wildcrane-runner 0.6.43 → 0.6.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/akb/dist/kanban.mjs +675 -628
- package/dist/akb/package.json +1 -1
- package/dist/akb-proxy.mjs +1 -1
- package/dist/launcher.mjs +1538 -705
- package/dist/plugin.mjs +1911 -1078
- package/dist/runner.mjs +1798 -1664
- package/dist/settings.mjs +1576 -743
- package/package.json +1 -1
package/dist/akb/dist/kanban.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// ai4kanban 0.11.
|
|
2
|
+
// ai4kanban 0.11.39 — built by runner/scripts/build.mjs. Do not edit.
|
|
3
3
|
import { createRequire as __ai4kanbanRequire } from 'node:module'
|
|
4
4
|
const require = __ai4kanbanRequire(import.meta.url)
|
|
5
5
|
var __create = Object.create;
|
|
@@ -130,10 +130,10 @@ async function refresh() {
|
|
|
130
130
|
const now = readSession();
|
|
131
131
|
if (!now) return { ok: false, reason: "signed-out" };
|
|
132
132
|
if (!expiringSoon(now)) return { ok: true, token: now.accessToken, session: now };
|
|
133
|
-
const {
|
|
133
|
+
const { api, anonKey } = cloudEndpoints();
|
|
134
134
|
let response;
|
|
135
135
|
try {
|
|
136
|
-
response = await fetch(`${
|
|
136
|
+
response = await fetch(`${api}/auth/v1/token?grant_type=refresh_token`, {
|
|
137
137
|
method: "POST",
|
|
138
138
|
headers: { apikey: anonKey, "content-type": "application/json" },
|
|
139
139
|
body: JSON.stringify({ refresh_token: now.refreshToken })
|
|
@@ -256,7 +256,7 @@ function workspaceTask() {
|
|
|
256
256
|
const id = process.env[TASK_ENV];
|
|
257
257
|
return id && id.trim() ? id.trim() : null;
|
|
258
258
|
}
|
|
259
|
-
function
|
|
259
|
+
function cloudStudio(name) {
|
|
260
260
|
if (/^wf-/.test(name)) return name.replace("-", "_");
|
|
261
261
|
return `wf_builtin_${name.replace(/-/g, "_")}`;
|
|
262
262
|
}
|
|
@@ -288,11 +288,11 @@ async function call(method, route2, body, key) {
|
|
|
288
288
|
async function createTask(from, said2) {
|
|
289
289
|
const source = await call("GET", `/v1/tasks/${encodeURIComponent(from)}`);
|
|
290
290
|
if (!source.ok) return source;
|
|
291
|
-
const
|
|
291
|
+
const studio = said2.studio ? cloudStudio(said2.studio) : source.value.studio?.id;
|
|
292
292
|
const body = {
|
|
293
293
|
title: said2.title,
|
|
294
294
|
project: source.value.project,
|
|
295
|
-
...
|
|
295
|
+
...studio ? { studio } : {},
|
|
296
296
|
...said2.request?.trim() ? { request: said2.request.trim() } : {},
|
|
297
297
|
source: "api",
|
|
298
298
|
source_context: { task: from, ...said2.agent ? { agent: said2.agent } : {} },
|
|
@@ -349,7 +349,7 @@ async function createProjectTask(project2, said2, key) {
|
|
|
349
349
|
title: said2.title,
|
|
350
350
|
project: project2,
|
|
351
351
|
source: "api",
|
|
352
|
-
...said2.
|
|
352
|
+
...said2.studio ? { studio: cloudStudio(said2.studio) } : {},
|
|
353
353
|
...said2.request?.trim() ? { request: said2.request.trim() } : {},
|
|
354
354
|
...said2.agent ? { source_context: { agent: said2.agent } } : {},
|
|
355
355
|
...said2.triage ? { triage: `tri_${project2.replace(/^prj_/, "")}_${said2.triage}` } : {}
|
|
@@ -599,7 +599,7 @@ function setBoard(kanban, root2, flag) {
|
|
|
599
599
|
RELEASES = path5.join(KANBAN, "releases.md");
|
|
600
600
|
RELEASE_SUMMARIES = path5.join(KANBAN, ".release-summaries");
|
|
601
601
|
AGENTS = path5.join(KANBAN, "agents");
|
|
602
|
-
|
|
602
|
+
STUDIOS = path5.join(KANBAN, "studios");
|
|
603
603
|
LEGACY_AGENTS = path5.join(KANBAN, "skills");
|
|
604
604
|
MEMORY = path5.join(KANBAN, "memory");
|
|
605
605
|
AGENT_MEMORY = path5.join(MEMORY, "agents");
|
|
@@ -663,7 +663,7 @@ function useProjectState() {
|
|
|
663
663
|
ensureAkbDir();
|
|
664
664
|
return ensureProjectState(KANBAN, REPO_ROOT);
|
|
665
665
|
}
|
|
666
|
-
var REPO_ROOT, KANBAN, TODO, ARCHIVE, REJECTIONS_TO_REVIEW, ARCHIVE_MD, README, MODULES_MD, CONFIG, KANBAN_GITIGNORE, RELEASES, RELEASE_SUMMARIES, AGENTS,
|
|
666
|
+
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;
|
|
667
667
|
var init_paths = __esm({
|
|
668
668
|
"../cli/src/lib/paths.ts"() {
|
|
669
669
|
"use strict";
|
|
@@ -682,7 +682,7 @@ var init_paths = __esm({
|
|
|
682
682
|
RELEASES = "";
|
|
683
683
|
RELEASE_SUMMARIES = "";
|
|
684
684
|
AGENTS = "";
|
|
685
|
-
|
|
685
|
+
STUDIOS = "";
|
|
686
686
|
LEGACY_AGENTS = "";
|
|
687
687
|
ASSETS = "";
|
|
688
688
|
BOARD_STATE = "";
|
|
@@ -878,7 +878,7 @@ function serializeFrontmatter(m) {
|
|
|
878
878
|
out.push(`blocked_by: [${(m.blocked_by || []).join(", ")}]`);
|
|
879
879
|
out.push(`related: [${(m.related || []).join(", ")}]`);
|
|
880
880
|
out.push(`modules: [${(m.modules || []).join(", ")}]`);
|
|
881
|
-
if (m.
|
|
881
|
+
if (m.studio) out.push(`studio: ${yamlScalar(m.studio)}`);
|
|
882
882
|
if (m.triage) out.push(`triage: ${yamlScalar(m.triage)}`);
|
|
883
883
|
if (m.source?.length) {
|
|
884
884
|
out.push("source:");
|
|
@@ -977,7 +977,7 @@ function parseFrontmatter(text4) {
|
|
|
977
977
|
delete meta.release;
|
|
978
978
|
delete meta.schedule;
|
|
979
979
|
delete meta.roi;
|
|
980
|
-
meta.
|
|
980
|
+
meta.studio = typeof meta.studio === "string" && meta.studio.trim() ? meta.studio.trim() : "";
|
|
981
981
|
meta.triage = typeof meta.triage === "string" ? meta.triage.trim() : "";
|
|
982
982
|
meta.source = (Array.isArray(meta.source) ? meta.source : typeof meta.source === "string" ? [meta.source] : []).map((ref) => String(ref).trim()).filter(Boolean);
|
|
983
983
|
delete meta.phases;
|
|
@@ -1605,9 +1605,9 @@ async function taskList(opts) {
|
|
|
1605
1605
|
}
|
|
1606
1606
|
async function taskShow(id) {
|
|
1607
1607
|
const task = await cloud("GET", `/v1/tasks/${enc(await taskRef(id))}`);
|
|
1608
|
-
const card = task.
|
|
1608
|
+
const card = task.studio ? await cloud("GET", `/v1/tasks/${enc(task.id)}/card`).catch(() => null) : null;
|
|
1609
1609
|
say(`${task.key} ${task.title}`);
|
|
1610
|
-
say(`${task.status}${task.
|
|
1610
|
+
say(`${task.status}${task.studio ? ` ${task.studio.name}` : ""} ${taskUrl(task.key)}`);
|
|
1611
1611
|
if (card?.body) say(`
|
|
1612
1612
|
${card.body.trim()}`);
|
|
1613
1613
|
return { ...task, card };
|
|
@@ -1621,7 +1621,7 @@ async function taskCreate(request2, opts) {
|
|
|
1621
1621
|
title,
|
|
1622
1622
|
request: text4,
|
|
1623
1623
|
project: await project(opts.project),
|
|
1624
|
-
...opts.
|
|
1624
|
+
...opts.studio ? { studio: cloudStudio(opts.studio) } : {},
|
|
1625
1625
|
source: "api"
|
|
1626
1626
|
});
|
|
1627
1627
|
say(`Created ${task.key}: ${task.title} ${taskUrl(task.key)}`);
|
|
@@ -4207,8 +4207,8 @@ var init_package = __esm({
|
|
|
4207
4207
|
"../cli/package.json"() {
|
|
4208
4208
|
package_default = {
|
|
4209
4209
|
name: "wildcrane",
|
|
4210
|
-
version: "0.11.
|
|
4211
|
-
akbContract:
|
|
4210
|
+
version: "0.11.39",
|
|
4211
|
+
akbContract: 10,
|
|
4212
4212
|
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.",
|
|
4213
4213
|
keywords: [
|
|
4214
4214
|
"kanban",
|
|
@@ -6536,8 +6536,8 @@ var init_language = __esm({
|
|
|
6536
6536
|
init_settings2();
|
|
6537
6537
|
LANGUAGE_ENV = "AI4KANBAN_LANGUAGE";
|
|
6538
6538
|
LANGUAGE_LINE_ENV = "AI4KANBAN_LANGUAGE_LINE";
|
|
6539
|
-
SYSTEM_LANGUAGE_ZH = "\u7528\u4E2D\u6587\u56DE\u590D\u3002\u7ED9\u4EFB\u52A1\u521B\u5EFA\u8005\u770B\u7684\u7528\u4E2D\u6587\uFF0C\u5DE5\u4F5C\
|
|
6540
|
-
SYSTEM_LANGUAGE_EN = "Reply in English. Write for the task creator in English; the
|
|
6539
|
+
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";
|
|
6540
|
+
SYSTEM_LANGUAGE_EN = "Reply in English. Write for the task creator in English; the studio's final artifacts follow the project's language.";
|
|
6541
6541
|
systemLanguages = /* @__PURE__ */ new Set([
|
|
6542
6542
|
SYSTEM_LANGUAGE_ZH,
|
|
6543
6543
|
SYSTEM_LANGUAGE_EN,
|
|
@@ -7119,7 +7119,7 @@ function parseStore() {
|
|
|
7119
7119
|
pictures: readPictures(entry.pictures),
|
|
7120
7120
|
stopping: entry.stopping === true ? true : void 0,
|
|
7121
7121
|
unspawned: entry.unspawned === true ? true : void 0,
|
|
7122
|
-
|
|
7122
|
+
studio: typeof entry.studio === "string" && entry.studio ? entry.studio : void 0,
|
|
7123
7123
|
specAgent: typeof entry.specAgent === "string" && entry.specAgent ? entry.specAgent : void 0,
|
|
7124
7124
|
triage: typeof entry.triage === "string" ? entry.triage : void 0,
|
|
7125
7125
|
refineRound: typeof entry.refineRound === "number" && Number.isInteger(entry.refineRound) && entry.refineRound >= 0 ? entry.refineRound : void 0,
|
|
@@ -7237,13 +7237,13 @@ function readDeliveryRow(raw) {
|
|
|
7237
7237
|
// The flow rules this delivery froze (#306). A delivery written down before they
|
|
7238
7238
|
// existed has none, and its runs read the files — which is what they always did.
|
|
7239
7239
|
rules: readRules(entry.rules),
|
|
7240
|
-
// The
|
|
7240
|
+
// The studio this delivery froze (#715). A delivery written down before studios
|
|
7241
7241
|
// existed has none, and its runs read the board — which is what they always did.
|
|
7242
|
-
|
|
7243
|
-
scheduled: entry.scheduled && typeof entry.scheduled.
|
|
7242
|
+
studio: readStudio(entry.studio),
|
|
7243
|
+
scheduled: entry.scheduled && typeof entry.scheduled.studio === "string" && typeof entry.scheduled.agent === "string" ? { studio: entry.scheduled.studio, agent: entry.scheduled.agent } : void 0
|
|
7244
7244
|
};
|
|
7245
7245
|
}
|
|
7246
|
-
function
|
|
7246
|
+
function readStudio(raw) {
|
|
7247
7247
|
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return void 0;
|
|
7248
7248
|
const box2 = raw;
|
|
7249
7249
|
const id = text2(box2.id);
|
|
@@ -8831,14 +8831,14 @@ function agentMemoryBlock(agent) {
|
|
|
8831
8831
|
${file.text || "_(empty)_"}`)
|
|
8832
8832
|
].join("\n\n");
|
|
8833
8833
|
}
|
|
8834
|
-
function specAgentSelector(id,
|
|
8835
|
-
const flow =
|
|
8834
|
+
function specAgentSelector(id, studio, meta) {
|
|
8835
|
+
const flow = studioFor(studio);
|
|
8836
8836
|
if (!flow || !previewAgents(flow).length) return "";
|
|
8837
8837
|
if (!meta?.previews) {
|
|
8838
8838
|
return [
|
|
8839
8839
|
"<preview-agents>",
|
|
8840
8840
|
"This card has not chosen its previews yet. Choose them first: the agents from",
|
|
8841
|
-
`\`akb raw previews --triggers --
|
|
8841
|
+
`\`akb raw previews --triggers --studio ${flow.id}\` whose conditions the card meets, always including those marked \`Always\`. Save them with`,
|
|
8842
8842
|
`\`akb raw update ${id} --previews <agents>\` (\`""\` when that leaves none); its stages follow from them.`,
|
|
8843
8843
|
"Then run only the chosen agents whose `After` is empty \u2014 the first stage; the rest run after its approval.",
|
|
8844
8844
|
`Command: \`akb raw previews <agent> ${id} <short note>\` \u2014 add \`--print\` to run it in this session, as \`akb guide refine\` says.`,
|
|
@@ -8891,13 +8891,13 @@ var init_agents = __esm({
|
|
|
8891
8891
|
init_paths();
|
|
8892
8892
|
init_spec_agent_names();
|
|
8893
8893
|
init_catalog();
|
|
8894
|
-
|
|
8894
|
+
init_studios();
|
|
8895
8895
|
init_catalog();
|
|
8896
8896
|
init_spec_agent_names();
|
|
8897
8897
|
specAgents = () => specAgentCatalog().agents;
|
|
8898
8898
|
specAgentProblems = () => [
|
|
8899
8899
|
...specAgentCatalog().problems,
|
|
8900
|
-
...
|
|
8900
|
+
...studioFileProblems(),
|
|
8901
8901
|
...agentKeyProblems(),
|
|
8902
8902
|
...stageContractProblems()
|
|
8903
8903
|
];
|
|
@@ -8931,8 +8931,8 @@ var init_agents = __esm({
|
|
|
8931
8931
|
const all2 = specAgents();
|
|
8932
8932
|
return names3.map((name) => all2.find((a) => a.name === name)).filter((a) => !!a);
|
|
8933
8933
|
};
|
|
8934
|
-
specAgentAssigned = (name,
|
|
8935
|
-
const flow =
|
|
8934
|
+
specAgentAssigned = (name, studio) => {
|
|
8935
|
+
const flow = studioFor(studio);
|
|
8936
8936
|
const wanted = canonicalSpecAgent(name);
|
|
8937
8937
|
return !!flow && previewAgents(flow).some((h) => h.agent === wanted);
|
|
8938
8938
|
};
|
|
@@ -8940,14 +8940,14 @@ var init_agents = __esm({
|
|
|
8940
8940
|
const there = specAgents().map((a) => a.name);
|
|
8941
8941
|
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.`;
|
|
8942
8942
|
};
|
|
8943
|
-
SPEC_ASSIGN_HOME = "it is switched on in its
|
|
8943
|
+
SPEC_ASSIGN_HOME = "it is switched on in its studio, in the board UI under Configuration \u2192 Studios";
|
|
8944
8944
|
SPEC_AGENT_HOME = "docs/kanban/agents/<name>/AGENT.md";
|
|
8945
8945
|
}
|
|
8946
8946
|
});
|
|
8947
8947
|
|
|
8948
8948
|
// ../cli/src/lib/agent/stages.ts
|
|
8949
|
-
function stageContracts(
|
|
8950
|
-
const flow =
|
|
8949
|
+
function stageContracts(studio) {
|
|
8950
|
+
const flow = studioFor(studio);
|
|
8951
8951
|
if (!flow) return BOARD_STAGES;
|
|
8952
8952
|
return BOARD_STAGES.map((contract) => {
|
|
8953
8953
|
if (contract.stage === "plan") return { ...contract, helpers: previewAgents(flow).map((h) => h.agent) };
|
|
@@ -8983,7 +8983,7 @@ var BOARD_STAGES, BOARD_NODES, stageContract, flowNodes, stageOfFlow, nodeOfFlow
|
|
|
8983
8983
|
var init_stages = __esm({
|
|
8984
8984
|
"../cli/src/lib/agent/stages.ts"() {
|
|
8985
8985
|
"use strict";
|
|
8986
|
-
|
|
8986
|
+
init_studios();
|
|
8987
8987
|
BOARD_STAGES = [
|
|
8988
8988
|
{
|
|
8989
8989
|
stage: "discuss",
|
|
@@ -9011,8 +9011,8 @@ var init_stages = __esm({
|
|
|
9011
9011
|
flows: ["implement", "run"],
|
|
9012
9012
|
input: "the approved card and the rules its delivery froze",
|
|
9013
9013
|
output: "the approved outcome and its recorded results",
|
|
9014
|
-
done: "all
|
|
9015
|
-
// The card
|
|
9014
|
+
done: "all studio steps have recorded completion and the card is archived",
|
|
9015
|
+
// The card studio's first land agent; none without one.
|
|
9016
9016
|
lead: "",
|
|
9017
9017
|
helpers: [],
|
|
9018
9018
|
requires: []
|
|
@@ -9025,21 +9025,21 @@ var init_stages = __esm({
|
|
|
9025
9025
|
{ flow: "review-dismissals", kind: "event", agent: "dismissal-reviewer" },
|
|
9026
9026
|
{ flow: "describe-project", kind: "event", agent: "project-writer" }
|
|
9027
9027
|
];
|
|
9028
|
-
stageContract = (stage,
|
|
9028
|
+
stageContract = (stage, studio) => stageContracts(studio).find((c) => c.stage === stage);
|
|
9029
9029
|
flowNodes = () => BOARD_NODES;
|
|
9030
9030
|
stageOfFlow = (flow) => flow ? BOARD_STAGES.find((c) => c.flows.includes(flow))?.stage : void 0;
|
|
9031
9031
|
nodeOfFlow = (flow) => flow ? flowNodes().find((n) => n.flow === flow) : void 0;
|
|
9032
|
-
agentForFlow = (flow,
|
|
9032
|
+
agentForFlow = (flow, studio) => {
|
|
9033
9033
|
if (!flow) return void 0;
|
|
9034
|
-
const stage = stageContracts(
|
|
9034
|
+
const stage = stageContracts(studio).find((c) => c.flows.includes(flow));
|
|
9035
9035
|
return stage ? stage.lead || void 0 : nodeOfFlow(flow)?.agent;
|
|
9036
9036
|
};
|
|
9037
|
-
flowsOfAgent = (name,
|
|
9037
|
+
flowsOfAgent = (name, studio) => [
|
|
9038
9038
|
.../* @__PURE__ */ new Set([
|
|
9039
|
-
// Across every
|
|
9040
|
-
// in one
|
|
9041
|
-
// flow it runs anywhere. A caller that names a
|
|
9042
|
-
...(
|
|
9039
|
+
// Across every studio this board has, unless one is named: the same agent leads the build
|
|
9040
|
+
// in one studio and nothing in another, and a rule written for it has to reach every
|
|
9041
|
+
// flow it runs anywhere. A caller that names a studio is asking about that one alone.
|
|
9042
|
+
...(studio !== void 0 ? [studio] : studios().map((w) => w.id)).flatMap(
|
|
9043
9043
|
(id) => stageContracts(id).filter((c) => c.lead && c.lead === name).flatMap((c) => c.flows)
|
|
9044
9044
|
),
|
|
9045
9045
|
...flowNodes().filter((n) => n.agent === name).map((n) => n.flow)
|
|
@@ -9054,9 +9054,9 @@ function landRole(name) {
|
|
|
9054
9054
|
const agent = specAgentCatalog().agents.find((a) => a.name === name);
|
|
9055
9055
|
return agent ? { name, gloss: agent.description, memory: [] } : void 0;
|
|
9056
9056
|
}
|
|
9057
|
-
function roleFlowsInOrder(name,
|
|
9057
|
+
function roleFlowsInOrder(name, studio) {
|
|
9058
9058
|
const order = FLOWS.map((flow) => flow.command);
|
|
9059
|
-
return flowsOfAgent(name,
|
|
9059
|
+
return flowsOfAgent(name, studio).sort((a, b) => order.indexOf(a) - order.indexOf(b));
|
|
9060
9060
|
}
|
|
9061
9061
|
function agentRoster() {
|
|
9062
9062
|
const specialists = specAgentCatalog().agents.filter((agent) => !ROLE_NAMES.includes(agent.name)).map((agent) => {
|
|
@@ -9127,7 +9127,7 @@ var init_roles = __esm({
|
|
|
9127
9127
|
gloss: "describes what the project is today, for planning and triage to follow",
|
|
9128
9128
|
memory: ["memory/project.md"]
|
|
9129
9129
|
};
|
|
9130
|
-
SMALL_FIX = "A small fix is a small change whose
|
|
9130
|
+
SMALL_FIX = "A small fix is a small change whose studio needs none of its previews.";
|
|
9131
9131
|
PROPOSER = {
|
|
9132
9132
|
name: "proposer",
|
|
9133
9133
|
gloss: "proposes the work a finished card leaves behind",
|
|
@@ -9142,7 +9142,7 @@ var init_roles = __esm({
|
|
|
9142
9142
|
value: "auto",
|
|
9143
9143
|
label: "Just do them",
|
|
9144
9144
|
cost: "For speed over quality",
|
|
9145
|
-
prompt: `${SMALL_FIX} Do each one instead of proposing it: create it with \`akb raw create --
|
|
9145
|
+
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.`
|
|
9146
9146
|
},
|
|
9147
9147
|
{ value: "propose", label: "Ask me first", cost: "For balancing speed and quality" },
|
|
9148
9148
|
{
|
|
@@ -9158,7 +9158,7 @@ var init_roles = __esm({
|
|
|
9158
9158
|
};
|
|
9159
9159
|
PLANNER_ROLE = {
|
|
9160
9160
|
name: PLANNER,
|
|
9161
|
-
gloss: "plans every card, to its
|
|
9161
|
+
gloss: "plans every card, to its studio's rules",
|
|
9162
9162
|
memory: [PLANNER_DECISIONS, PLANNER_REJECTED, PLANNER_REDESIGN],
|
|
9163
9163
|
hidden: true
|
|
9164
9164
|
};
|
|
@@ -9175,8 +9175,8 @@ var init_roles = __esm({
|
|
|
9175
9175
|
ROLE_NAMES = BOARD_ROLES.map((r) => r.name);
|
|
9176
9176
|
PLANNING_ROLE = PLANNER_ROLE.name;
|
|
9177
9177
|
roles = () => BOARD_ROLES;
|
|
9178
|
-
roleForFlow = (flow,
|
|
9179
|
-
const name = agentForFlow(flow,
|
|
9178
|
+
roleForFlow = (flow, studio) => {
|
|
9179
|
+
const name = agentForFlow(flow, studio);
|
|
9180
9180
|
return name ? roleNamed(name) ?? landRole(name) : void 0;
|
|
9181
9181
|
};
|
|
9182
9182
|
roleNamed = (name) => roles().find((role) => role.name === name);
|
|
@@ -9192,14 +9192,24 @@ var init_roles = __esm({
|
|
|
9192
9192
|
});
|
|
9193
9193
|
|
|
9194
9194
|
// ../cli/src/lib/shared/board-files.ts
|
|
9195
|
-
|
|
9195
|
+
function studioRenamed(path85, content) {
|
|
9196
|
+
const to = path85.replace(/^(rules\/)?workflows\//, "$1studios/").replace(/^(studios\/[^/]+)\/WORKFLOW\.md$/, "$1/STUDIO.md");
|
|
9197
|
+
if (!to.endsWith(".md")) return { path: to, content };
|
|
9198
|
+
if (to.startsWith("studios/")) return { path: to, content: content.replace(/^(icon:\s*["']?)workflow(-kit)?(["']?\s*)$/gm, "$1studio$2$3") };
|
|
9199
|
+
const front = /^(?:todo|triage)\//.test(to) ? /^---\r?\n[\s\S]*?\r?\n---/.exec(content)?.[0] : void 0;
|
|
9200
|
+
if (!front) return { path: to, content };
|
|
9201
|
+
const body = content.slice(front.length).replace(/^<Workflow(?=[\s/>])/gm, "<Studio");
|
|
9202
|
+
const renamed = front.replace(/^workflow:[ \t]*(.*)$/m, (_, id) => `studio: ${id === "workflow-builder" ? "studio-builder" : id}`);
|
|
9203
|
+
return { path: to, content: renamed + body };
|
|
9204
|
+
}
|
|
9205
|
+
var BOARD_FILE_LIMIT, cardSlug, studioFolder, studioName, draftFolder;
|
|
9196
9206
|
var init_board_files = __esm({
|
|
9197
9207
|
"../cli/src/lib/shared/board-files.ts"() {
|
|
9198
9208
|
"use strict";
|
|
9199
9209
|
BOARD_FILE_LIMIT = 256 * 1024;
|
|
9200
9210
|
cardSlug = (task) => task.toLowerCase().replace(/_/g, "-");
|
|
9201
|
-
|
|
9202
|
-
|
|
9211
|
+
studioFolder = (id) => id.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
9212
|
+
studioName = (id) => id.startsWith("wf_builtin_") ? id.slice("wf_builtin_".length).replace(/_/g, "-") : studioFolder(id);
|
|
9203
9213
|
draftFolder = (task) => cardSlug(task);
|
|
9204
9214
|
}
|
|
9205
9215
|
});
|
|
@@ -9264,7 +9274,7 @@ var init_icon = __esm({
|
|
|
9264
9274
|
"schema",
|
|
9265
9275
|
"compare",
|
|
9266
9276
|
"stack",
|
|
9267
|
-
"
|
|
9277
|
+
"studio",
|
|
9268
9278
|
"code",
|
|
9269
9279
|
"checklist",
|
|
9270
9280
|
"card",
|
|
@@ -9283,7 +9293,7 @@ var init_icon = __esm({
|
|
|
9283
9293
|
"blog",
|
|
9284
9294
|
"deck",
|
|
9285
9295
|
"video-clone",
|
|
9286
|
-
"
|
|
9296
|
+
"studio-kit"
|
|
9287
9297
|
];
|
|
9288
9298
|
ICON_COLORS = ["k", "w", "c", "g", "o", "p", "s", "m", "l", "r", "y"];
|
|
9289
9299
|
PATH = /^[MmLlHhVvCcSsQqTtAaZz0-9.,\s-]+$/;
|
|
@@ -9423,7 +9433,7 @@ function parseSpecAgent(text4, from, file, builtIn = false, list = () => []) {
|
|
|
9423
9433
|
const old = OLD_ROLE_KEYS.filter((key) => akb[key] !== void 0);
|
|
9424
9434
|
if (old.length) {
|
|
9425
9435
|
return bad(
|
|
9426
|
-
`\`${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
|
|
9436
|
+
`\`${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`,
|
|
9427
9437
|
{ keys: old }
|
|
9428
9438
|
);
|
|
9429
9439
|
}
|
|
@@ -9520,7 +9530,7 @@ var init_parse = __esm({
|
|
|
9520
9530
|
}
|
|
9521
9531
|
});
|
|
9522
9532
|
|
|
9523
|
-
// ../cli/src/lib/agent/
|
|
9533
|
+
// ../cli/src/lib/agent/studio-def.ts
|
|
9524
9534
|
function agentLines2(agents, indent2) {
|
|
9525
9535
|
return agents.flatMap(
|
|
9526
9536
|
(h) => !h.extra && !h.off ? [`${indent2}- ${scalar(h.agent)}`] : [
|
|
@@ -9558,8 +9568,8 @@ function stagesOf(chosen, after2) {
|
|
|
9558
9568
|
for (const name of chosen) (stages[stageOf(name)] ??= []).push(name);
|
|
9559
9569
|
return stages.filter(Boolean);
|
|
9560
9570
|
}
|
|
9561
|
-
function
|
|
9562
|
-
if (!
|
|
9571
|
+
function parseStudioFile(id, source, from) {
|
|
9572
|
+
if (!STUDIO_ID.test(id)) return { problem: `${from}: \`${id}\` is not a studio id \u2014 use lowercase letters, digits and dashes` };
|
|
9563
9573
|
const { meta, body } = splitFrontmatter(source);
|
|
9564
9574
|
if (meta === null) return { problem: `${from}: no \`---\` frontmatter` };
|
|
9565
9575
|
const raw = parseYamlBlock(meta);
|
|
@@ -9568,7 +9578,7 @@ function parseWorkflowFile(id, source, from) {
|
|
|
9568
9578
|
const old = OLD_KEYS.filter((key) => key in raw);
|
|
9569
9579
|
if (old.length) {
|
|
9570
9580
|
return {
|
|
9571
|
-
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
|
|
9581
|
+
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`
|
|
9572
9582
|
};
|
|
9573
9583
|
}
|
|
9574
9584
|
const icon = readIcon(raw.icon);
|
|
@@ -9609,9 +9619,9 @@ function parseWorkflowFile(id, source, from) {
|
|
|
9609
9619
|
}
|
|
9610
9620
|
};
|
|
9611
9621
|
}
|
|
9612
|
-
var scalar, plain, flowList, groupLines,
|
|
9613
|
-
var
|
|
9614
|
-
"../cli/src/lib/agent/
|
|
9622
|
+
var scalar, plain, flowList, groupLines, STUDIO_ID, OLD_KEYS, box, text3, readGroup;
|
|
9623
|
+
var init_studio_def = __esm({
|
|
9624
|
+
"../cli/src/lib/agent/studio-def.ts"() {
|
|
9615
9625
|
"use strict";
|
|
9616
9626
|
init_icon();
|
|
9617
9627
|
init_yaml2();
|
|
@@ -9621,7 +9631,7 @@ var init_workflow_def = __esm({
|
|
|
9621
9631
|
plain = (agents) => agents.every((h) => !h.extra && !h.off);
|
|
9622
9632
|
flowList = (agents) => `[${agents.map((h) => scalar(h.agent)).join(", ")}]`;
|
|
9623
9633
|
groupLines = (key, agents) => !agents.length ? [] : plain(agents) ? [`${key}: ${flowList(agents)}`] : [`${key}:`, ...agentLines2(agents, " ")];
|
|
9624
|
-
|
|
9634
|
+
STUDIO_ID = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
9625
9635
|
OLD_KEYS = ["stages", "delivers", "helpers", "every"];
|
|
9626
9636
|
box = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
9627
9637
|
text3 = (value) => typeof value === "string" ? value.trim() : "";
|
|
@@ -9629,8 +9639,8 @@ var init_workflow_def = __esm({
|
|
|
9629
9639
|
}
|
|
9630
9640
|
});
|
|
9631
9641
|
|
|
9632
|
-
// ../cli/src/lib/agent/
|
|
9633
|
-
function
|
|
9642
|
+
// ../cli/src/lib/agent/studio-diagram.ts
|
|
9643
|
+
function studioDiagram(def, agentOf2) {
|
|
9634
9644
|
const step = (name) => {
|
|
9635
9645
|
const agent = agentOf2(name);
|
|
9636
9646
|
const en = agent?.i18n.en?.title || name;
|
|
@@ -9650,14 +9660,14 @@ function workflowDiagram(def, agentOf2) {
|
|
|
9650
9660
|
scheduled: def.scheduled.map((s) => ({ ...step(s.agent), ...s.cadence ? { cadence: s.cadence } : {} }))
|
|
9651
9661
|
};
|
|
9652
9662
|
}
|
|
9653
|
-
var
|
|
9654
|
-
"../cli/src/lib/agent/
|
|
9663
|
+
var init_studio_diagram = __esm({
|
|
9664
|
+
"../cli/src/lib/agent/studio-diagram.ts"() {
|
|
9655
9665
|
"use strict";
|
|
9656
|
-
|
|
9666
|
+
init_studio_def();
|
|
9657
9667
|
}
|
|
9658
9668
|
});
|
|
9659
9669
|
|
|
9660
|
-
// ../cli/src/lib/shared/
|
|
9670
|
+
// ../cli/src/lib/shared/studio-files.ts
|
|
9661
9671
|
function folderPath(file, top) {
|
|
9662
9672
|
const parts = file.split("/");
|
|
9663
9673
|
if (parts.length < 3 || parts[0] !== top || !AGENT_NAME.test(parts[1])) return null;
|
|
@@ -9682,7 +9692,7 @@ function mcpProblem(text4) {
|
|
|
9682
9692
|
}
|
|
9683
9693
|
return null;
|
|
9684
9694
|
}
|
|
9685
|
-
function
|
|
9695
|
+
function checkStudioFiles(value, official = false) {
|
|
9686
9696
|
const read3 = inspect(value, official);
|
|
9687
9697
|
const first = read3.problems[0];
|
|
9688
9698
|
return first ? { ok: false, ...first } : { ok: true, def: read3.def, files: read3.files };
|
|
@@ -9713,7 +9723,7 @@ function inspect(value, official) {
|
|
|
9713
9723
|
if (size > FILE_LIMITS.file) return fail(file, `is larger than ${FILE_LIMITS.file / KB} KB`, true);
|
|
9714
9724
|
total += size;
|
|
9715
9725
|
if (total > FILE_LIMITS.total) return fail("files", `are larger than ${FILE_LIMITS.total / KB / KB} MB together`, true);
|
|
9716
|
-
if (file ===
|
|
9726
|
+
if (file === STUDIO_FILE) continue;
|
|
9717
9727
|
if (official && file === MCP_FILE) {
|
|
9718
9728
|
const problem = mcpProblem(text4);
|
|
9719
9729
|
if (problem) fail(file, problem);
|
|
@@ -9727,7 +9737,7 @@ function inspect(value, official) {
|
|
|
9727
9737
|
}
|
|
9728
9738
|
const at = folderPath(file, "agents");
|
|
9729
9739
|
if (!at) {
|
|
9730
|
-
fail(file, `is neither ${
|
|
9740
|
+
fail(file, `is neither ${STUDIO_FILE} nor inside agents/<name>/`);
|
|
9731
9741
|
continue;
|
|
9732
9742
|
}
|
|
9733
9743
|
if (!folders2.has(at[0])) folders2.set(at[0], /* @__PURE__ */ new Map());
|
|
@@ -9736,10 +9746,10 @@ function inspect(value, official) {
|
|
|
9736
9746
|
for (const name of skills) {
|
|
9737
9747
|
if (files[`skills/${name}/SKILL.md`] === void 0) fail(`skills/${name}/SKILL.md`, "is missing");
|
|
9738
9748
|
}
|
|
9739
|
-
const source = files[
|
|
9740
|
-
const read3 = typeof source === "string" ?
|
|
9741
|
-
if (!read3) fail(
|
|
9742
|
-
else if ("problem" in read3) fail(
|
|
9749
|
+
const source = files[STUDIO_FILE];
|
|
9750
|
+
const read3 = typeof source === "string" ? parseStudioFile("studio", source, STUDIO_FILE) : null;
|
|
9751
|
+
if (!read3) fail(STUDIO_FILE, "is missing");
|
|
9752
|
+
else if ("problem" in read3) fail(STUDIO_FILE, read3.problem.replace(`${STUDIO_FILE}: `, ""));
|
|
9743
9753
|
const agents = /* @__PURE__ */ new Map();
|
|
9744
9754
|
for (const [name, own] of folders2) {
|
|
9745
9755
|
const from = `agents/${name}/AGENT.md`;
|
|
@@ -9761,18 +9771,18 @@ function inspect(value, official) {
|
|
|
9761
9771
|
...def.scheduled.map((s) => [s.agent, "it schedules"])
|
|
9762
9772
|
];
|
|
9763
9773
|
for (const [name, why2] of named2) {
|
|
9764
|
-
if (!agents.has(name) && !folders2.has(name)) fail(
|
|
9774
|
+
if (!agents.has(name) && !folders2.has(name)) fail(STUDIO_FILE, `${why2} \`${name}\`, which has no agents/${name}/AGENT.md`);
|
|
9765
9775
|
}
|
|
9766
9776
|
return { problems, def, files };
|
|
9767
9777
|
}
|
|
9768
|
-
var
|
|
9769
|
-
var
|
|
9770
|
-
"../cli/src/lib/shared/
|
|
9778
|
+
var STUDIO_FILE, MCP_FILE, VERSION_FILE, versionText, KB, FILE_LIMITS, officialId, hashInput, landsOf, SEGMENT, isAboutFile, bytes, studioFilesProblems;
|
|
9779
|
+
var init_studio_files = __esm({
|
|
9780
|
+
"../cli/src/lib/shared/studio-files.ts"() {
|
|
9771
9781
|
"use strict";
|
|
9772
|
-
|
|
9782
|
+
init_studio_def();
|
|
9773
9783
|
init_parse();
|
|
9774
|
-
|
|
9775
|
-
|
|
9784
|
+
init_studio_diagram();
|
|
9785
|
+
STUDIO_FILE = "STUDIO.md";
|
|
9776
9786
|
MCP_FILE = "mcp.json";
|
|
9777
9787
|
VERSION_FILE = "version.json";
|
|
9778
9788
|
versionText = (id, version) => `${JSON.stringify({ id, version })}
|
|
@@ -9785,11 +9795,11 @@ var init_workflow_files = __esm({
|
|
|
9785
9795
|
SEGMENT = /^[\w.-]+$/;
|
|
9786
9796
|
isAboutFile = (file) => /^ABOUT(\.[a-z]{2})?\.md$/.test(file) || /^screenshots\/[\w.-]+\.(png|jpe?g|webp)$/.test(file);
|
|
9787
9797
|
bytes = (text4) => new TextEncoder().encode(text4).length;
|
|
9788
|
-
|
|
9798
|
+
studioFilesProblems = (value, official = false) => inspect(value, official).problems;
|
|
9789
9799
|
}
|
|
9790
9800
|
});
|
|
9791
9801
|
|
|
9792
|
-
// ../cli/src/lib/agent/
|
|
9802
|
+
// ../cli/src/lib/agent/studio-folder.ts
|
|
9793
9803
|
import fs28 from "node:fs";
|
|
9794
9804
|
import path32 from "node:path";
|
|
9795
9805
|
function filesOf(dir, base = dir) {
|
|
@@ -9798,17 +9808,17 @@ function filesOf(dir, base = dir) {
|
|
|
9798
9808
|
return e.isDirectory() ? filesOf(full, base) : [path32.relative(base, full).split(path32.sep).join("/")];
|
|
9799
9809
|
});
|
|
9800
9810
|
}
|
|
9801
|
-
function
|
|
9811
|
+
function readStudioFile(dir, file) {
|
|
9802
9812
|
const full = path32.join(dir, file);
|
|
9803
9813
|
return isAboutFile(file) && !file.endsWith(".md") ? `data:${MIME[path32.extname(file)]};base64,${fs28.readFileSync(full).toString("base64")}` : fs28.readFileSync(full, "utf8");
|
|
9804
9814
|
}
|
|
9805
|
-
var MIME,
|
|
9806
|
-
var
|
|
9807
|
-
"../cli/src/lib/agent/
|
|
9815
|
+
var MIME, readStudioFolder;
|
|
9816
|
+
var init_studio_folder = __esm({
|
|
9817
|
+
"../cli/src/lib/agent/studio-folder.ts"() {
|
|
9808
9818
|
"use strict";
|
|
9809
|
-
|
|
9819
|
+
init_studio_files();
|
|
9810
9820
|
MIME = { ".png": "image/png", ".jpg": "image/jpeg", ".jpeg": "image/jpeg", ".webp": "image/webp" };
|
|
9811
|
-
|
|
9821
|
+
readStudioFolder = (dir) => Object.fromEntries(filesOf(dir).sort().map((f) => [f, readStudioFile(dir, f)]));
|
|
9812
9822
|
}
|
|
9813
9823
|
});
|
|
9814
9824
|
|
|
@@ -9821,32 +9831,32 @@ function packOfficial(root2 = OFFICIAL, loose = false) {
|
|
|
9821
9831
|
const agentsDir = path33.join(root2, "agents");
|
|
9822
9832
|
const agentFiles = Object.fromEntries(dirs(agentsDir).map((name) => {
|
|
9823
9833
|
const dir = path33.join(agentsDir, name);
|
|
9824
|
-
return [name,
|
|
9834
|
+
return [name, readStudioFolder(dir)];
|
|
9825
9835
|
}));
|
|
9826
9836
|
for (const [name, own] of Object.entries(loose ? {} : agentFiles)) {
|
|
9827
9837
|
const read3 = parseSpecAgent(own["AGENT.md"] ?? "", `official/agents/${name}/AGENT.md`, (p) => own[p] ?? null, true);
|
|
9828
9838
|
if ("problem" in read3) throw new Error(read3.problem);
|
|
9829
9839
|
}
|
|
9830
|
-
const
|
|
9831
|
-
return dirs(
|
|
9832
|
-
const dir = path33.join(
|
|
9840
|
+
const studiosDir = path33.join(root2, "studios");
|
|
9841
|
+
return dirs(studiosDir).map((folder) => {
|
|
9842
|
+
const dir = path33.join(studiosDir, folder);
|
|
9833
9843
|
const files = {};
|
|
9834
9844
|
for (const f of filesOf(dir).sort()) {
|
|
9835
|
-
if (f ===
|
|
9845
|
+
if (f === STUDIO_FILE || f === MCP_FILE || f.startsWith("skills/") || isAboutFile(f)) files[f] = readStudioFile(dir, f);
|
|
9836
9846
|
}
|
|
9837
|
-
const read3 =
|
|
9847
|
+
const read3 = checkStudioFiles({ [STUDIO_FILE]: files[STUDIO_FILE], ...Object.fromEntries(
|
|
9838
9848
|
Object.entries(agentFiles).flatMap(([name, own]) => Object.entries(own).map(([f, t]) => [`agents/${name}/${f}`, t]))
|
|
9839
9849
|
) });
|
|
9840
|
-
if (!read3.ok && !loose) throw new Error(`official/
|
|
9841
|
-
const parsed =
|
|
9850
|
+
if (!read3.ok && !loose) throw new Error(`official/studios/${folder}: ${read3.file}: ${read3.reason}`);
|
|
9851
|
+
const parsed = parseStudioFile(folder, files[STUDIO_FILE] ?? "", STUDIO_FILE);
|
|
9842
9852
|
if ("problem" in parsed) throw new Error(parsed.problem);
|
|
9843
9853
|
const def = parsed.def;
|
|
9844
9854
|
for (const name of [...new Set([...def.previews, ...def.land, ...def.scheduled].map((h) => h.agent))].sort()) {
|
|
9845
9855
|
for (const [f, text4] of Object.entries(agentFiles[name] ?? {})) files[`agents/${name}/${f}`] = text4;
|
|
9846
9856
|
}
|
|
9847
|
-
const checked = loose ? { ok: true } :
|
|
9848
|
-
if (!checked.ok) throw new Error(`official/
|
|
9849
|
-
if (!def.names?.zh && !loose) throw new Error(`official/
|
|
9857
|
+
const checked = loose ? { ok: true } : checkStudioFiles(files, true);
|
|
9858
|
+
if (!checked.ok) throw new Error(`official/studios/${folder}: ${checked.file}: ${checked.reason}`);
|
|
9859
|
+
if (!def.names?.zh && !loose) throw new Error(`official/studios/${folder}/${STUDIO_FILE}: add its Chinese name under \`names: zh\``);
|
|
9850
9860
|
return {
|
|
9851
9861
|
id: officialId(folder),
|
|
9852
9862
|
name: def.name,
|
|
@@ -9863,16 +9873,16 @@ var OFFICIAL, dirs, hashOf;
|
|
|
9863
9873
|
var init_pack = __esm({
|
|
9864
9874
|
"../official/pack.ts"() {
|
|
9865
9875
|
init_parse();
|
|
9866
|
-
|
|
9867
|
-
|
|
9868
|
-
|
|
9876
|
+
init_studio_def();
|
|
9877
|
+
init_studio_folder();
|
|
9878
|
+
init_studio_files();
|
|
9869
9879
|
OFFICIAL = path33.dirname(fileURLToPath2(import.meta.url));
|
|
9870
9880
|
dirs = (dir) => fs29.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name).sort();
|
|
9871
9881
|
hashOf = (files) => crypto2.createHash("sha256").update(hashInput(files)).digest("hex");
|
|
9872
9882
|
}
|
|
9873
9883
|
});
|
|
9874
9884
|
|
|
9875
|
-
// ../cli/src/lib/agent/cloud-
|
|
9885
|
+
// ../cli/src/lib/agent/cloud-studios.ts
|
|
9876
9886
|
import fs30 from "node:fs";
|
|
9877
9887
|
import path34 from "node:path";
|
|
9878
9888
|
function readJson(file) {
|
|
@@ -9889,14 +9899,14 @@ function writeJson(file, value) {
|
|
|
9889
9899
|
`);
|
|
9890
9900
|
fs30.renameSync(tmp, file);
|
|
9891
9901
|
}
|
|
9892
|
-
function
|
|
9902
|
+
function heldStudioName(name) {
|
|
9893
9903
|
let files;
|
|
9894
9904
|
try {
|
|
9895
9905
|
files = fs30.readdirSync(path34.join(root(), "versions"));
|
|
9896
9906
|
} catch {
|
|
9897
9907
|
return "";
|
|
9898
9908
|
}
|
|
9899
|
-
const held4 = files.filter((f) => f.endsWith(".json")).map((f) => f.slice(0, f.lastIndexOf("@"))).find((id) =>
|
|
9909
|
+
const held4 = files.filter((f) => f.endsWith(".json")).map((f) => f.slice(0, f.lastIndexOf("@"))).find((id) => studioName(id) === name);
|
|
9900
9910
|
if (!held4) return "";
|
|
9901
9911
|
const file = files.filter((f) => f.startsWith(`${held4}@`)).sort().pop();
|
|
9902
9912
|
return readJson(path34.join(root(), "versions", file))?.name ?? "";
|
|
@@ -9907,9 +9917,9 @@ function saveVersion(held4) {
|
|
|
9907
9917
|
}
|
|
9908
9918
|
function savePin(task, held4) {
|
|
9909
9919
|
saveVersion(held4);
|
|
9910
|
-
writeJson(pinFile(task), {
|
|
9920
|
+
writeJson(pinFile(task), { studio: held4.id, version: held4.version });
|
|
9911
9921
|
}
|
|
9912
|
-
function
|
|
9922
|
+
function studiosReachable() {
|
|
9913
9923
|
if (devFolder()) return { ok: true };
|
|
9914
9924
|
return boardProject() && readSession() ? { ok: true } : { ok: false, kind: "needs-cloud" };
|
|
9915
9925
|
}
|
|
@@ -9917,27 +9927,27 @@ function pinMissing() {
|
|
|
9917
9927
|
const task = workspaceTask();
|
|
9918
9928
|
if (devFolder() || !task) return false;
|
|
9919
9929
|
const pin = readPin(task);
|
|
9920
|
-
return !(pin && readVersion(pin.
|
|
9930
|
+
return !(pin && readVersion(pin.studio, pin.version));
|
|
9921
9931
|
}
|
|
9922
9932
|
async function versionOf(id, version) {
|
|
9923
9933
|
const held4 = readVersion(id, version);
|
|
9924
9934
|
if (held4) return { ok: true, value: held4 };
|
|
9925
|
-
const read3 = await call("GET", `/v1/
|
|
9935
|
+
const read3 = await call("GET", `/v1/studios/${encodeURIComponent(id)}`);
|
|
9926
9936
|
if (!read3.ok) return read3;
|
|
9927
9937
|
saveVersion(read3.value);
|
|
9928
9938
|
return read3;
|
|
9929
9939
|
}
|
|
9930
9940
|
async function pinTask(task) {
|
|
9931
9941
|
const pin = readPin(task);
|
|
9932
|
-
const held4 = pin && readVersion(pin.
|
|
9942
|
+
const held4 = pin && readVersion(pin.studio, pin.version);
|
|
9933
9943
|
if (held4) return { ok: true, value: held4 };
|
|
9934
|
-
const read3 = await call("GET", `/v1/tasks/${encodeURIComponent(task)}/
|
|
9944
|
+
const read3 = await call("GET", `/v1/tasks/${encodeURIComponent(task)}/studio`);
|
|
9935
9945
|
if (!read3.ok) return read3;
|
|
9936
|
-
const value = { id: read3.value.
|
|
9946
|
+
const value = { id: read3.value.studio, version: read3.value.version, name: read3.value.name, files: read3.value.files };
|
|
9937
9947
|
savePin(task, value);
|
|
9938
9948
|
return { ok: true, value };
|
|
9939
9949
|
}
|
|
9940
|
-
async function
|
|
9950
|
+
async function syncStudios(force = false) {
|
|
9941
9951
|
offline = false;
|
|
9942
9952
|
const project2 = boardProject();
|
|
9943
9953
|
if (devFolder() || !project2 || !cloudConfigured() || !readSession()) return;
|
|
@@ -9964,7 +9974,7 @@ async function syncWorkflows(force = false) {
|
|
|
9964
9974
|
do {
|
|
9965
9975
|
const page = await call(
|
|
9966
9976
|
"GET",
|
|
9967
|
-
`/v1/
|
|
9977
|
+
`/v1/studios?workspace=${encodeURIComponent(workspace2)}&limit=100${after2 ? `&after=${encodeURIComponent(after2)}` : ""}`
|
|
9968
9978
|
);
|
|
9969
9979
|
if (!page.ok) {
|
|
9970
9980
|
offline = !page.code;
|
|
@@ -9979,7 +9989,7 @@ async function syncWorkflows(force = false) {
|
|
|
9979
9989
|
if (read3.ok) kept2.push({ id: read3.value.id, version: read3.value.version });
|
|
9980
9990
|
else if (!read3.code) offline = true;
|
|
9981
9991
|
}
|
|
9982
|
-
writeJson(listFile(project2), { at: (/* @__PURE__ */ new Date()).toISOString(), workspace: workspace2,
|
|
9992
|
+
writeJson(listFile(project2), { at: (/* @__PURE__ */ new Date()).toISOString(), workspace: workspace2, studios: kept2 });
|
|
9983
9993
|
} catch {
|
|
9984
9994
|
offline = true;
|
|
9985
9995
|
}
|
|
@@ -9991,14 +10001,14 @@ function readFlows() {
|
|
|
9991
10001
|
}
|
|
9992
10002
|
const project2 = boardProject();
|
|
9993
10003
|
if (!project2 || !readSession()) return [];
|
|
9994
|
-
const list = readJson(listFile(project2))?.
|
|
10004
|
+
const list = readJson(listFile(project2))?.studios ?? [];
|
|
9995
10005
|
const flows2 = list.flatMap((w) => {
|
|
9996
10006
|
const held4 = readVersion(w.id, w.version);
|
|
9997
10007
|
return held4 ? flowOf(held4) ?? [] : [];
|
|
9998
10008
|
});
|
|
9999
10009
|
const task = workspaceTask();
|
|
10000
10010
|
const pin = task ? readPin(task) : null;
|
|
10001
|
-
const pinned2 = pin && readVersion(pin.
|
|
10011
|
+
const pinned2 = pin && readVersion(pin.studio, pin.version);
|
|
10002
10012
|
const mine = pinned2 && flowOf(pinned2);
|
|
10003
10013
|
if (!mine) return flows2;
|
|
10004
10014
|
return [mine, ...flows2.filter((f) => f.cloudId !== mine.cloudId)];
|
|
@@ -10020,9 +10030,9 @@ function cloudAgentFiles() {
|
|
|
10020
10030
|
}
|
|
10021
10031
|
return { files, official };
|
|
10022
10032
|
}
|
|
10023
|
-
var DEV, FRESH_MS2, root, safe, versionFile, listFile, pinFile, readVersion, readPin, boardProject, devFolder, NEEDS_CLOUD, NOT_DOWNLOADED, offline,
|
|
10024
|
-
var
|
|
10025
|
-
"../cli/src/lib/agent/cloud-
|
|
10033
|
+
var DEV, FRESH_MS2, root, safe, versionFile, listFile, pinFile, readVersion, readPin, boardProject, devFolder, NEEDS_CLOUD, NOT_DOWNLOADED, offline, studiosOffline, flowOf, sources, flows, cloudStudioSources, cloudFlows;
|
|
10034
|
+
var init_cloud_studios = __esm({
|
|
10035
|
+
"../cli/src/lib/agent/cloud-studios.ts"() {
|
|
10026
10036
|
"use strict";
|
|
10027
10037
|
init_board_files();
|
|
10028
10038
|
init_pack();
|
|
@@ -10032,10 +10042,10 @@ var init_cloud_workflows = __esm({
|
|
|
10032
10042
|
init_file_memo();
|
|
10033
10043
|
init_home();
|
|
10034
10044
|
init_paths();
|
|
10035
|
-
|
|
10036
|
-
DEV = "
|
|
10045
|
+
init_studio_def();
|
|
10046
|
+
DEV = "AI4KANBAN_STUDIOS";
|
|
10037
10047
|
FRESH_MS2 = 6e4;
|
|
10038
|
-
root = () => path34.join(machineHome(), "
|
|
10048
|
+
root = () => path34.join(machineHome(), "studios");
|
|
10039
10049
|
safe = (name) => name.replace(/[^\w.@-]/g, "_");
|
|
10040
10050
|
versionFile = (id, version) => path34.join(root(), "versions", `${safe(id)}@${version}.json`);
|
|
10041
10051
|
listFile = (project2) => path34.join(root(), "lists", `${safe(project2)}.json`);
|
|
@@ -10044,13 +10054,13 @@ var init_cloud_workflows = __esm({
|
|
|
10044
10054
|
readPin = (task) => readJson(pinFile(task));
|
|
10045
10055
|
boardProject = () => KANBAN ? runnerProject(KANBAN) : null;
|
|
10046
10056
|
devFolder = () => process.env[DEV]?.trim() || "";
|
|
10047
|
-
NEEDS_CLOUD = "Sign in to run
|
|
10048
|
-
NOT_DOWNLOADED = "This
|
|
10057
|
+
NEEDS_CLOUD = "Sign in to run studios.";
|
|
10058
|
+
NOT_DOWNLOADED = "This studio isn't downloaded yet. Connect and try again.";
|
|
10049
10059
|
offline = false;
|
|
10050
|
-
|
|
10060
|
+
studiosOffline = () => offline;
|
|
10051
10061
|
flowOf = (held4) => {
|
|
10052
|
-
const id =
|
|
10053
|
-
const read3 =
|
|
10062
|
+
const id = studioName(held4.id);
|
|
10063
|
+
const read3 = parseStudioFile(id, held4.files["STUDIO.md"] ?? "", `the \`${id}\` studio`);
|
|
10054
10064
|
if ("problem" in read3) return null;
|
|
10055
10065
|
return { def: read3.def, cloudId: held4.id, version: held4.version, builtIn: held4.id.startsWith("wf_builtin_"), files: held4.files };
|
|
10056
10066
|
};
|
|
@@ -10061,7 +10071,7 @@ var init_cloud_workflows = __esm({
|
|
|
10061
10071
|
return [sessionFile(), ...project2 ? [listFile(project2)] : [], ...task ? [pinFile(task)] : []];
|
|
10062
10072
|
};
|
|
10063
10073
|
flows = memoByFiles(sources, readFlows);
|
|
10064
|
-
|
|
10074
|
+
cloudStudioSources = sources;
|
|
10065
10075
|
cloudFlows = () => flows();
|
|
10066
10076
|
}
|
|
10067
10077
|
});
|
|
@@ -10071,7 +10081,7 @@ var shippedAgentFiles, officialAgent;
|
|
|
10071
10081
|
var init_bundled2 = __esm({
|
|
10072
10082
|
"../cli/src/lib/agents/bundled.ts"() {
|
|
10073
10083
|
"use strict";
|
|
10074
|
-
|
|
10084
|
+
init_cloud_studios();
|
|
10075
10085
|
shippedAgentFiles = () => cloudAgentFiles().files;
|
|
10076
10086
|
officialAgent = (name) => cloudAgentFiles().official.has(name);
|
|
10077
10087
|
}
|
|
@@ -10154,7 +10164,7 @@ function checkAgentKeys(agents, places) {
|
|
|
10154
10164
|
agent.name,
|
|
10155
10165
|
agent.after.filter((other) => {
|
|
10156
10166
|
if (places.get(other) === places.get(agent.name)) return true;
|
|
10157
|
-
const what = byName.has(other) ? "is not a preview of the same
|
|
10167
|
+
const what = byName.has(other) ? "is not a preview of the same studio" : "is not an agent on this board";
|
|
10158
10168
|
problems.push(`${agent.from}: \`akb.after\` names \`${other}\`, which ${what} \u2014 ignoring it`);
|
|
10159
10169
|
return false;
|
|
10160
10170
|
})
|
|
@@ -10183,7 +10193,7 @@ function checkAgentKeys(agents, places) {
|
|
|
10183
10193
|
function readBundled(folder) {
|
|
10184
10194
|
const shipped = shippedAgentFiles();
|
|
10185
10195
|
const official = officialAgent(folder);
|
|
10186
|
-
const label = official ? `the built-in \`${folder}\` agent` : `the
|
|
10196
|
+
const label = official ? `the built-in \`${folder}\` agent` : `the studio agent \`${folder}\``;
|
|
10187
10197
|
const file = (relative) => shipped[`${folder}/${relative}`] ?? null;
|
|
10188
10198
|
const text4 = file("AGENT.md");
|
|
10189
10199
|
if (text4 === null) return { problem: `${label} has no AGENT.md` };
|
|
@@ -10241,10 +10251,10 @@ var init_catalog = __esm({
|
|
|
10241
10251
|
init_roles();
|
|
10242
10252
|
init_paths();
|
|
10243
10253
|
init_bundled2();
|
|
10244
|
-
|
|
10254
|
+
init_cloud_studios();
|
|
10245
10255
|
init_file_memo();
|
|
10246
10256
|
init_parse();
|
|
10247
|
-
specAgentCatalog = memoByFiles(() => [AGENTS, LEGACY_AGENTS, ...
|
|
10257
|
+
specAgentCatalog = memoByFiles(() => [AGENTS, LEGACY_AGENTS, ...cloudStudioSources()], readCatalog);
|
|
10248
10258
|
bundledFolders = () => [...new Set(Object.keys(shippedAgentFiles()).map((key) => key.split("/")[0]))].sort();
|
|
10249
10259
|
AGENT_FILE = "AGENT.md";
|
|
10250
10260
|
LEGACY_AGENT_FILE = "SKILL.md";
|
|
@@ -10253,10 +10263,10 @@ var init_catalog = __esm({
|
|
|
10253
10263
|
}
|
|
10254
10264
|
});
|
|
10255
10265
|
|
|
10256
|
-
// ../cli/src/lib/agent/
|
|
10266
|
+
// ../cli/src/lib/agent/studio-file.ts
|
|
10257
10267
|
import fs32 from "node:fs";
|
|
10258
10268
|
import path36 from "node:path";
|
|
10259
|
-
function
|
|
10269
|
+
function studioFileText(def) {
|
|
10260
10270
|
const lines = ["---", `name: ${scalar(def.name)}`];
|
|
10261
10271
|
const names3 = Object.entries(def.names ?? {});
|
|
10262
10272
|
if (names3.length) lines.push("names:", ...names3.map(([lang, said2]) => ` ${lang}: ${scalar(said2)}`));
|
|
@@ -10291,52 +10301,52 @@ function readFolder(id, problems) {
|
|
|
10291
10301
|
problems.push(`${rel(fileOf(id))} is missing`);
|
|
10292
10302
|
return null;
|
|
10293
10303
|
}
|
|
10294
|
-
const read3 =
|
|
10304
|
+
const read3 = parseStudioFile(id, source, rel(fileOf(id)));
|
|
10295
10305
|
if ("problem" in read3) {
|
|
10296
10306
|
problems.push(read3.problem);
|
|
10297
10307
|
return null;
|
|
10298
10308
|
}
|
|
10299
10309
|
return read3.def;
|
|
10300
10310
|
}
|
|
10301
|
-
function
|
|
10311
|
+
function boardStudioDefs() {
|
|
10302
10312
|
const problems = [];
|
|
10303
10313
|
const defs = cloudFlows().filter((f) => !f.builtIn).map((f) => f.def);
|
|
10304
10314
|
const draft = draftId();
|
|
10305
10315
|
const mine = draft ? readFolder(draft, problems) : null;
|
|
10306
10316
|
return { defs: mine ? [...defs, mine] : defs, problems };
|
|
10307
10317
|
}
|
|
10308
|
-
function
|
|
10318
|
+
function writeStudioDef(def) {
|
|
10309
10319
|
const file = fileOf(def.id);
|
|
10310
10320
|
fs32.mkdirSync(path36.dirname(file), { recursive: true });
|
|
10311
|
-
fs32.writeFileSync(file,
|
|
10321
|
+
fs32.writeFileSync(file, studioFileText(def));
|
|
10312
10322
|
forgetFileMemos();
|
|
10313
10323
|
}
|
|
10314
|
-
var
|
|
10315
|
-
var
|
|
10316
|
-
"../cli/src/lib/agent/
|
|
10324
|
+
var STUDIO_FILE2, builtinDefs, fileOf;
|
|
10325
|
+
var init_studio_file = __esm({
|
|
10326
|
+
"../cli/src/lib/agent/studio-file.ts"() {
|
|
10317
10327
|
"use strict";
|
|
10318
10328
|
init_file_memo();
|
|
10319
10329
|
init_board_files();
|
|
10320
10330
|
init_tasks();
|
|
10321
10331
|
init_paths();
|
|
10322
|
-
|
|
10323
|
-
|
|
10324
|
-
|
|
10325
|
-
|
|
10332
|
+
init_cloud_studios();
|
|
10333
|
+
init_studio_def();
|
|
10334
|
+
init_studio_def();
|
|
10335
|
+
STUDIO_FILE2 = "STUDIO.md";
|
|
10326
10336
|
builtinDefs = () => cloudFlows().filter((f) => f.builtIn).map((f) => f.def);
|
|
10327
|
-
fileOf = (id) => path36.join(
|
|
10337
|
+
fileOf = (id) => path36.join(STUDIOS, id, STUDIO_FILE2);
|
|
10328
10338
|
}
|
|
10329
10339
|
});
|
|
10330
10340
|
|
|
10331
|
-
// ../cli/src/lib/agent/
|
|
10341
|
+
// ../cli/src/lib/agent/studios.ts
|
|
10332
10342
|
import fs33 from "node:fs";
|
|
10333
10343
|
import path37 from "node:path";
|
|
10334
|
-
function
|
|
10344
|
+
function studioPurpose(flow) {
|
|
10335
10345
|
if (flow.builtIn) return builtinDescription(flow.id) || flow.name;
|
|
10336
|
-
return
|
|
10346
|
+
return boardStudioDefs().defs.find((d) => d.id === flow.id)?.description || flow.name;
|
|
10337
10347
|
}
|
|
10338
|
-
function
|
|
10339
|
-
const defs = flow.builtIn ? builtinDefs() :
|
|
10348
|
+
function studioWhen(flow) {
|
|
10349
|
+
const defs = flow.builtIn ? builtinDefs() : boardStudioDefs().defs;
|
|
10340
10350
|
return defs.find((d) => d.id === flow.id)?.when ?? "";
|
|
10341
10351
|
}
|
|
10342
10352
|
function readScheduled(raw) {
|
|
@@ -10372,49 +10382,49 @@ function resolveOne(cfg, def, builtIn) {
|
|
|
10372
10382
|
rules: def.rules
|
|
10373
10383
|
};
|
|
10374
10384
|
}
|
|
10375
|
-
function
|
|
10385
|
+
function writtenStudios() {
|
|
10376
10386
|
const cfg = safeConfig();
|
|
10377
|
-
return [...builtinDefs().map((def) => resolveOne(cfg, def, true)), ...
|
|
10387
|
+
return [...builtinDefs().map((def) => resolveOne(cfg, def, true)), ...boardStudioDefs().defs.map((def) => resolveOne(cfg, def, false))];
|
|
10378
10388
|
}
|
|
10379
|
-
function
|
|
10380
|
-
const flow =
|
|
10389
|
+
function knownStudio(asked) {
|
|
10390
|
+
const flow = studioById(asked.trim());
|
|
10381
10391
|
if (!flow) {
|
|
10382
|
-
die(`no
|
|
10383
|
-
kind: "no-such-
|
|
10384
|
-
|
|
10392
|
+
die(`no studio called "${asked.trim()}" on this board. It has: ${studios().map((w) => w.id).join(", ")}.`, {
|
|
10393
|
+
kind: "no-such-studio",
|
|
10394
|
+
studio: asked.trim()
|
|
10385
10395
|
});
|
|
10386
10396
|
}
|
|
10387
10397
|
return flow.id;
|
|
10388
10398
|
}
|
|
10389
|
-
function
|
|
10399
|
+
function studioFor(id) {
|
|
10390
10400
|
const wanted = (id ?? "").trim();
|
|
10391
|
-
return wanted ?
|
|
10401
|
+
return wanted ? studioById(wanted) : void 0;
|
|
10392
10402
|
}
|
|
10393
|
-
function
|
|
10403
|
+
function noStudioMessage(id) {
|
|
10394
10404
|
const wanted = (id ?? "").trim();
|
|
10395
10405
|
const zh = translating();
|
|
10396
|
-
if (!wanted || !
|
|
10397
|
-
const name =
|
|
10398
|
-
return zh ? `\u6B64\u4EFB\u52A1\u7684\u5DE5\u4F5C\
|
|
10406
|
+
if (!wanted || !studios().length) return zh ? "\u5148\u5B89\u88C5\u4E00\u4E2A\u5DE5\u4F5C\u53F0" : "Install a studio first.";
|
|
10407
|
+
const name = heldStudioName(wanted) || wanted;
|
|
10408
|
+
return zh ? `\u6B64\u4EFB\u52A1\u7684\u5DE5\u4F5C\u53F0\u300C${name}\u300D\u672A\u5B89\u88C5` : `This task's studio "${name}" is not installed.`;
|
|
10399
10409
|
}
|
|
10400
10410
|
function previewStages(flow, chosen) {
|
|
10401
10411
|
const names3 = flow ? previewAgents(flow).map((h) => h.agent).filter((name) => chosen.includes(name)) : [];
|
|
10402
10412
|
const stages = stagesOf(names3, agentAfter);
|
|
10403
10413
|
return stages.length ? stages : [[]];
|
|
10404
10414
|
}
|
|
10405
|
-
function
|
|
10415
|
+
function userStudioRules(flow) {
|
|
10406
10416
|
try {
|
|
10407
|
-
return fs33.readFileSync(
|
|
10417
|
+
return fs33.readFileSync(studioRuleFile(flow.id), "utf8").trim();
|
|
10408
10418
|
} catch {
|
|
10409
10419
|
return "";
|
|
10410
10420
|
}
|
|
10411
10421
|
}
|
|
10412
|
-
function
|
|
10413
|
-
return
|
|
10422
|
+
function studioProblems(id) {
|
|
10423
|
+
return studioIssues(id).map((issue) => issue.error);
|
|
10414
10424
|
}
|
|
10415
|
-
function
|
|
10416
|
-
const flow =
|
|
10417
|
-
if (!flow) return [refusal("
|
|
10425
|
+
function studioIssues(id) {
|
|
10426
|
+
const flow = studioById(id);
|
|
10427
|
+
if (!flow) return [refusal("studioNotFound", `this board has no \`${id}\` studio.`, { id })];
|
|
10418
10428
|
const known2 = onBoard();
|
|
10419
10429
|
const problems = [];
|
|
10420
10430
|
for (const { agent } of landAgents(flow)) {
|
|
@@ -10426,10 +10436,10 @@ function workflowIssues(id) {
|
|
|
10426
10436
|
continue;
|
|
10427
10437
|
}
|
|
10428
10438
|
problems.push(
|
|
10429
|
-
refusal("
|
|
10439
|
+
refusal("studioLandMissing", `\`${flow.name}\` lands with \`${agent}\`, and this board has no such agent.`, {
|
|
10430
10440
|
name: flow.name,
|
|
10431
10441
|
agent,
|
|
10432
|
-
|
|
10442
|
+
studio: flow.id
|
|
10433
10443
|
})
|
|
10434
10444
|
);
|
|
10435
10445
|
}
|
|
@@ -10445,10 +10455,10 @@ function landRefused(flow, agent, found2) {
|
|
|
10445
10455
|
folderName: `its folder is \`${found2.folder}\` but ${found2.file} names it \`${declared}\` \u2014 make the two match`,
|
|
10446
10456
|
file: `${found2.file} has an error \u2014 \`akb raw previews\` says which`
|
|
10447
10457
|
};
|
|
10448
|
-
return refusal("
|
|
10458
|
+
return refusal("studioLandRefused", `\`${agent}\`, which lands \`${flow.name}\`, can't be used: ${fix[found2.cause]}.`, {
|
|
10449
10459
|
name: flow.name,
|
|
10450
10460
|
agent,
|
|
10451
|
-
|
|
10461
|
+
studio: flow.id,
|
|
10452
10462
|
cause: found2.cause,
|
|
10453
10463
|
file: found2.file,
|
|
10454
10464
|
folder: found2.folder,
|
|
@@ -10458,33 +10468,33 @@ function landRefused(flow, agent, found2) {
|
|
|
10458
10468
|
}
|
|
10459
10469
|
function writeDraft(def, settings) {
|
|
10460
10470
|
try {
|
|
10461
|
-
|
|
10471
|
+
writeStudioDef(def);
|
|
10462
10472
|
} catch (e) {
|
|
10463
10473
|
const why2 = e instanceof Error ? e.message : String(e);
|
|
10464
|
-
return { ok: false, ...refusal("fileWrite", `couldn't write the "${def.name}"
|
|
10474
|
+
return { ok: false, ...refusal("fileWrite", `couldn't write the "${def.name}" studio: ${why2}`, { path: def.id, details: why2 }) };
|
|
10465
10475
|
}
|
|
10466
10476
|
return settings ? save2(settings) : { ok: true };
|
|
10467
10477
|
}
|
|
10468
|
-
function
|
|
10478
|
+
function renameStudio(id, name) {
|
|
10469
10479
|
const draft = draftId();
|
|
10470
10480
|
if (!draft) return readOnly();
|
|
10471
|
-
if (id !== draft) return { ok: false, ...refusal("
|
|
10481
|
+
if (id !== draft) return { ok: false, ...refusal("studioReadOnly", `only the draft, \`${draft}\`, is renamed here`, { id }) };
|
|
10472
10482
|
const wanted = trimmedName(name);
|
|
10473
|
-
if (!wanted) return { ok: false, ...refusal("
|
|
10474
|
-
if (nameTaken(wanted, id)) return { ok: false, ...refusal("
|
|
10483
|
+
if (!wanted) return { ok: false, ...refusal("studioUnnamed", "a studio needs a name") };
|
|
10484
|
+
if (nameTaken(wanted, id)) return { ok: false, ...refusal("studioTaken", `this workspace already has a studio called "${wanted}"`, { name: wanted }) };
|
|
10475
10485
|
const def = draftDef(id);
|
|
10476
10486
|
return def ? writeDraft({ ...def, name: wanted }) : notFound(id);
|
|
10477
10487
|
}
|
|
10478
10488
|
function elsewhere(agent, id) {
|
|
10479
|
-
const owner =
|
|
10489
|
+
const owner = agentStudio(agent);
|
|
10480
10490
|
if (!owner || owner === id) return null;
|
|
10481
|
-
const name =
|
|
10491
|
+
const name = studioById(owner)?.name ?? owner;
|
|
10482
10492
|
return {
|
|
10483
10493
|
ok: false,
|
|
10484
|
-
...refusal("
|
|
10494
|
+
...refusal("agentOtherStudio", `\`${agent}\` belongs to the "${name}" studio \u2014 create a new agent here instead`, {
|
|
10485
10495
|
agent,
|
|
10486
10496
|
name,
|
|
10487
|
-
|
|
10497
|
+
studio: owner
|
|
10488
10498
|
})
|
|
10489
10499
|
};
|
|
10490
10500
|
}
|
|
@@ -10493,14 +10503,14 @@ function scheduledMembers(flow) {
|
|
|
10493
10503
|
return flow.scheduled.filter((h) => known2.has(h.agent));
|
|
10494
10504
|
}
|
|
10495
10505
|
function listedScheduled(flow) {
|
|
10496
|
-
const def = (flow.builtIn ? builtinDefs() :
|
|
10506
|
+
const def = (flow.builtIn ? builtinDefs() : boardStudioDefs().defs).find((d) => d.id === flow.id);
|
|
10497
10507
|
const known2 = onBoard();
|
|
10498
10508
|
return (def?.scheduled ?? []).map((s) => s.agent).filter((agent) => known2.has(agent));
|
|
10499
10509
|
}
|
|
10500
10510
|
function setScheduled(id, change2, claim = "") {
|
|
10501
|
-
const flow =
|
|
10511
|
+
const flow = studioById(id);
|
|
10502
10512
|
if (!flow) return notFound(id);
|
|
10503
|
-
const rows = scheduledMembers(flow).filter((h) =>
|
|
10513
|
+
const rows = scheduledMembers(flow).filter((h) => agentStudio(h.agent) === id || h.agent === claim).map((h) => ({ ...h }));
|
|
10504
10514
|
const refused = change2(rows);
|
|
10505
10515
|
if (refused) return refused;
|
|
10506
10516
|
return save2((block) => {
|
|
@@ -10517,10 +10527,10 @@ function stampScheduledRun(id, agent, startedAt) {
|
|
|
10517
10527
|
if (!one) return { ok: false, error: "" };
|
|
10518
10528
|
one.lastRun = formatStamp(startedAt);
|
|
10519
10529
|
},
|
|
10520
|
-
|
|
10530
|
+
agentStudio(agent) ? "" : agent
|
|
10521
10531
|
).ok;
|
|
10522
10532
|
}
|
|
10523
|
-
function
|
|
10533
|
+
function adoptStudioScheduled(id, agent, from) {
|
|
10524
10534
|
const refused = elsewhere(agent, id);
|
|
10525
10535
|
if (refused) return refused;
|
|
10526
10536
|
return setScheduled(id, (rows) => {
|
|
@@ -10545,8 +10555,8 @@ function cardMeta(id) {
|
|
|
10545
10555
|
return null;
|
|
10546
10556
|
}
|
|
10547
10557
|
}
|
|
10548
|
-
function
|
|
10549
|
-
const flow =
|
|
10558
|
+
function frozenStudio(id) {
|
|
10559
|
+
const flow = studioFor(id);
|
|
10550
10560
|
if (!flow) return void 0;
|
|
10551
10561
|
const row = (h) => ({ agent: h.agent, extra: h.extra });
|
|
10552
10562
|
return {
|
|
@@ -10557,9 +10567,9 @@ function frozenWorkflow(id) {
|
|
|
10557
10567
|
land: landAgents(flow).map(row)
|
|
10558
10568
|
};
|
|
10559
10569
|
}
|
|
10560
|
-
var builtinDescription,
|
|
10561
|
-
var
|
|
10562
|
-
"../cli/src/lib/agent/
|
|
10570
|
+
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;
|
|
10571
|
+
var init_studios = __esm({
|
|
10572
|
+
"../cli/src/lib/agent/studios.ts"() {
|
|
10563
10573
|
"use strict";
|
|
10564
10574
|
init_cards();
|
|
10565
10575
|
init_frontmatter();
|
|
@@ -10569,13 +10579,13 @@ var init_workflows = __esm({
|
|
|
10569
10579
|
init_settings();
|
|
10570
10580
|
init_catalog();
|
|
10571
10581
|
init_spec_agent_names();
|
|
10572
|
-
|
|
10582
|
+
init_cloud_studios();
|
|
10573
10583
|
init_language();
|
|
10574
|
-
|
|
10584
|
+
init_studio_file();
|
|
10575
10585
|
init_types();
|
|
10576
10586
|
builtinDescription = (id) => builtinDefs().find((w) => w.id === id)?.description;
|
|
10577
|
-
|
|
10578
|
-
storedStages = (cfg, id) => configBlock(configBlock(
|
|
10587
|
+
studiosBlock = (cfg) => configBlock(cfg.studios);
|
|
10588
|
+
storedStages = (cfg, id) => configBlock(configBlock(studiosBlock(cfg).stages)[id]);
|
|
10579
10589
|
SCHEDULE = "schedule";
|
|
10580
10590
|
toRow = (h) => ({ agent: h.agent, extra: h.extra, ...h.off ? { off: true } : {} });
|
|
10581
10591
|
scheduledRow = (h) => ({
|
|
@@ -10584,12 +10594,12 @@ var init_workflows = __esm({
|
|
|
10584
10594
|
...h.lastRun ? { lastRun: h.lastRun } : {},
|
|
10585
10595
|
...h.since ? { since: h.since } : {}
|
|
10586
10596
|
});
|
|
10587
|
-
|
|
10597
|
+
studioFileProblems = () => boardStudioDefs().problems;
|
|
10588
10598
|
allListed = (flow) => [...flow.previews, ...flow.land, ...flow.scheduled];
|
|
10589
10599
|
resolved = memoByFiles(
|
|
10590
|
-
() => [UI_CONFIG, LEGACY_UI_CONFIG,
|
|
10600
|
+
() => [UI_CONFIG, LEGACY_UI_CONFIG, STUDIOS, AGENTS, LEGACY_AGENTS, ...cloudStudioSources()],
|
|
10591
10601
|
() => {
|
|
10592
|
-
const flows2 =
|
|
10602
|
+
const flows2 = writtenStudios();
|
|
10593
10603
|
const catalog = specAgentCatalog().agents;
|
|
10594
10604
|
const known2 = new Set(catalog.map((a) => a.name));
|
|
10595
10605
|
const owners = /* @__PURE__ */ new Map();
|
|
@@ -10619,9 +10629,9 @@ var init_workflows = __esm({
|
|
|
10619
10629
|
);
|
|
10620
10630
|
agentAfter = (name) => resolved().keys.after.get(name) ?? [];
|
|
10621
10631
|
agentKeyProblems = () => resolved().keys.problems;
|
|
10622
|
-
|
|
10623
|
-
|
|
10624
|
-
|
|
10632
|
+
agentStudio = (name) => resolved().owners.get(name) ?? "";
|
|
10633
|
+
studios = () => resolved().flows;
|
|
10634
|
+
studioById = (id) => studios().find((w) => w.id === id);
|
|
10625
10635
|
onBoard = () => new Set(specAgentCatalog().agents.map((a) => a.name));
|
|
10626
10636
|
previewMembers = (flow) => {
|
|
10627
10637
|
const known2 = onBoard();
|
|
@@ -10630,23 +10640,23 @@ var init_workflows = __esm({
|
|
|
10630
10640
|
previewAgents = (flow) => previewMembers(flow).filter((h) => !h.off);
|
|
10631
10641
|
landAgents = (flow) => flow.land.filter((h) => !h.off);
|
|
10632
10642
|
archivesOnApproval = (flow) => !!flow && !landAgents(flow).length;
|
|
10633
|
-
|
|
10643
|
+
studioRuleFile = (id) => path37.join(RULES, "studios", `${id}.md`);
|
|
10634
10644
|
save2 = (change2) => writeConfig((cfg) => {
|
|
10635
|
-
const block = configBlock(cfg.
|
|
10645
|
+
const block = configBlock(cfg.studios);
|
|
10636
10646
|
change2(block);
|
|
10637
|
-
if (Object.keys(block).length === 0) delete cfg.
|
|
10638
|
-
else cfg.
|
|
10647
|
+
if (Object.keys(block).length === 0) delete cfg.studios;
|
|
10648
|
+
else cfg.studios = block;
|
|
10639
10649
|
});
|
|
10640
|
-
draftDef = (id) =>
|
|
10641
|
-
notFound = (id) => ({ ok: false, ...refusal("
|
|
10642
|
-
readOnly = () => ({ ok: false, ...refusal("
|
|
10650
|
+
draftDef = (id) => boardStudioDefs().defs.find((d) => d.id === id);
|
|
10651
|
+
notFound = (id) => ({ ok: false, ...refusal("studioNotFound", `this board has no \`${id}\` studio`, { id }) });
|
|
10652
|
+
readOnly = () => ({ ok: false, ...refusal("studioReadOnly", "Only a Studio builder draft is renamed here; change a studio with `akb studio pull` and `push`.") });
|
|
10643
10653
|
trimmedName = (name) => name.replace(/\s+/g, " ").trim();
|
|
10644
|
-
nameTaken = (name, except = "") =>
|
|
10654
|
+
nameTaken = (name, except = "") => studios().some((w) => w.id !== except && trimmedName(w.name).toLowerCase() === trimmedName(name).toLowerCase());
|
|
10645
10655
|
scheduledAgent = (id, agent) => {
|
|
10646
|
-
const flow =
|
|
10656
|
+
const flow = studioById(id);
|
|
10647
10657
|
return flow ? scheduledMembers(flow).find((h) => h.agent === canonicalSpecAgent(agent.trim())) : void 0;
|
|
10648
10658
|
};
|
|
10649
|
-
|
|
10659
|
+
cardStudioId = (id) => cardMeta(id)?.studio ?? "";
|
|
10650
10660
|
cardStages = (meta, flow) => previewStages(flow, meta?.previews ?? []);
|
|
10651
10661
|
cardStage = (meta, flow) => Math.min(Math.max(meta?.phase || 1, 1), cardStages(meta, flow).length);
|
|
10652
10662
|
}
|
|
@@ -10661,17 +10671,17 @@ function loadGoals() {
|
|
|
10661
10671
|
if (held4.goals !== void 0 && held4.ideas !== void 0 && JSON.stringify(held4.goals) !== JSON.stringify(held4.ideas)) die("goals and ideas do not match.");
|
|
10662
10672
|
const goals = held4.goals ?? held4.ideas;
|
|
10663
10673
|
if (!Array.isArray(goals)) die("The goals array is missing or invalid.");
|
|
10664
|
-
return { file, held: { ...held4,
|
|
10674
|
+
return { file, held: { ...held4, studios: held4.studios ?? [], goals } };
|
|
10665
10675
|
}
|
|
10666
|
-
function
|
|
10676
|
+
function studioOf(held4, asked) {
|
|
10667
10677
|
const wanted = asked.trim();
|
|
10668
|
-
const found2 = held4.
|
|
10669
|
-
if (!found2) die(`No
|
|
10678
|
+
const found2 = held4.studios.find((w) => w.id === wanted || shortStudioId(w.id) === wanted);
|
|
10679
|
+
if (!found2) die(`No studio \`${wanted}\` here. It has: ${held4.studios.map((w) => shortStudioId(w.id)).join(", ")}.`);
|
|
10670
10680
|
return found2.id;
|
|
10671
10681
|
}
|
|
10672
|
-
function
|
|
10673
|
-
const first = held4.
|
|
10674
|
-
if (!first) die(
|
|
10682
|
+
function fallbackStudio(held4) {
|
|
10683
|
+
const first = held4.studios[0]?.id;
|
|
10684
|
+
if (!first) die(noStudioMessage(""));
|
|
10675
10685
|
return first;
|
|
10676
10686
|
}
|
|
10677
10687
|
function splitBody2(text4) {
|
|
@@ -10706,28 +10716,28 @@ function cmdGoal(args, opts) {
|
|
|
10706
10716
|
if (!title) die("--title must not be empty");
|
|
10707
10717
|
if (held4.goals.filter(open).length >= MAX_GOALS) die(`A conversation holds at most ${MAX_GOALS} goals; drop one first.`);
|
|
10708
10718
|
const body = readBody(opts.bodyFile);
|
|
10709
|
-
const
|
|
10719
|
+
const studio = opts.studio ? studioOf(held4, opts.studio) : fallbackStudio(held4);
|
|
10710
10720
|
const id = `new_${held4.goals.filter((i) => i.id.startsWith("new_")).length + 1}`;
|
|
10711
|
-
const previews = goalPreviews(held4,
|
|
10712
|
-
held4.goals.push({ id, title, ...body,
|
|
10721
|
+
const previews = goalPreviews(held4, studio, opts.previews);
|
|
10722
|
+
held4.goals.push({ id, title, ...body, studio, previews, task: null });
|
|
10713
10723
|
write2();
|
|
10714
|
-
say(`Saved goal ${id}: ${title} (${
|
|
10715
|
-
return { id, title,
|
|
10724
|
+
say(`Saved goal ${id}: ${title} (${shortStudioId(studio)}).`);
|
|
10725
|
+
return { id, title, studio, previews };
|
|
10716
10726
|
}
|
|
10717
10727
|
const goal = named(held4, opts.id);
|
|
10718
10728
|
if (goal.task) die(`${goal.id} is already a task; it no longer changes here.`);
|
|
10719
10729
|
if (sub === "save") {
|
|
10720
|
-
const
|
|
10721
|
-
const previews = opts.previews !== void 0 ? goalPreviews(held4,
|
|
10730
|
+
const studio = opts.studio !== void 0 ? studioOf(held4, opts.studio) : goal.studio;
|
|
10731
|
+
const previews = opts.previews !== void 0 ? goalPreviews(held4, studio, opts.previews) : studio === goal.studio ? goal.previews ?? [] : [];
|
|
10722
10732
|
if (opts.title !== void 0) {
|
|
10723
10733
|
if (!opts.title.trim()) die("--title must not be empty");
|
|
10724
10734
|
goal.title = opts.title.trim();
|
|
10725
10735
|
}
|
|
10726
10736
|
if (opts.bodyFile !== void 0) Object.assign(goal, readBody(opts.bodyFile));
|
|
10727
|
-
Object.assign(goal, {
|
|
10737
|
+
Object.assign(goal, { studio, previews });
|
|
10728
10738
|
write2();
|
|
10729
|
-
say(`Saved goal ${goal.id}: ${goal.title} (${
|
|
10730
|
-
return { id: goal.id, title: goal.title,
|
|
10739
|
+
say(`Saved goal ${goal.id}: ${goal.title} (${shortStudioId(goal.studio)}).`);
|
|
10740
|
+
return { id: goal.id, title: goal.title, studio: goal.studio, previews: goal.previews };
|
|
10731
10741
|
}
|
|
10732
10742
|
if (sub === "drop") {
|
|
10733
10743
|
goal.dropped = true;
|
|
@@ -10743,45 +10753,45 @@ function cmdGoal(args, opts) {
|
|
|
10743
10753
|
}
|
|
10744
10754
|
die("Use goal new, save, drop or start.");
|
|
10745
10755
|
}
|
|
10746
|
-
function
|
|
10756
|
+
function cmdGoalStudios() {
|
|
10747
10757
|
const { held: held4 } = loadGoals();
|
|
10748
|
-
for (const w of held4.
|
|
10749
|
-
say(`${
|
|
10758
|
+
for (const w of held4.studios) {
|
|
10759
|
+
say(`${shortStudioId(w.id)} ${w.name}`);
|
|
10750
10760
|
if (w.description && w.description !== w.name) say(` ${w.description}`);
|
|
10751
10761
|
if (w.when) say(` when ${w.when}`);
|
|
10752
10762
|
}
|
|
10753
|
-
return {
|
|
10763
|
+
return { studios: held4.studios.map((w) => ({ ...w, id: shortStudioId(w.id) })) };
|
|
10754
10764
|
}
|
|
10755
|
-
function goalPreviews(held4,
|
|
10765
|
+
function goalPreviews(held4, studio, asked = "") {
|
|
10756
10766
|
if (!asked.trim()) return [];
|
|
10757
|
-
const catalog = held4.
|
|
10767
|
+
const catalog = held4.studios.find((w) => w.id === studio)?.previews;
|
|
10758
10768
|
if (!catalog) die("Preview agents are unavailable; update Runner and try again.");
|
|
10759
10769
|
const names3 = asked.split(",").map((p) => canonicalSpecAgent({ ui: "ui-designer", api: "api-designer" }[p.trim()] ?? p.trim()));
|
|
10760
10770
|
if (names3.length > 50) die("previews must contain at most 50 agent names.");
|
|
10761
|
-
for (const name of names3) if (!catalog.some((p) => p.agent === name)) die(`Preview agent ${name} is not enabled in
|
|
10771
|
+
for (const name of names3) if (!catalog.some((p) => p.agent === name)) die(`Preview agent ${name} is not enabled in studio ${studio}.`);
|
|
10762
10772
|
return catalog.filter((p) => names3.includes(p.agent)).map((p) => p.agent);
|
|
10763
10773
|
}
|
|
10764
|
-
function cmdGoalPreviews(
|
|
10774
|
+
function cmdGoalPreviews(studio) {
|
|
10765
10775
|
const { held: held4 } = loadGoals();
|
|
10766
|
-
const id =
|
|
10767
|
-
const catalog = held4.
|
|
10776
|
+
const id = studioOf(held4, studio);
|
|
10777
|
+
const catalog = held4.studios.find((w) => w.id === id)?.previews;
|
|
10768
10778
|
if (!catalog) die("Preview agents are unavailable; update Runner and try again.");
|
|
10769
10779
|
const agents = catalog.map((p) => ({ name: p.agent, when: p.when || null }));
|
|
10770
10780
|
say(agents.length ? agents.map((p) => `${p.name}
|
|
10771
|
-
${p.when ?? "Always"}`).join("\n") : "This
|
|
10781
|
+
${p.when ?? "Always"}`).join("\n") : "This studio has no preview agent. Ask for none.");
|
|
10772
10782
|
return { agents, problems: [] };
|
|
10773
10783
|
}
|
|
10774
|
-
var MAX_GOALS, goalsFile,
|
|
10784
|
+
var MAX_GOALS, goalsFile, shortStudioId, open;
|
|
10775
10785
|
var init_goal = __esm({
|
|
10776
10786
|
"../cli/src/commands/goal.ts"() {
|
|
10777
10787
|
"use strict";
|
|
10778
10788
|
init_spec_agent_names();
|
|
10779
10789
|
init_io();
|
|
10780
10790
|
init_paths();
|
|
10781
|
-
|
|
10791
|
+
init_studios();
|
|
10782
10792
|
MAX_GOALS = 10;
|
|
10783
10793
|
goalsFile = () => process.env.KANBAN_GOALS || process.env.KANBAN_IDEAS || null;
|
|
10784
|
-
|
|
10794
|
+
shortStudioId = (id) => id.startsWith("wf_builtin_") ? id.slice("wf_builtin_".length).replace(/_/g, "-") : id;
|
|
10785
10795
|
open = (goal) => !goal.dropped && !goal.task;
|
|
10786
10796
|
}
|
|
10787
10797
|
});
|
|
@@ -10799,11 +10809,11 @@ function hostSession() {
|
|
|
10799
10809
|
if (cursor) return { id: cursor, host: "cursor" };
|
|
10800
10810
|
return kimi ? { id: kimi, host: "kimi" } : null;
|
|
10801
10811
|
}
|
|
10802
|
-
async function
|
|
10812
|
+
async function studios2(workspace2) {
|
|
10803
10813
|
const all2 = [];
|
|
10804
10814
|
let after2 = null;
|
|
10805
10815
|
do {
|
|
10806
|
-
const page = await request("GET", `/v1/
|
|
10816
|
+
const page = await request("GET", `/v1/studios?workspace=${encodeURIComponent(workspace2)}&limit=100${after2 ? `&after=${encodeURIComponent(after2)}` : ""}`);
|
|
10807
10817
|
all2.push(...page.data);
|
|
10808
10818
|
after2 = page.next;
|
|
10809
10819
|
} while (after2);
|
|
@@ -10849,7 +10859,7 @@ async function withGoalDiscussion(action, save3 = false) {
|
|
|
10849
10859
|
const before = process.env.KANBAN_GOALS;
|
|
10850
10860
|
try {
|
|
10851
10861
|
const previous = goalsOf(d);
|
|
10852
|
-
fs35.writeFileSync(file, JSON.stringify({ workspace: d.workspace,
|
|
10862
|
+
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 })) }));
|
|
10853
10863
|
process.env.KANBAN_GOALS = file;
|
|
10854
10864
|
const result = save3 ? await quietlyAsync(async () => action()) : await action();
|
|
10855
10865
|
if (save3) {
|
|
@@ -10875,21 +10885,21 @@ async function withGoalDiscussion(action, save3 = false) {
|
|
|
10875
10885
|
fs35.rmSync(dir, { recursive: true, force: true });
|
|
10876
10886
|
}
|
|
10877
10887
|
}
|
|
10878
|
-
async function queryPreviews(
|
|
10888
|
+
async function queryPreviews(studio, workspace2) {
|
|
10879
10889
|
if (!workspace2) {
|
|
10880
|
-
if (externalGoalSession()) return withGoalDiscussion(() => cmdGoalPreviews(
|
|
10890
|
+
if (externalGoalSession()) return withGoalDiscussion(() => cmdGoalPreviews(studio));
|
|
10881
10891
|
die("--workspace is required outside a goal discussion.");
|
|
10882
10892
|
}
|
|
10883
|
-
const list = await
|
|
10884
|
-
const flow = list.find((w) => w.id ===
|
|
10885
|
-
if (!flow) die(`No
|
|
10893
|
+
const list = await studios2(workspace2);
|
|
10894
|
+
const flow = list.find((w) => w.id === studio || shortStudioId(w.id) === studio);
|
|
10895
|
+
if (!flow) die(`No studio \`${studio}\` here.`);
|
|
10886
10896
|
if (!flow.previews) die("Preview agents are unavailable; update Runner and try again.");
|
|
10887
10897
|
const agents = flow.previews.map((p) => ({ name: p.agent, when: p.when || null }));
|
|
10888
10898
|
say(agents.length ? agents.map((p) => `${p.name}
|
|
10889
|
-
${p.when ?? "Always"}`).join("\n") : "This
|
|
10899
|
+
${p.when ?? "Always"}`).join("\n") : "This studio has no preview agent. Ask for none.");
|
|
10890
10900
|
return { agents, problems: [] };
|
|
10891
10901
|
}
|
|
10892
|
-
var externalGoalSession, request, cloudGoal,
|
|
10902
|
+
var externalGoalSession, request, cloudGoal, cloudGoalStudios;
|
|
10893
10903
|
var init_goal_cloud = __esm({
|
|
10894
10904
|
"../cli/src/commands/goal-cloud.ts"() {
|
|
10895
10905
|
"use strict";
|
|
@@ -10900,7 +10910,7 @@ var init_goal_cloud = __esm({
|
|
|
10900
10910
|
externalGoalSession = () => !goalsFile() && !process.env.KANBAN_RUN && !process.env.WILDCRANE_JOB && !process.env.AI4KANBAN_BOARD && Boolean(hostSession());
|
|
10901
10911
|
request = (method, route2, body) => cloud(method, route2, body);
|
|
10902
10912
|
cloudGoal = (args, opts) => withGoalDiscussion(() => cmdGoal(args, opts), true);
|
|
10903
|
-
|
|
10913
|
+
cloudGoalStudios = () => withGoalDiscussion(cmdGoalStudios);
|
|
10904
10914
|
}
|
|
10905
10915
|
});
|
|
10906
10916
|
|
|
@@ -14240,10 +14250,34 @@ var init_pointer = __esm({
|
|
|
14240
14250
|
}
|
|
14241
14251
|
});
|
|
14242
14252
|
|
|
14243
|
-
// ../cli/src/lib/card-
|
|
14253
|
+
// ../cli/src/lib/card-studio-backfill.ts
|
|
14244
14254
|
import fs37 from "node:fs";
|
|
14245
14255
|
import path40 from "node:path";
|
|
14246
|
-
function
|
|
14256
|
+
function renameToStudio() {
|
|
14257
|
+
if (!KANBAN || !BOARD_STATE) return;
|
|
14258
|
+
const mark = path40.join(BOARD_STATE, RENAMED);
|
|
14259
|
+
try {
|
|
14260
|
+
if (fs37.existsSync(mark)) return;
|
|
14261
|
+
for (const [from, to] of [[path40.join(KANBAN, "workflows"), STUDIOS], [path40.join(RULES, "workflows"), path40.join(RULES, "studios")]]) {
|
|
14262
|
+
if (fs37.existsSync(from) && !fs37.existsSync(to)) fs37.renameSync(from, to);
|
|
14263
|
+
}
|
|
14264
|
+
for (const file of [STUDIOS, TODO, TRIAGE].flatMap((dir) => fs37.existsSync(dir) ? walkMd(dir) : [])) {
|
|
14265
|
+
const at = path40.relative(KANBAN, file).split(path40.sep).join("/");
|
|
14266
|
+
const text4 = fs37.readFileSync(file, "utf8");
|
|
14267
|
+
const to = studioRenamed(at, text4);
|
|
14268
|
+
if (to.path === at && to.content === text4) continue;
|
|
14269
|
+
const target = path40.join(KANBAN, to.path);
|
|
14270
|
+
if (target !== file && fs37.existsSync(target)) continue;
|
|
14271
|
+
fs37.writeFileSync(target, to.content);
|
|
14272
|
+
if (target !== file) fs37.rmSync(file);
|
|
14273
|
+
}
|
|
14274
|
+
fs37.mkdirSync(BOARD_STATE, { recursive: true });
|
|
14275
|
+
fs37.writeFileSync(mark, "");
|
|
14276
|
+
} catch {
|
|
14277
|
+
}
|
|
14278
|
+
}
|
|
14279
|
+
function backfillCardStudios() {
|
|
14280
|
+
renameToStudio();
|
|
14247
14281
|
if (!TODO || !BOARD_STATE) return;
|
|
14248
14282
|
const mark = path40.join(BOARD_STATE, MARK);
|
|
14249
14283
|
try {
|
|
@@ -14254,24 +14288,26 @@ function backfillCardWorkflows() {
|
|
|
14254
14288
|
const end2 = text4.indexOf("\n---", 3);
|
|
14255
14289
|
if (end2 < 0) continue;
|
|
14256
14290
|
const head2 = text4.slice(0, end2);
|
|
14257
|
-
if (!/\ntitle:/.test(head2) || /\
|
|
14291
|
+
if (!/\ntitle:/.test(head2) || /\nstudio:/.test(head2)) continue;
|
|
14258
14292
|
const modules = /\nmodules:[^\n]*/.exec(head2);
|
|
14259
14293
|
const at = modules ? modules.index + modules[0].length : end2;
|
|
14260
14294
|
fs37.writeFileSync(file, `${text4.slice(0, at)}
|
|
14261
|
-
|
|
14295
|
+
studio: coding${text4.slice(at)}`);
|
|
14262
14296
|
}
|
|
14263
14297
|
fs37.mkdirSync(BOARD_STATE, { recursive: true });
|
|
14264
14298
|
fs37.writeFileSync(mark, "");
|
|
14265
14299
|
} catch {
|
|
14266
14300
|
}
|
|
14267
14301
|
}
|
|
14268
|
-
var MARK;
|
|
14269
|
-
var
|
|
14270
|
-
"../cli/src/lib/card-
|
|
14302
|
+
var MARK, RENAMED;
|
|
14303
|
+
var init_card_studio_backfill = __esm({
|
|
14304
|
+
"../cli/src/lib/card-studio-backfill.ts"() {
|
|
14271
14305
|
"use strict";
|
|
14272
14306
|
init_cards();
|
|
14273
14307
|
init_paths();
|
|
14274
|
-
|
|
14308
|
+
init_board_files();
|
|
14309
|
+
MARK = "card-studios-backfilled";
|
|
14310
|
+
RENAMED = "studio-names";
|
|
14275
14311
|
}
|
|
14276
14312
|
});
|
|
14277
14313
|
|
|
@@ -15015,7 +15051,7 @@ var init_usage = __esm({
|
|
|
15015
15051
|
// ../cli/src/lib/agents/roster.ts
|
|
15016
15052
|
function customAgentsOn() {
|
|
15017
15053
|
const running = /* @__PURE__ */ new Set();
|
|
15018
|
-
for (const flow of
|
|
15054
|
+
for (const flow of studios()) {
|
|
15019
15055
|
for (const h of [...previewAgents(flow), ...landAgents(flow)]) running.add(h.agent);
|
|
15020
15056
|
for (const scheduled of scheduledMembers(flow)) if (!scheduled.off) running.add(scheduled.agent);
|
|
15021
15057
|
}
|
|
@@ -15026,7 +15062,7 @@ var init_roster = __esm({
|
|
|
15026
15062
|
"../cli/src/lib/agents/roster.ts"() {
|
|
15027
15063
|
"use strict";
|
|
15028
15064
|
init_file_memo();
|
|
15029
|
-
|
|
15065
|
+
init_studios();
|
|
15030
15066
|
init_runtimes();
|
|
15031
15067
|
init_settings();
|
|
15032
15068
|
init_memory();
|
|
@@ -15242,7 +15278,7 @@ var init_answers = __esm({
|
|
|
15242
15278
|
function deliveryStep(delivery) {
|
|
15243
15279
|
const count3 = delivery.completions?.length ?? 0;
|
|
15244
15280
|
const last = delivery.completions?.[count3 - 1];
|
|
15245
|
-
const end2 = delivery.
|
|
15281
|
+
const end2 = delivery.studio?.land?.length ?? 1;
|
|
15246
15282
|
return last && !last.finished && last.step + 1 >= end2 ? last.step : count3;
|
|
15247
15283
|
}
|
|
15248
15284
|
function nextDeliveryRun(deliveryId) {
|
|
@@ -15301,28 +15337,28 @@ function agentForRun(ask2 = {}) {
|
|
|
15301
15337
|
if (!action) return void 0;
|
|
15302
15338
|
if (action === "implement") {
|
|
15303
15339
|
const delivery = deliveryFor({ action, id: ask2.id, deliveryId: ask2.deliveryId });
|
|
15304
|
-
const flow = delivery?.
|
|
15305
|
-
const rows = delivery?.
|
|
15340
|
+
const flow = delivery?.studio ? void 0 : studioFor(studioForRun(ask2));
|
|
15341
|
+
const rows = delivery?.studio?.land ?? (flow ? landAgents(flow) : []);
|
|
15306
15342
|
return rows[delivery ? deliveryStep(delivery) : 0]?.agent;
|
|
15307
15343
|
}
|
|
15308
15344
|
if (SPECIALIST_ACTIONS.has(action) || action === "sub") return specAgent;
|
|
15309
|
-
return roleForFlow(flowOf2(ask2, action),
|
|
15345
|
+
return roleForFlow(flowOf2(ask2, action), studioForRun(ask2))?.name;
|
|
15310
15346
|
}
|
|
15311
15347
|
function flowOf2(ask2, action) {
|
|
15312
15348
|
if (ask2.refineRound !== void 0 && REFINE_ACTIONS.has(action)) return "refine";
|
|
15313
15349
|
return flowByAction(action)?.command ?? action;
|
|
15314
15350
|
}
|
|
15315
|
-
var
|
|
15351
|
+
var studioForRun;
|
|
15316
15352
|
var init_runner = __esm({
|
|
15317
15353
|
"../cli/src/lib/agent/runner.ts"() {
|
|
15318
15354
|
"use strict";
|
|
15319
15355
|
init_flows();
|
|
15320
15356
|
init_roles();
|
|
15321
|
-
|
|
15357
|
+
init_studios();
|
|
15322
15358
|
init_deliveries();
|
|
15323
15359
|
init_progress();
|
|
15324
15360
|
init_types();
|
|
15325
|
-
|
|
15361
|
+
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);
|
|
15326
15362
|
}
|
|
15327
15363
|
});
|
|
15328
15364
|
|
|
@@ -15341,17 +15377,17 @@ function readRule(agent) {
|
|
|
15341
15377
|
migrateFlowRules();
|
|
15342
15378
|
return ruleFile(agent);
|
|
15343
15379
|
}
|
|
15344
|
-
function deliveryRules(
|
|
15380
|
+
function deliveryRules(studio) {
|
|
15345
15381
|
migrateFlowRules();
|
|
15346
15382
|
const rules = {};
|
|
15347
15383
|
for (const flow2 of FLOWS) {
|
|
15348
15384
|
if (flow2.action === "refine" || !DELIVERY_FLOWS.has(flow2.action)) continue;
|
|
15349
|
-
const role = roleForFlow(flow2.command,
|
|
15385
|
+
const role = roleForFlow(flow2.command, studio);
|
|
15350
15386
|
if (!role || rules[role.name] !== void 0) continue;
|
|
15351
15387
|
const rule = ruleFile(role.name);
|
|
15352
15388
|
if (rule) rules[role.name] = rule;
|
|
15353
15389
|
}
|
|
15354
|
-
const flow =
|
|
15390
|
+
const flow = studioFor(studio);
|
|
15355
15391
|
for (const { agent } of flow ? landAgents(flow) : []) {
|
|
15356
15392
|
const rule = ruleFile(agent);
|
|
15357
15393
|
if (rule) rules[agent] = rule;
|
|
@@ -15368,7 +15404,7 @@ function ownerOf2(req) {
|
|
|
15368
15404
|
return name ? { name } : null;
|
|
15369
15405
|
}
|
|
15370
15406
|
const flow = req.action === "reflect" ? req.action : flowForRequest(req)?.command;
|
|
15371
|
-
const role = roleForFlow(flow ?? "",
|
|
15407
|
+
const role = roleForFlow(flow ?? "", studioForRun(req));
|
|
15372
15408
|
return role ? { name: role.name, role, flow } : null;
|
|
15373
15409
|
}
|
|
15374
15410
|
function ruleFor(req, frozen) {
|
|
@@ -15452,7 +15488,7 @@ var init_rules2 = __esm({
|
|
|
15452
15488
|
init_flows();
|
|
15453
15489
|
init_roles();
|
|
15454
15490
|
init_runner();
|
|
15455
|
-
|
|
15491
|
+
init_studios();
|
|
15456
15492
|
init_types();
|
|
15457
15493
|
rulePath = (agent) => path48.join(RULES, `${agent}.md`);
|
|
15458
15494
|
flowForRequest = (req) => req.refineRound !== void 0 && REFINE_ACTIONS.has(req.action) ? flowByCommand("refine") : flowByAction(req.action);
|
|
@@ -15551,10 +15587,10 @@ function landedDeliveries(filter = {}) {
|
|
|
15551
15587
|
for (const audit of allAudits()) {
|
|
15552
15588
|
const landing = audit.landing;
|
|
15553
15589
|
if (typeof audit.cardId !== "number" || landing?.status !== "landed" || !landing.commit) continue;
|
|
15554
|
-
const
|
|
15590
|
+
const studio = audit.studio?.id || "coding";
|
|
15555
15591
|
if (filter.since !== void 0 && !(landing.at > filter.since)) continue;
|
|
15556
|
-
if (filter.
|
|
15557
|
-
out.push({ cardId: audit.cardId, title: audit.title,
|
|
15592
|
+
if (filter.studio !== void 0 && studio !== filter.studio) continue;
|
|
15593
|
+
out.push({ cardId: audit.cardId, title: audit.title, studio, at: landing.at, commit: landing.commit });
|
|
15558
15594
|
}
|
|
15559
15595
|
return out.sort((a, b) => a.at - b.at);
|
|
15560
15596
|
}
|
|
@@ -15636,7 +15672,7 @@ function resumeRefusal(delivery, store) {
|
|
|
15636
15672
|
}
|
|
15637
15673
|
if (delivery.cardId === null) return void 0;
|
|
15638
15674
|
const card = String(delivery.cardId);
|
|
15639
|
-
const pendingArchive = delivery.completions?.some((c) => !c.finished && c.step + 1 >= (delivery.
|
|
15675
|
+
const pendingArchive = delivery.completions?.some((c) => !c.finished && c.step + 1 >= (delivery.studio?.land?.length ?? 1));
|
|
15640
15676
|
if (cardOnBoard(delivery.cardId) === false && !(pendingArchive && locateArchived(delivery.cardId))) {
|
|
15641
15677
|
return refusal(
|
|
15642
15678
|
"deliveryCardGone",
|
|
@@ -15806,13 +15842,13 @@ function joinDelivery(store, run2, title, step, start, direct) {
|
|
|
15806
15842
|
priorStatus: cardId2 === null ? void 0 : cardStatus(cardId2),
|
|
15807
15843
|
planned: start?.planned,
|
|
15808
15844
|
rules: {
|
|
15809
|
-
...deliveryRules(cardId2 === null ? direct?.scheduled?.
|
|
15845
|
+
...deliveryRules(cardId2 === null ? direct?.scheduled?.studio : cardStudioId(cardId2)),
|
|
15810
15846
|
...direct?.scheduled && readRule(direct.scheduled.agent) ? { [direct.scheduled.agent]: readRule(direct.scheduled.agent) } : {}
|
|
15811
15847
|
},
|
|
15812
|
-
// And the one read of the
|
|
15848
|
+
// And the one read of the studio it builds under (#715) — its name and all three
|
|
15813
15849
|
// stages' assignments, frozen the way the rules are. Reassigning a stage, renaming the
|
|
15814
|
-
//
|
|
15815
|
-
|
|
15850
|
+
// studio or deleting it changes the next delivery and never this one.
|
|
15851
|
+
studio: frozenStudio(cardId2 === null ? direct?.scheduled?.studio ?? "" : cardStudioId(cardId2)),
|
|
15816
15852
|
scheduled: direct?.scheduled,
|
|
15817
15853
|
targetBranch: start?.targetBranch
|
|
15818
15854
|
};
|
|
@@ -15899,7 +15935,7 @@ function heldByDelivery(cardId2, program2) {
|
|
|
15899
15935
|
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 `;
|
|
15900
15936
|
return `delivery ${delivery.deliveryId} ${doing}Discard on the card page, or \`${cmd} raw delivery cancel ${delivery.deliveryId}\` to end it here.`;
|
|
15901
15937
|
}
|
|
15902
|
-
var auditPath, activeAudits, auditRow, lastSessionRunning, localAudit, unknownDelivery, isResumable, APPROVED, isApproved, cardStatus, openQuestions, activeIn, listDeliveries,
|
|
15938
|
+
var auditPath, activeAudits, auditRow, lastSessionRunning, localAudit, unknownDelivery, isResumable, APPROVED, isApproved, cardStatus, openQuestions, activeIn, listDeliveries, withStudio;
|
|
15903
15939
|
var init_deliveries = __esm({
|
|
15904
15940
|
"../cli/src/lib/agent/deliveries.ts"() {
|
|
15905
15941
|
"use strict";
|
|
@@ -15914,7 +15950,7 @@ var init_deliveries = __esm({
|
|
|
15914
15950
|
init_flows();
|
|
15915
15951
|
init_pause();
|
|
15916
15952
|
init_rules2();
|
|
15917
|
-
|
|
15953
|
+
init_studios();
|
|
15918
15954
|
init_store();
|
|
15919
15955
|
init_types();
|
|
15920
15956
|
init_worktree();
|
|
@@ -15939,9 +15975,9 @@ var init_deliveries = __esm({
|
|
|
15939
15975
|
openQuestions = (cardId2) => cardMeta2(cardId2)?.questions.length ?? 0;
|
|
15940
15976
|
activeIn = (store, cardId2) => store.deliveries.find((d) => d.status === "active" && d.cardId === cardId2);
|
|
15941
15977
|
listDeliveries = () => readStore().deliveries;
|
|
15942
|
-
|
|
15978
|
+
withStudio = (req) => req.studio ? req : {
|
|
15943
15979
|
...req,
|
|
15944
|
-
|
|
15980
|
+
studio: deliveryFor(req)?.studio?.id ?? (typeof req.id === "number" ? cardStudioId(req.id) || void 0 : void 0)
|
|
15945
15981
|
};
|
|
15946
15982
|
}
|
|
15947
15983
|
});
|
|
@@ -16009,7 +16045,7 @@ var init_Compare = __esm({
|
|
|
16009
16045
|
var Set_default;
|
|
16010
16046
|
var init_Set = __esm({
|
|
16011
16047
|
"../cli/src/components/Set.md"() {
|
|
16012
|
-
Set_default = '# Set\n\nGroup three or more previews of one purpose: a `<Set label="...">` line, one `<Asset ... />` per line, then `</Set
|
|
16048
|
+
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';
|
|
16013
16049
|
}
|
|
16014
16050
|
});
|
|
16015
16051
|
|
|
@@ -16021,11 +16057,11 @@ var init_Storyboard = __esm({
|
|
|
16021
16057
|
}
|
|
16022
16058
|
});
|
|
16023
16059
|
|
|
16024
|
-
// ../cli/src/components/
|
|
16025
|
-
var
|
|
16026
|
-
var
|
|
16027
|
-
"../cli/src/components/
|
|
16028
|
-
|
|
16060
|
+
// ../cli/src/components/Studio.md
|
|
16061
|
+
var Studio_default;
|
|
16062
|
+
var init_Studio = __esm({
|
|
16063
|
+
"../cli/src/components/Studio.md"() {
|
|
16064
|
+
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';
|
|
16029
16065
|
}
|
|
16030
16066
|
});
|
|
16031
16067
|
|
|
@@ -16057,9 +16093,9 @@ function agentComponents(names3, documents = DOCUMENTS) {
|
|
|
16057
16093
|
}
|
|
16058
16094
|
return [...docs.values()];
|
|
16059
16095
|
}
|
|
16060
|
-
function
|
|
16061
|
-
const flow =
|
|
16062
|
-
if (!flow) throw new BoardError(`no
|
|
16096
|
+
function studioComponents(id) {
|
|
16097
|
+
const flow = studioById(id);
|
|
16098
|
+
if (!flow) throw new BoardError(`no studio called "${id}"`, { kind: "unknown-studio", studio: id });
|
|
16063
16099
|
const members = [...previewMembers(flow), ...flow.land, ...scheduledMembers(flow)].map((row) => row.agent);
|
|
16064
16100
|
return agentComponents(members);
|
|
16065
16101
|
}
|
|
@@ -16071,13 +16107,13 @@ var init_components = __esm({
|
|
|
16071
16107
|
init_Compare();
|
|
16072
16108
|
init_Set();
|
|
16073
16109
|
init_Storyboard();
|
|
16074
|
-
|
|
16110
|
+
init_Studio();
|
|
16075
16111
|
init_shared();
|
|
16076
16112
|
init_agents();
|
|
16077
16113
|
init_io();
|
|
16078
16114
|
init_paths();
|
|
16079
|
-
|
|
16080
|
-
DOCUMENTS = { Asset: Asset_default, Compare: Compare_default, Storyboard: Storyboard_default, Set: Set_default,
|
|
16115
|
+
init_studios();
|
|
16116
|
+
DOCUMENTS = { Asset: Asset_default, Compare: Compare_default, Storyboard: Storyboard_default, Set: Set_default, Studio: Studio_default };
|
|
16081
16117
|
componentDocsText = (docs) => docs.length ? [shared_default, ...docs.map((doc) => doc.text)].map((text4) => text4.trim()).join("\n\n") : "";
|
|
16082
16118
|
}
|
|
16083
16119
|
});
|
|
@@ -16263,15 +16299,15 @@ function restartPrompt(req, deliveryId) {
|
|
|
16263
16299
|
return [RESTART_LEAD, buildPrompt(req)].join("\n\n");
|
|
16264
16300
|
}
|
|
16265
16301
|
function buildAsk(rawReq, notes = []) {
|
|
16266
|
-
const req =
|
|
16302
|
+
const req = withStudio(rawReq);
|
|
16267
16303
|
const command = DELIVERY_FLOWS.has(req.action) ? boardCommandFor(req.id) : boardCommand();
|
|
16268
16304
|
const ask2 = [actionPrompt(req, command, notes), pictureNote(req), commandNote(command)].filter(Boolean).join(" ");
|
|
16269
16305
|
return realPaths(boardText([ask2, roster(req), componentsBlock(req)].filter(Boolean).join("\n\n")), req);
|
|
16270
16306
|
}
|
|
16271
16307
|
function componentsBlock(req) {
|
|
16272
16308
|
const agent = findSpecAgent(agentForRun(req) ?? "");
|
|
16273
|
-
const flow =
|
|
16274
|
-
const docs = PLANNING_FOR.has(req.action) && flow ?
|
|
16309
|
+
const flow = studioFor(studioForRun(req));
|
|
16310
|
+
const docs = PLANNING_FOR.has(req.action) && flow ? studioComponents(flow.id) : agent ? agentComponents([agent.name]) : [];
|
|
16275
16311
|
const text4 = componentDocsText(docs);
|
|
16276
16312
|
return text4 ? `\u2014\u2014\u2014 preview components \u2014\u2014\u2014
|
|
16277
16313
|
|
|
@@ -16288,37 +16324,37 @@ function realPaths(text4, req) {
|
|
|
16288
16324
|
function helperExtra(req) {
|
|
16289
16325
|
const agent = req.specAgent ?? "";
|
|
16290
16326
|
if (!agent || req.action !== "spec") return "";
|
|
16291
|
-
const frozen = deliveryFor(req)?.
|
|
16292
|
-
const flow = frozen ? void 0 :
|
|
16327
|
+
const frozen = deliveryFor(req)?.studio;
|
|
16328
|
+
const flow = frozen ? void 0 : studioFor(studioForRun(req));
|
|
16293
16329
|
const rows = frozen ? frozen.previews ?? [] : flow ? previewMembers(flow) : [];
|
|
16294
16330
|
const extra = rows.find((h) => h.agent === agent)?.extra?.trim();
|
|
16295
|
-
return extra ? `\u2014\u2014\u2014 what this
|
|
16331
|
+
return extra ? `\u2014\u2014\u2014 what this studio asks of you here \u2014\u2014\u2014
|
|
16296
16332
|
|
|
16297
16333
|
${extra}` : "";
|
|
16298
16334
|
}
|
|
16299
|
-
function
|
|
16335
|
+
function studioRulesBlock(req) {
|
|
16300
16336
|
if (!PLANNING_FOR.has(req.action)) return "";
|
|
16301
|
-
const flow =
|
|
16337
|
+
const flow = studioFor(studioForRun(req));
|
|
16302
16338
|
if (!flow) return "";
|
|
16303
16339
|
const meta = req.id !== void 0 ? cardMeta(req.id) : null;
|
|
16304
16340
|
const stages = cardStages(meta, flow).length;
|
|
16305
16341
|
const stage = cardStage(meta, flow);
|
|
16306
16342
|
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" : ""}.` : "";
|
|
16307
|
-
const end2 = landAgents(flow).length ? "After the last approval, the
|
|
16308
|
-
const own =
|
|
16343
|
+
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.";
|
|
16344
|
+
const own = userStudioRules(flow);
|
|
16309
16345
|
const body = [where, end2, flow.rules.trim()].filter(Boolean).join("\n\n");
|
|
16310
16346
|
return [
|
|
16311
|
-
`<
|
|
16312
|
-
"How a card on this
|
|
16347
|
+
`<studio name="${flow.name}">`,
|
|
16348
|
+
"How a card on this studio is written.",
|
|
16313
16349
|
body,
|
|
16314
|
-
"</
|
|
16315
|
-
...own ? ["", "<rules>", "The user's own rules for cards on this
|
|
16350
|
+
"</studio>",
|
|
16351
|
+
...own ? ["", "<rules>", "The user's own rules for cards on this studio; they win over the studio above.", own, "</rules>"] : []
|
|
16316
16352
|
].join("\n");
|
|
16317
16353
|
}
|
|
16318
16354
|
function landBlock(req) {
|
|
16319
16355
|
if (req.action !== "implement") return "";
|
|
16320
|
-
const frozen = deliveryFor(req)?.
|
|
16321
|
-
const flow = frozen ? void 0 :
|
|
16356
|
+
const frozen = deliveryFor(req)?.studio;
|
|
16357
|
+
const flow = frozen ? void 0 : studioFor(studioForRun(req));
|
|
16322
16358
|
const rows = frozen ? frozen.land ?? [] : flow ? landAgents(flow) : [];
|
|
16323
16359
|
const delivery = deliveryFor(req);
|
|
16324
16360
|
const step = delivery ? deliveryStep(delivery) : 0;
|
|
@@ -16338,7 +16374,7 @@ ${agentFilesBlock(agent)}` : "",
|
|
|
16338
16374
|
globalMemoryBlock(agent) ? `\u2014\u2014\u2014 global memories \u2014\u2014\u2014
|
|
16339
16375
|
|
|
16340
16376
|
${globalMemoryBlock(agent)}` : "",
|
|
16341
|
-
extra ? `\u2014\u2014\u2014 what this
|
|
16377
|
+
extra ? `\u2014\u2014\u2014 what this studio asks of you here \u2014\u2014\u2014
|
|
16342
16378
|
|
|
16343
16379
|
${extra}` : ""
|
|
16344
16380
|
].filter(Boolean).join("\n\n")
|
|
@@ -16346,8 +16382,8 @@ ${extra}` : ""
|
|
|
16346
16382
|
);
|
|
16347
16383
|
}
|
|
16348
16384
|
function buildPrompt(rawReq, notes = []) {
|
|
16349
|
-
const req =
|
|
16350
|
-
return [buildAsk(req, notes),
|
|
16385
|
+
const req = withStudio(rawReq);
|
|
16386
|
+
return [buildAsk(req, notes), studioRulesBlock(req), landBlock(req), settingsBlock(req), ruleBlock(req, frozenRules(req))].filter(Boolean).join("\n\n");
|
|
16351
16387
|
}
|
|
16352
16388
|
function settingsBlock(req) {
|
|
16353
16389
|
const owner = ruleOwner(req);
|
|
@@ -16388,14 +16424,14 @@ function reflectBlocks(ids) {
|
|
|
16388
16424
|
}
|
|
16389
16425
|
function scheduledBlock() {
|
|
16390
16426
|
const given = process.env[SCHEDULED_AGENTS_ENV];
|
|
16391
|
-
const on = new Set(given === void 0 ?
|
|
16427
|
+
const on = new Set(given === void 0 ? studios().flatMap((flow) => listedScheduled(flow)) : given.split(","));
|
|
16392
16428
|
const lines = specAgentCatalog().agents.filter((a) => on.has(a.name)).map((a) => `${a.name} \u2014 ${a.description}`);
|
|
16393
16429
|
return lines.length ? ["<scheduled-agents>", ...lines, "</scheduled-agents>"] : [];
|
|
16394
16430
|
}
|
|
16395
16431
|
function roster(req) {
|
|
16396
16432
|
if (req.id === void 0) return "";
|
|
16397
16433
|
if (!SPEC_SELECTOR_FOR.has(req.action)) return "";
|
|
16398
|
-
const flow =
|
|
16434
|
+
const flow = studioFor(studioForRun(req));
|
|
16399
16435
|
return specAgentSelector(req.id, flow?.id, cardMeta(req.id));
|
|
16400
16436
|
}
|
|
16401
16437
|
function buildRun(req) {
|
|
@@ -16536,9 +16572,9 @@ ${memory}` : "",
|
|
|
16536
16572
|
shared ? `\u2014\u2014\u2014 global memories \u2014\u2014\u2014
|
|
16537
16573
|
|
|
16538
16574
|
${shared}` : "",
|
|
16539
|
-
// What THIS
|
|
16575
|
+
// What THIS studio asks of it here (#715) — the assignment's own words, after the
|
|
16540
16576
|
// agent's instructions and its memory, because it is written on top of them and never
|
|
16541
|
-
// in place of them. A card whose
|
|
16577
|
+
// in place of them. A card whose studio does not call this agent in has none.
|
|
16542
16578
|
helperExtra(req)
|
|
16543
16579
|
].filter(Boolean).join("\n\n");
|
|
16544
16580
|
}
|
|
@@ -16550,11 +16586,11 @@ ${shared}` : "",
|
|
|
16550
16586
|
if (own) notes.push(...own.notes);
|
|
16551
16587
|
const memory = agent ? agentMemoryBlock(agent) : "";
|
|
16552
16588
|
const shared = agent ? globalMemoryBlock(agent) : "";
|
|
16553
|
-
const flow =
|
|
16589
|
+
const flow = studioById(req.studio ?? "");
|
|
16554
16590
|
const extra = flow ? scheduledAgent(flow.id, req.specAgent ?? "")?.extra.trim() : "";
|
|
16555
16591
|
return [
|
|
16556
16592
|
[
|
|
16557
|
-
`You are the \`${req.specAgent}\` agent of the \`${flow?.name ?? req.
|
|
16593
|
+
`You are the \`${req.specAgent}\` agent of the \`${flow?.name ?? req.studio ?? ""}\` studio.`,
|
|
16558
16594
|
`The board is at \`${BOARD_FOLDER}\`, in the project at \`${PROJECT_FOLDER}\`.`,
|
|
16559
16595
|
`Nobody is watching: never ask.`,
|
|
16560
16596
|
req.deliveryId ? `When the outcome is complete, run \`${command} raw delivery complete ${req.deliveryId}\`.` : ""
|
|
@@ -16565,7 +16601,7 @@ ${own.instructions}` : "",
|
|
|
16565
16601
|
own?.files ? `\u2014\u2014\u2014 your own files \u2014\u2014\u2014
|
|
16566
16602
|
|
|
16567
16603
|
${own.files}` : "",
|
|
16568
|
-
extra ? `\u2014\u2014\u2014 what this
|
|
16604
|
+
extra ? `\u2014\u2014\u2014 what this studio asks of you here \u2014\u2014\u2014
|
|
16569
16605
|
|
|
16570
16606
|
${extra}` : "",
|
|
16571
16607
|
memory ? `\u2014\u2014\u2014 what you remember \u2014\u2014\u2014
|
|
@@ -16649,7 +16685,7 @@ var init_prompts = __esm({
|
|
|
16649
16685
|
init_flows();
|
|
16650
16686
|
init_resolve();
|
|
16651
16687
|
init_runner();
|
|
16652
|
-
|
|
16688
|
+
init_studios();
|
|
16653
16689
|
init_catalog();
|
|
16654
16690
|
init_roles();
|
|
16655
16691
|
init_rules2();
|
|
@@ -16961,10 +16997,10 @@ function recordReflection(run2) {
|
|
|
16961
16997
|
}
|
|
16962
16998
|
}
|
|
16963
16999
|
function recordScheduledRun(run2) {
|
|
16964
|
-
if (run2.action !== "scheduled" || run2.status !== "done" || !run2.
|
|
17000
|
+
if (run2.action !== "scheduled" || run2.status !== "done" || !run2.studio || !run2.specAgent) return;
|
|
16965
17001
|
try {
|
|
16966
17002
|
const began = (run2.deliveryId ? findDelivery(run2.deliveryId)?.startedAt : void 0) ?? run2.startedAt;
|
|
16967
|
-
stampScheduledRun(run2.
|
|
17003
|
+
stampScheduledRun(run2.studio, run2.specAgent, new Date(began));
|
|
16968
17004
|
} catch {
|
|
16969
17005
|
}
|
|
16970
17006
|
}
|
|
@@ -17004,7 +17040,7 @@ function retryAsk(r) {
|
|
|
17004
17040
|
triage: r.triage,
|
|
17005
17041
|
refineRound: r.refineRound,
|
|
17006
17042
|
flowId: r.flowId,
|
|
17007
|
-
|
|
17043
|
+
studio: r.studio,
|
|
17008
17044
|
cards: r.cards
|
|
17009
17045
|
};
|
|
17010
17046
|
switch (r.action) {
|
|
@@ -17179,16 +17215,16 @@ function approvedDirect(req) {
|
|
|
17179
17215
|
return typed ? { title: typed, approved: typed } : void 0;
|
|
17180
17216
|
}
|
|
17181
17217
|
function scheduledDirect(req) {
|
|
17182
|
-
const flow =
|
|
17218
|
+
const flow = studioById(req.studio ?? "");
|
|
17183
17219
|
const agent = req.specAgent ?? "";
|
|
17184
17220
|
const one = flow ? scheduledAgent(flow.id, agent) : void 0;
|
|
17185
17221
|
if (!flow || !one) {
|
|
17186
|
-
return refusal("agentNotScheduled", `\`${agent}\` is not a scheduled agent of the \`${req.
|
|
17222
|
+
return refusal("agentNotScheduled", `\`${agent}\` is not a scheduled agent of the \`${req.studio ?? ""}\` studio`, {
|
|
17187
17223
|
agent,
|
|
17188
|
-
|
|
17224
|
+
studio: req.studio ?? ""
|
|
17189
17225
|
});
|
|
17190
17226
|
}
|
|
17191
|
-
return { title: `${agent}: scheduled run (${flow.name})`, approved: "", scheduled: {
|
|
17227
|
+
return { title: `${agent}: scheduled run (${flow.name})`, approved: "", scheduled: { studio: flow.id, agent } };
|
|
17192
17228
|
}
|
|
17193
17229
|
function openRun(req, prompt, notes = [], sessionId = randomUUID4(), said2) {
|
|
17194
17230
|
const cardId2 = Number.isInteger(req.id) ? req.id : null;
|
|
@@ -17250,8 +17286,8 @@ function openRun(req, prompt, notes = [], sessionId = randomUUID4(), said2) {
|
|
|
17250
17286
|
// Which agent this is, on the action that is one — so the run list can name it, and so
|
|
17251
17287
|
// a resume starts the same agent rather than a different one.
|
|
17252
17288
|
specAgent: SPECIALIST_ACTIONS.has(req.action) ? req.specAgent : void 0,
|
|
17253
|
-
...req.action === "implement" && cardId2 === null ? {
|
|
17254
|
-
...req.action === "scheduled" ? {
|
|
17289
|
+
...req.action === "implement" && cardId2 === null ? { studio: req.studio?.trim() || void 0 } : {},
|
|
17290
|
+
...req.action === "scheduled" ? { studio: req.studio?.trim() || void 0 } : {},
|
|
17255
17291
|
cards: req.action === "reflect" ? req.cards : void 0,
|
|
17256
17292
|
// Internal refinement sessions name their position in the request. A standalone
|
|
17257
17293
|
// resolve carries no round.
|
|
@@ -17350,7 +17386,7 @@ function requestOf(record) {
|
|
|
17350
17386
|
// the CLI actually spawned takes it.
|
|
17351
17387
|
runtime: record.runtime,
|
|
17352
17388
|
specAgent: record.specAgent,
|
|
17353
|
-
...record.action === "scheduled" ? {
|
|
17389
|
+
...record.action === "scheduled" ? { studio: record.studio } : {},
|
|
17354
17390
|
triage: record.triage,
|
|
17355
17391
|
cards: record.cards,
|
|
17356
17392
|
refineRound: record.refineRound,
|
|
@@ -17449,7 +17485,7 @@ async function resumeHeld(prev, plan, sessionId, resuming, fresh) {
|
|
|
17449
17485
|
// No `input` on a resume: the note the user typed is already in the conversation being
|
|
17450
17486
|
// resumed — repeating it would read as a second instruction they never gave. A retry is
|
|
17451
17487
|
// the ask itself again, so it keeps everything the ask was written down with.
|
|
17452
|
-
...retry2 ? { input: prev.input,
|
|
17488
|
+
...retry2 ? { input: prev.input, studio: prev.studio } : {},
|
|
17453
17489
|
harness: plan.harness,
|
|
17454
17490
|
runtime: plan.runtime,
|
|
17455
17491
|
agent: plan.agent,
|
|
@@ -17470,7 +17506,7 @@ async function resumeHeld(prev, plan, sessionId, resuming, fresh) {
|
|
|
17470
17506
|
},
|
|
17471
17507
|
logPath: logPathOf(sessionId),
|
|
17472
17508
|
specAgent: prev.specAgent,
|
|
17473
|
-
...prev.action === "scheduled" ? {
|
|
17509
|
+
...prev.action === "scheduled" ? { studio: prev.studio } : {},
|
|
17474
17510
|
cards: prev.cards,
|
|
17475
17511
|
refineRound: prev.refineRound,
|
|
17476
17512
|
// The same refinement carried on, not a second one — the way a resume re-joins the
|
|
@@ -17815,7 +17851,7 @@ var init_sessions = __esm({
|
|
|
17815
17851
|
init_stop();
|
|
17816
17852
|
init_runtimes();
|
|
17817
17853
|
init_settings();
|
|
17818
|
-
|
|
17854
|
+
init_studios();
|
|
17819
17855
|
init_store();
|
|
17820
17856
|
init_creation_lock();
|
|
17821
17857
|
init_rules();
|
|
@@ -17940,7 +17976,7 @@ function serialize(signal2) {
|
|
|
17940
17976
|
...signal2.sourceType ? [`source_type: ${yamlScalar(signal2.sourceType)}`] : [],
|
|
17941
17977
|
...signal2.url ? [`url: ${yamlScalar(signal2.url)}`] : [],
|
|
17942
17978
|
...signal2.agent ? [`agent: ${yamlScalar(signal2.agent)}`] : [],
|
|
17943
|
-
...signal2.
|
|
17979
|
+
...signal2.studio ? [`studio: ${yamlScalar(signal2.studio)}`] : [],
|
|
17944
17980
|
`collected_at: ${yamlScalar(signal2.collectedAt)}`,
|
|
17945
17981
|
`imported_at: ${yamlScalar(signal2.importedAt)}`,
|
|
17946
17982
|
...signal2.meta.length > 0 ? ["meta:", ...signal2.meta.map((pair) => ` ${yamlScalar(pair.key)}: ${yamlScalar(pair.value)}`)] : [],
|
|
@@ -17995,7 +18031,7 @@ function parse(file, lenient = false) {
|
|
|
17995
18031
|
meta: missed ? [missed, ...written] : written,
|
|
17996
18032
|
url: held4.url || "",
|
|
17997
18033
|
...held4.agent ? { agent: held4.agent } : {},
|
|
17998
|
-
...held4.
|
|
18034
|
+
...held4.studio ? { studio: held4.studio } : {},
|
|
17999
18035
|
collectedAt: held4.collected_at ?? "",
|
|
18000
18036
|
importedAt: held4.imported_at ?? "",
|
|
18001
18037
|
dismissedAt: held4.dismissed_at || "",
|
|
@@ -18168,30 +18204,30 @@ var init_source = __esm({
|
|
|
18168
18204
|
}
|
|
18169
18205
|
});
|
|
18170
18206
|
|
|
18171
|
-
// ../cli/src/lib/agent/
|
|
18172
|
-
function
|
|
18207
|
+
// ../cli/src/lib/agent/studio-cards.ts
|
|
18208
|
+
function switchStudio(id, meta, asked) {
|
|
18173
18209
|
const wanted = asked.trim();
|
|
18174
|
-
const next =
|
|
18175
|
-
if (next === meta.
|
|
18210
|
+
const next = knownStudio(wanted);
|
|
18211
|
+
if (next === meta.studio) return false;
|
|
18176
18212
|
if (readRuns().some((r) => r.cardId === id && runIsLive(r))) {
|
|
18177
|
-
die(`#${id} has a run in progress \u2014 stop it before switching its
|
|
18213
|
+
die(`#${id} has a run in progress \u2014 stop it before switching its studio.`, { kind: "card-held", id });
|
|
18178
18214
|
}
|
|
18179
18215
|
const held4 = heldByDelivery(id);
|
|
18180
18216
|
if (held4) die(held4, { kind: "card-held", id });
|
|
18181
|
-
meta.
|
|
18217
|
+
meta.studio = next;
|
|
18182
18218
|
meta.status = "todo";
|
|
18183
18219
|
delete meta.previews;
|
|
18184
18220
|
meta.stages = 0;
|
|
18185
18221
|
meta.phase = 0;
|
|
18186
18222
|
return true;
|
|
18187
18223
|
}
|
|
18188
|
-
var
|
|
18189
|
-
"../cli/src/lib/agent/
|
|
18224
|
+
var init_studio_cards = __esm({
|
|
18225
|
+
"../cli/src/lib/agent/studio-cards.ts"() {
|
|
18190
18226
|
"use strict";
|
|
18191
18227
|
init_paths();
|
|
18192
18228
|
init_deliveries();
|
|
18193
18229
|
init_store();
|
|
18194
|
-
|
|
18230
|
+
init_studios();
|
|
18195
18231
|
}
|
|
18196
18232
|
});
|
|
18197
18233
|
|
|
@@ -18379,7 +18415,7 @@ function assetName(src, cardId2, exts, nested = false) {
|
|
|
18379
18415
|
if (exts.length && (!name.includes(".") || !exts.includes(ext))) return { expected, actual: `file type ${JSON.stringify(name.includes(".") ? ext : "")}` };
|
|
18380
18416
|
return { name };
|
|
18381
18417
|
}
|
|
18382
|
-
var TAG2, attr, SRC_ATTR, LABEL_ATTR, SEGMENT2, storyboardTag,
|
|
18418
|
+
var TAG2, attr, SRC_ATTR, LABEL_ATTR, SEGMENT2, storyboardTag, studioTag;
|
|
18383
18419
|
var init_storyboard = __esm({
|
|
18384
18420
|
"../cli/src/lib/storyboard.ts"() {
|
|
18385
18421
|
"use strict";
|
|
@@ -18389,8 +18425,8 @@ var init_storyboard = __esm({
|
|
|
18389
18425
|
LABEL_ATTR = attr("label");
|
|
18390
18426
|
SEGMENT2 = /^(?!\.)[^/\\]+$/;
|
|
18391
18427
|
storyboardTag = (raw) => storyboardAttrs(raw)?.src ?? null;
|
|
18392
|
-
|
|
18393
|
-
const m = /^<
|
|
18428
|
+
studioTag = (raw) => {
|
|
18429
|
+
const m = /^<Studio\b([^<>]*?)\/>$/.exec(raw.trim());
|
|
18394
18430
|
const src = m ? SRC_ATTR.exec(m[1]) : null;
|
|
18395
18431
|
return src ? src[1] ?? src[2] : null;
|
|
18396
18432
|
};
|
|
@@ -18401,7 +18437,7 @@ var init_storyboard = __esm({
|
|
|
18401
18437
|
var compare_default;
|
|
18402
18438
|
var init_compare2 = __esm({
|
|
18403
18439
|
"../artifact-sdk/src/builtin/compare.json"() {
|
|
18404
|
-
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", "
|
|
18440
|
+
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';
|
|
18405
18441
|
}
|
|
18406
18442
|
});
|
|
18407
18443
|
|
|
@@ -18463,7 +18499,7 @@ var init_spritesheet = __esm({
|
|
|
18463
18499
|
var storyboard_default;
|
|
18464
18500
|
var init_storyboard2 = __esm({
|
|
18465
18501
|
"../artifact-sdk/src/builtin/storyboard.json"() {
|
|
18466
|
-
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", "
|
|
18502
|
+
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';
|
|
18467
18503
|
}
|
|
18468
18504
|
});
|
|
18469
18505
|
|
|
@@ -18494,11 +18530,11 @@ var init_video = __esm({
|
|
|
18494
18530
|
}
|
|
18495
18531
|
});
|
|
18496
18532
|
|
|
18497
|
-
// ../artifact-sdk/src/builtin/
|
|
18498
|
-
var
|
|
18499
|
-
var
|
|
18500
|
-
"../artifact-sdk/src/builtin/
|
|
18501
|
-
|
|
18533
|
+
// ../artifact-sdk/src/builtin/studio.json
|
|
18534
|
+
var studio_default;
|
|
18535
|
+
var init_studio = __esm({
|
|
18536
|
+
"../artifact-sdk/src/builtin/studio.json"() {
|
|
18537
|
+
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';
|
|
18502
18538
|
}
|
|
18503
18539
|
});
|
|
18504
18540
|
|
|
@@ -18515,9 +18551,9 @@ var init_builtin = __esm({
|
|
|
18515
18551
|
init_storyboard2();
|
|
18516
18552
|
init_tiled();
|
|
18517
18553
|
init_video();
|
|
18518
|
-
|
|
18554
|
+
init_studio();
|
|
18519
18555
|
read = (m) => typeof m === "string" ? JSON.parse(m) : m;
|
|
18520
|
-
builtin_default = [html_default, image_default, video_default, markdown_default, storyboard_default, compare_default,
|
|
18556
|
+
builtin_default = [html_default, image_default, video_default, markdown_default, storyboard_default, compare_default, studio_default, tiled_default, spritesheet_default].map(read);
|
|
18521
18557
|
}
|
|
18522
18558
|
});
|
|
18523
18559
|
|
|
@@ -18670,12 +18706,12 @@ function bodyReferences(body) {
|
|
|
18670
18706
|
}
|
|
18671
18707
|
const kept2 = inTag || !/^(?: {4}|\t)/.test(line);
|
|
18672
18708
|
visible.push(kept2 ? line : "");
|
|
18673
|
-
if (kept2 && /^ {0,3}<(?:Asset|Mockup|Compare|Storyboard|
|
|
18709
|
+
if (kept2 && /^ {0,3}<(?:Asset|Mockup|Compare|Storyboard|Studio)\b/.test(line)) inTag = true;
|
|
18674
18710
|
if (line.includes("/>")) inTag = false;
|
|
18675
18711
|
}
|
|
18676
18712
|
const text4 = visible.join("\n").replace(/(`+)[^]*?\1/g, "");
|
|
18677
|
-
const tag = /<(Asset|Mockup|Compare|Storyboard|
|
|
18678
|
-
const blocks = text4.matchAll(/^ {0,3}(?:<(?:Asset|Mockup|Compare|Storyboard|
|
|
18713
|
+
const tag = /<(Asset|Mockup|Compare|Storyboard|Studio)\b([^<>]*?)\/>/g;
|
|
18714
|
+
const blocks = text4.matchAll(/^ {0,3}(?:<(?:Asset|Mockup|Compare|Storyboard|Studio)\b[^<>]*?\/>[ \t]*(?:\n[ \t]*)?)+$/gm);
|
|
18679
18715
|
for (const block of blocks) {
|
|
18680
18716
|
const tags = [...block[0].matchAll(tag)];
|
|
18681
18717
|
for (const m of tags) {
|
|
@@ -18685,7 +18721,7 @@ function bodyReferences(body) {
|
|
|
18685
18721
|
if (!a.a || !a.b) continue;
|
|
18686
18722
|
for (const k of ["a", "b", "shots"]) if (a[k]) out.push({ src: a[k], types: ARRANGED });
|
|
18687
18723
|
} else if (a.src) {
|
|
18688
|
-
out.push({ src: a.src, types: m[1] === "Storyboard" ? STORYBOARD : m[1] === "
|
|
18724
|
+
out.push({ src: a.src, types: m[1] === "Storyboard" ? STORYBOARD : m[1] === "Studio" ? STUDIO : m[1] === "Asset" ? ASSET : [] });
|
|
18689
18725
|
if (a.variants) {
|
|
18690
18726
|
try {
|
|
18691
18727
|
const v = JSON.parse(a.variants);
|
|
@@ -18709,13 +18745,13 @@ function kindOf2(ext) {
|
|
|
18709
18745
|
if (type.startsWith("image/")) return "image";
|
|
18710
18746
|
return type.startsWith("video/") || type.startsWith("audio/") ? "video" : "asset";
|
|
18711
18747
|
}
|
|
18712
|
-
var STORYBOARD,
|
|
18748
|
+
var STORYBOARD, STUDIO, ARRANGED, ASSET, isObject2, TYPES;
|
|
18713
18749
|
var init_references = __esm({
|
|
18714
18750
|
"../artifact-sdk/src/internal/references.ts"() {
|
|
18715
18751
|
"use strict";
|
|
18716
18752
|
STORYBOARD = ["storyboard"];
|
|
18717
|
-
|
|
18718
|
-
ARRANGED = ["storyboard", "compare", "spritesheet", "
|
|
18753
|
+
STUDIO = ["studio"];
|
|
18754
|
+
ARRANGED = ["storyboard", "compare", "spritesheet", "studio"];
|
|
18719
18755
|
ASSET = ["spritesheet", "asset"];
|
|
18720
18756
|
isObject2 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
|
|
18721
18757
|
TYPES = {
|
|
@@ -19090,8 +19126,8 @@ function validateSpec(file, text4, id) {
|
|
|
19090
19126
|
if (/^\s*<Storyboard\b/.test(line) && (storyboardTag(line) === null || lines[i - 1]?.trim() || lines[i + 1]?.trim())) {
|
|
19091
19127
|
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.');
|
|
19092
19128
|
}
|
|
19093
|
-
if (/^\s*<
|
|
19094
|
-
add(i + 1, "
|
|
19129
|
+
if (/^\s*<Studio\b/.test(line) && (studioTag(line) === null || !/\blabel="[^"]+"/.test(line) || lines[i - 1]?.trim() || lines[i + 1]?.trim())) {
|
|
19130
|
+
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.');
|
|
19095
19131
|
}
|
|
19096
19132
|
if (/^\s*<Compare\b/.test(line)) {
|
|
19097
19133
|
const attrs = compareAttrs(line);
|
|
@@ -19142,8 +19178,9 @@ function validateSpec(file, text4, id) {
|
|
|
19142
19178
|
function setEnd(lines, at) {
|
|
19143
19179
|
if (!/^\s*<Set\b[^<>]*>\s*$/.test(lines[at]) || lines[at - 1]?.trim()) return -1;
|
|
19144
19180
|
let i = at + 1;
|
|
19145
|
-
|
|
19146
|
-
|
|
19181
|
+
let assets = 0;
|
|
19182
|
+
for (; i < lines.length && (ASSET_LINE.test(lines[i]) || !lines[i].trim()); i++) if (lines[i].trim()) assets++;
|
|
19183
|
+
if (!assets || !/^\s*<\/Set>\s*$/.test(lines[i] ?? "") || lines[i + 1]?.trim()) return -1;
|
|
19147
19184
|
return i;
|
|
19148
19185
|
}
|
|
19149
19186
|
function inside(dir, name) {
|
|
@@ -19229,7 +19266,7 @@ function validateStoryboards(file, id, text4) {
|
|
|
19229
19266
|
const dir = path60.join(ASSETS, String(id));
|
|
19230
19267
|
for (const [tag, tagOf, rule, fix] of [
|
|
19231
19268
|
["Storyboard", storyboardTag, "storyboard-src", "Write the JSON there or fix the path."],
|
|
19232
|
-
["
|
|
19269
|
+
["Studio", studioTag, "studio-src", "Write it with `akb raw studio diagram <studio id> <card id>` or fix the path."]
|
|
19233
19270
|
]) {
|
|
19234
19271
|
for (const marker of storyboardMarkers(text4, tagOf)) {
|
|
19235
19272
|
const named2 = assetName(marker.src, id, ["json"]);
|
|
@@ -19448,8 +19485,8 @@ function validateCreate(opts) {
|
|
|
19448
19485
|
const related = parseIdList(opts.related ?? [], "related");
|
|
19449
19486
|
const modules = validModules(opts.modules ?? []);
|
|
19450
19487
|
const triage = (opts.triage ?? "").trim();
|
|
19451
|
-
const
|
|
19452
|
-
const flow =
|
|
19488
|
+
const studio = studioFlag(opts.studio ?? (triage ? itemStudio(triage) : void 0));
|
|
19489
|
+
const flow = studioFor(studio);
|
|
19453
19490
|
const previews = opts.previews === void 0 ? void 0 : previewsFlag(opts.previews, flow);
|
|
19454
19491
|
const stages = previews ? cardStages({ previews }, flow).length : 0;
|
|
19455
19492
|
const source = sourceFlag(opts.source ?? [], "source");
|
|
@@ -19457,10 +19494,10 @@ function validateCreate(opts) {
|
|
|
19457
19494
|
const questions = collectQuestions(opts.asked ?? []);
|
|
19458
19495
|
const draft = bodyFromFile(opts);
|
|
19459
19496
|
const written = draft ? normalizeBody(draft) : null;
|
|
19460
|
-
return { title, priority, blocked_by, related, modules, triage,
|
|
19497
|
+
return { title, priority, blocked_by, related, modules, triage, studio, previews, stages, source, questions, written };
|
|
19461
19498
|
}
|
|
19462
19499
|
function cmdCreate(opts) {
|
|
19463
|
-
const { title, priority, blocked_by, related, modules, triage,
|
|
19500
|
+
const { title, priority, blocked_by, related, modules, triage, studio, previews, stages, source, questions, written } = validateCreate(opts);
|
|
19464
19501
|
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" });
|
|
19465
19502
|
const start = opts.id;
|
|
19466
19503
|
const slug2 = slugify(opts.slug !== void 0 ? opts.slug : title);
|
|
@@ -19475,7 +19512,7 @@ function cmdCreate(opts) {
|
|
|
19475
19512
|
if (held4) die(`#${start} is already a card here (${rel(held4.target)})`, { kind: "id-taken", id: start });
|
|
19476
19513
|
if (fs59.existsSync(file)) die(`${rel(file)} already exists \u2014 pick a different --slug`);
|
|
19477
19514
|
countBoardEvent(triage ? "cards_created_proposed" : "cards_created_asked");
|
|
19478
|
-
const meta = { title, priority, status: "todo", blocked_by, related, modules,
|
|
19515
|
+
const meta = { title, priority, status: "todo", blocked_by, related, modules, studio, previews, stages, triage, source, questions };
|
|
19479
19516
|
const scaffolded = !written && opts.body !== false;
|
|
19480
19517
|
const body = written ?? (scaffolded ? defaultBody() : "");
|
|
19481
19518
|
fs59.writeFileSync(file, serializeFrontmatter(meta) + "\n\n" + body);
|
|
@@ -19499,26 +19536,26 @@ function sourceFlag(said2, flag) {
|
|
|
19499
19536
|
}
|
|
19500
19537
|
return out;
|
|
19501
19538
|
}
|
|
19502
|
-
function
|
|
19539
|
+
function studioFlag(asked) {
|
|
19503
19540
|
const wanted = (asked ?? "").trim();
|
|
19504
|
-
if (wanted) return
|
|
19505
|
-
const all2 =
|
|
19506
|
-
if (!all2[0]) die(
|
|
19541
|
+
if (wanted) return knownStudio(wanted);
|
|
19542
|
+
const all2 = studios();
|
|
19543
|
+
if (!all2[0]) die(noStudioMessage(""), { kind: "no-studio", studio: "" });
|
|
19507
19544
|
if (all2.length > 1 && !workspaceTask()) {
|
|
19508
|
-
die(`--
|
|
19545
|
+
die(`--studio is required on a board with several studios. Pick one: ${all2.map((w) => w.id).join(", ")}`, { kind: "needs-input" });
|
|
19509
19546
|
}
|
|
19510
19547
|
return all2[0].id;
|
|
19511
19548
|
}
|
|
19512
|
-
function
|
|
19549
|
+
function itemStudio(sourceId) {
|
|
19513
19550
|
const item = [...readInbox(), ...readArchived(), ...readAllDismissed()].find((signal2) => signal2.sourceId === sourceId);
|
|
19514
|
-
return item?.
|
|
19551
|
+
return item?.studio && studioById(item.studio) ? item.studio : void 0;
|
|
19515
19552
|
}
|
|
19516
19553
|
function previewsFlag(said2, flow) {
|
|
19517
19554
|
const offered = flow ? previewAgents(flow).map((h) => h.agent) : [];
|
|
19518
19555
|
const asked = new Set(said2.map((name) => canonicalSpecAgent(name.trim())).filter(Boolean));
|
|
19519
19556
|
const unknown = [...asked].filter((name) => !offered.includes(name));
|
|
19520
19557
|
if (unknown.length) {
|
|
19521
|
-
die(`${unknown.map((n) => `\`${n}\``).join(", ")} ${unknown.length > 1 ? "are not previews" : "is not a preview"} of its
|
|
19558
|
+
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" });
|
|
19522
19559
|
}
|
|
19523
19560
|
return offered.filter((name) => asked.has(name));
|
|
19524
19561
|
}
|
|
@@ -19585,10 +19622,10 @@ function cmdUpdate(id, flags) {
|
|
|
19585
19622
|
meta.source = [.../* @__PURE__ */ new Set([...meta.source, ...sourceFlag(flags.addSource, "add-source")])];
|
|
19586
19623
|
changes.push("source");
|
|
19587
19624
|
}
|
|
19588
|
-
if (flags.
|
|
19589
|
-
changes.push(`
|
|
19625
|
+
if (flags.studio !== void 0 && switchStudio(id, meta, flags.studio)) {
|
|
19626
|
+
changes.push(`studio\u2192${meta.studio}`, "status\u2192todo");
|
|
19590
19627
|
}
|
|
19591
|
-
const flow =
|
|
19628
|
+
const flow = studioFor(meta.studio);
|
|
19592
19629
|
if (flags.previews !== void 0) {
|
|
19593
19630
|
meta.previews = previewsFlag(flags.previews, flow);
|
|
19594
19631
|
changes.push("previews");
|
|
@@ -19679,7 +19716,7 @@ var init_card = __esm({
|
|
|
19679
19716
|
init_io();
|
|
19680
19717
|
init_usage();
|
|
19681
19718
|
init_validate();
|
|
19682
|
-
|
|
19719
|
+
init_studios();
|
|
19683
19720
|
init_inbox();
|
|
19684
19721
|
init_questions();
|
|
19685
19722
|
init_question_ops();
|
|
@@ -19687,7 +19724,7 @@ var init_card = __esm({
|
|
|
19687
19724
|
init_cards();
|
|
19688
19725
|
init_source();
|
|
19689
19726
|
init_store();
|
|
19690
|
-
|
|
19727
|
+
init_studio_cards();
|
|
19691
19728
|
init_spec_agent_names();
|
|
19692
19729
|
init_env();
|
|
19693
19730
|
init_tasks();
|
|
@@ -19979,7 +20016,7 @@ function addToInbox(drop) {
|
|
|
19979
20016
|
...hit ? { sourceType: hit } : {},
|
|
19980
20017
|
...kept2 ? { meta: [kept2, ...read3.incoming.meta] } : {},
|
|
19981
20018
|
...drop.agent ? { agent: drop.agent } : {},
|
|
19982
|
-
...drop.
|
|
20019
|
+
...drop.studio ? { studio: drop.studio } : {}
|
|
19983
20020
|
};
|
|
19984
20021
|
if (!incoming.title || !incoming.summary) return { ok: false, error: "nothing to add \u2014 that had no words in it." };
|
|
19985
20022
|
const sourceId = derivedSourceId(incoming.url || `${incoming.title}
|
|
@@ -20197,8 +20234,8 @@ function migrateCard(card) {
|
|
|
20197
20234
|
const said2 = (key) => typeof raw[key] === "string" ? raw[key].trim() : "";
|
|
20198
20235
|
const cadence = parseCadence(said2("cadence")) ? said2("cadence") : "";
|
|
20199
20236
|
const lastRun = parseStamp(said2("last_run")) ? said2("last_run") : "";
|
|
20200
|
-
const flow =
|
|
20201
|
-
if (!flow) throw new Error(
|
|
20237
|
+
const flow = studioById(meta.studio || "coding") ?? studios()[0];
|
|
20238
|
+
if (!flow) throw new Error(noStudioMessage(""));
|
|
20202
20239
|
const text4 = (name2) => agentText(name2, meta.title || card.slug, body);
|
|
20203
20240
|
const name = agentName(card, text4);
|
|
20204
20241
|
const dir = path66.join(AGENTS, name);
|
|
@@ -20208,7 +20245,7 @@ function migrateCard(card) {
|
|
|
20208
20245
|
try {
|
|
20209
20246
|
fs63.mkdirSync(dir, { recursive: true });
|
|
20210
20247
|
if (wrote) fs63.writeFileSync(file, text4(name));
|
|
20211
|
-
const adopted =
|
|
20248
|
+
const adopted = adoptStudioScheduled(flow.id, name, { cadence, lastRun });
|
|
20212
20249
|
if (!adopted.ok) throw new Error(adopted.error);
|
|
20213
20250
|
questionsToTriage(meta, name);
|
|
20214
20251
|
} catch (e) {
|
|
@@ -20218,7 +20255,7 @@ function migrateCard(card) {
|
|
|
20218
20255
|
}
|
|
20219
20256
|
if (card.folder) mergeInto2(card.folder, dir, ["root.md"]);
|
|
20220
20257
|
removeCard(card);
|
|
20221
|
-
return { card: rel(card.file), agent: name,
|
|
20258
|
+
return { card: rel(card.file), agent: name, studio: flow.name, on: !!cadence, cadence };
|
|
20222
20259
|
}
|
|
20223
20260
|
function migrateRecurringCards() {
|
|
20224
20261
|
const done2 = { agents: [], removed: [], failed: [] };
|
|
@@ -20242,7 +20279,7 @@ function migrateRecurringCards() {
|
|
|
20242
20279
|
function recurringMigrationLines(done2) {
|
|
20243
20280
|
return [
|
|
20244
20281
|
...done2.agents.map(
|
|
20245
|
-
(one) => `${one.card} is now the scheduled agent \`${one.agent}\` in the ${one.
|
|
20282
|
+
(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")
|
|
20246
20283
|
),
|
|
20247
20284
|
...done2.removed.map((card) => `removed ${card} \u2014 write a scheduled agent to pull triage items on a cadence (\`akb guide write-agent\`)`),
|
|
20248
20285
|
...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`)
|
|
@@ -20254,7 +20291,7 @@ var init_recurring = __esm({
|
|
|
20254
20291
|
"use strict";
|
|
20255
20292
|
init_settings();
|
|
20256
20293
|
init_roles();
|
|
20257
|
-
|
|
20294
|
+
init_studios();
|
|
20258
20295
|
init_catalog();
|
|
20259
20296
|
init_parse();
|
|
20260
20297
|
init_cadence();
|
|
@@ -20424,7 +20461,7 @@ _(not filled in yet \u2014 build the map from the repo before tagging a card.)_
|
|
|
20424
20461
|
|
|
20425
20462
|
// ../cli/src/lib/agent/scheduled.ts
|
|
20426
20463
|
function scheduledBusy(pass, store = readStore()) {
|
|
20427
|
-
const args = { agent: pass.agent,
|
|
20464
|
+
const args = { agent: pass.agent, studio: pass.studio };
|
|
20428
20465
|
if (store.runs.some((r) => r.status === "running" && isPass(r, pass))) {
|
|
20429
20466
|
return refusal("scheduledRunning", `\`${pass.agent}\` is already running`, args);
|
|
20430
20467
|
}
|
|
@@ -20436,7 +20473,7 @@ function scheduledBusy(pass, store = readStore()) {
|
|
|
20436
20473
|
function insideScheduledPass() {
|
|
20437
20474
|
const sessionId = insideRun();
|
|
20438
20475
|
const run2 = sessionId ? readStore().runs.find((r) => r.sessionId === sessionId) : void 0;
|
|
20439
|
-
return run2?.action === "scheduled" && run2.
|
|
20476
|
+
return run2?.action === "scheduled" && run2.studio && run2.specAgent ? { studio: run2.studio, agent: run2.specAgent } : null;
|
|
20440
20477
|
}
|
|
20441
20478
|
function runAgent() {
|
|
20442
20479
|
const sessionId = insideRun();
|
|
@@ -20461,12 +20498,12 @@ var init_scheduled = __esm({
|
|
|
20461
20498
|
init_types();
|
|
20462
20499
|
scheduledRequest = (pass) => ({
|
|
20463
20500
|
action: "scheduled",
|
|
20464
|
-
|
|
20501
|
+
studio: pass.studio,
|
|
20465
20502
|
specAgent: pass.agent
|
|
20466
20503
|
});
|
|
20467
|
-
isPass = (run2, pass) => run2.action === "scheduled" && run2.
|
|
20504
|
+
isPass = (run2, pass) => run2.action === "scheduled" && run2.studio === pass.studio && run2.specAgent === pass.agent;
|
|
20468
20505
|
openPasses = (deliveries, pass) => deliveries.filter(
|
|
20469
|
-
(d) => d.status === "active" && d.scheduled?.
|
|
20506
|
+
(d) => d.status === "active" && d.scheduled?.studio === pass.studio && d.scheduled.agent === pass.agent
|
|
20470
20507
|
);
|
|
20471
20508
|
stalePasses = (pass) => openPasses(readStore().deliveries, pass).map((d) => d.deliveryId);
|
|
20472
20509
|
}
|
|
@@ -20656,10 +20693,10 @@ function cmdArchived(opts) {
|
|
|
20656
20693
|
if (opts.since?.trim() === LAST_RUN) {
|
|
20657
20694
|
const pass = insideScheduledPass();
|
|
20658
20695
|
if (!pass) die(`--since ${LAST_RUN} only works inside a scheduled agent's run. Elsewhere, write the time as "YYYY-MM-DD HH:MM".`);
|
|
20659
|
-
const last = scheduledAgent(pass.
|
|
20696
|
+
const last = scheduledAgent(pass.studio, pass.agent)?.lastRun ?? "";
|
|
20660
20697
|
if (!parseStamp(last)) {
|
|
20661
20698
|
say("this is the first run, so no cards are listed.");
|
|
20662
|
-
return { cards: [], since: null,
|
|
20699
|
+
return { cards: [], since: null, studio: opts.studio ?? null, firstRun: true };
|
|
20663
20700
|
}
|
|
20664
20701
|
opts = { ...opts, since: last };
|
|
20665
20702
|
}
|
|
@@ -20667,19 +20704,19 @@ function cmdArchived(opts) {
|
|
|
20667
20704
|
since = parseStamp(opts.since);
|
|
20668
20705
|
if (!since) die(`cannot read --since "${opts.since}". Write it as "YYYY-MM-DD HH:MM", e.g. --since "2026-08-02 14:31".`);
|
|
20669
20706
|
}
|
|
20670
|
-
const
|
|
20707
|
+
const studio = opts.studio === void 0 ? null : knownStudio(opts.studio);
|
|
20671
20708
|
const open3 = boardCardIds();
|
|
20672
20709
|
const files = archivedFiles();
|
|
20673
|
-
const cards = landedDeliveries({ since: since?.getTime(),
|
|
20710
|
+
const cards = landedDeliveries({ since: since?.getTime(), studio: studio ?? void 0 }).filter((d) => !open3.has(d.cardId)).map((d) => ({
|
|
20674
20711
|
id: d.cardId,
|
|
20675
20712
|
title: d.title,
|
|
20676
|
-
|
|
20713
|
+
studio: d.studio,
|
|
20677
20714
|
landedAt: formatStamp(new Date(d.at)),
|
|
20678
20715
|
commit: d.commit,
|
|
20679
20716
|
file: files.has(d.cardId) ? rel(files.get(d.cardId)) : ""
|
|
20680
20717
|
}));
|
|
20681
|
-
const result = { cards, since: since ? formatStamp(since) : null,
|
|
20682
|
-
const scope = [
|
|
20718
|
+
const result = { cards, since: since ? formatStamp(since) : null, studio };
|
|
20719
|
+
const scope = [studio ? `on studio \`${studio}\`` : "", since ? `since ${formatStamp(since)}` : ""].filter(Boolean).join(" ");
|
|
20683
20720
|
if (!cards.length) {
|
|
20684
20721
|
say(`no cards landed${scope ? ` ${scope}` : ""}.`);
|
|
20685
20722
|
return result;
|
|
@@ -20688,18 +20725,18 @@ function cmdArchived(opts) {
|
|
|
20688
20725
|
for (const c of cards) {
|
|
20689
20726
|
say("");
|
|
20690
20727
|
say(`#${c.id} ${c.title}${c.file ? ` (${c.file})` : ""}`);
|
|
20691
|
-
say(` ${c.
|
|
20728
|
+
say(` ${c.studio} \xB7 landed ${c.landedAt} \xB7 commit ${c.commit}`);
|
|
20692
20729
|
}
|
|
20693
20730
|
return result;
|
|
20694
20731
|
}
|
|
20695
20732
|
function cmdList(opts) {
|
|
20696
20733
|
if (opts.archived) {
|
|
20697
20734
|
if (opts.stale) die("--archived and --stale answer different questions \u2014 pass one of them.");
|
|
20698
|
-
if (opts.module !== void 0) die("--module does not apply to --archived; narrow it with --
|
|
20735
|
+
if (opts.module !== void 0) die("--module does not apply to --archived; narrow it with --studio.");
|
|
20699
20736
|
return cmdArchived(opts);
|
|
20700
20737
|
}
|
|
20701
20738
|
if (opts.since !== void 0) die("--since only applies to --archived.");
|
|
20702
|
-
if (opts.
|
|
20739
|
+
if (opts.studio !== void 0) die("--studio only applies to --archived.");
|
|
20703
20740
|
const all2 = openRows();
|
|
20704
20741
|
let rows = all2;
|
|
20705
20742
|
let scope = "on the board";
|
|
@@ -20744,7 +20781,7 @@ var init_list = __esm({
|
|
|
20744
20781
|
init_cards();
|
|
20745
20782
|
init_cadence();
|
|
20746
20783
|
init_deliveries();
|
|
20747
|
-
|
|
20784
|
+
init_studios();
|
|
20748
20785
|
init_scheduled();
|
|
20749
20786
|
init_card_age();
|
|
20750
20787
|
init_card_holds();
|
|
@@ -20852,8 +20889,8 @@ function buildCard(id, file, relFromTodo) {
|
|
|
20852
20889
|
const { meta, body } = parseFrontmatter(text4);
|
|
20853
20890
|
if (!meta) return null;
|
|
20854
20891
|
const relPath = relFromTodo.split(path70.sep).join("/");
|
|
20855
|
-
const flow =
|
|
20856
|
-
const plan = !!meta.
|
|
20892
|
+
const flow = studioFor(meta.studio);
|
|
20893
|
+
const plan = !!meta.studio && archivesOnApproval(flow);
|
|
20857
20894
|
const stages = cardStages(meta, flow).length;
|
|
20858
20895
|
return {
|
|
20859
20896
|
id,
|
|
@@ -20868,7 +20905,7 @@ function buildCard(id, file, relFromTodo) {
|
|
|
20868
20905
|
blocked_by: meta.blocked_by,
|
|
20869
20906
|
related: meta.related,
|
|
20870
20907
|
questions: meta.questions,
|
|
20871
|
-
|
|
20908
|
+
studio: meta.studio,
|
|
20872
20909
|
...plan ? { deliversIn: "plan" } : {},
|
|
20873
20910
|
...stages > 1 ? { stages, stage: cardStage(meta, flow) } : {},
|
|
20874
20911
|
modules: meta.modules,
|
|
@@ -21065,7 +21102,7 @@ var init_read = __esm({
|
|
|
21065
21102
|
init_frontmatter();
|
|
21066
21103
|
init_assemble();
|
|
21067
21104
|
init_revision();
|
|
21068
|
-
|
|
21105
|
+
init_studios();
|
|
21069
21106
|
}
|
|
21070
21107
|
});
|
|
21071
21108
|
|
|
@@ -21940,7 +21977,7 @@ async function dispatch(move, cmd, args, opts, cli) {
|
|
|
21940
21977
|
const data = await runAction(ctx, {}, async () => {
|
|
21941
21978
|
const found2 = resolveBoard(move, { board: ctx.board, dir: ctx.dir, cwd: cli.cwd, installHint: cli.installHint });
|
|
21942
21979
|
useBoard(found2, ctx.dir !== null);
|
|
21943
|
-
await
|
|
21980
|
+
await syncStudios();
|
|
21944
21981
|
const root2 = found2.root;
|
|
21945
21982
|
sayIfRetiredPointer(root2);
|
|
21946
21983
|
const creating = move === "create" && insideRun() ? peekRun(insideRun()) : void 0;
|
|
@@ -21952,8 +21989,8 @@ async function dispatch(move, cmd, args, opts, cli) {
|
|
|
21952
21989
|
const inRun = move === "create" && insideRun() !== null;
|
|
21953
21990
|
const task = move === "create" && opts.id === void 0 ? workspaceTask() : null;
|
|
21954
21991
|
if (move === "create" && opts.id === void 0) {
|
|
21955
|
-
const {
|
|
21956
|
-
input.opts = (await cloudCard(task, task ? opts : { ...opts,
|
|
21992
|
+
const { studio } = validateCreate(opts);
|
|
21993
|
+
input.opts = (await cloudCard(task, task ? opts : { ...opts, studio })).opts;
|
|
21957
21994
|
}
|
|
21958
21995
|
const data2 = READ_ONLY_MOVES.has(move) ? await board().readMove(move, input) : unwrap(await withLease(moveTarget(move, args), (env2) => board().runMove(move, input, env2)));
|
|
21959
21996
|
const created = move === "create" && Array.isArray(data2.ids) ? data2.ids.filter((id) => Number.isInteger(id)) : [];
|
|
@@ -21981,7 +22018,7 @@ async function cloudCard(task, opts) {
|
|
|
21981
22018
|
const said2 = {
|
|
21982
22019
|
title: String(opts.title ?? "").trim(),
|
|
21983
22020
|
request: request2,
|
|
21984
|
-
|
|
22021
|
+
studio: typeof opts.studio === "string" && opts.studio.trim() ? opts.studio.trim() : void 0,
|
|
21985
22022
|
slug: typeof opts.slug === "string" ? opts.slug : void 0,
|
|
21986
22023
|
triage: sourceFile,
|
|
21987
22024
|
agent: runAgent() ?? void 0
|
|
@@ -22033,14 +22070,14 @@ function buildBoardProgram(cli) {
|
|
|
22033
22070
|
const asked = [];
|
|
22034
22071
|
const inOrder = ordered(asked);
|
|
22035
22072
|
move("create").summary("write exactly one card \u2014 its fields, its body template and its index entry").description(
|
|
22036
|
-
'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" --
|
|
22037
|
-
).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("--
|
|
22073
|
+
'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'
|
|
22074
|
+
).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() {
|
|
22038
22075
|
refuseRecurring(this);
|
|
22039
22076
|
await dispatch("create", this, [], { ...this.opts(), asked }, cli);
|
|
22040
22077
|
});
|
|
22041
22078
|
move("update").argument("<id>", ID, cardId).summary("rewrite a card's fields").description(
|
|
22042
22079
|
"Rewrite a card's frontmatter fields. --slug renames it. Body and questions are left untouched \u2014 those have their own moves."
|
|
22043
|
-
).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
|
|
22080
|
+
).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) {
|
|
22044
22081
|
refuseRecurring(this);
|
|
22045
22082
|
await dispatch("update", this, [String(id)], this.opts(), cli);
|
|
22046
22083
|
});
|
|
@@ -22065,11 +22102,11 @@ function buildBoardProgram(cli) {
|
|
|
22065
22102
|
await dispatch("memory-file", this, [name], this.opts(), cli);
|
|
22066
22103
|
});
|
|
22067
22104
|
move("list").summary("the open cards: id, title, meta, summary, path \u2014 or, with --archived, the cards that landed").description(
|
|
22068
|
-
"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,
|
|
22105
|
+
"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."
|
|
22069
22106
|
).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(
|
|
22070
22107
|
"--since <time>",
|
|
22071
22108
|
'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'
|
|
22072
|
-
).option("--
|
|
22109
|
+
).option("--studio <id>", "with --archived: only the cards of that studio").action(async function() {
|
|
22073
22110
|
await dispatch("list", this, [], this.opts(), cli);
|
|
22074
22111
|
});
|
|
22075
22112
|
move("archive").argument("<id>", ID, cardId).summary("finish a card").description(
|
|
@@ -22120,7 +22157,7 @@ var init_board2 = __esm({
|
|
|
22120
22157
|
init_sessions();
|
|
22121
22158
|
init_paths();
|
|
22122
22159
|
init_board_cli();
|
|
22123
|
-
|
|
22160
|
+
init_cloud_studios();
|
|
22124
22161
|
init_validate();
|
|
22125
22162
|
init_shared2();
|
|
22126
22163
|
init_esm();
|
|
@@ -22138,7 +22175,7 @@ function useBoard(found2, dirNamed) {
|
|
|
22138
22175
|
if (!found2.named && found2.board === path74.join(found2.root, "docs", "kanban")) setBoardRoot(found2.root, dirNamed);
|
|
22139
22176
|
else setBoardDir(found2.board, found2.root);
|
|
22140
22177
|
useProjectState();
|
|
22141
|
-
|
|
22178
|
+
backfillCardStudios();
|
|
22142
22179
|
}
|
|
22143
22180
|
function whole(found2, move) {
|
|
22144
22181
|
if (move === MAKES_A_BOARD) return found2;
|
|
@@ -22276,7 +22313,7 @@ var init_board_cli = __esm({
|
|
|
22276
22313
|
init_paths();
|
|
22277
22314
|
init_io();
|
|
22278
22315
|
init_pointer();
|
|
22279
|
-
|
|
22316
|
+
init_card_studio_backfill();
|
|
22280
22317
|
MAKES_A_BOARD = "init";
|
|
22281
22318
|
hasBoard = (dir) => fs73.existsSync(path74.join(dir, "docs", "kanban"));
|
|
22282
22319
|
isBoardDir = (dir) => fs73.existsSync(path74.join(dir, "todo")) && fs73.existsSync(path74.join(dir, "config.md"));
|
|
@@ -22324,9 +22361,9 @@ Print it, or run it
|
|
|
22324
22361
|
/** Under `delivery`: what one is, which no verb of it says on its own. */
|
|
22325
22362
|
deliveries: (program2) => `
|
|
22326
22363
|
What a delivery is
|
|
22327
|
-
A delivery freezes the approved requirements and runs the
|
|
22364
|
+
A delivery freezes the approved requirements and runs the studio agents in order.
|
|
22328
22365
|
Each agent records its result with \`delivery complete\`; the final step archives the card.
|
|
22329
|
-
The builder manages its branch, worktree, checks and merge. File
|
|
22366
|
+
The builder manages its branch, worktree, checks and merge. File studios deliver their
|
|
22330
22367
|
recorded outputs in the authorized directory. A successful run alone does not finish a delivery.
|
|
22331
22368
|
\`cancel\` ends it and preserves files. \`resume\` continues unfinished work.
|
|
22332
22369
|
|
|
@@ -22892,8 +22929,8 @@ var init_cloud_template = __esm({
|
|
|
22892
22929
|
|
|
22893
22930
|
// ../cli/src/commands/components.ts
|
|
22894
22931
|
function cmdComponents(opts) {
|
|
22895
|
-
if (!!opts.agent === !!opts.
|
|
22896
|
-
const docs = opts.agent ? agentComponents([opts.agent]) :
|
|
22932
|
+
if (!!opts.agent === !!opts.studio) die("choose exactly one of --agent or --studio", { kind: "invalid-usage" });
|
|
22933
|
+
const docs = opts.agent ? agentComponents([opts.agent]) : studioComponents(opts.studio);
|
|
22897
22934
|
say(docs.map((doc) => doc.name).join("\n") || "(none)");
|
|
22898
22935
|
if (opts.docs && docs.length) say(`
|
|
22899
22936
|
${componentDocsText(docs)}`);
|
|
@@ -22912,7 +22949,7 @@ var init_components2 = __esm({
|
|
|
22912
22949
|
var add_task_default;
|
|
22913
22950
|
var init_add_task = __esm({
|
|
22914
22951
|
"../cli/src/guide/add-task.md"() {
|
|
22915
|
-
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 --
|
|
22952
|
+
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';
|
|
22916
22953
|
}
|
|
22917
22954
|
});
|
|
22918
22955
|
|
|
@@ -22920,7 +22957,7 @@ var init_add_task = __esm({
|
|
|
22920
22957
|
var archive_default;
|
|
22921
22958
|
var init_archive2 = __esm({
|
|
22922
22959
|
"../cli/src/guide/archive.md"() {
|
|
22923
|
-
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
|
|
22960
|
+
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";
|
|
22924
22961
|
}
|
|
22925
22962
|
});
|
|
22926
22963
|
|
|
@@ -22928,7 +22965,7 @@ var init_archive2 = __esm({
|
|
|
22928
22965
|
var board_default;
|
|
22929
22966
|
var init_board3 = __esm({
|
|
22930
22967
|
"../cli/src/guide/board.md"() {
|
|
22931
|
-
board_default = "# How this board works\n\nThese rules apply to every card
|
|
22968
|
+
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";
|
|
22932
22969
|
}
|
|
22933
22970
|
});
|
|
22934
22971
|
|
|
@@ -22936,15 +22973,15 @@ var init_board3 = __esm({
|
|
|
22936
22973
|
var card_chat_default;
|
|
22937
22974
|
var init_card_chat = __esm({
|
|
22938
22975
|
"../cli/src/guide/card-chat.md"() {
|
|
22939
|
-
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
|
|
22976
|
+
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';
|
|
22940
22977
|
}
|
|
22941
22978
|
});
|
|
22942
22979
|
|
|
22943
|
-
// ../cli/src/guide/update-
|
|
22944
|
-
var
|
|
22945
|
-
var
|
|
22946
|
-
"../cli/src/guide/update-
|
|
22947
|
-
|
|
22980
|
+
// ../cli/src/guide/update-studio.md
|
|
22981
|
+
var update_studio_default;
|
|
22982
|
+
var init_update_studio = __esm({
|
|
22983
|
+
"../cli/src/guide/update-studio.md"() {
|
|
22984
|
+
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";
|
|
22948
22985
|
}
|
|
22949
22986
|
});
|
|
22950
22987
|
|
|
@@ -22960,7 +22997,7 @@ var init_describe_project = __esm({
|
|
|
22960
22997
|
var discuss_goal_default;
|
|
22961
22998
|
var init_discuss_goal = __esm({
|
|
22962
22999
|
"../cli/src/guide/discuss-goal.md"() {
|
|
22963
|
-
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- **
|
|
23000
|
+
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';
|
|
22964
23001
|
}
|
|
22965
23002
|
});
|
|
22966
23003
|
|
|
@@ -22968,7 +23005,7 @@ var init_discuss_goal = __esm({
|
|
|
22968
23005
|
var follow_up_default;
|
|
22969
23006
|
var init_follow_up = __esm({
|
|
22970
23007
|
"../cli/src/guide/follow-up.md"() {
|
|
22971
|
-
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- **
|
|
23008
|
+
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';
|
|
22972
23009
|
}
|
|
22973
23010
|
});
|
|
22974
23011
|
|
|
@@ -23016,7 +23053,7 @@ var init_review_rejections = __esm({
|
|
|
23016
23053
|
var refine_default;
|
|
23017
23054
|
var init_refine = __esm({
|
|
23018
23055
|
"../cli/src/guide/refine.md"() {
|
|
23019
|
-
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- **
|
|
23056
|
+
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';
|
|
23020
23057
|
}
|
|
23021
23058
|
});
|
|
23022
23059
|
|
|
@@ -23024,7 +23061,7 @@ var init_refine = __esm({
|
|
|
23024
23061
|
var reflect_default;
|
|
23025
23062
|
var init_reflect = __esm({
|
|
23026
23063
|
"../cli/src/guide/reflect.md"() {
|
|
23027
|
-
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 `
|
|
23064
|
+
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';
|
|
23028
23065
|
}
|
|
23029
23066
|
});
|
|
23030
23067
|
|
|
@@ -23056,7 +23093,7 @@ var init_preview_agent = __esm({
|
|
|
23056
23093
|
var update_questions_default;
|
|
23057
23094
|
var init_update_questions = __esm({
|
|
23058
23095
|
"../cli/src/guide/update-questions.md"() {
|
|
23059
|
-
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
|
|
23096
|
+
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';
|
|
23060
23097
|
}
|
|
23061
23098
|
});
|
|
23062
23099
|
|
|
@@ -23072,7 +23109,15 @@ var init_troubleshoot = __esm({
|
|
|
23072
23109
|
var write_agent_default;
|
|
23073
23110
|
var init_write_agent = __esm({
|
|
23074
23111
|
"../cli/src/guide/write-agent.md"() {
|
|
23075
|
-
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
|
|
23112
|
+
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";
|
|
23113
|
+
}
|
|
23114
|
+
});
|
|
23115
|
+
|
|
23116
|
+
// ../cli/src/guide/write-prompt.md
|
|
23117
|
+
var write_prompt_default;
|
|
23118
|
+
var init_write_prompt = __esm({
|
|
23119
|
+
"../cli/src/guide/write-prompt.md"() {
|
|
23120
|
+
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";
|
|
23076
23121
|
}
|
|
23077
23122
|
});
|
|
23078
23123
|
|
|
@@ -23086,7 +23131,7 @@ var init_writing = __esm({
|
|
|
23086
23131
|
|
|
23087
23132
|
// ../cli/src/lib/guide.ts
|
|
23088
23133
|
function findGuide(name) {
|
|
23089
|
-
const wanted =
|
|
23134
|
+
const wanted = RENAMED2[name] ?? name;
|
|
23090
23135
|
const guide = GUIDES.find((g) => g.name === wanted);
|
|
23091
23136
|
return guide ? { ...guide, text: boardText(guide.text) } : null;
|
|
23092
23137
|
}
|
|
@@ -23106,7 +23151,7 @@ function guideList(program2) {
|
|
|
23106
23151
|
];
|
|
23107
23152
|
return boardText(out.join("\n"));
|
|
23108
23153
|
}
|
|
23109
|
-
var GUIDES, guideNames,
|
|
23154
|
+
var GUIDES, guideNames, RENAMED2;
|
|
23110
23155
|
var init_guide = __esm({
|
|
23111
23156
|
"../cli/src/lib/guide.ts"() {
|
|
23112
23157
|
"use strict";
|
|
@@ -23114,7 +23159,7 @@ var init_guide = __esm({
|
|
|
23114
23159
|
init_archive2();
|
|
23115
23160
|
init_board3();
|
|
23116
23161
|
init_card_chat();
|
|
23117
|
-
|
|
23162
|
+
init_update_studio();
|
|
23118
23163
|
init_describe_project();
|
|
23119
23164
|
init_discuss_goal();
|
|
23120
23165
|
init_follow_up();
|
|
@@ -23131,6 +23176,7 @@ var init_guide = __esm({
|
|
|
23131
23176
|
init_update_questions();
|
|
23132
23177
|
init_troubleshoot();
|
|
23133
23178
|
init_write_agent();
|
|
23179
|
+
init_write_prompt();
|
|
23134
23180
|
init_writing();
|
|
23135
23181
|
init_paths();
|
|
23136
23182
|
GUIDES = [
|
|
@@ -23141,7 +23187,7 @@ var init_guide = __esm({
|
|
|
23141
23187
|
{ name: "discuss-goal", when: "help decide what is worth building, and shape it into goals to start as tasks", text: discuss_goal_default },
|
|
23142
23188
|
{ name: "troubleshoot", when: "\u5B9A\u4F4D\u8F6F\u4EF6\u6545\u969C\u7684\u6839\u56E0\u4E0E\u4FEE\u590D\u65B9\u5411", text: troubleshoot_default },
|
|
23143
23189
|
{ name: "card-chat", when: "answer a card's conversation, and act on what each turn settles", text: card_chat_default },
|
|
23144
|
-
{ name: "update-
|
|
23190
|
+
{ name: "update-studio", when: "change one of this workspace's studios so new tasks run the new version", text: update_studio_default },
|
|
23145
23191
|
{ name: "implement", when: "build a settled card and stop cleanly on an execution blocker", text: implement_default },
|
|
23146
23192
|
{ name: "archive", when: "finish a task \u2014 write its shipped line, then take it off the board", text: archive_default },
|
|
23147
23193
|
{ name: "update-questions", when: "decide what to ask the user, and write the question", text: update_questions_default },
|
|
@@ -23155,10 +23201,11 @@ var init_guide = __esm({
|
|
|
23155
23201
|
{ name: "reflect", when: "propose the work just-completed cards leave behind", text: reflect_default },
|
|
23156
23202
|
{ name: "preview-agent", when: "be a preview agent: write your one section of a card", text: preview_agent_default },
|
|
23157
23203
|
{ 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 },
|
|
23204
|
+
{ 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 },
|
|
23158
23205
|
{ name: "module-map", when: "write or rebuild docs/kanban/modules.md", text: module_map_default }
|
|
23159
23206
|
];
|
|
23160
23207
|
guideNames = () => GUIDES.map((g) => g.name);
|
|
23161
|
-
|
|
23208
|
+
RENAMED2 = {
|
|
23162
23209
|
"discuss-idea": "discuss-goal",
|
|
23163
23210
|
"spec-skill": "preview-agent",
|
|
23164
23211
|
"spec-agent": "preview-agent"
|
|
@@ -23194,62 +23241,62 @@ var init_guide2 = __esm({
|
|
|
23194
23241
|
}
|
|
23195
23242
|
});
|
|
23196
23243
|
|
|
23197
|
-
// ../cli/src/commands/
|
|
23244
|
+
// ../cli/src/commands/studio.ts
|
|
23198
23245
|
import fs75 from "node:fs";
|
|
23199
23246
|
import path76 from "node:path";
|
|
23200
|
-
function
|
|
23201
|
-
if (!
|
|
23202
|
-
const offline2 =
|
|
23203
|
-
const rows =
|
|
23247
|
+
function cmdStudioList() {
|
|
23248
|
+
if (!studiosReachable().ok) die(NEEDS_CLOUD, "needs-cloud");
|
|
23249
|
+
const offline2 = studiosOffline();
|
|
23250
|
+
const rows = studios();
|
|
23204
23251
|
for (const flow of rows) {
|
|
23205
23252
|
const previews = previewNames(previewMembers(flow));
|
|
23206
23253
|
const land = names2(flow.land);
|
|
23207
23254
|
const line = [flow.id, flow.name, ...previews ? [`previews: ${previews}${land ? ` \u2192 land: ${land}` : ""}`] : land ? [`land: ${land}`] : []];
|
|
23208
23255
|
say(`${line.join(" ")}${offline2 ? " (offline)" : ""}`);
|
|
23209
23256
|
for (const agent of listedScheduled(flow)) say(` scheduled: ${agent}`);
|
|
23210
|
-
for (const problem of
|
|
23257
|
+
for (const problem of studioProblems(flow.id)) say(` ! ${problem}`);
|
|
23211
23258
|
}
|
|
23212
|
-
const fileProblems =
|
|
23259
|
+
const fileProblems = studioFileProblems();
|
|
23213
23260
|
for (const problem of fileProblems) say(`! ${problem}`);
|
|
23214
23261
|
return {
|
|
23215
|
-
|
|
23262
|
+
studios: rows.map((flow) => ({
|
|
23216
23263
|
...flow,
|
|
23217
23264
|
previews: previewMembers(flow).map((h) => ({ ...h, after: agentAfter(h.agent) })),
|
|
23218
23265
|
scheduled: listedScheduled(flow),
|
|
23219
|
-
description:
|
|
23220
|
-
when:
|
|
23221
|
-
problems:
|
|
23266
|
+
description: studioPurpose(flow),
|
|
23267
|
+
when: studioWhen(flow),
|
|
23268
|
+
problems: studioProblems(flow.id)
|
|
23222
23269
|
})),
|
|
23223
23270
|
problems: fileProblems,
|
|
23224
23271
|
...offline2 ? { offline: offline2 } : {}
|
|
23225
23272
|
};
|
|
23226
23273
|
}
|
|
23227
|
-
function
|
|
23228
|
-
done(
|
|
23274
|
+
function cmdStudioRename(id, name) {
|
|
23275
|
+
done(renameStudio(id, name));
|
|
23229
23276
|
say(`renamed ${id} to "${name.trim()}"`);
|
|
23230
23277
|
return { id, name: name.trim() };
|
|
23231
23278
|
}
|
|
23232
|
-
function
|
|
23279
|
+
function cmdStudioDiagram(id, card) {
|
|
23233
23280
|
const flow = found(id);
|
|
23234
23281
|
const cardId2 = Number(card);
|
|
23235
23282
|
if (!Number.isInteger(cardId2) || !locate(cardId2)) die(`no card #${card} on this board`, "no-such-card");
|
|
23236
|
-
const diagram =
|
|
23283
|
+
const diagram = studioDiagram({ previews: previewMembers(flow), land: flow.land, scheduled: scheduledMembers(flow) }, (name) => {
|
|
23237
23284
|
const agent = findSpecAgent(name);
|
|
23238
23285
|
return agent ? { ...agent, after: agentAfter(name) } : null;
|
|
23239
23286
|
});
|
|
23240
|
-
const file = path76.join(ASSETS, String(cardId2), "
|
|
23287
|
+
const file = path76.join(ASSETS, String(cardId2), "studio.json");
|
|
23241
23288
|
fs75.mkdirSync(path76.dirname(file), { recursive: true });
|
|
23242
23289
|
fs75.writeFileSync(file, `${JSON.stringify(diagram, null, 2)}
|
|
23243
23290
|
`);
|
|
23244
|
-
const tag = `<
|
|
23291
|
+
const tag = `<Studio src=".assets/${cardId2}/studio.json" label="${flow.name.replace(/"/g, "")}" />`;
|
|
23245
23292
|
say(tag);
|
|
23246
23293
|
return { file, tag, diagram };
|
|
23247
23294
|
}
|
|
23248
|
-
function
|
|
23295
|
+
function cmdStudioValidate(folder) {
|
|
23249
23296
|
const dir = path76.resolve(folder);
|
|
23250
23297
|
if (!fs75.statSync(dir, { throwIfNoEntry: false })?.isDirectory()) die(`${folder} is not a folder`, "bad-args");
|
|
23251
|
-
const files =
|
|
23252
|
-
const read3 =
|
|
23298
|
+
const files = readStudioFolder(dir);
|
|
23299
|
+
const read3 = parseStudioFile("studio", files[STUDIO_FILE] ?? "", STUDIO_FILE);
|
|
23253
23300
|
const def = "def" in read3 ? read3.def : null;
|
|
23254
23301
|
const named2 = def ? new Set([...def.previews, ...def.land, ...def.scheduled].map((h) => h.agent)) : [];
|
|
23255
23302
|
for (const name of named2) {
|
|
@@ -23260,18 +23307,18 @@ function cmdWorkflowValidate(folder) {
|
|
|
23260
23307
|
if (text4 !== null) files[`agents/${name}/${file}`] = text4;
|
|
23261
23308
|
}
|
|
23262
23309
|
}
|
|
23263
|
-
const problems =
|
|
23264
|
-
if (problems.length) die(problems.map((p) => `! ${p}`).join("\n"), { kind: "
|
|
23310
|
+
const problems = studioFilesProblems(files).map((p) => `${p.file} ${p.reason}`);
|
|
23311
|
+
if (problems.length) die(problems.map((p) => `! ${p}`).join("\n"), { kind: "studio-problems", bare: true, problems });
|
|
23265
23312
|
say(`${folder}: no problems`);
|
|
23266
23313
|
return { folder: dir, problems };
|
|
23267
23314
|
}
|
|
23268
|
-
async function
|
|
23315
|
+
async function cmdStudioPull(id, folder) {
|
|
23269
23316
|
const cloudId = cloudIdOf(id);
|
|
23270
23317
|
if (!cloudId) found(id);
|
|
23271
23318
|
const dir = path76.resolve(folder ?? id);
|
|
23272
23319
|
if (fs75.existsSync(dir) && fs75.readdirSync(dir).length) die(`${folder ?? id} is not empty`, "bad-args");
|
|
23273
|
-
const read3 = await call("GET", `/v1/
|
|
23274
|
-
if (!read3.ok) die(read3.error, read3.code === "not_found" ? "no-such-
|
|
23320
|
+
const read3 = await call("GET", `/v1/studios/${encodeURIComponent(cloudId)}`);
|
|
23321
|
+
if (!read3.ok) die(read3.error, read3.code === "not_found" ? "no-such-studio" : "cloud-refused");
|
|
23275
23322
|
const { version, files } = read3.value;
|
|
23276
23323
|
for (const [file, text4] of Object.entries({ ...files, [VERSION_FILE]: versionText(cloudId, version) })) {
|
|
23277
23324
|
const full = path76.join(dir, ...file.split("/"));
|
|
@@ -23283,26 +23330,26 @@ async function cmdWorkflowPull(id, folder) {
|
|
|
23283
23330
|
say(`Pulled ${id} v${version} into ${shown}.`);
|
|
23284
23331
|
return { id, version, folder: dir };
|
|
23285
23332
|
}
|
|
23286
|
-
async function
|
|
23333
|
+
async function cmdStudioPush(folder, opts) {
|
|
23287
23334
|
const dir = path76.resolve(folder);
|
|
23288
23335
|
let pulled = null;
|
|
23289
23336
|
try {
|
|
23290
23337
|
pulled = JSON.parse(fs75.readFileSync(path76.join(dir, VERSION_FILE), "utf8"));
|
|
23291
23338
|
} catch {
|
|
23292
23339
|
}
|
|
23293
|
-
if (!pulled?.id || !Number.isInteger(pulled.version)) die(`${folder} was not written by \`akb
|
|
23340
|
+
if (!pulled?.id || !Number.isInteger(pulled.version)) die(`${folder} was not written by \`akb studio pull\``, "bad-args");
|
|
23294
23341
|
const { id: cloudId, version } = pulled;
|
|
23295
|
-
const id =
|
|
23296
|
-
const readOnly2 = () => die(`${id} is not this workspace's own; copy it on the web first.`, "
|
|
23342
|
+
const id = studioName(cloudId);
|
|
23343
|
+
const readOnly2 = () => die(`${id} is not this workspace's own; copy it on the web first.`, "studio-read-only");
|
|
23297
23344
|
if (cloudId.startsWith("wf_builtin_")) readOnly2();
|
|
23298
|
-
const read3 =
|
|
23299
|
-
const problems =
|
|
23300
|
-
if (problems.length) die(problems.map((p) => `! ${p}`).join("\n"), { kind: "bad-
|
|
23301
|
-
const checked =
|
|
23345
|
+
const read3 = readStudioFolder(dir);
|
|
23346
|
+
const problems = studioFilesProblems(read3).map((p) => `${p.file} ${p.reason}`);
|
|
23347
|
+
if (problems.length) die(problems.map((p) => `! ${p}`).join("\n"), { kind: "bad-studio", bare: true, problems });
|
|
23348
|
+
const checked = checkStudioFiles(read3);
|
|
23302
23349
|
const { files } = checked;
|
|
23303
|
-
const now = await call("GET", `/v1/
|
|
23304
|
-
if (!now.ok) die(now.error, now.code === "not_found" ? "no-such-
|
|
23305
|
-
if (now.value.version !== version) die(`${id} is at v${now.value.version} now; pull again and redo the change.`, "
|
|
23350
|
+
const now = await call("GET", `/v1/studios/${encodeURIComponent(cloudId)}`);
|
|
23351
|
+
if (!now.ok) die(now.error, now.code === "not_found" ? "no-such-studio" : "cloud-refused");
|
|
23352
|
+
if (now.value.version !== version) die(`${id} is at v${now.value.version} now; pull again and redo the change.`, "studio-moved");
|
|
23306
23353
|
if (JSON.stringify(files) === JSON.stringify(Object.fromEntries(Object.entries(now.value.files).filter(([f]) => f !== VERSION_FILE).sort()))) {
|
|
23307
23354
|
say(`${id} is unchanged (v${version}).`);
|
|
23308
23355
|
return { id, version, changed: false, ...opts.dryRun ? { dryRun: true } : {} };
|
|
@@ -23311,10 +23358,10 @@ async function cmdWorkflowPush(folder, opts) {
|
|
|
23311
23358
|
say(`${id} would push v${version + 1}.`);
|
|
23312
23359
|
return { id, version: version + 1, changed: true, dryRun: true };
|
|
23313
23360
|
}
|
|
23314
|
-
const res = await call("PATCH", `/v1/
|
|
23361
|
+
const res = await call("PATCH", `/v1/studios/${encodeURIComponent(cloudId)}`, { files });
|
|
23315
23362
|
if (!res.ok) {
|
|
23316
23363
|
if (res.code === "read_only" || res.code === "not_found") readOnly2();
|
|
23317
|
-
die(res.error, res.code === "bad_request" || res.code === "payload_too_large" ? "bad-
|
|
23364
|
+
die(res.error, res.code === "bad_request" || res.code === "payload_too_large" ? "bad-studio" : "cloud-refused");
|
|
23318
23365
|
}
|
|
23319
23366
|
const next = res.value.version;
|
|
23320
23367
|
fs75.writeFileSync(path76.join(dir, VERSION_FILE), versionText(cloudId, next));
|
|
@@ -23342,31 +23389,31 @@ async function cloudScope() {
|
|
|
23342
23389
|
const held4 = cloudOk(await call("GET", `/v1/projects/${enc2(project2)}`));
|
|
23343
23390
|
return { project: project2, workspace: held4.workspace };
|
|
23344
23391
|
}
|
|
23345
|
-
async function
|
|
23392
|
+
async function cmdStudioRule(name, opts) {
|
|
23346
23393
|
const rule = noteText(opts);
|
|
23347
23394
|
const { workspace: workspace2 } = await cloudScope();
|
|
23348
|
-
const held4 = cloudOk(await call("GET", `/v1/workspaces/${enc2(workspace2)}/
|
|
23349
|
-
const flow = held4.
|
|
23395
|
+
const held4 = cloudOk(await call("GET", `/v1/workspaces/${enc2(workspace2)}/studio-rules`));
|
|
23396
|
+
const flow = held4.studios.find((w) => studioName(w.id) === name);
|
|
23350
23397
|
if (!flow) {
|
|
23351
|
-
die(`no
|
|
23352
|
-
kind: "no-such-
|
|
23353
|
-
|
|
23398
|
+
die(`no studio called "${name}" here. There are: ${held4.studios.map((w) => studioName(w.id)).join(", ")}.`, {
|
|
23399
|
+
kind: "no-such-studio",
|
|
23400
|
+
studio: name
|
|
23354
23401
|
});
|
|
23355
23402
|
}
|
|
23356
23403
|
if (rule === void 0) {
|
|
23357
23404
|
const now = flow.rule ?? "";
|
|
23358
23405
|
say(now || `${name} has no rules`);
|
|
23359
|
-
return {
|
|
23406
|
+
return { studio: name, rule: now };
|
|
23360
23407
|
}
|
|
23361
|
-
cloudOk(await call("PUT", `/v1/workspaces/${enc2(workspace2)}/
|
|
23408
|
+
cloudOk(await call("PUT", `/v1/workspaces/${enc2(workspace2)}/studios/${enc2(flow.id)}/rule`, { rule }));
|
|
23362
23409
|
say(`${rule ? "saved" : "cleared"} the rules of ${name}`);
|
|
23363
|
-
return {
|
|
23410
|
+
return { studio: name, rule };
|
|
23364
23411
|
}
|
|
23365
|
-
async function
|
|
23412
|
+
async function cmdStudioInstructions(agent, opts) {
|
|
23366
23413
|
const rule = noteText(opts);
|
|
23367
23414
|
const { project: project2, workspace: workspace2 } = await cloudScope();
|
|
23368
23415
|
const [shared, own] = await Promise.all([
|
|
23369
|
-
call("GET", `/v1/workspaces/${enc2(workspace2)}/
|
|
23416
|
+
call("GET", `/v1/workspaces/${enc2(workspace2)}/studio-rules`),
|
|
23370
23417
|
call("GET", `/v1/projects/${enc2(project2)}/agents`)
|
|
23371
23418
|
]);
|
|
23372
23419
|
const sharedRows = cloudOk(shared).data;
|
|
@@ -23391,46 +23438,46 @@ async function cmdWorkflowInstructions(agent, opts) {
|
|
|
23391
23438
|
return { agent, rule, scope };
|
|
23392
23439
|
}
|
|
23393
23440
|
var found, done, names2, previewNames, cloudIdOf, enc2;
|
|
23394
|
-
var
|
|
23395
|
-
"../cli/src/commands/
|
|
23441
|
+
var init_studio2 = __esm({
|
|
23442
|
+
"../cli/src/commands/studio.ts"() {
|
|
23396
23443
|
"use strict";
|
|
23397
23444
|
init_agents();
|
|
23398
23445
|
init_cards();
|
|
23399
23446
|
init_io();
|
|
23400
23447
|
init_paths();
|
|
23401
|
-
|
|
23402
|
-
|
|
23403
|
-
|
|
23404
|
-
|
|
23405
|
-
|
|
23406
|
-
|
|
23448
|
+
init_studio_diagram();
|
|
23449
|
+
init_cloud_studios();
|
|
23450
|
+
init_studios();
|
|
23451
|
+
init_studio_folder();
|
|
23452
|
+
init_studio_files();
|
|
23453
|
+
init_studio_def();
|
|
23407
23454
|
init_board_files();
|
|
23408
23455
|
init_tasks();
|
|
23409
23456
|
found = (id) => {
|
|
23410
|
-
const flow =
|
|
23457
|
+
const flow = studioById(id);
|
|
23411
23458
|
if (!flow) {
|
|
23412
|
-
die(`no
|
|
23413
|
-
kind: "no-such-
|
|
23414
|
-
|
|
23459
|
+
die(`no studio called "${id}" here. There are: ${studios().map((w) => w.id).join(", ")}.`, {
|
|
23460
|
+
kind: "no-such-studio",
|
|
23461
|
+
studio: id
|
|
23415
23462
|
});
|
|
23416
23463
|
}
|
|
23417
23464
|
return flow;
|
|
23418
23465
|
};
|
|
23419
23466
|
done = (res) => {
|
|
23420
|
-
if (!res.ok) die(res.error ?? "the board refused that change", res.reason === "
|
|
23467
|
+
if (!res.ok) die(res.error ?? "the board refused that change", res.reason === "studioReadOnly" ? "studio-read-only" : void 0);
|
|
23421
23468
|
};
|
|
23422
23469
|
names2 = (rows) => rows.map((h) => `${h.agent}${h.off ? " (off)" : ""}`).join(", ");
|
|
23423
23470
|
previewNames = (rows) => rows.map((h) => `${names2([h])}${agentAfter(h.agent).length ? ` (after ${agentAfter(h.agent).join(", ")})` : ""}`).join(", ");
|
|
23424
|
-
cloudIdOf = (id) => cloudFlows().find((f) =>
|
|
23471
|
+
cloudIdOf = (id) => cloudFlows().find((f) => studioName(f.cloudId) === id)?.cloudId;
|
|
23425
23472
|
enc2 = encodeURIComponent;
|
|
23426
23473
|
}
|
|
23427
23474
|
});
|
|
23428
23475
|
|
|
23429
23476
|
// ../cli/src/lib/agent/complete.ts
|
|
23430
23477
|
function deliveryAgents(delivery) {
|
|
23431
|
-
if (delivery.
|
|
23432
|
-
const flow =
|
|
23433
|
-
if (!flow) throw new Error(
|
|
23478
|
+
if (delivery.studio?.land) return delivery.studio.land;
|
|
23479
|
+
const flow = studioFor(delivery.studio?.id);
|
|
23480
|
+
if (!flow) throw new Error(noStudioMessage(delivery.studio?.id));
|
|
23434
23481
|
return landAgents(flow);
|
|
23435
23482
|
}
|
|
23436
23483
|
function completeDelivery(named2, result = {}) {
|
|
@@ -23475,14 +23522,14 @@ function completeDelivery(named2, result = {}) {
|
|
|
23475
23522
|
return { delivery: delivery2, receipt: pending };
|
|
23476
23523
|
}
|
|
23477
23524
|
const agent = delivery2.scheduled?.agent ?? deliveryAgents(delivery2)[deliveryStep(delivery2)]?.agent;
|
|
23478
|
-
if (!agent) throw new Error("No
|
|
23525
|
+
if (!agent) throw new Error("No studio step remains to complete.");
|
|
23479
23526
|
if (delivery2.cardId !== null && !locate(delivery2.cardId)) throw new Error("The card is missing before completion.");
|
|
23480
23527
|
const finalStep = !!delivery2.scheduled || receipts.length + 1 >= deliveryAgents(delivery2).length;
|
|
23481
23528
|
const card = delivery2.cardId === null ? void 0 : findCard(delivery2.cardId);
|
|
23482
23529
|
if (finalStep && card && /[-*]\s+\[ \]/.test(card.body)) throw new Error("Complete every Todo before finishing the delivery.");
|
|
23483
23530
|
const merges = specAgentCatalog().agents.find((a) => a.name === agent)?.merges;
|
|
23484
23531
|
if (merges && !commit && delivery2.base) throw new Error(`\`${agent}\` must report its merged commit and target branch.`);
|
|
23485
|
-
if (delivery2.
|
|
23532
|
+
if (delivery2.studio?.needsArtifact && !delivery2.scheduled) {
|
|
23486
23533
|
const stop = filesStop(delivery2);
|
|
23487
23534
|
if (stop) throw new Error(stop.why);
|
|
23488
23535
|
}
|
|
@@ -23494,7 +23541,7 @@ function completeDelivery(named2, result = {}) {
|
|
|
23494
23541
|
syncAudit(delivery.deliveryId);
|
|
23495
23542
|
const final = !!delivery.scheduled || receipt.step + 1 >= deliveryAgents(delivery).length;
|
|
23496
23543
|
if (final && !receipt.finished) {
|
|
23497
|
-
if (delivery.
|
|
23544
|
+
if (delivery.studio?.needsArtifact && !delivery.scheduled) {
|
|
23498
23545
|
const stop = filesStop(delivery);
|
|
23499
23546
|
if (stop) throw new Error(stop.why);
|
|
23500
23547
|
}
|
|
@@ -23544,7 +23591,7 @@ var init_complete = __esm({
|
|
|
23544
23591
|
init_outputs();
|
|
23545
23592
|
init_read();
|
|
23546
23593
|
init_store();
|
|
23547
|
-
|
|
23594
|
+
init_studios();
|
|
23548
23595
|
init_catalog();
|
|
23549
23596
|
}
|
|
23550
23597
|
});
|
|
@@ -23563,7 +23610,7 @@ function approvalRequest(req) {
|
|
|
23563
23610
|
const ask2 = { id: card.id, title: card.title, notes: req.notes };
|
|
23564
23611
|
if (awaitingApproval(card)) return { action: "approve", ...ask2 };
|
|
23565
23612
|
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.` };
|
|
23566
|
-
return archivesOnApproval(
|
|
23613
|
+
return archivesOnApproval(studioFor(card.studio)) ? { action: "archive", ...ask2 } : { action: "implement", ...ask2 };
|
|
23567
23614
|
}
|
|
23568
23615
|
function advancePhase(id) {
|
|
23569
23616
|
const card = findCard(id);
|
|
@@ -23586,7 +23633,7 @@ var init_approve = __esm({
|
|
|
23586
23633
|
init_rules();
|
|
23587
23634
|
init_store();
|
|
23588
23635
|
init_types();
|
|
23589
|
-
|
|
23636
|
+
init_studios();
|
|
23590
23637
|
}
|
|
23591
23638
|
});
|
|
23592
23639
|
|
|
@@ -23595,7 +23642,7 @@ import { randomUUID as randomUUID5 } from "node:crypto";
|
|
|
23595
23642
|
async function startRun(req) {
|
|
23596
23643
|
const sessionId = randomUUID5();
|
|
23597
23644
|
const cardId2 = Number.isInteger(req.id) ? req.id : null;
|
|
23598
|
-
const short2 =
|
|
23645
|
+
const short2 = studioRefusal(req) ?? await scheduledRefusal(req);
|
|
23599
23646
|
if (short2) return short2;
|
|
23600
23647
|
const delivery = req.action === "implement" ? deliveryFor(req) : void 0;
|
|
23601
23648
|
if (delivery && req.session !== "new") {
|
|
@@ -23606,23 +23653,23 @@ async function startRun(req) {
|
|
|
23606
23653
|
if (moved) return moved;
|
|
23607
23654
|
return open2(req, sessionId);
|
|
23608
23655
|
}
|
|
23609
|
-
function
|
|
23656
|
+
function studioRefusal(req) {
|
|
23610
23657
|
if (!Number.isInteger(req.id)) return null;
|
|
23611
|
-
if (!
|
|
23612
|
-
if (pinMissing()) return refusal("
|
|
23658
|
+
if (!studiosReachable().ok) return refusal("needsCloud", NEEDS_CLOUD);
|
|
23659
|
+
if (pinMissing()) return refusal("studioOffline", NOT_DOWNLOADED);
|
|
23613
23660
|
if (deliveryFor(req)) return null;
|
|
23614
|
-
const id =
|
|
23615
|
-
const flow =
|
|
23616
|
-
if (!flow) return refusal("
|
|
23661
|
+
const id = cardStudioId(req.id);
|
|
23662
|
+
const flow = studioFor(id);
|
|
23663
|
+
if (!flow) return refusal("studioUnknown", noStudioMessage(id), { card: String(req.id), studio: id });
|
|
23617
23664
|
if (archivesOnApproval(flow) && req.action === "implement") {
|
|
23618
23665
|
return refusal("planDelivered", `#${req.id} lands nothing, so its last approval archives it rather than building it.`, { card: String(req.id) });
|
|
23619
23666
|
}
|
|
23620
|
-
const [problem] =
|
|
23667
|
+
const [problem] = studioIssues(flow.id);
|
|
23621
23668
|
return problem ?? null;
|
|
23622
23669
|
}
|
|
23623
23670
|
async function scheduledRefusal(req) {
|
|
23624
|
-
if (req.action !== "scheduled" || req.deliveryId || !req.
|
|
23625
|
-
const pass = {
|
|
23671
|
+
if (req.action !== "scheduled" || req.deliveryId || !req.studio || !req.specAgent) return null;
|
|
23672
|
+
const pass = { studio: req.studio, agent: req.specAgent };
|
|
23626
23673
|
const refused = scheduledBusy(pass);
|
|
23627
23674
|
if (refused) return refused;
|
|
23628
23675
|
for (const id of stalePasses(pass)) await cancelDelivery(id);
|
|
@@ -23687,8 +23734,8 @@ var init_start = __esm({
|
|
|
23687
23734
|
init_deliveries();
|
|
23688
23735
|
init_store();
|
|
23689
23736
|
init_prompts();
|
|
23690
|
-
|
|
23691
|
-
|
|
23737
|
+
init_cloud_studios();
|
|
23738
|
+
init_studios();
|
|
23692
23739
|
init_sessions();
|
|
23693
23740
|
init_runtimes();
|
|
23694
23741
|
init_scheduled();
|
|
@@ -24049,7 +24096,7 @@ function questionsField(meta) {
|
|
|
24049
24096
|
return field("questions", [`${meta.questions.length} open:`, ...lines.map((s) => ` ${s}`)]);
|
|
24050
24097
|
}
|
|
24051
24098
|
function stageField(meta) {
|
|
24052
|
-
const flow =
|
|
24099
|
+
const flow = studioFor(meta.studio);
|
|
24053
24100
|
const stages = cardStages(meta, flow).length;
|
|
24054
24101
|
return stages > 1 ? field("stage", `${cardStage(meta, flow)} of ${stages}`) : [];
|
|
24055
24102
|
}
|
|
@@ -24057,7 +24104,7 @@ function committingClose(delivery) {
|
|
|
24057
24104
|
if (!delivery) return [];
|
|
24058
24105
|
return [
|
|
24059
24106
|
"Keep board files at the board path and out of task commits.",
|
|
24060
|
-
...delivery.
|
|
24107
|
+
...delivery.studio?.needsArtifact ? ["Record each delivered file or folder in a new ticked `Output:` todo."] : []
|
|
24061
24108
|
];
|
|
24062
24109
|
}
|
|
24063
24110
|
function conversationBlock(chat) {
|
|
@@ -24169,7 +24216,7 @@ function buildFlow(req, program2) {
|
|
|
24169
24216
|
break;
|
|
24170
24217
|
}
|
|
24171
24218
|
case "spec": {
|
|
24172
|
-
next.push("Return to the
|
|
24219
|
+
next.push("Return to the studio that requested this preview and continue it in this session. No background follow-up is scheduled.");
|
|
24173
24220
|
break;
|
|
24174
24221
|
}
|
|
24175
24222
|
// Squeezing the memory back down (#514). The facts are the files, because the files
|
|
@@ -24244,7 +24291,7 @@ function buildFlow(req, program2) {
|
|
|
24244
24291
|
case "reflect": {
|
|
24245
24292
|
for (const id of reflectedCards(req)) readCard2(id, "archive");
|
|
24246
24293
|
close.push(
|
|
24247
|
-
`${self} raw triage add --title ".." --slug <short-english-slug> --source "#<id>" --
|
|
24294
|
+
`${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`,
|
|
24248
24295
|
"propose nothing at all when nothing follows: that is a complete result, and most batches are it",
|
|
24249
24296
|
"change nothing else \u2014 no card is created, edited or archived, and no memory file is written"
|
|
24250
24297
|
);
|
|
@@ -24259,9 +24306,9 @@ function leadLine(req, program2) {
|
|
|
24259
24306
|
return `${action}${what ? ` ${what}` : ""} \u2014 printed, not started. Do it here, in this session (${program2}).`;
|
|
24260
24307
|
}
|
|
24261
24308
|
function printFlow(rawReq, program2 = "akb") {
|
|
24262
|
-
const unbuilt = rawReq.action === "implement" ?
|
|
24309
|
+
const unbuilt = rawReq.action === "implement" ? studioRefusal(rawReq) : null;
|
|
24263
24310
|
if (unbuilt?.reason === "planDelivered") die(unbuilt.error, { kind: "plan-delivered" });
|
|
24264
|
-
const req =
|
|
24311
|
+
const req = withStudio(rawReq);
|
|
24265
24312
|
const flow = buildFlow(req, program2);
|
|
24266
24313
|
const prompt = buildAsk(req);
|
|
24267
24314
|
const rule = ruleFor(req, frozenRules(req));
|
|
@@ -24296,7 +24343,7 @@ function printFlow(rawReq, program2 = "akb") {
|
|
|
24296
24343
|
say(guide.text.trimEnd());
|
|
24297
24344
|
}
|
|
24298
24345
|
}
|
|
24299
|
-
for (const block of [
|
|
24346
|
+
for (const block of [studioRulesBlock(req), landBlock(req), settingsBlock(req)].filter(Boolean)) {
|
|
24300
24347
|
say("");
|
|
24301
24348
|
say(block);
|
|
24302
24349
|
}
|
|
@@ -24337,7 +24384,7 @@ var init_flow = __esm({
|
|
|
24337
24384
|
init_dismissal_review();
|
|
24338
24385
|
init_prompts();
|
|
24339
24386
|
init_rules2();
|
|
24340
|
-
|
|
24387
|
+
init_studios();
|
|
24341
24388
|
init_types();
|
|
24342
24389
|
init_env();
|
|
24343
24390
|
MAX_STEPS = 12;
|
|
@@ -24346,7 +24393,7 @@ var init_flow = __esm({
|
|
|
24346
24393
|
bodyScaffoldClose = (lead = "fill the existing") => [`${lead} body scaffold; do not rename or translate its section titles, and leave empty scaffold sections in place`];
|
|
24347
24394
|
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`;
|
|
24348
24395
|
stageClose = (meta) => {
|
|
24349
|
-
const flow =
|
|
24396
|
+
const flow = studioFor(meta.studio);
|
|
24350
24397
|
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"] : [];
|
|
24351
24398
|
};
|
|
24352
24399
|
GUIDES_FOR = {
|
|
@@ -24382,7 +24429,7 @@ function endOfStage(contract, card) {
|
|
|
24382
24429
|
const missing = missingRequired2(contract, card);
|
|
24383
24430
|
if (!missing.length) return { done: true };
|
|
24384
24431
|
const askable = missing.find(
|
|
24385
|
-
(name) => findSpecAgent(name) && specAgentAssigned(name,
|
|
24432
|
+
(name) => findSpecAgent(name) && specAgentAssigned(name, cardStudioId(card.id)) && !askedFor(card.id, name)
|
|
24386
24433
|
);
|
|
24387
24434
|
if (!askable) return { stage: contract.stage, missing };
|
|
24388
24435
|
return {
|
|
@@ -24397,7 +24444,7 @@ var init_stage_end = __esm({
|
|
|
24397
24444
|
init_flows();
|
|
24398
24445
|
init_store();
|
|
24399
24446
|
init_stages();
|
|
24400
|
-
|
|
24447
|
+
init_studios();
|
|
24401
24448
|
missingRequired2 = (contract, card) => contract.requires.filter((name) => !card.body.includes(specHeading(name)));
|
|
24402
24449
|
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.`;
|
|
24403
24450
|
stageOfAction = (action) => {
|
|
@@ -24613,7 +24660,7 @@ function specRunsAfter(asks) {
|
|
|
24613
24660
|
const card = byId.get(ask2.cardId);
|
|
24614
24661
|
if (!card) return [];
|
|
24615
24662
|
const agent = findSpecAgent(ask2.specAgent);
|
|
24616
|
-
if (!agent || !specAgentAssigned(agent.name,
|
|
24663
|
+
if (!agent || !specAgentAssigned(agent.name, cardStudioId(ask2.cardId))) return [];
|
|
24617
24664
|
return [{
|
|
24618
24665
|
action: "spec",
|
|
24619
24666
|
id: ask2.cardId,
|
|
@@ -24639,7 +24686,7 @@ var init_follow = __esm({
|
|
|
24639
24686
|
init_agents();
|
|
24640
24687
|
init_read();
|
|
24641
24688
|
init_refine2();
|
|
24642
|
-
|
|
24689
|
+
init_studios();
|
|
24643
24690
|
}
|
|
24644
24691
|
});
|
|
24645
24692
|
|
|
@@ -25384,11 +25431,11 @@ async function cmdStartRun(action, args, opts, program2 = "akb") {
|
|
|
25384
25431
|
if (follow2) return await followStarted(run2.sessionId, program2, opts.events === true);
|
|
25385
25432
|
return { sessionId: run2.sessionId, action, cardId: run2.cardId };
|
|
25386
25433
|
}
|
|
25387
|
-
async function cmdRunScheduled(
|
|
25388
|
-
const id =
|
|
25434
|
+
async function cmdRunScheduled(studio, agent, opts, program2 = "akb") {
|
|
25435
|
+
const id = knownStudio(studio);
|
|
25389
25436
|
const one = scheduledAgent(id, agent);
|
|
25390
25437
|
if (!one) die(`\`${id}\` schedules no agent called \`${agent}\``, { kind: "run-refused", action: "scheduled" });
|
|
25391
|
-
const req = scheduledRequest({
|
|
25438
|
+
const req = scheduledRequest({ studio: id, agent: one.agent });
|
|
25392
25439
|
if (insideRun() || opts.print) return printFlow(req, program2);
|
|
25393
25440
|
const started = await startRun(req);
|
|
25394
25441
|
if ("error" in started) die(started.error, { kind: "run-refused", action: "scheduled" });
|
|
@@ -25841,7 +25888,7 @@ var init_run = __esm({
|
|
|
25841
25888
|
init_refine2();
|
|
25842
25889
|
init_sessions();
|
|
25843
25890
|
init_start();
|
|
25844
|
-
|
|
25891
|
+
init_studios();
|
|
25845
25892
|
init_scheduled();
|
|
25846
25893
|
init_store();
|
|
25847
25894
|
init_io();
|
|
@@ -25919,8 +25966,8 @@ async function cmdTriageAdd(opts) {
|
|
|
25919
25966
|
const title = (opts.title ?? "").trim();
|
|
25920
25967
|
if (!title) die('say what it is: --title "<one line>"', { kind: "needs-input" });
|
|
25921
25968
|
if (opts.file !== void 0 && opts.text !== void 0) die("pass --file or --text, not both", { kind: "needs-input" });
|
|
25922
|
-
if (!opts.
|
|
25923
|
-
const
|
|
25969
|
+
if (!opts.studio?.trim()) die("say which studio does it: --studio <id> (`akb studio list`)", { kind: "needs-input" });
|
|
25970
|
+
const studio = knownStudio(opts.studio);
|
|
25924
25971
|
let body = opts.text;
|
|
25925
25972
|
if (opts.file !== void 0) {
|
|
25926
25973
|
try {
|
|
@@ -25933,7 +25980,7 @@ async function cmdTriageAdd(opts) {
|
|
|
25933
25980
|
die('the item has to say something: --text ".." , or --file <path> for a longer one', { kind: "needs-input" });
|
|
25934
25981
|
}
|
|
25935
25982
|
const agent = runAgent();
|
|
25936
|
-
const done2 = addToInbox({ title, text: body, source: opts.source, slug: opts.slug,
|
|
25983
|
+
const done2 = addToInbox({ title, text: body, source: opts.source, slug: opts.slug, studio, ...agent ? { agent } : {} });
|
|
25937
25984
|
if (!done2.ok) die(done2.error, { kind: "triage-item-refused" });
|
|
25938
25985
|
say(`added to triage: ${done2.signal.relPath}`);
|
|
25939
25986
|
return { title: done2.signal.title, source_id: done2.signal.sourceId, file: done2.signal.relPath };
|
|
@@ -25950,7 +25997,7 @@ var init_triage = __esm({
|
|
|
25950
25997
|
"../cli/src/commands/triage.ts"() {
|
|
25951
25998
|
"use strict";
|
|
25952
25999
|
init_scheduled();
|
|
25953
|
-
|
|
26000
|
+
init_studios();
|
|
25954
26001
|
init_signals();
|
|
25955
26002
|
init_io();
|
|
25956
26003
|
init_paths();
|
|
@@ -25959,8 +26006,8 @@ var init_triage = __esm({
|
|
|
25959
26006
|
|
|
25960
26007
|
// ../cli/src/commands/spec.ts
|
|
25961
26008
|
async function cmdSpec(opts, program2 = "akb") {
|
|
25962
|
-
if ((opts.
|
|
25963
|
-
if (opts.workspace && !opts.
|
|
26009
|
+
if ((opts.studio || opts.workspace) && !opts.triggers) die("--studio and --workspace require --triggers", { kind: "invalid-usage" });
|
|
26010
|
+
if (opts.workspace && !opts.studio) die("--workspace requires --studio", { kind: "invalid-usage" });
|
|
25964
26011
|
if (opts.triggers) {
|
|
25965
26012
|
if (opts.agent !== void 0 || opts.id !== void 0 || opts.note?.length || opts.print || opts.follow || opts.notes !== void 0) {
|
|
25966
26013
|
die("--triggers cannot be combined with positional arguments, --print, --follow or --notes", { kind: "invalid-usage" });
|
|
@@ -25987,9 +26034,9 @@ async function cmdSpec(opts, program2 = "akb") {
|
|
|
25987
26034
|
die(`say which card: ${program2} raw previews ${name} <id> [note]`, { kind: "needs-input" });
|
|
25988
26035
|
}
|
|
25989
26036
|
if (!locate(id)) die(`no task with id ${id} under ${rel(TODO)}`, { kind: "card-not-found", id });
|
|
25990
|
-
if (!specAgentAssigned(name,
|
|
26037
|
+
if (!specAgentAssigned(name, cardStudioId(id))) {
|
|
25991
26038
|
die(
|
|
25992
|
-
`the \`${name}\` agent is off or no preview of the
|
|
26039
|
+
`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}.`,
|
|
25993
26040
|
{ kind: "spec-agent-off", specAgent: name }
|
|
25994
26041
|
);
|
|
25995
26042
|
}
|
|
@@ -26057,7 +26104,7 @@ var init_spec = __esm({
|
|
|
26057
26104
|
init_io();
|
|
26058
26105
|
init_paths();
|
|
26059
26106
|
init_agents();
|
|
26060
|
-
|
|
26107
|
+
init_studios();
|
|
26061
26108
|
init_run();
|
|
26062
26109
|
}
|
|
26063
26110
|
});
|
|
@@ -26160,7 +26207,7 @@ async function onBoard2(cmd, cli, work) {
|
|
|
26160
26207
|
const found2 = resolveBoard("runs", { board: ctx.board, dir: ctx.dir, cwd: cli.cwd, installHint: cli.installHint });
|
|
26161
26208
|
useBoard(found2, ctx.dir !== null);
|
|
26162
26209
|
sayIfRetiredPointer(found2.root);
|
|
26163
|
-
await
|
|
26210
|
+
await syncStudios();
|
|
26164
26211
|
return { board: KANBAN, ...await work(cli.program) ?? {} };
|
|
26165
26212
|
});
|
|
26166
26213
|
}
|
|
@@ -26209,14 +26256,14 @@ function declareRaw(program2, cli) {
|
|
|
26209
26256
|
groups.delivery.addHelpText("after", HELP_AFTER.deliveries(cli.program));
|
|
26210
26257
|
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(
|
|
26211
26258
|
"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."
|
|
26212
|
-
).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("--
|
|
26259
|
+
).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", `
|
|
26213
26260
|
List trigger conditions: ${raw} previews --triggers --json`).action(async function(...vals) {
|
|
26214
26261
|
const [agent, id, note] = positional(vals);
|
|
26215
26262
|
const opts = this.opts();
|
|
26216
|
-
if (opts.triggers && opts.
|
|
26263
|
+
if (opts.triggers && opts.studio && !agent && id === void 0 && !note?.length && !opts.print && !opts.follow && opts.notes === void 0) {
|
|
26217
26264
|
await boardless(this, cli, async () => {
|
|
26218
|
-
if (goalsFile() && !opts.workspace) return cmdGoalPreviews(opts.
|
|
26219
|
-
return queryPreviews(opts.
|
|
26265
|
+
if (goalsFile() && !opts.workspace) return cmdGoalPreviews(opts.studio);
|
|
26266
|
+
return queryPreviews(opts.studio, opts.workspace);
|
|
26220
26267
|
});
|
|
26221
26268
|
} else await onBoard2(this, cli, (p) => cmdSpec({ agent, id, note, ...opts }, p));
|
|
26222
26269
|
});
|
|
@@ -26224,7 +26271,7 @@ List trigger conditions: ${raw} previews --triggers --json`).action(async functi
|
|
|
26224
26271
|
const triage = groups.triage;
|
|
26225
26272
|
withShared(triage.command("add")).summary("write one item into triage").description(
|
|
26226
26273
|
"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."
|
|
26227
|
-
).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("--
|
|
26274
|
+
).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() {
|
|
26228
26275
|
await onBoard2(this, cli, () => cmdTriageAdd(this.opts()));
|
|
26229
26276
|
});
|
|
26230
26277
|
withShared(triage.command("check")).summary("where triage already holds one source id").description(
|
|
@@ -26232,20 +26279,20 @@ List trigger conditions: ${raw} previews --triggers --json`).action(async functi
|
|
|
26232
26279
|
).argument("<source-id>", "the id to look for").action(async function(sourceId) {
|
|
26233
26280
|
await onBoard2(this, cli, () => cmdTriageCheck(sourceId));
|
|
26234
26281
|
});
|
|
26235
|
-
withShared(program2.command("components")).summary("list an agent or
|
|
26282
|
+
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() {
|
|
26236
26283
|
const ctx = ctxOf(this, cli.program);
|
|
26237
26284
|
useBoard(resolveBoard("components", { board: ctx.board, dir: ctx.dir, cwd: cli.cwd, installHint: cli.installHint }), ctx.dir !== null);
|
|
26238
26285
|
await boardless(this, cli, () => cmdComponents(this.opts()));
|
|
26239
26286
|
});
|
|
26240
|
-
const
|
|
26241
|
-
withShared(
|
|
26242
|
-
await onBoard2(this, cli, () =>
|
|
26287
|
+
const studio = noun("studio", "check a studio folder, or rename a draft or draw a diagram inside a run");
|
|
26288
|
+
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) {
|
|
26289
|
+
await onBoard2(this, cli, () => cmdStudioValidate(folder));
|
|
26243
26290
|
});
|
|
26244
|
-
withShared(
|
|
26245
|
-
await onBoard2(this, cli, () =>
|
|
26291
|
+
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) {
|
|
26292
|
+
await onBoard2(this, cli, () => cmdStudioRename(id, name.join(" ")));
|
|
26246
26293
|
});
|
|
26247
|
-
withShared(
|
|
26248
|
-
await onBoard2(this, cli, () =>
|
|
26294
|
+
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) {
|
|
26295
|
+
await onBoard2(this, cli, () => cmdStudioDiagram(id, card));
|
|
26249
26296
|
});
|
|
26250
26297
|
}
|
|
26251
26298
|
function declareRuns(program2, cli) {
|
|
@@ -26259,7 +26306,7 @@ function declareRuns(program2, cli) {
|
|
|
26259
26306
|
withShared(task.command("show")).argument("<task>").summary("a task and its card").action(async function(id) {
|
|
26260
26307
|
await boardless(this, cli, () => taskShow(id));
|
|
26261
26308
|
});
|
|
26262
|
-
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("--
|
|
26309
|
+
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) {
|
|
26263
26310
|
await boardless(this, cli, () => taskCreate(request2.join(" "), this.opts()));
|
|
26264
26311
|
});
|
|
26265
26312
|
withShared(task.command("approve")).argument("<task>").summary("approve the current review point").option("--comment <text>", "a note with the approval").action(async function(id) {
|
|
@@ -26285,7 +26332,7 @@ function declareRuns(program2, cli) {
|
|
|
26285
26332
|
withShared(task.command("comment")).argument("<task>").argument("<text...>").summary("comment on a task").action(async function(id, text4) {
|
|
26286
26333
|
await boardless(this, cli, () => taskComment(id, text4.join(" ")));
|
|
26287
26334
|
});
|
|
26288
|
-
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> [--
|
|
26335
|
+
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");
|
|
26289
26336
|
goal.action(async function(sub) {
|
|
26290
26337
|
await boardless(this, cli, () => externalGoalSession() ? cloudGoal([sub], this.opts()) : cmdGoal([sub], this.opts()));
|
|
26291
26338
|
});
|
|
@@ -26376,35 +26423,35 @@ function declareRuns(program2, cli) {
|
|
|
26376
26423
|
await boardless(this, cli, (p) => cmdTelemetry([move], p));
|
|
26377
26424
|
});
|
|
26378
26425
|
}
|
|
26379
|
-
const
|
|
26380
|
-
"Every card runs through one
|
|
26426
|
+
const studio = withShared(program2.command("studio")).summary("the studios this board runs, and the agents each one lists").description(
|
|
26427
|
+
"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."
|
|
26381
26428
|
).allowExcessArguments().allowUnknownOption().action(async function() {
|
|
26382
26429
|
const word = this.args[0];
|
|
26383
26430
|
if (word === "rename" || word === "diagram") {
|
|
26384
|
-
this.error(`\`${cli.program}
|
|
26431
|
+
this.error(`\`${cli.program} studio ${word}\` is now \`${cli.program} raw studio ${word}\`.`, { code: "commander.unknownCommand" });
|
|
26385
26432
|
}
|
|
26386
26433
|
if (word) this.error(`unknown command '${word}'`, { code: "commander.unknownCommand" });
|
|
26387
|
-
await
|
|
26434
|
+
await studioList(this, cli);
|
|
26388
26435
|
});
|
|
26389
|
-
const flowWord = (name) => withShared(
|
|
26390
|
-
flowWord("list").summary("every
|
|
26391
|
-
await
|
|
26436
|
+
const flowWord = (name) => withShared(studio.command(name));
|
|
26437
|
+
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() {
|
|
26438
|
+
await studioList(this, cli);
|
|
26392
26439
|
});
|
|
26393
|
-
flowWord("pull").argument("<id>", "the
|
|
26394
|
-
await onBoard2(this, cli, () =>
|
|
26440
|
+
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) {
|
|
26441
|
+
await onBoard2(this, cli, () => cmdStudioPull(id, folder));
|
|
26395
26442
|
});
|
|
26396
|
-
flowWord("push").argument("<folder>", "a folder `
|
|
26397
|
-
await boardless(this, cli, () =>
|
|
26443
|
+
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) {
|
|
26444
|
+
await boardless(this, cli, () => cmdStudioPush(folder, this.opts()));
|
|
26398
26445
|
});
|
|
26399
|
-
flowWord("rule").argument("<
|
|
26400
|
-
"Without --text or --file, prints the
|
|
26446
|
+
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(
|
|
26447
|
+
"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."
|
|
26401
26448
|
).action(async function(id) {
|
|
26402
|
-
await onBoard2(this, cli, () =>
|
|
26449
|
+
await onBoard2(this, cli, () => cmdStudioRule(id, this.opts()));
|
|
26403
26450
|
});
|
|
26404
|
-
flowWord("instructions").argument("<agent>", "an agent `akb
|
|
26405
|
-
"Without --text or --file, prints the agent's current instructions. With them, replaces all of them. A
|
|
26451
|
+
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(
|
|
26452
|
+
"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."
|
|
26406
26453
|
).action(async function(agent) {
|
|
26407
|
-
await onBoard2(this, cli, () =>
|
|
26454
|
+
await onBoard2(this, cli, () => cmdStudioInstructions(agent, this.opts()));
|
|
26408
26455
|
});
|
|
26409
26456
|
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(
|
|
26410
26457
|
"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."
|
|
@@ -26545,14 +26592,14 @@ function declareAgent(program2, cli) {
|
|
|
26545
26592
|
])
|
|
26546
26593
|
);
|
|
26547
26594
|
});
|
|
26548
|
-
withShared(agent.command("picks", { hidden: true })).argument("<json>", "runtime picks by
|
|
26595
|
+
withShared(agent.command("picks", { hidden: true })).argument("<json>", "runtime picks by studio agent").action(async function(json) {
|
|
26549
26596
|
await onBoard2(this, cli, () => cmdAgent(["picks", json]));
|
|
26550
26597
|
});
|
|
26551
|
-
word("run").argument("<
|
|
26552
|
-
await onBoard2(this, cli, (p) => cmdRunScheduled(
|
|
26598
|
+
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) {
|
|
26599
|
+
await onBoard2(this, cli, (p) => cmdRunScheduled(studio, name, this.opts(), p));
|
|
26553
26600
|
});
|
|
26554
26601
|
}
|
|
26555
|
-
var
|
|
26602
|
+
var studioList, positional, RUN_ID, DELIVERY, splitArgs, sentence;
|
|
26556
26603
|
var init_agent2 = __esm({
|
|
26557
26604
|
"../cli/src/lib/cli/agent.ts"() {
|
|
26558
26605
|
"use strict";
|
|
@@ -26561,7 +26608,7 @@ var init_agent2 = __esm({
|
|
|
26561
26608
|
init_io();
|
|
26562
26609
|
init_paths();
|
|
26563
26610
|
init_board_cli();
|
|
26564
|
-
|
|
26611
|
+
init_cloud_studios();
|
|
26565
26612
|
init_flows();
|
|
26566
26613
|
init_deliveries();
|
|
26567
26614
|
init_manual();
|
|
@@ -26572,7 +26619,7 @@ var init_agent2 = __esm({
|
|
|
26572
26619
|
init_goal();
|
|
26573
26620
|
init_task();
|
|
26574
26621
|
init_guide2();
|
|
26575
|
-
|
|
26622
|
+
init_studio2();
|
|
26576
26623
|
init_run();
|
|
26577
26624
|
init_triage();
|
|
26578
26625
|
init_goal();
|
|
@@ -26582,9 +26629,9 @@ var init_agent2 = __esm({
|
|
|
26582
26629
|
init_harnesses();
|
|
26583
26630
|
init_moved();
|
|
26584
26631
|
init_shared2();
|
|
26585
|
-
|
|
26586
|
-
await
|
|
26587
|
-
return
|
|
26632
|
+
studioList = (cmd, cli) => !cmd.optsWithGlobals().board && externalGoalSession() ? boardless(cmd, cli, cloudGoalStudios) : goalsFile() ? boardless(cmd, cli, () => cmdGoalStudios()) : onBoard2(cmd, cli, async () => {
|
|
26633
|
+
await syncStudios(true);
|
|
26634
|
+
return cmdStudioList();
|
|
26588
26635
|
});
|
|
26589
26636
|
positional = (vals) => vals.slice(0, -2);
|
|
26590
26637
|
RUN_ID = "a run's id, any prefix of one that names only one run, or `last`. Left out, it means the newest run";
|
|
@@ -26678,7 +26725,7 @@ async function repairBoard(root2, report3, named2) {
|
|
|
26678
26725
|
moveLegacyMemory(board2, report3);
|
|
26679
26726
|
dropModuleGoals(board2, report3);
|
|
26680
26727
|
movePlanRules(board2, report3);
|
|
26681
|
-
|
|
26728
|
+
noteOldStudios(board2, report3);
|
|
26682
26729
|
report3.sayDid();
|
|
26683
26730
|
await boardMove(root2, ["init"], board2);
|
|
26684
26731
|
moveRuntimes(root2, board2, report3);
|
|
@@ -26757,15 +26804,15 @@ var PLAN_LEADS = {
|
|
|
26757
26804
|
"carousel-post": ["carousel-planner"],
|
|
26758
26805
|
"blog-post": ["blog-planner"],
|
|
26759
26806
|
"video-clone": ["video-cloner"],
|
|
26760
|
-
"
|
|
26807
|
+
"studio-builder": ["studio-writer"]
|
|
26761
26808
|
};
|
|
26762
26809
|
var GONE_LEADS = ["software-planner", "planner"];
|
|
26763
26810
|
function planLeads(board2) {
|
|
26764
26811
|
const leads = { ...PLAN_LEADS };
|
|
26765
|
-
const root2 = path83.join(board2, "
|
|
26812
|
+
const root2 = path83.join(board2, "studios");
|
|
26766
26813
|
for (const entry of fs84.existsSync(root2) ? fs84.readdirSync(root2, { withFileTypes: true }) : []) {
|
|
26767
26814
|
if (!entry.isDirectory()) continue;
|
|
26768
|
-
const meta = splitFrontmatter(read2(path83.join(root2, entry.name, "
|
|
26815
|
+
const meta = splitFrontmatter(read2(path83.join(root2, entry.name, "STUDIO.md")) ?? "").meta;
|
|
26769
26816
|
const stages = meta === null ? void 0 : parseYamlBlock(meta).stages;
|
|
26770
26817
|
const plan = stages && typeof stages === "object" && !Array.isArray(stages) ? stages.plan : void 0;
|
|
26771
26818
|
const lead = plan && typeof plan === "object" && !Array.isArray(plan) && typeof plan.lead === "string" ? plan.lead.trim() : "";
|
|
@@ -26781,7 +26828,7 @@ function movePlanRules(board2, report3) {
|
|
|
26781
26828
|
const from = path83.join(rules, `${lead}.md`);
|
|
26782
26829
|
const rule = read2(from)?.trim();
|
|
26783
26830
|
if (!rule) continue;
|
|
26784
|
-
const to = path83.join(rules, "
|
|
26831
|
+
const to = path83.join(rules, "studios", `${id}.md`);
|
|
26785
26832
|
const there = read2(to)?.trim() ?? "";
|
|
26786
26833
|
if (!there.includes(rule)) {
|
|
26787
26834
|
fs84.mkdirSync(path83.dirname(to), { recursive: true });
|
|
@@ -26792,17 +26839,17 @@ function movePlanRules(board2, report3) {
|
|
|
26792
26839
|
}
|
|
26793
26840
|
}
|
|
26794
26841
|
for (const lead of GONE_LEADS) fs84.rmSync(path83.join(rules, `${lead}.md`), { force: true });
|
|
26795
|
-
if (moved.length) report3.did.push(`made each plan agent's rule its
|
|
26842
|
+
if (moved.length) report3.did.push(`made each plan agent's rule its studio's card rule (docs/kanban/rules/studios/): ${moved.join(", ")}`);
|
|
26796
26843
|
}
|
|
26797
|
-
function
|
|
26844
|
+
function noteOldStudios(board2, report3) {
|
|
26798
26845
|
const old = (dir, file, keys) => {
|
|
26799
26846
|
const root2 = path83.join(board2, dir);
|
|
26800
26847
|
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}`);
|
|
26801
26848
|
};
|
|
26802
|
-
const files = [...old("
|
|
26849
|
+
const files = [...old("studios", "STUDIO.md", /^(stages|delivers):/m), ...old("agents", "AGENT.md", /^\s+(hook|lead):/m)];
|
|
26803
26850
|
if (files.length) {
|
|
26804
26851
|
report3.notes.push(
|
|
26805
|
-
`written in the old form, so not read until rewritten \u2014 list a
|
|
26852
|
+
`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(", ")}`
|
|
26806
26853
|
);
|
|
26807
26854
|
}
|
|
26808
26855
|
}
|