@mnmal-ai/substrate 1.0.0-alpha.2 → 1.0.0-alpha.20

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 (53) hide show
  1. package/README.md +64 -14
  2. package/dist/boot-store-BaDqbBS-.js +4062 -0
  3. package/dist/{runtime-metrics-DwpDJ8vz.d.ts → bridge-BhiJKwfF.d.ts} +2 -87
  4. package/dist/cli-RRFphMtQ.js +3366 -0
  5. package/dist/client.browser.js +2485 -0
  6. package/dist/client.d.ts +273 -135
  7. package/dist/client.js +6 -6
  8. package/dist/cluster-worker.js +0 -1
  9. package/dist/{content-type-C7T28xNb.js → content-type-wLljot5M.js} +0 -1
  10. package/dist/{env-utils-CGNazUNt.js → env-utils-s25Z1YSA.js} +0 -1
  11. package/dist/{errors-D4vKuwz8.d.ts → errors-CYOaWZ8l.d.ts} +44 -4
  12. package/dist/{fake-DUVtKVSE.js → fake-DdXtb-m8.js} +0 -1
  13. package/dist/{index-D7mSOFlM.d.ts → index-ZKeYFHDD.d.ts} +7 -11
  14. package/dist/msgpackr-Dq18g6Ds.js +16 -0
  15. package/dist/node-version-BtK_Nq6z.js +32 -0
  16. package/dist/pack.d.ts +75 -11
  17. package/dist/pack.js +4 -4
  18. package/dist/pg-edges-store-C-IRv-O9.js +443 -0
  19. package/dist/{plugin-QuJN9pG_.js → plugin-MSbSZ6Al.js} +132 -8
  20. package/dist/proposals-bootstrap.js +6 -5
  21. package/dist/proposals.config.schema.json +5 -0
  22. package/dist/proposals.d.ts +17 -5
  23. package/dist/proposals.default-config.json +2 -1
  24. package/dist/proposals.js +2 -3
  25. package/dist/recall-bootstrap.js +5 -4
  26. package/dist/recall.config.schema.json +6 -0
  27. package/dist/recall.d.ts +35 -6
  28. package/dist/recall.js +2 -3
  29. package/dist/{repl-C52wyfMs.js → repl-Ob5OyQqj.js} +65 -33
  30. package/dist/{row-ByLFE2Wx.d.ts → row-CfsHSEfB.d.ts} +92 -12
  31. package/dist/run-B438GGJK.js +2435 -0
  32. package/dist/{plugin-t2g2wX0b.d.ts → schema-laGLMvMC.d.ts} +1287 -63
  33. package/dist/script-A9dxMRZA.js +143 -0
  34. package/dist/script-runner.js +77 -0
  35. package/dist/sdk.d.ts +227 -38
  36. package/dist/sdk.js +5 -110
  37. package/dist/semver-D_zdq0hi.js +17 -0
  38. package/dist/{src-DMzc3HfW.js → src-BNdhH_Hx.js} +745 -851
  39. package/dist/{src-CG7giuHr.js → src-BSL2yyVy.js} +779 -75
  40. package/dist/{src-BLgbLq2k.js → src-B_kHkbsr.js} +780 -330
  41. package/dist/{src-DWm0iA88.js → src-De9j33jv.js} +188 -87
  42. package/dist/src-DkxrpQOz.js +7709 -0
  43. package/dist/{row-DZ0Fnpc6.js → src-DmiUWOLp.js} +2 -1
  44. package/dist/{src-CHp3QyqB.js → src-S84ef4e3.js} +9177 -3377
  45. package/dist/substrate-admin.js +17 -782
  46. package/dist/substrate.js +4 -5487
  47. package/dist/testing.d.ts +730 -53
  48. package/dist/testing.js +20 -163
  49. package/dist/{ws-C72iVS5T.d.ts → ws-BT8kL1IF.d.ts} +4 -5
  50. package/package.json +26 -26
  51. package/dist/dataset-BQ8egGl5.js +0 -1535
  52. package/dist/schema-g4FQLr0V.d.ts +0 -433
  53. package/dist/src-CXKnqeTW.js +0 -2339
@@ -1,5 +1,4 @@
1
- import { createRequire as __binCreateRequire } from 'node:module'; const require = __binCreateRequire(import.meta.url);
2
- import { n as defaultPluginsForPersona, r as parsePort, t as KNOWN_PLUGINS } from "./substrate.js";
1
+ import { a as parsePositive, i as DEFAULT_SIZING, n as defaultPluginsForPersona, r as parsePort, t as KNOWN_PLUGINS } from "./cli-RRFphMtQ.js";
3
2
  import { createRequire } from "node:module";
4
3
  import path from "node:path";
5
4
  import { stripVTControlCharacters, styleText } from "node:util";
@@ -36,7 +35,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
36
35
  var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
37
36
 
38
37
  //#endregion
39
- //#region ../../node_modules/.pnpm/@inquirer+core@12.0.4_@types+node@26.6.5/node_modules/@inquirer/core/dist/lib/key.js
38
+ //#region ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@26.6.6/node_modules/@inquirer/core/dist/lib/key.js
40
39
  const keybindingLookup = /* @__PURE__ */ new Set(["emacs", "vim"]);
41
40
  function isKeybinding(value) {
42
41
  return keybindingLookup.has(value);
@@ -55,7 +54,7 @@ const isNumberKey = (key) => "1234567890".includes(key.name);
55
54
  const isEnterKey = (key) => key.name === "enter" || key.name === "return";
56
55
 
57
56
  //#endregion
58
- //#region ../../node_modules/.pnpm/@inquirer+core@12.0.4_@types+node@26.6.5/node_modules/@inquirer/core/dist/lib/errors.js
57
+ //#region ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@26.6.6/node_modules/@inquirer/core/dist/lib/errors.js
59
58
  var AbortPromptError = class extends Error {
60
59
  name = "AbortPromptError";
61
60
  message = "Prompt was aborted";
@@ -79,7 +78,7 @@ var ValidationError = class extends Error {
79
78
  };
80
79
 
81
80
  //#endregion
82
- //#region ../../node_modules/.pnpm/@inquirer+core@12.0.4_@types+node@26.6.5/node_modules/@inquirer/core/dist/lib/hook-engine.js
81
+ //#region ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@26.6.6/node_modules/@inquirer/core/dist/lib/hook-engine.js
83
82
  const hookStorage = new AsyncLocalStorage();
84
83
  function createStore(rl) {
85
84
  return {
@@ -174,7 +173,7 @@ const effectScheduler = {
174
173
  };
175
174
 
176
175
  //#endregion
177
- //#region ../../node_modules/.pnpm/@inquirer+core@12.0.4_@types+node@26.6.5/node_modules/@inquirer/core/dist/lib/use-state.js
176
+ //#region ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@26.6.6/node_modules/@inquirer/core/dist/lib/use-state.js
178
177
  function isFactory(value) {
179
178
  return typeof value === "function";
180
179
  }
@@ -199,7 +198,7 @@ function useState(defaultValue) {
199
198
  }
200
199
 
201
200
  //#endregion
202
- //#region ../../node_modules/.pnpm/@inquirer+core@12.0.4_@types+node@26.6.5/node_modules/@inquirer/core/dist/lib/use-effect.js
201
+ //#region ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@26.6.6/node_modules/@inquirer/core/dist/lib/use-effect.js
203
202
  function useEffect(cb, depArray) {
204
203
  withPointer((pointer) => {
205
204
  const oldDeps = pointer.get();
@@ -209,7 +208,7 @@ function useEffect(cb, depArray) {
209
208
  }
210
209
 
211
210
  //#endregion
212
- //#region ../../node_modules/.pnpm/@inquirer+figures@2.0.9/node_modules/@inquirer/figures/dist/index.js
211
+ //#region ../../node_modules/.pnpm/@inquirer+figures@2.0.10/node_modules/@inquirer/figures/dist/index.js
213
212
  function isUnicodeSupported() {
214
213
  if (!process$1.platform.startsWith("win")) return process$1.env["TERM"] !== "linux";
215
214
  return Boolean(process$1.env["CI"]) || Boolean(process$1.env["WT_SESSION"]) || Boolean(process$1.env["TERMINUS_SUBLIME"]) || process$1.env["ConEmuTask"] === "{cmd::Cmder}" || process$1.env["TERM_PROGRAM"] === "Terminus-Sublime" || process$1.env["TERM_PROGRAM"] === "vscode" || process$1.env["TERM"] === "xterm-256color" || process$1.env["TERM"] === "alacritty" || process$1.env["TERMINAL_EMULATOR"] === "JetBrains-JediTerm";
@@ -495,7 +494,7 @@ const figures = shouldUseMain ? mainSymbols : fallbackSymbols;
495
494
  const replacements = Object.entries(specialMainSymbols);
496
495
 
497
496
  //#endregion
498
- //#region ../../node_modules/.pnpm/@inquirer+core@12.0.4_@types+node@26.6.5/node_modules/@inquirer/core/dist/lib/theme.js
497
+ //#region ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@26.6.6/node_modules/@inquirer/core/dist/lib/theme.js
499
498
  const defaultTheme = {
500
499
  prefix: {
501
500
  idle: styleText("blue", "?"),
@@ -535,7 +534,7 @@ function getDefaultTheme() {
535
534
  }
536
535
 
537
536
  //#endregion
538
- //#region ../../node_modules/.pnpm/@inquirer+core@12.0.4_@types+node@26.6.5/node_modules/@inquirer/core/dist/lib/make-theme.js
537
+ //#region ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@26.6.6/node_modules/@inquirer/core/dist/lib/make-theme.js
539
538
  function isPlainObject(value) {
540
539
  if (typeof value !== "object" || value === null) return false;
541
540
  let proto = value;
@@ -555,7 +554,7 @@ function makeTheme(...themes) {
555
554
  }
556
555
 
557
556
  //#endregion
558
- //#region ../../node_modules/.pnpm/@inquirer+core@12.0.4_@types+node@26.6.5/node_modules/@inquirer/core/dist/lib/use-prefix.js
557
+ //#region ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@26.6.6/node_modules/@inquirer/core/dist/lib/use-prefix.js
559
558
  function usePrefix({ status = "idle", theme }) {
560
559
  const [showLoader, setShowLoader] = useState(false);
561
560
  const [tick, setTick] = useState(0);
@@ -582,7 +581,7 @@ function usePrefix({ status = "idle", theme }) {
582
581
  }
583
582
 
584
583
  //#endregion
585
- //#region ../../node_modules/.pnpm/@inquirer+core@12.0.4_@types+node@26.6.5/node_modules/@inquirer/core/dist/lib/use-memo.js
584
+ //#region ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@26.6.6/node_modules/@inquirer/core/dist/lib/use-memo.js
586
585
  function useMemo(fn, dependencies) {
587
586
  return withPointer((pointer) => {
588
587
  const prev = pointer.get();
@@ -599,13 +598,13 @@ function useMemo(fn, dependencies) {
599
598
  }
600
599
 
601
600
  //#endregion
602
- //#region ../../node_modules/.pnpm/@inquirer+core@12.0.4_@types+node@26.6.5/node_modules/@inquirer/core/dist/lib/use-ref.js
601
+ //#region ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@26.6.6/node_modules/@inquirer/core/dist/lib/use-ref.js
603
602
  function useRef(val) {
604
603
  return useState({ current: val })[0];
605
604
  }
606
605
 
607
606
  //#endregion
608
- //#region ../../node_modules/.pnpm/@inquirer+core@12.0.4_@types+node@26.6.5/node_modules/@inquirer/core/dist/lib/use-keypress.js
607
+ //#region ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@26.6.6/node_modules/@inquirer/core/dist/lib/use-keypress.js
609
608
  function useKeypress(userHandler) {
610
609
  const signal = useRef(userHandler);
611
610
  signal.current = userHandler;
@@ -939,7 +938,7 @@ function wrapAnsi(string, columns, options) {
939
938
  }
940
939
 
941
940
  //#endregion
942
- //#region ../../node_modules/.pnpm/@inquirer+core@12.0.4_@types+node@26.6.5/node_modules/@inquirer/core/dist/lib/utils.js
941
+ //#region ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@26.6.6/node_modules/@inquirer/core/dist/lib/utils.js
943
942
  var import_cli_width = /* @__PURE__ */ __toESM(require_cli_width(), 1);
944
943
  /**
945
944
  * Force line returns at specific width. This function is ANSI code friendly and it'll
@@ -966,7 +965,7 @@ function readlineWidth() {
966
965
  }
967
966
 
968
967
  //#endregion
969
- //#region ../../node_modules/.pnpm/@inquirer+core@12.0.4_@types+node@26.6.5/node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js
968
+ //#region ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@26.6.6/node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js
970
969
  function usePointerPosition({ active, renderedItems, pageSize, loop }) {
971
970
  const state = useRef({
972
971
  lastPointer: active,
@@ -1052,7 +1051,7 @@ function usePagination({ items, active, renderItem, pageSize, loop = true }) {
1052
1051
  }
1053
1052
 
1054
1053
  //#endregion
1055
- //#region ../../node_modules/.pnpm/@inquirer+type@4.2.0_@types+node@26.6.5/node_modules/@inquirer/type/dist/utils.js
1054
+ //#region ../../node_modules/.pnpm/@inquirer+type@4.2.1_@types+node@26.6.6/node_modules/@inquirer/type/dist/utils.js
1056
1055
  /**
1057
1056
  * Create a promise and get access to its `resolve` and `reject` functions.
1058
1057
  *
@@ -1373,7 +1372,7 @@ const process$2 = globalThis.process;
1373
1372
  const { onExit, load, unload } = signalExitWrap(processOk(process$2) ? new SignalExit(process$2) : new SignalExitFallback());
1374
1373
 
1375
1374
  //#endregion
1376
- //#region ../../node_modules/.pnpm/@inquirer+ansi@2.0.9/node_modules/@inquirer/ansi/dist/index.js
1375
+ //#region ../../node_modules/.pnpm/@inquirer+ansi@2.0.10/node_modules/@inquirer/ansi/dist/index.js
1377
1376
  const ESC = "\x1B[";
1378
1377
  /** Hide the cursor */
1379
1378
  const cursorHide = "\x1B[?25l";
@@ -1393,7 +1392,7 @@ const eraseLine = "\x1B[2K";
1393
1392
  const eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + "\x1B[2K\x1B[G" : "";
1394
1393
 
1395
1394
  //#endregion
1396
- //#region ../../node_modules/.pnpm/@inquirer+core@12.0.4_@types+node@26.6.5/node_modules/@inquirer/core/dist/lib/screen-manager.js
1395
+ //#region ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@26.6.6/node_modules/@inquirer/core/dist/lib/screen-manager.js
1397
1396
  const height = (content) => content.split("\n").length;
1398
1397
  const lastLine = (content) => content.split("\n").pop() ?? "";
1399
1398
  var ScreenManager = class {
@@ -1451,9 +1450,10 @@ var ScreenManager = class {
1451
1450
  };
1452
1451
 
1453
1452
  //#endregion
1454
- //#region ../../node_modules/.pnpm/@inquirer+core@12.0.4_@types+node@26.6.5/node_modules/@inquirer/core/dist/lib/create-prompt.js
1453
+ //#region ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@26.6.6/node_modules/@inquirer/core/dist/lib/create-prompt.js
1455
1454
  var import_lib = /* @__PURE__ */ __toESM(require_lib(), 1);
1456
1455
  const nativeSetImmediate = globalThis.setImmediate;
1456
+ const nativeClearImmediate = globalThis.clearImmediate;
1457
1457
  /**
1458
1458
  * Register an event listener and return its disposer, so registrations collapse
1459
1459
  * into a single statement: `cleanups.add(listenTo(rl, 'close', handler))`.
@@ -1556,8 +1556,10 @@ function createPrompt(view) {
1556
1556
  }
1557
1557
  });
1558
1558
  };
1559
- if ("readableFlowing" in input) nativeSetImmediate(startCycle);
1560
- else startCycle();
1559
+ if ("readableFlowing" in input && input.isTTY) {
1560
+ const immediate = nativeSetImmediate(startCycle);
1561
+ cleanups.add(() => nativeClearImmediate(immediate));
1562
+ } else startCycle();
1561
1563
  return promptPromise;
1562
1564
  });
1563
1565
  };
@@ -1565,7 +1567,7 @@ function createPrompt(view) {
1565
1567
  }
1566
1568
 
1567
1569
  //#endregion
1568
- //#region ../../node_modules/.pnpm/@inquirer+core@12.0.4_@types+node@26.6.5/node_modules/@inquirer/core/dist/lib/Separator.js
1570
+ //#region ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@26.6.6/node_modules/@inquirer/core/dist/lib/Separator.js
1569
1571
  /**
1570
1572
  * Separator object
1571
1573
  * Used to space/separate choices group
@@ -1582,7 +1584,7 @@ var Separator = class {
1582
1584
  };
1583
1585
 
1584
1586
  //#endregion
1585
- //#region ../../node_modules/.pnpm/@inquirer+checkbox@5.2.6_@types+node@26.6.5/node_modules/@inquirer/checkbox/dist/index.js
1587
+ //#region ../../node_modules/.pnpm/@inquirer+checkbox@5.2.8_@types+node@26.6.6/node_modules/@inquirer/checkbox/dist/index.js
1586
1588
  const checkboxTheme = {
1587
1589
  icon: {
1588
1590
  checked: styleText("green", figures.circleFilled),
@@ -1676,9 +1678,12 @@ var dist_default$3 = createPrompt((config, done) => {
1676
1678
  const [active, setActive] = useState(bounds.first);
1677
1679
  const [errorMsg, setError] = useState();
1678
1680
  useKeypress(async (key) => {
1681
+ if (status !== "idle") return;
1679
1682
  if (isEnterKey(key)) {
1683
+ setStatus("loading");
1680
1684
  const selection = items.filter(isChecked);
1681
1685
  const isValid = await validate([...selection]);
1686
+ setStatus("idle");
1682
1687
  if (required && !selection.length) setError("At least one choice must be selected");
1683
1688
  else if (isValid === true) {
1684
1689
  setStatus("done");
@@ -1767,7 +1772,7 @@ var dist_default$3 = createPrompt((config, done) => {
1767
1772
  });
1768
1773
 
1769
1774
  //#endregion
1770
- //#region ../../node_modules/.pnpm/@inquirer+confirm@6.3.3_@types+node@26.6.5/node_modules/@inquirer/confirm/dist/index.js
1775
+ //#region ../../node_modules/.pnpm/@inquirer+confirm@6.3.5_@types+node@26.6.6/node_modules/@inquirer/confirm/dist/index.js
1771
1776
  const confirmTheme = {
1772
1777
  keywords: {
1773
1778
  yes: "Yes",
@@ -1841,7 +1846,7 @@ var dist_default$2 = createPrompt((config, done) => {
1841
1846
  });
1842
1847
 
1843
1848
  //#endregion
1844
- //#region ../../node_modules/.pnpm/@inquirer+input@5.1.7_@types+node@26.6.5/node_modules/@inquirer/input/dist/index.js
1849
+ //#region ../../node_modules/.pnpm/@inquirer+input@5.1.9_@types+node@26.6.6/node_modules/@inquirer/input/dist/index.js
1845
1850
  const inputTheme = { validationFailureMode: "keep" };
1846
1851
  var dist_default$1 = createPrompt((config, done) => {
1847
1852
  const { prefill = "tab" } = config;
@@ -1911,7 +1916,7 @@ var dist_default$1 = createPrompt((config, done) => {
1911
1916
  });
1912
1917
 
1913
1918
  //#endregion
1914
- //#region ../../node_modules/.pnpm/@inquirer+select@5.2.6_@types+node@26.6.5/node_modules/@inquirer/select/dist/index.js
1919
+ //#region ../../node_modules/.pnpm/@inquirer+select@5.2.8_@types+node@26.6.6/node_modules/@inquirer/select/dist/index.js
1915
1920
  const selectTheme = {
1916
1921
  icon: { cursor: figures.pointer },
1917
1922
  style: {
@@ -2146,18 +2151,18 @@ async function runRepl(seed) {
2146
2151
  }));
2147
2152
  const embedder = seed.embedder ?? await dist_default({
2148
2153
  message: "Semantic recall embedder:",
2149
- default: "minilm",
2154
+ default: "bge-base",
2150
2155
  choices: [
2151
2156
  {
2152
- name: "minilm — all-MiniLM-L6-v2, in-process (recommended)",
2153
- value: "minilm"
2157
+ name: "bge-base — bge-base-en-v1.5, in-process (recommended)",
2158
+ value: "bge-base"
2154
2159
  },
2155
2160
  {
2156
- name: "bge-base — bge-base-en-v1.5, in-process, slower and stronger",
2157
- value: "bge-base"
2161
+ name: "minilm — all-MiniLM-L6-v2, in-process, smaller and faster",
2162
+ value: "minilm"
2158
2163
  },
2159
2164
  {
2160
- name: "ollama — bge-m3 via local Ollama",
2165
+ name: "ollama — bge-base-en-v1.5 via local Ollama",
2161
2166
  value: "ollama"
2162
2167
  },
2163
2168
  {
@@ -2166,6 +2171,28 @@ async function runRepl(seed) {
2166
2171
  }
2167
2172
  ]
2168
2173
  });
2174
+ const ask = async (message, fallback, flag) => Number(await dist_default$1({
2175
+ message,
2176
+ default: String(fallback),
2177
+ validate: (v) => {
2178
+ try {
2179
+ parsePositive(flag, v);
2180
+ return true;
2181
+ } catch (err) {
2182
+ return err.message;
2183
+ }
2184
+ }
2185
+ }));
2186
+ let { rowsPerDay, retentionDays, readTargetMs, writeHeavy } = seed;
2187
+ if (seed.profile === void 0 && process.stdin.isTTY === true) {
2188
+ rowsPerDay ??= await ask("Expected rows written per day:", DEFAULT_SIZING.rowsPerDay, "rows-per-day");
2189
+ retentionDays ??= await ask("Days of data to keep:", DEFAULT_SIZING.retentionDays, "retention-days");
2190
+ readTargetMs ??= await ask("Read latency target (ms):", DEFAULT_SIZING.readTargetMs, "read-target-ms");
2191
+ writeHeavy = writeHeavy || await dist_default$2({
2192
+ message: "Is write throughput a priority?",
2193
+ default: false
2194
+ });
2195
+ }
2169
2196
  const tls = seed.tls || await dist_default$2({
2170
2197
  message: "Terminate TLS in the binary (HTTPS)?",
2171
2198
  default: false
@@ -2204,6 +2231,11 @@ async function runRepl(seed) {
2204
2231
  tls,
2205
2232
  tlsCertPath,
2206
2233
  tlsKeyPath,
2234
+ rowsPerDay,
2235
+ retentionDays,
2236
+ readTargetMs,
2237
+ writeHeavy,
2238
+ profile: seed.profile,
2207
2239
  yes: true,
2208
2240
  force
2209
2241
  };
@@ -1,6 +1,5 @@
1
- import { E as Row, s as FieldInput } from "./schema-g4FQLr0V.js";
2
- import { l as BridgeCredential } from "./runtime-metrics-DwpDJ8vz.js";
3
- import { J as AutoCrudVerb, Q as PolicyDecision, Z as Policy, et as RequestContext } from "./plugin-t2g2wX0b.js";
1
+ import { Ln as Row, _t as PolicyDecision, gt as Policy, in as WhereClause, l as FieldInput, n as Dropped, p as PlanClause, pt as AutoCrudVerb, yt as RequestContext } from "./schema-laGLMvMC.js";
2
+ import { n as BridgeCredential } from "./bridge-BhiJKwfF.js";
4
3
  //#region ../../packages/substrate-types/src/nl.d.ts
5
4
  /**
6
5
  * The engine-dispatchable frame a successful NL translation produces. Keys
@@ -49,11 +48,16 @@ interface NlAskRequest {
49
48
  project?: string;
50
49
  /** Force the reading to this type; resubmit a clarify option's `type`. Must name a type of the namespace. */
51
50
  type?: string;
51
+ /**
52
+ * "Now" for relative dates and month-day year inference: ISO-8601 date-time with an
53
+ * offset (`2026-10-02T12:00:00-05:00`). Ranges are in its offset. Defaults to the server clock.
54
+ */
55
+ asOf?: string;
52
56
  }
53
57
  type NlParseStatus = 'resolved' | 'ambiguous' | 'partial' | 'clarify' | 'refuse' | 'unparsed';
54
58
  interface NlEvidence {
55
59
  span: string;
56
- role: 'id' | 'type' | 'value' | 'time' | 'order' | 'count' | 'scope' | 'field' | 'author' | 'history';
60
+ role: 'id' | 'type' | 'value' | 'time' | 'order' | 'count' | 'aggregate' | 'scope' | 'field' | 'author' | 'history';
57
61
  detail: string;
58
62
  }
59
63
  type NlJudgeAction = 'pick' | 'type' | 'bind' | 'recall' | 'clarify' | 'refuse' | 'escalate';
@@ -74,17 +78,45 @@ interface NlJudgeStep {
74
78
  choice?: NlJudgeChoice;
75
79
  /** Why the reply was not applied. */
76
80
  rejected?: string;
81
+ /** Keys of an applied reply outside the offered options (a walk, a comparison), ignored. */
82
+ ignored?: string[];
77
83
  }
78
- /** What an ask answered. The four kinds are exhaustive. */
84
+ /** What an ask answered. The five kinds are exhaustive. */
79
85
  type NlOutcome = {
80
86
  kind: 'rows';
81
87
  frame: Query;
82
88
  answer: string;
83
- /** Absent on the wire when the engine rejected the frame; `errors` then says why. */
89
+ /**
90
+ * Absent on the wire when the engine rejected the frame; `errors` then says why.
91
+ * On a `count` answer it is the engine's `{ count }`, or the first page of rows
92
+ * when the server could not count and the rows were paged instead.
93
+ */
84
94
  data: unknown;
95
+ /** On a `count` answer: every row the frame matches. Absent when counting stopped short, with `errors` saying why. */
96
+ count?: number;
97
+ /**
98
+ * On an `aggregate` answer: `fn` of `field` over the rows the frame matches,
99
+ * as one `value`, or per group keyed by `by` (a field, or the `day`/`hour`
100
+ * date group). Absent when the engine refused the frame, with `errors` saying why.
101
+ */
102
+ aggregate?: NlAggregate;
85
103
  errors?: unknown[];
86
104
  source: 'parser' | 'judge' | 'handoff';
87
105
  handoff?: string;
106
+ /** Parts of the question this answer does not reflect. Empty when nothing was lost. */
107
+ dropped: Dropped[];
108
+ /** The plan the frame ran, clause by clause, with the engine's served flags where it gave them. */
109
+ plan: PlanClause[];
110
+ } | {
111
+ /**
112
+ * The question cannot be answered without fabricating: something that
113
+ * changes which rows count was dropped from a count, aggregate, `$ref`
114
+ * or pick reading. Nothing ran; `dropped` says what, `plan` what was understood.
115
+ */
116
+ kind: 'unknown';
117
+ question: string;
118
+ dropped: Dropped[];
119
+ plan: PlanClause[];
88
120
  } | {
89
121
  kind: 'recall';
90
122
  query: string;
@@ -104,17 +136,33 @@ type NlOutcome = {
104
136
  kind: 'refuse';
105
137
  reason: string;
106
138
  };
139
+ interface NlAggregate {
140
+ fn: 'avg' | 'sum' | 'min' | 'max';
141
+ field: string;
142
+ by?: string;
143
+ /** Null when no row has a value (an empty set, or every value null). */
144
+ value?: number | string | null;
145
+ /** `key: null` is the rows with no value in the group field. */
146
+ groups?: {
147
+ key: string | boolean | null;
148
+ value: number | string | null;
149
+ }[];
150
+ /** More groups exist than were returned. */
151
+ truncated?: true;
152
+ }
107
153
  interface NlParsedData {
108
154
  status: NlParseStatus;
109
155
  frame?: Query;
110
156
  evidence: NlEvidence[];
111
157
  residual: string[];
112
158
  reason?: string;
159
+ /** The clock the question was read against: the request's `asOf`, else the server's. */
160
+ asOf?: string;
113
161
  }
114
162
  type NlJudgedStatus = 'resolved' | 'recall' | 'clarify' | 'refuse' | 'escalated';
115
163
  /**
116
- * One SSE event, discriminated by the SSE event name. The terminal answer is
117
- * named by its outcome kind (`rows` | `recall` | `clarify` | `refuse`) and
164
+ * One stream event, discriminated by `event`. The terminal answer is
165
+ * named by its outcome kind (`rows` | `recall` | `clarify` | `refuse` | `unknown`) and
118
166
  * carries the whole outcome; `done` always follows. An in-band `error` event
119
167
  * is not in this union: the client throws on it.
120
168
  */
@@ -152,12 +200,17 @@ type NlWireEvent = {
152
200
  data: Extract<NlOutcome, {
153
201
  kind: 'refuse';
154
202
  }>;
203
+ } | {
204
+ event: 'unknown';
205
+ data: Extract<NlOutcome, {
206
+ kind: 'unknown';
207
+ }>;
155
208
  } | {
156
209
  event: 'done';
157
210
  data: Record<string, never>;
158
211
  };
159
212
  /**
160
- * The JSON encoding's trail spells the terminal event `outcome`, where SSE
213
+ * The JSON encoding's trail spells the terminal event `outcome`, where the stream
161
214
  * names it by the outcome kind.
162
215
  */
163
216
  type NlTrailEvent = ({
@@ -185,8 +238,11 @@ interface NlPackField {
185
238
  /** `metadata` marks a server-managed virtual (createdAt, createdById, ...). */
186
239
  kind: 'scalar' | 'crossRef' | 'list' | 'struct' | 'metadata';
187
240
  valueType?: string;
188
- /** crossRef target type. */
189
- target?: string;
241
+ /** crossRef target. */
242
+ target?: {
243
+ namespace: string;
244
+ type: string;
245
+ };
190
246
  indexed: boolean;
191
247
  operators: string[];
192
248
  phrases: string[];
@@ -224,7 +280,25 @@ interface NlValueAlias {
224
280
  startsWith?: string;
225
281
  contains?: string;
226
282
  }
283
+ /** One `fieldPhrases` ruling: what a phrase binds to. Field refs are `'<Type>.<field>'` in the ruling's namespace. */
284
+ interface NlFieldPhrase {
285
+ field?: string;
286
+ /** Needs `field`: an equality binding ("valued PSA 9" -> Cert.grade = 9). */
287
+ value?: unknown;
288
+ /** Needs `field`: the implicit filter on that field's type. Never silent: it shows in `plan`. */
289
+ exclude?: WhereClause;
290
+ /** A difference (`sub`) or quotient (`div`) that orders; operands are `'<Type>.<field>'`, both on one type. */
291
+ select?: {
292
+ sub: [string, string];
293
+ } | {
294
+ div: [string, string];
295
+ };
296
+ /** A namespace default pick for this phrase. */
297
+ pick?: 'latest' | 'max' | 'min';
298
+ }
227
299
  interface NlNamespaceRulings {
300
+ /** Phrases bound to fields, values, implicit filters, computed orderings and pick defaults. Keys are normalised (trimmed, single-spaced, lower-cased). */
301
+ fieldPhrases?: Record<string, NlFieldPhrase>;
228
302
  /** Types never scoped to the asking project (their `project` means "belongs to", not "applies to"). */
229
303
  unscopedTypes?: string[];
230
304
  /** Extra phrases naming a type, e.g. `backlog` -> Task. Win over the generated phrases. */
@@ -248,6 +322,12 @@ interface NlNamespaceRulings {
248
322
  typeNotes?: Record<string, string>;
249
323
  /** A phrase that means a predicate, e.g. `accepted` -> Decision.status in [active, accepted]. */
250
324
  valueAliases?: Record<string, NlValueAlias[]>;
325
+ /**
326
+ * Rows of a type that never count unless asked for, e.g. `Run` -> `{ status: { in: ['skipped'] } }`.
327
+ * Applied as `NOT <clause>` whenever NL reads the type, as the seed or through a walk,
328
+ * and shown in `plan` as `ruling:<Type> default exclude`.
329
+ */
330
+ typeExcludes?: Record<string, WhereClause>;
251
331
  }
252
332
  /** The body of `GET /substrate/v1/nl/pack/:ns`. */
253
333
  interface NlServedPack extends NlNamespacePack {
@@ -716,4 +796,4 @@ declare function row<T>(predicate: (ctx: RequestContext, row: T) => boolean): Po
716
796
  */
717
797
  declare function applyRowFilters<T>(decision: PolicyDecision, rows: T[], ctx: RequestContext): T[];
718
798
  //#endregion
719
- export { NlJudgeStep as $, and as A, SYSTEM_NAMESPACE as B, flattenGrant as C, parseGrantEntries as D, intersectGrants as E, TokenProviderOpts as F, resolveAdminCredential as G, isActiveAdminKeyRow as H, adminClaimCapabilities as I, NlAskRequest as J, resolveDefaultKeyPath as K, isEncryptedKey as L, or as M, ADMIN_CAPABILITIES as N, decodeList as O, DEFAULT_CAPABILITIES as P, NlJudgeChoice as Q, makeAuthorizationProvider as R, expandFlat as S, grantIsUniform as T, AdminCredential as U, describeGrant as V, AdminEnv as W, NlEvidence as X, NlAskResult as Y, NlJudgeAction as Z, newlyGrantedPairs as _, denyAll as a, NlPackType as at, capabilitiesFor as b, requireIdentity as c, NlParsedData as ct, KeyUpdateRefusal as d, NlValueAlias as dt, NlJudgedStatus as et, checkRevocable as f, NlWireEvent as ft, newlyGranted as g, Query as gt, grantEntriesConfer as h, NLVocabularyHint as ht, allowVerbs as i, NlPackField as it, not as j, encodeList as k, requireNamespace as l, NlServedPack as lt, grantCovers as m, NLResult as mt, row as n, NlNamespaceRulings as nt, denyVerbs as o, NlPackValueRef as ot, checkUpdatable as p, NLBase as pt, resolveDefaultKidPath as q, allowAll as r, NlOutcome as rt, requireCapability as s, NlParseStatus as st, applyRowFilters as t, NlNamespacePack as tt, KeyMutationRefusal as u, NlTrailEvent as ut, revokedAtIso as v, grantEntryError as w, encodeGrant as x, Grant as y, makeTokenProvider as z };
799
+ export { NlJudgeAction as $, and as A, SYSTEM_NAMESPACE as B, flattenGrant as C, parseGrantEntries as D, intersectGrants as E, TokenProviderOpts as F, resolveAdminCredential as G, isActiveAdminKeyRow as H, adminClaimCapabilities as I, NlAggregate as J, resolveDefaultKeyPath as K, isEncryptedKey as L, or as M, ADMIN_CAPABILITIES as N, decodeList as O, DEFAULT_CAPABILITIES as P, NlFieldPhrase as Q, makeAuthorizationProvider as R, expandFlat as S, grantIsUniform as T, AdminCredential as U, describeGrant as V, AdminEnv as W, NlAskResult as X, NlAskRequest as Y, NlEvidence as Z, newlyGrantedPairs as _, NLVocabularyHint as _t, denyAll as a, NlOutcome as at, capabilitiesFor as b, requireIdentity as c, NlPackValueRef as ct, KeyUpdateRefusal as d, NlServedPack as dt, NlJudgeChoice as et, checkRevocable as f, NlTrailEvent as ft, newlyGranted as g, NLResult as gt, grantEntriesConfer as h, NLBase as ht, allowVerbs as i, NlNamespaceRulings as it, not as j, encodeList as k, requireNamespace as l, NlParseStatus as lt, grantCovers as m, NlWireEvent as mt, row as n, NlJudgedStatus as nt, denyVerbs as o, NlPackField as ot, checkUpdatable as p, NlValueAlias as pt, resolveDefaultKidPath as q, allowAll as r, NlNamespacePack as rt, requireCapability as s, NlPackType as st, applyRowFilters as t, NlJudgeStep as tt, KeyMutationRefusal as u, NlParsedData as ut, revokedAtIso as v, Query as vt, grantEntryError as w, encodeGrant as x, Grant as y, makeTokenProvider as z };