jg-agent-hq 0.5.0 → 0.5.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,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.1
4
+
5
+ - Qualify Claude Code 2.1.306 history alongside 2.1.304, including transcripts spanning both versions. Continue to reject unqualified CLI and transcript versions.
6
+
3
7
  ## 0.5.0
4
8
 
5
9
  - Add safe publication observations for the host's System view, with separate pending, blocked, failed and uncertain states, timestamps and exact commit identity.
package/README.md CHANGED
@@ -39,9 +39,9 @@ The Node API exposes `createAgentHq({ stateRoot, allowedRoots })` and `requestAg
39
39
 
40
40
  The controller owns its SQLite worker and native connections independently of client connections. Private state contains the lifetime owner, Unix socket and SQLite discovery metadata. Conversation bodies remain in the native providers' storage. Browsing never resumes an external session or starts inference. Quota windows come from native account observations, with explicit stale and unavailable states.
41
41
 
42
- The current read contracts were exercised against Codex 0.163.0 and Claude Code 2.1.304 on Linux. Unsupported native responses fail explicitly. `jg-agent-hq/contracts` contains browser-safe schemas and types; importing it does not import the host runtime.
42
+ The current read contracts were exercised against Codex 0.163.0 and Claude Code versions 2.1.304 and 2.1.306 on Linux. Unsupported native responses fail explicitly. `jg-agent-hq/contracts` contains browser-safe schemas and types; importing it does not import the host runtime.
43
43
 
44
- Use `--provider claude` for Claude history and usage; the default is `codex`. Claude connects lazily through its native structured CLI, with normal settings enabled and no user prompt. Usage requests explicitly disable the optional transcript-behavior scan. Its local history reader supports the qualified 2.1.304 format only, keeps byte locations rather than conversation bodies in SQLite, and reports unsupported history as unavailable. File history cannot establish current execution state. See the [reader limits and freshness contract](api/README.md#claude-history).
44
+ Use `--provider claude` for Claude history and usage; the default is `codex`. Claude connects lazily through its native structured CLI, with normal settings enabled and no user prompt. Usage requests explicitly disable the optional transcript-behavior scan. Its local history reader accepts only the qualified 2.1.304 and 2.1.306 versions, including transcripts containing both, keeps byte locations rather than conversation bodies in SQLite, and reports unsupported history as unavailable. File history cannot establish current execution state. See the [reader limits and freshness contract](api/README.md#claude-history).
45
45
 
46
46
  Explicit actions create, name, adopt, resume and close threads; send idle messages; steer an exact running turn; queue the next message; interrupt; and answer native questions or permissions. Actions have stable UUIDs and durable receipts. Repeating the same request returns its receipt; changing that UUID's payload conflicts. A lost acknowledgement stays uncertain until the exact native response arrives or the operator makes an explicit recovery choice. HQ never resends uncertain input.
47
47
 
package/api/README.md CHANGED
@@ -48,7 +48,7 @@ Threads expose native state, `historyState` (`available` or `unavailable`), owne
48
48
 
49
49
  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. An unavailable native lane requires restarting the host after resolving the native problem.
50
50
 
51
- The qualified 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. Both CLI and versioned transcript records must match 2.1.304. Other formats, encoded project keys longer than 200 characters, directory/file links, malformed records and records larger than 1 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.
51
+ The qualified 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. The CLI and each versioned transcript record must independently match a qualified version: 2.1.304 or 2.1.306. A transcript may contain both qualified versions. Other formats, encoded project keys longer than 200 characters, directory/file links, malformed records and records larger than 1 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.
52
52
 
53
53
  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. Foreign workspaces are omitted. If a file's workspace cannot be established, discovery reports unavailable rather than inventing an empty result.
54
54
 
@@ -100,7 +100,7 @@ Prompts expose `replyActionId` as soon as a reply is admitted, so reconnecting c
100
100
 
101
101
  ### Claude native control
102
102
 
103
- Each controlled session has one persistent native `claude` process in the authorized workspace. HQ adds structured input/output, replayed user-message acknowledgements, partial-message output and `--permission-prompt-tool=stdio`. It does not set a model, replace instructions/settings, disable session persistence, bypass permissions or enable a bare mode. Native skills remain available. Control was exercised against CLI 2.1.304. Native idle initialization, session identity and matching acknowledgements establish capability; a changed version label alone does not disable compatible controls. File history retains its separate exact-version check.
103
+ Each controlled session has one persistent native `claude` process in the authorized workspace. HQ adds structured input/output, replayed user-message acknowledgements, partial-message output and `--permission-prompt-tool=stdio`. It does not set a model, replace instructions/settings, disable session persistence, bypass permissions or enable a bare mode. Native skills remain available. Control was exercised against CLI 2.1.304. Native idle initialization, session identity and matching acknowledgements establish capability; a changed version label alone does not disable compatible controls. File history retains its separate qualified-version check.
104
104
 
105
105
  Creation chooses a native UUID without inference, then names that exact session. Resume uses native `--resume` and verifies the session-id fence on the name control before marking the session idle. The operator's handoff confirmation establishes that another CLI controller is closed; file timestamps and file-backed unknown states do not establish this. Independently running CLIs are outside HQ's state-directory coordination boundary.
106
106
 
@@ -2,7 +2,7 @@ import { Exception } from 'error-message-utils';
2
2
  import { scheduler } from 'node:timers/promises';
3
3
  import { z } from 'zod';
4
4
  import { createClaudeRpc } from './rpc.js';
5
- import { CLAUDE_HISTORY_VERSION, ClaudeUsageSchema } from './types.js';
5
+ import { ClaudeHistoryVersionSchema, ClaudeUsageSchema } from './types.js';
6
6
  import { toClaudeUsageSnapshot } from './transformers.js';
7
7
  /**
8
8
  * Lazily connects read-only Claude capabilities; Codex needs no Claude installation.
@@ -61,7 +61,7 @@ export const createClaudeProvider = (store) => {
61
61
  async readHistory(command) {
62
62
  const deadline = Date.now() + 30_000;
63
63
  const native = await open();
64
- if (native.version !== CLAUDE_HISTORY_VERSION)
64
+ if (!ClaudeHistoryVersionSchema.safeParse(native.version).success)
65
65
  throw new Exception('The Claude history is unavailable', undefined, {
66
66
  kind: 'agent-unavailable',
67
67
  });
@@ -4,7 +4,7 @@ import { Exception, extractMessage, hasErrorCode } from 'error-message-utils';
4
4
  import { z } from 'zod';
5
5
  import { HqResponseSchema, } from '../../../contracts/index.js';
6
6
  import { decodeHistoryCursor, encodeHistoryCursor, } from '../../../sessions/index.js';
7
- import { CLAUDE_HISTORY_VERSION } from '../types.js';
7
+ import { ClaudeHistoryVersionSchema } from '../types.js';
8
8
  import { EntryRowSchema, EntrySeekSchema, FileRowSchema, RecordSchema, SeekSchema, } from './types.js';
9
9
  import { openTranscript, projectDirectory, toClaudeItem } from './utilities.js';
10
10
  const MAX_RECORD_BYTES = 1_048_576;
@@ -189,7 +189,7 @@ export class ClaudeHistoryModel {
189
189
  this.__unavailable();
190
190
  const record = RecordSchema.parse(JSON.parse(new TextDecoder('utf-8', { fatal: true }).decode(bytes)));
191
191
  if (record.uuid !== entry.uuid ||
192
- record.version !== CLAUDE_HISTORY_VERSION ||
192
+ !ClaudeHistoryVersionSchema.safeParse(record.version).success ||
193
193
  record.cwd !== root)
194
194
  this.__unavailable();
195
195
  const item = toClaudeItem(record, entry.turn_id);
@@ -403,14 +403,15 @@ export class ClaudeHistoryModel {
403
403
  row.name = record.customTitle;
404
404
  return;
405
405
  }
406
- if (record.version !== undefined && record.version !== CLAUDE_HISTORY_VERSION)
406
+ if (record.version !== undefined &&
407
+ !ClaudeHistoryVersionSchema.safeParse(record.version).success)
407
408
  this.__unavailable();
408
409
  if (record.isSidechain || !record.uuid)
409
410
  return;
410
411
  if ((record.type === 'user' || record.type === 'assistant') &&
411
412
  record.message?.role !== record.type)
412
413
  this.__unavailable();
413
- if (record.version !== CLAUDE_HISTORY_VERSION ||
414
+ if (!ClaudeHistoryVersionSchema.safeParse(record.version).success ||
414
415
  record.sessionId !== nativeId ||
415
416
  record.cwd !== root ||
416
417
  record.timestamp === undefined ||
@@ -1,5 +1,8 @@
1
1
  import { z } from 'zod';
2
- export declare const CLAUDE_HISTORY_VERSION = "2.1.304";
2
+ export declare const ClaudeHistoryVersionSchema: z.ZodEnum<{
3
+ "2.1.304": "2.1.304";
4
+ "2.1.306": "2.1.306";
5
+ }>;
3
6
  export declare const ClaudeInitializeSchema: z.ZodObject<{
4
7
  claude_code_version: z.ZodString;
5
8
  commands: z.ZodOptional<z.ZodUnknown>;
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- // the local reader is qualified against this exact CLI transcript capability
3
- export const CLAUDE_HISTORY_VERSION = '2.1.304';
2
+ // only explicitly qualified CLI and transcript versions may use the local reader
3
+ export const ClaudeHistoryVersionSchema = z.enum(['2.1.304', '2.1.306']);
4
4
  export const ClaudeInitializeSchema = z.object({
5
5
  claude_code_version: z.string().min(1).max(128),
6
6
  commands: z.unknown().optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jg-agent-hq",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Native coding-agent workspace primitives.",
5
5
  "type": "module",
6
6
  "license": "MIT",