@sentry/junior 0.106.0 → 0.107.1

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 (132) hide show
  1. package/dist/{agent-hooks-KR5BCWOK.js → agent-hooks-ICPIJAFY.js} +9 -7
  2. package/dist/api/conversations/detail.d.ts +1 -1
  3. package/dist/api/conversations/events.d.ts +14 -0
  4. package/dist/api/conversations/schema.d.ts +196 -463
  5. package/dist/api/schema.d.ts +2 -7
  6. package/dist/api/schema.js +10 -8
  7. package/dist/api.js +377 -810
  8. package/dist/app.js +3586 -3614
  9. package/dist/{catalog-runtime-5CVM2DOF.js → catalog-runtime-FOFNPR3P.js} +3 -2
  10. package/dist/chat/agent/prompt.d.ts +1 -1
  11. package/dist/chat/agent/request.d.ts +28 -29
  12. package/dist/chat/agent/resume.d.ts +7 -7
  13. package/dist/chat/agent/session.d.ts +5 -6
  14. package/dist/chat/agent/tools.d.ts +3 -3
  15. package/dist/chat/agent-dispatch/runner.d.ts +2 -0
  16. package/dist/chat/config.d.ts +2 -2
  17. package/dist/chat/conversations/history.d.ts +582 -167
  18. package/dist/chat/conversations/message-projection.d.ts +6 -0
  19. package/dist/chat/conversations/message-summaries.d.ts +9 -0
  20. package/dist/chat/conversations/messages.d.ts +13 -27
  21. package/dist/chat/conversations/projection.d.ts +30 -53
  22. package/dist/chat/conversations/provenance.d.ts +42 -0
  23. package/dist/chat/conversations/search.d.ts +2 -2
  24. package/dist/chat/conversations/sql/conversation-row.d.ts +1 -1
  25. package/dist/chat/conversations/sql/event-lock.d.ts +3 -0
  26. package/dist/chat/conversations/sql/history.d.ts +3 -3
  27. package/dist/chat/conversations/sql/privacy.d.ts +27 -0
  28. package/dist/chat/conversations/sql/purge.d.ts +2 -10
  29. package/dist/chat/conversations/sql/store.d.ts +0 -5
  30. package/dist/chat/conversations/store.d.ts +8 -13
  31. package/dist/chat/conversations/turn-lifecycle.d.ts +41 -0
  32. package/dist/chat/db.d.ts +4 -10
  33. package/dist/chat/model-profile.d.ts +10 -0
  34. package/dist/chat/oauth-flow.d.ts +0 -5
  35. package/dist/chat/pi/conversation-events.d.ts +33 -0
  36. package/dist/chat/pi/sql-model-usage.d.ts +10 -0
  37. package/dist/chat/plugins/agent-hooks.d.ts +4 -2
  38. package/dist/chat/resource-events/ingest.d.ts +0 -13
  39. package/dist/chat/runtime/delivered-turn-state.d.ts +1 -1
  40. package/dist/chat/runtime/generated-artifacts.d.ts +1 -1
  41. package/dist/chat/runtime/reply-executor.d.ts +2 -0
  42. package/dist/chat/runtime/slack-resume.d.ts +23 -28
  43. package/dist/chat/runtime/slack-runtime.d.ts +2 -0
  44. package/dist/chat/runtime/turn.d.ts +14 -1
  45. package/dist/chat/services/context-compaction-marker.d.ts +0 -1
  46. package/dist/chat/services/context-compaction.d.ts +1 -0
  47. package/dist/chat/services/conversation-memory.d.ts +9 -0
  48. package/dist/chat/services/plugin-auth-orchestration.d.ts +1 -4
  49. package/dist/chat/services/subscribed-decision.d.ts +1 -1
  50. package/dist/chat/services/turn-failure-response.d.ts +10 -3
  51. package/dist/chat/services/turn-result.d.ts +7 -12
  52. package/dist/chat/services/{turn-reasoning-level.d.ts → turn-router.d.ts} +12 -8
  53. package/dist/chat/services/turn-session-record.d.ts +15 -16
  54. package/dist/chat/slack/adapter.d.ts +2 -2
  55. package/dist/chat/slack/errors.d.ts +2 -0
  56. package/dist/chat/slack/outbound.d.ts +0 -1
  57. package/dist/chat/slack/reply.d.ts +2 -8
  58. package/dist/chat/slack/tools/channel-capabilities.d.ts +2 -2
  59. package/dist/chat/slack/tools/{send-message.d.ts → send-files.d.ts} +27 -19
  60. package/dist/chat/state/conversation.d.ts +4 -4
  61. package/dist/chat/state/turn-id.d.ts +2 -0
  62. package/dist/chat/state/turn-session-keys.d.ts +6 -0
  63. package/dist/chat/state/turn-session.d.ts +11 -9
  64. package/dist/chat/task-execution/state.d.ts +6 -1
  65. package/dist/chat/task-execution/store.d.ts +1 -1
  66. package/dist/chat/tool-support/pi-tool-adapter.d.ts +1 -1
  67. package/dist/chat/tool-support/tool-execution-report.d.ts +1 -0
  68. package/dist/chat/tools/handoff/tool.d.ts +2 -2
  69. package/dist/chat/tools/sandbox/file-uploads.d.ts +28 -6
  70. package/dist/chat/tools/types.d.ts +6 -9
  71. package/dist/chat/tools/web/image-generate.d.ts +4 -6
  72. package/dist/{chunk-DDRQ4U7I.js → chunk-4YF7Z6IA.js} +390 -270
  73. package/dist/{chunk-AZ5OMSN5.js → chunk-AUUOHQAT.js} +2 -2
  74. package/dist/chunk-B2Z2H66D.js +250 -0
  75. package/dist/{chunk-4W4O4DCV.js → chunk-CQ7KSO2B.js} +75 -45
  76. package/dist/{chunk-MJSJAHBW.js → chunk-DY7TRYB5.js} +1 -1
  77. package/dist/{chunk-GPPUTY5M.js → chunk-EDLNHZH3.js} +861 -891
  78. package/dist/{chunk-R5BFYK2O.js → chunk-IGHMVDWI.js} +134 -18
  79. package/dist/chunk-MU6HHZEN.js +99 -0
  80. package/dist/{chunk-XTKJPSMF.js → chunk-NVOTGWYX.js} +458 -684
  81. package/dist/{chunk-AEWZ7F65.js → chunk-O24R4DCK.js} +2 -179
  82. package/dist/{chunk-CCFROYAV.js → chunk-PUAMO4PI.js} +115 -125
  83. package/dist/{chunk-ZMRLBBD5.js → chunk-RMVOAJRL.js} +30 -13
  84. package/dist/{chunk-3NYUCBLE.js → chunk-SPUAJVVH.js} +6 -4
  85. package/dist/{chunk-4UYIRWDW.js → chunk-SS67LUOK.js} +41 -290
  86. package/dist/{chunk-FXFQNHRU.js → chunk-VFUK3X5B.js} +4 -2
  87. package/dist/{chunk-3MPPVPGZ.js → chunk-VH6KWKG2.js} +2 -2
  88. package/dist/chunk-VIXFG2VC.js +182 -0
  89. package/dist/{chunk-BKM4UXUD.js → chunk-YFQ7CQDE.js} +669 -18
  90. package/dist/{chunk-77LHNQK4.js → chunk-YIPD3L6L.js} +4 -2
  91. package/dist/{chunk-3OUSJPR7.js → chunk-YNP2ATQX.js} +6 -4
  92. package/dist/{chunk-WR7H7VLJ.js → chunk-YT72TOEK.js} +2 -2
  93. package/dist/cli/chat.js +21 -20
  94. package/dist/cli/check.js +4 -3
  95. package/dist/cli/plugins.js +11 -9
  96. package/dist/cli/snapshot-warmup.js +7 -5
  97. package/dist/cli/upgrade.js +2041 -105
  98. package/dist/db/schema/{agent-steps.d.ts → conversation-events.d.ts} +37 -21
  99. package/dist/db/schema.d.ts +28 -159
  100. package/dist/{db-S33LFWG2.js → db-DIGO4TGW.js} +6 -8
  101. package/dist/{runner-HA5XAL6K.js → runner-ACR2HAIC.js} +209 -101
  102. package/dist/{skills-722AXRV5.js → skills-ITNHBARB.js} +4 -3
  103. package/dist/{validation-EUI2UFRM.js → validation-AGQ46ZGV.js} +4 -3
  104. package/migrations/0005_conversation_events.sql +122 -0
  105. package/migrations/README.md +23 -10
  106. package/migrations/meta/0005_snapshot.json +948 -0
  107. package/migrations/meta/_journal.json +7 -0
  108. package/package.json +5 -5
  109. package/dist/api/conversations/activity.d.ts +0 -40
  110. package/dist/api/conversations/detail-projection.d.ts +0 -11
  111. package/dist/api/conversations/detail.query.d.ts +0 -3
  112. package/dist/api/conversations/subagent.d.ts +0 -10
  113. package/dist/api/conversations/transcript.d.ts +0 -28
  114. package/dist/chat/conversations/legacy-advisor-session.d.ts +0 -7
  115. package/dist/chat/conversations/legacy-import.d.ts +0 -38
  116. package/dist/chat/conversations/sql/legacy-history-import.d.ts +0 -55
  117. package/dist/chat/conversations/sql/messages.d.ts +0 -4
  118. package/dist/chat/conversations/visible-compactions.d.ts +0 -11
  119. package/dist/chat/conversations/visible-messages.d.ts +0 -47
  120. package/dist/chat/services/reply-delivery-plan.d.ts +0 -5
  121. package/dist/chat/state/session-log.d.ts +0 -384
  122. package/dist/chunk-P4P7O5WG.js +0 -1072
  123. package/dist/chunk-XIMUQ4IU.js +0 -147
  124. package/dist/db/schema/conversation-messages.d.ts +0 -153
  125. package/dist/handlers/github-webhook/check-suite.d.ts +0 -3
  126. package/dist/handlers/github-webhook/issue-comment.d.ts +0 -3
  127. package/dist/handlers/github-webhook/pull-request-review-comment.d.ts +0 -3
  128. package/dist/handlers/github-webhook/pull-request-review.d.ts +0 -3
  129. package/dist/handlers/github-webhook/pull-request.d.ts +0 -3
  130. package/dist/handlers/github-webhook/resource.d.ts +0 -10
  131. package/dist/handlers/github-webhook.d.ts +0 -15
  132. package/dist/legacy-import-TMJISRKO.js +0 -18
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-77LHNQK4.js";
4
- import "./chunk-AEWZ7F65.js";
3
+ } from "./chunk-YIPD3L6L.js";
4
+ import "./chunk-VIXFG2VC.js";
5
+ import "./chunk-O24R4DCK.js";
5
6
  import "./chunk-OB42YVAE.js";
6
7
  import "./chunk-6GWA276C.js";
7
8
  import "./chunk-B3IT5END.js";
@@ -49,7 +49,7 @@ export declare function toObservablePromptPart(part: UserContentPart): Record<st
49
49
  export declare function buildPromptInput(input: AgentRunInput): PromptInput;
50
50
  /**
51
51
  * Convert a mid-run user message into the Pi user message shape used for
52
- * steering injection and parked-conversation session-log appends, so both
52
+ * steering injection and parked-conversation event-log appends, so both
53
53
  * paths store identical durable history.
54
54
  */
55
55
  export declare function buildSteeringPiMessage(message: AgentRunSteeringMessage): PiMessage;
@@ -12,7 +12,7 @@ import type { ChannelConfigurationService } from "@/chat/configuration/types";
12
12
  import type { ConversationPrivacy } from "@/chat/conversation-privacy";
13
13
  import type { CredentialContext } from "@/chat/credentials/context";
14
14
  import type { PiMessage } from "@/chat/pi/messages";
15
- import { type Actor } from "@/chat/actor";
15
+ import type { Actor } from "@/chat/actor";
16
16
  import type { SandboxAcquiredState } from "@/chat/sandbox/sandbox";
17
17
  import type { SandboxEgressTracePropagationConfig } from "@/chat/sandbox/egress/tracing";
18
18
  import type { AuthorizationFlowMode } from "@/chat/services/auth-pause";
@@ -20,7 +20,7 @@ import type { AssistantStatusSpec } from "@/chat/slack/assistant-thread/status";
20
20
  import type { SlackConversationContext } from "@/chat/slack/conversation-context";
21
21
  import type { ThreadArtifactsState } from "@/chat/state/artifacts";
22
22
  import type { ConversationPendingAuthState } from "@/chat/state/conversation";
23
- import type { PiMessageProvenance } from "@/chat/state/session-log";
23
+ import type { ConversationMessageProvenance } from "@/chat/conversations/provenance";
24
24
  import type { AgentTurnSurface } from "@/chat/state/turn-session";
25
25
  import type { ToolExecutionReport } from "@/chat/tool-support/tool-execution-report";
26
26
  import type { SlackActionToken } from "@/chat/slack/action-token";
@@ -40,7 +40,7 @@ export interface AgentRunInstructionActor {
40
40
  export interface AgentRunSteeringMessage {
41
41
  actor?: AgentRunInstructionActor;
42
42
  /** Provenance of this queued/steered message, carrying its original author. */
43
- provenance: PiMessageProvenance;
43
+ provenance: ConversationMessageProvenance;
44
44
  omittedImageAttachmentCount?: number;
45
45
  text: string;
46
46
  timestampMs?: number;
@@ -78,18 +78,6 @@ export interface AgentRunRouting {
78
78
  metadata?: Record<string, string>;
79
79
  plugin?: string;
80
80
  };
81
- correlation?: {
82
- conversationId?: string;
83
- threadId?: string;
84
- turnId?: string;
85
- runId?: string;
86
- channelId?: string;
87
- channelName?: string;
88
- teamId?: string;
89
- messageTs?: string;
90
- threadTs?: string;
91
- actorId?: string;
92
- };
93
81
  toolChannelId?: string;
94
82
  }
95
83
  /** Carries execution limits and dependency overrides for one run slice. */
@@ -127,15 +115,26 @@ export interface AgentRunState {
127
115
  * their failures never affect the run.
128
116
  */
129
117
  export interface AgentRunObservers {
130
- onTextDelta?: (deltaText: string) => void | Promise<void>;
131
- onAssistantMessageStart?: () => void | Promise<void>;
132
118
  onToolInvocation?: (invocation: {
133
- toolName: string;
134
119
  params: Record<string, unknown>;
120
+ toolCallId: string;
121
+ toolName: string;
135
122
  }) => void | Promise<void>;
136
123
  onToolResult?: (result: ToolExecutionReport) => void | Promise<void>;
137
124
  onStatus?: (status: AssistantStatusSpec) => void | Promise<void>;
138
125
  }
126
+ /** One completed tool-free assistant message ready for destination delivery. */
127
+ export interface AgentAssistantMessage {
128
+ text: string;
129
+ }
130
+ /** Delivers completed tool-free assistant messages in model order. */
131
+ export interface AgentRunDelivery {
132
+ onAssistantMessage: (message: AgentAssistantMessage) => void | Promise<void>;
133
+ }
134
+ /** Resume the agent turn after a transient or ambiguous delivery failure. */
135
+ export declare class RetryableDeliveryError extends Error {
136
+ constructor(cause: unknown);
137
+ }
139
138
  /** Carries durable-worker ports that commit or update resumable run state. */
140
139
  export interface AgentRunDurability {
141
140
  onInputCommitted?: () => void | Promise<void>;
@@ -148,25 +147,25 @@ export interface AgentRunDurability {
148
147
  }
149
148
  /** Groups the per-slice run request by the runtime role each field serves. */
150
149
  export interface AgentRunRequest {
150
+ /** Durable conversation advanced by this run. */
151
+ conversationId: string;
152
+ /** Stable turn advanced across this run and any continuation runs. */
153
+ turnId: string;
154
+ /** Optional bounded-run identifier used only for observability. */
155
+ runId?: string;
151
156
  input: AgentRunInput;
152
157
  routing: AgentRunRouting;
153
158
  policy?: AgentRunPolicy;
154
159
  state?: AgentRunState;
155
160
  observers?: AgentRunObservers;
161
+ delivery?: AgentRunDelivery;
156
162
  durability?: AgentRunDurability;
157
163
  }
158
- /** Extract conversation and session identifiers from correlation context. */
159
- export declare function getSessionIdentifiers(routing: AgentRunRouting): {
160
- conversationId?: string;
161
- sessionId?: string;
162
- };
163
- /** Derive the acting actor, filling platform and team from the destination. */
164
+ /** Resolve the explicit actor or the system credential actor for this run. */
164
165
  export declare function actorFromRouting(routing: AgentRunRouting): Actor | undefined;
165
- /** Reject actor identities that do not belong to the active destination. */
166
- export declare function assertActorDestinationMatch(routing: AgentRunRouting): void;
167
- /** Reject legacy Slack correlation fields that conflict with the destination. */
168
- export declare function assertCorrelationDestinationMatch(routing: AgentRunRouting): void;
166
+ /** Reject contradictory provider coordinates before the run touches state. */
167
+ export declare function assertRunRoutingConsistency(request: Pick<AgentRunRequest, "conversationId" | "routing">): void;
169
168
  /** Route tool side effects to the tool channel when one overrides the destination. */
170
169
  export declare function toolInvocationDestination(routing: AgentRunRouting): Destination;
171
170
  /** Infer the run surface when the caller did not state one. */
172
- export declare function surfaceFromRouting(routing: AgentRunRouting): AgentTurnSurface | undefined;
171
+ export declare function surfaceFromRouting(routing: AgentRunRouting): AgentTurnSurface;
@@ -9,14 +9,14 @@
9
9
  */
10
10
  import type { Destination, Source } from "@sentry/junior-plugin-api";
11
11
  import type { PiMessage } from "@/chat/pi/messages";
12
- import type { PiMessageProvenance } from "@/chat/state/session-log";
12
+ import type { ConversationMessageProvenance } from "@/chat/conversations/provenance";
13
13
  import { CooperativeTurnYieldError } from "@/chat/runtime/turn";
14
14
  import type { AgentRunOutcome } from "@/chat/runtime/agent-run-outcome";
15
15
  import type { AgentTurnSurface } from "@/chat/state/turn-session";
16
16
  import type { Actor } from "@/chat/actor";
17
17
  import { loadTurnSessionRecord, persistRunningSessionRecord } from "@/chat/services/turn-session-record";
18
18
  import { type AgentTurnUsage } from "@/chat/usage";
19
- import type { AgentRunDurability } from "@/chat/agent/request";
19
+ import { type AgentRunDurability } from "@/chat/agent/request";
20
20
  type LoadedSessionRecordState = Awaited<ReturnType<typeof loadTurnSessionRecord>>;
21
21
  type SessionRecordLogContext = NonNullable<Parameters<typeof persistRunningSessionRecord>[0]["logContext"]>;
22
22
  interface ResumeStateArgs {
@@ -30,11 +30,11 @@ interface ResumeStateArgs {
30
30
  recordActiveMcpProviders: () => Promise<void>;
31
31
  actor?: Actor;
32
32
  runSource: Source;
33
- sessionConversationId?: string;
34
- sessionId?: string;
33
+ conversationId: string;
34
+ turnId: string;
35
35
  sessionRecordState: LoadedSessionRecordState;
36
36
  startedAtMs: number;
37
- surface?: AgentTurnSurface;
37
+ surface: AgentTurnSurface;
38
38
  }
39
39
  interface ExpectedEndingTranslation {
40
40
  outcome?: AgentRunOutcome;
@@ -53,8 +53,8 @@ export declare function createResumeState(args: ResumeStateArgs): {
53
53
  getResumeSnapshot(currentMessages: PiMessage[]): PiMessage[];
54
54
  markTimedOut(): void;
55
55
  commitInput(): Promise<void>;
56
- persistSafeBoundary(messages: PiMessage[], trailingMessageProvenance?: PiMessageProvenance[]): Promise<boolean>;
57
- requireDurableInputCheckpoint(messages: PiMessage[], trailingMessageProvenance?: PiMessageProvenance[]): Promise<boolean>;
56
+ persistSafeBoundary(messages: PiMessage[], trailingMessageProvenance?: ConversationMessageProvenance[]): Promise<boolean>;
57
+ requireDurableInputCheckpoint(messages: PiMessage[], trailingMessageProvenance?: ConversationMessageProvenance[]): Promise<boolean>;
58
58
  yieldAtSafeBoundaryIfDue(currentMessages: PiMessage[]): void;
59
59
  /**
60
60
  * Persist the continuation for an expected run ending and translate it
@@ -2,19 +2,18 @@
2
2
  * Run session restore.
3
3
  *
4
4
  * Loads the persisted turn session projection for one run slice before the
5
- * tool and prompt phases need it, resolving the durable conversation and
6
- * session identifiers from routing.
5
+ * tool and prompt phases need it.
7
6
  */
8
7
  import { loadTurnSessionRecord } from "@/chat/services/turn-session-record";
9
- import { type AgentRunRouting } from "@/chat/agent/request";
10
8
  type LoadedSessionRecordState = Awaited<ReturnType<typeof loadTurnSessionRecord>>;
11
9
  /** Restore the persisted session projection for one run slice. */
12
- export declare function restoreSessionRecord(routing: AgentRunRouting): Promise<{
10
+ export declare function restoreSessionRecord(args: {
11
+ conversationId: string;
12
+ turnId: string;
13
+ }): Promise<{
13
14
  existingSessionRecord: LoadedSessionRecordState["existingSessionRecord"];
14
15
  currentSliceId: number;
15
16
  resumedFromSessionRecord: boolean;
16
- sessionConversationId?: string;
17
- sessionId?: string;
18
17
  sessionRecordState: LoadedSessionRecordState;
19
18
  }>;
20
19
  export {};
@@ -52,12 +52,12 @@ interface ToolWiringArgs {
52
52
  requestHandoff?: ToolRuntimeContext["handoff"];
53
53
  resume: ResumeState;
54
54
  routing: AgentRunRouting;
55
- sessionConversationId?: string;
56
- sessionId?: string;
55
+ conversationId: string;
56
+ turnId: string;
57
57
  skillSandbox: SkillSandbox;
58
58
  spanContext: LogContext;
59
59
  state: AgentRunState;
60
- surface?: AgentTurnSurface;
60
+ surface: AgentTurnSurface;
61
61
  syncLoadedSkillNamesForResume: () => void;
62
62
  toolCalls: string[];
63
63
  userInput: string;
@@ -1,9 +1,11 @@
1
1
  import type { AgentRunner } from "@/chat/runtime/agent-runner";
2
+ import { type ConversationTurnLifecycle } from "@/chat/conversations/turn-lifecycle";
2
3
  import { scheduleSessionCompletedPluginTasks } from "@/chat/plugins/task-runner";
3
4
  import { scheduleDispatchCallback } from "./signing";
4
5
  import type { DispatchCallback } from "./types";
5
6
  export interface AgentDispatchRunnerDeps {
6
7
  agentRunner: AgentRunner;
8
+ turnLifecycle?: ConversationTurnLifecycle;
7
9
  scheduleCallback?: typeof scheduleDispatchCallback;
8
10
  scheduleSessionCompletedPluginTasks?: typeof scheduleSessionCompletedPluginTasks;
9
11
  }
@@ -1,4 +1,5 @@
1
1
  import { type TurnReasoningLevel } from "@/chat/reasoning-level";
2
+ import { type ExecutionProfileConfig } from "@/chat/model-profile";
2
3
  /**
3
4
  * Buffer between the Vercel function timeout and the agent turn timeout so
4
5
  * Junior can abort, persist, and schedule continuation before host teardown.
@@ -8,8 +9,7 @@ export interface BotConfig {
8
9
  embeddingModelId: string;
9
10
  fastModelId: string;
10
11
  loadingMessages: string[];
11
- modelId: string;
12
- modelProfiles: Readonly<Record<string, string>>;
12
+ profiles: Readonly<Record<string, ExecutionProfileConfig>>;
13
13
  reasoningLevel?: TurnReasoningLevel;
14
14
  modelContextWindowTokens?: number;
15
15
  visionModelId?: string;