jg-agent-hq 2.0.0 → 4.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 +18 -0
- package/README.md +14 -14
- package/api/README.md +97 -65
- package/dist/actions/actions.js +15 -0
- package/dist/cli/cli.js +28 -5
- package/dist/cli/utilities.d.ts +3 -0
- package/dist/cli/utilities.js +13 -0
- package/dist/collaboration/dispatch/types.d.ts +2 -2
- package/dist/contracts/actions/types.d.ts +4 -4
- package/dist/contracts/browser/index.d.ts +1 -3
- package/dist/contracts/browser/index.js +1 -3
- package/dist/contracts/browser/types.d.ts +15 -1447
- package/dist/contracts/browser/types.js +3 -112
- package/dist/contracts/index.d.ts +9 -11
- package/dist/contracts/index.js +6 -8
- package/dist/contracts/plans/index.d.ts +4 -6
- package/dist/contracts/plans/index.js +2 -4
- package/dist/contracts/plans/types.d.ts +38 -905
- package/dist/contracts/plans/types.js +13 -139
- package/dist/contracts/sessions/index.d.ts +2 -0
- package/dist/contracts/sessions/index.js +2 -0
- package/dist/contracts/sessions/types.d.ts +101 -0
- package/dist/contracts/sessions/types.js +43 -0
- package/dist/contracts/types.d.ts +551 -1035
- package/dist/contracts/types.js +32 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/plans/admission.d.ts +6 -6
- package/dist/plans/admission.js +1 -1
- package/dist/plans/authority.d.ts +2 -0
- package/dist/plans/authority.js +23 -13
- package/dist/plans/documents.d.ts +20 -17
- package/dist/plans/documents.js +29 -63
- package/dist/plans/files.d.ts +2 -2
- package/dist/plans/files.js +5 -5
- package/dist/plans/finalization.d.ts +6 -8
- package/dist/plans/finalization.js +25 -26
- package/dist/plans/index.d.ts +2 -3
- package/dist/plans/index.js +1 -2
- package/dist/plans/plans.d.ts +8 -8
- package/dist/plans/plans.js +36 -83
- package/dist/plans/projections.d.ts +2 -2
- package/dist/plans/projections.js +44 -82
- package/dist/plans/revisions.d.ts +4 -5
- package/dist/plans/revisions.js +5 -44
- package/dist/plans/types.d.ts +5 -281
- package/dist/plans/types.js +2 -30
- package/dist/plans/utilities.js +2 -11
- package/dist/providers/claude/agents/agents.d.ts +16 -0
- package/dist/providers/claude/agents/agents.js +80 -0
- package/dist/providers/claude/agents/constants.d.ts +3 -0
- package/dist/providers/claude/agents/constants.js +4 -0
- package/dist/providers/claude/agents/index.d.ts +1 -0
- package/dist/providers/claude/agents/index.js +2 -0
- package/dist/providers/claude/agents/types.d.ts +14 -0
- package/dist/providers/claude/agents/types.js +9 -0
- package/dist/providers/claude/claude.js +2 -0
- package/dist/providers/claude/history/history.model.js +2 -0
- package/dist/providers/claude/history/types.d.ts +115 -368
- package/dist/providers/claude/index.d.ts +1 -0
- package/dist/providers/claude/index.js +2 -0
- package/dist/providers/claude/transformers.js +14 -1
- package/dist/providers/codex/adapter.d.ts +1 -1
- package/dist/providers/codex/adapter.js +26 -3
- package/dist/providers/codex/codex.js +51 -18
- package/dist/providers/codex/events.d.ts +2 -1
- package/dist/providers/codex/events.js +8 -3
- package/dist/providers/codex/index.d.ts +1 -1
- package/dist/providers/codex/index.js +1 -1
- package/dist/providers/codex/rpc.d.ts +9 -4
- package/dist/providers/codex/rpc.js +109 -47
- package/dist/providers/codex/skill-roots/constants.d.ts +4 -0
- package/dist/providers/codex/skill-roots/constants.js +7 -0
- package/dist/providers/codex/skill-roots/index.d.ts +2 -0
- package/dist/providers/codex/skill-roots/index.js +4 -0
- package/dist/providers/codex/skill-roots/skill-roots.d.ts +35 -0
- package/dist/providers/codex/skill-roots/skill-roots.js +93 -0
- package/dist/providers/codex/transformers.d.ts +3 -1
- package/dist/providers/codex/transformers.js +41 -3
- package/dist/providers/codex/types.d.ts +38 -1
- package/dist/providers/codex/types.js +15 -3
- package/dist/providers/codex/websocket/constants.d.ts +11 -0
- package/dist/providers/codex/websocket/constants.js +18 -0
- package/dist/providers/codex/websocket/index.d.ts +1 -0
- package/dist/providers/codex/websocket/index.js +2 -0
- package/dist/providers/codex/websocket/websocket.d.ts +7 -0
- package/dist/providers/codex/websocket/websocket.js +219 -0
- package/dist/providers/index.d.ts +2 -2
- package/dist/providers/index.js +1 -1
- package/dist/providers/process.d.ts +2 -2
- package/dist/providers/process.js +37 -4
- package/dist/providers/registry/registry.js +2 -1
- package/dist/providers/types.d.ts +25 -2
- package/dist/runtime/runtime.js +11 -3
- package/dist/runtime/state/index.d.ts +1 -1
- package/dist/runtime/state/index.js +1 -1
- package/dist/runtime/state/state.d.ts +15 -0
- package/dist/runtime/state/state.js +92 -1
- package/dist/runtime/types.d.ts +0 -2
- package/dist/runtime/types.js +0 -3
- package/dist/sessions/sessions.js +2 -0
- package/dist/snapshots/archive/archive.d.ts +29 -0
- package/dist/snapshots/archive/archive.js +342 -0
- package/dist/snapshots/archive/constants.d.ts +5 -0
- package/dist/snapshots/archive/constants.js +8 -0
- package/dist/snapshots/archive/index.d.ts +1 -0
- package/dist/snapshots/archive/index.js +2 -0
- package/dist/snapshots/artifacts.d.ts +10 -1
- package/dist/snapshots/artifacts.js +38 -13
- package/dist/snapshots/capture.d.ts +15 -0
- package/dist/snapshots/capture.js +158 -0
- package/dist/snapshots/database.d.ts +2 -0
- package/dist/snapshots/database.js +35 -55
- package/dist/snapshots/fences.d.ts +10 -0
- package/dist/snapshots/fences.js +51 -0
- package/dist/snapshots/index.d.ts +1 -0
- package/dist/snapshots/index.js +2 -0
- package/dist/snapshots/snapshots.d.ts +7 -3
- package/dist/snapshots/snapshots.js +31 -117
- package/dist/snapshots/snapshots.worker.js +5 -1
- package/dist/snapshots/types.d.ts +35 -3
- package/dist/snapshots/types.js +19 -4
- package/dist/storage/index.d.ts +2 -1
- package/dist/storage/index.js +2 -1
- package/dist/storage/schema/constants.d.ts +2 -0
- package/dist/storage/schema/constants.js +9 -0
- package/dist/storage/schema/index.d.ts +3 -0
- package/dist/storage/schema/index.js +6 -0
- package/dist/storage/schema/schema.d.ts +18 -0
- package/dist/storage/schema/schema.js +59 -0
- package/dist/storage/schema/types.d.ts +7 -0
- package/dist/storage/schema/types.js +8 -0
- package/dist/storage/storage.d.ts +1 -1
- package/dist/storage/storage.js +2 -2
- package/dist/storage/types.d.ts +0 -5
- package/dist/storage/types.js +0 -6
- package/dist/store/collaboration/collaboration.model.d.ts +2 -2
- package/dist/store/control/types.d.ts +16 -16
- package/dist/store/plans/plans.model.d.ts +3 -105
- package/dist/store/plans/plans.model.js +6 -46
- package/dist/store/schema.js +7 -35
- package/dist/store/schema.sql +91 -16
- package/dist/store/sessions/index.d.ts +1 -0
- package/dist/store/sessions/index.js +2 -0
- package/dist/store/sessions/sessions.model.d.ts +28 -0
- package/dist/store/sessions/sessions.model.js +105 -0
- package/dist/store/store.js +13 -7
- package/dist/store/store.worker.js +16 -11
- package/dist/store/types.d.ts +134 -513
- package/dist/store/types.js +21 -7
- package/docs/recovery.md +8 -4
- package/errors/README.md +3 -3
- package/package.json +2 -2
- package/dist/plans/reconciliation.d.ts +0 -34
- package/dist/plans/reconciliation.js +0 -246
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.0.0
|
|
4
|
+
|
|
5
|
+
- Run Codex sessions on Codex's shared app-server daemon, which also hosts terminal sessions, through `codex app-server proxy`. A keepalive notices a stopped daemon: affected sessions become uncertain, nothing is resent, and the next Codex read reconnects. Extra skill roots now travel with the threads HQ starts instead of changing every session on the daemon.
|
|
6
|
+
- Show sessions started in a terminal. Codex sessions on the daemon and Claude sessions from `claude agents --json` report a live state with external ownership, and take input only after they are closed there and adopted. Every state change of a managed or observed session is recorded in order and read with `session-states`; transitions are kept for seven days.
|
|
7
|
+
- Capture snapshots while agents keep working, and mark a plan edited during capture so restore withholds its execution authority. Add `packHqSnapshot` and `unpackHqSnapshot` for AES-256-GCM archives of a snapshot, for off-machine copies.
|
|
8
|
+
- Keep one storage schema. Its stamp records the package version that wrote it, and any other schema is refused with an error naming that version. Remove the offline storage upgrade, the `upgrade-storage` command and version-1 snapshot support.
|
|
9
|
+
- Finalize plans on the milestone IDs jg-breakdown assigns. Completion evidence follows its milestone ID, and evidence whose ID left the sequence is listed as unmatched. Add the `register` plan command so snapshots capture a plan's files. Remove HQ's own milestone matching, the `reconciliation` command and the correspondence contracts.
|
|
10
|
+
- Remove host-only contracts: the `priority`, `error-reservation` and `publication-retry` browser commands, the host read models, the `scope`, `repositories` and `errorReservations` plan metadata, plan comparisons and the `parsePlanContract` option. A plan's execution identity is its body, its milestones and its frontmatter extensions. The single Codex quota bucket is named `single`.
|
|
11
|
+
|
|
12
|
+
## 3.0.0
|
|
13
|
+
|
|
14
|
+
- Check protocol 0.2 plans with jg-plans 0.3.0 at each stage that grants authority: plan approval requires plan.md to conform, and finalization, sequence approval, authorization and execution require plan.md and milestones.md to conform together. Reading, status and revision workflows are unaffected, and plans without the 0.2 marker keep their current behavior.
|
|
15
|
+
|
|
16
|
+
- Version HQ storage independently of host user_version. Add explicit offline Node/CLI upgrades with a verified pre-upgrade backup, transactional rollback and uncertainty handling, retaining published 2.0.0 snapshots and version-specific restore fences.
|
|
17
|
+
|
|
18
|
+
- Expose native Codex credit balances and available earned resets without consuming them. Preserve valid single-bucket quota responses when the multi-bucket view is absent.
|
|
19
|
+
- Identify Claude five-hour and seven-day usage meters with explicit model/surface scopes, preserving independent windows, reset times and account-bound freshness. Keep older provider observations compatible.
|
|
20
|
+
|
|
3
21
|
## 2.0.0
|
|
4
22
|
|
|
5
23
|
- Add provider-neutral session capabilities, native lifecycle/configuration, file inputs, structured results, permissions, account observations and extension controls. Detect usable native contracts instead of restricting CLI version labels; isolate unavailable providers.
|
package/README.md
CHANGED
|
@@ -41,13 +41,15 @@ Install the providers you want and sign in through their native CLIs, then start
|
|
|
41
41
|
|
|
42
42
|
The Node API exposes `createAgentHq({ stateRoot, allowedRoots })` and `requestAgentHq(stateRoot, command)`. Configuration comes from these trusted operator inputs. Coding-instruction files are not runtime configuration.
|
|
43
43
|
|
|
44
|
-
The controller owns its SQLite worker and native connections independently of client connections. Its provider registry starts each native integration only when selected. Storage and managed-session reads work without an installed coding CLI; an unavailable provider does not disable another provider. Private state contains the lifetime owner, Unix socket and SQLite discovery metadata. Conversation histories remain in native storage; HQ retains complete bounded final results on their action receipts. Browsing never resumes an external session or starts inference. Quota windows come from native account observations, with explicit stale and unavailable states.
|
|
44
|
+
The controller owns its SQLite worker and native connections independently of client connections. Its provider registry starts each native integration only when selected. Storage and managed-session reads work without an installed coding CLI; an unavailable provider does not disable another provider. Private state contains the lifetime owner, Unix socket and SQLite discovery metadata. Conversation histories remain in native storage; HQ retains complete bounded final results on their action receipts. Browsing never resumes an external session or starts inference. Quota windows come from native account observations, with explicit stale and unavailable states. Usage reads include Codex credit balances and available earned-reset counts when reported, plus Claude five-hour and seven-day meters with their model/surface scopes and reset times.
|
|
45
45
|
|
|
46
46
|
Use `sessions` for discovery and `session-evidence` for newest-first historical evidence. These reads fit within 65,536 serialized bytes, retain exact native identities and content hashes, and continue large bodies in UTF-8 chunks. Select an item, turn or item kinds with filters. Matching names remain separate sessions. Provenance distinguishes native evidence from exact host submissions; historical text and quoted feedback never grant approval. See [bounded session evidence](api/README.md#bounded-session-evidence).
|
|
47
47
|
|
|
48
|
-
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.
|
|
48
|
+
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
49
|
|
|
50
|
-
`createHqSnapshot(hq, destination)` captures
|
|
50
|
+
`createHqSnapshot(hq, destination)` captures local state through SQLite's backup API while agents keep working, including host tables, stored reports, action.key and registered plan companions. HQ-mediated plan writes wait for it; the host keeps its own connections from writing host tables until it resolves. A plan that changed during capture is marked, and restore withholds its execution authority. `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 automation is paused, skill grants are revoked, 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
|
+
|
|
52
|
+
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, and HQ sends them no input until they are closed there and handed over with `thread-adopt`. Every state change of a managed or observed session is recorded in order; read them with `{ kind: 'session-states', afterSequence }` or `session-states`. See [session states](api/README.md#session-states).
|
|
51
53
|
|
|
52
54
|
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.
|
|
53
55
|
|
|
@@ -83,11 +85,9 @@ Controlled agents use `hq_identity` to recover their stable managed ID, task mem
|
|
|
83
85
|
|
|
84
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).
|
|
85
87
|
|
|
86
|
-
HQ uses jg-plans to observe and prepare ordinary Markdown plans. The
|
|
87
|
-
|
|
88
|
-
Coordinators can retain revision-bound compatibility reviews in that same file. Core operations preserve the records without assessing them or granting authority. The integrating coordinator owns review freshness and conflict gates.
|
|
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
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.
|
|
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
91
|
|
|
92
92
|
## Agent review and feedback
|
|
93
93
|
|
|
@@ -103,7 +103,7 @@ Follow the [three complete walkthroughs](https://jg-agent-hq.jesusgraterol.dev/e
|
|
|
103
103
|
|
|
104
104
|
These complete TypeScript examples use the public client and contracts. Start the local controller, sign in to the native CLIs, and install the required skills and supported project-local jg-plans CLI 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
105
|
|
|
106
|
-
`examples/shared-storage.ts` uses a
|
|
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 and fresh authority before execution.
|
|
107
107
|
|
|
108
108
|
The [qualification matrix](api/README.md#qualification) records native journeys, host coverage and remaining interface limits.
|
|
109
109
|
|
|
@@ -114,21 +114,21 @@ The [qualification matrix](api/README.md#qualification) records native journeys,
|
|
|
114
114
|
- `src/locks/`: lock ownership, acquisition, status and deliberate recovery.
|
|
115
115
|
- `src/runtime/`: trusted configuration and lifetime ownership.
|
|
116
116
|
- `src/ipc/` and `src/cli/`: private local commands and the installed executable.
|
|
117
|
-
- `src/providers/codex/`: native history and account protocol.
|
|
118
|
-
- `src/providers/claude/`: native structured control and usage,
|
|
117
|
+
- `src/providers/codex/`: the shared app-server daemon connection, native history and account protocol.
|
|
118
|
+
- `src/providers/claude/`: native structured control and usage, the identity-validated, worker-owned local history reader and the active-session poll.
|
|
119
119
|
- `src/providers/registry/`: lazy factories, normalized provider evidence, bounded lifecycle and source isolation.
|
|
120
120
|
- `src/providers/inputs/` and `src/providers/results/`: checked file delivery and complete native result validation.
|
|
121
121
|
- `src/providers/configuration/` and `src/providers/lineage/`: bounded native choices and confirmed immutable session relationships.
|
|
122
|
-
- `src/sessions/`: authorized discovery, bounded evidence and provenance, cursor-bound history reads and short label suggestions.
|
|
122
|
+
- `src/sessions/`: authorized discovery with live session states, bounded evidence and provenance, cursor-bound history reads and short label suggestions.
|
|
123
123
|
- `src/plans/`: execution digests, milestone finalization, revision checkpoints, retained verification and explicit plan authority.
|
|
124
124
|
- `src/skills/`: bounded native catalogs, invocation previews and explicit input preparation.
|
|
125
125
|
- `src/accounts/` and `src/extensions/`: safe account observations and authorized, bounded native MCP inventories.
|
|
126
126
|
- `src/collaboration/`: host-owned tasks, streams, scoped skill-grant admission and event-driven directed request dispatch.
|
|
127
127
|
- `src/collaboration/identity/` and `src/agent-tools/`: native-bound identity, private bridge credentials, shared agent tools and the stdio MCP entry.
|
|
128
128
|
- `src/actions/`: durable action dispatch, native input routing and bounded live presentation.
|
|
129
|
-
- `src/store/`: SQLite discovery metadata, collaboration streams and the action/control ledger in one worker.
|
|
130
|
-
- `src/storage/`: trusted host
|
|
131
|
-
- `src/snapshots/`:
|
|
129
|
+
- `src/store/`: SQLite discovery metadata, observed sessions and state transitions, collaboration streams and the action/control ledger in one worker.
|
|
130
|
+
- `src/storage/`: trusted host metadata, exclusive maintenance and the current schema stamp.
|
|
131
|
+
- `src/snapshots/`: capture while agents work, streamed inventory validation and offline recovery with execution paused.
|
|
132
132
|
- `src/contracts/`: browser-safe command and response contracts.
|
|
133
133
|
- `scripts/package/`: build-output cleanup and packed-consumer checks.
|
|
134
134
|
- `scripts/release/`: registry version/integrity checks and trusted publication of the tested archive.
|