@mnmal-ai/substrate 1.0.0-alpha.18 → 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.
- package/README.md +4 -4
- package/dist/{boot-store-C8KrACZ5.js → boot-store-DL2Wkzun.js} +191 -268
- package/dist/{bridge-5VHZiH9o.d.ts → bridge-BhiJKwfF.d.ts} +1 -1
- package/dist/{cli-zZ7nHhY5.js → cli-BYyPsfdY.js} +25 -28
- package/dist/client.browser.js +2478 -0
- package/dist/client.d.ts +176 -164
- package/dist/client.js +5 -5
- package/dist/{errors-DHgT7Fa8.d.ts → errors-CYOaWZ8l.d.ts} +1 -1
- package/dist/{index-DKJXQ031.d.ts → index-rW7fu2Af.d.ts} +3 -11
- package/dist/{node-version-CxqcqECU.js → node-version-BlYrbY2I.js} +8 -1
- package/dist/pack.d.ts +59 -11
- package/dist/pack.js +2 -2
- package/dist/{pg-edges-store-D7etFxNK.js → pg-edges-store-B0Krqoac.js} +1 -1
- package/dist/{plugin-DcoJGEMM.js → plugin-Dk9h__NU.js} +2 -2
- package/dist/proposals-bootstrap.js +2 -2
- package/dist/proposals.d.ts +2 -2
- 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-SY8cLOZl.js → repl-D6_CBsue.js} +1 -1
- package/dist/{row-DHxnCnhA.d.ts → row-CfsHSEfB.d.ts} +4 -4
- package/dist/{run-Cr-53N3F.js → run-BJMgCcCC.js} +18 -9
- package/dist/{schema-B5WBO8yh.d.ts → schema-laGLMvMC.d.ts} +15 -40
- package/dist/{script-B-32wZGY.js → script-DgXaJY1Y.js} +1 -1
- package/dist/sdk.d.ts +6 -6
- package/dist/sdk.js +3 -3
- package/dist/{src-CdbUzLhB.js → src-B6nsPVmD.js} +201 -25
- package/dist/{src-DV6PcXym.js → src-B_oTGi3X.js} +648 -845
- package/dist/{src-BcuotITf.js → src-BcigMQdR.js} +7 -4
- package/dist/{src-DR_hUj2p.js → src-D3ACIp1y.js} +1 -1
- package/dist/{src-B4dTiEWw.js → src-Dlmuq32R.js} +3 -3
- package/dist/{src-DZfgQ2gR.js → src-DreZjBk7.js} +3 -3
- package/dist/{src-D55T3ZcP.js → src-oO0DtS6y.js} +313 -887
- package/dist/substrate-admin.js +2 -2
- package/dist/substrate.js +2 -2
- package/dist/testing.d.ts +13 -47
- package/dist/testing.js +6 -167
- package/dist/{ws-BL9nSELO.d.ts → ws-BT8kL1IF.d.ts} +4 -4
- package/package.json +21 -23
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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,13 +1,13 @@
|
|
|
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-
|
|
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-
|
|
5
|
-
import {
|
|
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-
|
|
8
|
-
import { n as runScript, t as DEFAULT_MAX_WRITES } from "./script-
|
|
9
|
-
import { T as tryWithPgAdvisoryLock } from "./src-
|
|
10
|
-
import { n as PgLexicalStore, r as PgEmbeddingsStore } from "./src-
|
|
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
11
|
import { chmodSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
12
12
|
import { homedir, hostname, tmpdir } from "node:os";
|
|
13
13
|
import { basename, dirname, join, resolve } from "node:path";
|
|
@@ -345,7 +345,7 @@ async function runCheckEnums(argv = [], options = {}) {
|
|
|
345
345
|
write("SUBSTRATE_URL is required (e.g. https://substrate.example.com:3100)\n");
|
|
346
346
|
return 2;
|
|
347
347
|
}
|
|
348
|
-
const baseFetch = options.fetchImpl ??
|
|
348
|
+
const baseFetch = options.fetchImpl ?? substrateFetch;
|
|
349
349
|
const fetchImpl = (url, init) => baseFetch(url, {
|
|
350
350
|
...init,
|
|
351
351
|
redirect: "error"
|
|
@@ -838,7 +838,7 @@ function installShutdown(args) {
|
|
|
838
838
|
* bridge without one refuses to boot rather than
|
|
839
839
|
* connecting unauthenticated.
|
|
840
840
|
* SUBSTRATE_SENTINEL_CREDENTIAL JSON { keyPath, kid } the sentinel-client signs its
|
|
841
|
-
*
|
|
841
|
+
* frame-stream requests with. REQUIRED whenever
|
|
842
842
|
* SUBSTRATE_SENTINEL_URL is set.
|
|
843
843
|
* SUBSTRATE_AUTH_KEY_REGISTRY path to JSON key file (optional — auth opt-in)
|
|
844
844
|
* SUBSTRATE_ADMIN_CAPABILITY JWT claim value granting admin (optional)
|
|
@@ -880,7 +880,7 @@ function installShutdown(args) {
|
|
|
880
880
|
* Env parsing is the pure `parseEnv(env)`; `runServe()` sequences the I/O.
|
|
881
881
|
*/
|
|
882
882
|
/**
|
|
883
|
-
* Boot the Substrate HTTP
|
|
883
|
+
* Boot the Substrate HTTP server. Reads env, wires substrate + coordinators,
|
|
884
884
|
* starts Fastify, registers signal handlers for graceful shutdown. Invoked
|
|
885
885
|
* through the `substrate serve` subcommand.
|
|
886
886
|
*/
|
|
@@ -981,7 +981,7 @@ async function httpJson(url, opts = {}) {
|
|
|
981
981
|
init.redirect = "error";
|
|
982
982
|
let res;
|
|
983
983
|
try {
|
|
984
|
-
res = await
|
|
984
|
+
res = await substrateFetch(url, init);
|
|
985
985
|
} catch (err) {
|
|
986
986
|
throw new HttpJsonError(`${url}: ${err instanceof Error ? err.message : String(err)}`);
|
|
987
987
|
}
|
|
@@ -1307,7 +1307,7 @@ const CLI_ACTOR_KID = "substrate-federate-cli";
|
|
|
1307
1307
|
const defaultProbe = (origin) => probeAuthPosture(origin);
|
|
1308
1308
|
async function runEnroll(args, env, openDataset = openPgDataset, probe = defaultProbe) {
|
|
1309
1309
|
const posture = await probe(args.origin);
|
|
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
|
|
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);
|
|
1311
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;
|
|
1312
1312
|
const code = randomBytes(32).toString("base64url");
|
|
1313
1313
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2133,7 +2133,7 @@ function readmeTemplate(ctx) {
|
|
|
2133
2133
|
lines.push("");
|
|
2134
2134
|
lines.push("## Reaching this instance");
|
|
2135
2135
|
lines.push("");
|
|
2136
|
-
const curlFlags = ctx.substrateUrl.startsWith("https") ? "-sfk" : "-sf"
|
|
2136
|
+
const curlFlags = `${ctx.substrateUrl.startsWith("https") ? "-sfk" : "-sf"} --http2-prior-knowledge`;
|
|
2137
2137
|
lines.push(`Health check: \`curl ${curlFlags} ${ctx.substrateUrl}/health\``);
|
|
2138
2138
|
lines.push("");
|
|
2139
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\`.`);
|
|
@@ -2164,7 +2164,7 @@ async function runInit(argv) {
|
|
|
2164
2164
|
return 1;
|
|
2165
2165
|
}
|
|
2166
2166
|
if (!config.yes) try {
|
|
2167
|
-
const { runRepl } = await import("./repl-
|
|
2167
|
+
const { runRepl } = await import("./repl-D6_CBsue.js");
|
|
2168
2168
|
config = await runRepl(config);
|
|
2169
2169
|
} catch (err) {
|
|
2170
2170
|
if (err.message?.includes("User force closed")) return 130;
|
|
@@ -2686,7 +2686,7 @@ const LOCAL_EXPRESSIONS_NOTE = "The server published no expression catalogue (GE
|
|
|
2686
2686
|
*
|
|
2687
2687
|
* Every tool is a thin JSON-over-HTTP proxy to a `/substrate/v1/*` route. Frame keys
|
|
2688
2688
|
* are qualified (`<ns>/<Type>`, §4.7), so one call can fan across namespaces.
|
|
2689
|
-
* Subscribe / stream are
|
|
2689
|
+
* Subscribe / stream are long-lived frame streams and not exposed — stdio cannot host
|
|
2690
2690
|
* long-lived push streams cleanly.
|
|
2691
2691
|
*
|
|
2692
2692
|
* Run by the `substrate mcp` subcommand via `runMcp`.
|
|
@@ -2773,7 +2773,7 @@ async function postSubstrate(endpoint, path, body, errorMode = "textPreview") {
|
|
|
2773
2773
|
const url = `${trimTrailingSlashes(endpoint)}${path}`;
|
|
2774
2774
|
let res;
|
|
2775
2775
|
try {
|
|
2776
|
-
res = await
|
|
2776
|
+
res = await substrateFetch(url, {
|
|
2777
2777
|
method: "POST",
|
|
2778
2778
|
headers: authHeaders(endpoint, {
|
|
2779
2779
|
"content-type": "application/json",
|
|
@@ -2811,7 +2811,7 @@ async function getSubstrate(endpoint, path) {
|
|
|
2811
2811
|
const url = `${trimTrailingSlashes(endpoint)}${path}`;
|
|
2812
2812
|
let res;
|
|
2813
2813
|
try {
|
|
2814
|
-
res = await
|
|
2814
|
+
res = await substrateFetch(url, {
|
|
2815
2815
|
method: "GET",
|
|
2816
2816
|
headers: authHeaders(endpoint, { accept: "application/json" }),
|
|
2817
2817
|
redirect: "error"
|
|
@@ -3244,7 +3244,7 @@ async function runMcp() {
|
|
|
3244
3244
|
/**
|
|
3245
3245
|
* Substrate CLI dispatcher. The unified `substrate` binary dispatches on argv[2]:
|
|
3246
3246
|
*
|
|
3247
|
-
* substrate serve — boot the HTTP
|
|
3247
|
+
* substrate serve — boot the HTTP server (./main.ts)
|
|
3248
3248
|
* substrate mcp — boot the stdio MCP transport (./mcp/server.ts)
|
|
3249
3249
|
* substrate init — scaffold a runtime directory (./cli/init)
|
|
3250
3250
|
* substrate check-enums — report stored values outside declared enums
|
|
@@ -3265,7 +3265,7 @@ Usage:
|
|
|
3265
3265
|
substrate <subcommand> --help Print this help.
|
|
3266
3266
|
|
|
3267
3267
|
Subcommands:
|
|
3268
|
-
serve Boot the Substrate HTTP
|
|
3268
|
+
serve Boot the Substrate HTTP server (default port 3100).
|
|
3269
3269
|
mcp Boot the stdio MCP server. Reads SUBSTRATE_URL, and
|
|
3270
3270
|
SUBSTRATE_MCP_TOOLS (csv) to register only those tools.
|
|
3271
3271
|
init [dir] [flags] Scaffold a new Substrate runtime directory. Interactive by
|
|
@@ -3304,14 +3304,11 @@ Environment for \`serve\` (the load-bearing ones; the full reference is in the d
|
|
|
3304
3304
|
SUBSTRATE_AUTH_MODE 'attribute' or 'required'. Setting this or
|
|
3305
3305
|
SUBSTRATE_AUTH_KEY_REGISTRY enables auth; with
|
|
3306
3306
|
neither, every request is anonymous.
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
header or body). Rotating it invalidates every
|
|
3313
|
-
outstanding ticket, which is the only revocation
|
|
3314
|
-
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.
|
|
3315
3312
|
SUBSTRATE_PUBLIC_ORIGIN This server's origins, comma-separated (e.g.
|
|
3316
3313
|
https://host:3100,https://alias). A token must carry
|
|
3317
3314
|
'aud' naming one; a token with no 'aud' is refused.
|