@sentry/junior 0.94.0 → 0.96.0

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 (127) hide show
  1. package/dist/{agent-hooks-ZG7IDOIN.js → agent-hooks-5URSMY3O.js} +10 -11
  2. package/dist/api/people/list.js +8 -8
  3. package/dist/api/people/profile.js +8 -8
  4. package/dist/api/people/shared.d.ts +2 -2
  5. package/dist/api-reference.d.ts +2 -2
  6. package/dist/app.js +434 -199
  7. package/dist/{catalog-runtime-NZHMSMYC.js → catalog-runtime-MSMAYYIK.js} +4 -4
  8. package/dist/chat/advisor-request.d.ts +4 -0
  9. package/dist/chat/agent/request.d.ts +2 -0
  10. package/dist/chat/agent/resume.d.ts +2 -0
  11. package/dist/chat/conversations/history.d.ts +128 -0
  12. package/dist/chat/conversations/legacy-import.d.ts +38 -0
  13. package/dist/chat/conversations/messages.d.ts +39 -0
  14. package/dist/chat/conversations/projection.d.ts +94 -0
  15. package/dist/chat/conversations/retention.d.ts +36 -0
  16. package/dist/chat/conversations/sql/conversation-row.d.ts +14 -0
  17. package/dist/chat/conversations/sql/history.d.ts +4 -0
  18. package/dist/chat/conversations/sql/legacy-history-import.d.ts +55 -0
  19. package/dist/chat/conversations/sql/messages.d.ts +4 -0
  20. package/dist/chat/conversations/sql/migrations.d.ts +14 -3
  21. package/dist/chat/conversations/sql/purge.d.ts +53 -0
  22. package/dist/chat/conversations/sql/store.d.ts +7 -2
  23. package/dist/chat/conversations/store.d.ts +19 -0
  24. package/dist/chat/conversations/visible-compactions.d.ts +11 -0
  25. package/dist/chat/conversations/visible-messages.d.ts +47 -0
  26. package/dist/chat/db.d.ts +12 -1
  27. package/dist/chat/identities/sql.d.ts +1 -1
  28. package/dist/chat/logging.d.ts +4 -3
  29. package/dist/chat/plugins/auth/oauth-request.d.ts +2 -0
  30. package/dist/chat/resource-events/notification.d.ts +2 -0
  31. package/dist/chat/resource-events/store.d.ts +2 -1
  32. package/dist/chat/runtime/agent-run-outcome.d.ts +3 -0
  33. package/dist/chat/runtime/reply-executor.d.ts +8 -0
  34. package/dist/chat/runtime/thread-state.d.ts +2 -0
  35. package/dist/chat/sandbox/resources.d.ts +4 -0
  36. package/dist/chat/sentry.d.ts +1 -1
  37. package/dist/chat/services/mcp-auth-orchestration.d.ts +8 -0
  38. package/dist/chat/services/plugin-auth-orchestration.d.ts +12 -0
  39. package/dist/chat/services/turn-session-record.d.ts +14 -2
  40. package/dist/chat/sleep.d.ts +2 -0
  41. package/dist/chat/state/conversation.d.ts +7 -4
  42. package/dist/chat/state/session-log.d.ts +23 -1
  43. package/dist/chat/state/turn-session.d.ts +9 -1
  44. package/dist/chat/tool-support/private-trace-result.d.ts +4 -0
  45. package/dist/chat/tool-support/zod-tool.d.ts +1 -0
  46. package/dist/chat/tools/advisor/tool.d.ts +9 -4
  47. package/dist/chat/tools/definition.d.ts +2 -0
  48. package/dist/chat/tools/execution/tool-error-handler.d.ts +2 -2
  49. package/dist/chat/tools/system-time.d.ts +8 -0
  50. package/dist/chat/usage.d.ts +27 -13
  51. package/dist/chat/xml.d.ts +2 -0
  52. package/dist/{chunk-TNUUATT7.js → chunk-2NAZZPPS.js} +2 -2
  53. package/dist/{chunk-NYWPISSO.js → chunk-2XXEKR44.js} +1 -1
  54. package/dist/chunk-5C6XTTFI.js +1037 -0
  55. package/dist/{chunk-3DA7X2U3.js → chunk-6GWA276C.js} +15 -0
  56. package/dist/{chunk-LFLTJQVR.js → chunk-7FBGKXPE.js} +4 -0
  57. package/dist/{chunk-LNCREA5Z.js → chunk-AAZXTVJT.js} +4 -128
  58. package/dist/{chunk-GHGPTPBL.js → chunk-B7PUBQQM.js} +1 -1
  59. package/dist/{chunk-6H4PP63X.js → chunk-BYZWPRJA.js} +24 -14
  60. package/dist/chunk-CM5EZD5F.js +17 -0
  61. package/dist/{chunk-G3E7SCME.js → chunk-CZEX6KIQ.js} +23 -0
  62. package/dist/{chunk-YJ4OPVNA.js → chunk-DZENG5ML.js} +1 -1
  63. package/dist/{chunk-QGEWC27H.js → chunk-GQ3GK22G.js} +5 -7
  64. package/dist/{chunk-YYBX2BD5.js → chunk-GY34VGP5.js} +1 -1
  65. package/dist/{chunk-S6QKIGRM.js → chunk-I35CTGPO.js} +71 -29
  66. package/dist/{chunk-KRMANDHI.js → chunk-IYM2SIVG.js} +1489 -355
  67. package/dist/{chunk-BTH37NCU.js → chunk-L7CDEIVJ.js} +12 -4
  68. package/dist/chunk-MNTINMWR.js +865 -0
  69. package/dist/{chunk-MAVOJ54A.js → chunk-P3YFQLEN.js} +25 -388
  70. package/dist/{chunk-YTNPU7I2.js → chunk-PMNN6ST4.js} +2 -2
  71. package/dist/{chunk-PFXC67GJ.js → chunk-RAIB6WSG.js} +6 -80
  72. package/dist/{chunk-NFXSLTYG.js → chunk-RITD7E5L.js} +864 -62
  73. package/dist/{chunk-UUB3D2XI.js → chunk-S5KZ5LPG.js} +8 -10
  74. package/dist/{chunk-HDNWZMUN.js → chunk-UKHVMPX5.js} +112 -103
  75. package/dist/chunk-WM6KHPBQ.js +48 -0
  76. package/dist/{chunk-MC4ZZE4Q.js → chunk-YDT7SNCN.js} +1 -1
  77. package/dist/{chunk-NAPITCZ6.js → chunk-YDVEH3SB.js} +251 -6
  78. package/dist/cli/chat.js +25 -24
  79. package/dist/cli/check.js +5 -5
  80. package/dist/cli/main.js +1 -1
  81. package/dist/cli/plugins.js +12 -13
  82. package/dist/cli/snapshot-warmup.js +8 -9
  83. package/dist/cli/upgrade.js +79 -18
  84. package/dist/db/schema/agent-steps.d.ts +134 -0
  85. package/dist/db/schema/conversation-messages.d.ts +153 -0
  86. package/dist/{chat/conversations/sql → db}/schema/conversations.d.ts +34 -0
  87. package/dist/{chat/conversations/sql → db}/schema.d.ts +319 -8
  88. package/dist/db-2D6RMG67.js +24 -0
  89. package/dist/deployment.d.ts +2 -0
  90. package/dist/handlers/retention.d.ts +6 -0
  91. package/dist/instrumentation.js +17 -4
  92. package/dist/legacy-import-VZ2MEGP7.js +17 -0
  93. package/dist/nitro.js +14 -4
  94. package/dist/reporting/conversations/activity.d.ts +40 -0
  95. package/dist/reporting/conversations/context.d.ts +8 -0
  96. package/dist/reporting/conversations/details.d.ts +6 -0
  97. package/dist/reporting/conversations/index.d.ts +4 -0
  98. package/dist/reporting/conversations/shared.d.ts +9 -0
  99. package/dist/reporting/conversations/statistics.d.ts +4 -0
  100. package/dist/reporting/conversations/summaries.d.ts +20 -0
  101. package/dist/reporting/conversations/transcript.d.ts +28 -0
  102. package/dist/reporting/conversations/types.d.ts +191 -0
  103. package/dist/reporting/conversations.d.ts +1 -178
  104. package/dist/reporting.d.ts +5 -4
  105. package/dist/reporting.js +703 -837
  106. package/dist/{runner-XAZPJNAQ.js → runner-JZBRQP4F.js} +36 -42
  107. package/dist/{sentry-EGFOV3DH.js → sentry-JMWTS32N.js} +11 -1
  108. package/dist/{validation-KYAWETI4.js → validation-6XOOQGME.js} +5 -5
  109. package/migrations/README.md +32 -0
  110. package/migrations/meta/0000_snapshot.json +978 -0
  111. package/migrations/meta/_journal.json +13 -0
  112. package/package.json +10 -7
  113. package/dist/chat/sql/schema.d.ts +0 -1049
  114. package/dist/chat/state/conversation-details.d.ts +0 -47
  115. package/dist/chunk-7STN2ZSK.js +0 -250
  116. package/dist/chunk-LE5ANBUZ.js +0 -1040
  117. package/dist/chunk-QL66APYJ.js +0 -1377
  118. package/dist/db-YDN6AFJH.js +0 -18
  119. /package/dist/{chat/sql → db}/db.d.ts +0 -0
  120. /package/dist/{chat/sql → db}/executor.d.ts +0 -0
  121. /package/dist/{chat/sql → db}/neon.d.ts +0 -0
  122. /package/dist/{chat/sql → db}/postgres.d.ts +0 -0
  123. /package/dist/{chat/conversations/sql → db}/schema/destinations.d.ts +0 -0
  124. /package/dist/{chat/conversations/sql → db}/schema/identities.d.ts +0 -0
  125. /package/dist/{chat/conversations/sql → db}/schema/migrations.d.ts +0 -0
  126. /package/dist/{chat/conversations/sql → db}/schema/timestamps.d.ts +0 -0
  127. /package/dist/{chat/conversations/sql → db}/schema/users.d.ts +0 -0
@@ -6,7 +6,7 @@ import {
6
6
  toGenAiMessageMetadata,
7
7
  toGenAiMessagesTraceAttributes,
8
8
  toGenAiTextMetadata
9
- } from "./chunk-YYBX2BD5.js";
9
+ } from "./chunk-GY34VGP5.js";
10
10
  import {
11
11
  extractGenAiUsageAttributes,
12
12
  logException,
@@ -14,12 +14,15 @@ import {
14
14
  serializeGenAiAttribute,
15
15
  setSpanAttributes,
16
16
  withSpan
17
- } from "./chunk-S6QKIGRM.js";
17
+ } from "./chunk-I35CTGPO.js";
18
18
 
19
19
  // src/chat/xml.ts
20
20
  function escapeXml(value) {
21
21
  return value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&apos;");
22
22
  }
23
+ function unescapeXml(value) {
24
+ return value.replaceAll("&quot;", '"').replaceAll("&apos;", "'").replaceAll("&gt;", ">").replaceAll("&lt;", "<").replaceAll("&amp;", "&");
25
+ }
23
26
 
24
27
  // src/chat/current-instruction.ts
25
28
  var CURRENT_INSTRUCTION_TAG = "current-instruction";
@@ -28,9 +31,6 @@ var CURRENT_INSTRUCTION_OPEN_BARE = `<${CURRENT_INSTRUCTION_TAG}>`;
28
31
  var CURRENT_INSTRUCTION_OPEN_ATTR_PREFIX = `<${CURRENT_INSTRUCTION_TAG} `;
29
32
  var CURRENT_INSTRUCTION_CLOSE = `
30
33
  </${CURRENT_INSTRUCTION_TAG}>`;
31
- function unescapeXml(value) {
32
- return value.replaceAll("&quot;", '"').replaceAll("&apos;", "'").replaceAll("&gt;", ">").replaceAll("&lt;", "<").replaceAll("&amp;", "&");
33
- }
34
34
  function isCurrentInstructionOpeningTag(value) {
35
35
  return value === CURRENT_INSTRUCTION_OPEN_BARE || value.startsWith(CURRENT_INSTRUCTION_OPEN_ATTR_PREFIX) && value.endsWith(">");
36
36
  }
@@ -795,9 +795,249 @@ function setSlackReactionConfig(overrides) {
795
795
  }
796
796
  }
797
797
 
798
+ // src/chat/state/adapter.ts
799
+ import { createMemoryState } from "@chat-adapter/state-memory";
800
+ import { createRedisState } from "@chat-adapter/state-redis";
801
+
802
+ // src/chat/state/locks.ts
803
+ var ACTIVE_LOCK_TTL_MS = 9e4;
804
+ async function acquireActiveLock(state, threadId) {
805
+ return await state.acquireLock(threadId, ACTIVE_LOCK_TTL_MS);
806
+ }
807
+
808
+ // src/chat/state/adapter.ts
809
+ var ACTIVE_LOCK_HEARTBEAT_MS = 3e4;
810
+ var stateAdapter;
811
+ var redisStateAdapter;
812
+ function createPrefixedStateAdapter(base, prefix) {
813
+ const prefixed = (value) => `${prefix}:${value}`;
814
+ const unprefixed = (value) => value.startsWith(`${prefix}:`) ? value.slice(prefix.length + 1) : value;
815
+ const prefixLock = (lock) => ({
816
+ ...lock,
817
+ threadId: prefixed(lock.threadId)
818
+ });
819
+ const unprefixLock = (lock) => ({
820
+ ...lock,
821
+ threadId: unprefixed(lock.threadId)
822
+ });
823
+ return {
824
+ appendToList: (key, value, options) => base.appendToList(prefixed(key), value, options),
825
+ connect: () => base.connect(),
826
+ disconnect: () => base.disconnect(),
827
+ subscribe: (threadId) => base.subscribe(prefixed(threadId)),
828
+ unsubscribe: (threadId) => base.unsubscribe(prefixed(threadId)),
829
+ isSubscribed: (threadId) => base.isSubscribed(prefixed(threadId)),
830
+ acquireLock: async (threadId, ttlMs) => {
831
+ const lock = await base.acquireLock(prefixed(threadId), ttlMs);
832
+ return lock ? unprefixLock(lock) : null;
833
+ },
834
+ releaseLock: (lock) => base.releaseLock(prefixLock(lock)),
835
+ extendLock: async (lock, ttlMs) => {
836
+ const prefixedLock = prefixLock(lock);
837
+ const extended = await base.extendLock(prefixedLock, ttlMs);
838
+ if (extended) {
839
+ lock.expiresAt = prefixedLock.expiresAt;
840
+ }
841
+ return extended;
842
+ },
843
+ forceReleaseLock: (threadId) => base.forceReleaseLock(prefixed(threadId)),
844
+ enqueue: (threadId, entry, maxSize) => base.enqueue(prefixed(threadId), entry, maxSize),
845
+ dequeue: (threadId) => base.dequeue(prefixed(threadId)),
846
+ queueDepth: (threadId) => base.queueDepth(prefixed(threadId)),
847
+ get: (key) => base.get(prefixed(key)),
848
+ getList: (key) => base.getList(prefixed(key)),
849
+ set: (key, value, ttlMs) => base.set(prefixed(key), value, ttlMs),
850
+ setIfNotExists: (key, value, ttlMs) => base.setIfNotExists(prefixed(key), value, ttlMs),
851
+ delete: (key) => base.delete(prefixed(key))
852
+ };
853
+ }
854
+ function createQueuedStateAdapter(base, options) {
855
+ const heartbeats = /* @__PURE__ */ new Map();
856
+ const shouldHeartbeatLock = (ttlMs) => ttlMs === ACTIVE_LOCK_TTL_MS;
857
+ const heartbeatKey = (lock) => `${lock.threadId}:${lock.token}`;
858
+ const stopHeartbeatByKey = (key) => {
859
+ const heartbeat = heartbeats.get(key);
860
+ if (!heartbeat) {
861
+ return;
862
+ }
863
+ clearInterval(heartbeat.timer);
864
+ heartbeats.delete(key);
865
+ };
866
+ const stopHeartbeat = (lock) => {
867
+ stopHeartbeatByKey(heartbeatKey(lock));
868
+ };
869
+ const stopHeartbeatsForThread = (threadId) => {
870
+ for (const [key, heartbeat] of heartbeats) {
871
+ if (heartbeat.lock.threadId === threadId) {
872
+ stopHeartbeatByKey(key);
873
+ }
874
+ }
875
+ };
876
+ const stopAllHeartbeats = () => {
877
+ for (const key of heartbeats.keys()) {
878
+ stopHeartbeatByKey(key);
879
+ }
880
+ };
881
+ const runHeartbeat = async (key) => {
882
+ const heartbeat = heartbeats.get(key);
883
+ if (!heartbeat || heartbeat.inFlight) {
884
+ return;
885
+ }
886
+ heartbeat.inFlight = true;
887
+ try {
888
+ if (Date.now() - heartbeat.startedAtMs >= options.activeLockMaxAgeMs) {
889
+ stopHeartbeatByKey(key);
890
+ return;
891
+ }
892
+ const extended = await base.extendLock(heartbeat.lock, heartbeat.ttlMs);
893
+ if (!extended) {
894
+ stopHeartbeatByKey(key);
895
+ return;
896
+ }
897
+ heartbeat.lock.expiresAt = Date.now() + heartbeat.ttlMs;
898
+ } catch {
899
+ } finally {
900
+ const current = heartbeats.get(key);
901
+ if (current === heartbeat) {
902
+ current.inFlight = false;
903
+ }
904
+ }
905
+ };
906
+ const startOrUpdateHeartbeat = (lock, ttlMs) => {
907
+ const key = heartbeatKey(lock);
908
+ const existing = heartbeats.get(key);
909
+ if (existing) {
910
+ existing.ttlMs = ttlMs;
911
+ return;
912
+ }
913
+ const timer = setInterval(() => {
914
+ void runHeartbeat(key);
915
+ }, ACTIVE_LOCK_HEARTBEAT_MS);
916
+ timer.unref?.();
917
+ heartbeats.set(key, {
918
+ inFlight: false,
919
+ lock,
920
+ startedAtMs: Date.now(),
921
+ timer,
922
+ ttlMs
923
+ });
924
+ };
925
+ const acquireLock = async (threadId, ttlMs) => {
926
+ const lock = await base.acquireLock(threadId, ttlMs);
927
+ if (lock && shouldHeartbeatLock(ttlMs)) {
928
+ startOrUpdateHeartbeat(lock, ttlMs);
929
+ }
930
+ return lock;
931
+ };
932
+ return {
933
+ appendToList: (key, value, options2) => base.appendToList(key, value, options2),
934
+ connect: () => base.connect(),
935
+ disconnect: async () => {
936
+ stopAllHeartbeats();
937
+ await base.disconnect();
938
+ },
939
+ subscribe: (threadId) => base.subscribe(threadId),
940
+ unsubscribe: (threadId) => base.unsubscribe(threadId),
941
+ isSubscribed: (threadId) => base.isSubscribed(threadId),
942
+ acquireLock,
943
+ releaseLock: async (lock) => {
944
+ stopHeartbeat(lock);
945
+ await base.releaseLock(lock);
946
+ },
947
+ extendLock: async (lock, ttlMs) => {
948
+ const extended = await base.extendLock(lock, ttlMs);
949
+ if (extended) {
950
+ lock.expiresAt = Date.now() + ttlMs;
951
+ if (shouldHeartbeatLock(ttlMs)) {
952
+ startOrUpdateHeartbeat(lock, ttlMs);
953
+ } else {
954
+ stopHeartbeat(lock);
955
+ }
956
+ } else {
957
+ stopHeartbeat(lock);
958
+ }
959
+ return extended;
960
+ },
961
+ forceReleaseLock: async (threadId) => {
962
+ stopHeartbeatsForThread(threadId);
963
+ await base.forceReleaseLock(threadId);
964
+ },
965
+ enqueue: (threadId, entry, maxSize) => base.enqueue(threadId, entry, maxSize),
966
+ dequeue: (threadId) => base.dequeue(threadId),
967
+ queueDepth: (threadId) => base.queueDepth(threadId),
968
+ get: (key) => base.get(key),
969
+ getList: (key) => base.getList(key),
970
+ set: (key, value, ttlMs) => base.set(key, value, ttlMs),
971
+ setIfNotExists: (key, value, ttlMs) => base.setIfNotExists(key, value, ttlMs),
972
+ delete: (key) => base.delete(key)
973
+ };
974
+ }
975
+ function withOptionalPrefix(base, prefix) {
976
+ return prefix ? createPrefixedStateAdapter(base, prefix) : base;
977
+ }
978
+ function createStateAdapter() {
979
+ const config = getChatConfig();
980
+ const activeLockMaxAgeMs = config.bot.turnTimeoutMs + ACTIVE_LOCK_TTL_MS;
981
+ if (config.state.adapter === "memory") {
982
+ redisStateAdapter = void 0;
983
+ return createQueuedStateAdapter(
984
+ withOptionalPrefix(createMemoryState(), config.state.keyPrefix),
985
+ { activeLockMaxAgeMs }
986
+ );
987
+ }
988
+ if (!config.state.redisUrl) {
989
+ throw new Error("REDIS_URL is required for durable Slack thread state");
990
+ }
991
+ const redisState = createRedisState({
992
+ url: config.state.redisUrl
993
+ });
994
+ redisStateAdapter = redisState;
995
+ return createQueuedStateAdapter(
996
+ withOptionalPrefix(redisState, config.state.keyPrefix),
997
+ { activeLockMaxAgeMs }
998
+ );
999
+ }
1000
+ function getOptionalRedisStateAdapter() {
1001
+ getStateAdapter();
1002
+ return redisStateAdapter;
1003
+ }
1004
+ async function getConnectedStateContext() {
1005
+ const adapter = getStateAdapter();
1006
+ await adapter.connect();
1007
+ return {
1008
+ redisStateAdapter: getOptionalRedisStateAdapter(),
1009
+ stateAdapter: adapter
1010
+ };
1011
+ }
1012
+ async function getDefaultRedisStateAdapterFor(adapter) {
1013
+ if (adapter !== stateAdapter) {
1014
+ return void 0;
1015
+ }
1016
+ const context = await getConnectedStateContext();
1017
+ return context.stateAdapter === adapter ? context.redisStateAdapter : void 0;
1018
+ }
1019
+ function getStateAdapter() {
1020
+ if (!stateAdapter) {
1021
+ stateAdapter = createStateAdapter();
1022
+ }
1023
+ return stateAdapter;
1024
+ }
1025
+ async function disconnectStateAdapter() {
1026
+ if (!stateAdapter) {
1027
+ return;
1028
+ }
1029
+ try {
1030
+ await stateAdapter.disconnect();
1031
+ } finally {
1032
+ stateAdapter = void 0;
1033
+ redisStateAdapter = void 0;
1034
+ }
1035
+ }
1036
+
798
1037
  export {
799
1038
  toOptionalTrimmed,
800
1039
  escapeXml,
1040
+ unescapeXml,
801
1041
  renderCurrentInstruction,
802
1042
  unwrapCurrentInstruction,
803
1043
  TURN_CONTEXT_TAG,
@@ -834,5 +1074,10 @@ export {
834
1074
  getSlackClientSecret,
835
1075
  getRuntimeMetadata,
836
1076
  getSlackReactionConfig,
837
- setSlackReactionConfig
1077
+ setSlackReactionConfig,
1078
+ acquireActiveLock,
1079
+ getConnectedStateContext,
1080
+ getDefaultRedisStateAdapterFor,
1081
+ getStateAdapter,
1082
+ disconnectStateAdapter
838
1083
  };
package/dist/cli/chat.js CHANGED
@@ -1,30 +1,31 @@
1
1
  import {
2
2
  createAgentRunner,
3
3
  executeAgentRun
4
- } from "../chunk-KRMANDHI.js";
5
- import "../chunk-HDNWZMUN.js";
6
- import "../chunk-PFXC67GJ.js";
7
- import "../chunk-6H4PP63X.js";
8
- import "../chunk-LE5ANBUZ.js";
9
- import "../chunk-QL66APYJ.js";
4
+ } from "../chunk-IYM2SIVG.js";
5
+ import "../chunk-UKHVMPX5.js";
6
+ import "../chunk-RAIB6WSG.js";
7
+ import "../chunk-BYZWPRJA.js";
8
+ import "../chunk-CM5EZD5F.js";
9
+ import "../chunk-WM6KHPBQ.js";
10
+ import "../chunk-MNTINMWR.js";
11
+ import "../chunk-5C6XTTFI.js";
10
12
  import {
11
13
  loadAppPluginSet
12
14
  } from "../chunk-Y2CM7HXH.js";
13
- import "../chunk-UUB3D2XI.js";
14
- import "../chunk-TNUUATT7.js";
15
- import "../chunk-G3E7SCME.js";
16
- import "../chunk-7STN2ZSK.js";
17
- import "../chunk-NFXSLTYG.js";
18
- import "../chunk-NAPITCZ6.js";
19
- import "../chunk-YYBX2BD5.js";
20
- import "../chunk-GHGPTPBL.js";
21
- import "../chunk-YTNPU7I2.js";
22
- import "../chunk-BTH37NCU.js";
23
- import "../chunk-S6QKIGRM.js";
15
+ import "../chunk-S5KZ5LPG.js";
16
+ import "../chunk-2NAZZPPS.js";
17
+ import "../chunk-CZEX6KIQ.js";
18
+ import "../chunk-RITD7E5L.js";
19
+ import "../chunk-YDVEH3SB.js";
20
+ import "../chunk-GY34VGP5.js";
21
+ import "../chunk-B7PUBQQM.js";
22
+ import "../chunk-PMNN6ST4.js";
23
+ import "../chunk-L7CDEIVJ.js";
24
+ import "../chunk-I35CTGPO.js";
24
25
  import "../chunk-OB42YVAE.js";
25
- import "../chunk-3DA7X2U3.js";
26
+ import "../chunk-6GWA276C.js";
26
27
  import "../chunk-6APU57E6.js";
27
- import "../chunk-LFLTJQVR.js";
28
+ import "../chunk-7FBGKXPE.js";
28
29
  import "../chunk-MLKGABMK.js";
29
30
 
30
31
  // src/cli/chat.ts
@@ -147,10 +148,10 @@ async function configureLocalChatPlugins(pluginSet) {
147
148
  databaseModule
148
149
  ] = await Promise.all([
149
150
  import("../plugins-PZMDS7AT.js"),
150
- import("../agent-hooks-ZG7IDOIN.js"),
151
- import("../catalog-runtime-NZHMSMYC.js"),
152
- import("../validation-KYAWETI4.js"),
153
- import("../db-YDN6AFJH.js")
151
+ import("../agent-hooks-5URSMY3O.js"),
152
+ import("../catalog-runtime-MSMAYYIK.js"),
153
+ import("../validation-6XOOQGME.js"),
154
+ import("../db-2D6RMG67.js")
154
155
  ]);
155
156
  const resolvedPluginSet = pluginSet === void 0 ? await loadLocalPluginSet() : pluginSet ?? void 0;
156
157
  const plugins = pluginsModule.pluginRuntimeRegistrationsFromPluginSet(resolvedPluginSet);
@@ -211,7 +212,7 @@ function newRunConversationId() {
211
212
  async function prepareLocalChatRun(io, pluginSet) {
212
213
  defaultStateAdapterForLocalChat();
213
214
  await configureLocalChatPlugins(pluginSet);
214
- const { runLocalAgentTurn } = await import("../runner-XAZPJNAQ.js");
215
+ const { runLocalAgentTurn } = await import("../runner-JZBRQP4F.js");
215
216
  const deps = {
216
217
  agentRunner: createAgentRunner(executeAgentRun),
217
218
  deliverReply: async (reply) => {
package/dist/cli/check.js CHANGED
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  parseSkillFile
3
- } from "../chunk-YTNPU7I2.js";
3
+ } from "../chunk-PMNN6ST4.js";
4
4
  import {
5
5
  parseInlinePluginManifest,
6
6
  parsePluginManifest
7
- } from "../chunk-BTH37NCU.js";
8
- import "../chunk-S6QKIGRM.js";
7
+ } from "../chunk-L7CDEIVJ.js";
8
+ import "../chunk-I35CTGPO.js";
9
9
  import "../chunk-OB42YVAE.js";
10
- import "../chunk-3DA7X2U3.js";
10
+ import "../chunk-6GWA276C.js";
11
11
  import "../chunk-6APU57E6.js";
12
12
  import {
13
13
  JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE,
14
14
  JUNIOR_HEARTBEAT_ROUTE,
15
15
  LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION
16
- } from "../chunk-LFLTJQVR.js";
16
+ } from "../chunk-7FBGKXPE.js";
17
17
  import "../chunk-MLKGABMK.js";
18
18
 
19
19
  // src/cli/check.ts
package/dist/cli/main.js CHANGED
@@ -10,7 +10,7 @@ import "../chunk-MLKGABMK.js";
10
10
  import { pathToFileURL } from "url";
11
11
  var SENTRY_FLUSH_TIMEOUT_MS = 2e3;
12
12
  async function flushSentry() {
13
- const mod = await import("../sentry-EGFOV3DH.js");
13
+ const mod = await import("../sentry-JMWTS32N.js");
14
14
  await mod.flush(SENTRY_FLUSH_TIMEOUT_MS);
15
15
  }
16
16
  async function initSentry() {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  validatePluginEgressCredentialHooks,
3
3
  validatePluginRegistrations
4
- } from "../chunk-MC4ZZE4Q.js";
4
+ } from "../chunk-YDT7SNCN.js";
5
5
  import {
6
6
  pluginCatalogConfigFromPluginSet,
7
7
  pluginCliRegistrationsFromPluginSet,
@@ -13,26 +13,25 @@ import {
13
13
  import {
14
14
  setPlugins,
15
15
  validatePlugins
16
- } from "../chunk-UUB3D2XI.js";
16
+ } from "../chunk-S5KZ5LPG.js";
17
17
  import {
18
18
  createPluginLogger
19
- } from "../chunk-TNUUATT7.js";
20
- import "../chunk-G3E7SCME.js";
21
- import "../chunk-7STN2ZSK.js";
19
+ } from "../chunk-2NAZZPPS.js";
20
+ import "../chunk-CZEX6KIQ.js";
22
21
  import {
23
22
  getDb
24
- } from "../chunk-NFXSLTYG.js";
25
- import "../chunk-NAPITCZ6.js";
26
- import "../chunk-YYBX2BD5.js";
27
- import "../chunk-GHGPTPBL.js";
23
+ } from "../chunk-RITD7E5L.js";
24
+ import "../chunk-YDVEH3SB.js";
25
+ import "../chunk-GY34VGP5.js";
26
+ import "../chunk-B7PUBQQM.js";
28
27
  import {
29
28
  pluginCatalogRuntime
30
- } from "../chunk-BTH37NCU.js";
31
- import "../chunk-S6QKIGRM.js";
29
+ } from "../chunk-L7CDEIVJ.js";
30
+ import "../chunk-I35CTGPO.js";
32
31
  import "../chunk-OB42YVAE.js";
33
- import "../chunk-3DA7X2U3.js";
32
+ import "../chunk-6GWA276C.js";
34
33
  import "../chunk-6APU57E6.js";
35
- import "../chunk-LFLTJQVR.js";
34
+ import "../chunk-7FBGKXPE.js";
36
35
  import "../chunk-MLKGABMK.js";
37
36
 
38
37
  // src/cli/plugins.ts
@@ -1,20 +1,19 @@
1
1
  import {
2
2
  resolveRuntimeDependencySnapshot
3
- } from "../chunk-6H4PP63X.js";
4
- import "../chunk-G3E7SCME.js";
3
+ } from "../chunk-BYZWPRJA.js";
4
+ import "../chunk-CZEX6KIQ.js";
5
5
  import {
6
6
  disconnectStateAdapter
7
- } from "../chunk-7STN2ZSK.js";
8
- import "../chunk-NAPITCZ6.js";
9
- import "../chunk-YYBX2BD5.js";
7
+ } from "../chunk-YDVEH3SB.js";
8
+ import "../chunk-GY34VGP5.js";
10
9
  import {
11
10
  pluginCatalogRuntime
12
- } from "../chunk-BTH37NCU.js";
13
- import "../chunk-S6QKIGRM.js";
11
+ } from "../chunk-L7CDEIVJ.js";
12
+ import "../chunk-I35CTGPO.js";
14
13
  import "../chunk-OB42YVAE.js";
15
- import "../chunk-3DA7X2U3.js";
14
+ import "../chunk-6GWA276C.js";
16
15
  import "../chunk-6APU57E6.js";
17
- import "../chunk-LFLTJQVR.js";
16
+ import "../chunk-7FBGKXPE.js";
18
17
  import "../chunk-MLKGABMK.js";
19
18
 
20
19
  // src/cli/snapshot-warmup.ts
@@ -4,7 +4,7 @@ import {
4
4
  recordConversationActivity,
5
5
  recordConversationExecution,
6
6
  requestConversationWork
7
- } from "../chunk-QGEWC27H.js";
7
+ } from "../chunk-GQ3GK22G.js";
8
8
  import {
9
9
  defineJuniorPlugins,
10
10
  pluginCatalogConfigFromEnv,
@@ -12,45 +12,48 @@ import {
12
12
  pluginRuntimeRegistrationsFromPluginSet
13
13
  } from "../chunk-SG5WAA7H.js";
14
14
  import {
15
- JUNIOR_THREAD_STATE_TTL_MS,
16
15
  coerceThreadConversationState
17
- } from "../chunk-PFXC67GJ.js";
16
+ } from "../chunk-RAIB6WSG.js";
17
+ import {
18
+ JUNIOR_THREAD_STATE_TTL_MS,
19
+ importConversationFromLegacy
20
+ } from "../chunk-5C6XTTFI.js";
18
21
  import {
19
22
  loadAppPluginSet
20
23
  } from "../chunk-Y2CM7HXH.js";
21
24
  import {
22
25
  createPluginLogger,
23
26
  createPluginState
24
- } from "../chunk-TNUUATT7.js";
25
- import {
26
- disconnectStateAdapter,
27
- getConnectedStateContext
28
- } from "../chunk-7STN2ZSK.js";
27
+ } from "../chunk-2NAZZPPS.js";
29
28
  import {
30
29
  createJuniorSqlExecutor,
30
+ createSqlConversationMessageStore,
31
31
  createSqlStore,
32
- getDb
33
- } from "../chunk-NFXSLTYG.js";
32
+ getDb,
33
+ migrateSchema
34
+ } from "../chunk-RITD7E5L.js";
34
35
  import {
35
- getChatConfig
36
- } from "../chunk-NAPITCZ6.js";
37
- import "../chunk-YYBX2BD5.js";
36
+ disconnectStateAdapter,
37
+ getChatConfig,
38
+ getConnectedStateContext
39
+ } from "../chunk-YDVEH3SB.js";
40
+ import "../chunk-GY34VGP5.js";
38
41
  import {
39
42
  parseDestination,
40
43
  sameDestination
41
- } from "../chunk-GHGPTPBL.js";
44
+ } from "../chunk-B7PUBQQM.js";
42
45
  import {
43
46
  pluginCatalogRuntime
44
- } from "../chunk-BTH37NCU.js";
45
- import "../chunk-S6QKIGRM.js";
47
+ } from "../chunk-L7CDEIVJ.js";
48
+ import "../chunk-I35CTGPO.js";
46
49
  import {
47
50
  isRecord,
48
51
  toOptionalNumber,
49
52
  toOptionalString
50
53
  } from "../chunk-OB42YVAE.js";
51
- import "../chunk-3DA7X2U3.js";
54
+ import "../chunk-6GWA276C.js";
52
55
  import "../chunk-6APU57E6.js";
53
- import "../chunk-LFLTJQVR.js";
56
+ import "../chunk-7FBGKXPE.js";
54
57
  import "../chunk-MLKGABMK.js";
55
58
 
56
59
  // src/cli/upgrade.ts
@@ -78,6 +81,9 @@ function createStateConversationStore(state) {
78
81
  // Task-execution state has no destination records, so visibility is never
79
82
  // source-confirmed here and cross-context reads fail closed to private.
80
83
  getDestinationVisibility: async () => void 0,
84
+ // Subagent child conversations are a SQL-only concept; the advisor always
85
+ // links its child through the SQL store, never this legacy metadata path.
86
+ ensureChildConversation: async () => void 0,
81
87
  recordActivity: (args) => recordConversationActivity({ ...args, state }),
82
88
  recordExecution: (args) => recordConversationExecution({ ...args, state }),
83
89
  listByActivity: (args) => listConversationsByActivity({ ...args, state })
@@ -121,6 +127,60 @@ var sqlConversationMigration = {
121
127
  run: migrateConversationsToSql
122
128
  };
123
129
 
130
+ // src/cli/upgrade/migrations/conversations-history-sql.ts
131
+ var HISTORY_BACKFILL_LIMIT = 1e4;
132
+ async function migrateConversationHistoryToSql(context, options = {}) {
133
+ const source = createStateConversationStore(context.stateAdapter);
134
+ let executor = options.executor;
135
+ let closeExecutor;
136
+ if (!executor) {
137
+ const { sql } = getChatConfig();
138
+ executor = createJuniorSqlExecutor({
139
+ connectionString: sql.databaseUrl,
140
+ driver: sql.driver
141
+ });
142
+ closeExecutor = () => executor.close();
143
+ }
144
+ const limit = Math.max(1, options.batchSize ?? HISTORY_BACKFILL_LIMIT);
145
+ try {
146
+ await migrateSchema(executor);
147
+ const messageStore = createSqlConversationMessageStore(executor);
148
+ const conversations = await source.listByActivity({ limit });
149
+ let migrated = 0;
150
+ let existing = 0;
151
+ for (const conversation of conversations) {
152
+ const result = await importConversationFromLegacy(
153
+ conversation.conversationId,
154
+ {
155
+ executor,
156
+ messageStore,
157
+ conversationRecord: conversation,
158
+ ...options.sessionLogStore ? { sessionLogStore: options.sessionLogStore } : {},
159
+ ...options.advisorSessionStore ? { advisorSessionStore: options.advisorSessionStore } : {},
160
+ ...options.loadVisibleMessages ? { loadVisibleMessages: options.loadVisibleMessages } : {}
161
+ }
162
+ );
163
+ if (result.imported) {
164
+ migrated += 1;
165
+ } else {
166
+ existing += 1;
167
+ }
168
+ }
169
+ return {
170
+ existing,
171
+ migrated,
172
+ missing: 0,
173
+ scanned: conversations.length
174
+ };
175
+ } finally {
176
+ await closeExecutor?.();
177
+ }
178
+ }
179
+ var sqlConversationHistoryMigration = {
180
+ name: "backfill-agent-steps-sql",
181
+ run: migrateConversationHistoryToSql
182
+ };
183
+
124
184
  // src/cli/upgrade/migrations/upgrade-plugins.ts
125
185
  function unique(values) {
126
186
  return [...new Set(values)];
@@ -940,6 +1000,7 @@ var localPluginLoader = createJiti(import.meta.url, { moduleCache: false });
940
1000
  var MIGRATIONS = [
941
1001
  redisConversationStateMigration,
942
1002
  sqlConversationMigration,
1003
+ sqlConversationHistoryMigration,
943
1004
  sqlPluginMigration,
944
1005
  pluginStorageMigration
945
1006
  ];