beth-copilot 1.0.17 → 1.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 (265) hide show
  1. package/CHANGELOG.md +41 -28
  2. package/README.md +87 -247
  3. package/bin/cli.js +115 -7
  4. package/dist/__tests__/smoke.test.d.ts +8 -0
  5. package/dist/__tests__/smoke.test.d.ts.map +1 -0
  6. package/dist/__tests__/smoke.test.js +49 -0
  7. package/dist/__tests__/smoke.test.js.map +1 -0
  8. package/dist/cli/commands/beads.e2e.test.d.ts +13 -0
  9. package/dist/cli/commands/beads.e2e.test.d.ts.map +1 -0
  10. package/dist/cli/commands/beads.e2e.test.js +526 -0
  11. package/dist/cli/commands/beads.e2e.test.js.map +1 -0
  12. package/dist/cli/commands/cli-edge-cases.e2e.test.d.ts +32 -0
  13. package/dist/cli/commands/cli-edge-cases.e2e.test.d.ts.map +1 -0
  14. package/dist/cli/commands/cli-edge-cases.e2e.test.js +162 -0
  15. package/dist/cli/commands/cli-edge-cases.e2e.test.js.map +1 -0
  16. package/dist/cli/commands/close.d.ts +89 -0
  17. package/dist/cli/commands/close.d.ts.map +1 -0
  18. package/dist/cli/commands/close.e2e.test.d.ts +27 -0
  19. package/dist/cli/commands/close.e2e.test.d.ts.map +1 -0
  20. package/dist/cli/commands/close.e2e.test.js +252 -0
  21. package/dist/cli/commands/close.e2e.test.js.map +1 -0
  22. package/dist/cli/commands/close.js +309 -0
  23. package/dist/cli/commands/close.js.map +1 -0
  24. package/dist/cli/commands/close.test.d.ts +15 -0
  25. package/dist/cli/commands/close.test.d.ts.map +1 -0
  26. package/dist/cli/commands/close.test.js +634 -0
  27. package/dist/cli/commands/close.test.js.map +1 -0
  28. package/dist/cli/commands/doctor.d.ts +23 -0
  29. package/dist/cli/commands/doctor.d.ts.map +1 -1
  30. package/dist/cli/commands/doctor.js +93 -0
  31. package/dist/cli/commands/doctor.js.map +1 -1
  32. package/dist/cli/commands/doctor.test.js +209 -0
  33. package/dist/cli/commands/doctor.test.js.map +1 -1
  34. package/dist/cli/commands/framework-isolation.test.d.ts +30 -0
  35. package/dist/cli/commands/framework-isolation.test.d.ts.map +1 -0
  36. package/dist/cli/commands/framework-isolation.test.js +119 -0
  37. package/dist/cli/commands/framework-isolation.test.js.map +1 -0
  38. package/dist/cli/commands/init-logic.e2e.test.d.ts +37 -0
  39. package/dist/cli/commands/init-logic.e2e.test.d.ts.map +1 -0
  40. package/dist/cli/commands/init-logic.e2e.test.js +305 -0
  41. package/dist/cli/commands/init-logic.e2e.test.js.map +1 -0
  42. package/dist/cli/commands/land.d.ts +142 -0
  43. package/dist/cli/commands/land.d.ts.map +1 -0
  44. package/dist/cli/commands/land.js +647 -0
  45. package/dist/cli/commands/land.js.map +1 -0
  46. package/dist/cli/commands/land.test.d.ts +20 -0
  47. package/dist/cli/commands/land.test.d.ts.map +1 -0
  48. package/dist/cli/commands/land.test.js +622 -0
  49. package/dist/cli/commands/land.test.js.map +1 -0
  50. package/dist/cli/commands/pipeline.e2e.test.js +1 -1
  51. package/dist/cli/commands/pipeline.e2e.test.js.map +1 -1
  52. package/dist/cli/commands/pre-push-guard.d.ts +84 -0
  53. package/dist/cli/commands/pre-push-guard.d.ts.map +1 -0
  54. package/dist/cli/commands/pre-push-guard.e2e.test.d.ts +24 -0
  55. package/dist/cli/commands/pre-push-guard.e2e.test.d.ts.map +1 -0
  56. package/dist/cli/commands/pre-push-guard.e2e.test.js +171 -0
  57. package/dist/cli/commands/pre-push-guard.e2e.test.js.map +1 -0
  58. package/dist/cli/commands/pre-push-guard.js +257 -0
  59. package/dist/cli/commands/pre-push-guard.js.map +1 -0
  60. package/dist/cli/commands/pre-push-guard.test.d.ts +15 -0
  61. package/dist/cli/commands/pre-push-guard.test.d.ts.map +1 -0
  62. package/dist/cli/commands/pre-push-guard.test.js +397 -0
  63. package/dist/cli/commands/pre-push-guard.test.js.map +1 -0
  64. package/dist/cli/commands/quickstart-expanded.e2e.test.d.ts +23 -0
  65. package/dist/cli/commands/quickstart-expanded.e2e.test.d.ts.map +1 -0
  66. package/dist/cli/commands/quickstart-expanded.e2e.test.js +179 -0
  67. package/dist/cli/commands/quickstart-expanded.e2e.test.js.map +1 -0
  68. package/dist/cli/commands/quickstart.test.js +40 -2
  69. package/dist/cli/commands/quickstart.test.js.map +1 -1
  70. package/dist/core/agents/suite.test.js +4 -2
  71. package/dist/core/agents/suite.test.js.map +1 -1
  72. package/dist/core/agents/tools.test.js +5 -1
  73. package/dist/core/agents/tools.test.js.map +1 -1
  74. package/dist/index.d.ts +3 -10
  75. package/dist/index.d.ts.map +1 -1
  76. package/dist/index.js +5 -10
  77. package/dist/index.js.map +1 -1
  78. package/package.json +15 -9
  79. package/sbom.json +2011 -819
  80. package/templates/.github/agents/beth.agent.md +222 -45
  81. package/templates/.github/agents/developer.agent.md +37 -67
  82. package/templates/.github/agents/product-manager.agent.md +15 -57
  83. package/templates/.github/agents/researcher.agent.md +20 -60
  84. package/templates/.github/agents/security-reviewer.agent.md +29 -70
  85. package/templates/.github/agents/tester.agent.md +40 -58
  86. package/templates/.github/agents/ux-designer.agent.md +20 -63
  87. package/templates/.github/copilot-instructions.md +217 -204
  88. package/templates/AGENTS.md +108 -20
  89. package/dist/core/context.d.ts +0 -171
  90. package/dist/core/context.d.ts.map +0 -1
  91. package/dist/core/context.js +0 -353
  92. package/dist/core/context.js.map +0 -1
  93. package/dist/core/context.test.d.ts +0 -8
  94. package/dist/core/context.test.d.ts.map +0 -1
  95. package/dist/core/context.test.js +0 -253
  96. package/dist/core/context.test.js.map +0 -1
  97. package/dist/core/handoffs.d.ts +0 -151
  98. package/dist/core/handoffs.d.ts.map +0 -1
  99. package/dist/core/handoffs.js +0 -220
  100. package/dist/core/handoffs.js.map +0 -1
  101. package/dist/core/handoffs.test.d.ts +0 -8
  102. package/dist/core/handoffs.test.d.ts.map +0 -1
  103. package/dist/core/handoffs.test.js +0 -231
  104. package/dist/core/handoffs.test.js.map +0 -1
  105. package/dist/core/orchestrator.d.ts +0 -246
  106. package/dist/core/orchestrator.d.ts.map +0 -1
  107. package/dist/core/orchestrator.js +0 -514
  108. package/dist/core/orchestrator.js.map +0 -1
  109. package/dist/core/orchestrator.test.d.ts +0 -8
  110. package/dist/core/orchestrator.test.d.ts.map +0 -1
  111. package/dist/core/orchestrator.test.js +0 -517
  112. package/dist/core/orchestrator.test.js.map +0 -1
  113. package/dist/core/router.d.ts +0 -102
  114. package/dist/core/router.d.ts.map +0 -1
  115. package/dist/core/router.js +0 -178
  116. package/dist/core/router.js.map +0 -1
  117. package/dist/core/router.test.d.ts +0 -8
  118. package/dist/core/router.test.d.ts.map +0 -1
  119. package/dist/core/router.test.js +0 -215
  120. package/dist/core/router.test.js.map +0 -1
  121. package/dist/init.test.js +0 -288
  122. package/dist/providers/azure.d.ts +0 -147
  123. package/dist/providers/azure.d.ts.map +0 -1
  124. package/dist/providers/azure.js +0 -491
  125. package/dist/providers/azure.js.map +0 -1
  126. package/dist/providers/azure.test.d.ts +0 -11
  127. package/dist/providers/azure.test.d.ts.map +0 -1
  128. package/dist/providers/azure.test.js +0 -330
  129. package/dist/providers/azure.test.js.map +0 -1
  130. package/dist/providers/config.d.ts +0 -87
  131. package/dist/providers/config.d.ts.map +0 -1
  132. package/dist/providers/config.js +0 -193
  133. package/dist/providers/config.js.map +0 -1
  134. package/dist/providers/config.test.d.ts +0 -7
  135. package/dist/providers/config.test.d.ts.map +0 -1
  136. package/dist/providers/config.test.js +0 -370
  137. package/dist/providers/config.test.js.map +0 -1
  138. package/dist/providers/index.d.ts +0 -18
  139. package/dist/providers/index.d.ts.map +0 -1
  140. package/dist/providers/index.js +0 -14
  141. package/dist/providers/index.js.map +0 -1
  142. package/dist/providers/interface.d.ts +0 -191
  143. package/dist/providers/interface.d.ts.map +0 -1
  144. package/dist/providers/interface.js +0 -94
  145. package/dist/providers/interface.js.map +0 -1
  146. package/dist/providers/retry.d.ts +0 -128
  147. package/dist/providers/retry.d.ts.map +0 -1
  148. package/dist/providers/retry.js +0 -205
  149. package/dist/providers/retry.js.map +0 -1
  150. package/dist/providers/retry.test.d.ts +0 -7
  151. package/dist/providers/retry.test.d.ts.map +0 -1
  152. package/dist/providers/retry.test.js +0 -439
  153. package/dist/providers/retry.test.js.map +0 -1
  154. package/dist/providers/streaming.d.ts +0 -157
  155. package/dist/providers/streaming.d.ts.map +0 -1
  156. package/dist/providers/streaming.js +0 -233
  157. package/dist/providers/streaming.js.map +0 -1
  158. package/dist/providers/streaming.test.d.ts +0 -7
  159. package/dist/providers/streaming.test.d.ts.map +0 -1
  160. package/dist/providers/streaming.test.js +0 -372
  161. package/dist/providers/streaming.test.js.map +0 -1
  162. package/dist/providers/types.d.ts +0 -209
  163. package/dist/providers/types.d.ts.map +0 -1
  164. package/dist/providers/types.js +0 -53
  165. package/dist/providers/types.js.map +0 -1
  166. package/dist/providers/types.test.d.ts +0 -7
  167. package/dist/providers/types.test.d.ts.map +0 -1
  168. package/dist/providers/types.test.js +0 -141
  169. package/dist/providers/types.test.js.map +0 -1
  170. package/dist/tools/cli/beads.d.ts +0 -27
  171. package/dist/tools/cli/beads.d.ts.map +0 -1
  172. package/dist/tools/cli/beads.js +0 -172
  173. package/dist/tools/cli/beads.js.map +0 -1
  174. package/dist/tools/cli/beads.test.d.ts +0 -8
  175. package/dist/tools/cli/beads.test.d.ts.map +0 -1
  176. package/dist/tools/cli/beads.test.js +0 -264
  177. package/dist/tools/cli/beads.test.js.map +0 -1
  178. package/dist/tools/cli/editFile.d.ts +0 -17
  179. package/dist/tools/cli/editFile.d.ts.map +0 -1
  180. package/dist/tools/cli/editFile.js +0 -125
  181. package/dist/tools/cli/editFile.js.map +0 -1
  182. package/dist/tools/cli/editFile.test.d.ts +0 -8
  183. package/dist/tools/cli/editFile.test.d.ts.map +0 -1
  184. package/dist/tools/cli/editFile.test.js +0 -177
  185. package/dist/tools/cli/editFile.test.js.map +0 -1
  186. package/dist/tools/cli/readFile.d.ts +0 -25
  187. package/dist/tools/cli/readFile.d.ts.map +0 -1
  188. package/dist/tools/cli/readFile.js +0 -118
  189. package/dist/tools/cli/readFile.js.map +0 -1
  190. package/dist/tools/cli/readFile.test.d.ts +0 -8
  191. package/dist/tools/cli/readFile.test.d.ts.map +0 -1
  192. package/dist/tools/cli/readFile.test.js +0 -194
  193. package/dist/tools/cli/readFile.test.js.map +0 -1
  194. package/dist/tools/cli/search.d.ts +0 -16
  195. package/dist/tools/cli/search.d.ts.map +0 -1
  196. package/dist/tools/cli/search.js +0 -261
  197. package/dist/tools/cli/search.js.map +0 -1
  198. package/dist/tools/cli/search.test.d.ts +0 -8
  199. package/dist/tools/cli/search.test.d.ts.map +0 -1
  200. package/dist/tools/cli/search.test.js +0 -172
  201. package/dist/tools/cli/search.test.js.map +0 -1
  202. package/dist/tools/cli/subagent.d.ts +0 -43
  203. package/dist/tools/cli/subagent.d.ts.map +0 -1
  204. package/dist/tools/cli/subagent.js +0 -99
  205. package/dist/tools/cli/subagent.js.map +0 -1
  206. package/dist/tools/cli/subagent.test.d.ts +0 -8
  207. package/dist/tools/cli/subagent.test.d.ts.map +0 -1
  208. package/dist/tools/cli/subagent.test.js +0 -190
  209. package/dist/tools/cli/subagent.test.js.map +0 -1
  210. package/dist/tools/cli/terminal.d.ts +0 -19
  211. package/dist/tools/cli/terminal.d.ts.map +0 -1
  212. package/dist/tools/cli/terminal.js +0 -164
  213. package/dist/tools/cli/terminal.js.map +0 -1
  214. package/dist/tools/cli/terminal.test.d.ts +0 -8
  215. package/dist/tools/cli/terminal.test.d.ts.map +0 -1
  216. package/dist/tools/cli/terminal.test.js +0 -161
  217. package/dist/tools/cli/terminal.test.js.map +0 -1
  218. package/dist/tools/index.d.ts +0 -25
  219. package/dist/tools/index.d.ts.map +0 -1
  220. package/dist/tools/index.js +0 -41
  221. package/dist/tools/index.js.map +0 -1
  222. package/dist/tools/interface.d.ts +0 -64
  223. package/dist/tools/interface.d.ts.map +0 -1
  224. package/dist/tools/interface.js +0 -37
  225. package/dist/tools/interface.js.map +0 -1
  226. package/dist/tools/interface.test.d.ts +0 -7
  227. package/dist/tools/interface.test.d.ts.map +0 -1
  228. package/dist/tools/interface.test.js +0 -179
  229. package/dist/tools/interface.test.js.map +0 -1
  230. package/dist/tools/mcp/bridge.d.ts +0 -48
  231. package/dist/tools/mcp/bridge.d.ts.map +0 -1
  232. package/dist/tools/mcp/bridge.js +0 -128
  233. package/dist/tools/mcp/bridge.js.map +0 -1
  234. package/dist/tools/mcp/bridge.test.d.ts +0 -8
  235. package/dist/tools/mcp/bridge.test.d.ts.map +0 -1
  236. package/dist/tools/mcp/bridge.test.js +0 -300
  237. package/dist/tools/mcp/bridge.test.js.map +0 -1
  238. package/dist/tools/mcp/client.d.ts +0 -135
  239. package/dist/tools/mcp/client.d.ts.map +0 -1
  240. package/dist/tools/mcp/client.js +0 -263
  241. package/dist/tools/mcp/client.js.map +0 -1
  242. package/dist/tools/mcp/client.test.d.ts +0 -8
  243. package/dist/tools/mcp/client.test.d.ts.map +0 -1
  244. package/dist/tools/mcp/client.test.js +0 -390
  245. package/dist/tools/mcp/client.test.js.map +0 -1
  246. package/dist/tools/registry.d.ts +0 -82
  247. package/dist/tools/registry.d.ts.map +0 -1
  248. package/dist/tools/registry.js +0 -99
  249. package/dist/tools/registry.js.map +0 -1
  250. package/dist/tools/registry.test.d.ts +0 -7
  251. package/dist/tools/registry.test.d.ts.map +0 -1
  252. package/dist/tools/registry.test.js +0 -199
  253. package/dist/tools/registry.test.js.map +0 -1
  254. package/dist/tools/suite.test.d.ts +0 -11
  255. package/dist/tools/suite.test.d.ts.map +0 -1
  256. package/dist/tools/suite.test.js +0 -119
  257. package/dist/tools/suite.test.js.map +0 -1
  258. package/dist/tools/types.d.ts +0 -75
  259. package/dist/tools/types.d.ts.map +0 -1
  260. package/dist/tools/types.js +0 -30
  261. package/dist/tools/types.js.map +0 -1
  262. package/dist/tools/types.test.d.ts +0 -7
  263. package/dist/tools/types.test.d.ts.map +0 -1
  264. package/dist/tools/types.test.js +0 -178
  265. package/dist/tools/types.test.js.map +0 -1
@@ -1,75 +0,0 @@
1
- /**
2
- * Tool Abstraction Types
3
- *
4
- * Type definitions for the tool abstraction layer.
5
- * Tools provide a uniform interface for agent capabilities
6
- * regardless of runtime environment (CLI, Copilot, MCP).
7
- */
8
- import type { JSONSchema } from '../providers/types.js';
9
- /**
10
- * Error codes for tool execution errors.
11
- * Used to categorize failures and provide actionable error messages.
12
- */
13
- export type ToolErrorCode = 'INVALID_INPUT' | 'PERMISSION_DENIED' | 'EXECUTION_FAILED' | 'NOT_FOUND' | 'TIMEOUT';
14
- /**
15
- * Custom error class for tool execution errors.
16
- * Includes an error code for programmatic handling and
17
- * an optional cause for error chaining.
18
- */
19
- export declare class ToolError extends Error {
20
- /** Categorized error code for programmatic handling */
21
- readonly code: ToolErrorCode;
22
- /** Name of the tool that generated this error */
23
- readonly toolName: string;
24
- /** Original error that caused this error */
25
- readonly cause?: Error;
26
- constructor(message: string, code: ToolErrorCode, toolName: string, options?: {
27
- cause?: Error;
28
- });
29
- }
30
- /**
31
- * Permissions governing what a tool is allowed to do.
32
- * Enforced by tool implementations before performing operations.
33
- */
34
- export interface ToolPermissions {
35
- /** Whether the tool can read files from the filesystem */
36
- allowFileRead: boolean;
37
- /** Whether the tool can write or modify files on the filesystem */
38
- allowFileWrite: boolean;
39
- /** Whether the tool can execute terminal commands */
40
- allowTerminal: boolean;
41
- /** Whether the tool can make network requests */
42
- allowNetwork: boolean;
43
- }
44
- /**
45
- * Execution context provided to a tool when it runs.
46
- * Contains the working directory, permissions, and an optional abort signal.
47
- */
48
- export interface ToolContext {
49
- /** Absolute path to the working directory for file operations */
50
- workingDir: string;
51
- /** Permissions governing what the tool is allowed to do */
52
- permissions: ToolPermissions;
53
- /** Optional signal for cancelling tool execution */
54
- signal?: AbortSignal;
55
- }
56
- /**
57
- * Result returned by a tool after execution.
58
- * Includes a success flag, output text, and optional error/metadata.
59
- */
60
- export interface ToolResult {
61
- /** Whether the tool executed successfully */
62
- success: boolean;
63
- /** Human-readable output from the tool */
64
- output: string;
65
- /** Error message if the tool failed */
66
- error?: string;
67
- /** Additional structured metadata from the tool execution */
68
- metadata?: Record<string, unknown>;
69
- }
70
- /**
71
- * JSON Schema type for tool input validation.
72
- * Re-exports the JSONSchema type from the providers layer for consistency.
73
- */
74
- export type ToolInputSchema = JSONSchema;
75
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAMxD;;;GAGG;AACH,MAAM,MAAM,aAAa,GACrB,eAAe,GACf,mBAAmB,GACnB,kBAAkB,GAClB,WAAW,GACX,SAAS,CAAC;AAEd;;;;GAIG;AACH,qBAAa,SAAU,SAAQ,KAAK;IAClC,uDAAuD;IACvD,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAE7B,iDAAiD;IACjD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B,4CAA4C;IAC5C,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;gBAGrB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,aAAa,EACnB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,KAAK,CAAC;KACf;CAWJ;AAMD;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,0DAA0D;IAC1D,aAAa,EAAE,OAAO,CAAC;IAEvB,mEAAmE;IACnE,cAAc,EAAE,OAAO,CAAC;IAExB,qDAAqD;IACrD,aAAa,EAAE,OAAO,CAAC;IAEvB,iDAAiD;IACjD,YAAY,EAAE,OAAO,CAAC;CACvB;AAMD;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,iEAAiE;IACjE,UAAU,EAAE,MAAM,CAAC;IAEnB,2DAA2D;IAC3D,WAAW,EAAE,eAAe,CAAC;IAE7B,oDAAoD;IACpD,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAMD;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,6CAA6C;IAC7C,OAAO,EAAE,OAAO,CAAC;IAEjB,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;IAEf,uCAAuC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAMD;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC"}
@@ -1,30 +0,0 @@
1
- /**
2
- * Tool Abstraction Types
3
- *
4
- * Type definitions for the tool abstraction layer.
5
- * Tools provide a uniform interface for agent capabilities
6
- * regardless of runtime environment (CLI, Copilot, MCP).
7
- */
8
- /**
9
- * Custom error class for tool execution errors.
10
- * Includes an error code for programmatic handling and
11
- * an optional cause for error chaining.
12
- */
13
- export class ToolError extends Error {
14
- /** Categorized error code for programmatic handling */
15
- code;
16
- /** Name of the tool that generated this error */
17
- toolName;
18
- /** Original error that caused this error */
19
- cause;
20
- constructor(message, code, toolName, options) {
21
- super(message);
22
- this.name = 'ToolError';
23
- this.code = code;
24
- this.toolName = toolName;
25
- if (options?.cause) {
26
- this.cause = options.cause;
27
- }
28
- }
29
- }
30
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAmBH;;;;GAIG;AACH,MAAM,OAAO,SAAU,SAAQ,KAAK;IAClC,uDAAuD;IAC9C,IAAI,CAAgB;IAE7B,iDAAiD;IACxC,QAAQ,CAAS;IAE1B,4CAA4C;IACnC,KAAK,CAAS;IAEvB,YACE,OAAe,EACf,IAAmB,EACnB,QAAgB,EAChB,OAEC;QAED,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,IAAI,OAAO,EAAE,KAAK,EAAE,CAAC;YACnB,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC7B,CAAC;IACH,CAAC;CACF"}
@@ -1,7 +0,0 @@
1
- /**
2
- * Tool Types Tests
3
- *
4
- * Tests for ToolError class and type shapes.
5
- */
6
- export {};
7
- //# sourceMappingURL=types.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.test.d.ts","sourceRoot":"","sources":["../../src/tools/types.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -1,178 +0,0 @@
1
- /**
2
- * Tool Types Tests
3
- *
4
- * Tests for ToolError class and type shapes.
5
- */
6
- import { describe, it } from 'node:test';
7
- import assert from 'node:assert';
8
- import { ToolError } from './types.js';
9
- describe('ToolError', () => {
10
- describe('constructor', () => {
11
- it('should set message correctly', () => {
12
- const error = new ToolError('Bad input', 'INVALID_INPUT', 'readFile');
13
- assert.strictEqual(error.message, 'Bad input');
14
- });
15
- it('should set code correctly', () => {
16
- const error = new ToolError('Denied', 'PERMISSION_DENIED', 'editFile');
17
- assert.strictEqual(error.code, 'PERMISSION_DENIED');
18
- });
19
- it('should set toolName correctly', () => {
20
- const error = new ToolError('Failed', 'EXECUTION_FAILED', 'terminal');
21
- assert.strictEqual(error.toolName, 'terminal');
22
- });
23
- it('should set cause from options', () => {
24
- const original = new Error('Root cause');
25
- const error = new ToolError('Wrapped', 'EXECUTION_FAILED', 'search', {
26
- cause: original,
27
- });
28
- assert.strictEqual(error.cause, original);
29
- });
30
- it('should leave cause undefined when not provided', () => {
31
- const error = new ToolError('Test', 'NOT_FOUND', 'readFile');
32
- assert.strictEqual(error.cause, undefined);
33
- });
34
- it('should set all fields together', () => {
35
- const cause = new Error('Underlying issue');
36
- const error = new ToolError('Complete error', 'TIMEOUT', 'terminal', {
37
- cause,
38
- });
39
- assert.strictEqual(error.message, 'Complete error');
40
- assert.strictEqual(error.code, 'TIMEOUT');
41
- assert.strictEqual(error.toolName, 'terminal');
42
- assert.strictEqual(error.cause, cause);
43
- });
44
- });
45
- describe('name property', () => {
46
- it('should be "ToolError"', () => {
47
- const error = new ToolError('Test', 'INVALID_INPUT', 'test');
48
- assert.strictEqual(error.name, 'ToolError');
49
- });
50
- });
51
- describe('inheritance', () => {
52
- it('should be an instance of Error', () => {
53
- const error = new ToolError('Test', 'INVALID_INPUT', 'test');
54
- assert.ok(error instanceof Error);
55
- });
56
- it('should be an instance of ToolError', () => {
57
- const error = new ToolError('Test', 'INVALID_INPUT', 'test');
58
- assert.ok(error instanceof ToolError);
59
- });
60
- it('should have a stack trace', () => {
61
- const error = new ToolError('Test', 'INVALID_INPUT', 'test');
62
- assert.ok(typeof error.stack === 'string');
63
- assert.ok(error.stack.length > 0);
64
- });
65
- });
66
- describe('error codes', () => {
67
- const allCodes = [
68
- 'INVALID_INPUT',
69
- 'PERMISSION_DENIED',
70
- 'EXECUTION_FAILED',
71
- 'NOT_FOUND',
72
- 'TIMEOUT',
73
- ];
74
- for (const code of allCodes) {
75
- it(`should accept error code "${code}"`, () => {
76
- const error = new ToolError('Test', code, 'test-tool');
77
- assert.strictEqual(error.code, code);
78
- });
79
- }
80
- });
81
- describe('readonly properties', () => {
82
- it('should have readonly code', () => {
83
- const error = new ToolError('Test', 'INVALID_INPUT', 'test');
84
- assert.strictEqual(error.code, 'INVALID_INPUT');
85
- });
86
- it('should have readonly toolName', () => {
87
- const error = new ToolError('Test', 'INVALID_INPUT', 'readFile');
88
- assert.strictEqual(error.toolName, 'readFile');
89
- });
90
- });
91
- });
92
- describe('ToolResult shape', () => {
93
- it('should accept a successful result', () => {
94
- const result = {
95
- success: true,
96
- output: 'File contents here',
97
- };
98
- assert.strictEqual(result.success, true);
99
- assert.strictEqual(result.output, 'File contents here');
100
- assert.strictEqual(result.error, undefined);
101
- assert.strictEqual(result.metadata, undefined);
102
- });
103
- it('should accept a failed result with error', () => {
104
- const result = {
105
- success: false,
106
- output: '',
107
- error: 'File not found',
108
- };
109
- assert.strictEqual(result.success, false);
110
- assert.strictEqual(result.error, 'File not found');
111
- });
112
- it('should accept a result with metadata', () => {
113
- const result = {
114
- success: true,
115
- output: 'Done',
116
- metadata: { bytesRead: 1024, encoding: 'utf-8' },
117
- };
118
- assert.strictEqual(result.success, true);
119
- assert.deepStrictEqual(result.metadata, { bytesRead: 1024, encoding: 'utf-8' });
120
- });
121
- });
122
- describe('ToolPermissions shape', () => {
123
- it('should accept fully permissive permissions', () => {
124
- const perms = {
125
- allowFileRead: true,
126
- allowFileWrite: true,
127
- allowTerminal: true,
128
- allowNetwork: true,
129
- };
130
- assert.strictEqual(perms.allowFileRead, true);
131
- assert.strictEqual(perms.allowFileWrite, true);
132
- assert.strictEqual(perms.allowTerminal, true);
133
- assert.strictEqual(perms.allowNetwork, true);
134
- });
135
- it('should accept fully restrictive permissions', () => {
136
- const perms = {
137
- allowFileRead: false,
138
- allowFileWrite: false,
139
- allowTerminal: false,
140
- allowNetwork: false,
141
- };
142
- assert.strictEqual(perms.allowFileRead, false);
143
- assert.strictEqual(perms.allowFileWrite, false);
144
- assert.strictEqual(perms.allowTerminal, false);
145
- assert.strictEqual(perms.allowNetwork, false);
146
- });
147
- });
148
- describe('ToolContext shape', () => {
149
- it('should accept a context with required fields', () => {
150
- const ctx = {
151
- workingDir: '/home/user/project',
152
- permissions: {
153
- allowFileRead: true,
154
- allowFileWrite: false,
155
- allowTerminal: false,
156
- allowNetwork: false,
157
- },
158
- };
159
- assert.strictEqual(ctx.workingDir, '/home/user/project');
160
- assert.strictEqual(ctx.permissions.allowFileRead, true);
161
- assert.strictEqual(ctx.signal, undefined);
162
- });
163
- it('should accept a context with an AbortSignal', () => {
164
- const controller = new AbortController();
165
- const ctx = {
166
- workingDir: '/tmp',
167
- permissions: {
168
- allowFileRead: true,
169
- allowFileWrite: true,
170
- allowTerminal: true,
171
- allowNetwork: true,
172
- },
173
- signal: controller.signal,
174
- };
175
- assert.ok(ctx.signal instanceof AbortSignal);
176
- });
177
- });
178
- //# sourceMappingURL=types.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.test.js","sourceRoot":"","sources":["../../src/tools/types.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;QAC3B,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;YACtC,MAAM,KAAK,GAAG,IAAI,SAAS,CAAC,WAAW,EAAE,eAAe,EAAE,UAAU,CAAC,CAAC;YAEtE,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;YACnC,MAAM,KAAK,GAAG,IAAI,SAAS,CAAC,QAAQ,EAAE,mBAAmB,EAAE,UAAU,CAAC,CAAC;YAEvE,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;YACvC,MAAM,KAAK,GAAG,IAAI,SAAS,CAAC,QAAQ,EAAE,kBAAkB,EAAE,UAAU,CAAC,CAAC;YAEtE,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,+BAA+B,EAAE,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