jg-agent-hq 10.6.0 → 10.7.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 10.7.0
4
+
5
+ - Accept up to 16,777,216 bytes of files per input, each text file up to 262,144 bytes, up from 2,097,152 and 65,536. `capabilities.inputSchema` reports the new `maxFileBytes` and `maxTextFileBytes`.
6
+ - Carry native and IPC frames and Claude transcript records of up to 33,554,432 bytes, up from 8,388,608, so a Claude session whose transcript holds a large message, such as one with attached files, keeps its history. Claude indexing reads up to 64 MiB per batch. Every Claude history is indexed again once.
7
+ - Send a Codex message over 1,048,576 bytes as masked fragments of at most that size, so a large message never meets a WebSocket server's per-frame limit.
8
+
3
9
  ## 10.6.0
4
10
 
5
11
  - Steer a Claude session's active turn. Claude reports `steer` as supported and writes the text as a user message into the exact active turn, without interrupting it, and acknowledges the steer when Claude replays the message: 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 the message's UUID. Either replay acknowledges the steer against the turn it named. A steer never replayed fails 30 seconds after that turn ends, and one pending when the process stops fails at once. Claude used to reject `steer` as unavailable.
package/README.md CHANGED
@@ -81,7 +81,7 @@ Approval reads return indexed, cursor-paginated pending, answered and expired me
81
81
 
82
82
  Durable state includes `action.key`, which must stay private and accompany its SQLite database. Queued undelivered inputs and complete bounded final results are saved; ordinary input bodies and question answers are not.
83
83
 
84
- Text and skill inputs can attach bounded workspace files by path and media type. HQ verifies their content hashes again before queued delivery. Output schemas use native Codex turn parameters or Claude's structured-session flag; complete validated results and known token usage remain available on selected receipts after reconnect. Live previews stay bounded and explicitly mark truncation. See [file inputs and complete results](api/README.md#file-inputs-and-complete-results).
84
+ Text and skill inputs can attach up to 8 workspace files by path and media type, 16 MiB in all and 256 KiB per text file. HQ verifies their content hashes again before queued delivery. Output schemas use native Codex turn parameters or Claude's structured-session flag; complete validated results and known token usage remain available on selected receipts after reconnect. Live previews stay bounded and explicitly mark truncation. See [file inputs and complete results](api/README.md#file-inputs-and-complete-results).
85
85
 
86
86
  Use `suggest-thread-name --topic "Build usage" --state-root <directory>` for an editable label and `managed-thread-name --name build-usage --state-root <directory>` to resolve it. Creation adds a short ordinal suffix when a name is occupied. Actions and relationships retain immutable IDs.
87
87
 
package/api/README.md CHANGED
@@ -70,7 +70,7 @@ The controller exclusively creates `hq-owner.json`. A live, inactive, incomplete
70
70
 
71
71
  Codex sessions outlive the runtime, because they run in Codex's shared app-server daemon. Shutdown leaves them running: it doesn't interrupt their turns, clean their background terminals or answer a request still waiting on one, and their managed records stay bound to the stopped runtime. At startup, the next runtime rejoins each one that had no action in flight, one at a time in the background. It reads the session's state and latest turn from the daemon, binds the record to its own epoch, then joins with `thread/resume` without settings. A turn still running stays the session's active turn. A turn that finished meanwhile completes its action's receipt, without a `result`, and lets a queued entry waiting on it advance. The daemon sends a still-waiting request again on joining, and it opens as a new approval in the new epoch. A session whose latest turn isn't the one HQ recorded, because another client ran one, or that can't be read or joined, has its ownership marked uncertain for explicit recovery. A crash leaves the same bound records, so those sessions are rejoined too. A restored snapshot marks every session uncertain, so it never rejoins one. Claude sessions are processes the runtime owns: their turns stop with it, and they wait inactive for an explicit resume.
72
72
 
73
- One Codex connection carries every managed Codex session, so a message HQ can't validate never fails it. A notification about items, text deltas, token usage or a session's status that fails validation is dropped, and a session HQ controls reports a gap in its live window; a status newer than HQ knows makes the session `unknown`. A message over 8,388,608 bytes, including its continuation fragments, is skipped through its final fragment without being buffered; a request whose response was skipped fails at its 30-second deadline. A turn start, turn end or approval resolution that fails validation, or a skipped message, whose session can't be known so every session HQ controls is affected, is made up for by reading the session from the daemon, one session at a time and outside the order other sessions' events keep:
73
+ One Codex connection carries every managed Codex session, so a message HQ can't validate never fails it. A notification about items, text deltas, token usage or a session's status that fails validation is dropped, and a session HQ controls reports a gap in its live window; a status newer than HQ knows makes the session `unknown`. A message over 33,554,432 bytes, including its continuation fragments, is skipped through its final fragment without being buffered; a request whose response was skipped fails at its 30-second deadline. A turn start, turn end or approval resolution that fails validation, or a skipped message, whose session can't be known so every session HQ controls is affected, is made up for by reading the session from the daemon, one session at a time and outside the order other sessions' events keep:
74
74
 
75
75
  - a turn the saved history shows finished completes its receipt, without a `result`, and lets queued input waiting on it advance;
76
76
  - a running turn whose start was lost continues, and after a skipped message it continues watched: when Codex next reports the session neither running nor waiting while that turn is still recorded as active, the session is read as if the turn's end had been lost;
@@ -82,7 +82,7 @@ A session with an action in flight when a message is skipped, or when its turn s
82
82
 
83
83
  `requestAgentHq(stateRoot, command, signal?)` is a one-command IPC client. It verifies the private owner and socket, binds the command to the runtime epoch and checks the matching response. Cancellation closes that client's socket and reports transport failure; it never undoes an admitted action. Closing a client does not close the host. `stop` accepts a shutdown request; the SDK caller must await `runtime.closed` when it owns the runtime. The CLI confirms owner removal before reporting `state: stopped`.
84
84
 
85
- The socket accepts at most 32 simultaneous connections. Requests are bounded to 65,536 UTF-8 bytes; native and IPC response frames to 8,388,608 bytes. Structured transports reject malformed UTF-8/JSON, oversized frames and incomplete tails. Each native connection has at most 32 pending calls with a 30-second response deadline. IPC connections have a 35-second deadline. The SQLite worker bounds its queue to 128 commands, accommodating client reads, native lifecycle observations and action dispatch; collection operations remain limited to one page. Database work runs off the host event loop. The state directory is a same-user trust boundary, not a sandbox against other code running as that user.
85
+ The socket accepts at most 32 simultaneous connections. Requests are bounded to 65,536 UTF-8 bytes; native and IPC response frames to 33,554,432 bytes. HQ sends a Codex message over 1,048,576 bytes as fragments of at most that size. Structured transports reject malformed UTF-8/JSON, oversized frames and incomplete tails. Each native connection has at most 32 pending calls with a 30-second response deadline. IPC connections have a 35-second deadline. The SQLite worker bounds its queue to 128 commands, accommodating client reads, native lifecycle observations and action dispatch; collection operations remain limited to one page. Database work runs off the host event loop. The state directory is a same-user trust boundary, not a sandbox against other code running as that user.
86
86
 
87
87
  ## Provider adapters and capabilities
88
88
 
@@ -172,7 +172,7 @@ Text chunks contain at most 32,768 UTF-8 bytes and shrink when escaping or metad
172
172
 
173
173
  `HistoryItemSchema` and evidence fragments expose `provenance: { origin, source, nativeInputId, nativeInputSha256, actionId, contentBoundary: 'untrusted', grantsAuthority: false }`. Origins are operator, agent, tool, system or unknown. Native assistant/tool kinds establish only their observed category. A native user role, quoted operator text or an imported message cannot establish an operator. HQ correlates a submitted input only when its exact native message/client identity, thread/turn and `nativeInputSha256` match the acknowledged action ledger. A provider's user message carries `nativeInputSha256`, the SHA-256 of the text its native input sent: a Codex message's first text part, or a Claude record's string content or first text block, with a slash command or skill, which Claude records as command markup, read back as the `/name args` it sent. It is hashed before the parts the same input added after the text, such as a skill or attached files, and before a page cuts the text, so those messages correlate too. Programmatic host submissions have source `host-action` and unknown actor. An authenticated browser submission additionally requires the same selected thread and text fingerprint, yielding `authenticated-host-action` and operator provenance. A message without a native input identity, or whose sent text differs from the action's, stays unknown. Provenance remains historical evidence and grants no current approval, execution authority or tool permission; quotations remain inside its untrusted content boundary.
174
174
 
175
- Codex uses its native descending item API with unloaded thread metadata. It never reads Codex transcript files. Claude uses indexed current-chain byte locations, exact UUID lookups and separate bounded seeks per selected kind. Its cold index uses 16 MiB batches and a 30-second operation budget; selected evidence reads parse at most 4 MiB of records beyond the first. Continuation revalidates and rereads one bounded native page to detect content changes rather than caching transcript bodies. Work and memory per read are bounded independently of history growth; reconstructing a large body may reread that source page. No conversation-body cache is maintained.
175
+ Codex uses its native descending item API with unloaded thread metadata. It never reads Codex transcript files. Claude uses indexed current-chain byte locations, exact UUID lookups and separate bounded seeks per selected kind. Its cold index uses 64 MiB batches and a 30-second operation budget; selected evidence reads parse at most 4 MiB of records beyond the first. Continuation revalidates and rereads one bounded native page to detect content changes rather than caching transcript bodies. Work and memory per read are bounded independently of history growth; reconstructing a large body may reread that source page. No conversation-body cache is maintained.
176
176
 
177
177
  ## Native accounts and extensions
178
178
 
@@ -217,13 +217,13 @@ Managed threads expose `nativeLineage: { sessionId, parentThreadId, forkedFromId
217
217
 
218
218
  Text and native skill inputs accept optional `files: [{ path, mediaType }]`. Paths may be absolute or relative to the managed workspace and must resolve inside an operator-authorized root. HQ opens a checked regular-file descriptor, validates UTF-8 or the declared format signature, and binds the canonical path, byte count and SHA-256 before admission. It rereads and verifies that binding immediately before native delivery. Missing, changed or escaping queued files fail without sending input. Symlinks cannot redirect delivery outside the trusted roots. URLs are never fetched.
219
219
 
220
- The fixed limits are 8 references, 2,097,152 aggregate file bytes and 65,536 bytes per UTF-8 text file. Empty files, NUL-containing or invalid UTF-8 text, wrong signatures, unsupported media and oversized input are rejected. The 32,768-byte action envelope contains references, never base64. File bytes are encoded only inside the native 8 MiB frame; the file limits leave room even for worst-case JSON escaping.
220
+ The fixed limits are 8 references, 16,777,216 aggregate file bytes and 262,144 bytes per UTF-8 text file. Empty files, NUL-containing or invalid UTF-8 text, wrong signatures, unsupported media and oversized input are rejected. The 32,768-byte action envelope contains references, never base64. File bytes are encoded only inside the native 32 MiB frame; the file limits leave room even for worst-case JSON escaping.
221
221
 
222
222
  Codex supports PNG, JPEG, WebP and UTF-8 text. Images use native `image` data inputs; text files become complete text inputs labeled with their canonical path and hash. Claude supports those formats plus GIF and PDF, using native image/document blocks. Media signatures establish the declared format, not complete image/PDF validity; native decoder or model rejection remains a provider failure. `capabilities.inputSchema` includes `supportedMediaTypes`, `maxFiles`, `maxFileBytes` and `maxTextFileBytes`. Native model-specific media limitations remain native errors.
223
223
 
224
224
  Select a bounded JSON `outputSchema` in session settings or, for Codex, on a message/queue entry. Schemas are limited to 8,192 serialized UTF-8 bytes, 16 levels and 1,024 visited nodes, and must be supported by the installed Zod JSON Schema validator. External references are rejected and no remote schema is retrieved. Codex sends the selected schema as `turn/start.outputSchema`. Claude starts its owned structured process with `--json-schema`; a different schema requires close and explicit resume of the same native session. Its capability descriptor marks this as `idle-restart`.
225
225
 
226
- Selected action receipts expose nullable `result: { state, format, text, structuredOutput, isComplete, failure, usage }`. Results come from the complete native final message/result, independently of the 65,536-character history/live preview. The serialized result budget is 8,257,536 UTF-8 bytes, leaving 128 KiB of the 8 MiB IPC frame for action and transport metadata. Structured results retain the complete parsed value with `text: null`, avoiding a second escaped copy of the same JSON. This admits a 1 MiB UTF-8 result even when JSON escaping expands its content. HQ validates native structured output against the requested schema without stripping fields. Invalid or missing schema output fails the turn; oversized capture fails explicitly with no saved excerpt. Invalid but bounded JSON remains untrusted evidence in `structuredOutput`. The result is saved with native turn completion, survives a runtime restart and is omitted from action-list reads.
226
+ Selected action receipts expose nullable `result: { state, format, text, structuredOutput, isComplete, failure, usage }`. Results come from the complete native final message/result, independently of the 65,536-character history/live preview. The serialized result budget is 8,257,536 UTF-8 bytes, which leaves room in the 32 MiB IPC frame for action and transport metadata. Structured results retain the complete parsed value with `text: null`, avoiding a second escaped copy of the same JSON. This admits a 1 MiB UTF-8 result even when JSON escaping expands its content. HQ validates native structured output against the requested schema without stripping fields. Invalid or missing schema output fails the turn; oversized capture fails explicitly with no saved excerpt. Invalid but bounded JSON remains untrusted evidence in `structuredOutput`. The result is saved with native turn completion, survives a runtime restart and is omitted from action-list reads.
227
227
 
228
228
  `failure` is null or `native-error`, `invalid-structured-output`, `result-too-large`, or `missing-result`. A native turn can complete without a final assistant message; without a requested schema, that remains completed with `isComplete: false` and `missing-result`. It cannot supply a complete report. Interrupted native execution remains interrupted unless capture itself exceeds the result budget. None of these outcomes causes automatic replay.
229
229
 
@@ -233,11 +233,11 @@ Selected action receipts expose nullable `result: { state, format, text, structu
233
233
 
234
234
  Claude connects on its first read through `claude --print --input-format stream-json --output-format stream-json --verbose`. No user prompt, bare mode, permission bypass or SDK dependency is used. Runtime status reports this adapter as `idle`, `ready` or `unavailable`, with its observed CLI version. History reads start this process only until it has once started and initialized: the runtime keeps that check, so later history reads use the transcripts alone, while usage, models and other reads that use the connection still open it. This session-less process closes after 5 minutes without a read and opens again on the next read that needs it; while it is closed, status reports `idle` with the last observed version. An unavailable native lane requires restarting the host after resolving the native problem.
235
235
 
236
- The structured CLI interface has no session-history listing operation. The Claude-owned reader therefore uses direct UUID JSONL files in the native project's directory beneath `CLAUDE_CONFIG_DIR`, or the normal `.claude` directory. CLI and transcript version labels do not gate reads. Required session identity, workspace, parent links, timestamps and message roles are validated, while additive fields and mixed version labels are tolerated. Claude Code can write a hidden record, such as an attachment or a scheduled-task event, a few lines before the record it follows; the reader holds it back until that parent is indexed, and one whose parent the read doesn't reach starts a turn of its own. A message whose parent is unknown is never accepted. Encoded project keys longer than 200 characters, directory/file links, malformed required fields and records larger than 8 MiB report unavailable. Discovery never recurses into subdirectories, including excluded directories. Unsupported discovered sessions have `historyState: unavailable`; they do not prevent supported sessions from being listed.
236
+ The structured CLI interface has no session-history listing operation. The Claude-owned reader therefore uses direct UUID JSONL files in the native project's directory beneath `CLAUDE_CONFIG_DIR`, or the normal `.claude` directory. CLI and transcript version labels do not gate reads. Required session identity, workspace, parent links, timestamps and message roles are validated, while additive fields and mixed version labels are tolerated. Claude Code can write a hidden record, such as an attachment or a scheduled-task event, a few lines before the record it follows; the reader holds it back until that parent is indexed, and one whose parent the read doesn't reach starts a turn of its own. A message whose parent is unknown is never accepted. Encoded project keys longer than 200 characters, directory/file links, malformed required fields and records larger than 32 MiB report unavailable. Discovery never recurses into subdirectories, including excluded directories. Unsupported discovered sessions have `historyState: unavailable`; they do not prevent supported sessions from being listed.
237
237
 
238
238
  Discovery verifies the workspace recorded inside each transcript before returning its identity or title. A matching native directory name alone is insufficient because punctuation replacement can produce colliding directory keys, so a transcript belongs to the selected workspace once one of its records ran there: in the workspace or a subdirectory, including a removed one, whose nearest existing path ancestor resolves inside the workspace without excluded segments. A symlink escape doesn't count as inside. The session's other records may name any other folder, such as a sibling task worktree it moved into, and are listed and read with the rest. Every record must carry the session's own ID, and no record's folder, nor its nearest existing ancestor's real path, may have an excluded segment; otherwise the history is unavailable. A transcript with no record inside the workspace is omitted until one is written. If a file's workspace cannot be established, discovery reports unavailable rather than inventing an empty result.
239
239
 
240
- The existing SQLite worker incrementally records file identity, complete-line offsets, message identities and parent links. It does not save message bodies. File identity includes the current reader projection revision and a native prefix hash, so source changes invalidate the derived projection. Each worker batch inspects at most 128 directory entries and reads at most 16 MiB of new transcript bytes, one file at a time, which fits the largest record. The adapter continues batches with a host-event-loop yield between them, within a 30-second operation budget. If that budget is reached, the read reports unavailable and subsequent reads continue indexing. At most four incomplete discovery iterators remain open. Shutdown closes them. Discovery continuations use that projection without starting another directory scan; start a fresh first page to refresh discovery. A transcript whose identity, size and modification time match a projection that reached its end is neither read nor written again. Each directory scan keeps the transcripts it has seen in memory, and only a complete scan removes the others from the projection, so reads over unchanged transcripts write nothing to SQLite. No additional cache infrastructure or browser cache is used.
240
+ The existing SQLite worker incrementally records file identity, complete-line offsets, message identities and parent links. It does not save message bodies. File identity includes the current reader projection revision and a native prefix hash, so source changes invalidate the derived projection. Each worker batch inspects at most 128 directory entries and reads at most 64 MiB of new transcript bytes, one file at a time, which fits the largest record. The adapter continues batches with a host-event-loop yield between them, within a 30-second operation budget. If that budget is reached, the read reports unavailable and subsequent reads continue indexing. At most four incomplete discovery iterators remain open. Shutdown closes them. Discovery continuations use that projection without starting another directory scan; start a fresh first page to refresh discovery. A transcript whose identity, size and modification time match a projection that reached its end is neither read nor written again. Each directory scan keeps the transcripts it has seen in memory, and only a complete scan removes the others from the projection, so reads over unchanged transcripts write nothing to SQLite. No additional cache infrastructure or browser cache is used.
241
241
 
242
242
  Current-chain membership and turn starts are indexed as metadata. Ordinary item and turn continuations seek those indexes; they do not walk the full chain per page. A changed branch rebuilds membership before exposing that revision. Repeated native message identities can replace content while retaining their parent; a changed parent for the same identity is an unsupported format.
243
243
 
@@ -442,6 +442,7 @@ The operation matrix describes the implemented native interfaces and their expli
442
442
  | Claude permission requests | Claude Code 2.1.316 on 2026-11-01, in the default permission mode: a Write request carried `description`, `display_name`, `input`, `permission_suggestions`, `subtype`, `tool_name` and `tool_use_id`, and an error reply was recorded in the transcript as the tool call's failed result with the reply's text. | Fields such as `decision_reason_code` and `tool_kind` appear only in other modes, so their shape comes from the CLI's own code, not an observed request. |
443
443
  | Claude turns it starts itself | Claude Code 2.1.316 on 2026-11-01, in the auto permission mode with its input held open: when a background command finished after its turn, Claude sent `system:task_notification` and started a turn of its own, `system:init` then stream and assistant frames, ending in a `result` without `user_message_uuid`. Input written during that turn was replayed after its result as its own turn. Each HQ input's replayed message came before its turn's first stream and assistant frames. An interrupt ended such a turn with the interruption marker, then an `error_during_execution` result. `system:background_tasks_changed` listed the background commands running, and was empty once the last one ended. | The frame order is an observation of this version, not a native contract. |
444
444
  | Approvals on other clients' sessions | Codex 0.166.0 on 2026-11-01, on the shared daemon: connection A joined a thread connection B started, with `thread/resume`. When B's turn asked to run a command, the daemon sent the same approval request, with the same request ID, to both connections, and sent both `serverRequest/resolved` once B answered. | A thread only accepts `thread/resume` once its first turn has written its rollout. |
445
+ | Large file inputs | Claude Code 2.1.316 and Codex 0.166.0 on 2026-11-02. Claude took one message with a 15,814,657-byte, three-page PDF and a 262,144-byte text file, 16,076,801 bytes in all, and answered from both; its transcript held the message as a 21,355,974-byte record, which history read on a page of its own. Codex took one message with seven PNG images of about 2.4 MB each and a text file, 16,531,190 bytes in all, sent to the shared daemon in 1,048,576-byte WebSocket fragments, and answered from every image. In each session a text-only follow-up turn then completed, and its history pages and every message's item detail read. | The provider's own limits on PDF pages and image sizes were not reached. A Claude session keeps each attachment in its transcript, so it grows by the attachments' base64 size. |
445
446
  | Claude active sessions | Claude Code 2.1.310 answered `claude agents --json` in 0.16 s. Interactive entries carry `status` (`busy`, `waiting`, `idle`) and `pid`; background entries carry `id` and `state` (`blocked`). Sessions HQ starts in structured mode are listed as interactive under their HQ name and disappear after close. | The list describes running processes only; history still comes from transcripts. |
446
447
  | Host coverage | Linux x86_64 package checks passed on Node 24.15.0 and 24.22.1. Identity, native interaction and recovery ran on the floor and on 24.22.1. | No macOS host was available for this run. Windows is outside the declared host contract. |
447
448
 
@@ -1,4 +1,4 @@
1
- // serialized accounting includes escaping/identifiers and leaves space inside the 8 MiB IPC frame
1
+ // serialized accounting includes escaping/identifiers and leaves space inside the IPC frame
2
2
  const MAX_LIVE_BYTES = 4 * 1024 * 1024;
3
3
  /** Keeps a bounded presentation window until matching native history has been flushed. */
4
4
  export class LiveItems {
@@ -1,4 +1,7 @@
1
1
  import { z } from 'zod';
2
+ export declare const MAX_INPUT_FILES = 8;
3
+ export declare const MAX_INPUT_FILE_BYTES = 16777216;
4
+ export declare const MAX_TEXT_FILE_BYTES = 262144;
2
5
  export declare const InputFileSchema: z.ZodObject<{
3
6
  path: z.ZodString;
4
7
  mediaType: z.ZodEnum<{
@@ -25,6 +28,3 @@ export declare const BoundInputFileSchema: z.ZodObject<{
25
28
  bytes: z.ZodNumber;
26
29
  }, z.core.$strict>;
27
30
  export type IBoundInputFile = z.infer<typeof BoundInputFileSchema>;
28
- export declare const MAX_INPUT_FILES = 8;
29
- export declare const MAX_INPUT_FILE_BYTES = 2097152;
30
- export declare const MAX_TEXT_FILE_BYTES = 65536;
@@ -1,4 +1,12 @@
1
1
  import { z } from 'zod';
2
+ /*
3
+ * Fixed aggregate budgets leave headroom in the native 32 MiB structured frame: in the worst
4
+ * case, seven text files of characters JSON escapes six times over plus one binary file in
5
+ * base64 fill about 30 MiB of it.
6
+ */
7
+ export const MAX_INPUT_FILES = 8;
8
+ export const MAX_INPUT_FILE_BYTES = 16_777_216;
9
+ export const MAX_TEXT_FILE_BYTES = 262_144;
2
10
  // references travel over local IPC; file bytes are read only inside the trusted host
3
11
  export const InputFileSchema = z.strictObject({
4
12
  path: z.string().min(1).max(4096),
@@ -13,9 +21,5 @@ export const InputFileSchema = z.strictObject({
13
21
  });
14
22
  export const BoundInputFileSchema = InputFileSchema.extend({
15
23
  sha256: z.string().regex(/^[a-f0-9]{64}$/),
16
- bytes: z.number().int().positive().max(2_097_152),
24
+ bytes: z.number().int().positive().max(MAX_INPUT_FILE_BYTES),
17
25
  });
18
- // fixed aggregate budgets leave headroom in the native 8 MiB structured frame
19
- export const MAX_INPUT_FILES = 8;
20
- export const MAX_INPUT_FILE_BYTES = 2_097_152;
21
- export const MAX_TEXT_FILE_BYTES = 65_536;
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- // reserve 128 KiB in the 8 MiB frame for action and transport metadata
2
+ // a result keeps its 8 MiB less 128 KiB budget, which leaves room in the IPC frame for metadata
3
3
  export const MAX_RESULT_BYTES = 8_388_608 - 131_072;
4
4
  /** Rejects pathological schema depth and size before recursive library validation. */
5
5
  const boundSchema = (input) => {
@@ -1,5 +1,5 @@
1
1
  export declare const MAX_CONNECTIONS = 32;
2
2
  export declare const MAX_REQUEST_BYTES = 65536;
3
- export declare const MAX_FRAME_BYTES = 8388608;
3
+ export declare const MAX_FRAME_BYTES = 33554432;
4
4
  export declare const IPC_TIMEOUT_MS = 35000;
5
5
  export declare const CONTROL_SOCKET = "hq.sock";
@@ -1,6 +1,6 @@
1
1
  // limits bound simultaneous local clients and all buffered protocol input
2
2
  export const MAX_CONNECTIONS = 32;
3
3
  export const MAX_REQUEST_BYTES = 65_536;
4
- export const MAX_FRAME_BYTES = 8_388_608;
4
+ export const MAX_FRAME_BYTES = 33_554_432;
5
5
  export const IPC_TIMEOUT_MS = 35_000;
6
6
  export const CONTROL_SOCKET = 'hq.sock';
@@ -8,11 +8,11 @@ import { evidencePosition, buildEvidencePage, EVIDENCE_SOURCE_PAGE_SIZE, } from
8
8
  import { EntryRowSchema, EntrySeekSchema, FileRowSchema, RecordSchema, ApiRequestMetadataSchema, SeekSchema, } from './types.js';
9
9
  import { isClaudeAnswer, isClaudeCallFor, isClaudeRecordCwd, isClaudeWorkspaceCwd, openTranscript, projectDirectory, readClaudeParentUuid, toClaudeDetail, toClaudeImageData, toClaudeItem, } from './utilities.js';
10
10
  // identifies the path and record interpretation used by persisted projection entries
11
- const HISTORY_PROJECTION_VERSION = 8;
11
+ const HISTORY_PROJECTION_VERSION = 9;
12
12
  // one record, such as a tool result holding images, and an indexing read, which fits the largest
13
- const MAX_RECORD_BYTES = 8_388_608;
14
- const MAX_REFRESH_BYTES = 16_777_216;
15
- // the record bytes and serialized items of one page, which stays inside the 8 MiB IPC frame
13
+ const MAX_RECORD_BYTES = 33_554_432;
14
+ const MAX_REFRESH_BYTES = 67_108_864;
15
+ // the record bytes and serialized items of one page, which stays well inside the IPC frame
16
16
  const MAX_PAGE_BYTES = 4_194_304;
17
17
  // hidden records awaiting a parent later in the file; Claude Code writes them a few lines early
18
18
  const MAX_HELD_BACK_RECORDS = 64;
@@ -1,6 +1,7 @@
1
1
  export declare const WEBSOCKET_GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
2
2
  export declare const MAX_HANDSHAKE_BYTES = 16384;
3
3
  export declare const KEEPALIVE_INTERVAL_MS = 10000;
4
+ export declare const MAX_OUTGOING_FRAGMENT_BYTES = 1048576;
4
5
  export declare const WEBSOCKET_OPCODES: {
5
6
  readonly continuation: 0;
6
7
  readonly text: 1;
@@ -7,6 +7,11 @@ export const MAX_HANDSHAKE_BYTES = 16_384;
7
7
  * dead daemon fails that write at once; a hung one misses the pong until the next ping.
8
8
  */
9
9
  export const KEEPALIVE_INTERVAL_MS = 10_000;
10
+ /*
11
+ * The largest payload one outgoing frame carries. A larger message goes as fragments, which RFC
12
+ * 6455 requires servers to accept, so no single frame meets a server's per-frame limit.
13
+ */
14
+ export const MAX_OUTGOING_FRAGMENT_BYTES = 1_048_576;
10
15
  // RFC 6455 frame opcodes used by the daemon connection
11
16
  export const WEBSOCKET_OPCODES = {
12
17
  continuation: 0x0,
@@ -1,7 +1,7 @@
1
1
  import { createHash, randomBytes } from 'node:crypto';
2
2
  import { Exception } from 'jg-exception';
3
3
  import { MAX_FRAME_BYTES } from '../../../ipc/index.js';
4
- import { KEEPALIVE_INTERVAL_MS, MAX_HANDSHAKE_BYTES, WEBSOCKET_GUID, WEBSOCKET_OPCODES, } from './constants.js';
4
+ import { KEEPALIVE_INTERVAL_MS, MAX_HANDSHAKE_BYTES, MAX_OUTGOING_FRAGMENT_BYTES, WEBSOCKET_GUID, WEBSOCKET_OPCODES, } from './constants.js';
5
5
  /**
6
6
  * Rejects bytes that break the WebSocket contract.
7
7
  * @throws
@@ -15,13 +15,14 @@ const invalid = (cause) => {
15
15
  });
16
16
  };
17
17
  /**
18
- * Builds one final client frame, masked as RFC 6455 requires of clients.
18
+ * Builds one client frame, masked as RFC 6455 requires of clients.
19
+ * @param isFinal Whether the frame ends its message; a fragment before the last one is not.
19
20
  * @returns The complete frame bytes.
20
21
  */
21
- const encodeFrame = (opcode, payload) => {
22
+ const encodeFrame = (opcode, payload, isFinal = true) => {
22
23
  const lengthBytes = payload.length < 126 ? 0 : payload.length < 65_536 ? 2 : 8;
23
24
  const header = Buffer.alloc(2 + lengthBytes + 4);
24
- header[0] = 0x80 | opcode;
25
+ header[0] = (isFinal ? 0x80 : 0) | opcode;
25
26
  if (lengthBytes === 0)
26
27
  header[1] = 0x80 | payload.length;
27
28
  else if (lengthBytes === 2) {
@@ -39,6 +40,22 @@ const encodeFrame = (opcode, payload) => {
39
40
  masked[index] = payload[index] ^ mask[index & 3];
40
41
  return Buffer.concat([header, masked]);
41
42
  };
43
+ /**
44
+ * Builds one text message: a single final frame of at most MAX_OUTGOING_FRAGMENT_BYTES, or else a
45
+ * non-final text frame followed by continuation frames of at most that size, the last one final.
46
+ * @returns The frames' bytes, in order.
47
+ */
48
+ const encodeTextMessage = (payload) => {
49
+ if (payload.length <= MAX_OUTGOING_FRAGMENT_BYTES)
50
+ return encodeFrame(WEBSOCKET_OPCODES.text, payload);
51
+ const frames = [];
52
+ for (let start = 0; start < payload.length; start += MAX_OUTGOING_FRAGMENT_BYTES) {
53
+ const end = Math.min(start + MAX_OUTGOING_FRAGMENT_BYTES, payload.length);
54
+ const opcode = start === 0 ? WEBSOCKET_OPCODES.text : WEBSOCKET_OPCODES.continuation;
55
+ frames.push(encodeFrame(opcode, payload.subarray(start, end), end === payload.length));
56
+ }
57
+ return Buffer.concat(frames);
58
+ };
42
59
  /**
43
60
  * Speaks WebSocket over a byte stream, such as the Codex daemon's stdio proxy: an HTTP upgrade
44
61
  * with a verified accept key, masked text frames out, and bounded server frames in.
@@ -51,7 +68,7 @@ export const createWebSocketFraming = () => {
51
68
  .digest('base64');
52
69
  return {
53
70
  preamble: Buffer.from(`GET / HTTP/1.1\r\nHost: localhost\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Key: ${key}\r\nSec-WebSocket-Version: 13\r\n\r\n`, 'latin1'),
54
- encode: (message) => encodeFrame(WEBSOCKET_OPCODES.text, Buffer.from(JSON.stringify(message), 'utf8')),
71
+ encode: (message) => encodeTextMessage(Buffer.from(JSON.stringify(message), 'utf8')),
55
72
  createDecoder({ receive, reply, open, fail, discard }) {
56
73
  const chunks = [];
57
74
  let buffered = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jg-agent-hq",
3
- "version": "10.6.0",
3
+ "version": "10.7.0",
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",