@sentry/junior 0.150.1 → 0.151.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 (71) hide show
  1. package/dist/{agent-hooks-G4LEACQB.js → agent-hooks-EYUAEBMA.js} +10 -10
  2. package/dist/api/schema/conversation.d.ts +24 -4
  3. package/dist/api/schema.js +1 -1
  4. package/dist/api.js +63 -35
  5. package/dist/app.js +123 -200
  6. package/dist/{catalog-runtime-ZRSNE2MH.js → catalog-runtime-2LCLLOBI.js} +5 -5
  7. package/dist/chat/agent/skills.d.ts +5 -4
  8. package/dist/chat/agent/tools.d.ts +5 -5
  9. package/dist/chat/conversations/history.d.ts +12 -3
  10. package/dist/chat/conversations/projection.d.ts +7 -3
  11. package/dist/chat/mcp/tool-manager.d.ts +0 -4
  12. package/dist/chat/runtime/agent-run-outcome.d.ts +4 -0
  13. package/dist/chat/tools/search-conversation-events.d.ts +1 -1
  14. package/dist/chat/tools/skill/call-mcp-tool.d.ts +0 -1
  15. package/dist/chat/tools/skill/load-skill.d.ts +2 -5
  16. package/dist/chat/tools/types.d.ts +1 -2
  17. package/dist/{chunk-TZRYLW3R.js → chunk-2MGJ64SL.js} +1 -1
  18. package/dist/{chunk-IQW6RFXG.js → chunk-3WOK4ZLX.js} +72 -218
  19. package/dist/{chunk-XED3H34M.js → chunk-4ABTAQYC.js} +3 -3
  20. package/dist/{chunk-KFHJQYKQ.js → chunk-5N3XLYBW.js} +1 -1
  21. package/dist/{chunk-JVOLC6JZ.js → chunk-6A46QL4O.js} +4 -4
  22. package/dist/{chunk-2DIRU2C2.js → chunk-6DLWRSGV.js} +1 -1
  23. package/dist/{chunk-OWLJZ6I7.js → chunk-6PGJPCN2.js} +1 -1
  24. package/dist/{chunk-AD6N2KNE.js → chunk-6WNWM5JD.js} +5 -5
  25. package/dist/{chunk-D2PVJU5E.js → chunk-AGSUPAD5.js} +2 -2
  26. package/dist/{chunk-W3FQZAX5.js → chunk-B7KWBJAR.js} +6 -6
  27. package/dist/{chunk-QO3OSJDS.js → chunk-C7D2ONB5.js} +1 -1
  28. package/dist/{chunk-LSI3EKZQ.js → chunk-CL5DT6D2.js} +4 -4
  29. package/dist/{chunk-FGP5W3NS.js → chunk-D22FO4LW.js} +2 -2
  30. package/dist/{chunk-6IWDFUXW.js → chunk-DJAOSWB6.js} +1 -1
  31. package/dist/{chunk-JBYWR6FW.js → chunk-EMB4VY7H.js} +5 -5
  32. package/dist/{chunk-R53UTQ2Q.js → chunk-H7ZMEHAN.js} +1 -1
  33. package/dist/{chunk-N6QJAPZS.js → chunk-J5LAA2LI.js} +9 -9
  34. package/dist/{chunk-2AWDPNP7.js → chunk-JIJOPRD4.js} +16 -10
  35. package/dist/{chunk-6A24WEKX.js → chunk-JSKTDBSS.js} +4 -4
  36. package/dist/{chunk-GZ25ZSTX.js → chunk-K3QXMZDU.js} +11 -4
  37. package/dist/{chunk-IZE2EGCX.js → chunk-KPQBQRNM.js} +5 -5
  38. package/dist/{chunk-SZ74ECCC.js → chunk-M6KRPBXC.js} +6 -6
  39. package/dist/{chunk-3WIFZBJL.js → chunk-OAPPJ3TM.js} +1 -1
  40. package/dist/{chunk-LWFHRWJI.js → chunk-OFRJXFTH.js} +8 -8
  41. package/dist/{chunk-2Z7YX5PI.js → chunk-OYRFUQOV.js} +106 -16
  42. package/dist/{chunk-6ZYGORV4.js → chunk-PQUV3NA5.js} +2 -2
  43. package/dist/{chunk-5NOHC2Z4.js → chunk-PWMVR2MD.js} +1 -1
  44. package/dist/{chunk-QNSV46AW.js → chunk-QVQBWWXQ.js} +6 -6
  45. package/dist/{chunk-4JV7GUUH.js → chunk-UDDCHQN2.js} +1 -1
  46. package/dist/{chunk-JUBPTYNO.js → chunk-WVXFEQXE.js} +1 -1
  47. package/dist/{chunk-3JVUWLR7.js → chunk-XN3QKNQX.js} +8 -1
  48. package/dist/{chunk-B2YA2G26.js → chunk-YN4W5SRJ.js} +1 -1
  49. package/dist/{chunk-QZGYKKH6.js → chunk-ZGSL5ARH.js} +50 -22
  50. package/dist/cli/chat.js +30 -30
  51. package/dist/cli/check.js +6 -6
  52. package/dist/cli/plugins.js +13 -13
  53. package/dist/cli/snapshot-create.js +9 -9
  54. package/dist/cli/upgrade.js +7 -7
  55. package/dist/{db-WRA5ZHYE.js → db-ALCBI4JZ.js} +7 -7
  56. package/dist/instrumentation.js +4 -4
  57. package/dist/nitro.js +2 -2
  58. package/dist/{oauth-callback-server-QWAYG3MI.js → oauth-callback-server-3RRMG62B.js} +23 -23
  59. package/dist/{runner-5JQ54J6P.js → runner-V6C3EELU.js} +14 -14
  60. package/dist/{skills-3YD55WPO.js → skills-43PFYZIZ.js} +6 -6
  61. package/dist/spawn-UZNNTNFU.js +38 -0
  62. package/dist/{validation-ZXE3IRSB.js → validation-4MNN6QKE.js} +6 -6
  63. package/dist/version.js +1 -1
  64. package/dist/{work-7G2U64WI.js → work-YZO6XTEB.js} +17 -17
  65. package/dist/{worker-HJM2FZNI.js → worker-42AR7323.js} +11 -11
  66. package/migrations/0025_mcp_credential_subject.sql +8 -0
  67. package/migrations/meta/0025_snapshot.json +2275 -0
  68. package/migrations/meta/_journal.json +7 -0
  69. package/package.json +4 -4
  70. package/dist/chat/pi/derived-state.d.ts +0 -5
  71. package/dist/spawn-OOO26XDL.js +0 -38
@@ -230,6 +230,7 @@ export declare const conversationEventDataSchema: z.ZodUnion<readonly [z.ZodUnio
230
230
  }, z.core.$loose>], "type">, z.ZodObject<{
231
231
  type: z.ZodLiteral<"mcp_provider_connected">;
232
232
  provider: z.ZodString;
233
+ credentialSubjectId: z.ZodString;
233
234
  }, z.core.$strict>, z.ZodObject<{
234
235
  type: z.ZodLiteral<"authorization_requested">;
235
236
  kind: z.ZodUnion<readonly [z.ZodLiteral<"plugin">, z.ZodLiteral<"mcp">]>;
@@ -455,11 +456,14 @@ export declare const conversationEventDataSchema: z.ZodUnion<readonly [z.ZodUnio
455
456
  }, z.core.$loose>], "type">;
456
457
  sourceEventSeq: z.ZodOptional<z.ZodNumber>;
457
458
  }, z.core.$strict>>;
458
- }, z.core.$strict>], "type">]>;
459
+ }, z.core.$strict>], "type">, z.ZodObject<{
460
+ type: z.ZodLiteral<"mcp_provider_connected_unowned">;
461
+ provider: z.ZodString;
462
+ }, z.core.$strict>]>;
459
463
  /** One durable conversation event's validated data. */
460
464
  export type ConversationEventData = z.output<typeof conversationEventDataSchema>;
461
465
  /** Event type names recognized by current readers and observational queries. */
462
- export declare const KNOWN_CONVERSATION_EVENT_TYPES: readonly ["message", "message_updated", "user_message", "assistant_message", "tool_result", "mcp_provider_connected", "authorization_requested", "authorization_completed", "tool_execution_started", "guardian_action_reviewed", "message_handled", "messages_summarized", "turn_started", "turn_context", "structured_event", "turn_routed", "turn_completed", "turn_failed", "subagent_started", "subagent_ended", "handoff", "compaction"];
466
+ export declare const KNOWN_CONVERSATION_EVENT_TYPES: readonly ["message", "message_updated", "user_message", "assistant_message", "tool_result", "mcp_provider_connected", "mcp_provider_connected_unowned", "authorization_requested", "authorization_completed", "tool_execution_started", "guardian_action_reviewed", "message_handled", "messages_summarized", "turn_started", "turn_context", "structured_event", "turn_routed", "turn_completed", "turn_failed", "subagent_started", "subagent_ended", "handoff", "compaction"];
463
467
  /** One known durable conversation event type name. */
464
468
  export type KnownConversationEventType = (typeof KNOWN_CONVERSATION_EVENT_TYPES)[number];
465
469
  declare const unknownConversationEventDataSchema: z.ZodObject<{
@@ -531,6 +535,7 @@ export declare const conversationEventSchema: z.ZodUnion<readonly [z.ZodObject<{
531
535
  }, z.core.$loose>], "type">, z.ZodObject<{
532
536
  type: z.ZodLiteral<"mcp_provider_connected">;
533
537
  provider: z.ZodString;
538
+ credentialSubjectId: z.ZodString;
534
539
  }, z.core.$strict>, z.ZodObject<{
535
540
  type: z.ZodLiteral<"authorization_requested">;
536
541
  kind: z.ZodUnion<readonly [z.ZodLiteral<"plugin">, z.ZodLiteral<"mcp">]>;
@@ -756,7 +761,10 @@ export declare const conversationEventSchema: z.ZodUnion<readonly [z.ZodObject<{
756
761
  }, z.core.$loose>], "type">;
757
762
  sourceEventSeq: z.ZodOptional<z.ZodNumber>;
758
763
  }, z.core.$strict>>;
759
- }, z.core.$strict>], "type">]>;
764
+ }, z.core.$strict>], "type">, z.ZodObject<{
765
+ type: z.ZodLiteral<"mcp_provider_connected_unowned">;
766
+ provider: z.ZodString;
767
+ }, z.core.$strict>]>;
760
768
  }, z.core.$strict>, z.ZodObject<{
761
769
  schemaVersion: z.ZodNumber;
762
770
  seq: z.ZodNumber;
@@ -855,6 +863,7 @@ export declare const newConversationEventSchema: z.ZodObject<{
855
863
  }, z.core.$loose>], "type">, z.ZodObject<{
856
864
  type: z.ZodLiteral<"mcp_provider_connected">;
857
865
  provider: z.ZodString;
866
+ credentialSubjectId: z.ZodString;
858
867
  }, z.core.$strict>, z.ZodObject<{
859
868
  type: z.ZodLiteral<"authorization_requested">;
860
869
  kind: z.ZodUnion<readonly [z.ZodLiteral<"plugin">, z.ZodLiteral<"mcp">]>;
@@ -39,8 +39,11 @@ export declare function loadTurnProjection(args: {
39
39
  committedSeq: number;
40
40
  includeTail: boolean;
41
41
  }): Promise<PiConversationEventProjection | undefined>;
42
- /** Load MCP providers connected in the current agent-history version. */
43
- export declare function loadConnectedMcpProviders(args: ScopedConversation): Promise<string[]>;
42
+ /** Load MCP providers the credential subject connected in this conversation. */
43
+ export declare function loadConnectedMcpProviders(args: {
44
+ conversationId: string;
45
+ credentialSubjectId: string;
46
+ }): Promise<string[]>;
44
47
  /**
45
48
  * Append newly stable native history items.
46
49
  *
@@ -90,10 +93,11 @@ export declare function commitAcceptedReply(args: {
90
93
  providerConversationBindings?: Array<Omit<ProviderConversationBinding, "conversationId">>;
91
94
  repliedAtMs?: number;
92
95
  }): Promise<void>;
93
- /** Record a successful MCP provider connection without duplicating the fact. */
96
+ /** Record a successful MCP provider connection for one credential subject without duplicating it. */
94
97
  export declare function recordMcpProviderConnected(args: {
95
98
  conversationId: string;
96
99
  provider: string;
100
+ credentialSubjectId: string;
97
101
  }): Promise<void>;
98
102
  /** Record that an OAuth/MCP authorization link was delivered or reused. */
99
103
  export declare function recordAuthorizationRequested(args: {
@@ -10,7 +10,6 @@ import type { ImageContent, TextContent } from "@earendil-works/pi-ai";
10
10
  import type { OAuthClientProvider } from "@modelcontextprotocol/sdk/client/auth.js";
11
11
  import { type PluginMcpToolResult, type ToolAnnotations } from "@sentry/junior-plugin-api";
12
12
  import type { ConversationPrivacy } from "@/chat/conversation-privacy";
13
- import type { SkillMetadata } from "@/chat/skills";
14
13
  import type { PluginDefinition } from "@/chat/plugins/types";
15
14
  import { McpAuthorizationRequiredError } from "./client";
16
15
  export interface McpToolSuccessHookInput {
@@ -50,7 +49,6 @@ export interface ManagedMcpToolDescriptor {
50
49
  annotations?: ToolAnnotations;
51
50
  provider: string;
52
51
  }
53
- type ActiveMcpSkill = Pick<SkillMetadata, "name" | "pluginProvider">;
54
52
  export interface ManagedMcpTool extends ManagedMcpToolDescriptor {
55
53
  execute: (args: Record<string, unknown>, options?: {
56
54
  conversationPrivacy?: ConversationPrivacy;
@@ -73,7 +71,6 @@ export declare class McpToolManager {
73
71
  description: string;
74
72
  active: boolean;
75
73
  }>;
76
- activateForSkill(skill: ActiveMcpSkill): Promise<boolean>;
77
74
  activateProvider(provider: string): Promise<boolean>;
78
75
  close(): Promise<void>;
79
76
  /** Return descriptors for all active MCP provider tools, optionally filtered by provider. */
@@ -96,4 +93,3 @@ export declare class McpToolManager {
96
93
  }): Promise<PluginMcpToolResult>;
97
94
  private toToolDescriptor;
98
95
  }
99
- export {};
@@ -8,11 +8,15 @@ import type { AgentTurnUsage } from "@/chat/usage";
8
8
  * the session record's optimistic-concurrency version. `awaiting_auth` means
9
9
  * the run parked for user authorization.
10
10
  */
11
+ /** Why a run parked at a safe boundary and may continue. */
12
+ export type AgentSuspensionReason = "timeout" | "yield" | "retry";
11
13
  export type AgentRunOutcome = {
12
14
  status: "completed";
13
15
  result: AgentRunResult;
14
16
  } | {
15
17
  status: "suspended";
18
+ /** Why this slice stopped. Callers use this to choose wake vs yield. */
19
+ reason: AgentSuspensionReason;
16
20
  resumeVersion: number;
17
21
  usage?: AgentTurnUsage;
18
22
  } | {
@@ -9,7 +9,7 @@ export declare function createSearchConversationEventsTool(context: ToolRuntimeC
9
9
  after_seq?: number | null | undefined;
10
10
  before_seq?: number | null | undefined;
11
11
  limit?: number | null | undefined;
12
- types?: ("message" | "message_handled" | "assistant_message" | "turn_routed" | "guardian_action_reviewed" | "turn_context" | "structured_event" | "compaction" | "handoff" | "user_message" | "tool_result" | "mcp_provider_connected" | "authorization_requested" | "authorization_completed" | "tool_execution_started" | "message_updated" | "messages_summarized" | "turn_started" | "turn_completed" | "turn_failed" | "subagent_started" | "subagent_ended")[] | null | undefined;
12
+ types?: ("message" | "message_handled" | "assistant_message" | "turn_routed" | "guardian_action_reviewed" | "turn_context" | "structured_event" | "compaction" | "handoff" | "user_message" | "tool_result" | "mcp_provider_connected" | "mcp_provider_connected_unowned" | "authorization_requested" | "authorization_completed" | "tool_execution_started" | "message_updated" | "messages_summarized" | "turn_started" | "turn_completed" | "turn_failed" | "subagent_started" | "subagent_ended")[] | null | undefined;
13
13
  };
14
14
  execute?: ((input: unknown, options: import("./definition").ToolExecuteOptions) => {
15
15
  [x: string]: unknown;
@@ -1,6 +1,5 @@
1
1
  import type { ManagedMcpTool } from "@/chat/mcp/tool-manager";
2
2
  interface CallMcpToolManager {
3
- activateProvider(provider: string): Promise<boolean>;
4
3
  getResolvedActiveTools(): ManagedMcpTool[];
5
4
  }
6
5
  /** Create the stable dispatcher for active MCP provider tools. */
@@ -7,13 +7,10 @@ export type LoadSkillResult = {
7
7
  location?: string;
8
8
  path_resolution?: string;
9
9
  instructions?: string;
10
- mcp_provider?: string;
11
- available_tool_count?: number;
12
10
  } & Record<string, unknown>;
13
- export type LoadSkillMetadata = Pick<LoadSkillResult, "mcp_provider" | "available_tool_count">;
14
- /** Create the skill-loading tool that injects skill instructions and activates provider catalogs. */
11
+ /** Create the tool that loads skill instructions for the current turn. */
15
12
  export declare function createLoadSkillTool(availableSkills: SkillMetadata[], options?: {
16
- onSkillLoaded?: (skill: Skill) => void | LoadSkillMetadata | Promise<void | LoadSkillMetadata>;
13
+ onSkillLoaded?: (skill: Skill) => void | Promise<void>;
17
14
  }): Omit<import("../definition").AnyToolDefinition, "inputSchema" | "outputSchema" | "prepareArguments" | "execute"> & {
18
15
  inputSchema: import("../definition").JsonSchemaObject;
19
16
  outputSchema: import("../definition").JsonSchemaObject;
@@ -4,7 +4,6 @@ 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";
6
6
  import type { Skill } from "@/chat/skills";
7
- import type { LoadSkillMetadata } from "@/chat/tools/skill/load-skill";
8
7
  import type { JuniorToolOutput } from "@/chat/tool-support/structured-result";
9
8
  import type { WebActor, LocalActor, Actor, SlackActor } from "@/chat/actor";
10
9
  import type { SlackActionToken } from "@/chat/slack/action-token";
@@ -44,7 +43,7 @@ export interface ToolHooks {
44
43
  * generating tool reports success.
45
44
  */
46
45
  writeGeneratedArtifacts?: (files: FileUpload[]) => GeneratedArtifactFileRef[] | Promise<GeneratedArtifactFileRef[]>;
47
- onSkillLoaded?: (skill: Skill) => void | LoadSkillMetadata | Promise<void | LoadSkillMetadata>;
46
+ onSkillLoaded?: (skill: Skill) => void | Promise<void>;
48
47
  toolOverrides?: {
49
48
  imageGenerate?: ImageGenerateToolDeps;
50
49
  viewImage?: ViewImageToolDeps;
@@ -5,7 +5,7 @@ import {
5
5
  logInfo,
6
6
  logWarn,
7
7
  setSpanAttributes
8
- } from "./chunk-3WIFZBJL.js";
8
+ } from "./chunk-OAPPJ3TM.js";
9
9
  import {
10
10
  discoverInstalledPluginPackageContent,
11
11
  normalizePluginPackageNames