@sentry/junior 0.145.0 → 0.147.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-L7D2BDVV.js → agent-hooks-HS6VGUPM.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.js +1 -1
- package/dist/api.js +26 -22
- package/dist/app.js +285 -290
- package/dist/{catalog-runtime-QLAC4Q3W.js → catalog-runtime-M6ZTPYRV.js} +5 -5
- package/dist/chat/agent/prompt.d.ts +0 -2
- package/dist/chat/agent/request.d.ts +2 -5
- package/dist/chat/agent/resume.d.ts +0 -3
- package/dist/chat/agent/sandbox.d.ts +2 -2
- package/dist/chat/agent/skills.d.ts +0 -1
- package/dist/chat/agent/tools.d.ts +0 -3
- package/dist/chat/agent-dispatch/types.d.ts +2 -2
- package/dist/chat/capabilities/jr-rpc-command.d.ts +2 -2
- package/dist/chat/configuration/service.d.ts +5 -2
- package/dist/chat/configuration/sql.d.ts +9 -0
- package/dist/chat/configuration/types.d.ts +17 -13
- package/dist/chat/conversations/history.d.ts +3 -0
- package/dist/chat/conversations/message-search.d.ts +32 -0
- package/dist/chat/conversations/projection.d.ts +10 -0
- package/dist/chat/conversations/sql/message-search.d.ts +4 -0
- package/dist/chat/conversations/tool-source.d.ts +5 -0
- package/dist/chat/credentials/unlink-provider.d.ts +2 -1
- package/dist/chat/credentials/user-token-store.d.ts +2 -0
- package/dist/chat/db.d.ts +2 -2
- package/dist/chat/event-tasks/tool-support.d.ts +2 -0
- package/dist/chat/identities/sql.d.ts +8 -0
- package/dist/chat/logging.d.ts +2 -0
- package/dist/chat/mcp/auth-store.d.ts +0 -2
- package/dist/chat/mcp/oauth.d.ts +0 -2
- package/dist/chat/oauth-flow.d.ts +3 -1
- package/dist/chat/pi/client.d.ts +2 -0
- package/dist/chat/plugins/credential-hooks.d.ts +2 -0
- package/dist/chat/prompt.d.ts +0 -2
- package/dist/chat/resource-events/notification.d.ts +2 -1
- package/dist/chat/runtime/delivered-turn-state.d.ts +1 -4
- package/dist/chat/runtime/thread-state.d.ts +8 -11
- package/dist/chat/runtime/turn-input.d.ts +4 -2
- package/dist/chat/runtime/turn-preparation.d.ts +2 -4
- package/dist/chat/sandbox/command-result.d.ts +2 -0
- package/dist/chat/sandbox/egress/schemas.d.ts +6 -0
- package/dist/chat/scheduled-tasks/tool-support.d.ts +2 -0
- package/dist/chat/scheduled-tasks/tools/create.d.ts +2 -0
- package/dist/chat/scheduled-tasks/tools/delete.d.ts +2 -0
- package/dist/chat/scheduled-tasks/tools/list.d.ts +2 -0
- package/dist/chat/scheduled-tasks/tools/run-now.d.ts +2 -0
- package/dist/chat/scheduled-tasks/tools/update.d.ts +2 -0
- package/dist/chat/services/mcp-auth-orchestration.d.ts +0 -3
- package/dist/chat/services/plugin-auth-orchestration.d.ts +2 -1
- package/dist/chat/services/provider-default-config.d.ts +2 -2
- package/dist/chat/services/subscribed-decision.d.ts +3 -0
- package/dist/chat/services/subscribed-reply-policy.d.ts +1 -0
- package/dist/chat/services/turn-result.d.ts +0 -3
- package/dist/chat/services/turn-router.d.ts +3 -0
- package/dist/chat/slack/assistant-thread/lifecycle.d.ts +0 -1
- package/dist/chat/slack/assistant-thread/title.d.ts +0 -3
- package/dist/chat/slack/dispatch-turn.d.ts +1 -1
- package/dist/chat/slack/message/attachments.d.ts +2 -0
- package/dist/chat/slack/message/blocks.d.ts +2 -0
- package/dist/chat/slack/message/content.d.ts +18 -0
- package/dist/chat/slack/message/identity.d.ts +7 -0
- package/dist/chat/slack/tools/canvas/context.d.ts +0 -10
- package/dist/chat/slack/tools/canvas/create.d.ts +2 -0
- package/dist/chat/slack/tools/canvas/edit.d.ts +2 -0
- package/dist/chat/slack/tools/canvas/read.d.ts +2 -0
- package/dist/chat/slack/tools/canvas/write.d.ts +2 -0
- package/dist/chat/slack/tools/channel-list-messages.d.ts +2 -0
- package/dist/chat/slack/tools/{conversation-search.d.ts → conversation-message-search.d.ts} +23 -14
- package/dist/chat/slack/tools/list/add-items.d.ts +4 -1
- package/dist/chat/slack/tools/list/api.d.ts +8 -1
- package/dist/chat/slack/tools/list/create.d.ts +2 -0
- package/dist/chat/slack/tools/list/get-items.d.ts +5 -3
- package/dist/chat/slack/tools/list/update-item.d.ts +5 -1
- package/dist/chat/slack/tools/message-add-reaction.d.ts +2 -0
- package/dist/chat/slack/tools/public-search.d.ts +2 -0
- package/dist/chat/slack/tools/send-files.d.ts +2 -0
- package/dist/chat/slack/tools/thread-read.d.ts +2 -0
- package/dist/chat/slack/vision-cache.d.ts +5 -0
- package/dist/chat/state/conversation.d.ts +4 -5
- package/dist/chat/task-execution/checkpoint.d.ts +1 -3
- package/dist/chat/task-execution/turn-cursor.d.ts +0 -9
- package/dist/chat/tool-support/structured-result.d.ts +1 -0
- package/dist/chat/tool-support/timed-out-tool-result.d.ts +11 -0
- package/dist/chat/tools/create-event-task.d.ts +2 -0
- package/dist/chat/tools/delete-event-task.d.ts +2 -0
- package/dist/chat/tools/handoff/tool.d.ts +2 -0
- package/dist/chat/tools/list-event-tasks.d.ts +2 -0
- package/dist/chat/tools/list-resource-event-subscriptions.d.ts +2 -0
- package/dist/chat/tools/runtime/report-progress.d.ts +2 -0
- package/dist/chat/tools/runtime/spawn-agent.d.ts +2 -0
- package/dist/chat/tools/{query-conversation-events.d.ts → search-conversation-events.d.ts} +5 -3
- package/dist/chat/tools/search-resource-event-types.d.ts +2 -0
- package/dist/chat/tools/search-tools.d.ts +2 -0
- package/dist/chat/tools/skill/load-skill.d.ts +2 -0
- package/dist/chat/tools/skill/search-mcp-tools.d.ts +2 -0
- package/dist/chat/tools/stop-watching-resources.d.ts +2 -0
- package/dist/chat/tools/system-time.d.ts +2 -0
- package/dist/chat/tools/types.d.ts +0 -6
- package/dist/chat/tools/update-event-task.d.ts +2 -0
- package/dist/chat/tools/user-lookup.d.ts +29 -0
- package/dist/chat/tools/watch-resource-events.d.ts +2 -0
- package/dist/chat/tools/web/fetch-tool.d.ts +2 -0
- package/dist/chat/tools/web/image-generate.d.ts +2 -0
- package/dist/chat/tools/web/search.d.ts +2 -0
- package/dist/{chunk-PJ4NMVQB.js → chunk-34GS7B6L.js} +2 -2
- package/dist/{chunk-2LWPFSB4.js → chunk-4LJO56OJ.js} +9 -1
- package/dist/{chunk-QJBDABQA.js → chunk-6H5SZR24.js} +16 -20
- package/dist/{chunk-LVVSIMBB.js → chunk-745QJ3ZA.js} +1 -1
- package/dist/{chunk-64SBYW2O.js → chunk-7A4M7PCV.js} +613 -561
- package/dist/{chunk-XFKIRN3Q.js → chunk-7NVJVJID.js} +4 -3
- package/dist/{chunk-FUBRJA5F.js → chunk-7UQIVT6G.js} +13 -6
- package/dist/{chunk-ZIAMN2UW.js → chunk-AIOK6LAG.js} +40 -513
- package/dist/{chunk-EIX2LQ6L.js → chunk-AVOCH2Z5.js} +3 -3
- package/dist/{chunk-GUWLDMGF.js → chunk-AVZDSUFB.js} +4 -4
- package/dist/{chunk-2XET6PKP.js → chunk-AYU72WO7.js} +102 -73
- package/dist/chunk-AZ7EAOBE.js +566 -0
- package/dist/{chunk-DXEQAIUV.js → chunk-CSZINQJ2.js} +1 -1
- package/dist/{chunk-HLOUZC5C.js → chunk-CWP5RHVX.js} +4 -4
- package/dist/{chunk-DS3J6WGY.js → chunk-DLDRQHG5.js} +1 -1
- package/dist/{chunk-27TEJTZO.js → chunk-DU74WPIC.js} +55 -37
- package/dist/{chunk-YD54Q45G.js → chunk-EFLJ2WJH.js} +6 -4
- package/dist/{chunk-CD2XFGYQ.js → chunk-GGB4WL5A.js} +1 -1
- package/dist/{chunk-GDV5LXRA.js → chunk-IIOOO4FQ.js} +1 -1
- package/dist/{chunk-SIN3MXH6.js → chunk-JUUKWRBE.js} +1 -1
- package/dist/{chunk-VTDMB7XX.js → chunk-K4SZAP3K.js} +1 -1
- package/dist/{chunk-QUG4JSZK.js → chunk-ORO3PWKQ.js} +1 -1
- package/dist/{chunk-RUSS62EN.js → chunk-PVNG6UMU.js} +3 -3
- package/dist/{chunk-I47UGQPJ.js → chunk-Q4R73I43.js} +365 -206
- package/dist/{chunk-JTGS3ZZE.js → chunk-RXBVB2JM.js} +1 -1
- package/dist/{chunk-TZRXYWRE.js → chunk-SGZO7UWH.js} +2 -2
- package/dist/{chunk-JLMVCNXL.js → chunk-SVHUEHUL.js} +1 -0
- package/dist/{chunk-B46ZMVOV.js → chunk-X5UY34KT.js} +6 -5
- package/dist/{chunk-5PNPQYTO.js → chunk-YBVXBNSV.js} +2 -2
- package/dist/{chunk-HISR3DTV.js → chunk-YEO3VX72.js} +10 -25
- package/dist/{chunk-ZIMRGFYL.js → chunk-YHDERDRO.js} +7 -6
- package/dist/{chunk-WF5HVH3M.js → chunk-YNTTROJT.js} +1 -1
- package/dist/{chunk-2UH3JI64.js → chunk-YSB2N563.js} +87 -34
- package/dist/{chunk-ZYAJMESY.js → chunk-Z4YU7Z4L.js} +3 -2
- package/dist/cli/chat.js +32 -32
- 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/location-configurations.d.ts +127 -0
- package/dist/db/schema.d.ts +128 -1
- package/dist/{db-62PW6LM3.js → db-CSEW4RII.js} +9 -9
- package/dist/instrumentation.js +4 -4
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-6NZNHJAM.js → oauth-callback-server-FUEV5HNG.js} +24 -24
- package/dist/{runner-GCRPG3GQ.js → runner-U3XHSKSH.js} +21 -41
- package/dist/{skills-2S3MDFIQ.js → skills-AKE6W3WI.js} +6 -6
- package/dist/spawn-B6GDTWJ4.js +39 -0
- package/dist/{validation-HAOLCJ5A.js → validation-WDTAULUF.js} +6 -6
- package/dist/version.js +1 -1
- package/dist/{work-R4XYKMUW.js → work-C3HAO2BG.js} +17 -17
- package/dist/{worker-U2UCVR7M.js → worker-LNP4YKBM.js} +10 -10
- package/migrations/0024_misty_typhoid_mary.sql +12 -0
- package/migrations/meta/0024_snapshot.json +2275 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +4 -4
- package/dist/chat/conversations/search.d.ts +0 -24
- package/dist/chat/conversations/sql/search.d.ts +0 -4
- package/dist/chat/slack/legacy-attachments.d.ts +0 -4
- package/dist/chat/slack/message.d.ts +0 -12
- package/dist/chat/slack/tools/user-lookup.d.ts +0 -26
- package/dist/chat/state/artifacts.d.ts +0 -30
- package/dist/chat/tool-support/turn-deadline-result.d.ts +0 -3
- package/dist/chunk-Q6QZTTLS.js +0 -55
- package/dist/spawn-7WK37BTD.js +0 -39
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
JUNIOR_THREAD_STATE_TTL_MS
|
|
3
|
-
} from "./chunk-3Y47VMHV.js";
|
|
4
1
|
import {
|
|
5
2
|
JUNIOR_NATIVE_EVENT_NAMESPACE,
|
|
6
3
|
ToolInputError,
|
|
@@ -21,7 +18,7 @@ import {
|
|
|
21
18
|
instructionProvenanceFor,
|
|
22
19
|
sanitizePostgresJson,
|
|
23
20
|
withConversationEventLock
|
|
24
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-YSB2N563.js";
|
|
25
22
|
import {
|
|
26
23
|
SANDBOX_WORKSPACE_ROOT,
|
|
27
24
|
sleep
|
|
@@ -31,21 +28,18 @@ import {
|
|
|
31
28
|
fenceLock,
|
|
32
29
|
getStateAdapter,
|
|
33
30
|
withLock
|
|
34
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-ORO3PWKQ.js";
|
|
35
32
|
import {
|
|
36
33
|
botConfig,
|
|
37
34
|
unwrapCurrentInstruction
|
|
38
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-7NVJVJID.js";
|
|
39
36
|
import {
|
|
40
37
|
toStoredSlackActor
|
|
41
38
|
} from "./chunk-HZF5P5UN.js";
|
|
42
39
|
import {
|
|
43
40
|
getActiveTraceId,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
toOptionalNumber,
|
|
47
|
-
toOptionalString
|
|
48
|
-
} from "./chunk-2LWPFSB4.js";
|
|
41
|
+
logException
|
|
42
|
+
} from "./chunk-4LJO56OJ.js";
|
|
49
43
|
|
|
50
44
|
// src/chat/turn-context-tag.ts
|
|
51
45
|
var TURN_CONTEXT_TAG = "runtime-turn-context";
|
|
@@ -914,6 +908,26 @@ async function recordAgentsInstructionsUpdated(args) {
|
|
|
914
908
|
}
|
|
915
909
|
]);
|
|
916
910
|
}
|
|
911
|
+
async function recordSubscribedReplyRoute(args) {
|
|
912
|
+
await getConversationEventStore().append(args.conversationId, [
|
|
913
|
+
{
|
|
914
|
+
idempotencyKey: `native:${JUNIOR_NATIVE_EVENT_NAMESPACE}:passive_reply_routed:${args.runId}`,
|
|
915
|
+
createdAtMs: Date.now(),
|
|
916
|
+
data: {
|
|
917
|
+
type: "structured_event",
|
|
918
|
+
namespace: JUNIOR_NATIVE_EVENT_NAMESPACE,
|
|
919
|
+
name: "passive_reply_routed",
|
|
920
|
+
version: 1,
|
|
921
|
+
content: {
|
|
922
|
+
costUsd: args.costUsd,
|
|
923
|
+
reason: args.reason,
|
|
924
|
+
shouldReply: args.shouldReply,
|
|
925
|
+
...args.shouldUnsubscribe !== void 0 ? { shouldUnsubscribe: args.shouldUnsubscribe } : {}
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
]);
|
|
930
|
+
}
|
|
917
931
|
async function loadTurnRoute(args) {
|
|
918
932
|
const event = await getConversationEventStore().loadByIdempotencyKey(
|
|
919
933
|
args.conversationId,
|
|
@@ -937,6 +951,7 @@ async function recordTurnRoute(args) {
|
|
|
937
951
|
turnId: args.turnId,
|
|
938
952
|
modelProfile: args.modelProfile,
|
|
939
953
|
modelId: args.modelId,
|
|
954
|
+
...args.costUsd !== void 0 ? { costUsd: args.costUsd } : {},
|
|
940
955
|
reasoningLevel: args.reasoningLevel,
|
|
941
956
|
...args.confidence !== void 0 ? { confidence: args.confidence } : {},
|
|
942
957
|
source: args.source
|
|
@@ -1643,7 +1658,7 @@ async function recordConversationActivityMetadata(args) {
|
|
|
1643
1658
|
visibility: isChild ? void 0 : args.destinationVisibility
|
|
1644
1659
|
});
|
|
1645
1660
|
}
|
|
1646
|
-
function materializeTurnRecord(stored, piProjection, turnStartMessageIndex, restoreVolatileContext = true,
|
|
1661
|
+
function materializeTurnRecord(stored, piProjection, turnStartMessageIndex, restoreVolatileContext = true, runtimeMetrics) {
|
|
1647
1662
|
const restoredProjection = restoreVolatileContext && (stored.state === "running" || stored.state === "paused") ? restoreRuntimeContext(piProjection, stored.runtimeContext) : piProjection;
|
|
1648
1663
|
return {
|
|
1649
1664
|
schemaVersion: stored.schemaVersion,
|
|
@@ -1658,13 +1673,10 @@ function materializeTurnRecord(stored, piProjection, turnStartMessageIndex, rest
|
|
|
1658
1673
|
piMessages: restoredProjection.messages,
|
|
1659
1674
|
piMessageProvenance: restoredProjection.provenance,
|
|
1660
1675
|
actors: instructionActors(piProjection.provenance),
|
|
1661
|
-
cumulativeDurationMs:
|
|
1676
|
+
cumulativeDurationMs: runtimeMetrics?.cumulativeDurationMs ?? 0,
|
|
1662
1677
|
...definedProps({
|
|
1663
|
-
channelName:
|
|
1664
|
-
cumulativeUsage:
|
|
1665
|
-
loadedSkillNames: runtimeMetadata?.loadedSkillNames,
|
|
1666
|
-
modelId: runtimeMetadata?.modelId,
|
|
1667
|
-
reasoningLevel: runtimeMetadata?.reasoningLevel,
|
|
1678
|
+
channelName: runtimeMetrics?.channelName,
|
|
1679
|
+
cumulativeUsage: runtimeMetrics?.cumulativeUsage,
|
|
1668
1680
|
dispatchId: stored.dispatchId,
|
|
1669
1681
|
dispatchOutcome: stored.dispatchOutcome,
|
|
1670
1682
|
errorMessage: stored.errorMessage,
|
|
@@ -1802,7 +1814,7 @@ async function setStoredRecord(args) {
|
|
|
1802
1814
|
summary: {
|
|
1803
1815
|
...projectTurnSummary(storedRecord),
|
|
1804
1816
|
startedAtMs: storedRecord.startedAtMs,
|
|
1805
|
-
...args.
|
|
1817
|
+
...args.runtimeMetrics
|
|
1806
1818
|
}
|
|
1807
1819
|
});
|
|
1808
1820
|
await args.fence();
|
|
@@ -1824,7 +1836,7 @@ async function setStoredRecord(args) {
|
|
|
1824
1836
|
},
|
|
1825
1837
|
args.turnStartMessageIndex,
|
|
1826
1838
|
true,
|
|
1827
|
-
args.
|
|
1839
|
+
args.runtimeMetrics
|
|
1828
1840
|
);
|
|
1829
1841
|
}
|
|
1830
1842
|
async function updateTurnState(args) {
|
|
@@ -1840,14 +1852,11 @@ async function updateTurnState(args) {
|
|
|
1840
1852
|
piMessages: args.existing.piMessages,
|
|
1841
1853
|
piMessageProvenance: args.existing.piMessageProvenance,
|
|
1842
1854
|
ttlMs: turnCursorTtlMs(args.state),
|
|
1843
|
-
|
|
1855
|
+
runtimeMetrics: {
|
|
1844
1856
|
cumulativeDurationMs: args.existing.cumulativeDurationMs,
|
|
1845
1857
|
...definedProps({
|
|
1846
1858
|
channelName: args.existing.channelName,
|
|
1847
|
-
cumulativeUsage: args.existing.cumulativeUsage
|
|
1848
|
-
loadedSkillNames: args.existing.loadedSkillNames,
|
|
1849
|
-
modelId: args.existing.modelId,
|
|
1850
|
-
reasoningLevel: args.existing.reasoningLevel
|
|
1859
|
+
cumulativeUsage: args.existing.cumulativeUsage
|
|
1851
1860
|
})
|
|
1852
1861
|
},
|
|
1853
1862
|
...definedProps({
|
|
@@ -1930,15 +1939,12 @@ async function upsertTurnRecordLocked(args, fence) {
|
|
|
1930
1939
|
piMessages: commit.messages,
|
|
1931
1940
|
piMessageProvenance: commit.provenance,
|
|
1932
1941
|
ttlMs,
|
|
1933
|
-
//
|
|
1934
|
-
//
|
|
1935
|
-
|
|
1942
|
+
// Checkpoint commit also updates conversation execution metrics in SQL.
|
|
1943
|
+
// Channel/duration/usage are not Redis resume-cursor fields.
|
|
1944
|
+
runtimeMetrics: {
|
|
1936
1945
|
channelName: args.channelName ?? conversation?.channelName,
|
|
1937
1946
|
cumulativeDurationMs: args.cumulativeDurationMs ?? executionMetrics?.durationMs ?? 0,
|
|
1938
|
-
cumulativeUsage: args.cumulativeUsage ?? executionMetrics?.usage
|
|
1939
|
-
loadedSkillNames: args.loadedSkillNames,
|
|
1940
|
-
modelId: args.modelId,
|
|
1941
|
-
reasoningLevel: args.reasoningLevel
|
|
1947
|
+
cumulativeUsage: args.cumulativeUsage ?? executionMetrics?.usage
|
|
1942
1948
|
},
|
|
1943
1949
|
// Pass through only an explicit override so indexes stay on the resume window
|
|
1944
1950
|
// by default even when the record takes a short terminal TTL.
|
|
@@ -2167,7 +2173,6 @@ async function saveTurnCheckpoint(args) {
|
|
|
2167
2173
|
function sharedWrite(args, latest) {
|
|
2168
2174
|
return {
|
|
2169
2175
|
conversationId: args.conversationId,
|
|
2170
|
-
modelId: args.modelId,
|
|
2171
2176
|
turnId: args.turnId,
|
|
2172
2177
|
...definedProps2({
|
|
2173
2178
|
actor: args.actor,
|
|
@@ -2175,8 +2180,6 @@ function sharedWrite(args, latest) {
|
|
|
2175
2180
|
destination: args.destination,
|
|
2176
2181
|
destinationVisibility: args.destinationVisibility,
|
|
2177
2182
|
dispatchId: args.dispatchId ?? latest?.dispatchId,
|
|
2178
|
-
loadedSkillNames: args.loadedSkillNames,
|
|
2179
|
-
reasoningLevel: args.reasoningLevel,
|
|
2180
2183
|
source: args.source,
|
|
2181
2184
|
surface: args.surface ?? latest?.surface,
|
|
2182
2185
|
traceId: getActiveTraceId() ?? latest?.traceId,
|
|
@@ -2304,473 +2307,6 @@ async function saveDone(args) {
|
|
|
2304
2307
|
});
|
|
2305
2308
|
}
|
|
2306
2309
|
|
|
2307
|
-
// src/chat/state/conversation.ts
|
|
2308
|
-
function defaultConversationState() {
|
|
2309
|
-
return {
|
|
2310
|
-
schemaVersion: 1,
|
|
2311
|
-
messages: [],
|
|
2312
|
-
compactions: [],
|
|
2313
|
-
processing: {},
|
|
2314
|
-
vision: {
|
|
2315
|
-
byFileId: {}
|
|
2316
|
-
}
|
|
2317
|
-
};
|
|
2318
|
-
}
|
|
2319
|
-
function coercePendingAuthState(value) {
|
|
2320
|
-
if (!isRecord(value)) {
|
|
2321
|
-
return void 0;
|
|
2322
|
-
}
|
|
2323
|
-
const kind = value.kind;
|
|
2324
|
-
const provider = toOptionalString(value.provider);
|
|
2325
|
-
const actorId = toOptionalString(value.actorId);
|
|
2326
|
-
const authSessionId = toOptionalString(value.authSessionId);
|
|
2327
|
-
const scope = toOptionalString(value.scope);
|
|
2328
|
-
const sessionId = toOptionalString(value.sessionId);
|
|
2329
|
-
const linkSentAtMs = toOptionalNumber(value.linkSentAtMs);
|
|
2330
|
-
if (kind !== "mcp" && kind !== "plugin" || !provider || !actorId || kind === "mcp" && !authSessionId || !sessionId || typeof linkSentAtMs !== "number") {
|
|
2331
|
-
return void 0;
|
|
2332
|
-
}
|
|
2333
|
-
const base = {
|
|
2334
|
-
provider,
|
|
2335
|
-
actorId,
|
|
2336
|
-
...scope ? { scope } : {},
|
|
2337
|
-
sessionId,
|
|
2338
|
-
linkSentAtMs
|
|
2339
|
-
};
|
|
2340
|
-
return kind === "mcp" ? { ...base, authSessionId, kind } : { ...base, kind };
|
|
2341
|
-
}
|
|
2342
|
-
function coerceThreadConversationState(value) {
|
|
2343
|
-
if (!isRecord(value)) {
|
|
2344
|
-
return defaultConversationState();
|
|
2345
|
-
}
|
|
2346
|
-
const root = value;
|
|
2347
|
-
const rawConversation = isRecord(root.conversation) ? root.conversation : {};
|
|
2348
|
-
const messages = [];
|
|
2349
|
-
const compactions = [];
|
|
2350
|
-
const rawProcessing = isRecord(rawConversation.processing) ? rawConversation.processing : {};
|
|
2351
|
-
const processing = {
|
|
2352
|
-
activeTurnId: toOptionalString(rawProcessing.activeTurnId),
|
|
2353
|
-
lastCompletedAtMs: toOptionalNumber(rawProcessing.lastCompletedAtMs),
|
|
2354
|
-
pendingAuth: coercePendingAuthState(rawProcessing.pendingAuth)
|
|
2355
|
-
};
|
|
2356
|
-
const rawVision = isRecord(rawConversation.vision) ? rawConversation.vision : {};
|
|
2357
|
-
const rawVisionByFileId = isRecord(rawVision.byFileId) ? rawVision.byFileId : {};
|
|
2358
|
-
const byFileId = {};
|
|
2359
|
-
for (const [fileId, value2] of Object.entries(rawVisionByFileId)) {
|
|
2360
|
-
if (typeof fileId !== "string" || fileId.trim().length === 0) continue;
|
|
2361
|
-
if (!isRecord(value2)) continue;
|
|
2362
|
-
const summary = toOptionalString(value2.summary);
|
|
2363
|
-
const analyzedAtMs = toOptionalNumber(value2.analyzedAtMs);
|
|
2364
|
-
if (!summary || !analyzedAtMs) continue;
|
|
2365
|
-
byFileId[fileId] = {
|
|
2366
|
-
summary,
|
|
2367
|
-
analyzedAtMs
|
|
2368
|
-
};
|
|
2369
|
-
}
|
|
2370
|
-
return {
|
|
2371
|
-
schemaVersion: 1,
|
|
2372
|
-
messages,
|
|
2373
|
-
compactions,
|
|
2374
|
-
processing,
|
|
2375
|
-
vision: {
|
|
2376
|
-
backfillCompletedAtMs: toOptionalNumber(rawVision.backfillCompletedAtMs),
|
|
2377
|
-
byFileId
|
|
2378
|
-
}
|
|
2379
|
-
};
|
|
2380
|
-
}
|
|
2381
|
-
function buildConversationStatePatch(conversation) {
|
|
2382
|
-
return {
|
|
2383
|
-
conversation: {
|
|
2384
|
-
schemaVersion: 1,
|
|
2385
|
-
processing: { ...conversation.processing },
|
|
2386
|
-
vision: {
|
|
2387
|
-
backfillCompletedAtMs: conversation.vision.backfillCompletedAtMs,
|
|
2388
|
-
byFileId: { ...conversation.vision.byFileId }
|
|
2389
|
-
}
|
|
2390
|
-
}
|
|
2391
|
-
};
|
|
2392
|
-
}
|
|
2393
|
-
|
|
2394
|
-
// src/chat/state/artifacts.ts
|
|
2395
|
-
function coerceThreadArtifactsState(value) {
|
|
2396
|
-
if (!value || typeof value !== "object") {
|
|
2397
|
-
return {};
|
|
2398
|
-
}
|
|
2399
|
-
const raw = value;
|
|
2400
|
-
const artifacts = raw.artifacts ?? {};
|
|
2401
|
-
const listColumnMap = artifacts.listColumnMap ?? {};
|
|
2402
|
-
const recentCanvases = [];
|
|
2403
|
-
if (Array.isArray(artifacts.recentCanvases)) {
|
|
2404
|
-
for (const entry of artifacts.recentCanvases) {
|
|
2405
|
-
if (!entry || typeof entry !== "object") {
|
|
2406
|
-
continue;
|
|
2407
|
-
}
|
|
2408
|
-
const candidate = entry;
|
|
2409
|
-
if (typeof candidate.id !== "string" || candidate.id.trim().length === 0) {
|
|
2410
|
-
continue;
|
|
2411
|
-
}
|
|
2412
|
-
recentCanvases.push({
|
|
2413
|
-
id: candidate.id,
|
|
2414
|
-
title: typeof candidate.title === "string" ? candidate.title : void 0,
|
|
2415
|
-
url: typeof candidate.url === "string" ? candidate.url : void 0,
|
|
2416
|
-
createdAt: typeof candidate.createdAt === "string" ? candidate.createdAt : void 0
|
|
2417
|
-
});
|
|
2418
|
-
}
|
|
2419
|
-
}
|
|
2420
|
-
return {
|
|
2421
|
-
assistantContextChannelId: typeof artifacts.assistantContextChannelId === "string" ? artifacts.assistantContextChannelId : void 0,
|
|
2422
|
-
assistantTitle: typeof artifacts.assistantTitle === "string" ? artifacts.assistantTitle : void 0,
|
|
2423
|
-
assistantTitleSourceMessageId: typeof artifacts.assistantTitleSourceMessageId === "string" ? artifacts.assistantTitleSourceMessageId : void 0,
|
|
2424
|
-
lastCanvasId: typeof artifacts.lastCanvasId === "string" ? artifacts.lastCanvasId : void 0,
|
|
2425
|
-
lastCanvasUrl: typeof artifacts.lastCanvasUrl === "string" ? artifacts.lastCanvasUrl : void 0,
|
|
2426
|
-
recentCanvases,
|
|
2427
|
-
lastListId: typeof artifacts.lastListId === "string" ? artifacts.lastListId : void 0,
|
|
2428
|
-
lastListUrl: typeof artifacts.lastListUrl === "string" ? artifacts.lastListUrl : void 0,
|
|
2429
|
-
listColumnMap: {
|
|
2430
|
-
titleColumnId: typeof listColumnMap.titleColumnId === "string" ? listColumnMap.titleColumnId : void 0,
|
|
2431
|
-
completedColumnId: typeof listColumnMap.completedColumnId === "string" ? listColumnMap.completedColumnId : void 0,
|
|
2432
|
-
assigneeColumnId: typeof listColumnMap.assigneeColumnId === "string" ? listColumnMap.assigneeColumnId : void 0,
|
|
2433
|
-
dueDateColumnId: typeof listColumnMap.dueDateColumnId === "string" ? listColumnMap.dueDateColumnId : void 0
|
|
2434
|
-
},
|
|
2435
|
-
updatedAt: typeof artifacts.updatedAt === "string" ? artifacts.updatedAt : void 0
|
|
2436
|
-
};
|
|
2437
|
-
}
|
|
2438
|
-
function buildArtifactStatePatch(patch) {
|
|
2439
|
-
return {
|
|
2440
|
-
artifacts: {
|
|
2441
|
-
...patch,
|
|
2442
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
2443
|
-
}
|
|
2444
|
-
};
|
|
2445
|
-
}
|
|
2446
|
-
|
|
2447
|
-
// src/chat/configuration/validation.ts
|
|
2448
|
-
var CONFIG_KEY_RE = /^[a-z0-9]+(?:\.[a-z0-9-]+)+$/;
|
|
2449
|
-
var SECRET_KEY_RE = /(?:^|[_.-])(token|secret|password|passphrase|api[-_]?key|private[-_]?key|credential|auth)(?:$|[_.-])/i;
|
|
2450
|
-
var SECRET_VALUE_PATTERNS = [
|
|
2451
|
-
/\bBearer\s+[A-Za-z0-9._-]{16,}\b/i,
|
|
2452
|
-
/-----BEGIN [A-Z ]*PRIVATE KEY-----/,
|
|
2453
|
-
/\b(?:ghp|ghs|github_pat)_[A-Za-z0-9_]{20,}\b/,
|
|
2454
|
-
/\bxox[baprs]-[A-Za-z0-9-]{10,}\b/i,
|
|
2455
|
-
/\bsk-[A-Za-z0-9]{20,}\b/,
|
|
2456
|
-
/\bAIza[0-9A-Za-z\-_]{30,}\b/,
|
|
2457
|
-
/\bAKIA[0-9A-Z]{16}\b/,
|
|
2458
|
-
/\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/
|
|
2459
|
-
];
|
|
2460
|
-
function validateConfigKey(key) {
|
|
2461
|
-
const trimmed = key.trim();
|
|
2462
|
-
if (!trimmed) {
|
|
2463
|
-
return "Configuration key must not be empty";
|
|
2464
|
-
}
|
|
2465
|
-
if (!CONFIG_KEY_RE.test(trimmed)) {
|
|
2466
|
-
return `Invalid configuration key "${key}"; expected dotted lowercase namespace (for example "provider.repo")`;
|
|
2467
|
-
}
|
|
2468
|
-
if (SECRET_KEY_RE.test(trimmed)) {
|
|
2469
|
-
return `Configuration key "${key}" appears to be secret-related and is not allowed`;
|
|
2470
|
-
}
|
|
2471
|
-
return void 0;
|
|
2472
|
-
}
|
|
2473
|
-
function collectStringValues(value, output, depth = 0) {
|
|
2474
|
-
if (depth > 5) {
|
|
2475
|
-
return;
|
|
2476
|
-
}
|
|
2477
|
-
if (typeof value === "string") {
|
|
2478
|
-
output.push(value);
|
|
2479
|
-
return;
|
|
2480
|
-
}
|
|
2481
|
-
if (Array.isArray(value)) {
|
|
2482
|
-
for (const item of value) {
|
|
2483
|
-
collectStringValues(item, output, depth + 1);
|
|
2484
|
-
}
|
|
2485
|
-
return;
|
|
2486
|
-
}
|
|
2487
|
-
if (value && typeof value === "object") {
|
|
2488
|
-
for (const [key, nested] of Object.entries(
|
|
2489
|
-
value
|
|
2490
|
-
)) {
|
|
2491
|
-
output.push(key);
|
|
2492
|
-
collectStringValues(nested, output, depth + 1);
|
|
2493
|
-
}
|
|
2494
|
-
}
|
|
2495
|
-
}
|
|
2496
|
-
function validateConfigValue(value) {
|
|
2497
|
-
const stringValues = [];
|
|
2498
|
-
collectStringValues(value, stringValues);
|
|
2499
|
-
for (const text of stringValues) {
|
|
2500
|
-
for (const pattern of SECRET_VALUE_PATTERNS) {
|
|
2501
|
-
if (pattern.test(text)) {
|
|
2502
|
-
return "Configuration value appears to contain secret material and is not allowed";
|
|
2503
|
-
}
|
|
2504
|
-
}
|
|
2505
|
-
}
|
|
2506
|
-
return void 0;
|
|
2507
|
-
}
|
|
2508
|
-
|
|
2509
|
-
// src/chat/configuration/service.ts
|
|
2510
|
-
function defaultState() {
|
|
2511
|
-
return {
|
|
2512
|
-
schemaVersion: 1,
|
|
2513
|
-
entries: {}
|
|
2514
|
-
};
|
|
2515
|
-
}
|
|
2516
|
-
function sanitizeEntry(value) {
|
|
2517
|
-
if (!isRecord(value)) {
|
|
2518
|
-
return void 0;
|
|
2519
|
-
}
|
|
2520
|
-
const key = toOptionalString(value.key);
|
|
2521
|
-
if (!key) {
|
|
2522
|
-
return void 0;
|
|
2523
|
-
}
|
|
2524
|
-
if (validateConfigKey(key)) {
|
|
2525
|
-
return void 0;
|
|
2526
|
-
}
|
|
2527
|
-
const updatedAt = toOptionalString(value.updatedAt);
|
|
2528
|
-
if (!updatedAt) {
|
|
2529
|
-
return void 0;
|
|
2530
|
-
}
|
|
2531
|
-
if (value.scope !== "channel" && value.scope !== "conversation") {
|
|
2532
|
-
return void 0;
|
|
2533
|
-
}
|
|
2534
|
-
const scope = "conversation";
|
|
2535
|
-
return {
|
|
2536
|
-
key,
|
|
2537
|
-
value: value.value,
|
|
2538
|
-
scope,
|
|
2539
|
-
updatedAt,
|
|
2540
|
-
updatedBy: toOptionalString(value.updatedBy),
|
|
2541
|
-
source: toOptionalString(value.source),
|
|
2542
|
-
expiresAt: toOptionalString(value.expiresAt)
|
|
2543
|
-
};
|
|
2544
|
-
}
|
|
2545
|
-
function coerceState(raw) {
|
|
2546
|
-
if (!isRecord(raw)) {
|
|
2547
|
-
return defaultState();
|
|
2548
|
-
}
|
|
2549
|
-
const rawConfig = isRecord(raw.configuration) ? raw.configuration : {};
|
|
2550
|
-
const rawEntries = isRecord(rawConfig.entries) ? rawConfig.entries : {};
|
|
2551
|
-
const entries = {};
|
|
2552
|
-
for (const [key, value] of Object.entries(rawEntries)) {
|
|
2553
|
-
const entry = sanitizeEntry(value);
|
|
2554
|
-
if (!entry) {
|
|
2555
|
-
continue;
|
|
2556
|
-
}
|
|
2557
|
-
entries[key] = entry;
|
|
2558
|
-
}
|
|
2559
|
-
return {
|
|
2560
|
-
schemaVersion: 1,
|
|
2561
|
-
entries
|
|
2562
|
-
};
|
|
2563
|
-
}
|
|
2564
|
-
function createChannelConfigurationService(storage) {
|
|
2565
|
-
const getState = async () => {
|
|
2566
|
-
const loaded = await storage.load();
|
|
2567
|
-
return coerceState(loaded);
|
|
2568
|
-
};
|
|
2569
|
-
const saveState = async (state) => {
|
|
2570
|
-
await storage.save({
|
|
2571
|
-
schemaVersion: 1,
|
|
2572
|
-
entries: state.entries
|
|
2573
|
-
});
|
|
2574
|
-
};
|
|
2575
|
-
const get = async (key) => {
|
|
2576
|
-
const normalizedKey = key.trim();
|
|
2577
|
-
const state = await getState();
|
|
2578
|
-
return state.entries[normalizedKey];
|
|
2579
|
-
};
|
|
2580
|
-
const set = async (input) => {
|
|
2581
|
-
const normalizedKey = input.key.trim();
|
|
2582
|
-
const keyError = validateConfigKey(normalizedKey);
|
|
2583
|
-
if (keyError) {
|
|
2584
|
-
throw new Error(keyError);
|
|
2585
|
-
}
|
|
2586
|
-
const valueError = validateConfigValue(input.value);
|
|
2587
|
-
if (valueError) {
|
|
2588
|
-
throw new Error(valueError);
|
|
2589
|
-
}
|
|
2590
|
-
const state = await getState();
|
|
2591
|
-
const nextEntry = {
|
|
2592
|
-
key: normalizedKey,
|
|
2593
|
-
value: input.value,
|
|
2594
|
-
scope: "conversation",
|
|
2595
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2596
|
-
updatedBy: toOptionalString(input.updatedBy),
|
|
2597
|
-
source: toOptionalString(input.source),
|
|
2598
|
-
expiresAt: toOptionalString(input.expiresAt)
|
|
2599
|
-
};
|
|
2600
|
-
state.entries[normalizedKey] = nextEntry;
|
|
2601
|
-
await saveState(state);
|
|
2602
|
-
return nextEntry;
|
|
2603
|
-
};
|
|
2604
|
-
const unset = async (key) => {
|
|
2605
|
-
const normalizedKey = key.trim();
|
|
2606
|
-
const state = await getState();
|
|
2607
|
-
if (!state.entries[normalizedKey]) {
|
|
2608
|
-
return false;
|
|
2609
|
-
}
|
|
2610
|
-
delete state.entries[normalizedKey];
|
|
2611
|
-
await saveState(state);
|
|
2612
|
-
return true;
|
|
2613
|
-
};
|
|
2614
|
-
const list = async (options = {}) => {
|
|
2615
|
-
const state = await getState();
|
|
2616
|
-
const prefix = options.prefix?.trim();
|
|
2617
|
-
return Object.values(state.entries).filter((entry) => prefix ? entry.key.startsWith(prefix) : true).sort((a, b) => a.key.localeCompare(b.key));
|
|
2618
|
-
};
|
|
2619
|
-
const resolve = async (key) => {
|
|
2620
|
-
const entry = await get(key);
|
|
2621
|
-
return entry?.value;
|
|
2622
|
-
};
|
|
2623
|
-
const resolveValues = async (options = {}) => {
|
|
2624
|
-
const keys = Array.isArray(options.keys) ? options.keys.map((entry) => entry.trim()).filter((entry) => entry.length > 0) : void 0;
|
|
2625
|
-
const entries = options.prefix ? await list({ prefix: options.prefix }) : await list({});
|
|
2626
|
-
const filtered = keys ? entries.filter((entry) => keys.includes(entry.key)) : entries;
|
|
2627
|
-
const resolved = {};
|
|
2628
|
-
for (const entry of filtered) {
|
|
2629
|
-
resolved[entry.key] = entry.value;
|
|
2630
|
-
}
|
|
2631
|
-
return resolved;
|
|
2632
|
-
};
|
|
2633
|
-
return {
|
|
2634
|
-
get,
|
|
2635
|
-
set,
|
|
2636
|
-
unset,
|
|
2637
|
-
list,
|
|
2638
|
-
resolve,
|
|
2639
|
-
resolveValues
|
|
2640
|
-
};
|
|
2641
|
-
}
|
|
2642
|
-
|
|
2643
|
-
// src/chat/runtime/thread-state.ts
|
|
2644
|
-
function threadStateKey(threadId) {
|
|
2645
|
-
return `thread-state:${threadId}`;
|
|
2646
|
-
}
|
|
2647
|
-
function channelStateKey(channelId) {
|
|
2648
|
-
return `channel-state:${channelId}`;
|
|
2649
|
-
}
|
|
2650
|
-
function buildThreadStatePayload(patch) {
|
|
2651
|
-
const payload = {};
|
|
2652
|
-
if (patch.artifacts) {
|
|
2653
|
-
Object.assign(payload, buildArtifactStatePatch(patch.artifacts));
|
|
2654
|
-
}
|
|
2655
|
-
if (patch.conversation) {
|
|
2656
|
-
Object.assign(payload, buildConversationStatePatch(patch.conversation));
|
|
2657
|
-
}
|
|
2658
|
-
if (patch.sandboxRef !== void 0) {
|
|
2659
|
-
payload.app_sandbox_id = patch.sandboxRef?.id ?? "";
|
|
2660
|
-
payload.app_sandbox_dependency_profile_hash = patch.sandboxRef?.profileHash ?? "";
|
|
2661
|
-
}
|
|
2662
|
-
return payload;
|
|
2663
|
-
}
|
|
2664
|
-
async function mergePersistedState(key, payload) {
|
|
2665
|
-
if (Object.keys(payload).length === 0) {
|
|
2666
|
-
return;
|
|
2667
|
-
}
|
|
2668
|
-
const stateAdapter = getStateAdapter();
|
|
2669
|
-
await stateAdapter.connect();
|
|
2670
|
-
const existing = await stateAdapter.get(key) ?? {};
|
|
2671
|
-
await stateAdapter.set(
|
|
2672
|
-
key,
|
|
2673
|
-
{ ...existing, ...payload },
|
|
2674
|
-
JUNIOR_THREAD_STATE_TTL_MS
|
|
2675
|
-
);
|
|
2676
|
-
}
|
|
2677
|
-
function mergeArtifactsState(artifacts, patch) {
|
|
2678
|
-
if (!patch) {
|
|
2679
|
-
return artifacts;
|
|
2680
|
-
}
|
|
2681
|
-
return {
|
|
2682
|
-
...artifacts,
|
|
2683
|
-
...patch,
|
|
2684
|
-
listColumnMap: {
|
|
2685
|
-
...artifacts.listColumnMap,
|
|
2686
|
-
...patch.listColumnMap
|
|
2687
|
-
}
|
|
2688
|
-
};
|
|
2689
|
-
}
|
|
2690
|
-
function getPersistedSandboxState(state) {
|
|
2691
|
-
const id = toOptionalString(state.app_sandbox_id);
|
|
2692
|
-
if (!id) {
|
|
2693
|
-
return void 0;
|
|
2694
|
-
}
|
|
2695
|
-
const profileHash = toOptionalString(
|
|
2696
|
-
state.app_sandbox_dependency_profile_hash
|
|
2697
|
-
);
|
|
2698
|
-
return {
|
|
2699
|
-
id,
|
|
2700
|
-
...profileHash ? { profileHash } : {}
|
|
2701
|
-
};
|
|
2702
|
-
}
|
|
2703
|
-
async function persistThreadState(thread, patch) {
|
|
2704
|
-
if (patch.conversation) {
|
|
2705
|
-
await persistConversationMessages({
|
|
2706
|
-
conversation: patch.conversation,
|
|
2707
|
-
conversationId: toOptionalString(thread.id) ?? toOptionalString(thread.runId)
|
|
2708
|
-
});
|
|
2709
|
-
}
|
|
2710
|
-
await persistThreadRuntimeState(thread, patch);
|
|
2711
|
-
}
|
|
2712
|
-
async function persistThreadRuntimeState(thread, patch) {
|
|
2713
|
-
const threadId = toOptionalString(thread.id) ?? toOptionalString(thread.runId);
|
|
2714
|
-
if (!threadId) {
|
|
2715
|
-
throw new Error("thread id is required to persist runtime scratch");
|
|
2716
|
-
}
|
|
2717
|
-
await mergePersistedState(
|
|
2718
|
-
threadStateKey(threadId),
|
|
2719
|
-
buildThreadStatePayload(patch)
|
|
2720
|
-
);
|
|
2721
|
-
}
|
|
2722
|
-
async function getPersistedThreadState(threadId) {
|
|
2723
|
-
const stateAdapter = getStateAdapter();
|
|
2724
|
-
await stateAdapter.connect();
|
|
2725
|
-
return await stateAdapter.get(
|
|
2726
|
-
threadStateKey(threadId)
|
|
2727
|
-
) ?? {};
|
|
2728
|
-
}
|
|
2729
|
-
async function getPersistedChannelState(channelId) {
|
|
2730
|
-
const stateAdapter = getStateAdapter();
|
|
2731
|
-
await stateAdapter.connect();
|
|
2732
|
-
return await stateAdapter.get(
|
|
2733
|
-
channelStateKey(channelId)
|
|
2734
|
-
) ?? {};
|
|
2735
|
-
}
|
|
2736
|
-
async function persistThreadStateById(threadId, patch) {
|
|
2737
|
-
if (patch.conversation) {
|
|
2738
|
-
await persistConversationMessages({
|
|
2739
|
-
conversation: patch.conversation,
|
|
2740
|
-
conversationId: threadId
|
|
2741
|
-
});
|
|
2742
|
-
}
|
|
2743
|
-
await mergePersistedState(
|
|
2744
|
-
threadStateKey(threadId),
|
|
2745
|
-
buildThreadStatePayload(patch)
|
|
2746
|
-
);
|
|
2747
|
-
}
|
|
2748
|
-
function getChannelConfigurationService(thread) {
|
|
2749
|
-
const channel = thread.channel;
|
|
2750
|
-
const channelId = toOptionalString(thread.channelId) ?? toOptionalString(channel.id);
|
|
2751
|
-
if (!channelId) {
|
|
2752
|
-
throw new Error("channel id is required to load channel configuration");
|
|
2753
|
-
}
|
|
2754
|
-
return createChannelConfigurationService({
|
|
2755
|
-
load: async () => await channel.state,
|
|
2756
|
-
save: async (state) => {
|
|
2757
|
-
await mergePersistedState(channelStateKey(channelId), {
|
|
2758
|
-
configuration: state
|
|
2759
|
-
});
|
|
2760
|
-
}
|
|
2761
|
-
});
|
|
2762
|
-
}
|
|
2763
|
-
function getChannelConfigurationServiceById(channelId) {
|
|
2764
|
-
return createChannelConfigurationService({
|
|
2765
|
-
load: async () => await getPersistedChannelState(channelId),
|
|
2766
|
-
save: async (state) => {
|
|
2767
|
-
await mergePersistedState(channelStateKey(channelId), {
|
|
2768
|
-
configuration: state
|
|
2769
|
-
});
|
|
2770
|
-
}
|
|
2771
|
-
});
|
|
2772
|
-
}
|
|
2773
|
-
|
|
2774
2310
|
// src/chat/services/pending-auth.ts
|
|
2775
2311
|
var AUTH_LINK_REUSE_WINDOW_MS = 10 * 60 * 1e3;
|
|
2776
2312
|
var NON_REQUEST_SKIPPED_REASON_PREFIXES = [
|
|
@@ -2866,6 +2402,7 @@ export {
|
|
|
2866
2402
|
recordAuthorizationCompleted,
|
|
2867
2403
|
recordAuthenticationLinked,
|
|
2868
2404
|
recordAgentsInstructionsUpdated,
|
|
2405
|
+
recordSubscribedReplyRoute,
|
|
2869
2406
|
loadTurnRoute,
|
|
2870
2407
|
recordTurnRoute,
|
|
2871
2408
|
recordToolExecutionStarted,
|
|
@@ -2925,15 +2462,5 @@ export {
|
|
|
2925
2462
|
getConversationPendingAuth,
|
|
2926
2463
|
clearPendingAuth,
|
|
2927
2464
|
abandonReplacedPendingAuth,
|
|
2928
|
-
isPendingAuthLatestRequest
|
|
2929
|
-
coerceThreadConversationState,
|
|
2930
|
-
coerceThreadArtifactsState,
|
|
2931
|
-
mergeArtifactsState,
|
|
2932
|
-
getPersistedSandboxState,
|
|
2933
|
-
persistThreadState,
|
|
2934
|
-
persistThreadRuntimeState,
|
|
2935
|
-
getPersistedThreadState,
|
|
2936
|
-
persistThreadStateById,
|
|
2937
|
-
getChannelConfigurationService,
|
|
2938
|
-
getChannelConfigurationServiceById
|
|
2465
|
+
isPendingAuthLatestRequest
|
|
2939
2466
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getDb
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YSB2N563.js";
|
|
4
4
|
import {
|
|
5
5
|
juniorConversations,
|
|
6
6
|
juniorTaskExecutions
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-DU74WPIC.js";
|
|
8
8
|
import {
|
|
9
9
|
logWarn
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-4LJO56OJ.js";
|
|
11
11
|
|
|
12
12
|
// src/chat/tasks/execution-stats.ts
|
|
13
13
|
import {
|
|
@@ -4,18 +4,18 @@ import {
|
|
|
4
4
|
} from "./chunk-EM225ITJ.js";
|
|
5
5
|
import {
|
|
6
6
|
getStateAdapter
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ORO3PWKQ.js";
|
|
8
8
|
import {
|
|
9
9
|
toOptionalTrimmed
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-7NVJVJID.js";
|
|
11
11
|
import {
|
|
12
12
|
pluginCatalogRuntime
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-JUUKWRBE.js";
|
|
14
14
|
import {
|
|
15
15
|
setSpanAttributes,
|
|
16
16
|
setSpanStatus,
|
|
17
17
|
withSpan
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-4LJO56OJ.js";
|
|
19
19
|
|
|
20
20
|
// src/chat/sandbox/resources.ts
|
|
21
21
|
var configuredResources;
|