@sentry/junior 0.147.0 → 0.149.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-HS6VGUPM.js → agent-hooks-CWMCXAMT.js} +10 -10
- package/dist/api/conversations/access.d.ts +2 -1
- package/dist/api/conversations/aggregate.d.ts +2 -0
- package/dist/api/conversations/archive.d.ts +3 -5
- package/dist/api/conversations/create.d.ts +6 -0
- package/dist/api/conversations/detail.d.ts +2 -296
- package/dist/api/conversations/event-list.d.ts +2 -193
- package/dist/api/conversations/list.d.ts +4 -66
- package/dist/api/conversations/pending-messages.d.ts +15 -0
- package/dist/api/conversations/routes.d.ts +1 -1
- package/dist/api/conversations/stats.d.ts +0 -54
- package/dist/api/http.d.ts +2 -6
- package/dist/api/locations/detail.d.ts +3 -111
- package/dist/api/locations/list.d.ts +0 -45
- package/dist/api/locations/query.d.ts +2 -1
- package/dist/api/locations/routes.d.ts +1 -1
- package/dist/api/people/list.d.ts +0 -29
- package/dist/api/people/profile.d.ts +2 -106
- package/dist/api/people/profile.query.d.ts +2 -1
- package/dist/api/people/routes.d.ts +1 -1
- package/dist/api/people/shared.d.ts +3 -1
- package/dist/api/people/spend.d.ts +3 -4
- package/dist/api/personal-tokens/routes.d.ts +2 -2
- package/dist/api/route.d.ts +8 -14
- package/dist/api/schema/conversation.d.ts +130 -25
- package/dist/api/schema/location.d.ts +4 -0
- package/dist/api/schema/person.d.ts +7 -3
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +13 -1
- package/dist/api/stats.d.ts +0 -13
- package/dist/api/validation.d.ts +7 -0
- package/dist/api/viewer.d.ts +3 -0
- package/dist/api.d.ts +2 -1
- package/dist/api.js +772 -561
- package/dist/app.js +241 -204
- package/dist/{catalog-runtime-M6ZTPYRV.js → catalog-runtime-GAW5APVI.js} +5 -5
- package/dist/chat/actor.d.ts +4 -1
- package/dist/chat/agent/request.d.ts +2 -0
- package/dist/chat/agent/resume.d.ts +1 -0
- package/dist/chat/agent-dispatch/context.d.ts +2 -2
- package/dist/chat/agent-invocations/types.d.ts +52 -0
- package/dist/chat/api-turns/work.d.ts +108 -0
- package/dist/chat/app/services.d.ts +1 -1
- package/dist/chat/conversations/history.d.ts +60 -0
- package/dist/chat/conversations/provenance.d.ts +6 -0
- package/dist/chat/conversations/sql/actor-identity.d.ts +19 -0
- package/dist/chat/conversations/store.d.ts +1 -1
- package/dist/chat/resource-events/store.d.ts +1 -1
- package/dist/chat/runtime/reply-executor.d.ts +1 -3
- package/dist/chat/runtime/slack-runtime.d.ts +2 -1
- package/dist/chat/runtime/turn-preparation.d.ts +9 -0
- package/dist/chat/scheduled-tasks/tool-support.d.ts +5 -5
- package/dist/chat/scheduled-tasks/tools/create.d.ts +2 -2
- package/dist/chat/scheduled-tasks/tools/delete.d.ts +2 -2
- package/dist/chat/scheduled-tasks/tools/list.d.ts +2 -2
- package/dist/chat/scheduled-tasks/tools/run-now.d.ts +2 -2
- package/dist/chat/scheduled-tasks/tools/update.d.ts +2 -2
- package/dist/chat/services/conversation-memory.d.ts +2 -2
- package/dist/chat/services/conversation-title.d.ts +20 -0
- package/dist/chat/slack/assistant-thread/title.d.ts +10 -27
- package/dist/chat/slack/channel.d.ts +26 -0
- package/dist/chat/slack/dispatch-turn.d.ts +1 -0
- package/dist/chat/slack/timestamp-param.d.ts +0 -2
- package/dist/chat/slack/{tools → tool-support}/canvas/api.d.ts +1 -1
- package/dist/chat/slack/{tools → tool-support}/canvas/context.d.ts +3 -0
- package/dist/chat/slack/tool-support/channel-access.d.ts +42 -0
- package/dist/chat/slack/tool-support/channel-target.d.ts +27 -0
- package/dist/chat/slack/tool-support/list/params.d.ts +5 -0
- package/dist/chat/slack/tools/canvas/create.d.ts +1 -1
- package/dist/chat/slack/tools/channel-join.d.ts +28 -0
- package/dist/chat/slack/tools/channel-list-messages.d.ts +3 -2
- package/dist/chat/slack/tools/conversation-message-search.d.ts +2 -8
- package/dist/chat/slack/tools/message-add-reaction.d.ts +1 -1
- package/dist/chat/slack/tools/public-search.d.ts +63 -2
- package/dist/chat/slack/tools/send-files.d.ts +1 -1
- package/dist/chat/slack/tools/thread-read.d.ts +2 -5
- package/dist/chat/source.d.ts +2 -0
- package/dist/chat/state/conversation.d.ts +1 -0
- package/dist/chat/task-execution/checkpoint.d.ts +1 -0
- package/dist/chat/task-execution/state.d.ts +9 -4
- package/dist/chat/task-execution/store.d.ts +3 -2
- package/dist/chat/task-execution/turn-cursor.d.ts +2 -0
- package/dist/chat/task-execution/worker.d.ts +2 -0
- package/dist/chat/tasks/read.d.ts +1 -1
- package/dist/chat/tools/search-conversation-events.d.ts +1 -1
- package/dist/chat/tools/types.d.ts +11 -4
- package/dist/chat/tools/watch-resource-events.d.ts +2 -2
- package/dist/{chunk-ORO3PWKQ.js → chunk-25SC7D6Z.js} +1 -1
- package/dist/{chunk-GGB4WL5A.js → chunk-2JHKISQA.js} +1 -1
- package/dist/{chunk-AVZDSUFB.js → chunk-2P6BQQER.js} +4 -4
- package/dist/{chunk-7NVJVJID.js → chunk-32CXPIZE.js} +2 -2
- package/dist/{chunk-YSB2N563.js → chunk-3GYZ5YEH.js} +121 -87
- package/dist/{chunk-DU74WPIC.js → chunk-3I2IVWSZ.js} +1 -1
- package/dist/{chunk-SVHUEHUL.js → chunk-3JVUWLR7.js} +65 -4
- package/dist/{chunk-RXBVB2JM.js → chunk-3KGQOKIG.js} +1 -1
- package/dist/{chunk-YBVXBNSV.js → chunk-4JGM7FXO.js} +2 -2
- package/dist/{chunk-AZ7EAOBE.js → chunk-4YKPOYRV.js} +5 -5
- package/dist/chunk-5CWUQXXT.js +806 -0
- package/dist/{chunk-DLDRQHG5.js → chunk-6G5RCDKP.js} +1 -1
- package/dist/{chunk-AYU72WO7.js → chunk-75DSYFFB.js} +47 -70
- package/dist/{chunk-YHDERDRO.js → chunk-7BH46NB4.js} +91 -75
- package/dist/{chunk-745QJ3ZA.js → chunk-ALJG73MQ.js} +2 -2
- package/dist/chunk-ART7P442.js +48 -0
- package/dist/{chunk-7A4M7PCV.js → chunk-DK5UT6PQ.js} +1180 -556
- package/dist/{chunk-AIOK6LAG.js → chunk-EW2LNCRL.js} +813 -44
- package/dist/chunk-EXW76GW4.js +36 -0
- package/dist/chunk-GDFF3BQG.js +136 -0
- package/dist/{chunk-7UQIVT6G.js → chunk-JMH3DBM5.js} +6 -6
- package/dist/{chunk-CWP5RHVX.js → chunk-JMSMXXED.js} +12 -5
- package/dist/{chunk-CSZINQJ2.js → chunk-MEMURSBG.js} +1 -1
- package/dist/{chunk-YNTTROJT.js → chunk-QIW7OQEO.js} +1 -1
- package/dist/{chunk-Q4R73I43.js → chunk-RB26T3LU.js} +58 -28
- package/dist/{chunk-4LJO56OJ.js → chunk-RLVZIWNQ.js} +1 -1
- package/dist/{chunk-SGZO7UWH.js → chunk-SWHPVZBV.js} +2 -2
- package/dist/{chunk-PVNG6UMU.js → chunk-TFBNBXPU.js} +22 -10
- package/dist/{chunk-EFLJ2WJH.js → chunk-URDCZAL4.js} +5 -5
- package/dist/{chunk-6H5SZR24.js → chunk-UZGASGOD.js} +300 -383
- package/dist/{chunk-YEO3VX72.js → chunk-W7UONUIZ.js} +8 -6
- package/dist/{chunk-JUUKWRBE.js → chunk-X22XXSZA.js} +1 -1
- package/dist/{chunk-X5UY34KT.js → chunk-XPYWWMHR.js} +8 -8
- package/dist/{chunk-IIOOO4FQ.js → chunk-ZYMYLLWG.js} +2 -1
- package/dist/cli/chat.js +32 -35
- 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/agent-invocations.d.ts +20 -0
- package/dist/db/schema/conversation-annotations.d.ts +2 -2
- package/dist/db/schema.d.ts +22 -2
- package/dist/{db-CSEW4RII.js → db-JBZLRIVY.js} +7 -7
- package/dist/instrumentation.js +4 -4
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-FUEV5HNG.js → oauth-callback-server-MNTVYY2I.js} +24 -26
- package/dist/{runner-U3XHSKSH.js → runner-K24BWZSZ.js} +23 -25
- package/dist/{skills-AKE6W3WI.js → skills-AU5ST2CG.js} +6 -6
- package/dist/spawn-6PO7CVJ6.js +38 -0
- package/dist/{validation-WDTAULUF.js → validation-IXGZCFRO.js} +6 -6
- package/dist/version.js +1 -1
- package/dist/{work-C3HAO2BG.js → work-WCZIYILX.js} +18 -19
- package/dist/{worker-LNP4YKBM.js → worker-U2AACBEY.js} +11 -10
- package/package.json +6 -5
- package/dist/api/health.d.ts +0 -7
- package/dist/api/personal-tokens/create.d.ts +0 -11
- package/dist/api/personal-tokens/list.d.ts +0 -12
- package/dist/api/personal-tokens/revoke.d.ts +0 -5
- package/dist/api/plugin-reports.d.ts +0 -63
- package/dist/api/plugins.d.ts +0 -8
- package/dist/api/runtime.d.ts +0 -24
- package/dist/api/skills.d.ts +0 -6
- package/dist/chat/slack/tools/channel-access.d.ts +0 -30
- package/dist/chunk-34GS7B6L.js +0 -115
- package/dist/chunk-AVOCH2Z5.js +0 -285
- package/dist/chunk-HLXXQI5Q.js +0 -238
- package/dist/chunk-K4SZAP3K.js +0 -67
- package/dist/chunk-R776HKPK.js +0 -81
- package/dist/chunk-Z4YU7Z4L.js +0 -76
- package/dist/spawn-B6GDTWJ4.js +0 -39
- /package/dist/chat/slack/{tools → tool-support}/canvas/markdown.d.ts +0 -0
- /package/dist/chat/slack/{tools → tool-support}/channel-capabilities.d.ts +0 -0
- /package/dist/chat/slack/{tools → tool-support}/context.d.ts +0 -0
- /package/dist/chat/slack/{tools → tool-support}/list/api.d.ts +0 -0
- /package/dist/chat/slack/{tools → tool-support}/slack-message-url.d.ts +0 -0
package/dist/app.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
processConversationWork
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TFBNBXPU.js";
|
|
4
4
|
import {
|
|
5
5
|
bindSpawnAgent
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ALJG73MQ.js";
|
|
7
7
|
import {
|
|
8
8
|
createAgentInvocationWorker,
|
|
9
9
|
enqueueAgentInvocation,
|
|
10
10
|
listPendingAgentInvocationMailboxAppends,
|
|
11
11
|
routeAgentInvocationWork
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-W7UONUIZ.js";
|
|
13
13
|
import {
|
|
14
14
|
GET as GET2,
|
|
15
15
|
GET2 as GET3,
|
|
@@ -25,21 +25,36 @@ import {
|
|
|
25
25
|
getSlackErrorObservabilityAttributes,
|
|
26
26
|
getThreadId,
|
|
27
27
|
getThreadTs,
|
|
28
|
-
getTurnRequestDeadline,
|
|
29
28
|
isRetryableSlackPostError,
|
|
30
29
|
isSlackTitlePermissionError,
|
|
31
30
|
publishAppHomeView,
|
|
32
31
|
receiveLocalOAuthCredential,
|
|
33
32
|
resumeSlackTurn,
|
|
34
|
-
runWithTurnRequestDeadline,
|
|
35
33
|
sendSlackReply,
|
|
36
34
|
shouldKeepProcessingReactionForToolInvocation,
|
|
37
35
|
splitSlackReplyText,
|
|
38
36
|
startSlackProcessingReaction,
|
|
39
37
|
stripLeadingBotMention,
|
|
40
38
|
wakePausedTurn
|
|
41
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-75DSYFFB.js";
|
|
42
40
|
import "./chunk-FA6POGLH.js";
|
|
41
|
+
import {
|
|
42
|
+
getTurnRequestDeadline,
|
|
43
|
+
runWithTurnRequestDeadline
|
|
44
|
+
} from "./chunk-EXW76GW4.js";
|
|
45
|
+
import {
|
|
46
|
+
completeAuthPauseTurn,
|
|
47
|
+
persistAuthPauseTurnState
|
|
48
|
+
} from "./chunk-ART7P442.js";
|
|
49
|
+
import {
|
|
50
|
+
GET,
|
|
51
|
+
conversationVisibilityFromSlackChannelType,
|
|
52
|
+
createApiTurnWorker,
|
|
53
|
+
resolveSlackChannelTypeFromMessage,
|
|
54
|
+
resolveSlackConversationContext,
|
|
55
|
+
routeApiTurnWork
|
|
56
|
+
} from "./chunk-5CWUQXXT.js";
|
|
57
|
+
import "./chunk-4CODA7P5.js";
|
|
43
58
|
import {
|
|
44
59
|
CONVERSATION_WORK_STALE_ENQUEUE_MS,
|
|
45
60
|
appendAndEnqueueInboundMessage,
|
|
@@ -50,48 +65,36 @@ import {
|
|
|
50
65
|
isInvalidConversationRecordError,
|
|
51
66
|
listActiveConversationIds,
|
|
52
67
|
removeActiveConversation
|
|
53
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-JMSMXXED.js";
|
|
54
69
|
import {
|
|
55
|
-
buildConversationContext,
|
|
56
70
|
buildDeliveredTurnStatePatch,
|
|
57
71
|
claimDispatchMailboxAppend,
|
|
58
|
-
completeAuthPauseTurn,
|
|
59
72
|
confirmDispatchMailboxAppend,
|
|
60
|
-
createConversationMemoryService,
|
|
61
73
|
createOrGetDispatch,
|
|
62
|
-
estimateConversationContextTokens,
|
|
63
74
|
finalizeFailedTurnReplyWithEvent,
|
|
64
75
|
getAgentTurnDiagnosticsAttributes,
|
|
65
|
-
getConversationMessageSlackTs,
|
|
66
76
|
getDispatchConversationId,
|
|
67
77
|
getDispatchInputMessageId,
|
|
68
78
|
getDispatchInputMessageIds,
|
|
69
79
|
getDispatchRecord,
|
|
70
80
|
getDispatchTurnId,
|
|
71
81
|
getPluginDispatchProjection,
|
|
72
|
-
getThreadTitleSourceMessage,
|
|
73
82
|
getTurnUserMessage,
|
|
74
83
|
getTurnUserReplyAttachmentContext,
|
|
75
84
|
getTurnUserSlackMessageTs,
|
|
76
|
-
isHumanConversationMessage,
|
|
77
85
|
isTerminalDispatchStatus,
|
|
78
86
|
listPendingDispatchMailboxAppends,
|
|
79
|
-
markConversationMessage,
|
|
80
87
|
markDispatchAwaitingResume,
|
|
81
88
|
markDispatchBlocked,
|
|
82
89
|
markDispatchCompleted,
|
|
83
90
|
markDispatchFailed,
|
|
84
91
|
markDispatchRunning,
|
|
85
|
-
normalizeConversationText,
|
|
86
|
-
persistAuthPauseTurnState,
|
|
87
92
|
processPluginTask,
|
|
88
|
-
|
|
93
|
+
recordTaskExecution,
|
|
89
94
|
requireTurnFailureEventId,
|
|
90
95
|
resolveTurnSessionRouting,
|
|
91
|
-
scheduleSessionCompletedPluginTasks
|
|
92
|
-
|
|
93
|
-
upsertConversationMessage
|
|
94
|
-
} from "./chunk-6H5SZR24.js";
|
|
96
|
+
scheduleSessionCompletedPluginTasks
|
|
97
|
+
} from "./chunk-UZGASGOD.js";
|
|
95
98
|
import {
|
|
96
99
|
ConversationTurnLifecycleService,
|
|
97
100
|
coerceThreadConversationState,
|
|
@@ -101,17 +104,7 @@ import {
|
|
|
101
104
|
persistThreadRuntimeState,
|
|
102
105
|
persistThreadState,
|
|
103
106
|
persistThreadStateById
|
|
104
|
-
} from "./chunk-
|
|
105
|
-
import {
|
|
106
|
-
GET,
|
|
107
|
-
conversationVisibilityFromSlackChannelType,
|
|
108
|
-
resolveSlackChannelTypeFromMessage,
|
|
109
|
-
resolveSlackConversationContext
|
|
110
|
-
} from "./chunk-34GS7B6L.js";
|
|
111
|
-
import "./chunk-4CODA7P5.js";
|
|
112
|
-
import {
|
|
113
|
-
recordTaskExecution
|
|
114
|
-
} from "./chunk-AVOCH2Z5.js";
|
|
107
|
+
} from "./chunk-4YKPOYRV.js";
|
|
115
108
|
import "./chunk-UTL3MHPC.js";
|
|
116
109
|
import {
|
|
117
110
|
getVercelConversationWorkQueue,
|
|
@@ -130,7 +123,7 @@ import {
|
|
|
130
123
|
import {
|
|
131
124
|
validatePluginEgressCredentialHooks,
|
|
132
125
|
validatePluginRegistrations
|
|
133
|
-
} from "./chunk-
|
|
126
|
+
} from "./chunk-QIW7OQEO.js";
|
|
134
127
|
import {
|
|
135
128
|
defineJuniorPlugins,
|
|
136
129
|
pluginCatalogConfigFromEnv,
|
|
@@ -163,88 +156,95 @@ import {
|
|
|
163
156
|
setConfigDefaults,
|
|
164
157
|
shouldEmitDevAgentTrace,
|
|
165
158
|
shouldPropagateSandboxEgressTrace
|
|
166
|
-
} from "./chunk-
|
|
159
|
+
} from "./chunk-DK5UT6PQ.js";
|
|
167
160
|
import {
|
|
168
161
|
AuthorizationFlowDisabledError,
|
|
169
162
|
PluginCredentialFailureError
|
|
170
|
-
} from "./chunk-
|
|
163
|
+
} from "./chunk-XPYWWMHR.js";
|
|
171
164
|
import "./chunk-DIB4GX3G.js";
|
|
172
165
|
import {
|
|
173
166
|
createUserTokenStore,
|
|
174
167
|
deleteMcpAuthSessionsForUserProvider,
|
|
175
168
|
deleteMcpServerSessionId,
|
|
176
169
|
deleteMcpStoredOAuthCredentials
|
|
177
|
-
} from "./chunk-
|
|
170
|
+
} from "./chunk-RB26T3LU.js";
|
|
178
171
|
import {
|
|
179
172
|
RetryableDeliveryError
|
|
180
|
-
} from "./chunk-
|
|
173
|
+
} from "./chunk-GDFF3BQG.js";
|
|
181
174
|
import {
|
|
182
175
|
formatProviderLabel,
|
|
183
176
|
postSlackMessage,
|
|
184
177
|
startOAuthFlow
|
|
185
|
-
} from "./chunk-
|
|
178
|
+
} from "./chunk-JMH3DBM5.js";
|
|
179
|
+
import "./chunk-HUO3UTAQ.js";
|
|
186
180
|
import {
|
|
187
|
-
|
|
188
|
-
|
|
181
|
+
getExperimentalFeatures,
|
|
182
|
+
setExperimentalFeatures
|
|
183
|
+
} from "./chunk-5IDFPCON.js";
|
|
184
|
+
import {
|
|
185
|
+
getSandboxResourceConfig,
|
|
186
|
+
setSandboxResourceConfig
|
|
187
|
+
} from "./chunk-2P6BQQER.js";
|
|
188
|
+
import {
|
|
189
|
+
createSchedulerSqlStore,
|
|
190
|
+
findMatchingEventTasks,
|
|
191
|
+
logScheduledTaskRunSkipped,
|
|
192
|
+
scheduledTaskRunAttributes
|
|
193
|
+
} from "./chunk-URDCZAL4.js";
|
|
194
|
+
import {
|
|
195
|
+
parseSlackThreadId
|
|
196
|
+
} from "./chunk-MEMURSBG.js";
|
|
189
197
|
import {
|
|
190
198
|
ConversationTurnBoundaryError,
|
|
191
199
|
CooperativeTurnYieldError,
|
|
192
200
|
TurnInputCommitLostError,
|
|
193
201
|
TurnInputDeferredError,
|
|
194
202
|
abandonTurnRecord,
|
|
203
|
+
buildConversationContext,
|
|
195
204
|
buildDeterministicAssistantMessageId,
|
|
196
205
|
buildDeterministicTurnId,
|
|
197
206
|
clearPendingAuth,
|
|
198
207
|
commitAcceptedReply,
|
|
199
208
|
commitMessages,
|
|
200
209
|
completeTurnRecord,
|
|
210
|
+
createConversationMemoryService,
|
|
211
|
+
estimateConversationContextTokens,
|
|
212
|
+
estimateTextTokens,
|
|
201
213
|
failTurnRecord,
|
|
202
214
|
getAssistantReplyText,
|
|
215
|
+
getConversationMessageSlackTs,
|
|
203
216
|
getConversationTurnBoundaryError,
|
|
204
217
|
getTurnRecord,
|
|
205
218
|
getTurnRecordForResume,
|
|
206
219
|
hydrateConversationMessages,
|
|
207
220
|
isCooperativeTurnYieldError,
|
|
221
|
+
isHumanConversationMessage,
|
|
208
222
|
isTurnInputCommitLostError,
|
|
209
223
|
isTurnInputDeferredError,
|
|
210
224
|
listTurnSummaries,
|
|
211
225
|
loadConversationProjection,
|
|
212
226
|
loadProjection,
|
|
213
227
|
loadTurnCheckpoint,
|
|
228
|
+
markConversationMessage,
|
|
214
229
|
markTurnClosed,
|
|
215
230
|
markTurnCompleted,
|
|
216
231
|
markTurnFailed,
|
|
232
|
+
normalizeConversationText,
|
|
217
233
|
persistConversationMessageSummaries,
|
|
218
234
|
persistConversationMessages,
|
|
219
235
|
persistWithRetry,
|
|
236
|
+
recordDeliveredAssistantMessage,
|
|
220
237
|
recordSubscribedReplyRoute,
|
|
221
238
|
recordTurnSummary,
|
|
239
|
+
resolveConversationTitle,
|
|
222
240
|
saveTurnCheckpoint,
|
|
223
241
|
startActiveTurn,
|
|
224
242
|
stripRuntimeTurnContext,
|
|
225
|
-
trimTrailingAssistantMessages
|
|
226
|
-
|
|
243
|
+
trimTrailingAssistantMessages,
|
|
244
|
+
turnHasReply,
|
|
245
|
+
upsertConversationMessage
|
|
246
|
+
} from "./chunk-EW2LNCRL.js";
|
|
227
247
|
import "./chunk-3Y47VMHV.js";
|
|
228
|
-
import "./chunk-HUO3UTAQ.js";
|
|
229
|
-
import {
|
|
230
|
-
getExperimentalFeatures,
|
|
231
|
-
setExperimentalFeatures
|
|
232
|
-
} from "./chunk-5IDFPCON.js";
|
|
233
|
-
import {
|
|
234
|
-
getSandboxResourceConfig,
|
|
235
|
-
setSandboxResourceConfig
|
|
236
|
-
} from "./chunk-AVZDSUFB.js";
|
|
237
|
-
import {
|
|
238
|
-
createSchedulerSqlStore,
|
|
239
|
-
findMatchingEventTasks,
|
|
240
|
-
logScheduledTaskRunSkipped,
|
|
241
|
-
scheduledTaskRunAttributes
|
|
242
|
-
} from "./chunk-EFLJ2WJH.js";
|
|
243
|
-
import {
|
|
244
|
-
parseSlackThreadId
|
|
245
|
-
} from "./chunk-CSZINQJ2.js";
|
|
246
|
-
import "./chunk-Z4YU7Z4L.js";
|
|
247
|
-
import "./chunk-HLXXQI5Q.js";
|
|
248
248
|
import "./chunk-PDO5BLNM.js";
|
|
249
249
|
import "./chunk-UIE3R5XU.js";
|
|
250
250
|
import {
|
|
@@ -263,7 +263,7 @@ import {
|
|
|
263
263
|
verifyEventTaskCredentialSubject,
|
|
264
264
|
verifyScheduledTaskCredentialSubject,
|
|
265
265
|
verifySlackDirectCredentialSubject
|
|
266
|
-
} from "./chunk-
|
|
266
|
+
} from "./chunk-7BH46NB4.js";
|
|
267
267
|
import {
|
|
268
268
|
SlackActionError,
|
|
269
269
|
downloadPrivateSlackFile,
|
|
@@ -273,7 +273,7 @@ import {
|
|
|
273
273
|
normalizeSlackConversationId,
|
|
274
274
|
runWithSlackInstallationToken,
|
|
275
275
|
runWithWorkspaceTeamId
|
|
276
|
-
} from "./chunk-
|
|
276
|
+
} from "./chunk-SWHPVZBV.js";
|
|
277
277
|
import {
|
|
278
278
|
contextProvenance,
|
|
279
279
|
createSlackDestination,
|
|
@@ -286,19 +286,19 @@ import {
|
|
|
286
286
|
requireSlackDestination,
|
|
287
287
|
withConversationEventLock,
|
|
288
288
|
withConversationMutationLock
|
|
289
|
-
} from "./chunk-
|
|
289
|
+
} from "./chunk-3GYZ5YEH.js";
|
|
290
290
|
import {
|
|
291
291
|
juniorAgentBindings,
|
|
292
292
|
juniorAgentInvocations,
|
|
293
293
|
juniorConversationEvents,
|
|
294
294
|
juniorConversations
|
|
295
|
-
} from "./chunk-
|
|
295
|
+
} from "./chunk-3I2IVWSZ.js";
|
|
296
296
|
import "./chunk-EM225ITJ.js";
|
|
297
297
|
import {
|
|
298
298
|
acquireActiveLock,
|
|
299
299
|
getStateAdapter,
|
|
300
300
|
withActiveLock
|
|
301
|
-
} from "./chunk-
|
|
301
|
+
} from "./chunk-25SC7D6Z.js";
|
|
302
302
|
import {
|
|
303
303
|
STANDARD_MODEL_PROFILE,
|
|
304
304
|
botConfig,
|
|
@@ -316,16 +316,16 @@ import {
|
|
|
316
316
|
modelIdForProfile,
|
|
317
317
|
setSlackReactionConfig,
|
|
318
318
|
standardModelId
|
|
319
|
-
} from "./chunk-
|
|
319
|
+
} from "./chunk-32CXPIZE.js";
|
|
320
320
|
import {
|
|
321
321
|
juniorDestinations
|
|
322
322
|
} from "./chunk-VFUK3X5B.js";
|
|
323
|
-
import "./chunk-
|
|
324
|
-
import "./chunk-
|
|
323
|
+
import "./chunk-3KGQOKIG.js";
|
|
324
|
+
import "./chunk-4JGM7FXO.js";
|
|
325
325
|
import {
|
|
326
326
|
pluginCatalogRuntime
|
|
327
|
-
} from "./chunk-
|
|
328
|
-
import "./chunk-
|
|
327
|
+
} from "./chunk-X22XXSZA.js";
|
|
328
|
+
import "./chunk-2JHKISQA.js";
|
|
329
329
|
import {
|
|
330
330
|
credentialContextForActor
|
|
331
331
|
} from "./chunk-RUIXF3YQ.js";
|
|
@@ -359,7 +359,7 @@ import {
|
|
|
359
359
|
withContext,
|
|
360
360
|
withLogContext,
|
|
361
361
|
withSpan
|
|
362
|
-
} from "./chunk-
|
|
362
|
+
} from "./chunk-RLVZIWNQ.js";
|
|
363
363
|
import {
|
|
364
364
|
continueTrace
|
|
365
365
|
} from "./chunk-6GWA276C.js";
|
|
@@ -367,10 +367,10 @@ import "./chunk-OOUNJNMR.js";
|
|
|
367
367
|
import "./chunk-H4HBKISO.js";
|
|
368
368
|
import {
|
|
369
369
|
JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE
|
|
370
|
-
} from "./chunk-
|
|
370
|
+
} from "./chunk-6G5RCDKP.js";
|
|
371
371
|
import {
|
|
372
372
|
JUNIOR_VERSION
|
|
373
|
-
} from "./chunk-
|
|
373
|
+
} from "./chunk-ZYMYLLWG.js";
|
|
374
374
|
import "./chunk-MLKGABMK.js";
|
|
375
375
|
|
|
376
376
|
// src/app.ts
|
|
@@ -474,6 +474,7 @@ function buildAgentDispatchInboundMessage(dispatch2, nowMs = Date.now()) {
|
|
|
474
474
|
}
|
|
475
475
|
},
|
|
476
476
|
receivedAtMs: nowMs,
|
|
477
|
+
publishExternally: true,
|
|
477
478
|
source: "plugin"
|
|
478
479
|
};
|
|
479
480
|
}
|
|
@@ -1214,13 +1215,23 @@ var SCHEDULE_FREQUENCY_COPY = {
|
|
|
1214
1215
|
function singleLineMetadataValue(value) {
|
|
1215
1216
|
return value.replace(/[\r\n]+/g, " ").replace(/\s+/g, " ").trim();
|
|
1216
1217
|
}
|
|
1218
|
+
function buildDispatchInput(task) {
|
|
1219
|
+
const creator = sanitizeScheduledTaskPrincipal(task.createdBy);
|
|
1220
|
+
return [
|
|
1221
|
+
"You are executing a scheduled task.",
|
|
1222
|
+
"",
|
|
1223
|
+
"Task:",
|
|
1224
|
+
`- creator: <@${creator.slackUserId}>`,
|
|
1225
|
+
"",
|
|
1226
|
+
"Stored user instruction:",
|
|
1227
|
+
task.task.text
|
|
1228
|
+
].join("\n");
|
|
1229
|
+
}
|
|
1217
1230
|
function buildDispatchMetadata(args) {
|
|
1218
|
-
const creator = sanitizeScheduledTaskPrincipal(args.task.createdBy);
|
|
1219
1231
|
if (!args.task.task.text?.trim()) {
|
|
1220
1232
|
throw new Error("Scheduled task text is required");
|
|
1221
1233
|
}
|
|
1222
1234
|
return {
|
|
1223
|
-
creatorSlackUserId: creator.slackUserId,
|
|
1224
1235
|
runId: args.run.id,
|
|
1225
1236
|
schedule: singleLineMetadataValue(args.task.schedule.description),
|
|
1226
1237
|
scheduleKind: args.task.schedule.kind,
|
|
@@ -1507,7 +1518,7 @@ async function runScheduledTaskHeartbeat(args) {
|
|
|
1507
1518
|
} : {},
|
|
1508
1519
|
destination: task.destination,
|
|
1509
1520
|
destinationVisibility: task.conversationAccess.visibility,
|
|
1510
|
-
input: task
|
|
1521
|
+
input: buildDispatchInput(task),
|
|
1511
1522
|
metadata,
|
|
1512
1523
|
replyAttribution: replyAttribution(task),
|
|
1513
1524
|
source: dispatchSource(task)
|
|
@@ -2976,6 +2987,7 @@ function createSlackResourceEventInboundMessage(input) {
|
|
|
2976
2987
|
delivery: "defer",
|
|
2977
2988
|
source: "resource_event",
|
|
2978
2989
|
receivedAtMs: Date.now(),
|
|
2990
|
+
publishExternally: true,
|
|
2979
2991
|
input: {
|
|
2980
2992
|
text: input.text,
|
|
2981
2993
|
authorId: RESOURCE_EVENT_SLACK_AUTHOR_ID,
|
|
@@ -3180,7 +3192,9 @@ function createSlackConversationWorker(options) {
|
|
|
3180
3192
|
};
|
|
3181
3193
|
const drainSteeringMessages = async (accept) => {
|
|
3182
3194
|
await context.attempt.drain(async (pendingRecords) => {
|
|
3183
|
-
const candidates = pendingRecords.
|
|
3195
|
+
const candidates = pendingRecords.filter(
|
|
3196
|
+
(record) => record.publishExternally === context.publishExternally
|
|
3197
|
+
).map((record) => ({
|
|
3184
3198
|
inboundMessageId: record.inboundMessageId,
|
|
3185
3199
|
message: restoreMessage({ adapter, record })
|
|
3186
3200
|
})).filter(
|
|
@@ -3194,6 +3208,7 @@ function createSlackConversationWorker(options) {
|
|
|
3194
3208
|
await options.runtime.handleNewMention(thread, latestMessage, {
|
|
3195
3209
|
conversationId: context.conversationId,
|
|
3196
3210
|
destination,
|
|
3211
|
+
publishExternally: context.publishExternally,
|
|
3197
3212
|
messageContext,
|
|
3198
3213
|
drainSteeringMessages,
|
|
3199
3214
|
ack,
|
|
@@ -3207,6 +3222,7 @@ function createSlackConversationWorker(options) {
|
|
|
3207
3222
|
{
|
|
3208
3223
|
conversationId: context.conversationId,
|
|
3209
3224
|
destination,
|
|
3225
|
+
publishExternally: context.publishExternally,
|
|
3210
3226
|
messageContext,
|
|
3211
3227
|
drainSteeringMessages,
|
|
3212
3228
|
ack,
|
|
@@ -3258,6 +3274,7 @@ function buildSlackInboundMessage(args) {
|
|
|
3258
3274
|
source: "slack",
|
|
3259
3275
|
createdAtMs: args.message.metadata.dateSent.getTime(),
|
|
3260
3276
|
receivedAtMs: args.receivedAtMs,
|
|
3277
|
+
publishExternally: true,
|
|
3261
3278
|
input: {
|
|
3262
3279
|
text: args.message.text || " ",
|
|
3263
3280
|
authorId,
|
|
@@ -4800,6 +4817,9 @@ function buildLogContext(deps, args) {
|
|
|
4800
4817
|
function actorUserName(message) {
|
|
4801
4818
|
return getMessageActorIdentity(message)?.userName;
|
|
4802
4819
|
}
|
|
4820
|
+
function shouldPublishExternally(publishExternally) {
|
|
4821
|
+
return publishExternally !== false;
|
|
4822
|
+
}
|
|
4803
4823
|
function createSlackTurnRuntime(deps) {
|
|
4804
4824
|
const logContext = (args) => buildLogContext(deps, args);
|
|
4805
4825
|
const maybeHandleThreadOptOutDecision = async (args) => {
|
|
@@ -5113,6 +5133,7 @@ function createSlackTurnRuntime(deps) {
|
|
|
5113
5133
|
conversationId: hooks.conversationId,
|
|
5114
5134
|
destination: hooks.destination,
|
|
5115
5135
|
queuedMessages,
|
|
5136
|
+
publishExternally: shouldPublishExternally(hooks.publishExternally),
|
|
5116
5137
|
ack,
|
|
5117
5138
|
onToolInvocation: toolInvocationHook,
|
|
5118
5139
|
onTurnCompleted,
|
|
@@ -5170,11 +5191,13 @@ function createSlackTurnRuntime(deps) {
|
|
|
5170
5191
|
lifecycleError = error2;
|
|
5171
5192
|
}
|
|
5172
5193
|
await hooks.beforeFirstResponsePost?.();
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5194
|
+
if (shouldPublishExternally(hooks.publishExternally)) {
|
|
5195
|
+
await postFallbackErrorReplyWithLogging({
|
|
5196
|
+
thread,
|
|
5197
|
+
eventId,
|
|
5198
|
+
postFailureEventName: "mention.handler.failure_reply_post.failed"
|
|
5199
|
+
});
|
|
5200
|
+
}
|
|
5178
5201
|
if (lifecycleError) throw lifecycleError;
|
|
5179
5202
|
} finally {
|
|
5180
5203
|
if (completed) {
|
|
@@ -5374,6 +5397,7 @@ function createSlackTurnRuntime(deps) {
|
|
|
5374
5397
|
conversationId: hooks.conversationId,
|
|
5375
5398
|
destination: hooks.destination,
|
|
5376
5399
|
preparedState,
|
|
5400
|
+
publishExternally: shouldPublishExternally(hooks.publishExternally),
|
|
5377
5401
|
beforeFirstResponsePost: hooks.beforeFirstResponsePost,
|
|
5378
5402
|
queuedMessages,
|
|
5379
5403
|
ack,
|
|
@@ -5436,11 +5460,13 @@ function createSlackTurnRuntime(deps) {
|
|
|
5436
5460
|
lifecycleError = error2;
|
|
5437
5461
|
}
|
|
5438
5462
|
await hooks.beforeFirstResponsePost?.();
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
|
|
5442
|
-
|
|
5443
|
-
|
|
5463
|
+
if (shouldPublishExternally(hooks.publishExternally)) {
|
|
5464
|
+
await postFallbackErrorReplyWithLogging({
|
|
5465
|
+
thread,
|
|
5466
|
+
eventId,
|
|
5467
|
+
postFailureEventName: "subscribed_message.handler.failure_reply_post.failed"
|
|
5468
|
+
});
|
|
5469
|
+
}
|
|
5444
5470
|
if (lifecycleError) throw lifecycleError;
|
|
5445
5471
|
} finally {
|
|
5446
5472
|
if (completed) {
|
|
@@ -5996,8 +6022,7 @@ function createJuniorRuntimeServices(overrides = {}) {
|
|
|
5996
6022
|
scheduleSessionCompletedPluginTasks: overrides.replyExecutor?.scheduleSessionCompletedPluginTasks ?? (async (params) => {
|
|
5997
6023
|
await scheduleSessionCompletedPluginTasks(params);
|
|
5998
6024
|
}),
|
|
5999
|
-
turnLifecycle: overrides.replyExecutor?.turnLifecycle ?? new ConversationTurnLifecycleService(getConversationEventStore())
|
|
6000
|
-
generateThreadTitle: conversationMemory.generateThreadTitle
|
|
6025
|
+
turnLifecycle: overrides.replyExecutor?.turnLifecycle ?? new ConversationTurnLifecycleService(getConversationEventStore())
|
|
6001
6026
|
},
|
|
6002
6027
|
subscribedReplyPolicy: createSubscribedReplyPolicy({
|
|
6003
6028
|
completeObject: overrides.subscribedReplyPolicy?.completeObject ?? completeObject
|
|
@@ -6041,56 +6066,44 @@ function readSlackActionToken(message) {
|
|
|
6041
6066
|
}
|
|
6042
6067
|
|
|
6043
6068
|
// src/chat/slack/assistant-thread/title.ts
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
const
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
"app.slack.assistant_title.error_code": slackErrorCode
|
|
6077
|
-
} : {}
|
|
6078
|
-
};
|
|
6079
|
-
if (isSlackTitlePermissionError(error)) {
|
|
6080
|
-
setSpanAttributes(assistantTitleErrorAttributes);
|
|
6081
|
-
logError(
|
|
6082
|
-
"thread.title.generation_permission.denied",
|
|
6083
|
-
assistantTitleErrorAttributes
|
|
6084
|
-
);
|
|
6085
|
-
} else {
|
|
6086
|
-
logWarn("thread.title.slack_update.failed", {
|
|
6087
|
-
"exception.message": error instanceof Error ? error.message : String(error)
|
|
6088
|
-
});
|
|
6089
|
-
}
|
|
6090
|
-
}
|
|
6069
|
+
var projectedAssistantTitles = /* @__PURE__ */ new Set();
|
|
6070
|
+
function assistantTitleKey(channelId, threadTs) {
|
|
6071
|
+
return `${channelId}:${threadTs}`;
|
|
6072
|
+
}
|
|
6073
|
+
async function maybeSyncAssistantTitle(args) {
|
|
6074
|
+
const channelId = args.channelId;
|
|
6075
|
+
const threadTs = args.threadTs;
|
|
6076
|
+
if (!channelId || !threadTs || !isDmChannel(channelId)) {
|
|
6077
|
+
return;
|
|
6078
|
+
}
|
|
6079
|
+
const key = assistantTitleKey(channelId, threadTs);
|
|
6080
|
+
if (projectedAssistantTitles.has(key)) {
|
|
6081
|
+
return;
|
|
6082
|
+
}
|
|
6083
|
+
projectedAssistantTitles.add(key);
|
|
6084
|
+
try {
|
|
6085
|
+
await args.getSlackAdapter().setAssistantTitle(channelId, threadTs, args.title);
|
|
6086
|
+
} catch (error) {
|
|
6087
|
+
const slackErrorCode = getSlackApiErrorCode(error);
|
|
6088
|
+
if (isSlackTitlePermissionError(error)) {
|
|
6089
|
+
const assistantTitleErrorAttributes = {
|
|
6090
|
+
"app.slack.assistant_title.outcome": "permission_denied",
|
|
6091
|
+
...slackErrorCode ? {
|
|
6092
|
+
"app.slack.assistant_title.error_code": slackErrorCode
|
|
6093
|
+
} : {}
|
|
6094
|
+
};
|
|
6095
|
+
setSpanAttributes(assistantTitleErrorAttributes);
|
|
6096
|
+
logError(
|
|
6097
|
+
"thread.title.generation_permission.denied",
|
|
6098
|
+
assistantTitleErrorAttributes
|
|
6099
|
+
);
|
|
6100
|
+
return;
|
|
6091
6101
|
}
|
|
6092
|
-
|
|
6093
|
-
|
|
6102
|
+
projectedAssistantTitles.delete(key);
|
|
6103
|
+
logWarn("thread.title.slack_update.failed", {
|
|
6104
|
+
"exception.message": error instanceof Error ? error.message : String(error)
|
|
6105
|
+
});
|
|
6106
|
+
}
|
|
6094
6107
|
}
|
|
6095
6108
|
|
|
6096
6109
|
// src/chat/services/provider-default-config.ts
|
|
@@ -6240,6 +6253,9 @@ async function loadPiMessagesForTurn(args) {
|
|
|
6240
6253
|
}
|
|
6241
6254
|
return {};
|
|
6242
6255
|
}
|
|
6256
|
+
function shouldPublishExternally2(publishExternally) {
|
|
6257
|
+
return publishExternally !== false;
|
|
6258
|
+
}
|
|
6243
6259
|
function createReplyToThread(deps) {
|
|
6244
6260
|
return async function replyToThread(thread, message, options) {
|
|
6245
6261
|
if (message.author.isMe) {
|
|
@@ -6376,6 +6392,9 @@ function createReplyToThread(deps) {
|
|
|
6376
6392
|
);
|
|
6377
6393
|
try {
|
|
6378
6394
|
await beforeFirstResponsePost();
|
|
6395
|
+
if (!shouldPublishExternally2(options.publishExternally)) {
|
|
6396
|
+
return;
|
|
6397
|
+
}
|
|
6379
6398
|
if (channelId && threadTs) {
|
|
6380
6399
|
await sendSlackReply({
|
|
6381
6400
|
channelId,
|
|
@@ -6570,7 +6589,9 @@ function createReplyToThread(deps) {
|
|
|
6570
6589
|
});
|
|
6571
6590
|
if (configReply) {
|
|
6572
6591
|
await beforeFirstResponsePost();
|
|
6573
|
-
|
|
6592
|
+
if (shouldPublishExternally2(options.publishExternally)) {
|
|
6593
|
+
await thread.post(buildSlackOutputMessage(configReply.text));
|
|
6594
|
+
}
|
|
6574
6595
|
markConversationMessage(
|
|
6575
6596
|
preparedState.conversation,
|
|
6576
6597
|
preparedState.userMessageId,
|
|
@@ -6737,19 +6758,21 @@ function createReplyToThread(deps) {
|
|
|
6737
6758
|
let slackMessageTs2 = [];
|
|
6738
6759
|
await beforeFirstResponsePost();
|
|
6739
6760
|
try {
|
|
6740
|
-
if (
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
|
|
6750
|
-
const
|
|
6751
|
-
|
|
6752
|
-
|
|
6761
|
+
if (shouldPublishExternally2(options.publishExternally)) {
|
|
6762
|
+
if (channelId && thread.adapter.name === "slack") {
|
|
6763
|
+
slackMessageTs2 = await sendSlackReply({
|
|
6764
|
+
channelId,
|
|
6765
|
+
conversationId,
|
|
6766
|
+
replyAttribution: options.execution?.dispatch?.replyAttribution,
|
|
6767
|
+
text,
|
|
6768
|
+
...threadTs ? { threadTs } : {}
|
|
6769
|
+
});
|
|
6770
|
+
} else {
|
|
6771
|
+
for (const part of splitSlackReplyText(text)) {
|
|
6772
|
+
const postedMessageTs = (await thread.post(buildSlackOutputMessage(part))).id;
|
|
6773
|
+
if (postedMessageTs) {
|
|
6774
|
+
slackMessageTs2.push(postedMessageTs);
|
|
6775
|
+
}
|
|
6753
6776
|
}
|
|
6754
6777
|
}
|
|
6755
6778
|
}
|
|
@@ -6897,44 +6920,18 @@ function createReplyToThread(deps) {
|
|
|
6897
6920
|
}
|
|
6898
6921
|
}
|
|
6899
6922
|
status.update();
|
|
6900
|
-
|
|
6901
|
-
if (
|
|
6902
|
-
|
|
6903
|
-
conversationId
|
|
6904
|
-
});
|
|
6905
|
-
if (storedConversation?.title) {
|
|
6906
|
-
return void 0;
|
|
6907
|
-
}
|
|
6923
|
+
void resolveConversationTitle({ conversationId }).then(async (title) => {
|
|
6924
|
+
if (!title) {
|
|
6925
|
+
return;
|
|
6908
6926
|
}
|
|
6909
|
-
|
|
6910
|
-
assistantThreadContext,
|
|
6911
|
-
assistantUserName: botConfig.userName,
|
|
6912
|
-
channelId,
|
|
6913
|
-
conversation: preparedState.conversation,
|
|
6914
|
-
generateThreadTitle: deps.services.generateThreadTitle,
|
|
6927
|
+
await maybeSyncAssistantTitle({
|
|
6928
|
+
channelId: assistantThreadContext?.channelId,
|
|
6915
6929
|
getSlackAdapter: deps.getSlackAdapter,
|
|
6916
|
-
|
|
6917
|
-
|
|
6918
|
-
runId,
|
|
6919
|
-
threadId
|
|
6930
|
+
threadTs: assistantThreadContext?.threadTs,
|
|
6931
|
+
title
|
|
6920
6932
|
});
|
|
6921
|
-
})();
|
|
6922
|
-
void assistantTitleTask.then(async (titleUpdateResult) => {
|
|
6923
|
-
if (!titleUpdateResult) return;
|
|
6924
|
-
if (conversationId && titleUpdateResult.title) {
|
|
6925
|
-
try {
|
|
6926
|
-
await getConversationStore().recordActivity({
|
|
6927
|
-
activityAtMs: message.metadata.dateSent.getTime(),
|
|
6928
|
-
conversationId,
|
|
6929
|
-
nowMs: Date.now(),
|
|
6930
|
-
title: titleUpdateResult.title
|
|
6931
|
-
});
|
|
6932
|
-
} catch (error) {
|
|
6933
|
-
logException(error, "conversation.title.persist.failed");
|
|
6934
|
-
}
|
|
6935
|
-
}
|
|
6936
6933
|
}).catch((error) => {
|
|
6937
|
-
logException(error, "
|
|
6934
|
+
logException(error, "conversation.title.task.failed");
|
|
6938
6935
|
});
|
|
6939
6936
|
const toolChannelId = channelId;
|
|
6940
6937
|
const activeInstructionAuthorId = actor?.userId ?? parseActorUserId(message.author.userId);
|
|
@@ -6980,6 +6977,7 @@ function createReplyToThread(deps) {
|
|
|
6980
6977
|
slackConversation,
|
|
6981
6978
|
source,
|
|
6982
6979
|
destination,
|
|
6980
|
+
publishExternally: shouldPublishExternally2(options.publishExternally),
|
|
6983
6981
|
...destinationVisibility ? { destinationVisibility } : {},
|
|
6984
6982
|
surface: options.execution?.surface ?? "slack",
|
|
6985
6983
|
dispatch: options.execution?.dispatch,
|
|
@@ -7465,21 +7463,26 @@ function getBackfillText(entry) {
|
|
|
7465
7463
|
const text = normalizeConversationText(parseContent(entry).text);
|
|
7466
7464
|
return text || void 0;
|
|
7467
7465
|
}
|
|
7468
|
-
async function seedConversationBackfill(thread, conversation, currentTurn) {
|
|
7466
|
+
async function seedConversationBackfill(thread, conversation, currentTurn, resolveMessageActors) {
|
|
7469
7467
|
if (conversation.messages.length > 0 || conversation.compactions.length > 0) {
|
|
7470
7468
|
return "recent_messages";
|
|
7471
7469
|
}
|
|
7472
7470
|
const seeded = [];
|
|
7473
7471
|
let source = "recent_messages";
|
|
7472
|
+
let fetchedNewestFirst;
|
|
7474
7473
|
try {
|
|
7475
|
-
const
|
|
7474
|
+
const fetched = [];
|
|
7476
7475
|
for await (const entry of thread.messages) {
|
|
7477
|
-
|
|
7478
|
-
if (
|
|
7476
|
+
fetched.push(entry);
|
|
7477
|
+
if (fetched.length >= BACKFILL_MESSAGE_LIMIT) {
|
|
7479
7478
|
break;
|
|
7480
7479
|
}
|
|
7481
7480
|
}
|
|
7482
|
-
fetchedNewestFirst.reverse();
|
|
7481
|
+
fetchedNewestFirst = fetched.reverse();
|
|
7482
|
+
} catch {
|
|
7483
|
+
}
|
|
7484
|
+
if (fetchedNewestFirst) {
|
|
7485
|
+
await resolveMessageActors(fetchedNewestFirst);
|
|
7483
7486
|
for (const entry of fetchedNewestFirst) {
|
|
7484
7487
|
const text = getBackfillText(entry);
|
|
7485
7488
|
if (text) {
|
|
@@ -7489,7 +7492,6 @@ async function seedConversationBackfill(thread, conversation, currentTurn) {
|
|
|
7489
7492
|
if (seeded.length > 0) {
|
|
7490
7493
|
source = "thread_fetch";
|
|
7491
7494
|
}
|
|
7492
|
-
} catch {
|
|
7493
7495
|
}
|
|
7494
7496
|
if (seeded.length === 0) {
|
|
7495
7497
|
try {
|
|
@@ -7497,6 +7499,7 @@ async function seedConversationBackfill(thread, conversation, currentTurn) {
|
|
|
7497
7499
|
} catch {
|
|
7498
7500
|
}
|
|
7499
7501
|
const fromRecent = thread.recentMessages.slice(-BACKFILL_MESSAGE_LIMIT);
|
|
7502
|
+
await resolveMessageActors(fromRecent);
|
|
7500
7503
|
for (const entry of fromRecent) {
|
|
7501
7504
|
const text = getBackfillText(entry);
|
|
7502
7505
|
if (text) {
|
|
@@ -7528,10 +7531,15 @@ function createPrepareTurnState(deps) {
|
|
|
7528
7531
|
await hydrateConversationMessages({ conversation, conversationId });
|
|
7529
7532
|
const locationConfiguration = args.locationConfiguration ?? getLocationConfigurationService(args.destination);
|
|
7530
7533
|
const configuration = await locationConfiguration.resolveValues();
|
|
7531
|
-
const backfillSource = args.skipBackfill ? void 0 : await seedConversationBackfill(
|
|
7532
|
-
|
|
7533
|
-
|
|
7534
|
-
|
|
7534
|
+
const backfillSource = args.skipBackfill ? void 0 : await seedConversationBackfill(
|
|
7535
|
+
args.thread,
|
|
7536
|
+
conversation,
|
|
7537
|
+
{
|
|
7538
|
+
messageId: args.message.id,
|
|
7539
|
+
messageCreatedAtMs: args.message.metadata.dateSent.getTime()
|
|
7540
|
+
},
|
|
7541
|
+
(messages) => deps.resolveBackfillMessageActors(messages, args.destination)
|
|
7542
|
+
);
|
|
7535
7543
|
for (const queued of args.queuedMessages ?? []) {
|
|
7536
7544
|
const queuedMessage = toConversationMessage({
|
|
7537
7545
|
entry: queued.message,
|
|
@@ -7565,7 +7573,10 @@ function createPrepareTurnState(deps) {
|
|
|
7565
7573
|
threadTs: getThreadTs(args.context.threadId)
|
|
7566
7574
|
});
|
|
7567
7575
|
if (conversationId) {
|
|
7568
|
-
await persistConversationVisionCache(
|
|
7576
|
+
await persistConversationVisionCache(
|
|
7577
|
+
conversationId,
|
|
7578
|
+
conversation.vision
|
|
7579
|
+
);
|
|
7569
7580
|
}
|
|
7570
7581
|
}
|
|
7571
7582
|
await persistConversationMessages({ conversation, conversationId });
|
|
@@ -7650,6 +7661,7 @@ function createSlackDispatchTurnRunner(options) {
|
|
|
7650
7661
|
ack: hooks.ack,
|
|
7651
7662
|
conversationId,
|
|
7652
7663
|
destination: dispatch2.destination,
|
|
7664
|
+
publishExternally: true,
|
|
7653
7665
|
execution: {
|
|
7654
7666
|
disabledFeatures: ["interactive-auth"],
|
|
7655
7667
|
locationConfiguration: options.getLocationConfiguration(
|
|
@@ -7706,7 +7718,24 @@ function createSlackRuntime(options) {
|
|
|
7706
7718
|
const services = createJuniorRuntimeServices(options.services);
|
|
7707
7719
|
const prepareTurnState = createPrepareTurnState({
|
|
7708
7720
|
compactConversationIfNeeded: services.conversationMemory.compactConversationIfNeeded,
|
|
7709
|
-
hydrateConversationVisionContext: services.visionContext.hydrateConversationVisionContext
|
|
7721
|
+
hydrateConversationVisionContext: services.visionContext.hydrateConversationVisionContext,
|
|
7722
|
+
resolveBackfillMessageActors: async (messages, destination) => {
|
|
7723
|
+
if (destination.platform !== "slack") {
|
|
7724
|
+
throw new Error("Slack turn backfill requires a Slack destination");
|
|
7725
|
+
}
|
|
7726
|
+
await Promise.all(
|
|
7727
|
+
messages.filter((message) => {
|
|
7728
|
+
const actor = getMessageActorIdentity(message);
|
|
7729
|
+
return !message.author.isMe && Boolean(actor?.userId) && !actor?.fullName && !actor?.userName;
|
|
7730
|
+
}).map(
|
|
7731
|
+
(message) => ensureSlackMessageActorIdentity(
|
|
7732
|
+
message,
|
|
7733
|
+
destination.teamId,
|
|
7734
|
+
services.replyExecutor.lookupSlackUser
|
|
7735
|
+
)
|
|
7736
|
+
)
|
|
7737
|
+
);
|
|
7738
|
+
}
|
|
7710
7739
|
});
|
|
7711
7740
|
const replyToThread = createReplyToThread({
|
|
7712
7741
|
getSlackAdapter: options.getSlackAdapter,
|
|
@@ -8145,6 +8174,9 @@ async function runPausedTurnInContext(payload, options, runOptions) {
|
|
|
8145
8174
|
credentialContext,
|
|
8146
8175
|
actor,
|
|
8147
8176
|
destination: routingDestination,
|
|
8177
|
+
// Slack resume publishes unless the checkpoint opted out.
|
|
8178
|
+
// Missing means legacy/in-flight Slack turns still post.
|
|
8179
|
+
publishExternally: activeTurn.publishExternally !== false,
|
|
8148
8180
|
source,
|
|
8149
8181
|
toolChannelId: destination.channelId
|
|
8150
8182
|
},
|
|
@@ -8419,11 +8451,16 @@ function createConversationWork(options) {
|
|
|
8419
8451
|
return {
|
|
8420
8452
|
conversationStore: options.conversationStore,
|
|
8421
8453
|
queue: options.queue,
|
|
8422
|
-
run:
|
|
8423
|
-
|
|
8454
|
+
run: routeApiTurnWork({
|
|
8455
|
+
apiTurnWorker: createApiTurnWorker({
|
|
8424
8456
|
agentRunner: options.agentRunner
|
|
8425
8457
|
}),
|
|
8426
|
-
fallbackWorker:
|
|
8458
|
+
fallbackWorker: routeAgentInvocationWork({
|
|
8459
|
+
invocationWorker: createAgentInvocationWorker({
|
|
8460
|
+
agentRunner: options.agentRunner
|
|
8461
|
+
}),
|
|
8462
|
+
fallbackWorker: providerWorker
|
|
8463
|
+
})
|
|
8427
8464
|
}),
|
|
8428
8465
|
runtime,
|
|
8429
8466
|
state: options.state
|