@rei-standard/amsg-server 2.6.0-next.4 → 2.6.0-next.5

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.
@@ -598,7 +598,7 @@ function normalizeBeforeFireResult(result) {
598
598
  };
599
599
  }
600
600
  throw new TypeError(
601
- "AGENTIC_BAD_BEFORE_FIRE: onBeforeFire must return ChatMessage[] | { messages, maxToolIterations?, totalTimeoutMs? } | null"
601
+ "AGENTIC_BAD_BEFORE_FIRE: onBeforeFire must return ChatMessage[] | { messages, maxToolIterations?, totalTimeoutMs? } | { skip: true } | null"
602
602
  );
603
603
  }
604
604
  function firstPositiveInt(values, fallback) {
@@ -642,6 +642,9 @@ async function runAgenticFire({ task, decryptedPayload, userKey, ctx }) {
642
642
  });
643
643
  const before = await hooks.onBeforeFire(fireCtx);
644
644
  if (before == null) return { handled: false };
645
+ if (typeof before === "object" && before.skip === true) {
646
+ return { handled: true, result: { success: true, messagesSent: 0, status: "skipped", iterations: 0 } };
647
+ }
645
648
  const normalized = normalizeBeforeFireResult(before);
646
649
  const maxToolIterations = firstPositiveInt(
647
650
  [normalized.maxToolIterations, ctx.maxToolIterations],
@@ -1416,7 +1419,14 @@ function createMessagesHandler(ctx) {
1416
1419
  status: task.status,
1417
1420
  retryCount: task.retry_count,
1418
1421
  createdAt: task.created_at,
1419
- updatedAt: task.updated_at
1422
+ updatedAt: task.updated_at,
1423
+ // Character ownership / client-side task identity, pulled from the
1424
+ // scheduling host's metadata so it can filter tasks by character
1425
+ // (contactName can collide across characters). Only these two
1426
+ // metadata fields are surfaced — the rest of metadata may hold
1427
+ // host-private data and stays server-side. Absent → null.
1428
+ charId: decrypted.metadata?.charId ?? null,
1429
+ clientTaskId: decrypted.metadata?.amsgClientTaskId ?? null
1420
1430
  };
1421
1431
  }));
1422
1432
  const responsePayload = {
@@ -2082,7 +2092,7 @@ function createClientStateHandler(ctx) {
2082
2092
  }
2083
2093
 
2084
2094
  // src/server/lib/version.js
2085
- var SERVER_VERSION = true ? "2.6.0-next.4" : "0.0.0-dev";
2095
+ var SERVER_VERSION = true ? "2.6.0-next.5" : "0.0.0-dev";
2086
2096
 
2087
2097
  // src/server/handlers/capabilities.js
2088
2098
  var SERVER_FEATURES = Object.freeze([
@@ -598,7 +598,7 @@ function normalizeBeforeFireResult(result) {
598
598
  };
599
599
  }
600
600
  throw new TypeError(
601
- "AGENTIC_BAD_BEFORE_FIRE: onBeforeFire must return ChatMessage[] | { messages, maxToolIterations?, totalTimeoutMs? } | null"
601
+ "AGENTIC_BAD_BEFORE_FIRE: onBeforeFire must return ChatMessage[] | { messages, maxToolIterations?, totalTimeoutMs? } | { skip: true } | null"
602
602
  );
603
603
  }
604
604
  function firstPositiveInt(values, fallback) {
@@ -642,6 +642,9 @@ async function runAgenticFire({ task, decryptedPayload, userKey, ctx }) {
642
642
  });
643
643
  const before = await hooks.onBeforeFire(fireCtx);
644
644
  if (before == null) return { handled: false };
645
+ if (typeof before === "object" && before.skip === true) {
646
+ return { handled: true, result: { success: true, messagesSent: 0, status: "skipped", iterations: 0 } };
647
+ }
645
648
  const normalized = normalizeBeforeFireResult(before);
646
649
  const maxToolIterations = firstPositiveInt(
647
650
  [normalized.maxToolIterations, ctx.maxToolIterations],
@@ -1416,7 +1419,14 @@ function createMessagesHandler(ctx) {
1416
1419
  status: task.status,
1417
1420
  retryCount: task.retry_count,
1418
1421
  createdAt: task.created_at,
1419
- updatedAt: task.updated_at
1422
+ updatedAt: task.updated_at,
1423
+ // Character ownership / client-side task identity, pulled from the
1424
+ // scheduling host's metadata so it can filter tasks by character
1425
+ // (contactName can collide across characters). Only these two
1426
+ // metadata fields are surfaced — the rest of metadata may hold
1427
+ // host-private data and stays server-side. Absent → null.
1428
+ charId: _nullishCoalesce(_optionalChain([decrypted, 'access', _7 => _7.metadata, 'optionalAccess', _8 => _8.charId]), () => ( null)),
1429
+ clientTaskId: _nullishCoalesce(_optionalChain([decrypted, 'access', _9 => _9.metadata, 'optionalAccess', _10 => _10.amsgClientTaskId]), () => ( null))
1420
1430
  };
1421
1431
  }));
1422
1432
  const responsePayload = {
@@ -2082,7 +2092,7 @@ function createClientStateHandler(ctx) {
2082
2092
  }
2083
2093
 
2084
2094
  // src/server/lib/version.js
2085
- var SERVER_VERSION = true ? "2.6.0-next.4" : "0.0.0-dev";
2095
+ var SERVER_VERSION = true ? "2.6.0-next.5" : "0.0.0-dev";
2086
2096
 
2087
2097
  // src/server/handlers/capabilities.js
2088
2098
  var SERVER_FEATURES = Object.freeze([
@@ -1009,7 +1009,7 @@ async function resolveClientStateEntries(rows, fetchChunkRows, decryptValue) {
1009
1009
  * When the host configures fire-time hooks, an LLM task stops replaying
1010
1010
  * the completePrompt frozen at schedule time. At fire time instead:
1011
1011
  *
1012
- * onBeforeFire(fireCtx) → fresh messages (may read client_state)
1012
+ * onBeforeFire(fireCtx) → fresh messages (may read client_state) | { skip: true }
1013
1013
  * → callLlm → onLLMOutput(sessionCtx) → decision
1014
1014
  * ├─ 'finish' → push decision.pushPayloads, done
1015
1015
  * ├─ 'skip-push' → record, done (task counts as delivered)
@@ -1100,7 +1100,7 @@ function normalizeBeforeFireResult(result) {
1100
1100
  };
1101
1101
  }
1102
1102
  throw new TypeError(
1103
- 'AGENTIC_BAD_BEFORE_FIRE: onBeforeFire must return ChatMessage[] | { messages, maxToolIterations?, totalTimeoutMs? } | null'
1103
+ 'AGENTIC_BAD_BEFORE_FIRE: onBeforeFire must return ChatMessage[] | { messages, maxToolIterations?, totalTimeoutMs? } | { skip: true } | null'
1104
1104
  );
1105
1105
  }
1106
1106
 
@@ -1127,7 +1127,11 @@ function firstPositiveNumber(values, fallback) {
1127
1127
  * @param {string} args.userKey - per-user storage key (for readState decryption)
1128
1128
  * @param {Object} args.ctx - processor ctx ({ db, webpush, vapid, hooks, maxToolIterations, totalTimeoutMs })
1129
1129
  * @returns {Promise<{ handled: false } | { handled: true, result: { success: true, messagesSent: number, status: 'finished'|'skipped', iterations: number } }>}
1130
- * `handled: false` → caller falls back to the legacy frozen-prompt path.
1130
+ * `handled: false` → caller falls back to the legacy frozen-prompt path
1131
+ * (onBeforeFire returned null).
1132
+ * `onBeforeFire` may also return `{ skip: true }` to complete the fire
1133
+ * before the first LLM call → `status: 'skipped', iterations: 0`, same
1134
+ * success handling as the post-LLM skip-push path.
1131
1135
  * Failures (timeout / loop exceeded / config errors) throw — the caller's
1132
1136
  * existing error handling turns them into task retry/failure.
1133
1137
  */
@@ -1173,6 +1177,14 @@ async function runAgenticFire({ task, decryptedPayload, userKey, ctx }) {
1173
1177
  const before = await hooks.onBeforeFire(fireCtx);
1174
1178
  if (before == null) return { handled: false };
1175
1179
 
1180
+ // Pre-LLM skip: the host judged this fire moot before generation (e.g. the
1181
+ // conversation moved on after the task was scheduled). Shaped exactly like
1182
+ // the post-LLM 'skipped' result, so run-tick's success handling (delete
1183
+ // once-off / advance recurrence) applies unchanged — and zero tokens spent.
1184
+ if (typeof before === 'object' && before.skip === true) {
1185
+ return { handled: true, result: { success: true, messagesSent: 0, status: 'skipped', iterations: 0 } };
1186
+ }
1187
+
1176
1188
  const normalized = normalizeBeforeFireResult(before);
1177
1189
  const maxToolIterations = firstPositiveInt(
1178
1190
  [normalized.maxToolIterations, ctx.maxToolIterations],
@@ -1410,7 +1422,9 @@ async function processSingleMessage(task, ctx, providedMasterKey) {
1410
1422
  // needs the LLM, offer the agentic path first. onBeforeFire → null
1411
1423
  // falls straight through to the frozen-prompt chain below, and
1412
1424
  // deployments without hooks never enter this branch — legacy behavior
1413
- // is byte-identical.
1425
+ // is byte-identical. onBeforeFire → { skip: true } completes the fire
1426
+ // here as a zero-push success (no LLM call, no frozen-prompt fallback):
1427
+ // use it when the host can tell at fire time the message is moot.
1414
1428
  if (ctx.hooks && typeof ctx.hooks.onBeforeFire === 'function' && taskNeedsLlm(decryptedPayload)) {
1415
1429
  const agentic = await runAgenticFire({ task, decryptedPayload, userKey, ctx });
1416
1430
  if (agentic.handled) return agentic.result;
@@ -2302,7 +2316,14 @@ function createMessagesHandler(ctx) {
2302
2316
  status: task.status,
2303
2317
  retryCount: task.retry_count,
2304
2318
  createdAt: task.created_at,
2305
- updatedAt: task.updated_at
2319
+ updatedAt: task.updated_at,
2320
+ // Character ownership / client-side task identity, pulled from the
2321
+ // scheduling host's metadata so it can filter tasks by character
2322
+ // (contactName can collide across characters). Only these two
2323
+ // metadata fields are surfaced — the rest of metadata may hold
2324
+ // host-private data and stays server-side. Absent → null.
2325
+ charId: decrypted.metadata?.charId ?? null,
2326
+ clientTaskId: decrypted.metadata?.amsgClientTaskId ?? null
2306
2327
  };
2307
2328
  }));
2308
2329
 
@@ -1009,7 +1009,7 @@ async function resolveClientStateEntries(rows, fetchChunkRows, decryptValue) {
1009
1009
  * When the host configures fire-time hooks, an LLM task stops replaying
1010
1010
  * the completePrompt frozen at schedule time. At fire time instead:
1011
1011
  *
1012
- * onBeforeFire(fireCtx) → fresh messages (may read client_state)
1012
+ * onBeforeFire(fireCtx) → fresh messages (may read client_state) | { skip: true }
1013
1013
  * → callLlm → onLLMOutput(sessionCtx) → decision
1014
1014
  * ├─ 'finish' → push decision.pushPayloads, done
1015
1015
  * ├─ 'skip-push' → record, done (task counts as delivered)
@@ -1100,7 +1100,7 @@ function normalizeBeforeFireResult(result) {
1100
1100
  };
1101
1101
  }
1102
1102
  throw new TypeError(
1103
- 'AGENTIC_BAD_BEFORE_FIRE: onBeforeFire must return ChatMessage[] | { messages, maxToolIterations?, totalTimeoutMs? } | null'
1103
+ 'AGENTIC_BAD_BEFORE_FIRE: onBeforeFire must return ChatMessage[] | { messages, maxToolIterations?, totalTimeoutMs? } | { skip: true } | null'
1104
1104
  );
1105
1105
  }
1106
1106
 
@@ -1127,7 +1127,11 @@ function firstPositiveNumber(values, fallback) {
1127
1127
  * @param {string} args.userKey - per-user storage key (for readState decryption)
1128
1128
  * @param {Object} args.ctx - processor ctx ({ db, webpush, vapid, hooks, maxToolIterations, totalTimeoutMs })
1129
1129
  * @returns {Promise<{ handled: false } | { handled: true, result: { success: true, messagesSent: number, status: 'finished'|'skipped', iterations: number } }>}
1130
- * `handled: false` → caller falls back to the legacy frozen-prompt path.
1130
+ * `handled: false` → caller falls back to the legacy frozen-prompt path
1131
+ * (onBeforeFire returned null).
1132
+ * `onBeforeFire` may also return `{ skip: true }` to complete the fire
1133
+ * before the first LLM call → `status: 'skipped', iterations: 0`, same
1134
+ * success handling as the post-LLM skip-push path.
1131
1135
  * Failures (timeout / loop exceeded / config errors) throw — the caller's
1132
1136
  * existing error handling turns them into task retry/failure.
1133
1137
  */
@@ -1173,6 +1177,14 @@ async function runAgenticFire({ task, decryptedPayload, userKey, ctx }) {
1173
1177
  const before = await hooks.onBeforeFire(fireCtx);
1174
1178
  if (before == null) return { handled: false };
1175
1179
 
1180
+ // Pre-LLM skip: the host judged this fire moot before generation (e.g. the
1181
+ // conversation moved on after the task was scheduled). Shaped exactly like
1182
+ // the post-LLM 'skipped' result, so run-tick's success handling (delete
1183
+ // once-off / advance recurrence) applies unchanged — and zero tokens spent.
1184
+ if (typeof before === 'object' && before.skip === true) {
1185
+ return { handled: true, result: { success: true, messagesSent: 0, status: 'skipped', iterations: 0 } };
1186
+ }
1187
+
1176
1188
  const normalized = normalizeBeforeFireResult(before);
1177
1189
  const maxToolIterations = firstPositiveInt(
1178
1190
  [normalized.maxToolIterations, ctx.maxToolIterations],
@@ -1410,7 +1422,9 @@ async function processSingleMessage(task, ctx, providedMasterKey) {
1410
1422
  // needs the LLM, offer the agentic path first. onBeforeFire → null
1411
1423
  // falls straight through to the frozen-prompt chain below, and
1412
1424
  // deployments without hooks never enter this branch — legacy behavior
1413
- // is byte-identical.
1425
+ // is byte-identical. onBeforeFire → { skip: true } completes the fire
1426
+ // here as a zero-push success (no LLM call, no frozen-prompt fallback):
1427
+ // use it when the host can tell at fire time the message is moot.
1414
1428
  if (ctx.hooks && typeof ctx.hooks.onBeforeFire === 'function' && taskNeedsLlm(decryptedPayload)) {
1415
1429
  const agentic = await runAgenticFire({ task, decryptedPayload, userKey, ctx });
1416
1430
  if (agentic.handled) return agentic.result;
@@ -2302,7 +2316,14 @@ function createMessagesHandler(ctx) {
2302
2316
  status: task.status,
2303
2317
  retryCount: task.retry_count,
2304
2318
  createdAt: task.created_at,
2305
- updatedAt: task.updated_at
2319
+ updatedAt: task.updated_at,
2320
+ // Character ownership / client-side task identity, pulled from the
2321
+ // scheduling host's metadata so it can filter tasks by character
2322
+ // (contactName can collide across characters). Only these two
2323
+ // metadata fields are surfaced — the rest of metadata may hold
2324
+ // host-private data and stays server-side. Absent → null.
2325
+ charId: decrypted.metadata?.charId ?? null,
2326
+ clientTaskId: decrypted.metadata?.amsgClientTaskId ?? null
2306
2327
  };
2307
2328
  }));
2308
2329
 
@@ -8,7 +8,7 @@
8
8
 
9
9
 
10
10
 
11
- var _chunkREX5MCEZcjs = require('./chunk-REX5MCEZ.cjs');
11
+ var _chunkIFI4EWDWcjs = require('./chunk-IFI4EWDW.cjs');
12
12
 
13
13
 
14
14
 
@@ -19,4 +19,4 @@ var _chunkREX5MCEZcjs = require('./chunk-REX5MCEZ.cjs');
19
19
 
20
20
 
21
21
 
22
- exports.createD1Adapter = _chunkREX5MCEZcjs.createD1Adapter; exports.createSingleUserCloudflareWorker = _chunkREX5MCEZcjs.createSingleUserCloudflareWorker; exports.createSingleUserServer = _chunkREX5MCEZcjs.createSingleUserServer; exports.createWebCryptoWebPush = _chunkREX5MCEZcjs.createWebCryptoWebPush; exports.decryptFromStorage = _chunkREX5MCEZcjs.decryptFromStorage; exports.decryptPayload = _chunkREX5MCEZcjs.decryptPayload; exports.deriveUserEncryptionKey = _chunkREX5MCEZcjs.deriveUserEncryptionKey; exports.encryptForStorage = _chunkREX5MCEZcjs.encryptForStorage; exports.runScheduledTick = _chunkREX5MCEZcjs.runScheduledTick;
22
+ exports.createD1Adapter = _chunkIFI4EWDWcjs.createD1Adapter; exports.createSingleUserCloudflareWorker = _chunkIFI4EWDWcjs.createSingleUserCloudflareWorker; exports.createSingleUserServer = _chunkIFI4EWDWcjs.createSingleUserServer; exports.createWebCryptoWebPush = _chunkIFI4EWDWcjs.createWebCryptoWebPush; exports.decryptFromStorage = _chunkIFI4EWDWcjs.decryptFromStorage; exports.decryptPayload = _chunkIFI4EWDWcjs.decryptPayload; exports.deriveUserEncryptionKey = _chunkIFI4EWDWcjs.deriveUserEncryptionKey; exports.encryptForStorage = _chunkIFI4EWDWcjs.encryptForStorage; exports.runScheduledTick = _chunkIFI4EWDWcjs.runScheduledTick;
@@ -1,2 +1,2 @@
1
- export { f as createD1Adapter, h as createSingleUserCloudflareWorker, j as createSingleUserServer, k as createWebCryptoWebPush, l as decryptFromStorage, m as decryptPayload, n as deriveUserEncryptionKey, o as encryptForStorage, r as runScheduledTick } from './cloudflare-sVIPkSsf.cjs';
1
+ export { f as createD1Adapter, h as createSingleUserCloudflareWorker, j as createSingleUserServer, k as createWebCryptoWebPush, l as decryptFromStorage, m as decryptPayload, n as deriveUserEncryptionKey, o as encryptForStorage, r as runScheduledTick } from './cloudflare-DM_Njij8.cjs';
2
2
  import '@rei-standard/amsg-shared';
@@ -1,2 +1,2 @@
1
- export { f as createD1Adapter, h as createSingleUserCloudflareWorker, j as createSingleUserServer, k as createWebCryptoWebPush, l as decryptFromStorage, m as decryptPayload, n as deriveUserEncryptionKey, o as encryptForStorage, r as runScheduledTick } from './cloudflare-sVIPkSsf.js';
1
+ export { f as createD1Adapter, h as createSingleUserCloudflareWorker, j as createSingleUserServer, k as createWebCryptoWebPush, l as decryptFromStorage, m as decryptPayload, n as deriveUserEncryptionKey, o as encryptForStorage, r as runScheduledTick } from './cloudflare-DM_Njij8.js';
2
2
  import '@rei-standard/amsg-shared';
@@ -8,7 +8,7 @@ import {
8
8
  deriveUserEncryptionKey,
9
9
  encryptForStorage,
10
10
  runScheduledTick
11
- } from "./chunk-OVGQHTSE.mjs";
11
+ } from "./chunk-ES2HUXYZ.mjs";
12
12
  export {
13
13
  createD1Adapter,
14
14
  createSingleUserCloudflareWorker,
package/dist/index.cjs CHANGED
@@ -23,7 +23,7 @@
23
23
 
24
24
 
25
25
 
26
- var _chunkREX5MCEZcjs = require('./chunk-REX5MCEZ.cjs');
26
+ var _chunkIFI4EWDWcjs = require('./chunk-IFI4EWDW.cjs');
27
27
 
28
28
  // src/server/adapters/factory.js
29
29
  async function createAdapter(config) {
@@ -56,7 +56,7 @@ async function createAdapter(config) {
56
56
  // src/server/handlers/init-tenant.js
57
57
  function createInitTenantHandler(ctx) {
58
58
  async function POST(headers, body) {
59
- const initSecret = _chunkREX5MCEZcjs.getHeader.call(void 0, headers, "x-init-secret");
59
+ const initSecret = _chunkIFI4EWDWcjs.getHeader.call(void 0, headers, "x-init-secret");
60
60
  if (ctx.tenant.initSecret && initSecret !== ctx.tenant.initSecret) {
61
61
  return {
62
62
  status: 401,
@@ -69,7 +69,7 @@ function createInitTenantHandler(ctx) {
69
69
  }
70
70
  };
71
71
  }
72
- const parsed = _chunkREX5MCEZcjs.parseJsonBody.call(void 0, body);
72
+ const parsed = _chunkIFI4EWDWcjs.parseJsonBody.call(void 0, body);
73
73
  if (!parsed.ok) {
74
74
  return {
75
75
  status: 400,
@@ -83,7 +83,7 @@ function createInitTenantHandler(ctx) {
83
83
  const tenantId = payload.tenantId || void 0;
84
84
  const driver = payload.driver;
85
85
  const databaseUrl = payload.databaseUrl || payload.connectionString;
86
- if (tenantId && !_chunkREX5MCEZcjs.isValidUUIDv4.call(void 0, tenantId)) {
86
+ if (tenantId && !_chunkIFI4EWDWcjs.isValidUUIDv4.call(void 0, tenantId)) {
87
87
  return {
88
88
  status: 400,
89
89
  body: {
@@ -203,7 +203,7 @@ function createSendNotificationsHandler(ctx) {
203
203
  }
204
204
  };
205
205
  }
206
- const data = await _chunkREX5MCEZcjs.runScheduledTick.call(void 0, { ...ctx, db, masterKey });
206
+ const data = await _chunkIFI4EWDWcjs.runScheduledTick.call(void 0, { ...ctx, db, masterKey });
207
207
  return { status: 200, body: { success: true, data } };
208
208
  }
209
209
  return { POST };
@@ -575,12 +575,12 @@ async function createReiServer(config) {
575
575
  return {
576
576
  handlers: {
577
577
  initTenant: createInitTenantHandler(ctx),
578
- getUserKey: _chunkREX5MCEZcjs.createGetUserKeyHandler.call(void 0, ctx),
579
- scheduleMessage: _chunkREX5MCEZcjs.createScheduleMessageHandler.call(void 0, ctx),
578
+ getUserKey: _chunkIFI4EWDWcjs.createGetUserKeyHandler.call(void 0, ctx),
579
+ scheduleMessage: _chunkIFI4EWDWcjs.createScheduleMessageHandler.call(void 0, ctx),
580
580
  sendNotifications: createSendNotificationsHandler(ctx),
581
- updateMessage: _chunkREX5MCEZcjs.createUpdateMessageHandler.call(void 0, ctx),
582
- cancelMessage: _chunkREX5MCEZcjs.createCancelMessageHandler.call(void 0, ctx),
583
- messages: _chunkREX5MCEZcjs.createMessagesHandler.call(void 0, ctx)
581
+ updateMessage: _chunkIFI4EWDWcjs.createUpdateMessageHandler.call(void 0, ctx),
582
+ cancelMessage: _chunkIFI4EWDWcjs.createCancelMessageHandler.call(void 0, ctx),
583
+ messages: _chunkIFI4EWDWcjs.createMessagesHandler.call(void 0, ctx)
584
584
  }
585
585
  };
586
586
  }
@@ -606,4 +606,4 @@ async function createReiServer(config) {
606
606
 
607
607
 
608
608
 
609
- exports.createAdapter = createAdapter; exports.createD1Adapter = _chunkREX5MCEZcjs.createD1Adapter; exports.createReiServer = createReiServer; exports.createSingleUserCloudflareWorker = _chunkREX5MCEZcjs.createSingleUserCloudflareWorker; exports.createSingleUserServer = _chunkREX5MCEZcjs.createSingleUserServer; exports.createTenantToken = createTenantToken; exports.createWebCryptoWebPush = _chunkREX5MCEZcjs.createWebCryptoWebPush; exports.decryptFromStorage = _chunkREX5MCEZcjs.decryptFromStorage; exports.decryptPayload = _chunkREX5MCEZcjs.decryptPayload; exports.deriveUserEncryptionKey = _chunkREX5MCEZcjs.deriveUserEncryptionKey; exports.encryptForStorage = _chunkREX5MCEZcjs.encryptForStorage; exports.isValidISO8601 = _chunkREX5MCEZcjs.isValidISO8601; exports.isValidUUID = _chunkREX5MCEZcjs.isValidUUID; exports.isValidUUIDv4 = _chunkREX5MCEZcjs.isValidUUIDv4; exports.isValidUrl = _chunkREX5MCEZcjs.isValidUrl; exports.runScheduledTick = _chunkREX5MCEZcjs.runScheduledTick; exports.validateAvatarUrl = _chunkREX5MCEZcjs.validateAvatarUrl; exports.validateLlmMessagesArray = _chunkREX5MCEZcjs.validateLlmMessagesArray; exports.validateScheduleMessagePayload = _chunkREX5MCEZcjs.validateScheduleMessagePayload; exports.validateSplitPattern = _chunkREX5MCEZcjs.validateSplitPattern; exports.verifyTenantToken = verifyTenantToken;
609
+ exports.createAdapter = createAdapter; exports.createD1Adapter = _chunkIFI4EWDWcjs.createD1Adapter; exports.createReiServer = createReiServer; exports.createSingleUserCloudflareWorker = _chunkIFI4EWDWcjs.createSingleUserCloudflareWorker; exports.createSingleUserServer = _chunkIFI4EWDWcjs.createSingleUserServer; exports.createTenantToken = createTenantToken; exports.createWebCryptoWebPush = _chunkIFI4EWDWcjs.createWebCryptoWebPush; exports.decryptFromStorage = _chunkIFI4EWDWcjs.decryptFromStorage; exports.decryptPayload = _chunkIFI4EWDWcjs.decryptPayload; exports.deriveUserEncryptionKey = _chunkIFI4EWDWcjs.deriveUserEncryptionKey; exports.encryptForStorage = _chunkIFI4EWDWcjs.encryptForStorage; exports.isValidISO8601 = _chunkIFI4EWDWcjs.isValidISO8601; exports.isValidUUID = _chunkIFI4EWDWcjs.isValidUUID; exports.isValidUUIDv4 = _chunkIFI4EWDWcjs.isValidUUIDv4; exports.isValidUrl = _chunkIFI4EWDWcjs.isValidUrl; exports.runScheduledTick = _chunkIFI4EWDWcjs.runScheduledTick; exports.validateAvatarUrl = _chunkIFI4EWDWcjs.validateAvatarUrl; exports.validateLlmMessagesArray = _chunkIFI4EWDWcjs.validateLlmMessagesArray; exports.validateScheduleMessagePayload = _chunkIFI4EWDWcjs.validateScheduleMessagePayload; exports.validateSplitPattern = _chunkIFI4EWDWcjs.validateSplitPattern; exports.verifyTenantToken = verifyTenantToken;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { g as getHeader, p as parseJsonBody, i as isValidUUIDv4, r as runScheduledTick, c as createMessagesHandler, a as createCancelMessageHandler, b as createUpdateMessageHandler, d as createScheduleMessageHandler, e as createGetUserKeyHandler } from './cloudflare-sVIPkSsf.cjs';
2
- export { f as createD1Adapter, h as createSingleUserCloudflareWorker, j as createSingleUserServer, k as createWebCryptoWebPush, l as decryptFromStorage, m as decryptPayload, n as deriveUserEncryptionKey, o as encryptForStorage, q as isValidISO8601, s as isValidUUID, t as isValidUrl, v as validateLlmMessagesArray, u as validateScheduleMessagePayload, w as validateSplitPattern } from './cloudflare-sVIPkSsf.cjs';
1
+ import { g as getHeader, p as parseJsonBody, i as isValidUUIDv4, r as runScheduledTick, c as createMessagesHandler, a as createCancelMessageHandler, b as createUpdateMessageHandler, d as createScheduleMessageHandler, e as createGetUserKeyHandler } from './cloudflare-DM_Njij8.cjs';
2
+ export { f as createD1Adapter, h as createSingleUserCloudflareWorker, j as createSingleUserServer, k as createWebCryptoWebPush, l as decryptFromStorage, m as decryptPayload, n as deriveUserEncryptionKey, o as encryptForStorage, q as isValidISO8601, s as isValidUUID, t as isValidUrl, v as validateLlmMessagesArray, u as validateScheduleMessagePayload, w as validateSplitPattern } from './cloudflare-DM_Njij8.cjs';
3
3
  import { createHash, randomBytes, createCipheriv, createDecipheriv, timingSafeEqual, createHmac, randomUUID } from 'crypto';
4
4
  import { normalizeVapidSubject } from '@rei-standard/amsg-shared';
5
5
  export { validateAvatarUrl } from '@rei-standard/amsg-shared';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { g as getHeader, p as parseJsonBody, i as isValidUUIDv4, r as runScheduledTick, c as createMessagesHandler, a as createCancelMessageHandler, b as createUpdateMessageHandler, d as createScheduleMessageHandler, e as createGetUserKeyHandler } from './cloudflare-sVIPkSsf.js';
2
- export { f as createD1Adapter, h as createSingleUserCloudflareWorker, j as createSingleUserServer, k as createWebCryptoWebPush, l as decryptFromStorage, m as decryptPayload, n as deriveUserEncryptionKey, o as encryptForStorage, q as isValidISO8601, s as isValidUUID, t as isValidUrl, v as validateLlmMessagesArray, u as validateScheduleMessagePayload, w as validateSplitPattern } from './cloudflare-sVIPkSsf.js';
1
+ import { g as getHeader, p as parseJsonBody, i as isValidUUIDv4, r as runScheduledTick, c as createMessagesHandler, a as createCancelMessageHandler, b as createUpdateMessageHandler, d as createScheduleMessageHandler, e as createGetUserKeyHandler } from './cloudflare-DM_Njij8.js';
2
+ export { f as createD1Adapter, h as createSingleUserCloudflareWorker, j as createSingleUserServer, k as createWebCryptoWebPush, l as decryptFromStorage, m as decryptPayload, n as deriveUserEncryptionKey, o as encryptForStorage, q as isValidISO8601, s as isValidUUID, t as isValidUrl, v as validateLlmMessagesArray, u as validateScheduleMessagePayload, w as validateSplitPattern } from './cloudflare-DM_Njij8.js';
3
3
  import { createHash, randomBytes, createCipheriv, createDecipheriv, timingSafeEqual, createHmac, randomUUID } from 'crypto';
4
4
  import { normalizeVapidSubject } from '@rei-standard/amsg-shared';
5
5
  export { validateAvatarUrl } from '@rei-standard/amsg-shared';
package/dist/index.mjs CHANGED
@@ -23,7 +23,7 @@ import {
23
23
  validateLlmMessagesArray,
24
24
  validateScheduleMessagePayload,
25
25
  validateSplitPattern
26
- } from "./chunk-OVGQHTSE.mjs";
26
+ } from "./chunk-ES2HUXYZ.mjs";
27
27
 
28
28
  // src/server/adapters/factory.js
29
29
  async function createAdapter(config) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rei-standard/amsg-server",
3
- "version": "2.6.0-next.4",
3
+ "version": "2.6.0-next.5",
4
4
  "description": "ReiStandard Active Messaging server SDK with pluggable database adapters. Three-axis push schema (messageKind / messageType / messageSubtype) from @rei-standard/amsg-shared. Auto-emits ReasoningPush when the LLM response carries reasoning_content.",
5
5
  "repository": {
6
6
  "type": "git",