@mnmal-ai/substrate 1.0.0-alpha.10 → 1.0.0-alpha.12
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.
- package/README.md +4 -2
- package/dist/{boot-store-BVqfFxh1.js → boot-store-DHv9H1Gr.js} +170 -69
- package/dist/{bridge-Cp4PaIYO.d.ts → bridge-DQyQ6Qhn.d.ts} +1 -1
- package/dist/{cli-hSCBywhE.js → cli-_UNdneXr.js} +44 -24
- package/dist/client.d.ts +3 -4
- package/dist/client.js +3 -3
- package/dist/{errors-7mycvNGq.d.ts → errors-xP9Mo7Q1.d.ts} +38 -4
- package/dist/{index-DgSfwx7M.d.ts → index-baF5A5jU.d.ts} +1 -1
- package/dist/pack.d.ts +2 -2
- package/dist/pack.js +1 -1
- package/dist/{pg-edges-store-Lxsl5ZnK.js → pg-edges-store-B4FSN9yp.js} +72 -9
- package/dist/{plugin-CtwOINCM.js → plugin-BLm5IRdX.js} +2 -2
- package/dist/proposals-bootstrap.js +2 -2
- package/dist/proposals.d.ts +2 -3
- package/dist/proposals.js +1 -1
- package/dist/recall-bootstrap.js +2 -2
- package/dist/recall.d.ts +10 -11
- package/dist/recall.js +2 -2
- package/dist/{repl-DqfHelK7.js → repl-DUJGBwie.js} +25 -25
- package/dist/{row-BKKCXIG6.d.ts → row-Cu_iRhcR.d.ts} +57 -10
- package/dist/{run-B5dTbZ3g.js → run-BpsTNvdI.js} +539 -145
- package/dist/{dataset-CejF-Fr_.d.ts → schema-oXfQyo0s.d.ts} +2455 -1589
- package/dist/sdk.d.ts +108 -34
- package/dist/sdk.js +4 -4
- package/dist/{src-CqT-QWZ_.js → src-Bew_JvTo.js} +32 -16
- package/dist/{src-Da0t6si5.js → src-Bi3NhEsT.js} +1 -1
- package/dist/{src-5SJ5GEIM.js → src-C4t1Gy-m.js} +4844 -1367
- package/dist/{src-7CUSMK66.js → src-CHND7-Pm.js} +7 -3
- package/dist/src-CSe2tJDf.js +6940 -0
- package/dist/{src-Bi849yhn.js → src-CzhKLsOV.js} +175 -91
- package/dist/{src-hZb8wfvg.js → src-DWqzrm3O.js} +400 -284
- package/dist/substrate-admin.js +1 -1
- package/dist/substrate.js +1 -1
- package/dist/testing.d.ts +255 -90
- package/dist/testing.js +6 -23
- package/dist/{ws-ByZyHk7m.d.ts → ws-Dx3A2B4U.d.ts} +2 -3
- package/package.json +20 -20
- package/dist/schema-DoSc-4ig.d.ts +0 -470
- package/dist/src-CyvV7dCK.js +0 -4333
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { createRequire as __binCreateRequire } from 'node:module'; const require = __binCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
2
|
+
import { Qt as validateHardDeleteEnv, _ as AUDIT_EVENT_TYPE, et as loadSweepState, g as buildAuditRow, m as runInviteSweep, nt as saveSweepState, tt as runSweep, u as isStoreProfileName, v as INVITE_TYPE } from "./src-C4t1Gy-m.js";
|
|
3
3
|
import { n as trimTrailingSlashes, s as makeAuthorizationProvider } from "./env-utils-CGNazUNt.js";
|
|
4
|
-
import { L as encodeList, T as SYSTEM_NAMESPACE, f as coversNamespace, m as grantedIn, p as grantOf } from "./src-
|
|
5
|
-
import "./src-
|
|
6
|
-
import {
|
|
7
|
-
import { a as SubstrateClient, d as NetworkError, i as tokenAudience, n as resolveAgentCapabilities, p as AdminBackfillError, r as noRedirectFetch, t as createClientFromEnv, u as AuthError } from "./src-
|
|
4
|
+
import { L as encodeList, T as SYSTEM_NAMESPACE, f as coversNamespace, m as grantedIn, p as grantOf } from "./src-Bi3NhEsT.js";
|
|
5
|
+
import "./src-DWqzrm3O.js";
|
|
6
|
+
import { Y as AdminCliError, _ as openPgDataset, a as parseBridgeCreds, f as reportUnguardedIndexBuilds, g as version, i as MS_PER_DAY, m as startSentinelClient, n as resolvePluginDir, o as parseBridges, p as runDeferredIndexBuilds, s as parseEnv, t as bootStore, u as redactStoreSpec } from "./boot-store-DHv9H1Gr.js";
|
|
7
|
+
import { a as SubstrateClient, d as NetworkError, i as tokenAudience, n as resolveAgentCapabilities, p as AdminBackfillError, r as noRedirectFetch, t as createClientFromEnv, u as AuthError } from "./src-CHND7-Pm.js";
|
|
8
8
|
import { n as runScript, t as DEFAULT_MAX_WRITES } from "./script-C6DSa_Na.js";
|
|
9
|
-
import {
|
|
10
|
-
import { n as PgLexicalStore, r as PgEmbeddingsStore } from "./src-
|
|
9
|
+
import { w as tryWithPgAdvisoryLock } from "./src-CSe2tJDf.js";
|
|
10
|
+
import { n as PgLexicalStore, r as PgEmbeddingsStore } from "./src-CzhKLsOV.js";
|
|
11
11
|
import { chmodSync, existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
12
12
|
import { homedir, hostname } from "node:os";
|
|
13
13
|
import { basename, dirname, join, resolve } from "node:path";
|
|
@@ -17,6 +17,18 @@ import { z } from "zod";
|
|
|
17
17
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
18
18
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
19
19
|
|
|
20
|
+
//#region ../../node_modules/.pnpm/@mnmal-ai+surface-core@0.15.0_ink@8.0.0_@types+react@19.3.0_react@19.3.1__react@19.3.1/node_modules/@mnmal-ai/surface-core/dist/overlay-DMjCbsaC.js
|
|
21
|
+
const SEGMENTER = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
22
|
+
const OSC = /(?:\u001b\]|\u009d)[^\u0007\u001b\u009c]*(?:\u0007|\u009c|\u001b\\)?/g;
|
|
23
|
+
const CSI = /(?:\u001b\[|\u009b)[0-?]*[ -/]*[@-~]?/g;
|
|
24
|
+
const ESC_PAIR = /\u001b[ -~]?/g;
|
|
25
|
+
const CONTROL = /[\u0000-\u0008\u000b-\u001f\u007f-\u009f]/g;
|
|
26
|
+
/** Strips ESC sequences and C0/C1 control characters; keeps `\n`, and a tab becomes a space. */
|
|
27
|
+
function sanitise(text) {
|
|
28
|
+
return text.replace(/\t/g, " ").replace(OSC, "").replace(CSI, "").replace(ESC_PAIR, "").replace(CONTROL, "");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
20
32
|
//#region src/cli/ask/main.ts
|
|
21
33
|
const USAGE$1 = "usage: substrate ask [--ns <namespace>] [--project <name>] [--json] <question…>\n";
|
|
22
34
|
async function runAsk(argv, options = {}) {
|
|
@@ -64,7 +76,7 @@ async function runAsk(argv, options = {}) {
|
|
|
64
76
|
...options.fetchImpl !== void 0 ? { fetch: options.fetchImpl } : {}
|
|
65
77
|
}));
|
|
66
78
|
} catch (err) {
|
|
67
|
-
write(`substrate ask: agent identity: ${messageOf$1(err)}\n`);
|
|
79
|
+
write(`substrate ask: agent identity: ${sanitise(messageOf$1(err))}\n`);
|
|
68
80
|
return 2;
|
|
69
81
|
}
|
|
70
82
|
let result;
|
|
@@ -76,15 +88,15 @@ async function runAsk(argv, options = {}) {
|
|
|
76
88
|
});
|
|
77
89
|
} catch (err) {
|
|
78
90
|
if (err instanceof NetworkError && err.status === 404 && err.code !== "nl_unknown_namespace") write("substrate ask: the server has no NL route (is @mnmal-ai/substrate-nl installed?)\n");
|
|
79
|
-
else if (err instanceof NetworkError && err.serverMessage !== void 0) write(`substrate ask: ${err.serverMessage}\n`);
|
|
80
|
-
else write(`substrate ask: ${messageOf$1(err)}\n`);
|
|
91
|
+
else if (err instanceof NetworkError && err.serverMessage !== void 0) write(`substrate ask: ${sanitise(err.serverMessage)}\n`);
|
|
92
|
+
else write(`substrate ask: ${sanitise(messageOf$1(err))}\n`);
|
|
81
93
|
return 1;
|
|
82
94
|
}
|
|
83
95
|
const outcome = result.outcome;
|
|
84
|
-
if (json) write(`${JSON.stringify(result, null, 2)}\n`);
|
|
85
|
-
else write(render(outcome));
|
|
96
|
+
if (json) write(`${JSON.stringify(result, null, 2).replace(/[\u0080-\u009f]/g, (c) => `\\u${c.charCodeAt(0).toString(16).padStart(4, "0")}`)}\n`);
|
|
97
|
+
else write(render(outcome).split("\n").map(sanitise).join("\n"));
|
|
86
98
|
if (outcome === null) return 0;
|
|
87
|
-
if (outcome.kind === "refuse") return 1;
|
|
99
|
+
if (outcome.kind === "refuse" || outcome.kind === "unknown") return 1;
|
|
88
100
|
if (outcome.kind === "rows" && Array.isArray(outcome.errors) && outcome.errors.length > 0) return 1;
|
|
89
101
|
return 0;
|
|
90
102
|
}
|
|
@@ -97,11 +109,11 @@ function render(o) {
|
|
|
97
109
|
case "rows": {
|
|
98
110
|
const key = Object.keys(o.frame)[0] ?? "?";
|
|
99
111
|
const rows = Array.isArray(o.data) ? o.data : void 0;
|
|
100
|
-
const tail = rows === void 0 ? "rejected" : `${rows.length} rows`;
|
|
112
|
+
const tail = o.count !== void 0 ? `count ${o.count}` : rows === void 0 ? "rejected" : `${rows.length} rows`;
|
|
101
113
|
const head = `▸ ${key} · ${o.source}${o.handoff !== void 0 ? ` (${o.handoff})` : ""} · ${tail}\n`;
|
|
102
114
|
const errs = (o.errors ?? []).map((e) => ` ✗ ${JSON.stringify(e)}\n`).join("");
|
|
103
115
|
const body = (rows ?? []).map((r) => ` ${String(r.shortId ?? r.id ?? "")} ${String(r.title ?? r.synopsis ?? r.name ?? "")}\n`).join("");
|
|
104
|
-
return head + errs + body;
|
|
116
|
+
return head + errs + droppedText(o.dropped) + body;
|
|
105
117
|
}
|
|
106
118
|
case "recall": {
|
|
107
119
|
const errs = (o.errors ?? []).map((e) => ` ✗ ${JSON.stringify(e)}\n`).join("");
|
|
@@ -114,8 +126,15 @@ function render(o) {
|
|
|
114
126
|
return `? ${o.reason}\n${opts.map((x, i) => ` ${i + 1}. ${x.label}\n`).join("")}`;
|
|
115
127
|
}
|
|
116
128
|
case "refuse": return `✗ ${o.reason}\n`;
|
|
129
|
+
case "unknown": return `? unknown: not answered, because part of the question was dropped\n${droppedText(o.dropped)}${planText(o.plan)}`;
|
|
117
130
|
}
|
|
118
131
|
}
|
|
132
|
+
function droppedText(dropped) {
|
|
133
|
+
return (dropped ?? []).map((d) => ` dropped "${d.span}": ${d.reason}\n`).join("");
|
|
134
|
+
}
|
|
135
|
+
function planText(plan) {
|
|
136
|
+
return (plan ?? []).map((c) => ` plan ${c.path.join(".")} (${c.kind})\n`).join("");
|
|
137
|
+
}
|
|
119
138
|
|
|
120
139
|
//#endregion
|
|
121
140
|
//#region src/cli/backfill-field/main.ts
|
|
@@ -829,6 +848,8 @@ function installShutdown(args) {
|
|
|
829
848
|
* SUBSTRATE_BODY_LIMIT_BYTES max request body size in bytes (optional). Unset =
|
|
830
849
|
* Fastify's 1 MiB default. Raise for bulk batched
|
|
831
850
|
* mutation frames that exceed 1 MiB.
|
|
851
|
+
* SUBSTRATE_STATEMENT_TIMEOUT_MS statement timeout for walk reads in ms (default 30000);
|
|
852
|
+
* a cancelled read is refused `query_timeout`
|
|
832
853
|
* SUBSTRATE_SWEEP_INTERVAL_MS sweep cadence in ms (default 300000)
|
|
833
854
|
* SUBSTRATE_INVITE_SWEEP_INTERVAL_MS invite reaper cadence in ms (default 3600000 = 1h)
|
|
834
855
|
* SUBSTRATE_TOMBSTONE_RETENTION_DAYS retention window for tombstoned rows /
|
|
@@ -2138,7 +2159,7 @@ async function runInit(argv) {
|
|
|
2138
2159
|
return 1;
|
|
2139
2160
|
}
|
|
2140
2161
|
if (!config.yes) try {
|
|
2141
|
-
const { runRepl } = await import("./repl-
|
|
2162
|
+
const { runRepl } = await import("./repl-DUJGBwie.js");
|
|
2142
2163
|
config = await runRepl(config);
|
|
2143
2164
|
} catch (err) {
|
|
2144
2165
|
if (err.message?.includes("User force closed")) return 130;
|
|
@@ -2467,7 +2488,7 @@ function schemaOverview(federated) {
|
|
|
2467
2488
|
for (const [ns, schema] of Object.entries(federated)) {
|
|
2468
2489
|
const typeDefs = schema.types ?? {};
|
|
2469
2490
|
const types = {};
|
|
2470
|
-
for (const [name, def] of Object.entries(typeDefs)) types[safe(name, NAME)] = Object.entries(def.fields ?? {}).map(([field, shape]) => `${safe(field, NAME)}: ${fieldType(shape, ns)}`).join(", ");
|
|
2491
|
+
for (const [name, def] of Object.entries(typeDefs)) types[safe(name, NAME)] = [...Object.entries(def.fields ?? {}).map(([field, shape]) => `${safe(field, NAME)}: ${fieldType(shape, ns)}`), ...(def.inboundRefs ?? []).map((r) => `←${safe(r.type, NAME)}.${safe(r.field, NAME)}`)].join(", ");
|
|
2471
2492
|
const mutations = Object.keys(schema.mutations ?? {}).filter((m) => {
|
|
2472
2493
|
const crud = AUTO_CRUD.exec(m);
|
|
2473
2494
|
return !(crud?.[2] !== void 0 && crud[2] in typeDefs);
|
|
@@ -2479,8 +2500,7 @@ function schemaOverview(federated) {
|
|
|
2479
2500
|
}
|
|
2480
2501
|
return out;
|
|
2481
2502
|
}
|
|
2482
|
-
|
|
2483
|
-
const OVERVIEW_LEGEND = "Each type is `field: type` pairs. `a|b` is an enum, `?` nullable, `T[]` a list, `→Type` a reference (`→ns/Type` across namespaces). No field needs an index to filter; json filters by path only, and only non-json scalars sort. [readonly] fields are server-set. Generated get/create/update/delete<Type> mutations are not listed; `mutations` holds the rest. For a type's exact write contract call `schema` with `namespace` and `type`.";
|
|
2503
|
+
const overviewLegend = "Each type is `field: type` pairs. `a|b` is an enum, `?` nullable, `T[]` a list, `→Type` a reference (`→ns/Type` across namespaces). No field needs an index to filter; json filters by path only, and only non-json scalars sort. [readonly] fields are server-set. Generated get/create/update/delete<Type> mutations are not listed; `mutations` holds the rest. For a type's exact write contract call `schema` with `namespace` and `type`. `←Type.field` is a reference TO this type; follow it backwards with `_walk: { in: \"ns/Type.field\" }` in `where`, as a nested `fields` entry, or in `_agg`.";
|
|
2484
2504
|
/** Past this, the instructions carry only type names; the full overview is one `schema` call away. */
|
|
2485
2505
|
const INSTRUCTIONS_OVERVIEW_MAX = 12e3;
|
|
2486
2506
|
const CONVENTIONS = [
|
|
@@ -2497,7 +2517,7 @@ const CONVENTIONS = [
|
|
|
2497
2517
|
function buildInstructions(overview) {
|
|
2498
2518
|
if (overview === null) return `${CONVENTIONS}\n\nThe type list was unavailable at session start; call \`schema\` with no arguments for it.`;
|
|
2499
2519
|
const full = JSON.stringify(overview);
|
|
2500
|
-
const body = full.length <= INSTRUCTIONS_OVERVIEW_MAX ? `${
|
|
2520
|
+
const body = full.length <= INSTRUCTIONS_OVERVIEW_MAX ? `${overviewLegend}\n${full}` : `Type names only (the full overview is large; call \`schema\` with no arguments for fields):\n${JSON.stringify(Object.fromEntries(Object.entries(overview).map(([ns, o]) => [ns, Object.keys(o.types)])))}`;
|
|
2501
2521
|
return `${CONVENTIONS}\n\nTypes on this server at session start:\n${body}`;
|
|
2502
2522
|
}
|
|
2503
2523
|
|
|
@@ -2659,7 +2679,7 @@ function createSchemaHandler(endpoint) {
|
|
|
2659
2679
|
if ((ns === void 0 || ns === "") && args?.full !== true) try {
|
|
2660
2680
|
const federated = await getSubstrate(endpoint, "/substrate/v1/federated-schema");
|
|
2661
2681
|
return okResult({
|
|
2662
|
-
legend:
|
|
2682
|
+
legend: overviewLegend,
|
|
2663
2683
|
overview: schemaOverview(federated)
|
|
2664
2684
|
});
|
|
2665
2685
|
} catch (err) {
|
|
@@ -2805,7 +2825,7 @@ function createMcpServer(endpoint, options = {}) {
|
|
|
2805
2825
|
{
|
|
2806
2826
|
name: "query",
|
|
2807
2827
|
config: {
|
|
2808
|
-
description: "Query Substrate. payload is a single frame object mapping qualified keys (<ns>/<Type>) to { params, fields }. ONE call can span multiple namespaces — e.g. { \"prices/Price\": {...}, \"products/Product\": {...} }.",
|
|
2828
|
+
description: "Query Substrate. payload is a single frame object mapping qualified keys (<ns>/<Type>) to { params, fields }. ONE call can span multiple namespaces — e.g. { \"prices/Price\": {...}, \"products/Product\": {...} }. WALKS: a reference field is followed backwards with `_walk`, which names the inbound field as \"ns/Type.field\" (the schema overview marks it `←Type.field`). It filters in `where`, aggregates in `fields._agg`, or nests rows in `fields`. Example: orders with an item priced over 50, and their item count: { \"shop/Order\": { \"params\": { \"where\": { \"_walk\": { \"in\": \"shop/Item.order\", \"where\": { \"price\": { \"gt\": 50 } } } } }, \"fields\": { \"id\": true, \"_agg\": { \"items\": { \"in\": \"shop/Item.order\", \"count\": true } } } } }. `out: \"field\"` follows a reference forwards. A `_walk` takes `quantifier` \"any\" (default), \"none\" or \"all\", or `pick` one neighbour by { \"latest\": <date> }, { \"max\": <f> } or { \"min\": <f> }; an \"any\" walk binds `as: \"L\"`, and a later comparison reads it as { \"$ref\": \"L.price\", \"times\": 1.25 } (`$.f` is the seed row, `_agg.<name>` an aggregate; `times`/`plus` scale numbers, `plus` shifts a date in ms). `_agg` also takes avg/sum/min/max: <field> or latest: { by, value }, and in `where` compares beside a comparison: { \"_agg\": { \"in\": ..., \"count\": true }, \"gte\": 3 }. Frame params: `count: true` answers { count }; `aggregate: { name: { sum: \"price\" } }` with optional `bucket: { field, by: \"day\"|\"hour\" }` answers groups; `derive: { m: { diff|ratio: [\"_agg.x\", \"$.f\"] } }` is ordered by `orderBy: [{ \"$m\": \"desc\" }]`. Walks are query-only: subscribe, stream and mutate refuse them, as does a store without walks (walks_unsupported_store).",
|
|
2809
2829
|
inputSchema: { payload: payloadSchema("Query frame. Example: { \"default/Todo\": { \"params\": { \"limit\": 20 }, \"fields\": { \"id\": true, \"title\": true } } }") }
|
|
2810
2830
|
},
|
|
2811
2831
|
handler: createQueryHandler(endpoint)
|
|
@@ -2814,14 +2834,14 @@ function createMcpServer(endpoint, options = {}) {
|
|
|
2814
2834
|
name: "mutate",
|
|
2815
2835
|
config: {
|
|
2816
2836
|
description: "Run one or more mutations. payload is a single frame object mapping qualified keys (<ns>/<mutationName>) to { params, fields } (single-frame) or to an array of frames (batched atomic). ONE op-key can accept a single frame or an array. An ARRAY op-key is its own transaction: it commits or rolls back as a unit, independently of every other op-key in the call. The SINGLE-FRAME op-keys share one transaction when they sit on one tx scope (every namespace on one pg handle); across two tx scopes they are refused rather than split. So a single-frame op-key beside an array is NOT rolled back when the array fails — to make writes atomic together, put them in one array under one op-key. The memory dataset mints a fresh tx scope per namespace, so single-frame op-keys in two namespaces are refused there.",
|
|
2817
|
-
inputSchema: { payload: payloadSchema("Mutation frame. Single: { \"default/createTodo\": { \"params\": { \"title\": \"...\" }, \"fields\": { \"id\": true } } }. Batched atomic: { \"default/updateTodo\": [ { \"params\": { \"id\": \"1\", \"done\": true }, \"fields\": { \"id\": true } }, { \"params\": { \"id\": \"2\", \"done\": true }, \"fields\": { \"id\": true } } ] }.") }
|
|
2837
|
+
inputSchema: { payload: payloadSchema("Mutation frame. Single: { \"default/createTodo\": { \"params\": { \"title\": \"...\" }, \"fields\": { \"id\": true } } }. Batched atomic: { \"default/updateTodo\": [ { \"params\": { \"id\": \"1\", \"done\": true }, \"fields\": { \"id\": true } }, { \"params\": { \"id\": \"2\", \"done\": true }, \"fields\": { \"id\": true } } ] }. By filter: { \"default/updateManyTodo\": { \"params\": { \"where\": { \"done\": { \"eq\": false } }, \"set\": { \"done\": true } }, \"fields\": { \"count\": true, \"ids\": true, \"idsTruncated\": true } } }; deleteMany<Type> takes only \"where\".") }
|
|
2818
2838
|
},
|
|
2819
2839
|
handler: createMutateHandler(endpoint)
|
|
2820
2840
|
},
|
|
2821
2841
|
{
|
|
2822
2842
|
name: "ask",
|
|
2823
2843
|
config: {
|
|
2824
|
-
description: "Ask a natural-language question of one namespace. The parser answers first; a constrained judge handles what it escalates; a judge outage hands off honestly. Returns { outcome, trail }, where outcome.kind is rows | recall | clarify | refuse. Read-only. Requires the @mnmal-ai/substrate-nl plugin (404 otherwise).",
|
|
2844
|
+
description: "Ask a natural-language question of one namespace. The parser answers first; a constrained judge handles what it escalates; a judge outage hands off honestly. Returns { outcome, trail }, where outcome.kind is rows | recall | clarify | refuse | unknown. unknown means part of the question was dropped and the answer would change which rows count; it carries dropped and the plan, and nothing ran. rows also carries dropped (what it does not reflect) and plan. Read-only. Requires the @mnmal-ai/substrate-nl plugin (404 otherwise).",
|
|
2825
2845
|
inputSchema: {
|
|
2826
2846
|
namespace: z.string().min(1).describe("Namespace to ask, e.g. \"notes\"."),
|
|
2827
2847
|
question: z.string().min(1).describe("The question, e.g. \"open todos in billing\"."),
|
package/dist/client.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { C as
|
|
3
|
-
import {
|
|
4
|
-
import { s as SchemaDriftError } from "./index-DgSfwx7M.js";
|
|
1
|
+
import { Mn as Row, W as QualifiedFrame, f as PackEnvelope, fn as ResolverStat, gn as SlowRequest, hn as RuntimeMetrics, m as Schema, mn as RuntimeErrors, pn as RuntimeErrorEntry, un as ProcessStat } from "./schema-oXfQyo0s.js";
|
|
2
|
+
import { A as and, B as SYSTEM_NAMESPACE, C as flattenGrant, D as parseGrantEntries, E as intersectGrants, F as TokenProviderOpts, G as resolveAdminCredential, H as isActiveAdminKeyRow, I as adminClaimCapabilities, J as NlAskRequest, K as resolveDefaultKeyPath, L as isEncryptedKey, M as or, N as ADMIN_CAPABILITIES, O as decodeList, P as DEFAULT_CAPABILITIES, R as makeAuthorizationProvider, S as expandFlat, T as grantIsUniform, U as AdminCredential, V as describeGrant, W as AdminEnv, Y as NlAskResult, _ as newlyGrantedPairs, a as denyAll, b as capabilitiesFor, c as requireIdentity, d as KeyUpdateRefusal, dt as NlTrailEvent, f as checkRevocable, g as newlyGranted, h as grantEntriesConfer, i as allowVerbs, it as NlOutcome, j as not, k as encodeList, l as requireNamespace, m as grantCovers, n as row, o as denyVerbs, p as checkUpdatable, pt as NlWireEvent, q as resolveDefaultKidPath, r as allowAll, s as requireCapability, t as applyRowFilters, u as KeyMutationRefusal, ut as NlServedPack, v as revokedAtIso, w as grantEntryError, x as encodeGrant, y as Grant, z as makeTokenProvider } from "./row-Cu_iRhcR.js";
|
|
3
|
+
import { s as SchemaDriftError } from "./index-baF5A5jU.js";
|
|
5
4
|
import { Signal } from "@preact/signals-core";
|
|
6
5
|
//#region ../../packages/substrate-client/src/admin/surgery.d.ts
|
|
7
6
|
type AdminDropCascade = 'refuse' | 'delete';
|
package/dist/client.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createRequire as __binCreateRequire } from 'node:module'; const require = __binCreateRequire(import.meta.url);
|
|
2
2
|
import { a as adminClaimCapabilities, c as makeTokenProvider, d as resolveDefaultKidPath, i as DEFAULT_CAPABILITIES, l as resolveAdminCredential, o as isEncryptedKey, r as ADMIN_CAPABILITIES, s as makeAuthorizationProvider, u as resolveDefaultKeyPath } from "./env-utils-CGNazUNt.js";
|
|
3
|
-
import { A as expandFlat, C as not, D as isActiveAdminKeyRow, E as describeGrant, F as parseGrantEntries, I as decodeList, L as encodeList, M as grantEntryError, N as grantIsUniform, O as capabilitiesFor, P as intersectGrants, S as and, T as SYSTEM_NAMESPACE, _ as grantCovers, a as denyAll, b as newlyGrantedPairs, c as requireIdentity, g as checkUpdatable, h as checkRevocable, i as allowVerbs, j as flattenGrant, k as encodeGrant, l as requireNamespace, n as row, o as denyVerbs, r as allowAll, s as requireCapability, t as applyRowFilters, v as grantEntriesConfer, w as or, x as revokedAtIso, y as newlyGranted } from "./src-
|
|
4
|
-
import {
|
|
5
|
-
import { C as diagnose, S as DIAGNOSE_CHECKS, _ as SKIPPABLE_STEPS, a as SubstrateClient, b as planOnboarding, c as reduceSubscribeRows, d as NetworkError, f as SubscribeError, g as ONBOARD_STEPS, h as CURRENT_MARK, i as tokenAudience, l as watchRows, m as BACKFILL_CHUNK, n as resolveAgentCapabilities, o as collectDiagnostics, p as AdminBackfillError, r as noRedirectFetch, s as createDefaultDiagnosticsSink, t as createClientFromEnv, u as AuthError, v as STEP_MARKS, w as reconcileIdentities, x as requiredOutstanding, y as currentStep } from "./src-
|
|
3
|
+
import { A as expandFlat, C as not, D as isActiveAdminKeyRow, E as describeGrant, F as parseGrantEntries, I as decodeList, L as encodeList, M as grantEntryError, N as grantIsUniform, O as capabilitiesFor, P as intersectGrants, S as and, T as SYSTEM_NAMESPACE, _ as grantCovers, a as denyAll, b as newlyGrantedPairs, c as requireIdentity, g as checkUpdatable, h as checkRevocable, i as allowVerbs, j as flattenGrant, k as encodeGrant, l as requireNamespace, n as row, o as denyVerbs, r as allowAll, s as requireCapability, t as applyRowFilters, v as grantEntriesConfer, w as or, x as revokedAtIso, y as newlyGranted } from "./src-Bi3NhEsT.js";
|
|
4
|
+
import { f as SchemaDriftError } from "./src-DWqzrm3O.js";
|
|
5
|
+
import { C as diagnose, S as DIAGNOSE_CHECKS, _ as SKIPPABLE_STEPS, a as SubstrateClient, b as planOnboarding, c as reduceSubscribeRows, d as NetworkError, f as SubscribeError, g as ONBOARD_STEPS, h as CURRENT_MARK, i as tokenAudience, l as watchRows, m as BACKFILL_CHUNK, n as resolveAgentCapabilities, o as collectDiagnostics, p as AdminBackfillError, r as noRedirectFetch, s as createDefaultDiagnosticsSink, t as createClientFromEnv, u as AuthError, v as STEP_MARKS, w as reconcileIdentities, x as requiredOutstanding, y as currentStep } from "./src-CHND7-Pm.js";
|
|
6
6
|
import { n as runScript, t as DEFAULT_MAX_WRITES } from "./script-C6DSa_Na.js";
|
|
7
7
|
|
|
8
8
|
export { ADMIN_CAPABILITIES, AdminBackfillError, AuthError, BACKFILL_CHUNK, CURRENT_MARK, DEFAULT_CAPABILITIES, DEFAULT_MAX_WRITES, DIAGNOSE_CHECKS, NetworkError, ONBOARD_STEPS, SKIPPABLE_STEPS, STEP_MARKS, SYSTEM_NAMESPACE, SchemaDriftError, SubscribeError, SubstrateClient, adminClaimCapabilities, allowAll, allowVerbs, and, applyRowFilters, capabilitiesFor, checkRevocable, checkUpdatable, collectDiagnostics, createClientFromEnv, createDefaultDiagnosticsSink, currentStep, decodeList, denyAll, denyVerbs, describeGrant, diagnose, encodeGrant, encodeList, expandFlat, flattenGrant, grantCovers, grantEntriesConfer, grantEntryError, grantIsUniform, intersectGrants, isActiveAdminKeyRow, isEncryptedKey, makeAuthorizationProvider, makeTokenProvider, newlyGranted, newlyGrantedPairs, noRedirectFetch, not, or, parseGrantEntries, planOnboarding, reconcileIdentities, reduceSubscribeRows, requireCapability, requireIdentity, requireNamespace, requiredOutstanding, resolveAdminCredential, resolveAgentCapabilities, resolveDefaultKeyPath, resolveDefaultKidPath, revokedAtIso, row, runScript, tokenAudience, watchRows };
|
|
@@ -1,5 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { xn as EdgeRef, yn as Edge } from "./schema-oXfQyo0s.js";
|
|
2
2
|
//#region ../../packages/substrate-types/src/errors.d.ts
|
|
3
|
+
/** A by-filter write matched more rows than `SUBSTRATE_FILTER_WRITE_MAX_MATCH`; nothing changed. */
|
|
4
|
+
declare const FILTER_TOO_BROAD = "filter_too_broad";
|
|
5
|
+
/** Refusal codes for the typed-edge-walk grammar. */
|
|
6
|
+
declare const WALKS_NEED_PARTITIONED = "walks_need_partitioned";
|
|
7
|
+
declare const WALKS_IN_SUBSCRIPTION = "walks_in_subscription";
|
|
8
|
+
declare const WALKS_IN_MUTATION = "walks_in_mutation";
|
|
9
|
+
declare const ROW_POLICY_BLOCKS_WALK = "row_policy_blocks_walk";
|
|
10
|
+
declare const WALK_BUDGET_EXCEEDED = "walk_budget_exceeded";
|
|
11
|
+
declare const WALKS_UNSUPPORTED_STORE = "walks_unsupported_store";
|
|
12
|
+
/** A read cancelled by the store's statement timeout; `details: { timeoutMs }`. */
|
|
13
|
+
declare const QUERY_TIMEOUT = "query_timeout";
|
|
14
|
+
/**
|
|
15
|
+
* A walk construct refused where it cannot be answered: inside a struct, over
|
|
16
|
+
* a list or struct-nested crossRef, under a reused field name, on a virtual
|
|
17
|
+
* type, or on a read path that does not evaluate walks.
|
|
18
|
+
*/
|
|
19
|
+
declare const WALK_UNSUPPORTED_REF = "walk_unsupported_ref";
|
|
3
20
|
/**
|
|
4
21
|
* Throwable by a resolver to surface a structured per-frame error with a
|
|
5
22
|
* caller-chosen `code` instead of the generic `resolver_error`. The engine's
|
|
@@ -29,6 +46,8 @@ declare class ResolverFrameError extends Error {
|
|
|
29
46
|
readonly details?: Record<string, unknown>;
|
|
30
47
|
constructor(code: string, message: string, details?: Record<string, unknown>);
|
|
31
48
|
}
|
|
49
|
+
/** `filter_too_broad`: a by-filter write on `<namespace>/<type>` matched more than `maxMatch` rows. */
|
|
50
|
+
declare function filterTooBroad(namespace: string, type: string, maxMatch: number): ResolverFrameError;
|
|
32
51
|
/**
|
|
33
52
|
* Thrown by a write-path resolver when a crossRef declaring `onMissing: 'reject'`
|
|
34
53
|
* references a target that does not exist (or has been tombstoned). Extends
|
|
@@ -78,11 +97,12 @@ declare class NamespaceMismatch extends Error {
|
|
|
78
97
|
}
|
|
79
98
|
/**
|
|
80
99
|
* Thrown by `Dataset.updateField` when the caller targets a reserved
|
|
81
|
-
* field name (e.g. `_deletedAt`)
|
|
100
|
+
* field name (e.g. `_deletedAt`), and by any other write path that refuses
|
|
101
|
+
* one; `how` names that path in the message. Spec §4.5.
|
|
82
102
|
*/
|
|
83
103
|
declare class ReservedField extends Error {
|
|
84
104
|
readonly name = "ReservedField";
|
|
85
|
-
constructor(field: string);
|
|
105
|
+
constructor(field: string, how?: string);
|
|
86
106
|
}
|
|
87
107
|
/**
|
|
88
108
|
* The `(auth)` tag `HttpBridgeClient` appends to a 401/403 cause. Single
|
|
@@ -105,6 +125,20 @@ declare class BridgeUnreachableError extends Error {
|
|
|
105
125
|
readonly cause: unknown;
|
|
106
126
|
constructor(bridgeName: string, baseUrl: string, cause: unknown);
|
|
107
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* Thrown by a `BatchResolver` to refuse element `index` of its args list. The
|
|
130
|
+
* engine rolls back the whole array and reports `cause` as the per-element
|
|
131
|
+
* resolver would have: a `ResolverFrameError` or `RestrictViolation` keeps
|
|
132
|
+
* its code at `[key]`, and `batched_frame_rolled_back` names the element.
|
|
133
|
+
*/
|
|
134
|
+
declare class BatchElementError extends Error {
|
|
135
|
+
readonly index: number;
|
|
136
|
+
readonly cause: unknown;
|
|
137
|
+
readonly name = "BatchElementError";
|
|
138
|
+
constructor(index: number, cause: unknown);
|
|
139
|
+
}
|
|
140
|
+
/** Recognise a {@link BatchElementError} across module-realm boundaries. */
|
|
141
|
+
declare function isBatchElementError(err: unknown): err is BatchElementError;
|
|
108
142
|
/**
|
|
109
143
|
* Recognise a {@link ResolverFrameError} across module-realm boundaries.
|
|
110
144
|
*
|
|
@@ -127,4 +161,4 @@ declare function isResolverFrameError(err: unknown): err is ResolverFrameError;
|
|
|
127
161
|
*/
|
|
128
162
|
declare function isRestrictViolation(err: unknown): err is RestrictViolation;
|
|
129
163
|
//#endregion
|
|
130
|
-
export {
|
|
164
|
+
export { isRestrictViolation as S, WALK_UNSUPPORTED_REF as _, NamespaceMismatch as a, isBatchElementError as b, ReservedField as c, UnsupportedFilterError as d, WALKS_IN_MUTATION as f, WALK_BUDGET_EXCEEDED as g, WALKS_UNSUPPORTED_STORE as h, MissingReferentError as i, ResolverFrameError as l, WALKS_NEED_PARTITIONED as m, BridgeUnreachableError as n, QUERY_TIMEOUT as o, WALKS_IN_SUBSCRIPTION as p, FILTER_TOO_BROAD as r, ROW_POLICY_BLOCKS_WALK as s, BatchElementError as t, RestrictViolation as u, filterTooBroad as v, isResolverFrameError as x, isAuthCause as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { f as PackEnvelope, i as FieldDef, l as FieldInput, m as Schema } from "./schema-oXfQyo0s.js";
|
|
2
2
|
import { pack as packFrame, unpack as unpackFrame } from "msgpackr";
|
|
3
3
|
//#region ../../packages/substrate-pack/src/decoder.d.ts
|
|
4
4
|
interface DecodeContext {
|
package/dist/pack.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as DecodeEnvelopeCtx, c as decodeEnvelope, i as DecodeContext, l as decodePositional, n as packFrame, o as PackDecodeError, r as unpackFrame, s as SchemaDriftError, t as WS_SUBPROTOCOL_SUBSTRATE_PACK, u as decodePositionalFromFieldDef } from "./index-
|
|
1
|
+
import { f as PackEnvelope, i as FieldDef, l as FieldInput, m as Schema } from "./schema-oXfQyo0s.js";
|
|
2
|
+
import { a as DecodeEnvelopeCtx, c as decodeEnvelope, i as DecodeContext, l as decodePositional, n as packFrame, o as PackDecodeError, r as unpackFrame, s as SchemaDriftError, t as WS_SUBPROTOCOL_SUBSTRATE_PACK, u as decodePositionalFromFieldDef } from "./index-baF5A5jU.js";
|
|
3
3
|
//#region ../../packages/substrate-pack/src/content-type.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Content-type negotiation. Spec: §7.0.
|
package/dist/pack.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __binCreateRequire } from 'node:module'; const require = __binCreateRequire(import.meta.url);
|
|
2
|
-
import { _ as
|
|
2
|
+
import { _ as encodeEnvelope, a as buildDecodePlan, c as isPlainRequestData, d as PackDecodeError, f as SchemaDriftError, g as PackEncodeError, h as decodePositionalFromFieldDef, i as applyDecodePlanInPlace, l as decodeStreamChunk, m as decodePositional, n as packFrame, o as decodeWsEnvelope, p as decodeEnvelope, r as unpackFrame, s as encodeWsFrame, t as WS_SUBPROTOCOL_SUBSTRATE_PACK, u as encodeStreamChunk, v as encodePositional, y as encodePositionalFromFieldDef } from "./src-DWqzrm3O.js";
|
|
3
3
|
import { n as acceptsPack, t as PACK_MIME } from "./content-type-C7T28xNb.js";
|
|
4
4
|
|
|
5
5
|
export { PACK_MIME, PackDecodeError, PackEncodeError, SchemaDriftError, WS_SUBPROTOCOL_SUBSTRATE_PACK, acceptsPack, applyDecodePlanInPlace, buildDecodePlan, decodeEnvelope, decodePositional, decodePositionalFromFieldDef, decodeStreamChunk, decodeWsEnvelope, encodeEnvelope, encodePositional, encodePositionalFromFieldDef, encodeStreamChunk, encodeWsFrame, isPlainRequestData, packFrame, unpackFrame };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __binCreateRequire } from 'node:module'; const require = __binCreateRequire(import.meta.url);
|
|
2
|
-
import { n as txScopeIdFor } from "./src-
|
|
2
|
+
import { n as txScopeIdFor } from "./src-CSe2tJDf.js";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
|
|
5
5
|
//#region ../../packages/substrate-dataset-pg/src/pg-edges-store.ts
|
|
@@ -85,6 +85,54 @@ var PgEdgesStore = class PgEdgesStore {
|
|
|
85
85
|
createdAt
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
|
+
async writeMany(inputs) {
|
|
89
|
+
if (inputs.length === 0) return [];
|
|
90
|
+
const edges = inputs.map((input) => {
|
|
91
|
+
return {
|
|
92
|
+
id: randomUUID(),
|
|
93
|
+
from: buildRef(input.from.ns, input.from.type, refToId(input.from.id), input.from.bridged === true),
|
|
94
|
+
to: buildRef(input.to.ns, input.to.type, refToId(input.to.id), input.to.bridged === true),
|
|
95
|
+
fieldName: input.fieldName,
|
|
96
|
+
policy: input.policy,
|
|
97
|
+
createdAt: this.#now()
|
|
98
|
+
};
|
|
99
|
+
});
|
|
100
|
+
await this.#sql`
|
|
101
|
+
INSERT INTO edges (
|
|
102
|
+
id, from_ns, from_type, from_id, from_bridged,
|
|
103
|
+
to_ns, to_type, to_id, to_bridged,
|
|
104
|
+
field_name, policy, created_at, deleted_at, last_swept_at, blocked
|
|
105
|
+
)
|
|
106
|
+
SELECT t.id, t.from_ns, t.from_type, t.from_id, t.from_bridged::boolean,
|
|
107
|
+
t.to_ns, t.to_type, t.to_id, t.to_bridged::boolean,
|
|
108
|
+
t.field_name, t.policy, t.created_at::timestamptz, NULL, NULL, false
|
|
109
|
+
FROM unnest(
|
|
110
|
+
${edges.map((e) => e.id)}::uuid[],
|
|
111
|
+
${edges.map((e) => e.from.ns)}::text[],
|
|
112
|
+
${edges.map((e) => e.from.type)}::text[],
|
|
113
|
+
${edges.map((e) => String(e.from.id))}::text[],
|
|
114
|
+
${edges.map((e) => String(e.from.bridged === true))}::text[],
|
|
115
|
+
${edges.map((e) => e.to.ns)}::text[],
|
|
116
|
+
${edges.map((e) => e.to.type)}::text[],
|
|
117
|
+
${edges.map((e) => String(e.to.id))}::text[],
|
|
118
|
+
${edges.map((e) => String(e.to.bridged === true))}::text[],
|
|
119
|
+
${edges.map((e) => e.fieldName)}::text[],
|
|
120
|
+
${edges.map((e) => e.policy)}::text[],
|
|
121
|
+
${edges.map((e) => e.createdAt.toISOString())}::text[]
|
|
122
|
+
) AS t(id, from_ns, from_type, from_id, from_bridged,
|
|
123
|
+
to_ns, to_type, to_id, to_bridged, field_name, policy, created_at)
|
|
124
|
+
`;
|
|
125
|
+
return edges;
|
|
126
|
+
}
|
|
127
|
+
async tombstoneMany(ids, at) {
|
|
128
|
+
if (ids.length === 0) return;
|
|
129
|
+
await this.#sql`
|
|
130
|
+
UPDATE edges
|
|
131
|
+
SET deleted_at = ${at ?? this.#now()}
|
|
132
|
+
WHERE id = ANY(${ids}::uuid[])
|
|
133
|
+
AND deleted_at IS NULL
|
|
134
|
+
`;
|
|
135
|
+
}
|
|
88
136
|
async tombstone(id, at) {
|
|
89
137
|
const stamp = at ?? this.#now();
|
|
90
138
|
await this.#sql`
|
|
@@ -164,27 +212,42 @@ var PgEdgesStore = class PgEdgesStore {
|
|
|
164
212
|
`).map(rowToEdge);
|
|
165
213
|
}
|
|
166
214
|
async findEdgesToMany(refs) {
|
|
215
|
+
return this.#findMany("to", refs);
|
|
216
|
+
}
|
|
217
|
+
async findEdgesFromMany(refs) {
|
|
218
|
+
return this.#findMany("from", refs);
|
|
219
|
+
}
|
|
220
|
+
async #findMany(side, refs) {
|
|
167
221
|
if (refs.length === 0) return [];
|
|
168
222
|
const sql = this.#sql;
|
|
169
223
|
const seenRef = /* @__PURE__ */ new Set();
|
|
170
|
-
const
|
|
171
|
-
const
|
|
172
|
-
const
|
|
224
|
+
const seekNs = [];
|
|
225
|
+
const seekType = [];
|
|
226
|
+
const seekId = [];
|
|
173
227
|
for (const r of refs) {
|
|
174
228
|
const id = refToId(r.id);
|
|
175
229
|
const k = `${r.ns}\u0000${r.type}\u0000${id}`;
|
|
176
230
|
if (seenRef.has(k)) continue;
|
|
177
231
|
seenRef.add(k);
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
232
|
+
seekNs.push(r.ns);
|
|
233
|
+
seekType.push(r.type);
|
|
234
|
+
seekId.push(id);
|
|
181
235
|
}
|
|
236
|
+
const [colNs, colType, colId] = side === "to" ? [
|
|
237
|
+
sql("to_ns"),
|
|
238
|
+
sql("to_type"),
|
|
239
|
+
sql("to_id")
|
|
240
|
+
] : [
|
|
241
|
+
sql("from_ns"),
|
|
242
|
+
sql("from_type"),
|
|
243
|
+
sql("from_id")
|
|
244
|
+
];
|
|
182
245
|
return (await sql`
|
|
183
246
|
SELECT ${this.#edgeCols}
|
|
184
247
|
FROM edges
|
|
185
|
-
JOIN unnest(${
|
|
248
|
+
JOIN unnest(${seekNs}::text[], ${seekType}::text[], ${seekId}::text[])
|
|
186
249
|
AS seek(seek_ns, seek_type, seek_id)
|
|
187
|
-
ON
|
|
250
|
+
ON ${colNs} = seek.seek_ns AND ${colType} = seek.seek_type AND ${colId} = seek.seek_id
|
|
188
251
|
WHERE deleted_at IS NULL
|
|
189
252
|
`).map(rowToEdge);
|
|
190
253
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __binCreateRequire } from 'node:module'; const require = __binCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
import "./src-
|
|
2
|
+
import { $ as applyObligations, Dt as buildContext, kt as jsonResponse, sn as ResolverFrameError } from "./src-C4t1Gy-m.js";
|
|
3
|
+
import "./src-DWqzrm3O.js";
|
|
4
4
|
import { Worker } from "node:worker_threads";
|
|
5
5
|
|
|
6
6
|
//#region ../../plugins/substrate-recall/src/candidate-selection.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __binCreateRequire } from 'node:module'; const require = __binCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
import { n as createNoopPubSub, t as createProposalsPlugin } from "./src-
|
|
2
|
+
import { En as defineBootstrap } from "./src-C4t1Gy-m.js";
|
|
3
|
+
import { n as createNoopPubSub, t as createProposalsPlugin } from "./src-Bew_JvTo.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
|
|
6
6
|
//#region ../../plugins/substrate-proposals/src/bootstrap.ts
|
package/dist/proposals.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as ResolverFrameError } from "./errors-7mycvNGq.js";
|
|
1
|
+
import { Mt as Dataset, wn as OnDelete, x as CoordinatorPlugin } from "./schema-oXfQyo0s.js";
|
|
2
|
+
import { l as ResolverFrameError } from "./errors-xP9Mo7Q1.js";
|
|
4
3
|
//#region ../../plugins/substrate-proposals/src/config.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Multi-instance invalidation transport used by the plugin to broadcast
|
package/dist/proposals.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as __binCreateRequire } from 'node:module'; const require = __binCreateRequire(import.meta.url);
|
|
2
|
-
import { i as ProposalError, n as createNoopPubSub, r as storageSettled, t as createProposalsPlugin } from "./src-
|
|
2
|
+
import { i as ProposalError, n as createNoopPubSub, r as storageSettled, t as createProposalsPlugin } from "./src-Bew_JvTo.js";
|
|
3
3
|
|
|
4
4
|
export { ProposalError, createNoopPubSub, createProposalsPlugin, storageSettled };
|
package/dist/recall-bootstrap.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __binCreateRequire } from 'node:module'; const require = __binCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
2
|
+
import { En as defineBootstrap } from "./src-C4t1Gy-m.js";
|
|
3
3
|
import { t as FakeEmbedder } from "./fake-DUVtKVSE.js";
|
|
4
|
-
import { t as createRecallPlugin } from "./plugin-
|
|
4
|
+
import { t as createRecallPlugin } from "./plugin-BLm5IRdX.js";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
|
|
7
7
|
//#region ../../packages/substrate-embedder/src/types.ts
|
package/dist/recall.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Dt as PolicyDecision, F as FilterOperatorDef, H as KernelPlugin, Ot as PolicyProbeContext, W as McpToolRegistration, Z as PostWriteHook, j as EmbedSourceContext, jt as ResolverArgs, kt as RequestContext, lt as HttpHandler, n as Dataset, wt as Identity, z as KernelMigration } from "./dataset-CejF-Fr_.js";
|
|
1
|
+
import { C as EmbedSourceContext, Cn as EdgesStore, Ct as ResolverArgs, D as FilterOperatorDef, I as McpToolRegistration, Mn as Row, Mt as Dataset, P as KernelPlugin, U as PostWriteHook, bt as PolicyProbeContext, gt as Identity, i as FieldDef, j as KernelMigration, tt as HttpHandler, xt as RequestContext, yt as PolicyDecision } from "./schema-oXfQyo0s.js";
|
|
3
2
|
import { t as Embedder } from "./types-8c0gtnd2.js";
|
|
4
3
|
import postgres, { Sql } from "postgres";
|
|
5
4
|
//#region ../../plugins/substrate-recall/src/candidate-selection.d.ts
|
|
@@ -1517,7 +1516,7 @@ export declare class InMemoryEmbeddingsStore implements EmbeddingsStore {
|
|
|
1517
1516
|
//#endregion
|
|
1518
1517
|
//#region ../../plugins/substrate-recall/src/in-memory-lexical-store.d.ts
|
|
1519
1518
|
/**
|
|
1520
|
-
* Resolves a row body, mirroring pg's join against
|
|
1519
|
+
* Resolves a row body, mirroring pg's join against the type's table.
|
|
1521
1520
|
*
|
|
1522
1521
|
* Signature matches `InMemoryEmbeddingsStoreOptions.datasetFor` deliberately:
|
|
1523
1522
|
* a host wires both from the same registry lookup.
|
|
@@ -1707,20 +1706,20 @@ export declare class PgEmbeddingsStore implements EmbeddingsStore {
|
|
|
1707
1706
|
id: string;
|
|
1708
1707
|
}>, model: string): Promise<ReadonlyArray<EmbeddingsStoreFetchResult>>;
|
|
1709
1708
|
selectCandidates(selector: CandidateSelector, model: string): Promise<Candidate[]>;
|
|
1709
|
+
staleRowIds(input: {
|
|
1710
|
+
namespace: string;
|
|
1711
|
+
type: string;
|
|
1712
|
+
afterId: string;
|
|
1713
|
+
limit: number;
|
|
1714
|
+
}): Promise<string[]>;
|
|
1710
1715
|
/**
|
|
1711
1716
|
* Deletes every embedding whose backing row is missing or soft-deleted.
|
|
1712
|
-
* Needed because `embeddings` has no FK to
|
|
1717
|
+
* Needed because `embeddings` has no FK to the type tables and no
|
|
1713
1718
|
* dataset delete path touches it; tombstones are terminal, so soft-deleted
|
|
1714
1719
|
* rows are safe to collect immediately. Run as a sweep stage by the binary.
|
|
1715
1720
|
*
|
|
1716
1721
|
* @returns number of orphaned embeddings deleted.
|
|
1717
1722
|
*/
|
|
1718
|
-
staleRowIds(input: {
|
|
1719
|
-
namespace: string;
|
|
1720
|
-
type: string;
|
|
1721
|
-
afterId: string;
|
|
1722
|
-
limit: number;
|
|
1723
|
-
}): Promise<string[]>;
|
|
1724
1723
|
purgeOrphans(): Promise<number>;
|
|
1725
1724
|
}
|
|
1726
1725
|
//#endregion
|
|
@@ -1741,7 +1740,7 @@ export declare class PgLexicalStore implements LexicalStore {
|
|
|
1741
1740
|
/**
|
|
1742
1741
|
* Deletes every lexical row whose backing row is missing or soft-deleted,
|
|
1743
1742
|
* as `PgEmbeddingsStore.purgeOrphans` does for vectors: `lexical` has no FK
|
|
1744
|
-
* to
|
|
1743
|
+
* to the type tables, so a drop, purge or tombstone would otherwise leave the text.
|
|
1745
1744
|
*
|
|
1746
1745
|
* @returns number of orphaned lexical rows deleted.
|
|
1747
1746
|
*/
|
package/dist/recall.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __binCreateRequire } from 'node:module'; const require = __binCreateRequire(import.meta.url);
|
|
2
|
-
import { a as InMemoryLexicalStore, i as PgClusterStore, n as PgLexicalStore, o as InMemoryEmbeddingsStore, r as PgEmbeddingsStore, s as InMemoryClusterStore, t as RECALL_VERSION } from "./src-
|
|
3
|
-
import { $ as CLUSTERER_BACKEND_VERSION, A as CLUSTER_MEMBER_FIELDS, C as EmbedSourceRegistry, D as makeReembed, E as makeEmbedPostWrite, F as unknownParams, G as DEFAULT_CRYSTALLISE_CONFIG, H as CRYSTALLISE_IN_FLIGHT_CODE, I as handleRecallRequest, J as runClusterer, K as handleCrystallise, L as RRF_K, M as recallRouteHandler, N as checkParams, O as crystalliseRouteHandler, P as unknownParamMessage, Q as CLUSTERER_BACKEND, R as armRanks, S as createEmbedStats, T as embedRowReporting, U as createCrystalliseGuard, X as l2normalize, _ as EMBEDDINGS_FETCH_MAX_REFS, a as REINDEX_MAX_LIMIT, b as handleLexicalCoverage, c as SALIENCE_BOOST_MAX_TARGETS, d as embeddingsMigration, et as memberKey, f as recallMcpTool, g as embeddingsFetchRouteHandler, h as embeddingSimilarOperator, i as REINDEX_DEFAULT_LIMIT, j as buildClusterSurface, k as CLUSTER_FIELDS, l as lexicalMigration, m as makeLexicalPostWrite, n as salienceBoostRouteHandler, nt as validateSelector, o as handleReindex, p as makeLexicalClassify, q as validateCrystalliseInput, r as reindexRouteHandler, s as validateReindexInput, t as createRecallPlugin, tt as SELECT_CANDIDATES_MAX_LIMIT, u as recallClustersMigration, v as embedStatsRouteHandler, w as embedAndStore, x as validateLexicalCoverageInput, y as handleEmbedStatsRequest, z as fuseByRank } from "./plugin-
|
|
2
|
+
import { a as InMemoryLexicalStore, i as PgClusterStore, n as PgLexicalStore, o as InMemoryEmbeddingsStore, r as PgEmbeddingsStore, s as InMemoryClusterStore, t as RECALL_VERSION } from "./src-CzhKLsOV.js";
|
|
3
|
+
import { $ as CLUSTERER_BACKEND_VERSION, A as CLUSTER_MEMBER_FIELDS, C as EmbedSourceRegistry, D as makeReembed, E as makeEmbedPostWrite, F as unknownParams, G as DEFAULT_CRYSTALLISE_CONFIG, H as CRYSTALLISE_IN_FLIGHT_CODE, I as handleRecallRequest, J as runClusterer, K as handleCrystallise, L as RRF_K, M as recallRouteHandler, N as checkParams, O as crystalliseRouteHandler, P as unknownParamMessage, Q as CLUSTERER_BACKEND, R as armRanks, S as createEmbedStats, T as embedRowReporting, U as createCrystalliseGuard, X as l2normalize, _ as EMBEDDINGS_FETCH_MAX_REFS, a as REINDEX_MAX_LIMIT, b as handleLexicalCoverage, c as SALIENCE_BOOST_MAX_TARGETS, d as embeddingsMigration, et as memberKey, f as recallMcpTool, g as embeddingsFetchRouteHandler, h as embeddingSimilarOperator, i as REINDEX_DEFAULT_LIMIT, j as buildClusterSurface, k as CLUSTER_FIELDS, l as lexicalMigration, m as makeLexicalPostWrite, n as salienceBoostRouteHandler, nt as validateSelector, o as handleReindex, p as makeLexicalClassify, q as validateCrystalliseInput, r as reindexRouteHandler, s as validateReindexInput, t as createRecallPlugin, tt as SELECT_CANDIDATES_MAX_LIMIT, u as recallClustersMigration, v as embedStatsRouteHandler, w as embedAndStore, x as validateLexicalCoverageInput, y as handleEmbedStatsRequest, z as fuseByRank } from "./plugin-BLm5IRdX.js";
|
|
4
4
|
|
|
5
5
|
export { CLUSTERER_BACKEND, CLUSTERER_BACKEND_VERSION, CLUSTER_FIELDS, CLUSTER_MEMBER_FIELDS, CRYSTALLISE_IN_FLIGHT_CODE, DEFAULT_CRYSTALLISE_CONFIG, EMBEDDINGS_FETCH_MAX_REFS, EmbedSourceRegistry, InMemoryClusterStore, InMemoryEmbeddingsStore, InMemoryLexicalStore, PgClusterStore, PgEmbeddingsStore, PgLexicalStore, RECALL_VERSION, REINDEX_DEFAULT_LIMIT, REINDEX_MAX_LIMIT, RRF_K, SALIENCE_BOOST_MAX_TARGETS, SELECT_CANDIDATES_MAX_LIMIT, armRanks, buildClusterSurface, checkParams, createCrystalliseGuard, createEmbedStats, createRecallPlugin, crystalliseRouteHandler, embedAndStore, embedRowReporting, embedStatsRouteHandler, embeddingSimilarOperator, embeddingsFetchRouteHandler, embeddingsMigration, fuseByRank, handleCrystallise, handleEmbedStatsRequest, handleLexicalCoverage, handleRecallRequest, handleReindex, l2normalize, lexicalMigration, makeEmbedPostWrite, makeLexicalClassify, makeLexicalPostWrite, makeReembed, memberKey, recallClustersMigration, recallMcpTool, recallRouteHandler, reindexRouteHandler, runClusterer, salienceBoostRouteHandler, unknownParamMessage, unknownParams, validateCrystalliseInput, validateLexicalCoverageInput, validateReindexInput, validateSelector };
|