wildcrane 0.11.37 → 0.11.39

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 (3) hide show
  1. package/README.md +12 -12
  2. package/dist/kanban.mjs +675 -628
  3. package/package.json +2 -2
package/dist/kanban.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // ai4kanban 0.11.37 — built from the CLI's TypeScript sources by cli/scripts/build.mjs.
2
+ // ai4kanban 0.11.39 — 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)
@@ -131,10 +131,10 @@ async function refresh() {
131
131
  const now = readSession();
132
132
  if (!now) return { ok: false, reason: "signed-out" };
133
133
  if (!expiringSoon(now)) return { ok: true, token: now.accessToken, session: now };
134
- const { supabaseUrl, anonKey } = cloudEndpoints();
134
+ const { api, anonKey } = cloudEndpoints();
135
135
  let response;
136
136
  try {
137
- response = await fetch(`${supabaseUrl}/auth/v1/token?grant_type=refresh_token`, {
137
+ response = await fetch(`${api}/auth/v1/token?grant_type=refresh_token`, {
138
138
  method: "POST",
139
139
  headers: { apikey: anonKey, "content-type": "application/json" },
140
140
  body: JSON.stringify({ refresh_token: now.refreshToken })
@@ -257,7 +257,7 @@ function workspaceTask() {
257
257
  const id = process.env[TASK_ENV];
258
258
  return id && id.trim() ? id.trim() : null;
259
259
  }
260
- function cloudWorkflow(name) {
260
+ function cloudStudio(name) {
261
261
  if (/^wf-/.test(name)) return name.replace("-", "_");
262
262
  return `wf_builtin_${name.replace(/-/g, "_")}`;
263
263
  }
@@ -289,11 +289,11 @@ async function call(method, route2, body, key) {
289
289
  async function createTask(from, said2) {
290
290
  const source = await call("GET", `/v1/tasks/${encodeURIComponent(from)}`);
291
291
  if (!source.ok) return source;
292
- const workflow = said2.workflow ? cloudWorkflow(said2.workflow) : source.value.workflow?.id;
292
+ const studio = said2.studio ? cloudStudio(said2.studio) : source.value.studio?.id;
293
293
  const body = {
294
294
  title: said2.title,
295
295
  project: source.value.project,
296
- ...workflow ? { workflow } : {},
296
+ ...studio ? { studio } : {},
297
297
  ...said2.request?.trim() ? { request: said2.request.trim() } : {},
298
298
  source: "api",
299
299
  source_context: { task: from, ...said2.agent ? { agent: said2.agent } : {} },
@@ -350,7 +350,7 @@ async function createProjectTask(project2, said2, key) {
350
350
  title: said2.title,
351
351
  project: project2,
352
352
  source: "api",
353
- ...said2.workflow ? { workflow: cloudWorkflow(said2.workflow) } : {},
353
+ ...said2.studio ? { studio: cloudStudio(said2.studio) } : {},
354
354
  ...said2.request?.trim() ? { request: said2.request.trim() } : {},
355
355
  ...said2.agent ? { source_context: { agent: said2.agent } } : {},
356
356
  ...said2.triage ? { triage: `tri_${project2.replace(/^prj_/, "")}_${said2.triage}` } : {}
@@ -600,7 +600,7 @@ function setBoard(kanban, root2, flag) {
600
600
  RELEASES = path5.join(KANBAN, "releases.md");
601
601
  RELEASE_SUMMARIES = path5.join(KANBAN, ".release-summaries");
602
602
  AGENTS = path5.join(KANBAN, "agents");
603
- WORKFLOWS = path5.join(KANBAN, "workflows");
603
+ STUDIOS = path5.join(KANBAN, "studios");
604
604
  LEGACY_AGENTS = path5.join(KANBAN, "skills");
605
605
  MEMORY = path5.join(KANBAN, "memory");
606
606
  AGENT_MEMORY = path5.join(MEMORY, "agents");
@@ -664,7 +664,7 @@ function useProjectState() {
664
664
  ensureAkbDir();
665
665
  return ensureProjectState(KANBAN, REPO_ROOT);
666
666
  }
667
- var REPO_ROOT, KANBAN, TODO, ARCHIVE, REJECTIONS_TO_REVIEW, ARCHIVE_MD, README, MODULES_MD, CONFIG, KANBAN_GITIGNORE, RELEASES, RELEASE_SUMMARIES, AGENTS, WORKFLOWS, LEGACY_AGENTS, ASSETS, BOARD_STATE, MOCKUPS, MEMORY, AGENT_MEMORY, PROJECT_MD, LOCK, UI_CONFIG, LEGACY_UI_CONFIG, LOCAL_CONFIG, ENV_FILE, SESSIONS, SESSIONS_DIR, SESSIONS_LOCK2, INDEX_LOCK2, DELIVERIES, PLANS, PLANS_ARCHIVE, RULES, TRIAGE, SIGNALS_ARCHIVED, SIGNALS_DISMISSED, SIGNALS_FILES, SIGNALS_OLD_INBOX, SIGNALS_OLD_HANDLED, AKB_DIR, ROOT_GITIGNORE, AKB_IGNORE_LINE, BOARD_FLAG, rel, BOARD_PATH_IN_TEXT, ASSETS_PATH_IN_TEXT, MOCKUPS_PATH_IN_TEXT, BOARD_STATE_IN_TEXT;
667
+ var REPO_ROOT, KANBAN, TODO, ARCHIVE, REJECTIONS_TO_REVIEW, ARCHIVE_MD, README, MODULES_MD, CONFIG, KANBAN_GITIGNORE, RELEASES, RELEASE_SUMMARIES, AGENTS, STUDIOS, LEGACY_AGENTS, ASSETS, BOARD_STATE, MOCKUPS, MEMORY, AGENT_MEMORY, PROJECT_MD, LOCK, UI_CONFIG, LEGACY_UI_CONFIG, LOCAL_CONFIG, ENV_FILE, SESSIONS, SESSIONS_DIR, SESSIONS_LOCK2, INDEX_LOCK2, DELIVERIES, PLANS, PLANS_ARCHIVE, RULES, TRIAGE, SIGNALS_ARCHIVED, SIGNALS_DISMISSED, SIGNALS_FILES, SIGNALS_OLD_INBOX, SIGNALS_OLD_HANDLED, AKB_DIR, ROOT_GITIGNORE, AKB_IGNORE_LINE, BOARD_FLAG, rel, BOARD_PATH_IN_TEXT, ASSETS_PATH_IN_TEXT, MOCKUPS_PATH_IN_TEXT, BOARD_STATE_IN_TEXT;
668
668
  var init_paths = __esm({
669
669
  "src/lib/paths.ts"() {
670
670
  "use strict";
@@ -683,7 +683,7 @@ var init_paths = __esm({
683
683
  RELEASES = "";
684
684
  RELEASE_SUMMARIES = "";
685
685
  AGENTS = "";
686
- WORKFLOWS = "";
686
+ STUDIOS = "";
687
687
  LEGACY_AGENTS = "";
688
688
  ASSETS = "";
689
689
  BOARD_STATE = "";
@@ -879,7 +879,7 @@ function serializeFrontmatter(m) {
879
879
  out.push(`blocked_by: [${(m.blocked_by || []).join(", ")}]`);
880
880
  out.push(`related: [${(m.related || []).join(", ")}]`);
881
881
  out.push(`modules: [${(m.modules || []).join(", ")}]`);
882
- if (m.workflow) out.push(`workflow: ${yamlScalar(m.workflow)}`);
882
+ if (m.studio) out.push(`studio: ${yamlScalar(m.studio)}`);
883
883
  if (m.triage) out.push(`triage: ${yamlScalar(m.triage)}`);
884
884
  if (m.source?.length) {
885
885
  out.push("source:");
@@ -978,7 +978,7 @@ function parseFrontmatter(text4) {
978
978
  delete meta.release;
979
979
  delete meta.schedule;
980
980
  delete meta.roi;
981
- meta.workflow = typeof meta.workflow === "string" && meta.workflow.trim() ? meta.workflow.trim() : "";
981
+ meta.studio = typeof meta.studio === "string" && meta.studio.trim() ? meta.studio.trim() : "";
982
982
  meta.triage = typeof meta.triage === "string" ? meta.triage.trim() : "";
983
983
  meta.source = (Array.isArray(meta.source) ? meta.source : typeof meta.source === "string" ? [meta.source] : []).map((ref) => String(ref).trim()).filter(Boolean);
984
984
  delete meta.phases;
@@ -1606,9 +1606,9 @@ async function taskList(opts) {
1606
1606
  }
1607
1607
  async function taskShow(id) {
1608
1608
  const task = await cloud("GET", `/v1/tasks/${enc(await taskRef(id))}`);
1609
- const card = task.workflow ? await cloud("GET", `/v1/tasks/${enc(task.id)}/card`).catch(() => null) : null;
1609
+ const card = task.studio ? await cloud("GET", `/v1/tasks/${enc(task.id)}/card`).catch(() => null) : null;
1610
1610
  say(`${task.key} ${task.title}`);
1611
- say(`${task.status}${task.workflow ? ` ${task.workflow.name}` : ""} ${taskUrl(task.key)}`);
1611
+ say(`${task.status}${task.studio ? ` ${task.studio.name}` : ""} ${taskUrl(task.key)}`);
1612
1612
  if (card?.body) say(`
1613
1613
  ${card.body.trim()}`);
1614
1614
  return { ...task, card };
@@ -1622,7 +1622,7 @@ async function taskCreate(request2, opts) {
1622
1622
  title,
1623
1623
  request: text4,
1624
1624
  project: await project(opts.project),
1625
- ...opts.workflow ? { workflow: cloudWorkflow(opts.workflow) } : {},
1625
+ ...opts.studio ? { studio: cloudStudio(opts.studio) } : {},
1626
1626
  source: "api"
1627
1627
  });
1628
1628
  say(`Created ${task.key}: ${task.title} ${taskUrl(task.key)}`);
@@ -4208,8 +4208,8 @@ var init_package = __esm({
4208
4208
  "package.json"() {
4209
4209
  package_default = {
4210
4210
  name: "wildcrane",
4211
- version: "0.11.37",
4212
- akbContract: 9,
4211
+ version: "0.11.39",
4212
+ akbContract: 10,
4213
4213
  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.",
4214
4214
  keywords: [
4215
4215
  "kanban",
@@ -6537,8 +6537,8 @@ var init_language = __esm({
6537
6537
  init_settings2();
6538
6538
  LANGUAGE_ENV = "AI4KANBAN_LANGUAGE";
6539
6539
  LANGUAGE_LINE_ENV = "AI4KANBAN_LANGUAGE_LINE";
6540
- SYSTEM_LANGUAGE_ZH = "\u7528\u4E2D\u6587\u56DE\u590D\u3002\u7ED9\u4EFB\u52A1\u521B\u5EFA\u8005\u770B\u7684\u7528\u4E2D\u6587\uFF0C\u5DE5\u4F5C\u6D41\u7684\u6700\u7EC8\u4EA7\u7269\u6CBF\u7528\u9879\u76EE\u8BED\u8A00\u3002";
6541
- SYSTEM_LANGUAGE_EN = "Reply in English. Write for the task creator in English; the workflow's final artifacts follow the project's language.";
6540
+ SYSTEM_LANGUAGE_ZH = "\u7528\u4E2D\u6587\u56DE\u590D\u3002\u7ED9\u4EFB\u52A1\u521B\u5EFA\u8005\u770B\u7684\u7528\u4E2D\u6587\uFF0C\u5DE5\u4F5C\u53F0\u7684\u6700\u7EC8\u4EA7\u7269\u6CBF\u7528\u9879\u76EE\u8BED\u8A00\u3002";
6541
+ SYSTEM_LANGUAGE_EN = "Reply in English. Write for the task creator in English; the studio's final artifacts follow the project's language.";
6542
6542
  systemLanguages = /* @__PURE__ */ new Set([
6543
6543
  SYSTEM_LANGUAGE_ZH,
6544
6544
  SYSTEM_LANGUAGE_EN,
@@ -7120,7 +7120,7 @@ function parseStore() {
7120
7120
  pictures: readPictures(entry.pictures),
7121
7121
  stopping: entry.stopping === true ? true : void 0,
7122
7122
  unspawned: entry.unspawned === true ? true : void 0,
7123
- workflow: typeof entry.workflow === "string" && entry.workflow ? entry.workflow : void 0,
7123
+ studio: typeof entry.studio === "string" && entry.studio ? entry.studio : void 0,
7124
7124
  specAgent: typeof entry.specAgent === "string" && entry.specAgent ? entry.specAgent : void 0,
7125
7125
  triage: typeof entry.triage === "string" ? entry.triage : void 0,
7126
7126
  refineRound: typeof entry.refineRound === "number" && Number.isInteger(entry.refineRound) && entry.refineRound >= 0 ? entry.refineRound : void 0,
@@ -7238,13 +7238,13 @@ function readDeliveryRow(raw) {
7238
7238
  // The flow rules this delivery froze (#306). A delivery written down before they
7239
7239
  // existed has none, and its runs read the files — which is what they always did.
7240
7240
  rules: readRules(entry.rules),
7241
- // The workflow this delivery froze (#715). A delivery written down before workflows
7241
+ // The studio this delivery froze (#715). A delivery written down before studios
7242
7242
  // existed has none, and its runs read the board — which is what they always did.
7243
- workflow: readWorkflow(entry.workflow),
7244
- scheduled: entry.scheduled && typeof entry.scheduled.workflow === "string" && typeof entry.scheduled.agent === "string" ? { workflow: entry.scheduled.workflow, agent: entry.scheduled.agent } : void 0
7243
+ studio: readStudio(entry.studio),
7244
+ scheduled: entry.scheduled && typeof entry.scheduled.studio === "string" && typeof entry.scheduled.agent === "string" ? { studio: entry.scheduled.studio, agent: entry.scheduled.agent } : void 0
7245
7245
  };
7246
7246
  }
7247
- function readWorkflow(raw) {
7247
+ function readStudio(raw) {
7248
7248
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) return void 0;
7249
7249
  const box2 = raw;
7250
7250
  const id = text2(box2.id);
@@ -8832,14 +8832,14 @@ function agentMemoryBlock(agent) {
8832
8832
  ${file.text || "_(empty)_"}`)
8833
8833
  ].join("\n\n");
8834
8834
  }
8835
- function specAgentSelector(id, workflow, meta) {
8836
- const flow = workflowFor(workflow);
8835
+ function specAgentSelector(id, studio, meta) {
8836
+ const flow = studioFor(studio);
8837
8837
  if (!flow || !previewAgents(flow).length) return "";
8838
8838
  if (!meta?.previews) {
8839
8839
  return [
8840
8840
  "<preview-agents>",
8841
8841
  "This card has not chosen its previews yet. Choose them first: the agents from",
8842
- `\`akb raw previews --triggers --workflow ${flow.id}\` whose conditions the card meets, always including those marked \`Always\`. Save them with`,
8842
+ `\`akb raw previews --triggers --studio ${flow.id}\` whose conditions the card meets, always including those marked \`Always\`. Save them with`,
8843
8843
  `\`akb raw update ${id} --previews <agents>\` (\`""\` when that leaves none); its stages follow from them.`,
8844
8844
  "Then run only the chosen agents whose `After` is empty \u2014 the first stage; the rest run after its approval.",
8845
8845
  `Command: \`akb raw previews <agent> ${id} <short note>\` \u2014 add \`--print\` to run it in this session, as \`akb guide refine\` says.`,
@@ -8892,13 +8892,13 @@ var init_agents = __esm({
8892
8892
  init_paths();
8893
8893
  init_spec_agent_names();
8894
8894
  init_catalog();
8895
- init_workflows();
8895
+ init_studios();
8896
8896
  init_catalog();
8897
8897
  init_spec_agent_names();
8898
8898
  specAgents = () => specAgentCatalog().agents;
8899
8899
  specAgentProblems = () => [
8900
8900
  ...specAgentCatalog().problems,
8901
- ...workflowFileProblems(),
8901
+ ...studioFileProblems(),
8902
8902
  ...agentKeyProblems(),
8903
8903
  ...stageContractProblems()
8904
8904
  ];
@@ -8932,8 +8932,8 @@ var init_agents = __esm({
8932
8932
  const all2 = specAgents();
8933
8933
  return names3.map((name) => all2.find((a) => a.name === name)).filter((a) => !!a);
8934
8934
  };
8935
- specAgentAssigned = (name, workflow) => {
8936
- const flow = workflowFor(workflow);
8935
+ specAgentAssigned = (name, studio) => {
8936
+ const flow = studioFor(studio);
8937
8937
  const wanted = canonicalSpecAgent(name);
8938
8938
  return !!flow && previewAgents(flow).some((h) => h.agent === wanted);
8939
8939
  };
@@ -8941,14 +8941,14 @@ var init_agents = __esm({
8941
8941
  const there = specAgents().map((a) => a.name);
8942
8942
  return there.length ? `"${name}" is not an agent on this board. It has: ${there.join(", ")}.` : `"${name}" is not an agent on this board, and this board has none.`;
8943
8943
  };
8944
- SPEC_ASSIGN_HOME = "it is switched on in its workflow, in the board UI under Configuration \u2192 Workflows";
8944
+ SPEC_ASSIGN_HOME = "it is switched on in its studio, in the board UI under Configuration \u2192 Studios";
8945
8945
  SPEC_AGENT_HOME = "docs/kanban/agents/<name>/AGENT.md";
8946
8946
  }
8947
8947
  });
8948
8948
 
8949
8949
  // src/lib/agent/stages.ts
8950
- function stageContracts(workflow) {
8951
- const flow = workflowFor(workflow);
8950
+ function stageContracts(studio) {
8951
+ const flow = studioFor(studio);
8952
8952
  if (!flow) return BOARD_STAGES;
8953
8953
  return BOARD_STAGES.map((contract) => {
8954
8954
  if (contract.stage === "plan") return { ...contract, helpers: previewAgents(flow).map((h) => h.agent) };
@@ -8984,7 +8984,7 @@ var BOARD_STAGES, BOARD_NODES, stageContract, flowNodes, stageOfFlow, nodeOfFlow
8984
8984
  var init_stages = __esm({
8985
8985
  "src/lib/agent/stages.ts"() {
8986
8986
  "use strict";
8987
- init_workflows();
8987
+ init_studios();
8988
8988
  BOARD_STAGES = [
8989
8989
  {
8990
8990
  stage: "discuss",
@@ -9012,8 +9012,8 @@ var init_stages = __esm({
9012
9012
  flows: ["implement", "run"],
9013
9013
  input: "the approved card and the rules its delivery froze",
9014
9014
  output: "the approved outcome and its recorded results",
9015
- done: "all workflow steps have recorded completion and the card is archived",
9016
- // The card workflow's first land agent; none without one.
9015
+ done: "all studio steps have recorded completion and the card is archived",
9016
+ // The card studio's first land agent; none without one.
9017
9017
  lead: "",
9018
9018
  helpers: [],
9019
9019
  requires: []
@@ -9026,21 +9026,21 @@ var init_stages = __esm({
9026
9026
  { flow: "review-dismissals", kind: "event", agent: "dismissal-reviewer" },
9027
9027
  { flow: "describe-project", kind: "event", agent: "project-writer" }
9028
9028
  ];
9029
- stageContract = (stage, workflow) => stageContracts(workflow).find((c) => c.stage === stage);
9029
+ stageContract = (stage, studio) => stageContracts(studio).find((c) => c.stage === stage);
9030
9030
  flowNodes = () => BOARD_NODES;
9031
9031
  stageOfFlow = (flow) => flow ? BOARD_STAGES.find((c) => c.flows.includes(flow))?.stage : void 0;
9032
9032
  nodeOfFlow = (flow) => flow ? flowNodes().find((n) => n.flow === flow) : void 0;
9033
- agentForFlow = (flow, workflow) => {
9033
+ agentForFlow = (flow, studio) => {
9034
9034
  if (!flow) return void 0;
9035
- const stage = stageContracts(workflow).find((c) => c.flows.includes(flow));
9035
+ const stage = stageContracts(studio).find((c) => c.flows.includes(flow));
9036
9036
  return stage ? stage.lead || void 0 : nodeOfFlow(flow)?.agent;
9037
9037
  };
9038
- flowsOfAgent = (name, workflow) => [
9038
+ flowsOfAgent = (name, studio) => [
9039
9039
  .../* @__PURE__ */ new Set([
9040
- // Across every workflow this board has, unless one is named: the same agent leads the build
9041
- // in one workflow and nothing in another, and a rule written for it has to reach every
9042
- // flow it runs anywhere. A caller that names a workflow is asking about that one alone.
9043
- ...(workflow !== void 0 ? [workflow] : workflows().map((w) => w.id)).flatMap(
9040
+ // Across every studio this board has, unless one is named: the same agent leads the build
9041
+ // in one studio and nothing in another, and a rule written for it has to reach every
9042
+ // flow it runs anywhere. A caller that names a studio is asking about that one alone.
9043
+ ...(studio !== void 0 ? [studio] : studios().map((w) => w.id)).flatMap(
9044
9044
  (id) => stageContracts(id).filter((c) => c.lead && c.lead === name).flatMap((c) => c.flows)
9045
9045
  ),
9046
9046
  ...flowNodes().filter((n) => n.agent === name).map((n) => n.flow)
@@ -9055,9 +9055,9 @@ function landRole(name) {
9055
9055
  const agent = specAgentCatalog().agents.find((a) => a.name === name);
9056
9056
  return agent ? { name, gloss: agent.description, memory: [] } : void 0;
9057
9057
  }
9058
- function roleFlowsInOrder(name, workflow) {
9058
+ function roleFlowsInOrder(name, studio) {
9059
9059
  const order = FLOWS.map((flow) => flow.command);
9060
- return flowsOfAgent(name, workflow).sort((a, b) => order.indexOf(a) - order.indexOf(b));
9060
+ return flowsOfAgent(name, studio).sort((a, b) => order.indexOf(a) - order.indexOf(b));
9061
9061
  }
9062
9062
  function agentRoster() {
9063
9063
  const specialists = specAgentCatalog().agents.filter((agent) => !ROLE_NAMES.includes(agent.name)).map((agent) => {
@@ -9128,7 +9128,7 @@ var init_roles = __esm({
9128
9128
  gloss: "describes what the project is today, for planning and triage to follow",
9129
9129
  memory: ["memory/project.md"]
9130
9130
  };
9131
- SMALL_FIX = "A small fix is a small change whose workflow needs none of its previews.";
9131
+ SMALL_FIX = "A small fix is a small change whose studio needs none of its previews.";
9132
9132
  PROPOSER = {
9133
9133
  name: "proposer",
9134
9134
  gloss: "proposes the work a finished card leaves behind",
@@ -9143,7 +9143,7 @@ var init_roles = __esm({
9143
9143
  value: "auto",
9144
9144
  label: "Just do them",
9145
9145
  cost: "For speed over quality",
9146
- prompt: `${SMALL_FIX} Do each one instead of proposing it: create it with \`akb raw create --workflow <workflow> --source "#<finished card id>"\`, its Scope and Todo written per \`akb guide writing\`, then \`akb raw update <id> --status ready\` so it waits only for the user to approve the build.`
9146
+ prompt: `${SMALL_FIX} Do each one instead of proposing it: create it with \`akb raw create --studio <studio> --source "#<finished card id>"\`, its Scope and Todo written per \`akb guide writing\`, then \`akb raw update <id> --status ready\` so it waits only for the user to approve the build.`
9147
9147
  },
9148
9148
  { value: "propose", label: "Ask me first", cost: "For balancing speed and quality" },
9149
9149
  {
@@ -9159,7 +9159,7 @@ var init_roles = __esm({
9159
9159
  };
9160
9160
  PLANNER_ROLE = {
9161
9161
  name: PLANNER,
9162
- gloss: "plans every card, to its workflow's rules",
9162
+ gloss: "plans every card, to its studio's rules",
9163
9163
  memory: [PLANNER_DECISIONS, PLANNER_REJECTED, PLANNER_REDESIGN],
9164
9164
  hidden: true
9165
9165
  };
@@ -9176,8 +9176,8 @@ var init_roles = __esm({
9176
9176
  ROLE_NAMES = BOARD_ROLES.map((r) => r.name);
9177
9177
  PLANNING_ROLE = PLANNER_ROLE.name;
9178
9178
  roles = () => BOARD_ROLES;
9179
- roleForFlow = (flow, workflow) => {
9180
- const name = agentForFlow(flow, workflow);
9179
+ roleForFlow = (flow, studio) => {
9180
+ const name = agentForFlow(flow, studio);
9181
9181
  return name ? roleNamed(name) ?? landRole(name) : void 0;
9182
9182
  };
9183
9183
  roleNamed = (name) => roles().find((role) => role.name === name);
@@ -9193,14 +9193,24 @@ var init_roles = __esm({
9193
9193
  });
9194
9194
 
9195
9195
  // src/lib/shared/board-files.ts
9196
- var BOARD_FILE_LIMIT, cardSlug, workflowFolder, workflowName, draftFolder;
9196
+ function studioRenamed(path85, content) {
9197
+ const to = path85.replace(/^(rules\/)?workflows\//, "$1studios/").replace(/^(studios\/[^/]+)\/WORKFLOW\.md$/, "$1/STUDIO.md");
9198
+ if (!to.endsWith(".md")) return { path: to, content };
9199
+ if (to.startsWith("studios/")) return { path: to, content: content.replace(/^(icon:\s*["']?)workflow(-kit)?(["']?\s*)$/gm, "$1studio$2$3") };
9200
+ const front = /^(?:todo|triage)\//.test(to) ? /^---\r?\n[\s\S]*?\r?\n---/.exec(content)?.[0] : void 0;
9201
+ if (!front) return { path: to, content };
9202
+ const body = content.slice(front.length).replace(/^<Workflow(?=[\s/>])/gm, "<Studio");
9203
+ const renamed = front.replace(/^workflow:[ \t]*(.*)$/m, (_, id) => `studio: ${id === "workflow-builder" ? "studio-builder" : id}`);
9204
+ return { path: to, content: renamed + body };
9205
+ }
9206
+ var BOARD_FILE_LIMIT, cardSlug, studioFolder, studioName, draftFolder;
9197
9207
  var init_board_files = __esm({
9198
9208
  "src/lib/shared/board-files.ts"() {
9199
9209
  "use strict";
9200
9210
  BOARD_FILE_LIMIT = 256 * 1024;
9201
9211
  cardSlug = (task) => task.toLowerCase().replace(/_/g, "-");
9202
- workflowFolder = (id) => id.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
9203
- workflowName = (id) => id.startsWith("wf_builtin_") ? id.slice("wf_builtin_".length).replace(/_/g, "-") : workflowFolder(id);
9212
+ studioFolder = (id) => id.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
9213
+ studioName = (id) => id.startsWith("wf_builtin_") ? id.slice("wf_builtin_".length).replace(/_/g, "-") : studioFolder(id);
9204
9214
  draftFolder = (task) => cardSlug(task);
9205
9215
  }
9206
9216
  });
@@ -9265,7 +9275,7 @@ var init_icon = __esm({
9265
9275
  "schema",
9266
9276
  "compare",
9267
9277
  "stack",
9268
- "workflow",
9278
+ "studio",
9269
9279
  "code",
9270
9280
  "checklist",
9271
9281
  "card",
@@ -9284,7 +9294,7 @@ var init_icon = __esm({
9284
9294
  "blog",
9285
9295
  "deck",
9286
9296
  "video-clone",
9287
- "workflow-kit"
9297
+ "studio-kit"
9288
9298
  ];
9289
9299
  ICON_COLORS = ["k", "w", "c", "g", "o", "p", "s", "m", "l", "r", "y"];
9290
9300
  PATH = /^[MmLlHhVvCcSsQqTtAaZz0-9.,\s-]+$/;
@@ -9424,7 +9434,7 @@ function parseSpecAgent(text4, from, file, builtIn = false, list = () => []) {
9424
9434
  const old = OLD_ROLE_KEYS.filter((key) => akb[key] !== void 0);
9425
9435
  if (old.length) {
9426
9436
  return bad(
9427
- `\`${name}\` declares ${old.map((key) => `\`akb.${key}\``).join(", ")}, which the board no longer reads \u2014 remove ${old.length > 1 ? "them" : "it"}, and list the agent in its workflow's \`WORKFLOW.md\` under \`previews\`, \`land\` or \`scheduled\` (\`akb guide write-agent\`), or ask the Workflow builder to rewrite it`,
9437
+ `\`${name}\` declares ${old.map((key) => `\`akb.${key}\``).join(", ")}, which the board no longer reads \u2014 remove ${old.length > 1 ? "them" : "it"}, and list the agent in its studio's \`STUDIO.md\` under \`previews\`, \`land\` or \`scheduled\` (\`akb guide write-agent\`), or ask the Studio builder to rewrite it`,
9428
9438
  { keys: old }
9429
9439
  );
9430
9440
  }
@@ -9521,7 +9531,7 @@ var init_parse = __esm({
9521
9531
  }
9522
9532
  });
9523
9533
 
9524
- // src/lib/agent/workflow-def.ts
9534
+ // src/lib/agent/studio-def.ts
9525
9535
  function agentLines2(agents, indent2) {
9526
9536
  return agents.flatMap(
9527
9537
  (h) => !h.extra && !h.off ? [`${indent2}- ${scalar(h.agent)}`] : [
@@ -9559,8 +9569,8 @@ function stagesOf(chosen, after2) {
9559
9569
  for (const name of chosen) (stages[stageOf(name)] ??= []).push(name);
9560
9570
  return stages.filter(Boolean);
9561
9571
  }
9562
- function parseWorkflowFile(id, source, from) {
9563
- if (!WORKFLOW_ID.test(id)) return { problem: `${from}: \`${id}\` is not a workflow id \u2014 use lowercase letters, digits and dashes` };
9572
+ function parseStudioFile(id, source, from) {
9573
+ if (!STUDIO_ID.test(id)) return { problem: `${from}: \`${id}\` is not a studio id \u2014 use lowercase letters, digits and dashes` };
9564
9574
  const { meta, body } = splitFrontmatter(source);
9565
9575
  if (meta === null) return { problem: `${from}: no \`---\` frontmatter` };
9566
9576
  const raw = parseYamlBlock(meta);
@@ -9569,7 +9579,7 @@ function parseWorkflowFile(id, source, from) {
9569
9579
  const old = OLD_KEYS.filter((key) => key in raw);
9570
9580
  if (old.length) {
9571
9581
  return {
9572
- problem: `${from}: \`${old.join("`, `")}\` ${old.length > 1 ? "are" : "is"} no longer read \u2014 list the agents under \`previews\`, \`land\` and \`scheduled\` instead (\`akb guide write-agent\`), or ask the Workflow builder to rewrite it`
9582
+ problem: `${from}: \`${old.join("`, `")}\` ${old.length > 1 ? "are" : "is"} no longer read \u2014 list the agents under \`previews\`, \`land\` and \`scheduled\` instead (\`akb guide write-agent\`), or ask the Studio builder to rewrite it`
9573
9583
  };
9574
9584
  }
9575
9585
  const icon = readIcon(raw.icon);
@@ -9610,9 +9620,9 @@ function parseWorkflowFile(id, source, from) {
9610
9620
  }
9611
9621
  };
9612
9622
  }
9613
- var scalar, plain, flowList, groupLines, WORKFLOW_ID, OLD_KEYS, box, text3, readGroup;
9614
- var init_workflow_def = __esm({
9615
- "src/lib/agent/workflow-def.ts"() {
9623
+ var scalar, plain, flowList, groupLines, STUDIO_ID, OLD_KEYS, box, text3, readGroup;
9624
+ var init_studio_def = __esm({
9625
+ "src/lib/agent/studio-def.ts"() {
9616
9626
  "use strict";
9617
9627
  init_icon();
9618
9628
  init_yaml2();
@@ -9622,7 +9632,7 @@ var init_workflow_def = __esm({
9622
9632
  plain = (agents) => agents.every((h) => !h.extra && !h.off);
9623
9633
  flowList = (agents) => `[${agents.map((h) => scalar(h.agent)).join(", ")}]`;
9624
9634
  groupLines = (key, agents) => !agents.length ? [] : plain(agents) ? [`${key}: ${flowList(agents)}`] : [`${key}:`, ...agentLines2(agents, " ")];
9625
- WORKFLOW_ID = /^[a-z0-9]+(-[a-z0-9]+)*$/;
9635
+ STUDIO_ID = /^[a-z0-9]+(-[a-z0-9]+)*$/;
9626
9636
  OLD_KEYS = ["stages", "delivers", "helpers", "every"];
9627
9637
  box = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
9628
9638
  text3 = (value) => typeof value === "string" ? value.trim() : "";
@@ -9630,8 +9640,8 @@ var init_workflow_def = __esm({
9630
9640
  }
9631
9641
  });
9632
9642
 
9633
- // src/lib/agent/workflow-diagram.ts
9634
- function workflowDiagram(def, agentOf2) {
9643
+ // src/lib/agent/studio-diagram.ts
9644
+ function studioDiagram(def, agentOf2) {
9635
9645
  const step = (name) => {
9636
9646
  const agent = agentOf2(name);
9637
9647
  const en = agent?.i18n.en?.title || name;
@@ -9651,14 +9661,14 @@ function workflowDiagram(def, agentOf2) {
9651
9661
  scheduled: def.scheduled.map((s) => ({ ...step(s.agent), ...s.cadence ? { cadence: s.cadence } : {} }))
9652
9662
  };
9653
9663
  }
9654
- var init_workflow_diagram = __esm({
9655
- "src/lib/agent/workflow-diagram.ts"() {
9664
+ var init_studio_diagram = __esm({
9665
+ "src/lib/agent/studio-diagram.ts"() {
9656
9666
  "use strict";
9657
- init_workflow_def();
9667
+ init_studio_def();
9658
9668
  }
9659
9669
  });
9660
9670
 
9661
- // src/lib/shared/workflow-files.ts
9671
+ // src/lib/shared/studio-files.ts
9662
9672
  function folderPath(file, top) {
9663
9673
  const parts = file.split("/");
9664
9674
  if (parts.length < 3 || parts[0] !== top || !AGENT_NAME.test(parts[1])) return null;
@@ -9683,7 +9693,7 @@ function mcpProblem(text4) {
9683
9693
  }
9684
9694
  return null;
9685
9695
  }
9686
- function checkWorkflowFiles(value, official = false) {
9696
+ function checkStudioFiles(value, official = false) {
9687
9697
  const read3 = inspect(value, official);
9688
9698
  const first = read3.problems[0];
9689
9699
  return first ? { ok: false, ...first } : { ok: true, def: read3.def, files: read3.files };
@@ -9714,7 +9724,7 @@ function inspect(value, official) {
9714
9724
  if (size > FILE_LIMITS.file) return fail(file, `is larger than ${FILE_LIMITS.file / KB} KB`, true);
9715
9725
  total += size;
9716
9726
  if (total > FILE_LIMITS.total) return fail("files", `are larger than ${FILE_LIMITS.total / KB / KB} MB together`, true);
9717
- if (file === WORKFLOW_FILE) continue;
9727
+ if (file === STUDIO_FILE) continue;
9718
9728
  if (official && file === MCP_FILE) {
9719
9729
  const problem = mcpProblem(text4);
9720
9730
  if (problem) fail(file, problem);
@@ -9728,7 +9738,7 @@ function inspect(value, official) {
9728
9738
  }
9729
9739
  const at = folderPath(file, "agents");
9730
9740
  if (!at) {
9731
- fail(file, `is neither ${WORKFLOW_FILE} nor inside agents/<name>/`);
9741
+ fail(file, `is neither ${STUDIO_FILE} nor inside agents/<name>/`);
9732
9742
  continue;
9733
9743
  }
9734
9744
  if (!folders2.has(at[0])) folders2.set(at[0], /* @__PURE__ */ new Map());
@@ -9737,10 +9747,10 @@ function inspect(value, official) {
9737
9747
  for (const name of skills) {
9738
9748
  if (files[`skills/${name}/SKILL.md`] === void 0) fail(`skills/${name}/SKILL.md`, "is missing");
9739
9749
  }
9740
- const source = files[WORKFLOW_FILE];
9741
- const read3 = typeof source === "string" ? parseWorkflowFile("workflow", source, WORKFLOW_FILE) : null;
9742
- if (!read3) fail(WORKFLOW_FILE, "is missing");
9743
- else if ("problem" in read3) fail(WORKFLOW_FILE, read3.problem.replace(`${WORKFLOW_FILE}: `, ""));
9750
+ const source = files[STUDIO_FILE];
9751
+ const read3 = typeof source === "string" ? parseStudioFile("studio", source, STUDIO_FILE) : null;
9752
+ if (!read3) fail(STUDIO_FILE, "is missing");
9753
+ else if ("problem" in read3) fail(STUDIO_FILE, read3.problem.replace(`${STUDIO_FILE}: `, ""));
9744
9754
  const agents = /* @__PURE__ */ new Map();
9745
9755
  for (const [name, own] of folders2) {
9746
9756
  const from = `agents/${name}/AGENT.md`;
@@ -9762,18 +9772,18 @@ function inspect(value, official) {
9762
9772
  ...def.scheduled.map((s) => [s.agent, "it schedules"])
9763
9773
  ];
9764
9774
  for (const [name, why2] of named2) {
9765
- if (!agents.has(name) && !folders2.has(name)) fail(WORKFLOW_FILE, `${why2} \`${name}\`, which has no agents/${name}/AGENT.md`);
9775
+ if (!agents.has(name) && !folders2.has(name)) fail(STUDIO_FILE, `${why2} \`${name}\`, which has no agents/${name}/AGENT.md`);
9766
9776
  }
9767
9777
  return { problems, def, files };
9768
9778
  }
9769
- var WORKFLOW_FILE, MCP_FILE, VERSION_FILE, versionText, KB, FILE_LIMITS, officialId, hashInput, landsOf, SEGMENT, isAboutFile, bytes, workflowFilesProblems;
9770
- var init_workflow_files = __esm({
9771
- "src/lib/shared/workflow-files.ts"() {
9779
+ var STUDIO_FILE, MCP_FILE, VERSION_FILE, versionText, KB, FILE_LIMITS, officialId, hashInput, landsOf, SEGMENT, isAboutFile, bytes, studioFilesProblems;
9780
+ var init_studio_files = __esm({
9781
+ "src/lib/shared/studio-files.ts"() {
9772
9782
  "use strict";
9773
- init_workflow_def();
9783
+ init_studio_def();
9774
9784
  init_parse();
9775
- init_workflow_diagram();
9776
- WORKFLOW_FILE = "WORKFLOW.md";
9785
+ init_studio_diagram();
9786
+ STUDIO_FILE = "STUDIO.md";
9777
9787
  MCP_FILE = "mcp.json";
9778
9788
  VERSION_FILE = "version.json";
9779
9789
  versionText = (id, version) => `${JSON.stringify({ id, version })}
@@ -9786,11 +9796,11 @@ var init_workflow_files = __esm({
9786
9796
  SEGMENT = /^[\w.-]+$/;
9787
9797
  isAboutFile = (file) => /^ABOUT(\.[a-z]{2})?\.md$/.test(file) || /^screenshots\/[\w.-]+\.(png|jpe?g|webp)$/.test(file);
9788
9798
  bytes = (text4) => new TextEncoder().encode(text4).length;
9789
- workflowFilesProblems = (value, official = false) => inspect(value, official).problems;
9799
+ studioFilesProblems = (value, official = false) => inspect(value, official).problems;
9790
9800
  }
9791
9801
  });
9792
9802
 
9793
- // src/lib/agent/workflow-folder.ts
9803
+ // src/lib/agent/studio-folder.ts
9794
9804
  import fs28 from "node:fs";
9795
9805
  import path32 from "node:path";
9796
9806
  function filesOf(dir, base = dir) {
@@ -9799,17 +9809,17 @@ function filesOf(dir, base = dir) {
9799
9809
  return e.isDirectory() ? filesOf(full, base) : [path32.relative(base, full).split(path32.sep).join("/")];
9800
9810
  });
9801
9811
  }
9802
- function readWorkflowFile(dir, file) {
9812
+ function readStudioFile(dir, file) {
9803
9813
  const full = path32.join(dir, file);
9804
9814
  return isAboutFile(file) && !file.endsWith(".md") ? `data:${MIME[path32.extname(file)]};base64,${fs28.readFileSync(full).toString("base64")}` : fs28.readFileSync(full, "utf8");
9805
9815
  }
9806
- var MIME, readWorkflowFolder;
9807
- var init_workflow_folder = __esm({
9808
- "src/lib/agent/workflow-folder.ts"() {
9816
+ var MIME, readStudioFolder;
9817
+ var init_studio_folder = __esm({
9818
+ "src/lib/agent/studio-folder.ts"() {
9809
9819
  "use strict";
9810
- init_workflow_files();
9820
+ init_studio_files();
9811
9821
  MIME = { ".png": "image/png", ".jpg": "image/jpeg", ".jpeg": "image/jpeg", ".webp": "image/webp" };
9812
- readWorkflowFolder = (dir) => Object.fromEntries(filesOf(dir).sort().map((f) => [f, readWorkflowFile(dir, f)]));
9822
+ readStudioFolder = (dir) => Object.fromEntries(filesOf(dir).sort().map((f) => [f, readStudioFile(dir, f)]));
9813
9823
  }
9814
9824
  });
9815
9825
 
@@ -9822,32 +9832,32 @@ function packOfficial(root2 = OFFICIAL, loose = false) {
9822
9832
  const agentsDir = path33.join(root2, "agents");
9823
9833
  const agentFiles = Object.fromEntries(dirs(agentsDir).map((name) => {
9824
9834
  const dir = path33.join(agentsDir, name);
9825
- return [name, readWorkflowFolder(dir)];
9835
+ return [name, readStudioFolder(dir)];
9826
9836
  }));
9827
9837
  for (const [name, own] of Object.entries(loose ? {} : agentFiles)) {
9828
9838
  const read3 = parseSpecAgent(own["AGENT.md"] ?? "", `official/agents/${name}/AGENT.md`, (p) => own[p] ?? null, true);
9829
9839
  if ("problem" in read3) throw new Error(read3.problem);
9830
9840
  }
9831
- const workflowsDir = path33.join(root2, "workflows");
9832
- return dirs(workflowsDir).map((folder) => {
9833
- const dir = path33.join(workflowsDir, folder);
9841
+ const studiosDir = path33.join(root2, "studios");
9842
+ return dirs(studiosDir).map((folder) => {
9843
+ const dir = path33.join(studiosDir, folder);
9834
9844
  const files = {};
9835
9845
  for (const f of filesOf(dir).sort()) {
9836
- if (f === WORKFLOW_FILE || f === MCP_FILE || f.startsWith("skills/") || isAboutFile(f)) files[f] = readWorkflowFile(dir, f);
9846
+ if (f === STUDIO_FILE || f === MCP_FILE || f.startsWith("skills/") || isAboutFile(f)) files[f] = readStudioFile(dir, f);
9837
9847
  }
9838
- const read3 = checkWorkflowFiles({ [WORKFLOW_FILE]: files[WORKFLOW_FILE], ...Object.fromEntries(
9848
+ const read3 = checkStudioFiles({ [STUDIO_FILE]: files[STUDIO_FILE], ...Object.fromEntries(
9839
9849
  Object.entries(agentFiles).flatMap(([name, own]) => Object.entries(own).map(([f, t]) => [`agents/${name}/${f}`, t]))
9840
9850
  ) });
9841
- if (!read3.ok && !loose) throw new Error(`official/workflows/${folder}: ${read3.file}: ${read3.reason}`);
9842
- const parsed = parseWorkflowFile(folder, files[WORKFLOW_FILE] ?? "", WORKFLOW_FILE);
9851
+ if (!read3.ok && !loose) throw new Error(`official/studios/${folder}: ${read3.file}: ${read3.reason}`);
9852
+ const parsed = parseStudioFile(folder, files[STUDIO_FILE] ?? "", STUDIO_FILE);
9843
9853
  if ("problem" in parsed) throw new Error(parsed.problem);
9844
9854
  const def = parsed.def;
9845
9855
  for (const name of [...new Set([...def.previews, ...def.land, ...def.scheduled].map((h) => h.agent))].sort()) {
9846
9856
  for (const [f, text4] of Object.entries(agentFiles[name] ?? {})) files[`agents/${name}/${f}`] = text4;
9847
9857
  }
9848
- const checked = loose ? { ok: true } : checkWorkflowFiles(files, true);
9849
- if (!checked.ok) throw new Error(`official/workflows/${folder}: ${checked.file}: ${checked.reason}`);
9850
- if (!def.names?.zh && !loose) throw new Error(`official/workflows/${folder}/${WORKFLOW_FILE}: add its Chinese name under \`names: zh\``);
9858
+ const checked = loose ? { ok: true } : checkStudioFiles(files, true);
9859
+ if (!checked.ok) throw new Error(`official/studios/${folder}: ${checked.file}: ${checked.reason}`);
9860
+ if (!def.names?.zh && !loose) throw new Error(`official/studios/${folder}/${STUDIO_FILE}: add its Chinese name under \`names: zh\``);
9851
9861
  return {
9852
9862
  id: officialId(folder),
9853
9863
  name: def.name,
@@ -9864,16 +9874,16 @@ var OFFICIAL, dirs, hashOf;
9864
9874
  var init_pack = __esm({
9865
9875
  "../official/pack.ts"() {
9866
9876
  init_parse();
9867
- init_workflow_def();
9868
- init_workflow_folder();
9869
- init_workflow_files();
9877
+ init_studio_def();
9878
+ init_studio_folder();
9879
+ init_studio_files();
9870
9880
  OFFICIAL = path33.dirname(fileURLToPath2(import.meta.url));
9871
9881
  dirs = (dir) => fs29.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name).sort();
9872
9882
  hashOf = (files) => crypto2.createHash("sha256").update(hashInput(files)).digest("hex");
9873
9883
  }
9874
9884
  });
9875
9885
 
9876
- // src/lib/agent/cloud-workflows.ts
9886
+ // src/lib/agent/cloud-studios.ts
9877
9887
  import fs30 from "node:fs";
9878
9888
  import path34 from "node:path";
9879
9889
  function readJson(file) {
@@ -9890,14 +9900,14 @@ function writeJson(file, value) {
9890
9900
  `);
9891
9901
  fs30.renameSync(tmp, file);
9892
9902
  }
9893
- function heldWorkflowName(name) {
9903
+ function heldStudioName(name) {
9894
9904
  let files;
9895
9905
  try {
9896
9906
  files = fs30.readdirSync(path34.join(root(), "versions"));
9897
9907
  } catch {
9898
9908
  return "";
9899
9909
  }
9900
- const held4 = files.filter((f) => f.endsWith(".json")).map((f) => f.slice(0, f.lastIndexOf("@"))).find((id) => workflowName(id) === name);
9910
+ const held4 = files.filter((f) => f.endsWith(".json")).map((f) => f.slice(0, f.lastIndexOf("@"))).find((id) => studioName(id) === name);
9901
9911
  if (!held4) return "";
9902
9912
  const file = files.filter((f) => f.startsWith(`${held4}@`)).sort().pop();
9903
9913
  return readJson(path34.join(root(), "versions", file))?.name ?? "";
@@ -9908,9 +9918,9 @@ function saveVersion(held4) {
9908
9918
  }
9909
9919
  function savePin(task, held4) {
9910
9920
  saveVersion(held4);
9911
- writeJson(pinFile(task), { workflow: held4.id, version: held4.version });
9921
+ writeJson(pinFile(task), { studio: held4.id, version: held4.version });
9912
9922
  }
9913
- function workflowsReachable() {
9923
+ function studiosReachable() {
9914
9924
  if (devFolder()) return { ok: true };
9915
9925
  return boardProject() && readSession() ? { ok: true } : { ok: false, kind: "needs-cloud" };
9916
9926
  }
@@ -9918,27 +9928,27 @@ function pinMissing() {
9918
9928
  const task = workspaceTask();
9919
9929
  if (devFolder() || !task) return false;
9920
9930
  const pin = readPin(task);
9921
- return !(pin && readVersion(pin.workflow, pin.version));
9931
+ return !(pin && readVersion(pin.studio, pin.version));
9922
9932
  }
9923
9933
  async function versionOf(id, version) {
9924
9934
  const held4 = readVersion(id, version);
9925
9935
  if (held4) return { ok: true, value: held4 };
9926
- const read3 = await call("GET", `/v1/workflows/${encodeURIComponent(id)}`);
9936
+ const read3 = await call("GET", `/v1/studios/${encodeURIComponent(id)}`);
9927
9937
  if (!read3.ok) return read3;
9928
9938
  saveVersion(read3.value);
9929
9939
  return read3;
9930
9940
  }
9931
9941
  async function pinTask(task) {
9932
9942
  const pin = readPin(task);
9933
- const held4 = pin && readVersion(pin.workflow, pin.version);
9943
+ const held4 = pin && readVersion(pin.studio, pin.version);
9934
9944
  if (held4) return { ok: true, value: held4 };
9935
- const read3 = await call("GET", `/v1/tasks/${encodeURIComponent(task)}/workflow`);
9945
+ const read3 = await call("GET", `/v1/tasks/${encodeURIComponent(task)}/studio`);
9936
9946
  if (!read3.ok) return read3;
9937
- const value = { id: read3.value.workflow, version: read3.value.version, name: read3.value.name, files: read3.value.files };
9947
+ const value = { id: read3.value.studio, version: read3.value.version, name: read3.value.name, files: read3.value.files };
9938
9948
  savePin(task, value);
9939
9949
  return { ok: true, value };
9940
9950
  }
9941
- async function syncWorkflows(force = false) {
9951
+ async function syncStudios(force = false) {
9942
9952
  offline = false;
9943
9953
  const project2 = boardProject();
9944
9954
  if (devFolder() || !project2 || !cloudConfigured() || !readSession()) return;
@@ -9965,7 +9975,7 @@ async function syncWorkflows(force = false) {
9965
9975
  do {
9966
9976
  const page = await call(
9967
9977
  "GET",
9968
- `/v1/workflows?workspace=${encodeURIComponent(workspace2)}&limit=100${after2 ? `&after=${encodeURIComponent(after2)}` : ""}`
9978
+ `/v1/studios?workspace=${encodeURIComponent(workspace2)}&limit=100${after2 ? `&after=${encodeURIComponent(after2)}` : ""}`
9969
9979
  );
9970
9980
  if (!page.ok) {
9971
9981
  offline = !page.code;
@@ -9980,7 +9990,7 @@ async function syncWorkflows(force = false) {
9980
9990
  if (read3.ok) kept2.push({ id: read3.value.id, version: read3.value.version });
9981
9991
  else if (!read3.code) offline = true;
9982
9992
  }
9983
- writeJson(listFile(project2), { at: (/* @__PURE__ */ new Date()).toISOString(), workspace: workspace2, workflows: kept2 });
9993
+ writeJson(listFile(project2), { at: (/* @__PURE__ */ new Date()).toISOString(), workspace: workspace2, studios: kept2 });
9984
9994
  } catch {
9985
9995
  offline = true;
9986
9996
  }
@@ -9992,14 +10002,14 @@ function readFlows() {
9992
10002
  }
9993
10003
  const project2 = boardProject();
9994
10004
  if (!project2 || !readSession()) return [];
9995
- const list = readJson(listFile(project2))?.workflows ?? [];
10005
+ const list = readJson(listFile(project2))?.studios ?? [];
9996
10006
  const flows2 = list.flatMap((w) => {
9997
10007
  const held4 = readVersion(w.id, w.version);
9998
10008
  return held4 ? flowOf(held4) ?? [] : [];
9999
10009
  });
10000
10010
  const task = workspaceTask();
10001
10011
  const pin = task ? readPin(task) : null;
10002
- const pinned2 = pin && readVersion(pin.workflow, pin.version);
10012
+ const pinned2 = pin && readVersion(pin.studio, pin.version);
10003
10013
  const mine = pinned2 && flowOf(pinned2);
10004
10014
  if (!mine) return flows2;
10005
10015
  return [mine, ...flows2.filter((f) => f.cloudId !== mine.cloudId)];
@@ -10021,9 +10031,9 @@ function cloudAgentFiles() {
10021
10031
  }
10022
10032
  return { files, official };
10023
10033
  }
10024
- var DEV, FRESH_MS2, root, safe, versionFile, listFile, pinFile, readVersion, readPin, boardProject, devFolder, NEEDS_CLOUD, NOT_DOWNLOADED, offline, workflowsOffline, flowOf, sources, flows, cloudWorkflowSources, cloudFlows;
10025
- var init_cloud_workflows = __esm({
10026
- "src/lib/agent/cloud-workflows.ts"() {
10034
+ var DEV, FRESH_MS2, root, safe, versionFile, listFile, pinFile, readVersion, readPin, boardProject, devFolder, NEEDS_CLOUD, NOT_DOWNLOADED, offline, studiosOffline, flowOf, sources, flows, cloudStudioSources, cloudFlows;
10035
+ var init_cloud_studios = __esm({
10036
+ "src/lib/agent/cloud-studios.ts"() {
10027
10037
  "use strict";
10028
10038
  init_board_files();
10029
10039
  init_pack();
@@ -10033,10 +10043,10 @@ var init_cloud_workflows = __esm({
10033
10043
  init_file_memo();
10034
10044
  init_home();
10035
10045
  init_paths();
10036
- init_workflow_def();
10037
- DEV = "AI4KANBAN_WORKFLOWS";
10046
+ init_studio_def();
10047
+ DEV = "AI4KANBAN_STUDIOS";
10038
10048
  FRESH_MS2 = 6e4;
10039
- root = () => path34.join(machineHome(), "workflows");
10049
+ root = () => path34.join(machineHome(), "studios");
10040
10050
  safe = (name) => name.replace(/[^\w.@-]/g, "_");
10041
10051
  versionFile = (id, version) => path34.join(root(), "versions", `${safe(id)}@${version}.json`);
10042
10052
  listFile = (project2) => path34.join(root(), "lists", `${safe(project2)}.json`);
@@ -10045,13 +10055,13 @@ var init_cloud_workflows = __esm({
10045
10055
  readPin = (task) => readJson(pinFile(task));
10046
10056
  boardProject = () => KANBAN ? runnerProject(KANBAN) : null;
10047
10057
  devFolder = () => process.env[DEV]?.trim() || "";
10048
- NEEDS_CLOUD = "Sign in to run workflows.";
10049
- NOT_DOWNLOADED = "This workflow isn't downloaded yet. Connect and try again.";
10058
+ NEEDS_CLOUD = "Sign in to run studios.";
10059
+ NOT_DOWNLOADED = "This studio isn't downloaded yet. Connect and try again.";
10050
10060
  offline = false;
10051
- workflowsOffline = () => offline;
10061
+ studiosOffline = () => offline;
10052
10062
  flowOf = (held4) => {
10053
- const id = workflowName(held4.id);
10054
- const read3 = parseWorkflowFile(id, held4.files["WORKFLOW.md"] ?? "", `the \`${id}\` workflow`);
10063
+ const id = studioName(held4.id);
10064
+ const read3 = parseStudioFile(id, held4.files["STUDIO.md"] ?? "", `the \`${id}\` studio`);
10055
10065
  if ("problem" in read3) return null;
10056
10066
  return { def: read3.def, cloudId: held4.id, version: held4.version, builtIn: held4.id.startsWith("wf_builtin_"), files: held4.files };
10057
10067
  };
@@ -10062,7 +10072,7 @@ var init_cloud_workflows = __esm({
10062
10072
  return [sessionFile(), ...project2 ? [listFile(project2)] : [], ...task ? [pinFile(task)] : []];
10063
10073
  };
10064
10074
  flows = memoByFiles(sources, readFlows);
10065
- cloudWorkflowSources = sources;
10075
+ cloudStudioSources = sources;
10066
10076
  cloudFlows = () => flows();
10067
10077
  }
10068
10078
  });
@@ -10072,7 +10082,7 @@ var shippedAgentFiles, officialAgent;
10072
10082
  var init_bundled2 = __esm({
10073
10083
  "src/lib/agents/bundled.ts"() {
10074
10084
  "use strict";
10075
- init_cloud_workflows();
10085
+ init_cloud_studios();
10076
10086
  shippedAgentFiles = () => cloudAgentFiles().files;
10077
10087
  officialAgent = (name) => cloudAgentFiles().official.has(name);
10078
10088
  }
@@ -10155,7 +10165,7 @@ function checkAgentKeys(agents, places) {
10155
10165
  agent.name,
10156
10166
  agent.after.filter((other) => {
10157
10167
  if (places.get(other) === places.get(agent.name)) return true;
10158
- const what = byName.has(other) ? "is not a preview of the same workflow" : "is not an agent on this board";
10168
+ const what = byName.has(other) ? "is not a preview of the same studio" : "is not an agent on this board";
10159
10169
  problems.push(`${agent.from}: \`akb.after\` names \`${other}\`, which ${what} \u2014 ignoring it`);
10160
10170
  return false;
10161
10171
  })
@@ -10184,7 +10194,7 @@ function checkAgentKeys(agents, places) {
10184
10194
  function readBundled(folder) {
10185
10195
  const shipped = shippedAgentFiles();
10186
10196
  const official = officialAgent(folder);
10187
- const label = official ? `the built-in \`${folder}\` agent` : `the workflow agent \`${folder}\``;
10197
+ const label = official ? `the built-in \`${folder}\` agent` : `the studio agent \`${folder}\``;
10188
10198
  const file = (relative) => shipped[`${folder}/${relative}`] ?? null;
10189
10199
  const text4 = file("AGENT.md");
10190
10200
  if (text4 === null) return { problem: `${label} has no AGENT.md` };
@@ -10242,10 +10252,10 @@ var init_catalog = __esm({
10242
10252
  init_roles();
10243
10253
  init_paths();
10244
10254
  init_bundled2();
10245
- init_cloud_workflows();
10255
+ init_cloud_studios();
10246
10256
  init_file_memo();
10247
10257
  init_parse();
10248
- specAgentCatalog = memoByFiles(() => [AGENTS, LEGACY_AGENTS, ...cloudWorkflowSources()], readCatalog);
10258
+ specAgentCatalog = memoByFiles(() => [AGENTS, LEGACY_AGENTS, ...cloudStudioSources()], readCatalog);
10249
10259
  bundledFolders = () => [...new Set(Object.keys(shippedAgentFiles()).map((key) => key.split("/")[0]))].sort();
10250
10260
  AGENT_FILE = "AGENT.md";
10251
10261
  LEGACY_AGENT_FILE = "SKILL.md";
@@ -10254,10 +10264,10 @@ var init_catalog = __esm({
10254
10264
  }
10255
10265
  });
10256
10266
 
10257
- // src/lib/agent/workflow-file.ts
10267
+ // src/lib/agent/studio-file.ts
10258
10268
  import fs32 from "node:fs";
10259
10269
  import path36 from "node:path";
10260
- function workflowFileText(def) {
10270
+ function studioFileText(def) {
10261
10271
  const lines = ["---", `name: ${scalar(def.name)}`];
10262
10272
  const names3 = Object.entries(def.names ?? {});
10263
10273
  if (names3.length) lines.push("names:", ...names3.map(([lang, said2]) => ` ${lang}: ${scalar(said2)}`));
@@ -10292,52 +10302,52 @@ function readFolder(id, problems) {
10292
10302
  problems.push(`${rel(fileOf(id))} is missing`);
10293
10303
  return null;
10294
10304
  }
10295
- const read3 = parseWorkflowFile(id, source, rel(fileOf(id)));
10305
+ const read3 = parseStudioFile(id, source, rel(fileOf(id)));
10296
10306
  if ("problem" in read3) {
10297
10307
  problems.push(read3.problem);
10298
10308
  return null;
10299
10309
  }
10300
10310
  return read3.def;
10301
10311
  }
10302
- function boardWorkflowDefs() {
10312
+ function boardStudioDefs() {
10303
10313
  const problems = [];
10304
10314
  const defs = cloudFlows().filter((f) => !f.builtIn).map((f) => f.def);
10305
10315
  const draft = draftId();
10306
10316
  const mine = draft ? readFolder(draft, problems) : null;
10307
10317
  return { defs: mine ? [...defs, mine] : defs, problems };
10308
10318
  }
10309
- function writeWorkflowDef(def) {
10319
+ function writeStudioDef(def) {
10310
10320
  const file = fileOf(def.id);
10311
10321
  fs32.mkdirSync(path36.dirname(file), { recursive: true });
10312
- fs32.writeFileSync(file, workflowFileText(def));
10322
+ fs32.writeFileSync(file, studioFileText(def));
10313
10323
  forgetFileMemos();
10314
10324
  }
10315
- var WORKFLOW_FILE2, builtinDefs, fileOf;
10316
- var init_workflow_file = __esm({
10317
- "src/lib/agent/workflow-file.ts"() {
10325
+ var STUDIO_FILE2, builtinDefs, fileOf;
10326
+ var init_studio_file = __esm({
10327
+ "src/lib/agent/studio-file.ts"() {
10318
10328
  "use strict";
10319
10329
  init_file_memo();
10320
10330
  init_board_files();
10321
10331
  init_tasks();
10322
10332
  init_paths();
10323
- init_cloud_workflows();
10324
- init_workflow_def();
10325
- init_workflow_def();
10326
- WORKFLOW_FILE2 = "WORKFLOW.md";
10333
+ init_cloud_studios();
10334
+ init_studio_def();
10335
+ init_studio_def();
10336
+ STUDIO_FILE2 = "STUDIO.md";
10327
10337
  builtinDefs = () => cloudFlows().filter((f) => f.builtIn).map((f) => f.def);
10328
- fileOf = (id) => path36.join(WORKFLOWS, id, WORKFLOW_FILE2);
10338
+ fileOf = (id) => path36.join(STUDIOS, id, STUDIO_FILE2);
10329
10339
  }
10330
10340
  });
10331
10341
 
10332
- // src/lib/agent/workflows.ts
10342
+ // src/lib/agent/studios.ts
10333
10343
  import fs33 from "node:fs";
10334
10344
  import path37 from "node:path";
10335
- function workflowPurpose(flow) {
10345
+ function studioPurpose(flow) {
10336
10346
  if (flow.builtIn) return builtinDescription(flow.id) || flow.name;
10337
- return boardWorkflowDefs().defs.find((d) => d.id === flow.id)?.description || flow.name;
10347
+ return boardStudioDefs().defs.find((d) => d.id === flow.id)?.description || flow.name;
10338
10348
  }
10339
- function workflowWhen(flow) {
10340
- const defs = flow.builtIn ? builtinDefs() : boardWorkflowDefs().defs;
10349
+ function studioWhen(flow) {
10350
+ const defs = flow.builtIn ? builtinDefs() : boardStudioDefs().defs;
10341
10351
  return defs.find((d) => d.id === flow.id)?.when ?? "";
10342
10352
  }
10343
10353
  function readScheduled(raw) {
@@ -10373,49 +10383,49 @@ function resolveOne(cfg, def, builtIn) {
10373
10383
  rules: def.rules
10374
10384
  };
10375
10385
  }
10376
- function writtenWorkflows() {
10386
+ function writtenStudios() {
10377
10387
  const cfg = safeConfig();
10378
- return [...builtinDefs().map((def) => resolveOne(cfg, def, true)), ...boardWorkflowDefs().defs.map((def) => resolveOne(cfg, def, false))];
10388
+ return [...builtinDefs().map((def) => resolveOne(cfg, def, true)), ...boardStudioDefs().defs.map((def) => resolveOne(cfg, def, false))];
10379
10389
  }
10380
- function knownWorkflow(asked) {
10381
- const flow = workflowById(asked.trim());
10390
+ function knownStudio(asked) {
10391
+ const flow = studioById(asked.trim());
10382
10392
  if (!flow) {
10383
- die(`no workflow called "${asked.trim()}" on this board. It has: ${workflows().map((w) => w.id).join(", ")}.`, {
10384
- kind: "no-such-workflow",
10385
- workflow: asked.trim()
10393
+ die(`no studio called "${asked.trim()}" on this board. It has: ${studios().map((w) => w.id).join(", ")}.`, {
10394
+ kind: "no-such-studio",
10395
+ studio: asked.trim()
10386
10396
  });
10387
10397
  }
10388
10398
  return flow.id;
10389
10399
  }
10390
- function workflowFor(id) {
10400
+ function studioFor(id) {
10391
10401
  const wanted = (id ?? "").trim();
10392
- return wanted ? workflowById(wanted) : void 0;
10402
+ return wanted ? studioById(wanted) : void 0;
10393
10403
  }
10394
- function noWorkflowMessage(id) {
10404
+ function noStudioMessage(id) {
10395
10405
  const wanted = (id ?? "").trim();
10396
10406
  const zh = translating();
10397
- if (!wanted || !workflows().length) return zh ? "\u5148\u5B89\u88C5\u4E00\u4E2A\u5DE5\u4F5C\u6D41" : "Install a workflow first.";
10398
- const name = heldWorkflowName(wanted) || wanted;
10399
- return zh ? `\u6B64\u4EFB\u52A1\u7684\u5DE5\u4F5C\u6D41\u300C${name}\u300D\u672A\u5B89\u88C5` : `This task's workflow "${name}" is not installed.`;
10407
+ if (!wanted || !studios().length) return zh ? "\u5148\u5B89\u88C5\u4E00\u4E2A\u5DE5\u4F5C\u53F0" : "Install a studio first.";
10408
+ const name = heldStudioName(wanted) || wanted;
10409
+ return zh ? `\u6B64\u4EFB\u52A1\u7684\u5DE5\u4F5C\u53F0\u300C${name}\u300D\u672A\u5B89\u88C5` : `This task's studio "${name}" is not installed.`;
10400
10410
  }
10401
10411
  function previewStages(flow, chosen) {
10402
10412
  const names3 = flow ? previewAgents(flow).map((h) => h.agent).filter((name) => chosen.includes(name)) : [];
10403
10413
  const stages = stagesOf(names3, agentAfter);
10404
10414
  return stages.length ? stages : [[]];
10405
10415
  }
10406
- function userWorkflowRules(flow) {
10416
+ function userStudioRules(flow) {
10407
10417
  try {
10408
- return fs33.readFileSync(workflowRuleFile(flow.id), "utf8").trim();
10418
+ return fs33.readFileSync(studioRuleFile(flow.id), "utf8").trim();
10409
10419
  } catch {
10410
10420
  return "";
10411
10421
  }
10412
10422
  }
10413
- function workflowProblems(id) {
10414
- return workflowIssues(id).map((issue) => issue.error);
10423
+ function studioProblems(id) {
10424
+ return studioIssues(id).map((issue) => issue.error);
10415
10425
  }
10416
- function workflowIssues(id) {
10417
- const flow = workflowById(id);
10418
- if (!flow) return [refusal("workflowNotFound", `this board has no \`${id}\` workflow.`, { id })];
10426
+ function studioIssues(id) {
10427
+ const flow = studioById(id);
10428
+ if (!flow) return [refusal("studioNotFound", `this board has no \`${id}\` studio.`, { id })];
10419
10429
  const known2 = onBoard();
10420
10430
  const problems = [];
10421
10431
  for (const { agent } of landAgents(flow)) {
@@ -10427,10 +10437,10 @@ function workflowIssues(id) {
10427
10437
  continue;
10428
10438
  }
10429
10439
  problems.push(
10430
- refusal("workflowLandMissing", `\`${flow.name}\` lands with \`${agent}\`, and this board has no such agent.`, {
10440
+ refusal("studioLandMissing", `\`${flow.name}\` lands with \`${agent}\`, and this board has no such agent.`, {
10431
10441
  name: flow.name,
10432
10442
  agent,
10433
- workflow: flow.id
10443
+ studio: flow.id
10434
10444
  })
10435
10445
  );
10436
10446
  }
@@ -10446,10 +10456,10 @@ function landRefused(flow, agent, found2) {
10446
10456
  folderName: `its folder is \`${found2.folder}\` but ${found2.file} names it \`${declared}\` \u2014 make the two match`,
10447
10457
  file: `${found2.file} has an error \u2014 \`akb raw previews\` says which`
10448
10458
  };
10449
- return refusal("workflowLandRefused", `\`${agent}\`, which lands \`${flow.name}\`, can't be used: ${fix[found2.cause]}.`, {
10459
+ return refusal("studioLandRefused", `\`${agent}\`, which lands \`${flow.name}\`, can't be used: ${fix[found2.cause]}.`, {
10450
10460
  name: flow.name,
10451
10461
  agent,
10452
- workflow: flow.id,
10462
+ studio: flow.id,
10453
10463
  cause: found2.cause,
10454
10464
  file: found2.file,
10455
10465
  folder: found2.folder,
@@ -10459,33 +10469,33 @@ function landRefused(flow, agent, found2) {
10459
10469
  }
10460
10470
  function writeDraft(def, settings) {
10461
10471
  try {
10462
- writeWorkflowDef(def);
10472
+ writeStudioDef(def);
10463
10473
  } catch (e) {
10464
10474
  const why2 = e instanceof Error ? e.message : String(e);
10465
- return { ok: false, ...refusal("fileWrite", `couldn't write the "${def.name}" workflow: ${why2}`, { path: def.id, details: why2 }) };
10475
+ return { ok: false, ...refusal("fileWrite", `couldn't write the "${def.name}" studio: ${why2}`, { path: def.id, details: why2 }) };
10466
10476
  }
10467
10477
  return settings ? save2(settings) : { ok: true };
10468
10478
  }
10469
- function renameWorkflow(id, name) {
10479
+ function renameStudio(id, name) {
10470
10480
  const draft = draftId();
10471
10481
  if (!draft) return readOnly();
10472
- if (id !== draft) return { ok: false, ...refusal("workflowReadOnly", `only the draft, \`${draft}\`, is renamed here`, { id }) };
10482
+ if (id !== draft) return { ok: false, ...refusal("studioReadOnly", `only the draft, \`${draft}\`, is renamed here`, { id }) };
10473
10483
  const wanted = trimmedName(name);
10474
- if (!wanted) return { ok: false, ...refusal("workflowUnnamed", "a workflow needs a name") };
10475
- if (nameTaken(wanted, id)) return { ok: false, ...refusal("workflowTaken", `this workspace already has a workflow called "${wanted}"`, { name: wanted }) };
10484
+ if (!wanted) return { ok: false, ...refusal("studioUnnamed", "a studio needs a name") };
10485
+ if (nameTaken(wanted, id)) return { ok: false, ...refusal("studioTaken", `this workspace already has a studio called "${wanted}"`, { name: wanted }) };
10476
10486
  const def = draftDef(id);
10477
10487
  return def ? writeDraft({ ...def, name: wanted }) : notFound(id);
10478
10488
  }
10479
10489
  function elsewhere(agent, id) {
10480
- const owner = agentWorkflow(agent);
10490
+ const owner = agentStudio(agent);
10481
10491
  if (!owner || owner === id) return null;
10482
- const name = workflowById(owner)?.name ?? owner;
10492
+ const name = studioById(owner)?.name ?? owner;
10483
10493
  return {
10484
10494
  ok: false,
10485
- ...refusal("agentOtherWorkflow", `\`${agent}\` belongs to the "${name}" workflow \u2014 create a new agent here instead`, {
10495
+ ...refusal("agentOtherStudio", `\`${agent}\` belongs to the "${name}" studio \u2014 create a new agent here instead`, {
10486
10496
  agent,
10487
10497
  name,
10488
- workflow: owner
10498
+ studio: owner
10489
10499
  })
10490
10500
  };
10491
10501
  }
@@ -10494,14 +10504,14 @@ function scheduledMembers(flow) {
10494
10504
  return flow.scheduled.filter((h) => known2.has(h.agent));
10495
10505
  }
10496
10506
  function listedScheduled(flow) {
10497
- const def = (flow.builtIn ? builtinDefs() : boardWorkflowDefs().defs).find((d) => d.id === flow.id);
10507
+ const def = (flow.builtIn ? builtinDefs() : boardStudioDefs().defs).find((d) => d.id === flow.id);
10498
10508
  const known2 = onBoard();
10499
10509
  return (def?.scheduled ?? []).map((s) => s.agent).filter((agent) => known2.has(agent));
10500
10510
  }
10501
10511
  function setScheduled(id, change2, claim = "") {
10502
- const flow = workflowById(id);
10512
+ const flow = studioById(id);
10503
10513
  if (!flow) return notFound(id);
10504
- const rows = scheduledMembers(flow).filter((h) => agentWorkflow(h.agent) === id || h.agent === claim).map((h) => ({ ...h }));
10514
+ const rows = scheduledMembers(flow).filter((h) => agentStudio(h.agent) === id || h.agent === claim).map((h) => ({ ...h }));
10505
10515
  const refused = change2(rows);
10506
10516
  if (refused) return refused;
10507
10517
  return save2((block) => {
@@ -10518,10 +10528,10 @@ function stampScheduledRun(id, agent, startedAt) {
10518
10528
  if (!one) return { ok: false, error: "" };
10519
10529
  one.lastRun = formatStamp(startedAt);
10520
10530
  },
10521
- agentWorkflow(agent) ? "" : agent
10531
+ agentStudio(agent) ? "" : agent
10522
10532
  ).ok;
10523
10533
  }
10524
- function adoptWorkflowScheduled(id, agent, from) {
10534
+ function adoptStudioScheduled(id, agent, from) {
10525
10535
  const refused = elsewhere(agent, id);
10526
10536
  if (refused) return refused;
10527
10537
  return setScheduled(id, (rows) => {
@@ -10546,8 +10556,8 @@ function cardMeta(id) {
10546
10556
  return null;
10547
10557
  }
10548
10558
  }
10549
- function frozenWorkflow(id) {
10550
- const flow = workflowFor(id);
10559
+ function frozenStudio(id) {
10560
+ const flow = studioFor(id);
10551
10561
  if (!flow) return void 0;
10552
10562
  const row = (h) => ({ agent: h.agent, extra: h.extra });
10553
10563
  return {
@@ -10558,9 +10568,9 @@ function frozenWorkflow(id) {
10558
10568
  land: landAgents(flow).map(row)
10559
10569
  };
10560
10570
  }
10561
- var builtinDescription, workflowsBlock, storedStages, SCHEDULE, toRow, scheduledRow, workflowFileProblems, allListed, resolved, agentAfter, agentKeyProblems, agentWorkflow, workflows, workflowById, onBoard, previewMembers, previewAgents, landAgents, archivesOnApproval, workflowRuleFile, save2, draftDef, notFound, readOnly, trimmedName, nameTaken, scheduledAgent, cardWorkflowId, cardStages, cardStage;
10562
- var init_workflows = __esm({
10563
- "src/lib/agent/workflows.ts"() {
10571
+ var builtinDescription, studiosBlock, storedStages, SCHEDULE, toRow, scheduledRow, studioFileProblems, allListed, resolved, agentAfter, agentKeyProblems, agentStudio, studios, studioById, onBoard, previewMembers, previewAgents, landAgents, archivesOnApproval, studioRuleFile, save2, draftDef, notFound, readOnly, trimmedName, nameTaken, scheduledAgent, cardStudioId, cardStages, cardStage;
10572
+ var init_studios = __esm({
10573
+ "src/lib/agent/studios.ts"() {
10564
10574
  "use strict";
10565
10575
  init_cards();
10566
10576
  init_frontmatter();
@@ -10570,13 +10580,13 @@ var init_workflows = __esm({
10570
10580
  init_settings();
10571
10581
  init_catalog();
10572
10582
  init_spec_agent_names();
10573
- init_cloud_workflows();
10583
+ init_cloud_studios();
10574
10584
  init_language();
10575
- init_workflow_file();
10585
+ init_studio_file();
10576
10586
  init_types();
10577
10587
  builtinDescription = (id) => builtinDefs().find((w) => w.id === id)?.description;
10578
- workflowsBlock = (cfg) => configBlock(cfg.workflows);
10579
- storedStages = (cfg, id) => configBlock(configBlock(workflowsBlock(cfg).stages)[id]);
10588
+ studiosBlock = (cfg) => configBlock(cfg.studios);
10589
+ storedStages = (cfg, id) => configBlock(configBlock(studiosBlock(cfg).stages)[id]);
10580
10590
  SCHEDULE = "schedule";
10581
10591
  toRow = (h) => ({ agent: h.agent, extra: h.extra, ...h.off ? { off: true } : {} });
10582
10592
  scheduledRow = (h) => ({
@@ -10585,12 +10595,12 @@ var init_workflows = __esm({
10585
10595
  ...h.lastRun ? { lastRun: h.lastRun } : {},
10586
10596
  ...h.since ? { since: h.since } : {}
10587
10597
  });
10588
- workflowFileProblems = () => boardWorkflowDefs().problems;
10598
+ studioFileProblems = () => boardStudioDefs().problems;
10589
10599
  allListed = (flow) => [...flow.previews, ...flow.land, ...flow.scheduled];
10590
10600
  resolved = memoByFiles(
10591
- () => [UI_CONFIG, LEGACY_UI_CONFIG, WORKFLOWS, AGENTS, LEGACY_AGENTS, ...cloudWorkflowSources()],
10601
+ () => [UI_CONFIG, LEGACY_UI_CONFIG, STUDIOS, AGENTS, LEGACY_AGENTS, ...cloudStudioSources()],
10592
10602
  () => {
10593
- const flows2 = writtenWorkflows();
10603
+ const flows2 = writtenStudios();
10594
10604
  const catalog = specAgentCatalog().agents;
10595
10605
  const known2 = new Set(catalog.map((a) => a.name));
10596
10606
  const owners = /* @__PURE__ */ new Map();
@@ -10620,9 +10630,9 @@ var init_workflows = __esm({
10620
10630
  );
10621
10631
  agentAfter = (name) => resolved().keys.after.get(name) ?? [];
10622
10632
  agentKeyProblems = () => resolved().keys.problems;
10623
- agentWorkflow = (name) => resolved().owners.get(name) ?? "";
10624
- workflows = () => resolved().flows;
10625
- workflowById = (id) => workflows().find((w) => w.id === id);
10633
+ agentStudio = (name) => resolved().owners.get(name) ?? "";
10634
+ studios = () => resolved().flows;
10635
+ studioById = (id) => studios().find((w) => w.id === id);
10626
10636
  onBoard = () => new Set(specAgentCatalog().agents.map((a) => a.name));
10627
10637
  previewMembers = (flow) => {
10628
10638
  const known2 = onBoard();
@@ -10631,23 +10641,23 @@ var init_workflows = __esm({
10631
10641
  previewAgents = (flow) => previewMembers(flow).filter((h) => !h.off);
10632
10642
  landAgents = (flow) => flow.land.filter((h) => !h.off);
10633
10643
  archivesOnApproval = (flow) => !!flow && !landAgents(flow).length;
10634
- workflowRuleFile = (id) => path37.join(RULES, "workflows", `${id}.md`);
10644
+ studioRuleFile = (id) => path37.join(RULES, "studios", `${id}.md`);
10635
10645
  save2 = (change2) => writeConfig((cfg) => {
10636
- const block = configBlock(cfg.workflows);
10646
+ const block = configBlock(cfg.studios);
10637
10647
  change2(block);
10638
- if (Object.keys(block).length === 0) delete cfg.workflows;
10639
- else cfg.workflows = block;
10648
+ if (Object.keys(block).length === 0) delete cfg.studios;
10649
+ else cfg.studios = block;
10640
10650
  });
10641
- draftDef = (id) => boardWorkflowDefs().defs.find((d) => d.id === id);
10642
- notFound = (id) => ({ ok: false, ...refusal("workflowNotFound", `this board has no \`${id}\` workflow`, { id }) });
10643
- readOnly = () => ({ ok: false, ...refusal("workflowReadOnly", "Only a Workflow builder draft is renamed here; change a workflow with `akb workflow pull` and `push`.") });
10651
+ draftDef = (id) => boardStudioDefs().defs.find((d) => d.id === id);
10652
+ notFound = (id) => ({ ok: false, ...refusal("studioNotFound", `this board has no \`${id}\` studio`, { id }) });
10653
+ readOnly = () => ({ ok: false, ...refusal("studioReadOnly", "Only a Studio builder draft is renamed here; change a studio with `akb studio pull` and `push`.") });
10644
10654
  trimmedName = (name) => name.replace(/\s+/g, " ").trim();
10645
- nameTaken = (name, except = "") => workflows().some((w) => w.id !== except && trimmedName(w.name).toLowerCase() === trimmedName(name).toLowerCase());
10655
+ nameTaken = (name, except = "") => studios().some((w) => w.id !== except && trimmedName(w.name).toLowerCase() === trimmedName(name).toLowerCase());
10646
10656
  scheduledAgent = (id, agent) => {
10647
- const flow = workflowById(id);
10657
+ const flow = studioById(id);
10648
10658
  return flow ? scheduledMembers(flow).find((h) => h.agent === canonicalSpecAgent(agent.trim())) : void 0;
10649
10659
  };
10650
- cardWorkflowId = (id) => cardMeta(id)?.workflow ?? "";
10660
+ cardStudioId = (id) => cardMeta(id)?.studio ?? "";
10651
10661
  cardStages = (meta, flow) => previewStages(flow, meta?.previews ?? []);
10652
10662
  cardStage = (meta, flow) => Math.min(Math.max(meta?.phase || 1, 1), cardStages(meta, flow).length);
10653
10663
  }
@@ -10662,17 +10672,17 @@ function loadGoals() {
10662
10672
  if (held4.goals !== void 0 && held4.ideas !== void 0 && JSON.stringify(held4.goals) !== JSON.stringify(held4.ideas)) die("goals and ideas do not match.");
10663
10673
  const goals = held4.goals ?? held4.ideas;
10664
10674
  if (!Array.isArray(goals)) die("The goals array is missing or invalid.");
10665
- return { file, held: { ...held4, workflows: held4.workflows ?? [], goals } };
10675
+ return { file, held: { ...held4, studios: held4.studios ?? [], goals } };
10666
10676
  }
10667
- function workflowOf(held4, asked) {
10677
+ function studioOf(held4, asked) {
10668
10678
  const wanted = asked.trim();
10669
- const found2 = held4.workflows.find((w) => w.id === wanted || shortWorkflowId(w.id) === wanted);
10670
- if (!found2) die(`No workflow \`${wanted}\` here. It has: ${held4.workflows.map((w) => shortWorkflowId(w.id)).join(", ")}.`);
10679
+ const found2 = held4.studios.find((w) => w.id === wanted || shortStudioId(w.id) === wanted);
10680
+ if (!found2) die(`No studio \`${wanted}\` here. It has: ${held4.studios.map((w) => shortStudioId(w.id)).join(", ")}.`);
10671
10681
  return found2.id;
10672
10682
  }
10673
- function fallbackWorkflow(held4) {
10674
- const first = held4.workflows[0]?.id;
10675
- if (!first) die(noWorkflowMessage(""));
10683
+ function fallbackStudio(held4) {
10684
+ const first = held4.studios[0]?.id;
10685
+ if (!first) die(noStudioMessage(""));
10676
10686
  return first;
10677
10687
  }
10678
10688
  function splitBody2(text4) {
@@ -10707,28 +10717,28 @@ function cmdGoal(args, opts) {
10707
10717
  if (!title) die("--title must not be empty");
10708
10718
  if (held4.goals.filter(open).length >= MAX_GOALS) die(`A conversation holds at most ${MAX_GOALS} goals; drop one first.`);
10709
10719
  const body = readBody(opts.bodyFile);
10710
- const workflow = opts.workflow ? workflowOf(held4, opts.workflow) : fallbackWorkflow(held4);
10720
+ const studio = opts.studio ? studioOf(held4, opts.studio) : fallbackStudio(held4);
10711
10721
  const id = `new_${held4.goals.filter((i) => i.id.startsWith("new_")).length + 1}`;
10712
- const previews = goalPreviews(held4, workflow, opts.previews);
10713
- held4.goals.push({ id, title, ...body, workflow, previews, task: null });
10722
+ const previews = goalPreviews(held4, studio, opts.previews);
10723
+ held4.goals.push({ id, title, ...body, studio, previews, task: null });
10714
10724
  write2();
10715
- say(`Saved goal ${id}: ${title} (${shortWorkflowId(workflow)}).`);
10716
- return { id, title, workflow, previews };
10725
+ say(`Saved goal ${id}: ${title} (${shortStudioId(studio)}).`);
10726
+ return { id, title, studio, previews };
10717
10727
  }
10718
10728
  const goal = named(held4, opts.id);
10719
10729
  if (goal.task) die(`${goal.id} is already a task; it no longer changes here.`);
10720
10730
  if (sub === "save") {
10721
- const workflow = opts.workflow !== void 0 ? workflowOf(held4, opts.workflow) : goal.workflow;
10722
- const previews = opts.previews !== void 0 ? goalPreviews(held4, workflow, opts.previews) : workflow === goal.workflow ? goal.previews ?? [] : [];
10731
+ const studio = opts.studio !== void 0 ? studioOf(held4, opts.studio) : goal.studio;
10732
+ const previews = opts.previews !== void 0 ? goalPreviews(held4, studio, opts.previews) : studio === goal.studio ? goal.previews ?? [] : [];
10723
10733
  if (opts.title !== void 0) {
10724
10734
  if (!opts.title.trim()) die("--title must not be empty");
10725
10735
  goal.title = opts.title.trim();
10726
10736
  }
10727
10737
  if (opts.bodyFile !== void 0) Object.assign(goal, readBody(opts.bodyFile));
10728
- Object.assign(goal, { workflow, previews });
10738
+ Object.assign(goal, { studio, previews });
10729
10739
  write2();
10730
- say(`Saved goal ${goal.id}: ${goal.title} (${shortWorkflowId(goal.workflow)}).`);
10731
- return { id: goal.id, title: goal.title, workflow: goal.workflow, previews: goal.previews };
10740
+ say(`Saved goal ${goal.id}: ${goal.title} (${shortStudioId(goal.studio)}).`);
10741
+ return { id: goal.id, title: goal.title, studio: goal.studio, previews: goal.previews };
10732
10742
  }
10733
10743
  if (sub === "drop") {
10734
10744
  goal.dropped = true;
@@ -10744,45 +10754,45 @@ function cmdGoal(args, opts) {
10744
10754
  }
10745
10755
  die("Use goal new, save, drop or start.");
10746
10756
  }
10747
- function cmdGoalWorkflows() {
10757
+ function cmdGoalStudios() {
10748
10758
  const { held: held4 } = loadGoals();
10749
- for (const w of held4.workflows) {
10750
- say(`${shortWorkflowId(w.id)} ${w.name}`);
10759
+ for (const w of held4.studios) {
10760
+ say(`${shortStudioId(w.id)} ${w.name}`);
10751
10761
  if (w.description && w.description !== w.name) say(` ${w.description}`);
10752
10762
  if (w.when) say(` when ${w.when}`);
10753
10763
  }
10754
- return { workflows: held4.workflows.map((w) => ({ ...w, id: shortWorkflowId(w.id) })) };
10764
+ return { studios: held4.studios.map((w) => ({ ...w, id: shortStudioId(w.id) })) };
10755
10765
  }
10756
- function goalPreviews(held4, workflow, asked = "") {
10766
+ function goalPreviews(held4, studio, asked = "") {
10757
10767
  if (!asked.trim()) return [];
10758
- const catalog = held4.workflows.find((w) => w.id === workflow)?.previews;
10768
+ const catalog = held4.studios.find((w) => w.id === studio)?.previews;
10759
10769
  if (!catalog) die("Preview agents are unavailable; update Runner and try again.");
10760
10770
  const names3 = asked.split(",").map((p) => canonicalSpecAgent({ ui: "ui-designer", api: "api-designer" }[p.trim()] ?? p.trim()));
10761
10771
  if (names3.length > 50) die("previews must contain at most 50 agent names.");
10762
- for (const name of names3) if (!catalog.some((p) => p.agent === name)) die(`Preview agent ${name} is not enabled in workflow ${workflow}.`);
10772
+ for (const name of names3) if (!catalog.some((p) => p.agent === name)) die(`Preview agent ${name} is not enabled in studio ${studio}.`);
10763
10773
  return catalog.filter((p) => names3.includes(p.agent)).map((p) => p.agent);
10764
10774
  }
10765
- function cmdGoalPreviews(workflow) {
10775
+ function cmdGoalPreviews(studio) {
10766
10776
  const { held: held4 } = loadGoals();
10767
- const id = workflowOf(held4, workflow);
10768
- const catalog = held4.workflows.find((w) => w.id === id)?.previews;
10777
+ const id = studioOf(held4, studio);
10778
+ const catalog = held4.studios.find((w) => w.id === id)?.previews;
10769
10779
  if (!catalog) die("Preview agents are unavailable; update Runner and try again.");
10770
10780
  const agents = catalog.map((p) => ({ name: p.agent, when: p.when || null }));
10771
10781
  say(agents.length ? agents.map((p) => `${p.name}
10772
- ${p.when ?? "Always"}`).join("\n") : "This workflow has no preview agent. Ask for none.");
10782
+ ${p.when ?? "Always"}`).join("\n") : "This studio has no preview agent. Ask for none.");
10773
10783
  return { agents, problems: [] };
10774
10784
  }
10775
- var MAX_GOALS, goalsFile, shortWorkflowId, open;
10785
+ var MAX_GOALS, goalsFile, shortStudioId, open;
10776
10786
  var init_goal = __esm({
10777
10787
  "src/commands/goal.ts"() {
10778
10788
  "use strict";
10779
10789
  init_spec_agent_names();
10780
10790
  init_io();
10781
10791
  init_paths();
10782
- init_workflows();
10792
+ init_studios();
10783
10793
  MAX_GOALS = 10;
10784
10794
  goalsFile = () => process.env.KANBAN_GOALS || process.env.KANBAN_IDEAS || null;
10785
- shortWorkflowId = (id) => id.startsWith("wf_builtin_") ? id.slice("wf_builtin_".length).replace(/_/g, "-") : id;
10795
+ shortStudioId = (id) => id.startsWith("wf_builtin_") ? id.slice("wf_builtin_".length).replace(/_/g, "-") : id;
10786
10796
  open = (goal) => !goal.dropped && !goal.task;
10787
10797
  }
10788
10798
  });
@@ -10800,11 +10810,11 @@ function hostSession() {
10800
10810
  if (cursor) return { id: cursor, host: "cursor" };
10801
10811
  return kimi ? { id: kimi, host: "kimi" } : null;
10802
10812
  }
10803
- async function workflows2(workspace2) {
10813
+ async function studios2(workspace2) {
10804
10814
  const all2 = [];
10805
10815
  let after2 = null;
10806
10816
  do {
10807
- const page = await request("GET", `/v1/workflows?workspace=${encodeURIComponent(workspace2)}&limit=100${after2 ? `&after=${encodeURIComponent(after2)}` : ""}`);
10817
+ const page = await request("GET", `/v1/studios?workspace=${encodeURIComponent(workspace2)}&limit=100${after2 ? `&after=${encodeURIComponent(after2)}` : ""}`);
10808
10818
  all2.push(...page.data);
10809
10819
  after2 = page.next;
10810
10820
  } while (after2);
@@ -10850,7 +10860,7 @@ async function withGoalDiscussion(action, save3 = false) {
10850
10860
  const before = process.env.KANBAN_GOALS;
10851
10861
  try {
10852
10862
  const previous = goalsOf(d);
10853
- fs35.writeFileSync(file, JSON.stringify({ workspace: d.workspace, workflows: await workflows2(d.workspace), ideas: previous.map((g) => ({ ...g, task: typeof g.task === "object" && g.task ? g.task.id : g.task })) }));
10863
+ fs35.writeFileSync(file, JSON.stringify({ workspace: d.workspace, studios: await studios2(d.workspace), ideas: previous.map((g) => ({ ...g, task: typeof g.task === "object" && g.task ? g.task.id : g.task })) }));
10854
10864
  process.env.KANBAN_GOALS = file;
10855
10865
  const result = save3 ? await quietlyAsync(async () => action()) : await action();
10856
10866
  if (save3) {
@@ -10876,21 +10886,21 @@ async function withGoalDiscussion(action, save3 = false) {
10876
10886
  fs35.rmSync(dir, { recursive: true, force: true });
10877
10887
  }
10878
10888
  }
10879
- async function queryPreviews(workflow, workspace2) {
10889
+ async function queryPreviews(studio, workspace2) {
10880
10890
  if (!workspace2) {
10881
- if (externalGoalSession()) return withGoalDiscussion(() => cmdGoalPreviews(workflow));
10891
+ if (externalGoalSession()) return withGoalDiscussion(() => cmdGoalPreviews(studio));
10882
10892
  die("--workspace is required outside a goal discussion.");
10883
10893
  }
10884
- const list = await workflows2(workspace2);
10885
- const flow = list.find((w) => w.id === workflow || shortWorkflowId(w.id) === workflow);
10886
- if (!flow) die(`No workflow \`${workflow}\` here.`);
10894
+ const list = await studios2(workspace2);
10895
+ const flow = list.find((w) => w.id === studio || shortStudioId(w.id) === studio);
10896
+ if (!flow) die(`No studio \`${studio}\` here.`);
10887
10897
  if (!flow.previews) die("Preview agents are unavailable; update Runner and try again.");
10888
10898
  const agents = flow.previews.map((p) => ({ name: p.agent, when: p.when || null }));
10889
10899
  say(agents.length ? agents.map((p) => `${p.name}
10890
- ${p.when ?? "Always"}`).join("\n") : "This workflow has no preview agent. Ask for none.");
10900
+ ${p.when ?? "Always"}`).join("\n") : "This studio has no preview agent. Ask for none.");
10891
10901
  return { agents, problems: [] };
10892
10902
  }
10893
- var externalGoalSession, request, cloudGoal, cloudGoalWorkflows;
10903
+ var externalGoalSession, request, cloudGoal, cloudGoalStudios;
10894
10904
  var init_goal_cloud = __esm({
10895
10905
  "src/commands/goal-cloud.ts"() {
10896
10906
  "use strict";
@@ -10901,7 +10911,7 @@ var init_goal_cloud = __esm({
10901
10911
  externalGoalSession = () => !goalsFile() && !process.env.KANBAN_RUN && !process.env.WILDCRANE_JOB && !process.env.AI4KANBAN_BOARD && Boolean(hostSession());
10902
10912
  request = (method, route2, body) => cloud(method, route2, body);
10903
10913
  cloudGoal = (args, opts) => withGoalDiscussion(() => cmdGoal(args, opts), true);
10904
- cloudGoalWorkflows = () => withGoalDiscussion(cmdGoalWorkflows);
10914
+ cloudGoalStudios = () => withGoalDiscussion(cmdGoalStudios);
10905
10915
  }
10906
10916
  });
10907
10917
 
@@ -14241,10 +14251,34 @@ var init_pointer = __esm({
14241
14251
  }
14242
14252
  });
14243
14253
 
14244
- // src/lib/card-workflow-backfill.ts
14254
+ // src/lib/card-studio-backfill.ts
14245
14255
  import fs37 from "node:fs";
14246
14256
  import path40 from "node:path";
14247
- function backfillCardWorkflows() {
14257
+ function renameToStudio() {
14258
+ if (!KANBAN || !BOARD_STATE) return;
14259
+ const mark = path40.join(BOARD_STATE, RENAMED);
14260
+ try {
14261
+ if (fs37.existsSync(mark)) return;
14262
+ for (const [from, to] of [[path40.join(KANBAN, "workflows"), STUDIOS], [path40.join(RULES, "workflows"), path40.join(RULES, "studios")]]) {
14263
+ if (fs37.existsSync(from) && !fs37.existsSync(to)) fs37.renameSync(from, to);
14264
+ }
14265
+ for (const file of [STUDIOS, TODO, TRIAGE].flatMap((dir) => fs37.existsSync(dir) ? walkMd(dir) : [])) {
14266
+ const at = path40.relative(KANBAN, file).split(path40.sep).join("/");
14267
+ const text4 = fs37.readFileSync(file, "utf8");
14268
+ const to = studioRenamed(at, text4);
14269
+ if (to.path === at && to.content === text4) continue;
14270
+ const target = path40.join(KANBAN, to.path);
14271
+ if (target !== file && fs37.existsSync(target)) continue;
14272
+ fs37.writeFileSync(target, to.content);
14273
+ if (target !== file) fs37.rmSync(file);
14274
+ }
14275
+ fs37.mkdirSync(BOARD_STATE, { recursive: true });
14276
+ fs37.writeFileSync(mark, "");
14277
+ } catch {
14278
+ }
14279
+ }
14280
+ function backfillCardStudios() {
14281
+ renameToStudio();
14248
14282
  if (!TODO || !BOARD_STATE) return;
14249
14283
  const mark = path40.join(BOARD_STATE, MARK);
14250
14284
  try {
@@ -14255,24 +14289,26 @@ function backfillCardWorkflows() {
14255
14289
  const end2 = text4.indexOf("\n---", 3);
14256
14290
  if (end2 < 0) continue;
14257
14291
  const head2 = text4.slice(0, end2);
14258
- if (!/\ntitle:/.test(head2) || /\nworkflow:/.test(head2)) continue;
14292
+ if (!/\ntitle:/.test(head2) || /\nstudio:/.test(head2)) continue;
14259
14293
  const modules = /\nmodules:[^\n]*/.exec(head2);
14260
14294
  const at = modules ? modules.index + modules[0].length : end2;
14261
14295
  fs37.writeFileSync(file, `${text4.slice(0, at)}
14262
- workflow: coding${text4.slice(at)}`);
14296
+ studio: coding${text4.slice(at)}`);
14263
14297
  }
14264
14298
  fs37.mkdirSync(BOARD_STATE, { recursive: true });
14265
14299
  fs37.writeFileSync(mark, "");
14266
14300
  } catch {
14267
14301
  }
14268
14302
  }
14269
- var MARK;
14270
- var init_card_workflow_backfill = __esm({
14271
- "src/lib/card-workflow-backfill.ts"() {
14303
+ var MARK, RENAMED;
14304
+ var init_card_studio_backfill = __esm({
14305
+ "src/lib/card-studio-backfill.ts"() {
14272
14306
  "use strict";
14273
14307
  init_cards();
14274
14308
  init_paths();
14275
- MARK = "card-workflows-backfilled";
14309
+ init_board_files();
14310
+ MARK = "card-studios-backfilled";
14311
+ RENAMED = "studio-names";
14276
14312
  }
14277
14313
  });
14278
14314
 
@@ -15016,7 +15052,7 @@ var init_usage = __esm({
15016
15052
  // src/lib/agents/roster.ts
15017
15053
  function customAgentsOn() {
15018
15054
  const running = /* @__PURE__ */ new Set();
15019
- for (const flow of workflows()) {
15055
+ for (const flow of studios()) {
15020
15056
  for (const h of [...previewAgents(flow), ...landAgents(flow)]) running.add(h.agent);
15021
15057
  for (const scheduled of scheduledMembers(flow)) if (!scheduled.off) running.add(scheduled.agent);
15022
15058
  }
@@ -15027,7 +15063,7 @@ var init_roster = __esm({
15027
15063
  "src/lib/agents/roster.ts"() {
15028
15064
  "use strict";
15029
15065
  init_file_memo();
15030
- init_workflows();
15066
+ init_studios();
15031
15067
  init_runtimes();
15032
15068
  init_settings();
15033
15069
  init_memory();
@@ -15243,7 +15279,7 @@ var init_answers = __esm({
15243
15279
  function deliveryStep(delivery) {
15244
15280
  const count3 = delivery.completions?.length ?? 0;
15245
15281
  const last = delivery.completions?.[count3 - 1];
15246
- const end2 = delivery.workflow?.land?.length ?? 1;
15282
+ const end2 = delivery.studio?.land?.length ?? 1;
15247
15283
  return last && !last.finished && last.step + 1 >= end2 ? last.step : count3;
15248
15284
  }
15249
15285
  function nextDeliveryRun(deliveryId) {
@@ -15302,28 +15338,28 @@ function agentForRun(ask2 = {}) {
15302
15338
  if (!action) return void 0;
15303
15339
  if (action === "implement") {
15304
15340
  const delivery = deliveryFor({ action, id: ask2.id, deliveryId: ask2.deliveryId });
15305
- const flow = delivery?.workflow ? void 0 : workflowFor(workflowForRun(ask2));
15306
- const rows = delivery?.workflow?.land ?? (flow ? landAgents(flow) : []);
15341
+ const flow = delivery?.studio ? void 0 : studioFor(studioForRun(ask2));
15342
+ const rows = delivery?.studio?.land ?? (flow ? landAgents(flow) : []);
15307
15343
  return rows[delivery ? deliveryStep(delivery) : 0]?.agent;
15308
15344
  }
15309
15345
  if (SPECIALIST_ACTIONS.has(action) || action === "sub") return specAgent;
15310
- return roleForFlow(flowOf2(ask2, action), workflowForRun(ask2))?.name;
15346
+ return roleForFlow(flowOf2(ask2, action), studioForRun(ask2))?.name;
15311
15347
  }
15312
15348
  function flowOf2(ask2, action) {
15313
15349
  if (ask2.refineRound !== void 0 && REFINE_ACTIONS.has(action)) return "refine";
15314
15350
  return flowByAction(action)?.command ?? action;
15315
15351
  }
15316
- var workflowForRun;
15352
+ var studioForRun;
15317
15353
  var init_runner = __esm({
15318
15354
  "src/lib/agent/runner.ts"() {
15319
15355
  "use strict";
15320
15356
  init_flows();
15321
15357
  init_roles();
15322
- init_workflows();
15358
+ init_studios();
15323
15359
  init_deliveries();
15324
15360
  init_progress();
15325
15361
  init_types();
15326
- workflowForRun = (ask2) => ask2.workflow ?? (typeof ask2.id === "number" ? cardWorkflowId(ask2.id) || void 0 : ask2.deliveryId ? deliveryFor({ action: "implement", deliveryId: ask2.deliveryId })?.workflow?.id : void 0);
15362
+ studioForRun = (ask2) => ask2.studio ?? (typeof ask2.id === "number" ? cardStudioId(ask2.id) || void 0 : ask2.deliveryId ? deliveryFor({ action: "implement", deliveryId: ask2.deliveryId })?.studio?.id : void 0);
15327
15363
  }
15328
15364
  });
15329
15365
 
@@ -15342,17 +15378,17 @@ function readRule(agent) {
15342
15378
  migrateFlowRules();
15343
15379
  return ruleFile(agent);
15344
15380
  }
15345
- function deliveryRules(workflow) {
15381
+ function deliveryRules(studio) {
15346
15382
  migrateFlowRules();
15347
15383
  const rules = {};
15348
15384
  for (const flow2 of FLOWS) {
15349
15385
  if (flow2.action === "refine" || !DELIVERY_FLOWS.has(flow2.action)) continue;
15350
- const role = roleForFlow(flow2.command, workflow);
15386
+ const role = roleForFlow(flow2.command, studio);
15351
15387
  if (!role || rules[role.name] !== void 0) continue;
15352
15388
  const rule = ruleFile(role.name);
15353
15389
  if (rule) rules[role.name] = rule;
15354
15390
  }
15355
- const flow = workflowFor(workflow);
15391
+ const flow = studioFor(studio);
15356
15392
  for (const { agent } of flow ? landAgents(flow) : []) {
15357
15393
  const rule = ruleFile(agent);
15358
15394
  if (rule) rules[agent] = rule;
@@ -15369,7 +15405,7 @@ function ownerOf2(req) {
15369
15405
  return name ? { name } : null;
15370
15406
  }
15371
15407
  const flow = req.action === "reflect" ? req.action : flowForRequest(req)?.command;
15372
- const role = roleForFlow(flow ?? "", workflowForRun(req));
15408
+ const role = roleForFlow(flow ?? "", studioForRun(req));
15373
15409
  return role ? { name: role.name, role, flow } : null;
15374
15410
  }
15375
15411
  function ruleFor(req, frozen) {
@@ -15453,7 +15489,7 @@ var init_rules2 = __esm({
15453
15489
  init_flows();
15454
15490
  init_roles();
15455
15491
  init_runner();
15456
- init_workflows();
15492
+ init_studios();
15457
15493
  init_types();
15458
15494
  rulePath = (agent) => path48.join(RULES, `${agent}.md`);
15459
15495
  flowForRequest = (req) => req.refineRound !== void 0 && REFINE_ACTIONS.has(req.action) ? flowByCommand("refine") : flowByAction(req.action);
@@ -15552,10 +15588,10 @@ function landedDeliveries(filter = {}) {
15552
15588
  for (const audit of allAudits()) {
15553
15589
  const landing = audit.landing;
15554
15590
  if (typeof audit.cardId !== "number" || landing?.status !== "landed" || !landing.commit) continue;
15555
- const workflow = audit.workflow?.id || "coding";
15591
+ const studio = audit.studio?.id || "coding";
15556
15592
  if (filter.since !== void 0 && !(landing.at > filter.since)) continue;
15557
- if (filter.workflow !== void 0 && workflow !== filter.workflow) continue;
15558
- out.push({ cardId: audit.cardId, title: audit.title, workflow, at: landing.at, commit: landing.commit });
15593
+ if (filter.studio !== void 0 && studio !== filter.studio) continue;
15594
+ out.push({ cardId: audit.cardId, title: audit.title, studio, at: landing.at, commit: landing.commit });
15559
15595
  }
15560
15596
  return out.sort((a, b) => a.at - b.at);
15561
15597
  }
@@ -15637,7 +15673,7 @@ function resumeRefusal(delivery, store) {
15637
15673
  }
15638
15674
  if (delivery.cardId === null) return void 0;
15639
15675
  const card = String(delivery.cardId);
15640
- const pendingArchive = delivery.completions?.some((c) => !c.finished && c.step + 1 >= (delivery.workflow?.land?.length ?? 1));
15676
+ const pendingArchive = delivery.completions?.some((c) => !c.finished && c.step + 1 >= (delivery.studio?.land?.length ?? 1));
15641
15677
  if (cardOnBoard(delivery.cardId) === false && !(pendingArchive && locateArchived(delivery.cardId))) {
15642
15678
  return refusal(
15643
15679
  "deliveryCardGone",
@@ -15807,13 +15843,13 @@ function joinDelivery(store, run2, title, step, start, direct) {
15807
15843
  priorStatus: cardId2 === null ? void 0 : cardStatus(cardId2),
15808
15844
  planned: start?.planned,
15809
15845
  rules: {
15810
- ...deliveryRules(cardId2 === null ? direct?.scheduled?.workflow : cardWorkflowId(cardId2)),
15846
+ ...deliveryRules(cardId2 === null ? direct?.scheduled?.studio : cardStudioId(cardId2)),
15811
15847
  ...direct?.scheduled && readRule(direct.scheduled.agent) ? { [direct.scheduled.agent]: readRule(direct.scheduled.agent) } : {}
15812
15848
  },
15813
- // And the one read of the workflow it builds under (#715) — its name and all three
15849
+ // And the one read of the studio it builds under (#715) — its name and all three
15814
15850
  // stages' assignments, frozen the way the rules are. Reassigning a stage, renaming the
15815
- // workflow or deleting it changes the next delivery and never this one.
15816
- workflow: frozenWorkflow(cardId2 === null ? direct?.scheduled?.workflow ?? "" : cardWorkflowId(cardId2)),
15851
+ // studio or deleting it changes the next delivery and never this one.
15852
+ studio: frozenStudio(cardId2 === null ? direct?.scheduled?.studio ?? "" : cardStudioId(cardId2)),
15817
15853
  scheduled: direct?.scheduled,
15818
15854
  targetBranch: start?.targetBranch
15819
15855
  };
@@ -15900,7 +15936,7 @@ function heldByDelivery(cardId2, program2) {
15900
15936
  const doing = state.paused ? `is waiting on you on #${cardId2} \u2014 ${state.line} \u2014 so the board won't change the card. ${answer2} Or take the card back with ` : `is in flight on #${cardId2} \u2014 it is building the card as it was approved when it started, so the board won't change it. Take the card back with `;
15901
15937
  return `delivery ${delivery.deliveryId} ${doing}Discard on the card page, or \`${cmd} raw delivery cancel ${delivery.deliveryId}\` to end it here.`;
15902
15938
  }
15903
- var auditPath, activeAudits, auditRow, lastSessionRunning, localAudit, unknownDelivery, isResumable, APPROVED, isApproved, cardStatus, openQuestions, activeIn, listDeliveries, withWorkflow;
15939
+ var auditPath, activeAudits, auditRow, lastSessionRunning, localAudit, unknownDelivery, isResumable, APPROVED, isApproved, cardStatus, openQuestions, activeIn, listDeliveries, withStudio;
15904
15940
  var init_deliveries = __esm({
15905
15941
  "src/lib/agent/deliveries.ts"() {
15906
15942
  "use strict";
@@ -15915,7 +15951,7 @@ var init_deliveries = __esm({
15915
15951
  init_flows();
15916
15952
  init_pause();
15917
15953
  init_rules2();
15918
- init_workflows();
15954
+ init_studios();
15919
15955
  init_store();
15920
15956
  init_types();
15921
15957
  init_worktree();
@@ -15940,9 +15976,9 @@ var init_deliveries = __esm({
15940
15976
  openQuestions = (cardId2) => cardMeta2(cardId2)?.questions.length ?? 0;
15941
15977
  activeIn = (store, cardId2) => store.deliveries.find((d) => d.status === "active" && d.cardId === cardId2);
15942
15978
  listDeliveries = () => readStore().deliveries;
15943
- withWorkflow = (req) => req.workflow ? req : {
15979
+ withStudio = (req) => req.studio ? req : {
15944
15980
  ...req,
15945
- workflow: deliveryFor(req)?.workflow?.id ?? (typeof req.id === "number" ? cardWorkflowId(req.id) || void 0 : void 0)
15981
+ studio: deliveryFor(req)?.studio?.id ?? (typeof req.id === "number" ? cardStudioId(req.id) || void 0 : void 0)
15946
15982
  };
15947
15983
  }
15948
15984
  });
@@ -16010,7 +16046,7 @@ var init_Compare = __esm({
16010
16046
  var Set_default;
16011
16047
  var init_Set = __esm({
16012
16048
  "src/components/Set.md"() {
16013
- Set_default = '# Set\n\nGroup three or more previews of one purpose: a `<Set label="...">` line, one `<Asset ... />` per line, then `</Set>`, as one paragraph with no blank line inside. Inline and fenced examples remain text.\n\n- **One purpose**: one set per purpose, such as a screen\'s states or the files you changed; keep one or two previews as plain Assets.\n- **One item per label**: Assets sharing a `label` are one item; their `device` views, and a file beside its `.diff` or `.patch`, become switches on it.\n- **Items**: anything an Asset shows, but not a compare or storyboard.\n';
16049
+ Set_default = '# Set\n\nGroup three or more previews of one purpose: a `<Set label="...">` line, one `<Asset ... />` per line, then `</Set>`; blank lines between them are fine. Inline and fenced examples remain text.\n\n- **One purpose**: one set per purpose, such as a screen\'s states or the files you changed; keep one or two previews as plain Assets.\n- **One item per label**: Assets sharing a `label` are one item; their `device` views, and a file beside its `.diff` or `.patch`, become switches on it.\n- **Items**: anything an Asset shows, but not a compare or storyboard.\n';
16014
16050
  }
16015
16051
  });
16016
16052
 
@@ -16022,11 +16058,11 @@ var init_Storyboard = __esm({
16022
16058
  }
16023
16059
  });
16024
16060
 
16025
- // src/components/Workflow.md
16026
- var Workflow_default;
16027
- var init_Workflow = __esm({
16028
- "src/components/Workflow.md"() {
16029
- Workflow_default = '# Workflow\n\nShow how a workflow runs with `<Workflow src=".assets/<card id>/workflow.json" label="..." />` alone in a paragraph. Inline and fenced examples remain text.\n\n- **Data**: `akb raw workflow diagram <workflow id> <card id>` writes the file from the workflow and prints the tag; never write or edit the JSON by hand. Rerun it after changing the workflow.\n';
16061
+ // src/components/Studio.md
16062
+ var Studio_default;
16063
+ var init_Studio = __esm({
16064
+ "src/components/Studio.md"() {
16065
+ Studio_default = '# Studio\n\nShow how a studio runs with `<Studio src=".assets/<card id>/studio.json" label="..." />` alone in a paragraph. Inline and fenced examples remain text.\n\n- **Data**: `akb raw studio diagram <studio id> <card id>` writes the file from the studio and prints the tag; never write or edit the JSON by hand. Rerun it after changing the studio.\n';
16030
16066
  }
16031
16067
  });
16032
16068
 
@@ -16058,9 +16094,9 @@ function agentComponents(names3, documents = DOCUMENTS) {
16058
16094
  }
16059
16095
  return [...docs.values()];
16060
16096
  }
16061
- function workflowComponents(id) {
16062
- const flow = workflowById(id);
16063
- if (!flow) throw new BoardError(`no workflow called "${id}"`, { kind: "unknown-workflow", workflow: id });
16097
+ function studioComponents(id) {
16098
+ const flow = studioById(id);
16099
+ if (!flow) throw new BoardError(`no studio called "${id}"`, { kind: "unknown-studio", studio: id });
16064
16100
  const members = [...previewMembers(flow), ...flow.land, ...scheduledMembers(flow)].map((row) => row.agent);
16065
16101
  return agentComponents(members);
16066
16102
  }
@@ -16072,13 +16108,13 @@ var init_components = __esm({
16072
16108
  init_Compare();
16073
16109
  init_Set();
16074
16110
  init_Storyboard();
16075
- init_Workflow();
16111
+ init_Studio();
16076
16112
  init_shared();
16077
16113
  init_agents();
16078
16114
  init_io();
16079
16115
  init_paths();
16080
- init_workflows();
16081
- DOCUMENTS = { Asset: Asset_default, Compare: Compare_default, Storyboard: Storyboard_default, Set: Set_default, Workflow: Workflow_default };
16116
+ init_studios();
16117
+ DOCUMENTS = { Asset: Asset_default, Compare: Compare_default, Storyboard: Storyboard_default, Set: Set_default, Studio: Studio_default };
16082
16118
  componentDocsText = (docs) => docs.length ? [shared_default, ...docs.map((doc) => doc.text)].map((text4) => text4.trim()).join("\n\n") : "";
16083
16119
  }
16084
16120
  });
@@ -16264,15 +16300,15 @@ function restartPrompt(req, deliveryId) {
16264
16300
  return [RESTART_LEAD, buildPrompt(req)].join("\n\n");
16265
16301
  }
16266
16302
  function buildAsk(rawReq, notes = []) {
16267
- const req = withWorkflow(rawReq);
16303
+ const req = withStudio(rawReq);
16268
16304
  const command = DELIVERY_FLOWS.has(req.action) ? boardCommandFor(req.id) : boardCommand();
16269
16305
  const ask2 = [actionPrompt(req, command, notes), pictureNote(req), commandNote(command)].filter(Boolean).join(" ");
16270
16306
  return realPaths(boardText([ask2, roster(req), componentsBlock(req)].filter(Boolean).join("\n\n")), req);
16271
16307
  }
16272
16308
  function componentsBlock(req) {
16273
16309
  const agent = findSpecAgent(agentForRun(req) ?? "");
16274
- const flow = workflowFor(workflowForRun(req));
16275
- const docs = PLANNING_FOR.has(req.action) && flow ? workflowComponents(flow.id) : agent ? agentComponents([agent.name]) : [];
16310
+ const flow = studioFor(studioForRun(req));
16311
+ const docs = PLANNING_FOR.has(req.action) && flow ? studioComponents(flow.id) : agent ? agentComponents([agent.name]) : [];
16276
16312
  const text4 = componentDocsText(docs);
16277
16313
  return text4 ? `\u2014\u2014\u2014 preview components \u2014\u2014\u2014
16278
16314
 
@@ -16289,37 +16325,37 @@ function realPaths(text4, req) {
16289
16325
  function helperExtra(req) {
16290
16326
  const agent = req.specAgent ?? "";
16291
16327
  if (!agent || req.action !== "spec") return "";
16292
- const frozen = deliveryFor(req)?.workflow;
16293
- const flow = frozen ? void 0 : workflowFor(workflowForRun(req));
16328
+ const frozen = deliveryFor(req)?.studio;
16329
+ const flow = frozen ? void 0 : studioFor(studioForRun(req));
16294
16330
  const rows = frozen ? frozen.previews ?? [] : flow ? previewMembers(flow) : [];
16295
16331
  const extra = rows.find((h) => h.agent === agent)?.extra?.trim();
16296
- return extra ? `\u2014\u2014\u2014 what this workflow asks of you here \u2014\u2014\u2014
16332
+ return extra ? `\u2014\u2014\u2014 what this studio asks of you here \u2014\u2014\u2014
16297
16333
 
16298
16334
  ${extra}` : "";
16299
16335
  }
16300
- function workflowRulesBlock(req) {
16336
+ function studioRulesBlock(req) {
16301
16337
  if (!PLANNING_FOR.has(req.action)) return "";
16302
- const flow = workflowFor(workflowForRun(req));
16338
+ const flow = studioFor(studioForRun(req));
16303
16339
  if (!flow) return "";
16304
16340
  const meta = req.id !== void 0 ? cardMeta(req.id) : null;
16305
16341
  const stages = cardStages(meta, flow).length;
16306
16342
  const stage = cardStage(meta, flow);
16307
16343
  const where = req.id !== void 0 && stages > 1 ? `#${req.id} awaits Approve ${stage} of ${stages}: write only the previews this Approve covers${stage < stages ? "; the next previews start once the user approves" : ""}.` : "";
16308
- const end2 = landAgents(flow).length ? "After the last approval, the workflow agents complete the approved outcome and archive the card." : "The last Approve archives the card: nothing is built, so leave no todo for a build.";
16309
- const own = userWorkflowRules(flow);
16344
+ const end2 = landAgents(flow).length ? "After the last approval, the studio agents complete the approved outcome and archive the card." : "The last Approve archives the card: nothing is built, so leave no todo for a build.";
16345
+ const own = userStudioRules(flow);
16310
16346
  const body = [where, end2, flow.rules.trim()].filter(Boolean).join("\n\n");
16311
16347
  return [
16312
- `<workflow name="${flow.name}">`,
16313
- "How a card on this workflow is written.",
16348
+ `<studio name="${flow.name}">`,
16349
+ "How a card on this studio is written.",
16314
16350
  body,
16315
- "</workflow>",
16316
- ...own ? ["", "<rules>", "The user's own rules for cards on this workflow; they win over the workflow above.", own, "</rules>"] : []
16351
+ "</studio>",
16352
+ ...own ? ["", "<rules>", "The user's own rules for cards on this studio; they win over the studio above.", own, "</rules>"] : []
16317
16353
  ].join("\n");
16318
16354
  }
16319
16355
  function landBlock(req) {
16320
16356
  if (req.action !== "implement") return "";
16321
- const frozen = deliveryFor(req)?.workflow;
16322
- const flow = frozen ? void 0 : workflowFor(workflowForRun(req));
16357
+ const frozen = deliveryFor(req)?.studio;
16358
+ const flow = frozen ? void 0 : studioFor(studioForRun(req));
16323
16359
  const rows = frozen ? frozen.land ?? [] : flow ? landAgents(flow) : [];
16324
16360
  const delivery = deliveryFor(req);
16325
16361
  const step = delivery ? deliveryStep(delivery) : 0;
@@ -16339,7 +16375,7 @@ ${agentFilesBlock(agent)}` : "",
16339
16375
  globalMemoryBlock(agent) ? `\u2014\u2014\u2014 global memories \u2014\u2014\u2014
16340
16376
 
16341
16377
  ${globalMemoryBlock(agent)}` : "",
16342
- extra ? `\u2014\u2014\u2014 what this workflow asks of you here \u2014\u2014\u2014
16378
+ extra ? `\u2014\u2014\u2014 what this studio asks of you here \u2014\u2014\u2014
16343
16379
 
16344
16380
  ${extra}` : ""
16345
16381
  ].filter(Boolean).join("\n\n")
@@ -16347,8 +16383,8 @@ ${extra}` : ""
16347
16383
  );
16348
16384
  }
16349
16385
  function buildPrompt(rawReq, notes = []) {
16350
- const req = withWorkflow(rawReq);
16351
- return [buildAsk(req, notes), workflowRulesBlock(req), landBlock(req), settingsBlock(req), ruleBlock(req, frozenRules(req))].filter(Boolean).join("\n\n");
16386
+ const req = withStudio(rawReq);
16387
+ return [buildAsk(req, notes), studioRulesBlock(req), landBlock(req), settingsBlock(req), ruleBlock(req, frozenRules(req))].filter(Boolean).join("\n\n");
16352
16388
  }
16353
16389
  function settingsBlock(req) {
16354
16390
  const owner = ruleOwner(req);
@@ -16389,14 +16425,14 @@ function reflectBlocks(ids) {
16389
16425
  }
16390
16426
  function scheduledBlock() {
16391
16427
  const given = process.env[SCHEDULED_AGENTS_ENV];
16392
- const on = new Set(given === void 0 ? workflows().flatMap((flow) => listedScheduled(flow)) : given.split(","));
16428
+ const on = new Set(given === void 0 ? studios().flatMap((flow) => listedScheduled(flow)) : given.split(","));
16393
16429
  const lines = specAgentCatalog().agents.filter((a) => on.has(a.name)).map((a) => `${a.name} \u2014 ${a.description}`);
16394
16430
  return lines.length ? ["<scheduled-agents>", ...lines, "</scheduled-agents>"] : [];
16395
16431
  }
16396
16432
  function roster(req) {
16397
16433
  if (req.id === void 0) return "";
16398
16434
  if (!SPEC_SELECTOR_FOR.has(req.action)) return "";
16399
- const flow = workflowFor(workflowForRun(req));
16435
+ const flow = studioFor(studioForRun(req));
16400
16436
  return specAgentSelector(req.id, flow?.id, cardMeta(req.id));
16401
16437
  }
16402
16438
  function buildRun(req) {
@@ -16537,9 +16573,9 @@ ${memory}` : "",
16537
16573
  shared ? `\u2014\u2014\u2014 global memories \u2014\u2014\u2014
16538
16574
 
16539
16575
  ${shared}` : "",
16540
- // What THIS workflow asks of it here (#715) — the assignment's own words, after the
16576
+ // What THIS studio asks of it here (#715) — the assignment's own words, after the
16541
16577
  // agent's instructions and its memory, because it is written on top of them and never
16542
- // in place of them. A card whose workflow does not call this agent in has none.
16578
+ // in place of them. A card whose studio does not call this agent in has none.
16543
16579
  helperExtra(req)
16544
16580
  ].filter(Boolean).join("\n\n");
16545
16581
  }
@@ -16551,11 +16587,11 @@ ${shared}` : "",
16551
16587
  if (own) notes.push(...own.notes);
16552
16588
  const memory = agent ? agentMemoryBlock(agent) : "";
16553
16589
  const shared = agent ? globalMemoryBlock(agent) : "";
16554
- const flow = workflowById(req.workflow ?? "");
16590
+ const flow = studioById(req.studio ?? "");
16555
16591
  const extra = flow ? scheduledAgent(flow.id, req.specAgent ?? "")?.extra.trim() : "";
16556
16592
  return [
16557
16593
  [
16558
- `You are the \`${req.specAgent}\` agent of the \`${flow?.name ?? req.workflow ?? ""}\` workflow.`,
16594
+ `You are the \`${req.specAgent}\` agent of the \`${flow?.name ?? req.studio ?? ""}\` studio.`,
16559
16595
  `The board is at \`${BOARD_FOLDER}\`, in the project at \`${PROJECT_FOLDER}\`.`,
16560
16596
  `Nobody is watching: never ask.`,
16561
16597
  req.deliveryId ? `When the outcome is complete, run \`${command} raw delivery complete ${req.deliveryId}\`.` : ""
@@ -16566,7 +16602,7 @@ ${own.instructions}` : "",
16566
16602
  own?.files ? `\u2014\u2014\u2014 your own files \u2014\u2014\u2014
16567
16603
 
16568
16604
  ${own.files}` : "",
16569
- extra ? `\u2014\u2014\u2014 what this workflow asks of you here \u2014\u2014\u2014
16605
+ extra ? `\u2014\u2014\u2014 what this studio asks of you here \u2014\u2014\u2014
16570
16606
 
16571
16607
  ${extra}` : "",
16572
16608
  memory ? `\u2014\u2014\u2014 what you remember \u2014\u2014\u2014
@@ -16650,7 +16686,7 @@ var init_prompts = __esm({
16650
16686
  init_flows();
16651
16687
  init_resolve();
16652
16688
  init_runner();
16653
- init_workflows();
16689
+ init_studios();
16654
16690
  init_catalog();
16655
16691
  init_roles();
16656
16692
  init_rules2();
@@ -16962,10 +16998,10 @@ function recordReflection(run2) {
16962
16998
  }
16963
16999
  }
16964
17000
  function recordScheduledRun(run2) {
16965
- if (run2.action !== "scheduled" || run2.status !== "done" || !run2.workflow || !run2.specAgent) return;
17001
+ if (run2.action !== "scheduled" || run2.status !== "done" || !run2.studio || !run2.specAgent) return;
16966
17002
  try {
16967
17003
  const began = (run2.deliveryId ? findDelivery(run2.deliveryId)?.startedAt : void 0) ?? run2.startedAt;
16968
- stampScheduledRun(run2.workflow, run2.specAgent, new Date(began));
17004
+ stampScheduledRun(run2.studio, run2.specAgent, new Date(began));
16969
17005
  } catch {
16970
17006
  }
16971
17007
  }
@@ -17005,7 +17041,7 @@ function retryAsk(r) {
17005
17041
  triage: r.triage,
17006
17042
  refineRound: r.refineRound,
17007
17043
  flowId: r.flowId,
17008
- workflow: r.workflow,
17044
+ studio: r.studio,
17009
17045
  cards: r.cards
17010
17046
  };
17011
17047
  switch (r.action) {
@@ -17180,16 +17216,16 @@ function approvedDirect(req) {
17180
17216
  return typed ? { title: typed, approved: typed } : void 0;
17181
17217
  }
17182
17218
  function scheduledDirect(req) {
17183
- const flow = workflowById(req.workflow ?? "");
17219
+ const flow = studioById(req.studio ?? "");
17184
17220
  const agent = req.specAgent ?? "";
17185
17221
  const one = flow ? scheduledAgent(flow.id, agent) : void 0;
17186
17222
  if (!flow || !one) {
17187
- return refusal("agentNotScheduled", `\`${agent}\` is not a scheduled agent of the \`${req.workflow ?? ""}\` workflow`, {
17223
+ return refusal("agentNotScheduled", `\`${agent}\` is not a scheduled agent of the \`${req.studio ?? ""}\` studio`, {
17188
17224
  agent,
17189
- workflow: req.workflow ?? ""
17225
+ studio: req.studio ?? ""
17190
17226
  });
17191
17227
  }
17192
- return { title: `${agent}: scheduled run (${flow.name})`, approved: "", scheduled: { workflow: flow.id, agent } };
17228
+ return { title: `${agent}: scheduled run (${flow.name})`, approved: "", scheduled: { studio: flow.id, agent } };
17193
17229
  }
17194
17230
  function openRun(req, prompt, notes = [], sessionId = randomUUID4(), said2) {
17195
17231
  const cardId2 = Number.isInteger(req.id) ? req.id : null;
@@ -17251,8 +17287,8 @@ function openRun(req, prompt, notes = [], sessionId = randomUUID4(), said2) {
17251
17287
  // Which agent this is, on the action that is one — so the run list can name it, and so
17252
17288
  // a resume starts the same agent rather than a different one.
17253
17289
  specAgent: SPECIALIST_ACTIONS.has(req.action) ? req.specAgent : void 0,
17254
- ...req.action === "implement" && cardId2 === null ? { workflow: req.workflow?.trim() || void 0 } : {},
17255
- ...req.action === "scheduled" ? { workflow: req.workflow?.trim() || void 0 } : {},
17290
+ ...req.action === "implement" && cardId2 === null ? { studio: req.studio?.trim() || void 0 } : {},
17291
+ ...req.action === "scheduled" ? { studio: req.studio?.trim() || void 0 } : {},
17256
17292
  cards: req.action === "reflect" ? req.cards : void 0,
17257
17293
  // Internal refinement sessions name their position in the request. A standalone
17258
17294
  // resolve carries no round.
@@ -17351,7 +17387,7 @@ function requestOf(record) {
17351
17387
  // the CLI actually spawned takes it.
17352
17388
  runtime: record.runtime,
17353
17389
  specAgent: record.specAgent,
17354
- ...record.action === "scheduled" ? { workflow: record.workflow } : {},
17390
+ ...record.action === "scheduled" ? { studio: record.studio } : {},
17355
17391
  triage: record.triage,
17356
17392
  cards: record.cards,
17357
17393
  refineRound: record.refineRound,
@@ -17450,7 +17486,7 @@ async function resumeHeld(prev, plan, sessionId, resuming, fresh) {
17450
17486
  // No `input` on a resume: the note the user typed is already in the conversation being
17451
17487
  // resumed — repeating it would read as a second instruction they never gave. A retry is
17452
17488
  // the ask itself again, so it keeps everything the ask was written down with.
17453
- ...retry2 ? { input: prev.input, workflow: prev.workflow } : {},
17489
+ ...retry2 ? { input: prev.input, studio: prev.studio } : {},
17454
17490
  harness: plan.harness,
17455
17491
  runtime: plan.runtime,
17456
17492
  agent: plan.agent,
@@ -17471,7 +17507,7 @@ async function resumeHeld(prev, plan, sessionId, resuming, fresh) {
17471
17507
  },
17472
17508
  logPath: logPathOf(sessionId),
17473
17509
  specAgent: prev.specAgent,
17474
- ...prev.action === "scheduled" ? { workflow: prev.workflow } : {},
17510
+ ...prev.action === "scheduled" ? { studio: prev.studio } : {},
17475
17511
  cards: prev.cards,
17476
17512
  refineRound: prev.refineRound,
17477
17513
  // The same refinement carried on, not a second one — the way a resume re-joins the
@@ -17816,7 +17852,7 @@ var init_sessions = __esm({
17816
17852
  init_stop();
17817
17853
  init_runtimes();
17818
17854
  init_settings();
17819
- init_workflows();
17855
+ init_studios();
17820
17856
  init_store();
17821
17857
  init_creation_lock();
17822
17858
  init_rules();
@@ -17941,7 +17977,7 @@ function serialize(signal2) {
17941
17977
  ...signal2.sourceType ? [`source_type: ${yamlScalar(signal2.sourceType)}`] : [],
17942
17978
  ...signal2.url ? [`url: ${yamlScalar(signal2.url)}`] : [],
17943
17979
  ...signal2.agent ? [`agent: ${yamlScalar(signal2.agent)}`] : [],
17944
- ...signal2.workflow ? [`workflow: ${yamlScalar(signal2.workflow)}`] : [],
17980
+ ...signal2.studio ? [`studio: ${yamlScalar(signal2.studio)}`] : [],
17945
17981
  `collected_at: ${yamlScalar(signal2.collectedAt)}`,
17946
17982
  `imported_at: ${yamlScalar(signal2.importedAt)}`,
17947
17983
  ...signal2.meta.length > 0 ? ["meta:", ...signal2.meta.map((pair) => ` ${yamlScalar(pair.key)}: ${yamlScalar(pair.value)}`)] : [],
@@ -17996,7 +18032,7 @@ function parse(file, lenient = false) {
17996
18032
  meta: missed ? [missed, ...written] : written,
17997
18033
  url: held4.url || "",
17998
18034
  ...held4.agent ? { agent: held4.agent } : {},
17999
- ...held4.workflow ? { workflow: held4.workflow } : {},
18035
+ ...held4.studio ? { studio: held4.studio } : {},
18000
18036
  collectedAt: held4.collected_at ?? "",
18001
18037
  importedAt: held4.imported_at ?? "",
18002
18038
  dismissedAt: held4.dismissed_at || "",
@@ -18169,30 +18205,30 @@ var init_source = __esm({
18169
18205
  }
18170
18206
  });
18171
18207
 
18172
- // src/lib/agent/workflow-cards.ts
18173
- function switchWorkflow(id, meta, asked) {
18208
+ // src/lib/agent/studio-cards.ts
18209
+ function switchStudio(id, meta, asked) {
18174
18210
  const wanted = asked.trim();
18175
- const next = knownWorkflow(wanted);
18176
- if (next === meta.workflow) return false;
18211
+ const next = knownStudio(wanted);
18212
+ if (next === meta.studio) return false;
18177
18213
  if (readRuns().some((r) => r.cardId === id && runIsLive(r))) {
18178
- die(`#${id} has a run in progress \u2014 stop it before switching its workflow.`, { kind: "card-held", id });
18214
+ die(`#${id} has a run in progress \u2014 stop it before switching its studio.`, { kind: "card-held", id });
18179
18215
  }
18180
18216
  const held4 = heldByDelivery(id);
18181
18217
  if (held4) die(held4, { kind: "card-held", id });
18182
- meta.workflow = next;
18218
+ meta.studio = next;
18183
18219
  meta.status = "todo";
18184
18220
  delete meta.previews;
18185
18221
  meta.stages = 0;
18186
18222
  meta.phase = 0;
18187
18223
  return true;
18188
18224
  }
18189
- var init_workflow_cards = __esm({
18190
- "src/lib/agent/workflow-cards.ts"() {
18225
+ var init_studio_cards = __esm({
18226
+ "src/lib/agent/studio-cards.ts"() {
18191
18227
  "use strict";
18192
18228
  init_paths();
18193
18229
  init_deliveries();
18194
18230
  init_store();
18195
- init_workflows();
18231
+ init_studios();
18196
18232
  }
18197
18233
  });
18198
18234
 
@@ -18380,7 +18416,7 @@ function assetName(src, cardId2, exts, nested = false) {
18380
18416
  if (exts.length && (!name.includes(".") || !exts.includes(ext))) return { expected, actual: `file type ${JSON.stringify(name.includes(".") ? ext : "")}` };
18381
18417
  return { name };
18382
18418
  }
18383
- var TAG2, attr, SRC_ATTR, LABEL_ATTR, SEGMENT2, storyboardTag, workflowTag;
18419
+ var TAG2, attr, SRC_ATTR, LABEL_ATTR, SEGMENT2, storyboardTag, studioTag;
18384
18420
  var init_storyboard = __esm({
18385
18421
  "src/lib/storyboard.ts"() {
18386
18422
  "use strict";
@@ -18390,8 +18426,8 @@ var init_storyboard = __esm({
18390
18426
  LABEL_ATTR = attr("label");
18391
18427
  SEGMENT2 = /^(?!\.)[^/\\]+$/;
18392
18428
  storyboardTag = (raw) => storyboardAttrs(raw)?.src ?? null;
18393
- workflowTag = (raw) => {
18394
- const m = /^<Workflow\b([^<>]*?)\/>$/.exec(raw.trim());
18429
+ studioTag = (raw) => {
18430
+ const m = /^<Studio\b([^<>]*?)\/>$/.exec(raw.trim());
18395
18431
  const src = m ? SRC_ATTR.exec(m[1]) : null;
18396
18432
  return src ? src[1] ?? src[2] : null;
18397
18433
  };
@@ -18402,7 +18438,7 @@ var init_storyboard = __esm({
18402
18438
  var compare_default;
18403
18439
  var init_compare2 = __esm({
18404
18440
  "../artifact-sdk/src/builtin/compare.json"() {
18405
- compare_default = '{\n "name": "compare",\n "title": { "en": "Compare", "zh": "\u5BF9\u6BD4" },\n "types": ["compare"],\n "schema": {\n "type": "object",\n "required": ["a", "b"],\n "properties": { "a": { "type": "string" }, "b": { "type": "string" } }\n },\n "references": [\n { "json": "/a", "types": ["storyboard", "compare", "spritesheet", "workflow"] },\n { "json": "/b", "types": ["storyboard", "compare", "spritesheet", "workflow"] },\n { "json": "/shots", "types": ["storyboard", "compare", "spritesheet", "workflow"] }\n ]\n}\n';
18441
+ compare_default = '{\n "name": "compare",\n "title": { "en": "Compare", "zh": "\u5BF9\u6BD4" },\n "types": ["compare"],\n "schema": {\n "type": "object",\n "required": ["a", "b"],\n "properties": { "a": { "type": "string" }, "b": { "type": "string" } }\n },\n "references": [\n { "json": "/a", "types": ["storyboard", "compare", "spritesheet", "studio"] },\n { "json": "/b", "types": ["storyboard", "compare", "spritesheet", "studio"] },\n { "json": "/shots", "types": ["storyboard", "compare", "spritesheet", "studio"] }\n ]\n}\n';
18406
18442
  }
18407
18443
  });
18408
18444
 
@@ -18464,7 +18500,7 @@ var init_spritesheet = __esm({
18464
18500
  var storyboard_default;
18465
18501
  var init_storyboard2 = __esm({
18466
18502
  "../artifact-sdk/src/builtin/storyboard.json"() {
18467
- storyboard_default = '{\n "name": "storyboard",\n "title": { "en": "Storyboard", "zh": "\u5206\u955C" },\n "types": ["storyboard"],\n "schema": {\n "type": "object",\n "anyOf": [{ "required": ["shots"] }, { "required": ["slides"] }],\n "properties": {\n "shots": {\n "type": "array",\n "items": {\n "type": "object",\n "properties": { "frames": { "type": "array", "items": { "type": "object", "properties": { "src": { "type": "string" } } } } }\n }\n },\n "slides": {\n "type": "array",\n "items": {\n "type": "object",\n "properties": {\n "preview": { "type": "object", "properties": { "src": { "type": "string" } } },\n "assets": { "type": "array", "items": { "type": "string" } }\n }\n }\n }\n }\n },\n "references": [\n { "json": "/shots/*/frames/*/src", "types": ["storyboard", "compare", "spritesheet", "workflow"] },\n { "json": "/slides/*/preview/src", "types": ["storyboard", "compare", "spritesheet", "workflow"] },\n { "json": "/slides/*/assets/*" }\n ]\n}\n';
18503
+ storyboard_default = '{\n "name": "storyboard",\n "title": { "en": "Storyboard", "zh": "\u5206\u955C" },\n "types": ["storyboard"],\n "schema": {\n "type": "object",\n "anyOf": [{ "required": ["shots"] }, { "required": ["slides"] }],\n "properties": {\n "shots": {\n "type": "array",\n "items": {\n "type": "object",\n "properties": { "frames": { "type": "array", "items": { "type": "object", "properties": { "src": { "type": "string" } } } } }\n }\n },\n "slides": {\n "type": "array",\n "items": {\n "type": "object",\n "properties": {\n "preview": { "type": "object", "properties": { "src": { "type": "string" } } },\n "assets": { "type": "array", "items": { "type": "string" } }\n }\n }\n }\n }\n },\n "references": [\n { "json": "/shots/*/frames/*/src", "types": ["storyboard", "compare", "spritesheet", "studio"] },\n { "json": "/slides/*/preview/src", "types": ["storyboard", "compare", "spritesheet", "studio"] },\n { "json": "/slides/*/assets/*" }\n ]\n}\n';
18468
18504
  }
18469
18505
  });
18470
18506
 
@@ -18495,11 +18531,11 @@ var init_video = __esm({
18495
18531
  }
18496
18532
  });
18497
18533
 
18498
- // ../artifact-sdk/src/builtin/workflow.json
18499
- var workflow_default;
18500
- var init_workflow = __esm({
18501
- "../artifact-sdk/src/builtin/workflow.json"() {
18502
- workflow_default = '{\n "name": "workflow",\n "title": { "en": "Workflow", "zh": "\u5DE5\u4F5C\u6D41" },\n "types": ["workflow"],\n "schema": {\n "type": "object",\n "required": ["rounds", "land", "scheduled"],\n "properties": {\n "rounds": {\n "type": "array",\n "items": {\n "type": "array",\n "minItems": 1,\n "items": { "type": "object", "required": ["agent", "title"], "properties": { "agent": { "type": "string" }, "title": { "type": "object", "required": ["en"] } } }\n }\n },\n "land": { "type": "array", "items": { "type": "object", "required": ["agent", "title"] } },\n "scheduled": { "type": "array", "items": { "type": "object", "required": ["agent", "title"] } }\n }\n }\n}\n';
18534
+ // ../artifact-sdk/src/builtin/studio.json
18535
+ var studio_default;
18536
+ var init_studio = __esm({
18537
+ "../artifact-sdk/src/builtin/studio.json"() {
18538
+ studio_default = '{\n "name": "studio",\n "title": { "en": "Studio", "zh": "\u5DE5\u4F5C\u53F0" },\n "types": ["studio"],\n "schema": {\n "type": "object",\n "required": ["rounds", "land", "scheduled"],\n "properties": {\n "rounds": {\n "type": "array",\n "items": {\n "type": "array",\n "minItems": 1,\n "items": { "type": "object", "required": ["agent", "title"], "properties": { "agent": { "type": "string" }, "title": { "type": "object", "required": ["en"] } } }\n }\n },\n "land": { "type": "array", "items": { "type": "object", "required": ["agent", "title"] } },\n "scheduled": { "type": "array", "items": { "type": "object", "required": ["agent", "title"] } }\n }\n }\n}\n';
18503
18539
  }
18504
18540
  });
18505
18541
 
@@ -18516,9 +18552,9 @@ var init_builtin = __esm({
18516
18552
  init_storyboard2();
18517
18553
  init_tiled();
18518
18554
  init_video();
18519
- init_workflow();
18555
+ init_studio();
18520
18556
  read = (m) => typeof m === "string" ? JSON.parse(m) : m;
18521
- builtin_default = [html_default, image_default, video_default, markdown_default, storyboard_default, compare_default, workflow_default, tiled_default, spritesheet_default].map(read);
18557
+ builtin_default = [html_default, image_default, video_default, markdown_default, storyboard_default, compare_default, studio_default, tiled_default, spritesheet_default].map(read);
18522
18558
  }
18523
18559
  });
18524
18560
 
@@ -18671,12 +18707,12 @@ function bodyReferences(body) {
18671
18707
  }
18672
18708
  const kept2 = inTag || !/^(?: {4}|\t)/.test(line);
18673
18709
  visible.push(kept2 ? line : "");
18674
- if (kept2 && /^ {0,3}<(?:Asset|Mockup|Compare|Storyboard|Workflow)\b/.test(line)) inTag = true;
18710
+ if (kept2 && /^ {0,3}<(?:Asset|Mockup|Compare|Storyboard|Studio)\b/.test(line)) inTag = true;
18675
18711
  if (line.includes("/>")) inTag = false;
18676
18712
  }
18677
18713
  const text4 = visible.join("\n").replace(/(`+)[^]*?\1/g, "");
18678
- const tag = /<(Asset|Mockup|Compare|Storyboard|Workflow)\b([^<>]*?)\/>/g;
18679
- const blocks = text4.matchAll(/^ {0,3}(?:<(?:Asset|Mockup|Compare|Storyboard|Workflow)\b[^<>]*?\/>[ \t]*(?:\n[ \t]*)?)+$/gm);
18714
+ const tag = /<(Asset|Mockup|Compare|Storyboard|Studio)\b([^<>]*?)\/>/g;
18715
+ const blocks = text4.matchAll(/^ {0,3}(?:<(?:Asset|Mockup|Compare|Storyboard|Studio)\b[^<>]*?\/>[ \t]*(?:\n[ \t]*)?)+$/gm);
18680
18716
  for (const block of blocks) {
18681
18717
  const tags = [...block[0].matchAll(tag)];
18682
18718
  for (const m of tags) {
@@ -18686,7 +18722,7 @@ function bodyReferences(body) {
18686
18722
  if (!a.a || !a.b) continue;
18687
18723
  for (const k of ["a", "b", "shots"]) if (a[k]) out.push({ src: a[k], types: ARRANGED });
18688
18724
  } else if (a.src) {
18689
- out.push({ src: a.src, types: m[1] === "Storyboard" ? STORYBOARD : m[1] === "Workflow" ? WORKFLOW : m[1] === "Asset" ? ASSET : [] });
18725
+ out.push({ src: a.src, types: m[1] === "Storyboard" ? STORYBOARD : m[1] === "Studio" ? STUDIO : m[1] === "Asset" ? ASSET : [] });
18690
18726
  if (a.variants) {
18691
18727
  try {
18692
18728
  const v = JSON.parse(a.variants);
@@ -18710,13 +18746,13 @@ function kindOf2(ext) {
18710
18746
  if (type.startsWith("image/")) return "image";
18711
18747
  return type.startsWith("video/") || type.startsWith("audio/") ? "video" : "asset";
18712
18748
  }
18713
- var STORYBOARD, WORKFLOW, ARRANGED, ASSET, isObject2, TYPES;
18749
+ var STORYBOARD, STUDIO, ARRANGED, ASSET, isObject2, TYPES;
18714
18750
  var init_references = __esm({
18715
18751
  "../artifact-sdk/src/internal/references.ts"() {
18716
18752
  "use strict";
18717
18753
  STORYBOARD = ["storyboard"];
18718
- WORKFLOW = ["workflow"];
18719
- ARRANGED = ["storyboard", "compare", "spritesheet", "workflow"];
18754
+ STUDIO = ["studio"];
18755
+ ARRANGED = ["storyboard", "compare", "spritesheet", "studio"];
18720
18756
  ASSET = ["spritesheet", "asset"];
18721
18757
  isObject2 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
18722
18758
  TYPES = {
@@ -19091,8 +19127,8 @@ function validateSpec(file, text4, id) {
19091
19127
  if (/^\s*<Storyboard\b/.test(line) && (storyboardTag(line) === null || lines[i - 1]?.trim() || lines[i + 1]?.trim())) {
19092
19128
  add(i + 1, "storyboard-block", 'Put one self-closing <Storyboard src=".assets/<card id>/storyboard.json" /> tag on its own line, with blank lines around it.');
19093
19129
  }
19094
- if (/^\s*<Workflow\b/.test(line) && (workflowTag(line) === null || !/\blabel="[^"]+"/.test(line) || lines[i - 1]?.trim() || lines[i + 1]?.trim())) {
19095
- add(i + 1, "workflow-block", 'Put one self-closing <Workflow src=".assets/<card id>/workflow.json" label="..." /> tag on its own line, with blank lines around it.');
19130
+ if (/^\s*<Studio\b/.test(line) && (studioTag(line) === null || !/\blabel="[^"]+"/.test(line) || lines[i - 1]?.trim() || lines[i + 1]?.trim())) {
19131
+ add(i + 1, "studio-block", 'Put one self-closing <Studio src=".assets/<card id>/studio.json" label="..." /> tag on its own line, with blank lines around it.');
19096
19132
  }
19097
19133
  if (/^\s*<Compare\b/.test(line)) {
19098
19134
  const attrs = compareAttrs(line);
@@ -19143,8 +19179,9 @@ function validateSpec(file, text4, id) {
19143
19179
  function setEnd(lines, at) {
19144
19180
  if (!/^\s*<Set\b[^<>]*>\s*$/.test(lines[at]) || lines[at - 1]?.trim()) return -1;
19145
19181
  let i = at + 1;
19146
- while (i < lines.length && ASSET_LINE.test(lines[i])) i++;
19147
- if (i === at + 1 || !/^\s*<\/Set>\s*$/.test(lines[i] ?? "") || lines[i + 1]?.trim()) return -1;
19182
+ let assets = 0;
19183
+ for (; i < lines.length && (ASSET_LINE.test(lines[i]) || !lines[i].trim()); i++) if (lines[i].trim()) assets++;
19184
+ if (!assets || !/^\s*<\/Set>\s*$/.test(lines[i] ?? "") || lines[i + 1]?.trim()) return -1;
19148
19185
  return i;
19149
19186
  }
19150
19187
  function inside(dir, name) {
@@ -19230,7 +19267,7 @@ function validateStoryboards(file, id, text4) {
19230
19267
  const dir = path60.join(ASSETS, String(id));
19231
19268
  for (const [tag, tagOf, rule, fix] of [
19232
19269
  ["Storyboard", storyboardTag, "storyboard-src", "Write the JSON there or fix the path."],
19233
- ["Workflow", workflowTag, "workflow-src", "Write it with `akb raw workflow diagram <workflow id> <card id>` or fix the path."]
19270
+ ["Studio", studioTag, "studio-src", "Write it with `akb raw studio diagram <studio id> <card id>` or fix the path."]
19234
19271
  ]) {
19235
19272
  for (const marker of storyboardMarkers(text4, tagOf)) {
19236
19273
  const named2 = assetName(marker.src, id, ["json"]);
@@ -19449,8 +19486,8 @@ function validateCreate(opts) {
19449
19486
  const related = parseIdList(opts.related ?? [], "related");
19450
19487
  const modules = validModules(opts.modules ?? []);
19451
19488
  const triage = (opts.triage ?? "").trim();
19452
- const workflow = workflowFlag(opts.workflow ?? (triage ? itemWorkflow(triage) : void 0));
19453
- const flow = workflowFor(workflow);
19489
+ const studio = studioFlag(opts.studio ?? (triage ? itemStudio(triage) : void 0));
19490
+ const flow = studioFor(studio);
19454
19491
  const previews = opts.previews === void 0 ? void 0 : previewsFlag(opts.previews, flow);
19455
19492
  const stages = previews ? cardStages({ previews }, flow).length : 0;
19456
19493
  const source = sourceFlag(opts.source ?? [], "source");
@@ -19458,10 +19495,10 @@ function validateCreate(opts) {
19458
19495
  const questions = collectQuestions(opts.asked ?? []);
19459
19496
  const draft = bodyFromFile(opts);
19460
19497
  const written = draft ? normalizeBody(draft) : null;
19461
- return { title, priority, blocked_by, related, modules, triage, workflow, previews, stages, source, questions, written };
19498
+ return { title, priority, blocked_by, related, modules, triage, studio, previews, stages, source, questions, written };
19462
19499
  }
19463
19500
  function cmdCreate(opts) {
19464
- const { title, priority, blocked_by, related, modules, triage, workflow, previews, stages, source, questions, written } = validateCreate(opts);
19501
+ const { title, priority, blocked_by, related, modules, triage, studio, previews, stages, source, questions, written } = validateCreate(opts);
19465
19502
  if (opts.id === void 0) die("\u8BF7\u901A\u8FC7 `akb raw create` \u521B\u5EFA\u5361\u7247\uFF0C\u7531 Cloud \u5206\u914D\u7F16\u53F7", { kind: "needs-cloud" });
19466
19503
  const start = opts.id;
19467
19504
  const slug2 = slugify(opts.slug !== void 0 ? opts.slug : title);
@@ -19476,7 +19513,7 @@ function cmdCreate(opts) {
19476
19513
  if (held4) die(`#${start} is already a card here (${rel(held4.target)})`, { kind: "id-taken", id: start });
19477
19514
  if (fs59.existsSync(file)) die(`${rel(file)} already exists \u2014 pick a different --slug`);
19478
19515
  countBoardEvent(triage ? "cards_created_proposed" : "cards_created_asked");
19479
- const meta = { title, priority, status: "todo", blocked_by, related, modules, workflow, previews, stages, triage, source, questions };
19516
+ const meta = { title, priority, status: "todo", blocked_by, related, modules, studio, previews, stages, triage, source, questions };
19480
19517
  const scaffolded = !written && opts.body !== false;
19481
19518
  const body = written ?? (scaffolded ? defaultBody() : "");
19482
19519
  fs59.writeFileSync(file, serializeFrontmatter(meta) + "\n\n" + body);
@@ -19500,26 +19537,26 @@ function sourceFlag(said2, flag) {
19500
19537
  }
19501
19538
  return out;
19502
19539
  }
19503
- function workflowFlag(asked) {
19540
+ function studioFlag(asked) {
19504
19541
  const wanted = (asked ?? "").trim();
19505
- if (wanted) return knownWorkflow(wanted);
19506
- const all2 = workflows();
19507
- if (!all2[0]) die(noWorkflowMessage(""), { kind: "no-workflow", workflow: "" });
19542
+ if (wanted) return knownStudio(wanted);
19543
+ const all2 = studios();
19544
+ if (!all2[0]) die(noStudioMessage(""), { kind: "no-studio", studio: "" });
19508
19545
  if (all2.length > 1 && !workspaceTask()) {
19509
- die(`--workflow is required on a board with several workflows. Pick one: ${all2.map((w) => w.id).join(", ")}`, { kind: "needs-input" });
19546
+ die(`--studio is required on a board with several studios. Pick one: ${all2.map((w) => w.id).join(", ")}`, { kind: "needs-input" });
19510
19547
  }
19511
19548
  return all2[0].id;
19512
19549
  }
19513
- function itemWorkflow(sourceId) {
19550
+ function itemStudio(sourceId) {
19514
19551
  const item = [...readInbox(), ...readArchived(), ...readAllDismissed()].find((signal2) => signal2.sourceId === sourceId);
19515
- return item?.workflow && workflowById(item.workflow) ? item.workflow : void 0;
19552
+ return item?.studio && studioById(item.studio) ? item.studio : void 0;
19516
19553
  }
19517
19554
  function previewsFlag(said2, flow) {
19518
19555
  const offered = flow ? previewAgents(flow).map((h) => h.agent) : [];
19519
19556
  const asked = new Set(said2.map((name) => canonicalSpecAgent(name.trim())).filter(Boolean));
19520
19557
  const unknown = [...asked].filter((name) => !offered.includes(name));
19521
19558
  if (unknown.length) {
19522
- die(`${unknown.map((n) => `\`${n}\``).join(", ")} ${unknown.length > 1 ? "are not previews" : "is not a preview"} of its workflow. It offers: ${offered.join(", ") || "none"}.`, { kind: "needs-input" });
19559
+ die(`${unknown.map((n) => `\`${n}\``).join(", ")} ${unknown.length > 1 ? "are not previews" : "is not a preview"} of its studio. It offers: ${offered.join(", ") || "none"}.`, { kind: "needs-input" });
19523
19560
  }
19524
19561
  return offered.filter((name) => asked.has(name));
19525
19562
  }
@@ -19586,10 +19623,10 @@ function cmdUpdate(id, flags) {
19586
19623
  meta.source = [.../* @__PURE__ */ new Set([...meta.source, ...sourceFlag(flags.addSource, "add-source")])];
19587
19624
  changes.push("source");
19588
19625
  }
19589
- if (flags.workflow !== void 0 && switchWorkflow(id, meta, flags.workflow)) {
19590
- changes.push(`workflow\u2192${meta.workflow}`, "status\u2192todo");
19626
+ if (flags.studio !== void 0 && switchStudio(id, meta, flags.studio)) {
19627
+ changes.push(`studio\u2192${meta.studio}`, "status\u2192todo");
19591
19628
  }
19592
- const flow = workflowFor(meta.workflow);
19629
+ const flow = studioFor(meta.studio);
19593
19630
  if (flags.previews !== void 0) {
19594
19631
  meta.previews = previewsFlag(flags.previews, flow);
19595
19632
  changes.push("previews");
@@ -19680,7 +19717,7 @@ var init_card = __esm({
19680
19717
  init_io();
19681
19718
  init_usage();
19682
19719
  init_validate();
19683
- init_workflows();
19720
+ init_studios();
19684
19721
  init_inbox();
19685
19722
  init_questions();
19686
19723
  init_question_ops();
@@ -19688,7 +19725,7 @@ var init_card = __esm({
19688
19725
  init_cards();
19689
19726
  init_source();
19690
19727
  init_store();
19691
- init_workflow_cards();
19728
+ init_studio_cards();
19692
19729
  init_spec_agent_names();
19693
19730
  init_env();
19694
19731
  init_tasks();
@@ -19980,7 +20017,7 @@ function addToInbox(drop) {
19980
20017
  ...hit ? { sourceType: hit } : {},
19981
20018
  ...kept2 ? { meta: [kept2, ...read3.incoming.meta] } : {},
19982
20019
  ...drop.agent ? { agent: drop.agent } : {},
19983
- ...drop.workflow ? { workflow: drop.workflow } : {}
20020
+ ...drop.studio ? { studio: drop.studio } : {}
19984
20021
  };
19985
20022
  if (!incoming.title || !incoming.summary) return { ok: false, error: "nothing to add \u2014 that had no words in it." };
19986
20023
  const sourceId = derivedSourceId(incoming.url || `${incoming.title}
@@ -20198,8 +20235,8 @@ function migrateCard(card) {
20198
20235
  const said2 = (key) => typeof raw[key] === "string" ? raw[key].trim() : "";
20199
20236
  const cadence = parseCadence(said2("cadence")) ? said2("cadence") : "";
20200
20237
  const lastRun = parseStamp(said2("last_run")) ? said2("last_run") : "";
20201
- const flow = workflowById(meta.workflow || "coding") ?? workflows()[0];
20202
- if (!flow) throw new Error(noWorkflowMessage(""));
20238
+ const flow = studioById(meta.studio || "coding") ?? studios()[0];
20239
+ if (!flow) throw new Error(noStudioMessage(""));
20203
20240
  const text4 = (name2) => agentText(name2, meta.title || card.slug, body);
20204
20241
  const name = agentName(card, text4);
20205
20242
  const dir = path66.join(AGENTS, name);
@@ -20209,7 +20246,7 @@ function migrateCard(card) {
20209
20246
  try {
20210
20247
  fs63.mkdirSync(dir, { recursive: true });
20211
20248
  if (wrote) fs63.writeFileSync(file, text4(name));
20212
- const adopted = adoptWorkflowScheduled(flow.id, name, { cadence, lastRun });
20249
+ const adopted = adoptStudioScheduled(flow.id, name, { cadence, lastRun });
20213
20250
  if (!adopted.ok) throw new Error(adopted.error);
20214
20251
  questionsToTriage(meta, name);
20215
20252
  } catch (e) {
@@ -20219,7 +20256,7 @@ function migrateCard(card) {
20219
20256
  }
20220
20257
  if (card.folder) mergeInto2(card.folder, dir, ["root.md"]);
20221
20258
  removeCard(card);
20222
- return { card: rel(card.file), agent: name, workflow: flow.name, on: !!cadence, cadence };
20259
+ return { card: rel(card.file), agent: name, studio: flow.name, on: !!cadence, cadence };
20223
20260
  }
20224
20261
  function migrateRecurringCards() {
20225
20262
  const done2 = { agents: [], removed: [], failed: [] };
@@ -20243,7 +20280,7 @@ function migrateRecurringCards() {
20243
20280
  function recurringMigrationLines(done2) {
20244
20281
  return [
20245
20282
  ...done2.agents.map(
20246
- (one) => `${one.card} is now the scheduled agent \`${one.agent}\` in the ${one.workflow} workflow \u2014 ` + (one.on ? `on, cadence ${one.cadence}` : "off: it had no cadence, so it runs only when you run it")
20283
+ (one) => `${one.card} is now the scheduled agent \`${one.agent}\` in the ${one.studio} studio \u2014 ` + (one.on ? `on, cadence ${one.cadence}` : "off: it had no cadence, so it runs only when you run it")
20247
20284
  ),
20248
20285
  ...done2.removed.map((card) => `removed ${card} \u2014 write a scheduled agent to pull triage items on a cadence (\`akb guide write-agent\`)`),
20249
20286
  ...done2.failed.map((one) => `could not turn ${one.card} into a scheduled agent: ${one.why}. It is left as it was and tried again next time`)
@@ -20255,7 +20292,7 @@ var init_recurring = __esm({
20255
20292
  "use strict";
20256
20293
  init_settings();
20257
20294
  init_roles();
20258
- init_workflows();
20295
+ init_studios();
20259
20296
  init_catalog();
20260
20297
  init_parse();
20261
20298
  init_cadence();
@@ -20425,7 +20462,7 @@ _(not filled in yet \u2014 build the map from the repo before tagging a card.)_
20425
20462
 
20426
20463
  // src/lib/agent/scheduled.ts
20427
20464
  function scheduledBusy(pass, store = readStore()) {
20428
- const args = { agent: pass.agent, workflow: pass.workflow };
20465
+ const args = { agent: pass.agent, studio: pass.studio };
20429
20466
  if (store.runs.some((r) => r.status === "running" && isPass(r, pass))) {
20430
20467
  return refusal("scheduledRunning", `\`${pass.agent}\` is already running`, args);
20431
20468
  }
@@ -20437,7 +20474,7 @@ function scheduledBusy(pass, store = readStore()) {
20437
20474
  function insideScheduledPass() {
20438
20475
  const sessionId = insideRun();
20439
20476
  const run2 = sessionId ? readStore().runs.find((r) => r.sessionId === sessionId) : void 0;
20440
- return run2?.action === "scheduled" && run2.workflow && run2.specAgent ? { workflow: run2.workflow, agent: run2.specAgent } : null;
20477
+ return run2?.action === "scheduled" && run2.studio && run2.specAgent ? { studio: run2.studio, agent: run2.specAgent } : null;
20441
20478
  }
20442
20479
  function runAgent() {
20443
20480
  const sessionId = insideRun();
@@ -20462,12 +20499,12 @@ var init_scheduled = __esm({
20462
20499
  init_types();
20463
20500
  scheduledRequest = (pass) => ({
20464
20501
  action: "scheduled",
20465
- workflow: pass.workflow,
20502
+ studio: pass.studio,
20466
20503
  specAgent: pass.agent
20467
20504
  });
20468
- isPass = (run2, pass) => run2.action === "scheduled" && run2.workflow === pass.workflow && run2.specAgent === pass.agent;
20505
+ isPass = (run2, pass) => run2.action === "scheduled" && run2.studio === pass.studio && run2.specAgent === pass.agent;
20469
20506
  openPasses = (deliveries, pass) => deliveries.filter(
20470
- (d) => d.status === "active" && d.scheduled?.workflow === pass.workflow && d.scheduled.agent === pass.agent
20507
+ (d) => d.status === "active" && d.scheduled?.studio === pass.studio && d.scheduled.agent === pass.agent
20471
20508
  );
20472
20509
  stalePasses = (pass) => openPasses(readStore().deliveries, pass).map((d) => d.deliveryId);
20473
20510
  }
@@ -20657,10 +20694,10 @@ function cmdArchived(opts) {
20657
20694
  if (opts.since?.trim() === LAST_RUN) {
20658
20695
  const pass = insideScheduledPass();
20659
20696
  if (!pass) die(`--since ${LAST_RUN} only works inside a scheduled agent's run. Elsewhere, write the time as "YYYY-MM-DD HH:MM".`);
20660
- const last = scheduledAgent(pass.workflow, pass.agent)?.lastRun ?? "";
20697
+ const last = scheduledAgent(pass.studio, pass.agent)?.lastRun ?? "";
20661
20698
  if (!parseStamp(last)) {
20662
20699
  say("this is the first run, so no cards are listed.");
20663
- return { cards: [], since: null, workflow: opts.workflow ?? null, firstRun: true };
20700
+ return { cards: [], since: null, studio: opts.studio ?? null, firstRun: true };
20664
20701
  }
20665
20702
  opts = { ...opts, since: last };
20666
20703
  }
@@ -20668,19 +20705,19 @@ function cmdArchived(opts) {
20668
20705
  since = parseStamp(opts.since);
20669
20706
  if (!since) die(`cannot read --since "${opts.since}". Write it as "YYYY-MM-DD HH:MM", e.g. --since "2026-08-02 14:31".`);
20670
20707
  }
20671
- const workflow = opts.workflow === void 0 ? null : knownWorkflow(opts.workflow);
20708
+ const studio = opts.studio === void 0 ? null : knownStudio(opts.studio);
20672
20709
  const open3 = boardCardIds();
20673
20710
  const files = archivedFiles();
20674
- const cards = landedDeliveries({ since: since?.getTime(), workflow: workflow ?? void 0 }).filter((d) => !open3.has(d.cardId)).map((d) => ({
20711
+ const cards = landedDeliveries({ since: since?.getTime(), studio: studio ?? void 0 }).filter((d) => !open3.has(d.cardId)).map((d) => ({
20675
20712
  id: d.cardId,
20676
20713
  title: d.title,
20677
- workflow: d.workflow,
20714
+ studio: d.studio,
20678
20715
  landedAt: formatStamp(new Date(d.at)),
20679
20716
  commit: d.commit,
20680
20717
  file: files.has(d.cardId) ? rel(files.get(d.cardId)) : ""
20681
20718
  }));
20682
- const result = { cards, since: since ? formatStamp(since) : null, workflow };
20683
- const scope = [workflow ? `on workflow \`${workflow}\`` : "", since ? `since ${formatStamp(since)}` : ""].filter(Boolean).join(" ");
20719
+ const result = { cards, since: since ? formatStamp(since) : null, studio };
20720
+ const scope = [studio ? `on studio \`${studio}\`` : "", since ? `since ${formatStamp(since)}` : ""].filter(Boolean).join(" ");
20684
20721
  if (!cards.length) {
20685
20722
  say(`no cards landed${scope ? ` ${scope}` : ""}.`);
20686
20723
  return result;
@@ -20689,18 +20726,18 @@ function cmdArchived(opts) {
20689
20726
  for (const c of cards) {
20690
20727
  say("");
20691
20728
  say(`#${c.id} ${c.title}${c.file ? ` (${c.file})` : ""}`);
20692
- say(` ${c.workflow} \xB7 landed ${c.landedAt} \xB7 commit ${c.commit}`);
20729
+ say(` ${c.studio} \xB7 landed ${c.landedAt} \xB7 commit ${c.commit}`);
20693
20730
  }
20694
20731
  return result;
20695
20732
  }
20696
20733
  function cmdList(opts) {
20697
20734
  if (opts.archived) {
20698
20735
  if (opts.stale) die("--archived and --stale answer different questions \u2014 pass one of them.");
20699
- if (opts.module !== void 0) die("--module does not apply to --archived; narrow it with --workflow.");
20736
+ if (opts.module !== void 0) die("--module does not apply to --archived; narrow it with --studio.");
20700
20737
  return cmdArchived(opts);
20701
20738
  }
20702
20739
  if (opts.since !== void 0) die("--since only applies to --archived.");
20703
- if (opts.workflow !== void 0) die("--workflow only applies to --archived.");
20740
+ if (opts.studio !== void 0) die("--studio only applies to --archived.");
20704
20741
  const all2 = openRows();
20705
20742
  let rows = all2;
20706
20743
  let scope = "on the board";
@@ -20745,7 +20782,7 @@ var init_list = __esm({
20745
20782
  init_cards();
20746
20783
  init_cadence();
20747
20784
  init_deliveries();
20748
- init_workflows();
20785
+ init_studios();
20749
20786
  init_scheduled();
20750
20787
  init_card_age();
20751
20788
  init_card_holds();
@@ -20853,8 +20890,8 @@ function buildCard(id, file, relFromTodo) {
20853
20890
  const { meta, body } = parseFrontmatter(text4);
20854
20891
  if (!meta) return null;
20855
20892
  const relPath = relFromTodo.split(path70.sep).join("/");
20856
- const flow = workflowFor(meta.workflow);
20857
- const plan = !!meta.workflow && archivesOnApproval(flow);
20893
+ const flow = studioFor(meta.studio);
20894
+ const plan = !!meta.studio && archivesOnApproval(flow);
20858
20895
  const stages = cardStages(meta, flow).length;
20859
20896
  return {
20860
20897
  id,
@@ -20869,7 +20906,7 @@ function buildCard(id, file, relFromTodo) {
20869
20906
  blocked_by: meta.blocked_by,
20870
20907
  related: meta.related,
20871
20908
  questions: meta.questions,
20872
- workflow: meta.workflow,
20909
+ studio: meta.studio,
20873
20910
  ...plan ? { deliversIn: "plan" } : {},
20874
20911
  ...stages > 1 ? { stages, stage: cardStage(meta, flow) } : {},
20875
20912
  modules: meta.modules,
@@ -21066,7 +21103,7 @@ var init_read = __esm({
21066
21103
  init_frontmatter();
21067
21104
  init_assemble();
21068
21105
  init_revision();
21069
- init_workflows();
21106
+ init_studios();
21070
21107
  }
21071
21108
  });
21072
21109
 
@@ -21941,7 +21978,7 @@ async function dispatch(move, cmd, args, opts, cli) {
21941
21978
  const data = await runAction(ctx, {}, async () => {
21942
21979
  const found2 = resolveBoard(move, { board: ctx.board, dir: ctx.dir, cwd: cli.cwd, installHint: cli.installHint });
21943
21980
  useBoard(found2, ctx.dir !== null);
21944
- await syncWorkflows();
21981
+ await syncStudios();
21945
21982
  const root2 = found2.root;
21946
21983
  sayIfRetiredPointer(root2);
21947
21984
  const creating = move === "create" && insideRun() ? peekRun(insideRun()) : void 0;
@@ -21953,8 +21990,8 @@ async function dispatch(move, cmd, args, opts, cli) {
21953
21990
  const inRun = move === "create" && insideRun() !== null;
21954
21991
  const task = move === "create" && opts.id === void 0 ? workspaceTask() : null;
21955
21992
  if (move === "create" && opts.id === void 0) {
21956
- const { workflow } = validateCreate(opts);
21957
- input.opts = (await cloudCard(task, task ? opts : { ...opts, workflow })).opts;
21993
+ const { studio } = validateCreate(opts);
21994
+ input.opts = (await cloudCard(task, task ? opts : { ...opts, studio })).opts;
21958
21995
  }
21959
21996
  const data2 = READ_ONLY_MOVES.has(move) ? await board().readMove(move, input) : unwrap(await withLease(moveTarget(move, args), (env2) => board().runMove(move, input, env2)));
21960
21997
  const created = move === "create" && Array.isArray(data2.ids) ? data2.ids.filter((id) => Number.isInteger(id)) : [];
@@ -21982,7 +22019,7 @@ async function cloudCard(task, opts) {
21982
22019
  const said2 = {
21983
22020
  title: String(opts.title ?? "").trim(),
21984
22021
  request: request2,
21985
- workflow: typeof opts.workflow === "string" && opts.workflow.trim() ? opts.workflow.trim() : void 0,
22022
+ studio: typeof opts.studio === "string" && opts.studio.trim() ? opts.studio.trim() : void 0,
21986
22023
  slug: typeof opts.slug === "string" ? opts.slug : void 0,
21987
22024
  triage: sourceFile,
21988
22025
  agent: runAgent() ?? void 0
@@ -22034,14 +22071,14 @@ function buildBoardProgram(cli) {
22034
22071
  const asked = [];
22035
22072
  const inOrder = ordered(asked);
22036
22073
  move("create").summary("write exactly one card \u2014 its fields, its body template and its index entry").description(
22037
- 'Write exactly ONE card: allocate its id, write its frontmatter and a body template, and index it. There is no separate id-reservation mode. --blocked-by and --related take ids of existing open cards; for a group, create the root first, then create each subtask related to its id (see "Group tasks" in `akb guide add-task`). The script owns the frontmatter and writes the body scaffold; fill only the body by hand. Without --id, Cloud assigns the number in the linked project (no source task required). A failed local write can resume the same creation without making another Cloud task. Missing or invalid project links and denied access exit with code 1 using the existing error envelope. --body-file accepts a short draft or full card body. Invalid bodies fail before allocating a task or writing a card, with repair instructions. Cloud moves the card on by itself once it reaches the board: do not refine it here. Example: akb raw create --title "Add a delete command" --workflow coding --body-file /tmp/delete-command.md'
22038
- ).requiredOption("--title <title>", "what the card is called").addOption(new Option("--recurring").hideHelp()).option("--priority <level>", `how much it matters: ${LEVELS.join(" | ")} (default: med)`, oneOf(LEVELS)).option("--blocked-by <ids>", "ids of open cards this one waits on", collectList).option("--related <ids>", "ids of open cards this one relates to", collectList).option("--modules <names>", "the parts of the project it touches, validated against modules.md", collectList).option("--question <text>", "an open question; needs its --option choices. Repeatable; follow `akb guide update-questions`", inOrder("question")).option("--option <text>", "a choice for the --question before it", inOrder("option")).option("--recommended-option <text>", "a choice for the --question before it, ticked to start", inOrder("recommended-option")).option("--mode <mode>", "how many choices the --question before it takes: single | multi", inOrder("mode")).option("--slug <slug>", "the filename to write it under (default: from the title)").option("--no-body", "write the frontmatter and no body template").option("--body-file <path>", "a short draft or full card body, written to a file first").addOption(new Option("--cadence <cadence>").hideHelp()).option("--workflow <id>", "the workflow it runs through (`akb workflow list`). Required when the board has more than one, except inside a task run, which uses the task's own").option("--previews <agents>", `the preview agents it chose, from its workflow's; "" chooses none`, collectList).addOption(new Option("--id <n>", "the number Cloud gave this card's task; for the Runner").argParser(cardId).hideHelp()).option("--triage <source-id>", "the triage item this card is made of, so the item is never carded twice").option("--source <ref>", "where it came from: a plan's path, plan:<id>, #<id> or a URL. Repeatable", collect2).action(async function() {
22074
+ 'Write exactly ONE card: allocate its id, write its frontmatter and a body template, and index it. There is no separate id-reservation mode. --blocked-by and --related take ids of existing open cards; for a group, create the root first, then create each subtask related to its id (see "Group tasks" in `akb guide add-task`). The script owns the frontmatter and writes the body scaffold; fill only the body by hand. Without --id, Cloud assigns the number in the linked project (no source task required). A failed local write can resume the same creation without making another Cloud task. Missing or invalid project links and denied access exit with code 1 using the existing error envelope. --body-file accepts a short draft or full card body. Invalid bodies fail before allocating a task or writing a card, with repair instructions. Cloud moves the card on by itself once it reaches the board: do not refine it here. Example: akb raw create --title "Add a delete command" --studio coding --body-file /tmp/delete-command.md'
22075
+ ).requiredOption("--title <title>", "what the card is called").addOption(new Option("--recurring").hideHelp()).option("--priority <level>", `how much it matters: ${LEVELS.join(" | ")} (default: med)`, oneOf(LEVELS)).option("--blocked-by <ids>", "ids of open cards this one waits on", collectList).option("--related <ids>", "ids of open cards this one relates to", collectList).option("--modules <names>", "the parts of the project it touches, validated against modules.md", collectList).option("--question <text>", "an open question; needs its --option choices. Repeatable; follow `akb guide update-questions`", inOrder("question")).option("--option <text>", "a choice for the --question before it", inOrder("option")).option("--recommended-option <text>", "a choice for the --question before it, ticked to start", inOrder("recommended-option")).option("--mode <mode>", "how many choices the --question before it takes: single | multi", inOrder("mode")).option("--slug <slug>", "the filename to write it under (default: from the title)").option("--no-body", "write the frontmatter and no body template").option("--body-file <path>", "a short draft or full card body, written to a file first").addOption(new Option("--cadence <cadence>").hideHelp()).option("--studio <id>", "the studio it runs through (`akb studio list`). Required when the board has more than one, except inside a task run, which uses the task's own").option("--previews <agents>", `the preview agents it chose, from its studio's; "" chooses none`, collectList).addOption(new Option("--id <n>", "the number Cloud gave this card's task; for the Runner").argParser(cardId).hideHelp()).option("--triage <source-id>", "the triage item this card is made of, so the item is never carded twice").option("--source <ref>", "where it came from: a plan's path, plan:<id>, #<id> or a URL. Repeatable", collect2).action(async function() {
22039
22076
  refuseRecurring(this);
22040
22077
  await dispatch("create", this, [], { ...this.opts(), asked }, cli);
22041
22078
  });
22042
22079
  move("update").argument("<id>", ID, cardId).summary("rewrite a card's fields").description(
22043
22080
  "Rewrite a card's frontmatter fields. --slug renames it. Body and questions are left untouched \u2014 those have their own moves."
22044
- ).option("--title <title>", "what the card is called").option("--priority <level>", LEVELS.join(" | "), oneOf(LEVELS)).option("--status <status>", STATUSES.join(" | "), oneOf(STATUSES)).option("--blocked-by <ids>", "ids of open cards this one waits on", collectList).option("--related <ids>", "ids of open cards this one relates to", collectList).option("--add-blocked-by <ids>", "append ids to blocked_by, keeping the ids already there", collectList).option("--add-related <ids>", "append ids to related, keeping the ids already there", collectList).option("--modules <names>", "the parts of the project it touches", collectList).option("--source <ref>", `where it came from: a plan's path, plan:<id>, #<id> or a URL. Repeatable; "" clears the list`, collect2).option("--add-source <ref>", "append one source, keeping the ones already there. Repeatable", collect2).option("--previews <agents>", `the preview agents it chose, from its workflow's; "" chooses none`, collectList).option("--phase <n>", "the approval it is on, 1-based").option("--slug <slug>", "rename the file").option("--workflow <id>", "the workflow it runs through. The card goes back to todo and is re-planned").addOption(new Option("--cadence <cadence>").hideHelp()).action(async function(id) {
22081
+ ).option("--title <title>", "what the card is called").option("--priority <level>", LEVELS.join(" | "), oneOf(LEVELS)).option("--status <status>", STATUSES.join(" | "), oneOf(STATUSES)).option("--blocked-by <ids>", "ids of open cards this one waits on", collectList).option("--related <ids>", "ids of open cards this one relates to", collectList).option("--add-blocked-by <ids>", "append ids to blocked_by, keeping the ids already there", collectList).option("--add-related <ids>", "append ids to related, keeping the ids already there", collectList).option("--modules <names>", "the parts of the project it touches", collectList).option("--source <ref>", `where it came from: a plan's path, plan:<id>, #<id> or a URL. Repeatable; "" clears the list`, collect2).option("--add-source <ref>", "append one source, keeping the ones already there. Repeatable", collect2).option("--previews <agents>", `the preview agents it chose, from its studio's; "" chooses none`, collectList).option("--phase <n>", "the approval it is on, 1-based").option("--slug <slug>", "rename the file").option("--studio <id>", "the studio it runs through. The card goes back to todo and is re-planned").addOption(new Option("--cadence <cadence>").hideHelp()).action(async function(id) {
22045
22082
  refuseRecurring(this);
22046
22083
  await dispatch("update", this, [String(id)], this.opts(), cli);
22047
22084
  });
@@ -22066,11 +22103,11 @@ function buildBoardProgram(cli) {
22066
22103
  await dispatch("memory-file", this, [name], this.opts(), cli);
22067
22104
  });
22068
22105
  move("list").summary("the open cards: id, title, meta, summary, path \u2014 or, with --archived, the cards that landed").description(
22069
- "The open cards at a glance \u2014 one block per card with its id, title, meta (status, priority, blockers, open questions), summary line and file path.\n\n`--stale` asks the other question: which cards have sat untouched past the board's **Stale after** setting (config.md, 30 days by default), stalest first, each with the days it has sat and what is holding it \u2014 a blocker, an unanswered question, or a build. Age is the date git last saw the card's file; group roots and cards git cannot date are left out.\n\n`--archived` answers \"which cards landed in this period\": one block per landing, oldest first, with the card id, title, workflow, landing time, landed commit and the archived card file (blank when the file is no longer in .archive/, e.g. deleted by hand; a card the daily cleanup deletes goes with its finished delivery and is not listed). Only cards the board landed are listed \u2014 a card archived by hand, committed by hand, or built by a workflow that leaves files instead of a commit is not among them."
22106
+ "The open cards at a glance \u2014 one block per card with its id, title, meta (status, priority, blockers, open questions), summary line and file path.\n\n`--stale` asks the other question: which cards have sat untouched past the board's **Stale after** setting (config.md, 30 days by default), stalest first, each with the days it has sat and what is holding it \u2014 a blocker, an unanswered question, or a build. Age is the date git last saw the card's file; group roots and cards git cannot date are left out.\n\n`--archived` answers \"which cards landed in this period\": one block per landing, oldest first, with the card id, title, studio, landing time, landed commit and the archived card file (blank when the file is no longer in .archive/, e.g. deleted by hand; a card the daily cleanup deletes goes with its finished delivery and is not listed). Only cards the board landed are listed \u2014 a card archived by hand, committed by hand, or built by a studio that leaves files instead of a commit is not among them."
22070
22107
  ).option("-m, --module <name>", "only the cards tagged with that module, validated against modules.md").option("--stale", "only the cards untouched past the threshold, stalest first, with the days each has sat").option("--archived", "the cards that landed and were archived, oldest first, each with its landed commit").option(
22071
22108
  "--since <time>",
22072
22109
  'with --archived: only landings after this time, written "YYYY-MM-DD HH:MM"; inside a scheduled agent\'s run, `last-run` is when its last run began'
22073
- ).option("--workflow <id>", "with --archived: only the cards of that workflow").action(async function() {
22110
+ ).option("--studio <id>", "with --archived: only the cards of that studio").action(async function() {
22074
22111
  await dispatch("list", this, [], this.opts(), cli);
22075
22112
  });
22076
22113
  move("archive").argument("<id>", ID, cardId).summary("finish a card").description(
@@ -22121,7 +22158,7 @@ var init_board2 = __esm({
22121
22158
  init_sessions();
22122
22159
  init_paths();
22123
22160
  init_board_cli();
22124
- init_cloud_workflows();
22161
+ init_cloud_studios();
22125
22162
  init_validate();
22126
22163
  init_shared2();
22127
22164
  init_esm();
@@ -22139,7 +22176,7 @@ function useBoard(found2, dirNamed) {
22139
22176
  if (!found2.named && found2.board === path74.join(found2.root, "docs", "kanban")) setBoardRoot(found2.root, dirNamed);
22140
22177
  else setBoardDir(found2.board, found2.root);
22141
22178
  useProjectState();
22142
- backfillCardWorkflows();
22179
+ backfillCardStudios();
22143
22180
  }
22144
22181
  function whole(found2, move) {
22145
22182
  if (move === MAKES_A_BOARD) return found2;
@@ -22277,7 +22314,7 @@ var init_board_cli = __esm({
22277
22314
  init_paths();
22278
22315
  init_io();
22279
22316
  init_pointer();
22280
- init_card_workflow_backfill();
22317
+ init_card_studio_backfill();
22281
22318
  MAKES_A_BOARD = "init";
22282
22319
  hasBoard = (dir) => fs73.existsSync(path74.join(dir, "docs", "kanban"));
22283
22320
  isBoardDir = (dir) => fs73.existsSync(path74.join(dir, "todo")) && fs73.existsSync(path74.join(dir, "config.md"));
@@ -22325,9 +22362,9 @@ Print it, or run it
22325
22362
  /** Under `delivery`: what one is, which no verb of it says on its own. */
22326
22363
  deliveries: (program2) => `
22327
22364
  What a delivery is
22328
- A delivery freezes the approved requirements and runs the workflow agents in order.
22365
+ A delivery freezes the approved requirements and runs the studio agents in order.
22329
22366
  Each agent records its result with \`delivery complete\`; the final step archives the card.
22330
- The builder manages its branch, worktree, checks and merge. File workflows deliver their
22367
+ The builder manages its branch, worktree, checks and merge. File studios deliver their
22331
22368
  recorded outputs in the authorized directory. A successful run alone does not finish a delivery.
22332
22369
  \`cancel\` ends it and preserves files. \`resume\` continues unfinished work.
22333
22370
 
@@ -22893,8 +22930,8 @@ var init_cloud_template = __esm({
22893
22930
 
22894
22931
  // src/commands/components.ts
22895
22932
  function cmdComponents(opts) {
22896
- if (!!opts.agent === !!opts.workflow) die("choose exactly one of --agent or --workflow", { kind: "invalid-usage" });
22897
- const docs = opts.agent ? agentComponents([opts.agent]) : workflowComponents(opts.workflow);
22933
+ if (!!opts.agent === !!opts.studio) die("choose exactly one of --agent or --studio", { kind: "invalid-usage" });
22934
+ const docs = opts.agent ? agentComponents([opts.agent]) : studioComponents(opts.studio);
22898
22935
  say(docs.map((doc) => doc.name).join("\n") || "(none)");
22899
22936
  if (opts.docs && docs.length) say(`
22900
22937
  ${componentDocsText(docs)}`);
@@ -22913,7 +22950,7 @@ var init_components2 = __esm({
22913
22950
  var add_task_default;
22914
22951
  var init_add_task = __esm({
22915
22952
  "src/guide/add-task.md"() {
22916
- add_task_default = '# Add tasks\n\nUse this guide whenever work may become a card.\n\n- **Modules**: read `docs/kanban/modules.md` and relevant code or plans to choose or verify tags;\n follow `akb guide module-map` when none fits or a module needs splitting, and never ask the\n user to categorize the task.\n\n## Create the card\n\nWrite the fields with flags, never by editing frontmatter. Only `--title` is required:\n\n```text\nakb raw create --title "..." --modules <names> --priority <high|med|low> \\\n --workflow <id> [--previews <agents>] [--blocked-by <ids>] [--related <ids>] [--source <ref>]... \\\n [--slug <short-english-slug>] \\\n [--question "..." --recommended-option "..." --option "..." [--mode multi]]...\n```\n\n- **Workflow**: the request\'s own, else the id from `akb workflow list` that fits the work.\n- **Previews**: the agents from `akb raw previews --triggers --workflow <id>` whose conditions the\n card meets, always including those marked `Always`, or `--previews ""` when that leaves none.\n- **Dependencies**: `--blocked-by` for cards this one waits on, `--related` for cards that only\n relate; an existing card that needs this one\'s output gets\n `akb raw update <id> --add-blocked-by <ids>`.\n- **Source**: each plan path, card `#id` or URL the card came from.\n- **Non-English title**: needs `--slug`.\n- **Open questions**: classify each as `akb guide update-questions` says before writing it.\n\nFor example:\n\n```text\nakb raw create --title "Document the export format" --modules docs --priority low \\\n --workflow coding --blocked-by 42 --related 41 --source "#41"\n```\n\n### Group tasks\n\nUse a group when the cards are parts of one larger outcome, such as a plugin system with its\nSlack and Notion examples: a root plus one card per part. Otherwise keep cards independent.\n\n```text\ntodo/<id>-<short-slug>/\n root.md # the whole job\n <subid>-<slug>.md # one part, its own card\n```\n\n1. Create the root; call the id it prints `<id>`.\n2. Create each part with `--related <id>`, and `--blocked-by <subid>` where order matters.\n3. Move the files: the root becomes `todo/<id>-<short-slug>/root.md`, and each part keeps\n its filename under that folder. The folder slug is short English ASCII.\n4. Point the root at its parts: `akb raw update <id> --related <subid,subid,...>`.\n5. Repoint the moved cards in `todo/README.md`: give each bullet its new path and leave it\n under its heading.\n\nThe root\'s `## Todo` lists its parts, one line each ending in `#<subid>`.\n\n### Writing\n\nFill the body scaffold that `akb raw create` wrote, carrying the request\'s constraints into\nit. Do not rename or translate its section titles, and leave empty scaffold sections in\nplace. Do not repeat the title as an H1.\n\nCloud moves the card on by itself once it reaches the board; do not refine it in this session.\n';
22953
+ add_task_default = '# Add tasks\n\nUse this guide whenever work may become a card.\n\n- **Modules**: read `docs/kanban/modules.md` and relevant code or plans to choose or verify tags;\n follow `akb guide module-map` when none fits or a module needs splitting, and never ask the\n user to categorize the task.\n\n## Create the card\n\nWrite the fields with flags, never by editing frontmatter. Only `--title` is required:\n\n```text\nakb raw create --title "..." --modules <names> --priority <high|med|low> \\\n --studio <id> [--previews <agents>] [--blocked-by <ids>] [--related <ids>] [--source <ref>]... \\\n [--slug <short-english-slug>] \\\n [--question "..." --recommended-option "..." --option "..." [--mode multi]]...\n```\n\n- **Studio**: the request\'s own, else the id from `akb studio list` that fits the work.\n- **Previews**: the agents from `akb raw previews --triggers --studio <id>` whose conditions the\n card meets, always including those marked `Always`, or `--previews ""` when that leaves none.\n- **Dependencies**: `--blocked-by` for cards this one waits on, `--related` for cards that only\n relate; an existing card that needs this one\'s output gets\n `akb raw update <id> --add-blocked-by <ids>`.\n- **Source**: each plan path, card `#id` or URL the card came from.\n- **Non-English title**: needs `--slug`.\n- **Open questions**: classify each as `akb guide update-questions` says before writing it.\n\nFor example:\n\n```text\nakb raw create --title "Document the export format" --modules docs --priority low \\\n --studio coding --blocked-by 42 --related 41 --source "#41"\n```\n\n### Group tasks\n\nUse a group when the cards are parts of one larger outcome, such as a plugin system with its\nSlack and Notion examples: a root plus one card per part. Otherwise keep cards independent.\n\n```text\ntodo/<id>-<short-slug>/\n root.md # the whole job\n <subid>-<slug>.md # one part, its own card\n```\n\n1. Create the root; call the id it prints `<id>`.\n2. Create each part with `--related <id>`, and `--blocked-by <subid>` where order matters.\n3. Move the files: the root becomes `todo/<id>-<short-slug>/root.md`, and each part keeps\n its filename under that folder. The folder slug is short English ASCII.\n4. Point the root at its parts: `akb raw update <id> --related <subid,subid,...>`.\n5. Repoint the moved cards in `todo/README.md`: give each bullet its new path and leave it\n under its heading.\n\nThe root\'s `## Todo` lists its parts, one line each ending in `#<subid>`.\n\n### Writing\n\nFill the body scaffold that `akb raw create` wrote, carrying the request\'s constraints into\nit. Do not rename or translate its section titles, and leave empty scaffold sections in\nplace. Do not repeat the title as an H1.\n\nCloud moves the card on by itself once it reaches the board; do not refine it in this session.\n';
22917
22954
  }
22918
22955
  });
22919
22956
 
@@ -22921,7 +22958,7 @@ var init_add_task = __esm({
22921
22958
  var archive_default;
22922
22959
  var init_archive2 = __esm({
22923
22960
  "src/guide/archive.md"() {
22924
- archive_default = "# Finish a task\n\n## Write the shipped line\n\nRecord each user-facing outcome on one line in `docs/kanban/memory/readme.md`, under the\n`## <module>` heading the card's `modules:` names. Do not record internal-only changes. Use\nformats like these:\n\n- \u2705 Exporting a report to PDF: [Export reports](https://docs.example.com/export). Link to\n a published doc when available; do not restate it.\n- \u2705 Customers can pay an invoice by bank transfer from the billing page. When no doc\n exists, state plainly what the user can now do.\n- \u274C The orders table moved to a new database cluster. This describes infrastructure, not\n user-facing behavior.\n\n## Archive the card\n\nUse `akb raw delivery complete <id>` to finish your current workflow step. The last step archives\nthe card and prints its handoff. Earlier steps leave it for the remaining workflow agents.\nOutside an active delivery, use `akb raw archive <id>` or `akb raw reject <id>`.\n\n**Never finish a task by hand.** Deleting the card file yourself leaves other cards'\n`blocked_by:` and `related:` pointing at a card that no longer exists \u2014 the command is what\nfinds those, and nothing else will. A run that does this is reported as having broken the\nboard.\n\nAfter completing the approved step and required outputs, run `akb raw delivery complete <id>`\nand follow its handoff. Software steps in a git project supply `--commit <full-sha> --branch <target>`.\nIf completion was interrupted, inspect the recorded result and retry the same completion.\n";
22961
+ archive_default = "# Finish a task\n\n## Write the shipped line\n\nRecord each user-facing outcome on one line in `docs/kanban/memory/readme.md`, under the\n`## <module>` heading the card's `modules:` names. Do not record internal-only changes. Use\nformats like these:\n\n- \u2705 Exporting a report to PDF: [Export reports](https://docs.example.com/export). Link to\n a published doc when available; do not restate it.\n- \u2705 Customers can pay an invoice by bank transfer from the billing page. When no doc\n exists, state plainly what the user can now do.\n- \u274C The orders table moved to a new database cluster. This describes infrastructure, not\n user-facing behavior.\n\n## Archive the card\n\nUse `akb raw delivery complete <id>` to finish your current studio step. The last step archives\nthe card and prints its handoff. Earlier steps leave it for the remaining studio agents.\nOutside an active delivery, use `akb raw archive <id>` or `akb raw reject <id>`.\n\n**Never finish a task by hand.** Deleting the card file yourself leaves other cards'\n`blocked_by:` and `related:` pointing at a card that no longer exists \u2014 the command is what\nfinds those, and nothing else will. A run that does this is reported as having broken the\nboard.\n\nAfter completing the approved step and required outputs, run `akb raw delivery complete <id>`\nand follow its handoff. Software steps in a git project supply `--commit <full-sha> --branch <target>`.\nIf completion was interrupted, inspect the recorded result and retry the same completion.\n";
22925
22962
  }
22926
22963
  });
22927
22964
 
@@ -22929,7 +22966,7 @@ var init_archive2 = __esm({
22929
22966
  var board_default;
22930
22967
  var init_board3 = __esm({
22931
22968
  "src/guide/board.md"() {
22932
- board_default = "# How this board works\n\nThese rules apply to every card workflow. Read them once; each workflow'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 memory/ all memory \u2014 see \"Who owns a memory file\"\n\u2502 \u251C\u2500\u2500 readme.md what shipped \u2014 the board's own record\n\u2502 \u251C\u2500\u2500 project.md what the project is today \u2014 written only by `akb raw describe-project`\n\u2502 \u251C\u2500\u2500 <name>/ a global memory: `MEMORY.md` (its rules, unless built in), `README.md`\n\u2502 \u2502 (its index) and its entries\n\u2502 \u2514\u2500\u2500 agents/ one folder per agent that keeps memory, named after it \u2014\n\u2502 `planner/` holds `decisions.md`, `rejected.md`, `redesign.md`\n\u251C\u2500\u2500 rules/ `<agent>.md` \u2014 the user's rule for one agent, appended to every run it\n\u2502 does; written from the web or `akb workflow instructions`\n\u251C\u2500\u2500 triage/ items waiting to be sorted, one file each \u2014 not cards. Only\n\u2502 \u2502 Cloud's sort or Refine idea on the web's Triage page turns one\n\u2502 \u2502 into a card; `akb raw triage check <source-id>` finds an existing one\n\u2502 \u251C\u2500\u2500 archived/ items a card was made of\n\u2502 \u251C\u2500\u2500 dismissed/ items ignored, with the reason\n\u2502 \u2514\u2500\u2500 files/ dropped-in files\n\u2514\u2500\u2500 modules.md one line per module \u2014 `akb guide module-map` writes it\n```\n\n## Task ID\n\nEvery task's id is the number at the front of its filename (`04-plan-cap-enforcement.md` \u2192\nid 4): its Cloud task's number (`WC-4`). Only Cloud assigns one; `akb raw create` takes it.\n\n## Never hand-write a card's frontmatter\n\n`akb raw create`, `update`, and `update-questions` manage all of a card's frontmatter,\nincluding its `previews`. Edit only the card's **body** by hand. `akb raw help`\nlists all operations; `akb raw help <move>` explains one operation.\n\n## 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## Who owns a memory file\n\n**A memory file belongs to whoever reads and writes it.**\n\n- **`memory/readme.md`**: the board's record of shipped user-facing work.\n- **`memory/project.md`**: what the project is today, from its users' side, and the\n direction every judgement serves. Only `akb raw describe-project` writes it.\n- **`memory/agents/planner/`**: `decisions.md` holds user-facing answers that guide future\n planning and `redesign.md` design mistakes to avoid, both written by the memory review (`akb\n guide review-memory`); `rejected.md` holds what the user turned down and why, written only\n by the rejection and dismissal review (`akb guide review-rejections`). Other flows only read\n them, `akb raw memory prune` aside.\n- **`memory/<name>/`**: a global memory, kept by every agent listing it under `akb.memory`\n by the rules each run is given. Only the user changes its `MEMORY.md`, from the board UI.\n- **`memory/agents/<agent>/`**: an agent keeps only the files and split paths its own AGENT.md\n declares, plus the `redesign.md` the memory review writes there. An agent whose instructions\n name none keeps none.\n\nFile a planning note about one module in that module's folder,\n`memory/agents/planner/<module>/`, under the same file name, creating it if missing. A note\nspanning modules, or from a card with none, stays in `memory/agents/planner/`.\n\n### What earns a note\n\nOnly what changes a future planning choice. Writing nothing is a complete outcome.\n\n- **Honor an opt-out**: told not to record, write no memory and finish the requested action.\n- **A conversation writes none**: a card chat, a discussion, a feedback conversation, and\n any flow started in it write no memory and say nothing about it.\n- **Require lasting value**: a durable preference, constraint, decision, or lesson.\n- **Skip housekeeping**: duplicates, routine status changes, and facts recorded elsewhere.\n A rejected duplicate is not a rejected feature.\n- **Merge, don't repeat**: rewrite an equivalent entry in place.\n\n`readme.md` is not planning memory.\n";
22969
+ 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 memory/ all memory \u2014 see \"Who owns a memory file\"\n\u2502 \u251C\u2500\u2500 readme.md what shipped \u2014 the board's own record\n\u2502 \u251C\u2500\u2500 project.md what the project is today \u2014 written only by `akb raw describe-project`\n\u2502 \u251C\u2500\u2500 <name>/ a global memory: `MEMORY.md` (its rules, unless built in), `README.md`\n\u2502 \u2502 (its index) and its entries\n\u2502 \u2514\u2500\u2500 agents/ one folder per agent that keeps memory, named after it \u2014\n\u2502 `planner/` holds `decisions.md`, `rejected.md`, `redesign.md`\n\u251C\u2500\u2500 rules/ `<agent>.md` \u2014 the user's rule for one agent, appended to every run it\n\u2502 does; written from the web or `akb studio instructions`\n\u251C\u2500\u2500 triage/ items waiting to be sorted, one file each \u2014 not cards. Only\n\u2502 \u2502 Cloud's sort or Refine idea on the web's Triage page turns one\n\u2502 \u2502 into a card; `akb raw triage check <source-id>` finds an existing one\n\u2502 \u251C\u2500\u2500 archived/ items a card was made of\n\u2502 \u251C\u2500\u2500 dismissed/ items ignored, with the reason\n\u2502 \u2514\u2500\u2500 files/ dropped-in files\n\u2514\u2500\u2500 modules.md one line per module \u2014 `akb guide module-map` writes it\n```\n\n## Task ID\n\nEvery task's id is the number at the front of its filename (`04-plan-cap-enforcement.md` \u2192\nid 4): its Cloud task's number (`WC-4`). Only Cloud assigns one; `akb raw create` takes it.\n\n## Never hand-write a card's frontmatter\n\n`akb raw create`, `update`, and `update-questions` manage all of a card's frontmatter,\nincluding its `previews`. Edit only the card's **body** by hand. `akb raw help`\nlists all operations; `akb raw help <move>` explains one operation.\n\n## 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## Who owns a memory file\n\n**A memory file belongs to whoever reads and writes it.**\n\n- **`memory/readme.md`**: the board's record of shipped user-facing work.\n- **`memory/project.md`**: what the project is today, from its users' side, and the\n direction every judgement serves. Only `akb raw describe-project` writes it.\n- **`memory/agents/planner/`**: `decisions.md` holds user-facing answers that guide future\n planning and `redesign.md` design mistakes to avoid, both written by the memory review (`akb\n guide review-memory`); `rejected.md` holds what the user turned down and why, written only\n by the rejection and dismissal review (`akb guide review-rejections`). Other flows only read\n them, `akb raw memory prune` aside.\n- **`memory/<name>/`**: a global memory, kept by every agent listing it under `akb.memory`\n by the rules each run is given. Only the user changes its `MEMORY.md`, from the board UI.\n- **`memory/agents/<agent>/`**: an agent keeps only the files and split paths its own AGENT.md\n declares, plus the `redesign.md` the memory review writes there. An agent whose instructions\n name none keeps none.\n\nFile a planning note about one module in that module's folder,\n`memory/agents/planner/<module>/`, under the same file name, creating it if missing. A note\nspanning modules, or from a card with none, stays in `memory/agents/planner/`.\n\n### What earns a note\n\nOnly what changes a future planning choice. Writing nothing is a complete outcome.\n\n- **Honor an opt-out**: told not to record, write no memory and finish the requested action.\n- **A conversation writes none**: a card chat, a discussion, a feedback conversation, and\n any flow started in it write no memory and say nothing about it.\n- **Require lasting value**: a durable preference, constraint, decision, or lesson.\n- **Skip housekeeping**: duplicates, routine status changes, and facts recorded elsewhere.\n A rejected duplicate is not a rejected feature.\n- **Merge, don't repeat**: rewrite an equivalent entry in place.\n\n`readme.md` is not planning memory.\n";
22933
22970
  }
22934
22971
  });
22935
22972
 
@@ -22937,15 +22974,15 @@ var init_board3 = __esm({
22937
22974
  var card_chat_default;
22938
22975
  var init_card_chat = __esm({
22939
22976
  "src/guide/card-chat.md"() {
22940
- card_chat_default = '# Answer a card\'s conversation\n\nWork on the current card and its assets by default. Project implementation requires approval on the review page.\n\n- **Where the task stands**: read it with `akb task show <id>`.\n- **Button labels**: name actions by their labels on the page, in the user\'s language: "Approve" or "Approve, start \u2026" (\u6279\u51C6 / \u6279\u51C6\uFF0C\u5F00\u59CB\u2026), "Resume" (\u7EED\u8DD1), "Start again" (\u91CD\u65B0\u53D1\u8D77).\n\n- **Change requirements or drafts**: when the user changes the scope, expected behavior, or draft, use `akb raw card revise <id> --print "<change>"`.\n- **Record an answer**: when the user answers an open question on the card, use `akb raw card resolve <id> --print`.\n- **Manage open questions**: when a decision needs the user\'s input, follow `akb guide update-questions` and use `akb raw update-questions <id>` to edit the question list.\n- **Change card fields**: when the user changes metadata such as priority, modules, or dependencies, use `akb raw update <id>`.\n- **Choose a preview agent**: when a preview is needed and the agent is unclear, use `akb raw previews --triggers` to match the work to an agent.\n- **Create or revise a preview**: when the user asks to see or change a preview for the current card, use `akb raw previews <agent> <id> --print`; never write embed tags by hand.\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 workflow**: when the user asks to change a workflow or one of its agents, follow `akb guide update-workflow`.\n- **Check card edits**: after writing a card, run `akb raw validate <id>` and fix what it reports.\n- **Anything else**: for a request this guide does not cover, read `akb help` once, then the matching command\'s `--help`.\n\nReply in plain, natural language. Do not write memory, including through any flow this conversation starts.\n';
22977
+ card_chat_default = '# Answer a card\'s conversation\n\nWork on the current card and its assets by default. Project implementation requires approval on the review page.\n\n- **Where the task stands**: read it with `akb task show <id>`.\n- **Button labels**: name actions by their labels on the page, in the user\'s language: "Approve" or "Approve, start \u2026" (\u6279\u51C6 / \u6279\u51C6\uFF0C\u5F00\u59CB\u2026), "Resume" (\u7EED\u8DD1), "Start again" (\u91CD\u65B0\u53D1\u8D77).\n\n- **Change requirements or drafts**: when the user changes the scope, expected behavior, or draft, use `akb raw card revise <id> --print "<change>"`.\n- **Record an answer**: when the user answers an open question on the card, use `akb raw card resolve <id> --print`.\n- **Manage open questions**: when a decision needs the user\'s input, follow `akb guide update-questions` and use `akb raw update-questions <id>` to edit the question list.\n- **Change card fields**: when the user changes metadata such as priority, modules, or dependencies, use `akb raw update <id>`.\n- **Choose a preview agent**: when a preview is needed and the agent is unclear, use `akb raw previews --triggers` to match the work to an agent.\n- **Create or revise a preview**: when the user asks to see or change a preview for the current card, use `akb raw previews <agent> <id> --print`; never write embed tags by hand.\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**: when the user asks to change a studio or one of its agents, follow `akb guide update-studio`.\n- **Check card edits**: after writing a card, run `akb raw validate <id>` and fix what it reports.\n- **Anything else**: for a request this guide does not cover, read `akb help` once, then the matching command\'s `--help`.\n\nReply in plain, natural language. Do not write memory, including through any flow this conversation starts.\n';
22941
22978
  }
22942
22979
  });
22943
22980
 
22944
- // src/guide/update-workflow.md
22945
- var update_workflow_default;
22946
- var init_update_workflow = __esm({
22947
- "src/guide/update-workflow.md"() {
22948
- update_workflow_default = "# Update a workflow\n\nChange one of this workspace's workflows so new tasks run the new version.\n\n## How a workflow works\n\nA workflow is steerable: agents do the work, and a person reviews and fine-tunes only the parts where precision matters most, so the result stays reliable.\n\n- **Previews**: usually one preview agent shows the first draft; add another only when a part needs precision and a mistake there is costly, such as a developer tool's screens. Each shows only what the person decides on, without overlapping another. With none, the card the `WORKFLOW.md` body writes is the only review.\n- **Unreviewable previews**: when the user finds a preview unneeded or cannot judge it, remove it; a land agent checks that part instead, or nobody does.\n- **Stages**: one stage by default. Add `after` only when a draft is too costly to make before another is approved, such as a video's storyboard, which waits for its script.\n- **Minimal**: when the user outlines the workflow, keep it that simple or simpler; add no review point or constraint they did not ask for, and let the trial show what else needs review.\n- **Judgment**: leave to an agent what it can judge; never add a hard rule for one case, and keep a rule only once real runs show it holds widely.\n- **Memory**: give an agent memory only where it has wide latitude and tends to err or be corrected to taste, naming those error-prone points as what it records; give a narrow agent none.\n- **Land**: everything else runs unattended after the last approval and follows the approved drafts, such as building and merging a change; leave `land` empty when the last approved preview is the deliverable.\n- **Scheduled**: repeating work runs as a scheduled agent without previews; a workflow may hold only scheduled agents.\n- **`WORKFLOW.md`**: list its agents under `previews`, `land` and `scheduled`; `description` says in one sentence what it does; `when` tells an agent which requests it is for, exceptions included; the body is how a card of this kind is written.\n- **Agents**: write each as `akb guide write-agent` says.\n\n## Versions\n\n- **Pinned**: a workflow and the agents it holds live in Cloud as numbered versions; a task\n keeps the version it started with, and only tasks started after a push take the new one.\n- **Project agents**: agents under the board's `agents/` folder are the project's own; a\n workflow may name them, but they are not part of its versions and an edit there applies to\n every card at once.\n- **Own workflows only**: only the workspace's own workflows take a new version; ask the user to\n copy a built-in or marketplace one on the web first.\n\n## Change it\n\n- **Standing preference**: when the user only wants a lasting rule for a workflow or one of its\n agents and the flow itself stays, set it with `akb workflow rule <workflow>` or\n `akb workflow instructions <agent>` instead of pushing; it reaches every task's later runs and\n works on built-in workflows too. Either replaces all of them, so run it bare first to read the\n current ones, and keep each unless the user asks to change or drop it.\n- **Direct or task**: push directly a change the user spelled out; start a Workflow builder task\n instead when the change adds, removes or restages agents, or when the user wants to see it\n work before it applies.\n- **Steps**: `akb workflow pull <id> <folder>`, edit the files there and keep what the request\n leaves alone, fix every problem `akb raw workflow validate <folder>` reports, then\n `akb workflow push <folder>`.\n- **Moved on**: when push says Cloud has a newer version, pull again and redo the change.\n";
22981
+ // src/guide/update-studio.md
22982
+ var update_studio_default;
22983
+ var init_update_studio = __esm({
22984
+ "src/guide/update-studio.md"() {
22985
+ update_studio_default = "# Update a studio\n\nChange one of this workspace's studios so new tasks run the new version.\n\n## How a studio works\n\nA studio is steerable: agents do the work, and a person reviews and fine-tunes only the parts where precision matters most, so the result stays reliable.\n\n- **Previews**: usually one preview agent shows the work, finished or a draft, where the person can fine-tune it; add another only when a part needs precision and a mistake there is costly, such as a developer tool's screens. Each shows only what the person decides on, without overlapping another. With none, the card the `STUDIO.md` body writes is the only review.\n- **Unreviewable previews**: when the user finds a preview unneeded or cannot judge it, remove it; a land agent checks that part instead, or nobody does.\n- **Stages**: one stage by default. Add `after` only when a draft is too costly to make before another is approved, such as a video's storyboard, which waits for its script.\n- **Minimal**: when the user outlines the studio, keep it that simple or simpler; add no review point or constraint they did not ask for, and let the trial show what else needs review.\n- **Judgment**: leave to an agent what it can judge; never add a hard rule for one case, and keep a rule only once real runs show it holds widely.\n- **Memory**: give an agent memory only where it has wide latitude and tends to err or be corrected to taste, naming those error-prone points as what it records; give a narrow agent none.\n- **Land**: everything else runs unattended after the last approval and follows the approved previews, such as building and merging a change; leave `land` empty when the last approved preview is the deliverable.\n- **Scheduled**: repeating work runs as a scheduled agent without previews; a studio may hold only scheduled agents.\n- **Agents**: write each as `akb guide write-agent` says.\n\n## The folder\n\n`akb studio pull` writes a studio as this folder:\n\n```text\n<folder>/\n\u251C\u2500\u2500 STUDIO.md frontmatter: `description`, what it does in one sentence; `when`, which requests\n\u2502 it is for, exceptions included; its agents under `previews`, `land`, `scheduled`\n\u2502 body: how a card of this kind is written; every planning run on its cards reads it\n\u251C\u2500\u2500 agents/<name>/\n\u2502 \u251C\u2500\u2500 AGENT.md one agent: what its preview shows, or what its land or scheduled run does\n\u2502 \u2514\u2500\u2500 \u2026 files its AGENT.md points to\n\u2514\u2500\u2500 version.json the version pulled; push reads it, never edit it\n```\n\n## Versions\n\n- **Pinned**: a studio and the agents it holds live in Cloud as numbered versions; a task\n keeps the version it started with, and only tasks started after a push take the new one.\n- **Project agents**: agents under the board's `agents/` folder are the project's own; a\n studio may name them, but they are not part of its versions and an edit there applies to\n every card at once.\n- **Own studios only**: only the workspace's own studios take a new version; ask the user to\n copy a built-in or marketplace one on the web first.\n\n## Change it\n\n- **Standing preference**: when the user only wants a lasting rule for a studio or one of its\n agents and the flow itself stays, set it with `akb studio rule <studio>` or\n `akb studio instructions <agent>` instead of pushing; it reaches every task's later runs and\n works on built-in studios too. Either replaces all of them, so run it bare first to read the\n current ones, and keep each unless the user asks to change or drop it.\n- **Direct or task**: push directly a change the user spelled out; start a Studio builder task\n instead when the change adds, removes or restages agents, or when the user wants to review\n it before it applies.\n- **Steps**: `akb studio pull <id> <folder>`, edit the files there and keep what the request\n leaves alone, fix every problem `akb raw studio validate <folder>` reports, then\n `akb studio push <folder>`.\n- **Moved on**: when push says Cloud has a newer version, pull again and redo the change.\n";
22949
22986
  }
22950
22987
  });
22951
22988
 
@@ -22961,7 +22998,7 @@ var init_describe_project = __esm({
22961
22998
  var discuss_goal_default;
22962
22999
  var init_discuss_goal = __esm({
22963
23000
  "src/guide/discuss-goal.md"() {
22964
- discuss_goal_default = '# Discuss a goal\n\nThis flow only helps the user settle goals; refining, previewing, and running them come later.\n\n- **Remote user**: the user works remotely and sees only tasks and their previews, never local files.\n- **Software failures**: read `akb guide troubleshoot` when root cause analysis is needed.\n\n## Goals\n\n- **Missing information**: ask the user for information needed to form a goal.\n- **Save**: once a goal is clear, save or update it with `akb goal` (see `akb goal --help`), then stop; an existing build continues in its current session.\n- **Goal format**: each goal has a title, an outcome of at most 150 words, and a `## Done when` list of verifiable acceptance criteria, without technical design.\n- **Independent deliverables**: save separate deliverables as separate goals; remove a replaced goal with `akb goal drop --id <goal>`.\n- **Workflow**: pick the workflow from `akb workflow list` that fits the actual work; prefer the user\u2019s choice.\n- **Review points**: save through `--previews` the agents from `akb raw previews --triggers --workflow <id>` whose conditions the goal meets, always including those marked `Always`, or an empty list.\n- **Use judgment**: settle outcome decisions you can and explain them; ask only for decisions the user must make that change the result, with a recommendation.\n- **Plain words**: answer directly using everyday words.\n- **Hide machinery**: omit plans, files, paths, commands, tools, and connectors from replies; refer to actions by their button labels.\n- **Starting a goal**: "Start now" (\u7ACB\u5373\u5F00\u59CB) begins the work directly; "Refine goal" (\u7EC6\u5316\u76EE\u6807) appears only when the goal has review points, and shows their previews for approval first.\n- **Anything else**: for a request this guide does not cover, read `akb help` once, then the matching command\'s `--help`.\n';
23001
+ discuss_goal_default = '# Discuss a goal\n\nThis flow only helps the user settle goals; refining, previewing, and running them come later.\n\n- **Remote user**: the user works remotely and sees only tasks and their previews, never local files.\n- **Software failures**: read `akb guide troubleshoot` when root cause analysis is needed.\n\n## Goals\n\n- **Missing information**: ask the user for information needed to form a goal.\n- **Save**: once a goal is clear, save or update it with `akb goal` (see `akb goal --help`), then stop; an existing build continues in its current session.\n- **Goal format**: each goal has a title, an outcome of at most 150 words, and a `## Done when` list of verifiable acceptance criteria, without technical design.\n- **Independent deliverables**: save separate deliverables as separate goals; remove a replaced goal with `akb goal drop --id <goal>`.\n- **Studio**: pick the studio from `akb studio list` that fits the actual work; prefer the user\u2019s choice.\n- **Review points**: save through `--previews` the agents from `akb raw previews --triggers --studio <id>` whose conditions the goal meets, always including those marked `Always`, or an empty list.\n- **Use judgment**: settle outcome decisions you can and explain them; ask only for decisions the user must make that change the result, with a recommendation.\n- **Plain words**: answer directly using everyday words.\n- **Hide machinery**: omit plans, files, paths, commands, tools, and connectors from replies; refer to actions by their button labels.\n- **Starting a goal**: "Start now" (\u7ACB\u5373\u5F00\u59CB) begins the work directly; "Refine goal" (\u7EC6\u5316\u76EE\u6807) appears only when the goal has review points, and shows their previews for approval first.\n- **Anything else**: for a request this guide does not cover, read `akb help` once, then the matching command\'s `--help`.\n';
22965
23002
  }
22966
23003
  });
22967
23004
 
@@ -22969,7 +23006,7 @@ var init_discuss_goal = __esm({
22969
23006
  var follow_up_default;
22970
23007
  var init_follow_up = __esm({
22971
23008
  "src/guide/follow-up.md"() {
22972
- follow_up_default = '# Handle follow-up work\n\nUse when planning or implementation discovers additional work.\n\n- **Current task**: finish required work on this card; queue independent follow-ups in triage, then resume the original task.\n- **Drop what was turned down**: queue nothing that\n `docs/kanban/memory/agents/planner/rejected.md` or\n `docs/kanban/memory/agents/planner/*/rejected.md` turns down.\n- **Existing card**: when only another open card needs changing, run `akb raw card revise <id> "<the change and why>"`.\n- **Queue it**: use the command below; skip an item the command reports as already there.\n- **Workflow**: use the source card\'s `workflow:`, or the id from `akb workflow list` that fits the work when it has none.\n\n```text\nakb raw triage add --title "<one line>" --slug <short-english-slug> --source "#<id>" --workflow <workflow> --text "<body>"\n```\n\n## Write the item\n\nWrite each item\'s title and body in the **Goal format** of `akb guide discuss-goal`.\n';
23009
+ follow_up_default = '# Handle follow-up work\n\nUse when planning or implementation discovers additional work.\n\n- **Current task**: finish required work on this card; queue independent follow-ups in triage, then resume the original task.\n- **Drop what was turned down**: queue nothing that\n `docs/kanban/memory/agents/planner/rejected.md` or\n `docs/kanban/memory/agents/planner/*/rejected.md` turns down.\n- **Existing card**: when only another open card needs changing, run `akb raw card revise <id> "<the change and why>"`.\n- **Queue it**: use the command below; skip an item the command reports as already there.\n- **Studio**: use the source card\'s `studio:`, or the id from `akb studio list` that fits the work when it has none.\n\n```text\nakb raw triage add --title "<one line>" --slug <short-english-slug> --source "#<id>" --studio <studio> --text "<body>"\n```\n\n## Write the item\n\nWrite each item\'s title and body in the **Goal format** of `akb guide discuss-goal`.\n';
22973
23010
  }
22974
23011
  });
22975
23012
 
@@ -23017,7 +23054,7 @@ var init_review_rejections = __esm({
23017
23054
  var refine_default;
23018
23055
  var init_refine = __esm({
23019
23056
  "src/guide/refine.md"() {
23020
- refine_default = '# Refine a card\n\nPlan one card in this session until it can be built.\n\n- **\u91CD\u590D\u5361\u7247**: \u82E5\u53D1\u73B0\u53E6\u4E00\u5F20\u4EFB\u52A1\u5B8C\u6574\u8986\u76D6\u672C\u5361\uFF0C\u5373\u4F7F\u5BF9\u65B9\u5C1A\u672A\u5B9E\u65BD\uFF0C\u4E5F\u5148\u5C06\u5176\u7F3A\u5C11\u7684\u6709\u7528\u4FE1\u606F\u8865\u5165\u5E76\u786E\u8BA4\u4FDD\u5B58\u6210\u529F\uFF1B\n \u4FDD\u5B58\u5931\u8D25\u5219\u4FDD\u7559\u672C\u5361\u5E76\u505C\u6B62\u3002\u6CA1\u6709\u4FE1\u606F\u9700\u8981\u8865\u5145\u6216\u5DF2\u4FDD\u5B58\u6210\u529F\u540E\uFF0C\u8FD0\u884C\n `akb raw reject <id> --reason "<\u627F\u63A5\u4EFB\u52A1\u7F16\u53F7\u53CA\u5B8C\u6574\u8986\u76D6\u539F\u56E0>"` \u5E76\u505C\u6B62\u3002\n \u4E0D\u8BF7\u6C42\u786E\u8BA4\uFF0C\u4E0D\u8FD0\u884C\u9884\u89C8\uFF1B\u4EC5\u90E8\u5206\u91CD\u53E0\u4E0D\u4E22\u5F03\u3002\n- **Unchecked card**: a card with `triage:` set and an empty `## Scope` was never checked\n against the project. Check it first; when the project already does\n the work, or what it concerns no longer exists, run\n `akb raw reject <id> --reason "<what shows it>"` and stop.\n- **Gone or already done**: for any other card, append a question asking the user whether to\n discard it, run no preview agent, and stop.\n- **Workflow rules**: write the card as the workflow rules at the end of this prompt say.\n- **Preview agents**: an agent\'s `After` names the previews it waits for; the board approves\n previews in stages, one stage per Approve, and the card\'s `previews` were chosen when its\n goal was written. A card without `previews` has not chosen: choose and save them first, as\n the list says, then run only its first stage. Run each agent the list above names whose\n section is missing or outdated with `akb raw previews <agent> <id> --print`, one at a time in this\n session; leave out `--print` only for an agent the list says runs in a session of its own.\n- **Stale mentions**: rewrite any sentence that relies on a card no longer on the board.\n- **Questions**: settle every decision you can and record the answers as `akb guide writing`\n says; ask only what `akb guide update-questions` says to ask.\n- **Write**: shape the card as `akb guide writing` says, then run `akb raw validate <id>` and\n fix every reported line.\n- **Ready**: settle every fact from the project and authoritative sources. Once the card\n validates, judge whether it can be built as written, or before its last Approve: if so, run\n `akb raw update <id> --status ready`; otherwise leave what blocks it as an open question.\n\nFollow any closing steps the flow printed, then stop: the user approves the previews or starts\nthe build.\n';
23057
+ refine_default = '# Refine a card\n\nPlan one card in this session until it can be built.\n\n- **\u91CD\u590D\u5361\u7247**: \u82E5\u53D1\u73B0\u53E6\u4E00\u5F20\u4EFB\u52A1\u5B8C\u6574\u8986\u76D6\u672C\u5361\uFF0C\u5373\u4F7F\u5BF9\u65B9\u5C1A\u672A\u5B9E\u65BD\uFF0C\u4E5F\u5148\u5C06\u5176\u7F3A\u5C11\u7684\u6709\u7528\u4FE1\u606F\u8865\u5165\u5E76\u786E\u8BA4\u4FDD\u5B58\u6210\u529F\uFF1B\n \u4FDD\u5B58\u5931\u8D25\u5219\u4FDD\u7559\u672C\u5361\u5E76\u505C\u6B62\u3002\u6CA1\u6709\u4FE1\u606F\u9700\u8981\u8865\u5145\u6216\u5DF2\u4FDD\u5B58\u6210\u529F\u540E\uFF0C\u8FD0\u884C\n `akb raw reject <id> --reason "<\u627F\u63A5\u4EFB\u52A1\u7F16\u53F7\u53CA\u5B8C\u6574\u8986\u76D6\u539F\u56E0>"` \u5E76\u505C\u6B62\u3002\n \u4E0D\u8BF7\u6C42\u786E\u8BA4\uFF0C\u4E0D\u8FD0\u884C\u9884\u89C8\uFF1B\u4EC5\u90E8\u5206\u91CD\u53E0\u4E0D\u4E22\u5F03\u3002\n- **Unchecked card**: a card with `triage:` set and an empty `## Scope` was never checked\n against the project. Check it first; when the project already does\n the work, or what it concerns no longer exists, run\n `akb raw reject <id> --reason "<what shows it>"` and stop.\n- **Gone or already done**: for any other card, append a question asking the user whether to\n discard it, run no preview agent, and stop.\n- **Studio rules**: write the card as the studio rules at the end of this prompt say.\n- **Preview agents**: an agent\'s `After` names the previews it waits for; the board approves\n previews in stages, one stage per Approve, and the card\'s `previews` were chosen when its\n goal was written. A card without `previews` has not chosen: choose and save them first, as\n the list says, then run only its first stage. Run each agent the list above names whose\n section is missing or outdated with `akb raw previews <agent> <id> --print`, one at a time in this\n session; leave out `--print` only for an agent the list says runs in a session of its own.\n- **Stale mentions**: rewrite any sentence that relies on a card no longer on the board.\n- **Questions**: settle every decision you can and record the answers as `akb guide writing`\n says; ask only what `akb guide update-questions` says to ask.\n- **Write**: shape the card as `akb guide writing` says, then run `akb raw validate <id>` and\n fix every reported line.\n- **Ready**: settle every fact from the project and authoritative sources. Once the card\n validates, judge whether it can be built as written, or before its last Approve: if so, run\n `akb raw update <id> --status ready`; otherwise leave what blocks it as an open question.\n\nFollow any closing steps the flow printed, then stop: the user approves the previews or starts\nthe build.\n';
23021
23058
  }
23022
23059
  });
23023
23060
 
@@ -23025,7 +23062,7 @@ var init_refine = __esm({
23025
23062
  var reflect_default;
23026
23063
  var init_reflect = __esm({
23027
23064
  "src/guide/reflect.md"() {
23028
- reflect_default = '# Reflect on completed cards\n\n## Read\n\nRead each given `<card>` in full and check its own `shipped` content; keep cards separate.\nFind needs the work left behind or revealed, and verify them in the project. Proposing nothing is fine.\n\n## Filter\n\n- **Duplicates**: check `akb raw list` and `akb raw triage check <source-id>`; propose shared work only once.\n- **Exclude**: skip unsupported guesses, work covered by `<scheduled-agents>`, work rejected in `docs/kanban/memory/agents/planner/rejected.md` or its module folders, and calls the user reversed, in any `redesign.md` under `docs/kanban/memory/agents/` or under a card\'s `Overruled by the user`.\n- **Existing cards**: when shipped work invalidates an open card\'s plan, run `akb raw card revise <id> "<the change and why>"` instead of proposing an item.\n\n## Write\n\nWrite each item\'s title and body in the **Goal format** of `akb guide discuss-goal`; write the body to a temporary Markdown file and end it with the source card\'s archive path.\nWrite one triage item per proposal. Exploratory ideas are welcome; identify small chores as such.\nUse the source card\'s `workflow:`, or the id from `akb workflow list` that fits the work when it has none.\n\n```text\nakb raw triage add --title "<one line>" --slug <short-english-slug> --source "#<id>" --workflow <workflow> --file <body.md>\n```\n\nBriefly report what you proposed and what you skipped, with reasons.\n';
23065
+ reflect_default = '# Reflect on completed cards\n\n## Read\n\nRead each given `<card>` in full and check its own `shipped` content; keep cards separate.\nFind needs the work left behind or revealed, and verify them in the project. Proposing nothing is fine.\n\n## Filter\n\n- **Duplicates**: check `akb raw list` and `akb raw triage check <source-id>`; propose shared work only once.\n- **Exclude**: skip unsupported guesses, work covered by `<scheduled-agents>`, work rejected in `docs/kanban/memory/agents/planner/rejected.md` or its module folders, and calls the user reversed, in any `redesign.md` under `docs/kanban/memory/agents/` or under a card\'s `Overruled by the user`.\n- **Existing cards**: when shipped work invalidates an open card\'s plan, run `akb raw card revise <id> "<the change and why>"` instead of proposing an item.\n\n## Write\n\nWrite each item\'s title and body in the **Goal format** of `akb guide discuss-goal`; write the body to a temporary Markdown file and end it with the source card\'s archive path.\nWrite one triage item per proposal. Exploratory ideas are welcome; identify small chores as such.\nUse the source card\'s `studio:`, or the id from `akb studio list` that fits the work when it has none.\n\n```text\nakb raw triage add --title "<one line>" --slug <short-english-slug> --source "#<id>" --studio <studio> --file <body.md>\n```\n\nBriefly report what you proposed and what you skipped, with reasons.\n';
23029
23066
  }
23030
23067
  });
23031
23068
 
@@ -23057,7 +23094,7 @@ var init_preview_agent = __esm({
23057
23094
  var update_questions_default;
23058
23095
  var init_update_questions = __esm({
23059
23096
  "src/guide/update-questions.md"() {
23060
- update_questions_default = '# Decide what to ask the user\n\nA decision is a choice the work needs made. A question is a decision handed to the user:\nproject evidence cannot settle it, it materially affects what the user gets, and it has at\nleast two coherent options.\n\n### The material-decision test\n\nAsk when the tradeoff materially changes the delivered result, the accepted scope, the user\'s\nrisk, or a meaningful ongoing cost, and a reasonable reviewer may reject it; a workflow\'s rules\nadd what else counts. Settle everything else yourself. Leave the question open and stop only\nthe work that depends on it. An obstacle only the user can clear is a question too: say what\ncannot proceed and offer ways forward.\n\n- **Write for users**: each option\'s outcome and main cost, your recommendation ticked; no\n card ids, agent names, or board jargon.\n- **Options**: exclusive unless they genuinely combine (`--mode multi`); never write an\n "other" option, the user always gets one.\n- **Not a question**: where a fix goes (`akb guide follow-up`).\n\n```text\nakb raw update-questions <id> \\\n --append "Which behavior should apply?" \\\n --recommended-option "A \u2014 outcome and cost" \\\n --option "B \u2014 outcome and cost"\n```\n';
23097
+ update_questions_default = '# Decide what to ask the user\n\nA decision is a choice the work needs made. A question is a decision handed to the user:\nproject evidence cannot settle it, it materially affects what the user gets, and it has at\nleast two coherent options.\n\n### The material-decision test\n\nAsk when the tradeoff materially changes the delivered result, the accepted scope, the user\'s\nrisk, or a meaningful ongoing cost, and a reasonable reviewer may reject it; a studio\'s rules\nadd what else counts. Settle everything else yourself. Leave the question open and stop only\nthe work that depends on it. An obstacle only the user can clear is a question too: say what\ncannot proceed and offer ways forward.\n\n- **Write for users**: each option\'s outcome and main cost, your recommendation ticked; no\n card ids, agent names, or board jargon.\n- **Options**: exclusive unless they genuinely combine (`--mode multi`); never write an\n "other" option, the user always gets one.\n- **Not a question**: where a fix goes (`akb guide follow-up`).\n\n```text\nakb raw update-questions <id> \\\n --append "Which behavior should apply?" \\\n --recommended-option "A \u2014 outcome and cost" \\\n --option "B \u2014 outcome and cost"\n```\n';
23061
23098
  }
23062
23099
  });
23063
23100
 
@@ -23073,7 +23110,15 @@ var init_troubleshoot = __esm({
23073
23110
  var write_agent_default;
23074
23111
  var init_write_agent = __esm({
23075
23112
  "src/guide/write-agent.md"() {
23076
- write_agent_default = "# Write an agent\n\nAn agent is one folder: `docs/kanban/agents/<name>/AGENT.md`. The folder name is the agent's\nname and the word every flow asks for it by \u2014 lower-case words joined by `-`, matching the\n`name` in its frontmatter. It cannot be a name the board already answers to: one of the\nboard's roles, an agent the command ships, or a folder already in `docs/kanban/agents/`.\n\n## The file\n\n```yaml\n---\n# Required; matches the folder name.\nname: ux-writer\n# Required: one sentence saying what it does.\ndescription: Writes the words a screen shows.\n# Optional.\nakb:\n # Optional, for a preview agent: when to request it, exceptions included. Without it, it\n # always runs.\n when: A card changes what the product says to the user; not a typo.\n # Optional, for a preview agent: it runs only after these agents' previews are approved,\n # when the card requests them too; it never makes them run.\n after: [ui-designer]\n # Optional, for a preview agent: `new` runs it in a session of its own.\n session: new\n # Preview components this agent uses; an empty list loads no component documentation.\n components: [Asset]\n # Optional: a sticker of its deliverable, by glyph name (the Workflow builder lists them),\n # or 1 to 12 parts `{ d, f?, o?: true, s?, w? }`. Without it, a generic file is drawn.\n icon: text\n---\n\nYou write the words a screen shows.\n```\n\nIts workflow, not the agent, sets its role: `WORKFLOW.md` lists it under `previews`, `land`\nor `scheduled`.\n\nA scheduled agent can also name the new input it works on; it then runs only when there is some:\n\n```yaml\nakb:\n # archived-cards | chats | dismissals; omit to run on its cadence alone.\n reads: archived-cards\n```\n\nA land agent that merges code into the target branch declares it; completing its step then\nrequires the merged commit and branch:\n\n```yaml\nakb:\n merges: true\n```\n\nAn agent that shares material with others names the global memories it keeps:\n\n```yaml\nakb:\n # Optional; global memories under `docs/kanban/memory/<name>/`, by name.\n memory: [competitors]\n # Optional; its own memory files, or folders ending in `/`, that hold in any of the user's\n # projects. Everything else is this project's.\n memoryFiles:\n workspace: [style.md]\n```\n\nEverything under the frontmatter is the agent's instructions, read fresh on every run \u2014\na file with none is refused.\n\nAn agent declares no options of its own. Two ways of working is two agents, each with its own\n`AGENT.md` \u2014 a switch that changes how one agent works costs more than it buys.\n\n## Translations\n\n```yaml\nakb:\n # Optional; UI text only. Runs use English; omitted text falls back to English.\n i18n:\n # Language tag; every field below is optional.\n en:\n # Display name, shown as the stage name: name the output, not the role; at most\n # 3 English words or 4 Chinese characters. Does not change the agent's name.\n title: UI copy\n zh:\n title: \u754C\u9762\u6587\u6848\n description: \u64B0\u5199\u754C\u9762\u4E0A\u7684\u6587\u5B57\u3002\n when: \u5361\u7247\u65B0\u589E\u6216\u4FEE\u6539\u754C\u9762\u6587\u5B57\u65F6\u3002\n```\n\n## Files\n\nEvery file beside `AGENT.md`, in any subfolder, is named to the run by its path and opened only\nwhen the work calls for it. Put long material there and keep `AGENT.md` short.\n\n- **Scripts**: every agent owns its task scripts in its own folder, including built-in agents.\n Keep business validation there, outside the CLI's board logic. Document the runtime, inputs\n and invocation beside the script; consumers use the owner's script. Built-in files can be\n saved through `akb raw agent-file <agent> <path>` and run locally with their relative layout\n intact; custom agents use their existing folders.\n\n## Imported skills\n\nAn agent may carry several skills, each whole in its own `skills/<skill>/` folder.\n\n- **Keep the capability**: copy the skill's instructions, scripts, resources and license\n unchanged; never reduce it to rewritten instructions. Leave out installed packages and caches,\n and name any file it refers to that you could not get.\n- **Record the source**: list each in a `## Skills` section of `AGENT.md` as\n `- **<skill>**: <when to use it>. Source: <URL or pasted> @ <commit, tag or snapshot date>`.\n- **Adapt outside it**: say in `AGENT.md` when to use each skill and how its result becomes\n this agent's output; paths inside a skill resolve from its folder. Keep the skill folder\n untouched so an update can replace it whole.\n- **Runtime needs**: check every command, package and credential the skill needs on this\n machine. Name what is missing under its bullet and tell the user; never call the agent usable\n while anything is missing, and never copy a key into the folder.\n- **Update and remove**: update only when the user asks \u2014 replace the folder, show the diff and\n change the version. Remove a skill with its folder and bullet. Each agent owns its copies, so\n no change reaches another agent.\n\n## Memory\n\n`docs/kanban/memory/agents/<name>/` is read into every run. Keep none unless the agent has wide\nlatitude and its mistakes or the user's corrections should change its next output. Otherwise say\nin `AGENT.md`:\n\n- **Files**: each file and what it holds; `## General` for what always holds, and a heading per\n situation (a format, a recipe, a channel) for what holds only there.\n- **When**: which file to apply before which step, and which error-prone points, answers or\n corrections to record.\n- **What goes in**: lasting preferences, decisions and corrections only \u2014 never raw feedback,\n run history, or what the instructions already say.\n- **Shared material**: what other agents also use goes in a global memory under `akb.memory`;\n its rules arrive with every run, so `AGENT.md` never restates them.\n\n## Output\n\nDeclare the preview components the agent uses in `akb.components` (Asset, Compare, Storyboard, Set).\nTheir usage documentation is supplied with the run; omitted declarations default to Asset.\nUse `akb raw components --agent <name> --docs` or `--workflow <id> --docs` to read it.\n\nChoose the form the reader takes in fastest and say it in `AGENT.md`: an image for a look, a\nstoryboard for a sequence over time, readable Markdown for everything else.\n\n## Dependencies\n\n- **In `after`**: name the agents whose approved previews this one needs; it waits for those\n approvals and never requests the agents.\n- **In the instructions**: say what to do when the section it needs is missing or still\n carries an open question \u2014 normally draw nothing and write one line naming what is missing.\n A preview agent never asks for another.\n\n## Instructions\n\nSay what the agent owns, what it produces, and what it leaves alone. Don't repeat the contract\nevery run is pointed to (`akb guide preview-agent`): where the section goes, how to validate,\nhow to keep memory, and how to defer to the user. A scheduled agent says what one run does,\nnever when it runs.\n\n## Work with the user\n\n- **Ask little**: settle what the request, the skill and the board already answer; ask the rest\n as `akb guide update-questions` does, and never ask again what is answered.\n- **State between runs**: ask how a scheduled agent should keep what its next run needs, and\n write the answer into `AGENT.md`; assume no file or format.\n- **Important choices**: give a recommendation and its tradeoff, and accept a free answer.\n- **Show each edit**: when changing an existing agent, show every changed file as a unified\n diff with context, followed by one sentence of reason.\n\n## Check it\n\n- **Validate before finishing**: after creating or editing an agent, run `akb raw previews`. Read all trigger conditions with `akb raw previews --triggers`.\n Fix every problem reported for its file under \"Problems on this board\", then run it again.\n Do not finish until the agent is accepted with no problems reported for it.\n- **`akb raw previews <name> <id> --print`** on a real card prints the whole prompt the agent will get:\n its instructions, the reference for each chosen setting, its files and its memory. Read it, and cut whatever the run does not need.\n- **Workflow**: a new agent belongs to the workflow it was created in and starts switched on;\n a preview agent joins the end of that workflow's `previews`. `akb raw previews` refuses it while it is off.\n Switch it in that workflow's `WORKFLOW.md`.\n- **Schedule**: set `reads` from what the agent works on; it runs automatically by default.\n For a fixed cadence, add `cadence: 1d` to its entry in the workflow's `scheduled`.\n";
23113
+ write_agent_default = "# Write an agent\n\nAn agent is one folder: `docs/kanban/agents/<name>/AGENT.md`. The folder name is the agent's\nname and the word every flow asks for it by \u2014 lower-case words joined by `-`, matching the\n`name` in its frontmatter. It cannot be a name the board already answers to: one of the\nboard's roles, an agent the command ships, or a folder already in `docs/kanban/agents/`.\n\n## The file\n\n```yaml\n---\n# Required; matches the folder name.\nname: ux-writer\n# Required: one sentence saying what it does.\ndescription: Writes the words a screen shows.\n# Optional.\nakb:\n # Optional, for a preview agent: when to request it, exceptions included. Without it, it\n # always runs.\n when: A card changes what the product says to the user; not a typo.\n # Optional, for a preview agent: it runs only after these agents' previews are approved,\n # when the card requests them too; it never makes them run.\n after: [ui-designer]\n # Optional, for a preview agent: `new` runs it in a session of its own.\n session: new\n # Preview components this agent uses; an empty list loads no component documentation.\n components: [Asset]\n # Optional: a sticker of its deliverable, by glyph name (the Studio builder lists them),\n # or 1 to 12 parts `{ d, f?, o?: true, s?, w? }`. Without it, a generic file is drawn.\n icon: text\n---\n\nYou write the words a screen shows.\n```\n\nIts studio, not the agent, sets its role: `STUDIO.md` lists it under `previews`, `land`\nor `scheduled`.\n\nA scheduled agent can also name the new input it works on; it then runs only when there is some:\n\n```yaml\nakb:\n # archived-cards | chats | dismissals; omit to run on its cadence alone.\n reads: archived-cards\n```\n\nA land agent that merges code into the target branch declares it; completing its step then\nrequires the merged commit and branch:\n\n```yaml\nakb:\n merges: true\n```\n\nAn agent that shares material with others names the global memories it keeps:\n\n```yaml\nakb:\n # Optional; global memories under `docs/kanban/memory/<name>/`, by name.\n memory: [competitors]\n # Optional; its own memory files, or folders ending in `/`, that hold in any of the user's\n # projects. Everything else is this project's.\n memoryFiles:\n workspace: [style.md]\n```\n\nEverything under the frontmatter is the agent's instructions, read fresh on every run \u2014\na file with none is refused.\n\nAn agent declares no options of its own. Two ways of working is two agents, each with its own\n`AGENT.md` \u2014 a switch that changes how one agent works costs more than it buys.\n\n## Translations\n\n```yaml\nakb:\n # Optional; UI text only. Runs use English; omitted text falls back to English.\n i18n:\n # Language tag; every field below is optional.\n en:\n # Display name, shown as the stage name: name the output, not the role; at most\n # 3 English words or 4 Chinese characters. Does not change the agent's name.\n title: UI copy\n zh:\n title: \u754C\u9762\u6587\u6848\n description: \u64B0\u5199\u754C\u9762\u4E0A\u7684\u6587\u5B57\u3002\n when: \u5361\u7247\u65B0\u589E\u6216\u4FEE\u6539\u754C\u9762\u6587\u5B57\u65F6\u3002\n```\n\n## Files\n\nEvery file beside `AGENT.md`, in any subfolder, is named to the run by its path and opened only\nwhen the work calls for it. Put long material there and keep `AGENT.md` short.\n\n- **Scripts**: every agent owns its task scripts in its own folder, including built-in agents.\n Keep business validation there, outside the CLI's board logic. Document the runtime, inputs\n and invocation beside the script; consumers use the owner's script. Built-in files can be\n saved through `akb raw agent-file <agent> <path>` and run locally with their relative layout\n intact; custom agents use their existing folders.\n\n## Imported skills\n\nAn agent may carry several skills, each whole in its own `skills/<skill>/` folder.\n\n- **Keep the capability**: copy the skill's instructions, scripts, resources and license\n unchanged; never reduce it to rewritten instructions. Leave out installed packages and caches,\n and name any file it refers to that you could not get.\n- **Record the source**: list each in a `## Skills` section of `AGENT.md` as\n `- **<skill>**: <when to use it>. Source: <URL or pasted> @ <commit, tag or snapshot date>`.\n- **Adapt outside it**: say in `AGENT.md` when to use each skill and how its result becomes\n this agent's output; paths inside a skill resolve from its folder. Keep the skill folder\n untouched so an update can replace it whole.\n- **Runtime needs**: check every command, package and credential the skill needs on this\n machine. Name what is missing under its bullet and tell the user; never call the agent usable\n while anything is missing, and never copy a key into the folder.\n- **Update and remove**: update only when the user asks \u2014 replace the folder, show the diff and\n change the version. Remove a skill with its folder and bullet. Each agent owns its copies, so\n no change reaches another agent.\n\n## Memory\n\n`docs/kanban/memory/agents/<name>/` is read into every run. Keep none unless the agent has wide\nlatitude and its mistakes or the user's corrections should change its next output. Otherwise say\nin `AGENT.md`:\n\n- **Files**: each file and what it holds; `## General` for what always holds, and a heading per\n situation (a format, a recipe, a channel) for what holds only there.\n- **When**: which file to apply before which step, and which error-prone points, answers or\n corrections to record.\n- **What goes in**: lasting preferences, decisions and corrections only \u2014 never raw feedback,\n run history, or what the instructions already say.\n- **Shared material**: what other agents also use goes in a global memory under `akb.memory`;\n its rules arrive with every run, so `AGENT.md` never restates them.\n\n## Output\n\nDeclare the preview components the agent uses in `akb.components` (Asset, Compare, Storyboard, Set).\nTheir usage documentation is supplied with the run; omitted declarations default to Asset.\nUse `akb raw components --agent <name> --docs` or `--studio <id> --docs` to read it.\n\nChoose the form the reader takes in fastest and say it in `AGENT.md`: an image for a look, a\nstoryboard for a sequence over time, readable Markdown for everything else.\n\n## Dependencies\n\n- **In `after`**: name the agents whose approved previews this one needs; it waits for those\n approvals and never requests the agents.\n- **In the instructions**: say what to do when the section it needs is missing or still\n carries an open question \u2014 normally draw nothing and write one line naming what is missing.\n A preview agent never asks for another.\n\n## Instructions\n\nSay what the agent owns, what it produces, and what it leaves alone. Don't repeat the contract\nevery run is pointed to (`akb guide preview-agent`): where the section goes, how to validate,\nhow to keep memory, and how to defer to the user. A scheduled agent says what one run does,\nnever when it runs. Write the text as `akb guide write-prompt` says.\n\n## Work with the user\n\n- **Ask little**: settle what the request, the skill and the board already answer; ask the rest\n as `akb guide update-questions` does, and never ask again what is answered.\n- **State between runs**: ask how a scheduled agent should keep what its next run needs, and\n write the answer into `AGENT.md`; assume no file or format.\n- **Important choices**: give a recommendation and its tradeoff, and accept a free answer.\n- **Show each edit**: when changing an existing agent, show every changed file as a unified\n diff with context, followed by one sentence of reason.\n\n## Check it\n\n- **Validate before finishing**: after creating or editing an agent, run `akb raw previews`. Read all trigger conditions with `akb raw previews --triggers`.\n Fix every problem reported for its file under \"Problems on this board\", then run it again.\n Do not finish until the agent is accepted with no problems reported for it.\n- **`akb raw previews <name> <id> --print`** on a real card prints the whole prompt the agent will get:\n its instructions, the reference for each chosen setting, its files and its memory. Read it, and cut whatever the run does not need.\n- **Studio**: a new agent belongs to the studio it was created in and starts switched on;\n a preview agent joins the end of that studio's `previews`. `akb raw previews` refuses it while it is off.\n Switch it in that studio's `STUDIO.md`.\n- **Schedule**: set `reads` from what the agent works on; it runs automatically by default.\n For a fixed cadence, add `cadence: 1d` to its entry in the studio's `scheduled`.\n";
23114
+ }
23115
+ });
23116
+
23117
+ // src/guide/write-prompt.md
23118
+ var write_prompt_default;
23119
+ var init_write_prompt = __esm({
23120
+ "src/guide/write-prompt.md"() {
23121
+ write_prompt_default = "# Write a prompt\n\nHow the text of any prompt reads: an agent, a skill, a guide, or a prompt embedded in code.\n\n- **Only a real gap**: change a prompt only where it lacks an instruction it needs; reuse\n instructions that remain sufficient, and trim what is there while you add.\n- **Natural language only**: never write code, pseudocode, or a programmatic wrapper,\n including code that builds, picks, or controls a prompt. State conditions, branches, and\n order as plain instructions.\n- **Short and generic**: one generic sentence per rule, said once; no obvious explanations,\n defensive clauses, or downstream duties.\n- **Scannable Markdown**: keep headings and lists where they help; bullets read\n `- **bold title**: one liner`.\n- **Professional and comprehensible**: plain, clear language.\n";
23077
23122
  }
23078
23123
  });
23079
23124
 
@@ -23087,7 +23132,7 @@ var init_writing = __esm({
23087
23132
 
23088
23133
  // src/lib/guide.ts
23089
23134
  function findGuide(name) {
23090
- const wanted = RENAMED[name] ?? name;
23135
+ const wanted = RENAMED2[name] ?? name;
23091
23136
  const guide = GUIDES.find((g) => g.name === wanted);
23092
23137
  return guide ? { ...guide, text: boardText(guide.text) } : null;
23093
23138
  }
@@ -23107,7 +23152,7 @@ function guideList(program2) {
23107
23152
  ];
23108
23153
  return boardText(out.join("\n"));
23109
23154
  }
23110
- var GUIDES, guideNames, RENAMED;
23155
+ var GUIDES, guideNames, RENAMED2;
23111
23156
  var init_guide = __esm({
23112
23157
  "src/lib/guide.ts"() {
23113
23158
  "use strict";
@@ -23115,7 +23160,7 @@ var init_guide = __esm({
23115
23160
  init_archive2();
23116
23161
  init_board3();
23117
23162
  init_card_chat();
23118
- init_update_workflow();
23163
+ init_update_studio();
23119
23164
  init_describe_project();
23120
23165
  init_discuss_goal();
23121
23166
  init_follow_up();
@@ -23132,6 +23177,7 @@ var init_guide = __esm({
23132
23177
  init_update_questions();
23133
23178
  init_troubleshoot();
23134
23179
  init_write_agent();
23180
+ init_write_prompt();
23135
23181
  init_writing();
23136
23182
  init_paths();
23137
23183
  GUIDES = [
@@ -23142,7 +23188,7 @@ var init_guide = __esm({
23142
23188
  { name: "discuss-goal", when: "help decide what is worth building, and shape it into goals to start as tasks", text: discuss_goal_default },
23143
23189
  { name: "troubleshoot", when: "\u5B9A\u4F4D\u8F6F\u4EF6\u6545\u969C\u7684\u6839\u56E0\u4E0E\u4FEE\u590D\u65B9\u5411", text: troubleshoot_default },
23144
23190
  { name: "card-chat", when: "answer a card's conversation, and act on what each turn settles", text: card_chat_default },
23145
- { name: "update-workflow", when: "change one of this workspace's workflows so new tasks run the new version", text: update_workflow_default },
23191
+ { name: "update-studio", when: "change one of this workspace's studios so new tasks run the new version", text: update_studio_default },
23146
23192
  { name: "implement", when: "build a settled card and stop cleanly on an execution blocker", text: implement_default },
23147
23193
  { name: "archive", when: "finish a task \u2014 write its shipped line, then take it off the board", text: archive_default },
23148
23194
  { name: "update-questions", when: "decide what to ask the user, and write the question", text: update_questions_default },
@@ -23156,10 +23202,11 @@ var init_guide = __esm({
23156
23202
  { name: "reflect", when: "propose the work just-completed cards leave behind", text: reflect_default },
23157
23203
  { name: "preview-agent", when: "be a preview agent: write your one section of a card", text: preview_agent_default },
23158
23204
  { name: "write-agent", when: "create or change an agent, including one built from a skill \u2014 its AGENT.md, files, memory, and how to check it", text: write_agent_default },
23205
+ { name: "write-prompt", when: "write or change any prompt's text \u2014 an agent, a skill, a guide, or a prompt in code", text: write_prompt_default },
23159
23206
  { name: "module-map", when: "write or rebuild docs/kanban/modules.md", text: module_map_default }
23160
23207
  ];
23161
23208
  guideNames = () => GUIDES.map((g) => g.name);
23162
- RENAMED = {
23209
+ RENAMED2 = {
23163
23210
  "discuss-idea": "discuss-goal",
23164
23211
  "spec-skill": "preview-agent",
23165
23212
  "spec-agent": "preview-agent"
@@ -23195,62 +23242,62 @@ var init_guide2 = __esm({
23195
23242
  }
23196
23243
  });
23197
23244
 
23198
- // src/commands/workflow.ts
23245
+ // src/commands/studio.ts
23199
23246
  import fs75 from "node:fs";
23200
23247
  import path76 from "node:path";
23201
- function cmdWorkflowList() {
23202
- if (!workflowsReachable().ok) die(NEEDS_CLOUD, "needs-cloud");
23203
- const offline2 = workflowsOffline();
23204
- const rows = workflows();
23248
+ function cmdStudioList() {
23249
+ if (!studiosReachable().ok) die(NEEDS_CLOUD, "needs-cloud");
23250
+ const offline2 = studiosOffline();
23251
+ const rows = studios();
23205
23252
  for (const flow of rows) {
23206
23253
  const previews = previewNames(previewMembers(flow));
23207
23254
  const land = names2(flow.land);
23208
23255
  const line = [flow.id, flow.name, ...previews ? [`previews: ${previews}${land ? ` \u2192 land: ${land}` : ""}`] : land ? [`land: ${land}`] : []];
23209
23256
  say(`${line.join(" ")}${offline2 ? " (offline)" : ""}`);
23210
23257
  for (const agent of listedScheduled(flow)) say(` scheduled: ${agent}`);
23211
- for (const problem of workflowProblems(flow.id)) say(` ! ${problem}`);
23258
+ for (const problem of studioProblems(flow.id)) say(` ! ${problem}`);
23212
23259
  }
23213
- const fileProblems = workflowFileProblems();
23260
+ const fileProblems = studioFileProblems();
23214
23261
  for (const problem of fileProblems) say(`! ${problem}`);
23215
23262
  return {
23216
- workflows: rows.map((flow) => ({
23263
+ studios: rows.map((flow) => ({
23217
23264
  ...flow,
23218
23265
  previews: previewMembers(flow).map((h) => ({ ...h, after: agentAfter(h.agent) })),
23219
23266
  scheduled: listedScheduled(flow),
23220
- description: workflowPurpose(flow),
23221
- when: workflowWhen(flow),
23222
- problems: workflowProblems(flow.id)
23267
+ description: studioPurpose(flow),
23268
+ when: studioWhen(flow),
23269
+ problems: studioProblems(flow.id)
23223
23270
  })),
23224
23271
  problems: fileProblems,
23225
23272
  ...offline2 ? { offline: offline2 } : {}
23226
23273
  };
23227
23274
  }
23228
- function cmdWorkflowRename(id, name) {
23229
- done(renameWorkflow(id, name));
23275
+ function cmdStudioRename(id, name) {
23276
+ done(renameStudio(id, name));
23230
23277
  say(`renamed ${id} to "${name.trim()}"`);
23231
23278
  return { id, name: name.trim() };
23232
23279
  }
23233
- function cmdWorkflowDiagram(id, card) {
23280
+ function cmdStudioDiagram(id, card) {
23234
23281
  const flow = found(id);
23235
23282
  const cardId2 = Number(card);
23236
23283
  if (!Number.isInteger(cardId2) || !locate(cardId2)) die(`no card #${card} on this board`, "no-such-card");
23237
- const diagram = workflowDiagram({ previews: previewMembers(flow), land: flow.land, scheduled: scheduledMembers(flow) }, (name) => {
23284
+ const diagram = studioDiagram({ previews: previewMembers(flow), land: flow.land, scheduled: scheduledMembers(flow) }, (name) => {
23238
23285
  const agent = findSpecAgent(name);
23239
23286
  return agent ? { ...agent, after: agentAfter(name) } : null;
23240
23287
  });
23241
- const file = path76.join(ASSETS, String(cardId2), "workflow.json");
23288
+ const file = path76.join(ASSETS, String(cardId2), "studio.json");
23242
23289
  fs75.mkdirSync(path76.dirname(file), { recursive: true });
23243
23290
  fs75.writeFileSync(file, `${JSON.stringify(diagram, null, 2)}
23244
23291
  `);
23245
- const tag = `<Workflow src=".assets/${cardId2}/workflow.json" label="${flow.name.replace(/"/g, "")}" />`;
23292
+ const tag = `<Studio src=".assets/${cardId2}/studio.json" label="${flow.name.replace(/"/g, "")}" />`;
23246
23293
  say(tag);
23247
23294
  return { file, tag, diagram };
23248
23295
  }
23249
- function cmdWorkflowValidate(folder) {
23296
+ function cmdStudioValidate(folder) {
23250
23297
  const dir = path76.resolve(folder);
23251
23298
  if (!fs75.statSync(dir, { throwIfNoEntry: false })?.isDirectory()) die(`${folder} is not a folder`, "bad-args");
23252
- const files = readWorkflowFolder(dir);
23253
- const read3 = parseWorkflowFile("workflow", files[WORKFLOW_FILE] ?? "", WORKFLOW_FILE);
23299
+ const files = readStudioFolder(dir);
23300
+ const read3 = parseStudioFile("studio", files[STUDIO_FILE] ?? "", STUDIO_FILE);
23254
23301
  const def = "def" in read3 ? read3.def : null;
23255
23302
  const named2 = def ? new Set([...def.previews, ...def.land, ...def.scheduled].map((h) => h.agent)) : [];
23256
23303
  for (const name of named2) {
@@ -23261,18 +23308,18 @@ function cmdWorkflowValidate(folder) {
23261
23308
  if (text4 !== null) files[`agents/${name}/${file}`] = text4;
23262
23309
  }
23263
23310
  }
23264
- const problems = workflowFilesProblems(files).map((p) => `${p.file} ${p.reason}`);
23265
- if (problems.length) die(problems.map((p) => `! ${p}`).join("\n"), { kind: "workflow-problems", bare: true, problems });
23311
+ const problems = studioFilesProblems(files).map((p) => `${p.file} ${p.reason}`);
23312
+ if (problems.length) die(problems.map((p) => `! ${p}`).join("\n"), { kind: "studio-problems", bare: true, problems });
23266
23313
  say(`${folder}: no problems`);
23267
23314
  return { folder: dir, problems };
23268
23315
  }
23269
- async function cmdWorkflowPull(id, folder) {
23316
+ async function cmdStudioPull(id, folder) {
23270
23317
  const cloudId = cloudIdOf(id);
23271
23318
  if (!cloudId) found(id);
23272
23319
  const dir = path76.resolve(folder ?? id);
23273
23320
  if (fs75.existsSync(dir) && fs75.readdirSync(dir).length) die(`${folder ?? id} is not empty`, "bad-args");
23274
- const read3 = await call("GET", `/v1/workflows/${encodeURIComponent(cloudId)}`);
23275
- if (!read3.ok) die(read3.error, read3.code === "not_found" ? "no-such-workflow" : "cloud-refused");
23321
+ const read3 = await call("GET", `/v1/studios/${encodeURIComponent(cloudId)}`);
23322
+ if (!read3.ok) die(read3.error, read3.code === "not_found" ? "no-such-studio" : "cloud-refused");
23276
23323
  const { version, files } = read3.value;
23277
23324
  for (const [file, text4] of Object.entries({ ...files, [VERSION_FILE]: versionText(cloudId, version) })) {
23278
23325
  const full = path76.join(dir, ...file.split("/"));
@@ -23284,26 +23331,26 @@ async function cmdWorkflowPull(id, folder) {
23284
23331
  say(`Pulled ${id} v${version} into ${shown}.`);
23285
23332
  return { id, version, folder: dir };
23286
23333
  }
23287
- async function cmdWorkflowPush(folder, opts) {
23334
+ async function cmdStudioPush(folder, opts) {
23288
23335
  const dir = path76.resolve(folder);
23289
23336
  let pulled = null;
23290
23337
  try {
23291
23338
  pulled = JSON.parse(fs75.readFileSync(path76.join(dir, VERSION_FILE), "utf8"));
23292
23339
  } catch {
23293
23340
  }
23294
- if (!pulled?.id || !Number.isInteger(pulled.version)) die(`${folder} was not written by \`akb workflow pull\``, "bad-args");
23341
+ if (!pulled?.id || !Number.isInteger(pulled.version)) die(`${folder} was not written by \`akb studio pull\``, "bad-args");
23295
23342
  const { id: cloudId, version } = pulled;
23296
- const id = workflowName(cloudId);
23297
- const readOnly2 = () => die(`${id} is not this workspace's own; copy it on the web first.`, "workflow-read-only");
23343
+ const id = studioName(cloudId);
23344
+ const readOnly2 = () => die(`${id} is not this workspace's own; copy it on the web first.`, "studio-read-only");
23298
23345
  if (cloudId.startsWith("wf_builtin_")) readOnly2();
23299
- const read3 = readWorkflowFolder(dir);
23300
- const problems = workflowFilesProblems(read3).map((p) => `${p.file} ${p.reason}`);
23301
- if (problems.length) die(problems.map((p) => `! ${p}`).join("\n"), { kind: "bad-workflow", bare: true, problems });
23302
- const checked = checkWorkflowFiles(read3);
23346
+ const read3 = readStudioFolder(dir);
23347
+ const problems = studioFilesProblems(read3).map((p) => `${p.file} ${p.reason}`);
23348
+ if (problems.length) die(problems.map((p) => `! ${p}`).join("\n"), { kind: "bad-studio", bare: true, problems });
23349
+ const checked = checkStudioFiles(read3);
23303
23350
  const { files } = checked;
23304
- const now = await call("GET", `/v1/workflows/${encodeURIComponent(cloudId)}`);
23305
- if (!now.ok) die(now.error, now.code === "not_found" ? "no-such-workflow" : "cloud-refused");
23306
- if (now.value.version !== version) die(`${id} is at v${now.value.version} now; pull again and redo the change.`, "workflow-moved");
23351
+ const now = await call("GET", `/v1/studios/${encodeURIComponent(cloudId)}`);
23352
+ if (!now.ok) die(now.error, now.code === "not_found" ? "no-such-studio" : "cloud-refused");
23353
+ if (now.value.version !== version) die(`${id} is at v${now.value.version} now; pull again and redo the change.`, "studio-moved");
23307
23354
  if (JSON.stringify(files) === JSON.stringify(Object.fromEntries(Object.entries(now.value.files).filter(([f]) => f !== VERSION_FILE).sort()))) {
23308
23355
  say(`${id} is unchanged (v${version}).`);
23309
23356
  return { id, version, changed: false, ...opts.dryRun ? { dryRun: true } : {} };
@@ -23312,10 +23359,10 @@ async function cmdWorkflowPush(folder, opts) {
23312
23359
  say(`${id} would push v${version + 1}.`);
23313
23360
  return { id, version: version + 1, changed: true, dryRun: true };
23314
23361
  }
23315
- const res = await call("PATCH", `/v1/workflows/${encodeURIComponent(cloudId)}`, { files });
23362
+ const res = await call("PATCH", `/v1/studios/${encodeURIComponent(cloudId)}`, { files });
23316
23363
  if (!res.ok) {
23317
23364
  if (res.code === "read_only" || res.code === "not_found") readOnly2();
23318
- die(res.error, res.code === "bad_request" || res.code === "payload_too_large" ? "bad-workflow" : "cloud-refused");
23365
+ die(res.error, res.code === "bad_request" || res.code === "payload_too_large" ? "bad-studio" : "cloud-refused");
23319
23366
  }
23320
23367
  const next = res.value.version;
23321
23368
  fs75.writeFileSync(path76.join(dir, VERSION_FILE), versionText(cloudId, next));
@@ -23343,31 +23390,31 @@ async function cloudScope() {
23343
23390
  const held4 = cloudOk(await call("GET", `/v1/projects/${enc2(project2)}`));
23344
23391
  return { project: project2, workspace: held4.workspace };
23345
23392
  }
23346
- async function cmdWorkflowRule(name, opts) {
23393
+ async function cmdStudioRule(name, opts) {
23347
23394
  const rule = noteText(opts);
23348
23395
  const { workspace: workspace2 } = await cloudScope();
23349
- const held4 = cloudOk(await call("GET", `/v1/workspaces/${enc2(workspace2)}/workflow-rules`));
23350
- const flow = held4.workflows.find((w) => workflowName(w.id) === name);
23396
+ const held4 = cloudOk(await call("GET", `/v1/workspaces/${enc2(workspace2)}/studio-rules`));
23397
+ const flow = held4.studios.find((w) => studioName(w.id) === name);
23351
23398
  if (!flow) {
23352
- die(`no workflow called "${name}" here. There are: ${held4.workflows.map((w) => workflowName(w.id)).join(", ")}.`, {
23353
- kind: "no-such-workflow",
23354
- workflow: name
23399
+ die(`no studio called "${name}" here. There are: ${held4.studios.map((w) => studioName(w.id)).join(", ")}.`, {
23400
+ kind: "no-such-studio",
23401
+ studio: name
23355
23402
  });
23356
23403
  }
23357
23404
  if (rule === void 0) {
23358
23405
  const now = flow.rule ?? "";
23359
23406
  say(now || `${name} has no rules`);
23360
- return { workflow: name, rule: now };
23407
+ return { studio: name, rule: now };
23361
23408
  }
23362
- cloudOk(await call("PUT", `/v1/workspaces/${enc2(workspace2)}/workflows/${enc2(flow.id)}/rule`, { rule }));
23409
+ cloudOk(await call("PUT", `/v1/workspaces/${enc2(workspace2)}/studios/${enc2(flow.id)}/rule`, { rule }));
23363
23410
  say(`${rule ? "saved" : "cleared"} the rules of ${name}`);
23364
- return { workflow: name, rule };
23411
+ return { studio: name, rule };
23365
23412
  }
23366
- async function cmdWorkflowInstructions(agent, opts) {
23413
+ async function cmdStudioInstructions(agent, opts) {
23367
23414
  const rule = noteText(opts);
23368
23415
  const { project: project2, workspace: workspace2 } = await cloudScope();
23369
23416
  const [shared, own] = await Promise.all([
23370
- call("GET", `/v1/workspaces/${enc2(workspace2)}/workflow-rules`),
23417
+ call("GET", `/v1/workspaces/${enc2(workspace2)}/studio-rules`),
23371
23418
  call("GET", `/v1/projects/${enc2(project2)}/agents`)
23372
23419
  ]);
23373
23420
  const sharedRows = cloudOk(shared).data;
@@ -23392,46 +23439,46 @@ async function cmdWorkflowInstructions(agent, opts) {
23392
23439
  return { agent, rule, scope };
23393
23440
  }
23394
23441
  var found, done, names2, previewNames, cloudIdOf, enc2;
23395
- var init_workflow2 = __esm({
23396
- "src/commands/workflow.ts"() {
23442
+ var init_studio2 = __esm({
23443
+ "src/commands/studio.ts"() {
23397
23444
  "use strict";
23398
23445
  init_agents();
23399
23446
  init_cards();
23400
23447
  init_io();
23401
23448
  init_paths();
23402
- init_workflow_diagram();
23403
- init_cloud_workflows();
23404
- init_workflows();
23405
- init_workflow_folder();
23406
- init_workflow_files();
23407
- init_workflow_def();
23449
+ init_studio_diagram();
23450
+ init_cloud_studios();
23451
+ init_studios();
23452
+ init_studio_folder();
23453
+ init_studio_files();
23454
+ init_studio_def();
23408
23455
  init_board_files();
23409
23456
  init_tasks();
23410
23457
  found = (id) => {
23411
- const flow = workflowById(id);
23458
+ const flow = studioById(id);
23412
23459
  if (!flow) {
23413
- die(`no workflow called "${id}" here. There are: ${workflows().map((w) => w.id).join(", ")}.`, {
23414
- kind: "no-such-workflow",
23415
- workflow: id
23460
+ die(`no studio called "${id}" here. There are: ${studios().map((w) => w.id).join(", ")}.`, {
23461
+ kind: "no-such-studio",
23462
+ studio: id
23416
23463
  });
23417
23464
  }
23418
23465
  return flow;
23419
23466
  };
23420
23467
  done = (res) => {
23421
- if (!res.ok) die(res.error ?? "the board refused that change", res.reason === "workflowReadOnly" ? "workflow-read-only" : void 0);
23468
+ if (!res.ok) die(res.error ?? "the board refused that change", res.reason === "studioReadOnly" ? "studio-read-only" : void 0);
23422
23469
  };
23423
23470
  names2 = (rows) => rows.map((h) => `${h.agent}${h.off ? " (off)" : ""}`).join(", ");
23424
23471
  previewNames = (rows) => rows.map((h) => `${names2([h])}${agentAfter(h.agent).length ? ` (after ${agentAfter(h.agent).join(", ")})` : ""}`).join(", ");
23425
- cloudIdOf = (id) => cloudFlows().find((f) => workflowName(f.cloudId) === id)?.cloudId;
23472
+ cloudIdOf = (id) => cloudFlows().find((f) => studioName(f.cloudId) === id)?.cloudId;
23426
23473
  enc2 = encodeURIComponent;
23427
23474
  }
23428
23475
  });
23429
23476
 
23430
23477
  // src/lib/agent/complete.ts
23431
23478
  function deliveryAgents(delivery) {
23432
- if (delivery.workflow?.land) return delivery.workflow.land;
23433
- const flow = workflowFor(delivery.workflow?.id);
23434
- if (!flow) throw new Error(noWorkflowMessage(delivery.workflow?.id));
23479
+ if (delivery.studio?.land) return delivery.studio.land;
23480
+ const flow = studioFor(delivery.studio?.id);
23481
+ if (!flow) throw new Error(noStudioMessage(delivery.studio?.id));
23435
23482
  return landAgents(flow);
23436
23483
  }
23437
23484
  function completeDelivery(named2, result = {}) {
@@ -23476,14 +23523,14 @@ function completeDelivery(named2, result = {}) {
23476
23523
  return { delivery: delivery2, receipt: pending };
23477
23524
  }
23478
23525
  const agent = delivery2.scheduled?.agent ?? deliveryAgents(delivery2)[deliveryStep(delivery2)]?.agent;
23479
- if (!agent) throw new Error("No workflow step remains to complete.");
23526
+ if (!agent) throw new Error("No studio step remains to complete.");
23480
23527
  if (delivery2.cardId !== null && !locate(delivery2.cardId)) throw new Error("The card is missing before completion.");
23481
23528
  const finalStep = !!delivery2.scheduled || receipts.length + 1 >= deliveryAgents(delivery2).length;
23482
23529
  const card = delivery2.cardId === null ? void 0 : findCard(delivery2.cardId);
23483
23530
  if (finalStep && card && /[-*]\s+\[ \]/.test(card.body)) throw new Error("Complete every Todo before finishing the delivery.");
23484
23531
  const merges = specAgentCatalog().agents.find((a) => a.name === agent)?.merges;
23485
23532
  if (merges && !commit && delivery2.base) throw new Error(`\`${agent}\` must report its merged commit and target branch.`);
23486
- if (delivery2.workflow?.needsArtifact && !delivery2.scheduled) {
23533
+ if (delivery2.studio?.needsArtifact && !delivery2.scheduled) {
23487
23534
  const stop = filesStop(delivery2);
23488
23535
  if (stop) throw new Error(stop.why);
23489
23536
  }
@@ -23495,7 +23542,7 @@ function completeDelivery(named2, result = {}) {
23495
23542
  syncAudit(delivery.deliveryId);
23496
23543
  const final = !!delivery.scheduled || receipt.step + 1 >= deliveryAgents(delivery).length;
23497
23544
  if (final && !receipt.finished) {
23498
- if (delivery.workflow?.needsArtifact && !delivery.scheduled) {
23545
+ if (delivery.studio?.needsArtifact && !delivery.scheduled) {
23499
23546
  const stop = filesStop(delivery);
23500
23547
  if (stop) throw new Error(stop.why);
23501
23548
  }
@@ -23545,7 +23592,7 @@ var init_complete = __esm({
23545
23592
  init_outputs();
23546
23593
  init_read();
23547
23594
  init_store();
23548
- init_workflows();
23595
+ init_studios();
23549
23596
  init_catalog();
23550
23597
  }
23551
23598
  });
@@ -23564,7 +23611,7 @@ function approvalRequest(req) {
23564
23611
  const ask2 = { id: card.id, title: card.title, notes: req.notes };
23565
23612
  if (awaitingApproval(card)) return { action: "approve", ...ask2 };
23566
23613
  if (card.stages && card.stage < card.stages) return { error: `#${card.id} is still planning stage ${card.stage} \u2014 approve it once its previews are ready.` };
23567
- return archivesOnApproval(workflowFor(card.workflow)) ? { action: "archive", ...ask2 } : { action: "implement", ...ask2 };
23614
+ return archivesOnApproval(studioFor(card.studio)) ? { action: "archive", ...ask2 } : { action: "implement", ...ask2 };
23568
23615
  }
23569
23616
  function advancePhase(id) {
23570
23617
  const card = findCard(id);
@@ -23587,7 +23634,7 @@ var init_approve = __esm({
23587
23634
  init_rules();
23588
23635
  init_store();
23589
23636
  init_types();
23590
- init_workflows();
23637
+ init_studios();
23591
23638
  }
23592
23639
  });
23593
23640
 
@@ -23596,7 +23643,7 @@ import { randomUUID as randomUUID5 } from "node:crypto";
23596
23643
  async function startRun(req) {
23597
23644
  const sessionId = randomUUID5();
23598
23645
  const cardId2 = Number.isInteger(req.id) ? req.id : null;
23599
- const short2 = workflowRefusal(req) ?? await scheduledRefusal(req);
23646
+ const short2 = studioRefusal(req) ?? await scheduledRefusal(req);
23600
23647
  if (short2) return short2;
23601
23648
  const delivery = req.action === "implement" ? deliveryFor(req) : void 0;
23602
23649
  if (delivery && req.session !== "new") {
@@ -23607,23 +23654,23 @@ async function startRun(req) {
23607
23654
  if (moved) return moved;
23608
23655
  return open2(req, sessionId);
23609
23656
  }
23610
- function workflowRefusal(req) {
23657
+ function studioRefusal(req) {
23611
23658
  if (!Number.isInteger(req.id)) return null;
23612
- if (!workflowsReachable().ok) return refusal("needsCloud", NEEDS_CLOUD);
23613
- if (pinMissing()) return refusal("workflowOffline", NOT_DOWNLOADED);
23659
+ if (!studiosReachable().ok) return refusal("needsCloud", NEEDS_CLOUD);
23660
+ if (pinMissing()) return refusal("studioOffline", NOT_DOWNLOADED);
23614
23661
  if (deliveryFor(req)) return null;
23615
- const id = cardWorkflowId(req.id);
23616
- const flow = workflowFor(id);
23617
- if (!flow) return refusal("workflowUnknown", noWorkflowMessage(id), { card: String(req.id), workflow: id });
23662
+ const id = cardStudioId(req.id);
23663
+ const flow = studioFor(id);
23664
+ if (!flow) return refusal("studioUnknown", noStudioMessage(id), { card: String(req.id), studio: id });
23618
23665
  if (archivesOnApproval(flow) && req.action === "implement") {
23619
23666
  return refusal("planDelivered", `#${req.id} lands nothing, so its last approval archives it rather than building it.`, { card: String(req.id) });
23620
23667
  }
23621
- const [problem] = workflowIssues(flow.id);
23668
+ const [problem] = studioIssues(flow.id);
23622
23669
  return problem ?? null;
23623
23670
  }
23624
23671
  async function scheduledRefusal(req) {
23625
- if (req.action !== "scheduled" || req.deliveryId || !req.workflow || !req.specAgent) return null;
23626
- const pass = { workflow: req.workflow, agent: req.specAgent };
23672
+ if (req.action !== "scheduled" || req.deliveryId || !req.studio || !req.specAgent) return null;
23673
+ const pass = { studio: req.studio, agent: req.specAgent };
23627
23674
  const refused = scheduledBusy(pass);
23628
23675
  if (refused) return refused;
23629
23676
  for (const id of stalePasses(pass)) await cancelDelivery(id);
@@ -23688,8 +23735,8 @@ var init_start = __esm({
23688
23735
  init_deliveries();
23689
23736
  init_store();
23690
23737
  init_prompts();
23691
- init_cloud_workflows();
23692
- init_workflows();
23738
+ init_cloud_studios();
23739
+ init_studios();
23693
23740
  init_sessions();
23694
23741
  init_runtimes();
23695
23742
  init_scheduled();
@@ -24050,7 +24097,7 @@ function questionsField(meta) {
24050
24097
  return field("questions", [`${meta.questions.length} open:`, ...lines.map((s) => ` ${s}`)]);
24051
24098
  }
24052
24099
  function stageField(meta) {
24053
- const flow = workflowFor(meta.workflow);
24100
+ const flow = studioFor(meta.studio);
24054
24101
  const stages = cardStages(meta, flow).length;
24055
24102
  return stages > 1 ? field("stage", `${cardStage(meta, flow)} of ${stages}`) : [];
24056
24103
  }
@@ -24058,7 +24105,7 @@ function committingClose(delivery) {
24058
24105
  if (!delivery) return [];
24059
24106
  return [
24060
24107
  "Keep board files at the board path and out of task commits.",
24061
- ...delivery.workflow?.needsArtifact ? ["Record each delivered file or folder in a new ticked `Output:` todo."] : []
24108
+ ...delivery.studio?.needsArtifact ? ["Record each delivered file or folder in a new ticked `Output:` todo."] : []
24062
24109
  ];
24063
24110
  }
24064
24111
  function conversationBlock(chat) {
@@ -24170,7 +24217,7 @@ function buildFlow(req, program2) {
24170
24217
  break;
24171
24218
  }
24172
24219
  case "spec": {
24173
- next.push("Return to the workflow that requested this preview and continue it in this session. No background follow-up is scheduled.");
24220
+ next.push("Return to the studio that requested this preview and continue it in this session. No background follow-up is scheduled.");
24174
24221
  break;
24175
24222
  }
24176
24223
  // Squeezing the memory back down (#514). The facts are the files, because the files
@@ -24245,7 +24292,7 @@ function buildFlow(req, program2) {
24245
24292
  case "reflect": {
24246
24293
  for (const id of reflectedCards(req)) readCard2(id, "archive");
24247
24294
  close.push(
24248
- `${self} raw triage add --title ".." --slug <short-english-slug> --source "#<id>" --workflow <that card's workflow> --text ".." \u2014 one call per proposal, each naming the archived file of the card it traces to`,
24295
+ `${self} raw triage add --title ".." --slug <short-english-slug> --source "#<id>" --studio <that card's studio> --text ".." \u2014 one call per proposal, each naming the archived file of the card it traces to`,
24249
24296
  "propose nothing at all when nothing follows: that is a complete result, and most batches are it",
24250
24297
  "change nothing else \u2014 no card is created, edited or archived, and no memory file is written"
24251
24298
  );
@@ -24260,9 +24307,9 @@ function leadLine(req, program2) {
24260
24307
  return `${action}${what ? ` ${what}` : ""} \u2014 printed, not started. Do it here, in this session (${program2}).`;
24261
24308
  }
24262
24309
  function printFlow(rawReq, program2 = "akb") {
24263
- const unbuilt = rawReq.action === "implement" ? workflowRefusal(rawReq) : null;
24310
+ const unbuilt = rawReq.action === "implement" ? studioRefusal(rawReq) : null;
24264
24311
  if (unbuilt?.reason === "planDelivered") die(unbuilt.error, { kind: "plan-delivered" });
24265
- const req = withWorkflow(rawReq);
24312
+ const req = withStudio(rawReq);
24266
24313
  const flow = buildFlow(req, program2);
24267
24314
  const prompt = buildAsk(req);
24268
24315
  const rule = ruleFor(req, frozenRules(req));
@@ -24297,7 +24344,7 @@ function printFlow(rawReq, program2 = "akb") {
24297
24344
  say(guide.text.trimEnd());
24298
24345
  }
24299
24346
  }
24300
- for (const block of [workflowRulesBlock(req), landBlock(req), settingsBlock(req)].filter(Boolean)) {
24347
+ for (const block of [studioRulesBlock(req), landBlock(req), settingsBlock(req)].filter(Boolean)) {
24301
24348
  say("");
24302
24349
  say(block);
24303
24350
  }
@@ -24338,7 +24385,7 @@ var init_flow = __esm({
24338
24385
  init_dismissal_review();
24339
24386
  init_prompts();
24340
24387
  init_rules2();
24341
- init_workflows();
24388
+ init_studios();
24342
24389
  init_types();
24343
24390
  init_env();
24344
24391
  MAX_STEPS = 12;
@@ -24347,7 +24394,7 @@ var init_flow = __esm({
24347
24394
  bodyScaffoldClose = (lead = "fill the existing") => [`${lead} body scaffold; do not rename or translate its section titles, and leave empty scaffold sections in place`];
24348
24395
  answeredClose = (delivery, self) => `${self} raw delivery answered ${delivery.deliveryId} --changed|--unchanged "<why>" \u2014 before you drop the questions; dropping the last one with nothing said carries the build on as --unchanged`;
24349
24396
  stageClose = (meta) => {
24350
- const flow = workflowFor(meta.workflow);
24397
+ const flow = studioFor(meta.studio);
24351
24398
  return cardStage(meta, flow) < cardStages(meta, flow).length ? ["end the stage with its previews; ask no question about approving it \u2014 the board's Approve moves the card on"] : [];
24352
24399
  };
24353
24400
  GUIDES_FOR = {
@@ -24383,7 +24430,7 @@ function endOfStage(contract, card) {
24383
24430
  const missing = missingRequired2(contract, card);
24384
24431
  if (!missing.length) return { done: true };
24385
24432
  const askable = missing.find(
24386
- (name) => findSpecAgent(name) && specAgentAssigned(name, cardWorkflowId(card.id)) && !askedFor(card.id, name)
24433
+ (name) => findSpecAgent(name) && specAgentAssigned(name, cardStudioId(card.id)) && !askedFor(card.id, name)
24387
24434
  );
24388
24435
  if (!askable) return { stage: contract.stage, missing };
24389
24436
  return {
@@ -24398,7 +24445,7 @@ var init_stage_end = __esm({
24398
24445
  init_flows();
24399
24446
  init_store();
24400
24447
  init_stages();
24401
- init_workflows();
24448
+ init_studios();
24402
24449
  missingRequired2 = (contract, card) => contract.requires.filter((name) => !card.body.includes(specHeading(name)));
24403
24450
  shortLine = (short2, cardId2) => `the ${short2.stage} stage of #${cardId2} is not finished: ${short2.missing.map((name) => `\`${name}\``).join(", ")} ${short2.missing.length === 1 ? "is" : "are"} required here and wrote nothing. Run ${short2.missing.length === 1 ? "it" : "them"} yourself, take the requirement off the stage, or write that part of the card by hand.`;
24404
24451
  stageOfAction = (action) => {
@@ -24614,7 +24661,7 @@ function specRunsAfter(asks) {
24614
24661
  const card = byId.get(ask2.cardId);
24615
24662
  if (!card) return [];
24616
24663
  const agent = findSpecAgent(ask2.specAgent);
24617
- if (!agent || !specAgentAssigned(agent.name, cardWorkflowId(ask2.cardId))) return [];
24664
+ if (!agent || !specAgentAssigned(agent.name, cardStudioId(ask2.cardId))) return [];
24618
24665
  return [{
24619
24666
  action: "spec",
24620
24667
  id: ask2.cardId,
@@ -24640,7 +24687,7 @@ var init_follow = __esm({
24640
24687
  init_agents();
24641
24688
  init_read();
24642
24689
  init_refine2();
24643
- init_workflows();
24690
+ init_studios();
24644
24691
  }
24645
24692
  });
24646
24693
 
@@ -25385,11 +25432,11 @@ async function cmdStartRun(action, args, opts, program2 = "akb") {
25385
25432
  if (follow2) return await followStarted(run2.sessionId, program2, opts.events === true);
25386
25433
  return { sessionId: run2.sessionId, action, cardId: run2.cardId };
25387
25434
  }
25388
- async function cmdRunScheduled(workflow, agent, opts, program2 = "akb") {
25389
- const id = knownWorkflow(workflow);
25435
+ async function cmdRunScheduled(studio, agent, opts, program2 = "akb") {
25436
+ const id = knownStudio(studio);
25390
25437
  const one = scheduledAgent(id, agent);
25391
25438
  if (!one) die(`\`${id}\` schedules no agent called \`${agent}\``, { kind: "run-refused", action: "scheduled" });
25392
- const req = scheduledRequest({ workflow: id, agent: one.agent });
25439
+ const req = scheduledRequest({ studio: id, agent: one.agent });
25393
25440
  if (insideRun() || opts.print) return printFlow(req, program2);
25394
25441
  const started = await startRun(req);
25395
25442
  if ("error" in started) die(started.error, { kind: "run-refused", action: "scheduled" });
@@ -25842,7 +25889,7 @@ var init_run = __esm({
25842
25889
  init_refine2();
25843
25890
  init_sessions();
25844
25891
  init_start();
25845
- init_workflows();
25892
+ init_studios();
25846
25893
  init_scheduled();
25847
25894
  init_store();
25848
25895
  init_io();
@@ -25920,8 +25967,8 @@ async function cmdTriageAdd(opts) {
25920
25967
  const title = (opts.title ?? "").trim();
25921
25968
  if (!title) die('say what it is: --title "<one line>"', { kind: "needs-input" });
25922
25969
  if (opts.file !== void 0 && opts.text !== void 0) die("pass --file or --text, not both", { kind: "needs-input" });
25923
- if (!opts.workflow?.trim()) die("say which workflow does it: --workflow <id> (`akb workflow list`)", { kind: "needs-input" });
25924
- const workflow = knownWorkflow(opts.workflow);
25970
+ if (!opts.studio?.trim()) die("say which studio does it: --studio <id> (`akb studio list`)", { kind: "needs-input" });
25971
+ const studio = knownStudio(opts.studio);
25925
25972
  let body = opts.text;
25926
25973
  if (opts.file !== void 0) {
25927
25974
  try {
@@ -25934,7 +25981,7 @@ async function cmdTriageAdd(opts) {
25934
25981
  die('the item has to say something: --text ".." , or --file <path> for a longer one', { kind: "needs-input" });
25935
25982
  }
25936
25983
  const agent = runAgent();
25937
- const done2 = addToInbox({ title, text: body, source: opts.source, slug: opts.slug, workflow, ...agent ? { agent } : {} });
25984
+ const done2 = addToInbox({ title, text: body, source: opts.source, slug: opts.slug, studio, ...agent ? { agent } : {} });
25938
25985
  if (!done2.ok) die(done2.error, { kind: "triage-item-refused" });
25939
25986
  say(`added to triage: ${done2.signal.relPath}`);
25940
25987
  return { title: done2.signal.title, source_id: done2.signal.sourceId, file: done2.signal.relPath };
@@ -25951,7 +25998,7 @@ var init_triage = __esm({
25951
25998
  "src/commands/triage.ts"() {
25952
25999
  "use strict";
25953
26000
  init_scheduled();
25954
- init_workflows();
26001
+ init_studios();
25955
26002
  init_signals();
25956
26003
  init_io();
25957
26004
  init_paths();
@@ -25960,8 +26007,8 @@ var init_triage = __esm({
25960
26007
 
25961
26008
  // src/commands/spec.ts
25962
26009
  async function cmdSpec(opts, program2 = "akb") {
25963
- if ((opts.workflow || opts.workspace) && !opts.triggers) die("--workflow and --workspace require --triggers", { kind: "invalid-usage" });
25964
- if (opts.workspace && !opts.workflow) die("--workspace requires --workflow", { kind: "invalid-usage" });
26010
+ if ((opts.studio || opts.workspace) && !opts.triggers) die("--studio and --workspace require --triggers", { kind: "invalid-usage" });
26011
+ if (opts.workspace && !opts.studio) die("--workspace requires --studio", { kind: "invalid-usage" });
25965
26012
  if (opts.triggers) {
25966
26013
  if (opts.agent !== void 0 || opts.id !== void 0 || opts.note?.length || opts.print || opts.follow || opts.notes !== void 0) {
25967
26014
  die("--triggers cannot be combined with positional arguments, --print, --follow or --notes", { kind: "invalid-usage" });
@@ -25988,9 +26035,9 @@ async function cmdSpec(opts, program2 = "akb") {
25988
26035
  die(`say which card: ${program2} raw previews ${name} <id> [note]`, { kind: "needs-input" });
25989
26036
  }
25990
26037
  if (!locate(id)) die(`no task with id ${id} under ${rel(TODO)}`, { kind: "card-not-found", id });
25991
- if (!specAgentAssigned(name, cardWorkflowId(id))) {
26038
+ if (!specAgentAssigned(name, cardStudioId(id))) {
25992
26039
  die(
25993
- `the \`${name}\` agent is off or no preview of the workflow of #${id}, so it isn't running. Plan that part of the card yourself and carry on. It joins when ${SPEC_ASSIGN_HOME}.`,
26040
+ `the \`${name}\` agent is off or no preview of the studio of #${id}, so it isn't running. Plan that part of the card yourself and carry on. It joins when ${SPEC_ASSIGN_HOME}.`,
25994
26041
  { kind: "spec-agent-off", specAgent: name }
25995
26042
  );
25996
26043
  }
@@ -26058,7 +26105,7 @@ var init_spec = __esm({
26058
26105
  init_io();
26059
26106
  init_paths();
26060
26107
  init_agents();
26061
- init_workflows();
26108
+ init_studios();
26062
26109
  init_run();
26063
26110
  }
26064
26111
  });
@@ -26161,7 +26208,7 @@ async function onBoard2(cmd, cli, work) {
26161
26208
  const found2 = resolveBoard("runs", { board: ctx.board, dir: ctx.dir, cwd: cli.cwd, installHint: cli.installHint });
26162
26209
  useBoard(found2, ctx.dir !== null);
26163
26210
  sayIfRetiredPointer(found2.root);
26164
- await syncWorkflows();
26211
+ await syncStudios();
26165
26212
  return { board: KANBAN, ...await work(cli.program) ?? {} };
26166
26213
  });
26167
26214
  }
@@ -26210,14 +26257,14 @@ function declareRaw(program2, cli) {
26210
26257
  groups.delivery.addHelpText("after", HELP_AFTER.deliveries(cli.program));
26211
26258
  withShared(program2.command("previews")).argument("[agent]", "which preview agent; left off, the agents this board has are listed").argument("[id]", "the card to put it on", cardId).argument("[note...]", "what the flow wants looked at").summary("put a preview agent on a card; bare, list the preview agents this board has").description(
26212
26259
  "Fill one part of a card spec. Use --print to follow the specialist instructions in the current session. Without --print, start a separate run; inside a board run, queue it until that run ends."
26213
- ).option("-f, --follow", "watch its log instead of returning").option("--notes <text>", "what the flow wants looked at, for a caller building a command").option("--print", "print specialist instructions and work in this session").option("--triggers", "list agent names and trigger conditions without starting a run").option("--workflow <id>", "only enabled preview agents of this workflow").option("--workspace <id>", "the workspace whose workflows to query").addHelpText("after", `
26260
+ ).option("-f, --follow", "watch its log instead of returning").option("--notes <text>", "what the flow wants looked at, for a caller building a command").option("--print", "print specialist instructions and work in this session").option("--triggers", "list agent names and trigger conditions without starting a run").option("--studio <id>", "only enabled preview agents of this studio").option("--workspace <id>", "the workspace whose studios to query").addHelpText("after", `
26214
26261
  List trigger conditions: ${raw} previews --triggers --json`).action(async function(...vals) {
26215
26262
  const [agent, id, note] = positional(vals);
26216
26263
  const opts = this.opts();
26217
- if (opts.triggers && opts.workflow && !agent && id === void 0 && !note?.length && !opts.print && !opts.follow && opts.notes === void 0) {
26264
+ if (opts.triggers && opts.studio && !agent && id === void 0 && !note?.length && !opts.print && !opts.follow && opts.notes === void 0) {
26218
26265
  await boardless(this, cli, async () => {
26219
- if (goalsFile() && !opts.workspace) return cmdGoalPreviews(opts.workflow);
26220
- return queryPreviews(opts.workflow, opts.workspace);
26266
+ if (goalsFile() && !opts.workspace) return cmdGoalPreviews(opts.studio);
26267
+ return queryPreviews(opts.studio, opts.workspace);
26221
26268
  });
26222
26269
  } else await onBoard2(this, cli, (p) => cmdSpec({ agent, id, note, ...opts }, p));
26223
26270
  });
@@ -26225,7 +26272,7 @@ List trigger conditions: ${raw} previews --triggers --json`).action(async functi
26225
26272
  const triage = groups.triage;
26226
26273
  withShared(triage.command("add")).summary("write one item into triage").description(
26227
26274
  "One item, from words you already have \u2014 no endpoint, and nothing is pulled. The body is `--text` for a line or two, `--file <path>` when it is longer. `--source` says where it came from, and a reflection puts the card that prompted it there. It is not a task: it waits in triage until somebody sorts it. One already waiting, or already made into a card, is refused and told where it is; one only ignored is taken, and its `dismissed/` record is left alone."
26228
- ).requiredOption("--title <text>", "what it is, in one line").option("--text <text>", "its own words").option("--file <path>", "its own words, written to a file first").option("--source <text>", "where it came from").requiredOption("--workflow <id>", "the workflow that does it (`akb workflow list`); the card made of it runs on it").option("--slug <slug>", "a short English name for its file, and for the card it becomes (default: from the title)").action(async function() {
26275
+ ).requiredOption("--title <text>", "what it is, in one line").option("--text <text>", "its own words").option("--file <path>", "its own words, written to a file first").option("--source <text>", "where it came from").requiredOption("--studio <id>", "the studio that does it (`akb studio list`); the card made of it runs on it").option("--slug <slug>", "a short English name for its file, and for the card it becomes (default: from the title)").action(async function() {
26229
26276
  await onBoard2(this, cli, () => cmdTriageAdd(this.opts()));
26230
26277
  });
26231
26278
  withShared(triage.command("check")).summary("where triage already holds one source id").description(
@@ -26233,20 +26280,20 @@ List trigger conditions: ${raw} previews --triggers --json`).action(async functi
26233
26280
  ).argument("<source-id>", "the id to look for").action(async function(sourceId) {
26234
26281
  await onBoard2(this, cli, () => cmdTriageCheck(sourceId));
26235
26282
  });
26236
- withShared(program2.command("components")).summary("list an agent or workflow\u2019s preview components and their usage").option("--agent <name>", "one agent\u2019s components").option("--workflow <id>", "all components used by a workflow").option("--docs", "include component usage documentation").action(async function() {
26283
+ withShared(program2.command("components")).summary("list an agent or studio\u2019s preview components and their usage").option("--agent <name>", "one agent\u2019s components").option("--studio <id>", "all components used by a studio").option("--docs", "include component usage documentation").action(async function() {
26237
26284
  const ctx = ctxOf(this, cli.program);
26238
26285
  useBoard(resolveBoard("components", { board: ctx.board, dir: ctx.dir, cwd: cli.cwd, installHint: cli.installHint }), ctx.dir !== null);
26239
26286
  await boardless(this, cli, () => cmdComponents(this.opts()));
26240
26287
  });
26241
- const workflow = noun("workflow", "check a workflow folder, or rename a draft or draw a diagram inside a run");
26242
- withShared(workflow.command("validate")).argument("<folder>", "a workflow folder: WORKFLOW.md and agents/").summary("report every problem in a workflow folder; agents it names but lacks are read from the board").action(async function(folder) {
26243
- await onBoard2(this, cli, () => cmdWorkflowValidate(folder));
26288
+ const studio = noun("studio", "check a studio folder, or rename a draft or draw a diagram inside a run");
26289
+ withShared(studio.command("validate")).argument("<folder>", "a studio folder: STUDIO.md and agents/").summary("report every problem in a studio folder; agents it names but lacks are read from the board").action(async function(folder) {
26290
+ await onBoard2(this, cli, () => cmdStudioValidate(folder));
26244
26291
  });
26245
- withShared(workflow.command("rename")).argument("<id>", "the draft, from `workflow list`").argument("<name...>", "what to call it now").summary("rename the Workflow builder draft. Only inside that task's run.").action(async function(id, name) {
26246
- await onBoard2(this, cli, () => cmdWorkflowRename(id, name.join(" ")));
26292
+ withShared(studio.command("rename")).argument("<id>", "the draft, from `studio list`").argument("<name...>", "what to call it now").summary("rename the Studio builder draft. Only inside that task's run.").action(async function(id, name) {
26293
+ await onBoard2(this, cli, () => cmdStudioRename(id, name.join(" ")));
26247
26294
  });
26248
- withShared(workflow.command("diagram")).argument("<id>", "the workflow, from `workflow list`").argument("<card>", "the card whose asset folder gets workflow.json").summary("write the workflow's diagram to .assets/<card>/workflow.json and print the <Workflow> tag that shows it").action(async function(id, card) {
26249
- await onBoard2(this, cli, () => cmdWorkflowDiagram(id, card));
26295
+ withShared(studio.command("diagram")).argument("<id>", "the studio, from `studio list`").argument("<card>", "the card whose asset folder gets studio.json").summary("write the studio's diagram to .assets/<card>/studio.json and print the <Studio> tag that shows it").action(async function(id, card) {
26296
+ await onBoard2(this, cli, () => cmdStudioDiagram(id, card));
26250
26297
  });
26251
26298
  }
26252
26299
  function declareRuns(program2, cli) {
@@ -26260,7 +26307,7 @@ function declareRuns(program2, cli) {
26260
26307
  withShared(task.command("show")).argument("<task>").summary("a task and its card").action(async function(id) {
26261
26308
  await boardless(this, cli, () => taskShow(id));
26262
26309
  });
26263
- withShared(task.command("create")).argument("<request...>", "what the task should do").summary("create a task").option("--project <id>", "the project; default: this folder\u2019s linked one").option("--workflow <id>", "a name `akb workflow list` shows").action(async function(request2) {
26310
+ withShared(task.command("create")).argument("<request...>", "what the task should do").summary("create a task").option("--project <id>", "the project; default: this folder\u2019s linked one").option("--studio <id>", "a name `akb studio list` shows").action(async function(request2) {
26264
26311
  await boardless(this, cli, () => taskCreate(request2.join(" "), this.opts()));
26265
26312
  });
26266
26313
  withShared(task.command("approve")).argument("<task>").summary("approve the current review point").option("--comment <text>", "a note with the approval").action(async function(id) {
@@ -26286,7 +26333,7 @@ function declareRuns(program2, cli) {
26286
26333
  withShared(task.command("comment")).argument("<task>").argument("<text...>").summary("comment on a task").action(async function(id, text4) {
26287
26334
  await boardless(this, cli, () => taskComment(id, text4.join(" ")));
26288
26335
  });
26289
- 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> [--workflow <id>] [--previews <agents>]; update with goal save --id <goal> and any of --title, --body-file, --workflow, --previews. 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. Workflows are the ones `akb workflow 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("--workflow <id>", "the workflow that does the work, from `akb workflow list`").option("--previews <agents>", "review points, comma-separated; empty clears the selection");
26336
+ 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>] [--previews <agents>]; update with goal save --id <goal> and any of --title, --body-file, --studio, --previews. 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("--previews <agents>", "review points, comma-separated; empty clears the selection");
26290
26337
  goal.action(async function(sub) {
26291
26338
  await boardless(this, cli, () => externalGoalSession() ? cloudGoal([sub], this.opts()) : cmdGoal([sub], this.opts()));
26292
26339
  });
@@ -26377,35 +26424,35 @@ function declareRuns(program2, cli) {
26377
26424
  await boardless(this, cli, (p) => cmdTelemetry([move], p));
26378
26425
  });
26379
26426
  }
26380
- const workflow = withShared(program2.command("workflow")).summary("the workflows this board runs, and the agents each one lists").description(
26381
- "Every card runs through one workflow, kept in Cloud: the built-ins and the workflows this workspace installed or made. To change one of this workspace's own: `pull` it into a folder, edit, `push`. New tasks take the new version; a task already started keeps its own. `akb guide update-workflow` has the whole flow."
26427
+ const studio = withShared(program2.command("studio")).summary("the studios this board runs, and the agents each one lists").description(
26428
+ "Every card runs through one studio, kept in Cloud: the built-ins and the studios this workspace installed or made. To change one of this workspace's own: `pull` it into a folder, edit, `push`. New tasks take the new version; a task already started keeps its own. `akb guide update-studio` has the whole flow."
26382
26429
  ).allowExcessArguments().allowUnknownOption().action(async function() {
26383
26430
  const word = this.args[0];
26384
26431
  if (word === "rename" || word === "diagram") {
26385
- this.error(`\`${cli.program} workflow ${word}\` is now \`${cli.program} raw workflow ${word}\`.`, { code: "commander.unknownCommand" });
26432
+ this.error(`\`${cli.program} studio ${word}\` is now \`${cli.program} raw studio ${word}\`.`, { code: "commander.unknownCommand" });
26386
26433
  }
26387
26434
  if (word) this.error(`unknown command '${word}'`, { code: "commander.unknownCommand" });
26388
- await workflowList(this, cli);
26435
+ await studioList(this, cli);
26389
26436
  });
26390
- const flowWord = (name) => withShared(workflow.command(name));
26391
- flowWord("list").summary("every workflow this workspace can run, with its previews and what each waits on, land and scheduled agents. Offline, the ones downloaded before, marked (offline).").action(async function() {
26392
- await workflowList(this, cli);
26437
+ const flowWord = (name) => withShared(studio.command(name));
26438
+ flowWord("list").summary("every studio this workspace can run, with its previews and what each waits on, land and scheduled agents. Offline, the ones downloaded before, marked (offline).").action(async function() {
26439
+ await studioList(this, cli);
26393
26440
  });
26394
- flowWord("pull").argument("<id>", "the workflow, from `workflow list`").argument("[folder]", "where to write it, empty or new; default ./<id>").summary("write the workflow's current version into a folder to edit").action(async function(id, folder) {
26395
- await onBoard2(this, cli, () => cmdWorkflowPull(id, folder));
26441
+ flowWord("pull").argument("<id>", "the studio, from `studio list`").argument("[folder]", "where to write it, empty or new; default ./<id>").summary("write the studio's current version into a folder to edit").action(async function(id, folder) {
26442
+ await onBoard2(this, cli, () => cmdStudioPull(id, folder));
26396
26443
  });
26397
- flowWord("push").argument("<folder>", "a folder `workflow pull` wrote").option("--dry-run", "check the folder and print what would happen, saving nothing").summary("save the edited folder as the workflow's next version, which new tasks take").action(async function(folder) {
26398
- await boardless(this, cli, () => cmdWorkflowPush(folder, this.opts()));
26444
+ flowWord("push").argument("<folder>", "a folder `studio pull` wrote").option("--dry-run", "check the folder and print what would happen, saving nothing").summary("save the edited folder as the studio's next version, which new tasks take").action(async function(folder) {
26445
+ await boardless(this, cli, () => cmdStudioPush(folder, this.opts()));
26399
26446
  });
26400
- flowWord("rule").argument("<workflow>", "a workflow id from `akb workflow list`").option("--text <text>", "the rules, for a one-liner; empty clears them").option("--file <path>", "the rules, as markdown written to a file first").summary("set a workflow's rules \u2014 what every card on it follows \u2014 in the user's own words").description(
26401
- "Without --text or --file, prints the workflow's current rules. With them, replaces all of them, saved to Cloud for every project in the workspace; empty clears them."
26447
+ flowWord("rule").argument("<studio>", "a studio id from `akb studio list`").option("--text <text>", "the rules, for a one-liner; empty clears them").option("--file <path>", "the rules, as markdown written to a file first").summary("set a studio's rules \u2014 what every card on it follows \u2014 in the user's own words").description(
26448
+ "Without --text or --file, prints the studio's current rules. With them, replaces all of them, saved to Cloud for every project in the workspace; empty clears them."
26402
26449
  ).action(async function(id) {
26403
- await onBoard2(this, cli, () => cmdWorkflowRule(id, this.opts()));
26450
+ await onBoard2(this, cli, () => cmdStudioRule(id, this.opts()));
26404
26451
  });
26405
- flowWord("instructions").argument("<agent>", "an agent `akb workflow list` names").option("--text <text>", "the instructions, for a one-liner; empty clears them").option("--file <path>", "the instructions, as markdown written to a file first").summary("set one agent's instructions \u2014 appended to every run it does \u2014 in the user's own words").description(
26406
- "Without --text or --file, prints the agent's current instructions. With them, replaces all of them. A workflow's agent is the workspace's, shared by every workflow listing it; a board's scheduled agent is this project's. Saved to Cloud; empty clears them."
26452
+ flowWord("instructions").argument("<agent>", "an agent `akb studio list` names").option("--text <text>", "the instructions, for a one-liner; empty clears them").option("--file <path>", "the instructions, as markdown written to a file first").summary("set one agent's instructions \u2014 appended to every run it does \u2014 in the user's own words").description(
26453
+ "Without --text or --file, prints the agent's current instructions. With them, replaces all of them. A studio's agent is the workspace's, shared by every studio listing it; a board's scheduled agent is this project's. Saved to Cloud; empty clears them."
26407
26454
  ).action(async function(agent) {
26408
- await onBoard2(this, cli, () => cmdWorkflowInstructions(agent, this.opts()));
26455
+ await onBoard2(this, cli, () => cmdStudioInstructions(agent, this.opts()));
26409
26456
  });
26410
26457
  withShared(program2.command("guide")).argument("[topic]", "one flow in full; left off, every flow is listed one line each").summary("the flows the board works by, shipped with this command").description(
26411
26458
  "A printed flow already carries the flows its action is done by, so this is for the rest: how the board works at all, the module map, updating, the local UI. `guide board` is the card format, the layout and the memory set."
@@ -26546,14 +26593,14 @@ function declareAgent(program2, cli) {
26546
26593
  ])
26547
26594
  );
26548
26595
  });
26549
- withShared(agent.command("picks", { hidden: true })).argument("<json>", "runtime picks by workflow agent").action(async function(json) {
26596
+ withShared(agent.command("picks", { hidden: true })).argument("<json>", "runtime picks by studio agent").action(async function(json) {
26550
26597
  await onBoard2(this, cli, () => cmdAgent(["picks", json]));
26551
26598
  });
26552
- word("run").argument("<workflow>", "a workflow id, e.g. coding").argument("<agent>", "one of the agents it schedules").summary("run a workflow's scheduled agent once, now").addOption(new Option("-p, --print", "say what to do and start nothing").conflicts("follow")).option("-f, --follow", "watch the log instead of returning").option("--events", "with --follow: print its structured events, one JSON object per line").action(async function(workflow, name) {
26553
- await onBoard2(this, cli, (p) => cmdRunScheduled(workflow, name, this.opts(), p));
26599
+ word("run").argument("<studio>", "a studio id, e.g. coding").argument("<agent>", "one of the agents it schedules").summary("run a studio's scheduled agent once, now").addOption(new Option("-p, --print", "say what to do and start nothing").conflicts("follow")).option("-f, --follow", "watch the log instead of returning").option("--events", "with --follow: print its structured events, one JSON object per line").action(async function(studio, name) {
26600
+ await onBoard2(this, cli, (p) => cmdRunScheduled(studio, name, this.opts(), p));
26554
26601
  });
26555
26602
  }
26556
- var workflowList, positional, RUN_ID, DELIVERY, splitArgs, sentence;
26603
+ var studioList, positional, RUN_ID, DELIVERY, splitArgs, sentence;
26557
26604
  var init_agent2 = __esm({
26558
26605
  "src/lib/cli/agent.ts"() {
26559
26606
  "use strict";
@@ -26562,7 +26609,7 @@ var init_agent2 = __esm({
26562
26609
  init_io();
26563
26610
  init_paths();
26564
26611
  init_board_cli();
26565
- init_cloud_workflows();
26612
+ init_cloud_studios();
26566
26613
  init_flows();
26567
26614
  init_deliveries();
26568
26615
  init_manual();
@@ -26573,7 +26620,7 @@ var init_agent2 = __esm({
26573
26620
  init_goal();
26574
26621
  init_task();
26575
26622
  init_guide2();
26576
- init_workflow2();
26623
+ init_studio2();
26577
26624
  init_run();
26578
26625
  init_triage();
26579
26626
  init_goal();
@@ -26583,9 +26630,9 @@ var init_agent2 = __esm({
26583
26630
  init_harnesses();
26584
26631
  init_moved();
26585
26632
  init_shared2();
26586
- workflowList = (cmd, cli) => !cmd.optsWithGlobals().board && externalGoalSession() ? boardless(cmd, cli, cloudGoalWorkflows) : goalsFile() ? boardless(cmd, cli, () => cmdGoalWorkflows()) : onBoard2(cmd, cli, async () => {
26587
- await syncWorkflows(true);
26588
- return cmdWorkflowList();
26633
+ studioList = (cmd, cli) => !cmd.optsWithGlobals().board && externalGoalSession() ? boardless(cmd, cli, cloudGoalStudios) : goalsFile() ? boardless(cmd, cli, () => cmdGoalStudios()) : onBoard2(cmd, cli, async () => {
26634
+ await syncStudios(true);
26635
+ return cmdStudioList();
26589
26636
  });
26590
26637
  positional = (vals) => vals.slice(0, -2);
26591
26638
  RUN_ID = "a run's id, any prefix of one that names only one run, or `last`. Left out, it means the newest run";
@@ -26679,7 +26726,7 @@ async function repairBoard(root2, report3, named2) {
26679
26726
  moveLegacyMemory(board2, report3);
26680
26727
  dropModuleGoals(board2, report3);
26681
26728
  movePlanRules(board2, report3);
26682
- noteOldWorkflows(board2, report3);
26729
+ noteOldStudios(board2, report3);
26683
26730
  report3.sayDid();
26684
26731
  await boardMove(root2, ["init"], board2);
26685
26732
  moveRuntimes(root2, board2, report3);
@@ -26758,15 +26805,15 @@ var PLAN_LEADS = {
26758
26805
  "carousel-post": ["carousel-planner"],
26759
26806
  "blog-post": ["blog-planner"],
26760
26807
  "video-clone": ["video-cloner"],
26761
- "workflow-builder": ["workflow-writer"]
26808
+ "studio-builder": ["studio-writer"]
26762
26809
  };
26763
26810
  var GONE_LEADS = ["software-planner", "planner"];
26764
26811
  function planLeads(board2) {
26765
26812
  const leads = { ...PLAN_LEADS };
26766
- const root2 = path83.join(board2, "workflows");
26813
+ const root2 = path83.join(board2, "studios");
26767
26814
  for (const entry of fs84.existsSync(root2) ? fs84.readdirSync(root2, { withFileTypes: true }) : []) {
26768
26815
  if (!entry.isDirectory()) continue;
26769
- const meta = splitFrontmatter(read2(path83.join(root2, entry.name, "WORKFLOW.md")) ?? "").meta;
26816
+ const meta = splitFrontmatter(read2(path83.join(root2, entry.name, "STUDIO.md")) ?? "").meta;
26770
26817
  const stages = meta === null ? void 0 : parseYamlBlock(meta).stages;
26771
26818
  const plan = stages && typeof stages === "object" && !Array.isArray(stages) ? stages.plan : void 0;
26772
26819
  const lead = plan && typeof plan === "object" && !Array.isArray(plan) && typeof plan.lead === "string" ? plan.lead.trim() : "";
@@ -26782,7 +26829,7 @@ function movePlanRules(board2, report3) {
26782
26829
  const from = path83.join(rules, `${lead}.md`);
26783
26830
  const rule = read2(from)?.trim();
26784
26831
  if (!rule) continue;
26785
- const to = path83.join(rules, "workflows", `${id}.md`);
26832
+ const to = path83.join(rules, "studios", `${id}.md`);
26786
26833
  const there = read2(to)?.trim() ?? "";
26787
26834
  if (!there.includes(rule)) {
26788
26835
  fs84.mkdirSync(path83.dirname(to), { recursive: true });
@@ -26793,17 +26840,17 @@ function movePlanRules(board2, report3) {
26793
26840
  }
26794
26841
  }
26795
26842
  for (const lead of GONE_LEADS) fs84.rmSync(path83.join(rules, `${lead}.md`), { force: true });
26796
- if (moved.length) report3.did.push(`made each plan agent's rule its workflow's card rule (docs/kanban/rules/workflows/): ${moved.join(", ")}`);
26843
+ if (moved.length) report3.did.push(`made each plan agent's rule its studio's card rule (docs/kanban/rules/studios/): ${moved.join(", ")}`);
26797
26844
  }
26798
- function noteOldWorkflows(board2, report3) {
26845
+ function noteOldStudios(board2, report3) {
26799
26846
  const old = (dir, file, keys) => {
26800
26847
  const root2 = path83.join(board2, dir);
26801
26848
  return (fs84.existsSync(root2) ? fs84.readdirSync(root2, { withFileTypes: true }) : []).filter((e) => e.isDirectory() && keys.test(splitFrontmatter(read2(path83.join(root2, e.name, file)) ?? "").meta ?? "")).map((e) => `docs/kanban/${dir}/${e.name}/${file}`);
26802
26849
  };
26803
- const files = [...old("workflows", "WORKFLOW.md", /^(stages|delivers):/m), ...old("agents", "AGENT.md", /^\s+(hook|lead):/m)];
26850
+ const files = [...old("studios", "STUDIO.md", /^(stages|delivers):/m), ...old("agents", "AGENT.md", /^\s+(hook|lead):/m)];
26804
26851
  if (files.length) {
26805
26852
  report3.notes.push(
26806
- `written in the old form, so not read until rewritten \u2014 list a workflow's agents under \`previews\`, \`land\` and \`scheduled\`, and drop \`hook\`/\`lead\` from each agent (or ask the Workflow builder): ${files.join(", ")}`
26853
+ `written in the old form, so not read until rewritten \u2014 list a studio's agents under \`previews\`, \`land\` and \`scheduled\`, and drop \`hook\`/\`lead\` from each agent (or ask the Studio builder): ${files.join(", ")}`
26807
26854
  );
26808
26855
  }
26809
26856
  }