@gmickel/gno 2.14.0 → 2.16.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 (205) hide show
  1. package/README.md +1 -1
  2. package/assets/skill/cli-reference.md +4 -2
  3. package/assets/spa-production.json.gz +0 -0
  4. package/browser-extension/artifacts/{gno-browser-clipper-v2.14.0.zip → gno-browser-clipper-v2.16.0.zip} +0 -0
  5. package/browser-extension/artifacts/gno-browser-clipper-v2.16.0.zip.sha256 +1 -0
  6. package/browser-extension/dist/manifest.json +1 -1
  7. package/package.json +1 -1
  8. package/spec/cli.md +88 -45
  9. package/spec/db/schema.sql +45 -0
  10. package/spec/output-schemas/embed-receipt.schema.json +89 -0
  11. package/src/cli/commands/agents/commands.ts +1 -1
  12. package/src/cli/commands/ask.ts +1 -1
  13. package/src/cli/commands/context-build.ts +1 -1
  14. package/src/cli/commands/embed.ts +341 -20
  15. package/src/cli/commands/links.ts +1 -1
  16. package/src/cli/commands/mcp/install.ts +2 -2
  17. package/src/cli/commands/mcp/status.ts +1 -1
  18. package/src/cli/commands/mcp/uninstall.ts +1 -1
  19. package/src/cli/commands/query.ts +1 -1
  20. package/src/cli/commands/shared.ts +4 -4
  21. package/src/cli/commands/skill/install.ts +1 -1
  22. package/src/cli/commands/skill/paths-cmd.ts +1 -1
  23. package/src/cli/commands/skill/uninstall.ts +1 -1
  24. package/src/cli/commands/status.ts +75 -58
  25. package/src/cli/config-cache.ts +86 -0
  26. package/src/cli/globals.ts +64 -0
  27. package/src/cli/options.ts +23 -0
  28. package/src/cli/program.ts +44 -37
  29. package/src/cli/run.ts +121 -67
  30. package/src/cli/runtime-health.ts +132 -122
  31. package/src/cli/session-binding.ts +11 -2
  32. package/src/config/saver.ts +8 -0
  33. package/src/converters/adapters/browser-export/formats.ts +25 -15
  34. package/src/converters/adapters/email/adapter.ts +37 -53
  35. package/src/converters/adapters/email/html.ts +37 -20
  36. package/src/converters/adapters/email/mime.ts +71 -39
  37. package/src/converters/adapters/ical/adapter.ts +20 -12
  38. package/src/converters/adapters/jsonl/adapter.ts +8 -6
  39. package/src/converters/adapters/shared/html-text.ts +55 -37
  40. package/src/converters/adapters/shared/ooxml-protection.ts +5 -13
  41. package/src/converters/adapters/shared/utf8-lines.ts +69 -31
  42. package/src/converters/adapters/transcript/adapter.ts +12 -7
  43. package/src/converters/adapters/xlsx/adapter.ts +10 -7
  44. package/src/converters/adapters/xlsx/sheet-markdown.ts +93 -50
  45. package/src/converters/canonicalize.ts +17 -3
  46. package/src/converters/native/markdown.ts +24 -17
  47. package/src/converters/native/plaintext.ts +5 -6
  48. package/src/converters/registry.ts +130 -8
  49. package/src/core/activation-status.ts +4 -8
  50. package/src/core/change-diff.ts +38 -11
  51. package/src/core/context-compiler.ts +17 -18
  52. package/src/core/context-evidence.ts +116 -25
  53. package/src/core/context-verifier.ts +70 -31
  54. package/src/core/file-lock.ts +10 -2
  55. package/src/core/graph-analysis.ts +3 -3
  56. package/src/core/link-inventory-markdown.ts +2 -2
  57. package/src/core/links.ts +20 -87
  58. package/src/core/memory-fence.ts +16 -9
  59. package/src/core/memory-recall.ts +168 -34
  60. package/src/core/path-rules.ts +143 -0
  61. package/src/core/section-parse.ts +16 -6
  62. package/src/core/typed-metadata.ts +68 -0
  63. package/src/core/wiki-link-syntax.ts +88 -0
  64. package/src/embed/backlog.ts +173 -60
  65. package/src/embed/batch.ts +83 -12
  66. package/src/embed/resume-cursor.ts +103 -0
  67. package/src/embed/retry.ts +41 -32
  68. package/src/embed/variant-backlog.ts +697 -63
  69. package/src/embed/variant-plan.ts +41 -45
  70. package/src/embed/variant-retry.ts +157 -44
  71. package/src/index.ts +3 -3
  72. package/src/ingestion/budget-error-codes.ts +13 -0
  73. package/src/ingestion/chunker.ts +60 -49
  74. package/src/ingestion/compiled-context.ts +4 -5
  75. package/src/ingestion/convert-file.ts +1 -1
  76. package/src/ingestion/document-metadata.ts +16 -9
  77. package/src/ingestion/excluded-ranges.ts +97 -0
  78. package/src/ingestion/file-processor.ts +122 -37
  79. package/src/ingestion/frontmatter.ts +35 -7
  80. package/src/ingestion/graph-reconciliation.ts +187 -51
  81. package/src/ingestion/language.ts +66 -61
  82. package/src/ingestion/position.ts +5 -5
  83. package/src/ingestion/prepare-file.ts +50 -29
  84. package/src/ingestion/record-adapter-canonical.ts +37 -26
  85. package/src/ingestion/record-adapter.ts +46 -26
  86. package/src/ingestion/record-container.ts +121 -53
  87. package/src/ingestion/record-path.ts +5 -2
  88. package/src/ingestion/source-availability/darwin-io.ts +10 -7
  89. package/src/ingestion/source-availability/darwin-path.ts +21 -3
  90. package/src/ingestion/source-availability/readers.ts +51 -0
  91. package/src/ingestion/strip.ts +39 -105
  92. package/src/ingestion/sync.ts +692 -386
  93. package/src/ingestion/typed-metadata.ts +10 -4
  94. package/src/ingestion/walker.ts +485 -158
  95. package/src/llm/cache.ts +128 -84
  96. package/src/llm/http-inference.ts +112 -35
  97. package/src/llm/http-policy.ts +101 -0
  98. package/src/llm/httpEmbedding.ts +8 -1
  99. package/src/llm/httpGeneration.ts +5 -1
  100. package/src/llm/httpRerank.ts +5 -1
  101. package/src/llm/inference-scope.ts +15 -2
  102. package/src/llm/lazy-ports.ts +33 -3
  103. package/src/llm/lockfile.ts +34 -7
  104. package/src/llm/model-cleanup.ts +24 -0
  105. package/src/llm/native-worker/client.ts +23 -12
  106. package/src/llm/native-worker/dispatcher.ts +19 -9
  107. package/src/llm/native-worker/embedding-identity.ts +42 -16
  108. package/src/llm/native-worker/entry.ts +2 -1
  109. package/src/llm/native-worker/owner.ts +1 -0
  110. package/src/llm/native-worker/ports.ts +86 -23
  111. package/src/llm/native-worker/protocol.ts +386 -55
  112. package/src/llm/nodeLlamaCpp/adapter.ts +46 -29
  113. package/src/llm/nodeLlamaCpp/embedding.ts +93 -40
  114. package/src/llm/nodeLlamaCpp/generation.ts +194 -30
  115. package/src/llm/nodeLlamaCpp/lifecycle.ts +2 -0
  116. package/src/llm/nodeLlamaCpp/rerank-capacity.ts +101 -23
  117. package/src/llm/nodeLlamaCpp/rerank.ts +253 -44
  118. package/src/llm/types.ts +14 -0
  119. package/src/mcp/context.ts +342 -23
  120. package/src/mcp/http-transport.ts +21 -3
  121. package/src/mcp/tool-profile-types.ts +62 -0
  122. package/src/mcp/tool-profile.ts +32 -56
  123. package/src/mcp/tools/context.ts +5 -1
  124. package/src/mcp/tools/index.ts +269 -191
  125. package/src/mcp/tools/links.ts +7 -5
  126. package/src/mcp/tools/query.ts +60 -37
  127. package/src/mcp/tools/vsearch.ts +25 -14
  128. package/src/pipeline/answer.ts +133 -40
  129. package/src/pipeline/claim-verification.ts +293 -189
  130. package/src/pipeline/claim-verifier.ts +6 -7
  131. package/src/pipeline/egress-lineage.ts +37 -26
  132. package/src/pipeline/exclude.ts +34 -11
  133. package/src/pipeline/expansion.ts +233 -19
  134. package/src/pipeline/filters.ts +169 -33
  135. package/src/pipeline/graph-retrieval.ts +117 -61
  136. package/src/pipeline/hybrid.ts +598 -329
  137. package/src/pipeline/hydration.ts +86 -24
  138. package/src/pipeline/intent.ts +15 -7
  139. package/src/pipeline/owner-fusion.ts +61 -19
  140. package/src/pipeline/query-language.ts +15 -2
  141. package/src/pipeline/rerank.ts +15 -22
  142. package/src/pipeline/search.ts +193 -72
  143. package/src/pipeline/snippet.ts +15 -2
  144. package/src/pipeline/temporal.ts +51 -10
  145. package/src/pipeline/vsearch.ts +250 -152
  146. package/src/publish/attachment-raster.ts +2 -16
  147. package/src/publish/encrypted-export.ts +15 -5
  148. package/src/serve/browse-tree.ts +50 -42
  149. package/src/serve/connectors.ts +2 -1
  150. package/src/serve/context.ts +13 -4
  151. package/src/serve/doc-events.ts +3 -0
  152. package/src/serve/public/app.tsx +49 -21
  153. package/src/serve/public/components/BrowseTreeSidebar.tsx +163 -23
  154. package/src/serve/public/components/CaptureModal.tsx +14 -10
  155. package/src/serve/public/components/ai-elements/code-block.tsx +87 -50
  156. package/src/serve/public/components/editor/MarkdownPreview.tsx +99 -67
  157. package/src/serve/public/globals.built.css +1 -1
  158. package/src/serve/public/globals.css +19 -0
  159. package/src/serve/public/hooks/useCaptureModal.tsx +23 -10
  160. package/src/serve/public/lib/metadata-filter.ts +234 -9
  161. package/src/serve/public/pages/Browse.tsx +61 -27
  162. package/src/serve/public/pages/DocView.tsx +44 -25
  163. package/src/serve/public/pages/GraphView.tsx +8 -3
  164. package/src/serve/resident-runtime.ts +199 -48
  165. package/src/serve/routes/api.ts +98 -67
  166. package/src/serve/routes/links.ts +18 -4
  167. package/src/serve/server.ts +1370 -1180
  168. package/src/serve/spa-bundle-source.ts +52 -27
  169. package/src/serve/status.ts +101 -52
  170. package/src/serve/watch-reconciliation-fallback.ts +11 -7
  171. package/src/serve/watch-reconciliation-shared.ts +42 -4
  172. package/src/serve/watch-reconciliation.ts +21 -8
  173. package/src/serve/watch-service-events.ts +7 -1
  174. package/src/serve/watch-service-hosts.ts +3 -1
  175. package/src/serve/watch-service.ts +46 -21
  176. package/src/serve/watch-snapshot-scan.ts +6 -15
  177. package/src/sessions/archive.ts +20 -8
  178. package/src/sessions/sanitize.ts +38 -18
  179. package/src/sessions/service.ts +180 -102
  180. package/src/store/migrations/036-vector-mirror-state.ts +83 -0
  181. package/src/store/migrations/037-performance-indexes.ts +56 -0
  182. package/src/store/migrations/index.ts +4 -0
  183. package/src/store/sqlite/adapter.ts +1217 -651
  184. package/src/store/sqlite/chunking-policy.ts +15 -1
  185. package/src/store/sqlite/eligibility.ts +110 -70
  186. package/src/store/sqlite/graph-neighbors.ts +71 -46
  187. package/src/store/sqlite/graph-reference-state.ts +27 -3
  188. package/src/store/sqlite/graph-similarity.ts +59 -12
  189. package/src/store/sqlite/metadata-predicate.ts +123 -28
  190. package/src/store/sqlite/retrieval-trace-management-store.ts +126 -33
  191. package/src/store/sqlite/retrieval-trace-retention.ts +88 -76
  192. package/src/store/sqlite/retrieval-trace-rows.ts +7 -3
  193. package/src/store/types.ts +32 -0
  194. package/src/store/vector/eligibility.ts +39 -0
  195. package/src/store/vector/lazy.ts +17 -0
  196. package/src/store/vector/partition-index.ts +49 -47
  197. package/src/store/vector/proof-cache.ts +103 -0
  198. package/src/store/vector/sqlite-vec.ts +230 -139
  199. package/src/store/vector/stats.ts +29 -73
  200. package/src/store/vector/status.ts +151 -52
  201. package/src/store/vector/stored-vectors.ts +131 -45
  202. package/src/store/vector/types.ts +10 -0
  203. package/src/store/vector/variant-search.ts +771 -109
  204. package/src/store/vector/variants.ts +785 -144
  205. package/browser-extension/artifacts/gno-browser-clipper-v2.14.0.zip.sha256 +0 -1
package/README.md CHANGED
@@ -139,7 +139,7 @@ See the [guide](docs/COMPILED-CONTEXT.md).
139
139
 
140
140
  <!-- public-truth:current-version -->
141
141
 
142
- > Current source version: **v2.14.0**. See [CHANGELOG.md](./CHANGELOG.md).
142
+ > Current source version: **v2.16.0**. See [CHANGELOG.md](./CHANGELOG.md).
143
143
 
144
144
  <!-- /public-truth -->
145
145
 
@@ -117,9 +117,11 @@ gno collection clear-embeddings <name> [--all] [--json]
117
117
  ### gno embed
118
118
 
119
119
  ```bash
120
- gno embed [collection] [--collection <name>] [--force] [--model <uri>] [--batch-size <n>] [--dry-run] [--new-partition]
120
+ gno embed [collection] [--collection <name>] [--force] [--model <uri>] [--batch-size <n>] [--max-chunks <n>] [--max-seconds <n>] [--dry-run] [--new-partition]
121
121
  ```
122
122
 
123
+ Default foreground `--batch-size` is `64` (background embedding is capped at `32`). Use `--max-chunks` or `--max-seconds` to process a large backlog in bounded slices.
124
+
123
125
  Switching `GNO_LLAMA_GPU`, Bun version or thread count resumes the existing
124
126
  vector partition when a measured sample of stored chunks matches. If it does
125
127
  not, embed refuses to build a separate partition without `--new-partition`
@@ -169,7 +171,7 @@ them in a collection instead.
169
171
  Generate embeddings only.
170
172
 
171
173
  ```bash
172
- gno embed [--force] [--model <uri>] [--batch-size <n>] [--dry-run] [--new-partition]
174
+ gno embed [--force] [--model <uri>] [--batch-size <n>] [--max-chunks <n>] [--max-seconds <n>] [--dry-run] [--new-partition]
173
175
  ```
174
176
 
175
177
  ## Project Profiles
Binary file
@@ -0,0 +1 @@
1
+ 4aacdd5ad2205fdb41b02a4ec771b875b7fc73c771a74c4342925636b18c8729 gno-browser-clipper-v2.16.0.zip
@@ -21,5 +21,5 @@
21
21
  "content_security_policy": {
22
22
  "extension_pages": "script-src 'self'; object-src 'none'; connect-src http://127.0.0.1:*"
23
23
  },
24
- "version": "2.14.0"
24
+ "version": "2.16.0"
25
25
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gmickel/gno",
3
- "version": "2.14.0",
3
+ "version": "2.16.0",
4
4
  "description": "Local semantic search for your documents. Index Markdown, PDF, and Office files with hybrid BM25 + vector search.",
5
5
  "keywords": [
6
6
  "embeddings",
package/spec/cli.md CHANGED
@@ -903,6 +903,9 @@ Each JSON item is the configured collection plus `effectiveWorkspaceRoot` and
903
903
  [gno audit](#gno-audit). Schema:
904
904
  [`collection-list@1.0`](./output-schemas/collection-list.schema.json).
905
905
 
906
+ `updateCmdTimeoutMs` (milliseconds) appears when the collection sets a limit
907
+ for `updateCmd`; without it the command is stopped after 10 minutes.
908
+
906
909
  ---
907
910
 
908
911
  ### gno collection clear-embeddings
@@ -1123,7 +1126,7 @@ Generate embeddings for indexed chunks.
1123
1126
  **Synopsis:**
1124
1127
 
1125
1128
  ```bash
1126
- gno embed [collection] [--collection <name>] [--force] [--model <uri>] [--batch-size <n>] [--dry-run] [--yes] [--json]
1129
+ gno embed [collection] [--collection <name>] [--force] [--model <uri>] [--batch-size <n>] [--dry-run] [--max-chunks <n>] [--max-seconds <n>] [--yes] [--json]
1127
1130
  ```
1128
1131
 
1129
1132
  **Arguments:**
@@ -1136,29 +1139,80 @@ gno embed [collection] [--collection <name>] [--force] [--model <uri>] [--batch-
1136
1139
  - `[collection]` and `--collection <name>` are aliases
1137
1140
  - if provided, embedding work is scoped to that collection only
1138
1141
 
1139
- ````
1142
+ **Bounded runs:**
1143
+
1144
+ - `--max-chunks <n>` and `--max-seconds <n>` (positive integers) stop the run
1145
+ after the batch that reaches either limit. Chunks count every chunk the run
1146
+ submitted to the embedding provider, embedded or failed, including
1147
+ resubmissions: a retry after a model reset and the smaller requests of
1148
+ adaptive recovery (a failed batch retried in halves or one chunk at a time),
1149
+ and the stored chunks re-embedded to verify a changed runtime before the
1150
+ first batch. Verification is not interrupted: it submits at most one
1151
+ sample of up to eight chunks per stored partition of the model, once per
1152
+ runtime when its verdict is cached (a failed cache write verifies again
1153
+ on the next run), so it can take a run past the limit by
1154
+ those samples. Every run still embeds at least one batch, so a run whose
1155
+ verification reached the limit embeds one batch and stops.
1156
+ Seconds run from the start of embedding. Batches are never split, so a run
1157
+ can go past the limit by the submissions of one batch and its recovery.
1158
+ - A stopped run exits 0, also when some chunks were deferred by SQLite
1159
+ contention (the receipt still reports `contentionErrors`). It keeps every
1160
+ committed batch and releases the write lease. It skips the final
1161
+ vector-index activation that only a complete pass performs, does not start a
1162
+ model-wide vector index sync (a later run that is not stopped performs it),
1163
+ and the index stage marker records the run as
1164
+ finished, not interrupted (best effort: if the database stays busy past its
1165
+ timeout, the receipt is still printed and the next run only shows a resume
1166
+ note). The next `gno embed` continues with the remaining chunks.
1167
+ - A limit reached on the batch that empties the backlog is a complete run.
1168
+ - A bounded run starts after the position where the previous bounded run for
1169
+ the same scope stopped, reaches the end of the backlog and then wraps to the
1170
+ start, so chunks that keep failing stay pending without blocking later
1171
+ chunks. A run that reaches the end of its traversal clears the position.
1172
+ - Retries of failed chunks count toward `--max-chunks` and `--max-seconds`;
1173
+ retries still queued when a limit is reached stay pending for the next run.
1174
+ - `--dry-run` ignores both limits. Combining either limit with `--force` is a
1175
+ validation error (exit 1), because a forced pass restarts from the first
1176
+ chunk. Limit values must be positive whole numbers.
1177
+ - The JSON receipt of a run that embeds (not a dry run) adds `remaining`, the
1178
+ chunks still pending for the scope (0 when the backlog is done), and
1179
+ `stopped: "limit"` when a limit ended the run with work pending. Without
1180
+ `--json`, a stopped run adds the line "Stopped at the run limit; <n> chunks
1181
+ remaining. Run `gno embed` again to continue."
1140
1182
 
1141
1183
  **Output (JSON):**
1142
1184
 
1143
1185
  ```json
1144
- [
1145
- {
1146
- "name": "notes",
1147
- "path": "/home/user/notes",
1148
- "pattern": "**/*.md",
1149
- "include": null,
1150
- "exclude": [".git", "node_modules"],
1151
- "updateCmd": null
1152
- }
1153
- ]
1154
- ````
1186
+ {
1187
+ "embedded": 5024,
1188
+ "errors": 0,
1189
+ "contentionErrors": 0,
1190
+ "duration": 312.4,
1191
+ "model": "hf:org/model/model.gguf",
1192
+ "searchAvailable": true,
1193
+ "errorSamples": [],
1194
+ "remaining": 41210,
1195
+ "stopped": "limit"
1196
+ }
1197
+ ```
1155
1198
 
1156
- `updateCmdTimeoutMs` (milliseconds) appears when the collection sets a limit
1157
- for `updateCmd`; without it the command is stopped after 10 minutes.
1199
+ Schema: [`embed-receipt@1.0`](./output-schemas/embed-receipt.schema.json)
1200
+ (a failed run prints the error envelope instead).
1201
+
1202
+ `remaining` and `stopped` appear on runs that embed (not `--dry-run`);
1203
+ `stopped` only when a limit ended the run with work pending. `incomplete: true`
1204
+ appears when the run ended early because the embedding runtime changed.
1205
+ `suggestion` and `syncError` appear when relevant.
1158
1206
 
1159
1207
  **Exit Codes:**
1160
1208
 
1161
- - 0: Success
1209
+ - 0: Success, including a run stopped by `--max-chunks` or `--max-seconds`
1210
+ - 1: Validation error (for example a limit that is not a positive whole number,
1211
+ or a limit combined with `--force`)
1212
+ - 2: Runtime error (model, partition or index failure)
1213
+ - 4: Busy: the write lease is held, or some chunks were deferred by SQLite
1214
+ contention in a run that was not stopped by a limit (the receipt is still
1215
+ printed)
1162
1216
 
1163
1217
  ---
1164
1218
 
@@ -1380,7 +1434,7 @@ memory pressure prevents creating the full pool.
1380
1434
  **Synopsis:**
1381
1435
 
1382
1436
  ```bash
1383
- gno embed [--force] [--model <uri>] [--batch-size <n>] [--dry-run] [--yes] [--new-partition] [--json] [--lock-wait <duration>] [--no-wait]
1437
+ gno embed [collection] [--collection <name>] [--force] [--model <uri>] [--batch-size <n>] [--dry-run] [--max-chunks <n>] [--max-seconds <n>] [--yes] [--new-partition] [--json] [--lock-wait <duration>] [--no-wait]
1384
1438
  ```
1385
1439
 
1386
1440
  Vector partitions are keyed on model weights, formatter, dimensions, context
@@ -1396,38 +1450,27 @@ never confirms; without confirmation embed exits 2 and writes nothing.
1396
1450
 
1397
1451
  **Options:**
1398
1452
 
1399
- | Option | Type | Default | Description |
1400
- | ------------------------ | -------- | ------- | --------------------------------------------------------------------------- |
1401
- | `--force` | boolean | false | Re-embed all chunks (ignore existing vectors) |
1402
- | `--model` | string | config | Override embedding model URI |
1403
- | `--batch-size` | integer | 32 | Chunks per batch |
1404
- | `--dry-run` | boolean | false | Show what would be embedded without doing it |
1405
- | `--yes`, `-y` | boolean | false | Skip confirmation prompts (never confirms a separate vector partition) |
1406
- | `--new-partition` | boolean | false | Confirm building a separate vector partition for an incompatible runtime |
1407
- | `--json` | boolean | false | Output result as JSON |
1408
- | `--lock-wait <duration>` | duration | `120s` | How long to wait for the index write lease. Accepts `120`, `120s`, or `2m`. |
1409
- | `--no-wait` | boolean | false | Do not wait; fail immediately if another writer holds the lease |
1453
+ | Option | Type | Default | Description |
1454
+ | ------------------------ | -------- | ------- | ---------------------------------------------------------------------------- |
1455
+ | `--force` | boolean | false | Re-embed all chunks (ignore existing vectors) |
1456
+ | `--model` | string | config | Override embedding model URI |
1457
+ | `--batch-size` | integer | 64 | Chunks per batch (foreground default; background capped at 32) |
1458
+ | `--dry-run` | boolean | false | Show what would be embedded without doing it |
1459
+ | `--max-chunks <n>` | integer | - | Stop after the batch that reaches this many chunks (see Bounded runs above) |
1460
+ | `--max-seconds <n>` | integer | - | Stop after the batch that reaches this many seconds (see Bounded runs above) |
1461
+ | `--yes`, `-y` | boolean | false | Skip confirmation prompts (never confirms a separate vector partition) |
1462
+ | `--new-partition` | boolean | false | Confirm building a separate vector partition for an incompatible runtime |
1463
+ | `--json` | boolean | false | Output result as JSON |
1464
+ | `--lock-wait <duration>` | duration | `120s` | How long to wait for the index write lease. Accepts `120`, `120s`, or `2m`. |
1465
+ | `--no-wait` | boolean | false | Do not wait; fail immediately if another writer holds the lease |
1410
1466
 
1411
1467
  Waits by default for the same write lease as `index` / `update` / MCP writers. `--no-wait` opts out.
1412
1468
 
1413
- **Exit Codes:**
1414
-
1415
- - 0: Success
1416
- - 1: User cancelled or invalid `--lock-wait`
1417
- - 2: Model not available or embedding failure
1418
- - 4: Write lease busy (contention, not corruption)
1419
-
1420
- **JSON Output:**
1469
+ **Exit Codes and JSON Output:**
1421
1470
 
1422
- ```json
1423
- {
1424
- "embedded": 1234,
1425
- "errors": 0,
1426
- "duration": 45.2,
1427
- "model": "hf:BAAI/bge-m3-gguf/bge-m3-q8_0.gguf",
1428
- "searchAvailable": true
1429
- }
1430
- ```
1471
+ See the receipt and exit codes in the first [gno embed](#gno-embed) section
1472
+ (including `remaining`, `stopped`, `incomplete`, limit validation and
1473
+ contention).
1431
1474
 
1432
1475
  **Verbose Mode:**
1433
1476
 
@@ -298,6 +298,51 @@ CREATE INDEX IF NOT EXISTS idx_vector_owners_variant ON vector_owners(variant_id
298
298
  -- No chunk FK: replacing shared canonical chunks must not cascade vector loss.
299
299
  -- The writer validates bindings against current document/chunk/formatted input.
300
300
  -- vec_v1_<partition SHA256> uses variant_id INTEGER PRIMARY KEY and FLOAT[dims].
301
+ -- vec0 mirror freshness per partition (migration 036). A partition is clean
302
+ -- only while it has a row with dirty = 0. Triggers on vector_variants delete
303
+ -- the row on any change (deletes never conflict, so outer conflict clauses
304
+ -- cannot cancel them); the store's own writes, which update vec0 in the same
305
+ -- transaction, restore the previous mark; syncIndex(), a verified activation,
306
+ -- `gno vec sync` and `gno vec rebuild` mark it clean. The BEFORE triggers look
307
+ -- up each conflict by its own key, so stale statistics cannot make every write
308
+ -- scan the variants index.
309
+ CREATE TABLE IF NOT EXISTS vector_mirror_state (
310
+ partition_id TEXT PRIMARY KEY,
311
+ dirty INTEGER NOT NULL CHECK (dirty IN (0, 1))
312
+ );
313
+ CREATE TRIGGER IF NOT EXISTS vector_variants_mirror_before_insert
314
+ BEFORE INSERT ON vector_variants BEGIN
315
+ DELETE FROM vector_mirror_state WHERE partition_id IN (
316
+ SELECT partition_id FROM vector_variants
317
+ WHERE variant_id = NEW.variant_id
318
+ UNION ALL
319
+ SELECT partition_id FROM vector_variants
320
+ WHERE partition_id = NEW.partition_id AND input_hash = NEW.input_hash
321
+ );
322
+ END;
323
+ CREATE TRIGGER IF NOT EXISTS vector_variants_mirror_insert
324
+ AFTER INSERT ON vector_variants BEGIN
325
+ DELETE FROM vector_mirror_state WHERE partition_id = NEW.partition_id;
326
+ END;
327
+ CREATE TRIGGER IF NOT EXISTS vector_variants_mirror_before_update
328
+ BEFORE UPDATE ON vector_variants BEGIN
329
+ DELETE FROM vector_mirror_state WHERE partition_id IN (
330
+ SELECT partition_id FROM vector_variants
331
+ WHERE variant_id = NEW.variant_id
332
+ UNION ALL
333
+ SELECT partition_id FROM vector_variants
334
+ WHERE partition_id = NEW.partition_id AND input_hash = NEW.input_hash
335
+ );
336
+ END;
337
+ CREATE TRIGGER IF NOT EXISTS vector_variants_mirror_update
338
+ AFTER UPDATE ON vector_variants BEGIN
339
+ DELETE FROM vector_mirror_state
340
+ WHERE partition_id IN (OLD.partition_id, NEW.partition_id);
341
+ END;
342
+ CREATE TRIGGER IF NOT EXISTS vector_variants_mirror_delete
343
+ AFTER DELETE ON vector_variants BEGIN
344
+ DELETE FROM vector_mirror_state WHERE partition_id = OLD.partition_id;
345
+ END;
301
346
  -- Its writes/deletes share the authoritative variant transaction; no best effort.
302
347
  -- Mutation epoch fences all old and new writers, including raw SQL. Active state
303
348
  -- records durable variant authority after initial promotion. activated_epoch
@@ -0,0 +1,89 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "gno://schemas/embed-receipt@1.0",
4
+ "title": "GNO Embed Receipt",
5
+ "description": "Receipt emitted by `gno embed --json` for a run that reached a result (failures emit the error envelope instead). A dry run reports the pending chunk count as `embedded` and omits `remaining`. A run that embeds adds `remaining`; a run ended by `--max-chunks` or `--max-seconds` with work pending adds `stopped`.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "embedded",
10
+ "errors",
11
+ "contentionErrors",
12
+ "duration",
13
+ "model",
14
+ "searchAvailable",
15
+ "errorSamples"
16
+ ],
17
+ "properties": {
18
+ "embedded": {
19
+ "type": "integer",
20
+ "minimum": 0,
21
+ "description": "Chunks embedded and stored by this run; for `--dry-run`, the chunks that would be embedded."
22
+ },
23
+ "errors": {
24
+ "type": "integer",
25
+ "minimum": 0,
26
+ "description": "Chunks that failed to embed in this run; they stay pending."
27
+ },
28
+ "contentionErrors": {
29
+ "type": "integer",
30
+ "minimum": 0,
31
+ "description": "Chunks deferred by SQLITE_BUSY/LOCKED - not embedding failures."
32
+ },
33
+ "duration": {
34
+ "type": "number",
35
+ "minimum": 0,
36
+ "description": "Seconds."
37
+ },
38
+ "model": {
39
+ "type": "string",
40
+ "minLength": 1,
41
+ "description": "Embedding model URI."
42
+ },
43
+ "searchAvailable": {
44
+ "type": "boolean",
45
+ "description": "False when sqlite-vec is unavailable: vectors are stored but KNN search is disabled."
46
+ },
47
+ "errorSamples": {
48
+ "type": "array",
49
+ "items": { "type": "string" },
50
+ "description": "Up to a few distinct failure messages."
51
+ },
52
+ "suggestion": {
53
+ "type": "string",
54
+ "description": "Next step for the user, when one applies."
55
+ },
56
+ "syncError": {
57
+ "type": "string",
58
+ "description": "Vector index sync failure after embedding."
59
+ },
60
+ "remaining": {
61
+ "type": "integer",
62
+ "minimum": 0,
63
+ "description": "Chunks still pending for the scope after this run (0 when the backlog is done). Present on runs that embed, absent on `--dry-run`."
64
+ },
65
+ "stopped": {
66
+ "const": "limit",
67
+ "description": "A run limit (`--max-chunks` or `--max-seconds`) ended the run with work pending. Absent otherwise."
68
+ },
69
+ "incomplete": {
70
+ "const": true,
71
+ "description": "The run ended early because the embedding runtime changed. Absent otherwise."
72
+ }
73
+ },
74
+ "dependencies": {
75
+ "stopped": ["remaining"],
76
+ "incomplete": ["remaining"]
77
+ },
78
+ "if": {
79
+ "properties": { "stopped": { "const": "limit" } },
80
+ "required": ["stopped"]
81
+ },
82
+ "then": {
83
+ "description": "A limit stop leaves work pending and is never a runtime change.",
84
+ "properties": {
85
+ "remaining": { "type": "integer", "minimum": 1 },
86
+ "incomplete": false
87
+ }
88
+ }
89
+ }
@@ -5,7 +5,7 @@
5
5
  */
6
6
 
7
7
  import { CliError } from "../../errors.js";
8
- import { getGlobals } from "../../program.js";
8
+ import { getGlobals } from "../../globals.js";
9
9
  import {
10
10
  BLOCK_VERSION,
11
11
  extractBlock,
@@ -37,7 +37,7 @@ import {
37
37
  createVectorIndexPort,
38
38
  type VectorIndexPort,
39
39
  } from "../../store/vector";
40
- import { getGlobals } from "../program";
40
+ import { getGlobals } from "../globals";
41
41
  import {
42
42
  createProgressRenderer,
43
43
  createThrottledProgressRenderer,
@@ -22,7 +22,7 @@ import { resolveDownloadPolicy } from "../../llm/policy";
22
22
  import { resolveModelUri } from "../../llm/registry";
23
23
  import { createVectorIndexPort } from "../../store/vector";
24
24
  import { CliError } from "../errors";
25
- import { getGlobals } from "../program";
25
+ import { getGlobals } from "../globals";
26
26
  import {
27
27
  createProgressRenderer,
28
28
  createThrottledProgressRenderer,