@gmickel/gno 2.10.1 → 2.12.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 (112) hide show
  1. package/README.md +11 -11
  2. package/assets/skill/SKILL.md +27 -15
  3. package/assets/skill/cli-reference.md +6 -5
  4. package/assets/skill/examples.md +16 -12
  5. package/assets/skill/mcp-reference.md +2 -1
  6. package/assets/spa-production.json.gz +0 -0
  7. package/browser-extension/artifacts/{gno-browser-clipper-v2.10.1.zip → gno-browser-clipper-v2.12.0.zip} +0 -0
  8. package/browser-extension/artifacts/gno-browser-clipper-v2.12.0.zip.sha256 +1 -0
  9. package/browser-extension/dist/manifest.json +1 -1
  10. package/package.json +10 -5
  11. package/spec/cli.md +127 -35
  12. package/spec/evals-agentic.md +3 -1
  13. package/spec/mcp.md +36 -6
  14. package/spec/output-schemas/ask.schema.json +8 -0
  15. package/spec/output-schemas/claim-verification.schema.json +8 -2
  16. package/spec/output-schemas/context-capsule-v1.schema.json +6 -1
  17. package/spec/output-schemas/context-capsule-verification.schema.json +4 -2
  18. package/spec/output-schemas/get.schema.json +4 -0
  19. package/spec/output-schemas/metadata-summary.schema.json +60 -0
  20. package/spec/output-schemas/multi-get.schema.json +4 -0
  21. package/spec/output-schemas/search-result.schema.json +4 -0
  22. package/spec/output-schemas/search-results.schema.json +4 -0
  23. package/spec/output-schemas/status.schema.json +28 -0
  24. package/src/app/constants.ts +16 -0
  25. package/src/app/context-agent-projection.ts +10 -1
  26. package/src/app/context-format.ts +1 -0
  27. package/src/app/verified-ask.ts +2 -0
  28. package/src/cli/commands/agents/block.ts +10 -9
  29. package/src/cli/commands/agents/commands.ts +6 -5
  30. package/src/cli/commands/agents/engine.ts +15 -2
  31. package/src/cli/commands/agents/harnesses.ts +21 -14
  32. package/src/cli/commands/ask-format.ts +18 -1
  33. package/src/cli/commands/ask.ts +4 -5
  34. package/src/cli/commands/cleanup.ts +46 -6
  35. package/src/cli/commands/collection/remove.ts +1 -0
  36. package/src/cli/commands/collection/rename.ts +1 -0
  37. package/src/cli/commands/daemon.ts +5 -1
  38. package/src/cli/commands/doctor.ts +37 -0
  39. package/src/cli/commands/get.ts +11 -1
  40. package/src/cli/commands/mcp/paths.ts +2 -1
  41. package/src/cli/commands/metadata.ts +79 -0
  42. package/src/cli/commands/multi-get.ts +13 -0
  43. package/src/cli/commands/setup-semantic.ts +6 -1
  44. package/src/cli/commands/shared.ts +35 -8
  45. package/src/cli/commands/skill/paths.ts +20 -2
  46. package/src/cli/commands/status.ts +89 -15
  47. package/src/cli/format/search-results.ts +11 -0
  48. package/src/cli/options.ts +2 -0
  49. package/src/cli/program.ts +64 -3
  50. package/src/core/activation-probe-plan.ts +0 -1
  51. package/src/core/config-mutation.ts +72 -55
  52. package/src/core/context-capsule-schema.ts +2 -0
  53. package/src/core/context-capsule-verification.ts +2 -0
  54. package/src/core/context-compiler.ts +2 -5
  55. package/src/core/context-evidence.ts +1 -0
  56. package/src/core/context-verifier.ts +14 -1
  57. package/src/core/memory-remember.ts +0 -1
  58. package/src/core/metadata-discovery.ts +169 -0
  59. package/src/core/module-path.ts +33 -0
  60. package/src/core/runtime-entrypoint.ts +3 -1
  61. package/src/ingestion/file-processor.ts +6 -3
  62. package/src/ingestion/prepare-file.ts +14 -4
  63. package/src/ingestion/source-availability/root.ts +138 -0
  64. package/src/ingestion/sync.ts +35 -1
  65. package/src/ingestion/walker.ts +11 -3
  66. package/src/llm/native-worker/client.ts +8 -4
  67. package/src/llm/native-worker/errors.ts +26 -3
  68. package/src/mcp/http-egress.ts +1 -0
  69. package/src/mcp/http-transport.ts +7 -2
  70. package/src/mcp/server.ts +3 -0
  71. package/src/mcp/tool-descriptions-core.ts +3 -3
  72. package/src/mcp/tool-profile.ts +16 -1
  73. package/src/mcp/tools/get.ts +10 -0
  74. package/src/mcp/tools/index.ts +68 -4
  75. package/src/mcp/tools/multi-get.ts +15 -0
  76. package/src/mcp/tools/query.ts +5 -3
  77. package/src/mcp/tools/search.ts +5 -3
  78. package/src/mcp/tools/status.ts +17 -2
  79. package/src/mcp/tools/vsearch.ts +5 -3
  80. package/src/mcp/tools/workspace-write.ts +42 -34
  81. package/src/pipeline/answer-prompt.ts +15 -2
  82. package/src/pipeline/answer.ts +3 -0
  83. package/src/pipeline/claim-verification-schema.ts +6 -1
  84. package/src/pipeline/claim-verification.ts +54 -1
  85. package/src/pipeline/explain.ts +1 -1
  86. package/src/pipeline/fusion.ts +24 -4
  87. package/src/pipeline/hybrid.ts +5 -1
  88. package/src/pipeline/query-snippet.ts +266 -0
  89. package/src/pipeline/result-context.ts +29 -0
  90. package/src/pipeline/search.ts +154 -20
  91. package/src/pipeline/types.ts +4 -0
  92. package/src/pipeline/vsearch.ts +5 -1
  93. package/src/sdk/client.ts +46 -6
  94. package/src/sdk/documents.ts +5 -0
  95. package/src/sdk/types.ts +11 -1
  96. package/src/serve/public/components/ThoroughnessSelector.tsx +1 -1
  97. package/src/serve/public/globals.built.css +1 -1
  98. package/src/serve/public/pages/Collections.tsx +8 -0
  99. package/src/serve/public/pages/Search.tsx +9 -1
  100. package/src/serve/resident-request.ts +8 -0
  101. package/src/serve/resident-runtime.ts +25 -3
  102. package/src/serve/routes/api.ts +29 -1
  103. package/src/serve/server.ts +12 -0
  104. package/src/serve/spa-production-build.ts +7 -3
  105. package/src/serve/status-model.ts +2 -0
  106. package/src/serve/status.ts +29 -0
  107. package/src/sessions/config-refresh.ts +6 -0
  108. package/src/sessions/import-child.ts +4 -1
  109. package/src/store/sqlite/adapter.ts +241 -20
  110. package/src/store/types.ts +61 -7
  111. package/src/store/vector/variant-search.ts +112 -74
  112. package/browser-extension/artifacts/gno-browser-clipper-v2.10.1.zip.sha256 +0 -1
package/src/sdk/client.ts CHANGED
@@ -78,6 +78,7 @@ import {
78
78
  refreshContextFile,
79
79
  } from "../app/compiled-context-files";
80
80
  import {
81
+ decorateResultUris,
81
82
  decorateUriForIndex,
82
83
  DEFAULT_INDEX_NAME,
83
84
  getIndexDbPath,
@@ -140,6 +141,7 @@ import {
140
141
  type MemoryErrorCode,
141
142
  MemoryService,
142
143
  } from "../core/memory";
144
+ import { readMetadataSummary } from "../core/metadata-discovery";
143
145
  import { resolveNoteCreatePlan } from "../core/note-creation";
144
146
  import { resolveNotePreset } from "../core/note-presets";
145
147
  import {
@@ -187,6 +189,7 @@ import {
187
189
  withContentTypeRules,
188
190
  } from "../ingestion";
189
191
  import { updateFrontmatterTags } from "../ingestion/frontmatter";
192
+ import { withCollectionRootErrors } from "../ingestion/source-availability/root";
190
193
  import {
191
194
  withInferenceScope,
192
195
  finishInferenceCleanup,
@@ -208,7 +211,10 @@ import { runAutomationProfile } from "../sessions/automation";
208
211
  import { assertSessionBinding } from "../sessions/binding";
209
212
  import { SessionsService } from "../sessions/service";
210
213
  import { SESSIONS_VALIDATION_CODES, SessionsError } from "../sessions/types";
211
- import { SqliteAdapter } from "../store/sqlite/adapter";
214
+ import {
215
+ SqliteAdapter,
216
+ staleCollectionsMessage,
217
+ } from "../store/sqlite/adapter";
212
218
  import { openScopedIndexStore } from "../store/sqlite/scoped-index";
213
219
  import { createVectorIndexPort } from "../store/vector";
214
220
  import {
@@ -460,6 +466,14 @@ class GnoClientImpl implements GnoClient {
460
466
  if (!this.isOpen()) {
461
467
  throw sdkError("RUNTIME", "GNO client is closed");
462
468
  }
469
+ // Another client may have indexed a collection this config omits since
470
+ // this one opened; never read it.
471
+ const stale = this.store.staleIndexedCollections(
472
+ this.config.collections.map(({ name }) => name)
473
+ );
474
+ if (stale.length > 0) {
475
+ throw sdkError("RUNTIME", staleCollectionsMessage(stale));
476
+ }
463
477
  }
464
478
 
465
479
  private getCollections(collection?: string) {
@@ -701,10 +715,9 @@ class GnoClientImpl implements GnoClient {
701
715
  private decorateSearchResults(results: SearchResults): SearchResults {
702
716
  return {
703
717
  ...results,
704
- results: results.results.map((result) => ({
705
- ...result,
706
- uri: decorateUriForIndex(result.uri, this.indexName),
707
- })),
718
+ results: results.results.map((result) =>
719
+ decorateResultUris(result, this.indexName)
720
+ ),
708
721
  };
709
722
  }
710
723
 
@@ -1415,6 +1428,14 @@ class GnoClientImpl implements GnoClient {
1415
1428
  const decorated = {
1416
1429
  ...result,
1417
1430
  uri: decorateUriForIndex(result.uri, scoped.indexName),
1431
+ ...(result.supersededBy
1432
+ ? {
1433
+ supersededBy: decorateUriForIndex(
1434
+ result.supersededBy,
1435
+ scoped.indexName
1436
+ ),
1437
+ }
1438
+ : {}),
1418
1439
  };
1419
1440
  const traceMetadata = getRetrievalTraceMetadata(result);
1420
1441
  if (traceMetadata) {
@@ -1458,6 +1479,14 @@ class GnoClientImpl implements GnoClient {
1458
1479
  documents: result.documents.map((doc) => ({
1459
1480
  ...doc,
1460
1481
  uri: decorateUriForIndex(doc.uri, scoped.indexName),
1482
+ ...(doc.supersededBy
1483
+ ? {
1484
+ supersededBy: decorateUriForIndex(
1485
+ doc.supersededBy,
1486
+ scoped.indexName
1487
+ ),
1488
+ }
1489
+ : {}),
1461
1490
  })),
1462
1491
  };
1463
1492
  } finally {
@@ -1477,6 +1506,17 @@ class GnoClientImpl implements GnoClient {
1477
1506
  };
1478
1507
  }
1479
1508
 
1509
+ async listMetadata(options: { collection?: string; values?: number } = {}) {
1510
+ this.assertOpen();
1511
+ try {
1512
+ return await readMetadataSummary(this.store, options);
1513
+ } catch (cause) {
1514
+ if (cause instanceof RangeError)
1515
+ throw sdkError("VALIDATION", cause.message);
1516
+ throw cause;
1517
+ }
1518
+ }
1519
+
1480
1520
  async changes(
1481
1521
  options: ListKnowledgeChangesInput = {}
1482
1522
  ): Promise<KnowledgeChangesResult> {
@@ -1513,7 +1553,7 @@ class GnoClientImpl implements GnoClient {
1513
1553
  })
1514
1554
  );
1515
1555
  return {
1516
- ...status,
1556
+ ...(await withCollectionRootErrors(status, this.config.collections)),
1517
1557
  contentTypeBoost: buildContentTypeBoostStatus(
1518
1558
  this.config.contentTypes ?? []
1519
1559
  ),
@@ -30,6 +30,7 @@ import {
30
30
  evidenceFromExactDocument,
31
31
  RetrievalTraceSession,
32
32
  } from "../core/retrieval-trace-session";
33
+ import { supersedingUri } from "../pipeline/result-context";
33
34
  import { sdkError } from "./errors";
34
35
 
35
36
  const URI_PREFIX_PATTERN = /^gno:\/\/[^/]+\//;
@@ -177,6 +178,8 @@ export async function getDocumentByRef(
177
178
  options: GnoGetOptions = {}
178
179
  ): Promise<GetResponse> {
179
180
  const response = await getDocumentByRefUntraced(store, config, ref, options);
181
+ const successor = await supersedingUri(store, response.uri);
182
+ if (successor) response.supersededBy = successor;
180
183
  if (!options.traceId) return response;
181
184
  const resumed = await RetrievalTraceSession.resume({
182
185
  store,
@@ -325,7 +328,9 @@ export async function multiGetDocuments(
325
328
  );
326
329
  const coll = config.collections.find((c) => c.name === doc.collection);
327
330
  const sourceRelPath = doc.recordSourcePath ?? doc.relPath;
331
+ const successor = await supersedingUri(store, doc.uri);
328
332
  documents.push({
333
+ ...(successor ? { supersededBy: successor } : {}),
329
334
  docid: doc.docid,
330
335
  uri: doc.uri,
331
336
  title: doc.title ?? undefined,
package/src/sdk/types.ts CHANGED
@@ -90,6 +90,7 @@ import type {
90
90
  SectionTargetV1,
91
91
  } from "../core/sections";
92
92
  import type { SyncResult } from "../ingestion";
93
+ import type { CollectionRootError } from "../ingestion/source-availability/root";
93
94
  import type { DownloadPolicy } from "../llm/policy";
94
95
  import type {
95
96
  AskOptions,
@@ -193,7 +194,11 @@ export type GnoVectorSearchOptions = Omit<
193
194
  export type GnoContextInput = Omit<ContextCapsuleBuildInput, "indexName"> &
194
195
  GnoProjectHintOptions;
195
196
  export type GnoContextResult = ContextCapsuleV1;
196
- export type GnoIndexStatus = IndexStatus & {
197
+ export type GnoIndexStatus = Omit<IndexStatus, "collections"> & {
198
+ /** `rootError` is set while a collection's folder is missing or unreadable. */
199
+ collections: Array<
200
+ IndexStatus["collections"][number] & { rootError?: CollectionRootError }
201
+ >;
197
202
  contentTypeBoost: ContentTypeBoostStatus;
198
203
  };
199
204
  export type GnoContextVerificationResult = ContextCapsuleVerification;
@@ -394,6 +399,11 @@ export interface GnoClient {
394
399
  list(
395
400
  options?: GnoListOptions
396
401
  ): Promise<import("../cli/commands/ls").LsResponse>;
402
+ /** Typed metadata keys with types, document counts and common values. */
403
+ listMetadata(options?: {
404
+ collection?: string;
405
+ values?: number;
406
+ }): Promise<import("../core/metadata-discovery").MetadataSummary>;
397
407
  changes(options?: ListKnowledgeChangesInput): Promise<KnowledgeChangesResult>;
398
408
  diff(ref: string, changeId?: string): Promise<KnowledgeDiffResult>;
399
409
  impact(
@@ -29,7 +29,7 @@ interface Option {
29
29
  }
30
30
 
31
31
  const options: Option[] = [
32
- { id: "fast", label: "Fast", timing: "BM25", icon: Rabbit },
32
+ { id: "fast", label: "Fast", timing: "<1s", icon: Rabbit },
33
33
  { id: "balanced", label: "Balanced", timing: "~2s", icon: Gauge },
34
34
  { id: "thorough", label: "Thorough", timing: "~5s", icon: Sparkles },
35
35
  ];