@dungle-scrubs/harness-cli-normalizer 0.4.6 → 0.5.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.
- package/README.md +43 -3
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +5 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +65 -0
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/help.d.ts +2 -2
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +25 -7
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/inspect.d.ts.map +1 -1
- package/dist/cli/inspect.js +63 -24
- package/dist/cli/inspect.js.map +1 -1
- package/dist/cli/refuse.d.ts +14 -0
- package/dist/cli/refuse.d.ts.map +1 -0
- package/dist/cli/refuse.js +38 -0
- package/dist/cli/refuse.js.map +1 -0
- package/dist/cli/run.d.ts.map +1 -1
- package/dist/cli/run.js +9 -40
- package/dist/cli/run.js.map +1 -1
- package/dist/interpretation/argv.d.ts +3 -0
- package/dist/interpretation/argv.d.ts.map +1 -1
- package/dist/interpretation/argv.js +2 -0
- package/dist/interpretation/argv.js.map +1 -1
- package/dist/interpretation/hints.d.ts.map +1 -1
- package/dist/interpretation/hints.js +4 -0
- package/dist/interpretation/hints.js.map +1 -1
- package/dist/interpretation/resolve-options.d.ts.map +1 -1
- package/dist/interpretation/resolve-options.js +124 -3
- package/dist/interpretation/resolve-options.js.map +1 -1
- package/dist/interpretation/support.d.ts +1 -0
- package/dist/interpretation/support.d.ts.map +1 -1
- package/dist/interpretation/support.js +29 -0
- package/dist/interpretation/support.js.map +1 -1
- package/dist/interpretation/tool-selection.d.ts +6 -16
- package/dist/interpretation/tool-selection.d.ts.map +1 -1
- package/dist/interpretation/tool-selection.js +205 -85
- package/dist/interpretation/tool-selection.js.map +1 -1
- package/dist/interpretation/tool-vocabulary.d.ts +38 -0
- package/dist/interpretation/tool-vocabulary.d.ts.map +1 -0
- package/dist/interpretation/tool-vocabulary.js +142 -0
- package/dist/interpretation/tool-vocabulary.js.map +1 -0
- package/dist/interpretation/turn-options.d.ts.map +1 -1
- package/dist/interpretation/turn-options.js +107 -2
- package/dist/interpretation/turn-options.js.map +1 -1
- package/dist/interpretation/vocabulary.d.ts +1 -0
- package/dist/interpretation/vocabulary.d.ts.map +1 -1
- package/dist/interpretation/vocabulary.js +5 -0
- package/dist/interpretation/vocabulary.js.map +1 -1
- package/dist/knowledge/claude-code.d.ts.map +1 -1
- package/dist/knowledge/claude-code.js +14 -13
- package/dist/knowledge/claude-code.js.map +1 -1
- package/dist/knowledge/codex.d.ts.map +1 -1
- package/dist/knowledge/codex.js +10 -4
- package/dist/knowledge/codex.js.map +1 -1
- package/dist/knowledge/descriptor.d.ts +16 -1
- package/dist/knowledge/descriptor.d.ts.map +1 -1
- package/dist/knowledge/descriptor.js +18 -1
- package/dist/knowledge/descriptor.js.map +1 -1
- package/dist/knowledge/muse.d.ts.map +1 -1
- package/dist/knowledge/muse.js +18 -3
- package/dist/knowledge/muse.js.map +1 -1
- package/dist/knowledge/overrides.d.ts.map +1 -1
- package/dist/knowledge/overrides.js +3 -2
- package/dist/knowledge/overrides.js.map +1 -1
- package/dist/knowledge/pi.d.ts.map +1 -1
- package/dist/knowledge/pi.js +8 -7
- package/dist/knowledge/pi.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/args.ts +5 -0
- package/src/cli/config.ts +88 -0
- package/src/cli/help.ts +25 -7
- package/src/cli/inspect.ts +61 -20
- package/src/cli/refuse.ts +50 -0
- package/src/cli/run.ts +9 -58
- package/src/interpretation/argv.ts +5 -0
- package/src/interpretation/hints.ts +8 -0
- package/src/interpretation/resolve-options.ts +129 -3
- package/src/interpretation/support.ts +30 -0
- package/src/interpretation/tool-selection.ts +225 -101
- package/src/interpretation/tool-vocabulary.ts +183 -0
- package/src/interpretation/turn-options.ts +99 -2
- package/src/interpretation/vocabulary.ts +5 -0
- package/src/knowledge/claude-code.ts +14 -13
- package/src/knowledge/codex.ts +10 -4
- package/src/knowledge/descriptor.ts +37 -2
- package/src/knowledge/muse.ts +18 -3
- package/src/knowledge/overrides.ts +4 -2
- package/src/knowledge/pi.ts +8 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"support.js","sourceRoot":"","sources":["../../src/interpretation/support.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"support.js","sourceRoot":"","sources":["../../src/interpretation/support.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAQtD,MAAM,UAAU,GAAG,CAAC,CAAoB,EAAE,MAAqB,EAAiB,EAAE;IAChF,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,GAAG,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC;YAClC,IAAI,IAAI,KAAK,SAAS;gBAAE,OAAO,IAAI,CAAC;YACpC,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY;gBAAE,OAAO,IAAI,CAAC,IAAI,CAAC;YACjD,IAAI,IAAI,CAAC,IAAI,KAAK,oBAAoB;gBAAE,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;YACzF,IAAI,IAAI,CAAC,IAAI,KAAK,aAAa;gBAC7B,OAAO,CAAC,CAAC,KAAK,CAAC,WAAW,IAAI,CAAC,CAAC,KAAK,CAAC,WAAW,IAAI,WAAW,CAAC;YACnE,OAAO,IAAI,CAAC;QACd,CAAC;QACD,KAAK,OAAO;YACV,OAAO,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC;QAC7B,KAAK,cAAc;YACjB,OAAO,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC;QAC7B,KAAK,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OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
|
@@ -1,29 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Tool-selection rendering
|
|
3
|
-
* per-harness argv tokens, per decisions D1-D3 and the Phase 0 evidence.
|
|
4
|
-
*
|
|
5
|
-
* Semantics:
|
|
6
|
-
* - include: exact allowlist over the descriptor's curated names. pi's flag
|
|
7
|
-
* is strict over built-ins, rendered directly. claude's include flag only
|
|
8
|
-
* pre-approves without restricting the visible set, so an exact allowlist
|
|
9
|
-
* on claude renders as a deny-complement (all known minus included).
|
|
10
|
-
* - exclude: the complement of the named tools over all descriptor-known
|
|
11
|
-
* names (D2). pi's native exclude subtracts from its default set (4
|
|
12
|
-
* tools), so a D2 exclude renders as a computed include list there.
|
|
13
|
-
* - mutual exclusion (D1): both flags in one call refuse.
|
|
14
|
-
* - extensible rule (D3): curated names validate and map; unknown
|
|
15
|
-
* clean-selector names pass through and are reported as unmapped so
|
|
16
|
-
* provenance can surface them.
|
|
2
|
+
* Tool-selection rendering with canonical vocabulary.
|
|
17
3
|
*/
|
|
18
4
|
import type { HarnessDescriptor } from "../knowledge/descriptor.js";
|
|
19
5
|
export declare const TOOL_SELECTOR: RegExp;
|
|
20
6
|
export interface ToolSelection {
|
|
21
7
|
readonly include?: readonly string[];
|
|
22
8
|
readonly exclude?: readonly string[];
|
|
9
|
+
readonly toolMap?: Readonly<Record<string, string>>;
|
|
23
10
|
}
|
|
24
11
|
export interface RenderedToolSelection {
|
|
25
12
|
readonly tokens: readonly string[];
|
|
26
|
-
readonly
|
|
13
|
+
readonly passthrough: readonly string[];
|
|
27
14
|
}
|
|
15
|
+
export declare const renderAccessPreset: (h: HarnessDescriptor, access: "read" | "write", opts?: {
|
|
16
|
+
toolMap?: Readonly<Record<string, string>>;
|
|
17
|
+
}) => string[];
|
|
28
18
|
export declare const renderToolSelection: (h: HarnessDescriptor, selection: ToolSelection) => RenderedToolSelection;
|
|
29
19
|
//# sourceMappingURL=tool-selection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-selection.d.ts","sourceRoot":"","sources":["../../src/interpretation/tool-selection.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"tool-selection.d.ts","sourceRoot":"","sources":["../../src/interpretation/tool-selection.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAgBpE,eAAO,MAAM,aAAa,QAA0C,CAAC;AAErE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACrD;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC;AAkCD,eAAO,MAAM,kBAAkB,MAC1B,iBAAiB,UACZ,MAAM,GAAG,OAAO,SAClB;IAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CAAE,KACnD,MAAM,EAkBR,CAAC;AAEF,eAAO,MAAM,mBAAmB,MAC3B,iBAAiB,aACT,aAAa,KACvB,qBA0NF,CAAC"}
|
|
@@ -1,46 +1,61 @@
|
|
|
1
1
|
import { defaultDescriptors } from "../knowledge/overrides.js";
|
|
2
|
+
import { hintFor } from "./hints.js";
|
|
2
3
|
import { ArgvRefusalError } from "./refusal.js";
|
|
3
|
-
import { supportedBy } from "./support.js";
|
|
4
|
+
import { supportedBy, supportedByCanonical } from "./support.js";
|
|
5
|
+
import { allCanonicalNames, canonicalTable, parseToolSelector, READ_PRESET, } from "./tool-vocabulary.js";
|
|
4
6
|
export const TOOL_SELECTOR = /^[A-Za-z0-9][A-Za-z0-9._:/@-]{0,127}$/;
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
if (!TOOL_SELECTOR.test(name)) {
|
|
16
|
-
throw new ArgvRefusalError({
|
|
17
|
-
issue: "invalid-tool-grant",
|
|
18
|
-
harness: h.name,
|
|
19
|
-
supported: [`must match ${TOOL_SELECTOR.source}`],
|
|
20
|
-
detail: name,
|
|
21
|
-
});
|
|
22
|
-
}
|
|
7
|
+
const validateInnerName = (h, name, raw) => {
|
|
8
|
+
if (name.trim() === "" || name.includes(",")) {
|
|
9
|
+
throw new ArgvRefusalError({
|
|
10
|
+
issue: "invalid-tool-grant",
|
|
11
|
+
harness: h.name,
|
|
12
|
+
supported: ["non-empty, comma-free tool names"],
|
|
13
|
+
detail: `tools=${JSON.stringify(raw)}`,
|
|
14
|
+
});
|
|
23
15
|
}
|
|
24
|
-
|
|
16
|
+
if (!TOOL_SELECTOR.test(name)) {
|
|
17
|
+
throw new ArgvRefusalError({
|
|
18
|
+
issue: "invalid-tool-grant",
|
|
19
|
+
harness: h.name,
|
|
20
|
+
supported: [`must match ${TOOL_SELECTOR.source}`],
|
|
21
|
+
detail: name,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const categoriesFor = (h, canonicals, table) => {
|
|
26
|
+
const cats = new Set();
|
|
27
|
+
for (const c of canonicals) {
|
|
28
|
+
const val = table[c]?.[h.name];
|
|
29
|
+
if (val?.kind === "category")
|
|
30
|
+
cats.add(val.key);
|
|
31
|
+
}
|
|
32
|
+
return cats;
|
|
25
33
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
export const renderAccessPreset = (h, access, opts = {}) => {
|
|
35
|
+
if (access === "write")
|
|
36
|
+
return [];
|
|
37
|
+
// read preset
|
|
38
|
+
const filtered = READ_PRESET.filter((c) => {
|
|
39
|
+
if (opts.toolMap?.[c] !== undefined)
|
|
40
|
+
return true;
|
|
41
|
+
const table = canonicalTable(defaultDescriptors());
|
|
42
|
+
return table[c]?.[h.name] !== undefined;
|
|
43
|
+
});
|
|
44
|
+
if (filtered.length === 0)
|
|
45
|
+
return [];
|
|
46
|
+
// For tool-preset harnesses, render via tool-selection include
|
|
47
|
+
const spec = h.turnOptions.access;
|
|
48
|
+
if (spec && spec.kind === "tool-preset") {
|
|
49
|
+
const rendered = renderToolSelection(h, { include: filtered, toolMap: opts.toolMap });
|
|
50
|
+
return [...rendered.tokens];
|
|
37
51
|
}
|
|
38
|
-
|
|
52
|
+
// For flag-value / flag-list-by-value harnesses, caller should handle via spec mapping;
|
|
53
|
+
// we return empty here so turn-options can map via spec values.
|
|
54
|
+
return [];
|
|
39
55
|
};
|
|
40
56
|
export const renderToolSelection = (h, selection) => {
|
|
41
57
|
const hasInclude = selection.include !== undefined;
|
|
42
58
|
const hasExclude = selection.exclude !== undefined;
|
|
43
|
-
// D1: mutual exclusivity, structured refusal.
|
|
44
59
|
if (hasInclude && hasExclude) {
|
|
45
60
|
throw new ArgvRefusalError({
|
|
46
61
|
issue: "mutually-exclusive-options",
|
|
@@ -51,28 +66,108 @@ export const renderToolSelection = (h, selection) => {
|
|
|
51
66
|
});
|
|
52
67
|
}
|
|
53
68
|
if (!hasInclude && !hasExclude)
|
|
54
|
-
return { tokens: [],
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
69
|
+
return { tokens: [], passthrough: [] };
|
|
70
|
+
const set = defaultDescriptors();
|
|
71
|
+
const table = canonicalTable(set);
|
|
72
|
+
const toolMap = selection.toolMap ?? {};
|
|
73
|
+
const allCanonical = allCanonicalNames(set, {
|
|
74
|
+
[h.name]: toolMap,
|
|
75
|
+
});
|
|
76
|
+
const splitSelection = (names) => {
|
|
77
|
+
const canonical = [];
|
|
78
|
+
const passthrough = [];
|
|
79
|
+
const setForValidate = new Set(allCanonical);
|
|
80
|
+
for (const raw of names) {
|
|
81
|
+
const parsed = parseToolSelector(raw);
|
|
82
|
+
if (parsed.kind === "native") {
|
|
83
|
+
validateInnerName(h, parsed.name, names);
|
|
84
|
+
passthrough.push(parsed.name);
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
validateInnerName(h, parsed.name, names);
|
|
88
|
+
if (!setForValidate.has(parsed.name)) {
|
|
89
|
+
throw new ArgvRefusalError({
|
|
90
|
+
issue: "unknown-tool-name",
|
|
91
|
+
harness: h.name,
|
|
92
|
+
option: "tools",
|
|
93
|
+
supported: [...allCanonical],
|
|
94
|
+
hint: "use native:<name> for an extension or MCP tool",
|
|
95
|
+
detail: `unknown tool name(s) ${parsed.name}`,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
canonical.push(parsed.name);
|
|
99
|
+
}
|
|
100
|
+
return { canonical, passthrough };
|
|
101
|
+
};
|
|
102
|
+
const isCodexShape = h.tools.includeFlag === null && h.tools.categories.length === 0;
|
|
103
|
+
const isCategoryShape = h.tools.includeFlag === null && h.tools.categories.length > 0;
|
|
104
|
+
if (isCodexShape) {
|
|
58
105
|
throw new ArgvRefusalError({
|
|
59
106
|
issue: "unsupported-option",
|
|
60
107
|
harness: h.name,
|
|
61
|
-
option,
|
|
108
|
+
option: hasInclude ? "tools" : "excludeTools",
|
|
62
109
|
supported: ["per-tool name lists"],
|
|
63
|
-
supportedBy:
|
|
64
|
-
hint: h.name
|
|
65
|
-
|
|
66
|
-
: "nearest control on muse: category switches (--disable-write, --disable-shell, --disable-web-tools) gate tool execution per session",
|
|
110
|
+
supportedBy: supportedBy(set, hasInclude ? "tools" : "excludeTools"),
|
|
111
|
+
hint: hintFor(h.name, hasInclude ? "tools" : "excludeTools") ??
|
|
112
|
+
"nearest control on codex: category switches via config keys (features.shell_tool, web_search) or sandbox modes - see `hcn inspect codex`",
|
|
67
113
|
});
|
|
68
114
|
}
|
|
115
|
+
if (isCategoryShape) {
|
|
116
|
+
const names = hasInclude ? selection.include : selection.exclude;
|
|
117
|
+
const { canonical, passthrough } = splitSelection(names);
|
|
118
|
+
if (hasExclude) {
|
|
119
|
+
// one helper replaces the three no-counterpart loops
|
|
120
|
+
for (const c of canonical) {
|
|
121
|
+
const has = toolMap[c] !== undefined || table[c]?.[h.name] !== undefined;
|
|
122
|
+
if (!has) {
|
|
123
|
+
throw new ArgvRefusalError({
|
|
124
|
+
issue: "unsupported-option",
|
|
125
|
+
harness: h.name,
|
|
126
|
+
option: "excludeTools",
|
|
127
|
+
supported: ["per-tool name lists"],
|
|
128
|
+
supportedBy: supportedByCanonical(set, c),
|
|
129
|
+
hint: hintFor(h.name, "excludeTools"),
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
const cats = categoriesFor(h, canonical, table);
|
|
134
|
+
const tokens = [];
|
|
135
|
+
for (const cat of h.tools.categories) {
|
|
136
|
+
if (cats.has(cat.key) && cat.disableFlag)
|
|
137
|
+
tokens.push(cat.disableFlag);
|
|
138
|
+
}
|
|
139
|
+
return { tokens, passthrough };
|
|
140
|
+
}
|
|
141
|
+
for (const c of canonical) {
|
|
142
|
+
const has = toolMap[c] !== undefined || table[c]?.[h.name] !== undefined;
|
|
143
|
+
if (!has) {
|
|
144
|
+
throw new ArgvRefusalError({
|
|
145
|
+
issue: "unsupported-option",
|
|
146
|
+
harness: h.name,
|
|
147
|
+
option: "tools",
|
|
148
|
+
supported: ["per-tool name lists"],
|
|
149
|
+
supportedBy: supportedByCanonical(set, c),
|
|
150
|
+
hint: hintFor(h.name, "tools"),
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (canonical.length === 0) {
|
|
155
|
+
const tokens = h.tools.categories.map((c) => c.disableFlag).filter((f) => !!f);
|
|
156
|
+
return { tokens, passthrough };
|
|
157
|
+
}
|
|
158
|
+
const grantedCats = categoriesFor(h, canonical, table);
|
|
159
|
+
const tokens = [];
|
|
160
|
+
for (const cat of h.tools.categories) {
|
|
161
|
+
if (!grantedCats.has(cat.key) && cat.disableFlag)
|
|
162
|
+
tokens.push(cat.disableFlag);
|
|
163
|
+
}
|
|
164
|
+
return { tokens, passthrough };
|
|
165
|
+
}
|
|
166
|
+
// From here: h has list flags (claude, pi)
|
|
69
167
|
if (hasInclude) {
|
|
70
|
-
const names =
|
|
168
|
+
const names = selection.include;
|
|
71
169
|
if (names.length === 0) {
|
|
72
|
-
|
|
73
|
-
// defined meaning, so refuse; on claude emit the deny complement
|
|
74
|
-
// without an empty include token.
|
|
75
|
-
if (h.tools.includeIsStrictAllowlist || h.tools.excludeFlag === null) {
|
|
170
|
+
if (h.tools.includeIsStrictAllowlist) {
|
|
76
171
|
throw new ArgvRefusalError({
|
|
77
172
|
issue: "invalid-tool-grant",
|
|
78
173
|
harness: h.name,
|
|
@@ -82,66 +177,91 @@ export const renderToolSelection = (h, selection) => {
|
|
|
82
177
|
});
|
|
83
178
|
}
|
|
84
179
|
const known = h.tools.builtins.map((t) => t.name);
|
|
85
|
-
return { tokens: [h.tools.excludeFlag, known.join(",")],
|
|
180
|
+
return { tokens: [h.tools.excludeFlag, known.join(",")], passthrough: [] };
|
|
86
181
|
}
|
|
87
|
-
const {
|
|
88
|
-
|
|
89
|
-
|
|
182
|
+
const { canonical, passthrough } = splitSelection(names);
|
|
183
|
+
for (const c of canonical) {
|
|
184
|
+
const has = toolMap[c] !== undefined || table[c]?.[h.name] !== undefined;
|
|
185
|
+
if (!has) {
|
|
90
186
|
throw new ArgvRefusalError({
|
|
91
|
-
issue: "
|
|
187
|
+
issue: "unsupported-option",
|
|
92
188
|
harness: h.name,
|
|
93
189
|
option: "tools",
|
|
94
|
-
supported: [
|
|
95
|
-
|
|
190
|
+
supported: ["per-tool name lists"],
|
|
191
|
+
supportedBy: supportedByCanonical(set, c),
|
|
192
|
+
hint: `add toolMap.${h.name}.${c} to ~/.config/hcn/config.json or pass native:${c}`,
|
|
96
193
|
});
|
|
97
194
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
195
|
+
}
|
|
196
|
+
const mapped = [];
|
|
197
|
+
for (const c of canonical) {
|
|
198
|
+
let n = toolMap[c] ?? null;
|
|
199
|
+
if (n === null) {
|
|
200
|
+
const entry = table[c]?.[h.name];
|
|
201
|
+
if (entry?.kind === "builtin")
|
|
202
|
+
n = entry.native;
|
|
203
|
+
}
|
|
204
|
+
if (n)
|
|
205
|
+
mapped.push(n);
|
|
206
|
+
}
|
|
207
|
+
if (!h.tools.includeIsStrictAllowlist) {
|
|
208
|
+
// claude's include flag pre-approves without restricting, so an exact allowlist renders as the deny complement
|
|
104
209
|
const known = h.tools.builtins.map((t) => t.name);
|
|
105
210
|
const excluded = known.filter((n) => !mapped.includes(n));
|
|
106
|
-
const tokens = [h.tools.includeFlag, [...mapped, ...
|
|
107
|
-
|
|
108
|
-
|
|
211
|
+
const tokens = [h.tools.includeFlag, [...mapped, ...passthrough].join(",")];
|
|
212
|
+
// only add exclude if needed? original pushed exclude even when? Keep original behavior: push excludeFlag excluded
|
|
213
|
+
if (excluded.length > 0 || passthrough.length > 0) {
|
|
214
|
+
tokens.push(h.tools.excludeFlag, excluded.join(","));
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
// when all tools included, exclude nothing? but keep token? original pushed exclude always
|
|
218
|
+
tokens.push(h.tools.excludeFlag, excluded.join(","));
|
|
219
|
+
}
|
|
220
|
+
return { tokens, passthrough };
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
tokens: [h.tools.includeFlag, [...mapped, ...passthrough].join(",")],
|
|
224
|
+
passthrough,
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
// exclude
|
|
228
|
+
const names = selection.exclude;
|
|
229
|
+
const { canonical, passthrough: excludedPassthrough } = splitSelection(names);
|
|
230
|
+
for (const c of canonical) {
|
|
231
|
+
const has = toolMap[c] !== undefined || table[c]?.[h.name] !== undefined;
|
|
232
|
+
if (!has) {
|
|
233
|
+
throw new ArgvRefusalError({
|
|
234
|
+
issue: "unsupported-option",
|
|
235
|
+
harness: h.name,
|
|
236
|
+
option: "excludeTools",
|
|
237
|
+
supported: ["per-tool name lists"],
|
|
238
|
+
supportedBy: supportedByCanonical(set, c),
|
|
239
|
+
hint: `add toolMap.${h.name}.${c} to ~/.config/hcn/config.json or pass native:${c}`,
|
|
240
|
+
});
|
|
109
241
|
}
|
|
110
|
-
// pi: strict over built-ins, direct include; unmapped (extension/MCP)
|
|
111
|
-
// names ride along in the same list - pi governs them too.
|
|
112
|
-
return { tokens: [h.tools.includeFlag, [...mapped, ...unmapped].join(",")], unmapped };
|
|
113
242
|
}
|
|
114
|
-
|
|
115
|
-
const names = validateNames(h, selection.exclude);
|
|
116
|
-
const { mapped, unmapped: excludedUnmapped } = resolveNames(h, names);
|
|
117
|
-
if (excludedUnmapped.length > 0) {
|
|
118
|
-
// Excluding a name the descriptor does not know: permitted (it may be a
|
|
119
|
-
// runtime-registered tool), rendered natively where the harness's deny
|
|
120
|
-
// list can carry it; on claude only, since its include path consumes
|
|
121
|
-
// unknown names without effect (silent-acceptance hazard).
|
|
243
|
+
if (excludedPassthrough.length > 0) {
|
|
122
244
|
if (!h.tools.includeIsStrictAllowlist) {
|
|
123
|
-
const
|
|
124
|
-
|
|
245
|
+
const mapped = canonical.map((c) => toolMap[c] ?? table[c]?.[h.name]?.native ?? c);
|
|
246
|
+
const tokens = [h.tools.excludeFlag, [...mapped, ...excludedPassthrough].join(",")];
|
|
247
|
+
return { tokens, passthrough: excludedPassthrough };
|
|
125
248
|
}
|
|
126
|
-
// pi: a D2 exclude renders as a computed include (its native exclude
|
|
127
|
-
// subtracts from the default set, which cannot express "all minus X"
|
|
128
|
-
// when off-by-default tools are involved). An unknown excluded name
|
|
129
|
-
// cannot be complemented - refuse rather than silently grant it.
|
|
130
249
|
throw new ArgvRefusalError({
|
|
131
250
|
issue: "unknown-tool-name",
|
|
132
251
|
harness: h.name,
|
|
133
252
|
option: "excludeTools",
|
|
134
253
|
supported: [`known tool names: ${h.tools.builtins.map((t) => t.name).join(", ")}`],
|
|
135
|
-
detail: `cannot exclude unknown name(s) ${
|
|
254
|
+
detail: `cannot exclude unknown name(s) ${excludedPassthrough.join(", ")}: the complement cannot be computed`,
|
|
136
255
|
});
|
|
137
256
|
}
|
|
257
|
+
const mapped = canonical
|
|
258
|
+
.map((c) => toolMap[c] ?? table[c]?.[h.name]?.native ?? "")
|
|
259
|
+
.filter(Boolean);
|
|
138
260
|
const known = h.tools.builtins.filter((t) => !mapped.includes(t.name));
|
|
139
261
|
const kept = known.map((t) => t.name);
|
|
140
262
|
if (!h.tools.includeIsStrictAllowlist) {
|
|
141
|
-
|
|
142
|
-
return { tokens: [h.tools.excludeFlag, mapped.join(",")], unmapped: [] };
|
|
263
|
+
return { tokens: [h.tools.excludeFlag, mapped.join(",")], passthrough: [] };
|
|
143
264
|
}
|
|
144
|
-
|
|
145
|
-
return { tokens: [h.tools.includeFlag, kept.join(",")], unmapped: [] };
|
|
265
|
+
return { tokens: [h.tools.includeFlag, kept.join(",")], passthrough: [] };
|
|
146
266
|
};
|
|
147
267
|
//# sourceMappingURL=tool-selection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-selection.js","sourceRoot":"","sources":["../../src/interpretation/tool-selection.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,CAAC,MAAM,aA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AC,CAAC,KAAK,CAAC,WAAY,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;IAC/E,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,WAAY,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;AAC7E,CAAC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { DescriptorSet } from "../knowledge/overrides.js";
|
|
2
|
+
export declare const NATIVE_PREFIX: "native:";
|
|
3
|
+
export type VocabularyEntry = {
|
|
4
|
+
kind: "builtin";
|
|
5
|
+
native: string;
|
|
6
|
+
} | {
|
|
7
|
+
kind: "category";
|
|
8
|
+
key: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const READ_PRESET: readonly ["read", "grep", "glob", "list", "web-fetch", "web-search"];
|
|
11
|
+
export type ParsedSelector = {
|
|
12
|
+
kind: "canonical";
|
|
13
|
+
name: string;
|
|
14
|
+
} | {
|
|
15
|
+
kind: "native";
|
|
16
|
+
name: string;
|
|
17
|
+
};
|
|
18
|
+
export declare const parseToolSelector: (raw: string) => ParsedSelector;
|
|
19
|
+
export type ToolMap = Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
20
|
+
export type ToolMapTier = "user-config" | "project-config";
|
|
21
|
+
export type MergedToolMap = Readonly<Record<string, Readonly<Record<string, {
|
|
22
|
+
native: string;
|
|
23
|
+
tier: ToolMapTier;
|
|
24
|
+
}>>>>;
|
|
25
|
+
/** Pure merge per harness per canonical: project > user. */
|
|
26
|
+
export declare const mergeToolMaps: (tiers: {
|
|
27
|
+
readonly user?: ToolMap;
|
|
28
|
+
readonly project?: ToolMap;
|
|
29
|
+
}) => MergedToolMap;
|
|
30
|
+
export type CanonicalTable = Readonly<Record<string, Readonly<Partial<Record<string, VocabularyEntry>>>>>;
|
|
31
|
+
export declare const canonicalTable: (set: DescriptorSet) => CanonicalTable;
|
|
32
|
+
export declare const canonicalToolTable: typeof canonicalTable;
|
|
33
|
+
export declare const canonicalNames: (set: DescriptorSet) => readonly string[];
|
|
34
|
+
export declare const allCanonicalNames: (set: DescriptorSet, toolMap?: ToolMap | MergedToolMap) => readonly string[];
|
|
35
|
+
export declare const hasCounterpart: (table: CanonicalTable, canonical: string, harnessName: string, toolMap?: MergedToolMap | ToolMap) => boolean;
|
|
36
|
+
export declare const nativeFor: (table: CanonicalTable, canonical: string, harnessName: string, toolMap?: MergedToolMap | ToolMap) => string | null;
|
|
37
|
+
export declare const validateCanonicalList: (names: readonly string[] | undefined, allCanonical: readonly string[], harness: string) => void;
|
|
38
|
+
//# sourceMappingURL=tool-vocabulary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-vocabulary.d.ts","sourceRoot":"","sources":["../../src/interpretation/tool-vocabulary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG/D,eAAO,MAAM,aAAa,EAAG,SAAkB,CAAC;AAEhD,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACnC;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtC,eAAO,MAAM,WAAW,YAAI,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,CAAU,CAAC;AAEhG,MAAM,MAAM,cAAc,GAAG;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpG,eAAO,MAAM,iBAAiB,QAAS,MAAM,KAAG,cAGV,CAAC;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,SAAS,MAAM,EAAE,GAAG,SAAS,gBACtB,SAAS,MAAM,EAAE,WACtB,MAAM,KACd,IAgBF,CAAC"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { ArgvRefusalError } from "./refusal.js";
|
|
2
|
+
export const NATIVE_PREFIX = "native:";
|
|
3
|
+
export const READ_PRESET = ["read", "grep", "glob", "list", "web-fetch", "web-search"];
|
|
4
|
+
export const parseToolSelector = (raw) => raw.startsWith(NATIVE_PREFIX)
|
|
5
|
+
? { kind: "native", name: raw.slice(NATIVE_PREFIX.length) }
|
|
6
|
+
: { kind: "canonical", name: raw };
|
|
7
|
+
/** Pure merge per harness per canonical: project > user. */
|
|
8
|
+
export const mergeToolMaps = (tiers) => {
|
|
9
|
+
const merged = {};
|
|
10
|
+
const harnesses = new Set([
|
|
11
|
+
...Object.keys(tiers.user ?? {}),
|
|
12
|
+
...Object.keys(tiers.project ?? {}),
|
|
13
|
+
]);
|
|
14
|
+
for (const h of harnesses) {
|
|
15
|
+
const userEntries = tiers.user?.[h] ?? {};
|
|
16
|
+
const projectEntries = tiers.project?.[h] ?? {};
|
|
17
|
+
const canonicals = new Set([
|
|
18
|
+
...Object.keys(userEntries),
|
|
19
|
+
...Object.keys(projectEntries),
|
|
20
|
+
]);
|
|
21
|
+
const perHarness = {};
|
|
22
|
+
for (const c of canonicals) {
|
|
23
|
+
if (projectEntries[c] !== undefined) {
|
|
24
|
+
perHarness[c] = { native: projectEntries[c], tier: "project-config" };
|
|
25
|
+
}
|
|
26
|
+
else if (userEntries[c] !== undefined) {
|
|
27
|
+
perHarness[c] = { native: userEntries[c], tier: "user-config" };
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (Object.keys(perHarness).length > 0) {
|
|
31
|
+
merged[h] = perHarness;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return merged;
|
|
35
|
+
};
|
|
36
|
+
const tableCache = new WeakMap();
|
|
37
|
+
export const canonicalTable = (set) => {
|
|
38
|
+
const cached = tableCache.get(set);
|
|
39
|
+
if (cached)
|
|
40
|
+
return cached;
|
|
41
|
+
const allCanonical = new Set();
|
|
42
|
+
for (const h of Object.values(set)) {
|
|
43
|
+
if (!h)
|
|
44
|
+
continue;
|
|
45
|
+
for (const b of h.tools.builtins) {
|
|
46
|
+
if (b.canonical !== null)
|
|
47
|
+
allCanonical.add(b.canonical);
|
|
48
|
+
}
|
|
49
|
+
for (const c of h.tools.categories) {
|
|
50
|
+
for (const n of c.canonical)
|
|
51
|
+
allCanonical.add(n);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const table = {};
|
|
55
|
+
for (const canonical of allCanonical) {
|
|
56
|
+
const perHarness = {};
|
|
57
|
+
for (const h of Object.values(set)) {
|
|
58
|
+
if (!h)
|
|
59
|
+
continue;
|
|
60
|
+
const builtin = h.tools.builtins.find((b) => b.canonical === canonical);
|
|
61
|
+
if (builtin) {
|
|
62
|
+
perHarness[h.name] = { kind: "builtin", native: builtin.name };
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
const cat = h.tools.categories.find((c) => c.canonical.includes(canonical));
|
|
66
|
+
if (cat) {
|
|
67
|
+
perHarness[h.name] = { kind: "category", key: cat.key };
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
table[canonical] = perHarness;
|
|
71
|
+
}
|
|
72
|
+
const frozen = table;
|
|
73
|
+
tableCache.set(set, frozen);
|
|
74
|
+
return frozen;
|
|
75
|
+
};
|
|
76
|
+
// Backwards compat alias
|
|
77
|
+
export const canonicalToolTable = canonicalTable;
|
|
78
|
+
export const canonicalNames = (set) => {
|
|
79
|
+
const table = canonicalTable(set);
|
|
80
|
+
return Object.keys(table).sort();
|
|
81
|
+
};
|
|
82
|
+
export const allCanonicalNames = (set, toolMap) => {
|
|
83
|
+
const base = canonicalNames(set);
|
|
84
|
+
const extra = toolMap
|
|
85
|
+
? Object.values(toolMap).flatMap((m) => Object.keys(m))
|
|
86
|
+
: [];
|
|
87
|
+
return [...new Set([...base, ...extra])].sort();
|
|
88
|
+
};
|
|
89
|
+
export const hasCounterpart = (table, canonical, harnessName, toolMap) => {
|
|
90
|
+
if (toolMap) {
|
|
91
|
+
const hm = toolMap[harnessName];
|
|
92
|
+
if (hm && hm[canonical] !== undefined) {
|
|
93
|
+
const v = hm[canonical];
|
|
94
|
+
if (typeof v === "object" && v !== null && "native" in v)
|
|
95
|
+
return true;
|
|
96
|
+
if (typeof v === "string")
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const entry = table[canonical];
|
|
101
|
+
if (!entry)
|
|
102
|
+
return false;
|
|
103
|
+
return entry[harnessName] !== undefined;
|
|
104
|
+
};
|
|
105
|
+
export const nativeFor = (table, canonical, harnessName, toolMap) => {
|
|
106
|
+
if (toolMap) {
|
|
107
|
+
const hm = toolMap[harnessName];
|
|
108
|
+
const val = hm?.[canonical];
|
|
109
|
+
if (val !== undefined) {
|
|
110
|
+
if (typeof val === "object" && val !== null && "native" in val) {
|
|
111
|
+
return val.native;
|
|
112
|
+
}
|
|
113
|
+
if (typeof val === "string")
|
|
114
|
+
return val;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const entry = table[canonical];
|
|
118
|
+
const v = entry?.[harnessName];
|
|
119
|
+
if (v?.kind === "builtin")
|
|
120
|
+
return v.native;
|
|
121
|
+
return null;
|
|
122
|
+
};
|
|
123
|
+
export const validateCanonicalList = (names, allCanonical, harness) => {
|
|
124
|
+
if (!names)
|
|
125
|
+
return;
|
|
126
|
+
const set = new Set(allCanonical);
|
|
127
|
+
for (const name of names) {
|
|
128
|
+
if (name.startsWith(NATIVE_PREFIX))
|
|
129
|
+
continue;
|
|
130
|
+
if (!set.has(name)) {
|
|
131
|
+
throw new ArgvRefusalError({
|
|
132
|
+
issue: "unknown-tool-name",
|
|
133
|
+
harness: harness,
|
|
134
|
+
option: "tools",
|
|
135
|
+
supported: allCanonical,
|
|
136
|
+
hint: "use native:<name> for an extension or MCP tool",
|
|
137
|
+
detail: `unknown tool name ${JSON.stringify(name)}`,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
//# sourceMappingURL=tool-vocabulary.js.map
|