wildcrane-runner 0.6.119 → 0.6.121
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 +4 -2
- package/dist/akb/dist/kanban.mjs +294 -79
- package/dist/akb/package.json +1 -1
- package/dist/akb-proxy.mjs +1 -1
- package/dist/codex-proxy.mjs +8 -5
- package/dist/codex-retained.mjs +8 -5
- package/dist/flow-worker-main.mjs +113 -56
- package/dist/launcher.mjs +145 -125
- package/dist/plugin.mjs +166 -147
- package/dist/runner.mjs +130 -60
- package/dist/settings.mjs +31 -15
- package/package.json +1 -1
package/dist/akb/dist/kanban.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// ai4kanban 0.11.
|
|
2
|
+
// ai4kanban 0.11.103 — built by runner/scripts/build.mjs. Do not edit.
|
|
3
3
|
import { createRequire as __ai4kanbanRequire } from 'node:module'
|
|
4
4
|
const require = __ai4kanbanRequire(import.meta.url)
|
|
5
5
|
var __create = Object.create;
|
|
@@ -858,8 +858,9 @@ var init_io = __esm({
|
|
|
858
858
|
});
|
|
859
859
|
|
|
860
860
|
// ../cli/src/lib/machine/project.ts
|
|
861
|
-
import { randomUUID } from "node:crypto";
|
|
861
|
+
import { createHash as createHash2, randomUUID } from "node:crypto";
|
|
862
862
|
import fs2 from "node:fs";
|
|
863
|
+
import os2 from "node:os";
|
|
863
864
|
import path3 from "node:path";
|
|
864
865
|
function realPathOf(file2, links = 0) {
|
|
865
866
|
const here = path3.resolve(file2);
|
|
@@ -912,32 +913,87 @@ function stateLayout(board, root2) {
|
|
|
912
913
|
}
|
|
913
914
|
const hiddenPrefix = `.akb${path3.sep}`;
|
|
914
915
|
const hidden = relative.startsWith(hiddenPrefix);
|
|
915
|
-
const
|
|
916
|
+
const runnerBoard = relative === `${hiddenPrefix}kanban`;
|
|
917
|
+
const akb = path3.join(project2, ".akb");
|
|
918
|
+
const state = runnerBoard ? path3.join(akb, "state") : hidden ? path3.join(akb, "hidden-boards", relative.slice(hiddenPrefix.length)) : path3.join(akb, "boards", relative || "_root");
|
|
916
919
|
assertBoardStatePath(state, state);
|
|
917
920
|
assertBoardStatePath(realPathOf(state), state);
|
|
918
|
-
const legacy2 = hidden ? path3.join(
|
|
919
|
-
|
|
921
|
+
const legacy2 = hidden ? [path3.join(akb, "boards", relative)] : [];
|
|
922
|
+
if (runnerBoard) legacy2.push(path3.join(akb, "hidden-boards", "kanban"));
|
|
923
|
+
return { project: project2, state, legacy: legacy2, runnerBoard };
|
|
920
924
|
}
|
|
921
925
|
function projectStateDir(board, root2 = stateRootOf(board)) {
|
|
922
926
|
return stateLayout(board, root2).state;
|
|
923
927
|
}
|
|
928
|
+
function hasRunningSession(dir) {
|
|
929
|
+
try {
|
|
930
|
+
const store = JSON.parse(fs2.readFileSync(path3.join(dir, SESSIONS_FILE), "utf8"));
|
|
931
|
+
const runs = Array.isArray(store?.runs) ? store.runs : store?.live;
|
|
932
|
+
return Array.isArray(runs) && runs.some((run3) => run3?.status === "running" && [run3.pid, run3.agentPid].some(isLivePid));
|
|
933
|
+
} catch (error62) {
|
|
934
|
+
if (missing(error62) || error62 instanceof SyntaxError) return false;
|
|
935
|
+
throw error62;
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
function isLivePid(pid) {
|
|
939
|
+
if (!Number.isSafeInteger(pid) || pid < 1) return false;
|
|
940
|
+
try {
|
|
941
|
+
process.kill(pid, 0);
|
|
942
|
+
return true;
|
|
943
|
+
} catch (error62) {
|
|
944
|
+
return error62.code === "EPERM";
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
function hasRunnerJob(project2) {
|
|
948
|
+
const home3 = process.env.WILDCRANE_HOME || path3.join(os2.homedir(), ".wildcrane");
|
|
949
|
+
const prefix = `${createHash2("sha256").update(project2).digest("hex")}.`;
|
|
950
|
+
try {
|
|
951
|
+
return fs2.readdirSync(path3.join(home3, "holds")).some((name) => name.startsWith(prefix) && isLivePid(Number(name.slice(prefix.length))));
|
|
952
|
+
} catch (error62) {
|
|
953
|
+
if (missing(error62)) return false;
|
|
954
|
+
throw error62;
|
|
955
|
+
}
|
|
956
|
+
}
|
|
924
957
|
function migrateProjectState(board, root2 = stateRootOf(board)) {
|
|
925
|
-
const { state, legacy: legacy2 } = stateLayout(board, root2);
|
|
926
|
-
|
|
927
|
-
|
|
958
|
+
const { project: project2, state, legacy: legacy2, runnerBoard } = stateLayout(board, root2);
|
|
959
|
+
const present = legacy2.filter((dir) => {
|
|
960
|
+
const entry = fs2.lstatSync(dir, { throwIfNoEntry: false });
|
|
961
|
+
if (!entry) return false;
|
|
962
|
+
if (!entry.isDirectory() || realPathOf(dir) !== dir) {
|
|
963
|
+
throw new BoardError(`Legacy board state must be a regular directory: ${dir}. Move the saved state to ${state} before restarting.`, { kind: "board-state-path" });
|
|
964
|
+
}
|
|
965
|
+
return true;
|
|
966
|
+
});
|
|
967
|
+
if (!present.length) return state;
|
|
968
|
+
if (runnerBoard && hasRunnerJob(project2) || [...present, state].some(hasRunningSession)) {
|
|
969
|
+
throw new BoardError(`Board state migration is waiting for the running tasks in ${project2} to exit.`, { kind: "board-state-busy" });
|
|
970
|
+
}
|
|
971
|
+
const sources2 = present.filter((dir) => {
|
|
972
|
+
try {
|
|
973
|
+
fs2.rmdirSync(dir);
|
|
974
|
+
return false;
|
|
975
|
+
} catch (error62) {
|
|
976
|
+
if (missing(error62)) return false;
|
|
977
|
+
if (["ENOTEMPTY", "EEXIST"].includes(error62.code ?? "")) return true;
|
|
978
|
+
throw error62;
|
|
979
|
+
}
|
|
980
|
+
});
|
|
981
|
+
const conflict = (dirs2) => new BoardError(`Board state exists at ${dirs2.join(" and ")}. Compare the saved state before moving it to ${state}.`, { kind: "board-state-conflict" });
|
|
982
|
+
if (sources2.length > 1) throw conflict(sources2);
|
|
983
|
+
const source2 = sources2[0];
|
|
984
|
+
if (!source2) return state;
|
|
928
985
|
if (fs2.lstatSync(state, { throwIfNoEntry: false })) {
|
|
929
|
-
if (fs2.lstatSync(
|
|
986
|
+
if (fs2.lstatSync(source2, { throwIfNoEntry: false })) throw conflict([source2, state]);
|
|
930
987
|
return state;
|
|
931
988
|
}
|
|
932
|
-
if (realPathOf(legacy2) !== legacy2) {
|
|
933
|
-
throw new BoardError(`Legacy board state points through a symbolic link: ${legacy2}. Move the saved state to ${state} and remove the old link before restarting.`, { kind: "board-state-path" });
|
|
934
|
-
}
|
|
935
989
|
fs2.mkdirSync(path3.dirname(state), { recursive: true });
|
|
936
990
|
try {
|
|
937
|
-
fs2.renameSync(
|
|
991
|
+
fs2.renameSync(source2, state);
|
|
938
992
|
} catch (error62) {
|
|
939
|
-
if (
|
|
940
|
-
|
|
993
|
+
if (fs2.lstatSync(state, { throwIfNoEntry: false })) {
|
|
994
|
+
if (fs2.lstatSync(source2, { throwIfNoEntry: false })) throw conflict([source2, state]);
|
|
995
|
+
if (missing(error62)) return state;
|
|
996
|
+
}
|
|
941
997
|
throw error62;
|
|
942
998
|
}
|
|
943
999
|
return state;
|
|
@@ -982,7 +1038,7 @@ var init_project = __esm({
|
|
|
982
1038
|
NESTED_STATE = /(^|[/\\])\.akb[/\\](?:(?:boards|hidden-boards)[/\\])?\.akb(?=[/\\]|$)/;
|
|
983
1039
|
InvalidBoardStatePath = class extends BoardError {
|
|
984
1040
|
constructor(file2, state, id2) {
|
|
985
|
-
const use = state ? `Use ${state}${id2 ? ` or an .assets/${id2}/\u2026 reference` : ""}.` : "Use the board\u2019s project-local
|
|
1041
|
+
const use = state ? `Use ${state}${id2 ? ` or an .assets/${id2}/\u2026 reference` : ""}.` : "Use the board\u2019s project-local state directory.";
|
|
986
1042
|
super(`Invalid nested board state path: ${file2}. ${use}`, { kind: "board-state-path" });
|
|
987
1043
|
}
|
|
988
1044
|
};
|
|
@@ -17995,7 +18051,7 @@ var init_tasks = __esm({
|
|
|
17995
18051
|
});
|
|
17996
18052
|
|
|
17997
18053
|
// ../cli/src/lib/agent/cloud-studios.ts
|
|
17998
|
-
import { createHash as
|
|
18054
|
+
import { createHash as createHash3, randomUUID as randomUUID3 } from "node:crypto";
|
|
17999
18055
|
import { setTimeout as delay } from "node:timers/promises";
|
|
18000
18056
|
import fs19 from "node:fs";
|
|
18001
18057
|
import path19 from "node:path";
|
|
@@ -18041,7 +18097,7 @@ function saveStudioSession(task, session, pin) {
|
|
|
18041
18097
|
if (!fs19.existsSync(file2)) writeJson(file2, pin);
|
|
18042
18098
|
}
|
|
18043
18099
|
function runtimeContextFile(task, runtime, session) {
|
|
18044
|
-
const key =
|
|
18100
|
+
const key = createHash3("sha256").update(JSON.stringify([runtime, session])).digest("hex");
|
|
18045
18101
|
return path19.join(sessionDir(task), "context", key + ".json");
|
|
18046
18102
|
}
|
|
18047
18103
|
function readRuntimeContext(task, runtime, session) {
|
|
@@ -18134,7 +18190,7 @@ async function cachedPackage(held4, pack, download2) {
|
|
|
18134
18190
|
const read5 = await download2(pack.downloadUrl, pack.zipBytes);
|
|
18135
18191
|
if (!read5.ok) return read5;
|
|
18136
18192
|
const zip = read5.value;
|
|
18137
|
-
if (zip.length !== pack.zipBytes ||
|
|
18193
|
+
if (zip.length !== pack.zipBytes || createHash3("sha256").update(zip).digest("hex") !== pack.zipSha256) return invalid("the Studio ZIP digest");
|
|
18138
18194
|
let files;
|
|
18139
18195
|
try {
|
|
18140
18196
|
files = decodeStudioZip(zip);
|
|
@@ -18329,9 +18385,9 @@ var init_cloud_studios = __esm({
|
|
|
18329
18385
|
listFile = (project2) => path19.join(root(), "lists", `${safe(project2)}.json`);
|
|
18330
18386
|
pinFile = (task) => path19.join(root(), "tasks", `${safe(task)}.json`);
|
|
18331
18387
|
sessionDir = (task) => path19.join(root(), "sessions", safe(task));
|
|
18332
|
-
sessionFileOf = (task, session) => path19.join(sessionDir(task),
|
|
18388
|
+
sessionFileOf = (task, session) => path19.join(sessionDir(task), createHash3("sha256").update(session).digest("hex") + ".json");
|
|
18333
18389
|
skillDir = (id2, version2) => path19.join(root(), "bundles", safe(id2) + "@" + version2);
|
|
18334
|
-
filesHash = (files) =>
|
|
18390
|
+
filesHash = (files) => createHash3("sha256").update(hashInput(files)).digest("hex");
|
|
18335
18391
|
readVersion = (id2, version2) => {
|
|
18336
18392
|
const held4 = readJson(versionFile(id2, version2));
|
|
18337
18393
|
return held4?.id === id2 && held4.version === version2 && isStudioFiles(held4.files) && (!held4.filesSha256 || filesHash(held4.files) === held4.filesSha256) ? held4 : null;
|
|
@@ -41310,8 +41366,8 @@ var init_package = __esm({
|
|
|
41310
41366
|
"../cli/package.json"() {
|
|
41311
41367
|
package_default = {
|
|
41312
41368
|
name: "wildcrane",
|
|
41313
|
-
version: "0.11.
|
|
41314
|
-
akbContract:
|
|
41369
|
+
version: "0.11.103",
|
|
41370
|
+
akbContract: 36,
|
|
41315
41371
|
canonicalCommands: true,
|
|
41316
41372
|
description: "WildCrane's `akb` command \u2014 scaffold the Markdown board under docs/kanban/, put an agent on a card, and carry the flows the agent works by.",
|
|
41317
41373
|
keywords: [
|
|
@@ -44457,7 +44513,7 @@ var init_agent_file = __esm({
|
|
|
44457
44513
|
});
|
|
44458
44514
|
|
|
44459
44515
|
// ../cli/src/lib/agent/runtime-context.ts
|
|
44460
|
-
import { createHash as
|
|
44516
|
+
import { createHash as createHash4 } from "node:crypto";
|
|
44461
44517
|
function contextUpdate(previous, blocks) {
|
|
44462
44518
|
const sent = { ...previous };
|
|
44463
44519
|
const parts = [];
|
|
@@ -44501,7 +44557,7 @@ var init_runtime_context = __esm({
|
|
|
44501
44557
|
"use strict";
|
|
44502
44558
|
init_board_files();
|
|
44503
44559
|
init_review_plan();
|
|
44504
|
-
contextFingerprint = (text4) =>
|
|
44560
|
+
contextFingerprint = (text4) => createHash4("sha256").update(text4).digest("hex");
|
|
44505
44561
|
taskCardBlock = (card) => ["card", "Task card: " + card];
|
|
44506
44562
|
configurationBlock = (text4) => ["config", text4, "Studio configuration cleared."];
|
|
44507
44563
|
contextAction = (action) => action === "clarify" ? "refine" : action === "edit" ? "revise" : action;
|
|
@@ -44744,7 +44800,7 @@ var init_memory_file = __esm({
|
|
|
44744
44800
|
|
|
44745
44801
|
// ../cli/src/commands/inspect.ts
|
|
44746
44802
|
import fs47 from "node:fs";
|
|
44747
|
-
import
|
|
44803
|
+
import os3 from "node:os";
|
|
44748
44804
|
import path47 from "node:path";
|
|
44749
44805
|
function cmdInspect(id2) {
|
|
44750
44806
|
const findings = [];
|
|
@@ -44799,12 +44855,13 @@ function cmdInspect(id2) {
|
|
|
44799
44855
|
records.push(...fact("delivery", () => (store.deliveries ?? []).filter((held5) => held5.cardId === id2), []));
|
|
44800
44856
|
const held4 = [...new Map(records.map((held5) => [held5.deliveryId, held5])).values()].sort((a, b) => b.startedAt - a.startedAt)[0];
|
|
44801
44857
|
const job = executionOf()?.job;
|
|
44802
|
-
const checkpoint = job ? read5("recovery", path47.join(process.env.WILDCRANE_HOME ||
|
|
44858
|
+
const checkpoint = job ? read5("recovery", path47.join(process.env.WILDCRANE_HOME || os3.homedir() + "/.wildcrane", "checkpoints", `${encodeURIComponent(job)}.json`), null) : null;
|
|
44803
44859
|
const delivery = fact("delivery", () => held4 ? { id: held4.deliveryId, status: held4.status, directory: held4.worktree ?? REPO_ROOT, completedSteps: (held4.completions ?? []).map((c) => c.step) } : null, null);
|
|
44804
44860
|
const recovery = fact("recovery", () => checkpoint ? { pendingOperations: checkpoint.pending ?? [], submitted: checkpoint.submitted ?? null } : null, null);
|
|
44805
44861
|
const result = {
|
|
44806
44862
|
id: id2,
|
|
44807
44863
|
card,
|
|
44864
|
+
asset_folder: path47.join(ASSETS, String(id2)),
|
|
44808
44865
|
previews: fact("previews", () => Object.entries(progress).map(([agent, p]) => ({
|
|
44809
44866
|
agent,
|
|
44810
44867
|
currentStageId: p.currentStageId,
|
|
@@ -45033,7 +45090,7 @@ var init_spawnable = __esm({
|
|
|
45033
45090
|
// ../cli/src/lib/agent/locate.ts
|
|
45034
45091
|
import { spawn as spawn2, spawnSync as spawnSync4 } from "node:child_process";
|
|
45035
45092
|
import fs50 from "node:fs";
|
|
45036
|
-
import
|
|
45093
|
+
import os4 from "node:os";
|
|
45037
45094
|
import path50 from "node:path";
|
|
45038
45095
|
function versionIn(output2) {
|
|
45039
45096
|
const plain = output2.replace(/\x1b\[[0-9;]*m/g, "");
|
|
@@ -45105,7 +45162,7 @@ function latestIn(parent, tail = "") {
|
|
|
45105
45162
|
return byVersion(names2.filter((name) => !name.startsWith("."))).slice(0, 2).map((name) => path50.join(parent, name, tail));
|
|
45106
45163
|
}
|
|
45107
45164
|
function commonDirs() {
|
|
45108
|
-
const home3 =
|
|
45165
|
+
const home3 = os4.homedir();
|
|
45109
45166
|
const under = (...parts) => path50.join(home3, ...parts);
|
|
45110
45167
|
const nodes = (root2, tail = []) => root2 ? folders(root2).map((version2) => path50.join(root2, version2, ...tail)) : [];
|
|
45111
45168
|
if (WINDOWS2) {
|
|
@@ -45258,7 +45315,7 @@ var init_locate = __esm({
|
|
|
45258
45315
|
};
|
|
45259
45316
|
isCopy = (harness, file2) => copyFiles(harness).some((one) => one.file === file2);
|
|
45260
45317
|
answersFile = () => path50.join(machineHome(), "agent-copies.json");
|
|
45261
|
-
probeOptions = (file2) => ({ cwd:
|
|
45318
|
+
probeOptions = (file2) => ({ cwd: os4.tmpdir(), env: copyEnv(file2), windowsHide: true, shell: false });
|
|
45262
45319
|
spawnName = (copy2, binary) => copy2 && (!copy2.entry || /\.(cmd|bat)$/i.test(copy2.file)) ? copy2.file : binary;
|
|
45263
45320
|
}
|
|
45264
45321
|
});
|
|
@@ -45313,14 +45370,14 @@ var init_models = __esm({
|
|
|
45313
45370
|
});
|
|
45314
45371
|
|
|
45315
45372
|
// ../cli/src/lib/agent/harnesses/types.ts
|
|
45316
|
-
import { createHash as
|
|
45373
|
+
import { createHash as createHash5 } from "node:crypto";
|
|
45317
45374
|
import fs51 from "node:fs";
|
|
45318
45375
|
import path51 from "node:path";
|
|
45319
45376
|
function namesFlag(argv, flags2) {
|
|
45320
45377
|
return argv.some((tok) => flags2.some((flag) => tok === flag || tok.startsWith(`${flag}=`)));
|
|
45321
45378
|
}
|
|
45322
45379
|
function machineFile(name, text4) {
|
|
45323
|
-
const suffix =
|
|
45380
|
+
const suffix = createHash5("sha256").update(text4).digest("hex").slice(0, 16);
|
|
45324
45381
|
const file2 = path51.join(machineHome(), "prompts", `${path51.parse(name).name}-${suffix}${path51.extname(name)}`);
|
|
45325
45382
|
try {
|
|
45326
45383
|
if (fs51.readFileSync(file2, "utf8") === text4) return file2;
|
|
@@ -45463,9 +45520,9 @@ var init_failures = __esm({
|
|
|
45463
45520
|
// ../cli/src/lib/agent/wire/acp-cost.ts
|
|
45464
45521
|
import fs52 from "node:fs";
|
|
45465
45522
|
import path52 from "node:path";
|
|
45466
|
-
import { createHash as
|
|
45523
|
+
import { createHash as createHash6 } from "node:crypto";
|
|
45467
45524
|
function acpCostFile(tool, cwd, session) {
|
|
45468
|
-
const key =
|
|
45525
|
+
const key = createHash6("sha256").update(JSON.stringify([tool, cwd, session])).digest("hex");
|
|
45469
45526
|
return path52.join(machineHome(), "usage", "acp", `${key}.json`);
|
|
45470
45527
|
}
|
|
45471
45528
|
function readAcpCost(file2) {
|
|
@@ -46770,7 +46827,7 @@ var init_antigravity = __esm({
|
|
|
46770
46827
|
// ../cli/src/lib/agent/harnesses/antigravity.ts
|
|
46771
46828
|
import fs55 from "node:fs";
|
|
46772
46829
|
import path55 from "node:path";
|
|
46773
|
-
import { createHash as
|
|
46830
|
+
import { createHash as createHash7 } from "node:crypto";
|
|
46774
46831
|
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
46775
46832
|
function antigravityModels(output2) {
|
|
46776
46833
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -46802,7 +46859,7 @@ function systemPrompt(text4, _argv, env2) {
|
|
|
46802
46859
|
const rule = `${text4}
|
|
46803
46860
|
|
|
46804
46861
|
The task working directory is ${env2.PWD ?? process.cwd()}. Use it as the base for project files and commands. This additional workspace contains only language rules; do not write task output here.`;
|
|
46805
|
-
const hash2 =
|
|
46862
|
+
const hash2 = createHash7("sha256").update(rule).digest("hex").slice(0, 16);
|
|
46806
46863
|
const root2 = path55.join(machineHome(), "prompts", `antigravity-${hash2}`);
|
|
46807
46864
|
const file2 = path55.join(root2, ".agents", "rules", "language.md");
|
|
46808
46865
|
fs55.mkdirSync(path55.dirname(file2), { recursive: true });
|
|
@@ -50809,9 +50866,9 @@ var init_own_cost = __esm({
|
|
|
50809
50866
|
});
|
|
50810
50867
|
|
|
50811
50868
|
// ../cli/src/lib/machine/identity.ts
|
|
50812
|
-
import
|
|
50869
|
+
import os5 from "node:os";
|
|
50813
50870
|
function machineName() {
|
|
50814
|
-
const raw =
|
|
50871
|
+
const raw = os5.hostname().trim();
|
|
50815
50872
|
return raw.replace(/\.local$/i, "") || "this machine";
|
|
50816
50873
|
}
|
|
50817
50874
|
var init_identity = __esm({
|
|
@@ -58061,10 +58118,10 @@ var init_task_operation = __esm({
|
|
|
58061
58118
|
|
|
58062
58119
|
// ../cli/src/commands/task.ts
|
|
58063
58120
|
import fs70 from "node:fs";
|
|
58064
|
-
import
|
|
58121
|
+
import os6 from "node:os";
|
|
58065
58122
|
import path71 from "node:path";
|
|
58066
58123
|
async function cloud(method, route2, body, signal2) {
|
|
58067
|
-
process.env.AI4KANBAN_HOME ??= process.env.WILDCRANE_HOME || path71.join(
|
|
58124
|
+
process.env.AI4KANBAN_HOME ??= process.env.WILDCRANE_HOME || path71.join(os6.homedir(), ".wildcrane");
|
|
58068
58125
|
const token2 = await accessToken();
|
|
58069
58126
|
if (!token2.ok) throw cloudError({
|
|
58070
58127
|
code: token2.reason.replace("-", "_"),
|
|
@@ -58163,7 +58220,7 @@ function readableFile(file2) {
|
|
|
58163
58220
|
function taskFiles(task, board, location) {
|
|
58164
58221
|
const local = board && runnerProject(board) === task.project ? localTaskRecord(board, task.id) : null;
|
|
58165
58222
|
const chat_file = /^task_[\w-]+$/.test(task.id) ? readableFile(taskChatFile(task.id)) : null;
|
|
58166
|
-
if (!local) return { card_file: null, chat_file, discussion_file: null, approved_inputs_file: null, delivery: null, config_files: [] };
|
|
58223
|
+
if (!local) return { card_file: null, asset_folder: null, chat_file, discussion_file: null, approved_inputs_file: null, delivery: null, config_files: [] };
|
|
58167
58224
|
useBoard({ root: projectRootOf(local.board), board: local.board, named: true }, false, true);
|
|
58168
58225
|
const found2 = fs70.existsSync(path71.join(local.board, "todo")) && locate(local.number) || locateArchived(local.number);
|
|
58169
58226
|
const card_file = found2 ? readableFile(found2.kind === "group" ? path71.join(found2.target, "root.md") : found2.target) : null;
|
|
@@ -58174,6 +58231,7 @@ function taskFiles(task, board, location) {
|
|
|
58174
58231
|
const config_files = [projectConfigFile, ...studio2 ? [studioConfigFile(studio2), legacyStudioRuleFile(studio2)] : []].map((file2) => readableFile(path71.join(local.board, file2))).filter((file2) => file2 !== null);
|
|
58175
58232
|
return {
|
|
58176
58233
|
card_file,
|
|
58234
|
+
asset_folder: path71.join(ASSETS, String(local.number)),
|
|
58177
58235
|
chat_file,
|
|
58178
58236
|
discussion_file: readableFile(path71.join(local.board, ".sync", `${local.task}.discussion`, "discussion.md")),
|
|
58179
58237
|
approved_inputs_file: current ? readableFile(process.env[SAVED_PREVIEW_FILE_ENV]) : null,
|
|
@@ -58268,6 +58326,7 @@ async function taskShow(id2, location = {}) {
|
|
|
58268
58326
|
say(`${task.key} ${task.title}`);
|
|
58269
58327
|
say(`${task.status}${task.studio ? ` ${task.studio.name}` : ""} ${taskUrl(task.key)}`);
|
|
58270
58328
|
if (files.card_file || task.studio) say(`Card file: ${files.card_file ?? "unavailable on this computer"}`);
|
|
58329
|
+
if (files.asset_folder) say(`Asset folder: ${files.asset_folder}`);
|
|
58271
58330
|
if (card) say(`
|
|
58272
58331
|
${card.body.trim()}`);
|
|
58273
58332
|
else if (task.studio) say("The card has not been generated yet.");
|
|
@@ -58902,7 +58961,7 @@ var init_goal2 = __esm({
|
|
|
58902
58961
|
|
|
58903
58962
|
// ../cli/src/commands/goal-cloud.ts
|
|
58904
58963
|
import fs73 from "node:fs";
|
|
58905
|
-
import
|
|
58964
|
+
import os7 from "node:os";
|
|
58906
58965
|
import path72 from "node:path";
|
|
58907
58966
|
import crypto7 from "node:crypto";
|
|
58908
58967
|
function hostSession() {
|
|
@@ -58929,7 +58988,7 @@ async function studios2(workspace2) {
|
|
|
58929
58988
|
async function discussion() {
|
|
58930
58989
|
const session = hostSession();
|
|
58931
58990
|
if (!session) die("Goals exist only inside a WildCrane goal discussion.");
|
|
58932
|
-
const home3 = process.env.WILDCRANE_HOME || path72.join(
|
|
58991
|
+
const home3 = process.env.WILDCRANE_HOME || path72.join(os7.homedir(), ".wildcrane");
|
|
58933
58992
|
process.env.AI4KANBAN_HOME ??= home3;
|
|
58934
58993
|
if (session.host === "discussion") return request("GET", `/v1/discussions/${encodeURIComponent(session.id)}`);
|
|
58935
58994
|
const machineFile2 = path72.join(home3, "machine.json");
|
|
@@ -59826,7 +59885,7 @@ var init_transcribe = __esm({
|
|
|
59826
59885
|
});
|
|
59827
59886
|
|
|
59828
59887
|
// ../cli/src/commands/cloud-template.ts
|
|
59829
|
-
import { createHash as
|
|
59888
|
+
import { createHash as createHash8 } from "node:crypto";
|
|
59830
59889
|
import fs76 from "node:fs";
|
|
59831
59890
|
import path76 from "node:path";
|
|
59832
59891
|
function usage2(problem2, line) {
|
|
@@ -59889,7 +59948,7 @@ async function asJson(res) {
|
|
|
59889
59948
|
return value;
|
|
59890
59949
|
}
|
|
59891
59950
|
function entries(value) {
|
|
59892
|
-
return Array.isArray(value) && value.every((entry) => isRecord(entry) && hasText(entry.path) && !/[\\:\0]/.test(entry.path) && entry.path.split("/").every((part) => !!part && part !== "." && part !== "..") && typeof entry.size === "number" && Number.isSafeInteger(entry.size) && entry.size >= 0 && (entry.sha256 === void 0 || typeof entry.sha256 === "string" && /^[a-f0-9]{64}$/.test(entry.sha256)));
|
|
59951
|
+
return Array.isArray(value) && value.every((entry) => isRecord(entry) && hasText(entry.path) && !/[\\:\0]/.test(entry.path) && entry.path.split("/").every((part) => !!part && part !== "." && part !== "..") && typeof entry.size === "number" && Number.isSafeInteger(entry.size) && entry.size >= 0 && (entry.sha256 === void 0 || typeof entry.sha256 === "string" && /^[a-f0-9]{64}$/.test(entry.sha256)) && (entry.url === void 0 || hasText(entry.url)));
|
|
59893
59952
|
}
|
|
59894
59953
|
async function downloadEntries(name, kind, files, to, fallback) {
|
|
59895
59954
|
if (!SLUG.test(name)) throw cloudError(invalidResponse("a valid template name"));
|
|
@@ -59906,13 +59965,13 @@ async function downloadEntries(name, kind, files, to, fallback) {
|
|
|
59906
59965
|
if (!(error62 instanceof BoardError)) throw error62;
|
|
59907
59966
|
return refuse4(CORRUPT, fallback, invalidResponse(expected));
|
|
59908
59967
|
});
|
|
59909
|
-
if (file2.sha256 &&
|
|
59910
|
-
fetched.push({ out, bytes });
|
|
59968
|
+
if (file2.sha256 && createHash8("sha256").update(bytes).digest("hex") !== file2.sha256) refuse4(CORRUPT, fallback, invalidResponse(expected));
|
|
59969
|
+
fetched.push({ out, bytes, url: file2.url });
|
|
59911
59970
|
}
|
|
59912
59971
|
if (fetched.length) fs76.mkdirSync(to, { recursive: true });
|
|
59913
|
-
return fetched.map(({ out, bytes }) => {
|
|
59972
|
+
return fetched.map(({ out, bytes, url: url2 }) => {
|
|
59914
59973
|
fs76.writeFileSync(out, bytes);
|
|
59915
|
-
say(out);
|
|
59974
|
+
say(url2 ? `${out} (${url2})` : out);
|
|
59916
59975
|
return out;
|
|
59917
59976
|
});
|
|
59918
59977
|
}
|
|
@@ -59941,9 +60000,13 @@ async function templateSearch(opts, program2) {
|
|
|
59941
60000
|
const { templates } = await asJson(await ask(`?${query}`, {}, WITHOUT));
|
|
59942
60001
|
if (templates.length === 0) say("No template matches.");
|
|
59943
60002
|
for (const t of templates) {
|
|
59944
|
-
|
|
60003
|
+
const scope = t.website?.scope;
|
|
60004
|
+
const details = [t.access, scope, t.revision ? `rev ${t.revision}` : void 0].filter(Boolean).join(", ");
|
|
60005
|
+
say(`${t.name} \u2014 ${t.title} [${details}]`);
|
|
59945
60006
|
say(` ${t.summary}`);
|
|
59946
|
-
|
|
60007
|
+
if (t.pageUrl) say(` page: ${t.pageUrl}`);
|
|
60008
|
+
const previewList = t.previews.map((p) => p.url ? `${p.path} (${p.url})` : p.path).join(", ") || "-";
|
|
60009
|
+
say(` tags: ${t.tags.join(", ") || "-"} \xB7 previews: ${previewList}`);
|
|
59947
60010
|
for (const l of t.description.split("\n")) say(` ${l}`);
|
|
59948
60011
|
}
|
|
59949
60012
|
return { templates };
|
|
@@ -59951,13 +60014,27 @@ async function templateSearch(opts, program2) {
|
|
|
59951
60014
|
async function templatePreview(name, opts, program2) {
|
|
59952
60015
|
if (!opts.to) usage2("Missing --to.", `${program2} template preview <name> --to <dir>`);
|
|
59953
60016
|
const at = encodeURIComponent(name);
|
|
59954
|
-
const { previews } = requireResponse(
|
|
60017
|
+
const { previews, revision, pageUrl } = requireResponse(
|
|
59955
60018
|
await asJson(await ask(`/${at}/previews`, {}, WITHOUT)),
|
|
59956
60019
|
"the template preview list",
|
|
59957
|
-
(value) => entries(value.previews)
|
|
60020
|
+
(value) => entries(value.previews) && (value.revision === void 0 || hasText(value.revision)) && (value.pageUrl === void 0 || hasText(value.pageUrl))
|
|
59958
60021
|
);
|
|
59959
60022
|
if (previews.length === 0) say("This template has no preview.");
|
|
59960
|
-
|
|
60023
|
+
const written = await downloadEntries(name, "previews", previews, opts.to, WITHOUT);
|
|
60024
|
+
if (pageUrl) say(`page: ${pageUrl}`);
|
|
60025
|
+
return {
|
|
60026
|
+
name,
|
|
60027
|
+
...revision !== void 0 && { revision },
|
|
60028
|
+
...pageUrl !== void 0 && { pageUrl },
|
|
60029
|
+
previews: written,
|
|
60030
|
+
files: previews.map((p, i) => ({
|
|
60031
|
+
path: p.path,
|
|
60032
|
+
file: written[i],
|
|
60033
|
+
size: p.size,
|
|
60034
|
+
...p.sha256 !== void 0 && { sha256: p.sha256 },
|
|
60035
|
+
...p.url !== void 0 && { url: p.url }
|
|
60036
|
+
}))
|
|
60037
|
+
};
|
|
59961
60038
|
}
|
|
59962
60039
|
async function templateGet(name, opts, program2) {
|
|
59963
60040
|
if (!opts.to) usage2("Missing --to.", `${program2} template get <name> --to <dir>`);
|
|
@@ -59966,7 +60043,7 @@ async function templateGet(name, opts, program2) {
|
|
|
59966
60043
|
const { template } = requireResponse(
|
|
59967
60044
|
await asJson(await ask(`/${at}`, {}, WITHOUT)),
|
|
59968
60045
|
"the template file list",
|
|
59969
|
-
(value) => isRecord(value.template) && entries(value.template.files)
|
|
60046
|
+
(value) => isRecord(value.template) && entries(value.template.files) && (value.template.previews === void 0 || entries(value.template.previews))
|
|
59970
60047
|
);
|
|
59971
60048
|
const fetched = [];
|
|
59972
60049
|
for (const f of template.files) {
|
|
@@ -59977,7 +60054,7 @@ async function templateGet(name, opts, program2) {
|
|
|
59977
60054
|
if (!(error62 instanceof BoardError)) throw error62;
|
|
59978
60055
|
return refuse4(CORRUPT, WITHOUT, invalidResponse("a matching template file"));
|
|
59979
60056
|
});
|
|
59980
|
-
if (bytes.byteLength !== f.size ||
|
|
60057
|
+
if (bytes.byteLength !== f.size || createHash8("sha256").update(bytes).digest("hex") !== f.sha256) {
|
|
59981
60058
|
refuse4(CORRUPT, WITHOUT);
|
|
59982
60059
|
}
|
|
59983
60060
|
fetched.push({ out, bytes });
|
|
@@ -59991,7 +60068,19 @@ async function templateGet(name, opts, program2) {
|
|
|
59991
60068
|
fs76.writeFileSync(f.out, f.bytes);
|
|
59992
60069
|
}
|
|
59993
60070
|
say(`Fetched ${name}: ${fetched.length} files into ${to}`);
|
|
59994
|
-
|
|
60071
|
+
if (template.pageUrl) say(`page: ${template.pageUrl}`);
|
|
60072
|
+
for (const p of template.previews ?? []) {
|
|
60073
|
+
if (p.url) say(`preview: ${p.path} (${p.url})`);
|
|
60074
|
+
}
|
|
60075
|
+
return {
|
|
60076
|
+
name,
|
|
60077
|
+
to,
|
|
60078
|
+
files: template.files.map((f) => f.path),
|
|
60079
|
+
...template.title !== void 0 && { title: template.title },
|
|
60080
|
+
...template.revision !== void 0 && { revision: template.revision },
|
|
60081
|
+
...template.pageUrl !== void 0 && { pageUrl: template.pageUrl },
|
|
60082
|
+
...template.previews !== void 0 && { previews: template.previews }
|
|
60083
|
+
};
|
|
59995
60084
|
}
|
|
59996
60085
|
async function templateSource(name, opts) {
|
|
59997
60086
|
const at = encodeURIComponent(name);
|
|
@@ -60399,7 +60488,7 @@ var require_limiter = __commonJS({
|
|
|
60399
60488
|
var require_permessage_deflate = __commonJS({
|
|
60400
60489
|
"../cli/node_modules/ws/lib/permessage-deflate.js"(exports, module) {
|
|
60401
60490
|
"use strict";
|
|
60402
|
-
var
|
|
60491
|
+
var zlib2 = __require("zlib");
|
|
60403
60492
|
var bufferUtil = require_buffer_util();
|
|
60404
60493
|
var Limiter = require_limiter();
|
|
60405
60494
|
var { kStatusCode } = require_constants();
|
|
@@ -60666,8 +60755,8 @@ var require_permessage_deflate = __commonJS({
|
|
|
60666
60755
|
const endpoint2 = this._isServer ? "client" : "server";
|
|
60667
60756
|
if (!this._inflate) {
|
|
60668
60757
|
const key = `${endpoint2}_max_window_bits`;
|
|
60669
|
-
const windowBits = typeof this.params[key] !== "number" ?
|
|
60670
|
-
this._inflate =
|
|
60758
|
+
const windowBits = typeof this.params[key] !== "number" ? zlib2.Z_DEFAULT_WINDOWBITS : this.params[key];
|
|
60759
|
+
this._inflate = zlib2.createInflateRaw({
|
|
60671
60760
|
...this._options.zlibInflateOptions,
|
|
60672
60761
|
windowBits
|
|
60673
60762
|
});
|
|
@@ -60717,8 +60806,8 @@ var require_permessage_deflate = __commonJS({
|
|
|
60717
60806
|
const endpoint2 = this._isServer ? "server" : "client";
|
|
60718
60807
|
if (!this._deflate) {
|
|
60719
60808
|
const key = `${endpoint2}_max_window_bits`;
|
|
60720
|
-
const windowBits = typeof this.params[key] !== "number" ?
|
|
60721
|
-
this._deflate =
|
|
60809
|
+
const windowBits = typeof this.params[key] !== "number" ? zlib2.Z_DEFAULT_WINDOWBITS : this.params[key];
|
|
60810
|
+
this._deflate = zlib2.createDeflateRaw({
|
|
60722
60811
|
...this._options.zlibDeflateOptions,
|
|
60723
60812
|
windowBits
|
|
60724
60813
|
});
|
|
@@ -60728,7 +60817,7 @@ var require_permessage_deflate = __commonJS({
|
|
|
60728
60817
|
}
|
|
60729
60818
|
this._deflate[kCallback] = callback;
|
|
60730
60819
|
this._deflate.write(data);
|
|
60731
|
-
this._deflate.flush(
|
|
60820
|
+
this._deflate.flush(zlib2.Z_SYNC_FLUSH, () => {
|
|
60732
60821
|
if (!this._deflate) {
|
|
60733
60822
|
return;
|
|
60734
60823
|
}
|
|
@@ -62491,7 +62580,7 @@ var require_websocket = __commonJS({
|
|
|
62491
62580
|
var net = __require("net");
|
|
62492
62581
|
var querystring = __require("querystring");
|
|
62493
62582
|
var tls = __require("tls");
|
|
62494
|
-
var { randomBytes, createHash:
|
|
62583
|
+
var { randomBytes, createHash: createHash13 } = __require("crypto");
|
|
62495
62584
|
var { Duplex, Readable } = __require("stream");
|
|
62496
62585
|
var { URL: URL3 } = __require("url");
|
|
62497
62586
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
@@ -63182,7 +63271,7 @@ var require_websocket = __commonJS({
|
|
|
63182
63271
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
63183
63272
|
return;
|
|
63184
63273
|
}
|
|
63185
|
-
const digest2 =
|
|
63274
|
+
const digest2 = createHash13("sha1").update(key + GUID).digest("base64");
|
|
63186
63275
|
if (res.headers["sec-websocket-accept"] !== digest2) {
|
|
63187
63276
|
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
63188
63277
|
return;
|
|
@@ -63567,7 +63656,7 @@ var require_websocket_server = __commonJS({
|
|
|
63567
63656
|
var EventEmitter = __require("events");
|
|
63568
63657
|
var http = __require("http");
|
|
63569
63658
|
var { Duplex } = __require("stream");
|
|
63570
|
-
var { createHash:
|
|
63659
|
+
var { createHash: createHash13 } = __require("crypto");
|
|
63571
63660
|
var extension2 = require_extension();
|
|
63572
63661
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
63573
63662
|
var subprotocol2 = require_subprotocol();
|
|
@@ -63877,7 +63966,7 @@ var require_websocket_server = __commonJS({
|
|
|
63877
63966
|
);
|
|
63878
63967
|
}
|
|
63879
63968
|
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
|
63880
|
-
const digest2 =
|
|
63969
|
+
const digest2 = createHash13("sha1").update(key + GUID).digest("base64");
|
|
63881
63970
|
const headers = [
|
|
63882
63971
|
"HTTP/1.1 101 Switching Protocols",
|
|
63883
63972
|
"Upgrade: websocket",
|
|
@@ -64285,7 +64374,7 @@ var init_archive2 = __esm({
|
|
|
64285
64374
|
var board_default;
|
|
64286
64375
|
var init_board2 = __esm({
|
|
64287
64376
|
"../cli/src/guide/board.md"() {
|
|
64288
|
-
board_default = "# How this board works\n\nThese rules apply to every card studio. Read them once; each studio's guide covers\nthe remaining details.\n\n## Layout\n\n```\ndocs/kanban/\n\u251C\u2500\u2500 todo/ open tasks\n\u2502 \u251C\u2500\u2500 README.md the index \u2014 read it first\n\u2502 \u2514\u2500\u2500 <id>-<slug>.md\n\u2502 one card per file; a group keeps its cards in one folder\n\u251C\u2500\u2500 rules/ `config.md` \u2014 project defaults; `studios/<studio>/config.md` \u2014 Studio configuration\n\u2502 `<agent>.md` \u2014 project background-task instructions, set with\n\u2502 `akb studio instructions`\n\u251C\u2500\u2500 triage/ items waiting to be sorted, one file each \u2014 not cards. Only\n\u2502 \u2502 Cloud's sort or Refine idea on the web's Triage page turns one\n\u2502 \u2502 into a card; `akb triage check <source-id>` finds an existing one\n\u2502 \u251C\u2500\u2500 archived/ items a card was made of\n\u2502 \u251C\u2500\u2500 dismissed/ items ignored, with the reason\n\u2502 \u2514\u2500\u2500 files/ dropped-in files\n\u2514\u2500\u2500 modules.md one line per module \u2014 `akb guide module-map` writes it\n```\n\
|
|
64377
|
+
board_default = "# How this board works\n\nThese rules apply to every card studio. Read them once; each studio's guide covers\nthe remaining details.\n\n## Layout\n\n```\ndocs/kanban/\n\u251C\u2500\u2500 todo/ open tasks\n\u2502 \u251C\u2500\u2500 README.md the index \u2014 read it first\n\u2502 \u2514\u2500\u2500 <id>-<slug>.md\n\u2502 one card per file; a group keeps its cards in one folder\n\u251C\u2500\u2500 rules/ `config.md` \u2014 project defaults; `studios/<studio>/config.md` \u2014 Studio configuration\n\u2502 `<agent>.md` \u2014 project background-task instructions, set with\n\u2502 `akb studio instructions`\n\u251C\u2500\u2500 triage/ items waiting to be sorted, one file each \u2014 not cards. Only\n\u2502 \u2502 Cloud's sort or Refine idea on the web's Triage page turns one\n\u2502 \u2502 into a card; `akb triage check <source-id>` finds an existing one\n\u2502 \u251C\u2500\u2500 archived/ items a card was made of\n\u2502 \u251C\u2500\u2500 dismissed/ items ignored, with the reason\n\u2502 \u2514\u2500\u2500 files/ dropped-in files\n\u2514\u2500\u2500 modules.md one line per module \u2014 `akb guide module-map` writes it\n```\n\n## Task ID\n\nEvery task's id is the number at the front of its filename (`04-plan-cap-enforcement.md` \u2192\nid 4): its Cloud task's number (`WC-4`). Only Cloud assigns one.\n\n## Never hand-write a card's frontmatter\n\nEdit the card body directly. Use `akb task update` for card fields,\n`akb task update-questions` for questions, and `akb task review` for the review plan.\n\nFind commands with `akb help`, then read the matching subcommand's `--help`.\n\n## Content conflicts\n\nFor synchronization conflicts, follow `akb guide resolve-conflict`.\n\n## Inside a board run\n\nA board run carries `KANBAN_RUN` in its environment. Never unset or bypass it (for example\n`env -u KANBAN_RUN`): when a command only prints a flow, follow the printed flow.\n\n## Group task\n\nA group lives in `todo/<id>-<slug>/`: `root.md` tracks the whole job and each subtask is its\nown card beside it; `akb guide add-task` says how to build one. The root's `## Todo` lists the\nsubtasks, one line each ending in `#<subid>`: archiving a subtask ticks its line, rejecting\none strikes it through, and resolving the last line archives the root in the same run, with\nany open question or unticked todo of its own. A board a Runner keeps leaves that close to\nCloud, which waits for the root to be queued with no step on it. A root listing no subtasks is\nonly closed by hand.\n\n## Task context\n\nUse `akb task show <task>` for the current card, Review, Preview references and saved materials.\nCheck the current Studio instructions, shared rules and project and Studio configurations before\nworking. Read linked files, applicable Preview definitions, component documentation and memory\nas needed. Write results in matching Preview blocks and preserve unrelated work. When reading scoped\npreferences for a specific output, match its configuration to the current action and the task's\nproject (`akb task show <id> --json`).\n\nSave task assets in the `Asset folder` shown by `akb task show <id>` and reference them as\n`.assets/<id>/\u2026` in the card. Keep `todo/.assets/` clear.\n\nReread configuration before Land and after a Setup answer. Studio preferences override project\ndefaults for the same key. Ask through `akb guide update-questions` when a required Setup choice\nfirst matters. Pause the dependent action and use declared defaults for optional choices.\nCheck required credentials on the executing Runner without printing secrets. Use a read-only\ncheck when available. If missing or invalid, ask the user to configure them locally or follow\nthe Studio's fallback. Keep credentials out of cards, configuration, synced files and logs. Do not write memory in task runs.\n\n## Preview selection\n\n- **Read the Studio first**: before choosing Previews, read its `STUDIO.md` (`akb studio file <studio> STUDIO.md`), relevant linked files, and its configuration (`akb studio rule <studio>`).\n- **Built-in Previews first**: match deliverables that need review to the Studio's built-in Previews; never replace a built-in Preview with a custom one or mix a built-in Preview's deliverable into a custom Preview.\n- **Custom Previews as fallback**: define a custom Preview only when built-in Previews cannot cover a deliverable that needs review, and keep task plans and context in the card or goal body.\n";
|
|
64289
64378
|
}
|
|
64290
64379
|
});
|
|
64291
64380
|
|
|
@@ -64389,7 +64478,7 @@ var init_review_rejections = __esm({
|
|
|
64389
64478
|
var refine_default;
|
|
64390
64479
|
var init_refine = __esm({
|
|
64391
64480
|
"../cli/src/guide/refine.md"() {
|
|
64392
|
-
refine_default = '# Refine a card\n\nPlan
|
|
64481
|
+
refine_default = '# Refine a card\n\nPlan only what is needed to make the requested outcome buildable; skip further planning when it already is.\n\n- **Unchecked cards**: check cards with `triage:` and empty `## Scope` against the project, rejecting obsolete or completed work with `akb task remove <id> "<evidence>"` and stopping.\n- **Other obsolete or completed cards**: ask whether to discard, run no previews, and stop.\n- **Groups**: preserve subtask coverage and progress, fill gaps without duplication, and do not mark the parent ready merely because its split is complete.\n- **Verification**: plan representative checks for the outcome, project rules and material risks, confirm prerequisites, and keep optional coverage optional.\n- **Review**: read `akb task review <id>`. If undecided, submit `--review <flow>` with Preview names or `--file <json>` with Preview IDs, plus `--revision <n>`. Use `--review \'\'` when no extra review is needed. Work only on dispatched, unlocked nodes and continue independent work during review.\n- **Context and Previews**: follow "Task context" and "Preview selection" in `akb guide board`. Attach any custom definition with `--preview-definitions-file`.\n- **Previews**: prepare only the unlocked nodes\u2019 outputs per the Studio\u2019s `<Preview>` blocks. Before revising an approved output, use `--revise-from <stage> --revision <n>`; preserve unrelated outputs and approvals.\n- **Submit**: synchronize body and assets, then report `--stage <id> --status done --revision <n>`. Re-read after conflicts; obtain output approval at the required stages.\n- **Delivery**: the Studio\'s delivery flow handles separate implementation and its checks.\n- **References**: rewrite mentions of cards no longer on the board.\n- **Decisions**: settle in-scope choices by project evidence and conventions; ask before changing scope and only as `akb guide update-questions` allows.\n- **Card**: follow studio rules and `akb guide writing`, fixing all errors from `akb task validate <id>`.\n- **Ready**: when validated and buildable with prerequisites settled, run `akb task update <id> --status ready`; otherwise leave blockers as open questions.\n\nFollow the printed closing steps. Wait only for required approvals; completion still requires Studio delivery checks.\n';
|
|
64393
64482
|
}
|
|
64394
64483
|
});
|
|
64395
64484
|
|
|
@@ -64397,7 +64486,7 @@ var init_refine = __esm({
|
|
|
64397
64486
|
var reflect_default;
|
|
64398
64487
|
var init_reflect = __esm({
|
|
64399
64488
|
"../cli/src/guide/reflect.md"() {
|
|
64400
|
-
reflect_default = '# Reflect on completed cards\n\n## Read\n\nRead each given `<card>` in full and check its own `shipped` content; keep cards separate.\n\n## Filter\n\n- **Evidence**: verify each candidate against
|
|
64489
|
+
reflect_default = '# Reflect on completed cards\n\n## Read\n\nRead each given `<card>` in full and check its own `shipped` content; keep cards separate.\n\n## Filter\n\n- **Evidence**: verify each candidate against current project state or deliverables, citing specific evidence and skipping resolved or unsupported items.\n- **Impact**: propose a separate task only for material impact on users, workflows, deliverables, or stated project goals\u2014never minor polish or speculation.\n- **Duplicates**: compare requested outcomes with open tasks (`akb board list`), pending triage, and the rest of this batch; skip work they already cover. If shipped work invalidates an open task\'s plan, run `akb task revise <id> "<the change and why>"`.\n- **Prior decisions**: skip work rejected in `docs/kanban/memory/agents/planner/rejected.md` or its module folders, and calls the user reversed, in any `redesign.md` under `docs/kanban/memory/agents/` or under a card\'s `Overruled by the user`. Revisit a low-value dismissal only when new evidence establishes material impact.\n\n## Write\n\nWrite each item\'s title and body in the **Goal format** of `akb guide discuss-goal`; write the body to a temporary Markdown file and end it with the source card\'s archive path.\nWrite one triage item per qualifying proposal. Submit nothing if none qualify.\nUse the source card\'s `studio:`, or the id from `akb studio list` that fits the work when it has none.\n\n```text\nakb triage add --title "<one line>" --slug <short-english-slug> --source "#<id>" --studio <studio> --file <body.md>\n```\n\nBriefly report what you proposed and what you skipped, with reasons.\n';
|
|
64401
64490
|
}
|
|
64402
64491
|
});
|
|
64403
64492
|
|
|
@@ -64581,6 +64670,7 @@ var init_guide2 = __esm({
|
|
|
64581
64670
|
import crypto8 from "node:crypto";
|
|
64582
64671
|
import fs77 from "node:fs";
|
|
64583
64672
|
import path77 from "node:path";
|
|
64673
|
+
import zlib from "node:zlib";
|
|
64584
64674
|
function cmdStudioList() {
|
|
64585
64675
|
if (!studiosReachable().ok) die(NEEDS_CLOUD, "needs-cloud");
|
|
64586
64676
|
const rows = studios();
|
|
@@ -64845,7 +64935,124 @@ async function cmdStudioInstructions(agent, opts) {
|
|
|
64845
64935
|
say(rule ? `saved ${agent}'s instructions (this project)` : `cleared ${agent}'s instructions`);
|
|
64846
64936
|
return { agent, rule, scope: "project" };
|
|
64847
64937
|
}
|
|
64848
|
-
|
|
64938
|
+
function tarHeader(name, size, kind = "0") {
|
|
64939
|
+
const header = new Uint8Array(512);
|
|
64940
|
+
const writeStr = (at, val) => header.set(Buffer.from(val, "utf8"), at);
|
|
64941
|
+
writeStr(0, name);
|
|
64942
|
+
writeStr(100, "0000644\0");
|
|
64943
|
+
writeStr(108, "0000000\0");
|
|
64944
|
+
writeStr(116, "0000000\0");
|
|
64945
|
+
writeStr(124, `${size.toString(8).padStart(11, "0")}\0`);
|
|
64946
|
+
writeStr(136, "00000000000\0");
|
|
64947
|
+
writeStr(148, " ");
|
|
64948
|
+
header[156] = kind.charCodeAt(0);
|
|
64949
|
+
writeStr(257, "ustar\0");
|
|
64950
|
+
writeStr(263, "00");
|
|
64951
|
+
const sum = header.reduce((a, b) => a + b, 0);
|
|
64952
|
+
writeStr(148, `${sum.toString(8).padStart(6, "0")}\0 `);
|
|
64953
|
+
return header;
|
|
64954
|
+
}
|
|
64955
|
+
function tarBlock(body) {
|
|
64956
|
+
const pad2 = Math.ceil(body.length / 512) * 512;
|
|
64957
|
+
if (pad2 === 0) return new Uint8Array(0);
|
|
64958
|
+
const out = new Uint8Array(pad2);
|
|
64959
|
+
out.set(body);
|
|
64960
|
+
return out;
|
|
64961
|
+
}
|
|
64962
|
+
function packDashboardDir(dir) {
|
|
64963
|
+
const root2 = path77.resolve(dir);
|
|
64964
|
+
if (!fs77.statSync(root2, { throwIfNoEntry: false })?.isDirectory()) {
|
|
64965
|
+
die(`${dir} is not a folder`, "bad-args");
|
|
64966
|
+
}
|
|
64967
|
+
const indexStat = fs77.lstatSync(path77.join(root2, "index.html"), { throwIfNoEntry: false });
|
|
64968
|
+
if (!indexStat?.isFile()) {
|
|
64969
|
+
die(`${dir} must contain index.html at its root`, "bad-args");
|
|
64970
|
+
}
|
|
64971
|
+
const files = [];
|
|
64972
|
+
let totalBytes = 0;
|
|
64973
|
+
const walk2 = (current, prefix) => {
|
|
64974
|
+
for (const entry of fs77.readdirSync(current, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
64975
|
+
if (entry.isSymbolicLink()) die(`Symlinks are not allowed in dashboard bundles: ${prefix}${entry.name}`, "bad-args");
|
|
64976
|
+
const full = path77.join(current, entry.name);
|
|
64977
|
+
const rel3 = `${prefix}${entry.name}`;
|
|
64978
|
+
if (entry.isDirectory()) {
|
|
64979
|
+
walk2(full, `${rel3}/`);
|
|
64980
|
+
} else if (entry.isFile()) {
|
|
64981
|
+
const body = fs77.readFileSync(full);
|
|
64982
|
+
totalBytes += body.length;
|
|
64983
|
+
if (files.length >= DASHBOARD_MAX_FILES) die(`Dashboard bundle exceeds ${DASHBOARD_MAX_FILES} files`, "bad-args");
|
|
64984
|
+
if (totalBytes > DASHBOARD_MAX_BYTES) die("Dashboard bundle exceeds 25 MB unpacked", "bad-args");
|
|
64985
|
+
files.push({ rel: rel3, body });
|
|
64986
|
+
}
|
|
64987
|
+
}
|
|
64988
|
+
};
|
|
64989
|
+
walk2(root2, "");
|
|
64990
|
+
const chunks = [];
|
|
64991
|
+
for (const { rel: rel3, body } of files) {
|
|
64992
|
+
const nameBytes = Buffer.byteLength(rel3, "utf8");
|
|
64993
|
+
if (nameBytes > 100) {
|
|
64994
|
+
const paxEntry = `path=${rel3}
|
|
64995
|
+
`;
|
|
64996
|
+
const len = Buffer.byteLength(paxEntry, "utf8") + String(Buffer.byteLength(paxEntry, "utf8") + 4).length + 1;
|
|
64997
|
+
const paxBody = Buffer.from(`${len} ${paxEntry}`, "utf8");
|
|
64998
|
+
chunks.push(tarHeader(`pax/${rel3.slice(0, 80)}`, paxBody.length, "x"), tarBlock(paxBody));
|
|
64999
|
+
chunks.push(tarHeader(rel3.slice(0, 99), body.length), tarBlock(body));
|
|
65000
|
+
} else {
|
|
65001
|
+
chunks.push(tarHeader(rel3, body.length), tarBlock(body));
|
|
65002
|
+
}
|
|
65003
|
+
}
|
|
65004
|
+
chunks.push(new Uint8Array(1024));
|
|
65005
|
+
return { gzip: zlib.gzipSync(Buffer.concat(chunks)), fileCount: files.length, sizeBytes: totalBytes };
|
|
65006
|
+
}
|
|
65007
|
+
async function cmdStudioDashboardPublish(studioId, dir, opts = {}) {
|
|
65008
|
+
if (opts.access !== void 0 && opts.access !== "private" && opts.access !== "public") {
|
|
65009
|
+
die('--access must be "private" or "public"', "bad-args");
|
|
65010
|
+
}
|
|
65011
|
+
const { gzip } = packDashboardDir(dir);
|
|
65012
|
+
const workspace2 = opts.workspace ?? (await cloudScope()).workspace;
|
|
65013
|
+
const listed = requireResponse(
|
|
65014
|
+
cloudOk(await call("GET", `/v1/dashboards?workspace=${enc2(workspace2)}&studio=${enc2(studioId)}&limit=1`)),
|
|
65015
|
+
"the Studio dashboard list",
|
|
65016
|
+
(v) => Array.isArray(v.data)
|
|
65017
|
+
);
|
|
65018
|
+
let dash = listed.data[0];
|
|
65019
|
+
if (!dash) {
|
|
65020
|
+
dash = requireResponse(
|
|
65021
|
+
cloudOk(await call("POST", "/v1/dashboards", {
|
|
65022
|
+
workspace: workspace2,
|
|
65023
|
+
studio: studioId,
|
|
65024
|
+
name: opts.name?.trim() || studioId,
|
|
65025
|
+
...opts.access ? { access: opts.access } : {}
|
|
65026
|
+
})),
|
|
65027
|
+
"the created dashboard",
|
|
65028
|
+
(v) => typeof v.id === "string"
|
|
65029
|
+
);
|
|
65030
|
+
} else if (opts.access !== void 0 || opts.name !== void 0) {
|
|
65031
|
+
dash = requireResponse(
|
|
65032
|
+
cloudOk(await call("PATCH", `/v1/dashboards/${enc2(dash.id)}`, {
|
|
65033
|
+
...opts.name !== void 0 ? { name: opts.name.trim() } : {},
|
|
65034
|
+
...opts.access !== void 0 ? { access: opts.access } : {}
|
|
65035
|
+
})),
|
|
65036
|
+
"the updated dashboard",
|
|
65037
|
+
(v) => typeof v.id === "string"
|
|
65038
|
+
);
|
|
65039
|
+
}
|
|
65040
|
+
const published = requireResponse(
|
|
65041
|
+
cloudOk(await call("PUT", `/v1/dashboards/${enc2(dash.id)}/bundle`, new Blob([new Uint8Array(gzip)], { type: "application/gzip" }))),
|
|
65042
|
+
"the published dashboard",
|
|
65043
|
+
(v) => typeof v.id === "string" && typeof v.url === "string"
|
|
65044
|
+
);
|
|
65045
|
+
say(`${published.id} ${published.studio} ${published.access} ${published.url} (${published.fileCount} files, ${published.sizeBytes} bytes)`);
|
|
65046
|
+
return {
|
|
65047
|
+
id: published.id,
|
|
65048
|
+
studio: published.studio,
|
|
65049
|
+
url: published.url,
|
|
65050
|
+
access: published.access,
|
|
65051
|
+
fileCount: published.fileCount,
|
|
65052
|
+
sizeBytes: published.sizeBytes
|
|
65053
|
+
};
|
|
65054
|
+
}
|
|
65055
|
+
var found, cloudIdOf, enc2, DASHBOARD_MAX_BYTES, DASHBOARD_MAX_FILES;
|
|
64849
65056
|
var init_studio3 = __esm({
|
|
64850
65057
|
"../cli/src/commands/studio.ts"() {
|
|
64851
65058
|
"use strict";
|
|
@@ -64872,6 +65079,8 @@ var init_studio3 = __esm({
|
|
|
64872
65079
|
};
|
|
64873
65080
|
cloudIdOf = (id2) => cloudFlows().find((f) => studioName(f.cloudId) === id2)?.cloudId;
|
|
64874
65081
|
enc2 = encodeURIComponent;
|
|
65082
|
+
DASHBOARD_MAX_BYTES = 25 * 1024 * 1024;
|
|
65083
|
+
DASHBOARD_MAX_FILES = 1e3;
|
|
64875
65084
|
}
|
|
64876
65085
|
});
|
|
64877
65086
|
|
|
@@ -66087,7 +66296,7 @@ var init_approve = __esm({
|
|
|
66087
66296
|
});
|
|
66088
66297
|
|
|
66089
66298
|
// ../cli/src/lib/agent/refine.ts
|
|
66090
|
-
import { createHash as
|
|
66299
|
+
import { createHash as createHash9 } from "node:crypto";
|
|
66091
66300
|
function markBoard() {
|
|
66092
66301
|
try {
|
|
66093
66302
|
return new Map(allCards().map((card) => [card.id, wroteOf(card)]));
|
|
@@ -66219,7 +66428,7 @@ var init_refine2 = __esm({
|
|
|
66219
66428
|
};
|
|
66220
66429
|
MARKER = /^<!--\s*agent\s*-->$/;
|
|
66221
66430
|
asMoved = (body) => body.split("\n").map((line) => line.trimEnd()).filter((line) => line.trim() && !MARKER.test(line.trim())).sort();
|
|
66222
|
-
wroteOf = (card) =>
|
|
66431
|
+
wroteOf = (card) => createHash9("sha1").update(
|
|
66223
66432
|
JSON.stringify([
|
|
66224
66433
|
card.status,
|
|
66225
66434
|
card.relPath,
|
|
@@ -67841,7 +68050,7 @@ var init_check2 = __esm({
|
|
|
67841
68050
|
});
|
|
67842
68051
|
|
|
67843
68052
|
// ../cli/src/lib/signals/identity.ts
|
|
67844
|
-
import { createHash as
|
|
68053
|
+
import { createHash as createHash10 } from "node:crypto";
|
|
67845
68054
|
function host(url2) {
|
|
67846
68055
|
try {
|
|
67847
68056
|
return new URL(url2).hostname.replace(/^www\./, "");
|
|
@@ -67863,14 +68072,14 @@ var init_identity2 = __esm({
|
|
|
67863
68072
|
"../cli/src/lib/signals/identity.ts"() {
|
|
67864
68073
|
"use strict";
|
|
67865
68074
|
DERIVED = "derived-";
|
|
67866
|
-
derivedSourceId = (seed) => `${DERIVED}${
|
|
68075
|
+
derivedSourceId = (seed) => `${DERIVED}${createHash10("sha256").update(seed).digest("hex").slice(0, 16)}`;
|
|
67867
68076
|
}
|
|
67868
68077
|
});
|
|
67869
68078
|
|
|
67870
68079
|
// ../cli/src/lib/signals/add.ts
|
|
67871
68080
|
import fs87 from "node:fs";
|
|
67872
68081
|
import path85 from "node:path";
|
|
67873
|
-
import { createHash as
|
|
68082
|
+
import { createHash as createHash11 } from "node:crypto";
|
|
67874
68083
|
function linkTitle(url2) {
|
|
67875
68084
|
let at;
|
|
67876
68085
|
try {
|
|
@@ -67895,7 +68104,7 @@ function fileName2(name, data) {
|
|
|
67895
68104
|
const base = path85.basename(name);
|
|
67896
68105
|
const ext = path85.extname(base).toLowerCase().slice(0, 12);
|
|
67897
68106
|
const word = path85.basename(base, path85.extname(base)).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 40) || "file";
|
|
67898
|
-
const hash2 =
|
|
68107
|
+
const hash2 = createHash11("sha256").update(data).digest("hex").slice(0, 8);
|
|
67899
68108
|
return `${word}-${hash2}${ext}`;
|
|
67900
68109
|
}
|
|
67901
68110
|
function addToInbox(drop) {
|
|
@@ -68105,13 +68314,13 @@ var init_previews = __esm({
|
|
|
68105
68314
|
// ../cli/src/commands/studio-preview.ts
|
|
68106
68315
|
import fs89 from "node:fs";
|
|
68107
68316
|
import path86 from "node:path";
|
|
68108
|
-
import { createHash as
|
|
68317
|
+
import { createHash as createHash12, randomUUID as randomUUID12 } from "node:crypto";
|
|
68109
68318
|
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
68110
68319
|
function readFolder2(folder2, baseline = false) {
|
|
68111
68320
|
const root2 = fs89.realpathSync(folder2);
|
|
68112
68321
|
const files = readStudioFolder(root2), checked = checkStudioFiles(files, readVersion2(files)?.id.startsWith("wf_builtin_") === true, { allowLegacyLand: baseline });
|
|
68113
68322
|
if (!checked.ok) die(`${folder2}/${formatStudioProblem(checked)}`, "studio-problems");
|
|
68114
|
-
const fingerprint =
|
|
68323
|
+
const fingerprint = createHash12("sha256").update(hashInput({ ...checked.files, ...files[VERSION_FILE] ? { [VERSION_FILE]: files[VERSION_FILE] } : {} })).digest("hex");
|
|
68115
68324
|
return { files, def: checked.def, fingerprint };
|
|
68116
68325
|
}
|
|
68117
68326
|
function unified(before, after2, file2, folder2) {
|
|
@@ -68597,6 +68806,12 @@ function declareRuns(program2, cli) {
|
|
|
68597
68806
|
).action(async function(agent) {
|
|
68598
68807
|
await onBoard(this, cli, () => cmdStudioInstructions(agent, this.opts()));
|
|
68599
68808
|
});
|
|
68809
|
+
const dashboard = flowWord("dashboard").summary("manage a studio static dashboard");
|
|
68810
|
+
dashboard.command("publish").argument("<studio>", "a studio id").argument("<dir>", "folder containing index.html and static assets").option("--access <mode>", "private or public").option("--name <name>", "dashboard display name").option("--workspace <id>", "target workspace id").summary("pack and publish a static dashboard for a studio").action(async function(studioId, dir) {
|
|
68811
|
+
const opts = this.opts();
|
|
68812
|
+
if (opts.workspace) await boardless(this, cli, () => cmdStudioDashboardPublish(studioId, dir, opts));
|
|
68813
|
+
else await onBoard(this, cli, () => cmdStudioDashboardPublish(studioId, dir, opts));
|
|
68814
|
+
});
|
|
68600
68815
|
withShared(program2.command("guide")).argument("[topic]", "one flow in full; left off, every flow is listed one line each").summary("the flows the board works by, shipped with this command").description(
|
|
68601
68816
|
"A printed flow already carries the flows its action is done by, so this is for the rest: how the board works at all, the module map, updating, the local UI. `guide board` is the card format, the layout and the memory set."
|
|
68602
68817
|
).action(async function(...vals) {
|