@lannguyensi/harness 0.14.0 → 0.15.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/CHANGELOG.md +23 -0
- package/README.md +3 -1
- package/dist/cli/init/composer.d.ts +29 -0
- package/dist/cli/init/composer.js +377 -0
- package/dist/cli/init/composer.js.map +1 -0
- package/dist/cli/init/dependencies.d.ts +25 -0
- package/dist/cli/init/dependencies.js +100 -10
- package/dist/cli/init/dependencies.js.map +1 -1
- package/dist/cli/init/index.d.ts +18 -1
- package/dist/cli/init/index.js +17 -7
- package/dist/cli/init/index.js.map +1 -1
- package/dist/cli/init/interactive.d.ts +31 -2
- package/dist/cli/init/interactive.js +321 -79
- package/dist/cli/init/interactive.js.map +1 -1
- package/dist/cli/init/templates.d.ts +1 -1
- package/dist/cli/init/templates.js +60 -9
- package/dist/cli/init/templates.js.map +1 -1
- package/dist/cli/pack/hook-pre-tool-use.d.ts +1 -1
- package/dist/cli/pack/hook-pre-tool-use.js +37 -3
- package/dist/cli/pack/hook-pre-tool-use.js.map +1 -1
- package/dist/cli/validate/checks.d.ts +1 -1
- package/dist/cli/validate/checks.js +1 -7
- package/dist/cli/validate/checks.js.map +1 -1
- package/dist/io/harness-lock.js +1 -9
- package/dist/io/harness-lock.js.map +1 -1
- package/dist/policies/ledger-client.js +3 -9
- package/dist/policies/ledger-client.js.map +1 -1
- package/dist/policies/producers.d.ts +12 -0
- package/dist/policies/producers.js +61 -0
- package/dist/policies/producers.js.map +1 -0
- package/dist/runtime/expand-home.d.ts +14 -0
- package/dist/runtime/expand-home.js +54 -0
- package/dist/runtime/expand-home.js.map +1 -0
- package/dist/runtime/intercept.js +13 -2
- package/dist/runtime/intercept.js.map +1 -1
- package/dist/runtime/ledger-add.js +10 -3
- package/dist/runtime/ledger-add.js.map +1 -1
- package/dist/runtime/ledger-record.js +11 -10
- package/dist/runtime/ledger-record.js.map +1 -1
- package/dist/schema/index.d.ts +281 -101
- package/dist/schema/permission-profiles.d.ts +125 -125
- package/dist/schema/policies.d.ts +261 -0
- package/dist/schema/policies.js +50 -0
- package/dist/schema/policies.js.map +1 -1
- package/package.json +1 -1
|
@@ -24,16 +24,24 @@ export const PROFILE_DEPENDENCIES = {
|
|
|
24
24
|
binary: "memory-router-user-prompt-submit",
|
|
25
25
|
npmPackage: "@lannguyensi/memory-router",
|
|
26
26
|
description: "memory router (UserPromptSubmit hook)",
|
|
27
|
+
// Mirrors the FULL_TEMPLATE memory.router min_version floor (the
|
|
28
|
+
// `--version` short-circuit harness doctor expects landed in 0.3.0).
|
|
29
|
+
minVersion: "0.3.0",
|
|
27
30
|
},
|
|
28
31
|
{
|
|
29
32
|
binary: "understanding-gate-claude-hook",
|
|
30
33
|
npmPackage: "@lannguyensi/understanding-gate",
|
|
31
34
|
description: "understanding gate (UserPromptSubmit injector)",
|
|
35
|
+
// 0.3.0 added parser-side bullet-to-section mapping so
|
|
36
|
+
// fast_confirm reports actually persist end-to-end (agent-grounding
|
|
37
|
+
// PR #78). Operators on 0.2.x silently miss the fix.
|
|
38
|
+
minVersion: "0.3.0",
|
|
32
39
|
},
|
|
33
40
|
{
|
|
34
41
|
binary: "understanding-gate-claude-stop",
|
|
35
42
|
npmPackage: "@lannguyensi/understanding-gate",
|
|
36
43
|
description: "understanding gate (Stop capture)",
|
|
44
|
+
minVersion: "0.3.0",
|
|
37
45
|
},
|
|
38
46
|
],
|
|
39
47
|
team: [
|
|
@@ -50,15 +58,18 @@ export const PROFILE_DEPENDENCIES = {
|
|
|
50
58
|
},
|
|
51
59
|
],
|
|
52
60
|
// Full inherits everything from Solo + Team, and adds the
|
|
53
|
-
// SessionStart preflight producer: the `git-preflight` hook shells
|
|
54
|
-
// to `agent-preflight` (`preflight` binary) to write
|
|
55
|
-
// to the ledger, which is what the
|
|
61
|
+
// SessionStart preflight producer: the `git-preflight` hook shells
|
|
62
|
+
// out to `agent-preflight` (`preflight` binary) to write
|
|
63
|
+
// `preflight:${REPO}` to the ledger, which is what the
|
|
64
|
+
// `preflight-before-*` policies match.
|
|
56
65
|
//
|
|
57
|
-
//
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
//
|
|
66
|
+
// codebase-oracle (`@lannguyensi/codebase-oracle`) is intentionally
|
|
67
|
+
// NOT in the Full chain. It is a useful standalone MCP for multi-repo
|
|
68
|
+
// semantic search, but harness itself does not require it and the
|
|
69
|
+
// setup cost (ORACLE_SCAN_ROOT + an embedding provider key + initial
|
|
70
|
+
// index run) is not worth pushing on every Full-profile operator.
|
|
71
|
+
// See FULL_TEMPLATE comment under `tools.mcp` for the manual wiring
|
|
72
|
+
// recipe (`harness add mcp codebase-oracle --command codebase-oracle,mcp`).
|
|
62
73
|
full: [
|
|
63
74
|
{
|
|
64
75
|
binary: "preflight",
|
|
@@ -116,10 +127,19 @@ function findOnPath(binary, pathEnv) {
|
|
|
116
127
|
* `npm i -g <pkg1> <pkg2>` call.
|
|
117
128
|
*/
|
|
118
129
|
export function checkDependencies(profile, opts = {}) {
|
|
130
|
+
return checkDependencyList(dependenciesForProfile(profile), opts);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* List-based variant of `checkDependencies` for callers that compute a
|
|
134
|
+
* bespoke dep set (e.g. the Custom-profile composer in task 31d2fbb5).
|
|
135
|
+
* Same semantics: resolve each binary on PATH, return statuses +
|
|
136
|
+
* de-duped missing packages.
|
|
137
|
+
*/
|
|
138
|
+
export function checkDependencyList(deps, opts = {}) {
|
|
119
139
|
const pathEnv = opts.pathEnv ?? process.env.PATH ?? "";
|
|
120
140
|
const statuses = [];
|
|
121
141
|
const missingPackages = new Set();
|
|
122
|
-
for (const dep of
|
|
142
|
+
for (const dep of deps) {
|
|
123
143
|
const resolved = findOnPath(dep.binary, pathEnv);
|
|
124
144
|
if (resolved) {
|
|
125
145
|
statuses.push({ dep, installed: true, resolvedPath: resolved });
|
|
@@ -131,6 +151,70 @@ export function checkDependencies(profile, opts = {}) {
|
|
|
131
151
|
}
|
|
132
152
|
return { statuses, missingPackages: [...missingPackages] };
|
|
133
153
|
}
|
|
154
|
+
/**
|
|
155
|
+
* Resolve the dependency list for a Custom-profile selection. Maps each
|
|
156
|
+
* checkbox key to its underlying binary requirement. Used by the
|
|
157
|
+
* interactive wizard's Custom branch so the dependency-check + install
|
|
158
|
+
* UX is identical to the named profiles.
|
|
159
|
+
*/
|
|
160
|
+
export function dependenciesForCustom(sel) {
|
|
161
|
+
const chain = [];
|
|
162
|
+
const seen = new Set();
|
|
163
|
+
const push = (dep) => {
|
|
164
|
+
if (seen.has(dep.binary))
|
|
165
|
+
return;
|
|
166
|
+
seen.add(dep.binary);
|
|
167
|
+
chain.push(dep);
|
|
168
|
+
};
|
|
169
|
+
// Pack → understanding-gate adapters (mirrors PROFILE_DEPENDENCIES.solo).
|
|
170
|
+
if (sel.packs.includes("understanding-before-execution")) {
|
|
171
|
+
for (const dep of PROFILE_DEPENDENCIES.solo) {
|
|
172
|
+
if (dep.binary.startsWith("understanding-gate-"))
|
|
173
|
+
push(dep);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
// MCPs → their bridges / bins. codebase-oracle is treated as a
|
|
177
|
+
// first-class dep here even though FULL_TEMPLATE deliberately omits
|
|
178
|
+
// it (the doc-table reasoning is that its setup cost is too high for
|
|
179
|
+
// every Full operator). Custom is opt-in, so an operator who ticks
|
|
180
|
+
// codebase-oracle has accepted that cost; we still install the bin
|
|
181
|
+
// for them. The env-var requirement is surfaced as a composer warning.
|
|
182
|
+
const mcpToBinary = {
|
|
183
|
+
"agent-tasks": "agent-tasks-mcp-bridge",
|
|
184
|
+
"grounding-mcp": "grounding-mcp",
|
|
185
|
+
"memory-router": "memory-router-user-prompt-submit",
|
|
186
|
+
"codebase-oracle": "codebase-oracle",
|
|
187
|
+
};
|
|
188
|
+
const extraDeps = [
|
|
189
|
+
{
|
|
190
|
+
binary: "codebase-oracle",
|
|
191
|
+
npmPackage: "@lannguyensi/codebase-oracle",
|
|
192
|
+
description: "codebase-oracle MCP server",
|
|
193
|
+
},
|
|
194
|
+
];
|
|
195
|
+
for (const m of sel.mcps) {
|
|
196
|
+
const targetBin = mcpToBinary[m];
|
|
197
|
+
const dep = PROFILE_DEPENDENCIES.solo.find((d) => d.binary === targetBin) ??
|
|
198
|
+
PROFILE_DEPENDENCIES.team.find((d) => d.binary === targetBin) ??
|
|
199
|
+
extraDeps.find((d) => d.binary === targetBin);
|
|
200
|
+
if (dep)
|
|
201
|
+
push(dep);
|
|
202
|
+
}
|
|
203
|
+
// preflight-* policies need agent-preflight on PATH (the
|
|
204
|
+
// SessionStart hook FULL_TEMPLATE wires; mirrors PROFILE_DEPENDENCIES.full).
|
|
205
|
+
// Even though the Custom surface does not expose the SessionStart hook
|
|
206
|
+
// yet, operators wiring the preflight gates will still want the
|
|
207
|
+
// producer binary installed so a manual `harness session-start preflight`
|
|
208
|
+
// invocation can populate the ledger tag.
|
|
209
|
+
const wantsPreflight = sel.policies.some((p) => p.startsWith("preflight-"));
|
|
210
|
+
if (wantsPreflight) {
|
|
211
|
+
for (const dep of PROFILE_DEPENDENCIES.full) {
|
|
212
|
+
if (dep.binary === "preflight")
|
|
213
|
+
push(dep);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return chain;
|
|
217
|
+
}
|
|
134
218
|
/**
|
|
135
219
|
* Render the dependency table the wizard shows to the operator. Pure
|
|
136
220
|
* function so tests can lock the surface text without spawning a
|
|
@@ -141,9 +225,15 @@ export function formatDependencyTable(profile, result) {
|
|
|
141
225
|
lines.push(`Profile "${profile}" depends on these binaries:`);
|
|
142
226
|
for (const status of result.statuses) {
|
|
143
227
|
const mark = status.installed ? "✓" : "✗";
|
|
228
|
+
// minVersion is informational only at this layer (the wizard does
|
|
229
|
+
// not yet probe the installed bin's version); show it next to the
|
|
230
|
+
// package name so operators see the floor a feature depends on.
|
|
231
|
+
const pkgLabel = status.dep.minVersion
|
|
232
|
+
? `${status.dep.npmPackage}@${status.dep.minVersion}+`
|
|
233
|
+
: status.dep.npmPackage;
|
|
144
234
|
const where = status.installed
|
|
145
235
|
? `(already installed)`
|
|
146
|
-
: `→ ${
|
|
236
|
+
: `→ ${pkgLabel}`;
|
|
147
237
|
lines.push(` ${mark} ${status.dep.binary.padEnd(36)} ${where}`);
|
|
148
238
|
}
|
|
149
239
|
if (result.missingPackages.length === 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../../src/cli/init/dependencies.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,2BAA2B;AAC3B,EAAE;AACF,oEAAoE;AACpE,sEAAsE;AACtE,uEAAuE;AACvE,wEAAwE;AACxE,mEAAmE;AACnE,uEAAuE;AACvE,oEAAoE;AACpE,iEAAiE;AACjE,EAAE;AACF,wEAAwE;AACxE,uEAAuE;AACvE,kEAAkE;AAClE,iEAAiE;AACjE,mDAAmD;AAEnD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../../src/cli/init/dependencies.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,2BAA2B;AAC3B,EAAE;AACF,oEAAoE;AACpE,sEAAsE;AACtE,uEAAuE;AACvE,wEAAwE;AACxE,mEAAmE;AACnE,uEAAuE;AACvE,oEAAoE;AACpE,iEAAiE;AACjE,EAAE;AACF,wEAAwE;AACxE,uEAAuE;AACvE,kEAAkE;AAClE,iEAAiE;AACjE,mDAAmD;AAEnD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,KAAK,IAA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AAE,EAAE;YACxB,OAAO,CAAC,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,QAAkB,EAClB,OAAuB,EAAE;IAEzB,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;IAC9D,CAAC;IACD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,IAAI,SAAS,CAAC;IACpC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC;IACpE,OAAO;QACL,EAAE,EAAE,IAAI,KAAK,CAAC;QACd,SAAS,EAAE,CAAC,GAAG,QAAQ,CAAC;QACxB,MAAM;QACN,QAAQ,EAAE,IAAI;KACf,CAAC;AACJ,CAAC"}
|
package/dist/cli/init/index.d.ts
CHANGED
|
@@ -1,13 +1,30 @@
|
|
|
1
1
|
import { type TemplateName } from "./templates.js";
|
|
2
2
|
export interface InitOptions {
|
|
3
3
|
template?: TemplateName;
|
|
4
|
+
/**
|
|
5
|
+
* Pre-composed manifest YAML; bypasses the template lookup. Used by
|
|
6
|
+
* the interactive Custom-profile composer (task 31d2fbb5) so the same
|
|
7
|
+
* lock + validateBeforeWrite + overwrite-guard path is reused without
|
|
8
|
+
* needing a second write surface.
|
|
9
|
+
*/
|
|
10
|
+
content?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Label surfaced to the operator and recorded on `InitResult.template`
|
|
13
|
+
* when `content` is provided (the YAML carries no template name of its
|
|
14
|
+
* own). Defaults to `"custom"`.
|
|
15
|
+
*/
|
|
16
|
+
contentLabel?: string;
|
|
4
17
|
force?: boolean;
|
|
5
18
|
configPath?: string;
|
|
6
19
|
homeDir?: string;
|
|
7
20
|
}
|
|
8
21
|
export interface InitResult {
|
|
9
22
|
path: string;
|
|
10
|
-
|
|
23
|
+
/**
|
|
24
|
+
* The template name written, or `contentLabel` (default "custom")
|
|
25
|
+
* when the caller passed `content` instead of selecting a preset.
|
|
26
|
+
*/
|
|
27
|
+
template: TemplateName | string;
|
|
11
28
|
overwrote: boolean;
|
|
12
29
|
stdout: string;
|
|
13
30
|
stderr: string;
|
package/dist/cli/init/index.js
CHANGED
|
@@ -19,13 +19,23 @@ function resolveTargetPath(opts) {
|
|
|
19
19
|
}
|
|
20
20
|
export async function init(opts = {}) {
|
|
21
21
|
const target = resolveTargetPath(opts);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
//
|
|
25
|
-
|
|
22
|
+
// When the caller supplied pre-composed YAML, use it verbatim and
|
|
23
|
+
// record the contentLabel (default "custom") in the result. Otherwise
|
|
24
|
+
// fall back to the named-template path.
|
|
25
|
+
const usingContent = opts.content !== undefined;
|
|
26
|
+
const templateLabel = usingContent
|
|
27
|
+
? opts.contentLabel ?? "custom"
|
|
28
|
+
: opts.template ?? "minimal";
|
|
29
|
+
const content = usingContent
|
|
30
|
+
? opts.content
|
|
31
|
+
: getTemplate(opts.template ?? "minimal");
|
|
32
|
+
// Validate before any disk work. For named templates a failure is a
|
|
33
|
+
// code bug; for composer output it's also a code bug (the composer is
|
|
34
|
+
// expected to emit validate-clean YAML). Either way we want to fail
|
|
35
|
+
// loud BEFORE clobbering the on-disk manifest.
|
|
26
36
|
const validation = validateBeforeWrite(parseYaml(content));
|
|
27
37
|
if (!validation.ok) {
|
|
28
|
-
throw new HarnessExitError(`template "${
|
|
38
|
+
throw new HarnessExitError(`${usingContent ? "composed manifest" : `template "${templateLabel}"`} failed validation:\n${formatValidationErrors(validation.errors)}`, EX_SOFTWARE);
|
|
29
39
|
}
|
|
30
40
|
const lockPath = path.join(path.dirname(target), LOCK_BASENAME);
|
|
31
41
|
// Existence check + write inside the lock so two concurrent `init` calls
|
|
@@ -40,7 +50,7 @@ export async function init(opts = {}) {
|
|
|
40
50
|
});
|
|
41
51
|
const stderr = exists ? `(overwriting existing manifest at ${target})\n` : "";
|
|
42
52
|
const stdout = [
|
|
43
|
-
`harness manifest written to ${target} (template: ${
|
|
53
|
+
`harness manifest written to ${target} (template: ${templateLabel})`,
|
|
44
54
|
"",
|
|
45
55
|
"Next steps:",
|
|
46
56
|
` harness validate --config ${target}`,
|
|
@@ -48,7 +58,7 @@ export async function init(opts = {}) {
|
|
|
48
58
|
` harness doctor --config ${target}`,
|
|
49
59
|
"",
|
|
50
60
|
].join("\n");
|
|
51
|
-
return { path: target, template, overwrote: exists, stdout, stderr };
|
|
61
|
+
return { path: target, template: templateLabel, overwrote: exists, stdout, stderr };
|
|
52
62
|
}
|
|
53
63
|
export const KNOWN_TEMPLATES = ["minimal", "solo", "team", "full"];
|
|
54
64
|
export function isTemplate(s) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/init/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EACL,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,E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AAM,GAAG,MAAM,CAAC,CAAC,CAAC,qCAAqC,MAAM,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9E,MAAM,MAAM,GAAG;QACb,+BAA+B,MAAM,eAAe,aAAa,GAAG;QACpE,EAAE;QACF,aAAa;QACb,+BAA+B,MAAM,EAAE;QACvC,+BAA+B,MAAM,EAAE;QACvC,+BAA+B,MAAM,EAAE;QACvC,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AACtF,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAEnF,MAAM,UAAU,UAAU,CAAC,CAAS;IAClC,OAAQ,eAA4B,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { select, confirm, input } from "@inquirer/prompts";
|
|
1
|
+
import { select, confirm, input, checkbox } from "@inquirer/prompts";
|
|
2
|
+
import { type RuntimeName } from "./detect.js";
|
|
2
3
|
import { type InitResult } from "./index.js";
|
|
3
4
|
import { type ApplyResult } from "../apply/index.js";
|
|
4
5
|
import { type InstallOptions } from "./dependencies.js";
|
|
@@ -7,6 +8,22 @@ export interface InteractivePrompts {
|
|
|
7
8
|
select: typeof select;
|
|
8
9
|
confirm: typeof confirm;
|
|
9
10
|
input: typeof input;
|
|
11
|
+
checkbox: typeof checkbox;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Wire targets the wizard knows about. `claude-code` and `codex` map to
|
|
15
|
+
* the runtimes that `harness apply` already supports. `opencode` is
|
|
16
|
+
* surfaced as disabled until the runtime adapter (agent-tasks/f34eb233)
|
|
17
|
+
* lands; including it here keeps the checkbox slot stable so docs and
|
|
18
|
+
* screenshots do not churn when the adapter ships.
|
|
19
|
+
*/
|
|
20
|
+
export type WireableRuntime = RuntimeName;
|
|
21
|
+
export interface RuntimeApplyOutcome {
|
|
22
|
+
runtime: WireableRuntime;
|
|
23
|
+
/** undefined if `apply()` threw — recoveryHint carries the user-facing message. */
|
|
24
|
+
apply?: ApplyResult;
|
|
25
|
+
/** Operator-facing recovery message when apply threw, or the manual merge command for codex. */
|
|
26
|
+
recoveryHint?: string;
|
|
10
27
|
}
|
|
11
28
|
export interface RunInteractiveOptions {
|
|
12
29
|
/** Override homedir for detection + write target. */
|
|
@@ -37,7 +54,19 @@ export interface InteractiveResult {
|
|
|
37
54
|
profile?: ProfileChoice;
|
|
38
55
|
/** Whether `harness validate` reported zero errors after the write. */
|
|
39
56
|
validateClean?: boolean;
|
|
40
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* Per-runtime apply outcome from the wire-now step. Present when the
|
|
59
|
+
* operator selected at least one runtime in the multiselect (default:
|
|
60
|
+
* every detected runtime is pre-checked). Empty array means the
|
|
61
|
+
* operator unchecked all runtimes — manifest stays on disk, no wiring.
|
|
62
|
+
*/
|
|
63
|
+
applies?: RuntimeApplyOutcome[];
|
|
64
|
+
/**
|
|
65
|
+
* Legacy single-runtime shorthand: the claude-code apply outcome, if
|
|
66
|
+
* the wizard wired claude-code this run. Preserved so callers that
|
|
67
|
+
* predate task 696f7560 keep working. New code should read `applies[]`
|
|
68
|
+
* instead.
|
|
69
|
+
*/
|
|
41
70
|
apply?: ApplyResult;
|
|
42
71
|
}
|
|
43
72
|
export declare function runInteractive(opts?: RunInteractiveOptions): Promise<InteractiveResult>;
|