jg-agent-hq 13.5.4 → 13.5.6

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 CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 13.5.6
4
+
5
+ - Forward creation model, reasoning effort, Fast mode and output schema to the session's first turn for Codex and Claude. Keep startup-only settings on session creation, and preserve the same action identity and input admission checks.
6
+
7
+ ## 13.5.5
8
+
9
+ - Preserve queued Claude steers across intervening native turns. Unconfirmed delivery expires only after 30 continuous idle seconds; saved-history confirmations retain their identity until live replay or controller teardown.
10
+ - Report rejected Claude results with bounded UUID-only correlation metadata and a rejection reason, without prompts, native output, file paths or credentials.
11
+ - Preserve exact replay/result validation, action receipts, native history, storage schema and paused queues without resending input.
12
+
3
13
  ## 13.5.4
4
14
 
5
15
  - 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.
package/README.md CHANGED
@@ -71,7 +71,7 @@ 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.
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. Pending steers survive intervening native turns: only unconfirmed input expires after 30 continuous idle seconds, and saved confirmations retain their identity until live replay or controller teardown. Rejected results emit a bounded stderr diagnostic with validated UUIDs and a reason, never message bodies or paths.
75
75
 
76
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).
77
77
 
package/api/README.md CHANGED
@@ -274,22 +274,22 @@ Hosts retain their own resolution metadata and recover missed questions through
274
274
 
275
275
  Send `{ kind: 'action', action: { id, runtimeEpoch, command } }`. Generate one UUID per user intent, take the epoch from `status` or the runtime's `runtimeEpoch`, and retain the complete envelope until its receipt can be read. The validated envelope is limited to `MAX_ACTION_BYTES`, 32,768 UTF-8 bytes of its JSON, which `jg-agent-hq/contracts` exports. It is recorded before native writes. Reusing the UUID with the identical envelope returns the saved receipt without dispatch; a changed envelope conflicts. This check also works for an original request read after restart. A new UUID with an expired epoch cannot execute.
276
276
 
277
- | Action | Fields and behavior |
278
- | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
279
- | `thread-create` | `provider` (a registered provider ID), `workspaceRoot`, `name`, optional `input`. Creates an empty native thread and sets its readable name before reporting acknowledgement. With `input`, the same action then sends it as the session's first message, see [first input](#first-input). |
280
- | `thread-adopt` | The same fields plus `nativeId`, `operatorConfirmation`. Explicitly records an external thread as managed. Codex accepts it unloaded or idle, between turns of a terminal that still holds it, and resumes it with optional `settings`, which it refuses while another client holds the thread; Claude requires qualified workspace history and the native idle/session-identity checks, and refuses while a terminal runs it. |
281
- | `thread-resume` | `threadId`, `operatorConfirmation`. Resumes an inactive managed thread; the runtime does not fetch its complete conversation bodies. |
282
- | `thread-recover` | `threadId`, `operatorConfirmation`, `recovery`. The recovery is `{ kind: 'resume' }` for a known native identity, `{ kind: 'attach', nativeId }` for an inspected identity after uncertain creation, or `{ kind: 'create' }` to explicitly create a fresh empty thread when no native identity was recorded. The latter can leave an empty orphan from the uncertain creation; it never repeats a message. |
283
- | `thread-rename` | `threadId`, `name`. Changes the name only after the matching native acknowledgement. |
284
- | `thread-close` | `threadId`, optional `interrupt`. Requires an idle thread and pauses its queue. Codex cleans and verifies its native terminal list before unsubscribe. Claude closes the owned CLI and proves process-group exit before releasing control. With `interrupt: true`, a thread whose turn runs is interrupted first, by the same action: its `phase` is `interrupt` until the turn ends, then `clean` and `close`; an idle thread closes as without it. For a verified current-runtime quarantined Claude controller, explicit interrupting close instead starts at clean/close, without guessing a turn; unknown work may still be running. |
285
- | `thread-delete` | `provider`, `workspaceRoot`, `nativeId`. Deletes a session no process runs from its provider's storage, with the runtime's records of it, and runs within its request; see [thread deletion](#thread-deletion). |
286
- | `message` | `threadId`, `input`. Starts a turn only while idle. |
287
- | `steer` | `threadId`, `expectedTurnId`, `text`, optional top-level `files` (`InputFileSchema[]`). Codex uses native `turn/steer`. Claude writes text and qualified files as a user message into the exact active turn, never interrupting it, and acknowledges it when Claude replays it: at the turn's next tool boundary, where the turn takes it in and ends with one result, or, for text written while the turn's final answer streams, after the turn's result, where it runs as the session's next turn under its own UUID. Either replay acknowledges the steer against the turn it named. A Claude steer never replayed fails 30 seconds after that turn ends, and one pending when the process stops fails at once. Otherwise a finished or changed turn cannot become a new turn. Unlisted media types reject the complete input before native writing. No skills or settings are accepted. |
288
- | `queue` | `threadId`, `expectedTurnId`, `input`. Saves an explicit next-turn message or skill invocation, never a permission or question answer. |
289
- | `queue-send` | `queuedActionId`. Explicitly authorizes a still-undelivered queue entry, including a queue paused by restart or interruption. |
290
- | `queue-cancel` | `queuedActionId`. Cancels only an undelivered queue entry and clears its saved body. |
291
- | `interrupt` | `threadId`, `expectedTurnId`. A native request acknowledgement leaves the thread stopping until native completion evidence arrives. |
292
- | `native-reply` | `threadId`, `expectedTurnId`, `approvalId`, `response`. Answers one exact current native request; cannot consume queue text. |
277
+ | Action | Fields and behavior |
278
+ | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
279
+ | `thread-create` | `provider` (a registered provider ID), `workspaceRoot`, `name`, optional `input`. Creates an empty native thread and sets its readable name before reporting acknowledgement. With `input`, the same action then sends it as the session's first message, see [first input](#first-input). |
280
+ | `thread-adopt` | The same fields plus `nativeId`, `operatorConfirmation`. Explicitly records an external thread as managed. Codex accepts it unloaded or idle, between turns of a terminal that still holds it, and resumes it with optional `settings`, which it refuses while another client holds the thread; Claude requires qualified workspace history and the native idle/session-identity checks, and refuses while a terminal runs it. |
281
+ | `thread-resume` | `threadId`, `operatorConfirmation`. Resumes an inactive managed thread; the runtime does not fetch its complete conversation bodies. |
282
+ | `thread-recover` | `threadId`, `operatorConfirmation`, `recovery`. The recovery is `{ kind: 'resume' }` for a known native identity, `{ kind: 'attach', nativeId }` for an inspected identity after uncertain creation, or `{ kind: 'create' }` to explicitly create a fresh empty thread when no native identity was recorded. The latter can leave an empty orphan from the uncertain creation; it never repeats a message. |
283
+ | `thread-rename` | `threadId`, `name`. Changes the name only after the matching native acknowledgement. |
284
+ | `thread-close` | `threadId`, optional `interrupt`. Requires an idle thread and pauses its queue. Codex cleans and verifies its native terminal list before unsubscribe. Claude closes the owned CLI and proves process-group exit before releasing control. With `interrupt: true`, a thread whose turn runs is interrupted first, by the same action: its `phase` is `interrupt` until the turn ends, then `clean` and `close`; an idle thread closes as without it. For a verified current-runtime quarantined Claude controller, explicit interrupting close instead starts at clean/close, without guessing a turn; unknown work may still be running. |
285
+ | `thread-delete` | `provider`, `workspaceRoot`, `nativeId`. Deletes a session no process runs from its provider's storage, with the runtime's records of it, and runs within its request; see [thread deletion](#thread-deletion). |
286
+ | `message` | `threadId`, `input`. Starts a turn only while idle. |
287
+ | `steer` | `threadId`, `expectedTurnId`, `text`, optional top-level `files` (`InputFileSchema[]`). Codex uses native `turn/steer`. Claude writes text and qualified files as a user message into the exact active turn, never interrupting it, and acknowledges it when Claude replays it: at the turn's next tool boundary, where the turn takes it in and ends with one result, or, for text written while the turn's final answer streams, after the turn's result, where it runs as the session's next turn under its own UUID. Either replay acknowledges the steer against the turn it named. Unconfirmed Claude input expires after 30 continuous idle seconds; any new turn cancels that deadline and a later idle window rearms it for all waiting steers. Saved-history-confirmed steers retain their correlation identity until live replay or controller teardown. Unconfirmed input pending when the process stops fails at once. Otherwise a finished or changed turn cannot become a new turn. Unlisted media types reject the complete input before native writing. No skills or settings are accepted. |
288
+ | `queue` | `threadId`, `expectedTurnId`, `input`. Saves an explicit next-turn message or skill invocation, never a permission or question answer. |
289
+ | `queue-send` | `queuedActionId`. Explicitly authorizes a still-undelivered queue entry, including a queue paused by restart or interruption. |
290
+ | `queue-cancel` | `queuedActionId`. Cancels only an undelivered queue entry and clears its saved body. |
291
+ | `interrupt` | `threadId`, `expectedTurnId`. A native request acknowledgement leaves the thread stopping until native completion evidence arrives. |
292
+ | `native-reply` | `threadId`, `expectedTurnId`, `approvalId`, `response`. Answers one exact current native request; cannot consume queue text. |
293
293
 
294
294
  Message and queue input is a closed union: `{ kind: 'text', text }` or `{ kind: 'skill', skillId, arguments }`. Text is nonempty and at most 65,536 characters; skill arguments may be empty and cap at 16,384 characters. The envelope's UTF-8 limit still applies. A selected skill is resolved through the target thread's current native catalog before admission. Unavailable, missing or disabled selections cannot dispatch. Normal text needs no catalog read. Steering retains its `text` field and exact active-turn target, adding only optional top-level `files`. Text-only steers remain unchanged; skills and turn settings cannot be steered.
295
295
 
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { TurnSettingsSchema } from '../../contracts/index.js';
2
3
  import { HQ_ERRORS } from '../../errors/index.js';
3
4
  import { PROVIDER_OPERATIONS, readInputFiles } from '../../providers/index.js';
4
5
  import { capabilityUnavailable } from '../../providers/registry/index.js';
@@ -147,10 +148,8 @@ export const createAdmission = (context, dispatcher) => {
147
148
  prepared.workspaceRoot = await resolveWorkspaceTarget(command.workspaceRoot, roots);
148
149
  if (command.kind === 'thread-create' && command.input) {
149
150
  // a first input resolves a skill from the folder's catalog, as the new session's matches it
150
- input = await prepareInput(command.input, {}, prepared.workspaceRoot, {
151
- provider: command.provider,
152
- workspaceRoot: prepared.workspaceRoot,
153
- });
151
+ const { model, effort, fast, outputSchema } = command.settings ?? {};
152
+ input = await prepareInput(command.input, TurnSettingsSchema.parse({ model, effort, fast, outputSchema }), prepared.workspaceRoot, { provider: command.provider, workspaceRoot: prepared.workspaceRoot });
154
153
  await control.validateInput(undefined, input);
155
154
  prepared.input = input;
156
155
  }
@@ -141,8 +141,8 @@ export declare const createClaudeControl: (additionalDirectories?: string[]) =>
141
141
  * interrupting it. Claude takes it in at the turn's next tool boundary and replays it there,
142
142
  * or, for text written while the turn's final answer streams, replays it after the turn's
143
143
  * result and runs it as the session's next turn. Either replay acknowledges the steer against
144
- * the turn it named; a stopped process, or no replay within 30 seconds of that turn's end,
145
- * fails it.
144
+ * the turn it named. Unconfirmed input fails after 30 continuous idle seconds or process
145
+ * shutdown. Saved confirmations retain their identity for a later live replay.
146
146
  * @returns The turn the steer named, once Claude replayed it.
147
147
  * @throws
148
148
  * - JG_AGENT_HQ_ACTION_CONFLICT: The HQ action conflicts with its recorded state
@@ -610,8 +610,8 @@ export const createClaudeControl = (additionalDirectories = []) => {
610
610
  * interrupting it. Claude takes it in at the turn's next tool boundary and replays it there,
611
611
  * or, for text written while the turn's final answer streams, replays it after the turn's
612
612
  * result and runs it as the session's next turn. Either replay acknowledges the steer against
613
- * the turn it named; a stopped process, or no replay within 30 seconds of that turn's end,
614
- * fails it.
613
+ * the turn it named. Unconfirmed input fails after 30 continuous idle seconds or process
614
+ * shutdown. Saved confirmations retain their identity for a later live replay.
615
615
  * @returns The turn the steer named, once Claude replayed it.
616
616
  * @throws
617
617
  * - JG_AGENT_HQ_ACTION_CONFLICT: The HQ action conflicts with its recorded state
@@ -0,0 +1,3 @@
1
+ import type { IClaudeSession } from './types.js';
2
+ /** Reports one rejected result without exposing prompts, output, paths or parser payloads. */
3
+ export declare const reportRejectedClaudeResult: (session: IClaudeSession, result: unknown, reason: "invalid-result" | "no-active-turn" | "input-mismatch") => void;
@@ -0,0 +1,35 @@
1
+ import { z } from 'zod';
2
+ // failure output is bounded and contains only validated identities, never native bodies
3
+ const MAX_DIAGNOSTIC_IDS = 64;
4
+ const ResultIdentitySchema = z.object({ user_message_uuid: z.uuid().optional() });
5
+ const uuidOrNull = (candidate) => {
6
+ const parsed = z.uuid().safeParse(candidate);
7
+ return parsed.success ? parsed.data : null;
8
+ };
9
+ const collectIds = (identities) => {
10
+ const selected = [];
11
+ let inspected = 0;
12
+ for (const identity of identities) {
13
+ inspected += 1;
14
+ const uuid = uuidOrNull(identity);
15
+ if (uuid !== null)
16
+ selected.push(uuid);
17
+ if (inspected === MAX_DIAGNOSTIC_IDS)
18
+ break;
19
+ }
20
+ return selected;
21
+ };
22
+ /** Reports one rejected result without exposing prompts, output, paths or parser payloads. */
23
+ export const reportRejectedClaudeResult = (session, result, reason) => {
24
+ const identity = ResultIdentitySchema.safeParse(result);
25
+ console.error('[jg-agent-hq] Claude result rejected', JSON.stringify({
26
+ reason,
27
+ sessionId: uuidOrNull(session.id),
28
+ userMessageUuid: identity.success ? (identity.data.user_message_uuid ?? null) : null,
29
+ inputId: uuidOrNull(session.input?.id),
30
+ nativeTurnId: uuidOrNull(session.nativeTurn?.id),
31
+ pendingSteerCount: session.steers.size,
32
+ pendingSteerIds: collectIds(session.steers.keys()),
33
+ replayedSteerIds: collectIds(session.replayedSteers ?? []),
34
+ }));
35
+ };
@@ -6,6 +6,7 @@ import { toTurnResult } from '../../results/index.js';
6
6
  import { parseActionRequest } from '../../utilities.js';
7
7
  import { HQ_ERRORS } from '../../../errors/index.js';
8
8
  import { createClaudePrompt } from './permissions.js';
9
+ import { reportRejectedClaudeResult } from './diagnostics.js';
9
10
  const FrameSchema = z.object({
10
11
  type: z.string(),
11
12
  session_id: z.string().optional(),
@@ -109,12 +110,18 @@ const unavailable = () => {
109
110
  * input's. Input still waiting for its replay has no turn yet.
110
111
  */
111
112
  export const getActiveTurn = (session) => session.nativeTurn ?? (session.input?.isAcknowledged ? session.input : undefined);
113
+ /** Cancels the idle-only replay deadline before a new native turn begins. */
114
+ const pauseSteerExpiry = (session) => {
115
+ clearTimeout(session.steerReplayTimer);
116
+ delete session.steerReplayTimer;
117
+ };
112
118
  /** Acknowledges the single current input before forwarding its ordered turn evidence. */
113
119
  const acknowledge = (session, events) => {
114
120
  const input = session.input;
115
121
  if (!input || input.isAcknowledged)
116
122
  return;
117
123
  input.isAcknowledged = true;
124
+ pauseSteerExpiry(session);
118
125
  session.replayedSteers?.clear();
119
126
  clearTimeout(input.timer);
120
127
  input.resolve({ id: input.id });
@@ -135,6 +142,7 @@ const acknowledge = (session, events) => {
135
142
  const startNativeTurn = (session, events) => {
136
143
  const turn = { id: randomUUID(), interruptRequested: false, hasInterruptionMarker: false };
137
144
  session.nativeTurn = turn;
145
+ pauseSteerExpiry(session);
138
146
  events?.observe({
139
147
  kind: 'turn-started',
140
148
  provider: 'claude',
@@ -163,29 +171,44 @@ export const setBackgroundCommands = (session, count, events) => {
163
171
  * @param failure The shared control failure, when its diagnostic cause is available.
164
172
  */
165
173
  export const failSteers = (session, turnId, failure = HQ_ERRORS.create('claudeFailed', { data: { kind: 'agent-unavailable' } })) => {
166
- if (turnId === undefined)
174
+ if (turnId === undefined) {
175
+ pauseSteerExpiry(session);
167
176
  session.replayedSteers?.clear();
177
+ }
168
178
  for (const steer of session.steers.values()) {
169
179
  if (turnId !== undefined && steer.turnId !== turnId)
170
180
  continue;
171
- clearTimeout(steer.timer);
172
181
  session.steers.delete(steer.id);
173
182
  if (!steer.isAcknowledged)
174
183
  steer.reject(failure);
175
184
  }
176
185
  };
177
- /*
178
- * Claude replays a steer written while a turn's final answer streams only after that turn's
179
- * result, at once; a steer still unreplayed this long after its turn ended fails.
180
- */
186
+ // an unconfirmed steer expires only after a continuous idle window
181
187
  const STEER_REPLAY_GRACE_MS = 30_000;
182
188
  // match the bounded late-control identity window; eviction never accepts an unknown result
183
189
  const MAX_REPLAYED_STEERS = 64;
184
- /** Gives the steers of a turn that just ended their grace period for a replay after its result. */
185
- const awaitLateSteers = (session, turnId) => {
190
+ /** Retains saved confirmations and never expires an input while another turn is running. */
191
+ const expireIdleSteers = (session) => {
192
+ delete session.steerReplayTimer;
193
+ if (getActiveTurn(session) || session.isClosing || session.isQuarantined)
194
+ return;
195
+ for (const [id, steer] of session.steers) {
196
+ if (steer.isAcknowledged)
197
+ continue;
198
+ session.steers.delete(id);
199
+ steer.reject(HQ_ERRORS.create('claudeFailed', { data: { kind: 'agent-unavailable' } }));
200
+ }
201
+ };
202
+ /** Arms one idle deadline for every unconfirmed input, including steers of earlier turns. */
203
+ const awaitLateSteers = (session) => {
204
+ pauseSteerExpiry(session);
205
+ if (getActiveTurn(session) || session.isClosing || session.isQuarantined)
206
+ return;
186
207
  for (const steer of session.steers.values())
187
- if (steer.turnId === turnId && steer.timer === undefined)
188
- steer.timer = setTimeout(() => failSteers(session, turnId), STEER_REPLAY_GRACE_MS);
208
+ if (!steer.isAcknowledged) {
209
+ session.steerReplayTimer = setTimeout(() => expireIdleSteers(session), STEER_REPLAY_GRACE_MS);
210
+ return;
211
+ }
189
212
  };
190
213
  /**
191
214
  * Takes in a steer's replay, which can precede the old result even when its answer runs next.
@@ -193,7 +216,6 @@ const awaitLateSteers = (session, turnId) => {
193
216
  * its identity for a later native completion. Acknowledge delivery against the turn it named.
194
217
  */
195
218
  const acknowledgeSteer = (session, steer, events) => {
196
- clearTimeout(steer.timer);
197
219
  session.steers.delete(steer.id);
198
220
  const replayed = (session.replayedSteers ??= new Set());
199
221
  replayed.add(steer.id);
@@ -203,6 +225,7 @@ const acknowledgeSteer = (session, steer, events) => {
203
225
  replayed.delete(oldest);
204
226
  }
205
227
  if (!getActiveTurn(session)) {
228
+ pauseSteerExpiry(session);
206
229
  session.nativeTurn = { id: steer.id, interruptRequested: false, hasInterruptionMarker: false };
207
230
  events?.observe({
208
231
  kind: 'turn-started',
@@ -372,20 +395,27 @@ export const receiveClaudeMessage = (session, raw, events) => {
372
395
  }
373
396
  }
374
397
  else if (frame.type === 'result') {
375
- const result = ResultSchema.parse(raw);
398
+ const parsedResult = ResultSchema.safeParse(raw);
399
+ if (!parsedResult.success) {
400
+ reportRejectedClaudeResult(session, raw, 'invalid-result');
401
+ throw parsedResult.error;
402
+ }
403
+ const result = parsedResult.data;
376
404
  observeFastMode(session, raw);
377
405
  // a turn Claude started, or one a steer runs after its turn, has no action to capture its result
378
406
  if (result.user_message_uuid === undefined ||
379
407
  result.user_message_uuid === session.nativeTurn?.id ||
380
408
  (session.nativeTurn !== undefined && session.replayedSteers?.has(result.user_message_uuid))) {
381
409
  const turn = session.nativeTurn;
382
- if (!turn)
410
+ if (!turn) {
411
+ reportRejectedClaudeResult(session, result, 'no-active-turn');
383
412
  unavailable();
413
+ }
384
414
  if (result.user_message_uuid !== undefined)
385
415
  session.replayedSteers?.delete(result.user_message_uuid);
386
416
  session.nativeTurn = undefined;
387
417
  endTurn(session, events);
388
- awaitLateSteers(session, turn.id);
418
+ awaitLateSteers(session);
389
419
  events?.observe({
390
420
  kind: 'turn-completed',
391
421
  provider: 'claude',
@@ -396,13 +426,15 @@ export const receiveClaudeMessage = (session, raw, events) => {
396
426
  return;
397
427
  }
398
428
  const input = session.input;
399
- if (!input || input.id !== result.user_message_uuid || session.nativeTurn)
429
+ if (!input || input.id !== result.user_message_uuid || session.nativeTurn) {
430
+ reportRejectedClaudeResult(session, result, 'input-mismatch');
400
431
  unavailable();
432
+ }
401
433
  acknowledge(session, events);
402
434
  const state = toTurnState(result, input);
403
435
  session.input = undefined;
404
436
  endTurn(session, events);
405
- awaitLateSteers(session, input.id);
437
+ awaitLateSteers(session);
406
438
  const observedUsage = UsageSchema.safeParse(result.usage);
407
439
  const usage = observedUsage.success
408
440
  ? {
@@ -27,7 +27,6 @@ export type IClaudeSteer = {
27
27
  isAcknowledged: boolean;
28
28
  resolve(turnId: string): void;
29
29
  reject(error: unknown): void;
30
- timer?: ReturnType<typeof setTimeout>;
31
30
  };
32
31
  export type IClaudeSavedInput = Pick<IHistoryItem, 'kind' | 'provenance'> & (Pick<IHistoryItem, 'turnId'> | Pick<IEvidenceItem, 'reference'>);
33
32
  export type IClaudeTurn = IClaudeInput | IClaudeNativeTurn;
@@ -54,6 +53,7 @@ export type IClaudeSession = {
54
53
  input?: IClaudeInput;
55
54
  nativeTurn?: IClaudeNativeTurn;
56
55
  steers: Map<string, IClaudeSteer>;
56
+ steerReplayTimer?: ReturnType<typeof setTimeout>;
57
57
  replayedSteers?: Set<string>;
58
58
  backgroundTaskCount: number;
59
59
  fastMode?: IClaudeFastMode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jg-agent-hq",
3
- "version": "13.5.4",
3
+ "version": "13.5.6",
4
4
  "description": "Native Claude Code and Codex session control, history, usage and recoverable local storage for Node.js apps.",
5
5
  "type": "module",
6
6
  "license": "MIT",