wildcrane-runner 0.6.109 → 0.6.110

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.
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // ai4kanban 0.11.89 — built by runner/scripts/build.mjs. Do not edit.
2
+ // ai4kanban 0.11.90 — 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;
@@ -1767,18 +1767,18 @@ var init_parse = __esm({
1767
1767
  return result.issues.length === 0;
1768
1768
  };
1769
1769
  _encode = (_Err) => {
1770
- const parse4 = _parse(_Err);
1770
+ const parse5 = _parse(_Err);
1771
1771
  const fn = (schema, value, _ctx, _params) => {
1772
1772
  const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
1773
- return parse4(schema, value, ctx, finalizeParams(fn, _params));
1773
+ return parse5(schema, value, ctx, finalizeParams(fn, _params));
1774
1774
  };
1775
1775
  return fn;
1776
1776
  };
1777
1777
  encode = /* @__PURE__ */ _encode($ZodRealError);
1778
1778
  _decode = (_Err) => {
1779
- const parse4 = _parse(_Err);
1779
+ const parse5 = _parse(_Err);
1780
1780
  const fn = (schema, value, _ctx, _params) => {
1781
- return parse4(schema, value, _ctx, finalizeParams(fn, _params));
1781
+ return parse5(schema, value, _ctx, finalizeParams(fn, _params));
1782
1782
  };
1783
1783
  return fn;
1784
1784
  };
@@ -2703,7 +2703,7 @@ function capSize(inst, size) {
2703
2703
  if (!caps.length)
2704
2704
  return;
2705
2705
  const cap = Math.min(...caps.map((c) => c[0]));
2706
- const parse4 = inst._zod.parse;
2706
+ const parse5 = inst._zod.parse;
2707
2707
  inst._zod.parse = (payload, ctx) => {
2708
2708
  const n = size(payload.value);
2709
2709
  if (n > cap && !ctx?.skipChecks && ctx?.direction !== "backward") {
@@ -2717,7 +2717,7 @@ function capSize(inst, size) {
2717
2717
  }
2718
2718
  }
2719
2719
  }
2720
- return parse4(payload, ctx);
2720
+ return parse5(payload, ctx);
2721
2721
  };
2722
2722
  }
2723
2723
  function handleArrayResult(result, final, index) {
@@ -20909,6 +20909,9 @@ function withoutCode(source2) {
20909
20909
  return line;
20910
20910
  }).join("").replace(/(`+)([^]*?)\1(?!`)/g, blank);
20911
20911
  }
20912
+ function agentSectionOffset(source2) {
20913
+ return /^<!--[ \t]*agent[ \t]*-->/m.exec(withoutCode(source2))?.index ?? source2.length;
20914
+ }
20912
20915
  function parsePreviewBlocks(source2, file2 = "STUDIO.md") {
20913
20916
  const blocks = [], problems = [];
20914
20917
  const masked = withoutCode(source2);
@@ -22832,7 +22835,7 @@ var init_package = __esm({
22832
22835
  "../cli/package.json"() {
22833
22836
  package_default = {
22834
22837
  name: "wildcrane",
22835
- version: "0.11.89",
22838
+ version: "0.11.90",
22836
22839
  akbContract: 29,
22837
22840
  canonicalCommands: true,
22838
22841
  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.",
@@ -25958,7 +25961,7 @@ var CONVERSATION_MS;
25958
25961
  var init_conversation = __esm({
25959
25962
  "../cli/src/lib/shared/conversation.ts"() {
25960
25963
  "use strict";
25961
- CONVERSATION_MS = { send: 15e3, claim: 3e4, prepare: 6e4, start: 15e3, startup: 12e4, quiet: 6e4, stop: 1e4 };
25964
+ CONVERSATION_MS = { send: 15e3, prepare: 6e4, start: 15e3, stop: 1e4 };
25962
25965
  }
25963
25966
  });
25964
25967
 
@@ -29808,10 +29811,10 @@ var require_code = __commonJS({
29808
29811
  function interpolate(x) {
29809
29812
  return typeof x == "number" || typeof x == "boolean" || x === null ? x : safeStringify(Array.isArray(x) ? x.join(",") : x);
29810
29813
  }
29811
- function stringify(x) {
29814
+ function stringify2(x) {
29812
29815
  return new _Code(safeStringify(x));
29813
29816
  }
29814
- exports.stringify = stringify;
29817
+ exports.stringify = stringify2;
29815
29818
  function safeStringify(x) {
29816
29819
  return JSON.stringify(x).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
29817
29820
  }
@@ -33506,7 +33509,7 @@ var require_fast_uri = __commonJS({
33506
33509
  normalizeString(uri, options);
33507
33510
  } else if (typeof uri === "object") {
33508
33511
  uri = /** @type {T} */
33509
- parse4(serialize2(uri, options), options);
33512
+ parse5(serialize2(uri, options), options);
33510
33513
  }
33511
33514
  return uri;
33512
33515
  }
@@ -33549,8 +33552,8 @@ var require_fast_uri = __commonJS({
33549
33552
  function resolveComponent(base, relative, options, skipNormalization) {
33550
33553
  const target = {};
33551
33554
  if (!skipNormalization) {
33552
- base = parse4(serialize2(base, options), options);
33553
- relative = parse4(serialize2(relative, options), options);
33555
+ base = parse5(serialize2(base, options), options);
33556
+ relative = parse5(serialize2(relative, options), options);
33554
33557
  }
33555
33558
  options = options || {};
33556
33559
  if (!options.tolerant && relative.scheme) {
@@ -33868,7 +33871,7 @@ var require_fast_uri = __commonJS({
33868
33871
  }
33869
33872
  return { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme };
33870
33873
  }
33871
- function parse4(uri, opts) {
33874
+ function parse5(uri, opts) {
33872
33875
  return parseWithStatus(uri, opts).parsed;
33873
33876
  }
33874
33877
  function normalizeString(uri, opts) {
@@ -33905,7 +33908,7 @@ var require_fast_uri = __commonJS({
33905
33908
  resolveComponent,
33906
33909
  equal,
33907
33910
  serialize: serialize2,
33908
- parse: parse4
33911
+ parse: parse5
33909
33912
  };
33910
33913
  module.exports = fastUri;
33911
33914
  module.exports.default = fastUri;
@@ -37893,7 +37896,7 @@ var require_stringify = __commonJS({
37893
37896
  props.push(doc.directives.tagString(tag));
37894
37897
  return props.join(" ");
37895
37898
  }
37896
- function stringify(item, ctx, onComment, onChompKeep) {
37899
+ function stringify2(item, ctx, onComment, onChompKeep) {
37897
37900
  if (identity.isPair(item))
37898
37901
  return item.toString(ctx, onComment, onChompKeep);
37899
37902
  if (identity.isAlias(item)) {
@@ -37922,7 +37925,7 @@ var require_stringify = __commonJS({
37922
37925
  ${ctx.indent}${str5}`;
37923
37926
  }
37924
37927
  exports.createStringifyContext = createStringifyContext;
37925
- exports.stringify = stringify;
37928
+ exports.stringify = stringify2;
37926
37929
  }
37927
37930
  });
37928
37931
 
@@ -37932,7 +37935,7 @@ var require_stringifyPair = __commonJS({
37932
37935
  "use strict";
37933
37936
  var identity = require_identity();
37934
37937
  var Scalar = require_Scalar();
37935
- var stringify = require_stringify();
37938
+ var stringify2 = require_stringify();
37936
37939
  var stringifyComment = require_stringifyComment();
37937
37940
  function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
37938
37941
  const { allNullValues, doc, indent: indent2, indentStep, options: { commentString, indentSeq, simpleKeys } } = ctx;
@@ -37954,7 +37957,7 @@ var require_stringifyPair = __commonJS({
37954
37957
  });
37955
37958
  let keyCommentDone = false;
37956
37959
  let chompKeep = false;
37957
- let str5 = stringify.stringify(key, ctx, () => keyCommentDone = true, () => chompKeep = true);
37960
+ let str5 = stringify2.stringify(key, ctx, () => keyCommentDone = true, () => chompKeep = true);
37958
37961
  if (!explicitKey && !ctx.inFlow && str5.length > 1024) {
37959
37962
  if (simpleKeys)
37960
37963
  throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
@@ -38006,7 +38009,7 @@ ${indent2}:`;
38006
38009
  ctx.indent = ctx.indent.substring(2);
38007
38010
  }
38008
38011
  let valueCommentDone = false;
38009
- const valueStr = stringify.stringify(value, ctx, () => valueCommentDone = true, () => chompKeep = true);
38012
+ const valueStr = stringify2.stringify(value, ctx, () => valueCommentDone = true, () => chompKeep = true);
38010
38013
  let ws = " ";
38011
38014
  if (keyComment || vsb || vcb) {
38012
38015
  ws = vsb ? "\n" : "";
@@ -38147,7 +38150,7 @@ var require_addPairToJSMap = __commonJS({
38147
38150
  "use strict";
38148
38151
  var log = require_log();
38149
38152
  var merge2 = require_merge();
38150
- var stringify = require_stringify();
38153
+ var stringify2 = require_stringify();
38151
38154
  var identity = require_identity();
38152
38155
  var toJS = require_toJS();
38153
38156
  function addPairToJSMap(ctx, map3, { key, value }) {
@@ -38183,7 +38186,7 @@ var require_addPairToJSMap = __commonJS({
38183
38186
  if (typeof jsKey !== "object")
38184
38187
  return String(jsKey);
38185
38188
  if (identity.isNode(key) && ctx?.doc) {
38186
- const strCtx = stringify.createStringifyContext(ctx.doc, {});
38189
+ const strCtx = stringify2.createStringifyContext(ctx.doc, {});
38187
38190
  strCtx.anchors = /* @__PURE__ */ new Set();
38188
38191
  for (const node2 of ctx.anchors.keys())
38189
38192
  strCtx.anchors.add(node2.anchor);
@@ -38250,12 +38253,12 @@ var require_stringifyCollection = __commonJS({
38250
38253
  "../cli/node_modules/yaml/dist/stringify/stringifyCollection.js"(exports) {
38251
38254
  "use strict";
38252
38255
  var identity = require_identity();
38253
- var stringify = require_stringify();
38256
+ var stringify2 = require_stringify();
38254
38257
  var stringifyComment = require_stringifyComment();
38255
38258
  function stringifyCollection(collection, ctx, options) {
38256
38259
  const flow = ctx.inFlow ?? collection.flow;
38257
- const stringify2 = flow ? stringifyFlowCollection : stringifyBlockCollection;
38258
- return stringify2(collection, ctx, options);
38260
+ const stringify3 = flow ? stringifyFlowCollection : stringifyBlockCollection;
38261
+ return stringify3(collection, ctx, options);
38259
38262
  }
38260
38263
  function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, flowChars, itemIndent, onChompKeep, onComment }) {
38261
38264
  const { indent: indent2, options: { commentString } } = ctx;
@@ -38280,7 +38283,7 @@ var require_stringifyCollection = __commonJS({
38280
38283
  }
38281
38284
  }
38282
38285
  chompKeep = false;
38283
- let str6 = stringify.stringify(item, itemCtx, () => comment2 = null, () => chompKeep = true);
38286
+ let str6 = stringify2.stringify(item, itemCtx, () => comment2 = null, () => chompKeep = true);
38284
38287
  if (comment2)
38285
38288
  str6 += stringifyComment.lineComment(str6, itemIndent, commentString(comment2));
38286
38289
  if (chompKeep && comment2)
@@ -38347,7 +38350,7 @@ ${indent2}${line}` : "\n";
38347
38350
  }
38348
38351
  if (comment)
38349
38352
  reqNewline = true;
38350
- let str5 = stringify.stringify(item, itemCtx, () => comment = null);
38353
+ let str5 = stringify2.stringify(item, itemCtx, () => comment = null);
38351
38354
  reqNewline || (reqNewline = lines.length > linesAtValue || str5.includes("\n"));
38352
38355
  if (i < items.length - 1) {
38353
38356
  str5 += ",";
@@ -39708,7 +39711,7 @@ var require_stringifyDocument = __commonJS({
39708
39711
  "../cli/node_modules/yaml/dist/stringify/stringifyDocument.js"(exports) {
39709
39712
  "use strict";
39710
39713
  var identity = require_identity();
39711
- var stringify = require_stringify();
39714
+ var stringify2 = require_stringify();
39712
39715
  var stringifyComment = require_stringifyComment();
39713
39716
  function stringifyDocument(doc, options) {
39714
39717
  const lines = [];
@@ -39723,7 +39726,7 @@ var require_stringifyDocument = __commonJS({
39723
39726
  }
39724
39727
  if (hasDirectives)
39725
39728
  lines.push("---");
39726
- const ctx = stringify.createStringifyContext(doc, options);
39729
+ const ctx = stringify2.createStringifyContext(doc, options);
39727
39730
  const { commentString } = ctx.options;
39728
39731
  if (doc.commentBefore) {
39729
39732
  if (lines.length !== 1)
@@ -39745,7 +39748,7 @@ var require_stringifyDocument = __commonJS({
39745
39748
  contentComment = doc.contents.comment;
39746
39749
  }
39747
39750
  const onChompKeep = contentComment ? void 0 : () => chompKeep = true;
39748
- let body = stringify.stringify(doc.contents, ctx, () => contentComment = null, onChompKeep);
39751
+ let body = stringify2.stringify(doc.contents, ctx, () => contentComment = null, onChompKeep);
39749
39752
  if (contentComment)
39750
39753
  body += stringifyComment.lineComment(body, "", commentString(contentComment));
39751
39754
  if ((body[0] === "|" || body[0] === ">") && lines[lines.length - 1] === "---") {
@@ -39753,7 +39756,7 @@ var require_stringifyDocument = __commonJS({
39753
39756
  } else
39754
39757
  lines.push(body);
39755
39758
  } else {
39756
- lines.push(stringify.stringify(doc.contents, ctx));
39759
+ lines.push(stringify2.stringify(doc.contents, ctx));
39757
39760
  }
39758
39761
  if (doc.directives?.docEnd) {
39759
39762
  if (doc.comment) {
@@ -41889,7 +41892,7 @@ var require_cst_scalar = __commonJS({
41889
41892
  var require_cst_stringify = __commonJS({
41890
41893
  "../cli/node_modules/yaml/dist/parse/cst-stringify.js"(exports) {
41891
41894
  "use strict";
41892
- var stringify = (cst) => "type" in cst ? stringifyToken(cst) : stringifyItem(cst);
41895
+ var stringify2 = (cst) => "type" in cst ? stringifyToken(cst) : stringifyItem(cst);
41893
41896
  function stringifyToken(token2) {
41894
41897
  switch (token2.type) {
41895
41898
  case "block-scalar": {
@@ -41942,7 +41945,7 @@ var require_cst_stringify = __commonJS({
41942
41945
  res += stringifyToken(value);
41943
41946
  return res;
41944
41947
  }
41945
- exports.stringify = stringify;
41948
+ exports.stringify = stringify2;
41946
41949
  }
41947
41950
  });
41948
41951
 
@@ -43653,7 +43656,7 @@ var require_public_api = __commonJS({
43653
43656
  }
43654
43657
  return doc;
43655
43658
  }
43656
- function parse4(src, reviver, options) {
43659
+ function parse5(src, reviver, options) {
43657
43660
  let _reviver = void 0;
43658
43661
  if (typeof reviver === "function") {
43659
43662
  _reviver = reviver;
@@ -43672,7 +43675,7 @@ var require_public_api = __commonJS({
43672
43675
  }
43673
43676
  return doc.toJS(Object.assign({ reviver: _reviver }, options));
43674
43677
  }
43675
- function stringify(value, replacer, options) {
43678
+ function stringify2(value, replacer, options) {
43676
43679
  let _replacer = null;
43677
43680
  if (typeof replacer === "function" || Array.isArray(replacer)) {
43678
43681
  _replacer = replacer;
@@ -43694,10 +43697,10 @@ var require_public_api = __commonJS({
43694
43697
  return value.toString(options);
43695
43698
  return new Document.Document(value, _replacer, options).toString(options);
43696
43699
  }
43697
- exports.parse = parse4;
43700
+ exports.parse = parse5;
43698
43701
  exports.parseAllDocuments = parseAllDocuments;
43699
43702
  exports.parseDocument = parseDocument3;
43700
- exports.stringify = stringify;
43703
+ exports.stringify = stringify2;
43701
43704
  }
43702
43705
  });
43703
43706
 
@@ -43991,7 +43994,7 @@ var GUIDE_TOPICS;
43991
43994
  var init_guide_topics = __esm({
43992
43995
  "../cli/src/lib/shared/guide-topics.ts"() {
43993
43996
  "use strict";
43994
- GUIDE_TOPICS = ["board", "writing", "add-task", "follow-up", "discuss-goal", "troubleshoot", "card-chat", "update-studio", "implement", "settle-background", "archive", "update-questions", "refine", "revise", "resolve", "prune-memory", "review-memory", "describe-project", "review-rejections", "reflect", "write-agent", "write-prompt", "module-map"];
43997
+ GUIDE_TOPICS = ["board", "writing", "add-task", "follow-up", "discuss-goal", "troubleshoot", "card-chat", "task-ui-en", "task-ui-zh", "update-studio", "implement", "settle-background", "archive", "update-questions", "refine", "revise", "resolve", "prune-memory", "review-memory", "describe-project", "review-rejections", "reflect", "write-agent", "write-prompt", "module-map"];
43995
43998
  }
43996
43999
  });
43997
44000
 
@@ -44228,7 +44231,7 @@ function heldStudioName(name) {
44228
44231
  }
44229
44232
  function saveVersion(held4) {
44230
44233
  const file2 = versionFile(held4.id, held4.version);
44231
- if (!fs32.existsSync(file2)) writeJson(file2, { id: held4.id, version: held4.version, name: held4.name, names: held4.names, files: held4.files });
44234
+ writeJson(file2, { id: held4.id, version: held4.version, name: held4.name, names: held4.names, files: held4.files });
44232
44235
  }
44233
44236
  function savePin(task, held4) {
44234
44237
  saveVersion(held4);
@@ -44261,14 +44264,24 @@ async function versionOf(id2, version2) {
44261
44264
  return read5;
44262
44265
  }
44263
44266
  async function pinTask(task) {
44264
- const pin = readPin(task);
44265
- const held4 = pin && readVersion(pin.studio, pin.version);
44266
- if (held4 && "def" in parseStudioFile("studio", held4.files["STUDIO.md"] ?? "", "STUDIO.md")) return { ok: true, value: held4 };
44267
+ const cached3 = sessionTaskStudios.get(task);
44268
+ if (cached3) return { ok: true, value: cached3 };
44267
44269
  const read5 = await call("GET", `/v1/tasks/${encodeURIComponent(task)}/studio`);
44268
44270
  if (!read5.ok) return read5;
44269
- if (!hasText(read5.value.studio) || !isStudioVersion(read5.value.version) || !isStudioFiles(read5.value.files)) return invalid("the task\u2019s Studio version");
44270
- const value = { id: read5.value.studio, version: read5.value.version, name: read5.value.name, files: read5.value.files, historicalPreviews: read5.value.historicalPreviews };
44271
+ if (read5.value.deleted) {
44272
+ const pin = readPin(task);
44273
+ const held4 = pin && readVersion(pin.studio, pin.version);
44274
+ if (held4) {
44275
+ sessionTaskStudios.set(task, held4);
44276
+ return { ok: true, value: held4 };
44277
+ }
44278
+ return invalid("the task\u2019s Studio");
44279
+ }
44280
+ if (!hasText(read5.value.studio) || !isStudioFiles(read5.value.files)) return invalid("the task\u2019s Studio");
44281
+ const version2 = isStudioVersion(read5.value.version) ? read5.value.version : 1;
44282
+ const value = { id: read5.value.studio, version: version2, name: read5.value.name, files: read5.value.files, historicalPreviews: read5.value.historicalPreviews };
44271
44283
  savePin(task, value);
44284
+ sessionTaskStudios.set(task, value);
44272
44285
  return { ok: true, value };
44273
44286
  }
44274
44287
  async function syncStudios(force = false) {
@@ -44370,7 +44383,7 @@ function taskHistoricalPreviews() {
44370
44383
  const task = workspaceTask();
44371
44384
  return task ? Object.keys(readPin(task)?.historicalPreviews ?? {}) : [];
44372
44385
  }
44373
- var DEV, FRESH_MS, root, safe, versionFile, listFile, pinFile, readVersion, readPin, boardProject, devFolder, NEEDS_CLOUD, NOT_DOWNLOADED, verification, studioVerification, isStudioVersion, flowOf, sources, flows, cloudStudioSources, cloudFlows;
44386
+ var DEV, FRESH_MS, root, safe, versionFile, listFile, pinFile, readVersion, readPin, boardProject, devFolder, NEEDS_CLOUD, NOT_DOWNLOADED, verification, studioVerification, isStudioVersion, sessionTaskStudios, flowOf, sources, flows, cloudStudioSources, cloudFlows;
44374
44387
  var init_cloud_studios = __esm({
44375
44388
  "../cli/src/lib/agent/cloud-studios.ts"() {
44376
44389
  "use strict";
@@ -44400,6 +44413,7 @@ var init_cloud_studios = __esm({
44400
44413
  verification = { cached: false };
44401
44414
  studioVerification = () => verification;
44402
44415
  isStudioVersion = (value) => typeof value === "number" && Number.isSafeInteger(value) && value > 0;
44416
+ sessionTaskStudios = /* @__PURE__ */ new Map();
44403
44417
  flowOf = (held4) => {
44404
44418
  const id2 = studioName(held4.id);
44405
44419
  const read5 = parseStudioFile(id2, held4.files["STUDIO.md"] ?? "", `the \`${id2}\` studio`);
@@ -56379,6 +56393,99 @@ var init_shared_memory = __esm({
56379
56393
  }
56380
56394
  });
56381
56395
 
56396
+ // ../cli/src/lib/shared/coding-previews.ts
56397
+ var CODING_PREVIEWS;
56398
+ var init_coding_previews = __esm({
56399
+ "../cli/src/lib/shared/coding-previews.ts"() {
56400
+ "use strict";
56401
+ CODING_PREVIEWS = {
56402
+ "tech-stack-advisor": "tech-choices",
56403
+ "email-planner": "emails",
56404
+ "ui-designer": "ui-design",
56405
+ "api-designer": "api-docs",
56406
+ "schema-designer": "schema",
56407
+ "prompt-writer": "prompts",
56408
+ "competitor-research": "competitor-research"
56409
+ };
56410
+ }
56411
+ });
56412
+
56413
+ // ../cli/src/lib/shared/studio-migration.ts
56414
+ function migrateTask(body, previews, ids, historical = {}) {
56415
+ historical = { ...historical };
56416
+ const historicalId = (name) => {
56417
+ const id2 = `historical-${name}`;
56418
+ if (Object.values(ids).includes(id2)) throw Error(`Historical Preview ${name} collides with defined Preview ${id2}`);
56419
+ return id2;
56420
+ };
56421
+ for (const name of previews) if (!ids[name] && !Object.values(ids).includes(name) && !Object.hasOwn(historical, name)) historical[historicalId(name)] ??= { title: { en: name } };
56422
+ const marker = agentSectionOffset(body);
56423
+ const head2 = body.slice(0, marker), tail = body.slice(marker);
56424
+ const headings = [...withoutCode(head2).matchAll(/^##[ \t]+[^\n]*$/gm)];
56425
+ const groups = /* @__PURE__ */ new Map(), chunks = [];
56426
+ let at = 0;
56427
+ for (let n = 0; n < headings.length; n++) {
56428
+ const heading = headings[n], name = /^##[ \t]+By[ \t]+`([^`]+)`[ \t]+agent[ \t]*$/.exec(head2.slice(heading.index, heading.index + heading[0].length))?.[1];
56429
+ if (!name) continue;
56430
+ const end2 = headings[n + 1]?.index ?? head2.length;
56431
+ const id2 = ids[name] ?? historicalId(name);
56432
+ if (!ids[name]) historical[id2] ??= { title: { en: name } };
56433
+ const result = head2.slice(heading.index + heading[0].length, end2).trim();
56434
+ if (!result) continue;
56435
+ chunks.push({ text: head2.slice(at, heading.index) });
56436
+ const parts = groups.get(id2) ?? [];
56437
+ if (!groups.has(id2)) chunks.push({ text: `\0${id2}\0` });
56438
+ parts.push(result);
56439
+ groups.set(id2, parts);
56440
+ at = end2;
56441
+ }
56442
+ chunks.push({ text: head2.slice(at) });
56443
+ const migrated = chunks.map((c) => c.text.replace(/\u0000([^\u0000]+)\u0000/g, (_, id2) => `<Preview id="${id2}">
56444
+
56445
+ ${groups.get(id2).join("\n\n")}
56446
+
56447
+ </Preview>
56448
+
56449
+ `)).join("") + tail;
56450
+ const parsed = parsePreviewBlocks(migrated);
56451
+ if (parsed.problems.length) throw Error(parsed.problems.map((p) => p.message).join("; "));
56452
+ return { body: migrated, previews: [...new Set(previews.map((p) => ids[p] ?? (historical[`historical-${p}`] ? `historical-${p}` : p)))], historical };
56453
+ }
56454
+ function migrateHistoricalArchive(content, base) {
56455
+ const roleHeading = /^##[ \t]+By[ \t]+[^\n]*agent[ \t]*$/gm;
56456
+ if (content.search(roleHeading) < 0) return content;
56457
+ const original = parseFrontmatter(content).meta?.studio;
56458
+ const target = base ? parseFrontmatter(base).meta?.studio : void 0;
56459
+ if ([original, target].some((id2) => id2 && id2 !== "coding")) return content;
56460
+ const headings = [...withoutCode(content).matchAll(roleHeading)];
56461
+ if (!headings.length) return content;
56462
+ const ids = new Set(base ? parsePreviewBlocks(base).blocks.map((block) => block.id) : []);
56463
+ if (!ids.size && original !== "coding") return content;
56464
+ if (headings.some(({ index, 0: line }) => {
56465
+ const name = /^##[ \t]+By[ \t]+`([^`]+)`[ \t]+agent[ \t]*$/.exec(content.slice(index, index + line.length))?.[1];
56466
+ return !name || !Object.hasOwn(CODING_PREVIEWS, name) || !!ids.size && !ids.has(CODING_PREVIEWS[name]);
56467
+ })) return content;
56468
+ try {
56469
+ const migrated = migrateTask(content, [], CODING_PREVIEWS).body;
56470
+ if (withoutCode(migrated).search(roleHeading) < 0) return migrated;
56471
+ } catch {
56472
+ }
56473
+ return content;
56474
+ }
56475
+ var import_yaml9;
56476
+ var init_studio_migration = __esm({
56477
+ "../cli/src/lib/shared/studio-migration.ts"() {
56478
+ "use strict";
56479
+ init_frontmatter();
56480
+ import_yaml9 = __toESM(require_dist(), 1);
56481
+ init_parse3();
56482
+ init_studio_def();
56483
+ init_preview_blocks();
56484
+ init_coding_previews();
56485
+ init_coding_previews();
56486
+ }
56487
+ });
56488
+
56382
56489
  // ../cli/src/lib/shared/board-conflicts.ts
56383
56490
  import crypto4 from "node:crypto";
56384
56491
  import fs65 from "node:fs";
@@ -56497,7 +56604,7 @@ function resolutionOf(record2, value) {
56497
56604
  if (saved.remote.content === null && saved.base.content !== null && f.content !== null && (numberOfCard(f.path) !== null || f.path.startsWith("triage/"))) refuse(record2, `This path was removed or moved: ${f.path}. Preserve the local draft outside the board.`, "cloud-refused");
56498
56605
  if (numberOfCard(f.path) !== null && f.content !== null) {
56499
56606
  const front = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(f.content)?.[1];
56500
- const parsed = (0, import_yaml9.parseDocument)(front ?? "");
56607
+ const parsed = (0, import_yaml10.parseDocument)(front ?? "");
56501
56608
  const fields2 = parsed.toJS();
56502
56609
  if (!front || parsed.errors.length || !fields2 || typeof fields2.title !== "string" || ["title", "priority", "status", "blocked_by", "related", "modules", "questions"].some((key) => !(key in fields2)) || ["blocked_by", "related", "modules", "questions"].some((key) => !Array.isArray(fields2[key])) || fields2.modules.some((v) => typeof v !== "string") || ["blocked_by", "related"].some((key) => fields2[key].some((v) => !Number.isSafeInteger(v) || Number(v) < 1))) refuse(record2, `Invalid card metadata: ${f.path}`, "invalid-usage");
56503
56610
  const meta3 = parseFrontmatter(f.content).meta;
@@ -56604,9 +56711,15 @@ async function resolveConflict(board2, project2, id2, expect, value, transport)
56604
56711
  save2(board2, r);
56605
56712
  refuse(r, "Another batch member changed locally. Read the conflict again.");
56606
56713
  }
56607
- const writes = r.files.map((f) => ({ path: f.remotePath, content: files.some((v) => v.path === f.path) ? files.find((v) => v.path === f.path).content : f.automatic ? f.automatic.content : f.local.content, base_seq: f.remote.seq }));
56714
+ const writes = r.files.map((f) => {
56715
+ const result = files.find((v) => v.path === f.path);
56716
+ const content = result ? result.content : f.automatic ? f.automatic.content : f.local.content;
56717
+ return { path: f.remotePath, base_seq: f.remote.seq, content: content !== null && f.path.startsWith(".archive/") && numberOfCard(f.path) !== null ? migrateHistoricalArchive(content, f.remote.content ?? f.base.content ?? void 0) : content };
56718
+ });
56608
56719
  r.draft = { revision: expect, files, working, writes };
56609
56720
  save2(board2, r);
56721
+ const oversized = writes.find((w) => w.content !== null && Buffer.byteLength(w.content) > BOARD_FILE_LIMIT);
56722
+ if (oversized) refuse(r, `${oversized.path} exceeds the board file limit.`, "cloud-refused");
56610
56723
  const remote2 = await transport.read(project2);
56611
56724
  if (!remote2.ok) refuse(r, remote2.error, "cloud-refused");
56612
56725
  const versions = r.files.map((f) => remote2.value.files.find((v) => v.path === f.remotePath) ?? { path: f.remotePath, seq: 0, content: null });
@@ -56642,11 +56755,11 @@ async function resolveConflict(board2, project2, id2, expect, value, transport)
56642
56755
  return { id: id2, state: r.state, receipt: r.receipt };
56643
56756
  });
56644
56757
  }
56645
- var import_yaml9, digest, folder, fileOf, pendingConflicts, conflictList;
56758
+ var import_yaml10, digest, folder, fileOf, pendingConflicts, conflictList;
56646
56759
  var init_board_conflicts = __esm({
56647
56760
  "../cli/src/lib/shared/board-conflicts.ts"() {
56648
56761
  "use strict";
56649
- import_yaml9 = __toESM(require_dist(), 1);
56762
+ import_yaml10 = __toESM(require_dist(), 1);
56650
56763
  init_shared_memory();
56651
56764
  init_io();
56652
56765
  init_lock();
@@ -56654,6 +56767,7 @@ var init_board_conflicts = __esm({
56654
56767
  init_board_files();
56655
56768
  init_tasks();
56656
56769
  init_frontmatter();
56770
+ init_studio_migration();
56657
56771
  digest = (value) => crypto4.createHash("sha256").update(JSON.stringify(value)).digest("hex");
56658
56772
  folder = (board2) => path67.join(projectStateDir(board2), "conflicts");
56659
56773
  fileOf = (board2, id2) => {
@@ -57689,18 +57803,25 @@ ${card.body.trim()}`);
57689
57803
  async function taskCreate(request2, opts, location = {}) {
57690
57804
  const text5 = request2.trim();
57691
57805
  if (!text5) die("Say what the task is.", { kind: "bad-args", exitCode: 2 });
57806
+ if (opts.review !== void 0 && opts.reviewFile !== void 0) die("Use either --review or --review-file.");
57692
57807
  const line = text5.split("\n")[0].trim();
57693
57808
  const title = line.length > 80 ? `${line.slice(0, 79)}\u2026` : line;
57694
57809
  const target = await project(opts.project, location);
57695
57810
  if (!opts.studio?.trim()) return refuse3("Choose --studio from akb studio list.", "no_studio");
57696
- const task = await cloud("POST", "/v1/tasks", {
57811
+ const body = {
57697
57812
  title,
57698
57813
  request: text5,
57699
57814
  project: target,
57700
57815
  studio: cloudStudio(opts.studio),
57701
57816
  source: "api",
57702
57817
  run: true
57703
- });
57818
+ };
57819
+ if (opts.review !== void 0) body.review_flow = opts.review;
57820
+ if (opts.reviewFile !== void 0) body.review_plan = parseReviewPlan(JSON.parse(fs71.readFileSync(opts.reviewFile, "utf8")));
57821
+ if (opts.previewDefinitionsFile !== void 0) {
57822
+ body.preview_definitions = previewDefinitionsSchema.parse(JSON.parse(fs71.readFileSync(opts.previewDefinitionsFile, "utf8")));
57823
+ }
57824
+ const task = await cloud("POST", "/v1/tasks", body);
57704
57825
  say(`Created ${task.key}: ${task.title} ${taskUrl(task.key)}`);
57705
57826
  say(`Status: ${task.status}${task.failure ? ` \u2014 ${task.failure}` : ""}`);
57706
57827
  return { ...task };
@@ -57998,6 +58119,24 @@ async function taskResume(id2, location = {}) {
57998
58119
  say(task.status === "queued" ? `Resume queued for ${task.key}.` : `Resumed ${task.key}.`);
57999
58120
  return { ...task };
58000
58121
  }
58122
+ async function resolveCloudRuntime(asked) {
58123
+ const value = asked.trim();
58124
+ if (!value) die("Specify a runtime id or name.", { kind: "bad-args", exitCode: 2 });
58125
+ if (value.startsWith("rt_")) return value;
58126
+ const list3 = await cloud("GET", "/v1/runtimes");
58127
+ requireResponse(list3, "a list of runtimes", (v) => Array.isArray(v.data));
58128
+ const matches = list3.data.filter((r) => r.name === value || r.default && value === "Global default");
58129
+ if (!matches.length) return refuse3(`No runtime named "${value}".`, "not_found");
58130
+ if (matches.length > 1) return refuse3(`Multiple runtimes are named "${value}". Use its rt_... id instead.`, "conflict");
58131
+ return matches[0].id;
58132
+ }
58133
+ async function taskRuntime(id2, runtime, location = {}) {
58134
+ const runtimeId = await resolveCloudRuntime(runtime);
58135
+ const ref = await taskRef(id2, location);
58136
+ const task = requireTask(await cloud("PATCH", `/v1/tasks/${enc(ref)}`, { runtime: runtimeId }));
58137
+ say(`Updated ${task.key} runtime to ${task.runtime_info?.name ?? runtimeId}.`);
58138
+ return { ...task };
58139
+ }
58001
58140
  async function taskStop(id2, location = {}) {
58002
58141
  const task = requireTask(await cloud("POST", `/v1/tasks/${enc(await taskRef(id2, location))}/stop`));
58003
58142
  requireResponse(task, "a stop receipt", (value) => ["running", "queued", "waiting_review", "stopped"].includes(value.status));
@@ -61138,7 +61277,7 @@ var require_extension = __commonJS({
61138
61277
  if (dest[name] === void 0) dest[name] = [elem];
61139
61278
  else dest[name].push(elem);
61140
61279
  }
61141
- function parse4(header) {
61280
+ function parse5(header) {
61142
61281
  const offers = /* @__PURE__ */ Object.create(null);
61143
61282
  let params = /* @__PURE__ */ Object.create(null);
61144
61283
  let mustUnescape = false;
@@ -61278,7 +61417,7 @@ var require_extension = __commonJS({
61278
61417
  }).join(", ");
61279
61418
  }).join(", ");
61280
61419
  }
61281
- module.exports = { format, parse: parse4 };
61420
+ module.exports = { format, parse: parse5 };
61282
61421
  }
61283
61422
  });
61284
61423
 
@@ -61313,7 +61452,7 @@ var require_websocket = __commonJS({
61313
61452
  var {
61314
61453
  EventTarget: { addEventListener, removeEventListener }
61315
61454
  } = require_event_target();
61316
- var { format, parse: parse4 } = require_extension();
61455
+ var { format, parse: parse5 } = require_extension();
61317
61456
  var { toBuffer } = require_buffer_util();
61318
61457
  var kAborted = /* @__PURE__ */ Symbol("kAborted");
61319
61458
  var protocolVersions = [8, 13];
@@ -62013,7 +62152,7 @@ var require_websocket = __commonJS({
62013
62152
  }
62014
62153
  let extensions;
62015
62154
  try {
62016
- extensions = parse4(secWebSocketExtensions);
62155
+ extensions = parse5(secWebSocketExtensions);
62017
62156
  } catch (err) {
62018
62157
  const message = "Invalid Sec-WebSocket-Extensions header";
62019
62158
  abortHandshake(websocket, socket, message);
@@ -62321,7 +62460,7 @@ var require_subprotocol = __commonJS({
62321
62460
  "../cli/node_modules/ws/lib/subprotocol.js"(exports, module) {
62322
62461
  "use strict";
62323
62462
  var { tokenChars } = require_validation2();
62324
- function parse4(header) {
62463
+ function parse5(header) {
62325
62464
  const protocols = /* @__PURE__ */ new Set();
62326
62465
  let start = -1;
62327
62466
  let end2 = -1;
@@ -62357,7 +62496,7 @@ var require_subprotocol = __commonJS({
62357
62496
  protocols.add(protocol);
62358
62497
  return protocols;
62359
62498
  }
62360
- module.exports = { parse: parse4 };
62499
+ module.exports = { parse: parse5 };
62361
62500
  }
62362
62501
  });
62363
62502
 
@@ -63074,7 +63213,7 @@ var init_task_chat = __esm({
63074
63213
  var add_task_default;
63075
63214
  var init_add_task = __esm({
63076
63215
  "../cli/src/guide/add-task.md"() {
63077
- add_task_default = "# Add tasks\n\nCreate new work with `akb task create`; read its `--help` for options.\n\n- **Modules**: read `docs/kanban/modules.md` and relevant project context; follow\n `akb guide module-map` when no tag fits.\n\n## Group tasks\n\nUse a group when several tasks deliver one larger outcome; otherwise keep them independent.\n\n- **Creation**: create the root first, then its subtasks.\n- **Relationships**: link group members with `related`; use `blocked_by` for actual dependencies.\n- **Layout**: once their cards are prepared, place the root at `todo/<id>-<slug>/root.md`\n and the subtask files beside it; update their paths in `todo/README.md`.\n- **Tracking**: the root's `## Todo` lists its subtasks, one line each ending in `#<subid>`.\n\nFollow `akb guide writing` when editing a card.\n";
63216
+ add_task_default = '# Add tasks\n\nCreate new work with `akb task create`; read its `--help` for options. When setting `--review`, `--review-file`, or `--preview-definitions-file` on a request, follow "Preview selection" in `akb guide board`.\n\n- **Modules**: read `docs/kanban/modules.md` and relevant project context; follow\n `akb guide module-map` when no tag fits.\n\n## Group tasks\n\nUse a group when several tasks deliver one larger outcome; otherwise keep them independent.\n\n- **Creation**: create the root first, then its subtasks.\n- **Relationships**: link group members with `related`; use `blocked_by` for actual dependencies.\n- **Layout**: once their cards are prepared, place the root at `todo/<id>-<slug>/root.md`\n and the subtask files beside it; update their paths in `todo/README.md`.\n- **Tracking**: the root\'s `## Todo` lists its subtasks, one line each ending in `#<subid>`.\n\nFollow `akb guide writing` when editing a card.\n';
63078
63217
  }
63079
63218
  });
63080
63219
 
@@ -63090,7 +63229,7 @@ var init_archive2 = __esm({
63090
63229
  var board_default;
63091
63230
  var init_board3 = __esm({
63092
63231
  "../cli/src/guide/board.md"() {
63093
- 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 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\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";
63232
+ 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 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\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\n## Preview selection\n\n- **Read the Studio first**: before choosing Previews, read the target Studio's `STUDIO.md` (`akb studio file <studio> STUDIO.md`), any linked files it names, and its rules (`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";
63094
63233
  }
63095
63234
  });
63096
63235
 
@@ -63098,7 +63237,23 @@ var init_board3 = __esm({
63098
63237
  var card_chat_default;
63099
63238
  var init_card_chat = __esm({
63100
63239
  "../cli/src/guide/card-chat.md"() {
63101
- 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 task revise <id> "<change>" --print`.\n- **Record an answer**: when the user answers an open question on the card, use `akb task 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 task 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 task 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';
63240
+ card_chat_default = "# Answer a card's conversation\n\nWork only on unlocked stages. An empty plan needs no extra approval; an undecided plan allows planning only.\n\n- **Task and review**: read the current card or use `akb task show <id>` when needed. Use `akb task review <id>` for the full review state and snapshots, and before reporting a stage with its revision. Sync content and assets before reporting done.\n- **Studio and Previews**: when working on a draft, read `akb studio file <studio> STUDIO.md`, shared rules at `shared/RULES.md` when present, and workspace rules with `akb studio rule <studio>`. Use the relevant entries from `akb studio previews --studio <studio> --json` and read component usage with `akb raw components --studio <studio> --docs` when needed. Read only applicable files in the board\u2019s `memory/`.\n- **Button labels**: Quote current labels from the conversation verbatim. Otherwise, consult the task-page guide for the user's language (`akb guide task-ui-en` or `akb guide task-ui-zh`) and describe the action if its label is uncertain.\n\n- **Change requirements or drafts**: when the user changes the scope, expected behavior, or draft, use `akb task revise <id> \"<change>\" --print`.\n- **Record an answer**: when the user answers an open question on the card, use `akb task 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 task 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 task 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";
63241
+ }
63242
+ });
63243
+
63244
+ // ../cli/src/guide/task-ui-en.md
63245
+ var task_ui_en_default;
63246
+ var init_task_ui_en = __esm({
63247
+ "../cli/src/guide/task-ui-en.md"() {
63248
+ task_ui_en_default = "# Task-page buttons\n\n- **Approve** \u2014 In the review flow when a prerequisite Preview is ready for approval. Dependent Previews can start once their prerequisites are approved.\n- **Execute** \u2014 In the header when the task is ready to run. Approves any ready independent Previews and starts execution.\n- **Stop** \u2014 In the header while a run is active and can be stopped.\n- **Resume** \u2014 In the run log for a stopped task or retryable failure when no run is active or queued.\n- **Discard run** \u2014 In the run log when a run can be discarded. Confirming deletes its changes and branch and keeps the task and plan.\n- **Restore** \u2014 In the header for completed or removed tasks with an available Studio. Returns the task to the board.\n";
63249
+ }
63250
+ });
63251
+
63252
+ // ../cli/src/guide/task-ui-zh.md
63253
+ var task_ui_zh_default;
63254
+ var init_task_ui_zh = __esm({
63255
+ "../cli/src/guide/task-ui-zh.md"() {
63256
+ task_ui_zh_default = "# Task-page buttons in Chinese\n\n- **\u6279\u51C6** \u2014 In the review flow when a prerequisite Preview is ready for approval. Dependent Previews can start once their prerequisites are approved.\n- **\u6267\u884C** \u2014 In the header when the task is ready to run. Approves any ready independent Previews and starts execution.\n- **\u505C\u6B62** \u2014 In the header while a run is active and can be stopped.\n- **\u7EE7\u7EED\u6267\u884C** \u2014 In the run log for a stopped task or retryable failure when no run is active or queued.\n- **\u4E22\u5F03\u8FD9\u6B21\u6267\u884C** \u2014 In the run log when a run can be discarded. Confirming deletes its changes and branch and keeps the task and plan.\n- **\u6062\u590D** \u2014 In the header for completed or removed tasks with an available Studio. Returns the task to the board.\n";
63102
63257
  }
63103
63258
  });
63104
63259
 
@@ -63122,7 +63277,7 @@ var init_describe_project = __esm({
63122
63277
  var discuss_goal_default;
63123
63278
  var init_discuss_goal = __esm({
63124
63279
  "../cli/src/guide/discuss-goal.md"() {
63125
- discuss_goal_default = '# Discuss a goal\n\nResearch how the requested outcome can be achieved before defining a Goal. Explain viable approaches and key tradeoffs in the discussion, then save the requested outcome and acceptance criteria.\n\n- **Investigations**: finish checks and diagnosis here; save a change only when findings establish it. Report unverified work plainly.\n- **Goals**: save independent deliverables separately. Update existing goals rather than duplicate them.\n- **Studio**: choose the fitting installed Studio, preferring the user\'s choice; read its Additional Notes with `akb studio rule <studio>` and honor their scope.\n- **Select Previews**: read the chosen Studio\'s `STUDIO.md` with `akb studio file <studio> STUDIO.md` and linked Studio files as needed with `akb studio file <studio> <path>`. Match deliverables that need review to Studio Previews. Define a Goal Preview for a result that needs review and lacks a Studio Preview.\n- **Review** independent Previews in parallel by default. Use Studio or Goal Preview names, e.g. `--review \'Tech choices + UI design\'`. Add `->` when the next group needs the previous group\'s approvals. Verify the saved plan.\n- **Review state**: pass `--review \'\'` for no extra approval, leave the plan undecided while a decision is missing, and omit the option when keeping a saved plan.\n- **Decisions**: ask only about choices the user must make, and recommend an option.\n- **Save**: in a web discussion, use `akb goal` in the current session, including on retry. Say the goal is ready to save when the reply ends. If the command still fails, say it was not saved.\n- **Start**: the user starts each Goal from the page; its effective review arrangement governs output approval. Confirm changes to task-specific Preview definitions before making the affected output.\n- **Communication**: the remote user sees tasks and previews. Use plain words and button labels, omitting internal paths, commands and tools.\n\n## Goal format\n\nUse exactly these three fields on create and update. Include only what the user requested or confirmed.\n\nPass the one-line title separately with `--title`. Use this template for `--body-file`:\n\n```markdown\n<The requested outcome in at most 150 words.>\n\n## Done when\n\n- <A verifiable condition for the requested outcome.>\n```\n\n\n## Custom Preview definitions\n\nPass a JSON array with `--preview-definitions-file`. Use a stable ID, English and Chinese titles, and concise requirements. Omit the file to keep definitions, or pass `[]` to clear them.\n\n```json\n[{\n "id": "accessibility-report",\n "title": {"en": "Accessibility report", "zh": "\u65E0\u969C\u788D\u68C0\u67E5\u62A5\u544A"},\n "instructions": "Check keyboard navigation, visible focus and contrast. Include steps to reproduce issues."\n}]\n```\n\nUse the title in a Flow such as `--review \'UI design -> Accessibility report\'` when preparation requires an earlier approval.\n';
63280
+ discuss_goal_default = '# Discuss a goal\n\nResearch how the requested outcome can be achieved before defining a Goal. Explain viable approaches and key tradeoffs in the discussion, then save the requested outcome and acceptance criteria.\n\n- **Investigations**: finish checks and diagnosis here; save a change only when findings establish it. Report unverified work plainly.\n- **Goals**: save independent deliverables separately. Update existing goals rather than duplicate them.\n- **Studio**: choose the fitting installed Studio, preferring the user\'s choice; honor its rules\' scope.\n- **Select Previews**: follow "Preview selection" in `akb guide board`, defining a custom Preview with `--preview-definitions-file` when needed.\n- **Review** independent Previews in parallel by default. Use Studio or custom Preview names, e.g. `--review \'Tech choices + UI design\'`. Add `->` when the next group needs the previous group\'s approvals. Verify the saved plan.\n- **Review state**: pass `--review \'\'` for no extra approval, leave the plan undecided while a decision is missing, and omit the option when keeping a saved plan.\n- **Decisions**: ask only about choices the user must make, and recommend an option.\n- **Save**: in a web discussion, use `akb goal` in the current session, including on retry. Say the goal is ready to save when the reply ends. If the command still fails, say it was not saved.\n- **Start**: the user starts each Goal from the page; its effective review arrangement governs output approval. Confirm changes to task-specific Preview definitions before making the affected output.\n- **Communication**: the remote user sees tasks and previews. Use plain words and button labels, omitting internal paths, commands and tools.\n\n## Goal format\n\nUse exactly these three fields on create and update. Include only what the user requested or confirmed.\n\nPass the one-line title separately with `--title`. Use this template for `--body-file`:\n\n```markdown\n<The requested outcome in at most 150 words.>\n\n## Done when\n\n- <A verifiable condition for the requested outcome.>\n```\n\n\n## Custom Preview definitions\n\nPass a JSON array with `--preview-definitions-file`. Use a stable ID, English and Chinese titles, and concise requirements. Omit the file to keep definitions, or pass `[]` to clear them.\n\n```json\n[{\n "id": "accessibility-report",\n "title": {"en": "Accessibility report", "zh": "\u65E0\u969C\u788D\u68C0\u67E5\u62A5\u544A"},\n "instructions": "Check keyboard navigation, visible focus and contrast. Include steps to reproduce issues."\n}]\n```\n\nUse the title in a Flow such as `--review \'UI design -> Accessibility report\'` when preparation requires an earlier approval.\n';
63126
63281
  }
63127
63282
  });
63128
63283
 
@@ -63178,7 +63333,7 @@ var init_review_rejections = __esm({
63178
63333
  var refine_default;
63179
63334
  var init_refine = __esm({
63180
63335
  "../cli/src/guide/refine.md"() {
63181
- refine_default = "# Refine a card\n\nPlan one card until it is buildable.\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- **Preview selection**: choose Studio Previews for drafts or results that need review. For a requested result the Studio lacks, attach its definition with `--preview-definitions-file`. Keep task context in the card body.\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 choices supported by evidence and ask 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";
63336
+ refine_default = '# Refine a card\n\nPlan one card until it is buildable.\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- **Preview selection**: follow "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 choices supported by evidence and ask 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';
63182
63337
  }
63183
63338
  });
63184
63339
 
@@ -63283,6 +63438,8 @@ var init_guide = __esm({
63283
63438
  init_archive2();
63284
63439
  init_board3();
63285
63440
  init_card_chat();
63441
+ init_task_ui_en();
63442
+ init_task_ui_zh();
63286
63443
  init_update_studio();
63287
63444
  init_describe_project();
63288
63445
  init_discuss_goal();
@@ -63312,6 +63469,8 @@ var init_guide = __esm({
63312
63469
  { name: "discuss-goal", when: "help decide what is worth building, and shape it into goals to start as tasks", text: discuss_goal_default },
63313
63470
  { name: "troubleshoot", when: "\u5B9A\u4F4D\u8F6F\u4EF6\u6545\u969C\u7684\u6839\u56E0\u4E0E\u4FEE\u590D\u65B9\u5411", text: troubleshoot_default },
63314
63471
  { name: "card-chat", when: "answer a card's conversation, and act on what each turn settles", text: card_chat_default },
63472
+ { name: "task-ui-en", when: "look up task-page buttons in English", text: task_ui_en_default },
63473
+ { name: "task-ui-zh", when: "look up task-page buttons in Chinese", text: task_ui_zh_default },
63315
63474
  { name: "update-studio", when: "change one of this workspace's studios so new tasks run the new version", text: update_studio_default },
63316
63475
  { name: "implement", when: "build a settled card and stop cleanly on an execution blocker", text: implement_default },
63317
63476
  { name: "settle-background", when: "finish this task\u2019s remaining background work", text: settle_background_default },
@@ -66778,11 +66937,11 @@ function declareRuns(program2, cli) {
66778
66937
  withShared(task.command("show")).argument("<task>").summary("a task and its card").action(async function(id2) {
66779
66938
  await boardless(this, cli, (_, location) => taskShow(id2, location));
66780
66939
  });
66781
- withCreateOptions(withShared(task.command("create"))).argument("[request...]", "what the task should do").summary("prepare a task from a request or write a local card from a title").description("Pass a request to prepare a Cloud task asynchronously. Use --title to allocate a number in Cloud and immediately write a card and its index entry to this board. Use --studio with a request. Card fields apply to --title and --project applies to a request. Edit the saved body separately.").option("--project <id>", "for a request: the project; default: this folder\u2019s linked one").action(async function(request2) {
66940
+ withCreateOptions(withShared(task.command("create"))).argument("[request...]", "what the task should do").summary("prepare a task from a request or write a local card from a title").description("Pass a request to prepare a Cloud task asynchronously. Use --title to allocate a number in Cloud and immediately write a card and its index entry to this board. Use --studio with a request. Card fields apply to --title and --project applies to a request. Edit the saved body separately.").option("--project <id>", "for a request: the project; default: this folder\u2019s linked one").option("--review <flow>", "set a review flow using Studio Preview names").option("--review-file <path>", "JSON review nodes with after dependencies; [] needs no extra review").option("--preview-definitions-file <path>", "propose a JSON list of task Preview definitions").action(async function(request2) {
66782
66941
  const opts = this.opts();
66783
66942
  if (opts.title !== void 0) {
66784
- if (request2.length || opts.project !== void 0) {
66785
- die("Use --title with the local board, or pass a request and optionally --project.", "bad-args");
66943
+ if (request2.length || opts.project !== void 0 || opts.review !== void 0 || opts.reviewFile !== void 0 || opts.previewDefinitionsFile !== void 0) {
66944
+ die("Use --title with the local board, or pass a request with --project, --review, --review-file, and --preview-definitions-file.", "bad-args");
66786
66945
  }
66787
66946
  return createBoardCard(this, cli);
66788
66947
  }
@@ -66821,6 +66980,9 @@ function declareRuns(program2, cli) {
66821
66980
  withShared(task.command("resume")).argument("<task>").summary("continue its stopped run").action(async function(id2) {
66822
66981
  await boardless(this, cli, (_, location) => taskResume(id2, location));
66823
66982
  });
66983
+ withShared(task.command("runtime")).argument("<task>").argument("<runtime>").summary("change a task\u2019s runtime").action(async function(id2, runtime) {
66984
+ await boardless(this, cli, (_, location) => taskRuntime(id2, runtime, location));
66985
+ });
66824
66986
  withShared(task.command("stop")).argument("<task>").summary("stop its current run").action(async function(id2) {
66825
66987
  await boardless(this, cli, (_, location) => taskStop(id2, location));
66826
66988
  });