@gmickel/gno 2.5.1 → 2.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.
Files changed (160) hide show
  1. package/README.md +60 -5
  2. package/assets/skill/README.md +5 -1
  3. package/assets/skill/SKILL.md +80 -4
  4. package/assets/skill/cli-reference.md +132 -2
  5. package/assets/skill/examples.md +30 -0
  6. package/assets/skill/mcp-reference.md +54 -1
  7. package/assets/skill/recipes/capture-and-file.md +6 -0
  8. package/assets/skill/recipes/memory-file-decision.md +6 -0
  9. package/assets/skill/recipes/memory-supersede-fact.md +5 -0
  10. package/assets/skill/recipes/session-evidence-lookup.md +98 -0
  11. package/assets/spa-production.json.gz +0 -0
  12. package/browser-extension/artifacts/{gno-browser-clipper-v2.5.1.zip → gno-browser-clipper-v2.7.0.zip} +0 -0
  13. package/browser-extension/artifacts/gno-browser-clipper-v2.7.0.zip.sha256 +1 -0
  14. package/browser-extension/dist/manifest.json +1 -1
  15. package/package.json +2 -1
  16. package/spec/cli.md +449 -35
  17. package/spec/mcp.md +234 -4
  18. package/spec/output-schemas/ask.schema.json +1 -1
  19. package/spec/output-schemas/capture-receipt.schema.json +4 -1
  20. package/spec/output-schemas/doctor.schema.json +88 -0
  21. package/spec/output-schemas/error.schema.json +11 -2
  22. package/spec/output-schemas/get.schema.json +1 -1
  23. package/spec/output-schemas/mcp-capture-result.schema.json +4 -2
  24. package/spec/output-schemas/memory-remember.schema.json +10 -4
  25. package/spec/output-schemas/multi-get.schema.json +4 -1
  26. package/spec/output-schemas/peek.schema.json +2 -9
  27. package/spec/output-schemas/request-status.schema.json +113 -0
  28. package/spec/output-schemas/resident-status.schema.json +22 -0
  29. package/spec/output-schemas/search-result.schema.json +1 -1
  30. package/spec/output-schemas/search-results.schema.json +1 -1
  31. package/spec/output-schemas/sessions-automation-run.schema.json +46 -0
  32. package/spec/output-schemas/sessions-discovery.schema.json +38 -0
  33. package/spec/output-schemas/sessions-import-receipt.schema.json +156 -0
  34. package/spec/output-schemas/sessions-status.schema.json +432 -0
  35. package/spec/output-schemas/status.schema.json +98 -0
  36. package/src/cli/commands/ask.ts +14 -2
  37. package/src/cli/commands/capture.ts +55 -96
  38. package/src/cli/commands/daemon.ts +41 -0
  39. package/src/cli/commands/doctor.ts +54 -20
  40. package/src/cli/commands/embed.ts +41 -3
  41. package/src/cli/commands/ls.ts +3 -0
  42. package/src/cli/commands/memory.ts +12 -3
  43. package/src/cli/commands/query.ts +5 -0
  44. package/src/cli/commands/request-status.ts +59 -0
  45. package/src/cli/commands/reset.ts +39 -5
  46. package/src/cli/commands/sessions.ts +713 -0
  47. package/src/cli/commands/shared.ts +14 -1
  48. package/src/cli/commands/status.ts +63 -5
  49. package/src/cli/commands/vec.ts +54 -0
  50. package/src/cli/detach.ts +29 -1
  51. package/src/cli/errors.ts +13 -9
  52. package/src/cli/program.ts +441 -2
  53. package/src/cli/session-binding.ts +49 -0
  54. package/src/config/types.ts +8 -0
  55. package/src/core/capture-publish.ts +239 -0
  56. package/src/core/capture-sync.ts +12 -2
  57. package/src/core/host-paths.ts +31 -0
  58. package/src/core/memory-remember.ts +234 -122
  59. package/src/core/memory-types.ts +11 -0
  60. package/src/core/network-boundary-inventory.ts +8 -0
  61. package/src/core/request-receipts.ts +671 -0
  62. package/src/core/shutdown-budget.ts +6 -0
  63. package/src/core/vector-partition-status.ts +52 -0
  64. package/src/embed/backlog.ts +124 -18
  65. package/src/embed/fingerprint.ts +6 -3
  66. package/src/embed/retry.ts +66 -27
  67. package/src/embed/variant-backlog.ts +15 -10
  68. package/src/embed/variant-retry.ts +31 -22
  69. package/src/index.ts +30 -2
  70. package/src/llm/native-worker/dispatcher.ts +2 -0
  71. package/src/llm/native-worker/embedding-identity.ts +42 -0
  72. package/src/llm/native-worker/protocol.ts +1 -0
  73. package/src/llm/types.ts +3 -0
  74. package/src/mcp/context.ts +17 -0
  75. package/src/mcp/http-egress.ts +4 -0
  76. package/src/mcp/http-transport.ts +2 -0
  77. package/src/mcp/resources/index.ts +6 -5
  78. package/src/mcp/tool-descriptions-core.ts +1 -1
  79. package/src/mcp/tools/capture.ts +87 -85
  80. package/src/mcp/tools/index.ts +77 -4
  81. package/src/mcp/tools/memory-remember.ts +8 -1
  82. package/src/mcp/tools/memory-shared.ts +7 -1
  83. package/src/mcp/tools/request-status.ts +73 -0
  84. package/src/mcp/tools/sessions.ts +208 -0
  85. package/src/mcp/tools/status.ts +4 -0
  86. package/src/pipeline/hybrid.ts +37 -7
  87. package/src/pipeline/vsearch.ts +14 -2
  88. package/src/sdk/client.ts +180 -84
  89. package/src/sdk/index.ts +6 -0
  90. package/src/sdk/types.ts +54 -2
  91. package/src/serve/capture-service.ts +98 -32
  92. package/src/serve/config-sync.ts +3 -2
  93. package/src/serve/embed-scheduler.ts +133 -19
  94. package/src/serve/host-path-redaction.ts +79 -0
  95. package/src/serve/public/app.tsx +4 -1
  96. package/src/serve/public/components/CaptureModal.tsx +26 -8
  97. package/src/serve/public/components/sessions/AutomationPanel.tsx +800 -0
  98. package/src/serve/public/components/sessions/ImportReceipt.tsx +238 -0
  99. package/src/serve/public/components/sessions/SessionSearch.tsx +286 -0
  100. package/src/serve/public/components/sessions/SourcesPanel.tsx +541 -0
  101. package/src/serve/public/components/sessions/api.ts +40 -0
  102. package/src/serve/public/globals.built.css +1 -1
  103. package/src/serve/public/hooks/use-api.ts +26 -3
  104. package/src/serve/public/lib/request-intent.ts +77 -0
  105. package/src/serve/public/lib/snippet.tsx +52 -0
  106. package/src/serve/public/lib/workspace-actions.ts +12 -1
  107. package/src/serve/public/lib/workspace-tabs.ts +2 -0
  108. package/src/serve/public/pages/Dashboard.tsx +22 -9
  109. package/src/serve/public/pages/DocView.tsx +25 -6
  110. package/src/serve/public/pages/DocumentEditor.tsx +224 -104
  111. package/src/serve/public/pages/Search.tsx +1 -41
  112. package/src/serve/public/pages/Sessions.tsx +350 -0
  113. package/src/serve/resident-runtime.ts +69 -4
  114. package/src/serve/resident-status.ts +13 -1
  115. package/src/serve/routes/api.ts +476 -147
  116. package/src/serve/routes/sessions.ts +766 -0
  117. package/src/serve/security.ts +9 -0
  118. package/src/serve/server.ts +215 -10
  119. package/src/serve/session-automation.ts +146 -0
  120. package/src/serve/status-model.ts +16 -0
  121. package/src/serve/status.ts +2 -0
  122. package/src/serve/watch-reconciliation-shared.ts +3 -0
  123. package/src/serve/watch-service-events.ts +3 -2
  124. package/src/serve/watch-service-run-flush.ts +35 -2
  125. package/src/serve/watch-service.ts +5 -0
  126. package/src/sessions/archive.ts +348 -0
  127. package/src/sessions/automation-state.ts +444 -0
  128. package/src/sessions/automation-status.ts +239 -0
  129. package/src/sessions/automation.ts +1169 -0
  130. package/src/sessions/binding.ts +105 -0
  131. package/src/sessions/claude-hook.ts +240 -0
  132. package/src/sessions/config.ts +176 -0
  133. package/src/sessions/format.ts +191 -0
  134. package/src/sessions/import-child-env.ts +8 -0
  135. package/src/sessions/import-child.ts +152 -0
  136. package/src/sessions/parsers/claude-code.ts +259 -0
  137. package/src/sessions/parsers/codex.ts +303 -0
  138. package/src/sessions/parsers/hermes.ts +248 -0
  139. package/src/sessions/parsers/openclaw.ts +496 -0
  140. package/src/sessions/parsers/shared.ts +184 -0
  141. package/src/sessions/sanitize.ts +222 -0
  142. package/src/sessions/service.ts +1533 -0
  143. package/src/sessions/setup.ts +477 -0
  144. package/src/sessions/sources.ts +518 -0
  145. package/src/sessions/state.ts +118 -0
  146. package/src/sessions/types.ts +457 -0
  147. package/src/store/migrations/031-runtime-independent-vectors.ts +29 -0
  148. package/src/store/migrations/032-vector-runtime-callers.ts +17 -0
  149. package/src/store/migrations/index.ts +4 -0
  150. package/src/store/sqlite/adapter.ts +76 -16
  151. package/src/store/sqlite/scoped-index.ts +9 -0
  152. package/src/store/types.ts +11 -1
  153. package/src/store/vector/lazy.ts +46 -43
  154. package/src/store/vector/runtime-compat.ts +651 -0
  155. package/src/store/vector/sqlite-vec.ts +20 -2
  156. package/src/store/vector/status.ts +276 -35
  157. package/src/store/vector/types.ts +2 -0
  158. package/src/store/vector/variant-search.ts +71 -23
  159. package/src/store/vector/variants.ts +49 -14
  160. package/browser-extension/artifacts/gno-browser-clipper-v2.5.1.zip.sha256 +0 -1
@@ -9,7 +9,11 @@ import type { Collection, Config } from "../../config/types";
9
9
  import type { SyncResult } from "../../ingestion";
10
10
  import type { SearchResults } from "../../pipeline/types";
11
11
 
12
- import { decorateUriForIndex, getIndexDbPath } from "../../app/constants";
12
+ import {
13
+ DEFAULT_INDEX_NAME,
14
+ decorateUriForIndex,
15
+ getIndexDbPath,
16
+ } from "../../app/constants";
13
17
  import {
14
18
  getConfigPaths,
15
19
  isInitialized,
@@ -17,6 +21,7 @@ import {
17
21
  writeConfigWarningsToStderr,
18
22
  } from "../../config";
19
23
  import { SqliteAdapter } from "../../store/sqlite/adapter";
24
+ import { assertCliSessionBinding } from "../session-binding";
20
25
 
21
26
  /**
22
27
  * Result of CLI store initialization.
@@ -90,6 +95,14 @@ export async function initStore(
90
95
  };
91
96
  }
92
97
 
98
+ // Every index a command opens (including one named by a `?index=` URI)
99
+ // honours the session-archive config/index binding.
100
+ await assertCliSessionBinding(
101
+ options.configPath,
102
+ options.indexName ?? DEFAULT_INDEX_NAME,
103
+ config
104
+ );
105
+
93
106
  // Ensure data directory exists (may have been deleted by reset)
94
107
  const { ensureDirectories } = await import("../../config");
95
108
  await ensureDirectories();
@@ -8,6 +8,7 @@
8
8
  import type { ContentTypeBoostStatus } from "../../config/content-types";
9
9
  import type { ActivationStatus } from "../../core/activation-status";
10
10
  import type { MemoryStatus } from "../../core/memory-diagnostics";
11
+ import type { BackgroundIssue } from "../../serve/status-model";
11
12
  import type { IndexStatus } from "../../store/types";
12
13
 
13
14
  import { getIndexDbPath, getModelsCachePath } from "../../app/constants";
@@ -24,11 +25,18 @@ import {
24
25
  buildMemoryStatus,
25
26
  formatMemoryStatusLines,
26
27
  } from "../../core/memory-diagnostics";
28
+ import { formatVectorPartitionLines } from "../../core/vector-partition-status";
27
29
  import { ModelCache } from "../../llm/cache";
28
30
  import { getActivePreset, resolveModelUri } from "../../llm/registry";
29
31
  import { getConnectorVerificationTargets } from "../../serve/connectors";
30
32
  import { createStandaloneResidentStatus } from "../../serve/resident-status";
31
33
  import { SqliteAdapter } from "../../store/sqlite/adapter";
34
+ import {
35
+ formatBackgroundIssue,
36
+ residentIssues,
37
+ resolveProcessPaths,
38
+ statusProcess,
39
+ } from "../detach";
32
40
 
33
41
  /**
34
42
  * Options for status command.
@@ -54,9 +62,35 @@ export type StatusResult =
54
62
  activation: ActivationStatus;
55
63
  contentTypeBoost: ContentTypeBoostStatus;
56
64
  memory: MemoryStatus;
65
+ backgroundIssues: ResidentBackgroundIssue[];
57
66
  }
58
67
  | { success: false; error: string };
59
68
 
69
+ /** A background issue reported by (or about) a running detached resident. */
70
+ export type ResidentBackgroundIssue = BackgroundIssue & {
71
+ process: "serve" | "daemon";
72
+ pid: number;
73
+ };
74
+
75
+ /**
76
+ * Ask each detached resident for its background issues. Each request is
77
+ * bounded (500ms), so a hung resident is reported, never waited on.
78
+ */
79
+ async function collectResidentIssues(): Promise<ResidentBackgroundIssue[]> {
80
+ const statuses = await Promise.all(
81
+ (["serve", "daemon"] as const).map((kind) =>
82
+ statusProcess({ kind, ...resolveProcessPaths(kind) })
83
+ )
84
+ );
85
+ return statuses.flatMap((processStatus) =>
86
+ residentIssues(processStatus).map((issue) => ({
87
+ process: processStatus.cmd,
88
+ pid: processStatus.pid ?? 0,
89
+ ...issue,
90
+ }))
91
+ );
92
+ }
93
+
60
94
  function connectorProjectionLine(activation: ActivationStatus): string | null {
61
95
  const { projected, total, truncated } = activation.connectorProjection;
62
96
  if (!truncated) {
@@ -117,6 +151,12 @@ function formatTerminal(
117
151
  if (indexStatus.embeddingBacklog > 0) {
118
152
  lines.push(`Embedding backlog: ${indexStatus.embeddingBacklog} chunks`);
119
153
  }
154
+ lines.push(
155
+ ...formatVectorPartitionLines(
156
+ indexStatus.vectorPartitions,
157
+ indexStatus.vectorRuntime
158
+ )
159
+ );
120
160
 
121
161
  const chunking = formatChunkingStatus(indexStatus.chunking);
122
162
  if (chunking) lines.push(chunking);
@@ -205,6 +245,11 @@ function formatMarkdown(
205
245
  lines.push(`- **Documents**: ${indexStatus.activeDocuments}`);
206
246
  lines.push(`- **Chunks**: ${indexStatus.totalChunks}`);
207
247
  lines.push(`- **Embedding backlog**: ${indexStatus.embeddingBacklog}`);
248
+ for (const line of formatVectorPartitionLines(
249
+ indexStatus.vectorPartitions,
250
+ indexStatus.vectorRuntime
251
+ ))
252
+ lines.push(`- ${line.trim()}`);
208
253
  if (indexStatus.typedMetadata)
209
254
  lines.push(
210
255
  `- **Typed metadata**: ${indexStatus.typedMetadata.pending} pending sync, ${indexStatus.typedMetadata.invalid} invalid`
@@ -318,6 +363,7 @@ export async function status(
318
363
  activation,
319
364
  contentTypeBoost: buildContentTypeBoostStatus(config.contentTypes ?? []),
320
365
  memory: await buildMemoryStatus(store, config.collections),
366
+ backgroundIssues: await collectResidentIssues(),
321
367
  };
322
368
  } finally {
323
369
  await store.close();
@@ -356,6 +402,8 @@ export function formatStatus(
356
402
  totalDocuments: s.activeDocuments,
357
403
  totalChunks: s.totalChunks,
358
404
  embeddingBacklog: s.embeddingBacklog,
405
+ vectorPartitions: s.vectorPartitions,
406
+ vectorRuntime: s.vectorRuntime,
359
407
  typedMetadata: s.typedMetadata,
360
408
  chunking: s.chunking,
361
409
  lastUpdated: s.lastUpdatedAt,
@@ -363,6 +411,9 @@ export function formatStatus(
363
411
  contentTypeBoost: result.contentTypeBoost,
364
412
  activation: result.activation,
365
413
  memory: result.memory,
414
+ ...(result.backgroundIssues.length
415
+ ? { backgroundIssues: result.backgroundIssues }
416
+ : {}),
366
417
  },
367
418
  null,
368
419
  2
@@ -378,10 +429,17 @@ export function formatStatus(
378
429
  );
379
430
  }
380
431
 
381
- return formatTerminal(
382
- result.status,
383
- result.activation,
384
- result.contentTypeBoost,
385
- result.memory
432
+ const issueLines = result.backgroundIssues.map(
433
+ (issue) =>
434
+ ` ${issue.process} (pid ${issue.pid}): ${formatBackgroundIssue(issue)}`
386
435
  );
436
+ return [
437
+ formatTerminal(
438
+ result.status,
439
+ result.activation,
440
+ result.contentTypeBoost,
441
+ result.memory
442
+ ),
443
+ ...(issueLines.length ? ["", "Background issues:", ...issueLines] : []),
444
+ ].join("\n");
387
445
  }
@@ -13,6 +13,10 @@ import {
13
13
  createVectorIndexPort,
14
14
  createVectorStatsPort,
15
15
  } from "../../store/vector";
16
+ import {
17
+ dropVectorPartition,
18
+ type VectorPartitionStatus,
19
+ } from "../../store/vector/status";
16
20
 
17
21
  // ─────────────────────────────────────────────────────────────────────────────
18
22
  // Types
@@ -294,3 +298,53 @@ export function formatVecRebuild(
294
298
 
295
299
  return `Vec index rebuilt: ${result.count.toLocaleString()} vectors`;
296
300
  }
301
+
302
+ export type VecDropResult =
303
+ | { success: true; partition: VectorPartitionStatus }
304
+ | { success: false; error: string };
305
+
306
+ /**
307
+ * Drop an abandoned vector partition (shadow or legacy). Active partitions
308
+ * that retrieval uses are refused.
309
+ */
310
+ export async function vecDrop(
311
+ partition: string,
312
+ options: VecOptions = {}
313
+ ): Promise<VecDropResult> {
314
+ if (!(await isInitialized(options.configPath)))
315
+ return { success: false, error: "GNO not initialized. Run: gno init" };
316
+ const configResult = await loadConfig(options.configPath);
317
+ if (!configResult.ok)
318
+ return { success: false, error: configResult.error.message };
319
+ const store = new SqliteAdapter();
320
+ const openResult = await store.open(
321
+ getIndexDbPath(options.indexName),
322
+ configResult.value.ftsTokenizer,
323
+ configResult.value.busyTimeoutMs
324
+ );
325
+ if (!openResult.ok)
326
+ return { success: false, error: openResult.error.message };
327
+ try {
328
+ const dropped = await dropVectorPartition(store.getRawDb(), partition);
329
+ return dropped.ok
330
+ ? { success: true, partition: dropped.partition }
331
+ : { success: false, error: dropped.error };
332
+ } finally {
333
+ await store.close();
334
+ }
335
+ }
336
+
337
+ export function formatVecDrop(
338
+ result: VecDropResult,
339
+ options: { json?: boolean }
340
+ ): string {
341
+ if (!result.success) {
342
+ return options.json
343
+ ? JSON.stringify({ error: { code: "RUNTIME", message: result.error } })
344
+ : `Error: ${result.error}`;
345
+ }
346
+ const { partition } = result;
347
+ return options.json
348
+ ? JSON.stringify({ dropped: partition }, null, 2)
349
+ : `Dropped ${partition.state} partition ${partition.id.slice(0, 12)} (${partition.provenance}, ${partition.owners} chunks)`;
350
+ }
package/src/cli/detach.ts CHANGED
@@ -20,7 +20,7 @@ import { mkdir, stat, unlink } from "node:fs/promises";
20
20
  // node:path — no Bun path utils.
21
21
  import { dirname, join } from "node:path";
22
22
 
23
- import type { ResidentStatus } from "../serve/status-model";
23
+ import type { BackgroundIssue, ResidentStatus } from "../serve/status-model";
24
24
 
25
25
  import { VERSION, resolveDirs } from "../app/constants";
26
26
  import { toAbsolutePath } from "../config/paths";
@@ -840,6 +840,34 @@ export async function statusProcess(
840
840
  };
841
841
  }
842
842
 
843
+ /** Issues a running detached resident reports, or that it failed to answer at all. */
844
+ export function residentIssues(status: ProcessStatus): BackgroundIssue[] {
845
+ if (!status.running) return [];
846
+ if (!status.resident)
847
+ return [
848
+ {
849
+ job: "resident",
850
+ state: "unresponsive",
851
+ consecutiveFailures: 0,
852
+ runningSeconds: null,
853
+ },
854
+ ];
855
+ return status.resident.backgroundIssues ?? [];
856
+ }
857
+
858
+ export function formatBackgroundIssue(issue: BackgroundIssue): string {
859
+ switch (issue.state) {
860
+ case "unresponsive":
861
+ return "resident did not answer its status request within 500ms (busy or hung)";
862
+ case "failing":
863
+ return `background embed failing (${issue.consecutiveFailures} failed passes in a row; details in the log)`;
864
+ case "parked":
865
+ return `background embed parked after ${issue.consecutiveFailures} failed passes; pending chunks wait for new changes or \`gno embed\``;
866
+ case "overrunning":
867
+ return `background embed pass running for ${issue.runningSeconds ?? 0}s`;
868
+ }
869
+ }
870
+
843
871
  /**
844
872
  * Inspect the pid-file for a "live-foreign" signal — a live pid whose
845
873
  * recorded gno version disagrees with the currently running binary. Returns
package/src/cli/errors.ts CHANGED
@@ -9,15 +9,19 @@
9
9
  // Error Types
10
10
  // ─────────────────────────────────────────────────────────────────────────────
11
11
 
12
- export type CliErrorCode =
13
- | "VALIDATION"
14
- | "RUNTIME"
15
- | "NOT_RUNNING"
16
- | "BUSY"
17
- | "AUDIT_FINDINGS"
18
- | "AUDIT_PARTIAL"
19
- | "CONTEXT_STALE"
20
- | "CONTEXT_CONFLICT";
12
+ /** Every code the CLI error model can emit; `error.schema.json` must list each. */
13
+ export const CLI_ERROR_CODES = [
14
+ "VALIDATION",
15
+ "RUNTIME",
16
+ "NOT_RUNNING",
17
+ "BUSY",
18
+ "AUDIT_FINDINGS",
19
+ "AUDIT_PARTIAL",
20
+ "CONTEXT_STALE",
21
+ "CONTEXT_CONFLICT",
22
+ ] as const;
23
+
24
+ export type CliErrorCode = (typeof CLI_ERROR_CODES)[number];
21
25
 
22
26
  export interface CliErrorOptions {
23
27
  details?: Record<string, unknown>;