@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,4 @@
1
+ /** Copy app directory and plugin manifests into the server output. */
2
+ export declare function copyAppAndPluginContent(cwd: string, serverRoot: string, packageNames?: unknown): void;
3
+ /** Copy extra file patterns into server output for files the bundler cannot trace. */
4
+ export declare function copyIncludedFiles(cwd: string, serverRoot: string, patterns?: unknown): void;
@@ -0,0 +1,2 @@
1
+ /** Convert a simple file glob (supporting `*` wildcards) into a RegExp. */
2
+ export declare function globToRegex(pattern: string): RegExp;
@@ -0,0 +1,14 @@
1
+ import type { Nitro } from "nitro/types";
2
+ /**
3
+ * Override rolldown's treeshake config so that module side effects survive
4
+ * bundling.
5
+ *
6
+ * pi-ai registers API providers via a top-level side-effect in
7
+ * register-builtins.js. Nitro's default moduleSideEffects whitelist only
8
+ * includes unenv polyfills, so rolldown tree-shakes the registration call
9
+ * and the apiProviderRegistry Map stays empty at runtime.
10
+ *
11
+ * TODO(upstream): Track https://github.com/nitrojs/nitro/issues/XXXX for
12
+ * native moduleSideEffects configuration support.
13
+ */
14
+ export declare function applyRolldownTreeshakeWorkaround(nitro: Nitro): void;
@@ -0,0 +1,4 @@
1
+ import type { Nitro } from "nitro/types";
2
+ import type { PluginConfig } from "@/chat/plugins/types";
3
+ /** Inject a virtual module so createApp() can read the plugin list at runtime. */
4
+ export declare function injectVirtualConfig(nitro: Nitro, plugins?: PluginConfig): void;
@@ -0,0 +1,6 @@
1
+ import type { HeartbeatHookContext } from "@sentry/junior-plugin-api";
2
+ /** Build the plugin-scoped heartbeat context that gates durable dispatch access. */
3
+ export declare function createHeartbeatContext(args: {
4
+ nowMs: number;
5
+ plugin: string;
6
+ }): HeartbeatHookContext;
@@ -0,0 +1,14 @@
1
+ /** Re-drive stale core dispatches before invoking plugin heartbeat hooks. */
2
+ export declare function recoverStaleDispatches(args: {
3
+ limit?: number;
4
+ nowMs: number;
5
+ }): Promise<number>;
6
+ /** Run trusted plugin heartbeat hooks with bounded per-invocation work. */
7
+ export declare function runTrustedPluginHeartbeats(args: {
8
+ limit?: number;
9
+ nowMs: number;
10
+ }): Promise<void>;
11
+ /** Run the core heartbeat phases. */
12
+ export declare function runHeartbeat(args: {
13
+ nowMs: number;
14
+ }): Promise<void>;
@@ -0,0 +1,9 @@
1
+ import { generateAssistantReply as generateAssistantReplyImpl } from "@/chat/respond";
2
+ import { scheduleDispatchCallback } from "./signing";
3
+ import type { DispatchCallback } from "./types";
4
+ export interface AgentDispatchRunnerDeps {
5
+ generateAssistantReply?: typeof generateAssistantReplyImpl;
6
+ scheduleCallback?: typeof scheduleDispatchCallback;
7
+ }
8
+ /** Run one serverless slice for a core-owned agent dispatch. */
9
+ export declare function runAgentDispatchSlice(callback: DispatchCallback, deps?: AgentDispatchRunnerDeps): Promise<void>;
@@ -0,0 +1,5 @@
1
+ import type { DispatchCallback } from "./types";
2
+ /** Schedule an authenticated internal callback to run a dispatched agent slice. */
3
+ export declare function scheduleDispatchCallback(callback: DispatchCallback): Promise<void>;
4
+ /** Verify and parse an authenticated agent dispatch callback request. */
5
+ export declare function verifyDispatchCallbackRequest(request: Request): Promise<DispatchCallback | undefined>;
@@ -0,0 +1,29 @@
1
+ import type { StateAdapter } from "chat";
2
+ import type { DispatchCreateResult, DispatchOptions, DispatchProjection, DispatchRecord, DispatchStatus } from "./types";
3
+ /** Keep dispatch persistence keys consistent across callback and recovery paths. */
4
+ export declare function getDispatchStorageKey(id: string): string;
5
+ /** Map a dispatch destination to the conversation lock and memory key it owns. */
6
+ export declare function getDispatchConversationId(destination: DispatchRecord["destination"]): string;
7
+ /** Give dispatch slices stable turn ids for resumability and trace correlation. */
8
+ export declare function getDispatchTurnId(dispatchId: string): string;
9
+ /** Gate recovery to dispatches that can still make progress. */
10
+ export declare function isTerminalDispatchStatus(status: DispatchStatus): boolean;
11
+ /** Serialize mutations for a dispatch so callbacks and heartbeats stay idempotent. */
12
+ export declare function withDispatchLock<T>(dispatchId: string, callback: (state: StateAdapter) => Promise<T>): Promise<T>;
13
+ /** Load dispatch state for callback, recovery, and plugin projection paths. */
14
+ export declare function getDispatchRecord(id: string): Promise<DispatchRecord | undefined>;
15
+ /** Create a plugin dispatch idempotently from the plugin's idempotency key. */
16
+ export declare function createOrGetDispatch(args: {
17
+ nowMs: number;
18
+ options: DispatchOptions;
19
+ plugin: string;
20
+ }): Promise<DispatchCreateResult>;
21
+ /** Advance dispatch versions so stale callbacks cannot overwrite newer state. */
22
+ export declare function updateDispatchRecord(state: StateAdapter, record: DispatchRecord): Promise<DispatchRecord>;
23
+ /** Feed heartbeat recovery from the durable incomplete-dispatch index. */
24
+ export declare function listIncompleteDispatchIds(): Promise<string[]>;
25
+ /** Return a plugin-scoped dispatch projection without exposing raw runtime state. */
26
+ export declare function getPluginDispatchProjection(args: {
27
+ id: string;
28
+ plugin: string;
29
+ }): Promise<DispatchProjection | undefined>;
@@ -0,0 +1,57 @@
1
+ export type DispatchStatus = "pending" | "running" | "awaiting_resume" | "completed" | "failed" | "blocked";
2
+ export interface DispatchActor {
3
+ type: "system";
4
+ id: string;
5
+ }
6
+ export interface DispatchDestination {
7
+ platform: "slack";
8
+ teamId: string;
9
+ channelId: string;
10
+ }
11
+ export interface DispatchCredentialSubject {
12
+ type: "user";
13
+ userId: string;
14
+ allowedWhen: "private-direct-conversation";
15
+ }
16
+ export interface DispatchOptions {
17
+ credentialSubject?: DispatchCredentialSubject;
18
+ destination: DispatchDestination;
19
+ idempotencyKey: string;
20
+ input: string;
21
+ metadata?: Record<string, string>;
22
+ }
23
+ export interface DispatchRecord {
24
+ actor: DispatchActor;
25
+ attempt: number;
26
+ createdAtMs: number;
27
+ credentialSubject?: DispatchCredentialSubject;
28
+ destination: DispatchDestination;
29
+ errorMessage?: string;
30
+ id: string;
31
+ idempotencyKey: string;
32
+ input: string;
33
+ lastCallbackAtMs?: number;
34
+ leaseExpiresAtMs?: number;
35
+ maxAttempts: number;
36
+ metadata?: Record<string, string>;
37
+ plugin: string;
38
+ resultMessageTs?: string;
39
+ resumeCheckpointVersion?: number;
40
+ status: DispatchStatus;
41
+ updatedAtMs: number;
42
+ version: number;
43
+ }
44
+ export interface DispatchProjection {
45
+ errorMessage?: string;
46
+ id: string;
47
+ resultMessageTs?: string;
48
+ status: DispatchStatus;
49
+ }
50
+ export interface DispatchCallback {
51
+ expectedVersion: number;
52
+ id: string;
53
+ }
54
+ export interface DispatchCreateResult {
55
+ record: DispatchRecord;
56
+ status: "created" | "already_exists";
57
+ }
@@ -0,0 +1,3 @@
1
+ import type { DispatchOptions } from "./types";
2
+ /** Validate plugin-provided dispatch options before core persists them. */
3
+ export declare function validateDispatchOptions(options: DispatchOptions): void;
@@ -0,0 +1,10 @@
1
+ import type { SlackAdapter } from "@chat-adapter/slack";
2
+ import { type AssistantLifecycleEvent, type SlackTurnRuntime } from "@/chat/runtime/slack-runtime";
3
+ import type { JuniorRuntimeServiceOverrides } from "@/chat/app/services";
4
+ import { type PreparedTurnState } from "@/chat/runtime/turn-preparation";
5
+ export interface CreateSlackRuntimeOptions {
6
+ getSlackAdapter: () => SlackAdapter;
7
+ now?: () => number;
8
+ services?: JuniorRuntimeServiceOverrides;
9
+ }
10
+ export declare function createSlackRuntime(options: CreateSlackRuntimeOptions): SlackTurnRuntime<PreparedTurnState, AssistantLifecycleEvent>;
@@ -0,0 +1,6 @@
1
+ import type { SlackAdapter } from "@chat-adapter/slack";
2
+ import { JuniorChat } from "@/chat/ingress/junior-chat";
3
+ /** Return the lazily initialized production chat app. */
4
+ export declare function getProductionBot(): JuniorChat<{
5
+ slack: SlackAdapter;
6
+ }>;
@@ -0,0 +1,17 @@
1
+ import { type ConversationMemoryDeps, type ConversationMemoryService } from "@/chat/services/conversation-memory";
2
+ import { type SubscribedReplyPolicy, type SubscribedReplyPolicyDeps } from "@/chat/services/subscribed-reply-policy";
3
+ import type { ReplyExecutorServices } from "@/chat/runtime/reply-executor";
4
+ import { type VisionContextDeps, type VisionContextService } from "@/chat/services/vision-context";
5
+ export interface JuniorRuntimeServices {
6
+ conversationMemory: ConversationMemoryService;
7
+ replyExecutor: ReplyExecutorServices;
8
+ subscribedReplyPolicy: SubscribedReplyPolicy;
9
+ visionContext: VisionContextService;
10
+ }
11
+ export interface JuniorRuntimeServiceOverrides {
12
+ conversationMemory?: Partial<ConversationMemoryDeps>;
13
+ replyExecutor?: Partial<Omit<ReplyExecutorServices, "generateThreadTitle">>;
14
+ subscribedReplyPolicy?: Partial<SubscribedReplyPolicyDeps>;
15
+ visionContext?: Partial<VisionContextDeps>;
16
+ }
17
+ export declare function createJuniorRuntimeServices(overrides?: JuniorRuntimeServiceOverrides): JuniorRuntimeServices;
@@ -0,0 +1,16 @@
1
+ export interface CapabilityProviderTargetDefinition {
2
+ type: string;
3
+ configKey: string;
4
+ commandFlags?: string[];
5
+ }
6
+ export interface CapabilityProviderDefinition {
7
+ provider: string;
8
+ capabilities: string[];
9
+ configKeys: string[];
10
+ target?: CapabilityProviderTargetDefinition;
11
+ }
12
+ export declare function getCapabilityProvider(capability: string): CapabilityProviderDefinition | undefined;
13
+ export declare function isKnownCapability(capability: string): boolean;
14
+ export declare function listCapabilityProviders(): CapabilityProviderDefinition[];
15
+ /** Log the capability catalog contents once at startup. */
16
+ export declare function logCapabilityCatalogLoadedOnce(): void;
@@ -0,0 +1,10 @@
1
+ import type { CredentialLease } from "@/chat/credentials/broker";
2
+ import type { UserTokenStore } from "@/chat/credentials/user-token-store";
3
+ /** Create the user token store used by OAuth-backed credential brokers. */
4
+ export declare function createUserTokenStore(): UserTokenStore;
5
+ /** Issue one provider credential lease for host-side sandbox egress proxying. */
6
+ export declare function issueProviderCredentialLease(input: {
7
+ provider: string;
8
+ requesterId: string;
9
+ reason: string;
10
+ }): Promise<CredentialLease>;
@@ -0,0 +1,26 @@
1
+ import type { ChannelConfigurationService } from "@/chat/configuration/types";
2
+ import type { Skill } from "@/chat/skills";
3
+ type JrRpcDeps = {
4
+ activeSkill: Skill | null;
5
+ channelConfiguration?: ChannelConfigurationService;
6
+ requesterId?: string;
7
+ onConfigurationValueChanged?: (key: string, value: unknown | undefined) => void;
8
+ };
9
+ export declare function maybeExecuteJrRpcCustomCommand(command: string, deps: JrRpcDeps): Promise<{
10
+ handled: false;
11
+ } | {
12
+ handled: true;
13
+ result: {
14
+ ok: boolean;
15
+ command: string;
16
+ cwd: string;
17
+ exit_code: number;
18
+ signal: null;
19
+ timed_out: boolean;
20
+ stdout: string;
21
+ stderr: string;
22
+ stdout_truncated: boolean;
23
+ stderr_truncated: boolean;
24
+ };
25
+ }>;
26
+ export {};
@@ -0,0 +1,19 @@
1
+ import type { CredentialBroker, CredentialLease } from "@/chat/credentials/broker";
2
+ export interface CredentialRouter {
3
+ issue(input: {
4
+ provider: string;
5
+ reason: string;
6
+ requesterId?: string;
7
+ }): Promise<CredentialLease>;
8
+ }
9
+ export declare class ProviderCredentialRouter implements CredentialRouter {
10
+ private readonly brokersByProvider;
11
+ constructor(input: {
12
+ brokersByProvider: Record<string, CredentialBroker>;
13
+ });
14
+ issue(input: {
15
+ provider: string;
16
+ reason: string;
17
+ requesterId?: string;
18
+ }): Promise<CredentialLease>;
19
+ }
@@ -0,0 +1,6 @@
1
+ /** Narrow an unknown value to a non-empty string, or undefined. */
2
+ export declare function toOptionalString(value: unknown): string | undefined;
3
+ /** Narrow an unknown value to a finite number, or undefined. */
4
+ export declare function toOptionalNumber(value: unknown): number | undefined;
5
+ /** Type-guard: true when value is a non-null object (usable as Record). */
6
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
@@ -0,0 +1,47 @@
1
+ declare const ADVISOR_THINKING_LEVELS: readonly ["minimal", "low", "medium", "high", "xhigh"];
2
+ export type AdvisorThinkingLevel = (typeof ADVISOR_THINKING_LEVELS)[number];
3
+ export interface BotConfig {
4
+ advisor: AdvisorConfig;
5
+ fastModelId: string;
6
+ loadingMessages: string[];
7
+ modelId: string;
8
+ visionModelId?: string;
9
+ turnTimeoutMs: number;
10
+ userName: string;
11
+ }
12
+ export interface AdvisorConfig {
13
+ modelId: string;
14
+ thinkingLevel: AdvisorThinkingLevel;
15
+ }
16
+ export interface ChatConfig {
17
+ bot: BotConfig;
18
+ functionMaxDurationSeconds: number;
19
+ slack: {
20
+ botToken?: string;
21
+ clientId?: string;
22
+ clientSecret?: string;
23
+ signingSecret?: string;
24
+ };
25
+ state: {
26
+ adapter: "memory" | "redis";
27
+ keyPrefix?: string;
28
+ redisUrl?: string;
29
+ };
30
+ }
31
+ /** Parse all chat configuration from environment variables. */
32
+ export declare function readChatConfig(env?: NodeJS.ProcessEnv): ChatConfig;
33
+ /** Return the chat configuration (parsed once at startup). */
34
+ export declare function getChatConfig(): ChatConfig;
35
+ /** Bot configuration derived from environment at module load. */
36
+ export declare const botConfig: BotConfig;
37
+ export declare function getSlackBotToken(): string | undefined;
38
+ export declare function getSlackSigningSecret(): string | undefined;
39
+ export declare function getSlackClientId(): string | undefined;
40
+ export declare function getSlackClientSecret(): string | undefined;
41
+ export declare function hasRedisConfig(): boolean;
42
+ export interface RuntimeMetadata {
43
+ version?: string;
44
+ }
45
+ /** Return runtime metadata (version from deploy environment). */
46
+ export declare function getRuntimeMetadata(): RuntimeMetadata;
47
+ export {};
@@ -0,0 +1,4 @@
1
+ /** Store install-wide config defaults; keys must be registered plugin config keys. */
2
+ export declare function setConfigDefaults(defaults: Record<string, unknown> | undefined): void;
3
+ /** Return the install-wide configuration defaults (empty object when none set). */
4
+ export declare function getConfigDefaults(): Record<string, unknown>;
@@ -0,0 +1,2 @@
1
+ import type { ChannelConfigurationService, ChannelConfigurationStorage } from "@/chat/configuration/types";
2
+ export declare function createChannelConfigurationService(storage: ChannelConfigurationStorage): ChannelConfigurationService;
@@ -0,0 +1,37 @@
1
+ export type ConfigScope = "conversation";
2
+ export interface ConfigEntry {
3
+ key: string;
4
+ value: unknown;
5
+ scope: ConfigScope;
6
+ updatedAt: string;
7
+ updatedBy?: string;
8
+ source?: string;
9
+ expiresAt?: string;
10
+ }
11
+ export interface ChannelConfigState {
12
+ schemaVersion: 1;
13
+ entries: Record<string, ConfigEntry>;
14
+ }
15
+ export interface ChannelConfigurationStorage {
16
+ load: () => Promise<unknown | null>;
17
+ save: (state: ChannelConfigState) => Promise<void>;
18
+ }
19
+ export interface ChannelConfigurationService {
20
+ get: (key: string) => Promise<ConfigEntry | undefined>;
21
+ set: (input: {
22
+ key: string;
23
+ value: unknown;
24
+ updatedBy?: string;
25
+ source?: string;
26
+ expiresAt?: string;
27
+ }) => Promise<ConfigEntry>;
28
+ unset: (key: string) => Promise<boolean>;
29
+ list: (options?: {
30
+ prefix?: string;
31
+ }) => Promise<ConfigEntry[]>;
32
+ resolve: (key: string) => Promise<unknown | undefined>;
33
+ resolveValues: (options?: {
34
+ keys?: string[];
35
+ prefix?: string;
36
+ }) => Promise<Record<string, unknown>>;
37
+ }
@@ -0,0 +1,2 @@
1
+ export declare function validateConfigKey(key: string): string | undefined;
2
+ export declare function validateConfigValue(value: unknown): string | undefined;
@@ -0,0 +1,22 @@
1
+ export declare class CredentialUnavailableError extends Error {
2
+ readonly provider: string;
3
+ constructor(provider: string, message: string);
4
+ }
5
+ export type CredentialHeaderTransform = {
6
+ domain: string;
7
+ headers: Record<string, string>;
8
+ };
9
+ export interface CredentialLease {
10
+ id: string;
11
+ provider: string;
12
+ env: Record<string, string>;
13
+ headerTransforms?: CredentialHeaderTransform[];
14
+ expiresAt: string;
15
+ metadata?: Record<string, string>;
16
+ }
17
+ export interface CredentialBroker {
18
+ issue(input: {
19
+ reason: string;
20
+ requesterId?: string;
21
+ }): Promise<CredentialLease>;
22
+ }
@@ -0,0 +1,3 @@
1
+ import type { CredentialHeaderTransform } from "@/chat/credentials/broker";
2
+ /** Merge transforms by domain so later transforms override earlier headers. */
3
+ export declare function mergeHeaderTransforms(transforms: CredentialHeaderTransform[]): CredentialHeaderTransform[];
@@ -0,0 +1,4 @@
1
+ /** Normalize OAuth scope strings so persisted grants can be compared reliably. */
2
+ export declare function normalizeOAuthScope(scope?: string): string | undefined;
3
+ /** Return whether the stored grant still satisfies the provider's current scope contract. */
4
+ export declare function hasRequiredOAuthScope(storedScope?: string, requiredScope?: string): boolean;
@@ -0,0 +1,9 @@
1
+ import type { StateAdapter } from "chat";
2
+ import type { StoredTokens, UserTokenStore } from "@/chat/credentials/user-token-store";
3
+ export declare class StateAdapterTokenStore implements UserTokenStore {
4
+ private readonly state;
5
+ constructor(stateAdapter: StateAdapter);
6
+ get(userId: string, provider: string): Promise<StoredTokens | undefined>;
7
+ set(userId: string, provider: string, tokens: StoredTokens): Promise<void>;
8
+ delete(userId: string, provider: string): Promise<void>;
9
+ }
@@ -0,0 +1,2 @@
1
+ import type { UserTokenStore } from "@/chat/credentials/user-token-store";
2
+ export declare function unlinkProvider(userId: string, provider: string, userTokenStore: UserTokenStore): Promise<void>;
@@ -0,0 +1,11 @@
1
+ export interface StoredTokens {
2
+ accessToken: string;
3
+ refreshToken: string;
4
+ expiresAt?: number;
5
+ scope?: string;
6
+ }
7
+ export interface UserTokenStore {
8
+ get(userId: string, provider: string): Promise<StoredTokens | undefined>;
9
+ set(userId: string, provider: string, tokens: StoredTokens): Promise<void>;
10
+ delete(userId: string, provider: string): Promise<void>;
11
+ }
@@ -0,0 +1,47 @@
1
+ /** Check whether a path exists and is a directory. */
2
+ export declare function isDirectory(targetPath: string): boolean;
3
+ /** Check whether a path exists and is a regular file. */
4
+ export declare function isFile(targetPath: string): boolean;
5
+ export interface DiscoverNodeModulesDirsOptions {
6
+ candidateDirs?: string[];
7
+ }
8
+ /** Discover node_modules directories reachable from the current working directory. */
9
+ export declare function discoverNodeModulesDirs(cwd?: string, options?: DiscoverNodeModulesDirsOptions): string[];
10
+ export interface DiscoverProjectRootsOptions {
11
+ nodeModulesDirs?: string[];
12
+ }
13
+ /** Discover project root directories by walking up from cwd and checking node_modules parents. */
14
+ export declare function discoverProjectRoots(cwd?: string, options?: DiscoverProjectRootsOptions): string[];
15
+ /** Return the resolved app home directory for the current working directory. */
16
+ export declare function homeDir(): string;
17
+ export interface ResolveHomeDirOptions {
18
+ projectRoots?: string[];
19
+ }
20
+ /** Resolve the app home directory by scoring candidate `app/` directories. */
21
+ export declare function resolveHomeDir(cwd?: string, options?: ResolveHomeDirOptions): string;
22
+ /** Return the data directory (same as homeDir). */
23
+ export declare function dataDir(): string;
24
+ /** Return the path to the SOUL.md file. */
25
+ export declare function soulPath(): string;
26
+ /** Return the path to the WORLD.md file. */
27
+ export declare function worldPath(): string;
28
+ /** Return the path to the DESCRIPTION.md file. */
29
+ export declare function descriptionPath(): string;
30
+ /** Return the skills directory path. */
31
+ export declare function skillsDir(): string;
32
+ /** Return the plugins directory path. */
33
+ export declare function pluginsDir(): string;
34
+ /** Return all unique data root directories. */
35
+ export declare function dataRoots(): string[];
36
+ /** Return all unique skill root directories. */
37
+ export declare function skillRoots(): string[];
38
+ /** Return all unique plugin root directories. */
39
+ export declare function pluginRoots(): string[];
40
+ /** Return candidate paths where SOUL.md might be found. */
41
+ export declare function soulPathCandidates(): string[];
42
+ /** Return candidate paths where WORLD.md might be found. */
43
+ export declare function worldPathCandidates(): string[];
44
+ /** Return candidate paths where DESCRIPTION.md might be found. */
45
+ export declare function descriptionPathCandidates(): string[];
46
+ /** List non-reserved .md files in the app root for sandbox reference syncing. */
47
+ export declare function listReferenceFiles(): string[];
@@ -0,0 +1,26 @@
1
+ import { Chat, type ActionEvent, type Adapter, type AppHomeOpenedEvent, type AssistantContextChangedEvent, type AssistantThreadStartedEvent, type Message, type ModalCloseEvent, type ReactionEvent, type SlashCommandEvent, type WebhookOptions } from "chat";
2
+ export declare class JuniorChat<TAdapters extends Record<string, Adapter> = Record<string, Adapter>> extends Chat<TAdapters> {
3
+ /**
4
+ * Normalize Slack thread IDs before the SDK's concurrency queue.
5
+ *
6
+ * Slack DM roots can arrive with an empty thread timestamp, while
7
+ * later replies include the root timestamp. Resolve factories before
8
+ * delegating so the lock/state/subscription key is canonicalized before
9
+ * the SDK computes its per-thread queue key.
10
+ */
11
+ processMessage(adapter: Adapter, threadId: string, messageOrFactory: Message | (() => Promise<Message>), options?: WebhookOptions): Promise<void>;
12
+ processReaction(event: Omit<ReactionEvent, "adapter" | "thread"> & {
13
+ adapter?: Adapter;
14
+ }, options?: WebhookOptions): void;
15
+ processAction(event: Omit<ActionEvent, "thread" | "openModal"> & {
16
+ adapter: Adapter;
17
+ }, options: WebhookOptions | undefined): Promise<void>;
18
+ processModalClose(event: Omit<ModalCloseEvent, "relatedThread" | "relatedMessage" | "relatedChannel">, contextId?: string, options?: WebhookOptions): void;
19
+ processSlashCommand(event: Omit<SlashCommandEvent, "channel" | "openModal"> & {
20
+ adapter: Adapter;
21
+ channelId: string;
22
+ }, options: WebhookOptions | undefined): void;
23
+ processAssistantThreadStarted(event: AssistantThreadStartedEvent, options?: WebhookOptions): void;
24
+ processAssistantContextChanged(event: AssistantContextChangedEvent, options?: WebhookOptions): void;
25
+ processAppHomeOpened(event: AppHomeOpenedEvent, options?: WebhookOptions): void;
26
+ }
@@ -0,0 +1,50 @@
1
+ import { Message, type Adapter } from "chat";
2
+ /**
3
+ * Parsed result from a Slack `message_changed` event that contains a newly
4
+ * added bot @mention. Returns `null` when the event does not qualify.
5
+ */
6
+ export interface MessageChangedMention {
7
+ /** Slack thread ID in `slack:<channel>:<thread_ts>` format. */
8
+ threadId: string;
9
+ /** Synthesized Message to pass to `bot.processMessage`. */
10
+ message: Message;
11
+ }
12
+ interface SlackMessageChangedEvent {
13
+ type: "event_callback";
14
+ team_id?: string;
15
+ event: {
16
+ type: "message";
17
+ subtype: "message_changed";
18
+ channel: string;
19
+ message: {
20
+ files?: SlackEditedMessageFile[];
21
+ source_team?: string;
22
+ text?: string;
23
+ ts: string;
24
+ thread_ts?: string;
25
+ user?: string;
26
+ user_team?: string;
27
+ };
28
+ previous_message: {
29
+ text?: string;
30
+ };
31
+ };
32
+ }
33
+ interface SlackEditedMessageFile {
34
+ mimetype?: string;
35
+ name?: string;
36
+ original_h?: number;
37
+ original_w?: number;
38
+ size?: number;
39
+ url_private?: string;
40
+ url_private_download?: string;
41
+ }
42
+ export declare function isMessageChangedEnvelope(value: unknown): value is SlackMessageChangedEvent;
43
+ /**
44
+ * Inspect a raw parsed Slack webhook body and extract a synthesized mention
45
+ * event when a `message_changed` edit newly adds the bot's @mention.
46
+ *
47
+ * Returns `null` when the payload is not a qualifying `message_changed` event.
48
+ */
49
+ export declare function extractMessageChangedMention(body: unknown, botUserId: string, adapter: Adapter): MessageChangedMention | null;
50
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { ThreadMessageKind } from "@/chat/queue/thread-message-dispatcher";
2
+ /** Derive canonical Slack thread IDs from the raw event payload. */
3
+ export declare function normalizeIncomingSlackThreadId(threadId: string, message: unknown): string;
4
+ /** Classify an incoming message as a mention or subscribed message. */
5
+ export declare function determineThreadMessageKind(args: {
6
+ isDirectMessage: boolean;
7
+ isMention: boolean;
8
+ isSubscribed: boolean;
9
+ }): ThreadMessageKind | undefined;
@@ -0,0 +1,3 @@
1
+ import type { SlashCommandEvent } from "chat";
2
+ /** Route `/jr link` and `/jr unlink` slash commands to the appropriate OAuth flow. */
3
+ export declare function handleSlashCommand(event: SlashCommandEvent): Promise<void>;
@@ -0,0 +1,9 @@
1
+ export { runWithWorkspaceTeamId } from "@/chat/slack/workspace-context";
2
+ /**
3
+ * Return true when a Slack event's author is from an external workspace.
4
+ *
5
+ * In Slack Connect shared channels the inner event carries `user_team`
6
+ * (the author's home workspace). When it differs from the outer payload's
7
+ * `team_id` the author is a Slack Connect participant, not a local member.
8
+ */
9
+ export declare function isExternalSlackUser(raw: Record<string, unknown> | undefined): boolean;
@@ -0,0 +1,2 @@
1
+ /** Return the marker added when a visible reply ended mid-execution. */
2
+ export declare function getInterruptionMarker(): string;