@mnmal-ai/substrate 1.0.0-alpha.17 → 1.0.0-alpha.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +4 -4
  2. package/dist/{boot-store-DNU0UfX7.js → boot-store-DL2Wkzun.js} +207 -258
  3. package/dist/{bridge-5VHZiH9o.d.ts → bridge-BhiJKwfF.d.ts} +1 -1
  4. package/dist/{cli-CwWUYUMv.js → cli-BYyPsfdY.js} +193 -31
  5. package/dist/client.browser.js +2478 -0
  6. package/dist/client.d.ts +181 -164
  7. package/dist/client.js +5 -5
  8. package/dist/{errors-DHgT7Fa8.d.ts → errors-CYOaWZ8l.d.ts} +1 -1
  9. package/dist/{index-DKJXQ031.d.ts → index-rW7fu2Af.d.ts} +3 -11
  10. package/dist/{node-version-CxqcqECU.js → node-version-BlYrbY2I.js} +8 -1
  11. package/dist/pack.d.ts +59 -11
  12. package/dist/pack.js +2 -2
  13. package/dist/{pg-edges-store-CSJ7sG2l.js → pg-edges-store-B0Krqoac.js} +1 -1
  14. package/dist/{plugin-Dk9RC3LH.js → plugin-Dk9h__NU.js} +2 -2
  15. package/dist/proposals-bootstrap.js +2 -2
  16. package/dist/proposals.d.ts +2 -2
  17. package/dist/proposals.js +1 -1
  18. package/dist/recall-bootstrap.js +2 -2
  19. package/dist/recall.d.ts +1 -1
  20. package/dist/recall.js +2 -2
  21. package/dist/{repl-BNnKFG3y.js → repl-D6_CBsue.js} +1 -1
  22. package/dist/{row-DHxnCnhA.d.ts → row-CfsHSEfB.d.ts} +4 -4
  23. package/dist/{run-NmwNmVUD.js → run-BJMgCcCC.js} +18 -9
  24. package/dist/{schema-B5WBO8yh.d.ts → schema-laGLMvMC.d.ts} +15 -40
  25. package/dist/{script-C6DSa_Na.js → script-DgXaJY1Y.js} +12 -2
  26. package/dist/script-runner.js +78 -0
  27. package/dist/sdk.d.ts +9 -8
  28. package/dist/sdk.js +3 -3
  29. package/dist/{src-CdbUzLhB.js → src-B6nsPVmD.js} +201 -25
  30. package/dist/{src-DV6PcXym.js → src-B_oTGi3X.js} +648 -845
  31. package/dist/{src-DWrFdHrY.js → src-BcigMQdR.js} +7 -4
  32. package/dist/{src-DR_hUj2p.js → src-D3ACIp1y.js} +1 -1
  33. package/dist/{src-DwynOVMk.js → src-Dlmuq32R.js} +3 -3
  34. package/dist/{src-7lp1y4HK.js → src-DreZjBk7.js} +3 -3
  35. package/dist/{src-BHh6UZ7L.js → src-oO0DtS6y.js} +431 -949
  36. package/dist/substrate-admin.js +2 -2
  37. package/dist/substrate.js +2 -2
  38. package/dist/testing.d.ts +13 -47
  39. package/dist/testing.js +6 -167
  40. package/dist/{ws-BL9nSELO.d.ts → ws-BT8kL1IF.d.ts} +4 -4
  41. package/package.json +21 -23
@@ -1,4 +1,4 @@
1
- import { On as EdgeRef, f as PackEnvelope, m as Schema, zn as Row } from "./schema-B5WBO8yh.js";
1
+ import { En as EdgeRef, Ln as Row, f as PackEnvelope, m as Schema } from "./schema-laGLMvMC.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,21 +1,22 @@
1
1
  import { createRequire as __binCreateRequire } from 'node:module'; const require = __binCreateRequire(import.meta.url);
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";
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-oO0DtS6y.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-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
- import { n as runScript, t as DEFAULT_MAX_WRITES } from "./script-C6DSa_Na.js";
9
- import { T as tryWithPgAdvisoryLock } from "./src-DWrFdHrY.js";
10
- import { n as PgLexicalStore, r as PgEmbeddingsStore } from "./src-7lp1y4HK.js";
11
- import { chmodSync, existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
12
- import { homedir, hostname } from "node:os";
4
+ import { L as encodeList, T as SYSTEM_NAMESPACE, f as coversNamespace, m as grantedIn, p as grantOf } from "./src-D3ACIp1y.js";
5
+ import { G as EXPR_AGGREGATES, K as EXPR_FUNCTIONS, W as DATE_UNITS, q as EXPR_LIMITS } from "./src-B6nsPVmD.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-DL2Wkzun.js";
7
+ import { E as substrateFetch, 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-B_oTGi3X.js";
8
+ import { n as runScript, t as DEFAULT_MAX_WRITES } from "./script-DgXaJY1Y.js";
9
+ import { T as tryWithPgAdvisoryLock } from "./src-BcigMQdR.js";
10
+ import { n as PgLexicalStore, r as PgEmbeddingsStore } from "./src-DreZjBk7.js";
11
+ import { chmodSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
12
+ import { homedir, hostname, tmpdir } from "node:os";
13
13
  import { basename, dirname, join, resolve } from "node:path";
14
14
  import { createHash, generateKeyPairSync, randomBytes } from "node:crypto";
15
- import { pathToFileURL } from "node:url";
15
+ import { fileURLToPath, pathToFileURL } from "node:url";
16
16
  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
+ import { fork } from "node:child_process";
19
20
 
20
21
  //#region ../../node_modules/.pnpm/@mnmal-ai+surface-kit@0.17.1_ink@8.0.0_@types+react@19.3.0_react@19.3.1__react@19.3.1/node_modules/@mnmal-ai/surface-kit/dist/cells.js
21
22
  const graphemes = new Intl.Segmenter(void 0, { granularity: "grapheme" });
@@ -344,7 +345,7 @@ async function runCheckEnums(argv = [], options = {}) {
344
345
  write("SUBSTRATE_URL is required (e.g. https://substrate.example.com:3100)\n");
345
346
  return 2;
346
347
  }
347
- const baseFetch = options.fetchImpl ?? fetch;
348
+ const baseFetch = options.fetchImpl ?? substrateFetch;
348
349
  const fetchImpl = (url, init) => baseFetch(url, {
349
350
  ...init,
350
351
  redirect: "error"
@@ -837,7 +838,7 @@ function installShutdown(args) {
837
838
  * bridge without one refuses to boot rather than
838
839
  * connecting unauthenticated.
839
840
  * SUBSTRATE_SENTINEL_CREDENTIAL JSON { keyPath, kid } the sentinel-client signs its
840
- * WS upgrade with. REQUIRED whenever
841
+ * frame-stream requests with. REQUIRED whenever
841
842
  * SUBSTRATE_SENTINEL_URL is set.
842
843
  * SUBSTRATE_AUTH_KEY_REGISTRY path to JSON key file (optional — auth opt-in)
843
844
  * SUBSTRATE_ADMIN_CAPABILITY JWT claim value granting admin (optional)
@@ -879,7 +880,7 @@ function installShutdown(args) {
879
880
  * Env parsing is the pure `parseEnv(env)`; `runServe()` sequences the I/O.
880
881
  */
881
882
  /**
882
- * Boot the Substrate HTTP/WS server. Reads env, wires substrate + coordinators,
883
+ * Boot the Substrate HTTP server. Reads env, wires substrate + coordinators,
883
884
  * starts Fastify, registers signal handlers for graceful shutdown. Invoked
884
885
  * through the `substrate serve` subcommand.
885
886
  */
@@ -980,7 +981,7 @@ async function httpJson(url, opts = {}) {
980
981
  init.redirect = "error";
981
982
  let res;
982
983
  try {
983
- res = await fetch(url, init);
984
+ res = await substrateFetch(url, init);
984
985
  } catch (err) {
985
986
  throw new HttpJsonError(`${url}: ${err instanceof Error ? err.message : String(err)}`);
986
987
  }
@@ -1306,7 +1307,7 @@ const CLI_ACTOR_KID = "substrate-federate-cli";
1306
1307
  const defaultProbe = (origin) => probeAuthPosture(origin);
1307
1308
  async function runEnroll(args, env, openDataset = openPgDataset, probe = defaultProbe) {
1308
1309
  const posture = await probe(args.origin);
1309
- if (posture === "disabled") throw new AdminCliError(`${args.origin} reports auth is DISABLED — a credential issued against it would verify nothing. Set SUBSTRATE_AUTH_MODE and SUBSTRATE_STREAM_TICKET_SECRET on the callee, restart it, then retry.`, 7);
1310
+ if (posture === "disabled") throw new AdminCliError(`${args.origin} reports auth is DISABLED — a credential issued against it would verify nothing. Set SUBSTRATE_AUTH_MODE on the callee, restart it, then retry.`, 7);
1310
1311
  const probeWarning = posture === "unreachable" ? `could not reach ${args.origin} to confirm auth is enabled — minting anyway. Verify the callee shows \`auth: enabled\` in its boot banner.` : null;
1311
1312
  const code = randomBytes(32).toString("base64url");
1312
1313
  const now = /* @__PURE__ */ new Date();
@@ -2132,7 +2133,7 @@ function readmeTemplate(ctx) {
2132
2133
  lines.push("");
2133
2134
  lines.push("## Reaching this instance");
2134
2135
  lines.push("");
2135
- const curlFlags = ctx.substrateUrl.startsWith("https") ? "-sfk" : "-sf";
2136
+ const curlFlags = `${ctx.substrateUrl.startsWith("https") ? "-sfk" : "-sf"} --http2-prior-knowledge`;
2136
2137
  lines.push(`Health check: \`curl ${curlFlags} ${ctx.substrateUrl}/health\``);
2137
2138
  lines.push("");
2138
2139
  lines.push(`Clients (MCP/CLI — e.g. \`.mcp.json\`) connect via \`SUBSTRATE_URL=${ctx.substrateUrl}\`. That's a **client** setting: the server reads \`PORT\`${ctx.tls ? " + the TLS paths" : ""}, not \`SUBSTRATE_URL\`.`);
@@ -2163,7 +2164,7 @@ async function runInit(argv) {
2163
2164
  return 1;
2164
2165
  }
2165
2166
  if (!config.yes) try {
2166
- const { runRepl } = await import("./repl-BNnKFG3y.js");
2167
+ const { runRepl } = await import("./repl-D6_CBsue.js");
2167
2168
  config = await runRepl(config);
2168
2169
  } catch (err) {
2169
2170
  if (err.message?.includes("User force closed")) return 130;
@@ -2455,6 +2456,126 @@ function makeAgentJwtProvider(env, audience) {
2455
2456
  return () => provider();
2456
2457
  }
2457
2458
 
2459
+ //#endregion
2460
+ //#region src/mcp/run-sandbox.ts
2461
+ /**
2462
+ * Runs agent-supplied script text in a sandboxed child process (Decision #642).
2463
+ *
2464
+ * The child runs under Node's permission model: it may read only its runner and
2465
+ * the script, and has no network, child processes, workers or environment. Each
2466
+ * ScriptContext call it makes is relayed to a real one from `runScript`, so the
2467
+ * read / dry-run / write modes, `maxWrites`, signing and the report are exactly
2468
+ * the CLI's.
2469
+ */
2470
+ const DEFAULT_RUN_TIMEOUT_MS = 6e4;
2471
+ /** Heap ceiling for one script's child, in MiB. */
2472
+ const CHILD_HEAP_MB = 256;
2473
+ const OPS = /* @__PURE__ */ new Set([
2474
+ "query",
2475
+ "queryAll",
2476
+ "recall",
2477
+ "schema",
2478
+ "mutate",
2479
+ "log"
2480
+ ]);
2481
+ /** The runner beside this module: `.js` in the built package, `.ts` when run from source. */
2482
+ function runnerPath() {
2483
+ const js = fileURLToPath(new URL("./script-runner.js", import.meta.url));
2484
+ return existsSync(js) ? js : fileURLToPath(new URL("./script-runner.ts", import.meta.url));
2485
+ }
2486
+ async function runSandboxed(source, opts) {
2487
+ const dir = mkdtempSync(join(tmpdir(), "substrate-run-"));
2488
+ const script = join(dir, "script.mts");
2489
+ writeFileSync(script, source);
2490
+ const runner = runnerPath();
2491
+ const timeoutMs = opts.timeoutMs ?? 6e4;
2492
+ try {
2493
+ return await runScript((s) => inChild(s, runner, script, timeoutMs), {
2494
+ client: opts.client,
2495
+ kid: opts.kid,
2496
+ ...opts.mode !== void 0 ? { mode: opts.mode } : {},
2497
+ ...opts.args !== void 0 ? { args: opts.args } : {},
2498
+ ...opts.maxWrites !== void 0 ? { maxWrites: opts.maxWrites } : {},
2499
+ ...opts.log !== void 0 ? { log: opts.log } : {}
2500
+ });
2501
+ } finally {
2502
+ rmSync(dir, {
2503
+ recursive: true,
2504
+ force: true
2505
+ });
2506
+ }
2507
+ }
2508
+ function inChild(s, runner, script, timeoutMs) {
2509
+ return new Promise((resolve, reject) => {
2510
+ const child = fork(runner, [], {
2511
+ execArgv: [
2512
+ "--permission",
2513
+ `--allow-fs-read=${runner}`,
2514
+ `--allow-fs-read=${script}`,
2515
+ `--max-old-space-size=${CHILD_HEAP_MB}`
2516
+ ],
2517
+ env: {},
2518
+ stdio: [
2519
+ "ignore",
2520
+ "ignore",
2521
+ "ignore",
2522
+ "ipc"
2523
+ ],
2524
+ serialization: "advanced"
2525
+ });
2526
+ let settled = false;
2527
+ const finish = (err, value) => {
2528
+ if (settled) return;
2529
+ settled = true;
2530
+ clearTimeout(timer);
2531
+ child.kill("SIGKILL");
2532
+ if (err !== null) reject(err);
2533
+ else resolve(value);
2534
+ };
2535
+ const timer = setTimeout(() => finish(/* @__PURE__ */ new Error(`script timed out after ${timeoutMs} ms`)), timeoutMs);
2536
+ child.on("error", (err) => finish(err));
2537
+ child.on("exit", (code, signal) => finish(/* @__PURE__ */ new Error(`script process exited (${signal ?? `code ${code}`}) before finishing`)));
2538
+ child.on("message", (m) => {
2539
+ if (m.type === "done") {
2540
+ if (m.ok === true) finish(null, m.result);
2541
+ else finish(new Error(m.error ?? "script failed"));
2542
+ return;
2543
+ }
2544
+ if (m.type !== "call" || m.id === void 0) return;
2545
+ const id = m.id;
2546
+ const reply = (r) => {
2547
+ if (!settled) child.send({
2548
+ type: "reply",
2549
+ id,
2550
+ ...r
2551
+ });
2552
+ };
2553
+ if (m.op === void 0 || !OPS.has(m.op)) {
2554
+ reply({
2555
+ ok: false,
2556
+ error: `unknown context call '${String(m.op)}'`
2557
+ });
2558
+ return;
2559
+ }
2560
+ const fn = s[m.op];
2561
+ Promise.resolve().then(() => fn(...m.input ?? [])).then((value) => reply({
2562
+ ok: true,
2563
+ value
2564
+ }), (err) => reply({
2565
+ ok: false,
2566
+ error: err instanceof Error ? err.message : String(err)
2567
+ }));
2568
+ });
2569
+ child.send({
2570
+ type: "start",
2571
+ script,
2572
+ kid: s.kid,
2573
+ mode: s.mode,
2574
+ args: { ...s.args }
2575
+ });
2576
+ });
2577
+ }
2578
+
2458
2579
  //#endregion
2459
2580
  //#region src/mcp/schema-overview.ts
2460
2581
  /**
@@ -2565,7 +2686,7 @@ const LOCAL_EXPRESSIONS_NOTE = "The server published no expression catalogue (GE
2565
2686
  *
2566
2687
  * Every tool is a thin JSON-over-HTTP proxy to a `/substrate/v1/*` route. Frame keys
2567
2688
  * are qualified (`<ns>/<Type>`, §4.7), so one call can fan across namespaces.
2568
- * Subscribe / stream are WS-only and not exposed — stdio cannot host
2689
+ * Subscribe / stream are long-lived frame streams and not exposed — stdio cannot host
2569
2690
  * long-lived push streams cleanly.
2570
2691
  *
2571
2692
  * Run by the `substrate mcp` subcommand via `runMcp`.
@@ -2652,7 +2773,7 @@ async function postSubstrate(endpoint, path, body, errorMode = "textPreview") {
2652
2773
  const url = `${trimTrailingSlashes(endpoint)}${path}`;
2653
2774
  let res;
2654
2775
  try {
2655
- res = await fetch(url, {
2776
+ res = await substrateFetch(url, {
2656
2777
  method: "POST",
2657
2778
  headers: authHeaders(endpoint, {
2658
2779
  "content-type": "application/json",
@@ -2690,7 +2811,7 @@ async function getSubstrate(endpoint, path) {
2690
2811
  const url = `${trimTrailingSlashes(endpoint)}${path}`;
2691
2812
  let res;
2692
2813
  try {
2693
- res = await fetch(url, {
2814
+ res = await substrateFetch(url, {
2694
2815
  method: "GET",
2695
2816
  headers: authHeaders(endpoint, { accept: "application/json" }),
2696
2817
  redirect: "error"
@@ -2861,6 +2982,33 @@ function createDropTypeHandler(endpoint) {
2861
2982
  }
2862
2983
  };
2863
2984
  }
2985
+ /**
2986
+ * `run`: one script, sandboxed (Decision #642), signed as this MCP server's
2987
+ * agent. The client is made on first use and kept: building it reads the key.
2988
+ */
2989
+ function createRunHandler(env = process.env) {
2990
+ let signed;
2991
+ return async (input) => {
2992
+ try {
2993
+ signed ??= createClientFromEnv({ env });
2994
+ if (signed.kid === null) return errorResult("run needs an agent identity: set SUBSTRATE_AGENT_KEY_ID and SUBSTRATE_AGENT_KEY_PATH");
2995
+ const report = await runSandboxed(input.script, {
2996
+ client: signed.client,
2997
+ kid: signed.kid,
2998
+ mode: input.mode ?? "read",
2999
+ args: input.args ?? {},
3000
+ maxWrites: input.maxWrites ?? 50,
3001
+ log: () => {}
3002
+ });
3003
+ return report.ok ? okResult(report) : {
3004
+ ...okResult(report),
3005
+ isError: true
3006
+ };
3007
+ } catch (err) {
3008
+ return errorResult(toMessage(err));
3009
+ }
3010
+ };
3011
+ }
2864
3012
  function createMcpServer(endpoint, options = {}) {
2865
3013
  const server = new McpServer({
2866
3014
  name: "substrate",
@@ -2896,6 +3044,23 @@ function createMcpServer(endpoint, options = {}) {
2896
3044
  },
2897
3045
  handler: createMutateHandler(endpoint)
2898
3046
  },
3047
+ {
3048
+ name: "run",
3049
+ config: {
3050
+ description: "Run a short script against Substrate in one call: many queries and writes, one small report back. Use it when the work takes three or more dependent calls (ids passed from one call to the next, a census that must page, a join, recall-then-hydrate, a batch of writes chosen by a read). `script` is a JS/TS module whose default export is `async (s) => result`; type syntax is stripped. `s` has: kid, mode, args; query(frame) (throws on a refused frame); queryAll(key, { params, fields }) (pages to the end); recall({ query, namespace, type, k?, where?, row? }); schema(namespace?, type?); mutate(frame); log(...). Return counts, ids and short handles, not whole rows. Modes: \"read\" (default) refuses mutate; \"dry-run\" records each mutate payload in the report without sending it; \"write\" sends up to maxWrites frames (default 50; an array element counts one). Dry-run first, read report.mutations, then write. The script runs sandboxed: no files, network, processes or environment; it reaches only the store, as this agent. Report: { ok, kid, mode, result, error?, mutations[{ frame, applied, errors? }], warnings, stats }.",
3051
+ inputSchema: {
3052
+ script: z.string().min(1).describe("Module text, e.g. \"export default async (s) => (await s.queryAll('cortext/Todo', { params: { where: { status: { eq: 'open' } } }, fields: { id: true } })).length\""),
3053
+ args: z.record(z.string(), z.unknown()).optional().describe("Passed to the script as s.args."),
3054
+ mode: z.enum([
3055
+ "read",
3056
+ "dry-run",
3057
+ "write"
3058
+ ]).optional().describe("Default \"read\"."),
3059
+ maxWrites: z.number().int().nonnegative().optional().describe("Write mode: most mutate frames to send. Default 50.")
3060
+ }
3061
+ },
3062
+ handler: createRunHandler()
3063
+ },
2899
3064
  {
2900
3065
  name: "ask",
2901
3066
  config: {
@@ -3079,7 +3244,7 @@ async function runMcp() {
3079
3244
  /**
3080
3245
  * Substrate CLI dispatcher. The unified `substrate` binary dispatches on argv[2]:
3081
3246
  *
3082
- * substrate serve — boot the HTTP/WS server (./main.ts)
3247
+ * substrate serve — boot the HTTP server (./main.ts)
3083
3248
  * substrate mcp — boot the stdio MCP transport (./mcp/server.ts)
3084
3249
  * substrate init — scaffold a runtime directory (./cli/init)
3085
3250
  * substrate check-enums — report stored values outside declared enums
@@ -3100,7 +3265,7 @@ Usage:
3100
3265
  substrate <subcommand> --help Print this help.
3101
3266
 
3102
3267
  Subcommands:
3103
- serve Boot the Substrate HTTP/WS server (default port 3100).
3268
+ serve Boot the Substrate HTTP server (default port 3100).
3104
3269
  mcp Boot the stdio MCP server. Reads SUBSTRATE_URL, and
3105
3270
  SUBSTRATE_MCP_TOOLS (csv) to register only those tools.
3106
3271
  init [dir] [flags] Scaffold a new Substrate runtime directory. Interactive by
@@ -3139,14 +3304,11 @@ Environment for \`serve\` (the load-bearing ones; the full reference is in the d
3139
3304
  SUBSTRATE_AUTH_MODE 'attribute' or 'required'. Setting this or
3140
3305
  SUBSTRATE_AUTH_KEY_REGISTRY enables auth; with
3141
3306
  neither, every request is anonymous.
3142
- SUBSTRATE_STREAM_TICKET_SECRET HMAC key signing the SSE stream tickets. REQUIRED when
3143
- auth is enabled — boot fails without it. Minimum 16
3144
- characters after trimming. The ticket signature is the
3145
- ONLY authentication on GET /substrate/v1/stream and
3146
- GET /substrate/v1/subscribe (EventSource can send no
3147
- header or body). Rotating it invalidates every
3148
- outstanding ticket, which is the only revocation
3149
- mechanism.
3307
+ SUBSTRATE_CURSOR_SECRET Seals pagination cursors under row-filter policies, so
3308
+ every process sharing it opens the same cursors.
3309
+ Unset, the key is per process and a sealed cursor stops
3310
+ opening after a restart. SUBSTRATE_STREAM_TICKET_SECRET
3311
+ is read when this is unset.
3150
3312
  SUBSTRATE_PUBLIC_ORIGIN This server's origins, comma-separated (e.g.
3151
3313
  https://host:3100,https://alias). A token must carry
3152
3314
  'aud' naming one; a token with no 'aud' is refused.