subharness 0.0.7 → 0.0.10
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 +40 -9
- 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 +6 -1
- package/dist/cli/args.js +63 -5
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/catalog-worker.js +3 -2
- package/dist/cli/catalog-worker.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 +15 -0
- package/dist/cli/extensions.js +187 -0
- package/dist/cli/extensions.js.map +1 -0
- package/dist/cli/help.d.ts +1 -0
- package/dist/cli/help.js +34 -6
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/main.js +100 -10
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/output.js +5 -1
- package/dist/cli/output.js.map +1 -1
- package/dist/config/access.d.ts +2 -1
- package/dist/config/access.js +18 -7
- package/dist/config/access.js.map +1 -1
- package/dist/config/loader.d.ts +2 -0
- package/dist/config/loader.js +20 -6
- package/dist/config/loader.js.map +1 -1
- package/dist/config/project-context.d.ts +9 -0
- package/dist/config/project-context.js +41 -0
- package/dist/config/project-context.js.map +1 -0
- package/dist/config/resolve-access.d.ts +2 -1
- package/dist/config/resolve-access.js +5 -2
- package/dist/config/resolve-access.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 +34 -0
- package/dist/extensions/catalog.js +103 -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.d.ts +4 -4
- package/dist/runtime/capture.js +59 -15
- package/dist/runtime/capture.js.map +1 -1
- package/dist/runtime/catalog.d.ts +6 -1
- package/dist/runtime/catalog.js +1 -1
- package/dist/runtime/catalog.js.map +1 -1
- package/dist/runtime/coordinator.d.ts +9 -4
- package/dist/runtime/coordinator.js +130 -27
- 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/definition.d.ts +1 -1
- package/dist/runtime/definition.js +2 -2
- package/dist/runtime/definition.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 +254 -0
- package/dist/runtime/extension-supervisor.js.map +1 -0
- package/dist/runtime/select-native.d.ts +3 -1
- package/dist/runtime/select-native.js +32 -5
- package/dist/runtime/select-native.js.map +1 -1
- package/dist/runtime/service.d.ts +5 -0
- package/dist/runtime/service.js +113 -15
- 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 +24 -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 +64 -9
- 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/access-config.md +9 -7
- package/sdk/adapter-contract.md +25 -3
- package/sdk/agent-skill.md +8 -5
- 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 +53 -14
- package/sdk/cli/output.md +14 -2
- package/sdk/completion-notifications.md +2 -2
- package/sdk/config.md +65 -11
- 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 +32 -10
- package/sdk/extensions.md +189 -0
- package/sdk/fx.md +4 -2
- package/sdk/harnesses.md +1 -1
- package/sdk/index.md +4 -0
- package/sdk/message-delivery.md +2 -0
- package/sdk/opencode.md +1 -1
- package/sdk/plugins/sub-agents.md +3 -1
- package/sdk/project-root.md +97 -0
- package/sdk/project-team.md +10 -4
- package/sdk/sessions.md +4 -0
- package/sdk/v1-runtime.md +22 -8
package/sdk/v1-runtime.md
CHANGED
|
@@ -4,7 +4,7 @@ The first usable version supplies a TypeScript definition and execution SDK and
|
|
|
4
4
|
|
|
5
5
|
## Package and definitions
|
|
6
6
|
|
|
7
|
-
The package is `subharness`, with the primary executable `subharness` and identical `agent` compatibility alias. Node.js 22.18 or newer is required. ESM exports include `agent`, `tool`, `toolResult`, `codex`, `claudeCode`, `fx`, `opencode`, `copilot`, `cursor`, and their definition/configuration types. The public SDK defines reusable specialists; direct CLI harness targets also execute without a definition. Execution uses either the CLI or the connected or embedded [execution SDK](execution.md). The SDK additionally exports the client, runner, handle, result, access, approval
|
|
7
|
+
The package is `subharness`, with the primary executable `subharness` and identical `agent` compatibility alias. Node.js 22.18 or newer is required. ESM exports include `agent`, `tool`, `toolResult`, `codex`, `claudeCode`, `fx`, `opencode`, `copilot`, `cursor`, and their definition/configuration types. The public SDK defines reusable specialists; direct CLI harness targets also execute without a definition. Execution uses either the CLI or the connected or embedded [execution SDK](execution.md). The SDK additionally exports the client, runner, handle, result, access, approval and error types defined there, and the normalized types and subscriptions in [Session events](events.md). The `subharness/extensions` subpath supplies the authoring types for [User extensions](extensions.md); compiled extension modules require no runtime import of Subharness. The daemon, worker, catalog, and launcher rules below describe CLI execution; an embedded runner owns its coordinator and inline tool closures in the host process, while a connected client shares the CLI coordinator. Definition objects have readonly configuration fields and no execution methods. They contain functions and schemas and are not a serialization format.
|
|
8
8
|
|
|
9
9
|
```ts
|
|
10
10
|
import { agent, codex, claudeCode, tool } from "subharness";
|
|
@@ -16,11 +16,13 @@ Custom tools accept Zod 4 object schemas that can be represented as JSON Schema.
|
|
|
16
16
|
|
|
17
17
|
## Discovery and loading
|
|
18
18
|
|
|
19
|
-
Global definitions live in `~/.subharness/agents/`; repository definitions live in `.subharness/agents/` at the execution worktree root. Every `.ts` file under those directories except `.d.ts` declarations is a definition entry; see [agent discovery](config.md).
|
|
19
|
+
Global definitions live in `~/.subharness/agents/`; by default, repository definitions live in `.subharness/agents/` at the execution worktree root. Every `.ts` file under those directories except `.d.ts` declarations is a definition entry; see [agent discovery](config.md). Without `--root`, the execution directory is the project root outside Git, and nested repositories use the nearest Git worktree root. CLI [logical project selection](project-root.md) with `--root` instead selects that directory's repository catalog, access, and extensions without merging enclosing scopes. Bare repositories are unsupported execution directories. Symlink directories are not traversed during discovery.
|
|
20
|
+
|
|
21
|
+
CLI `run` and `check` can also select an [explicit definition file](config.md#explicit-definition-files) outside those catalog directories. Relative file targets resolve against the invoking command's directory, independently of execution `--cwd` and project `--root`. Loading skips unrelated catalogs and retains the existing captured-session, access-selection, and managed-child authorization rules.
|
|
20
22
|
|
|
21
23
|
Definitions are trusted executable TypeScript. Loading a catalog evaluates its modules, so callers must trust the selected project and global definition files. Imports resolve relative to each definition through normal Node package resolution, with TypeScript loading supplied by the CLI. Missing imports, invalid exports, and duplicate names fail with the source filename. A session retains its loaded instructions, tools, and harness configuration for follow-ups; new sessions load current definition sources.
|
|
22
24
|
|
|
23
|
-
An omitted `--cwd` uses the command's working directory. `--prompt-file` paths resolve against the calling command's directory
|
|
25
|
+
An omitted `--cwd` uses the explicit `--root`, or the command's working directory otherwise. Explicit relative `--cwd`, `--root`, and `--prompt-file` paths resolve independently against the calling command's directory; prompt files use UTF-8. Prompts must contain non-whitespace text and cannot exceed 1 MiB. One quoted positional prompt, `--prompt`, and `--prompt-file` are mutually exclusive. `--prompt-file -` reads bounded UTF-8 stdin to EOF and rejects a terminal input stream. Direct harness targets accept `--model` for `run` and `check`. Codex, Claude Code, and fx also accept `--effort`; OpenCode, Copilot, and Cursor reject it. Specialist targets reject both overrides.
|
|
24
26
|
|
|
25
27
|
`run` and task-creating `send` commands accept `--detach` with every prompt source. The option ends the requesting command's observation immediately after successful admission, so the command returns exactly the existing `started` record and exits `0`. The service explicitly completes that observation response; it does not rely on a caller abandoning a response body. Admission errors keep their records and exit codes, while later failures remain available through `wait` and `status`. Interrupt delivery confirms affected execution has stopped before replacement admission even when detached. Steering rejects `--detach` with `INVALID_ARGUMENT`. The option is an observation request and is never retained as session configuration.
|
|
26
28
|
|
|
@@ -34,11 +36,13 @@ Readiness means only that the selected target's startup checks passed at that mo
|
|
|
34
36
|
|
|
35
37
|
The coordinator accepts local connections only. Its endpoint, instance identifier, and access token are stored with owner-only permissions under `~/.subharness/state/`. Task and session identifiers resolve through this coordinator from any working directory. Child invocation context is supplied privately by a session launcher that restores the coordinator location and parent context even when native shells change the inherited environment. Launchers use owner-only permissions, contain no provider credentials, and are removed when the session worker closes. Users do not supply parent identifiers or tokens in command flags. A context is accepted only while its parent task allows delegation.
|
|
36
38
|
|
|
37
|
-
Closing a response-reading command does not cancel work. The coordinator retains responses and session records for its lifetime. A coordinator restart does not replay tasks or reconstruct queues; unavailable identifiers return an explicit error.
|
|
39
|
+
Closing a response-reading command does not cancel work. The coordinator retains responses and session records for its lifetime. A coordinator restart does not replay tasks or reconstruct queues; unavailable identifiers return an explicit error. This version does not recover library sessions after coordinator or environment exit. Responses are not consumed by readers; each reader supplies its own position. Task/session metadata and complete-response records are not silently evicted while the coordinator is running. Live event delivery is separate and does not retain content for later subscribers.
|
|
40
|
+
|
|
41
|
+
Explicit project/access roots remain in coordinator-owned session context for follow-ups and declared children. Managed `list`, `run`, and `check` calls cannot supply `--root`; child execution cwd does not change inherited access or extension scope. Personal settings and relative credential/project references use the corresponding main-checkout app directory, or the selected root outside Git, with the validation and startup timing defined in [logical project roots](project-root.md). Actual execution workspace metadata and dashboard Git grouping remain cwd-based.
|
|
38
42
|
|
|
39
43
|
## Task states and responses
|
|
40
44
|
|
|
41
|
-
The coordinator supplies the terminal dashboard with a read-only snapshot of current session work followed by retained finished tasks, including failed active tasks that pause a queue. Each task appears at most once, and retained history is available to newly opened dashboards for the coordinator’s lifetime. The private snapshot includes
|
|
45
|
+
The coordinator supplies the terminal dashboard with a read-only snapshot of current session work followed by retained finished tasks, including failed active tasks that pause a queue. Each task appears at most once, and retained history is available to newly opened dashboards for the coordinator’s lifetime. The private snapshot includes `history: true` for finished history, `grouping: true` for grouped context, and `taskDetails: true` for the expanded task-detail fields. Missing `history` or `grouping` ends the dashboard with `COORDINATOR_OUTDATED` and exit `1`. Missing `taskDetails` keeps the dashboard running; opening a task screen shows `COORDINATOR_OUTDATED` with restart guidance instead of task details. It carries only session/task identity, selected harness, bounded prompt title, task state, canonical checkout/repository paths, and timestamps needed by the display; it excludes environment variables, credentials, definitions, transcripts, and native diagnostics. Reading it does not acknowledge responses or change task execution. Workers report the actual selected harness to the coordinator after native startup succeeds. Task timing records the first dispatch, latest failure, and terminal completion or confirmed-stop time without resetting on native continuations. Finished rows retain a fixed elapsed duration; recovery clears terminal timing for the resumed task. Snapshot observation adds no public SDK execution method or persistent history. The inspector uses a separate authenticated, read-only session-history projection for retained work requests, stable admission ordinals, queue state and direct child sessions. Full prompt/response content and summarized agent/model identity are fetched only for the open task screen through the task-detail projection. It omits already-cached prompt and response text on refresh and never acknowledges delegated outcomes or changes execution. The core task screen renders steps from a task-scoped live subscription; those events are absent from private dashboard projections. The private transport is defined in [Dashboard inspection](cli/dashboard-inspection.md); presentation is defined in [CLI](cli/index.md#live-dashboard).
|
|
42
46
|
|
|
43
47
|
Task states are `queued`, `running`, `waiting`, `awaiting_approval`, `completed`, `failed`, `cancelled`, and `interrupted`. `waiting` means the library task remains active between native turns while delegated work or child-result processing is pending. A native permission request is not a completed response. Terminal outcomes are `completed`, `failed`, `cancelled`, and `interrupted`.
|
|
44
48
|
|
|
@@ -50,7 +54,9 @@ Each session admits task-creating requests in the order the coordinator receives
|
|
|
50
54
|
|
|
51
55
|
Steering an actively generating native turn uses native steering when available; otherwise it follows the interrupt contract: cancel the active task and its descendants, then create a replacement task with the supplied message while preserving independently queued work. The output reports the effective delivery mode. Steering a `waiting` task starts a native continuation of that same task with the new input, leaving descendants running. With no active task, steering fails; callers can submit a queued task. Acceptance means the native integration accepted the input, not that the model has acted on it.
|
|
52
56
|
|
|
53
|
-
Cancellation closes admission of new descendants, removes queued descendants, and requests native interruption for running descendants. `cancel` returns after affected
|
|
57
|
+
Cancellation closes admission of new descendants, removes queued descendants, and requests native interruption for running descendants. `cancel` returns after affected native turns have stopped. Repeating cancellation of a terminal task is a harmless status read. Interruption uses the same boundary before the replacement starts; independently queued tasks keep their order. A failed cancellation leaves dispatch paused and returns an error rather than claiming execution stopped. Concurrent interrupts are serialized in admission order.
|
|
58
|
+
|
|
59
|
+
A native harness can retain a tracked tool process as session-owned background work across turns. Such a process can remain alive after cancellation or task completion even though the native turn has stopped. Closing the session through the CLI or SDK, or shutting down the coordinator, closes native resources and lets the harness terminate the tool processes it tracks. A process deliberately detached outside native harness tracking remains outside both Subharness and harness ownership and can survive session close.
|
|
54
60
|
|
|
55
61
|
On parent execution failure, affected descendants are cancelled before reporting the settled failure. A failed or cancelled child is delivered to its parent as an outcome the parent can interpret; it does not automatically fail the parent. Parent continuation uses the existing native session and original task. Child results received while the parent is busy are retained until they can be delivered without interrupting its turn. Results available together may be delivered in one continuation, once each.
|
|
56
62
|
|
|
@@ -66,7 +72,7 @@ Ordinary text/JSON tool results and complete responses are limited to 1 MiB. Ric
|
|
|
66
72
|
|
|
67
73
|
A managed task cannot delegate follow-up work into its own session or an ancestor's session. Such an admission returns `INVALID_PARENT` before changing any execution: that queued work would otherwise wait for the very task whose completion depends on it. Invalid delegation and replacement requests never cancel existing work.
|
|
68
74
|
|
|
69
|
-
The CLI and connected SDK select the same coordinator directory: an explicit SDK `stateDirectory`, otherwise `AGENT_STATE_DIR`, otherwise `~/.subharness/state/shared`. Connection authenticates the instance and requires protocol version 1 with the applicable `sdk-v1` or `cli-v1` capability.
|
|
75
|
+
The CLI and connected SDK select the same coordinator directory: an explicit SDK `stateDirectory`, otherwise `AGENT_STATE_DIR`, otherwise `~/.subharness/state/shared`. Connection authenticates the instance and requires protocol version 1 with the applicable `sdk-v1` or `cli-v1` capability. Explicit-root CLI runs and managed `list`, `check`, or `run` commands supplying `--root` additionally require `cli-root-v1` before submission; an older live coordinator yields `COORDINATOR_OUTDATED` without automatic restart, default-root fallback, or task replay.
|
|
70
76
|
|
|
71
77
|
Each candidate coordinator, rather than the CLI command that spawned it, holds an operating-system-backed startup lock from its final endpoint check through service startup and atomic endpoint publication. The lock is released automatically if the candidate exits. After acquiring it, a candidate retires without publishing when the retained endpoint gives a compatible authenticated health response for the recorded coordinator instance. It starts only when metadata is absent, or a well-formed stale record has a proven-dead owner and an unresponsive endpoint. Malformed, unauthorized, incompatible, or uncertain endpoints fail explicitly without replacement. This prevents a caller exit or a later candidate from exposing competing endpoint publication.
|
|
72
78
|
|
|
@@ -77,4 +83,12 @@ Lock contention is bounded by the spawning command's startup deadline. Waiting f
|
|
|
77
83
|
Coordinators leave endpoint records in place during shutdown. Legacy pathname lock artifacts do not grant startup ownership and are left untouched. An unavailable endpoint alone does not prove absence. A live or unknown owner, authentication failure, incompatible protocol, or instance mismatch forbids replacement startup. A permitted replacement atomically overwrites only a proven-stale record; tasks owned by the previous coordinator are not reconstructed. An interrupted coordinator response is reported as unavailable without exposing native diagnostics or automatically repeating the request. Disconnecting an observer detaches that observation; it does not cancel execution.
|
|
78
84
|
A successful detached task-creation request ends its service observation explicitly after the admission record while the coordinator continues to own the task.
|
|
79
85
|
|
|
80
|
-
Catalog discovery evaluates TypeScript in a short-lived process with the selected execution directory as its working directory. Module stdout and stderr are not mixed into CLI output.
|
|
86
|
+
Catalog discovery evaluates TypeScript in a short-lived process with the selected execution directory as its working directory. Module stdout and stderr are not mixed into CLI output. Sessions retain their loaded instructions, tools, and harness configuration in an isolated graph owner. Follow-ups and declared child sessions use that captured graph and its closures without re-importing changed files. New top-level sessions load the current definition source. Definition closures remain in their graph owner and are not serialized between processes.
|
|
87
|
+
|
|
88
|
+
## Live events and user extensions
|
|
89
|
+
|
|
90
|
+
The public [live event API](events.md) forwards normalized session events only to currently matching subscribers. With no subscriber, adapters skip event normalization and event IPC. Native startup options needed for partial output are enabled for every session so later subscribers receive supported deltas. Opening registers before its promise resolves, and only events accepted after that registration point are delivered. Adapters keep no extra observation content. Earlier content appears only when the native route later supplies it in a snapshot; for mid-item joins on chunk-only `fx-acp` and `cursor-acp`, turn-boundary snapshots cover only content normalized since registration and use state `"incomplete"`. Pending delivery is limited to 128 events or 1 MiB per subscriber; falling behind rejects observation with `EVENT_BACKPRESSURE` without delaying execution. Content limits and redaction apply before transfer.
|
|
91
|
+
|
|
92
|
+
Static extension manifests live in global and repository directories. Explicit per-user consent is stored in the owner-only `~/.subharness/extensions.json` file under the [extension consent schema](config.md#extension-consent-and-logs), with repository consent per canonical logical project root. Without `--root`, that remains the execution worktree root or execution directory outside Git. At every newly admitted coordinator session, including connected SDK creation, the coordinator selects all enabled global extensions and enabled repository extensions for the selected logical root, independently of execution cwd when `--root` is used. Instance identity is the qualified reference plus the canonical project root for repository extensions; global instances have no checkout component. Failure state, admission eligibility and re-enablement are scoped to that identity. Enabling one project root affects only that root's repository instance; app roots do not inherit consent from parent or sibling roots or other worktrees. Each applicable extension runs in a separately supervised child process from its first matching session until coordinator close, unless failure disables it. Execution workers, CLI dashboards and embedded runners do not load extension modules. Disabling removes eligibility for newly admitted sessions while existing assignments continue. A failed instance remains disabled and visible through `subharness extensions list` for the coordinator's lifetime, without automatic restart or failure of agents or other extensions. Explicitly enabling the selected instance identity again saves consent and notifies a running coordinator to permit a new process at the first newly admitted matching session; sessions assigned to the failed instance are not reassigned. If notification fails, consent stays saved and enable warns that the failure state clears on coordinator restart, exiting `0`. No notification is needed when no coordinator is running. Restarting the coordinator resets runtime failure state.
|
|
93
|
+
|
|
94
|
+
The CLI task screen itself opens the public task-scoped live subscription and renders incoming turns, assistant text, reasoning, tool and approval steps, and inline session-error notices. Approval and session-error rows count toward the display bound. Its original request, task error and latest complete response come from ordinary inspection. The open screen displays at most 500 steps, dropping the oldest with a visible omission notice; this bound belongs only to dashboard display state. Leaving closes the subscription and discards that state. Reopening does not retrieve past events. Earlier content appears only when the native route itself supplies it in a later snapshot; chunk-only mid-item views remain incomplete. The screen consumes events independently of rendering. After `EVENT_BACKPRESSURE`, it shows a missed-steps notice and follows the [dashboard retry bounds](cli/dashboard-design.md#refresh-and-compatibility): at most one reopen every 2 seconds, stopping after 3 consecutive failures within 60 seconds, counting failed reopens. It then shows “Live steps paused; reopen the task to retry.” SDK applications implement custom event handling through direct subscriptions. [User extensions](extensions.md) defines the plain-object module API, supervised lifetime, manifest, diagnostics and complete logger example.
|