@sentry/junior 0.190.0 → 0.192.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.
Files changed (97) hide show
  1. package/dist/{agent-hooks-3IG2FQW2.js → agent-hooks-3JY76L5X.js} +11 -11
  2. package/dist/api/activity.d.ts +3 -1
  3. package/dist/api/code/overview.d.ts +12 -0
  4. package/dist/api/locations/detail.d.ts +8 -0
  5. package/dist/api/locations/list.d.ts +5 -0
  6. package/dist/api/people/code.d.ts +6 -0
  7. package/dist/api/people/shared.d.ts +2 -0
  8. package/dist/api/reporting-window.d.ts +40 -0
  9. package/dist/api/schema/code.d.ts +14 -0
  10. package/dist/api/schema/conversation.d.ts +27 -0
  11. package/dist/api/schema/location.d.ts +15 -0
  12. package/dist/api/schema/person.d.ts +104 -0
  13. package/dist/api/schema/task.d.ts +15 -2
  14. package/dist/api/schema.d.ts +1 -1
  15. package/dist/api/schema.js +2 -2
  16. package/dist/api.js +536 -141
  17. package/dist/app.js +93 -130
  18. package/dist/{catalog-runtime-2OT7S3ZC.js → catalog-runtime-5JVLWXRY.js} +4 -4
  19. package/dist/chat/agent/resume.d.ts +0 -1
  20. package/dist/chat/agent/types.d.ts +0 -1
  21. package/dist/chat/agent-invocations/types.d.ts +4 -4
  22. package/dist/chat/providers/slack/runtime.d.ts +1 -2
  23. package/dist/chat/providers/slack/system-turn.d.ts +9 -4
  24. package/dist/chat/providers/slack/turn.d.ts +0 -1
  25. package/dist/chat/services/turn-router.d.ts +1 -1
  26. package/dist/chat/slack/dispatch-turn.d.ts +0 -1
  27. package/dist/chat/slack/timestamp-param.d.ts +1 -1
  28. package/dist/chat/task-execution/assistant-message.d.ts +7 -7
  29. package/dist/chat/task-execution/checkpoint.d.ts +0 -1
  30. package/dist/chat/task-execution/conversation-turn.d.ts +2 -2
  31. package/dist/chat/task-execution/state.d.ts +0 -3
  32. package/dist/chat/task-execution/store.d.ts +0 -1
  33. package/dist/chat/task-execution/turn-cursor.d.ts +0 -2
  34. package/dist/chat/task-execution/worker.d.ts +0 -1
  35. package/dist/chat/tasks/execution-stats.d.ts +12 -0
  36. package/dist/{chunk-Y4WL4OYD.js → chunk-3ADPXQBL.js} +1 -1
  37. package/dist/{chunk-F3K2267N.js → chunk-3O2NXVGB.js} +77 -35
  38. package/dist/{chunk-2MKHYSYL.js → chunk-3UJSII43.js} +3 -3
  39. package/dist/{chunk-RLYJYEIY.js → chunk-47JFLZSF.js} +5 -7
  40. package/dist/{chunk-T66GV7A3.js → chunk-4AFSQJD6.js} +2 -2
  41. package/dist/{chunk-DJZGQ7OL.js → chunk-4B4DQGOM.js} +22 -29
  42. package/dist/{chunk-OJFX2FP7.js → chunk-4CCQZHD3.js} +9 -11
  43. package/dist/{chunk-BUJU6C2J.js → chunk-4WIA45WD.js} +1 -1
  44. package/dist/{chunk-VWNIDTFR.js → chunk-4Z7B5WVV.js} +2 -2
  45. package/dist/{chunk-3J3BCB4J.js → chunk-5V4BAUCH.js} +1 -1
  46. package/dist/{chunk-663DQH5W.js → chunk-6FCKJDKS.js} +1 -1
  47. package/dist/{chunk-HI5KXE3C.js → chunk-6LX6KV5C.js} +3 -3
  48. package/dist/{chunk-67MMSYSE.js → chunk-7XO7PTZE.js} +1 -1
  49. package/dist/{chunk-OKAHLUSU.js → chunk-AKR6W7VV.js} +3 -3
  50. package/dist/{chunk-JV7U4665.js → chunk-ARSUYYQG.js} +1 -1
  51. package/dist/{chunk-IRQ3RSX3.js → chunk-BGLMT6KP.js} +3 -3
  52. package/dist/{chunk-2MRF22J4.js → chunk-BUTAWPUV.js} +50 -8
  53. package/dist/{chunk-62DRKZQU.js → chunk-EIYOABL4.js} +4 -4
  54. package/dist/{chunk-PFAZSRGR.js → chunk-EYIMZY5O.js} +114 -19
  55. package/dist/{chunk-DVX6U6GI.js → chunk-EYNUOZCN.js} +1 -1
  56. package/dist/{chunk-4PKEJK5B.js → chunk-FGYWKKTJ.js} +1 -1
  57. package/dist/{chunk-YFU4DGZY.js → chunk-G4E5WIRL.js} +30 -9
  58. package/dist/{chunk-OON4IQHH.js → chunk-H5Q2T5VC.js} +1 -1
  59. package/dist/{chunk-ZFCO2TMB.js → chunk-IBO4YFFZ.js} +1 -1
  60. package/dist/{chunk-ECOR3OXY.js → chunk-ITTEDZGY.js} +8 -8
  61. package/dist/{chunk-4BLFIYVK.js → chunk-KR5F3QSP.js} +9 -12
  62. package/dist/{chunk-6BXUSF7J.js → chunk-LRTEMMCZ.js} +1 -1
  63. package/dist/{chunk-MNHJ4WLE.js → chunk-MB2CTEPD.js} +74 -4
  64. package/dist/{chunk-YKIAUKYH.js → chunk-OBN7UEQJ.js} +2 -2
  65. package/dist/{chunk-OYCOLHCR.js → chunk-PXP2M32M.js} +5 -5
  66. package/dist/{chunk-6H7YU6XH.js → chunk-PXUBRZBU.js} +1 -1
  67. package/dist/{chunk-REVH4BZU.js → chunk-PYVGXGKC.js} +2 -2
  68. package/dist/{chunk-UTL3MHPC.js → chunk-RC745GGZ.js} +8 -1
  69. package/dist/{chunk-CZXZKTAI.js → chunk-RWBZZMW6.js} +3 -3
  70. package/dist/{chunk-GWCFXTB6.js → chunk-SSR6YBWW.js} +6 -6
  71. package/dist/{chunk-7UJ6IJCK.js → chunk-SZ2O3CGS.js} +1 -1
  72. package/dist/{chunk-BGOLRC36.js → chunk-VF3EDS7P.js} +13 -11
  73. package/dist/{chunk-FVFJ57RK.js → chunk-YE6DVM43.js} +9 -8
  74. package/dist/{chunk-7Y7XMI6P.js → chunk-YRWGJ5OO.js} +5 -5
  75. package/dist/{chunk-W2C4TPLB.js → chunk-Z4DNJI5F.js} +5 -5
  76. package/dist/cli/chat.js +33 -33
  77. package/dist/cli/check.js +5 -5
  78. package/dist/cli/plugins.js +12 -12
  79. package/dist/cli/snapshot-create.js +9 -9
  80. package/dist/cli/upgrade.js +6 -6
  81. package/dist/db/schema/stats.d.ts +5 -1
  82. package/dist/{db-2IFDMDDY.js → db-LRM6AP66.js} +6 -6
  83. package/dist/instrumentation.js +3 -3
  84. package/dist/nitro.js +6 -6
  85. package/dist/{oauth-callback-server-SZSS2KH6.js → oauth-callback-server-BKCDVYVH.js} +29 -29
  86. package/dist/reporting-schema.d.ts +2 -2
  87. package/dist/{runner-2N4QU77X.js → runner-RUXGS3E6.js} +21 -21
  88. package/dist/{skills-VU2LZAKX.js → skills-DXP2RCJF.js} +5 -5
  89. package/dist/spawn-HH7GH7XT.js +42 -0
  90. package/dist/task-runner-H5I7R3LJ.js +36 -0
  91. package/dist/{validation-IJGHK7NI.js → validation-F4KYLIF2.js} +5 -5
  92. package/dist/version.js +1 -1
  93. package/dist/{work-DI45MLRL.js → work-UUNMNSML.js} +21 -21
  94. package/dist/{worker-FY7KWG2M.js → worker-PMIJ5NLD.js} +10 -10
  95. package/package.json +6 -6
  96. package/dist/spawn-3K7RV4T5.js +0 -42
  97. package/dist/task-runner-52DYFHW3.js +0 -36
@@ -39,7 +39,6 @@ interface SteeringDrainContext {
39
39
  export interface SlackTurnOptions extends ReplyHooks {
40
40
  conversationId?: string;
41
41
  destination: Destination;
42
- publishExternally?: boolean;
43
42
  }
44
43
  export interface SlackTurnRuntimeDependencies<TPreparedState> {
45
44
  assistantUserName: string;
@@ -98,7 +97,6 @@ export interface SlackTurnRuntimeDependencies<TPreparedState> {
98
97
  onTurnStatePersisted?: () => Promise<void>;
99
98
  preparedState?: TPreparedState;
100
99
  queuedMessages?: QueuedTurnMessage[];
101
- publishExternally?: boolean;
102
100
  drainSteeringMessages?: (accept: (messages: QueuedTurnMessage[]) => Promise<void>, context?: SteeringDrainContext) => Promise<QueuedTurnMessage[]>;
103
101
  shouldYield?: () => boolean;
104
102
  }) => Promise<void>;
@@ -111,5 +109,6 @@ export interface SlackTurnRuntime<_TPreparedState, TAssistantEvent extends Assis
111
109
  /** Webhook entry for subscribed Slack Message traffic. */
112
110
  handleSubscribedMessage: (thread: Thread, message: Message, hooks: SlackTurnOptions) => Promise<void>;
113
111
  }
112
+ /** Build the Slack event runtime that routes mentions and subscribed messages. */
114
113
  export declare function createSlackTurnRuntime<TPreparedState, TAssistantEvent extends AssistantLifecycleEvent = AssistantLifecycleEvent>(deps: SlackTurnRuntimeDependencies<TPreparedState>): SlackTurnRuntime<TPreparedState, TAssistantEvent>;
115
114
  export {};
@@ -1,8 +1,13 @@
1
1
  import type { SlackAdapter } from "@chat-adapter/slack";
2
2
  import type { StateAdapter } from "chat";
3
- import type { PublishMessage } from "@/chat/task-execution/assistant-message";
4
- /** Create Slack publishing for system Turns that have no webhook Message. */
5
- export declare function createSlackSystemTurnPublisher(args: {
3
+ import type { DeliverMessage } from "@/chat/task-execution/assistant-message";
4
+ /**
5
+ * Deliver system Turn output to Slack without a webhook Message.
6
+ *
7
+ * TODO(dcramer): Replace this Location-taking function with Delivery bound to one
8
+ * Location after Resource event work supplies Delivery before the Run.
9
+ */
10
+ export declare function createSlackSystemTurnDelivery(args: {
6
11
  getSlackAdapter: () => SlackAdapter;
7
12
  state?: StateAdapter;
8
- }): PublishMessage;
13
+ }): DeliverMessage;
@@ -49,7 +49,6 @@ export declare function createSlackTurn(deps: SlackTurnDeps): (thread: Thread, m
49
49
  onTurnStatePersisted?: () => Promise<void>;
50
50
  preparedState?: PreparedTurnState;
51
51
  queuedMessages?: QueuedTurnMessage[];
52
- publishExternally?: boolean;
53
52
  execution?: DispatchTurnContext;
54
53
  skipBackfill?: boolean;
55
54
  drainSteeringMessages?: (accept: (messages: QueuedTurnMessage[]) => Promise<void>, context?: {
@@ -12,7 +12,7 @@ declare function createTurnRouteSchema(profiles: Readonly<Record<string, ModelPr
12
12
  none: "none";
13
13
  }>;
14
14
  profile: z.ZodString;
15
- confidence: z.ZodPreprocess<z.ZodNumber>;
15
+ confidence: z.ZodPreprocess<z.ZodNumber, unknown>;
16
16
  reason: z.ZodString;
17
17
  }, z.core.$strip>;
18
18
  export interface TurnRoute {
@@ -7,7 +7,6 @@ type ExecuteSlackTurn = (thread: ThreadImpl, message: Message, options: {
7
7
  conversationId?: string;
8
8
  destination: DispatchRecord["destination"];
9
9
  execution: DispatchTurnContext;
10
- publishExternally?: boolean;
11
10
  onTurnDeliveryAccepted?: (messageId?: string) => void;
12
11
  onTurnOutcome?: (result: DispatchTurnResult) => void;
13
12
  shouldYield?: () => boolean;
@@ -15,7 +15,7 @@ type RequiredSlackTimestampParamResult = {
15
15
  error: string;
16
16
  };
17
17
  /** Define a model-facing Slack timestamp, normalizing numeric model args to strings. */
18
- export declare function slackTimestampParam(description: string): z.ZodPreprocess<z.ZodString>;
18
+ export declare function slackTimestampParam(description: string): z.ZodPreprocess<z.ZodString, unknown>;
19
19
  /** Parse tool input into a branded Slack timestamp before provider calls. */
20
20
  export declare function parseSlackTimestampParam(field: string, value: string | number | undefined): SlackTimestampParamResult;
21
21
  /** Parse a required tool input timestamp into a branded Slack timestamp. */
@@ -2,29 +2,29 @@ import type { AssistantMessage } from "@earendil-works/pi-ai";
2
2
  import type { Location } from "@/chat/conversations/location";
3
3
  import type { ProviderConversationReference } from "@/chat/conversations/sql/bindings";
4
4
  import type { ThreadConversationState } from "@/chat/state/conversation";
5
- /** Facts returned after a provider publishes one Message. */
6
- export type PublishedMessage = {
5
+ /** Facts returned after provider Delivery. */
6
+ export type DeliveryResult = {
7
7
  providerMessageId?: string;
8
8
  providerConversationBindings?: ProviderConversationReference[];
9
9
  };
10
10
  /**
11
- * Publish one Message through the provider that owns its Location.
11
+ * Deliver one Message through the provider that owns its Location.
12
12
  *
13
- * TODO(dcramer): Delete PublishedMessage and PublishMessage after the core Turn
13
+ * TODO(dcramer): Delete DeliveryResult and DeliverMessage after the core Turn
14
14
  * lifecycle stores completed assistant Messages and the mailbox worker can
15
15
  * accept provider Delivery directly.
16
16
  */
17
- export type PublishMessage = (input: {
17
+ export type DeliverMessage = (input: {
18
18
  conversationId: string;
19
19
  location: Location;
20
20
  text: string;
21
- }) => Promise<PublishedMessage>;
21
+ }) => Promise<DeliveryResult>;
22
22
  /** Store one assistant Message and its Agent history. */
23
23
  export declare function commitAssistantMessage(args: {
24
24
  agentMessage?: AssistantMessage;
25
25
  conversation: ThreadConversationState;
26
26
  conversationId: string;
27
- publishedMessage?: PublishedMessage;
27
+ deliveryResult?: DeliveryResult;
28
28
  sessionId: string;
29
29
  source?: "slack" | "web";
30
30
  text: string;
@@ -46,7 +46,6 @@ interface TurnCheckpointWrite {
46
46
  destinationVisibility?: ConversationPrivacy;
47
47
  dispatchId?: string;
48
48
  dispatchOutcome?: AgentDispatchOutcome;
49
- publishExternally?: boolean;
50
49
  source?: Source;
51
50
  surface?: AgentTurnSurface;
52
51
  turnStartMessageIndex?: number;
@@ -1,8 +1,8 @@
1
- import { type PublishMessage } from "@/chat/task-execution/assistant-message";
1
+ import { type DeliverMessage } from "@/chat/task-execution/assistant-message";
2
2
  import type { AgentRunner } from "@/chat/runtime/agent-runner";
3
3
  import type { ConversationWorkerContext, ConversationWorkerResult } from "@/chat/task-execution/worker";
4
4
  import { type MailboxTurnWork } from "@/chat/task-execution/mailbox-turn";
5
5
  /**
6
6
  * Create the shared mailbox worker for web and resource-event Turns.
7
7
  */
8
- export declare function createConversationTurnWorker(agentRunner: AgentRunner, publishMessage?: PublishMessage): (context: ConversationWorkerContext, resolved: MailboxTurnWork) => Promise<ConversationWorkerResult>;
8
+ export declare function createConversationTurnWorker(agentRunner: AgentRunner, deliverMessage?: DeliverMessage): (context: ConversationWorkerContext, resolved: MailboxTurnWork) => Promise<ConversationWorkerResult>;
@@ -38,8 +38,6 @@ export declare const inboundMessageDeliverySchema: z.ZodEnum<{
38
38
  defer: "defer";
39
39
  interrupt: "interrupt";
40
40
  }>;
41
- /** Whether this turn also publishes assistant output to the conversation destination. */
42
- export declare const publishExternallySchema: z.ZodBoolean;
43
41
  export type InboundMessageDelivery = z.output<typeof inboundMessageDeliverySchema>;
44
42
  /** Canonical durable mailbox entry owned by task execution. */
45
43
  export declare const inboundMessageSchema: z.ZodObject<{
@@ -67,7 +65,6 @@ export declare const inboundMessageSchema: z.ZodObject<{
67
65
  text: z.ZodString;
68
66
  }, z.core.$strict>;
69
67
  receivedAtMs: z.ZodNumber;
70
- publishExternally: z.ZodBoolean;
71
68
  source: z.ZodEnum<{
72
69
  slack: "slack";
73
70
  local: "local";
@@ -138,7 +138,6 @@ export declare function drainConversationMailbox(args: Parameters<typeof workSta
138
138
  metadata?: Record<string, unknown> | undefined;
139
139
  };
140
140
  receivedAtMs: number;
141
- publishExternally: boolean;
142
141
  source: "slack" | "local" | "web" | "resource_event" | "plugin" | "api" | "scheduler" | "internal";
143
142
  attemptCount?: number | undefined;
144
143
  destination?: {
@@ -50,7 +50,6 @@ export interface TurnRecord {
50
50
  */
51
51
  actors: Actor[];
52
52
  resumeReason?: TurnPauseReason;
53
- publishExternally?: boolean;
54
53
  /** Input that started this Turn; absent only on stored legacy cursors. */
55
54
  source?: Source;
56
55
  resumedFromSliceId?: number;
@@ -106,7 +105,6 @@ export declare function upsertTurnRecord(args: {
106
105
  trailingMessageProvenance?: ConversationMessageProvenance[];
107
106
  actor?: Actor;
108
107
  resumeReason?: TurnPauseReason;
109
- publishExternally?: boolean;
110
108
  errorMessage?: string;
111
109
  resumedFromSliceId?: number;
112
110
  traceId?: string;
@@ -9,7 +9,6 @@ export interface ConversationWorkerContext {
9
9
  checkIn(): Promise<boolean>;
10
10
  conversationId: string;
11
11
  destination?: Destination;
12
- publishExternally: boolean;
13
12
  /** True when the current execution slice must stop at its next safe boundary. */
14
13
  shouldYield(): boolean;
15
14
  /** Return an AbortSignal backed by the durable Conversation stop request. */
@@ -46,6 +46,10 @@ export declare function readTaskExecutionSummaries(type: TaskExecutionType, name
46
46
  export declare function readTaskExecutionDays(dayCount?: number, options?: {
47
47
  nowMs?: number;
48
48
  }): Promise<TaskExecutionDay[]>;
49
+ /** Load a fixed trailing window of completed executions stacked by hour. */
50
+ export declare function readTaskExecutionHours(hourCount?: number, options?: {
51
+ nowMs?: number;
52
+ }): Promise<TaskExecutionDay[]>;
49
53
  /** Load the newest terminal task execution linked to one conversation, if any. */
50
54
  export declare function readTaskExecutionByConversationId(args: {
51
55
  conversationId: string;
@@ -78,3 +82,11 @@ export declare function readTaskExecutionStatusDays(args: {
78
82
  nowMs?: number;
79
83
  taskId: string;
80
84
  }): Promise<TaskExecutionStatusDay[]>;
85
+ /** Load a fixed trailing window of terminal executions for one task by hour. */
86
+ export declare function readTaskExecutionStatusHours(args: {
87
+ hourCount?: number;
88
+ kind: TaskExecutionType;
89
+ namespace?: string;
90
+ nowMs?: number;
91
+ taskId: string;
92
+ }): Promise<TaskExecutionStatusDay[]>;
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-PEQXYSSE.js";
13
13
  import {
14
14
  JUNIOR_VERSION
15
- } from "./chunk-JV7U4665.js";
15
+ } from "./chunk-ARSUYYQG.js";
16
16
 
17
17
  // src/deployment.ts
18
18
  var JUNIOR_HEARTBEAT_ROUTE = "/api/internal/heartbeat";
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  AgentRunError,
6
6
  executeTurn
7
- } from "./chunk-IRQ3RSX3.js";
7
+ } from "./chunk-BGLMT6KP.js";
8
8
  import {
9
9
  buildDeliveredTurnStatePatch,
10
10
  finalizeFailedTurnReplyWithEvent,
@@ -15,14 +15,14 @@ import {
15
15
  getTurnUserSlackMessageTs,
16
16
  persistAuthPauseTurnState,
17
17
  requireTurnFailureEventId
18
- } from "./chunk-7Y7XMI6P.js";
18
+ } from "./chunk-YRWGJ5OO.js";
19
19
  import {
20
20
  resolveTurnSessionRouting,
21
21
  scheduleSessionCompletedPluginTasks
22
- } from "./chunk-ECOR3OXY.js";
22
+ } from "./chunk-ITTEDZGY.js";
23
23
  import {
24
24
  getTurnLifecycle
25
- } from "./chunk-6H7YU6XH.js";
25
+ } from "./chunk-PXUBRZBU.js";
26
26
  import {
27
27
  coerceThreadConversationState,
28
28
  configValueSchema,
@@ -30,11 +30,11 @@ import {
30
30
  getPersistedSandboxState,
31
31
  getPersistedThreadState,
32
32
  persistThreadStateById
33
- } from "./chunk-W2C4TPLB.js";
33
+ } from "./chunk-Z4DNJI5F.js";
34
34
  import {
35
35
  buildSentryConversationUrl,
36
36
  deleteWebAuthorization
37
- } from "./chunk-OON4IQHH.js";
37
+ } from "./chunk-H5Q2T5VC.js";
38
38
  import {
39
39
  createUserTokenStore,
40
40
  deleteMcpAuthSession,
@@ -43,8 +43,9 @@ import {
43
43
  getMcpProviderErrorAttributes,
44
44
  getMcpStoredOAuthCredentials,
45
45
  lookupSlackUserProfile,
46
+ putMcpStoredOAuthCredentials,
46
47
  resolvePluginOAuthAccount
47
- } from "./chunk-FVFJ57RK.js";
48
+ } from "./chunk-YE6DVM43.js";
48
49
  import {
49
50
  RetryableDeliveryError,
50
51
  addReactionToMessage,
@@ -58,7 +59,7 @@ import {
58
59
  removeReactionFromMessage,
59
60
  resolveBaseUrl,
60
61
  truncateStatusText
61
- } from "./chunk-GWCFXTB6.js";
62
+ } from "./chunk-SSR6YBWW.js";
62
63
  import {
63
64
  CooperativeTurnYieldError,
64
65
  clearPendingAuth,
@@ -67,7 +68,7 @@ import {
67
68
  isCooperativeTurnYieldError,
68
69
  isPendingAuthLatestRequest,
69
70
  markTurnFailed
70
- } from "./chunk-67MMSYSE.js";
71
+ } from "./chunk-7XO7PTZE.js";
71
72
  import {
72
73
  TurnSliceLimitExceededError,
73
74
  abandonTurnRecord,
@@ -87,20 +88,20 @@ import {
87
88
  recordTurnSummary,
88
89
  saveTurnCheckpoint,
89
90
  turnHasReply
90
- } from "./chunk-BGOLRC36.js";
91
+ } from "./chunk-VF3EDS7P.js";
91
92
  import {
92
93
  parseSlackThreadId,
93
94
  readSlackRawMessageContext,
94
95
  resolveSlackChannelIdFromMessage,
95
96
  resolveSlackChannelIdFromThreadId
96
- } from "./chunk-BUJU6C2J.js";
97
+ } from "./chunk-4WIA45WD.js";
97
98
  import {
98
99
  ensureConversationWake,
99
100
  requestConversationWork
100
- } from "./chunk-YFU4DGZY.js";
101
+ } from "./chunk-G4E5WIRL.js";
101
102
  import {
102
103
  getTurnRequestDeadline
103
- } from "./chunk-7UJ6IJCK.js";
104
+ } from "./chunk-SZ2O3CGS.js";
104
105
  import {
105
106
  getVercelConversationWorkQueue
106
107
  } from "./chunk-DKIJ2RP5.js";
@@ -112,39 +113,39 @@ import {
112
113
  getSlackClient,
113
114
  isDmChannel,
114
115
  normalizeSlackConversationId
115
- } from "./chunk-2MRF22J4.js";
116
+ } from "./chunk-BUTAWPUV.js";
116
117
  import {
117
118
  getConversationStore,
118
119
  getSqlExecutor,
119
120
  requireSlackDestination,
120
121
  upsertIdentity,
121
122
  upsertLinkedIdentity
122
- } from "./chunk-OKAHLUSU.js";
123
+ } from "./chunk-AKR6W7VV.js";
123
124
  import {
124
125
  acquireActiveLock,
125
126
  getStateAdapter
126
- } from "./chunk-6BXUSF7J.js";
127
+ } from "./chunk-LRTEMMCZ.js";
127
128
  import {
128
129
  botConfig,
129
130
  escapeXml,
130
131
  getChatConfig,
131
132
  getRuntimeMetadata,
132
133
  normalizeSlackEmojiName
133
- } from "./chunk-VWNIDTFR.js";
134
+ } from "./chunk-4Z7B5WVV.js";
134
135
  import {
135
136
  defaultModelId
136
137
  } from "./chunk-D4YV5TDV.js";
137
138
  import {
138
139
  discoverSkills
139
- } from "./chunk-REVH4BZU.js";
140
+ } from "./chunk-PYVGXGKC.js";
140
141
  import {
141
142
  pluginCatalogRuntime
142
- } from "./chunk-4PKEJK5B.js";
143
+ } from "./chunk-FGYWKKTJ.js";
143
144
  import {
144
145
  buildOAuthTokenRequest,
145
146
  hasRequiredOAuthScope,
146
147
  parseOAuthTokenResponse
147
- } from "./chunk-663DQH5W.js";
148
+ } from "./chunk-6FCKJDKS.js";
148
149
  import {
149
150
  createSlackResumeActor,
150
151
  isUserActor,
@@ -163,7 +164,7 @@ import {
163
164
  setTags,
164
165
  toOptionalString,
165
166
  withLogContext
166
- } from "./chunk-Y4WL4OYD.js";
167
+ } from "./chunk-3ADPXQBL.js";
167
168
 
168
169
  // src/chat/slack/assistant-thread/status-render.ts
169
170
  var DEFAULT_STATUS_CONTEXTS = {
@@ -1416,15 +1417,13 @@ async function resumeSlackTurnInContext(args) {
1416
1417
  const deliveryState2 = await getDeliveryConversation();
1417
1418
  let slackMessageTs = [];
1418
1419
  try {
1419
- if (runArgs.run?.publishExternally !== false) {
1420
- slackMessageTs = await sendSlackReply({
1421
- channelId: runArgs.channelId,
1422
- conversationId: runArgs.conversationId,
1423
- replyAttribution: runArgs.run?.dispatch?.replyAttribution,
1424
- text,
1425
- threadTs: runArgs.threadTs
1426
- });
1427
- }
1420
+ slackMessageTs = await sendSlackReply({
1421
+ channelId: runArgs.channelId,
1422
+ conversationId: runArgs.conversationId,
1423
+ replyAttribution: runArgs.run?.dispatch?.replyAttribution,
1424
+ text,
1425
+ threadTs: runArgs.threadTs
1426
+ });
1428
1427
  } catch (error) {
1429
1428
  if (isRetryableSlackPostError(error)) {
1430
1429
  throw new RetryableDeliveryError(error);
@@ -2222,6 +2221,45 @@ async function GET(request, provider, waitUntil, options) {
2222
2221
  return htmlResponse("missing_state");
2223
2222
  }
2224
2223
  if (error) {
2224
+ try {
2225
+ const pendingSession = await getMcpAuthSession(state);
2226
+ if (pendingSession && pendingSession.provider === provider) {
2227
+ try {
2228
+ await runCurrentMcpCredentialMutation(
2229
+ pendingSession,
2230
+ provider,
2231
+ async () => {
2232
+ const credentials = await getMcpStoredOAuthCredentials(
2233
+ pendingSession.userId,
2234
+ provider
2235
+ );
2236
+ if (!credentials?.clientInformation && !credentials?.discoveryState) {
2237
+ return;
2238
+ }
2239
+ const nextCredentials = credentials.tokens ? { tokens: credentials.tokens } : {};
2240
+ await putMcpStoredOAuthCredentials(
2241
+ pendingSession.userId,
2242
+ provider,
2243
+ nextCredentials
2244
+ );
2245
+ }
2246
+ );
2247
+ } catch (cleanupError) {
2248
+ if (!(cleanupError instanceof McpOAuthAttemptExpiredError)) {
2249
+ logException(
2250
+ cleanupError,
2251
+ "mcp.oauth_callback.provider_error_cleanup.failed",
2252
+ { "app.credential.provider": provider }
2253
+ );
2254
+ }
2255
+ }
2256
+ await deleteMcpAuthSession(pendingSession.authSessionId);
2257
+ }
2258
+ } catch (cleanupError) {
2259
+ logException(cleanupError, "mcp.oauth_callback.provider_error_cleanup.failed", {
2260
+ "app.credential.provider": provider
2261
+ });
2262
+ }
2225
2263
  return htmlResponse("provider_error");
2226
2264
  }
2227
2265
  if (!code) {
@@ -2392,12 +2430,16 @@ async function connectedOAuthTokens(userId, plugin, userTokenStore) {
2392
2430
  return void 0;
2393
2431
  }
2394
2432
  async function hasConnectedMcpAccount(userId, plugin) {
2395
- if (plugin.manifest.mcp) {
2396
- return Boolean(
2397
- (await getMcpStoredOAuthCredentials(userId, plugin.manifest.name))?.tokens
2398
- );
2433
+ if (!plugin.manifest.mcp) {
2434
+ return false;
2399
2435
  }
2400
- return false;
2436
+ const credentials = await getMcpStoredOAuthCredentials(
2437
+ userId,
2438
+ plugin.manifest.name
2439
+ );
2440
+ return Boolean(
2441
+ credentials?.tokens || credentials?.clientInformation || credentials?.discoveryState
2442
+ );
2401
2443
  }
2402
2444
  async function buildHomeView(userId, userTokenStore) {
2403
2445
  const runtimeMetadata = getRuntimeMetadata();
@@ -6,14 +6,14 @@ import {
6
6
  isStale,
7
7
  runNonInteractiveCommand,
8
8
  sleep
9
- } from "./chunk-HI5KXE3C.js";
9
+ } from "./chunk-6LX6KV5C.js";
10
10
  import {
11
11
  getStateAdapter
12
- } from "./chunk-6BXUSF7J.js";
12
+ } from "./chunk-LRTEMMCZ.js";
13
13
  import {
14
14
  setSpanAttributes,
15
15
  withSpan
16
- } from "./chunk-Y4WL4OYD.js";
16
+ } from "./chunk-3ADPXQBL.js";
17
17
 
18
18
  // src/chat/sandbox/resources.ts
19
19
  var configuredResources;
@@ -19,23 +19,23 @@ import {
19
19
  releaseConversationWork,
20
20
  requestAnotherSlice,
21
21
  startConversationWork
22
- } from "./chunk-YFU4DGZY.js";
22
+ } from "./chunk-G4E5WIRL.js";
23
23
  import {
24
24
  getTurnRequestDeadline
25
- } from "./chunk-7UJ6IJCK.js";
25
+ } from "./chunk-SZ2O3CGS.js";
26
26
  import {
27
27
  ConversationQueueMessageRejectedError
28
28
  } from "./chunk-JAL3CH4G.js";
29
29
  import {
30
30
  getChatConfig,
31
31
  isProviderRetryError
32
- } from "./chunk-VWNIDTFR.js";
32
+ } from "./chunk-4Z7B5WVV.js";
33
33
  import {
34
34
  logException,
35
35
  logInfo,
36
36
  logWarn,
37
37
  withLogContext
38
- } from "./chunk-Y4WL4OYD.js";
38
+ } from "./chunk-3ADPXQBL.js";
39
39
 
40
40
  // src/chat/task-execution/worker.ts
41
41
  var CONVERSATION_WORK_DEFER_DELAY_MS = 15e3;
@@ -49,7 +49,7 @@ function selectContiguousTurnBatch(messages) {
49
49
  return [];
50
50
  }
51
51
  const nextTurnIndex = messages.findIndex(
52
- (message) => message.input.authorId !== first.input.authorId || message.publishExternally !== first.publishExternally
52
+ (message) => message.input.authorId !== first.input.authorId || message.source !== first.source
53
53
  );
54
54
  return messages.slice(
55
55
  0,
@@ -457,7 +457,6 @@ async function processConversationWorkInContext(message, options) {
457
457
  attemptMessageIds = attemptMessages.map(
458
458
  (message2) => message2.inboundMessageId
459
459
  );
460
- const publishExternally = attemptMessages[0]?.publishExternally ?? false;
461
460
  attemptSelectedMessageIds = new Set(attemptMessageIds);
462
461
  const ack = async () => {
463
462
  const acknowledged = await ackMessages({
@@ -494,7 +493,6 @@ async function processConversationWorkInContext(message, options) {
494
493
  },
495
494
  conversationId,
496
495
  destination,
497
- publishExternally,
498
496
  shouldYield,
499
497
  stopSignal: stop.signal,
500
498
  checkIn
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createAndEnqueueAgentInvocation
3
- } from "./chunk-OJFX2FP7.js";
3
+ } from "./chunk-4CCQZHD3.js";
4
4
  import {
5
5
  actorFromRun,
6
6
  toolInvocationDestination
7
- } from "./chunk-GWCFXTB6.js";
7
+ } from "./chunk-SSR6YBWW.js";
8
8
 
9
9
  // src/chat/agent-invocations/spawn.ts
10
10
  function bindSpawnAgent(run, options) {