@sentry/junior 0.202.0 → 0.204.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-CMyTD4DD.js +17509 -0
- package/dist/agent-hooks-Bbcp9e33.js +4040 -0
- package/dist/agent-runner-DNb1A49M.js +678 -0
- package/dist/api/schema.d.ts +2728 -2639
- package/dist/api/schema.js +4 -169
- package/dist/api.d.ts +23 -17
- package/dist/api.js +3881 -5326
- package/dist/app-B1TOqBI8.d.ts +246 -0
- package/dist/app.d.ts +4 -520
- package/dist/app.js +9522 -11875
- package/dist/auth-pause-state-DosEalIG.js +168 -0
- package/dist/catalog-runtime-BReos-D4.js +7 -0
- package/dist/checkpoint-CNrPyRJN.js +2450 -0
- package/dist/cli/chat.d.ts +20 -0
- package/dist/cli/chat.js +229 -336
- package/dist/cli/check.d.ts +8 -0
- package/dist/cli/check.js +513 -806
- package/dist/cli/env.d.ts +13 -0
- package/dist/cli/env.js +63 -12
- package/dist/cli/init.d.ts +3 -0
- package/dist/cli/init.js +90 -159
- package/dist/cli/main.d.ts +6 -0
- package/dist/cli/main.js +43 -64
- package/dist/cli/plugins.d.ts +13 -0
- package/dist/cli/plugins.js +148 -227
- package/dist/cli/run.d.ts +16 -0
- package/dist/cli/run.js +52 -8
- package/dist/cli/snapshot-create.d.ts +4 -0
- package/dist/cli/snapshot-create.js +71 -125
- package/dist/cli/upgrade.d.ts +15 -0
- package/dist/cli/upgrade.js +232 -335
- package/dist/config-nGCW1OTG.js +941 -0
- package/dist/context-B45_WqVX.js +298 -0
- package/dist/conversation-privacy-B4voFRSm.js +182 -0
- package/dist/conversation-work-C6y3T5Hx.js +51 -0
- package/dist/credential-sync-kXr1hvO1.js +2660 -0
- package/dist/db-BeyXKJOI.d.ts +5 -0
- package/dist/destinations-BeBiJeEM.js +29 -0
- package/dist/execution-stats-DWfSihcH.js +373 -0
- package/dist/executor-DcMSlI5c.js +721 -0
- package/dist/experimental-CIXf7Uye.js +46 -0
- package/dist/history-ClE4toxe.d.ts +32 -0
- package/dist/history-CqTuSAdI.js +441 -0
- package/dist/instrumentation.d.ts +3 -3
- package/dist/instrumentation.js +130 -176
- package/dist/job-queue-Drn_LXlM.js +63 -0
- package/dist/logging-BzAk1S_s.js +1210 -0
- package/dist/model-profile-CZmVoGdX.js +49 -0
- package/dist/nitro.d.ts +31 -36
- package/dist/nitro.js +275 -456
- package/dist/oauth-callback-server-JiftokvA.js +130 -0
- package/dist/oauth-relay-CdCnu80W.js +62 -0
- package/dist/package-discovery-7a9YqLhE.js +455 -0
- package/dist/pending-auth-CWmSdZVg.js +185 -0
- package/dist/plugin-module-BKGOXca2.js +81 -0
- package/dist/plugins-BI9A1vKA.d.ts +95 -0
- package/dist/plugins-egKWjgue.js +99 -0
- package/dist/private-trace-result-BLvBjy_e.js +16 -0
- package/dist/profile-CrT5nXbw.js +861 -0
- package/dist/registry-DH1xUo2N.js +1419 -0
- package/dist/reporting-schema-DosTN__Q.js +105 -0
- package/dist/resolve-CZHnfxaS.js +546 -0
- package/dist/rolldown-runtime-B4FMCO8f.js +28 -0
- package/dist/runner-CZV2sC46.js +392 -0
- package/dist/sandbox-egress-signals-bHZfmhbd.js +46 -0
- package/dist/schema-Rn8-XEaN.js +1140 -0
- package/dist/sentry-CD3SdJl-.js +26 -0
- package/dist/skills-CIcDQSgM.js +316 -0
- package/dist/spawn-DdkUFRmq.js +29 -0
- package/dist/stats-DTUbAb88.js +2634 -0
- package/dist/store-C5qxF2ac.d.ts +208 -0
- package/dist/task-queue-CJIR4RF7.js +136 -0
- package/dist/task-runner-D-O3A-Cp.js +639 -0
- package/dist/thread-state-CRc9jTJS.js +431 -0
- package/dist/turn-execution-BkinIdJF.js +47 -0
- package/dist/turn-lifecycle-DQV19VTW.js +54 -0
- package/dist/usage-D3EbSO7w.js +296 -0
- package/dist/usage-schema-CKaDkH_j.js +20 -0
- package/dist/validation-C2CR-OX3.js +40 -0
- package/dist/vercel-queue-DIkVcfK4.js +167 -0
- package/dist/vercel.d.ts +6 -6
- package/dist/vercel.js +14 -6
- package/dist/version-CnXZ614E.d.ts +5 -0
- package/dist/version-DxcWdoKa.js +8 -0
- package/dist/version.d.ts +2 -4
- package/dist/version.js +2 -6
- package/dist/web-authorization-RMBxAR_t.js +76 -0
- package/dist/web-input-3EPfpf55.js +494 -0
- package/dist/work-fGofI7Op.js +509 -0
- package/dist/worker-CsOLq-mR.js +625 -0
- package/package.json +9 -9
- package/dist/agent-hooks-UXITLYOK.js +0 -51
- package/dist/catalog-runtime-BG3JLLK2.js +0 -14
- package/dist/chunk-2LYHWMR4.js +0 -46
- package/dist/chunk-2MK3QBGA.js +0 -321
- package/dist/chunk-3PGQSKJV.js +0 -692
- package/dist/chunk-3UI3WFTX.js +0 -519
- package/dist/chunk-3Y47VMHV.js +0 -6
- package/dist/chunk-4UO6FK4G.js +0 -64
- package/dist/chunk-5NOPO64K.js +0 -198
- package/dist/chunk-5PKWYPFT.js +0 -2943
- package/dist/chunk-63NKKFJL.js +0 -1228
- package/dist/chunk-6AYH6252.js +0 -787
- package/dist/chunk-6Y5B5PEX.js +0 -80
- package/dist/chunk-7DHZP5KJ.js +0 -333
- package/dist/chunk-7H2VZTWN.js +0 -103
- package/dist/chunk-7NL7T6VU.js +0 -406
- package/dist/chunk-A76OIMYN.js +0 -102
- package/dist/chunk-AWMS3SPP.js +0 -58
- package/dist/chunk-B3LY5RCL.js +0 -229
- package/dist/chunk-BD2KT3OB.js +0 -36
- package/dist/chunk-BXCX5QKA.js +0 -2086
- package/dist/chunk-C6VVF43U.js +0 -81
- package/dist/chunk-CEMMLV5L.js +0 -98
- package/dist/chunk-CM5HNV2W.js +0 -131
- package/dist/chunk-DA2KGZZI.js +0 -13
- package/dist/chunk-DBVY6HLX.js +0 -64
- package/dist/chunk-DIB4GX3G.js +0 -8
- package/dist/chunk-DKIJ2RP5.js +0 -68
- package/dist/chunk-DL2KLKVH.js +0 -931
- package/dist/chunk-DWPN6SCH.js +0 -172
- package/dist/chunk-ELWOYVOY.js +0 -206
- package/dist/chunk-EWT7H65X.js +0 -506
- package/dist/chunk-FA6POGLH.js +0 -70
- package/dist/chunk-HMREVIO2.js +0 -135
- package/dist/chunk-IIWUT4FO.js +0 -820
- package/dist/chunk-JAL3CH4G.js +0 -27
- package/dist/chunk-JSJQEWBJ.js +0 -3295
- package/dist/chunk-KHKKHDLD.js +0 -387
- package/dist/chunk-LA6R4A7Q.js +0 -706
- package/dist/chunk-LOOU2DUR.js +0 -20428
- package/dist/chunk-M6FHWXE3.js +0 -700
- package/dist/chunk-M76HMB7M.js +0 -1856
- package/dist/chunk-MAGNK5J4.js +0 -1520
- package/dist/chunk-MTM5IFCY.js +0 -1190
- package/dist/chunk-N7TMSOZH.js +0 -235
- package/dist/chunk-NHJU2ZAL.js +0 -56
- package/dist/chunk-NSXKRGRT.js +0 -717
- package/dist/chunk-OWMPFXJA.js +0 -1764
- package/dist/chunk-PDO5BLNM.js +0 -22
- package/dist/chunk-PEQXYSSE.js +0 -45
- package/dist/chunk-PW4P4JYF.js +0 -1135
- package/dist/chunk-QB54UQUS.js +0 -320
- package/dist/chunk-QP3OGJXF.js +0 -105
- package/dist/chunk-RC745GGZ.js +0 -122
- package/dist/chunk-REOIRYPR.js +0 -37
- package/dist/chunk-SCOZRLZ4.js +0 -164
- package/dist/chunk-TXJSXBV5.js +0 -1433
- package/dist/chunk-TXKUKMVO.js +0 -417
- package/dist/chunk-U2GPUYAL.js +0 -3656
- package/dist/chunk-UIE3R5XU.js +0 -17
- package/dist/chunk-UXPG6ZIN.js +0 -84
- package/dist/chunk-VFUK3X5B.js +0 -50
- package/dist/chunk-WQSHDTTI.js +0 -1163
- package/dist/chunk-X6GDDWQH.js +0 -60
- package/dist/chunk-Y2CM7HXH.js +0 -111
- package/dist/chunk-Y7X25LFY.js +0 -15
- package/dist/chunk-YDUR3ZYW.js +0 -10
- package/dist/conversation-work-VIOQ5ZF3.js +0 -54
- package/dist/db-3L2MCVRI.js +0 -26
- package/dist/discovery-DWVDM7UK.js +0 -44
- package/dist/experimental-P5FZM4CU.js +0 -12
- package/dist/oauth-callback-server-YVV6C6T2.js +0 -243
- package/dist/oauth-relay-5XPVRPYB.js +0 -8
- package/dist/plugins-YTYJMMJF.js +0 -14
- package/dist/runner-LQ7RETDP.js +0 -522
- package/dist/sandbox-egress-signals-FIL7EGPR.js +0 -73
- package/dist/sentry-MB3NL3IR.js +0 -42
- package/dist/skills-XRWYEDCD.js +0 -27
- package/dist/spawn-RC6SJUAI.js +0 -42
- package/dist/task-runner-7DY7ARYH.js +0 -36
- package/dist/validation-7MNQGCJA.js +0 -17
- package/dist/work-COALHUCG.js +0 -51
- package/dist/worker-6MURZIPD.js +0 -24
package/dist/chunk-7NL7T6VU.js
DELETED
|
@@ -1,406 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TURN_REASONING_LEVELS,
|
|
3
|
-
modelProfileSchema
|
|
4
|
-
} from "./chunk-NHJU2ZAL.js";
|
|
5
|
-
|
|
6
|
-
// src/chat/conversations/provenance.ts
|
|
7
|
-
import { actorSchema } from "@sentry/junior-plugin-api";
|
|
8
|
-
import { z } from "zod";
|
|
9
|
-
var conversationMessageAuthoritySchema = z.union([
|
|
10
|
-
z.literal("instruction"),
|
|
11
|
-
z.literal("context")
|
|
12
|
-
]);
|
|
13
|
-
var conversationMessageProvenanceSchema = z.object({
|
|
14
|
-
authority: conversationMessageAuthoritySchema,
|
|
15
|
-
actor: actorSchema.optional()
|
|
16
|
-
}).strict();
|
|
17
|
-
function instructionProvenanceFor(actor) {
|
|
18
|
-
return actor ? { authority: "instruction", actor } : { authority: "instruction" };
|
|
19
|
-
}
|
|
20
|
-
var contextProvenance = {
|
|
21
|
-
authority: "context"
|
|
22
|
-
};
|
|
23
|
-
function actorIdentityKey(actor) {
|
|
24
|
-
if (actor.platform === "system") {
|
|
25
|
-
return `system ${actor.name}`;
|
|
26
|
-
}
|
|
27
|
-
return actor.platform === "slack" ? `slack\0${actor.teamId}\0${actor.userId}` : `${actor.platform}\0${actor.userId}`;
|
|
28
|
-
}
|
|
29
|
-
function sameActorIdentity(left, right) {
|
|
30
|
-
return Boolean(
|
|
31
|
-
left && right && actorIdentityKey(left) === actorIdentityKey(right)
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
function instructionActors(provenance) {
|
|
35
|
-
const seen = /* @__PURE__ */ new Set();
|
|
36
|
-
const actors = [];
|
|
37
|
-
for (const entry of provenance) {
|
|
38
|
-
if (entry.authority !== "instruction" || !entry.actor) {
|
|
39
|
-
continue;
|
|
40
|
-
}
|
|
41
|
-
const identity = actorIdentityKey(entry.actor);
|
|
42
|
-
if (seen.has(identity)) {
|
|
43
|
-
continue;
|
|
44
|
-
}
|
|
45
|
-
seen.add(identity);
|
|
46
|
-
actors.push(entry.actor);
|
|
47
|
-
}
|
|
48
|
-
return actors;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// src/chat/conversations/history.ts
|
|
52
|
-
import { z as z2 } from "zod";
|
|
53
|
-
var userMessageEventDataSchema = z2.object({
|
|
54
|
-
type: z2.literal("user_message"),
|
|
55
|
-
role: z2.never().optional(),
|
|
56
|
-
provenance: conversationMessageProvenanceSchema
|
|
57
|
-
}).passthrough();
|
|
58
|
-
var assistantMessageEventDataSchema = z2.object({
|
|
59
|
-
type: z2.literal("assistant_message"),
|
|
60
|
-
role: z2.never().optional()
|
|
61
|
-
}).passthrough();
|
|
62
|
-
var toolResultEventDataSchema = z2.object({
|
|
63
|
-
type: z2.literal("tool_result"),
|
|
64
|
-
role: z2.never().optional()
|
|
65
|
-
}).passthrough();
|
|
66
|
-
var agentHistoryItemSchema = z2.discriminatedUnion("type", [
|
|
67
|
-
userMessageEventDataSchema,
|
|
68
|
-
assistantMessageEventDataSchema,
|
|
69
|
-
toolResultEventDataSchema
|
|
70
|
-
]);
|
|
71
|
-
var nativeReplacementHistoryItemSchema = z2.object({
|
|
72
|
-
item: agentHistoryItemSchema,
|
|
73
|
-
// Preserve the copied item's position when a turn resumes. Synthetic
|
|
74
|
-
// summary and handoff items have no source event.
|
|
75
|
-
sourceEventSeq: z2.number().int().nonnegative().optional()
|
|
76
|
-
}).strict();
|
|
77
|
-
var replacementHistorySchema = z2.array(nativeReplacementHistoryItemSchema);
|
|
78
|
-
var compactionDetailsSchema = z2.object({
|
|
79
|
-
reason: z2.literal("capacity"),
|
|
80
|
-
estimatedInputTokens: z2.number().int().nonnegative(),
|
|
81
|
-
replacementInputTokens: z2.number().int().nonnegative().optional(),
|
|
82
|
-
triggerTokens: z2.number().int().nonnegative(),
|
|
83
|
-
inputLimitTokens: z2.number().int().positive(),
|
|
84
|
-
inputMessageCount: z2.number().int().nonnegative(),
|
|
85
|
-
retainedMessageCount: z2.number().int().nonnegative(),
|
|
86
|
-
summaryChars: z2.number().int().nonnegative()
|
|
87
|
-
}).strict();
|
|
88
|
-
var historyReplacementEventDataSchema = z2.discriminatedUnion("type", [
|
|
89
|
-
z2.object({
|
|
90
|
-
type: z2.literal("handoff"),
|
|
91
|
-
modelProfile: modelProfileSchema,
|
|
92
|
-
modelId: z2.string().min(1),
|
|
93
|
-
reasoningLevel: z2.string().min(1).optional(),
|
|
94
|
-
triggeringToolCallId: z2.string().min(1).optional(),
|
|
95
|
-
summary: z2.string().min(1).optional(),
|
|
96
|
-
replacementHistory: replacementHistorySchema
|
|
97
|
-
}).strict(),
|
|
98
|
-
z2.object({
|
|
99
|
-
type: z2.literal("compaction"),
|
|
100
|
-
modelProfile: modelProfileSchema,
|
|
101
|
-
modelId: z2.string().min(1),
|
|
102
|
-
details: compactionDetailsSchema.optional(),
|
|
103
|
-
summary: z2.string().min(1).optional(),
|
|
104
|
-
replacementHistory: replacementHistorySchema
|
|
105
|
-
}).strict()
|
|
106
|
-
]);
|
|
107
|
-
var historyReplacementSchema = z2.object({
|
|
108
|
-
data: historyReplacementEventDataSchema,
|
|
109
|
-
createdAtMs: z2.number().finite()
|
|
110
|
-
}).strict();
|
|
111
|
-
var mcpProviderConnectedEventDataSchema = z2.object({
|
|
112
|
-
type: z2.literal("mcp_provider_connected"),
|
|
113
|
-
provider: z2.string().min(1),
|
|
114
|
-
credentialSubjectId: z2.string().min(1)
|
|
115
|
-
}).strict();
|
|
116
|
-
var unownedMcpProviderConnectedEventDataSchema = z2.object({
|
|
117
|
-
type: z2.literal("mcp_provider_connected_unowned"),
|
|
118
|
-
provider: z2.string().min(1)
|
|
119
|
-
}).strict();
|
|
120
|
-
var authorizationKindSchema = z2.union([
|
|
121
|
-
z2.literal("plugin"),
|
|
122
|
-
z2.literal("mcp")
|
|
123
|
-
]);
|
|
124
|
-
var authorizationRequestedEventDataSchema = z2.object({
|
|
125
|
-
type: z2.literal("authorization_requested"),
|
|
126
|
-
kind: authorizationKindSchema,
|
|
127
|
-
provider: z2.string().min(1),
|
|
128
|
-
actorId: z2.string().min(1),
|
|
129
|
-
authorizationId: z2.string().min(1),
|
|
130
|
-
delivery: z2.union([
|
|
131
|
-
z2.literal("private_link_sent"),
|
|
132
|
-
z2.literal("private_link_reused")
|
|
133
|
-
])
|
|
134
|
-
}).strict();
|
|
135
|
-
var authorizationCompletedEventDataSchema = z2.object({
|
|
136
|
-
type: z2.literal("authorization_completed"),
|
|
137
|
-
kind: authorizationKindSchema,
|
|
138
|
-
provider: z2.string().min(1),
|
|
139
|
-
actorId: z2.string().min(1),
|
|
140
|
-
authorizationId: z2.string().min(1)
|
|
141
|
-
}).strict();
|
|
142
|
-
var toolExecutionStartedEventDataSchema = z2.object({
|
|
143
|
-
type: z2.literal("tool_execution_started"),
|
|
144
|
-
toolCallId: z2.string().min(1),
|
|
145
|
-
toolName: z2.string().min(1)
|
|
146
|
-
}).strict();
|
|
147
|
-
var guardianActionReviewedEventDataSchema = z2.object({
|
|
148
|
-
type: z2.literal("guardian_action_reviewed"),
|
|
149
|
-
turnId: z2.string().min(1),
|
|
150
|
-
toolCallId: z2.string().min(1),
|
|
151
|
-
toolName: z2.string().min(1),
|
|
152
|
-
costUsd: z2.number().finite().nonnegative().optional(),
|
|
153
|
-
decision: z2.enum(["allow", "ask", "deny"]),
|
|
154
|
-
riskLevel: z2.enum(["low", "medium", "high", "critical"]),
|
|
155
|
-
userAuthorization: z2.enum(["high", "medium", "low", "unknown"])
|
|
156
|
-
}).strict();
|
|
157
|
-
var conversationMessageRoleSchema = z2.union([
|
|
158
|
-
z2.literal("user"),
|
|
159
|
-
z2.literal("assistant"),
|
|
160
|
-
z2.literal("system")
|
|
161
|
-
]);
|
|
162
|
-
var messageEventDataSchema = z2.object({
|
|
163
|
-
type: z2.literal("message"),
|
|
164
|
-
messageId: z2.string().min(1),
|
|
165
|
-
role: conversationMessageRoleSchema,
|
|
166
|
-
text: z2.string(),
|
|
167
|
-
authorIdentityId: z2.string().min(1).optional(),
|
|
168
|
-
meta: z2.record(z2.string(), z2.unknown()).optional()
|
|
169
|
-
}).strict();
|
|
170
|
-
var messageUpdatedEventDataSchema = messageEventDataSchema.extend({
|
|
171
|
-
type: z2.literal("message_updated")
|
|
172
|
-
});
|
|
173
|
-
var messageHandledEventDataSchema = z2.object({
|
|
174
|
-
type: z2.literal("message_handled"),
|
|
175
|
-
messageId: z2.string().min(1)
|
|
176
|
-
}).strict();
|
|
177
|
-
var messagesSummarizedEventDataSchema = z2.object({
|
|
178
|
-
type: z2.literal("messages_summarized"),
|
|
179
|
-
historyFromSeq: z2.number().int().nonnegative(),
|
|
180
|
-
compactions: z2.array(
|
|
181
|
-
z2.object({
|
|
182
|
-
coveredMessageCount: z2.number().int().nonnegative(),
|
|
183
|
-
createdAtMs: z2.number(),
|
|
184
|
-
id: z2.string().min(1),
|
|
185
|
-
summary: z2.string()
|
|
186
|
-
}).strict()
|
|
187
|
-
)
|
|
188
|
-
}).strict();
|
|
189
|
-
var conversationTurnSurfaceSchema = z2.enum([
|
|
190
|
-
"slack",
|
|
191
|
-
"api",
|
|
192
|
-
"scheduler",
|
|
193
|
-
"internal"
|
|
194
|
-
]);
|
|
195
|
-
var conversationTurnFailureCodeSchema = z2.enum([
|
|
196
|
-
"agent_run_failed",
|
|
197
|
-
"delivery_failed",
|
|
198
|
-
"model_execution_failed",
|
|
199
|
-
"persistence_failed"
|
|
200
|
-
]);
|
|
201
|
-
var conversationTurnFailureReasonSchema = z2.enum([
|
|
202
|
-
"auth",
|
|
203
|
-
"permission",
|
|
204
|
-
"rate_limit",
|
|
205
|
-
"capacity",
|
|
206
|
-
"timeout",
|
|
207
|
-
"network",
|
|
208
|
-
"server",
|
|
209
|
-
"invalid_request",
|
|
210
|
-
"invalid_response",
|
|
211
|
-
"quota",
|
|
212
|
-
"content_policy",
|
|
213
|
-
"unknown",
|
|
214
|
-
"empty_output",
|
|
215
|
-
"tool_errors",
|
|
216
|
-
"suppressed_output"
|
|
217
|
-
]);
|
|
218
|
-
var turnStartedEventDataSchema = z2.object({
|
|
219
|
-
type: z2.literal("turn_started"),
|
|
220
|
-
turnId: z2.string().min(1),
|
|
221
|
-
inputMessageIds: z2.array(z2.string().min(1)).min(1),
|
|
222
|
-
surface: conversationTurnSurfaceSchema
|
|
223
|
-
}).strict().refine(
|
|
224
|
-
(data) => new Set(data.inputMessageIds).size === data.inputMessageIds.length,
|
|
225
|
-
"turn input message ids must be unique"
|
|
226
|
-
);
|
|
227
|
-
var turnRoutedEventDataSchema = z2.object({
|
|
228
|
-
type: z2.literal("turn_routed"),
|
|
229
|
-
turnId: z2.string().min(1),
|
|
230
|
-
modelProfile: modelProfileSchema,
|
|
231
|
-
modelId: z2.string().min(1),
|
|
232
|
-
costUsd: z2.number().finite().nonnegative().optional(),
|
|
233
|
-
reasoningLevel: z2.enum(TURN_REASONING_LEVELS),
|
|
234
|
-
confidence: z2.number().min(0).max(1).optional(),
|
|
235
|
-
source: z2.enum(["configured", "inherited", "router"])
|
|
236
|
-
}).strict();
|
|
237
|
-
var turnContextEventDataSchema = z2.object({
|
|
238
|
-
type: z2.literal("turn_context"),
|
|
239
|
-
turnId: z2.string().min(1),
|
|
240
|
-
pluginName: z2.string().min(1),
|
|
241
|
-
kind: z2.string().min(1).max(64),
|
|
242
|
-
version: z2.number().int().positive(),
|
|
243
|
-
content: z2.record(z2.string(), z2.unknown())
|
|
244
|
-
}).strict();
|
|
245
|
-
var structuredConversationEventDataSchema = z2.object({
|
|
246
|
-
type: z2.literal("structured_event"),
|
|
247
|
-
namespace: z2.string().regex(/^[a-z][a-z0-9-]*$/),
|
|
248
|
-
name: z2.string().regex(/^[a-z][a-z0-9_]*$/),
|
|
249
|
-
version: z2.number().int().positive(),
|
|
250
|
-
turnId: z2.string().min(1).optional(),
|
|
251
|
-
content: z2.record(z2.string(), z2.unknown())
|
|
252
|
-
}).strict();
|
|
253
|
-
var deliveredAttachmentSchema = z2.object({
|
|
254
|
-
id: z2.string().min(1),
|
|
255
|
-
filename: z2.string().min(1),
|
|
256
|
-
contentType: z2.string().min(1),
|
|
257
|
-
bytes: z2.number().int().nonnegative()
|
|
258
|
-
}).strict();
|
|
259
|
-
var attachmentsDeliveredEventDataSchema = z2.object({
|
|
260
|
-
type: z2.literal("attachments_delivered"),
|
|
261
|
-
attachments: z2.array(deliveredAttachmentSchema).min(1),
|
|
262
|
-
toolCallId: z2.string().min(1).optional(),
|
|
263
|
-
turnId: z2.string().min(1).optional()
|
|
264
|
-
}).strict();
|
|
265
|
-
var turnCompletedEventDataSchema = z2.object({
|
|
266
|
-
type: z2.literal("turn_completed"),
|
|
267
|
-
turnId: z2.string().min(1),
|
|
268
|
-
outcome: z2.enum(["success", "no_reply", "cancelled"])
|
|
269
|
-
}).strict();
|
|
270
|
-
var turnFailedEventDataSchema = z2.object({
|
|
271
|
-
type: z2.literal("turn_failed"),
|
|
272
|
-
turnId: z2.string().min(1),
|
|
273
|
-
failureCode: conversationTurnFailureCodeSchema,
|
|
274
|
-
failureReason: conversationTurnFailureReasonSchema.optional(),
|
|
275
|
-
eventId: z2.string().regex(/^[a-f0-9]{32}$/i).optional()
|
|
276
|
-
}).strict();
|
|
277
|
-
var subagentStartedEventDataSchema = z2.object({
|
|
278
|
-
type: z2.literal("subagent_started"),
|
|
279
|
-
subagentInvocationId: z2.string().min(1),
|
|
280
|
-
subagentKind: z2.string().min(1),
|
|
281
|
-
modelId: z2.string().min(1).optional(),
|
|
282
|
-
parentToolCallId: z2.string().min(1).optional(),
|
|
283
|
-
reasoningLevel: z2.string().min(1).optional(),
|
|
284
|
-
childConversationId: z2.string().min(1)
|
|
285
|
-
}).strict();
|
|
286
|
-
var subagentEndedEventDataSchema = z2.object({
|
|
287
|
-
type: z2.literal("subagent_ended"),
|
|
288
|
-
subagentInvocationId: z2.string().min(1),
|
|
289
|
-
outcome: z2.union([
|
|
290
|
-
z2.literal("success"),
|
|
291
|
-
z2.literal("error"),
|
|
292
|
-
z2.literal("aborted")
|
|
293
|
-
]),
|
|
294
|
-
errorCode: z2.string().min(1).optional()
|
|
295
|
-
}).strict();
|
|
296
|
-
var appendableConversationEventDataSchema = z2.union([
|
|
297
|
-
messageEventDataSchema,
|
|
298
|
-
messageUpdatedEventDataSchema,
|
|
299
|
-
agentHistoryItemSchema,
|
|
300
|
-
mcpProviderConnectedEventDataSchema,
|
|
301
|
-
authorizationRequestedEventDataSchema,
|
|
302
|
-
authorizationCompletedEventDataSchema,
|
|
303
|
-
toolExecutionStartedEventDataSchema,
|
|
304
|
-
guardianActionReviewedEventDataSchema,
|
|
305
|
-
messageHandledEventDataSchema,
|
|
306
|
-
messagesSummarizedEventDataSchema,
|
|
307
|
-
turnStartedEventDataSchema,
|
|
308
|
-
turnContextEventDataSchema,
|
|
309
|
-
structuredConversationEventDataSchema,
|
|
310
|
-
attachmentsDeliveredEventDataSchema,
|
|
311
|
-
turnRoutedEventDataSchema,
|
|
312
|
-
turnCompletedEventDataSchema,
|
|
313
|
-
turnFailedEventDataSchema,
|
|
314
|
-
subagentStartedEventDataSchema,
|
|
315
|
-
subagentEndedEventDataSchema
|
|
316
|
-
]);
|
|
317
|
-
var conversationEventDataSchema = z2.union([
|
|
318
|
-
appendableConversationEventDataSchema,
|
|
319
|
-
historyReplacementEventDataSchema,
|
|
320
|
-
unownedMcpProviderConnectedEventDataSchema
|
|
321
|
-
]);
|
|
322
|
-
var KNOWN_CONVERSATION_EVENT_TYPES = [
|
|
323
|
-
"message",
|
|
324
|
-
"message_updated",
|
|
325
|
-
"user_message",
|
|
326
|
-
"assistant_message",
|
|
327
|
-
"tool_result",
|
|
328
|
-
"mcp_provider_connected",
|
|
329
|
-
"mcp_provider_connected_unowned",
|
|
330
|
-
"authorization_requested",
|
|
331
|
-
"authorization_completed",
|
|
332
|
-
"tool_execution_started",
|
|
333
|
-
"guardian_action_reviewed",
|
|
334
|
-
"message_handled",
|
|
335
|
-
"messages_summarized",
|
|
336
|
-
"turn_started",
|
|
337
|
-
"turn_context",
|
|
338
|
-
"structured_event",
|
|
339
|
-
"attachments_delivered",
|
|
340
|
-
"turn_routed",
|
|
341
|
-
"turn_completed",
|
|
342
|
-
"turn_failed",
|
|
343
|
-
"subagent_started",
|
|
344
|
-
"subagent_ended",
|
|
345
|
-
"handoff",
|
|
346
|
-
"compaction"
|
|
347
|
-
];
|
|
348
|
-
var knownConversationEventTypeSchema = z2.enum(KNOWN_CONVERSATION_EVENT_TYPES);
|
|
349
|
-
var unknownConversationEventDataSchema = z2.object({
|
|
350
|
-
type: z2.literal("unknown"),
|
|
351
|
-
originalType: z2.string().min(1),
|
|
352
|
-
payload: z2.unknown()
|
|
353
|
-
}).strict();
|
|
354
|
-
var conversationEventEnvelopeSchema = z2.object({
|
|
355
|
-
schemaVersion: z2.number().int().nonnegative(),
|
|
356
|
-
seq: z2.number().int().nonnegative(),
|
|
357
|
-
historyVersion: z2.number().int().nonnegative(),
|
|
358
|
-
idempotencyKey: z2.string().min(1).optional(),
|
|
359
|
-
createdAtMs: z2.number().finite()
|
|
360
|
-
}).strict();
|
|
361
|
-
var conversationEventSchema = z2.union([
|
|
362
|
-
conversationEventEnvelopeSchema.extend({
|
|
363
|
-
schemaVersion: z2.literal(1),
|
|
364
|
-
data: conversationEventDataSchema
|
|
365
|
-
}),
|
|
366
|
-
conversationEventEnvelopeSchema.extend({
|
|
367
|
-
data: unknownConversationEventDataSchema
|
|
368
|
-
})
|
|
369
|
-
]);
|
|
370
|
-
var storedConversationEventSchema = conversationEventEnvelopeSchema.extend({
|
|
371
|
-
type: z2.string().min(1),
|
|
372
|
-
payload: z2.unknown()
|
|
373
|
-
});
|
|
374
|
-
function decodeStoredConversationEvent(value) {
|
|
375
|
-
const stored = storedConversationEventSchema.parse(value);
|
|
376
|
-
const { type, payload, ...envelope } = stored;
|
|
377
|
-
const knownType = knownConversationEventTypeSchema.safeParse(type).success;
|
|
378
|
-
if (stored.schemaVersion === 1 && knownType) {
|
|
379
|
-
const data = typeof payload === "object" && payload !== null && !Array.isArray(payload) ? { ...payload, type } : { type };
|
|
380
|
-
return conversationEventSchema.parse({ ...envelope, data });
|
|
381
|
-
}
|
|
382
|
-
return conversationEventSchema.parse({
|
|
383
|
-
...envelope,
|
|
384
|
-
data: { type: "unknown", originalType: type, payload }
|
|
385
|
-
});
|
|
386
|
-
}
|
|
387
|
-
var newConversationEventSchema = z2.object({
|
|
388
|
-
data: appendableConversationEventDataSchema,
|
|
389
|
-
idempotencyKey: z2.string().min(1).optional(),
|
|
390
|
-
createdAtMs: z2.number().finite()
|
|
391
|
-
}).strict();
|
|
392
|
-
|
|
393
|
-
export {
|
|
394
|
-
instructionProvenanceFor,
|
|
395
|
-
contextProvenance,
|
|
396
|
-
sameActorIdentity,
|
|
397
|
-
instructionActors,
|
|
398
|
-
agentHistoryItemSchema,
|
|
399
|
-
historyReplacementSchema,
|
|
400
|
-
conversationTurnFailureCodeSchema,
|
|
401
|
-
conversationTurnFailureReasonSchema,
|
|
402
|
-
conversationEventDataSchema,
|
|
403
|
-
KNOWN_CONVERSATION_EVENT_TYPES,
|
|
404
|
-
decodeStoredConversationEvent,
|
|
405
|
-
newConversationEventSchema
|
|
406
|
-
};
|
package/dist/chunk-A76OIMYN.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
parseSlackChannelId,
|
|
3
|
-
parseSlackMessageTs,
|
|
4
|
-
parseSlackTeamId
|
|
5
|
-
} from "./chunk-N7TMSOZH.js";
|
|
6
|
-
import {
|
|
7
|
-
toOptionalString
|
|
8
|
-
} from "./chunk-MAGNK5J4.js";
|
|
9
|
-
|
|
10
|
-
// src/chat/slack/context.ts
|
|
11
|
-
import { z } from "zod";
|
|
12
|
-
function toTrimmedSlackString(value) {
|
|
13
|
-
const normalized = toOptionalString(value);
|
|
14
|
-
return normalized?.trim() || void 0;
|
|
15
|
-
}
|
|
16
|
-
var slackMessageEnvelopeSchema = z.object({
|
|
17
|
-
raw: z.unknown().optional()
|
|
18
|
-
});
|
|
19
|
-
var rawSlackMessageSchema = z.object({
|
|
20
|
-
channel: z.unknown().optional(),
|
|
21
|
-
message: z.unknown().optional(),
|
|
22
|
-
team: z.unknown().optional(),
|
|
23
|
-
team_id: z.unknown().optional(),
|
|
24
|
-
thread_ts: z.unknown().optional(),
|
|
25
|
-
ts: z.unknown().optional(),
|
|
26
|
-
user_team: z.unknown().optional()
|
|
27
|
-
});
|
|
28
|
-
var nestedRawSlackMessageSchema = z.object({
|
|
29
|
-
ts: z.unknown().optional()
|
|
30
|
-
});
|
|
31
|
-
function readSlackRawMessageContext(message) {
|
|
32
|
-
const envelope = slackMessageEnvelopeSchema.safeParse(message);
|
|
33
|
-
if (!envelope.success) {
|
|
34
|
-
return void 0;
|
|
35
|
-
}
|
|
36
|
-
const raw = rawSlackMessageSchema.safeParse(envelope.data.raw);
|
|
37
|
-
if (!raw.success) {
|
|
38
|
-
return void 0;
|
|
39
|
-
}
|
|
40
|
-
const nestedMessage = nestedRawSlackMessageSchema.safeParse(raw.data.message);
|
|
41
|
-
const channelId = parseSlackChannelId(raw.data.channel);
|
|
42
|
-
const threadTs = parseSlackMessageTs(raw.data.thread_ts);
|
|
43
|
-
const messageTs = parseSlackMessageTs(raw.data.ts);
|
|
44
|
-
const nestedMessageTs = nestedMessage.success && parseSlackMessageTs(nestedMessage.data.ts);
|
|
45
|
-
const teamId = parseSlackTeamId(raw.data.team_id) ?? parseSlackTeamId(raw.data.team);
|
|
46
|
-
const authorTeamId = parseSlackTeamId(raw.data.user_team);
|
|
47
|
-
return {
|
|
48
|
-
...channelId ? { channelId } : void 0,
|
|
49
|
-
...threadTs ? { threadTs } : void 0,
|
|
50
|
-
...messageTs ? { messageTs } : void 0,
|
|
51
|
-
...nestedMessageTs ? { nestedMessageTs } : void 0,
|
|
52
|
-
...teamId ? { teamId } : void 0,
|
|
53
|
-
...authorTeamId ? { authorTeamId } : void 0
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
function parseSlackThreadId(threadId) {
|
|
57
|
-
const normalizedThreadId = toTrimmedSlackString(threadId);
|
|
58
|
-
if (!normalizedThreadId) {
|
|
59
|
-
return void 0;
|
|
60
|
-
}
|
|
61
|
-
const parts = normalizedThreadId.split(":");
|
|
62
|
-
if (parts.length !== 3 || parts[0] !== "slack") {
|
|
63
|
-
return void 0;
|
|
64
|
-
}
|
|
65
|
-
const channelId = parseSlackChannelId(parts[1]);
|
|
66
|
-
const threadTs = parseSlackMessageTs(parts[2]);
|
|
67
|
-
if (!channelId || !threadTs) {
|
|
68
|
-
return void 0;
|
|
69
|
-
}
|
|
70
|
-
return { channelId, threadTs };
|
|
71
|
-
}
|
|
72
|
-
function resolveSlackChannelIdFromThreadId(threadId) {
|
|
73
|
-
return parseSlackThreadId(threadId)?.channelId;
|
|
74
|
-
}
|
|
75
|
-
function resolveSlackChannelIdFromMessage(message) {
|
|
76
|
-
const messageChannelId = parseSlackChannelId(
|
|
77
|
-
message.channelId
|
|
78
|
-
);
|
|
79
|
-
if (messageChannelId) {
|
|
80
|
-
return messageChannelId;
|
|
81
|
-
}
|
|
82
|
-
const raw = message.raw;
|
|
83
|
-
if (raw && typeof raw === "object") {
|
|
84
|
-
const rawChannel = parseSlackChannelId(
|
|
85
|
-
raw.channel
|
|
86
|
-
);
|
|
87
|
-
if (rawChannel) {
|
|
88
|
-
return rawChannel;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
const threadId = toTrimmedSlackString(
|
|
92
|
-
message.threadId
|
|
93
|
-
);
|
|
94
|
-
return resolveSlackChannelIdFromThreadId(threadId);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export {
|
|
98
|
-
readSlackRawMessageContext,
|
|
99
|
-
parseSlackThreadId,
|
|
100
|
-
resolveSlackChannelIdFromThreadId,
|
|
101
|
-
resolveSlackChannelIdFromMessage
|
|
102
|
-
};
|
package/dist/chunk-AWMS3SPP.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ConversationTurnLifecycleService
|
|
3
|
-
} from "./chunk-DBVY6HLX.js";
|
|
4
|
-
import {
|
|
5
|
-
runAgentWithTimeout
|
|
6
|
-
} from "./chunk-DL2KLKVH.js";
|
|
7
|
-
import {
|
|
8
|
-
getConversationEventStore
|
|
9
|
-
} from "./chunk-M76HMB7M.js";
|
|
10
|
-
|
|
11
|
-
// src/chat/runtime/turn-execution.ts
|
|
12
|
-
var AgentRunError = class extends Error {
|
|
13
|
-
constructor(cause) {
|
|
14
|
-
super(cause instanceof Error ? cause.message : "Agent Run failed", {
|
|
15
|
-
cause
|
|
16
|
-
});
|
|
17
|
-
this.name = "AgentRunError";
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
async function executeTurn(agentRunner, run, saveResult, timeoutMs) {
|
|
21
|
-
let outcome;
|
|
22
|
-
try {
|
|
23
|
-
outcome = await runAgentWithTimeout(agentRunner, run, timeoutMs);
|
|
24
|
-
} catch (error) {
|
|
25
|
-
throw new AgentRunError(error);
|
|
26
|
-
}
|
|
27
|
-
if (outcome.status !== "completed") {
|
|
28
|
-
return outcome;
|
|
29
|
-
}
|
|
30
|
-
const saved = await saveResult(outcome.result);
|
|
31
|
-
const lifecycle = new ConversationTurnLifecycleService(
|
|
32
|
-
getConversationEventStore()
|
|
33
|
-
);
|
|
34
|
-
const common = {
|
|
35
|
-
conversationId: run.conversationId,
|
|
36
|
-
createdAtMs: saved.finishedAtMs ?? Date.now(),
|
|
37
|
-
turnId: run.turnId
|
|
38
|
-
};
|
|
39
|
-
if (saved.outcome === "failed") {
|
|
40
|
-
await lifecycle.fail({
|
|
41
|
-
...common,
|
|
42
|
-
...saved.eventId ? { eventId: saved.eventId } : void 0,
|
|
43
|
-
failureCode: saved.failureCode,
|
|
44
|
-
...saved.failureReason ? { failureReason: saved.failureReason } : void 0
|
|
45
|
-
});
|
|
46
|
-
} else {
|
|
47
|
-
await lifecycle.complete({
|
|
48
|
-
...common,
|
|
49
|
-
outcome: saved.outcome
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
return { status: "completed" };
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export {
|
|
56
|
-
AgentRunError,
|
|
57
|
-
executeTurn
|
|
58
|
-
};
|