jazz-ai 0.1.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 (143) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +182 -0
  3. package/dist/cli/commands/auth.d.ts +18 -0
  4. package/dist/cli/commands/auth.d.ts.map +1 -0
  5. package/dist/cli/commands/auth.js +128 -0
  6. package/dist/cli/commands/auth.js.map +1 -0
  7. package/dist/cli/commands/chat-agent.d.ts +18 -0
  8. package/dist/cli/commands/chat-agent.d.ts.map +1 -0
  9. package/dist/cli/commands/chat-agent.js +421 -0
  10. package/dist/cli/commands/chat-agent.js.map +1 -0
  11. package/dist/cli/commands/edit-agent.d.ts +10 -0
  12. package/dist/cli/commands/edit-agent.d.ts.map +1 -0
  13. package/dist/cli/commands/edit-agent.js +310 -0
  14. package/dist/cli/commands/edit-agent.js.map +1 -0
  15. package/dist/cli/commands/task-agent.d.ts +126 -0
  16. package/dist/cli/commands/task-agent.d.ts.map +1 -0
  17. package/dist/cli/commands/task-agent.js +345 -0
  18. package/dist/cli/commands/task-agent.js.map +1 -0
  19. package/dist/core/agent/agent-prompt.d.ts +47 -0
  20. package/dist/core/agent/agent-prompt.d.ts.map +1 -0
  21. package/dist/core/agent/agent-prompt.js +146 -0
  22. package/dist/core/agent/agent-prompt.js.map +1 -0
  23. package/dist/core/agent/agent-runner.d.ts +63 -0
  24. package/dist/core/agent/agent-runner.d.ts.map +1 -0
  25. package/dist/core/agent/agent-runner.js +346 -0
  26. package/dist/core/agent/agent-runner.js.map +1 -0
  27. package/dist/core/agent/agent-service.d.ts +164 -0
  28. package/dist/core/agent/agent-service.d.ts.map +1 -0
  29. package/dist/core/agent/agent-service.js +463 -0
  30. package/dist/core/agent/agent-service.js.map +1 -0
  31. package/dist/core/agent/gmail-agent.d.ts +17 -0
  32. package/dist/core/agent/gmail-agent.d.ts.map +1 -0
  33. package/dist/core/agent/gmail-agent.js +191 -0
  34. package/dist/core/agent/gmail-agent.js.map +1 -0
  35. package/dist/core/agent/prompts/default/v1.d.ts +2 -0
  36. package/dist/core/agent/prompts/default/v1.d.ts.map +1 -0
  37. package/dist/core/agent/prompts/default/v1.js +202 -0
  38. package/dist/core/agent/prompts/default/v1.js.map +1 -0
  39. package/dist/core/agent/prompts/default/v2.d.ts +2 -0
  40. package/dist/core/agent/prompts/default/v2.d.ts.map +1 -0
  41. package/dist/core/agent/prompts/default/v2.js +72 -0
  42. package/dist/core/agent/prompts/default/v2.js.map +1 -0
  43. package/dist/core/agent/prompts/gmail/v1.d.ts +2 -0
  44. package/dist/core/agent/prompts/gmail/v1.d.ts.map +1 -0
  45. package/dist/core/agent/prompts/gmail/v1.js +206 -0
  46. package/dist/core/agent/prompts/gmail/v1.js.map +1 -0
  47. package/dist/core/agent/prompts/gmail/v2.d.ts +2 -0
  48. package/dist/core/agent/prompts/gmail/v2.d.ts.map +1 -0
  49. package/dist/core/agent/prompts/gmail/v2.js +59 -0
  50. package/dist/core/agent/prompts/gmail/v2.js.map +1 -0
  51. package/dist/core/agent/tools/base-tool.d.ts +161 -0
  52. package/dist/core/agent/tools/base-tool.d.ts.map +1 -0
  53. package/dist/core/agent/tools/base-tool.js +153 -0
  54. package/dist/core/agent/tools/base-tool.js.map +1 -0
  55. package/dist/core/agent/tools/fs-tools.d.ts +21 -0
  56. package/dist/core/agent/tools/fs-tools.d.ts.map +1 -0
  57. package/dist/core/agent/tools/fs-tools.js +1210 -0
  58. package/dist/core/agent/tools/fs-tools.js.map +1 -0
  59. package/dist/core/agent/tools/git-tools.d.ts +63 -0
  60. package/dist/core/agent/tools/git-tools.d.ts.map +1 -0
  61. package/dist/core/agent/tools/git-tools.js +600 -0
  62. package/dist/core/agent/tools/git-tools.js.map +1 -0
  63. package/dist/core/agent/tools/gmail-tools.d.ts +22 -0
  64. package/dist/core/agent/tools/gmail-tools.d.ts.map +1 -0
  65. package/dist/core/agent/tools/gmail-tools.js +779 -0
  66. package/dist/core/agent/tools/gmail-tools.js.map +1 -0
  67. package/dist/core/agent/tools/register-tools.d.ts +13 -0
  68. package/dist/core/agent/tools/register-tools.d.ts.map +1 -0
  69. package/dist/core/agent/tools/register-tools.js +169 -0
  70. package/dist/core/agent/tools/register-tools.js.map +1 -0
  71. package/dist/core/agent/tools/shell-tools.d.ts +19 -0
  72. package/dist/core/agent/tools/shell-tools.d.ts.map +1 -0
  73. package/dist/core/agent/tools/shell-tools.js +367 -0
  74. package/dist/core/agent/tools/shell-tools.js.map +1 -0
  75. package/dist/core/agent/tools/tool-registry.d.ts +62 -0
  76. package/dist/core/agent/tools/tool-registry.d.ts.map +1 -0
  77. package/dist/core/agent/tools/tool-registry.js +187 -0
  78. package/dist/core/agent/tools/tool-registry.js.map +1 -0
  79. package/dist/core/agent/tools/web-search-tools.d.ts +39 -0
  80. package/dist/core/agent/tools/web-search-tools.d.ts.map +1 -0
  81. package/dist/core/agent/tools/web-search-tools.js +220 -0
  82. package/dist/core/agent/tools/web-search-tools.js.map +1 -0
  83. package/dist/core/types/errors.d.ts +300 -0
  84. package/dist/core/types/errors.d.ts.map +1 -0
  85. package/dist/core/types/errors.js +115 -0
  86. package/dist/core/types/errors.js.map +1 -0
  87. package/dist/core/types/index.d.ts +208 -0
  88. package/dist/core/types/index.d.ts.map +1 -0
  89. package/dist/core/types/index.js +30 -0
  90. package/dist/core/types/index.js.map +1 -0
  91. package/dist/core/utils/error-handler.d.ts +114 -0
  92. package/dist/core/utils/error-handler.d.ts.map +1 -0
  93. package/dist/core/utils/error-handler.js +551 -0
  94. package/dist/core/utils/error-handler.js.map +1 -0
  95. package/dist/core/utils/markdown-renderer.d.ts +52 -0
  96. package/dist/core/utils/markdown-renderer.d.ts.map +1 -0
  97. package/dist/core/utils/markdown-renderer.js +134 -0
  98. package/dist/core/utils/markdown-renderer.js.map +1 -0
  99. package/dist/main.d.ts +3 -0
  100. package/dist/main.d.ts.map +1 -0
  101. package/dist/main.js +255 -0
  102. package/dist/main.js.map +1 -0
  103. package/dist/services/config.d.ts +29 -0
  104. package/dist/services/config.d.ts.map +1 -0
  105. package/dist/services/config.js +204 -0
  106. package/dist/services/config.js.map +1 -0
  107. package/dist/services/gmail.d.ts +197 -0
  108. package/dist/services/gmail.d.ts.map +1 -0
  109. package/dist/services/gmail.js +592 -0
  110. package/dist/services/gmail.js.map +1 -0
  111. package/dist/services/llm/ai-sdk-service.d.ts +5 -0
  112. package/dist/services/llm/ai-sdk-service.d.ts.map +1 -0
  113. package/dist/services/llm/ai-sdk-service.js +326 -0
  114. package/dist/services/llm/ai-sdk-service.js.map +1 -0
  115. package/dist/services/llm/context-manager.d.ts +51 -0
  116. package/dist/services/llm/context-manager.d.ts.map +1 -0
  117. package/dist/services/llm/context-manager.js +269 -0
  118. package/dist/services/llm/context-manager.js.map +1 -0
  119. package/dist/services/llm/types.d.ts +114 -0
  120. package/dist/services/llm/types.d.ts.map +1 -0
  121. package/dist/services/llm/types.js +51 -0
  122. package/dist/services/llm/types.js.map +1 -0
  123. package/dist/services/logger.d.ts +28 -0
  124. package/dist/services/logger.d.ts.map +1 -0
  125. package/dist/services/logger.js +267 -0
  126. package/dist/services/logger.js.map +1 -0
  127. package/dist/services/shell.d.ts +37 -0
  128. package/dist/services/shell.d.ts.map +1 -0
  129. package/dist/services/shell.js +197 -0
  130. package/dist/services/shell.js.map +1 -0
  131. package/dist/services/storage/file.d.ts +37 -0
  132. package/dist/services/storage/file.d.ts.map +1 -0
  133. package/dist/services/storage/file.js +221 -0
  134. package/dist/services/storage/file.js.map +1 -0
  135. package/dist/services/storage/inMemory.d.ts +25 -0
  136. package/dist/services/storage/inMemory.d.ts.map +1 -0
  137. package/dist/services/storage/inMemory.js +106 -0
  138. package/dist/services/storage/inMemory.js.map +1 -0
  139. package/dist/services/storage/service.d.ts +26 -0
  140. package/dist/services/storage/service.d.ts.map +1 -0
  141. package/dist/services/storage/service.js +48 -0
  142. package/dist/services/storage/service.js.map +1 -0
  143. package/package.json +92 -0
@@ -0,0 +1,206 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GMAIL_PROMPT_V1 = void 0;
4
+ exports.GMAIL_PROMPT_V1 = `
5
+ <agent_identity>
6
+ You are {agentName}, an AI assistant specialized in email management and Gmail operations.
7
+ {agentDescription}
8
+ </agent_identity>
9
+ <core_principles>
10
+ <goal>Execute email management tasks efficiently using Gmail API tools</goal>
11
+ <behaviors>
12
+
13
+ Parse email-related commands and map them to appropriate Gmail operations
14
+ Handle email searching, reading, organizing, and composition tasks
15
+ Manage labels, filters, and email organization efficiently
16
+ Execute batch operations when working with multiple emails
17
+ Provide clear email content and metadata in readable formats
18
+ </behaviors>
19
+
20
+ </core_principles>
21
+ <email_operations_framework>
22
+ <command_interpretation>
23
+ <email_queries>Parse search terms, date ranges, sender/recipient filters, and label criteria</email_queries>
24
+ <batch_operations>Identify when multiple emails need the same operation applied</batch_operations>
25
+ <label_management>Handle label creation, modification, application, and removal requests</label_management>
26
+ <composition_tasks>Extract recipients, subject, body content, and formatting requirements</composition_tasks>
27
+ </command_interpretation>
28
+ <execution_strategy>
29
+ <direct_retrieval>Execute email listing, searching, and reading operations immediately</direct_retrieval>
30
+ <sequential_processing>For multi-email operations, process emails in logical batches</sequential_processing>
31
+ <label_operations>Handle label management before applying labels to emails</label_operations>
32
+ <result_formatting>Present email data in clear, scannable formats with relevant metadata</result_formatting>
33
+ </execution_strategy>
34
+ <approval_workflow>
35
+ <approval_required>
36
+
37
+ Sending emails to external recipients
38
+ Deleting emails permanently (not trash)
39
+ Bulk deletion operations (>5 emails)
40
+ Creating or modifying important system labels
41
+ Batch operations affecting >10 emails
42
+ </approval_required>
43
+ <auto_execute>
44
+ Reading and listing emails
45
+ Searching email content
46
+ Moving emails to trash
47
+ Adding/removing labels
48
+ Creating custom labels
49
+ </auto_execute>
50
+ </approval_workflow>
51
+ </email_operations_framework>
52
+
53
+ <gmail_tool_categories>
54
+ <email_retrieval>
55
+ <tools>listEmails, getEmail, searchEmails</tools>
56
+ <best_practices>
57
+
58
+ Use appropriate filters to limit results to relevant emails
59
+ Format email lists with sender, subject, date, and labels for easy scanning
60
+ Present full email content with clear headers and body separation
61
+ Include message threading information when relevant
62
+ </best_practices>
63
+ <output_formatting>
64
+ Show email metadata (from, to, subject, date, labels) clearly
65
+ Format email bodies with proper line breaks and structure
66
+ Indicate unread status and importance markers
67
+ Display attachment information when present
68
+ </output_formatting>
69
+ </email_retrieval>
70
+
71
+ <email_organization>
72
+ <tools>addLabelsToEmail, removeLabelsFromEmail, batchModifyEmails, trashEmail</tools>
73
+ <best_practices>
74
+
75
+ Confirm label names exist before applying them
76
+ Use batch operations for multiple emails with same changes
77
+ Preserve important labels when reorganizing
78
+ Provide clear confirmation of organization changes
79
+ </best_practices>
80
+ <workflow_optimization>
81
+ Group similar labeling operations together
82
+ Apply labels before moving emails when both are needed
83
+ Use descriptive confirmation messages for batch operations
84
+ </workflow_optimization>
85
+ </email_organization>
86
+
87
+ <label_management>
88
+ <tools>listLabels, createLabel, updateLabel, deleteLabel</tools>
89
+ <best_practices>
90
+
91
+ Check for existing similar labels before creating new ones
92
+ Use clear, descriptive label names
93
+ Maintain label hierarchy and organization
94
+ Confirm label deletion impact on existing emails
95
+ </best_practices>
96
+ <safety_measures>
97
+ List existing labels when suggesting label operations
98
+ Warn about label deletion consequences
99
+ Suggest label renaming instead of delete/create when appropriate
100
+ </safety_measures>
101
+ </label_management>
102
+
103
+ <email_composition>
104
+ <tools>sendEmail</tools>
105
+ <best_practices>
106
+
107
+ Extract clear recipient lists (to, cc, bcc)
108
+ Generate appropriate subject lines when not provided
109
+ Format email body with proper structure and tone
110
+ Include necessary context and call-to-action items
111
+ </best_practices>
112
+ <approval_protocol>
113
+ Always request approval before sending emails
114
+ Display complete email content for review
115
+ Confirm recipient addresses are correct
116
+ Note any external or sensitive recipients
117
+ </approval_protocol>
118
+ </email_composition>
119
+
120
+ <email_deletion>
121
+ <tools>deleteEmail, trashEmail</tools>
122
+ <safety_measures>
123
+
124
+ Default to trash instead of permanent deletion
125
+ Require approval for permanent deletion
126
+ Confirm email identification before deletion
127
+ Warn about irreversible operations
128
+ </safety_measures>
129
+ <batch_handling>
130
+ Request approval for bulk deletion operations
131
+ Provide summary of emails to be deleted
132
+ Offer trash alternative for bulk operations
133
+ </batch_handling>
134
+ </email_deletion>
135
+ </gmail_tool_categories>
136
+
137
+ <communication_standards>
138
+ <operation_acknowledgment>
139
+ <action_confirmation>State what email operation you're performing</action_confirmation>
140
+ <tool_usage>Mention which Gmail tool you're using when relevant</tool_usage>
141
+ <result_summary>Provide clear summary of operation outcomes</result_summary>
142
+ </operation_acknowledgment>
143
+ <email_presentation>
144
+ <list_formatting>
145
+
146
+ Show emails in chronological order (newest first) unless specified
147
+ Include: sender, subject, date, labels, unread status
148
+ Use consistent formatting for easy scanning
149
+ Indicate email threading and conversation grouping
150
+ </list_formatting>
151
+ <content_display>
152
+ Separate email headers from body content clearly
153
+ Preserve important formatting while ensuring readability
154
+ Show attachment names and types
155
+ Indicate email importance and priority markers
156
+ </content_display>
157
+ <search_results>
158
+ Highlight matching terms in search results when possible
159
+ Show relevant context around matches
160
+ Group results by conversation when appropriate
161
+ Provide result counts and filtering information
162
+ </search_results>
163
+ </email_presentation>
164
+
165
+ <error_handling>
166
+ <common_issues>
167
+
168
+ Email not found: Suggest alternative search terms or criteria
169
+ Label conflicts: Show existing similar labels and suggest alternatives
170
+ Permission errors: Explain Gmail access limitations clearly
171
+ Rate limiting: Inform user about API restrictions and retry timing
172
+ </common_issues>
173
+ <recovery_strategies>
174
+ Offer alternative search approaches for failed queries
175
+ Suggest label alternatives when creation fails
176
+ Provide partial results when some operations succeed in batch
177
+ </recovery_strategies>
178
+ </error_handling>
179
+ </communication_standards>
180
+
181
+ <context_awareness>
182
+ <email_context>
183
+
184
+ Track conversation threads and related emails
185
+ Remember recent search criteria and commonly used labels
186
+ Understand user's email organization patterns
187
+ Maintain awareness of important contacts and domains
188
+ </email_context>
189
+
190
+ <user_preferences>
191
+
192
+ Learn from user's labeling and organization habits
193
+ Adapt to preferred email presentation formats
194
+ Remember frequently used search filters and criteria
195
+ Respect user's email management workflow
196
+ </user_preferences>
197
+ </context_awareness>
198
+
199
+ <tool_integration>
200
+ {toolInstructions}
201
+ </tool_integration>
202
+ <operational_notes>
203
+ You are an email management specialist that translates user requests into Gmail operations. Focus on efficient email retrieval, clear presentation of email data, and streamlined organization tasks. Execute commands directly while respecting approval workflows for sending and deletion operations. Present email information in formats that make it easy for users to quickly scan and identify relevant messages.
204
+ </operational_notes>
205
+ `;
206
+ //# sourceMappingURL=v1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v1.js","sourceRoot":"","sources":["../../../../../src/core/agent/prompts/gmail/v1.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyM9B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const GMAIL_PROMPT_V2 = "You are {agentName}, an AI assistant specialized in email management and Gmail operations.\n{agentDescription}\n\n## Current Context\n- **Current Date (ISO format):** {currentDate}\n- **System Information:** {systemInfo}\n- **User Information:** {userInfo}\n\n## Core Behavior\n- Parse email commands and execute appropriate Gmail operations\n- Handle searching, reading, organizing, and composing emails\n- Manage labels, filters, and batch operations efficiently\n- Present email data in clear, scannable formats\n\n## Approval Required\n- Sending emails to external recipients\n- Permanent email deletion (not trash)\n- Bulk deletion (>5 emails) or bulk operations (>10 emails)\n- Creating/modifying system labels\n\n## Auto-Execute\n- Reading, listing, and searching emails\n- Moving emails to trash\n- Adding/removing labels\n- Creating custom labels\n\n## Tool Operations\n\n### Email Retrieval\n**Tools:** listEmails, getEmail, searchEmails\n- Use appropriate filters to limit results\n- Format lists: sender, subject, date, labels, unread status\n- Show newest first unless specified\n- Display full content when requested\n\n### Email Management\n**Tools:** trashEmail, deleteEmail, batchModifyEmails\n- Use trashEmail for safer removal (recoverable)\n- Use deleteEmail only for permanent deletion\n- Batch operations for efficiency with multiple emails\n\n### Label Management\n**Tools:** listLabels, createLabel, updateLabel, deleteLabel, addLabelsToEmail, removeLabelsFromEmail\n- Create descriptive label names\n- Use colors and visibility settings appropriately\n- Apply labels systematically\n\n### Email Composition\n**Tools:** sendEmail\n- Draft emails with clear subject lines\n- Include all necessary recipients\n- Format content appropriately\n\nAlways ask for approval before sending emails or performing destructive operations.\n";
2
+ //# sourceMappingURL=v2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v2.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/prompts/gmail/v2.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,g0DAsD3B,CAAC"}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GMAIL_PROMPT_V2 = void 0;
4
+ exports.GMAIL_PROMPT_V2 = `You are {agentName}, an AI assistant specialized in email management and Gmail operations.
5
+ {agentDescription}
6
+
7
+ ## Current Context
8
+ - **Current Date (ISO format):** {currentDate}
9
+ - **System Information:** {systemInfo}
10
+ - **User Information:** {userInfo}
11
+
12
+ ## Core Behavior
13
+ - Parse email commands and execute appropriate Gmail operations
14
+ - Handle searching, reading, organizing, and composing emails
15
+ - Manage labels, filters, and batch operations efficiently
16
+ - Present email data in clear, scannable formats
17
+
18
+ ## Approval Required
19
+ - Sending emails to external recipients
20
+ - Permanent email deletion (not trash)
21
+ - Bulk deletion (>5 emails) or bulk operations (>10 emails)
22
+ - Creating/modifying system labels
23
+
24
+ ## Auto-Execute
25
+ - Reading, listing, and searching emails
26
+ - Moving emails to trash
27
+ - Adding/removing labels
28
+ - Creating custom labels
29
+
30
+ ## Tool Operations
31
+
32
+ ### Email Retrieval
33
+ **Tools:** listEmails, getEmail, searchEmails
34
+ - Use appropriate filters to limit results
35
+ - Format lists: sender, subject, date, labels, unread status
36
+ - Show newest first unless specified
37
+ - Display full content when requested
38
+
39
+ ### Email Management
40
+ **Tools:** trashEmail, deleteEmail, batchModifyEmails
41
+ - Use trashEmail for safer removal (recoverable)
42
+ - Use deleteEmail only for permanent deletion
43
+ - Batch operations for efficiency with multiple emails
44
+
45
+ ### Label Management
46
+ **Tools:** listLabels, createLabel, updateLabel, deleteLabel, addLabelsToEmail, removeLabelsFromEmail
47
+ - Create descriptive label names
48
+ - Use colors and visibility settings appropriately
49
+ - Apply labels systematically
50
+
51
+ ### Email Composition
52
+ **Tools:** sendEmail
53
+ - Draft emails with clear subject lines
54
+ - Include all necessary recipients
55
+ - Format content appropriately
56
+
57
+ Always ask for approval before sending emails or performing destructive operations.
58
+ `;
59
+ //# sourceMappingURL=v2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v2.js","sourceRoot":"","sources":["../../../../../src/core/agent/prompts/gmail/v2.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsD9B,CAAC"}
@@ -0,0 +1,161 @@
1
+ import { Effect } from "effect";
2
+ import { z } from "zod";
3
+ import { type Tool, type ToolExecutionContext, type ToolExecutionResult } from "./tool-registry";
4
+ /**
5
+ * Lightweight, reusable tool builder with optional runtime validation.
6
+ * Keeps JSON Schema as-is for LLMs and applies a simple validator at runtime.
7
+ */
8
+ export interface ToolValidatorResult<Args extends Record<string, unknown>> {
9
+ readonly valid: boolean;
10
+ readonly value?: Args;
11
+ readonly errors?: readonly string[];
12
+ }
13
+ export type ToolValidator<Args extends Record<string, unknown>> = (args: Record<string, unknown>) => ToolValidatorResult<Args>;
14
+ export interface BaseToolConfig<R, Args extends Record<string, unknown>> {
15
+ readonly name: string;
16
+ readonly description: string;
17
+ readonly parameters: z.ZodTypeAny;
18
+ /** If true, hide this tool from UI listings while keeping it callable. */
19
+ readonly hidden?: boolean;
20
+ /**
21
+ * Optional function to validate the tool arguments before execution.
22
+ *
23
+ * This validator runs after the LLM provides arguments but before the handler
24
+ * is called. It provides runtime type checking and custom validation logic
25
+ * beyond what JSON Schema can express. The validator should return a result
26
+ * indicating whether the arguments are valid and provide any error messages
27
+ * for invalid inputs.
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * validate: (args) => {
32
+ * if (args.email && !args.email.includes('@')) {
33
+ * return { valid: false, errors: ['Invalid email format'] };
34
+ * }
35
+ * return { valid: true, value: args };
36
+ * }
37
+ * ```
38
+ */
39
+ readonly validate?: ToolValidator<Args>;
40
+ /**
41
+ * Optional approval requirement for destructive tools.
42
+ * If provided, the tool will ALWAYS show the approval message and require user confirmation.
43
+ * The LLM cannot bypass this by setting any field - it must ask the user for confirmation.
44
+ */
45
+ readonly approval?: {
46
+ /**
47
+ * Create a human-readable message explaining what will happen.
48
+ * Used to guide the agent to ask the user for confirmation.
49
+ * Can be async to fetch additional context (like email details).
50
+ */
51
+ readonly message: (args: Args, context: ToolExecutionContext) => Effect.Effect<string, Error, R>;
52
+ /**
53
+ * Custom error message when approval is required. Defaults to generic message.
54
+ */
55
+ readonly errorMessage?: string;
56
+ /**
57
+ * Optional execution callback that defines which tool to call on user approval
58
+ * and how to build its arguments from the validated input.
59
+ */
60
+ readonly execute?: {
61
+ readonly toolName: string;
62
+ readonly buildArgs: (args: Args) => Record<string, unknown>;
63
+ };
64
+ };
65
+ /**
66
+ * The main function that handles the tool execution logic.
67
+ *
68
+ * This is the core implementation of the tool that performs the actual work.
69
+ * It receives validated arguments and execution context, and returns an Effect
70
+ * that represents the asynchronous operation. The handler should handle all
71
+ * business logic, external API calls, file operations, or other side effects
72
+ * required by the tool.
73
+ *
74
+ * The function must return a ToolExecutionResult that indicates success or failure,
75
+ * along with any relevant data or error messages. All side effects should be
76
+ * wrapped in Effect to ensure proper error handling and resource management.
77
+ *
78
+ * @param args - The validated arguments passed to the tool
79
+ * @param context - The execution context containing environment, logger, and other services
80
+ * @returns An Effect that resolves to a ToolExecutionResult
81
+ *
82
+ * @example
83
+ * ```typescript
84
+ * handler: (args, context) => Effect.gen(function* () {
85
+ * const logger = yield* context.logger;
86
+ * yield* logger.info(`Processing request: ${args.id}`);
87
+ *
88
+ * const result = yield* processRequest(args);
89
+ * return { success: true, result };
90
+ * })
91
+ * ```
92
+ */
93
+ readonly handler: (args: Args, context: ToolExecutionContext) => Effect.Effect<ToolExecutionResult, Error, R>;
94
+ /**
95
+ * Optional function to create a human-readable summary of the tool execution result.
96
+ *
97
+ * This function is called after the tool execution completes successfully and is used
98
+ * to generate a concise, user-friendly summary of what the tool accomplished. The
99
+ * summary is typically displayed to the user or logged for audit purposes. If not
100
+ * provided, a default summary will be generated based on the tool name and success status.
101
+ *
102
+ * The function receives the complete ToolExecutionResult and should return a string
103
+ * that clearly describes the outcome. Return undefined to use the default summary
104
+ * generation logic.
105
+ *
106
+ * @param result - The complete execution result from the tool handler
107
+ * @returns A human-readable summary string, or undefined to use default summary
108
+ *
109
+ * @example
110
+ * ```typescript
111
+ * createSummary: (result) => {
112
+ * if (result.success && result.result) {
113
+ * return `Successfully processed ${result.result.count} items`;
114
+ * }
115
+ * return `Tool execution ${result.success ? 'succeeded' : 'failed'}`;
116
+ * }
117
+ * ```
118
+ */
119
+ readonly createSummary?: (result: ToolExecutionResult) => string | undefined;
120
+ }
121
+ /**
122
+ * Define a new tool with validation and approval capabilities
123
+ *
124
+ * Creates a tool from the provided configuration, including optional validation
125
+ * and approval requirements. The tool can be configured to require user approval
126
+ * for destructive operations and includes comprehensive argument validation.
127
+ *
128
+ * @param config - The tool configuration including name, description, parameters, validation, and approval settings
129
+ * @returns A Tool object that can be registered and executed
130
+ *
131
+ * @example
132
+ * ```typescript
133
+ * const emailTool = defineTool({
134
+ * name: "send_email",
135
+ * description: "Send an email to a recipient",
136
+ * parameters: {
137
+ * to: { type: "string", description: "Recipient email address" },
138
+ * subject: { type: "string", description: "Email subject" }
139
+ * },
140
+ * handler: async (args, context) => {
141
+ * // Tool implementation
142
+ * return { success: true, result: "Email sent" };
143
+ * }
144
+ * });
145
+ * ```
146
+ */
147
+ export declare function defineTool<R, Args extends Record<string, unknown>>(config: BaseToolConfig<R, Args>): Tool<R>;
148
+ /**
149
+ * Build a minimal runtime validator from a JSON Schema subset.
150
+ * Supports: type = string|number|boolean|array(object: items.type), required[], additionalProperties.
151
+ */
152
+ export declare function makeJsonSchemaValidator<Args extends Record<string, unknown>>(schema: Record<string, unknown>): ToolValidator<Args>;
153
+ /**
154
+ * Utility to extend a JSON schema object with a standard approval boolean field.
155
+ * This does not mutate the original schema object.
156
+ */
157
+ export declare function withApprovalBoolean(schema: z.ZodTypeAny, options?: {
158
+ fieldName?: string;
159
+ description?: string;
160
+ }): z.ZodTypeAny;
161
+ //# sourceMappingURL=base-tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-tool.d.ts","sourceRoot":"","sources":["../../../../src/core/agent/tools/base-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,oBAAoB,EAAE,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEjG;;;GAGG;AAEH,MAAM,WAAW,mBAAmB,CAAC,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACvE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAED,MAAM,MAAM,aAAa,CAAC,IAAI,SAAS,MAAM,CAAC,M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AClD;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,MAAM,GAAG,SAAS,CAAC;CAC9E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChE,MAAM,EAAE,cAAc,CAAC,CAAC,EAAE,IAAI,CAAC,GAC9B,IAAI,CAAC,CAAC,CAAC,CAmDT;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1E,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,aAAa,CAAC,IAAI,CAAC,CA+DrB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,CAAC,CAAC,UAAU,EACpB,OAAO,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GACrD,CAAC,CAAC,UAAU,CAYd"}
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defineTool = defineTool;
4
+ exports.makeJsonSchemaValidator = makeJsonSchemaValidator;
5
+ exports.withApprovalBoolean = withApprovalBoolean;
6
+ const effect_1 = require("effect");
7
+ const zod_1 = require("zod");
8
+ /**
9
+ * Define a new tool with validation and approval capabilities
10
+ *
11
+ * Creates a tool from the provided configuration, including optional validation
12
+ * and approval requirements. The tool can be configured to require user approval
13
+ * for destructive operations and includes comprehensive argument validation.
14
+ *
15
+ * @param config - The tool configuration including name, description, parameters, validation, and approval settings
16
+ * @returns A Tool object that can be registered and executed
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * const emailTool = defineTool({
21
+ * name: "send_email",
22
+ * description: "Send an email to a recipient",
23
+ * parameters: {
24
+ * to: { type: "string", description: "Recipient email address" },
25
+ * subject: { type: "string", description: "Email subject" }
26
+ * },
27
+ * handler: async (args, context) => {
28
+ * // Tool implementation
29
+ * return { success: true, result: "Email sent" };
30
+ * }
31
+ * });
32
+ * ```
33
+ */
34
+ function defineTool(config) {
35
+ return {
36
+ name: config.name,
37
+ description: config.description,
38
+ parameters: config.parameters,
39
+ hidden: config.hidden === true,
40
+ createSummary: config.createSummary,
41
+ execute(args, context) {
42
+ if (config.validate) {
43
+ const result = config.validate(args);
44
+ if (!result.valid) {
45
+ const message = (result.errors || ["Invalid arguments"]).join("; ");
46
+ return effect_1.Effect.succeed({ success: false, result: null, error: message });
47
+ }
48
+ const validated = result.value;
49
+ // Enforce approval if configured
50
+ if (config.approval) {
51
+ // Return an approval request payload
52
+ return effect_1.Effect.gen(function* () {
53
+ const approval = config.approval;
54
+ const approvalMessage = yield* approval.message(validated, context);
55
+ const execute = approval.execute;
56
+ return {
57
+ success: false,
58
+ result: {
59
+ approvalRequired: true,
60
+ message: approvalMessage,
61
+ ...(execute
62
+ ? {
63
+ instruction: `Please ask the user for confirmation. If they confirm, call this tool again with { "confirm": true } or call: ${execute.toolName} with these exact arguments: ${JSON.stringify(execute.buildArgs(validated))}`,
64
+ executeToolName: execute.toolName,
65
+ executeArgs: execute.buildArgs(validated),
66
+ }
67
+ : {}),
68
+ },
69
+ error: approval.errorMessage ??
70
+ "Approval required: This action requires user confirmation.",
71
+ };
72
+ });
73
+ }
74
+ return config.handler(validated, context);
75
+ }
76
+ // No validation configured; pass through
77
+ return config.handler(args, context);
78
+ },
79
+ };
80
+ }
81
+ /**
82
+ * Build a minimal runtime validator from a JSON Schema subset.
83
+ * Supports: type = string|number|boolean|array(object: items.type), required[], additionalProperties.
84
+ */
85
+ function makeJsonSchemaValidator(schema) {
86
+ return (args) => {
87
+ const errors = [];
88
+ const s = schema;
89
+ if (s.type !== undefined && s.type !== "object") {
90
+ errors.push("Root schema.type must be 'object'");
91
+ }
92
+ const properties = (s.properties || {});
93
+ const required = new Set((s.required || []));
94
+ for (const key of required) {
95
+ if (!(key in args)) {
96
+ errors.push(`Missing required property: ${key}`);
97
+ }
98
+ }
99
+ for (const [key, value] of Object.entries(args)) {
100
+ const prop = properties[key];
101
+ if (!prop) {
102
+ if (s.additionalProperties === false) {
103
+ errors.push(`Unknown property: ${key}`);
104
+ }
105
+ continue;
106
+ }
107
+ const expected = prop.type;
108
+ if (!expected)
109
+ continue;
110
+ const actual = typeof value;
111
+ if (expected === "array") {
112
+ if (!Array.isArray(value)) {
113
+ errors.push(`Property '${key}' expected array, got ${actual}`);
114
+ }
115
+ else {
116
+ const itemType = prop.items?.type;
117
+ if (itemType) {
118
+ for (let i = 0; i < value.length; i++) {
119
+ const t = typeof value[i];
120
+ if (t !== itemType) {
121
+ errors.push(`Property '${key}[${i}]' expected ${itemType}, got ${t}`);
122
+ }
123
+ }
124
+ }
125
+ }
126
+ }
127
+ else if (actual !== expected) {
128
+ errors.push(`Property '${key}' expected ${expected}, got ${actual}`);
129
+ }
130
+ }
131
+ if (errors.length > 0) {
132
+ return { valid: false, errors };
133
+ }
134
+ return { valid: true, value: args };
135
+ };
136
+ }
137
+ /**
138
+ * Utility to extend a JSON schema object with a standard approval boolean field.
139
+ * This does not mutate the original schema object.
140
+ */
141
+ function withApprovalBoolean(schema, options) {
142
+ const fieldName = options?.fieldName ?? "confirm";
143
+ const description = options?.description ?? "Set to true to confirm this action.";
144
+ // If provided a Zod object, extend it in-place with a boolean confirm field
145
+ if (schema instanceof zod_1.z.ZodObject) {
146
+ return schema.extend({
147
+ [fieldName]: zod_1.z.boolean().describe(description),
148
+ });
149
+ }
150
+ // If it's some other Zod type, intersect with an object carrying confirm
151
+ return zod_1.z.object({ [fieldName]: zod_1.z.boolean().describe(description) }).and(schema);
152
+ }
153
+ //# sourceMappingURL=base-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-tool.js","sourceRoot":"","sources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AAQ,SAAS,CAAC,EAAE,CAAC,CAAC;4BACxE,CAAC;wBACH,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;iBAAM,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;gBAC/B,MAAM,CAAC,IAAI,CAAC,aAAa,GAAG,cAAc,QAAQ,SAAS,MAAM,EAAE,CAAC,CAAC;YACvE,CAAC;QACH,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAW,CAAC;QAC3C,CAAC;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAY,EAAW,CAAC;IACvD,CAAC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAgB,mBAAmB,CACjC,MAAoB,EACpB,OAAsD;IAEtD,MAAM,SAAS,GAAG,OAAO,EAAE,SAAS,IAAI,SAAS,CAAC;IAClD,MAAM,WAAW,GAAG,OAAO,EAAE,WAAW,IAAI,qCAAqC,CAAC;IAElF,4EAA4E;IAC5E,IAAI,MAAM,YAAY,OAAC,CAAC,SAAS,EAAE,CAAC;QAClC,OAAO,MAAM,CAAC,MAAM,CAAC;YACnB,CAAC,SAAS,CAAC,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC;SAC/C,CAAC,CAAC;IACL,CAAC;IACD,yEAAyE;IACzE,OAAO,OAAC,CAAC,MAAM,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAClF,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { FileSystem } from "@effect/platform";
2
+ import { Effect } from "effect";
3
+ import { type FileSystemContextService } from "../../../services/shell";
4
+ import { type Tool } from "./tool-registry";
5
+ export declare function createFindPathTool(): Tool<FileSystem.FileSystem | FileSystemContextService>;
6
+ export declare function createPwdTool(): Tool<FileSystemContextService>;
7
+ export declare function createLsTool(): Tool<FileSystem.FileSystem | FileSystemContextService>;
8
+ export declare function createCdTool(): Tool<FileSystem.FileSystem | FileSystemContextService>;
9
+ export declare function createReadFileTool(): Tool<FileSystem.FileSystem | FileSystemContextService>;
10
+ export declare function createWriteFileTool(): Tool<FileSystem.FileSystem | FileSystemContextService>;
11
+ export declare function createExecuteWriteFileTool(): Tool<FileSystem.FileSystem | FileSystemContextService>;
12
+ export declare function createGrepTool(): Tool<FileSystem.FileSystem | FileSystemContextService>;
13
+ export declare function createFindTool(): Tool<FileSystem.FileSystem | FileSystemContextService>;
14
+ export declare function createMkdirTool(): Tool<FileSystem.FileSystem | FileSystemContextService>;
15
+ export declare function createExecuteMkdirTool(): Tool<FileSystem.FileSystem | FileSystemContextService>;
16
+ export declare function createStatTool(): Tool<FileSystem.FileSystem | FileSystemContextService>;
17
+ export declare function createRmTool(): Tool<FileSystem.FileSystem | FileSystemContextService>;
18
+ export declare function createExecuteRmTool(): Tool<FileSystem.FileSystem | FileSystemContextService>;
19
+ export declare function createFindDirTool(): Tool<FileSystem.FileSystem | FileSystemContextService>;
20
+ export declare function registerFileTools(): Effect.Effect<void, Error, FileSystem.FileSystem>;
21
+ //# sourceMappingURL=fs-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs-tools.d.ts","sourceRoot":"","sources":["../../../../src/core/agent/tools/fs-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EACL,KAAK,wBAAwB,EAE9B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,KAAK,IAAI,EAA6B,MAAM,iBAAiB,CAAC;AAoCvE,wBAAgB,kBAAkB,IAAI,IAAI,CAAC,UAAU,CAAC,UAAU,GAAG,wB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