beth-copilot 1.0.15 → 1.0.16
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.
- package/README.md +197 -77
- package/bin/cli.js +47 -0
- package/dist/core/context.d.ts +171 -0
- package/dist/core/context.d.ts.map +1 -0
- package/dist/core/context.js +353 -0
- package/dist/core/context.js.map +1 -0
- package/dist/core/context.test.d.ts +8 -0
- package/dist/core/context.test.d.ts.map +1 -0
- package/dist/core/context.test.js +253 -0
- package/dist/core/context.test.js.map +1 -0
- package/dist/core/handoffs.d.ts +151 -0
- package/dist/core/handoffs.d.ts.map +1 -0
- package/dist/core/handoffs.js +220 -0
- package/dist/core/handoffs.js.map +1 -0
- package/dist/core/handoffs.test.d.ts +8 -0
- package/dist/core/handoffs.test.d.ts.map +1 -0
- package/dist/core/handoffs.test.js +231 -0
- package/dist/core/handoffs.test.js.map +1 -0
- package/dist/core/orchestrator.d.ts +246 -0
- package/dist/core/orchestrator.d.ts.map +1 -0
- package/dist/core/orchestrator.js +514 -0
- package/dist/core/orchestrator.js.map +1 -0
- package/dist/core/orchestrator.test.d.ts +8 -0
- package/dist/core/orchestrator.test.d.ts.map +1 -0
- package/dist/core/orchestrator.test.js +517 -0
- package/dist/core/orchestrator.test.js.map +1 -0
- package/dist/core/router.d.ts +102 -0
- package/dist/core/router.d.ts.map +1 -0
- package/dist/core/router.js +178 -0
- package/dist/core/router.js.map +1 -0
- package/dist/core/router.test.d.ts +8 -0
- package/dist/core/router.test.d.ts.map +1 -0
- package/dist/core/router.test.js +215 -0
- package/dist/core/router.test.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/tools/cli/beads.d.ts +27 -0
- package/dist/tools/cli/beads.d.ts.map +1 -0
- package/dist/tools/cli/beads.js +172 -0
- package/dist/tools/cli/beads.js.map +1 -0
- package/dist/tools/cli/beads.test.d.ts +8 -0
- package/dist/tools/cli/beads.test.d.ts.map +1 -0
- package/dist/tools/cli/beads.test.js +264 -0
- package/dist/tools/cli/beads.test.js.map +1 -0
- package/dist/tools/cli/editFile.d.ts +17 -0
- package/dist/tools/cli/editFile.d.ts.map +1 -0
- package/dist/tools/cli/editFile.js +125 -0
- package/dist/tools/cli/editFile.js.map +1 -0
- package/dist/tools/cli/editFile.test.d.ts +8 -0
- package/dist/tools/cli/editFile.test.d.ts.map +1 -0
- package/dist/tools/cli/editFile.test.js +177 -0
- package/dist/tools/cli/editFile.test.js.map +1 -0
- package/dist/tools/cli/readFile.d.ts +25 -0
- package/dist/tools/cli/readFile.d.ts.map +1 -0
- package/dist/tools/cli/readFile.js +118 -0
- package/dist/tools/cli/readFile.js.map +1 -0
- package/dist/tools/cli/readFile.test.d.ts +8 -0
- package/dist/tools/cli/readFile.test.d.ts.map +1 -0
- package/dist/tools/cli/readFile.test.js +194 -0
- package/dist/tools/cli/readFile.test.js.map +1 -0
- package/dist/tools/cli/search.d.ts +16 -0
- package/dist/tools/cli/search.d.ts.map +1 -0
- package/dist/tools/cli/search.js +261 -0
- package/dist/tools/cli/search.js.map +1 -0
- package/dist/tools/cli/search.test.d.ts +8 -0
- package/dist/tools/cli/search.test.d.ts.map +1 -0
- package/dist/tools/cli/search.test.js +172 -0
- package/dist/tools/cli/search.test.js.map +1 -0
- package/dist/tools/cli/subagent.d.ts +43 -0
- package/dist/tools/cli/subagent.d.ts.map +1 -0
- package/dist/tools/cli/subagent.js +99 -0
- package/dist/tools/cli/subagent.js.map +1 -0
- package/dist/tools/cli/subagent.test.d.ts +8 -0
- package/dist/tools/cli/subagent.test.d.ts.map +1 -0
- package/dist/tools/cli/subagent.test.js +190 -0
- package/dist/tools/cli/subagent.test.js.map +1 -0
- package/dist/tools/cli/terminal.d.ts +19 -0
- package/dist/tools/cli/terminal.d.ts.map +1 -0
- package/dist/tools/cli/terminal.js +164 -0
- package/dist/tools/cli/terminal.js.map +1 -0
- package/dist/tools/cli/terminal.test.d.ts +8 -0
- package/dist/tools/cli/terminal.test.d.ts.map +1 -0
- package/dist/tools/cli/terminal.test.js +161 -0
- package/dist/tools/cli/terminal.test.js.map +1 -0
- package/dist/tools/index.d.ts +25 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +41 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/interface.d.ts +64 -0
- package/dist/tools/interface.d.ts.map +1 -0
- package/dist/tools/interface.js +37 -0
- package/dist/tools/interface.js.map +1 -0
- package/dist/tools/interface.test.d.ts +7 -0
- package/dist/tools/interface.test.d.ts.map +1 -0
- package/dist/tools/interface.test.js +179 -0
- package/dist/tools/interface.test.js.map +1 -0
- package/dist/tools/mcp/bridge.d.ts +48 -0
- package/dist/tools/mcp/bridge.d.ts.map +1 -0
- package/dist/tools/mcp/bridge.js +128 -0
- package/dist/tools/mcp/bridge.js.map +1 -0
- package/dist/tools/mcp/bridge.test.d.ts +8 -0
- package/dist/tools/mcp/bridge.test.d.ts.map +1 -0
- package/dist/tools/mcp/bridge.test.js +300 -0
- package/dist/tools/mcp/bridge.test.js.map +1 -0
- package/dist/tools/mcp/client.d.ts +135 -0
- package/dist/tools/mcp/client.d.ts.map +1 -0
- package/dist/tools/mcp/client.js +263 -0
- package/dist/tools/mcp/client.js.map +1 -0
- package/dist/tools/mcp/client.test.d.ts +8 -0
- package/dist/tools/mcp/client.test.d.ts.map +1 -0
- package/dist/tools/mcp/client.test.js +390 -0
- package/dist/tools/mcp/client.test.js.map +1 -0
- package/dist/tools/registry.d.ts +82 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +99 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/registry.test.d.ts +7 -0
- package/dist/tools/registry.test.d.ts.map +1 -0
- package/dist/tools/registry.test.js +199 -0
- package/dist/tools/registry.test.js.map +1 -0
- package/dist/tools/suite.test.d.ts +11 -0
- package/dist/tools/suite.test.d.ts.map +1 -0
- package/dist/tools/suite.test.js +119 -0
- package/dist/tools/suite.test.js.map +1 -0
- package/dist/tools/types.d.ts +75 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +30 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools/types.test.d.ts +7 -0
- package/dist/tools/types.test.d.ts.map +1 -0
- package/dist/tools/types.test.js +178 -0
- package/dist/tools/types.test.js.map +1 -0
- package/package.json +2 -2
- package/sbom.json +209 -209
|
@@ -0,0 +1,75 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/tools/types.ts"],"names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O,CAAC,CAAC;CACpC;AAMD;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.test.d.ts","sourceRoot":"","sources":["../../src/tools/types.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,178 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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;YAEt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CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;QACrD,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;QACzC,MAAM,GAAG,GAAgB;YACvB,UAAU,EAAE,MAAM;YAClB,WAAW,EAAE;gBACX,aAAa,EAAE,IAAI;gBACnB,cAAc,EAAE,IAAI;gBACpB,aAAa,EAAE,IAAI;gBACnB,YAAY,EAAE,IAAI;aACnB;YACD,MAAM,EAAE,UAAU,CAAC,MAAM;SAC1B,CAAC;QAEF,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,YAAY,WAAW,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "beth-copilot",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.16",
|
|
4
4
|
"description": "Beth - A ruthless, hyper-competent AI orchestrator for GitHub Copilot multi-agent workflows",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"github-copilot",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"build": "tsc",
|
|
38
38
|
"build:watch": "tsc --watch",
|
|
39
39
|
"test": "node --test bin/lib/*.test.js",
|
|
40
|
-
"test:ts": "pnpm run build && node --test dist/lib/*.test.js dist/cli/commands/*.test.js dist/core/agents/*.test.js dist/core/skills/*.test.js dist/providers/*.test.js",
|
|
40
|
+
"test:ts": "pnpm run build && node --test dist/lib/*.test.js dist/cli/commands/*.test.js dist/core/*.test.js dist/core/agents/*.test.js dist/core/skills/*.test.js dist/providers/*.test.js dist/tools/*.test.js dist/tools/cli/*.test.js dist/tools/mcp/*.test.js",
|
|
41
41
|
"test:all": "pnpm run test && pnpm run test:ts",
|
|
42
42
|
"sbom:generate": "npx @cyclonedx/cyclonedx-npm --output-file sbom.json --output-format JSON",
|
|
43
43
|
"prepublishOnly": "npm run build && npm run sbom:generate"
|