@sentry/junior 0.123.0 → 0.124.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-7JCABN73.js → agent-hooks-RPQRUAGN.js} +7 -7
- package/dist/api/conversations/detail.d.ts +2 -2
- package/dist/api/conversations/event-list.d.ts +2 -2
- package/dist/api/conversations/events.d.ts +1 -1
- package/dist/api/schema/conversation.d.ts +8 -8
- package/dist/api/schema.js +1 -1
- package/dist/api.js +23 -22
- package/dist/app.js +21 -21
- package/dist/{catalog-runtime-SZAS6EVH.js → catalog-runtime-QM2W6BBD.js} +5 -5
- package/dist/chat/conversations/history.d.ts +7 -7
- package/dist/chat/conversations/projection.d.ts +13 -0
- package/dist/chat/conversations/structured-events.d.ts +31 -0
- package/dist/chat/services/provider-error.d.ts +2 -0
- package/dist/chat/tools/query-conversation-events.d.ts +1 -1
- package/dist/{chunk-QKYO7ZNS.js → chunk-4HQMMFRL.js} +1 -1
- package/dist/{chunk-3S2K7SYY.js → chunk-4OWSABFE.js} +39 -16
- package/dist/{chunk-7YOBVIHY.js → chunk-7S36LUYT.js} +1 -1
- package/dist/{chunk-XLPETJXX.js → chunk-APPWCJVJ.js} +1 -1
- package/dist/{chunk-JMUPEYKC.js → chunk-AYQZCJZJ.js} +4 -4
- package/dist/{chunk-DAMUPWYR.js → chunk-EKVBTUVM.js} +2 -2
- package/dist/{chunk-5P4QBMTY.js → chunk-GBIFLB5Y.js} +57 -11
- package/dist/{chunk-2DZD6HX2.js → chunk-HOVHXQQE.js} +4 -4
- package/dist/{chunk-JCJN6TPV.js → chunk-IYUHOYFA.js} +14 -1
- package/dist/{chunk-A3TUEGKH.js → chunk-MG3L3UGS.js} +1 -1
- package/dist/{chunk-DQQCWMA2.js → chunk-PBZEJRYY.js} +10 -8
- package/dist/{chunk-ZO4TL4OK.js → chunk-PGLSOXFU.js} +4 -4
- package/dist/{chunk-MU6HHZEN.js → chunk-PR3M62LK.js} +74 -0
- package/dist/{chunk-ZOOZ25BO.js → chunk-RW6MD6ZV.js} +1 -1
- package/dist/{chunk-5EUADEG3.js → chunk-TFO4SDCQ.js} +1 -1
- package/dist/{chunk-VTWLP6YS.js → chunk-UZAOIEAR.js} +1 -1
- package/dist/{chunk-JPG43UG7.js → chunk-VLAWZSCB.js} +9 -4
- package/dist/{chunk-THYOK2SL.js → chunk-W4YS2LXS.js} +3 -3
- package/dist/{chunk-RQ6BLJJD.js → chunk-WFIXN6UU.js} +7 -7
- package/dist/{chunk-K5DCMBUV.js → chunk-WKLA6WLW.js} +48 -6
- package/dist/{chunk-DVPWU77W.js → chunk-YYAQ5ZNK.js} +7 -7
- package/dist/{chunk-LEQXDCWK.js → chunk-ZV2K3WM4.js} +1 -1
- package/dist/cli/chat.js +22 -22
- package/dist/cli/check.js +6 -6
- package/dist/cli/plugins.js +10 -10
- package/dist/cli/snapshot-create.js +8 -8
- package/dist/cli/upgrade.js +5 -5
- package/dist/{db-XKB2CHDW.js → db-2W4KOPLN.js} +5 -5
- package/dist/instrumentation.js +2 -2
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-EVMACH4G.js → oauth-callback-server-3TGRLQUD.js} +16 -16
- package/dist/{runner-BVHV5Y6L.js → runner-NAVNNKQY.js} +11 -11
- package/dist/{skills-QTI6GGJ4.js → skills-FIVS6EXW.js} +6 -6
- package/dist/{validation-SCQUYIUU.js → validation-NX4DAKNV.js} +6 -6
- package/dist/version.js +1 -1
- package/migrations/0012_structured_conversation_events.sql +4 -0
- package/migrations/meta/0012_snapshot.json +1244 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +6 -6
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
toMcpProviderError,
|
|
31
31
|
toolInvocationDestination,
|
|
32
32
|
uploadFilesToConversation
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-WFIXN6UU.js";
|
|
34
34
|
import {
|
|
35
35
|
CooperativeTurnYieldError,
|
|
36
36
|
JUNIOR_THREAD_STATE_TTL_MS,
|
|
@@ -80,7 +80,7 @@ import {
|
|
|
80
80
|
stripRuntimeTurnContext,
|
|
81
81
|
trimTrailingAssistantMessages,
|
|
82
82
|
updateConversationStats
|
|
83
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-WKLA6WLW.js";
|
|
84
84
|
import {
|
|
85
85
|
parseSandboxEgressAuthRequiredSignal,
|
|
86
86
|
parseSandboxEgressPermissionDeniedSignal,
|
|
@@ -104,14 +104,14 @@ import {
|
|
|
104
104
|
runNonInteractiveCommand,
|
|
105
105
|
throwSandboxOperationError,
|
|
106
106
|
wrapSandboxSetupError
|
|
107
|
-
} from "./chunk-
|
|
107
|
+
} from "./chunk-HOVHXQQE.js";
|
|
108
108
|
import {
|
|
109
109
|
incrementStat
|
|
110
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-TFO4SDCQ.js";
|
|
111
111
|
import {
|
|
112
112
|
addAgentTurnUsage,
|
|
113
113
|
hasAgentTurnUsage
|
|
114
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-PR3M62LK.js";
|
|
115
115
|
import {
|
|
116
116
|
privateTraceResultAttributes
|
|
117
117
|
} from "./chunk-UIE3R5XU.js";
|
|
@@ -129,7 +129,7 @@ import {
|
|
|
129
129
|
normalizeSlackConversationId,
|
|
130
130
|
resolveChannelCapabilities,
|
|
131
131
|
withSlackRetries
|
|
132
|
-
} from "./chunk-
|
|
132
|
+
} from "./chunk-PGLSOXFU.js";
|
|
133
133
|
import {
|
|
134
134
|
KNOWN_CONVERSATION_EVENT_TYPES,
|
|
135
135
|
contextProvenance,
|
|
@@ -139,7 +139,7 @@ import {
|
|
|
139
139
|
instructionActors,
|
|
140
140
|
instructionProvenanceFor,
|
|
141
141
|
sameActorIdentity
|
|
142
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-YYAQ5ZNK.js";
|
|
143
143
|
import {
|
|
144
144
|
SANDBOX_DATA_ROOT,
|
|
145
145
|
SANDBOX_SKILLS_ROOT,
|
|
@@ -149,7 +149,7 @@ import {
|
|
|
149
149
|
sandboxSkillFile,
|
|
150
150
|
sandboxSkillPathResolution,
|
|
151
151
|
sleep
|
|
152
|
-
} from "./chunk-
|
|
152
|
+
} from "./chunk-RW6MD6ZV.js";
|
|
153
153
|
import {
|
|
154
154
|
ACTIVE_TURN_COMPACTION_SUMMARY_PREFIX,
|
|
155
155
|
COMPACTION_SUMMARY_PREFIX,
|
|
@@ -160,6 +160,7 @@ import {
|
|
|
160
160
|
MISSING_GATEWAY_CREDENTIALS_ERROR,
|
|
161
161
|
MODEL_HANDOFF_SUMMARY_PREFIX,
|
|
162
162
|
ModelProfileNotConfiguredError,
|
|
163
|
+
ProviderError,
|
|
163
164
|
STANDARD_MODEL_PROFILE,
|
|
164
165
|
TURN_REASONING_LEVELS,
|
|
165
166
|
botConfig,
|
|
@@ -167,8 +168,10 @@ import {
|
|
|
167
168
|
completeText,
|
|
168
169
|
createProviderError,
|
|
169
170
|
escapeXml,
|
|
171
|
+
findProviderError,
|
|
170
172
|
getGatewayApiKey,
|
|
171
173
|
getPiGatewayApiKey,
|
|
174
|
+
getProviderErrorAttributes,
|
|
172
175
|
hasCompactedConversationContext,
|
|
173
176
|
isCompactionSummaryText,
|
|
174
177
|
isProviderRetryError,
|
|
@@ -180,7 +183,7 @@ import {
|
|
|
180
183
|
renderCurrentInstruction,
|
|
181
184
|
resolveGatewayModel,
|
|
182
185
|
unwrapCurrentInstruction
|
|
183
|
-
} from "./chunk-
|
|
186
|
+
} from "./chunk-IYUHOYFA.js";
|
|
184
187
|
import {
|
|
185
188
|
canExposeConversationPayload,
|
|
186
189
|
parseSlackThreadId,
|
|
@@ -197,10 +200,10 @@ import {
|
|
|
197
200
|
findSkillByName,
|
|
198
201
|
loadSkillsByName,
|
|
199
202
|
parseSkillInvocation
|
|
200
|
-
} from "./chunk-
|
|
203
|
+
} from "./chunk-EKVBTUVM.js";
|
|
201
204
|
import {
|
|
202
205
|
pluginCatalogRuntime
|
|
203
|
-
} from "./chunk-
|
|
206
|
+
} from "./chunk-4HQMMFRL.js";
|
|
204
207
|
import {
|
|
205
208
|
CredentialUnavailableError,
|
|
206
209
|
OAuthProviderError,
|
|
@@ -208,7 +211,7 @@ import {
|
|
|
208
211
|
getOAuthProviderErrorAttributes,
|
|
209
212
|
resolveAuthTokenPlaceholder,
|
|
210
213
|
resolvePluginCommandEnv
|
|
211
|
-
} from "./chunk-
|
|
214
|
+
} from "./chunk-APPWCJVJ.js";
|
|
212
215
|
import {
|
|
213
216
|
credentialUserSubjectId
|
|
214
217
|
} from "./chunk-W3U3YQYI.js";
|
|
@@ -232,7 +235,7 @@ import {
|
|
|
232
235
|
summarizeMessageText,
|
|
233
236
|
withLogContext,
|
|
234
237
|
withSpan
|
|
235
|
-
} from "./chunk-
|
|
238
|
+
} from "./chunk-VLAWZSCB.js";
|
|
236
239
|
import {
|
|
237
240
|
parseSlackChannelId,
|
|
238
241
|
parseSlackMessageTs,
|
|
@@ -14146,6 +14149,7 @@ var guardianDecisionSchema = z45.object({
|
|
|
14146
14149
|
userAuthorization: z45.enum(["high", "medium", "low", "unknown"])
|
|
14147
14150
|
}).strict();
|
|
14148
14151
|
var GUARDIAN_REVIEW_TIMEOUT_MS = 6e4;
|
|
14152
|
+
var GUARDIAN_REVIEW_MAX_TOKENS = 2e3;
|
|
14149
14153
|
var MAX_PROPOSAL_CHARS = 192e3;
|
|
14150
14154
|
function guardianPrompt(proposal) {
|
|
14151
14155
|
const proposalJson = JSON.stringify(z45.json().parse(proposal), null, 2);
|
|
@@ -14168,12 +14172,12 @@ function createGuardianActionReviewer(options) {
|
|
|
14168
14172
|
async review(proposal, reviewOptions) {
|
|
14169
14173
|
const timeoutSignal = AbortSignal.timeout(GUARDIAN_REVIEW_TIMEOUT_MS);
|
|
14170
14174
|
const signal = reviewOptions?.signal ? AbortSignal.any([reviewOptions.signal, timeoutSignal]) : timeoutSignal;
|
|
14171
|
-
const
|
|
14175
|
+
const completeReview = () => options.completeObject({
|
|
14172
14176
|
modelId: options.modelId,
|
|
14173
14177
|
schema: guardianDecisionSchema,
|
|
14174
14178
|
system: GUARDIAN_ACTION_POLICY,
|
|
14175
14179
|
prompt: guardianPrompt(proposal),
|
|
14176
|
-
maxTokens:
|
|
14180
|
+
maxTokens: GUARDIAN_REVIEW_MAX_TOKENS,
|
|
14177
14181
|
recordTelemetryPayloads: false,
|
|
14178
14182
|
temperature: 0,
|
|
14179
14183
|
signal,
|
|
@@ -14182,6 +14186,20 @@ function createGuardianActionReviewer(options) {
|
|
|
14182
14186
|
guardianRole: "tool_action_review"
|
|
14183
14187
|
}
|
|
14184
14188
|
});
|
|
14189
|
+
let result;
|
|
14190
|
+
try {
|
|
14191
|
+
result = await completeReview();
|
|
14192
|
+
} catch (error) {
|
|
14193
|
+
if (signal.aborted || !(error instanceof ProviderError) || error.kind !== "invalid_response") {
|
|
14194
|
+
throw error;
|
|
14195
|
+
}
|
|
14196
|
+
logWarn("guardian.action_review.retrying", {
|
|
14197
|
+
"app.ai.provider_error.kind": error.kind,
|
|
14198
|
+
"app.guardian.review_attempt": 2,
|
|
14199
|
+
"gen_ai.request.model": error.modelId ?? options.modelId
|
|
14200
|
+
});
|
|
14201
|
+
result = await completeReview();
|
|
14202
|
+
}
|
|
14185
14203
|
return {
|
|
14186
14204
|
...guardianDecisionSchema.parse(result.object),
|
|
14187
14205
|
...result.costUsd !== void 0 ? { costUsd: result.costUsd } : {}
|
|
@@ -16435,7 +16453,12 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
|
|
|
16435
16453
|
if (durability.onInputCommitted && !resume?.inputCommitted) {
|
|
16436
16454
|
throw error;
|
|
16437
16455
|
}
|
|
16438
|
-
|
|
16456
|
+
const providerError = findProviderError(error);
|
|
16457
|
+
logException(
|
|
16458
|
+
error,
|
|
16459
|
+
"assistant.reply.generation.failed",
|
|
16460
|
+
providerError ? getProviderErrorAttributes(providerError) : {}
|
|
16461
|
+
);
|
|
16439
16462
|
const message = error instanceof Error ? error.message : String(error);
|
|
16440
16463
|
return {
|
|
16441
16464
|
status: "completed",
|
|
@@ -237,12 +237,12 @@ var conversationReportTurnContextEventDataSchema = z2.object({
|
|
|
237
237
|
version: z2.number().int().positive(),
|
|
238
238
|
content: z2.record(z2.string(), z2.unknown())
|
|
239
239
|
}).strict();
|
|
240
|
-
var
|
|
241
|
-
type: z2.literal("
|
|
240
|
+
var conversationReportStructuredEventDataSchema = z2.object({
|
|
241
|
+
type: z2.literal("structured_event"),
|
|
242
242
|
namespace: z2.string().min(1),
|
|
243
243
|
name: z2.string().min(1),
|
|
244
244
|
version: z2.number().int().positive(),
|
|
245
|
-
turnId: z2.string().min(1),
|
|
245
|
+
turnId: z2.string().min(1).optional(),
|
|
246
246
|
presentation: conversationEventPresentationSchema
|
|
247
247
|
}).strict();
|
|
248
248
|
var conversationReportCompactionEventDataSchema = z2.object({
|
|
@@ -285,7 +285,7 @@ var conversationReportEventDataSchema = z2.discriminatedUnion("type", [
|
|
|
285
285
|
conversationReportToolCallsEventDataSchema,
|
|
286
286
|
conversationReportTurnLifecycleEventDataSchema,
|
|
287
287
|
conversationReportTurnContextEventDataSchema,
|
|
288
|
-
|
|
288
|
+
conversationReportStructuredEventDataSchema,
|
|
289
289
|
conversationReportTurnRoutedEventDataSchema,
|
|
290
290
|
conversationReportGuardianActionReviewedEventDataSchema,
|
|
291
291
|
conversationReportCompactionEventDataSchema,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
persistAuthPauseTurnState,
|
|
14
14
|
requireTurnFailureEventId,
|
|
15
15
|
scheduleSessionCompletedPluginTasks
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-PBZEJRYY.js";
|
|
17
17
|
import {
|
|
18
18
|
buildSentryConversationUrl
|
|
19
19
|
} from "./chunk-4CODA7P5.js";
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
resolveBaseUrl,
|
|
41
41
|
resolvePluginOAuthAccount,
|
|
42
42
|
truncateStatusText
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-WFIXN6UU.js";
|
|
44
44
|
import {
|
|
45
45
|
JUNIOR_THREAD_STATE_TTL_MS,
|
|
46
46
|
TurnSliceLimitExceededError,
|
|
@@ -68,11 +68,12 @@ import {
|
|
|
68
68
|
persistThreadStateById,
|
|
69
69
|
persistWithRetry,
|
|
70
70
|
recordAgentTurnSessionSummary,
|
|
71
|
+
recordAuthenticationLinked,
|
|
71
72
|
recordAuthorizationCompleted,
|
|
72
73
|
recordDeliveredAssistantMessage,
|
|
73
74
|
turnHasReply,
|
|
74
75
|
updateConversationStats
|
|
75
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-WKLA6WLW.js";
|
|
76
77
|
import {
|
|
77
78
|
SlackActionError,
|
|
78
79
|
getDashboardConversationLink,
|
|
@@ -81,19 +82,19 @@ import {
|
|
|
81
82
|
getSlackClient,
|
|
82
83
|
isDmChannel,
|
|
83
84
|
normalizeSlackConversationId
|
|
84
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-PGLSOXFU.js";
|
|
85
86
|
import {
|
|
86
87
|
getConversationEventStore,
|
|
87
88
|
getConversationStore,
|
|
88
89
|
parseDestination,
|
|
89
90
|
requireSlackDestination,
|
|
90
91
|
sameDestination
|
|
91
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-YYAQ5ZNK.js";
|
|
92
93
|
import {
|
|
93
94
|
acquireActiveLock,
|
|
94
95
|
getDefaultRedisStateAdapterFor,
|
|
95
96
|
getStateAdapter
|
|
96
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-RW6MD6ZV.js";
|
|
97
98
|
import {
|
|
98
99
|
FUNCTION_TIMEOUT_BUFFER_SECONDS,
|
|
99
100
|
botConfig,
|
|
@@ -102,7 +103,7 @@ import {
|
|
|
102
103
|
getRuntimeMetadata,
|
|
103
104
|
normalizeSlackEmojiName,
|
|
104
105
|
standardModelId
|
|
105
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-IYUHOYFA.js";
|
|
106
107
|
import {
|
|
107
108
|
parseSlackThreadId,
|
|
108
109
|
readSlackRawMessageContext,
|
|
@@ -111,15 +112,15 @@ import {
|
|
|
111
112
|
} from "./chunk-S7G34U75.js";
|
|
112
113
|
import {
|
|
113
114
|
discoverSkills
|
|
114
|
-
} from "./chunk-
|
|
115
|
+
} from "./chunk-EKVBTUVM.js";
|
|
115
116
|
import {
|
|
116
117
|
pluginCatalogRuntime
|
|
117
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-4HQMMFRL.js";
|
|
118
119
|
import {
|
|
119
120
|
buildOAuthTokenRequest,
|
|
120
121
|
hasRequiredOAuthScope,
|
|
121
122
|
parseOAuthTokenResponse
|
|
122
|
-
} from "./chunk-
|
|
123
|
+
} from "./chunk-APPWCJVJ.js";
|
|
123
124
|
import {
|
|
124
125
|
createSlackResumeActor,
|
|
125
126
|
isUserActor,
|
|
@@ -132,7 +133,7 @@ import {
|
|
|
132
133
|
logWarn,
|
|
133
134
|
setTags,
|
|
134
135
|
withLogContext
|
|
135
|
-
} from "./chunk-
|
|
136
|
+
} from "./chunk-VLAWZSCB.js";
|
|
136
137
|
import {
|
|
137
138
|
isRecord,
|
|
138
139
|
toOptionalNumber,
|
|
@@ -3605,6 +3606,29 @@ async function GET(request, provider, waitUntil, options) {
|
|
|
3605
3606
|
mutation
|
|
3606
3607
|
)
|
|
3607
3608
|
);
|
|
3609
|
+
let providerLabel;
|
|
3610
|
+
try {
|
|
3611
|
+
providerLabel = formatProviderLabel(provider);
|
|
3612
|
+
} catch {
|
|
3613
|
+
providerLabel = void 0;
|
|
3614
|
+
}
|
|
3615
|
+
try {
|
|
3616
|
+
await recordAuthenticationLinked({
|
|
3617
|
+
conversationId: authSession.conversationId,
|
|
3618
|
+
provider,
|
|
3619
|
+
actorId: authSession.userId,
|
|
3620
|
+
authorizationId: mcpAuthorizationId({
|
|
3621
|
+
provider,
|
|
3622
|
+
sessionId: authSession.sessionId
|
|
3623
|
+
}),
|
|
3624
|
+
turnId: authSession.sessionId,
|
|
3625
|
+
...providerLabel ? { providerLabel } : {}
|
|
3626
|
+
});
|
|
3627
|
+
} catch (error2) {
|
|
3628
|
+
logException(error2, "mcp.oauth_callback.authentication_event.failed", {
|
|
3629
|
+
"app.credential.provider": provider
|
|
3630
|
+
});
|
|
3631
|
+
}
|
|
3608
3632
|
try {
|
|
3609
3633
|
await deleteMcpAuthSession(authSession.authSessionId);
|
|
3610
3634
|
} catch (cleanupError) {
|
|
@@ -4295,6 +4319,28 @@ async function GET2(request, provider, waitUntil, options) {
|
|
|
4295
4319
|
...parsedTokenResponse,
|
|
4296
4320
|
...account ? { account } : {}
|
|
4297
4321
|
});
|
|
4322
|
+
if (stored.resumeConversationId) {
|
|
4323
|
+
try {
|
|
4324
|
+
await recordAuthenticationLinked({
|
|
4325
|
+
conversationId: stored.resumeConversationId,
|
|
4326
|
+
provider,
|
|
4327
|
+
actorId: stored.userId,
|
|
4328
|
+
providerLabel,
|
|
4329
|
+
...account?.label ? { accountLabel: account.label } : {},
|
|
4330
|
+
...stored.resumeSessionId ? {
|
|
4331
|
+
authorizationId: pluginAuthorizationId({
|
|
4332
|
+
provider,
|
|
4333
|
+
sessionId: stored.resumeSessionId
|
|
4334
|
+
}),
|
|
4335
|
+
turnId: stored.resumeSessionId
|
|
4336
|
+
} : {}
|
|
4337
|
+
});
|
|
4338
|
+
} catch (error) {
|
|
4339
|
+
logException(error, "oauth.callback.authentication_event.failed", {
|
|
4340
|
+
"app.credential.provider": provider
|
|
4341
|
+
});
|
|
4342
|
+
}
|
|
4343
|
+
}
|
|
4298
4344
|
if (stored.destination?.platform !== "local") {
|
|
4299
4345
|
waitUntil(async () => {
|
|
4300
4346
|
try {
|
|
@@ -2,18 +2,18 @@ import {
|
|
|
2
2
|
SANDBOX_WORKSPACE_ROOT,
|
|
3
3
|
getStateAdapter,
|
|
4
4
|
sleep
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-RW6MD6ZV.js";
|
|
6
6
|
import {
|
|
7
7
|
toOptionalTrimmed
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-IYUHOYFA.js";
|
|
9
9
|
import {
|
|
10
10
|
pluginCatalogRuntime
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-4HQMMFRL.js";
|
|
12
12
|
import {
|
|
13
13
|
setSpanAttributes,
|
|
14
14
|
setSpanStatus,
|
|
15
15
|
withSpan
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-VLAWZSCB.js";
|
|
17
17
|
|
|
18
18
|
// src/chat/sandbox/snapshot/profile.ts
|
|
19
19
|
import { createHash } from "crypto";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
normalizeGenAiFinishReason,
|
|
13
13
|
serializeGenAiAttribute,
|
|
14
14
|
withSpan
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-VLAWZSCB.js";
|
|
16
16
|
|
|
17
17
|
// src/chat/config.ts
|
|
18
18
|
import { getModel as getModel2 } from "@earendil-works/pi-ai/compat";
|
|
@@ -181,6 +181,18 @@ function createProviderError(error, options = {}) {
|
|
|
181
181
|
function isProviderRetryError(error) {
|
|
182
182
|
return error instanceof ProviderError && error.retryable;
|
|
183
183
|
}
|
|
184
|
+
function findProviderError(error) {
|
|
185
|
+
const visited = /* @__PURE__ */ new Set();
|
|
186
|
+
let current = error;
|
|
187
|
+
while (current instanceof Error && !visited.has(current)) {
|
|
188
|
+
if (current instanceof ProviderError) {
|
|
189
|
+
return current;
|
|
190
|
+
}
|
|
191
|
+
visited.add(current);
|
|
192
|
+
current = current.cause;
|
|
193
|
+
}
|
|
194
|
+
return void 0;
|
|
195
|
+
}
|
|
184
196
|
function getProviderErrorUserMessage(error) {
|
|
185
197
|
switch (error.kind) {
|
|
186
198
|
case "capacity":
|
|
@@ -969,6 +981,7 @@ export {
|
|
|
969
981
|
ProviderError,
|
|
970
982
|
createProviderError,
|
|
971
983
|
isProviderRetryError,
|
|
984
|
+
findProviderError,
|
|
972
985
|
getProviderErrorUserMessage,
|
|
973
986
|
getProviderErrorAttributes,
|
|
974
987
|
escapeXml,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createPluginConversationEvents
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-W4YS2LXS.js";
|
|
4
4
|
import {
|
|
5
5
|
pluginTaskId,
|
|
6
6
|
pluginTaskParamsSchema,
|
|
@@ -25,29 +25,30 @@ import {
|
|
|
25
25
|
persistThreadStateById,
|
|
26
26
|
stripRuntimeTurnContext,
|
|
27
27
|
updateConversationStats
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-WKLA6WLW.js";
|
|
29
29
|
import {
|
|
30
30
|
createPluginEmbedder,
|
|
31
31
|
createPluginLogger,
|
|
32
32
|
createPluginModel,
|
|
33
33
|
createPluginState,
|
|
34
34
|
getPlugins
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-PGLSOXFU.js";
|
|
36
36
|
import {
|
|
37
37
|
getDb,
|
|
38
38
|
sameActorIdentity
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-YYAQ5ZNK.js";
|
|
40
40
|
import {
|
|
41
41
|
getStateAdapter
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-RW6MD6ZV.js";
|
|
43
43
|
import {
|
|
44
44
|
ProviderError,
|
|
45
|
+
findProviderError,
|
|
45
46
|
getProviderErrorAttributes,
|
|
46
47
|
getProviderErrorUserMessage
|
|
47
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-IYUHOYFA.js";
|
|
48
49
|
import {
|
|
49
50
|
buildTurnFailureResponse
|
|
50
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-VLAWZSCB.js";
|
|
51
52
|
import {
|
|
52
53
|
parseSlackMessageTs
|
|
53
54
|
} from "./chunk-F3B2YJ76.js";
|
|
@@ -410,12 +411,13 @@ function getExecutionFailureReason(reply) {
|
|
|
410
411
|
}
|
|
411
412
|
function getFailureCapture(reply) {
|
|
412
413
|
if (reply.diagnostics.outcome === "provider_error") {
|
|
414
|
+
const providerError = findProviderError(reply.diagnostics.providerError);
|
|
413
415
|
return {
|
|
414
416
|
eventName: "agent.turn.provider_error",
|
|
415
417
|
error: reply.diagnostics.providerError ?? new Error(
|
|
416
418
|
reply.diagnostics.errorMessage ?? "Provider error without explicit message"
|
|
417
419
|
),
|
|
418
|
-
attributes:
|
|
420
|
+
attributes: providerError ? getProviderErrorAttributes(providerError) : {},
|
|
419
421
|
body: "Agent turn failed with provider error"
|
|
420
422
|
};
|
|
421
423
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getDb
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YYAQ5ZNK.js";
|
|
4
4
|
import {
|
|
5
5
|
juniorConversationAnnotations,
|
|
6
6
|
juniorIdentities,
|
|
@@ -10,14 +10,14 @@ import {
|
|
|
10
10
|
SANDBOX_WORKSPACE_ROOT,
|
|
11
11
|
getStateAdapter,
|
|
12
12
|
sleep
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-RW6MD6ZV.js";
|
|
14
14
|
import {
|
|
15
15
|
botConfig,
|
|
16
16
|
completeObject,
|
|
17
17
|
embedTexts,
|
|
18
18
|
getSlackBotToken,
|
|
19
19
|
standardModelId
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-IYUHOYFA.js";
|
|
21
21
|
import {
|
|
22
22
|
isActorUserId,
|
|
23
23
|
parseActorUserId
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
setSpanAttributes,
|
|
31
31
|
setSpanStatus,
|
|
32
32
|
withSpan
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-VLAWZSCB.js";
|
|
34
34
|
import {
|
|
35
35
|
parseSlackChannelReferenceId,
|
|
36
36
|
parseSlackMessageTs,
|
|
@@ -2,6 +2,76 @@ import {
|
|
|
2
2
|
usageSchema
|
|
3
3
|
} from "./chunk-PDO5BLNM.js";
|
|
4
4
|
|
|
5
|
+
// src/chat/conversations/structured-events.ts
|
|
6
|
+
import {
|
|
7
|
+
conversationEventPresentationSchema,
|
|
8
|
+
defineConversationEvent
|
|
9
|
+
} from "@sentry/junior-plugin-api";
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
var JUNIOR_NATIVE_EVENT_NAMESPACE = "junior";
|
|
12
|
+
var authenticationEventContentSchema = z.object({
|
|
13
|
+
accountLabel: z.string().trim().min(1).max(120).optional(),
|
|
14
|
+
actorId: z.string().min(1),
|
|
15
|
+
authorizationId: z.string().min(1).optional(),
|
|
16
|
+
provider: z.string().regex(/^[a-z][a-z0-9-]*$/),
|
|
17
|
+
providerLabel: z.string().trim().min(1).max(80).optional()
|
|
18
|
+
}).strict();
|
|
19
|
+
function providerTitle(content) {
|
|
20
|
+
return content.providerLabel?.trim() || content.provider;
|
|
21
|
+
}
|
|
22
|
+
var authenticationLinkedEvent = defineConversationEvent({
|
|
23
|
+
name: "authentication_linked",
|
|
24
|
+
version: 1,
|
|
25
|
+
schema: authenticationEventContentSchema,
|
|
26
|
+
renderEvent(event) {
|
|
27
|
+
const provider = providerTitle(event);
|
|
28
|
+
return {
|
|
29
|
+
icon: "link",
|
|
30
|
+
title: `${provider} connected`,
|
|
31
|
+
...event.accountLabel ? { preview: `Connected as \`${event.accountLabel}\`` } : {},
|
|
32
|
+
details: [
|
|
33
|
+
{
|
|
34
|
+
title: `${provider} connected`,
|
|
35
|
+
...event.accountLabel ? { description: `Connected as \`${event.accountLabel}\`` } : {},
|
|
36
|
+
metadata: [event.provider]
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
var authenticationUnlinkedEvent = defineConversationEvent({
|
|
43
|
+
name: "authentication_unlinked",
|
|
44
|
+
version: 1,
|
|
45
|
+
schema: authenticationEventContentSchema,
|
|
46
|
+
renderEvent(event) {
|
|
47
|
+
const provider = providerTitle(event);
|
|
48
|
+
return {
|
|
49
|
+
icon: "key",
|
|
50
|
+
title: `${provider} disconnected`,
|
|
51
|
+
details: [
|
|
52
|
+
{
|
|
53
|
+
title: `${provider} disconnected`,
|
|
54
|
+
metadata: [event.provider]
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
var NATIVE_EVENT_DEFINITIONS = [authenticationLinkedEvent, authenticationUnlinkedEvent];
|
|
61
|
+
function getJuniorNativeEventDefinition(args) {
|
|
62
|
+
return NATIVE_EVENT_DEFINITIONS.find(
|
|
63
|
+
(definition) => definition.eventName === args.name && definition.version === args.version
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
function renderJuniorNativeConversationEvent(args) {
|
|
67
|
+
if (args.namespace !== JUNIOR_NATIVE_EVENT_NAMESPACE) return void 0;
|
|
68
|
+
const definition = getJuniorNativeEventDefinition(args);
|
|
69
|
+
if (!definition) return void 0;
|
|
70
|
+
return conversationEventPresentationSchema.parse(
|
|
71
|
+
definition.renderEvent(definition.parse(args.content))
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
5
75
|
// src/chat/usage.ts
|
|
6
76
|
var agentTurnUsageSchema = usageSchema;
|
|
7
77
|
var COMPONENT_USAGE_FIELDS = [
|
|
@@ -93,6 +163,10 @@ function addAgentTurnUsage(...usages) {
|
|
|
93
163
|
}
|
|
94
164
|
|
|
95
165
|
export {
|
|
166
|
+
JUNIOR_NATIVE_EVENT_NAMESPACE,
|
|
167
|
+
authenticationLinkedEvent,
|
|
168
|
+
authenticationUnlinkedEvent,
|
|
169
|
+
renderJuniorNativeConversationEvent,
|
|
96
170
|
agentTurnUsageSchema,
|
|
97
171
|
hasAgentTurnUsage,
|
|
98
172
|
addAgentTurnUsage
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "./chunk-6GWA276C.js";
|
|
14
14
|
import {
|
|
15
15
|
getDeploymentTelemetryAttributes
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-UZAOIEAR.js";
|
|
17
17
|
|
|
18
18
|
// src/chat/logging.ts
|
|
19
19
|
import path from "path";
|
|
@@ -948,10 +948,15 @@ var log = {
|
|
|
948
948
|
if (typeof sentryWithScope === "function" && typeof sentryCaptureException === "function") {
|
|
949
949
|
sentryWithScope((scope) => {
|
|
950
950
|
setSentryScopeContext(scope, getBoundLogContext());
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
951
|
+
const mergedAttributes = mergeAttributes(
|
|
952
|
+
getBoundLogAttributes(),
|
|
953
|
+
attrs
|
|
954
|
+
);
|
|
955
|
+
for (const [key, value] of Object.entries(mergedAttributes)) {
|
|
954
956
|
scope.setExtra(key, value);
|
|
957
|
+
if (SENTRY_TAG_ATTRIBUTE_KEYS.has(key) && typeof value === "string" && value.length > 0) {
|
|
958
|
+
scope.setTag(key, value);
|
|
959
|
+
}
|
|
955
960
|
}
|
|
956
961
|
eventId = sentryCaptureException(normalizedError);
|
|
957
962
|
});
|