wildcrane 0.11.89 → 0.11.90

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.
Files changed (2) hide show
  1. package/dist/kanban.mjs +228 -66
  2. package/package.json +1 -1
package/dist/kanban.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // ai4kanban 0.11.89 — built from the CLI's TypeScript sources by cli/scripts/build.mjs.
2
+ // ai4kanban 0.11.90 — built from the CLI's TypeScript sources by cli/scripts/build.mjs.
3
3
  // Do not edit: every change belongs in cli/src/, and a build overwrites this file.
4
4
  import { createRequire as __ai4kanbanRequire } from 'node:module'
5
5
  const require = __ai4kanbanRequire(import.meta.url)
@@ -1768,18 +1768,18 @@ var init_parse = __esm({
1768
1768
  return result.issues.length === 0;
1769
1769
  };
1770
1770
  _encode = (_Err) => {
1771
- const parse4 = _parse(_Err);
1771
+ const parse5 = _parse(_Err);
1772
1772
  const fn = (schema, value, _ctx, _params) => {
1773
1773
  const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
1774
- return parse4(schema, value, ctx, finalizeParams(fn, _params));
1774
+ return parse5(schema, value, ctx, finalizeParams(fn, _params));
1775
1775
  };
1776
1776
  return fn;
1777
1777
  };
1778
1778
  encode = /* @__PURE__ */ _encode($ZodRealError);
1779
1779
  _decode = (_Err) => {
1780
- const parse4 = _parse(_Err);
1780
+ const parse5 = _parse(_Err);
1781
1781
  const fn = (schema, value, _ctx, _params) => {
1782
- return parse4(schema, value, _ctx, finalizeParams(fn, _params));
1782
+ return parse5(schema, value, _ctx, finalizeParams(fn, _params));
1783
1783
  };
1784
1784
  return fn;
1785
1785
  };
@@ -2704,7 +2704,7 @@ function capSize(inst, size) {
2704
2704
  if (!caps.length)
2705
2705
  return;
2706
2706
  const cap = Math.min(...caps.map((c) => c[0]));
2707
- const parse4 = inst._zod.parse;
2707
+ const parse5 = inst._zod.parse;
2708
2708
  inst._zod.parse = (payload, ctx) => {
2709
2709
  const n = size(payload.value);
2710
2710
  if (n > cap && !ctx?.skipChecks && ctx?.direction !== "backward") {
@@ -2718,7 +2718,7 @@ function capSize(inst, size) {
2718
2718
  }
2719
2719
  }
2720
2720
  }
2721
- return parse4(payload, ctx);
2721
+ return parse5(payload, ctx);
2722
2722
  };
2723
2723
  }
2724
2724
  function handleArrayResult(result, final, index) {
@@ -20910,6 +20910,9 @@ function withoutCode(source2) {
20910
20910
  return line;
20911
20911
  }).join("").replace(/(`+)([^]*?)\1(?!`)/g, blank);
20912
20912
  }
20913
+ function agentSectionOffset(source2) {
20914
+ return /^<!--[ \t]*agent[ \t]*-->/m.exec(withoutCode(source2))?.index ?? source2.length;
20915
+ }
20913
20916
  function parsePreviewBlocks(source2, file2 = "STUDIO.md") {
20914
20917
  const blocks = [], problems = [];
20915
20918
  const masked = withoutCode(source2);
@@ -22833,7 +22836,7 @@ var init_package = __esm({
22833
22836
  "package.json"() {
22834
22837
  package_default = {
22835
22838
  name: "wildcrane",
22836
- version: "0.11.89",
22839
+ version: "0.11.90",
22837
22840
  akbContract: 29,
22838
22841
  canonicalCommands: true,
22839
22842
  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.",
@@ -25959,7 +25962,7 @@ var CONVERSATION_MS;
25959
25962
  var init_conversation = __esm({
25960
25963
  "src/lib/shared/conversation.ts"() {
25961
25964
  "use strict";
25962
- CONVERSATION_MS = { send: 15e3, claim: 3e4, prepare: 6e4, start: 15e3, startup: 12e4, quiet: 6e4, stop: 1e4 };
25965
+ CONVERSATION_MS = { send: 15e3, prepare: 6e4, start: 15e3, stop: 1e4 };
25963
25966
  }
25964
25967
  });
25965
25968
 
@@ -29809,10 +29812,10 @@ var require_code = __commonJS({
29809
29812
  function interpolate(x) {
29810
29813
  return typeof x == "number" || typeof x == "boolean" || x === null ? x : safeStringify(Array.isArray(x) ? x.join(",") : x);
29811
29814
  }
29812
- function stringify(x) {
29815
+ function stringify2(x) {
29813
29816
  return new _Code(safeStringify(x));
29814
29817
  }
29815
- exports.stringify = stringify;
29818
+ exports.stringify = stringify2;
29816
29819
  function safeStringify(x) {
29817
29820
  return JSON.stringify(x).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
29818
29821
  }
@@ -33507,7 +33510,7 @@ var require_fast_uri = __commonJS({
33507
33510
  normalizeString(uri, options);
33508
33511
  } else if (typeof uri === "object") {
33509
33512
  uri = /** @type {T} */
33510
- parse4(serialize2(uri, options), options);
33513
+ parse5(serialize2(uri, options), options);
33511
33514
  }
33512
33515
  return uri;
33513
33516
  }
@@ -33550,8 +33553,8 @@ var require_fast_uri = __commonJS({
33550
33553
  function resolveComponent(base, relative, options, skipNormalization) {
33551
33554
  const target = {};
33552
33555
  if (!skipNormalization) {
33553
- base = parse4(serialize2(base, options), options);
33554
- relative = parse4(serialize2(relative, options), options);
33556
+ base = parse5(serialize2(base, options), options);
33557
+ relative = parse5(serialize2(relative, options), options);
33555
33558
  }
33556
33559
  options = options || {};
33557
33560
  if (!options.tolerant && relative.scheme) {
@@ -33869,7 +33872,7 @@ var require_fast_uri = __commonJS({
33869
33872
  }
33870
33873
  return { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme };
33871
33874
  }
33872
- function parse4(uri, opts) {
33875
+ function parse5(uri, opts) {
33873
33876
  return parseWithStatus(uri, opts).parsed;
33874
33877
  }
33875
33878
  function normalizeString(uri, opts) {
@@ -33906,7 +33909,7 @@ var require_fast_uri = __commonJS({
33906
33909
  resolveComponent,
33907
33910
  equal,
33908
33911
  serialize: serialize2,
33909
- parse: parse4
33912
+ parse: parse5
33910
33913
  };
33911
33914
  module.exports = fastUri;
33912
33915
  module.exports.default = fastUri;
@@ -37894,7 +37897,7 @@ var require_stringify = __commonJS({
37894
37897
  props.push(doc.directives.tagString(tag));
37895
37898
  return props.join(" ");
37896
37899
  }
37897
- function stringify(item, ctx, onComment, onChompKeep) {
37900
+ function stringify2(item, ctx, onComment, onChompKeep) {
37898
37901
  if (identity.isPair(item))
37899
37902
  return item.toString(ctx, onComment, onChompKeep);
37900
37903
  if (identity.isAlias(item)) {
@@ -37923,7 +37926,7 @@ var require_stringify = __commonJS({
37923
37926
  ${ctx.indent}${str5}`;
37924
37927
  }
37925
37928
  exports.createStringifyContext = createStringifyContext;
37926
- exports.stringify = stringify;
37929
+ exports.stringify = stringify2;
37927
37930
  }
37928
37931
  });
37929
37932
 
@@ -37933,7 +37936,7 @@ var require_stringifyPair = __commonJS({
37933
37936
  "use strict";
37934
37937
  var identity = require_identity();
37935
37938
  var Scalar = require_Scalar();
37936
- var stringify = require_stringify();
37939
+ var stringify2 = require_stringify();
37937
37940
  var stringifyComment = require_stringifyComment();
37938
37941
  function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
37939
37942
  const { allNullValues, doc, indent: indent2, indentStep, options: { commentString, indentSeq, simpleKeys } } = ctx;
@@ -37955,7 +37958,7 @@ var require_stringifyPair = __commonJS({
37955
37958
  });
37956
37959
  let keyCommentDone = false;
37957
37960
  let chompKeep = false;
37958
- let str5 = stringify.stringify(key, ctx, () => keyCommentDone = true, () => chompKeep = true);
37961
+ let str5 = stringify2.stringify(key, ctx, () => keyCommentDone = true, () => chompKeep = true);
37959
37962
  if (!explicitKey && !ctx.inFlow && str5.length > 1024) {
37960
37963
  if (simpleKeys)
37961
37964
  throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
@@ -38007,7 +38010,7 @@ ${indent2}:`;
38007
38010
  ctx.indent = ctx.indent.substring(2);
38008
38011
  }
38009
38012
  let valueCommentDone = false;
38010
- const valueStr = stringify.stringify(value, ctx, () => valueCommentDone = true, () => chompKeep = true);
38013
+ const valueStr = stringify2.stringify(value, ctx, () => valueCommentDone = true, () => chompKeep = true);
38011
38014
  let ws = " ";
38012
38015
  if (keyComment || vsb || vcb) {
38013
38016
  ws = vsb ? "\n" : "";
@@ -38148,7 +38151,7 @@ var require_addPairToJSMap = __commonJS({
38148
38151
  "use strict";
38149
38152
  var log = require_log();
38150
38153
  var merge2 = require_merge();
38151
- var stringify = require_stringify();
38154
+ var stringify2 = require_stringify();
38152
38155
  var identity = require_identity();
38153
38156
  var toJS = require_toJS();
38154
38157
  function addPairToJSMap(ctx, map3, { key, value }) {
@@ -38184,7 +38187,7 @@ var require_addPairToJSMap = __commonJS({
38184
38187
  if (typeof jsKey !== "object")
38185
38188
  return String(jsKey);
38186
38189
  if (identity.isNode(key) && ctx?.doc) {
38187
- const strCtx = stringify.createStringifyContext(ctx.doc, {});
38190
+ const strCtx = stringify2.createStringifyContext(ctx.doc, {});
38188
38191
  strCtx.anchors = /* @__PURE__ */ new Set();
38189
38192
  for (const node2 of ctx.anchors.keys())
38190
38193
  strCtx.anchors.add(node2.anchor);
@@ -38251,12 +38254,12 @@ var require_stringifyCollection = __commonJS({
38251
38254
  "node_modules/yaml/dist/stringify/stringifyCollection.js"(exports) {
38252
38255
  "use strict";
38253
38256
  var identity = require_identity();
38254
- var stringify = require_stringify();
38257
+ var stringify2 = require_stringify();
38255
38258
  var stringifyComment = require_stringifyComment();
38256
38259
  function stringifyCollection(collection, ctx, options) {
38257
38260
  const flow = ctx.inFlow ?? collection.flow;
38258
- const stringify2 = flow ? stringifyFlowCollection : stringifyBlockCollection;
38259
- return stringify2(collection, ctx, options);
38261
+ const stringify3 = flow ? stringifyFlowCollection : stringifyBlockCollection;
38262
+ return stringify3(collection, ctx, options);
38260
38263
  }
38261
38264
  function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, flowChars, itemIndent, onChompKeep, onComment }) {
38262
38265
  const { indent: indent2, options: { commentString } } = ctx;
@@ -38281,7 +38284,7 @@ var require_stringifyCollection = __commonJS({
38281
38284
  }
38282
38285
  }
38283
38286
  chompKeep = false;
38284
- let str6 = stringify.stringify(item, itemCtx, () => comment2 = null, () => chompKeep = true);
38287
+ let str6 = stringify2.stringify(item, itemCtx, () => comment2 = null, () => chompKeep = true);
38285
38288
  if (comment2)
38286
38289
  str6 += stringifyComment.lineComment(str6, itemIndent, commentString(comment2));
38287
38290
  if (chompKeep && comment2)
@@ -38348,7 +38351,7 @@ ${indent2}${line}` : "\n";
38348
38351
  }
38349
38352
  if (comment)
38350
38353
  reqNewline = true;
38351
- let str5 = stringify.stringify(item, itemCtx, () => comment = null);
38354
+ let str5 = stringify2.stringify(item, itemCtx, () => comment = null);
38352
38355
  reqNewline || (reqNewline = lines.length > linesAtValue || str5.includes("\n"));
38353
38356
  if (i < items.length - 1) {
38354
38357
  str5 += ",";
@@ -39709,7 +39712,7 @@ var require_stringifyDocument = __commonJS({
39709
39712
  "node_modules/yaml/dist/stringify/stringifyDocument.js"(exports) {
39710
39713
  "use strict";
39711
39714
  var identity = require_identity();
39712
- var stringify = require_stringify();
39715
+ var stringify2 = require_stringify();
39713
39716
  var stringifyComment = require_stringifyComment();
39714
39717
  function stringifyDocument(doc, options) {
39715
39718
  const lines = [];
@@ -39724,7 +39727,7 @@ var require_stringifyDocument = __commonJS({
39724
39727
  }
39725
39728
  if (hasDirectives)
39726
39729
  lines.push("---");
39727
- const ctx = stringify.createStringifyContext(doc, options);
39730
+ const ctx = stringify2.createStringifyContext(doc, options);
39728
39731
  const { commentString } = ctx.options;
39729
39732
  if (doc.commentBefore) {
39730
39733
  if (lines.length !== 1)
@@ -39746,7 +39749,7 @@ var require_stringifyDocument = __commonJS({
39746
39749
  contentComment = doc.contents.comment;
39747
39750
  }
39748
39751
  const onChompKeep = contentComment ? void 0 : () => chompKeep = true;
39749
- let body = stringify.stringify(doc.contents, ctx, () => contentComment = null, onChompKeep);
39752
+ let body = stringify2.stringify(doc.contents, ctx, () => contentComment = null, onChompKeep);
39750
39753
  if (contentComment)
39751
39754
  body += stringifyComment.lineComment(body, "", commentString(contentComment));
39752
39755
  if ((body[0] === "|" || body[0] === ">") && lines[lines.length - 1] === "---") {
@@ -39754,7 +39757,7 @@ var require_stringifyDocument = __commonJS({
39754
39757
  } else
39755
39758
  lines.push(body);
39756
39759
  } else {
39757
- lines.push(stringify.stringify(doc.contents, ctx));
39760
+ lines.push(stringify2.stringify(doc.contents, ctx));
39758
39761
  }
39759
39762
  if (doc.directives?.docEnd) {
39760
39763
  if (doc.comment) {
@@ -41890,7 +41893,7 @@ var require_cst_scalar = __commonJS({
41890
41893
  var require_cst_stringify = __commonJS({
41891
41894
  "node_modules/yaml/dist/parse/cst-stringify.js"(exports) {
41892
41895
  "use strict";
41893
- var stringify = (cst) => "type" in cst ? stringifyToken(cst) : stringifyItem(cst);
41896
+ var stringify2 = (cst) => "type" in cst ? stringifyToken(cst) : stringifyItem(cst);
41894
41897
  function stringifyToken(token2) {
41895
41898
  switch (token2.type) {
41896
41899
  case "block-scalar": {
@@ -41943,7 +41946,7 @@ var require_cst_stringify = __commonJS({
41943
41946
  res += stringifyToken(value);
41944
41947
  return res;
41945
41948
  }
41946
- exports.stringify = stringify;
41949
+ exports.stringify = stringify2;
41947
41950
  }
41948
41951
  });
41949
41952
 
@@ -43654,7 +43657,7 @@ var require_public_api = __commonJS({
43654
43657
  }
43655
43658
  return doc;
43656
43659
  }
43657
- function parse4(src, reviver, options) {
43660
+ function parse5(src, reviver, options) {
43658
43661
  let _reviver = void 0;
43659
43662
  if (typeof reviver === "function") {
43660
43663
  _reviver = reviver;
@@ -43673,7 +43676,7 @@ var require_public_api = __commonJS({
43673
43676
  }
43674
43677
  return doc.toJS(Object.assign({ reviver: _reviver }, options));
43675
43678
  }
43676
- function stringify(value, replacer, options) {
43679
+ function stringify2(value, replacer, options) {
43677
43680
  let _replacer = null;
43678
43681
  if (typeof replacer === "function" || Array.isArray(replacer)) {
43679
43682
  _replacer = replacer;
@@ -43695,10 +43698,10 @@ var require_public_api = __commonJS({
43695
43698
  return value.toString(options);
43696
43699
  return new Document.Document(value, _replacer, options).toString(options);
43697
43700
  }
43698
- exports.parse = parse4;
43701
+ exports.parse = parse5;
43699
43702
  exports.parseAllDocuments = parseAllDocuments;
43700
43703
  exports.parseDocument = parseDocument3;
43701
- exports.stringify = stringify;
43704
+ exports.stringify = stringify2;
43702
43705
  }
43703
43706
  });
43704
43707
 
@@ -43992,7 +43995,7 @@ var GUIDE_TOPICS;
43992
43995
  var init_guide_topics = __esm({
43993
43996
  "src/lib/shared/guide-topics.ts"() {
43994
43997
  "use strict";
43995
- 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"];
43998
+ 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"];
43996
43999
  }
43997
44000
  });
43998
44001
 
@@ -44229,7 +44232,7 @@ function heldStudioName(name) {
44229
44232
  }
44230
44233
  function saveVersion(held4) {
44231
44234
  const file2 = versionFile(held4.id, held4.version);
44232
- if (!fs32.existsSync(file2)) writeJson(file2, { id: held4.id, version: held4.version, name: held4.name, names: held4.names, files: held4.files });
44235
+ writeJson(file2, { id: held4.id, version: held4.version, name: held4.name, names: held4.names, files: held4.files });
44233
44236
  }
44234
44237
  function savePin(task, held4) {
44235
44238
  saveVersion(held4);
@@ -44262,14 +44265,24 @@ async function versionOf(id2, version2) {
44262
44265
  return read5;
44263
44266
  }
44264
44267
  async function pinTask(task) {
44265
- const pin = readPin(task);
44266
- const held4 = pin && readVersion(pin.studio, pin.version);
44267
- if (held4 && "def" in parseStudioFile("studio", held4.files["STUDIO.md"] ?? "", "STUDIO.md")) return { ok: true, value: held4 };
44268
+ const cached3 = sessionTaskStudios.get(task);
44269
+ if (cached3) return { ok: true, value: cached3 };
44268
44270
  const read5 = await call("GET", `/v1/tasks/${encodeURIComponent(task)}/studio`);
44269
44271
  if (!read5.ok) return read5;
44270
- if (!hasText(read5.value.studio) || !isStudioVersion(read5.value.version) || !isStudioFiles(read5.value.files)) return invalid("the task\u2019s Studio version");
44271
- const value = { id: read5.value.studio, version: read5.value.version, name: read5.value.name, files: read5.value.files, historicalPreviews: read5.value.historicalPreviews };
44272
+ if (read5.value.deleted) {
44273
+ const pin = readPin(task);
44274
+ const held4 = pin && readVersion(pin.studio, pin.version);
44275
+ if (held4) {
44276
+ sessionTaskStudios.set(task, held4);
44277
+ return { ok: true, value: held4 };
44278
+ }
44279
+ return invalid("the task\u2019s Studio");
44280
+ }
44281
+ if (!hasText(read5.value.studio) || !isStudioFiles(read5.value.files)) return invalid("the task\u2019s Studio");
44282
+ const version2 = isStudioVersion(read5.value.version) ? read5.value.version : 1;
44283
+ const value = { id: read5.value.studio, version: version2, name: read5.value.name, files: read5.value.files, historicalPreviews: read5.value.historicalPreviews };
44272
44284
  savePin(task, value);
44285
+ sessionTaskStudios.set(task, value);
44273
44286
  return { ok: true, value };
44274
44287
  }
44275
44288
  async function syncStudios(force = false) {
@@ -44371,7 +44384,7 @@ function taskHistoricalPreviews() {
44371
44384
  const task = workspaceTask();
44372
44385
  return task ? Object.keys(readPin(task)?.historicalPreviews ?? {}) : [];
44373
44386
  }
44374
- 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;
44387
+ 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;
44375
44388
  var init_cloud_studios = __esm({
44376
44389
  "src/lib/agent/cloud-studios.ts"() {
44377
44390
  "use strict";
@@ -44401,6 +44414,7 @@ var init_cloud_studios = __esm({
44401
44414
  verification = { cached: false };
44402
44415
  studioVerification = () => verification;
44403
44416
  isStudioVersion = (value) => typeof value === "number" && Number.isSafeInteger(value) && value > 0;
44417
+ sessionTaskStudios = /* @__PURE__ */ new Map();
44404
44418
  flowOf = (held4) => {
44405
44419
  const id2 = studioName(held4.id);
44406
44420
  const read5 = parseStudioFile(id2, held4.files["STUDIO.md"] ?? "", `the \`${id2}\` studio`);
@@ -56380,6 +56394,99 @@ var init_shared_memory = __esm({
56380
56394
  }
56381
56395
  });
56382
56396
 
56397
+ // src/lib/shared/coding-previews.ts
56398
+ var CODING_PREVIEWS;
56399
+ var init_coding_previews = __esm({
56400
+ "src/lib/shared/coding-previews.ts"() {
56401
+ "use strict";
56402
+ CODING_PREVIEWS = {
56403
+ "tech-stack-advisor": "tech-choices",
56404
+ "email-planner": "emails",
56405
+ "ui-designer": "ui-design",
56406
+ "api-designer": "api-docs",
56407
+ "schema-designer": "schema",
56408
+ "prompt-writer": "prompts",
56409
+ "competitor-research": "competitor-research"
56410
+ };
56411
+ }
56412
+ });
56413
+
56414
+ // src/lib/shared/studio-migration.ts
56415
+ function migrateTask(body, previews, ids, historical = {}) {
56416
+ historical = { ...historical };
56417
+ const historicalId = (name) => {
56418
+ const id2 = `historical-${name}`;
56419
+ if (Object.values(ids).includes(id2)) throw Error(`Historical Preview ${name} collides with defined Preview ${id2}`);
56420
+ return id2;
56421
+ };
56422
+ for (const name of previews) if (!ids[name] && !Object.values(ids).includes(name) && !Object.hasOwn(historical, name)) historical[historicalId(name)] ??= { title: { en: name } };
56423
+ const marker = agentSectionOffset(body);
56424
+ const head2 = body.slice(0, marker), tail = body.slice(marker);
56425
+ const headings = [...withoutCode(head2).matchAll(/^##[ \t]+[^\n]*$/gm)];
56426
+ const groups = /* @__PURE__ */ new Map(), chunks = [];
56427
+ let at = 0;
56428
+ for (let n = 0; n < headings.length; n++) {
56429
+ const heading = headings[n], name = /^##[ \t]+By[ \t]+`([^`]+)`[ \t]+agent[ \t]*$/.exec(head2.slice(heading.index, heading.index + heading[0].length))?.[1];
56430
+ if (!name) continue;
56431
+ const end2 = headings[n + 1]?.index ?? head2.length;
56432
+ const id2 = ids[name] ?? historicalId(name);
56433
+ if (!ids[name]) historical[id2] ??= { title: { en: name } };
56434
+ const result = head2.slice(heading.index + heading[0].length, end2).trim();
56435
+ if (!result) continue;
56436
+ chunks.push({ text: head2.slice(at, heading.index) });
56437
+ const parts = groups.get(id2) ?? [];
56438
+ if (!groups.has(id2)) chunks.push({ text: `\0${id2}\0` });
56439
+ parts.push(result);
56440
+ groups.set(id2, parts);
56441
+ at = end2;
56442
+ }
56443
+ chunks.push({ text: head2.slice(at) });
56444
+ const migrated = chunks.map((c) => c.text.replace(/\u0000([^\u0000]+)\u0000/g, (_, id2) => `<Preview id="${id2}">
56445
+
56446
+ ${groups.get(id2).join("\n\n")}
56447
+
56448
+ </Preview>
56449
+
56450
+ `)).join("") + tail;
56451
+ const parsed = parsePreviewBlocks(migrated);
56452
+ if (parsed.problems.length) throw Error(parsed.problems.map((p) => p.message).join("; "));
56453
+ return { body: migrated, previews: [...new Set(previews.map((p) => ids[p] ?? (historical[`historical-${p}`] ? `historical-${p}` : p)))], historical };
56454
+ }
56455
+ function migrateHistoricalArchive(content, base) {
56456
+ const roleHeading = /^##[ \t]+By[ \t]+[^\n]*agent[ \t]*$/gm;
56457
+ if (content.search(roleHeading) < 0) return content;
56458
+ const original = parseFrontmatter(content).meta?.studio;
56459
+ const target = base ? parseFrontmatter(base).meta?.studio : void 0;
56460
+ if ([original, target].some((id2) => id2 && id2 !== "coding")) return content;
56461
+ const headings = [...withoutCode(content).matchAll(roleHeading)];
56462
+ if (!headings.length) return content;
56463
+ const ids = new Set(base ? parsePreviewBlocks(base).blocks.map((block) => block.id) : []);
56464
+ if (!ids.size && original !== "coding") return content;
56465
+ if (headings.some(({ index, 0: line }) => {
56466
+ const name = /^##[ \t]+By[ \t]+`([^`]+)`[ \t]+agent[ \t]*$/.exec(content.slice(index, index + line.length))?.[1];
56467
+ return !name || !Object.hasOwn(CODING_PREVIEWS, name) || !!ids.size && !ids.has(CODING_PREVIEWS[name]);
56468
+ })) return content;
56469
+ try {
56470
+ const migrated = migrateTask(content, [], CODING_PREVIEWS).body;
56471
+ if (withoutCode(migrated).search(roleHeading) < 0) return migrated;
56472
+ } catch {
56473
+ }
56474
+ return content;
56475
+ }
56476
+ var import_yaml9;
56477
+ var init_studio_migration = __esm({
56478
+ "src/lib/shared/studio-migration.ts"() {
56479
+ "use strict";
56480
+ init_frontmatter();
56481
+ import_yaml9 = __toESM(require_dist(), 1);
56482
+ init_parse3();
56483
+ init_studio_def();
56484
+ init_preview_blocks();
56485
+ init_coding_previews();
56486
+ init_coding_previews();
56487
+ }
56488
+ });
56489
+
56383
56490
  // src/lib/shared/board-conflicts.ts
56384
56491
  import crypto4 from "node:crypto";
56385
56492
  import fs65 from "node:fs";
@@ -56498,7 +56605,7 @@ function resolutionOf(record2, value) {
56498
56605
  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");
56499
56606
  if (numberOfCard(f.path) !== null && f.content !== null) {
56500
56607
  const front = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(f.content)?.[1];
56501
- const parsed = (0, import_yaml9.parseDocument)(front ?? "");
56608
+ const parsed = (0, import_yaml10.parseDocument)(front ?? "");
56502
56609
  const fields2 = parsed.toJS();
56503
56610
  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");
56504
56611
  const meta3 = parseFrontmatter(f.content).meta;
@@ -56605,9 +56712,15 @@ async function resolveConflict(board2, project2, id2, expect, value, transport)
56605
56712
  save2(board2, r);
56606
56713
  refuse(r, "Another batch member changed locally. Read the conflict again.");
56607
56714
  }
56608
- 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 }));
56715
+ const writes = r.files.map((f) => {
56716
+ const result = files.find((v) => v.path === f.path);
56717
+ const content = result ? result.content : f.automatic ? f.automatic.content : f.local.content;
56718
+ 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 };
56719
+ });
56609
56720
  r.draft = { revision: expect, files, working, writes };
56610
56721
  save2(board2, r);
56722
+ const oversized = writes.find((w) => w.content !== null && Buffer.byteLength(w.content) > BOARD_FILE_LIMIT);
56723
+ if (oversized) refuse(r, `${oversized.path} exceeds the board file limit.`, "cloud-refused");
56611
56724
  const remote2 = await transport.read(project2);
56612
56725
  if (!remote2.ok) refuse(r, remote2.error, "cloud-refused");
56613
56726
  const versions = r.files.map((f) => remote2.value.files.find((v) => v.path === f.remotePath) ?? { path: f.remotePath, seq: 0, content: null });
@@ -56643,11 +56756,11 @@ async function resolveConflict(board2, project2, id2, expect, value, transport)
56643
56756
  return { id: id2, state: r.state, receipt: r.receipt };
56644
56757
  });
56645
56758
  }
56646
- var import_yaml9, digest, folder, fileOf, pendingConflicts, conflictList;
56759
+ var import_yaml10, digest, folder, fileOf, pendingConflicts, conflictList;
56647
56760
  var init_board_conflicts = __esm({
56648
56761
  "src/lib/shared/board-conflicts.ts"() {
56649
56762
  "use strict";
56650
- import_yaml9 = __toESM(require_dist(), 1);
56763
+ import_yaml10 = __toESM(require_dist(), 1);
56651
56764
  init_shared_memory();
56652
56765
  init_io();
56653
56766
  init_lock();
@@ -56655,6 +56768,7 @@ var init_board_conflicts = __esm({
56655
56768
  init_board_files();
56656
56769
  init_tasks();
56657
56770
  init_frontmatter();
56771
+ init_studio_migration();
56658
56772
  digest = (value) => crypto4.createHash("sha256").update(JSON.stringify(value)).digest("hex");
56659
56773
  folder = (board2) => path67.join(projectStateDir(board2), "conflicts");
56660
56774
  fileOf = (board2, id2) => {
@@ -57690,18 +57804,25 @@ ${card.body.trim()}`);
57690
57804
  async function taskCreate(request2, opts, location = {}) {
57691
57805
  const text5 = request2.trim();
57692
57806
  if (!text5) die("Say what the task is.", { kind: "bad-args", exitCode: 2 });
57807
+ if (opts.review !== void 0 && opts.reviewFile !== void 0) die("Use either --review or --review-file.");
57693
57808
  const line = text5.split("\n")[0].trim();
57694
57809
  const title = line.length > 80 ? `${line.slice(0, 79)}\u2026` : line;
57695
57810
  const target = await project(opts.project, location);
57696
57811
  if (!opts.studio?.trim()) return refuse3("Choose --studio from akb studio list.", "no_studio");
57697
- const task = await cloud("POST", "/v1/tasks", {
57812
+ const body = {
57698
57813
  title,
57699
57814
  request: text5,
57700
57815
  project: target,
57701
57816
  studio: cloudStudio(opts.studio),
57702
57817
  source: "api",
57703
57818
  run: true
57704
- });
57819
+ };
57820
+ if (opts.review !== void 0) body.review_flow = opts.review;
57821
+ if (opts.reviewFile !== void 0) body.review_plan = parseReviewPlan(JSON.parse(fs71.readFileSync(opts.reviewFile, "utf8")));
57822
+ if (opts.previewDefinitionsFile !== void 0) {
57823
+ body.preview_definitions = previewDefinitionsSchema.parse(JSON.parse(fs71.readFileSync(opts.previewDefinitionsFile, "utf8")));
57824
+ }
57825
+ const task = await cloud("POST", "/v1/tasks", body);
57705
57826
  say(`Created ${task.key}: ${task.title} ${taskUrl(task.key)}`);
57706
57827
  say(`Status: ${task.status}${task.failure ? ` \u2014 ${task.failure}` : ""}`);
57707
57828
  return { ...task };
@@ -57999,6 +58120,24 @@ async function taskResume(id2, location = {}) {
57999
58120
  say(task.status === "queued" ? `Resume queued for ${task.key}.` : `Resumed ${task.key}.`);
58000
58121
  return { ...task };
58001
58122
  }
58123
+ async function resolveCloudRuntime(asked) {
58124
+ const value = asked.trim();
58125
+ if (!value) die("Specify a runtime id or name.", { kind: "bad-args", exitCode: 2 });
58126
+ if (value.startsWith("rt_")) return value;
58127
+ const list3 = await cloud("GET", "/v1/runtimes");
58128
+ requireResponse(list3, "a list of runtimes", (v) => Array.isArray(v.data));
58129
+ const matches = list3.data.filter((r) => r.name === value || r.default && value === "Global default");
58130
+ if (!matches.length) return refuse3(`No runtime named "${value}".`, "not_found");
58131
+ if (matches.length > 1) return refuse3(`Multiple runtimes are named "${value}". Use its rt_... id instead.`, "conflict");
58132
+ return matches[0].id;
58133
+ }
58134
+ async function taskRuntime(id2, runtime, location = {}) {
58135
+ const runtimeId = await resolveCloudRuntime(runtime);
58136
+ const ref = await taskRef(id2, location);
58137
+ const task = requireTask(await cloud("PATCH", `/v1/tasks/${enc(ref)}`, { runtime: runtimeId }));
58138
+ say(`Updated ${task.key} runtime to ${task.runtime_info?.name ?? runtimeId}.`);
58139
+ return { ...task };
58140
+ }
58002
58141
  async function taskStop(id2, location = {}) {
58003
58142
  const task = requireTask(await cloud("POST", `/v1/tasks/${enc(await taskRef(id2, location))}/stop`));
58004
58143
  requireResponse(task, "a stop receipt", (value) => ["running", "queued", "waiting_review", "stopped"].includes(value.status));
@@ -61139,7 +61278,7 @@ var require_extension = __commonJS({
61139
61278
  if (dest[name] === void 0) dest[name] = [elem];
61140
61279
  else dest[name].push(elem);
61141
61280
  }
61142
- function parse4(header) {
61281
+ function parse5(header) {
61143
61282
  const offers = /* @__PURE__ */ Object.create(null);
61144
61283
  let params = /* @__PURE__ */ Object.create(null);
61145
61284
  let mustUnescape = false;
@@ -61279,7 +61418,7 @@ var require_extension = __commonJS({
61279
61418
  }).join(", ");
61280
61419
  }).join(", ");
61281
61420
  }
61282
- module.exports = { format, parse: parse4 };
61421
+ module.exports = { format, parse: parse5 };
61283
61422
  }
61284
61423
  });
61285
61424
 
@@ -61314,7 +61453,7 @@ var require_websocket = __commonJS({
61314
61453
  var {
61315
61454
  EventTarget: { addEventListener, removeEventListener }
61316
61455
  } = require_event_target();
61317
- var { format, parse: parse4 } = require_extension();
61456
+ var { format, parse: parse5 } = require_extension();
61318
61457
  var { toBuffer } = require_buffer_util();
61319
61458
  var kAborted = /* @__PURE__ */ Symbol("kAborted");
61320
61459
  var protocolVersions = [8, 13];
@@ -62014,7 +62153,7 @@ var require_websocket = __commonJS({
62014
62153
  }
62015
62154
  let extensions;
62016
62155
  try {
62017
- extensions = parse4(secWebSocketExtensions);
62156
+ extensions = parse5(secWebSocketExtensions);
62018
62157
  } catch (err) {
62019
62158
  const message = "Invalid Sec-WebSocket-Extensions header";
62020
62159
  abortHandshake(websocket, socket, message);
@@ -62322,7 +62461,7 @@ var require_subprotocol = __commonJS({
62322
62461
  "node_modules/ws/lib/subprotocol.js"(exports, module) {
62323
62462
  "use strict";
62324
62463
  var { tokenChars } = require_validation2();
62325
- function parse4(header) {
62464
+ function parse5(header) {
62326
62465
  const protocols = /* @__PURE__ */ new Set();
62327
62466
  let start = -1;
62328
62467
  let end2 = -1;
@@ -62358,7 +62497,7 @@ var require_subprotocol = __commonJS({
62358
62497
  protocols.add(protocol);
62359
62498
  return protocols;
62360
62499
  }
62361
- module.exports = { parse: parse4 };
62500
+ module.exports = { parse: parse5 };
62362
62501
  }
62363
62502
  });
62364
62503
 
@@ -63075,7 +63214,7 @@ var init_task_chat = __esm({
63075
63214
  var add_task_default;
63076
63215
  var init_add_task = __esm({
63077
63216
  "src/guide/add-task.md"() {
63078
- 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";
63217
+ 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';
63079
63218
  }
63080
63219
  });
63081
63220
 
@@ -63091,7 +63230,7 @@ var init_archive2 = __esm({
63091
63230
  var board_default;
63092
63231
  var init_board3 = __esm({
63093
63232
  "src/guide/board.md"() {
63094
- 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";
63233
+ 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";
63095
63234
  }
63096
63235
  });
63097
63236
 
@@ -63099,7 +63238,23 @@ var init_board3 = __esm({
63099
63238
  var card_chat_default;
63100
63239
  var init_card_chat = __esm({
63101
63240
  "src/guide/card-chat.md"() {
63102
- 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';
63241
+ 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";
63242
+ }
63243
+ });
63244
+
63245
+ // src/guide/task-ui-en.md
63246
+ var task_ui_en_default;
63247
+ var init_task_ui_en = __esm({
63248
+ "src/guide/task-ui-en.md"() {
63249
+ 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";
63250
+ }
63251
+ });
63252
+
63253
+ // src/guide/task-ui-zh.md
63254
+ var task_ui_zh_default;
63255
+ var init_task_ui_zh = __esm({
63256
+ "src/guide/task-ui-zh.md"() {
63257
+ 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";
63103
63258
  }
63104
63259
  });
63105
63260
 
@@ -63123,7 +63278,7 @@ var init_describe_project = __esm({
63123
63278
  var discuss_goal_default;
63124
63279
  var init_discuss_goal = __esm({
63125
63280
  "src/guide/discuss-goal.md"() {
63126
- 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';
63281
+ 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';
63127
63282
  }
63128
63283
  });
63129
63284
 
@@ -63179,7 +63334,7 @@ var init_review_rejections = __esm({
63179
63334
  var refine_default;
63180
63335
  var init_refine = __esm({
63181
63336
  "src/guide/refine.md"() {
63182
- 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";
63337
+ 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';
63183
63338
  }
63184
63339
  });
63185
63340
 
@@ -63284,6 +63439,8 @@ var init_guide = __esm({
63284
63439
  init_archive2();
63285
63440
  init_board3();
63286
63441
  init_card_chat();
63442
+ init_task_ui_en();
63443
+ init_task_ui_zh();
63287
63444
  init_update_studio();
63288
63445
  init_describe_project();
63289
63446
  init_discuss_goal();
@@ -63313,6 +63470,8 @@ var init_guide = __esm({
63313
63470
  { name: "discuss-goal", when: "help decide what is worth building, and shape it into goals to start as tasks", text: discuss_goal_default },
63314
63471
  { name: "troubleshoot", when: "\u5B9A\u4F4D\u8F6F\u4EF6\u6545\u969C\u7684\u6839\u56E0\u4E0E\u4FEE\u590D\u65B9\u5411", text: troubleshoot_default },
63315
63472
  { name: "card-chat", when: "answer a card's conversation, and act on what each turn settles", text: card_chat_default },
63473
+ { name: "task-ui-en", when: "look up task-page buttons in English", text: task_ui_en_default },
63474
+ { name: "task-ui-zh", when: "look up task-page buttons in Chinese", text: task_ui_zh_default },
63316
63475
  { name: "update-studio", when: "change one of this workspace's studios so new tasks run the new version", text: update_studio_default },
63317
63476
  { name: "implement", when: "build a settled card and stop cleanly on an execution blocker", text: implement_default },
63318
63477
  { name: "settle-background", when: "finish this task\u2019s remaining background work", text: settle_background_default },
@@ -66779,11 +66938,11 @@ function declareRuns(program2, cli) {
66779
66938
  withShared(task.command("show")).argument("<task>").summary("a task and its card").action(async function(id2) {
66780
66939
  await boardless(this, cli, (_, location) => taskShow(id2, location));
66781
66940
  });
66782
- 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) {
66941
+ 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) {
66783
66942
  const opts = this.opts();
66784
66943
  if (opts.title !== void 0) {
66785
- if (request2.length || opts.project !== void 0) {
66786
- die("Use --title with the local board, or pass a request and optionally --project.", "bad-args");
66944
+ if (request2.length || opts.project !== void 0 || opts.review !== void 0 || opts.reviewFile !== void 0 || opts.previewDefinitionsFile !== void 0) {
66945
+ die("Use --title with the local board, or pass a request with --project, --review, --review-file, and --preview-definitions-file.", "bad-args");
66787
66946
  }
66788
66947
  return createBoardCard(this, cli);
66789
66948
  }
@@ -66822,6 +66981,9 @@ function declareRuns(program2, cli) {
66822
66981
  withShared(task.command("resume")).argument("<task>").summary("continue its stopped run").action(async function(id2) {
66823
66982
  await boardless(this, cli, (_, location) => taskResume(id2, location));
66824
66983
  });
66984
+ withShared(task.command("runtime")).argument("<task>").argument("<runtime>").summary("change a task\u2019s runtime").action(async function(id2, runtime) {
66985
+ await boardless(this, cli, (_, location) => taskRuntime(id2, runtime, location));
66986
+ });
66825
66987
  withShared(task.command("stop")).argument("<task>").summary("stop its current run").action(async function(id2) {
66826
66988
  await boardless(this, cli, (_, location) => taskStop(id2, location));
66827
66989
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wildcrane",
3
- "version": "0.11.89",
3
+ "version": "0.11.90",
4
4
  "akbContract": 29,
5
5
  "canonicalCommands": true,
6
6
  "description": "WildCrane's `akb` command — scaffold the Markdown board under docs/kanban/, put an agent on a card, and carry the flows the agent works by.",