jg-agent-hq 8.0.0 → 8.0.1

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,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 8.0.1
4
+
5
+ - Link a Claude message that invokes a skill or slash command to the action that sent it. Claude records the `/name args` it received as command markup, so its hash never matched the action's and a Claude reviewer's review request stayed `unknown`. `nativeInputSha256` now hashes the `/name args` the markup holds.
6
+ - Keep 7.0.0's storage schema, so databases and snapshots written by 5.x through 8.0.0 open as they are.
7
+
3
8
  ## 8.0.0
4
9
 
5
10
  - Correlate a message HQ sent with a skill or attached files, or one longer than a page keeps, with the action that sent it. Correlation hashed the message's whole presented text, which for Codex holds a `[skill]` line and its attached files after the text, and for Claude a `[Native document]` or image line, and it skipped a message a page cut, so all of them stayed `unknown`. Provenance now matches the SHA-256 of the text the native input sent, before the parts the same input added and before any cut. A Codex reviewer's review request, which always carries its skill, now reads `agent-input`.
package/api/README.md CHANGED
@@ -156,7 +156,7 @@ Threads expose native state, the live session `state` described under [session s
156
156
 
157
157
  Text chunks contain at most 32,768 UTF-8 bytes and shrink when escaping or metadata consumes the response budget. Cursors bind all query fields and the content of a partially consumed native page. Changed content, changed query scope or a changed Claude chain revision uses CURSOR_INVALID; start a fresh read rather than joining different evidence. New native pages use the provider's continuation, not an immutable transcript snapshot. Newly arriving or removed history may therefore require a fresh discovery/evidence read. Authorization is rechecked on every request before content access, and no alternate raw-file path bypasses a denial.
158
158
 
159
- `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. 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.
159
+ `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.
160
160
 
161
161
  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.
162
162
 
@@ -159,6 +159,14 @@ const toFileChange = (patch) => {
159
159
  * Presents an operator-side text record; a task notification, which the CLI doesn't show, is
160
160
  * dropped, and a `!` shell output takes its input's UUID as its call.
161
161
  */
162
+ // the `/name args` the operator typed, which Claude records as command markup, or null for other text
163
+ const readCommandText = (text) => {
164
+ const name = COMMAND.test(text) ? COMMAND_NAME.exec(text)?.[1] : undefined;
165
+ if (!name)
166
+ return null;
167
+ const args = COMMAND_ARGS.exec(text)?.[1]?.trim();
168
+ return args ? `/${name} ${args}` : `/${name}`;
169
+ };
162
170
  const toUserPresentation = (record, text) => {
163
171
  const base = { nativeType: record.type, callId: null, outcome: null, files: [] };
164
172
  if (text.startsWith('<task-notification>'))
@@ -179,22 +187,17 @@ const toUserPresentation = (record, text) => {
179
187
  text: [output[1], output[2]].filter(Boolean).join('\n'),
180
188
  callId: record.parentUuid ?? null,
181
189
  };
182
- const name = COMMAND.test(text) ? COMMAND_NAME.exec(text)?.[1] : undefined;
183
- if (name) {
184
- const args = COMMAND_ARGS.exec(text)?.[1]?.trim();
185
- return { ...base, kind: 'user-message', text: args ? `/${name} ${args}` : `/${name}` };
186
- }
187
- return { ...base, kind: 'user-message', text };
190
+ return { ...base, kind: 'user-message', text: readCommandText(text) ?? text };
188
191
  };
189
- // the text a user record's input sent: its whole content, or its first block when that is text
192
+ /*
193
+ * The text a user record's input sent: its whole content, or its first block when that is text,
194
+ * with a slash command or skill as the `/name args` that was sent, not the markup Claude records.
195
+ */
190
196
  const readInputText = (record) => {
191
197
  const content = record.message?.content;
192
- if (typeof content === 'string')
193
- return content;
194
- if (!Array.isArray(content))
195
- return null;
196
- const first = BlockSchema.safeParse(content[0]).data;
197
- return first?.type === 'text' ? (first.text ?? null) : null;
198
+ const first = Array.isArray(content) ? BlockSchema.safeParse(content[0]).data : undefined;
199
+ const text = typeof content === 'string' ? content : first?.type === 'text' ? (first.text ?? null) : null;
200
+ return text === null ? null : (readCommandText(text) ?? text);
198
201
  };
199
202
  /** Presents a native record as the CLI shows it, or null for one it leaves out. */
200
203
  const toPresentation = (record) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jg-agent-hq",
3
- "version": "8.0.0",
3
+ "version": "8.0.1",
4
4
  "description": "Native coding-agent session control, agent streams and durable collaboration for Node.js apps.",
5
5
  "type": "module",
6
6
  "license": "MIT",