@sentry/junior 0.193.0 → 0.194.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-DWY3MZZ7.js → agent-hooks-IDX764FD.js} +11 -11
- package/dist/api/conversations/aggregate.d.ts +2 -0
- package/dist/api/conversations/list.d.ts +1 -1
- package/dist/api/conversations/projection.d.ts +1 -1
- package/dist/api/locations/detail.d.ts +1 -1
- package/dist/api/schema/conversation.d.ts +3 -3
- package/dist/api/schema/location.d.ts +1 -1
- package/dist/api/schema/person.d.ts +1 -1
- package/dist/api/schema/task.d.ts +71 -8
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +3 -1
- package/dist/api.js +106 -187
- package/dist/app.js +44 -39
- package/dist/{catalog-runtime-NAD44W5K.js → catalog-runtime-MICXEBLK.js} +4 -4
- package/dist/chat/agent/resume.d.ts +2 -0
- package/dist/chat/config.d.ts +1 -0
- package/dist/chat/conversations/history.d.ts +4 -2
- package/dist/chat/services/turn-limit.d.ts +11 -1
- package/dist/chat/slack/{source-link.d.ts → location-url.d.ts} +1 -1
- package/dist/chat/task-execution/checkpoint.d.ts +2 -0
- package/dist/chat/task-execution/turn-cursor.d.ts +3 -0
- package/dist/chat/tasks/execution-stats.d.ts +13 -1
- package/dist/chat/usage.d.ts +4 -0
- package/dist/{chunk-GTXQHZ2O.js → chunk-2NL3Y47F.js} +5 -5
- package/dist/{chunk-DVU734PI.js → chunk-53IEEFFP.js} +3 -3
- package/dist/{chunk-WH5VV2RW.js → chunk-6H2MKVV5.js} +1 -1
- package/dist/{chunk-42N6CDWF.js → chunk-73JEAQRT.js} +4 -4
- package/dist/{chunk-KWXZMHJS.js → chunk-7ANA7PBB.js} +3 -3
- package/dist/{chunk-2CYWEVOP.js → chunk-ADEACKAH.js} +81 -68
- package/dist/{chunk-D4XQZOHB.js → chunk-AWZS5SVX.js} +8 -8
- package/dist/{chunk-FQ5HFSFR.js → chunk-CCTYK5RH.js} +6 -6
- package/dist/{chunk-N6Q2PNSI.js → chunk-CFGBKPWQ.js} +3 -3
- package/dist/{chunk-5LEVZYXF.js → chunk-E53C73ML.js} +4 -4
- package/dist/{chunk-IBXXTO3J.js → chunk-ELCYG6UU.js} +3 -3
- package/dist/{chunk-COCVPDWX.js → chunk-ENWIHU54.js} +6 -6
- package/dist/{chunk-AZVDODSP.js → chunk-F2KSURTJ.js} +9 -9
- package/dist/{chunk-K47OVEO4.js → chunk-G35QGPO2.js} +1 -1
- package/dist/{chunk-PYBFVK6K.js → chunk-G4RARFNT.js} +50 -24
- package/dist/{chunk-S5HS6WRH.js → chunk-GY5SEFVL.js} +5 -5
- package/dist/{chunk-LG7Q4OW4.js → chunk-H4DCWLTR.js} +8 -8
- package/dist/{chunk-QDU5MW2R.js → chunk-IME5OW4Y.js} +1 -1
- package/dist/{chunk-5E5SLAVD.js → chunk-INTBMGNX.js} +23 -25
- package/dist/{chunk-HMBTX5RK.js → chunk-IOGDKPVU.js} +1 -1
- package/dist/{chunk-OICYQPKP.js → chunk-JOI3DHML.js} +1 -1
- package/dist/{chunk-GUKGU6R7.js → chunk-KNIAWMBU.js} +1 -1
- package/dist/{chunk-4UA5C7AM.js → chunk-NPO24LAN.js} +8 -8
- package/dist/{chunk-IQCL5JGL.js → chunk-NWWDFHXP.js} +1 -1
- package/dist/{chunk-ZFPEPWOO.js → chunk-OEQOAONV.js} +60 -29
- package/dist/{chunk-3YZ2Q6AW.js → chunk-P2P6MUQ4.js} +2 -2
- package/dist/{chunk-LXRTHE43.js → chunk-QMEF4Z7R.js} +5 -5
- package/dist/{chunk-D5YQPCEG.js → chunk-RFE7DCZK.js} +24 -2
- package/dist/{chunk-QWY4KI2V.js → chunk-S7GX44BU.js} +1 -1
- package/dist/{chunk-WJJDQLVL.js → chunk-U76RWMFR.js} +4 -2
- package/dist/{chunk-IOUUS6H4.js → chunk-V4HXV5MY.js} +1 -1
- package/dist/{chunk-GUMBIDDL.js → chunk-VOB2DKO6.js} +174 -34
- package/dist/{chunk-BFP3ZKG6.js → chunk-WMJS5DDV.js} +4 -4
- package/dist/{chunk-DXFUYLHX.js → chunk-WWXJUURQ.js} +1 -1
- package/dist/{chunk-QY2IU47O.js → chunk-X76JVHQ4.js} +1 -1
- package/dist/{chunk-5S6AQFNG.js → chunk-XLWZRHX5.js} +1 -1
- package/dist/{chunk-THYNA2QN.js → chunk-XND3J6AT.js} +1 -1
- package/dist/{chunk-THFNL3TL.js → chunk-XRDSML3K.js} +2 -2
- package/dist/{chunk-EYIMZY5O.js → chunk-YSLIB7ER.js} +18 -3
- package/dist/cli/chat.js +33 -33
- package/dist/cli/check.js +5 -5
- package/dist/cli/plugins.js +12 -12
- package/dist/cli/snapshot-create.js +9 -9
- package/dist/cli/upgrade.js +6 -6
- package/dist/{db-H5MDRQEY.js → db-3IEVINAY.js} +6 -6
- package/dist/instrumentation.js +3 -3
- package/dist/nitro.js +6 -6
- package/dist/{oauth-callback-server-IOU3NUHT.js → oauth-callback-server-N7L2BB4L.js} +29 -29
- package/dist/{runner-FZ5ZHLFG.js → runner-PTTZV3WU.js} +21 -21
- package/dist/{skills-AR3WD6BX.js → skills-POMWS2RR.js} +5 -5
- package/dist/spawn-R75MXXKE.js +42 -0
- package/dist/task-runner-OQLRHADB.js +36 -0
- package/dist/{validation-VYE7TQY7.js → validation-U6LOMXR7.js} +5 -5
- package/dist/version.js +1 -1
- package/dist/{work-CTQFWYKE.js → work-FHA3BS4L.js} +21 -21
- package/dist/{worker-6WQU3IT5.js → worker-GR4UNVVP.js} +10 -10
- package/package.json +5 -5
- package/dist/spawn-ZU6JABR7.js +0 -42
- package/dist/task-runner-EEGGG2PM.js +0 -36
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
authenticationUnlinkedEvent,
|
|
8
8
|
fallbackShortTitle,
|
|
9
9
|
generateShortTitle
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-RFE7DCZK.js";
|
|
11
11
|
import {
|
|
12
12
|
bindProviderConversation,
|
|
13
13
|
createSqlConversationEventStore,
|
|
@@ -16,18 +16,18 @@ import {
|
|
|
16
16
|
getSqlExecutor,
|
|
17
17
|
sanitizePostgresJson,
|
|
18
18
|
withConversationEventLock
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-ADEACKAH.js";
|
|
20
20
|
import {
|
|
21
21
|
SANDBOX_REPOS_ROOT,
|
|
22
22
|
SANDBOX_WORKSPACE_ROOT,
|
|
23
23
|
sleep
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-7ANA7PBB.js";
|
|
25
25
|
import {
|
|
26
26
|
MUTATION_LOCK_TTL_MS,
|
|
27
27
|
fenceLock,
|
|
28
28
|
getStateAdapter,
|
|
29
29
|
withLock
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-V4HXV5MY.js";
|
|
31
31
|
import {
|
|
32
32
|
agentHistoryItemSchema,
|
|
33
33
|
contextProvenance,
|
|
@@ -40,17 +40,18 @@ import {
|
|
|
40
40
|
escapeXml,
|
|
41
41
|
resolveGatewayModel,
|
|
42
42
|
unwrapCurrentInstruction
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-U76RWMFR.js";
|
|
44
44
|
import {
|
|
45
45
|
parseSlackMessageTs,
|
|
46
46
|
toStoredSlackActor
|
|
47
47
|
} from "./chunk-N7TMSOZH.js";
|
|
48
48
|
import {
|
|
49
|
+
buildTurnFailureResponse,
|
|
49
50
|
getActiveTraceId,
|
|
50
51
|
logException,
|
|
51
52
|
logWarn,
|
|
52
53
|
setSpanAttributes
|
|
53
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-X76JVHQ4.js";
|
|
54
55
|
|
|
55
56
|
// src/chat/turn-context-tag.ts
|
|
56
57
|
var TURN_CONTEXT_TAG = "runtime-turn-context";
|
|
@@ -1241,7 +1242,7 @@ async function commitMessagesLocked(args, executor) {
|
|
|
1241
1242
|
content: context.content
|
|
1242
1243
|
}
|
|
1243
1244
|
})) ?? [];
|
|
1244
|
-
await eventStore.append(args.conversationId, [
|
|
1245
|
+
const appendedEvents = await eventStore.append(args.conversationId, [
|
|
1245
1246
|
...newMessages.map((message, index) => ({
|
|
1246
1247
|
data: historyItemFromPiMessage(
|
|
1247
1248
|
message,
|
|
@@ -1251,22 +1252,19 @@ async function commitMessagesLocked(args, executor) {
|
|
|
1251
1252
|
})),
|
|
1252
1253
|
...turnContextEvents
|
|
1253
1254
|
]);
|
|
1254
|
-
|
|
1255
|
-
|
|
1255
|
+
const cursor = appendedEvents.at(-1) ?? currentEvents.at(-1);
|
|
1256
|
+
return {
|
|
1257
|
+
committedSeq: cursor?.seq ?? -1,
|
|
1258
|
+
historyVersion: cursor?.historyVersion ?? 0,
|
|
1259
|
+
messageSeqs: [
|
|
1260
|
+
...current.seqs,
|
|
1261
|
+
...appendedEvents.slice(0, newMessages.length).map((event) => event.seq)
|
|
1262
|
+
],
|
|
1263
|
+
messages: nextLocalMessages,
|
|
1264
|
+
provenance: nextLocalProvenance
|
|
1265
|
+
};
|
|
1256
1266
|
}
|
|
1257
|
-
|
|
1258
|
-
args.conversationId
|
|
1259
|
-
);
|
|
1260
|
-
const committed = projectConversationEvents(committedEvents, {
|
|
1261
|
-
defaultProfile: botConfig.defaultProfile
|
|
1262
|
-
});
|
|
1263
|
-
return {
|
|
1264
|
-
committedSeq: committedEvents.at(-1)?.seq ?? -1,
|
|
1265
|
-
historyVersion: committedEvents.at(-1)?.historyVersion ?? 0,
|
|
1266
|
-
messageSeqs: committed.seqs,
|
|
1267
|
-
messages: nextLocalMessages,
|
|
1268
|
-
provenance: nextLocalProvenance
|
|
1269
|
-
};
|
|
1267
|
+
throw new AgentHistoryBranchError(args.conversationId);
|
|
1270
1268
|
}
|
|
1271
1269
|
async function recordMcpProviderConnected(args) {
|
|
1272
1270
|
const eventStore = getConversationEventStore();
|
|
@@ -2074,6 +2072,7 @@ var storedTurnRecordSchema = z2.object({
|
|
|
2074
2072
|
committedSeq: seqCursorSchema,
|
|
2075
2073
|
historyVersion: z2.number().int().nonnegative().optional(),
|
|
2076
2074
|
errorMessage: z2.string().optional(),
|
|
2075
|
+
cumulativeToolCallCount: z2.number().int().nonnegative().optional(),
|
|
2077
2076
|
turnStartSeq: seqCursorSchema.optional(),
|
|
2078
2077
|
runtimeContext: z2.array(piMessageSchema).optional()
|
|
2079
2078
|
}).strip();
|
|
@@ -2175,6 +2174,7 @@ function materializeTurnRecord(stored, piProjection, turnStartMessageIndex, rest
|
|
|
2175
2174
|
cumulativeDurationMs: runtimeMetrics?.cumulativeDurationMs ?? 0,
|
|
2176
2175
|
...definedProps({
|
|
2177
2176
|
channelName: runtimeMetrics?.channelName,
|
|
2177
|
+
cumulativeToolCallCount: stored.cumulativeToolCallCount,
|
|
2178
2178
|
cumulativeUsage: runtimeMetrics?.cumulativeUsage,
|
|
2179
2179
|
dispatchId: stored.dispatchId,
|
|
2180
2180
|
dispatchOutcome: stored.dispatchOutcome,
|
|
@@ -2246,12 +2246,13 @@ async function materializeStoredTurnRecord(conversationId, turnId, followCurrent
|
|
|
2246
2246
|
if (!pinnedProjection) {
|
|
2247
2247
|
return void 0;
|
|
2248
2248
|
}
|
|
2249
|
-
const
|
|
2250
|
-
const currentHistoryVersion =
|
|
2249
|
+
const eventStore = getConversationEventStore();
|
|
2250
|
+
const currentHistoryVersion = await eventStore.loadCurrentHistoryVersion(conversationId);
|
|
2251
2251
|
const followsReplacement = followCurrentReplacement && (parsed.state === "running" || parsed.state === "paused") && parsed.historyVersion !== void 0 && parsed.historyVersion !== currentHistoryVersion;
|
|
2252
|
-
const piProjection = followsReplacement ? projectConversationEvents(
|
|
2253
|
-
|
|
2254
|
-
|
|
2252
|
+
const piProjection = followsReplacement ? projectConversationEvents(
|
|
2253
|
+
await eventStore.loadCurrentHistory(conversationId),
|
|
2254
|
+
{ defaultProfile: botConfig.defaultProfile }
|
|
2255
|
+
) : pinnedProjection;
|
|
2255
2256
|
const turnStartMessageIndex = followsReplacement ? 0 : parsed.turnStartSeq === void 0 ? void 0 : piProjection.seqs.filter((seq) => seq <= parsed.turnStartSeq).length;
|
|
2256
2257
|
const conversation = await getConversationStore().get({ conversationId });
|
|
2257
2258
|
const executionMetrics = executionMetricsForTurn(conversation, turnId);
|
|
@@ -2288,6 +2289,7 @@ function buildStoredRecord(args) {
|
|
|
2288
2289
|
committedSeq: args.committedSeq,
|
|
2289
2290
|
...definedProps({
|
|
2290
2291
|
actor: args.actor,
|
|
2292
|
+
cumulativeToolCallCount: args.cumulativeToolCallCount,
|
|
2291
2293
|
dispatchId: args.dispatchId,
|
|
2292
2294
|
dispatchOutcome: args.dispatchOutcome,
|
|
2293
2295
|
errorMessage: args.errorMessage,
|
|
@@ -2379,6 +2381,7 @@ async function updateTurnState(args) {
|
|
|
2379
2381
|
lastProgressAtMs: parsed.lastProgressAtMs,
|
|
2380
2382
|
previousVersion: parsed.version,
|
|
2381
2383
|
...definedProps({
|
|
2384
|
+
cumulativeToolCallCount: args.existing.cumulativeToolCallCount,
|
|
2382
2385
|
dispatchId: args.existing.dispatchId,
|
|
2383
2386
|
dispatchOutcome: args.existing.dispatchOutcome,
|
|
2384
2387
|
errorMessage: args.errorMessage ?? args.existing.errorMessage,
|
|
@@ -2473,6 +2476,7 @@ async function upsertTurnRecordLocked(args, fence) {
|
|
|
2473
2476
|
historyVersion: commit.historyVersion,
|
|
2474
2477
|
previousVersion: existingRecord?.version,
|
|
2475
2478
|
...definedProps({
|
|
2479
|
+
cumulativeToolCallCount: args.cumulativeToolCallCount ?? existingRecord?.cumulativeToolCallCount,
|
|
2476
2480
|
dispatchId,
|
|
2477
2481
|
dispatchOutcome: args.dispatchOutcome ?? existingRecord?.dispatchOutcome,
|
|
2478
2482
|
errorMessage: args.errorMessage,
|
|
@@ -2643,9 +2647,33 @@ var TurnSliceLimitExceededError = class extends Error {
|
|
|
2643
2647
|
this.name = "TurnSliceLimitExceededError";
|
|
2644
2648
|
}
|
|
2645
2649
|
};
|
|
2650
|
+
var TurnToolCallLimitExceededError = class extends Error {
|
|
2651
|
+
constructor(maxToolCalls) {
|
|
2652
|
+
super(`Agent turn exceeded execution limit (${maxToolCalls} tool calls)`);
|
|
2653
|
+
this.name = "TurnToolCallLimitExceededError";
|
|
2654
|
+
}
|
|
2655
|
+
};
|
|
2656
|
+
function isDirectTurnExecutionLimitError(error) {
|
|
2657
|
+
return error instanceof TurnSliceLimitExceededError || error instanceof TurnToolCallLimitExceededError;
|
|
2658
|
+
}
|
|
2659
|
+
function isTurnExecutionLimitExceededError(error) {
|
|
2660
|
+
if (isDirectTurnExecutionLimitError(error)) {
|
|
2661
|
+
return true;
|
|
2662
|
+
}
|
|
2663
|
+
return error instanceof Error && isDirectTurnExecutionLimitError(error.cause);
|
|
2664
|
+
}
|
|
2665
|
+
function assertTurnToolCallLimit(toolCallCount, maxToolCalls) {
|
|
2666
|
+
if (toolCallCount <= maxToolCalls) {
|
|
2667
|
+
return;
|
|
2668
|
+
}
|
|
2669
|
+
throw new TurnToolCallLimitExceededError(maxToolCalls);
|
|
2670
|
+
}
|
|
2646
2671
|
function buildTurnLimitResponse(eventId) {
|
|
2647
2672
|
return `I couldn't finish this request because this turn reached its execution limit. Please try again with a smaller or more specific request. Reference: \`event_id=${eventId}\`.`;
|
|
2648
2673
|
}
|
|
2674
|
+
function buildTurnErrorResponse(error, eventId) {
|
|
2675
|
+
return isTurnExecutionLimitExceededError(error) ? buildTurnLimitResponse(eventId) : buildTurnFailureResponse(eventId);
|
|
2676
|
+
}
|
|
2649
2677
|
|
|
2650
2678
|
// src/chat/task-execution/checkpoint.ts
|
|
2651
2679
|
function definedProps2(values) {
|
|
@@ -2699,7 +2727,8 @@ function sharedWrite(args, latest) {
|
|
|
2699
2727
|
source: args.source,
|
|
2700
2728
|
surface: args.surface ?? latest?.surface,
|
|
2701
2729
|
traceId: getActiveTraceId() ?? latest?.traceId,
|
|
2702
|
-
turnStartMessageIndex: args.turnStartMessageIndex ?? latest?.turnStartMessageIndex
|
|
2730
|
+
turnStartMessageIndex: args.turnStartMessageIndex ?? latest?.turnStartMessageIndex,
|
|
2731
|
+
cumulativeToolCallCount: args.cumulativeToolCallCount ?? latest?.cumulativeToolCallCount
|
|
2703
2732
|
})
|
|
2704
2733
|
};
|
|
2705
2734
|
}
|
|
@@ -2896,7 +2925,9 @@ export {
|
|
|
2896
2925
|
buildAgentsInstructionsMessage,
|
|
2897
2926
|
findVisibleAgentsInstructions,
|
|
2898
2927
|
TurnSliceLimitExceededError,
|
|
2899
|
-
|
|
2928
|
+
isTurnExecutionLimitExceededError,
|
|
2929
|
+
assertTurnToolCallLimit,
|
|
2930
|
+
buildTurnErrorResponse,
|
|
2900
2931
|
persistWithRetry,
|
|
2901
2932
|
getTurnRecord,
|
|
2902
2933
|
getTurnRecordForResume,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pluginCatalogRuntime
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WWXJUURQ.js";
|
|
4
4
|
import {
|
|
5
5
|
skillRoots
|
|
6
6
|
} from "./chunk-TXKUKMVO.js";
|
|
7
7
|
import {
|
|
8
8
|
logWarn
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-X76JVHQ4.js";
|
|
10
10
|
|
|
11
11
|
// src/chat/skills.ts
|
|
12
12
|
import fs from "fs/promises";
|
|
@@ -7,23 +7,23 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
formatProviderLabel,
|
|
9
9
|
startOAuthFlow
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-ENWIHU54.js";
|
|
11
11
|
import {
|
|
12
12
|
abandonReplacedPendingAuth,
|
|
13
13
|
canReusePendingAuthLink
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-G35QGPO2.js";
|
|
15
15
|
import {
|
|
16
16
|
recordAuthorizationRequested
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-OEQOAONV.js";
|
|
18
18
|
import {
|
|
19
19
|
AGENT_INVOCATION_MAILBOX_STATUSES
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-XLWZRHX5.js";
|
|
21
21
|
import {
|
|
22
22
|
TURN_REASONING_LEVELS
|
|
23
23
|
} from "./chunk-D4YV5TDV.js";
|
|
24
24
|
import {
|
|
25
25
|
pluginCatalogRuntime
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-WWXJUURQ.js";
|
|
27
27
|
import {
|
|
28
28
|
credentialContextSchema
|
|
29
29
|
} from "./chunk-CEMMLV5L.js";
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
} from "./chunk-PDO5BLNM.js";
|
|
4
4
|
import {
|
|
5
5
|
botConfig
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-U76RWMFR.js";
|
|
7
7
|
import {
|
|
8
8
|
logWarn
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-X76JVHQ4.js";
|
|
10
10
|
|
|
11
11
|
// src/chat/conversations/structured-events.ts
|
|
12
12
|
import {
|
|
@@ -174,6 +174,26 @@ function getComponentTotal(usage) {
|
|
|
174
174
|
}
|
|
175
175
|
return total;
|
|
176
176
|
}
|
|
177
|
+
function agentTurnCostUsd(usage) {
|
|
178
|
+
if (!usage?.cost) return void 0;
|
|
179
|
+
const total = getFiniteCost(usage.cost.total);
|
|
180
|
+
if (total !== void 0) return total;
|
|
181
|
+
let componentTotal = 0;
|
|
182
|
+
let hasComponent = false;
|
|
183
|
+
for (const field of COST_COMPONENT_FIELDS) {
|
|
184
|
+
const value = getFiniteCost(usage.cost[field]);
|
|
185
|
+
if (value === void 0) continue;
|
|
186
|
+
hasComponent = true;
|
|
187
|
+
componentTotal = addCost(componentTotal, value);
|
|
188
|
+
}
|
|
189
|
+
return hasComponent ? componentTotal : void 0;
|
|
190
|
+
}
|
|
191
|
+
function agentTurnTotalTokens(usage) {
|
|
192
|
+
if (!usage) return void 0;
|
|
193
|
+
const componentTotal = getComponentTotal(usage);
|
|
194
|
+
if (componentTotal !== void 0) return componentTotal;
|
|
195
|
+
return getFiniteCount(usage.totalTokens);
|
|
196
|
+
}
|
|
177
197
|
function addAgentTurnUsage(...usages) {
|
|
178
198
|
const components = {};
|
|
179
199
|
let componentTotal;
|
|
@@ -307,5 +327,7 @@ export {
|
|
|
307
327
|
ToolInputError,
|
|
308
328
|
agentTurnUsageSchema,
|
|
309
329
|
hasAgentTurnUsage,
|
|
330
|
+
agentTurnCostUsd,
|
|
331
|
+
agentTurnTotalTokens,
|
|
310
332
|
addAgentTurnUsage
|
|
311
333
|
};
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
toCanonicalInputMessage,
|
|
8
8
|
toCanonicalOutputMessage,
|
|
9
9
|
toGenAiMessagesTraceAttributes
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-JOI3DHML.js";
|
|
11
11
|
import {
|
|
12
12
|
extractGenAiUsageAttributes,
|
|
13
13
|
logException,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
normalizeGenAiFinishReason,
|
|
16
16
|
serializeGenAiAttribute,
|
|
17
17
|
withSpan
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-X76JVHQ4.js";
|
|
19
19
|
|
|
20
20
|
// src/chat/services/provider-error.ts
|
|
21
21
|
var ProviderError = class extends Error {
|
|
@@ -674,6 +674,7 @@ function normalizeSlackEmojiName(value) {
|
|
|
674
674
|
var MIN_AGENT_TURN_TIMEOUT_MS = 10 * 1e3;
|
|
675
675
|
var DEFAULT_AGENT_TURN_TIMEOUT_MS = 12 * 60 * 1e3;
|
|
676
676
|
var MAX_SLICES_PER_TURN = 100;
|
|
677
|
+
var MAX_TOOL_CALLS_PER_TURN = 150;
|
|
677
678
|
var DEFAULT_FUNCTION_MAX_DURATION_SECONDS = 300;
|
|
678
679
|
var DEFAULT_SLACK_SLASH_COMMAND = "/jr";
|
|
679
680
|
var DEFAULT_PROCESSING_REACTION_EMOJI = "eyes";
|
|
@@ -902,6 +903,7 @@ function readBotConfig(env, functionMaxDurationSeconds) {
|
|
|
902
903
|
loadingMessages: parseLoadingMessages(env.JUNIOR_LOADING_MESSAGES),
|
|
903
904
|
visionModelId: validateGatewayModelId(env.AI_VISION_MODEL),
|
|
904
905
|
maxSlicesPerTurn: MAX_SLICES_PER_TURN,
|
|
906
|
+
maxToolCallsPerTurn: MAX_TOOL_CALLS_PER_TURN,
|
|
905
907
|
turnTimeoutMs: parseAgentTurnTimeoutMs(
|
|
906
908
|
env.AGENT_TURN_TIMEOUT_MS,
|
|
907
909
|
maxTurnTimeoutMs
|