@sentry/junior 0.179.0 → 0.180.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-32IDCLMW.js → agent-hooks-DKDDRKZA.js} +16 -18
- package/dist/api/schema.js +0 -1
- package/dist/api.js +199 -197
- package/dist/app.d.ts +4 -0
- package/dist/app.js +300 -1259
- package/dist/catalog-runtime-WXKGUF3W.js +14 -0
- package/dist/chat/agent/sandbox.d.ts +0 -2
- package/dist/chat/api-turns/routing.d.ts +4 -0
- package/dist/chat/api-turns/work.d.ts +5 -0
- package/dist/chat/config.d.ts +5 -2
- package/dist/chat/configuration/defaults.d.ts +1 -1
- package/dist/chat/conversations/projection.d.ts +6 -4
- package/dist/chat/ingress/message-router.d.ts +3 -0
- package/dist/chat/model-profile.d.ts +8 -10
- package/dist/chat/pi/conversation-events.d.ts +3 -2
- package/dist/chat/plugins/task-queue.d.ts +40 -3
- package/dist/chat/plugins/task-runner.d.ts +1 -1
- package/dist/chat/queue/callback.d.ts +26 -0
- package/dist/chat/queue/sign.d.ts +30 -0
- package/dist/chat/sandbox/sandbox.d.ts +0 -2
- package/dist/chat/sandbox/session.d.ts +0 -2
- package/dist/chat/sandbox/skill-sync.d.ts +1 -1
- package/dist/chat/sandbox/snapshot/events.d.ts +23 -0
- package/dist/chat/sandbox/snapshot/job-callback.d.ts +5 -0
- package/dist/chat/sandbox/snapshot/job-queue.d.ts +26 -0
- package/dist/chat/sandbox/snapshot/job-runner.d.ts +11 -0
- package/dist/chat/sandbox/snapshot/not-ready-error.d.ts +6 -0
- package/dist/chat/sandbox/snapshot/workspace.d.ts +9 -3
- package/dist/chat/services/turn-router.d.ts +4 -3
- package/dist/chat/task-execution/queue-signing.d.ts +10 -21
- package/dist/chat/task-execution/state.d.ts +48 -0
- package/dist/chat/task-execution/store.d.ts +28 -2
- package/dist/chat/task-execution/worker.d.ts +4 -1
- package/dist/chat/tools/handoff/tool.d.ts +1 -1
- package/dist/{chunk-B6ECUSVX.js → chunk-2AYEVN7K.js} +8 -8
- package/dist/{chunk-SLGGOASN.js → chunk-2YIRH4E3.js} +46 -46
- package/dist/{chunk-KJLHIHFF.js → chunk-3ILJBWP7.js} +35 -227
- package/dist/{chunk-RZRYOLCE.js → chunk-5PUMIMNQ.js} +2292 -1147
- package/dist/{chunk-CJLBLELR.js → chunk-5TUR4M3M.js} +8 -61
- package/dist/{chunk-6ZWRNC4D.js → chunk-6Y5B5PEX.js} +1 -1
- package/dist/{chunk-XSPSCWLH.js → chunk-6YCEWOLO.js} +4 -4
- package/dist/chunk-7H2VZTWN.js +103 -0
- package/dist/{chunk-FAS6AIMF.js → chunk-CCDXTDSY.js} +8 -8
- package/dist/{chunk-CGA4ERJ5.js → chunk-CEMMLV5L.js} +1 -1
- package/dist/{chunk-XZY6G5YZ.js → chunk-CK6EINVZ.js} +180 -87
- package/dist/{chunk-FIANEE7Z.js → chunk-CM5HNV2W.js} +6 -6
- package/dist/{chunk-JT4WMD3C.js → chunk-CP73FKME.js} +144 -218
- package/dist/{chunk-3I7XE3PA.js → chunk-DHLOGWYH.js} +36 -36
- package/dist/chunk-DKIJ2RP5.js +68 -0
- package/dist/{chunk-YFNAMRGE.js → chunk-DRHEGXTZ.js} +1 -1
- package/dist/{chunk-OOUNJNMR.js → chunk-DWPN6SCH.js} +1 -1
- package/dist/chunk-EWHP2IRG.js +209 -0
- package/dist/{chunk-R6U7N4FS.js → chunk-FGC3PHNH.js} +3 -3
- package/dist/{chunk-3TM3FYLQ.js → chunk-GA5NS74S.js} +1 -1
- package/dist/{chunk-FIDMHAO6.js → chunk-GPXAHUQH.js} +84 -274
- package/dist/chunk-GUKXEPMX.js +218 -0
- package/dist/{chunk-GENV6KF2.js → chunk-I6IFTAPF.js} +108 -76
- package/dist/{chunk-R5NWWYIS.js → chunk-IANUX7HX.js} +5 -5
- package/dist/{chunk-G2CAC4CV.js → chunk-KCL6AWYW.js} +74 -68
- package/dist/{chunk-5IRROPA5.js → chunk-L7LTGN4Z.js} +129 -31
- package/dist/{chunk-Q5B3WTGG.js → chunk-LGVQLNLS.js} +42 -41
- package/dist/chunk-M3QYTBQ6.js +55 -0
- package/dist/{chunk-FTGD2FBP.js → chunk-MXEUIGHO.js} +2 -2
- package/dist/{chunk-M63DETLL.js → chunk-N7TMSOZH.js} +6 -6
- package/dist/{chunk-2HIPYNQI.js → chunk-O4QYZTDK.js} +33 -32
- package/dist/chunk-PEQXYSSE.js +45 -0
- package/dist/{chunk-RTRBYSF3.js → chunk-QSO7B5JO.js} +1 -1
- package/dist/{chunk-HQNE5APD.js → chunk-RAZG3YHC.js} +100 -79
- package/dist/{chunk-VP4OVRDD.js → chunk-S7YRTOSQ.js} +69 -73
- package/dist/{chunk-U4TKB6F6.js → chunk-SDBKZ5LV.js} +108 -5
- package/dist/{chunk-GPLAT6H7.js → chunk-TC5DE5KJ.js} +22 -18
- package/dist/{chunk-H4HBKISO.js → chunk-TXKUKMVO.js} +1 -1
- package/dist/chunk-U5EUCUBH.js +164 -0
- package/dist/{chunk-3AFVR5UC.js → chunk-VG722ONZ.js} +18 -16
- package/dist/{chunk-ZQMG3CL5.js → chunk-VGPPWWHF.js} +16 -16
- package/dist/{chunk-JMJNFEDC.js → chunk-WVAMRKYG.js} +9 -54
- package/dist/chunk-X6GDDWQH.js +60 -0
- package/dist/{chunk-4GWXAILB.js → chunk-ZE2KOV3G.js} +1 -1
- package/dist/{chunk-TIEKUH4Q.js → chunk-ZM7ZURJS.js} +4 -3
- package/dist/cli/chat.js +47 -43
- package/dist/cli/check.js +13 -15
- package/dist/cli/env.js +0 -1
- package/dist/cli/init.js +0 -1
- package/dist/cli/main.js +2 -3
- package/dist/cli/plugins.js +18 -20
- package/dist/cli/run.js +0 -1
- package/dist/cli/snapshot-create.js +14 -16
- package/dist/cli/upgrade.js +16 -18
- package/dist/{conversation-work-KATFHLG3.js → conversation-work-VIOQ5ZF3.js} +0 -2
- package/dist/{db-EJAV7JL6.js → db-6SBHIAJK.js} +8 -10
- package/dist/deployment.d.ts +1 -0
- package/dist/{discovery-GUFTFBTL.js → discovery-DWVDM7UK.js} +1 -2
- package/dist/{experimental-XVDOSRBS.js → experimental-SIJSRDJD.js} +0 -1
- package/dist/instrumentation.js +7 -9
- package/dist/nitro.js +39 -13
- package/dist/{oauth-callback-server-GAVSUBTQ.js → oauth-callback-server-WSDQPZZS.js} +34 -32
- package/dist/{oauth-relay-3ZU72UGL.js → oauth-relay-5XPVRPYB.js} +0 -1
- package/dist/{plugins-HW4VWW6G.js → plugins-YTYJMMJF.js} +1 -2
- package/dist/{runner-34JL64JF.js → runner-GWTSWESR.js} +39 -33
- package/dist/{sandbox-egress-signals-DXOOBSBI.js → sandbox-egress-signals-FIL7EGPR.js} +5 -6
- package/dist/{sentry-JMWTS32N.js → sentry-MB3NL3IR.js} +1 -2
- package/dist/skills-F32BPFYW.js +27 -0
- package/dist/spawn-X5BPP5OE.js +37 -0
- package/dist/task-runner-2FPBV5PP.js +32 -0
- package/dist/validation-62WO524A.js +17 -0
- package/dist/vercel.js +0 -1
- package/dist/version.js +1 -2
- package/dist/work-3C3CMZ24.js +45 -0
- package/dist/worker-MFAI6ZEK.js +22 -0
- package/package.json +8 -7
- package/dist/catalog-runtime-FBVA6WAQ.js +0 -16
- package/dist/chat/plugins/task-callback.d.ts +0 -5
- package/dist/chat/plugins/task-message.d.ts +0 -23
- package/dist/chat/plugins/task-signing.d.ts +0 -31
- package/dist/chat/sandbox/snapshot/waiting-error.d.ts +0 -15
- package/dist/chat/services/workspace-snapshot-wait.d.ts +0 -27
- package/dist/chunk-5I6ORJUY.js +0 -127
- package/dist/chunk-6GWA276C.js +0 -72
- package/dist/chunk-MLKGABMK.js +0 -9
- package/dist/chunk-UT6X7XN7.js +0 -51
- package/dist/chunk-WR76IVA5.js +0 -130
- package/dist/skills-U545HALM.js +0 -29
- package/dist/spawn-I2S4IDUQ.js +0 -37
- package/dist/validation-EVXVGA44.js +0 -19
- package/dist/work-QOAUPDBU.js +0 -45
- package/dist/worker-5GX2IKLZ.js +0 -24
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-PDO5BLNM.js";
|
|
4
4
|
import {
|
|
5
5
|
ToolInputError
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-DHLOGWYH.js";
|
|
7
7
|
import {
|
|
8
8
|
agentHistoryItemSchema,
|
|
9
9
|
bindProviderConversation,
|
|
@@ -16,35 +16,35 @@ import {
|
|
|
16
16
|
instructionProvenanceFor,
|
|
17
17
|
sanitizePostgresJson,
|
|
18
18
|
withConversationEventLock
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-S7YRTOSQ.js";
|
|
20
20
|
import {
|
|
21
21
|
SANDBOX_REPOS_ROOT,
|
|
22
22
|
SANDBOX_WORKSPACE_ROOT,
|
|
23
23
|
sleep
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-WVAMRKYG.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-GA5NS74S.js";
|
|
31
31
|
import {
|
|
32
32
|
botConfig,
|
|
33
33
|
completeText,
|
|
34
34
|
escapeXml,
|
|
35
35
|
resolveGatewayModel,
|
|
36
36
|
unwrapCurrentInstruction
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-I6IFTAPF.js";
|
|
38
38
|
import {
|
|
39
39
|
parseSlackMessageTs,
|
|
40
40
|
toStoredSlackActor
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-N7TMSOZH.js";
|
|
42
42
|
import {
|
|
43
43
|
getActiveTraceId,
|
|
44
44
|
logException,
|
|
45
45
|
logWarn,
|
|
46
46
|
setSpanAttributes
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-RAZG3YHC.js";
|
|
48
48
|
|
|
49
49
|
// src/chat/turn-context-tag.ts
|
|
50
50
|
var TURN_CONTEXT_TAG = "runtime-turn-context";
|
|
@@ -337,7 +337,7 @@ function recordDeliveredAssistantMessage(args) {
|
|
|
337
337
|
},
|
|
338
338
|
meta: {
|
|
339
339
|
replied: true,
|
|
340
|
-
...args.source ? { source: args.source } :
|
|
340
|
+
...args.source ? { source: args.source } : void 0
|
|
341
341
|
}
|
|
342
342
|
});
|
|
343
343
|
return messageId;
|
|
@@ -769,8 +769,8 @@ function splitMeta(meta) {
|
|
|
769
769
|
const author = rest.author;
|
|
770
770
|
delete rest.author;
|
|
771
771
|
return {
|
|
772
|
-
...author ? { author } :
|
|
773
|
-
...Object.keys(rest).length > 0 ? { meta: rest } :
|
|
772
|
+
...author ? { author } : void 0,
|
|
773
|
+
...Object.keys(rest).length > 0 ? { meta: rest } : void 0
|
|
774
774
|
};
|
|
775
775
|
}
|
|
776
776
|
function missingBaselineError(event) {
|
|
@@ -805,7 +805,7 @@ function projectConversationMessages(history) {
|
|
|
805
805
|
...message,
|
|
806
806
|
createdAtMs: current?.message.createdAtMs ?? message.createdAtMs
|
|
807
807
|
},
|
|
808
|
-
...current?.repliedAtMs === void 0 ?
|
|
808
|
+
...current?.repliedAtMs === void 0 ? void 0 : { repliedAtMs: current.repliedAtMs }
|
|
809
809
|
});
|
|
810
810
|
continue;
|
|
811
811
|
}
|
|
@@ -835,7 +835,7 @@ function toStoredConversationMessage(message) {
|
|
|
835
835
|
messageId: message.id,
|
|
836
836
|
role: message.role,
|
|
837
837
|
text: message.text,
|
|
838
|
-
...Object.keys(meta).length > 0 ? { meta } :
|
|
838
|
+
...Object.keys(meta).length > 0 ? { meta } : void 0,
|
|
839
839
|
createdAtMs: message.createdAtMs
|
|
840
840
|
};
|
|
841
841
|
}
|
|
@@ -894,8 +894,8 @@ async function appendConversationMessages(eventStore, args) {
|
|
|
894
894
|
messageId: stored.messageId,
|
|
895
895
|
role: stored.role,
|
|
896
896
|
text: stored.text,
|
|
897
|
-
...stored.authorIdentityId ? { authorIdentityId: stored.authorIdentityId } :
|
|
898
|
-
...stored.meta ? { meta: stored.meta } :
|
|
897
|
+
...stored.authorIdentityId ? { authorIdentityId: stored.authorIdentityId } : void 0,
|
|
898
|
+
...stored.meta ? { meta: stored.meta } : void 0
|
|
899
899
|
}
|
|
900
900
|
}
|
|
901
901
|
] : [] : [
|
|
@@ -907,8 +907,8 @@ async function appendConversationMessages(eventStore, args) {
|
|
|
907
907
|
messageId: stored.messageId,
|
|
908
908
|
role: stored.role,
|
|
909
909
|
text: stored.text,
|
|
910
|
-
...stored.authorIdentityId ? { authorIdentityId: stored.authorIdentityId } :
|
|
911
|
-
...stored.meta ? { meta: stored.meta } :
|
|
910
|
+
...stored.authorIdentityId ? { authorIdentityId: stored.authorIdentityId } : void 0,
|
|
911
|
+
...stored.meta ? { meta: stored.meta } : void 0
|
|
912
912
|
}
|
|
913
913
|
}
|
|
914
914
|
];
|
|
@@ -1000,11 +1000,11 @@ var authenticationLinkedEvent = defineConversationEvent({
|
|
|
1000
1000
|
return {
|
|
1001
1001
|
icon: "link",
|
|
1002
1002
|
title: `${provider} connected`,
|
|
1003
|
-
...event.accountLabel ? { preview: `Connected as \`${event.accountLabel}\`` } :
|
|
1003
|
+
...event.accountLabel ? { preview: `Connected as \`${event.accountLabel}\`` } : void 0,
|
|
1004
1004
|
details: [
|
|
1005
1005
|
{
|
|
1006
1006
|
title: `${provider} connected`,
|
|
1007
|
-
...event.accountLabel ? { description: `Connected as \`${event.accountLabel}\`` } :
|
|
1007
|
+
...event.accountLabel ? { description: `Connected as \`${event.accountLabel}\`` } : void 0,
|
|
1008
1008
|
metadata: [event.provider]
|
|
1009
1009
|
}
|
|
1010
1010
|
]
|
|
@@ -1039,13 +1039,13 @@ var agentsInstructionsUpdatedEvent = defineConversationEvent({
|
|
|
1039
1039
|
return {
|
|
1040
1040
|
icon: "brain",
|
|
1041
1041
|
title,
|
|
1042
|
-
...preview ? { preview } :
|
|
1042
|
+
...preview ? { preview } : void 0,
|
|
1043
1043
|
...event.sources.length > 0 ? {
|
|
1044
1044
|
details: event.sources.map((source) => ({
|
|
1045
1045
|
title: sourceFilename(source.path),
|
|
1046
1046
|
content: source.content
|
|
1047
1047
|
}))
|
|
1048
|
-
} :
|
|
1048
|
+
} : void 0
|
|
1049
1049
|
};
|
|
1050
1050
|
}
|
|
1051
1051
|
});
|
|
@@ -1127,10 +1127,10 @@ function projectConversationEvents(events, options) {
|
|
|
1127
1127
|
const messages = [];
|
|
1128
1128
|
const provenance = [];
|
|
1129
1129
|
const seqs = [];
|
|
1130
|
-
let modelProfile =
|
|
1131
|
-
let
|
|
1130
|
+
let modelProfile = options.defaultProfile;
|
|
1131
|
+
let replacementSeq;
|
|
1132
1132
|
for (const event of events) {
|
|
1133
|
-
if (options
|
|
1133
|
+
if (options.maxSeq !== void 0 && event.seq > options.maxSeq) break;
|
|
1134
1134
|
if (event.data.type === "unknown") {
|
|
1135
1135
|
throw new Error(
|
|
1136
1136
|
`Unsupported conversation event "${event.data.originalType}" at seq ${event.seq} (schema version ${event.schemaVersion})`
|
|
@@ -1138,7 +1138,7 @@ function projectConversationEvents(events, options) {
|
|
|
1138
1138
|
}
|
|
1139
1139
|
if (event.data.type === "compaction" || event.data.type === "handoff") {
|
|
1140
1140
|
modelProfile = event.data.modelProfile;
|
|
1141
|
-
|
|
1141
|
+
replacementSeq = event.seq;
|
|
1142
1142
|
for (const replacement of event.data.replacementHistory) {
|
|
1143
1143
|
for (const message of durableMessages(
|
|
1144
1144
|
piMessageFromHistoryItem(replacement.item)
|
|
@@ -1168,7 +1168,13 @@ function projectConversationEvents(events, options) {
|
|
|
1168
1168
|
seqs.push(event.seq);
|
|
1169
1169
|
}
|
|
1170
1170
|
}
|
|
1171
|
-
return {
|
|
1171
|
+
return {
|
|
1172
|
+
messages,
|
|
1173
|
+
provenance,
|
|
1174
|
+
seqs,
|
|
1175
|
+
modelProfile,
|
|
1176
|
+
replacementSeq
|
|
1177
|
+
};
|
|
1172
1178
|
}
|
|
1173
1179
|
|
|
1174
1180
|
// src/chat/conversations/projection.ts
|
|
@@ -1283,25 +1289,32 @@ async function loadProjection(args) {
|
|
|
1283
1289
|
const events = await getConversationEventStore().loadCurrentHistory(
|
|
1284
1290
|
args.conversationId
|
|
1285
1291
|
);
|
|
1286
|
-
return projectConversationEvents(events
|
|
1292
|
+
return projectConversationEvents(events, {
|
|
1293
|
+
defaultProfile: botConfig.defaultProfile
|
|
1294
|
+
}).messages;
|
|
1287
1295
|
}
|
|
1288
1296
|
async function loadConversationProjection(args) {
|
|
1289
1297
|
const events = await getConversationEventStore().loadCurrentHistory(
|
|
1290
1298
|
args.conversationId
|
|
1291
1299
|
);
|
|
1292
|
-
return projectConversationEvents(events
|
|
1300
|
+
return projectConversationEvents(events, {
|
|
1301
|
+
defaultProfile: botConfig.defaultProfile
|
|
1302
|
+
});
|
|
1293
1303
|
}
|
|
1294
1304
|
async function openConversationProjection(args) {
|
|
1295
1305
|
const events = await getConversationEventStore().loadCurrentHistory(
|
|
1296
1306
|
args.conversationId
|
|
1297
1307
|
);
|
|
1298
|
-
return projectConversationEvents(events
|
|
1308
|
+
return projectConversationEvents(events, {
|
|
1309
|
+
defaultProfile: botConfig.defaultProfile
|
|
1310
|
+
});
|
|
1299
1311
|
}
|
|
1300
1312
|
async function loadTurnProjection(args) {
|
|
1301
1313
|
const eventStore = getConversationEventStore();
|
|
1302
1314
|
if (args.committedSeq < 0) {
|
|
1303
1315
|
return projectConversationEvents(
|
|
1304
|
-
await eventStore.loadCurrentHistory(args.conversationId)
|
|
1316
|
+
await eventStore.loadCurrentHistory(args.conversationId),
|
|
1317
|
+
{ defaultProfile: botConfig.defaultProfile }
|
|
1305
1318
|
);
|
|
1306
1319
|
}
|
|
1307
1320
|
const historyEvents = await eventStore.loadHistoryContaining(
|
|
@@ -1312,7 +1325,9 @@ async function loadTurnProjection(args) {
|
|
|
1312
1325
|
if (!historyEvents) {
|
|
1313
1326
|
return void 0;
|
|
1314
1327
|
}
|
|
1315
|
-
return projectConversationEvents(historyEvents
|
|
1328
|
+
return projectConversationEvents(historyEvents, {
|
|
1329
|
+
defaultProfile: botConfig.defaultProfile
|
|
1330
|
+
});
|
|
1316
1331
|
}
|
|
1317
1332
|
async function loadConnectedMcpProviders(args) {
|
|
1318
1333
|
const events = await getConversationEventStore().loadHistory(
|
|
@@ -1358,7 +1373,7 @@ async function commitAcceptedReply(args) {
|
|
|
1358
1373
|
{
|
|
1359
1374
|
conversation: args.conversation,
|
|
1360
1375
|
conversationId: args.conversationId,
|
|
1361
|
-
...args.repliedAtMs === void 0 ?
|
|
1376
|
+
...args.repliedAtMs === void 0 ? void 0 : { repliedAtMs: args.repliedAtMs }
|
|
1362
1377
|
}
|
|
1363
1378
|
);
|
|
1364
1379
|
for (const binding of args.providerConversationBindings ?? []) {
|
|
@@ -1375,7 +1390,9 @@ async function commitMessagesLocked(args, executor) {
|
|
|
1375
1390
|
const currentEvents = await eventStore.loadCurrentHistory(
|
|
1376
1391
|
args.conversationId
|
|
1377
1392
|
);
|
|
1378
|
-
const current = projectConversationEvents(currentEvents
|
|
1393
|
+
const current = projectConversationEvents(currentEvents, {
|
|
1394
|
+
defaultProfile: botConfig.defaultProfile
|
|
1395
|
+
});
|
|
1379
1396
|
const nextLocalMessages = stripRuntimeTurnContext(args.messages).map(
|
|
1380
1397
|
normalizeDurableMessage
|
|
1381
1398
|
);
|
|
@@ -1387,9 +1404,9 @@ async function commitMessagesLocked(args, executor) {
|
|
|
1387
1404
|
existing: current,
|
|
1388
1405
|
nextMessages: nextLocalMessages,
|
|
1389
1406
|
matchingPrefix,
|
|
1390
|
-
...args.provenance ? { explicitProvenance: args.provenance } :
|
|
1391
|
-
...args.trailingMessageProvenance ? { trailingMessageProvenance: args.trailingMessageProvenance } :
|
|
1392
|
-
...args.newMessageProvenance ? { newMessageProvenance: args.newMessageProvenance } :
|
|
1407
|
+
...args.provenance ? { explicitProvenance: args.provenance } : void 0,
|
|
1408
|
+
...args.trailingMessageProvenance ? { trailingMessageProvenance: args.trailingMessageProvenance } : void 0,
|
|
1409
|
+
...args.newMessageProvenance ? { newMessageProvenance: args.newMessageProvenance } : void 0
|
|
1393
1410
|
});
|
|
1394
1411
|
if (matchingPrefix === current.messages.length) {
|
|
1395
1412
|
const newMessages = nextLocalMessages.slice(matchingPrefix);
|
|
@@ -1422,7 +1439,9 @@ async function commitMessagesLocked(args, executor) {
|
|
|
1422
1439
|
const committedEvents = await eventStore.loadCurrentHistory(
|
|
1423
1440
|
args.conversationId
|
|
1424
1441
|
);
|
|
1425
|
-
const committed = projectConversationEvents(committedEvents
|
|
1442
|
+
const committed = projectConversationEvents(committedEvents, {
|
|
1443
|
+
defaultProfile: botConfig.defaultProfile
|
|
1444
|
+
});
|
|
1426
1445
|
return {
|
|
1427
1446
|
committedSeq: committedEvents.at(-1)?.seq ?? -1,
|
|
1428
1447
|
historyVersion: committedEvents.at(-1)?.historyVersion ?? 0,
|
|
@@ -1504,9 +1523,9 @@ async function recordAuthenticationAccountChange(action, args) {
|
|
|
1504
1523
|
const content = definition.parse({
|
|
1505
1524
|
actorId: args.actorId,
|
|
1506
1525
|
provider: args.provider,
|
|
1507
|
-
...args.accountLabel ? { accountLabel: args.accountLabel } :
|
|
1508
|
-
...args.authorizationId ? { authorizationId: args.authorizationId } :
|
|
1509
|
-
...args.providerLabel ? { providerLabel: args.providerLabel } :
|
|
1526
|
+
...args.accountLabel ? { accountLabel: args.accountLabel } : void 0,
|
|
1527
|
+
...args.authorizationId ? { authorizationId: args.authorizationId } : void 0,
|
|
1528
|
+
...args.providerLabel ? { providerLabel: args.providerLabel } : void 0
|
|
1510
1529
|
});
|
|
1511
1530
|
await getConversationEventStore().append(args.conversationId, [
|
|
1512
1531
|
{
|
|
@@ -1522,7 +1541,7 @@ async function recordAuthenticationAccountChange(action, args) {
|
|
|
1522
1541
|
namespace: JUNIOR_NATIVE_EVENT_NAMESPACE,
|
|
1523
1542
|
name: definition.eventName,
|
|
1524
1543
|
version: definition.version,
|
|
1525
|
-
...args.turnId ? { turnId: args.turnId } :
|
|
1544
|
+
...args.turnId ? { turnId: args.turnId } : void 0,
|
|
1526
1545
|
content
|
|
1527
1546
|
}
|
|
1528
1547
|
}
|
|
@@ -1561,8 +1580,8 @@ async function recordAgentsInstructionsUpdated(args) {
|
|
|
1561
1580
|
action,
|
|
1562
1581
|
fingerprint,
|
|
1563
1582
|
sources: instructions?.sources ?? [],
|
|
1564
|
-
...instructions ? { directory: instructions.directory } :
|
|
1565
|
-
...instructions ? { textBytes: Buffer.byteLength(instructions.text, "utf8") } :
|
|
1583
|
+
...instructions ? { directory: instructions.directory } : void 0,
|
|
1584
|
+
...instructions ? { textBytes: Buffer.byteLength(instructions.text, "utf8") } : void 0
|
|
1566
1585
|
});
|
|
1567
1586
|
await getConversationEventStore().append(args.conversationId, [
|
|
1568
1587
|
{
|
|
@@ -1598,7 +1617,7 @@ async function recordSubscribedReplyRoute(args) {
|
|
|
1598
1617
|
costUsd: args.costUsd,
|
|
1599
1618
|
reason: args.reason,
|
|
1600
1619
|
shouldReply: args.shouldReply,
|
|
1601
|
-
...args.shouldUnsubscribe !== void 0 ? { shouldUnsubscribe: args.shouldUnsubscribe } :
|
|
1620
|
+
...args.shouldUnsubscribe !== void 0 ? { shouldUnsubscribe: args.shouldUnsubscribe } : void 0
|
|
1602
1621
|
}
|
|
1603
1622
|
}
|
|
1604
1623
|
}
|
|
@@ -1615,7 +1634,7 @@ async function loadTurnRoute(args) {
|
|
|
1615
1634
|
if (event.data.type !== "turn_routed" || event.data.turnId !== args.turnId) {
|
|
1616
1635
|
throw new Error(`Turn route key for "${args.turnId}" has invalid data`);
|
|
1617
1636
|
}
|
|
1618
|
-
return event.data;
|
|
1637
|
+
return { ...event.data, seq: event.seq };
|
|
1619
1638
|
}
|
|
1620
1639
|
async function recordTurnRoute(args) {
|
|
1621
1640
|
await getConversationEventStore().append(args.conversationId, [
|
|
@@ -1627,9 +1646,9 @@ async function recordTurnRoute(args) {
|
|
|
1627
1646
|
turnId: args.turnId,
|
|
1628
1647
|
modelProfile: args.modelProfile,
|
|
1629
1648
|
modelId: args.modelId,
|
|
1630
|
-
...args.costUsd !== void 0 ? { costUsd: args.costUsd } :
|
|
1649
|
+
...args.costUsd !== void 0 ? { costUsd: args.costUsd } : void 0,
|
|
1631
1650
|
reasoningLevel: args.reasoningLevel,
|
|
1632
|
-
...args.confidence !== void 0 ? { confidence: args.confidence } :
|
|
1651
|
+
...args.confidence !== void 0 ? { confidence: args.confidence } : void 0,
|
|
1633
1652
|
source: args.source
|
|
1634
1653
|
}
|
|
1635
1654
|
}
|
|
@@ -1664,8 +1683,8 @@ async function recordAttachmentsDelivered(args) {
|
|
|
1664
1683
|
idempotencyKey: attachmentsDeliveredIdempotencyKey({
|
|
1665
1684
|
attachments: args.attachments,
|
|
1666
1685
|
conversationId: args.conversationId,
|
|
1667
|
-
...args.toolCallId ? { toolCallId: args.toolCallId } :
|
|
1668
|
-
...args.turnId ? { turnId: args.turnId } :
|
|
1686
|
+
...args.toolCallId ? { toolCallId: args.toolCallId } : void 0,
|
|
1687
|
+
...args.turnId ? { turnId: args.turnId } : void 0
|
|
1669
1688
|
}),
|
|
1670
1689
|
data: {
|
|
1671
1690
|
type: "attachments_delivered",
|
|
@@ -1675,8 +1694,8 @@ async function recordAttachmentsDelivered(args) {
|
|
|
1675
1694
|
contentType: attachment.contentType,
|
|
1676
1695
|
bytes: attachment.bytes
|
|
1677
1696
|
})),
|
|
1678
|
-
...args.toolCallId ? { toolCallId: args.toolCallId } :
|
|
1679
|
-
...args.turnId ? { turnId: args.turnId } :
|
|
1697
|
+
...args.toolCallId ? { toolCallId: args.toolCallId } : void 0,
|
|
1698
|
+
...args.turnId ? { turnId: args.turnId } : void 0
|
|
1680
1699
|
},
|
|
1681
1700
|
createdAtMs: args.createdAtMs ?? Date.now()
|
|
1682
1701
|
}
|
|
@@ -1690,7 +1709,7 @@ async function recordGuardianActionReviewed(args) {
|
|
|
1690
1709
|
turnId: args.turnId,
|
|
1691
1710
|
toolCallId: args.toolCallId,
|
|
1692
1711
|
toolName: args.toolName,
|
|
1693
|
-
...args.costUsd !== void 0 ? { costUsd: args.costUsd } :
|
|
1712
|
+
...args.costUsd !== void 0 ? { costUsd: args.costUsd } : void 0,
|
|
1694
1713
|
decision: args.decision,
|
|
1695
1714
|
riskLevel: args.riskLevel,
|
|
1696
1715
|
userAuthorization: args.userAuthorization
|
|
@@ -1700,129 +1719,6 @@ async function recordGuardianActionReviewed(args) {
|
|
|
1700
1719
|
]);
|
|
1701
1720
|
}
|
|
1702
1721
|
|
|
1703
|
-
// src/chat/state/turn-id.ts
|
|
1704
|
-
function buildDeterministicTurnId(messageId) {
|
|
1705
|
-
const sanitized = messageId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
1706
|
-
return `turn_${sanitized}`;
|
|
1707
|
-
}
|
|
1708
|
-
function buildDeterministicAssistantMessageId(turnId) {
|
|
1709
|
-
return `${turnId}:assistant:1`;
|
|
1710
|
-
}
|
|
1711
|
-
|
|
1712
|
-
// src/chat/runtime/turn.ts
|
|
1713
|
-
var ConversationTurnBoundaryError = class extends Error {
|
|
1714
|
-
eventId;
|
|
1715
|
-
failureCode;
|
|
1716
|
-
constructor(args) {
|
|
1717
|
-
super(
|
|
1718
|
-
args.cause instanceof Error ? args.cause.message : String(args.cause),
|
|
1719
|
-
{
|
|
1720
|
-
cause: args.cause
|
|
1721
|
-
}
|
|
1722
|
-
);
|
|
1723
|
-
this.name = "ConversationTurnBoundaryError";
|
|
1724
|
-
this.eventId = args.eventId;
|
|
1725
|
-
this.failureCode = args.failureCode;
|
|
1726
|
-
}
|
|
1727
|
-
};
|
|
1728
|
-
function getConversationTurnBoundaryError(error) {
|
|
1729
|
-
return error instanceof ConversationTurnBoundaryError ? error : void 0;
|
|
1730
|
-
}
|
|
1731
|
-
var CooperativeTurnYieldError = class extends Error {
|
|
1732
|
-
code = "cooperative_turn_yield";
|
|
1733
|
-
constructor(message = "Agent turn yielded at a safe boundary") {
|
|
1734
|
-
super(message);
|
|
1735
|
-
this.name = "CooperativeTurnYieldError";
|
|
1736
|
-
}
|
|
1737
|
-
};
|
|
1738
|
-
function isCooperativeTurnYieldError(error) {
|
|
1739
|
-
return error instanceof CooperativeTurnYieldError;
|
|
1740
|
-
}
|
|
1741
|
-
var TurnInputCommitLostError = class extends Error {
|
|
1742
|
-
code = "turn_input_commit_lost";
|
|
1743
|
-
constructor(message = "Turn input commit lost its durable owner") {
|
|
1744
|
-
super(message);
|
|
1745
|
-
this.name = "TurnInputCommitLostError";
|
|
1746
|
-
}
|
|
1747
|
-
};
|
|
1748
|
-
function isTurnInputCommitLostError(error) {
|
|
1749
|
-
return error instanceof TurnInputCommitLostError;
|
|
1750
|
-
}
|
|
1751
|
-
var TurnInputDeferredError = class extends Error {
|
|
1752
|
-
code = "turn_input_deferred";
|
|
1753
|
-
constructor(message = "Turn input is deferred until the active resume ends") {
|
|
1754
|
-
super(message);
|
|
1755
|
-
this.name = "TurnInputDeferredError";
|
|
1756
|
-
}
|
|
1757
|
-
};
|
|
1758
|
-
function isTurnInputDeferredError(error) {
|
|
1759
|
-
return error instanceof TurnInputDeferredError;
|
|
1760
|
-
}
|
|
1761
|
-
function startActiveTurn(args) {
|
|
1762
|
-
args.conversation.processing.activeTurnId = args.nextTurnId;
|
|
1763
|
-
}
|
|
1764
|
-
function clearActiveTurn(conversation, sessionId) {
|
|
1765
|
-
if (!sessionId || conversation.processing.activeTurnId === sessionId) {
|
|
1766
|
-
conversation.processing.activeTurnId = void 0;
|
|
1767
|
-
}
|
|
1768
|
-
}
|
|
1769
|
-
function markTurnClosed(args) {
|
|
1770
|
-
clearActiveTurn(args.conversation, args.sessionId);
|
|
1771
|
-
args.conversation.processing.lastCompletedAtMs = args.nowMs;
|
|
1772
|
-
}
|
|
1773
|
-
function markTurnCompleted(args) {
|
|
1774
|
-
clearActiveTurn(args.conversation, args.sessionId);
|
|
1775
|
-
args.conversation.processing.lastCompletedAtMs = args.nowMs;
|
|
1776
|
-
}
|
|
1777
|
-
function markTurnFailed(args) {
|
|
1778
|
-
clearActiveTurn(args.conversation, args.sessionId);
|
|
1779
|
-
args.conversation.processing.lastCompletedAtMs = args.nowMs;
|
|
1780
|
-
args.markConversationMessage(args.conversation, args.userMessageId, {
|
|
1781
|
-
replied: false,
|
|
1782
|
-
skippedReason: "reply failed"
|
|
1783
|
-
});
|
|
1784
|
-
}
|
|
1785
|
-
|
|
1786
|
-
// src/chat/no-reply.ts
|
|
1787
|
-
var NO_REPLY_MARKER = "[[NO_REPLY]]";
|
|
1788
|
-
function isNoReplyMarker(text) {
|
|
1789
|
-
return text.trim() === NO_REPLY_MARKER;
|
|
1790
|
-
}
|
|
1791
|
-
function containsNoReplyMarker(text) {
|
|
1792
|
-
return text.includes(NO_REPLY_MARKER);
|
|
1793
|
-
}
|
|
1794
|
-
|
|
1795
|
-
// src/chat/services/assistant-reply.ts
|
|
1796
|
-
var THINKING_XML_BLOCK_PATTERN = /[ \t]*<thinking\b[^>]*>[\s\S]*?<\/thinking>[ \t]*(?:\r?\n)?/gi;
|
|
1797
|
-
var FENCED_CODE_BLOCK_PATTERN = /```[\s\S]*?```/g;
|
|
1798
|
-
function sanitizeAssistantText(text) {
|
|
1799
|
-
let result = "";
|
|
1800
|
-
let cursor = 0;
|
|
1801
|
-
for (const match of text.matchAll(FENCED_CODE_BLOCK_PATTERN)) {
|
|
1802
|
-
const start = match.index;
|
|
1803
|
-
if (start === void 0) continue;
|
|
1804
|
-
result += text.slice(cursor, start).replace(THINKING_XML_BLOCK_PATTERN, "");
|
|
1805
|
-
result += match[0];
|
|
1806
|
-
cursor = start + match[0].length;
|
|
1807
|
-
}
|
|
1808
|
-
return (result + text.slice(cursor).replace(THINKING_XML_BLOCK_PATTERN, "")).trim();
|
|
1809
|
-
}
|
|
1810
|
-
function decideReply(message) {
|
|
1811
|
-
if (message.content.some((part) => part.type === "toolCall")) {
|
|
1812
|
-
return { kind: "suppress" };
|
|
1813
|
-
}
|
|
1814
|
-
const text = sanitizeAssistantText(extractAssistantText(message));
|
|
1815
|
-
if (!text) return { kind: "empty" };
|
|
1816
|
-
if (isNoReplyMarker(text) || containsNoReplyMarker(text)) {
|
|
1817
|
-
return { kind: "suppress" };
|
|
1818
|
-
}
|
|
1819
|
-
return { kind: "deliver", text };
|
|
1820
|
-
}
|
|
1821
|
-
function getAssistantReplyText(message) {
|
|
1822
|
-
const decision = decideReply(message);
|
|
1823
|
-
return decision.kind === "deliver" ? decision.text : void 0;
|
|
1824
|
-
}
|
|
1825
|
-
|
|
1826
1722
|
// src/chat/services/persist-retry.ts
|
|
1827
1723
|
var PERSIST_ATTEMPTS = 3;
|
|
1828
1724
|
async function persistWithRetry(persist) {
|
|
@@ -2243,7 +2139,7 @@ function findVisibleAgentsInstructions(messages) {
|
|
|
2243
2139
|
}
|
|
2244
2140
|
return {
|
|
2245
2141
|
active: true,
|
|
2246
|
-
...match[1] ? { directory: match[1] } :
|
|
2142
|
+
...match[1] ? { directory: match[1] } : void 0,
|
|
2247
2143
|
text
|
|
2248
2144
|
};
|
|
2249
2145
|
}
|
|
@@ -2412,7 +2308,7 @@ async function recordConversationActivityMetadata(args) {
|
|
|
2412
2308
|
nowMs: args.nowMs,
|
|
2413
2309
|
actor: sessionLogActor(args.actor),
|
|
2414
2310
|
...definedProps({ source: activitySource }),
|
|
2415
|
-
...args.source ? { sessionSource: args.source } :
|
|
2311
|
+
...args.source ? { sessionSource: args.source } : void 0,
|
|
2416
2312
|
visibility: isChild ? void 0 : args.destinationVisibility
|
|
2417
2313
|
});
|
|
2418
2314
|
await conversationStore.recordExecution({
|
|
@@ -2424,7 +2320,7 @@ async function recordConversationActivityMetadata(args) {
|
|
|
2424
2320
|
lastActivityAtMs: args.summary.updatedAtMs,
|
|
2425
2321
|
metrics: {
|
|
2426
2322
|
durationMs: args.summary.cumulativeDurationMs,
|
|
2427
|
-
...args.summary.cumulativeUsage ? { usage: args.summary.cumulativeUsage } :
|
|
2323
|
+
...args.summary.cumulativeUsage ? { usage: args.summary.cumulativeUsage } : void 0
|
|
2428
2324
|
},
|
|
2429
2325
|
actor: sessionLogActor(args.actor),
|
|
2430
2326
|
...definedProps({ source: activitySource }),
|
|
@@ -2524,7 +2420,9 @@ async function materializeStoredTurnRecord(conversationId, turnId, followCurrent
|
|
|
2524
2420
|
const currentHistory = await getConversationEventStore().loadCurrentHistory(conversationId);
|
|
2525
2421
|
const currentHistoryVersion = currentHistory.at(-1)?.historyVersion ?? parsed.historyVersion ?? 0;
|
|
2526
2422
|
const followsReplacement = followCurrentReplacement && (parsed.state === "running" || parsed.state === "paused") && parsed.historyVersion !== void 0 && parsed.historyVersion !== currentHistoryVersion;
|
|
2527
|
-
const piProjection = followsReplacement ? projectConversationEvents(currentHistory
|
|
2423
|
+
const piProjection = followsReplacement ? projectConversationEvents(currentHistory, {
|
|
2424
|
+
defaultProfile: botConfig.defaultProfile
|
|
2425
|
+
}) : pinnedProjection;
|
|
2528
2426
|
const turnStartMessageIndex = followsReplacement ? 0 : parsed.turnStartSeq === void 0 ? void 0 : piProjection.seqs.filter((seq) => seq <= parsed.turnStartSeq).length;
|
|
2529
2427
|
const conversation = await getConversationStore().get({ conversationId });
|
|
2530
2428
|
const executionMetrics = executionMetricsForTurn(conversation, turnId);
|
|
@@ -2690,14 +2588,14 @@ async function upsertTurnRecordLocked(args, fence) {
|
|
|
2690
2588
|
const commit = await commitMessages({
|
|
2691
2589
|
conversationId: args.conversationId,
|
|
2692
2590
|
messages: args.piMessages,
|
|
2693
|
-
...instructionActor ? { newMessageProvenance: instructionProvenanceFor(instructionActor) } :
|
|
2694
|
-
...args.trailingMessageProvenance ? { trailingMessageProvenance: args.trailingMessageProvenance } :
|
|
2591
|
+
...instructionActor ? { newMessageProvenance: instructionProvenanceFor(instructionActor) } : void 0,
|
|
2592
|
+
...args.trailingMessageProvenance ? { trailingMessageProvenance: args.trailingMessageProvenance } : void 0,
|
|
2695
2593
|
...args.turnContexts && args.turnContexts.length > 0 ? {
|
|
2696
2594
|
turnContext: {
|
|
2697
2595
|
contexts: args.turnContexts,
|
|
2698
2596
|
turnId: args.turnId
|
|
2699
2597
|
}
|
|
2700
|
-
} :
|
|
2598
|
+
} : void 0
|
|
2701
2599
|
});
|
|
2702
2600
|
const durableTurnStartMessageIndex = args.turnStartMessageIndex === void 0 ? void 0 : stripRuntimeTurnContext(
|
|
2703
2601
|
args.piMessages.slice(0, args.turnStartMessageIndex)
|
|
@@ -2976,14 +2874,14 @@ function addAgentTurnUsage(...usages) {
|
|
|
2976
2874
|
if (totalOnlyTokens !== void 0) {
|
|
2977
2875
|
return {
|
|
2978
2876
|
totalTokens: totalOnlyTokens + (componentTotal ?? 0),
|
|
2979
|
-
...reasoningTokens !== void 0 ? { reasoningTokens } :
|
|
2980
|
-
...Object.keys(cost).length > 0 ? { cost } :
|
|
2877
|
+
...reasoningTokens !== void 0 ? { reasoningTokens } : void 0,
|
|
2878
|
+
...Object.keys(cost).length > 0 ? { cost } : void 0
|
|
2981
2879
|
};
|
|
2982
2880
|
}
|
|
2983
2881
|
const result = {
|
|
2984
2882
|
...components,
|
|
2985
|
-
...reasoningTokens !== void 0 ? { reasoningTokens } :
|
|
2986
|
-
...Object.keys(cost).length > 0 ? { cost } :
|
|
2883
|
+
...reasoningTokens !== void 0 ? { reasoningTokens } : void 0,
|
|
2884
|
+
...Object.keys(cost).length > 0 ? { cost } : void 0
|
|
2987
2885
|
};
|
|
2988
2886
|
return hasAgentTurnUsage(result) ? result : void 0;
|
|
2989
2887
|
}
|
|
@@ -3176,69 +3074,6 @@ async function saveDone(args) {
|
|
|
3176
3074
|
});
|
|
3177
3075
|
}
|
|
3178
3076
|
|
|
3179
|
-
// src/chat/services/pending-auth.ts
|
|
3180
|
-
var AUTH_LINK_REUSE_WINDOW_MS = 10 * 60 * 1e3;
|
|
3181
|
-
var NON_REQUEST_SKIPPED_REASON_PREFIXES = [
|
|
3182
|
-
"directed_to_other_party:",
|
|
3183
|
-
"side_conversation:"
|
|
3184
|
-
];
|
|
3185
|
-
function isSkippedNonRequest(reason) {
|
|
3186
|
-
return NON_REQUEST_SKIPPED_REASON_PREFIXES.some(
|
|
3187
|
-
(prefix) => reason?.startsWith(prefix)
|
|
3188
|
-
);
|
|
3189
|
-
}
|
|
3190
|
-
function canReusePendingAuthLink(args) {
|
|
3191
|
-
const { pendingAuth } = args;
|
|
3192
|
-
if (!pendingAuth) {
|
|
3193
|
-
return false;
|
|
3194
|
-
}
|
|
3195
|
-
return pendingAuth.kind === args.kind && pendingAuth.provider === args.provider && pendingAuth.actorId === args.actorId && pendingAuth.scope === args.scope && pendingAuth.sessionId === args.sessionId && pendingAuth.linkSentAtMs + AUTH_LINK_REUSE_WINDOW_MS > (args.nowMs ?? Date.now());
|
|
3196
|
-
}
|
|
3197
|
-
function getConversationPendingAuth(args) {
|
|
3198
|
-
const pendingAuth = args.conversation.processing.pendingAuth;
|
|
3199
|
-
if (!pendingAuth) {
|
|
3200
|
-
return void 0;
|
|
3201
|
-
}
|
|
3202
|
-
if (pendingAuth.kind !== args.kind || pendingAuth.provider !== args.provider || pendingAuth.actorId !== args.actorId || pendingAuth.scope !== args.scope) {
|
|
3203
|
-
return void 0;
|
|
3204
|
-
}
|
|
3205
|
-
return pendingAuth;
|
|
3206
|
-
}
|
|
3207
|
-
function clearPendingAuth(conversation, sessionId) {
|
|
3208
|
-
if (!conversation.processing.pendingAuth) {
|
|
3209
|
-
return;
|
|
3210
|
-
}
|
|
3211
|
-
if (sessionId && conversation.processing.pendingAuth.sessionId !== sessionId) {
|
|
3212
|
-
return;
|
|
3213
|
-
}
|
|
3214
|
-
conversation.processing.pendingAuth = void 0;
|
|
3215
|
-
}
|
|
3216
|
-
async function abandonReplacedPendingAuth(args) {
|
|
3217
|
-
if (args.previousPendingAuth && args.previousPendingAuth.sessionId !== args.nextPendingAuth.sessionId && args.conversationId) {
|
|
3218
|
-
await abandonTurnRecord({
|
|
3219
|
-
conversationId: args.conversationId,
|
|
3220
|
-
turnId: args.previousPendingAuth.sessionId,
|
|
3221
|
-
errorMessage: "Abandoned by a newer auth-blocked request in the same conversation."
|
|
3222
|
-
});
|
|
3223
|
-
}
|
|
3224
|
-
}
|
|
3225
|
-
function isPendingAuthLatestRequest(conversation, pendingAuth) {
|
|
3226
|
-
for (let index = conversation.messages.length - 1; index >= 0; index -= 1) {
|
|
3227
|
-
const message = conversation.messages[index];
|
|
3228
|
-
if (message?.role !== "user") {
|
|
3229
|
-
continue;
|
|
3230
|
-
}
|
|
3231
|
-
if (message.author?.isBot) {
|
|
3232
|
-
continue;
|
|
3233
|
-
}
|
|
3234
|
-
if (isSkippedNonRequest(message.meta?.skippedReason)) {
|
|
3235
|
-
continue;
|
|
3236
|
-
}
|
|
3237
|
-
return buildDeterministicTurnId(message.id) === pendingAuth.sessionId;
|
|
3238
|
-
}
|
|
3239
|
-
return false;
|
|
3240
|
-
}
|
|
3241
|
-
|
|
3242
3077
|
export {
|
|
3243
3078
|
renderJuniorNativeConversationEvent,
|
|
3244
3079
|
TURN_CONTEXT_TAG,
|
|
@@ -3316,26 +3151,6 @@ export {
|
|
|
3316
3151
|
renderAgentsInstructions,
|
|
3317
3152
|
buildAgentsInstructionsMessage,
|
|
3318
3153
|
findVisibleAgentsInstructions,
|
|
3319
|
-
buildDeterministicTurnId,
|
|
3320
|
-
buildDeterministicAssistantMessageId,
|
|
3321
|
-
ConversationTurnBoundaryError,
|
|
3322
|
-
getConversationTurnBoundaryError,
|
|
3323
|
-
CooperativeTurnYieldError,
|
|
3324
|
-
isCooperativeTurnYieldError,
|
|
3325
|
-
TurnInputCommitLostError,
|
|
3326
|
-
isTurnInputCommitLostError,
|
|
3327
|
-
TurnInputDeferredError,
|
|
3328
|
-
isTurnInputDeferredError,
|
|
3329
|
-
startActiveTurn,
|
|
3330
|
-
markTurnClosed,
|
|
3331
|
-
markTurnCompleted,
|
|
3332
|
-
markTurnFailed,
|
|
3333
|
-
NO_REPLY_MARKER,
|
|
3334
|
-
isNoReplyMarker,
|
|
3335
|
-
containsNoReplyMarker,
|
|
3336
|
-
sanitizeAssistantText,
|
|
3337
|
-
decideReply,
|
|
3338
|
-
getAssistantReplyText,
|
|
3339
3154
|
agentTurnUsageSchema,
|
|
3340
3155
|
hasAgentTurnUsage,
|
|
3341
3156
|
addAgentTurnUsage,
|
|
@@ -3351,10 +3166,5 @@ export {
|
|
|
3351
3166
|
failTurnRecord,
|
|
3352
3167
|
continuableMessages,
|
|
3353
3168
|
loadTurnCheckpoint,
|
|
3354
|
-
saveTurnCheckpoint
|
|
3355
|
-
canReusePendingAuthLink,
|
|
3356
|
-
getConversationPendingAuth,
|
|
3357
|
-
clearPendingAuth,
|
|
3358
|
-
abandonReplacedPendingAuth,
|
|
3359
|
-
isPendingAuthLatestRequest
|
|
3169
|
+
saveTurnCheckpoint
|
|
3360
3170
|
};
|