jg-agent-hq 9.0.0 → 10.0.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.0.0
4
+
5
+ - List Claude threads from an index in last-activity order, replacing the unused index in creation order, so a page no longer sorts every transcript of the workspace, and a continuation seeks into that index instead of scanning the pages before it. Active-session reads find an observed Claude session's transcript through an index on its native ID instead of scanning every indexed transcript.
6
+ - Document `JG_AGENT_HQ_TRANSPORT_FAILED` on `request`, which a Claude history read rejects with when it can't start Claude's CLI.
7
+ - Breaking: change the storage schema in place. A database or snapshot written by 9.x is refused with `JG_AGENT_HQ_STORAGE_INVALID` naming the version that wrote it; start from a fresh state root.
8
+
3
9
  ## 9.0.0
4
10
 
5
11
  - Breaking: remove plans, collaboration, agent tools and the agent bridge. HQ no longer registers, locks or snapshots plans, runs collaboration tasks, streams or requests, starts agents from other agents, or gives the sessions it starts tools of its own. The `plan`, `thread-plan`, `collaboration` and `agent-tool` requests, the browser `plan` command and `BrowserThreadDetailSchema.plan`, the plan, collaboration and agent-tool contracts with `PlanActionScopeSchema` and `ActionPlanContextSchema`, `computePlanRevision`, `IPlanContract`, `IProviderAgentTools`, `IAgentToolDefinition`, `IAgentMcpLease`, a provider's `agentTools` and its `agentTools` capability, and the `agent-input` provenance source are gone.
@@ -94,6 +94,7 @@ export declare const createClaudeProvider: (store: IStore) => {
94
94
  * @returns One bounded native-file read through the owned worker.
95
95
  * @throws
96
96
  * - JG_AGENT_HQ_CLAUDE_FAILED: The Claude integration failed
97
+ * - JG_AGENT_HQ_TRANSPORT_FAILED: The HQ transport failed
97
98
  * - JG_AGENT_HQ_CLAUDE_HISTORY_UNAVAILABLE: The Claude history is unavailable
98
99
  * - JG_AGENT_HQ_IMAGE_UNAVAILABLE: The HQ image is unavailable
99
100
  * - JG_AGENT_HQ_STORE_FAILED: The HQ store failed
@@ -237,6 +237,7 @@ export const createClaudeProvider = (store) => {
237
237
  * @returns One bounded native-file read through the owned worker.
238
238
  * @throws
239
239
  * - JG_AGENT_HQ_CLAUDE_FAILED: The Claude integration failed
240
+ * - JG_AGENT_HQ_TRANSPORT_FAILED: The HQ transport failed
240
241
  * - JG_AGENT_HQ_CLAUDE_HISTORY_UNAVAILABLE: The Claude history is unavailable
241
242
  * - JG_AGENT_HQ_IMAGE_UNAVAILABLE: The HQ image is unavailable
242
243
  * - JG_AGENT_HQ_STORE_FAILED: The HQ store failed
@@ -120,13 +120,15 @@ export class ClaudeHistoryModel {
120
120
  const seek = continuation ? this.__parseCursor(SeekSchema, continuation) : undefined;
121
121
  if (!seek && !this.__refresh(directory, root))
122
122
  return { kind: 'indexing' };
123
+ // a row-value seek, so a continuation starts in the index rather than scanning earlier pages
124
+ const after = seek ? 'AND (updated_at, native_id) < (?, ?)' : '';
123
125
  const rows = this.__database
124
126
  .prepare(`SELECT native_id, workspace_root, identity, file_size, modified_at, byte_offset, revision,
125
127
  leaf_id, name, created_at, updated_at, supported, workspace_state FROM hq_claude_file
126
- WHERE workspace_root = ? AND workspace_state = 'matching' AND (? IS NULL OR updated_at < ? OR (updated_at = ? AND native_id < ?))
128
+ WHERE workspace_root = ? AND workspace_state = 'matching' ${after}
127
129
  AND (? IS NULL OR instr(lower(coalesce(name, '')), lower(?)) > 0)
128
130
  ORDER BY updated_at DESC, native_id DESC LIMIT ?`)
129
- .all(root, seek?.updatedAt ?? null, seek?.updatedAt ?? null, seek?.updatedAt ?? null, seek?.nativeId ?? null, command.search ?? null, command.search ?? null, command.limit + 1)
131
+ .all(root, ...(seek ? [seek.updatedAt, seek.nativeId] : []), command.search ?? null, command.search ?? null, command.limit + 1)
130
132
  .map((row) => FileRowSchema.parse(row));
131
133
  const page = rows.slice(0, command.limit);
132
134
  const last = page.at(-1);
@@ -59,6 +59,7 @@ export type IAgentHq = {
59
59
  * - JG_AGENT_HQ_ACTION_CONFLICT: The HQ action conflicts with its recorded state
60
60
  * - JG_AGENT_HQ_CODEX_FAILED: The Codex integration failed
61
61
  * - JG_AGENT_HQ_CLAUDE_FAILED: The Claude integration failed
62
+ * - JG_AGENT_HQ_TRANSPORT_FAILED: The HQ transport failed
62
63
  * - JG_AGENT_HQ_CLAUDE_HISTORY_UNAVAILABLE: The Claude history is unavailable
63
64
  * - JG_AGENT_HQ_IMAGE_UNAVAILABLE: The HQ image is unavailable
64
65
  * - JG_AGENT_HQ_PROVIDER_FAILED: The HQ provider integration failed
@@ -140,8 +140,10 @@ CREATE TABLE hq_claude_file (
140
140
  supported INTEGER NOT NULL, workspace_state TEXT NOT NULL,
141
141
  CONSTRAINT hq_pk_cf__workspace_root_native_id PRIMARY KEY (workspace_root, native_id)
142
142
  ) STRICT;
143
- CREATE INDEX hq_idx_cf__workspace_root_created_at_native_id_desc
144
- ON hq_claude_file(workspace_root, created_at DESC, native_id DESC);
143
+ -- the thread list's last-activity order, and an observed session's lookup by native ID alone
144
+ CREATE INDEX hq_idx_cf__workspace_root_updated_at_native_id_desc
145
+ ON hq_claude_file(workspace_root, updated_at DESC, native_id DESC);
146
+ CREATE INDEX hq_idx_cf__native_id_updated_at_desc ON hq_claude_file(native_id, updated_at DESC);
145
147
  CREATE TABLE hq_claude_entry (
146
148
  workspace_root TEXT NOT NULL, native_id TEXT NOT NULL, uuid TEXT NOT NULL,
147
149
  parent_uuid TEXT, turn_id TEXT NOT NULL, byte_offset INTEGER NOT NULL, byte_length INTEGER NOT NULL,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jg-agent-hq",
3
- "version": "9.0.0",
3
+ "version": "10.0.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",