@cleocode/cleo 2026.4.113 → 2026.4.115
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/dist/cli/index.js +118 -33
- package/dist/cli/index.js.map +4 -4
- package/package.json +9 -9
package/dist/cli/index.js
CHANGED
|
@@ -705,6 +705,13 @@ var init_variable_substitution = __esm({
|
|
|
705
705
|
}
|
|
706
706
|
});
|
|
707
707
|
|
|
708
|
+
// packages/contracts/src/operations/worktree.ts
|
|
709
|
+
var init_worktree = __esm({
|
|
710
|
+
"packages/contracts/src/operations/worktree.ts"() {
|
|
711
|
+
"use strict";
|
|
712
|
+
}
|
|
713
|
+
});
|
|
714
|
+
|
|
708
715
|
// packages/contracts/src/operations/index.ts
|
|
709
716
|
var init_operations = __esm({
|
|
710
717
|
"packages/contracts/src/operations/index.ts"() {
|
|
@@ -725,6 +732,7 @@ var init_operations = __esm({
|
|
|
725
732
|
init_tasks();
|
|
726
733
|
init_validate();
|
|
727
734
|
init_variable_substitution();
|
|
735
|
+
init_worktree();
|
|
728
736
|
}
|
|
729
737
|
});
|
|
730
738
|
|
|
@@ -735,6 +743,13 @@ var init_orchestration_hierarchy = __esm({
|
|
|
735
743
|
}
|
|
736
744
|
});
|
|
737
745
|
|
|
746
|
+
// packages/contracts/src/peer.ts
|
|
747
|
+
var init_peer = __esm({
|
|
748
|
+
"packages/contracts/src/peer.ts"() {
|
|
749
|
+
"use strict";
|
|
750
|
+
}
|
|
751
|
+
});
|
|
752
|
+
|
|
738
753
|
// packages/contracts/src/session.ts
|
|
739
754
|
var init_session2 = __esm({
|
|
740
755
|
"packages/contracts/src/session.ts"() {
|
|
@@ -845,6 +860,7 @@ var init_src = __esm({
|
|
|
845
860
|
init_operations();
|
|
846
861
|
init_params();
|
|
847
862
|
init_orchestration_hierarchy();
|
|
863
|
+
init_peer();
|
|
848
864
|
init_session2();
|
|
849
865
|
init_status_registry();
|
|
850
866
|
init_task_evidence();
|
|
@@ -9617,13 +9633,15 @@ async function composeSpawnForTask(taskId, root, options = {}) {
|
|
|
9617
9633
|
sessionId: options.sessionId ?? null,
|
|
9618
9634
|
role: inferredRole,
|
|
9619
9635
|
protocol: options.protocol,
|
|
9620
|
-
skipAtomicityCheck: options.skipAtomicityCheck ?? false
|
|
9636
|
+
skipAtomicityCheck: options.skipAtomicityCheck ?? false,
|
|
9637
|
+
worktreePath: options.worktreePath,
|
|
9638
|
+
worktreeBranch: options.worktreeBranch
|
|
9621
9639
|
});
|
|
9622
9640
|
} finally {
|
|
9623
9641
|
db.close();
|
|
9624
9642
|
}
|
|
9625
9643
|
}
|
|
9626
|
-
async function orchestrateSpawn(taskId, protocolType, projectRoot, tier) {
|
|
9644
|
+
async function orchestrateSpawn(taskId, protocolType, projectRoot, tier, noWorktree) {
|
|
9627
9645
|
if (!taskId) {
|
|
9628
9646
|
return engineError("E_INVALID_INPUT", "taskId is required");
|
|
9629
9647
|
}
|
|
@@ -9650,10 +9668,43 @@ async function orchestrateSpawn(taskId, protocolType, projectRoot, tier) {
|
|
|
9650
9668
|
} catch {
|
|
9651
9669
|
activeSessionId = null;
|
|
9652
9670
|
}
|
|
9671
|
+
let sdkWorktreeResult = null;
|
|
9672
|
+
let worktreePath;
|
|
9673
|
+
let worktreeBranch;
|
|
9674
|
+
if (noWorktree) {
|
|
9675
|
+
getLogger2("engine:orchestrate").info(
|
|
9676
|
+
{ taskId },
|
|
9677
|
+
"T1140 --no-worktree: worktree provisioning skipped (audit logged)"
|
|
9678
|
+
);
|
|
9679
|
+
try {
|
|
9680
|
+
const accessor2 = await getAccessor2(root);
|
|
9681
|
+
await accessor2.appendLog({
|
|
9682
|
+
action: "orchestrate.spawn.no-worktree",
|
|
9683
|
+
taskId,
|
|
9684
|
+
actor: "orchestrate-engine",
|
|
9685
|
+
details: { reason: "--no-worktree flag set by caller", taskId }
|
|
9686
|
+
});
|
|
9687
|
+
} catch {
|
|
9688
|
+
}
|
|
9689
|
+
} else {
|
|
9690
|
+
try {
|
|
9691
|
+
const { spawnWorktree } = await import("@cleocode/core/internal");
|
|
9692
|
+
sdkWorktreeResult = await spawnWorktree(root, { taskId });
|
|
9693
|
+
worktreePath = sdkWorktreeResult.path;
|
|
9694
|
+
worktreeBranch = sdkWorktreeResult.branch;
|
|
9695
|
+
} catch (wtErr) {
|
|
9696
|
+
getLogger2("engine:orchestrate").warn(
|
|
9697
|
+
{ taskId, err: wtErr },
|
|
9698
|
+
`T1140 worktree creation failed for ${taskId} \u2014 spawning without isolation: ${wtErr instanceof Error ? wtErr.message : String(wtErr)}`
|
|
9699
|
+
);
|
|
9700
|
+
}
|
|
9701
|
+
}
|
|
9653
9702
|
const payload = await composeSpawnForTask(taskId, root, {
|
|
9654
9703
|
tier,
|
|
9655
9704
|
sessionId: activeSessionId,
|
|
9656
|
-
protocol: protocolType
|
|
9705
|
+
protocol: protocolType,
|
|
9706
|
+
worktreePath,
|
|
9707
|
+
worktreeBranch
|
|
9657
9708
|
});
|
|
9658
9709
|
if (!payload.atomicity.allowed) {
|
|
9659
9710
|
return engineError(
|
|
@@ -9669,20 +9720,21 @@ async function orchestrateSpawn(taskId, protocolType, projectRoot, tier) {
|
|
|
9669
9720
|
}
|
|
9670
9721
|
);
|
|
9671
9722
|
}
|
|
9672
|
-
|
|
9673
|
-
|
|
9674
|
-
|
|
9675
|
-
|
|
9676
|
-
|
|
9677
|
-
|
|
9678
|
-
|
|
9679
|
-
|
|
9680
|
-
|
|
9681
|
-
|
|
9682
|
-
|
|
9683
|
-
|
|
9684
|
-
|
|
9685
|
-
|
|
9723
|
+
const finalPrompt = payload.prompt;
|
|
9724
|
+
const worktreeAdapterResult = sdkWorktreeResult ? {
|
|
9725
|
+
worktree: {
|
|
9726
|
+
path: sdkWorktreeResult.path,
|
|
9727
|
+
branch: sdkWorktreeResult.branch,
|
|
9728
|
+
taskId: sdkWorktreeResult.taskId,
|
|
9729
|
+
baseRef: sdkWorktreeResult.baseRef,
|
|
9730
|
+
projectHash: sdkWorktreeResult.projectHash,
|
|
9731
|
+
createdAt: sdkWorktreeResult.createdAt,
|
|
9732
|
+
locked: sdkWorktreeResult.locked
|
|
9733
|
+
},
|
|
9734
|
+
envVars: sdkWorktreeResult.envVars,
|
|
9735
|
+
cwd: sdkWorktreeResult.path,
|
|
9736
|
+
preamble: sdkWorktreeResult.preamble
|
|
9737
|
+
} : null;
|
|
9686
9738
|
return {
|
|
9687
9739
|
success: true,
|
|
9688
9740
|
data: {
|
|
@@ -9694,10 +9746,10 @@ ${payload.prompt}` : payload.prompt;
|
|
|
9694
9746
|
harnessHint: payload.harnessHint,
|
|
9695
9747
|
atomicity: payload.atomicity,
|
|
9696
9748
|
meta: payload.meta,
|
|
9697
|
-
// T1118 L1+L2 — worktree binding for harness adapters.
|
|
9698
|
-
worktree:
|
|
9699
|
-
worktreeEnv:
|
|
9700
|
-
worktreeCwd:
|
|
9749
|
+
// T1118 L1+L2 / T1140 — worktree binding for harness adapters.
|
|
9750
|
+
worktree: worktreeAdapterResult?.worktree ?? null,
|
|
9751
|
+
worktreeEnv: worktreeAdapterResult?.envVars ?? null,
|
|
9752
|
+
worktreeCwd: worktreeAdapterResult?.cwd ?? null,
|
|
9701
9753
|
spawnContext: {
|
|
9702
9754
|
taskId: payload.taskId,
|
|
9703
9755
|
protocol: payload.meta.protocol,
|
|
@@ -26285,7 +26337,14 @@ var init_orchestrate2 = __esm({
|
|
|
26285
26337
|
}
|
|
26286
26338
|
const protocolType = params?.protocolType;
|
|
26287
26339
|
const tier = params?.tier;
|
|
26288
|
-
const
|
|
26340
|
+
const noWorktree = params?.noWorktree;
|
|
26341
|
+
const result = await orchestrateSpawn(
|
|
26342
|
+
taskId,
|
|
26343
|
+
protocolType,
|
|
26344
|
+
projectRoot,
|
|
26345
|
+
tier,
|
|
26346
|
+
noWorktree
|
|
26347
|
+
);
|
|
26289
26348
|
return wrapResult(result, "mutate", "orchestrate", operation, startTime);
|
|
26290
26349
|
}
|
|
26291
26350
|
case "handoff": {
|
|
@@ -31868,6 +31927,17 @@ function resolveFormat(opts, defaults) {
|
|
|
31868
31927
|
|
|
31869
31928
|
// packages/cleo/src/cli/commands/adapter.ts
|
|
31870
31929
|
init_cli();
|
|
31930
|
+
|
|
31931
|
+
// packages/cleo/src/cli/lib/subcommand-guard.ts
|
|
31932
|
+
function isSubCommandDispatch(rawArgs, subCommands2) {
|
|
31933
|
+
if (!rawArgs || !subCommands2) return false;
|
|
31934
|
+
const firstArg = rawArgs.find((a) => !a.startsWith("-"));
|
|
31935
|
+
if (!firstArg) return false;
|
|
31936
|
+
if (typeof subCommands2 !== "object") return false;
|
|
31937
|
+
return firstArg in subCommands2;
|
|
31938
|
+
}
|
|
31939
|
+
|
|
31940
|
+
// packages/cleo/src/cli/commands/adapter.ts
|
|
31871
31941
|
var listCommand = defineCommand({
|
|
31872
31942
|
meta: { name: "list", description: "List all discovered provider adapters" },
|
|
31873
31943
|
async run() {
|
|
@@ -31979,7 +32049,8 @@ var adapterCommand = defineCommand({
|
|
|
31979
32049
|
activate: activateCommand,
|
|
31980
32050
|
dispose: disposeCommand
|
|
31981
32051
|
},
|
|
31982
|
-
async run() {
|
|
32052
|
+
async run({ cmd, rawArgs }) {
|
|
32053
|
+
if (isSubCommandDispatch(rawArgs, cmd.subCommands)) return;
|
|
31983
32054
|
await dispatchFromCli(
|
|
31984
32055
|
"query",
|
|
31985
32056
|
"tools",
|
|
@@ -36381,7 +36452,8 @@ var backupCommand = defineCommand({
|
|
|
36381
36452
|
import: importCommand,
|
|
36382
36453
|
inspect: backupInspectSubCommand
|
|
36383
36454
|
},
|
|
36384
|
-
async run() {
|
|
36455
|
+
async run({ cmd, rawArgs }) {
|
|
36456
|
+
if (isSubCommandDispatch(rawArgs, cmd.subCommands)) return;
|
|
36385
36457
|
await dispatchFromCli("mutate", "admin", "backup", {}, { command: "backup" });
|
|
36386
36458
|
}
|
|
36387
36459
|
});
|
|
@@ -39056,7 +39128,8 @@ var daemonCommand = defineCommand({
|
|
|
39056
39128
|
stop: stopCommand3,
|
|
39057
39129
|
status: statusCommand4
|
|
39058
39130
|
},
|
|
39059
|
-
async run({ args }) {
|
|
39131
|
+
async run({ args, cmd, rawArgs }) {
|
|
39132
|
+
if (isSubCommandDispatch(rawArgs, cmd.subCommands)) return;
|
|
39060
39133
|
const cleoDir = args["cleo-dir"] ?? join11(homedir2(), ".cleo");
|
|
39061
39134
|
await showDaemonStatus(cleoDir, args.json ?? false);
|
|
39062
39135
|
}
|
|
@@ -43025,7 +43098,8 @@ var manifestCommand = defineCommand({
|
|
|
43025
43098
|
append: appendCommand,
|
|
43026
43099
|
archive: archiveCommand2
|
|
43027
43100
|
},
|
|
43028
|
-
async run({ cmd }) {
|
|
43101
|
+
async run({ cmd, rawArgs }) {
|
|
43102
|
+
if (isSubCommandDispatch(rawArgs, cmd.subCommands)) return;
|
|
43029
43103
|
await showUsage(cmd);
|
|
43030
43104
|
}
|
|
43031
43105
|
});
|
|
@@ -50368,6 +50442,10 @@ var spawnCommand2 = defineCommand({
|
|
|
50368
50442
|
tier: {
|
|
50369
50443
|
type: "string",
|
|
50370
50444
|
description: "Protocol tier: 0 (minimal), 1 (standard), 2 (full), or auto (default \u2014 inferred from role+size+labels via T892 heuristics)"
|
|
50445
|
+
},
|
|
50446
|
+
"no-worktree": {
|
|
50447
|
+
type: "boolean",
|
|
50448
|
+
description: "Skip worktree provisioning for this spawn. The opt-out is logged to the audit log (T1140)."
|
|
50371
50449
|
}
|
|
50372
50450
|
},
|
|
50373
50451
|
async run({ args }) {
|
|
@@ -50385,7 +50463,8 @@ var spawnCommand2 = defineCommand({
|
|
|
50385
50463
|
{
|
|
50386
50464
|
taskId: args.taskId,
|
|
50387
50465
|
protocolType: args.protocol,
|
|
50388
|
-
tier
|
|
50466
|
+
tier,
|
|
50467
|
+
noWorktree: args["no-worktree"] === true
|
|
50389
50468
|
},
|
|
50390
50469
|
{ command: "orchestrate" }
|
|
50391
50470
|
);
|
|
@@ -51625,7 +51704,8 @@ var providerCommand = defineCommand({
|
|
|
51625
51704
|
hooks: hooksCommand,
|
|
51626
51705
|
inject: injectCommand2
|
|
51627
51706
|
},
|
|
51628
|
-
async run() {
|
|
51707
|
+
async run({ cmd, rawArgs }) {
|
|
51708
|
+
if (isSubCommandDispatch(rawArgs, cmd.subCommands)) return;
|
|
51629
51709
|
await dispatchFromCli(
|
|
51630
51710
|
"query",
|
|
51631
51711
|
"tools",
|
|
@@ -54512,7 +54592,8 @@ var baselineSub = defineCommand({
|
|
|
54512
54592
|
subCommands: {
|
|
54513
54593
|
capture: baselineCaptureSub
|
|
54514
54594
|
},
|
|
54515
|
-
async run({ args }) {
|
|
54595
|
+
async run({ args, cmd, rawArgs }) {
|
|
54596
|
+
if (isSubCommandDispatch(rawArgs, cmd.subCommands)) return;
|
|
54516
54597
|
const jsonMode = args.json === true;
|
|
54517
54598
|
emitSuccess(
|
|
54518
54599
|
{ message: "Use: cleo sentient baseline capture <sha>" },
|
|
@@ -54625,7 +54706,8 @@ var allowlistSub = defineCommand({
|
|
|
54625
54706
|
add: allowlistAddSub,
|
|
54626
54707
|
remove: allowlistRemoveSub
|
|
54627
54708
|
},
|
|
54628
|
-
async run({ args }) {
|
|
54709
|
+
async run({ args, cmd, rawArgs }) {
|
|
54710
|
+
if (isSubCommandDispatch(rawArgs, cmd.subCommands)) return;
|
|
54629
54711
|
const jsonMode = args.json === true;
|
|
54630
54712
|
emitSuccess(
|
|
54631
54713
|
{ message: "Use: cleo sentient allowlist list|add|remove" },
|
|
@@ -54650,7 +54732,8 @@ var sentientCommand = defineCommand({
|
|
|
54650
54732
|
baseline: baselineSub,
|
|
54651
54733
|
allowlist: allowlistSub
|
|
54652
54734
|
},
|
|
54653
|
-
async run({ args }) {
|
|
54735
|
+
async run({ args, cmd, rawArgs }) {
|
|
54736
|
+
if (isSubCommandDispatch(rawArgs, cmd.subCommands)) return;
|
|
54654
54737
|
const projectRoot = resolveProjectRoot7(args.project);
|
|
54655
54738
|
const jsonMode = args.json === true;
|
|
54656
54739
|
try {
|
|
@@ -55617,7 +55700,8 @@ var skillsCommand2 = defineCommand({
|
|
|
55617
55700
|
deps: depsCommand3,
|
|
55618
55701
|
"spawn-providers": spawnProvidersCommand
|
|
55619
55702
|
},
|
|
55620
|
-
async run() {
|
|
55703
|
+
async run({ cmd, rawArgs }) {
|
|
55704
|
+
if (isSubCommandDispatch(rawArgs, cmd.subCommands)) return;
|
|
55621
55705
|
await dispatchFromCli(
|
|
55622
55706
|
"query",
|
|
55623
55707
|
"tools",
|
|
@@ -55789,7 +55873,8 @@ var statsCommand6 = defineCommand({
|
|
|
55789
55873
|
subCommands: {
|
|
55790
55874
|
compliance: complianceCommand2
|
|
55791
55875
|
},
|
|
55792
|
-
async run({ args }) {
|
|
55876
|
+
async run({ args, cmd, rawArgs }) {
|
|
55877
|
+
if (isSubCommandDispatch(rawArgs, cmd.subCommands)) return;
|
|
55793
55878
|
await dispatchFromCli(
|
|
55794
55879
|
"query",
|
|
55795
55880
|
"admin",
|