code60-transmission-server 0.0.0-stage → 0.1.0-staging.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/LICENSE +180 -0
  2. package/README.engine.md +463 -0
  3. package/README.md +376 -2
  4. package/dist/src/broker/filesystem.js +385 -0
  5. package/dist/src/broker/index.js +734 -0
  6. package/dist/src/broker/native/README.md +207 -0
  7. package/dist/src/broker/native/build.js +46 -0
  8. package/dist/src/broker/native/command-helper.c +93 -0
  9. package/dist/src/broker/native/fs-helper.c +529 -0
  10. package/dist/src/broker/native/git-helper.c +205 -0
  11. package/dist/src/broker/policy.js +149 -0
  12. package/dist/src/broker/startup-lock.js +14 -0
  13. package/dist/src/broker/types.js +11 -0
  14. package/dist/src/cli/configure.js +208 -0
  15. package/dist/src/cli/daemon.js +369 -0
  16. package/dist/src/cli/helpers.js +112 -0
  17. package/dist/src/cli/main.js +189 -0
  18. package/dist/src/cli/runtime-build.js +38 -0
  19. package/dist/src/config/coding-policy.js +4 -0
  20. package/dist/src/config/deployment.js +183 -0
  21. package/dist/src/config/documents.js +29 -0
  22. package/dist/src/config/profile-validation.js +129 -0
  23. package/dist/src/config/schema-graph.js +237 -0
  24. package/dist/src/config/schema-loader.js +185 -0
  25. package/dist/src/config/validation-pool.js +105 -0
  26. package/dist/src/config/validation-protocol.js +1 -0
  27. package/dist/src/config/validation-worker.js +106 -0
  28. package/dist/src/config/workflow-language.js +9 -0
  29. package/dist/src/config/workflow-schema.json +545 -0
  30. package/dist/src/config/workflow-types.js +1 -0
  31. package/dist/src/config/workflow-validation.js +95 -0
  32. package/dist/src/engine/budgets.js +50 -0
  33. package/dist/src/engine/clocks.js +27 -0
  34. package/dist/src/engine/commands.js +477 -0
  35. package/dist/src/engine/contracts.js +11 -0
  36. package/dist/src/engine/drain-state.js +31 -0
  37. package/dist/src/engine/effective-permissions.js +120 -0
  38. package/dist/src/engine/instruction-pins.js +205 -0
  39. package/dist/src/engine/retries.js +50 -0
  40. package/dist/src/engine/state.js +1 -0
  41. package/dist/src/engine/timing.js +23 -0
  42. package/dist/src/engine/tool-observations.js +87 -0
  43. package/dist/src/engine/workflow-engine.js +1862 -0
  44. package/dist/src/main.js +28 -0
  45. package/dist/src/mcp/catalog.js +71 -0
  46. package/dist/src/mcp/main.js +26 -0
  47. package/dist/src/mcp/server.js +177 -0
  48. package/dist/src/runtime/codex-app-server.js +91 -0
  49. package/dist/src/runtime/codex-executable.js +50 -0
  50. package/dist/src/runtime/containment.js +82 -0
  51. package/dist/src/runtime/engine-driver.js +221 -0
  52. package/dist/src/runtime/json-line-writer.js +192 -0
  53. package/dist/src/runtime/pinned-instruction-sources.js +24 -0
  54. package/dist/src/runtime/protocol-client.js +264 -0
  55. package/dist/src/runtime/protocol-pool.js +183 -0
  56. package/dist/src/runtime/protocol-projection.js +393 -0
  57. package/dist/src/runtime/protocol-types.js +1 -0
  58. package/dist/src/runtime/protocol-worker.js +18 -0
  59. package/dist/src/runtime/provider-bridge.js +290 -0
  60. package/dist/src/runtime/provider-credentials.js +41 -0
  61. package/dist/src/runtime/provider-transport.js +406 -0
  62. package/dist/src/runtime/runtime-broker.js +213 -0
  63. package/dist/src/runtime/workspace-instructions.js +120 -0
  64. package/dist/src/runtime/workspace-view.js +74 -0
  65. package/dist/src/server/api-contract.json +11629 -0
  66. package/dist/src/server/api-types.js +1 -0
  67. package/dist/src/server/application.js +44 -0
  68. package/dist/src/server/auth.js +67 -0
  69. package/dist/src/server/broker-handlers.js +242 -0
  70. package/dist/src/server/coding.js +281 -0
  71. package/dist/src/server/control-plane.js +50 -0
  72. package/dist/src/server/deployment.js +249 -0
  73. package/dist/src/server/errors.js +22 -0
  74. package/dist/src/server/history-handlers.js +127 -0
  75. package/dist/src/server/http.js +124 -0
  76. package/dist/src/server/paging.js +56 -0
  77. package/dist/src/server/publication.js +119 -0
  78. package/dist/src/server/tool-event-handler.js +77 -0
  79. package/dist/src/server/workspace-handlers.js +34 -0
  80. package/dist/src/storage/coordinator.js +224 -0
  81. package/dist/src/storage/startup-lock.js +71 -0
  82. package/dist/src/storage/store.js +167 -0
  83. package/dist/src/tools/check-worker.js +81 -0
  84. package/dist/src/tools/checks.js +117 -0
  85. package/dist/src/tools/command-check.js +34 -0
  86. package/dist/src/tools/commands.js +312 -0
  87. package/dist/src/tools/developer.js +353 -0
  88. package/dist/src/tools/dns.js +248 -0
  89. package/dist/src/tools/http-contract.js +38 -0
  90. package/dist/src/tools/http.js +358 -0
  91. package/dist/src/tools/index.js +194 -0
  92. package/dist/src/tools/worker-check.js +73 -0
  93. package/dist/src/workspaces/git.js +227 -0
  94. package/dist/src/workspaces/index.js +937 -0
  95. package/dist/src/workspaces/source.js +295 -0
  96. package/examples/deployment.local.json +22 -0
  97. package/package.json +71 -4
  98. package/scripts/postinstall.mjs +26 -0
package/LICENSE ADDED
@@ -0,0 +1,180 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by the Licensor or on behalf
58
+ of the Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the Licensor as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of the Licensor who has received a Contribution and
64
+ subsequently incorporated it into the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Work; and
105
+
106
+ (d) If the Work includes a "Notice" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such Notice file, in at least one of the following
110
+ places: within a Notice file distributed as part of the Work;
111
+ within the Source form or documentation, if provided along with
112
+ the Derivative Works; or, within a display generated by the
113
+ Derivative Works, if and wherever such third-party notices
114
+ appear. The contents of the Notice file are for informational
115
+ purposes only and do not modify the License. You may add
116
+ Your own attribution notices within Derivative Works that You
117
+ distribute, alongside or as part of the Notice file from the
118
+ Work, provided that You do not modify the License.
119
+
120
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
121
+ any Contribution intentionally submitted for inclusion in the Work
122
+ by You to the Licensor shall be under the terms and conditions of
123
+ this License, without any additional terms or conditions.
124
+ Notwithstanding the above, nothing herein shall supersede or modify
125
+ the terms of any separate licensing agreement you may have with
126
+ the Licensor.
127
+
128
+ 6. Trademarks. This License does not grant permission to use the trade
129
+ names, trademarks, service marks, or product names of the Licensor,
130
+ except as required for reasonable and customary use in describing the
131
+ Work and reproducing the rest of the License.
132
+
133
+ 7. Disclaimer of Warranty. Unless required by applicable law or
134
+ agreed to in writing, Licensor provides the Work (and each
135
+ Contributor provides its Contributions) on an "AS IS" BASIS,
136
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
137
+ implied, including but not limited to the warranties of
138
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, or
139
+ NON-INFRINGEMENT. You are solely responsible for determining the
140
+ appropriateness of using or redistributing the Work and assume any
141
+ risks associated with Your exercise of permissions under this License.
142
+
143
+ 8. Limitation of Liability. In no event and under no legal theory,
144
+ whether in tort (including negligence), contract, or otherwise,
145
+ unless required by applicable law (such as deliberate and grossly
146
+ negligent acts) or agreed to in writing, shall any Contributor be
147
+ liable to You for damages, including any direct, indirect, special,
148
+ incidental, or consequential damages of any character arising as a
149
+ result of this License or out of the use or inability to use the
150
+ Work (including but not limited to damages for loss of goodwill,
151
+ work stoppage, computer failure or malfunction, or any and all
152
+ other commercial damages or losses), even if such Contributor
153
+ has been advised of the possibility of such damages.
154
+
155
+ 9. Accepting Warranty or Additional Liability. While redistributing
156
+ the Work or Derivative Works thereof, You may choose to offer,
157
+ and charge a fee for, acceptance of support, warranty, or indemnity
158
+ obligations and/or other liability obligations and/or rights
159
+ consistent with this License. However, in accepting such obligations,
160
+ You may act only on Your own behalf and on Your own responsibility,
161
+ and not on behalf of any other Contributor, and only if You agree
162
+ to indemnify, defend, and hold each Contributor harmless for any
163
+ liability incurred by, or claims asserted against, such Contributor
164
+ by reason of your accepting any such warranty or additional liability.
165
+
166
+ END OF TERMS AND CONDITIONS
167
+
168
+ Copyright 2026 Code Manufactory LLC
169
+
170
+ Licensed under the Apache License, Version 2.0 (the "License");
171
+ you may not use this file except in compliance with the License.
172
+ You may obtain a copy of the License at
173
+
174
+ http://www.apache.org/licenses/LICENSE-2.0
175
+
176
+ Unless required by applicable law or agreed to in writing, software
177
+ distributed under the License is distributed on an "AS IS" BASIS,
178
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
179
+ See the License for the specific language governing permissions and
180
+ limitations under the License.
@@ -0,0 +1,463 @@
1
+ # Workflow engine
2
+
3
+ The server runs sequential agent steps in Git workspaces, stores durable state
4
+ in SQLite, and brokers tool access through engine-owned permissions and approvals.
5
+
6
+ For first setup, see [README.md](README.md) and the loadable
7
+ [local deployment example](examples/deployment.local.json).
8
+ For a complete live-model run, use the
9
+ [hello-world example](examples/hello-world/README.md): `npm run example:hello-world`.
10
+
11
+ ## Normal entry point
12
+
13
+ The emitted server entry point is `dist/src/main.js`, also available through
14
+ `npm start -- <arguments>`. It does not build anything automatically. It requires all five arguments, with absolute paths:
15
+
16
+ ```text
17
+ --state-directory /private/owned/engine-state
18
+ --fs-helper /absolute/owned/fs-helper
19
+ --git-helper /absolute/owned/git-helper
20
+ --configuration /private/owned/configuration.json
21
+ --operator-token-file /private/owned/operator.token
22
+ ```
23
+
24
+ Use the supported Node 24 version declared in `package.json`. `npm run build`,
25
+ `npm test` and `npm run test:pilot` invoke the native build; they are not
26
+ TypeScript-only validation shortcuts. The build compiles both C helpers. Keep
27
+ native runs serial and do not rebuild images used by a preserved-image run.
28
+
29
+ The state directory must already exist, be owned by the current user, and have
30
+ mode `0700`. Configuration and token files must be owned regular files with no
31
+ group/other access, symlinks or hardlinks. The token file contains a randomly
32
+ generated URL-safe token of 32 through 512 characters, optionally with surrounding
33
+ whitespace. Never put a token in a command argument or configuration JSON.
34
+
35
+ There is no home/environment configuration or login discovery. The API listens
36
+ only on `127.0.0.1`. A deployment wishing to expose it remotely must separately
37
+ provide an authenticated, appropriately secured ingress.
38
+
39
+ Use [examples/deployment.local.json](examples/deployment.local.json) as the strict
40
+ JSON starting point. Install a private `0600` copy, replace uppercase placeholders,
41
+ and choose unused ports. Its focused test copies the exact checked-in bytes for
42
+ real-loader validation without relaxing private-file rules or launching the
43
+ placeholder executable.
44
+
45
+ A minimal disabled configuration has this shape. Replace its deployment paths,
46
+ ports and model selection with values advertised by your installation:
47
+
48
+ ```json
49
+ {
50
+ "listenPort": 31260,
51
+ "operator": { "id": "local-operator", "workspaceIds": ["*"] },
52
+ "runtime": {
53
+ "enabled": false,
54
+ "executable": "/absolute/owned/codex",
55
+ "modelPort": 31261,
56
+ "models": [{ "id": "deployment-configured-local-model", "effortLevels": [] }]
57
+ },
58
+ "deploymentPolicy": { "defaultEffect": "deny", "rules": [] },
59
+ "agentHttp": {},
60
+ "schemaHttp": { "networkPolicy": { "defaultEffect": "deny", "rules": [] } },
61
+ "checks": [],
62
+ "deploymentRoots": []
63
+ }
64
+ ```
65
+
66
+ `"*"` explicitly authorizes this operator for every registered workspace.
67
+ Otherwise list exact workspace IDs. Startup rotates this configured operator's
68
+ token and revokes previously configured operator identities.
69
+
70
+ `enabled: false` advertises the runtime as unavailable/requiring configuration.
71
+ Enable it only after selecting the actual executable/model and providing an
72
+ owned loopback Responses-compatible provider. Runtime `codex-local` retains the explicit
73
+ local provider `code60-local`, using the configured loopback model port and model
74
+ IDs. Advertise only effort
75
+ levels actually supported by that model (`none`, `minimal`, `low`, `medium`,
76
+ `high`, `xhigh` are the representable protocol values).
77
+
78
+ The only runtime option is `artifactFormat: "json" | "yaml"`. Additional HTTPS
79
+ Responses providers use the optional configuration below. Arbitrary runtime
80
+ options, ambient credentials and implicit login discovery remain unsupported.
81
+ The generic publication service is not narrowed to local providers.
82
+
83
+ ## Operator API walkthrough
84
+
85
+ This request sequence uses the normal deployment's HTTP API. The base URL is
86
+ `http://127.0.0.1:<listenPort>/api/v1`. Every request needs the configured operator
87
+ Bearer token. Use a client that reads that private token without printing it,
88
+ embedding it in a URL, or exposing it in process arguments or saved request logs.
89
+ There is no browser login, token-discovery endpoint or unauthenticated health
90
+ route.
91
+
92
+ 1. **Discover actual deployment support.** GET `/runtimes`, then
93
+ `/runtimes/<runtimeId>/configuration`, and GET `/checks`. An unavailable
94
+ runtime is not made usable by publishing a profile. Choose only the returned
95
+ provider/model/effort, tool configurations and named checks. The reference
96
+ examples' `runtime_001` is not the normal deployment's `codex-local`.
97
+ 2. **Register an explicitly authorized, existing disposable Git worktree.**
98
+ POST `/workspaces` with a body such as
99
+ `{"name":"first-workspace","repositoryPath":"/absolute/owned/disposable-worktree","scratchPaths":[]}`.
100
+ Registration requires an unrestricted operator, returns `201` with a
101
+ workspace `id`, `Location` and `ETag`, and does not clone or clean a repository.
102
+ Never attach a user repository merely to test setup.
103
+ 3. **Publish a complete worker profile.** POST `/agent-profiles` with the
104
+ following shape, replacing the model with an actually advertised selection.
105
+ This minimal profile deliberately enables no tools. Real tools also require
106
+ matching profile and outer deployment permissions; approval cannot override
107
+ a hard denial.
108
+
109
+ ```json
110
+ {
111
+ "name": "first-worker",
112
+ "initialVersion": {
113
+ "definition": {
114
+ "role": "worker",
115
+ "runtime": {
116
+ "runtimeId": "codex-local",
117
+ "provider": "code60-local",
118
+ "model": "deployment-configured-local-model",
119
+ "options": {},
120
+ "credentialRefs": {}
121
+ },
122
+ "tools": [],
123
+ "permissions": { "defaultEffect": "deny", "rules": [] },
124
+ "instructions": [{ "kind": "inline", "text": "Return the assigned JSON artifact without Markdown." }]
125
+ },
126
+ "resources": []
127
+ }
128
+ }
129
+ ```
130
+
131
+ Record the returned profile's **`latestVersionId`**, not its profile `id`.
132
+ Optional preflight POST `/agent-profile-validations` takes the `initialVersion`
133
+ object itself and returns a validation report, not a published version.
134
+ HTTPS selections additionally need the configured credential reference below;
135
+ never substitute credential bytes.
136
+ 4. **Publish an immutable workflow package.** For example, use this YAML as the
137
+ source content, replacing the worker version ID with the preceding response:
138
+
139
+ ```yaml
140
+ kind: Workflow
141
+ version: "1"
142
+ metadata:
143
+ name: first-workflow
144
+ config:
145
+ agent-profiles:
146
+ worker: worker_profile_version_from_response
147
+ steps:
148
+ - id: first-step
149
+ execution:
150
+ max-session-resets: 1
151
+ max-attempts-per-session: 2
152
+ exitArtifact:
153
+ schema:
154
+ type: object
155
+ required: [answer]
156
+ properties:
157
+ answer: { type: string }
158
+ additionalProperties: false
159
+ exitCriteria:
160
+ semantic:
161
+ criteria: []
162
+ verifier:
163
+ session: ephemeral
164
+ max-attempts: 1
165
+ ```
166
+
167
+ POST `/workflows` with
168
+ `{"name":"first-workflow","initialVersion":{"source":{"format":"yaml","content":"<the complete YAML source>"}}}`.
169
+ Use a JSON serializer for the source string. Optional preflight
170
+ `/workflow-validations` takes the `initialVersion` object, not the create
171
+ wrapper. An empty semantic criterion list needs no verifier session/profile;
172
+ enabling criteria requires an explicit complete verifier profile and finite
173
+ role bounds. Record the returned workflow's **`latestVersionId`**.
174
+ 5. **Admit and observe a run.** POST `/runs` with
175
+ `{"workspaceId":"<workspace id>","workflowVersionId":"<workflow version id>"}`.
176
+ `202` means admitted, not completed. Follow its run `Location`; inspect the
177
+ run's state and independent `executionControl`, `approvalWait` and pending
178
+ blocks. Under `/runs/<id>`, GET the `/steps`, `/sessions`, `/submissions`,
179
+ `/artifacts`, `/blocks`, `/baselines` and `/instruction-snapshots` collections.
180
+ GET `/runs/<id>/events?waitSeconds=30` supports bounded long-polling.
181
+ Follow each `nextCursor` until `null`, keeping the same collection and
182
+ authenticated scope.
183
+ 6. **Use explicit, conditional controls.** Fetch the target run, block, action
184
+ or approval's current `ETag` before its conditional POST and send it as
185
+ `If-Match`. Pause/resume bodies are `{"reason":"..."}`. Their `202` response is
186
+ an operation: follow its `Location` until success, failure or a required
187
+ decision. An accepted pause is still draining until genuinely quiescent;
188
+ resuming never clears a separate approval, budget or external-change hold.
189
+ Missing conversations require explicit recovery, not an implicit resume.
190
+
191
+ All POSTs require `Content-Type: application/json` and a nonempty
192
+ `Idempotency-Key` (at most 200 characters). Preserve a request's exact body and
193
+ key to retrieve its original receipt after a lost response; a changed body under
194
+ that key is `409`, not a new command. Conditional POSTs require `If-Match`:
195
+ missing is `428`, stale is `412`. Obtain a fresh ETag and make a new deliberate
196
+ request instead of blindly retrying a state conflict. Adapter routes use
197
+ engine-issued session credentials plus `X-Session-Epoch`; an operator token is
198
+ not adapter authority, and fenced adapters cannot resurrect old receipts.
199
+
200
+ The complete request bodies and response/Problem shapes are in
201
+ [the OpenAPI contract](reference/workflow-engine/api/openapi.yaml).
202
+ The API is not permission to start a model or mutate a repository without
203
+ the operator's explicit selection and authorization.
204
+
205
+ ## Configured HTTPS providers
206
+
207
+ Add explicit `providers` and `providerCredentials` arrays to the configuration.
208
+ For example, replacing the documentation-only hosts, addresses and file path:
209
+
210
+ ```json
211
+ {
212
+ "providers": [{
213
+ "id": "configured-provider",
214
+ "endpoint": "https://model.example/v1/responses",
215
+ "models": [{ "id": "configured-model", "effortLevels": ["low", "high"], "defaultEffort": "high" }],
216
+ "maxRequestBytes": 67108864,
217
+ "timeoutMs": 30000,
218
+ "maxConcurrent": 2,
219
+ "dnsResolvers": [{ "address": "192.0.2.53", "port": 53 }],
220
+ "networkPolicy": {
221
+ "defaultEffect": "deny",
222
+ "rules": [
223
+ { "kind": "network", "protocol": "https", "host": "model.example", "port": 443, "effect": "allow" },
224
+ { "kind": "network", "protocol": "https", "host": "198.51.100.20", "port": 443, "effect": "allow" },
225
+ { "kind": "network", "protocol": "udp", "host": "192.0.2.53", "port": 53, "effect": "allow" },
226
+ { "kind": "network", "protocol": "tcp", "host": "192.0.2.53", "port": 53, "effect": "allow" }
227
+ ]
228
+ }
229
+ }],
230
+ "providerCredentials": [{
231
+ "referenceId": "configured-provider-reference",
232
+ "version": "deployment-v1",
233
+ "providerId": "configured-provider",
234
+ "origin": "https://model.example",
235
+ "file": "/private/owned/provider.token"
236
+ }]
237
+ }
238
+ ```
239
+
240
+ The endpoint is a complete fixed HTTPS URL ending in `/responses`, without user
241
+ information, query or fragment. Model requests cannot change its method, path,
242
+ origin or headers. Every resolved IP needs its own network authority, including
243
+ unused answers. Zero or one explicit numeric resolver is supported. Hostnames
244
+ require that resolver plus both UDP and TCP permission; numeric HTTPS endpoints
245
+ need no DNS. There is no address/server fallback, ambient DNS, proxy, redirect or
246
+ transport retry.
247
+
248
+ Credential files follow the configuration/token file's private ownership and
249
+ no-alias rules. They contain 1–8192 printable ASCII token bytes, optionally
250
+ followed by one newline. The engine preloads them once. Only reference IDs,
251
+ versions, provider grants and origins enter descriptions; raw secrets never
252
+ enter configuration JSON, profiles, history, process arguments or diagnostics.
253
+ Credential lookup happens only after exact TLS identity and peer verification.
254
+ Do not use the legacy local-model port as an unauthenticated billable relay.
255
+
256
+ A profile selects `runtimeId: "codex-local"`, the configured provider/model,
257
+ optional supported `effort`, and
258
+ `credentialRefs: { "provider": "configured-provider-reference" }`. The runtime
259
+ advertises the `provider` slot, not an invented `apiKey` slot. Omitted effort uses
260
+ that model's explicit administrative `defaultEffort`. Provider/origin/version
261
+ mismatches fail before launching a process.
262
+
263
+ Each session gets a separate ephemeral loopback listener and random capability.
264
+ The contained process may contact only that port. The bridge also requires a
265
+ currently active generation and the actual Core admission predicate, including
266
+ session/epoch, pause, approval holds, assignment, deadlines and remaining role
267
+ allowance. Containment and knowledge of a local port are not model authority.
268
+
269
+ Requests spool into a private engine-only sibling directory, outside the
270
+ contained process's writable state. Bounded pure workers strictly validate the
271
+ original JSON bytes and pinned model/effort before provider contact.
272
+ `maxRequestBytes` is an explicit finite provider-input policy, not an artifact
273
+ schema size cap or truncation rule. Resource exhaustion fails visibly; it does
274
+ not manufacture a successful shortened artifact.
275
+
276
+ The engine records each request's scoped metadata and exact-byte digest before
277
+ contact, then records its terminal outcome after physical settlement. No request
278
+ body, provider error, capability or secret enters that ledger. Unfinished markers
279
+ become uncertain on recovery; old requests are never silently resent. Codex's
280
+ request and stream retries are disabled. Explicit engine retries still use the
281
+ existing shared durable retry allowance and execution clocks. Ordinary provider
282
+ round trips are not artifact submissions, and repeated admission checks neither
283
+ charge nor refill any allowance.
284
+
285
+ Response streaming preserves bytes and backpressure. Only successful JSON/SSE
286
+ content types and safe headers pass through; a literal credential echo is fatal.
287
+ Shutdown counts spool I/O, validation workers, request/response callbacks and
288
+ physical socket close before releasing ownership. Failed settlement bookkeeping
289
+ retains a barrier rather than declaring the run quiet.
290
+
291
+ Filesystem tool configuration comes from the actual tool registry. Deployment
292
+ roots, when needed, are explicitly registered as `{ "id": "...", "path": "..." }`
293
+ directory entries. Outer deployment policy defaults to deny. Agent HTTP and
294
+ administrative schema fetching use separate network policies, with explicit
295
+ numeric DNS settings and all-destination authorization, never ambient DNS.
296
+ Administrative transport does not silently impose a shorter default timeout than
297
+ the workflow's schema-fetch deadline. An explicitly configured `schemaHttp`
298
+ `timeoutMs` is a deployment transport bound and must cover permitted fetch times.
299
+
300
+ Named checks are deployment registrations with `id`, `description`, `version`
301
+ and either a fixed artifact `predicate` or a `command` with optional `cwd`, `env`
302
+ and `timeoutMs`. Command checks execute through the broker-owned command runner,
303
+ with source read-only. Declared generated/cache paths require profile and
304
+ deployment write authority; a read-only profile does not gain cache write access.
305
+ Passing evidence is pinned to the exact source revision and command definition. Changing source
306
+ requires fresh checks. Model-authored commands do not become acceptance checks.
307
+
308
+ ## Coding tasks
309
+
310
+ `POST /coding-tasks` accepts `task`, `repositoryPath` or `workspaceId`, optional
311
+ immutable `inputs`/`inputArtifacts`, a profile version, and command-check overrides.
312
+ The caller's idempotency key covers workspace/profile/workflow/run setup, including
313
+ reconnects. The default preset detects package-manager scripts named `typecheck`,
314
+ `lint`, `test`, and `build` and runs them with `CI=1`. Supply explicit commands for
315
+ other ecosystems or scripts that need noninteractive flags. Dependencies can be
316
+ installed by the worker; ignored dependency trees are not source checkpoints.
317
+
318
+ `GET /readiness` reports local setup, an actual contained app-server handshake,
319
+ command capabilities, quotas, and separately unverified provider authentication.
320
+ Use `code60 configure` and `code60 doctor` for setup. `commands.enabled` is false
321
+ for existing deployments unless configured. New coding configurations enable
322
+ general outbound access; `commands.network: none` selects offline execution.
323
+
324
+ `GET /runs/{runId}/result` returns the run-only diff, changed files, command logs,
325
+ check evidence, diagnostics, and `verified`, `pending_or_failed`, or `unverified`
326
+ status. Patch/output cursors count bytes and support bounded reads. Command output
327
+ also includes Base64 bytes for exact reconstruction across UTF-8 boundaries.
328
+ To inspect a command log, call `get_coding_task_result` with `runId`, `commandId`,
329
+ `stream`, `outputCursor`, and `outputLimit`; the HTTP result endpoint accepts
330
+ the same query parameters. Pending questions survive daemon shutdown; answer
331
+ them before recovering the interrupted conversation. Answers remain available
332
+ to the replacement worker through its context manifest.
333
+ `sourceQuotas`, command deadlines/output limits, and `contextBytes` are explicit
334
+ deployment settings. Supplemental model context defaults to 64 KiB; retrieval
335
+ tools expose pinned artifacts, schemas, history, messages, and immutable inputs.
336
+
337
+ New HTTP workspace registrations use Git-aware manifests by default. Linked
338
+ worktrees and binary/symlink source entries are supported. Historical checkpoints
339
+ remain readable. Starting a coding task upgrades an
340
+ existing idle registration to Git-aware tracking without changing working files;
341
+ active leases cannot be upgraded. Declared generated paths exclude untracked
342
+ output even when the project has no matching ignore rule; tracked files always
343
+ remain source. `sourceTracking: false` explicitly selects the legacy native format.
344
+ An existing commit is required. Submodules and unsupported entry types fail
345
+ preflight rather than being silently omitted.
346
+
347
+ `POST /runs/{runId}/messages` queues steering before acceptance. Worker questions
348
+ appear in `/runs/{runId}/questions` and the run's `inputWait`; answer through
349
+ `POST /questions/{questionId}/answers`. Questions retain the conversation and
350
+ freeze execution accounting without consuming submissions. Absolute authored
351
+ deadlines remain hard bounds. Restarted conversations require explicit recovery.
352
+
353
+ Coding tasks default to `resultMode: working_tree`, preserving HEAD and the
354
+ index. The starting dirty source state is the rollback baseline; ignored caches
355
+ are retained. Explicit `resultMode: commit` requires a clean source baseline.
356
+ Legacy commit-based workflows keep their original default.
357
+
358
+ If command settlement is uncertain, inspect the result's recovery preview and
359
+ provide `commandResolution: { sourceDigest, action }` to `recover_run` (or the
360
+ HTTP recovery endpoint). `action` is `preserve_changes` or `rollback`. The engine
361
+ requires stopped processes, the exact current preview digest, and unchanged Git
362
+ metadata before adopting or restoring command changes. It never resends the old
363
+ command automatically. Concurrent external edits during writing commands cannot
364
+ be reliably attributed; pause/stop commands before editing the project elsewhere.
365
+
366
+ ## Ownership and recovery
367
+
368
+ Startup acquires the inherited writer lock **before opening SQLite**, applying
369
+ migrations or constructing/recovering workspace and broker owners. Every service
370
+ shares one SQL coordinator. Existing sessions are fenced and runs are marked
371
+ interrupted, preserving explicit pause state and authored downtime accounting.
372
+ No provider conversation is reconnected. Resumption after process loss requires
373
+ the explicit recovery protocol.
374
+
375
+ All API operations use `createApplication`. New tool admission delegates
376
+ to the actual engine's read-only predicate. Trusted tool history commits inside
377
+ the broker completion transaction before effect work drains. Driver observations
378
+ deduplicate that record and cannot clear uncertain effects.
379
+
380
+ Workspace instruction bytes come from the owner's immutable active-lease
381
+ snapshot, before any session exists. `AGENTS.md`/`AGENTS.override.md` remain scoped USER
382
+ guidance, never system/developer instructions. Recovery reuses the original pins.
383
+
384
+ Shutdown stops the engine and awaits physical work before closing the broker,
385
+ workspace descriptors, database and inherited lock, in that order. An uncertain
386
+ journal prevents optimistic owner/barrier release and requires reconciliation.
387
+
388
+ ## Runtime containment
389
+
390
+ The installed Codex CLI runs as an app-server under a default-deny macOS Seatbelt
391
+ policy and an isolated runtime directory. HOME, CODEX_HOME and XDG locations
392
+ point into that directory; ambient credentials, proxies and user configuration
393
+ are not inherited. The process may execute only the selected runtime executable
394
+ and contact only its assigned loopback model port. Managed workspace access goes
395
+ through brokered tools, rather than direct runtime filesystem access.
396
+
397
+ The `/etc` and `/private/etc` compatibility exception permits metadata/existence
398
+ queries only. It grants neither file contents nor directory listing and does not
399
+ authorize broker/model access. Workspace `AGENTS.md` and `AGENTS.override.md`
400
+ content is discovered and pinned by the engine as scoped USER guidance.
401
+
402
+ Builds require Node 24.22.x, npm and the macOS command-line C toolchain. Packaging
403
+ emits TypeScript and builds both helpers under `dist/src/broker/native/.build`.
404
+ Pass trusted absolute helper paths to the server; runtime requests cannot select
405
+ source-tree fallback binaries or trigger compilation.
406
+
407
+ ## Validation
408
+
409
+ TypeScript checks and the focused example-loader check:
410
+
411
+ ```sh
412
+ npm run typecheck
413
+ node ./node_modules/typescript/bin/tsc -p tsconfig.build.json
414
+ node ./node_modules/vitest/vitest.mjs run tests/server/example-configuration.test.ts --maxWorkers=1
415
+ ```
416
+
417
+ The example test uses the actual private-file loader and emitted pure validation
418
+ workers; it does not launch a helper, sandbox, Codex or network listener.
419
+ Additional controlled provider checks:
420
+
421
+ ```sh
422
+ node ./node_modules/vitest/vitest.mjs run tests/server/deployment.test.ts tests/runtime/provider-bridge.test.ts tests/runtime/provider-credentials.test.ts tests/runtime/provider-driver.test.ts
423
+ ```
424
+
425
+ These explicit tests use controlled native/process ports and owned in-process
426
+ loopback TLS fixtures, not a live provider.
427
+
428
+ Build and full-tree test entry points, on macOS with the native prerequisites:
429
+
430
+ ```sh
431
+ npm run build
432
+ npm test
433
+ npm run test:pilot
434
+ ```
435
+
436
+ Both test scripts rebuild native helpers. Default native fixtures select those
437
+ built helpers; sanitizer variants compile separately. Normal-entrypoint and
438
+ restart suites run in this default mode without preserved-image prerequisites.
439
+ Installed-Codex fixtures resolve the explicit absolute `CODE60_CODEX_EXECUTABLE`
440
+ override first, otherwise `codex` on `PATH`, and fail clearly when it is missing.
441
+ Lookup does not launch Codex or read its configuration/credentials. Use
442
+ `--maxWorkers=1` to run native suites serially.
443
+
444
+ Packaged fixture mode remains optional for independently preserved images, not a
445
+ fresh-clone prerequisite. Do not enable it against newly compiled images.
446
+
447
+ To run suites that require existing preserved helper images:
448
+
449
+ ```sh
450
+ CODE60_NATIVE_FIXTURE_MODE=packaged node ./node_modules/vitest/vitest.mjs run tests \
451
+ --exclude=tests/workspaces/writer-barrier.test.ts \
452
+ --exclude=tests/pilot/broker-fs.test.ts \
453
+ --maxWorkers=1
454
+ ```
455
+
456
+ The exclusions are C-compiling fixtures. Packaged mode checks fixed existing
457
+ assets and skips unavailable sanitizer variants; it does not rebuild them.
458
+ Run clean-build and sanitizer suites separately with their required toolchain.
459
+
460
+ Fresh-process component measurements use emitted code, synthetic inputs and owned
461
+ TLS only: `node scripts/measure-provider-bridge.mjs plain-50m` (also
462
+ `search-escape`, `unicode`, `two-slots`). They do not prove installed Codex
463
+ compatibility or a global memory bound.