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

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/dist/client.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __binCreateRequire } from 'node:module'; const require = __binCreateRequire(import.meta.url);
2
- import { a as makeAuthorizationProvider, c as resolveDefaultKeyPath, i as isEncryptedKey, l as resolveDefaultKidPath, n as DEFAULT_CAPABILITIES, o as makeTokenProvider, r as adminClaimCapabilities, s as resolveAdminCredential, t as ADMIN_CAPABILITIES } from "./agent-token-BIboWOU0.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 "./row-DK7lPZVe.js";
4
- import { g as SchemaDriftError } from "./src-C4DzaIQZ.js";
5
- import { S as reconcileIdentities, _ as currentStep, a as createDefaultDiagnosticsSink, b as DIAGNOSE_CHECKS, c as AuthError, d as AdminBackfillError, f as BACKFILL_CHUNK, g as STEP_MARKS, h as SKIPPABLE_STEPS, i as collectDiagnostics, l as NetworkError, m as ONBOARD_STEPS, n as tokenAudience, o as reduceSubscribeRows, p as CURRENT_MARK, r as SubstrateClient, s as watchRows, t as noRedirectFetch, u as SubscribeError, v as planOnboarding, x as diagnose, y as requiredOutstanding } from "./src-DuopV8u7.js";
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 "./row-DZ0Fnpc6.js";
4
+ import { g as SchemaDriftError } from "./src-BLgbLq2k.js";
5
+ import { S as reconcileIdentities, _ as currentStep, a as createDefaultDiagnosticsSink, b as DIAGNOSE_CHECKS, c as AuthError, d as AdminBackfillError, f as BACKFILL_CHUNK, g as STEP_MARKS, h as SKIPPABLE_STEPS, i as collectDiagnostics, l as NetworkError, m as ONBOARD_STEPS, n as tokenAudience, o as reduceSubscribeRows, p as CURRENT_MARK, r as SubstrateClient, s as watchRows, t as noRedirectFetch, u as SubscribeError, v as planOnboarding, x as diagnose, y as requiredOutstanding } from "./src-DMzc3HfW.js";
6
6
 
7
7
  export { ADMIN_CAPABILITIES, AdminBackfillError, AuthError, BACKFILL_CHUNK, CURRENT_MARK, DEFAULT_CAPABILITIES, DIAGNOSE_CHECKS, NetworkError, ONBOARD_STEPS, SKIPPABLE_STEPS, STEP_MARKS, SYSTEM_NAMESPACE, SchemaDriftError, SubscribeError, SubstrateClient, adminClaimCapabilities, allowAll, allowVerbs, and, applyRowFilters, capabilitiesFor, checkRevocable, checkUpdatable, collectDiagnostics, 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, resolveDefaultKeyPath, resolveDefaultKidPath, revokedAtIso, row, tokenAudience, watchRows };
@@ -1,9 +1,9 @@
1
1
  import { createRequire as __binCreateRequire } from 'node:module'; const require = __binCreateRequire(import.meta.url);
2
- import { d as buildAuditRow, f as AUDIT_EVENT_TYPE } from "./src-YXlv_RyL.js";
3
- import { a as makeAuthorizationProvider, c as resolveDefaultKeyPath, l as resolveDefaultKidPath, r as adminClaimCapabilities, s as resolveAdminCredential, t as ADMIN_CAPABILITIES } from "./agent-token-BIboWOU0.js";
4
- import { D as isActiveAdminKeyRow, E as describeGrant, L as encodeList, M as grantEntryError, T as SYSTEM_NAMESPACE, v as grantEntriesConfer } from "./row-DK7lPZVe.js";
5
- import { _ as currentStep, b as DIAGNOSE_CHECKS, g as STEP_MARKS, h as SKIPPABLE_STEPS, n as tokenAudience, p as CURRENT_MARK, v as planOnboarding, x as diagnose, y as requiredOutstanding } from "./src-DuopV8u7.js";
6
- import { i as pendingMigrations, o as runMigrations, t as PgDataset } from "./src-CjEwiKXw.js";
2
+ import { d as buildAuditRow, f as AUDIT_EVENT_TYPE } from "./src-CHp3QyqB.js";
3
+ import { a as adminClaimCapabilities, d as resolveDefaultKidPath, l as resolveAdminCredential, n as trimTrailingSlashes, r as ADMIN_CAPABILITIES, s as makeAuthorizationProvider, 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 "./row-DZ0Fnpc6.js";
5
+ import { _ as currentStep, b as DIAGNOSE_CHECKS, g as STEP_MARKS, h as SKIPPABLE_STEPS, n as tokenAudience, p as CURRENT_MARK, v as planOnboarding, x as diagnose, y as requiredOutstanding } from "./src-DMzc3HfW.js";
6
+ import { i as pendingMigrations, o as runMigrations, t as PgDataset } from "./src-CXKnqeTW.js";
7
7
  import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
8
8
  import { homedir } from "node:os";
9
9
  import { dirname, join } from "node:path";
@@ -11,7 +11,7 @@ import { createHash, createPublicKey, generateKeyPairSync, randomUUID } from "no
11
11
  import postgres from "postgres";
12
12
 
13
13
  //#region package.json
14
- var version = "1.0.0-alpha.1";
14
+ var version = "1.0.0-alpha.2";
15
15
 
16
16
  //#endregion
17
17
  //#region src/admin/errors.ts
@@ -535,7 +535,7 @@ function readEd25519PublicKey(path) {
535
535
  async function runKeyPatchViaRoute(body, baseUrl, env, exitCodes, fetchImpl = fetch) {
536
536
  const auth = resolveAdminAuth(env, baseUrl);
537
537
  if ("error" in auth) throw new AdminCliError(`${body.revoke === true ? "revoke" : "update"}: ${auth.error}`, 1);
538
- const url = `${baseUrl.replace(/\/+$/, "")}/substrate/v1/_system/keys`;
538
+ const url = `${trimTrailingSlashes(baseUrl)}/substrate/v1/_system/keys`;
539
539
  let res;
540
540
  try {
541
541
  res = await fetchImpl(url, {
@@ -598,7 +598,7 @@ const UPDATE_EXIT_CODES = {
598
598
  async function runKeyListViaRoute(baseUrl, env, fetchImpl = fetch) {
599
599
  const auth = resolveAdminAuth(env, baseUrl);
600
600
  if ("error" in auth) throw new AdminCliError(`list: ${auth.error}`, 1);
601
- const base = `${baseUrl.replace(/\/+$/, "")}/substrate/v1/_system/keys`;
601
+ const base = `${trimTrailingSlashes(baseUrl)}/substrate/v1/_system/keys`;
602
602
  const keys = [];
603
603
  let cursor;
604
604
  for (let page = 0; page < 50; page += 1) {
@@ -1185,7 +1185,7 @@ async function runRegisterViaRoute(args, baseUrl, env, fetchImpl = fetch) {
1185
1185
  ...Object.keys(directoryParams).length > 0 ? { params: directoryParams } : {}
1186
1186
  }
1187
1187
  };
1188
- const url = `${baseUrl.replace(/\/+$/, "")}/substrate/v1/_system/keys`;
1188
+ const url = `${trimTrailingSlashes(baseUrl)}/substrate/v1/_system/keys`;
1189
1189
  let res;
1190
1190
  try {
1191
1191
  res = await fetchImpl(url, {
@@ -111,7 +111,7 @@ function adminClaimCapabilities(env) {
111
111
  return custom === void 0 || custom.length === 0 || ADMIN_CAPABILITIES.includes(custom) ? ADMIN_CAPABILITIES : [...ADMIN_CAPABILITIES, custom];
112
112
  }
113
113
  function b64url(buf) {
114
- return buf.toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
114
+ return buf.toString("base64url");
115
115
  }
116
116
  function sign$1(kid, key, ns, capabilities, aud) {
117
117
  const now = Math.floor(Date.now() / 1e3);
@@ -197,4 +197,33 @@ function makeAuthorizationProvider(cred, opts = {}) {
197
197
  }
198
198
 
199
199
  //#endregion
200
- export { makeAuthorizationProvider as a, resolveDefaultKeyPath as c, isEncryptedKey as i, resolveDefaultKidPath as l, DEFAULT_CAPABILITIES as n, makeTokenProvider as o, adminClaimCapabilities as r, resolveAdminCredential as s, ADMIN_CAPABILITIES as t };
200
+ //#region ../../packages/substrate-types/src/env-utils.ts
201
+ /**
202
+ * Pure env-string parsing helpers shared by plugins and deployment helpers
203
+ * (e.g. `substrate-sentinel-client`) without a substrate-sdk runtime dep.
204
+ */
205
+ /**
206
+ * Strict positive-integer env parsing. Returns `fallback` when `raw` is
207
+ * undefined (env var unset). Throws with `envVar` in the message when `raw`
208
+ * is set but not a positive integer — never falls back on invalid input, so
209
+ * a config typo fails at boot.
210
+ */
211
+ function parsePositiveInt(raw, envVar, fallback) {
212
+ if (raw === void 0) return fallback;
213
+ const n = Number(raw);
214
+ if (!Number.isFinite(n) || !Number.isInteger(n) || n <= 0) throw new Error(`${envVar} must be a positive integer (got '${raw}')`);
215
+ return n;
216
+ }
217
+ /**
218
+ * `url` with its trailing slashes removed, for joining a configured base URL
219
+ * to a path. A loop rather than `/\/+$/`, which backtracks quadratically on a
220
+ * long run of slashes that does not end the string.
221
+ */
222
+ function trimTrailingSlashes(url) {
223
+ let end = url.length;
224
+ while (end > 0 && url.charCodeAt(end - 1) === 47) end--;
225
+ return url.slice(0, end);
226
+ }
227
+
228
+ //#endregion
229
+ export { adminClaimCapabilities as a, makeTokenProvider as c, resolveDefaultKidPath as d, DEFAULT_CAPABILITIES as i, resolveAdminCredential as l, trimTrailingSlashes as n, isEncryptedKey as o, ADMIN_CAPABILITIES as r, makeAuthorizationProvider as s, parsePositiveInt as t, resolveDefaultKeyPath as u };
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 decodeEnvelope, a as buildDecodePlan, c as isPlainRequestData, d as PackEncodeError, f as encodeEnvelope, g as SchemaDriftError, h as PackDecodeError, i as applyDecodePlanInPlace, l as decodeStreamChunk, m as encodePositionalFromFieldDef, n as packFrame, o as decodeWsEnvelope, p as encodePositional, r as unpackFrame, s as encodeWsFrame, t as WS_SUBPROTOCOL_SUBSTRATE_PACK, u as encodeStreamChunk, v as decodePositional, y as decodePositionalFromFieldDef } from "./src-C4DzaIQZ.js";
2
+ import { _ as decodeEnvelope, a as buildDecodePlan, c as isPlainRequestData, d as PackEncodeError, f as encodeEnvelope, g as SchemaDriftError, h as PackDecodeError, i as applyDecodePlanInPlace, l as decodeStreamChunk, m as encodePositionalFromFieldDef, n as packFrame, o as decodeWsEnvelope, p as encodePositional, r as unpackFrame, s as encodeWsFrame, t as WS_SUBPROTOCOL_SUBSTRATE_PACK, u as encodeStreamChunk, v as decodePositional, y as decodePositionalFromFieldDef } from "./src-BLgbLq2k.js";
3
3
  import { n as acceptsPack, t as PACK_MIME } from "./content-type-C7T28xNb.js";
4
4
 
5
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 };
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __binCreateRequire } from 'node:module'; const require = __binCreateRequire(import.meta.url);
2
- import { L as applyObligations, Q as buildContext, et as jsonResponse, wt as ResolverFrameError } from "./src-YXlv_RyL.js";
2
+ import { L as applyObligations, Q as buildContext, et as jsonResponse, wt as ResolverFrameError } from "./src-CHp3QyqB.js";
3
3
  import { Worker } from "node:worker_threads";
4
4
 
5
5
  //#region ../../plugins/substrate-recall/src/candidate-selection.ts
@@ -951,6 +951,7 @@ async function handleRecallRequest(input, deps) {
951
951
  }
952
952
  const type = input.type;
953
953
  if (type === void 0 || type === "") throw Object.assign(/* @__PURE__ */ new Error("recall: pass `type`, the type to search. There is no default."), { code: "bad_request" });
954
+ if (typeof input.query !== "string" || input.query.trim() === "") throw Object.assign(/* @__PURE__ */ new Error("recall: pass `query`, the text to search for."), { code: "bad_request" });
954
955
  if (input.query.length > 8192) throw Object.assign(/* @__PURE__ */ new Error(`recall: query is longer than ${MAX_RECALL_QUERY_CHARS} characters`), { code: "bad_request" });
955
956
  const k = clamp(input.k ?? 10, 1, 100);
956
957
  const threshold = typeof input.threshold === "number" ? input.threshold : 0;
@@ -976,7 +977,8 @@ async function handleRecallRequest(input, deps) {
976
977
  type,
977
978
  model: embedder.modelId,
978
979
  vector,
979
- k
980
+ k,
981
+ salienceHalfLifeHours: salience.halfLifeHours
980
982
  };
981
983
  if (threshold > 0) knnInput.threshold = threshold;
982
984
  if (returnVector) knnInput.returnVector = true;
@@ -1502,14 +1504,35 @@ function rethrowCoded$1(err) {
1502
1504
  * answers both visibility and counts; `check` is cached per scope.
1503
1505
  */
1504
1506
  async function resolveClusterVisibility(record, deps, ctx) {
1505
- if (deps.checkReadPolicy === void 0) return {
1507
+ if (deps.checkReadPolicy === void 0) return storedVisibility(record);
1508
+ const members = await deps.clusters.listMembers(record.id, { includeDeparted: true });
1509
+ return visibilityOf(members, await readableMembers(members, deps, ctx));
1510
+ }
1511
+ /**
1512
+ * `resolveClusterVisibility` for a whole listing: one member read and one
1513
+ * readability check across every cluster, rather than two per cluster.
1514
+ */
1515
+ async function resolveListVisibility(records, deps, ctx) {
1516
+ if (deps.checkReadPolicy === void 0 || records.length === 0) return records.map(storedVisibility);
1517
+ const members = await deps.clusters.listMembers(records.map((r) => r.id), { includeDeparted: true });
1518
+ const readable = await readableMembers(members, deps, ctx);
1519
+ const byCluster = /* @__PURE__ */ new Map();
1520
+ for (const m of members) {
1521
+ const list = byCluster.get(m.clusterId);
1522
+ if (list === void 0) byCluster.set(m.clusterId, [m]);
1523
+ else list.push(m);
1524
+ }
1525
+ return records.map((r) => visibilityOf(byCluster.get(r.id) ?? [], readable));
1526
+ }
1527
+ function storedVisibility(record) {
1528
+ return {
1506
1529
  visible: true,
1507
1530
  memberCount: record.memberCount,
1508
1531
  departedCount: record.departedCount,
1509
1532
  labelReadable: true
1510
1533
  };
1511
- const members = await deps.clusters.listMembers(record.id, { includeDeparted: true });
1512
- const readable = await readableMembers(members, deps, ctx);
1534
+ }
1535
+ function visibilityOf(members, readable) {
1513
1536
  let liveTotal = 0;
1514
1537
  let memberCount = 0;
1515
1538
  let departedCount = 0;
@@ -1559,10 +1582,11 @@ function buildClusterSurface(deps) {
1559
1582
  return [project(clusterRow(one, vis), args.fields)];
1560
1583
  }
1561
1584
  const rows = await deps.clusters.listClusters(p.includeRetired === true ? { includeRetired: true } : {});
1585
+ const visibility = await resolveListVisibility(rows, deps, ctx);
1562
1586
  const visible = [];
1563
- for (const c of rows) {
1564
- const vis = await resolveClusterVisibility(c, deps, ctx);
1565
- if (vis.visible) visible.push(project(clusterRow(c, vis), args.fields));
1587
+ for (const [i, c] of rows.entries()) {
1588
+ const vis = visibility[i];
1589
+ if (vis?.visible === true) visible.push(project(clusterRow(c, vis), args.fields));
1566
1590
  }
1567
1591
  return visible;
1568
1592
  };
@@ -1739,7 +1763,7 @@ async function embedRowReporting(row, opts) {
1739
1763
  if (opts.serializeRow) source = await opts.serializeRow(row);
1740
1764
  else if (opts.fields && opts.fields.length > 0) source = opts.fields.map((f) => row[f]).filter((v) => typeof v === "string" && v.length > 0).join("\n");
1741
1765
  else source = "";
1742
- if (source === null || source === void 0) {
1766
+ if (source === null || source === void 0 || source.trim() === "") {
1743
1767
  await opts.store.delete({
1744
1768
  rowNamespace: opts.namespace,
1745
1769
  rowType: opts.type,
@@ -3594,8 +3618,9 @@ function makeSpreadResolver(registry, edges) {
3594
3618
  //#region ../../plugins/substrate-recall/src/plugin.ts
3595
3619
  const DEFAULT_CLUSTER_DIMENSION = 768;
3596
3620
  const DEFAULT_QUERY_EMBED_TIMEOUT_MS = 3e4;
3621
+ const DEFAULT_WRITE_EMBED_TIMEOUT_MS = 3e4;
3597
3622
  /** `embedder` with `timeoutMs` applied to every call that does not set its own. */
3598
- function withQueryTimeout(embedder, timeoutMs) {
3623
+ function withEmbedTimeout(embedder, timeoutMs) {
3599
3624
  return {
3600
3625
  modelId: embedder.modelId,
3601
3626
  dimension: embedder.dimension,
@@ -3634,7 +3659,7 @@ function makeEmbedSourceContext(resolveDataset) {
3634
3659
  }
3635
3660
  function createRecallPlugin(cfg) {
3636
3661
  const stats = cfg.stats ?? createEmbedStats();
3637
- const queryEmbedder = cfg.embedder === void 0 ? void 0 : withQueryTimeout(cfg.embedder, cfg.queryEmbedTimeoutMs ?? 3e4);
3662
+ const queryEmbedder = cfg.embedder === void 0 ? void 0 : withEmbedTimeout(cfg.embedder, cfg.queryEmbedTimeoutMs ?? 3e4);
3638
3663
  const spreadRegistry = new SpreadEdgeRegistry();
3639
3664
  const embedSourceRegistry = new EmbedSourceRegistry();
3640
3665
  const lexicalSourceRegistry = new LexicalSourceRegistry();
@@ -3826,7 +3851,10 @@ function createRecallPlugin(cfg) {
3826
3851
  stats,
3827
3852
  ...embedSourceContext !== void 0 ? { embedSourceContext } : {}
3828
3853
  };
3829
- const hook = makeEmbedPostWrite(binding);
3854
+ const hook = makeEmbedPostWrite({
3855
+ ...binding,
3856
+ embedder: withEmbedTimeout(binding.embedder, cfg.writeEmbedTimeoutMs ?? 3e4)
3857
+ });
3830
3858
  out[typeName] = composeHooks(out[typeName], hook);
3831
3859
  embedSourceRegistry.add({
3832
3860
  namespace: namespace.namespace,
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __binCreateRequire } from 'node:module'; const require = __binCreateRequire(import.meta.url);
2
- import { Pt as defineBootstrap } from "./src-YXlv_RyL.js";
3
- import { n as createNoopPubSub, t as createProposalsPlugin } from "./src-5hVbeiAu.js";
2
+ import { Pt as defineBootstrap } from "./src-CHp3QyqB.js";
3
+ import { n as createNoopPubSub, t as createProposalsPlugin } from "./src-CG7giuHr.js";
4
4
  import { z } from "zod";
5
5
 
6
6
  //#region ../../plugins/substrate-proposals/src/bootstrap.ts
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 { n as createNoopPubSub, r as ProposalError, t as createProposalsPlugin } from "./src-5hVbeiAu.js";
2
+ import { n as createNoopPubSub, r as ProposalError, t as createProposalsPlugin } from "./src-CG7giuHr.js";
3
3
 
4
4
  export { ProposalError, createNoopPubSub, createProposalsPlugin };
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __binCreateRequire } from 'node:module'; const require = __binCreateRequire(import.meta.url);
2
- import { Pt as defineBootstrap } from "./src-YXlv_RyL.js";
2
+ import { Pt as defineBootstrap } from "./src-CHp3QyqB.js";
3
3
  import { t as FakeEmbedder } from "./fake-DUVtKVSE.js";
4
- import { t as createRecallPlugin } from "./plugin-BuQQEzL-.js";
4
+ import { t as createRecallPlugin } from "./plugin-QuJN9pG_.js";
5
5
  import { z } from "zod";
6
6
 
7
7
  //#region ../../packages/substrate-embedder/src/types.ts
@@ -49,7 +49,7 @@ var OllamaEmbedder = class {
49
49
  async embed(text, opts) {
50
50
  const timeoutMs = opts?.timeoutMs ?? this.timeoutMs;
51
51
  const contextLength = await this.resolveContextLength(timeoutMs);
52
- const url = `${this.baseUrl.replace(/\/+$/, "")}/api/embed`;
52
+ const url = `${trimTrailingSlashes(this.baseUrl)}/api/embed`;
53
53
  const controller = new AbortController();
54
54
  const timer = setTimeout(() => controller.abort(), timeoutMs);
55
55
  let res;
@@ -98,7 +98,7 @@ var OllamaEmbedder = class {
98
98
  return this.contextLength;
99
99
  }
100
100
  async fetchContextLength(timeoutMs) {
101
- const url = `${this.baseUrl.replace(/\/+$/, "")}/api/show`;
101
+ const url = `${trimTrailingSlashes(this.baseUrl)}/api/show`;
102
102
  const controller = new AbortController();
103
103
  const timer = setTimeout(() => controller.abort(), timeoutMs);
104
104
  let body;
@@ -137,6 +137,11 @@ var OllamaEmbedder = class {
137
137
  }
138
138
  };
139
139
  /** `unavailable` for a failed request, naming the timeout when it was the abort. */
140
+ function trimTrailingSlashes(url) {
141
+ let end = url.length;
142
+ while (end > 0 && url.charCodeAt(end - 1) === 47) end--;
143
+ return url.slice(0, end);
144
+ }
140
145
  function transportError(url, controller, timeoutMs, err) {
141
146
  const detail = controller.signal.aborted ? `timed out after ${timeoutMs}ms` : `failed: ${err instanceof Error ? err.message : String(err)}`;
142
147
  return new EmbedError("unavailable", `OllamaEmbedder: POST ${url} ${detail}`, { cause: err });
@@ -378,6 +383,7 @@ const CrystalliseSchema = z.object({
378
383
  const RecallBootstrapConfigSchema = z.object({
379
384
  embedder: EmbedderSchema.optional(),
380
385
  queryEmbedTimeoutMs: z.number().int().positive().default(3e4),
386
+ writeEmbedTimeoutMs: z.number().int().positive().default(3e4),
381
387
  hnswM: z.number().int().positive().default(16),
382
388
  hnswEfConstruction: z.number().int().positive().default(64),
383
389
  salience: SalienceSchema.default({
@@ -426,6 +432,7 @@ const bootstrap = defineBootstrap.kernel({
426
432
  return createRecallPlugin({
427
433
  ...embedder !== null ? { embedder } : {},
428
434
  queryEmbedTimeoutMs: config.queryEmbedTimeoutMs,
435
+ writeEmbedTimeoutMs: config.writeEmbedTimeoutMs,
429
436
  ...deps.lexicalStore !== void 0 ? { lexicalStore: deps.lexicalStore } : {},
430
437
  store: deps.store,
431
438
  ...deps.stats !== void 0 ? { stats: deps.stats } : {},
@@ -118,6 +118,12 @@
118
118
  "exclusiveMinimum": 0,
119
119
  "maximum": 9007199254740991
120
120
  },
121
+ "writeEmbedTimeoutMs": {
122
+ "default": 30000,
123
+ "type": "integer",
124
+ "exclusiveMinimum": 0,
125
+ "maximum": 9007199254740991
126
+ },
121
127
  "hnswM": {
122
128
  "default": 16,
123
129
  "type": "integer",
package/dist/recall.d.ts CHANGED
@@ -150,8 +150,11 @@ interface ClusterStore {
150
150
  includeRetired?: boolean;
151
151
  }): Promise<ClusterRecord[]>;
152
152
  getCluster(id: string): Promise<ClusterRecord | null>;
153
- /** Members of one cluster. Departed members excluded unless asked for. */
154
- listMembers(clusterId: string, opts?: {
153
+ /**
154
+ * Members of one cluster, or of each of several in one read. Departed
155
+ * members excluded unless asked for.
156
+ */
157
+ listMembers(clusterId: string | readonly string[], opts?: {
155
158
  includeDeparted?: boolean;
156
159
  }): Promise<ClusterMemberRecord[]>;
157
160
  /**
@@ -242,6 +245,11 @@ interface EmbeddingsStoreKnnInput {
242
245
  * store shared by several still fills k. Equality family only.
243
246
  */
244
247
  rowFilter?: KnnRowFilter;
248
+ /**
249
+ * Return each row's salience decayed to now by this half-life, the decay
250
+ * `boostSalience` applies. Absent: the stored value, as of its last boost.
251
+ */
252
+ salienceHalfLifeHours?: number;
245
253
  }
246
254
  type KnnScalar = string | number | boolean | null;
247
255
  /** Field -> `{ eq }` or `{ in }`; every field must match. `eq: null` matches a missing or null field. */
@@ -1451,7 +1459,7 @@ export declare class InMemoryClusterStore implements ClusterStore {
1451
1459
  includeRetired?: boolean;
1452
1460
  }): Promise<ClusterRecord[]>;
1453
1461
  getCluster(id: string): Promise<ClusterRecord | null>;
1454
- listMembers(clusterId: string, opts?: {
1462
+ listMembers(clusterId: string | readonly string[], opts?: {
1455
1463
  includeDeparted?: boolean;
1456
1464
  }): Promise<ClusterMemberRecord[]>;
1457
1465
  listAllMembers(): Promise<ClusterMemberRecord[]>;
@@ -1651,7 +1659,7 @@ export declare class PgClusterStore implements ClusterStore {
1651
1659
  includeRetired?: boolean;
1652
1660
  }): Promise<ClusterRecord[]>;
1653
1661
  getCluster(id: string): Promise<ClusterRecord | null>;
1654
- listMembers(clusterId: string, opts?: {
1662
+ listMembers(clusterId: string | readonly string[], opts?: {
1655
1663
  includeDeparted?: boolean;
1656
1664
  }): Promise<ClusterMemberRecord[]>;
1657
1665
  listAllMembers(): Promise<ClusterMemberRecord[]>;
@@ -1731,10 +1739,17 @@ export declare class PgLexicalStore implements LexicalStore {
1731
1739
  interface RecallPluginConfig {
1732
1740
  embedder?: Embedder;
1733
1741
  /**
1734
- * Timeout for embedding a recall or `embeddingSimilar` query, in ms. Write
1735
- * and reindex embeds keep the embedder's own timeout. Default 30000.
1742
+ * Timeout for embedding a recall or `embeddingSimilar` query, in ms.
1743
+ * Reindex embeds keep the embedder's own timeout. Default 30000.
1736
1744
  */
1737
1745
  queryEmbedTimeoutMs?: number;
1746
+ /**
1747
+ * Timeout for the embed that follows a write, in ms. The engine awaits
1748
+ * after-commit work before it replies, so this bounds how long an already
1749
+ * committed write can be held by a slow embedder. A timed-out embed keeps
1750
+ * the row's previous vector until its next write or a reindex. Default 30000.
1751
+ */
1752
+ writeEmbedTimeoutMs?: number;
1738
1753
  store: EmbeddingsStore;
1739
1754
  /**
1740
1755
  * Store for the lexical arm. Absent → types declaring `lexical.source`
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-zcyUofMJ.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-BuQQEzL-.js";
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-DWm0iA88.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-QuJN9pG_.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 };
@@ -388,18 +388,16 @@ function newlyGranted(prev, next) {
388
388
  * facing refusal message.
389
389
  */
390
390
  function newlyGrantedPairs(prev, next) {
391
- const covered = (ns, cap) => {
392
- const direct = prev[ns];
393
- if (Array.isArray(direct) && direct.includes(cap)) return true;
394
- const wild = prev["*"];
395
- return Array.isArray(wild) && wild.includes(cap);
396
- };
391
+ const effective = (grant, ns) => grant[ns] ?? grant["*"] ?? [];
397
392
  const byNs = /* @__PURE__ */ new Map();
398
- for (const [ns, caps] of Object.entries(next)) for (const cap of caps) {
399
- if (covered(ns, cap)) continue;
400
- const bucket = byNs.get(ns);
401
- if (bucket === void 0) byNs.set(ns, [cap]);
402
- else bucket.push(cap);
393
+ for (const ns of /* @__PURE__ */ new Set([...Object.keys(prev), ...Object.keys(next)])) {
394
+ const had = effective(prev, ns);
395
+ for (const cap of effective(next, ns)) {
396
+ if (had.includes(cap)) continue;
397
+ const bucket = byNs.get(ns);
398
+ if (bucket === void 0) byNs.set(ns, [cap]);
399
+ else bucket.push(cap);
400
+ }
403
401
  }
404
402
  return [...byNs.entries()].map(([ns, caps]) => `${ns}:${[...caps].sort().join("+")}`).sort();
405
403
  }
package/dist/sdk.d.ts CHANGED
@@ -32,6 +32,12 @@ export declare function canonicalize(value: unknown): unknown;
32
32
  * a config typo fails at boot.
33
33
  */
34
34
  export declare function parsePositiveInt(raw: string | undefined, envVar: string, fallback: number): number;
35
+ /**
36
+ * `url` with its trailing slashes removed, for joining a configured base URL
37
+ * to a path. A loop rather than `/\/+$/`, which backtracks quadratically on a
38
+ * long run of slashes that does not end the string.
39
+ */
40
+ export declare function trimTrailingSlashes(url: string): string;
35
41
  //#endregion
36
42
  //#region ../../packages/substrate-types/src/hard-delete-gate.d.ts
37
43
  /**
package/dist/sdk.js CHANGED
@@ -1,9 +1,8 @@
1
1
  import { createRequire as __binCreateRequire } from 'node:module'; const require = __binCreateRequire(import.meta.url);
2
- import { $ as error400, A as resolveIdentity, At as CLIENT_SUPPLIED_SERVER_FIELD, C as purgeResolver, Ct as ReservedField, D as deleteRow, Dt as isAuthCause, E as deleteResolver, Et as UnsupportedFilterError, M as resolveEntityRow, Mt as canonicalize, Nt as BootstrapConfigError, O as createResolver, Ot as isResolverFrameError, Pt as defineBootstrap, S as updateResolver, St as NamespaceMismatch, T as getResolver, Tt as RestrictViolation, Z as JSON_HEADERS, _ as field, _t as createKeyedMutex, at as WS_REASON_SERVER_RESTART, b as installAutoCrud, bt as BridgeUnreachableError, ct as normaliseVocabValues, dt as vocabImplication, et as jsonResponse, ft as RegistryBase, g as RESERVED_AUTOCRUD_FIELD_NAMES, gt as normaliseMetadataWhere, h as RESERVED_AUTOCRUD_FIELDS, ht as normaliseMetadataOrderBy, it as WS_CODE_SUBSCRIPTION_UNSUPPORTED_FRAME, j as resolveEntityId, jt as ROW_METADATA_FIELDS, k as UnattributedWriteError, kt as isRestrictViolation, lt as normaliseVocabWhere, m as defineNamespace, mt as METADATA_FILTER_FIELDS, ot as WS_REASON_SUBSCRIPTION_OVERLOADED, pt as METADATA_AUTHOR_FIELDS, st as canonicalVocabValue, tt as parseJsonBody, ut as storedVocabSpellings, v as autoCrudOptionsOf, vt as assertHardDeleteAllowed, w as listResolver, wt as ResolverFrameError, x as applyUpdatePatch, xt as MissingReferentError, y as createResolverWithEdges, yt as validateHardDeleteEnv } from "./src-YXlv_RyL.js";
3
- import { a as makeAuthorizationProvider, c as resolveDefaultKeyPath, i as isEncryptedKey, l as resolveDefaultKidPath, n as DEFAULT_CAPABILITIES, o as makeTokenProvider, r as adminClaimCapabilities, s as resolveAdminCredential, t as ADMIN_CAPABILITIES } from "./agent-token-BIboWOU0.js";
4
- 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, d as confersAnywhere, f as coversNamespace, g as checkUpdatable, h as checkRevocable, i as allowVerbs, j as flattenGrant, k as encodeGrant, l as requireNamespace, m as grantedIn, n as row, o as denyVerbs, p as grantOf, r as allowAll, s as requireCapability, t as applyRowFilters, u as allCapabilities, v as grantEntriesConfer, w as or, x as revokedAtIso, y as newlyGranted } from "./row-DK7lPZVe.js";
5
- import { S as assertNever, b as formatQualifiedKey, x as parseQualifiedKey } from "./src-C4DzaIQZ.js";
6
- import { t as parsePositiveInt } from "./env-utils-B7SGmoeJ.js";
2
+ import { $ as error400, A as resolveIdentity, At as CLIENT_SUPPLIED_SERVER_FIELD, C as purgeResolver, Ct as ReservedField, D as deleteRow, Dt as isAuthCause, E as deleteResolver, Et as UnsupportedFilterError, M as resolveEntityRow, Mt as canonicalize, Nt as BootstrapConfigError, O as createResolver, Ot as isResolverFrameError, Pt as defineBootstrap, S as updateResolver, St as NamespaceMismatch, T as getResolver, Tt as RestrictViolation, Z as JSON_HEADERS, _ as field, _t as createKeyedMutex, at as WS_REASON_SERVER_RESTART, b as installAutoCrud, bt as BridgeUnreachableError, ct as normaliseVocabValues, dt as vocabImplication, et as jsonResponse, ft as RegistryBase, g as RESERVED_AUTOCRUD_FIELD_NAMES, gt as normaliseMetadataWhere, h as RESERVED_AUTOCRUD_FIELDS, ht as normaliseMetadataOrderBy, it as WS_CODE_SUBSCRIPTION_UNSUPPORTED_FRAME, j as resolveEntityId, jt as ROW_METADATA_FIELDS, k as UnattributedWriteError, kt as isRestrictViolation, lt as normaliseVocabWhere, m as defineNamespace, mt as METADATA_FILTER_FIELDS, ot as WS_REASON_SUBSCRIPTION_OVERLOADED, pt as METADATA_AUTHOR_FIELDS, st as canonicalVocabValue, tt as parseJsonBody, ut as storedVocabSpellings, v as autoCrudOptionsOf, vt as assertHardDeleteAllowed, w as listResolver, wt as ResolverFrameError, x as applyUpdatePatch, xt as MissingReferentError, y as createResolverWithEdges, yt as validateHardDeleteEnv } from "./src-CHp3QyqB.js";
3
+ import { a as adminClaimCapabilities, c as makeTokenProvider, d as resolveDefaultKidPath, i as DEFAULT_CAPABILITIES, l as resolveAdminCredential, n as trimTrailingSlashes, o as isEncryptedKey, r as ADMIN_CAPABILITIES, s as makeAuthorizationProvider, t as parsePositiveInt, u as resolveDefaultKeyPath } from "./env-utils-CGNazUNt.js";
4
+ 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, d as confersAnywhere, f as coversNamespace, g as checkUpdatable, h as checkRevocable, i as allowVerbs, j as flattenGrant, k as encodeGrant, l as requireNamespace, m as grantedIn, n as row, o as denyVerbs, p as grantOf, r as allowAll, s as requireCapability, t as applyRowFilters, u as allCapabilities, v as grantEntriesConfer, w as or, x as revokedAtIso, y as newlyGranted } from "./row-DZ0Fnpc6.js";
5
+ import { S as assertNever, b as formatQualifiedKey, x as parseQualifiedKey } from "./src-BLgbLq2k.js";
7
6
 
8
7
  //#region ../../packages/substrate-sdk/src/engine-helpers.ts
9
8
  /**
@@ -109,4 +108,4 @@ async function queryOne(engine, namespace, typeName, params, fields, identity =
109
108
  }
110
109
 
111
110
  //#endregion
112
- export { ADMIN_CAPABILITIES, BootstrapConfigError, BridgeUnreachableError, CLIENT_SUPPLIED_SERVER_FIELD, DEFAULT_CAPABILITIES, EngineQueryError, JSON_HEADERS, METADATA_AUTHOR_FIELDS, METADATA_FILTER_FIELDS, MissingReferentError, NamespaceMismatch, RESERVED_AUTOCRUD_FIELDS, RESERVED_AUTOCRUD_FIELD_NAMES, ROW_METADATA_FIELDS, RegistryBase, ReservedField, ResolverFrameError, RestrictViolation, SYSTEM_NAMESPACE, UnattributedWriteError, UnsupportedFilterError, WS_CODE_SUBSCRIPTION_UNSUPPORTED_FRAME, WS_REASON_SERVER_RESTART, WS_REASON_SUBSCRIPTION_OVERLOADED, adminClaimCapabilities, allCapabilities, allowAll, allowVerbs, and, applyRowFilters, applyUpdatePatch, assertHardDeleteAllowed, assertNever, autoCrudOptionsOf, canonicalVocabValue, canonicalize, capabilitiesFor, checkRevocable, checkUpdatable, confersAnywhere, coversNamespace, createKeyedMutex, createResolver, createResolverWithEdges, decodeList, defineBootstrap, defineNamespace, deleteResolver, deleteRow, denyAll, denyVerbs, describeGrant, encodeGrant, encodeList, error400, expandFlat, field, flattenGrant, formatQualifiedKey, getResolver, grantCovers, grantEntriesConfer, grantEntryError, grantIsUniform, grantOf, grantedIn, installAutoCrud, intersectGrants, isActiveAdminKeyRow, isAuthCause, isEncryptedKey, isResolverFrameError, isRestrictViolation, jsonResponse, listResolver, makeAuthorizationProvider, makeCtx, makeTokenProvider, newlyGranted, newlyGrantedPairs, normaliseMetadataOrderBy, normaliseMetadataWhere, normaliseVocabValues, normaliseVocabWhere, not, or, parseGrantEntries, parseJsonBody, parsePositiveInt, parseQualifiedKey, purgeResolver, queryAll, queryOne, requireCapability, requireIdentity, requireNamespace, resolveAdminCredential, resolveDefaultKeyPath, resolveDefaultKidPath, resolveEntityId, resolveEntityRow, resolveIdentity, revokedAtIso, row, selectAll, storedVocabSpellings, updateResolver, validateHardDeleteEnv, vocabImplication };
111
+ export { ADMIN_CAPABILITIES, BootstrapConfigError, BridgeUnreachableError, CLIENT_SUPPLIED_SERVER_FIELD, DEFAULT_CAPABILITIES, EngineQueryError, JSON_HEADERS, METADATA_AUTHOR_FIELDS, METADATA_FILTER_FIELDS, MissingReferentError, NamespaceMismatch, RESERVED_AUTOCRUD_FIELDS, RESERVED_AUTOCRUD_FIELD_NAMES, ROW_METADATA_FIELDS, RegistryBase, ReservedField, ResolverFrameError, RestrictViolation, SYSTEM_NAMESPACE, UnattributedWriteError, UnsupportedFilterError, WS_CODE_SUBSCRIPTION_UNSUPPORTED_FRAME, WS_REASON_SERVER_RESTART, WS_REASON_SUBSCRIPTION_OVERLOADED, adminClaimCapabilities, allCapabilities, allowAll, allowVerbs, and, applyRowFilters, applyUpdatePatch, assertHardDeleteAllowed, assertNever, autoCrudOptionsOf, canonicalVocabValue, canonicalize, capabilitiesFor, checkRevocable, checkUpdatable, confersAnywhere, coversNamespace, createKeyedMutex, createResolver, createResolverWithEdges, decodeList, defineBootstrap, defineNamespace, deleteResolver, deleteRow, denyAll, denyVerbs, describeGrant, encodeGrant, encodeList, error400, expandFlat, field, flattenGrant, formatQualifiedKey, getResolver, grantCovers, grantEntriesConfer, grantEntryError, grantIsUniform, grantOf, grantedIn, installAutoCrud, intersectGrants, isActiveAdminKeyRow, isAuthCause, isEncryptedKey, isResolverFrameError, isRestrictViolation, jsonResponse, listResolver, makeAuthorizationProvider, makeCtx, makeTokenProvider, newlyGranted, newlyGrantedPairs, normaliseMetadataOrderBy, normaliseMetadataWhere, normaliseVocabValues, normaliseVocabWhere, not, or, parseGrantEntries, parseJsonBody, parsePositiveInt, parseQualifiedKey, purgeResolver, queryAll, queryOne, requireCapability, requireIdentity, requireNamespace, resolveAdminCredential, resolveDefaultKeyPath, resolveDefaultKidPath, resolveEntityId, resolveEntityRow, resolveIdentity, revokedAtIso, row, selectAll, storedVocabSpellings, trimTrailingSlashes, updateResolver, validateHardDeleteEnv, vocabImplication };
@@ -208,6 +208,7 @@ function decodeEnvelope(bytes, ctx) {
208
208
  if (raw._meta !== void 0) out._meta = raw._meta;
209
209
  if (raw._pagination !== void 0) out._pagination = raw._pagination;
210
210
  if (raw._completeness !== void 0) out._completeness = raw._completeness;
211
+ if (raw._diagnostics !== void 0) out._diagnostics = raw._diagnostics;
211
212
  if (raw.errors !== void 0) out.errors = raw.errors;
212
213
  return out;
213
214
  }
@@ -482,6 +483,7 @@ function encodeEnvelope(envelope, ctx) {
482
483
  if (envelope._meta !== void 0) out._meta = envelope._meta;
483
484
  if (envelope._pagination !== void 0) out._pagination = envelope._pagination;
484
485
  if (envelope._completeness !== void 0) out._completeness = envelope._completeness;
486
+ if (envelope._diagnostics !== void 0) out._diagnostics = envelope._diagnostics;
485
487
  if (envelope.errors !== void 0) out.errors = envelope.errors;
486
488
  return Buffer.from(pack(out));
487
489
  }
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __binCreateRequire } from 'node:module'; const require = __binCreateRequire(import.meta.url);
2
- import { A as resolveIdentity, F as publishSchema, Z as JSON_HEADERS, _ as field, b as installAutoCrud, h as RESERVED_AUTOCRUD_FIELDS, l as migrateFieldValues, m as defineNamespace, v as autoCrudOptionsOf, wt as ResolverFrameError } from "./src-YXlv_RyL.js";
3
- import { s as requireCapability } from "./row-DK7lPZVe.js";
2
+ import { A as resolveIdentity, F as publishSchema, Z as JSON_HEADERS, _ as field, b as installAutoCrud, h as RESERVED_AUTOCRUD_FIELDS, l as migrateFieldValues, m as defineNamespace, v as autoCrudOptionsOf, wt as ResolverFrameError } from "./src-CHp3QyqB.js";
3
+ import { s as requireCapability } from "./row-DZ0Fnpc6.js";
4
4
  import { randomUUID } from "node:crypto";
5
5
 
6
6
  //#region ../../plugins/substrate-proposals/src/capability.ts