wildcrane-runner 0.6.104 → 0.6.105
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/akb/dist/kanban.mjs +262 -110
- package/dist/akb/package.json +1 -1
- package/dist/akb-proxy.mjs +1 -1
- package/dist/codex-proxy.mjs +356 -219
- package/dist/codex-retained.mjs +145 -51
- package/dist/flow-worker-main.mjs +924 -783
- package/dist/launcher.mjs +4 -4
- package/dist/plugin.mjs +4 -4
- package/dist/runner.mjs +847 -661
- package/dist/settings.mjs +4 -4
- 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.85 — 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;
|
|
@@ -16691,12 +16691,12 @@ function toJSONSchema(input2, params) {
|
|
|
16691
16691
|
processSchema(schema, ctx2);
|
|
16692
16692
|
}
|
|
16693
16693
|
const schemas = {};
|
|
16694
|
-
const
|
|
16694
|
+
const external2 = {
|
|
16695
16695
|
registry: registry2,
|
|
16696
16696
|
uri: params?.uri,
|
|
16697
16697
|
defs
|
|
16698
16698
|
};
|
|
16699
|
-
ctx2.external =
|
|
16699
|
+
ctx2.external = external2;
|
|
16700
16700
|
for (const entry of registry2._idmap.entries()) {
|
|
16701
16701
|
const [key, schema] = entry;
|
|
16702
16702
|
extractDefs(ctx2, schema);
|
|
@@ -22722,7 +22722,7 @@ var init_package = __esm({
|
|
|
22722
22722
|
"../cli/package.json"() {
|
|
22723
22723
|
package_default = {
|
|
22724
22724
|
name: "wildcrane",
|
|
22725
|
-
version: "0.11.
|
|
22725
|
+
version: "0.11.85",
|
|
22726
22726
|
akbContract: 28,
|
|
22727
22727
|
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.",
|
|
22728
22728
|
keywords: [
|
|
@@ -49235,6 +49235,54 @@ var init_inbox = __esm({
|
|
|
49235
49235
|
}
|
|
49236
49236
|
});
|
|
49237
49237
|
|
|
49238
|
+
// ../cli/src/lib/question-ops.ts
|
|
49239
|
+
function questionPositions(raw, count3, flag) {
|
|
49240
|
+
const ns = String(raw).split(",").map((s) => s.trim()).filter((s) => s.length > 0).map(Number);
|
|
49241
|
+
if (ns.length === 0 || ns.some((n) => !Number.isInteger(n) || n < 1)) {
|
|
49242
|
+
throw new QuestionOpError(`--${flag} needs one or more 1-based question numbers (e.g. 1 or 1,3)`);
|
|
49243
|
+
}
|
|
49244
|
+
const over = ns.find((n) => n > count3);
|
|
49245
|
+
if (over !== void 0) throw new QuestionOpError(`the card has ${count3} open question(s) \u2014 there's no question ${over}`);
|
|
49246
|
+
return ns;
|
|
49247
|
+
}
|
|
49248
|
+
function applyQuestionOps(start, ops, asker) {
|
|
49249
|
+
let questions = [...start];
|
|
49250
|
+
const changes = [];
|
|
49251
|
+
const closed2 = [];
|
|
49252
|
+
const positions = (op, flag) => questionPositions(op.ns ?? String(op.n), questions.length, flag);
|
|
49253
|
+
for (const op of ops) {
|
|
49254
|
+
if (op.kind === "clear") {
|
|
49255
|
+
closed2.push(...questions);
|
|
49256
|
+
questions = [];
|
|
49257
|
+
changes.push("cleared");
|
|
49258
|
+
} else if (op.kind === "drop") {
|
|
49259
|
+
const ns = positions(op, "drop");
|
|
49260
|
+
closed2.push(...ns.map((n) => questions[n - 1]));
|
|
49261
|
+
questions = questions.filter((_, i) => !ns.includes(i + 1));
|
|
49262
|
+
changes.push(`dropped ${ns.join(",")}`);
|
|
49263
|
+
} else if (op.kind === "append") {
|
|
49264
|
+
const agent = op.question.agent ?? asker;
|
|
49265
|
+
questions.push(agent ? { ...op.question, agent } : op.question);
|
|
49266
|
+
changes.push("appended");
|
|
49267
|
+
} else {
|
|
49268
|
+
const [n] = positions(op, "update");
|
|
49269
|
+
const agent = op.question.agent ?? questions[n - 1].agent;
|
|
49270
|
+
questions[n - 1] = { ...op.question, ...agent ? { agent } : {} };
|
|
49271
|
+
changes.push(`rewrote ${n}`);
|
|
49272
|
+
}
|
|
49273
|
+
}
|
|
49274
|
+
return { questions, changes, closed: closed2 };
|
|
49275
|
+
}
|
|
49276
|
+
var QUESTION_EDIT_LIMITS, QuestionOpError;
|
|
49277
|
+
var init_question_ops = __esm({
|
|
49278
|
+
"../cli/src/lib/question-ops.ts"() {
|
|
49279
|
+
"use strict";
|
|
49280
|
+
QUESTION_EDIT_LIMITS = { operations: 50, text: 4e3, options: 20, option: 200 };
|
|
49281
|
+
QuestionOpError = class extends Error {
|
|
49282
|
+
};
|
|
49283
|
+
}
|
|
49284
|
+
});
|
|
49285
|
+
|
|
49238
49286
|
// ../cli/src/lib/questions.ts
|
|
49239
49287
|
function newDraft(flag, value) {
|
|
49240
49288
|
const text5 = value.trim();
|
|
@@ -49289,7 +49337,7 @@ function missingChoices(text5) {
|
|
|
49289
49337
|
`"${text5}" needs choices to tick \u2014 add 2 or more --option "a \u2014 why". The user always gets a free-text choice too, so never write one yourself.`
|
|
49290
49338
|
);
|
|
49291
49339
|
}
|
|
49292
|
-
function readQuestionOps(typed) {
|
|
49340
|
+
function readQuestionOps(typed, compatibility = false) {
|
|
49293
49341
|
const ops = [];
|
|
49294
49342
|
for (let i = 0; i < typed.length; i++) {
|
|
49295
49343
|
const [key, value] = typed[i];
|
|
@@ -49315,71 +49363,40 @@ function readQuestionOps(typed) {
|
|
|
49315
49363
|
if (!ops.length) {
|
|
49316
49364
|
die('update-questions needs at least one op: --append ".." | --update <n> ".." | --drop n[,n...] | --clear');
|
|
49317
49365
|
}
|
|
49366
|
+
if (!compatibility && ops.length > QUESTION_EDIT_LIMITS.operations) {
|
|
49367
|
+
die(`Submit at most ${QUESTION_EDIT_LIMITS.operations} edits at a time.`);
|
|
49368
|
+
}
|
|
49318
49369
|
for (const op of ops) {
|
|
49319
49370
|
if (op.draft) {
|
|
49371
|
+
if (!compatibility) validateQuestionEdit(op.draft);
|
|
49320
49372
|
op.question = finalizeDraft(op.draft);
|
|
49321
49373
|
delete op.draft;
|
|
49322
49374
|
}
|
|
49323
49375
|
}
|
|
49324
49376
|
return ops;
|
|
49325
49377
|
}
|
|
49378
|
+
function validateQuestionEdit(draft) {
|
|
49379
|
+
const { text: text5, option, options } = QUESTION_EDIT_LIMITS;
|
|
49380
|
+
if (Buffer.byteLength(draft.question) > text5) die(`Question text must be at most ${text5} bytes.`);
|
|
49381
|
+
if (draft.options.length > options) die(`A question can have at most ${options} choices.`);
|
|
49382
|
+
if (draft.options.some((choice) => Buffer.byteLength(choice) > option)) die(`Each choice must be at most ${option} bytes.`);
|
|
49383
|
+
if (draft.recommended.length > 1) die("A question takes at most one --recommended-option.");
|
|
49384
|
+
if (draft.agent && (draft.agent.length > 64 || !AGENT_NAME.test(draft.agent))) {
|
|
49385
|
+
die("--agent must be at most 64 characters with lowercase letters or digits joined by hyphens.");
|
|
49386
|
+
}
|
|
49387
|
+
}
|
|
49326
49388
|
var init_questions = __esm({
|
|
49327
49389
|
"../cli/src/lib/questions.ts"() {
|
|
49328
49390
|
"use strict";
|
|
49329
49391
|
init_paths();
|
|
49392
|
+
init_parse3();
|
|
49393
|
+
init_question_ops();
|
|
49330
49394
|
init_question_block();
|
|
49331
49395
|
init_question_block();
|
|
49332
49396
|
init_rules();
|
|
49333
49397
|
}
|
|
49334
49398
|
});
|
|
49335
49399
|
|
|
49336
|
-
// ../cli/src/lib/question-ops.ts
|
|
49337
|
-
function questionPositions(raw, count3, flag) {
|
|
49338
|
-
const ns = String(raw).split(",").map((s) => s.trim()).filter((s) => s.length > 0).map(Number);
|
|
49339
|
-
if (ns.length === 0 || ns.some((n) => !Number.isInteger(n) || n < 1)) {
|
|
49340
|
-
throw new QuestionOpError(`--${flag} needs one or more 1-based question numbers (e.g. 1 or 1,3)`);
|
|
49341
|
-
}
|
|
49342
|
-
const over = ns.find((n) => n > count3);
|
|
49343
|
-
if (over !== void 0) throw new QuestionOpError(`the card has ${count3} open question(s) \u2014 there's no question ${over}`);
|
|
49344
|
-
return ns;
|
|
49345
|
-
}
|
|
49346
|
-
function applyQuestionOps(start, ops, asker) {
|
|
49347
|
-
let questions = [...start];
|
|
49348
|
-
const changes = [];
|
|
49349
|
-
const closed2 = [];
|
|
49350
|
-
const positions = (op, flag) => questionPositions(op.ns ?? String(op.n), questions.length, flag);
|
|
49351
|
-
for (const op of ops) {
|
|
49352
|
-
if (op.kind === "clear") {
|
|
49353
|
-
closed2.push(...questions);
|
|
49354
|
-
questions = [];
|
|
49355
|
-
changes.push("cleared");
|
|
49356
|
-
} else if (op.kind === "drop") {
|
|
49357
|
-
const ns = positions(op, "drop");
|
|
49358
|
-
closed2.push(...ns.map((n) => questions[n - 1]));
|
|
49359
|
-
questions = questions.filter((_, i) => !ns.includes(i + 1));
|
|
49360
|
-
changes.push(`dropped ${ns.join(",")}`);
|
|
49361
|
-
} else if (op.kind === "append") {
|
|
49362
|
-
const agent = op.question.agent ?? asker;
|
|
49363
|
-
questions.push(agent ? { ...op.question, agent } : op.question);
|
|
49364
|
-
changes.push("appended");
|
|
49365
|
-
} else {
|
|
49366
|
-
const [n] = positions(op, "update");
|
|
49367
|
-
const agent = op.question.agent ?? questions[n - 1].agent;
|
|
49368
|
-
questions[n - 1] = { ...op.question, ...agent ? { agent } : {} };
|
|
49369
|
-
changes.push(`rewrote ${n}`);
|
|
49370
|
-
}
|
|
49371
|
-
}
|
|
49372
|
-
return { questions, changes, closed: closed2 };
|
|
49373
|
-
}
|
|
49374
|
-
var QuestionOpError;
|
|
49375
|
-
var init_question_ops = __esm({
|
|
49376
|
-
"../cli/src/lib/question-ops.ts"() {
|
|
49377
|
-
"use strict";
|
|
49378
|
-
QuestionOpError = class extends Error {
|
|
49379
|
-
};
|
|
49380
|
-
}
|
|
49381
|
-
});
|
|
49382
|
-
|
|
49383
49400
|
// ../cli/src/lib/source.ts
|
|
49384
49401
|
function parseSourceRef(raw) {
|
|
49385
49402
|
const text5 = raw.trim();
|
|
@@ -50041,6 +50058,37 @@ var init_manifest = __esm({
|
|
|
50041
50058
|
}
|
|
50042
50059
|
});
|
|
50043
50060
|
|
|
50061
|
+
// ../artifact-sdk/src/internal/file-references.ts
|
|
50062
|
+
function splitFileReference(src) {
|
|
50063
|
+
const end2 = src.search(/[?#]/);
|
|
50064
|
+
return end2 < 0 ? [src, ""] : [src.slice(0, end2), src.slice(end2)];
|
|
50065
|
+
}
|
|
50066
|
+
function relativeFileReference(src, owner) {
|
|
50067
|
+
const parts = owner.split("/").slice(0, -1);
|
|
50068
|
+
for (const part of src.split("/")) {
|
|
50069
|
+
if (part === ".." && parts.length && parts.at(-1) !== "..") parts.pop();
|
|
50070
|
+
else if (part && part !== ".") parts.push(part);
|
|
50071
|
+
}
|
|
50072
|
+
return parts.join("/");
|
|
50073
|
+
}
|
|
50074
|
+
var CSS, fileManifest;
|
|
50075
|
+
var init_file_references = __esm({
|
|
50076
|
+
"../artifact-sdk/src/internal/file-references.ts"() {
|
|
50077
|
+
"use strict";
|
|
50078
|
+
init_manifest();
|
|
50079
|
+
CSS = {
|
|
50080
|
+
name: "css",
|
|
50081
|
+
types: ["css"],
|
|
50082
|
+
references: [
|
|
50083
|
+
{ text: `@import\\s+["']([^"']+)["']` },
|
|
50084
|
+
{ text: `url\\(\\s*["']?([^"')]+?)["']?\\s*\\)` }
|
|
50085
|
+
],
|
|
50086
|
+
skip: ["/\\*[\\s\\S]*?\\*/"]
|
|
50087
|
+
};
|
|
50088
|
+
fileManifest = (type, name) => type === "asset" && /\.css$/i.test(name) ? CSS : manifestOf(type);
|
|
50089
|
+
}
|
|
50090
|
+
});
|
|
50091
|
+
|
|
50044
50092
|
// ../artifact-sdk/src/internal/collect.ts
|
|
50045
50093
|
function collect(body, card, host2) {
|
|
50046
50094
|
return collectSources(bodyReferences(body), card, host2);
|
|
@@ -50050,7 +50098,7 @@ function collectSources(sources2, card, host2) {
|
|
|
50050
50098
|
const active3 = /* @__PURE__ */ new Set();
|
|
50051
50099
|
const out = [];
|
|
50052
50100
|
const visit2 = (src, types, owner, partial2 = false) => {
|
|
50053
|
-
const path88 = src
|
|
50101
|
+
const [path88] = splitFileReference(src);
|
|
50054
50102
|
let resolved;
|
|
50055
50103
|
try {
|
|
50056
50104
|
resolved = host2.resolve(path88, owner);
|
|
@@ -50100,13 +50148,13 @@ function collectSources(sources2, card, host2) {
|
|
|
50100
50148
|
} else {
|
|
50101
50149
|
node2.kind = textKind(extOf(file2), types);
|
|
50102
50150
|
try {
|
|
50103
|
-
if (
|
|
50151
|
+
if (fileManifest(node2.kind, file2)?.references) node2.data = host2.read(file2);
|
|
50104
50152
|
} catch (error62) {
|
|
50105
50153
|
node2.problems.push({ src: file2, message: why(error62) });
|
|
50106
50154
|
}
|
|
50107
50155
|
}
|
|
50108
50156
|
node2.error = node2.problems[0]?.message;
|
|
50109
|
-
if (!node2.error) for (const ref of referencesOf(
|
|
50157
|
+
if (!node2.error) for (const ref of referencesOf(fileManifest(node2.kind, file2), node2.data)) child(ref, file2);
|
|
50110
50158
|
} else {
|
|
50111
50159
|
for (const ref of host2.retained(key, types)) child(ref, card);
|
|
50112
50160
|
}
|
|
@@ -50133,6 +50181,7 @@ var extOf, why, textKind, kindAt;
|
|
|
50133
50181
|
var init_collect = __esm({
|
|
50134
50182
|
"../artifact-sdk/src/internal/collect.ts"() {
|
|
50135
50183
|
"use strict";
|
|
50184
|
+
init_file_references();
|
|
50136
50185
|
init_manifest();
|
|
50137
50186
|
init_references();
|
|
50138
50187
|
extOf = (file2) => /\.[^./\\]+$/.exec(file2)?.[0].toLowerCase() ?? "";
|
|
@@ -50930,14 +50979,16 @@ function cmdUpdate(id2, flags) {
|
|
|
50930
50979
|
return { id: id2, changes, file: rel(dest) };
|
|
50931
50980
|
}
|
|
50932
50981
|
function cmdUpdateQuestions(id2, input2) {
|
|
50933
|
-
|
|
50982
|
+
return updateCardQuestions(id2, readQuestionOps(input2.ops ?? [], true), true);
|
|
50983
|
+
}
|
|
50984
|
+
function updateCardQuestions(id2, ops, compatibility = false) {
|
|
50934
50985
|
const found2 = locate(id2);
|
|
50935
50986
|
if (!found2) die(`no task with id ${id2} under ${rel(TODO)}`, { kind: "card-not-found", id: id2 });
|
|
50936
50987
|
const file2 = found2.kind === "group" ? path57.join(found2.target, "root.md") : found2.target;
|
|
50937
50988
|
const { meta: meta3, body } = parseFrontmatter(fs52.readFileSync(file2, "utf8"));
|
|
50938
50989
|
if (!meta3) die(`${rel(file2)} has no frontmatter \u2014 recreate it with \`akb raw create\``);
|
|
50939
50990
|
for (const op of ops) {
|
|
50940
|
-
if (!op.question?.agent) continue;
|
|
50991
|
+
if (!compatibility || !op.question?.agent) continue;
|
|
50941
50992
|
const agent = findSpecAgent(op.question.agent);
|
|
50942
50993
|
if (!agent) die(`--agent "${op.question.agent}" is not an agent on this board`, { kind: "no-such-spec-agent", specAgent: op.question.agent });
|
|
50943
50994
|
op.question.agent = agent.name;
|
|
@@ -51633,7 +51684,7 @@ next \u2014 what the script can't do:
|
|
|
51633
51684
|
}
|
|
51634
51685
|
if (mentions.some((m) => m.where !== "body")) {
|
|
51635
51686
|
say(" A mention in frontmatter is the script's to rewrite, not yours:");
|
|
51636
|
-
say(' `update-questions <
|
|
51687
|
+
say(' `akb task update-questions <task> --update <n> "..."` (see help).');
|
|
51637
51688
|
}
|
|
51638
51689
|
return note;
|
|
51639
51690
|
}
|
|
@@ -56470,6 +56521,19 @@ var init_board_conflicts2 = __esm({
|
|
|
56470
56521
|
}
|
|
56471
56522
|
});
|
|
56472
56523
|
|
|
56524
|
+
// ../cli/src/lib/cli/question-options.ts
|
|
56525
|
+
function withQuestionOptions(command, ops) {
|
|
56526
|
+
const inOrder = ordered(ops);
|
|
56527
|
+
return command.option("--append <text>", "append a new question", inOrder("append")).option("--update <n> <text...>", "rewrite question <n>", inOrder("update")).option("--drop <positions>", "remove questions, e.g. 1 or 1,3", inOrder("drop")).option("--clear", "remove every open question", inOrder("clear")).option("--option <text>", "a choice for the preceding append or update", inOrder("option")).option("--recommended-option <text>", "a choice selected by default", inOrder("recommended-option")).option("--mode <mode>", "single (default) or multi", inOrder("mode")).addOption(new Option("--agent <name>").hideHelp().argParser(inOrder("agent")));
|
|
56528
|
+
}
|
|
56529
|
+
var init_question_options = __esm({
|
|
56530
|
+
"../cli/src/lib/cli/question-options.ts"() {
|
|
56531
|
+
"use strict";
|
|
56532
|
+
init_esm();
|
|
56533
|
+
init_shared2();
|
|
56534
|
+
}
|
|
56535
|
+
});
|
|
56536
|
+
|
|
56473
56537
|
// ../cli/src/lib/cli/board.ts
|
|
56474
56538
|
var board_exports = {};
|
|
56475
56539
|
__export(board_exports, {
|
|
@@ -56619,10 +56683,7 @@ function buildBoardProgram(cli) {
|
|
|
56619
56683
|
await dispatch("update", this, [String(id2)], this.opts(), cli);
|
|
56620
56684
|
});
|
|
56621
56685
|
const questionOps = [];
|
|
56622
|
-
|
|
56623
|
-
move("update-questions").argument("<id>", ID, cardId).summary("patch a card's open questions: append, rewrite, drop, skip, or clear").description(
|
|
56624
|
-
"Patch the open-question list in place. Ops apply in the order they were typed, and a position is read against the list as it stands when its op runs. Positions are 1-based. A question handed to the user always carries choices to tick \u2014 follow `akb guide update-questions`. --option, --recommended-option and --mode attach to the --append or --update before them."
|
|
56625
|
-
).option("--append <text>", "add one question to the end", opInOrder("append")).option("--update <n> <text...>", "rewrite question <n> whole", opInOrder("update")).option("--drop <positions>", "remove answered questions, e.g. 1 or 1,3", opInOrder("drop")).option("--clear", "remove every open question", opInOrder("clear")).option("--option <text>", "a choice for the op before it", opInOrder("option")).option("--recommended-option <text>", "a choice for the op before it, ticked to start", opInOrder("recommended-option")).option("--mode <mode>", "how many choices the op before it takes: single | multi", opInOrder("mode")).addOption(new Option("--agent <name>").hideHelp().argParser(opInOrder("agent"))).action(async function(id2) {
|
|
56686
|
+
withQuestionOptions(withShared(program2.command("update-questions", { hidden: true })).argument("<id>", ID, cardId).summary("edit open questions on a local card (compatibility)").description("For older Runner instructions. Use akb task update-questions.\nSee akb guide update-questions."), questionOps).action(async function(id2) {
|
|
56626
56687
|
await dispatch("update-questions", this, [String(id2)], { ops: questionOps }, cli);
|
|
56627
56688
|
});
|
|
56628
56689
|
move("inspect").argument("<id>", ID, cardId).summary("read task facts, saved work and execution references").action(async function(id2) {
|
|
@@ -56700,6 +56761,7 @@ var init_board2 = __esm({
|
|
|
56700
56761
|
init_agent2();
|
|
56701
56762
|
init_board_conflicts();
|
|
56702
56763
|
init_board_conflicts2();
|
|
56764
|
+
init_question_options();
|
|
56703
56765
|
ID = "the card's id";
|
|
56704
56766
|
}
|
|
56705
56767
|
});
|
|
@@ -57498,13 +57560,43 @@ async function taskApprove(id2, comment, opts = {}, location = {}) {
|
|
|
57498
57560
|
}
|
|
57499
57561
|
async function taskUpdateQuestions(id2, typed, location = {}) {
|
|
57500
57562
|
const ops = readQuestionOps(typed);
|
|
57563
|
+
const current = executionOf() ? workspaceTask() : null;
|
|
57501
57564
|
const ref = await taskRef(id2, location);
|
|
57502
|
-
const
|
|
57503
|
-
const
|
|
57565
|
+
const selected = current && !ref.startsWith("task_") ? requireTask(await cloud("GET", `/v1/tasks/${enc(ref)}`)) : null;
|
|
57566
|
+
const target = selected?.id ?? ref;
|
|
57567
|
+
if (current && target === current) {
|
|
57568
|
+
const board2 = runnerTaskBoard(location);
|
|
57569
|
+
const unavailable = () => refuse3("Cannot find the current task\u2019s local card on its Runner board.", "local_card_unavailable");
|
|
57570
|
+
if (!board2) return unavailable();
|
|
57571
|
+
return withSyncLock(board2, async () => {
|
|
57572
|
+
const project2 = runnerProject(board2);
|
|
57573
|
+
const mapped = localTaskRecord(board2, current);
|
|
57574
|
+
if (!mapped || !project2 || selected && (selected.project !== project2 || numberOf(selected.key) !== mapped.number)) {
|
|
57575
|
+
return unavailable();
|
|
57576
|
+
}
|
|
57577
|
+
const root2 = projectRootOf(board2);
|
|
57578
|
+
useBoard({ board: board2, root: root2, named: true }, false, true);
|
|
57579
|
+
return withBoardLock(() => {
|
|
57580
|
+
const run3 = insideRun();
|
|
57581
|
+
const runCard = run3 ? peekRun(run3)?.cardId : null;
|
|
57582
|
+
if (runCard != null && runCard !== mapped.number || !fs70.existsSync(path73.join(board2, "todo")) || !locate(mapped.number)) {
|
|
57583
|
+
return unavailable();
|
|
57584
|
+
}
|
|
57585
|
+
return updateCardQuestions(mapped.number, ops);
|
|
57586
|
+
});
|
|
57587
|
+
});
|
|
57588
|
+
}
|
|
57589
|
+
const card = requireResponse(
|
|
57590
|
+
await cloud("GET", `/v1/tasks/${enc(target)}/card`),
|
|
57591
|
+
"the card body and version",
|
|
57592
|
+
(value) => hasText(value.body) && Number.isSafeInteger(value.version) && value.version >= 0
|
|
57593
|
+
);
|
|
57594
|
+
const meta3 = parseFrontmatter(card.body).meta;
|
|
57595
|
+
if (!meta3) return refuse3("The card has no frontmatter.", "bad_request");
|
|
57504
57596
|
let changes;
|
|
57505
57597
|
let open4;
|
|
57506
57598
|
try {
|
|
57507
|
-
const done = applyQuestionOps(questions, ops);
|
|
57599
|
+
const done = applyQuestionOps(meta3.questions, ops);
|
|
57508
57600
|
changes = done.changes;
|
|
57509
57601
|
open4 = done.questions.length;
|
|
57510
57602
|
} catch (e) {
|
|
@@ -57516,21 +57608,26 @@ async function taskUpdateQuestions(id2, typed, location = {}) {
|
|
|
57516
57608
|
if (op.kind === "append") return { append: q };
|
|
57517
57609
|
if (op.kind === "update") return { update: op.n, question: q };
|
|
57518
57610
|
if (op.kind === "drop") return { drop: questionPositions(op.ns, Infinity, "drop") };
|
|
57519
|
-
|
|
57520
|
-
return die(`akb task update-questions has no --${op.kind}; --drop removes a question`);
|
|
57611
|
+
return { clear: true };
|
|
57521
57612
|
});
|
|
57522
|
-
const task = await cloud("PATCH", `/v1/tasks/${enc(
|
|
57613
|
+
const task = await cloud("PATCH", `/v1/tasks/${enc(target)}/questions`, { base_version: card.version, ops: body });
|
|
57523
57614
|
say(`updated ${task.key} questions: ${changes.join(", ")} (${open4} open)`);
|
|
57524
57615
|
return { ...task, changes, open: open4 };
|
|
57525
57616
|
}
|
|
57526
|
-
function
|
|
57527
|
-
const task = workspaceTask();
|
|
57617
|
+
function runnerTaskBoard(location) {
|
|
57528
57618
|
const runnerBoard = process.env.AI4KANBAN_BOARD?.trim();
|
|
57529
|
-
if (!
|
|
57619
|
+
if (!runnerBoard) return null;
|
|
57530
57620
|
const cwd = location.cwd ?? process.cwd();
|
|
57531
|
-
const board2 = path73.resolve(cwd, location.board ?? runnerBoard);
|
|
57532
57621
|
try {
|
|
57533
|
-
|
|
57622
|
+
const board2 = path73.resolve(cwd, location.board ?? runnerBoard);
|
|
57623
|
+
return fs70.realpathSync(board2) === fs70.realpathSync(path73.resolve(cwd, runnerBoard)) && runnerProject(board2) ? board2 : null;
|
|
57624
|
+
} catch {
|
|
57625
|
+
return null;
|
|
57626
|
+
}
|
|
57627
|
+
}
|
|
57628
|
+
function localTaskRecord(board2, task) {
|
|
57629
|
+
if (!/^task_[\w-]+$/.test(task)) return null;
|
|
57630
|
+
try {
|
|
57534
57631
|
const record2 = JSON.parse(fs70.readFileSync(path73.join(board2, ".sync", task + ".json"), "utf8"));
|
|
57535
57632
|
if (record2.task === task && Number.isSafeInteger(record2.number) && record2.number > 0 && !record2.deleted) {
|
|
57536
57633
|
return { board: board2, task, number: record2.number };
|
|
@@ -57539,6 +57636,12 @@ function localTaskTarget(location) {
|
|
|
57539
57636
|
}
|
|
57540
57637
|
return null;
|
|
57541
57638
|
}
|
|
57639
|
+
function localTaskTarget(location) {
|
|
57640
|
+
const task = workspaceTask();
|
|
57641
|
+
if (!task || !executionOf()) return null;
|
|
57642
|
+
const board2 = runnerTaskBoard(location);
|
|
57643
|
+
return board2 ? localTaskRecord(board2, task) : null;
|
|
57644
|
+
}
|
|
57542
57645
|
function linkedBoard(location) {
|
|
57543
57646
|
const cwd = location.cwd ?? process.cwd();
|
|
57544
57647
|
const named2 = location.board ?? process.env.AI4KANBAN_BOARD;
|
|
@@ -57735,6 +57838,7 @@ var init_task = __esm({
|
|
|
57735
57838
|
init_board_files();
|
|
57736
57839
|
init_board_conflicts();
|
|
57737
57840
|
init_remove();
|
|
57841
|
+
init_card();
|
|
57738
57842
|
init_io();
|
|
57739
57843
|
init_response();
|
|
57740
57844
|
init_paths();
|
|
@@ -62783,7 +62887,7 @@ var init_archive2 = __esm({
|
|
|
62783
62887
|
var board_default;
|
|
62784
62888
|
var init_board3 = __esm({
|
|
62785
62889
|
"../cli/src/guide/board.md"() {
|
|
62786
|
-
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/ `studios/<studio>.md` \u2014 Studio notes, set with `akb studio rule`\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 raw 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\n`akb raw update`, `update-questions` and `akb raw conflict resolve` manage
|
|
62890
|
+
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/ `studios/<studio>.md` \u2014 Studio notes, set with `akb studio rule`\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 raw 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\n`akb raw update`, `akb task update-questions` and `akb raw conflict resolve` manage a card's frontmatter,\nincluding its `previews`. Edit only the card's **body** by hand. `akb raw help`\nlists all operations; `akb raw help <move>` explains one operation.\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\nContinue from the task's saved discussion, results and approved requirements. Follow explicit\nproject and Studio rules. Read relevant memory on demand; do not write memory in task runs.\n";
|
|
62787
62891
|
}
|
|
62788
62892
|
});
|
|
62789
62893
|
|
|
@@ -62791,7 +62895,7 @@ var init_board3 = __esm({
|
|
|
62791
62895
|
var card_chat_default;
|
|
62792
62896
|
var init_card_chat = __esm({
|
|
62793
62897
|
"../cli/src/guide/card-chat.md"() {
|
|
62794
|
-
card_chat_default = '# Answer a card\'s conversation\n\nRead the task\u2019s review plan and work only on unlocked stages. An empty plan needs no extra approval; an undecided plan allows planning only.\n\n- **Where the task stands**: read `akb task show <id>` and `akb task review <id>`.\n- **Button labels**: name actions by their labels on the page, in the user\'s language: "Approve" or "Approve, start \u2026" (\u6279\u51C6 / \u6279\u51C6\uFF0C\u5F00\u59CB\u2026), "Resume" (\u7EED\u8DD1), "Start again" (\u91CD\u65B0\u53D1\u8D77).\n\n- **Change requirements or drafts**: when the user changes the scope, expected behavior, or draft, use `akb raw card revise <id> --print "<change>"`.\n- **Record an answer**: when the user answers an open question on the card, use `akb raw card resolve <id> --print`.\n- **Manage open questions**: when a decision needs the user\'s input, follow `akb guide update-questions` and use `akb
|
|
62898
|
+
card_chat_default = '# Answer a card\'s conversation\n\nRead the task\u2019s review plan and work only on unlocked stages. An empty plan needs no extra approval; an undecided plan allows planning only.\n\n- **Where the task stands**: read `akb task show <id>` and `akb task review <id>`.\n- **Button labels**: name actions by their labels on the page, in the user\'s language: "Approve" or "Approve, start \u2026" (\u6279\u51C6 / \u6279\u51C6\uFF0C\u5F00\u59CB\u2026), "Resume" (\u7EED\u8DD1), "Start again" (\u91CD\u65B0\u53D1\u8D77).\n\n- **Change requirements or drafts**: when the user changes the scope, expected behavior, or draft, use `akb raw card revise <id> --print "<change>"`.\n- **Record an answer**: when the user answers an open question on the card, use `akb raw card resolve <id> --print`.\n- **Manage open questions**: when a decision needs the user\'s input, follow `akb guide update-questions` and use `akb task update-questions <task>` to edit the question list.\n- **Change card fields**: when the user changes metadata such as priority, modules, or dependencies, use `akb raw update <id>`.\n- **Previews**: prepare or revise only requested outputs, using the task-bound Studio\u2019s Preview instructions and supplied component documentation. Before changing approved output, invalidate its stage with `akb task review <id> --revise-from <stage> --revision <n>`. Preserve unrelated work.\n- **Create a separate task**: when the user asks to capture work unrelated to this card, follow `akb guide add-task`.\n- **Split this card**: when the user asks to break this card\'s outcome into subtasks, follow the group procedure in `akb guide add-task`.\n- **Change a studio**: use `akb guide update-studio` for shared Studio instructions; a correction to this card\'s draft alone stays on this card.\n- **Check card edits**: after writing a card, run `akb raw validate <id>` and fix what it reports.\n- **Anything else**: for a request this guide does not cover, read `akb help` once, then the matching command\'s `--help`.\n\nReply in plain, natural language. Do not write memory, including through any flow this conversation starts.\n\n- **Approve**: only on an explicit request, use `akb task approve <id> --stage <stage> --revision <reviewed revision>`. In a reply this commits after successful synchronization. Finish the reply without further edits or waiting. Never substitute the latest revision for the one reviewed.\n- **Change the plan**: submit a complete replacement with `akb task review <id> --file <json> --revision <n>`. It takes effect immediately. Answers to questions never approve work.\n';
|
|
62795
62899
|
}
|
|
62796
62900
|
});
|
|
62797
62901
|
|
|
@@ -62831,7 +62935,7 @@ var init_follow_up = __esm({
|
|
|
62831
62935
|
var implement_default;
|
|
62832
62936
|
var init_implement = __esm({
|
|
62833
62937
|
"../cli/src/guide/implement.md"() {
|
|
62834
|
-
implement_default = "# Implement the approved requirements\n\nBuild the approved requirements without reopening settled decisions or unrelated questions; without a card, create none.\n\nFor Git deliveries, adapt the approved work to the current target branch and preserve its\nbehavior and removals unless the task's core intent requires changing them. Stop the\naffected work and use `akb guide update-questions` only if those changes conflict with the\ntask's core intent.\n\nDo not push, publish or deploy.\n\nOnce a task meets its Studio's delivery conditions, follow `akb guide archive` to record\ndelivery completion before ending the run.\n\n- **Verification**: run required and minimal representative checks, reuse valid results, distinguish defects from environment or tool limits, stop retries that add no evidence, and finish when acceptance is proven.\n- **Authorization**: carry approval for necessary in-scope operations across tools and stages without asking again.\n- **Blockers**: resolve routine problems and use `akb guide update-questions` only for user-action blockers or out-of-scope decisions, stating attempts, impact and recommendation while continuing independent work.\n- **Defer**: follow `akb guide follow-up` for unrelated work and keep it from blocking delivery.\n- **Decisions**: record material, reversible build decisions under `## Worth noting after implementation`.\n";
|
|
62938
|
+
implement_default = "# Implement the approved requirements\n\nBuild the approved requirements without reopening settled decisions or unrelated questions; without a card, create none.\n\nBefore implementing a Cloud task, read its recent chat with `akb task chat <task>`.\nRead older messages as needed. Use relevant clarifications within the scope of\nthe current card and approved plan.\n\nFor Git deliveries, adapt the approved work to the current target branch and preserve its\nbehavior and removals unless the task's core intent requires changing them. Stop the\naffected work and use `akb guide update-questions` only if those changes conflict with the\ntask's core intent.\n\nDo not push, publish or deploy.\n\nOnce a task meets its Studio's delivery conditions, follow `akb guide archive` to record\ndelivery completion before ending the run.\n\n- **Verification**: run required and minimal representative checks, reuse valid results, distinguish defects from environment or tool limits, stop retries that add no evidence, and finish when acceptance is proven.\n- **Authorization**: carry approval for necessary in-scope operations across tools and stages without asking again.\n- **Blockers**: resolve routine problems and use `akb guide update-questions` only for user-action blockers or out-of-scope decisions, stating attempts, impact and recommendation while continuing independent work.\n- **Defer**: follow `akb guide follow-up` for unrelated work and keep it from blocking delivery.\n- **Decisions**: record material, reversible build decisions under `## Worth noting after implementation`.\n";
|
|
62835
62939
|
}
|
|
62836
62940
|
});
|
|
62837
62941
|
|
|
@@ -62887,7 +62991,7 @@ var init_reflect = __esm({
|
|
|
62887
62991
|
var resolve_default;
|
|
62888
62992
|
var init_resolve2 = __esm({
|
|
62889
62993
|
"../cli/src/guide/resolve.md"() {
|
|
62890
|
-
resolve_default = '# Resolve questions\n\nApply the answers the user supplied to existing open questions. Leave every unanswered\nquestion unchanged. While applying answers, do not research, choose for the user, raise\nanother question, or change project code.\n\n## Apply each answer\n\n1. Match each supplied answer to its open question. If the answer is missing or unclear,\n leave that question open.\n2. Follow `akb guide writing`. Merge the answer into the existing decision, keep only the\n selected choice, remove obsolete or contradictory text, preserve completed work, and add\n newly required work as unchecked todos. When the answer changes an agent\'s section, read\n that agent\'s rules first, as "Preview ownership" there says.\
|
|
62994
|
+
resolve_default = '# Resolve questions\n\nApply the answers the user supplied to existing open questions. Leave every unanswered\nquestion unchanged. While applying answers, do not research, choose for the user, raise\nanother question, or change project code.\n\n## Apply each answer\n\n1. Match each supplied answer to its open question. If the answer is missing or unclear,\n leave that question open.\n2. Follow `akb guide writing`. Merge the answer into the existing decision, keep only the\n selected choice, remove obsolete or contradictory text, preserve completed work, and add\n newly required work as unchecked todos. When the answer changes an agent\'s section, read\n that agent\'s rules first, as "Preview ownership" there says.\n\nWhen an answer accepts a step the user was asked to review and asks for no changes, tick that\nstep\'s review todo; an answer asking for changes leaves it unticked.\n\nWhen an answer chooses to discard the card, first run `akb raw delivery cancel <delivery>` if a\ndelivery is in flight, then `akb task remove <id> "<why>" --discard`, and stop. Skip every\nremaining step of this guide.\n\nWhen an answer sends an agent\'s (`agent:`) section back for rework that the user must confirm\nagain, keep or `--update` the question instead of dropping it. Once no question is left for\nthat agent, request each matching agent listed below it whose section is missing or says it\nis waiting.\n\nWhen an answer selects one of several options in a Preview block, remove the rejected\noptions and their spec-tmp files.\n\n## Say what the answers did to a build in flight\n\nA delivery builds the card as it was approved when it started, and applying answers is the\nonly thing that rewrites that card underneath it. You read the question and you wrote the\nanswer, so you are the only one who can tell a confirmation from a change \u2014 the board reads\nyour conclusion and never the card\'s text.\n\n```text\nakb raw delivery answered <delivery> --unchanged "<why>"\nakb raw delivery answered <delivery> --changed "<why>"\n```\n\n- **Record it before you drop the questions**: dropping the last one is what puts the board\n back in motion, and until the conclusion is written the build does not land.\n- **Judge the meaning, not the words**: confirming an option that is already built, writing\n down a decision the card already carries, and tidying prose are all `--unchanged`.\n Adding, dropping or changing a requirement is `--changed`.\n- **A wrong implementation confirmed is still a change**: an answer that blesses work\n contradicting the approved copy is `--changed`, however finished that work is.\n- **One conclusion per round**: it covers every answer you applied in this session. The\n delivery a `--changed` reopens starts on the card as it then reads, with none of its own.\n\n`akb raw card implement <id> --print` prints the delivery\'s id and the copy it is building.\nNothing to record when no delivery is in flight.\n\n## Curate the human half\n\nPut each answer `akb guide writing` places in `Worth noting` in that section; put other\nnecessary lasting decisions below the boundary.\n\nRe-read the whole human half against the same rule. Remove or move down entries that\nfail it, repeat scope, or overlap another entry. Merge entries governed by one decision. One to\nthree independent items is normal; every additional item needs distinct user-facing stakes.\n\n## Close the answered questions\n\nSave the body and any delivery conclusion first. Drop only the questions whose answers\nare fully applied. Runner synchronizes the updated body and question list together.\n\n```text\nakb task update-questions <task> --drop <n[,n...]>\n```\n\n## Refine\n\nIf any question remains open, stop and leave the card waiting. When a delivery is in flight,\nnever refine \u2014 even if `--changed` updated requirements, execution resumes directly from the\nupdated card.\n\nOnce no question is left and no delivery is building the card, refine it in this session by\n`akb guide refine`, which decides readiness:\n\n- **Partial**: when the card was refined before, revisit only what the answers changed.\n- **Full**: when the answers reshape the card or its `## Scope` is still the creation scaffold.\n';
|
|
62891
62995
|
}
|
|
62892
62996
|
});
|
|
62893
62997
|
|
|
@@ -62911,7 +63015,7 @@ var init_revise = __esm({
|
|
|
62911
63015
|
var update_questions_default;
|
|
62912
63016
|
var init_update_questions = __esm({
|
|
62913
63017
|
"../cli/src/guide/update-questions.md"() {
|
|
62914
|
-
update_questions_default = '# Decide what to ask the user\n\nA decision is a choice the work needs made. A question is a decision handed to the user:\nproject evidence cannot settle it, it materially affects what the user gets, and it has at\nleast two coherent options.\n\n### The material-decision test\n\nAsk when the tradeoff materially changes the delivered result, the accepted scope, the user\'s\nrisk, or a meaningful ongoing cost, and a reasonable reviewer may reject it; a studio\'s rules\nadd what else counts. Settle everything else yourself. Leave the question open and stop only\nthe work that depends on it. An obstacle only the user can clear is a question too: say what\ncannot proceed and offer ways forward.\n\n- **Write for users**: each option\'s outcome and main cost, your recommendation ticked; no\n card ids, agent names, or board jargon.\n- **Options**: exclusive unless they genuinely combine (`--mode multi`); never write an\n "other" option, the user always gets one.\n- **Not a question**: where a fix goes (`akb guide follow-up`).\n\n```text\nakb
|
|
63018
|
+
update_questions_default = '# Decide what to ask the user\n\nA decision is a choice the work needs made. A question is a decision handed to the user:\nproject evidence cannot settle it, it materially affects what the user gets, and it has at\nleast two coherent options.\n\n### The material-decision test\n\nAsk when the tradeoff materially changes the delivered result, the accepted scope, the user\'s\nrisk, or a meaningful ongoing cost, and a reasonable reviewer may reject it; a studio\'s rules\nadd what else counts. Settle everything else yourself. Leave the question open and stop only\nthe work that depends on it. An obstacle only the user can clear is a question too: say what\ncannot proceed and offer ways forward.\n\n- **Write for users**: each option\'s outcome and main cost, your recommendation ticked; no\n card ids, agent names, or board jargon.\n- **Options**: exclusive unless they genuinely combine (`--mode multi`); never write an\n "other" option, the user always gets one.\n- **Not a question**: where a fix goes (`akb guide follow-up`).\n\n```text\nakb task update-questions <task> \\\n --append "Which behavior should apply?" \\\n --recommended-option "A \u2014 outcome and cost" \\\n --option "B \u2014 outcome and cost"\n```\n\nUse the current task\'s key, ID, or project number. Runner saves the current card locally\nand synchronizes it with the rest of the card. For a Cloud version conflict, read the card\nagain and check the question positions before resubmitting.\n';
|
|
62915
63019
|
}
|
|
62916
63020
|
});
|
|
62917
63021
|
|
|
@@ -62943,7 +63047,7 @@ var init_write_prompt = __esm({
|
|
|
62943
63047
|
var writing_default;
|
|
62944
63048
|
var init_writing = __esm({
|
|
62945
63049
|
"../cli/src/guide/writing.md"() {
|
|
62946
|
-
writing_default = '# Write a card\n\nA card has a **human half** for review and a folded **agent half** for implementation.\nUse this order and keep the English section titles and empty scaffold sections:\n\n```text\n<One short paragraph: the problem and the intended result.>\n\n## Worth noting <- user\'s answers first, then material decisions; empty if none\n- **<decision>**: <chosen behavior and main cost in one sentence>\n\n## Worth noting after implementation\n- **<decision>**: <chosen behavior and main cost in one sentence>\n <- settled by the build; omit when empty; no logs or open questions\n\n<Preview id="<id>"> <- requested deliverable\n<result Markdown and assets>\n</Preview>\n\n<!-- agent --> <- folded content starts here\n\n## Scope <- requirements, not rationale\n### Done when <- acceptance checklist, when supplied\n- [ ] <observable result>\n\n## Todo <- implementation only; finish planning before writing steps\n- [ ] <one build step>\n\n## Decided by the agent <- other decisions and non-obvious findings the build needs\n- **<decision>**: <answer and required action>\n### Overruled by the user <- superseded decisions, always last\n```\n\n- **Decisions**: use the material-decision test in `akb guide update-questions` for Worth noting;\n merge entries governed by one policy and keep only the decision and its main cost.\n- **Delivery boundary**: Worth noting after implementation never changes approved scope or\n blocks an ongoing delivery; the build must fix deviations or refer them to the user.\n- **Preview sections**: use matching Preview tags and a stable Studio ID; keep the ID when revising.\n The app supplies localized titles and icons. Group files of one deliverable with Set.\n- **Previews**: read the relevant Studio `<Preview>` block and needed references before revising\n its section and assets in place.\n- **Preview presentation**: at every review point, show the deliverable directly; omit surrounding\n introductions, summaries and notes unless requested or needed for review, keeping necessary\n context brief and stating it once.\n- **Preserve work**: leave checked todos and supplied Done when checklists unchanged; append a\n todo to reverse completed work, and move user-overruled decisions to Overruled by the user\n until the card leaves no room to repeat them.\n- **Writing**: write clear behavior and necessary tradeoffs for a fresh reader, keep the human\n half self-contained, and state each fact once.\n- **Agent half**: keep only implementation-critical information not stated elsewhere; omit\n process logs and routine implementation planning, and leave unneeded sections empty.\n- **Frontmatter**: never edit frontmatter by hand; use `akb raw update` or `update-questions`.\n- **Validate**: run `akb raw validate <id>` after edits and fix every reported file and line.\n';
|
|
63050
|
+
writing_default = '# Write a card\n\nA card has a **human half** for review and a folded **agent half** for implementation.\nUse this order and keep the English section titles and empty scaffold sections:\n\n```text\n<One short paragraph: the problem and the intended result.>\n\n## Worth noting <- user\'s answers first, then material decisions; empty if none\n- **<decision>**: <chosen behavior and main cost in one sentence>\n\n## Worth noting after implementation\n- **<decision>**: <chosen behavior and main cost in one sentence>\n <- settled by the build; omit when empty; no logs or open questions\n\n<Preview id="<id>"> <- requested deliverable\n<result Markdown and assets>\n</Preview>\n\n<!-- agent --> <- folded content starts here\n\n## Scope <- requirements, not rationale\n### Done when <- acceptance checklist, when supplied\n- [ ] <observable result>\n\n## Todo <- implementation only; finish planning before writing steps\n- [ ] <one build step>\n\n## Decided by the agent <- other decisions and non-obvious findings the build needs\n- **<decision>**: <answer and required action>\n### Overruled by the user <- superseded decisions, always last\n```\n\n- **Decisions**: use the material-decision test in `akb guide update-questions` for Worth noting;\n merge entries governed by one policy and keep only the decision and its main cost.\n- **Delivery boundary**: Worth noting after implementation never changes approved scope or\n blocks an ongoing delivery; the build must fix deviations or refer them to the user.\n- **Preview sections**: use matching Preview tags and a stable Studio ID; keep the ID when revising.\n The app supplies localized titles and icons. Group files of one deliverable with Set.\n- **Previews**: read the relevant Studio `<Preview>` block and needed references before revising\n its section and assets in place.\n- **Preview presentation**: at every review point, show the deliverable directly; omit surrounding\n introductions, summaries and notes unless requested or needed for review, keeping necessary\n context brief and stating it once.\n- **Preserve work**: leave checked todos and supplied Done when checklists unchanged; append a\n todo to reverse completed work, and move user-overruled decisions to Overruled by the user\n until the card leaves no room to repeat them.\n- **Writing**: write clear behavior and necessary tradeoffs for a fresh reader, keep the human\n half self-contained, and state each fact once.\n- **Agent half**: keep only implementation-critical information not stated elsewhere; omit\n process logs and routine implementation planning, and leave unneeded sections empty.\n- **Frontmatter**: never edit frontmatter by hand; use `akb raw update` or `akb task update-questions`.\n- **Validate**: run `akb raw validate <id>` after edits and fix every reported file and line.\n';
|
|
62947
63051
|
}
|
|
62948
63052
|
});
|
|
62949
63053
|
|
|
@@ -63372,6 +63476,11 @@ var init_progress = __esm({
|
|
|
63372
63476
|
|
|
63373
63477
|
// ../cli/src/lib/agent/complete.ts
|
|
63374
63478
|
import fs76 from "node:fs";
|
|
63479
|
+
function checkRecordedResult(receipt, commit, branch) {
|
|
63480
|
+
if (receipt.commit === commit && receipt.branch === branch) return;
|
|
63481
|
+
const describe4 = (hash3, target) => hash3 ? `${hash3} on ${target}` : "no Git result";
|
|
63482
|
+
throw new Error(`This step already recorded a different result. Recorded: ${describe4(receipt.commit, receipt.branch)}. Reported: ${describe4(commit, branch)}.`);
|
|
63483
|
+
}
|
|
63375
63484
|
function completeDelivery(named2, result = {}) {
|
|
63376
63485
|
const commit = result.commit?.toLowerCase();
|
|
63377
63486
|
const branch = result.branch;
|
|
@@ -63400,7 +63509,7 @@ function completeDelivery(named2, result = {}) {
|
|
|
63400
63509
|
const pending = receipts[deliveryStep(delivery2)];
|
|
63401
63510
|
const previous = receipts.find((c) => c.sessionId === sessionId || c.resumedSessions?.includes(sessionId));
|
|
63402
63511
|
if (previous) {
|
|
63403
|
-
|
|
63512
|
+
checkRecordedResult(previous, commit, branch);
|
|
63404
63513
|
if (!previous.finished && previous.step === deliveryStep(delivery2) && (delivery2.status !== "active" || run3 !== current || run3.status !== "running")) {
|
|
63405
63514
|
throw new Error("Only the current owning run can finish pending completion.");
|
|
63406
63515
|
}
|
|
@@ -63411,7 +63520,7 @@ function completeDelivery(named2, result = {}) {
|
|
|
63411
63520
|
}
|
|
63412
63521
|
if (answerOutcome(delivery2) === "changed") throw new Error("The approved requirements were superseded. Continue with the updated delivery.");
|
|
63413
63522
|
if (pending && run3 === current) {
|
|
63414
|
-
|
|
63523
|
+
checkRecordedResult(pending, commit, branch);
|
|
63415
63524
|
pending.resumedSessions = [...pending.resumedSessions ?? [], sessionId];
|
|
63416
63525
|
return { delivery: delivery2, receipt: pending };
|
|
63417
63526
|
}
|
|
@@ -64425,13 +64534,32 @@ var init_coding_previews = __esm({
|
|
|
64425
64534
|
|
|
64426
64535
|
// ../cli/src/lib/agent/approved-ui.ts
|
|
64427
64536
|
import path81 from "node:path";
|
|
64537
|
+
function approvedUiSource(pins, src, owner) {
|
|
64538
|
+
const [ref] = splitFileReference(src);
|
|
64539
|
+
if (artifactId.test(ref)) {
|
|
64540
|
+
const version2 = approvedUiPin(pins, ref).version;
|
|
64541
|
+
const names2 = Object.keys(pins).filter((name) => {
|
|
64542
|
+
const pin = approvedUiPin(pins, name);
|
|
64543
|
+
return pin.artifact === ref && (version2 === void 0 || pin.version === version2);
|
|
64544
|
+
});
|
|
64545
|
+
return names2.find((name) => !artifactId.test(name)) ?? names2[0] ?? ref;
|
|
64546
|
+
}
|
|
64547
|
+
const local = owner && !ref.startsWith(".assets/") ? relativeFileReference(ref, owner) : ref;
|
|
64548
|
+
return [local, src, ref, path81.posix.normalize(local)].find((key) => Object.hasOwn(pins, key)) ?? local;
|
|
64549
|
+
}
|
|
64550
|
+
function approvedUiPin(pins, source2) {
|
|
64551
|
+
return object2(Object.hasOwn(pins, source2) ? pins[source2] : void 0);
|
|
64552
|
+
}
|
|
64553
|
+
function validUiPin(pin) {
|
|
64554
|
+
return !pin.error && pin.status !== "pending" && pin.status !== "failed" && typeof pin.artifact === "string" && artifactId.test(pin.artifact) && typeof pin.version === "number" && Number.isSafeInteger(pin.version) && pin.version > 0;
|
|
64555
|
+
}
|
|
64428
64556
|
function approvedUiPreviews(review) {
|
|
64429
64557
|
if (reviewAuthorization(review).kind !== "delivery") return [];
|
|
64430
64558
|
const result = [];
|
|
64431
|
-
for (const node2 of review.plan ?? []) {
|
|
64559
|
+
for (const [index, node2] of (review.plan ?? []).entries()) {
|
|
64432
64560
|
const stage = review.stages.find((stage2) => stage2.id === node2.id);
|
|
64433
64561
|
const snapshot2 = stage?.snapshot;
|
|
64434
|
-
if (!stage || !snapshot2) continue;
|
|
64562
|
+
if (node2.kind === "work" || !stage || !snapshot2) continue;
|
|
64435
64563
|
const evidence = object2(snapshot2.evidence);
|
|
64436
64564
|
const content = object2(evidence.content);
|
|
64437
64565
|
const frozenPreviews = Array.isArray(snapshot2.previews) ? snapshot2.previews.filter(isObject2) : [];
|
|
@@ -64439,17 +64567,17 @@ function approvedUiPreviews(review) {
|
|
|
64439
64567
|
const preview = object2(content[id2]);
|
|
64440
64568
|
const body = typeof preview.body === "string" ? preview.body : typeof snapshot2.body === "string" ? parsePreviewBlocks(snapshot2.body).blocks.find((block) => block.id === id2)?.instructions : void 0;
|
|
64441
64569
|
if (!body) continue;
|
|
64442
|
-
const pins = { ...object2(frozenPreviews.find((preview2) => preview2.id === id2)?.assets), ...object2(evidence.assets) };
|
|
64570
|
+
const pins = { ...object2(evidence.dependencies), ...object2(frozenPreviews.find((preview2) => preview2.id === id2)?.assets), ...object2(evidence.assets) };
|
|
64443
64571
|
const files = /* @__PURE__ */ new Map();
|
|
64444
|
-
const add2 = (src, label2, device) => {
|
|
64445
|
-
|
|
64446
|
-
const
|
|
64447
|
-
if (
|
|
64572
|
+
const add2 = (src, label2, device, required2 = true) => {
|
|
64573
|
+
if (external.test(src)) return;
|
|
64574
|
+
const source2 = approvedUiSource(pins, src);
|
|
64575
|
+
if (!required2 && !Object.hasOwn(pins, source2) && !/\.(?:html?|tsx)$/i.test(source2)) return;
|
|
64448
64576
|
const name = label2.trim() || path81.posix.basename(src);
|
|
64449
64577
|
const key = JSON.stringify([src, name]);
|
|
64450
64578
|
let file2 = files.get(key);
|
|
64451
64579
|
if (!file2) {
|
|
64452
|
-
file2 = { src,
|
|
64580
|
+
file2 = { src, source: source2, label: name, devices: /* @__PURE__ */ new Set() };
|
|
64453
64581
|
files.set(key, file2);
|
|
64454
64582
|
}
|
|
64455
64583
|
file2.devices.add(device === "mobile" ? "Mobile" : device === "desktop" ? "Desktop" : "Device unspecified");
|
|
@@ -64469,33 +64597,53 @@ function approvedUiPreviews(review) {
|
|
|
64469
64597
|
}
|
|
64470
64598
|
}
|
|
64471
64599
|
const listed = new Set([...files.values()].map((file2) => file2.src));
|
|
64472
|
-
for (const src of bodySources(body)) if (!listed.has(src)) add2(src, "");
|
|
64473
|
-
result.push(
|
|
64600
|
+
for (const src of bodySources(body)) if (!listed.has(src)) add2(src, "", void 0, false);
|
|
64601
|
+
if (files.size) result.push({
|
|
64602
|
+
id: id2,
|
|
64603
|
+
revision: stage.revision,
|
|
64604
|
+
directory: `review-${stage.revision}-${index}/${id2}`,
|
|
64605
|
+
body,
|
|
64606
|
+
pins,
|
|
64607
|
+
files: [...files.values()]
|
|
64608
|
+
});
|
|
64474
64609
|
}
|
|
64475
64610
|
}
|
|
64476
64611
|
return result;
|
|
64477
64612
|
}
|
|
64478
|
-
function approvedUiFile(directory,
|
|
64479
|
-
const
|
|
64480
|
-
|
|
64481
|
-
|
|
64482
|
-
|
|
64483
|
-
|
|
64484
|
-
|
|
64485
|
-
|
|
64613
|
+
function approvedUiFile(directory, preview, source2) {
|
|
64614
|
+
const parts = path81.posix.normalize(splitFileReference(source2)[0]).split("/");
|
|
64615
|
+
let parents = 0;
|
|
64616
|
+
while (parts[0] === "..") {
|
|
64617
|
+
parts.shift();
|
|
64618
|
+
parents++;
|
|
64619
|
+
}
|
|
64620
|
+
const rendered = /\.tsx$/i.test(parts.at(-1) ?? "");
|
|
64621
|
+
if (rendered) parts[parts.length - 1] = parts.at(-1).replace(/\.tsx$/i, ".html");
|
|
64622
|
+
const safe2 = parts.map((part) => !part || part === "." ? "%00" : part.replace(/[\\:*?"<>|%\x00-\x1f]/g, (char) => `%${char.charCodeAt(0).toString(16).padStart(2, "0")}`));
|
|
64623
|
+
return path81.join(directory, preview.directory, `${rendered ? "rendered" : "files"}-${parents}`, ...safe2);
|
|
64624
|
+
}
|
|
64625
|
+
function approvedUiPrompt(review, directory, includeBody = false) {
|
|
64626
|
+
const previews = approvedUiPreviews(review);
|
|
64627
|
+
if (!previews.length) return "";
|
|
64486
64628
|
return [
|
|
64487
64629
|
"Approved UI previews",
|
|
64488
64630
|
APPROVED_UI_RULE,
|
|
64489
|
-
|
|
64490
|
-
|
|
64491
|
-
|
|
64492
|
-
|
|
64631
|
+
...previews.flatMap((preview) => [
|
|
64632
|
+
...includeBody ? [preview.body] : [],
|
|
64633
|
+
preview.files.flatMap((file2) => {
|
|
64634
|
+
const pin = approvedUiPin(preview.pins, file2.source);
|
|
64635
|
+
if (!validUiPin(pin)) return [];
|
|
64636
|
+
const ref = directory ? `frozen file: \`${approvedUiFile(directory, preview, file2.source)}\`` : `artifact ${pin.artifact}, version ${pin.version}`;
|
|
64637
|
+
return [`- ${file2.label} \xB7 ${[...file2.devices].join(" / ")} \xB7 Review revision ${preview.revision} \xB7 ${file2.src} \xB7 ${ref}`];
|
|
64638
|
+
}).join("\n")
|
|
64639
|
+
])
|
|
64493
64640
|
].join("\n\n");
|
|
64494
64641
|
}
|
|
64495
|
-
var APPROVED_UI_DIR_ENV, APPROVED_UI_RULE, UI_PREVIEW, historicalUiIds, object2;
|
|
64642
|
+
var APPROVED_UI_DIR_ENV, APPROVED_UI_RULE, UI_PREVIEW, historicalUiIds, object2, artifactId, external;
|
|
64496
64643
|
var init_approved_ui = __esm({
|
|
64497
64644
|
"../cli/src/lib/agent/approved-ui.ts"() {
|
|
64498
64645
|
"use strict";
|
|
64646
|
+
init_file_references();
|
|
64499
64647
|
init_references();
|
|
64500
64648
|
init_tags();
|
|
64501
64649
|
init_coding_previews();
|
|
@@ -64506,6 +64654,8 @@ var init_approved_ui = __esm({
|
|
|
64506
64654
|
UI_PREVIEW = "ui-design";
|
|
64507
64655
|
historicalUiIds = Object.keys(CODING_PREVIEWS).filter((id2) => id2 !== UI_PREVIEW && CODING_PREVIEWS[id2] === UI_PREVIEW);
|
|
64508
64656
|
object2 = (value) => isObject2(value) ? value : {};
|
|
64657
|
+
artifactId = /^art_[a-z0-9]+$/i;
|
|
64658
|
+
external = /^(?:[a-z][\w+.-]*:|\/|#)/i;
|
|
64509
64659
|
}
|
|
64510
64660
|
});
|
|
64511
64661
|
|
|
@@ -64661,11 +64811,13 @@ async function watchRun(sessionId, resume = startResume, retryBackoff = backoffM
|
|
|
64661
64811
|
const review = reviewContext?.review;
|
|
64662
64812
|
const boundary = review && reviewBoundary(savedPreviews ? { ...review, stages: review.stages.map((stage) => ({ ...stage, snapshot: null })) } : review, reviewContext.assigned);
|
|
64663
64813
|
const coding = record2.action === "implement" && studioForRun({ id: record2.cardId ?? void 0, deliveryId: record2.deliveryId }) === "coding";
|
|
64664
|
-
const
|
|
64814
|
+
const uiDirectory = process.env[APPROVED_UI_DIR_ENV];
|
|
64815
|
+
const approvedUi = review && coding && (!savedPreviews || uiDirectory) ? approvedUiPrompt(review, uiDirectory, !!savedPreviews) : "";
|
|
64816
|
+
const savedPrompt = savedPreviews ? [
|
|
64665
64817
|
`Read the saved task Previews and their pinned files in \`${savedPreviews}\`. Use these saved versions for the requirements they cover and verify the delivery against them.`,
|
|
64666
|
-
...coding && review?.plan?.some((node2) => node2.previews.includes("ui-design")) ? [APPROVED_UI_RULE] : []
|
|
64667
|
-
].join("\n") :
|
|
64668
|
-
const prompt = [process.env.AI4KANBAN_SYNC_DIAGNOSTIC ? syncRepairPrompt(process.env.AI4KANBAN_SYNC_DIAGNOSTIC) : "", record2.retry ? `Previous execution failed: ${record2.retry.reason}. Check existing results before continuing; do not repeat completed operations.` : "", conflictPrompt(KANBAN), boundary, basePrompt, resumedStudio,
|
|
64818
|
+
...coding && !approvedUi && review?.plan?.some((node2) => node2.previews.includes("ui-design")) ? [APPROVED_UI_RULE] : []
|
|
64819
|
+
].join("\n") : "";
|
|
64820
|
+
const prompt = [process.env.AI4KANBAN_SYNC_DIAGNOSTIC ? syncRepairPrompt(process.env.AI4KANBAN_SYNC_DIAGNOSTIC) : "", record2.retry ? `Previous execution failed: ${record2.retry.reason}. Check existing results before continuing; do not repeat completed operations.` : "", conflictPrompt(KANBAN), boundary, basePrompt, resumedStudio, savedPrompt, approvedUi, recoveryPrompt2, discardedCardsPrompt(record2.discardedCards)].filter(Boolean).join("\n\n");
|
|
64669
64821
|
const before = markBoard();
|
|
64670
64822
|
const takes = active3.images;
|
|
64671
64823
|
active3.renderer?.setRequiredImages?.(record2.pictures ?? []);
|
|
@@ -66483,8 +66635,7 @@ function declareRuns(program2, cli) {
|
|
|
66483
66635
|
await boardless(this, cli, (_, location) => taskReview(id2, this.opts(), location));
|
|
66484
66636
|
});
|
|
66485
66637
|
const questionOps = [];
|
|
66486
|
-
|
|
66487
|
-
withShared(task.command("update-questions")).argument("<task>").summary("edit the task's open questions, like `raw update-questions`").description("Positions are 1-based, in the order of the card\u2019s `questions:` (`akb task show`). --option, --recommended-option and --mode attach to the --append or --update before them.").option("--append <text>", "add one question to the end", opInOrder("append")).option("--update <n> <text...>", "rewrite question <n> whole", opInOrder("update")).option("--drop <positions>", "remove questions, e.g. 1 or 1,3", opInOrder("drop")).option("--clear", "remove every open question", opInOrder("clear")).option("--option <text>", "a choice for the op before it", opInOrder("option")).option("--recommended-option <text>", "a choice for the op before it, ticked to start", opInOrder("recommended-option")).option("--mode <mode>", "how many choices the op before it takes: single | multi", opInOrder("mode")).addOption(new Option("--agent <name>").hideHelp().argParser(opInOrder("agent"))).action(async function(id2) {
|
|
66638
|
+
withQuestionOptions(withShared(task.command("update-questions")).argument("<task>").summary("append, rewrite, or remove open questions").description("Edit the current Runner task locally for synchronization, or save another task in Cloud. Edits apply in order at 1-based positions. Choices and mode apply to the preceding --append or --update.\nSee akb guide update-questions."), questionOps).action(async function(id2) {
|
|
66488
66639
|
await boardless(this, cli, (_, location) => taskUpdateQuestions(id2, questionOps, location));
|
|
66489
66640
|
});
|
|
66490
66641
|
withShared(task.command("chat")).argument("<task>").argument("[message...]").summary("read task chat history, follow or stop its reply, or send a message").description("Without a message, read the last 20 messages and the chat reply state separately from task execution. --follow tracks only the reply present at the start; Ctrl+C disconnects locally. --stop stops only that reply. --follow --json emits JSON Lines; other modes return one JSON object.").option("--limit <n>", "show the last n messages, oldest first (default: 20)", intInRange(1, Number.MAX_SAFE_INTEGER)).option("--all", "show all retained messages").option("--follow", "follow this reply to its result, then exit").option("--stop", "request stopping only the current chat reply").addHelpText("after", '\nExamples:\n akb task chat WC-12\n akb task chat 12 --all --json\n akb task chat 12 --follow --json\n akb task chat 12 --stop\n akb task chat 12 "Revise the draft"').action(async function(id2, message) {
|
|
@@ -66820,6 +66971,7 @@ var init_agent2 = __esm({
|
|
|
66820
66971
|
init_agent_check();
|
|
66821
66972
|
init_harnesses();
|
|
66822
66973
|
init_moved();
|
|
66974
|
+
init_question_options();
|
|
66823
66975
|
init_shared2();
|
|
66824
66976
|
REVIEW_FLOW_HELP = `
|
|
66825
66977
|
Review examples
|