@sentry/junior 0.189.0 → 0.191.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 (86) hide show
  1. package/dist/{agent-hooks-6QRYH6PX.js → agent-hooks-HIWWBBKO.js} +11 -11
  2. package/dist/api.js +27 -27
  3. package/dist/app.js +134 -152
  4. package/dist/{catalog-runtime-IETJLJFG.js → catalog-runtime-4OKH4265.js} +4 -4
  5. package/dist/chat/actor.d.ts +7 -2
  6. package/dist/chat/agent/resume.d.ts +0 -1
  7. package/dist/chat/agent/types.d.ts +0 -1
  8. package/dist/chat/agent-invocations/types.d.ts +44 -308
  9. package/dist/chat/event-tasks/tool-support.d.ts +1 -1
  10. package/dist/chat/providers/slack/runtime.d.ts +1 -2
  11. package/dist/chat/providers/slack/system-turn.d.ts +9 -4
  12. package/dist/chat/providers/slack/turn.d.ts +0 -1
  13. package/dist/chat/resource-events/actor.d.ts +2 -2
  14. package/dist/chat/services/turn-router.d.ts +1 -1
  15. package/dist/chat/slack/dispatch-turn.d.ts +0 -1
  16. package/dist/chat/slack/timestamp-param.d.ts +1 -1
  17. package/dist/chat/source.d.ts +3 -3
  18. package/dist/chat/task-execution/assistant-message.d.ts +7 -7
  19. package/dist/chat/task-execution/checkpoint.d.ts +0 -1
  20. package/dist/chat/task-execution/conversation-turn.d.ts +2 -2
  21. package/dist/chat/task-execution/mailbox-turn.d.ts +16 -6
  22. package/dist/chat/task-execution/state.d.ts +2 -5
  23. package/dist/chat/task-execution/store.d.ts +1 -2
  24. package/dist/chat/task-execution/turn-cursor.d.ts +10 -3
  25. package/dist/chat/task-execution/worker.d.ts +0 -1
  26. package/dist/chat/tools/types.d.ts +9 -2
  27. package/dist/{chunk-BYBSI5TI.js → chunk-2JAWOTUT.js} +2 -2
  28. package/dist/{chunk-WN6VLHOU.js → chunk-3PDR63SX.js} +30 -9
  29. package/dist/{chunk-SR6OMO5C.js → chunk-5IMKUVMS.js} +8 -11
  30. package/dist/{chunk-YYSEH2WC.js → chunk-6KISW5UY.js} +2 -2
  31. package/dist/{chunk-WDHPN2GH.js → chunk-7PYCRKQL.js} +3 -3
  32. package/dist/{chunk-YNZPOFF3.js → chunk-AWFSSFAX.js} +9 -11
  33. package/dist/{chunk-OEIITG5F.js → chunk-BVWC5DBM.js} +1 -1
  34. package/dist/{chunk-DYXVAO2E.js → chunk-BVYUIVXE.js} +1 -1
  35. package/dist/{chunk-WYDF6PGK.js → chunk-CCPOZMS4.js} +3 -3
  36. package/dist/{chunk-YYZNESC3.js → chunk-CECRMPXJ.js} +9 -8
  37. package/dist/{chunk-6AUR6PWR.js → chunk-CUUE5MGF.js} +3 -3
  38. package/dist/{chunk-MVPLEPSI.js → chunk-DP6H3U2X.js} +1 -1
  39. package/dist/{chunk-E3PDZPGV.js → chunk-EQZUBYRF.js} +1 -1
  40. package/dist/{chunk-PCPSX4ES.js → chunk-GQN4REF5.js} +14 -12
  41. package/dist/{chunk-AC7MDOJW.js → chunk-HNMRX2EN.js} +5 -5
  42. package/dist/{chunk-7R5JRPCY.js → chunk-K2NKG42A.js} +5 -5
  43. package/dist/{chunk-MFSET7Q7.js → chunk-KTW62MG5.js} +31 -13
  44. package/dist/{chunk-PY3EIEAF.js → chunk-L4JLLS6C.js} +1 -1
  45. package/dist/{chunk-CMWIMFM6.js → chunk-LOYTPSAK.js} +5 -5
  46. package/dist/{chunk-S3SGZUOI.js → chunk-MFZOIKET.js} +1 -1
  47. package/dist/{chunk-MI6ZBDTS.js → chunk-NK3UEKAW.js} +25 -10
  48. package/dist/{chunk-QNIOBNOY.js → chunk-NY5SJGJZ.js} +52 -46
  49. package/dist/{chunk-4RHJ3CXR.js → chunk-Q32BSFN4.js} +13 -12
  50. package/dist/{chunk-ZV6PFUA4.js → chunk-QRNJO7DZ.js} +1 -1
  51. package/dist/{chunk-KN32OWL2.js → chunk-RZS4F5K4.js} +3 -3
  52. package/dist/{chunk-CUYFCI4G.js → chunk-S7NSFCCW.js} +16 -13
  53. package/dist/{chunk-5VWAY27R.js → chunk-SEIZ2XLD.js} +1 -1
  54. package/dist/{chunk-MRXMFB4L.js → chunk-SGRL7NV6.js} +5 -5
  55. package/dist/{chunk-WWYUYKKV.js → chunk-TH6LMEOW.js} +1 -1
  56. package/dist/{chunk-WMUAKAIF.js → chunk-VGYZ3YZM.js} +85 -41
  57. package/dist/{chunk-ZUPDSJUE.js → chunk-WBNQYVCM.js} +2 -2
  58. package/dist/{chunk-GP32KD2J.js → chunk-WCSXTDOL.js} +1 -1
  59. package/dist/{chunk-O35GZCKL.js → chunk-WNIVCR74.js} +2 -2
  60. package/dist/{chunk-UCWO5MKP.js → chunk-X6PQKQTY.js} +5 -7
  61. package/dist/{chunk-5CXCGDIL.js → chunk-YNRLCUCB.js} +1 -1
  62. package/dist/{chunk-LHKZKAZ4.js → chunk-ZJRGWZZ2.js} +3 -3
  63. package/dist/{chunk-NY2F7BZA.js → chunk-ZNFNGDT7.js} +1 -1
  64. package/dist/{chunk-VKQWU4PO.js → chunk-ZRN3OS7M.js} +1 -1
  65. package/dist/cli/chat.js +33 -33
  66. package/dist/cli/check.js +5 -5
  67. package/dist/cli/plugins.js +12 -12
  68. package/dist/cli/snapshot-create.js +9 -9
  69. package/dist/cli/upgrade.js +6 -6
  70. package/dist/db/schema/agent-invocations.d.ts +18 -6
  71. package/dist/db/schema.d.ts +18 -6
  72. package/dist/{db-LPJKR2EO.js → db-LG4ZEWA3.js} +6 -6
  73. package/dist/instrumentation.js +3 -3
  74. package/dist/nitro.js +6 -6
  75. package/dist/{oauth-callback-server-DMXF4TTQ.js → oauth-callback-server-KI7ZRTOG.js} +29 -29
  76. package/dist/{runner-L5DPVYCN.js → runner-K2EOSAZQ.js} +21 -21
  77. package/dist/{skills-NXG3LBCK.js → skills-JTRDFKMA.js} +5 -5
  78. package/dist/spawn-SRBETYCF.js +42 -0
  79. package/dist/task-runner-INQIQ4VF.js +36 -0
  80. package/dist/{validation-CH36LTOS.js → validation-NBWURHAP.js} +5 -5
  81. package/dist/version.js +1 -1
  82. package/dist/{work-HBC5Y5VZ.js → work-35TBEAUI.js} +21 -21
  83. package/dist/{worker-5RDZHLXH.js → worker-F762M6XM.js} +10 -10
  84. package/package.json +6 -6
  85. package/dist/spawn-VRUIGKWW.js +0 -42
  86. package/dist/task-runner-7YTBSPXW.js +0 -36
@@ -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>;
@@ -10,17 +10,27 @@ export type MailboxTurnInput = {
10
10
  actor: Actor;
11
11
  author: ConversationAuthor;
12
12
  message: InboundMessage;
13
- source: "resource_event" | "web";
13
+ source: Source;
14
14
  };
15
15
  /** Actor and Source facts saved for one Turn. */
16
16
  export type TurnInputFacts = Pick<MailboxTurnInput, "actor" | "author" | "source">;
17
- /** Restore the Turn input facts kept on one saved Message. */
18
- export declare function turnInputFactsFromConversationMessage(message: ConversationMessage): TurnInputFacts | undefined;
19
- /** Build the AgentRun Source for one Turn input. */
20
- export declare function sourceFromTurnInput(args: {
17
+ /**
18
+ * Restore Turn input facts, with saved Message fallback for legacy cursors.
19
+ *
20
+ * TODO(dcramer): Remove Actor and Source reconstruction from the saved Message
21
+ * after no deployed Turn cursor can omit either field.
22
+ */
23
+ export declare function turnInputFactsFromConversationMessage(message: ConversationMessage, args: {
21
24
  conversationId: string;
22
25
  location?: Location;
23
- source: MailboxTurnInput["source"];
26
+ savedActor?: Actor;
27
+ savedSource?: Source;
28
+ visibility?: ConversationPrivacy;
29
+ }): TurnInputFacts | undefined;
30
+ /** Normalize the selected mailbox Source with current Conversation visibility. */
31
+ export declare function sourceFromTurnInput(args: {
32
+ conversationId: string;
33
+ source: Source;
24
34
  visibility?: ConversationPrivacy;
25
35
  }): Source;
26
36
  /** Return the active web Turn for one Conversation, if it has one. */
@@ -18,11 +18,11 @@ declare const inboundMessageSourceSchema: z.ZodEnum<{
18
18
  slack: "slack";
19
19
  local: "local";
20
20
  web: "web";
21
+ resource_event: "resource_event";
21
22
  plugin: "plugin";
22
23
  api: "api";
23
24
  scheduler: "scheduler";
24
25
  internal: "internal";
25
- resource_event: "resource_event";
26
26
  }>;
27
27
  export type Source = z.output<typeof inboundMessageSourceSchema>;
28
28
  export type ExecutionStatus = "paused" | "failed" | "idle" | "pending" | "running";
@@ -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,16 +65,15 @@ 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";
74
71
  web: "web";
72
+ resource_event: "resource_event";
75
73
  plugin: "plugin";
76
74
  api: "api";
77
75
  scheduler: "scheduler";
78
76
  internal: "internal";
79
- resource_event: "resource_event";
80
77
  }>;
81
78
  }, z.core.$strict>;
82
79
  export type InboundMessage = z.output<typeof inboundMessageSchema>;
@@ -138,8 +138,7 @@ 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
- source: "slack" | "local" | "web" | "plugin" | "api" | "scheduler" | "internal" | "resource_event";
141
+ source: "slack" | "local" | "web" | "resource_event" | "plugin" | "api" | "scheduler" | "internal";
143
142
  attemptCount?: number | undefined;
144
143
  destination?: {
145
144
  platform: "slack";
@@ -7,7 +7,7 @@
7
7
  * keeps resume metadata and a committed `seq` cursor into
8
8
  * `junior_conversation_events`.
9
9
  */
10
- import type { Destination, Source } from "@sentry/junior-plugin-api";
10
+ import { type Destination, type Source } from "@sentry/junior-plugin-api";
11
11
  import { type PiMessage } from "@/chat/pi/messages";
12
12
  import { type Actor } from "@/chat/actor";
13
13
  import { type ConversationMessageProvenance } from "@/chat/conversations/provenance";
@@ -20,6 +20,13 @@ export type AgentTurnSurface = "slack" | "api" | "scheduler" | "internal";
20
20
  export type TurnPauseReason = "timeout" | "auth" | "yield" | "retry";
21
21
  export type AgentDispatchOutcome = "blocked" | "completed" | "failed";
22
22
  export interface TurnRecord {
23
+ /**
24
+ * Actor that started this Turn; absent only on stored legacy cursors.
25
+ *
26
+ * TODO(dcramer): Make this field required after no deployed Turn cursor can
27
+ * omit Actor.
28
+ */
29
+ actor?: Actor;
23
30
  channelName?: string;
24
31
  schemaVersion: 2;
25
32
  version: number;
@@ -43,7 +50,8 @@ export interface TurnRecord {
43
50
  */
44
51
  actors: Actor[];
45
52
  resumeReason?: TurnPauseReason;
46
- publishExternally?: boolean;
53
+ /** Input that started this Turn; absent only on stored legacy cursors. */
54
+ source?: Source;
47
55
  resumedFromSliceId?: number;
48
56
  turnId: string;
49
57
  sliceId: number;
@@ -97,7 +105,6 @@ export declare function upsertTurnRecord(args: {
97
105
  trailingMessageProvenance?: ConversationMessageProvenance[];
98
106
  actor?: Actor;
99
107
  resumeReason?: TurnPauseReason;
100
- publishExternally?: boolean;
101
108
  errorMessage?: string;
102
109
  resumedFromSliceId?: number;
103
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. */
@@ -1,5 +1,5 @@
1
1
  import type { FileUpload } from "chat";
2
- import type { WebSource, Destination, Identity, LocalDestination, LocalSource, PluginEgress, SlackDestination, SlackSource, Source, User } from "@sentry/junior-plugin-api";
2
+ import type { WebSource, ResourceEventSource, Destination, Identity, LocalDestination, LocalSource, PluginEgress, SlackDestination, SlackSource, Source, SystemActor, User } from "@sentry/junior-plugin-api";
3
3
  import type { McpToolManager } from "@/chat/mcp/tool-manager";
4
4
  import type { SandboxWorkspace } from "@/chat/sandbox/workspace";
5
5
  import type { AgentTurnSurface } from "@/chat/task-execution/checkpoint";
@@ -109,7 +109,14 @@ interface WebToolRuntimeContext extends BaseToolRuntimeContext {
109
109
  slack?: never;
110
110
  slackActionToken?: never;
111
111
  }
112
- export type ToolRuntimeContext = LocalToolRuntimeContext | SlackToolRuntimeContext | WebToolRuntimeContext;
112
+ interface ResourceEventToolRuntimeContext extends BaseToolRuntimeContext {
113
+ destination: Destination;
114
+ actor?: SystemActor;
115
+ source: ResourceEventSource;
116
+ slack?: never;
117
+ slackActionToken?: never;
118
+ }
119
+ export type ToolRuntimeContext = LocalToolRuntimeContext | ResourceEventToolRuntimeContext | SlackToolRuntimeContext | WebToolRuntimeContext;
113
120
  export interface ToolState {
114
121
  getOperationResult: <T>(operationKey: string) => T | undefined;
115
122
  setOperationResult: (operationKey: string, result: unknown) => void;
@@ -7,7 +7,7 @@ import {
7
7
  toCanonicalInputMessage,
8
8
  toCanonicalOutputMessage,
9
9
  toGenAiMessagesTraceAttributes
10
- } from "./chunk-DYXVAO2E.js";
10
+ } from "./chunk-BVYUIVXE.js";
11
11
  import {
12
12
  extractGenAiUsageAttributes,
13
13
  logException,
@@ -15,7 +15,7 @@ import {
15
15
  normalizeGenAiFinishReason,
16
16
  serializeGenAiAttribute,
17
17
  withSpan
18
- } from "./chunk-PY3EIEAF.js";
18
+ } from "./chunk-L4JLLS6C.js";
19
19
 
20
20
  // src/chat/services/provider-error.ts
21
21
  var ProviderError = class extends Error {
@@ -8,14 +8,14 @@ import {
8
8
  getConversationStore,
9
9
  parseDestination,
10
10
  sameDestination
11
- } from "./chunk-CUYFCI4G.js";
11
+ } from "./chunk-S7NSFCCW.js";
12
12
  import {
13
13
  getDefaultRedisStateAdapterFor,
14
14
  getStateAdapter
15
- } from "./chunk-5CXCGDIL.js";
15
+ } from "./chunk-YNRLCUCB.js";
16
16
  import {
17
17
  getChatConfig
18
- } from "./chunk-BYBSI5TI.js";
18
+ } from "./chunk-2JAWOTUT.js";
19
19
  import {
20
20
  parseStoredSlackActor
21
21
  } from "./chunk-N7TMSOZH.js";
@@ -23,7 +23,7 @@ import {
23
23
  isRecord,
24
24
  toOptionalNumber,
25
25
  toOptionalString
26
- } from "./chunk-PY3EIEAF.js";
26
+ } from "./chunk-L4JLLS6C.js";
27
27
 
28
28
  // src/chat/task-execution/state.ts
29
29
  import { randomUUID } from "crypto";
@@ -81,7 +81,6 @@ var agentInputSchema = z.object({
81
81
  message: "agent input requires text or attachments"
82
82
  });
83
83
  var inboundMessageDeliverySchema = z.enum(["defer", "interrupt"]);
84
- var publishExternallySchema = z.boolean();
85
84
  var inboundMessageSchema = z.object({
86
85
  attemptCount: z.number().finite().optional(),
87
86
  conversationId: z.string().refine((value) => value.trim().length > 0),
@@ -92,9 +91,11 @@ var inboundMessageSchema = z.object({
92
91
  injectedAtMs: z.number().finite().optional(),
93
92
  input: agentInputSchema,
94
93
  receivedAtMs: z.number().finite(),
95
- publishExternally: publishExternallySchema,
96
94
  source: inboundMessageSourceSchema
97
95
  }).strict();
96
+ var storedInboundMessageSchema = inboundMessageSchema.extend({
97
+ publishExternally: z.boolean()
98
+ });
98
99
  function conversationKey(conversationId) {
99
100
  return `${CONVERSATION_PREFIX}:${conversationId}`;
100
101
  }
@@ -148,8 +149,15 @@ function normalizeExecutionStatus(value) {
148
149
  return void 0;
149
150
  }
150
151
  function normalizeMessage(value) {
151
- const parsed = inboundMessageSchema.safeParse(value);
152
- return parsed.success ? parsed.data : void 0;
152
+ const parsed = storedInboundMessageSchema.safeParse(value);
153
+ if (!parsed.success) {
154
+ return void 0;
155
+ }
156
+ const { publishExternally: _publishExternally, ...message } = parsed.data;
157
+ return message;
158
+ }
159
+ function storeMessage(message, publishExternally) {
160
+ return { ...message, publishExternally };
153
161
  }
154
162
  function isFinalAttempt(message) {
155
163
  return (message.attemptCount ?? 0) >= CONVERSATION_WORK_MAX_DELIVERY_ATTEMPTS - 1;
@@ -612,9 +620,22 @@ async function writeConversation(state, lock, conversation) {
612
620
  if (!fenced) {
613
621
  throw new ConversationMutationFencedError(next.conversationId);
614
622
  }
623
+ const hasSlackDestination = next.destination?.platform === "slack";
624
+ const stored = {
625
+ ...next,
626
+ execution: {
627
+ ...next.execution,
628
+ pendingMessages: next.execution.pendingMessages.map(
629
+ (message) => storeMessage(
630
+ message,
631
+ hasSlackDestination && (message.source === "slack" || message.source === "resource_event" || message.source === "plugin" || message.source === "scheduler")
632
+ )
633
+ )
634
+ }
635
+ };
615
636
  await state.set(
616
637
  conversationKey(next.conversationId),
617
- next,
638
+ stored,
618
639
  JUNIOR_THREAD_STATE_TTL_MS
619
640
  );
620
641
  await upsertIndexEntry({
@@ -3,39 +3,39 @@ import {
3
3
  } from "./chunk-UTL3MHPC.js";
4
4
  import {
5
5
  parseSlackThreadId
6
- } from "./chunk-MVPLEPSI.js";
6
+ } from "./chunk-DP6H3U2X.js";
7
7
  import {
8
8
  appendAndEnqueueExclusiveInboundMessage,
9
9
  appendAndEnqueueInboundMessage
10
- } from "./chunk-WN6VLHOU.js";
10
+ } from "./chunk-3PDR63SX.js";
11
11
  import {
12
12
  buildDeterministicTurnId
13
13
  } from "./chunk-DA2KGZZI.js";
14
14
  import {
15
15
  normalizeSlackConversationId
16
- } from "./chunk-MI6ZBDTS.js";
16
+ } from "./chunk-NK3UEKAW.js";
17
17
  import {
18
18
  getConversationStore,
19
19
  getDb
20
- } from "./chunk-CUYFCI4G.js";
20
+ } from "./chunk-S7NSFCCW.js";
21
21
  import {
22
22
  juniorConversationParticipants,
23
23
  juniorConversations,
24
24
  juniorIdentities,
25
25
  juniorUsers
26
- } from "./chunk-5VWAY27R.js";
26
+ } from "./chunk-SEIZ2XLD.js";
27
27
  import {
28
28
  juniorDestinations
29
29
  } from "./chunk-VFUK3X5B.js";
30
30
  import {
31
31
  getSlackBotToken
32
- } from "./chunk-BYBSI5TI.js";
32
+ } from "./chunk-2JAWOTUT.js";
33
33
  import {
34
34
  canExposeConversationPayload
35
- } from "./chunk-DYXVAO2E.js";
35
+ } from "./chunk-BVYUIVXE.js";
36
36
  import {
37
37
  logWarn
38
- } from "./chunk-PY3EIEAF.js";
38
+ } from "./chunk-L4JLLS6C.js";
39
39
 
40
40
  // src/handlers/health.ts
41
41
  function readHealthReport() {
@@ -398,9 +398,6 @@ function buildWebInboundMessage(args) {
398
398
  }
399
399
  },
400
400
  receivedAtMs: nowMs,
401
- // TODO(dcramer): Rename this stored field to publish after deployed
402
- // mailbox readers and writers use the new name.
403
- publishExternally: false,
404
401
  // TODO(dcramer): Replace this string after deployed mailbox readers and
405
402
  // writers use a complete web Source.
406
403
  source: "web"
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-E3PDZPGV.js";
3
+ } from "./chunk-EQZUBYRF.js";
4
4
  import {
5
5
  skillRoots
6
6
  } from "./chunk-TXKUKMVO.js";
7
7
  import {
8
8
  logWarn
9
- } from "./chunk-PY3EIEAF.js";
9
+ } from "./chunk-L4JLLS6C.js";
10
10
 
11
11
  // src/chat/skills.ts
12
12
  import fs from "fs/promises";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  toOptionalTrimmed
3
- } from "./chunk-BYBSI5TI.js";
3
+ } from "./chunk-2JAWOTUT.js";
4
4
  import {
5
5
  pluginCatalogRuntime
6
- } from "./chunk-E3PDZPGV.js";
6
+ } from "./chunk-EQZUBYRF.js";
7
7
  import {
8
8
  setSpanAttributes,
9
9
  setSpanStatus
10
- } from "./chunk-PY3EIEAF.js";
10
+ } from "./chunk-L4JLLS6C.js";
11
11
 
12
12
  // src/chat/sandbox/paths.ts
13
13
  function normalizeWorkspaceRoot(input) {
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  AgentRunError,
3
3
  executeTurn
4
- } from "./chunk-WYDF6PGK.js";
4
+ } from "./chunk-CCPOZMS4.js";
5
5
  import {
6
6
  ConversationTurnLifecycleService
7
- } from "./chunk-WWYUYKKV.js";
7
+ } from "./chunk-TH6LMEOW.js";
8
8
  import {
9
9
  getPersistedSandboxState,
10
10
  getPersistedThreadState,
11
11
  persistThreadStateById
12
- } from "./chunk-MRXMFB4L.js";
12
+ } from "./chunk-SGRL7NV6.js";
13
13
  import {
14
14
  AgentInvocationBusyError,
15
15
  AgentInvocationLimitError,
@@ -18,32 +18,32 @@ import {
18
18
  agentBindingSchema,
19
19
  agentInvocationSchema,
20
20
  createAgentInvocationSchema
21
- } from "./chunk-AC7MDOJW.js";
21
+ } from "./chunk-HNMRX2EN.js";
22
22
  import {
23
23
  TurnInputCommitLostError,
24
24
  getAssistantReplyText,
25
25
  getConversationTurnBoundaryError,
26
26
  isTurnInputCommitLostError
27
- } from "./chunk-GP32KD2J.js";
27
+ } from "./chunk-WCSXTDOL.js";
28
28
  import {
29
29
  failTurnRecord,
30
30
  getTerminalAssistantMessages,
31
31
  getTurnRecord,
32
32
  openConversationProjection,
33
33
  saveTurnCheckpoint
34
- } from "./chunk-MFSET7Q7.js";
34
+ } from "./chunk-KTW62MG5.js";
35
35
  import {
36
36
  appendAndEnqueueInboundMessage
37
- } from "./chunk-WN6VLHOU.js";
37
+ } from "./chunk-3PDR63SX.js";
38
38
  import {
39
39
  getConversationEventStore,
40
40
  getConversationStore,
41
41
  getSqlExecutor
42
- } from "./chunk-CUYFCI4G.js";
42
+ } from "./chunk-S7NSFCCW.js";
43
43
  import {
44
44
  juniorAgentBindings,
45
45
  juniorAgentInvocations
46
- } from "./chunk-5VWAY27R.js";
46
+ } from "./chunk-SEIZ2XLD.js";
47
47
 
48
48
  // src/chat/agent-invocations/work.ts
49
49
  import { z } from "zod";
@@ -314,7 +314,6 @@ function buildAgentInvocationInboundMessage(invocation, nowMs = Date.now()) {
314
314
  }
315
315
  },
316
316
  receivedAtMs: nowMs,
317
- publishExternally: false,
318
317
  source: "internal"
319
318
  };
320
319
  }
@@ -590,7 +589,6 @@ function createAgentInvocationWorker(agentRunner) {
590
589
  actor: invocation.actor,
591
590
  credentialContext: invocation.credentialContext,
592
591
  destination: invocation.destination,
593
- publishExternally: context.publishExternally,
594
592
  source: invocation.source,
595
593
  ...location ? { location } : void 0,
596
594
  surface: "internal",
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-E3PDZPGV.js";
3
+ } from "./chunk-EQZUBYRF.js";
4
4
 
5
5
  // src/chat/plugins/validation.ts
6
6
  import { isDeepStrictEqual } from "util";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logWarn
3
- } from "./chunk-PY3EIEAF.js";
3
+ } from "./chunk-L4JLLS6C.js";
4
4
 
5
5
  // src/chat/conversation-privacy.ts
6
6
  import { AsyncLocalStorage } from "async_hooks";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  ConversationTurnLifecycleService
3
- } from "./chunk-WWYUYKKV.js";
3
+ } from "./chunk-TH6LMEOW.js";
4
4
  import {
5
5
  runAgentWithTimeout
6
- } from "./chunk-PCPSX4ES.js";
6
+ } from "./chunk-GQN4REF5.js";
7
7
  import {
8
8
  getConversationEventStore
9
- } from "./chunk-CUYFCI4G.js";
9
+ } from "./chunk-S7NSFCCW.js";
10
10
 
11
11
  // src/chat/runtime/turn-execution.ts
12
12
  var AgentRunError = class extends Error {
@@ -1,32 +1,32 @@
1
1
  import {
2
2
  resolveBaseUrl
3
- } from "./chunk-PCPSX4ES.js";
3
+ } from "./chunk-GQN4REF5.js";
4
4
  import {
5
5
  createPluginLogger,
6
6
  getPlugins,
7
7
  getSlackClient,
8
8
  withSlackRetries
9
- } from "./chunk-MI6ZBDTS.js";
9
+ } from "./chunk-NK3UEKAW.js";
10
10
  import {
11
11
  getDb,
12
12
  parseDestination
13
- } from "./chunk-CUYFCI4G.js";
13
+ } from "./chunk-S7NSFCCW.js";
14
14
  import {
15
15
  sleep
16
- } from "./chunk-WDHPN2GH.js";
16
+ } from "./chunk-7PYCRKQL.js";
17
17
  import {
18
18
  acquireActiveLock,
19
19
  getStateAdapter
20
- } from "./chunk-5CXCGDIL.js";
20
+ } from "./chunk-YNRLCUCB.js";
21
21
  import {
22
22
  pluginCatalogRuntime
23
- } from "./chunk-E3PDZPGV.js";
23
+ } from "./chunk-EQZUBYRF.js";
24
24
  import {
25
25
  fetchWithBoundedOAuthErrorBodies
26
- } from "./chunk-ZV6PFUA4.js";
26
+ } from "./chunk-QRNJO7DZ.js";
27
27
  import {
28
28
  isRecord
29
- } from "./chunk-PY3EIEAF.js";
29
+ } from "./chunk-L4JLLS6C.js";
30
30
 
31
31
  // src/chat/capabilities/router.ts
32
32
  var ProviderCredentialRouter = class {
@@ -1155,6 +1155,7 @@ export {
1155
1155
  deleteMcpAuthSession,
1156
1156
  deleteMcpAuthSessionsForUserProvider,
1157
1157
  getMcpStoredOAuthCredentials,
1158
+ putMcpStoredOAuthCredentials,
1158
1159
  deleteMcpStoredOAuthCredentials,
1159
1160
  deleteMcpServerSessionId,
1160
1161
  createMcpOAuthClientProvider,
@@ -6,14 +6,14 @@ import {
6
6
  isStale,
7
7
  runNonInteractiveCommand,
8
8
  sleep
9
- } from "./chunk-WDHPN2GH.js";
9
+ } from "./chunk-7PYCRKQL.js";
10
10
  import {
11
11
  getStateAdapter
12
- } from "./chunk-5CXCGDIL.js";
12
+ } from "./chunk-YNRLCUCB.js";
13
13
  import {
14
14
  setSpanAttributes,
15
15
  withSpan
16
- } from "./chunk-PY3EIEAF.js";
16
+ } from "./chunk-L4JLLS6C.js";
17
17
 
18
18
  // src/chat/sandbox/resources.ts
19
19
  var configuredResources;
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-N7TMSOZH.js";
6
6
  import {
7
7
  toOptionalString
8
- } from "./chunk-PY3EIEAF.js";
8
+ } from "./chunk-L4JLLS6C.js";
9
9
 
10
10
  // src/chat/slack/context.ts
11
11
  import { z } from "zod";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createPluginCatalogRuntime
3
- } from "./chunk-ZV6PFUA4.js";
3
+ } from "./chunk-QRNJO7DZ.js";
4
4
 
5
5
  // src/chat/plugins/catalog-runtime.ts
6
6
  var pluginCatalogRuntime = createPluginCatalogRuntime();
@@ -8,19 +8,19 @@ import {
8
8
  isDmChannel,
9
9
  normalizeSlackConversationId,
10
10
  withSlackRetries
11
- } from "./chunk-MI6ZBDTS.js";
11
+ } from "./chunk-NK3UEKAW.js";
12
12
  import {
13
13
  parseDestination
14
- } from "./chunk-CUYFCI4G.js";
14
+ } from "./chunk-S7NSFCCW.js";
15
15
  import {
16
16
  getStateAdapter
17
- } from "./chunk-5CXCGDIL.js";
17
+ } from "./chunk-YNRLCUCB.js";
18
18
  import {
19
19
  normalizeSlackEmojiName
20
- } from "./chunk-BYBSI5TI.js";
20
+ } from "./chunk-2JAWOTUT.js";
21
21
  import {
22
22
  pluginCatalogRuntime
23
- } from "./chunk-E3PDZPGV.js";
23
+ } from "./chunk-EQZUBYRF.js";
24
24
  import {
25
25
  parseSlackMessageTs,
26
26
  parseSlackUserId
@@ -29,7 +29,7 @@ import {
29
29
  isRecord,
30
30
  logInfo,
31
31
  logWarn
32
- } from "./chunk-PY3EIEAF.js";
32
+ } from "./chunk-L4JLLS6C.js";
33
33
 
34
34
  // src/chat/agent/types.ts
35
35
  var RetryableDeliveryError = class extends Error {
@@ -55,7 +55,7 @@ function actorFromRun(run) {
55
55
  }
56
56
  function assertRunConsistency(run) {
57
57
  const { destination, source } = run;
58
- switch (source.platform) {
58
+ switch (source.kind) {
59
59
  case "slack": {
60
60
  if (destination.platform !== "slack") {
61
61
  throw new TypeError(
@@ -108,17 +108,19 @@ function assertRunConsistency(run) {
108
108
  }
109
109
  break;
110
110
  }
111
+ case "resource_event":
112
+ break;
111
113
  }
112
114
  const actor = run.dispatch?.actor ?? run.actor;
113
115
  if (!actor || actor.platform === "system") {
114
116
  return;
115
117
  }
116
- if (actor.platform !== source.platform) {
118
+ if (actor.platform !== source.kind) {
117
119
  throw new TypeError(
118
- `Actor platform "${actor.platform}" does not match Source platform "${source.platform}"`
120
+ `Actor platform "${actor.platform}" does not match Source kind "${source.kind}"`
119
121
  );
120
122
  }
121
- if (actor.platform === "slack" && source.platform === "slack" && actor.teamId !== source.teamId) {
123
+ if (actor.platform === "slack" && source.kind === "slack" && actor.teamId !== source.teamId) {
122
124
  throw new TypeError("Slack Actor team does not match Source team");
123
125
  }
124
126
  }
@@ -136,10 +138,10 @@ function surfaceFromRun(run) {
136
138
  if (run.surface) {
137
139
  return run.surface;
138
140
  }
139
- if (run.source.platform === "slack") {
141
+ if (run.source.kind === "slack") {
140
142
  return "slack";
141
143
  }
142
- if (run.source.platform === "web") {
144
+ if (run.source.kind === "web") {
143
145
  return "api";
144
146
  }
145
147
  return "internal";