@gaunt-sloth/agent 2.0.0-alpha.4 → 2.0.0-alpha.40
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 +73 -23
- package/cli-acp.js +21 -24
- package/dist/builtInToolsConfig.d.ts +17 -3
- package/dist/builtInToolsConfig.js +43 -41
- package/dist/builtInToolsConfig.js.map +1 -1
- package/dist/core/debugCapture.d.ts +7 -49
- package/dist/core/debugCapture.js +1 -1
- package/dist/core/debugCapture.js.map +1 -1
- package/dist/core/resolveAgentFactory.d.ts +15 -0
- package/dist/core/resolveAgentFactory.js +17 -0
- package/dist/core/resolveAgentFactory.js.map +1 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/dist/mcp/OAuthClientProviderImpl.js.map +1 -1
- package/dist/mcp/tlsTrust.d.ts +61 -0
- package/dist/mcp/tlsTrust.js +109 -0
- package/dist/mcp/tlsTrust.js.map +1 -0
- package/dist/middleware/binaryContentInjectionMiddleware.d.ts +8 -1
- package/dist/middleware/binaryContentInjectionMiddleware.js +11 -2
- package/dist/middleware/binaryContentInjectionMiddleware.js.map +1 -1
- package/dist/middleware/frontendImageInjectionMiddleware.d.ts +107 -0
- package/dist/middleware/frontendImageInjectionMiddleware.js +167 -0
- package/dist/middleware/frontendImageInjectionMiddleware.js.map +1 -0
- package/dist/middleware/registry.js +49 -1
- package/dist/middleware/registry.js.map +1 -1
- package/dist/middleware/types.d.ts +16 -2
- package/dist/modules/a2a/A2AClientWrapper.d.ts +56 -1
- package/dist/modules/a2a/A2AClientWrapper.js +131 -31
- package/dist/modules/a2a/A2AClientWrapper.js.map +1 -1
- package/dist/modules/acp/acpAgentApp.d.ts +57 -0
- package/dist/modules/acp/acpAgentApp.js +378 -0
- package/dist/modules/acp/acpAgentApp.js.map +1 -0
- package/dist/modules/acp/acpAgentAppV1.d.ts +52 -0
- package/dist/modules/acp/acpAgentAppV1.js +307 -0
- package/dist/modules/acp/acpAgentAppV1.js.map +1 -0
- package/dist/modules/acp/acpCommon.d.ts +167 -0
- package/dist/modules/acp/acpCommon.js +282 -0
- package/dist/modules/acp/acpCommon.js.map +1 -0
- package/dist/modules/acp/acpPermissions.d.ts +65 -0
- package/dist/modules/acp/acpPermissions.js +162 -0
- package/dist/modules/acp/acpPermissions.js.map +1 -0
- package/dist/modules/acp/acpPermissionsV1.d.ts +45 -0
- package/dist/modules/acp/acpPermissionsV1.js +110 -0
- package/dist/modules/acp/acpPermissionsV1.js.map +1 -0
- package/dist/modules/acp/acpRouter.d.ts +41 -0
- package/dist/modules/acp/acpRouter.js +48 -0
- package/dist/modules/acp/acpRouter.js.map +1 -0
- package/dist/modules/acp/acpStdio.d.ts +47 -0
- package/dist/modules/acp/acpStdio.js +71 -0
- package/dist/modules/acp/acpStdio.js.map +1 -0
- package/dist/modules/acp/acpToolCalls.d.ts +93 -0
- package/dist/modules/acp/acpToolCalls.js +193 -0
- package/dist/modules/acp/acpToolCalls.js.map +1 -0
- package/dist/modules/acp/acpUpdates.d.ts +48 -0
- package/dist/modules/acp/acpUpdates.js +142 -0
- package/dist/modules/acp/acpUpdates.js.map +1 -0
- package/dist/modules/acp/acpUpdatesV1.d.ts +61 -0
- package/dist/modules/acp/acpUpdatesV1.js +162 -0
- package/dist/modules/acp/acpUpdatesV1.js.map +1 -0
- package/dist/modules/apiAgUiModule.d.ts +87 -0
- package/dist/modules/apiAgUiModule.js +225 -32
- package/dist/modules/apiAgUiModule.js.map +1 -1
- package/dist/modules/interactiveSessionModule.js +524 -50
- package/dist/modules/interactiveSessionModule.js.map +1 -1
- package/dist/modules/slashCommands.d.ts +582 -0
- package/dist/modules/slashCommands.js +1001 -0
- package/dist/modules/slashCommands.js.map +1 -0
- package/dist/resolvers.js +119 -9
- package/dist/resolvers.js.map +1 -1
- package/dist/tools/GthCustomToolkit.js +95 -11
- package/dist/tools/GthCustomToolkit.js.map +1 -1
- package/dist/tools/GthDevToolkit.d.ts +9 -33
- package/dist/tools/GthDevToolkit.js +94 -73
- package/dist/tools/GthDevToolkit.js.map +1 -1
- package/dist/tools/GthFileSystemToolkit.d.ts +63 -0
- package/dist/tools/GthFileSystemToolkit.js +506 -105
- package/dist/tools/GthFileSystemToolkit.js.map +1 -1
- package/dist/tools/McpResourceTool.d.ts +31 -0
- package/dist/tools/McpResourceTool.js +106 -0
- package/dist/tools/McpResourceTool.js.map +1 -0
- package/dist/tools/gthChecklistTool.d.ts +30 -0
- package/dist/tools/gthChecklistTool.js +80 -0
- package/dist/tools/gthChecklistTool.js.map +1 -0
- package/dist/tools/gthGrepTool.d.ts +54 -0
- package/dist/tools/gthGrepTool.js +482 -0
- package/dist/tools/gthGrepTool.js.map +1 -0
- package/dist/tools/shell/env.js +1 -1
- package/dist/tools/shell/env.js.map +1 -1
- package/dist/tools/shell/outputBuffer.js.map +1 -1
- package/dist/tools/shell/workDir.d.ts +2 -0
- package/dist/tools/shell/workDir.js +19 -0
- package/dist/tools/shell/workDir.js.map +1 -0
- package/dist/utils/mcpAuthError.d.ts +36 -0
- package/dist/utils/mcpAuthError.js +89 -0
- package/dist/utils/mcpAuthError.js.map +1 -0
- package/dist/utils/mcpUtils.js +16 -0
- package/dist/utils/mcpUtils.js.map +1 -1
- package/package.json +12 -12
- package/dist/core/GthDeepAgent.d.ts +0 -151
- package/dist/core/GthDeepAgent.js +0 -604
- package/dist/core/GthDeepAgent.js.map +0 -1
- package/dist/core/deepAgentPermissions.d.ts +0 -73
- package/dist/core/deepAgentPermissions.js +0 -161
- package/dist/core/deepAgentPermissions.js.map +0 -1
- package/dist/core/gthAcpServer.d.ts +0 -27
- package/dist/core/gthAcpServer.js +0 -71
- package/dist/core/gthAcpServer.js.map +0 -1
- package/dist/core/gthDeepAgentFactory.d.ts +0 -8
- package/dist/core/gthDeepAgentFactory.js +0 -9
- package/dist/core/gthDeepAgentFactory.js.map +0 -1
- package/dist/modules/acpModule.d.ts +0 -40
- package/dist/modules/acpModule.js +0 -70
- package/dist/modules/acpModule.js.map +0 -1
- package/dist/tools/shell/allowlist.d.ts +0 -11
- package/dist/tools/shell/allowlist.js +0 -12
- package/dist/tools/shell/allowlist.js.map +0 -1
- package/dist/tools/shell/arity.d.ts +0 -11
- package/dist/tools/shell/arity.js +0 -12
- package/dist/tools/shell/arity.js.map +0 -1
- package/dist/tools/shell/hardline.d.ts +0 -15
- package/dist/tools/shell/hardline.js +0 -88
- package/dist/tools/shell/hardline.js.map +0 -1
- package/dist/tools/shell/normalize.d.ts +0 -10
- package/dist/tools/shell/normalize.js +0 -11
- package/dist/tools/shell/normalize.js.map +0 -1
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import type { FilesystemPermission } from 'deepagents';
|
|
2
|
-
export type { FilesystemPermission };
|
|
3
|
-
/**
|
|
4
|
-
* Tool names deepagents' filesystem middleware registers. This mirrors deepagents'
|
|
5
|
-
* internal `FILESYSTEM_TOOL_NAMES` (which is declared in its types but not exported
|
|
6
|
-
* at runtime). `createDeepAgent` throws on a name collision with any of these, so a
|
|
7
|
-
* gsloth-supplied tool sharing one of these names is superseded by the deep agent's
|
|
8
|
-
* built-in filesystem tool. Kept here as the single place the deep path references it.
|
|
9
|
-
*/
|
|
10
|
-
export declare const FILESYSTEM_TOOL_NAMES: readonly ["ls", "read_file", "write_file", "edit_file", "glob", "grep", "execute"];
|
|
11
|
-
/** The slice of GthConfig the permission mapping consumes. */
|
|
12
|
-
export interface PermissionConfigSlice {
|
|
13
|
-
filesystem: string[] | 'all' | 'read' | 'none';
|
|
14
|
-
aiignore?: {
|
|
15
|
-
enabled?: boolean;
|
|
16
|
-
patterns?: string[];
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Extra real filesystem roots to allow (`gth exec --allow-dir`). When present, the backend runs
|
|
20
|
-
* WITHOUT virtualMode, so permission paths are real absolute paths: access is allow-listed to
|
|
21
|
-
* cwd + these dirs and everything else is denied. Undefined/empty keeps the cwd-only sandbox.
|
|
22
|
-
*/
|
|
23
|
-
allowDirs?: string[];
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Build allow+deny rules for the widened (`--allow-dir`) sandbox. Because the backend runs
|
|
27
|
-
* without virtualMode, paths are REAL absolute paths, so we anchor allow rules at the resolved
|
|
28
|
-
* absolute cwd and each allowed dir, then deny everything else. First-match-wins, so the allow
|
|
29
|
-
* rules must come before the catch-all deny.
|
|
30
|
-
*/
|
|
31
|
-
export declare function allowDirsToPermissions(allowDirs: string[]): FilesystemPermission[];
|
|
32
|
-
/**
|
|
33
|
-
* Convert `.aiignore` patterns (relative, .gitignore-ish) into deepagents deny rules.
|
|
34
|
-
*
|
|
35
|
-
* deepagents matches the path argument the model passes to a fs tool against ABSOLUTE
|
|
36
|
-
* globs. EXT-13: the backend now runs WITHOUT virtualMode in both the default and widened
|
|
37
|
-
* cases, so paths are REAL absolute paths and the caller passes the absolute cwd as `base`
|
|
38
|
-
* to anchor these deny rules there.
|
|
39
|
-
*
|
|
40
|
-
* A bare pattern (`*.env`, `secret.txt`) should match at any depth, so we emit both a
|
|
41
|
-
* top-level (`<base>/secret.txt`) and a recursive (`<base>/**/secret.txt`) rule. A pattern
|
|
42
|
-
* already containing "/" (`config/secrets.json`) is anchored as-is (plus a `/**` subtree rule).
|
|
43
|
-
*
|
|
44
|
-
* `base` defaults to "" (anchoring at the virtual root "/") for legacy callers; gsloth's
|
|
45
|
-
* {@link buildPermissions} always passes the absolute cwd now.
|
|
46
|
-
*/
|
|
47
|
-
export declare function aiignoreToPermissions(patterns: string[], base?: string): FilesystemPermission[];
|
|
48
|
-
/**
|
|
49
|
-
* Map gsloth's filesystem mode onto deepagents permission rules for the DEFAULT
|
|
50
|
-
* (non-widen) code-mode sandbox.
|
|
51
|
-
*
|
|
52
|
-
* EXT-13: the default backend now runs WITHOUT virtualMode (real absolute paths), so
|
|
53
|
-
* containment can no longer lean on the virtual-root chroot — it is enforced entirely by
|
|
54
|
-
* these globs anchored at the REAL absolute cwd. We therefore allow read+write within
|
|
55
|
-
* `cwd/**` (and `cwd`) and deny everything else (`/**`), mirroring what virtualMode gave
|
|
56
|
-
* for free. An explicit `string[]` allow-list resolves each entry against the real cwd.
|
|
57
|
-
*
|
|
58
|
-
* - `all` → no extra restriction beyond the cwd sandbox (matches the old virtualMode
|
|
59
|
-
* behavior, where `/` already meant cwd).
|
|
60
|
-
* - `read` → deny all writes (the cwd sandbox still applies for reads).
|
|
61
|
-
* - `none` → deny all reads and writes.
|
|
62
|
-
* - `string[]` → allow each (cwd-resolved) dir, deny everything else.
|
|
63
|
-
*
|
|
64
|
-
* The `cwd` argument is injected (defaults to {@link getCurrentWorkDir}) so callers/tests
|
|
65
|
-
* can anchor deterministically.
|
|
66
|
-
*/
|
|
67
|
-
export declare function filesystemModeToPermissions(fs: string[] | 'all' | 'read' | 'none', cwd?: string, virtual?: boolean): FilesystemPermission[];
|
|
68
|
-
/**
|
|
69
|
-
* Compose the full permission list. `.aiignore` deny rules go FIRST so they win over
|
|
70
|
-
* any allow rule (first-match-wins). Then the filesystem-mode rules. `.aiignore` is
|
|
71
|
-
* skipped when explicitly disabled (`aiignore.enabled === false`) or has no patterns.
|
|
72
|
-
*/
|
|
73
|
-
export declare function buildPermissions(config: PermissionConfigSlice, virtual?: boolean): FilesystemPermission[];
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { getCurrentWorkDir } from '@gaunt-sloth/core/utils/systemUtils.js';
|
|
3
|
-
/**
|
|
4
|
-
* Tool names deepagents' filesystem middleware registers. This mirrors deepagents'
|
|
5
|
-
* internal `FILESYSTEM_TOOL_NAMES` (which is declared in its types but not exported
|
|
6
|
-
* at runtime). `createDeepAgent` throws on a name collision with any of these, so a
|
|
7
|
-
* gsloth-supplied tool sharing one of these names is superseded by the deep agent's
|
|
8
|
-
* built-in filesystem tool. Kept here as the single place the deep path references it.
|
|
9
|
-
*/
|
|
10
|
-
export const FILESYSTEM_TOOL_NAMES = [
|
|
11
|
-
'ls',
|
|
12
|
-
'read_file',
|
|
13
|
-
'write_file',
|
|
14
|
-
'edit_file',
|
|
15
|
-
'glob',
|
|
16
|
-
'grep',
|
|
17
|
-
'execute',
|
|
18
|
-
];
|
|
19
|
-
/**
|
|
20
|
-
* Build allow+deny rules for the widened (`--allow-dir`) sandbox. Because the backend runs
|
|
21
|
-
* without virtualMode, paths are REAL absolute paths, so we anchor allow rules at the resolved
|
|
22
|
-
* absolute cwd and each allowed dir, then deny everything else. First-match-wins, so the allow
|
|
23
|
-
* rules must come before the catch-all deny.
|
|
24
|
-
*/
|
|
25
|
-
export function allowDirsToPermissions(allowDirs) {
|
|
26
|
-
const cwd = getCurrentWorkDir();
|
|
27
|
-
const roots = [cwd, ...allowDirs.map((d) => path.resolve(cwd, d))];
|
|
28
|
-
// De-dupe resolved roots (e.g. an --allow-dir pointing back at cwd).
|
|
29
|
-
const uniqueRoots = Array.from(new Set(roots));
|
|
30
|
-
const allow = uniqueRoots.map((root) => ({
|
|
31
|
-
operations: ['read', 'write'],
|
|
32
|
-
paths: [`${root}/**`, root],
|
|
33
|
-
mode: 'allow',
|
|
34
|
-
}));
|
|
35
|
-
return [...allow, { operations: ['read', 'write'], paths: ['/**'], mode: 'deny' }];
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Strip a single leading "./" or "/" and any trailing slashes, using linear string
|
|
39
|
-
* ops rather than regex. The previous `/\/+$/` trailing-slash regex was flagged by
|
|
40
|
-
* CodeQL as a polynomial ReDoS (the `$` anchor makes the greedy `\/+` retry from every
|
|
41
|
-
* start position → quadratic on a long run of slashes); plain slicing is O(n) and safe.
|
|
42
|
-
*/
|
|
43
|
-
function normalizePathFragment(p) {
|
|
44
|
-
let start = 0;
|
|
45
|
-
if (p.startsWith('./'))
|
|
46
|
-
start = 2;
|
|
47
|
-
else if (p.startsWith('/'))
|
|
48
|
-
start = 1;
|
|
49
|
-
let end = p.length;
|
|
50
|
-
while (end > start && p[end - 1] === '/')
|
|
51
|
-
end--;
|
|
52
|
-
return p.slice(start, end);
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Convert `.aiignore` patterns (relative, .gitignore-ish) into deepagents deny rules.
|
|
56
|
-
*
|
|
57
|
-
* deepagents matches the path argument the model passes to a fs tool against ABSOLUTE
|
|
58
|
-
* globs. EXT-13: the backend now runs WITHOUT virtualMode in both the default and widened
|
|
59
|
-
* cases, so paths are REAL absolute paths and the caller passes the absolute cwd as `base`
|
|
60
|
-
* to anchor these deny rules there.
|
|
61
|
-
*
|
|
62
|
-
* A bare pattern (`*.env`, `secret.txt`) should match at any depth, so we emit both a
|
|
63
|
-
* top-level (`<base>/secret.txt`) and a recursive (`<base>/**/secret.txt`) rule. A pattern
|
|
64
|
-
* already containing "/" (`config/secrets.json`) is anchored as-is (plus a `/**` subtree rule).
|
|
65
|
-
*
|
|
66
|
-
* `base` defaults to "" (anchoring at the virtual root "/") for legacy callers; gsloth's
|
|
67
|
-
* {@link buildPermissions} always passes the absolute cwd now.
|
|
68
|
-
*/
|
|
69
|
-
export function aiignoreToPermissions(patterns, base = '') {
|
|
70
|
-
const rules = [];
|
|
71
|
-
for (const raw of patterns) {
|
|
72
|
-
const clean = normalizePathFragment(raw);
|
|
73
|
-
if (clean.length === 0)
|
|
74
|
-
continue;
|
|
75
|
-
const paths = clean.includes('/')
|
|
76
|
-
? [`${base}/${clean}`, `${base}/${clean}/**`]
|
|
77
|
-
: [`${base}/${clean}`, `${base}/**/${clean}`];
|
|
78
|
-
rules.push({ operations: ['read', 'write'], paths, mode: 'deny' });
|
|
79
|
-
}
|
|
80
|
-
return rules;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Map gsloth's filesystem mode onto deepagents permission rules for the DEFAULT
|
|
84
|
-
* (non-widen) code-mode sandbox.
|
|
85
|
-
*
|
|
86
|
-
* EXT-13: the default backend now runs WITHOUT virtualMode (real absolute paths), so
|
|
87
|
-
* containment can no longer lean on the virtual-root chroot — it is enforced entirely by
|
|
88
|
-
* these globs anchored at the REAL absolute cwd. We therefore allow read+write within
|
|
89
|
-
* `cwd/**` (and `cwd`) and deny everything else (`/**`), mirroring what virtualMode gave
|
|
90
|
-
* for free. An explicit `string[]` allow-list resolves each entry against the real cwd.
|
|
91
|
-
*
|
|
92
|
-
* - `all` → no extra restriction beyond the cwd sandbox (matches the old virtualMode
|
|
93
|
-
* behavior, where `/` already meant cwd).
|
|
94
|
-
* - `read` → deny all writes (the cwd sandbox still applies for reads).
|
|
95
|
-
* - `none` → deny all reads and writes.
|
|
96
|
-
* - `string[]` → allow each (cwd-resolved) dir, deny everything else.
|
|
97
|
-
*
|
|
98
|
-
* The `cwd` argument is injected (defaults to {@link getCurrentWorkDir}) so callers/tests
|
|
99
|
-
* can anchor deterministically.
|
|
100
|
-
*/
|
|
101
|
-
export function filesystemModeToPermissions(fs, cwd = getCurrentWorkDir(), virtual = false) {
|
|
102
|
-
// EXT-16: on Windows the real cwd (`D:\...`) cannot be expressed as a deepagents
|
|
103
|
-
// permission glob — its `validatePath` requires POSIX `/`-rooted paths — so the backend
|
|
104
|
-
// runs in virtualMode and these rules anchor at the virtual root `/` (= cwd) instead of
|
|
105
|
-
// the real absolute cwd. On POSIX, `virtual` is false and this is the EXT-13 real-path
|
|
106
|
-
// sandbox unchanged. `rootGlob`/`rootPath` = "everything under the sandbox root".
|
|
107
|
-
const rootGlob = virtual ? '/**' : `${cwd}/**`;
|
|
108
|
-
const rootPath = virtual ? '/' : cwd;
|
|
109
|
-
if (fs === 'none')
|
|
110
|
-
return [{ operations: ['read', 'write'], paths: ['/**'], mode: 'deny' }];
|
|
111
|
-
if (fs === 'read') {
|
|
112
|
-
// Deny all writes everywhere; reads are still confined to the cwd sandbox below.
|
|
113
|
-
return [
|
|
114
|
-
{ operations: ['write'], paths: ['/**'], mode: 'deny' },
|
|
115
|
-
{ operations: ['read'], paths: [rootGlob, rootPath], mode: 'allow' },
|
|
116
|
-
{ operations: ['read'], paths: ['/**'], mode: 'deny' },
|
|
117
|
-
];
|
|
118
|
-
}
|
|
119
|
-
if (fs === 'all') {
|
|
120
|
-
// No allow-list restriction, but the cwd sandbox must still apply by default
|
|
121
|
-
// (allow cwd/**, deny /**) — this is what virtualMode enforced implicitly.
|
|
122
|
-
return [
|
|
123
|
-
{ operations: ['read', 'write'], paths: [rootGlob, rootPath], mode: 'allow' },
|
|
124
|
-
{ operations: ['read', 'write'], paths: ['/**'], mode: 'deny' },
|
|
125
|
-
];
|
|
126
|
-
}
|
|
127
|
-
// string[] — explicit allow-list of directories. Real mode resolves each against the REAL
|
|
128
|
-
// cwd; virtual mode anchors each under the virtual root `/`. Allow read+write within each,
|
|
129
|
-
// deny everything else. Allow rules first (first-match-wins), deny catch-all last.
|
|
130
|
-
const allow = fs
|
|
131
|
-
.filter((d) => d !== 'all' && d !== 'read')
|
|
132
|
-
.map((d) => {
|
|
133
|
-
const frag = normalizePathFragment(d);
|
|
134
|
-
const dir = virtual ? `/${frag}` : path.resolve(cwd, frag);
|
|
135
|
-
return { operations: ['read', 'write'], paths: [`${dir}/**`, dir], mode: 'allow' };
|
|
136
|
-
});
|
|
137
|
-
return [...allow, { operations: ['read', 'write'], paths: ['/**'], mode: 'deny' }];
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Compose the full permission list. `.aiignore` deny rules go FIRST so they win over
|
|
141
|
-
* any allow rule (first-match-wins). Then the filesystem-mode rules. `.aiignore` is
|
|
142
|
-
* skipped when explicitly disabled (`aiignore.enabled === false`) or has no patterns.
|
|
143
|
-
*/
|
|
144
|
-
export function buildPermissions(config, virtual = false) {
|
|
145
|
-
const cwd = getCurrentWorkDir();
|
|
146
|
-
const widen = Array.isArray(config.allowDirs) && config.allowDirs.length > 0;
|
|
147
|
-
const aiignoreEnabled = config.aiignore?.enabled !== false && !!config.aiignore?.patterns?.length;
|
|
148
|
-
// EXT-13/EXT-16: real mode anchors aiignore deny rules at the absolute cwd; virtual mode
|
|
149
|
-
// (Windows) anchors them at the virtual root ("" → "/"). Either way they keep matching the
|
|
150
|
-
// project-relative ignore patterns.
|
|
151
|
-
const base = virtual ? '' : cwd;
|
|
152
|
-
const aiignore = aiignoreEnabled ? aiignoreToPermissions(config.aiignore.patterns, base) : [];
|
|
153
|
-
// `--allow-dir` widens to the cwd + allowed-dirs allow-list, which needs REAL absolute paths
|
|
154
|
-
// and so cannot apply in virtualMode (EXT-16): when virtual, fall back to the cwd-only mode
|
|
155
|
-
// sandbox (the caller warns that widening is limited on this platform).
|
|
156
|
-
const modeRules = widen && !virtual
|
|
157
|
-
? allowDirsToPermissions(config.allowDirs)
|
|
158
|
-
: filesystemModeToPermissions(config.filesystem, cwd, virtual);
|
|
159
|
-
return [...aiignore, ...modeRules];
|
|
160
|
-
}
|
|
161
|
-
//# sourceMappingURL=deepAgentPermissions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deepAgentPermissions.js","sourceRoot":"","sources":["../../src/core/deepAgentPermissions.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAI3E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,IAAI;IACJ,WAAW;IACX,YAAY;IACZ,WAAW;IACX,MAAM;IACN,MAAM;IACN,SAAS;CACD,CAAC;AAcX;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,SAAmB;IACxD,MAAM,GAAG,GAAG,iBAAiB,EAAE,CAAC;IAChC,MAAM,KAAK,GAAG,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACnE,qEAAqE;IACrE,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,KAAK,CAA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AAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;AACrF,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAC9B,MAA6B,EAC7B,OAAO,GAAG,KAAK;IAEf,MAAM,GAAG,GAAG,iBAAiB,EAAE,CAAC;IAChC,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;IAC7E,MAAM,eAAe,GAAG,MAAM,CAAC,QAAQ,EAAE,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC;IAClG,yFAAyF;IACzF,2FAA2F;IAC3F,oCAAoC;IACpC,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;IAChC,MAAM,QAAQ,GAAG,eAAe,CAAC,CAAC,CAAC,qBAAqB,CAAC,MAAM,CAAC,QAAS,CAAC,QAAS,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAChG,6FAA6F;IAC7F,4FAA4F;IAC5F,wEAAwE;IACxE,MAAM,SAAS,GACb,KAAK,IAAI,CAAC,OAAO;QACf,CAAC,CAAC,sBAAsB,CAAC,MAAM,CAAC,SAAU,CAAC;QAC3C,CAAC,CAAC,2BAA2B,CAAC,MAAM,CAAC,UAAU,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IACnE,OAAO,CAAC,GAAG,QAAQ,EAAE,GAAG,SAAS,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @packageDocumentation
|
|
3
|
-
* Thin wrapper over `deepagents-acp`'s `DeepAgentsServer` that fixes how its filesystem backend is
|
|
4
|
-
* rooted, since 0.1.12 gets both the location and the path semantics wrong for an IDE-hosted agent.
|
|
5
|
-
*
|
|
6
|
-
* 1. **Per-session root.** deepagents-acp roots its backend once at `workspaceRoot ?? process.cwd()`
|
|
7
|
-
* and IGNORES the `cwd` carried by every ACP `session/new` request. An ACP host (Zed, JetBrains)
|
|
8
|
-
* spawns one long-lived agent subprocess and passes the real project root per session, so we
|
|
9
|
-
* re-root the backend to `session/new.cwd`.
|
|
10
|
-
* 2. **Virtual-fs semantics.** deepagents-acp builds its backend WITHOUT `virtualMode`, so `/`
|
|
11
|
-
* resolves to the OS root and `ls /` lists the whole machine — but deepagents' filesystem prompt
|
|
12
|
-
* tells the model `/` is the workspace root (the convention the local runner uses via
|
|
13
|
-
* `FilesystemBackend({ virtualMode: true })`). We switch the backend into virtual-fs mode so
|
|
14
|
-
* `'/'`-rooted paths are workspace-relative.
|
|
15
|
-
*
|
|
16
|
-
* The server's connection handler dispatches `this.handleNewSession(params, conn)` dynamically, so
|
|
17
|
-
* we patch that instance method before `start()`. Both fixes reach into deepagents-acp internals and
|
|
18
|
-
* are guarded so a shape change degrades to a no-op rather than throwing; if a future deepagents-acp
|
|
19
|
-
* honors session cwd / virtual mode itself, this becomes a harmless re-assert.
|
|
20
|
-
*/
|
|
21
|
-
import { DeepAgentsServer, type DeepAgentsServerOptions } from 'deepagents-acp';
|
|
22
|
-
/**
|
|
23
|
-
* Construct and start a deepagents-acp server that roots its filesystem backend at each ACP
|
|
24
|
-
* session's `cwd` and runs it in virtual-fs mode (so `/` is the workspace, not the OS root).
|
|
25
|
-
* Resolves once the stdio transport is listening.
|
|
26
|
-
*/
|
|
27
|
-
export declare function startGthAcpServer(options: DeepAgentsServerOptions): Promise<DeepAgentsServer>;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @packageDocumentation
|
|
3
|
-
* Thin wrapper over `deepagents-acp`'s `DeepAgentsServer` that fixes how its filesystem backend is
|
|
4
|
-
* rooted, since 0.1.12 gets both the location and the path semantics wrong for an IDE-hosted agent.
|
|
5
|
-
*
|
|
6
|
-
* 1. **Per-session root.** deepagents-acp roots its backend once at `workspaceRoot ?? process.cwd()`
|
|
7
|
-
* and IGNORES the `cwd` carried by every ACP `session/new` request. An ACP host (Zed, JetBrains)
|
|
8
|
-
* spawns one long-lived agent subprocess and passes the real project root per session, so we
|
|
9
|
-
* re-root the backend to `session/new.cwd`.
|
|
10
|
-
* 2. **Virtual-fs semantics.** deepagents-acp builds its backend WITHOUT `virtualMode`, so `/`
|
|
11
|
-
* resolves to the OS root and `ls /` lists the whole machine — but deepagents' filesystem prompt
|
|
12
|
-
* tells the model `/` is the workspace root (the convention the local runner uses via
|
|
13
|
-
* `FilesystemBackend({ virtualMode: true })`). We switch the backend into virtual-fs mode so
|
|
14
|
-
* `'/'`-rooted paths are workspace-relative.
|
|
15
|
-
*
|
|
16
|
-
* The server's connection handler dispatches `this.handleNewSession(params, conn)` dynamically, so
|
|
17
|
-
* we patch that instance method before `start()`. Both fixes reach into deepagents-acp internals and
|
|
18
|
-
* are guarded so a shape change degrades to a no-op rather than throwing; if a future deepagents-acp
|
|
19
|
-
* honors session cwd / virtual mode itself, this becomes a harmless re-assert.
|
|
20
|
-
*/
|
|
21
|
-
import { DeepAgentsServer } from 'deepagents-acp';
|
|
22
|
-
import { resolve } from 'node:path';
|
|
23
|
-
import { debugLog } from '@gaunt-sloth/core/utils/debugUtils.js';
|
|
24
|
-
/**
|
|
25
|
-
* Put an ACP filesystem backend into deepagents' virtual-fs mode so `'/'`-rooted paths are
|
|
26
|
-
* workspace-relative (clamped under `cwd`), matching deepagents' prompt and the local runner.
|
|
27
|
-
*
|
|
28
|
-
* `virtualMode` covers the methods that route through `resolvePath` (ls) and the inline checks
|
|
29
|
-
* (glob/grep). The ACP read/write proxy uses its own `resolveAbsPath`, which ignores `virtualMode`,
|
|
30
|
-
* so override that too so proxied reads/writes hit the workspace, not the OS root.
|
|
31
|
-
*/
|
|
32
|
-
function configureVirtualFs(backend) {
|
|
33
|
-
backend.virtualMode = true;
|
|
34
|
-
backend.resolveAbsPath = (filePath) => resolve(backend.cwd ?? process.cwd(), String(filePath).replace(/^\/+/, ''));
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Construct and start a deepagents-acp server that roots its filesystem backend at each ACP
|
|
38
|
-
* session's `cwd` and runs it in virtual-fs mode (so `/` is the workspace, not the OS root).
|
|
39
|
-
* Resolves once the stdio transport is listening.
|
|
40
|
-
*/
|
|
41
|
-
export async function startGthAcpServer(options) {
|
|
42
|
-
const server = new DeepAgentsServer(options);
|
|
43
|
-
const internals = server;
|
|
44
|
-
const original = internals.handleNewSession;
|
|
45
|
-
if (typeof original === 'function') {
|
|
46
|
-
const bound = original.bind(server);
|
|
47
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
48
|
-
internals.handleNewSession = async (params, conn) => {
|
|
49
|
-
const result = await bound(params, conn);
|
|
50
|
-
const backends = internals.acpBackends;
|
|
51
|
-
const cwd = typeof params?.cwd === 'string' && params.cwd.length > 0 ? resolve(params.cwd) : undefined;
|
|
52
|
-
if (backends && backends.size > 0) {
|
|
53
|
-
for (const backend of backends.values()) {
|
|
54
|
-
if (!backend || typeof backend !== 'object')
|
|
55
|
-
continue;
|
|
56
|
-
if (cwd)
|
|
57
|
-
backend.cwd = cwd;
|
|
58
|
-
configureVirtualFs(backend);
|
|
59
|
-
}
|
|
60
|
-
debugLog(`ACP session: virtual fs, root ${cwd ?? '[startup workspace]'}`);
|
|
61
|
-
}
|
|
62
|
-
return result;
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
debugLog('deepagents-acp handleNewSession not found to patch; session fs rooting disabled');
|
|
67
|
-
}
|
|
68
|
-
await server.start();
|
|
69
|
-
return server;
|
|
70
|
-
}
|
|
71
|
-
//# sourceMappingURL=gthAcpServer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gthAcpServer.js","sourceRoot":"","sources":["../../src/core/gthAcpServer.ts"],"names":[],"mappings":"AAAA;;;;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,CAAC;YAC7F,IAAI,QAAQ,IAAI,QAAQ,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;gBAClC,KAAK,MAAM,OAAO,IAAI,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;oBACxC,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ;wBAAE,SAAS;oBACtD,IAAI,GAAG;wBAAE,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC;oBAC3B,kBAAkB,CAAC,OAAO,CAAC,CAAC;gBAC9B,CAAC;gBACD,QAAQ,CAAC,iCAAiC,GAAG,IAAI,qBAAqB,EAAE,CAAC,CAAC;YAC5E,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,QAAQ,CAAC,iFAAiF,CAAC,CAAC;IAC9F,CAAC;IAED,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;IACrB,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { GthAgentFactory } from '@gaunt-sloth/core/core/types.js';
|
|
2
|
-
/**
|
|
3
|
-
* A {@link GthAgentFactory} that produces a {@link GthDeepAgent}. Pass this to
|
|
4
|
-
* `GthAgentRunner` (its optional 3rd ctor arg) so the same runner drives a
|
|
5
|
-
* `createDeepAgent` graph instead of the lean default — without `core` ever
|
|
6
|
-
* importing `deepagents`.
|
|
7
|
-
*/
|
|
8
|
-
export declare const gthDeepAgentFactory: GthAgentFactory;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { GthDeepAgent } from '#src/core/GthDeepAgent.js';
|
|
2
|
-
/**
|
|
3
|
-
* A {@link GthAgentFactory} that produces a {@link GthDeepAgent}. Pass this to
|
|
4
|
-
* `GthAgentRunner` (its optional 3rd ctor arg) so the same runner drives a
|
|
5
|
-
* `createDeepAgent` graph instead of the lean default — without `core` ever
|
|
6
|
-
* importing `deepagents`.
|
|
7
|
-
*/
|
|
8
|
-
export const gthDeepAgentFactory = (statusUpdate, resolvers) => new GthDeepAgent(statusUpdate, resolvers);
|
|
9
|
-
//# sourceMappingURL=gthDeepAgentFactory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gthDeepAgentFactory.js","sourceRoot":"","sources":["../../src/core/gthDeepAgentFactory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAoB,CAAC,YAAY,EAAE,SAAS,EAAE,EAAE,CAC9E,IAAI,YAAY,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @packageDocumentation
|
|
3
|
-
* ACP (Agent Client Protocol) server entry for the Gaunt Sloth deep agent.
|
|
4
|
-
*
|
|
5
|
-
* This is a parallel front-door to the AG-UI server ({@link startAgUiServer}); both expose
|
|
6
|
-
* the SAME {@link GthDeepAgent}. AG-UI stays the robot-controller path; ACP is an additional
|
|
7
|
-
* way to drive Galvanized Pukeko from an ACP host (Zed, JetBrains, a future Pukeko client).
|
|
8
|
-
*
|
|
9
|
-
* It reuses {@link GthDeepAgent.buildDeepAgentParams} so tool resolution (with the filesystem
|
|
10
|
-
* disabled so deepagents owns fs access), the `.aiignore`/filesystem→permission mapping and the
|
|
11
|
-
* fs-denial-softening middleware are identical to the local runner path. `deepagents-acp`
|
|
12
|
-
* supplies the rest of the coding-agent surface itself: a per-session `ACPFilesystemBackend`
|
|
13
|
-
* (proxying reads/writes through the ACP client so unsaved editor buffers are visible), the
|
|
14
|
-
* checkpointer, interactive `session/request_permission` gating, and tool-call/plan reporting.
|
|
15
|
-
*/
|
|
16
|
-
import type { GthConfig } from '@gaunt-sloth/core/config.js';
|
|
17
|
-
import type { GthCommand } from '@gaunt-sloth/core/core/types.js';
|
|
18
|
-
export interface StartAcpServerOptions {
|
|
19
|
-
/** Agent name advertised to the ACP client (used for session routing). */
|
|
20
|
-
name?: string;
|
|
21
|
-
/** Human-readable description shown to ACP clients when listing agents. */
|
|
22
|
-
description?: string;
|
|
23
|
-
/** gsloth command whose config/prompt to apply (defaults to `'code'`, the full-fs agent). */
|
|
24
|
-
command?: GthCommand;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Start the Gaunt Sloth deep agent as an ACP server over stdio.
|
|
28
|
-
*
|
|
29
|
-
* Resolves once the stdio transport is listening; the process then stays alive serving the
|
|
30
|
-
* ACP host until it is terminated. The returned promise rejecting means startup failed.
|
|
31
|
-
*
|
|
32
|
-
* NOTE: deepagents-acp 0.1.12 does NOT forward `permissions` to `createDeepAgent` — on the ACP
|
|
33
|
-
* path fs gating is delegated to the host's interactive permission prompts, not gsloth's
|
|
34
|
-
* `.aiignore`→permissions mapping. `permissions` is still passed here for forward-compatibility.
|
|
35
|
-
* EXT-13 caveat: the ACP backend keeps `virtualMode` ON (`/` = workspace, see gthAcpServer), while
|
|
36
|
-
* EXT-13 re-anchored gsloth's default permissions at the REAL absolute cwd for the local runner. So
|
|
37
|
-
* if a future deepagents-acp DOES forward these rules they would not match the virtual `/`-rooted
|
|
38
|
-
* paths the ACP backend hands them — revisit the mapping (or the ACP backend's mode) at that point.
|
|
39
|
-
*/
|
|
40
|
-
export declare function startAcpServer(config: GthConfig, options?: StartAcpServerOptions): Promise<void>;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @packageDocumentation
|
|
3
|
-
* ACP (Agent Client Protocol) server entry for the Gaunt Sloth deep agent.
|
|
4
|
-
*
|
|
5
|
-
* This is a parallel front-door to the AG-UI server ({@link startAgUiServer}); both expose
|
|
6
|
-
* the SAME {@link GthDeepAgent}. AG-UI stays the robot-controller path; ACP is an additional
|
|
7
|
-
* way to drive Galvanized Pukeko from an ACP host (Zed, JetBrains, a future Pukeko client).
|
|
8
|
-
*
|
|
9
|
-
* It reuses {@link GthDeepAgent.buildDeepAgentParams} so tool resolution (with the filesystem
|
|
10
|
-
* disabled so deepagents owns fs access), the `.aiignore`/filesystem→permission mapping and the
|
|
11
|
-
* fs-denial-softening middleware are identical to the local runner path. `deepagents-acp`
|
|
12
|
-
* supplies the rest of the coding-agent surface itself: a per-session `ACPFilesystemBackend`
|
|
13
|
-
* (proxying reads/writes through the ACP client so unsaved editor buffers are visible), the
|
|
14
|
-
* checkpointer, interactive `session/request_permission` gating, and tool-call/plan reporting.
|
|
15
|
-
*/
|
|
16
|
-
import { getProcessCwd, stderr } from '@gaunt-sloth/core/utils/systemUtils.js';
|
|
17
|
-
import { debugLog } from '@gaunt-sloth/core/utils/debugUtils.js';
|
|
18
|
-
import { GthDeepAgent } from '#src/core/GthDeepAgent.js';
|
|
19
|
-
import { startGthAcpServer } from '#src/core/gthAcpServer.js';
|
|
20
|
-
import { createResolvers } from '#src/resolvers.js';
|
|
21
|
-
/**
|
|
22
|
-
* ACP-side status routing: the ACP protocol owns stdout (JSON-RPC framing), so agent
|
|
23
|
-
* status/info must never touch it. Route everything to stderr.
|
|
24
|
-
*/
|
|
25
|
-
const acpStatusUpdate = (_level, message) => {
|
|
26
|
-
stderr.write(`${message}\n`);
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Start the Gaunt Sloth deep agent as an ACP server over stdio.
|
|
30
|
-
*
|
|
31
|
-
* Resolves once the stdio transport is listening; the process then stays alive serving the
|
|
32
|
-
* ACP host until it is terminated. The returned promise rejecting means startup failed.
|
|
33
|
-
*
|
|
34
|
-
* NOTE: deepagents-acp 0.1.12 does NOT forward `permissions` to `createDeepAgent` — on the ACP
|
|
35
|
-
* path fs gating is delegated to the host's interactive permission prompts, not gsloth's
|
|
36
|
-
* `.aiignore`→permissions mapping. `permissions` is still passed here for forward-compatibility.
|
|
37
|
-
* EXT-13 caveat: the ACP backend keeps `virtualMode` ON (`/` = workspace, see gthAcpServer), while
|
|
38
|
-
* EXT-13 re-anchored gsloth's default permissions at the REAL absolute cwd for the local runner. So
|
|
39
|
-
* if a future deepagents-acp DOES forward these rules they would not match the virtual `/`-rooted
|
|
40
|
-
* paths the ACP backend hands them — revisit the mapping (or the ACP backend's mode) at that point.
|
|
41
|
-
*/
|
|
42
|
-
export async function startAcpServer(config, options = {}) {
|
|
43
|
-
const command = options.command ?? 'code';
|
|
44
|
-
const agent = new GthDeepAgent(acpStatusUpdate, createResolvers());
|
|
45
|
-
const params = await agent.buildDeepAgentParams(command, config);
|
|
46
|
-
// gsloth's composed system prompt (backstory + guidelines + per-command mode prompt + system
|
|
47
|
-
// prompt) comes back on `params.systemPrompt` — the SAME prompt the local runner passes to
|
|
48
|
-
// createDeepAgent. ACP has no per-turn hook, so it sets the agent's `systemPrompt` here.
|
|
49
|
-
const systemPrompt = params.systemPrompt;
|
|
50
|
-
// workspaceRoot is only the startup default: startGthAcpServer re-roots the filesystem backend
|
|
51
|
-
// to each ACP session's `cwd` (the IDE's project root). Use the raw process cwd, not
|
|
52
|
-
// getCurrentWorkDir() — its INIT_CWD preference leaks stale paths into this long-lived subprocess.
|
|
53
|
-
const workspaceRoot = getProcessCwd();
|
|
54
|
-
debugLog(`Starting ACP server (command: ${command}, startup workspace: ${workspaceRoot})`);
|
|
55
|
-
await startGthAcpServer({
|
|
56
|
-
agents: {
|
|
57
|
-
name: options.name ?? 'gaunt-sloth',
|
|
58
|
-
description: options.description ?? 'Gaunt Sloth deep coding agent',
|
|
59
|
-
model: params.model,
|
|
60
|
-
tools: params.tools,
|
|
61
|
-
systemPrompt,
|
|
62
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
63
|
-
middleware: params.middleware,
|
|
64
|
-
// Forward-compat: ignored by deepagents-acp 0.1.12 (the host gates fs interactively).
|
|
65
|
-
permissions: params.permissions,
|
|
66
|
-
},
|
|
67
|
-
workspaceRoot,
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
//# sourceMappingURL=acpModule.js.map
|
|
@@ -1 +0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O,CAAC,WAAW,IAAI,+BAA+B;YACnE,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,YAAY;YACZ,8DAA8D;YAC9D,UAAU,EAAE,MAAM,CAAC,UAAiB;YACpC,sFAAsF;YACtF,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC;QACD,aAAa;KACd,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module tools/shell/allowlist
|
|
3
|
-
*
|
|
4
|
-
* Re-export of the EXT-9 Tier-2 allow-list engine. The implementation lives in
|
|
5
|
-
* `@gaunt-sloth/core` (`core/shell/allowlist`) because the core {@link GthAgentRunner}
|
|
6
|
-
* owns the per-instance session store and the loaded persisted store and consults
|
|
7
|
-
* `matchesApproval` before prompting (core cannot import from `@gaunt-sloth/agent`).
|
|
8
|
-
*
|
|
9
|
-
* See the core module for the exact safe-bin / anti-widening matching rule.
|
|
10
|
-
*/
|
|
11
|
-
export { matchesApproval, hasWideningFlag, AllowlistStore, PersistedAllowlist, type ApprovalScope, type ApprovalStores, } from '@gaunt-sloth/core/core/shell/allowlist.js';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module tools/shell/allowlist
|
|
3
|
-
*
|
|
4
|
-
* Re-export of the EXT-9 Tier-2 allow-list engine. The implementation lives in
|
|
5
|
-
* `@gaunt-sloth/core` (`core/shell/allowlist`) because the core {@link GthAgentRunner}
|
|
6
|
-
* owns the per-instance session store and the loaded persisted store and consults
|
|
7
|
-
* `matchesApproval` before prompting (core cannot import from `@gaunt-sloth/agent`).
|
|
8
|
-
*
|
|
9
|
-
* See the core module for the exact safe-bin / anti-widening matching rule.
|
|
10
|
-
*/
|
|
11
|
-
export { matchesApproval, hasWideningFlag, AllowlistStore, PersistedAllowlist, } from '@gaunt-sloth/core/core/shell/allowlist.js';
|
|
12
|
-
//# sourceMappingURL=allowlist.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"allowlist.js","sourceRoot":"","sources":["../../../src/tools/shell/allowlist.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EACL,eAAe,EACf,eAAe,EACf,cAAc,EACd,kBAAkB,GAGnB,MAAM,2CAA2C,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module tools/shell/arity
|
|
3
|
-
*
|
|
4
|
-
* Re-export of the EXT-9 Tier-2 command classifier. The implementation lives in
|
|
5
|
-
* `@gaunt-sloth/core` (`core/shell/arity`) because the core {@link GthAgentRunner}
|
|
6
|
-
* must consult it BEFORE prompting (and core cannot import from `@gaunt-sloth/agent`).
|
|
7
|
-
* This stable agent-side path is kept for tests and any agent-layer consumers.
|
|
8
|
-
*
|
|
9
|
-
* See the core module for the arity table scope and the anti-injection fail-closed rule.
|
|
10
|
-
*/
|
|
11
|
-
export { classifyCommand, tokenize, meaningfulPrefixTokens, type CommandClassification, } from '@gaunt-sloth/core/core/shell/arity.js';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module tools/shell/arity
|
|
3
|
-
*
|
|
4
|
-
* Re-export of the EXT-9 Tier-2 command classifier. The implementation lives in
|
|
5
|
-
* `@gaunt-sloth/core` (`core/shell/arity`) because the core {@link GthAgentRunner}
|
|
6
|
-
* must consult it BEFORE prompting (and core cannot import from `@gaunt-sloth/agent`).
|
|
7
|
-
* This stable agent-side path is kept for tests and any agent-layer consumers.
|
|
8
|
-
*
|
|
9
|
-
* See the core module for the arity table scope and the anti-injection fail-closed rule.
|
|
10
|
-
*/
|
|
11
|
-
export { classifyCommand, tokenize, meaningfulPrefixTokens, } from '@gaunt-sloth/core/core/shell/arity.js';
|
|
12
|
-
//# sourceMappingURL=arity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"arity.js","sourceRoot":"","sources":["../../../src/tools/shell/arity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EACL,eAAe,EACf,QAAQ,EACR,sBAAsB,GAEvB,MAAM,uCAAuC,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hardline patterns: [regex, human description]. Matched case-insensitively
|
|
3
|
-
* against the normalized command.
|
|
4
|
-
*/
|
|
5
|
-
export declare const HARDLINE_PATTERNS: ReadonlyArray<readonly [RegExp, string]>;
|
|
6
|
-
export interface HardlineMatch {
|
|
7
|
-
/** Human-readable reason the command was refused. */
|
|
8
|
-
description: string;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Check a raw command against the hardline blocklist. Normalizes first so
|
|
12
|
-
* obfuscated variants are caught. Returns the match (with a description) when the
|
|
13
|
-
* command is catastrophic, or `null` when it is allowed to proceed.
|
|
14
|
-
*/
|
|
15
|
-
export declare function checkHardline(command: string): HardlineMatch | null;
|