@sentry/junior 0.88.0 → 0.90.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 (158) hide show
  1. package/README.md +16 -5
  2. package/dist/{agent-hooks-RIJ5TSWP.js → agent-hooks-MXAF7RQL.js} +10 -10
  3. package/dist/api/people/list.js +8 -8
  4. package/dist/api/people/profile.js +8 -8
  5. package/dist/api-reference.d.ts +1 -1
  6. package/dist/app.js +716 -732
  7. package/dist/{catalog-runtime-MW7XERSU.js → catalog-runtime-DXE6NXHT.js} +5 -5
  8. package/dist/chat/agent/index.d.ts +4 -0
  9. package/dist/chat/agent/prompt.d.ts +78 -0
  10. package/dist/chat/{respond.d.ts → agent/request.d.ts} +98 -55
  11. package/dist/chat/agent/resume.d.ts +65 -0
  12. package/dist/chat/agent/sandbox.d.ts +15 -0
  13. package/dist/chat/agent/session.d.ts +20 -0
  14. package/dist/chat/agent/skills.d.ts +26 -0
  15. package/dist/chat/agent/tools.d.ts +78 -0
  16. package/dist/chat/agent-dispatch/runner.d.ts +3 -5
  17. package/dist/chat/app/production.d.ts +3 -1
  18. package/dist/chat/app/services.d.ts +1 -4
  19. package/dist/chat/logging.d.ts +2 -0
  20. package/dist/chat/mcp/tool-manager.d.ts +1 -6
  21. package/dist/chat/pi/messages.d.ts +18 -2
  22. package/dist/chat/pi/transcript.d.ts +31 -0
  23. package/dist/chat/plugins/agent-hooks.d.ts +2 -2
  24. package/dist/chat/prompt.d.ts +1 -1
  25. package/dist/chat/runtime/agent-continue-runner.d.ts +5 -5
  26. package/dist/chat/runtime/agent-run-outcome.d.ts +21 -0
  27. package/dist/chat/runtime/agent-runner.d.ts +11 -0
  28. package/dist/chat/runtime/delivered-turn-state.d.ts +2 -2
  29. package/dist/chat/runtime/generated-artifacts.d.ts +16 -0
  30. package/dist/chat/runtime/reply-executor.d.ts +2 -2
  31. package/dist/chat/runtime/slack-resume.d.ts +21 -12
  32. package/dist/chat/runtime/turn.d.ts +5 -39
  33. package/dist/chat/services/reply-delivery-plan.d.ts +0 -8
  34. package/dist/chat/services/turn-failure-response.d.ts +4 -4
  35. package/dist/chat/services/turn-result.d.ts +4 -7
  36. package/dist/chat/slack/channel.d.ts +9 -5
  37. package/dist/chat/slack/client.d.ts +3 -1
  38. package/dist/chat/slack/context.d.ts +17 -5
  39. package/dist/chat/slack/id-param.d.ts +25 -0
  40. package/dist/chat/slack/ids.d.ts +18 -4
  41. package/dist/chat/slack/outbound.d.ts +16 -0
  42. package/dist/chat/slack/output.d.ts +3 -3
  43. package/dist/chat/slack/reply.d.ts +4 -7
  44. package/dist/chat/slack/timestamp-param.d.ts +25 -0
  45. package/dist/chat/slack/tools/canvas/context.d.ts +18 -0
  46. package/dist/chat/slack/tools/canvas/create.d.ts +4 -0
  47. package/dist/chat/slack/tools/canvas/edit.d.ts +3 -0
  48. package/dist/chat/slack/tools/canvas/read.d.ts +6 -0
  49. package/dist/chat/slack/tools/canvas/write.d.ts +3 -0
  50. package/dist/chat/{tools/slack → slack/tools}/channel-access.d.ts +4 -3
  51. package/dist/chat/{tools → slack/tools}/channel-capabilities.d.ts +2 -0
  52. package/dist/chat/slack/tools/channel-list-messages.d.ts +3 -0
  53. package/dist/chat/{tools/slack → slack/tools}/context.d.ts +5 -4
  54. package/dist/chat/slack/tools/list/add-items.d.ts +3 -0
  55. package/dist/chat/{tools/slack/lists.d.ts → slack/tools/list/api.d.ts} +2 -1
  56. package/dist/chat/slack/tools/list/create.d.ts +3 -0
  57. package/dist/chat/slack/tools/list/get-items.d.ts +3 -0
  58. package/dist/chat/slack/tools/list/update-item.d.ts +3 -0
  59. package/dist/chat/slack/tools/message-add-reaction.d.ts +4 -0
  60. package/dist/chat/slack/tools/send-message.d.ts +11 -0
  61. package/dist/chat/{tools/slack → slack/tools}/slack-message-url.d.ts +5 -5
  62. package/dist/chat/slack/tools/thread-read.d.ts +6 -0
  63. package/dist/chat/slack/tools/user-lookup.d.ts +2 -0
  64. package/dist/chat/slack/users.d.ts +2 -1
  65. package/dist/chat/{services → slack}/vision-context.d.ts +4 -2
  66. package/dist/chat/state/session-log.d.ts +1 -1
  67. package/dist/chat/tool-exposure.d.ts +10 -0
  68. package/dist/chat/tool-support/catalog-tool-call.d.ts +10 -0
  69. package/dist/chat/{tools/execution → tool-support}/normalize-result.d.ts +4 -1
  70. package/dist/chat/{tools/agent-tools.d.ts → tool-support/pi-tool-adapter.d.ts} +3 -9
  71. package/dist/chat/tool-support/schema-summary.d.ts +2 -0
  72. package/dist/chat/{tools → tool-support}/skill/mcp-tool-summary.d.ts +0 -6
  73. package/dist/chat/tool-support/structured-result.d.ts +73 -0
  74. package/dist/chat/tool-support/text-range-result.d.ts +58 -0
  75. package/dist/chat/tool-support/tool-execution-report.d.ts +7 -0
  76. package/dist/chat/tool-support/zod-tool.d.ts +27 -0
  77. package/dist/chat/tools/advisor/tool.d.ts +9 -18
  78. package/dist/chat/tools/definition.d.ts +56 -9
  79. package/dist/chat/tools/execute-tool.d.ts +3 -0
  80. package/dist/chat/tools/index.d.ts +3 -2
  81. package/dist/chat/tools/resource-events.d.ts +3 -13
  82. package/dist/chat/tools/runtime/report-progress.d.ts +1 -3
  83. package/dist/chat/tools/sandbox/bash.d.ts +1 -4
  84. package/dist/chat/tools/sandbox/edit-file.d.ts +25 -7
  85. package/dist/chat/tools/sandbox/file-uploads.d.ts +30 -0
  86. package/dist/chat/tools/sandbox/file-utils.d.ts +10 -1
  87. package/dist/chat/tools/sandbox/find-files.d.ts +12 -11
  88. package/dist/chat/tools/sandbox/grep.d.ts +18 -12
  89. package/dist/chat/tools/sandbox/list-dir.d.ts +15 -7
  90. package/dist/chat/tools/sandbox/read-file.d.ts +2 -31
  91. package/dist/chat/tools/sandbox/write-file.d.ts +1 -4
  92. package/dist/chat/tools/search-tools.d.ts +4 -0
  93. package/dist/chat/tools/skill/call-mcp-tool.d.ts +1 -4
  94. package/dist/chat/tools/skill/load-skill.d.ts +4 -5
  95. package/dist/chat/tools/skill/search-mcp-tools.d.ts +1 -5
  96. package/dist/chat/tools/system-time.d.ts +1 -1
  97. package/dist/chat/tools/types.d.ts +15 -5
  98. package/dist/chat/tools/web/fetch-content.d.ts +4 -2
  99. package/dist/chat/tools/web/fetch-tool.d.ts +4 -4
  100. package/dist/chat/tools/web/image-generate.d.ts +4 -3
  101. package/dist/chat/tools/web/search.d.ts +1 -4
  102. package/dist/{chunk-4IXHIV37.js → chunk-2S7M37HY.js} +6 -8
  103. package/dist/{chunk-L7OHKDOX.js → chunk-3MPOMK3K.js} +58 -7
  104. package/dist/{chunk-V6XDCS3X.js → chunk-5GBUZI6M.js} +4 -4
  105. package/dist/{chunk-7ES37H6U.js → chunk-AN2437E3.js} +4 -4
  106. package/dist/chunk-AOISHLSF.js +747 -0
  107. package/dist/{chunk-NYJLQI42.js → chunk-BKSZL4QO.js} +11257 -11957
  108. package/dist/{chunk-XS6NLQPA.js → chunk-DACFZ5CI.js} +474 -33
  109. package/dist/chunk-GCWD2VHP.js +1216 -0
  110. package/dist/chunk-GHGPTPBL.js +53 -0
  111. package/dist/{chunk-S35CPNPT.js → chunk-HXL2ZV74.js} +40 -216
  112. package/dist/{chunk-PBV4ZIVM.js → chunk-IRRMABQD.js} +1 -1
  113. package/dist/{chunk-2DPZRS3B.js → chunk-IX76WFJV.js} +8 -8
  114. package/dist/{chunk-66NX7MNW.js → chunk-KC42JAAQ.js} +1 -1
  115. package/dist/chunk-LFLTJQVR.js +90 -0
  116. package/dist/{chunk-IATAYWFU.js → chunk-NW7AXDA5.js} +2 -2
  117. package/dist/{chunk-F22AM3OW.js → chunk-NYWPISSO.js} +1 -1
  118. package/dist/chunk-OB42YVAE.js +16 -0
  119. package/dist/chunk-ONFOWI2D.js +955 -0
  120. package/dist/chunk-PHZHJTCK.js +1062 -0
  121. package/dist/{chunk-6UPQ5GTJ.js → chunk-QCKGI74V.js} +7 -7
  122. package/dist/{chunk-YPAE5RH3.js → chunk-RS6ANWVT.js} +1 -1
  123. package/dist/{chunk-C5NCV3OB.js → chunk-TYUXD3FN.js} +1 -1
  124. package/dist/{chunk-KBFQXJL4.js → chunk-XP7F4LYB.js} +5 -7
  125. package/dist/{chunk-VMBZFPZM.js → chunk-ZUK7BL63.js} +187 -9
  126. package/dist/cli/chat.js +55 -40
  127. package/dist/cli/check.js +6 -6
  128. package/dist/cli/init.js +30 -36
  129. package/dist/cli/plugins.js +16 -16
  130. package/dist/cli/snapshot-warmup.js +9 -9
  131. package/dist/cli/upgrade.js +21 -21
  132. package/dist/db-CXI7PR5U.js +18 -0
  133. package/dist/handlers/agent-dispatch.d.ts +3 -3
  134. package/dist/handlers/mcp-oauth-callback.d.ts +3 -3
  135. package/dist/handlers/oauth-callback.d.ts +3 -3
  136. package/dist/instrumentation.js +6 -5
  137. package/dist/nitro.js +3 -7
  138. package/dist/reporting.js +23 -25
  139. package/dist/{runner-BCRF2FCI.js → runner-FKL3RAHA.js} +89 -77
  140. package/dist/{validation-FMJO3L5P.js → validation-I7GD2YWS.js} +6 -6
  141. package/package.json +6 -6
  142. package/dist/chat/respond-helpers.d.ts +0 -82
  143. package/dist/chat/services/attachment-claims.d.ts +0 -2
  144. package/dist/chat/services/channel-intent.d.ts +0 -2
  145. package/dist/chat/tools/sandbox/attach-file.d.ts +0 -7
  146. package/dist/chat/tools/slack/canvas-tools.d.ts +0 -30
  147. package/dist/chat/tools/slack/channel-list-messages.d.ts +0 -9
  148. package/dist/chat/tools/slack/channel-post-message.d.ts +0 -5
  149. package/dist/chat/tools/slack/list-tools.d.ts +0 -21
  150. package/dist/chat/tools/slack/message-add-reaction.d.ts +0 -5
  151. package/dist/chat/tools/slack/thread-read.d.ts +0 -12
  152. package/dist/chat/tools/slack/user-lookup.d.ts +0 -8
  153. package/dist/chunk-AHLSXMOU.js +0 -506
  154. package/dist/chunk-FTMXFBDC.js +0 -49
  155. package/dist/chunk-KBSLCOGE.js +0 -2226
  156. package/dist/chunk-KQKIA4CU.js +0 -186
  157. package/dist/db-37HOGLI7.js +0 -18
  158. /package/dist/chat/{tools/slack/canvases.d.ts → slack/tools/canvas/api.d.ts} +0 -0
@@ -1,17 +1,41 @@
1
1
  import { type SandboxFileSystem } from "@/chat/tools/sandbox/file-utils";
2
2
  import { type TextReplacement } from "@/chat/tools/sandbox/text-edits";
3
3
  type EditReplacement = TextReplacement;
4
+ type EditFailureKind = "not_found" | "old_text_not_found" | "old_text_not_unique" | "overlapping_edits" | "no_change" | "invalid_edit";
4
5
  interface EditFileResult {
5
6
  content: [{
6
7
  type: "text";
7
8
  text: string;
8
9
  }];
9
10
  details: {
11
+ data: {
12
+ diff: string;
13
+ first_changed_line?: number;
14
+ path: string;
15
+ replacements: number;
16
+ };
10
17
  diff: string;
11
18
  first_changed_line?: number;
12
19
  ok: true;
13
20
  path: string;
14
21
  replacements: number;
22
+ status: "success";
23
+ target: string;
24
+ } | {
25
+ data: {
26
+ path: string;
27
+ replacements: number;
28
+ };
29
+ error: {
30
+ kind: EditFailureKind;
31
+ message: string;
32
+ retryable: true;
33
+ };
34
+ ok: false;
35
+ path: string;
36
+ replacements: number;
37
+ status: "error";
38
+ target: string;
15
39
  };
16
40
  }
17
41
  interface EditFileInput {
@@ -27,11 +51,5 @@ export declare function editFile(params: {
27
51
  path: string;
28
52
  }): Promise<EditFileResult>;
29
53
  /** Create the sandbox edit tool definition exposed to the agent. */
30
- export declare function createEditFileTool(): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
31
- path: import("@sinclair/typebox").TString;
32
- edits: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
33
- oldText: import("@sinclair/typebox").TString;
34
- newText: import("@sinclair/typebox").TString;
35
- }>>;
36
- }>>;
54
+ export declare function createEditFileTool(): import("../definition").AnyToolDefinition;
37
55
  export {};
@@ -0,0 +1,30 @@
1
+ import type { SandboxWorkspace } from "@/chat/sandbox/workspace";
2
+ /** Maximum single file size accepted by model-facing upload tools. */
3
+ export declare const MAX_SANDBOX_FILE_UPLOAD_BYTES: number;
4
+ /** Sandbox directory for generated files that later tools can consume. */
5
+ export declare const SANDBOX_ARTIFACTS_DIR = "/tmp/junior/artifacts";
6
+ /** Materialized sandbox file data ready for outbound upload boundaries. */
7
+ export interface SandboxFileUpload {
8
+ bytes: number;
9
+ data: Buffer;
10
+ filename: string;
11
+ mimeType: string;
12
+ path: string;
13
+ }
14
+ /** Signal that a model-provided file path did not resolve in the active sandbox. */
15
+ export declare class SandboxFileNotFoundError extends Error {
16
+ readonly path: string;
17
+ constructor(path: string);
18
+ }
19
+ /** Resolve model-provided sandbox paths against the sandbox workspace root. */
20
+ export declare function normalizeSandboxPath(inputPath: string): string;
21
+ /** Return the canonical sandbox artifact path for generated files. */
22
+ export declare function sandboxArtifactPath(filename: string): string;
23
+ /** Infer upload MIME type from an explicit value or filename extension. */
24
+ export declare function inferMimeType(filename: string, explicitMimeType?: string): string;
25
+ /** Read and validate one sandbox file for Slack/file reply upload. */
26
+ export declare function readSandboxFileUpload(sandbox: SandboxWorkspace, input: {
27
+ path: string;
28
+ filename?: string;
29
+ mimeType?: string;
30
+ }): Promise<SandboxFileUpload>;
@@ -3,14 +3,23 @@ export type { SandboxFileSystem };
3
3
  export declare const MAX_TEXT_CHARS = 60000;
4
4
  export type TextSearchResultDetails = {
5
5
  ok: true;
6
+ status?: "success";
7
+ target?: string;
6
8
  path: string;
7
9
  truncated: boolean;
10
+ data?: unknown;
8
11
  } | {
9
12
  ok: false;
10
- error: "not_found";
13
+ status?: "error";
14
+ target?: string;
15
+ error: {
16
+ kind: "not_found";
17
+ message: string;
18
+ };
11
19
  path: string;
12
20
  missing_path?: string;
13
21
  truncated: false;
22
+ data?: unknown;
14
23
  };
15
24
  export interface TextSearchToolResult {
16
25
  content: [{
@@ -1,13 +1,18 @@
1
- import { type SandboxFileSystem, type TextSearchResultDetails } from "@/chat/tools/sandbox/file-utils";
2
- interface FindFilesResult {
3
- content: [{
4
- type: "text";
5
- text: string;
6
- }];
1
+ import { type SandboxFileSystem, type TextSearchResultDetails, type TextSearchToolResult } from "@/chat/tools/sandbox/file-utils";
2
+ import { type JuniorToolResultEnvelope } from "@/chat/tool-support/structured-result";
3
+ interface FindFilesSuccessResult {
4
+ content: JuniorToolResultEnvelope["content"];
7
5
  details: TextSearchResultDetails & {
6
+ data: {
7
+ files: string[];
8
+ file_count: number;
9
+ path: string;
10
+ truncation_reasons?: string[];
11
+ };
8
12
  result_limit_reached?: number;
9
13
  };
10
14
  }
15
+ type FindFilesResult = FindFilesSuccessResult | TextSearchToolResult;
11
16
  /** Find workspace files with structured limits instead of ad hoc shell output. */
12
17
  export declare function findFiles(params: {
13
18
  fs: SandboxFileSystem;
@@ -16,9 +21,5 @@ export declare function findFiles(params: {
16
21
  pattern: string;
17
22
  }): Promise<FindFilesResult>;
18
23
  /** 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 declare function createFindFilesTool(): import("../definition").AnyToolDefinition;
24
25
  export {};
@@ -1,14 +1,28 @@
1
- import { type SandboxFileSystem, type TextSearchResultDetails } from "@/chat/tools/sandbox/file-utils";
2
- interface GrepResult {
1
+ import { type SandboxFileSystem, type TextSearchResultDetails, type TextSearchToolResult } from "@/chat/tools/sandbox/file-utils";
2
+ interface GrepResultData {
3
+ context: number;
4
+ glob?: string;
5
+ line_count: number;
6
+ lines: string[];
7
+ match_count: number;
8
+ pattern: string;
9
+ path: string;
10
+ truncation_reasons?: string[];
11
+ }
12
+ interface GrepSuccessResult {
3
13
  content: [{
4
14
  type: "text";
5
15
  text: string;
6
16
  }];
7
- details: TextSearchResultDetails & {
17
+ details: Extract<TextSearchResultDetails, {
18
+ ok: true;
19
+ }> & {
20
+ data: GrepResultData;
8
21
  line_truncated?: boolean;
9
22
  match_limit_reached?: number;
10
23
  };
11
24
  }
25
+ type GrepResult = GrepSuccessResult | TextSearchToolResult;
12
26
  /** Search workspace file contents with bounded, line-numbered output. */
13
27
  export declare function grepFiles(params: {
14
28
  context?: unknown;
@@ -21,13 +35,5 @@ export declare function grepFiles(params: {
21
35
  pattern: string;
22
36
  }): Promise<GrepResult>;
23
37
  /** 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
- }>>;
38
+ export declare function createGrepTool(): import("../definition").AnyToolDefinition;
33
39
  export {};
@@ -1,13 +1,24 @@
1
- import { type SandboxFileSystem, type TextSearchResultDetails } from "@/chat/tools/sandbox/file-utils";
2
- interface ListDirResult {
1
+ import { type SandboxFileSystem, type TextSearchResultDetails, type TextSearchToolResult } from "@/chat/tools/sandbox/file-utils";
2
+ interface ListDirResultData {
3
+ entries: string[];
4
+ entry_count: number;
5
+ path: string;
6
+ total_entries: number;
7
+ truncation_reasons?: string[];
8
+ }
9
+ interface ListDirSuccessResult {
3
10
  content: [{
4
11
  type: "text";
5
12
  text: string;
6
13
  }];
7
- details: TextSearchResultDetails & {
14
+ details: Extract<TextSearchResultDetails, {
15
+ ok: true;
16
+ }> & {
17
+ data: ListDirResultData;
8
18
  entry_limit_reached?: number;
9
19
  };
10
20
  }
21
+ type ListDirResult = ListDirSuccessResult | TextSearchToolResult;
11
22
  /** List workspace directories without forcing the model through shell output. */
12
23
  export declare function listDir(params: {
13
24
  fs: SandboxFileSystem;
@@ -15,8 +26,5 @@ export declare function listDir(params: {
15
26
  path?: string;
16
27
  }): Promise<ListDirResult>;
17
28
  /** 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
- }>>;
29
+ export declare function createListDirTool(): import("../definition").AnyToolDefinition;
22
30
  export {};
@@ -1,32 +1,3 @@
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;
1
+ export { missingFileResult, sliceFileContent, } from "@/chat/tool-support/text-range-result";
26
2
  /** 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 {};
3
+ export declare function createReadFileTool(): import("../definition").AnyToolDefinition;
@@ -1,5 +1,2 @@
1
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
- }>>;
2
+ export declare function createWriteFileTool(): import("../definition").AnyToolDefinition;
@@ -0,0 +1,4 @@
1
+ import type { AnyToolDefinition } from "@/chat/tools/definition";
2
+ export declare const SEARCH_TOOLS_NAME = "searchTools";
3
+ /** Create the model-visible search tool for the executable tool catalog. */
4
+ export declare function createSearchToolsTool(catalogTools: Record<string, AnyToolDefinition>): AnyToolDefinition;
@@ -4,8 +4,5 @@ interface CallMcpToolManager {
4
4
  getResolvedActiveTools(): ManagedMcpTool[];
5
5
  }
6
6
  /** Create the stable dispatcher for active MCP provider tools. */
7
- export declare function createCallMcpToolTool(mcpToolManager: CallMcpToolManager): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
8
- tool_name: import("@sinclair/typebox").TString;
9
- arguments: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
10
- }>>;
7
+ export declare function createCallMcpToolTool(mcpToolManager: CallMcpToolManager): import("../definition").AnyToolDefinition;
11
8
  export {};
@@ -1,6 +1,7 @@
1
1
  import { type Skill, type SkillMetadata } from "@/chat/skills";
2
2
  export type LoadSkillResult = {
3
- ok?: boolean;
3
+ ok: boolean;
4
+ status: "error" | "success";
4
5
  error?: string;
5
6
  available_skills?: string[];
6
7
  skill_name?: string;
@@ -12,11 +13,9 @@ export type LoadSkillResult = {
12
13
  instructions?: string;
13
14
  mcp_provider?: string;
14
15
  available_tool_count?: number;
15
- };
16
+ } & Record<string, unknown>;
16
17
  export type LoadSkillMetadata = Pick<LoadSkillResult, "mcp_provider" | "available_tool_count">;
17
18
  /** Create the skill-loading tool that injects skill instructions and activates provider catalogs. */
18
19
  export declare function createLoadSkillTool(availableSkills: SkillMetadata[], options?: {
19
20
  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
- }>>;
21
+ }): import("../definition").AnyToolDefinition;
@@ -12,9 +12,5 @@ interface SearchMcpToolManager {
12
12
  getAvailableProviderCatalog(): ProviderSummary[];
13
13
  }
14
14
  /** Create the progressive MCP catalog search tool used before callMcpTool. */
15
- export declare function createSearchMcpToolsTool(mcpToolManager: SearchMcpToolManager): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
16
- query: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
17
- provider: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
18
- max_results: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
19
- }>>;
15
+ export declare function createSearchMcpToolsTool(mcpToolManager: SearchMcpToolManager): import("../definition").AnyToolDefinition;
20
16
  export {};
@@ -1 +1 @@
1
- export declare function createSystemTimeTool(): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{}>>;
1
+ export declare function createSystemTimeTool(): import("./definition").AnyToolDefinition;
@@ -7,6 +7,7 @@ import type { ThreadArtifactsState } from "@/chat/state/artifacts";
7
7
  import type { Skill } from "@/chat/skills";
8
8
  import type { LoadSkillMetadata } from "@/chat/tools/skill/load-skill";
9
9
  import type { AdvisorToolRuntimeContext } from "@/chat/tools/advisor/tool";
10
+ import type { JuniorToolResult } from "@/chat/tool-support/structured-result";
10
11
  import type { LocalRequester, Requester, SlackRequester } from "@/chat/requester";
11
12
  export interface ImageGenerateToolDeps {
12
13
  fetch?: typeof fetch;
@@ -15,18 +16,27 @@ export interface WebFetchToolDeps {
15
16
  execute?: (input: {
16
17
  url: string;
17
18
  max_chars?: number;
18
- }) => Promise<unknown> | unknown;
19
+ }) => Promise<JuniorToolResult> | JuniorToolResult;
19
20
  }
20
21
  export interface WebSearchToolDeps {
21
22
  execute?: (input: {
22
23
  query: string;
23
24
  max_results?: number;
24
- }) => Promise<unknown> | unknown;
25
+ }) => Promise<JuniorToolResult> | JuniorToolResult;
26
+ }
27
+ /** Sandbox file handle returned to the model after a generated artifact is written. */
28
+ export interface GeneratedArtifactFileRef {
29
+ bytes: number;
30
+ filename: string;
31
+ mimeType?: string;
32
+ path: string;
25
33
  }
26
34
  export interface ToolHooks {
27
- getGeneratedFile?: (filename: string) => FileUpload | undefined;
28
- onGeneratedArtifactFiles?: (files: FileUpload[]) => void;
29
- onGeneratedFiles?: (files: FileUpload[]) => void;
35
+ /**
36
+ * Materialize generated files and return sandbox paths that exist before the
37
+ * generating tool reports success.
38
+ */
39
+ writeGeneratedArtifacts?: (files: FileUpload[]) => GeneratedArtifactFileRef[] | Promise<GeneratedArtifactFileRef[]>;
30
40
  onArtifactStatePatch?: (patch: Partial<ThreadArtifactsState>) => void | Promise<void>;
31
41
  onSkillLoaded?: (skill: Skill) => void | LoadSkillMetadata | Promise<void | LoadSkillMetadata>;
32
42
  toolOverrides?: {
@@ -6,7 +6,9 @@ export interface WebFetchResponseContent {
6
6
  truncated: boolean;
7
7
  extractedChars: number;
8
8
  }
9
- export interface WebFetchResponse {
9
+ export type WebFetchResponse = {
10
+ ok: true;
11
+ status: "success";
10
12
  url: string;
11
13
  content: string;
12
14
  title?: string;
@@ -14,7 +16,7 @@ export interface WebFetchResponse {
14
16
  source_bytes: number;
15
17
  extracted_chars: number;
16
18
  truncated: boolean;
17
- }
19
+ } & Record<string, unknown>;
18
20
  /** Extract readable content and metadata from a fetched response body. */
19
21
  export declare function extractContentDetails(body: string, contentType: string, maxChars: number): WebFetchResponseContent;
20
22
  /** Extract readable content from a fetched response body, converting HTML to markdown. */
@@ -1,5 +1,5 @@
1
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
- }>>;
2
+ /** Create the fetch tool with delivery guidance scoped to active file-send capability. */
3
+ export declare function createWebFetchTool(hooks: ToolHooks, options?: {
4
+ canSendFilesToActiveConversation?: boolean;
5
+ }): import("../definition").AnyToolDefinition;
@@ -1,4 +1,5 @@
1
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
- }>>;
2
+ /** Create the image tool with sandbox artifact guidance matched to file-send capability. */
3
+ export declare function createImageGenerateTool(hooks: Required<Pick<ToolHooks, "writeGeneratedArtifacts">>, options?: {
4
+ canSendFilesToActiveConversation?: boolean;
5
+ }, deps?: ImageGenerateToolDeps): import("../definition").AnyToolDefinition;
@@ -1,5 +1,2 @@
1
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
- }>>;
2
+ export declare function createWebSearchTool(override?: WebSearchToolDeps): import("../definition").AnyToolDefinition;
@@ -1,16 +1,14 @@
1
+ import {
2
+ getChatConfig
3
+ } from "./chunk-HXL2ZV74.js";
1
4
  import {
2
5
  parseDestination,
3
6
  sameDestination
4
- } from "./chunk-AHLSXMOU.js";
5
- import {
6
- getChatConfig
7
- } from "./chunk-S35CPNPT.js";
7
+ } from "./chunk-GHGPTPBL.js";
8
8
  import {
9
+ normalizeIdentityEmail,
9
10
  parseStoredSlackRequester
10
- } from "./chunk-KQKIA4CU.js";
11
- import {
12
- normalizeIdentityEmail
13
- } from "./chunk-VMBZFPZM.js";
11
+ } from "./chunk-ZUK7BL63.js";
14
12
 
15
13
  // src/chat/conversations/sql/store.ts
16
14
  import { randomUUID as randomUUID2 } from "crypto";
@@ -1,12 +1,58 @@
1
1
  import {
2
2
  toOptionalString
3
- } from "./chunk-FTMXFBDC.js";
3
+ } from "./chunk-OB42YVAE.js";
4
+ import {
5
+ parseSlackChannelId,
6
+ parseSlackMessageTs,
7
+ parseSlackTeamId
8
+ } from "./chunk-LFLTJQVR.js";
4
9
 
5
10
  // src/chat/slack/context.ts
11
+ import { z } from "zod";
6
12
  function toTrimmedSlackString(value) {
7
13
  const normalized = toOptionalString(value);
8
14
  return normalized?.trim() || void 0;
9
15
  }
16
+ var slackMessageEnvelopeSchema = z.object({
17
+ raw: z.unknown().optional()
18
+ });
19
+ var rawSlackMessageSchema = z.object({
20
+ channel: z.unknown().optional(),
21
+ message: z.unknown().optional(),
22
+ team: z.unknown().optional(),
23
+ team_id: z.unknown().optional(),
24
+ thread_ts: z.unknown().optional(),
25
+ ts: z.unknown().optional(),
26
+ user_team: z.unknown().optional()
27
+ });
28
+ var nestedRawSlackMessageSchema = z.object({
29
+ ts: z.unknown().optional()
30
+ });
31
+ function readSlackRawMessageContext(message) {
32
+ const envelope = slackMessageEnvelopeSchema.safeParse(message);
33
+ if (!envelope.success) {
34
+ return void 0;
35
+ }
36
+ const raw = rawSlackMessageSchema.safeParse(envelope.data.raw);
37
+ if (!raw.success) {
38
+ return void 0;
39
+ }
40
+ const nestedMessage = nestedRawSlackMessageSchema.safeParse(raw.data.message);
41
+ const channelId = parseSlackChannelId(raw.data.channel);
42
+ const threadTs = parseSlackMessageTs(raw.data.thread_ts);
43
+ const messageTs = parseSlackMessageTs(raw.data.ts);
44
+ const nestedMessageTs = nestedMessage.success && parseSlackMessageTs(nestedMessage.data.ts);
45
+ const teamId = parseSlackTeamId(raw.data.team_id) ?? parseSlackTeamId(raw.data.team);
46
+ const authorTeamId = parseSlackTeamId(raw.data.user_team);
47
+ return {
48
+ ...channelId ? { channelId } : {},
49
+ ...threadTs ? { threadTs } : {},
50
+ ...messageTs ? { messageTs } : {},
51
+ ...nestedMessageTs ? { nestedMessageTs } : {},
52
+ ...teamId ? { teamId } : {},
53
+ ...authorTeamId ? { authorTeamId } : {}
54
+ };
55
+ }
10
56
  function parseSlackThreadId(threadId) {
11
57
  const normalizedThreadId = toTrimmedSlackString(threadId);
12
58
  if (!normalizedThreadId) {
@@ -16,8 +62,8 @@ function parseSlackThreadId(threadId) {
16
62
  if (parts.length !== 3 || parts[0] !== "slack") {
17
63
  return void 0;
18
64
  }
19
- const channelId = toTrimmedSlackString(parts[1]);
20
- const threadTs = toTrimmedSlackString(parts[2]);
65
+ const channelId = parseSlackChannelId(parts[1]);
66
+ const threadTs = parseSlackMessageTs(parts[2]);
21
67
  if (!channelId || !threadTs) {
22
68
  return void 0;
23
69
  }
@@ -27,7 +73,7 @@ function resolveSlackChannelIdFromThreadId(threadId) {
27
73
  return parseSlackThreadId(threadId)?.channelId;
28
74
  }
29
75
  function resolveSlackChannelIdFromMessage(message) {
30
- const messageChannelId = toTrimmedSlackString(
76
+ const messageChannelId = parseSlackChannelId(
31
77
  message.channelId
32
78
  );
33
79
  if (messageChannelId) {
@@ -35,7 +81,7 @@ function resolveSlackChannelIdFromMessage(message) {
35
81
  }
36
82
  const raw = message.raw;
37
83
  if (raw && typeof raw === "object") {
38
- const rawChannel = toTrimmedSlackString(
84
+ const rawChannel = parseSlackChannelId(
39
85
  raw.channel
40
86
  );
41
87
  if (rawChannel) {
@@ -58,11 +104,15 @@ function privateNarrowingFromChannelId(channelId) {
58
104
  return normalized.startsWith("D") || normalized.startsWith("G") ? "private" : void 0;
59
105
  }
60
106
  function privateNarrowingFromConversationId(conversationId) {
61
- if (!conversationId?.trim()) return void 0;
62
- const slackThread = parseSlackThreadId(conversationId);
107
+ const normalized = conversationId?.trim();
108
+ if (!normalized) return void 0;
109
+ const slackThread = parseSlackThreadId(normalized);
63
110
  if (slackThread) {
64
111
  return privateNarrowingFromChannelId(slackThread.channelId);
65
112
  }
113
+ if (normalized.startsWith("slack:")) {
114
+ return void 0;
115
+ }
66
116
  return "private";
67
117
  }
68
118
  function resolveConversationPrivacy(input) {
@@ -214,6 +264,7 @@ function toGenAiMessagesTraceAttributes(prefix, messages) {
214
264
  }
215
265
 
216
266
  export {
267
+ readSlackRawMessageContext,
217
268
  parseSlackThreadId,
218
269
  resolveSlackChannelIdFromThreadId,
219
270
  resolveSlackChannelIdFromMessage,
@@ -3,16 +3,16 @@ import {
3
3
  } from "./chunk-G3E7SCME.js";
4
4
  import {
5
5
  getStateAdapter
6
- } from "./chunk-YPAE5RH3.js";
6
+ } from "./chunk-RS6ANWVT.js";
7
7
  import {
8
8
  toOptionalTrimmed
9
- } from "./chunk-S35CPNPT.js";
9
+ } from "./chunk-HXL2ZV74.js";
10
10
  import {
11
11
  pluginCatalogRuntime
12
- } from "./chunk-KBFQXJL4.js";
12
+ } from "./chunk-XP7F4LYB.js";
13
13
  import {
14
14
  withSpan
15
- } from "./chunk-VMBZFPZM.js";
15
+ } from "./chunk-ZUK7BL63.js";
16
16
 
17
17
  // src/chat/sandbox/runtime-dependency-snapshots.ts
18
18
  import { createHash } from "crypto";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-KBFQXJL4.js";
3
+ } from "./chunk-XP7F4LYB.js";
4
+ import {
5
+ logWarn
6
+ } from "./chunk-ZUK7BL63.js";
4
7
  import {
5
8
  skillRoots
6
9
  } from "./chunk-6APU57E6.js";
7
- import {
8
- logWarn
9
- } from "./chunk-VMBZFPZM.js";
10
10
 
11
11
  // src/chat/skills.ts
12
12
  import fs from "fs/promises";