@sentry/junior 0.93.0 → 0.95.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 (122) hide show
  1. package/dist/{agent-hooks-ZG7IDOIN.js → agent-hooks-FTQ5EGPO.js} +9 -10
  2. package/dist/api/people/list.js +7 -7
  3. package/dist/api/people/profile.js +7 -7
  4. package/dist/api/people/shared.d.ts +2 -2
  5. package/dist/api-reference.d.ts +1 -1
  6. package/dist/app.js +474 -231
  7. package/dist/{catalog-runtime-NZHMSMYC.js → catalog-runtime-2D7IVKUT.js} +3 -3
  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/egress/credentialed.d.ts +1 -1
  28. package/dist/chat/identities/sql.d.ts +1 -1
  29. package/dist/chat/logging.d.ts +2 -1
  30. package/dist/chat/resource-events/store.d.ts +2 -1
  31. package/dist/chat/runtime/reply-executor.d.ts +8 -0
  32. package/dist/chat/runtime/thread-state.d.ts +2 -0
  33. package/dist/chat/sandbox/egress/schemas.d.ts +4 -0
  34. package/dist/chat/sandbox/egress/session.d.ts +2 -2
  35. package/dist/chat/sandbox/resources.d.ts +4 -0
  36. package/dist/chat/services/mcp-auth-orchestration.d.ts +8 -0
  37. package/dist/chat/services/plugin-auth-orchestration.d.ts +12 -0
  38. package/dist/chat/services/turn-session-record.d.ts +14 -2
  39. package/dist/chat/sleep.d.ts +2 -0
  40. package/dist/chat/state/conversation.d.ts +7 -4
  41. package/dist/chat/state/session-log.d.ts +23 -1
  42. package/dist/chat/state/turn-session.d.ts +6 -0
  43. package/dist/chat/tool-support/private-trace-result.d.ts +4 -0
  44. package/dist/chat/tool-support/zod-tool.d.ts +1 -0
  45. package/dist/chat/tools/advisor/tool.d.ts +9 -4
  46. package/dist/chat/tools/definition.d.ts +2 -0
  47. package/dist/chat/tools/execution/tool-error-handler.d.ts +2 -2
  48. package/dist/chat/tools/system-time.d.ts +8 -0
  49. package/dist/chat/xml.d.ts +2 -0
  50. package/dist/{chunk-NYWPISSO.js → chunk-2XXEKR44.js} +1 -1
  51. package/dist/{chunk-QGEWC27H.js → chunk-5XMNOD3S.js} +5 -7
  52. package/dist/{chunk-NFXSLTYG.js → chunk-6ONME5IG.js} +864 -62
  53. package/dist/{chunk-LFLTJQVR.js → chunk-7FBGKXPE.js} +4 -0
  54. package/dist/{chunk-MC4ZZE4Q.js → chunk-AYP4ERVZ.js} +1 -1
  55. package/dist/{chunk-GHGPTPBL.js → chunk-B7PUBQQM.js} +1 -1
  56. package/dist/chunk-CM5EZD5F.js +17 -0
  57. package/dist/chunk-CRRBJ3JP.js +1037 -0
  58. package/dist/{chunk-G3E7SCME.js → chunk-CZEX6KIQ.js} +23 -0
  59. package/dist/{chunk-TNUUATT7.js → chunk-E3E2XNCN.js} +2 -2
  60. package/dist/{chunk-LNCREA5Z.js → chunk-EKNJM5IG.js} +3 -127
  61. package/dist/{chunk-NAPITCZ6.js → chunk-GUE7HTNR.js} +251 -6
  62. package/dist/{chunk-BTH37NCU.js → chunk-GVOUCI2O.js} +1 -1
  63. package/dist/{chunk-YYBX2BD5.js → chunk-GY34VGP5.js} +1 -1
  64. package/dist/{chunk-JJUJ4CO2.js → chunk-HCXXB35T.js} +1489 -360
  65. package/dist/{chunk-YTNPU7I2.js → chunk-HDTO3A74.js} +2 -2
  66. package/dist/{chunk-YJ4OPVNA.js → chunk-HZNJLKKI.js} +1 -1
  67. package/dist/{chunk-HDNWZMUN.js → chunk-KDPCGVIT.js} +116 -51
  68. package/dist/chunk-N4RNJ32C.js +48 -0
  69. package/dist/{chunk-UUB3D2XI.js → chunk-NSCHU54X.js} +8 -10
  70. package/dist/{chunk-PFXC67GJ.js → chunk-RAIB6WSG.js} +6 -80
  71. package/dist/chunk-WAGQ377B.js +724 -0
  72. package/dist/{chunk-6H4PP63X.js → chunk-WCMQJE4F.js} +24 -14
  73. package/dist/{chunk-S6QKIGRM.js → chunk-WPOJ443W.js} +15 -25
  74. package/dist/{chunk-MAVOJ54A.js → chunk-XX4N4E6C.js} +25 -388
  75. package/dist/cli/chat.js +24 -23
  76. package/dist/cli/check.js +4 -4
  77. package/dist/cli/plugins.js +11 -12
  78. package/dist/cli/snapshot-warmup.js +7 -8
  79. package/dist/cli/upgrade.js +78 -17
  80. package/dist/db/schema/agent-steps.d.ts +134 -0
  81. package/dist/db/schema/conversation-messages.d.ts +153 -0
  82. package/dist/{chat/conversations/sql → db}/schema/conversations.d.ts +34 -0
  83. package/dist/{chat/conversations/sql → db}/schema.d.ts +319 -8
  84. package/dist/db-W55B74OP.js +24 -0
  85. package/dist/deployment.d.ts +2 -0
  86. package/dist/handlers/retention.d.ts +6 -0
  87. package/dist/instrumentation.js +16 -3
  88. package/dist/legacy-import-ZPLGLAFD.js +17 -0
  89. package/dist/nitro.js +14 -4
  90. package/dist/reporting/conversations/activity.d.ts +40 -0
  91. package/dist/reporting/conversations/context.d.ts +8 -0
  92. package/dist/reporting/conversations/details.d.ts +6 -0
  93. package/dist/reporting/conversations/index.d.ts +4 -0
  94. package/dist/reporting/conversations/shared.d.ts +9 -0
  95. package/dist/reporting/conversations/statistics.d.ts +4 -0
  96. package/dist/reporting/conversations/summaries.d.ts +17 -0
  97. package/dist/reporting/conversations/transcript.d.ts +28 -0
  98. package/dist/reporting/conversations/types.d.ts +178 -0
  99. package/dist/reporting/conversations.d.ts +1 -178
  100. package/dist/reporting.d.ts +4 -3
  101. package/dist/reporting.js +603 -827
  102. package/dist/{runner-XAZPJNAQ.js → runner-OOSBDYRK.js} +35 -41
  103. package/dist/{validation-KYAWETI4.js → validation-QCGRFRFZ.js} +4 -4
  104. package/migrations/README.md +32 -0
  105. package/migrations/meta/0000_snapshot.json +978 -0
  106. package/migrations/meta/_journal.json +13 -0
  107. package/package.json +9 -6
  108. package/dist/chat/sql/schema.d.ts +0 -1049
  109. package/dist/chat/state/conversation-details.d.ts +0 -47
  110. package/dist/chunk-7STN2ZSK.js +0 -250
  111. package/dist/chunk-LE5ANBUZ.js +0 -1040
  112. package/dist/chunk-QL66APYJ.js +0 -1377
  113. package/dist/db-YDN6AFJH.js +0 -18
  114. /package/dist/{chat/sql → db}/db.d.ts +0 -0
  115. /package/dist/{chat/sql → db}/executor.d.ts +0 -0
  116. /package/dist/{chat/sql → db}/neon.d.ts +0 -0
  117. /package/dist/{chat/sql → db}/postgres.d.ts +0 -0
  118. /package/dist/{chat/conversations/sql → db}/schema/destinations.d.ts +0 -0
  119. /package/dist/{chat/conversations/sql → db}/schema/identities.d.ts +0 -0
  120. /package/dist/{chat/conversations/sql → db}/schema/migrations.d.ts +0 -0
  121. /package/dist/{chat/conversations/sql → db}/schema/timestamps.d.ts +0 -0
  122. /package/dist/{chat/conversations/sql → db}/schema/users.d.ts +0 -0
@@ -1,47 +0,0 @@
1
- import { type StoredSlackActor } from "@/chat/actor";
2
- import type { AgentTurnSurface } from "./turn-session";
3
- export interface ConversationDetailsRecord {
4
- conversationId: string;
5
- /** Generated display title from the LLM. Absent until title has been produced. */
6
- displayTitle?: string;
7
- /** The message id used as input when generating the title. */
8
- titleSourceMessageId?: string;
9
- /** Slack channel name or equivalent location label. */
10
- channelName?: string;
11
- /** Surface on which the conversation was started. */
12
- originSurface?: AgentTurnSurface;
13
- /** Actor who initiated the conversation (first turn). */
14
- originActor?: StoredSlackActor;
15
- /** Timestamp of the first turn in the conversation. */
16
- startedAtMs?: number;
17
- }
18
- /**
19
- * Record the origin context for a conversation the first time it is seen and
20
- * refresh the context TTL on later turns without changing the stored origin.
21
- */
22
- export declare function initConversationContext(conversationId: string, context: {
23
- channelName?: string;
24
- originSurface?: AgentTurnSurface;
25
- originActor?: StoredSlackActor;
26
- startedAtMs: number;
27
- }): Promise<void>;
28
- /**
29
- * Persist or refresh the LLM-generated title for a conversation.
30
- *
31
- * Plain set — no read, no lock.
32
- */
33
- export declare function setConversationTitle(conversationId: string, title: {
34
- displayTitle: string;
35
- titleSourceMessageId?: string;
36
- }): Promise<void>;
37
- /**
38
- * Read conversation details for a single conversation.
39
- * Assembles the context and title records in parallel.
40
- * Returns undefined only when neither context nor title details exist yet.
41
- */
42
- export declare function getConversationDetails(conversationId: string): Promise<ConversationDetailsRecord | undefined>;
43
- /**
44
- * Bulk-fetch conversation details for a set of conversation ids in parallel.
45
- * Returns a map from conversationId → record (omits ids with no details).
46
- */
47
- export declare function getConversationDetailsForIds(conversationIds: Iterable<string>): Promise<Map<string, ConversationDetailsRecord>>;
@@ -1,250 +0,0 @@
1
- import {
2
- getChatConfig
3
- } from "./chunk-NAPITCZ6.js";
4
-
5
- // src/chat/state/adapter.ts
6
- import { createMemoryState } from "@chat-adapter/state-memory";
7
- import { createRedisState } from "@chat-adapter/state-redis";
8
-
9
- // src/chat/state/locks.ts
10
- var ACTIVE_LOCK_TTL_MS = 9e4;
11
- async function acquireActiveLock(state, threadId) {
12
- return await state.acquireLock(threadId, ACTIVE_LOCK_TTL_MS);
13
- }
14
-
15
- // src/chat/state/adapter.ts
16
- var ACTIVE_LOCK_HEARTBEAT_MS = 3e4;
17
- var stateAdapter;
18
- var redisStateAdapter;
19
- function createPrefixedStateAdapter(base, prefix) {
20
- const prefixed = (value) => `${prefix}:${value}`;
21
- const unprefixed = (value) => value.startsWith(`${prefix}:`) ? value.slice(prefix.length + 1) : value;
22
- const prefixLock = (lock) => ({
23
- ...lock,
24
- threadId: prefixed(lock.threadId)
25
- });
26
- const unprefixLock = (lock) => ({
27
- ...lock,
28
- threadId: unprefixed(lock.threadId)
29
- });
30
- return {
31
- appendToList: (key, value, options) => base.appendToList(prefixed(key), value, options),
32
- connect: () => base.connect(),
33
- disconnect: () => base.disconnect(),
34
- subscribe: (threadId) => base.subscribe(prefixed(threadId)),
35
- unsubscribe: (threadId) => base.unsubscribe(prefixed(threadId)),
36
- isSubscribed: (threadId) => base.isSubscribed(prefixed(threadId)),
37
- acquireLock: async (threadId, ttlMs) => {
38
- const lock = await base.acquireLock(prefixed(threadId), ttlMs);
39
- return lock ? unprefixLock(lock) : null;
40
- },
41
- releaseLock: (lock) => base.releaseLock(prefixLock(lock)),
42
- extendLock: async (lock, ttlMs) => {
43
- const prefixedLock = prefixLock(lock);
44
- const extended = await base.extendLock(prefixedLock, ttlMs);
45
- if (extended) {
46
- lock.expiresAt = prefixedLock.expiresAt;
47
- }
48
- return extended;
49
- },
50
- forceReleaseLock: (threadId) => base.forceReleaseLock(prefixed(threadId)),
51
- enqueue: (threadId, entry, maxSize) => base.enqueue(prefixed(threadId), entry, maxSize),
52
- dequeue: (threadId) => base.dequeue(prefixed(threadId)),
53
- queueDepth: (threadId) => base.queueDepth(prefixed(threadId)),
54
- get: (key) => base.get(prefixed(key)),
55
- getList: (key) => base.getList(prefixed(key)),
56
- set: (key, value, ttlMs) => base.set(prefixed(key), value, ttlMs),
57
- setIfNotExists: (key, value, ttlMs) => base.setIfNotExists(prefixed(key), value, ttlMs),
58
- delete: (key) => base.delete(prefixed(key))
59
- };
60
- }
61
- function createQueuedStateAdapter(base, options) {
62
- const heartbeats = /* @__PURE__ */ new Map();
63
- const shouldHeartbeatLock = (ttlMs) => ttlMs === ACTIVE_LOCK_TTL_MS;
64
- const heartbeatKey = (lock) => `${lock.threadId}:${lock.token}`;
65
- const stopHeartbeatByKey = (key) => {
66
- const heartbeat = heartbeats.get(key);
67
- if (!heartbeat) {
68
- return;
69
- }
70
- clearInterval(heartbeat.timer);
71
- heartbeats.delete(key);
72
- };
73
- const stopHeartbeat = (lock) => {
74
- stopHeartbeatByKey(heartbeatKey(lock));
75
- };
76
- const stopHeartbeatsForThread = (threadId) => {
77
- for (const [key, heartbeat] of heartbeats) {
78
- if (heartbeat.lock.threadId === threadId) {
79
- stopHeartbeatByKey(key);
80
- }
81
- }
82
- };
83
- const stopAllHeartbeats = () => {
84
- for (const key of heartbeats.keys()) {
85
- stopHeartbeatByKey(key);
86
- }
87
- };
88
- const runHeartbeat = async (key) => {
89
- const heartbeat = heartbeats.get(key);
90
- if (!heartbeat || heartbeat.inFlight) {
91
- return;
92
- }
93
- heartbeat.inFlight = true;
94
- try {
95
- if (Date.now() - heartbeat.startedAtMs >= options.activeLockMaxAgeMs) {
96
- stopHeartbeatByKey(key);
97
- return;
98
- }
99
- const extended = await base.extendLock(heartbeat.lock, heartbeat.ttlMs);
100
- if (!extended) {
101
- stopHeartbeatByKey(key);
102
- return;
103
- }
104
- heartbeat.lock.expiresAt = Date.now() + heartbeat.ttlMs;
105
- } catch {
106
- } finally {
107
- const current = heartbeats.get(key);
108
- if (current === heartbeat) {
109
- current.inFlight = false;
110
- }
111
- }
112
- };
113
- const startOrUpdateHeartbeat = (lock, ttlMs) => {
114
- const key = heartbeatKey(lock);
115
- const existing = heartbeats.get(key);
116
- if (existing) {
117
- existing.ttlMs = ttlMs;
118
- return;
119
- }
120
- const timer = setInterval(() => {
121
- void runHeartbeat(key);
122
- }, ACTIVE_LOCK_HEARTBEAT_MS);
123
- timer.unref?.();
124
- heartbeats.set(key, {
125
- inFlight: false,
126
- lock,
127
- startedAtMs: Date.now(),
128
- timer,
129
- ttlMs
130
- });
131
- };
132
- const acquireLock = async (threadId, ttlMs) => {
133
- const lock = await base.acquireLock(threadId, ttlMs);
134
- if (lock && shouldHeartbeatLock(ttlMs)) {
135
- startOrUpdateHeartbeat(lock, ttlMs);
136
- }
137
- return lock;
138
- };
139
- return {
140
- appendToList: (key, value, options2) => base.appendToList(key, value, options2),
141
- connect: () => base.connect(),
142
- disconnect: async () => {
143
- stopAllHeartbeats();
144
- await base.disconnect();
145
- },
146
- subscribe: (threadId) => base.subscribe(threadId),
147
- unsubscribe: (threadId) => base.unsubscribe(threadId),
148
- isSubscribed: (threadId) => base.isSubscribed(threadId),
149
- acquireLock,
150
- releaseLock: async (lock) => {
151
- stopHeartbeat(lock);
152
- await base.releaseLock(lock);
153
- },
154
- extendLock: async (lock, ttlMs) => {
155
- const extended = await base.extendLock(lock, ttlMs);
156
- if (extended) {
157
- lock.expiresAt = Date.now() + ttlMs;
158
- if (shouldHeartbeatLock(ttlMs)) {
159
- startOrUpdateHeartbeat(lock, ttlMs);
160
- } else {
161
- stopHeartbeat(lock);
162
- }
163
- } else {
164
- stopHeartbeat(lock);
165
- }
166
- return extended;
167
- },
168
- forceReleaseLock: async (threadId) => {
169
- stopHeartbeatsForThread(threadId);
170
- await base.forceReleaseLock(threadId);
171
- },
172
- enqueue: (threadId, entry, maxSize) => base.enqueue(threadId, entry, maxSize),
173
- dequeue: (threadId) => base.dequeue(threadId),
174
- queueDepth: (threadId) => base.queueDepth(threadId),
175
- get: (key) => base.get(key),
176
- getList: (key) => base.getList(key),
177
- set: (key, value, ttlMs) => base.set(key, value, ttlMs),
178
- setIfNotExists: (key, value, ttlMs) => base.setIfNotExists(key, value, ttlMs),
179
- delete: (key) => base.delete(key)
180
- };
181
- }
182
- function withOptionalPrefix(base, prefix) {
183
- return prefix ? createPrefixedStateAdapter(base, prefix) : base;
184
- }
185
- function createStateAdapter() {
186
- const config = getChatConfig();
187
- const activeLockMaxAgeMs = config.bot.turnTimeoutMs + ACTIVE_LOCK_TTL_MS;
188
- if (config.state.adapter === "memory") {
189
- redisStateAdapter = void 0;
190
- return createQueuedStateAdapter(
191
- withOptionalPrefix(createMemoryState(), config.state.keyPrefix),
192
- { activeLockMaxAgeMs }
193
- );
194
- }
195
- if (!config.state.redisUrl) {
196
- throw new Error("REDIS_URL is required for durable Slack thread state");
197
- }
198
- const redisState = createRedisState({
199
- url: config.state.redisUrl
200
- });
201
- redisStateAdapter = redisState;
202
- return createQueuedStateAdapter(
203
- withOptionalPrefix(redisState, config.state.keyPrefix),
204
- { activeLockMaxAgeMs }
205
- );
206
- }
207
- function getOptionalRedisStateAdapter() {
208
- getStateAdapter();
209
- return redisStateAdapter;
210
- }
211
- async function getConnectedStateContext() {
212
- const adapter = getStateAdapter();
213
- await adapter.connect();
214
- return {
215
- redisStateAdapter: getOptionalRedisStateAdapter(),
216
- stateAdapter: adapter
217
- };
218
- }
219
- async function getDefaultRedisStateAdapterFor(adapter) {
220
- if (adapter !== stateAdapter) {
221
- return void 0;
222
- }
223
- const context = await getConnectedStateContext();
224
- return context.stateAdapter === adapter ? context.redisStateAdapter : void 0;
225
- }
226
- function getStateAdapter() {
227
- if (!stateAdapter) {
228
- stateAdapter = createStateAdapter();
229
- }
230
- return stateAdapter;
231
- }
232
- async function disconnectStateAdapter() {
233
- if (!stateAdapter) {
234
- return;
235
- }
236
- try {
237
- await stateAdapter.disconnect();
238
- } finally {
239
- stateAdapter = void 0;
240
- redisStateAdapter = void 0;
241
- }
242
- }
243
-
244
- export {
245
- acquireActiveLock,
246
- getConnectedStateContext,
247
- getDefaultRedisStateAdapterFor,
248
- getStateAdapter,
249
- disconnectStateAdapter
250
- };