@sentry/junior 0.186.0 → 0.188.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-4B3Z4WRK.js → agent-hooks-5RQEVLQD.js} +11 -11
- package/dist/api.js +32 -32
- package/dist/app.js +67 -91
- package/dist/{catalog-runtime-AFJCAOHC.js → catalog-runtime-L4A6BJ3U.js} +4 -4
- package/dist/chat/agent/types.d.ts +16 -17
- package/dist/chat/agent-invocations/types.d.ts +72 -0
- package/dist/chat/api-turns/{accepted-reply.d.ts → assistant-message.d.ts} +3 -2
- package/dist/chat/api-turns/cancellation.d.ts +0 -1
- package/dist/chat/api-turns/mailbox-input.d.ts +0 -3
- package/dist/chat/api-turns/routing.d.ts +22 -21
- package/dist/chat/api-turns/work.d.ts +2 -2
- package/dist/chat/conversations/location.d.ts +4 -9
- package/dist/chat/conversations/store.d.ts +17 -7
- package/dist/chat/event-tasks/tool-support.d.ts +6 -0
- package/dist/chat/resource-events/actor.d.ts +7 -0
- package/dist/chat/services/turn-session-routing.d.ts +10 -9
- package/dist/chat/task-execution/slack-resource-event.d.ts +13 -5
- package/dist/chat/task-input.d.ts +22 -0
- package/dist/{chunk-YXSBZRP7.js → chunk-32XSSFZV.js} +1 -1
- package/dist/{chunk-HKFLRIBD.js → chunk-3HEZWDS5.js} +2 -2
- package/dist/{chunk-INQHUE72.js → chunk-6FGN7ZEG.js} +6 -2
- package/dist/{chunk-TXLBLGNQ.js → chunk-6JZGXLL2.js} +5 -5
- package/dist/{chunk-H7X2G2KS.js → chunk-6YGFBU3A.js} +12 -12
- package/dist/{chunk-MCLWOBPN.js → chunk-AW77HH54.js} +23 -19
- package/dist/{chunk-2U7EPTRZ.js → chunk-CDSLOYOR.js} +5 -5
- package/dist/{chunk-CM6RTYSO.js → chunk-CIG6WI7Q.js} +9 -6
- package/dist/{chunk-7EOWT62G.js → chunk-CVBDVIF4.js} +1 -1
- package/dist/{chunk-QBL2AVFF.js → chunk-CZRWU4ZM.js} +2 -2
- package/dist/{chunk-GQMQCY7H.js → chunk-ERZMACYA.js} +3 -3
- package/dist/{chunk-FFYDRLXW.js → chunk-FIUCHYT6.js} +1 -1
- package/dist/{chunk-VQIWBJOP.js → chunk-HCIVBCP5.js} +1 -1
- package/dist/{chunk-43LODHJM.js → chunk-IUUQWIG2.js} +14 -31
- package/dist/{chunk-7EU4YSZ4.js → chunk-LODJKINF.js} +140 -123
- package/dist/{chunk-2IBDVE62.js → chunk-MQDIIFZM.js} +4 -4
- package/dist/{chunk-NRMAOGRS.js → chunk-NZLZ4KYZ.js} +1 -1
- package/dist/{chunk-PZZOGHVR.js → chunk-PSHMPRIU.js} +1 -1
- package/dist/{chunk-AD64YMEC.js → chunk-Q7O74WOO.js} +2 -2
- package/dist/{chunk-JFPY6XFF.js → chunk-QCGNHSMA.js} +6 -6
- package/dist/{chunk-OZG7E22Y.js → chunk-QDHJTKPE.js} +5 -5
- package/dist/{chunk-3CVEE6LA.js → chunk-QIMN3FXL.js} +1 -1
- package/dist/{chunk-64WF2GQ3.js → chunk-QIOUTXTZ.js} +1 -1
- package/dist/{chunk-VXL2LBPK.js → chunk-QVH6FW3T.js} +13 -3
- package/dist/{chunk-GSB3NTNS.js → chunk-RMB7CERI.js} +34 -36
- package/dist/{chunk-EWRPUXE3.js → chunk-SC67CH3C.js} +18 -14
- package/dist/{chunk-VQZYIVYN.js → chunk-UVUXFRYN.js} +6 -6
- package/dist/{chunk-DHYZ4VKG.js → chunk-VFZAUQ5V.js} +97 -47
- package/dist/{chunk-QU3URVWG.js → chunk-W2DDJCPS.js} +8 -8
- package/dist/{chunk-STOCCPWH.js → chunk-W42ENMJW.js} +1 -1
- package/dist/{chunk-BRKB5R7P.js → chunk-WGZJ5SU4.js} +1 -1
- package/dist/{chunk-O6GQO7VP.js → chunk-WW2Y7JIA.js} +26 -23
- package/dist/{chunk-HWXP6RHG.js → chunk-X55FOVZO.js} +3 -3
- package/dist/{chunk-ACGWTJ74.js → chunk-XI4PVY2T.js} +3 -3
- package/dist/{chunk-CV5CPRVG.js → chunk-XJIPMHKI.js} +3 -3
- package/dist/{chunk-VOGOTEW7.js → chunk-Z5SKZE5B.js} +2 -2
- package/dist/{chunk-DOP3FIQC.js → chunk-ZX7RSBQ6.js} +1 -1
- 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/schema/agent-invocations.d.ts +36 -0
- package/dist/db/schema.d.ts +36 -0
- package/dist/{db-7XL4UPAE.js → db-YPRZAA2T.js} +6 -6
- package/dist/instrumentation.js +3 -3
- package/dist/nitro.js +6 -6
- package/dist/{oauth-callback-server-RAOYHWDI.js → oauth-callback-server-DBBIR3XG.js} +28 -28
- package/dist/{runner-KMPBWRPM.js → runner-FKVFFPLO.js} +20 -20
- package/dist/{skills-IPCALGLQ.js → skills-4RBAZEMV.js} +5 -5
- package/dist/spawn-CO7QFCNJ.js +41 -0
- package/dist/task-runner-DUGZGI7V.js +34 -0
- package/dist/{validation-BSRCCX6N.js → validation-E6Z5LHZM.js} +5 -5
- package/dist/version.js +1 -1
- package/dist/{work-T6UFTOJY.js → work-OFTXWOK4.js} +21 -21
- package/dist/{worker-L35OG7VA.js → worker-OMWNOKTJ.js} +10 -10
- package/package.json +4 -4
- package/dist/spawn-OSOWTMBG.js +0 -41
- package/dist/task-runner-IQNBA3RY.js +0 -34
|
@@ -9,18 +9,18 @@ import {
|
|
|
9
9
|
getSqlExecutor,
|
|
10
10
|
sanitizePostgresJson,
|
|
11
11
|
withConversationEventLock
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-IUUQWIG2.js";
|
|
13
13
|
import {
|
|
14
14
|
SANDBOX_REPOS_ROOT,
|
|
15
15
|
SANDBOX_WORKSPACE_ROOT,
|
|
16
16
|
sleep
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-X55FOVZO.js";
|
|
18
18
|
import {
|
|
19
19
|
MUTATION_LOCK_TTL_MS,
|
|
20
20
|
fenceLock,
|
|
21
21
|
getStateAdapter,
|
|
22
22
|
withLock
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-ZX7RSBQ6.js";
|
|
24
24
|
import {
|
|
25
25
|
agentHistoryItemSchema,
|
|
26
26
|
contextProvenance,
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
escapeXml,
|
|
34
34
|
resolveGatewayModel,
|
|
35
35
|
unwrapCurrentInstruction
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-Q7O74WOO.js";
|
|
37
37
|
import {
|
|
38
38
|
parseSlackMessageTs,
|
|
39
39
|
toStoredSlackActor
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
logException,
|
|
44
44
|
logWarn,
|
|
45
45
|
setSpanAttributes
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-QIMN3FXL.js";
|
|
47
47
|
|
|
48
48
|
// src/chat/turn-context-tag.ts
|
|
49
49
|
var TURN_CONTEXT_TAG = "runtime-turn-context";
|
|
@@ -653,7 +653,7 @@ async function ensureConversationTitleOnce(args) {
|
|
|
653
653
|
if (stored?.title?.trim()) {
|
|
654
654
|
return void 0;
|
|
655
655
|
}
|
|
656
|
-
if (stored?.
|
|
656
|
+
if (stored?.parentConversationId) {
|
|
657
657
|
return void 0;
|
|
658
658
|
}
|
|
659
659
|
const titleSourceMessage = getThreadTitleSourceMessage(args.conversation);
|
|
@@ -2306,12 +2306,12 @@ async function recordConversationActivityMetadata(args) {
|
|
|
2306
2306
|
const conversation = await conversationStore.get({
|
|
2307
2307
|
conversationId: args.summary.conversationId
|
|
2308
2308
|
});
|
|
2309
|
-
const
|
|
2310
|
-
const destination =
|
|
2311
|
-
if (!
|
|
2309
|
+
const hasParent = Boolean(conversation?.parentConversationId);
|
|
2310
|
+
const destination = hasParent ? void 0 : args.destination;
|
|
2311
|
+
if (!hasParent && !destination && !conversation) {
|
|
2312
2312
|
return;
|
|
2313
2313
|
}
|
|
2314
|
-
const activitySource =
|
|
2314
|
+
const activitySource = hasParent ? "internal" : args.source?.platform === "web" ? "web" : destination?.platform === "local" ? "local" : destination ? args.summary.surface : void 0;
|
|
2315
2315
|
await conversationStore.recordActivity({
|
|
2316
2316
|
activityAtMs: args.summary.updatedAtMs,
|
|
2317
2317
|
channelName: args.summary.channelName,
|
|
@@ -2321,7 +2321,7 @@ async function recordConversationActivityMetadata(args) {
|
|
|
2321
2321
|
actor: sessionLogActor(args.actor),
|
|
2322
2322
|
...definedProps({ source: activitySource }),
|
|
2323
2323
|
...args.source ? { sessionSource: args.source } : void 0,
|
|
2324
|
-
visibility:
|
|
2324
|
+
visibility: hasParent ? void 0 : args.destinationVisibility
|
|
2325
2325
|
});
|
|
2326
2326
|
await conversationStore.recordExecution({
|
|
2327
2327
|
channelName: args.summary.channelName,
|
|
@@ -2337,7 +2337,7 @@ async function recordConversationActivityMetadata(args) {
|
|
|
2337
2337
|
actor: sessionLogActor(args.actor),
|
|
2338
2338
|
...definedProps({ source: activitySource }),
|
|
2339
2339
|
updatedAtMs: args.nowMs,
|
|
2340
|
-
visibility:
|
|
2340
|
+
visibility: hasParent ? void 0 : args.destinationVisibility
|
|
2341
2341
|
});
|
|
2342
2342
|
}
|
|
2343
2343
|
function materializeTurnRecord(stored, piProjection, turnStartMessageIndex, restoreVolatileContext = true, runtimeMetrics) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
coerceThreadConversationState,
|
|
3
3
|
getPersistedThreadState
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CIG6WI7Q.js";
|
|
5
5
|
import {
|
|
6
6
|
pluginTaskId,
|
|
7
7
|
pluginTaskParamsSchema,
|
|
8
8
|
sendVercelPluginTask
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-XI4PVY2T.js";
|
|
10
10
|
import {
|
|
11
11
|
getPiMessageRole,
|
|
12
12
|
getTurnRecord,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
isToolResultMessage,
|
|
17
17
|
normalizeToolNameFromResult,
|
|
18
18
|
stripRuntimeTurnContext
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-6YGFBU3A.js";
|
|
20
20
|
import {
|
|
21
21
|
createPluginConversationEvents,
|
|
22
22
|
createPluginEmbedder,
|
|
@@ -25,21 +25,21 @@ import {
|
|
|
25
25
|
createPluginState,
|
|
26
26
|
getPlugins,
|
|
27
27
|
readActorIdentity
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-QCGNHSMA.js";
|
|
29
29
|
import {
|
|
30
30
|
JUNIOR_THREAD_STATE_TTL_MS
|
|
31
31
|
} from "./chunk-3Y47VMHV.js";
|
|
32
32
|
import {
|
|
33
33
|
getConversationStore,
|
|
34
34
|
getDb
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-IUUQWIG2.js";
|
|
36
36
|
import {
|
|
37
37
|
juniorConversations,
|
|
38
38
|
juniorTaskExecutions
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-QVH6FW3T.js";
|
|
40
40
|
import {
|
|
41
41
|
getStateAdapter
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-ZX7RSBQ6.js";
|
|
43
43
|
import {
|
|
44
44
|
sameActorIdentity
|
|
45
45
|
} from "./chunk-GFBR4S3Q.js";
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
} from "./chunk-N7TMSOZH.js";
|
|
52
52
|
import {
|
|
53
53
|
logWarn
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-QIMN3FXL.js";
|
|
55
55
|
|
|
56
56
|
// src/chat/plugins/task-runner.ts
|
|
57
57
|
import { pluginRunContextSchema } from "@sentry/junior-plugin-api";
|
|
@@ -63,12 +63,14 @@ async function loadConversationChain(conversationId, conversationStore) {
|
|
|
63
63
|
let cursor = conversationId;
|
|
64
64
|
while (cursor && !seen.has(cursor)) {
|
|
65
65
|
seen.add(cursor);
|
|
66
|
-
const conversation = await conversationStore.get({
|
|
66
|
+
const conversation = await conversationStore.get({
|
|
67
|
+
conversationId: cursor
|
|
68
|
+
});
|
|
67
69
|
if (!conversation) {
|
|
68
70
|
break;
|
|
69
71
|
}
|
|
70
72
|
chain.push(conversation);
|
|
71
|
-
cursor = conversation.
|
|
73
|
+
cursor = conversation.parentConversationId;
|
|
72
74
|
}
|
|
73
75
|
return chain;
|
|
74
76
|
}
|
|
@@ -86,18 +88,18 @@ function slackSourceForDestination(args) {
|
|
|
86
88
|
};
|
|
87
89
|
}
|
|
88
90
|
async function resolveConversationRouting(args) {
|
|
89
|
-
const conversationStore = args.conversationStore ?? (await import("./db-
|
|
91
|
+
const conversationStore = args.conversationStore ?? (await import("./db-YPRZAA2T.js")).getConversationStore();
|
|
90
92
|
const chain = await loadConversationChain(
|
|
91
93
|
args.conversationId,
|
|
92
94
|
conversationStore
|
|
93
95
|
);
|
|
94
96
|
let destination;
|
|
95
97
|
let source;
|
|
96
|
-
let
|
|
98
|
+
let location;
|
|
97
99
|
for (const conversation of chain) {
|
|
98
100
|
destination ??= conversation.destination;
|
|
99
101
|
source ??= conversation.sessionSource;
|
|
100
|
-
|
|
102
|
+
location ??= conversation.location;
|
|
101
103
|
if (destination && source) {
|
|
102
104
|
break;
|
|
103
105
|
}
|
|
@@ -109,14 +111,16 @@ async function resolveConversationRouting(args) {
|
|
|
109
111
|
const slackSource = slackSourceForDestination({ destination, source });
|
|
110
112
|
return {
|
|
111
113
|
destination,
|
|
112
|
-
...
|
|
113
|
-
...slackSource ? {
|
|
114
|
+
...location ? { location } : void 0,
|
|
115
|
+
...slackSource ? {
|
|
116
|
+
source: location ? { ...slackSource, location } : slackSource
|
|
117
|
+
} : void 0
|
|
114
118
|
};
|
|
115
119
|
}
|
|
116
120
|
return {
|
|
117
121
|
destination,
|
|
118
|
-
...
|
|
119
|
-
...source ? { source } : void 0
|
|
122
|
+
...location ? { location } : void 0,
|
|
123
|
+
...source ? { source: location ? { ...source, location } : source } : void 0
|
|
120
124
|
};
|
|
121
125
|
}
|
|
122
126
|
async function resolveTurnSessionRouting(args) {
|
|
@@ -129,7 +133,7 @@ async function resolveTurnSessionRouting(args) {
|
|
|
129
133
|
return {
|
|
130
134
|
destination: routing.destination,
|
|
131
135
|
source: routing.source,
|
|
132
|
-
...routing.
|
|
136
|
+
...routing.location ? { location: routing.location } : void 0
|
|
133
137
|
};
|
|
134
138
|
}
|
|
135
139
|
|
|
@@ -969,7 +973,7 @@ async function loadPluginRun(params) {
|
|
|
969
973
|
completedAtMs: record.updatedAtMs,
|
|
970
974
|
conversationId: record.conversationId,
|
|
971
975
|
destination: routing.destination,
|
|
972
|
-
...routing.
|
|
976
|
+
...routing.location ? { locationId: routing.location.id } : void 0,
|
|
973
977
|
// Read Actors from the full run record, not the shorter transcript.
|
|
974
978
|
// This includes every Actor that supplied an instruction.
|
|
975
979
|
actors: record.actors,
|
|
@@ -19,23 +19,23 @@ import {
|
|
|
19
19
|
releaseConversationWork,
|
|
20
20
|
requestAnotherSlice,
|
|
21
21
|
startConversationWork
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-MQDIIFZM.js";
|
|
23
23
|
import {
|
|
24
24
|
ConversationQueueMessageRejectedError
|
|
25
25
|
} from "./chunk-JAL3CH4G.js";
|
|
26
26
|
import {
|
|
27
27
|
getTurnRequestDeadline
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-WGZJ5SU4.js";
|
|
29
29
|
import {
|
|
30
30
|
getChatConfig,
|
|
31
31
|
isProviderRetryError
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-Q7O74WOO.js";
|
|
33
33
|
import {
|
|
34
34
|
logException,
|
|
35
35
|
logInfo,
|
|
36
36
|
logWarn,
|
|
37
37
|
withLogContext
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-QIMN3FXL.js";
|
|
39
39
|
|
|
40
40
|
// src/chat/task-execution/worker.ts
|
|
41
41
|
var CONVERSATION_WORK_DEFER_DELAY_MS = 15e3;
|
|
@@ -279,7 +279,7 @@ async function processConversationWorkInContext(message, options) {
|
|
|
279
279
|
let destination = initial.destination;
|
|
280
280
|
if (!destination && options.conversationStore) {
|
|
281
281
|
const stored = await options.conversationStore.get({ conversationId });
|
|
282
|
-
if (stored && !stored.
|
|
282
|
+
if (stored && !stored.parentConversationId) {
|
|
283
283
|
destination = stored.destination;
|
|
284
284
|
}
|
|
285
285
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
persistConversationMessages
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6YGFBU3A.js";
|
|
4
4
|
import {
|
|
5
5
|
JUNIOR_THREAD_STATE_TTL_MS
|
|
6
6
|
} from "./chunk-3Y47VMHV.js";
|
|
7
7
|
import {
|
|
8
8
|
getDb
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-IUUQWIG2.js";
|
|
10
10
|
import {
|
|
11
11
|
juniorLocationConfigurations
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-QVH6FW3T.js";
|
|
13
13
|
import {
|
|
14
14
|
getStateAdapter
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-ZX7RSBQ6.js";
|
|
16
16
|
import {
|
|
17
17
|
juniorDestinations
|
|
18
18
|
} from "./chunk-VFUK3X5B.js";
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
isRecord,
|
|
21
21
|
toOptionalNumber,
|
|
22
22
|
toOptionalString
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-QIMN3FXL.js";
|
|
24
24
|
|
|
25
25
|
// src/chat/state/conversation.ts
|
|
26
26
|
function defaultConversationState() {
|
|
@@ -372,7 +372,10 @@ function createSqlLocationConfigurationStorage(db, destination) {
|
|
|
372
372
|
};
|
|
373
373
|
}
|
|
374
374
|
function createDurableLocationConfigurationService(args) {
|
|
375
|
-
const storage = createSqlLocationConfigurationStorage(
|
|
375
|
+
const storage = createSqlLocationConfigurationStorage(
|
|
376
|
+
args.db,
|
|
377
|
+
args.destination
|
|
378
|
+
);
|
|
376
379
|
let cutover;
|
|
377
380
|
const ensureCutover = () => cutover ??= (async () => {
|
|
378
381
|
if ((await storage.list()).length > 0) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createAndEnqueueAgentInvocation
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SC67CH3C.js";
|
|
4
4
|
import {
|
|
5
5
|
actorFromRun,
|
|
6
6
|
toolInvocationDestination
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-6FGN7ZEG.js";
|
|
8
8
|
|
|
9
9
|
// src/chat/agent-invocations/spawn.ts
|
|
10
10
|
function bindSpawnAgent(run, options) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ConversationTurnLifecycleService
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-W42ENMJW.js";
|
|
4
4
|
import {
|
|
5
5
|
runAgentWithTimeout
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-6FGN7ZEG.js";
|
|
7
7
|
import {
|
|
8
8
|
getConversationEventStore
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-IUUQWIG2.js";
|
|
10
10
|
|
|
11
11
|
// src/chat/runtime/turn-execution.ts
|
|
12
12
|
var AgentRunError = class extends Error {
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
juniorConversations,
|
|
9
9
|
juniorIdentities,
|
|
10
10
|
juniorUsers
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-QVH6FW3T.js";
|
|
12
12
|
import {
|
|
13
13
|
conversationEventDataSchema,
|
|
14
14
|
decodeStoredConversationEvent,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
} from "./chunk-VFUK3X5B.js";
|
|
21
21
|
import {
|
|
22
22
|
getChatConfig
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-Q7O74WOO.js";
|
|
24
24
|
import {
|
|
25
25
|
parseActorUserId,
|
|
26
26
|
parseSlackChannelReferenceId,
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
} from "./chunk-N7TMSOZH.js";
|
|
29
29
|
import {
|
|
30
30
|
normalizeIdentityEmail
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-QIMN3FXL.js";
|
|
32
32
|
|
|
33
33
|
// src/chat/conversations/sql/store.ts
|
|
34
34
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
@@ -418,18 +418,7 @@ function mergeActor(current2, next) {
|
|
|
418
418
|
}
|
|
419
419
|
|
|
420
420
|
// src/chat/conversations/location.ts
|
|
421
|
-
import {
|
|
422
|
-
import { z } from "zod";
|
|
423
|
-
var locationSchema = z.object({
|
|
424
|
-
/** Junior-owned stable identity for this location. */
|
|
425
|
-
id: nonBlankStringSchema,
|
|
426
|
-
/** Provider namespace that owns the provider and tenant identifiers. */
|
|
427
|
-
provider: nonBlankStringSchema,
|
|
428
|
-
/** Optional provider-native workspace, account, or tenant scope. */
|
|
429
|
-
tenantId: nonBlankStringSchema.optional(),
|
|
430
|
-
/** Provider-native identifier for the container within its tenant scope. */
|
|
431
|
-
providerId: nonBlankStringSchema
|
|
432
|
-
}).strict();
|
|
421
|
+
import { locationSchema } from "@sentry/junior-plugin-api";
|
|
433
422
|
|
|
434
423
|
// src/chat/conversations/sql/location.ts
|
|
435
424
|
function locationFromRow(row) {
|
|
@@ -594,11 +583,7 @@ function conversationFromRow(readRow) {
|
|
|
594
583
|
...row.metricRunId ? { runId: row.metricRunId } : void 0,
|
|
595
584
|
...row.executionUsage ? { usage: row.executionUsage } : void 0
|
|
596
585
|
},
|
|
597
|
-
...row.parentConversationId ? {
|
|
598
|
-
lineage: {
|
|
599
|
-
parentConversationId: row.parentConversationId
|
|
600
|
-
}
|
|
601
|
-
} : void 0,
|
|
586
|
+
...row.parentConversationId ? { parentConversationId: row.parentConversationId } : void 0,
|
|
602
587
|
...destination ? { destination } : void 0,
|
|
603
588
|
...location ? { location } : void 0,
|
|
604
589
|
...actor ? { actor } : void 0,
|
|
@@ -686,9 +671,9 @@ var SqlStore = class {
|
|
|
686
671
|
conversationId: args.childConversationId
|
|
687
672
|
});
|
|
688
673
|
if (existing) {
|
|
689
|
-
if (existing.
|
|
674
|
+
if (existing.parentConversationId !== args.parentConversationId) {
|
|
690
675
|
throw new Error(
|
|
691
|
-
`Conversation
|
|
676
|
+
`Conversation parent changed for ${args.childConversationId}`
|
|
692
677
|
);
|
|
693
678
|
}
|
|
694
679
|
return;
|
|
@@ -701,7 +686,7 @@ var SqlStore = class {
|
|
|
701
686
|
`Conversation parent is missing for ${args.childConversationId}`
|
|
702
687
|
);
|
|
703
688
|
}
|
|
704
|
-
if (parent.
|
|
689
|
+
if (parent.parentConversationId) {
|
|
705
690
|
throw new Error("Recursive agent delegation is not enabled");
|
|
706
691
|
}
|
|
707
692
|
const child = {
|
|
@@ -710,9 +695,7 @@ var SqlStore = class {
|
|
|
710
695
|
nowMs,
|
|
711
696
|
source: args.source
|
|
712
697
|
}),
|
|
713
|
-
|
|
714
|
-
parentConversationId: args.parentConversationId
|
|
715
|
-
}
|
|
698
|
+
parentConversationId: args.parentConversationId
|
|
716
699
|
};
|
|
717
700
|
await this.upsertConversation({ conversation: child });
|
|
718
701
|
}
|
|
@@ -793,7 +776,7 @@ var SqlStore = class {
|
|
|
793
776
|
createdAtMs: args.createdAtMs,
|
|
794
777
|
lastActivityAtMs: args.lastActivityAtMs,
|
|
795
778
|
updatedAtMs: args.updatedAtMs,
|
|
796
|
-
...existing?.
|
|
779
|
+
...existing?.parentConversationId ? { parentConversationId: existing.parentConversationId } : void 0,
|
|
797
780
|
...args.channelName ? { channelName: args.channelName } : void 0,
|
|
798
781
|
...args.destination ? { destination: args.destination } : void 0,
|
|
799
782
|
...args.actor ? { actor: args.actor } : void 0,
|
|
@@ -921,7 +904,7 @@ var SqlStore = class {
|
|
|
921
904
|
/** Upsert the conversation row while preserving previously discovered nullable metadata fields. */
|
|
922
905
|
async upsertConversation(args) {
|
|
923
906
|
const { conversation } = args;
|
|
924
|
-
if (!conversation.
|
|
907
|
+
if (!conversation.parentConversationId && !conversation.destination) {
|
|
925
908
|
const existing = await this.get({
|
|
926
909
|
conversationId: conversation.conversationId
|
|
927
910
|
});
|
|
@@ -949,10 +932,10 @@ var SqlStore = class {
|
|
|
949
932
|
actorIdentityObservation,
|
|
950
933
|
conversation.updatedAtMs
|
|
951
934
|
) : void 0;
|
|
952
|
-
const rootConversationId = conversation.
|
|
935
|
+
const rootConversationId = conversation.parentConversationId ? sql3`(
|
|
953
936
|
select parent.root_conversation_id
|
|
954
937
|
from junior_conversations parent
|
|
955
|
-
where parent.conversation_id = ${conversation.
|
|
938
|
+
where parent.conversation_id = ${conversation.parentConversationId}
|
|
956
939
|
)` : conversation.conversationId;
|
|
957
940
|
const rows = await this.executor.db().insert(juniorConversations).values({
|
|
958
941
|
conversationId: conversation.conversationId,
|
|
@@ -978,7 +961,7 @@ var SqlStore = class {
|
|
|
978
961
|
runId: conversation.execution.runId ?? null,
|
|
979
962
|
lastCheckpointAt: conversation.execution.lastCheckpointAtMs === void 0 ? null : dateFromMs2(conversation.execution.lastCheckpointAtMs),
|
|
980
963
|
lastEnqueuedAt: conversation.execution.lastEnqueuedAtMs === void 0 ? null : dateFromMs2(conversation.execution.lastEnqueuedAtMs),
|
|
981
|
-
parentConversationId: conversation.
|
|
964
|
+
parentConversationId: conversation.parentConversationId ?? null,
|
|
982
965
|
rootConversationId
|
|
983
966
|
}).onConflictDoUpdate({
|
|
984
967
|
target: juniorConversations.conversationId,
|