@sentry/junior 0.157.0 → 0.159.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-QI5EPOKQ.js → agent-hooks-IAD3AANZ.js} +10 -10
- package/dist/api/conversations/cancel-pending-messages.d.ts +4 -0
- package/dist/api/conversations/priority.d.ts +2 -1
- package/dist/api/conversations/user-message-activity.d.ts +3 -0
- package/dist/api/schema/conversation.d.ts +13 -0
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +5 -1
- package/dist/api.js +280 -175
- package/dist/app.js +32 -32
- package/dist/{catalog-runtime-HUGHAFUN.js → catalog-runtime-6VANKLH5.js} +5 -5
- package/dist/chat/conversations/history.d.ts +4 -1
- package/dist/chat/slack/mrkdwn.d.ts +2 -1
- package/dist/chat/task-execution/state.d.ts +10 -0
- package/dist/chat/task-execution/store.d.ts +11 -0
- package/dist/{chunk-7J65DOBL.js → chunk-27UQ7UB3.js} +6 -6
- package/dist/{chunk-GEY6IFXH.js → chunk-54O6IKUS.js} +4 -4
- package/dist/{chunk-XRERMHPN.js → chunk-6IADZQJR.js} +1 -1
- package/dist/{chunk-VIBHFGQC.js → chunk-AIQKUJKK.js} +4 -4
- package/dist/{chunk-AFQ47JQ7.js → chunk-AZW5HKC5.js} +8 -8
- package/dist/{chunk-6MI43QZO.js → chunk-CNHELV2P.js} +1 -1
- package/dist/{chunk-VDAEXEBB.js → chunk-DJZPA72K.js} +35 -6
- package/dist/{chunk-TA5R6BME.js → chunk-DXSZJAVZ.js} +18 -18
- package/dist/{chunk-MGJW3SW4.js → chunk-EBP6IS66.js} +6 -6
- package/dist/{chunk-CZCMFRUQ.js → chunk-EQXVKNLM.js} +11 -0
- package/dist/{chunk-BLCVTEE7.js → chunk-FWDN67U3.js} +55 -4
- package/dist/{chunk-VYDM7HUF.js → chunk-IJ6KWS3V.js} +1 -1
- package/dist/{chunk-MDZQ62PB.js → chunk-K2LAI7RW.js} +2 -2
- package/dist/{chunk-UJYA75N5.js → chunk-L2PEQ2PY.js} +2 -2
- package/dist/{chunk-46ADYIPE.js → chunk-LUIKMY35.js} +1 -1
- package/dist/{chunk-PP4UQTH3.js → chunk-NCJV265M.js} +9 -9
- package/dist/{chunk-HJ3EZHIX.js → chunk-NT6V5WEE.js} +5 -5
- package/dist/{chunk-3GS7O66Z.js → chunk-O2DZWUPQ.js} +1 -1
- package/dist/{chunk-F7VOY4VQ.js → chunk-OGMHLKNO.js} +1 -1
- package/dist/{chunk-GO2W3VZY.js → chunk-PQWWCKNB.js} +4 -4
- package/dist/{chunk-D7BNWRYL.js → chunk-PT7B6A3O.js} +1 -1
- package/dist/{chunk-I3OQVVMV.js → chunk-Q5X37U6G.js} +1 -1
- package/dist/{chunk-G2FN3I66.js → chunk-QODFNKQS.js} +27 -10
- package/dist/{chunk-OWASYHHV.js → chunk-SQOVZSWF.js} +20 -18
- package/dist/{chunk-MKA3T2R6.js → chunk-TD7ZQZ5W.js} +1 -1
- package/dist/{chunk-RQBRGPUF.js → chunk-U7D4VLUF.js} +2 -2
- package/dist/{chunk-4M25PSFB.js → chunk-UG673UVL.js} +1 -1
- package/dist/{chunk-5TIH5GOE.js → chunk-UKKOKMRE.js} +5 -5
- package/dist/{chunk-MXO6VFB3.js → chunk-UP6KQVF5.js} +1 -1
- package/dist/{chunk-S4PFOWRA.js → chunk-WTQ3CKC3.js} +1 -1
- package/dist/{chunk-WNNYOPXX.js → chunk-X7AIXRVJ.js} +5 -5
- package/dist/{chunk-77QB5FNI.js → chunk-YCBZ47LC.js} +1 -1
- package/dist/{chunk-VBKFO65J.js → chunk-YSMAMSOU.js} +10 -10
- package/dist/cli/chat.js +30 -30
- package/dist/cli/check.js +6 -6
- package/dist/cli/plugins.js +13 -13
- package/dist/cli/snapshot-create.js +9 -9
- package/dist/cli/upgrade.js +7 -7
- package/dist/{db-VQAV4PJ3.js → db-BIIMAPFB.js} +7 -7
- package/dist/instrumentation.js +4 -4
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-K5KQAAAX.js → oauth-callback-server-4BENCPP3.js} +23 -23
- package/dist/{runner-U7QI7P4S.js → runner-TUBJLEYO.js} +13 -13
- package/dist/{skills-ENKRBZ7K.js → skills-MBRLNBRV.js} +6 -6
- package/dist/spawn-ZWIXA46E.js +37 -0
- package/dist/{validation-VKCDVGA6.js → validation-YTJGRJYT.js} +6 -6
- package/dist/version.js +1 -1
- package/dist/{work-IBD6PWP2.js → work-5MRHKA54.js} +17 -17
- package/dist/worker-S2V7HZJ4.js +24 -0
- package/package.json +4 -4
- package/dist/spawn-4XGNONLS.js +0 -37
- package/dist/worker-TJFXOZRC.js +0 -24
|
@@ -4,30 +4,30 @@ import {
|
|
|
4
4
|
isConversationScopedChannel,
|
|
5
5
|
isDmChannel,
|
|
6
6
|
normalizeSlackConversationId
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-K2LAI7RW.js";
|
|
8
8
|
import {
|
|
9
9
|
getConversationEventStore,
|
|
10
10
|
getDb
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-QODFNKQS.js";
|
|
12
12
|
import {
|
|
13
13
|
juniorConversationAnnotations,
|
|
14
14
|
juniorConversationEvents,
|
|
15
15
|
juniorIdentities,
|
|
16
16
|
juniorUsers
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-O2DZWUPQ.js";
|
|
18
18
|
import {
|
|
19
19
|
SANDBOX_WORKSPACE_ROOT
|
|
20
20
|
} from "./chunk-EM225ITJ.js";
|
|
21
21
|
import {
|
|
22
22
|
getStateAdapter
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-Q5X37U6G.js";
|
|
24
24
|
import {
|
|
25
25
|
botConfig,
|
|
26
26
|
completeObject,
|
|
27
27
|
embedTexts,
|
|
28
28
|
getSlackBotToken,
|
|
29
29
|
standardModelId
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-L2PEQ2PY.js";
|
|
31
31
|
import {
|
|
32
32
|
isActorUserId,
|
|
33
33
|
parseActorUserId,
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
logInfo,
|
|
41
41
|
logWarn,
|
|
42
42
|
normalizeIdentityEmail
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-TD7ZQZ5W.js";
|
|
44
44
|
|
|
45
45
|
// src/chat/plugins/agent-hooks.ts
|
|
46
46
|
import {
|
|
@@ -133,6 +133,15 @@ var conversationPendingMessagesReportSchema = z2.object({
|
|
|
133
133
|
generatedAt: z2.string().datetime(),
|
|
134
134
|
messages: z2.array(conversationPendingMessageSchema)
|
|
135
135
|
}).strict();
|
|
136
|
+
var cancelConversationPendingMessagesBodySchema = z2.object({
|
|
137
|
+
inboundMessageIds: z2.array(z2.string().min(1)).min(1).optional(),
|
|
138
|
+
receivedBefore: z2.string().datetime().optional()
|
|
139
|
+
}).strict();
|
|
140
|
+
var cancelConversationPendingMessagesResponseSchema = z2.object({
|
|
141
|
+
cancelledCount: z2.number().int().nonnegative(),
|
|
142
|
+
cancelledInboundMessageIds: z2.array(z2.string().min(1)),
|
|
143
|
+
conversationId: z2.string().min(1)
|
|
144
|
+
}).strict();
|
|
136
145
|
var conversationAuxiliaryCostsSchema = z2.object({
|
|
137
146
|
costUsd: z2.number().finite().nonnegative(),
|
|
138
147
|
operations: z2.array(
|
|
@@ -810,6 +819,8 @@ export {
|
|
|
810
819
|
conversationPendingMessageSchema,
|
|
811
820
|
conversationPendingAuthorizationSchema,
|
|
812
821
|
conversationPendingMessagesReportSchema,
|
|
822
|
+
cancelConversationPendingMessagesBodySchema,
|
|
823
|
+
cancelConversationPendingMessagesResponseSchema,
|
|
813
824
|
conversationAuxiliaryCostsSchema,
|
|
814
825
|
conversationSummaryReportSchema,
|
|
815
826
|
conversationReportEventDataSchema,
|
|
@@ -8,14 +8,14 @@ import {
|
|
|
8
8
|
getConversationStore,
|
|
9
9
|
parseDestination,
|
|
10
10
|
sameDestination
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-QODFNKQS.js";
|
|
12
12
|
import {
|
|
13
13
|
getDefaultRedisStateAdapterFor,
|
|
14
14
|
getStateAdapter
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-Q5X37U6G.js";
|
|
16
16
|
import {
|
|
17
17
|
getChatConfig
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-L2PEQ2PY.js";
|
|
19
19
|
import {
|
|
20
20
|
parseStoredSlackActor
|
|
21
21
|
} from "./chunk-V7YE4WCP.js";
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
isRecord,
|
|
24
24
|
toOptionalNumber,
|
|
25
25
|
toOptionalString
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-TD7ZQZ5W.js";
|
|
27
27
|
|
|
28
28
|
// src/chat/task-execution/state.ts
|
|
29
29
|
import { randomUUID } from "crypto";
|
|
@@ -984,6 +984,49 @@ async function ackMessages(args) {
|
|
|
984
984
|
return true;
|
|
985
985
|
});
|
|
986
986
|
}
|
|
987
|
+
async function cancelHumanFacingPendingMessages(args) {
|
|
988
|
+
const nowMs = args.nowMs ?? now();
|
|
989
|
+
const requestedIds = args.inboundMessageIds === void 0 ? void 0 : new Set(args.inboundMessageIds);
|
|
990
|
+
return await withConversationMutation(args, async (state, lock) => {
|
|
991
|
+
const current = await readConversation(state, args.conversationId);
|
|
992
|
+
if (!current) {
|
|
993
|
+
return { cancelledInboundMessageIds: [] };
|
|
994
|
+
}
|
|
995
|
+
const cancelledInboundMessageIds = [];
|
|
996
|
+
const pendingMessages2 = [];
|
|
997
|
+
for (const message of current.execution.pendingMessages) {
|
|
998
|
+
const isHumanFacing = message.source === "web" || message.source === "slack";
|
|
999
|
+
const isRequested = requestedIds === void 0 || requestedIds.has(message.inboundMessageId);
|
|
1000
|
+
const isInSnapshot = args.receivedBeforeMs === void 0 || message.receivedAtMs <= args.receivedBeforeMs;
|
|
1001
|
+
if (isHumanFacing && isRequested && isInSnapshot) {
|
|
1002
|
+
cancelledInboundMessageIds.push(message.inboundMessageId);
|
|
1003
|
+
continue;
|
|
1004
|
+
}
|
|
1005
|
+
pendingMessages2.push(message);
|
|
1006
|
+
}
|
|
1007
|
+
if (cancelledInboundMessageIds.length === 0) {
|
|
1008
|
+
return { cancelledInboundMessageIds };
|
|
1009
|
+
}
|
|
1010
|
+
const becomesIdle = current.execution.status === "pending" && pendingMessages2.length === 0;
|
|
1011
|
+
await writeConversation(
|
|
1012
|
+
state,
|
|
1013
|
+
lock,
|
|
1014
|
+
withExecutionUpdate(
|
|
1015
|
+
current,
|
|
1016
|
+
{
|
|
1017
|
+
...current.execution,
|
|
1018
|
+
lastEnqueuedAtMs: pendingMessages2.length === 0 ? void 0 : current.execution.lastEnqueuedAtMs,
|
|
1019
|
+
pendingMessages: pendingMessages2,
|
|
1020
|
+
retryCount: becomesIdle ? 0 : current.execution.retryCount,
|
|
1021
|
+
runId: becomesIdle ? void 0 : current.execution.runId,
|
|
1022
|
+
status: becomesIdle ? "idle" : current.execution.status
|
|
1023
|
+
},
|
|
1024
|
+
nowMs
|
|
1025
|
+
)
|
|
1026
|
+
);
|
|
1027
|
+
return { cancelledInboundMessageIds };
|
|
1028
|
+
});
|
|
1029
|
+
}
|
|
987
1030
|
async function requestAnotherSlice(args) {
|
|
988
1031
|
const nowMs = args.nowMs ?? now();
|
|
989
1032
|
return await withConversationMutation(args, async (state, lock) => {
|
|
@@ -1451,6 +1494,13 @@ async function ackMessages2(args) {
|
|
|
1451
1494
|
await recordExecutionMetadata(args);
|
|
1452
1495
|
return result;
|
|
1453
1496
|
}
|
|
1497
|
+
async function cancelHumanFacingPendingMessages2(args) {
|
|
1498
|
+
const result = await cancelHumanFacingPendingMessages(args);
|
|
1499
|
+
if (result.cancelledInboundMessageIds.length > 0) {
|
|
1500
|
+
await recordExecutionMetadata(args);
|
|
1501
|
+
}
|
|
1502
|
+
return result;
|
|
1503
|
+
}
|
|
1454
1504
|
async function requestAnotherSlice2(args) {
|
|
1455
1505
|
const result = await requestAnotherSlice(args);
|
|
1456
1506
|
await recordExecutionMetadata(args);
|
|
@@ -1516,6 +1566,7 @@ export {
|
|
|
1516
1566
|
checkInConversationWork2 as checkInConversationWork,
|
|
1517
1567
|
drainConversationMailbox2 as drainConversationMailbox,
|
|
1518
1568
|
ackMessages2 as ackMessages,
|
|
1569
|
+
cancelHumanFacingPendingMessages2 as cancelHumanFacingPendingMessages,
|
|
1519
1570
|
requestAnotherSlice2 as requestAnotherSlice,
|
|
1520
1571
|
beginConversationResume2 as beginConversationResume,
|
|
1521
1572
|
releaseConversationWork2 as releaseConversationWork,
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-EM225ITJ.js";
|
|
4
4
|
import {
|
|
5
5
|
getSlackBotToken
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-L2PEQ2PY.js";
|
|
7
7
|
import {
|
|
8
8
|
parseSlackChannelReferenceId
|
|
9
9
|
} from "./chunk-V7YE4WCP.js";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
setSpanAttributes,
|
|
13
13
|
setSpanStatus,
|
|
14
14
|
withSpan
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-TD7ZQZ5W.js";
|
|
16
16
|
|
|
17
17
|
// src/chat/slack/client.ts
|
|
18
18
|
import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
toCanonicalInputMessage,
|
|
4
4
|
toCanonicalOutputMessage,
|
|
5
5
|
toGenAiMessagesTraceAttributes
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-PT7B6A3O.js";
|
|
7
7
|
import {
|
|
8
8
|
extractGenAiUsageAttributes,
|
|
9
9
|
logException,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
normalizeGenAiFinishReason,
|
|
12
12
|
serializeGenAiAttribute,
|
|
13
13
|
withSpan
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-TD7ZQZ5W.js";
|
|
15
15
|
|
|
16
16
|
// src/chat/services/provider-error.ts
|
|
17
17
|
var ProviderError = class extends Error {
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
coerceThreadConversationState,
|
|
3
3
|
getPersistedThreadState,
|
|
4
4
|
persistThreadStateById
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-UKKOKMRE.js";
|
|
6
6
|
import {
|
|
7
7
|
pluginTaskId,
|
|
8
8
|
pluginTaskParamsSchema,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
markTurnCompleted,
|
|
23
23
|
normalizeToolNameFromResult,
|
|
24
24
|
stripRuntimeTurnContext
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-54O6IKUS.js";
|
|
26
26
|
import {
|
|
27
27
|
JUNIOR_THREAD_STATE_TTL_MS
|
|
28
28
|
} from "./chunk-3Y47VMHV.js";
|
|
@@ -33,25 +33,25 @@ import {
|
|
|
33
33
|
createPluginModel,
|
|
34
34
|
createPluginState,
|
|
35
35
|
getPlugins
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-EBP6IS66.js";
|
|
37
37
|
import {
|
|
38
38
|
getConversationStore,
|
|
39
39
|
getDb,
|
|
40
40
|
sameActorIdentity
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-QODFNKQS.js";
|
|
42
42
|
import {
|
|
43
43
|
juniorConversations,
|
|
44
44
|
juniorTaskExecutions
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-O2DZWUPQ.js";
|
|
46
46
|
import {
|
|
47
47
|
getStateAdapter
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-Q5X37U6G.js";
|
|
49
49
|
import {
|
|
50
50
|
ProviderError,
|
|
51
51
|
findProviderError,
|
|
52
52
|
getProviderErrorAttributes,
|
|
53
53
|
getProviderErrorUserMessage
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-L2PEQ2PY.js";
|
|
55
55
|
import {
|
|
56
56
|
credentialSubjectSchema
|
|
57
57
|
} from "./chunk-BDUENQD3.js";
|
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
import {
|
|
62
62
|
buildTurnFailureResponse,
|
|
63
63
|
logWarn
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-TD7ZQZ5W.js";
|
|
65
65
|
|
|
66
66
|
// src/chat/runtime/delivered-turn-state.ts
|
|
67
67
|
function buildDeliveredTurnStatePatch(args) {
|
|
@@ -87,7 +87,7 @@ import { pluginRunContextSchema } from "@sentry/junior-plugin-api";
|
|
|
87
87
|
|
|
88
88
|
// src/chat/services/turn-session-routing.ts
|
|
89
89
|
async function resolveTurnSessionRouting(args) {
|
|
90
|
-
const conversationStore = args.conversationStore ?? (await import("./db-
|
|
90
|
+
const conversationStore = args.conversationStore ?? (await import("./db-BIIMAPFB.js")).getConversationStore();
|
|
91
91
|
const conversation = await conversationStore.get({
|
|
92
92
|
conversationId: args.conversationId
|
|
93
93
|
});
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ToolInputError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-54O6IKUS.js";
|
|
4
4
|
import {
|
|
5
5
|
canRouteResourceEvents,
|
|
6
6
|
getPlugins
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-EBP6IS66.js";
|
|
8
8
|
import {
|
|
9
9
|
getDb
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-QODFNKQS.js";
|
|
11
11
|
import {
|
|
12
12
|
juniorAttachments,
|
|
13
13
|
juniorConversations,
|
|
@@ -15,13 +15,13 @@ import {
|
|
|
15
15
|
juniorSchedulerRuns,
|
|
16
16
|
juniorSchedulerTasks,
|
|
17
17
|
juniorStats
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-O2DZWUPQ.js";
|
|
19
19
|
import {
|
|
20
20
|
juniorDestinations
|
|
21
21
|
} from "./chunk-VFUK3X5B.js";
|
|
22
22
|
import {
|
|
23
23
|
logInfo
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-TD7ZQZ5W.js";
|
|
25
25
|
|
|
26
26
|
// src/chat/event-tasks/store.ts
|
|
27
27
|
import { and, asc, desc, eq, inArray, or, sql } from "drizzle-orm";
|
|
@@ -4,18 +4,18 @@ import {
|
|
|
4
4
|
} from "./chunk-EM225ITJ.js";
|
|
5
5
|
import {
|
|
6
6
|
getStateAdapter
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-Q5X37U6G.js";
|
|
8
8
|
import {
|
|
9
9
|
toOptionalTrimmed
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-L2PEQ2PY.js";
|
|
11
11
|
import {
|
|
12
12
|
pluginCatalogRuntime
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-CNHELV2P.js";
|
|
14
14
|
import {
|
|
15
15
|
setSpanAttributes,
|
|
16
16
|
setSpanStatus,
|
|
17
17
|
withSpan
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-TD7ZQZ5W.js";
|
|
19
19
|
|
|
20
20
|
// src/chat/sandbox/resources.ts
|
|
21
21
|
var configuredResources;
|
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
juniorConversations,
|
|
7
7
|
juniorIdentities,
|
|
8
8
|
juniorUsers
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-O2DZWUPQ.js";
|
|
10
10
|
import {
|
|
11
11
|
TURN_REASONING_LEVELS,
|
|
12
12
|
getChatConfig,
|
|
13
13
|
modelProfileSchema
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-L2PEQ2PY.js";
|
|
15
15
|
import {
|
|
16
16
|
juniorDestinations
|
|
17
17
|
} from "./chunk-VFUK3X5B.js";
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
} from "./chunk-V7YE4WCP.js";
|
|
23
23
|
import {
|
|
24
24
|
normalizeIdentityEmail
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-TD7ZQZ5W.js";
|
|
26
26
|
|
|
27
27
|
// src/chat/conversations/sql/store.ts
|
|
28
28
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
@@ -1608,6 +1608,29 @@ var messageHistoryEventTypes = [
|
|
|
1608
1608
|
"message_updated",
|
|
1609
1609
|
"message_handled"
|
|
1610
1610
|
];
|
|
1611
|
+
var HUMAN_INSTRUCTION_PLATFORMS = /* @__PURE__ */ new Set(["slack", "local", "web"]);
|
|
1612
|
+
function eventUnarchivesConversation(data) {
|
|
1613
|
+
if (data.type === "user_message") {
|
|
1614
|
+
const provenance = data.provenance;
|
|
1615
|
+
if (provenance.authority !== "instruction") return false;
|
|
1616
|
+
const platform = provenance.actor?.platform;
|
|
1617
|
+
return platform === void 0 || HUMAN_INSTRUCTION_PLATFORMS.has(platform);
|
|
1618
|
+
}
|
|
1619
|
+
if (data.type !== "message") {
|
|
1620
|
+
return false;
|
|
1621
|
+
}
|
|
1622
|
+
if (data.role !== "user") return false;
|
|
1623
|
+
const meta = data.meta;
|
|
1624
|
+
if (!meta) return true;
|
|
1625
|
+
if (typeof meta.eventType === "string" && meta.eventType.length > 0) {
|
|
1626
|
+
return false;
|
|
1627
|
+
}
|
|
1628
|
+
const author = meta.author;
|
|
1629
|
+
if (author && typeof author === "object" && !Array.isArray(author) && author.isBot === true) {
|
|
1630
|
+
return false;
|
|
1631
|
+
}
|
|
1632
|
+
return true;
|
|
1633
|
+
}
|
|
1611
1634
|
function insertFromEvent(conversationId, seq, historyVersion, event, actorIdentityId) {
|
|
1612
1635
|
const stripped = stripPayloadAuthorIdentityId(event.data);
|
|
1613
1636
|
const { type, ...payload } = conversationEventDataSchema.parse(stripped);
|
|
@@ -1691,7 +1714,7 @@ var SqlConversationEventStore = class {
|
|
|
1691
1714
|
newestCreatedAtMs,
|
|
1692
1715
|
options
|
|
1693
1716
|
);
|
|
1694
|
-
if (options.activity !== "preserve") {
|
|
1717
|
+
if (options.activity !== "preserve" && pending.some((event) => eventUnarchivesConversation(event.data))) {
|
|
1695
1718
|
await this.executor.db().update(juniorConversations).set({ archivedAt: null }).where(
|
|
1696
1719
|
and6(
|
|
1697
1720
|
eq6(juniorConversations.conversationId, conversationId),
|
|
@@ -1736,12 +1759,6 @@ var SqlConversationEventStore = class {
|
|
|
1736
1759
|
const parsed = historyReplacementSchema.parse(replacement);
|
|
1737
1760
|
await withConversationEventLock(this.executor, conversationId, async () => {
|
|
1738
1761
|
await ensureConversationRow(this.executor, conversationId, Date.now());
|
|
1739
|
-
await this.executor.db().update(juniorConversations).set({ archivedAt: null }).where(
|
|
1740
|
-
and6(
|
|
1741
|
-
eq6(juniorConversations.conversationId, conversationId),
|
|
1742
|
-
isNotNull(juniorConversations.archivedAt)
|
|
1743
|
-
)
|
|
1744
|
-
);
|
|
1745
1762
|
const cursor = await this.readCursor(conversationId);
|
|
1746
1763
|
const historyVersion = (cursor.maxHistoryVersion ?? 0) + 1;
|
|
1747
1764
|
await this.executor.db().insert(juniorConversationEvents).values(
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
PluginCredentialFailureError,
|
|
8
8
|
agentNameSchema,
|
|
9
9
|
createPluginAuthOrchestration
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-X7AIXRVJ.js";
|
|
11
11
|
import {
|
|
12
12
|
authorizationId
|
|
13
13
|
} from "./chunk-DIB4GX3G.js";
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
searchSlackUsers,
|
|
33
33
|
selectPluginGrant,
|
|
34
34
|
toMcpProviderError
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-AZW5HKC5.js";
|
|
36
36
|
import {
|
|
37
37
|
RetryableDeliveryError,
|
|
38
38
|
actorFromRun,
|
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
getSlackMessagePermalink,
|
|
49
49
|
resolveBaseUrl,
|
|
50
50
|
uploadFilesToConversation
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-DJZPA72K.js";
|
|
52
52
|
import {
|
|
53
53
|
parseSandboxEgressAuthRequiredSignal,
|
|
54
54
|
parseSandboxEgressPermissionDeniedSignal,
|
|
@@ -74,7 +74,7 @@ import {
|
|
|
74
74
|
runNonInteractiveCommand,
|
|
75
75
|
throwSandboxOperationError,
|
|
76
76
|
wrapSandboxSetupError
|
|
77
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-PQWWCKNB.js";
|
|
78
78
|
import {
|
|
79
79
|
SCHEDULED_TASK_SYSTEM_ACTOR,
|
|
80
80
|
compactEventTask,
|
|
@@ -107,10 +107,10 @@ import {
|
|
|
107
107
|
scheduledTaskAttributes,
|
|
108
108
|
storeAttachments,
|
|
109
109
|
writableEventTask
|
|
110
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-NT6V5WEE.js";
|
|
111
111
|
import {
|
|
112
112
|
parseSlackThreadId
|
|
113
|
-
} from "./chunk-
|
|
113
|
+
} from "./chunk-IJ6KWS3V.js";
|
|
114
114
|
import {
|
|
115
115
|
AGENTS_REMOVAL_NOTICE,
|
|
116
116
|
AGENTS_REPLACEMENT_NOTICE,
|
|
@@ -180,7 +180,7 @@ import {
|
|
|
180
180
|
stripRuntimeTurnContext,
|
|
181
181
|
trimTrailingAssistantMessages,
|
|
182
182
|
truncateText
|
|
183
|
-
} from "./chunk-
|
|
183
|
+
} from "./chunk-54O6IKUS.js";
|
|
184
184
|
import {
|
|
185
185
|
JUNIOR_THREAD_STATE_TTL_MS
|
|
186
186
|
} from "./chunk-3Y47VMHV.js";
|
|
@@ -196,7 +196,7 @@ import {
|
|
|
196
196
|
getSlackToolContext,
|
|
197
197
|
readActorIdentity,
|
|
198
198
|
resolveChannelCapabilities
|
|
199
|
-
} from "./chunk-
|
|
199
|
+
} from "./chunk-EBP6IS66.js";
|
|
200
200
|
import {
|
|
201
201
|
SlackActionError,
|
|
202
202
|
downloadPrivateSlackFile,
|
|
@@ -205,7 +205,7 @@ import {
|
|
|
205
205
|
isConversationScopedChannel,
|
|
206
206
|
normalizeSlackConversationId,
|
|
207
207
|
withSlackRetries
|
|
208
|
-
} from "./chunk-
|
|
208
|
+
} from "./chunk-K2LAI7RW.js";
|
|
209
209
|
import {
|
|
210
210
|
KNOWN_CONVERSATION_EVENT_TYPES,
|
|
211
211
|
contextProvenance,
|
|
@@ -217,10 +217,10 @@ import {
|
|
|
217
217
|
instructionActors,
|
|
218
218
|
instructionProvenanceFor,
|
|
219
219
|
sameActorIdentity
|
|
220
|
-
} from "./chunk-
|
|
220
|
+
} from "./chunk-QODFNKQS.js";
|
|
221
221
|
import {
|
|
222
222
|
juniorIdentities
|
|
223
|
-
} from "./chunk-
|
|
223
|
+
} from "./chunk-O2DZWUPQ.js";
|
|
224
224
|
import {
|
|
225
225
|
SANDBOX_DATA_ROOT,
|
|
226
226
|
SANDBOX_SKILLS_ROOT,
|
|
@@ -232,7 +232,7 @@ import {
|
|
|
232
232
|
} from "./chunk-EM225ITJ.js";
|
|
233
233
|
import {
|
|
234
234
|
getStateAdapter
|
|
235
|
-
} from "./chunk-
|
|
235
|
+
} from "./chunk-Q5X37U6G.js";
|
|
236
236
|
import {
|
|
237
237
|
ACTIVE_TURN_COMPACTION_SUMMARY_PREFIX,
|
|
238
238
|
COMPACTION_SUMMARY_PREFIX,
|
|
@@ -265,7 +265,7 @@ import {
|
|
|
265
265
|
resolveGatewayCredential,
|
|
266
266
|
resolveGatewayModel,
|
|
267
267
|
unwrapCurrentInstruction
|
|
268
|
-
} from "./chunk-
|
|
268
|
+
} from "./chunk-L2PEQ2PY.js";
|
|
269
269
|
import {
|
|
270
270
|
canExposeConversationPayload,
|
|
271
271
|
resolveConversationPrivacy,
|
|
@@ -275,16 +275,16 @@ import {
|
|
|
275
275
|
toGenAiMessagesTraceAttributes,
|
|
276
276
|
toGenAiPayloadMetadata,
|
|
277
277
|
toGenAiPayloadTraceAttributes
|
|
278
|
-
} from "./chunk-
|
|
278
|
+
} from "./chunk-PT7B6A3O.js";
|
|
279
279
|
import {
|
|
280
280
|
discoverSkills,
|
|
281
281
|
findSkillByName,
|
|
282
282
|
loadSkillsByName,
|
|
283
283
|
parseSkillInvocation
|
|
284
|
-
} from "./chunk-
|
|
284
|
+
} from "./chunk-U7D4VLUF.js";
|
|
285
285
|
import {
|
|
286
286
|
pluginCatalogRuntime
|
|
287
|
-
} from "./chunk-
|
|
287
|
+
} from "./chunk-CNHELV2P.js";
|
|
288
288
|
import {
|
|
289
289
|
CredentialUnavailableError,
|
|
290
290
|
OAuthProviderError,
|
|
@@ -292,7 +292,7 @@ import {
|
|
|
292
292
|
getOAuthProviderErrorAttributes,
|
|
293
293
|
resolveAuthTokenPlaceholder,
|
|
294
294
|
resolvePluginCommandEnv
|
|
295
|
-
} from "./chunk-
|
|
295
|
+
} from "./chunk-YCBZ47LC.js";
|
|
296
296
|
import {
|
|
297
297
|
credentialUserSubjectId
|
|
298
298
|
} from "./chunk-BDUENQD3.js";
|
|
@@ -320,7 +320,7 @@ import {
|
|
|
320
320
|
summarizeMessageText,
|
|
321
321
|
withLogContext,
|
|
322
322
|
withSpan
|
|
323
|
-
} from "./chunk-
|
|
323
|
+
} from "./chunk-TD7ZQZ5W.js";
|
|
324
324
|
import {
|
|
325
325
|
startInactiveSpan,
|
|
326
326
|
withActiveSpan
|
|
@@ -1731,6 +1731,7 @@ function buildOutputSection(platform) {
|
|
|
1731
1731
|
`<output format="markdown">`,
|
|
1732
1732
|
"- Start with the answer or result, not internal process narration.",
|
|
1733
1733
|
"- Use concise Markdown suitable for terminal output: short paragraphs, bullets, links, and fenced code blocks when helpful.",
|
|
1734
|
+
"- When you mention a pull request, include a direct link. Prefer the full PR URL or a Markdown link; do not leave bare `PR #123` text without a URL or repo.",
|
|
1734
1735
|
"- End every turn with a final user-facing response.",
|
|
1735
1736
|
"</output>"
|
|
1736
1737
|
].join("\n");
|
|
@@ -1740,6 +1741,7 @@ function buildOutputSection(platform) {
|
|
|
1740
1741
|
"- Default to the shortest complete reply\u2014usually 1\u20135 sentences and under 800 characters. Include only the outcome, decisive evidence, and any blocker or required next action. If useful detail would exceed that, put it in a Slack canvas and reply with the link. An explicit user request for detail overrides this target.",
|
|
1741
1742
|
"- Start with the answer or result, not internal process narration.",
|
|
1742
1743
|
"- Use Slack-flavored Markdown: **bold** section labels, `code`, [text](url) links, bullet lists, and fenced code blocks. No hash-prefixed headings and no tables. When the answer primarily lists several URLs, show each URL bare instead of as a labeled link.",
|
|
1744
|
+
"- When you mention a pull request, include a direct link. Prefer the full PR URL or a Markdown link; `owner/repo#number` is also accepted and is linkified on delivery. Do not leave bare `PR #123` text without a URL or repo.",
|
|
1743
1745
|
"- End every turn with a final user-facing markdown response unless the Slack action rules allow a no-reply completion.",
|
|
1744
1746
|
"</output>"
|
|
1745
1747
|
].join("\n");
|