@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":"overrides.d.ts","sourceRoot":"","sources":["../../src/knowledge/overrides.ts"],"names":[],"mappings":"AAgBA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAEjB,MAAM,iBAAiB,CAAC;AAIzB,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"overrides.d.ts","sourceRoot":"","sources":["../../src/knowledge/overrides.ts"],"names":[],"mappings":"AAgBA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAEjB,MAAM,iBAAiB,CAAC;AAIzB,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC;AAS5E,eAAO,MAAM,kBAAkB,QAAO,aAAmC,CAAC;AAE1E;;sDAEsD;AACtD,eAAO,MAAM,kBAAkB;WAA2C,MAAM;UAAQ,MAAM;EAAK,CAAC;AAEpG,qBAAa,oBAAqB,SAAQ,KAAK;IAE3C,QAAQ,CAAC,IAAI,EAAE,MAAM;IAErB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM;IAH3B,YACW,IAAI,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM,EACL,OAAO,CAAC,EAAE,MAAM,YAAA,EAM1B;CACF;AAiLD,sEAAsE;AACtE,eAAO,MAAM,cAAc,aAAc,MAAM,QAAQ,MAAM,KAAG,aAkD/D,CAAC"}
|
|
@@ -17,12 +17,13 @@ import { codexCli } from "./codex.js";
|
|
|
17
17
|
import { HARNESS_NAMES, SESSION_INPUT_KINDS, } from "./descriptor.js";
|
|
18
18
|
import { museCode } from "./muse.js";
|
|
19
19
|
import { piCli } from "./pi.js";
|
|
20
|
-
|
|
20
|
+
const SHARED_DESCRIPTORS = {
|
|
21
21
|
claude: claudeCode,
|
|
22
22
|
codex: codexCli,
|
|
23
23
|
pi: piCli,
|
|
24
24
|
muse: museCode,
|
|
25
|
-
}
|
|
25
|
+
};
|
|
26
|
+
export const defaultDescriptors = () => SHARED_DESCRIPTORS;
|
|
26
27
|
/** Tracks which descriptors were produced by an override file and what their
|
|
27
28
|
* matcher counts are, so the execution layer can emit `matcherOverrides` on
|
|
28
29
|
* the spawn boundary event without re-deriving it. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overrides.js","sourceRoot":"","sources":["../../src/knowledge/overrides.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EACL,aAAa,EAGb,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAIhC,MAAM,
|
|
1
|
+
{"version":3,"file":"overrides.js","sourceRoot":"","sources":["../../src/knowledge/overrides.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EACL,aAAa,EAGb,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAIhC,MAAM,kBAAkB,GAAkB;IACxC,MAAM,EAAE,UAAU;IAClB,KAAK,EAA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AAC,SAAS,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC;QAC1F,MAAM,WAAW,GACd,IAAI,CAAC,YAAkD,CAAC,MAAM;YAC5D,kBAAkB,CAAC,YAAkD,CAAC,MAAM;YAC/E,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;QACxF,IAAI,YAAY,IAAI,WAAW,EAAE,CAAC;YAChC,kBAAkB,CAAC,GAAG,CAAC,IAAI,EAAE;gBAC3B,KAAK,EAAG,IAAI,CAAC,aAAmD,CAAC,MAAM;gBACvE,IAAI,EAAG,IAAI,CAAC,YAAkD,CAAC,MAAM;aACtE,CAAC,CAAC;QACL,CAAC;QACD,MAAM,CAAC,IAAmB,CAAC,GAAG,IAAI,CAAC;IACrC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pi.d.ts","sourceRoot":"","sources":["../../src/knowledge/pi.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAc,KAAK,iBAAiB,EAAc,MAAM,iBAAiB,CAAC;AAGjF,eAAO,MAAM,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"pi.d.ts","sourceRoot":"","sources":["../../src/knowledge/pi.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAc,KAAK,iBAAiB,EAAc,MAAM,iBAAiB,CAAC;AAGjF,eAAO,MAAM,KAAK,EAAE,iBAyKlB,CAAC"}
|
package/dist/knowledge/pi.js
CHANGED
|
@@ -153,6 +153,7 @@ export const piCli = deepFreeze({
|
|
|
153
153
|
},
|
|
154
154
|
},
|
|
155
155
|
},
|
|
156
|
+
access: { kind: "tool-preset", render: { kind: "flag-value", flag: "--tools" } },
|
|
156
157
|
},
|
|
157
158
|
// Phase 0 fixtures: pi-both-tool-flags.md. Both list flags legal at once;
|
|
158
159
|
// exclude subtracts from include. --tools is strict over BUILT-INS but
|
|
@@ -165,13 +166,13 @@ export const piCli = deepFreeze({
|
|
|
165
166
|
includeIsStrictAllowlist: true,
|
|
166
167
|
composable: true,
|
|
167
168
|
builtins: [
|
|
168
|
-
{ name: "read", defaultEnabled: true },
|
|
169
|
-
{ name: "bash", defaultEnabled: true },
|
|
170
|
-
{ name: "edit", defaultEnabled: true },
|
|
171
|
-
{ name: "write", defaultEnabled: true },
|
|
172
|
-
{ name: "grep", defaultEnabled: false },
|
|
173
|
-
{ name: "find", defaultEnabled: false },
|
|
174
|
-
{ name: "ls", defaultEnabled: false },
|
|
169
|
+
{ name: "read", defaultEnabled: true, canonical: "read" },
|
|
170
|
+
{ name: "bash", defaultEnabled: true, canonical: "shell" },
|
|
171
|
+
{ name: "edit", defaultEnabled: true, canonical: "edit" },
|
|
172
|
+
{ name: "write", defaultEnabled: true, canonical: "write" },
|
|
173
|
+
{ name: "grep", defaultEnabled: false, canonical: "grep" },
|
|
174
|
+
{ name: "find", defaultEnabled: false, canonical: "glob" },
|
|
175
|
+
{ name: "ls", defaultEnabled: false, canonical: "list" },
|
|
175
176
|
],
|
|
176
177
|
categories: [],
|
|
177
178
|
denySemantics: "remove-from-set",
|
package/dist/knowledge/pi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pi.js","sourceRoot":"","sources":["../../src/knowledge/pi.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,UAAU,EAA0B,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAE5E,MAAM,CAAC,MAAM,KAAK,GAAsB,UAAU,CAAC;IACjD,IAAI,EAAE,IAAI;IACV,GAAG,EAAE,IAAI;IACT,eAAe,EAAE,QAAQ;IACzB,aAAa,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OA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AE,iBAAiB;KACjC;CACF,CAAC,CAAC"}
|
package/package.json
CHANGED
package/src/cli/args.ts
CHANGED
|
@@ -220,6 +220,8 @@ export const parseTurnOptions = (values: Record<string, unknown>): TurnOptions =
|
|
|
220
220
|
}
|
|
221
221
|
if (hasDiscovery) (opts as Record<string, unknown>).discovery = discovery as DiscoveryOptions;
|
|
222
222
|
|
|
223
|
+
if (values.access !== undefined) opts.access = String(values.access);
|
|
224
|
+
|
|
223
225
|
// prompt will be set by caller after resolvePrompt
|
|
224
226
|
return opts as unknown as TurnOptions;
|
|
225
227
|
};
|
|
@@ -284,6 +286,7 @@ const KNOWN_FLAGS = new Set([
|
|
|
284
286
|
"--provider",
|
|
285
287
|
"--tools",
|
|
286
288
|
"--exclude-tools",
|
|
289
|
+
"--access",
|
|
287
290
|
"--autonomy",
|
|
288
291
|
"--no-autonomy",
|
|
289
292
|
"--write",
|
|
@@ -320,6 +323,7 @@ const FLAGS_WITH_VALUE = new Set([
|
|
|
320
323
|
"--provider",
|
|
321
324
|
"--tools",
|
|
322
325
|
"--exclude-tools",
|
|
326
|
+
"--access",
|
|
323
327
|
"--max-steps",
|
|
324
328
|
"--cwd",
|
|
325
329
|
"--env",
|
|
@@ -443,6 +447,7 @@ export const parseCommonFlags = (
|
|
|
443
447
|
"system-prompt": { type: "string" as const },
|
|
444
448
|
"append-system-prompt": { type: "string" as const },
|
|
445
449
|
"max-steps": { type: "string" as const },
|
|
450
|
+
access: { type: "string" as const },
|
|
446
451
|
"no-tools": { type: "boolean" as const },
|
|
447
452
|
"no-instruction-files": { type: "boolean" as const },
|
|
448
453
|
"no-extensions": { type: "boolean" as const },
|
package/src/cli/config.ts
CHANGED
|
@@ -9,11 +9,21 @@
|
|
|
9
9
|
* (key known, value type plausible); value legality (effort in ladder,
|
|
10
10
|
* model in vocabulary) is enforced by the same renderers as args, so
|
|
11
11
|
* config and CLI can never disagree about what is legal.
|
|
12
|
+
*
|
|
13
|
+
* toolMap: { pi: { "web-search": "web_search" } } - extensible canonical
|
|
14
|
+
* vocabulary per harness; unknown harness, harness with no allowlist
|
|
15
|
+
* (codex, muse), non-string/empty values, or invalid selector canonical
|
|
16
|
+
* keys hard-fail naming the key path. hcn cannot verify native names exist
|
|
17
|
+
* at run time; a wrong name reaches the harness as an unknown tool.
|
|
12
18
|
*/
|
|
13
19
|
import { existsSync, readFileSync } from "node:fs";
|
|
14
20
|
import { homedir } from "node:os";
|
|
15
21
|
import { dirname, join, resolve } from "node:path";
|
|
16
22
|
import type { TurnOptions } from "../interpretation/argv.js";
|
|
23
|
+
import { TOOL_SELECTOR } from "../interpretation/tool-selection.js";
|
|
24
|
+
import { validateAccess } from "../interpretation/vocabulary.js";
|
|
25
|
+
import { HARNESS_NAMES } from "../knowledge/descriptor.js";
|
|
26
|
+
import { defaultDescriptors } from "../knowledge/overrides.js";
|
|
17
27
|
|
|
18
28
|
const SCHEMA_VERSION = 1;
|
|
19
29
|
|
|
@@ -73,6 +83,8 @@ const KNOWN_KEYS = new Set([
|
|
|
73
83
|
// entry by ratification).
|
|
74
84
|
"systemPrompt",
|
|
75
85
|
"appendSystemPrompt",
|
|
86
|
+
"toolMap",
|
|
87
|
+
"access",
|
|
76
88
|
]);
|
|
77
89
|
|
|
78
90
|
const LIST_KEYS = new Set(["tools", "excludeTools"]);
|
|
@@ -107,6 +119,74 @@ export const parseUserConfig = (text: string): Partial<TurnOptions> => {
|
|
|
107
119
|
if (!KNOWN_KEYS.has(key)) {
|
|
108
120
|
throw new ConfigError(`unknown config key: ${JSON.stringify(key)}`);
|
|
109
121
|
}
|
|
122
|
+
if (key === "toolMap") {
|
|
123
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
124
|
+
throw new ConfigError(
|
|
125
|
+
'config key "toolMap" must be an object of harness -> canonical -> native',
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
const toolMapObj = value as Record<string, unknown>;
|
|
129
|
+
const SEL = TOOL_SELECTOR;
|
|
130
|
+
const descSet = defaultDescriptors();
|
|
131
|
+
const harnessNames = HARNESS_NAMES as readonly string[];
|
|
132
|
+
for (const [harness, inner] of Object.entries(toolMapObj)) {
|
|
133
|
+
if (!(harnessNames as readonly string[]).includes(harness)) {
|
|
134
|
+
throw new ConfigError(`unknown config key: ${JSON.stringify(`toolMap.${harness}`)}`);
|
|
135
|
+
}
|
|
136
|
+
const desc = (
|
|
137
|
+
descSet as Record<
|
|
138
|
+
string,
|
|
139
|
+
{
|
|
140
|
+
tools: {
|
|
141
|
+
includeFlag: string | null;
|
|
142
|
+
categories: readonly { canonical: readonly string[] }[];
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
>
|
|
146
|
+
)[harness];
|
|
147
|
+
const canTakeToolMap =
|
|
148
|
+
desc && (desc.tools.includeFlag !== null || desc.tools.categories.length > 0);
|
|
149
|
+
const hasListOrCats = canTakeToolMap;
|
|
150
|
+
if (!hasListOrCats) {
|
|
151
|
+
throw new ConfigError(`unknown config key: ${JSON.stringify(`toolMap.${harness}`)}`);
|
|
152
|
+
}
|
|
153
|
+
if (typeof inner !== "object" || inner === null || Array.isArray(inner)) {
|
|
154
|
+
throw new ConfigError(
|
|
155
|
+
`config key ${JSON.stringify(`toolMap.${harness}`)} must be an object of canonical -> native string`,
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
const innerObj = inner as Record<string, unknown>;
|
|
159
|
+
// For category-only harnesses (muse), only category-backed canonicals are valid (A4)
|
|
160
|
+
const isCategoryOnly = desc.tools.includeFlag === null && desc.tools.categories.length > 0;
|
|
161
|
+
const allowedForCategoryOnly = isCategoryOnly
|
|
162
|
+
? new Set(desc.tools.categories.flatMap((c) => [...c.canonical]))
|
|
163
|
+
: null;
|
|
164
|
+
for (const [canonical, nativeVal] of Object.entries(innerObj)) {
|
|
165
|
+
if (isCategoryOnly && allowedForCategoryOnly && !allowedForCategoryOnly.has(canonical)) {
|
|
166
|
+
throw new ConfigError(
|
|
167
|
+
`unknown config key: ${JSON.stringify(`toolMap.${harness}.${canonical}`)}`,
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
if (!SEL.test(canonical)) {
|
|
171
|
+
throw new ConfigError(
|
|
172
|
+
`config key ${JSON.stringify(`toolMap.${harness}.${canonical}`)} must match ${SEL.source}`,
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
if (typeof nativeVal !== "string") {
|
|
176
|
+
throw new ConfigError(
|
|
177
|
+
`config key ${JSON.stringify(`toolMap.${harness}.${canonical}`)} must be a non-empty string, got ${typeof nativeVal}`,
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
if (nativeVal.trim() === "") {
|
|
181
|
+
throw new ConfigError(
|
|
182
|
+
`config key ${JSON.stringify(`toolMap.${harness}.${canonical}`)} must be a non-empty string`,
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
(out as Record<string, unknown>)[key] = value;
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
110
190
|
if (key === "toolsets") {
|
|
111
191
|
if (
|
|
112
192
|
typeof value !== "object" ||
|
|
@@ -132,6 +212,14 @@ export const parseUserConfig = (text: string): Partial<TurnOptions> => {
|
|
|
132
212
|
(out as Record<string, unknown>)[key] = value;
|
|
133
213
|
continue;
|
|
134
214
|
}
|
|
215
|
+
if (key === "access") {
|
|
216
|
+
const v = validateAccess(String(value));
|
|
217
|
+
if (!v.ok) {
|
|
218
|
+
throw new ConfigError('config key "access" must be "read" or "write"');
|
|
219
|
+
}
|
|
220
|
+
(out as Record<string, unknown>)[key] = value;
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
135
223
|
if (LIST_KEYS.has(key)) {
|
|
136
224
|
if (!Array.isArray(value) || value.some((v) => typeof v !== "string")) {
|
|
137
225
|
throw new ConfigError(`config key ${JSON.stringify(key)} must be an array of strings`);
|
package/src/cli/help.ts
CHANGED
|
@@ -32,10 +32,16 @@ Options:
|
|
|
32
32
|
--effort <value> Effort level (validated per harness/model)
|
|
33
33
|
--sandbox <value> Sandbox mode (codex only)
|
|
34
34
|
--provider <value> Provider (pi only)
|
|
35
|
-
--tools <a,b> Tool grant allowlist
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
--tools <a,b> Tool grant allowlist - canonical names (read, write,
|
|
36
|
+
edit, shell, grep, glob, list, web-fetch,
|
|
37
|
+
web-search, subagent, skill);
|
|
38
|
+
'native:<name>' passes a harness-native or
|
|
39
|
+
extension tool through (claude, pi; a bare
|
|
40
|
+
name matching a configured toolset expands
|
|
41
|
+
to it)
|
|
42
|
+
--exclude-tools <a,b> Complement over known tools - canonical names
|
|
43
|
+
(same vocabulary, native:<name> passthrough);
|
|
44
|
+
mutually exclusive with --tools (claude, pi)
|
|
39
45
|
--autonomy Enable autonomy flag (claude/codex/muse)
|
|
40
46
|
--no-autonomy Disable autonomy
|
|
41
47
|
--write Enable write (muse)
|
|
@@ -54,6 +60,13 @@ Options:
|
|
|
54
60
|
exclusion automatically. Opt-in; no default)
|
|
55
61
|
--append-system-prompt <text>
|
|
56
62
|
Append to the built-in prompt (claude, pi only)
|
|
63
|
+
--access <read|write> Access preset - read = read-only tool subset
|
|
64
|
+
(canonical: read, grep, glob, list, web-fetch,
|
|
65
|
+
web-search; claude/pi via --tools, codex via
|
|
66
|
+
--sandbox read-only, muse via --disable-write
|
|
67
|
+
--disable-shell); write = no restriction;
|
|
68
|
+
mutually exclusive with --tools/--exclude-tools
|
|
69
|
+
and with --sandbox on codex; no default
|
|
57
70
|
--max-steps <n> Max steps (muse, 1-10000)
|
|
58
71
|
--timeout <seconds> Wall-clock budget for the run (all harnesses,
|
|
59
72
|
hcn-enforced; 0 disables; no default)
|
|
@@ -83,8 +96,10 @@ Defaults with no flags:
|
|
|
83
96
|
git root) > user config (~/.config/hcn/config.json) > built-in profile
|
|
84
97
|
> harness default. The profile pins: effort medium, sandbox
|
|
85
98
|
workspace-write (codex only; other harnesses report divergence),
|
|
86
|
-
discovery on, autonomy off, write/shell on. timeout
|
|
87
|
-
no default
|
|
99
|
+
discovery on, autonomy off, write/shell on. timeout, max-steps and
|
|
100
|
+
access have no default; harness default applies (access write emits
|
|
101
|
+
nothing on claude/pi/muse, --sandbox workspace-write on codex via
|
|
102
|
+
profile). toolMap is config-only (no flag) - canonical -> native mapping per harness. Question escalation defaults ON (config key
|
|
88
103
|
"escalateQuestions"; it is a prompt preamble, never a harness flag).
|
|
89
104
|
Provenance prints to stderr on every run; see
|
|
90
105
|
'hcn inspect <harness>' for the resolved argv of a bare run.
|
|
@@ -125,7 +140,10 @@ Options:
|
|
|
125
140
|
--effort <value> Effort
|
|
126
141
|
--sandbox <value> Sandbox
|
|
127
142
|
--provider <value> Provider
|
|
128
|
-
--tools <a,b> Tools
|
|
143
|
+
--tools <a,b> Tools - canonical names (read, write, edit,
|
|
144
|
+
shell, grep, glob, list, web-fetch,
|
|
145
|
+
web-search, subagent, skill);
|
|
146
|
+
'native:<name>' passes through
|
|
129
147
|
--autonomy / --no-autonomy
|
|
130
148
|
--write / --no-write
|
|
131
149
|
--shell / --no-shell
|
package/src/cli/inspect.ts
CHANGED
|
@@ -2,7 +2,11 @@ import { redactArgv } from "../execution/stream-turn.js";
|
|
|
2
2
|
import { buildLaunchArgv } from "../interpretation/argv.js";
|
|
3
3
|
import { ArgvRefusalError } from "../interpretation/refusal.js";
|
|
4
4
|
import { FloorExceededError, resolveEffectiveOptions } from "../interpretation/resolve-options.js";
|
|
5
|
+
import { canonicalTable, mergeToolMaps } from "../interpretation/tool-vocabulary.js";
|
|
6
|
+
import { defaultDescriptors } from "../knowledge/overrides.js";
|
|
5
7
|
import { parseTurnOptions, resolvePromptAsync } from "./args.js";
|
|
8
|
+
import { ConfigError, loadProjectConfig, loadUserConfig } from "./config.js";
|
|
9
|
+
import { refusalOf, refuse } from "./refuse.js";
|
|
6
10
|
import { resolveHarness } from "./resolve-harness.js";
|
|
7
11
|
|
|
8
12
|
export const inspect = async (harnessName: string, rawArgs: string[]): Promise<void> => {
|
|
@@ -48,8 +52,55 @@ export const inspect = async (harnessName: string, rawArgs: string[]): Promise<v
|
|
|
48
52
|
const values = parsed.values as Record<string, unknown>;
|
|
49
53
|
const wantArgv = values.argv === true;
|
|
50
54
|
|
|
55
|
+
// Load config once at top and reuse for both paths
|
|
56
|
+
let rawUserMap: Record<string, Record<string, string>> | undefined;
|
|
57
|
+
let rawProjectMap: Record<string, Record<string, string>> | undefined;
|
|
58
|
+
let loadedTiers: {
|
|
59
|
+
user?: import("../interpretation/argv.js").TurnOptions;
|
|
60
|
+
project?: import("../interpretation/argv.js").TurnOptions;
|
|
61
|
+
} = {};
|
|
62
|
+
try {
|
|
63
|
+
const u = loadUserConfig();
|
|
64
|
+
rawUserMap = (u?.config as { toolMap?: Record<string, Record<string, string>> } | undefined)
|
|
65
|
+
?.toolMap;
|
|
66
|
+
if (u) loadedTiers = { ...loadedTiers, user: u.config as never };
|
|
67
|
+
const p = loadProjectConfig();
|
|
68
|
+
rawProjectMap = (p?.config as { toolMap?: Record<string, Record<string, string>> } | undefined)
|
|
69
|
+
?.toolMap;
|
|
70
|
+
if (p) loadedTiers = { ...loadedTiers, project: p.config as never };
|
|
71
|
+
} catch (e) {
|
|
72
|
+
if (e instanceof ConfigError) {
|
|
73
|
+
process.stderr.write(`config error: ${(e as Error).message}\n`);
|
|
74
|
+
process.exitCode = 2;
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
throw e;
|
|
78
|
+
}
|
|
79
|
+
const merged = mergeToolMaps({ user: rawUserMap, project: rawProjectMap });
|
|
80
|
+
|
|
51
81
|
if (!wantArgv) {
|
|
52
|
-
|
|
82
|
+
const table = canonicalTable(defaultDescriptors());
|
|
83
|
+
const slice: Record<string, unknown> = {};
|
|
84
|
+
const allCanonicalForInspect = [
|
|
85
|
+
...new Set([...Object.keys(table), ...Object.keys(merged[h.name] ?? {})]),
|
|
86
|
+
].sort();
|
|
87
|
+
for (const canonical of allCanonicalForInspect) {
|
|
88
|
+
const perHarness = table[canonical] as Record<string, unknown> | undefined;
|
|
89
|
+
const v = perHarness?.[h.name];
|
|
90
|
+
const mapped = merged[h.name]?.[canonical];
|
|
91
|
+
if (mapped !== undefined) {
|
|
92
|
+
slice[canonical] = { native: mapped.native, source: mapped.tier };
|
|
93
|
+
} else if (v !== undefined) {
|
|
94
|
+
const vv = v as { kind: string; native?: string; key?: string };
|
|
95
|
+
const val =
|
|
96
|
+
vv.kind === "builtin"
|
|
97
|
+
? { native: vv.native, source: "descriptor" }
|
|
98
|
+
: { ...vv, source: "descriptor" };
|
|
99
|
+
slice[canonical] = val;
|
|
100
|
+
} else {
|
|
101
|
+
slice[canonical] = { native: null, source: "none" };
|
|
102
|
+
}
|
|
103
|
+
}
|
|
53
104
|
const out = {
|
|
54
105
|
name: h.name,
|
|
55
106
|
bin: h.bin,
|
|
@@ -76,6 +127,7 @@ export const inspect = async (harnessName: string, rawArgs: string[]): Promise<v
|
|
|
76
127
|
turnOptions: h.turnOptions,
|
|
77
128
|
limitMatchers: h.limitMatchers,
|
|
78
129
|
authMatchers: h.authMatchers,
|
|
130
|
+
toolVocabulary: slice,
|
|
79
131
|
};
|
|
80
132
|
process.stdout.write(`${JSON.stringify(out, null, 2)}\n`);
|
|
81
133
|
return;
|
|
@@ -189,26 +241,13 @@ export const inspect = async (harnessName: string, rawArgs: string[]): Promise<v
|
|
|
189
241
|
}
|
|
190
242
|
}
|
|
191
243
|
|
|
192
|
-
//
|
|
193
|
-
// launch-only semantics, so --argv previews the truth of a bare run.
|
|
194
|
-
const { loadUserConfig, loadProjectConfig, ConfigError } = await import("./config.js");
|
|
244
|
+
// Reuse already-loaded config for argv preview
|
|
195
245
|
const tiers: {
|
|
196
246
|
user?: Partial<ReturnType<typeof parseTurnOptions>>;
|
|
197
247
|
project?: Partial<ReturnType<typeof parseTurnOptions>>;
|
|
198
248
|
} = {};
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
if (loaded !== null) tiers.user = loaded.config;
|
|
202
|
-
const proj = loadProjectConfig();
|
|
203
|
-
if (proj !== null) tiers.project = proj.config;
|
|
204
|
-
} catch (configErr) {
|
|
205
|
-
if (configErr instanceof ConfigError) {
|
|
206
|
-
process.stderr.write(`config error: ${(configErr as Error).message}\n`);
|
|
207
|
-
process.exitCode = 2;
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
throw configErr;
|
|
211
|
-
}
|
|
249
|
+
if (loadedTiers.user) tiers.user = loadedTiers.user as never;
|
|
250
|
+
if (loadedTiers.project) tiers.project = loadedTiers.project as never;
|
|
212
251
|
let resolved: ReturnType<typeof resolveEffectiveOptions>;
|
|
213
252
|
try {
|
|
214
253
|
resolved = resolveEffectiveOptions(h, { ...turnOpts, prompt } as never, tiers);
|
|
@@ -218,6 +257,10 @@ export const inspect = async (harnessName: string, rawArgs: string[]): Promise<v
|
|
|
218
257
|
process.exitCode = 2;
|
|
219
258
|
return;
|
|
220
259
|
}
|
|
260
|
+
if (resErr instanceof ArgvRefusalError) {
|
|
261
|
+
refuse(refusalOf(resErr as ArgvRefusalError), false);
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
221
264
|
throw resErr;
|
|
222
265
|
}
|
|
223
266
|
const { writeProvenance } = await import("./provenance.js");
|
|
@@ -237,9 +280,7 @@ export const inspect = async (harnessName: string, rawArgs: string[]): Promise<v
|
|
|
237
280
|
if (claudeTokens !== undefined && claudeTokens.length > 0) argv.push(...claudeTokens);
|
|
238
281
|
} catch (err) {
|
|
239
282
|
if (err instanceof ArgvRefusalError) {
|
|
240
|
-
|
|
241
|
-
if (err.supported.length) process.stderr.write(`supported: ${err.supported.join(", ")}\n`);
|
|
242
|
-
process.exitCode = 2;
|
|
283
|
+
refuse(refusalOf(err as ArgvRefusalError), false);
|
|
243
284
|
return;
|
|
244
285
|
}
|
|
245
286
|
throw err;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { failureFromRejected } from "../execution/failure.js";
|
|
2
|
+
import type { ArgvRefusalError, RefusalIssue } from "../interpretation/refusal.js";
|
|
3
|
+
import { writeEventNdjson } from "./render.js";
|
|
4
|
+
|
|
5
|
+
export interface Refusal {
|
|
6
|
+
readonly message: string;
|
|
7
|
+
readonly issue: RefusalIssue;
|
|
8
|
+
readonly option?: ArgvRefusalError["option"];
|
|
9
|
+
readonly facet?: ArgvRefusalError["facet"];
|
|
10
|
+
readonly supported?: readonly string[];
|
|
11
|
+
readonly supportedBy?: ArgvRefusalError["supportedBy"];
|
|
12
|
+
readonly hint?: string;
|
|
13
|
+
readonly trailer?: readonly string[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const refusalOf = (err: ArgvRefusalError): Refusal => ({
|
|
17
|
+
message: err.message,
|
|
18
|
+
issue: err.issue,
|
|
19
|
+
option: err.option,
|
|
20
|
+
facet: err.facet,
|
|
21
|
+
supported: err.supported,
|
|
22
|
+
supportedBy: err.supportedBy,
|
|
23
|
+
hint: err.hint,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export const refuse = (r: Refusal, json: boolean): void => {
|
|
27
|
+
process.stderr.write(`${r.message}\n`);
|
|
28
|
+
if (r.hint) process.stderr.write(`hint: ${r.hint}\n`);
|
|
29
|
+
if (r.supportedBy?.length) {
|
|
30
|
+
process.stderr.write(
|
|
31
|
+
`supported on: ${r.supportedBy.map((e) => `${e.harness} (${e.spelling})`).join(", ")}\n`,
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
if (r.supported?.length) process.stderr.write(`supported: ${r.supported.join(", ")}\n`);
|
|
35
|
+
for (const line of r.trailer ?? []) process.stderr.write(`${line}\n`);
|
|
36
|
+
if (json) {
|
|
37
|
+
const summary = failureFromRejected({
|
|
38
|
+
issue: r.issue,
|
|
39
|
+
option: r.option,
|
|
40
|
+
facet: r.facet,
|
|
41
|
+
supported: r.supported,
|
|
42
|
+
supportedBy: r.supportedBy,
|
|
43
|
+
hint: r.hint,
|
|
44
|
+
detail: r.message,
|
|
45
|
+
});
|
|
46
|
+
writeEventNdjson({ kind: "failure", ...summary });
|
|
47
|
+
writeEventNdjson({ kind: "done", exitCode: null, cause: "failed", failure: summary });
|
|
48
|
+
}
|
|
49
|
+
process.exitCode = 2;
|
|
50
|
+
};
|
package/src/cli/run.ts
CHANGED
|
@@ -1,72 +1,19 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
2
|
import type { HarnessEvent } from "../execution/events.js";
|
|
3
|
-
import { failureFromRejected } from "../execution/failure.js";
|
|
4
3
|
import { nodeRunnerDeps } from "../execution/node-deps.js";
|
|
5
4
|
import { KILL_GRACE_MS, redactArgv, streamTurn } from "../execution/stream-turn.js";
|
|
6
5
|
import { buildLaunchArgv, buildResumeArgv } from "../interpretation/argv.js";
|
|
7
6
|
import { composeEscalatedPrompt } from "../interpretation/question.js";
|
|
8
|
-
import type { RefusalIssue } from "../interpretation/refusal.js";
|
|
9
7
|
import { ArgvRefusalError } from "../interpretation/refusal.js";
|
|
10
8
|
import { FloorExceededError, resolveEffectiveOptions } from "../interpretation/resolve-options.js";
|
|
11
9
|
import { storePath } from "../interpretation/store.js";
|
|
12
10
|
import { recognizeNativeSpelling, supportedBy } from "../interpretation/support.js";
|
|
13
11
|
import { defaultDescriptors } from "../knowledge/overrides.js";
|
|
14
12
|
import { parseRunExtra, parseTurnOptions, resolvePromptAsync } from "./args.js";
|
|
13
|
+
import { refusalOf, refuse } from "./refuse.js";
|
|
15
14
|
import { createRenderState, renderEvent, writeEventNdjson } from "./render.js";
|
|
16
15
|
import { resolveHarness } from "./resolve-harness.js";
|
|
17
16
|
|
|
18
|
-
/** One shape for every hcn-side refusal. Stderr keeps the prose (message,
|
|
19
|
-
* hint, support lists, usage pointer); under --json the same fields also
|
|
20
|
-
* ride stdout as a `failure` event plus a `done`, so a stream reader never
|
|
21
|
-
* meets an empty stream on exit 2. */
|
|
22
|
-
interface Refusal {
|
|
23
|
-
readonly message: string;
|
|
24
|
-
readonly issue: RefusalIssue;
|
|
25
|
-
readonly option?: ArgvRefusalError["option"];
|
|
26
|
-
readonly facet?: ArgvRefusalError["facet"];
|
|
27
|
-
readonly supported?: readonly string[];
|
|
28
|
-
readonly supportedBy?: ArgvRefusalError["supportedBy"];
|
|
29
|
-
readonly hint?: string;
|
|
30
|
-
/** Plain stderr lines written after the structured ones. */
|
|
31
|
-
readonly trailer?: readonly string[];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const refusalOf = (err: ArgvRefusalError): Refusal => ({
|
|
35
|
-
message: err.message,
|
|
36
|
-
issue: err.issue,
|
|
37
|
-
option: err.option,
|
|
38
|
-
facet: err.facet,
|
|
39
|
-
supported: err.supported,
|
|
40
|
-
supportedBy: err.supportedBy,
|
|
41
|
-
hint: err.hint,
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
const refuse = (r: Refusal, json: boolean): void => {
|
|
45
|
-
process.stderr.write(`${r.message}\n`);
|
|
46
|
-
if (r.hint) process.stderr.write(`hint: ${r.hint}\n`);
|
|
47
|
-
if (r.supportedBy?.length) {
|
|
48
|
-
process.stderr.write(
|
|
49
|
-
`supported on: ${r.supportedBy.map((e) => `${e.harness} (${e.spelling})`).join(", ")}\n`,
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
if (r.supported?.length) process.stderr.write(`supported: ${r.supported.join(", ")}\n`);
|
|
53
|
-
for (const line of r.trailer ?? []) process.stderr.write(`${line}\n`);
|
|
54
|
-
if (json) {
|
|
55
|
-
const summary = failureFromRejected({
|
|
56
|
-
issue: r.issue,
|
|
57
|
-
option: r.option,
|
|
58
|
-
facet: r.facet,
|
|
59
|
-
supported: r.supported,
|
|
60
|
-
supportedBy: r.supportedBy,
|
|
61
|
-
hint: r.hint,
|
|
62
|
-
detail: r.message,
|
|
63
|
-
});
|
|
64
|
-
writeEventNdjson({ kind: "failure", ...summary });
|
|
65
|
-
writeEventNdjson({ kind: "done", exitCode: null, cause: "failed", failure: summary });
|
|
66
|
-
}
|
|
67
|
-
process.exitCode = 2;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
17
|
export const run = async (harnessName: string, rawArgs: string[]): Promise<void> => {
|
|
71
18
|
const h = resolveHarness(harnessName);
|
|
72
19
|
|
|
@@ -295,6 +242,10 @@ export const run = async (harnessName: string, rawArgs: string[]): Promise<void>
|
|
|
295
242
|
refuse({ message: resErr.message, issue: "invalid-tool-grant" }, wantJson);
|
|
296
243
|
return;
|
|
297
244
|
}
|
|
245
|
+
if (resErr instanceof ArgvRefusalError) {
|
|
246
|
+
refuse(refusalOf(resErr), wantJson);
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
298
249
|
throw resErr;
|
|
299
250
|
}
|
|
300
251
|
const { provenance, unrenderable } = resolved;
|
|
@@ -408,12 +359,12 @@ export const run = async (harnessName: string, rawArgs: string[]): Promise<void>
|
|
|
408
359
|
// all refuses inside buildLaunchArgv below, so a throw here is left
|
|
409
360
|
// to that path.
|
|
410
361
|
const grant = (fullOpts.resume ? turnOpts : effectiveTurnOpts).tools;
|
|
411
|
-
if (grant !== undefined && grant.length > 0
|
|
362
|
+
if (grant !== undefined && grant.length > 0) {
|
|
412
363
|
try {
|
|
413
364
|
const { renderToolSelection } = await import("../interpretation/tool-selection.js");
|
|
414
|
-
const {
|
|
415
|
-
if (
|
|
416
|
-
process.stderr.write(`provenance:
|
|
365
|
+
const { passthrough } = renderToolSelection(h, { include: [...grant] });
|
|
366
|
+
if (passthrough.length > 0) {
|
|
367
|
+
process.stderr.write(`provenance: native tools = ${JSON.stringify(passthrough)}\n`);
|
|
417
368
|
}
|
|
418
369
|
} catch {
|
|
419
370
|
// refused below with the structured message
|
|
@@ -83,6 +83,9 @@ export interface TurnOptions {
|
|
|
83
83
|
readonly escalateQuestions?: boolean;
|
|
84
84
|
/** Internal: set by CLI when prompt came from --prompt/--prompt-file to bypass leading '-' guard */
|
|
85
85
|
readonly __explicitPrompt?: boolean;
|
|
86
|
+
/** toolMap extensible vocabulary per harness (issue toolMap) */
|
|
87
|
+
readonly toolMap?: Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
88
|
+
readonly access?: "read" | "write";
|
|
86
89
|
}
|
|
87
90
|
|
|
88
91
|
export interface ResumeOptions extends TurnOptions {
|
|
@@ -124,9 +127,11 @@ const turnTail = (h: HarnessDescriptor, opts: TurnOptions): string[] => {
|
|
|
124
127
|
tail.push(h.autonomy.flag);
|
|
125
128
|
}
|
|
126
129
|
if (opts.tools !== undefined || opts.excludeTools !== undefined) {
|
|
130
|
+
const perHarnessMap = opts.toolMap?.[h.name];
|
|
127
131
|
const rendered = renderToolSelection(h, {
|
|
128
132
|
include: opts.tools,
|
|
129
133
|
exclude: opts.excludeTools,
|
|
134
|
+
toolMap: perHarnessMap,
|
|
130
135
|
});
|
|
131
136
|
tail.push(...rendered.tokens);
|
|
132
137
|
}
|