jg-agent-hq 13.5.2 → 13.5.4
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 +10 -0
- package/README.md +2 -0
- package/api/README.md +2 -0
- package/dist/providers/claude/control/control.js +1 -0
- package/dist/providers/claude/control/stream.js +19 -4
- package/dist/providers/claude/control/types.d.ts +1 -0
- package/dist/store/control/admission/admission.model.js +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 13.5.4
|
|
4
|
+
|
|
5
|
+
- Keep Claude control when a steering message is replayed before the preceding turn's result but its own answer completes afterward. Match that completion only to an exact live replay observed by the same controller, retaining bounded correlation metadata and rejecting unknown or consumed identities.
|
|
6
|
+
- Retire replay metadata on new explicit input, controller replacement and shutdown. Preserve existing action receipts, paused queues, storage schema and native history without sending input again.
|
|
7
|
+
|
|
8
|
+
## 13.5.3
|
|
9
|
+
|
|
10
|
+
- Keep controller creation, adoption, resume and recovery in the existing preparation state until native readiness. Opening a session without input no longer reports a turn starting or completing, preventing false completion notifications. Genuine input and autonomous native turns retain their lifecycle events.
|
|
11
|
+
- Preserve the storage schema, action key, input receipts and queue admission without migration or replay.
|
|
12
|
+
|
|
3
13
|
## 13.5.2
|
|
4
14
|
|
|
5
15
|
- Automatically rejoin previously managed Codex sessions after a shared connection loss or HQ restart when their verified latest native turn changed. Joining sends no input or settings, leaves earlier receipts unresolved and queues paused, and still refuses unverified state, pending submissions and turn changes during the join. Existing uncertain/external sessions still require explicit recovery.
|
package/README.md
CHANGED
|
@@ -71,6 +71,8 @@ Explicit actions create, name, adopt, resume, close and delete threads; send idl
|
|
|
71
71
|
|
|
72
72
|
Claude can save a steer as a queued-command attachment without echoing a live user message. Reading that saved input through history, details or evidence confirms a submitted or uncertain delivery when its exact action, session, workspace, turn and original-text fingerprint match. The existing turn-completion history flush performs the same check. This also resolves receipts from an earlier runtime without restoring control or resending input.
|
|
73
73
|
|
|
74
|
+
A steering replay can arrive before the preceding turn's result even when Claude answers it in a following turn. That following completion can name the exact replayed input instead of HQ's generated live turn ID. The controller retains a bounded set of these observed identities within its process generation, consumes a matching completion once and retires them on a new explicit input or controller replacement. Unknown results remain unavailable. This changes no receipt ownership, storage schema or queue delivery and never resends input.
|
|
75
|
+
|
|
74
76
|
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).
|
|
75
77
|
|
|
76
78
|
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 steers its active turn with a structured user message. Close other CLI controllers before confirming adoption, resume or recovery. The runtime 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.
|
package/api/README.md
CHANGED
|
@@ -405,6 +405,8 @@ Codex leaves `reasoning` items out as it reads them, so a Codex page can hold fe
|
|
|
405
405
|
|
|
406
406
|
## Session states
|
|
407
407
|
|
|
408
|
+
Controller setup uses the managed record's existing `creating` preparation state for creation, adoption, resume and recovery. Until native readiness its session state is unknown, rather than a running inference turn. Readiness alone records `opened`, never `turn-completed`; `starting` is reserved for an action that actually submits turn input. Verified existing turns and autonomous native output still record their actual lifecycle.
|
|
409
|
+
|
|
408
410
|
Every session has a live state: `running`, `waiting` (on the operator), `idle`, `closed`, `failed` or `unknown`. A managed session reports it from its managed record. A session another client drives is observed and listed with `ownership: 'external'`; the runtime sends it no input until `thread-adopt` records it as managed, and never stops, wakes or drives a session a terminal runs. A managed session the runtime closed is observed again, so a terminal that continues it shows its state.
|
|
409
411
|
|
|
410
412
|
A retained session with uncertain ownership also takes its live state from native observation, including loaded Codex sessions found at startup and later status changes. Thread reads, discovery and active-session summaries retain its managed ID and `ownership: 'uncertain'`. Observation never changes its control record, settles uncertain input, advances queued input or restores execution authority. Without a native observation its state remains unknown; explicit recovery is still required to regain control.
|
|
@@ -206,6 +206,7 @@ export const createClaudeControl = (additionalDirectories = []) => {
|
|
|
206
206
|
conflict();
|
|
207
207
|
session.parked = undefined;
|
|
208
208
|
session.scope = randomUUID();
|
|
209
|
+
session.replayedSteers?.clear();
|
|
209
210
|
const scope = session.scope;
|
|
210
211
|
session.opening = start(session, session.hasInput, signal);
|
|
211
212
|
try {
|
|
@@ -115,6 +115,7 @@ const acknowledge = (session, events) => {
|
|
|
115
115
|
if (!input || input.isAcknowledged)
|
|
116
116
|
return;
|
|
117
117
|
input.isAcknowledged = true;
|
|
118
|
+
session.replayedSteers?.clear();
|
|
118
119
|
clearTimeout(input.timer);
|
|
119
120
|
input.resolve({ id: input.id });
|
|
120
121
|
const request = parseActionRequest(input.requestId);
|
|
@@ -162,6 +163,8 @@ export const setBackgroundCommands = (session, count, events) => {
|
|
|
162
163
|
* @param failure The shared control failure, when its diagnostic cause is available.
|
|
163
164
|
*/
|
|
164
165
|
export const failSteers = (session, turnId, failure = HQ_ERRORS.create('claudeFailed', { data: { kind: 'agent-unavailable' } })) => {
|
|
166
|
+
if (turnId === undefined)
|
|
167
|
+
session.replayedSteers?.clear();
|
|
165
168
|
for (const steer of session.steers.values()) {
|
|
166
169
|
if (turnId !== undefined && steer.turnId !== turnId)
|
|
167
170
|
continue;
|
|
@@ -176,6 +179,8 @@ export const failSteers = (session, turnId, failure = HQ_ERRORS.create('claudeFa
|
|
|
176
179
|
* result, at once; a steer still unreplayed this long after its turn ended fails.
|
|
177
180
|
*/
|
|
178
181
|
const STEER_REPLAY_GRACE_MS = 30_000;
|
|
182
|
+
// match the bounded late-control identity window; eviction never accepts an unknown result
|
|
183
|
+
const MAX_REPLAYED_STEERS = 64;
|
|
179
184
|
/** Gives the steers of a turn that just ended their grace period for a replay after its result. */
|
|
180
185
|
const awaitLateSteers = (session, turnId) => {
|
|
181
186
|
for (const steer of session.steers.values())
|
|
@@ -183,13 +188,20 @@ const awaitLateSteers = (session, turnId) => {
|
|
|
183
188
|
steer.timer = setTimeout(() => failSteers(session, turnId), STEER_REPLAY_GRACE_MS);
|
|
184
189
|
};
|
|
185
190
|
/**
|
|
186
|
-
* Takes in a steer's replay
|
|
187
|
-
*
|
|
188
|
-
*
|
|
191
|
+
* Takes in a steer's replay, which can precede the old result even when its answer runs next.
|
|
192
|
+
* With no active turn, the replay starts that following turn under its own UUID; otherwise keep
|
|
193
|
+
* its identity for a later native completion. Acknowledge delivery against the turn it named.
|
|
189
194
|
*/
|
|
190
195
|
const acknowledgeSteer = (session, steer, events) => {
|
|
191
196
|
clearTimeout(steer.timer);
|
|
192
197
|
session.steers.delete(steer.id);
|
|
198
|
+
const replayed = (session.replayedSteers ??= new Set());
|
|
199
|
+
replayed.add(steer.id);
|
|
200
|
+
if (replayed.size > MAX_REPLAYED_STEERS) {
|
|
201
|
+
const oldest = replayed.values().next().value;
|
|
202
|
+
if (oldest !== undefined)
|
|
203
|
+
replayed.delete(oldest);
|
|
204
|
+
}
|
|
193
205
|
if (!getActiveTurn(session)) {
|
|
194
206
|
session.nativeTurn = { id: steer.id, interruptRequested: false, hasInterruptionMarker: false };
|
|
195
207
|
events?.observe({
|
|
@@ -364,10 +376,13 @@ export const receiveClaudeMessage = (session, raw, events) => {
|
|
|
364
376
|
observeFastMode(session, raw);
|
|
365
377
|
// a turn Claude started, or one a steer runs after its turn, has no action to capture its result
|
|
366
378
|
if (result.user_message_uuid === undefined ||
|
|
367
|
-
result.user_message_uuid === session.nativeTurn?.id
|
|
379
|
+
result.user_message_uuid === session.nativeTurn?.id ||
|
|
380
|
+
(session.nativeTurn !== undefined && session.replayedSteers?.has(result.user_message_uuid))) {
|
|
368
381
|
const turn = session.nativeTurn;
|
|
369
382
|
if (!turn)
|
|
370
383
|
unavailable();
|
|
384
|
+
if (result.user_message_uuid !== undefined)
|
|
385
|
+
session.replayedSteers?.delete(result.user_message_uuid);
|
|
371
386
|
session.nativeTurn = undefined;
|
|
372
387
|
endTurn(session, events);
|
|
373
388
|
awaitLateSteers(session, turn.id);
|
|
@@ -242,7 +242,7 @@ export class ControlAdmission extends ControlModel {
|
|
|
242
242
|
}
|
|
243
243
|
if (isCreating)
|
|
244
244
|
phase = 'create';
|
|
245
|
-
this._statements.run("UPDATE agent_hq_thread SET ownership = 'managed', runtime_epoch = ?, pending_action_id = ?, active_turn_id = NULL, state =
|
|
245
|
+
this._statements.run("UPDATE agent_hq_thread SET ownership = 'managed', runtime_epoch = ?, pending_action_id = ?, active_turn_id = NULL, state = 'creating', updated_at = ? WHERE id = ?", this._epoch, action.id, now, threadId);
|
|
246
246
|
if (prepared.recoveryTurn !== undefined) {
|
|
247
247
|
if (command.kind !== 'thread-recover' ||
|
|
248
248
|
command.recovery.kind !== 'resume' ||
|
|
@@ -359,7 +359,7 @@ export class ControlAdmission extends ControlModel {
|
|
|
359
359
|
this._conflict();
|
|
360
360
|
const threadId = randomUUID();
|
|
361
361
|
this._statements.run(`INSERT INTO agent_hq_thread (id, provider, native_id, name, workspace_root, ownership, runtime_epoch, pending_action_id, state, registration_action_id, created_at, updated_at)
|
|
362
|
-
VALUES (?, ?, ?, ?, ?, 'managed', ?, ?, ?, ?, ?, ?)`, threadId, provider, nativeId ?? null, name, prepared.workspaceRoot, this._epoch, actionId,
|
|
362
|
+
VALUES (?, ?, ?, ?, ?, 'managed', ?, ?, ?, ?, ?, ?)`, threadId, provider, nativeId ?? null, name, prepared.workspaceRoot, this._epoch, actionId, 'creating', actionId, now, now);
|
|
363
363
|
this._statements.run('UPDATE agent_hq_action SET thread_id = ?, requested_name = ?, provider = ? WHERE id = ?', threadId, name, provider, actionId);
|
|
364
364
|
if (prepared.input) {
|
|
365
365
|
this._statements.run('UPDATE agent_hq_action SET queued_input = ? WHERE id = ?', JSON.stringify(prepared.input), actionId);
|
package/package.json
CHANGED