code60-transmission-server 0.1.0-staging.6 → 0.1.1

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 (104) hide show
  1. package/INTENT.md +47 -0
  2. package/README.md +87 -308
  3. package/dist/src/acp.js +130 -0
  4. package/dist/src/contract.js +133 -0
  5. package/dist/src/engine.js +650 -0
  6. package/dist/src/linux.js +84 -0
  7. package/dist/src/main.js +81 -25
  8. package/dist/src/repository.js +94 -0
  9. package/dist/src/service.js +196 -0
  10. package/package.json +19 -35
  11. package/reference/openapi.json +1073 -0
  12. package/README.engine.md +0 -463
  13. package/dist/src/broker/filesystem.js +0 -385
  14. package/dist/src/broker/index.js +0 -734
  15. package/dist/src/broker/native/README.md +0 -207
  16. package/dist/src/broker/native/build.js +0 -46
  17. package/dist/src/broker/native/command-helper.c +0 -93
  18. package/dist/src/broker/native/fs-helper.c +0 -529
  19. package/dist/src/broker/native/git-helper.c +0 -205
  20. package/dist/src/broker/policy.js +0 -149
  21. package/dist/src/broker/startup-lock.js +0 -14
  22. package/dist/src/broker/types.js +0 -11
  23. package/dist/src/cli/configure.js +0 -193
  24. package/dist/src/cli/daemon.js +0 -369
  25. package/dist/src/cli/helpers.js +0 -112
  26. package/dist/src/cli/main.js +0 -189
  27. package/dist/src/cli/runtime-build.js +0 -38
  28. package/dist/src/config/coding-policy.js +0 -4
  29. package/dist/src/config/deployment.js +0 -182
  30. package/dist/src/config/documents.js +0 -29
  31. package/dist/src/config/profile-validation.js +0 -123
  32. package/dist/src/config/schema-graph.js +0 -237
  33. package/dist/src/config/schema-loader.js +0 -185
  34. package/dist/src/config/validation-pool.js +0 -105
  35. package/dist/src/config/validation-protocol.js +0 -1
  36. package/dist/src/config/validation-worker.js +0 -106
  37. package/dist/src/config/workflow-language.js +0 -9
  38. package/dist/src/config/workflow-schema.json +0 -545
  39. package/dist/src/config/workflow-types.js +0 -1
  40. package/dist/src/config/workflow-validation.js +0 -95
  41. package/dist/src/engine/budgets.js +0 -50
  42. package/dist/src/engine/clocks.js +0 -27
  43. package/dist/src/engine/commands.js +0 -472
  44. package/dist/src/engine/contracts.js +0 -11
  45. package/dist/src/engine/drain-state.js +0 -31
  46. package/dist/src/engine/effective-permissions.js +0 -120
  47. package/dist/src/engine/instruction-pins.js +0 -205
  48. package/dist/src/engine/retries.js +0 -50
  49. package/dist/src/engine/state.js +0 -1
  50. package/dist/src/engine/timing.js +0 -23
  51. package/dist/src/engine/tool-observations.js +0 -87
  52. package/dist/src/engine/workflow-engine.js +0 -1862
  53. package/dist/src/mcp/catalog.js +0 -71
  54. package/dist/src/mcp/main.js +0 -26
  55. package/dist/src/mcp/server.js +0 -147
  56. package/dist/src/runtime/codex-app-server.js +0 -91
  57. package/dist/src/runtime/containment.js +0 -82
  58. package/dist/src/runtime/engine-driver.js +0 -221
  59. package/dist/src/runtime/json-line-writer.js +0 -192
  60. package/dist/src/runtime/pinned-instruction-sources.js +0 -24
  61. package/dist/src/runtime/protocol-client.js +0 -264
  62. package/dist/src/runtime/protocol-pool.js +0 -183
  63. package/dist/src/runtime/protocol-projection.js +0 -393
  64. package/dist/src/runtime/protocol-types.js +0 -1
  65. package/dist/src/runtime/protocol-worker.js +0 -18
  66. package/dist/src/runtime/provider-bridge.js +0 -290
  67. package/dist/src/runtime/provider-credentials.js +0 -41
  68. package/dist/src/runtime/provider-transport.js +0 -406
  69. package/dist/src/runtime/runtime-broker.js +0 -213
  70. package/dist/src/runtime/workspace-instructions.js +0 -120
  71. package/dist/src/runtime/workspace-view.js +0 -74
  72. package/dist/src/server/api-contract.json +0 -11614
  73. package/dist/src/server/api-types.js +0 -1
  74. package/dist/src/server/application.js +0 -44
  75. package/dist/src/server/auth.js +0 -67
  76. package/dist/src/server/broker-handlers.js +0 -242
  77. package/dist/src/server/coding.js +0 -254
  78. package/dist/src/server/control-plane.js +0 -50
  79. package/dist/src/server/deployment.js +0 -249
  80. package/dist/src/server/errors.js +0 -22
  81. package/dist/src/server/history-handlers.js +0 -127
  82. package/dist/src/server/http.js +0 -124
  83. package/dist/src/server/paging.js +0 -56
  84. package/dist/src/server/publication.js +0 -119
  85. package/dist/src/server/tool-event-handler.js +0 -77
  86. package/dist/src/server/workspace-handlers.js +0 -34
  87. package/dist/src/storage/coordinator.js +0 -224
  88. package/dist/src/storage/startup-lock.js +0 -71
  89. package/dist/src/storage/store.js +0 -167
  90. package/dist/src/tools/check-worker.js +0 -81
  91. package/dist/src/tools/checks.js +0 -117
  92. package/dist/src/tools/command-check.js +0 -34
  93. package/dist/src/tools/commands.js +0 -310
  94. package/dist/src/tools/developer.js +0 -351
  95. package/dist/src/tools/dns.js +0 -248
  96. package/dist/src/tools/http-contract.js +0 -38
  97. package/dist/src/tools/http.js +0 -358
  98. package/dist/src/tools/index.js +0 -194
  99. package/dist/src/tools/worker-check.js +0 -73
  100. package/dist/src/workspaces/git.js +0 -227
  101. package/dist/src/workspaces/index.js +0 -937
  102. package/dist/src/workspaces/source.js +0 -295
  103. package/examples/deployment.local.json +0 -22
  104. package/scripts/postinstall.mjs +0 -26
package/INTENT.md ADDED
@@ -0,0 +1,47 @@
1
+ # Transmission intent
2
+
3
+ Transmission gives a calling orchestrator a deterministic outer loop for long-running work. Each task starts in a fresh harness session to reduce context rot. A separate verifier evaluates the worker’s result. The orchestrator can rely on a small set of outcomes even when an individual task takes several attempts.
4
+
5
+ ## Priorities, in order
6
+
7
+ 1. Extremely low-friction setup for the user.
8
+ 2. Extremely low-friction setup for the user. The repetition is intentional.
9
+ 3. Autonomy over long runs. Failed tests, verifier feedback, and retries are ordinary parts of the work.
10
+ 4. Reasonable recovery from interruptions a developer encounters on one machine.
11
+ 5. Reasonably secure defaults within Transmission’s own sphere of responsibility.
12
+
13
+ ## From request to running workflow
14
+
15
+ The user describes what they want to accomplish. The calling orchestrator, acting through the harness, uses the MCP tool’s guidance to design a workflow. The caller defines the tasks, their order, and their completion criteria. The harness presents the workflow and asks the user to confirm it. Ordinary coding tasks should require no project-specific Transmission setup or knowledge of its orchestration API from the user.
16
+
17
+ That confirmation authorizes autonomous execution of the agreed scope. Transmission owns session lifecycle and workflow decisions. Automatic approval of decisions during execution is configurable and enabled by default. Return to the user only when their intent needs clarification, the scope needs to change, or the workflow genuinely cannot proceed.
18
+
19
+ ## Implementation and verification
20
+
21
+ Workers use the harness’s normal tools, command execution, and permissions. Transmission starts a fresh worker session for each task and keeps verification separate from implementation. The workflow can express the verifier’s criteria as a prompt.
22
+
23
+ When verification calls for repairs, the original worker receives the feedback and can try again up to a configured limit. At that limit, restart the task in a fresh session, subject to the configured retry limit. A failed test or a request for repair can be handled inside this loop without involving the user.
24
+
25
+ ## Recovery on one machine
26
+
27
+ | Interruption | Expected behavior |
28
+ | --- | --- |
29
+ | The MCP client closes | The approved workflow keeps running. |
30
+ | The machine reboots | Resume from the last completed task and continue with the first unfinished task. |
31
+ | The harness dies mid-task | Retry that task in a fresh session within the configured retry limit. |
32
+
33
+ ## What the caller can rely on
34
+
35
+ | Workflow status | Information returned |
36
+ | --- | --- |
37
+ | Running | Which task is running. |
38
+ | Completed | The result and the verifier’s verdict. |
39
+ | Needs input | The specific decision the user needs to make. |
40
+ | Failed | Why the workflow failed and what it tried. |
41
+ | Cancelled | Confirmation that the workflow was cancelled. |
42
+
43
+ ## Architectural limits
44
+
45
+ The harness owns development permissions and their enforcement. Transmission has no additional protection mandate. A new security layer on top of the harness is outside the project’s scope.
46
+
47
+ The recovery target is an individual developer’s machine and the interruptions described above. Rebuilding Temporal is outside the project’s scope. When architectural choices compete, the priorities above govern the trade-off.
package/README.md CHANGED
@@ -1,356 +1,135 @@
1
- # Code60 Transmission Server
1
+ # Transmission
2
2
 
3
- A local workflow server for running bounded coding-agent steps against a Git
4
- workspace. It stores workflow state, approvals and tool authority in SQLite,
5
- brokers file, command and network access, and returns verified coding changes
6
- as an uncommitted diff. Low-level workflows also support Git commit results.
3
+ Transmission runs an approved coding workflow in an existing Git project. The calling assistant designs the tasks and asks you to confirm them. Each task gets a fresh worker. A separate verifier inspects the project, runs checks, and returns a verdict. Rejected work goes back to the same worker with the verifier’s feedback.
7
4
 
8
- From this checkout, run `npm run build`, then use `node dist/src/cli/main.js`
9
- in place of `npx -y code60-transmission-server` in the commands below.
5
+ ## Connect your assistant
10
6
 
11
- ## Run with npx (MCP)
12
-
13
- For coding tasks, configure the installed Codex executable, provider/model, and
14
- an existing private API-key file once:
15
-
16
- ```sh
17
- npx -y code60-transmission-server configure --executable /absolute/path/to/codex --provider openrouter --model openai/gpt-5.3-codex --credential-file /absolute/path/to/provider.token
18
- npx -y code60-transmission-server doctor --repository /absolute/path/to/project
19
- ```
20
-
21
- `configure` also offers interactive prompts when run in a terminal. It enables
22
- brokered commands with outbound networking and discovers installed toolchain
23
- directories. It does not import your Codex login or ambient API keys.
24
- `doctor --check-provider` explicitly makes a small billable model request;
25
- ordinary readiness checks do not claim that provider authentication was verified.
26
-
27
- The default MCP toolset is the compact coding interface. Call
28
- `get_coding_readiness`, then `start_coding_task` with a stable `idempotencyKey`
29
- and `body: { repositoryPath, task }`. Existing staged, unstaged, and untracked
30
- source changes become the baseline. Workers can inspect/edit source, run builds
31
- and tests, ask questions, and receive `send_task_message` guidance. Inspect
32
- `get_run` and `get_coding_task_result` for the diff and executable check evidence.
33
- Successful coding tasks leave HEAD and staging unchanged and edits uncommitted.
34
-
35
- For an existing deployment, stop its daemon and run `code60 configure --coding-only`
36
- to enable coding tools and outbound commands while preserving its provider,
37
- model, credential references, and runtime settings. Profile permissions and
38
- deployment permissions both apply: a profile cannot override a deployment deny.
39
- `doctor` reports missing deployment grants before a task spends model tokens.
40
-
41
- After upgrading, stop the old daemon and reconnect your MCP client. The launcher
42
- detects mismatched engine builds and reports the restart command; it preserves
43
- runs and never automatically replaces a running engine. `mcp-config` pins the
44
- installed package version, including prereleases, so a staging installation does
45
- not silently generate a client configuration for the stable release. Select
46
- `code60-transmission-server@staging` explicitly when testing the staging release.
47
- Tasks without executable checks explicitly report `unverified`.
48
-
49
- Use `--toolset admin` to advertise the complete workflow/profile administration
50
- catalog. Existing low-level calls remain dispatchable in either toolset. Their
51
- default result mode remains automatic commits; select `resultMode: working_tree`
52
- to accept a revision without committing. Commit mode requires clean source.
53
-
54
- The [coding-task example](examples/coding-task/README.md) demonstrates a real bug
55
- reproduction, fix, regression test, build, and preservation of existing work:
56
- `npm run example:coding-task`.
57
-
58
- On macOS with Node.js **24.22.0 or newer in the 24.x line** and Xcode Command
59
- Line Tools (`/usr/bin/clang` and Git), any MCP client can start and connect to
60
- the server directly via `npx` — no separate daemon startup is required:
7
+ On macOS or Linux x64 with glibc, with Node 24.22 or later in the 24.x series, add this stdio MCP server to your assistant. Sign in to Codex once using your usual Codex login.
61
8
 
62
9
  ```json
63
10
  {
64
11
  "mcpServers": {
65
- "code60": {
12
+ "transmission": {
66
13
  "command": "npx",
67
- "args": ["-y", "code60-transmission-server"]
14
+ "args": ["-y", "code60-transmission-server", "mcp"]
68
15
  }
69
16
  }
70
17
  }
71
18
  ```
72
19
 
73
- Or print the ready-to-paste client entry from Terminal:
74
-
75
- ```sh
76
- npx -y code60-transmission-server mcp-config
77
- ```
78
-
79
- On first connection, the launcher compiles the native macOS containment helpers
80
- (during install or on demand into a private user-owned directory), creates a
81
- private `0700` state directory at
82
- `~/Library/Application Support/Code60 Transmission/state` with `0600`
83
- `configuration.json` and `operator.token`, and starts one shared detached
84
- background engine for that state directory. Multiple MCP clients share the same
85
- engine, and closing an MCP client leaves the engine running so active runs are
86
- not interrupted. Pass `--state-directory /absolute/path` to isolate an
87
- independent state directory.
88
-
89
- Inspect or stop the background engine at any time:
90
-
91
- ```sh
92
- npx -y code60-transmission-server status
93
- npx -y code60-transmission-server stop
94
- ```
95
-
96
- The default state directory and port (`31260`) are shared cleanly with the
97
- macOS `.pkg` installer below. Before changing `configuration.json` or upgrading
98
- to a new package version, let active runs finish, run `stop`, and reconnect.
99
- Registered workspaces must be standalone Git repositories prepared normally on
100
- disk (with a real `.git` directory, at least one commit, and no hardlinked
101
- `.git/objects` files—do not initialize repositories inside a sandbox that
102
- forbids deleting files, and use `git clone --no-hardlinks` for local clones).
103
-
104
- ## Install on macOS
20
+ For an unpublished candidate, install the tarball and run `code60 mcp-config` for the exact local server entry. A first connection starts the local engine. Describe the outcome you want, review the caller’s proposed tasks and verification criteria, and confirm the workflow.
105
21
 
106
- Open the Code60 Transmission `.pkg` for your Mac's architecture. It installs
107
- the engine, stdio MCP bridge, Node.js, SQLite binding, and both native helpers
108
- for your macOS account. Both the engine and bridge use the bundled Node runtime.
109
- The package targets macOS 14 or newer.
22
+ ## Execution
110
23
 
111
- To get the connection settings for your desktop MCP client, run this command in Terminal.
24
+ The MCP caller sends the approved workflow to `start_workflow`. Project paths are absolute. The caller can load the same input from a saved JSON definition.
112
25
 
113
- ```sh
114
- "$HOME/Library/Application Support/Code60 Transmission/app/code60" mcp-config
26
+ ```json
27
+ {
28
+ "repository": "/absolute/path/to/project",
29
+ "confirmed": true,
30
+ "idempotencyKey": "my-project-duration-parser-1",
31
+ "tasks": [{
32
+ "name": "Repair duration parsing",
33
+ "instructions": "Reproduce the fractional-duration bug, fix the parser, and add regression coverage.",
34
+ "verify": "Exercise positive and negative fractional durations against the public API. Explain the observed behavior.",
35
+ "checks": ["npm test"]
36
+ }]
37
+ }
115
38
  ```
116
39
 
117
- Copy the printed server entry into your client's MCP settings. For a client
118
- with separate fields, use the printed absolute path as its stdio command and
119
- leave the arguments empty. The first connection creates a private operator
120
- token and configuration and starts one engine in your macOS login session.
121
- Each client gets its own bridge. The engine stays running after clients close.
122
-
123
- The installed launcher also supports `configure`, `doctor`, `status`, and
124
- `stop`. Run `code60 stop` before reconfiguring a running installation, then
125
- reconnect the MCP client. Use `code60 mcp --toolset admin` for the full catalog.
126
-
127
- Private configuration, token, database, and engine log live together in
128
- `~/Library/Application Support/Code60 Transmission/state/`, outside the installed
129
- `app/` directory. The default API port is `31260`. If that port is in use,
130
- set `listenPort` in `state/configuration.json` to a free port and reconnect.
131
- The bridge reads the same setting. The initial deployment supports operator
132
- setup. To run coding-agent steps, configure the Codex CLI and a model provider
133
- as described in [Configure and run](#configure-and-run). Git workspace operations
134
- use Apple's Command Line Tools Git and your configured author identity.
135
-
136
- Before an upgrade or a configuration reload, let active runs finish, disconnect
137
- the clients, and stop the loaded engine.
138
-
139
- ```sh
140
- launchctl bootout "gui/$(id -u)/com.codemanufactory.code60.transmission"
141
- ```
40
+ The engine uses a single ACP client implementation and the maintained `@agentclientprotocol/codex-acp` package, which includes a compatible Codex executable. Codex owns development tools, configuration, authentication, filesystem access and command execution. The project folder is the session working directory. The ACP adapter supports normal Codex configuration and the optional `CODEX_PATH` override. Transmission advertises no client terminal or filesystem services.
142
41
 
143
- Install the new package or edit the private configuration, then reconnect.
144
- Reinstalling updates the application and preserves the private state.
42
+ Each worker submission is tied to a Git tree snapshot. Workers receive the task instructions and requested commands. Verifiers receive the independent verification prompt and the candidate summary in a separate session. Put shared requirements in the task instructions. Optional explicit checks run in the verifier’s harness and their reported results are included in the verdict. Acceptance requires a valid affirmative verdict on the same source tree. A verifier can tell the original worker exactly what to repair. By default a worker gets two repairs before replacement and a task gets two fresh-session retries. The workflow can override `repairs` and `retries`.
145
43
 
146
- ## Build the macOS installer
44
+ The initial worktree, including existing staged, unstaged and nonignored untracked source, is the diff baseline. Transmission uses a disposable index and private Git objects. Ordinary results remain uncommitted. Use one active workflow per checkout and avoid simultaneous external source edits if you need attribution of the final patch.
147
45
 
148
- On a build Mac of the target architecture, use the official unpacked Node
149
- 24.22.0 or newer 24.x distribution (including its `LICENSE`), npm, and Apple's
150
- Command Line Tools.
46
+ ## Decisions, results and recovery
151
47
 
152
- ```sh
153
- npm ci
154
- npm run package:macos
155
- ```
48
+ | Status | What the caller receives |
49
+ | --- | --- |
50
+ | running | Current task and role |
51
+ | pausing | Current task while active agents are stopping |
52
+ | paused | Preserved progress, waiting for an explicit resume |
53
+ | needs_input | A decision with a question ID and, for a permission request, the choices offered by the harness |
54
+ | completed | The result, verifier verdict, and ordered accepted task records |
55
+ | failed | The reason and attempt history |
56
+ | cancelled | Confirmation and the accepted tasks so far |
156
57
 
157
- The output is `dist/installers/Code60-Transmission-<version>-<arch>.pkg`.
158
- The build stages a fresh TypeScript compilation, native helpers, and locked
159
- production dependencies. It checks architecture, deployment targets, dynamic
160
- library paths, and the bundled SQLite binding. The default build is unsigned
161
- for local testing. For a public release, set `APPLICATION_SIGN_IDENTITY` and
162
- `INSTALLER_SIGN_IDENTITY` to your Developer ID Application and Installer
163
- identities, and set `NOTARY_PROFILE` to your notarytool Keychain profile.
164
- The same build command then signs the native code and package, submits it to
165
- Apple, staples the ticket, and checks Gatekeeper acceptance.
58
+ The MCP tools include status, paginated events, the paginated accepted diff, answering questions, steering, pause, resume and cancellation. `autoApprove` defaults to true and selects a one-time allowance when the harness offers one. Set it to false to receive those decisions yourself. Requirements and scope questions always go to the caller. The harness enforces its effective permissions.
166
59
 
167
- In a separate macOS login account with port 31260 available and no installed
168
- Transmission engine, run `node scripts/smoke-macos-package.mjs /absolute/path/to/the.pkg`.
169
- It checks the installer domain and exercises the extracted payload with two MCP
170
- clients and a real per-user engine, then removes its temporary service and files.
60
+ Call `pause_workflow` with `{"runId":"<workflow ID>"}` to interrupt the active worker or verifier immediately. The workflow enters `pausing` before agent shutdown and returns `paused` once its agents and execution loop have stopped. Working files, HEAD, staging, accepted tasks, guidance and spent allowances are preserved. A paused workflow still reserves its checkout. Repeating pause returns the current pause outcome; cancellation can supersede an in-flight pause.
171
61
 
172
- ## Requirements for building from source
62
+ Call `resume_workflow` with the same run ID to continue. The first unfinished task starts with fresh worker and verifier sessions, including when verification was interrupted. Pause does not spend a fresh-session retry or replenish repair/retry allowances. The new worker is instructed to inspect partial work before repeating consequential actions. Unanswered scope questions survive pause and still require an answer; an answer given while paused is saved without starting work. Permission questions for stopped sessions are withdrawn and must be requested again by the fresh harness. Resume during `pausing` is rejected. Repeated resume after continuation returns the current snapshot; ended workflows reject pause and resume.
173
63
 
174
- - macOS, for the native containment used by the runtime and helpers.
175
- - Node.js **24.22.0 or newer in the 24.x line**, and npm.
176
- - An installed Codex CLI with `app-server` support.
177
- - Xcode Command Line Tools (`/usr/bin/clang`), including a C toolchain, and Git
178
- with your existing author identity available for workspace commits.
64
+ The engine stays up when the MCP client disconnects. Approved tasks, questions, verdicts, and attempts are stored in SQLite. On restart, the engine continues with the first unfinished task and retains partial working-tree changes. Explicitly paused workflows stay paused until `resume_workflow`; a restart during `pausing` also leaves the workflow paused. Restarting the engine preserves the task’s retry allowance. A lost harness consumes a fresh-session retry. Completed tasks stay accepted. Cancellation leaves the files available for review.
179
65
 
180
- ## Install and build
66
+ ## Revise unfinished work
181
67
 
182
- From the checkout:
68
+ To change tasks or verification criteria within the same run, call `pause_workflow` and wait for `paused`. Read `get_workflow_plan` with `{"runId":"<workflow ID>"}`. It returns `planRevision`, `activeTaskIndex`, and the full task definitions, including instructions, independent verification prompts, and optional check commands. Tasks before the active index are completed and cannot be revised.
183
69
 
184
- ```sh
185
- npm ci
186
- npm run build
187
- ```
70
+ Present the revised unfinished tasks and criteria to the user and obtain confirmation. Submit the complete replacement for the unfinished portion, including the interrupted current task, to `revise_workflow`:
188
71
 
189
- The build emits TypeScript **and compiles both C helpers** into
190
- `dist/src/broker/native/.build/`. Starting the server does not build them.
191
-
192
- ## Configure and run
72
+ ```json
73
+ {
74
+ "runId": "6ef301cf-b89e-4c11-af33-e11b1171a6b8",
75
+ "expectedRevision": 0,
76
+ "idempotencyKey": "duration-parser-revision-1",
77
+ "confirmed": true,
78
+ "remainingTasks": [{
79
+ "name": "Cover scientific notation",
80
+ "instructions": "Extend the existing parser to support scientific notation and add regression tests. Preserve the completed parsing changes.",
81
+ "verify": "Independently test positive, negative, fractional and malformed scientific notation. Check backward compatibility with existing duration inputs.",
82
+ "checks": ["npm test"]
83
+ }]
84
+ }
85
+ ```
193
86
 
194
- For a complete first run with a real model, follow
195
- [the hello-world example](examples/hello-world/README.md). After building and
196
- setting `OPENROUTER_API_KEY`, run `npm run example:hello-world`. It creates its
197
- own disposable Git workspace and private configuration, runs the workflow,
198
- checks the artifact and acceptance commit, and stops the server.
87
+ Use the revision returned by `get_workflow_plan` as `expectedRevision`. The replacement can add, remove, reorder, or rewrite unfinished tasks. Include at least one task; the completed prefix plus the replacement may contain at most 100 tasks. Each task must include its full instructions and verification prompt. Omitting `checks` removes that task's previous explicit check requirements. Repository settings, permission settings, and repair/retry limits remain fixed.
199
88
 
200
- Start with [examples/deployment.local.json](examples/deployment.local.json).
201
- It contains no secrets, leaves the runtime disabled, and denies all tool access.
202
- Uppercase `REPLACE_WITH_...` values are placeholders. Before enabling the runtime,
203
- set your Codex executable's absolute path, the local model ID/effort, and an unused
204
- loopback model port served by an owned Responses-compatible synthetic provider.
205
- No model provider is started for you.
89
+ The response is a workflow snapshot with an incremented `planRevision`. The run remains paused until a separate `resume_workflow` call. Resume starts fresh sessions for the first revised unfinished task and verifies against its new criteria. The current task position retains its spent repair and retry allowances, even if its task is replaced; later tasks receive their ordinary allowances when reached.
206
90
 
207
- Keep state and private files outside the checkout. For a **new** state directory:
91
+ Completed task definitions, results, verdicts, accepted diffs, the original baseline, working files, HEAD, staging, and prior events remain intact. When the current task changes, its old feedback, guidance, messages, and question are archived and cleared from active execution. Add any still-relevant guidance after revision. When only later tasks change, current task context and unanswered questions are retained.
208
92
 
209
- ```sh
210
- ROOT="$(pwd -P)"
211
- STATE="$HOME/code60-engine-state"
212
- mkdir -m 700 "$STATE" &&
213
- install -m 600 examples/deployment.local.json "$STATE/configuration.json" &&
214
- node --input-type=module -e 'import { randomBytes } from "node:crypto"; import { writeFileSync } from "node:fs"; writeFileSync(process.argv[1], randomBytes(32).toString("base64url") + "\n", { mode: 0o600, flag: "wx" });' "$STATE/operator.token"
215
- ```
93
+ Each revision is recorded as a `plan_revised` event with the previous unfinished task list, the normalized revision request, and any archived context. New execution events carry `detail.planRevision`; older events without it belong to revision zero. The revised plan and history survive restart and stay paused until explicit resume.
216
94
 
217
- Edit that private configuration copy. Keep it and the token owned by your user,
218
- mode `0600`, without symlinks or hardlinks. The state directory must be `0700`.
219
- Never put the token in configuration JSON, command arguments or Git.
220
-
221
- ```sh
222
- npm start -- \
223
- --state-directory "$STATE" \
224
- --fs-helper "$ROOT/dist/src/broker/native/.build/fs-helper" \
225
- --git-helper "$ROOT/dist/src/broker/native/.build/git-helper" \
226
- --configuration "$STATE/configuration.json" \
227
- --operator-token-file "$STATE/operator.token"
228
- ```
95
+ Retry an uncertain revision with the exact same request and key. An accepted retry returns the current snapshot, even after later revisions, resume, restart, or completion. A changed request under the same key is rejected. A new revision with a stale `expectedRevision` is rejected without applying changes; read the current plan and reassess it before making a new request. Replaying the original `start_workflow` request still identifies this run and returns its current snapshot.
229
96
 
230
- All five paths must be absolute. With the example ports, the authenticated API
231
- is at `http://127.0.0.1:31260/api/v1`. There is no unauthenticated health route or
232
- automatic login. Read the private token in your API client, then follow the
233
- [operator walkthrough and recovery rules](README.engine.md#operator-api-walkthrough)
234
- to register an explicitly authorized Git workspace, publish profiles/workflows,
235
- and start a run. The disabled example supports API setup, not agent execution.
97
+ New revisions require a fully paused run. Running, pausing, input-waiting without explicit pause, stopping, and ended workflows reject them. Use cancellation when there is no remaining work to run.
236
98
 
237
- ## Connect an agent over MCP
99
+ ## Observe task progress
238
100
 
239
- Start the Transmission Server with your private deployment configuration, then
240
- configure your MCP client to launch the built stdio bridge. For clients that use
241
- an `mcpServers` configuration, replace both absolute paths and use the engine's
242
- configured port.
101
+ A client can render the ordered tasks by calling `get_workflow` with only the run ID. For example, during verification the response can look like this:
243
102
 
244
103
  ```json
245
104
  {
246
- "mcpServers": {
247
- "code60": {
248
- "command": "node",
249
- "args": [
250
- "/absolute/path/to/code60-transmission-server/dist/src/mcp/main.js",
251
- "--port", "31260",
252
- "--operator-token-file", "/absolute/path/to/private/operator.token"
253
- ]
254
- }
255
- }
105
+ "runId": "6ef301cf-b89e-4c11-af33-e11b1171a6b8",
106
+ "planRevision": 0,
107
+ "status": "running",
108
+ "task": "Implement the fix",
109
+ "phase": "verifier",
110
+ "tasks": [
111
+ { "index": 0, "name": "Implement the fix", "state": "verifying" },
112
+ { "index": 1, "name": "Document it", "state": "pending" }
113
+ ],
114
+ "activeTaskIndex": 0,
115
+ "eventCursor": 37,
116
+ "accepted": [],
117
+ "attempts": []
256
118
  }
257
119
  ```
258
120
 
259
- The client launches one bridge per connection. The bridge reads the private token
260
- file on startup and authenticates to the engine on IPv4 loopback. The agent can
261
- exercise the configured operator’s authority, including approval decisions and
262
- recovery. Workspace registration requires an unrestricted operator. To execute
263
- agent steps, enable and configure the deployment runtime.
264
-
265
- 1. Discover runtimes and named checks, then register an authorized worktree with
266
- `create_workspace`. Use the selected provider's `credentialReferences`
267
- from `get_runtime_configuration` as `credentialRefs.provider` when publishing
268
- a worker with `create_agent_profile`.
269
- 2. Call `get_workflow_schema` and `get_workflow_example`, or read the MCP
270
- resources `code60://workflow/schema` and `code60://workflow/example`.
271
- Replace the example’s worker placeholder with
272
- the profile’s `latestVersionId`. Pass the YAML or JSON source and any bundled
273
- resources to `validate_workflow`, then publish with `create_workflow`.
274
- 3. Call `create_run` with a unique `idempotencyKey` and a `body` containing
275
- `workspaceId` and the workflow’s `latestVersionId` as `workflowVersionId`.
276
- Save the returned `body.id`. A 202 response means the engine admitted the run.
277
- 4. Read `get_run` or call `list_run_events` with `runId`, `follow: true`,
278
- and `waitSeconds: 30`. Reuse each `body.nextCursor` as `cursor` on the next
279
- poll, including after reconnecting. Inspect approvals, blocks, and artifacts
280
- through their list and get tools. Closing the MCP client leaves the engine
281
- running.
282
-
283
- Tools return the HTTP `status` and engine `body` in structured content and text,
284
- plus `etag`, `location`, and `idempotentReplay` when available. All POST tools
285
- take `body` and `idempotencyKey`. Reuse the same arguments after a lost response.
286
- For a conditional command, pass the target read’s `etag` as `ifMatch`. On a
287
- stale-version error, reread the target before making a new decision. Poll
288
- `get_operation` for asynchronous operator commands.
289
-
290
- ## Workflow examples
291
-
292
- - [Hello world](examples/hello-world/README.md): run a real agent, validate its
293
- artifact, and verify the accepted Git commit. Run `npm run example:hello-world`.
294
- - [Pull request lifecycle](examples/pull-request/README.md): clone the disposable
295
- GitHub repository, create a worktree, make an agent change, push/open/merge a
296
- PR, and delete the worktree. Run `npm run example:pull-request`.
297
-
298
- ## Browse the API specification
299
-
300
- With Docker running, start Swagger UI:
301
-
302
- ```sh
303
- npm run docs:api
304
- ```
121
+ Each task keeps its zero-based index even when names repeat. The active row can be `implementing`, `verifying`, `repairing`, `needs_input`, `pausing`, or `paused`. Pausing and paused runs retain their active index. A terminal run has a null active index. Previously accepted rows stay `accepted`, the interrupted row records `failed` or `cancelled`, and unstarted rows stay `pending`.
305
122
 
306
- Open [http://localhost:8080](http://localhost:8080) to browse the OpenAPI specification.
307
- The API server does not need to be running. Press Ctrl+C to stop the viewer and
308
- remove its container. The first run downloads the Swagger UI image.
123
+ For subsequent activity, call `get_workflow_events` with the same run ID and `after` set to the snapshot’s `eventCursor`. Use the last returned sequence for the next page. Sequence numbers can have gaps between events for a run. Use `after: 0` for earlier history, or refresh `get_workflow` for another complete snapshot.
309
124
 
310
- ## Tests
125
+ Private state defaults to `~/Library/Application Support/Code60 Transmission/workflows`. On Linux, state defaults to `$XDG_STATE_HOME/code60-transmission/workflows` or `~/.local/state/code60-transmission/workflows`. Ordinary connections enable `code60-transmission.service` when a systemd user manager is available. Without one, reconnect after login to recover work. Explicit state directories skip service registration. Linux requires Git and the npm platform dependency for Codex, or an explicit `CODEX_PATH`.
311
126
 
312
- ```sh
313
- npm run typecheck
314
- npm test -- --maxWorkers=1
315
- ```
127
+ On macOS, the first ordinary connection registers a per-user LaunchAgent to restart the engine at login. Keep Node and the installed package available at their original paths for login restart. Credentials supplied only through transient shell environment variables need to be available again after login. For an isolated engine, set `TRANSMISSION_STATE_DIR` to a new absolute directory. Isolated engines skip login registration. Use `code60 status` and `code60 stop` with the same state directory.
128
+
129
+ ## Development and validation
130
+
131
+ Run `npm ci`, `npm run typecheck`, and `npm test`. The HTTP contract is generated from the same schemas used by MCP and the engine. Run `npm run contracts:check` after changing the interface.
132
+
133
+ For the installed-package live test, run `npm pack` followed by `npm run acceptance:installed -- /absolute/path/to/candidate.tgz /absolute/path/to/new-evidence-directory`. This uses the normal Codex login and real model calls. It installs the package, clones a pinned upstream repository, and exercises rejection, same-session repair, fresh verification, and a second task over MCP. Pass `--agent-caller` to have a real Codex caller design the workflow and submit it over MCP after the test supplies confirmation. The default caller uses the MCP SDK. An independent grader runs the upstream suite and additional public-API assertions and checks the dirty baseline, index and HEAD. The script saves the report, diff, events and uncommitted checkout, then stops the isolated engine.
316
134
 
317
- `npm test` builds its own native helpers before running the suite, including the
318
- normal-entrypoint and restart tests. Installed-runtime tests use
319
- `CODE60_CODEX_EXECUTABLE` (an explicit absolute executable path) first, otherwise
320
- look for `codex` on `PATH`; absence is a clear test failure, not a silent skip.
321
- No Codex configuration or credentials are read by that lookup. To run just the
322
- runtime pilot, use `npm run test:pilot -- --maxWorkers=1`. Run native builds/tests
323
- serially. Preserved-image mode is optional, not needed for a fresh clone.
324
- See [validation details](README.engine.md#validation) for focused checks.
325
-
326
- ## Limits
327
-
328
- - The [hello-world example](examples/hello-world/README.md) has live validation
329
- through OpenRouter with GPT-5.3-Codex. Other provider/model combinations need
330
- their own validation; the normal automated suite uses synthetic providers.
331
- - Single host, one coordinator per state directory, loopback API only. No
332
- multi-host service, public ingress or browser login is supplied.
333
- - Broker tools include file/range reads, precise edits, directory creation,
334
- paginated search/diffs, sandboxed commands and their input/output/stop controls,
335
- questions, context retrieval, and `http_request`. Profile and deployment policy
336
- both apply. Commands may use configured toolchains and outbound networking;
337
- host credentials, engine state, and command writes to Git metadata are denied.
338
- - Git-aware source tracking excludes ignored dependencies/build output and uses
339
- streamed content-addressed checkpoints. Default source quotas are 100,000
340
- entries, 1 GiB per file, and 10 GiB of unique source content per run. Configure
341
- `sourceQuotas` to change these explicit operational bounds.
342
- - Working-folder runs require exclusive source editing while commands execute.
343
- Same-user external filesystem races are not a mandatory isolation boundary;
344
- detected conflicts and uncertain commands retain their leases for recovery.
345
- - Containment is macOS-only. Preserved-image test success does not establish
346
- clean-build, sanitizer or cross-platform support.
347
-
348
- See [README.engine.md](README.engine.md) for configuration, API, authorization,
349
- instruction pinning, deadlines and recovery details.
350
-
351
- ## Repository skills
352
-
353
- Use `$add-workflow-example` to add or revise a runnable example with setup
354
- instructions and end-to-end verification. The
355
- [repository skill](.agents/skills/add-workflow-example/SKILL.md) describes the
356
- required implementation and evidence.
135
+ See [project intent](INTENT.md) and the [HTTP contract](reference/openapi.json).
@@ -0,0 +1,130 @@
1
+ import { spawn } from 'node:child_process';
2
+ import { accessSync, constants } from 'node:fs';
3
+ import { createRequire } from 'node:module';
4
+ import { dirname, join } from 'node:path';
5
+ import { fileURLToPath } from 'node:url';
6
+ import { Readable, Writable } from 'node:stream';
7
+ import { ClientApp, ndJsonStream, PROTOCOL_VERSION, } from '@agentclientprotocol/sdk';
8
+ export class AcpHarness {
9
+ child;
10
+ connection;
11
+ ready;
12
+ active = '';
13
+ output = '';
14
+ messageId;
15
+ exited;
16
+ constructor(hooks, cwd) {
17
+ const executable = fileURLToPath(import.meta.resolve('@agentclientprotocol/codex-acp'));
18
+ const env = { ...process.env };
19
+ if (process.platform === 'linux' && !env.CODEX_PATH) {
20
+ try {
21
+ const manifest = createRequire(executable).resolve('@openai/codex-linux-x64/package.json');
22
+ env.CODEX_PATH = join(dirname(manifest), 'vendor/x86_64-unknown-linux-musl/bin/codex');
23
+ accessSync(env.CODEX_PATH, constants.X_OK);
24
+ }
25
+ catch {
26
+ throw Error('Missing Linux x64 Codex executable. Reinstall Transmission with npm optional dependencies enabled, or set CODEX_PATH to an installed Codex executable.');
27
+ }
28
+ }
29
+ this.child = spawn(process.execPath, [executable], {
30
+ cwd,
31
+ env,
32
+ stdio: 'pipe',
33
+ detached: true,
34
+ });
35
+ this.exited = new Promise((resolve) => this.child.once('close', () => resolve()));
36
+ // Adapter stderr may contain user configuration. Drain it without persisting secrets.
37
+ this.child.stderr.resume();
38
+ const app = new ClientApp()
39
+ .onRequest('session/request_permission', async ({ params }) => {
40
+ const optionId = params.sessionId === this.active
41
+ ? await hooks.permission(params)
42
+ : undefined;
43
+ return {
44
+ outcome: optionId
45
+ ? { outcome: 'selected', optionId }
46
+ : { outcome: 'cancelled' },
47
+ };
48
+ })
49
+ .onNotification('session/update', ({ params: { sessionId, update } }) => {
50
+ if (sessionId !== this.active)
51
+ return;
52
+ if (update.sessionUpdate === 'agent_message_chunk' &&
53
+ update.content.type === 'text') {
54
+ if (update.messageId && this.messageId !== update.messageId)
55
+ this.output = '';
56
+ this.messageId = update.messageId;
57
+ this.output = (this.output + update.content.text).slice(-256 * 1024);
58
+ }
59
+ if (update.sessionUpdate === 'tool_call' ||
60
+ (update.sessionUpdate === 'tool_call_update' && update.status)) {
61
+ hooks.tool(sessionId, [update.toolCallId, update.kind, update.title, update.status]
62
+ .filter(Boolean)
63
+ .join(' ')
64
+ .slice(0, 1600));
65
+ }
66
+ });
67
+ this.connection = app.connect(ndJsonStream(Writable.toWeb(this.child.stdin), Readable.toWeb(this.child.stdout)));
68
+ this.child.on('error', (error) => this.connection.close(error));
69
+ this.ready = this.connection.agent.request('initialize', {
70
+ protocolVersion: PROTOCOL_VERSION,
71
+ clientCapabilities: {},
72
+ clientInfo: { name: 'transmission', version: '1' },
73
+ }, {
74
+ cancellationSignal: AbortSignal.timeout(60000),
75
+ stopWaitingOnCancel: true,
76
+ });
77
+ }
78
+ async session(cwd) {
79
+ const init = await this.ready;
80
+ if (init.protocolVersion !== PROTOCOL_VERSION)
81
+ throw new Error('The installed ACP adapter negotiated an incompatible protocol.');
82
+ const session = await this.connection.agent.request('session/new', { cwd, mcpServers: [] }, {
83
+ cancellationSignal: AbortSignal.timeout(120000),
84
+ stopWaitingOnCancel: true,
85
+ });
86
+ return session.sessionId;
87
+ }
88
+ async prompt(sessionId, text) {
89
+ this.output = '';
90
+ this.messageId = undefined;
91
+ this.active = sessionId;
92
+ try {
93
+ const result = await this.connection.agent.request('session/prompt', {
94
+ sessionId,
95
+ prompt: [{ type: 'text', text }],
96
+ });
97
+ if (result.stopReason !== 'end_turn')
98
+ throw new Error('Agent stopped: ' + result.stopReason);
99
+ return this.output;
100
+ }
101
+ finally {
102
+ this.active = '';
103
+ }
104
+ }
105
+ async close() {
106
+ if (this.active)
107
+ void this.connection.agent
108
+ .notify('session/cancel', { sessionId: this.active })
109
+ .catch(() => { });
110
+ this.connection.close();
111
+ this.child.stdin.end();
112
+ const pid = this.child.pid;
113
+ if (!pid)
114
+ return;
115
+ const signal = (sig) => {
116
+ try {
117
+ process.kill(-pid, sig);
118
+ }
119
+ catch { }
120
+ };
121
+ signal('SIGTERM');
122
+ const kill = setTimeout(() => signal('SIGKILL'), 1500);
123
+ try {
124
+ await this.exited;
125
+ }
126
+ finally {
127
+ clearTimeout(kill);
128
+ }
129
+ }
130
+ }