@dadado/agent-kit-cli 6.25.0 → 6.26.1
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/dashboard/dashboard.html +3 -3
- package/dashboard/lib/guards.mjs +1 -0
- package/dist/{add-OYLOMCM6.js → add-G7KEZLWP.js} +7 -6
- package/dist/{chunk-7HDQEK6T.js → chunk-2G4K4ZI5.js} +7 -3
- package/dist/{chunk-QLTGHJB3.js → chunk-2GXN7HVG.js} +5 -5
- package/dist/{chunk-IFBIO7VT.js → chunk-3KFLQE6Y.js} +1533 -52
- package/dist/{chunk-GQSSXDDK.js → chunk-ARJRICI2.js} +1 -1
- package/dist/{chunk-6WUKLS4D.js → chunk-BIFTTL2O.js} +1 -1
- package/dist/{chunk-QACMV46U.js → chunk-BSK6C4UO.js} +19 -12
- package/dist/{chunk-NJ2SUSWX.js → chunk-BVZDPVUL.js} +1 -1
- package/dist/{chunk-GMG7ZH4E.js → chunk-DOMBVLI4.js} +13 -13
- package/dist/{chunk-2F6NMQOA.js → chunk-FB6G6OD6.js} +3 -3
- package/dist/{chunk-MFKHIWEL.js → chunk-FOVHFMSH.js} +1 -1
- package/dist/{chunk-EO5NGAYV.js → chunk-FUSNEYGU.js} +29 -3
- package/dist/{chunk-SAQ3EE5R.js → chunk-HGB4DHXV.js} +3 -3
- package/dist/{chunk-6M6UKECW.js → chunk-IHVJTGYR.js} +0 -32
- package/dist/chunk-KMK4T4ZM.js +34 -0
- package/dist/{chunk-ZMYV6PRE.js → chunk-LEVNLHH3.js} +2 -1
- package/dist/{chunk-2XLI7XEY.js → chunk-MGVV6YC4.js} +1 -1
- package/dist/{chunk-C7SV7UP5.js → chunk-MWRYQLEG.js} +3 -3
- package/dist/{chunk-WKFE3RUC.js → chunk-NHJ4IAVN.js} +5 -3
- package/dist/{chunk-HSIHZWFF.js → chunk-NW5SWKJV.js} +7 -7
- package/dist/{chunk-C4Q77GGJ.js → chunk-O7VMHCNN.js} +6 -0
- package/dist/{chunk-CIV42JGT.js → chunk-PCIYXGB3.js} +2 -2
- package/dist/{chunk-7Y74KO7U.js → chunk-PLLXFSN2.js} +12 -12
- package/dist/{chunk-XGZOU4DS.js → chunk-QMCBXCP5.js} +4 -4
- package/dist/{chunk-QX55T4UX.js → chunk-RJP47EGS.js} +6 -1
- package/dist/{chunk-KWYF7QNH.js → chunk-RLVY6YD3.js} +17 -2
- package/dist/{chunk-JGG574RK.js → chunk-RRJVC35Y.js} +3 -3
- package/dist/{chunk-PIMGV3E5.js → chunk-SWJJW624.js} +1 -1
- package/dist/{chunk-G5MQRP6M.js → chunk-SYRJ5TTK.js} +13 -9
- package/dist/{chunk-L5V3W3DY.js → chunk-TTUFIE26.js} +60 -14
- package/dist/chunk-WOXTL43E.js +248 -0
- package/dist/{chunk-JFS4GKP7.js → chunk-XXPI4H4D.js} +2 -2
- package/dist/{chunk-M4UL422I.js → chunk-Y5526WCN.js} +6 -6
- package/dist/{chunk-CXE6ASSX.js → chunk-Y575INEC.js} +1 -1
- package/dist/{chunk-H7RAFRRZ.js → chunk-YFRG3CMS.js} +68 -34
- package/dist/{chunk-JG3CNGQM.js → chunk-ZNZHDPS3.js} +6 -4
- package/dist/{commands-UW2C2ZN4.js → commands-SCFSX4U4.js} +8 -6
- package/dist/{conflicts-RING6AHV.js → conflicts-4GLQOMJF.js} +9 -10
- package/dist/{contribute-LSY75JZH.js → contribute-HE4WCBRY.js} +7 -6
- package/dist/{countdown-SZ2P4XHB.js → countdown-VXOFV23S.js} +104 -57
- package/dist/{dashboard-P65XHYCU.js → dashboard-6V6PCNYF.js} +1 -1
- package/dist/{dashboard-broadcast-GYK34QYL.js → dashboard-broadcast-PMVQ7PXU.js} +1 -1
- package/dist/{diff-NZVBVQSK.js → diff-3XUZM7ZT.js} +8 -7
- package/dist/{doctor-TJSXBVGV.js → doctor-KGUWU5SN.js} +16 -15
- package/dist/{engine-info-BBI5QO5Y.js → engine-info-VM4VPGQM.js} +2 -2
- package/dist/{ground-control-ZJXPUIQN.js → ground-control-J4AMA4S4.js} +7 -4
- package/dist/{handoff-2OZSWGTE.js → handoff-LLT4CI6H.js} +2 -3
- package/dist/{hook-3VPKNSOO.js → hook-UPZ3CPYS.js} +22 -22
- package/dist/index.js +52 -32
- package/dist/{init-UW2BJBO2.js → init-ZHLVXEVT.js} +19 -18
- package/dist/{install-RQSI4CHG.js → install-XWOG64W3.js} +19 -18
- package/dist/{installs-7TR4H4QH.js → installs-2ROXPO6M.js} +5 -4
- package/dist/{mission-control-VSU6NT43.js → mission-control-IGOI3WHS.js} +2 -2
- package/dist/models-SNB5Q3YU.js +45 -0
- package/dist/paths-JTPV6SXH.js +107 -0
- package/dist/pi-DCMDOY65.js +248 -0
- package/dist/{plan-index-BNLUU6T5.js → plan-index-5QZJK4AG.js} +2 -3
- package/dist/{queue-JHYILLMX.js → queue-HDR5ER25.js} +11 -13
- package/dist/{run-CQF5RM5X.js → run-RGIY5JTX.js} +24 -30
- package/dist/{run-plan-BEOCOJCF.js → run-plan-DHB3ZXJS.js} +35 -23
- package/dist/{session-start-QV7CEFRX.js → session-start-NC2HE5X5.js} +16 -16
- package/dist/{sessions-AWAAO3DU.js → sessions-WWWLYPW6.js} +4 -4
- package/dist/{setup-global-ST4TT427.js → setup-global-WDMARD4Z.js} +11 -10
- package/dist/{status-HUBPBGUU.js → status-2WNJL7PP.js} +12 -11
- package/dist/update-OXCWYN3Y.js +32 -0
- package/dist/{update-all-YYUTXHGR.js → update-all-E2MV6KME.js} +20 -18
- package/package.json +14 -4
- package/pi/agent-kit.ts +224 -0
- package/dist/chunk-7ABY6DYH.js +0 -89
- package/dist/chunk-AQLBEEPD.js +0 -625
- package/dist/chunk-MUTTNRX4.js +0 -53
- package/dist/chunk-TOSAAQ5A.js +0 -71
- package/dist/update-DD5UZPGG.js +0 -31
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CURSOR_COMMANDS_DIR_REL
|
|
3
|
+
} from "./chunk-FUSNEYGU.js";
|
|
4
|
+
import "./chunk-RJP47EGS.js";
|
|
5
|
+
import {
|
|
6
|
+
MANIFEST_RELATIVE_PATH
|
|
7
|
+
} from "./chunk-KMK4T4ZM.js";
|
|
8
|
+
import {
|
|
9
|
+
KIT_VERSION
|
|
10
|
+
} from "./chunk-2G4K4ZI5.js";
|
|
11
|
+
import {
|
|
12
|
+
SKILL_DIRS_REL
|
|
13
|
+
} from "./chunk-O7VMHCNN.js";
|
|
14
|
+
import {
|
|
15
|
+
fileExists
|
|
16
|
+
} from "./chunk-5B4DVO6C.js";
|
|
17
|
+
|
|
18
|
+
// src/commands/paths.ts
|
|
19
|
+
import { defineCommand } from "citty";
|
|
20
|
+
|
|
21
|
+
// src/lifecycle/kit-surface-paths.ts
|
|
22
|
+
import { stat } from "fs/promises";
|
|
23
|
+
import path from "path";
|
|
24
|
+
var KIT_SURFACE_PATHS_SCHEMA_VERSION = 1;
|
|
25
|
+
async function isDirectory(target) {
|
|
26
|
+
try {
|
|
27
|
+
return (await stat(target)).isDirectory();
|
|
28
|
+
} catch {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
async function resolveKitRoot(cwd) {
|
|
33
|
+
let dir = path.resolve(cwd);
|
|
34
|
+
for (; ; ) {
|
|
35
|
+
if (await fileExists(path.join(dir, MANIFEST_RELATIVE_PATH))) return dir;
|
|
36
|
+
if (await fileExists(path.join(dir, ".git"))) return null;
|
|
37
|
+
const parent = path.dirname(dir);
|
|
38
|
+
if (parent === dir) return null;
|
|
39
|
+
dir = parent;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
async function resolveKitSurfacePaths(cwd) {
|
|
43
|
+
const root = await resolveKitRoot(cwd);
|
|
44
|
+
if (!root) return null;
|
|
45
|
+
const commandsDir = path.join(root, CURSOR_COMMANDS_DIR_REL);
|
|
46
|
+
const skillDirs = SKILL_DIRS_REL.map((rel) => path.join(root, rel));
|
|
47
|
+
const present = await Promise.all(skillDirs.map(isDirectory));
|
|
48
|
+
return {
|
|
49
|
+
schemaVersion: KIT_SURFACE_PATHS_SCHEMA_VERSION,
|
|
50
|
+
kitVersion: KIT_VERSION,
|
|
51
|
+
root,
|
|
52
|
+
commands: await isDirectory(commandsDir) ? commandsDir : null,
|
|
53
|
+
skills: skillDirs.filter((_, i) => present[i])
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function noKitRootMessage(cwd) {
|
|
57
|
+
return `No Agent Kit here: no ${MANIFEST_RELATIVE_PATH} in ${path.resolve(cwd)} or its parents (up to the git root). Run from inside a kit project or pass --cwd <path>.`;
|
|
58
|
+
}
|
|
59
|
+
function renderKitSurfacePaths(paths) {
|
|
60
|
+
return [
|
|
61
|
+
`root: ${paths.root}`,
|
|
62
|
+
`commands: ${paths.commands ?? "(none)"}`,
|
|
63
|
+
`skills: ${paths.skills.length > 0 ? paths.skills.join(", ") : "(none)"}`
|
|
64
|
+
].join("\n");
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// src/commands/paths.ts
|
|
68
|
+
async function runPathsCommand(cwd, json) {
|
|
69
|
+
const paths = await resolveKitSurfacePaths(cwd);
|
|
70
|
+
if (!paths) return { exitCode: 1, stdout: "", stderr: noKitRootMessage(cwd) };
|
|
71
|
+
return {
|
|
72
|
+
exitCode: 0,
|
|
73
|
+
stdout: json ? JSON.stringify(paths, null, 2) : renderKitSurfacePaths(paths),
|
|
74
|
+
stderr: ""
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
var pathsCommand = defineCommand({
|
|
78
|
+
meta: {
|
|
79
|
+
name: "paths",
|
|
80
|
+
description: "Print the kit root and its command and skill directories (read-only; --json)"
|
|
81
|
+
},
|
|
82
|
+
args: {
|
|
83
|
+
cwd: {
|
|
84
|
+
type: "string",
|
|
85
|
+
default: process.cwd(),
|
|
86
|
+
description: "Directory to resolve the kit root from (walks up to the git root)"
|
|
87
|
+
},
|
|
88
|
+
json: {
|
|
89
|
+
type: "boolean",
|
|
90
|
+
default: false,
|
|
91
|
+
description: "Print { schemaVersion, kitVersion, root, commands, skills } as JSON"
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
async run({ args }) {
|
|
95
|
+
const cwd = typeof args.cwd === "string" ? args.cwd : process.cwd();
|
|
96
|
+
const result = await runPathsCommand(cwd, args.json === true);
|
|
97
|
+
if (result.stdout) process.stdout.write(`${result.stdout}
|
|
98
|
+
`);
|
|
99
|
+
if (result.stderr) process.stderr.write(`${result.stderr}
|
|
100
|
+
`);
|
|
101
|
+
process.exitCode = result.exitCode;
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
export {
|
|
105
|
+
pathsCommand,
|
|
106
|
+
runPathsCommand
|
|
107
|
+
};
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import {
|
|
2
|
+
KIT_PACKAGE_NAME,
|
|
3
|
+
KIT_VERSION
|
|
4
|
+
} from "./chunk-2G4K4ZI5.js";
|
|
5
|
+
|
|
6
|
+
// src/commands/pi.ts
|
|
7
|
+
import { execFile } from "child_process";
|
|
8
|
+
import { existsSync } from "fs";
|
|
9
|
+
import { homedir } from "os";
|
|
10
|
+
import path from "path";
|
|
11
|
+
import { defineCommand } from "citty";
|
|
12
|
+
var defaultPiRunner = (args) => new Promise((resolve) => {
|
|
13
|
+
execFile(
|
|
14
|
+
"pi",
|
|
15
|
+
args,
|
|
16
|
+
{ encoding: "utf8", maxBuffer: 4 * 1024 * 1024 },
|
|
17
|
+
(error, stdout, stderr) => {
|
|
18
|
+
const err = error;
|
|
19
|
+
resolve({
|
|
20
|
+
code: err ? typeof err.code === "number" ? err.code : null : 0,
|
|
21
|
+
stdout: String(stdout ?? ""),
|
|
22
|
+
stderr: String(stderr ?? ""),
|
|
23
|
+
missing: err?.code === "ENOENT"
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
});
|
|
28
|
+
var PI_MISSING = "pi is not on PATH. Install pi (https://pi.dev) first; the Agent Kit bridge is a pi package.";
|
|
29
|
+
function piPackageSpec(name, version) {
|
|
30
|
+
return `npm:${name}@${version}`;
|
|
31
|
+
}
|
|
32
|
+
function parsePiList(stdout) {
|
|
33
|
+
const out = { user: [], project: [] };
|
|
34
|
+
let section = null;
|
|
35
|
+
for (const line of stdout.split("\n")) {
|
|
36
|
+
if (/^User packages:/.test(line)) section = "user";
|
|
37
|
+
else if (/^Project packages:/.test(line)) section = "project";
|
|
38
|
+
else if (/^\S/.test(line)) section = null;
|
|
39
|
+
else if (section && /^ {2}\S/.test(line)) out[section].push(line.trim());
|
|
40
|
+
}
|
|
41
|
+
return out;
|
|
42
|
+
}
|
|
43
|
+
function sourcesForPackage(sources, name) {
|
|
44
|
+
const prefix = `npm:${name}`;
|
|
45
|
+
return sources.filter((s) => s === prefix || s.startsWith(`${prefix}@`));
|
|
46
|
+
}
|
|
47
|
+
function scopeFlags(local, approve) {
|
|
48
|
+
if (!local) return [];
|
|
49
|
+
return approve ? ["--local", "--approve"] : ["--local"];
|
|
50
|
+
}
|
|
51
|
+
var NOT_TRUSTED = /project is not trusted/i;
|
|
52
|
+
var APPROVE_HINT = "Re-run with --approve to let pi change this project's package config for this one command (pi's saved trust stays untouched).";
|
|
53
|
+
function piOutput(run) {
|
|
54
|
+
return `${run.stdout}
|
|
55
|
+
${run.stderr}`.split("\n").map((l) => l.trimEnd()).filter((l) => l.trim() !== "");
|
|
56
|
+
}
|
|
57
|
+
function settingsTarget(options) {
|
|
58
|
+
if (options.local) return path.join(options.cwd, ".pi", "settings.json");
|
|
59
|
+
const agentDir = options.env?.PI_CODING_AGENT_DIR || path.join(homedir(), ".pi", "agent");
|
|
60
|
+
return path.join(agentDir, "settings.json");
|
|
61
|
+
}
|
|
62
|
+
function removeLine(name, local) {
|
|
63
|
+
const line = ["pi", "remove", ...scopeFlags(local, false), `npm:${name}`].join(" ");
|
|
64
|
+
return local ? `${line} (add --approve while pi does not trust this project)` : line;
|
|
65
|
+
}
|
|
66
|
+
async function configuredSources(run, local, approve) {
|
|
67
|
+
if (local && !approve) return { skipped: true };
|
|
68
|
+
const listed = await run(["list", ...local ? ["--approve"] : []]);
|
|
69
|
+
if (listed.missing) return { error: { exitCode: 1, lines: [PI_MISSING] } };
|
|
70
|
+
if (listed.code !== 0) {
|
|
71
|
+
const detail = listed.stderr.trim() || listed.stdout.trim();
|
|
72
|
+
return {
|
|
73
|
+
error: { exitCode: 1, lines: [`\`pi list\` failed (exit ${listed.code}): ${detail}`] }
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
const parsed = parsePiList(listed.stdout);
|
|
77
|
+
return { sources: local ? parsed.project : parsed.user };
|
|
78
|
+
}
|
|
79
|
+
function resolved(options) {
|
|
80
|
+
return {
|
|
81
|
+
name: options.packageName ?? KIT_PACKAGE_NAME,
|
|
82
|
+
version: options.version ?? KIT_VERSION,
|
|
83
|
+
run: options.run ?? defaultPiRunner,
|
|
84
|
+
scope: options.local ? "project" : "user",
|
|
85
|
+
approve: options.approve === true
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
var SKIPPED_CHECK = "Skipped the already-configured check: pi lists project packages only with --approve.";
|
|
89
|
+
function refused(run, args) {
|
|
90
|
+
const lines = piOutput(run);
|
|
91
|
+
if (lines.some((l) => NOT_TRUSTED.test(l)))
|
|
92
|
+
return { exitCode: 1, lines: [...lines, APPROVE_HINT] };
|
|
93
|
+
return { exitCode: 1, lines: [...lines, `\`pi ${args.join(" ")}\` failed (exit ${run.code}).`] };
|
|
94
|
+
}
|
|
95
|
+
async function runPiInstall(options) {
|
|
96
|
+
const { name, version, run, scope, approve } = resolved(options);
|
|
97
|
+
if (!name) return { exitCode: 1, lines: ["Cannot read this CLI's package name."] };
|
|
98
|
+
const spec = piPackageSpec(name, version);
|
|
99
|
+
const installArgs = ["install", ...scopeFlags(options.local, approve), spec];
|
|
100
|
+
const target = settingsTarget(options);
|
|
101
|
+
const found = await configuredSources(run, options.local, approve);
|
|
102
|
+
if ("error" in found) return found.error;
|
|
103
|
+
const lines = [];
|
|
104
|
+
if ("skipped" in found) lines.push(SKIPPED_CHECK);
|
|
105
|
+
const current = "sources" in found ? sourcesForPackage(found.sources, name) : [];
|
|
106
|
+
if (current.includes(spec)) {
|
|
107
|
+
return {
|
|
108
|
+
exitCode: 0,
|
|
109
|
+
lines: [
|
|
110
|
+
`Already installed: ${spec} (${scope} scope, ${target}). Nothing to do.`,
|
|
111
|
+
`Remove with: ${removeLine(name, options.local)}`
|
|
112
|
+
]
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
if (current.length > 0) lines.push(`Replacing ${current.join(", ")} with ${spec}.`);
|
|
116
|
+
if (options.dryRun) {
|
|
117
|
+
lines.push(`Dry run. Would run: pi ${installArgs.join(" ")}`);
|
|
118
|
+
lines.push(`It would write ${target}.`);
|
|
119
|
+
return { exitCode: 0, lines };
|
|
120
|
+
}
|
|
121
|
+
const installed = await run(installArgs);
|
|
122
|
+
if (installed.missing) return { exitCode: 1, lines: [PI_MISSING] };
|
|
123
|
+
if (installed.code !== 0) {
|
|
124
|
+
const failure = refused(installed, installArgs);
|
|
125
|
+
return { exitCode: 1, lines: [...lines, ...failure.lines] };
|
|
126
|
+
}
|
|
127
|
+
lines.push(...piOutput(installed));
|
|
128
|
+
lines.push(`Installed the Agent Kit bridge for pi: ${spec} (${scope} scope, ${target}).`);
|
|
129
|
+
lines.push(
|
|
130
|
+
"pi now loads the kit's commands, skills and session context in any folder with a kit; run /reload in open pi sessions."
|
|
131
|
+
);
|
|
132
|
+
const agentDir = options.env?.PI_CODING_AGENT_DIR || path.join(homedir(), ".pi", "agent");
|
|
133
|
+
const standalone = path.join(agentDir, "extensions", "agent-kit.ts");
|
|
134
|
+
if (existsSync(standalone)) {
|
|
135
|
+
lines.push(
|
|
136
|
+
`Note: ${standalone} also exists; pi would load two bridges. Remove that file to keep only the package.`
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
lines.push(`Remove with: ${removeLine(name, options.local)}`);
|
|
140
|
+
return { exitCode: 0, lines };
|
|
141
|
+
}
|
|
142
|
+
async function runPiRemove(options) {
|
|
143
|
+
const { name, run, scope, approve } = resolved(options);
|
|
144
|
+
if (!name) return { exitCode: 1, lines: ["Cannot read this CLI's package name."] };
|
|
145
|
+
const found = await configuredSources(run, options.local, approve);
|
|
146
|
+
if ("error" in found) return found.error;
|
|
147
|
+
const nothing = `Not installed in ${scope} scope: npm:${name}. Nothing to do.`;
|
|
148
|
+
const lines = [];
|
|
149
|
+
if ("skipped" in found) lines.push(SKIPPED_CHECK);
|
|
150
|
+
else if (sourcesForPackage(found.sources, name).length === 0) {
|
|
151
|
+
return { exitCode: 0, lines: [nothing] };
|
|
152
|
+
}
|
|
153
|
+
const args = ["remove", ...scopeFlags(options.local, approve), `npm:${name}`];
|
|
154
|
+
if (options.dryRun) {
|
|
155
|
+
return { exitCode: 0, lines: [...lines, `Dry run. Would run: pi ${args.join(" ")}`] };
|
|
156
|
+
}
|
|
157
|
+
const removed = await run(args);
|
|
158
|
+
if (removed.missing) return { exitCode: 1, lines: [PI_MISSING] };
|
|
159
|
+
const output = piOutput(removed);
|
|
160
|
+
if (removed.code !== 0) {
|
|
161
|
+
if (output.some((l) => /no matching package found/i.test(l))) {
|
|
162
|
+
return { exitCode: 0, lines: [...lines, nothing] };
|
|
163
|
+
}
|
|
164
|
+
const failure = refused(removed, args);
|
|
165
|
+
return { exitCode: 1, lines: [...lines, ...failure.lines] };
|
|
166
|
+
}
|
|
167
|
+
return {
|
|
168
|
+
exitCode: 0,
|
|
169
|
+
lines: [
|
|
170
|
+
...lines,
|
|
171
|
+
...output,
|
|
172
|
+
`Removed npm:${name} (${scope} scope, ${settingsTarget(options)}).`
|
|
173
|
+
]
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
var sharedArgs = {
|
|
177
|
+
local: {
|
|
178
|
+
type: "boolean",
|
|
179
|
+
default: false,
|
|
180
|
+
description: "Use this project's .pi/settings.json instead of the user settings"
|
|
181
|
+
},
|
|
182
|
+
approve: {
|
|
183
|
+
type: "boolean",
|
|
184
|
+
default: false,
|
|
185
|
+
description: "With --local: pass pi's --approve (trust this project's files for this one pi command)"
|
|
186
|
+
},
|
|
187
|
+
"dry-run": {
|
|
188
|
+
type: "boolean",
|
|
189
|
+
default: false,
|
|
190
|
+
description: "Print the pi command without running it"
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
function report(result) {
|
|
194
|
+
const stream = result.exitCode === 0 ? process.stdout : process.stderr;
|
|
195
|
+
for (const line of result.lines) stream.write(`${line}
|
|
196
|
+
`);
|
|
197
|
+
process.exitCode = result.exitCode;
|
|
198
|
+
}
|
|
199
|
+
var piCommand = defineCommand({
|
|
200
|
+
meta: {
|
|
201
|
+
name: "pi",
|
|
202
|
+
description: "Opt-in: install or remove the Agent Kit bridge for pi (a pi package from this CLI's npm package)"
|
|
203
|
+
},
|
|
204
|
+
subCommands: {
|
|
205
|
+
install: defineCommand({
|
|
206
|
+
meta: {
|
|
207
|
+
name: "install",
|
|
208
|
+
description: "Run `pi install npm:<this CLI>@<this version>` (user scope; --local for project)"
|
|
209
|
+
},
|
|
210
|
+
args: sharedArgs,
|
|
211
|
+
async run({ args }) {
|
|
212
|
+
report(
|
|
213
|
+
await runPiInstall({
|
|
214
|
+
local: args.local === true,
|
|
215
|
+
approve: args.approve === true,
|
|
216
|
+
dryRun: args["dry-run"] === true,
|
|
217
|
+
cwd: process.cwd(),
|
|
218
|
+
env: process.env
|
|
219
|
+
})
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
}),
|
|
223
|
+
remove: defineCommand({
|
|
224
|
+
meta: { name: "remove", description: "Run `pi remove npm:<this CLI>` for the chosen scope" },
|
|
225
|
+
args: sharedArgs,
|
|
226
|
+
async run({ args }) {
|
|
227
|
+
report(
|
|
228
|
+
await runPiRemove({
|
|
229
|
+
local: args.local === true,
|
|
230
|
+
approve: args.approve === true,
|
|
231
|
+
dryRun: args["dry-run"] === true,
|
|
232
|
+
cwd: process.cwd(),
|
|
233
|
+
env: process.env
|
|
234
|
+
})
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
})
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
export {
|
|
241
|
+
defaultPiRunner,
|
|
242
|
+
parsePiList,
|
|
243
|
+
piCommand,
|
|
244
|
+
piPackageSpec,
|
|
245
|
+
runPiInstall,
|
|
246
|
+
runPiRemove,
|
|
247
|
+
sourcesForPackage
|
|
248
|
+
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
formatPlanIndexLines,
|
|
3
3
|
writePlanIndex
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-C4Q77GGJ.js";
|
|
4
|
+
} from "./chunk-TTUFIE26.js";
|
|
5
|
+
import "./chunk-O7VMHCNN.js";
|
|
7
6
|
import "./chunk-5B4DVO6C.js";
|
|
8
7
|
|
|
9
8
|
// src/commands/plan-index.ts
|
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
2
|
readHandoffText
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-TOSAAQ5A.js";
|
|
7
|
-
import "./chunk-XGZOU4DS.js";
|
|
8
|
-
import {
|
|
9
|
-
extractFieldBlock
|
|
10
|
-
} from "./chunk-L5V3W3DY.js";
|
|
11
|
-
import "./chunk-MUTTNRX4.js";
|
|
3
|
+
} from "./chunk-BSK6C4UO.js";
|
|
4
|
+
import "./chunk-BIFTTL2O.js";
|
|
5
|
+
import "./chunk-QMCBXCP5.js";
|
|
12
6
|
import {
|
|
13
7
|
QUEUE_LEASE_RELPATH,
|
|
14
8
|
formatQueueLeaseRefusal,
|
|
15
9
|
inspectQueueLease
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-FOVHFMSH.js";
|
|
11
|
+
import "./chunk-RLVY6YD3.js";
|
|
12
|
+
import "./chunk-3KFLQE6Y.js";
|
|
19
13
|
import "./chunk-P7732A25.js";
|
|
14
|
+
import {
|
|
15
|
+
extractFieldBlock
|
|
16
|
+
} from "./chunk-TTUFIE26.js";
|
|
20
17
|
import "./chunk-WGLPZXNU.js";
|
|
21
18
|
import "./chunk-Q35TWISF.js";
|
|
22
19
|
import "./chunk-QTON2GQX.js";
|
|
23
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-PFEUZXVT.js";
|
|
21
|
+
import "./chunk-O7VMHCNN.js";
|
|
24
22
|
import "./chunk-5B4DVO6C.js";
|
|
25
23
|
|
|
26
24
|
// src/commands/queue.ts
|
|
@@ -2,43 +2,27 @@ import {
|
|
|
2
2
|
runPlanLoop,
|
|
3
3
|
shouldUseLiveTui,
|
|
4
4
|
withLiveTui
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import
|
|
7
|
-
CLAUDE_SUBAGENT_MODEL_ENV,
|
|
8
|
-
describeResolvedRoles,
|
|
9
|
-
loadRolesContext,
|
|
10
|
-
resolveReviewJobRole,
|
|
11
|
-
resolveSubworkerModel,
|
|
12
|
-
resolveWorkerRole
|
|
13
|
-
} from "./chunk-AQLBEEPD.js";
|
|
5
|
+
} from "./chunk-YFRG3CMS.js";
|
|
6
|
+
import "./chunk-WOXTL43E.js";
|
|
14
7
|
import {
|
|
15
8
|
REVIEW_PACK_SLASH,
|
|
16
9
|
runReviewJob
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-NW5SWKJV.js";
|
|
11
|
+
import "./chunk-ARJRICI2.js";
|
|
12
|
+
import "./chunk-Y575INEC.js";
|
|
20
13
|
import {
|
|
21
14
|
negatedFlag
|
|
22
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-LEVNLHH3.js";
|
|
23
16
|
import {
|
|
24
17
|
landDispatchOutcome,
|
|
25
18
|
runDispatchDriver
|
|
26
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-BSK6C4UO.js";
|
|
27
20
|
import {
|
|
28
21
|
DRIVER_EVENTS_FORMATS
|
|
29
|
-
} from "./chunk-
|
|
30
|
-
import {
|
|
31
|
-
resolveActivePlanPath
|
|
32
|
-
} from "./chunk-7ABY6DYH.js";
|
|
33
|
-
import {
|
|
34
|
-
detectAgentBackend,
|
|
35
|
-
listDetectBackendIds
|
|
36
|
-
} from "./chunk-TOSAAQ5A.js";
|
|
22
|
+
} from "./chunk-BIFTTL2O.js";
|
|
37
23
|
import {
|
|
38
24
|
LAND_ON_GATE_DESCRIPTION
|
|
39
|
-
} from "./chunk-
|
|
40
|
-
import "./chunk-L5V3W3DY.js";
|
|
41
|
-
import "./chunk-MUTTNRX4.js";
|
|
25
|
+
} from "./chunk-QMCBXCP5.js";
|
|
42
26
|
import {
|
|
43
27
|
LEASE_FREE_SLASHES,
|
|
44
28
|
QUEUE_LEASE_INTERRUPT_WAIT_MS,
|
|
@@ -48,7 +32,7 @@ import {
|
|
|
48
32
|
forwardTermination,
|
|
49
33
|
gateCheckIn,
|
|
50
34
|
holdQueueStatus
|
|
51
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-FOVHFMSH.js";
|
|
52
36
|
import {
|
|
53
37
|
buildDispatchPrompt,
|
|
54
38
|
classifySlash,
|
|
@@ -59,15 +43,25 @@ import {
|
|
|
59
43
|
resolveOperatorNote,
|
|
60
44
|
runHeadlessDispatch,
|
|
61
45
|
unknownSlashMessage
|
|
62
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-RLVY6YD3.js";
|
|
63
47
|
import {
|
|
64
|
-
|
|
65
|
-
|
|
48
|
+
CLAUDE_SUBAGENT_MODEL_ENV,
|
|
49
|
+
describeResolvedRoles,
|
|
50
|
+
detectAgentBackend,
|
|
51
|
+
getBackend,
|
|
52
|
+
listDetectBackendIds,
|
|
53
|
+
loadRolesContext,
|
|
54
|
+
resolveActivePlanPath,
|
|
55
|
+
resolveReviewJobRole,
|
|
56
|
+
resolveSubworkerModel,
|
|
57
|
+
resolveWorkerRole
|
|
58
|
+
} from "./chunk-3KFLQE6Y.js";
|
|
66
59
|
import {
|
|
67
60
|
HITL_UNANSWERED_EXIT_CODE,
|
|
68
61
|
formatHitlSummary,
|
|
69
62
|
hitlExitCode
|
|
70
63
|
} from "./chunk-P7732A25.js";
|
|
64
|
+
import "./chunk-TTUFIE26.js";
|
|
71
65
|
import "./chunk-WGLPZXNU.js";
|
|
72
66
|
import "./chunk-Q35TWISF.js";
|
|
73
67
|
import "./chunk-QTON2GQX.js";
|
|
@@ -75,7 +69,7 @@ import {
|
|
|
75
69
|
logger
|
|
76
70
|
} from "./chunk-ZB43YMHW.js";
|
|
77
71
|
import "./chunk-PFEUZXVT.js";
|
|
78
|
-
import "./chunk-
|
|
72
|
+
import "./chunk-O7VMHCNN.js";
|
|
79
73
|
import "./chunk-5B4DVO6C.js";
|
|
80
74
|
|
|
81
75
|
// src/commands/run.ts
|
|
@@ -1,37 +1,33 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runPlanLoop
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import "./chunk-HSIHZWFF.js";
|
|
9
|
-
import "./chunk-GQSSXDDK.js";
|
|
10
|
-
import "./chunk-CXE6ASSX.js";
|
|
3
|
+
} from "./chunk-YFRG3CMS.js";
|
|
4
|
+
import "./chunk-WOXTL43E.js";
|
|
5
|
+
import "./chunk-NW5SWKJV.js";
|
|
6
|
+
import "./chunk-ARJRICI2.js";
|
|
7
|
+
import "./chunk-Y575INEC.js";
|
|
11
8
|
import {
|
|
12
9
|
negatedFlag
|
|
13
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-LEVNLHH3.js";
|
|
14
11
|
import {
|
|
15
12
|
DRIVER_EVENTS_FORMATS
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-7ABY6DYH.js";
|
|
18
|
-
import {
|
|
19
|
-
detectAgentBackend,
|
|
20
|
-
listDetectBackendIds
|
|
21
|
-
} from "./chunk-TOSAAQ5A.js";
|
|
13
|
+
} from "./chunk-BIFTTL2O.js";
|
|
22
14
|
import {
|
|
23
15
|
LAND_ON_GATE_DESCRIPTION
|
|
24
|
-
} from "./chunk-
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-MFKHIWEL.js";
|
|
28
|
-
import "./chunk-KWYF7QNH.js";
|
|
16
|
+
} from "./chunk-QMCBXCP5.js";
|
|
17
|
+
import "./chunk-FOVHFMSH.js";
|
|
18
|
+
import "./chunk-RLVY6YD3.js";
|
|
29
19
|
import {
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
detectAgentBackend,
|
|
21
|
+
getBackend,
|
|
22
|
+
listDetectBackendIds,
|
|
23
|
+
loadRolesContext,
|
|
24
|
+
parseLocalModelId,
|
|
25
|
+
resolveWorkerRole
|
|
26
|
+
} from "./chunk-3KFLQE6Y.js";
|
|
32
27
|
import {
|
|
33
28
|
HITL_UNANSWERED_EXIT_CODE
|
|
34
29
|
} from "./chunk-P7732A25.js";
|
|
30
|
+
import "./chunk-TTUFIE26.js";
|
|
35
31
|
import "./chunk-WGLPZXNU.js";
|
|
36
32
|
import "./chunk-Q35TWISF.js";
|
|
37
33
|
import "./chunk-QTON2GQX.js";
|
|
@@ -39,7 +35,7 @@ import {
|
|
|
39
35
|
logger
|
|
40
36
|
} from "./chunk-ZB43YMHW.js";
|
|
41
37
|
import "./chunk-PFEUZXVT.js";
|
|
42
|
-
import "./chunk-
|
|
38
|
+
import "./chunk-O7VMHCNN.js";
|
|
43
39
|
import "./chunk-5B4DVO6C.js";
|
|
44
40
|
|
|
45
41
|
// src/commands/run-plan.ts
|
|
@@ -166,6 +162,14 @@ var runPlanCommand = defineCommand({
|
|
|
166
162
|
}
|
|
167
163
|
let onLimit;
|
|
168
164
|
const onLimitId = String(args["on-limit"] ?? "").trim();
|
|
165
|
+
if (backend.id === "local") {
|
|
166
|
+
const problem = localRunProblem(worker.model, onLimitId);
|
|
167
|
+
if (problem) {
|
|
168
|
+
logger.error(problem);
|
|
169
|
+
process.exitCode = 1;
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
169
173
|
if (onLimitId) {
|
|
170
174
|
try {
|
|
171
175
|
onLimit = getBackend(onLimitId);
|
|
@@ -197,6 +201,14 @@ var runPlanCommand = defineCommand({
|
|
|
197
201
|
process.exitCode = code;
|
|
198
202
|
}
|
|
199
203
|
});
|
|
204
|
+
function localRunProblem(model, onLimitId) {
|
|
205
|
+
if (onLimitId) {
|
|
206
|
+
return "--on-limit is not available with --backend local: a local run never moves to another engine (it would spend an account and send the repository to a vendor).";
|
|
207
|
+
}
|
|
208
|
+
const parsed = parseLocalModelId(model);
|
|
209
|
+
return parsed.ok ? null : parsed.message;
|
|
210
|
+
}
|
|
200
211
|
export {
|
|
212
|
+
localRunProblem,
|
|
201
213
|
runPlanCommand
|
|
202
214
|
};
|
|
@@ -27,26 +27,26 @@ import {
|
|
|
27
27
|
updateCheckSection,
|
|
28
28
|
updateNoticeSection,
|
|
29
29
|
withDeadline
|
|
30
|
-
} from "./chunk-
|
|
31
|
-
import "./chunk-
|
|
30
|
+
} from "./chunk-SYRJ5TTK.js";
|
|
31
|
+
import "./chunk-XXPI4H4D.js";
|
|
32
32
|
import "./chunk-2YU2H7I6.js";
|
|
33
|
-
import "./chunk-
|
|
34
|
-
import "./chunk-MUTTNRX4.js";
|
|
35
|
-
import "./chunk-MFKHIWEL.js";
|
|
33
|
+
import "./chunk-FOVHFMSH.js";
|
|
36
34
|
import "./chunk-MCH3E46V.js";
|
|
37
35
|
import "./chunk-4CRBUEJ6.js";
|
|
38
|
-
import "./chunk-
|
|
39
|
-
import "./chunk-
|
|
40
|
-
import "./chunk-
|
|
41
|
-
import "./chunk-
|
|
42
|
-
import "./chunk-
|
|
43
|
-
import "./chunk-
|
|
36
|
+
import "./chunk-TTUFIE26.js";
|
|
37
|
+
import "./chunk-FB6G6OD6.js";
|
|
38
|
+
import "./chunk-NHJ4IAVN.js";
|
|
39
|
+
import "./chunk-Y5526WCN.js";
|
|
40
|
+
import "./chunk-MWRYQLEG.js";
|
|
41
|
+
import "./chunk-HGB4DHXV.js";
|
|
44
42
|
import "./chunk-CGXLR77R.js";
|
|
45
|
-
import "./chunk-
|
|
46
|
-
import "./chunk-
|
|
47
|
-
import "./chunk-
|
|
48
|
-
import "./chunk-
|
|
49
|
-
import "./chunk-
|
|
43
|
+
import "./chunk-PFEUZXVT.js";
|
|
44
|
+
import "./chunk-ZNZHDPS3.js";
|
|
45
|
+
import "./chunk-RJP47EGS.js";
|
|
46
|
+
import "./chunk-IHVJTGYR.js";
|
|
47
|
+
import "./chunk-KMK4T4ZM.js";
|
|
48
|
+
import "./chunk-2G4K4ZI5.js";
|
|
49
|
+
import "./chunk-O7VMHCNN.js";
|
|
50
50
|
import "./chunk-5B4DVO6C.js";
|
|
51
51
|
export {
|
|
52
52
|
AUDIT_SESSION_LIST_TIMEOUT_MS,
|
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
formatChatAge,
|
|
6
6
|
renderLiveRoster,
|
|
7
7
|
shellQuote
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-XXPI4H4D.js";
|
|
9
|
+
import "./chunk-FOVHFMSH.js";
|
|
10
|
+
import "./chunk-O7VMHCNN.js";
|
|
11
11
|
|
|
12
12
|
// src/commands/sessions.ts
|
|
13
13
|
import path from "path";
|
|
@@ -79,7 +79,7 @@ var sessionsCommand = defineCommand({
|
|
|
79
79
|
const cwd = process.cwd();
|
|
80
80
|
const workspace = path.resolve(cwd, typeof args.cwd === "string" && args.cwd ? args.cwd : ".");
|
|
81
81
|
if (args.live) {
|
|
82
|
-
const { listDetachedAuditSessions } = await import("./session-start-
|
|
82
|
+
const { listDetachedAuditSessions } = await import("./session-start-NC2HE5X5.js");
|
|
83
83
|
const roster = await collectLiveRoster(workspace, { listAudit: listDetachedAuditSessions });
|
|
84
84
|
process.stdout.write(
|
|
85
85
|
args.json ? `${JSON.stringify(roster, null, 2)}
|