@sentry/junior 0.107.0 → 0.108.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-ICPIJAFY.js → agent-hooks-NU5HK3PS.js} +4 -4
- package/dist/api/conversations/list.d.ts +1 -0
- package/dist/api.js +11 -8
- package/dist/app.js +270 -48
- package/dist/chat/conversations/history.d.ts +16 -5
- package/dist/chat/conversations/message-projection.d.ts +3 -5
- package/dist/chat/resource-events/store.d.ts +6 -0
- package/dist/chat/runtime/slack-runtime.d.ts +3 -0
- package/dist/chat/task-execution/slack-work.d.ts +237 -10
- package/dist/chat/tool-support/turn-deadline-result.d.ts +3 -0
- package/dist/{chunk-YFQ7CQDE.js → chunk-3RGQLX2F.js} +10 -16
- package/dist/{chunk-CQ7KSO2B.js → chunk-A5CO2EHL.js} +6 -6
- package/dist/{chunk-AUUOHQAT.js → chunk-AHJR2IFF.js} +1 -1
- package/dist/{chunk-SPUAJVVH.js → chunk-B5I5LMSP.js} +1 -1
- package/dist/{chunk-B2Z2H66D.js → chunk-H3QYZL7K.js} +32 -2
- package/dist/{chunk-4YF7Z6IA.js → chunk-J3B3FPP2.js} +2 -2
- package/dist/{chunk-EDLNHZH3.js → chunk-KPMPQ6AA.js} +143 -98
- package/dist/{chunk-NVOTGWYX.js → chunk-TE4QHJH4.js} +25 -10
- package/dist/{chunk-YNP2ATQX.js → chunk-TWINAEZQ.js} +6 -5
- package/dist/{chunk-RMVOAJRL.js → chunk-UD6THJ2I.js} +2 -2
- package/dist/{chunk-IGHMVDWI.js → chunk-XKB7LGIW.js} +1 -1
- package/dist/cli/chat.js +11 -11
- package/dist/cli/plugins.js +4 -4
- package/dist/cli/snapshot-warmup.js +2 -2
- package/dist/cli/upgrade.js +6 -11
- package/dist/{db-DIGO4TGW.js → db-AMRBAT5D.js} +1 -1
- package/dist/{runner-ACR2HAIC.js → runner-TQH5GAJ4.js} +7 -7
- package/package.json +7 -7
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
persistRunningSessionRecord,
|
|
16
16
|
persistYieldSessionRecord,
|
|
17
17
|
updateConversationStats
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-3RGQLX2F.js";
|
|
19
19
|
import {
|
|
20
20
|
JUNIOR_THREAD_STATE_TTL_MS,
|
|
21
21
|
loadConnectedMcpProviders,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
recordAuthorizationRequested,
|
|
25
25
|
recordMcpProviderConnected,
|
|
26
26
|
recordToolExecutionStarted
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-J3B3FPP2.js";
|
|
28
28
|
import {
|
|
29
29
|
buildNonInteractiveShellScript,
|
|
30
30
|
createSandboxInstance,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
isSnapshotMissingError,
|
|
35
35
|
resolveRuntimeDependencySnapshot,
|
|
36
36
|
runNonInteractiveCommand
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-B5I5LMSP.js";
|
|
38
38
|
import {
|
|
39
39
|
addAgentTurnUsage,
|
|
40
40
|
hasAgentTurnUsage
|
|
@@ -50,10 +50,10 @@ import {
|
|
|
50
50
|
getPlugins,
|
|
51
51
|
getSlackToolContext,
|
|
52
52
|
resolveChannelCapabilities
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-UD6THJ2I.js";
|
|
54
54
|
import {
|
|
55
55
|
createPluginLogger
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-AHJR2IFF.js";
|
|
57
57
|
import {
|
|
58
58
|
SANDBOX_DATA_ROOT,
|
|
59
59
|
SANDBOX_SKILLS_ROOT,
|
|
@@ -64,7 +64,7 @@ import {
|
|
|
64
64
|
import {
|
|
65
65
|
acquireActiveLock,
|
|
66
66
|
getStateAdapter
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-H3QYZL7K.js";
|
|
68
68
|
import {
|
|
69
69
|
SlackActionError,
|
|
70
70
|
downloadPrivateSlackFile,
|
|
@@ -83,7 +83,7 @@ import {
|
|
|
83
83
|
getDb,
|
|
84
84
|
instructionActors,
|
|
85
85
|
instructionProvenanceFor
|
|
86
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-TE4QHJH4.js";
|
|
87
87
|
import {
|
|
88
88
|
sleep
|
|
89
89
|
} from "./chunk-4ZNGQH7C.js";
|
|
@@ -839,8 +839,108 @@ function buildTurnResult(input) {
|
|
|
839
839
|
};
|
|
840
840
|
}
|
|
841
841
|
|
|
842
|
-
// src/chat/
|
|
842
|
+
// src/chat/tool-support/structured-result.ts
|
|
843
843
|
import { z } from "zod";
|
|
844
|
+
var juniorToolContinuationSchema = z.object({
|
|
845
|
+
arguments: z.record(z.string(), z.unknown()),
|
|
846
|
+
reason: z.string().min(1).optional()
|
|
847
|
+
}).strict();
|
|
848
|
+
var juniorToolBoundContinuationSchema = juniorToolContinuationSchema.extend({
|
|
849
|
+
tool_name: z.string().min(1)
|
|
850
|
+
});
|
|
851
|
+
var juniorToolErrorSchema = z.object({
|
|
852
|
+
kind: z.string().min(1),
|
|
853
|
+
message: z.string().min(1),
|
|
854
|
+
retryable: z.boolean().optional()
|
|
855
|
+
}).strict();
|
|
856
|
+
var juniorToolResultSchema = z.object({
|
|
857
|
+
ok: z.boolean(),
|
|
858
|
+
status: z.enum(["success", "error"]),
|
|
859
|
+
target: z.string().min(1).optional(),
|
|
860
|
+
data: z.unknown().optional(),
|
|
861
|
+
truncated: z.boolean().optional(),
|
|
862
|
+
continuation: juniorToolContinuationSchema.optional(),
|
|
863
|
+
error: z.union([juniorToolErrorSchema, z.string()]).optional()
|
|
864
|
+
}).passthrough();
|
|
865
|
+
var juniorToolResultWithBoundContinuationSchema = juniorToolResultSchema.extend({
|
|
866
|
+
continuation: juniorToolBoundContinuationSchema.optional()
|
|
867
|
+
});
|
|
868
|
+
function sortJsonValue(value) {
|
|
869
|
+
if (Array.isArray(value)) {
|
|
870
|
+
return value.map(sortJsonValue);
|
|
871
|
+
}
|
|
872
|
+
if (!value || typeof value !== "object") {
|
|
873
|
+
return value;
|
|
874
|
+
}
|
|
875
|
+
return Object.fromEntries(
|
|
876
|
+
Object.entries(value).filter(([, item]) => item !== void 0).sort(([left], [right]) => left.localeCompare(right)).map(([key, item]) => [key, sortJsonValue(item)])
|
|
877
|
+
);
|
|
878
|
+
}
|
|
879
|
+
function isRecord2(value) {
|
|
880
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
881
|
+
}
|
|
882
|
+
function injectContinuationToolName(details, toolName) {
|
|
883
|
+
const parsed = juniorToolResultSchema.parse(details);
|
|
884
|
+
if (!isRecord2(parsed.continuation)) {
|
|
885
|
+
return parsed;
|
|
886
|
+
}
|
|
887
|
+
return juniorToolResultWithBoundContinuationSchema.parse({
|
|
888
|
+
...parsed,
|
|
889
|
+
continuation: {
|
|
890
|
+
...parsed.continuation,
|
|
891
|
+
tool_name: toolName
|
|
892
|
+
}
|
|
893
|
+
});
|
|
894
|
+
}
|
|
895
|
+
function makeStructuredToolResult(details, options = {}) {
|
|
896
|
+
const parsed = juniorToolResultSchema.parse(details);
|
|
897
|
+
return {
|
|
898
|
+
content: [
|
|
899
|
+
{
|
|
900
|
+
type: "text",
|
|
901
|
+
text: JSON.stringify(sortJsonValue(parsed))
|
|
902
|
+
},
|
|
903
|
+
...options.content ?? []
|
|
904
|
+
],
|
|
905
|
+
details: parsed
|
|
906
|
+
};
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
// src/chat/tool-support/turn-deadline-result.ts
|
|
910
|
+
var TURN_DEADLINE_INTERRUPTION = {
|
|
911
|
+
cause: "turn_deadline",
|
|
912
|
+
scope: "execution_slice",
|
|
913
|
+
task_status: "active"
|
|
914
|
+
};
|
|
915
|
+
function annotateTurnDeadlineToolResult(result) {
|
|
916
|
+
const parsed = juniorToolResultSchema.safeParse(result.details);
|
|
917
|
+
if (!parsed.success) {
|
|
918
|
+
return void 0;
|
|
919
|
+
}
|
|
920
|
+
const error = parsed.data.error;
|
|
921
|
+
if (!error || typeof error !== "object" || error.kind !== "outcome_unknown") {
|
|
922
|
+
return void 0;
|
|
923
|
+
}
|
|
924
|
+
const details = {
|
|
925
|
+
...parsed.data,
|
|
926
|
+
interruption: TURN_DEADLINE_INTERRUPTION,
|
|
927
|
+
error: {
|
|
928
|
+
...error,
|
|
929
|
+
message: "Tool execution was interrupted when the current execution slice reached its internal deadline. The original task remains active, but this tool call's outcome is unknown and may include side effects."
|
|
930
|
+
}
|
|
931
|
+
};
|
|
932
|
+
const envelope = makeStructuredToolResult(details, {
|
|
933
|
+
content: result.content.slice(1)
|
|
934
|
+
});
|
|
935
|
+
return {
|
|
936
|
+
content: envelope.content,
|
|
937
|
+
details: envelope.details,
|
|
938
|
+
isError: true
|
|
939
|
+
};
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
// src/chat/services/turn-router.ts
|
|
943
|
+
import { z as z2 } from "zod";
|
|
844
944
|
var CLASSIFIER_CONFIDENCE_THRESHOLD = 0.75;
|
|
845
945
|
var MAX_ROUTER_CONTEXT_CHARS = 8e3;
|
|
846
946
|
var ROUTER_CONTEXT_HEAD_CHARS = 3e3;
|
|
@@ -866,17 +966,17 @@ function coerceClassifierConfidence(value) {
|
|
|
866
966
|
return CONFIDENCE_LABELS[trimmed] ?? value;
|
|
867
967
|
}
|
|
868
968
|
function createTurnRouteSchema(profiles) {
|
|
869
|
-
return
|
|
870
|
-
reasoning_level:
|
|
969
|
+
return z2.object({
|
|
970
|
+
reasoning_level: z2.enum(TURN_REASONING_LEVELS),
|
|
871
971
|
profile: modelProfileSchema.refine(
|
|
872
972
|
(profile) => Object.hasOwn(profiles, profile),
|
|
873
973
|
"Profile is not configured"
|
|
874
974
|
),
|
|
875
|
-
confidence:
|
|
975
|
+
confidence: z2.preprocess(
|
|
876
976
|
coerceClassifierConfidence,
|
|
877
|
-
|
|
977
|
+
z2.number().min(0).max(1)
|
|
878
978
|
),
|
|
879
|
-
reason:
|
|
979
|
+
reason: z2.string().min(1)
|
|
880
980
|
});
|
|
881
981
|
}
|
|
882
982
|
var CLASSIFIER_FALLBACK_REASONING_LEVEL = "medium";
|
|
@@ -1214,7 +1314,7 @@ function parseMcpProviderFromToolName(toolName) {
|
|
|
1214
1314
|
|
|
1215
1315
|
// src/chat/pi/derived-state.ts
|
|
1216
1316
|
var MCP_BRIDGE_TOOLS = /* @__PURE__ */ new Set(["callMcpTool", "searchMcpTools"]);
|
|
1217
|
-
function
|
|
1317
|
+
function isRecord3(value) {
|
|
1218
1318
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
1219
1319
|
}
|
|
1220
1320
|
function providerFromToolName(value) {
|
|
@@ -1236,7 +1336,7 @@ function addBridgeToolProvider(toolName, value, providers) {
|
|
|
1236
1336
|
if (bridgeTool === "searchMcpTools") {
|
|
1237
1337
|
for (const argsKey of ["input", "args", "arguments", "params"]) {
|
|
1238
1338
|
const args = value[argsKey];
|
|
1239
|
-
if (
|
|
1339
|
+
if (isRecord3(args)) {
|
|
1240
1340
|
addString(providers, args.provider);
|
|
1241
1341
|
}
|
|
1242
1342
|
}
|
|
@@ -1245,7 +1345,7 @@ function addBridgeToolProvider(toolName, value, providers) {
|
|
|
1245
1345
|
if (bridgeTool === "callMcpTool") {
|
|
1246
1346
|
for (const argsKey of ["input", "args", "arguments", "params"]) {
|
|
1247
1347
|
const args = value[argsKey];
|
|
1248
|
-
if (
|
|
1348
|
+
if (isRecord3(args)) {
|
|
1249
1349
|
addString(providers, providerFromToolName(args.tool_name));
|
|
1250
1350
|
}
|
|
1251
1351
|
}
|
|
@@ -1258,18 +1358,18 @@ function addMcpResultProvider(message, providers) {
|
|
|
1258
1358
|
return;
|
|
1259
1359
|
}
|
|
1260
1360
|
if (toolName === "loadSkill") {
|
|
1261
|
-
if (
|
|
1361
|
+
if (isRecord3(message.details)) {
|
|
1262
1362
|
addString(providers, message.details.mcp_provider);
|
|
1263
1363
|
}
|
|
1264
1364
|
addString(providers, message.mcp_provider);
|
|
1265
1365
|
return;
|
|
1266
1366
|
}
|
|
1267
1367
|
if (toolName === "searchMcpTools") {
|
|
1268
|
-
if (
|
|
1368
|
+
if (isRecord3(message.details)) {
|
|
1269
1369
|
addString(providers, message.details.provider);
|
|
1270
1370
|
if (Array.isArray(message.details.tools)) {
|
|
1271
1371
|
for (const tool of message.details.tools) {
|
|
1272
|
-
if (
|
|
1372
|
+
if (isRecord3(tool)) {
|
|
1273
1373
|
addString(providers, providerFromToolName(tool.tool_name));
|
|
1274
1374
|
}
|
|
1275
1375
|
}
|
|
@@ -1281,11 +1381,11 @@ function addMcpResultProvider(message, providers) {
|
|
|
1281
1381
|
if (toolName === "callMcpTool") {
|
|
1282
1382
|
for (const argsKey of ["input", "args", "arguments", "params"]) {
|
|
1283
1383
|
const args = message[argsKey];
|
|
1284
|
-
if (
|
|
1384
|
+
if (isRecord3(args)) {
|
|
1285
1385
|
addString(providers, providerFromToolName(args.tool_name));
|
|
1286
1386
|
}
|
|
1287
1387
|
}
|
|
1288
|
-
if (
|
|
1388
|
+
if (isRecord3(message.details)) {
|
|
1289
1389
|
addString(providers, message.details.provider);
|
|
1290
1390
|
addString(providers, providerFromToolName(message.details.tool_name));
|
|
1291
1391
|
}
|
|
@@ -1293,7 +1393,7 @@ function addMcpResultProvider(message, providers) {
|
|
|
1293
1393
|
}
|
|
1294
1394
|
}
|
|
1295
1395
|
function scanMcpProviders(message, providers) {
|
|
1296
|
-
if (!
|
|
1396
|
+
if (!isRecord3(message)) {
|
|
1297
1397
|
return;
|
|
1298
1398
|
}
|
|
1299
1399
|
if (message.role === "toolResult") {
|
|
@@ -1305,15 +1405,15 @@ function scanMcpProviders(message, providers) {
|
|
|
1305
1405
|
return;
|
|
1306
1406
|
}
|
|
1307
1407
|
for (const part of content) {
|
|
1308
|
-
if (!
|
|
1408
|
+
if (!isRecord3(part)) {
|
|
1309
1409
|
continue;
|
|
1310
1410
|
}
|
|
1311
1411
|
addBridgeToolProvider(getToolName(part), part, providers);
|
|
1312
1412
|
}
|
|
1313
1413
|
}
|
|
1314
1414
|
function scanLoadedSkills(message, skills) {
|
|
1315
|
-
if (
|
|
1316
|
-
if (
|
|
1415
|
+
if (isRecord3(message) && message.role === "toolResult" && message.toolName === "loadSkill" && message.isError !== true) {
|
|
1416
|
+
if (isRecord3(message.details)) {
|
|
1317
1417
|
addString(skills, message.details.skill_name);
|
|
1318
1418
|
}
|
|
1319
1419
|
addString(skills, message.skill_name);
|
|
@@ -3817,73 +3917,6 @@ function serializeMcpPayload(payload, privacy, options = {}) {
|
|
|
3817
3917
|
// src/chat/tools/sandbox/bash.ts
|
|
3818
3918
|
import { z as z4 } from "zod";
|
|
3819
3919
|
|
|
3820
|
-
// src/chat/tool-support/structured-result.ts
|
|
3821
|
-
import { z as z2 } from "zod";
|
|
3822
|
-
var juniorToolContinuationSchema = z2.object({
|
|
3823
|
-
arguments: z2.record(z2.string(), z2.unknown()),
|
|
3824
|
-
reason: z2.string().min(1).optional()
|
|
3825
|
-
}).strict();
|
|
3826
|
-
var juniorToolBoundContinuationSchema = juniorToolContinuationSchema.extend({
|
|
3827
|
-
tool_name: z2.string().min(1)
|
|
3828
|
-
});
|
|
3829
|
-
var juniorToolErrorSchema = z2.object({
|
|
3830
|
-
kind: z2.string().min(1),
|
|
3831
|
-
message: z2.string().min(1),
|
|
3832
|
-
retryable: z2.boolean().optional()
|
|
3833
|
-
}).strict();
|
|
3834
|
-
var juniorToolResultSchema = z2.object({
|
|
3835
|
-
ok: z2.boolean(),
|
|
3836
|
-
status: z2.enum(["success", "error"]),
|
|
3837
|
-
target: z2.string().min(1).optional(),
|
|
3838
|
-
data: z2.unknown().optional(),
|
|
3839
|
-
truncated: z2.boolean().optional(),
|
|
3840
|
-
continuation: juniorToolContinuationSchema.optional(),
|
|
3841
|
-
error: z2.union([juniorToolErrorSchema, z2.string()]).optional()
|
|
3842
|
-
}).passthrough();
|
|
3843
|
-
var juniorToolResultWithBoundContinuationSchema = juniorToolResultSchema.extend({
|
|
3844
|
-
continuation: juniorToolBoundContinuationSchema.optional()
|
|
3845
|
-
});
|
|
3846
|
-
function sortJsonValue(value) {
|
|
3847
|
-
if (Array.isArray(value)) {
|
|
3848
|
-
return value.map(sortJsonValue);
|
|
3849
|
-
}
|
|
3850
|
-
if (!value || typeof value !== "object") {
|
|
3851
|
-
return value;
|
|
3852
|
-
}
|
|
3853
|
-
return Object.fromEntries(
|
|
3854
|
-
Object.entries(value).filter(([, item]) => item !== void 0).sort(([left], [right]) => left.localeCompare(right)).map(([key, item]) => [key, sortJsonValue(item)])
|
|
3855
|
-
);
|
|
3856
|
-
}
|
|
3857
|
-
function isRecord3(value) {
|
|
3858
|
-
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
3859
|
-
}
|
|
3860
|
-
function injectContinuationToolName(details, toolName) {
|
|
3861
|
-
const parsed = juniorToolResultSchema.parse(details);
|
|
3862
|
-
if (!isRecord3(parsed.continuation)) {
|
|
3863
|
-
return parsed;
|
|
3864
|
-
}
|
|
3865
|
-
return juniorToolResultWithBoundContinuationSchema.parse({
|
|
3866
|
-
...parsed,
|
|
3867
|
-
continuation: {
|
|
3868
|
-
...parsed.continuation,
|
|
3869
|
-
tool_name: toolName
|
|
3870
|
-
}
|
|
3871
|
-
});
|
|
3872
|
-
}
|
|
3873
|
-
function makeStructuredToolResult(details, options = {}) {
|
|
3874
|
-
const parsed = juniorToolResultSchema.parse(details);
|
|
3875
|
-
return {
|
|
3876
|
-
content: [
|
|
3877
|
-
{
|
|
3878
|
-
type: "text",
|
|
3879
|
-
text: JSON.stringify(sortJsonValue(parsed))
|
|
3880
|
-
},
|
|
3881
|
-
...options.content ?? []
|
|
3882
|
-
],
|
|
3883
|
-
details: parsed
|
|
3884
|
-
};
|
|
3885
|
-
}
|
|
3886
|
-
|
|
3887
3920
|
// src/chat/tool-support/zod-tool.ts
|
|
3888
3921
|
import { z as z3 } from "zod";
|
|
3889
3922
|
|
|
@@ -5990,6 +6023,17 @@ async function cancelResourceEventSubscription(input) {
|
|
|
5990
6023
|
return next;
|
|
5991
6024
|
});
|
|
5992
6025
|
}
|
|
6026
|
+
async function cancelSubscriptions(input) {
|
|
6027
|
+
const subscriptions = await listResourceEventSubscriptions(input);
|
|
6028
|
+
for (const subscription of subscriptions) {
|
|
6029
|
+
await cancelResourceEventSubscription({
|
|
6030
|
+
conversationId: input.conversationId,
|
|
6031
|
+
id: subscription.id,
|
|
6032
|
+
nowMs: input.nowMs,
|
|
6033
|
+
state: input.state
|
|
6034
|
+
});
|
|
6035
|
+
}
|
|
6036
|
+
}
|
|
5993
6037
|
async function findMatchingResourceEventSubscriptions(input) {
|
|
5994
6038
|
const state = input.state ?? getStateAdapter();
|
|
5995
6039
|
await state.connect();
|
|
@@ -11216,12 +11260,11 @@ function buildSandboxEgressNetworkPolicy(input) {
|
|
|
11216
11260
|
domain,
|
|
11217
11261
|
input?.traceConfig
|
|
11218
11262
|
);
|
|
11219
|
-
|
|
11220
|
-
{
|
|
11221
|
-
|
|
11222
|
-
|
|
11223
|
-
|
|
11224
|
-
];
|
|
11263
|
+
if (policy.forward && forwardURL) {
|
|
11264
|
+
allow[domain] = [{ forwardURL }];
|
|
11265
|
+
} else if (shouldPropagateTrace && hasTraceHeaders) {
|
|
11266
|
+
allow[domain] = [{ transform: [{ headers: traceHeaders }] }];
|
|
11267
|
+
}
|
|
11225
11268
|
}
|
|
11226
11269
|
return { allow };
|
|
11227
11270
|
}
|
|
@@ -15930,6 +15973,7 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy) {
|
|
|
15930
15973
|
}
|
|
15931
15974
|
return void 0;
|
|
15932
15975
|
},
|
|
15976
|
+
afterToolCall: async ({ result: result2 }, signal2) => runResume.timedOut && signal2?.aborted ? annotateTurnDeadlineToolResult(result2) : void 0,
|
|
15933
15977
|
prepareNextTurn: async () => {
|
|
15934
15978
|
const update = applyPendingHandoff();
|
|
15935
15979
|
await drainSteeringMessages();
|
|
@@ -16342,6 +16386,7 @@ export {
|
|
|
16342
16386
|
buildSlackOutputMessage,
|
|
16343
16387
|
buildSteeringPiMessage,
|
|
16344
16388
|
createUserTokenStore,
|
|
16389
|
+
cancelSubscriptions,
|
|
16345
16390
|
findMatchingResourceEventSubscriptions,
|
|
16346
16391
|
deliverResourceEventSubscription,
|
|
16347
16392
|
listThreadReplies,
|
|
@@ -462,16 +462,17 @@ function privacyFromRow(row) {
|
|
|
462
462
|
}
|
|
463
463
|
return row.destination.visibility === "public" ? "public" : "private";
|
|
464
464
|
}
|
|
465
|
-
function actorFromIdentityRow(identity) {
|
|
465
|
+
function actorFromIdentityRow(identity, userDisplayName) {
|
|
466
466
|
if (!identity) {
|
|
467
467
|
return void 0;
|
|
468
468
|
}
|
|
469
469
|
if (identity.provider !== "slack") {
|
|
470
470
|
return void 0;
|
|
471
471
|
}
|
|
472
|
+
const fullName = userDisplayName?.trim() ? userDisplayName : identity.displayName;
|
|
472
473
|
return {
|
|
473
474
|
...identity.emailNormalized ? { email: identity.emailNormalized } : identity.email ? { email: identity.email } : {},
|
|
474
|
-
...
|
|
475
|
+
...fullName ? { fullName } : {},
|
|
475
476
|
platform: "slack",
|
|
476
477
|
slackUserId: identity.providerSubjectId,
|
|
477
478
|
...identity.handle ? { slackUserName: identity.handle } : {},
|
|
@@ -502,7 +503,10 @@ function conversationFromRow(readRow) {
|
|
|
502
503
|
throw new Error("Conversation legacy actor is not migrated");
|
|
503
504
|
}
|
|
504
505
|
const destination = destinationFromRow(readRow.destination);
|
|
505
|
-
const actor = actorFromIdentityRow(
|
|
506
|
+
const actor = actorFromIdentityRow(
|
|
507
|
+
readRow.actorIdentity,
|
|
508
|
+
readRow.actorUserDisplayName
|
|
509
|
+
);
|
|
506
510
|
if (readRow.destination !== null && !destination) {
|
|
507
511
|
throw new Error("Conversation record destination is invalid");
|
|
508
512
|
}
|
|
@@ -769,14 +773,15 @@ var SqlStore = class {
|
|
|
769
773
|
const rows = await this.executor.db().select({
|
|
770
774
|
conversation: juniorConversations,
|
|
771
775
|
destination: juniorDestinations,
|
|
772
|
-
actorIdentity: juniorIdentities
|
|
776
|
+
actorIdentity: juniorIdentities,
|
|
777
|
+
actorUserDisplayName: juniorUsers.displayName
|
|
773
778
|
}).from(juniorConversations).leftJoin(
|
|
774
779
|
juniorDestinations,
|
|
775
780
|
eq2(juniorDestinations.id, juniorConversations.destinationId)
|
|
776
781
|
).leftJoin(
|
|
777
782
|
juniorIdentities,
|
|
778
783
|
eq2(juniorIdentities.id, juniorConversations.actorIdentityId)
|
|
779
|
-
).where(isNull(juniorConversations.parentConversationId)).orderBy(
|
|
784
|
+
).leftJoin(juniorUsers, eq2(juniorUsers.id, juniorIdentities.userId)).where(isNull(juniorConversations.parentConversationId)).orderBy(
|
|
780
785
|
desc(juniorConversations.lastActivityAt),
|
|
781
786
|
asc(juniorConversations.conversationId)
|
|
782
787
|
).limit(Math.max(0, args.limit ?? 1e4)).offset(Math.max(0, args.offset ?? 0));
|
|
@@ -819,14 +824,15 @@ var SqlStore = class {
|
|
|
819
824
|
const rows = await this.executor.db().select({
|
|
820
825
|
conversation: juniorConversations,
|
|
821
826
|
destination: juniorDestinations,
|
|
822
|
-
actorIdentity: juniorIdentities
|
|
827
|
+
actorIdentity: juniorIdentities,
|
|
828
|
+
actorUserDisplayName: juniorUsers.displayName
|
|
823
829
|
}).from(juniorConversations).leftJoin(
|
|
824
830
|
juniorDestinations,
|
|
825
831
|
eq2(juniorDestinations.id, juniorConversations.destinationId)
|
|
826
832
|
).leftJoin(
|
|
827
833
|
juniorIdentities,
|
|
828
834
|
eq2(juniorIdentities.id, juniorConversations.actorIdentityId)
|
|
829
|
-
).where(eq2(juniorConversations.conversationId, conversationId));
|
|
835
|
+
).leftJoin(juniorUsers, eq2(juniorUsers.id, juniorIdentities.userId)).where(eq2(juniorConversations.conversationId, conversationId));
|
|
830
836
|
return rows[0];
|
|
831
837
|
}
|
|
832
838
|
/** Upsert the conversation row while preserving previously discovered nullable metadata fields. */
|
|
@@ -1318,6 +1324,15 @@ function eventFromRow(row) {
|
|
|
1318
1324
|
payload: row.payload
|
|
1319
1325
|
});
|
|
1320
1326
|
}
|
|
1327
|
+
function messagesSummarizedEventFromRow(row) {
|
|
1328
|
+
const event = eventFromRow(row);
|
|
1329
|
+
if (event.schemaVersion !== 1 || event.data.type !== "messages_summarized") {
|
|
1330
|
+
throw new Error(
|
|
1331
|
+
"Message compaction row did not decode as messages_summarized"
|
|
1332
|
+
);
|
|
1333
|
+
}
|
|
1334
|
+
return { ...event, schemaVersion: 1, data: event.data };
|
|
1335
|
+
}
|
|
1321
1336
|
var SqlConversationEventStore = class {
|
|
1322
1337
|
constructor(executor) {
|
|
1323
1338
|
this.executor = executor;
|
|
@@ -1438,8 +1453,8 @@ var SqlConversationEventStore = class {
|
|
|
1438
1453
|
eq3(juniorConversationEvents.type, "messages_summarized")
|
|
1439
1454
|
)
|
|
1440
1455
|
).orderBy(desc2(juniorConversationEvents.seq)).limit(1);
|
|
1441
|
-
const compaction = compactionRow ?
|
|
1442
|
-
const historyFromSeq = compaction?.data.
|
|
1456
|
+
const compaction = compactionRow ? messagesSummarizedEventFromRow(compactionRow) : void 0;
|
|
1457
|
+
const historyFromSeq = compaction?.data.historyFromSeq ?? 0;
|
|
1443
1458
|
const rows = await this.executor.db().select().from(juniorConversationEvents).where(
|
|
1444
1459
|
and3(
|
|
1445
1460
|
eq3(juniorConversationEvents.conversationId, conversationId),
|
|
@@ -1447,7 +1462,7 @@ var SqlConversationEventStore = class {
|
|
|
1447
1462
|
gte(juniorConversationEvents.seq, historyFromSeq)
|
|
1448
1463
|
)
|
|
1449
1464
|
).orderBy(asc2(juniorConversationEvents.seq));
|
|
1450
|
-
return { events: rows.map(eventFromRow), compaction };
|
|
1465
|
+
return { events: rows.map(eventFromRow), compaction, historyFromSeq };
|
|
1451
1466
|
}
|
|
1452
1467
|
async loadHistory(conversationId) {
|
|
1453
1468
|
const rows = await this.executor.db().select().from(juniorConversationEvents).where(eq3(juniorConversationEvents.conversationId, conversationId)).orderBy(asc2(juniorConversationEvents.seq));
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
JUNIOR_THREAD_STATE_TTL_MS
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-J3B3FPP2.js";
|
|
4
4
|
import {
|
|
5
5
|
getDefaultRedisStateAdapterFor,
|
|
6
6
|
getStateAdapter
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-H3QYZL7K.js";
|
|
8
8
|
import {
|
|
9
9
|
getChatConfig
|
|
10
10
|
} from "./chunk-SS67LUOK.js";
|
|
@@ -110,14 +110,15 @@ function normalizeInput(value) {
|
|
|
110
110
|
if (!isRecord(value)) {
|
|
111
111
|
return void 0;
|
|
112
112
|
}
|
|
113
|
-
const text =
|
|
114
|
-
|
|
113
|
+
const text = typeof value.text === "string" ? value.text : void 0;
|
|
114
|
+
const attachments = Array.isArray(value.attachments) ? [...value.attachments] : void 0;
|
|
115
|
+
if (text === void 0 || !text.trim() && !attachments?.length) {
|
|
115
116
|
return void 0;
|
|
116
117
|
}
|
|
117
118
|
return {
|
|
118
119
|
text,
|
|
119
120
|
authorId: toOptionalString(value.authorId),
|
|
120
|
-
attachments
|
|
121
|
+
attachments,
|
|
121
122
|
metadata: normalizeMetadata(value.metadata)
|
|
122
123
|
};
|
|
123
124
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createPluginLogger,
|
|
3
3
|
createPluginState
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-AHJR2IFF.js";
|
|
5
5
|
import {
|
|
6
6
|
SANDBOX_WORKSPACE_ROOT
|
|
7
7
|
} from "./chunk-G3E7SCME.js";
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "./chunk-VH6KWKG2.js";
|
|
14
14
|
import {
|
|
15
15
|
getDb
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-TE4QHJH4.js";
|
|
17
17
|
import {
|
|
18
18
|
botConfig,
|
|
19
19
|
completeObject,
|
package/dist/cli/chat.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createAgentRunner,
|
|
3
3
|
executeAgentRun
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-KPMPQ6AA.js";
|
|
5
|
+
import "../chunk-3RGQLX2F.js";
|
|
6
|
+
import "../chunk-J3B3FPP2.js";
|
|
7
|
+
import "../chunk-B5I5LMSP.js";
|
|
8
8
|
import "../chunk-MU6HHZEN.js";
|
|
9
9
|
import "../chunk-PDO5BLNM.js";
|
|
10
10
|
import "../chunk-UIE3R5XU.js";
|
|
11
11
|
import {
|
|
12
12
|
loadAppPluginSet
|
|
13
13
|
} from "../chunk-Y2CM7HXH.js";
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-
|
|
14
|
+
import "../chunk-UD6THJ2I.js";
|
|
15
|
+
import "../chunk-AHJR2IFF.js";
|
|
16
16
|
import "../chunk-G3E7SCME.js";
|
|
17
|
-
import "../chunk-
|
|
17
|
+
import "../chunk-H3QYZL7K.js";
|
|
18
18
|
import "../chunk-VH6KWKG2.js";
|
|
19
|
-
import "../chunk-
|
|
19
|
+
import "../chunk-TE4QHJH4.js";
|
|
20
20
|
import "../chunk-4ZNGQH7C.js";
|
|
21
21
|
import "../chunk-SS67LUOK.js";
|
|
22
22
|
import "../chunk-VFUK3X5B.js";
|
|
@@ -153,10 +153,10 @@ async function configureLocalChatPlugins(pluginSet) {
|
|
|
153
153
|
databaseModule
|
|
154
154
|
] = await Promise.all([
|
|
155
155
|
import("../plugins-PZMDS7AT.js"),
|
|
156
|
-
import("../agent-hooks-
|
|
156
|
+
import("../agent-hooks-NU5HK3PS.js"),
|
|
157
157
|
import("../catalog-runtime-FOFNPR3P.js"),
|
|
158
158
|
import("../validation-AGQ46ZGV.js"),
|
|
159
|
-
import("../db-
|
|
159
|
+
import("../db-AMRBAT5D.js")
|
|
160
160
|
]);
|
|
161
161
|
const resolvedPluginSet = pluginSet === void 0 ? await loadLocalPluginSet() : pluginSet ?? void 0;
|
|
162
162
|
const plugins = pluginsModule.pluginRuntimeRegistrationsFromPluginSet(resolvedPluginSet);
|
|
@@ -217,7 +217,7 @@ function newRunConversationId() {
|
|
|
217
217
|
async function prepareLocalChatRun(io, pluginSet) {
|
|
218
218
|
defaultStateAdapterForLocalChat();
|
|
219
219
|
await configureLocalChatPlugins(pluginSet);
|
|
220
|
-
const { runLocalAgentTurn } = await import("../runner-
|
|
220
|
+
const { runLocalAgentTurn } = await import("../runner-TQH5GAJ4.js");
|
|
221
221
|
const deps = {
|
|
222
222
|
agentRunner: createAgentRunner(executeAgentRun),
|
|
223
223
|
deliverReply: async (reply) => {
|
package/dist/cli/plugins.js
CHANGED
|
@@ -13,16 +13,16 @@ import {
|
|
|
13
13
|
import {
|
|
14
14
|
setPlugins,
|
|
15
15
|
validatePlugins
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-UD6THJ2I.js";
|
|
17
17
|
import {
|
|
18
18
|
createPluginLogger
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-AHJR2IFF.js";
|
|
20
20
|
import "../chunk-G3E7SCME.js";
|
|
21
|
-
import "../chunk-
|
|
21
|
+
import "../chunk-H3QYZL7K.js";
|
|
22
22
|
import "../chunk-VH6KWKG2.js";
|
|
23
23
|
import {
|
|
24
24
|
getDb
|
|
25
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-TE4QHJH4.js";
|
|
26
26
|
import "../chunk-4ZNGQH7C.js";
|
|
27
27
|
import "../chunk-SS67LUOK.js";
|
|
28
28
|
import "../chunk-VFUK3X5B.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
GLOBAL_RUNTIME_DEPENDENCIES,
|
|
3
3
|
resolveRuntimeDependencySnapshot
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-B5I5LMSP.js";
|
|
5
5
|
import "../chunk-G3E7SCME.js";
|
|
6
6
|
import {
|
|
7
7
|
disconnectStateAdapter
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-H3QYZL7K.js";
|
|
9
9
|
import "../chunk-4ZNGQH7C.js";
|
|
10
10
|
import "../chunk-SS67LUOK.js";
|
|
11
11
|
import "../chunk-RT5BUHR5.js";
|