@mnmal-ai/substrate 1.0.0-alpha.1 → 1.0.0-alpha.10

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 (47) hide show
  1. package/README.md +48 -6
  2. package/dist/boot-store-BVqfFxh1.js +4060 -0
  3. package/dist/{runtime-metrics-DwpDJ8vz.d.ts → bridge-Cp4PaIYO.d.ts} +2 -87
  4. package/dist/cli-hSCBywhE.js +3126 -0
  5. package/dist/client.d.ts +130 -8
  6. package/dist/client.js +6 -5
  7. package/dist/{plugin-t2g2wX0b.d.ts → dataset-CejF-Fr_.d.ts} +1640 -1320
  8. package/dist/{agent-token-BIboWOU0.js → env-utils-CGNazUNt.js} +31 -2
  9. package/dist/{errors-D4vKuwz8.d.ts → errors-7mycvNGq.d.ts} +1 -1
  10. package/dist/{index-D7mSOFlM.d.ts → index-DgSfwx7M.d.ts} +1 -1
  11. package/dist/node-version-C5FSmwJX.js +26 -0
  12. package/dist/pack.d.ts +2 -2
  13. package/dist/pack.js +1 -1
  14. package/dist/pg-edges-store-Lxsl5ZnK.js +381 -0
  15. package/dist/{plugin-BuQQEzL-.js → plugin-CtwOINCM.js} +171 -18
  16. package/dist/proposals-bootstrap.js +6 -4
  17. package/dist/proposals.config.schema.json +5 -0
  18. package/dist/proposals.d.ts +15 -4
  19. package/dist/proposals.default-config.json +2 -1
  20. package/dist/proposals.js +2 -2
  21. package/dist/recall-bootstrap.js +13 -4
  22. package/dist/recall.config.schema.json +12 -0
  23. package/dist/recall.d.ts +54 -9
  24. package/dist/recall.js +2 -2
  25. package/dist/{repl-C52wyfMs.js → repl-DqfHelK7.js} +62 -29
  26. package/dist/{row-ByLFE2Wx.d.ts → row-BKKCXIG6.d.ts} +5 -3
  27. package/dist/run-B5dTbZ3g.js +1997 -0
  28. package/dist/{schema-g4FQLr0V.d.ts → schema-DoSc-4ig.d.ts} +44 -7
  29. package/dist/script-C6DSa_Na.js +134 -0
  30. package/dist/sdk.d.ts +90 -12
  31. package/dist/sdk.js +5 -110
  32. package/dist/{src-YXlv_RyL.js → src-5SJ5GEIM.js} +1555 -326
  33. package/dist/{src-DuopV8u7.js → src-7CUSMK66.js} +148 -19
  34. package/dist/{src-zcyUofMJ.js → src-Bi849yhn.js} +39 -15
  35. package/dist/{src-5hVbeiAu.js → src-CqT-QWZ_.js} +697 -57
  36. package/dist/src-CyvV7dCK.js +4333 -0
  37. package/dist/{row-DK7lPZVe.js → src-Da0t6si5.js} +11 -11
  38. package/dist/{src-C4DzaIQZ.js → src-hZb8wfvg.js} +12 -1
  39. package/dist/substrate-admin.js +17 -781
  40. package/dist/substrate.js +4 -5476
  41. package/dist/testing.d.ts +557 -8
  42. package/dist/testing.js +39 -3
  43. package/dist/{ws-C72iVS5T.d.ts → ws-ByZyHk7m.d.ts} +3 -3
  44. package/package.json +21 -20
  45. package/dist/dataset-DOXGRz50.js +0 -1535
  46. package/dist/env-utils-B7SGmoeJ.js +0 -21
  47. package/dist/src-CjEwiKXw.js +0 -2327
package/dist/testing.js CHANGED
@@ -1,5 +1,8 @@
1
1
  import { createRequire as __binCreateRequire } from 'node:module'; const require = __binCreateRequire(import.meta.url);
2
- import { N as MemoryEdgesStore, P as loadPlugins, at as WS_REASON_SERVER_RESTART, c as MemoryDataset, rt as signHs256, s as compose } from "./src-YXlv_RyL.js";
2
+ import { G as loadPlugins, W as MemoryEdgesStore, _t as signHs256, c as MemoryDataset, s as compose, yt as WS_REASON_SERVER_RESTART } from "./src-5SJ5GEIM.js";
3
+ import "./src-hZb8wfvg.js";
4
+ import { l as deriveListIndexMigration, m as runMigrations, p as runDerivedMigrations, t as PgDataset } from "./src-CyvV7dCK.js";
5
+ import { t as PgEdgesStore } from "./pg-edges-store-Lxsl5ZnK.js";
3
6
  import { t as FakeEmbedder } from "./fake-DUVtKVSE.js";
4
7
  import { randomUUID } from "node:crypto";
5
8
  import postgres from "postgres";
@@ -183,7 +186,7 @@ const TEST_SCHEMA_PREFIX = "substrate_test_";
183
186
  * migrations stay incremental.
184
187
  */
185
188
  function pgTestSchemaName(packageName) {
186
- const slug = packageName.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
189
+ const slug = packageName.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_|_$/g, "");
187
190
  return `${TEST_SCHEMA_PREFIX}${slug}`.slice(0, 63);
188
191
  }
189
192
  /**
@@ -263,6 +266,39 @@ async function preparePgTestSchema(url, opts) {
263
266
  if (warning !== void 0) (opts.warn ?? ((m) => void process.stderr.write(`${m}\n`)))(warning);
264
267
  return pgTestSchemaUrl(url, opts.packageName);
265
268
  }
269
+ /**
270
+ * The storage layout this run's pg suites build, from `SUBSTRATE_TEST_LAYOUT`
271
+ * (default `legacy`). Copies it into `SUBSTRATE_STORAGE_LAYOUT`, which
272
+ * `runMigrations` reads on a fresh database, and returns the package name to
273
+ * isolate under, so each layout gets a schema of its own.
274
+ *
275
+ * Call from `globalSetup`, before `preparePgTestSchema`.
276
+ */
277
+ function selectPgTestLayout(packageName) {
278
+ const layout = process.env.SUBSTRATE_TEST_LAYOUT ?? "legacy";
279
+ if (layout !== "legacy" && layout !== "partitioned") throw new Error(`SUBSTRATE_TEST_LAYOUT must be 'legacy' or 'partitioned', got '${layout}'`);
280
+ process.env.SUBSTRATE_STORAGE_LAYOUT = layout;
281
+ return {
282
+ layout,
283
+ packageName: `${packageName}-${layout}`
284
+ };
285
+ }
286
+ /**
287
+ * A `createSchema` for `preparePgTestSchema` that drops and recreates the
288
+ * schema, so every run builds its layout from an empty database.
289
+ */
290
+ async function recreatePgTestSchema(url, schema) {
291
+ const sql = postgres(url, {
292
+ max: 1,
293
+ onnotice: () => {}
294
+ });
295
+ try {
296
+ await sql.unsafe(`DROP SCHEMA IF EXISTS "${schema}" CASCADE`);
297
+ await sql.unsafe(`CREATE SCHEMA "${schema}"`);
298
+ } finally {
299
+ await sql.end({ timeout: 5 });
300
+ }
301
+ }
266
302
 
267
303
  //#endregion
268
304
  //#region ../../packages/substrate-server-memory/src/memory-ws-connection.ts
@@ -699,4 +735,4 @@ var MemorySubstrateServer = class {
699
735
  };
700
736
 
701
737
  //#endregion
702
- export { AlreadyStartedError, FakeEmbedder, MemoryDataset, MemoryEdgesStore, MemorySubstrateServer, UnknownWsPathError, WsClosedError, announcePgGating, assertCannotWriteOutsideTestDatabases, assertNotSuperuser, assertTestDatabase, compose, createMemoryWsPair, interpretSuperuserProbe, loadPlugins, matchRoute, pgTestSchemaName, pgTestSchemaUrl, preparePgTestSchema, publicLeftoverWarning, reachFailureMessage, signHs256 };
738
+ export { AlreadyStartedError, FakeEmbedder, MemoryDataset, MemoryEdgesStore, MemorySubstrateServer, PgDataset, PgEdgesStore, UnknownWsPathError, WsClosedError, announcePgGating, assertCannotWriteOutsideTestDatabases, assertNotSuperuser, assertTestDatabase, compose, createMemoryWsPair, deriveListIndexMigration, interpretSuperuserProbe, loadPlugins, matchRoute, pgTestSchemaName, pgTestSchemaUrl, preparePgTestSchema, publicLeftoverWarning, reachFailureMessage, recreatePgTestSchema, runDerivedMigrations, runMigrations, selectPgTestLayout, signHs256 };
@@ -1,6 +1,6 @@
1
- import { C as Id, _ as EdgesStore, h as EdgeRef, l as PackEnvelope, s as FieldInput } from "./schema-g4FQLr0V.js";
2
- import { c as BridgeClient } from "./runtime-metrics-DwpDJ8vz.js";
3
- import { lt as DatasetRegistry } from "./plugin-t2g2wX0b.js";
1
+ import { E as Id, b as EdgesStore, c as FieldInput, d as PackEnvelope, v as EdgeRef } from "./schema-DoSc-4ig.js";
2
+ import { t as BridgeClient } from "./bridge-Cp4PaIYO.js";
3
+ import { r as DatasetRegistry } from "./dataset-CejF-Fr_.js";
4
4
  //#region ../../packages/substrate-types/src/idempotency.d.ts
5
5
  interface IdempotencyStore {
6
6
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mnmal-ai/substrate",
3
- "version": "1.0.0-alpha.1",
3
+ "version": "1.0.0-alpha.10",
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": {
@@ -36,24 +36,24 @@
36
36
  },
37
37
  "devDependencies": {
38
38
  "@inquirer/prompts": "^8.7.2",
39
- "@mnmal-ai/substrate-bootstrap": "1.0.0-alpha.1",
40
- "@mnmal-ai/substrate-client": "1.0.0-alpha.1",
41
- "@mnmal-ai/substrate-compose": "1.0.0-alpha.1",
42
- "@mnmal-ai/substrate-config": "1.0.0-alpha.1",
43
- "@mnmal-ai/substrate-core": "1.0.0-alpha.1",
44
- "@mnmal-ai/substrate-dataset-memory": "1.0.0-alpha.1",
45
- "@mnmal-ai/substrate-dataset-pg": "1.0.0-alpha.1",
46
- "@mnmal-ai/substrate-embedder": "1.0.0-alpha.1",
47
- "@mnmal-ai/substrate-filter": "1.0.0-alpha.1",
48
- "@mnmal-ai/substrate-pack": "1.0.0-alpha.1",
49
- "@mnmal-ai/substrate-policy": "1.0.0-alpha.1",
50
- "@mnmal-ai/substrate-proposals": "1.0.0-alpha.1",
51
- "@mnmal-ai/substrate-recall": "1.0.0-alpha.1",
52
- "@mnmal-ai/substrate-sdk": "1.0.0-alpha.1",
53
- "@mnmal-ai/substrate-sentinel-client": "1.0.0-alpha.1",
54
- "@mnmal-ai/substrate-server-fastify": "1.0.0-alpha.1",
55
- "@mnmal-ai/substrate-server-memory": "1.0.0-alpha.1",
56
- "@mnmal-ai/substrate-types": "1.0.0-alpha.1",
39
+ "@mnmal-ai/substrate-bootstrap": "1.0.0-alpha.10",
40
+ "@mnmal-ai/substrate-client": "1.0.0-alpha.10",
41
+ "@mnmal-ai/substrate-compose": "1.0.0-alpha.10",
42
+ "@mnmal-ai/substrate-config": "1.0.0-alpha.10",
43
+ "@mnmal-ai/substrate-core": "1.0.0-alpha.10",
44
+ "@mnmal-ai/substrate-dataset-memory": "1.0.0-alpha.10",
45
+ "@mnmal-ai/substrate-dataset-pg": "1.0.0-alpha.10",
46
+ "@mnmal-ai/substrate-embedder": "1.0.0-alpha.10",
47
+ "@mnmal-ai/substrate-filter": "1.0.0-alpha.10",
48
+ "@mnmal-ai/substrate-pack": "1.0.0-alpha.10",
49
+ "@mnmal-ai/substrate-policy": "1.0.0-alpha.10",
50
+ "@mnmal-ai/substrate-proposals": "1.0.0-alpha.10",
51
+ "@mnmal-ai/substrate-recall": "1.0.0-alpha.10",
52
+ "@mnmal-ai/substrate-sdk": "1.0.0-alpha.10",
53
+ "@mnmal-ai/substrate-sentinel-client": "1.0.0-alpha.10",
54
+ "@mnmal-ai/substrate-server-fastify": "1.0.0-alpha.10",
55
+ "@mnmal-ai/substrate-server-memory": "1.0.0-alpha.10",
56
+ "@mnmal-ai/substrate-types": "1.0.0-alpha.10",
57
57
  "@types/node": "^26.6.4",
58
58
  "@types/semver": "^7.5.0",
59
59
  "@types/ws": "^8.18.1",
@@ -64,7 +64,7 @@
64
64
  "vitest": "^5.0.3"
65
65
  },
66
66
  "engines": {
67
- "node": ">=26.2.0"
67
+ "node": ">=26.12.1"
68
68
  },
69
69
  "exports": {
70
70
  "./sdk": {
@@ -114,6 +114,7 @@
114
114
  "build": "tsdown && node scripts/copy-plugin-configs.mjs",
115
115
  "dev": "tsx src/bin/substrate.ts serve",
116
116
  "test": "vitest run",
117
+ "test:partitioned": "SUBSTRATE_TEST_LAYOUT=partitioned vitest run",
117
118
  "check-types": "tsc -p tsconfig.json --noEmit",
118
119
  "lint": "biome check ."
119
120
  }