wildcrane 0.11.75 → 0.11.77
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/dist/kanban.mjs +521 -279
- package/package.json +2 -2
package/dist/kanban.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// ai4kanban 0.11.
|
|
2
|
+
// ai4kanban 0.11.77 — built from the CLI's TypeScript sources by cli/scripts/build.mjs.
|
|
3
3
|
// Do not edit: every change belongs in cli/src/, and a build overwrites this file.
|
|
4
4
|
import { createRequire as __ai4kanbanRequire } from 'node:module'
|
|
5
5
|
const require = __ai4kanbanRequire(import.meta.url)
|
|
@@ -546,9 +546,9 @@ function floatSafeRemainder(val, step) {
|
|
|
546
546
|
return 0;
|
|
547
547
|
return ratio - roundedRatio;
|
|
548
548
|
}
|
|
549
|
-
function defineLazy(
|
|
549
|
+
function defineLazy(object3, key, getter) {
|
|
550
550
|
let value = void 0;
|
|
551
|
-
Object.defineProperty(
|
|
551
|
+
Object.defineProperty(object3, key, {
|
|
552
552
|
get() {
|
|
553
553
|
if (value === EVALUATING) {
|
|
554
554
|
return void 0;
|
|
@@ -560,7 +560,7 @@ function defineLazy(object2, key, getter) {
|
|
|
560
560
|
return value;
|
|
561
561
|
},
|
|
562
562
|
set(v) {
|
|
563
|
-
Object.defineProperty(
|
|
563
|
+
Object.defineProperty(object3, key, {
|
|
564
564
|
value: v
|
|
565
565
|
// configurable: true,
|
|
566
566
|
});
|
|
@@ -640,10 +640,10 @@ function mergeDefs(...defs) {
|
|
|
640
640
|
function cloneDef(schema) {
|
|
641
641
|
return mergeDefs(schema._zod.def);
|
|
642
642
|
}
|
|
643
|
-
function getElementAtPath(obj3,
|
|
644
|
-
if (!
|
|
643
|
+
function getElementAtPath(obj3, path87) {
|
|
644
|
+
if (!path87)
|
|
645
645
|
return obj3;
|
|
646
|
-
return
|
|
646
|
+
return path87.reduce((acc, key) => acc?.[key], obj3);
|
|
647
647
|
}
|
|
648
648
|
function promiseAllObject(promisesObj) {
|
|
649
649
|
const keys = Object.keys(promisesObj);
|
|
@@ -902,11 +902,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
902
902
|
}
|
|
903
903
|
return false;
|
|
904
904
|
}
|
|
905
|
-
function prefixIssues(
|
|
905
|
+
function prefixIssues(path87, issues) {
|
|
906
906
|
return issues.map((iss) => {
|
|
907
907
|
var _a3;
|
|
908
908
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
909
|
-
iss.path.unshift(
|
|
909
|
+
iss.path.unshift(path87);
|
|
910
910
|
return iss;
|
|
911
911
|
});
|
|
912
912
|
}
|
|
@@ -1439,16 +1439,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
|
|
|
1439
1439
|
}
|
|
1440
1440
|
function formatError(error62, mapper = (issue2) => issue2.message) {
|
|
1441
1441
|
const fieldErrors = { _errors: [] };
|
|
1442
|
-
const processError = (error63,
|
|
1442
|
+
const processError = (error63, path87 = []) => {
|
|
1443
1443
|
for (const issue2 of error63.issues) {
|
|
1444
1444
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1445
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1445
|
+
issue2.errors.map((issues) => processError({ issues }, [...path87, ...issue2.path]));
|
|
1446
1446
|
} else if (issue2.code === "invalid_key") {
|
|
1447
|
-
processError({ issues: issue2.issues }, [...
|
|
1447
|
+
processError({ issues: issue2.issues }, [...path87, ...issue2.path]);
|
|
1448
1448
|
} else if (issue2.code === "invalid_element") {
|
|
1449
|
-
processError({ issues: issue2.issues }, [...
|
|
1449
|
+
processError({ issues: issue2.issues }, [...path87, ...issue2.path]);
|
|
1450
1450
|
} else {
|
|
1451
|
-
const fullpath = [...
|
|
1451
|
+
const fullpath = [...path87, ...issue2.path];
|
|
1452
1452
|
if (fullpath.length === 0) {
|
|
1453
1453
|
fieldErrors._errors.push(mapper(issue2));
|
|
1454
1454
|
} else {
|
|
@@ -1487,17 +1487,17 @@ function formatError(error62, mapper = (issue2) => issue2.message) {
|
|
|
1487
1487
|
}
|
|
1488
1488
|
function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
1489
1489
|
const result = { errors: [] };
|
|
1490
|
-
const processError = (error63,
|
|
1490
|
+
const processError = (error63, path87 = []) => {
|
|
1491
1491
|
var _a3;
|
|
1492
1492
|
for (const issue2 of error63.issues) {
|
|
1493
1493
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1494
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1494
|
+
issue2.errors.map((issues) => processError({ issues }, [...path87, ...issue2.path]));
|
|
1495
1495
|
} else if (issue2.code === "invalid_key") {
|
|
1496
|
-
processError({ issues: issue2.issues }, [...
|
|
1496
|
+
processError({ issues: issue2.issues }, [...path87, ...issue2.path]);
|
|
1497
1497
|
} else if (issue2.code === "invalid_element") {
|
|
1498
|
-
processError({ issues: issue2.issues }, [...
|
|
1498
|
+
processError({ issues: issue2.issues }, [...path87, ...issue2.path]);
|
|
1499
1499
|
} else {
|
|
1500
|
-
const fullpath = [...
|
|
1500
|
+
const fullpath = [...path87, ...issue2.path];
|
|
1501
1501
|
if (fullpath.length === 0) {
|
|
1502
1502
|
result.errors.push(mapper(issue2));
|
|
1503
1503
|
continue;
|
|
@@ -1536,8 +1536,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
|
1536
1536
|
}
|
|
1537
1537
|
function toDotPath(_path) {
|
|
1538
1538
|
const segs = [];
|
|
1539
|
-
const
|
|
1540
|
-
for (const seg of
|
|
1539
|
+
const path87 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
1540
|
+
for (const seg of path87) {
|
|
1541
1541
|
if (typeof seg === "number")
|
|
1542
1542
|
segs.push(`[${seg}]`);
|
|
1543
1543
|
else if (typeof seg === "symbol")
|
|
@@ -16222,8 +16222,8 @@ function foldObjects(members2) {
|
|
|
16222
16222
|
}
|
|
16223
16223
|
const properties = {};
|
|
16224
16224
|
const required2 = /* @__PURE__ */ new Set();
|
|
16225
|
-
for (const
|
|
16226
|
-
for (const key in
|
|
16225
|
+
for (const object3 of objects) {
|
|
16226
|
+
for (const key in object3.properties) {
|
|
16227
16227
|
if (Object.prototype.hasOwnProperty.call(properties, key))
|
|
16228
16228
|
continue;
|
|
16229
16229
|
const parts = [];
|
|
@@ -16237,18 +16237,18 @@ function foldObjects(members2) {
|
|
|
16237
16237
|
const merged = parts.length === 1 ? parts[0] : foldObjects(parts) ?? { allOf: parts };
|
|
16238
16238
|
assignProp(properties, key, merged);
|
|
16239
16239
|
}
|
|
16240
|
-
for (const key of
|
|
16240
|
+
for (const key of object3.required ?? [])
|
|
16241
16241
|
required2.add(key);
|
|
16242
16242
|
}
|
|
16243
16243
|
const folded = { type: "object", properties };
|
|
16244
16244
|
if (required2.size)
|
|
16245
16245
|
folded.required = [...required2];
|
|
16246
|
-
if (objects.every((
|
|
16246
|
+
if (objects.every((object3) => object3.additionalProperties === false)) {
|
|
16247
16247
|
folded.additionalProperties = false;
|
|
16248
16248
|
} else {
|
|
16249
16249
|
const constraints = [];
|
|
16250
|
-
for (const
|
|
16251
|
-
const constraint = undeclaredConstraint(
|
|
16250
|
+
for (const object3 of objects) {
|
|
16251
|
+
const constraint = undeclaredConstraint(object3);
|
|
16252
16252
|
if (constraint && !constraints.some((seen) => JSON.stringify(seen) === JSON.stringify(constraint)))
|
|
16253
16253
|
constraints.push(constraint);
|
|
16254
16254
|
}
|
|
@@ -19569,13 +19569,13 @@ function resolveRef(ref, ctx) {
|
|
|
19569
19569
|
if (!ref.startsWith("#")) {
|
|
19570
19570
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
19571
19571
|
}
|
|
19572
|
-
const
|
|
19573
|
-
if (
|
|
19572
|
+
const path87 = ref.slice(1).split("/").filter(Boolean);
|
|
19573
|
+
if (path87.length === 0) {
|
|
19574
19574
|
return ctx.rootSchema;
|
|
19575
19575
|
}
|
|
19576
19576
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
19577
|
-
if (
|
|
19578
|
-
const key =
|
|
19577
|
+
if (path87[0] === defsKey) {
|
|
19578
|
+
const key = path87[1] === void 0 ? void 0 : decodeJSONPointerSegment(path87[1]);
|
|
19579
19579
|
if (!key || !ctx.defs[key]) {
|
|
19580
19580
|
throw new Error(`Reference not found: ${ref}`);
|
|
19581
19581
|
}
|
|
@@ -20855,7 +20855,7 @@ function parseReviewPlan(value, previews) {
|
|
|
20855
20855
|
return plan;
|
|
20856
20856
|
}
|
|
20857
20857
|
function readReviewPlan(plan) {
|
|
20858
|
-
return plan?.map(({ id: id2, after: after2, previews }) => ({ id: id2, after: after2, previews })) ?? null;
|
|
20858
|
+
return plan?.map(({ id: id2, after: after2, previews, kind }) => ({ id: id2, after: after2, previews, ...kind && { kind } })) ?? null;
|
|
20859
20859
|
}
|
|
20860
20860
|
function reviewAuthorization(review, assigned, dispatchRevision) {
|
|
20861
20861
|
if (review.pending_plan) return { kind: "pending" };
|
|
@@ -20878,7 +20878,7 @@ function reviewAllows(authorization, action) {
|
|
|
20878
20878
|
function reviewInstruction(authorization) {
|
|
20879
20879
|
switch (authorization.kind) {
|
|
20880
20880
|
case "plan":
|
|
20881
|
-
return "Planning only.
|
|
20881
|
+
return "Planning only. Submit a review plan. Wait for confirmation if it is pending, and work only on dispatched stages.";
|
|
20882
20882
|
case "pending":
|
|
20883
20883
|
return "Wait for the proposed plan decision. Do not start new stages.";
|
|
20884
20884
|
case "unreviewed":
|
|
@@ -20912,7 +20912,8 @@ var init_review_plan = __esm({
|
|
|
20912
20912
|
reviewNodeSchema = external_exports.object({
|
|
20913
20913
|
id,
|
|
20914
20914
|
after: external_exports.array(id).max(50).default([]),
|
|
20915
|
-
previews: external_exports.array(id).max(50).default([])
|
|
20915
|
+
previews: external_exports.array(id).max(50).default([]),
|
|
20916
|
+
kind: external_exports.literal("work").optional()
|
|
20916
20917
|
}).strict();
|
|
20917
20918
|
reviewPlanSchema = external_exports.array(reviewNodeSchema).max(50).superRefine((nodes, ctx) => {
|
|
20918
20919
|
try {
|
|
@@ -22218,14 +22219,14 @@ async function taskReview(id2, opts = {}, location = {}) {
|
|
|
22218
22219
|
if (!count3) task = await cloud("GET", `/v1/tasks/${enc(ref)}`);
|
|
22219
22220
|
else {
|
|
22220
22221
|
const review_revision = reviewRevision(opts.revision);
|
|
22221
|
-
let
|
|
22222
|
-
if (opts.file)
|
|
22223
|
-
else if (opts.reviseFrom)
|
|
22222
|
+
let fields2;
|
|
22223
|
+
if (opts.file) fields2 = { operation: "plan", review_plan: parseReviewPlan(JSON.parse(fs7.readFileSync(opts.file, "utf8"))) };
|
|
22224
|
+
else if (opts.reviseFrom) fields2 = { operation: "revise", stage: opts.reviseFrom };
|
|
22224
22225
|
else {
|
|
22225
22226
|
if (!opts.stage || !["running", "done"].includes(opts.status)) die("--stage and --status running|done are required.");
|
|
22226
|
-
|
|
22227
|
+
fields2 = { operation: "status", stage: opts.stage, status: opts.status };
|
|
22227
22228
|
}
|
|
22228
|
-
task = await cloud("POST", `/v1/tasks/${enc(ref)}/review`, { ...
|
|
22229
|
+
task = await cloud("POST", `/v1/tasks/${enc(ref)}/review`, { ...fields2, review_revision });
|
|
22229
22230
|
}
|
|
22230
22231
|
say(JSON.stringify(task.review, null, 2));
|
|
22231
22232
|
return { review: task.review };
|
|
@@ -22369,11 +22370,11 @@ function markSubtaskIn(text5, id2, action) {
|
|
|
22369
22370
|
}
|
|
22370
22371
|
function dropRefsIn(text5, id2) {
|
|
22371
22372
|
const lines = text5.split("\n");
|
|
22372
|
-
const
|
|
22373
|
-
if (lines[0]?.trim() !== "---") return { text: text5, fields };
|
|
22373
|
+
const fields2 = [];
|
|
22374
|
+
if (lines[0]?.trim() !== "---") return { text: text5, fields: fields2 };
|
|
22374
22375
|
let end2 = 1;
|
|
22375
22376
|
while (end2 < lines.length && lines[end2].trim() !== "---") end2++;
|
|
22376
|
-
if (end2 >= lines.length) return { text: text5, fields };
|
|
22377
|
+
if (end2 >= lines.length) return { text: text5, fields: fields2 };
|
|
22377
22378
|
for (let i = 1; i < end2; i++) {
|
|
22378
22379
|
const m = lines[i].match(REF_LIST);
|
|
22379
22380
|
if (!m) continue;
|
|
@@ -22381,9 +22382,9 @@ function dropRefsIn(text5, id2) {
|
|
|
22381
22382
|
const kept2 = refs.filter((s) => Number(s.replace(/^#/, "")) !== id2);
|
|
22382
22383
|
if (kept2.length === refs.length) continue;
|
|
22383
22384
|
lines[i] = `${m[1]}: [${kept2.join(", ")}]`;
|
|
22384
|
-
|
|
22385
|
+
fields2.push(m[1]);
|
|
22385
22386
|
}
|
|
22386
|
-
return { text:
|
|
22387
|
+
return { text: fields2.length ? lines.join("\n") : text5, fields: fields2 };
|
|
22387
22388
|
}
|
|
22388
22389
|
function groupCloseOf(text5) {
|
|
22389
22390
|
const { total, resolved } = subtaskLines(parseFrontmatter(text5).body);
|
|
@@ -22507,10 +22508,10 @@ function dropCrossRefs(id2) {
|
|
|
22507
22508
|
const touched = [];
|
|
22508
22509
|
for (const file2 of walkMd(TODO)) {
|
|
22509
22510
|
if (path9.basename(file2) === "README.md") continue;
|
|
22510
|
-
const { text: text5, fields } = dropRefsIn(fs8.readFileSync(file2, "utf8"), id2);
|
|
22511
|
-
if (!
|
|
22511
|
+
const { text: text5, fields: fields2 } = dropRefsIn(fs8.readFileSync(file2, "utf8"), id2);
|
|
22512
|
+
if (!fields2.length) continue;
|
|
22512
22513
|
fs8.writeFileSync(file2, text5);
|
|
22513
|
-
touched.push(`${path9.relative(TODO, file2).split(path9.sep).join("/")} (${
|
|
22514
|
+
touched.push(`${path9.relative(TODO, file2).split(path9.sep).join("/")} (${fields2.join(", ")})`);
|
|
22514
22515
|
}
|
|
22515
22516
|
return touched;
|
|
22516
22517
|
}
|
|
@@ -22534,22 +22535,22 @@ var init_file_limits = __esm({
|
|
|
22534
22535
|
});
|
|
22535
22536
|
|
|
22536
22537
|
// src/lib/shared/board-files.ts
|
|
22537
|
-
function isBoardPath(
|
|
22538
|
-
if (!
|
|
22539
|
-
if (
|
|
22540
|
-
if (
|
|
22541
|
-
if (
|
|
22542
|
-
if (SETTINGS.includes(
|
|
22543
|
-
if (
|
|
22544
|
-
if (
|
|
22545
|
-
return ROOTS.some((root2) =>
|
|
22546
|
-
}
|
|
22547
|
-
function numberOfCard(
|
|
22548
|
-
const n = ROOT.exec(
|
|
22538
|
+
function isBoardPath(path87) {
|
|
22539
|
+
if (!path87 || path87.length > 500 || path87.startsWith("/") || path87.includes("\\") || path87.includes("\0")) return false;
|
|
22540
|
+
if (path87.split("/").some((part) => !part || part === "." || part === "..")) return false;
|
|
22541
|
+
if (path87 === "todo/README.md" || path87.split("/").includes(".sync")) return false;
|
|
22542
|
+
if (path87.startsWith("studios/")) return true;
|
|
22543
|
+
if (SETTINGS.includes(path87)) return true;
|
|
22544
|
+
if (path87.startsWith("rules/")) return isSettingsPath(path87);
|
|
22545
|
+
if (path87.startsWith("assets/")) return taskOfAssets(path87) !== null;
|
|
22546
|
+
return ROOTS.some((root2) => path87.startsWith(root2)) && path87.endsWith(".md");
|
|
22547
|
+
}
|
|
22548
|
+
function numberOfCard(path87) {
|
|
22549
|
+
const n = ROOT.exec(path87)?.[1] ?? CARD.exec(path87)?.[1];
|
|
22549
22550
|
return n ? Number(n) : null;
|
|
22550
22551
|
}
|
|
22551
|
-
function studioRenamed(
|
|
22552
|
-
const to =
|
|
22552
|
+
function studioRenamed(path87, content) {
|
|
22553
|
+
const to = path87.replace(/^(rules\/)?workflows\//, "$1studios/").replace(/^(studios\/[^/]+)\/WORKFLOW\.md$/, "$1/STUDIO.md");
|
|
22553
22554
|
if (!to.endsWith(".md")) return { path: to, content };
|
|
22554
22555
|
if (to.startsWith("studios/")) return { path: to, content: content.replace(/^(icon:\s*["']?)workflow(-kit)?(["']?\s*)$/gm, "$1studio$2$3") };
|
|
22555
22556
|
const front = /^(?:todo|triage)\//.test(to) ? /^---\r?\n[\s\S]*?\r?\n---/.exec(content)?.[0] : void 0;
|
|
@@ -22565,10 +22566,10 @@ var init_board_files = __esm({
|
|
|
22565
22566
|
init_file_limits();
|
|
22566
22567
|
ROOTS = ["todo/", ".archive/", "memory/", "studios/", "triage/", "assets/", "rules/"];
|
|
22567
22568
|
SETTINGS = ["modules.md", "config.md"];
|
|
22568
|
-
isSettingsPath = (
|
|
22569
|
+
isSettingsPath = (path87) => SETTINGS.includes(path87) || /^rules\/(?:studios\/[^/]+|proposer|project-writer|dismissal-reviewer|memory-pruner)\.md$/.test(path87);
|
|
22569
22570
|
CARD = /^(?:todo|\.archive)\/(?:[^/]+\/)*(\d+)-[^/]*\.md$/;
|
|
22570
22571
|
ROOT = /^(?:todo|\.archive)\/(?:[^/]+\/)*(\d+)-[^/]+\/root\.md$/;
|
|
22571
|
-
taskOfAssets = (
|
|
22572
|
+
taskOfAssets = (path87) => /^assets\/(task_[0-9a-f]+)\.json$/.exec(path87)?.[1] ?? null;
|
|
22572
22573
|
studioFolder = (id2) => id2.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
22573
22574
|
studioName = (id2) => id2.startsWith("wf_builtin_") ? id2.slice("wf_builtin_".length).replace(/_/g, "-") : studioFolder(id2);
|
|
22574
22575
|
}
|
|
@@ -25791,8 +25792,8 @@ var require_utils = __commonJS({
|
|
|
25791
25792
|
}
|
|
25792
25793
|
return ind;
|
|
25793
25794
|
}
|
|
25794
|
-
function removeDotSegments(
|
|
25795
|
-
let input2 =
|
|
25795
|
+
function removeDotSegments(path87) {
|
|
25796
|
+
let input2 = path87;
|
|
25796
25797
|
const output2 = [];
|
|
25797
25798
|
let nextSlash = -1;
|
|
25798
25799
|
let len = 0;
|
|
@@ -25866,11 +25867,11 @@ var require_utils = __commonJS({
|
|
|
25866
25867
|
}
|
|
25867
25868
|
return output2.join("");
|
|
25868
25869
|
}
|
|
25869
|
-
function removeDotSegmentsRelative(
|
|
25870
|
-
if (
|
|
25871
|
-
return removeDotSegments(
|
|
25870
|
+
function removeDotSegmentsRelative(path87) {
|
|
25871
|
+
if (path87 === "" || path87[0] === "/") {
|
|
25872
|
+
return removeDotSegments(path87);
|
|
25872
25873
|
}
|
|
25873
|
-
const segments =
|
|
25874
|
+
const segments = path87.split("/");
|
|
25874
25875
|
const last = segments.length - 1;
|
|
25875
25876
|
const output2 = [];
|
|
25876
25877
|
let trailingDirectory = false;
|
|
@@ -26233,8 +26234,8 @@ var require_schemes = __commonJS({
|
|
|
26233
26234
|
}
|
|
26234
26235
|
if (wsComponent.resourceName) {
|
|
26235
26236
|
const queryIndex = wsComponent.resourceName.indexOf("?");
|
|
26236
|
-
const
|
|
26237
|
-
wsComponent.path =
|
|
26237
|
+
const path87 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
|
|
26238
|
+
wsComponent.path = path87 && path87 !== "/" ? path87 : void 0;
|
|
26238
26239
|
wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
|
|
26239
26240
|
wsComponent.resourceName = void 0;
|
|
26240
26241
|
}
|
|
@@ -29394,17 +29395,17 @@ var require_visit = __commonJS({
|
|
|
29394
29395
|
visit2.BREAK = BREAK;
|
|
29395
29396
|
visit2.SKIP = SKIP;
|
|
29396
29397
|
visit2.REMOVE = REMOVE;
|
|
29397
|
-
function visit_(key, node2, visitor,
|
|
29398
|
-
const ctrl = callVisitor(key, node2, visitor,
|
|
29398
|
+
function visit_(key, node2, visitor, path87) {
|
|
29399
|
+
const ctrl = callVisitor(key, node2, visitor, path87);
|
|
29399
29400
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
29400
|
-
replaceNode(key,
|
|
29401
|
-
return visit_(key, ctrl, visitor,
|
|
29401
|
+
replaceNode(key, path87, ctrl);
|
|
29402
|
+
return visit_(key, ctrl, visitor, path87);
|
|
29402
29403
|
}
|
|
29403
29404
|
if (typeof ctrl !== "symbol") {
|
|
29404
29405
|
if (identity.isCollection(node2)) {
|
|
29405
|
-
|
|
29406
|
+
path87 = Object.freeze(path87.concat(node2));
|
|
29406
29407
|
for (let i = 0; i < node2.items.length; ++i) {
|
|
29407
|
-
const ci = visit_(i, node2.items[i], visitor,
|
|
29408
|
+
const ci = visit_(i, node2.items[i], visitor, path87);
|
|
29408
29409
|
if (typeof ci === "number")
|
|
29409
29410
|
i = ci - 1;
|
|
29410
29411
|
else if (ci === BREAK)
|
|
@@ -29415,13 +29416,13 @@ var require_visit = __commonJS({
|
|
|
29415
29416
|
}
|
|
29416
29417
|
}
|
|
29417
29418
|
} else if (identity.isPair(node2)) {
|
|
29418
|
-
|
|
29419
|
-
const ck = visit_("key", node2.key, visitor,
|
|
29419
|
+
path87 = Object.freeze(path87.concat(node2));
|
|
29420
|
+
const ck = visit_("key", node2.key, visitor, path87);
|
|
29420
29421
|
if (ck === BREAK)
|
|
29421
29422
|
return BREAK;
|
|
29422
29423
|
else if (ck === REMOVE)
|
|
29423
29424
|
node2.key = null;
|
|
29424
|
-
const cv = visit_("value", node2.value, visitor,
|
|
29425
|
+
const cv = visit_("value", node2.value, visitor, path87);
|
|
29425
29426
|
if (cv === BREAK)
|
|
29426
29427
|
return BREAK;
|
|
29427
29428
|
else if (cv === REMOVE)
|
|
@@ -29442,17 +29443,17 @@ var require_visit = __commonJS({
|
|
|
29442
29443
|
visitAsync.BREAK = BREAK;
|
|
29443
29444
|
visitAsync.SKIP = SKIP;
|
|
29444
29445
|
visitAsync.REMOVE = REMOVE;
|
|
29445
|
-
async function visitAsync_(key, node2, visitor,
|
|
29446
|
-
const ctrl = await callVisitor(key, node2, visitor,
|
|
29446
|
+
async function visitAsync_(key, node2, visitor, path87) {
|
|
29447
|
+
const ctrl = await callVisitor(key, node2, visitor, path87);
|
|
29447
29448
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
29448
|
-
replaceNode(key,
|
|
29449
|
-
return visitAsync_(key, ctrl, visitor,
|
|
29449
|
+
replaceNode(key, path87, ctrl);
|
|
29450
|
+
return visitAsync_(key, ctrl, visitor, path87);
|
|
29450
29451
|
}
|
|
29451
29452
|
if (typeof ctrl !== "symbol") {
|
|
29452
29453
|
if (identity.isCollection(node2)) {
|
|
29453
|
-
|
|
29454
|
+
path87 = Object.freeze(path87.concat(node2));
|
|
29454
29455
|
for (let i = 0; i < node2.items.length; ++i) {
|
|
29455
|
-
const ci = await visitAsync_(i, node2.items[i], visitor,
|
|
29456
|
+
const ci = await visitAsync_(i, node2.items[i], visitor, path87);
|
|
29456
29457
|
if (typeof ci === "number")
|
|
29457
29458
|
i = ci - 1;
|
|
29458
29459
|
else if (ci === BREAK)
|
|
@@ -29463,13 +29464,13 @@ var require_visit = __commonJS({
|
|
|
29463
29464
|
}
|
|
29464
29465
|
}
|
|
29465
29466
|
} else if (identity.isPair(node2)) {
|
|
29466
|
-
|
|
29467
|
-
const ck = await visitAsync_("key", node2.key, visitor,
|
|
29467
|
+
path87 = Object.freeze(path87.concat(node2));
|
|
29468
|
+
const ck = await visitAsync_("key", node2.key, visitor, path87);
|
|
29468
29469
|
if (ck === BREAK)
|
|
29469
29470
|
return BREAK;
|
|
29470
29471
|
else if (ck === REMOVE)
|
|
29471
29472
|
node2.key = null;
|
|
29472
|
-
const cv = await visitAsync_("value", node2.value, visitor,
|
|
29473
|
+
const cv = await visitAsync_("value", node2.value, visitor, path87);
|
|
29473
29474
|
if (cv === BREAK)
|
|
29474
29475
|
return BREAK;
|
|
29475
29476
|
else if (cv === REMOVE)
|
|
@@ -29496,23 +29497,23 @@ var require_visit = __commonJS({
|
|
|
29496
29497
|
}
|
|
29497
29498
|
return visitor;
|
|
29498
29499
|
}
|
|
29499
|
-
function callVisitor(key, node2, visitor,
|
|
29500
|
+
function callVisitor(key, node2, visitor, path87) {
|
|
29500
29501
|
if (typeof visitor === "function")
|
|
29501
|
-
return visitor(key, node2,
|
|
29502
|
+
return visitor(key, node2, path87);
|
|
29502
29503
|
if (identity.isMap(node2))
|
|
29503
|
-
return visitor.Map?.(key, node2,
|
|
29504
|
+
return visitor.Map?.(key, node2, path87);
|
|
29504
29505
|
if (identity.isSeq(node2))
|
|
29505
|
-
return visitor.Seq?.(key, node2,
|
|
29506
|
+
return visitor.Seq?.(key, node2, path87);
|
|
29506
29507
|
if (identity.isPair(node2))
|
|
29507
|
-
return visitor.Pair?.(key, node2,
|
|
29508
|
+
return visitor.Pair?.(key, node2, path87);
|
|
29508
29509
|
if (identity.isScalar(node2))
|
|
29509
|
-
return visitor.Scalar?.(key, node2,
|
|
29510
|
+
return visitor.Scalar?.(key, node2, path87);
|
|
29510
29511
|
if (identity.isAlias(node2))
|
|
29511
|
-
return visitor.Alias?.(key, node2,
|
|
29512
|
+
return visitor.Alias?.(key, node2, path87);
|
|
29512
29513
|
return void 0;
|
|
29513
29514
|
}
|
|
29514
|
-
function replaceNode(key,
|
|
29515
|
-
const parent =
|
|
29515
|
+
function replaceNode(key, path87, node2) {
|
|
29516
|
+
const parent = path87[path87.length - 1];
|
|
29516
29517
|
if (identity.isCollection(parent)) {
|
|
29517
29518
|
parent.items[key] = node2;
|
|
29518
29519
|
} else if (identity.isPair(parent)) {
|
|
@@ -30124,10 +30125,10 @@ var require_Collection = __commonJS({
|
|
|
30124
30125
|
var createNode = require_createNode();
|
|
30125
30126
|
var identity = require_identity();
|
|
30126
30127
|
var Node = require_Node();
|
|
30127
|
-
function collectionFromPath(schema,
|
|
30128
|
+
function collectionFromPath(schema, path87, value) {
|
|
30128
30129
|
let v = value;
|
|
30129
|
-
for (let i =
|
|
30130
|
-
const k =
|
|
30130
|
+
for (let i = path87.length - 1; i >= 0; --i) {
|
|
30131
|
+
const k = path87[i];
|
|
30131
30132
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
30132
30133
|
const a = [];
|
|
30133
30134
|
a[k] = v;
|
|
@@ -30146,7 +30147,7 @@ var require_Collection = __commonJS({
|
|
|
30146
30147
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
30147
30148
|
});
|
|
30148
30149
|
}
|
|
30149
|
-
var isEmptyPath = (
|
|
30150
|
+
var isEmptyPath = (path87) => path87 == null || typeof path87 === "object" && !!path87[Symbol.iterator]().next().done;
|
|
30150
30151
|
var Collection = class extends Node.NodeBase {
|
|
30151
30152
|
constructor(type, schema) {
|
|
30152
30153
|
super(type);
|
|
@@ -30176,11 +30177,11 @@ var require_Collection = __commonJS({
|
|
|
30176
30177
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
30177
30178
|
* that already exists in the map.
|
|
30178
30179
|
*/
|
|
30179
|
-
addIn(
|
|
30180
|
-
if (isEmptyPath(
|
|
30180
|
+
addIn(path87, value) {
|
|
30181
|
+
if (isEmptyPath(path87))
|
|
30181
30182
|
this.add(value);
|
|
30182
30183
|
else {
|
|
30183
|
-
const [key, ...rest] =
|
|
30184
|
+
const [key, ...rest] = path87;
|
|
30184
30185
|
const node2 = this.get(key, true);
|
|
30185
30186
|
if (identity.isCollection(node2))
|
|
30186
30187
|
node2.addIn(rest, value);
|
|
@@ -30194,8 +30195,8 @@ var require_Collection = __commonJS({
|
|
|
30194
30195
|
* Removes a value from the collection.
|
|
30195
30196
|
* @returns `true` if the item was found and removed.
|
|
30196
30197
|
*/
|
|
30197
|
-
deleteIn(
|
|
30198
|
-
const [key, ...rest] =
|
|
30198
|
+
deleteIn(path87) {
|
|
30199
|
+
const [key, ...rest] = path87;
|
|
30199
30200
|
if (rest.length === 0)
|
|
30200
30201
|
return this.delete(key);
|
|
30201
30202
|
const node2 = this.get(key, true);
|
|
@@ -30209,8 +30210,8 @@ var require_Collection = __commonJS({
|
|
|
30209
30210
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
30210
30211
|
* `true` (collections are always returned intact).
|
|
30211
30212
|
*/
|
|
30212
|
-
getIn(
|
|
30213
|
-
const [key, ...rest] =
|
|
30213
|
+
getIn(path87, keepScalar) {
|
|
30214
|
+
const [key, ...rest] = path87;
|
|
30214
30215
|
const node2 = this.get(key, true);
|
|
30215
30216
|
if (rest.length === 0)
|
|
30216
30217
|
return !keepScalar && identity.isScalar(node2) ? node2.value : node2;
|
|
@@ -30228,8 +30229,8 @@ var require_Collection = __commonJS({
|
|
|
30228
30229
|
/**
|
|
30229
30230
|
* Checks if the collection includes a value with the key `key`.
|
|
30230
30231
|
*/
|
|
30231
|
-
hasIn(
|
|
30232
|
-
const [key, ...rest] =
|
|
30232
|
+
hasIn(path87) {
|
|
30233
|
+
const [key, ...rest] = path87;
|
|
30233
30234
|
if (rest.length === 0)
|
|
30234
30235
|
return this.has(key);
|
|
30235
30236
|
const node2 = this.get(key, true);
|
|
@@ -30239,8 +30240,8 @@ var require_Collection = __commonJS({
|
|
|
30239
30240
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
30240
30241
|
* boolean to add/remove the item from the set.
|
|
30241
30242
|
*/
|
|
30242
|
-
setIn(
|
|
30243
|
-
const [key, ...rest] =
|
|
30243
|
+
setIn(path87, value) {
|
|
30244
|
+
const [key, ...rest] = path87;
|
|
30244
30245
|
if (rest.length === 0) {
|
|
30245
30246
|
this.set(key, value);
|
|
30246
30247
|
} else {
|
|
@@ -32755,9 +32756,9 @@ var require_Document = __commonJS({
|
|
|
32755
32756
|
this.contents.add(value);
|
|
32756
32757
|
}
|
|
32757
32758
|
/** Adds a value to the document. */
|
|
32758
|
-
addIn(
|
|
32759
|
+
addIn(path87, value) {
|
|
32759
32760
|
if (assertCollection(this.contents))
|
|
32760
|
-
this.contents.addIn(
|
|
32761
|
+
this.contents.addIn(path87, value);
|
|
32761
32762
|
}
|
|
32762
32763
|
/**
|
|
32763
32764
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -32832,14 +32833,14 @@ var require_Document = __commonJS({
|
|
|
32832
32833
|
* Removes a value from the document.
|
|
32833
32834
|
* @returns `true` if the item was found and removed.
|
|
32834
32835
|
*/
|
|
32835
|
-
deleteIn(
|
|
32836
|
-
if (Collection.isEmptyPath(
|
|
32836
|
+
deleteIn(path87) {
|
|
32837
|
+
if (Collection.isEmptyPath(path87)) {
|
|
32837
32838
|
if (this.contents == null)
|
|
32838
32839
|
return false;
|
|
32839
32840
|
this.contents = null;
|
|
32840
32841
|
return true;
|
|
32841
32842
|
}
|
|
32842
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
32843
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path87) : false;
|
|
32843
32844
|
}
|
|
32844
32845
|
/**
|
|
32845
32846
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -32854,10 +32855,10 @@ var require_Document = __commonJS({
|
|
|
32854
32855
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
32855
32856
|
* `true` (collections are always returned intact).
|
|
32856
32857
|
*/
|
|
32857
|
-
getIn(
|
|
32858
|
-
if (Collection.isEmptyPath(
|
|
32858
|
+
getIn(path87, keepScalar) {
|
|
32859
|
+
if (Collection.isEmptyPath(path87))
|
|
32859
32860
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
32860
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
32861
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path87, keepScalar) : void 0;
|
|
32861
32862
|
}
|
|
32862
32863
|
/**
|
|
32863
32864
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -32868,10 +32869,10 @@ var require_Document = __commonJS({
|
|
|
32868
32869
|
/**
|
|
32869
32870
|
* Checks if the document includes a value at `path`.
|
|
32870
32871
|
*/
|
|
32871
|
-
hasIn(
|
|
32872
|
-
if (Collection.isEmptyPath(
|
|
32872
|
+
hasIn(path87) {
|
|
32873
|
+
if (Collection.isEmptyPath(path87))
|
|
32873
32874
|
return this.contents !== void 0;
|
|
32874
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
32875
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path87) : false;
|
|
32875
32876
|
}
|
|
32876
32877
|
/**
|
|
32877
32878
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -32888,13 +32889,13 @@ var require_Document = __commonJS({
|
|
|
32888
32889
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
32889
32890
|
* boolean to add/remove the item from the set.
|
|
32890
32891
|
*/
|
|
32891
|
-
setIn(
|
|
32892
|
-
if (Collection.isEmptyPath(
|
|
32892
|
+
setIn(path87, value) {
|
|
32893
|
+
if (Collection.isEmptyPath(path87)) {
|
|
32893
32894
|
this.contents = value;
|
|
32894
32895
|
} else if (this.contents == null) {
|
|
32895
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
32896
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path87), value);
|
|
32896
32897
|
} else if (assertCollection(this.contents)) {
|
|
32897
|
-
this.contents.setIn(
|
|
32898
|
+
this.contents.setIn(path87, value);
|
|
32898
32899
|
}
|
|
32899
32900
|
}
|
|
32900
32901
|
/**
|
|
@@ -34855,9 +34856,9 @@ var require_cst_visit = __commonJS({
|
|
|
34855
34856
|
visit2.BREAK = BREAK;
|
|
34856
34857
|
visit2.SKIP = SKIP;
|
|
34857
34858
|
visit2.REMOVE = REMOVE;
|
|
34858
|
-
visit2.itemAtPath = (cst,
|
|
34859
|
+
visit2.itemAtPath = (cst, path87) => {
|
|
34859
34860
|
let item = cst;
|
|
34860
|
-
for (const [field2, index] of
|
|
34861
|
+
for (const [field2, index] of path87) {
|
|
34861
34862
|
const tok = item?.[field2];
|
|
34862
34863
|
if (tok && "items" in tok) {
|
|
34863
34864
|
item = tok.items[index];
|
|
@@ -34866,23 +34867,23 @@ var require_cst_visit = __commonJS({
|
|
|
34866
34867
|
}
|
|
34867
34868
|
return item;
|
|
34868
34869
|
};
|
|
34869
|
-
visit2.parentCollection = (cst,
|
|
34870
|
-
const parent = visit2.itemAtPath(cst,
|
|
34871
|
-
const field2 =
|
|
34870
|
+
visit2.parentCollection = (cst, path87) => {
|
|
34871
|
+
const parent = visit2.itemAtPath(cst, path87.slice(0, -1));
|
|
34872
|
+
const field2 = path87[path87.length - 1][0];
|
|
34872
34873
|
const coll = parent?.[field2];
|
|
34873
34874
|
if (coll && "items" in coll)
|
|
34874
34875
|
return coll;
|
|
34875
34876
|
throw new Error("Parent collection not found");
|
|
34876
34877
|
};
|
|
34877
|
-
function _visit(
|
|
34878
|
-
let ctrl = visitor(item,
|
|
34878
|
+
function _visit(path87, item, visitor) {
|
|
34879
|
+
let ctrl = visitor(item, path87);
|
|
34879
34880
|
if (typeof ctrl === "symbol")
|
|
34880
34881
|
return ctrl;
|
|
34881
34882
|
for (const field2 of ["key", "value"]) {
|
|
34882
34883
|
const token2 = item[field2];
|
|
34883
34884
|
if (token2 && "items" in token2) {
|
|
34884
34885
|
for (let i = 0; i < token2.items.length; ++i) {
|
|
34885
|
-
const ci = _visit(Object.freeze(
|
|
34886
|
+
const ci = _visit(Object.freeze(path87.concat([[field2, i]])), token2.items[i], visitor);
|
|
34886
34887
|
if (typeof ci === "number")
|
|
34887
34888
|
i = ci - 1;
|
|
34888
34889
|
else if (ci === BREAK)
|
|
@@ -34893,10 +34894,10 @@ var require_cst_visit = __commonJS({
|
|
|
34893
34894
|
}
|
|
34894
34895
|
}
|
|
34895
34896
|
if (typeof ctrl === "function" && field2 === "key")
|
|
34896
|
-
ctrl = ctrl(item,
|
|
34897
|
+
ctrl = ctrl(item, path87);
|
|
34897
34898
|
}
|
|
34898
34899
|
}
|
|
34899
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
34900
|
+
return typeof ctrl === "function" ? ctrl(item, path87) : ctrl;
|
|
34900
34901
|
}
|
|
34901
34902
|
exports.visit = visit2;
|
|
34902
34903
|
}
|
|
@@ -36812,7 +36813,7 @@ var init_preview_blocks = __esm({
|
|
|
36812
36813
|
// src/lib/agent/studio-def.ts
|
|
36813
36814
|
function parseStudioFile(id2, source2, from, requirePreviewCopy = false) {
|
|
36814
36815
|
const problems = [];
|
|
36815
|
-
const fail = (offset,
|
|
36816
|
+
const fail = (offset, path87, code, message, hint2) => problems.push({ file: from, ...sourcePosition(source2, offset), path: path87, code, message, hint: hint2 });
|
|
36816
36817
|
const result = () => ({ problem: problems.map((p) => `${p.file}:${p.line}:${p.column} ${p.path}: ${p.code} \u2014 ${p.message}. ${p.hint}`).join("\n"), problems });
|
|
36817
36818
|
if (!STUDIO_ID.test(id2)) fail(0, "id", "studio-schema", `Invalid Studio ID ${id2}`, "Use lowercase letters, digits and dashes.");
|
|
36818
36819
|
const front = /^---\r?\n([^]*?)\r?\n---(?:\r?\n|$)/.exec(source2);
|
|
@@ -38956,7 +38957,7 @@ var require_command = __commonJS({
|
|
|
38956
38957
|
"node_modules/commander/lib/command.js"(exports) {
|
|
38957
38958
|
var EventEmitter = __require("node:events").EventEmitter;
|
|
38958
38959
|
var childProcess = __require("node:child_process");
|
|
38959
|
-
var
|
|
38960
|
+
var path87 = __require("node:path");
|
|
38960
38961
|
var fs88 = __require("node:fs");
|
|
38961
38962
|
var process2 = __require("node:process");
|
|
38962
38963
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
@@ -39956,9 +39957,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
39956
39957
|
let launchWithNode = false;
|
|
39957
39958
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
39958
39959
|
function findFile(baseDir, baseName) {
|
|
39959
|
-
const localBin =
|
|
39960
|
+
const localBin = path87.resolve(baseDir, baseName);
|
|
39960
39961
|
if (fs88.existsSync(localBin)) return localBin;
|
|
39961
|
-
if (sourceExt.includes(
|
|
39962
|
+
if (sourceExt.includes(path87.extname(baseName))) return void 0;
|
|
39962
39963
|
const foundExt = sourceExt.find(
|
|
39963
39964
|
(ext) => fs88.existsSync(`${localBin}${ext}`)
|
|
39964
39965
|
);
|
|
@@ -39976,17 +39977,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
39976
39977
|
} catch {
|
|
39977
39978
|
resolvedScriptPath = this._scriptPath;
|
|
39978
39979
|
}
|
|
39979
|
-
executableDir =
|
|
39980
|
-
|
|
39980
|
+
executableDir = path87.resolve(
|
|
39981
|
+
path87.dirname(resolvedScriptPath),
|
|
39981
39982
|
executableDir
|
|
39982
39983
|
);
|
|
39983
39984
|
}
|
|
39984
39985
|
if (executableDir) {
|
|
39985
39986
|
let localFile = findFile(executableDir, executableFile);
|
|
39986
39987
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
39987
|
-
const legacyName =
|
|
39988
|
+
const legacyName = path87.basename(
|
|
39988
39989
|
this._scriptPath,
|
|
39989
|
-
|
|
39990
|
+
path87.extname(this._scriptPath)
|
|
39990
39991
|
);
|
|
39991
39992
|
if (legacyName !== this._name) {
|
|
39992
39993
|
localFile = findFile(
|
|
@@ -39997,7 +39998,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
39997
39998
|
}
|
|
39998
39999
|
executableFile = localFile || executableFile;
|
|
39999
40000
|
}
|
|
40000
|
-
launchWithNode = sourceExt.includes(
|
|
40001
|
+
launchWithNode = sourceExt.includes(path87.extname(executableFile));
|
|
40001
40002
|
let proc;
|
|
40002
40003
|
if (process2.platform !== "win32") {
|
|
40003
40004
|
if (launchWithNode) {
|
|
@@ -40844,7 +40845,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
40844
40845
|
* @return {Command}
|
|
40845
40846
|
*/
|
|
40846
40847
|
nameFromFilename(filename) {
|
|
40847
|
-
this._name =
|
|
40848
|
+
this._name = path87.basename(filename, path87.extname(filename));
|
|
40848
40849
|
return this;
|
|
40849
40850
|
}
|
|
40850
40851
|
/**
|
|
@@ -40858,9 +40859,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
40858
40859
|
* @param {string} [path]
|
|
40859
40860
|
* @return {(string|null|Command)}
|
|
40860
40861
|
*/
|
|
40861
|
-
executableDir(
|
|
40862
|
-
if (
|
|
40863
|
-
this._executableDir =
|
|
40862
|
+
executableDir(path88) {
|
|
40863
|
+
if (path88 === void 0) return this._executableDir;
|
|
40864
|
+
this._executableDir = path88;
|
|
40864
40865
|
return this;
|
|
40865
40866
|
}
|
|
40866
40867
|
/**
|
|
@@ -41815,8 +41816,8 @@ var init_package = __esm({
|
|
|
41815
41816
|
"package.json"() {
|
|
41816
41817
|
package_default = {
|
|
41817
41818
|
name: "wildcrane",
|
|
41818
|
-
version: "0.11.
|
|
41819
|
-
akbContract:
|
|
41819
|
+
version: "0.11.77",
|
|
41820
|
+
akbContract: 24,
|
|
41820
41821
|
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.",
|
|
41821
41822
|
keywords: [
|
|
41822
41823
|
"kanban",
|
|
@@ -42084,7 +42085,7 @@ function operatingSystem() {
|
|
|
42084
42085
|
const named2 = { darwin: "macos", win32: "windows", linux: "linux" };
|
|
42085
42086
|
return named2[process.platform] ?? (token(process.platform) ?? "other");
|
|
42086
42087
|
}
|
|
42087
|
-
function reportUsage(name,
|
|
42088
|
+
function reportUsage(name, fields2 = {}, surface = usageSurface()) {
|
|
42088
42089
|
try {
|
|
42089
42090
|
if (doNotTrack()) return;
|
|
42090
42091
|
const held4 = readUsageReporting();
|
|
@@ -42098,7 +42099,7 @@ function reportUsage(name, fields = {}, surface = usageSurface()) {
|
|
|
42098
42099
|
append({ name: "app_day", day, id: randomUUID3(), surface, version: SKILL_VERSION });
|
|
42099
42100
|
writeState({ ...state, dayEvent: day });
|
|
42100
42101
|
}
|
|
42101
|
-
append({ name, day, id: randomUUID3(), surface, version: SKILL_VERSION, ...
|
|
42102
|
+
append({ name, day, id: randomUUID3(), surface, version: SKILL_VERSION, ...fields2 });
|
|
42102
42103
|
} catch {
|
|
42103
42104
|
return;
|
|
42104
42105
|
}
|
|
@@ -42131,15 +42132,15 @@ function reportRun(what, harness, customAgent, end2) {
|
|
|
42131
42132
|
});
|
|
42132
42133
|
}
|
|
42133
42134
|
function endFields({ model, costUsd, ownEndpoint }) {
|
|
42134
|
-
const
|
|
42135
|
+
const fields2 = {};
|
|
42135
42136
|
if (model?.trim()) {
|
|
42136
42137
|
const named2 = TOKEN.test(model.trim()) ? model.trim() : void 0;
|
|
42137
|
-
|
|
42138
|
+
fields2.model = named2 && !ownEndpoint && inCatalog(named2) ? named2 : "custom";
|
|
42138
42139
|
}
|
|
42139
42140
|
if (typeof costUsd === "number" && Number.isFinite(costUsd) && costUsd >= 0) {
|
|
42140
|
-
|
|
42141
|
+
fields2.cost_micros = Math.round(costUsd * 1e6);
|
|
42141
42142
|
}
|
|
42142
|
-
return
|
|
42143
|
+
return fields2;
|
|
42143
42144
|
}
|
|
42144
42145
|
function readBoard() {
|
|
42145
42146
|
try {
|
|
@@ -42172,22 +42173,22 @@ function reportBoardNumbers(customAgentsOn2) {
|
|
|
42172
42173
|
const held4 = readBoard();
|
|
42173
42174
|
const day = usageDay();
|
|
42174
42175
|
if (held4.day === day) return;
|
|
42175
|
-
const
|
|
42176
|
+
const fields2 = {};
|
|
42176
42177
|
for (const name of BOARD_COUNTS) {
|
|
42177
42178
|
const n = countOf(held4.counts, name);
|
|
42178
|
-
if (n)
|
|
42179
|
+
if (n) fields2[name] = n;
|
|
42179
42180
|
}
|
|
42180
42181
|
const sum = (...names2) => names2.reduce((total, name) => total + countOf(held4.counts, name), 0);
|
|
42181
42182
|
const created = sum("cards_created_asked", "cards_created_proposed");
|
|
42182
|
-
if (created)
|
|
42183
|
+
if (created) fields2.cards_created = created;
|
|
42183
42184
|
const closed2 = sum("questions_closed_board", "questions_closed_user", "questions_closed_verify");
|
|
42184
|
-
if (closed2)
|
|
42185
|
+
if (closed2) fields2.questions_closed = closed2;
|
|
42185
42186
|
const on = customAgentsOn2();
|
|
42186
|
-
if (on > 0)
|
|
42187
|
-
if (!Object.keys(
|
|
42187
|
+
if (on > 0) fields2.custom_agents_on = on;
|
|
42188
|
+
if (!Object.keys(fields2).length) return;
|
|
42188
42189
|
const id2 = typeof held4.id === "string" && held4.id ? held4.id : randomUUID3();
|
|
42189
42190
|
writeBoard({ id: id2, day });
|
|
42190
|
-
reportUsage("board_numbers", { board: id2, ...
|
|
42191
|
+
reportUsage("board_numbers", { board: id2, ...fields2 });
|
|
42191
42192
|
} catch {
|
|
42192
42193
|
return;
|
|
42193
42194
|
}
|
|
@@ -42857,6 +42858,8 @@ var init_prices = __esm({
|
|
|
42857
42858
|
"src/lib/agent/prices.ts"() {
|
|
42858
42859
|
"use strict";
|
|
42859
42860
|
OPENAI = {
|
|
42861
|
+
"gpt-6.2-astra": { input: 8, cachedInput: 0.4, output: 40 },
|
|
42862
|
+
"gpt-6.2-sol": { input: 2, cachedInput: 0.1, output: 10 },
|
|
42860
42863
|
"gpt-6.1-sol": { input: 2, cachedInput: 0.1, output: 10 },
|
|
42861
42864
|
"gpt-6-astra": { input: 10, cachedInput: 1, output: 50 },
|
|
42862
42865
|
"gpt-6-sol": { input: 2, cachedInput: 0.2, output: 10 },
|
|
@@ -43136,6 +43139,93 @@ var init_stream = __esm({
|
|
|
43136
43139
|
}
|
|
43137
43140
|
});
|
|
43138
43141
|
|
|
43142
|
+
// src/lib/agent/wire/antigravity-session.ts
|
|
43143
|
+
import { existsSync } from "node:fs";
|
|
43144
|
+
function antigravityConversationFile(session) {
|
|
43145
|
+
if (/^[a-f0-9-]{36}$/i.test(session)) return home(".gemini", "antigravity-cli", "conversations", `${session}.db`);
|
|
43146
|
+
}
|
|
43147
|
+
function varint(bytes2, offset) {
|
|
43148
|
+
let value = 0;
|
|
43149
|
+
for (let shift = 0; shift < 70 && offset.value < bytes2.length; shift += 7) {
|
|
43150
|
+
const byte = bytes2[offset.value++];
|
|
43151
|
+
value += (byte & 127) * 2 ** shift;
|
|
43152
|
+
if (byte < 128) return value;
|
|
43153
|
+
}
|
|
43154
|
+
throw new Error("Invalid Antigravity conversation metadata");
|
|
43155
|
+
}
|
|
43156
|
+
function* fields(bytes2) {
|
|
43157
|
+
const offset = { value: 0 };
|
|
43158
|
+
while (offset.value < bytes2.length) {
|
|
43159
|
+
const tag = varint(bytes2, offset);
|
|
43160
|
+
const number4 = Math.floor(tag / 8);
|
|
43161
|
+
const wire = tag % 8;
|
|
43162
|
+
if (number4 < 1 || number4 >= 2 ** 29) throw new Error("Invalid Antigravity conversation metadata");
|
|
43163
|
+
if (wire === 0) {
|
|
43164
|
+
yield [number4, varint(bytes2, offset)];
|
|
43165
|
+
continue;
|
|
43166
|
+
}
|
|
43167
|
+
const size = wire === 2 ? varint(bytes2, offset) : wire === 1 ? 8 : wire === 5 ? 4 : -1;
|
|
43168
|
+
const end2 = offset.value + size;
|
|
43169
|
+
if (size < 0 || end2 > bytes2.length) throw new Error("Invalid Antigravity conversation metadata");
|
|
43170
|
+
if (wire === 2) yield [number4, bytes2.subarray(offset.value, end2)];
|
|
43171
|
+
offset.value = end2;
|
|
43172
|
+
}
|
|
43173
|
+
}
|
|
43174
|
+
function bytesField(data, field2) {
|
|
43175
|
+
if (!(data instanceof Uint8Array)) return;
|
|
43176
|
+
for (const [number4, value] of fields(data)) {
|
|
43177
|
+
if (number4 === field2 && value instanceof Uint8Array) return value;
|
|
43178
|
+
}
|
|
43179
|
+
}
|
|
43180
|
+
function antigravityRecordedModels(session, steps) {
|
|
43181
|
+
const found2 = /* @__PURE__ */ new Map();
|
|
43182
|
+
const file2 = antigravityConversationFile(session);
|
|
43183
|
+
if (!file2 || !existsSync(file2)) return found2;
|
|
43184
|
+
try {
|
|
43185
|
+
const sqlite = process.getBuiltinModule?.("node:sqlite");
|
|
43186
|
+
if (!sqlite) return found2;
|
|
43187
|
+
const db = new sqlite.DatabaseSync(file2, { readOnly: true });
|
|
43188
|
+
try {
|
|
43189
|
+
const prompt = db.prepare("SELECT metadata FROM steps WHERE idx = ?");
|
|
43190
|
+
const generations = db.prepare("SELECT data FROM gen_metadata WHERE instr(data, ?) > 0");
|
|
43191
|
+
for (const index of new Set([...steps.values()].map((step) => step.prompt))) {
|
|
43192
|
+
const id2 = bytesField(prompt.get(index)?.metadata, 12);
|
|
43193
|
+
if (id2?.length !== 36) continue;
|
|
43194
|
+
const key = Buffer.concat([Buffer.from([34, 36]), id2]);
|
|
43195
|
+
for (const { data } of generations.iterate(key)) {
|
|
43196
|
+
if (!(data instanceof Uint8Array) || utf8(bytesField(data, 4)) !== utf8(id2)) continue;
|
|
43197
|
+
const model = utf8(bytesField(bytesField(data, 1), 19)) || void 0;
|
|
43198
|
+
const record2 = (step) => {
|
|
43199
|
+
if (steps.get(step)?.prompt !== index) return;
|
|
43200
|
+
found2.set(step, found2.has(step) && found2.get(step) !== model ? void 0 : model);
|
|
43201
|
+
};
|
|
43202
|
+
for (const [field2, value] of fields(data)) {
|
|
43203
|
+
if (field2 !== 2) continue;
|
|
43204
|
+
if (typeof value === "number") record2(value);
|
|
43205
|
+
else {
|
|
43206
|
+
const offset = { value: 0 };
|
|
43207
|
+
while (offset.value < value.length) record2(varint(value, offset));
|
|
43208
|
+
}
|
|
43209
|
+
}
|
|
43210
|
+
}
|
|
43211
|
+
}
|
|
43212
|
+
} finally {
|
|
43213
|
+
db.close();
|
|
43214
|
+
}
|
|
43215
|
+
return found2;
|
|
43216
|
+
} catch {
|
|
43217
|
+
return /* @__PURE__ */ new Map();
|
|
43218
|
+
}
|
|
43219
|
+
}
|
|
43220
|
+
var utf8;
|
|
43221
|
+
var init_antigravity_session = __esm({
|
|
43222
|
+
"src/lib/agent/wire/antigravity-session.ts"() {
|
|
43223
|
+
"use strict";
|
|
43224
|
+
init_models();
|
|
43225
|
+
utf8 = (bytes2) => bytes2 && Buffer.from(bytes2).toString("utf8");
|
|
43226
|
+
}
|
|
43227
|
+
});
|
|
43228
|
+
|
|
43139
43229
|
// src/lib/agent/wire/antigravity.ts
|
|
43140
43230
|
import path29 from "node:path";
|
|
43141
43231
|
function failureHint(reason) {
|
|
@@ -43165,15 +43255,22 @@ function createAntigravityRenderer(expectedSession, cwd = process.cwd()) {
|
|
|
43165
43255
|
let cost;
|
|
43166
43256
|
let incomplete = false;
|
|
43167
43257
|
const priced = /* @__PURE__ */ new Set();
|
|
43258
|
+
let prompt = -1;
|
|
43259
|
+
const pendingCosts = /* @__PURE__ */ new Map();
|
|
43260
|
+
const estimate = (id2, usage3) => {
|
|
43261
|
+
const usd = priceUsd("antigravity", id2, usage3, started);
|
|
43262
|
+
if (usd === void 0) incomplete = true;
|
|
43263
|
+
else cost = (cost ?? 0) + usd;
|
|
43264
|
+
};
|
|
43168
43265
|
const countCost = (step) => {
|
|
43169
43266
|
const index = step.step_index;
|
|
43170
|
-
if (typeof index !== "number" || !Number.isSafeInteger(index) || index < 0 || priced.has(index)) return;
|
|
43267
|
+
if (typeof index !== "number" || !Number.isSafeInteger(index) || index < 0 || priced.has(index) || !model && index <= prompt) return;
|
|
43171
43268
|
priced.add(index);
|
|
43172
43269
|
const u = obj2(step.usage);
|
|
43173
43270
|
const valid = [u.input_tokens, u.output_tokens, u.cache_read_tokens].every((n) => typeof n === "number" && Number.isFinite(n) && n >= 0);
|
|
43174
|
-
|
|
43175
|
-
if (
|
|
43176
|
-
else
|
|
43271
|
+
if (!valid || !model && prompt < 0) incomplete = true;
|
|
43272
|
+
else if (model) estimate(model, usageOf(u));
|
|
43273
|
+
else pendingCosts.set(index, { prompt, usage: usageOf(u) });
|
|
43177
43274
|
};
|
|
43178
43275
|
let used;
|
|
43179
43276
|
let turnUsage = zero();
|
|
@@ -43206,9 +43303,11 @@ function createAntigravityRenderer(expectedSession, cwd = process.cwd()) {
|
|
|
43206
43303
|
}
|
|
43207
43304
|
if (e.event === "step_update") {
|
|
43208
43305
|
const step = obj2(e.step_update);
|
|
43209
|
-
|
|
43210
|
-
session
|
|
43306
|
+
const got = str2(step.conversation_id);
|
|
43307
|
+
if (expectedSession && got !== expectedSession || session && got && got !== session) return "";
|
|
43308
|
+
session = got || session;
|
|
43211
43309
|
const id2 = String(step.step_index ?? "");
|
|
43310
|
+
if (step.state === "DONE" && step.step_type === "user_input" && typeof step.step_index === "number" && Number.isSafeInteger(step.step_index) && step.step_index > prompt) prompt = step.step_index;
|
|
43212
43311
|
if (step.state === "DONE" && ["agent_response", "checkpoint"].includes(str2(step.step_type))) countCost(step);
|
|
43213
43312
|
if (step.step_type === "agent_response") {
|
|
43214
43313
|
const text5 = str2(step.text_delta);
|
|
@@ -43219,8 +43318,8 @@ function createAntigravityRenderer(expectedSession, cwd = process.cwd()) {
|
|
|
43219
43318
|
contextStep = index;
|
|
43220
43319
|
const u = obj2(step.usage);
|
|
43221
43320
|
const counts = [u.input_tokens, u.cache_read_tokens];
|
|
43222
|
-
const
|
|
43223
|
-
context =
|
|
43321
|
+
const prompt2 = counts.every((n) => typeof n === "number" && Number.isFinite(n) && n >= 0) ? num2(u.input_tokens) + num2(u.cache_read_tokens) : 0;
|
|
43322
|
+
context = prompt2 > 0 && Number.isFinite(prompt2) ? { used: prompt2 } : void 0;
|
|
43224
43323
|
}
|
|
43225
43324
|
if (step.state === "DONE" && step.usage && !counted.has(index)) {
|
|
43226
43325
|
counted.add(index);
|
|
@@ -43272,7 +43371,7 @@ ${imageError(target, reason || str2(step.state))}
|
|
|
43272
43371
|
terminal = true;
|
|
43273
43372
|
return "";
|
|
43274
43373
|
}
|
|
43275
|
-
session
|
|
43374
|
+
session ||= str2(result.conversation_id) || void 0;
|
|
43276
43375
|
terminal = true;
|
|
43277
43376
|
final = typeof result.response === "string" ? result.response : void 0;
|
|
43278
43377
|
const total = usageOf(result.usage);
|
|
@@ -43304,6 +43403,11 @@ ${imageError(target, reason || str2(step.state))}
|
|
|
43304
43403
|
},
|
|
43305
43404
|
flush() {
|
|
43306
43405
|
const text5 = reader.flush();
|
|
43406
|
+
if (pendingCosts.size) {
|
|
43407
|
+
const models = session ? antigravityRecordedModels(session, pendingCosts) : void 0;
|
|
43408
|
+
for (const [index, { usage: usage3 }] of pendingCosts) estimate(models?.get(index), usage3);
|
|
43409
|
+
pendingCosts.clear();
|
|
43410
|
+
}
|
|
43307
43411
|
if (!terminal) {
|
|
43308
43412
|
incomplete = true;
|
|
43309
43413
|
const diagnostics = [stderr.trim(), offStream?.match(/^(?:error:|rpc error:|API error\b)/i) ? offStream : void 0];
|
|
@@ -43338,6 +43442,7 @@ var init_antigravity = __esm({
|
|
|
43338
43442
|
init_events();
|
|
43339
43443
|
init_json();
|
|
43340
43444
|
init_stream();
|
|
43445
|
+
init_antigravity_session();
|
|
43341
43446
|
KINDS = {
|
|
43342
43447
|
run_command: "execute",
|
|
43343
43448
|
command_status: "execute",
|
|
@@ -43385,7 +43490,10 @@ function antigravityModels(output2) {
|
|
|
43385
43490
|
}
|
|
43386
43491
|
function args(argv, resume) {
|
|
43387
43492
|
if (namesFlag(argv, ["--continue", "-c", "--conversation", "--remote-agent"])) throw new Error(translating() ? "\u8BF7\u901A\u8FC7 WildCrane \u9009\u62E9 Antigravity \u4F1A\u8BDD\uFF0C\u4E0D\u8981\u5728\u989D\u5916\u53C2\u6570\u4E2D\u6307\u5B9A\u4F1A\u8BDD\u6216\u8FDC\u7A0B\u6267\u884C\u3002" : "Antigravity: select a session through WildCrane, not extra arguments.");
|
|
43388
|
-
if (resume
|
|
43493
|
+
if (resume) {
|
|
43494
|
+
const file2 = antigravityConversationFile(resume);
|
|
43495
|
+
if (!file2 || !fs29.existsSync(file2)) throw new Error(translating() ? "Antigravity \u4F1A\u8BDD\u4E0D\u5B58\u5728\u3002\u8BF7\u5728\u672C\u673A\u6062\u590D\u539F\u4F1A\u8BDD\u540E\u7EED\u63A5\u3002" : "Antigravity session not found. Restore the original conversation on this computer before resuming.");
|
|
43496
|
+
}
|
|
43389
43497
|
const extra = resume ? ["--conversation", resume] : [];
|
|
43390
43498
|
if (!namesFlag(argv, ["--output-format"])) extra.push("--output-format", "stream-json");
|
|
43391
43499
|
if (!namesFlag(argv, ["--dangerously-skip-permissions"])) extra.push("--dangerously-skip-permissions");
|
|
@@ -43403,6 +43511,7 @@ var init_antigravity2 = __esm({
|
|
|
43403
43511
|
init_types3();
|
|
43404
43512
|
init_language();
|
|
43405
43513
|
init_antigravity();
|
|
43514
|
+
init_antigravity_session();
|
|
43406
43515
|
EFFORT_ID = /-(?:low|medium|high|xhigh|max)$/i;
|
|
43407
43516
|
EFFORT_NAME = /\s*\((?:low|medium|high|xhigh|max)\)$/i;
|
|
43408
43517
|
ANTIGRAVITY = {
|
|
@@ -43947,10 +44056,10 @@ function findRollout(threadId) {
|
|
|
43947
44056
|
}
|
|
43948
44057
|
for (const name of names2) {
|
|
43949
44058
|
if (!name.startsWith("rollout-") || !name.endsWith(tail)) continue;
|
|
43950
|
-
const
|
|
44059
|
+
const path87 = join2(dir, name);
|
|
43951
44060
|
try {
|
|
43952
|
-
const at = statSync2(
|
|
43953
|
-
if (!newest2 || at > newest2.at) newest2 = { path:
|
|
44061
|
+
const at = statSync2(path87).mtimeMs;
|
|
44062
|
+
if (!newest2 || at > newest2.at) newest2 = { path: path87, at };
|
|
43954
44063
|
} catch {
|
|
43955
44064
|
}
|
|
43956
44065
|
}
|
|
@@ -43958,11 +44067,11 @@ function findRollout(threadId) {
|
|
|
43958
44067
|
return newest2?.path;
|
|
43959
44068
|
}
|
|
43960
44069
|
function readCodexRunFacts(threadId) {
|
|
43961
|
-
const
|
|
43962
|
-
if (!
|
|
44070
|
+
const path87 = findRollout(threadId);
|
|
44071
|
+
if (!path87) return void 0;
|
|
43963
44072
|
let raw;
|
|
43964
44073
|
try {
|
|
43965
|
-
raw = readFileSync2(
|
|
44074
|
+
raw = readFileSync2(path87, "utf8");
|
|
43966
44075
|
} catch {
|
|
43967
44076
|
return void 0;
|
|
43968
44077
|
}
|
|
@@ -44088,8 +44197,8 @@ function renderCompleted(item) {
|
|
|
44088
44197
|
const changes = Array.isArray(item.changes) ? item.changes : [];
|
|
44089
44198
|
return changes.map((raw) => {
|
|
44090
44199
|
const change2 = obj2(raw);
|
|
44091
|
-
const
|
|
44092
|
-
return
|
|
44200
|
+
const path87 = str2(change2.path);
|
|
44201
|
+
return path87 ? `\u23FA ${str2(change2.kind) || "change"}(${path87})
|
|
44093
44202
|
` : "";
|
|
44094
44203
|
}).join("");
|
|
44095
44204
|
}
|
|
@@ -44427,10 +44536,10 @@ function readKimiRunFacts(sessionId) {
|
|
|
44427
44536
|
const total = { input: 0, cacheCreation: 0, cacheRead: 0, output: 0 };
|
|
44428
44537
|
let model;
|
|
44429
44538
|
let holding = 0;
|
|
44430
|
-
for (const { path:
|
|
44539
|
+
for (const { path: path87, main } of wireFiles(entry.sessionDir)) {
|
|
44431
44540
|
let raw;
|
|
44432
44541
|
try {
|
|
44433
|
-
raw = readFileSync3(
|
|
44542
|
+
raw = readFileSync3(path87, "utf8");
|
|
44434
44543
|
} catch {
|
|
44435
44544
|
continue;
|
|
44436
44545
|
}
|
|
@@ -44807,8 +44916,8 @@ var init_tail = __esm({
|
|
|
44807
44916
|
import fs31 from "node:fs";
|
|
44808
44917
|
function whereHint(update2, title) {
|
|
44809
44918
|
const locations = Array.isArray(update2.locations) ? update2.locations : [];
|
|
44810
|
-
const
|
|
44811
|
-
return
|
|
44919
|
+
const path87 = str2(obj2(locations[0]).path);
|
|
44920
|
+
return path87 && !title.includes(path87) ? hint(path87) : "";
|
|
44812
44921
|
}
|
|
44813
44922
|
function saidBy(update2) {
|
|
44814
44923
|
const content = Array.isArray(update2.content) ? update2.content : [];
|
|
@@ -45989,7 +46098,7 @@ async function run(io, options, count3) {
|
|
|
45989
46098
|
startupTimer = setTimeout(() => {
|
|
45990
46099
|
if (!started) io.event?.({ kind: "log", data: { text: "[conversation] start_unconfirmed" } });
|
|
45991
46100
|
}, CONVERSATION_MS.start);
|
|
45992
|
-
await bounded(rpc.call("turn/start", { threadId, input: [{ type: "text", text: text5 }, ...images.map((
|
|
46101
|
+
await bounded(rpc.call("turn/start", { threadId, input: [{ type: "text", text: text5 }, ...images.map((path87) => ({ type: "localImage", path: path87 }))] }), CONVERSATION_MS.start, "Codex turn/start timed out; submission outcome is unknown.").catch((error62) => {
|
|
45993
46102
|
if (!started) throw error62;
|
|
45994
46103
|
});
|
|
45995
46104
|
};
|
|
@@ -53051,24 +53160,24 @@ function writeSignal(incoming, importedAt, slug = "") {
|
|
|
53051
53160
|
fs51.writeFileSync(file2, serialize({ ...signal2, relPath: boardRel(file2) }));
|
|
53052
53161
|
return { ...signal2, relPath: boardRel(file2) };
|
|
53053
53162
|
}
|
|
53054
|
-
function stamp3(file2,
|
|
53163
|
+
function stamp3(file2, fields2) {
|
|
53055
53164
|
const text5 = fs51.readFileSync(file2, "utf8");
|
|
53056
53165
|
const lines = text5.split("\n");
|
|
53057
53166
|
const close = lines.indexOf("---", 1);
|
|
53058
53167
|
if (close < 0) return;
|
|
53059
53168
|
const kept2 = lines.slice(1, close).filter((line) => {
|
|
53060
53169
|
const key = line.match(/^([a-z_]+):/);
|
|
53061
|
-
return !key ||
|
|
53170
|
+
return !key || fields2[key[1]] === void 0;
|
|
53062
53171
|
});
|
|
53063
|
-
const added = Object.entries(
|
|
53172
|
+
const added = Object.entries(fields2).flatMap(([key, value]) => value === null ? [] : [`${key}: ${yamlScalar(value)}`]);
|
|
53064
53173
|
fs51.writeFileSync(file2, ["---", ...kept2, ...added, ...lines.slice(close)].join("\n"));
|
|
53065
53174
|
}
|
|
53066
|
-
function moveSignal(from, into,
|
|
53175
|
+
function moveSignal(from, into, fields2) {
|
|
53067
53176
|
if (!fs51.existsSync(from)) return "";
|
|
53068
53177
|
fs51.mkdirSync(into, { recursive: true });
|
|
53069
53178
|
const at = path55.join(into, freeName(into, path55.basename(from)));
|
|
53070
53179
|
fs51.renameSync(from, at);
|
|
53071
|
-
stamp3(at,
|
|
53180
|
+
stamp3(at, fields2);
|
|
53072
53181
|
return boardRel(at);
|
|
53073
53182
|
}
|
|
53074
53183
|
function archiveInboxItem(sourceId, cardId2) {
|
|
@@ -53546,11 +53655,10 @@ var init_schema = __esm({
|
|
|
53546
53655
|
});
|
|
53547
53656
|
|
|
53548
53657
|
// ../artifact-sdk/src/internal/references.ts
|
|
53549
|
-
function
|
|
53658
|
+
function visibleBody(body) {
|
|
53550
53659
|
const lines = body.replace(/<!--[^]*?-->/g, "").split(/\r?\n/);
|
|
53551
53660
|
let fence = "";
|
|
53552
53661
|
let inTag = false;
|
|
53553
|
-
const out = [];
|
|
53554
53662
|
const visible = [];
|
|
53555
53663
|
for (const line of lines) {
|
|
53556
53664
|
const delimiter = /^ {0,3}(`{3,}|~{3,})/.exec(line)?.[1];
|
|
@@ -53569,32 +53677,39 @@ function bodyReferences(body) {
|
|
|
53569
53677
|
if (kept2 && /^ {0,3}<(?:Asset|Mockup|Compare|Storyboard|Studio)\b/.test(line)) inTag = true;
|
|
53570
53678
|
if (line.includes("/>")) inTag = false;
|
|
53571
53679
|
}
|
|
53572
|
-
|
|
53573
|
-
|
|
53680
|
+
return visible.join("\n").replace(/(`+)[^]*?\1/g, "");
|
|
53681
|
+
}
|
|
53682
|
+
function* componentTags(text5) {
|
|
53574
53683
|
const blocks = text5.matchAll(/^ {0,3}(?:<(?:Asset|Mockup|Compare|Storyboard|Studio)\b[^<>]*?\/>[ \t]*(?:\n[ \t]*)?)+$/gm);
|
|
53575
53684
|
for (const block of blocks) {
|
|
53576
|
-
const
|
|
53577
|
-
|
|
53578
|
-
const
|
|
53579
|
-
|
|
53580
|
-
|
|
53581
|
-
|
|
53582
|
-
|
|
53583
|
-
|
|
53584
|
-
|
|
53585
|
-
|
|
53586
|
-
|
|
53587
|
-
|
|
53588
|
-
|
|
53589
|
-
|
|
53590
|
-
|
|
53591
|
-
|
|
53685
|
+
for (const match of block[0].matchAll(TAG3)) {
|
|
53686
|
+
const attrs = {};
|
|
53687
|
+
for (const p of match[2].matchAll(/([\w-]+)\s*=\s*(?:"([^"]*)"|'([^']*)')/g)) attrs[p[1]] = p[2] ?? p[3];
|
|
53688
|
+
yield { name: match[1], attrs };
|
|
53689
|
+
}
|
|
53690
|
+
}
|
|
53691
|
+
}
|
|
53692
|
+
function bodyReferences(body) {
|
|
53693
|
+
const text5 = visibleBody(body);
|
|
53694
|
+
const out = [];
|
|
53695
|
+
for (const { name, attrs: a } of componentTags(text5)) {
|
|
53696
|
+
if (name === "Compare") {
|
|
53697
|
+
if (!a.a || !a.b) continue;
|
|
53698
|
+
for (const k of ["a", "b", "shots"]) if (a[k]) out.push({ src: a[k], types: ARRANGED });
|
|
53699
|
+
} else if (a.src) {
|
|
53700
|
+
out.push({ src: a.src, types: name === "Storyboard" ? STORYBOARD : name === "Studio" ? STUDIO : name === "Asset" ? ASSET : [] });
|
|
53701
|
+
if (a.variants) {
|
|
53702
|
+
try {
|
|
53703
|
+
const v = JSON.parse(a.variants);
|
|
53704
|
+
if (isObject2(v)) {
|
|
53705
|
+
for (const src of Object.values(v)) if (typeof src === "string" && src) out.push({ src, types: name === "Asset" ? ASSET : [] });
|
|
53592
53706
|
}
|
|
53707
|
+
} catch {
|
|
53593
53708
|
}
|
|
53594
53709
|
}
|
|
53595
53710
|
}
|
|
53596
53711
|
}
|
|
53597
|
-
for (const m of text5.replace(
|
|
53712
|
+
for (const m of text5.replace(TAG3, "").matchAll(/\]\(\s*<?([^\s)>]+)>?(?:\s+["'][^]*?["'])?\s*\)/g)) out.push({ src: m[1], types: [] });
|
|
53598
53713
|
return out;
|
|
53599
53714
|
}
|
|
53600
53715
|
function kindOf2(ext) {
|
|
@@ -53605,7 +53720,7 @@ function kindOf2(ext) {
|
|
|
53605
53720
|
if (type.startsWith("image/")) return "image";
|
|
53606
53721
|
return type.startsWith("video/") || type.startsWith("audio/") ? "video" : "asset";
|
|
53607
53722
|
}
|
|
53608
|
-
var STORYBOARD, STUDIO, ARRANGED, ASSET, isObject2, bodySources, TYPES;
|
|
53723
|
+
var STORYBOARD, STUDIO, ARRANGED, ASSET, isObject2, TAG3, bodyComponentTags, bodySources, TYPES;
|
|
53609
53724
|
var init_references = __esm({
|
|
53610
53725
|
"../artifact-sdk/src/internal/references.ts"() {
|
|
53611
53726
|
"use strict";
|
|
@@ -53614,6 +53729,8 @@ var init_references = __esm({
|
|
|
53614
53729
|
ARRANGED = ["storyboard", "compare", "spritesheet", "studio"];
|
|
53615
53730
|
ASSET = ["spritesheet", "asset"];
|
|
53616
53731
|
isObject2 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
|
|
53732
|
+
TAG3 = /<(Asset|Mockup|Compare|Storyboard|Studio)\b([^<>]*?)\/>/g;
|
|
53733
|
+
bodyComponentTags = (body) => componentTags(visibleBody(body));
|
|
53617
53734
|
bodySources = (body) => [...new Set(bodyReferences(body).map((r) => r.src))];
|
|
53618
53735
|
TYPES = {
|
|
53619
53736
|
".png": "image/png",
|
|
@@ -53766,14 +53883,14 @@ function collectSources(sources2, card, host2) {
|
|
|
53766
53883
|
const active3 = /* @__PURE__ */ new Set();
|
|
53767
53884
|
const out = [];
|
|
53768
53885
|
const visit2 = (src, types, owner, partial2 = false) => {
|
|
53769
|
-
const
|
|
53886
|
+
const path87 = src.replace(/[?#].*$/, "");
|
|
53770
53887
|
let resolved;
|
|
53771
53888
|
try {
|
|
53772
|
-
resolved = host2.resolve(
|
|
53889
|
+
resolved = host2.resolve(path87, owner);
|
|
53773
53890
|
} catch (error62) {
|
|
53774
53891
|
if (owner !== card) return { key: null, error: why(error62) };
|
|
53775
53892
|
if (!nodes.has(src)) {
|
|
53776
|
-
const node3 = { key: src, file: null, kind: kindAt(
|
|
53893
|
+
const node3 = { key: src, file: null, kind: kindAt(path87, types), error: why(error62), problems: [], dependencies: /* @__PURE__ */ new Map(), aliases: /* @__PURE__ */ new Set([src]) };
|
|
53777
53894
|
nodes.set(src, node3);
|
|
53778
53895
|
out.push(node3);
|
|
53779
53896
|
}
|
|
@@ -54003,7 +54120,7 @@ function validateSpec(file2, text5, id2) {
|
|
|
54003
54120
|
add2(1, "frontmatter", "Expected a leading --- frontmatter block and its closing ---. Restore both delimiters.");
|
|
54004
54121
|
return errors;
|
|
54005
54122
|
}
|
|
54006
|
-
const
|
|
54123
|
+
const fields2 = /* @__PURE__ */ new Map();
|
|
54007
54124
|
for (let i = 1; i < end2; i++) {
|
|
54008
54125
|
const line = lines[i];
|
|
54009
54126
|
if (!line.trim() || /^\s|^#/.test(line)) continue;
|
|
@@ -54013,35 +54130,35 @@ function validateSpec(file2, text5, id2) {
|
|
|
54013
54130
|
continue;
|
|
54014
54131
|
}
|
|
54015
54132
|
const key = match[1];
|
|
54016
|
-
if (
|
|
54017
|
-
|
|
54133
|
+
if (fields2.has(key)) add2(i + 1, "duplicate-field", `Field ${key} is repeated. Keep one ${key}: entry.`);
|
|
54134
|
+
fields2.set(key, { line: i + 1, value: match[2] });
|
|
54018
54135
|
}
|
|
54019
54136
|
for (const key of ["title", "priority", "status", "blocked_by", "related", "modules", "questions"]) {
|
|
54020
|
-
if (!
|
|
54137
|
+
if (!fields2.has(key)) add2(1, "missing-field", `Missing ${key}: in frontmatter. Restore it with the board's metadata commands.`);
|
|
54021
54138
|
}
|
|
54022
54139
|
const { meta: meta3 } = parseFrontmatter(text5);
|
|
54023
|
-
if (typeof meta3?.title !== "string" || !meta3.title.trim()) add2(
|
|
54140
|
+
if (typeof meta3?.title !== "string" || !meta3.title.trim()) add2(fields2.get("title")?.line ?? 1, "title", "The title is empty. Set a non-empty title with akb raw update.");
|
|
54024
54141
|
for (const key of ["priority", "status"]) {
|
|
54025
54142
|
const allowed2 = key === "status" ? STATUSES : LEVELS;
|
|
54026
|
-
const value =
|
|
54143
|
+
const value = fields2.get(key);
|
|
54027
54144
|
if (value && !allowed2.includes(value.value.replace(/^['"]|['"]$/g, ""))) {
|
|
54028
54145
|
add2(value.line, key, `Invalid ${key} ${JSON.stringify(value.value)}. Expected ${allowed2.join(", ")}; use akb raw update.`);
|
|
54029
54146
|
}
|
|
54030
54147
|
}
|
|
54031
|
-
const approved =
|
|
54148
|
+
const approved = fields2.get("preview_approved");
|
|
54032
54149
|
if (approved && approved.value !== "true") {
|
|
54033
54150
|
add2(approved.line, "preview_approved", `Invalid preview_approved ${JSON.stringify(approved.value)}. Only the board writes it, as true; remove the line.`);
|
|
54034
54151
|
}
|
|
54035
|
-
const rejected =
|
|
54152
|
+
const rejected = fields2.get("rejected");
|
|
54036
54153
|
if (rejected && rejected.value !== "true") {
|
|
54037
54154
|
add2(rejected.line, "rejected", `Invalid rejected ${JSON.stringify(rejected.value)}. Only akb raw reject writes it, as true; remove the line.`);
|
|
54038
54155
|
}
|
|
54039
54156
|
for (const key of ["rejected_reason", "rejected_at", "rejected_by"]) {
|
|
54040
|
-
const field2 =
|
|
54157
|
+
const field2 = fields2.get(key);
|
|
54041
54158
|
if (field2 && !rejected) add2(field2.line, key, `${key} is only kept on a rejected card. Only akb raw reject writes it; remove the line.`);
|
|
54042
54159
|
}
|
|
54043
54160
|
for (const key of ["blocked_by", "related", "modules", "questions"]) {
|
|
54044
|
-
const field2 =
|
|
54161
|
+
const field2 = fields2.get(key);
|
|
54045
54162
|
if (!field2) continue;
|
|
54046
54163
|
if (field2.value !== "" && !/^\[.*\]$/.test(field2.value)) {
|
|
54047
54164
|
add2(field2.line, "list", `${key} must be a list: use [] when empty, [values], or indented list entries.`);
|
|
@@ -56706,8 +56823,8 @@ function resolutionOf(record2, value) {
|
|
|
56706
56823
|
if (numberOfCard(f.path) !== null && f.content !== null) {
|
|
56707
56824
|
const front = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(f.content)?.[1];
|
|
56708
56825
|
const parsed = (0, import_yaml9.parseDocument)(front ?? "");
|
|
56709
|
-
const
|
|
56710
|
-
if (!front || parsed.errors.length || !
|
|
56826
|
+
const fields2 = parsed.toJS();
|
|
56827
|
+
if (!front || parsed.errors.length || !fields2 || typeof fields2.title !== "string" || ["title", "priority", "status", "blocked_by", "related", "modules", "questions"].some((key) => !(key in fields2)) || ["blocked_by", "related", "modules", "questions"].some((key) => !Array.isArray(fields2[key])) || fields2.modules.some((v) => typeof v !== "string") || ["blocked_by", "related"].some((key) => fields2[key].some((v) => !Number.isSafeInteger(v) || Number(v) < 1))) refuse3(record2, `Invalid card metadata: ${f.path}`, "invalid-usage");
|
|
56711
56828
|
const meta3 = parseFrontmatter(f.content).meta;
|
|
56712
56829
|
if (!meta3?.title?.trim() || !["todo", "ready", "implementing"].includes(meta3.status) || !["high", "med", "low"].includes(meta3.priority)) refuse3(record2, `Invalid card metadata: ${f.path}`, "invalid-usage");
|
|
56713
56830
|
if (meta3.status === "ready" && meta3.questions.length) refuse3(record2, "A ready card cannot have open questions.", "invalid-usage");
|
|
@@ -56968,10 +57085,10 @@ async function dispatch(move, cmd, args2, opts, cli) {
|
|
|
56968
57085
|
const created = move === "create" && Array.isArray(data2.ids) ? data2.ids.filter((id2) => Number.isInteger(id2)) : [];
|
|
56969
57086
|
if (inRun) await recordCards(insideRun(), created);
|
|
56970
57087
|
if (move === "create" && typeof input2.opts.triage === "string" && created[0] !== void 0) archiveCreation(input2.opts.triage, created[0]);
|
|
56971
|
-
const { output: output2, warnings, ...
|
|
57088
|
+
const { output: output2, warnings, ...fields2 } = data2;
|
|
56972
57089
|
if (output2) say(output2);
|
|
56973
57090
|
for (const line of warnings ?? []) warn(line);
|
|
56974
|
-
return { board: KANBAN, ...
|
|
57091
|
+
return { board: KANBAN, ...fields2 };
|
|
56975
57092
|
});
|
|
56976
57093
|
cli.onAnswer?.(data);
|
|
56977
57094
|
}
|
|
@@ -57272,8 +57389,8 @@ function prose(box) {
|
|
|
57272
57389
|
if (box.warnings.length) out.warnings = box.warnings;
|
|
57273
57390
|
return out;
|
|
57274
57391
|
}
|
|
57275
|
-
function answer(
|
|
57276
|
-
process.stdout.write(JSON.stringify(
|
|
57392
|
+
function answer(object3) {
|
|
57393
|
+
process.stdout.write(JSON.stringify(object3) + "\n");
|
|
57277
57394
|
}
|
|
57278
57395
|
function report2(err, { program: program2, json: json2, box = null }) {
|
|
57279
57396
|
if (!(err instanceof BoardError)) {
|
|
@@ -61972,7 +62089,7 @@ var init_board3 = __esm({
|
|
|
61972
62089
|
var card_chat_default;
|
|
61973
62090
|
var init_card_chat = __esm({
|
|
61974
62091
|
"src/guide/card-chat.md"() {
|
|
61975
|
-
card_chat_default = '# Answer a card\'s conversation\n\nRead the task\u2019s review plan and work only on unlocked stages. An empty plan needs no extra approval; an undecided plan allows planning only.\n\n- **Where the task stands**: read `akb task show <id>` and `akb task review <id>`.\n- **Button labels**: name actions by their labels on the page, in the user\'s language: "Approve" or "Approve, start \u2026" (\u6279\u51C6 / \u6279\u51C6\uFF0C\u5F00\u59CB\u2026), "Resume" (\u7EED\u8DD1), "Start again" (\u91CD\u65B0\u53D1\u8D77).\n\n- **Change requirements or drafts**: when the user changes the scope, expected behavior, or draft, use `akb 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- **Previews**: prepare or revise only requested outputs, using the task-bound Studio\u2019s Preview instructions and supplied component documentation. Before changing approved output, invalidate its stage with `akb task review <id> --revise-from <stage> --revision <n>`. Preserve unrelated work.\n- **Create a separate task**: when the user asks to capture work unrelated to this card, follow `akb guide add-task`.\n- **Split this card**: when the user asks to break this card\'s outcome into subtasks, follow the group procedure in `akb guide add-task`.\n- **Change a studio**: use `akb guide update-studio` for shared Studio instructions; a correction to this card\'s draft alone stays on this card.\n- **Check card edits**: after writing a card, run `akb 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\n- **Approve**: only on an explicit request, use `akb task approve <id> --stage <stage> --revision <reviewed revision>`; omit `--stage` for a pending plan. In a reply this commits after successful synchronization. Finish the reply without further edits or waiting. Never substitute the latest revision for the one reviewed.\n- **Change the plan**: propose a complete replacement with `akb task review <id> --file <json> --revision <n>` and wait for confirmation. Answers to questions never approve work.\n';
|
|
62092
|
+
card_chat_default = '# Answer a card\'s conversation\n\nRead the task\u2019s review plan and work only on unlocked stages. An empty plan needs no extra approval; an undecided plan allows planning only.\n\n- **Where the task stands**: read `akb task show <id>` and `akb task review <id>`.\n- **Button labels**: name actions by their labels on the page, in the user\'s language: "Approve" or "Approve, start \u2026" (\u6279\u51C6 / \u6279\u51C6\uFF0C\u5F00\u59CB\u2026), "Resume" (\u7EED\u8DD1), "Start again" (\u91CD\u65B0\u53D1\u8D77).\n\n- **Change requirements or drafts**: when the user changes the scope, expected behavior, or draft, use `akb 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- **Previews**: prepare or revise only requested outputs, using the task-bound Studio\u2019s Preview instructions and supplied component documentation. Before changing approved output, invalidate its stage with `akb task review <id> --revise-from <stage> --revision <n>`. Preserve unrelated work.\n- **Create a separate task**: when the user asks to capture work unrelated to this card, follow `akb guide add-task`.\n- **Split this card**: when the user asks to break this card\'s outcome into subtasks, follow the group procedure in `akb guide add-task`.\n- **Change a studio**: use `akb guide update-studio` for shared Studio instructions; a correction to this card\'s draft alone stays on this card.\n- **Check card edits**: after writing a card, run `akb 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\n- **Approve**: only on an explicit request, use `akb task approve <id> --stage <stage> --revision <reviewed revision>`; omit `--stage` for a pending plan. In a reply this commits after successful synchronization. Finish the reply without further edits or waiting. Never substitute the latest revision for the one reviewed.\n- **Change the plan**: propose a complete replacement with `akb task review <id> --file <json> --revision <n>` and wait for confirmation if `pending_plan` is set. Answers to questions never approve work.\n';
|
|
61976
62093
|
}
|
|
61977
62094
|
});
|
|
61978
62095
|
|
|
@@ -61996,7 +62113,7 @@ var init_describe_project = __esm({
|
|
|
61996
62113
|
var discuss_goal_default;
|
|
61997
62114
|
var init_discuss_goal = __esm({
|
|
61998
62115
|
"src/guide/discuss-goal.md"() {
|
|
61999
|
-
discuss_goal_default =
|
|
62116
|
+
discuss_goal_default = '# Discuss a goal\n\nExplain feasible options and key tradeoffs, then save the result the user can choose to start.\n\n- **Investigations**: finish checks and diagnosis here; save a change only when findings establish it. Report unverified work plainly.\n- **Goals**: save independent deliverables separately. Update existing goals rather than duplicate them.\n- **Studio**: choose the fitting installed Studio, preferring the user\'s choice; read its Additional Notes with `akb studio rule <studio>` and honor their scope. Its Preview IDs name outputs, not agents.\n- **Review**: save the Goal\'s review plan with `--review-file <json>` (`{id,after?,previews?,kind?}`). Use the Studio\'s Preview IDs and stable node IDs. An `after` edge between review nodes requires approval; mark ordinary work with `"kind":"work"` for completion-only dependencies.\n- **Review state**: save `[]` when no extra review is needed and `null` only while a decision is missing. Keep the saved arrangement when editing other details.\n- **Decisions**: explain the proposed outcome and review arrangement before saving. Ask only for choices the user must make, with a recommendation.\n- **Start**: the user starts each Goal from the page; starting accepts its arrangement, never skips its review gates. Changing the arrangement after starting requires plan confirmation.\n- **Communication**: the remote user sees tasks and previews. Use plain words and button labels, omitting internal paths, commands and tools.\n\n## Goal format\n\nUse exactly these three fields on create and update. Include only what the user requested or confirmed.\n\nPass the one-line title separately with `--title`. Use this template for `--body-file`:\n\n```markdown\n<The requested outcome in at most 150 words.>\n\n## Done when\n\n- <A verifiable condition for the requested outcome.>\n```\n';
|
|
62000
62117
|
}
|
|
62001
62118
|
});
|
|
62002
62119
|
|
|
@@ -62052,7 +62169,7 @@ var init_review_rejections = __esm({
|
|
|
62052
62169
|
var refine_default;
|
|
62053
62170
|
var init_refine = __esm({
|
|
62054
62171
|
"src/guide/refine.md"() {
|
|
62055
|
-
refine_default = '# Refine a card\n\nPlan one card until it is buildable.\n\n- **Unchecked cards**: check cards with `triage:` and empty `## Scope` against the project, rejecting obsolete or completed work with `akb raw reject <id> --reason "<evidence>"` and stopping.\n- **Other obsolete or completed cards**: ask whether to discard, run no previews, and stop.\n- **Groups**: preserve subtask coverage and progress, fill gaps without duplication, and do not mark the parent ready merely because its split is complete.\n- **Verification**: plan representative checks for the outcome, project rules and material risks, confirm prerequisites, and keep optional coverage optional.\n- **Review**: read `akb task review <id>`. If the arrangement is undecided, propose it with `--file <json> --revision <n>` and wait for confirmation. Work only on dispatched, unlocked nodes; keep independent work moving while other nodes await review.\n- **Previews**: prepare only the unlocked nodes\u2019 outputs per the Studio\u2019s `<Preview>` blocks. Before revising an approved output, use `--revise-from <stage> --revision <n>`; preserve unrelated outputs and approvals.\n- **Submit**: synchronize body and assets, then report `--stage <id> --status done --revision <n>`. Re-read after conflicts; never treat submission, question answers or plan confirmation as product approval.\n- **Delivery handoff**: for Studios with separate delivery, finish the review plan with a handoff; implementation and its checks run in delivery.\n- **References**: rewrite mentions of cards no longer on the board.\n- **Decisions**: settle choices supported by evidence and ask only as `akb guide update-questions` allows.\n- **Card**: follow studio rules and `akb guide writing`, fixing all errors from `akb raw validate <id>`.\n- **Ready**: when validated and buildable with prerequisites settled, run `akb raw update <id> --status ready`; otherwise leave blockers as open questions.\n\nFollow the printed closing steps. Wait only for required approvals; completion still requires Studio delivery checks.\n';
|
|
62172
|
+
refine_default = '# Refine a card\n\nPlan one card until it is buildable.\n\n- **Unchecked cards**: check cards with `triage:` and empty `## Scope` against the project, rejecting obsolete or completed work with `akb raw reject <id> --reason "<evidence>"` and stopping.\n- **Other obsolete or completed cards**: ask whether to discard, run no previews, and stop.\n- **Groups**: preserve subtask coverage and progress, fill gaps without duplication, and do not mark the parent ready merely because its split is complete.\n- **Verification**: plan representative checks for the outcome, project rules and material risks, confirm prerequisites, and keep optional coverage optional.\n- **Review**: read `akb task review <id>`. If the arrangement is undecided, propose it with `--file <json> --revision <n>` and wait for confirmation if `pending_plan` is set. Work only on dispatched, unlocked nodes; keep independent work moving while other nodes await review.\n- **Previews**: prepare only the unlocked nodes\u2019 outputs per the Studio\u2019s `<Preview>` blocks. Before revising an approved output, use `--revise-from <stage> --revision <n>`; preserve unrelated outputs and approvals.\n- **Submit**: synchronize body and assets, then report `--stage <id> --status done --revision <n>`. Re-read after conflicts; never treat submission, question answers or plan confirmation as product approval.\n- **Delivery handoff**: for Studios with separate delivery, finish the review plan with a handoff; implementation and its checks run in delivery.\n- **References**: rewrite mentions of cards no longer on the board.\n- **Decisions**: settle choices supported by evidence and ask only as `akb guide update-questions` allows.\n- **Card**: follow studio rules and `akb guide writing`, fixing all errors from `akb raw validate <id>`.\n- **Ready**: when validated and buildable with prerequisites settled, run `akb raw update <id> --status ready`; otherwise leave blockers as open questions.\n\nFollow the printed closing steps. Wait only for required approvals; completion still requires Studio delivery checks.\n';
|
|
62056
62173
|
}
|
|
62057
62174
|
});
|
|
62058
62175
|
|
|
@@ -63611,6 +63728,128 @@ var init_refine2 = __esm({
|
|
|
63611
63728
|
}
|
|
63612
63729
|
});
|
|
63613
63730
|
|
|
63731
|
+
// ../artifact-sdk/src/internal/tags.ts
|
|
63732
|
+
function variantsOf(raw, src) {
|
|
63733
|
+
if (!raw) return [];
|
|
63734
|
+
let parsed;
|
|
63735
|
+
try {
|
|
63736
|
+
parsed = JSON.parse(raw);
|
|
63737
|
+
} catch {
|
|
63738
|
+
return [];
|
|
63739
|
+
}
|
|
63740
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return [];
|
|
63741
|
+
const list3 = Object.entries(parsed).filter((e) => typeof e[1] === "string" && !!e[1]);
|
|
63742
|
+
if (list3.length < 2 || !list3.some(([, s]) => s === src)) return [];
|
|
63743
|
+
return list3.map(([label2, s]) => ({ label: label2, src: s }));
|
|
63744
|
+
}
|
|
63745
|
+
var init_tags = __esm({
|
|
63746
|
+
"../artifact-sdk/src/internal/tags.ts"() {
|
|
63747
|
+
"use strict";
|
|
63748
|
+
}
|
|
63749
|
+
});
|
|
63750
|
+
|
|
63751
|
+
// src/lib/shared/coding-previews.ts
|
|
63752
|
+
var CODING_PREVIEWS;
|
|
63753
|
+
var init_coding_previews = __esm({
|
|
63754
|
+
"src/lib/shared/coding-previews.ts"() {
|
|
63755
|
+
"use strict";
|
|
63756
|
+
CODING_PREVIEWS = {
|
|
63757
|
+
"tech-stack-advisor": "tech-choices",
|
|
63758
|
+
"email-planner": "emails",
|
|
63759
|
+
"ui-designer": "ui-design",
|
|
63760
|
+
"api-designer": "api-docs",
|
|
63761
|
+
"schema-designer": "schema",
|
|
63762
|
+
"prompt-writer": "prompts",
|
|
63763
|
+
"competitor-research": "competitor-research"
|
|
63764
|
+
};
|
|
63765
|
+
}
|
|
63766
|
+
});
|
|
63767
|
+
|
|
63768
|
+
// src/lib/agent/approved-ui.ts
|
|
63769
|
+
import path80 from "node:path";
|
|
63770
|
+
function approvedUiPreviews(review) {
|
|
63771
|
+
if (reviewAuthorization(review).kind !== "delivery") return [];
|
|
63772
|
+
const result = [];
|
|
63773
|
+
for (const node2 of review.plan ?? []) {
|
|
63774
|
+
const stage = review.stages.find((stage2) => stage2.id === node2.id);
|
|
63775
|
+
const snapshot2 = stage?.snapshot;
|
|
63776
|
+
if (!stage || !snapshot2) continue;
|
|
63777
|
+
const evidence = object2(snapshot2.evidence);
|
|
63778
|
+
const content = object2(evidence.content);
|
|
63779
|
+
const frozenPreviews = Array.isArray(snapshot2.previews) ? snapshot2.previews.filter(isObject2) : [];
|
|
63780
|
+
for (const id2 of node2.previews.filter((id3) => UI_IDS.includes(id3))) {
|
|
63781
|
+
const preview = object2(content[id2]);
|
|
63782
|
+
const body = typeof preview.body === "string" ? preview.body : typeof snapshot2.body === "string" ? parsePreviewBlocks(snapshot2.body).blocks.find((block) => block.id === id2)?.instructions : void 0;
|
|
63783
|
+
if (!body) continue;
|
|
63784
|
+
const pins = { ...object2(frozenPreviews.find((preview2) => preview2.id === id2)?.assets), ...object2(evidence.assets) };
|
|
63785
|
+
const files = /* @__PURE__ */ new Map();
|
|
63786
|
+
const add2 = (src, label2, device) => {
|
|
63787
|
+
const pin = object2(pins[src]);
|
|
63788
|
+
const { artifact, version: version2 } = pin;
|
|
63789
|
+
if (typeof artifact !== "string" || !/^art_[a-z0-9]+$/i.test(artifact) || typeof version2 !== "number" || !Number.isSafeInteger(version2) || version2 < 1) return;
|
|
63790
|
+
const name = label2.trim() || path80.posix.basename(src);
|
|
63791
|
+
const key = JSON.stringify([src, name]);
|
|
63792
|
+
let file2 = files.get(key);
|
|
63793
|
+
if (!file2) {
|
|
63794
|
+
file2 = { src, artifact, version: version2, revision: stage.revision, label: name, devices: /* @__PURE__ */ new Set() };
|
|
63795
|
+
files.set(key, file2);
|
|
63796
|
+
}
|
|
63797
|
+
file2.devices.add(device === "mobile" ? "Mobile" : device === "desktop" ? "Desktop" : "Device unspecified");
|
|
63798
|
+
};
|
|
63799
|
+
for (const { name, attrs } of bodyComponentTags(body)) {
|
|
63800
|
+
const label2 = attrs.label ?? "";
|
|
63801
|
+
if (name === "Compare" && attrs.a && attrs.b) {
|
|
63802
|
+
add2(attrs.a, attrs["a-label"] || label2);
|
|
63803
|
+
add2(attrs.b, attrs["b-label"] || label2);
|
|
63804
|
+
} else if (attrs.src) {
|
|
63805
|
+
const variants = variantsOf(attrs.variants, attrs.src);
|
|
63806
|
+
if (variants.length) {
|
|
63807
|
+
for (const variant of variants) add2(variant.src, label2 ? `${label2} (${variant.label})` : variant.label, attrs.device);
|
|
63808
|
+
} else {
|
|
63809
|
+
add2(attrs.src, label2, attrs.device);
|
|
63810
|
+
}
|
|
63811
|
+
}
|
|
63812
|
+
}
|
|
63813
|
+
const listed = new Set([...files.values()].map((file2) => file2.src));
|
|
63814
|
+
for (const src of bodySources(body)) if (!listed.has(src)) add2(src, "");
|
|
63815
|
+
result.push(...files.values());
|
|
63816
|
+
}
|
|
63817
|
+
}
|
|
63818
|
+
return result;
|
|
63819
|
+
}
|
|
63820
|
+
function approvedUiFile(directory, file2) {
|
|
63821
|
+
const ext = path80.posix.extname(file2.src).toLowerCase();
|
|
63822
|
+
const suffix = ext === ".tsx" ? ".html" : /^\.[a-z0-9]+$/.test(ext) ? ext : "";
|
|
63823
|
+
return path80.join(directory, `${file2.artifact}-${file2.version}${suffix}`);
|
|
63824
|
+
}
|
|
63825
|
+
function approvedUiPrompt(review, directory) {
|
|
63826
|
+
const files = approvedUiPreviews(review);
|
|
63827
|
+
if (!files.length) return "";
|
|
63828
|
+
return [
|
|
63829
|
+
"Approved UI previews",
|
|
63830
|
+
APPROVED_UI_RULE,
|
|
63831
|
+
files.map((file2) => {
|
|
63832
|
+
const ref = directory ? `frozen file: \`${approvedUiFile(directory, file2)}\`` : `artifact ${file2.artifact}, version ${file2.version}`;
|
|
63833
|
+
return `- ${file2.label} \xB7 ${[...file2.devices].join(" / ")} \xB7 Review revision ${file2.revision} \xB7 ${file2.src} \xB7 ${ref}`;
|
|
63834
|
+
}).join("\n")
|
|
63835
|
+
].join("\n\n");
|
|
63836
|
+
}
|
|
63837
|
+
var APPROVED_UI_DIR_ENV, APPROVED_UI_RULE, UI_IDS, object2;
|
|
63838
|
+
var init_approved_ui = __esm({
|
|
63839
|
+
"src/lib/agent/approved-ui.ts"() {
|
|
63840
|
+
"use strict";
|
|
63841
|
+
init_references();
|
|
63842
|
+
init_tags();
|
|
63843
|
+
init_coding_previews();
|
|
63844
|
+
init_preview_blocks();
|
|
63845
|
+
init_review_plan();
|
|
63846
|
+
APPROVED_UI_DIR_ENV = "AI4KANBAN_APPROVED_UI_DIR";
|
|
63847
|
+
APPROVED_UI_RULE = "Open the approved mockups and match them exactly for the changes specified in the task card. Consider copying the relevant mockup code directly when the project framework permits. Compare the implementation with the approved desktop and mobile views and fix any differences.";
|
|
63848
|
+
UI_IDS = ["ui-designer", CODING_PREVIEWS["ui-designer"]];
|
|
63849
|
+
object2 = (value) => isObject2(value) ? value : {};
|
|
63850
|
+
}
|
|
63851
|
+
});
|
|
63852
|
+
|
|
63614
63853
|
// src/lib/agent/follow.ts
|
|
63615
63854
|
function refineRunsAfter(asks) {
|
|
63616
63855
|
return asks.flatMap((ask2) => {
|
|
@@ -63748,7 +63987,8 @@ async function watchRun(sessionId, resume = startResume, retryBackoff = backoffM
|
|
|
63748
63987
|
const recoveryPrompt = record2.harness === "antigravity" && record2.resumedFrom ? "First verify existing progress and operation results. Preserve user decisions and completed work; do not repeat completed operations. Check actual state before continuing any operation whose result is uncertain." : "";
|
|
63749
63988
|
const reviewContext = taskReviewContext();
|
|
63750
63989
|
const boundary = reviewContext ? reviewBoundary(reviewContext.review, reviewContext.assigned) : "";
|
|
63751
|
-
const
|
|
63990
|
+
const approvedUi = reviewContext && record2.action === "implement" && studioForRun({ id: record2.cardId ?? void 0, deliveryId: record2.deliveryId }) === "coding" ? approvedUiPrompt(reviewContext.review, process.env[APPROVED_UI_DIR_ENV]) : "";
|
|
63991
|
+
const prompt = [process.env.AI4KANBAN_SYNC_DIAGNOSTIC ? syncRepairPrompt(process.env.AI4KANBAN_SYNC_DIAGNOSTIC) : "", record2.retry ? `Previous execution failed: ${record2.retry.reason}. Check existing results before continuing; do not repeat completed operations.` : "", conflictPrompt(KANBAN), boundary, basePrompt, approvedUi, recoveryPrompt, discardedCardsPrompt(record2.discardedCards)].filter(Boolean).join("\n\n");
|
|
63752
63992
|
const before = markBoard();
|
|
63753
63993
|
const takes = active3.images;
|
|
63754
63994
|
active3.renderer?.setRequiredImages?.(record2.pictures ?? []);
|
|
@@ -64229,6 +64469,8 @@ var STOP_GRACE_MS, STOP_CLOSE_MS, STOP_FINISH_MS, silenceSaid, joinNotes;
|
|
|
64229
64469
|
var init_watch = __esm({
|
|
64230
64470
|
"src/lib/agent/watch.ts"() {
|
|
64231
64471
|
"use strict";
|
|
64472
|
+
init_approved_ui();
|
|
64473
|
+
init_runner();
|
|
64232
64474
|
init_review_plan();
|
|
64233
64475
|
init_env();
|
|
64234
64476
|
init_connection_process();
|
|
@@ -64267,7 +64509,7 @@ var init_watch = __esm({
|
|
|
64267
64509
|
|
|
64268
64510
|
// src/commands/run.ts
|
|
64269
64511
|
import fs80 from "node:fs";
|
|
64270
|
-
import
|
|
64512
|
+
import path81 from "node:path";
|
|
64271
64513
|
async function cmdStartRun(action, args2, opts, program2 = "akb") {
|
|
64272
64514
|
const { req, follow: follow2, print } = readRequest(action, args2, opts);
|
|
64273
64515
|
if (!print && (action === "approve" || action === "implement")) {
|
|
@@ -64489,7 +64731,7 @@ async function cmdSubStart(words, opts) {
|
|
|
64489
64731
|
let prompt = words.join(" ");
|
|
64490
64732
|
if (opts.file) {
|
|
64491
64733
|
try {
|
|
64492
|
-
prompt = fs80.readFileSync(
|
|
64734
|
+
prompt = fs80.readFileSync(path81.resolve(opts.file), "utf8");
|
|
64493
64735
|
} catch {
|
|
64494
64736
|
die(`--file: cannot read ${opts.file}`, { kind: "run-refused" });
|
|
64495
64737
|
}
|
|
@@ -64841,7 +65083,7 @@ var init_config3 = __esm({
|
|
|
64841
65083
|
|
|
64842
65084
|
// src/lib/signals/migrate.ts
|
|
64843
65085
|
import fs81 from "node:fs";
|
|
64844
|
-
import
|
|
65086
|
+
import path82 from "node:path";
|
|
64845
65087
|
function readHandled() {
|
|
64846
65088
|
let text5;
|
|
64847
65089
|
try {
|
|
@@ -64863,7 +65105,7 @@ function readHandled() {
|
|
|
64863
65105
|
}
|
|
64864
65106
|
function lift(from, into) {
|
|
64865
65107
|
fs81.mkdirSync(into, { recursive: true });
|
|
64866
|
-
fs81.renameSync(from,
|
|
65108
|
+
fs81.renameSync(from, path82.join(into, freeName(into, path82.basename(from))));
|
|
64867
65109
|
}
|
|
64868
65110
|
function repoint(dir, from, into) {
|
|
64869
65111
|
let entries;
|
|
@@ -64874,7 +65116,7 @@ function repoint(dir, from, into) {
|
|
|
64874
65116
|
}
|
|
64875
65117
|
for (const entry of entries) {
|
|
64876
65118
|
if (!entry.isFile() || !entry.name.endsWith(".md")) continue;
|
|
64877
|
-
const file2 =
|
|
65119
|
+
const file2 = path82.join(dir, entry.name);
|
|
64878
65120
|
const text5 = fs81.readFileSync(file2, "utf8");
|
|
64879
65121
|
if (text5.includes(from)) fs81.writeFileSync(file2, text5.split(from).join(into));
|
|
64880
65122
|
}
|
|
@@ -64887,17 +65129,17 @@ function dropIfEmpty(dir) {
|
|
|
64887
65129
|
}
|
|
64888
65130
|
function liftInbox() {
|
|
64889
65131
|
if (!fs81.existsSync(SIGNALS_OLD_INBOX)) return;
|
|
64890
|
-
const oldFiles =
|
|
65132
|
+
const oldFiles = path82.join(SIGNALS_OLD_INBOX, "files");
|
|
64891
65133
|
if (fs81.existsSync(oldFiles)) {
|
|
64892
65134
|
for (const entry of fs81.readdirSync(oldFiles, { withFileTypes: true })) {
|
|
64893
|
-
if (entry.isFile()) lift(
|
|
65135
|
+
if (entry.isFile()) lift(path82.join(oldFiles, entry.name), SIGNALS_FILES);
|
|
64894
65136
|
}
|
|
64895
65137
|
dropIfEmpty(oldFiles);
|
|
64896
65138
|
}
|
|
64897
65139
|
const held4 = new Set(readFolder(TRIAGE).map((signal2) => signal2.sourceId));
|
|
64898
65140
|
for (const entry of fs81.readdirSync(SIGNALS_OLD_INBOX, { withFileTypes: true })) {
|
|
64899
65141
|
if (!entry.isFile() || !entry.name.endsWith(".md")) continue;
|
|
64900
|
-
const from =
|
|
65142
|
+
const from = path82.join(SIGNALS_OLD_INBOX, entry.name);
|
|
64901
65143
|
const item = parse3(from);
|
|
64902
65144
|
if (item && held4.has(item.sourceId)) {
|
|
64903
65145
|
fs81.rmSync(from, { force: true });
|
|
@@ -64906,7 +65148,7 @@ function liftInbox() {
|
|
|
64906
65148
|
if (item) held4.add(item.sourceId);
|
|
64907
65149
|
lift(from, TRIAGE);
|
|
64908
65150
|
}
|
|
64909
|
-
const wasAt = asWritten(
|
|
65151
|
+
const wasAt = asWritten(path82.join(SIGNALS_OLD_INBOX, "files"));
|
|
64910
65152
|
const nowAt = asWritten(SIGNALS_FILES);
|
|
64911
65153
|
for (const dir of [TRIAGE, SIGNALS_ARCHIVED, SIGNALS_DISMISSED]) repoint(dir, wasAt, nowAt);
|
|
64912
65154
|
dropIfEmpty(SIGNALS_OLD_INBOX);
|
|
@@ -64932,7 +65174,7 @@ function liftHandled() {
|
|
|
64932
65174
|
"---",
|
|
64933
65175
|
""
|
|
64934
65176
|
];
|
|
64935
|
-
fs81.writeFileSync(
|
|
65177
|
+
fs81.writeFileSync(path82.join(SIGNALS_DISMISSED, name), `${front.join("\n")}
|
|
64936
65178
|
`);
|
|
64937
65179
|
}
|
|
64938
65180
|
fs81.rmSync(SIGNALS_OLD_HANDLED, { force: true });
|
|
@@ -64953,7 +65195,7 @@ var init_migrate = __esm({
|
|
|
64953
65195
|
init_yaml();
|
|
64954
65196
|
init_inbox();
|
|
64955
65197
|
HANDLED_LINE = /^-\s+(.+?)\s+—\s+(.+)$/;
|
|
64956
|
-
asWritten = (dir) => `${rel(dir).split(
|
|
65198
|
+
asWritten = (dir) => `${rel(dir).split(path82.sep).join("/")}/`;
|
|
64957
65199
|
}
|
|
64958
65200
|
});
|
|
64959
65201
|
|
|
@@ -65007,7 +65249,7 @@ var init_identity2 = __esm({
|
|
|
65007
65249
|
|
|
65008
65250
|
// src/lib/signals/add.ts
|
|
65009
65251
|
import fs82 from "node:fs";
|
|
65010
|
-
import
|
|
65252
|
+
import path83 from "node:path";
|
|
65011
65253
|
import { createHash as createHash8 } from "node:crypto";
|
|
65012
65254
|
function linkTitle(url2) {
|
|
65013
65255
|
let at;
|
|
@@ -65020,7 +65262,7 @@ function linkTitle(url2) {
|
|
|
65020
65262
|
return oneLine(where) || url2.slice(0, TITLE_MAX);
|
|
65021
65263
|
}
|
|
65022
65264
|
function asText(file2) {
|
|
65023
|
-
const ext =
|
|
65265
|
+
const ext = path83.extname(file2.name).toLowerCase();
|
|
65024
65266
|
if (!file2.type.startsWith("text/") && file2.type !== "application/json" && !TEXT_EXTENSIONS.has(ext)) return null;
|
|
65025
65267
|
try {
|
|
65026
65268
|
const text5 = new TextDecoder("utf-8", { fatal: true }).decode(file2.data);
|
|
@@ -65030,9 +65272,9 @@ function asText(file2) {
|
|
|
65030
65272
|
}
|
|
65031
65273
|
}
|
|
65032
65274
|
function fileName2(name, data) {
|
|
65033
|
-
const base =
|
|
65034
|
-
const ext =
|
|
65035
|
-
const word =
|
|
65275
|
+
const base = path83.basename(name);
|
|
65276
|
+
const ext = path83.extname(base).toLowerCase().slice(0, 12);
|
|
65277
|
+
const word = path83.basename(base, path83.extname(base)).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 40) || "file";
|
|
65036
65278
|
const hash3 = createHash8("sha256").update(data).digest("hex").slice(0, 8);
|
|
65037
65279
|
return `${word}-${hash3}${ext}`;
|
|
65038
65280
|
}
|
|
@@ -65041,9 +65283,9 @@ function addToInbox(drop) {
|
|
|
65041
65283
|
const typed = (drop.text ?? "").trim();
|
|
65042
65284
|
const file2 = drop.file;
|
|
65043
65285
|
if (!typed && !file2) return { ok: false, error: "nothing to add \u2014 paste a link or some text, or drop a file." };
|
|
65044
|
-
if (file2 && file2.data.length === 0) return { ok: false, error: `${
|
|
65286
|
+
if (file2 && file2.data.length === 0) return { ok: false, error: `${path83.basename(file2.name)} is empty.` };
|
|
65045
65287
|
if (file2 && file2.data.length > MAX_BYTES3) {
|
|
65046
|
-
return { ok: false, error: `${
|
|
65288
|
+
return { ok: false, error: `${path83.basename(file2.name)} is over ${MAX_BYTES3 / 1024 / 1024} MB \u2014 too big for the board.` };
|
|
65047
65289
|
}
|
|
65048
65290
|
const read5 = describe3(typed, file2);
|
|
65049
65291
|
const keep2 = read5.keep;
|
|
@@ -65080,7 +65322,7 @@ function describe3(typed, file2) {
|
|
|
65080
65322
|
return only ? [only] : [];
|
|
65081
65323
|
};
|
|
65082
65324
|
if (file2) {
|
|
65083
|
-
const name =
|
|
65325
|
+
const name = path83.basename(file2.name);
|
|
65084
65326
|
const text5 = asText(file2);
|
|
65085
65327
|
const note = typed ? `
|
|
65086
65328
|
|
|
@@ -65092,7 +65334,7 @@ ${typed}` : "";
|
|
|
65092
65334
|
const at = keepAt(file2);
|
|
65093
65335
|
return {
|
|
65094
65336
|
incoming: {
|
|
65095
|
-
title:
|
|
65337
|
+
title: path83.basename(name, path83.extname(name)) || name,
|
|
65096
65338
|
summary: `${name} \u2014 ${boardRel2(at)}${note}`,
|
|
65097
65339
|
...named2
|
|
65098
65340
|
},
|
|
@@ -65130,13 +65372,13 @@ var init_add = __esm({
|
|
|
65130
65372
|
MAX_BYTES3 = 25 * 1024 * 1024;
|
|
65131
65373
|
TITLE_MAX = 120;
|
|
65132
65374
|
TEXT_EXTENSIONS = /* @__PURE__ */ new Set([".md", ".markdown", ".txt", ".text", ".csv", ".json", ".yml", ".yaml", ".log"]);
|
|
65133
|
-
boardRel2 = (file2) => rel(file2).split(
|
|
65375
|
+
boardRel2 = (file2) => rel(file2).split(path83.sep).join("/");
|
|
65134
65376
|
oneLine = (text5) => {
|
|
65135
65377
|
const first = text5.split("\n").find((line) => line.trim()) ?? "";
|
|
65136
65378
|
const clean = first.replace(/^#+\s*/, "").trim();
|
|
65137
65379
|
return clean.length > TITLE_MAX ? `${clean.slice(0, TITLE_MAX - 1).trimEnd()}\u2026` : clean;
|
|
65138
65380
|
};
|
|
65139
|
-
keepAt = (file2) =>
|
|
65381
|
+
keepAt = (file2) => path83.join(SIGNALS_FILES, fileName2(file2.name, file2.data));
|
|
65140
65382
|
}
|
|
65141
65383
|
});
|
|
65142
65384
|
|
|
@@ -65241,7 +65483,7 @@ var init_spec = __esm({
|
|
|
65241
65483
|
|
|
65242
65484
|
// src/commands/studio-preview.ts
|
|
65243
65485
|
import fs84 from "node:fs";
|
|
65244
|
-
import
|
|
65486
|
+
import path84 from "node:path";
|
|
65245
65487
|
import { createHash as createHash9, randomUUID as randomUUID8 } from "node:crypto";
|
|
65246
65488
|
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
65247
65489
|
function readFolder2(folder2) {
|
|
@@ -65250,7 +65492,7 @@ function readFolder2(folder2) {
|
|
|
65250
65492
|
const scan = (dir) => {
|
|
65251
65493
|
for (const e of fs84.readdirSync(dir, { withFileTypes: true })) {
|
|
65252
65494
|
if (e.name.startsWith(".")) continue;
|
|
65253
|
-
const file2 =
|
|
65495
|
+
const file2 = path84.join(dir, e.name);
|
|
65254
65496
|
if (e.isSymbolicLink()) throw Error(`${file2}: symbolic links are not allowed`);
|
|
65255
65497
|
if (e.isDirectory()) scan(file2);
|
|
65256
65498
|
else {
|
|
@@ -65267,7 +65509,7 @@ function readFolder2(folder2) {
|
|
|
65267
65509
|
return { files, def: checked.def, fingerprint };
|
|
65268
65510
|
}
|
|
65269
65511
|
function unified(before, after2, file2, folder2) {
|
|
65270
|
-
const a =
|
|
65512
|
+
const a = path84.join(folder2, "a"), b = path84.join(folder2, "b");
|
|
65271
65513
|
fs84.writeFileSync(a, before ?? "");
|
|
65272
65514
|
fs84.writeFileSync(b, after2 ?? "");
|
|
65273
65515
|
const result = spawnSync7("git", ["diff", "--no-index", "--text", "--no-ext-diff", "--no-color", "--unified=3", before === null ? "/dev/null" : a, after2 === null ? "/dev/null" : b], { encoding: "utf8", maxBuffer: 16 * 1024 * 1024 });
|
|
@@ -65279,17 +65521,17 @@ ${start < 0 ? "" : lines.slice(start + 2).join("\n")}`;
|
|
|
65279
65521
|
}
|
|
65280
65522
|
async function cmdStudioPreview(id2, opts) {
|
|
65281
65523
|
if (!locate(id2)) die(`no card ${id2}`, "no-such-card");
|
|
65282
|
-
const destination =
|
|
65524
|
+
const destination = path84.join(ASSETS, String(id2), "studio-review"), staging = `${destination}.${randomUUID8()}.tmp`, backup = `${destination}.${randomUUID8()}.previous`;
|
|
65283
65525
|
let moved = false;
|
|
65284
65526
|
try {
|
|
65285
|
-
const draft = readFolder2(
|
|
65527
|
+
const draft = readFolder2(path84.resolve(opts.folder)), base = opts.base === "empty" ? null : readFolder2(path84.resolve(opts.base));
|
|
65286
65528
|
const version2 = readVersion2(draft.files), baseVersion = base && readVersion2(base.files);
|
|
65287
65529
|
if (base ? !version2 || !baseVersion || JSON.stringify(version2) !== JSON.stringify(baseVersion) : version2 !== null) throw Error("version.json: existing Studios need matching baseline and draft versions; use --base empty only for a new Studio without version.json");
|
|
65288
65530
|
fs84.mkdirSync(staging, { recursive: true });
|
|
65289
65531
|
const review = { version: 2, base: base && baseVersion ? { ...baseVersion, fingerprint: base.fingerprint } : null, fingerprint: draft.fingerprint, files: [] };
|
|
65290
65532
|
const save3 = (file2, bytes2) => {
|
|
65291
|
-
const target =
|
|
65292
|
-
fs84.mkdirSync(
|
|
65533
|
+
const target = path84.join(staging, file2);
|
|
65534
|
+
fs84.mkdirSync(path84.dirname(target), { recursive: true });
|
|
65293
65535
|
fs84.writeFileSync(target, bytes2);
|
|
65294
65536
|
return file2;
|
|
65295
65537
|
};
|
|
@@ -65298,10 +65540,10 @@ async function cmdStudioPreview(id2, opts) {
|
|
|
65298
65540
|
const before = base?.files[file2] ?? null, after2 = draft.files[file2] ?? null;
|
|
65299
65541
|
review.files.push({ path: file2, before: before === null ? null : save3(`files/${i}/before.txt`, before), after: after2 === null ? null : save3(`files/${i}/after.txt`, after2), ...before !== after2 ? { diff: save3(`files/${i}/change.diff`, unified(before, after2, file2, staging)) } : {} });
|
|
65300
65542
|
}
|
|
65301
|
-
for (const p of ["a", "b"]) fs84.rmSync(
|
|
65543
|
+
for (const p of ["a", "b"]) fs84.rmSync(path84.join(staging, p), { force: true });
|
|
65302
65544
|
if (!parseReview(review)) throw Error("generated review is invalid");
|
|
65303
65545
|
save3("review.json", JSON.stringify(review, null, 2) + "\n");
|
|
65304
|
-
fs84.mkdirSync(
|
|
65546
|
+
fs84.mkdirSync(path84.dirname(destination), { recursive: true });
|
|
65305
65547
|
if (fs84.existsSync(destination)) {
|
|
65306
65548
|
fs84.renameSync(destination, backup);
|
|
65307
65549
|
moved = true;
|
|
@@ -65319,7 +65561,7 @@ ${items}
|
|
|
65319
65561
|
|
|
65320
65562
|
</Set>` : items;
|
|
65321
65563
|
say([tag, files].filter(Boolean).join("\n\n"));
|
|
65322
|
-
return { file:
|
|
65564
|
+
return { file: path84.join(destination, "review.json"), tag, files };
|
|
65323
65565
|
} catch (error62) {
|
|
65324
65566
|
if (moved && !fs84.existsSync(destination)) fs84.renameSync(backup, destination);
|
|
65325
65567
|
if (error62 && typeof error62 === "object" && "kind" in error62) throw error62;
|
|
@@ -65902,7 +66144,7 @@ init_agent2();
|
|
|
65902
66144
|
|
|
65903
66145
|
// src/lib/cli/setup.ts
|
|
65904
66146
|
import fs86 from "node:fs";
|
|
65905
|
-
import
|
|
66147
|
+
import path86 from "node:path";
|
|
65906
66148
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
65907
66149
|
|
|
65908
66150
|
// src/commands/update.ts
|
|
@@ -65911,7 +66153,7 @@ init_config_template();
|
|
|
65911
66153
|
init_io();
|
|
65912
66154
|
init_version();
|
|
65913
66155
|
import fs85 from "node:fs";
|
|
65914
|
-
import
|
|
66156
|
+
import path85 from "node:path";
|
|
65915
66157
|
import { spawnSync as spawnSync9 } from "node:child_process";
|
|
65916
66158
|
var NAME = "wildcrane";
|
|
65917
66159
|
var REPO = "https://github.com/wildcrane-ai/wildcrane";
|
|
@@ -65953,8 +66195,8 @@ async function cmdUpdate2(ctx) {
|
|
|
65953
66195
|
return { updated: ctx.dir, from, to: SKILL_VERSION };
|
|
65954
66196
|
}
|
|
65955
66197
|
async function repairBoard(root2, report3, named2) {
|
|
65956
|
-
const legacy =
|
|
65957
|
-
const kept2 =
|
|
66198
|
+
const legacy = path85.join(root2, "docs", "kanban");
|
|
66199
|
+
const kept2 = path85.join(root2, ".akb", "kanban");
|
|
65958
66200
|
const board2 = named2 ?? (fs85.existsSync(legacy) ? legacy : kept2);
|
|
65959
66201
|
if (!fs85.existsSync(board2)) {
|
|
65960
66202
|
report3.notes.push("\u672A\u627E\u5230\u770B\u677F\uFF0C\u8BF7\u901A\u8FC7\u63D2\u4EF6\u8FDE\u63A5\u4E91\u7AEF\u9879\u76EE\u3002");
|
|
@@ -65967,7 +66209,7 @@ async function repairBoard(root2, report3, named2) {
|
|
|
65967
66209
|
return true;
|
|
65968
66210
|
}
|
|
65969
66211
|
function checkConfig(board2, report3) {
|
|
65970
|
-
const current = read4(
|
|
66212
|
+
const current = read4(path85.join(board2, "config.md"));
|
|
65971
66213
|
if (!current) return;
|
|
65972
66214
|
const added = missingConfigKeys(current);
|
|
65973
66215
|
if (added.length) {
|
|
@@ -65977,7 +66219,7 @@ function checkConfig(board2, report3) {
|
|
|
65977
66219
|
}
|
|
65978
66220
|
}
|
|
65979
66221
|
function checkModules(board2, report3) {
|
|
65980
|
-
const map3 = read4(
|
|
66222
|
+
const map3 = read4(path85.join(board2, "modules.md"));
|
|
65981
66223
|
if (map3 && map3.includes(UNFILLED)) {
|
|
65982
66224
|
report3.notes.push(
|
|
65983
66225
|
"docs/kanban/modules.md is still blank \u2014 write it from the repo (`akb guide module-map`)"
|
|
@@ -66031,14 +66273,14 @@ function declareSetup(program2, cli) {
|
|
|
66031
66273
|
program2.version(SKILL_VERSION, "-v, --version", "print this version").addHelpText("beforeAll", spelled(cli.program));
|
|
66032
66274
|
const dirOption = (cmd) => cmd.option("--dir <path>", "the project to work on (default: the current folder)").option("--json", "answer as one JSON object instead of prose");
|
|
66033
66275
|
const where = (cmd) => {
|
|
66034
|
-
const dir =
|
|
66276
|
+
const dir = path86.resolve(String(cmd.optsWithGlobals().dir ?? cli.cwd));
|
|
66035
66277
|
if (!fs86.existsSync(dir)) throw new BoardError(`no such folder: ${dir}`, { kind: "no-such-folder", dir });
|
|
66036
66278
|
return dir;
|
|
66037
66279
|
};
|
|
66038
66280
|
dirOption(program2.command("update")).summary("\u4FEE\u590D\u5DF2\u6709\u770B\u677F\u5E76\u68C0\u67E5 CLI \u65B0\u7248\u672C").description("\u4FEE\u590D\u5DF2\u6709\u770B\u677F\u5E76\u63D0\u793A CLI \u5347\u7EA7\u547D\u4EE4\u3002\u6CA1\u6709\u770B\u677F\u65F6\uFF0C\u8BF7\u901A\u8FC7\u63D2\u4EF6\u8FDE\u63A5\u4E91\u7AEF\u9879\u76EE\u3002").action(async function() {
|
|
66039
66281
|
const dir = where(this);
|
|
66040
66282
|
const named2 = this.optsWithGlobals().board ?? process.env.AI4KANBAN_BOARD?.trim();
|
|
66041
|
-
const board2 = named2 ?
|
|
66283
|
+
const board2 = named2 ? path86.resolve(cli.cwd, named2) : null;
|
|
66042
66284
|
await runAction(ctxOf(this, cli.program), {}, () => cmdUpdate2({ dir, program: cli.program, board: board2 }));
|
|
66043
66285
|
});
|
|
66044
66286
|
program2.command("__rules", { hidden: true }).action(function() {
|