@sentry/junior 0.226.0 → 0.228.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-FUetyyLe.js → agent-hooks-DUQ3ASdp.js} +227 -12
- package/dist/{agent-runner-DEF7auSj.js → agent-runner-CIesujf5.js} +123 -77
- package/dist/api/schema.d.ts +203 -32
- package/dist/api/schema.js +3 -3
- package/dist/api.js +105 -67
- package/dist/{app-TVL42pGL.d.ts → app-BRZB3MuD.d.ts} +1 -1
- package/dist/app.d.ts +1 -1
- package/dist/app.js +275 -137
- package/dist/{briefs-Cb4T2BUI.js → briefs-BTrVMqUg.js} +4 -4
- package/dist/{catalog-runtime-BYGR3Dr4.js → catalog-runtime-NOBDOyJi.js} +1 -1
- package/dist/{checkpoint-CJe-dZFF.js → checkpoint-CzN3gXoB.js} +7 -7
- package/dist/cli/chat.js +13 -13
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.js +1 -1
- package/dist/cli/plugins.js +3 -3
- package/dist/cli/snapshot-create.js +3 -3
- package/dist/cli/upgrade.js +3 -3
- package/dist/{client-C2WBBx7m.js → client-C6VUBzL_.js} +2 -2
- package/dist/{config-Bws6Rpsh.js → config-BLPaWN1Q.js} +2 -2
- package/dist/{context-Bplcgypl.js → context-0Et9iVSB.js} +1 -1
- package/dist/{conversation-DPbmIwjy.js → conversation-DOI6Y60M.js} +52 -24
- package/dist/{conversation-privacy-pCcW0a5Y.js → conversation-privacy-DJ88ECSq.js} +1 -1
- package/dist/{credential-sync-ibuNsMyl.js → credential-sync-OKs419AB.js} +14 -14
- package/dist/{executor-D36FWjcf.js → executor-DZVZBfmX.js} +1 -1
- package/dist/{history-DI9KJT3J.d.ts → history-H-SI5Dej.d.ts} +27 -1
- package/dist/images-D3x6EemU.js +82 -0
- package/dist/instrumentation.js +2 -2
- package/dist/{job-queue-2mFFDMHB.js → job-queue-BuSPM0cX.js} +1 -1
- package/dist/{logging-CvjMHRvg.js → logging-Blgn76r3.js} +1 -1
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +3 -3
- package/dist/{oauth-authorization-l4O1rXsL.js → oauth-authorization-t-NPqTNB.js} +1 -1
- package/dist/{oauth-callback-server-Ds8M5FFX.js → oauth-callback-server-BP7SgTcu.js} +2 -2
- package/dist/{pending-auth-DLNJbD8H.js → pending-auth-CXLwmDaG.js} +1 -1
- package/dist/{profile-dvV7PB7u.js → profile-a5xmeUHf.js} +4 -4
- package/dist/{prompt-DehgjkO5.js → prompt-9C-wUwwx.js} +1 -1
- package/dist/{registry-C6FHctIu.js → registry-BUbczT2k.js} +2 -2
- package/dist/{resolve-DqwGI9wq.js → resolve-3PhWSiEF.js} +2 -2
- package/dist/{runner-CzYEcB73.js → runner-CsnuKcsq.js} +10 -10
- package/dist/{sandbox-egress-signals-BZOv0fns.js → sandbox-egress-signals-D34sI4J6.js} +1 -1
- package/dist/{schema-BZg-xzfG.js → schema-CXmCvVLn.js} +1 -1
- package/dist/{skills-EhiVbjF4.js → skills-CLgyYrgF.js} +2 -2
- package/dist/{spawn-Ck3L0rEr.js → spawn-CS56i7Nm.js} +2 -2
- package/dist/{task-queue-TXhAWQwj.js → task-queue-C2sTDXqQ.js} +3 -3
- package/dist/{task-runner-axUJS1No.js → task-runner-uSodiP4v.js} +10 -10
- package/dist/{thread-state-CTuWhjru.js → thread-state-BurqeqMv.js} +5 -5
- package/dist/{turn-failure-response-csVoLOzx.js → turn-failure-response-Bshcqa0a.js} +9 -9
- package/dist/{turn-lifecycle-C1S6vELh.js → turn-lifecycle-foKlVl_T.js} +1 -1
- package/dist/{turn-session-routing-5RejBvit.js → turn-session-routing-DDUMJ2GY.js} +1 -1
- package/dist/{validation-q2PFxkTQ.js → validation-DZc56dXw.js} +1 -1
- package/dist/{version-ByLtIYyy.js → version-y4cRp5Y2.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{web-authorization-Biy8nsS7.js → web-authorization-BfVYx0t1.js} +6 -6
- package/dist/{web-input-DM9LaEdn.js → web-input-B6FZlrgg.js} +73 -41
- package/dist/{work-QrbHdXTc.js → work-Dy8sW9MZ.js} +7 -7
- package/dist/{worker-r17aopXW.js → worker-BH0RP7Hj.js} +5 -5
- package/package.json +5 -4
package/dist/app.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { $
|
|
2
|
-
import { C as withLogContext, O as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, S as withContext, d as logException, f as logInfo, j as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, p as logWarn, r as createRequestContext, v as setSpanAttributes, w as withSpan, y as setSpanStatus } from "./logging-
|
|
1
|
+
import { $ as collectEventAutomationMatchKeys, A as requestAttachmentDeletion, An as getConfigDefaults, Bt as removeActiveConversation, C as readPublicArtifact, Cn as createUserTokenStore, Et as clearExpiredConversationLease, Ft as hasRunnableConversationWork, G as readScheduledAutomation, H as listScheduledAutomations, Ht as requestConversationWork, It as listActiveConversationIds, J as scheduledRunId, Jt as hasRunnableConversationWork$1, Kt as CONVERSATION_WORK_STALE_ENQUEUE_MS, L as logScheduledAutomationRunSkipped, M as parseSlackThreadId, Mt as ensureConversationWake, Nt as getConversation, O as collectAttachmentGarbage, Pt as getConversationWorkState, Q as effectiveTaskOutcomes, R as scheduledAutomationRunAttributes, S as publicArtifactHeaders, Sn as slackExternalRefIdSchema, T as lookupSlackUserProfile, U as listScheduledAutomationsForTeam, Wt as stopConversationWork, X as scheduledRunSchema, Xt as isInvalidConversationRecordError, Y as withScheduledAutomationLock, Zt as renderTaskInput, _t as getEventCatalog, a as isExperimentalFeatureEnabled, an as consumeSandboxEgressAuthRequiredSignal, en as resolveSandboxEgressProviderForHost, f as deleteMcpAuthSessionsForUserProvider, fn as startOAuthFlow, i as getExperimentalFeatures, in as clearSandboxEgressSignals, jn as setConfigDefaults, l as executeCredentialedEgressRequest, ln as formatProviderLabel, m as deleteMcpStoredOAuthCredentials, mt as ingestEvent, nn as shouldPropagateSandboxEgressTrace, nt as findMatchingEventAutomations, o as setExperimentalFeatures, on as consumeSandboxEgressPermissionDeniedSignal, p as deleteMcpServerSessionId, pt as processWorkspaceSnapshotJob, q as saveScheduledAutomationInLock, rn as SANDBOX_EGRESS_PROXY_PATH, s as executeAgentRun, sn as parseSandboxEgressCredentialToken, t as createAgentRunner, tn as normalizeSandboxEgressTracePropagationDomains, vt as eventGuidance, w as unpublishedArtifactHeaders, xn as slackEntitySchema, xt as appendAndEnqueueInboundMessage, z as getNextRunAtMs } from "./agent-runner-CIesujf5.js";
|
|
2
|
+
import { C as withLogContext, O as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, S as withContext, d as logException, f as logInfo, j as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, p as logWarn, r as createRequestContext, v as setSpanAttributes, w as withSpan, y as setSpanStatus } from "./logging-Blgn76r3.js";
|
|
3
3
|
import { r as continueTrace } from "./sentry-CgWZM_kV.js";
|
|
4
|
-
import { t as JUNIOR_VERSION } from "./version-
|
|
5
|
-
import { a as getChatConfig, f as setBotModelConfig, i as configureFunctionMaxDurationSeconds, m as setSlackReactionConfig, n as botConfig, p as setProfiles, s as getSlackBotToken, u as getSlackReactionConfig } from "./config-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { t as JUNIOR_VERSION } from "./version-y4cRp5Y2.js";
|
|
5
|
+
import { a as getChatConfig, f as setBotModelConfig, i as configureFunctionMaxDurationSeconds, m as setSlackReactionConfig, n as botConfig, p as setProfiles, s as getSlackBotToken, u as getSlackReactionConfig } from "./config-BLPaWN1Q.js";
|
|
6
|
+
import { _ as slackChannelIdSchema, g as parseSlackUserId, h as parseSlackTeamId, u as parseActorUserId, v as slackTeamIdSchema, x as slackMessageTsSchema, y as slackUserIdSchema } from "./context-0Et9iVSB.js";
|
|
7
|
+
import { $t as getConversationStore, Ct as createPluginLogger, F as bindSlackDirectCredentialSubject, G as isDmChannel, I as verifyEventAutomationCredentialSubject, L as verifyScheduledAutomationCredentialSubject, N as bindEventAutomationCredentialSubject, P as bindScheduledAutomationCredentialSubject, Q as readActorIdentity, R as verifySlackDirectCredentialSubject, U as getSlackClient, Vt as resolveRootVisibility, Wt as listConversationAnnotations, X as runWithWorkspaceTeamId, Y as getWorkspaceTeamId, Zt as getConversationEventStore, a as getPluginRoutes, bt as createPluginState, ct as collectEventMatchKeys, d as setPlugins, en as getDb, f as validatePlugins, ft as findMatchingWatches, gt as getDashboardConversationLink, h as setBriefsConfig, i as getPluginApiRoutes, in as withConversationMutationLock, mn as deleteProviderIdentityForSlackUser, mt as takeDueTimerWatches, ot as cancelSubscriptions, rn as withConversationEventLock, tn as getSqlExecutor, u as getPlugins, vt as getDashboardTaskLink, wt as readConversationAccessFromSql, yt as setDashboardConversationLinkOptions } from "./agent-hooks-DUQ3ASdp.js";
|
|
8
8
|
import { n as juniorDestinations } from "./destinations-BeBiJeEM.js";
|
|
9
|
-
import { E as juniorConversations, a as juniorSchedulerRuns, f as juniorAgentBindings, g as juniorConversationBriefs, o as juniorSchedulerTasks, p as juniorAgentInvocations, y as juniorConversationEvents } from "./executor-
|
|
10
|
-
import { k as annotationCard } from "./conversation-
|
|
11
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
12
|
-
import { X as projectConversationMessages, q as appendConversationMessages } from "./checkpoint-
|
|
13
|
-
import { O as withLock$1, w as getStateAdapter } from "./profile-
|
|
14
|
-
import { f as setSandboxResourceConfig, u as getSandboxResourceConfig } from "./resolve-
|
|
15
|
-
import { a as getVercelConversationWorkQueue, g as isConversationQueueMessageRejectedError, h as conversationQueueMessageSchema, i as verifyWorkspaceSnapshotJobMessage, o as resolveConversationWorkQueueTopic, s as verifyConversationQueueMessage, t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-
|
|
16
|
-
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-
|
|
9
|
+
import { E as juniorConversations, a as juniorSchedulerRuns, f as juniorAgentBindings, g as juniorConversationBriefs, o as juniorSchedulerTasks, p as juniorAgentInvocations, y as juniorConversationEvents } from "./executor-DZVZBfmX.js";
|
|
10
|
+
import { k as annotationCard } from "./conversation-DOI6Y60M.js";
|
|
11
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-NOBDOyJi.js";
|
|
12
|
+
import { X as projectConversationMessages, q as appendConversationMessages } from "./checkpoint-CzN3gXoB.js";
|
|
13
|
+
import { O as withLock$1, w as getStateAdapter } from "./profile-a5xmeUHf.js";
|
|
14
|
+
import { f as setSandboxResourceConfig, u as getSandboxResourceConfig } from "./resolve-3PhWSiEF.js";
|
|
15
|
+
import { a as getVercelConversationWorkQueue, g as isConversationQueueMessageRejectedError, h as conversationQueueMessageSchema, i as verifyWorkspaceSnapshotJobMessage, o as resolveConversationWorkQueueTopic, s as verifyConversationQueueMessage, t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-BuSPM0cX.js";
|
|
16
|
+
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-DZc56dXw.js";
|
|
17
17
|
import { a as pluginRuntimeRegistrationsFromPluginSet, n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "./plugins-egKWjgue.js";
|
|
18
|
-
import { A as THREAD_OPTOUT_ACK, C as verifySlackSignature, D as withNormalizedThreadId, E as normalizeIncomingSlackThreadId, F as createVercelAttachmentStorage, L as enqueueAgentDispatch, M as parseContent, N as getThreadStopDecision, O as getAuthPausedConversationTurnId, P as renderSlackObjectCard, R as GET$3, S as runWithSlackInstallation, T as stopSlackThread, a as webActorFromEmail, b as clearSlackPendingReactions, c as getProductionSlackAdapter, g as readViewerAutomationSummary, i as recordWebConversationActivity, j as startProcessingReaction, n as conversationTurnIdForMessage, o as createProductionConversationWorkOptions, s as createProductionSlackWebhookServices, t as appendAndEnqueueWebMessage, v as recordSkippedConversationMessage, w as isSlackMessageStopped, y as buildSlackInboundMessage } from "./web-input-
|
|
19
|
-
import { O as recordAutomationExecution, _ as markDispatchFailed, a as confirmDispatchMailboxAppend, d as getPluginDispatchProjection, f as isTerminalDispatchStatus, l as getDispatchRecord, o as createOrGetDispatch, p as listPendingDispatchMailboxAppends, s as getDispatchConversationId } from "./task-runner-
|
|
20
|
-
import { c as listPendingAgentInvocationMailboxAppends, r as enqueueAgentInvocation } from "./work-
|
|
21
|
-
import { s as coerceThreadConversationState } from "./thread-state-
|
|
22
|
-
import { a as GET$4, i as publishAppHomeView, r as GET$5, t as receiveLocalOAuthCredential } from "./credential-sync-
|
|
23
|
-
import { a as registerVercelPluginTaskDevConsumer, n as createVercelPluginTaskCallback, s as queueCallback } from "./task-queue-
|
|
24
|
-
import { t as processConversationWork } from "./worker-
|
|
25
|
-
import { t as bindSpawnAgent } from "./spawn-
|
|
18
|
+
import { A as THREAD_OPTOUT_ACK, C as verifySlackSignature, D as withNormalizedThreadId, E as normalizeIncomingSlackThreadId, F as createVercelAttachmentStorage, L as enqueueAgentDispatch, M as parseContent, N as getThreadStopDecision, O as getAuthPausedConversationTurnId, P as renderSlackObjectCard, R as GET$3, S as runWithSlackInstallation, T as stopSlackThread, a as webActorFromEmail, b as clearSlackPendingReactions, c as getProductionSlackAdapter, g as readViewerAutomationSummary, i as recordWebConversationActivity, j as startProcessingReaction, n as conversationTurnIdForMessage, o as createProductionConversationWorkOptions, s as createProductionSlackWebhookServices, t as appendAndEnqueueWebMessage, v as recordSkippedConversationMessage, w as isSlackMessageStopped, y as buildSlackInboundMessage } from "./web-input-B6FZlrgg.js";
|
|
19
|
+
import { O as recordAutomationExecution, _ as markDispatchFailed, a as confirmDispatchMailboxAppend, d as getPluginDispatchProjection, f as isTerminalDispatchStatus, l as getDispatchRecord, o as createOrGetDispatch, p as listPendingDispatchMailboxAppends, s as getDispatchConversationId } from "./task-runner-uSodiP4v.js";
|
|
20
|
+
import { c as listPendingAgentInvocationMailboxAppends, r as enqueueAgentInvocation } from "./work-Dy8sW9MZ.js";
|
|
21
|
+
import { s as coerceThreadConversationState } from "./thread-state-BurqeqMv.js";
|
|
22
|
+
import { a as GET$4, i as publishAppHomeView, r as GET$5, t as receiveLocalOAuthCredential } from "./credential-sync-OKs419AB.js";
|
|
23
|
+
import { a as registerVercelPluginTaskDevConsumer, n as createVercelPluginTaskCallback, s as queueCallback } from "./task-queue-C2sTDXqQ.js";
|
|
24
|
+
import { t as processConversationWork } from "./worker-BH0RP7Hj.js";
|
|
25
|
+
import { t as bindSpawnAgent } from "./spawn-CS56i7Nm.js";
|
|
26
26
|
import { createRequire } from "node:module";
|
|
27
27
|
import { pathToFileURL } from "node:url";
|
|
28
28
|
import { Hono } from "hono";
|
|
@@ -34,6 +34,26 @@ import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
|
34
34
|
import { createRemoteJWKSet, decodeJwt, jwtVerify } from "jose";
|
|
35
35
|
import { ChannelImpl, ThreadImpl } from "chat";
|
|
36
36
|
import * as acp from "@agentclientprotocol/sdk";
|
|
37
|
+
//#region src/chat/events/timers.ts
|
|
38
|
+
/** Publish a bounded batch of due timers; the mailbox owns agent execution. */
|
|
39
|
+
async function runTimerWatchHeartbeat(args) {
|
|
40
|
+
const errors = [];
|
|
41
|
+
for (const watch of await takeDueTimerWatches(args.nowMs)) try {
|
|
42
|
+
await ingestEvent({
|
|
43
|
+
namespace: "junior",
|
|
44
|
+
identifier: watch.identifier,
|
|
45
|
+
eventType: "timer.fired",
|
|
46
|
+
eventKey: `timer:${watch.id}`,
|
|
47
|
+
occurredAtMs: watch.firesAtMs,
|
|
48
|
+
terminal: true,
|
|
49
|
+
trustedSummary: "Timer elapsed."
|
|
50
|
+
}, args);
|
|
51
|
+
} catch (error) {
|
|
52
|
+
errors.push(error);
|
|
53
|
+
}
|
|
54
|
+
if (errors.length) throw new AggregateError(errors, "Timer Watch delivery failed");
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
37
57
|
//#region src/chat/task-execution/heartbeat.ts
|
|
38
58
|
const DEFAULT_RECOVERY_LIMIT = 25;
|
|
39
59
|
function heartbeatIdempotencyKey(reason, conversationId, nowMs) {
|
|
@@ -1026,6 +1046,14 @@ async function runHeartbeat(args) {
|
|
|
1026
1046
|
} catch (error) {
|
|
1027
1047
|
logException(error, "scheduled_automations.heartbeat.failed");
|
|
1028
1048
|
}
|
|
1049
|
+
try {
|
|
1050
|
+
await runTimerWatchHeartbeat({
|
|
1051
|
+
nowMs: args.nowMs,
|
|
1052
|
+
queue
|
|
1053
|
+
});
|
|
1054
|
+
} catch (error) {
|
|
1055
|
+
logException(error, "watches.timer.heartbeat.failed");
|
|
1056
|
+
}
|
|
1029
1057
|
await runPluginHeartbeats({
|
|
1030
1058
|
conversationWorkQueue: queue,
|
|
1031
1059
|
nowMs: args.nowMs
|
|
@@ -1740,6 +1768,104 @@ async function presentSlackAnnotationDetails(event, teamId) {
|
|
|
1740
1768
|
});
|
|
1741
1769
|
}
|
|
1742
1770
|
//#endregion
|
|
1771
|
+
//#region src/chat/ingress/slack-payload.ts
|
|
1772
|
+
const eventTimestampSchema = slackMessageTsSchema.refine((value) => Number.isFinite((/* @__PURE__ */ new Date(Number(value) * 1e3)).getTime()));
|
|
1773
|
+
const slackSlashCommandSchema = z.object({
|
|
1774
|
+
channel_id: z.string().trim().pipe(slackChannelIdSchema),
|
|
1775
|
+
team_id: z.string().trim().pipe(slackTeamIdSchema),
|
|
1776
|
+
user_id: z.string().trim().pipe(slackUserIdSchema),
|
|
1777
|
+
text: z.string(),
|
|
1778
|
+
enterprise_id: z.string().optional(),
|
|
1779
|
+
is_enterprise_install: z.enum(["true", "false"]).optional()
|
|
1780
|
+
});
|
|
1781
|
+
const slackAssistantThreadSchema = z.object({
|
|
1782
|
+
channel_id: z.string().min(1),
|
|
1783
|
+
thread_ts: eventTimestampSchema,
|
|
1784
|
+
user_id: z.string(),
|
|
1785
|
+
context: z.object({
|
|
1786
|
+
channel_id: z.string().optional(),
|
|
1787
|
+
team_id: z.string().optional(),
|
|
1788
|
+
enterprise_id: z.string().nullable().optional()
|
|
1789
|
+
})
|
|
1790
|
+
});
|
|
1791
|
+
const slackEventSchema = z.looseObject({
|
|
1792
|
+
type: z.string(),
|
|
1793
|
+
attachments: z.array(z.looseObject({
|
|
1794
|
+
from_url: z.string().optional(),
|
|
1795
|
+
original_url: z.string().optional(),
|
|
1796
|
+
title: z.string().optional(),
|
|
1797
|
+
text: z.string().optional(),
|
|
1798
|
+
image_url: z.string().optional(),
|
|
1799
|
+
thumb_url: z.string().optional(),
|
|
1800
|
+
service_name: z.string().optional()
|
|
1801
|
+
})).optional(),
|
|
1802
|
+
files: z.array(z.looseObject({
|
|
1803
|
+
id: z.string().optional(),
|
|
1804
|
+
mimetype: z.string().optional(),
|
|
1805
|
+
url_private: z.string().optional(),
|
|
1806
|
+
name: z.string().optional(),
|
|
1807
|
+
size: z.number().optional(),
|
|
1808
|
+
original_w: z.number().optional(),
|
|
1809
|
+
original_h: z.number().optional()
|
|
1810
|
+
})).optional(),
|
|
1811
|
+
edited: z.looseObject({ ts: eventTimestampSchema }).optional(),
|
|
1812
|
+
team: z.string().optional(),
|
|
1813
|
+
team_id: z.string().optional(),
|
|
1814
|
+
username: z.string().optional(),
|
|
1815
|
+
blocks: z.array(z.looseObject({
|
|
1816
|
+
type: z.string(),
|
|
1817
|
+
elements: z.array(z.looseObject({
|
|
1818
|
+
type: z.string(),
|
|
1819
|
+
elements: z.array(z.looseObject({
|
|
1820
|
+
type: z.string(),
|
|
1821
|
+
url: z.string().optional()
|
|
1822
|
+
})).optional()
|
|
1823
|
+
})).optional(),
|
|
1824
|
+
text: z.union([z.string(), z.looseObject({
|
|
1825
|
+
type: z.enum(["mrkdwn", "plain_text"]),
|
|
1826
|
+
text: z.string()
|
|
1827
|
+
})]).optional()
|
|
1828
|
+
})).optional(),
|
|
1829
|
+
bot_id: z.string().optional(),
|
|
1830
|
+
channel: z.string().optional(),
|
|
1831
|
+
channel_type: z.enum([
|
|
1832
|
+
"channel",
|
|
1833
|
+
"group",
|
|
1834
|
+
"mpim",
|
|
1835
|
+
"im",
|
|
1836
|
+
"app_home"
|
|
1837
|
+
]).optional(),
|
|
1838
|
+
event_ts: eventTimestampSchema.optional(),
|
|
1839
|
+
subtype: z.string().optional(),
|
|
1840
|
+
text: z.string().optional(),
|
|
1841
|
+
thread_ts: eventTimestampSchema.optional(),
|
|
1842
|
+
ts: eventTimestampSchema.optional(),
|
|
1843
|
+
user: z.string().optional()
|
|
1844
|
+
});
|
|
1845
|
+
const slackEventEnvelopeSchema = z.object({
|
|
1846
|
+
event_id: z.unknown().optional(),
|
|
1847
|
+
is_ext_shared_channel: z.unknown().optional(),
|
|
1848
|
+
enterprise_id: z.string().optional(),
|
|
1849
|
+
event: slackEventSchema.optional(),
|
|
1850
|
+
is_enterprise_install: z.boolean().optional(),
|
|
1851
|
+
team_id: z.string().optional(),
|
|
1852
|
+
type: z.string(),
|
|
1853
|
+
challenge: z.string().optional()
|
|
1854
|
+
});
|
|
1855
|
+
const slackInteractivePayloadSchema = z.object({
|
|
1856
|
+
actions: z.array(z.object({
|
|
1857
|
+
action_id: z.string().optional(),
|
|
1858
|
+
selected_option: z.object({ value: z.string().optional() }).optional(),
|
|
1859
|
+
value: z.string().optional()
|
|
1860
|
+
})).optional(),
|
|
1861
|
+
team: z.object({ id: z.string().optional() }).nullish(),
|
|
1862
|
+
type: z.string(),
|
|
1863
|
+
user: z.object({
|
|
1864
|
+
id: z.string().optional(),
|
|
1865
|
+
team_id: z.string().optional()
|
|
1866
|
+
}).optional()
|
|
1867
|
+
});
|
|
1868
|
+
//#endregion
|
|
1743
1869
|
//#region src/chat/conversations/stop.ts
|
|
1744
1870
|
/** Stop the current Conversation Turn and wake an idle resume when needed. */
|
|
1745
1871
|
async function stopConversationTurn(args) {
|
|
@@ -1856,22 +1982,75 @@ function textMentionsBot(text, botUserId) {
|
|
|
1856
1982
|
}
|
|
1857
1983
|
//#endregion
|
|
1858
1984
|
//#region src/chat/ingress/workspace-membership.ts
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1985
|
+
const MEMBER_TTL_MS = 3e5;
|
|
1986
|
+
const NON_MEMBER_TTL_MS = 3e4;
|
|
1987
|
+
const authorTeamSchema = z.object({
|
|
1988
|
+
user_team: z.string().optional(),
|
|
1989
|
+
source_team: z.string().optional(),
|
|
1990
|
+
user: z.unknown().optional()
|
|
1991
|
+
});
|
|
1992
|
+
/** Accept only verified workspace authors, reusing recent membership lookups. */
|
|
1993
|
+
async function isSlackWorkspaceMember(raw, state) {
|
|
1868
1994
|
const workspaceTeamId = getWorkspaceTeamId();
|
|
1869
1995
|
if (!workspaceTeamId) return false;
|
|
1870
|
-
const
|
|
1871
|
-
if (
|
|
1872
|
-
const
|
|
1873
|
-
|
|
1874
|
-
return false;
|
|
1996
|
+
const parsed = authorTeamSchema.safeParse(raw);
|
|
1997
|
+
if (!parsed.success) return false;
|
|
1998
|
+
const event = parsed.data;
|
|
1999
|
+
const userId = parseSlackUserId(event.user);
|
|
2000
|
+
if (!userId) return false;
|
|
2001
|
+
const key = `slack:membership:${workspaceTeamId}:${userId}`;
|
|
2002
|
+
const authorTeam = parseSlackTeamId(event.user_team);
|
|
2003
|
+
if (authorTeam === workspaceTeamId) return true;
|
|
2004
|
+
if (event.user_team !== void 0 && !authorTeam && !/^E[A-Z0-9]+$/.test(event.user_team)) return false;
|
|
2005
|
+
const explicitlyExternal = authorTeam !== void 0;
|
|
2006
|
+
if (!explicitlyExternal) {
|
|
2007
|
+
const cached = await state.get(key);
|
|
2008
|
+
if (typeof cached === "boolean") return cached;
|
|
2009
|
+
}
|
|
2010
|
+
const result = await withLock$1(state, `${key}:lookup`, async () => {
|
|
2011
|
+
if (explicitlyExternal) {
|
|
2012
|
+
await state.set(key, false, NON_MEMBER_TTL_MS);
|
|
2013
|
+
return false;
|
|
2014
|
+
}
|
|
2015
|
+
const cached = await state.get(key);
|
|
2016
|
+
if (typeof cached === "boolean") return cached;
|
|
2017
|
+
const user = await lookupSlackUserProfile(userId);
|
|
2018
|
+
const authorTeam = parseSlackTeamId(user.team_id);
|
|
2019
|
+
if (user.id !== userId || !authorTeam) return false;
|
|
2020
|
+
const member = authorTeam === workspaceTeamId && !user.is_deleted;
|
|
2021
|
+
await state.set(key, member, member ? MEMBER_TTL_MS : NON_MEMBER_TTL_MS);
|
|
2022
|
+
return member;
|
|
2023
|
+
}, {
|
|
2024
|
+
keepAlive: true,
|
|
2025
|
+
waitMs: 1e4
|
|
2026
|
+
});
|
|
2027
|
+
if (!result.acquired) throw new Error("Could not acquire Slack membership lookup lock");
|
|
2028
|
+
return result.value;
|
|
2029
|
+
}
|
|
2030
|
+
//#endregion
|
|
2031
|
+
//#region src/chat/ingress/slack-message-telemetry.ts
|
|
2032
|
+
function field(value, pattern) {
|
|
2033
|
+
if (value === void 0) return "missing";
|
|
2034
|
+
return typeof value === "string" && value.length <= 64 && pattern.test(value) ? value : "invalid";
|
|
2035
|
+
}
|
|
2036
|
+
/** Record Slack's identity fields separately from the membership decision. */
|
|
2037
|
+
function slackMessageAttributes(body) {
|
|
2038
|
+
const event = body.event;
|
|
2039
|
+
const teamId = /^[TE][A-Z0-9]+$/;
|
|
2040
|
+
return {
|
|
2041
|
+
"messaging.message.id": event?.ts,
|
|
2042
|
+
"app.slack.event_id": field(body.event_id, /^Ev[A-Z0-9]+$/),
|
|
2043
|
+
"app.slack.event_type": field(event?.type, /^[a-z_]+$/),
|
|
2044
|
+
"app.slack.event_subtype": field(event?.subtype, /^[a-z_]+$/),
|
|
2045
|
+
"app.slack.user_id": field(event?.user, /^[UW][A-Z0-9]+$/),
|
|
2046
|
+
"app.slack.bot_id": field(event?.bot_id, /^B[A-Z0-9]+$/),
|
|
2047
|
+
"app.slack.team_id": field(body.team_id, /^T[A-Z0-9]+$/),
|
|
2048
|
+
"app.slack.enterprise_id": field(body.enterprise_id, /^E[A-Z0-9]+$/),
|
|
2049
|
+
"app.slack.user_team": field(event?.user_team, teamId),
|
|
2050
|
+
"app.slack.source_team": field(event?.source_team, teamId),
|
|
2051
|
+
"app.slack.event_team": field(event?.team, teamId),
|
|
2052
|
+
"app.slack.is_ext_shared_channel": typeof body.is_ext_shared_channel === "boolean" ? body.is_ext_shared_channel : body.is_ext_shared_channel === void 0 ? "missing" : "invalid"
|
|
2053
|
+
};
|
|
1875
2054
|
}
|
|
1876
2055
|
//#endregion
|
|
1877
2056
|
//#region src/chat/credentials/unlink-provider.ts
|
|
@@ -1889,17 +2068,12 @@ async function unlinkProvider(userId, provider, userTokenStore, slackTeamId) {
|
|
|
1889
2068
|
//#endregion
|
|
1890
2069
|
//#region src/chat/ingress/slash-command.ts
|
|
1891
2070
|
async function postEphemeral(event, text) {
|
|
1892
|
-
await event.channel.postEphemeral(event.
|
|
1893
|
-
}
|
|
1894
|
-
function requireActorId(event) {
|
|
1895
|
-
const userId = parseActorUserId(event.user.userId);
|
|
1896
|
-
if (!userId) throw new Error("Slack slash command requires a actor user id");
|
|
1897
|
-
return userId;
|
|
2071
|
+
await event.channel.postEphemeral(event.userId, text, { fallbackToDM: false });
|
|
1898
2072
|
}
|
|
1899
2073
|
function getCommandName() {
|
|
1900
2074
|
return getChatConfig().slack.slashCommand;
|
|
1901
2075
|
}
|
|
1902
|
-
async function handleLink(event,
|
|
2076
|
+
async function handleLink(event, provider) {
|
|
1903
2077
|
if (!pluginCatalogRuntime.isProvider(provider)) {
|
|
1904
2078
|
await postEphemeral(event, `Unknown provider: \`${provider}\``);
|
|
1905
2079
|
return;
|
|
@@ -1908,20 +2082,14 @@ async function handleLink(event, actorId, provider) {
|
|
|
1908
2082
|
await postEphemeral(event, `${formatProviderLabel(provider)} doesn't support account linking.`);
|
|
1909
2083
|
return;
|
|
1910
2084
|
}
|
|
1911
|
-
const raw = event.raw;
|
|
1912
|
-
const actor = createActor({
|
|
1913
|
-
platform: "slack",
|
|
1914
|
-
teamId: raw.team_id,
|
|
1915
|
-
userId: actorId
|
|
1916
|
-
}, {
|
|
1917
|
-
platform: "slack",
|
|
1918
|
-
teamId: raw.team_id,
|
|
1919
|
-
userId: actorId
|
|
1920
|
-
});
|
|
1921
2085
|
const result = await startOAuthFlow(provider, {
|
|
1922
|
-
actorId,
|
|
1923
|
-
|
|
1924
|
-
|
|
2086
|
+
actorId: event.userId,
|
|
2087
|
+
actor: {
|
|
2088
|
+
platform: "slack",
|
|
2089
|
+
teamId: event.teamId,
|
|
2090
|
+
userId: event.userId
|
|
2091
|
+
},
|
|
2092
|
+
channelId: event.channelId
|
|
1925
2093
|
});
|
|
1926
2094
|
if (!result.ok) {
|
|
1927
2095
|
await postEphemeral(event, `Failed to start linking: ${result.error}`);
|
|
@@ -1930,7 +2098,7 @@ async function handleLink(event, actorId, provider) {
|
|
|
1930
2098
|
if (result.delivery === "fallback_dm") await postEphemeral(event, `Check your DMs for a ${formatProviderLabel(provider)} authorization link.`);
|
|
1931
2099
|
else if (result.delivery === false) await postEphemeral(event, "I wasn't able to send you a private authorization link. Please try again in a direct message.");
|
|
1932
2100
|
}
|
|
1933
|
-
async function handleUnlink(event,
|
|
2101
|
+
async function handleUnlink(event, provider) {
|
|
1934
2102
|
if (!pluginCatalogRuntime.isProvider(provider)) {
|
|
1935
2103
|
await postEphemeral(event, `Unknown provider: \`${provider}\``);
|
|
1936
2104
|
return;
|
|
@@ -1940,8 +2108,7 @@ async function handleUnlink(event, actorId, provider) {
|
|
|
1940
2108
|
return;
|
|
1941
2109
|
}
|
|
1942
2110
|
const tokenStore = createUserTokenStore();
|
|
1943
|
-
|
|
1944
|
-
await unlinkProvider(actorId, provider, tokenStore, teamId);
|
|
2111
|
+
await unlinkProvider(event.userId, provider, tokenStore, event.teamId);
|
|
1945
2112
|
logInfo("slash_command.credential.unlinked", { "app.credential.provider": provider });
|
|
1946
2113
|
await postEphemeral(event, `Your ${formatProviderLabel(provider)} account has been unlinked.`);
|
|
1947
2114
|
}
|
|
@@ -1957,9 +2124,8 @@ async function handleSlashCommand(event) {
|
|
|
1957
2124
|
return;
|
|
1958
2125
|
}
|
|
1959
2126
|
const normalized = provider.toLowerCase();
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
else await handleUnlink(event, actorId, normalized);
|
|
2127
|
+
if (subcommand === "link") await handleLink(event, normalized);
|
|
2128
|
+
else await handleUnlink(event, normalized);
|
|
1963
2129
|
}
|
|
1964
2130
|
//#endregion
|
|
1965
2131
|
//#region src/chat/slack/automation-details.ts
|
|
@@ -2154,7 +2320,7 @@ async function buildThread(args) {
|
|
|
2154
2320
|
});
|
|
2155
2321
|
}
|
|
2156
2322
|
function shouldIgnoreMessage(message) {
|
|
2157
|
-
return message.author.isMe === true || !parseActorUserId(message.author.userId)
|
|
2323
|
+
return message.author.isMe === true || !parseActorUserId(message.author.userId);
|
|
2158
2324
|
}
|
|
2159
2325
|
function shouldPersistBeforeAck(body) {
|
|
2160
2326
|
return body.event?.type === "app_mention" || body.event?.type === "message";
|
|
@@ -2273,7 +2439,7 @@ async function routeParsedMessage(args) {
|
|
|
2273
2439
|
const message = normalized.message;
|
|
2274
2440
|
const canonicalThreadId = normalized.threadId;
|
|
2275
2441
|
const botUserId = args.adapter.botUserId;
|
|
2276
|
-
const isMention = Boolean(botUserId && (textMentionsBot(args.event.text ?? "", botUserId) || args.event.blocks?.some((block) => block.type === "section" && block.text
|
|
2442
|
+
const isMention = Boolean(botUserId && (textMentionsBot(args.event.text ?? "", botUserId) || args.event.blocks?.some((block) => block.type === "section" && typeof block.text === "object" && block.text.type === "mrkdwn" && textMentionsBot(block.text.text, botUserId))));
|
|
2277
2443
|
if (isMention) message.isMention = true;
|
|
2278
2444
|
const isDirectMessage = isDmEvent(args.event);
|
|
2279
2445
|
const isSubscribed = !isDirectMessage && !isMention && await args.state.isSubscribed(canonicalThreadId);
|
|
@@ -2356,32 +2522,22 @@ async function handleSlackEvent(args) {
|
|
|
2356
2522
|
installation,
|
|
2357
2523
|
state,
|
|
2358
2524
|
task: async () => {
|
|
2359
|
-
if (event.type === "assistant_thread_started") {
|
|
2360
|
-
const
|
|
2361
|
-
if (
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
threadTs: assistantThread.thread_ts
|
|
2367
|
-
}),
|
|
2368
|
-
threadTs: assistantThread.thread_ts,
|
|
2369
|
-
userId: assistantThread.user_id
|
|
2370
|
-
});
|
|
2371
|
-
return;
|
|
2372
|
-
}
|
|
2373
|
-
if (event.type === "assistant_thread_context_changed") {
|
|
2374
|
-
const assistantThread = event.assistant_thread;
|
|
2375
|
-
if (assistantThread?.channel_id && assistantThread.thread_ts) await args.services.runtime.handleAssistantContextChanged({
|
|
2376
|
-
channelId: assistantThread.channel_id,
|
|
2377
|
-
context: { channelId: assistantThread.context?.channel_id },
|
|
2525
|
+
if (event.type === "assistant_thread_started" || event.type === "assistant_thread_context_changed") {
|
|
2526
|
+
const parsed = slackAssistantThreadSchema.safeParse(event.assistant_thread);
|
|
2527
|
+
if (!parsed.success) return;
|
|
2528
|
+
const thread = parsed.data;
|
|
2529
|
+
const callback = {
|
|
2530
|
+
channelId: thread.channel_id,
|
|
2531
|
+
context: { channelId: thread.context.channel_id },
|
|
2378
2532
|
threadId: adapter.encodeThreadId({
|
|
2379
|
-
channel:
|
|
2380
|
-
threadTs:
|
|
2533
|
+
channel: thread.channel_id,
|
|
2534
|
+
threadTs: thread.thread_ts
|
|
2381
2535
|
}),
|
|
2382
|
-
threadTs:
|
|
2383
|
-
userId:
|
|
2384
|
-
}
|
|
2536
|
+
threadTs: thread.thread_ts,
|
|
2537
|
+
userId: thread.user_id
|
|
2538
|
+
};
|
|
2539
|
+
if (event.type === "assistant_thread_started") await args.services.runtime.handleAssistantThreadStarted(callback);
|
|
2540
|
+
else await args.services.runtime.handleAssistantContextChanged(callback);
|
|
2385
2541
|
return;
|
|
2386
2542
|
}
|
|
2387
2543
|
if (event.type === "entity_details_requested") {
|
|
@@ -2395,6 +2551,9 @@ async function handleSlackEvent(args) {
|
|
|
2395
2551
|
return;
|
|
2396
2552
|
}
|
|
2397
2553
|
if ((event.type === "message" || event.type === "app_mention") && !shouldIgnoreMessageSubtype(event) && event.channel && event.ts) {
|
|
2554
|
+
const member = await isSlackWorkspaceMember(event, state);
|
|
2555
|
+
setSpanAttributes({ "app.slack.membership": member ? "verified" : "unverified" });
|
|
2556
|
+
if (!member) return;
|
|
2398
2557
|
const message = adapter.parseMessage(event);
|
|
2399
2558
|
if (!(await withLock$1(state, `slack:ingress:${normalizeMessageThreadId(message).threadId}`, () => routeParsedMessage({
|
|
2400
2559
|
adapter,
|
|
@@ -2419,42 +2578,19 @@ function requireSlackPayloadUserId(value, source) {
|
|
|
2419
2578
|
return userId;
|
|
2420
2579
|
}
|
|
2421
2580
|
async function handleSlashCommandForm(args) {
|
|
2422
|
-
const
|
|
2423
|
-
const channelId = args.params.get("channel_id") ?? "";
|
|
2581
|
+
const { channel_id: channelId, team_id: teamId, user_id: userId } = args.form;
|
|
2424
2582
|
const channel = new ChannelImpl({
|
|
2425
|
-
id:
|
|
2583
|
+
id: `slack:${channelId}`,
|
|
2426
2584
|
adapter: args.adapter,
|
|
2427
2585
|
stateAdapter: args.state
|
|
2428
2586
|
});
|
|
2429
|
-
const userId = requireSlackPayloadUserId(args.params.get("user_id"), "Slack slash command payload");
|
|
2430
|
-
const teamId = args.params.get("team_id") ?? void 0;
|
|
2431
|
-
const userIdentity = createActor({
|
|
2432
|
-
platform: "slack",
|
|
2433
|
-
teamId,
|
|
2434
|
-
userId,
|
|
2435
|
-
userName: args.params.get("user_name") ?? void 0,
|
|
2436
|
-
fullName: args.params.get("user_name") ?? void 0
|
|
2437
|
-
}, {
|
|
2438
|
-
teamId,
|
|
2439
|
-
userId
|
|
2440
|
-
});
|
|
2441
|
-
if (!userIdentity?.userId) throw new Error("Slack slash command payload actor identity is invalid");
|
|
2442
2587
|
await withSpan("chat.slash_command", "chat.slash_command", { userId }, async () => {
|
|
2443
2588
|
await handleSlashCommand({
|
|
2444
|
-
adapter: args.adapter,
|
|
2445
2589
|
channel,
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
user: {
|
|
2451
|
-
userId,
|
|
2452
|
-
userName: userIdentity.userName ?? "",
|
|
2453
|
-
fullName: userIdentity.fullName ?? "",
|
|
2454
|
-
isBot: false,
|
|
2455
|
-
isMe: false
|
|
2456
|
-
},
|
|
2457
|
-
openModal: async () => void 0
|
|
2590
|
+
channelId,
|
|
2591
|
+
teamId,
|
|
2592
|
+
text: args.form.text,
|
|
2593
|
+
userId
|
|
2458
2594
|
});
|
|
2459
2595
|
});
|
|
2460
2596
|
}
|
|
@@ -2477,14 +2613,6 @@ async function handleInteractivePayload(args) {
|
|
|
2477
2613
|
}
|
|
2478
2614
|
});
|
|
2479
2615
|
}
|
|
2480
|
-
function installationFromForm(params) {
|
|
2481
|
-
const isEnterpriseInstall = params.get("is_enterprise_install") === "true";
|
|
2482
|
-
return {
|
|
2483
|
-
teamId: params.get("team_id") ?? void 0,
|
|
2484
|
-
enterpriseId: params.get("enterprise_id") ?? void 0,
|
|
2485
|
-
isEnterpriseInstall
|
|
2486
|
-
};
|
|
2487
|
-
}
|
|
2488
2616
|
function installationFromInteractive(payload) {
|
|
2489
2617
|
return { teamId: payload.team?.id ?? payload.user?.team_id };
|
|
2490
2618
|
}
|
|
@@ -2494,17 +2622,24 @@ async function handleSlackForm(args) {
|
|
|
2494
2622
|
const state = args.services.state ?? getStateAdapter();
|
|
2495
2623
|
await state.connect();
|
|
2496
2624
|
if (params.has("command") && !params.has("payload")) {
|
|
2497
|
-
const
|
|
2625
|
+
const result = slackSlashCommandSchema.safeParse(Object.fromEntries(params));
|
|
2626
|
+
if (!result.success) return new Response("Invalid slash command payload", { status: 400 });
|
|
2627
|
+
const form = result.data;
|
|
2628
|
+
const installation = {
|
|
2629
|
+
teamId: form.team_id,
|
|
2630
|
+
enterpriseId: form.enterprise_id,
|
|
2631
|
+
isEnterpriseInstall: form.is_enterprise_install === "true"
|
|
2632
|
+
};
|
|
2498
2633
|
enqueue(args.waitUntil, withLogContext({
|
|
2499
2634
|
platform: "slack",
|
|
2500
|
-
userId:
|
|
2635
|
+
userId: form.user_id
|
|
2501
2636
|
}, () => runWithWorkspaceTeamId(installation.teamId, () => runWithSlackInstallation({
|
|
2502
2637
|
adapter,
|
|
2503
2638
|
installation,
|
|
2504
2639
|
state,
|
|
2505
2640
|
task: () => handleSlashCommandForm({
|
|
2506
2641
|
adapter,
|
|
2507
|
-
|
|
2642
|
+
form,
|
|
2508
2643
|
state
|
|
2509
2644
|
})
|
|
2510
2645
|
})).catch((error) => {
|
|
@@ -2514,8 +2649,9 @@ async function handleSlackForm(args) {
|
|
|
2514
2649
|
}
|
|
2515
2650
|
const rawPayload = params.get("payload");
|
|
2516
2651
|
if (!rawPayload) return new Response("Missing payload", { status: 400 });
|
|
2517
|
-
const
|
|
2518
|
-
if (!
|
|
2652
|
+
const result = slackInteractivePayloadSchema.safeParse(parseJson(rawPayload));
|
|
2653
|
+
if (!result.success) return new Response("Invalid payload JSON", { status: 400 });
|
|
2654
|
+
const payload = result.data;
|
|
2519
2655
|
const installation = installationFromInteractive(payload);
|
|
2520
2656
|
enqueue(args.waitUntil, withLogContext({
|
|
2521
2657
|
platform: "slack",
|
|
@@ -2547,20 +2683,21 @@ async function handleSlackWebhook(args) {
|
|
|
2547
2683
|
services: args.services,
|
|
2548
2684
|
waitUntil: args.waitUntil
|
|
2549
2685
|
});
|
|
2550
|
-
const
|
|
2551
|
-
if (!
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
return Response.json({ challenge });
|
|
2555
|
-
}
|
|
2686
|
+
const result = slackEventEnvelopeSchema.safeParse(parseJson(body));
|
|
2687
|
+
if (!result.success) return new Response("Invalid JSON", { status: 400 });
|
|
2688
|
+
const parsed = result.data;
|
|
2689
|
+
if (parsed.type === "url_verification") return Response.json({ challenge: parsed.challenge });
|
|
2556
2690
|
if (parsed.type === "event_callback") {
|
|
2557
2691
|
const eventLogContext = slackEventLogContext(parsed.event);
|
|
2558
2692
|
if (shouldPersistBeforeAck(parsed)) {
|
|
2559
2693
|
const failureResponse = await withLogContext(eventLogContext, async () => {
|
|
2560
2694
|
try {
|
|
2561
|
-
await handleSlackEvent({
|
|
2695
|
+
await withSpan("slack.message.ingress", "slack.message.ingress", eventLogContext, () => handleSlackEvent({
|
|
2562
2696
|
body: parsed,
|
|
2563
2697
|
services: args.services
|
|
2698
|
+
}), {
|
|
2699
|
+
...slackMessageAttributes(parsed),
|
|
2700
|
+
"app.slack.membership": "not_checked"
|
|
2564
2701
|
});
|
|
2565
2702
|
} catch (error) {
|
|
2566
2703
|
if (error instanceof SlackEventPersistenceError) logException(error.cause, "slack.event.persist.failed");
|
|
@@ -4798,6 +4935,7 @@ function dashboardHostRoutePaths(dashboard, authenticatedRoutes = []) {
|
|
|
4798
4935
|
...pagePaths,
|
|
4799
4936
|
"/favicon.ico",
|
|
4800
4937
|
"/_junior/dashboard/avatar.png",
|
|
4938
|
+
"/_junior/dashboard/object-icons/*",
|
|
4801
4939
|
"/_junior/dashboard/client.js",
|
|
4802
4940
|
"/_junior/dashboard/icon-512.png",
|
|
4803
4941
|
"/_junior/dashboard/manifest.webmanifest",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { r as completeObject } from "./client-
|
|
1
|
+
import { r as completeObject } from "./client-C6VUBzL_.js";
|
|
2
2
|
import { r as defaultModelId } from "./model-profile-BwU8mqwD.js";
|
|
3
|
-
import {
|
|
4
|
-
import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-
|
|
3
|
+
import { U as parseBriefInput, d as conversationDetailReportSchema, p as conversationEventPageSchema, z as briefCodeChangeSchema } from "./conversation-DOI6Y60M.js";
|
|
4
|
+
import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-9C-wUwwx.js";
|
|
5
5
|
import { CLI_USAGE } from "./cli/run.js";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { z } from "zod";
|
|
@@ -269,7 +269,7 @@ async function parseRunOptions(argv) {
|
|
|
269
269
|
* `DATABASE_URL` at import, and `briefs pull` must work with only a token.
|
|
270
270
|
*/
|
|
271
271
|
async function configuredDefaultModelId() {
|
|
272
|
-
const { botConfig } = await import("./config-
|
|
272
|
+
const { botConfig } = await import("./config-BLPaWN1Q.js").then((n) => n.r);
|
|
273
273
|
return defaultModelId(botConfig);
|
|
274
274
|
}
|
|
275
275
|
function apiUrl(baseUrl, pathname) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
|
|
2
|
-
import { t as createPluginCatalogRuntime } from "./registry-
|
|
2
|
+
import { t as createPluginCatalogRuntime } from "./registry-BUbczT2k.js";
|
|
3
3
|
//#region src/chat/plugins/catalog-runtime.ts
|
|
4
4
|
var catalog_runtime_exports = /* @__PURE__ */ __exportAll({ pluginCatalogRuntime: () => pluginCatalogRuntime });
|
|
5
5
|
const pluginCatalogRuntime = createPluginCatalogRuntime();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { i as completeText, m as escapeXml, o as resolveGatewayModel, p as unwrapCurrentInstruction } from "./client-
|
|
2
|
-
import { d as logException, o as getActiveTraceId, p as logWarn, t as buildTurnFailureResponse, v as setSpanAttributes } from "./logging-
|
|
3
|
-
import { n as botConfig } from "./config-
|
|
4
|
-
import {
|
|
5
|
-
import { $t as
|
|
6
|
-
import {
|
|
7
|
-
import { D as fenceLock, O as withLock, T as MUTATION_LOCK_TTL_MS, k as sleep, w as getStateAdapter } from "./profile-
|
|
1
|
+
import { i as completeText, m as escapeXml, o as resolveGatewayModel, p as unwrapCurrentInstruction } from "./client-C6VUBzL_.js";
|
|
2
|
+
import { d as logException, o as getActiveTraceId, p as logWarn, t as buildTurnFailureResponse, v as setSpanAttributes } from "./logging-Blgn76r3.js";
|
|
3
|
+
import { n as botConfig } from "./config-BLPaWN1Q.js";
|
|
4
|
+
import { b as parseSlackMessageTs, f as toStoredSlackActor } from "./context-0Et9iVSB.js";
|
|
5
|
+
import { $t as getConversationStore, Jt as authenticationLinkedEvent, Kt as JUNIOR_NATIVE_EVENT_NAMESPACE, Yt as authenticationUnlinkedEvent, Zt as getConversationEventStore, cn as addAgentTurnUsage, nn as createSqlConversationEventStore, on as bindProviderConversation, qt as agentsInstructionsUpdatedEvent, rn as withConversationEventLock, tn as getSqlExecutor } from "./agent-hooks-DUQ3ASdp.js";
|
|
6
|
+
import { $ as contextProvenance, G as agentHistoryItemSchema, et as instructionActors, tt as instructionProvenanceFor } from "./conversation-DOI6Y60M.js";
|
|
7
|
+
import { D as fenceLock, O as withLock, T as MUTATION_LOCK_TTL_MS, k as sleep, w as getStateAdapter } from "./profile-a5xmeUHf.js";
|
|
8
8
|
import { isDeepStrictEqual } from "node:util";
|
|
9
9
|
import { z } from "zod";
|
|
10
10
|
import { createHash } from "node:crypto";
|