subharness 0.0.7 → 0.0.9
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.
- package/README.md +18 -6
- package/dist/adapters/claude-events.d.ts +71 -0
- package/dist/adapters/claude-events.js +860 -0
- package/dist/adapters/claude-events.js.map +1 -0
- package/dist/adapters/claude-worker-client.d.ts +11 -0
- package/dist/adapters/claude-worker-client.js +219 -5
- package/dist/adapters/claude-worker-client.js.map +1 -1
- package/dist/adapters/claude-worker-protocol.d.ts +58 -0
- package/dist/adapters/claude-worker-protocol.js.map +1 -1
- package/dist/adapters/claude-worker.js +48 -3
- package/dist/adapters/claude-worker.js.map +1 -1
- package/dist/adapters/claude.d.ts +5 -1
- package/dist/adapters/claude.js +14 -2
- package/dist/adapters/claude.js.map +1 -1
- package/dist/adapters/codex-events.d.ts +52 -0
- package/dist/adapters/codex-events.js +672 -0
- package/dist/adapters/codex-events.js.map +1 -0
- package/dist/adapters/codex-turn-failure.d.ts +2 -0
- package/dist/adapters/codex-turn-failure.js +116 -0
- package/dist/adapters/codex-turn-failure.js.map +1 -0
- package/dist/adapters/codex.js +44 -7
- package/dist/adapters/codex.js.map +1 -1
- package/dist/adapters/copilot-events.d.ts +68 -0
- package/dist/adapters/copilot-events.js +650 -0
- package/dist/adapters/copilot-events.js.map +1 -0
- package/dist/adapters/copilot.js +24 -4
- package/dist/adapters/copilot.js.map +1 -1
- package/dist/adapters/cursor-acp-events.d.ts +36 -0
- package/dist/adapters/cursor-acp-events.js +251 -0
- package/dist/adapters/cursor-acp-events.js.map +1 -0
- package/dist/adapters/cursor-cli-session.d.ts +1 -0
- package/dist/adapters/cursor-cli-session.js +26 -5
- package/dist/adapters/cursor-cli-session.js.map +1 -1
- package/dist/adapters/cursor-cli.js +5 -0
- package/dist/adapters/cursor-cli.js.map +1 -1
- package/dist/adapters/cursor-sdk-events.d.ts +30 -0
- package/dist/adapters/cursor-sdk-events.js +233 -0
- package/dist/adapters/cursor-sdk-events.js.map +1 -0
- package/dist/adapters/cursor-session.js +56 -7
- package/dist/adapters/cursor-session.js.map +1 -1
- package/dist/adapters/cursor-startup.js +8 -2
- package/dist/adapters/cursor-startup.js.map +1 -1
- package/dist/adapters/event-normalizer.d.ts +57 -0
- package/dist/adapters/event-normalizer.js +143 -0
- package/dist/adapters/event-normalizer.js.map +1 -0
- package/dist/adapters/event-secrets.d.ts +17 -0
- package/dist/adapters/event-secrets.js +28 -0
- package/dist/adapters/event-secrets.js.map +1 -0
- package/dist/adapters/event-types.d.ts +58 -0
- package/dist/adapters/event-types.js +2 -0
- package/dist/adapters/event-types.js.map +1 -0
- package/dist/adapters/fx-events.d.ts +37 -0
- package/dist/adapters/fx-events.js +393 -0
- package/dist/adapters/fx-events.js.map +1 -0
- package/dist/adapters/fx-rpc.d.ts +2 -0
- package/dist/adapters/fx-rpc.js +11 -5
- package/dist/adapters/fx-rpc.js.map +1 -1
- package/dist/adapters/fx.js +73 -8
- package/dist/adapters/fx.js.map +1 -1
- package/dist/adapters/opencode-events.d.ts +58 -0
- package/dist/adapters/opencode-events.js +653 -0
- package/dist/adapters/opencode-events.js.map +1 -0
- package/dist/adapters/opencode-http.d.ts +1 -0
- package/dist/adapters/opencode-http.js +8 -7
- package/dist/adapters/opencode-http.js.map +1 -1
- package/dist/adapters/opencode.js +50 -9
- package/dist/adapters/opencode.js.map +1 -1
- package/dist/adapters/rpc.d.ts +2 -0
- package/dist/adapters/rpc.js +11 -5
- package/dist/adapters/rpc.js.map +1 -1
- package/dist/adapters/types.d.ts +2 -0
- package/dist/adapters/types.js.map +1 -1
- package/dist/cli/args.d.ts +3 -1
- package/dist/cli/args.js +25 -1
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/dashboard-client.d.ts +1 -0
- package/dist/cli/dashboard-client.js +13 -1
- package/dist/cli/dashboard-client.js.map +1 -1
- package/dist/cli/dashboard-controller.js +6 -7
- package/dist/cli/dashboard-controller.js.map +1 -1
- package/dist/cli/dashboard-detail-view.d.ts +14 -8
- package/dist/cli/dashboard-detail-view.js +15 -44
- package/dist/cli/dashboard-detail-view.js.map +1 -1
- package/dist/cli/dashboard-history-view.d.ts +3 -12
- package/dist/cli/dashboard-history-view.js +18 -82
- package/dist/cli/dashboard-history-view.js.map +1 -1
- package/dist/cli/dashboard-live.d.ts +32 -0
- package/dist/cli/dashboard-live.js +177 -0
- package/dist/cli/dashboard-live.js.map +1 -0
- package/dist/cli/dashboard-renderer.d.ts +21 -1
- package/dist/cli/dashboard-renderer.js +85 -21
- package/dist/cli/dashboard-renderer.js.map +1 -1
- package/dist/cli/dashboard-steps.d.ts +53 -0
- package/dist/cli/dashboard-steps.js +157 -0
- package/dist/cli/dashboard-steps.js.map +1 -0
- package/dist/cli/dashboard-task-format.d.ts +15 -0
- package/dist/cli/dashboard-task-format.js +119 -0
- package/dist/cli/dashboard-task-format.js.map +1 -0
- package/dist/cli/dashboard-task-view.d.ts +66 -0
- package/dist/cli/dashboard-task-view.js +325 -0
- package/dist/cli/dashboard-task-view.js.map +1 -0
- package/dist/cli/dashboard.d.ts +2 -0
- package/dist/cli/dashboard.js +71 -6
- package/dist/cli/dashboard.js.map +1 -1
- package/dist/cli/extensions-client.d.ts +23 -0
- package/dist/cli/extensions-client.js +147 -0
- package/dist/cli/extensions-client.js.map +1 -0
- package/dist/cli/extensions.d.ts +14 -0
- package/dist/cli/extensions.js +181 -0
- package/dist/cli/extensions.js.map +1 -0
- package/dist/cli/help.d.ts +1 -0
- package/dist/cli/help.js +21 -0
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/main.js +54 -2
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/output.js +1 -0
- package/dist/cli/output.js.map +1 -1
- package/dist/events/content.d.ts +43 -0
- package/dist/events/content.js +249 -0
- package/dist/events/content.js.map +1 -0
- package/dist/events/queue.d.ts +59 -0
- package/dist/events/queue.js +144 -0
- package/dist/events/queue.js.map +1 -0
- package/dist/events/validate.d.ts +22 -0
- package/dist/events/validate.js +542 -0
- package/dist/events/validate.js.map +1 -0
- package/dist/extensions/catalog.d.ts +33 -0
- package/dist/extensions/catalog.js +101 -0
- package/dist/extensions/catalog.js.map +1 -0
- package/dist/extensions/child-protocol.d.ts +38 -0
- package/dist/extensions/child-protocol.js +2 -0
- package/dist/extensions/child-protocol.js.map +1 -0
- package/dist/extensions/child.d.ts +1 -0
- package/dist/extensions/child.js +125 -0
- package/dist/extensions/child.js.map +1 -0
- package/dist/extensions/consent.d.ts +13 -0
- package/dist/extensions/consent.js +204 -0
- package/dist/extensions/consent.js.map +1 -0
- package/dist/extensions/environment.d.ts +1 -0
- package/dist/extensions/environment.js +12 -0
- package/dist/extensions/environment.js.map +1 -0
- package/dist/extensions/identity.d.ts +9 -0
- package/dist/extensions/identity.js +28 -0
- package/dist/extensions/identity.js.map +1 -0
- package/dist/extensions/log.d.ts +5 -0
- package/dist/extensions/log.js +80 -0
- package/dist/extensions/log.js.map +1 -0
- package/dist/extensions/manifest.d.ts +7 -0
- package/dist/extensions/manifest.js +213 -0
- package/dist/extensions/manifest.js.map +1 -0
- package/dist/extensions/types.d.ts +24 -0
- package/dist/extensions/types.js +2 -0
- package/dist/extensions/types.js.map +1 -0
- package/dist/extensions.d.ts +5 -0
- package/dist/extensions.js +2 -0
- package/dist/extensions.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js.map +1 -1
- package/dist/runtime/approval-registry.d.ts +6 -2
- package/dist/runtime/approval-registry.js +31 -3
- package/dist/runtime/approval-registry.js.map +1 -1
- package/dist/runtime/capture.js +45 -13
- package/dist/runtime/capture.js.map +1 -1
- package/dist/runtime/coordinator.d.ts +8 -4
- package/dist/runtime/coordinator.js +128 -26
- package/dist/runtime/coordinator.js.map +1 -1
- package/dist/runtime/daemon.js +9 -1
- package/dist/runtime/daemon.js.map +1 -1
- package/dist/runtime/dashboard.d.ts +4 -0
- package/dist/runtime/dashboard.js +8 -0
- package/dist/runtime/dashboard.js.map +1 -1
- package/dist/runtime/event-operation.d.ts +41 -0
- package/dist/runtime/event-operation.js +290 -0
- package/dist/runtime/event-operation.js.map +1 -0
- package/dist/runtime/event-owner.d.ts +94 -0
- package/dist/runtime/event-owner.js +429 -0
- package/dist/runtime/event-owner.js.map +1 -0
- package/dist/runtime/event-source.d.ts +39 -0
- package/dist/runtime/event-source.js +344 -0
- package/dist/runtime/event-source.js.map +1 -0
- package/dist/runtime/extension-instance.d.ts +61 -0
- package/dist/runtime/extension-instance.js +356 -0
- package/dist/runtime/extension-instance.js.map +1 -0
- package/dist/runtime/extension-protocol.d.ts +47 -0
- package/dist/runtime/extension-protocol.js +33 -0
- package/dist/runtime/extension-protocol.js.map +1 -0
- package/dist/runtime/extension-service.d.ts +10 -0
- package/dist/runtime/extension-service.js +35 -0
- package/dist/runtime/extension-service.js.map +1 -0
- package/dist/runtime/extension-supervisor.d.ts +33 -0
- package/dist/runtime/extension-supervisor.js +251 -0
- package/dist/runtime/extension-supervisor.js.map +1 -0
- package/dist/runtime/select-native.d.ts +2 -1
- package/dist/runtime/select-native.js +26 -2
- package/dist/runtime/select-native.js.map +1 -1
- package/dist/runtime/service.d.ts +5 -0
- package/dist/runtime/service.js +83 -9
- package/dist/runtime/service.js.map +1 -1
- package/dist/runtime/session-event-wire.d.ts +29 -0
- package/dist/runtime/session-event-wire.js +2 -0
- package/dist/runtime/session-event-wire.js.map +1 -0
- package/dist/runtime/session-events-service.d.ts +8 -0
- package/dist/runtime/session-events-service.js +124 -0
- package/dist/runtime/session-events-service.js.map +1 -0
- package/dist/runtime/session-events-transport.d.ts +8 -0
- package/dist/runtime/session-events-transport.js +142 -0
- package/dist/runtime/session-events-transport.js.map +1 -0
- package/dist/runtime/startup-lock.d.ts +2 -0
- package/dist/runtime/startup-lock.js +49 -5
- package/dist/runtime/startup-lock.js.map +1 -1
- package/dist/runtime/state.d.ts +2 -1
- package/dist/runtime/state.js +4 -0
- package/dist/runtime/state.js.map +1 -1
- package/dist/runtime/transport.d.ts +1 -0
- package/dist/runtime/transport.js +2 -0
- package/dist/runtime/transport.js.map +1 -1
- package/dist/runtime/types.d.ts +22 -0
- package/dist/runtime/types.js.map +1 -1
- package/dist/runtime/worker-client.js +42 -13
- package/dist/runtime/worker-client.js.map +1 -1
- package/dist/runtime/worker-event-channel.d.ts +30 -0
- package/dist/runtime/worker-event-channel.js +141 -0
- package/dist/runtime/worker-event-channel.js.map +1 -0
- package/dist/runtime/worker-event-protocol.d.ts +88 -0
- package/dist/runtime/worker-event-protocol.js +114 -0
- package/dist/runtime/worker-event-protocol.js.map +1 -0
- package/dist/runtime/worker-events.d.ts +73 -0
- package/dist/runtime/worker-events.js +704 -0
- package/dist/runtime/worker-events.js.map +1 -0
- package/dist/runtime/worker-server.d.ts +3 -1
- package/dist/runtime/worker-server.js +63 -8
- package/dist/runtime/worker-server.js.map +1 -1
- package/dist/sdk/connected-events.d.ts +3 -0
- package/dist/sdk/connected-events.js +259 -0
- package/dist/sdk/connected-events.js.map +1 -0
- package/dist/sdk/connected-types.d.ts +2 -0
- package/dist/sdk/connected-types.js.map +1 -1
- package/dist/sdk/connected.js +3 -0
- package/dist/sdk/connected.js.map +1 -1
- package/dist/sdk/event-types.d.ts +182 -0
- package/dist/sdk/event-types.js +2 -0
- package/dist/sdk/event-types.js.map +1 -0
- package/dist/sdk/execution-driver.js +1 -1
- package/dist/sdk/execution-driver.js.map +1 -1
- package/dist/sdk/execution-types.d.ts +2 -0
- package/dist/sdk/execution-types.js.map +1 -1
- package/dist/sdk/runner.js +2 -0
- package/dist/sdk/runner.js.map +1 -1
- package/package.json +5 -1
- package/sdk/adapter-contract.md +25 -3
- package/sdk/agent-skill.md +3 -2
- package/sdk/cli/dashboard-design.md +37 -9
- package/sdk/cli/dashboard-inspection.md +14 -6
- package/sdk/cli/extensions.md +44 -0
- package/sdk/cli/index.md +27 -4
- package/sdk/cli/output.md +13 -1
- package/sdk/completion-notifications.md +2 -2
- package/sdk/config.md +31 -2
- package/sdk/copilot.md +1 -1
- package/sdk/cursor.md +2 -2
- package/sdk/diagnostics.md +68 -0
- package/sdk/distribution.md +13 -3
- package/sdk/events.md +339 -0
- package/sdk/execution.md +26 -7
- package/sdk/extensions.md +181 -0
- package/sdk/fx.md +4 -2
- package/sdk/harnesses.md +1 -1
- package/sdk/index.md +3 -0
- package/sdk/message-delivery.md +2 -0
- package/sdk/opencode.md +1 -1
- package/sdk/project-team.md +10 -4
- package/sdk/sessions.md +4 -0
- package/sdk/v1-runtime.md +14 -4
package/sdk/cli/index.md
CHANGED
|
@@ -5,6 +5,10 @@ The CLI is the primary execution interface for an everyday coding assistant. The
|
|
|
5
5
|
```sh
|
|
6
6
|
subharness list [--cwd <directory>]
|
|
7
7
|
subharness dashboard
|
|
8
|
+
subharness extensions --help
|
|
9
|
+
subharness extensions list
|
|
10
|
+
subharness extensions enable <global:id|repo:id>
|
|
11
|
+
subharness extensions disable <global:id|repo:id>
|
|
8
12
|
subharness check <target> [--cwd <directory>] [--format text|jsonl]
|
|
9
13
|
subharness check <harness> [--cwd <directory>] [--model <model>] [--effort <effort>] [--format text|jsonl]
|
|
10
14
|
subharness run <target> [--cwd <directory>] [--detach] <prompt>
|
|
@@ -21,10 +25,11 @@ subharness respond <request-id> --content <json>
|
|
|
21
25
|
subharness respond <request-id> --content-file <path|->
|
|
22
26
|
subharness queue <session-id>
|
|
23
27
|
subharness cancel <task-id>
|
|
28
|
+
subharness close <session-id> [--format text|jsonl]
|
|
24
29
|
subharness resume <session-id>
|
|
25
30
|
```
|
|
26
31
|
|
|
27
|
-
Execution commands accept `--format text|jsonl`; text is the default. `--help` and `--version` are plain-text information modes without a `--format` option. `subharness --help` and `<command> --help` show usage without requiring execution arguments or starting execution. Direct harness help includes that harness’s options; other command help shows the general usage. [Output records and exit codes](output.md) define the integration format.
|
|
32
|
+
Execution commands accept `--format text|jsonl`; text is the default. `--help` and `--version` are plain-text information modes without a `--format` option. `subharness --help` and `<command> --help` show usage without requiring execution arguments or starting execution. Direct harness help includes that harness’s options; extension help shows extensions usage; other command help shows the general usage. [Output records and exit codes](output.md) define the integration format.
|
|
28
33
|
|
|
29
34
|
`list` includes the built-in harness targets and discovered definitions without starting harnesses or calling models. Inclusion is not a claim that an executable, eligible account, or particular model is available. Definition loading retains its existing validation and trust requirements. `check` performs the selected target's native startup checks in an isolated worker, closes the temporary native session, confirms that the worker and adapter-owned native processes have stopped, and returns without submitting a turn or admitting a task. Cleanup or unconfirmed termination is a failed check, not a readiness result. `run` starts a new session and its first task, immediately prints their identities, and waits for one complete response, pending permission request, or terminal outcome. It returns control even if that task still has delegated work. A response contains a response identifier and task state; an approval observation contains request identifiers and schemas.
|
|
30
35
|
|
|
@@ -32,6 +37,20 @@ Readiness means only that startup checks for the selected target passed at that
|
|
|
32
37
|
|
|
33
38
|
`run --detach` instead returns immediately after successful admission with only the same `started` record.
|
|
34
39
|
|
|
40
|
+
## Close a session
|
|
41
|
+
|
|
42
|
+
`subharness close <session-id>` stops new admission to the session, cancels its active and queued tasks and their recorded descendants with confirmed-stop semantics, and then closes the native harness resources. The harness therefore performs cleanup for tool processes that it tracks as part of the native session. The closed session and its retained task records remain inspectable. Closing an already closed session succeeds.
|
|
43
|
+
|
|
44
|
+
Session identifiers resolve coordinator-wide; `close` is not restricted by managed parent lineage. Callers must close only sessions whose lifecycle they own and no longer need.
|
|
45
|
+
|
|
46
|
+
`close` attaches to the selected existing coordinator and never starts one. An unknown session is `UNKNOWN_SESSION`. A running coordinator that predates this operation returns `COORDINATOR_OUTDATED` with guidance to stop that coordinator after active work ends and start a new run. Cancellation and cleanup failures retain their safe `CANCEL_FAILED` or native-cleanup diagnostics. See [CLI output](output.md) for records and exit codes.
|
|
47
|
+
|
|
48
|
+
Task cancellation and interrupt stop the agent's active native turn, including recorded descendant work and admitted callbacks. A tool process that the native harness intentionally tracks across turns can continue after cancellation or task completion. Examples include a yielded Codex background terminal and a Claude Code `run_in_background` shell. `subharness close`, SDK `session.close()`, and coordinator shutdown close the native session, allowing the harness to terminate those tracked tool processes. A command that deliberately detaches a process outside the harness's tracking, such as a daemon that escapes with `setsid`, is outside both Subharness and harness ownership and can survive every one of these boundaries.
|
|
49
|
+
|
|
50
|
+
Verification scope is limited to live Codex 0.157.0 and Claude Code 2.1.288 sessions plus fx 0.0.12 source inspection. The fx evidence is source-only because that installed version could not create a live session during verification. OpenCode, GitHub Copilot, and Cursor have no equivalent verified tool-process evidence; their adapter close contract still applies.
|
|
51
|
+
|
|
52
|
+
[Extension commands](extensions.md) discover static manifests and manage explicit per-user consent in the owner-only `~/.subharness/extensions.json` file. `subharness extensions` without a subcommand prints extensions usage to stderr and exits `2`; `subharness extensions --help` prints it to stdout and exits `0`. These commands use text output, never import extension modules, and do not accept `--format`. The coordinator supervises each applicable extension in a separate child process when its first matching session is admitted. Newly admitted CLI and connected SDK sessions are assigned to enabled global extensions and enabled repository extensions for their checkout. The dashboard and embedded runners do not load extension code.
|
|
53
|
+
|
|
35
54
|
## Live dashboard
|
|
36
55
|
|
|
37
56
|
`subharness dashboard` opens a read-only live terminal display for the current local coordinator, covering all of its managed directories, with the calling checkout pinned first when it has displayed runs. It includes direct harness sessions, specialists, and delegated agents managed by that coordinator. It does not discover unmanaged native processes or coordinators belonging to other installations or state directories.
|
|
@@ -50,11 +69,11 @@ The harness label is `codex`, `claude`, `fx`, `opencode`, `copilot`, or `cursor`
|
|
|
50
69
|
|
|
51
70
|
Time is elapsed wall time since that task first dispatched, including waiting and recovery. A queued task shows `00:00`. Completed, cancelled, and interrupted tasks freeze their elapsed time when that outcome is reached. Failed tasks freeze their elapsed time at failure and resume counting from the original start if explicitly recovered. Tasks cancelled before first dispatch show `00:00`. Repeated observation or cancellation that leaves a settled terminal outcome unchanged does not change its recorded finish time. If stopping previously unconfirmed execution reaches a new outcome, timing records that new outcome. Durations use `MM:SS` below one hour and `H:MM:SS` thereafter. State and elapsed time occupy separate aligned columns. Finished rows include completion age when space permits, as defined in [Dashboard presentation](dashboard-design.md). Narrow terminals truncate titles by display width without splitting grapheme clusters; when the fixed fields alone do not fit, the row is clipped to the available columns.
|
|
52
71
|
|
|
53
|
-
The overview contains compact group labels and agent rows: no application heading, border, footer, spinner, key hints, or empty-state message. A leading `›` identifies the selected task. It uses the alternate screen and restores the normal screen and cursor on exit. When stdin is a terminal, keyboard echo is suppressed and Up/Down, Enter, Escape and inspector scrolling keys are handled; the previous input mode is restored on exit. Non-terminal stdin is not consumed. Overview rows do not wrap; selection scrolls the list to reach runs outside the viewport. Current work takes precedence over finished history within each group. Enter opens the selected task's agent-session history with queued requests first and remaining requests newest first. Up/Down select requests; Enter
|
|
72
|
+
The overview contains compact group labels and agent rows: no application heading, border, footer, spinner, key hints, or empty-state message. A leading `›` identifies the selected task. It uses the alternate screen and restores the normal screen and cursor on exit. When stdin is a terminal, keyboard echo is suppressed and Up/Down, Enter, Escape and inspector scrolling keys are handled; the previous input mode is restored on exit. Non-terminal stdin is not consumed. Overview rows do not wrap; selection scrolls the list to reach runs outside the viewport. Current work takes precedence over finished history within each group. Enter opens the selected task's agent-session history with queued requests first and remaining requests newest first. Up/Down select requests; Enter opens a dedicated task screen with agent name, known harness/model, state, workspace, elapsed time, original request, error and latest response. The core task screen subscribes to live events and renders selectable arriving steps: Up/Down moves through them, Enter expands/collapses bounded details, and PageUp/PageDown/Home/End scroll. A compact Sub-agents footer summarizes direct child sessions. Completed states are green when color is enabled. Escape returns from the task screen to the request list, then from that list to the overview. The detailed navigation and presentation rules are defined in [Dashboard presentation](dashboard-design.md#task-screen). Dashboard inspection is read-only and does not load user extensions. Ctrl+C exits with code `130`; SIGTERM exits with code `143`. Exiting never cancels agents.
|
|
54
73
|
|
|
55
|
-
Snapshots refresh once per second without overlapping requests. Resizing redraws the current
|
|
74
|
+
Snapshots refresh once per second without overlapping requests. Opening a task screen also opens the public [live event subscription](../events.md) scoped to that task; leaving closes it. Only events accepted after registration populate turns and steps. Past events are not loaded; the existing request, task error and latest complete response remain available. Content produced before registration appears only if the native route itself later supplies it in a snapshot. For mid-item joins on chunk-only fx and Cursor ACP routes, turn-boundary snapshots include only content normalized since registration and use item state `"incomplete"`. Only the selected task's own steps are displayed. Approval events add `Approval` rows with `pending`, `answered` or `withdrawn` state and the observed request message; session errors add inline notice rows. The dashboard display keeps at most 500 steps including those rows, dropping the oldest with a visible notice that earlier steps were omitted. User extensions are supervised independently by the coordinator and have no dashboard UI. Event consumption is independent of rendering speed. If `EVENT_BACKPRESSURE` occurs, the screen shows a missed-steps notice and reopens at most once every 2 seconds. After 3 consecutive backpressure failures within 60 seconds, counting failed reopens, retries stop with “Live steps paused; reopen the task to retry.” Missing `session-events-v1` support shows `COORDINATOR_OUTDATED` with coordinator restart guidance in place of live steps while core content remains available. Other event-stream failures show safe diagnostics while core inspection remains available. Extension diagnostics are shown only by `subharness extensions list`, not on the task screen. Resizing redraws the current view immediately. Unchanged visible rows are not rewritten. Rendering uses native Node streams and terminal escape sequences with a focused Unicode width utility. Slow output does not accumulate unbounded redraws.
|
|
56
75
|
|
|
57
|
-
The command requires terminal stdout and a terminal supporting cursor control; non-terminal output and `TERM=dumb` fail with `INVALID_ARGUMENT` and exit `2` before connecting or emitting terminal escapes. It accepts no positional arguments or options except `--help`, which follows general command help behavior. In particular, it has no `--format` or `--cwd` option. Errors use ordinary text stderr after restoring the terminal. It does not load agent definitions, start a coordinator, start a harness, or submit work. If no coordinator is initially reachable, the list stays blank and checks again once per second so agents started later can appear. After a successful connection, a failed, invalid, or timed-out snapshot exits with an error instead of presenting stale data. The snapshot
|
|
76
|
+
The command requires terminal stdout and a terminal supporting cursor control; non-terminal output and `TERM=dumb` fail with `INVALID_ARGUMENT` and exit `2` before connecting or emitting terminal escapes. It accepts no positional arguments or options except `--help`, which follows general command help behavior. In particular, it has no `--format` or `--cwd` option. Errors use ordinary text stderr after restoring the terminal. It does not load agent definitions, start a coordinator, start a harness, or submit work. If no coordinator is initially reachable, the list stays blank and checks again once per second so agents started later can appear. After a successful connection, a failed, invalid, or timed-out snapshot exits with an error instead of presenting stale data. The snapshot identifies finished-run history with `history: true`, grouped checkout context with `grouping: true`, and the expanded task-detail fields with `taskDetails: true`. An absent or false `taskDetails` marker keeps the dashboard running; opening a task screen shows `COORDINATOR_OUTDATED` with restart guidance instead of task details. Among these markers, only missing `history` or `grouping` ends the dashboard with `COORDINATOR_OUTDATED` and exit `1`. The legacy unknown-operation error for `dashboard` has the same exit behavior. The error identifies the coordinator process and directs the user to stop it after active work ends and start a new run. Restarting only the dashboard does not reload coordinator code. Coordinator restart discards retained in-memory history; the dashboard never restarts it automatically. Snapshot requests have a five-second timeout.
|
|
58
77
|
|
|
59
78
|
## Direct harnesses and specialists
|
|
60
79
|
|
|
@@ -91,6 +110,10 @@ Direct-harness help for `run` and `check` describes the relevant options and acc
|
|
|
91
110
|
|
|
92
111
|
`run` and `send` require exactly one prompt source: one positional text argument, `--prompt <text>`, or `--prompt-file <path|->`. Quote a positional prompt containing spaces; extra positional arguments are errors rather than implicitly joined text. `--` ends option parsing and allows a positional prompt beginning with a dash. It never introduces native harness arguments.
|
|
93
112
|
|
|
113
|
+
Callers that generate long or multiline prompts should use `--prompt-file <path>` with an owner-private temporary file. Owner-private means that only the owner can access it; on POSIX systems, use mode `0600` inside a mode-`0700` temporary directory. Remove the file after a `started` or `accepted` record, or command exit, confirms that the CLI has read it. When the host owns standard input, callers may instead use `--prompt-file -`.
|
|
114
|
+
|
|
115
|
+
Generated long or multiline prompts should not be passed through `--prompt` or a positional argument. Large argument vectors increase process-launch cost, and a host argument limit can reject process launch with an explicit host error. Keeping the prompt payload out of the argument vector does not eliminate unrelated host resource pressure. If the host instead kills the CLI before admission, no task exists and the command prints nothing.
|
|
116
|
+
|
|
94
117
|
`--prompt-file -` reads standard input to EOF. It is explicit: piped stdin is not read or appended when another prompt source is supplied. Interactive terminal stdin is rejected instead of waiting for a conversation. Missing, empty, invalid UTF-8, and oversized input fail before session admission. File and stdin diagnostics distinguish read failures from invalid UTF-8 content. Files and stdin are bounded while reading to 1 MiB. File paths resolve relative to the calling command's directory, independently of `--cwd`. Omitted `--cwd` uses the calling directory. Follow-ups retain their session's execution directory.
|
|
95
118
|
|
|
96
119
|
`send` defaults to `queue`, creating a new task that waits for the active task's full completion boundary. `steer` targets whichever task is active when handled. If that task is between native turns, steering starts a continuation of the same task. If an actively generating harness lacks steering, the operation follows `interrupt` semantics and reports the effective mode. `interrupt` cancels affected work, waits for stop confirmation, and starts a replacement before independently queued tasks. See [message delivery](../message-delivery.md).
|
package/sdk/cli/output.md
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
[Error diagnostics](../diagnostics.md) defines safe process and coordinator communication details. These details enrich message text without changing the error record shape or command exit-code rules.
|
|
4
4
|
|
|
5
|
-
`dashboard` is a terminal-only live view, not an execution-record command. It accepts no `--format` option and emits no text/JSONL records on success. Its
|
|
5
|
+
`dashboard` is a terminal-only live view, not an execution-record command. It accepts no `--format` option and emits no text/JSONL records on success. Its overview, request list, task screen, empty state and terminal lifecycle are defined in the [CLI contract](index.md#live-dashboard).
|
|
6
|
+
|
|
7
|
+
[Extension management commands](extensions.md) use plain text and the exit codes defined on that page; they do not accept `--format`. Supervised extension diagnostics are visible through `subharness extensions list`; extension output never interleaves with execution-command records or dashboard rendering. The public [live event subscription](../events.md) is a separate SDK stream, not another `run`/`wait` output mode.
|
|
6
8
|
|
|
7
9
|
Execution commands accept `--format text|jsonl`; `text` is the default. Both formats report the same operations. JSONL contains complete records separated by newlines, never native token streams or tool transcripts. All records include `version: 1` and a `type` discriminator. Identifiers are opaque strings prefixed with `ses_`, `tsk_`, `rsp_`, or `req_` and are not paths or process identifiers.
|
|
8
10
|
|
|
@@ -39,10 +41,20 @@ The identifiers above are illustrative. A `response` contains `sessionId`, `task
|
|
|
39
41
|
|
|
40
42
|
An `accepted` record contains `sessionId`, `taskId`, `delivery: "steer"`. A successful `cancel` emits a `cancelled` record with the targeted task identity and final state, after affected native execution has stopped. Already-terminal tasks retain their existing state. `resume` emits `started` for the existing task with `resumed: true`, then its next response or terminal outcome.
|
|
41
43
|
|
|
44
|
+
A successful `close` emits exactly one record after session cleanup completes:
|
|
45
|
+
|
|
46
|
+
```jsonl
|
|
47
|
+
{"version":1,"type":"closed","sessionId":"ses_123"}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Text output is `Closed session ses_123.`. Repeated close of an already closed session has the same successful output.
|
|
51
|
+
|
|
42
52
|
Errors use `{ "version": 1, "type": "error", "error": { "code": "INVALID_ARGUMENT", "message": "..." } }` with task/session identifiers when known. JSONL errors appear on stdout; text errors appear on stderr. Native stderr and credentials are not forwarded. Text responses show identifiers and state above the complete response text, with a `wait --after` hint only while the task is pending. Text layout is intended for reading; integrations should use JSONL.
|
|
43
53
|
|
|
44
54
|
Exit code `0` means the command succeeded or a response was returned; it does not mean the agent fulfilled the objective. For `check`, it means only that the selected target's startup checks passed at that moment. For `run --detach` and detached task-creating sends, it means admission succeeded, not that native startup or execution succeeded. Admission errors retain their existing error records and exit codes; later failures are available through `wait` or `status`. Code `1` means execution, access, or capability failure; `2` means invalid input, configuration, or unknown identifiers; and `130` means an observation ended in cancellation or interruption. Successful `cancel` itself exits `0`. Combining `--detach` with `--delivery steer` is an `INVALID_ARGUMENT` error and exits `2`.
|
|
45
55
|
|
|
56
|
+
Successful `close` exits `0`. An unknown session returns `UNKNOWN_SESSION` and exits `2`. An unavailable coordinator returns `COORDINATOR_UNAVAILABLE` and exits `1` without starting one. A coordinator that does not support session close returns `COORDINATOR_OUTDATED` with restart guidance and exits `1`. Cancellation or native cleanup failure retains the safe `CANCEL_FAILED` or cleanup diagnostic and exits `1`. When cancellation and native cleanup both fail in one close attempt, the native-cleanup diagnostic takes precedence because native resource retirement remains unconfirmed.
|
|
57
|
+
|
|
46
58
|
`status` snapshots retain the observed task’s outcome in their exit code: queued, running, waiting, awaiting_approval, and completed states exit `0`; cancelled or interrupted states exit `130`; failed states use `1` or `2` according to the stored error. A retrieval error uses its own error code.
|
|
47
59
|
|
|
48
60
|
Standard CLI `--help` and `--version` produce plain text, do not accept `--format`, and do not start the coordinator or harnesses. Command-level `--help` is also available without execution arguments. Unsupported options and extra positional arguments are errors.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Responses and Task Completion
|
|
2
2
|
|
|
3
|
-
The [execution SDK](execution.md) provides complete-response cursors and task snapshot observation directly to application code.
|
|
3
|
+
The [execution SDK](execution.md) provides complete-response cursors and task snapshot observation directly to application code. Its separate [session events API](events.md) provides bounded normalized assistant/reasoning content and tool previews where the native route supports them. Only events accepted after subscription registration are delivered; they do not replace complete-response retention or acknowledge child-result delivery. UI disconnects detach observers. Embedded runner lifetime is application-owned; shared coordinator work survives connected-client disconnect.
|
|
4
4
|
|
|
5
|
-
Returning a response, completing a task, and starting another caller model turn are separate operations. The CLI returns control after each complete native response from the requested agent. It includes task/session identity, response identity, and the task state.
|
|
5
|
+
Returning a response, completing a task, and starting another caller model turn are separate operations. The CLI returns control after each complete native response from the requested agent. It includes task/session identity, response identity, and the task state. Execution commands do not interleave live events or descendants' transcripts with their response records. The dashboard renders arriving steps from the separate public event source. [User extensions](extensions.md) execute independently in coordinator-supervised child processes.
|
|
6
6
|
|
|
7
7
|
The adapter captures complete responses automatically. Agents do not need a reporting tool, special JSON format, or a classifier that recognizes questions. A question is delivered through the same response mechanism as any other text.
|
|
8
8
|
|
package/sdk/config.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Agent Discovery
|
|
2
2
|
|
|
3
|
-
Repository agents live in `.subharness/agents/` at the Git worktree root. Global agents live in `~/.subharness/agents/`. The `.subharness/` directory holds subharness configuration
|
|
3
|
+
Repository agents live in `.subharness/agents/` at the Git worktree root. Global agents live in `~/.subharness/agents/`. The `.subharness/` directory holds subharness configuration, agent definitions, shared modules and optional extension installations. Cross-harness skills conventionally remain in `.agents/skills/`, which subharness does not read.
|
|
4
4
|
|
|
5
5
|
```text
|
|
6
6
|
project/
|
|
@@ -10,12 +10,19 @@ project/
|
|
|
10
10
|
reviewer.ts
|
|
11
11
|
tools/
|
|
12
12
|
uppercaseTool.ts
|
|
13
|
+
extensions/
|
|
14
|
+
tool-result-logger/
|
|
15
|
+
extension.json
|
|
16
|
+
dist/
|
|
17
|
+
index.mjs
|
|
13
18
|
agents.local.json
|
|
14
19
|
```
|
|
15
20
|
|
|
16
21
|
Every `.ts` file under `agents/`, including files in nested directories, is a catalog entry that default-exports one `AgentDefinition`. Type declaration files ending in `.d.ts` are ignored. Other extensions are ignored. The file name does not determine the agent's name. There is no registry file or registration command. Symlink directories are not traversed. An invalid entry fails discovery with its source filename; it is not silently skipped.
|
|
17
22
|
|
|
18
|
-
Shared code such as custom tools, instruction fragments, and constants belongs outside `agents/`, for example in `.subharness/tools/`. Definitions import these modules with ordinary relative imports.
|
|
23
|
+
Shared code such as custom tools, instruction fragments, and constants belongs outside `agents/`, for example in `.subharness/tools/`. Definitions import these modules with ordinary relative imports. Agent discovery selects entries only under `agents/`; shared modules are loaded only through definition imports, and `tools/` is a convention rather than a discovered directory. A helper module placed inside `agents/` is treated as a definition and fails discovery when it does not default-export one.
|
|
24
|
+
|
|
25
|
+
Extension installations under `.subharness/extensions/<id>/` or `~/.subharness/extensions/<id>/` are separate from the agent catalog. Extension discovery reads static manifests only. Their compiled entries are executable code loaded only by a coordinator-supervised extension process after explicit per-user enablement. Agent discovery does not import extension entries. See [User extensions](extensions.md) and [extension commands](cli/extensions.md).
|
|
19
26
|
|
|
20
27
|
A definition imports shared modules and other definitions, such as a declared subagent, with relative paths:
|
|
21
28
|
|
|
@@ -51,6 +58,28 @@ An omitted `--cwd` uses the calling command's directory. Inside nested repositor
|
|
|
51
58
|
|
|
52
59
|
`check` resolves direct harnesses, repository and global specialists, unambiguous bare names, and declared children under the same rules as `run`. Direct harness checks bypass catalog discovery. Specialist checks evaluate the selected definition in an isolated worker, so they retain the same trust requirement and use the selected directory for definition loading and native startup. A check covers only that selected definition, not its declared children.
|
|
53
60
|
|
|
61
|
+
## Extension consent and logs
|
|
62
|
+
|
|
63
|
+
Extension consent is stored in `~/.subharness/extensions.json` with owner-only permissions. It uses this schema:
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"version": 1,
|
|
68
|
+
"global": ["<id>"],
|
|
69
|
+
"repositories": {
|
|
70
|
+
"<canonical checkout path>": ["<id>"]
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Enable and disable updates are serialized through the owner-private `~/.subharness/extensions.lock.sqlite` coordination file. The lock file contains no consent data. Each update re-reads `extensions.json` while it owns the lock before writing the replacement.
|
|
76
|
+
|
|
77
|
+
`global` contains enabled global extension IDs. Each `repositories` key is a canonical checkout path whose array contains enabled repository extension IDs. Repository consent is per checkout and never written into repository files. An instance is identified by its qualified reference plus its canonical checkout for repository extensions, or by its qualified reference alone for global extensions. Failure state, eligibility and re-enablement apply per instance; enabling in one checkout does not reset or enable another checkout's instance. The [extension commands](cli/extensions.md) read and update this file; discovery alone does not grant consent.
|
|
78
|
+
|
|
79
|
+
The consent file is at most 256 KiB. `repositories` contains at most 1,024 checkout entries. Each scope contains at most 256 IDs: the `global` array and each repository array have that limit independently. Every extensions command rejects an existing consent file that is not owner-only, exits `1`, and directs the user to restrict its permissions with `chmod 600 ~/.subharness/extensions.json`. No command repairs permissions. The [extension-command exit codes](cli/extensions.md#output-and-failures) take precedence over general CLI configuration exit codes for these commands.
|
|
80
|
+
|
|
81
|
+
Global instances write stdout/stderr to `<stateDirectory>/extensions/global-<id>.log`. Repository instances use `<stateDirectory>/extensions/repo-<id>-<checkout-hash>.log`, where `<checkout-hash>` is the first 12 hex characters of the SHA-256 of the canonical checkout path. Filenames contain no colons. The log uses owner-only access. It is compacted after it exceeds 1.5 MiB and trimmed to the most recent 1 MiB. The selected coordinator's state directory follows [execution discovery](execution.md#ownership-and-transport-boundaries): explicit `ConnectOptions.stateDirectory`, then `AGENT_STATE_DIR`, then `~/.subharness/state/shared`; CLI commands use the environment/default rule. Consent remains in `~/.subharness/extensions.json` regardless of the selected coordinator state directory. `subharness extensions list` shows each instance's actual log path, never its contents.
|
|
82
|
+
|
|
54
83
|
## Personal access and worktrees
|
|
55
84
|
|
|
56
85
|
The optional [access file](access-config.md) is `.subharness/agents.local.json` in the repository's main checkout, shared by its linked worktrees. This means the local checkout associated with those worktrees, not a branch named `main` or another clone of the same remote. Worktree agent definitions and execution directories still come from the selected worktree.
|
package/sdk/copilot.md
CHANGED
|
@@ -44,7 +44,7 @@ Enterprise managed-policy self-fetch is enabled for explicit GitHub-token access
|
|
|
44
44
|
|
|
45
45
|
## Lifecycle
|
|
46
46
|
|
|
47
|
-
Follow-ups reuse the native session. Events are correlated to the active turn; a final assistant message alone is not successful completion. A session-idle event is accepted in any native session mode after evidence that the submitted turn started, and only when no native work remains. A stale idle event cannot complete a newly submitted task. The adapter reports native shutdown or transport loss as an execution failure and limits final response text to 1 MiB. Model or endpoint substitutions fail without replay. Turn completion withdraws remaining approval requests.
|
|
47
|
+
Follow-ups reuse the native session. Events are correlated to the active turn; a final assistant message alone is not successful completion. [Live session events](events.md#effective-route-capabilities) expose bounded text/reasoning and tool previews separately from the final response. Their effective capabilities omit `nativeVersion` because the pinned SDK package version is not the native runtime version and the adapter does not expose a verified runtime version. Native streaming is enabled at every session startup so later subscribers receive subsequent deltas. With no subscriber, event normalization and event IPC are skipped. A session-idle event is accepted in any native session mode after evidence that the submitted turn started, and only when no native work remains. A stale idle event cannot complete a newly submitted task. The adapter reports native shutdown or transport loss as an execution failure and limits final response text to 1 MiB. Model or endpoint substitutions fail without replay. Turn completion withdraws remaining approval requests.
|
|
48
48
|
|
|
49
49
|
Interruption stops tool admission, withdraws pending approvals, requests native abort, confirms no native work remains, and waits for admitted callbacks. An abort acknowledgement alone does not prove the native process stopped. Native cancellation requests and status checks are bounded; a cancellation that cannot establish idle/termination returns `CANCELLATION_FAILED`. Already-admitted host callbacks are drained without imposing that native cancellation deadline on their execution. Steering uses the coordinator's interrupt behavior, and prompt-free recovery returns `RECOVERY_UNSUPPORTED`.
|
|
50
50
|
|
package/sdk/cursor.md
CHANGED
|
@@ -41,7 +41,7 @@ For API-key access, the selected key is passed explicitly to the SDK. Subscripti
|
|
|
41
41
|
|
|
42
42
|
Successive tasks use the same native agent. Specialist instructions supplement the native harness instructions in the first user turn; they do not replace Cursor's system prompt. Declared tools use native SDK custom tools, validate inputs, preserve text and image results, and stop admitting calls when the task stops. Cancellation and close wait for admitted callbacks to settle.
|
|
43
43
|
|
|
44
|
-
Active steering returns `UNSUPPORTED_DELIVERY`; the coordinator applies its documented interrupt-and-replace behavior. Interruption cancels the active native run and waits for terminal completion. Failure to confirm native stop returns `CANCELLATION_FAILED`, fails the active turn, and prevents further tasks in that session. Tool admission remains closed; close must still dispose the native agent and drain admitted callbacks. Prompt-free recovery returns `RECOVERY_UNSUPPORTED`. A turn succeeds only with a successful terminal result and returns its final text. Responses are limited to 1 MiB.
|
|
44
|
+
Active steering returns `UNSUPPORTED_DELIVERY`; the coordinator applies its documented interrupt-and-replace behavior. Interruption cancels the active native run and waits for terminal completion. Failure to confirm native stop returns `CANCELLATION_FAILED`, fails the active turn, and prevents further tasks in that session. Tool admission remains closed; close must still dispose the native agent and drain admitted callbacks. Prompt-free recovery returns `RECOVERY_UNSUPPORTED`. A turn succeeds only with a successful terminal result and returns its final text. [Live session events](events.md#effective-route-capabilities) are separate bounded previews: the `cursor-sdk` route declares assistant support `"available"` with delivery `["snapshot"]` for final responses, reasoning support `"unverified"` with delivery `[]`, and tool snapshots where supported. Unverified reasoning may or may not arrive and callers must not depend on it. Interactive approvals remain unavailable. Responses are limited to 1 MiB.
|
|
45
45
|
|
|
46
46
|
The SDK's headless permission decisions remain native. This SDK version exposes no supported interactive approval or input channel to the adapter. Its `request` message records a backend request identifier and is not an approval request. Native run failures produce a sanitized execution error; the adapter does not invent an `INPUT_REQUIRED` mapping from undocumented error codes. Close disposes the native agent and drains custom tools. `check cursor` verifies credential/model discovery, local agent creation, and disposal without submitting a prompt; it does not prove quota or that a later shell command will be permitted.
|
|
47
47
|
|
|
@@ -65,4 +65,4 @@ For subscription access, either explicit `sandboxMode` value fails with `UNSUPPO
|
|
|
65
65
|
|
|
66
66
|
Declared tools use a uniquely named private MCP server supplied in `session/new`. The adapter verifies that the native client initializes the server before admitting prompts; a skipped or failed native MCP connection is a startup error. MCP request bodies are limited to 16 MiB and headers to 16 KiB. Text and image results retain their MCP content types and shared tool-result limits. Native approval rules still apply. Active `session/request_permission` requests expose only the offered allow-once and reject-once choices through the shared approval flow with `harness: "cursor"`; persistent allow-always/reject-always choices are not exposed. Original native option IDs are retained. Unsupported or malformed interactive requests, including questions and plan approval, fail with `INPUT_REQUIRED` and cancel the native turn. Startup-time interactive requests are unsupported. Withdrawal, terminal completion, cancellation, and close retire pending requests; late answers never grant permission.
|
|
67
67
|
|
|
68
|
-
A terminal ACP `end_turn` returns the accumulated assistant text. `cancelled` is interruption; refusal or exhausted-limit terminal reasons and RPC/transport failures reject with a sanitized execution error. This CLI release can render some backend failures as ordinary assistant text followed by `end_turn`, without a separate failure signal. Such text is returned as native output; a completed Subharness task on this route means the native turn ended, not that every backend operation succeeded. The adapter does not guess error status from prose. Raw transport diagnostics remain private. This capability limit is specific to the subscription ACP route; the API-key SDK route retains its typed native results.
|
|
68
|
+
A terminal ACP `end_turn` returns the accumulated assistant text. [Live session events](events.md#effective-route-capabilities) can also capture assistant chunks; vendor reasoning and tool update emission on this route remain unverified. Only currently subscribed observers receive these events. `cancelled` is interruption; refusal or exhausted-limit terminal reasons and RPC/transport failures reject with a sanitized execution error. This CLI release can render some backend failures as ordinary assistant text followed by `end_turn`, without a separate failure signal. Such text is returned as native output; a completed Subharness task on this route means the native turn ended, not that every backend operation succeeded. The adapter does not guess error status from prose. Raw transport diagnostics remain private. This capability limit is specific to the subscription ACP route; the API-key SDK route retains its typed native results.
|
package/sdk/diagnostics.md
CHANGED
|
@@ -2,12 +2,47 @@
|
|
|
2
2
|
|
|
3
3
|
Error records retain their existing `{ code, message }` shape. Messages describe the operation that failed and include safe, observed context that helps callers identify the cause. The diagnostics described here never include raw native stderr, SDK exception text, HTTP response bodies, RPC error messages or data, prompts, credential values, or configuration contents. Unknown native values receive a fixed generic explanation rather than being echoed. Paths included in these diagnostic cases are quoted with C0, C1, DEL, and Unicode line separators escaped.
|
|
4
4
|
|
|
5
|
+
## Context-exhaustion error code
|
|
6
|
+
|
|
7
|
+
This harness-neutral terminal-classification code lets callers handle context exhaustion without parsing message text. This is not a complete index of public error codes.
|
|
8
|
+
|
|
9
|
+
| Code | Meaning |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| `CONTEXT_WINDOW_EXCEEDED` | The native harness reported that the turn exhausted its context window. The Codex adapter currently produces this code. |
|
|
12
|
+
|
|
5
13
|
## Claude startup and turn failures
|
|
6
14
|
|
|
7
15
|
Claude startup distinguishes native account inspection, model catalog retrieval, and model settings validation. An unexpected exception from account inspection or model catalog retrieval is `HARNESS_FAILED`, with the failed phase identified. Unexpected exceptions after successful access verification are also harness failures identified by the current startup phase. They do not establish unavailable access and do not permit connection or harness fallback. A completed account inspection that demonstrates unavailable or incompatible access retains `ACCESS_UNAVAILABLE` and its existing eligible fallback behavior. Existing explicit configuration, settings capability, model, and effort errors retain their codes and guidance, including `--model` guidance for an unverifiable native default. Cleanup and no-prompt-before-verification rules remain unchanged.
|
|
8
16
|
|
|
9
17
|
Claude terminal result failures retain `HARNESS_ERROR`. Recognized result subtypes distinguish a native turn limit, a native budget limit, exhausted structured-output retries, and an error during execution. Messages describe the reported category without claiming an unobserved provider cause, quoting native error text, or promising that Subharness exposes configuration for every native limit. Unknown subtypes and unsuccessful results without a recognized category receive a fixed generic turn-failure message. A reported execution failure is never automatically retried or replayed.
|
|
10
18
|
|
|
19
|
+
## Codex turn failures
|
|
20
|
+
|
|
21
|
+
When Codex completes a turn with status `failed`, the adapter classifies the terminal turn's `error.codexErrorInfo` against the installed App Server schema categories below. The terminal record is authoritative. An earlier `error` notification with `willRetry: true` does not fail the turn or determine its classification.
|
|
22
|
+
|
|
23
|
+
| Codex category | Error code | Fixed message |
|
|
24
|
+
| --- | --- | --- |
|
|
25
|
+
| `contextWindowExceeded` | `CONTEXT_WINDOW_EXCEEDED` | Codex reported context-window exhaustion. The turn was not replayed. Cancel the failed task to release queued work, then continue in a new session or submit a smaller task. |
|
|
26
|
+
| `sessionBudgetExceeded` | `HARNESS_FAILED` | Codex reported that the session budget was exhausted. The turn was not replayed. Cancel the failed task to release queued work, then continue in a new session. |
|
|
27
|
+
| `usageLimitExceeded` | `HARNESS_FAILED` | Codex reported that the account usage limit was exhausted. The turn was not replayed. Cancel the failed task to release queued work, then try again after usage is available. |
|
|
28
|
+
| `rateLimitExceeded` | `HARNESS_FAILED` | Codex reported a provider rate limit. The turn was not replayed. Cancel the failed task to release queued work, then try again after the rate limit resets. |
|
|
29
|
+
| `serverOverloaded` | `HARNESS_FAILED` | Codex reported that the provider was overloaded. The turn was not replayed. Cancel the failed task to release queued work, then try again later. |
|
|
30
|
+
| `cyberPolicy` | `HARNESS_FAILED` | Codex reported that its cyber-safety policy blocked the turn. The turn was not replayed. Cancel the failed task to release queued work, then revise the task before creating new work. |
|
|
31
|
+
| `misalignmentPolicyViolation` | `HARNESS_FAILED` | Codex reported that its safety policy blocked the turn for misalignment. The turn was not replayed. Cancel the failed task to release queued work, then revise the task before creating new work. |
|
|
32
|
+
| `httpConnectionFailed` | `HARNESS_FAILED` | Codex reported that its provider HTTP connection failed. The turn was not replayed. Cancel the failed task to release queued work, then verify connectivity before creating new work. |
|
|
33
|
+
| `responseStreamConnectionFailed` | `HARNESS_FAILED` | Codex reported that its provider response-stream connection failed. The turn was not replayed. Cancel the failed task to release queued work, then verify connectivity before creating new work. |
|
|
34
|
+
| `internalServerError` | `HARNESS_FAILED` | Codex reported an internal provider error. The turn was not replayed. Cancel the failed task to release queued work, then try again later. |
|
|
35
|
+
| `unauthorized` | `HARNESS_FAILED` | Codex reported that the provider rejected authorization. The turn was not replayed. Cancel the failed task to release queued work, then verify Codex authentication before creating new work. |
|
|
36
|
+
| `badRequest` | `HARNESS_FAILED` | Codex reported that the provider rejected the request as invalid. The turn was not replayed. Cancel the failed task to release queued work, then verify the model and provider configuration before creating new work. |
|
|
37
|
+
| `threadRollbackFailed` | `HARNESS_FAILED` | Codex reported that it could not roll back the native thread after a failure. The turn was not replayed. Cancel the failed task to release queued work, then continue in a new session. |
|
|
38
|
+
| `sandboxError` | `HARNESS_FAILED` | Codex reported a native sandbox failure. The turn was not replayed. Cancel the failed task to release queued work, then verify the sandbox configuration and permissions before creating new work. |
|
|
39
|
+
| `responseStreamDisconnected` | `HARNESS_FAILED` | Codex reported that the provider response stream disconnected. The turn was not replayed. Cancel the failed task to release queued work, then verify connectivity before creating new work. |
|
|
40
|
+
| `responseTooManyFailedAttempts` | `HARNESS_FAILED` | Codex reported that the provider response failed after repeated attempts. The turn was not replayed. Cancel the failed task to release queued work, then try again later. |
|
|
41
|
+
| `activeTurnNotSteerable` | `HARNESS_FAILED` | Codex reported that the active native turn could not be steered. The turn was not replayed. Cancel the failed task to release queued work, then submit the correction as new work. |
|
|
42
|
+
| `other` | `HARNESS_FAILED` | Codex reported another classified native turn failure. The turn was not replayed. Cancel the failed task to release queued work, then inspect the failed task before creating new work. |
|
|
43
|
+
|
|
44
|
+
The object-shaped connection and stream categories require `httpStatusCode` to be `null` or an unsigned 16-bit integer. The steering category requires `turnKind` to be `review` or `compact`. Additive fields do not change a recognized category and are never exposed. Missing, unknown, or malformed categories use `HARNESS_FAILED` with `Codex did not complete the turn successfully.` Native `message`, `additionalDetails`, HTTP status, steering kind, misalignment details, and all other native text or metadata are never included. `INTERRUPTED` and `PROTOCOL_ERROR` classification is unchanged.
|
|
45
|
+
|
|
11
46
|
## Native protocol and process failures
|
|
12
47
|
|
|
13
48
|
Codex and fx RPC rejection messages identify the requested native method and include the native error code only when it is a safe integer. Known JSON-RPC codes use fixed categories: `-32700` is a parse error, `-32600` an invalid request, `-32601` an unavailable method, `-32602` invalid parameters, and `-32603` an internal error. Other safe integer codes remain numeric without an invented interpretation. Missing or malformed codes are not printed. A generic rejection does not claim that authentication or native configuration caused the error. Existing steering and session-option capability classifications retain their Subharness error codes and useful recovery guidance. Freeform native messages and error data are never forwarded.
|
|
@@ -20,6 +55,39 @@ Worker failures identify the pending operation when available, such as startup,
|
|
|
20
55
|
|
|
21
56
|
Coordinator communication failures retain `COORDINATOR_UNAVAILABLE`. A non-success HTTP response identifies its numeric status and a recognized requested operation, when available. A successful response with no body is distinguished from HTTP rejection. Invalid JSON records, an incomplete final record, and an interrupted response stream have distinct fixed explanations. Transport failures retain the statement that the task was not automatically retried. These diagnostics do not expose endpoint tokens, raw request or response contents, or arbitrary operation names. They do not infer whether a task completed from an HTTP or transport failure and do not automatically replay it.
|
|
22
57
|
|
|
58
|
+
## Live events and extensions
|
|
59
|
+
|
|
60
|
+
Live event subscriptions and capability reads use these safe error codes:
|
|
61
|
+
|
|
62
|
+
| Code | Meaning |
|
|
63
|
+
| --- | --- |
|
|
64
|
+
| `EVENT_BACKPRESSURE` | The subscriber exceeded its 128-event or 1 MiB pending-delivery bound. Its stream rejects; execution and other subscribers are unaffected. |
|
|
65
|
+
| `OBSERVATION_CLOSED` | An already aborted signal rejects `events.open` without registration; abort after registration rejects a pending read. Failed embedded runner close also rejects pending subscription reads with this code. It ends observation only. |
|
|
66
|
+
| `COORDINATOR_UNAVAILABLE` | Connected disconnect or failed coordinator close rejects pending subscription reads with this code. |
|
|
67
|
+
| `COORDINATOR_INCOMPATIBLE` | The event operation requires `session-events-v1`, which the coordinator does not advertise. Supported execution and inspection remain usable. |
|
|
68
|
+
| `UNKNOWN_SESSION` | Subscription or capability lookup names an unknown session. `capabilities(sessionId)` resolves `undefined` only for a known session before harness selection. |
|
|
69
|
+
| `UNKNOWN_TASK` | A task-scoped subscription names an unknown task. |
|
|
70
|
+
|
|
71
|
+
`session.error` events with `category: "capture"` report live-event processing failures, not execution failures. Their `error.code` is `CAPTURE_FAILED` for invalid or undeliverable observation data detected by an adapter or by the owner's worker lane, or a more specific existing code where a route documents one. A capture error never changes the task's execution outcome.
|
|
72
|
+
|
|
73
|
+
If closing an execution owner fails, every open subscription of that owner ends, regardless of scope. Pending reads reject with `OBSERVATION_CLOSED` for embedded runner subscriptions and `COORDINATOR_UNAVAILABLE` for connected subscriptions.
|
|
74
|
+
|
|
75
|
+
Event-processing failures detected by the owner itself, such as dropping an invalid adapter draft, use `session.error` with `category: "capture"` and `origin: "owner"`. Owner-raised session errors may have category `"execution"` or `"capture"`; adapter-raised session errors have category `"capture"` only. Each adapter keeps normalization state for at most 1,024 open items per session. Items beyond that bound are not forwarded, and the adapter raises one capture error per turn that overflows. Capture errors do not change execution outcomes.
|
|
76
|
+
|
|
77
|
+
The Codex, Claude Code, fx, Copilot and Cursor SDK adapters also track at most 1,024 distinct item identities per turn. Later new identities are not forwarded after that bound is reached, and the adapter raises one capture error for the turn. Previously admitted identities may still complete. This bound does not change execution outcomes.
|
|
78
|
+
|
|
79
|
+
Codex, fx, Copilot and Cursor SDK emit at most one adapter capture error per turn for malformed optional live-event data. Codex, fx and Cursor SDK use `CAPTURE_FAILED`; Copilot retains `PROTOCOL_ERROR`. Cursor SDK capture failures are distinct from `NATIVE_ERROR` execution failures.
|
|
80
|
+
|
|
81
|
+
The dashboard maps missing `session-events-v1` support to `COORDINATOR_OUTDATED` with coordinator restart guidance in place of live steps; core task content remains visible. An absent or false `taskDetails` marker on the dashboard snapshot keeps the dashboard running and displays `COORDINATOR_OUTDATED` with restart guidance instead of task details when the task screen opens. Missing `history` or `grouping` markers end the dashboard with `COORDINATOR_OUTDATED` and exit `1`. These presentation rules do not change the SDK event error code.
|
|
82
|
+
|
|
83
|
+
The CLI displays `EXTENSION_*` codes with their safe messages only through `subharness extensions list`; they also remain available through the coordinator's existing safe diagnostics. The dashboard does not display extension diagnostics. [User extensions](extensions.md#bounds-shutdown-and-diagnostics) defines `EXTENSION_LOAD_FAILED`, `EXTENSION_INCOMPATIBLE`, `EXTENSION_HANDLER_FAILED`, `EXTENSION_TIMEOUT`, `EXTENSION_BACKPRESSURE`, `EXTENSION_DISPOSE_FAILED`, `EXTENSION_EXITED` and `EXTENSION_LOG_UNAVAILABLE`. An unexpected extension-process exit uses `EXTENSION_EXITED` and disables that instance under the same failure and recovery rules as other extension failures. `EXTENSION_LOG_UNAVAILABLE` is informational: a log open, write or close failure discards unwritable output and never stops the instance. These diagnostics identify the qualified reference and canonical checkout for repository instances without exposing raw exception messages, stacks, event content or child output. They do not change the agent's task outcome.
|
|
84
|
+
|
|
85
|
+
Extension discovery and consent-read failures during session admission are fail-open. The session is admitted without extension delivery, and the problem is retained as a separate admission diagnostic for `subharness extensions list`; it is not attributed to an instance when no identity is known. The coordinator retains at most the 16 most recent admission diagnostics. Each instance separately retains at most its eight most recent diagnostics, including whether each one disabled the instance and when it occurred.
|
|
86
|
+
|
|
87
|
+
Extension stdout/stderr is kept only in its owner-private bounded log: `<stateDirectory>/extensions/global-<id>.log` for a global instance or `<stateDirectory>/extensions/repo-<id>-<checkout-hash>.log` for a repository instance. `<checkout-hash>` is the first 12 hex characters of the SHA-256 of the canonical checkout path. The filenames contain no colons. Logs are located using the selected coordinator's [state-directory selection rule](execution.md#ownership-and-transport-boundaries). A log is compacted after it exceeds 1.5 MiB and is trimmed to the most recent 1 MiB. List shows the actual instance log path; log contents are never included in execution output, safe diagnostics or the dashboard. If enable saves consent but cannot notify a running coordinator, it warns that the failure state clears on coordinator restart and exits `0`; it does not roll back consent or claim successful notification.
|
|
88
|
+
|
|
89
|
+
`subharness extensions list` and the coordinator's extension-status operation each report at most 256 instances and report the exact number of additional instances omitted. Every extensions command rejects an existing consent file that is not owner-only with exit `1` and guidance to run `chmod 600 ~/.subharness/extensions.json`; no command repairs permissions. The [extension-command exit codes](cli/extensions.md#output-and-failures) govern these commands and take precedence over general CLI configuration exit codes.
|
|
90
|
+
|
|
23
91
|
## Access configuration and OIDC
|
|
24
92
|
|
|
25
93
|
Personal-access schema errors retain `INVALID_CONFIG` and identify their structural location: the root object, `access`, a recognized harness entry such as `access.claudeCode`, or a zero-based connection location such as `access.claudeCode[0]`. A known invalid connection property may extend that location, for example `access.claudeCode[0].env`. Unknown property names or harness names are not echoed because arbitrary keys can contain sensitive values. An unknown connection property identifies its containing connection. Errors raised while loading a file also identify its absolute, safely quoted main-checkout path, or execution-project path outside Git. Invalid JSON and file-read errors identify the same safely quoted path. Validation happens before any connection is attempted; it does not fabricate attempted-access context.
|
package/sdk/distribution.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Package Distribution
|
|
2
2
|
|
|
3
|
-
The npm package name is `subharness`. One package provides the TypeScript SDK and the `subharness` executable and its `agent` compatibility alias. Agent definitions import public helpers from `subharness`. The website workspace remains private and is not part of the npm package.
|
|
3
|
+
The npm package name is `subharness`. One package provides the TypeScript SDK and the `subharness` executable and its `agent` compatibility alias. Agent definitions import public helpers from `subharness`. Every event, subscription and capability type is exported from that root and re-exported as a type from `subharness/extensions`; extension authoring types use the `subharness/extensions` subpath. Compiled extension modules use no Subharness runtime import. The website workspace remains private and is not part of the npm package.
|
|
4
4
|
|
|
5
5
|
The source repository is [vercel-labs/subharness](https://github.com/vercel-labs/subharness). Its GitHub visibility is internal, so cloning requires repository access. The product name is subharness. The primary CLI command is `subharness`; `agent` remains an identical compatibility alias. Agent discovery and personal configuration live under `.subharness/`.
|
|
6
6
|
|
|
@@ -20,11 +20,21 @@ Repository scripts use pnpm, including workspace command forwarding and content-
|
|
|
20
20
|
|
|
21
21
|
A tarball built from a source checkout can differ from the registry release with the same version. The current package version is `0.0.3`, producing `subharness-0.0.3.tgz`. Install a local tarball with `npm install --save-dev /absolute/path/to/subharness-0.0.3.tgz`. Run the project's local executable with `npx subharness`.
|
|
22
22
|
|
|
23
|
+
## Extension directories and authoring types
|
|
24
|
+
|
|
25
|
+
The core package contains live event normalization/transport, manifest discovery, per-user consent in `~/.subharness/extensions.json` and coordinator supervision of extension children. `subharness/extensions` supplies TypeScript authoring declarations. User modules default-export a plain definition object and import its type with `import type`; their compiled ESM does not require Subharness as a runtime dependency. Embedded SDK applications consume events directly through the root package's event API.
|
|
26
|
+
|
|
27
|
+
An extension distribution contains `extension.json`, its compiled ESM entry and any required packaged dependencies. It is installed as a self-contained directory in the user's global or repository extension location. The coordinator starts a separate supervised child for an enabled installation when its first matching session is admitted; that child loads the entry. Listing and discovery inspect only static manifests, never import code, install packages or build TypeScript. User extension code and dependencies are not part of the core package or bundle.
|
|
28
|
+
|
|
29
|
+
The CLI task screen's renderer belongs to the core package and consumes live events directly. It does not load extension code. See [User extensions](extensions.md) for the type-only definition API and self-contained logger, and [extension commands](cli/extensions.md) for directory placement and explicit enablement.
|
|
30
|
+
|
|
31
|
+
The existing native SDK dependencies and native executable requirements are unchanged. Core release publishing follows the procedure below and does not publish user extension directories.
|
|
32
|
+
|
|
23
33
|
## Package contents and release checks
|
|
24
34
|
|
|
25
|
-
Packages built from this source contain the built JavaScript, declaration files and source maps under `dist/`, SDK Markdown documentation under `sdk/`, the README, the Apache License 2.0, and package metadata. Source maps embed the original TypeScript so debuggers can display it without a separate source checkout. Website code, development agents, skills, source assets, tests, `.context`,
|
|
35
|
+
Packages built from this source contain the built JavaScript, declaration files and source maps under `dist/`, SDK Markdown documentation under `sdk/`, the README, the Apache License 2.0, and package metadata. Package metadata exports `.` for the root SDK and `./extensions` for the `subharness/extensions` authoring declarations. The subpath supplies `ExtensionDefinition`, `ExtensionContext`, `ExtensionInstance` and `ExtensionManifest`, and re-exports every event, subscription and capability type from `subharness` as a type. Compiled extension code requires no runtime import from that subpath. Source maps embed the original TypeScript so debuggers can display it without a separate source checkout. Website code, development agents, skills, source assets, tests, `.context`, access configuration, extension consent files and logs, and environment files are excluded.
|
|
26
36
|
|
|
27
|
-
Packing builds the SDK from the current source before assembling its files. The CLI's `--version` output matches the package version. A clean consumer must be able to import the execution SDK, run an inline definition against a controlled native protocol fixture, and discover a TypeScript agent definition using the installed executable without access to the source checkout or a paid model call. `pnpm run check:package` packs with pnpm and verifies this clean-consumer behavior and the packaged file boundary without running a coding model. It requires network access to install dependencies from the public npm registry and disables install lifecycle scripts in the temporary consumer.
|
|
37
|
+
Packing builds the SDK from the current source before assembling its files. The CLI's `--version` output matches the package version. A clean consumer must be able to import the execution SDK, resolve the packaged `./extensions` subpath, type-check a definition and `SessionEvent` import from `subharness/extensions`, compile it without a Subharness runtime import, run an inline definition against a controlled native protocol fixture, and discover a TypeScript agent definition using the installed executable without access to the source checkout or a paid model call. `pnpm run check:package` packs with pnpm and verifies this clean-consumer behavior and the packaged file boundary without running a coding model. It requires network access to install dependencies from the public npm registry and disables install lifecycle scripts in the temporary consumer.
|
|
28
38
|
|
|
29
39
|
The committed lockfile pins dependency content with integrity hashes and does not embed company registry URLs. pnpm resolves packages through the configured registry, which defaults to the public npm registry. Installation and package verification do not change the developer's global npm registry configuration. Registry authentication remains with npm.
|
|
30
40
|
|