@sentry/junior 0.52.0 → 0.54.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 (222) hide show
  1. package/README.md +3 -2
  2. package/dist/api-reference.d.ts +7 -0
  3. package/dist/app.d.ts +5 -10
  4. package/dist/app.js +1671 -1219
  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/app/factory.d.ts +10 -0
  10. package/dist/chat/app/production.d.ts +6 -0
  11. package/dist/chat/app/services.d.ts +17 -0
  12. package/dist/chat/capabilities/catalog.d.ts +16 -0
  13. package/dist/chat/capabilities/factory.d.ts +10 -0
  14. package/dist/chat/capabilities/jr-rpc-command.d.ts +26 -0
  15. package/dist/chat/capabilities/router.d.ts +19 -0
  16. package/dist/chat/coerce.d.ts +6 -0
  17. package/dist/chat/config.d.ts +46 -0
  18. package/dist/chat/configuration/defaults.d.ts +4 -0
  19. package/dist/chat/configuration/service.d.ts +2 -0
  20. package/dist/chat/configuration/types.d.ts +37 -0
  21. package/dist/chat/configuration/validation.d.ts +2 -0
  22. package/dist/chat/credentials/broker.d.ts +22 -0
  23. package/dist/chat/credentials/header-transforms.d.ts +3 -0
  24. package/dist/chat/credentials/oauth-scope.d.ts +4 -0
  25. package/dist/chat/credentials/state-adapter-token-store.d.ts +9 -0
  26. package/dist/chat/credentials/test-broker.d.ts +19 -0
  27. package/dist/chat/credentials/unlink-provider.d.ts +2 -0
  28. package/dist/chat/credentials/user-token-store.d.ts +11 -0
  29. package/dist/chat/discovery.d.ts +47 -0
  30. package/dist/chat/ingress/junior-chat.d.ts +26 -0
  31. package/dist/chat/ingress/message-changed.d.ts +50 -0
  32. package/dist/chat/ingress/message-router.d.ts +9 -0
  33. package/dist/chat/ingress/slash-command.d.ts +3 -0
  34. package/dist/chat/ingress/workspace-membership.d.ts +10 -0
  35. package/dist/chat/interruption-marker.d.ts +2 -0
  36. package/dist/chat/logging.d.ts +88 -0
  37. package/dist/chat/mcp/auth-store.d.ts +41 -0
  38. package/dist/chat/mcp/client.d.ts +34 -0
  39. package/dist/chat/mcp/errors.d.ts +8 -0
  40. package/dist/chat/mcp/oauth-provider.d.ts +27 -0
  41. package/dist/chat/mcp/oauth.d.ts +17 -0
  42. package/dist/chat/mcp/tool-manager.d.ts +60 -0
  43. package/dist/chat/oauth-flow.d.ts +45 -0
  44. package/dist/chat/optional-string.d.ts +5 -0
  45. package/dist/chat/pi/client.d.ts +49 -0
  46. package/dist/chat/pi/messages.d.ts +3 -0
  47. package/dist/chat/pi/traced-stream.d.ts +9 -0
  48. package/dist/chat/plugins/auth/api-headers-broker.d.ts +6 -0
  49. package/dist/chat/plugins/auth/auth-token-placeholder.d.ts +3 -0
  50. package/dist/chat/plugins/auth/github-app-broker.d.ts +4 -0
  51. package/dist/chat/plugins/auth/oauth-bearer-broker.d.ts +6 -0
  52. package/dist/chat/plugins/auth/oauth-request.d.ts +18 -0
  53. package/dist/chat/plugins/command-env.d.ts +3 -0
  54. package/dist/chat/plugins/manifest.d.ts +3 -0
  55. package/dist/chat/plugins/package-discovery.d.ts +14 -0
  56. package/dist/chat/plugins/registry.d.ts +23 -0
  57. package/dist/chat/plugins/types.d.ts +146 -0
  58. package/dist/chat/prompt.d.ts +39 -0
  59. package/dist/chat/queue/thread-message-dispatcher.d.ts +33 -0
  60. package/dist/chat/respond-helpers.d.ts +77 -0
  61. package/dist/chat/respond.d.ts +64 -0
  62. package/dist/chat/runtime/auth-pause-state.d.ts +11 -0
  63. package/dist/chat/runtime/delivered-turn-state.d.ts +15 -0
  64. package/dist/chat/runtime/dev-agent-trace.d.ts +1 -0
  65. package/dist/chat/runtime/processing-reaction.d.ts +25 -0
  66. package/dist/chat/runtime/reply-executor.d.ts +56 -0
  67. package/dist/chat/runtime/report-progress.d.ts +3 -0
  68. package/dist/chat/runtime/slack-resume.d.ts +50 -0
  69. package/dist/chat/runtime/slack-runtime.d.ts +100 -0
  70. package/dist/chat/runtime/thread-context.d.ts +22 -0
  71. package/dist/chat/runtime/thread-state.d.ts +28 -0
  72. package/dist/chat/runtime/turn-preparation.d.ts +43 -0
  73. package/dist/chat/runtime/turn-user-message.d.ts +12 -0
  74. package/dist/chat/runtime/turn.d.ts +69 -0
  75. package/dist/chat/sandbox/credentials.d.ts +11 -0
  76. package/dist/chat/sandbox/egress-oidc.d.ts +3 -0
  77. package/dist/chat/sandbox/egress-policy.d.ts +11 -0
  78. package/dist/chat/sandbox/egress-proxy.d.ts +10 -0
  79. package/dist/chat/sandbox/egress-session.d.ts +27 -0
  80. package/dist/chat/sandbox/errors.d.ts +12 -0
  81. package/dist/chat/sandbox/eval-gh-stub.d.ts +2 -0
  82. package/dist/chat/sandbox/eval-oauth-stub.d.ts +2 -0
  83. package/dist/chat/sandbox/eval-sentry-stub.d.ts +2 -0
  84. package/dist/chat/sandbox/fault-injection.d.ts +2 -0
  85. package/dist/chat/sandbox/http-error-details.d.ts +18 -0
  86. package/dist/chat/sandbox/noninteractive-command.d.ts +17 -0
  87. package/dist/chat/sandbox/paths.d.ts +5 -0
  88. package/dist/chat/sandbox/runtime-dependency-snapshots.d.ts +20 -0
  89. package/dist/chat/sandbox/sandbox.d.ts +52 -0
  90. package/dist/chat/sandbox/session.d.ts +53 -0
  91. package/dist/chat/sandbox/skill-sandbox.d.ts +42 -0
  92. package/dist/chat/sandbox/skill-sync.d.ts +17 -0
  93. package/dist/chat/sandbox/workspace.d.ts +55 -0
  94. package/dist/chat/sentry.d.ts +2 -0
  95. package/dist/chat/services/attachment-claims.d.ts +2 -0
  96. package/dist/chat/services/auth-pause-response.d.ts +2 -0
  97. package/dist/chat/services/auth-pause.d.ts +12 -0
  98. package/dist/chat/services/channel-intent.d.ts +2 -0
  99. package/dist/chat/services/conversation-memory.d.ts +33 -0
  100. package/dist/chat/services/mcp-auth-orchestration.d.ts +29 -0
  101. package/dist/chat/services/pending-auth.d.ts +27 -0
  102. package/dist/chat/services/plugin-auth-orchestration.d.ts +36 -0
  103. package/dist/chat/services/provider-default-config.d.ts +9 -0
  104. package/dist/chat/services/provider-retry.d.ts +6 -0
  105. package/dist/chat/services/reply-delivery-plan.d.ts +17 -0
  106. package/dist/chat/services/subscribed-decision.d.ts +63 -0
  107. package/dist/chat/services/subscribed-reply-policy.d.ts +23 -0
  108. package/dist/chat/services/timeout-resume.d.ts +17 -0
  109. package/dist/chat/services/turn-checkpoint.d.ts +74 -0
  110. package/dist/chat/services/turn-continuation-response.d.ts +2 -0
  111. package/dist/chat/services/turn-failure-response.d.ts +15 -0
  112. package/dist/chat/services/turn-result.d.ts +55 -0
  113. package/dist/chat/services/turn-thinking-level.d.ts +49 -0
  114. package/dist/chat/services/vision-context.d.ts +61 -0
  115. package/dist/chat/skills.d.ts +48 -0
  116. package/dist/chat/slack/adapter.d.ts +9 -0
  117. package/dist/chat/slack/app-home.d.ts +11 -0
  118. package/dist/chat/slack/assistant-thread/lifecycle.d.ts +13 -0
  119. package/dist/chat/slack/assistant-thread/status-render.d.ts +28 -0
  120. package/dist/chat/slack/assistant-thread/status-scheduler.d.ts +23 -0
  121. package/dist/chat/slack/assistant-thread/status-send.d.ts +31 -0
  122. package/dist/chat/slack/assistant-thread/status.d.ts +36 -0
  123. package/dist/chat/slack/assistant-thread/title.d.ts +28 -0
  124. package/dist/chat/slack/canvas-references.d.ts +2 -0
  125. package/dist/chat/slack/channel.d.ts +48 -0
  126. package/dist/chat/slack/client.d.ts +52 -0
  127. package/dist/chat/slack/context.d.ts +9 -0
  128. package/dist/chat/slack/emoji.d.ts +1 -0
  129. package/dist/chat/slack/errors.d.ts +6 -0
  130. package/dist/chat/slack/footer.d.ts +42 -0
  131. package/dist/chat/slack/legacy-attachments.d.ts +4 -0
  132. package/dist/chat/slack/message.d.ts +6 -0
  133. package/dist/chat/slack/mrkdwn.d.ts +12 -0
  134. package/dist/chat/slack/outbound.d.ts +57 -0
  135. package/dist/chat/slack/output.d.ts +54 -0
  136. package/dist/chat/slack/reply.d.ts +33 -0
  137. package/dist/chat/slack/status-format.d.ts +2 -0
  138. package/dist/chat/slack/turn-continuation-notice.d.ts +8 -0
  139. package/dist/chat/slack/user.d.ts +7 -0
  140. package/dist/chat/slack/users.d.ts +39 -0
  141. package/dist/chat/state/adapter.d.ts +9 -0
  142. package/dist/chat/state/artifacts.d.ts +29 -0
  143. package/dist/chat/state/conversation.d.ts +81 -0
  144. package/dist/chat/state/pi-session-message-store.d.ts +15 -0
  145. package/dist/chat/state/turn-id.d.ts +2 -0
  146. package/dist/chat/state/turn-session-store.d.ts +49 -0
  147. package/dist/chat/tools/advisor/session-store.d.ts +9 -0
  148. package/dist/chat/tools/advisor/tool.d.ts +33 -0
  149. package/dist/chat/tools/agent-tools.d.ts +9 -0
  150. package/dist/chat/tools/channel-capabilities.d.ts +11 -0
  151. package/dist/chat/tools/definition.d.ts +17 -0
  152. package/dist/chat/tools/execution/build-sandbox-input.d.ts +2 -0
  153. package/dist/chat/tools/execution/normalize-result.d.ts +6 -0
  154. package/dist/chat/tools/execution/tool-error-handler.d.ts +3 -0
  155. package/dist/chat/tools/execution/tool-input-error.d.ts +6 -0
  156. package/dist/chat/tools/idempotency.d.ts +1 -0
  157. package/dist/chat/tools/index.d.ts +5 -0
  158. package/dist/chat/tools/runtime/report-progress.d.ts +4 -0
  159. package/dist/chat/tools/sandbox/attach-file.d.ts +7 -0
  160. package/dist/chat/tools/sandbox/bash.d.ts +5 -0
  161. package/dist/chat/tools/sandbox/edit-file.d.ts +37 -0
  162. package/dist/chat/tools/sandbox/file-utils.d.ts +52 -0
  163. package/dist/chat/tools/sandbox/find-files.d.ts +24 -0
  164. package/dist/chat/tools/sandbox/grep.d.ts +33 -0
  165. package/dist/chat/tools/sandbox/list-dir.d.ts +22 -0
  166. package/dist/chat/tools/sandbox/read-file.d.ts +32 -0
  167. package/dist/chat/tools/sandbox/text-edits.d.ts +28 -0
  168. package/dist/chat/tools/sandbox/write-file.d.ts +5 -0
  169. package/dist/chat/tools/skill/call-mcp-tool.d.ts +7 -0
  170. package/dist/chat/tools/skill/load-skill.d.ts +22 -0
  171. package/dist/chat/tools/skill/mcp-tool-summary.d.ts +31 -0
  172. package/dist/chat/tools/skill/search-mcp-tools.d.ts +8 -0
  173. package/dist/chat/tools/slack/canvas-tools.d.ts +29 -0
  174. package/dist/chat/tools/slack/canvases.d.ts +45 -0
  175. package/dist/chat/tools/slack/channel-list-messages.d.ts +9 -0
  176. package/dist/chat/tools/slack/channel-post-message.d.ts +4 -0
  177. package/dist/chat/tools/slack/list-tools.d.ts +21 -0
  178. package/dist/chat/tools/slack/lists.d.ts +42 -0
  179. package/dist/chat/tools/slack/message-add-reaction.d.ts +4 -0
  180. package/dist/chat/tools/slack/slack-message-url.d.ts +18 -0
  181. package/dist/chat/tools/slack/thread-read.d.ts +9 -0
  182. package/dist/chat/tools/slack/user-lookup.d.ts +8 -0
  183. package/dist/chat/tools/system-time.d.ts +1 -0
  184. package/dist/chat/tools/types.d.ts +55 -0
  185. package/dist/chat/tools/web/constants.d.ts +6 -0
  186. package/dist/chat/tools/web/fetch-content.d.ts +23 -0
  187. package/dist/chat/tools/web/fetch-tool.d.ts +5 -0
  188. package/dist/chat/tools/web/image-generate.d.ts +4 -0
  189. package/dist/chat/tools/web/network.d.ts +6 -0
  190. package/dist/chat/tools/web/search.d.ts +5 -0
  191. package/dist/chat/turn-context-tag.d.ts +6 -0
  192. package/dist/chat/usage.d.ts +24 -0
  193. package/dist/chat/xml.d.ts +1 -0
  194. package/dist/{chunk-XPXD3FCE.js → chunk-5LUISFEY.js} +189 -35
  195. package/dist/{chunk-KCOKQLBF.js → chunk-7WTXNEPF.js} +120 -15
  196. package/dist/{chunk-ZNFNY53B.js → chunk-QCHPJ4FD.js} +2 -2
  197. package/dist/{chunk-Q3FDONU7.js → chunk-YITDDLS3.js} +34 -28
  198. package/dist/cli/check.js +3 -3
  199. package/dist/cli/init.js +1 -0
  200. package/dist/cli/snapshot-warmup.js +3 -3
  201. package/dist/handlers/diagnostics-dashboard.d.ts +2 -0
  202. package/dist/handlers/diagnostics.d.ts +2 -0
  203. package/dist/handlers/health.d.ts +4 -0
  204. package/dist/handlers/mcp-oauth-callback.d.ts +2 -0
  205. package/dist/handlers/oauth-callback.d.ts +2 -0
  206. package/dist/handlers/oauth-html.d.ts +2 -0
  207. package/dist/handlers/sandbox-egress-proxy.d.ts +4 -0
  208. package/dist/handlers/turn-resume.d.ts +3 -0
  209. package/dist/handlers/types.d.ts +2 -0
  210. package/dist/handlers/webhooks.d.ts +15 -0
  211. package/dist/instrumentation.d.ts +1 -3
  212. package/dist/nitro.d.ts +4 -7
  213. package/dist/nitro.js +112 -54
  214. package/dist/package-resolution.d.ts +13 -0
  215. package/dist/vercel.d.ts +2 -4
  216. package/package.json +25 -25
  217. package/dist/cli/check.d.ts +0 -8
  218. package/dist/cli/env.d.ts +0 -7
  219. package/dist/cli/init.d.ts +0 -3
  220. package/dist/cli/run.d.ts +0 -12
  221. package/dist/cli/snapshot-warmup.d.ts +0 -3
  222. package/dist/types-X_iCClPb.d.ts +0 -75
@@ -0,0 +1,52 @@
1
+ import type { SandboxFileSystem } from "@/chat/sandbox/workspace";
2
+ export type { SandboxFileSystem };
3
+ export declare const MAX_TEXT_CHARS = 60000;
4
+ export type TextSearchResultDetails = {
5
+ ok: true;
6
+ path: string;
7
+ truncated: boolean;
8
+ } | {
9
+ ok: false;
10
+ error: "not_found";
11
+ path: string;
12
+ missing_path?: string;
13
+ truncated: false;
14
+ };
15
+ export interface TextSearchToolResult {
16
+ content: [{
17
+ type: "text";
18
+ text: string;
19
+ }];
20
+ details: TextSearchResultDetails;
21
+ }
22
+ /** Normalize model-supplied numeric knobs before they reach filesystem tools. */
23
+ export declare function positiveInteger(value: unknown): number | undefined;
24
+ /** Compare and slice text in one line-ending space while preserving callers' output rules. */
25
+ export declare function normalizeToLf(value: string): string;
26
+ /** Keep tool output inside the model-facing budget with an explicit notice. */
27
+ export declare function truncateText(value: string, maxChars?: number): {
28
+ content: string;
29
+ truncated: boolean;
30
+ };
31
+ /** Detect model-facing missing paths without swallowing sandbox lifecycle/API failures. */
32
+ export declare function isMissingPathError(error: unknown): boolean;
33
+ /** Build the shared model-visible result for expected missing search/list paths. */
34
+ export declare function missingPathSearchResult(params: {
35
+ path: string;
36
+ displayPath?: string;
37
+ missingPath?: string;
38
+ }): TextSearchToolResult;
39
+ /** Keep sandbox filesystem tools scoped to the mounted workspace root. */
40
+ export declare function resolveWorkspacePath(input: string | undefined, fallback?: string): string;
41
+ /** Share bounded workspace traversal across search tools so their skip rules stay aligned. */
42
+ export declare function collectFiles(params: {
43
+ fs: SandboxFileSystem;
44
+ root: string;
45
+ limit?: number;
46
+ pattern?: string;
47
+ }): Promise<{
48
+ files: string[];
49
+ limitReached: boolean;
50
+ missingPath?: string;
51
+ missingRoot: boolean;
52
+ }>;
@@ -0,0 +1,24 @@
1
+ import { type SandboxFileSystem, type TextSearchResultDetails } from "@/chat/tools/sandbox/file-utils";
2
+ interface FindFilesResult {
3
+ content: [{
4
+ type: "text";
5
+ text: string;
6
+ }];
7
+ details: TextSearchResultDetails & {
8
+ result_limit_reached?: number;
9
+ };
10
+ }
11
+ /** Find workspace files with structured limits instead of ad hoc shell output. */
12
+ export declare function findFiles(params: {
13
+ fs: SandboxFileSystem;
14
+ limit?: unknown;
15
+ path?: string;
16
+ pattern: string;
17
+ }): Promise<FindFilesResult>;
18
+ /** Create the sandbox file discovery tool definition exposed to the agent. */
19
+ export declare function createFindFilesTool(): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
20
+ pattern: import("@sinclair/typebox").TString;
21
+ path: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
22
+ limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
23
+ }>>;
24
+ export {};
@@ -0,0 +1,33 @@
1
+ import { type SandboxFileSystem, type TextSearchResultDetails } from "@/chat/tools/sandbox/file-utils";
2
+ interface GrepResult {
3
+ content: [{
4
+ type: "text";
5
+ text: string;
6
+ }];
7
+ details: TextSearchResultDetails & {
8
+ line_truncated?: boolean;
9
+ match_limit_reached?: number;
10
+ };
11
+ }
12
+ /** Search workspace file contents with bounded, line-numbered output. */
13
+ export declare function grepFiles(params: {
14
+ context?: unknown;
15
+ fs: SandboxFileSystem;
16
+ glob?: string;
17
+ ignoreCase?: boolean;
18
+ limit?: unknown;
19
+ literal?: boolean;
20
+ path?: string;
21
+ pattern: string;
22
+ }): Promise<GrepResult>;
23
+ /** Create the sandbox grep tool definition exposed to the agent. */
24
+ export declare function createGrepTool(): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
25
+ pattern: import("@sinclair/typebox").TString;
26
+ path: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
27
+ glob: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
28
+ ignoreCase: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
29
+ literal: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
30
+ context: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
31
+ limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
32
+ }>>;
33
+ export {};
@@ -0,0 +1,22 @@
1
+ import { type SandboxFileSystem, type TextSearchResultDetails } from "@/chat/tools/sandbox/file-utils";
2
+ interface ListDirResult {
3
+ content: [{
4
+ type: "text";
5
+ text: string;
6
+ }];
7
+ details: TextSearchResultDetails & {
8
+ entry_limit_reached?: number;
9
+ };
10
+ }
11
+ /** List workspace directories without forcing the model through shell output. */
12
+ export declare function listDir(params: {
13
+ fs: SandboxFileSystem;
14
+ limit?: unknown;
15
+ path?: string;
16
+ }): Promise<ListDirResult>;
17
+ /** Create the sandbox directory listing tool definition exposed to the agent. */
18
+ export declare function createListDirTool(): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
19
+ path: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
20
+ limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
21
+ }>>;
22
+ export {};
@@ -0,0 +1,32 @@
1
+ interface TextRangeResult {
2
+ content: string;
3
+ end_line?: number;
4
+ path: string;
5
+ start_line: number;
6
+ success: true;
7
+ total_lines: number;
8
+ truncated: boolean;
9
+ continuation?: string;
10
+ }
11
+ interface TextRangeMissingPathResult {
12
+ content: "";
13
+ error: "not_found";
14
+ path: string;
15
+ success: false;
16
+ }
17
+ /** Return a bounded line window so large files can be read incrementally. */
18
+ export declare function sliceFileContent(params: {
19
+ content: string;
20
+ limit?: unknown;
21
+ offset?: unknown;
22
+ path: string;
23
+ }): TextRangeResult;
24
+ /** Return a model-visible result for expected missing read targets. */
25
+ export declare function missingFileResult(path: string): TextRangeMissingPathResult;
26
+ /** Create the sandbox read tool definition exposed to the agent. */
27
+ export declare function createReadFileTool(): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
28
+ path: import("@sinclair/typebox").TString;
29
+ offset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
30
+ limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
31
+ }>>;
32
+ export {};
@@ -0,0 +1,28 @@
1
+ export interface TextReplacement {
2
+ oldText: string;
3
+ newText: string;
4
+ }
5
+ export interface TextReplacementInput {
6
+ edits: TextReplacement[];
7
+ }
8
+ /** Preserve a text artifact's dominant line-ending style across rewrites. */
9
+ export declare function detectLineEnding(value: string): "\r\n" | "\n";
10
+ /** Restore normalized LF content to the caller's original line-ending style. */
11
+ export declare function restoreLineEndings(value: string, lineEnding: "\r\n" | "\n"): string;
12
+ /** Keep UTF-8 BOM handling out of exact edit matching. */
13
+ export declare function stripBom(value: string): {
14
+ bom: string;
15
+ text: string;
16
+ };
17
+ /** Accept common exact-edit argument variants before schema validation. */
18
+ export declare function prepareTextReplacementArguments<T extends TextReplacementInput>(input: unknown): T;
19
+ /** Build a small line-oriented diff that gives agents enough context to review edits. */
20
+ export declare function buildCompactDiff(oldContent: string, newContent: string): {
21
+ diff: string;
22
+ firstChangedLine?: number;
23
+ };
24
+ /** Apply exact replacements to normalized text after validating uniqueness and overlap. */
25
+ export declare function validateAndApplyTextEdits(content: string, edits: TextReplacement[], targetName: string): {
26
+ baseContent: string;
27
+ newContent: string;
28
+ };
@@ -0,0 +1,5 @@
1
+ /** Create the sandbox full-file write tool definition exposed to the agent. */
2
+ export declare function createWriteFileTool(): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
3
+ path: import("@sinclair/typebox").TString;
4
+ content: import("@sinclair/typebox").TString;
5
+ }>>;
@@ -0,0 +1,7 @@
1
+ import type { McpToolManager } from "@/chat/mcp/tool-manager";
2
+ import type { Skill } from "@/chat/skills";
3
+ /** Create the stable dispatcher for active MCP provider tools. */
4
+ export declare function createCallMcpToolTool(mcpToolManager: McpToolManager, getActiveSkills: () => Skill[]): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
5
+ tool_name: import("@sinclair/typebox").TString;
6
+ arguments: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
7
+ }>>;
@@ -0,0 +1,22 @@
1
+ import { type Skill, type SkillMetadata } from "@/chat/skills";
2
+ export type LoadSkillResult = {
3
+ ok?: boolean;
4
+ error?: string;
5
+ available_skills?: string[];
6
+ skill_name?: string;
7
+ description?: string;
8
+ skill_dir?: string;
9
+ working_directory?: string;
10
+ location?: string;
11
+ path_resolution?: string;
12
+ instructions?: string;
13
+ mcp_provider?: string;
14
+ available_tool_count?: number;
15
+ };
16
+ export type LoadSkillMetadata = Pick<LoadSkillResult, "mcp_provider" | "available_tool_count">;
17
+ /** Create the skill-loading tool that injects skill instructions and activates provider catalogs. */
18
+ export declare function createLoadSkillTool(availableSkills: SkillMetadata[], options?: {
19
+ onSkillLoaded?: (skill: Skill) => void | LoadSkillMetadata | Promise<void | LoadSkillMetadata>;
20
+ }): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
21
+ skill_name: import("@sinclair/typebox").TString;
22
+ }>>;
@@ -0,0 +1,31 @@
1
+ import type { ManagedMcpToolDescriptor } from "@/chat/mcp/tool-manager";
2
+ export interface ExposedToolSummary {
3
+ tool_name: string;
4
+ mcp_tool_name: string;
5
+ provider: string;
6
+ title?: string;
7
+ description: string;
8
+ signature: string;
9
+ call: {
10
+ tool_name: string;
11
+ arguments: Record<string, string>;
12
+ };
13
+ input_schema: Record<string, unknown>;
14
+ input_schema_summary: string;
15
+ output_schema?: Record<string, unknown>;
16
+ annotations?: Record<string, unknown>;
17
+ }
18
+ export interface ActiveMcpCatalogSummary {
19
+ provider: string;
20
+ available_tool_count: number;
21
+ }
22
+ /** Build a stable model-readable MCP tool signature. */
23
+ export declare function formatMcpToolSignature(toolName: string, schema: Record<string, unknown>): string;
24
+ /** Build the exact callMcpTool argument shape agents should use. */
25
+ export declare function formatMcpToolCallExample(toolName: string, schema: Record<string, unknown>): ExposedToolSummary["call"];
26
+ /** Summarize an MCP input schema for quick catalog scanning. */
27
+ export declare function summarizeInputSchema(schema: Record<string, unknown>): string;
28
+ /** Convert a managed MCP tool descriptor into agent-visible search output. */
29
+ export declare function toExposedToolSummary(toolDef: ManagedMcpToolDescriptor): ExposedToolSummary;
30
+ /** Group discovered MCP tools into provider catalogs for prompt disclosure. */
31
+ export declare function toActiveMcpCatalogSummaries(toolDefs: ManagedMcpToolDescriptor[]): ActiveMcpCatalogSummary[];
@@ -0,0 +1,8 @@
1
+ import type { McpToolManager } from "@/chat/mcp/tool-manager";
2
+ import type { Skill } from "@/chat/skills";
3
+ /** Create the progressive MCP catalog search tool used before callMcpTool. */
4
+ export declare function createSearchMcpToolsTool(mcpToolManager: McpToolManager, getActiveSkills: () => Skill[]): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
5
+ query: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
6
+ provider: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
7
+ max_results: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
8
+ }>>;
@@ -0,0 +1,29 @@
1
+ import type { ToolRuntimeContext, ToolState } from "@/chat/tools/types";
2
+ /** Create a tool that provisions a new Slack canvas in the active channel. */
3
+ export declare function createSlackCanvasCreateTool(context: ToolRuntimeContext, state: ToolState): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
4
+ title: import("@sinclair/typebox").TString;
5
+ markdown: import("@sinclair/typebox").TString;
6
+ }>>;
7
+ /**
8
+ * Create a tool that reads a Slack canvas the bot has access to. Accepts
9
+ * either a canvas/file ID (`F...`) or a Slack canvas/docs URL and returns the
10
+ * canvas body downloaded via the bot's file access.
11
+ */
12
+ export declare function createSlackCanvasReadTool(): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
13
+ canvas: import("@sinclair/typebox").TString;
14
+ offset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
15
+ limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
16
+ }>>;
17
+ /** Create a tool that edits a Slack canvas like a markdown file. */
18
+ export declare function createSlackCanvasEditTool(state: ToolState): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
19
+ canvas: import("@sinclair/typebox").TString;
20
+ edits: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
21
+ oldText: import("@sinclair/typebox").TString;
22
+ newText: import("@sinclair/typebox").TString;
23
+ }>>;
24
+ }>>;
25
+ /** Create a tool that deliberately replaces a Slack canvas body. */
26
+ export declare function createSlackCanvasWriteTool(state: ToolState): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
27
+ canvas: import("@sinclair/typebox").TString;
28
+ content: import("@sinclair/typebox").TString;
29
+ }>>;
@@ -0,0 +1,45 @@
1
+ export { extractCanvasId } from "@/chat/slack/canvas-references";
2
+ export interface CanvasCreateInput {
3
+ title: string;
4
+ markdown: string;
5
+ channelId?: string;
6
+ }
7
+ export interface CanvasReadResult {
8
+ canvasId: string;
9
+ title?: string;
10
+ permalink?: string;
11
+ mimetype?: string;
12
+ filetype?: string;
13
+ content: string;
14
+ byteLength: number;
15
+ }
16
+ /** Clamp headings deeper than h3 to h3 (Slack canvas limitation). */
17
+ export declare function normalizeCanvasMarkdown(markdown: string): {
18
+ markdown: string;
19
+ normalizedHeadingCount: number;
20
+ };
21
+ /**
22
+ * Create a standalone Slack canvas owned by the bot and best-effort grant write
23
+ * access to the active channel. Standalone canvases (`canvases.create`) are not
24
+ * subject to the one-per-channel limit of `conversations.canvases.create`, so
25
+ * the bot can produce multiple canvases in the same channel/thread.
26
+ */
27
+ export declare function createCanvas(input: CanvasCreateInput): Promise<{
28
+ canvasId: string;
29
+ permalink?: string;
30
+ }>;
31
+ /** Replace an existing Slack canvas body with the provided markdown. */
32
+ export declare function writeCanvasMarkdown(input: {
33
+ canvasId: string;
34
+ markdown: string;
35
+ }): Promise<{
36
+ markdown: string;
37
+ normalizedHeadingCount: number;
38
+ }>;
39
+ /**
40
+ * Read a Slack canvas the bot has access to and return its raw downloadable
41
+ * content. Slack does not expose a structured canvas-read API, so we fetch
42
+ * file metadata via `files.info` and download the canvas body via the private
43
+ * file URL with the bot token.
44
+ */
45
+ export declare function readCanvas(canvasIdOrUrl: string): Promise<CanvasReadResult>;
@@ -0,0 +1,9 @@
1
+ import type { ToolRuntimeContext } from "@/chat/tools/types";
2
+ export declare function createSlackChannelListMessagesTool(context: ToolRuntimeContext): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
3
+ limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
4
+ cursor: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
5
+ oldest: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
6
+ latest: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
7
+ inclusive: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
8
+ max_pages: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
9
+ }>>;
@@ -0,0 +1,4 @@
1
+ import type { ToolRuntimeContext, ToolState } from "@/chat/tools/types";
2
+ export declare function createSlackChannelPostMessageTool(context: ToolRuntimeContext, state: ToolState): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
3
+ text: import("@sinclair/typebox").TString;
4
+ }>>;
@@ -0,0 +1,21 @@
1
+ import type { ToolState } from "@/chat/tools/types";
2
+ /** Create a tool that provisions a new Slack todo list. */
3
+ export declare function createSlackListCreateTool(state: ToolState): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
4
+ name: import("@sinclair/typebox").TString;
5
+ }>>;
6
+ /** Create a tool that appends items to the active Slack list. */
7
+ export declare function createSlackListAddItemsTool(state: ToolState): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
8
+ items: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
9
+ assignee_user_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
10
+ due_date: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
11
+ }>>;
12
+ /** Create a tool that reads items from the active Slack list. */
13
+ export declare function createSlackListGetItemsTool(state: ToolState): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
14
+ limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
15
+ }>>;
16
+ /** Create a tool that updates an item in the active Slack list. */
17
+ export declare function createSlackListUpdateItemTool(state: ToolState): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
18
+ item_id: import("@sinclair/typebox").TString;
19
+ completed: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
20
+ title: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
21
+ }>>;
@@ -0,0 +1,42 @@
1
+ import type { ListColumnMap } from "@/chat/state/artifacts";
2
+ interface SlackListsSchemaColumnResponse {
3
+ id: string;
4
+ key: string;
5
+ name: string;
6
+ type: string;
7
+ is_primary_column?: boolean;
8
+ }
9
+ interface SlackListsItem {
10
+ id: string;
11
+ fields: unknown[];
12
+ }
13
+ /** Infer well-known column roles (title, completed, assignee, due date) from a list schema. */
14
+ export declare function inferListColumnMap(schema?: SlackListsSchemaColumnResponse[]): ListColumnMap;
15
+ /** Create a new Slack todo list with the default schema. */
16
+ export declare function createTodoList(name: string): Promise<{
17
+ listId: string;
18
+ listColumnMap: ListColumnMap;
19
+ permalink?: string;
20
+ }>;
21
+ /** Add one or more items to an existing Slack list. */
22
+ export declare function addListItems(input: {
23
+ listId: string;
24
+ titles: string[];
25
+ listColumnMap?: ListColumnMap;
26
+ assigneeUserId?: string;
27
+ dueDate?: string;
28
+ }): Promise<{
29
+ createdItemIds: string[];
30
+ listColumnMap?: ListColumnMap;
31
+ }>;
32
+ /** Fetch items from a Slack list, paginating up to `limit`. */
33
+ export declare function listItems(listId: string, limit?: number): Promise<SlackListsItem[]>;
34
+ /** Update fields (title, completed) on an existing Slack list item. */
35
+ export declare function updateListItem(input: {
36
+ listId: string;
37
+ itemId: string;
38
+ listColumnMap: ListColumnMap;
39
+ completed?: boolean;
40
+ title?: string;
41
+ }): Promise<void>;
42
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { ToolRuntimeContext, ToolState } from "@/chat/tools/types";
2
+ export declare function createSlackMessageAddReactionTool(context: ToolRuntimeContext, state: ToolState): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
3
+ emoji: import("@sinclair/typebox").TString;
4
+ }>>;
@@ -0,0 +1,18 @@
1
+ /** Parse Slack archive URLs into structured message references. */
2
+ export interface SlackMessageReference {
3
+ channelId: string;
4
+ messageTs: string;
5
+ threadTs?: string;
6
+ }
7
+ type ParseResult = {
8
+ ok: true;
9
+ reference: SlackMessageReference;
10
+ } | {
11
+ ok: false;
12
+ error: string;
13
+ };
14
+ /** Slack message timestamp format: 10 digits, dot, 6 digits. */
15
+ export declare const SLACK_TS_PATTERN: RegExp;
16
+ /** Parse a Slack archive URL (or mrkdwn-wrapped URL) into a message reference. */
17
+ export declare function parseSlackMessageReference(input: string): ParseResult;
18
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { ToolRuntimeContext } from "@/chat/tools/types";
2
+ /** Create a tool that reads a Slack thread from a shared message URL or explicit coordinates. */
3
+ export declare function createSlackThreadReadTool(context: ToolRuntimeContext): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
4
+ url: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
5
+ channel_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
6
+ ts: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
7
+ limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
8
+ max_pages: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
9
+ }>>;
@@ -0,0 +1,8 @@
1
+ export declare function createSlackUserLookupTool(): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
2
+ user_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
3
+ email: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
4
+ query: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
5
+ limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
6
+ max_pages: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
7
+ include_bots: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
8
+ }>>;
@@ -0,0 +1 @@
1
+ export declare function createSystemTimeTool(): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{}>>;
@@ -0,0 +1,55 @@
1
+ import type { FileUpload } from "chat";
2
+ import type { McpToolManager } from "@/chat/mcp/tool-manager";
3
+ import type { SandboxWorkspace } from "@/chat/sandbox/workspace";
4
+ import type { ThreadArtifactsState } from "@/chat/state/artifacts";
5
+ import type { Skill } from "@/chat/skills";
6
+ import type { LoadSkillMetadata } from "@/chat/tools/skill/load-skill";
7
+ import type { ChannelCapabilities } from "@/chat/tools/channel-capabilities";
8
+ import type { AdvisorToolRuntimeContext } from "@/chat/tools/advisor/tool";
9
+ export interface ImageGenerateToolDeps {
10
+ fetch?: typeof fetch;
11
+ }
12
+ export interface WebFetchToolDeps {
13
+ execute?: (input: {
14
+ url: string;
15
+ max_chars?: number;
16
+ }) => Promise<unknown> | unknown;
17
+ }
18
+ export interface WebSearchToolDeps {
19
+ execute?: (input: {
20
+ query: string;
21
+ max_results?: number;
22
+ }) => Promise<unknown> | unknown;
23
+ }
24
+ export interface ToolHooks {
25
+ getGeneratedFile?: (filename: string) => FileUpload | undefined;
26
+ onGeneratedArtifactFiles?: (files: FileUpload[]) => void;
27
+ onGeneratedFiles?: (files: FileUpload[]) => void;
28
+ onArtifactStatePatch?: (patch: Partial<ThreadArtifactsState>) => void | Promise<void>;
29
+ onSkillLoaded?: (skill: Skill) => void | LoadSkillMetadata | Promise<void | LoadSkillMetadata>;
30
+ toolOverrides?: {
31
+ imageGenerate?: ImageGenerateToolDeps;
32
+ webFetch?: WebFetchToolDeps;
33
+ webSearch?: WebSearchToolDeps;
34
+ };
35
+ }
36
+ export interface ToolRuntimeContext {
37
+ advisor?: AdvisorToolRuntimeContext;
38
+ channelId?: string;
39
+ channelCapabilities: ChannelCapabilities;
40
+ messageTs?: string;
41
+ threadTs?: string;
42
+ userText?: string;
43
+ artifactState?: ThreadArtifactsState;
44
+ configuration?: Record<string, unknown>;
45
+ getActiveSkills?: () => Skill[];
46
+ mcpToolManager?: McpToolManager;
47
+ sandbox: SandboxWorkspace;
48
+ }
49
+ export interface ToolState {
50
+ artifactState: ThreadArtifactsState;
51
+ patchArtifactState: (patch: Partial<ThreadArtifactsState>) => void | Promise<void>;
52
+ getCurrentListId: () => string | undefined;
53
+ getOperationResult: <T>(operationKey: string) => T | undefined;
54
+ setOperationResult: (operationKey: string, result: unknown) => void;
55
+ }
@@ -0,0 +1,6 @@
1
+ export declare const USER_AGENT = "junior-bot/0.1";
2
+ export declare const FETCH_TIMEOUT_MS = 8000;
3
+ export declare const MAX_REDIRECTS = 3;
4
+ export declare const DEFAULT_MAX_CHARS = 6000;
5
+ export declare const MAX_FETCH_CHARS = 12000;
6
+ export declare const MAX_FETCH_BYTES = 1000000;
@@ -0,0 +1,23 @@
1
+ import { MAX_FETCH_CHARS } from "@/chat/tools/web/constants";
2
+ export { MAX_FETCH_CHARS };
3
+ export interface WebFetchResponseContent {
4
+ content: string;
5
+ title?: string;
6
+ truncated: boolean;
7
+ extractedChars: number;
8
+ }
9
+ export interface WebFetchResponse {
10
+ url: string;
11
+ content: string;
12
+ title?: string;
13
+ content_type: string;
14
+ source_bytes: number;
15
+ extracted_chars: number;
16
+ truncated: boolean;
17
+ }
18
+ /** Extract readable content and metadata from a fetched response body. */
19
+ export declare function extractContentDetails(body: string, contentType: string, maxChars: number): WebFetchResponseContent;
20
+ /** Extract readable content from a fetched response body, converting HTML to markdown. */
21
+ export declare function extractContent(body: string, contentType: string, maxChars: number): string;
22
+ /** Extract text content from a web fetch response, validating content type and size. */
23
+ export declare function extractWebFetchResponse(url: URL, response: Response, maxChars?: number): Promise<WebFetchResponse>;
@@ -0,0 +1,5 @@
1
+ import type { ToolHooks } from "@/chat/tools/types";
2
+ export declare function createWebFetchTool(hooks: ToolHooks): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
3
+ url: import("@sinclair/typebox").TString;
4
+ max_chars: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
5
+ }>>;
@@ -0,0 +1,4 @@
1
+ import type { ImageGenerateToolDeps, ToolHooks } from "@/chat/tools/types";
2
+ export declare function createImageGenerateTool(hooks: ToolHooks, deps?: ImageGenerateToolDeps): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
3
+ prompt: import("@sinclair/typebox").TString;
4
+ }>>;
@@ -0,0 +1,6 @@
1
+ export declare function assertPublicUrl(rawUrl: string): Promise<URL>;
2
+ export declare function withTimeout<T>(task: Promise<T>, timeoutMs: number, label: string, options?: {
3
+ onTimeout?: () => void;
4
+ }): Promise<T>;
5
+ export declare function fetchTextWithRedirects(url: URL, redirectsLeft: number): Promise<Response>;
6
+ export declare function readResponseBody(response: Response, maxBytes: number): Promise<string>;
@@ -0,0 +1,5 @@
1
+ import type { WebSearchToolDeps } from "@/chat/tools/types";
2
+ export declare function createWebSearchTool(override?: WebSearchToolDeps): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
3
+ query: import("@sinclair/typebox").TString;
4
+ max_results: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
5
+ }>>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Canonical tag name for the runtime turn context block injected into Pi
3
+ * messages. Shared between prompt assembly and turn context stripping to keep
4
+ * both in sync without requiring the full prompt module.
5
+ */
6
+ export declare const TURN_CONTEXT_TAG = "runtime-turn-context";
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Structured token usage captured for a single agent turn.
3
+ *
4
+ * Mirrors the fields pi-ai emits on `AssistantMessage.usage` (see
5
+ * `@earendil-works/pi-ai` `Usage`) so diagnostics carry every counter the
6
+ * provider normalizes into the pi-ai shape as its own item. Renderers decide
7
+ * whether to display a breakdown or a single aggregate.
8
+ */
9
+ export interface AgentTurnUsage {
10
+ /** Non-cached input tokens; OTel `gen_ai.usage.input_tokens` adds cache counters back in. */
11
+ inputTokens?: number;
12
+ /** Output tokens; pi-ai folds reasoning tokens into this for providers that report them. */
13
+ outputTokens?: number;
14
+ /** Cached input tokens read from the provider's prompt cache. */
15
+ cachedInputTokens?: number;
16
+ /** Input tokens written into the provider's prompt cache. */
17
+ cacheCreationTokens?: number;
18
+ /** Provider-reported total. May not equal the sum of individual counters across providers. */
19
+ totalTokens?: number;
20
+ }
21
+ /** Return whether any token counter is present on a usage record. */
22
+ export declare function hasAgentTurnUsage(usage: AgentTurnUsage | undefined): usage is AgentTurnUsage;
23
+ /** Aggregate token usage across slices without double-counting provider totals. */
24
+ export declare function addAgentTurnUsage(...usages: Array<AgentTurnUsage | undefined>): AgentTurnUsage | undefined;