@gmickel/gno 2.3.3 → 2.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.
Files changed (117) hide show
  1. package/README.md +22 -3
  2. package/assets/skill/SKILL.md +53 -0
  3. package/assets/skill/cli-reference.md +29 -0
  4. package/assets/skill/examples.md +30 -0
  5. package/assets/skill/mcp-reference.md +26 -0
  6. package/assets/spa-production.json.gz +0 -0
  7. package/browser-extension/artifacts/{gno-browser-clipper-v2.3.3.zip → gno-browser-clipper-v2.5.1.zip} +0 -0
  8. package/browser-extension/artifacts/gno-browser-clipper-v2.5.1.zip.sha256 +1 -0
  9. package/browser-extension/dist/manifest.json +1 -1
  10. package/package.json +1 -1
  11. package/spec/cli.md +41 -0
  12. package/spec/compiled-context.md +68 -0
  13. package/spec/db/schema.sql +2 -0
  14. package/spec/evals.md +48 -0
  15. package/spec/mcp.md +37 -0
  16. package/spec/output-schemas/ask.schema.json +12 -0
  17. package/spec/output-schemas/compiled-context-check.schema.json +44 -0
  18. package/spec/output-schemas/compiled-context-file.schema.json +165 -0
  19. package/spec/output-schemas/compiled-context-preview.schema.json +142 -0
  20. package/spec/output-schemas/context-capsule-v1.schema.json +205 -32
  21. package/spec/output-schemas/context-capsule-verification.schema.json +32 -9
  22. package/spec/output-schemas/evidence-fixtures.schema.json +176 -0
  23. package/spec/output-schemas/evidence-report.schema.json +322 -0
  24. package/spec/output-schemas/evidence-run.schema.json +277 -0
  25. package/spec/output-schemas/metadata-predicate.schema.json +460 -0
  26. package/spec/output-schemas/retrieval-trace-filters.schema.json +13 -4
  27. package/spec/output-schemas/search-results.schema.json +12 -0
  28. package/spec/output-schemas/status.schema.json +37 -6
  29. package/src/app/compiled-context-files.ts +361 -0
  30. package/src/app/compiled-context.ts +240 -0
  31. package/src/app/context-runtime-contract.ts +33 -2
  32. package/src/app/context-runtime-input.ts +17 -0
  33. package/src/app/context-runtime-types.ts +2 -0
  34. package/src/app/context-runtime.ts +27 -3
  35. package/src/app/context-surface.ts +7 -0
  36. package/src/app/verified-ask.ts +1 -0
  37. package/src/cli/commands/ask.ts +1 -0
  38. package/src/cli/commands/audit.ts +4 -0
  39. package/src/cli/commands/context-build.ts +1 -0
  40. package/src/cli/commands/context-compiled.ts +136 -0
  41. package/src/cli/commands/search.ts +1 -0
  42. package/src/cli/commands/status.ts +10 -0
  43. package/src/cli/errors.ts +10 -3
  44. package/src/cli/options.ts +19 -0
  45. package/src/cli/program.ts +82 -0
  46. package/src/converters/types.ts +2 -0
  47. package/src/core/compiled-context.ts +254 -0
  48. package/src/core/context-budget.ts +2 -10
  49. package/src/core/context-capsule-retrieval-schema.ts +8 -0
  50. package/src/core/context-capsule-schema.ts +47 -3
  51. package/src/core/context-capsule-validation.ts +14 -2
  52. package/src/core/context-capsule-verification.ts +1 -0
  53. package/src/core/context-capsule.ts +16 -2
  54. package/src/core/context-compiler.ts +3 -0
  55. package/src/core/file-lock.ts +22 -5
  56. package/src/core/folder-setup-planning.ts +2 -1
  57. package/src/core/network-boundary-inventory.ts +8 -0
  58. package/src/core/record-metadata.ts +1 -1
  59. package/src/core/retrieval-replay-candidate.ts +5 -0
  60. package/src/core/retrieval-trace-filter-normalization.ts +4 -0
  61. package/src/core/retrieval-trace-request.ts +1 -0
  62. package/src/core/retrieval-trace-session.ts +5 -1
  63. package/src/core/retrieval-trace.ts +2 -0
  64. package/src/core/setup-receipt.ts +27 -20
  65. package/src/core/typed-metadata.ts +228 -0
  66. package/src/core/validation.ts +9 -2
  67. package/src/core/windows-private-path.ts +96 -0
  68. package/src/index.ts +2 -2
  69. package/src/ingestion/compiled-context.ts +15 -0
  70. package/src/ingestion/record-adapter-canonical.ts +13 -2
  71. package/src/ingestion/record-container.ts +9 -0
  72. package/src/ingestion/sync.ts +51 -9
  73. package/src/ingestion/typed-metadata.ts +55 -0
  74. package/src/ingestion/walker.ts +5 -4
  75. package/src/llm/nodeLlamaCpp/simulator-install.ts +6 -2
  76. package/src/mcp/http-egress.ts +11 -3
  77. package/src/mcp/retrieval-warnings.ts +24 -0
  78. package/src/mcp/tools/ask.ts +23 -2
  79. package/src/mcp/tools/context.ts +47 -2
  80. package/src/mcp/tools/index.ts +58 -1
  81. package/src/mcp/tools/query.ts +16 -1
  82. package/src/mcp/tools/search.ts +12 -1
  83. package/src/mcp/tools/status.ts +4 -0
  84. package/src/mcp/tools/vsearch.ts +12 -1
  85. package/src/pipeline/diagnose.ts +6 -0
  86. package/src/pipeline/filters.ts +65 -0
  87. package/src/pipeline/graph-retrieval.ts +9 -1
  88. package/src/pipeline/hybrid.ts +22 -2
  89. package/src/pipeline/search.ts +11 -0
  90. package/src/pipeline/types.ts +7 -1
  91. package/src/pipeline/vsearch.ts +21 -1
  92. package/src/sdk/client.ts +98 -3
  93. package/src/sdk/index.ts +11 -0
  94. package/src/sdk/types.ts +35 -1
  95. package/src/serve/compiled-context.ts +84 -0
  96. package/src/serve/context-capsule.ts +1 -0
  97. package/src/serve/public/app.tsx +12 -1
  98. package/src/serve/public/components/MetadataFilter.tsx +186 -0
  99. package/src/serve/public/globals.built.css +1 -1
  100. package/src/serve/public/lib/metadata-filter.ts +28 -0
  101. package/src/serve/public/lib/retrieval-filters.ts +3 -0
  102. package/src/serve/public/lib/workspace-tabs.ts +2 -0
  103. package/src/serve/public/pages/Ask.tsx +48 -3
  104. package/src/serve/public/pages/CompiledContext.tsx +364 -0
  105. package/src/serve/public/pages/Dashboard.tsx +7 -0
  106. package/src/serve/public/pages/DocView.tsx +33 -0
  107. package/src/serve/public/pages/Search.tsx +44 -1
  108. package/src/serve/routes/api.ts +50 -0
  109. package/src/serve/server.ts +43 -2
  110. package/src/serve/spa-production-build.ts +6 -5
  111. package/src/store/migrations/030-typed-metadata.ts +13 -0
  112. package/src/store/migrations/index.ts +2 -0
  113. package/src/store/sqlite/adapter.ts +69 -5
  114. package/src/store/sqlite/eligibility.ts +12 -0
  115. package/src/store/sqlite/metadata-predicate.ts +71 -0
  116. package/src/store/types.ts +11 -0
  117. package/browser-extension/artifacts/gno-browser-clipper-v2.3.3.zip.sha256 +0 -1
@@ -0,0 +1,71 @@
1
+ import type {
2
+ MetadataPredicate,
3
+ MetadataScalar,
4
+ } from "../../core/typed-metadata";
5
+
6
+ import { normalizeMetadataPredicate } from "../../core/typed-metadata";
7
+
8
+ /** JSON keys and values are bound parameters, never paths or SQL fragments. */
9
+ export function compileMetadataPredicate(input: MetadataPredicate): {
10
+ sql: string;
11
+ params: (string | number)[];
12
+ } {
13
+ const params: (string | number)[] = [];
14
+ const bind = (value: string | number): string => {
15
+ params.push(value);
16
+ return "?";
17
+ };
18
+ const scalar = (alias: string, value: MetadataScalar): string => {
19
+ const type =
20
+ typeof value === "number"
21
+ ? `${alias}.type IN ('integer','real')`
22
+ : typeof value === "boolean"
23
+ ? `${alias}.type IN ('true','false')`
24
+ : `${alias}.type = 'text'`;
25
+ return `(${type} AND ${alias}.value = ${bind(typeof value === "boolean" ? Number(value) : value)})`;
26
+ };
27
+ const compile = (node: MetadataPredicate): string => {
28
+ if (node.op === "and" || node.op === "or")
29
+ return `(${node.predicates.map(compile).join(node.op === "and" ? " AND " : " OR ")})`;
30
+ if (node.op === "not") return `NOT (${compile(node.predicate)})`;
31
+ if (!("key" in node)) throw new Error("Invalid metadata predicate");
32
+ const key = bind(node.key);
33
+ const select = `SELECT 1 FROM json_each(d.typed_metadata) mf WHERE mf.key = ${key}`;
34
+ if (node.op === "exists")
35
+ return `${node.value ? "" : "NOT "}EXISTS (${select})`;
36
+ if ("values" in node) {
37
+ if (node.op === "all") {
38
+ const conditions = node.values.map(
39
+ (value) =>
40
+ `EXISTS (SELECT 1 FROM json_each(mf.value) mv WHERE ${scalar("mv", value)})`
41
+ );
42
+ return `EXISTS (${select} AND CASE WHEN mf.type = 'array' THEN (${conditions.join(" AND ")}) ELSE 0 END)`;
43
+ }
44
+ const arrayMatches = node.values
45
+ .map((value) => scalar("mv", value))
46
+ .join(" OR ");
47
+ const scalarMatches = node.values
48
+ .map((value) => scalar("mf", value))
49
+ .join(" OR ");
50
+ const match = `CASE WHEN mf.type = 'array' THEN EXISTS (SELECT 1 FROM json_each(mf.value) mv WHERE ${arrayMatches}) ELSE (${scalarMatches}) END`;
51
+ return `EXISTS (${select} AND ${node.op === "nin" ? "NOT " : ""}(${match}))`;
52
+ }
53
+ if (node.op === "eq")
54
+ return `EXISTS (${select} AND ${scalar("mf", node.value)})`;
55
+ if (node.op === "ne") {
56
+ const equal = scalar("mf", node.value);
57
+ const type =
58
+ typeof node.value === "number"
59
+ ? "mf.type IN ('integer','real')"
60
+ : typeof node.value === "boolean"
61
+ ? "mf.type IN ('true','false')"
62
+ : "mf.type = 'text'";
63
+ return `EXISTS (${select} AND ${type} AND NOT ${equal})`;
64
+ }
65
+ if (typeof node.value !== "number")
66
+ throw new Error("Ordering requires a number");
67
+ const operators = { gt: ">", gte: ">=", lt: "<", lte: "<=" } as const;
68
+ return `EXISTS (${select} AND mf.type IN ('integer','real') AND mf.value ${operators[node.op]} ${bind(node.value)})`;
69
+ };
70
+ return { sql: compile(normalizeMetadataPredicate(input)), params };
71
+ }
@@ -20,6 +20,7 @@ import type {
20
20
  FileRefactorRecoveryReceipt,
21
21
  FileRefactorRecoveryReceiptDraft,
22
22
  } from "../core/file-refactor-journal";
23
+ import type { MetadataPredicate, TypedMetadata } from "../core/typed-metadata";
23
24
  import type {
24
25
  ChunkingPolicyToken,
25
26
  ChunkingStatus,
@@ -119,6 +120,8 @@ export interface ContextRow {
119
120
 
120
121
  /** Document row from DB */
121
122
  export interface DocumentRow {
123
+ typedMetadata?: TypedMetadata | null;
124
+ metadataError?: string | null;
122
125
  id: number;
123
126
  collection: string;
124
127
  relPath: string;
@@ -377,6 +380,8 @@ export interface DocEdgeInput {
377
380
 
378
381
  /** Input for upserting a document */
379
382
  export interface DocumentInput {
383
+ typedMetadata?: TypedMetadata;
384
+ metadataError?: string;
380
385
  collection: string;
381
386
  relPath: string;
382
387
  sourceHash: string;
@@ -667,6 +672,7 @@ export interface GraphReferenceStore {
667
672
  }
668
673
 
669
674
  export interface DocumentEligibilityOptions {
675
+ filter?: MetadataPredicate;
670
676
  /** Internal owner eligibility; public lexical language remains reserved. */
671
677
  chunkLanguage?: string;
672
678
  /** Include author, content type and categories in whole-owner exclusion. */
@@ -793,6 +799,7 @@ export interface CollectionStatus {
793
799
 
794
800
  /** Index-level status */
795
801
  export interface IndexStatus {
802
+ typedMetadata?: { pending: number; invalid: number };
796
803
  /** Config version string */
797
804
  version: string;
798
805
  /** Index name (from dbPath) */
@@ -1522,6 +1529,9 @@ export type WithTransaction = <T>(
1522
1529
  * Implementations: SQLite adapter (src/store/sqlite/adapter.ts)
1523
1530
  */
1524
1531
  export interface StorePort {
1532
+ getTypedMetadataCoverage?(
1533
+ options: DocumentEligibilityOptions
1534
+ ): Promise<StoreResult<{ pending: number; invalid: number }>>;
1525
1535
  // ─────────────────────────────────────────────────────────────────────────
1526
1536
  // Lifecycle
1527
1537
  // ─────────────────────────────────────────────────────────────────────────
@@ -1869,6 +1879,7 @@ export interface StorePort {
1869
1879
  options?: {
1870
1880
  collection?: string;
1871
1881
  activeOnly?: boolean;
1882
+ eligibility?: DocumentEligibilityOptions;
1872
1883
  }
1873
1884
  ): Promise<StoreResult<DocumentRow[]>>;
1874
1885
 
@@ -1 +0,0 @@
1
- 47dbd00572b4a1d5e90a26f90e02a4e04399db9c5792bcfce0ee2e44269fafa5 gno-browser-clipper-v2.3.3.zip