@sentry/junior 0.187.0 → 0.189.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.
- package/dist/{agent-hooks-XVAE2554.js → agent-hooks-6QRYH6PX.js} +11 -11
- package/dist/api/acp/conversations.d.ts +2 -2
- package/dist/api/conversations/list.d.ts +7 -0
- package/dist/api/people/shared.d.ts +54 -0
- package/dist/api.js +41 -52
- package/dist/app.d.ts +1 -1
- package/dist/app.js +1001 -338
- package/dist/{catalog-runtime-DWFAC562.js → catalog-runtime-IETJLJFG.js} +4 -4
- package/dist/chat/agent/resume.d.ts +0 -2
- package/dist/chat/agent/types.d.ts +9 -14
- package/dist/chat/agent-dispatch/work.d.ts +1 -10
- package/dist/chat/agent-invocations/spawn.d.ts +1 -1
- package/dist/chat/agent-invocations/types.d.ts +296 -24
- package/dist/chat/app/conversation-work.d.ts +16 -8
- package/dist/chat/conversation-privacy.d.ts +7 -7
- package/dist/chat/conversations/destination.d.ts +12 -0
- package/dist/chat/conversations/location.d.ts +3 -8
- package/dist/chat/conversations/projection.d.ts +2 -2
- package/dist/chat/conversations/sql/location.d.ts +13 -4
- package/dist/chat/{api-turns → conversations}/stop.d.ts +2 -2
- package/dist/chat/conversations/store.d.ts +8 -11
- package/dist/chat/conversations/structured-events.d.ts +1 -1
- package/dist/chat/{api-turns/authorization.d.ts → conversations/web-authorization.d.ts} +1 -0
- package/dist/chat/conversations/web-input.d.ts +98 -0
- package/dist/chat/conversations/web-mailbox.d.ts +12 -0
- package/dist/chat/providers/slack/runtime.d.ts +1 -0
- package/dist/chat/providers/slack/system-turn.d.ts +8 -0
- package/dist/chat/resource-events/actor.d.ts +13 -12
- package/dist/chat/resource-events/notification.d.ts +1 -1
- package/dist/chat/services/guardian-action-policy.d.ts +1 -1
- package/dist/chat/services/turn-session-routing.d.ts +5 -5
- package/dist/chat/task-execution/assistant-message.d.ts +32 -0
- package/dist/chat/task-execution/conversation-turn.d.ts +8 -0
- package/dist/chat/{api-turns → task-execution}/mailbox-input.d.ts +1 -2
- package/dist/chat/task-execution/mailbox-turn.d.ts +42 -0
- package/dist/chat/task-execution/paused-turn.d.ts +1 -1
- package/dist/chat/task-execution/slack-work.d.ts +0 -2
- package/dist/{chunk-WL3R2KTS.js → chunk-4RHJ3CXR.js} +90 -289
- package/dist/{chunk-U6ZQHRIP.js → chunk-5CXCGDIL.js} +1 -1
- package/dist/{chunk-HXR3FHTE.js → chunk-5VWAY27R.js} +7 -3
- package/dist/{chunk-D3GDGREI.js → chunk-6AUR6PWR.js} +3 -3
- package/dist/{chunk-EIWYZXSM.js → chunk-7R5JRPCY.js} +8 -6
- package/dist/{chunk-WRDW3A3D.js → chunk-AC7MDOJW.js} +5 -7
- package/dist/{chunk-URZ7UD4P.js → chunk-BYBSI5TI.js} +2 -2
- package/dist/{chunk-MUPPP7A7.js → chunk-CMWIMFM6.js} +4 -182
- package/dist/{chunk-WKIS4VRK.js → chunk-CUYFCI4G.js} +70 -39
- package/dist/chunk-DA2KGZZI.js +13 -0
- package/dist/{chunk-Q6OCUQ7W.js → chunk-DYXVAO2E.js} +1 -1
- package/dist/{chunk-QH3I7ZOK.js → chunk-E3PDZPGV.js} +1 -1
- package/dist/{chunk-NU775DLU.js → chunk-GP32KD2J.js} +4 -12
- package/dist/{chunk-STF4GSK4.js → chunk-KN32OWL2.js} +5 -5
- package/dist/chunk-LHKZKAZ4.js +285 -0
- package/dist/{chunk-D5BWM37G.js → chunk-MFSET7Q7.js} +51 -341
- package/dist/{chunk-DUE4EUNL.js → chunk-MI6ZBDTS.js} +6 -6
- package/dist/{chunk-27T5HZHO.js → chunk-MRXMFB4L.js} +6 -87
- package/dist/{chunk-4A2R3AQB.js → chunk-MVPLEPSI.js} +1 -1
- package/dist/{chunk-7LRRVMPH.js → chunk-NY2F7BZA.js} +1 -1
- package/dist/chunk-O35GZCKL.js +311 -0
- package/dist/{chunk-U3KMII5Y.js → chunk-OEIITG5F.js} +1 -1
- package/dist/{chunk-6FKNNUSN.js → chunk-PCPSX4ES.js} +209 -7
- package/dist/{chunk-6YCIYOVA.js → chunk-PY3EIEAF.js} +1 -1
- package/dist/{chunk-U5POFCKM.js → chunk-QNIOBNOY.js} +284 -123
- package/dist/{chunk-JCRXXEMC.js → chunk-S3SGZUOI.js} +1 -1
- package/dist/chunk-SR6OMO5C.js +703 -0
- package/dist/{chunk-TQHCZXN7.js → chunk-UCWO5MKP.js} +7 -7
- package/dist/{chunk-ITLYUKGZ.js → chunk-VKQWU4PO.js} +2 -2
- package/dist/{chunk-JZPDYKRG.js → chunk-WDHPN2GH.js} +3 -3
- package/dist/{chunk-P2VU5JNH.js → chunk-WMUAKAIF.js} +42 -42
- package/dist/{chunk-NIKLTFBP.js → chunk-WN6VLHOU.js} +12 -5
- package/dist/{chunk-VC343WHM.js → chunk-WWYUYKKV.js} +1 -1
- package/dist/{chunk-OM4SFFJK.js → chunk-WYDF6PGK.js} +3 -3
- package/dist/{chunk-KRYJ5VOD.js → chunk-YNZPOFF3.js} +16 -21
- package/dist/{chunk-Z6OHCDXP.js → chunk-YYSEH2WC.js} +2 -2
- package/dist/{chunk-BITZUBPJ.js → chunk-YYZNESC3.js} +8 -8
- package/dist/{chunk-2VUDJGB6.js → chunk-ZUPDSJUE.js} +2 -5
- package/dist/{chunk-X5SXFVZT.js → chunk-ZV6PFUA4.js} +1 -1
- package/dist/cli/chat.js +34 -33
- package/dist/cli/check.js +5 -5
- package/dist/cli/plugins.js +12 -12
- package/dist/cli/snapshot-create.js +9 -9
- package/dist/cli/upgrade.js +6 -6
- package/dist/db/schema/conversations.d.ts +62 -0
- package/dist/db/schema.d.ts +31 -0
- package/dist/{db-FBHAWVXU.js → db-LPJKR2EO.js} +6 -6
- package/dist/instrumentation.js +3 -3
- package/dist/nitro.js +6 -6
- package/dist/{oauth-callback-server-5HS5ULC6.js → oauth-callback-server-DMXF4TTQ.js} +30 -28
- package/dist/{runner-46W6NV6B.js → runner-L5DPVYCN.js} +24 -20
- package/dist/{skills-TG3QC4B6.js → skills-NXG3LBCK.js} +5 -5
- package/dist/spawn-VRUIGKWW.js +42 -0
- package/dist/task-runner-7YTBSPXW.js +36 -0
- package/dist/{validation-GMRIDBC5.js → validation-CH36LTOS.js} +5 -5
- package/dist/version.js +1 -1
- package/dist/{work-W4ULBJTU.js → work-HBC5Y5VZ.js} +22 -21
- package/dist/{worker-M6NVACS2.js → worker-5RDZHLXH.js} +10 -10
- package/migrations/0037_conversation_location.sql +23 -0
- package/migrations/meta/0037_snapshot.json +3192 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +4 -4
- package/dist/chat/api-turns/assistant-message.d.ts +0 -12
- package/dist/chat/api-turns/cancellation.d.ts +0 -24
- package/dist/chat/api-turns/routing.d.ts +0 -51
- package/dist/chat/api-turns/work.d.ts +0 -99
- package/dist/chat/task-execution/slack-resource-event.d.ts +0 -47
- package/dist/chunk-4YD3DET6.js +0 -1503
- package/dist/chunk-6FGN7ZEG.js +0 -221
- package/dist/spawn-Y6YWBIJS.js +0 -41
- package/dist/task-runner-YSGBPN4U.js +0 -34
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isExperimentalFeatureEnabled
|
|
3
|
+
} from "./chunk-2LYHWMR4.js";
|
|
1
4
|
import {
|
|
2
5
|
SlackActionError,
|
|
3
6
|
applyPluginFormatMarkdown,
|
|
@@ -5,19 +8,19 @@ import {
|
|
|
5
8
|
isDmChannel,
|
|
6
9
|
normalizeSlackConversationId,
|
|
7
10
|
withSlackRetries
|
|
8
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-MI6ZBDTS.js";
|
|
9
12
|
import {
|
|
10
13
|
parseDestination
|
|
11
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-CUYFCI4G.js";
|
|
12
15
|
import {
|
|
13
16
|
getStateAdapter
|
|
14
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-5CXCGDIL.js";
|
|
15
18
|
import {
|
|
16
19
|
normalizeSlackEmojiName
|
|
17
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-BYBSI5TI.js";
|
|
18
21
|
import {
|
|
19
22
|
pluginCatalogRuntime
|
|
20
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-E3PDZPGV.js";
|
|
21
24
|
import {
|
|
22
25
|
parseSlackMessageTs,
|
|
23
26
|
parseSlackUserId
|
|
@@ -26,7 +29,198 @@ import {
|
|
|
26
29
|
isRecord,
|
|
27
30
|
logInfo,
|
|
28
31
|
logWarn
|
|
29
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-PY3EIEAF.js";
|
|
33
|
+
|
|
34
|
+
// src/chat/agent/types.ts
|
|
35
|
+
var RetryableDeliveryError = class extends Error {
|
|
36
|
+
constructor(cause) {
|
|
37
|
+
super("Assistant delivery was transient or ambiguous", { cause });
|
|
38
|
+
this.name = "RetryableDeliveryError";
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
function isAgentRunFeatureDisabled(disabledFeatures, feature) {
|
|
42
|
+
return disabledFeatures?.includes(feature) ?? false;
|
|
43
|
+
}
|
|
44
|
+
function actorFromRun(run) {
|
|
45
|
+
if (run.dispatch?.actor) {
|
|
46
|
+
return run.dispatch.actor;
|
|
47
|
+
}
|
|
48
|
+
if (run.actor) {
|
|
49
|
+
return run.actor;
|
|
50
|
+
}
|
|
51
|
+
if (run.credentialContext && !("type" in run.credentialContext.actor)) {
|
|
52
|
+
return run.credentialContext.actor;
|
|
53
|
+
}
|
|
54
|
+
return void 0;
|
|
55
|
+
}
|
|
56
|
+
function assertRunConsistency(run) {
|
|
57
|
+
const { destination, source } = run;
|
|
58
|
+
switch (source.platform) {
|
|
59
|
+
case "slack": {
|
|
60
|
+
if (destination.platform !== "slack") {
|
|
61
|
+
throw new TypeError(
|
|
62
|
+
"Run source and destination platforms do not match"
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
if (source.teamId !== destination.teamId) {
|
|
66
|
+
throw new TypeError("Slack source and destination teams do not match");
|
|
67
|
+
}
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
case "local": {
|
|
71
|
+
if (destination.platform !== "local") {
|
|
72
|
+
throw new TypeError(
|
|
73
|
+
"Run source and destination platforms do not match"
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
if (source.conversationId !== destination.conversationId) {
|
|
77
|
+
throw new TypeError(
|
|
78
|
+
"Source and destination conversation IDs do not match"
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
if (run.surface !== "internal" && destination.conversationId !== run.conversationId) {
|
|
82
|
+
throw new TypeError(
|
|
83
|
+
"Source, destination, and run conversation IDs do not match"
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
case "web": {
|
|
89
|
+
if (run.surface !== "internal" && source.conversationId !== run.conversationId) {
|
|
90
|
+
throw new TypeError("Web source and run conversation IDs do not match");
|
|
91
|
+
}
|
|
92
|
+
switch (destination.platform) {
|
|
93
|
+
case "local": {
|
|
94
|
+
if (source.conversationId !== destination.conversationId) {
|
|
95
|
+
throw new TypeError(
|
|
96
|
+
"Source and destination conversation IDs do not match"
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
if (run.surface !== "internal" && destination.conversationId !== run.conversationId) {
|
|
100
|
+
throw new TypeError(
|
|
101
|
+
"Source, destination, and run conversation IDs do not match"
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
case "slack":
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const actor = run.dispatch?.actor ?? run.actor;
|
|
113
|
+
if (!actor || actor.platform === "system") {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (actor.platform !== source.platform) {
|
|
117
|
+
throw new TypeError(
|
|
118
|
+
`Actor platform "${actor.platform}" does not match Source platform "${source.platform}"`
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
if (actor.platform === "slack" && source.platform === "slack" && actor.teamId !== source.teamId) {
|
|
122
|
+
throw new TypeError("Slack Actor team does not match Source team");
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function toolInvocationDestination(run) {
|
|
126
|
+
if (run.destination.platform !== "slack" || !run.toolChannelId) {
|
|
127
|
+
return run.destination;
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
platform: "slack",
|
|
131
|
+
teamId: run.destination.teamId,
|
|
132
|
+
channelId: run.toolChannelId
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function surfaceFromRun(run) {
|
|
136
|
+
if (run.surface) {
|
|
137
|
+
return run.surface;
|
|
138
|
+
}
|
|
139
|
+
if (run.source.platform === "slack") {
|
|
140
|
+
return "slack";
|
|
141
|
+
}
|
|
142
|
+
if (run.source.platform === "web") {
|
|
143
|
+
return "api";
|
|
144
|
+
}
|
|
145
|
+
return "internal";
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// src/chat/runtime/agent-runner.ts
|
|
149
|
+
var AGENT_ABORT_SETTLE_GRACE_MS = 5e3;
|
|
150
|
+
function createAgentRunner(execute, options) {
|
|
151
|
+
const attachmentStorage = options?.attachmentStorage;
|
|
152
|
+
const streamFn = options?.streamFn;
|
|
153
|
+
const tracePropagation = options?.tracePropagation;
|
|
154
|
+
const bindSpawnAgent = options?.bindSpawnAgent;
|
|
155
|
+
const canBindSpawn = Boolean(bindSpawnAgent) && isExperimentalFeatureEnabled("subagents");
|
|
156
|
+
return {
|
|
157
|
+
run: async (run) => {
|
|
158
|
+
const spawnAgent = bindSpawnAgent && canBindSpawn && !isAgentRunFeatureDisabled(run.disabledFeatures, "subagents") ? bindSpawnAgent(run) : void 0;
|
|
159
|
+
const nextRun = {
|
|
160
|
+
...run,
|
|
161
|
+
environment: {
|
|
162
|
+
...run.environment,
|
|
163
|
+
attachmentStorage: run.environment?.attachmentStorage ?? attachmentStorage,
|
|
164
|
+
sandboxTracePropagation: run.environment?.sandboxTracePropagation ?? tracePropagation
|
|
165
|
+
},
|
|
166
|
+
...spawnAgent ? {
|
|
167
|
+
durability: {
|
|
168
|
+
...run.durability,
|
|
169
|
+
spawnAgent
|
|
170
|
+
}
|
|
171
|
+
} : void 0
|
|
172
|
+
};
|
|
173
|
+
return await execute(nextRun, streamFn);
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
async function waitForAgentSettlement(runPromise) {
|
|
178
|
+
let timeoutId;
|
|
179
|
+
const settleGrace = new Promise((resolve) => {
|
|
180
|
+
timeoutId = setTimeout(resolve, AGENT_ABORT_SETTLE_GRACE_MS);
|
|
181
|
+
timeoutId.unref?.();
|
|
182
|
+
});
|
|
183
|
+
await Promise.race([
|
|
184
|
+
runPromise.then(
|
|
185
|
+
() => void 0,
|
|
186
|
+
() => void 0
|
|
187
|
+
),
|
|
188
|
+
settleGrace
|
|
189
|
+
]);
|
|
190
|
+
if (timeoutId) {
|
|
191
|
+
clearTimeout(timeoutId);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
async function runAgentWithTimeout(agentRunner, run, timeoutMs) {
|
|
195
|
+
if (typeof timeoutMs !== "number") {
|
|
196
|
+
return await agentRunner.run(run);
|
|
197
|
+
}
|
|
198
|
+
const timeoutError = new Error(
|
|
199
|
+
`executeAgentRun timed out after ${timeoutMs}ms`
|
|
200
|
+
);
|
|
201
|
+
const abortController = new AbortController();
|
|
202
|
+
const signal = run.signal ? AbortSignal.any([run.signal, abortController.signal]) : abortController.signal;
|
|
203
|
+
const runPromise = agentRunner.run({ ...run, signal });
|
|
204
|
+
let timeoutId;
|
|
205
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
206
|
+
timeoutId = setTimeout(() => {
|
|
207
|
+
abortController.abort(timeoutError);
|
|
208
|
+
reject(timeoutError);
|
|
209
|
+
}, timeoutMs);
|
|
210
|
+
});
|
|
211
|
+
try {
|
|
212
|
+
return await Promise.race([runPromise, timeoutPromise]);
|
|
213
|
+
} catch (error) {
|
|
214
|
+
if (abortController.signal.aborted) {
|
|
215
|
+
await waitForAgentSettlement(runPromise);
|
|
216
|
+
}
|
|
217
|
+
throw error;
|
|
218
|
+
} finally {
|
|
219
|
+
if (timeoutId) {
|
|
220
|
+
clearTimeout(timeoutId);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
30
224
|
|
|
31
225
|
// src/chat/slack/outbound.ts
|
|
32
226
|
var MAX_SLACK_MESSAGE_TEXT_CHARS = 4e4;
|
|
@@ -705,6 +899,12 @@ async function startOAuthFlow(provider, input) {
|
|
|
705
899
|
}
|
|
706
900
|
|
|
707
901
|
export {
|
|
902
|
+
RetryableDeliveryError,
|
|
903
|
+
isAgentRunFeatureDisabled,
|
|
904
|
+
actorFromRun,
|
|
905
|
+
assertRunConsistency,
|
|
906
|
+
toolInvocationDestination,
|
|
907
|
+
surfaceFromRun,
|
|
708
908
|
getSlackMessagePermalink,
|
|
709
909
|
postSlackMessage,
|
|
710
910
|
uploadFilesToConversation,
|
|
@@ -719,5 +919,7 @@ export {
|
|
|
719
919
|
formatProviderLabel,
|
|
720
920
|
resolveBaseUrl,
|
|
721
921
|
deliverOAuthAuthorization,
|
|
722
|
-
startOAuthFlow
|
|
922
|
+
startOAuthFlow,
|
|
923
|
+
createAgentRunner,
|
|
924
|
+
runAgentWithTimeout
|
|
723
925
|
};
|