wildcrane 0.11.79 → 0.11.80

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 +158 -106
  2. package/package.json +2 -2
package/dist/kanban.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // ai4kanban 0.11.79 — built from the CLI's TypeScript sources by cli/scripts/build.mjs.
2
+ // ai4kanban 0.11.80 — 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)
@@ -20817,6 +20817,108 @@ var init_zod = __esm({
20817
20817
  }
20818
20818
  });
20819
20819
 
20820
+ // src/lib/shared/preview-blocks.ts
20821
+ function sourcePosition(source2, offset) {
20822
+ const before = source2.slice(0, offset);
20823
+ return { line: before.split("\n").length, column: offset - before.lastIndexOf("\n") };
20824
+ }
20825
+ function withoutCode(source2) {
20826
+ const blank = (s) => s.replace(/[^\n\r]/g, " ");
20827
+ let fence;
20828
+ let indented = false, afterBlank = true, inList = false;
20829
+ return source2.split(/(?<=\n)/).map((line) => {
20830
+ const marker = /^ {0,3}(`{3,}|~{3,})(.*)/.exec(line);
20831
+ if (fence) {
20832
+ if (marker && marker[1][0] === fence.char && marker[1].length >= fence.length && !marker[2].trim()) fence = void 0;
20833
+ return blank(line);
20834
+ }
20835
+ if (marker) {
20836
+ fence = { char: marker[1][0], length: marker[1].length };
20837
+ return blank(line);
20838
+ }
20839
+ if (!line.trim()) {
20840
+ afterBlank = true;
20841
+ return line;
20842
+ }
20843
+ const hasIndent = /^(?: {4}|\t)/.test(line);
20844
+ if (!hasIndent) indented = false;
20845
+ if (/^ {0,3}(?:[-+*]|\d+[.)])\s/.test(line)) inList = true;
20846
+ else if (/^\S/.test(line)) inList = false;
20847
+ if (hasIndent && (indented || afterBlank && !inList)) {
20848
+ indented = true;
20849
+ return blank(line);
20850
+ }
20851
+ afterBlank = false;
20852
+ return line;
20853
+ }).join("").replace(/(`+)([^]*?)\1(?!`)/g, blank);
20854
+ }
20855
+ function parsePreviewBlocks(source2, file2 = "STUDIO.md") {
20856
+ const blocks = [], problems = [];
20857
+ const masked = withoutCode(source2);
20858
+ let open4;
20859
+ const seen = /* @__PURE__ */ new Set();
20860
+ const fail = (offset, id2, code, message, hint2) => problems.push({ file: file2, ...sourcePosition(source2, offset), path: id2 ? `previews.${id2}` : "previews", code, message, hint: hint2 });
20861
+ for (const tag of masked.matchAll(/<\/?Preview\b[^>]*(?:>|$)/g)) {
20862
+ const offset = tag.index, text5 = tag[0];
20863
+ const closing = /^<\/Preview\s*>$/.test(text5);
20864
+ if (closing) {
20865
+ if (!open4) fail(offset, "", "preview-unexpected-close", "Preview has no opening tag", "Remove it or restore its opening tag.");
20866
+ else {
20867
+ const instructions = source2.slice(open4.content, offset).trim();
20868
+ if (!instructions) fail(open4.start, open4.id, "preview-empty", `Preview ${open4.id} is empty`, "Describe the requested output inside the block.");
20869
+ blocks.push({ id: open4.id, instructions, start: open4.start, end: offset + text5.length });
20870
+ open4 = void 0;
20871
+ }
20872
+ continue;
20873
+ }
20874
+ const opening = /^<Preview\s+id=(?:"([^"]*)"|'([^']*)')\s*>$/.exec(text5);
20875
+ if (!opening || open4) {
20876
+ fail(offset, open4?.id ?? "", "preview-tag", "Malformed or nested Preview tag", 'Use one non-nested <Preview id="stable-id"> block with only id.');
20877
+ continue;
20878
+ }
20879
+ const id2 = opening[1] ?? opening[2];
20880
+ if (!PREVIEW_ID.test(id2) || seen.has(id2)) fail(offset, id2, "preview-id", `Invalid or repeated Preview ID ${id2}`, "Use a unique lowercase ID with digits and dashes.");
20881
+ seen.add(id2);
20882
+ open4 = { id: id2, start: offset, content: offset + text5.length };
20883
+ }
20884
+ if (open4) fail(open4.start, open4.id, "preview-unclosed", `Preview ${open4.id} is not closed`, "Add </Preview> after this block.");
20885
+ return { blocks, problems };
20886
+ }
20887
+ var PREVIEW_ID;
20888
+ var init_preview_blocks = __esm({
20889
+ "src/lib/shared/preview-blocks.ts"() {
20890
+ "use strict";
20891
+ PREVIEW_ID = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
20892
+ }
20893
+ });
20894
+
20895
+ // src/lib/shared/preview-definitions.ts
20896
+ function effectivePreviewCatalog(studio, definitions) {
20897
+ const seen = new Set(studio.map((p) => p.id));
20898
+ for (const p of definitions) {
20899
+ if (seen.has(p.id)) throw new Error(`Duplicate Preview ID "${p.id}".`);
20900
+ seen.add(p.id);
20901
+ }
20902
+ return [...studio, ...definitions];
20903
+ }
20904
+ var previewComponents, language, previewDefinitionSchema, previewDefinitionsSchema;
20905
+ var init_preview_definitions = __esm({
20906
+ "src/lib/shared/preview-definitions.ts"() {
20907
+ "use strict";
20908
+ init_zod();
20909
+ init_preview_blocks();
20910
+ previewComponents = ["Asset", "Compare", "Storyboard", "Set", "Studio"];
20911
+ language = /^[a-z]{2,3}(?:-[A-Za-z0-9]+)*$/;
20912
+ previewDefinitionSchema = external_exports.object({
20913
+ id: external_exports.string().max(100).regex(PREVIEW_ID),
20914
+ title: external_exports.record(external_exports.string().regex(language), external_exports.string().trim().min(1).max(100)).refine((names2) => Boolean(names2.en && names2.zh), "A Preview needs English and Chinese titles."),
20915
+ instructions: external_exports.string().trim().min(1).max(1e4),
20916
+ components: external_exports.array(external_exports.enum(previewComponents)).max(previewComponents.length).refine((items) => new Set(items).size === items.length, "Preview Components must be unique.").transform((items) => [...items].sort()).optional()
20917
+ }).strict();
20918
+ previewDefinitionsSchema = external_exports.array(previewDefinitionSchema).max(50);
20919
+ }
20920
+ });
20921
+
20820
20922
  // src/lib/shared/review-plan.ts
20821
20923
  function reviewPreviewIds(plan) {
20822
20924
  return [...new Set((plan ?? []).flatMap((node2) => node2.previews))];
@@ -20882,6 +20984,7 @@ function readReviewPlan(plan) {
20882
20984
  return plan?.map(({ id: id2, after: after2, previews, kind }) => ({ id: id2, after: after2, previews, ...kind && { kind } })) ?? null;
20883
20985
  }
20884
20986
  function reviewAuthorization(review, assigned, dispatchRevision) {
20987
+ if (review.pending_plan) return { kind: "waiting" };
20885
20988
  const states2 = new Map(review.stages.map((stage) => [stage.id, stage]));
20886
20989
  const nodes = (review.plan ?? []).filter((node2) => {
20887
20990
  const stage = states2.get(node2.id);
@@ -20921,9 +21024,18 @@ function reviewInstruction(authorization) {
20921
21024
  }
20922
21025
  }
20923
21026
  function reviewBoundary(review, assigned) {
21027
+ const { preview_definitions = [], ...state } = review;
21028
+ const authorization = reviewAuthorization(review, assigned);
21029
+ const definitions = authorization.kind === "stages" && assigned ? preview_definitions.filter((p) => authorization.nodes.some((node2) => node2.previews.includes(p.id))) : preview_definitions;
20924
21030
  return [
20925
- "Task review: " + JSON.stringify(review),
20926
- reviewInstruction(reviewAuthorization(review, assigned)),
21031
+ "Task review: " + JSON.stringify(state),
21032
+ reviewInstruction(authorization),
21033
+ ...definitions.map((p) => [
21034
+ `<Preview id="${p.id}">`,
21035
+ p.instructions,
21036
+ ...p.components ? [`Allowed Preview Components: ${p.components.join(", ") || "none"}.`] : [],
21037
+ "</Preview>"
21038
+ ].join("\n")),
20927
21039
  "Read akb task review before reporting running/done with its revision. Sync content and assets before done. Revise a stage before changing its approved output. Only stage approval accepts reviewable outputs."
20928
21040
  ].join("\n");
20929
21041
  }
@@ -22232,21 +22344,24 @@ async function taskReview(id2, opts = {}, location = {}) {
22232
22344
  if (count3 > 1 || opts.stage !== void 0 && opts.status === void 0) die("Use one of --review, --file, --stage with --status, or --revise-from.");
22233
22345
  const ref = await taskRef(id2, location);
22234
22346
  let task;
22235
- if (!count3) task = await cloud("GET", `/v1/tasks/${enc(ref)}`);
22347
+ if (opts.previewDefinitionsFile !== void 0 && (opts.status !== void 0 || opts.reviseFrom !== void 0)) die("Preview definitions can only change with a review plan.");
22348
+ if (!count3 && opts.previewDefinitionsFile === void 0) task = await cloud("GET", `/v1/tasks/${enc(ref)}`);
22236
22349
  else {
22237
22350
  const review_revision = reviewRevision(opts.revision);
22238
22351
  let fields2;
22239
22352
  if (opts.review !== void 0) {
22240
- const studio = opts.review === "" ? void 0 : await cloud("GET", `/v1/tasks/${enc(ref)}/studio`);
22241
- fields2 = { operation: "plan", review_plan: parseReviewFlow(opts.review, studio?.previews) };
22353
+ fields2 = { operation: "plan", review_flow: opts.review };
22242
22354
  } else if (opts.file !== void 0) {
22243
22355
  fields2 = { operation: "plan", review_plan: parseReviewPlan(JSON.parse(fs7.readFileSync(opts.file, "utf8"))) };
22244
22356
  } else if (opts.reviseFrom !== void 0) {
22245
22357
  fields2 = { operation: "revise", stage: opts.reviseFrom };
22358
+ } else if (opts.previewDefinitionsFile !== void 0) {
22359
+ fields2 = { operation: "plan" };
22246
22360
  } else {
22247
22361
  if (!opts.stage || !["running", "done"].includes(opts.status)) die("--stage and --status running|done are required.");
22248
22362
  fields2 = { operation: "status", stage: opts.stage, status: opts.status };
22249
22363
  }
22364
+ if (opts.previewDefinitionsFile !== void 0) fields2.preview_definitions = previewDefinitionsSchema.parse(JSON.parse(fs7.readFileSync(opts.previewDefinitionsFile, "utf8")));
22250
22365
  task = await cloud("POST", `/v1/tasks/${enc(ref)}/review`, { ...fields2, review_revision });
22251
22366
  }
22252
22367
  say(JSON.stringify(task.review, null, 2));
@@ -22318,6 +22433,7 @@ var init_task = __esm({
22318
22433
  "use strict";
22319
22434
  init_env();
22320
22435
  init_reply_approval();
22436
+ init_preview_definitions();
22321
22437
  init_review_plan();
22322
22438
  init_reply_approval();
22323
22439
  init_config();
@@ -36794,81 +36910,6 @@ var init_icon = __esm({
36794
36910
  }
36795
36911
  });
36796
36912
 
36797
- // src/lib/shared/preview-blocks.ts
36798
- function sourcePosition(source2, offset) {
36799
- const before = source2.slice(0, offset);
36800
- return { line: before.split("\n").length, column: offset - before.lastIndexOf("\n") };
36801
- }
36802
- function withoutCode(source2) {
36803
- const blank = (s) => s.replace(/[^\n\r]/g, " ");
36804
- let fence;
36805
- let indented = false, afterBlank = true, inList = false;
36806
- return source2.split(/(?<=\n)/).map((line) => {
36807
- const marker = /^ {0,3}(`{3,}|~{3,})(.*)/.exec(line);
36808
- if (fence) {
36809
- if (marker && marker[1][0] === fence.char && marker[1].length >= fence.length && !marker[2].trim()) fence = void 0;
36810
- return blank(line);
36811
- }
36812
- if (marker) {
36813
- fence = { char: marker[1][0], length: marker[1].length };
36814
- return blank(line);
36815
- }
36816
- if (!line.trim()) {
36817
- afterBlank = true;
36818
- return line;
36819
- }
36820
- const hasIndent = /^(?: {4}|\t)/.test(line);
36821
- if (!hasIndent) indented = false;
36822
- if (/^ {0,3}(?:[-+*]|\d+[.)])\s/.test(line)) inList = true;
36823
- else if (/^\S/.test(line)) inList = false;
36824
- if (hasIndent && (indented || afterBlank && !inList)) {
36825
- indented = true;
36826
- return blank(line);
36827
- }
36828
- afterBlank = false;
36829
- return line;
36830
- }).join("").replace(/(`+)([^]*?)\1(?!`)/g, blank);
36831
- }
36832
- function parsePreviewBlocks(source2, file2 = "STUDIO.md") {
36833
- const blocks = [], problems = [];
36834
- const masked = withoutCode(source2);
36835
- let open4;
36836
- const seen = /* @__PURE__ */ new Set();
36837
- const fail = (offset, id2, code, message, hint2) => problems.push({ file: file2, ...sourcePosition(source2, offset), path: id2 ? `previews.${id2}` : "previews", code, message, hint: hint2 });
36838
- for (const tag of masked.matchAll(/<\/?Preview\b[^>]*(?:>|$)/g)) {
36839
- const offset = tag.index, text5 = tag[0];
36840
- const closing = /^<\/Preview\s*>$/.test(text5);
36841
- if (closing) {
36842
- if (!open4) fail(offset, "", "preview-unexpected-close", "Preview has no opening tag", "Remove it or restore its opening tag.");
36843
- else {
36844
- const instructions = source2.slice(open4.content, offset).trim();
36845
- if (!instructions) fail(open4.start, open4.id, "preview-empty", `Preview ${open4.id} is empty`, "Describe the requested output inside the block.");
36846
- blocks.push({ id: open4.id, instructions, start: open4.start, end: offset + text5.length });
36847
- open4 = void 0;
36848
- }
36849
- continue;
36850
- }
36851
- const opening = /^<Preview\s+id=(?:"([^"]*)"|'([^']*)')\s*>$/.exec(text5);
36852
- if (!opening || open4) {
36853
- fail(offset, open4?.id ?? "", "preview-tag", "Malformed or nested Preview tag", 'Use one non-nested <Preview id="stable-id"> block with only id.');
36854
- continue;
36855
- }
36856
- const id2 = opening[1] ?? opening[2];
36857
- if (!PREVIEW_ID.test(id2) || seen.has(id2)) fail(offset, id2, "preview-id", `Invalid or repeated Preview ID ${id2}`, "Use a unique lowercase ID with digits and dashes.");
36858
- seen.add(id2);
36859
- open4 = { id: id2, start: offset, content: offset + text5.length };
36860
- }
36861
- if (open4) fail(open4.start, open4.id, "preview-unclosed", `Preview ${open4.id} is not closed`, "Add </Preview> after this block.");
36862
- return { blocks, problems };
36863
- }
36864
- var PREVIEW_ID;
36865
- var init_preview_blocks = __esm({
36866
- "src/lib/shared/preview-blocks.ts"() {
36867
- "use strict";
36868
- PREVIEW_ID = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
36869
- }
36870
- });
36871
-
36872
36913
  // src/lib/agent/studio-def.ts
36873
36914
  function landSections(body, previews) {
36874
36915
  const blank = (text5) => text5.replace(/[^\r\n]/g, " ");
@@ -37574,7 +37615,7 @@ var init_language = __esm({
37574
37615
  isSystemLanguage = (text5) => text5 === SYSTEM_LANGUAGE_ZH || text5 === SYSTEM_LANGUAGE_EN;
37575
37616
  languageCode = (value) => value === "zh" || value === "en" ? value : null;
37576
37617
  translating = () => runLanguage() === "zh";
37577
- systemLanguage = (language) => language === "zh" ? SYSTEM_LANGUAGE_ZH : language === "en" ? SYSTEM_LANGUAGE_EN : "";
37618
+ systemLanguage = (language2) => language2 === "zh" ? SYSTEM_LANGUAGE_ZH : language2 === "en" ? SYSTEM_LANGUAGE_EN : "";
37578
37619
  }
37579
37620
  });
37580
37621
 
@@ -37728,22 +37769,25 @@ function editGoal(args2, opts, held4) {
37728
37769
  const body = readBody(opts.bodyFile);
37729
37770
  const studio = opts.studio ? studioOf(held4, opts.studio) : fallbackStudio(held4);
37730
37771
  const id2 = `new_${held4.goals.filter((i) => i.id.startsWith("new_")).length + 1}`;
37731
- const review_plan = goalReview(held4, studio, opts);
37732
- held4.goals.push({ id: id2, title, ...body, studio, review_plan, task: null });
37733
- return { id: id2, title, studio, review_plan };
37772
+ const preview_definitions = goalDefinitions(opts);
37773
+ const review_plan = goalReview(held4, studio, opts, null, preview_definitions);
37774
+ held4.goals.push({ id: id2, title, ...body, studio, review_plan, ...opts.previewDefinitionsFile !== void 0 ? { preview_definitions } : {}, task: null });
37775
+ return { id: id2, title, studio, review_plan, preview_definitions };
37734
37776
  }
37735
37777
  const goal = named(held4, opts.id);
37736
37778
  if (goal.task) die(`${goal.id} is already a task; it no longer changes here.`);
37737
37779
  if (sub === "save") {
37738
37780
  const studio = opts.studio !== void 0 ? studioOf(held4, opts.studio) : goal.studio;
37739
- const review_plan = goalReview(held4, studio, opts, goal.review_plan ?? null);
37781
+ const preview_definitions = goalDefinitions(opts, goal.preview_definitions);
37782
+ const review_plan = goalReview(held4, studio, opts, goal.review_plan ?? null, preview_definitions);
37740
37783
  if (opts.title !== void 0) {
37741
37784
  if (!opts.title.trim()) die("--title must not be empty");
37742
37785
  goal.title = opts.title.trim();
37743
37786
  }
37744
37787
  if (opts.bodyFile !== void 0) Object.assign(goal, readBody(opts.bodyFile));
37745
37788
  Object.assign(goal, { studio, review_plan });
37746
- return { id: goal.id, title: goal.title, studio: goal.studio, review_plan: goal.review_plan };
37789
+ if (opts.previewDefinitionsFile !== void 0) goal.preview_definitions = preview_definitions;
37790
+ return { id: goal.id, title: goal.title, studio: goal.studio, review_plan, preview_definitions };
37747
37791
  }
37748
37792
  if (sub === "drop") {
37749
37793
  goal.dropped = true;
@@ -37763,8 +37807,16 @@ function cmdGoalStudios(held4 = loadGoals().held) {
37763
37807
  }
37764
37808
  return { studios: held4.studios.map((w) => ({ ...w, id: shortStudioId(w.id) })) };
37765
37809
  }
37766
- function checkGoalReview(held4, studio, value) {
37767
- const catalog = held4.studios.find((w) => w.id === studio)?.previews;
37810
+ function goalDefinitions(opts, previous = []) {
37811
+ return opts.previewDefinitionsFile === void 0 ? previous : previewDefinitionsSchema.parse(JSON.parse(fs16.readFileSync(opts.previewDefinitionsFile, "utf8")));
37812
+ }
37813
+ function goalCatalog(held4, studio, definitions) {
37814
+ const builtIn = held4.studios.find((w) => w.id === studio)?.previews;
37815
+ if (!builtIn && definitions.length) die("Preview outputs are unavailable; update Runner and try again.");
37816
+ return builtIn && effectivePreviewCatalog(builtIn, definitions);
37817
+ }
37818
+ function checkGoalReview(held4, studio, value, definitions = []) {
37819
+ const catalog = goalCatalog(held4, studio, definitions);
37768
37820
  try {
37769
37821
  const plan = parseReviewPlan(value);
37770
37822
  if (plan?.some((n) => n.previews.length) && !catalog) die("Preview outputs are unavailable; update Runner and try again.");
@@ -37773,20 +37825,19 @@ function checkGoalReview(held4, studio, value) {
37773
37825
  return die(e.message);
37774
37826
  }
37775
37827
  }
37776
- function goalReview(held4, studio, opts, previous = null) {
37828
+ function goalReview(held4, studio, opts, previous, definitions) {
37777
37829
  if (opts.review !== void 0) {
37778
37830
  if (opts.reviewFile !== void 0) die("Use either --review or --review-file.");
37779
- const catalog = held4.studios.find((w) => w.id === studio)?.previews;
37780
- return parseReviewFlow(opts.review, catalog);
37831
+ return parseReviewFlow(opts.review, goalCatalog(held4, studio, definitions));
37781
37832
  }
37782
37833
  const value = opts.reviewFile === void 0 ? previous : JSON.parse(fs16.readFileSync(opts.reviewFile, "utf8"));
37783
- return checkGoalReview(held4, studio, value);
37834
+ return checkGoalReview(held4, studio, value, definitions);
37784
37835
  }
37785
37836
  function cmdGoalPreviews(studio, held4 = loadGoals().held) {
37786
37837
  const id2 = studioOf(held4, studio);
37787
37838
  const catalog = held4.studios.find((w) => w.id === id2)?.previews;
37788
37839
  if (!catalog) die("Preview outputs are unavailable; update Runner and try again.");
37789
- const previews = catalog.map(({ id: id3, instructions }) => ({ id: id3, instructions }));
37840
+ const previews = catalog;
37790
37841
  say(previews.map((p) => `${p.id}
37791
37842
  ${p.instructions}`).join("\n"));
37792
37843
  return { previews, problems: [] };
@@ -37795,6 +37846,7 @@ var MAX_GOALS, shortStudioId, open2;
37795
37846
  var init_goal2 = __esm({
37796
37847
  "src/commands/goal.ts"() {
37797
37848
  "use strict";
37849
+ init_preview_definitions();
37798
37850
  init_review_plan();
37799
37851
  init_goal_draft();
37800
37852
  init_io();
@@ -37891,7 +37943,7 @@ async function queryPreviews(studio, workspace2) {
37891
37943
  const flow = list3.find((w) => w.id === studio || shortStudioId(w.id) === studio);
37892
37944
  if (!flow) die(`No studio \`${studio}\` here.`);
37893
37945
  if (!flow.previews) die("Preview outputs are unavailable; update Runner and try again.");
37894
- const previews = flow.previews.map(({ id: id2, instructions }) => ({ id: id2, instructions }));
37946
+ const previews = flow.previews;
37895
37947
  say(previews.map((p) => `${p.id}
37896
37948
  ${p.instructions}`).join("\n"));
37897
37949
  return { previews, problems: [] };
@@ -41870,8 +41922,8 @@ var init_package = __esm({
41870
41922
  "package.json"() {
41871
41923
  package_default = {
41872
41924
  name: "wildcrane",
41873
- version: "0.11.79",
41874
- akbContract: 26,
41925
+ version: "0.11.80",
41926
+ akbContract: 27,
41875
41927
  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.",
41876
41928
  keywords: [
41877
41929
  "kanban",
@@ -48419,8 +48471,8 @@ edits here do not last.
48419
48471
  });
48420
48472
 
48421
48473
  // src/lib/agents/index.ts
48422
- function agentLines(agent, language = readLanguage()) {
48423
- const said2 = agent.i18n[language];
48474
+ function agentLines(agent, language2 = readLanguage()) {
48475
+ const said2 = agent.i18n[language2];
48424
48476
  return {
48425
48477
  title: said2?.title || agent.i18n.en?.title || "",
48426
48478
  description: said2?.description || agent.description
@@ -50859,13 +50911,13 @@ function languageEnv(given) {
50859
50911
  }
50860
50912
  return env2;
50861
50913
  }
50862
- function withSystemLanguage(harness, argv, env2, language) {
50914
+ function withSystemLanguage(harness, argv, env2, language2) {
50863
50915
  env2 = languageEnv(env2);
50864
- const text5 = systemLanguage(language);
50916
+ const text5 = systemLanguage(language2);
50865
50917
  if (!text5) return { argv, env: env2 };
50866
50918
  const added = argv.length ? harness.systemPrompt?.(text5, argv, env2) : void 0;
50867
50919
  if (!added?.args?.length && !Object.keys(added?.env ?? {}).length) {
50868
- const note = language === "zh" ? "\u8BED\u8A00\u89C4\u5219\u672A\u80FD\u66F4\u65B0\uFF1A\u8FDE\u63A5\u5668\u3001\u5DF2\u6709\u4F1A\u8BDD\u6216\u81EA\u8BBE\u7CFB\u7EDF\u63D0\u793A\u8BCD\u4E0D\u652F\u6301\u6CE8\u5165\u3002\u8BF7\u81EA\u884C\u53E6\u5F00\u652F\u6301\u7684\u4F1A\u8BDD\u4EE5\u91C7\u7528\u65B0\u89C4\u5219\u3002" : "Language rules could not be updated: the connector, existing session, or custom system prompt prevents injection. Open a supported new session to apply them.";
50920
+ const note = language2 === "zh" ? "\u8BED\u8A00\u89C4\u5219\u672A\u80FD\u66F4\u65B0\uFF1A\u8FDE\u63A5\u5668\u3001\u5DF2\u6709\u4F1A\u8BDD\u6216\u81EA\u8BBE\u7CFB\u7EDF\u63D0\u793A\u8BCD\u4E0D\u652F\u6301\u6CE8\u5165\u3002\u8BF7\u81EA\u884C\u53E6\u5F00\u652F\u6301\u7684\u4F1A\u8BDD\u4EE5\u91C7\u7528\u65B0\u89C4\u5219\u3002" : "Language rules could not be updated: the connector, existing session, or custom system prompt prevents injection. Open a supported new session to apply them.";
50869
50921
  return { argv, env: env2, note };
50870
50922
  }
50871
50923
  const at = /^node(?:\.exe)?$/.test(path49.basename(argv[0])) && argv[1] && !argv[1].startsWith("-") ? 2 : 1;
@@ -51343,7 +51395,7 @@ var init_pictures = __esm({
51343
51395
  var Asset_default;
51344
51396
  var init_Asset = __esm({
51345
51397
  "src/components/Asset.md"() {
51346
- Asset_default = '# Asset\n\nShow a file as a Preview with `<Asset src=".assets/<card id>/<file>" label="..." />` alone in a paragraph.\nInline and fenced examples remain text.\n\n- **Label**: use a few words; an image\'s optional `alt` is its shipped caption and cannot contain `<`, `>` or its enclosing quote.\n- **Device**: use a separate tag for each device view, with `device="mobile"` or `device="desktop"`; both may reference the same responsive page.\n- **Variants**: versions of the same content on the same device share one tag with `variants=\'{"English": ".assets/<card id>/page.en.html", "\u4E2D\u6587": ".assets/<card id>/page.zh.html"}\'`, with `src` shown first; alternatives stay separate tags.\n- **Loop**: add `loop` for muted, looping video without controls.\n- **Tiled map**: a `.tmx` or `.tmj` `src` draws as a map; keep its `.tsx`/`.tsj` tilesets and images beside it, at the relative paths it names.\n- **Sprite animation**: a TexturePacker JSON (Hash or Array) `src` plays as an animation; keep its sheet image beside it, at the relative path `meta.image` names.\n- **Web page**: an `.html` or `.htm` `src` loads only the relative paths named in its tags and styles.\n- **Mermaid**: a `.mmd` or `.mermaid` `src` draws a diagram and shows its source if it cannot render.\n- **Excel**: a `.xlsx` draws a read-only workbook with sheet tabs, formulas, and saved results.\n- **Text**: code and other text files show as highlighted text; a `.diff` or `.patch` shows its added and removed lines.\n';
51398
+ Asset_default = '# Asset\n\nShow a file as a Preview with `<Asset src=".assets/<card id>/<file>" label="..." />` alone in a paragraph.\nInline and fenced examples remain text.\n\n- **Label**: use a few words; an image\'s optional `alt` is its shipped caption and cannot contain `<`, `>` or its enclosing quote.\n- **Device**: use a separate tag for each device view, with `device="mobile"` or `device="desktop"`; both may reference the same responsive page.\n- **Variants**: versions of the same content on the same device share one tag with `variants=\'{"English": ".assets/<card id>/page.en.html", "\u4E2D\u6587": ".assets/<card id>/page.zh.html"}\'`, with `src` shown first; alternatives stay separate tags.\n- **Loop**: add `loop` for muted, looping video without controls.\n- **Tiled map**: a `.tmx` or `.tmj` `src` draws as a map; keep its `.tsx`/`.tsj` tilesets and images beside it, at the relative paths it names.\n- **Sprite animation**: a TexturePacker JSON (Hash or Array) `src` plays as an animation; keep its sheet image beside it, at the relative path `meta.image` names.\n- **Web page**: an `.html` or `.htm` `src` loads only the relative paths named in its tags and styles.\n- **Mermaid**: a `.mmd` or `.mermaid` `src` draws a diagram and shows its source if it cannot render.\n- **Documents**: PDF, DOCX, and PPTX open in a read-only viewer with page and zoom controls. DOCX and PPTX previews use LibreOffice and the fonts installed on the Runner. The original remains downloadable.\n- **Excel**: a `.xlsx` draws a read-only workbook with sheet tabs, formulas, and saved results.\n- **Text**: code and other text files show as highlighted text; a `.diff` or `.patch` shows its added and removed lines.\n';
51347
51399
  }
51348
51400
  });
51349
51401
 
@@ -62024,7 +62076,7 @@ var init_describe_project = __esm({
62024
62076
  var discuss_goal_default;
62025
62077
  var init_discuss_goal = __esm({
62026
62078
  "src/guide/discuss-goal.md"() {
62027
- discuss_goal_default = "# Discuss a goal\n\nExplain feasible options and key tradeoffs, then save the result the user can choose to start.\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**: before saving the review plan, select Previews by matching the planned changes to the chosen Studio's Preview definitions.\n- **Review** independent Previews in parallel by default. Use Studio Preview names, e.g. `--review 'Tech choices + UI design'`. Add `->` only when the next group needs the previous group's approvals. Delivery waits for all approvals in the last group. Verify the saved plan even when no flowchart appears.\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**: explain the proposed outcome and review arrangement before saving. Ask only for choices the user must make, with a recommendation.\n- **Start**: the user starts each Goal from the page; its effective review arrangement governs output approval.\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";
62079
+ discuss_goal_default = '# Discuss a goal\n\nExplain feasible options and key tradeoffs, then save the result the user can choose to start.\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**: match requested work to the Studio\u2019s Previews. Define a Goal Preview only when the Studio lacks a requested result.\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**: explain the proposed outcome and review arrangement before saving. Ask only for choices the user must make, with a recommendation.\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';
62028
62080
  }
62029
62081
  });
62030
62082
 
@@ -65622,7 +65674,7 @@ function declareRuns(program2, cli) {
65622
65674
  withShared(task.command("approve")).argument("<task>").summary("approve the current review point").option("--stage <id>", "the reviewed node").requiredOption("--revision <n>", "the stage version you reviewed").option("--comment <text>", "a note with the approval").action(async function(id2) {
65623
65675
  await boardless(this, cli, (_, location) => taskApprove(id2, this.opts().comment, this.opts(), location));
65624
65676
  });
65625
- withShared(task.command("review")).argument("<task>").summary("read the task review, set the plan or report a stage").option("--review <flow>", "set a review flow using Studio Preview names").addHelpText("after", REVIEW_FLOW_HELP).option("--file <path>", "set a JSON review plan").option("--stage <id>", "the node to report").option("--status <status>", "running or done").option("--revise-from <id>", "revise this node and its dependents").option("--revision <n>", "the task review version read before this write").action(async function(id2) {
65677
+ withShared(task.command("review")).argument("<task>").summary("read the task review, set the plan or report a stage").option("--review <flow>", "set a review flow using Studio Preview names").addHelpText("after", REVIEW_FLOW_HELP).option("--file <path>", "set a JSON review plan").option("--stage <id>", "the node to report").option("--status <status>", "running or done").option("--preview-definitions-file <path>", "propose a JSON list of task Preview definitions").option("--revise-from <id>", "revise this node and its dependents").option("--revision <n>", "the task review version read before this write").action(async function(id2) {
65626
65678
  await boardless(this, cli, (_, location) => taskReview(id2, this.opts(), location));
65627
65679
  });
65628
65680
  const questionOps = [];
@@ -65651,7 +65703,7 @@ function declareRuns(program2, cli) {
65651
65703
  withShared(task.command("comment")).argument("<task>").argument("<text...>").summary("comment on a task").action(async function(id2, text5) {
65652
65704
  await boardless(this, cli, (_, location) => taskComment(id2, text5.join(" "), location));
65653
65705
  });
65654
- const goal = withShared(program2.command("goal")).argument("<move>", "new, save, drop or start").summary("save, drop and start goals of this conversation").description('Write a temporary draft, then goal new --title "\u2026" --body-file <file> [--studio <id>] [--review <flow>]; update with goal save --id <goal> and any of --title, --body-file, --studio, --review. goal drop --id <goal> withdraws one; goal start --id <goal> turns it into a task. A `## Done when` list in the body is what counts as done. Studios are the ones `akb studio list` shows.').option("--id <goal>", "the goal to save, drop or start").option("--title <title>", "what the goal is called").option("--body-file <path>", "the outcome, then a `## Done when` list").option("--studio <id>", "the studio that does the work, from `akb studio list`").option("--review <flow>", "save a review flow using Studio Preview names").option("--review-file <path>", "JSON review nodes with after dependencies; [] needs no extra review").addHelpText("after", REVIEW_FLOW_HELP);
65706
+ const goal = withShared(program2.command("goal")).argument("<move>", "new, save, drop or start").summary("save, drop and start goals of this conversation").description('Write a temporary draft, then goal new --title "\u2026" --body-file <file> [--studio <id>] [--review <flow>]; update with goal save --id <goal> and any of --title, --body-file, --studio, --review. goal drop --id <goal> withdraws one; goal start --id <goal> turns it into a task. A `## Done when` list in the body is what counts as done. Studios are the ones `akb studio list` shows.').option("--id <goal>", "the goal to save, drop or start").option("--title <title>", "what the goal is called").option("--body-file <path>", "the outcome, then a `## Done when` list").option("--studio <id>", "the studio that does the work, from `akb studio list`").option("--review <flow>", "save a review flow using Studio Preview names").option("--preview-definitions-file <path>", "save a JSON list of Goal Preview definitions").option("--review-file <path>", "JSON review nodes with after dependencies; [] needs no extra review").addHelpText("after", REVIEW_FLOW_HELP);
65655
65707
  goal.action(async function(sub) {
65656
65708
  await boardless(this, cli, () => externalGoalSession() ? cloudGoal([sub], this.opts()) : cmdGoal([sub], this.opts()));
65657
65709
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wildcrane",
3
- "version": "0.11.79",
4
- "akbContract": 26,
3
+ "version": "0.11.80",
4
+ "akbContract": 27,
5
5
  "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.",
6
6
  "keywords": [
7
7
  "kanban",