@sentry/junior 0.140.0 → 0.142.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-BFTDRFUO.js → agent-hooks-WDJQQAPH.js} +10 -10
- package/dist/api/conversations/detail.d.ts +1 -0
- package/dist/api/conversations/event-list.d.ts +1 -0
- package/dist/api/schema/conversation.d.ts +4 -0
- package/dist/api/schema/task.d.ts +8 -0
- package/dist/api/schema.js +1 -1
- package/dist/api.js +35 -23
- package/dist/app.js +63 -92
- package/dist/{catalog-runtime-RK664S5T.js → catalog-runtime-CLHTYBHB.js} +5 -5
- package/dist/chat/agent/repository-context.d.ts +1 -0
- package/dist/chat/conversations/history.d.ts +2 -0
- package/dist/chat/conversations/projection.d.ts +8 -0
- package/dist/chat/conversations/store.d.ts +5 -0
- package/dist/chat/conversations/structured-events.d.ts +11 -0
- package/dist/chat/event-tasks/types.d.ts +7 -1
- package/dist/chat/runtime/thread-state.d.ts +3 -1
- package/dist/chat/runtime/turn.d.ts +0 -4
- package/dist/chat/scheduled-tasks/tools/create.d.ts +1 -0
- package/dist/chat/scheduled-tasks/types.d.ts +5 -0
- package/dist/chat/services/conversation-memory.d.ts +2 -1
- package/dist/chat/services/guardian-action-policy.d.ts +1 -1
- package/dist/chat/services/short-title.d.ts +25 -0
- package/dist/chat/state/conversation.d.ts +6 -17
- package/dist/chat/state/turn-session.d.ts +3 -4
- package/dist/chat/tools/create-event-task.d.ts +1 -0
- package/dist/{chunk-MYVCHWDG.js → chunk-4EZV6URQ.js} +107 -37
- package/dist/{chunk-557HLSNH.js → chunk-4L7PKEHM.js} +5 -1
- package/dist/{chunk-WTGLUX4K.js → chunk-5ITSZIAP.js} +1 -1
- package/dist/{chunk-3CUBAGA3.js → chunk-5QVVW3FY.js} +7 -7
- package/dist/{chunk-XX2QNQN4.js → chunk-6IMKBHCG.js} +81 -47
- package/dist/{chunk-3B7O3GNU.js → chunk-7R3CGEMF.js} +3 -3
- package/dist/{chunk-S3FAOKQU.js → chunk-A646AKNB.js} +29 -29
- package/dist/{chunk-BMFRFSTM.js → chunk-B2H7NI5C.js} +165 -535
- package/dist/{chunk-AA2EPMUF.js → chunk-CA4WLRA3.js} +4 -4
- package/dist/{chunk-D3X2PI3D.js → chunk-CBMIVCPM.js} +2 -2
- package/dist/chunk-DRTWANQF.js +67 -0
- package/dist/{chunk-CDQ4YIZM.js → chunk-HLXXQI5Q.js} +55 -1
- package/dist/{chunk-TKTZ4L4Z.js → chunk-HVTWCMDS.js} +1 -1
- package/dist/{chunk-CPPTBHQN.js → chunk-JIWZ7T4C.js} +1 -1
- package/dist/{chunk-UXMRN2ZX.js → chunk-LGY7YX5O.js} +1 -1
- package/dist/{chunk-YB363QGA.js → chunk-LL3BGP7J.js} +1 -1
- package/dist/{chunk-TGIKZJ3Y.js → chunk-LXLBYA6N.js} +2 -2
- package/dist/{chunk-XROWZSOY.js → chunk-N3H7G5K6.js} +1 -1
- package/dist/{chunk-J5H65GY2.js → chunk-NWO5IB7V.js} +1 -1
- package/dist/{chunk-YWM6MJT4.js → chunk-OGQGJAD7.js} +2 -0
- package/dist/{chunk-VRDHAITB.js → chunk-OQAPYAXH.js} +3 -3
- package/dist/{chunk-4PIT6O7A.js → chunk-PWDCFIQG.js} +6 -6
- package/dist/{chunk-OGNL2QY7.js → chunk-QDRMQI5W.js} +4 -4
- package/dist/{chunk-5KAZMR5U.js → chunk-R7E476CH.js} +6 -6
- package/dist/{chunk-HEFBGCCU.js → chunk-RYYBUI34.js} +2 -2
- package/dist/{chunk-WSWM6A3R.js → chunk-SCHH6264.js} +19 -3
- package/dist/{chunk-I3OZR3HG.js → chunk-SF6YKONJ.js} +1 -1
- package/dist/{chunk-DMDOKRPC.js → chunk-T4NFQ5SG.js} +5 -5
- package/dist/{chunk-5YAWB2AX.js → chunk-VJMBLWYR.js} +15 -17
- package/dist/{chunk-A6BI25J3.js → chunk-WJEW7UNC.js} +341 -16
- package/dist/{chunk-N2I7W2VS.js → chunk-WYLSMTWU.js} +1 -1
- package/dist/{chunk-NPL66ZWL.js → chunk-XAW6IN6M.js} +1 -1
- package/dist/chunk-XFHSZNOX.js +75 -0
- package/dist/{chunk-Z2A7BDHT.js → chunk-ZPNUI4L3.js} +23 -26
- package/dist/cli/chat.js +33 -31
- 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/schema/event-tasks.d.ts +20 -52
- package/dist/db/schema/scheduled-tasks.d.ts +17 -0
- package/dist/db/schema.d.ts +36 -52
- package/dist/{db-QOGYDDQM.js → db-6N4CD5AI.js} +7 -7
- package/dist/instrumentation.js +4 -4
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-CT4RMGCP.js → oauth-callback-server-G4K2X56R.js} +24 -22
- package/dist/{runner-PHMLHNLX.js → runner-DEIHVRUE.js} +25 -26
- package/dist/{skills-AYRM4QGF.js → skills-FZVJ6ZFW.js} +6 -6
- package/dist/spawn-WD4F67SZ.js +38 -0
- package/dist/{validation-M5JNGRGL.js → validation-EOLSG7B6.js} +6 -6
- package/dist/version.js +1 -1
- package/dist/{work-LZWE6HK4.js → work-AS3IBMLA.js} +17 -17
- package/dist/{worker-KOGPXFYK.js → worker-VGGNGOUU.js} +10 -10
- package/migrations/0023_task_title_columns.sql +2 -0
- package/migrations/meta/0023_snapshot.json +2198 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +4 -4
- package/dist/spawn-OGRQFUNK.js +0 -38
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
getConversationStore,
|
|
6
6
|
parseDestination,
|
|
7
7
|
sameDestination
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-SCHH6264.js";
|
|
9
9
|
import {
|
|
10
10
|
getDefaultRedisStateAdapterFor,
|
|
11
11
|
getStateAdapter
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-NWO5IB7V.js";
|
|
13
13
|
import {
|
|
14
14
|
getChatConfig
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-A646AKNB.js";
|
|
16
16
|
import {
|
|
17
17
|
parseStoredSlackActor
|
|
18
18
|
} from "./chunk-HZF5P5UN.js";
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
isRecord,
|
|
21
21
|
toOptionalNumber,
|
|
22
22
|
toOptionalString
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-XAW6IN6M.js";
|
|
24
24
|
|
|
25
25
|
// src/chat/task-execution/state.ts
|
|
26
26
|
import { randomUUID } from "crypto";
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {
|
|
2
|
+
botConfig,
|
|
3
|
+
resolveGatewayModel
|
|
4
|
+
} from "./chunk-A646AKNB.js";
|
|
5
|
+
|
|
6
|
+
// src/chat/services/context-budget.ts
|
|
7
|
+
var COMPACTION_TRIGGER_RATIO = 0.9;
|
|
8
|
+
var CONTEXT_INPUT_LIMIT_RATIO = 0.95;
|
|
9
|
+
var COMPACTION_TARGET_RATIO = 0.8;
|
|
10
|
+
var FALLBACK_CONTEXT_WINDOW_TOKENS = 4e5;
|
|
11
|
+
function positiveInteger(value, fallback) {
|
|
12
|
+
return Number.isFinite(value) && value > 0 ? Math.floor(value) : fallback;
|
|
13
|
+
}
|
|
14
|
+
function estimateTextTokens(text) {
|
|
15
|
+
return Math.ceil(text.length / 4);
|
|
16
|
+
}
|
|
17
|
+
function calculateContextCompactionTriggerTokens(model) {
|
|
18
|
+
const contextWindow = positiveInteger(
|
|
19
|
+
model.contextWindow,
|
|
20
|
+
FALLBACK_CONTEXT_WINDOW_TOKENS
|
|
21
|
+
);
|
|
22
|
+
return Math.max(1, Math.floor(contextWindow * COMPACTION_TRIGGER_RATIO));
|
|
23
|
+
}
|
|
24
|
+
function calculateContextInputLimitTokens(model) {
|
|
25
|
+
const contextWindow = positiveInteger(
|
|
26
|
+
model.contextWindow,
|
|
27
|
+
FALLBACK_CONTEXT_WINDOW_TOKENS
|
|
28
|
+
);
|
|
29
|
+
return Math.max(1, Math.floor(contextWindow * CONTEXT_INPUT_LIMIT_RATIO));
|
|
30
|
+
}
|
|
31
|
+
function calculateContextCompactionTargetTokens(triggerTokens) {
|
|
32
|
+
return Math.max(1, Math.floor(triggerTokens * COMPACTION_TARGET_RATIO));
|
|
33
|
+
}
|
|
34
|
+
function getModelContextBudget(modelId) {
|
|
35
|
+
const model = resolveGatewayModel(modelId);
|
|
36
|
+
const advertisedContextWindow = positiveInteger(
|
|
37
|
+
model.contextWindow,
|
|
38
|
+
FALLBACK_CONTEXT_WINDOW_TOKENS
|
|
39
|
+
);
|
|
40
|
+
return {
|
|
41
|
+
contextWindow: Math.min(
|
|
42
|
+
botConfig.contextWindowTokens,
|
|
43
|
+
advertisedContextWindow
|
|
44
|
+
)
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function getAgentContextCompactionTriggerTokens(modelId) {
|
|
48
|
+
return calculateContextCompactionTriggerTokens(
|
|
49
|
+
getModelContextBudget(modelId)
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
function getAgentContextInputLimitTokens(modelId) {
|
|
53
|
+
return calculateContextInputLimitTokens(getModelContextBudget(modelId));
|
|
54
|
+
}
|
|
55
|
+
function getConversationContextCompactionTriggerTokens() {
|
|
56
|
+
return calculateContextCompactionTriggerTokens(
|
|
57
|
+
getModelContextBudget(botConfig.fastModelId)
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export {
|
|
62
|
+
estimateTextTokens,
|
|
63
|
+
calculateContextCompactionTargetTokens,
|
|
64
|
+
getAgentContextCompactionTriggerTokens,
|
|
65
|
+
getAgentContextInputLimitTokens,
|
|
66
|
+
getConversationContextCompactionTriggerTokens
|
|
67
|
+
};
|
|
@@ -16,9 +16,41 @@ var authenticationEventContentSchema = z.object({
|
|
|
16
16
|
provider: z.string().regex(/^[a-z][a-z0-9-]*$/),
|
|
17
17
|
providerLabel: z.string().trim().min(1).max(80).optional()
|
|
18
18
|
}).strict();
|
|
19
|
+
var agentsInstructionsUpdatedContentSchema = z.object({
|
|
20
|
+
action: z.enum(["loaded", "replaced", "cleared"]),
|
|
21
|
+
directory: z.string().trim().min(1).max(500).optional(),
|
|
22
|
+
fingerprint: z.string().trim().min(1).max(128),
|
|
23
|
+
sources: z.array(
|
|
24
|
+
z.object({
|
|
25
|
+
content: z.string().min(1).max(32 * 1024),
|
|
26
|
+
path: z.string().trim().min(1).max(500)
|
|
27
|
+
}).strict()
|
|
28
|
+
).max(32),
|
|
29
|
+
textBytes: z.number().int().nonnegative().optional()
|
|
30
|
+
}).strict();
|
|
19
31
|
function providerTitle(content) {
|
|
20
32
|
return content.providerLabel?.trim() || content.provider;
|
|
21
33
|
}
|
|
34
|
+
function agentsInstructionsTitle(action) {
|
|
35
|
+
if (action === "loaded") return "Loaded AGENTS.md";
|
|
36
|
+
if (action === "replaced") return "Updated AGENTS.md";
|
|
37
|
+
return "Cleared AGENTS.md";
|
|
38
|
+
}
|
|
39
|
+
function sourceFilename(sourcePath) {
|
|
40
|
+
return sourcePath.split("/").at(-1) || sourcePath;
|
|
41
|
+
}
|
|
42
|
+
function formatBytes(bytes) {
|
|
43
|
+
if (bytes < 1024) return `${bytes} bytes`;
|
|
44
|
+
const kilobytes = bytes / 1024;
|
|
45
|
+
return `${Number.isInteger(kilobytes) ? kilobytes : kilobytes.toFixed(1)} KB`;
|
|
46
|
+
}
|
|
47
|
+
function agentsInstructionsPreview(content) {
|
|
48
|
+
const source = content.sources[0];
|
|
49
|
+
if (!source) return void 0;
|
|
50
|
+
const filename = sourceFilename(source.path);
|
|
51
|
+
const label = content.sources.length === 1 ? filename : `${content.sources.length} AGENTS.md files`;
|
|
52
|
+
return typeof content.textBytes === "number" ? `${label} \xB7 ${formatBytes(content.textBytes)}` : label;
|
|
53
|
+
}
|
|
22
54
|
var authenticationLinkedEvent = defineConversationEvent({
|
|
23
55
|
name: "authentication_linked",
|
|
24
56
|
version: 1,
|
|
@@ -57,9 +89,30 @@ var authenticationUnlinkedEvent = defineConversationEvent({
|
|
|
57
89
|
};
|
|
58
90
|
}
|
|
59
91
|
});
|
|
92
|
+
var agentsInstructionsUpdatedEvent = defineConversationEvent({
|
|
93
|
+
name: "agents_instructions_updated",
|
|
94
|
+
version: 1,
|
|
95
|
+
schema: agentsInstructionsUpdatedContentSchema,
|
|
96
|
+
renderEvent(event) {
|
|
97
|
+
const title = agentsInstructionsTitle(event.action);
|
|
98
|
+
const preview = agentsInstructionsPreview(event);
|
|
99
|
+
return {
|
|
100
|
+
icon: "brain",
|
|
101
|
+
title,
|
|
102
|
+
...preview ? { preview } : {},
|
|
103
|
+
...event.sources.length > 0 ? {
|
|
104
|
+
details: event.sources.map((source) => ({
|
|
105
|
+
title: sourceFilename(source.path),
|
|
106
|
+
content: source.content
|
|
107
|
+
}))
|
|
108
|
+
} : {}
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
});
|
|
60
112
|
var NATIVE_EVENT_DEFINITIONS = [
|
|
61
113
|
authenticationLinkedEvent,
|
|
62
|
-
authenticationUnlinkedEvent
|
|
114
|
+
authenticationUnlinkedEvent,
|
|
115
|
+
agentsInstructionsUpdatedEvent
|
|
63
116
|
];
|
|
64
117
|
function getJuniorNativeEventDefinition(args) {
|
|
65
118
|
return NATIVE_EVENT_DEFINITIONS.find(
|
|
@@ -176,6 +229,7 @@ export {
|
|
|
176
229
|
JUNIOR_NATIVE_EVENT_NAMESPACE,
|
|
177
230
|
authenticationLinkedEvent,
|
|
178
231
|
authenticationUnlinkedEvent,
|
|
232
|
+
agentsInstructionsUpdatedEvent,
|
|
179
233
|
renderJuniorNativeConversationEvent,
|
|
180
234
|
ToolInputError,
|
|
181
235
|
agentTurnUsageSchema,
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
} from "./chunk-UTL3MHPC.js";
|
|
4
4
|
import {
|
|
5
5
|
parseSlackThreadId
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-5ITSZIAP.js";
|
|
7
7
|
import {
|
|
8
8
|
normalizeSlackConversationId
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-RYYBUI34.js";
|
|
10
10
|
|
|
11
11
|
// src/handlers/health.ts
|
|
12
12
|
function readHealthReport() {
|
|
@@ -609,6 +609,8 @@ var taskSummaryBaseSchema = z7.object({
|
|
|
609
609
|
lastRunAt: z7.string().datetime().optional(),
|
|
610
610
|
ownedByViewer: z7.boolean(),
|
|
611
611
|
runsLast7Days: z7.number().int().nonnegative(),
|
|
612
|
+
/** Short display title; falls back from instruction when unset. */
|
|
613
|
+
title: z7.string().min(1),
|
|
612
614
|
totalRuns: z7.number().int().nonnegative()
|
|
613
615
|
});
|
|
614
616
|
var scheduledTaskSummarySchema = taskSummaryBaseSchema.extend({
|
|
@@ -18,20 +18,20 @@ import {
|
|
|
18
18
|
releaseConversationWork,
|
|
19
19
|
requestConversationContinuation,
|
|
20
20
|
startConversationWork
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-CA4WLRA3.js";
|
|
22
22
|
import {
|
|
23
23
|
ConversationQueueMessageRejectedError
|
|
24
24
|
} from "./chunk-IUFM5JWV.js";
|
|
25
25
|
import {
|
|
26
26
|
getChatConfig,
|
|
27
27
|
isProviderRetryError
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-A646AKNB.js";
|
|
29
29
|
import {
|
|
30
30
|
logException,
|
|
31
31
|
logInfo,
|
|
32
32
|
logWarn,
|
|
33
33
|
withLogContext
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-XAW6IN6M.js";
|
|
35
35
|
|
|
36
36
|
// src/chat/task-execution/worker.ts
|
|
37
37
|
var CONVERSATION_WORK_DEFER_DELAY_MS = 15e3;
|
|
@@ -4,30 +4,30 @@ import {
|
|
|
4
4
|
isConversationScopedChannel,
|
|
5
5
|
isDmChannel,
|
|
6
6
|
normalizeSlackConversationId
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-RYYBUI34.js";
|
|
8
8
|
import {
|
|
9
9
|
getConversationEventStore,
|
|
10
10
|
getDb
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-SCHH6264.js";
|
|
12
12
|
import {
|
|
13
13
|
juniorConversationAnnotations,
|
|
14
14
|
juniorConversationEvents,
|
|
15
15
|
juniorIdentities,
|
|
16
16
|
juniorUsers
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-4L7PKEHM.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-NWO5IB7V.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-A646AKNB.js";
|
|
31
31
|
import {
|
|
32
32
|
isActorUserId,
|
|
33
33
|
parseActorUserId
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
logInfo,
|
|
43
43
|
logWarn,
|
|
44
44
|
normalizeIdentityEmail
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-XAW6IN6M.js";
|
|
46
46
|
|
|
47
47
|
// src/chat/plugins/agent-hooks.ts
|
|
48
48
|
import {
|
|
@@ -4,18 +4,18 @@ import {
|
|
|
4
4
|
} from "./chunk-EM225ITJ.js";
|
|
5
5
|
import {
|
|
6
6
|
getStateAdapter
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-NWO5IB7V.js";
|
|
8
8
|
import {
|
|
9
9
|
toOptionalTrimmed
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-A646AKNB.js";
|
|
11
11
|
import {
|
|
12
12
|
pluginCatalogRuntime
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-WYLSMTWU.js";
|
|
14
14
|
import {
|
|
15
15
|
setSpanAttributes,
|
|
16
16
|
setSpanStatus,
|
|
17
17
|
withSpan
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-XAW6IN6M.js";
|
|
19
19
|
|
|
20
20
|
// src/chat/sandbox/resources.ts
|
|
21
21
|
var configuredResources;
|
|
@@ -4,19 +4,19 @@ import {
|
|
|
4
4
|
isDmChannel,
|
|
5
5
|
normalizeSlackConversationId,
|
|
6
6
|
withSlackRetries
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-RYYBUI34.js";
|
|
8
8
|
import {
|
|
9
9
|
parseDestination
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-SCHH6264.js";
|
|
11
11
|
import {
|
|
12
12
|
getStateAdapter
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-NWO5IB7V.js";
|
|
14
14
|
import {
|
|
15
15
|
normalizeSlackEmojiName
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-A646AKNB.js";
|
|
17
17
|
import {
|
|
18
18
|
pluginCatalogRuntime
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-WYLSMTWU.js";
|
|
20
20
|
import {
|
|
21
21
|
parseSlackMessageTs,
|
|
22
22
|
parseSlackUserId
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
isRecord,
|
|
26
26
|
logInfo,
|
|
27
27
|
logWarn
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-XAW6IN6M.js";
|
|
29
29
|
|
|
30
30
|
// src/chat/slack/outbound.ts
|
|
31
31
|
var MAX_SLACK_MESSAGE_TEXT_CHARS = 4e4;
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-EM225ITJ.js";
|
|
4
4
|
import {
|
|
5
5
|
getSlackBotToken
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-A646AKNB.js";
|
|
7
7
|
import {
|
|
8
8
|
parseSlackChannelReferenceId
|
|
9
9
|
} from "./chunk-F3B2YJ76.js";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
setSpanAttributes,
|
|
13
13
|
setSpanStatus,
|
|
14
14
|
withSpan
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-XAW6IN6M.js";
|
|
16
16
|
|
|
17
17
|
// src/chat/slack/client.ts
|
|
18
18
|
import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
|
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
juniorConversations,
|
|
6
6
|
juniorIdentities,
|
|
7
7
|
juniorUsers
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-4L7PKEHM.js";
|
|
9
9
|
import {
|
|
10
10
|
TURN_REASONING_LEVELS,
|
|
11
11
|
getChatConfig,
|
|
12
12
|
modelProfileSchema
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-A646AKNB.js";
|
|
14
14
|
import {
|
|
15
15
|
juniorDestinations
|
|
16
16
|
} from "./chunk-VFUK3X5B.js";
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
} from "./chunk-F3B2YJ76.js";
|
|
21
21
|
import {
|
|
22
22
|
normalizeIdentityEmail
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-XAW6IN6M.js";
|
|
24
24
|
|
|
25
25
|
// src/chat/conversations/sql/store.ts
|
|
26
26
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
@@ -452,6 +452,11 @@ function conversationFromRow(readRow) {
|
|
|
452
452
|
lastActivityAtMs: requiredMsFromDate(row.lastActivityAt),
|
|
453
453
|
updatedAtMs: requiredMsFromDate(row.updatedAt),
|
|
454
454
|
execution,
|
|
455
|
+
executionMetrics: {
|
|
456
|
+
durationMs: row.executionDurationMs,
|
|
457
|
+
...row.metricRunId ? { runId: row.metricRunId } : {},
|
|
458
|
+
...row.executionUsage ? { usage: row.executionUsage } : {}
|
|
459
|
+
},
|
|
455
460
|
...row.parentConversationId ? {
|
|
456
461
|
lineage: {
|
|
457
462
|
parentConversationId: row.parentConversationId
|
|
@@ -1479,6 +1484,17 @@ var SqlConversationEventStore = class {
|
|
|
1479
1484
|
).orderBy(asc2(juniorConversationEvents.seq));
|
|
1480
1485
|
return rows.map(eventFromRow);
|
|
1481
1486
|
}
|
|
1487
|
+
async loadLatestStructuredEvent(conversationId, namespace, name) {
|
|
1488
|
+
const [row] = await this.executor.db().select().from(juniorConversationEvents).where(
|
|
1489
|
+
and4(
|
|
1490
|
+
eq4(juniorConversationEvents.conversationId, conversationId),
|
|
1491
|
+
eq4(juniorConversationEvents.type, "structured_event"),
|
|
1492
|
+
sql4`${juniorConversationEvents.payload}->>'namespace' = ${namespace}`,
|
|
1493
|
+
sql4`${juniorConversationEvents.payload}->>'name' = ${name}`
|
|
1494
|
+
)
|
|
1495
|
+
).orderBy(desc2(juniorConversationEvents.seq)).limit(1);
|
|
1496
|
+
return row ? eventFromRow(row) : void 0;
|
|
1497
|
+
}
|
|
1482
1498
|
async loadLatestInstruction(conversationId) {
|
|
1483
1499
|
const [row] = await this.executor.db().select().from(juniorConversationEvents).where(
|
|
1484
1500
|
and4(
|
|
@@ -4,24 +4,24 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
formatProviderLabel,
|
|
6
6
|
startOAuthFlow
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-R7E476CH.js";
|
|
8
8
|
import {
|
|
9
9
|
abandonReplacedPendingAuth,
|
|
10
10
|
canReusePendingAuthLink,
|
|
11
11
|
recordAuthorizationRequested
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-B2H7NI5C.js";
|
|
13
13
|
import {
|
|
14
14
|
parseSandboxEgressAuthRequiredSignal
|
|
15
15
|
} from "./chunk-HUO3UTAQ.js";
|
|
16
16
|
import {
|
|
17
17
|
AGENT_INVOCATION_MAILBOX_STATUSES
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-4L7PKEHM.js";
|
|
19
19
|
import {
|
|
20
20
|
TURN_REASONING_LEVELS
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-A646AKNB.js";
|
|
22
22
|
import {
|
|
23
23
|
pluginCatalogRuntime
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-WYLSMTWU.js";
|
|
25
25
|
import {
|
|
26
26
|
credentialContextSchema
|
|
27
27
|
} from "./chunk-RUIXF3YQ.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
appendAndEnqueueInboundMessage
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CA4WLRA3.js";
|
|
4
4
|
import {
|
|
5
5
|
ConversationTurnLifecycleService
|
|
6
6
|
} from "./chunk-Q6QZTTLS.js";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
agentBindingSchema,
|
|
13
13
|
agentInvocationSchema,
|
|
14
14
|
createAgentInvocationSchema
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-T4NFQ5SG.js";
|
|
16
16
|
import {
|
|
17
17
|
TurnInputCommitLostError,
|
|
18
18
|
coerceThreadArtifactsState,
|
|
@@ -28,16 +28,20 @@ import {
|
|
|
28
28
|
persistCompletedSessionRecord,
|
|
29
29
|
persistThreadStateById,
|
|
30
30
|
persistYieldSessionRecord
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-B2H7NI5C.js";
|
|
32
32
|
import {
|
|
33
33
|
getConversationEventStore,
|
|
34
34
|
getConversationStore,
|
|
35
35
|
getSqlExecutor
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-SCHH6264.js";
|
|
37
37
|
import {
|
|
38
38
|
juniorAgentBindings,
|
|
39
39
|
juniorAgentInvocations
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-4L7PKEHM.js";
|
|
41
|
+
import {
|
|
42
|
+
botConfig,
|
|
43
|
+
modelIdForProfile
|
|
44
|
+
} from "./chunk-A646AKNB.js";
|
|
41
45
|
|
|
42
46
|
// src/chat/agent-invocations/work.ts
|
|
43
47
|
import { z } from "zod";
|
|
@@ -427,24 +431,18 @@ async function recoverRunningSession(invocation) {
|
|
|
427
431
|
if (!session || session.state !== "running") {
|
|
428
432
|
return;
|
|
429
433
|
}
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
expectedVersion: session.version,
|
|
434
|
-
sessionId: session.sessionId,
|
|
435
|
-
errorMessage: `Running agent invocation session is missing its model for ${invocation.invocationId}`
|
|
436
|
-
});
|
|
437
|
-
return;
|
|
438
|
-
}
|
|
434
|
+
const projection = await openConversationProjection({
|
|
435
|
+
conversationId: invocation.childConversationId
|
|
436
|
+
});
|
|
439
437
|
const parked = await persistYieldSessionRecord({
|
|
440
438
|
conversationId: invocation.childConversationId,
|
|
441
439
|
currentSliceId: session.sliceId,
|
|
442
440
|
errorMessage: "Recovered running agent invocation after worker loss",
|
|
443
441
|
messages: session.piMessages,
|
|
444
|
-
modelId:
|
|
445
|
-
// Execution actor
|
|
442
|
+
modelId: modelIdForProfile(botConfig, projection.modelProfile),
|
|
443
|
+
// Execution actor and reasoning live on the parent invocation, not Redis.
|
|
446
444
|
actor: invocation.actor,
|
|
447
|
-
reasoningLevel:
|
|
445
|
+
reasoningLevel: invocation.reasoningLevel,
|
|
448
446
|
sessionId: session.sessionId,
|
|
449
447
|
surface: session.surface
|
|
450
448
|
});
|