@sentry/junior 0.138.0 → 0.140.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-SCR74Q3E.js → agent-hooks-BFTDRFUO.js} +10 -10
- package/dist/api/schema/task.d.ts +104 -1
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +9 -1
- package/dist/api.js +198 -54
- package/dist/app.js +374 -607
- package/dist/{catalog-runtime-IU3QF4GG.js → catalog-runtime-RK664S5T.js} +6 -6
- package/dist/chat/agent/request.d.ts +12 -2
- package/dist/chat/credentials/context.d.ts +14 -0
- package/dist/chat/resource-events/actor.d.ts +23 -0
- package/dist/chat/scheduled-tasks/telemetry.d.ts +7 -0
- package/dist/chat/scheduled-tasks/tool-support.d.ts +10 -2
- package/dist/chat/scheduled-tasks/tools/create.d.ts +4 -2
- package/dist/chat/scheduled-tasks/tools/delete.d.ts +4 -2
- package/dist/chat/scheduled-tasks/tools/list.d.ts +4 -2
- package/dist/chat/scheduled-tasks/tools/run-now.d.ts +4 -2
- package/dist/chat/scheduled-tasks/tools/update.d.ts +4 -2
- package/dist/chat/scheduled-tasks/types.d.ts +1 -1
- package/dist/chat/slack/dashboard-link.d.ts +2 -0
- package/dist/chat/state/turn-session-keys.d.ts +2 -2
- package/dist/chat/state/turn-session.d.ts +16 -12
- package/dist/chat/tasks/execution-stats.d.ts +34 -3
- package/dist/chat/tasks/read.d.ts +3 -1
- package/dist/chunk-3B7O3GNU.js +207 -0
- package/dist/{chunk-N7WARMC6.js → chunk-3CUBAGA3.js} +7 -7
- package/dist/{chunk-5MXWHTCK.js → chunk-4PIT6O7A.js} +17 -8
- package/dist/{chunk-DCLLQGS6.js → chunk-557HLSNH.js} +8 -3
- package/dist/{chunk-SD3OFRWY.js → chunk-5KAZMR5U.js} +6 -6
- package/dist/{chunk-ZBSMCXKV.js → chunk-5YAWB2AX.js} +7 -6
- package/dist/{chunk-FEUNPTGV.js → chunk-A6BI25J3.js} +434 -12
- package/dist/{chunk-5LTJ4ITU.js → chunk-AA2EPMUF.js} +4 -4
- package/dist/{chunk-TUUDXEXU.js → chunk-BMFRFSTM.js} +68 -79
- package/dist/{chunk-C7ZVPO4Z.js → chunk-CPPTBHQN.js} +1 -1
- package/dist/{chunk-ZXNTJJIE.js → chunk-D3X2PI3D.js} +2 -2
- package/dist/{chunk-LPVUNO2W.js → chunk-DMDOKRPC.js} +7 -7
- package/dist/{chunk-TCS76X5D.js → chunk-HEFBGCCU.js} +2 -2
- package/dist/{chunk-EPBBYMNE.js → chunk-HUO3UTAQ.js} +1 -1
- package/dist/{chunk-KFRHRSCJ.js → chunk-I3OZR3HG.js} +2 -2
- package/dist/{chunk-BOLJOV5T.js → chunk-J5H65GY2.js} +1 -1
- package/dist/{chunk-RZIBSCYC.js → chunk-MYVCHWDG.js} +39 -23
- package/dist/{chunk-QS527AV5.js → chunk-N2I7W2VS.js} +1 -1
- package/dist/{chunk-JNNJZURV.js → chunk-NPL66ZWL.js} +1 -1
- package/dist/{chunk-A7WCHXZV.js → chunk-OGNL2QY7.js} +4 -4
- package/dist/{chunk-77VDLF3Z.js → chunk-RUIXF3YQ.js} +10 -0
- package/dist/{chunk-BYW4B4PR.js → chunk-S3FAOKQU.js} +2 -2
- package/dist/chunk-TGIKZJ3Y.js +115 -0
- package/dist/{chunk-YU5QUF67.js → chunk-TKTZ4L4Z.js} +1 -1
- package/dist/{chunk-VPZFVJND.js → chunk-UXMRN2ZX.js} +1 -1
- package/dist/{chunk-HIWJWWMT.js → chunk-VRDHAITB.js} +3 -3
- package/dist/{chunk-SIPKWSXK.js → chunk-WSWM6A3R.js} +3 -3
- package/dist/{chunk-FNLBTB4K.js → chunk-WTGLUX4K.js} +1 -1
- package/dist/{chunk-PB3CXNVL.js → chunk-XROWZSOY.js} +1 -1
- package/dist/{chunk-TDJCLNDH.js → chunk-XX2QNQN4.js} +147 -86
- package/dist/{chunk-KDCHVT25.js → chunk-YB363QGA.js} +9 -2
- package/dist/{chunk-HCIVH3JS.js → chunk-YWM6MJT4.js} +29 -1
- package/dist/{chunk-E5UYAIKJ.js → chunk-Z2A7BDHT.js} +17 -19
- package/dist/cli/chat.js +33 -33
- package/dist/cli/check.js +7 -7
- package/dist/cli/plugins.js +14 -14
- package/dist/cli/snapshot-create.js +10 -10
- package/dist/cli/upgrade.js +8 -8
- package/dist/db/schema/task-executions.d.ts +23 -2
- package/dist/db/schema.d.ts +20 -1
- package/dist/{db-UO2IWXGA.js → db-QOGYDDQM.js} +7 -7
- package/dist/instrumentation.js +4 -4
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-MAQI43LX.js → oauth-callback-server-CT4RMGCP.js} +22 -21
- package/dist/{runner-PIUQEXKE.js → runner-PHMLHNLX.js} +18 -16
- package/dist/{sandbox-egress-signals-A5HWIQH4.js → sandbox-egress-signals-EKPAVWQL.js} +2 -2
- package/dist/{skills-4ARJADHQ.js → skills-AYRM4QGF.js} +7 -7
- package/dist/spawn-OGRQFUNK.js +38 -0
- package/dist/{validation-S3EE3HWL.js → validation-M5JNGRGL.js} +7 -7
- package/dist/version.js +1 -1
- package/dist/{work-UARRUAW3.js → work-LZWE6HK4.js} +18 -18
- package/dist/{worker-DOCIRVD3.js → worker-KOGPXFYK.js} +10 -10
- package/migrations/0022_task_execution_status.sql +3 -0
- package/migrations/meta/0022_snapshot.json +2186 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +5 -5
- package/dist/chunk-ELKW5FIB.js +0 -233
- package/dist/spawn-G2AWPMCT.js +0 -38
|
@@ -21,20 +21,20 @@ import {
|
|
|
21
21
|
instructionProvenanceFor,
|
|
22
22
|
sanitizePostgresJson,
|
|
23
23
|
withConversationEventLock
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-WSWM6A3R.js";
|
|
25
25
|
import {
|
|
26
26
|
SANDBOX_WORKSPACE_ROOT,
|
|
27
27
|
sleep
|
|
28
28
|
} from "./chunk-EM225ITJ.js";
|
|
29
29
|
import {
|
|
30
30
|
getStateAdapter
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-J5H65GY2.js";
|
|
32
32
|
import {
|
|
33
33
|
botConfig,
|
|
34
34
|
escapeXml,
|
|
35
35
|
resolveGatewayModel,
|
|
36
36
|
unwrapCurrentInstruction
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-S3FAOKQU.js";
|
|
38
38
|
import {
|
|
39
39
|
toStoredSlackActor
|
|
40
40
|
} from "./chunk-HZF5P5UN.js";
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
setSpanAttributes,
|
|
50
50
|
toOptionalNumber,
|
|
51
51
|
toOptionalString
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-NPL66ZWL.js";
|
|
53
53
|
|
|
54
54
|
// src/chat/turn-context-tag.ts
|
|
55
55
|
var TURN_CONTEXT_TAG = "runtime-turn-context";
|
|
@@ -1402,7 +1402,6 @@ function getAssistantReplyText(message) {
|
|
|
1402
1402
|
}
|
|
1403
1403
|
|
|
1404
1404
|
// src/chat/state/turn-session.ts
|
|
1405
|
-
import { THREAD_STATE_TTL_MS } from "chat";
|
|
1406
1405
|
import {
|
|
1407
1406
|
actorSchema
|
|
1408
1407
|
} from "@sentry/junior-plugin-api";
|
|
@@ -1766,9 +1765,8 @@ function agentTurnSessionConversationIndexKey(conversationId) {
|
|
|
1766
1765
|
}
|
|
1767
1766
|
|
|
1768
1767
|
// src/chat/state/turn-session.ts
|
|
1769
|
-
var
|
|
1770
|
-
var
|
|
1771
|
-
var AGENT_TURN_SESSION_TTL_MS = THREAD_STATE_TTL_MS;
|
|
1768
|
+
var AGENT_TURN_SESSION_RESUME_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
1769
|
+
var AGENT_TURN_SESSION_TERMINAL_TTL_MS = 60 * 60 * 1e3;
|
|
1772
1770
|
function definedProps(values) {
|
|
1773
1771
|
return Object.fromEntries(
|
|
1774
1772
|
Object.entries(values).filter(([, value]) => value !== void 0)
|
|
@@ -1796,6 +1794,19 @@ var agentTurnResumeReasonSchema = z2.enum([
|
|
|
1796
1794
|
var nonNegativeNumberSchema = z2.number().finite().nonnegative();
|
|
1797
1795
|
var seqCursorSchema = z2.number().int().min(-1);
|
|
1798
1796
|
var agentTurnSessionSummarySchema = z2.object({
|
|
1797
|
+
version: z2.number().int().nonnegative(),
|
|
1798
|
+
conversationId: z2.string().min(1),
|
|
1799
|
+
dispatchId: z2.string().min(1).optional(),
|
|
1800
|
+
dispatchOutcome: z2.enum(["blocked", "completed", "failed"]).optional(),
|
|
1801
|
+
resultMessageId: z2.string().min(1).optional(),
|
|
1802
|
+
resumeReason: agentTurnResumeReasonSchema.optional(),
|
|
1803
|
+
sessionId: z2.string().min(1),
|
|
1804
|
+
sliceId: z2.number().int().nonnegative(),
|
|
1805
|
+
state: agentTurnSessionStatusSchema,
|
|
1806
|
+
surface: agentTurnSurfaceSchema.optional(),
|
|
1807
|
+
updatedAtMs: nonNegativeNumberSchema
|
|
1808
|
+
}).strip();
|
|
1809
|
+
var storedAgentTurnSessionRecordSchema = z2.object({
|
|
1799
1810
|
channelName: z2.string().min(1).optional(),
|
|
1800
1811
|
version: z2.number().int().nonnegative(),
|
|
1801
1812
|
conversationId: z2.string().min(1),
|
|
@@ -1808,8 +1819,6 @@ var agentTurnSessionSummarySchema = z2.object({
|
|
|
1808
1819
|
loadedSkillNames: z2.array(z2.string()).optional(),
|
|
1809
1820
|
modelId: z2.string().min(1).optional(),
|
|
1810
1821
|
reasoningLevel: z2.string().min(1).optional(),
|
|
1811
|
-
// TODO(#1267): Remove actor from this projection once resume rebuilds it.
|
|
1812
|
-
actor: actorSchema.optional(),
|
|
1813
1822
|
resumeReason: agentTurnResumeReasonSchema.optional(),
|
|
1814
1823
|
resumedFromSliceId: z2.number().int().nonnegative().optional(),
|
|
1815
1824
|
sessionId: z2.string().min(1),
|
|
@@ -1818,9 +1827,7 @@ var agentTurnSessionSummarySchema = z2.object({
|
|
|
1818
1827
|
state: agentTurnSessionStatusSchema,
|
|
1819
1828
|
surface: agentTurnSurfaceSchema.optional(),
|
|
1820
1829
|
traceId: z2.string().optional(),
|
|
1821
|
-
updatedAtMs: nonNegativeNumberSchema
|
|
1822
|
-
}).strip();
|
|
1823
|
-
var storedAgentTurnSessionRecordSchema = agentTurnSessionSummarySchema.extend({
|
|
1830
|
+
updatedAtMs: nonNegativeNumberSchema,
|
|
1824
1831
|
actors: z2.array(actorSchema).optional(),
|
|
1825
1832
|
committedSeq: seqCursorSchema,
|
|
1826
1833
|
historyVersion: z2.number().int().nonnegative().optional(),
|
|
@@ -1845,20 +1852,25 @@ function parseAgentTurnSessionRecord(value) {
|
|
|
1845
1852
|
function parseAgentTurnSessionSummary(value) {
|
|
1846
1853
|
return agentTurnSessionSummarySchema.parse(value);
|
|
1847
1854
|
}
|
|
1855
|
+
function agentTurnSessionRecordTtlMs(state, ttlMs) {
|
|
1856
|
+
if (ttlMs !== void 0) {
|
|
1857
|
+
return Math.max(1, ttlMs);
|
|
1858
|
+
}
|
|
1859
|
+
return state === "running" || state === "awaiting_resume" ? AGENT_TURN_SESSION_RESUME_TTL_MS : AGENT_TURN_SESSION_TERMINAL_TTL_MS;
|
|
1860
|
+
}
|
|
1861
|
+
function agentTurnSessionIndexTtlMs(ttlMs) {
|
|
1862
|
+
return Math.max(1, ttlMs ?? AGENT_TURN_SESSION_RESUME_TTL_MS);
|
|
1863
|
+
}
|
|
1864
|
+
function projectAgentTurnSessionSummary(record) {
|
|
1865
|
+
return agentTurnSessionSummarySchema.parse(record);
|
|
1866
|
+
}
|
|
1848
1867
|
async function appendAgentTurnSessionSummary(summary, ttlMs) {
|
|
1849
|
-
const projectedSummary = agentTurnSessionSummarySchema.parse(summary);
|
|
1850
1868
|
const stateAdapter = getStateAdapter();
|
|
1851
|
-
await
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
stateAdapter.appendToList(
|
|
1857
|
-
agentTurnSessionConversationIndexKey(projectedSummary.conversationId),
|
|
1858
|
-
projectedSummary,
|
|
1859
|
-
{ ttlMs }
|
|
1860
|
-
)
|
|
1861
|
-
]);
|
|
1869
|
+
await stateAdapter.appendToList(
|
|
1870
|
+
agentTurnSessionConversationIndexKey(summary.conversationId),
|
|
1871
|
+
agentTurnSessionSummarySchema.parse(summary),
|
|
1872
|
+
{ ttlMs }
|
|
1873
|
+
);
|
|
1862
1874
|
}
|
|
1863
1875
|
async function recordConversationActivityMetadata(args) {
|
|
1864
1876
|
const conversationStore = args.conversationStore ?? getConversationStore();
|
|
@@ -1874,7 +1886,7 @@ async function recordConversationActivityMetadata(args) {
|
|
|
1874
1886
|
conversationId: args.summary.conversationId,
|
|
1875
1887
|
destination,
|
|
1876
1888
|
nowMs: args.nowMs,
|
|
1877
|
-
actor: sessionLogActor(args.
|
|
1889
|
+
actor: sessionLogActor(args.actor),
|
|
1878
1890
|
...definedProps({ source: activitySource }),
|
|
1879
1891
|
...args.source ? { sessionSource: args.source } : {},
|
|
1880
1892
|
visibility: isChild ? void 0 : args.destinationVisibility
|
|
@@ -1890,7 +1902,7 @@ async function recordConversationActivityMetadata(args) {
|
|
|
1890
1902
|
durationMs: args.summary.cumulativeDurationMs,
|
|
1891
1903
|
...args.summary.cumulativeUsage ? { usage: args.summary.cumulativeUsage } : {}
|
|
1892
1904
|
},
|
|
1893
|
-
actor: sessionLogActor(args.
|
|
1905
|
+
actor: sessionLogActor(args.actor),
|
|
1894
1906
|
...definedProps({ source: activitySource }),
|
|
1895
1907
|
updatedAtMs: args.nowMs,
|
|
1896
1908
|
visibility: isChild ? void 0 : args.destinationVisibility
|
|
@@ -1912,7 +1924,6 @@ function materializeAgentTurnSessionRecord(stored, piProjection, turnStartMessag
|
|
|
1912
1924
|
actors: stored.actors ?? instructionActors(piProjection.provenance),
|
|
1913
1925
|
cumulativeDurationMs: stored.cumulativeDurationMs,
|
|
1914
1926
|
...definedProps({
|
|
1915
|
-
actor: stored.actor,
|
|
1916
1927
|
channelName: stored.channelName,
|
|
1917
1928
|
cumulativeUsage: stored.cumulativeUsage,
|
|
1918
1929
|
dispatchId: stored.dispatchId,
|
|
@@ -2032,7 +2043,6 @@ function buildStoredRecord(args) {
|
|
|
2032
2043
|
committedSeq: args.committedSeq,
|
|
2033
2044
|
cumulativeDurationMs: args.cumulativeDurationMs,
|
|
2034
2045
|
...definedProps({
|
|
2035
|
-
actor: args.actor,
|
|
2036
2046
|
actors: args.actors,
|
|
2037
2047
|
channelName: args.channelName,
|
|
2038
2048
|
cumulativeUsage: args.cumulativeUsage,
|
|
@@ -2058,6 +2068,7 @@ async function setStoredRecord(args) {
|
|
|
2058
2068
|
await stateAdapter.connect();
|
|
2059
2069
|
const storedRecord = storedAgentTurnSessionRecordSchema.parse(args.record);
|
|
2060
2070
|
await recordConversationActivityMetadata({
|
|
2071
|
+
actor: args.actor,
|
|
2061
2072
|
conversationStore: args.conversationStore,
|
|
2062
2073
|
destination: args.destination,
|
|
2063
2074
|
destinationVisibility: args.destinationVisibility,
|
|
@@ -2070,16 +2081,10 @@ async function setStoredRecord(args) {
|
|
|
2070
2081
|
storedRecord,
|
|
2071
2082
|
args.ttlMs
|
|
2072
2083
|
);
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
errorMessage: _errorMessage,
|
|
2078
|
-
turnStartSeq: _turnStartSeq,
|
|
2079
|
-
runtimeContext: _runtimeContext,
|
|
2080
|
-
...summary
|
|
2081
|
-
} = storedRecord;
|
|
2082
|
-
await appendAgentTurnSessionSummary(summary, args.ttlMs);
|
|
2084
|
+
await appendAgentTurnSessionSummary(
|
|
2085
|
+
projectAgentTurnSessionSummary(storedRecord),
|
|
2086
|
+
agentTurnSessionIndexTtlMs(args.indexTtlMs)
|
|
2087
|
+
);
|
|
2083
2088
|
return materializeAgentTurnSessionRecord(
|
|
2084
2089
|
storedRecord,
|
|
2085
2090
|
{
|
|
@@ -2100,7 +2105,7 @@ async function updateAgentTurnSessionState(args) {
|
|
|
2100
2105
|
return await setStoredRecord({
|
|
2101
2106
|
piMessages: args.existing.piMessages,
|
|
2102
2107
|
piMessageProvenance: args.existing.piMessageProvenance,
|
|
2103
|
-
ttlMs:
|
|
2108
|
+
ttlMs: agentTurnSessionRecordTtlMs(args.state),
|
|
2104
2109
|
...definedProps({
|
|
2105
2110
|
turnStartMessageIndex: args.existing.turnStartMessageIndex
|
|
2106
2111
|
}),
|
|
@@ -2116,7 +2121,6 @@ async function updateAgentTurnSessionState(args) {
|
|
|
2116
2121
|
cumulativeDurationMs: args.existing.cumulativeDurationMs,
|
|
2117
2122
|
actors: args.existing.actors,
|
|
2118
2123
|
...definedProps({
|
|
2119
|
-
actor: args.existing.actor,
|
|
2120
2124
|
channelName: parsed.channelName,
|
|
2121
2125
|
cumulativeUsage: args.existing.cumulativeUsage,
|
|
2122
2126
|
dispatchId: args.existing.dispatchId,
|
|
@@ -2129,7 +2133,6 @@ async function updateAgentTurnSessionState(args) {
|
|
|
2129
2133
|
resumeReason: args.existing.resumeReason,
|
|
2130
2134
|
resultMessageId: args.existing.resultMessageId,
|
|
2131
2135
|
resumedFromSliceId: args.existing.resumedFromSliceId,
|
|
2132
|
-
runtimeContext: parsed.runtimeContext,
|
|
2133
2136
|
surface: args.existing.surface,
|
|
2134
2137
|
traceId: args.existing.traceId,
|
|
2135
2138
|
turnStartSeq: parsed.turnStartSeq
|
|
@@ -2148,8 +2151,8 @@ async function upsertAgentTurnSessionRecord(args) {
|
|
|
2148
2151
|
`Turn session ${args.sessionId} dispatchId cannot be changed`
|
|
2149
2152
|
);
|
|
2150
2153
|
}
|
|
2151
|
-
const ttlMs =
|
|
2152
|
-
const instructionActor = args.actor
|
|
2154
|
+
const ttlMs = agentTurnSessionRecordTtlMs(args.state, args.ttlMs);
|
|
2155
|
+
const instructionActor = args.actor;
|
|
2153
2156
|
const commit = await commitMessages({
|
|
2154
2157
|
conversationId: args.conversationId,
|
|
2155
2158
|
messages: args.piMessages,
|
|
@@ -2170,6 +2173,7 @@ async function upsertAgentTurnSessionRecord(args) {
|
|
|
2170
2173
|
const turnStartSeq = durableTurnStartMessageIndex === void 0 ? existingRecord?.turnStartSeq : durableTurnStartMessageIndex <= 0 ? -1 : commit.messageSeqs[durableTurnStartMessageIndex - 1] ?? commit.committedSeq;
|
|
2171
2174
|
const turnStartMessageIndex = durableTurnStartMessageIndex ?? (turnStartSeq === void 0 ? void 0 : commit.messageSeqs.filter((seq) => seq <= turnStartSeq).length);
|
|
2172
2175
|
return await setStoredRecord({
|
|
2176
|
+
actor: args.actor,
|
|
2173
2177
|
conversationStore: args.conversationStore,
|
|
2174
2178
|
destination: args.destination,
|
|
2175
2179
|
destinationVisibility: args.destinationVisibility,
|
|
@@ -2177,6 +2181,9 @@ async function upsertAgentTurnSessionRecord(args) {
|
|
|
2177
2181
|
piMessages: commit.messages,
|
|
2178
2182
|
piMessageProvenance: commit.provenance,
|
|
2179
2183
|
ttlMs,
|
|
2184
|
+
// Pass through only an explicit override so indexes stay on the resume window
|
|
2185
|
+
// by default even when the record takes a short terminal TTL.
|
|
2186
|
+
...definedProps({ indexTtlMs: args.ttlMs }),
|
|
2180
2187
|
turnStartMessageIndex,
|
|
2181
2188
|
record: buildStoredRecord({
|
|
2182
2189
|
conversationId: args.conversationId,
|
|
@@ -2194,7 +2201,6 @@ async function upsertAgentTurnSessionRecord(args) {
|
|
|
2194
2201
|
...commit.provenance
|
|
2195
2202
|
]),
|
|
2196
2203
|
...definedProps({
|
|
2197
|
-
actor: args.actor ?? existingRecord?.actor,
|
|
2198
2204
|
channelName: args.channelName ?? existingRecord?.channelName,
|
|
2199
2205
|
cumulativeUsage: args.cumulativeUsage,
|
|
2200
2206
|
dispatchId: args.dispatchId ?? existingRecord?.dispatchId,
|
|
@@ -2206,7 +2212,7 @@ async function upsertAgentTurnSessionRecord(args) {
|
|
|
2206
2212
|
resumeReason: args.resumeReason,
|
|
2207
2213
|
resultMessageId: args.resultMessageId ?? existingRecord?.resultMessageId,
|
|
2208
2214
|
resumedFromSliceId: args.resumedFromSliceId,
|
|
2209
|
-
runtimeContext: retainedRuntimeContext,
|
|
2215
|
+
runtimeContext: args.state === "running" || args.state === "awaiting_resume" ? retainedRuntimeContext : void 0,
|
|
2210
2216
|
startedAtMs: existingRecord?.startedAtMs,
|
|
2211
2217
|
surface: args.surface ?? existingRecord?.surface,
|
|
2212
2218
|
traceId: args.traceId ?? existingRecord?.traceId,
|
|
@@ -2231,43 +2237,41 @@ async function recordAgentTurnSessionSummary(args) {
|
|
|
2231
2237
|
);
|
|
2232
2238
|
}
|
|
2233
2239
|
const nowMs = Date.now();
|
|
2234
|
-
const ttlMs =
|
|
2240
|
+
const ttlMs = agentTurnSessionIndexTtlMs(args.ttlMs);
|
|
2235
2241
|
const summary = {
|
|
2236
2242
|
version: existing?.version ?? 0,
|
|
2237
2243
|
conversationId: args.conversationId,
|
|
2238
2244
|
sessionId: args.sessionId,
|
|
2239
2245
|
sliceId: args.sliceId,
|
|
2240
|
-
startedAtMs: existing?.startedAtMs ?? args.startedAtMs ?? nowMs,
|
|
2241
|
-
lastProgressAtMs: args.lastProgressAtMs ?? nowMs,
|
|
2242
2246
|
state: args.state,
|
|
2243
2247
|
updatedAtMs: nowMs,
|
|
2244
|
-
cumulativeDurationMs: args.cumulativeDurationMs ?? existing?.cumulativeDurationMs ?? 0,
|
|
2245
2248
|
...definedProps({
|
|
2246
|
-
actor: args.actor ?? existing?.actor,
|
|
2247
|
-
channelName: args.channelName ?? existing?.channelName,
|
|
2248
|
-
cumulativeUsage: args.cumulativeUsage ?? existing?.cumulativeUsage,
|
|
2249
2249
|
dispatchId: args.dispatchId ?? existingDispatchId,
|
|
2250
2250
|
dispatchOutcome: args.dispatchOutcome ?? existingDispatchOutcome,
|
|
2251
|
-
loadedSkillNames: args.loadedSkillNames ?? existing?.loadedSkillNames,
|
|
2252
|
-
modelId: args.modelId ?? existing?.modelId,
|
|
2253
|
-
reasoningLevel: args.reasoningLevel ?? existing?.reasoningLevel,
|
|
2254
2251
|
resumeReason: args.resumeReason,
|
|
2255
2252
|
resultMessageId: args.resultMessageId ?? existingResultMessageId,
|
|
2256
|
-
surface: args.surface ?? existing?.surface
|
|
2257
|
-
traceId: args.traceId ?? existing?.traceId
|
|
2253
|
+
surface: args.surface ?? existing?.surface
|
|
2258
2254
|
})
|
|
2259
2255
|
};
|
|
2260
2256
|
await recordConversationActivityMetadata({
|
|
2257
|
+
actor: args.actor,
|
|
2261
2258
|
conversationStore: args.conversationStore,
|
|
2262
2259
|
destination: args.destination,
|
|
2263
2260
|
destinationVisibility: args.destinationVisibility,
|
|
2264
2261
|
nowMs,
|
|
2265
2262
|
source: args.source,
|
|
2266
|
-
summary
|
|
2263
|
+
summary: {
|
|
2264
|
+
...summary,
|
|
2265
|
+
channelName: args.channelName ?? stored?.channelName,
|
|
2266
|
+
cumulativeDurationMs: args.cumulativeDurationMs ?? stored?.cumulativeDurationMs ?? 0,
|
|
2267
|
+
cumulativeUsage: args.cumulativeUsage ?? stored?.cumulativeUsage,
|
|
2268
|
+
startedAtMs: stored?.startedAtMs ?? args.startedAtMs ?? nowMs
|
|
2269
|
+
}
|
|
2267
2270
|
});
|
|
2268
2271
|
await appendAgentTurnSessionSummary(summary, ttlMs);
|
|
2269
2272
|
}
|
|
2270
|
-
async function readAgentTurnSessionSummariesFromIndex(key
|
|
2273
|
+
async function readAgentTurnSessionSummariesFromIndex(key) {
|
|
2274
|
+
const stateAdapter = getStateAdapter();
|
|
2271
2275
|
await stateAdapter.connect();
|
|
2272
2276
|
const values = await stateAdapter.getList(key);
|
|
2273
2277
|
const summaries = /* @__PURE__ */ new Map();
|
|
@@ -2275,11 +2279,7 @@ async function readAgentTurnSessionSummariesFromIndex(key, stateAdapter) {
|
|
|
2275
2279
|
let summary;
|
|
2276
2280
|
try {
|
|
2277
2281
|
summary = parseAgentTurnSessionSummary(value);
|
|
2278
|
-
} catch
|
|
2279
|
-
logWarn("agent.turn.session_summary_parse.failed", {
|
|
2280
|
-
"app.state.key": key,
|
|
2281
|
-
"exception.message": error instanceof Error ? error.message : String(error)
|
|
2282
|
-
});
|
|
2282
|
+
} catch {
|
|
2283
2283
|
continue;
|
|
2284
2284
|
}
|
|
2285
2285
|
const summaryKey = `${summary.conversationId}:${summary.sessionId}`;
|
|
@@ -2292,20 +2292,8 @@ async function readAgentTurnSessionSummariesFromIndex(key, stateAdapter) {
|
|
|
2292
2292
|
);
|
|
2293
2293
|
}
|
|
2294
2294
|
async function listAgentTurnSessionSummariesForConversation(conversationId) {
|
|
2295
|
-
const stateAdapter = getStateAdapter();
|
|
2296
|
-
const summaries = await listBoundedAgentTurnSessionSummariesForConversation(conversationId);
|
|
2297
|
-
if (summaries.length > 0) {
|
|
2298
|
-
return summaries;
|
|
2299
|
-
}
|
|
2300
|
-
return (await readAgentTurnSessionSummariesFromIndex(
|
|
2301
|
-
AGENT_TURN_SESSION_INDEX_KEY,
|
|
2302
|
-
stateAdapter
|
|
2303
|
-
)).filter((summary) => summary.conversationId === conversationId);
|
|
2304
|
-
}
|
|
2305
|
-
async function listBoundedAgentTurnSessionSummariesForConversation(conversationId) {
|
|
2306
2295
|
return readAgentTurnSessionSummariesFromIndex(
|
|
2307
|
-
agentTurnSessionConversationIndexKey(conversationId)
|
|
2308
|
-
getStateAdapter()
|
|
2296
|
+
agentTurnSessionConversationIndexKey(conversationId)
|
|
2309
2297
|
);
|
|
2310
2298
|
}
|
|
2311
2299
|
async function abandonAgentTurnSessionRecord(args) {
|
|
@@ -2378,7 +2366,8 @@ function sessionWriteContext(args, latest) {
|
|
|
2378
2366
|
modelId: args.modelId,
|
|
2379
2367
|
sessionId: args.sessionId,
|
|
2380
2368
|
...definedProps2({
|
|
2381
|
-
|
|
2369
|
+
// Live only: Redis no longer stores execution actor across resumes.
|
|
2370
|
+
actor: args.actor,
|
|
2382
2371
|
channelName: args.channelName ?? latest?.channelName,
|
|
2383
2372
|
destination: args.destination,
|
|
2384
2373
|
destinationVisibility: args.destinationVisibility,
|
|
@@ -4,27 +4,27 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
formatProviderLabel,
|
|
6
6
|
startOAuthFlow
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-5KAZMR5U.js";
|
|
8
8
|
import {
|
|
9
9
|
abandonReplacedPendingAuth,
|
|
10
10
|
canReusePendingAuthLink,
|
|
11
11
|
recordAuthorizationRequested
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-BMFRFSTM.js";
|
|
13
13
|
import {
|
|
14
14
|
parseSandboxEgressAuthRequiredSignal
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-HUO3UTAQ.js";
|
|
16
16
|
import {
|
|
17
17
|
AGENT_INVOCATION_MAILBOX_STATUSES
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-557HLSNH.js";
|
|
19
19
|
import {
|
|
20
20
|
TURN_REASONING_LEVELS
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-S3FAOKQU.js";
|
|
22
22
|
import {
|
|
23
23
|
pluginCatalogRuntime
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-N2I7W2VS.js";
|
|
25
25
|
import {
|
|
26
26
|
credentialContextSchema
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-RUIXF3YQ.js";
|
|
28
28
|
|
|
29
29
|
// src/chat/services/auth-pause.ts
|
|
30
30
|
var AuthorizationPauseError = class extends Error {
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-EM225ITJ.js";
|
|
4
4
|
import {
|
|
5
5
|
getSlackBotToken
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-S3FAOKQU.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-NPL66ZWL.js";
|
|
16
16
|
|
|
17
17
|
// src/chat/slack/client.ts
|
|
18
18
|
import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
credentialUserSubjectId
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RUIXF3YQ.js";
|
|
4
4
|
import {
|
|
5
5
|
logInfo,
|
|
6
6
|
logWarn,
|
|
7
7
|
setSpanAttributes
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-NPL66ZWL.js";
|
|
9
9
|
import {
|
|
10
10
|
discoverInstalledPluginPackageContent,
|
|
11
11
|
normalizePluginPackageNames
|