@sentry/junior 0.53.0 → 0.55.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 (239) hide show
  1. package/README.md +4 -3
  2. package/dist/api-reference.d.ts +7 -0
  3. package/dist/app.d.ts +14 -12
  4. package/dist/app.js +12977 -10333
  5. package/dist/build/copy-build-content.d.ts +4 -0
  6. package/dist/build/glob-to-regex.d.ts +2 -0
  7. package/dist/build/rolldown-workarounds.d.ts +14 -0
  8. package/dist/build/virtual-config.d.ts +4 -0
  9. package/dist/chat/agent-dispatch/context.d.ts +6 -0
  10. package/dist/chat/agent-dispatch/heartbeat.d.ts +14 -0
  11. package/dist/chat/agent-dispatch/runner.d.ts +9 -0
  12. package/dist/chat/agent-dispatch/signing.d.ts +5 -0
  13. package/dist/chat/agent-dispatch/store.d.ts +29 -0
  14. package/dist/chat/agent-dispatch/types.d.ts +57 -0
  15. package/dist/chat/agent-dispatch/validation.d.ts +3 -0
  16. package/dist/chat/app/factory.d.ts +10 -0
  17. package/dist/chat/app/production.d.ts +6 -0
  18. package/dist/chat/app/services.d.ts +17 -0
  19. package/dist/chat/capabilities/catalog.d.ts +16 -0
  20. package/dist/chat/capabilities/factory.d.ts +10 -0
  21. package/dist/chat/capabilities/jr-rpc-command.d.ts +26 -0
  22. package/dist/chat/capabilities/router.d.ts +19 -0
  23. package/dist/chat/coerce.d.ts +6 -0
  24. package/dist/chat/config.d.ts +47 -0
  25. package/dist/chat/configuration/defaults.d.ts +4 -0
  26. package/dist/chat/configuration/service.d.ts +2 -0
  27. package/dist/chat/configuration/types.d.ts +37 -0
  28. package/dist/chat/configuration/validation.d.ts +2 -0
  29. package/dist/chat/credentials/broker.d.ts +22 -0
  30. package/dist/chat/credentials/header-transforms.d.ts +3 -0
  31. package/dist/chat/credentials/oauth-scope.d.ts +4 -0
  32. package/dist/chat/credentials/state-adapter-token-store.d.ts +9 -0
  33. package/dist/chat/credentials/unlink-provider.d.ts +2 -0
  34. package/dist/chat/credentials/user-token-store.d.ts +11 -0
  35. package/dist/chat/discovery.d.ts +47 -0
  36. package/dist/chat/ingress/junior-chat.d.ts +26 -0
  37. package/dist/chat/ingress/message-changed.d.ts +50 -0
  38. package/dist/chat/ingress/message-router.d.ts +9 -0
  39. package/dist/chat/ingress/slash-command.d.ts +3 -0
  40. package/dist/chat/ingress/workspace-membership.d.ts +9 -0
  41. package/dist/chat/interruption-marker.d.ts +2 -0
  42. package/dist/chat/logging.d.ts +90 -0
  43. package/dist/chat/mcp/auth-store.d.ts +41 -0
  44. package/dist/chat/mcp/client.d.ts +34 -0
  45. package/dist/chat/mcp/errors.d.ts +8 -0
  46. package/dist/chat/mcp/oauth-provider.d.ts +27 -0
  47. package/dist/chat/mcp/oauth.d.ts +17 -0
  48. package/dist/chat/mcp/tool-manager.d.ts +60 -0
  49. package/dist/chat/oauth-flow.d.ts +45 -0
  50. package/dist/chat/optional-string.d.ts +5 -0
  51. package/dist/chat/pi/client.d.ts +49 -0
  52. package/dist/chat/pi/messages.d.ts +3 -0
  53. package/dist/chat/pi/traced-stream.d.ts +9 -0
  54. package/dist/chat/plugins/agent-hooks.d.ts +32 -0
  55. package/dist/chat/plugins/auth/api-headers-broker.d.ts +6 -0
  56. package/dist/chat/plugins/auth/auth-token-placeholder.d.ts +3 -0
  57. package/dist/chat/plugins/auth/github-app-broker.d.ts +4 -0
  58. package/dist/chat/plugins/auth/oauth-bearer-broker.d.ts +6 -0
  59. package/dist/chat/plugins/auth/oauth-request.d.ts +18 -0
  60. package/dist/chat/plugins/command-env.d.ts +3 -0
  61. package/dist/chat/plugins/logging.d.ts +3 -0
  62. package/dist/chat/plugins/manifest.d.ts +3 -0
  63. package/dist/chat/plugins/package-discovery.d.ts +14 -0
  64. package/dist/chat/plugins/registry.d.ts +23 -0
  65. package/dist/chat/plugins/state.d.ts +3 -0
  66. package/dist/chat/plugins/types.d.ts +146 -0
  67. package/dist/chat/prompt.d.ts +39 -0
  68. package/dist/chat/queue/thread-message-dispatcher.d.ts +33 -0
  69. package/dist/chat/respond-helpers.d.ts +77 -0
  70. package/dist/chat/respond.d.ts +75 -0
  71. package/dist/chat/runtime/auth-pause-state.d.ts +11 -0
  72. package/dist/chat/runtime/delivered-turn-state.d.ts +15 -0
  73. package/dist/chat/runtime/dev-agent-trace.d.ts +1 -0
  74. package/dist/chat/runtime/processing-reaction.d.ts +25 -0
  75. package/dist/chat/runtime/reply-executor.d.ts +56 -0
  76. package/dist/chat/runtime/report-progress.d.ts +3 -0
  77. package/dist/chat/runtime/slack-resume.d.ts +50 -0
  78. package/dist/chat/runtime/slack-runtime.d.ts +100 -0
  79. package/dist/chat/runtime/thread-context.d.ts +24 -0
  80. package/dist/chat/runtime/thread-state.d.ts +28 -0
  81. package/dist/chat/runtime/turn-preparation.d.ts +43 -0
  82. package/dist/chat/runtime/turn-user-message.d.ts +12 -0
  83. package/dist/chat/runtime/turn.d.ts +69 -0
  84. package/dist/chat/sandbox/credentials.d.ts +11 -0
  85. package/dist/chat/sandbox/egress-oidc.d.ts +3 -0
  86. package/dist/chat/sandbox/egress-policy.d.ts +11 -0
  87. package/dist/chat/sandbox/egress-proxy.d.ts +17 -0
  88. package/dist/chat/sandbox/egress-session.d.ts +27 -0
  89. package/dist/chat/sandbox/errors.d.ts +12 -0
  90. package/dist/chat/sandbox/http-error-details.d.ts +18 -0
  91. package/dist/chat/sandbox/noninteractive-command.d.ts +17 -0
  92. package/dist/chat/sandbox/paths.d.ts +5 -0
  93. package/dist/chat/sandbox/runtime-dependency-snapshots.d.ts +20 -0
  94. package/dist/chat/sandbox/sandbox.d.ts +54 -0
  95. package/dist/chat/sandbox/session.d.ts +54 -0
  96. package/dist/chat/sandbox/skill-sandbox.d.ts +42 -0
  97. package/dist/chat/sandbox/skill-sync.d.ts +16 -0
  98. package/dist/chat/sandbox/workspace.d.ts +55 -0
  99. package/dist/chat/scheduler/cadence.d.ts +24 -0
  100. package/dist/chat/scheduler/plugin.d.ts +2 -0
  101. package/dist/chat/scheduler/prompt.d.ts +7 -0
  102. package/dist/chat/scheduler/store.d.ts +49 -0
  103. package/dist/chat/scheduler/types.d.ts +86 -0
  104. package/dist/chat/sentry.d.ts +2 -0
  105. package/dist/chat/services/attachment-claims.d.ts +2 -0
  106. package/dist/chat/services/auth-pause-response.d.ts +2 -0
  107. package/dist/chat/services/auth-pause.d.ts +19 -0
  108. package/dist/chat/services/channel-intent.d.ts +2 -0
  109. package/dist/chat/services/conversation-memory.d.ts +33 -0
  110. package/dist/chat/services/mcp-auth-orchestration.d.ts +30 -0
  111. package/dist/chat/services/pending-auth.d.ts +27 -0
  112. package/dist/chat/services/plugin-auth-orchestration.d.ts +37 -0
  113. package/dist/chat/services/provider-default-config.d.ts +9 -0
  114. package/dist/chat/services/provider-retry.d.ts +6 -0
  115. package/dist/chat/services/reply-delivery-plan.d.ts +17 -0
  116. package/dist/chat/services/subscribed-decision.d.ts +63 -0
  117. package/dist/chat/services/subscribed-reply-policy.d.ts +23 -0
  118. package/dist/chat/services/timeout-resume.d.ts +17 -0
  119. package/dist/chat/services/turn-checkpoint.d.ts +74 -0
  120. package/dist/chat/services/turn-continuation-response.d.ts +2 -0
  121. package/dist/chat/services/turn-failure-response.d.ts +15 -0
  122. package/dist/chat/services/turn-result.d.ts +55 -0
  123. package/dist/chat/services/turn-thinking-level.d.ts +49 -0
  124. package/dist/chat/services/vision-context.d.ts +61 -0
  125. package/dist/chat/skills.d.ts +48 -0
  126. package/dist/chat/slack/adapter.d.ts +9 -0
  127. package/dist/chat/slack/app-home.d.ts +11 -0
  128. package/dist/chat/slack/assistant-thread/lifecycle.d.ts +13 -0
  129. package/dist/chat/slack/assistant-thread/status-render.d.ts +28 -0
  130. package/dist/chat/slack/assistant-thread/status-scheduler.d.ts +23 -0
  131. package/dist/chat/slack/assistant-thread/status-send.d.ts +31 -0
  132. package/dist/chat/slack/assistant-thread/status.d.ts +36 -0
  133. package/dist/chat/slack/assistant-thread/title.d.ts +28 -0
  134. package/dist/chat/slack/canvas-references.d.ts +2 -0
  135. package/dist/chat/slack/channel.d.ts +48 -0
  136. package/dist/chat/slack/client.d.ts +52 -0
  137. package/dist/chat/slack/context.d.ts +9 -0
  138. package/dist/chat/slack/emoji.d.ts +1 -0
  139. package/dist/chat/slack/errors.d.ts +6 -0
  140. package/dist/chat/slack/footer.d.ts +42 -0
  141. package/dist/chat/slack/ids.d.ts +4 -0
  142. package/dist/chat/slack/legacy-attachments.d.ts +4 -0
  143. package/dist/chat/slack/message.d.ts +6 -0
  144. package/dist/chat/slack/mrkdwn.d.ts +12 -0
  145. package/dist/chat/slack/outbound.d.ts +57 -0
  146. package/dist/chat/slack/output.d.ts +54 -0
  147. package/dist/chat/slack/reply.d.ts +33 -0
  148. package/dist/chat/slack/status-format.d.ts +2 -0
  149. package/dist/chat/slack/turn-continuation-notice.d.ts +8 -0
  150. package/dist/chat/slack/user.d.ts +8 -0
  151. package/dist/chat/slack/users.d.ts +39 -0
  152. package/dist/chat/slack/workspace-context.d.ts +4 -0
  153. package/dist/chat/state/adapter.d.ts +9 -0
  154. package/dist/chat/state/artifacts.d.ts +29 -0
  155. package/dist/chat/state/conversation.d.ts +81 -0
  156. package/dist/chat/state/pi-session-message-store.d.ts +15 -0
  157. package/dist/chat/state/turn-id.d.ts +2 -0
  158. package/dist/chat/state/turn-session-store.d.ts +49 -0
  159. package/dist/chat/tools/advisor/session-store.d.ts +9 -0
  160. package/dist/chat/tools/advisor/tool.d.ts +33 -0
  161. package/dist/chat/tools/agent-tools.d.ts +10 -0
  162. package/dist/chat/tools/channel-capabilities.d.ts +11 -0
  163. package/dist/chat/tools/definition.d.ts +17 -0
  164. package/dist/chat/tools/execution/build-sandbox-input.d.ts +2 -0
  165. package/dist/chat/tools/execution/normalize-result.d.ts +6 -0
  166. package/dist/chat/tools/execution/tool-error-handler.d.ts +3 -0
  167. package/dist/chat/tools/execution/tool-input-error.d.ts +6 -0
  168. package/dist/chat/tools/idempotency.d.ts +1 -0
  169. package/dist/chat/tools/index.d.ts +5 -0
  170. package/dist/chat/tools/runtime/report-progress.d.ts +4 -0
  171. package/dist/chat/tools/sandbox/attach-file.d.ts +7 -0
  172. package/dist/chat/tools/sandbox/bash.d.ts +5 -0
  173. package/dist/chat/tools/sandbox/edit-file.d.ts +37 -0
  174. package/dist/chat/tools/sandbox/file-utils.d.ts +52 -0
  175. package/dist/chat/tools/sandbox/find-files.d.ts +24 -0
  176. package/dist/chat/tools/sandbox/grep.d.ts +33 -0
  177. package/dist/chat/tools/sandbox/list-dir.d.ts +22 -0
  178. package/dist/chat/tools/sandbox/read-file.d.ts +32 -0
  179. package/dist/chat/tools/sandbox/text-edits.d.ts +28 -0
  180. package/dist/chat/tools/sandbox/write-file.d.ts +5 -0
  181. package/dist/chat/tools/skill/call-mcp-tool.d.ts +7 -0
  182. package/dist/chat/tools/skill/load-skill.d.ts +22 -0
  183. package/dist/chat/tools/skill/mcp-tool-summary.d.ts +31 -0
  184. package/dist/chat/tools/skill/search-mcp-tools.d.ts +8 -0
  185. package/dist/chat/tools/slack/canvas-tools.d.ts +29 -0
  186. package/dist/chat/tools/slack/canvases.d.ts +45 -0
  187. package/dist/chat/tools/slack/channel-list-messages.d.ts +9 -0
  188. package/dist/chat/tools/slack/channel-post-message.d.ts +4 -0
  189. package/dist/chat/tools/slack/list-tools.d.ts +21 -0
  190. package/dist/chat/tools/slack/lists.d.ts +42 -0
  191. package/dist/chat/tools/slack/message-add-reaction.d.ts +4 -0
  192. package/dist/chat/tools/slack/schedule-tools.d.ts +29 -0
  193. package/dist/chat/tools/slack/slack-message-url.d.ts +18 -0
  194. package/dist/chat/tools/slack/thread-read.d.ts +9 -0
  195. package/dist/chat/tools/slack/user-lookup.d.ts +8 -0
  196. package/dist/chat/tools/system-time.d.ts +1 -0
  197. package/dist/chat/tools/types.d.ts +61 -0
  198. package/dist/chat/tools/web/constants.d.ts +6 -0
  199. package/dist/chat/tools/web/fetch-content.d.ts +23 -0
  200. package/dist/chat/tools/web/fetch-tool.d.ts +5 -0
  201. package/dist/chat/tools/web/image-generate.d.ts +4 -0
  202. package/dist/chat/tools/web/network.d.ts +6 -0
  203. package/dist/chat/tools/web/search.d.ts +5 -0
  204. package/dist/chat/turn-context-tag.d.ts +6 -0
  205. package/dist/chat/usage.d.ts +24 -0
  206. package/dist/chat/xml.d.ts +1 -0
  207. package/dist/{chunk-XPXD3FCE.js → chunk-5LUISFEY.js} +189 -35
  208. package/dist/{chunk-ZNFNY53B.js → chunk-D3G3YOU4.js} +2 -2
  209. package/dist/chunk-SCQPBJAU.js +21 -0
  210. package/dist/{chunk-Q3FDONU7.js → chunk-TTUY467K.js} +47 -37
  211. package/dist/{chunk-KCOKQLBF.js → chunk-XI3CFWTA.js} +168 -15
  212. package/dist/cli/check.js +3 -3
  213. package/dist/cli/init.js +6 -1
  214. package/dist/cli/snapshot-warmup.js +3 -3
  215. package/dist/handlers/agent-dispatch.d.ts +3 -0
  216. package/dist/handlers/diagnostics-dashboard.d.ts +2 -0
  217. package/dist/handlers/diagnostics.d.ts +2 -0
  218. package/dist/handlers/health.d.ts +4 -0
  219. package/dist/handlers/heartbeat.d.ts +3 -0
  220. package/dist/handlers/mcp-oauth-callback.d.ts +2 -0
  221. package/dist/handlers/oauth-callback.d.ts +2 -0
  222. package/dist/handlers/oauth-html.d.ts +2 -0
  223. package/dist/handlers/sandbox-egress-proxy.d.ts +9 -0
  224. package/dist/handlers/turn-resume.d.ts +3 -0
  225. package/dist/handlers/types.d.ts +2 -0
  226. package/dist/handlers/webhooks.d.ts +15 -0
  227. package/dist/instrumentation.d.ts +1 -3
  228. package/dist/nitro.d.ts +4 -7
  229. package/dist/nitro.js +112 -54
  230. package/dist/package-resolution.d.ts +13 -0
  231. package/dist/vercel.d.ts +2 -4
  232. package/dist/vercel.js +3 -12
  233. package/package.json +32 -26
  234. package/dist/cli/check.d.ts +0 -8
  235. package/dist/cli/env.d.ts +0 -7
  236. package/dist/cli/init.d.ts +0 -3
  237. package/dist/cli/run.d.ts +0 -12
  238. package/dist/cli/snapshot-warmup.d.ts +0 -3
  239. package/dist/types-X_iCClPb.d.ts +0 -75
@@ -0,0 +1,28 @@
1
+ import { type Thread } from "chat";
2
+ import type { ChannelConfigurationService } from "@/chat/configuration/types";
3
+ import type { ThreadConversationState } from "@/chat/state/conversation";
4
+ import { type ThreadArtifactsState } from "@/chat/state/artifacts";
5
+ export interface ThreadStatePatch {
6
+ artifacts?: ThreadArtifactsState;
7
+ conversation?: ThreadConversationState;
8
+ sandboxId?: string;
9
+ sandboxDependencyProfileHash?: string;
10
+ }
11
+ export interface PersistedSandboxState {
12
+ sandboxDependencyProfileHash?: string;
13
+ sandboxId?: string;
14
+ }
15
+ export declare function mergeArtifactsState(artifacts: ThreadArtifactsState, patch: Partial<ThreadArtifactsState> | undefined): ThreadArtifactsState;
16
+ /** Extract persisted sandbox metadata from thread state payload. */
17
+ export declare function getPersistedSandboxState(state: Record<string, unknown>): PersistedSandboxState;
18
+ /** Persist a thread-state patch through the Chat SDK thread interface. */
19
+ export declare function persistThreadState(thread: Thread, patch: ThreadStatePatch): Promise<void>;
20
+ /** Load the persisted state payload for a thread without requiring a Chat singleton. */
21
+ export declare function getPersistedThreadState(threadId: string): Promise<Record<string, unknown>>;
22
+ /** Load the persisted state payload for a channel without constructing a Chat channel. */
23
+ export declare function getPersistedChannelState(channelId: string): Promise<Record<string, unknown>>;
24
+ /** Persist a thread-state patch by thread id without constructing a Chat thread. */
25
+ export declare function persistThreadStateById(threadId: string, patch: ThreadStatePatch): Promise<void>;
26
+ export declare function getChannelConfigurationService(thread: Thread): ChannelConfigurationService;
27
+ /** Resolve a channel configuration service by channel id without a Chat thread. */
28
+ export declare function getChannelConfigurationServiceById(channelId: string): ChannelConfigurationService;
@@ -0,0 +1,43 @@
1
+ import type { Message, Thread } from "chat";
2
+ import type { ThreadConversationState } from "@/chat/state/conversation";
3
+ import { type ThreadArtifactsState } from "@/chat/state/artifacts";
4
+ import type { ChannelConfigurationService } from "@/chat/configuration/types";
5
+ export interface PreparedTurnState {
6
+ artifacts: ThreadArtifactsState;
7
+ configuration?: Record<string, unknown>;
8
+ channelConfiguration?: ChannelConfigurationService;
9
+ conversation: ThreadConversationState;
10
+ conversationContext?: string;
11
+ routingContext?: string;
12
+ sandboxId?: string;
13
+ sandboxDependencyProfileHash?: string;
14
+ userMessageId?: string;
15
+ }
16
+ export interface PrepareTurnStateDeps {
17
+ compactConversationIfNeeded: (conversation: ThreadConversationState, context: {
18
+ threadId?: string;
19
+ channelId?: string;
20
+ requesterId?: string;
21
+ runId?: string;
22
+ }) => Promise<void>;
23
+ hydrateConversationVisionContext: (conversation: ThreadConversationState, context: {
24
+ threadId?: string;
25
+ channelId?: string;
26
+ requesterId?: string;
27
+ runId?: string;
28
+ threadTs?: string;
29
+ }) => Promise<void>;
30
+ }
31
+ /** Build the turn-state preparer from injected conversation services. */
32
+ export declare function createPrepareTurnState(deps: PrepareTurnStateDeps): (args: {
33
+ explicitMention: boolean;
34
+ message: Message;
35
+ thread: Thread;
36
+ userText: string;
37
+ context: {
38
+ threadId?: string;
39
+ requesterId?: string;
40
+ channelId?: string;
41
+ runId?: string;
42
+ };
43
+ }) => Promise<PreparedTurnState>;
@@ -0,0 +1,12 @@
1
+ import type { ConversationMessage, ThreadConversationState } from "@/chat/state/conversation";
2
+ /** Return the user message for a persisted turn/session, if one exists. */
3
+ export declare function getTurnUserMessage(conversation: ThreadConversationState, sessionId: string): ConversationMessage | undefined;
4
+ /** Return the persisted user-message id for a turn/session, if one exists. */
5
+ export declare function getTurnUserMessageId(conversation: ThreadConversationState, sessionId: string): string | undefined;
6
+ /** Return the Slack timestamp for the user message that a resumed turn acts on. */
7
+ export declare function getTurnUserSlackMessageTs(message: ConversationMessage | undefined): string | undefined;
8
+ /** Rebuild attachment context for a resumed turn from the persisted user message. */
9
+ export declare function getTurnUserReplyAttachmentContext(message: ConversationMessage | undefined): {
10
+ inboundAttachmentCount?: number;
11
+ omittedImageAttachmentCount?: number;
12
+ };
@@ -0,0 +1,69 @@
1
+ import type { ThreadConversationState } from "@/chat/state/conversation";
2
+ import type { AuthorizationPauseDisposition, AuthorizationPauseKind } from "@/chat/services/auth-pause";
3
+ import type { TurnThinkingSelection } from "@/chat/services/turn-thinking-level";
4
+ import type { AgentTurnUsage } from "@/chat/usage";
5
+ export { buildDeterministicTurnId } from "@/chat/state/turn-id";
6
+ export type RetryableTurnReason = "mcp_auth_resume" | "plugin_auth_resume" | "turn_timeout_resume";
7
+ export interface RetryableTurnMetadata {
8
+ authDisposition?: AuthorizationPauseDisposition;
9
+ authDurationMs?: number;
10
+ authKind?: AuthorizationPauseKind;
11
+ authProvider?: string;
12
+ authThinkingLevel?: TurnThinkingSelection["thinkingLevel"];
13
+ authUsage?: AgentTurnUsage;
14
+ checkpointVersion?: number;
15
+ conversationId?: string;
16
+ sessionId?: string;
17
+ sliceId?: number;
18
+ }
19
+ /** Error indicating the turn can be retried (timeout or auth pause). */
20
+ export declare class RetryableTurnError extends Error {
21
+ readonly code = "retryable_turn";
22
+ readonly metadata?: RetryableTurnMetadata;
23
+ readonly reason: RetryableTurnReason;
24
+ constructor(reason: RetryableTurnReason, message: string, metadata?: RetryableTurnMetadata);
25
+ }
26
+ export declare function isRetryableTurnError(error: unknown, reason?: RetryableTurnReason): error is RetryableTurnError;
27
+ /** Mark a turn as the active turn in conversation state. */
28
+ export declare function startActiveTurn(args: {
29
+ conversation: ThreadConversationState;
30
+ nextTurnId: string;
31
+ updateConversationStats: (conversation: ThreadConversationState) => void;
32
+ }): void;
33
+ /**
34
+ * Close the active turn without marking a Pi session reusable for future
35
+ * history. Use this for auth handoffs and recovery replies that end the live
36
+ * turn but do not produce a completed Pi session.
37
+ */
38
+ export declare function markTurnClosed(args: {
39
+ conversation: ThreadConversationState;
40
+ nowMs: number;
41
+ sessionId?: string;
42
+ updateConversationStats: (conversation: ThreadConversationState) => void;
43
+ }): void;
44
+ /**
45
+ * Mark a turn as completed after final reply delivery succeeds and make its Pi
46
+ * session the reusable history source for the next turn.
47
+ */
48
+ export declare function markTurnCompleted(args: {
49
+ conversation: ThreadConversationState;
50
+ nowMs: number;
51
+ sessionId: string;
52
+ updateConversationStats: (conversation: ThreadConversationState) => void;
53
+ }): void;
54
+ /**
55
+ * Mark a turn as failed when execution or final user-visible reply delivery
56
+ * cannot be completed. If `sessionId` is provided, `activeTurnId` is only
57
+ * cleared when it still matches the failing turn.
58
+ */
59
+ export declare function markTurnFailed(args: {
60
+ conversation: ThreadConversationState;
61
+ nowMs: number;
62
+ sessionId?: string;
63
+ userMessageId?: string;
64
+ markConversationMessage: (conversation: ThreadConversationState, messageId: string | undefined, patch: {
65
+ replied?: boolean;
66
+ skippedReason?: string;
67
+ }) => void;
68
+ updateConversationStats: (conversation: ThreadConversationState) => void;
69
+ }): void;
@@ -0,0 +1,11 @@
1
+ interface VercelSandboxCredentials {
2
+ teamId: string;
3
+ projectId: string;
4
+ token: string;
5
+ }
6
+ /**
7
+ * Resolve explicit Vercel Sandbox credentials, or return undefined to let
8
+ * the SDK read ambient Vercel auth from its own environment detection.
9
+ */
10
+ export declare function getVercelSandboxCredentials(): VercelSandboxCredentials | undefined;
11
+ export {};
@@ -0,0 +1,3 @@
1
+ import { type JWTPayload } from "jose";
2
+ /** Verify Vercel signed this Sandbox firewall proxy request for the active VM session. */
3
+ export declare function verifyVercelSandboxOidcToken(token: string): Promise<JWTPayload>;
@@ -0,0 +1,11 @@
1
+ import type { NetworkPolicy } from "@vercel/sandbox";
2
+ /** Return whether an outbound host is covered by a sandbox egress domain rule. */
3
+ export declare function matchesSandboxEgressDomain(host: string, domain: string): boolean;
4
+ /** Resolve the plugin provider responsible for an outbound sandbox host. */
5
+ export declare function resolveSandboxEgressProviderForHost(host: string): string | undefined;
6
+ /** Build the policy that forwards provider requests back to Junior for credentials. */
7
+ export declare function buildSandboxEgressNetworkPolicy(input?: {
8
+ requesterToken?: string;
9
+ }): NetworkPolicy;
10
+ /** Resolve non-secret command environment values for registered sandbox providers. */
11
+ export declare function resolveSandboxCommandEnvironment(): Promise<Record<string, string>>;
@@ -0,0 +1,17 @@
1
+ import type { JWTPayload } from "jose";
2
+ /** Intercepts a credential-injected sandbox HTTP request before live forwarding. */
3
+ export type SandboxEgressHttpInterceptor = (input: {
4
+ provider: string;
5
+ request: Request;
6
+ upstreamUrl: URL;
7
+ }) => Promise<Response | undefined>;
8
+ interface ProxyDeps {
9
+ fetch?: typeof fetch;
10
+ interceptHttp?: SandboxEgressHttpInterceptor;
11
+ verifyOidc?: (token: string) => Promise<JWTPayload>;
12
+ }
13
+ /** Return whether a request appears to be from the Vercel Sandbox egress proxy. */
14
+ export declare function isSandboxEgressForwardedRequest(request: Request): boolean;
15
+ /** Proxy one Vercel Sandbox firewall egress request through lazy credential headers. */
16
+ export declare function proxySandboxEgressRequest(request: Request, deps?: ProxyDeps): Promise<Response>;
17
+ export {};
@@ -0,0 +1,27 @@
1
+ import type { CredentialHeaderTransform } from "@/chat/credentials/broker";
2
+ export declare const SANDBOX_EGRESS_PROXY_PATH = "/api/internal/sandbox-egress";
3
+ export interface SandboxEgressRequesterContext {
4
+ requesterId: string;
5
+ egressId: string;
6
+ expiresAtMs: number;
7
+ contextId: string;
8
+ }
9
+ export interface SandboxEgressCredentialLease {
10
+ provider: string;
11
+ expiresAt: string;
12
+ headerTransforms: CredentialHeaderTransform[];
13
+ }
14
+ /** Create a signed requester/sandbox context token for lazy sandbox egress auth. */
15
+ export declare function createSandboxEgressRequesterToken(input: {
16
+ requesterId: string;
17
+ egressId: string;
18
+ ttlMs?: number;
19
+ }): string;
20
+ /** Verify a signed requester/sandbox context token from the proxy URL. */
21
+ export declare function parseSandboxEgressRequesterToken(token: string | undefined): SandboxEgressRequesterContext | undefined;
22
+ /** Cache a short-lived credential lease for repeated forwarded requests for one requester/sandbox context. */
23
+ export declare function setSandboxEgressCredentialLease(context: SandboxEgressRequesterContext, lease: SandboxEgressCredentialLease): Promise<void>;
24
+ /** Load a cached egress credential lease for a requester/sandbox context/provider pair. */
25
+ export declare function getSandboxEgressCredentialLease(provider: string, context: SandboxEgressRequesterContext): Promise<SandboxEgressCredentialLease | undefined>;
26
+ /** Clear a cached egress credential lease after the provider rejects its headers. */
27
+ export declare function clearSandboxEgressCredentialLease(provider: string, context: SandboxEgressRequesterContext): Promise<void>;
@@ -0,0 +1,12 @@
1
+ /** Detect sandbox filesystem operations that can safely ignore existing directories. */
2
+ export declare function isAlreadyExistsError(error: unknown): boolean;
3
+ /** Detect when a cached sandbox can no longer be reused and must be recreated. */
4
+ export declare function isSandboxUnavailableError(error: unknown): boolean;
5
+ /** Detect transient snapshot boot races so sandbox creation can retry. */
6
+ export declare function isSnapshottingError(error: unknown): boolean;
7
+ /** Detect interrupted command streams where no reliable exit status is available. */
8
+ export declare function isSandboxCommandStreamInterruptedError(error: unknown): boolean;
9
+ /** Wrap raw sandbox setup failures into one stable user-facing error contract. */
10
+ export declare function wrapSandboxSetupError(error: unknown): Error;
11
+ /** Record span data and throw one stable sandbox operation error. */
12
+ export declare function throwSandboxOperationError(action: string, error: unknown, includeMissingPath?: boolean): never;
@@ -0,0 +1,18 @@
1
+ interface ExtraFieldOption {
2
+ sourceKey: string;
3
+ attributeKey: string;
4
+ summaryKey?: string;
5
+ }
6
+ export interface ExtractHttpErrorDetailsOptions {
7
+ attributePrefix?: string;
8
+ previewLimit?: number;
9
+ extraFields?: ExtraFieldOption[];
10
+ }
11
+ export interface ExtractedHttpErrorDetails {
12
+ attributes: Record<string, string | number | boolean | string[]>;
13
+ summary: string;
14
+ searchableText: string;
15
+ }
16
+ /** Extract structured HTTP error metadata (status, headers, body preview) for logging. */
17
+ export declare function extractHttpErrorDetails(error: unknown, options?: ExtractHttpErrorDetailsOptions): ExtractedHttpErrorDetails;
18
+ export {};
@@ -0,0 +1,17 @@
1
+ import type { SandboxCommandResult, SandboxWorkspace } from "@/chat/sandbox/workspace";
2
+ interface NonInteractiveShellOptions {
3
+ env?: Record<string, string>;
4
+ pathPrefix?: string;
5
+ }
6
+ interface NonInteractiveCommandInput extends NonInteractiveShellOptions {
7
+ args?: string[];
8
+ cmd: string;
9
+ cwd?: string;
10
+ login?: boolean;
11
+ sudo?: boolean;
12
+ }
13
+ /** Build one shell entrypoint that never waits on terminal input. */
14
+ export declare function buildNonInteractiveShellScript(script: string, options?: NonInteractiveShellOptions): string;
15
+ /** Run a subprocess through one enforced non-interactive entrypoint. */
16
+ export declare function runNonInteractiveCommand(sandbox: Pick<SandboxWorkspace, "runCommand">, input: NonInteractiveCommandInput): Promise<SandboxCommandResult>;
17
+ export {};
@@ -0,0 +1,5 @@
1
+ export declare const SANDBOX_WORKSPACE_ROOT: string;
2
+ export declare const SANDBOX_SKILLS_ROOT: string;
3
+ export declare const SANDBOX_DATA_ROOT: string;
4
+ export declare function sandboxSkillDir(skillName: string): string;
5
+ export declare function sandboxSkillFile(skillName: string): string;
@@ -0,0 +1,20 @@
1
+ export type SnapshotResolveOutcome = "no_profile" | "cache_hit" | "cache_hit_after_lock_wait" | "rebuilt" | "forced_rebuild";
2
+ export type SnapshotRebuildReason = "cache_miss" | "floating_stale" | "force_rebuild" | "snapshot_missing";
3
+ export interface RuntimeDependencySnapshot {
4
+ snapshotId?: string;
5
+ profileHash?: string;
6
+ dependencyCount: number;
7
+ cacheHit: boolean;
8
+ resolveOutcome: SnapshotResolveOutcome;
9
+ rebuildReason?: SnapshotRebuildReason;
10
+ }
11
+ export type RuntimeDependencySnapshotProgressPhase = "resolve_start" | "cache_hit" | "waiting_for_lock" | "building_snapshot" | "build_complete";
12
+ export declare function getRuntimeDependencyProfileHash(runtime: string): string | undefined;
13
+ export declare function resolveRuntimeDependencySnapshot(params: {
14
+ runtime: string;
15
+ timeoutMs: number;
16
+ forceRebuild?: boolean;
17
+ staleSnapshotId?: string;
18
+ onProgress?: (phase: RuntimeDependencySnapshotProgressPhase) => void | Promise<void>;
19
+ }): Promise<RuntimeDependencySnapshot>;
20
+ export declare function isSnapshotMissingError(error: unknown): boolean;
@@ -0,0 +1,54 @@
1
+ import { type LogContext } from "@/chat/logging";
2
+ import type { AgentPluginHookRunner } from "@/chat/plugins/agent-hooks";
3
+ import type { SandboxInstance } from "@/chat/sandbox/workspace";
4
+ import type { SkillMetadata } from "@/chat/skills";
5
+ interface SandboxExecutionInput {
6
+ toolName: string;
7
+ input: unknown;
8
+ }
9
+ export interface SandboxExecutionEnvelope<T = unknown> {
10
+ result: T;
11
+ }
12
+ export interface BashCustomCommandResult {
13
+ ok: boolean;
14
+ command: string;
15
+ cwd: string;
16
+ exit_code: number;
17
+ signal: null;
18
+ timed_out: boolean;
19
+ stdout: string;
20
+ stderr: string;
21
+ stdout_truncated: boolean;
22
+ stderr_truncated: boolean;
23
+ }
24
+ export interface SandboxAcquiredState {
25
+ sandboxId: string;
26
+ sandboxDependencyProfileHash?: string;
27
+ }
28
+ export interface SandboxExecutor {
29
+ configureSkills(skills: SkillMetadata[]): void;
30
+ configureReferenceFiles(files: string[]): void;
31
+ getSandboxId(): string | undefined;
32
+ getDependencyProfileHash(): string | undefined;
33
+ canExecute(toolName: string): boolean;
34
+ createSandbox(): Promise<SandboxInstance>;
35
+ execute<T>(params: SandboxExecutionInput): Promise<SandboxExecutionEnvelope<T>>;
36
+ dispose(): Promise<void>;
37
+ }
38
+ /** Create one sandbox-backed tool executor facade for the current turn. */
39
+ export declare function createSandboxExecutor(options?: {
40
+ sandboxId?: string;
41
+ sandboxDependencyProfileHash?: string;
42
+ timeoutMs?: number;
43
+ traceContext?: LogContext;
44
+ credentialEgress?: {
45
+ requesterId: string;
46
+ };
47
+ agentHooks?: AgentPluginHookRunner;
48
+ onSandboxAcquired?: (sandbox: SandboxAcquiredState) => void | Promise<void>;
49
+ runBashCustomCommand?: (command: string) => Promise<{
50
+ handled: boolean;
51
+ result?: BashCustomCommandResult;
52
+ }>;
53
+ }): SandboxExecutor;
54
+ export {};
@@ -0,0 +1,54 @@
1
+ import { type NetworkPolicy } from "@vercel/sandbox";
2
+ import { type LogContext } from "@/chat/logging";
3
+ import { type SandboxFileSystem, type SandboxInstance } from "@/chat/sandbox/workspace";
4
+ import type { SkillMetadata } from "@/chat/skills";
5
+ interface SandboxToolExecutors {
6
+ bash: (input: {
7
+ command: string;
8
+ env?: Record<string, string>;
9
+ timeoutMs?: number;
10
+ }) => Promise<{
11
+ stdout: string;
12
+ stderr: string;
13
+ exitCode: number;
14
+ stdoutTruncated: boolean;
15
+ stderrTruncated: boolean;
16
+ timedOut?: boolean;
17
+ }>;
18
+ readFile: (input: {
19
+ path: string;
20
+ }) => Promise<{
21
+ content: string;
22
+ }>;
23
+ writeFile: (input: {
24
+ path: string;
25
+ content: string;
26
+ }) => Promise<{
27
+ success: boolean;
28
+ }>;
29
+ fs: SandboxFileSystem;
30
+ }
31
+ interface SandboxSessionManager {
32
+ configureSkills(skills: SkillMetadata[]): void;
33
+ configureReferenceFiles(files: string[]): void;
34
+ getSandboxId(): string | undefined;
35
+ getDependencyProfileHash(): string | undefined;
36
+ createSandbox(): Promise<SandboxInstance>;
37
+ ensureToolExecutors(): Promise<SandboxToolExecutors>;
38
+ dispose(): Promise<void>;
39
+ }
40
+ /** Manage sandbox lifecycle, sync, keepalive, and tool executor caching for one executor instance. */
41
+ export declare function createSandboxSessionManager(options?: {
42
+ sandboxId?: string;
43
+ sandboxDependencyProfileHash?: string;
44
+ timeoutMs?: number;
45
+ traceContext?: LogContext;
46
+ commandEnv?: () => Promise<Record<string, string>>;
47
+ createNetworkPolicy?: (egressId: string) => NetworkPolicy | undefined;
48
+ onSandboxPrepare?: (sandbox: SandboxInstance) => void | Promise<void>;
49
+ onSandboxAcquired?: (sandbox: {
50
+ sandboxId: string;
51
+ sandboxDependencyProfileHash?: string;
52
+ }) => void | Promise<void>;
53
+ }): SandboxSessionManager;
54
+ export {};
@@ -0,0 +1,42 @@
1
+ import { type Skill, type SkillMetadata } from "@/chat/skills";
2
+ export interface SkillSandboxFileEntry {
3
+ path: string;
4
+ type: "file" | "directory";
5
+ }
6
+ export interface SkillSandboxListFilesResult {
7
+ skillName: string;
8
+ directory: string;
9
+ entries: SkillSandboxFileEntry[];
10
+ truncated: boolean;
11
+ }
12
+ export interface SkillSandboxReadFileResult {
13
+ skillName: string;
14
+ path: string;
15
+ content: string;
16
+ truncated: boolean;
17
+ }
18
+ /** Sandboxed file access scoped to the active skill's directory — prevents path traversal. */
19
+ export declare class SkillSandbox {
20
+ private readonly availableSkills;
21
+ private readonly availableByName;
22
+ private readonly loadedSkills;
23
+ private activeSkillName;
24
+ constructor(availableSkills: SkillMetadata[], preloadedSkills?: Skill[]);
25
+ getAvailableSkills(): SkillMetadata[];
26
+ getLoadedSkillNames(): string[];
27
+ getActiveSkill(): Skill | null;
28
+ loadSkill(skillName: string): Promise<Skill | null>;
29
+ filterToolNames(toolNames: string[]): string[] | null;
30
+ listFiles(params: {
31
+ skillName?: string;
32
+ directory?: string;
33
+ recursive?: boolean;
34
+ maxEntries?: number;
35
+ }): Promise<SkillSandboxListFilesResult>;
36
+ readFile(params: {
37
+ skillName?: string;
38
+ filePath: string;
39
+ maxChars?: number;
40
+ }): Promise<SkillSandboxReadFileResult>;
41
+ private requireSkill;
42
+ }
@@ -0,0 +1,16 @@
1
+ import type { SandboxInstance } from "@/chat/sandbox/workspace";
2
+ import type { SkillMetadata } from "@/chat/skills";
3
+ /** Resolve a virtual sandbox skill path back to the host filesystem when no sandbox exists yet. */
4
+ export declare function resolveHostSkillPath(availableSkills: SkillMetadata[], sandboxPath: string): string | null;
5
+ /** Resolve a virtual sandbox data path back to the host filesystem when no sandbox exists yet. */
6
+ export declare function resolveHostDataPath(referenceFiles: string[], sandboxPath: string): string | null;
7
+ /** Detect missing host-backed skill files so reads can fall back to the sandbox copy. */
8
+ export declare function isHostFileMissingError(error: unknown): boolean;
9
+ /** Copy the current skill set and reference files into a sandbox. */
10
+ export declare function syncSkillsToSandbox(params: {
11
+ sandbox: SandboxInstance;
12
+ skills: SkillMetadata[];
13
+ referenceFiles?: string[];
14
+ withSpan: <T>(name: string, op: string, attributes: Record<string, unknown>, callback: () => Promise<T>) => Promise<T>;
15
+ workspaceRoot?: string;
16
+ }): Promise<void>;
@@ -0,0 +1,55 @@
1
+ import type { NetworkPolicy, Sandbox as VercelSandbox } from "@vercel/sandbox";
2
+ export interface SandboxCommandResult {
3
+ exitCode: number;
4
+ stderr(): Promise<string>;
5
+ stdout(): Promise<string>;
6
+ }
7
+ export interface SandboxCommandInput {
8
+ args?: string[];
9
+ cmd: string;
10
+ cwd?: string;
11
+ env?: Record<string, string>;
12
+ signal?: AbortSignal;
13
+ sudo?: boolean;
14
+ }
15
+ export interface SandboxFileStat {
16
+ isDirectory(): boolean;
17
+ }
18
+ export interface SandboxFileSystem {
19
+ readFile(filePath: string, options: {
20
+ encoding: BufferEncoding;
21
+ }): Promise<string>;
22
+ writeFile(filePath: string, content: string, options?: {
23
+ encoding?: BufferEncoding;
24
+ }): Promise<void>;
25
+ readdir(filePath: string): Promise<string[]>;
26
+ stat(filePath: string): Promise<SandboxFileStat>;
27
+ }
28
+ export interface SandboxWorkspace {
29
+ readFileToBuffer(input: {
30
+ cwd?: string;
31
+ path: string;
32
+ }): Promise<Buffer | null | undefined>;
33
+ runCommand(input: SandboxCommandInput): Promise<SandboxCommandResult>;
34
+ }
35
+ export interface SandboxInstance extends SandboxWorkspace {
36
+ readonly sandboxId: string;
37
+ readonly sandboxEgressId: string;
38
+ readonly fs: SandboxFileSystem;
39
+ extendTimeout(duration: number): Promise<void>;
40
+ mkDir(path: string): Promise<void>;
41
+ snapshot(): Promise<{
42
+ snapshotId: string;
43
+ }>;
44
+ stop(): Promise<unknown>;
45
+ update(params: {
46
+ networkPolicy?: NetworkPolicy;
47
+ }): Promise<void>;
48
+ writeFiles(files: Array<{
49
+ content: string | Uint8Array;
50
+ mode?: number;
51
+ path: string;
52
+ }>): Promise<void>;
53
+ }
54
+ /** Adapt the Vercel SDK object once so the rest of Junior sees one sandbox contract. */
55
+ export declare function createSandboxInstance(sandbox: VercelSandbox): SandboxInstance;
@@ -0,0 +1,24 @@
1
+ import type { ScheduledCalendarFrequency, ScheduledTask, ScheduledTaskRecurrence } from "@/chat/scheduler/types";
2
+ /** Parse an ISO timestamp into a finite Unix timestamp in milliseconds. */
3
+ export declare function parseScheduleTimestamp(value: string): number | undefined;
4
+ export interface ZonedDateTimeParts {
5
+ day: number;
6
+ hour: number;
7
+ minute: number;
8
+ month: number;
9
+ second: number;
10
+ weekday: number;
11
+ year: number;
12
+ }
13
+ /** Resolve a UTC timestamp into calendar parts for a named time zone. */
14
+ export declare function getZonedDateTimeParts(timestampMs: number, timezone: string): ZonedDateTimeParts;
15
+ /** Build a calendar recurrence anchored to an exact first run timestamp. */
16
+ export declare function buildCalendarRecurrence(args: {
17
+ frequency: ScheduledCalendarFrequency;
18
+ interval?: number;
19
+ nextRunAtMs: number;
20
+ timezone: string;
21
+ weekdays?: number[];
22
+ }): ScheduledTaskRecurrence;
23
+ /** Return the next fire time after a completed run, when the task recurs. */
24
+ export declare function getNextRunAtMs(task: ScheduledTask, scheduledForMs: number, afterMs?: number): number | undefined;
@@ -0,0 +1,2 @@
1
+ /** Create Junior's built-in trusted scheduler plugin. */
2
+ export declare function createSchedulerPlugin(): import("@sentry/junior-plugin-api").JuniorPlugin;
@@ -0,0 +1,7 @@
1
+ import { type ScheduledRun, type ScheduledTask } from "@/chat/scheduler/types";
2
+ /** Build the marker-delimited user prompt for one scheduled task execution. */
3
+ export declare function buildScheduledTaskRunPrompt(args: {
4
+ nowMs: number;
5
+ run: ScheduledRun;
6
+ task: ScheduledTask;
7
+ }): string;
@@ -0,0 +1,49 @@
1
+ import type { StateAdapter } from "chat";
2
+ import type { ScheduledRun, ScheduledTask } from "@/chat/scheduler/types";
3
+ export interface SchedulerStore {
4
+ claimDueRun(args: {
5
+ nowMs: number;
6
+ }): Promise<ScheduledRun | undefined>;
7
+ getRun(runId: string): Promise<ScheduledRun | undefined>;
8
+ getTask(taskId: string): Promise<ScheduledTask | undefined>;
9
+ listIncompleteRuns(): Promise<ScheduledRun[]>;
10
+ listTasksForTeam(teamId: string): Promise<ScheduledTask[]>;
11
+ markRunBlocked(args: {
12
+ completedAtMs: number;
13
+ errorMessage: string;
14
+ runId: string;
15
+ startedAtMs?: number;
16
+ }): Promise<ScheduledRun | undefined>;
17
+ markRunCompleted(args: {
18
+ completedAtMs: number;
19
+ resultMessageTs?: string;
20
+ runId: string;
21
+ startedAtMs: number;
22
+ }): Promise<ScheduledRun | undefined>;
23
+ markRunFailed(args: {
24
+ completedAtMs: number;
25
+ errorMessage: string;
26
+ startedAtMs?: number;
27
+ runId: string;
28
+ }): Promise<ScheduledRun | undefined>;
29
+ markRunSkipped(args: {
30
+ completedAtMs: number;
31
+ errorMessage: string;
32
+ runId: string;
33
+ }): Promise<ScheduledRun | undefined>;
34
+ markRunDispatched(args: {
35
+ claimedAtMs: number;
36
+ dispatchId: string;
37
+ nowMs: number;
38
+ runId: string;
39
+ }): Promise<ScheduledRun | undefined>;
40
+ saveTask(task: ScheduledTask): Promise<void>;
41
+ updateTaskAfterRun(args: {
42
+ errorMessage?: string;
43
+ nowMs: number;
44
+ run: ScheduledRun;
45
+ status: "blocked" | "completed" | "failed";
46
+ }): Promise<void>;
47
+ }
48
+ /** Create the production scheduler store backed by Junior's state adapter. */
49
+ export declare function createStateSchedulerStore(stateAdapter?: StateAdapter): SchedulerStore;