{"slug":"oip-cloudflare-pages-integration","title":"Cloudflare Pages Integration with OIP","body":"Cloudflare Pages integration defines the deployment of static web assets and serverless functions as an Object Invocation Protocol (OIP) work object. This object specifies the source repository, build configuration, and environment variables for a Cloudflare Pages project. Invocation of this object via `/api/dispatch` initiates a deployment process. The resulting receipt confirms the successful provisioning and update of the Cloudflare Pages site. Conformant behavior ensures the deployed assets are accessible at the specified Uniform Resource Locator (URL).\n\n## Cloudflare Pages Integration Definition\nCloudflare Pages integration is an OIP work object that orchestrates the deployment of web projects to Cloudflare Pages. This object encapsulates the necessary configuration for a Cloudflare Pages site, including repository details, build commands, and environment variables. The `/api/dispatch` route processes this object, triggering the Cloudflare Pages deployment pipeline. A successful deployment yields a receipt, proving the site's update or creation. The conformant behavior is the public availability of the deployed application at its designated URL.\n\n## Cloudflare Pages Deployment Object\nThe Cloudflare Pages deployment object is a JavaScript Object Notation (JSON) structure submitted to the OIP Application Programming Interface (API) for deploying a web project. This object specifies the `key` as `oip-cloudflare-pages-deploy` and includes a `body` containing deployment parameters. The `body` includes `projectName`, `repositoryUrl`, `branch`, `buildCommand`, `publishDirectory`, and `environmentVariables`. The `oip-cloudflare-pages-deploy` object is invoked via `POST /api/dispatch {key: \"oip-cloudflare-pages-deploy\", body: {...}}`.\n\n```json\n{\n  \"key\": \"oip-cloudflare-pages-deploy\",\n  \"body\": {\n    \"projectName\": \"my-oip-app\",\n    \"repositoryUrl\": \"https://github.com/user/my-oip-app.git\",\n    \"branch\": \"main\",\n    \"buildCommand\": \"npm run build\",\n    \"publishDirectory\": \"dist\",\n    \"environmentVariables\": {\n      \"OIP_API_URL\": \"https://miscsubjects.com/api/dispatch\"\n    }\n  }\n}\n```\n\n## Invocation Mechanism\nThe invocation mechanism for Cloudflare Pages deployment utilizes the OIP `/api/dispatch` route. A client sends an HTTP `POST` request to `https://miscsubjects.com/api/dispatch` with a JSON payload representing the `oip-cloudflare-pages-deploy` object. This action appends the invocation request to the OIP ledger. The OIP system then processes the request, interacting with the Cloudflare Pages API to initiate the deployment. The invocation returns a receipt identifier (`inv_ID`) for tracking the operation's status.\n\n## Deployment Receipt\nA deployment receipt is a JSON document returned by the OIP system, proving the successful initiation or completion of a Cloudflare Pages deployment. This receipt is retrieved by querying `/api/dispatch?receipt=inv_ID` where `inv_ID` is the identifier received from the initial invocation. The receipt includes `invocationId`, `status`, `deploymentId`, `siteName`, and `url`. The `status` field indicates the state of the deployment process, such as `initiated` or `completed`. The `url` field specifies the public Uniform Resource Locator (URL) of the deployed Cloudflare Pages site.\n\n```json\n{\n  \"invocationId\": \"inv_1234567890abcdef\",\n  \"status\": \"completed\",\n  \"objectKey\": \"oip-cloudflare-pages-deploy\",\n  \"timestamp\": \"2023-10-27T10:00:00Z\",\n  \"details\": {\n    \"deploymentId\": \"cf_deploy_abc123def456\",\n    \"siteName\": \"my-oip-app\",\n    \"url\": \"https://my-oip-app.pages.dev\",\n    \"cloudflareProjectId\": \"cf_proj_xyz789\"\n  }\n}\n```\n\n## Ledger Record\nThe ledger record for a Cloudflare Pages deployment invocation is an immutable entry within the OIP ledger. Every invocation to `POST /api/dispatch` appends a record of the `oip-cloudflare-pages-deploy` object and its `body` to the ledger. This record includes the `invocationId`, `timestamp`, and the full JSON payload of the invoked object. The ledger provides an auditable history of all deployment operations, enabling replay and repair mechanisms as part of the OIP loop (object, invoke, ledger, receipt, replay, repair). Access to ledger records is available via specific OIP API routes, such as `/api/dispatch?ledger=inv_ID`.\n\n## End-to-End Deployment Example\nThis example demonstrates invoking a Cloudflare Pages deployment using `curl`, a Command Line Interface (CLI) tool for transferring data with URLs. The invocation deploys a project from a GitHub repository.\n\n```bash\ncurl -X POST https://miscsubjects.com/api/dispatch \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"key\": \"oip-cloudflare-pages-deploy\",\n    \"body\": {\n      \"projectName\": \"example-oip-site\",\n      \"repositoryUrl\": \"https://github.com/miscsubjects/example-oip-site.git\",\n      \"branch\": \"main\",\n      \"buildCommand\": \"npm install && npm run build\",\n      \"publishDirectory\": \"public\",\n      \"environmentVariables\": {\n        \"API_ENDPOINT\": \"https://api.example.com\"\n      }\n    }\n  }'\n```\n\nUpon successful invocation, the OIP API returns an `invocationId`:\n\n```json\n{\n  \"invocationId\": \"inv_abcdef1234567890\",\n  \"status\": \"initiated\"\n}\n```\n\nTo retrieve the deployment receipt, use the `invocationId`:\n\n```bash\ncurl \"https://miscsubjects.com/api/dispatch?receipt=inv_abcdef1234567890\"\n```\n\nThe receipt confirms the deployment status and details:\n\n```json\n{\n  \"invocationId\": \"inv_abcdef1234567890\",\n  \"status\": \"completed\",\n  \"objectKey\": \"oip-cloudflare-pages-deploy\",\n  \"timestamp\": \"2023-10-27T10:05:30Z\",\n  \"details\": {\n    \"deploymentId\": \"cf_deploy_xyz987abc654\",\n    \"siteName\": \"example-oip-site\",\n    \"url\": \"https://example-oip-site.pages.dev\",\n    \"cloudflareProjectId\": \"cf_proj_def321\"\n  }\n}\n```\n\n## Receipt Validation Rule\nA Cloudflare Pages deployment receipt is valid if it contains an `invocationId` matching the initial request, a `status` of `completed`, and a `details` object with `deploymentId`, `siteName`, and a valid `url` pointing to the deployed resource. The `objectKey` field must be `oip-cloudflare-pages-deploy`. The presence of these fields confirms the OIP system's successful interaction with Cloudflare Pages and the availability of deployment specifics.\n\n## Conformance Rule\nConformant behavior for a Cloudflare Pages integration requires that an `oip-cloudflare-pages-deploy` object, when successfully invoked and receipted, results in a publicly accessible web application or static site at the `url` specified in the receipt's `details`. The content served at this URL must correspond to the source repository and build configuration defined in the original OIP object. Any deviation from the expected content or accessibility constitutes non-conformance.\n\n## Cloudflare Pages Deployment and Model Context Protocol\nCloudflare Pages deployment within OIP focuses on the automated provisioning and updating of web assets and serverless functions. The Model Context Protocol (MCP) defines how a model connects to a server that exposes tools, resources, and prompts over a session. An OIP Cloudflare Pages deployment object specifies the infrastructure for a web application, while an MCP session defines the operational context for a computational model. An OIP deployment provides the hosting environment for a web application; an MCP session provides the execution environment for a model. A deployed OIP application on Cloudflare Pages can serve as a front-end for an MCP-driven backend, where the application interacts with an MCP server via its API. The OIP object defines the static deployment; the MCP session defines the dynamic interaction.","register":"oip_protocol","tags":["oip","object-invocation-protocol","protocol-specification","machine-native-json","dynamic"],"style":{"accent":"#16324f","measure":860},"claims":[{"id":"oip-c1","tier":"system","text":"The OIP article layer is generated from live directory rows, so it documents the objects that actually run the reference implementation.","who_claims":"system/oip_articles","source_ids":["oip-s3","oip-s4"]},{"id":"oip-c2","tier":"system","text":"The OIP operating path is caller to directory object to dispatch runner to invocation ledger to receipt.","who_claims":"system/oip_articles","source_ids":["oip-s1"]},{"id":"oip-c3","tier":"system","text":"Every executable capability in the reference implementation is reachable as an OIP object with a human article, a machine document, invocation history, and receipt path.","who_claims":"system/oip_articles","source_ids":["oip-s2","oip-s3"]},{"id":"oip-c4","tier":"system","text":"Tap & Go is the copy primitive: one drop carries credential, protocol, tree, search, execute, and receipt instructions without a separate token-map-bundle assembly step.","who_claims":"system/oip_articles","source_ids":["oip-s2"]},{"id":"oip-c5","tier":"system","text":"OIP receipts are the proof object for actions: they record request, response, actor, links, replay, repair, and lineage.","who_claims":"system/oip_articles","source_ids":["oip-s2","oip-s5"]}],"sources":[{"id":"oip-s1","type":"protocol","title":"BUILD_SPEC object invocation path","url":"https://miscsubjects.com/api/file/docs/BUILD_SPEC.md","summary":"Defines directory rows, dispatch, ledger, and the escalation path for changing the build.","quote":"Run anything: POST https://miscsubjects.com/api/dispatch {key, body}","claim_ids":["oip-c2"],"link_status":"ok","hash":"oipbuildspec0001"},{"id":"oip-s2","type":"protocol","title":"Object Invocation Protocol spec","url":"https://miscsubjects.com/api/file/docs/OIP.md","summary":"Defines OIP surfaces, invariant loop, receipt/replay/repair, and invocation envelopes.","quote":"identify, explain, invoke, ledger, yield","claim_ids":["oip-c3","oip-c4","oip-c5"],"link_status":"ok","hash":"oipspec00000002"},{"id":"oip-s3","type":"protocol","title":"Live OIP capability tree","url":"https://miscsubjects.com/api/dispatch?map=1&format=markdown","summary":"Public recursive capability tree.","quote":"root > shelf > system article > capability article > receipt","claim_ids":["oip-c1","oip-c3"],"link_status":"ok","hash":"oipmap0000000002"},{"id":"oip-s4","type":"protocol","title":"Directory row documentation","url":"https://miscsubjects.com/api/dispatch?key=OIP_TREE&format=markdown","summary":"Capability articles are generated from live rows.","quote":"Machine Contract","claim_ids":["oip-c1"],"link_status":"ok","hash":"oiprow0000000003"},{"id":"oip-s5","type":"protocol","title":"Invocation ledger","url":"https://miscsubjects.com/api/invocations","summary":"Append-only invocation records and receipt links.","quote":"invocations","claim_ids":["oip-c5"],"link_status":"ok","hash":"oipinvocations0005"}],"prov":{"model":"system/oip_articles","action":"generate"}}