@sentry/junior 0.147.0 → 0.148.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-HS6VGUPM.js → agent-hooks-VAUYT6PD.js} +10 -10
- package/dist/api/conversations/access.d.ts +2 -1
- package/dist/api/conversations/archive.d.ts +3 -5
- package/dist/api/conversations/create.d.ts +6 -0
- package/dist/api/conversations/detail.d.ts +2 -296
- package/dist/api/conversations/event-list.d.ts +2 -193
- package/dist/api/conversations/list.d.ts +4 -66
- package/dist/api/conversations/routes.d.ts +1 -1
- package/dist/api/conversations/stats.d.ts +0 -54
- package/dist/api/http.d.ts +2 -6
- package/dist/api/locations/detail.d.ts +3 -111
- package/dist/api/locations/list.d.ts +0 -45
- package/dist/api/locations/query.d.ts +2 -1
- package/dist/api/locations/routes.d.ts +1 -1
- package/dist/api/people/list.d.ts +0 -29
- package/dist/api/people/profile.d.ts +2 -106
- package/dist/api/people/profile.query.d.ts +2 -1
- package/dist/api/people/routes.d.ts +1 -1
- package/dist/api/people/shared.d.ts +1 -1
- package/dist/api/people/spend.d.ts +3 -4
- package/dist/api/personal-tokens/routes.d.ts +2 -2
- package/dist/api/route.d.ts +8 -14
- package/dist/api/schema/conversation.d.ts +60 -29
- package/dist/api/schema/location.d.ts +4 -0
- package/dist/api/schema/person.d.ts +7 -3
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +7 -1
- package/dist/api/stats.d.ts +0 -13
- package/dist/api/validation.d.ts +7 -0
- package/dist/api/viewer.d.ts +3 -0
- package/dist/api.d.ts +2 -1
- package/dist/api.js +624 -562
- package/dist/app.js +183 -105
- package/dist/{catalog-runtime-M6ZTPYRV.js → catalog-runtime-WADOZVTB.js} +5 -5
- package/dist/chat/actor.d.ts +4 -1
- package/dist/chat/agent/request.d.ts +2 -0
- package/dist/chat/agent/resume.d.ts +1 -0
- package/dist/chat/agent-dispatch/context.d.ts +2 -2
- package/dist/chat/agent-invocations/types.d.ts +52 -0
- package/dist/chat/api-turns/work.d.ts +103 -0
- package/dist/chat/conversations/history.d.ts +60 -0
- package/dist/chat/conversations/provenance.d.ts +6 -0
- package/dist/chat/conversations/sql/actor-identity.d.ts +19 -0
- package/dist/chat/conversations/store.d.ts +1 -1
- package/dist/chat/resource-events/store.d.ts +1 -1
- package/dist/chat/runtime/reply-executor.d.ts +1 -1
- package/dist/chat/runtime/slack-runtime.d.ts +2 -1
- package/dist/chat/runtime/turn-preparation.d.ts +9 -0
- package/dist/chat/scheduled-tasks/tool-support.d.ts +5 -5
- package/dist/chat/scheduled-tasks/tools/create.d.ts +2 -2
- package/dist/chat/scheduled-tasks/tools/delete.d.ts +2 -2
- package/dist/chat/scheduled-tasks/tools/list.d.ts +2 -2
- package/dist/chat/scheduled-tasks/tools/run-now.d.ts +2 -2
- package/dist/chat/scheduled-tasks/tools/update.d.ts +2 -2
- package/dist/chat/slack/channel.d.ts +26 -0
- package/dist/chat/slack/dispatch-turn.d.ts +1 -0
- package/dist/chat/slack/timestamp-param.d.ts +0 -2
- package/dist/chat/slack/{tools → tool-support}/canvas/api.d.ts +1 -1
- package/dist/chat/slack/{tools → tool-support}/canvas/context.d.ts +3 -0
- package/dist/chat/slack/tool-support/channel-access.d.ts +42 -0
- package/dist/chat/slack/tool-support/channel-target.d.ts +27 -0
- package/dist/chat/slack/tool-support/list/params.d.ts +5 -0
- package/dist/chat/slack/tools/canvas/create.d.ts +1 -1
- package/dist/chat/slack/tools/channel-join.d.ts +28 -0
- package/dist/chat/slack/tools/channel-list-messages.d.ts +3 -2
- package/dist/chat/slack/tools/conversation-message-search.d.ts +2 -8
- package/dist/chat/slack/tools/message-add-reaction.d.ts +1 -1
- package/dist/chat/slack/tools/public-search.d.ts +63 -2
- package/dist/chat/slack/tools/send-files.d.ts +1 -1
- package/dist/chat/slack/tools/thread-read.d.ts +2 -5
- package/dist/chat/source.d.ts +2 -0
- package/dist/chat/task-execution/checkpoint.d.ts +1 -0
- package/dist/chat/task-execution/state.d.ts +9 -4
- package/dist/chat/task-execution/store.d.ts +3 -2
- package/dist/chat/task-execution/turn-cursor.d.ts +2 -0
- package/dist/chat/task-execution/worker.d.ts +2 -0
- package/dist/chat/tasks/read.d.ts +1 -1
- package/dist/chat/tools/search-conversation-events.d.ts +1 -1
- package/dist/chat/tools/types.d.ts +11 -4
- package/dist/chat/tools/watch-resource-events.d.ts +2 -2
- package/dist/{chunk-ORO3PWKQ.js → chunk-2B3PT3V2.js} +1 -1
- package/dist/{chunk-SVHUEHUL.js → chunk-45LOR4PU.js} +21 -4
- package/dist/{chunk-YBVXBNSV.js → chunk-4AQZYNHM.js} +2 -2
- package/dist/{chunk-Z4YU7Z4L.js → chunk-4EA2SFK2.js} +65 -4
- package/dist/{chunk-7NVJVJID.js → chunk-4GXJUYJV.js} +2 -2
- package/dist/{chunk-IIOOO4FQ.js → chunk-55F4QU2V.js} +2 -1
- package/dist/{chunk-745QJ3ZA.js → chunk-7OEIXFC3.js} +2 -2
- package/dist/{chunk-DU74WPIC.js → chunk-D3WPMGEX.js} +1 -1
- package/dist/{chunk-PVNG6UMU.js → chunk-D6YX4NNN.js} +22 -10
- package/dist/chunk-DUY5CDAM.js +36 -0
- package/dist/{chunk-4LJO56OJ.js → chunk-EAI67NTM.js} +1 -1
- package/dist/{chunk-X5UY34KT.js → chunk-EINWQFXI.js} +8 -8
- package/dist/chunk-GDFF3BQG.js +136 -0
- package/dist/{chunk-EFLJ2WJH.js → chunk-GXYDVZKM.js} +5 -5
- package/dist/{chunk-CWP5RHVX.js → chunk-HLPLT3NY.js} +8 -5
- package/dist/{chunk-JUUKWRBE.js → chunk-HWQGBIH7.js} +1 -1
- package/dist/{chunk-AZ7EAOBE.js → chunk-IL4EDBMV.js} +5 -5
- package/dist/{chunk-DLDRQHG5.js → chunk-LAZGHEYU.js} +1 -1
- package/dist/{chunk-RXBVB2JM.js → chunk-LE5H7LMT.js} +1 -1
- package/dist/chunk-LNVEIJ2L.js +48 -0
- package/dist/{chunk-YEO3VX72.js → chunk-OJCP3C3J.js} +8 -6
- package/dist/{chunk-GGB4WL5A.js → chunk-POSZWRGL.js} +1 -1
- package/dist/{chunk-YNTTROJT.js → chunk-QOWHHM3F.js} +1 -1
- package/dist/{chunk-6H5SZR24.js → chunk-RRJV5UR5.js} +302 -59
- package/dist/{chunk-AYU72WO7.js → chunk-ULAU5ZGU.js} +41 -64
- package/dist/{chunk-SGZO7UWH.js → chunk-V2FXMOEA.js} +2 -2
- package/dist/{chunk-AIOK6LAG.js → chunk-VCYSOXON.js} +272 -41
- package/dist/{chunk-7A4M7PCV.js → chunk-VMNRXKAH.js} +1166 -540
- package/dist/{chunk-YSB2N563.js → chunk-VRHTNBA6.js} +121 -87
- package/dist/{chunk-AVZDSUFB.js → chunk-VY6W3T43.js} +4 -4
- package/dist/{chunk-7UQIVT6G.js → chunk-WCN4YSH7.js} +6 -6
- package/dist/{chunk-CSZINQJ2.js → chunk-WOONT5ZP.js} +1 -1
- package/dist/{chunk-Q4R73I43.js → chunk-XJ42NBP5.js} +58 -28
- package/dist/{chunk-YHDERDRO.js → chunk-ZCHIC2GM.js} +91 -75
- package/dist/chunk-ZPL2RR7F.js +798 -0
- package/dist/cli/chat.js +33 -35
- package/dist/cli/check.js +6 -6
- package/dist/cli/plugins.js +13 -13
- package/dist/cli/snapshot-create.js +9 -9
- package/dist/cli/upgrade.js +7 -7
- package/dist/db/schema/agent-invocations.d.ts +20 -0
- package/dist/db/schema/conversation-annotations.d.ts +2 -2
- package/dist/db/schema.d.ts +22 -2
- package/dist/{db-CSEW4RII.js → db-XUKZRFFK.js} +7 -7
- package/dist/instrumentation.js +4 -4
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-FUEV5HNG.js → oauth-callback-server-LPZMMGFI.js} +25 -26
- package/dist/{runner-U3XHSKSH.js → runner-DGKUTMPX.js} +17 -18
- package/dist/{skills-AKE6W3WI.js → skills-P7YUFSXM.js} +6 -6
- package/dist/spawn-DSK3ZEVD.js +38 -0
- package/dist/{validation-WDTAULUF.js → validation-S7U5M5NR.js} +6 -6
- package/dist/version.js +1 -1
- package/dist/{work-C3HAO2BG.js → work-GAA7TVAD.js} +18 -19
- package/dist/{worker-LNP4YKBM.js → worker-JXPJH3QB.js} +11 -10
- package/package.json +5 -4
- package/dist/api/health.d.ts +0 -7
- package/dist/api/personal-tokens/create.d.ts +0 -11
- package/dist/api/personal-tokens/list.d.ts +0 -12
- package/dist/api/personal-tokens/revoke.d.ts +0 -5
- package/dist/api/plugin-reports.d.ts +0 -63
- package/dist/api/plugins.d.ts +0 -8
- package/dist/api/runtime.d.ts +0 -24
- package/dist/api/skills.d.ts +0 -6
- package/dist/chat/slack/tools/channel-access.d.ts +0 -30
- package/dist/chunk-34GS7B6L.js +0 -115
- package/dist/chunk-AVOCH2Z5.js +0 -285
- package/dist/chunk-HLXXQI5Q.js +0 -238
- package/dist/chunk-K4SZAP3K.js +0 -67
- package/dist/chunk-R776HKPK.js +0 -81
- package/dist/spawn-B6GDTWJ4.js +0 -39
- /package/dist/chat/slack/{tools → tool-support}/canvas/markdown.d.ts +0 -0
- /package/dist/chat/slack/{tools → tool-support}/channel-capabilities.d.ts +0 -0
- /package/dist/chat/slack/{tools → tool-support}/context.d.ts +0 -0
- /package/dist/chat/slack/{tools → tool-support}/list/api.d.ts +0 -0
- /package/dist/chat/slack/{tools → tool-support}/slack-message-url.d.ts +0 -0
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
relayLocalOAuthCallback
|
|
3
3
|
} from "./chunk-FA6POGLH.js";
|
|
4
|
+
import {
|
|
5
|
+
getTurnRequestDeadline
|
|
6
|
+
} from "./chunk-DUY5CDAM.js";
|
|
7
|
+
import {
|
|
8
|
+
persistAuthPauseTurnState
|
|
9
|
+
} from "./chunk-LNVEIJ2L.js";
|
|
10
|
+
import {
|
|
11
|
+
buildSentryConversationUrl
|
|
12
|
+
} from "./chunk-4CODA7P5.js";
|
|
4
13
|
import {
|
|
5
14
|
ensureConversationWake,
|
|
6
15
|
requestConversationWork
|
|
7
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-HLPLT3NY.js";
|
|
8
17
|
import {
|
|
9
18
|
buildConversationContext,
|
|
10
19
|
buildDeliveredTurnStatePatch,
|
|
@@ -15,13 +24,12 @@ import {
|
|
|
15
24
|
getTurnUserReplyAttachmentContext,
|
|
16
25
|
getTurnUserSlackMessageTs,
|
|
17
26
|
markConversationMessage,
|
|
18
|
-
persistAuthPauseTurnState,
|
|
19
27
|
recordDeliveredAssistantMessage,
|
|
20
28
|
requireTurnFailureEventId,
|
|
21
29
|
resolveTurnSessionRouting,
|
|
22
30
|
scheduleSessionCompletedPluginTasks,
|
|
23
31
|
turnHasReply
|
|
24
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-RRJV5UR5.js";
|
|
25
33
|
import {
|
|
26
34
|
ConversationTurnLifecycleService,
|
|
27
35
|
coerceThreadConversationState,
|
|
@@ -30,10 +38,7 @@ import {
|
|
|
30
38
|
getPersistedSandboxState,
|
|
31
39
|
getPersistedThreadState,
|
|
32
40
|
persistThreadStateById
|
|
33
|
-
} from "./chunk-
|
|
34
|
-
import {
|
|
35
|
-
buildSentryConversationUrl
|
|
36
|
-
} from "./chunk-4CODA7P5.js";
|
|
41
|
+
} from "./chunk-IL4EDBMV.js";
|
|
37
42
|
import {
|
|
38
43
|
getVercelConversationWorkQueue
|
|
39
44
|
} from "./chunk-WR76IVA5.js";
|
|
@@ -46,10 +51,10 @@ import {
|
|
|
46
51
|
getMcpStoredOAuthCredentials,
|
|
47
52
|
lookupSlackUserProfile,
|
|
48
53
|
resolvePluginOAuthAccount
|
|
49
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-XJ42NBP5.js";
|
|
50
55
|
import {
|
|
51
56
|
RetryableDeliveryError
|
|
52
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-GDFF3BQG.js";
|
|
53
58
|
import {
|
|
54
59
|
addReactionToMessage,
|
|
55
60
|
escapeSlackMrkdwnText,
|
|
@@ -62,7 +67,13 @@ import {
|
|
|
62
67
|
removeReactionFromMessage,
|
|
63
68
|
resolveBaseUrl,
|
|
64
69
|
truncateStatusText
|
|
65
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-WCN4YSH7.js";
|
|
71
|
+
import {
|
|
72
|
+
parseSlackThreadId,
|
|
73
|
+
readSlackRawMessageContext,
|
|
74
|
+
resolveSlackChannelIdFromMessage,
|
|
75
|
+
resolveSlackChannelIdFromThreadId
|
|
76
|
+
} from "./chunk-WOONT5ZP.js";
|
|
66
77
|
import {
|
|
67
78
|
TurnSliceLimitExceededError,
|
|
68
79
|
abandonTurnRecord,
|
|
@@ -83,55 +94,48 @@ import {
|
|
|
83
94
|
recordAuthorizationCompleted,
|
|
84
95
|
recordTurnSummary,
|
|
85
96
|
saveTurnCheckpoint
|
|
86
|
-
} from "./chunk-
|
|
87
|
-
import {
|
|
88
|
-
parseSlackThreadId,
|
|
89
|
-
readSlackRawMessageContext,
|
|
90
|
-
resolveSlackChannelIdFromMessage,
|
|
91
|
-
resolveSlackChannelIdFromThreadId
|
|
92
|
-
} from "./chunk-CSZINQJ2.js";
|
|
97
|
+
} from "./chunk-VCYSOXON.js";
|
|
93
98
|
import {
|
|
94
99
|
getDashboardConversationLink,
|
|
95
100
|
getPluginSlackConversationLink
|
|
96
|
-
} from "./chunk-
|
|
101
|
+
} from "./chunk-ZCHIC2GM.js";
|
|
97
102
|
import {
|
|
98
103
|
SlackActionError,
|
|
99
104
|
getHeaderString,
|
|
100
105
|
getSlackClient,
|
|
101
106
|
isDmChannel,
|
|
102
107
|
normalizeSlackConversationId
|
|
103
|
-
} from "./chunk-
|
|
108
|
+
} from "./chunk-V2FXMOEA.js";
|
|
104
109
|
import {
|
|
105
110
|
getConversationEventStore,
|
|
106
111
|
getSqlExecutor,
|
|
107
112
|
requireSlackDestination,
|
|
108
113
|
upsertIdentity,
|
|
109
114
|
upsertLinkedIdentity
|
|
110
|
-
} from "./chunk-
|
|
115
|
+
} from "./chunk-VRHTNBA6.js";
|
|
111
116
|
import {
|
|
112
117
|
acquireActiveLock,
|
|
113
118
|
getStateAdapter
|
|
114
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-2B3PT3V2.js";
|
|
115
120
|
import {
|
|
116
|
-
FUNCTION_TIMEOUT_BUFFER_SECONDS,
|
|
117
121
|
botConfig,
|
|
118
122
|
escapeXml,
|
|
119
123
|
getChatConfig,
|
|
120
124
|
getRuntimeMetadata,
|
|
121
125
|
normalizeSlackEmojiName,
|
|
122
126
|
standardModelId
|
|
123
|
-
} from "./chunk-
|
|
127
|
+
} from "./chunk-4GXJUYJV.js";
|
|
124
128
|
import {
|
|
125
129
|
discoverSkills
|
|
126
|
-
} from "./chunk-
|
|
130
|
+
} from "./chunk-4AQZYNHM.js";
|
|
127
131
|
import {
|
|
128
132
|
pluginCatalogRuntime
|
|
129
|
-
} from "./chunk-
|
|
133
|
+
} from "./chunk-HWQGBIH7.js";
|
|
130
134
|
import {
|
|
131
135
|
buildOAuthTokenRequest,
|
|
132
136
|
hasRequiredOAuthScope,
|
|
133
137
|
parseOAuthTokenResponse
|
|
134
|
-
} from "./chunk-
|
|
138
|
+
} from "./chunk-POSZWRGL.js";
|
|
135
139
|
import {
|
|
136
140
|
createSlackResumeActor,
|
|
137
141
|
isUserActor
|
|
@@ -149,7 +153,7 @@ import {
|
|
|
149
153
|
setTags,
|
|
150
154
|
toOptionalString,
|
|
151
155
|
withLogContext
|
|
152
|
-
} from "./chunk-
|
|
156
|
+
} from "./chunk-EAI67NTM.js";
|
|
153
157
|
import {
|
|
154
158
|
homeDir
|
|
155
159
|
} from "./chunk-H4HBKISO.js";
|
|
@@ -1076,33 +1080,6 @@ function buildAuthPauseResponse(slackUserId, providerDisplayName, requestText) {
|
|
|
1076
1080
|
I sent you a link.`;
|
|
1077
1081
|
}
|
|
1078
1082
|
|
|
1079
|
-
// src/chat/runtime/request-deadline.ts
|
|
1080
|
-
import { AsyncLocalStorage } from "async_hooks";
|
|
1081
|
-
var requestDeadlineStorage = new AsyncLocalStorage();
|
|
1082
|
-
function createTurnRequestDeadline(startedAtMs) {
|
|
1083
|
-
const requestBudgetMs = Math.max(
|
|
1084
|
-
1,
|
|
1085
|
-
getChatConfig().functionMaxDurationSeconds * 1e3 - FUNCTION_TIMEOUT_BUFFER_SECONDS * 1e3
|
|
1086
|
-
);
|
|
1087
|
-
return {
|
|
1088
|
-
startedAtMs,
|
|
1089
|
-
deadlineAtMs: startedAtMs + requestBudgetMs
|
|
1090
|
-
};
|
|
1091
|
-
}
|
|
1092
|
-
function getTurnRequestDeadline() {
|
|
1093
|
-
return requestDeadlineStorage.getStore();
|
|
1094
|
-
}
|
|
1095
|
-
function runWithTurnRequestDeadline(callback, startedAtMs = Date.now()) {
|
|
1096
|
-
const existingDeadline = requestDeadlineStorage.getStore();
|
|
1097
|
-
if (existingDeadline) {
|
|
1098
|
-
return callback();
|
|
1099
|
-
}
|
|
1100
|
-
return requestDeadlineStorage.run(
|
|
1101
|
-
createTurnRequestDeadline(startedAtMs),
|
|
1102
|
-
callback
|
|
1103
|
-
);
|
|
1104
|
-
}
|
|
1105
|
-
|
|
1106
1083
|
// src/chat/runtime/slack-resume.ts
|
|
1107
1084
|
function resolveReplyTimeoutMs(explicitTimeoutMs) {
|
|
1108
1085
|
if (typeof explicitTimeoutMs === "number" && explicitTimeoutMs > 0) {
|
|
@@ -1436,15 +1413,17 @@ async function resumeSlackTurnInContext(args) {
|
|
|
1436
1413
|
}
|
|
1437
1414
|
failureCode = "delivery_failed";
|
|
1438
1415
|
const deliveryState2 = await getDeliveryConversation();
|
|
1439
|
-
let slackMessageTs;
|
|
1416
|
+
let slackMessageTs = [];
|
|
1440
1417
|
try {
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1418
|
+
if (runArgs.replyContext?.routing.publishExternally !== false) {
|
|
1419
|
+
slackMessageTs = await sendSlackReply({
|
|
1420
|
+
channelId: runArgs.channelId,
|
|
1421
|
+
conversationId: runArgs.conversationId,
|
|
1422
|
+
replyAttribution: runArgs.replyContext?.routing.dispatch?.replyAttribution,
|
|
1423
|
+
text,
|
|
1424
|
+
threadTs: runArgs.threadTs
|
|
1425
|
+
});
|
|
1426
|
+
}
|
|
1448
1427
|
} catch (error) {
|
|
1449
1428
|
if (isRetryableSlackPostError(error)) {
|
|
1450
1429
|
throw new RetryableDeliveryError(error);
|
|
@@ -3185,8 +3164,6 @@ export {
|
|
|
3185
3164
|
shouldKeepProcessingReactionForToolInvocation,
|
|
3186
3165
|
startSlackProcessingReaction,
|
|
3187
3166
|
buildAuthPauseResponse,
|
|
3188
|
-
getTurnRequestDeadline,
|
|
3189
|
-
runWithTurnRequestDeadline,
|
|
3190
3167
|
resumeSlackTurn,
|
|
3191
3168
|
getPausedTurnRequest,
|
|
3192
3169
|
wakePausedTurn,
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-EM225ITJ.js";
|
|
4
4
|
import {
|
|
5
5
|
getSlackBotToken
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-4GXJUYJV.js";
|
|
7
7
|
import {
|
|
8
8
|
parseSlackChannelReferenceId
|
|
9
9
|
} from "./chunk-F3B2YJ76.js";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
setSpanAttributes,
|
|
13
13
|
setSpanStatus,
|
|
14
14
|
withSpan
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-EAI67NTM.js";
|
|
16
16
|
|
|
17
17
|
// src/chat/slack/client.ts
|
|
18
18
|
import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
addAgentTurnUsage,
|
|
5
|
-
agentsInstructionsUpdatedEvent,
|
|
6
|
-
authenticationLinkedEvent,
|
|
7
|
-
authenticationUnlinkedEvent
|
|
8
|
-
} from "./chunk-HLXXQI5Q.js";
|
|
2
|
+
usageSchema
|
|
3
|
+
} from "./chunk-PDO5BLNM.js";
|
|
9
4
|
import {
|
|
10
5
|
agentHistoryItemSchema,
|
|
11
6
|
bindProviderConversation,
|
|
@@ -18,7 +13,7 @@ import {
|
|
|
18
13
|
instructionProvenanceFor,
|
|
19
14
|
sanitizePostgresJson,
|
|
20
15
|
withConversationEventLock
|
|
21
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-VRHTNBA6.js";
|
|
22
17
|
import {
|
|
23
18
|
SANDBOX_WORKSPACE_ROOT,
|
|
24
19
|
sleep
|
|
@@ -28,18 +23,18 @@ import {
|
|
|
28
23
|
fenceLock,
|
|
29
24
|
getStateAdapter,
|
|
30
25
|
withLock
|
|
31
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-2B3PT3V2.js";
|
|
32
27
|
import {
|
|
33
28
|
botConfig,
|
|
34
29
|
unwrapCurrentInstruction
|
|
35
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-4GXJUYJV.js";
|
|
36
31
|
import {
|
|
37
32
|
toStoredSlackActor
|
|
38
33
|
} from "./chunk-HZF5P5UN.js";
|
|
39
34
|
import {
|
|
40
35
|
getActiveTraceId,
|
|
41
36
|
logException
|
|
42
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-EAI67NTM.js";
|
|
43
38
|
|
|
44
39
|
// src/chat/turn-context-tag.ts
|
|
45
40
|
var TURN_CONTEXT_TAG = "runtime-turn-context";
|
|
@@ -397,6 +392,131 @@ var piContentMessageSchema = z.object({
|
|
|
397
392
|
role: z.string().min(1)
|
|
398
393
|
}).passthrough().transform((value) => value);
|
|
399
394
|
|
|
395
|
+
// src/chat/conversations/structured-events.ts
|
|
396
|
+
import {
|
|
397
|
+
conversationEventPresentationSchema,
|
|
398
|
+
defineConversationEvent
|
|
399
|
+
} from "@sentry/junior-plugin-api";
|
|
400
|
+
import { z as z2 } from "zod";
|
|
401
|
+
var JUNIOR_NATIVE_EVENT_NAMESPACE = "junior";
|
|
402
|
+
var authenticationEventContentSchema = z2.object({
|
|
403
|
+
accountLabel: z2.string().trim().min(1).max(120).optional(),
|
|
404
|
+
actorId: z2.string().min(1),
|
|
405
|
+
authorizationId: z2.string().min(1).optional(),
|
|
406
|
+
provider: z2.string().regex(/^[a-z][a-z0-9-]*$/),
|
|
407
|
+
providerLabel: z2.string().trim().min(1).max(80).optional()
|
|
408
|
+
}).strict();
|
|
409
|
+
var agentsInstructionsUpdatedContentSchema = z2.object({
|
|
410
|
+
action: z2.enum(["loaded", "replaced", "cleared"]),
|
|
411
|
+
directory: z2.string().trim().min(1).max(500).optional(),
|
|
412
|
+
fingerprint: z2.string().trim().min(1).max(128),
|
|
413
|
+
sources: z2.array(
|
|
414
|
+
z2.object({
|
|
415
|
+
content: z2.string().min(1).max(32 * 1024),
|
|
416
|
+
path: z2.string().trim().min(1).max(500)
|
|
417
|
+
}).strict()
|
|
418
|
+
).max(32),
|
|
419
|
+
textBytes: z2.number().int().nonnegative().optional()
|
|
420
|
+
}).strict();
|
|
421
|
+
function providerTitle(content) {
|
|
422
|
+
return content.providerLabel?.trim() || content.provider;
|
|
423
|
+
}
|
|
424
|
+
function agentsInstructionsTitle(action) {
|
|
425
|
+
if (action === "loaded") return "Loaded AGENTS.md";
|
|
426
|
+
if (action === "replaced") return "Updated AGENTS.md";
|
|
427
|
+
return "Cleared AGENTS.md";
|
|
428
|
+
}
|
|
429
|
+
function sourceFilename(sourcePath) {
|
|
430
|
+
return sourcePath.split("/").at(-1) || sourcePath;
|
|
431
|
+
}
|
|
432
|
+
function formatBytes(bytes) {
|
|
433
|
+
if (bytes < 1024) return `${bytes} bytes`;
|
|
434
|
+
const kilobytes = bytes / 1024;
|
|
435
|
+
return `${Number.isInteger(kilobytes) ? kilobytes : kilobytes.toFixed(1)} KB`;
|
|
436
|
+
}
|
|
437
|
+
function agentsInstructionsPreview(content) {
|
|
438
|
+
const source = content.sources[0];
|
|
439
|
+
if (!source) return void 0;
|
|
440
|
+
const filename = sourceFilename(source.path);
|
|
441
|
+
const label = content.sources.length === 1 ? filename : `${content.sources.length} AGENTS.md files`;
|
|
442
|
+
return typeof content.textBytes === "number" ? `${label} \xB7 ${formatBytes(content.textBytes)}` : label;
|
|
443
|
+
}
|
|
444
|
+
var authenticationLinkedEvent = defineConversationEvent({
|
|
445
|
+
name: "authentication_linked",
|
|
446
|
+
version: 1,
|
|
447
|
+
schema: authenticationEventContentSchema,
|
|
448
|
+
renderEvent(event) {
|
|
449
|
+
const provider = providerTitle(event);
|
|
450
|
+
return {
|
|
451
|
+
icon: "link",
|
|
452
|
+
title: `${provider} connected`,
|
|
453
|
+
...event.accountLabel ? { preview: `Connected as \`${event.accountLabel}\`` } : {},
|
|
454
|
+
details: [
|
|
455
|
+
{
|
|
456
|
+
title: `${provider} connected`,
|
|
457
|
+
...event.accountLabel ? { description: `Connected as \`${event.accountLabel}\`` } : {},
|
|
458
|
+
metadata: [event.provider]
|
|
459
|
+
}
|
|
460
|
+
]
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
});
|
|
464
|
+
var authenticationUnlinkedEvent = defineConversationEvent({
|
|
465
|
+
name: "authentication_unlinked",
|
|
466
|
+
version: 1,
|
|
467
|
+
schema: authenticationEventContentSchema,
|
|
468
|
+
renderEvent(event) {
|
|
469
|
+
const provider = providerTitle(event);
|
|
470
|
+
return {
|
|
471
|
+
icon: "key",
|
|
472
|
+
title: `${provider} disconnected`,
|
|
473
|
+
details: [
|
|
474
|
+
{
|
|
475
|
+
title: `${provider} disconnected`,
|
|
476
|
+
metadata: [event.provider]
|
|
477
|
+
}
|
|
478
|
+
]
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
});
|
|
482
|
+
var agentsInstructionsUpdatedEvent = defineConversationEvent({
|
|
483
|
+
name: "agents_instructions_updated",
|
|
484
|
+
version: 1,
|
|
485
|
+
schema: agentsInstructionsUpdatedContentSchema,
|
|
486
|
+
renderEvent(event) {
|
|
487
|
+
const title = agentsInstructionsTitle(event.action);
|
|
488
|
+
const preview = agentsInstructionsPreview(event);
|
|
489
|
+
return {
|
|
490
|
+
icon: "brain",
|
|
491
|
+
title,
|
|
492
|
+
...preview ? { preview } : {},
|
|
493
|
+
...event.sources.length > 0 ? {
|
|
494
|
+
details: event.sources.map((source) => ({
|
|
495
|
+
title: sourceFilename(source.path),
|
|
496
|
+
content: source.content
|
|
497
|
+
}))
|
|
498
|
+
} : {}
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
});
|
|
502
|
+
var NATIVE_EVENT_DEFINITIONS = [
|
|
503
|
+
authenticationLinkedEvent,
|
|
504
|
+
authenticationUnlinkedEvent,
|
|
505
|
+
agentsInstructionsUpdatedEvent
|
|
506
|
+
];
|
|
507
|
+
function getJuniorNativeEventDefinition(args) {
|
|
508
|
+
return NATIVE_EVENT_DEFINITIONS.find(
|
|
509
|
+
(definition) => definition.eventName === args.name && definition.version === args.version
|
|
510
|
+
);
|
|
511
|
+
}
|
|
512
|
+
function renderJuniorNativeConversationEvent(args) {
|
|
513
|
+
if (args.namespace !== JUNIOR_NATIVE_EVENT_NAMESPACE) return void 0;
|
|
514
|
+
const definition = getJuniorNativeEventDefinition(args);
|
|
515
|
+
if (!definition) return void 0;
|
|
516
|
+
const presentation = definition.renderEvent(definition.parse(args.content));
|
|
517
|
+
return presentation === void 0 ? void 0 : conversationEventPresentationSchema.parse(presentation);
|
|
518
|
+
}
|
|
519
|
+
|
|
400
520
|
// src/chat/pi/conversation-events.ts
|
|
401
521
|
function authorizationObservationMessage(data, createdAtMs) {
|
|
402
522
|
const label = data.kind === "mcp" ? "MCP authorization" : "Authorization";
|
|
@@ -1131,7 +1251,7 @@ async function persistWithRetry(persist) {
|
|
|
1131
1251
|
}
|
|
1132
1252
|
|
|
1133
1253
|
// src/chat/task-execution/turn-cursor.ts
|
|
1134
|
-
import { z as
|
|
1254
|
+
import { z as z3 } from "zod";
|
|
1135
1255
|
|
|
1136
1256
|
// src/chat/repository-instructions.ts
|
|
1137
1257
|
import { createHash as createHash2 } from "crypto";
|
|
@@ -1139,6 +1259,16 @@ import path2 from "path";
|
|
|
1139
1259
|
|
|
1140
1260
|
// src/chat/tools/sandbox/file-utils.ts
|
|
1141
1261
|
import path from "path";
|
|
1262
|
+
|
|
1263
|
+
// src/chat/tools/execution/tool-input-error.ts
|
|
1264
|
+
var ToolInputError = class extends Error {
|
|
1265
|
+
constructor(message, options) {
|
|
1266
|
+
super(message, options);
|
|
1267
|
+
this.name = "ToolInputError";
|
|
1268
|
+
}
|
|
1269
|
+
};
|
|
1270
|
+
|
|
1271
|
+
// src/chat/tools/sandbox/file-utils.ts
|
|
1142
1272
|
var MAX_TEXT_CHARS = 6e4;
|
|
1143
1273
|
var RIPGREP_EXCLUDED_GLOBS = [
|
|
1144
1274
|
"!**/.git/**",
|
|
@@ -1524,63 +1654,64 @@ function definedProps(values) {
|
|
|
1524
1654
|
Object.entries(values).filter(([, value]) => value !== void 0)
|
|
1525
1655
|
);
|
|
1526
1656
|
}
|
|
1527
|
-
var turnStatusSchema =
|
|
1657
|
+
var turnStatusSchema = z3.enum([
|
|
1528
1658
|
"running",
|
|
1529
1659
|
"paused",
|
|
1530
1660
|
"completed",
|
|
1531
1661
|
"failed",
|
|
1532
1662
|
"abandoned"
|
|
1533
1663
|
]);
|
|
1534
|
-
var turnSurfaceSchema =
|
|
1664
|
+
var turnSurfaceSchema = z3.enum([
|
|
1535
1665
|
"slack",
|
|
1536
1666
|
"api",
|
|
1537
1667
|
"scheduler",
|
|
1538
1668
|
"internal"
|
|
1539
1669
|
]);
|
|
1540
|
-
var turnPauseReasonSchema =
|
|
1670
|
+
var turnPauseReasonSchema = z3.enum([
|
|
1541
1671
|
"timeout",
|
|
1542
1672
|
"auth",
|
|
1543
1673
|
"yield",
|
|
1544
1674
|
"retry"
|
|
1545
1675
|
]);
|
|
1546
|
-
var nonNegativeNumberSchema =
|
|
1547
|
-
var seqCursorSchema =
|
|
1548
|
-
var storedTurnSummarySchema =
|
|
1549
|
-
schemaVersion:
|
|
1550
|
-
version:
|
|
1551
|
-
conversationId:
|
|
1552
|
-
dispatchId:
|
|
1553
|
-
dispatchOutcome:
|
|
1554
|
-
resultMessageId:
|
|
1676
|
+
var nonNegativeNumberSchema = z3.number().finite().nonnegative();
|
|
1677
|
+
var seqCursorSchema = z3.number().int().min(-1);
|
|
1678
|
+
var storedTurnSummarySchema = z3.object({
|
|
1679
|
+
schemaVersion: z3.literal(TURN_CURSOR_SCHEMA_VERSION),
|
|
1680
|
+
version: z3.number().int().nonnegative(),
|
|
1681
|
+
conversationId: z3.string().min(1),
|
|
1682
|
+
dispatchId: z3.string().min(1).optional(),
|
|
1683
|
+
dispatchOutcome: z3.enum(["blocked", "completed", "failed"]).optional(),
|
|
1684
|
+
resultMessageId: z3.string().min(1).optional(),
|
|
1555
1685
|
resumeReason: turnPauseReasonSchema.optional(),
|
|
1556
|
-
turnId:
|
|
1557
|
-
sliceId:
|
|
1686
|
+
turnId: z3.string().min(1),
|
|
1687
|
+
sliceId: z3.number().int().nonnegative(),
|
|
1558
1688
|
state: turnStatusSchema,
|
|
1559
1689
|
surface: turnSurfaceSchema.optional(),
|
|
1560
1690
|
updatedAtMs: nonNegativeNumberSchema
|
|
1561
1691
|
}).strip();
|
|
1562
|
-
var storedTurnRecordSchema =
|
|
1563
|
-
schemaVersion:
|
|
1564
|
-
version:
|
|
1565
|
-
conversationId:
|
|
1566
|
-
dispatchId:
|
|
1567
|
-
dispatchOutcome:
|
|
1568
|
-
resultMessageId:
|
|
1692
|
+
var storedTurnRecordSchema = z3.object({
|
|
1693
|
+
schemaVersion: z3.literal(TURN_CURSOR_SCHEMA_VERSION),
|
|
1694
|
+
version: z3.number().int().nonnegative(),
|
|
1695
|
+
conversationId: z3.string().min(1),
|
|
1696
|
+
dispatchId: z3.string().min(1).optional(),
|
|
1697
|
+
dispatchOutcome: z3.enum(["blocked", "completed", "failed"]).optional(),
|
|
1698
|
+
resultMessageId: z3.string().min(1).optional(),
|
|
1569
1699
|
lastProgressAtMs: nonNegativeNumberSchema,
|
|
1570
1700
|
resumeReason: turnPauseReasonSchema.optional(),
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1701
|
+
publishExternally: z3.boolean().optional(),
|
|
1702
|
+
resumedFromSliceId: z3.number().int().nonnegative().optional(),
|
|
1703
|
+
turnId: z3.string().min(1),
|
|
1704
|
+
sliceId: z3.number().int().nonnegative(),
|
|
1574
1705
|
startedAtMs: nonNegativeNumberSchema,
|
|
1575
1706
|
state: turnStatusSchema,
|
|
1576
1707
|
surface: turnSurfaceSchema.optional(),
|
|
1577
|
-
traceId:
|
|
1708
|
+
traceId: z3.string().optional(),
|
|
1578
1709
|
updatedAtMs: nonNegativeNumberSchema,
|
|
1579
1710
|
committedSeq: seqCursorSchema,
|
|
1580
|
-
historyVersion:
|
|
1581
|
-
errorMessage:
|
|
1711
|
+
historyVersion: z3.number().int().nonnegative().optional(),
|
|
1712
|
+
errorMessage: z3.string().optional(),
|
|
1582
1713
|
turnStartSeq: seqCursorSchema.optional(),
|
|
1583
|
-
runtimeContext:
|
|
1714
|
+
runtimeContext: z3.array(piMessageSchema).optional()
|
|
1584
1715
|
}).strip();
|
|
1585
1716
|
function conversationExecutionFromSummary(summary) {
|
|
1586
1717
|
const status = summary.state === "completed" || summary.state === "abandoned" ? "idle" : summary.state;
|
|
@@ -1629,7 +1760,7 @@ async function recordConversationActivityMetadata(args) {
|
|
|
1629
1760
|
});
|
|
1630
1761
|
const isChild = Boolean(conversation?.lineage);
|
|
1631
1762
|
const destination = isChild ? void 0 : args.destination;
|
|
1632
|
-
const activitySource = isChild ? "internal" : destination?.platform === "local" ? "local" : destination ? args.summary.surface : void 0;
|
|
1763
|
+
const activitySource = isChild ? "internal" : args.source?.platform === "web" ? "web" : destination?.platform === "local" ? "local" : destination ? args.summary.surface : void 0;
|
|
1633
1764
|
await conversationStore.recordActivity({
|
|
1634
1765
|
activityAtMs: args.summary.updatedAtMs,
|
|
1635
1766
|
channelName: args.summary.channelName,
|
|
@@ -1681,6 +1812,7 @@ function materializeTurnRecord(stored, piProjection, turnStartMessageIndex, rest
|
|
|
1681
1812
|
dispatchOutcome: stored.dispatchOutcome,
|
|
1682
1813
|
errorMessage: stored.errorMessage,
|
|
1683
1814
|
resumeReason: stored.resumeReason,
|
|
1815
|
+
publishExternally: stored.publishExternally,
|
|
1684
1816
|
resultMessageId: stored.resultMessageId,
|
|
1685
1817
|
resumedFromSliceId: stored.resumedFromSliceId,
|
|
1686
1818
|
surface: stored.surface,
|
|
@@ -1790,6 +1922,7 @@ function buildStoredRecord(args) {
|
|
|
1790
1922
|
errorMessage: args.errorMessage,
|
|
1791
1923
|
historyVersion: args.historyVersion,
|
|
1792
1924
|
resumeReason: args.resumeReason,
|
|
1925
|
+
publishExternally: args.publishExternally,
|
|
1793
1926
|
resultMessageId: args.resultMessageId,
|
|
1794
1927
|
resumedFromSliceId: args.resumedFromSliceId,
|
|
1795
1928
|
runtimeContext: args.runtimeContext && args.runtimeContext.length > 0 ? args.runtimeContext : void 0,
|
|
@@ -1877,6 +2010,7 @@ async function updateTurnState(args) {
|
|
|
1877
2010
|
errorMessage: args.errorMessage ?? args.existing.errorMessage,
|
|
1878
2011
|
historyVersion: parsed.historyVersion,
|
|
1879
2012
|
resumeReason: args.existing.resumeReason,
|
|
2013
|
+
publishExternally: args.existing.publishExternally,
|
|
1880
2014
|
resultMessageId: args.resultMessageId ?? args.existing.resultMessageId,
|
|
1881
2015
|
resumedFromSliceId: args.existing.resumedFromSliceId,
|
|
1882
2016
|
surface: args.existing.surface,
|
|
@@ -1964,6 +2098,7 @@ async function upsertTurnRecordLocked(args, fence) {
|
|
|
1964
2098
|
errorMessage: args.errorMessage,
|
|
1965
2099
|
lastProgressAtMs: args.lastProgressAtMs,
|
|
1966
2100
|
resumeReason: args.resumeReason,
|
|
2101
|
+
publishExternally: args.publishExternally ?? existingRecord?.publishExternally,
|
|
1967
2102
|
resultMessageId: args.resultMessageId ?? existingRecord?.resultMessageId,
|
|
1968
2103
|
resumedFromSliceId: args.resumedFromSliceId,
|
|
1969
2104
|
runtimeContext: args.state === "running" || args.state === "paused" ? retainedRuntimeContext : void 0,
|
|
@@ -2120,6 +2255,96 @@ async function failTurnRecord(args) {
|
|
|
2120
2255
|
);
|
|
2121
2256
|
}
|
|
2122
2257
|
|
|
2258
|
+
// src/chat/usage.ts
|
|
2259
|
+
var agentTurnUsageSchema = usageSchema;
|
|
2260
|
+
var COMPONENT_USAGE_FIELDS = [
|
|
2261
|
+
"inputTokens",
|
|
2262
|
+
"outputTokens",
|
|
2263
|
+
"cachedInputTokens",
|
|
2264
|
+
"cacheCreationTokens"
|
|
2265
|
+
];
|
|
2266
|
+
var COST_COMPONENT_FIELDS = [
|
|
2267
|
+
"input",
|
|
2268
|
+
"output",
|
|
2269
|
+
"cacheRead",
|
|
2270
|
+
"cacheWrite"
|
|
2271
|
+
];
|
|
2272
|
+
function hasAgentTurnUsage(usage) {
|
|
2273
|
+
return Boolean(
|
|
2274
|
+
usage && (Object.entries(usage).some(
|
|
2275
|
+
([field, value]) => field !== "cost" && typeof value === "number" && Number.isFinite(value)
|
|
2276
|
+
) || Object.values(usage.cost ?? {}).some(
|
|
2277
|
+
(value) => typeof value === "number" && Number.isFinite(value)
|
|
2278
|
+
))
|
|
2279
|
+
);
|
|
2280
|
+
}
|
|
2281
|
+
function getFiniteCount(value) {
|
|
2282
|
+
return typeof value === "number" && Number.isFinite(value) ? Math.max(0, Math.floor(value)) : void 0;
|
|
2283
|
+
}
|
|
2284
|
+
function getFiniteCost(value) {
|
|
2285
|
+
return typeof value === "number" && Number.isFinite(value) ? Math.max(0, value) : void 0;
|
|
2286
|
+
}
|
|
2287
|
+
function addCost(left, right) {
|
|
2288
|
+
return Math.round(((left ?? 0) + right) * 1e12) / 1e12;
|
|
2289
|
+
}
|
|
2290
|
+
function getComponentTotal(usage) {
|
|
2291
|
+
let total;
|
|
2292
|
+
for (const field of COMPONENT_USAGE_FIELDS) {
|
|
2293
|
+
const value = getFiniteCount(usage[field]);
|
|
2294
|
+
if (value === void 0) continue;
|
|
2295
|
+
total = (total ?? 0) + value;
|
|
2296
|
+
}
|
|
2297
|
+
return total;
|
|
2298
|
+
}
|
|
2299
|
+
function addAgentTurnUsage(...usages) {
|
|
2300
|
+
const components = {};
|
|
2301
|
+
let componentTotal;
|
|
2302
|
+
let totalOnlyTokens;
|
|
2303
|
+
let reasoningTokens;
|
|
2304
|
+
const cost = {};
|
|
2305
|
+
for (const usage of usages) {
|
|
2306
|
+
if (!usage) continue;
|
|
2307
|
+
const reasoning = getFiniteCount(usage.reasoningTokens);
|
|
2308
|
+
if (reasoning !== void 0) {
|
|
2309
|
+
reasoningTokens = (reasoningTokens ?? 0) + reasoning;
|
|
2310
|
+
}
|
|
2311
|
+
if (usage.cost) {
|
|
2312
|
+
for (const field of [...COST_COMPONENT_FIELDS, "total"]) {
|
|
2313
|
+
const value = getFiniteCost(usage.cost[field]);
|
|
2314
|
+
if (value === void 0) continue;
|
|
2315
|
+
cost[field] = addCost(cost[field], value);
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2318
|
+
const usageComponentTotal = getComponentTotal(usage);
|
|
2319
|
+
if (usageComponentTotal !== void 0) {
|
|
2320
|
+
componentTotal = (componentTotal ?? 0) + usageComponentTotal;
|
|
2321
|
+
for (const field of COMPONENT_USAGE_FIELDS) {
|
|
2322
|
+
const value = getFiniteCount(usage[field]);
|
|
2323
|
+
if (value === void 0) continue;
|
|
2324
|
+
components[field] = (components[field] ?? 0) + value;
|
|
2325
|
+
}
|
|
2326
|
+
continue;
|
|
2327
|
+
}
|
|
2328
|
+
const totalTokens = getFiniteCount(usage.totalTokens);
|
|
2329
|
+
if (totalTokens !== void 0) {
|
|
2330
|
+
totalOnlyTokens = (totalOnlyTokens ?? 0) + totalTokens;
|
|
2331
|
+
}
|
|
2332
|
+
}
|
|
2333
|
+
if (totalOnlyTokens !== void 0) {
|
|
2334
|
+
return {
|
|
2335
|
+
totalTokens: totalOnlyTokens + (componentTotal ?? 0),
|
|
2336
|
+
...reasoningTokens !== void 0 ? { reasoningTokens } : {},
|
|
2337
|
+
...Object.keys(cost).length > 0 ? { cost } : {}
|
|
2338
|
+
};
|
|
2339
|
+
}
|
|
2340
|
+
const result = {
|
|
2341
|
+
...components,
|
|
2342
|
+
...reasoningTokens !== void 0 ? { reasoningTokens } : {},
|
|
2343
|
+
...Object.keys(cost).length > 0 ? { cost } : {}
|
|
2344
|
+
};
|
|
2345
|
+
return hasAgentTurnUsage(result) ? result : void 0;
|
|
2346
|
+
}
|
|
2347
|
+
|
|
2123
2348
|
// src/chat/services/turn-limit.ts
|
|
2124
2349
|
var TurnSliceLimitExceededError = class extends Error {
|
|
2125
2350
|
constructor(maxSlices) {
|
|
@@ -2180,6 +2405,7 @@ function sharedWrite(args, latest) {
|
|
|
2180
2405
|
destination: args.destination,
|
|
2181
2406
|
destinationVisibility: args.destinationVisibility,
|
|
2182
2407
|
dispatchId: args.dispatchId ?? latest?.dispatchId,
|
|
2408
|
+
publishExternally: args.publishExternally ?? latest?.publishExternally,
|
|
2183
2409
|
source: args.source,
|
|
2184
2410
|
surface: args.surface ?? latest?.surface,
|
|
2185
2411
|
traceId: getActiveTraceId() ?? latest?.traceId,
|
|
@@ -2371,6 +2597,7 @@ function isPendingAuthLatestRequest(conversation, pendingAuth) {
|
|
|
2371
2597
|
}
|
|
2372
2598
|
|
|
2373
2599
|
export {
|
|
2600
|
+
renderJuniorNativeConversationEvent,
|
|
2374
2601
|
TURN_CONTEXT_TAG,
|
|
2375
2602
|
isAssistantMessage,
|
|
2376
2603
|
isToolResultMessage,
|
|
@@ -2407,6 +2634,7 @@ export {
|
|
|
2407
2634
|
recordTurnRoute,
|
|
2408
2635
|
recordToolExecutionStarted,
|
|
2409
2636
|
recordGuardianActionReviewed,
|
|
2637
|
+
ToolInputError,
|
|
2410
2638
|
MAX_TEXT_CHARS,
|
|
2411
2639
|
RIPGREP_EXCLUDED_GLOBS,
|
|
2412
2640
|
DEFAULT_SEARCH_COMMAND_TIMEOUT_MS,
|
|
@@ -2445,6 +2673,9 @@ export {
|
|
|
2445
2673
|
sanitizeAssistantText,
|
|
2446
2674
|
decideReply,
|
|
2447
2675
|
getAssistantReplyText,
|
|
2676
|
+
agentTurnUsageSchema,
|
|
2677
|
+
hasAgentTurnUsage,
|
|
2678
|
+
addAgentTurnUsage,
|
|
2448
2679
|
TurnSliceLimitExceededError,
|
|
2449
2680
|
buildTurnLimitResponse,
|
|
2450
2681
|
persistWithRetry,
|