jg-agent-hq 8.0.1 → 9.0.0
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/CHANGELOG.md +21 -0
- package/README.md +18 -37
- package/api/README.md +52 -244
- package/dist/actions/actions.d.ts +5 -50
- package/dist/actions/actions.js +49 -190
- package/dist/actions/live/live.d.ts +5 -1
- package/dist/actions/live/live.js +7 -3
- package/dist/actions/reads.d.ts +3 -2
- package/dist/actions/reads.js +12 -5
- package/dist/actions/waits/index.d.ts +1 -0
- package/dist/actions/waits/index.js +2 -0
- package/dist/actions/waits/waits.d.ts +37 -0
- package/dist/actions/waits/waits.js +107 -0
- package/dist/cli/cli.js +6 -56
- package/dist/contracts/actions/index.d.ts +2 -4
- package/dist/contracts/actions/index.js +1 -3
- package/dist/contracts/actions/types.d.ts +135 -142
- package/dist/contracts/actions/types.js +12 -22
- package/dist/contracts/browser/types.d.ts +12 -605
- package/dist/contracts/browser/types.js +2 -5
- package/dist/contracts/evidence/types.d.ts +4 -7
- package/dist/contracts/evidence/types.js +2 -8
- package/dist/contracts/index.d.ts +5 -16
- package/dist/contracts/index.js +4 -15
- package/dist/contracts/locks/index.d.ts +2 -0
- package/dist/contracts/locks/index.js +2 -0
- package/dist/contracts/locks/types.d.ts +50 -0
- package/dist/contracts/locks/types.js +36 -0
- package/dist/contracts/providers/types.d.ts +0 -38
- package/dist/contracts/providers/types.js +0 -1
- package/dist/contracts/results/types.js +1 -1
- package/dist/contracts/sessions/types.d.ts +2 -0
- package/dist/contracts/sessions/types.js +7 -1
- package/dist/contracts/skills/types.d.ts +1 -0
- package/dist/contracts/skills/types.js +5 -0
- package/dist/contracts/types.d.ts +4526 -12307
- package/dist/contracts/types.js +13 -12
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -2
- package/dist/providers/claude/adapter.js +1 -11
- package/dist/providers/claude/claude.d.ts +6 -3
- package/dist/providers/claude/claude.js +49 -9
- package/dist/providers/claude/control/control.d.ts +2 -20
- package/dist/providers/claude/control/control.js +88 -155
- package/dist/providers/claude/control/permissions.d.ts +0 -9
- package/dist/providers/claude/control/permissions.js +0 -22
- package/dist/providers/claude/control/skills.js +1 -0
- package/dist/providers/claude/control/stream.js +1 -34
- package/dist/providers/claude/control/types.d.ts +0 -3
- package/dist/providers/claude/history/history.model.d.ts +9 -0
- package/dist/providers/claude/history/history.model.js +77 -43
- package/dist/providers/claude/history/types.d.ts +284 -3045
- package/dist/providers/claude/history/types.js +1 -0
- package/dist/providers/claude/rpc.d.ts +0 -5
- package/dist/providers/claude/rpc.js +0 -3
- package/dist/providers/codex/adapter.js +2 -12
- package/dist/providers/codex/codex.d.ts +1 -2
- package/dist/providers/codex/codex.js +2 -100
- package/dist/providers/codex/types.d.ts +2 -4
- package/dist/providers/registry/registry.d.ts +0 -2
- package/dist/providers/registry/registry.js +0 -7
- package/dist/providers/types.d.ts +4 -6
- package/dist/providers/types.js +3 -2
- package/dist/runtime/runtime.js +10 -81
- package/dist/runtime/types.d.ts +1 -18
- package/dist/runtime/types.js +0 -1
- package/dist/sessions/sessions.js +0 -1
- package/dist/skills/skills.js +3 -0
- package/dist/snapshots/archive/archive.js +2 -23
- package/dist/snapshots/capture.d.ts +2 -5
- package/dist/snapshots/capture.js +4 -85
- package/dist/snapshots/constants.d.ts +0 -1
- package/dist/snapshots/constants.js +1 -6
- package/dist/snapshots/database.d.ts +2 -3
- package/dist/snapshots/database.js +9 -114
- package/dist/snapshots/fences.d.ts +3 -5
- package/dist/snapshots/fences.js +3 -15
- package/dist/snapshots/files.d.ts +3 -1
- package/dist/snapshots/files.js +15 -4
- package/dist/snapshots/snapshots.d.ts +6 -7
- package/dist/snapshots/snapshots.js +9 -16
- package/dist/snapshots/types.d.ts +5 -81
- package/dist/snapshots/types.js +7 -30
- package/dist/storage/constants.d.ts +1 -0
- package/dist/storage/constants.js +5 -1
- package/dist/storage/types.d.ts +1 -0
- package/dist/storage/types.js +1 -0
- package/dist/store/control/constants.d.ts +3 -2
- package/dist/store/control/constants.js +3 -1
- package/dist/store/control/control.model.d.ts +1 -11
- package/dist/store/control/control.model.js +10 -131
- package/dist/store/control/transformers.d.ts +6 -3
- package/dist/store/control/transformers.js +6 -5
- package/dist/store/control/types.d.ts +91 -170
- package/dist/store/control/types.js +5 -7
- package/dist/store/schema.js +1 -1
- package/dist/store/schema.sql +3 -360
- package/dist/store/sessions/sessions.model.d.ts +10 -6
- package/dist/store/sessions/sessions.model.js +19 -2
- package/dist/store/snapshot.d.ts +10 -0
- package/dist/store/snapshot.js +37 -0
- package/dist/store/store.js +1 -54
- package/dist/store/store.worker.js +5 -97
- package/dist/store/types.d.ts +241 -4802
- package/dist/store/types.js +1 -44
- package/docs/recovery.md +10 -6
- package/errors/README.md +29 -39
- package/package.json +3 -4
- package/dist/agent-tools/agent-tools.d.ts +0 -6
- package/dist/agent-tools/agent-tools.js +0 -181
- package/dist/agent-tools/constants.d.ts +0 -7
- package/dist/agent-tools/constants.js +0 -45
- package/dist/agent-tools/index.d.ts +0 -4
- package/dist/agent-tools/index.js +0 -4
- package/dist/agent-tools/mcp/index.d.ts +0 -1
- package/dist/agent-tools/mcp/index.js +0 -2
- package/dist/agent-tools/mcp/mcp.d.ts +0 -7
- package/dist/agent-tools/mcp/mcp.js +0 -50
- package/dist/agent-tools/types.d.ts +0 -64
- package/dist/agent-tools/types.js +0 -1
- package/dist/agent-tools/utilities.d.ts +0 -13
- package/dist/agent-tools/utilities.js +0 -37
- package/dist/collaboration/collaboration.d.ts +0 -7
- package/dist/collaboration/collaboration.js +0 -119
- package/dist/collaboration/constants.d.ts +0 -2
- package/dist/collaboration/constants.js +0 -3
- package/dist/collaboration/dispatch/dispatch.d.ts +0 -12
- package/dist/collaboration/dispatch/dispatch.js +0 -148
- package/dist/collaboration/dispatch/index.d.ts +0 -3
- package/dist/collaboration/dispatch/index.js +0 -4
- package/dist/collaboration/dispatch/types.d.ts +0 -632
- package/dist/collaboration/dispatch/types.js +0 -44
- package/dist/collaboration/grants/grants.d.ts +0 -45
- package/dist/collaboration/grants/grants.js +0 -131
- package/dist/collaboration/grants/index.d.ts +0 -1
- package/dist/collaboration/grants/index.js +0 -2
- package/dist/collaboration/identity/credentials.d.ts +0 -17
- package/dist/collaboration/identity/credentials.js +0 -182
- package/dist/collaboration/identity/index.d.ts +0 -4
- package/dist/collaboration/identity/index.js +0 -4
- package/dist/collaboration/identity/types.d.ts +0 -171
- package/dist/collaboration/identity/types.js +0 -87
- package/dist/collaboration/index.d.ts +0 -3
- package/dist/collaboration/index.js +0 -3
- package/dist/collaboration/types.d.ts +0 -25
- package/dist/collaboration/types.js +0 -1
- package/dist/contracts/agent-tools/index.d.ts +0 -2
- package/dist/contracts/agent-tools/index.js +0 -2
- package/dist/contracts/agent-tools/types.d.ts +0 -697
- package/dist/contracts/agent-tools/types.js +0 -125
- package/dist/contracts/collaboration/index.d.ts +0 -4
- package/dist/contracts/collaboration/index.js +0 -4
- package/dist/contracts/collaboration/reports/constants.d.ts +0 -1
- package/dist/contracts/collaboration/reports/constants.js +0 -2
- package/dist/contracts/collaboration/reports/index.d.ts +0 -3
- package/dist/contracts/collaboration/reports/index.js +0 -3
- package/dist/contracts/collaboration/reports/types.d.ts +0 -69
- package/dist/contracts/collaboration/reports/types.js +0 -53
- package/dist/contracts/collaboration/types.d.ts +0 -6734
- package/dist/contracts/collaboration/types.js +0 -696
- package/dist/contracts/plans/index.d.ts +0 -6
- package/dist/contracts/plans/index.js +0 -6
- package/dist/contracts/plans/types.d.ts +0 -1788
- package/dist/contracts/plans/types.js +0 -278
- package/dist/plans/admission.d.ts +0 -288
- package/dist/plans/admission.js +0 -393
- package/dist/plans/authority.d.ts +0 -21
- package/dist/plans/authority.js +0 -207
- package/dist/plans/documents.d.ts +0 -80
- package/dist/plans/documents.js +0 -238
- package/dist/plans/evidence.d.ts +0 -11
- package/dist/plans/evidence.js +0 -211
- package/dist/plans/files.d.ts +0 -55
- package/dist/plans/files.js +0 -264
- package/dist/plans/finalization.d.ts +0 -11
- package/dist/plans/finalization.js +0 -30
- package/dist/plans/index.d.ts +0 -5
- package/dist/plans/index.js +0 -6
- package/dist/plans/plans.d.ts +0 -325
- package/dist/plans/plans.js +0 -803
- package/dist/plans/projections.d.ts +0 -13
- package/dist/plans/projections.js +0 -67
- package/dist/plans/revisions.d.ts +0 -50
- package/dist/plans/revisions.js +0 -181
- package/dist/plans/types.d.ts +0 -114
- package/dist/plans/types.js +0 -43
- package/dist/plans/utilities.d.ts +0 -36
- package/dist/plans/utilities.js +0 -62
- package/dist/snapshots/artifacts.d.ts +0 -16
- package/dist/snapshots/artifacts.js +0 -75
- package/dist/store/collaboration/authority.d.ts +0 -228
- package/dist/store/collaboration/authority.js +0 -128
- package/dist/store/collaboration/collaboration.model.d.ts +0 -412
- package/dist/store/collaboration/collaboration.model.js +0 -254
- package/dist/store/collaboration/constants.d.ts +0 -13
- package/dist/store/collaboration/constants.js +0 -14
- package/dist/store/collaboration/dispatch.d.ts +0 -19
- package/dist/store/collaboration/dispatch.js +0 -197
- package/dist/store/collaboration/identity.d.ts +0 -21
- package/dist/store/collaboration/identity.js +0 -146
- package/dist/store/collaboration/index.d.ts +0 -3
- package/dist/store/collaboration/index.js +0 -5
- package/dist/store/collaboration/invocation.d.ts +0 -21
- package/dist/store/collaboration/invocation.js +0 -162
- package/dist/store/collaboration/messages.d.ts +0 -54
- package/dist/store/collaboration/messages.js +0 -157
- package/dist/store/collaboration/outcomes.d.ts +0 -11
- package/dist/store/collaboration/outcomes.js +0 -216
- package/dist/store/collaboration/queries.d.ts +0 -23
- package/dist/store/collaboration/queries.js +0 -259
- package/dist/store/collaboration/reports.d.ts +0 -37
- package/dist/store/collaboration/reports.js +0 -117
- package/dist/store/collaboration/requests.d.ts +0 -22
- package/dist/store/collaboration/requests.js +0 -111
- package/dist/store/collaboration/search.d.ts +0 -13
- package/dist/store/collaboration/search.js +0 -58
- package/dist/store/collaboration/spawn.d.ts +0 -33
- package/dist/store/collaboration/spawn.js +0 -96
- package/dist/store/collaboration/streams.d.ts +0 -13
- package/dist/store/collaboration/streams.js +0 -100
- package/dist/store/collaboration/tasks.d.ts +0 -20
- package/dist/store/collaboration/tasks.js +0 -169
- package/dist/store/collaboration/transformers.d.ts +0 -56
- package/dist/store/collaboration/transformers.js +0 -179
- package/dist/store/collaboration/types.d.ts +0 -25
- package/dist/store/collaboration/types.js +0 -8
- package/dist/store/collaboration/utilities.d.ts +0 -23
- package/dist/store/collaboration/utilities.js +0 -77
- package/dist/store/collaboration/waits.d.ts +0 -26
- package/dist/store/collaboration/waits.js +0 -114
- package/dist/store/plans/index.d.ts +0 -1
- package/dist/store/plans/index.js +0 -2
- package/dist/store/plans/plans.model.d.ts +0 -47
- package/dist/store/plans/plans.model.js +0 -179
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 9.0.0
|
|
4
|
+
|
|
5
|
+
- Breaking: remove plans, collaboration, agent tools and the agent bridge. HQ no longer registers, locks or snapshots plans, runs collaboration tasks, streams or requests, starts agents from other agents, or gives the sessions it starts tools of its own. The `plan`, `thread-plan`, `collaboration` and `agent-tool` requests, the browser `plan` command and `BrowserThreadDetailSchema.plan`, the plan, collaboration and agent-tool contracts with `PlanActionScopeSchema` and `ActionPlanContextSchema`, `computePlanRevision`, `IPlanContract`, `IProviderAgentTools`, `IAgentToolDefinition`, `IAgentMcpLease`, a provider's `agentTools` and its `agentTools` capability, and the `agent-input` provenance source are gone.
|
|
6
|
+
- Breaking: the CLI drops `agent-bridge`, `plan-status`, `plan-milestones`, `--coordination-root` and `--directory`, and `createAgentHq` drops `coordinationRoot`. Snapshots take the HQ lock in the state root and hold no plan files: their header loses `sourceCoordinationRoot`, an inspection loses `planCount`, `diagnosticPlanCount`, `changedPlanCount` and `pendingWriteCount`, and a restore result loses `recoveryRoot`.
|
|
7
|
+
- Breaking: remove `JG_AGENT_HQ_COLLABORATION_FORBIDDEN`, `JG_AGENT_HQ_COLLABORATION_CONFLICT`, `JG_AGENT_HQ_PLAN_INVALID` and `JG_AGENT_HQ_PLAN_FAILED`, and the `jg-plans` and `@modelcontextprotocol/server` dependencies.
|
|
8
|
+
- Start Claude sessions without `--mcp-config` or a bridge process, and register no dynamic tools with Codex, whose `dynamicToolCall` history items still show. Actions admit and claim queued work directly, without a plan lock.
|
|
9
|
+
- Add `action-wait`, which returns a receipt once it has its native thread ID or settles, woken by HQ's own changes rather than polling, or as it stands with `isTimedOut` when its timeout of at most 30 seconds passes. Receipts gain `nativeThreadId`, which action collections leave out.
|
|
10
|
+
- `session-states` pages gain `latestSequence`, the highest transition sequence ever issued, and `isReset`, which is true when the cursor is past it or its own transition was pruned.
|
|
11
|
+
- Breaking: a provider's skill inventory must carry `invocationPrefix`, and skill pages return it: `/` for Claude and `$` for Codex.
|
|
12
|
+
- Add the `locks` read and `jg-agent-hq locks`, which list at most 256 of the machine's jg-locks locks with their holders. HQ only reads them and never takes, waits for or recovers one. jg-agent-hq now depends on `jg-locks`.
|
|
13
|
+
- Open no `claude` process for Claude history reads after the runtime's first successful check of the CLI. Keep a Claude usage result for 60 seconds, so frequent usage reads ask Claude at most once a minute; an auth notification, a rate-limit event or a closed connection ends it early.
|
|
14
|
+
- Write nothing to SQLite when reading unchanged Claude transcripts. A transcript whose identity, size and modification time match an index that reached its end is skipped without a transaction, a directory scan tracks the transcripts it saw in memory, and indexing prepares its per-record statements once. Native discovery pages are no longer copied into SQLite.
|
|
15
|
+
- Leave the Claude history index out of snapshots. The store worker deletes its rows from a full copy and writes the snapshot database from it with `VACUUM INTO`, which keeps every table's rowids. A restored runtime rebuilds the index from the transcripts on its first Claude history read, as a fresh one does.
|
|
16
|
+
- Add `journalSizeLimitBytes`, 16 MiB, to `connectionSettings`. HQ's connection applies it as `journal_size_limit`, so the WAL file shrinks back after a checkpoint; apply it to host connections that write.
|
|
17
|
+
- Breaking: change the storage schema in place. A database or snapshot written by 8.x is refused with `JG_AGENT_HQ_STORAGE_INVALID` naming the version that wrote it; start from a fresh state root.
|
|
18
|
+
|
|
19
|
+
## 8.0.2
|
|
20
|
+
|
|
21
|
+
- Clear a finished command, tool call or file change from the live window once history holds it with the same outcome. Codex shortens long command output when it saves it, so the saved text never matched the live text and the item stayed `awaiting-flush` until the window evicted it. An item without an outcome, such as a message, still needs exactly matching content.
|
|
22
|
+
- Keep 7.0.0's storage schema, so databases and snapshots written by 5.x through 8.0.1 open as they are.
|
|
23
|
+
|
|
3
24
|
## 8.0.1
|
|
4
25
|
|
|
5
26
|
- Link a Claude message that invokes a skill or slash command to the action that sent it. Claude records the `/name args` it received as command markup, so its hash never matched the action's and a Claude reviewer's review request stayed `unknown`. `nativeInputSha256` now hashes the `/name args` the markup holds.
|
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# jg-agent-hq
|
|
2
2
|
|
|
3
|
-
A TypeScript library and local controller for applications that run coding agents. Create native Claude Code and Codex sessions, send work, handle permissions and follow results through one API.
|
|
3
|
+
A TypeScript library and local controller for applications that run coding agents. Create native Claude Code and Codex sessions, send work, handle permissions and follow results through one API.
|
|
4
4
|
|
|
5
|
-
Use it to build an agent dashboard, editor integration or automated development workflow. HQ owns local session control
|
|
5
|
+
Use it to build an agent dashboard, editor integration or automated development workflow. HQ owns local session control. Your application owns its interface, authentication and off-machine backups. Native CLIs supply the coding harnesses, tools, skills and sign-in; additional providers can implement the same host contract.
|
|
6
6
|
|
|
7
7
|
Requires Node.js 24.15.0 or later on Linux or macOS. The lock protocol uses POSIX ownership, private directories and process-liveness probes. Windows is outside the supported host contract.
|
|
8
8
|
|
|
@@ -31,6 +31,8 @@ Callers supply a trusted state root. Locks live in its private `.runtime/hq.lock
|
|
|
31
31
|
|
|
32
32
|
Short metadata operations use `withHqLock`. Long-lived runtime ownership must use a separate owner record; never hold a metadata lock for an agent turn's lifetime. The lock coordinates cooperating processes and does not isolate hostile code running as the same OS user.
|
|
33
33
|
|
|
34
|
+
Machine-wide locks are separate. The `locks` read and `jg-agent-hq locks` list the named locks that scripts, agents and apps on the machine take through [jg-locks](https://jg-packages.jesusgraterol.dev/packages/jg-locks/), each with its holder, so an application on HQ can show them. HQ only reads them; it never takes, waits for or recovers one. See [machine locks](api/README.md#machine-locks).
|
|
35
|
+
|
|
34
36
|
See the [API reference](api/README.md) and [error contracts](errors/README.md).
|
|
35
37
|
|
|
36
38
|
Intentional failures use `Exception` from `jg-exception`, with the named string codes in the error reference. Local clients use `PUBLIC_ERROR_CODES` and `PUBLIC_ERROR_MESSAGES` from `jg-agent-hq/contracts` for errors translated at the IPC boundary. Safe classifications remain separate from private diagnostic causes.
|
|
@@ -47,23 +49,23 @@ Use `sessions` for discovery and `session-evidence` for newest-first historical
|
|
|
47
49
|
|
|
48
50
|
Trusted Node hosts can open the database described by `hq.storage` and keep application tables under their own prefix. HQ reserves `hq_`, validates its current schema stamp on startup, and leaves application schema ownership and `user_version` with the host. Use `hq.withStorageMaintenance(callback)` for host schema changes; it drains admitted work and rejects active native execution before the callback. The stamp records the package version that wrote the database, and startup refuses any other schema with an error naming that version; HQ never migrates storage. See the [shared storage contract](api/README.md#shared-storage).
|
|
49
51
|
|
|
50
|
-
`createHqSnapshot(hq, destination)` captures local state through SQLite's backup API while agents keep working, including host tables
|
|
52
|
+
`createHqSnapshot(hq, destination)` captures local state through SQLite's backup API while agents keep working, including host tables and action.key, under the HQ lock in the state root; the host keeps its own connections from writing host tables until it resolves. It leaves out the index of Claude transcripts, which a restored runtime rebuilds from the transcripts on its first Claude history read, as a fresh one does. `inspectHqSnapshot(directory)` verifies the complete snapshot; `restoreHqSnapshot({ snapshotDirectory, destination })` validates and stages it into a new private recovery workspace. `packHqSnapshot(snapshotDirectory, archivePath, key)` encrypts a snapshot into one AES-256-GCM file for off-machine copies, and `unpackHqSnapshot(archivePath, destination, key)` verifies and writes it back as a snapshot directory. Snapshots from another schema are refused by the package version that wrote them. Restored native ownership needs reconciliation and allowed roots must be selected explicitly. Hosts own the key and remote backups; a failed disk can lose changes since the last successful off-machine backup. See [snapshot and restore](api/README.md#snapshot-and-restore) and [recovery](docs/recovery.md).
|
|
51
53
|
|
|
52
54
|
Sessions started in a terminal show up too. Codex sessions on the shared daemon and Claude sessions from `claude agents --json` report a live state (`running`, `waiting`, `idle`, `closed`, `failed` or `unknown`) with external ownership. HQ builds on what each CLI offers and never stops, wakes or drives a session a terminal runs: it adopts a Codex session the terminal holds between turns, through the shared daemon, and a Claude session only once no terminal runs it, while a Claude session's `terminal` field names the terminal that does. Every state change of a managed or observed session is recorded in order; read them with `{ kind: 'session-states', afterSequence }` or `session-states`. `active-sessions` lists every running and waiting session with its workspace, `unstarted-threads` lists the sessions HQ created before their first turn, and `observation-pace` polls Claude every 5 seconds instead of 30 while a client follows sessions live. See [session states](api/README.md#session-states).
|
|
53
55
|
|
|
54
56
|
Provider IDs are bounded lowercase identifiers. Codex and Claude are built in; trusted Node hosts can register additional `IAgentProviderFactory` implementations through `providerFactories`. Capabilities report current operation support, provider/session scope and unavailable reasons. Native version labels are diagnostic metadata and never determine admission. Unknown essential control data fails explicitly. `jg-agent-hq/contracts` contains browser-safe schemas and types; importing it does not import the host runtime.
|
|
55
57
|
|
|
56
|
-
Use `--provider claude` for Claude history and usage; the default is `codex`. Claude connects lazily through its native structured CLI, with normal settings enabled and no user prompt. Usage requests explicitly disable the optional transcript-behavior scan. Its local history reader validates required identity, workspace and chain fields, tolerates additive fields and mixed version labels,
|
|
58
|
+
Use `--provider claude` for Claude history and usage; the default is `codex`. Claude connects lazily through its native structured CLI, with normal settings enabled and no user prompt. History reads start that process only for the runtime's first check of the CLI, and a usage result answers reads for 60 seconds. Usage requests explicitly disable the optional transcript-behavior scan. Its local history reader validates required identity, workspace and chain fields, tolerates additive fields and mixed version labels, keeps byte locations rather than conversation bodies in SQLite, and writes nothing for a transcript that hasn't changed. History, live items and evidence present items as the CLI shows them, with `notice` items, tool calls paired with their results, and each file change's files; unknown ordered content is presented as unsupported, and untrustworthy identity or ordering makes the affected read unavailable. File history cannot establish current execution state. See the [reader limits and freshness contract](api/README.md#claude-history).
|
|
57
59
|
|
|
58
|
-
Explicit actions create, name, adopt, resume and close threads; send idle messages; steer an exact running turn; queue the next message; interrupt; and answer native questions, permissions or MCP elicitation. Actions have stable UUIDs and durable receipts. Repeating the same request returns its receipt; changing that UUID's payload conflicts. A lost acknowledgement stays uncertain until the exact native response arrives or the operator makes an explicit recovery choice. HQ never resends uncertain input.
|
|
60
|
+
Explicit actions create, name, adopt, resume and close threads; send idle messages; steer an exact running turn; queue the next message; interrupt; and answer native questions, permissions or MCP elicitation. Actions have stable UUIDs and durable receipts. `action-wait` returns a receipt once it has its native thread ID or settles, woken by HQ's own changes rather than polling, or as it stands when its timeout of at most 30 seconds passes. Repeating the same request returns its receipt; changing that UUID's payload conflicts. A lost acknowledgement stays uncertain until the exact native response arrives or the operator makes an explicit recovery choice. HQ never resends uncertain input.
|
|
59
61
|
|
|
60
|
-
Actions also fork native history into a distinct session, compact idle sessions, and use native archive/unarchive and history revert where supported. Forks retain exact native lineage
|
|
62
|
+
Actions also fork native history into a distinct session, compact idle sessions, and use native archive/unarchive and history revert where supported. Forks retain exact native lineage. Unarchive leaves a session inactive until explicitly resumed. Revert changes conversation history; it does not undo files. Claude exposes compaction and fork, with archive and conversation revert reported as unsupported.
|
|
61
63
|
|
|
62
64
|
Use `account --provider <id>` for safe native account metadata, and `mcp-servers --thread-id <id>` for configured server status. `mcp-tools` and `mcp-resources` select `--server-name <name>` and support bounded continuation. Native reload and authentication controls use the existing JSON `request` interface and durable action receipts. Login URLs are live presentation and are never saved in SQLite. See [native accounts and extensions](api/README.md#native-accounts-and-extensions).
|
|
63
65
|
|
|
64
66
|
Use `models --provider <id>` for native model and effort choices, and `configuration --provider <id> --workspace-root <path> [--thread-id <id>]` for known effective settings and paged native agent/profile metadata. Creation and explicit resume accept typed startup settings; messages can select a model and effort for the next turn. Startup instructions, native Claude agents and permission settings require an idle session restart. Capability schemas describe supported selections and change modes. Unknown settings remain explicit, and native configuration files stay with each CLI. See the [configuration contract](api/README.md#native-configuration).
|
|
65
67
|
|
|
66
|
-
Native execution settings, instructions, skills and tool permissions remain with each CLI. Claude uses an owned structured process per controlled session, closes it after 60 idle minutes and reopens it for the next input, and reports immediate steering as unavailable.
|
|
68
|
+
Native execution settings, instructions, skills and tool permissions remain with each CLI. Claude uses an owned structured process per controlled session, closes it after 60 idle minutes and reopens it for the next input, and reports immediate steering as unavailable. Close other CLI controllers before confirming adoption, resume or recovery. HQ coordinates sessions sharing one state directory; it cannot lock independently running native CLIs. Integrating browser hosts can use durable host-action admission and operator-scoped reconciliation through the programmatic API; see the [browser host contract](api/README.md#browser-host-integration). The standalone CLI advertises only commands it implements.
|
|
67
69
|
|
|
68
70
|
Approval reads return indexed, cursor-paginated pending, answered and expired metadata after reconnect or restart. Sensitive presentation is available only while the exact native request is live. Native permissions require explicit responses; unknown request kinds or scopes are denied. See [native replies and reconnect reads](api/README.md#thread-control-and-live-input).
|
|
69
71
|
|
|
@@ -77,40 +79,22 @@ Use `skills --thread-id <id> --state-root <directory>` to browse the controlled
|
|
|
77
79
|
|
|
78
80
|
Use `jg-agent-hq request --state-root <directory>` with a closed HQ command on stdin for action and control reads. The [API reference](api/README.md) describes action envelopes, receipts and reconnect reads.
|
|
79
81
|
|
|
80
|
-
Trusted hosts can create collaboration tasks, add managed agents from any provider, and coordinate them through durable streams. Streams contain small indexed messages and optional directed or claimable requests. Subscription, reading, acknowledgement, assignment and completion are separate records. Metadata operations retain replay receipts and recover notification fan-out after restart. Directed requests can run through the existing native action ledger when the host enables automatic dispatch or explicitly selects a request. An assigned agent can publish direct child requests and yield with a bounded wait set. Exact child outcomes or requester clarifications continue the parent under its current authority; child completion never completes or approves the parent. Information, reads and acknowledgements do not start turns. HQ stores exact bounded outcome reports independently of native histories. Hosts issue exact task-scoped skill grants; role labels and message text grant no authority. See [task collaboration](api/README.md#task-collaboration).
|
|
81
|
-
|
|
82
|
-
Controlled agents use `hq_identity` to recover their stable managed ID, task memberships, permissions and pending inbox counts. Codex uses experimental native dynamic tools; Claude uses a private session-specific stdio MCP bridge. Both use the same closed operations for streams, verified invocation context, requests, report chunks, session evidence and authorized managed spawning. Children can use either provider and inherit equal or narrower task permissions. The host sets a finite cumulative spawn budget. Native subagents share their owning HQ session identity. A Claude session runs these tools without asking for permission, and every other tool keeps native permission handling. See [agent tools](api/README.md#agent-tools).
|
|
83
|
-
|
|
84
|
-
## Plan coordination
|
|
85
|
-
|
|
86
|
-
`plan-status --directory <path>` and `plan-milestones --directory <path>` inspect a selected ordinary planning directory. No project registry is required. Mutations use the existing `request` JSON command with `kind: 'plan'`; see the [plan command reference](api/README.md#plan-coordination).
|
|
87
|
-
|
|
88
|
-
HQ uses jg-plans to observe and prepare ordinary Markdown plans. The plan contract keeps every frontmatter field except the four administrative ones, and all shared requirement sections. Status reports skills bindings as absent, current or stale. A stale binding keeps the plan readable and approvable during revision, but closes finalization and execution until jg-breakdown refreshes coverage; bindings never grant HQ approval. jg-breakdown assigns milestone UUIDs; finalization requires one on every milestone, records the revision and returns the unchanged sequence when a breakdown exists. `register` records a plan directory for snapshots without locks or reads. A plan without a breakdown remains one unit: finalization returns null content, plan approval suffices, and whole-plan execution uses an empty milestone selection with a null milestone ID. No milestone file is created merely to make a small plan executable. Plan approval, sequence approval and scoped execution authorization are separate explicit operator actions. None sends native input or answers tool permissions. `coordination.json` holds current records beside the plan. SQLite retains write replay identities and a replaceable, paged milestone projection. Keep both when recovering interrupted writes. Document locks release before the write journal is completed. Checked replacements are private (0600), and progress preserves revision while recording one prepared updated_at. A pending write blocks further mutation until its original action is reconciled.
|
|
89
|
-
|
|
90
|
-
Begin a revision before native planning. HQ stops bound implementation threads and their owned background work, captures partial-work evidence, and keeps execution paused while the CLI revises the plan and regenerates milestones. jg-breakdown keeps the ID and status of work whose requirements still hold, and finalization carries completion evidence by milestone ID, so rewording preserves it. A milestone the new sequence no longer marks done needs a new completion. Present and approve the canonical sequence, then explicitly authorize the new execution scope and mode. Neither approval nor restart resumes implementation. Whole-plan checkpoints and completion evidence also work without a milestone file. Evidence for a milestone ID that left the sequence stays visible in status as unmatched. See the [revision recovery contract](api/README.md#revision-and-progress-recovery).
|
|
91
|
-
|
|
92
|
-
## Agent review and feedback
|
|
93
|
-
|
|
94
|
-
Choose any managed reviewer and author, including the same provider, and send task-scoped stream requests. Optional native skills use exact host-issued grants: jg-review-session can read the selected evidence, and jg-feedback can assess an exact report reference. HQ selects the installed native skill and verifies the invocation before dispatch. Missing or unavailable skills remain blocked; no copied workflow is substituted.
|
|
95
|
-
|
|
96
|
-
Reports return through HQ storage and delivery without manual copying or another reviewer turn. Feedback is untrusted advice and grants no plan approval, execution authority or acceptance of recommendations. Parent work can yield for child results and continue through its existing authority. Busy agents queue; uncertainty never causes automatic resending. See [native skill delegation](api/README.md#native-skill-delegation) and [task collaboration](api/README.md#task-collaboration).
|
|
97
|
-
|
|
98
82
|
## Source examples
|
|
99
83
|
|
|
100
|
-
Follow the [
|
|
84
|
+
Follow the [complete session walkthrough](https://jg-agent-hq.jesusgraterol.dev/examples/), with copyable source and its result.
|
|
101
85
|
|
|
102
|
-
`examples/control-session.ts` creates a native session and reads its actual delivery, output, permission and usage observations.
|
|
86
|
+
`examples/control-session.ts` creates a native session and reads its actual delivery, output, permission and usage observations.
|
|
103
87
|
|
|
104
|
-
These complete TypeScript examples use the public client and contracts. Start the local controller
|
|
88
|
+
These complete TypeScript examples use the public client and contracts. Start the local controller and sign in to the native CLIs first. The host supplies actual user decisions and keeps native permission handling separate. Retain request identities before submission; after an interrupted client call, inspect those receipts instead of rerunning a whole example. Examples are development sources, not package exports or automatic website actions.
|
|
105
89
|
|
|
106
|
-
`examples/shared-storage.ts` uses a trusted Node runtime to save a singleton application preference under the app\_ prefix, capture and inspect shared SQLite storage, and verify the value after offline restore. It closes its own SQL connections and preserves the host's user_version. Select absent output directories and pause every other writer first. The application write commits before capture; a later backup failure does not roll it back. The recovered state still requires explicit allowed roots
|
|
90
|
+
`examples/shared-storage.ts` uses a trusted Node runtime to save a singleton application preference under the app\_ prefix, capture and inspect shared SQLite storage, and verify the value after offline restore. It closes its own SQL connections and preserves the host's user_version. Select absent output directories and pause every other writer first. The application write commits before capture; a later backup failure does not roll it back. The recovered state still requires explicit allowed roots before execution.
|
|
107
91
|
|
|
108
92
|
The [qualification matrix](api/README.md#qualification) records native journeys, host coverage and remaining interface limits.
|
|
109
93
|
|
|
110
94
|
## Project blueprint
|
|
111
95
|
|
|
112
96
|
- `src/index.ts`: the explicit public package boundary.
|
|
113
|
-
- `examples/`: public source helpers for sessions
|
|
97
|
+
- `examples/`: public source helpers for sessions and shared host storage.
|
|
114
98
|
- `src/locks/`: lock ownership, acquisition, status and deliberate recovery.
|
|
115
99
|
- `src/runtime/`: trusted configuration and lifetime ownership.
|
|
116
100
|
- `src/ipc/` and `src/cli/`: private local commands and the installed executable.
|
|
@@ -120,16 +104,13 @@ The [qualification matrix](api/README.md#qualification) records native journeys,
|
|
|
120
104
|
- `src/providers/inputs/` and `src/providers/results/`: checked file delivery and complete native result validation.
|
|
121
105
|
- `src/providers/configuration/` and `src/providers/lineage/`: bounded native choices and confirmed immutable session relationships.
|
|
122
106
|
- `src/sessions/`: authorized discovery with live session states, the active-session list, bounded evidence and provenance, cursor-bound history reads and short label suggestions.
|
|
123
|
-
- `src/plans/`: execution digests, milestone finalization, revision checkpoints, retained verification and explicit plan authority.
|
|
124
107
|
- `src/skills/`: bounded native catalogs, invocation previews and explicit input preparation.
|
|
125
108
|
- `src/accounts/` and `src/extensions/`: safe account observations and authorized, bounded native MCP inventories.
|
|
126
|
-
- `src/
|
|
127
|
-
- `src/
|
|
128
|
-
- `src/actions/`: durable action dispatch, native input routing and bounded live presentation.
|
|
129
|
-
- `src/store/`: SQLite discovery metadata, observed sessions and state transitions, collaboration streams and the action/control ledger in one worker.
|
|
109
|
+
- `src/actions/`: durable action dispatch, native input routing, bounded live presentation and receipt waits its own changes wake.
|
|
110
|
+
- `src/store/`: SQLite discovery metadata, observed sessions and state transitions, the action/control ledger and the snapshot's database copy in one worker.
|
|
130
111
|
- `src/storage/`: trusted host metadata, exclusive maintenance and the current schema stamp.
|
|
131
|
-
- `src/snapshots/`: capture while agents work,
|
|
132
|
-
- `src/contracts/`: browser-safe command and response contracts.
|
|
112
|
+
- `src/snapshots/`: capture while agents work, manifest validation and offline recovery that releases native ownership.
|
|
113
|
+
- `src/contracts/`: browser-safe command and response contracts, including the jg-locks lock list.
|
|
133
114
|
- `scripts/package/`: build-output cleanup and packed-consumer checks.
|
|
134
115
|
- `scripts/release/`: registry version/integrity checks and trusted publication of the tested archive.
|
|
135
116
|
- `scripts/test-support/`: disposable external CLI fixtures.
|