@mnmal-ai/substrate 1.0.0-alpha.16 → 1.0.0-alpha.17
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 +3 -2
- package/dist/{boot-store-HxCgbvNl.js → boot-store-DNU0UfX7.js} +19 -66
- package/dist/{bridge-CvZGzNIO.d.ts → bridge-5VHZiH9o.d.ts} +1 -1
- package/dist/{cli-6mjAWiEZ.js → cli-CwWUYUMv.js} +66 -12
- package/dist/client.d.ts +3 -3
- package/dist/client.js +3 -3
- package/dist/{errors-BXxm9eZF.d.ts → errors-DHgT7Fa8.d.ts} +8 -2
- package/dist/{index-EN-nQsX8.d.ts → index-DKJXQ031.d.ts} +1 -1
- package/dist/{node-version-C5FSmwJX.js → node-version-CxqcqECU.js} +1 -1
- package/dist/pack.d.ts +18 -2
- package/dist/pack.js +2 -2
- package/dist/{pg-edges-store-De5F1tUf.js → pg-edges-store-CSJ7sG2l.js} +1 -1
- package/dist/{plugin-Dpa_Y7Ep.js → plugin-Dk9RC3LH.js} +2 -2
- package/dist/proposals-bootstrap.js +2 -2
- package/dist/proposals.d.ts +5 -3
- package/dist/proposals.js +1 -1
- package/dist/recall-bootstrap.js +2 -2
- package/dist/recall.d.ts +1 -1
- package/dist/recall.js +2 -2
- package/dist/{repl-2WfRPUb0.js → repl-BNnKFG3y.js} +1 -1
- package/dist/{row-Dh57ShWL.d.ts → row-DHxnCnhA.d.ts} +10 -8
- package/dist/{run-ChcHBIN3.js → run-NmwNmVUD.js} +142 -106
- package/dist/{schema-B--_bHjn.d.ts → schema-B5WBO8yh.d.ts} +79 -19
- package/dist/sdk.d.ts +48 -6
- package/dist/sdk.js +4 -4
- package/dist/{src--uyAqssS.js → src-7lp1y4HK.js} +3 -3
- package/dist/{src-BMHI_rTJ.js → src-BHh6UZ7L.js} +2141 -493
- package/dist/{src-DWqzrm3O.js → src-CdbUzLhB.js} +209 -36
- package/dist/{src-Bi3NhEsT.js → src-DR_hUj2p.js} +1 -1
- package/dist/{src-CHND7-Pm.js → src-DV6PcXym.js} +2 -2
- package/dist/{src-DHLw3eCn.js → src-DWrFdHrY.js} +1016 -231
- package/dist/{src-B4sqnLRy.js → src-DwynOVMk.js} +77 -28
- package/dist/substrate-admin.js +2 -2
- package/dist/substrate.js +2 -2
- package/dist/testing.d.ts +5 -3
- package/dist/testing.js +4 -4
- package/dist/{ws-CpHWxwp9.d.ts → ws-BL9nSELO.d.ts} +2 -2
- package/package.json +21 -21
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The `substrate` binary: the server, the stdio MCP server, and the runtime scaffolder, plus `substrate-admin` for key management. The same package carries the libraries for plugin authors and clients, and two built-in plugins: `substrate-recall` (kernel) and `substrate-proposals` (coordinator).
|
|
4
4
|
|
|
5
|
-
It runs as a real install: the binary and its plugins resolve from one shared `node_modules`, so every plugin sees the same copy of every shared package. `substrate init` scaffolds such a runtime directory. Node `>=26.
|
|
5
|
+
It runs as a real install: the binary and its plugins resolve from one shared `node_modules`, so every plugin sees the same copy of every shared package. `substrate init` scaffolds such a runtime directory. Node `>=26.13.1` is required; a durable deployment also needs PostgreSQL 18 or newer with the `pgvector` extension. Walkthrough: [`docs/getting-started.md`](https://github.com/mnmal-ai/substrate/blob/main/docs/getting-started.md).
|
|
6
6
|
|
|
7
7
|
## Library subpaths
|
|
8
8
|
|
|
@@ -141,7 +141,7 @@ The main ones; `substrate --help` and the header of `apps/substrate/src/main.ts`
|
|
|
141
141
|
| `SUBSTRATE_STREAM_TICKET_SECRET` | HMAC key signing SSE stream tickets. **Required when auth is enabled**; at least 16 characters. The ticket signature is the only authentication on `GET /substrate/v1/stream` and `GET /substrate/v1/subscribe`, because `EventSource` can send no header or body. Rotating it invalidates every outstanding ticket. |
|
|
142
142
|
| `SUBSTRATE_TLS_KEY_PATH` / `SUBSTRATE_TLS_CERT_PATH` / `SUBSTRATE_TLS_CA_PATH` | Serve HTTPS. Key and cert are required together. |
|
|
143
143
|
| `SUBSTRATE_NAMESPACE` | Default namespace for recall requests that omit one; with neither, recall refuses with `missing_namespace`. |
|
|
144
|
-
| `SUBSTRATE_STATEMENT_TIMEOUT_MS` | Statement timeout for typed edge walk reads (default 30000). A read it cancels is refused `query_timeout`. |
|
|
144
|
+
| `SUBSTRATE_STATEMENT_TIMEOUT_MS` | Statement timeout for typed edge walk reads (default 30000). A read it cancels is refused `query_timeout`. It also bounds the wait for a free database connection; a request that waits longer is refused `store_busy`. |
|
|
145
145
|
| `SUBSTRATE_PAGE_LIMIT_DEFAULT` / `SUBSTRATE_PAGE_LIMIT_MAX` | Page size for a remote query that names no `limit` (default 100), and the largest `limit` accepted (default 1000). |
|
|
146
146
|
| `SUBSTRATE_FILTER_WRITE_MAX_MATCH` / `SUBSTRATE_FILTER_WRITE_IDS_CAP` | `updateMany<Type>` / `deleteMany<Type>`: a filter matching more rows than the max is refused `filter_too_broad` (default 10000); the result lists at most the cap of ids (default 1000). |
|
|
147
147
|
| `SUBSTRATE_SWEEP_INTERVAL_MS` | Edge-sweep cadence (default 300000) |
|
|
@@ -162,6 +162,7 @@ Natural-language query and the recall embedder are not configured by environment
|
|
|
162
162
|
- [Design spec](https://github.com/mnmal-ai/substrate/blob/main/docs/substrate-from-first-principles.md)
|
|
163
163
|
- [Operator decisions](https://github.com/mnmal-ai/substrate/blob/main/docs/operator-decisions.md)
|
|
164
164
|
- [Upgrading to per-type tables](https://github.com/mnmal-ai/substrate/blob/main/docs/upgrading-to-type-tables.md)
|
|
165
|
+
- [Upgrading to the warehouse grammar](https://github.com/mnmal-ai/substrate/blob/main/docs/upgrading-to-warehouse-grammar.md)
|
|
165
166
|
- [Plugin author guide](https://github.com/mnmal-ai/substrate/blob/main/docs/plugin-author-guide.md)
|
|
166
167
|
|
|
167
168
|
## License
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { createRequire as __binCreateRequire } from 'node:module'; const require = __binCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
2
|
+
import { A as isReservedAutoCrudField, Ft as HttpBridgeClient, Lt as buildContext, Vt as parseAuthConfig, Wt as WS_REASON_SERVER_RESTART, Z as MemoryEdgesStore, _ as AUDIT_EVENT_TYPE, _t as getExtensionOperator, a as composeFromManifests, bt as unregisterExtensionOperator, c as MemoryDataset, et as effectiveFilterOperators, g as buildAuditRow, h as SYSTEM_TYPE_DEFS, i as PluginLoadError, n as kernelMigrationTracking, o as DEFAULT_NAMESPACE, r as mountKernelRoute, s as compose, t as composeKernelPlugins, u as isStoreProfileName, vt as listExtensionOperators, yt as registerExtensionOperator } from "./src-BHh6UZ7L.js";
|
|
3
3
|
import { a as adminClaimCapabilities, d as resolveDefaultKidPath, l as resolveAdminCredential, n as trimTrailingSlashes, r as ADMIN_CAPABILITIES, s as makeAuthorizationProvider, t as parsePositiveInt, u as resolveDefaultKeyPath } from "./env-utils-CGNazUNt.js";
|
|
4
|
-
import { D as isActiveAdminKeyRow, E as describeGrant, L as encodeList, M as grantEntryError, T as SYSTEM_NAMESPACE, v as grantEntriesConfer } from "./src-
|
|
5
|
-
import {
|
|
6
|
-
import { C as diagnose, S as DIAGNOSE_CHECKS, _ as SKIPPABLE_STEPS, b as planOnboarding, h as CURRENT_MARK, i as tokenAudience, v as STEP_MARKS, x as requiredOutstanding, y as currentStep } from "./src-
|
|
7
|
-
import { _ as
|
|
8
|
-
import { t as PgEdgesStore } from "./pg-edges-store-
|
|
9
|
-
import { a as InMemoryLexicalStore, i as PgClusterStore, n as PgLexicalStore, o as InMemoryEmbeddingsStore, r as PgEmbeddingsStore, s as InMemoryClusterStore } from "./src
|
|
10
|
-
import { et as memberKey } from "./plugin-
|
|
4
|
+
import { D as isActiveAdminKeyRow, E as describeGrant, L as encodeList, M as grantEntryError, T as SYSTEM_NAMESPACE, v as grantEntriesConfer } from "./src-DR_hUj2p.js";
|
|
5
|
+
import { L as DEFAULT_FILTER_WRITE_LIMITS } from "./src-CdbUzLhB.js";
|
|
6
|
+
import { C as diagnose, S as DIAGNOSE_CHECKS, _ as SKIPPABLE_STEPS, b as planOnboarding, h as CURRENT_MARK, i as tokenAudience, v as STEP_MARKS, x as requiredOutstanding, y as currentStep } from "./src-DV6PcXym.js";
|
|
7
|
+
import { _ as pendingMigrations, f as assertNotMigrating, h as deriveListIndexMigration, m as assertTablesLayout, n as PgDataset, t as PgIdempotencyStore, v as runDerivedMigrations, y as runMigrations } from "./src-DWrFdHrY.js";
|
|
8
|
+
import { t as PgEdgesStore } from "./pg-edges-store-CSJ7sG2l.js";
|
|
9
|
+
import { a as InMemoryLexicalStore, i as PgClusterStore, n as PgLexicalStore, o as InMemoryEmbeddingsStore, r as PgEmbeddingsStore, s as InMemoryClusterStore } from "./src-7lp1y4HK.js";
|
|
10
|
+
import { et as memberKey } from "./plugin-Dk9RC3LH.js";
|
|
11
11
|
import { existsSync, linkSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
12
12
|
import { homedir } from "node:os";
|
|
13
13
|
import { basename, dirname, join, resolve } from "node:path";
|
|
@@ -138,60 +138,6 @@ function makeDiskGuard(opts) {
|
|
|
138
138
|
};
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
//#endregion
|
|
142
|
-
//#region ../../packages/substrate-dataset-pg/src/pg-idempotency-store.ts
|
|
143
|
-
var PgIdempotencyStore = class {
|
|
144
|
-
#sql;
|
|
145
|
-
constructor(options) {
|
|
146
|
-
this.#sql = options.sql;
|
|
147
|
-
}
|
|
148
|
-
async get(key) {
|
|
149
|
-
const row = (await this.#sql`
|
|
150
|
-
SELECT envelope
|
|
151
|
-
FROM idempotency
|
|
152
|
-
WHERE key = ${key}
|
|
153
|
-
AND expires_at > now()
|
|
154
|
-
LIMIT 1
|
|
155
|
-
`)[0];
|
|
156
|
-
if (row === void 0) return void 0;
|
|
157
|
-
return row.envelope;
|
|
158
|
-
}
|
|
159
|
-
async put(key, envelope, ttlMs) {
|
|
160
|
-
const sql = this.#sql;
|
|
161
|
-
await sql`
|
|
162
|
-
INSERT INTO idempotency (key, envelope, expires_at)
|
|
163
|
-
VALUES (
|
|
164
|
-
${key},
|
|
165
|
-
${sql.json(envelope)},
|
|
166
|
-
now() + (${ttlMs}::bigint || ' milliseconds')::interval
|
|
167
|
-
)
|
|
168
|
-
ON CONFLICT (key) DO UPDATE SET
|
|
169
|
-
-- The envelope is IMMUTABLE while the entry is live: an idempotency key
|
|
170
|
-
-- must resolve to one stable answer for its whole window, or two
|
|
171
|
-
-- retries of the same request can get different results, which is the
|
|
172
|
-
-- thing the store exists to prevent.
|
|
173
|
-
--
|
|
174
|
-
-- Once it has EXPIRED that rule inverts. The dedupe window closed, the
|
|
175
|
-
-- mutation legitimately re-executed, and the new envelope is the real
|
|
176
|
-
-- result. Keeping the old one would hand back a stale answer wrapped in
|
|
177
|
-
-- a fresh TTL, to a caller who was never deduped at all.
|
|
178
|
-
envelope = CASE
|
|
179
|
-
WHEN idempotency.expires_at <= now() THEN EXCLUDED.envelope
|
|
180
|
-
ELSE idempotency.envelope
|
|
181
|
-
END,
|
|
182
|
-
-- GREATEST rather than a WHERE guard: extends a live window, never
|
|
183
|
-
-- shortens it, and takes the new value outright when the old is past.
|
|
184
|
-
expires_at = GREATEST(idempotency.expires_at, EXCLUDED.expires_at)
|
|
185
|
-
`;
|
|
186
|
-
}
|
|
187
|
-
async reapExpired() {
|
|
188
|
-
return { deleted: (await this.#sql`
|
|
189
|
-
DELETE FROM idempotency
|
|
190
|
-
WHERE expires_at <= now()
|
|
191
|
-
`).count };
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
|
|
195
141
|
//#endregion
|
|
196
142
|
//#region src/pg-client.ts
|
|
197
143
|
function formatPgNotice(notice) {
|
|
@@ -210,9 +156,16 @@ function pgNoticeOptions(write = (s) => void process.stderr.write(s)) {
|
|
|
210
156
|
* Open a pg client with substrate's standard options. Prefer this over calling
|
|
211
157
|
* `postgres()` directly so NOTICE routing stays consistent across `serve`, the
|
|
212
158
|
* admin CLI, `substrate federate`, and the migrate CLI.
|
|
159
|
+
*
|
|
160
|
+
* `queueTimeoutMs` bounds how long a query, transaction or reserve waits for a
|
|
161
|
+
* free connection before it rejects with the driver's `QUEUE_TIMEOUT`. Unset,
|
|
162
|
+
* it waits as long as it takes.
|
|
213
163
|
*/
|
|
214
|
-
function openSql(url) {
|
|
215
|
-
return postgres(url,
|
|
164
|
+
function openSql(url, opts = {}) {
|
|
165
|
+
return postgres(url, {
|
|
166
|
+
...pgNoticeOptions(),
|
|
167
|
+
...opts.queueTimeoutMs !== void 0 ? { queue_timeout: opts.queueTimeoutMs / 1e3 } : {}
|
|
168
|
+
});
|
|
216
169
|
}
|
|
217
170
|
|
|
218
171
|
//#endregion
|
|
@@ -1794,7 +1747,7 @@ async function closeQuietly(sql) {
|
|
|
1794
1747
|
|
|
1795
1748
|
//#endregion
|
|
1796
1749
|
//#region package.json
|
|
1797
|
-
var version = "1.0.0-alpha.
|
|
1750
|
+
var version = "1.0.0-alpha.17";
|
|
1798
1751
|
|
|
1799
1752
|
//#endregion
|
|
1800
1753
|
//#region src/plugin-manifest.ts
|
|
@@ -2878,7 +2831,7 @@ async function wireStore(storeSpec, fieldDefLookupFor, typeDefLookupFor, diskGua
|
|
|
2878
2831
|
close: null
|
|
2879
2832
|
};
|
|
2880
2833
|
if (storeSpec.startsWith("postgres://") || storeSpec.startsWith("postgresql://")) {
|
|
2881
|
-
const sql = openSql(storeSpec);
|
|
2834
|
+
const sql = openSql(storeSpec, statementTimeoutMs !== void 0 ? { queueTimeoutMs: statementTimeoutMs } : {});
|
|
2882
2835
|
try {
|
|
2883
2836
|
await runMigrations(sql);
|
|
2884
2837
|
} catch (err) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { On as EdgeRef, f as PackEnvelope, m as Schema, zn as Row } from "./schema-B5WBO8yh.js";
|
|
2
2
|
//#region ../../packages/substrate-types/src/bridge.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Per-frame bucket sent to a bridge. Same shape as `QualifiedFrame` in the
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { createRequire as __binCreateRequire } from 'node:module'; const require = __binCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
2
|
+
import { _ as AUDIT_EVENT_TYPE, cn as validateHardDeleteEnv, g as buildAuditRow, it as saveSweepState, m as runInviteSweep, nt as loadSweepState, rt as runSweep, u as isStoreProfileName, v as INVITE_TYPE } from "./src-BHh6UZ7L.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 { 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-
|
|
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-DR_hUj2p.js";
|
|
5
|
+
import { F as EXPR_FUNCTIONS, I as EXPR_LIMITS, N as DATE_UNITS, P as EXPR_AGGREGATES } from "./src-CdbUzLhB.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-DNU0UfX7.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-DV6PcXym.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 { T as tryWithPgAdvisoryLock } from "./src-DWrFdHrY.js";
|
|
10
|
+
import { n as PgLexicalStore, r as PgEmbeddingsStore } from "./src-7lp1y4HK.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";
|
|
@@ -2163,7 +2163,7 @@ async function runInit(argv) {
|
|
|
2163
2163
|
return 1;
|
|
2164
2164
|
}
|
|
2165
2165
|
if (!config.yes) try {
|
|
2166
|
-
const { runRepl } = await import("./repl-
|
|
2166
|
+
const { runRepl } = await import("./repl-BNnKFG3y.js");
|
|
2167
2167
|
config = await runRepl(config);
|
|
2168
2168
|
} catch (err) {
|
|
2169
2169
|
if (err.message?.includes("User force closed")) return 130;
|
|
@@ -2457,6 +2457,12 @@ function makeAgentJwtProvider(env, audience) {
|
|
|
2457
2457
|
|
|
2458
2458
|
//#endregion
|
|
2459
2459
|
//#region src/mcp/schema-overview.ts
|
|
2460
|
+
/**
|
|
2461
|
+
* A compact map of the federated schema for agents: every namespace's types,
|
|
2462
|
+
* each as one line of `field: type`, plus the mutations autoCRUD did not
|
|
2463
|
+
* generate. Enough to pick a type and write a query; a write contract is
|
|
2464
|
+
* still one scoped `schema { namespace, type }` away.
|
|
2465
|
+
*/
|
|
2460
2466
|
const NAME = /^[A-Za-z_][A-Za-z0-9_-]{0,63}$/;
|
|
2461
2467
|
const ENUM_VALUE = /^[A-Za-z0-9_./-]{1,40}$/;
|
|
2462
2468
|
const MAX_ENUM_VALUES = 20;
|
|
@@ -2524,6 +2530,32 @@ function buildInstructions(overview) {
|
|
|
2524
2530
|
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)])))}`;
|
|
2525
2531
|
return `${CONVENTIONS}\n\nTypes on this server at session start:\n${body}`;
|
|
2526
2532
|
}
|
|
2533
|
+
/** This binary's own catalogue: the fallback when the server publishes none. */
|
|
2534
|
+
const localExpressions = {
|
|
2535
|
+
functions: EXPR_FUNCTIONS,
|
|
2536
|
+
aggregates: EXPR_AGGREGATES,
|
|
2537
|
+
limits: EXPR_LIMITS,
|
|
2538
|
+
dateUnits: DATE_UNITS
|
|
2539
|
+
};
|
|
2540
|
+
/** The `expressions` section of an unscoped schema reply, or undefined when it has none. */
|
|
2541
|
+
function serverExpressions(schema) {
|
|
2542
|
+
const e = schema?.expressions;
|
|
2543
|
+
return Array.isArray(e?.functions) && Array.isArray(e?.aggregates) && Array.isArray(e?.dateUnits) && e?.limits ? e : void 0;
|
|
2544
|
+
}
|
|
2545
|
+
/** The expression catalogue as compact lines for the no-args overview: one per function, then aggregates, limits and date units. */
|
|
2546
|
+
function expressionLines(c) {
|
|
2547
|
+
return [
|
|
2548
|
+
...c.functions.map((f) => {
|
|
2549
|
+
const args = f.args === "variadic" ? "..." : f.args.join(", ");
|
|
2550
|
+
return `${f.name}(${args}) → ${f.returns}: ${f.description}`;
|
|
2551
|
+
}),
|
|
2552
|
+
`aggregates: ${c.aggregates.join(", ")}`,
|
|
2553
|
+
`limits: maxDepth ${c.limits.maxDepth}, maxNodesPerExpr ${c.limits.maxNodesPerExpr}, maxNodesPerFrame ${c.limits.maxNodesPerFrame}`,
|
|
2554
|
+
`dateUnits: ${c.dateUnits.join(", ")}`
|
|
2555
|
+
];
|
|
2556
|
+
}
|
|
2557
|
+
/** Said beside a catalogue that is this binary's own, which may differ from what the server accepts. */
|
|
2558
|
+
const LOCAL_EXPRESSIONS_NOTE = "The server published no expression catalogue (GET /substrate/v1/schema), so this is the local binary's; the server may accept a different set.";
|
|
2527
2559
|
|
|
2528
2560
|
//#endregion
|
|
2529
2561
|
//#region src/mcp/server.ts
|
|
@@ -2675,21 +2707,43 @@ async function getSubstrate(endpoint, path) {
|
|
|
2675
2707
|
async function recall(endpoint, body) {
|
|
2676
2708
|
return postSubstrate(endpoint, "/substrate/v1/recall", body, "parsedError");
|
|
2677
2709
|
}
|
|
2710
|
+
/** The server's expression catalogue, or undefined when it publishes none (an older server, or no default namespace). */
|
|
2711
|
+
async function expressionsOf(endpoint) {
|
|
2712
|
+
try {
|
|
2713
|
+
return serverExpressions(await getSubstrate(endpoint, "/substrate/v1/schema"));
|
|
2714
|
+
} catch {
|
|
2715
|
+
return;
|
|
2716
|
+
}
|
|
2717
|
+
}
|
|
2678
2718
|
function createSchemaHandler(endpoint) {
|
|
2679
2719
|
return async (args) => {
|
|
2680
2720
|
const ns = args?.namespace;
|
|
2681
2721
|
const type = args?.type;
|
|
2682
2722
|
const shape = args?.shape;
|
|
2683
2723
|
if ((ns === void 0 || ns === "") && args?.full !== true) try {
|
|
2684
|
-
const federated = await getSubstrate(endpoint, "/substrate/v1/federated-schema");
|
|
2724
|
+
const [federated, catalogue] = await Promise.all([getSubstrate(endpoint, "/substrate/v1/federated-schema"), expressionsOf(endpoint)]);
|
|
2685
2725
|
return okResult({
|
|
2686
2726
|
legend: overviewLegend,
|
|
2687
|
-
overview: schemaOverview(federated)
|
|
2727
|
+
overview: schemaOverview(federated),
|
|
2728
|
+
expressions: expressionLines(catalogue ?? localExpressions),
|
|
2729
|
+
...catalogue === void 0 ? { expressionsNote: LOCAL_EXPRESSIONS_NOTE } : {}
|
|
2688
2730
|
});
|
|
2689
2731
|
} catch (err) {
|
|
2690
2732
|
return errorResult(toMessage(err));
|
|
2691
2733
|
}
|
|
2692
2734
|
let path = "/substrate/v1/federated-schema";
|
|
2735
|
+
if ((ns === void 0 || ns === "") && args?.full === true) try {
|
|
2736
|
+
const [federated, catalogue] = await Promise.all([getSubstrate(endpoint, path), expressionsOf(endpoint)]);
|
|
2737
|
+
return okResult({
|
|
2738
|
+
...federated,
|
|
2739
|
+
$expressions: catalogue ?? {
|
|
2740
|
+
...localExpressions,
|
|
2741
|
+
note: "The server published no expression catalogue (GET /substrate/v1/schema), so this is the local binary's; the server may accept a different set."
|
|
2742
|
+
}
|
|
2743
|
+
});
|
|
2744
|
+
} catch (err) {
|
|
2745
|
+
return errorResult(toMessage(err));
|
|
2746
|
+
}
|
|
2693
2747
|
if (ns !== void 0 && ns !== "") {
|
|
2694
2748
|
if (type !== void 0 && type !== "") {
|
|
2695
2749
|
const q = shape !== void 0 && shape !== "" ? `?shape=${encodeURIComponent(shape)}` : "";
|
|
@@ -2816,7 +2870,7 @@ function createMcpServer(endpoint, options = {}) {
|
|
|
2816
2870
|
{
|
|
2817
2871
|
name: "schema",
|
|
2818
2872
|
config: {
|
|
2819
|
-
description: "Fetch the Substrate schema. No args → a compact overview: every namespace's types, one line of `field: type` each, enough to write a query. `full: true` → the whole federated schema (large; rarely needed). SCOPED + CHEAP: pass `namespace` for one namespace, or `namespace` + `type` for a single type's write contract ({ fields, mutations }). Mine the scoped shape BEFORE a create/update so you send only declared fields — autoCRUD rejects undeclared fields with `unknown_field`. CHEAPER STILL: add `shape: \"fields\"` when you only need the type's field names and kinds — for an autoCRUD type the mutations restate the field block five times over, so the default answer costs about 6x the question.",
|
|
2873
|
+
description: "Fetch the Substrate schema. No args → a compact overview: every namespace's types, one line of `field: type` each, enough to write a query. `full: true` → the whole federated schema plus the full expression catalogue under `$expressions` (large; rarely needed). SCOPED + CHEAP: pass `namespace` for one namespace, or `namespace` + `type` for a single type's write contract ({ fields, mutations }). Mine the scoped shape BEFORE a create/update so you send only declared fields — autoCRUD rejects undeclared fields with `unknown_field`. CHEAPER STILL: add `shape: \"fields\"` when you only need the type's field names and kinds — for an autoCRUD type the mutations restate the field block five times over, so the default answer costs about 6x the question.",
|
|
2820
2874
|
inputSchema: {
|
|
2821
2875
|
namespace: z.string().min(1).optional().describe("Scope to one namespace, e.g. \"notes\". Omit for the full federated schema."),
|
|
2822
2876
|
type: z.string().min(1).optional().describe("Scope to one type within `namespace`, e.g. \"Todo\" — returns its field defs + create/update param shapes. Requires `namespace`."),
|
|
@@ -2829,7 +2883,7 @@ function createMcpServer(endpoint, options = {}) {
|
|
|
2829
2883
|
{
|
|
2830
2884
|
name: "query",
|
|
2831
2885
|
config: {
|
|
2832
|
-
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\" } }`
|
|
2886
|
+
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\": {...} }. The expression functions for select, where.$expr, groupBy and having are listed by the `schema` tool. 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\" } }` answers one group, or one per key of `groupBy: { day: { dateTrunc: [{ \"lit\": \"day\" }, \"seenAt\"] } }` (a map of names to expressions; `having` filters the groups, `offset` skips them, `orderBy` names their outputs). `select: { m: { sub: [\"_agg.x\", \"price\"] } }` adds a computed value to each row, ordered by `orderBy: [{ \"m\": \"desc\" }]`. An expression is a field name, a literal, `{ \"lit\": \"text\" }` or `{ \"fn\": [args] }`. Walks are query-only: subscribe, stream and mutate refuse them, as does a store without walks (walks_unsupported_store).",
|
|
2833
2887
|
inputSchema: { payload: payloadSchema("Query frame. Example: { \"default/Todo\": { \"params\": { \"limit\": 20 }, \"fields\": { \"id\": true, \"title\": true } } }") }
|
|
2834
2888
|
},
|
|
2835
2889
|
handler: createQueryHandler(endpoint)
|
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
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, 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, X as NlAskResult, Y as NlAskRequest, _ as newlyGrantedPairs, a as denyAll, at as NlOutcome, b as capabilitiesFor, c as requireIdentity, d as KeyUpdateRefusal, dt as NlServedPack, f as checkRevocable, ft as NlTrailEvent, g as newlyGranted, h as grantEntriesConfer, i as allowVerbs, j as not, k as encodeList, l as requireNamespace, m as grantCovers, mt as NlWireEvent, n as row, o as denyVerbs, p as checkUpdatable, q as resolveDefaultKidPath, r as allowAll, s as requireCapability, t as applyRowFilters, u as KeyMutationRefusal, v as revokedAtIso, w as grantEntryError, x as encodeGrant, y as Grant, z as makeTokenProvider } from "./row-
|
|
3
|
-
import { s as SchemaDriftError } from "./index-
|
|
1
|
+
import { W as QualifiedFrame, dn as ResolverStat, f as PackEnvelope, fn as RuntimeErrorEntry, hn as SlowRequest, ln as ProcessStat, m as Schema, mn as RuntimeMetrics, pn as RuntimeErrors, zn as Row } from "./schema-B5WBO8yh.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, 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, X as NlAskResult, Y as NlAskRequest, _ as newlyGrantedPairs, a as denyAll, at as NlOutcome, b as capabilitiesFor, c as requireIdentity, d as KeyUpdateRefusal, dt as NlServedPack, f as checkRevocable, ft as NlTrailEvent, g as newlyGranted, h as grantEntriesConfer, i as allowVerbs, j as not, k as encodeList, l as requireNamespace, m as grantCovers, mt as NlWireEvent, n as row, o as denyVerbs, p as checkUpdatable, q as resolveDefaultKidPath, r as allowAll, s as requireCapability, t as applyRowFilters, u as KeyMutationRefusal, v as revokedAtIso, w as grantEntryError, x as encodeGrant, y as Grant, z as makeTokenProvider } from "./row-DHxnCnhA.js";
|
|
3
|
+
import { s as SchemaDriftError } from "./index-DKJXQ031.js";
|
|
4
4
|
import { Signal } from "@preact/signals-core";
|
|
5
5
|
//#region ../../packages/substrate-client/src/admin/surgery.d.ts
|
|
6
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 { f as SchemaDriftError } from "./src-
|
|
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-DR_hUj2p.js";
|
|
4
|
+
import { f as SchemaDriftError } from "./src-CdbUzLhB.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-DV6PcXym.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,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { En as Edge, On as EdgeRef } from "./schema-B5WBO8yh.js";
|
|
2
2
|
//#region ../../packages/substrate-types/src/errors.d.ts
|
|
3
3
|
/** A by-filter write matched more rows than `SUBSTRATE_FILTER_WRITE_MAX_MATCH`; nothing changed. */
|
|
4
4
|
declare const FILTER_TOO_BROAD = "filter_too_broad";
|
|
@@ -11,6 +11,12 @@ declare const WALK_BUDGET_EXCEEDED = "walk_budget_exceeded";
|
|
|
11
11
|
declare const WALKS_UNSUPPORTED_STORE = "walks_unsupported_store";
|
|
12
12
|
/** A read cancelled by the store's statement timeout; `details: { timeoutMs }`. */
|
|
13
13
|
declare const QUERY_TIMEOUT = "query_timeout";
|
|
14
|
+
/** No store connection came free within the wait limit, so the request never started; retry later. */
|
|
15
|
+
declare const STORE_BUSY = "store_busy";
|
|
16
|
+
/** An aggregate or expression whose value leaves its type's range (an int64 sum past 2^63-1); the same code on every engine. */
|
|
17
|
+
declare const VALUE_OUT_OF_RANGE = "value_out_of_range";
|
|
18
|
+
/** A regex call on the memory evaluator that would take more steps than its budget; `details: { budget }`. */
|
|
19
|
+
declare const REGEX_BUDGET_EXCEEDED = "regex_budget_exceeded";
|
|
14
20
|
/**
|
|
15
21
|
* A walk construct refused where it cannot be answered: inside a struct, over
|
|
16
22
|
* a list or struct-nested crossRef, under a reused field name, on a virtual
|
|
@@ -161,4 +167,4 @@ declare function isResolverFrameError(err: unknown): err is ResolverFrameError;
|
|
|
161
167
|
*/
|
|
162
168
|
declare function isRestrictViolation(err: unknown): err is RestrictViolation;
|
|
163
169
|
//#endregion
|
|
164
|
-
export {
|
|
170
|
+
export { isBatchElementError as C, isAuthCause as S, isRestrictViolation as T, WALKS_NEED_PARTITIONED as _, NamespaceMismatch as a, WALK_UNSUPPORTED_REF as b, ROW_POLICY_BLOCKS_WALK as c, RestrictViolation as d, STORE_BUSY as f, WALKS_IN_SUBSCRIPTION as g, WALKS_IN_MUTATION as h, MissingReferentError as i, ReservedField as l, VALUE_OUT_OF_RANGE as m, BridgeUnreachableError as n, QUERY_TIMEOUT as o, UnsupportedFilterError as p, FILTER_TOO_BROAD as r, REGEX_BUDGET_EXCEEDED as s, BatchElementError as t, ResolverFrameError as u, WALKS_UNSUPPORTED_STORE as v, isResolverFrameError as w, filterTooBroad as x, WALK_BUDGET_EXCEEDED as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as PackEnvelope, i as FieldDef, l as FieldInput, m as Schema } from "./schema-
|
|
1
|
+
import { f as PackEnvelope, i as FieldDef, l as FieldInput, m as Schema } from "./schema-B5WBO8yh.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 {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __binCreateRequire } from 'node:module'; const require = __binCreateRequire(import.meta.url);
|
|
2
2
|
//#region src/node-version.ts
|
|
3
3
|
/** The oldest Node the binaries run on; matches `engines.node` in package.json. */
|
|
4
|
-
const MIN_NODE_VERSION = "26.
|
|
4
|
+
const MIN_NODE_VERSION = "26.13.1";
|
|
5
5
|
/** Returns a refusal message when `version` (e.g. `process.versions.node`) is below the minimum, else null. */
|
|
6
6
|
function nodeVersionRefusal(version) {
|
|
7
7
|
const have = version.split(".").map(Number);
|
package/dist/pack.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { f as PackEnvelope, i as FieldDef, l as FieldInput, m as Schema } from "./schema-
|
|
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-B5WBO8yh.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-DKJXQ031.js";
|
|
3
3
|
//#region ../../packages/substrate-pack/src/content-type.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Content-type negotiation. Spec: §7.0.
|
|
@@ -61,6 +61,22 @@ export declare function encodePositional(value: unknown, fields: FieldInput, sch
|
|
|
61
61
|
*/
|
|
62
62
|
export declare function encodePositionalFromFieldDef(value: unknown, def: FieldDef, schema: Schema, ctx: EncodeContext, path?: string[]): unknown;
|
|
63
63
|
export declare function encodeEnvelope(envelope: PackEnvelope, ctx: EncodeEnvelopeCtx): Buffer;
|
|
64
|
+
/**
|
|
65
|
+
* The wire form of `envelope.data[key]`, or of `value` in its place: rows as
|
|
66
|
+
* positional tuples, or the value as-is when nothing positions it. A `list`
|
|
67
|
+
* value's rows encode one by one, so a slice of its rows gives that slice of
|
|
68
|
+
* the whole value's wire form.
|
|
69
|
+
*/
|
|
70
|
+
export declare function positionValue(envelope: PackEnvelope, ctx: EncodeEnvelopeCtx, key: string, value?: unknown): unknown;
|
|
71
|
+
/** `envelope` with `data` replaced by its wire form; `pack` of it is the response body. */
|
|
72
|
+
export declare function withData(envelope: PackEnvelope, data: Record<string, unknown>): PackEnvelope;
|
|
73
|
+
/**
|
|
74
|
+
* `pack(wire)` in pieces, a long row list `rowsPerPart` rows per piece, for a
|
|
75
|
+
* `wire` envelope from `withData`. msgpackr's default `pack` writes every
|
|
76
|
+
* object as a map16 (`de`) and records no shared state between values, so
|
|
77
|
+
* the pieces concatenate to the same bytes.
|
|
78
|
+
*/
|
|
79
|
+
export declare function packEnvelopeParts(wire: PackEnvelope, rowsPerPart: number): Generator<Uint8Array>;
|
|
64
80
|
//#endregion
|
|
65
81
|
//#region ../../packages/substrate-pack/src/stream-chunk.d.ts
|
|
66
82
|
/**
|
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 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-
|
|
2
|
+
import { S as withData, _ as encodeEnvelope, a as buildDecodePlan, b as packEnvelopeParts, 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, x as positionValue, y as encodePositionalFromFieldDef } from "./src-CdbUzLhB.js";
|
|
3
3
|
import { n as acceptsPack, t as PACK_MIME } from "./content-type-C7T28xNb.js";
|
|
4
4
|
|
|
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 };
|
|
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, packEnvelopeParts, packFrame, positionValue, unpackFrame, withData };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __binCreateRequire } from 'node:module'; const require = __binCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
2
|
+
import { r as txScopeIdFor } from "./src-DWrFdHrY.js";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
|
|
5
5
|
//#region ../../packages/substrate-dataset-pg/src/pg-edges-store.ts
|
|
@@ -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 { Lt as buildContext, tt as applyObligations, vn as ResolverFrameError, zt as jsonResponse } from "./src-BHh6UZ7L.js";
|
|
3
|
+
import "./src-CdbUzLhB.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 { zn as defineBootstrap } from "./src-BHh6UZ7L.js";
|
|
3
|
+
import { n as createNoopPubSub, t as createProposalsPlugin } from "./src-DwynOVMk.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,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { jn as OnDelete, jt as Dataset, x as CoordinatorPlugin } from "./schema-B5WBO8yh.js";
|
|
2
|
+
import { u as ResolverFrameError } from "./errors-DHgT7Fa8.js";
|
|
3
3
|
//#region ../../plugins/substrate-proposals/src/config.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Multi-instance invalidation transport used by the plugin to broadcast
|
|
@@ -23,6 +23,8 @@ interface PubSub {
|
|
|
23
23
|
notify(channel: string, payload: string): Promise<void>;
|
|
24
24
|
}
|
|
25
25
|
interface ProposalsPluginConfig {
|
|
26
|
+
/** Where a one-line warning goes, such as a stored proposal skipped at replay. Defaults to `console.warn`. */
|
|
27
|
+
log?: (line: string) => void;
|
|
26
28
|
/**
|
|
27
29
|
* Namespaces this plugin owns. Propose mutations outside this list are
|
|
28
30
|
* rejected at resolver entry. A proposed crossRef must target a type in an
|
|
@@ -90,7 +92,7 @@ export declare class ProposalError extends ResolverFrameError {
|
|
|
90
92
|
}
|
|
91
93
|
//#endregion
|
|
92
94
|
//#region ../../plugins/substrate-proposals/src/field-spec-json.d.ts
|
|
93
|
-
type ScalarType = 'string' | 'number' | 'boolean' | 'date' | 'json';
|
|
95
|
+
type ScalarType = 'string' | 'number' | 'int16' | 'int32' | 'int64' | 'boolean' | 'date' | 'json';
|
|
94
96
|
interface ScalarSpec {
|
|
95
97
|
kind: 'scalar';
|
|
96
98
|
type: ScalarType;
|
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-DwynOVMk.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 { zn as defineBootstrap } from "./src-BHh6UZ7L.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-Dk9RC3LH.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,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { An as EdgesStore, C as EmbedSourceContext, Ct as ResolverArgs, D as FilterOperatorDef, I as McpToolRegistration, P as KernelPlugin, U as PostWriteHook, bt as PolicyProbeContext, gt as Identity, i as FieldDef, j as KernelMigration, jt as Dataset, tt as HttpHandler, xt as RequestContext, yt as PolicyDecision, zn as Row } from "./schema-B5WBO8yh.js";
|
|
2
2
|
import { t as Embedder } from "./types-8c0gtnd2.js";
|
|
3
3
|
import postgres, { Sql } from "postgres";
|
|
4
4
|
//#region ../../plugins/substrate-recall/src/candidate-selection.d.ts
|
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-7lp1y4HK.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-Dk9RC3LH.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 };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __binCreateRequire } from 'node:module'; const require = __binCreateRequire(import.meta.url);
|
|
2
|
-
import { a as parsePositive, i as DEFAULT_SIZING, n as defaultPluginsForPersona, r as parsePort, t as KNOWN_PLUGINS } from "./cli-
|
|
2
|
+
import { a as parsePositive, i as DEFAULT_SIZING, n as defaultPluginsForPersona, r as parsePort, t as KNOWN_PLUGINS } from "./cli-CwWUYUMv.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { stripVTControlCharacters, styleText } from "node:util";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as BridgeCredential } from "./bridge-
|
|
1
|
+
import { ht as AutoCrudVerb, l as FieldInput, n as Dropped, on as WhereClause, p as PlanClause, vt as Policy, xt as RequestContext, yt as PolicyDecision, zn as Row } from "./schema-B5WBO8yh.js";
|
|
2
|
+
import { n as BridgeCredential } from "./bridge-5VHZiH9o.js";
|
|
3
3
|
//#region ../../packages/substrate-types/src/nl.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* The engine-dispatchable frame a successful NL translation produces. Keys
|
|
@@ -97,7 +97,7 @@ type NlOutcome = {
|
|
|
97
97
|
/**
|
|
98
98
|
* On an `aggregate` answer: `fn` of `field` over the rows the frame matches,
|
|
99
99
|
* as one `value`, or per group keyed by `by` (a field, or the `day`/`hour`
|
|
100
|
-
*
|
|
100
|
+
* date group). Absent when the engine refused the frame, with `errors` saying why.
|
|
101
101
|
*/
|
|
102
102
|
aggregate?: NlAggregate;
|
|
103
103
|
errors?: unknown[];
|
|
@@ -287,15 +287,17 @@ interface NlFieldPhrase {
|
|
|
287
287
|
value?: unknown;
|
|
288
288
|
/** Needs `field`: the implicit filter on that field's type. Never silent: it shows in `plan`. */
|
|
289
289
|
exclude?: WhereClause;
|
|
290
|
-
/** A
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
}
|
|
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
|
+
};
|
|
294
296
|
/** A namespace default pick for this phrase. */
|
|
295
297
|
pick?: 'latest' | 'max' | 'min';
|
|
296
298
|
}
|
|
297
299
|
interface NlNamespaceRulings {
|
|
298
|
-
/** Phrases bound to fields, values, implicit filters,
|
|
300
|
+
/** Phrases bound to fields, values, implicit filters, computed orderings and pick defaults. Keys are normalised (trimmed, single-spaced, lower-cased). */
|
|
299
301
|
fieldPhrases?: Record<string, NlFieldPhrase>;
|
|
300
302
|
/** Types never scoped to the asking project (their `project` means "belongs to", not "applies to"). */
|
|
301
303
|
unscopedTypes?: string[];
|