@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.
- package/README.md +4 -4
- package/dist/{boot-store-DNU0UfX7.js → boot-store-DL2Wkzun.js} +207 -258
- package/dist/{bridge-5VHZiH9o.d.ts → bridge-BhiJKwfF.d.ts} +1 -1
- package/dist/{cli-CwWUYUMv.js → cli-BYyPsfdY.js} +193 -31
- package/dist/client.browser.js +2478 -0
- package/dist/client.d.ts +181 -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-CSJ7sG2l.js → pg-edges-store-B0Krqoac.js} +1 -1
- package/dist/{plugin-Dk9RC3LH.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-BNnKFG3y.js → repl-D6_CBsue.js} +1 -1
- package/dist/{row-DHxnCnhA.d.ts → row-CfsHSEfB.d.ts} +4 -4
- package/dist/{run-NmwNmVUD.js → run-BJMgCcCC.js} +18 -9
- package/dist/{schema-B5WBO8yh.d.ts → schema-laGLMvMC.d.ts} +15 -40
- package/dist/{script-C6DSa_Na.js → script-DgXaJY1Y.js} +12 -2
- package/dist/script-runner.js +78 -0
- package/dist/sdk.d.ts +9 -8
- 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-DWrFdHrY.js → src-BcigMQdR.js} +7 -4
- package/dist/{src-DR_hUj2p.js → src-D3ACIp1y.js} +1 -1
- package/dist/{src-DwynOVMk.js → src-Dlmuq32R.js} +3 -3
- package/dist/{src-7lp1y4HK.js → src-DreZjBk7.js} +3 -3
- package/dist/{src-BHh6UZ7L.js → src-oO0DtS6y.js} +431 -949
- 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
package/dist/substrate-admin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __binCreateRequire } from 'node:module'; const require = __binCreateRequire(import.meta.url);
|
|
3
|
-
import { t as assertNodeVersion } from "./node-version-
|
|
3
|
+
import { t as assertNodeVersion } from "./node-version-BlYrbY2I.js";
|
|
4
4
|
import { realpathSync } from "node:fs";
|
|
5
5
|
import { pathToFileURL } from "node:url";
|
|
6
6
|
|
|
@@ -37,7 +37,7 @@ function isEntrypointPath(moduleUrl, argv1) {
|
|
|
37
37
|
*/
|
|
38
38
|
if (isEntrypointPath(import.meta.url, process.argv[1])) {
|
|
39
39
|
assertNodeVersion();
|
|
40
|
-
import("./run-
|
|
40
|
+
import("./run-BJMgCcCC.js").then(({ runAdminCli }) => runAdminCli());
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
//#endregion
|
package/dist/substrate.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __binCreateRequire } from 'node:module'; const require = __binCreateRequire(import.meta.url);
|
|
3
|
-
import { t as assertNodeVersion } from "./node-version-
|
|
3
|
+
import { t as assertNodeVersion } from "./node-version-BlYrbY2I.js";
|
|
4
4
|
|
|
5
5
|
//#region src/bin/substrate.ts
|
|
6
6
|
assertNodeVersion();
|
|
7
|
-
import("./cli-
|
|
7
|
+
import("./cli-BYyPsfdY.js").then(({ runCli }) => runCli(process.argv.slice(2))).then((code) => process.exit(code));
|
|
8
8
|
|
|
9
9
|
//#endregion
|
|
10
10
|
export { };
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as WsResponseFrame, f as IdempotencyStore, l as SweepDeps, s as BridgeRegistry, u as SweepState } from "./ws-
|
|
1
|
+
import { At as DatasetRegistry, Bn as WriteRow, Bt as IndexPlan, Cn as CanDeleteResult, Dn as EdgeWriteInput, Dt as ConditionalUpdateResult, E as EngineInput, En as EdgeRef, Ft as FilterCapabilities, G as Registry$1, Gt as ReadParams, It as FilterWriteLimits, J as RegistryEntryInput, Jt as StorageReport, K as RegistryBase, Kt as ReadResult, L as NamespaceConfig, Ln as Row, Lt as FilterWriteOptions, Mt as DropResult, On as EdgesStore, P as KernelPlugin, Pn as Id, Qt as UpdateFieldRef, Rt as FilterWriteResult, S as DropParticipant, T as EngineHandle, Tn as EdgePatch, Tt as WriteEvent, Ut as PoolStats, W as QualifiedFrame, Wt as PromotionEvent, Yt as TxScopeHandles, Z as ScheduledTask, Zt as TypeStorageReport, _t as PolicyDecision, an as WriteOptions, at as RequestObserver, b as CommittedWritesHook, cn as ResolveObservation, ct as SubstrateRequest, d as OrderedBy, dn as RuntimeErrors, f as PackEnvelope, i as FieldDef, in as WhereClause, jn as ActorIdentity, jt as DeleteResult, k as IndexDecl, kt as Dataset, ln as ResolverStat, lt as SubstrateResponse, m as Schema, mn as TypeStats, mt as Identity, nt as HttpMethod, on as WriteResult, ot as RuntimeOp, pn as SlowRequest, q as RegistryEntry, rt as PluginRouter, sn as ProcessStat, st as StartOpts, tt as HttpHandler, ut as SubstrateServer, vt as PolicyProbeContext, wn as Edge, x as CoordinatorPlugin, xt as ResolverArgs, yt as RequestContext } from "./schema-laGLMvMC.js";
|
|
2
|
+
import { a as WsResponseFrame, f as IdempotencyStore, l as SweepDeps, s as BridgeRegistry, u as SweepState } from "./ws-BT8kL1IF.js";
|
|
3
3
|
import { t as Embedder } from "./types-8c0gtnd2.js";
|
|
4
4
|
import { Sql, TransactionSql } from "postgres";
|
|
5
5
|
//#region ../../packages/substrate-compose/src/auth.d.ts
|
|
@@ -336,10 +336,10 @@ interface EngineOptions {
|
|
|
336
336
|
* without the call site knowing which metric string to use.
|
|
337
337
|
*
|
|
338
338
|
* - `'cancel'` — explicit client-driven cancel (op: 'cancel') or direct handle use
|
|
339
|
-
* - `'
|
|
339
|
+
* - `'client_disconnect'` — client disconnected (response closed)
|
|
340
340
|
* - `'shutdown'` — server-initiated graceful shutdown (conn.onShutdown)
|
|
341
341
|
*/
|
|
342
|
-
type SubscriptionCancelReason = 'cancel' | '
|
|
342
|
+
type SubscriptionCancelReason = 'cancel' | 'client_disconnect' | 'shutdown';
|
|
343
343
|
interface SubscriptionHandle {
|
|
344
344
|
readonly __brand?: 'SubscriptionHandle';
|
|
345
345
|
readonly id: string;
|
|
@@ -357,8 +357,8 @@ interface SubscribeInput {
|
|
|
357
357
|
ctx: Partial<RequestContext>;
|
|
358
358
|
/**
|
|
359
359
|
* Frame sink. Sync-returning callbacks are still valid; the engine awaits
|
|
360
|
-
* whatever `onFrame` returns so back-pressure-aware transports (e.g.
|
|
361
|
-
*
|
|
360
|
+
* whatever `onFrame` returns so back-pressure-aware transports (e.g. a frame
|
|
361
|
+
* stream's write drain) can resolve asynchronously. The fanout loop tracks
|
|
362
362
|
* pending (unsettled) calls per subscription and tears the entry down when
|
|
363
363
|
* the count exceeds `EngineOptions.subscriptions.queueLimit` (§5.13).
|
|
364
364
|
*/
|
|
@@ -1006,7 +1006,7 @@ interface ComposeOpts {
|
|
|
1006
1006
|
bridges?: BridgeRegistry;
|
|
1007
1007
|
/**
|
|
1008
1008
|
* JWT auth config (§5.12). When supplied, route handlers for
|
|
1009
|
-
* `/substrate/v1/query`, `/substrate/v1/mutate`, and
|
|
1009
|
+
* `/substrate/v1/query`, `/substrate/v1/mutate`, `/substrate/v1/subscribe` and `/substrate/v1/stream` require a
|
|
1010
1010
|
* valid `Authorization: Bearer <token>` header; missing / invalid tokens
|
|
1011
1011
|
* return 401 with `{ code: 'unauthorized' }`. When absent, every request
|
|
1012
1012
|
* passes through unauthenticated, attributed to `systemActor`.
|
|
@@ -1043,7 +1043,7 @@ interface ComposeOpts {
|
|
|
1043
1043
|
* §5.13 subscription back-pressure override. Threads straight into
|
|
1044
1044
|
* `EngineOptions.subscriptions`. Default (absent): engine default
|
|
1045
1045
|
* queueLimit of 256. Conformance tests set a tiny limit to trigger the
|
|
1046
|
-
* teardown contract deterministically (docs/
|
|
1046
|
+
* teardown contract deterministically (docs/stream-contract.md).
|
|
1047
1047
|
*/
|
|
1048
1048
|
subscriptions?: {
|
|
1049
1049
|
queueLimit?: number;
|
|
@@ -1086,15 +1086,11 @@ interface ComposeOpts {
|
|
|
1086
1086
|
*/
|
|
1087
1087
|
keyReprimeIntervalMs?: number;
|
|
1088
1088
|
/**
|
|
1089
|
-
*
|
|
1090
|
-
*
|
|
1091
|
-
*
|
|
1092
|
-
* authenticate on this signature alone, the dev default is a published
|
|
1093
|
-
* constant, and `''` / `' '` are HMAC keys Node accepts. Omit it only with
|
|
1094
|
-
* auth disabled, where `gate` is the identity function and there is nothing
|
|
1095
|
-
* to bypass. Trimmed before use.
|
|
1089
|
+
* Seals pagination cursors under a row-filter policy. Every process sharing
|
|
1090
|
+
* it opens the same cursors; without it the key is per process, so a sealed
|
|
1091
|
+
* cursor stops opening after a restart or on another replica. Trimmed.
|
|
1096
1092
|
*/
|
|
1097
|
-
|
|
1093
|
+
cursorSealSecret?: string;
|
|
1098
1094
|
/**
|
|
1099
1095
|
* Effective value + provenance for every defaulted knob, as the caller's
|
|
1100
1096
|
* env parser resolved them. When present, compose mounts
|
|
@@ -1868,36 +1864,8 @@ export declare class FakeEmbedder implements Embedder {
|
|
|
1868
1864
|
embed(text: string): Promise<Float32Array>;
|
|
1869
1865
|
}
|
|
1870
1866
|
//#endregion
|
|
1871
|
-
//#region ../../packages/substrate-server-memory/src/memory-ws-connection.d.ts
|
|
1872
|
-
/**
|
|
1873
|
-
* @internal — thrown when sending on a closed in-memory WS pair. Treat as
|
|
1874
|
-
* package-private.
|
|
1875
|
-
*/
|
|
1876
|
-
export declare class WsClosedError extends Error {
|
|
1877
|
-
constructor();
|
|
1878
|
-
}
|
|
1879
|
-
type Frame = Buffer | Uint8Array | string;
|
|
1880
|
-
interface MemoryWsClient {
|
|
1881
|
-
send(frame: Frame): void;
|
|
1882
|
-
onMessage(cb: (frame: Buffer) => void): void;
|
|
1883
|
-
onClose(cb: (code?: number) => void): void;
|
|
1884
|
-
close(code?: number, reason?: string): void;
|
|
1885
|
-
readonly closed: boolean;
|
|
1886
|
-
}
|
|
1887
|
-
/**
|
|
1888
|
-
* @internal — paired in-memory WS endpoints used by `MemorySubstrateServer`
|
|
1889
|
-
* for inject-style WS testing. Treat as package-private.
|
|
1890
|
-
*/
|
|
1891
|
-
export declare function createMemoryWsPair(): {
|
|
1892
|
-
server: WsConnection;
|
|
1893
|
-
client: MemoryWsClient;
|
|
1894
|
-
};
|
|
1895
|
-
//#endregion
|
|
1896
1867
|
//#region ../../packages/substrate-server-memory/src/memory-server.d.ts
|
|
1897
1868
|
type ErrorHook = (err: Error, req?: SubstrateRequest) => void;
|
|
1898
|
-
export declare class UnknownWsPathError extends Error {
|
|
1899
|
-
constructor(path: string);
|
|
1900
|
-
}
|
|
1901
1869
|
/**
|
|
1902
1870
|
* @internal — thrown when `MemorySubstrateServer.start()` is called twice.
|
|
1903
1871
|
* Re-exported from the package index; treat as package-private.
|
|
@@ -1908,7 +1876,6 @@ export declare class AlreadyStartedError extends Error {
|
|
|
1908
1876
|
export declare class MemorySubstrateServer implements SubstrateServer {
|
|
1909
1877
|
#private;
|
|
1910
1878
|
route(method: HttpMethod, path: string, handler: HttpHandler): void;
|
|
1911
|
-
websocket(path: string, handler: WsHandler): void;
|
|
1912
1879
|
onError(hook: ErrorHook): void;
|
|
1913
1880
|
observeRequests(observer: RequestObserver): void;
|
|
1914
1881
|
observeInFlight(fn: (op: RuntimeOp, delta: 1 | -1) => void): void;
|
|
@@ -1926,7 +1893,6 @@ export declare class MemorySubstrateServer implements SubstrateServer {
|
|
|
1926
1893
|
name: string;
|
|
1927
1894
|
}): PluginRouter;
|
|
1928
1895
|
inject(req: Partial<SubstrateRequest>): Promise<SubstrateResponse>;
|
|
1929
|
-
connectWebsocket(path: string, headers?: Record<string, string>): MemoryWsClient;
|
|
1930
1896
|
}
|
|
1931
1897
|
//#endregion
|
|
1932
1898
|
//#region ../../packages/substrate-server-memory/src/route-matcher.d.ts
|
|
@@ -1953,4 +1919,4 @@ export declare class MemorySubstrateServer implements SubstrateServer {
|
|
|
1953
1919
|
*/
|
|
1954
1920
|
export declare function matchRoute(registered: string, actual: string): Record<string, string> | null;
|
|
1955
1921
|
//#endregion
|
|
1956
|
-
export type { AuthConfig, ComposeResult, FieldDefLookup, IndexedListField,
|
|
1922
|
+
export type { AuthConfig, ComposeResult, FieldDefLookup, IndexedListField, PgDatasetOptions, PgEdgesStoreOptions };
|
package/dist/testing.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { createRequire as __binCreateRequire } from 'node:module'; const require = __binCreateRequire(import.meta.url);
|
|
2
|
-
import { Ht as signHs256, Q as loadPlugins, Wt as WS_REASON_SERVER_RESTART, Z as MemoryEdgesStore, c as MemoryDataset, s as compose } from "./src-
|
|
3
|
-
import "./src-
|
|
4
|
-
import { h as deriveListIndexMigration, n as PgDataset, v as runDerivedMigrations, y as runMigrations } from "./src-
|
|
5
|
-
import { t as PgEdgesStore } from "./pg-edges-store-
|
|
2
|
+
import { Ht as signHs256, Q as loadPlugins, Wt as WS_REASON_SERVER_RESTART, Z as MemoryEdgesStore, c as MemoryDataset, s as compose } from "./src-oO0DtS6y.js";
|
|
3
|
+
import "./src-B6nsPVmD.js";
|
|
4
|
+
import { h as deriveListIndexMigration, n as PgDataset, v as runDerivedMigrations, y as runMigrations } from "./src-BcigMQdR.js";
|
|
5
|
+
import { t as PgEdgesStore } from "./pg-edges-store-B0Krqoac.js";
|
|
6
6
|
import { t as FakeEmbedder } from "./fake-DUVtKVSE.js";
|
|
7
|
-
import { randomUUID } from "node:crypto";
|
|
8
7
|
import postgres from "postgres";
|
|
9
8
|
|
|
10
9
|
//#region ../../packages/substrate-dataset-pg/src/testing.ts
|
|
@@ -283,111 +282,6 @@ async function recreatePgTestSchema(url, schema) {
|
|
|
283
282
|
}
|
|
284
283
|
}
|
|
285
284
|
|
|
286
|
-
//#endregion
|
|
287
|
-
//#region ../../packages/substrate-server-memory/src/memory-ws-connection.ts
|
|
288
|
-
/**
|
|
289
|
-
* In-process WebSocket pair. One end is the server-side `WsConnection`
|
|
290
|
-
* handed to the user's `WsHandler`; the other is a `MemoryWsClient` returned
|
|
291
|
-
* to test code so it can drive the connection without opening a socket.
|
|
292
|
-
*
|
|
293
|
-
* Per §4.8 transport symmetry, upgrade metadata (path, headers, query, params)
|
|
294
|
-
* rides on `SubstrateRequest`, not on `WsConnection`. The pair only needs an
|
|
295
|
-
* `id` — the caller (`MemorySubstrateServer`) builds the `SubstrateRequest` separately.
|
|
296
|
-
*
|
|
297
|
-
* Frames are normalised to Buffer on delivery so handlers see the same shape
|
|
298
|
-
* they would over a real WS (the `WsConnection.onMessage` signature is
|
|
299
|
-
* `(frame: Buffer) => void`). `send()` accepts Buffer / Uint8Array / string on
|
|
300
|
-
* both sides and normalises before dispatch.
|
|
301
|
-
*
|
|
302
|
-
* Close semantics:
|
|
303
|
-
* - First close from either side transitions the pair to closed and fires
|
|
304
|
-
* both sides' onClose callbacks synchronously with the provided code.
|
|
305
|
-
* - Subsequent close() calls are no-ops (no duplicate events).
|
|
306
|
-
* - send() on a closed endpoint throws a named error — callers that race
|
|
307
|
-
* a close against a send should handle this, mirroring real WS behaviour
|
|
308
|
-
* where the underlying socket may have shut down mid-write.
|
|
309
|
-
*/
|
|
310
|
-
/**
|
|
311
|
-
* @internal — thrown when sending on a closed in-memory WS pair. Treat as
|
|
312
|
-
* package-private.
|
|
313
|
-
*/
|
|
314
|
-
var WsClosedError = class extends Error {
|
|
315
|
-
constructor() {
|
|
316
|
-
super("WebSocket is closed");
|
|
317
|
-
this.name = "WsClosedError";
|
|
318
|
-
}
|
|
319
|
-
};
|
|
320
|
-
function toBuffer(frame) {
|
|
321
|
-
if (typeof frame === "string") return Buffer.from(frame, "utf8");
|
|
322
|
-
if (Buffer.isBuffer(frame)) return frame;
|
|
323
|
-
return Buffer.from(frame);
|
|
324
|
-
}
|
|
325
|
-
/**
|
|
326
|
-
* @internal — paired in-memory WS endpoints used by `MemorySubstrateServer`
|
|
327
|
-
* for inject-style WS testing. Treat as package-private.
|
|
328
|
-
*/
|
|
329
|
-
function createMemoryWsPair() {
|
|
330
|
-
const serverSide = {
|
|
331
|
-
messageListeners: [],
|
|
332
|
-
closeListeners: []
|
|
333
|
-
};
|
|
334
|
-
const clientSide = {
|
|
335
|
-
messageListeners: [],
|
|
336
|
-
closeListeners: []
|
|
337
|
-
};
|
|
338
|
-
const state = { closed: false };
|
|
339
|
-
const closePair = (code) => {
|
|
340
|
-
if (state.closed) return;
|
|
341
|
-
state.closed = true;
|
|
342
|
-
const s = serverSide.closeListeners.slice();
|
|
343
|
-
const c = clientSide.closeListeners.slice();
|
|
344
|
-
for (const cb of s) try {
|
|
345
|
-
cb(code);
|
|
346
|
-
} catch {}
|
|
347
|
-
for (const cb of c) try {
|
|
348
|
-
cb(code);
|
|
349
|
-
} catch {}
|
|
350
|
-
};
|
|
351
|
-
return {
|
|
352
|
-
server: {
|
|
353
|
-
id: randomUUID(),
|
|
354
|
-
send(frame) {
|
|
355
|
-
if (state.closed) throw new WsClosedError();
|
|
356
|
-
const buf = toBuffer(frame);
|
|
357
|
-
for (const cb of clientSide.messageListeners.slice()) cb(buf);
|
|
358
|
-
},
|
|
359
|
-
onMessage(cb) {
|
|
360
|
-
serverSide.messageListeners.push(cb);
|
|
361
|
-
},
|
|
362
|
-
onClose(cb) {
|
|
363
|
-
serverSide.closeListeners.push(cb);
|
|
364
|
-
},
|
|
365
|
-
close(code, _reason) {
|
|
366
|
-
closePair(code);
|
|
367
|
-
}
|
|
368
|
-
},
|
|
369
|
-
client: {
|
|
370
|
-
send(frame) {
|
|
371
|
-
if (state.closed) throw new WsClosedError();
|
|
372
|
-
const buf = toBuffer(frame);
|
|
373
|
-
for (const cb of serverSide.messageListeners.slice()) cb(buf);
|
|
374
|
-
},
|
|
375
|
-
onMessage(cb) {
|
|
376
|
-
clientSide.messageListeners.push(cb);
|
|
377
|
-
},
|
|
378
|
-
onClose(cb) {
|
|
379
|
-
clientSide.closeListeners.push(cb);
|
|
380
|
-
},
|
|
381
|
-
close(code, _reason) {
|
|
382
|
-
closePair(code);
|
|
383
|
-
},
|
|
384
|
-
get closed() {
|
|
385
|
-
return state.closed;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
};
|
|
389
|
-
}
|
|
390
|
-
|
|
391
285
|
//#endregion
|
|
392
286
|
//#region ../../packages/substrate-server-memory/src/route-matcher.ts
|
|
393
287
|
/**
|
|
@@ -452,12 +346,6 @@ function paramName(seg) {
|
|
|
452
346
|
|
|
453
347
|
//#endregion
|
|
454
348
|
//#region ../../packages/substrate-server-memory/src/memory-server.ts
|
|
455
|
-
var UnknownWsPathError = class extends Error {
|
|
456
|
-
constructor(path) {
|
|
457
|
-
super(`No websocket route registered for path: ${path}`);
|
|
458
|
-
this.name = "UnknownWsPathError";
|
|
459
|
-
}
|
|
460
|
-
};
|
|
461
349
|
/**
|
|
462
350
|
* @internal — thrown when `MemorySubstrateServer.start()` is called twice.
|
|
463
351
|
* Re-exported from the package index; treat as package-private.
|
|
@@ -502,7 +390,6 @@ function parseQuery(path) {
|
|
|
502
390
|
}
|
|
503
391
|
var MemorySubstrateServer = class {
|
|
504
392
|
#routes = [];
|
|
505
|
-
#wsRoutes = [];
|
|
506
393
|
#inFlight = /* @__PURE__ */ new Set();
|
|
507
394
|
#shutdownHooks = /* @__PURE__ */ new Set();
|
|
508
395
|
#errorHook;
|
|
@@ -517,12 +404,6 @@ var MemorySubstrateServer = class {
|
|
|
517
404
|
handler
|
|
518
405
|
});
|
|
519
406
|
}
|
|
520
|
-
websocket(path, handler) {
|
|
521
|
-
this.#wsRoutes.push({
|
|
522
|
-
pattern: path,
|
|
523
|
-
handler
|
|
524
|
-
});
|
|
525
|
-
}
|
|
526
407
|
onError(hook) {
|
|
527
408
|
this.#errorHook = hook;
|
|
528
409
|
}
|
|
@@ -585,8 +466,7 @@ var MemorySubstrateServer = class {
|
|
|
585
466
|
post: (path, handler) => this.route("POST", prefixed(path), handler),
|
|
586
467
|
put: (path, handler) => this.route("PUT", prefixed(path), handler),
|
|
587
468
|
delete: (path, handler) => this.route("DELETE", prefixed(path), handler),
|
|
588
|
-
patch: (path, handler) => this.route("PATCH", prefixed(path), handler)
|
|
589
|
-
websocket: (path, handler) => this.websocket(prefixed(path), handler)
|
|
469
|
+
patch: (path, handler) => this.route("PATCH", prefixed(path), handler)
|
|
590
470
|
};
|
|
591
471
|
}
|
|
592
472
|
async inject(req) {
|
|
@@ -674,48 +554,7 @@ var MemorySubstrateServer = class {
|
|
|
674
554
|
if (ownedController !== null) this.#inFlight.delete(ownedController);
|
|
675
555
|
}
|
|
676
556
|
}
|
|
677
|
-
#reportWsError(err) {
|
|
678
|
-
const error = err instanceof Error ? err : new Error(String(err));
|
|
679
|
-
if (!this.#errorHook) return;
|
|
680
|
-
try {
|
|
681
|
-
this.#errorHook(error);
|
|
682
|
-
} catch {}
|
|
683
|
-
}
|
|
684
|
-
connectWebsocket(path, headers = {}) {
|
|
685
|
-
const parsed = parseQuery(path);
|
|
686
|
-
let matched;
|
|
687
|
-
let params = {};
|
|
688
|
-
for (const entry of this.#wsRoutes) {
|
|
689
|
-
const m = matchRoute(entry.pattern, parsed.pathname);
|
|
690
|
-
if (m !== null) {
|
|
691
|
-
matched = entry;
|
|
692
|
-
params = m;
|
|
693
|
-
break;
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
if (!matched) throw new UnknownWsPathError(parsed.pathname);
|
|
697
|
-
const substrateReq = {
|
|
698
|
-
method: "GET",
|
|
699
|
-
path: parsed.pathname,
|
|
700
|
-
headers,
|
|
701
|
-
query: parsed.query,
|
|
702
|
-
params,
|
|
703
|
-
body: null
|
|
704
|
-
};
|
|
705
|
-
const { server, client } = createMemoryWsPair();
|
|
706
|
-
queueMicrotask(() => {
|
|
707
|
-
try {
|
|
708
|
-
const result = matched.handler(substrateReq, server);
|
|
709
|
-
if (result && typeof result.then === "function") result.catch((err) => {
|
|
710
|
-
this.#reportWsError(err);
|
|
711
|
-
});
|
|
712
|
-
} catch (err) {
|
|
713
|
-
this.#reportWsError(err);
|
|
714
|
-
}
|
|
715
|
-
});
|
|
716
|
-
return client;
|
|
717
|
-
}
|
|
718
557
|
};
|
|
719
558
|
|
|
720
559
|
//#endregion
|
|
721
|
-
export { AlreadyStartedError, FakeEmbedder, MemoryDataset, MemoryEdgesStore, MemorySubstrateServer, PgDataset, PgEdgesStore,
|
|
560
|
+
export { AlreadyStartedError, FakeEmbedder, MemoryDataset, MemoryEdgesStore, MemorySubstrateServer, PgDataset, PgEdgesStore, announcePgGating, assertCannotWriteOutsideTestDatabases, assertNotSuperuser, assertTestDatabase, compose, deriveListIndexMigration, interpretSuperuserProbe, loadPlugins, matchRoute, pgTestSchemaName, pgTestSchemaUrl, preparePgTestSchema, publicLeftoverWarning, reachFailureMessage, recreatePgTestSchema, runDerivedMigrations, runMigrations, signHs256 };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as BridgeClient } from "./bridge-
|
|
1
|
+
import { At as DatasetRegistry, En as EdgeRef, On as EdgesStore, Pn as Id, f as PackEnvelope, l as FieldInput } from "./schema-laGLMvMC.js";
|
|
2
|
+
import { t as BridgeClient } from "./bridge-BhiJKwfF.js";
|
|
3
3
|
//#region ../../packages/substrate-types/src/idempotency.d.ts
|
|
4
4
|
interface IdempotencyStore {
|
|
5
5
|
/**
|
|
@@ -120,12 +120,12 @@ interface WsResponseFrame {
|
|
|
120
120
|
* Known values: `WS_REASON_SUBSCRIPTION_OVERLOADED` (queue-limit teardown),
|
|
121
121
|
* `WS_REASON_SERVER_RESTART` (graceful shutdown). Absent on a cancel ack.
|
|
122
122
|
* Stays `string` on the wire for forward compatibility — clients must
|
|
123
|
-
* tolerate unknown tokens. Contract: docs/
|
|
123
|
+
* tolerate unknown tokens. Contract: docs/stream-contract.md.
|
|
124
124
|
*/
|
|
125
125
|
reason?: string;
|
|
126
126
|
}
|
|
127
127
|
/**
|
|
128
|
-
* Terminal-cause vocabulary (docs/
|
|
128
|
+
* Terminal-cause vocabulary (docs/stream-contract.md). The overload
|
|
129
129
|
* token is BOTH the `code` of the terminal `error` frame and the `reason` of
|
|
130
130
|
* the following `end` frame — one token per condition, no second spelling.
|
|
131
131
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mnmal-ai/substrate",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.19",
|
|
4
4
|
"description": "Substrate — an agent-first typed-data server: the substrate and substrate-admin binaries, the built-in plugins and the SDK subpaths.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@fastify/compress": "^9.2.0",
|
|
25
25
|
"@fastify/cors": "^11.3.0",
|
|
26
|
-
"@fastify/websocket": "^11.3.1",
|
|
27
26
|
"@mnmal-ai/holomap-clusterer": "0.2.1",
|
|
28
27
|
"@modelcontextprotocol/sdk": "^1.32.0",
|
|
29
28
|
"@preact/signals-core": "^1.14.4",
|
|
@@ -31,33 +30,31 @@
|
|
|
31
30
|
"msgpackr": "^2.1.0",
|
|
32
31
|
"postgres": "4.1.0",
|
|
33
32
|
"semver": "^7.8.5",
|
|
34
|
-
"ws": "^8.22.0",
|
|
35
33
|
"zod": "^4.6.7"
|
|
36
34
|
},
|
|
37
35
|
"devDependencies": {
|
|
38
36
|
"@inquirer/prompts": "^8.7.2",
|
|
39
|
-
"@mnmal-ai/substrate-bootstrap": "1.0.0-alpha.
|
|
40
|
-
"@mnmal-ai/substrate-client": "1.0.0-alpha.
|
|
41
|
-
"@mnmal-ai/substrate-compose": "1.0.0-alpha.
|
|
42
|
-
"@mnmal-ai/substrate-config": "1.0.0-alpha.
|
|
43
|
-
"@mnmal-ai/substrate-core": "1.0.0-alpha.
|
|
44
|
-
"@mnmal-ai/substrate-dataset-memory": "1.0.0-alpha.
|
|
45
|
-
"@mnmal-ai/substrate-dataset-pg": "1.0.0-alpha.
|
|
46
|
-
"@mnmal-ai/substrate-embedder": "1.0.0-alpha.
|
|
47
|
-
"@mnmal-ai/substrate-filter": "1.0.0-alpha.
|
|
48
|
-
"@mnmal-ai/substrate-pack": "1.0.0-alpha.
|
|
49
|
-
"@mnmal-ai/substrate-policy": "1.0.0-alpha.
|
|
50
|
-
"@mnmal-ai/substrate-proposals": "1.0.0-alpha.
|
|
51
|
-
"@mnmal-ai/substrate-recall": "1.0.0-alpha.
|
|
52
|
-
"@mnmal-ai/substrate-sdk": "1.0.0-alpha.
|
|
53
|
-
"@mnmal-ai/substrate-sentinel-client": "1.0.0-alpha.
|
|
54
|
-
"@mnmal-ai/substrate-server-fastify": "1.0.0-alpha.
|
|
55
|
-
"@mnmal-ai/substrate-server-memory": "1.0.0-alpha.
|
|
56
|
-
"@mnmal-ai/substrate-types": "1.0.0-alpha.
|
|
37
|
+
"@mnmal-ai/substrate-bootstrap": "1.0.0-alpha.19",
|
|
38
|
+
"@mnmal-ai/substrate-client": "1.0.0-alpha.19",
|
|
39
|
+
"@mnmal-ai/substrate-compose": "1.0.0-alpha.19",
|
|
40
|
+
"@mnmal-ai/substrate-config": "1.0.0-alpha.19",
|
|
41
|
+
"@mnmal-ai/substrate-core": "1.0.0-alpha.19",
|
|
42
|
+
"@mnmal-ai/substrate-dataset-memory": "1.0.0-alpha.19",
|
|
43
|
+
"@mnmal-ai/substrate-dataset-pg": "1.0.0-alpha.19",
|
|
44
|
+
"@mnmal-ai/substrate-embedder": "1.0.0-alpha.19",
|
|
45
|
+
"@mnmal-ai/substrate-filter": "1.0.0-alpha.19",
|
|
46
|
+
"@mnmal-ai/substrate-pack": "1.0.0-alpha.19",
|
|
47
|
+
"@mnmal-ai/substrate-policy": "1.0.0-alpha.19",
|
|
48
|
+
"@mnmal-ai/substrate-proposals": "1.0.0-alpha.19",
|
|
49
|
+
"@mnmal-ai/substrate-recall": "1.0.0-alpha.19",
|
|
50
|
+
"@mnmal-ai/substrate-sdk": "1.0.0-alpha.19",
|
|
51
|
+
"@mnmal-ai/substrate-sentinel-client": "1.0.0-alpha.19",
|
|
52
|
+
"@mnmal-ai/substrate-server-fastify": "1.0.0-alpha.19",
|
|
53
|
+
"@mnmal-ai/substrate-server-memory": "1.0.0-alpha.19",
|
|
54
|
+
"@mnmal-ai/substrate-types": "1.0.0-alpha.19",
|
|
57
55
|
"@mnmal-ai/surface-core": "0.17.1",
|
|
58
56
|
"@types/node": "^26.6.4",
|
|
59
57
|
"@types/semver": "^7.5.0",
|
|
60
|
-
"@types/ws": "^8.18.1",
|
|
61
58
|
"msw": "^3.0.1",
|
|
62
59
|
"tsdown": "^0.23.0",
|
|
63
60
|
"tsx": "^4.23.15",
|
|
@@ -74,6 +71,7 @@
|
|
|
74
71
|
},
|
|
75
72
|
"./client": {
|
|
76
73
|
"types": "./dist/client.d.ts",
|
|
74
|
+
"browser": "./dist/client.browser.js",
|
|
77
75
|
"import": "./dist/client.js"
|
|
78
76
|
},
|
|
79
77
|
"./pack": {
|
|
@@ -112,7 +110,7 @@
|
|
|
112
110
|
]
|
|
113
111
|
},
|
|
114
112
|
"scripts": {
|
|
115
|
-
"build": "tsdown && node scripts/copy-plugin-configs.mjs",
|
|
113
|
+
"build": "tsdown && node scripts/copy-plugin-configs.mjs && node scripts/check-browser-bundle.mjs",
|
|
116
114
|
"dev": "tsx src/bin/substrate.ts serve",
|
|
117
115
|
"test": "vitest run",
|
|
118
116
|
"check-types": "tsc -p tsconfig.json --noEmit",
|