@sentry/junior 0.114.0 → 0.116.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-WNBUY4OB.js → agent-hooks-67NFITDH.js} +13 -12
- package/dist/api/conversations/detail.d.ts +20 -0
- package/dist/api/conversations/event-list.d.ts +2 -0
- package/dist/api/conversations/event-page.d.ts +1 -1
- package/dist/api/conversations/events.d.ts +1 -1
- package/dist/api/health.d.ts +7 -0
- package/dist/api/people/profile.d.ts +2 -2
- package/dist/api/people/shared.d.ts +1 -1
- package/dist/api/personal-tokens/create.d.ts +11 -0
- package/dist/api/personal-tokens/list.d.ts +12 -0
- package/dist/api/personal-tokens/revoke.d.ts +5 -0
- package/dist/api/personal-tokens/routes.d.ts +4 -0
- package/dist/api/plugin-reports.d.ts +62 -0
- package/dist/api/plugins.d.ts +8 -0
- package/dist/api/route.d.ts +1 -1
- package/dist/api/runtime.d.ts +24 -0
- package/dist/api/schema/conversation.d.ts +26 -0
- package/dist/api/schema/person.d.ts +3 -3
- package/dist/api/schema/personal-token.d.ts +38 -0
- package/dist/api/schema.d.ts +4 -2
- package/dist/api/schema.js +19 -7
- package/dist/api/skills.d.ts +6 -0
- package/dist/api.d.ts +1 -0
- package/dist/api.js +285 -121
- package/dist/app.js +1957 -5677
- package/dist/catalog-runtime-CWZY6GTH.js +18 -0
- package/dist/chat/agent/request.d.ts +7 -0
- package/dist/chat/agent/resume.d.ts +1 -0
- package/dist/chat/agent/sandbox.d.ts +3 -0
- package/dist/chat/agent/tools.d.ts +3 -0
- package/dist/chat/agent-dispatch/context.d.ts +2 -0
- package/dist/chat/agent-dispatch/heartbeat.d.ts +11 -5
- package/dist/chat/agent-dispatch/signing.d.ts +14 -5
- package/dist/chat/agent-dispatch/store.d.ts +36 -15
- package/dist/chat/agent-dispatch/types.d.ts +23 -10
- package/dist/chat/agent-dispatch/work.d.ts +58 -0
- package/dist/chat/app/factory.d.ts +12 -3
- package/dist/chat/config.d.ts +2 -0
- package/dist/chat/conversations/history.d.ts +291 -290
- package/dist/chat/conversations/projection.d.ts +2 -2
- package/dist/chat/local/credential-sync.d.ts +5 -0
- package/dist/chat/local/oauth-relay.d.ts +4 -0
- package/dist/chat/mcp/oauth.d.ts +1 -0
- package/dist/chat/mcp/tool-manager.d.ts +2 -1
- package/dist/chat/oauth-authorization.d.ts +17 -0
- package/dist/chat/oauth-flow.d.ts +9 -0
- package/dist/chat/pi/conversation-events.d.ts +6 -2
- package/dist/chat/plugins/annotations.d.ts +8 -0
- package/dist/chat/plugins/registry.d.ts +0 -3
- package/dist/chat/plugins/types.d.ts +0 -2
- package/dist/chat/runtime/agent-continue-runner.d.ts +4 -0
- package/dist/chat/runtime/reply-executor.d.ts +6 -1
- package/dist/chat/runtime/slack-resume.d.ts +5 -1
- package/dist/chat/runtime/turn-input.d.ts +3 -0
- package/dist/chat/sandbox/egress/schemas.d.ts +46 -0
- package/dist/chat/sandbox/egress/signals.d.ts +9 -0
- package/dist/chat/sandbox/sandbox.d.ts +4 -1
- package/dist/chat/sandbox/session.d.ts +2 -11
- package/dist/chat/sandbox/workspace.d.ts +10 -2
- package/dist/chat/sentry-payload-filter.d.ts +4 -4
- package/dist/chat/services/mcp-auth-orchestration.d.ts +5 -3
- package/dist/chat/services/plugin-auth-orchestration.d.ts +2 -0
- package/dist/chat/services/turn-session-record.d.ts +14 -1
- package/dist/chat/slack/dispatch-turn.d.ts +25 -0
- package/dist/chat/slack/message-control.d.ts +2 -0
- package/dist/chat/slack/oauth-authorization-message.d.ts +3 -0
- package/dist/chat/state/turn-session.d.ts +11 -0
- package/dist/chat/task-execution/slack-work.d.ts +2 -0
- package/dist/chat/tool-support/text-range-result.d.ts +3 -0
- package/dist/chat/tool-support/zod-tool.d.ts +2 -1
- package/dist/chat/tools/definition.d.ts +3 -5
- package/dist/chat/tools/query-conversation-events.d.ts +68 -0
- package/dist/chat/tools/sandbox/file-utils.d.ts +8 -1
- package/dist/chat/tools/sandbox/find-files.d.ts +2 -1
- package/dist/chat/tools/sandbox/grep.d.ts +2 -1
- package/dist/{chunk-OSKEC4XU.js → chunk-25GU5B5E.js} +1 -1
- package/dist/{chunk-XLFBQJUO.js → chunk-3H45VOBZ.js} +32 -7
- package/dist/{chunk-4FUEG3QY.js → chunk-3JOGUT46.js} +4 -16
- package/dist/chunk-4CODA7P5.js +43 -0
- package/dist/{chunk-O4GT7LYB.js → chunk-4DD6AOCG.js} +3 -43
- package/dist/{chunk-YU6PO42Q.js → chunk-53ZKTQO6.js} +1 -1
- package/dist/{chunk-WV4UJBAS.js → chunk-5UNB623T.js} +1282 -2536
- package/dist/{chunk-TLGM5X2M.js → chunk-6RQ5GCWH.js} +2 -2
- package/dist/{chunk-MIAKQNYX.js → chunk-6ZK6FZIV.js} +1 -1
- package/dist/{chunk-W6RDUAO3.js → chunk-BXLS3I4W.js} +1 -1
- package/dist/{chunk-RD7EJI7H.js → chunk-CI3VK7X5.js} +69 -3
- package/dist/chunk-DIB4GX3G.js +8 -0
- package/dist/{chunk-42WRQLJ6.js → chunk-F3B2YJ76.js} +0 -14
- package/dist/chunk-FA6POGLH.js +70 -0
- package/dist/{chunk-6Y5L4BOM.js → chunk-FXOYURO4.js} +5 -3
- package/dist/chunk-HDSDCEPK.js +80 -0
- package/dist/{chunk-C4MZ3GP5.js → chunk-HZF5P5UN.js} +1 -1
- package/dist/{chunk-K2W4CK7K.js → chunk-JZPQ5K4V.js} +10 -129
- package/dist/{chunk-FIGAF6KL.js → chunk-KBNDFU6J.js} +108 -38
- package/dist/{chunk-PM3PX42K.js → chunk-MGH5ADQS.js} +1 -2
- package/dist/{chunk-5CZ7RETL.js → chunk-N7TMYLF2.js} +1 -1
- package/dist/chunk-OB42YVAE.js +16 -0
- package/dist/{chunk-6QWPVTMO.js → chunk-OF5FODBL.js} +125 -23
- package/dist/{chunk-2ZTTXTSZ.js → chunk-PE44LDDQ.js} +9 -4
- package/dist/chunk-PGKWXHYJ.js +1870 -0
- package/dist/{chunk-ZGXH3REA.js → chunk-PZGPCOSD.js} +12 -2
- package/dist/{chunk-JQFJO5WH.js → chunk-RXRQJF7Y.js} +74 -17
- package/dist/{chunk-S4QDH23A.js → chunk-TC4ZEM2D.js} +113 -79
- package/dist/{chunk-ABPSDO6M.js → chunk-UEVLIYK5.js} +234 -165
- package/dist/chunk-VKZ6WVAY.js +4318 -0
- package/dist/{chunk-VNNBSKCO.js → chunk-VZCSLYCE.js} +22 -7
- package/dist/chunk-W3U3YQYI.js +71 -0
- package/dist/{chunk-SG5WAA7H.js → chunk-WKU7TY22.js} +0 -3
- package/dist/cli/chat.js +74 -42
- package/dist/cli/check.js +10 -8
- package/dist/cli/init.js +1 -0
- package/dist/cli/plugins.js +18 -16
- package/dist/cli/snapshot-warmup.js +13 -11
- package/dist/cli/upgrade.js +12 -10
- package/dist/db/schema/api-tokens.d.ts +160 -0
- package/dist/db/schema/conversation-annotations.d.ts +142 -0
- package/dist/db/schema.d.ts +305 -1
- package/dist/{db-4VLP7KBF.js → db-57FHVGGQ.js} +9 -8
- package/dist/handlers/agent-dispatch.d.ts +7 -3
- package/dist/handlers/sandbox-egress-signals.d.ts +4 -0
- package/dist/instrumentation.js +72 -4
- package/dist/nitro.js +5 -5
- package/dist/oauth-callback-server-PAQRPXZX.js +231 -0
- package/dist/oauth-relay-3ZU72UGL.js +9 -0
- package/dist/personal-tokens/store.d.ts +27 -0
- package/dist/{plugins-PZMDS7AT.js → plugins-IUJA4VBU.js} +1 -1
- package/dist/reporting-schema.d.ts +10 -4
- package/dist/reporting.d.ts +5 -5
- package/dist/{runner-IPXLWQOF.js → runner-4ISZYJEX.js} +141 -74
- package/dist/sandbox-egress-signals-CDFAP67O.js +75 -0
- package/dist/{skills-QCNZISNF.js → skills-UE2KXQMB.js} +10 -8
- package/dist/validation-PO5LHTJT.js +21 -0
- package/dist/version.js +1 -1
- package/migrations/0008_sticky_rage.sql +14 -0
- package/migrations/0009_slippery_harrier.sql +12 -0
- package/migrations/0010_native_conversation_history.sql +142 -0
- package/migrations/meta/0008_snapshot.json +1076 -0
- package/migrations/meta/0009_snapshot.json +1146 -0
- package/migrations/meta/0010_snapshot.json +1190 -0
- package/migrations/meta/_journal.json +22 -1
- package/package.json +6 -7
- package/dist/catalog-runtime-6O4M6JGA.js +0 -16
- package/dist/chat/agent-dispatch/runner.d.ts +0 -13
- package/dist/chat/capabilities/catalog.d.ts +0 -16
- package/dist/chat/oauth-authorization-message.d.ts +0 -6
- package/dist/validation-I2BW3UHD.js +0 -19
- package/dist/{chunk-KNFROR7R.js → chunk-5I6ORJUY.js} +1 -1
|
@@ -4,22 +4,22 @@ import {
|
|
|
4
4
|
juniorConversations,
|
|
5
5
|
juniorIdentities,
|
|
6
6
|
juniorUsers
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-RXRQJF7Y.js";
|
|
8
8
|
import {
|
|
9
9
|
TURN_REASONING_LEVELS,
|
|
10
10
|
getChatConfig,
|
|
11
11
|
modelProfileSchema
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-PZGPCOSD.js";
|
|
13
13
|
import {
|
|
14
14
|
juniorDestinations
|
|
15
15
|
} from "./chunk-VFUK3X5B.js";
|
|
16
16
|
import {
|
|
17
17
|
normalizeIdentityEmail
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-3JOGUT46.js";
|
|
19
19
|
import {
|
|
20
20
|
parseSlackChannelReferenceId,
|
|
21
21
|
parseSlackTeamId
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-F3B2YJ76.js";
|
|
23
23
|
|
|
24
24
|
// src/chat/conversations/sql/store.ts
|
|
25
25
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
@@ -59,12 +59,6 @@ function sameDestination(left, right) {
|
|
|
59
59
|
}
|
|
60
60
|
return false;
|
|
61
61
|
}
|
|
62
|
-
function destinationKey(destination) {
|
|
63
|
-
if (destination.platform === "local") {
|
|
64
|
-
return destination.conversationId;
|
|
65
|
-
}
|
|
66
|
-
return `slack:${destination.teamId}:${destination.channelId}`;
|
|
67
|
-
}
|
|
68
62
|
|
|
69
63
|
// src/chat/identities/sql.ts
|
|
70
64
|
import { randomUUID } from "crypto";
|
|
@@ -741,9 +735,11 @@ import {
|
|
|
741
735
|
asc as asc2,
|
|
742
736
|
desc as desc2,
|
|
743
737
|
eq as eq3,
|
|
738
|
+
gt,
|
|
744
739
|
gte,
|
|
745
740
|
inArray,
|
|
746
741
|
isNotNull,
|
|
742
|
+
lt,
|
|
747
743
|
lte,
|
|
748
744
|
sql as sql4
|
|
749
745
|
} from "drizzle-orm";
|
|
@@ -796,20 +792,31 @@ var handoffModelProfileSchema = modelProfileSchema.refine(
|
|
|
796
792
|
(profile) => profile !== "standard",
|
|
797
793
|
"handoff profile must not be standard"
|
|
798
794
|
);
|
|
799
|
-
var
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
provenance: conversationMessageProvenanceSchema
|
|
803
|
-
}).
|
|
804
|
-
var
|
|
805
|
-
type: z2.literal("
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
795
|
+
var userMessageEventDataSchema = z2.object({
|
|
796
|
+
type: z2.literal("user_message"),
|
|
797
|
+
role: z2.never().optional(),
|
|
798
|
+
provenance: conversationMessageProvenanceSchema
|
|
799
|
+
}).passthrough();
|
|
800
|
+
var assistantMessageEventDataSchema = z2.object({
|
|
801
|
+
type: z2.literal("assistant_message"),
|
|
802
|
+
role: z2.never().optional()
|
|
803
|
+
}).passthrough();
|
|
804
|
+
var toolResultEventDataSchema = z2.object({
|
|
805
|
+
type: z2.literal("tool_result"),
|
|
806
|
+
role: z2.never().optional()
|
|
807
|
+
}).passthrough();
|
|
808
|
+
var agentHistoryItemSchema = z2.discriminatedUnion("type", [
|
|
809
|
+
userMessageEventDataSchema,
|
|
810
|
+
assistantMessageEventDataSchema,
|
|
811
|
+
toolResultEventDataSchema
|
|
812
|
+
]);
|
|
813
|
+
var nativeReplacementHistoryItemSchema = z2.object({
|
|
814
|
+
item: agentHistoryItemSchema,
|
|
815
|
+
// Preserve the copied item's position when a turn resumes. Synthetic
|
|
816
|
+
// summary and handoff items have no source event.
|
|
810
817
|
sourceEventSeq: z2.number().int().nonnegative().optional()
|
|
811
|
-
});
|
|
812
|
-
var replacementHistorySchema = z2.array(
|
|
818
|
+
}).strict();
|
|
819
|
+
var replacementHistorySchema = z2.array(nativeReplacementHistoryItemSchema);
|
|
813
820
|
var compactionDetailsSchema = z2.object({
|
|
814
821
|
reason: z2.literal("capacity"),
|
|
815
822
|
estimatedInputTokens: z2.number().int().nonnegative(),
|
|
@@ -827,6 +834,7 @@ var historyReplacementEventDataSchema = z2.discriminatedUnion("type", [
|
|
|
827
834
|
modelId: z2.string().min(1),
|
|
828
835
|
reasoningLevel: z2.string().min(1).optional(),
|
|
829
836
|
triggeringToolCallId: z2.string().min(1).optional(),
|
|
837
|
+
summary: z2.string().min(1).optional(),
|
|
830
838
|
replacementHistory: replacementHistorySchema
|
|
831
839
|
}).strict(),
|
|
832
840
|
z2.object({
|
|
@@ -834,15 +842,10 @@ var historyReplacementEventDataSchema = z2.discriminatedUnion("type", [
|
|
|
834
842
|
modelProfile: modelProfileSchema,
|
|
835
843
|
modelId: z2.string().min(1),
|
|
836
844
|
details: compactionDetailsSchema.optional(),
|
|
845
|
+
summary: z2.string().min(1).optional(),
|
|
837
846
|
replacementHistory: replacementHistorySchema
|
|
838
847
|
}).strict()
|
|
839
848
|
]);
|
|
840
|
-
var legacyRollbackEventDataSchema = z2.object({
|
|
841
|
-
type: z2.literal("rollback"),
|
|
842
|
-
modelProfile: modelProfileSchema,
|
|
843
|
-
modelId: z2.string().min(1),
|
|
844
|
-
replacementHistory: replacementHistorySchema
|
|
845
|
-
}).strict();
|
|
846
849
|
var historyReplacementSchema = z2.object({
|
|
847
850
|
data: historyReplacementEventDataSchema,
|
|
848
851
|
createdAtMs: z2.number().finite()
|
|
@@ -973,7 +976,7 @@ var subagentEndedEventDataSchema = z2.object({
|
|
|
973
976
|
var appendableConversationEventDataSchema = z2.union([
|
|
974
977
|
messageEventDataSchema,
|
|
975
978
|
messageUpdatedEventDataSchema,
|
|
976
|
-
|
|
979
|
+
agentHistoryItemSchema,
|
|
977
980
|
mcpProviderConnectedEventDataSchema,
|
|
978
981
|
authorizationRequestedEventDataSchema,
|
|
979
982
|
authorizationCompletedEventDataSchema,
|
|
@@ -989,13 +992,14 @@ var appendableConversationEventDataSchema = z2.union([
|
|
|
989
992
|
]);
|
|
990
993
|
var conversationEventDataSchema = z2.union([
|
|
991
994
|
appendableConversationEventDataSchema,
|
|
992
|
-
historyReplacementEventDataSchema
|
|
993
|
-
legacyRollbackEventDataSchema
|
|
995
|
+
historyReplacementEventDataSchema
|
|
994
996
|
]);
|
|
995
|
-
var
|
|
997
|
+
var KNOWN_CONVERSATION_EVENT_TYPES = [
|
|
996
998
|
"message",
|
|
997
999
|
"message_updated",
|
|
998
|
-
"
|
|
1000
|
+
"user_message",
|
|
1001
|
+
"assistant_message",
|
|
1002
|
+
"tool_result",
|
|
999
1003
|
"mcp_provider_connected",
|
|
1000
1004
|
"authorization_requested",
|
|
1001
1005
|
"authorization_completed",
|
|
@@ -1009,9 +1013,9 @@ var knownConversationEventTypeSchema = z2.enum([
|
|
|
1009
1013
|
"subagent_started",
|
|
1010
1014
|
"subagent_ended",
|
|
1011
1015
|
"handoff",
|
|
1012
|
-
"compaction"
|
|
1013
|
-
|
|
1014
|
-
|
|
1016
|
+
"compaction"
|
|
1017
|
+
];
|
|
1018
|
+
var knownConversationEventTypeSchema = z2.enum(KNOWN_CONVERSATION_EVENT_TYPES);
|
|
1015
1019
|
var unknownConversationEventDataSchema = z2.object({
|
|
1016
1020
|
type: z2.literal("unknown"),
|
|
1017
1021
|
originalType: z2.string().min(1),
|
|
@@ -1268,6 +1272,16 @@ var SqlConversationEventStore = class {
|
|
|
1268
1272
|
).orderBy(asc2(juniorConversationEvents.seq));
|
|
1269
1273
|
return rows.map(eventFromRow);
|
|
1270
1274
|
}
|
|
1275
|
+
async loadLatestInstruction(conversationId) {
|
|
1276
|
+
const [row] = await this.executor.db().select().from(juniorConversationEvents).where(
|
|
1277
|
+
and3(
|
|
1278
|
+
eq3(juniorConversationEvents.conversationId, conversationId),
|
|
1279
|
+
eq3(juniorConversationEvents.type, "user_message"),
|
|
1280
|
+
sql4`${juniorConversationEvents.payload}->'provenance'->>'authority' = 'instruction'`
|
|
1281
|
+
)
|
|
1282
|
+
).orderBy(desc2(juniorConversationEvents.seq)).limit(1);
|
|
1283
|
+
return row ? eventFromRow(row) : void 0;
|
|
1284
|
+
}
|
|
1271
1285
|
async loadMessageHistory(conversationId) {
|
|
1272
1286
|
const [compactionRow] = await this.executor.db().select().from(juniorConversationEvents).where(
|
|
1273
1287
|
and3(
|
|
@@ -1290,6 +1304,61 @@ var SqlConversationEventStore = class {
|
|
|
1290
1304
|
const rows = await this.executor.db().select().from(juniorConversationEvents).where(eq3(juniorConversationEvents.conversationId, conversationId)).orderBy(asc2(juniorConversationEvents.seq));
|
|
1291
1305
|
return rows.map(eventFromRow);
|
|
1292
1306
|
}
|
|
1307
|
+
async query(conversationId, query) {
|
|
1308
|
+
if (query.limit < 1) {
|
|
1309
|
+
throw new Error("Conversation event query limit must be at least 1");
|
|
1310
|
+
}
|
|
1311
|
+
if (query.afterSeq !== void 0 && query.beforeSeq !== void 0 && query.afterSeq >= query.beforeSeq) {
|
|
1312
|
+
return { events: [], hasOlder: false, hasNewer: false };
|
|
1313
|
+
}
|
|
1314
|
+
const typeFilter = query.types && query.types.length > 0 ? inArray(juniorConversationEvents.type, [...query.types]) : void 0;
|
|
1315
|
+
const bounds = and3(
|
|
1316
|
+
eq3(juniorConversationEvents.conversationId, conversationId),
|
|
1317
|
+
query.afterSeq === void 0 ? void 0 : gt(juniorConversationEvents.seq, query.afterSeq),
|
|
1318
|
+
query.beforeSeq === void 0 ? void 0 : lt(juniorConversationEvents.seq, query.beforeSeq),
|
|
1319
|
+
typeFilter
|
|
1320
|
+
);
|
|
1321
|
+
const newestFirst = query.afterSeq === void 0;
|
|
1322
|
+
const rows = await this.executor.db().select().from(juniorConversationEvents).where(bounds).orderBy(
|
|
1323
|
+
newestFirst ? desc2(juniorConversationEvents.seq) : asc2(juniorConversationEvents.seq)
|
|
1324
|
+
).limit(query.limit + 1);
|
|
1325
|
+
const overflow = rows.length > query.limit;
|
|
1326
|
+
const pageRows = overflow ? rows.slice(0, query.limit) : rows;
|
|
1327
|
+
const events = (newestFirst ? [...pageRows].reverse() : pageRows).map(
|
|
1328
|
+
eventFromRow
|
|
1329
|
+
);
|
|
1330
|
+
if (events.length === 0) {
|
|
1331
|
+
return { events, hasOlder: false, hasNewer: false };
|
|
1332
|
+
}
|
|
1333
|
+
const firstSeq = events[0].seq;
|
|
1334
|
+
const lastSeq = events[events.length - 1].seq;
|
|
1335
|
+
const hasOlder = newestFirst && overflow ? true : await this.hasMatchingEvent({
|
|
1336
|
+
conversationId,
|
|
1337
|
+
beforeSeq: firstSeq,
|
|
1338
|
+
typeFilter
|
|
1339
|
+
});
|
|
1340
|
+
const hasNewer = !newestFirst && overflow ? true : await this.hasMatchingEvent({
|
|
1341
|
+
conversationId,
|
|
1342
|
+
afterSeq: lastSeq,
|
|
1343
|
+
typeFilter
|
|
1344
|
+
});
|
|
1345
|
+
return { events, hasOlder, hasNewer };
|
|
1346
|
+
}
|
|
1347
|
+
/** Return whether any matching event exists inside the exclusive seq window. */
|
|
1348
|
+
async hasMatchingEvent(args) {
|
|
1349
|
+
if (args.afterSeq !== void 0 && args.beforeSeq !== void 0 && args.afterSeq >= args.beforeSeq) {
|
|
1350
|
+
return false;
|
|
1351
|
+
}
|
|
1352
|
+
const [row] = await this.executor.db().select({ seq: juniorConversationEvents.seq }).from(juniorConversationEvents).where(
|
|
1353
|
+
and3(
|
|
1354
|
+
eq3(juniorConversationEvents.conversationId, args.conversationId),
|
|
1355
|
+
args.afterSeq === void 0 ? void 0 : gt(juniorConversationEvents.seq, args.afterSeq),
|
|
1356
|
+
args.beforeSeq === void 0 ? void 0 : lt(juniorConversationEvents.seq, args.beforeSeq),
|
|
1357
|
+
args.typeFilter
|
|
1358
|
+
)
|
|
1359
|
+
).limit(1);
|
|
1360
|
+
return row !== void 0;
|
|
1361
|
+
}
|
|
1293
1362
|
/** Read the next sequence and active model-history version. */
|
|
1294
1363
|
async readCursor(conversationId) {
|
|
1295
1364
|
const rows = await this.executor.db().select({
|
|
@@ -1434,10 +1503,11 @@ export {
|
|
|
1434
1503
|
parseDestination,
|
|
1435
1504
|
requireSlackDestination,
|
|
1436
1505
|
sameDestination,
|
|
1437
|
-
destinationKey,
|
|
1438
1506
|
instructionProvenanceFor,
|
|
1439
1507
|
contextProvenance,
|
|
1440
1508
|
instructionActors,
|
|
1509
|
+
agentHistoryItemSchema,
|
|
1510
|
+
KNOWN_CONVERSATION_EVENT_TYPES,
|
|
1441
1511
|
decodeStoredConversationEvent,
|
|
1442
1512
|
sanitizePostgresJson,
|
|
1443
1513
|
withConversationEventLock,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// package.json
|
|
2
2
|
var package_default = {
|
|
3
3
|
name: "@sentry/junior",
|
|
4
|
-
version: "0.
|
|
4
|
+
version: "0.116.0",
|
|
5
5
|
private: false,
|
|
6
6
|
publishConfig: {
|
|
7
7
|
access: "public"
|
|
@@ -82,7 +82,6 @@ var package_default = {
|
|
|
82
82
|
"@vercel/queue": "^0.2.0",
|
|
83
83
|
"@vercel/sandbox": "2.8.0",
|
|
84
84
|
ai: "^6.0.190",
|
|
85
|
-
"bash-tool": "^1.3.16",
|
|
86
85
|
chat: "4.29.0",
|
|
87
86
|
commander: "^14.0.3",
|
|
88
87
|
"drizzle-orm": "catalog:",
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/chat/coerce.ts
|
|
2
|
+
function toOptionalString(value) {
|
|
3
|
+
return typeof value === "string" && value.trim() ? value : void 0;
|
|
4
|
+
}
|
|
5
|
+
function toOptionalNumber(value) {
|
|
6
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
7
|
+
}
|
|
8
|
+
function isRecord(value) {
|
|
9
|
+
return typeof value === "object" && value !== null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
toOptionalString,
|
|
14
|
+
toOptionalNumber,
|
|
15
|
+
isRecord
|
|
16
|
+
};
|
|
@@ -4,8 +4,9 @@ import {
|
|
|
4
4
|
} from "./chunk-MU6HHZEN.js";
|
|
5
5
|
import {
|
|
6
6
|
getStateAdapter
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-53ZKTQO6.js";
|
|
8
8
|
import {
|
|
9
|
+
agentHistoryItemSchema,
|
|
9
10
|
contextProvenance,
|
|
10
11
|
createSqlConversationEventStore,
|
|
11
12
|
getConversationEventStore,
|
|
@@ -15,7 +16,7 @@ import {
|
|
|
15
16
|
instructionProvenanceFor,
|
|
16
17
|
sanitizePostgresJson,
|
|
17
18
|
withConversationEventLock
|
|
18
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-KBNDFU6J.js";
|
|
19
20
|
import {
|
|
20
21
|
sleep
|
|
21
22
|
} from "./chunk-4ZNGQH7C.js";
|
|
@@ -24,22 +25,24 @@ import {
|
|
|
24
25
|
escapeXml,
|
|
25
26
|
resolveGatewayModel,
|
|
26
27
|
unwrapCurrentInstruction
|
|
27
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-PZGPCOSD.js";
|
|
28
29
|
import {
|
|
29
30
|
toStoredSlackActor
|
|
30
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-HZF5P5UN.js";
|
|
31
32
|
import {
|
|
32
33
|
getActiveTraceId,
|
|
33
34
|
logException,
|
|
34
35
|
logWarn,
|
|
35
36
|
setSpanAttributes
|
|
36
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-3JOGUT46.js";
|
|
37
38
|
import {
|
|
38
39
|
isRecord,
|
|
39
|
-
parseSlackMessageTs,
|
|
40
40
|
toOptionalNumber,
|
|
41
41
|
toOptionalString
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-OB42YVAE.js";
|
|
43
|
+
import {
|
|
44
|
+
parseSlackMessageTs
|
|
45
|
+
} from "./chunk-F3B2YJ76.js";
|
|
43
46
|
|
|
44
47
|
// src/chat/turn-context-tag.ts
|
|
45
48
|
var TURN_CONTEXT_TAG = "runtime-turn-context";
|
|
@@ -173,11 +176,47 @@ function authorizationObservationMessage(data, createdAtMs) {
|
|
|
173
176
|
timestamp: createdAtMs
|
|
174
177
|
});
|
|
175
178
|
}
|
|
176
|
-
function messageEventProvenance(data) {
|
|
177
|
-
return data.provenance ?? contextProvenance;
|
|
178
|
-
}
|
|
179
179
|
function durableMessages(message) {
|
|
180
|
-
return stripRuntimeTurnContext([
|
|
180
|
+
return stripRuntimeTurnContext([message]);
|
|
181
|
+
}
|
|
182
|
+
function historyItemFromPiMessage(message, provenance) {
|
|
183
|
+
const parsed = piMessageSchema.parse(message);
|
|
184
|
+
const { role, ...fields } = parsed;
|
|
185
|
+
if (role === "user") {
|
|
186
|
+
return agentHistoryItemSchema.parse({
|
|
187
|
+
...fields,
|
|
188
|
+
type: "user_message",
|
|
189
|
+
provenance
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
if (role === "assistant") {
|
|
193
|
+
return agentHistoryItemSchema.parse({
|
|
194
|
+
...fields,
|
|
195
|
+
type: "assistant_message"
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
if (role === "toolResult") {
|
|
199
|
+
return agentHistoryItemSchema.parse({
|
|
200
|
+
...fields,
|
|
201
|
+
type: "tool_result"
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
throw new Error(`Unsupported durable agent message role "${role}"`);
|
|
205
|
+
}
|
|
206
|
+
function piMessageFromHistoryItem(data) {
|
|
207
|
+
if (data.type === "user_message") {
|
|
208
|
+
const { type: _2, provenance: __, ...fields2 } = data;
|
|
209
|
+
return piMessageSchema.parse({ ...fields2, role: "user" });
|
|
210
|
+
}
|
|
211
|
+
if (data.type === "assistant_message") {
|
|
212
|
+
const { type: _2, ...fields2 } = data;
|
|
213
|
+
return piMessageSchema.parse({ ...fields2, role: "assistant" });
|
|
214
|
+
}
|
|
215
|
+
const { type: _, ...fields } = data;
|
|
216
|
+
return piMessageSchema.parse({ ...fields, role: "toolResult" });
|
|
217
|
+
}
|
|
218
|
+
function historyItemProvenance(data) {
|
|
219
|
+
return data.type === "user_message" ? data.provenance : contextProvenance;
|
|
181
220
|
}
|
|
182
221
|
function projectConversationEvents(events, options) {
|
|
183
222
|
const messages = [];
|
|
@@ -192,22 +231,26 @@ function projectConversationEvents(events, options) {
|
|
|
192
231
|
`Unsupported conversation event "${event.data.originalType}" at seq ${event.seq} (schema version ${event.schemaVersion})`
|
|
193
232
|
);
|
|
194
233
|
}
|
|
195
|
-
if (event.data.type === "compaction" || event.data.type === "handoff"
|
|
234
|
+
if (event.data.type === "compaction" || event.data.type === "handoff") {
|
|
196
235
|
modelProfile = event.data.modelProfile;
|
|
197
236
|
modelId = event.data.modelId;
|
|
198
237
|
for (const replacement of event.data.replacementHistory) {
|
|
199
|
-
for (const message of durableMessages(
|
|
238
|
+
for (const message of durableMessages(
|
|
239
|
+
piMessageFromHistoryItem(replacement.item)
|
|
240
|
+
)) {
|
|
200
241
|
messages.push(message);
|
|
201
|
-
provenance.push(replacement.
|
|
242
|
+
provenance.push(historyItemProvenance(replacement.item));
|
|
202
243
|
seqs.push(replacement.sourceEventSeq ?? event.seq);
|
|
203
244
|
}
|
|
204
245
|
}
|
|
205
246
|
continue;
|
|
206
247
|
}
|
|
207
|
-
if (event.data.type === "
|
|
208
|
-
for (const message of durableMessages(
|
|
248
|
+
if (event.data.type === "user_message" || event.data.type === "assistant_message" || event.data.type === "tool_result") {
|
|
249
|
+
for (const message of durableMessages(
|
|
250
|
+
piMessageFromHistoryItem(event.data)
|
|
251
|
+
)) {
|
|
209
252
|
messages.push(message);
|
|
210
|
-
provenance.push(
|
|
253
|
+
provenance.push(historyItemProvenance(event.data));
|
|
211
254
|
seqs.push(event.seq);
|
|
212
255
|
}
|
|
213
256
|
continue;
|
|
@@ -257,9 +300,12 @@ function resolveCommitProvenance(args) {
|
|
|
257
300
|
}
|
|
258
301
|
return args.explicitProvenance;
|
|
259
302
|
}
|
|
303
|
+
if (args.existing.provenance.length !== args.existing.messages.length) {
|
|
304
|
+
throw new Error("committed provenance must align one-to-one with messages");
|
|
305
|
+
}
|
|
260
306
|
const matchingPrefix = args.matchingPrefix;
|
|
261
307
|
const provenance = args.nextMessages.map(
|
|
262
|
-
(_, index) => index < matchingPrefix ? args.existing.provenance[index]
|
|
308
|
+
(_, index) => index < matchingPrefix ? args.existing.provenance[index] : contextProvenance
|
|
263
309
|
);
|
|
264
310
|
if (args.newMessageProvenance) {
|
|
265
311
|
for (let index = args.nextMessages.length - 1; index >= matchingPrefix; index -= 1) {
|
|
@@ -369,11 +415,10 @@ async function commitMessagesLocked(args, executor) {
|
|
|
369
415
|
await eventStore.append(
|
|
370
416
|
args.conversationId,
|
|
371
417
|
newMessages.map((message, index) => ({
|
|
372
|
-
data:
|
|
373
|
-
type: "agent_step",
|
|
418
|
+
data: historyItemFromPiMessage(
|
|
374
419
|
message,
|
|
375
|
-
|
|
376
|
-
|
|
420
|
+
nextLocalProvenance[matchingPrefix + index]
|
|
421
|
+
),
|
|
377
422
|
createdAtMs: messageTimestamp(message)
|
|
378
423
|
}))
|
|
379
424
|
);
|
|
@@ -648,6 +693,9 @@ var agentTurnSessionSummarySchema = z2.object({
|
|
|
648
693
|
cumulativeDurationMs: nonNegativeNumberSchema,
|
|
649
694
|
cumulativeUsage: agentTurnUsageSchema.optional(),
|
|
650
695
|
destination: destinationSchema.optional(),
|
|
696
|
+
dispatchId: z2.string().min(1).optional(),
|
|
697
|
+
dispatchOutcome: z2.enum(["blocked", "completed", "failed"]).optional(),
|
|
698
|
+
resultMessageId: z2.string().min(1).optional(),
|
|
651
699
|
source: sourceSchema.optional(),
|
|
652
700
|
lastProgressAtMs: nonNegativeNumberSchema,
|
|
653
701
|
loadedSkillNames: z2.array(z2.string()).optional(),
|
|
@@ -750,6 +798,9 @@ function materializeAgentTurnSessionRecord(stored, piProjection, turnStartMessag
|
|
|
750
798
|
actors: stored.actors ?? instructionActors(piProjection.provenance),
|
|
751
799
|
cumulativeDurationMs: stored.cumulativeDurationMs,
|
|
752
800
|
...stored.destination ? { destination: stored.destination } : {},
|
|
801
|
+
...stored.dispatchId ? { dispatchId: stored.dispatchId } : {},
|
|
802
|
+
...stored.dispatchOutcome ? { dispatchOutcome: stored.dispatchOutcome } : {},
|
|
803
|
+
...stored.resultMessageId ? { resultMessageId: stored.resultMessageId } : {},
|
|
753
804
|
...stored.source ? { source: stored.source } : {},
|
|
754
805
|
...stored.cumulativeUsage ? { cumulativeUsage: stored.cumulativeUsage } : {},
|
|
755
806
|
...stored.resumeReason ? { resumeReason: stored.resumeReason } : {},
|
|
@@ -859,6 +910,9 @@ function buildStoredRecord(args) {
|
|
|
859
910
|
cumulativeDurationMs: args.cumulativeDurationMs,
|
|
860
911
|
...args.cumulativeUsage ? { cumulativeUsage: args.cumulativeUsage } : {},
|
|
861
912
|
...args.destination ? { destination: args.destination } : {},
|
|
913
|
+
...args.dispatchId ? { dispatchId: args.dispatchId } : {},
|
|
914
|
+
...args.dispatchOutcome ? { dispatchOutcome: args.dispatchOutcome } : {},
|
|
915
|
+
...args.resultMessageId ? { resultMessageId: args.resultMessageId } : {},
|
|
862
916
|
...args.source ? { source: args.source } : {},
|
|
863
917
|
...args.actor ? { actor: args.actor } : {},
|
|
864
918
|
...args.actors ? { actors: args.actors } : {},
|
|
@@ -934,6 +988,9 @@ async function updateAgentTurnSessionState(args) {
|
|
|
934
988
|
cumulativeDurationMs: args.existing.cumulativeDurationMs,
|
|
935
989
|
...args.existing.cumulativeUsage ? { cumulativeUsage: args.existing.cumulativeUsage } : {},
|
|
936
990
|
...args.existing.destination ? { destination: args.existing.destination } : {},
|
|
991
|
+
...args.existing.dispatchId ? { dispatchId: args.existing.dispatchId } : {},
|
|
992
|
+
...args.existing.dispatchOutcome ? { dispatchOutcome: args.existing.dispatchOutcome } : {},
|
|
993
|
+
...args.existing.resultMessageId ? { resultMessageId: args.existing.resultMessageId } : {},
|
|
937
994
|
...args.existing.source ? { source: args.existing.source } : {},
|
|
938
995
|
...args.existing.loadedSkillNames ? { loadedSkillNames: args.existing.loadedSkillNames } : {},
|
|
939
996
|
...args.existing.modelId ? { modelId: args.existing.modelId } : {},
|
|
@@ -953,6 +1010,12 @@ async function upsertAgentTurnSessionRecord(args) {
|
|
|
953
1010
|
args.conversationId,
|
|
954
1011
|
args.sessionId
|
|
955
1012
|
);
|
|
1013
|
+
const existingDispatchId = existingRecord?.dispatchId ?? (await listAgentTurnSessionSummariesForConversation(args.conversationId)).find((summary) => summary.sessionId === args.sessionId)?.dispatchId;
|
|
1014
|
+
if (existingDispatchId && args.dispatchId && existingDispatchId !== args.dispatchId) {
|
|
1015
|
+
throw new Error(
|
|
1016
|
+
`Turn session ${args.sessionId} dispatchId cannot be changed`
|
|
1017
|
+
);
|
|
1018
|
+
}
|
|
956
1019
|
const ttlMs = Math.max(1, args.ttlMs ?? AGENT_TURN_SESSION_TTL_MS);
|
|
957
1020
|
const instructionActor = args.actor ?? existingRecord?.actor;
|
|
958
1021
|
const commit = await commitMessages({
|
|
@@ -991,6 +1054,13 @@ async function upsertAgentTurnSessionRecord(args) {
|
|
|
991
1054
|
cumulativeDurationMs: args.cumulativeDurationMs ?? existingRecord?.cumulativeDurationMs ?? 0,
|
|
992
1055
|
...args.cumulativeUsage ? { cumulativeUsage: args.cumulativeUsage } : {},
|
|
993
1056
|
...args.destination ?? existingRecord?.destination ? { destination: args.destination ?? existingRecord?.destination } : {},
|
|
1057
|
+
...args.dispatchId ?? existingRecord?.dispatchId ? { dispatchId: args.dispatchId ?? existingRecord?.dispatchId } : {},
|
|
1058
|
+
...args.dispatchOutcome ?? existingRecord?.dispatchOutcome ? {
|
|
1059
|
+
dispatchOutcome: args.dispatchOutcome ?? existingRecord?.dispatchOutcome
|
|
1060
|
+
} : {},
|
|
1061
|
+
...args.resultMessageId ?? existingRecord?.resultMessageId ? {
|
|
1062
|
+
resultMessageId: args.resultMessageId ?? existingRecord?.resultMessageId
|
|
1063
|
+
} : {},
|
|
994
1064
|
...args.source ?? existingRecord?.source ? { source: args.source ?? existingRecord?.source } : {},
|
|
995
1065
|
...args.loadedSkillNames ? { loadedSkillNames: args.loadedSkillNames } : {},
|
|
996
1066
|
modelId: args.modelId,
|
|
@@ -1012,10 +1082,20 @@ async function upsertAgentTurnSessionRecord(args) {
|
|
|
1012
1082
|
});
|
|
1013
1083
|
}
|
|
1014
1084
|
async function recordAgentTurnSessionSummary(args) {
|
|
1015
|
-
const
|
|
1085
|
+
const stored = await getStoredAgentTurnSessionRecord(
|
|
1016
1086
|
args.conversationId,
|
|
1017
1087
|
args.sessionId
|
|
1018
1088
|
);
|
|
1089
|
+
const priorSummary = (await listAgentTurnSessionSummariesForConversation(args.conversationId)).find((summary2) => summary2.sessionId === args.sessionId);
|
|
1090
|
+
const existing = stored ?? priorSummary;
|
|
1091
|
+
const existingDispatchId = existing?.dispatchId;
|
|
1092
|
+
const existingDispatchOutcome = priorSummary?.dispatchOutcome ?? stored?.dispatchOutcome;
|
|
1093
|
+
const existingResultMessageId = priorSummary?.resultMessageId ?? stored?.resultMessageId;
|
|
1094
|
+
if (existingDispatchId && args.dispatchId && existingDispatchId !== args.dispatchId) {
|
|
1095
|
+
throw new Error(
|
|
1096
|
+
`Turn session ${args.sessionId} dispatchId cannot be changed`
|
|
1097
|
+
);
|
|
1098
|
+
}
|
|
1019
1099
|
const nowMs = Date.now();
|
|
1020
1100
|
const ttlMs = Math.max(1, args.ttlMs ?? AGENT_TURN_SESSION_TTL_MS);
|
|
1021
1101
|
const summary = {
|
|
@@ -1031,6 +1111,9 @@ async function recordAgentTurnSessionSummary(args) {
|
|
|
1031
1111
|
cumulativeDurationMs: args.cumulativeDurationMs ?? existing?.cumulativeDurationMs ?? 0,
|
|
1032
1112
|
...args.cumulativeUsage ?? existing?.cumulativeUsage ? { cumulativeUsage: args.cumulativeUsage ?? existing?.cumulativeUsage } : {},
|
|
1033
1113
|
...args.destination ?? existing?.destination ? { destination: args.destination ?? existing?.destination } : {},
|
|
1114
|
+
...args.dispatchId ?? existingDispatchId ? { dispatchId: args.dispatchId ?? existingDispatchId } : {},
|
|
1115
|
+
...args.dispatchOutcome ?? existingDispatchOutcome ? { dispatchOutcome: args.dispatchOutcome ?? existingDispatchOutcome } : {},
|
|
1116
|
+
...args.resultMessageId ?? existingResultMessageId ? { resultMessageId: args.resultMessageId ?? existingResultMessageId } : {},
|
|
1034
1117
|
...args.source ?? existing?.source ? { source: args.source ?? existing?.source } : {},
|
|
1035
1118
|
...args.actor ?? existing?.actor ? { actor: args.actor ?? existing?.actor } : {},
|
|
1036
1119
|
...args.loadedSkillNames ? { loadedSkillNames: args.loadedSkillNames } : existing?.loadedSkillNames ? { loadedSkillNames: existing.loadedSkillNames } : {},
|
|
@@ -1200,6 +1283,7 @@ async function persistRunningSessionRecord(args) {
|
|
|
1200
1283
|
cumulativeDurationMs: latestSessionRecord?.cumulativeDurationMs,
|
|
1201
1284
|
cumulativeUsage: latestSessionRecord?.cumulativeUsage,
|
|
1202
1285
|
...args.destination ?? latestSessionRecord?.destination ? { destination: args.destination ?? latestSessionRecord?.destination } : {},
|
|
1286
|
+
...args.dispatchId ?? latestSessionRecord?.dispatchId ? { dispatchId: args.dispatchId ?? latestSessionRecord?.dispatchId } : {},
|
|
1203
1287
|
...args.source ?? latestSessionRecord?.source ? { source: args.source ?? latestSessionRecord?.source } : {},
|
|
1204
1288
|
sessionId: args.sessionId,
|
|
1205
1289
|
sliceId: args.sliceId,
|
|
@@ -1258,6 +1342,14 @@ async function persistCompletedSessionRecord(args) {
|
|
|
1258
1342
|
args.currentUsage
|
|
1259
1343
|
),
|
|
1260
1344
|
...args.destination ?? latestSessionRecord?.destination ? { destination: args.destination ?? latestSessionRecord?.destination } : {},
|
|
1345
|
+
...args.dispatchId ?? latestSessionRecord?.dispatchId ? { dispatchId: args.dispatchId ?? latestSessionRecord?.dispatchId } : {},
|
|
1346
|
+
...args.dispatchOutcome ?? latestSessionRecord?.dispatchOutcome ? {
|
|
1347
|
+
dispatchOutcome: args.dispatchOutcome ?? latestSessionRecord?.dispatchOutcome
|
|
1348
|
+
} : {},
|
|
1349
|
+
...args.errorMessage ? { errorMessage: args.errorMessage } : {},
|
|
1350
|
+
...args.resultMessageId ?? latestSessionRecord?.resultMessageId ? {
|
|
1351
|
+
resultMessageId: args.resultMessageId ?? latestSessionRecord?.resultMessageId
|
|
1352
|
+
} : {},
|
|
1261
1353
|
...args.source ?? latestSessionRecord?.source ? { source: args.source ?? latestSessionRecord?.source } : {},
|
|
1262
1354
|
...args.destinationVisibility ? { destinationVisibility: args.destinationVisibility } : {},
|
|
1263
1355
|
sessionId: args.sessionId,
|
|
@@ -1288,6 +1380,10 @@ async function completeDeliveredTurn(args) {
|
|
|
1288
1380
|
currentUsage: args.usage,
|
|
1289
1381
|
destination: args.destination,
|
|
1290
1382
|
destinationVisibility: args.destinationVisibility,
|
|
1383
|
+
dispatchId: args.dispatchId,
|
|
1384
|
+
dispatchOutcome: args.dispatchOutcome,
|
|
1385
|
+
errorMessage: args.errorMessage,
|
|
1386
|
+
resultMessageId: args.resultMessageId,
|
|
1291
1387
|
source: args.source,
|
|
1292
1388
|
sessionId: args.sessionId,
|
|
1293
1389
|
sliceId: args.sliceId,
|
|
@@ -1326,6 +1422,7 @@ async function persistAuthPauseSessionRecord(args) {
|
|
|
1326
1422
|
args.currentUsage
|
|
1327
1423
|
),
|
|
1328
1424
|
...args.destination ?? latestSessionRecord?.destination ? { destination: args.destination ?? latestSessionRecord?.destination } : {},
|
|
1425
|
+
...args.dispatchId ?? latestSessionRecord?.dispatchId ? { dispatchId: args.dispatchId ?? latestSessionRecord?.dispatchId } : {},
|
|
1329
1426
|
...args.source ?? latestSessionRecord?.source ? { source: args.source ?? latestSessionRecord?.source } : {},
|
|
1330
1427
|
sessionId: args.sessionId,
|
|
1331
1428
|
sliceId: nextSliceId,
|
|
@@ -1390,6 +1487,7 @@ async function persistContinuationSessionRecord(args) {
|
|
|
1390
1487
|
...args.destination ?? latestSessionRecord?.destination ? {
|
|
1391
1488
|
destination: args.destination ?? latestSessionRecord?.destination
|
|
1392
1489
|
} : {},
|
|
1490
|
+
...args.dispatchId ?? latestSessionRecord?.dispatchId ? { dispatchId: args.dispatchId ?? latestSessionRecord?.dispatchId } : {},
|
|
1393
1491
|
...args.source ?? latestSessionRecord?.source ? { source: args.source ?? latestSessionRecord?.source } : {},
|
|
1394
1492
|
sessionId: args.sessionId,
|
|
1395
1493
|
sliceId: args.currentSliceId,
|
|
@@ -1416,6 +1514,7 @@ async function persistContinuationSessionRecord(args) {
|
|
|
1416
1514
|
cumulativeDurationMs,
|
|
1417
1515
|
cumulativeUsage,
|
|
1418
1516
|
...args.destination ?? latestSessionRecord?.destination ? { destination: args.destination ?? latestSessionRecord?.destination } : {},
|
|
1517
|
+
...args.dispatchId ?? latestSessionRecord?.dispatchId ? { dispatchId: args.dispatchId ?? latestSessionRecord?.dispatchId } : {},
|
|
1419
1518
|
...args.source ?? latestSessionRecord?.source ? { source: args.source ?? latestSessionRecord?.source } : {},
|
|
1420
1519
|
sessionId: args.sessionId,
|
|
1421
1520
|
sliceId: nextSliceId,
|
|
@@ -1469,6 +1568,7 @@ async function persistYieldSessionRecord(args) {
|
|
|
1469
1568
|
args.currentUsage
|
|
1470
1569
|
),
|
|
1471
1570
|
...args.destination ?? latestSessionRecord?.destination ? { destination: args.destination ?? latestSessionRecord?.destination } : {},
|
|
1571
|
+
...args.dispatchId ?? latestSessionRecord?.dispatchId ? { dispatchId: args.dispatchId ?? latestSessionRecord?.dispatchId } : {},
|
|
1472
1572
|
...args.source ?? latestSessionRecord?.source ? { source: args.source ?? latestSessionRecord?.source } : {},
|
|
1473
1573
|
sessionId: args.sessionId,
|
|
1474
1574
|
sliceId: args.currentSliceId,
|
|
@@ -2678,6 +2778,8 @@ export {
|
|
|
2678
2778
|
retainRuntimeTurnContext,
|
|
2679
2779
|
instructionTextForProjection,
|
|
2680
2780
|
stripRuntimeTurnContext,
|
|
2781
|
+
historyItemFromPiMessage,
|
|
2782
|
+
piMessageFromHistoryItem,
|
|
2681
2783
|
loadProjection,
|
|
2682
2784
|
loadConversationProjection,
|
|
2683
2785
|
openConversationProjection,
|
|
@@ -5,8 +5,13 @@ var healthReportSchema = z.object({
|
|
|
5
5
|
service: z.string(),
|
|
6
6
|
timestamp: z.string()
|
|
7
7
|
}).strict();
|
|
8
|
-
var
|
|
9
|
-
|
|
8
|
+
var pluginSchema = z.object({
|
|
9
|
+
configKeys: z.array(z.string()),
|
|
10
|
+
description: z.string(),
|
|
11
|
+
displayName: z.string(),
|
|
12
|
+
name: z.string()
|
|
13
|
+
}).strict();
|
|
14
|
+
var pluginsSchema = z.array(pluginSchema);
|
|
10
15
|
var skillReportSchema = z.object({
|
|
11
16
|
name: z.string(),
|
|
12
17
|
pluginProvider: z.string().optional()
|
|
@@ -97,8 +102,8 @@ var pluginOperationalReportFeedSchema = z.object({
|
|
|
97
102
|
|
|
98
103
|
export {
|
|
99
104
|
healthReportSchema,
|
|
100
|
-
|
|
101
|
-
|
|
105
|
+
pluginSchema,
|
|
106
|
+
pluginsSchema,
|
|
102
107
|
skillReportSchema,
|
|
103
108
|
skillReportsSchema,
|
|
104
109
|
pluginPackageContentItemReportSchema,
|