wildcrane-runner 0.6.114 → 0.6.116
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/akb/dist/kanban.mjs +684 -399
- package/dist/akb/package.json +1 -1
- package/dist/akb-proxy.mjs +1 -1
- package/dist/codex-proxy.mjs +1 -1
- package/dist/codex-retained.mjs +1 -1
- package/dist/flow-worker-main.mjs +108 -89
- package/dist/launcher.mjs +77 -74
- package/dist/plugin.mjs +77 -74
- package/dist/runner.mjs +110 -91
- package/dist/settings.mjs +77 -74
- package/package.json +1 -1
package/dist/akb/dist/kanban.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// ai4kanban 0.11.
|
|
2
|
+
// ai4kanban 0.11.98 — built by runner/scripts/build.mjs. Do not edit.
|
|
3
3
|
import { createRequire as __ai4kanbanRequire } from 'node:module'
|
|
4
4
|
const require = __ai4kanbanRequire(import.meta.url)
|
|
5
5
|
var __create = Object.create;
|
|
@@ -138,8 +138,8 @@ function deferRefresh(session, error62, { after: after2, transport = false } = {
|
|
|
138
138
|
const seconds = after2?.trim() ? Number(after2) : NaN;
|
|
139
139
|
const serverDelay = Number.isFinite(seconds) ? seconds * 1e3 : Date.parse(after2 ?? "") - Date.now();
|
|
140
140
|
const backoff = (transport ? 5e3 : REFRESH_BACKOFF_MS) * 2 ** (attempt2 - 1);
|
|
141
|
-
const
|
|
142
|
-
const retry2 = { key: refreshKey(session), until: Date.now() +
|
|
141
|
+
const delay4 = Math.max(Math.min(backoff, transport ? 3e4 : 3e5), Number.isFinite(serverDelay) ? serverDelay : 0);
|
|
142
|
+
const retry2 = { key: refreshKey(session), until: Date.now() + delay4, attempt: attempt2, error: error62 };
|
|
143
143
|
if (transport) transportRetry = { ...retry2, file: retryFile() };
|
|
144
144
|
else {
|
|
145
145
|
const temporary = `${retryFile()}.${process.pid}.tmp`;
|
|
@@ -1696,12 +1696,12 @@ function retryRecord(failure2, attempt2, runtime, sessionAction) {
|
|
|
1696
1696
|
};
|
|
1697
1697
|
}
|
|
1698
1698
|
async function waitForRetry(at, stopped2) {
|
|
1699
|
-
const
|
|
1700
|
-
if (!
|
|
1699
|
+
const delay4 = Math.max(0, at - Date.now());
|
|
1700
|
+
if (!delay4) return;
|
|
1701
1701
|
let timer;
|
|
1702
1702
|
try {
|
|
1703
1703
|
await Promise.race([new Promise((resolve2) => {
|
|
1704
|
-
timer = setTimeout(resolve2,
|
|
1704
|
+
timer = setTimeout(resolve2, delay4);
|
|
1705
1705
|
}), ...stopped2 ? [stopped2] : []]);
|
|
1706
1706
|
} finally {
|
|
1707
1707
|
clearTimeout(timer);
|
|
@@ -1764,10 +1764,10 @@ function planRetry(failure2, attempt2, now = Date.now(), backoff = backoffMs, ta
|
|
|
1764
1764
|
return { pause: "authorization" };
|
|
1765
1765
|
}
|
|
1766
1766
|
if (attempt2 > of) return { pause: "limit" };
|
|
1767
|
-
const
|
|
1768
|
-
const valid =
|
|
1767
|
+
const delay4 = failure2.retryAfterMs;
|
|
1768
|
+
const valid = delay4 !== void 0 && !Number.isNaN(delay4) && delay4 >= 0;
|
|
1769
1769
|
const immediate = failure2.source === "validation";
|
|
1770
|
-
const wait = valid ?
|
|
1770
|
+
const wait = valid ? delay4 : immediate ? 0 : backoff(attempt2 + 1);
|
|
1771
1771
|
const cap = task && failure2.code === "rate_limited" && valid ? 24 * 60 * 6e4 : CAP_MS;
|
|
1772
1772
|
if (wait > cap) return { pause: "wait_too_long" };
|
|
1773
1773
|
return { plan: { at: now + wait, of, failure: failure2 } };
|
|
@@ -2837,18 +2837,18 @@ var init_file_limits = __esm({
|
|
|
2837
2837
|
});
|
|
2838
2838
|
|
|
2839
2839
|
// ../cli/src/lib/shared/board-files.ts
|
|
2840
|
-
function isBoardPath(
|
|
2841
|
-
if (!
|
|
2842
|
-
if (
|
|
2843
|
-
if (
|
|
2844
|
-
if (
|
|
2845
|
-
if (SETTINGS.includes(
|
|
2846
|
-
if (
|
|
2847
|
-
if (
|
|
2848
|
-
return ROOTS.some((root2) =>
|
|
2849
|
-
}
|
|
2850
|
-
function numberOfCard(
|
|
2851
|
-
const n = ROOT.exec(
|
|
2840
|
+
function isBoardPath(path88) {
|
|
2841
|
+
if (!path88 || path88.length > 500 || path88.startsWith("/") || path88.includes("\\") || path88.includes("\0")) return false;
|
|
2842
|
+
if (path88.split("/").some((part) => !part || part === "." || part === "..")) return false;
|
|
2843
|
+
if (path88 === "todo/README.md" || path88.split("/").includes(".sync")) return false;
|
|
2844
|
+
if (path88.startsWith("studios/")) return true;
|
|
2845
|
+
if (SETTINGS.includes(path88)) return true;
|
|
2846
|
+
if (path88.startsWith("rules/")) return isSettingsPath(path88);
|
|
2847
|
+
if (path88.startsWith("assets/")) return taskOfAssets(path88) !== null;
|
|
2848
|
+
return ROOTS.some((root2) => path88.startsWith(root2)) && path88.endsWith(".md");
|
|
2849
|
+
}
|
|
2850
|
+
function numberOfCard(path88) {
|
|
2851
|
+
const n = ROOT.exec(path88)?.[1] ?? CARD.exec(path88)?.[1];
|
|
2852
2852
|
return n ? Number(n) : null;
|
|
2853
2853
|
}
|
|
2854
2854
|
function studioConfigText(config2, legacy2) {
|
|
@@ -2862,17 +2862,17 @@ var init_board_files = __esm({
|
|
|
2862
2862
|
init_file_limits();
|
|
2863
2863
|
ROOTS = ["todo/", ".archive/", "memory/", "studios/", "triage/", "assets/", "rules/"];
|
|
2864
2864
|
SETTINGS = ["modules.md", "config.md"];
|
|
2865
|
-
isSettingsPath = (
|
|
2865
|
+
isSettingsPath = (path88) => SETTINGS.includes(path88) || path88 === projectConfigFile || isStudioConfigPath(path88) || /^rules\/(?:proposer|project-writer|dismissal-reviewer|memory-pruner)\.md$/.test(path88);
|
|
2866
2866
|
CARD = /^(?:todo|\.archive)\/(?:[^/]+\/)*(\d+)-[^/]*\.md$/;
|
|
2867
2867
|
ROOT = /^(?:todo|\.archive)\/(?:[^/]+\/)*(\d+)-[^/]+\/root\.md$/;
|
|
2868
2868
|
assetsFile = (task) => `assets/${task}.json`;
|
|
2869
|
-
taskOfAssets = (
|
|
2869
|
+
taskOfAssets = (path88) => /^assets\/(task_[0-9a-f]+)\.json$/.exec(path88)?.[1] ?? null;
|
|
2870
2870
|
studioFolder = (id2) => id2.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
2871
2871
|
studioName = (id2) => id2.startsWith("wf_builtin_") ? id2.slice("wf_builtin_".length).replace(/_/g, "-") : studioFolder(id2);
|
|
2872
2872
|
projectConfigFile = "rules/config.md";
|
|
2873
2873
|
studioConfigFile = (id2) => `rules/studios/${studioName(id2)}/config.md`;
|
|
2874
2874
|
legacyStudioRuleFile = (id2) => `rules/studios/${studioName(id2)}.md`;
|
|
2875
|
-
isStudioConfigPath = (
|
|
2875
|
+
isStudioConfigPath = (path88) => /^rules\/studios\/[^/]+(?:\/config)?\.md$/.test(path88);
|
|
2876
2876
|
studioConfigConflict = (config2, legacy2) => !!config2?.trim() && !!legacy2?.trim() && config2.trim() !== legacy2.trim();
|
|
2877
2877
|
}
|
|
2878
2878
|
});
|
|
@@ -6094,8 +6094,8 @@ var require_utils = __commonJS({
|
|
|
6094
6094
|
}
|
|
6095
6095
|
return ind;
|
|
6096
6096
|
}
|
|
6097
|
-
function removeDotSegments(
|
|
6098
|
-
let input2 =
|
|
6097
|
+
function removeDotSegments(path88) {
|
|
6098
|
+
let input2 = path88;
|
|
6099
6099
|
const output2 = [];
|
|
6100
6100
|
let nextSlash = -1;
|
|
6101
6101
|
let len = 0;
|
|
@@ -6169,11 +6169,11 @@ var require_utils = __commonJS({
|
|
|
6169
6169
|
}
|
|
6170
6170
|
return output2.join("");
|
|
6171
6171
|
}
|
|
6172
|
-
function removeDotSegmentsRelative(
|
|
6173
|
-
if (
|
|
6174
|
-
return removeDotSegments(
|
|
6172
|
+
function removeDotSegmentsRelative(path88) {
|
|
6173
|
+
if (path88 === "" || path88[0] === "/") {
|
|
6174
|
+
return removeDotSegments(path88);
|
|
6175
6175
|
}
|
|
6176
|
-
const segments =
|
|
6176
|
+
const segments = path88.split("/");
|
|
6177
6177
|
const last = segments.length - 1;
|
|
6178
6178
|
const output2 = [];
|
|
6179
6179
|
let trailingDirectory = false;
|
|
@@ -6536,8 +6536,8 @@ var require_schemes = __commonJS({
|
|
|
6536
6536
|
}
|
|
6537
6537
|
if (wsComponent.resourceName) {
|
|
6538
6538
|
const queryIndex = wsComponent.resourceName.indexOf("?");
|
|
6539
|
-
const
|
|
6540
|
-
wsComponent.path =
|
|
6539
|
+
const path88 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
|
|
6540
|
+
wsComponent.path = path88 && path88 !== "/" ? path88 : void 0;
|
|
6541
6541
|
wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
|
|
6542
6542
|
wsComponent.resourceName = void 0;
|
|
6543
6543
|
}
|
|
@@ -9697,17 +9697,17 @@ var require_visit = __commonJS({
|
|
|
9697
9697
|
visit2.BREAK = BREAK;
|
|
9698
9698
|
visit2.SKIP = SKIP;
|
|
9699
9699
|
visit2.REMOVE = REMOVE;
|
|
9700
|
-
function visit_(key, node2, visitor,
|
|
9701
|
-
const ctrl = callVisitor(key, node2, visitor,
|
|
9700
|
+
function visit_(key, node2, visitor, path88) {
|
|
9701
|
+
const ctrl = callVisitor(key, node2, visitor, path88);
|
|
9702
9702
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
9703
|
-
replaceNode(key,
|
|
9704
|
-
return visit_(key, ctrl, visitor,
|
|
9703
|
+
replaceNode(key, path88, ctrl);
|
|
9704
|
+
return visit_(key, ctrl, visitor, path88);
|
|
9705
9705
|
}
|
|
9706
9706
|
if (typeof ctrl !== "symbol") {
|
|
9707
9707
|
if (identity.isCollection(node2)) {
|
|
9708
|
-
|
|
9708
|
+
path88 = Object.freeze(path88.concat(node2));
|
|
9709
9709
|
for (let i = 0; i < node2.items.length; ++i) {
|
|
9710
|
-
const ci = visit_(i, node2.items[i], visitor,
|
|
9710
|
+
const ci = visit_(i, node2.items[i], visitor, path88);
|
|
9711
9711
|
if (typeof ci === "number")
|
|
9712
9712
|
i = ci - 1;
|
|
9713
9713
|
else if (ci === BREAK)
|
|
@@ -9718,13 +9718,13 @@ var require_visit = __commonJS({
|
|
|
9718
9718
|
}
|
|
9719
9719
|
}
|
|
9720
9720
|
} else if (identity.isPair(node2)) {
|
|
9721
|
-
|
|
9722
|
-
const ck = visit_("key", node2.key, visitor,
|
|
9721
|
+
path88 = Object.freeze(path88.concat(node2));
|
|
9722
|
+
const ck = visit_("key", node2.key, visitor, path88);
|
|
9723
9723
|
if (ck === BREAK)
|
|
9724
9724
|
return BREAK;
|
|
9725
9725
|
else if (ck === REMOVE)
|
|
9726
9726
|
node2.key = null;
|
|
9727
|
-
const cv = visit_("value", node2.value, visitor,
|
|
9727
|
+
const cv = visit_("value", node2.value, visitor, path88);
|
|
9728
9728
|
if (cv === BREAK)
|
|
9729
9729
|
return BREAK;
|
|
9730
9730
|
else if (cv === REMOVE)
|
|
@@ -9745,17 +9745,17 @@ var require_visit = __commonJS({
|
|
|
9745
9745
|
visitAsync.BREAK = BREAK;
|
|
9746
9746
|
visitAsync.SKIP = SKIP;
|
|
9747
9747
|
visitAsync.REMOVE = REMOVE;
|
|
9748
|
-
async function visitAsync_(key, node2, visitor,
|
|
9749
|
-
const ctrl = await callVisitor(key, node2, visitor,
|
|
9748
|
+
async function visitAsync_(key, node2, visitor, path88) {
|
|
9749
|
+
const ctrl = await callVisitor(key, node2, visitor, path88);
|
|
9750
9750
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
9751
|
-
replaceNode(key,
|
|
9752
|
-
return visitAsync_(key, ctrl, visitor,
|
|
9751
|
+
replaceNode(key, path88, ctrl);
|
|
9752
|
+
return visitAsync_(key, ctrl, visitor, path88);
|
|
9753
9753
|
}
|
|
9754
9754
|
if (typeof ctrl !== "symbol") {
|
|
9755
9755
|
if (identity.isCollection(node2)) {
|
|
9756
|
-
|
|
9756
|
+
path88 = Object.freeze(path88.concat(node2));
|
|
9757
9757
|
for (let i = 0; i < node2.items.length; ++i) {
|
|
9758
|
-
const ci = await visitAsync_(i, node2.items[i], visitor,
|
|
9758
|
+
const ci = await visitAsync_(i, node2.items[i], visitor, path88);
|
|
9759
9759
|
if (typeof ci === "number")
|
|
9760
9760
|
i = ci - 1;
|
|
9761
9761
|
else if (ci === BREAK)
|
|
@@ -9766,13 +9766,13 @@ var require_visit = __commonJS({
|
|
|
9766
9766
|
}
|
|
9767
9767
|
}
|
|
9768
9768
|
} else if (identity.isPair(node2)) {
|
|
9769
|
-
|
|
9770
|
-
const ck = await visitAsync_("key", node2.key, visitor,
|
|
9769
|
+
path88 = Object.freeze(path88.concat(node2));
|
|
9770
|
+
const ck = await visitAsync_("key", node2.key, visitor, path88);
|
|
9771
9771
|
if (ck === BREAK)
|
|
9772
9772
|
return BREAK;
|
|
9773
9773
|
else if (ck === REMOVE)
|
|
9774
9774
|
node2.key = null;
|
|
9775
|
-
const cv = await visitAsync_("value", node2.value, visitor,
|
|
9775
|
+
const cv = await visitAsync_("value", node2.value, visitor, path88);
|
|
9776
9776
|
if (cv === BREAK)
|
|
9777
9777
|
return BREAK;
|
|
9778
9778
|
else if (cv === REMOVE)
|
|
@@ -9799,23 +9799,23 @@ var require_visit = __commonJS({
|
|
|
9799
9799
|
}
|
|
9800
9800
|
return visitor;
|
|
9801
9801
|
}
|
|
9802
|
-
function callVisitor(key, node2, visitor,
|
|
9802
|
+
function callVisitor(key, node2, visitor, path88) {
|
|
9803
9803
|
if (typeof visitor === "function")
|
|
9804
|
-
return visitor(key, node2,
|
|
9804
|
+
return visitor(key, node2, path88);
|
|
9805
9805
|
if (identity.isMap(node2))
|
|
9806
|
-
return visitor.Map?.(key, node2,
|
|
9806
|
+
return visitor.Map?.(key, node2, path88);
|
|
9807
9807
|
if (identity.isSeq(node2))
|
|
9808
|
-
return visitor.Seq?.(key, node2,
|
|
9808
|
+
return visitor.Seq?.(key, node2, path88);
|
|
9809
9809
|
if (identity.isPair(node2))
|
|
9810
|
-
return visitor.Pair?.(key, node2,
|
|
9810
|
+
return visitor.Pair?.(key, node2, path88);
|
|
9811
9811
|
if (identity.isScalar(node2))
|
|
9812
|
-
return visitor.Scalar?.(key, node2,
|
|
9812
|
+
return visitor.Scalar?.(key, node2, path88);
|
|
9813
9813
|
if (identity.isAlias(node2))
|
|
9814
|
-
return visitor.Alias?.(key, node2,
|
|
9814
|
+
return visitor.Alias?.(key, node2, path88);
|
|
9815
9815
|
return void 0;
|
|
9816
9816
|
}
|
|
9817
|
-
function replaceNode(key,
|
|
9818
|
-
const parent =
|
|
9817
|
+
function replaceNode(key, path88, node2) {
|
|
9818
|
+
const parent = path88[path88.length - 1];
|
|
9819
9819
|
if (identity.isCollection(parent)) {
|
|
9820
9820
|
parent.items[key] = node2;
|
|
9821
9821
|
} else if (identity.isPair(parent)) {
|
|
@@ -10323,7 +10323,7 @@ var require_Scalar = __commonJS({
|
|
|
10323
10323
|
var Node = require_Node();
|
|
10324
10324
|
var toJS = require_toJS();
|
|
10325
10325
|
var isScalarValue = (value) => !value || typeof value !== "function" && typeof value !== "object";
|
|
10326
|
-
var
|
|
10326
|
+
var Scalar2 = class extends Node.NodeBase {
|
|
10327
10327
|
constructor(value) {
|
|
10328
10328
|
super(identity.SCALAR);
|
|
10329
10329
|
this.value = value;
|
|
@@ -10335,12 +10335,12 @@ var require_Scalar = __commonJS({
|
|
|
10335
10335
|
return String(this.value);
|
|
10336
10336
|
}
|
|
10337
10337
|
};
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
|
-
|
|
10341
|
-
|
|
10342
|
-
|
|
10343
|
-
exports.Scalar =
|
|
10338
|
+
Scalar2.BLOCK_FOLDED = "BLOCK_FOLDED";
|
|
10339
|
+
Scalar2.BLOCK_LITERAL = "BLOCK_LITERAL";
|
|
10340
|
+
Scalar2.PLAIN = "PLAIN";
|
|
10341
|
+
Scalar2.QUOTE_DOUBLE = "QUOTE_DOUBLE";
|
|
10342
|
+
Scalar2.QUOTE_SINGLE = "QUOTE_SINGLE";
|
|
10343
|
+
exports.Scalar = Scalar2;
|
|
10344
10344
|
exports.isScalarValue = isScalarValue;
|
|
10345
10345
|
}
|
|
10346
10346
|
});
|
|
@@ -10351,7 +10351,7 @@ var require_createNode = __commonJS({
|
|
|
10351
10351
|
"use strict";
|
|
10352
10352
|
var Alias = require_Alias();
|
|
10353
10353
|
var identity = require_identity();
|
|
10354
|
-
var
|
|
10354
|
+
var Scalar2 = require_Scalar();
|
|
10355
10355
|
var defaultTagPrefix = "tag:yaml.org,2002:";
|
|
10356
10356
|
function findTagObject(value, tagName, tags) {
|
|
10357
10357
|
if (tagName) {
|
|
@@ -10396,7 +10396,7 @@ var require_createNode = __commonJS({
|
|
|
10396
10396
|
value = value.toJSON();
|
|
10397
10397
|
}
|
|
10398
10398
|
if (!value || typeof value !== "object") {
|
|
10399
|
-
const node3 = new
|
|
10399
|
+
const node3 = new Scalar2.Scalar(value);
|
|
10400
10400
|
if (ref)
|
|
10401
10401
|
ref.node = node3;
|
|
10402
10402
|
return node3;
|
|
@@ -10407,7 +10407,7 @@ var require_createNode = __commonJS({
|
|
|
10407
10407
|
onTagObj(tagObj);
|
|
10408
10408
|
delete ctx.onTagObj;
|
|
10409
10409
|
}
|
|
10410
|
-
const node2 = tagObj?.createNode ? tagObj.createNode(ctx.schema, value, ctx) : typeof tagObj?.nodeClass?.from === "function" ? tagObj.nodeClass.from(ctx.schema, value, ctx) : new
|
|
10410
|
+
const node2 = tagObj?.createNode ? tagObj.createNode(ctx.schema, value, ctx) : typeof tagObj?.nodeClass?.from === "function" ? tagObj.nodeClass.from(ctx.schema, value, ctx) : new Scalar2.Scalar(value);
|
|
10411
10411
|
if (tagName)
|
|
10412
10412
|
node2.tag = tagName;
|
|
10413
10413
|
else if (!tagObj.default)
|
|
@@ -10427,10 +10427,10 @@ var require_Collection = __commonJS({
|
|
|
10427
10427
|
var createNode = require_createNode();
|
|
10428
10428
|
var identity = require_identity();
|
|
10429
10429
|
var Node = require_Node();
|
|
10430
|
-
function collectionFromPath(schema,
|
|
10430
|
+
function collectionFromPath(schema, path88, value) {
|
|
10431
10431
|
let v = value;
|
|
10432
|
-
for (let i =
|
|
10433
|
-
const k =
|
|
10432
|
+
for (let i = path88.length - 1; i >= 0; --i) {
|
|
10433
|
+
const k = path88[i];
|
|
10434
10434
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
10435
10435
|
const a = [];
|
|
10436
10436
|
a[k] = v;
|
|
@@ -10449,7 +10449,7 @@ var require_Collection = __commonJS({
|
|
|
10449
10449
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
10450
10450
|
});
|
|
10451
10451
|
}
|
|
10452
|
-
var isEmptyPath = (
|
|
10452
|
+
var isEmptyPath = (path88) => path88 == null || typeof path88 === "object" && !!path88[Symbol.iterator]().next().done;
|
|
10453
10453
|
var Collection = class extends Node.NodeBase {
|
|
10454
10454
|
constructor(type, schema) {
|
|
10455
10455
|
super(type);
|
|
@@ -10479,11 +10479,11 @@ var require_Collection = __commonJS({
|
|
|
10479
10479
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
10480
10480
|
* that already exists in the map.
|
|
10481
10481
|
*/
|
|
10482
|
-
addIn(
|
|
10483
|
-
if (isEmptyPath(
|
|
10482
|
+
addIn(path88, value) {
|
|
10483
|
+
if (isEmptyPath(path88))
|
|
10484
10484
|
this.add(value);
|
|
10485
10485
|
else {
|
|
10486
|
-
const [key, ...rest] =
|
|
10486
|
+
const [key, ...rest] = path88;
|
|
10487
10487
|
const node2 = this.get(key, true);
|
|
10488
10488
|
if (identity.isCollection(node2))
|
|
10489
10489
|
node2.addIn(rest, value);
|
|
@@ -10497,8 +10497,8 @@ var require_Collection = __commonJS({
|
|
|
10497
10497
|
* Removes a value from the collection.
|
|
10498
10498
|
* @returns `true` if the item was found and removed.
|
|
10499
10499
|
*/
|
|
10500
|
-
deleteIn(
|
|
10501
|
-
const [key, ...rest] =
|
|
10500
|
+
deleteIn(path88) {
|
|
10501
|
+
const [key, ...rest] = path88;
|
|
10502
10502
|
if (rest.length === 0)
|
|
10503
10503
|
return this.delete(key);
|
|
10504
10504
|
const node2 = this.get(key, true);
|
|
@@ -10512,8 +10512,8 @@ var require_Collection = __commonJS({
|
|
|
10512
10512
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
10513
10513
|
* `true` (collections are always returned intact).
|
|
10514
10514
|
*/
|
|
10515
|
-
getIn(
|
|
10516
|
-
const [key, ...rest] =
|
|
10515
|
+
getIn(path88, keepScalar) {
|
|
10516
|
+
const [key, ...rest] = path88;
|
|
10517
10517
|
const node2 = this.get(key, true);
|
|
10518
10518
|
if (rest.length === 0)
|
|
10519
10519
|
return !keepScalar && identity.isScalar(node2) ? node2.value : node2;
|
|
@@ -10531,8 +10531,8 @@ var require_Collection = __commonJS({
|
|
|
10531
10531
|
/**
|
|
10532
10532
|
* Checks if the collection includes a value with the key `key`.
|
|
10533
10533
|
*/
|
|
10534
|
-
hasIn(
|
|
10535
|
-
const [key, ...rest] =
|
|
10534
|
+
hasIn(path88) {
|
|
10535
|
+
const [key, ...rest] = path88;
|
|
10536
10536
|
if (rest.length === 0)
|
|
10537
10537
|
return this.has(key);
|
|
10538
10538
|
const node2 = this.get(key, true);
|
|
@@ -10542,8 +10542,8 @@ var require_Collection = __commonJS({
|
|
|
10542
10542
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
10543
10543
|
* boolean to add/remove the item from the set.
|
|
10544
10544
|
*/
|
|
10545
|
-
setIn(
|
|
10546
|
-
const [key, ...rest] =
|
|
10545
|
+
setIn(path88, value) {
|
|
10546
|
+
const [key, ...rest] = path88;
|
|
10547
10547
|
if (rest.length === 0) {
|
|
10548
10548
|
this.set(key, value);
|
|
10549
10549
|
} else {
|
|
@@ -10720,7 +10720,7 @@ ${indent2}${text4.slice(fold + 1, end3)}`;
|
|
|
10720
10720
|
var require_stringifyString = __commonJS({
|
|
10721
10721
|
"../cli/node_modules/yaml/dist/stringify/stringifyString.js"(exports) {
|
|
10722
10722
|
"use strict";
|
|
10723
|
-
var
|
|
10723
|
+
var Scalar2 = require_Scalar();
|
|
10724
10724
|
var foldFlowLines = require_foldFlowLines();
|
|
10725
10725
|
var getFoldOptions = (ctx, isBlock) => ({
|
|
10726
10726
|
indentAtStart: isBlock ? ctx.indent.length : ctx.indentAtStart,
|
|
@@ -10863,7 +10863,7 @@ ${indent2}`) + "'";
|
|
|
10863
10863
|
return quotedString(value, ctx);
|
|
10864
10864
|
}
|
|
10865
10865
|
const indent2 = ctx.indent || (ctx.forceBlockIndent || containsDocumentMarker(value) ? " " : "");
|
|
10866
|
-
const literal2 = blockQuote === "literal" ? true : blockQuote === "folded" || type ===
|
|
10866
|
+
const literal2 = blockQuote === "literal" ? true : blockQuote === "folded" || type === Scalar2.Scalar.BLOCK_FOLDED ? false : type === Scalar2.Scalar.BLOCK_LITERAL ? true : !lineLengthOverLimit(value, lineWidth, indent2.length);
|
|
10867
10867
|
if (!value)
|
|
10868
10868
|
return literal2 ? "|\n" : ">\n";
|
|
10869
10869
|
let chomp;
|
|
@@ -10918,7 +10918,7 @@ ${indent2}`) + "'";
|
|
|
10918
10918
|
const foldedValue = value.replace(/\n+/g, "\n$&").replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${indent2}`);
|
|
10919
10919
|
let literalFallback = false;
|
|
10920
10920
|
const foldOptions = getFoldOptions(ctx, true);
|
|
10921
|
-
if (blockQuote !== "folded" && type !==
|
|
10921
|
+
if (blockQuote !== "folded" && type !== Scalar2.Scalar.BLOCK_FOLDED) {
|
|
10922
10922
|
foldOptions.onOverflow = () => {
|
|
10923
10923
|
literalFallback = true;
|
|
10924
10924
|
};
|
|
@@ -10941,7 +10941,7 @@ ${indent2}${start}${value}${end2}`;
|
|
|
10941
10941
|
if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
|
|
10942
10942
|
return implicitKey || inFlow || !value.includes("\n") ? quotedString(value, ctx) : blockString(item, ctx, onComment, onChompKeep);
|
|
10943
10943
|
}
|
|
10944
|
-
if (!implicitKey && !inFlow && type !==
|
|
10944
|
+
if (!implicitKey && !inFlow && type !== Scalar2.Scalar.PLAIN && value.includes("\n")) {
|
|
10945
10945
|
return blockString(item, ctx, onComment, onChompKeep);
|
|
10946
10946
|
}
|
|
10947
10947
|
if (containsDocumentMarker(value)) {
|
|
@@ -10966,20 +10966,20 @@ ${indent2}`);
|
|
|
10966
10966
|
const { implicitKey, inFlow } = ctx;
|
|
10967
10967
|
const ss = typeof item.value === "string" ? item : Object.assign({}, item, { value: String(item.value) });
|
|
10968
10968
|
let { type } = item;
|
|
10969
|
-
if (type !==
|
|
10969
|
+
if (type !== Scalar2.Scalar.QUOTE_DOUBLE) {
|
|
10970
10970
|
if (/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(ss.value))
|
|
10971
|
-
type =
|
|
10971
|
+
type = Scalar2.Scalar.QUOTE_DOUBLE;
|
|
10972
10972
|
}
|
|
10973
10973
|
const _stringify = (_type) => {
|
|
10974
10974
|
switch (_type) {
|
|
10975
|
-
case
|
|
10976
|
-
case
|
|
10975
|
+
case Scalar2.Scalar.BLOCK_FOLDED:
|
|
10976
|
+
case Scalar2.Scalar.BLOCK_LITERAL:
|
|
10977
10977
|
return implicitKey || inFlow ? quotedString(ss.value, ctx) : blockString(ss, ctx, onComment, onChompKeep);
|
|
10978
|
-
case
|
|
10978
|
+
case Scalar2.Scalar.QUOTE_DOUBLE:
|
|
10979
10979
|
return doubleQuotedString(ss.value, ctx);
|
|
10980
|
-
case
|
|
10980
|
+
case Scalar2.Scalar.QUOTE_SINGLE:
|
|
10981
10981
|
return singleQuotedString(ss.value, ctx);
|
|
10982
|
-
case
|
|
10982
|
+
case Scalar2.Scalar.PLAIN:
|
|
10983
10983
|
return plainString(ss, ctx, onComment, onChompKeep);
|
|
10984
10984
|
default:
|
|
10985
10985
|
return null;
|
|
@@ -11128,7 +11128,7 @@ var require_stringifyPair = __commonJS({
|
|
|
11128
11128
|
"../cli/node_modules/yaml/dist/stringify/stringifyPair.js"(exports) {
|
|
11129
11129
|
"use strict";
|
|
11130
11130
|
var identity = require_identity();
|
|
11131
|
-
var
|
|
11131
|
+
var Scalar2 = require_Scalar();
|
|
11132
11132
|
var stringify = require_stringify();
|
|
11133
11133
|
var stringifyComment = require_stringifyComment();
|
|
11134
11134
|
function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
|
|
@@ -11143,7 +11143,7 @@ var require_stringifyPair = __commonJS({
|
|
|
11143
11143
|
throw new Error(msg);
|
|
11144
11144
|
}
|
|
11145
11145
|
}
|
|
11146
|
-
let explicitKey = !simpleKeys && (!key || keyComment && value == null && !ctx.inFlow || identity.isCollection(key) || (identity.isScalar(key) ? key.type ===
|
|
11146
|
+
let explicitKey = !simpleKeys && (!key || keyComment && value == null && !ctx.inFlow || identity.isCollection(key) || (identity.isScalar(key) ? key.type === Scalar2.Scalar.BLOCK_FOLDED || key.type === Scalar2.Scalar.BLOCK_LITERAL : typeof key === "object"));
|
|
11147
11147
|
ctx = Object.assign({}, ctx, {
|
|
11148
11148
|
allNullValues: false,
|
|
11149
11149
|
implicitKey: !explicitKey && (simpleKeys || !allNullValues),
|
|
@@ -11283,19 +11283,19 @@ var require_merge = __commonJS({
|
|
|
11283
11283
|
"../cli/node_modules/yaml/dist/schema/yaml-1.1/merge.js"(exports) {
|
|
11284
11284
|
"use strict";
|
|
11285
11285
|
var identity = require_identity();
|
|
11286
|
-
var
|
|
11286
|
+
var Scalar2 = require_Scalar();
|
|
11287
11287
|
var MERGE_KEY = "<<";
|
|
11288
11288
|
var merge2 = {
|
|
11289
11289
|
identify: (value) => value === MERGE_KEY || typeof value === "symbol" && value.description === MERGE_KEY,
|
|
11290
11290
|
default: "key",
|
|
11291
11291
|
tag: "tag:yaml.org,2002:merge",
|
|
11292
11292
|
test: /^<<$/,
|
|
11293
|
-
resolve: () => Object.assign(new
|
|
11293
|
+
resolve: () => Object.assign(new Scalar2.Scalar(Symbol(MERGE_KEY)), {
|
|
11294
11294
|
addToJSMap: addMergeToJSMap
|
|
11295
11295
|
}),
|
|
11296
11296
|
stringify: () => MERGE_KEY
|
|
11297
11297
|
};
|
|
11298
|
-
var isMergeKey = (ctx, key) => (merge2.identify(key) || identity.isScalar(key) && (!key.type || key.type ===
|
|
11298
|
+
var isMergeKey = (ctx, key) => (merge2.identify(key) || identity.isScalar(key) && (!key.type || key.type === Scalar2.Scalar.PLAIN) && merge2.identify(key.value)) && ctx?.doc.schema.tags.some((tag) => tag.tag === merge2.tag && tag.default);
|
|
11299
11299
|
function addMergeToJSMap(ctx, map3, value) {
|
|
11300
11300
|
const source2 = resolveAliasValue(ctx, value);
|
|
11301
11301
|
if (identity.isSeq(source2))
|
|
@@ -11602,7 +11602,7 @@ var require_YAMLMap = __commonJS({
|
|
|
11602
11602
|
var Collection = require_Collection();
|
|
11603
11603
|
var identity = require_identity();
|
|
11604
11604
|
var Pair = require_Pair();
|
|
11605
|
-
var
|
|
11605
|
+
var Scalar2 = require_Scalar();
|
|
11606
11606
|
function findPair(items, key) {
|
|
11607
11607
|
const k = identity.isScalar(key) ? key.value : key;
|
|
11608
11608
|
for (const it of items) {
|
|
@@ -11669,7 +11669,7 @@ var require_YAMLMap = __commonJS({
|
|
|
11669
11669
|
if (prev) {
|
|
11670
11670
|
if (!overwrite)
|
|
11671
11671
|
throw new Error(`Key ${_pair.key} already set`);
|
|
11672
|
-
if (identity.isScalar(prev.value) &&
|
|
11672
|
+
if (identity.isScalar(prev.value) && Scalar2.isScalarValue(_pair.value))
|
|
11673
11673
|
prev.value.value = _pair.value;
|
|
11674
11674
|
else
|
|
11675
11675
|
prev.value = _pair.value;
|
|
@@ -11767,7 +11767,7 @@ var require_YAMLSeq = __commonJS({
|
|
|
11767
11767
|
var stringifyCollection = require_stringifyCollection();
|
|
11768
11768
|
var Collection = require_Collection();
|
|
11769
11769
|
var identity = require_identity();
|
|
11770
|
-
var
|
|
11770
|
+
var Scalar2 = require_Scalar();
|
|
11771
11771
|
var toJS = require_toJS();
|
|
11772
11772
|
var YAMLSeq = class extends Collection.Collection {
|
|
11773
11773
|
static get tagName() {
|
|
@@ -11824,7 +11824,7 @@ var require_YAMLSeq = __commonJS({
|
|
|
11824
11824
|
if (typeof idx !== "number")
|
|
11825
11825
|
throw new Error(`Expected a valid index, not ${key}.`);
|
|
11826
11826
|
const prev = this.items[idx];
|
|
11827
|
-
if (identity.isScalar(prev) &&
|
|
11827
|
+
if (identity.isScalar(prev) && Scalar2.isScalarValue(value))
|
|
11828
11828
|
prev.value = value;
|
|
11829
11829
|
else
|
|
11830
11830
|
this.items[idx] = value;
|
|
@@ -11920,14 +11920,14 @@ var require_string = __commonJS({
|
|
|
11920
11920
|
var require_null = __commonJS({
|
|
11921
11921
|
"../cli/node_modules/yaml/dist/schema/common/null.js"(exports) {
|
|
11922
11922
|
"use strict";
|
|
11923
|
-
var
|
|
11923
|
+
var Scalar2 = require_Scalar();
|
|
11924
11924
|
var nullTag = {
|
|
11925
11925
|
identify: (value) => value == null,
|
|
11926
|
-
createNode: () => new
|
|
11926
|
+
createNode: () => new Scalar2.Scalar(null),
|
|
11927
11927
|
default: true,
|
|
11928
11928
|
tag: "tag:yaml.org,2002:null",
|
|
11929
11929
|
test: /^(?:~|[Nn]ull|NULL)?$/,
|
|
11930
|
-
resolve: () => new
|
|
11930
|
+
resolve: () => new Scalar2.Scalar(null),
|
|
11931
11931
|
stringify: ({ source: source2 }, ctx) => typeof source2 === "string" && nullTag.test.test(source2) ? source2 : ctx.options.nullStr
|
|
11932
11932
|
};
|
|
11933
11933
|
exports.nullTag = nullTag;
|
|
@@ -11938,13 +11938,13 @@ var require_null = __commonJS({
|
|
|
11938
11938
|
var require_bool = __commonJS({
|
|
11939
11939
|
"../cli/node_modules/yaml/dist/schema/core/bool.js"(exports) {
|
|
11940
11940
|
"use strict";
|
|
11941
|
-
var
|
|
11941
|
+
var Scalar2 = require_Scalar();
|
|
11942
11942
|
var boolTag = {
|
|
11943
11943
|
identify: (value) => typeof value === "boolean",
|
|
11944
11944
|
default: true,
|
|
11945
11945
|
tag: "tag:yaml.org,2002:bool",
|
|
11946
11946
|
test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
|
|
11947
|
-
resolve: (str5) => new
|
|
11947
|
+
resolve: (str5) => new Scalar2.Scalar(str5[0] === "t" || str5[0] === "T"),
|
|
11948
11948
|
stringify({ source: source2, value }, ctx) {
|
|
11949
11949
|
if (source2 && boolTag.test.test(source2)) {
|
|
11950
11950
|
const sv = source2[0] === "t" || source2[0] === "T";
|
|
@@ -11989,7 +11989,7 @@ var require_stringifyNumber = __commonJS({
|
|
|
11989
11989
|
var require_float = __commonJS({
|
|
11990
11990
|
"../cli/node_modules/yaml/dist/schema/core/float.js"(exports) {
|
|
11991
11991
|
"use strict";
|
|
11992
|
-
var
|
|
11992
|
+
var Scalar2 = require_Scalar();
|
|
11993
11993
|
var stringifyNumber = require_stringifyNumber();
|
|
11994
11994
|
var floatNaN = {
|
|
11995
11995
|
identify: (value) => typeof value === "number",
|
|
@@ -12017,7 +12017,7 @@ var require_float = __commonJS({
|
|
|
12017
12017
|
tag: "tag:yaml.org,2002:float",
|
|
12018
12018
|
test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
|
|
12019
12019
|
resolve(str5) {
|
|
12020
|
-
const node2 = new
|
|
12020
|
+
const node2 = new Scalar2.Scalar(parseFloat(str5));
|
|
12021
12021
|
const dot = str5.indexOf(".");
|
|
12022
12022
|
if (dot !== -1 && str5[str5.length - 1] === "0")
|
|
12023
12023
|
node2.minFractionDigits = str5.length - dot - 1;
|
|
@@ -12108,7 +12108,7 @@ var require_schema = __commonJS({
|
|
|
12108
12108
|
var require_schema2 = __commonJS({
|
|
12109
12109
|
"../cli/node_modules/yaml/dist/schema/json/schema.js"(exports) {
|
|
12110
12110
|
"use strict";
|
|
12111
|
-
var
|
|
12111
|
+
var Scalar2 = require_Scalar();
|
|
12112
12112
|
var map3 = require_map();
|
|
12113
12113
|
var seq = require_seq();
|
|
12114
12114
|
function intIdentify(value) {
|
|
@@ -12125,7 +12125,7 @@ var require_schema2 = __commonJS({
|
|
|
12125
12125
|
},
|
|
12126
12126
|
{
|
|
12127
12127
|
identify: (value) => value == null,
|
|
12128
|
-
createNode: () => new
|
|
12128
|
+
createNode: () => new Scalar2.Scalar(null),
|
|
12129
12129
|
default: true,
|
|
12130
12130
|
tag: "tag:yaml.org,2002:null",
|
|
12131
12131
|
test: /^null$/,
|
|
@@ -12176,7 +12176,7 @@ var require_binary = __commonJS({
|
|
|
12176
12176
|
"../cli/node_modules/yaml/dist/schema/yaml-1.1/binary.js"(exports) {
|
|
12177
12177
|
"use strict";
|
|
12178
12178
|
var node_buffer = __require("buffer");
|
|
12179
|
-
var
|
|
12179
|
+
var Scalar2 = require_Scalar();
|
|
12180
12180
|
var stringifyString = require_stringifyString();
|
|
12181
12181
|
var binary = {
|
|
12182
12182
|
identify: (value) => value instanceof Uint8Array,
|
|
@@ -12220,15 +12220,15 @@ var require_binary = __commonJS({
|
|
|
12220
12220
|
} else {
|
|
12221
12221
|
throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
|
|
12222
12222
|
}
|
|
12223
|
-
type ?? (type =
|
|
12224
|
-
if (type !==
|
|
12223
|
+
type ?? (type = Scalar2.Scalar.BLOCK_LITERAL);
|
|
12224
|
+
if (type !== Scalar2.Scalar.QUOTE_DOUBLE) {
|
|
12225
12225
|
const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
|
|
12226
12226
|
const n = Math.ceil(str5.length / lineWidth);
|
|
12227
12227
|
const lines = new Array(n);
|
|
12228
12228
|
for (let i = 0, o = 0; i < n; ++i, o += lineWidth) {
|
|
12229
12229
|
lines[i] = str5.substr(o, lineWidth);
|
|
12230
12230
|
}
|
|
12231
|
-
str5 = lines.join(type ===
|
|
12231
|
+
str5 = lines.join(type === Scalar2.Scalar.BLOCK_LITERAL ? "\n" : " ");
|
|
12232
12232
|
}
|
|
12233
12233
|
return stringifyString.stringifyString({ comment, type, value: str5 }, ctx, onComment, onChompKeep);
|
|
12234
12234
|
}
|
|
@@ -12243,7 +12243,7 @@ var require_pairs = __commonJS({
|
|
|
12243
12243
|
"use strict";
|
|
12244
12244
|
var identity = require_identity();
|
|
12245
12245
|
var Pair = require_Pair();
|
|
12246
|
-
var
|
|
12246
|
+
var Scalar2 = require_Scalar();
|
|
12247
12247
|
var YAMLSeq = require_YAMLSeq();
|
|
12248
12248
|
function resolvePairs(seq, onError) {
|
|
12249
12249
|
if (identity.isSeq(seq)) {
|
|
@@ -12254,7 +12254,7 @@ var require_pairs = __commonJS({
|
|
|
12254
12254
|
else if (identity.isMap(item)) {
|
|
12255
12255
|
if (item.items.length > 1)
|
|
12256
12256
|
onError("Each pair must have its own sequence indicator");
|
|
12257
|
-
const pair = item.items[0] || new Pair.Pair(new
|
|
12257
|
+
const pair = item.items[0] || new Pair.Pair(new Scalar2.Scalar(null));
|
|
12258
12258
|
if (item.commentBefore)
|
|
12259
12259
|
pair.key.commentBefore = pair.key.commentBefore ? `${item.commentBefore}
|
|
12260
12260
|
${pair.key.commentBefore}` : item.commentBefore;
|
|
@@ -12397,7 +12397,7 @@ var require_omap = __commonJS({
|
|
|
12397
12397
|
var require_bool2 = __commonJS({
|
|
12398
12398
|
"../cli/node_modules/yaml/dist/schema/yaml-1.1/bool.js"(exports) {
|
|
12399
12399
|
"use strict";
|
|
12400
|
-
var
|
|
12400
|
+
var Scalar2 = require_Scalar();
|
|
12401
12401
|
function boolStringify({ value, source: source2 }, ctx) {
|
|
12402
12402
|
const boolObj = value ? trueTag : falseTag;
|
|
12403
12403
|
if (source2 && boolObj.test.test(source2))
|
|
@@ -12409,7 +12409,7 @@ var require_bool2 = __commonJS({
|
|
|
12409
12409
|
default: true,
|
|
12410
12410
|
tag: "tag:yaml.org,2002:bool",
|
|
12411
12411
|
test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
|
|
12412
|
-
resolve: () => new
|
|
12412
|
+
resolve: () => new Scalar2.Scalar(true),
|
|
12413
12413
|
stringify: boolStringify
|
|
12414
12414
|
};
|
|
12415
12415
|
var falseTag = {
|
|
@@ -12417,7 +12417,7 @@ var require_bool2 = __commonJS({
|
|
|
12417
12417
|
default: true,
|
|
12418
12418
|
tag: "tag:yaml.org,2002:bool",
|
|
12419
12419
|
test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,
|
|
12420
|
-
resolve: () => new
|
|
12420
|
+
resolve: () => new Scalar2.Scalar(false),
|
|
12421
12421
|
stringify: boolStringify
|
|
12422
12422
|
};
|
|
12423
12423
|
exports.falseTag = falseTag;
|
|
@@ -12429,7 +12429,7 @@ var require_bool2 = __commonJS({
|
|
|
12429
12429
|
var require_float2 = __commonJS({
|
|
12430
12430
|
"../cli/node_modules/yaml/dist/schema/yaml-1.1/float.js"(exports) {
|
|
12431
12431
|
"use strict";
|
|
12432
|
-
var
|
|
12432
|
+
var Scalar2 = require_Scalar();
|
|
12433
12433
|
var stringifyNumber = require_stringifyNumber();
|
|
12434
12434
|
var floatNaN = {
|
|
12435
12435
|
identify: (value) => typeof value === "number",
|
|
@@ -12457,7 +12457,7 @@ var require_float2 = __commonJS({
|
|
|
12457
12457
|
tag: "tag:yaml.org,2002:float",
|
|
12458
12458
|
test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
|
|
12459
12459
|
resolve(str5) {
|
|
12460
|
-
const node2 = new
|
|
12460
|
+
const node2 = new Scalar2.Scalar(parseFloat(str5.replace(/_/g, "")));
|
|
12461
12461
|
const dot = str5.indexOf(".");
|
|
12462
12462
|
if (dot !== -1) {
|
|
12463
12463
|
const f = str5.substring(dot + 1).replace(/_/g, "");
|
|
@@ -12698,7 +12698,7 @@ var require_timestamp = __commonJS({
|
|
|
12698
12698
|
resolve: (str5) => parseSexagesimal(str5, false),
|
|
12699
12699
|
stringify: stringifySexagesimal
|
|
12700
12700
|
};
|
|
12701
|
-
var
|
|
12701
|
+
var timestamp2 = {
|
|
12702
12702
|
identify: (value) => value instanceof Date,
|
|
12703
12703
|
default: true,
|
|
12704
12704
|
tag: "tag:yaml.org,2002:timestamp",
|
|
@@ -12707,7 +12707,7 @@ var require_timestamp = __commonJS({
|
|
|
12707
12707
|
// assumed to be 00:00:00Z (start of day, UTC).
|
|
12708
12708
|
test: RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),
|
|
12709
12709
|
resolve(str5) {
|
|
12710
|
-
const match = str5.match(
|
|
12710
|
+
const match = str5.match(timestamp2.test);
|
|
12711
12711
|
if (!match)
|
|
12712
12712
|
throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
|
|
12713
12713
|
const [, year, month, day, hour, minute, second] = match.map(Number);
|
|
@@ -12726,7 +12726,7 @@ var require_timestamp = __commonJS({
|
|
|
12726
12726
|
};
|
|
12727
12727
|
exports.floatTime = floatTime;
|
|
12728
12728
|
exports.intTime = intTime;
|
|
12729
|
-
exports.timestamp =
|
|
12729
|
+
exports.timestamp = timestamp2;
|
|
12730
12730
|
}
|
|
12731
12731
|
});
|
|
12732
12732
|
|
|
@@ -12746,7 +12746,7 @@ var require_schema3 = __commonJS({
|
|
|
12746
12746
|
var omap = require_omap();
|
|
12747
12747
|
var pairs = require_pairs();
|
|
12748
12748
|
var set3 = require_set();
|
|
12749
|
-
var
|
|
12749
|
+
var timestamp2 = require_timestamp();
|
|
12750
12750
|
var schema = [
|
|
12751
12751
|
map3.map,
|
|
12752
12752
|
seq.seq,
|
|
@@ -12766,9 +12766,9 @@ var require_schema3 = __commonJS({
|
|
|
12766
12766
|
omap.omap,
|
|
12767
12767
|
pairs.pairs,
|
|
12768
12768
|
set3.set,
|
|
12769
|
-
|
|
12770
|
-
|
|
12771
|
-
|
|
12769
|
+
timestamp2.intTime,
|
|
12770
|
+
timestamp2.floatTime,
|
|
12771
|
+
timestamp2.timestamp
|
|
12772
12772
|
];
|
|
12773
12773
|
exports.schema = schema;
|
|
12774
12774
|
}
|
|
@@ -12793,7 +12793,7 @@ var require_tags = __commonJS({
|
|
|
12793
12793
|
var pairs = require_pairs();
|
|
12794
12794
|
var schema$2 = require_schema3();
|
|
12795
12795
|
var set3 = require_set();
|
|
12796
|
-
var
|
|
12796
|
+
var timestamp2 = require_timestamp();
|
|
12797
12797
|
var schemas = /* @__PURE__ */ new Map([
|
|
12798
12798
|
["core", schema.schema],
|
|
12799
12799
|
["failsafe", [map3.map, seq.seq, string4.string]],
|
|
@@ -12807,11 +12807,11 @@ var require_tags = __commonJS({
|
|
|
12807
12807
|
float: float.float,
|
|
12808
12808
|
floatExp: float.floatExp,
|
|
12809
12809
|
floatNaN: float.floatNaN,
|
|
12810
|
-
floatTime:
|
|
12810
|
+
floatTime: timestamp2.floatTime,
|
|
12811
12811
|
int: int2.int,
|
|
12812
12812
|
intHex: int2.intHex,
|
|
12813
12813
|
intOct: int2.intOct,
|
|
12814
|
-
intTime:
|
|
12814
|
+
intTime: timestamp2.intTime,
|
|
12815
12815
|
map: map3.map,
|
|
12816
12816
|
merge: merge2.merge,
|
|
12817
12817
|
null: _null4.nullTag,
|
|
@@ -12819,7 +12819,7 @@ var require_tags = __commonJS({
|
|
|
12819
12819
|
pairs: pairs.pairs,
|
|
12820
12820
|
seq: seq.seq,
|
|
12821
12821
|
set: set3.set,
|
|
12822
|
-
timestamp:
|
|
12822
|
+
timestamp: timestamp2.timestamp
|
|
12823
12823
|
};
|
|
12824
12824
|
var coreKnownTags = {
|
|
12825
12825
|
"tag:yaml.org,2002:binary": binary.binary,
|
|
@@ -12827,7 +12827,7 @@ var require_tags = __commonJS({
|
|
|
12827
12827
|
"tag:yaml.org,2002:omap": omap.omap,
|
|
12828
12828
|
"tag:yaml.org,2002:pairs": pairs.pairs,
|
|
12829
12829
|
"tag:yaml.org,2002:set": set3.set,
|
|
12830
|
-
"tag:yaml.org,2002:timestamp":
|
|
12830
|
+
"tag:yaml.org,2002:timestamp": timestamp2.timestamp
|
|
12831
12831
|
};
|
|
12832
12832
|
function getTags(customTags, schemaName, addMergeTag) {
|
|
12833
12833
|
const schemaTags = schemas.get(schemaName);
|
|
@@ -13058,9 +13058,9 @@ var require_Document = __commonJS({
|
|
|
13058
13058
|
this.contents.add(value);
|
|
13059
13059
|
}
|
|
13060
13060
|
/** Adds a value to the document. */
|
|
13061
|
-
addIn(
|
|
13061
|
+
addIn(path88, value) {
|
|
13062
13062
|
if (assertCollection(this.contents))
|
|
13063
|
-
this.contents.addIn(
|
|
13063
|
+
this.contents.addIn(path88, value);
|
|
13064
13064
|
}
|
|
13065
13065
|
/**
|
|
13066
13066
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -13135,14 +13135,14 @@ var require_Document = __commonJS({
|
|
|
13135
13135
|
* Removes a value from the document.
|
|
13136
13136
|
* @returns `true` if the item was found and removed.
|
|
13137
13137
|
*/
|
|
13138
|
-
deleteIn(
|
|
13139
|
-
if (Collection.isEmptyPath(
|
|
13138
|
+
deleteIn(path88) {
|
|
13139
|
+
if (Collection.isEmptyPath(path88)) {
|
|
13140
13140
|
if (this.contents == null)
|
|
13141
13141
|
return false;
|
|
13142
13142
|
this.contents = null;
|
|
13143
13143
|
return true;
|
|
13144
13144
|
}
|
|
13145
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
13145
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path88) : false;
|
|
13146
13146
|
}
|
|
13147
13147
|
/**
|
|
13148
13148
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -13157,10 +13157,10 @@ var require_Document = __commonJS({
|
|
|
13157
13157
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
13158
13158
|
* `true` (collections are always returned intact).
|
|
13159
13159
|
*/
|
|
13160
|
-
getIn(
|
|
13161
|
-
if (Collection.isEmptyPath(
|
|
13160
|
+
getIn(path88, keepScalar) {
|
|
13161
|
+
if (Collection.isEmptyPath(path88))
|
|
13162
13162
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
13163
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
13163
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path88, keepScalar) : void 0;
|
|
13164
13164
|
}
|
|
13165
13165
|
/**
|
|
13166
13166
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -13171,10 +13171,10 @@ var require_Document = __commonJS({
|
|
|
13171
13171
|
/**
|
|
13172
13172
|
* Checks if the document includes a value at `path`.
|
|
13173
13173
|
*/
|
|
13174
|
-
hasIn(
|
|
13175
|
-
if (Collection.isEmptyPath(
|
|
13174
|
+
hasIn(path88) {
|
|
13175
|
+
if (Collection.isEmptyPath(path88))
|
|
13176
13176
|
return this.contents !== void 0;
|
|
13177
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
13177
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path88) : false;
|
|
13178
13178
|
}
|
|
13179
13179
|
/**
|
|
13180
13180
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -13191,13 +13191,13 @@ var require_Document = __commonJS({
|
|
|
13191
13191
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
13192
13192
|
* boolean to add/remove the item from the set.
|
|
13193
13193
|
*/
|
|
13194
|
-
setIn(
|
|
13195
|
-
if (Collection.isEmptyPath(
|
|
13194
|
+
setIn(path88, value) {
|
|
13195
|
+
if (Collection.isEmptyPath(path88)) {
|
|
13196
13196
|
this.contents = value;
|
|
13197
13197
|
} else if (this.contents == null) {
|
|
13198
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
13198
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path88), value);
|
|
13199
13199
|
} else if (assertCollection(this.contents)) {
|
|
13200
|
-
this.contents.setIn(
|
|
13200
|
+
this.contents.setIn(path88, value);
|
|
13201
13201
|
}
|
|
13202
13202
|
}
|
|
13203
13203
|
/**
|
|
@@ -13965,7 +13965,7 @@ var require_compose_collection = __commonJS({
|
|
|
13965
13965
|
"../cli/node_modules/yaml/dist/compose/compose-collection.js"(exports) {
|
|
13966
13966
|
"use strict";
|
|
13967
13967
|
var identity = require_identity();
|
|
13968
|
-
var
|
|
13968
|
+
var Scalar2 = require_Scalar();
|
|
13969
13969
|
var YAMLMap = require_YAMLMap();
|
|
13970
13970
|
var YAMLSeq = require_YAMLSeq();
|
|
13971
13971
|
var resolveBlockMap = require_resolve_block_map();
|
|
@@ -14014,7 +14014,7 @@ var require_compose_collection = __commonJS({
|
|
|
14014
14014
|
}
|
|
14015
14015
|
const coll = resolveCollection(CN, ctx, token2, onError, tagName, tag);
|
|
14016
14016
|
const res = tag.resolve?.(coll, (msg) => onError(tagToken, "TAG_RESOLVE_FAILED", msg), ctx.options) ?? coll;
|
|
14017
|
-
const node2 = identity.isNode(res) ? res : new
|
|
14017
|
+
const node2 = identity.isNode(res) ? res : new Scalar2.Scalar(res);
|
|
14018
14018
|
node2.range = coll.range;
|
|
14019
14019
|
node2.tag = tagName;
|
|
14020
14020
|
if (tag?.format)
|
|
@@ -14029,13 +14029,13 @@ var require_compose_collection = __commonJS({
|
|
|
14029
14029
|
var require_resolve_block_scalar = __commonJS({
|
|
14030
14030
|
"../cli/node_modules/yaml/dist/compose/resolve-block-scalar.js"(exports) {
|
|
14031
14031
|
"use strict";
|
|
14032
|
-
var
|
|
14032
|
+
var Scalar2 = require_Scalar();
|
|
14033
14033
|
function resolveBlockScalar(ctx, scalar, onError) {
|
|
14034
14034
|
const start = scalar.offset;
|
|
14035
14035
|
const header = parseBlockScalarHeader(scalar, ctx.options.strict, onError);
|
|
14036
14036
|
if (!header)
|
|
14037
14037
|
return { value: "", type: null, comment: "", range: [start, start, start] };
|
|
14038
|
-
const type = header.mode === ">" ?
|
|
14038
|
+
const type = header.mode === ">" ? Scalar2.Scalar.BLOCK_FOLDED : Scalar2.Scalar.BLOCK_LITERAL;
|
|
14039
14039
|
const lines = scalar.source ? splitLines(scalar.source) : [];
|
|
14040
14040
|
let chompStart = lines.length;
|
|
14041
14041
|
for (let i = lines.length - 1; i >= 0; --i) {
|
|
@@ -14097,7 +14097,7 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
14097
14097
|
onError(offset - content.length - (crlf ? 2 : 1), "BAD_INDENT", message);
|
|
14098
14098
|
indent2 = "";
|
|
14099
14099
|
}
|
|
14100
|
-
if (type ===
|
|
14100
|
+
if (type === Scalar2.Scalar.BLOCK_LITERAL) {
|
|
14101
14101
|
value += sep + indent2.slice(trimIndent) + content;
|
|
14102
14102
|
sep = "\n";
|
|
14103
14103
|
} else if (indent2.length > trimIndent || content[0] === " ") {
|
|
@@ -14212,7 +14212,7 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
14212
14212
|
var require_resolve_flow_scalar = __commonJS({
|
|
14213
14213
|
"../cli/node_modules/yaml/dist/compose/resolve-flow-scalar.js"(exports) {
|
|
14214
14214
|
"use strict";
|
|
14215
|
-
var
|
|
14215
|
+
var Scalar2 = require_Scalar();
|
|
14216
14216
|
var resolveEnd = require_resolve_end();
|
|
14217
14217
|
function resolveFlowScalar(scalar, strict, onError) {
|
|
14218
14218
|
const { offset, type, source: source2, end: end2 } = scalar;
|
|
@@ -14221,15 +14221,15 @@ var require_resolve_flow_scalar = __commonJS({
|
|
|
14221
14221
|
const _onError = (rel3, code, msg) => onError(offset + rel3, code, msg);
|
|
14222
14222
|
switch (type) {
|
|
14223
14223
|
case "scalar":
|
|
14224
|
-
_type =
|
|
14224
|
+
_type = Scalar2.Scalar.PLAIN;
|
|
14225
14225
|
value = plainValue(source2, _onError);
|
|
14226
14226
|
break;
|
|
14227
14227
|
case "single-quoted-scalar":
|
|
14228
|
-
_type =
|
|
14228
|
+
_type = Scalar2.Scalar.QUOTE_SINGLE;
|
|
14229
14229
|
value = singleQuotedValue(source2, _onError);
|
|
14230
14230
|
break;
|
|
14231
14231
|
case "double-quoted-scalar":
|
|
14232
|
-
_type =
|
|
14232
|
+
_type = Scalar2.Scalar.QUOTE_DOUBLE;
|
|
14233
14233
|
value = doubleQuotedValue(source2, _onError);
|
|
14234
14234
|
break;
|
|
14235
14235
|
/* istanbul ignore next should not happen */
|
|
@@ -14434,7 +14434,7 @@ var require_compose_scalar = __commonJS({
|
|
|
14434
14434
|
"../cli/node_modules/yaml/dist/compose/compose-scalar.js"(exports) {
|
|
14435
14435
|
"use strict";
|
|
14436
14436
|
var identity = require_identity();
|
|
14437
|
-
var
|
|
14437
|
+
var Scalar2 = require_Scalar();
|
|
14438
14438
|
var resolveBlockScalar = require_resolve_block_scalar();
|
|
14439
14439
|
var resolveFlowScalar = require_resolve_flow_scalar();
|
|
14440
14440
|
function composeScalar(ctx, token2, tagToken, onError) {
|
|
@@ -14452,11 +14452,11 @@ var require_compose_scalar = __commonJS({
|
|
|
14452
14452
|
let scalar;
|
|
14453
14453
|
try {
|
|
14454
14454
|
const res = tag.resolve(value, (msg) => onError(tagToken ?? token2, "TAG_RESOLVE_FAILED", msg), ctx.options);
|
|
14455
|
-
scalar = identity.isScalar(res) ? res : new
|
|
14455
|
+
scalar = identity.isScalar(res) ? res : new Scalar2.Scalar(res);
|
|
14456
14456
|
} catch (error62) {
|
|
14457
14457
|
const msg = error62 instanceof Error ? error62.message : String(error62);
|
|
14458
14458
|
onError(tagToken ?? token2, "TAG_RESOLVE_FAILED", msg);
|
|
14459
|
-
scalar = new
|
|
14459
|
+
scalar = new Scalar2.Scalar(value);
|
|
14460
14460
|
}
|
|
14461
14461
|
scalar.range = range;
|
|
14462
14462
|
scalar.source = value;
|
|
@@ -15158,9 +15158,9 @@ var require_cst_visit = __commonJS({
|
|
|
15158
15158
|
visit2.BREAK = BREAK;
|
|
15159
15159
|
visit2.SKIP = SKIP;
|
|
15160
15160
|
visit2.REMOVE = REMOVE;
|
|
15161
|
-
visit2.itemAtPath = (cst,
|
|
15161
|
+
visit2.itemAtPath = (cst, path88) => {
|
|
15162
15162
|
let item = cst;
|
|
15163
|
-
for (const [field2, index] of
|
|
15163
|
+
for (const [field2, index] of path88) {
|
|
15164
15164
|
const tok = item?.[field2];
|
|
15165
15165
|
if (tok && "items" in tok) {
|
|
15166
15166
|
item = tok.items[index];
|
|
@@ -15169,23 +15169,23 @@ var require_cst_visit = __commonJS({
|
|
|
15169
15169
|
}
|
|
15170
15170
|
return item;
|
|
15171
15171
|
};
|
|
15172
|
-
visit2.parentCollection = (cst,
|
|
15173
|
-
const parent = visit2.itemAtPath(cst,
|
|
15174
|
-
const field2 =
|
|
15172
|
+
visit2.parentCollection = (cst, path88) => {
|
|
15173
|
+
const parent = visit2.itemAtPath(cst, path88.slice(0, -1));
|
|
15174
|
+
const field2 = path88[path88.length - 1][0];
|
|
15175
15175
|
const coll = parent?.[field2];
|
|
15176
15176
|
if (coll && "items" in coll)
|
|
15177
15177
|
return coll;
|
|
15178
15178
|
throw new Error("Parent collection not found");
|
|
15179
15179
|
};
|
|
15180
|
-
function _visit(
|
|
15181
|
-
let ctrl = visitor(item,
|
|
15180
|
+
function _visit(path88, item, visitor) {
|
|
15181
|
+
let ctrl = visitor(item, path88);
|
|
15182
15182
|
if (typeof ctrl === "symbol")
|
|
15183
15183
|
return ctrl;
|
|
15184
15184
|
for (const field2 of ["key", "value"]) {
|
|
15185
15185
|
const token2 = item[field2];
|
|
15186
15186
|
if (token2 && "items" in token2) {
|
|
15187
15187
|
for (let i = 0; i < token2.items.length; ++i) {
|
|
15188
|
-
const ci = _visit(Object.freeze(
|
|
15188
|
+
const ci = _visit(Object.freeze(path88.concat([[field2, i]])), token2.items[i], visitor);
|
|
15189
15189
|
if (typeof ci === "number")
|
|
15190
15190
|
i = ci - 1;
|
|
15191
15191
|
else if (ci === BREAK)
|
|
@@ -15196,10 +15196,10 @@ var require_cst_visit = __commonJS({
|
|
|
15196
15196
|
}
|
|
15197
15197
|
}
|
|
15198
15198
|
if (typeof ctrl === "function" && field2 === "key")
|
|
15199
|
-
ctrl = ctrl(item,
|
|
15199
|
+
ctrl = ctrl(item, path88);
|
|
15200
15200
|
}
|
|
15201
15201
|
}
|
|
15202
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
15202
|
+
return typeof ctrl === "function" ? ctrl(item, path88) : ctrl;
|
|
15203
15203
|
}
|
|
15204
15204
|
exports.visit = visit2;
|
|
15205
15205
|
}
|
|
@@ -16831,7 +16831,7 @@ var require_public_api = __commonJS({
|
|
|
16831
16831
|
return docs;
|
|
16832
16832
|
return Object.assign([], { empty: true }, composer$1.streamInfo());
|
|
16833
16833
|
}
|
|
16834
|
-
function
|
|
16834
|
+
function parseDocument4(source2, options = {}) {
|
|
16835
16835
|
const { lineCounter: lineCounter2, prettyErrors } = parseOptions(options);
|
|
16836
16836
|
const parser$1 = new parser.Parser(lineCounter2?.addNewLine);
|
|
16837
16837
|
const composer$1 = new composer.Composer(options);
|
|
@@ -16857,7 +16857,7 @@ var require_public_api = __commonJS({
|
|
|
16857
16857
|
} else if (options === void 0 && reviver && typeof reviver === "object") {
|
|
16858
16858
|
options = reviver;
|
|
16859
16859
|
}
|
|
16860
|
-
const doc =
|
|
16860
|
+
const doc = parseDocument4(src, options);
|
|
16861
16861
|
if (!doc)
|
|
16862
16862
|
return null;
|
|
16863
16863
|
doc.warnings.forEach((warning) => log.warn(doc.options.logLevel, warning));
|
|
@@ -16893,7 +16893,7 @@ var require_public_api = __commonJS({
|
|
|
16893
16893
|
}
|
|
16894
16894
|
exports.parse = parse4;
|
|
16895
16895
|
exports.parseAllDocuments = parseAllDocuments;
|
|
16896
|
-
exports.parseDocument =
|
|
16896
|
+
exports.parseDocument = parseDocument4;
|
|
16897
16897
|
exports.stringify = stringify;
|
|
16898
16898
|
}
|
|
16899
16899
|
});
|
|
@@ -16909,7 +16909,7 @@ var require_dist = __commonJS({
|
|
|
16909
16909
|
var Alias = require_Alias();
|
|
16910
16910
|
var identity = require_identity();
|
|
16911
16911
|
var Pair = require_Pair();
|
|
16912
|
-
var
|
|
16912
|
+
var Scalar2 = require_Scalar();
|
|
16913
16913
|
var YAMLMap = require_YAMLMap();
|
|
16914
16914
|
var YAMLSeq = require_YAMLSeq();
|
|
16915
16915
|
var cst = require_cst();
|
|
@@ -16934,7 +16934,7 @@ var require_dist = __commonJS({
|
|
|
16934
16934
|
exports.isScalar = identity.isScalar;
|
|
16935
16935
|
exports.isSeq = identity.isSeq;
|
|
16936
16936
|
exports.Pair = Pair.Pair;
|
|
16937
|
-
exports.Scalar =
|
|
16937
|
+
exports.Scalar = Scalar2.Scalar;
|
|
16938
16938
|
exports.YAMLMap = YAMLMap.YAMLMap;
|
|
16939
16939
|
exports.YAMLSeq = YAMLSeq.YAMLSeq;
|
|
16940
16940
|
exports.CST = cst;
|
|
@@ -17080,15 +17080,15 @@ function parsePreviewBlocks(source2, file2 = "STUDIO.md") {
|
|
|
17080
17080
|
const masked = withoutCode(source2);
|
|
17081
17081
|
let open4;
|
|
17082
17082
|
const seen = /* @__PURE__ */ new Set();
|
|
17083
|
-
const
|
|
17083
|
+
const fail2 = (offset, id2, code, message, hint2) => problems.push({ file: file2, ...sourcePosition(source2, offset), path: id2 ? `previews.${id2}` : "previews", code, message, hint: hint2 });
|
|
17084
17084
|
for (const tag of masked.matchAll(/<\/?Preview\b[^>]*(?:>|$)/g)) {
|
|
17085
17085
|
const offset = tag.index, text4 = tag[0];
|
|
17086
17086
|
const closing = /^<\/Preview\s*>$/.test(text4);
|
|
17087
17087
|
if (closing) {
|
|
17088
|
-
if (!open4)
|
|
17088
|
+
if (!open4) fail2(offset, "", "preview-unexpected-close", "Preview has no opening tag", "Remove it or restore its opening tag.");
|
|
17089
17089
|
else {
|
|
17090
17090
|
const instructions = source2.slice(open4.content, offset).trim();
|
|
17091
|
-
if (!instructions)
|
|
17091
|
+
if (!instructions) fail2(open4.start, open4.id, "preview-empty", `Preview ${open4.id} is empty`, "Describe the requested output inside the block.");
|
|
17092
17092
|
blocks.push({ id: open4.id, instructions, start: open4.start, end: offset + text4.length });
|
|
17093
17093
|
open4 = void 0;
|
|
17094
17094
|
}
|
|
@@ -17096,15 +17096,15 @@ function parsePreviewBlocks(source2, file2 = "STUDIO.md") {
|
|
|
17096
17096
|
}
|
|
17097
17097
|
const opening = /^<Preview\s+id=(?:"([^"]*)"|'([^']*)')\s*>$/.exec(text4);
|
|
17098
17098
|
if (!opening || open4) {
|
|
17099
|
-
|
|
17099
|
+
fail2(offset, open4?.id ?? "", "preview-tag", "Malformed or nested Preview tag", 'Use one non-nested <Preview id="stable-id"> block with only id.');
|
|
17100
17100
|
continue;
|
|
17101
17101
|
}
|
|
17102
17102
|
const id2 = opening[1] ?? opening[2];
|
|
17103
|
-
if (!PREVIEW_ID.test(id2) || seen.has(id2))
|
|
17103
|
+
if (!PREVIEW_ID.test(id2) || seen.has(id2)) fail2(offset, id2, "preview-id", `Invalid or repeated Preview ID ${id2}`, "Use a unique lowercase ID with digits and dashes.");
|
|
17104
17104
|
seen.add(id2);
|
|
17105
17105
|
open4 = { id: id2, start: offset, content: offset + text4.length };
|
|
17106
17106
|
}
|
|
17107
|
-
if (open4)
|
|
17107
|
+
if (open4) fail2(open4.start, open4.id, "preview-unclosed", `Preview ${open4.id} is not closed`, "Add </Preview> after this block.");
|
|
17108
17108
|
return { blocks, problems };
|
|
17109
17109
|
}
|
|
17110
17110
|
var PREVIEW_ID;
|
|
@@ -17144,24 +17144,24 @@ function landSections(body, previews) {
|
|
|
17144
17144
|
}
|
|
17145
17145
|
function parseStudioFile(id2, source2, from, { requirePreviewCopy = false, requireLand = false } = {}) {
|
|
17146
17146
|
const problems = [];
|
|
17147
|
-
const
|
|
17147
|
+
const fail2 = (offset, path88, code, message, hint2) => problems.push({ file: from, ...sourcePosition(source2, offset), path: path88, code, message, hint: hint2 });
|
|
17148
17148
|
const result = () => ({ problem: problems.map((p) => `${p.file}:${p.line}:${p.column} ${p.path}: ${p.code} \u2014 ${p.message}. ${p.hint}`).join("\n"), problems });
|
|
17149
|
-
if (!STUDIO_ID.test(id2))
|
|
17149
|
+
if (!STUDIO_ID.test(id2)) fail2(0, "id", "studio-schema", `Invalid Studio ID ${id2}`, "Use lowercase letters, digits and dashes.");
|
|
17150
17150
|
const front = /^---\r?\n([^]*?)\r?\n---(?:\r?\n|$)/.exec(source2);
|
|
17151
17151
|
if (!front) {
|
|
17152
|
-
|
|
17152
|
+
fail2(0, "", "yaml-syntax", "Missing YAML frontmatter", "Enclose metadata between --- lines.");
|
|
17153
17153
|
return result();
|
|
17154
17154
|
}
|
|
17155
17155
|
const metaOffset = source2.indexOf("\n") + 1, bodyOffset = front[0].length;
|
|
17156
17156
|
const counter = new import_yaml3.LineCounter();
|
|
17157
17157
|
const document = (0, import_yaml3.parseDocument)(front[1], { lineCounter: counter, uniqueKeys: true, strict: true });
|
|
17158
|
-
for (const error62 of document.errors)
|
|
17158
|
+
for (const error62 of document.errors) fail2(metaOffset + (error62.pos[0] ?? 0), "", error62.code === "DUPLICATE_KEY" ? "yaml-duplicate-key" : "yaml-syntax", error62.message.split("\n")[0], "Correct the indicated YAML location.");
|
|
17159
17159
|
if (problems.length) return result();
|
|
17160
17160
|
let raw;
|
|
17161
17161
|
try {
|
|
17162
17162
|
raw = document.toJS({ maxAliasCount: 0 });
|
|
17163
17163
|
} catch {
|
|
17164
|
-
|
|
17164
|
+
fail2(metaOffset, "", "yaml-syntax", "YAML aliases are not supported", "Write metadata explicitly.");
|
|
17165
17165
|
return result();
|
|
17166
17166
|
}
|
|
17167
17167
|
if (!validate(raw)) {
|
|
@@ -17170,7 +17170,7 @@ function parseStudioFile(id2, source2, from, { requirePreviewCopy = false, requi
|
|
|
17170
17170
|
const key = error62.params.additionalProperty ?? error62.params.missingProperty;
|
|
17171
17171
|
if (key) parts.push(String(key));
|
|
17172
17172
|
const node2 = parts.length ? document.getIn(parts, true) : document.contents;
|
|
17173
|
-
|
|
17173
|
+
fail2(metaOffset + (node2?.range?.[0] ?? 0), parts.join("."), "studio-schema", `${parts.join(".") || "metadata"} ${error62.message}`, "Use only Studio metadata and previews: {id: {title?, description?, icon?}} with the declared field types.");
|
|
17174
17174
|
}
|
|
17175
17175
|
}
|
|
17176
17176
|
const body = source2.slice(bodyOffset);
|
|
@@ -17178,14 +17178,14 @@ function parseStudioFile(id2, source2, from, { requirePreviewCopy = false, requi
|
|
|
17178
17178
|
problems.push(...parsed.problems.map((p) => ({ ...p, line: p.line + source2.slice(0, bodyOffset).split("\n").length - 1 })));
|
|
17179
17179
|
if (problems.length) return result();
|
|
17180
17180
|
const map3 = raw.previews ?? {};
|
|
17181
|
-
for (const block of parsed.blocks) if (!Object.hasOwn(map3, block.id))
|
|
17182
|
-
for (const key of Object.keys(map3)) if (!parsed.blocks.some((b) => b.id === key))
|
|
17181
|
+
for (const block of parsed.blocks) if (!Object.hasOwn(map3, block.id)) fail2(bodyOffset + block.start, `previews.${block.id}`, "preview-metadata-missing", `Preview ${block.id} has no metadata entry`, "Add the ID under previews, using {} if needed.");
|
|
17182
|
+
for (const key of Object.keys(map3)) if (!parsed.blocks.some((b) => b.id === key)) fail2(metaOffset + (document.getIn(["previews", key], true)?.range?.[0] ?? 0), `previews.${key}`, "preview-body-missing", `Preview ${key} has no body`, "Add its block or remove unused metadata.");
|
|
17183
17183
|
if (requirePreviewCopy) for (const block of parsed.blocks) {
|
|
17184
17184
|
const metadata = Object.hasOwn(map3, block.id) ? map3[block.id] : void 0;
|
|
17185
17185
|
if (!metadata) continue;
|
|
17186
17186
|
for (const field2 of ["title", "description"]) for (const lang of ["en", "zh"]) {
|
|
17187
17187
|
if (metadata[field2]?.[lang]) continue;
|
|
17188
|
-
|
|
17188
|
+
fail2(
|
|
17189
17189
|
bodyOffset + block.start,
|
|
17190
17190
|
`previews.${block.id}.${field2}.${lang}`,
|
|
17191
17191
|
"preview-display-missing",
|
|
@@ -17196,10 +17196,10 @@ function parseStudioFile(id2, source2, from, { requirePreviewCopy = false, requi
|
|
|
17196
17196
|
}
|
|
17197
17197
|
if (requireLand) {
|
|
17198
17198
|
const sections = landSections(body, parsed.blocks);
|
|
17199
|
-
if (!sections.length)
|
|
17199
|
+
if (!sections.length) fail2(bodyOffset, "Land", "studio-land-missing", "Missing ## Land section", "Add ## Land to the Studio body and describe delivery, checks and what to record.");
|
|
17200
17200
|
for (const [index, { offset, empty }] of sections.entries()) {
|
|
17201
|
-
if (index)
|
|
17202
|
-
if (empty)
|
|
17201
|
+
if (index) fail2(bodyOffset + offset, "Land", "studio-land-duplicate", "Repeated ## Land section", "Combine delivery instructions under one ## Land heading.");
|
|
17202
|
+
if (empty) fail2(bodyOffset + offset, "Land", "studio-land-empty", "The ## Land section is empty", "Describe delivery, checks and what to record under ## Land.");
|
|
17203
17203
|
}
|
|
17204
17204
|
}
|
|
17205
17205
|
if (problems.length) return result();
|
|
@@ -17314,51 +17314,51 @@ function checkStudioFiles(value, official = false, checks = {}) {
|
|
|
17314
17314
|
}
|
|
17315
17315
|
function inspect(value, official, { allowLegacyPreviewCopy, allowLegacyLand } = {}) {
|
|
17316
17316
|
const problems = [];
|
|
17317
|
-
const
|
|
17317
|
+
const fail2 = (file2, reason, tooLarge = false) => {
|
|
17318
17318
|
problems.push({ file: file2, reason, ...tooLarge ? { tooLarge } : {} });
|
|
17319
17319
|
return { problems };
|
|
17320
17320
|
};
|
|
17321
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return
|
|
17321
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return fail2("files", "must be an object of path \u2192 text");
|
|
17322
17322
|
const files = Object.fromEntries(Object.entries(value).filter(([file2]) => file2 !== VERSION_FILE));
|
|
17323
17323
|
const entries2 = Object.entries(files);
|
|
17324
|
-
if (entries2.length > FILE_LIMITS.count) return
|
|
17324
|
+
if (entries2.length > FILE_LIMITS.count) return fail2("files", `holds at most ${FILE_LIMITS.count} files`, true);
|
|
17325
17325
|
let total = 0;
|
|
17326
17326
|
const skills = /* @__PURE__ */ new Set();
|
|
17327
17327
|
for (const [file2, text4] of entries2) {
|
|
17328
17328
|
if (typeof text4 !== "string" || text4.includes("\0")) {
|
|
17329
|
-
|
|
17329
|
+
fail2(file2, "is not a text file");
|
|
17330
17330
|
continue;
|
|
17331
17331
|
}
|
|
17332
17332
|
if (file2.length > FILE_LIMITS.path) {
|
|
17333
|
-
|
|
17333
|
+
fail2(file2, `the path is longer than ${FILE_LIMITS.path} characters`);
|
|
17334
17334
|
continue;
|
|
17335
17335
|
}
|
|
17336
17336
|
const size = bytes(text4);
|
|
17337
|
-
if (size > FILE_LIMITS.file) return
|
|
17337
|
+
if (size > FILE_LIMITS.file) return fail2(file2, `is larger than ${FILE_LIMITS.file / KB} KB`, true);
|
|
17338
17338
|
total += size;
|
|
17339
|
-
if (total > FILE_LIMITS.total) return
|
|
17339
|
+
if (total > FILE_LIMITS.total) return fail2("files", `are larger than ${FILE_LIMITS.total / KB / KB} MB together`, true);
|
|
17340
17340
|
if (file2 === STUDIO_FILE || file2 === CARD_TEMPLATE_FILE) continue;
|
|
17341
17341
|
if (official && file2 === MCP_FILE) {
|
|
17342
17342
|
const problem2 = mcpProblem(text4);
|
|
17343
|
-
if (problem2)
|
|
17343
|
+
if (problem2) fail2(file2, problem2);
|
|
17344
17344
|
continue;
|
|
17345
17345
|
}
|
|
17346
17346
|
if (official && isAboutFile(file2)) continue;
|
|
17347
17347
|
if (official && file2.startsWith("skills/")) {
|
|
17348
|
-
if (!folderPath(file2, "skills"))
|
|
17348
|
+
if (!folderPath(file2, "skills")) fail2(file2, "is not inside skills/<name>/");
|
|
17349
17349
|
else skills.add(file2.split("/")[1]);
|
|
17350
17350
|
continue;
|
|
17351
17351
|
}
|
|
17352
17352
|
if (isSharedFile(file2)) continue;
|
|
17353
17353
|
if (/^(?:references|scripts)\//.test(file2) && file2.split("/").every((p) => SEGMENT.test(p) && p !== "." && p !== "..")) continue;
|
|
17354
|
-
|
|
17354
|
+
fail2(file2, `use ${STUDIO_FILE}, ${CARD_TEMPLATE_FILE}, references/, scripts/ or shared/`);
|
|
17355
17355
|
}
|
|
17356
17356
|
for (const name of skills) {
|
|
17357
|
-
if (files[`skills/${name}/SKILL.md`] === void 0)
|
|
17357
|
+
if (files[`skills/${name}/SKILL.md`] === void 0) fail2(`skills/${name}/SKILL.md`, "is missing");
|
|
17358
17358
|
}
|
|
17359
17359
|
const source2 = files[STUDIO_FILE];
|
|
17360
17360
|
const read5 = typeof source2 === "string" ? parseStudioFile("studio", source2, STUDIO_FILE, { requirePreviewCopy: !official && !allowLegacyPreviewCopy, requireLand: !allowLegacyLand }) : null;
|
|
17361
|
-
if (!read5)
|
|
17361
|
+
if (!read5) fail2(STUDIO_FILE, "is missing");
|
|
17362
17362
|
else if ("problem" in read5) for (const problem2 of read5.problems) problems.push({ ...problem2, reason: problem2.message });
|
|
17363
17363
|
if (!read5 || "problem" in read5) return { problems };
|
|
17364
17364
|
const def = read5.def;
|
|
@@ -17387,15 +17387,39 @@ function inspect(value, official, { allowLegacyPreviewCopy, allowLegacyLand } =
|
|
|
17387
17387
|
}
|
|
17388
17388
|
return { problems, def, files };
|
|
17389
17389
|
}
|
|
17390
|
+
function cloneFiles(files, name) {
|
|
17391
|
+
const refused = Object.keys(files).find((file2) => file2 === MCP_FILE || file2.startsWith("skills/"));
|
|
17392
|
+
if (refused) return { refused: refused === MCP_FILE ? MCP_FILE : `${refused.split("/").slice(0, 2).join("/")}/` };
|
|
17393
|
+
const kept2 = Object.fromEntries(Object.entries(files).filter(([file2]) => file2 !== VERSION_FILE && !isAboutFile(file2)));
|
|
17394
|
+
const source2 = kept2[STUDIO_FILE] ?? "";
|
|
17395
|
+
const read5 = parseStudioFile("studio", source2, STUDIO_FILE);
|
|
17396
|
+
if ("problem" in read5) return { files: kept2 };
|
|
17397
|
+
kept2[STUDIO_FILE] = source2.replace(/^---\r?\n([^]*?)\r?\n---(?:\r?\n|$)/, (_front, yaml) => {
|
|
17398
|
+
const document = (0, import_yaml5.parseDocument)(yaml);
|
|
17399
|
+
const quoted = (value) => Object.assign(new import_yaml5.Scalar(value), { type: import_yaml5.Scalar.QUOTE_DOUBLE });
|
|
17400
|
+
document.set("name", quoted(name ?? `${read5.def.name} (copy)`));
|
|
17401
|
+
if (name) document.delete("names");
|
|
17402
|
+
else if (read5.def.names) {
|
|
17403
|
+
for (const [lang, text4] of Object.entries(read5.def.names)) {
|
|
17404
|
+
document.setIn(["names", lang], quoted(lang === "zh" ? `${text4}\uFF08\u526F\u672C\uFF09` : `${text4} (copy)`));
|
|
17405
|
+
}
|
|
17406
|
+
}
|
|
17407
|
+
return `---
|
|
17408
|
+
${document.toString({ lineWidth: 0 })}---
|
|
17409
|
+
`;
|
|
17410
|
+
});
|
|
17411
|
+
return { files: kept2 };
|
|
17412
|
+
}
|
|
17390
17413
|
function previewCatalog(files) {
|
|
17391
17414
|
const read5 = parseStudioFile("studio", files[STUDIO_FILE] ?? "", STUDIO_FILE);
|
|
17392
17415
|
if ("problem" in read5) throw new Error(read5.problem);
|
|
17393
17416
|
return read5.def.previews;
|
|
17394
17417
|
}
|
|
17395
|
-
var STUDIO_FILE, MCP_FILE, CARD_TEMPLATE_FILE, RULES_FILE, VERSION_FILE, versionText, KB, FILE_LIMITS, officialId, hashInput, landsOf, SEGMENT, isAboutFile, bytes, isSharedFile, studioFilesProblems;
|
|
17418
|
+
var import_yaml5, STUDIO_FILE, MCP_FILE, CARD_TEMPLATE_FILE, RULES_FILE, VERSION_FILE, versionText, KB, FILE_LIMITS, officialId, hashInput, landsOf, SEGMENT, isAboutFile, bytes, isSharedFile, studioFilesProblems;
|
|
17396
17419
|
var init_studio_files = __esm({
|
|
17397
17420
|
"../cli/src/lib/shared/studio-files.ts"() {
|
|
17398
17421
|
"use strict";
|
|
17422
|
+
import_yaml5 = __toESM(require_dist(), 1);
|
|
17399
17423
|
init_studio_def();
|
|
17400
17424
|
init_preview_blocks();
|
|
17401
17425
|
init_guide_topics();
|
|
@@ -17548,7 +17572,7 @@ function cloudStudio(name) {
|
|
|
17548
17572
|
if (/^wf-/.test(name)) return name.replace("-", "_");
|
|
17549
17573
|
return `wf_builtin_${name.replace(/-/g, "_")}`;
|
|
17550
17574
|
}
|
|
17551
|
-
async function call(method, route2, body, key) {
|
|
17575
|
+
async function call(method, route2, body, key, { allowResultError = false } = {}) {
|
|
17552
17576
|
if (!cloudConfigured()) return { ok: false, error: NOT_CONFIGURED, code: "bad_request" };
|
|
17553
17577
|
const token2 = await accessToken();
|
|
17554
17578
|
if (!token2.ok) {
|
|
@@ -17560,17 +17584,17 @@ async function call(method, route2, body, key) {
|
|
|
17560
17584
|
method,
|
|
17561
17585
|
headers: {
|
|
17562
17586
|
authorization: `Bearer ${token2.token}`,
|
|
17563
|
-
...body ? { "content-type": "application/json" } : {},
|
|
17587
|
+
...body ? { "content-type": body instanceof Blob ? body.type : "application/json" } : {},
|
|
17564
17588
|
...key ? { "idempotency-key": key } : {}
|
|
17565
17589
|
},
|
|
17566
|
-
...body ? { body: JSON.stringify(body) } : {},
|
|
17590
|
+
...body ? { body: body instanceof Blob ? body : JSON.stringify(body) } : {},
|
|
17567
17591
|
signal: AbortSignal.timeout(2e4)
|
|
17568
17592
|
});
|
|
17569
17593
|
} catch (e) {
|
|
17570
17594
|
return { ok: false, error: `Cloud could not be reached: ${e instanceof Error ? e.message : String(e)}`, code: "unreachable", retryable: true };
|
|
17571
17595
|
}
|
|
17572
17596
|
const parsed = await readCloudJson(response);
|
|
17573
|
-
const problem2 = cloudProblem(response, parsed) ?? (isRecord(parsed) ? null : invalidResponse("a valid JSON response"));
|
|
17597
|
+
const problem2 = (response.ok && allowResultError ? null : cloudProblem(response, parsed)) ?? (isRecord(parsed) ? null : invalidResponse("a valid JSON response"));
|
|
17574
17598
|
if (problem2) return { ok: false, ...problem2, error: problem2.message };
|
|
17575
17599
|
return { ok: true, value: parsed, replayed: response.headers.get("idempotent-replayed") === "true" };
|
|
17576
17600
|
}
|
|
@@ -18785,8 +18809,8 @@ var init_card_lines = __esm({
|
|
|
18785
18809
|
});
|
|
18786
18810
|
|
|
18787
18811
|
// ../cli/src/lib/shared/card-structure.ts
|
|
18788
|
-
function problem(file2, line,
|
|
18789
|
-
return { file: file2, line, column: 1, path:
|
|
18812
|
+
function problem(file2, line, path88, code, message, hint2) {
|
|
18813
|
+
return { file: file2, line, column: 1, path: path88, code, message, hint: hint2 };
|
|
18790
18814
|
}
|
|
18791
18815
|
function cardHeaderProblems(file2, text4, context, strict = false) {
|
|
18792
18816
|
const lines = text4.replace(/\r\n/g, "\n").split("\n");
|
|
@@ -18794,7 +18818,7 @@ function cardHeaderProblems(file2, text4, context, strict = false) {
|
|
|
18794
18818
|
const { meta: meta3 } = parseFrontmatter(text4);
|
|
18795
18819
|
const fields2 = /* @__PURE__ */ new Map();
|
|
18796
18820
|
const problems = [];
|
|
18797
|
-
const add2 = (line,
|
|
18821
|
+
const add2 = (line, path88, code, message, hint2) => problems.push(problem(file2, line, path88, code, message, hint2));
|
|
18798
18822
|
if (!meta3) {
|
|
18799
18823
|
add2(1, "frontmatter", "frontmatter", "Expected a leading --- frontmatter block and its closing ---", "Restore both delimiters.");
|
|
18800
18824
|
return { lines, end: end2, meta: meta3, problems, fields: fields2 };
|
|
@@ -20115,10 +20139,10 @@ function mergeDefs(...defs) {
|
|
|
20115
20139
|
function cloneDef(schema) {
|
|
20116
20140
|
return mergeDefs(schema._zod.def);
|
|
20117
20141
|
}
|
|
20118
|
-
function getElementAtPath(obj3,
|
|
20119
|
-
if (!
|
|
20142
|
+
function getElementAtPath(obj3, path88) {
|
|
20143
|
+
if (!path88)
|
|
20120
20144
|
return obj3;
|
|
20121
|
-
return
|
|
20145
|
+
return path88.reduce((acc, key) => acc?.[key], obj3);
|
|
20122
20146
|
}
|
|
20123
20147
|
function promiseAllObject(promisesObj) {
|
|
20124
20148
|
const keys = Object.keys(promisesObj);
|
|
@@ -20377,11 +20401,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
20377
20401
|
}
|
|
20378
20402
|
return false;
|
|
20379
20403
|
}
|
|
20380
|
-
function prefixIssues(
|
|
20404
|
+
function prefixIssues(path88, issues) {
|
|
20381
20405
|
return issues.map((iss) => {
|
|
20382
20406
|
var _a3;
|
|
20383
20407
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
20384
|
-
iss.path.unshift(
|
|
20408
|
+
iss.path.unshift(path88);
|
|
20385
20409
|
return iss;
|
|
20386
20410
|
});
|
|
20387
20411
|
}
|
|
@@ -20914,16 +20938,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
|
|
|
20914
20938
|
}
|
|
20915
20939
|
function formatError(error62, mapper = (issue2) => issue2.message) {
|
|
20916
20940
|
const fieldErrors = { _errors: [] };
|
|
20917
|
-
const processError = (error63,
|
|
20941
|
+
const processError = (error63, path88 = []) => {
|
|
20918
20942
|
for (const issue2 of error63.issues) {
|
|
20919
20943
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
20920
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
20944
|
+
issue2.errors.map((issues) => processError({ issues }, [...path88, ...issue2.path]));
|
|
20921
20945
|
} else if (issue2.code === "invalid_key") {
|
|
20922
|
-
processError({ issues: issue2.issues }, [...
|
|
20946
|
+
processError({ issues: issue2.issues }, [...path88, ...issue2.path]);
|
|
20923
20947
|
} else if (issue2.code === "invalid_element") {
|
|
20924
|
-
processError({ issues: issue2.issues }, [...
|
|
20948
|
+
processError({ issues: issue2.issues }, [...path88, ...issue2.path]);
|
|
20925
20949
|
} else {
|
|
20926
|
-
const fullpath = [...
|
|
20950
|
+
const fullpath = [...path88, ...issue2.path];
|
|
20927
20951
|
if (fullpath.length === 0) {
|
|
20928
20952
|
fieldErrors._errors.push(mapper(issue2));
|
|
20929
20953
|
} else {
|
|
@@ -20962,17 +20986,17 @@ function formatError(error62, mapper = (issue2) => issue2.message) {
|
|
|
20962
20986
|
}
|
|
20963
20987
|
function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
20964
20988
|
const result = { errors: [] };
|
|
20965
|
-
const processError = (error63,
|
|
20989
|
+
const processError = (error63, path88 = []) => {
|
|
20966
20990
|
var _a3;
|
|
20967
20991
|
for (const issue2 of error63.issues) {
|
|
20968
20992
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
20969
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
20993
|
+
issue2.errors.map((issues) => processError({ issues }, [...path88, ...issue2.path]));
|
|
20970
20994
|
} else if (issue2.code === "invalid_key") {
|
|
20971
|
-
processError({ issues: issue2.issues }, [...
|
|
20995
|
+
processError({ issues: issue2.issues }, [...path88, ...issue2.path]);
|
|
20972
20996
|
} else if (issue2.code === "invalid_element") {
|
|
20973
|
-
processError({ issues: issue2.issues }, [...
|
|
20997
|
+
processError({ issues: issue2.issues }, [...path88, ...issue2.path]);
|
|
20974
20998
|
} else {
|
|
20975
|
-
const fullpath = [...
|
|
20999
|
+
const fullpath = [...path88, ...issue2.path];
|
|
20976
21000
|
if (fullpath.length === 0) {
|
|
20977
21001
|
result.errors.push(mapper(issue2));
|
|
20978
21002
|
continue;
|
|
@@ -21011,8 +21035,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
|
21011
21035
|
}
|
|
21012
21036
|
function toDotPath(_path) {
|
|
21013
21037
|
const segs = [];
|
|
21014
|
-
const
|
|
21015
|
-
for (const seg of
|
|
21038
|
+
const path88 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
21039
|
+
for (const seg of path88) {
|
|
21016
21040
|
if (typeof seg === "number")
|
|
21017
21041
|
segs.push(`[${seg}]`);
|
|
21018
21042
|
else if (typeof seg === "symbol")
|
|
@@ -39044,13 +39068,13 @@ function resolveRef(ref, ctx) {
|
|
|
39044
39068
|
if (!ref.startsWith("#")) {
|
|
39045
39069
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
39046
39070
|
}
|
|
39047
|
-
const
|
|
39048
|
-
if (
|
|
39071
|
+
const path88 = ref.slice(1).split("/").filter(Boolean);
|
|
39072
|
+
if (path88.length === 0) {
|
|
39049
39073
|
return ctx.rootSchema;
|
|
39050
39074
|
}
|
|
39051
39075
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
39052
|
-
if (
|
|
39053
|
-
const key =
|
|
39076
|
+
if (path88[0] === defsKey) {
|
|
39077
|
+
const key = path88[1] === void 0 ? void 0 : decodeJSONPointerSegment(path88[1]);
|
|
39054
39078
|
if (!key || !ctx.defs[key]) {
|
|
39055
39079
|
throw new Error(`Reference not found: ${ref}`);
|
|
39056
39080
|
}
|
|
@@ -40818,8 +40842,8 @@ var init_package = __esm({
|
|
|
40818
40842
|
"../cli/package.json"() {
|
|
40819
40843
|
package_default = {
|
|
40820
40844
|
name: "wildcrane",
|
|
40821
|
-
version: "0.11.
|
|
40822
|
-
akbContract:
|
|
40845
|
+
version: "0.11.98",
|
|
40846
|
+
akbContract: 32,
|
|
40823
40847
|
canonicalCommands: true,
|
|
40824
40848
|
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.",
|
|
40825
40849
|
keywords: [
|
|
@@ -40907,8 +40931,8 @@ function readCache() {
|
|
|
40907
40931
|
const file2 = cacheFile();
|
|
40908
40932
|
let stamp3;
|
|
40909
40933
|
try {
|
|
40910
|
-
const
|
|
40911
|
-
stamp3 = `${
|
|
40934
|
+
const stat2 = fs30.statSync(file2);
|
|
40935
|
+
stamp3 = `${stat2.mtimeMs}:${stat2.size}`;
|
|
40912
40936
|
} catch {
|
|
40913
40937
|
return void 0;
|
|
40914
40938
|
}
|
|
@@ -42303,14 +42327,14 @@ function collectSources(sources2, card, host2) {
|
|
|
42303
42327
|
const active2 = /* @__PURE__ */ new Set();
|
|
42304
42328
|
const out = [];
|
|
42305
42329
|
const visit2 = (src, types, owner, partial2 = false) => {
|
|
42306
|
-
const [
|
|
42330
|
+
const [path88] = splitFileReference(src);
|
|
42307
42331
|
let resolved;
|
|
42308
42332
|
try {
|
|
42309
|
-
resolved = host2.resolve(
|
|
42333
|
+
resolved = host2.resolve(path88, owner);
|
|
42310
42334
|
} catch (error62) {
|
|
42311
42335
|
if (owner !== card) return { key: null, error: why(error62) };
|
|
42312
42336
|
if (!nodes.has(src)) {
|
|
42313
|
-
const node3 = { key: src, file: null, kind: kindAt(
|
|
42337
|
+
const node3 = { key: src, file: null, kind: kindAt(path88, types), error: why(error62), problems: [], dependencies: /* @__PURE__ */ new Map(), aliases: /* @__PURE__ */ new Set([src]) };
|
|
42314
42338
|
nodes.set(src, node3);
|
|
42315
42339
|
out.push(node3);
|
|
42316
42340
|
}
|
|
@@ -42578,8 +42602,8 @@ function validateSpec(file2, text4, id2, context) {
|
|
|
42578
42602
|
if (/^\s*<Storyboard\b/.test(line) && (storyboardTag(line) === null || lines[i - 1]?.trim() || lines[i + 1]?.trim())) {
|
|
42579
42603
|
add2(i + 1, "storyboard-block", 'Put one self-closing <Storyboard src=".assets/<card id>/storyboard.json" /> tag on its own line, with blank lines around it.');
|
|
42580
42604
|
}
|
|
42581
|
-
if (/^\s*<Studio\b/.test(line) && (studioTag(line)
|
|
42582
|
-
add2(i + 1, "studio-block", 'Put one self-closing <Studio src=".assets/<card id>/studio.json"
|
|
42605
|
+
if (/^\s*<Studio\b/.test(line) && (!studioTag(line) || lines[i - 1]?.trim() || lines[i + 1]?.trim())) {
|
|
42606
|
+
add2(i + 1, "studio-block", 'Put one self-closing <Studio src=".assets/<card id>/studio-review/review.json" /> tag on its own line, with blank lines around it.');
|
|
42583
42607
|
}
|
|
42584
42608
|
if (/^\s*<Compare\b/.test(line)) {
|
|
42585
42609
|
const attrs = compareAttrs(line);
|
|
@@ -42717,7 +42741,7 @@ function validateStoryboards(file2, id2, text4) {
|
|
|
42717
42741
|
["Studio", studioTag, "studio-src", "Fix the path or freeze the draft with `akb studio preview <card> --folder <draft> --base <baseline>` and use the returned Studio tag."]
|
|
42718
42742
|
]) {
|
|
42719
42743
|
for (const marker of storyboardMarkers(text4, tagOf)) {
|
|
42720
|
-
const named2 = assetName(marker.src, id2, ["json"]);
|
|
42744
|
+
const named2 = assetName(marker.src, id2, ["json"], tag === "Studio");
|
|
42721
42745
|
const add2 = (message) => errors.push({ file: rel(file2), line: marker.line, rule, message });
|
|
42722
42746
|
if (!("name" in named2)) add2(`${tag} src is ${named2.actual}; expected ${named2.expected}.`);
|
|
42723
42747
|
else if (!inside(dir, named2.name)) add2(`${tag} src ${marker.src} names no file in this card's asset folder. ${fix}`);
|
|
@@ -44514,8 +44538,8 @@ function keep(file2, answer2) {
|
|
|
44514
44538
|
}
|
|
44515
44539
|
function keyOf(file2) {
|
|
44516
44540
|
const real2 = fs49.realpathSync.native(file2);
|
|
44517
|
-
const
|
|
44518
|
-
return `${real2}|${
|
|
44541
|
+
const stat2 = fs49.statSync(real2);
|
|
44542
|
+
return `${real2}|${stat2.size}|${stat2.mtimeMs}`;
|
|
44519
44543
|
}
|
|
44520
44544
|
function known(file2, maxAge) {
|
|
44521
44545
|
const answer2 = kept()[file2];
|
|
@@ -44616,8 +44640,8 @@ function uniqueIds(list3) {
|
|
|
44616
44640
|
function modelsIn(file2, pick3, salt = "") {
|
|
44617
44641
|
let stamp3;
|
|
44618
44642
|
try {
|
|
44619
|
-
const
|
|
44620
|
-
stamp3 = `${
|
|
44643
|
+
const stat2 = statSync(file2);
|
|
44644
|
+
stamp3 = `${stat2.mtimeMs}:${stat2.size}:${salt}`;
|
|
44621
44645
|
} catch {
|
|
44622
44646
|
return cached2.get(file2)?.found ?? [];
|
|
44623
44647
|
}
|
|
@@ -45099,7 +45123,7 @@ function connect(stdout, stdin, onCall, dialect = {}) {
|
|
|
45099
45123
|
const closed2 = (why2) => {
|
|
45100
45124
|
if (gone) return;
|
|
45101
45125
|
gone = why2;
|
|
45102
|
-
for (const { fail } of waiting.values())
|
|
45126
|
+
for (const { fail: fail2 } of waiting.values()) fail2(why2);
|
|
45103
45127
|
waiting.clear();
|
|
45104
45128
|
};
|
|
45105
45129
|
stdout.on("data", (chunk) => {
|
|
@@ -45136,8 +45160,8 @@ function connect(stdout, stdin, onCall, dialect = {}) {
|
|
|
45136
45160
|
call(method, params) {
|
|
45137
45161
|
if (gone) return Promise.reject(gone);
|
|
45138
45162
|
const id2 = dialect.stringIds ? String(nextId++) : nextId++;
|
|
45139
|
-
return new Promise((ok,
|
|
45140
|
-
waiting.set(String(id2), { ok, fail });
|
|
45163
|
+
return new Promise((ok, fail2) => {
|
|
45164
|
+
waiting.set(String(id2), { ok, fail: fail2 });
|
|
45141
45165
|
send({ id: id2, method, params });
|
|
45142
45166
|
});
|
|
45143
45167
|
},
|
|
@@ -45230,8 +45254,8 @@ var init_tail = __esm({
|
|
|
45230
45254
|
import fs53 from "node:fs";
|
|
45231
45255
|
function whereHint(update2, title) {
|
|
45232
45256
|
const locations = Array.isArray(update2.locations) ? update2.locations : [];
|
|
45233
|
-
const
|
|
45234
|
-
return
|
|
45257
|
+
const path88 = str4(obj2(locations[0]).path);
|
|
45258
|
+
return path88 && !title.includes(path88) ? hint(path88) : "";
|
|
45235
45259
|
}
|
|
45236
45260
|
function saidBy(update2) {
|
|
45237
45261
|
const content = Array.isArray(update2.content) ? update2.content : [];
|
|
@@ -45892,7 +45916,7 @@ function createAntigravityRenderer(expectedSession, cwd = process.cwd()) {
|
|
|
45892
45916
|
const calls = /* @__PURE__ */ new Set();
|
|
45893
45917
|
const closed2 = /* @__PURE__ */ new Set();
|
|
45894
45918
|
const events = createEventCollector();
|
|
45895
|
-
const
|
|
45919
|
+
const fail2 = (reason, code = "provider_failed") => {
|
|
45896
45920
|
failure2 = failureHint(reason);
|
|
45897
45921
|
classified = makeFailure("runtime", failure2, { code, detail: reason });
|
|
45898
45922
|
events.error(failure2);
|
|
@@ -45907,7 +45931,7 @@ function createAntigravityRenderer(expectedSession, cwd = process.cwd()) {
|
|
|
45907
45931
|
if (e.event === "init") {
|
|
45908
45932
|
const got = str4(e.conversation_id);
|
|
45909
45933
|
if (expectedSession && got !== expectedSession) {
|
|
45910
|
-
|
|
45934
|
+
fail2(translating() ? "Antigravity \u672A\u7EED\u63A5\u6307\u5B9A\u4F1A\u8BDD\uFF0C\u8BF7\u68C0\u67E5\u672C\u673A\u539F\u4F1A\u8BDD\u540E\u91CD\u8BD5\u3002" : "Antigravity did not resume the requested conversation.", "session_mismatch");
|
|
45911
45935
|
return "";
|
|
45912
45936
|
}
|
|
45913
45937
|
session = got || session;
|
|
@@ -45986,7 +46010,7 @@ ${imageError(target, reason || str4(step.state))}
|
|
|
45986
46010
|
if (e.event === "result") {
|
|
45987
46011
|
const result = obj2(e.result);
|
|
45988
46012
|
if (expectedSession && str4(result.conversation_id) && result.conversation_id !== expectedSession) {
|
|
45989
|
-
|
|
46013
|
+
fail2(translating() ? "Antigravity \u672A\u7EED\u63A5\u6307\u5B9A\u4F1A\u8BDD\uFF0C\u8BF7\u68C0\u67E5\u672C\u673A\u539F\u4F1A\u8BDD\u540E\u91CD\u8BD5\u3002" : "Antigravity did not resume the requested conversation.", "session_mismatch");
|
|
45990
46014
|
terminal = true;
|
|
45991
46015
|
return "";
|
|
45992
46016
|
}
|
|
@@ -46003,9 +46027,9 @@ ${imageError(target, reason || str4(step.state))}
|
|
|
46003
46027
|
if (imageFailure) events.error(imageFailure);
|
|
46004
46028
|
readImages.clear();
|
|
46005
46029
|
imageErrors.clear();
|
|
46006
|
-
if (Array.isArray(result.denied_actions) && result.denied_actions.length)
|
|
46030
|
+
if (Array.isArray(result.denied_actions) && result.denied_actions.length) fail2(translating() ? "Antigravity \u6743\u9650\u62D2\u7EDD\uFF0C\u8BF7\u68C0\u67E5\u6743\u9650\u89C4\u5219\u540E\u91CD\u8BD5\u3002" : "Antigravity permission denied. Check permission rules, then retry.", "permission_denied");
|
|
46007
46031
|
else if (!failure2 && (typeof result.response !== "string" || result.status !== "SUCCESS" || str4(result.error) || result.finished_reason && result.finished_reason !== "completed" && result.finished_reason !== "success")) {
|
|
46008
|
-
|
|
46032
|
+
fail2(result.status === "CANCELED" ? `Antigravity: CANCELED${result.error ? `: ${str4(result.error)}` : ""}` : str4(result.error) || `Antigravity: ${str4(result.status) || "missing status"}`);
|
|
46009
46033
|
}
|
|
46010
46034
|
events.end();
|
|
46011
46035
|
turnUsage = zero();
|
|
@@ -46032,7 +46056,7 @@ ${imageError(target, reason || str4(step.state))}
|
|
|
46032
46056
|
if (!terminal) {
|
|
46033
46057
|
incomplete = true;
|
|
46034
46058
|
const diagnostics = [stderr.trim(), offStream?.match(/^(?:error:|rpc error:|API error\b)/i) ? offStream : void 0];
|
|
46035
|
-
if (!failure2)
|
|
46059
|
+
if (!failure2) fail2(diagnostics.find(Boolean) || (translating() ? "Antigravity \u672A\u8FD4\u56DE\u6700\u7EC8\u7ED3\u679C\uFF0C\u8BF7\u68C0\u67E5\u65E5\u5FD7\u540E\u91CD\u8BD5\u3002" : "Antigravity returned no final result. Check the log, then retry."), "result_missing");
|
|
46036
46060
|
}
|
|
46037
46061
|
events.end();
|
|
46038
46062
|
return text4;
|
|
@@ -46633,10 +46657,10 @@ function findRollout(threadId) {
|
|
|
46633
46657
|
}
|
|
46634
46658
|
for (const name of names2) {
|
|
46635
46659
|
if (!name.startsWith("rollout-") || !name.endsWith(tail)) continue;
|
|
46636
|
-
const
|
|
46660
|
+
const path88 = join2(dir, name);
|
|
46637
46661
|
try {
|
|
46638
|
-
const at = statSync2(
|
|
46639
|
-
if (!newest2 || at > newest2.at) newest2 = { path:
|
|
46662
|
+
const at = statSync2(path88).mtimeMs;
|
|
46663
|
+
if (!newest2 || at > newest2.at) newest2 = { path: path88, at };
|
|
46640
46664
|
} catch {
|
|
46641
46665
|
}
|
|
46642
46666
|
}
|
|
@@ -46644,11 +46668,11 @@ function findRollout(threadId) {
|
|
|
46644
46668
|
return newest2?.path;
|
|
46645
46669
|
}
|
|
46646
46670
|
function readCodexRunFacts(threadId) {
|
|
46647
|
-
const
|
|
46648
|
-
if (!
|
|
46671
|
+
const path88 = findRollout(threadId);
|
|
46672
|
+
if (!path88) return void 0;
|
|
46649
46673
|
let raw;
|
|
46650
46674
|
try {
|
|
46651
|
-
raw = readFileSync2(
|
|
46675
|
+
raw = readFileSync2(path88, "utf8");
|
|
46652
46676
|
} catch {
|
|
46653
46677
|
return void 0;
|
|
46654
46678
|
}
|
|
@@ -46774,8 +46798,8 @@ function renderCompleted(item) {
|
|
|
46774
46798
|
const changes = Array.isArray(item.changes) ? item.changes : [];
|
|
46775
46799
|
return changes.map((raw) => {
|
|
46776
46800
|
const change2 = obj2(raw);
|
|
46777
|
-
const
|
|
46778
|
-
return
|
|
46801
|
+
const path88 = str4(change2.path);
|
|
46802
|
+
return path88 ? `\u23FA ${str4(change2.kind) || "change"}(${path88})
|
|
46779
46803
|
` : "";
|
|
46780
46804
|
}).join("");
|
|
46781
46805
|
}
|
|
@@ -47113,10 +47137,10 @@ function readKimiRunFacts(sessionId) {
|
|
|
47113
47137
|
const total = { input: 0, cacheCreation: 0, cacheRead: 0, output: 0 };
|
|
47114
47138
|
let model;
|
|
47115
47139
|
let holding = 0;
|
|
47116
|
-
for (const { path:
|
|
47140
|
+
for (const { path: path88, main } of wireFiles(entry.sessionDir)) {
|
|
47117
47141
|
let raw;
|
|
47118
47142
|
try {
|
|
47119
|
-
raw = readFileSync3(
|
|
47143
|
+
raw = readFileSync3(path88, "utf8");
|
|
47120
47144
|
} catch {
|
|
47121
47145
|
continue;
|
|
47122
47146
|
}
|
|
@@ -48173,7 +48197,7 @@ async function run(io, options, count3) {
|
|
|
48173
48197
|
startupTimer = setTimeout(() => {
|
|
48174
48198
|
if (!started) io.event?.({ kind: "log", data: { text: "[conversation] start_unconfirmed" } });
|
|
48175
48199
|
}, CONVERSATION_MS.start);
|
|
48176
|
-
await bounded(rpc.call("turn/start", { threadId, input: [{ type: "text", text: text4 }, ...images.map((
|
|
48200
|
+
await bounded(rpc.call("turn/start", { threadId, input: [{ type: "text", text: text4 }, ...images.map((path88) => ({ type: "localImage", path: path88 }))] }), CONVERSATION_MS.start, "Codex turn/start timed out; submission outcome is unknown.").catch((error62) => {
|
|
48177
48201
|
if (!started) throw error62;
|
|
48178
48202
|
});
|
|
48179
48203
|
};
|
|
@@ -51429,8 +51453,8 @@ function markedInProc(entry, strict = false, since) {
|
|
|
51429
51453
|
if (fs60.readFileSync(`/proc/${name}/environ`, "utf8").split("\0").includes(entry)) pids.push(Number(name));
|
|
51430
51454
|
} catch (error62) {
|
|
51431
51455
|
if (strict && !["ENOENT", "ESRCH"].includes(error62.code ?? "")) {
|
|
51432
|
-
const
|
|
51433
|
-
if (
|
|
51456
|
+
const stat2 = fs60.statSync(`/proc/${name}`, { throwIfNoEntry: false });
|
|
51457
|
+
if (stat2?.uid === process.getuid?.() && !startedBefore(Number(name), since)) throw error62;
|
|
51434
51458
|
}
|
|
51435
51459
|
}
|
|
51436
51460
|
}
|
|
@@ -54074,7 +54098,7 @@ var require_command = __commonJS({
|
|
|
54074
54098
|
"../cli/node_modules/commander/lib/command.js"(exports) {
|
|
54075
54099
|
var EventEmitter = __require("node:events").EventEmitter;
|
|
54076
54100
|
var childProcess = __require("node:child_process");
|
|
54077
|
-
var
|
|
54101
|
+
var path88 = __require("node:path");
|
|
54078
54102
|
var fs92 = __require("node:fs");
|
|
54079
54103
|
var process2 = __require("node:process");
|
|
54080
54104
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
@@ -55074,9 +55098,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
55074
55098
|
let launchWithNode = false;
|
|
55075
55099
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
55076
55100
|
function findFile(baseDir, baseName) {
|
|
55077
|
-
const localBin =
|
|
55101
|
+
const localBin = path88.resolve(baseDir, baseName);
|
|
55078
55102
|
if (fs92.existsSync(localBin)) return localBin;
|
|
55079
|
-
if (sourceExt.includes(
|
|
55103
|
+
if (sourceExt.includes(path88.extname(baseName))) return void 0;
|
|
55080
55104
|
const foundExt = sourceExt.find(
|
|
55081
55105
|
(ext) => fs92.existsSync(`${localBin}${ext}`)
|
|
55082
55106
|
);
|
|
@@ -55094,17 +55118,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
55094
55118
|
} catch {
|
|
55095
55119
|
resolvedScriptPath = this._scriptPath;
|
|
55096
55120
|
}
|
|
55097
|
-
executableDir =
|
|
55098
|
-
|
|
55121
|
+
executableDir = path88.resolve(
|
|
55122
|
+
path88.dirname(resolvedScriptPath),
|
|
55099
55123
|
executableDir
|
|
55100
55124
|
);
|
|
55101
55125
|
}
|
|
55102
55126
|
if (executableDir) {
|
|
55103
55127
|
let localFile = findFile(executableDir, executableFile);
|
|
55104
55128
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
55105
|
-
const legacyName =
|
|
55129
|
+
const legacyName = path88.basename(
|
|
55106
55130
|
this._scriptPath,
|
|
55107
|
-
|
|
55131
|
+
path88.extname(this._scriptPath)
|
|
55108
55132
|
);
|
|
55109
55133
|
if (legacyName !== this._name) {
|
|
55110
55134
|
localFile = findFile(
|
|
@@ -55115,7 +55139,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
55115
55139
|
}
|
|
55116
55140
|
executableFile = localFile || executableFile;
|
|
55117
55141
|
}
|
|
55118
|
-
launchWithNode = sourceExt.includes(
|
|
55142
|
+
launchWithNode = sourceExt.includes(path88.extname(executableFile));
|
|
55119
55143
|
let proc;
|
|
55120
55144
|
if (process2.platform !== "win32") {
|
|
55121
55145
|
if (launchWithNode) {
|
|
@@ -55962,7 +55986,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
55962
55986
|
* @return {Command}
|
|
55963
55987
|
*/
|
|
55964
55988
|
nameFromFilename(filename) {
|
|
55965
|
-
this._name =
|
|
55989
|
+
this._name = path88.basename(filename, path88.extname(filename));
|
|
55966
55990
|
return this;
|
|
55967
55991
|
}
|
|
55968
55992
|
/**
|
|
@@ -55976,9 +56000,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
55976
56000
|
* @param {string} [path]
|
|
55977
56001
|
* @return {(string|null|Command)}
|
|
55978
56002
|
*/
|
|
55979
|
-
executableDir(
|
|
55980
|
-
if (
|
|
55981
|
-
this._executableDir =
|
|
56003
|
+
executableDir(path89) {
|
|
56004
|
+
if (path89 === void 0) return this._executableDir;
|
|
56005
|
+
this._executableDir = path89;
|
|
55982
56006
|
return this;
|
|
55983
56007
|
}
|
|
55984
56008
|
/**
|
|
@@ -56689,7 +56713,7 @@ function resolutionOf(record2, value) {
|
|
|
56689
56713
|
if (saved.remote.content === null && saved.base.content !== null && f.content !== null && (numberOfCard(f.path) !== null || f.path.startsWith("triage/"))) refuse(record2, `This path was removed or moved: ${f.path}. Preserve the local draft outside the board.`, "cloud-refused");
|
|
56690
56714
|
if (numberOfCard(f.path) !== null && f.content !== null) {
|
|
56691
56715
|
const front = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(f.content)?.[1];
|
|
56692
|
-
const parsed = (0,
|
|
56716
|
+
const parsed = (0, import_yaml11.parseDocument)(front ?? "");
|
|
56693
56717
|
const fields2 = parsed.toJS();
|
|
56694
56718
|
if (!front || parsed.errors.length || !fields2 || typeof fields2.title !== "string" || ["title", "priority", "status", "blocked_by", "related", "modules", "questions"].some((key) => !(key in fields2)) || ["blocked_by", "related", "modules", "questions"].some((key) => !Array.isArray(fields2[key])) || fields2.modules.some((v) => typeof v !== "string") || ["blocked_by", "related"].some((key) => fields2[key].some((v) => !Number.isSafeInteger(v) || Number(v) < 1))) refuse(record2, `Invalid card metadata: ${f.path}`, "invalid-usage");
|
|
56695
56719
|
const meta3 = parseFrontmatter(f.content).meta;
|
|
@@ -56840,11 +56864,11 @@ async function resolveConflict(board, project2, id2, expect, value, transport) {
|
|
|
56840
56864
|
return { id: id2, state: r.state, receipt: r.receipt };
|
|
56841
56865
|
});
|
|
56842
56866
|
}
|
|
56843
|
-
var
|
|
56867
|
+
var import_yaml11, digest, folder, fileOf, pendingConflicts, conflictList;
|
|
56844
56868
|
var init_board_conflicts = __esm({
|
|
56845
56869
|
"../cli/src/lib/shared/board-conflicts.ts"() {
|
|
56846
56870
|
"use strict";
|
|
56847
|
-
|
|
56871
|
+
import_yaml11 = __toESM(require_dist(), 1);
|
|
56848
56872
|
init_shared_memory();
|
|
56849
56873
|
init_io();
|
|
56850
56874
|
init_lock();
|
|
@@ -57920,7 +57944,12 @@ async function taskRuntime(id2, runtime, location = {}) {
|
|
|
57920
57944
|
const runtimeId = await resolveCloudRuntime(runtime);
|
|
57921
57945
|
const ref = await taskRef(id2, location);
|
|
57922
57946
|
const task = requireTask(await cloud("PATCH", `/v1/tasks/${enc(ref)}`, { runtime: runtimeId }));
|
|
57923
|
-
|
|
57947
|
+
if (task.runtime !== runtimeId || task.runtime_info != null && task.runtime_info.id !== runtimeId) {
|
|
57948
|
+
const effective = task.runtime_info == null ? "" : `, effective ${task.runtime_info.id ?? "missing"}`;
|
|
57949
|
+
throw cloudError(invalidResponse(`a matching runtime (requested ${runtimeId}, saved ${task.runtime ?? "missing"}${effective})`));
|
|
57950
|
+
}
|
|
57951
|
+
const name = task.runtime_info?.name;
|
|
57952
|
+
say(`Updated ${task.key} runtime to ${hasText(name) ? name : task.runtime}.`);
|
|
57924
57953
|
return { ...task };
|
|
57925
57954
|
}
|
|
57926
57955
|
async function taskStop(id2, location = {}) {
|
|
@@ -58765,7 +58794,7 @@ async function cloudImage(opts, program2) {
|
|
|
58765
58794
|
failed: "Could not generate the image.",
|
|
58766
58795
|
fallback: "Use an existing image or screenshot.",
|
|
58767
58796
|
// A Cloud without tiers answers no `x-tier`, and generated at standard.
|
|
58768
|
-
label: (res) => `${res.headers.get("x-
|
|
58797
|
+
label: (res) => `${res.headers.get("x-tier") ?? "standard"}`
|
|
58769
58798
|
});
|
|
58770
58799
|
}
|
|
58771
58800
|
async function cloudTts(opts, program2) {
|
|
@@ -58836,8 +58865,9 @@ async function generate(g) {
|
|
|
58836
58865
|
if (res.status === 401) refuse3(problem2, `${CLOUD_ACCESS_HINTS.expired}
|
|
58837
58866
|
${problem2.message}`);
|
|
58838
58867
|
if (problem2.code === "pro_required") refuse3(problem2, g.proRequired);
|
|
58868
|
+
if (problem2.code === "api_balance_insufficient" || problem2.code === "pricing_changed") refuse3(problem2, problem2.message);
|
|
58839
58869
|
if (problem2.code === "credits_used_up") {
|
|
58840
|
-
refuse3(problem2, res.headers.has("retry-after") ? "AI credits are used up. See Settings \u2192 Usage or wait for the next reset." : "Trial AI credits are used up.
|
|
58870
|
+
refuse3(problem2, res.headers.has("retry-after") ? "AI credits are used up. See Settings \u2192 Usage or wait for the next reset." : "Trial AI credits are used up. Add API balance in Settings \u2192 Usage.");
|
|
58841
58871
|
}
|
|
58842
58872
|
if (res.status === 400) refuse3(problem2, `${problem2.message}
|
|
58843
58873
|
usage: ${g.usage}`, 2);
|
|
@@ -58858,7 +58888,8 @@ ${g.fallback}`, retryable: true }, { bare: true, exitCode: 1 });
|
|
|
58858
58888
|
const out = g.outFor?.(res, g.out) ?? g.out;
|
|
58859
58889
|
fs74.mkdirSync(path73.dirname(path73.resolve(out)), { recursive: true });
|
|
58860
58890
|
fs74.writeFileSync(out, bytes2);
|
|
58861
|
-
|
|
58891
|
+
const charge = res.headers.get("x-wildcrane-api-charge-usd");
|
|
58892
|
+
say(`${out} (${g.label(res)}${charge ? `, WildCrane API $${charge}` : ""})`);
|
|
58862
58893
|
return { out };
|
|
58863
58894
|
}
|
|
58864
58895
|
function mediaMatches(contentType, bytes2, image) {
|
|
@@ -58896,10 +58927,212 @@ var init_cloud = __esm({
|
|
|
58896
58927
|
}
|
|
58897
58928
|
});
|
|
58898
58929
|
|
|
58930
|
+
// ../cli/src/lib/shared/transcription.ts
|
|
58931
|
+
function transcriptionLanguage(value) {
|
|
58932
|
+
return typeof value === "string" && (value === "auto" || languages.has(value));
|
|
58933
|
+
}
|
|
58934
|
+
var languages, MAX_TRANSCRIPTION_BYTES;
|
|
58935
|
+
var init_transcription = __esm({
|
|
58936
|
+
"../cli/src/lib/shared/transcription.ts"() {
|
|
58937
|
+
"use strict";
|
|
58938
|
+
languages = new Set("en zh de es ru ko fr ja pt tr pl ca nl ar sv it id hi fi vi he uk el ms cs ro da hu ta no th ur hr bg lt la mi ml cy sk te fa lv bn sr az sl kn et mk br eu is hy ne mn bs kk sq sw gl mr pa si km sn yo so af oc ka be tg sd gu am yi lo uz fo ht ps tk nn mt sa lb my bo tl mg as tt haw ln ha ba jw su yue".split(" "));
|
|
58939
|
+
MAX_TRANSCRIPTION_BYTES = 20 * 1024 * 1024;
|
|
58940
|
+
}
|
|
58941
|
+
});
|
|
58942
|
+
|
|
58943
|
+
// ../cli/src/commands/transcribe.ts
|
|
58944
|
+
import { execFile } from "node:child_process";
|
|
58945
|
+
import { randomUUID as randomUUID8 } from "node:crypto";
|
|
58946
|
+
import { mkdir, mkdtemp, readFile as readFile2, realpath, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
58947
|
+
import { tmpdir } from "node:os";
|
|
58948
|
+
import path74 from "node:path";
|
|
58949
|
+
import { setTimeout as delay2 } from "node:timers/promises";
|
|
58950
|
+
import { promisify } from "node:util";
|
|
58951
|
+
async function ffmpeg(tool, args2) {
|
|
58952
|
+
try {
|
|
58953
|
+
return (await exec(tool, args2)).stdout;
|
|
58954
|
+
} catch (error62) {
|
|
58955
|
+
const cause = error62;
|
|
58956
|
+
if (cause.code === "ENOENT") throw fail(`Install ${tool} and make it available on PATH.`);
|
|
58957
|
+
throw fail(cause.stderr?.trim() || `${tool} could not read the media.`);
|
|
58958
|
+
}
|
|
58959
|
+
}
|
|
58960
|
+
async function audioStream(input2, choice) {
|
|
58961
|
+
const answer2 = await ffmpeg("ffprobe", ["-v", "error", "-select_streams", "a", "-show_entries", "stream=index", "-of", "json", input2]);
|
|
58962
|
+
const { streams = [] } = JSON.parse(answer2);
|
|
58963
|
+
if (!streams.length) throw fail("The media contains no audio streams.");
|
|
58964
|
+
if (choice === void 0 && streams.length > 1) throw fail("Choose an audio stream with --audio-stream.");
|
|
58965
|
+
const index = choice === void 0 ? 0 : Number(choice);
|
|
58966
|
+
if (!Number.isSafeInteger(index) || index < 0 || index >= streams.length) {
|
|
58967
|
+
throw fail(`--audio-stream must be an audio stream index from 0 to ${streams.length - 1}.`);
|
|
58968
|
+
}
|
|
58969
|
+
return index;
|
|
58970
|
+
}
|
|
58971
|
+
async function cloud2(send, retries = 0) {
|
|
58972
|
+
for (let attempt2 = 0; ; attempt2++) {
|
|
58973
|
+
const answer2 = await send();
|
|
58974
|
+
if (answer2.ok) return answer2.value;
|
|
58975
|
+
if (!answer2.retryable || attempt2 >= retries) throw fail(answer2.error, answer2.code);
|
|
58976
|
+
await delay2(answer2.code === "idempotency_in_progress" ? 5e3 : 1e3 * (attempt2 + 1));
|
|
58977
|
+
}
|
|
58978
|
+
}
|
|
58979
|
+
async function uploadAudio(task, name, wav, key) {
|
|
58980
|
+
const artifact = requireResponse(
|
|
58981
|
+
await cloud2(() => call(
|
|
58982
|
+
"POST",
|
|
58983
|
+
`/v1/tasks/${encodeURIComponent(task)}/artifacts`,
|
|
58984
|
+
{ type: "asset", name },
|
|
58985
|
+
`transcribe-artifact-${key}`
|
|
58986
|
+
), 3),
|
|
58987
|
+
"an audio artifact id",
|
|
58988
|
+
(value) => /^art_[0-9a-z_]+$/.test(value.id)
|
|
58989
|
+
);
|
|
58990
|
+
const routes = `/v1/artifacts/${artifact.id}`;
|
|
58991
|
+
const upload = requireResponse(
|
|
58992
|
+
await cloud2(() => call(
|
|
58993
|
+
"POST",
|
|
58994
|
+
`${routes}/uploads`,
|
|
58995
|
+
{ content_type: pcmType, size: wav.size }
|
|
58996
|
+
)),
|
|
58997
|
+
"an audio upload id",
|
|
58998
|
+
(value) => /^upl_[0-9a-z_]+$/.test(value.id)
|
|
58999
|
+
);
|
|
59000
|
+
await cloud2(() => call("PUT", `/v1/uploads/${upload.id}`, wav));
|
|
59001
|
+
const version2 = requireResponse(
|
|
59002
|
+
await cloud2(() => call(
|
|
59003
|
+
"POST",
|
|
59004
|
+
`${routes}/versions`,
|
|
59005
|
+
{ upload: upload.id },
|
|
59006
|
+
`transcribe-version-${key}`
|
|
59007
|
+
), 3),
|
|
59008
|
+
"an audio artifact version",
|
|
59009
|
+
(value) => Number.isSafeInteger(value.version) && value.version > 0
|
|
59010
|
+
);
|
|
59011
|
+
return { artifact: artifact.id, version: version2.version };
|
|
59012
|
+
}
|
|
59013
|
+
async function poll(id2) {
|
|
59014
|
+
const deadline = Date.now() + 15 * 6e4;
|
|
59015
|
+
do {
|
|
59016
|
+
const pending = await cloud2(() => call(
|
|
59017
|
+
"GET",
|
|
59018
|
+
`/v1/transcriptions/${id2}`,
|
|
59019
|
+
void 0,
|
|
59020
|
+
void 0,
|
|
59021
|
+
{ allowResultError: true }
|
|
59022
|
+
), 3);
|
|
59023
|
+
if (pending.status === "done" && pending.result && Array.isArray(pending.result.segments)) return pending.result;
|
|
59024
|
+
if (pending.status === "failed") throw fail(pending.error?.message || "The audio could not be transcribed.", "transcription_failed");
|
|
59025
|
+
if (pending.status !== "running" && pending.status !== "queued") throw fail("Cloud did not return a valid transcription job.");
|
|
59026
|
+
await delay2(1e3);
|
|
59027
|
+
} while (Date.now() < deadline);
|
|
59028
|
+
throw fail(`Transcription ${id2} did not finish in time.`);
|
|
59029
|
+
}
|
|
59030
|
+
function timestamp(ms) {
|
|
59031
|
+
const pad2 = (n, width = 2) => String(n).padStart(width, "0");
|
|
59032
|
+
return `${pad2(Math.floor(ms / 36e5))}:${pad2(Math.floor(ms / 6e4) % 60)}:${pad2(Math.floor(ms / 1e3) % 60)}.${pad2(ms % 1e3, 3)}`;
|
|
59033
|
+
}
|
|
59034
|
+
function webvtt(transcript) {
|
|
59035
|
+
return "WEBVTT\n\n" + transcript.segments.map(({ id: id2, text: text4, start_ms, end_ms }) => `${id2}
|
|
59036
|
+
${timestamp(start_ms)} --> ${timestamp(end_ms)}
|
|
59037
|
+
${text4.replace(/\s*\r?\n\s*/g, " ").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")}
|
|
59038
|
+
|
|
59039
|
+
`).join("");
|
|
59040
|
+
}
|
|
59041
|
+
async function outputPath(cwd, file2) {
|
|
59042
|
+
const absolute = path74.resolve(cwd, file2);
|
|
59043
|
+
await mkdir(path74.dirname(absolute), { recursive: true });
|
|
59044
|
+
return path74.join(await realpath(path74.dirname(absolute)), path74.basename(absolute));
|
|
59045
|
+
}
|
|
59046
|
+
async function cmdTranscribe(media, options, cwd) {
|
|
59047
|
+
const task = workspaceTask();
|
|
59048
|
+
if (!task) throw fail("Run akb transcribe inside a WildCrane Runner task.");
|
|
59049
|
+
const language2 = options.language ?? "auto";
|
|
59050
|
+
if (!transcriptionLanguage(language2)) throw fail("Use auto or a supported language code.");
|
|
59051
|
+
const choice = options.audioStream;
|
|
59052
|
+
if (choice !== void 0 && !/^\d+$/.test(choice)) throw fail("--audio-stream must be a non-negative integer.");
|
|
59053
|
+
try {
|
|
59054
|
+
const input2 = await realpath(path74.resolve(cwd, media));
|
|
59055
|
+
if (!(await stat(input2)).isFile()) throw fail("Choose a local media file.");
|
|
59056
|
+
const index = await audioStream(input2, choice);
|
|
59057
|
+
const [out, vtt] = await Promise.all([outputPath(cwd, options.out), outputPath(cwd, options.vtt)]);
|
|
59058
|
+
if (out === vtt || out === input2 || vtt === input2) throw fail("Use distinct paths for the media, JSON and WebVTT files.");
|
|
59059
|
+
for (const target of [out, vtt]) {
|
|
59060
|
+
if ((await stat(target).catch((error62) => {
|
|
59061
|
+
if (error62.code !== "ENOENT") throw error62;
|
|
59062
|
+
}))?.isDirectory()) throw fail(`The output path is a directory: ${target}`);
|
|
59063
|
+
}
|
|
59064
|
+
const scratch = await mkdtemp(path74.join(tmpdir(), "akb-transcribe-"));
|
|
59065
|
+
const key = randomUUID8();
|
|
59066
|
+
const outTemp = `${out}.${key}.tmp`;
|
|
59067
|
+
const vttTemp = `${vtt}.${key}.tmp`;
|
|
59068
|
+
try {
|
|
59069
|
+
const wav = path74.join(scratch, "audio.wav");
|
|
59070
|
+
await ffmpeg("ffmpeg", [
|
|
59071
|
+
"-nostdin",
|
|
59072
|
+
"-v",
|
|
59073
|
+
"error",
|
|
59074
|
+
"-i",
|
|
59075
|
+
input2,
|
|
59076
|
+
"-map",
|
|
59077
|
+
`0:a:${index}`,
|
|
59078
|
+
"-ac",
|
|
59079
|
+
"1",
|
|
59080
|
+
"-ar",
|
|
59081
|
+
"16000",
|
|
59082
|
+
"-c:a",
|
|
59083
|
+
"pcm_s16le",
|
|
59084
|
+
"-fs",
|
|
59085
|
+
String(MAX_TRANSCRIPTION_BYTES + 1),
|
|
59086
|
+
"-f",
|
|
59087
|
+
"wav",
|
|
59088
|
+
wav
|
|
59089
|
+
]);
|
|
59090
|
+
const { size } = await stat(wav);
|
|
59091
|
+
if (size > MAX_TRANSCRIPTION_BYTES) throw fail(`The extracted WAV exceeds ${MAX_TRANSCRIPTION_BYTES / 1048576} MiB.`);
|
|
59092
|
+
const audio = await uploadAudio(task, `Transcription ${key}.wav`, new Blob([await readFile2(wav)], { type: pcmType }), key);
|
|
59093
|
+
const { id: id2 } = requireResponse(
|
|
59094
|
+
await cloud2(() => call(
|
|
59095
|
+
"POST",
|
|
59096
|
+
"/v1/transcriptions",
|
|
59097
|
+
{ audio, language: language2 },
|
|
59098
|
+
`transcribe-${key}`
|
|
59099
|
+
), 3),
|
|
59100
|
+
"a transcription job id",
|
|
59101
|
+
(value) => /^trn_[0-9a-z_]+$/.test(value.id)
|
|
59102
|
+
);
|
|
59103
|
+
const transcript = await poll(id2);
|
|
59104
|
+
const file2 = { ...transcript, source: { media, audio_stream: index } };
|
|
59105
|
+
await writeFile(outTemp, JSON.stringify(file2, null, 2) + "\n");
|
|
59106
|
+
await writeFile(vttTemp, webvtt(transcript));
|
|
59107
|
+
await rename(outTemp, out);
|
|
59108
|
+
await rename(vttTemp, vtt);
|
|
59109
|
+
return { id: id2, out, vtt };
|
|
59110
|
+
} finally {
|
|
59111
|
+
await Promise.allSettled([rm(scratch, { recursive: true, force: true }), rm(outTemp, { force: true }), rm(vttTemp, { force: true })]);
|
|
59112
|
+
}
|
|
59113
|
+
} catch (error62) {
|
|
59114
|
+
if (error62 instanceof BoardError) throw error62;
|
|
59115
|
+
throw fail(error62 instanceof Error ? error62.message : String(error62));
|
|
59116
|
+
}
|
|
59117
|
+
}
|
|
59118
|
+
var exec, pcmType, fail;
|
|
59119
|
+
var init_transcribe = __esm({
|
|
59120
|
+
"../cli/src/commands/transcribe.ts"() {
|
|
59121
|
+
"use strict";
|
|
59122
|
+
init_tasks();
|
|
59123
|
+
init_response();
|
|
59124
|
+
init_io();
|
|
59125
|
+
init_transcription();
|
|
59126
|
+
exec = promisify(execFile);
|
|
59127
|
+
pcmType = "audio/wav";
|
|
59128
|
+
fail = (message, code) => new BoardError(message, { code, kind: code });
|
|
59129
|
+
}
|
|
59130
|
+
});
|
|
59131
|
+
|
|
58899
59132
|
// ../cli/src/commands/cloud-template.ts
|
|
58900
59133
|
import { createHash as createHash5 } from "node:crypto";
|
|
58901
59134
|
import fs75 from "node:fs";
|
|
58902
|
-
import
|
|
59135
|
+
import path75 from "node:path";
|
|
58903
59136
|
function usage2(problem2, line) {
|
|
58904
59137
|
die(`${problem2}
|
|
58905
59138
|
usage: ${line}`, { kind: "bad-args", bare: true, exitCode: 2 });
|
|
@@ -58968,8 +59201,8 @@ async function downloadEntries(name, kind, files, to, fallback) {
|
|
|
58968
59201
|
const names2 = /* @__PURE__ */ new Set();
|
|
58969
59202
|
const expected = "a matching template download";
|
|
58970
59203
|
for (const file2 of files) {
|
|
58971
|
-
const leaf =
|
|
58972
|
-
const out =
|
|
59204
|
+
const leaf = path75.basename(file2.path);
|
|
59205
|
+
const out = path75.join(to, kind === "previews" && leaf.startsWith(`${name}-`) ? leaf : `${name}-${leaf}`);
|
|
58973
59206
|
if (names2.has(out)) refuse4(CORRUPT, fallback, invalidResponse(expected));
|
|
58974
59207
|
names2.add(out);
|
|
58975
59208
|
const response = await ask(`/${encodeURIComponent(name)}/${kind}/${route(file2.path)}`, {}, fallback);
|
|
@@ -59041,8 +59274,8 @@ async function templateGet(name, opts, program2) {
|
|
|
59041
59274
|
);
|
|
59042
59275
|
const fetched = [];
|
|
59043
59276
|
for (const f of template.files) {
|
|
59044
|
-
const out =
|
|
59045
|
-
if (!out.startsWith(
|
|
59277
|
+
const out = path75.resolve(to, f.path);
|
|
59278
|
+
if (!out.startsWith(path75.resolve(to) + path75.sep)) refuse4(CORRUPT, WITHOUT);
|
|
59046
59279
|
const response = await ask(`/${at}/files/${route(f.path)}`, {}, WITHOUT);
|
|
59047
59280
|
const bytes2 = await cloudBytes(response, "a matching template file", { size: f.size }).catch((error62) => {
|
|
59048
59281
|
if (!(error62 instanceof BoardError)) throw error62;
|
|
@@ -59053,12 +59286,12 @@ async function templateGet(name, opts, program2) {
|
|
|
59053
59286
|
}
|
|
59054
59287
|
fetched.push({ out, bytes: bytes2 });
|
|
59055
59288
|
}
|
|
59056
|
-
const taken = fetched.filter((f) => fs75.existsSync(f.out)).map((f) =>
|
|
59289
|
+
const taken = fetched.filter((f) => fs75.existsSync(f.out)).map((f) => path75.relative(to, f.out));
|
|
59057
59290
|
if (taken.length > 0) {
|
|
59058
59291
|
refuse4(`The folder already has ${taken.join(", ")}. Use another folder, or move those files first.`);
|
|
59059
59292
|
}
|
|
59060
59293
|
for (const f of fetched) {
|
|
59061
|
-
fs75.mkdirSync(
|
|
59294
|
+
fs75.mkdirSync(path75.dirname(f.out), { recursive: true });
|
|
59062
59295
|
fs75.writeFileSync(f.out, f.bytes);
|
|
59063
59296
|
}
|
|
59064
59297
|
say(`Fetched ${name}: ${fetched.length} files into ${to}`);
|
|
@@ -59078,16 +59311,16 @@ async function templateSource(name, opts) {
|
|
|
59078
59311
|
return { name, source: source2, evidence: opts.to ? written : evidence.map((e) => e.path) };
|
|
59079
59312
|
}
|
|
59080
59313
|
async function templatePublish(dir, opts) {
|
|
59081
|
-
const root2 =
|
|
59082
|
-
const manifest =
|
|
59314
|
+
const root2 = path75.resolve(dir);
|
|
59315
|
+
const manifest = path75.join(root2, "template.md");
|
|
59083
59316
|
if (!fs75.existsSync(manifest)) refuse4("template.md is missing from the folder\u2019s top level.");
|
|
59084
59317
|
const meta3 = readTemplateMeta(fs75.readFileSync(manifest, "utf8"));
|
|
59085
59318
|
const files = walk(root2);
|
|
59086
|
-
const total = files.reduce((sum, f) => sum + fs75.statSync(
|
|
59319
|
+
const total = files.reduce((sum, f) => sum + fs75.statSync(path75.join(root2, f)).size, 0);
|
|
59087
59320
|
if (total > MAX_BYTES2) refuse4("The template\u2019s files exceed 50 MB.");
|
|
59088
59321
|
for (const extra of [...opts.preview, ...opts.evidence]) {
|
|
59089
59322
|
if (!fs75.existsSync(extra)) refuse4(`${extra} does not exist.`);
|
|
59090
|
-
if (
|
|
59323
|
+
if (path75.resolve(extra).startsWith(root2 + path75.sep)) {
|
|
59091
59324
|
refuse4(`${extra} is inside the template folder. Move the previews and evidence outside it.`);
|
|
59092
59325
|
}
|
|
59093
59326
|
}
|
|
@@ -59096,10 +59329,10 @@ async function templatePublish(dir, opts) {
|
|
|
59096
59329
|
}
|
|
59097
59330
|
const form = new FormData();
|
|
59098
59331
|
form.set("meta", JSON.stringify({ ...meta3, replace: !!opts.replace }));
|
|
59099
|
-
const add2 = (kind, name, file2) => form.append(`${kind}:${name}`, new Blob([fs75.readFileSync(file2)]),
|
|
59100
|
-
for (const f of files) add2("files", f,
|
|
59101
|
-
for (const f of opts.preview) add2("previews",
|
|
59102
|
-
for (const f of opts.evidence) add2("evidence",
|
|
59332
|
+
const add2 = (kind, name, file2) => form.append(`${kind}:${name}`, new Blob([fs75.readFileSync(file2)]), path75.basename(name));
|
|
59333
|
+
for (const f of files) add2("files", f, path75.join(root2, f));
|
|
59334
|
+
for (const f of opts.preview) add2("previews", path75.basename(f), f);
|
|
59335
|
+
for (const f of opts.evidence) add2("evidence", path75.basename(f), f);
|
|
59103
59336
|
const done = requireResponse(
|
|
59104
59337
|
await asJson(await ask("", { method: "POST", body: form })),
|
|
59105
59338
|
"a template publication receipt",
|
|
@@ -59120,7 +59353,7 @@ async function templateDelete(name) {
|
|
|
59120
59353
|
return { name, deleted: true };
|
|
59121
59354
|
}
|
|
59122
59355
|
async function templateShowcase(name, dir) {
|
|
59123
|
-
const file2 =
|
|
59356
|
+
const file2 = path75.join(dir, "showcase.json");
|
|
59124
59357
|
if (!fs75.existsSync(file2)) refuse4(`showcase.json is missing from ${dir}.`);
|
|
59125
59358
|
let meta3;
|
|
59126
59359
|
try {
|
|
@@ -59136,7 +59369,7 @@ async function templateShowcase(name, dir) {
|
|
|
59136
59369
|
const form = new FormData();
|
|
59137
59370
|
form.set("meta", JSON.stringify(meta3));
|
|
59138
59371
|
for (const p of new Set(named2)) {
|
|
59139
|
-
const at =
|
|
59372
|
+
const at = path75.join(dir, p);
|
|
59140
59373
|
if (!fs75.existsSync(at)) refuse4(`${at} does not exist.`);
|
|
59141
59374
|
form.append(`media:${p}`, new Blob([fs75.readFileSync(at)]), p);
|
|
59142
59375
|
}
|
|
@@ -59150,7 +59383,7 @@ async function templateShowcase(name, dir) {
|
|
|
59150
59383
|
}
|
|
59151
59384
|
function walk(root2, sub = "") {
|
|
59152
59385
|
const out = [];
|
|
59153
|
-
for (const entry of fs75.readdirSync(
|
|
59386
|
+
for (const entry of fs75.readdirSync(path75.join(root2, sub), { withFileTypes: true })) {
|
|
59154
59387
|
if (entry.name.startsWith(".") || entry.name === "node_modules") continue;
|
|
59155
59388
|
const rel3 = sub ? `${sub}/${entry.name}` : entry.name;
|
|
59156
59389
|
if (entry.isDirectory()) out.push(...walk(root2, rel3));
|
|
@@ -63056,7 +63289,7 @@ var reply_log_exports = {};
|
|
|
63056
63289
|
__export(reply_log_exports, {
|
|
63057
63290
|
watchReplyLog: () => watchReplyLog
|
|
63058
63291
|
});
|
|
63059
|
-
function watchReplyLog(id2, add2,
|
|
63292
|
+
function watchReplyLog(id2, add2, fail2) {
|
|
63060
63293
|
let socket = null;
|
|
63061
63294
|
let timer;
|
|
63062
63295
|
let ping;
|
|
@@ -63081,7 +63314,7 @@ function watchReplyLog(id2, add2, fail) {
|
|
|
63081
63314
|
};
|
|
63082
63315
|
const refuse5 = (error62) => {
|
|
63083
63316
|
stop();
|
|
63084
|
-
|
|
63317
|
+
fail2(error62);
|
|
63085
63318
|
};
|
|
63086
63319
|
const retry2 = () => {
|
|
63087
63320
|
if (closed2) return;
|
|
@@ -63157,7 +63390,7 @@ var init_reply_log = __esm({
|
|
|
63157
63390
|
});
|
|
63158
63391
|
|
|
63159
63392
|
// ../cli/src/commands/task-chat.ts
|
|
63160
|
-
import { setTimeout as
|
|
63393
|
+
import { setTimeout as delay3 } from "node:timers/promises";
|
|
63161
63394
|
function validateChatOptions(message, opts) {
|
|
63162
63395
|
if (opts.limit !== void 0 && opts.all || message.length && (opts.limit !== void 0 || opts.all || opts.follow || opts.stop) || opts.stop && (opts.limit !== void 0 || opts.all || opts.follow)) {
|
|
63163
63396
|
throw new BoardError("Use a message, history options [--limit <n> | --all] [--follow], or --stop separately.", { kind: "bad-args" });
|
|
@@ -63293,7 +63526,7 @@ async function taskChatFollow(id2, opts) {
|
|
|
63293
63526
|
if (!active(reply)) {
|
|
63294
63527
|
break;
|
|
63295
63528
|
}
|
|
63296
|
-
await
|
|
63529
|
+
await delay3(1e3, void 0, { signal: controller.signal });
|
|
63297
63530
|
}
|
|
63298
63531
|
} else {
|
|
63299
63532
|
body = first.chat.messages.at(-1)?.role === "agent" ? first.chat.messages.at(-1).body : null;
|
|
@@ -63651,7 +63884,7 @@ var init_guide2 = __esm({
|
|
|
63651
63884
|
// ../cli/src/commands/studio.ts
|
|
63652
63885
|
import crypto7 from "node:crypto";
|
|
63653
63886
|
import fs76 from "node:fs";
|
|
63654
|
-
import
|
|
63887
|
+
import path76 from "node:path";
|
|
63655
63888
|
function cmdStudioList() {
|
|
63656
63889
|
if (!studiosReachable().ok) die(NEEDS_CLOUD, "needs-cloud");
|
|
63657
63890
|
const rows = studios();
|
|
@@ -63668,7 +63901,7 @@ function cmdStudioDiagram(_id, _card, _folder) {
|
|
|
63668
63901
|
die("Freeze a Studio draft with akb studio preview <card> --folder <draft> --base <baseline>.", "bad-args");
|
|
63669
63902
|
}
|
|
63670
63903
|
function cmdStudioValidate(folder2) {
|
|
63671
|
-
const dir =
|
|
63904
|
+
const dir = path76.resolve(folder2);
|
|
63672
63905
|
if (!fs76.statSync(dir, { throwIfNoEntry: false })?.isDirectory()) die(`${folder2} is not a folder`, "bad-args");
|
|
63673
63906
|
const files = readStudioFolder(dir);
|
|
63674
63907
|
let builtin = false;
|
|
@@ -63683,31 +63916,75 @@ function cmdStudioValidate(folder2) {
|
|
|
63683
63916
|
const fingerprint = checked.ok ? crypto7.createHash("sha256").update(hashInput({ ...checked.files, ...files[VERSION_FILE] ? { [VERSION_FILE]: files[VERSION_FILE] } : {} })).digest("hex") : null;
|
|
63684
63917
|
return { folder: dir, problems, fingerprint };
|
|
63685
63918
|
}
|
|
63686
|
-
async function
|
|
63919
|
+
async function currentStudio(id2) {
|
|
63687
63920
|
const cloudId = cloudIdOf(id2);
|
|
63688
63921
|
if (!cloudId) {
|
|
63689
63922
|
const { problem: problem2 } = studioVerification();
|
|
63690
63923
|
if (problem2) throw cloudError(problem2);
|
|
63691
63924
|
found(id2);
|
|
63692
63925
|
}
|
|
63693
|
-
const dir = path75.resolve(folder2 ?? id2);
|
|
63694
|
-
if (fs76.existsSync(dir) && fs76.readdirSync(dir).length) die(`${folder2 ?? id2} is not empty`, "bad-args");
|
|
63695
63926
|
const read5 = await call("GET", `/v1/studios/${encodeURIComponent(cloudId)}`);
|
|
63696
|
-
|
|
63927
|
+
return requireResponse(
|
|
63697
63928
|
cloudOk(read5, read5.ok || read5.code !== "not_found" ? void 0 : "no-such-studio"),
|
|
63698
63929
|
"the Studio version and files",
|
|
63699
63930
|
(value) => value.id === cloudId && isStudioVersion(value.version) && isStudioFiles(value.files)
|
|
63700
63931
|
);
|
|
63701
|
-
|
|
63702
|
-
|
|
63703
|
-
|
|
63932
|
+
}
|
|
63933
|
+
function emptyStudioFolder(dir) {
|
|
63934
|
+
const destination = fs76.lstatSync(dir, { throwIfNoEntry: false });
|
|
63935
|
+
if (!destination) return false;
|
|
63936
|
+
if (!destination.isDirectory()) die(`${dir} is not a directory. Choose a new or empty folder.`, "bad-args");
|
|
63937
|
+
if (fs76.readdirSync(dir).length) die(`${dir} is not empty. Choose a new or empty folder.`, "bad-args");
|
|
63938
|
+
return true;
|
|
63939
|
+
}
|
|
63940
|
+
function writeStudioFiles(dir, files) {
|
|
63941
|
+
for (const [file2, text4] of Object.entries(files)) {
|
|
63942
|
+
const full = path76.join(dir, ...file2.split("/"));
|
|
63943
|
+
fs76.mkdirSync(path76.dirname(full), { recursive: true });
|
|
63704
63944
|
const data = isAboutFile(file2) && !file2.endsWith(".md") && /^data:[^;]+;base64,/.exec(text4);
|
|
63705
|
-
fs76.writeFileSync(full, data ? Buffer.from(text4.slice(data[0].length), "base64") : text4);
|
|
63945
|
+
fs76.writeFileSync(full, data ? Buffer.from(text4.slice(data[0].length), "base64") : text4, { flag: "wx" });
|
|
63706
63946
|
}
|
|
63947
|
+
}
|
|
63948
|
+
async function cmdStudioPull(id2, folder2) {
|
|
63949
|
+
const dir = path76.resolve(folder2 ?? id2);
|
|
63950
|
+
emptyStudioFolder(dir);
|
|
63951
|
+
const { id: cloudId, version: version2, files } = await currentStudio(id2);
|
|
63952
|
+
writeStudioFiles(dir, { ...files, [VERSION_FILE]: versionText(cloudId, version2) });
|
|
63707
63953
|
const shown = folder2 ?? `./${id2}`;
|
|
63708
63954
|
say(`Pulled ${id2} v${version2} into ${shown}.`);
|
|
63709
63955
|
return { id: id2, version: version2, folder: dir };
|
|
63710
63956
|
}
|
|
63957
|
+
async function cmdStudioClone(id2, folder2, name) {
|
|
63958
|
+
const dir = path76.resolve(folder2);
|
|
63959
|
+
emptyStudioFolder(dir);
|
|
63960
|
+
if (name !== void 0 && !name.trim()) die("--name needs a non-blank Studio name.", "bad-args");
|
|
63961
|
+
const { version: version2, files } = await currentStudio(id2);
|
|
63962
|
+
const cloned = cloneFiles(files, name?.trim());
|
|
63963
|
+
if ("refused" in cloned) {
|
|
63964
|
+
die(`Studio "${id2}" uses ${cloned.refused}, which a workspace Studio cannot carry. Use studio pull to inspect it or choose another Studio.`, "studio-not-cloneable");
|
|
63965
|
+
}
|
|
63966
|
+
const checked = checkStudioFiles(cloned.files);
|
|
63967
|
+
if (!checked.ok) die(formatStudioProblem(checked), { kind: "bad-studio", problems: checked.problems });
|
|
63968
|
+
const parent = path76.dirname(dir);
|
|
63969
|
+
fs76.mkdirSync(parent, { recursive: true });
|
|
63970
|
+
const staging = fs76.mkdtempSync(path76.join(parent, ".studio-clone-"));
|
|
63971
|
+
let removedEmpty = false;
|
|
63972
|
+
try {
|
|
63973
|
+
writeStudioFiles(staging, checked.files);
|
|
63974
|
+
if (emptyStudioFolder(dir) && process.platform === "win32") {
|
|
63975
|
+
fs76.rmdirSync(dir);
|
|
63976
|
+
removedEmpty = true;
|
|
63977
|
+
}
|
|
63978
|
+
fs76.renameSync(staging, dir);
|
|
63979
|
+
} catch (error62) {
|
|
63980
|
+
if (removedEmpty) fs76.mkdirSync(dir, { recursive: true });
|
|
63981
|
+
throw error62;
|
|
63982
|
+
} finally {
|
|
63983
|
+
fs76.rmSync(staging, { recursive: true, force: true });
|
|
63984
|
+
}
|
|
63985
|
+
say(`Cloned ${id2} v${version2} into ${folder2}.`);
|
|
63986
|
+
return { source: id2, sourceVersion: version2, folder: dir };
|
|
63987
|
+
}
|
|
63711
63988
|
function publicationFiles(dir) {
|
|
63712
63989
|
const checked = checkStudioFiles(readStudioFolder(dir));
|
|
63713
63990
|
if (!checked.ok) die(formatStudioProblem(checked), { kind: "bad-studio", problems: checked.problems });
|
|
@@ -63719,7 +63996,7 @@ async function publishFolder(dir, route2, body, requestId) {
|
|
|
63719
63996
|
if (task && context && reviewAllows(reviewAuthorization(context.review, context.assigned), "implement")) {
|
|
63720
63997
|
body = { ...body, source_task: task };
|
|
63721
63998
|
}
|
|
63722
|
-
const pendingFile =
|
|
63999
|
+
const pendingFile = path76.join(dir, ".publication.json");
|
|
63723
64000
|
const hash2 = crypto7.createHash("sha256").update(JSON.stringify({ route: route2, files: body.files, workspace: body.workspace })).digest("hex");
|
|
63724
64001
|
let held4;
|
|
63725
64002
|
try {
|
|
@@ -63738,29 +64015,29 @@ async function publishFolder(dir, route2, body, requestId) {
|
|
|
63738
64015
|
);
|
|
63739
64016
|
pending.resultVersion = version2;
|
|
63740
64017
|
fs76.writeFileSync(pendingFile, JSON.stringify(pending, null, 2) + "\n");
|
|
63741
|
-
fs76.writeFileSync(
|
|
64018
|
+
fs76.writeFileSync(path76.join(dir, VERSION_FILE), versionText(id2, version2));
|
|
63742
64019
|
say(`Saved ${studioName(id2)} v${version2}. New tasks take it.`);
|
|
63743
64020
|
return { id: id2, version: version2, changed: true, requestId: pending.requestId };
|
|
63744
64021
|
}
|
|
63745
64022
|
async function cmdStudioCreate(folder2, opts) {
|
|
63746
64023
|
if (!opts.requestId) die("--request-id is required", "bad-args");
|
|
63747
|
-
const dir =
|
|
64024
|
+
const dir = path76.resolve(folder2);
|
|
63748
64025
|
const files = publicationFiles(dir);
|
|
63749
64026
|
const workspace2 = opts.workspace ?? (await cloudScope()).workspace;
|
|
63750
64027
|
return publishFolder(dir, "/v1/studios", { files, workspace: workspace2 }, opts.requestId);
|
|
63751
64028
|
}
|
|
63752
64029
|
async function cmdStudioPush(folder2, opts) {
|
|
63753
|
-
const dir =
|
|
64030
|
+
const dir = path76.resolve(folder2);
|
|
63754
64031
|
let pulled = null;
|
|
63755
64032
|
try {
|
|
63756
|
-
pulled = JSON.parse(fs76.readFileSync(
|
|
64033
|
+
pulled = JSON.parse(fs76.readFileSync(path76.join(dir, VERSION_FILE), "utf8"));
|
|
63757
64034
|
} catch {
|
|
63758
64035
|
}
|
|
63759
64036
|
if (!pulled?.id || !Number.isInteger(pulled.version) || pulled.version < 1) die(`${folder2} has no valid version.json; pull again.`, "bad-args");
|
|
63760
64037
|
const { id: id2, version: version2 } = pulled;
|
|
63761
64038
|
if (id2.startsWith("wf_builtin_")) die("Copy this studio before editing it.", "studio-read-only");
|
|
63762
64039
|
const files = publicationFiles(dir);
|
|
63763
|
-
if (!fs76.existsSync(
|
|
64040
|
+
if (!fs76.existsSync(path76.join(dir, ".publication.json")) && !opts.requestId) {
|
|
63764
64041
|
const now = await call("GET", `/v1/studios/${encodeURIComponent(id2)}`);
|
|
63765
64042
|
if (now.ok && now.value.version === version2 && isStudioFiles(now.value.files) && JSON.stringify(files) === JSON.stringify(Object.fromEntries(Object.entries(now.value.files).filter(([f]) => f !== VERSION_FILE).sort()))) {
|
|
63766
64043
|
say(`${studioName(id2)} is unchanged (v${version2}).`);
|
|
@@ -64083,7 +64360,7 @@ var init_complete = __esm({
|
|
|
64083
64360
|
});
|
|
64084
64361
|
|
|
64085
64362
|
// ../cli/src/lib/agent/start.ts
|
|
64086
|
-
import { randomUUID as
|
|
64363
|
+
import { randomUUID as randomUUID9 } from "node:crypto";
|
|
64087
64364
|
async function startRun(req) {
|
|
64088
64365
|
const short2 = retiredStudioRun(req.action) ?? studioRefusal(req);
|
|
64089
64366
|
if (short2) return short2;
|
|
@@ -64092,7 +64369,7 @@ async function startRun(req) {
|
|
|
64092
64369
|
const previous = readRuns().filter((r) => r.deliveryId === delivery.deliveryId && r.action === "implement").reverse().sort((a, b) => b.startedAt - a.startedAt)[0];
|
|
64093
64370
|
if (previous && !delivery.completions?.some((c) => c.sessionId === previous.sessionId || c.resumedSessions?.includes(previous.sessionId))) return startResume(previous.sessionId, { deliveryId: delivery.deliveryId, notes: req.notes });
|
|
64094
64371
|
}
|
|
64095
|
-
return open3(req,
|
|
64372
|
+
return open3(req, randomUUID9());
|
|
64096
64373
|
}
|
|
64097
64374
|
function studioRefusal(req) {
|
|
64098
64375
|
if (!Number.isInteger(req.id)) return null;
|
|
@@ -64121,7 +64398,7 @@ function startSubRun(parentId, prompt, runtime) {
|
|
|
64121
64398
|
specAgent: parent.agent,
|
|
64122
64399
|
runtime: runtime ?? inherited
|
|
64123
64400
|
},
|
|
64124
|
-
|
|
64401
|
+
randomUUID9()
|
|
64125
64402
|
);
|
|
64126
64403
|
}
|
|
64127
64404
|
function runAsk(req, sessionId) {
|
|
@@ -64175,7 +64452,7 @@ var init_start = __esm({
|
|
|
64175
64452
|
|
|
64176
64453
|
// ../cli/src/lib/agent/memory-review.ts
|
|
64177
64454
|
import fs78 from "node:fs";
|
|
64178
|
-
import
|
|
64455
|
+
import path77 from "node:path";
|
|
64179
64456
|
function taskChatsToReview(tasks) {
|
|
64180
64457
|
const out = [];
|
|
64181
64458
|
for (const ref of [...new Set(tasks)]) {
|
|
@@ -64197,7 +64474,7 @@ function readArchived2(id2) {
|
|
|
64197
64474
|
const found2 = Number.isInteger(id2) && id2 > 0 ? locateArchived(id2) : null;
|
|
64198
64475
|
if (!found2) return null;
|
|
64199
64476
|
try {
|
|
64200
|
-
const file2 = found2.kind === "group" ?
|
|
64477
|
+
const file2 = found2.kind === "group" ? path77.join(found2.target, "root.md") : found2.target;
|
|
64201
64478
|
const { meta: meta3, body } = parseFrontmatter(fs78.readFileSync(file2, "utf8"));
|
|
64202
64479
|
if (!meta3) return null;
|
|
64203
64480
|
return { id: id2, title: meta3.title, modules: meta3.modules ?? [], studio: meta3.studio ?? "", previews: meta3.previews ?? [], rejected: meta3.rejected, body };
|
|
@@ -64260,10 +64537,10 @@ var init_memory_review = __esm({
|
|
|
64260
64537
|
|
|
64261
64538
|
// ../cli/src/lib/agent/dismissal-review.ts
|
|
64262
64539
|
import fs79 from "node:fs";
|
|
64263
|
-
import
|
|
64540
|
+
import path78 from "node:path";
|
|
64264
64541
|
function rejectionsToReview() {
|
|
64265
64542
|
const scratch = process.env.AI4KANBAN_REJECTION_INPUT;
|
|
64266
|
-
const dir =
|
|
64543
|
+
const dir = path78.join(scratch ? path78.join(scratch, ".archive") : ARCHIVE, REJECTIONS_TO_REVIEW);
|
|
64267
64544
|
if (!fs79.existsSync(dir)) return [];
|
|
64268
64545
|
const found2 = [];
|
|
64269
64546
|
for (const file2 of walkMd(dir)) {
|
|
@@ -64308,7 +64585,7 @@ function withdrawnSources() {
|
|
|
64308
64585
|
if (cited.length === 0) return [];
|
|
64309
64586
|
const scratch = process.env.AI4KANBAN_REJECTION_INPUT;
|
|
64310
64587
|
const dismissed = new Set(reviewDismissed().map((s) => s.sourceId));
|
|
64311
|
-
const restored = new Set([...readInbox(), ...readArchived(scratch ?
|
|
64588
|
+
const restored = new Set([...readInbox(), ...readArchived(scratch ? path78.join(scratch, "triage", "archived") : void 0)].map((s) => s.sourceId));
|
|
64312
64589
|
return cited.filter((id2) => restored.has(id2) && !dismissed.has(id2));
|
|
64313
64590
|
}
|
|
64314
64591
|
var reviewDismissed, SOURCES2;
|
|
@@ -64323,7 +64600,7 @@ var init_dismissal_review = __esm({
|
|
|
64323
64600
|
init_archive();
|
|
64324
64601
|
reviewDismissed = () => {
|
|
64325
64602
|
const scratch = process.env.AI4KANBAN_REJECTION_INPUT;
|
|
64326
|
-
return readAllDismissed(scratch ?
|
|
64603
|
+
return readAllDismissed(scratch ? path78.join(scratch, "triage", "dismissed") : void 0);
|
|
64327
64604
|
};
|
|
64328
64605
|
SOURCES2 = /\(([^()]+)\)\s*$/;
|
|
64329
64606
|
}
|
|
@@ -64331,7 +64608,7 @@ var init_dismissal_review = __esm({
|
|
|
64331
64608
|
|
|
64332
64609
|
// ../cli/src/lib/agent/flow.ts
|
|
64333
64610
|
import fs80 from "node:fs";
|
|
64334
|
-
import
|
|
64611
|
+
import path79 from "node:path";
|
|
64335
64612
|
function readCard(id2, home3 = "board") {
|
|
64336
64613
|
const pending = activeDelivery(id2)?.completions?.some((c) => !c.finished);
|
|
64337
64614
|
const found2 = home3 === "archive" ? locateArchived(id2) : locate(id2) ?? (pending ? locateArchived(id2) : null);
|
|
@@ -64341,7 +64618,7 @@ function readCard(id2, home3 = "board") {
|
|
|
64341
64618
|
{ kind: "card-not-found", id: id2 }
|
|
64342
64619
|
);
|
|
64343
64620
|
}
|
|
64344
|
-
const file2 = found2.kind === "group" ?
|
|
64621
|
+
const file2 = found2.kind === "group" ? path79.join(found2.target, "root.md") : found2.target;
|
|
64345
64622
|
let text4;
|
|
64346
64623
|
try {
|
|
64347
64624
|
text4 = fs80.readFileSync(file2, "utf8");
|
|
@@ -64779,7 +65056,7 @@ var init_flow = __esm({
|
|
|
64779
65056
|
|
|
64780
65057
|
// ../cli/src/lib/card-sources.ts
|
|
64781
65058
|
import fs81 from "node:fs";
|
|
64782
|
-
import
|
|
65059
|
+
import path80 from "node:path";
|
|
64783
65060
|
function planById(id2) {
|
|
64784
65061
|
const found2 = readPlan(`plans/${id2}-.md`);
|
|
64785
65062
|
return found2?.text.trim() ? found2 : null;
|
|
@@ -64789,7 +65066,7 @@ function cardLink(id2) {
|
|
|
64789
65066
|
const found2 = open4 ?? locateArchived(id2);
|
|
64790
65067
|
if (!found2) return null;
|
|
64791
65068
|
try {
|
|
64792
|
-
const file2 = found2.kind === "group" ?
|
|
65069
|
+
const file2 = found2.kind === "group" ? path80.join(found2.target, "root.md") : found2.target;
|
|
64793
65070
|
const title = parseFrontmatter(fs81.readFileSync(file2, "utf8")).meta?.title ?? "";
|
|
64794
65071
|
return { kind: "card", ref: String(id2), title, ...open4 ? {} : { archived: true } };
|
|
64795
65072
|
} catch {
|
|
@@ -64854,11 +65131,11 @@ var init_card_sources = __esm({
|
|
|
64854
65131
|
|
|
64855
65132
|
// ../cli/src/lib/view/read.ts
|
|
64856
65133
|
import fs82 from "node:fs";
|
|
64857
|
-
import
|
|
65134
|
+
import path81 from "node:path";
|
|
64858
65135
|
function readCard2(file2, relFromTodo) {
|
|
64859
|
-
const id2 = idPrefix(
|
|
65136
|
+
const id2 = idPrefix(path81.basename(relFromTodo));
|
|
64860
65137
|
if (id2 === null) {
|
|
64861
|
-
const parts = relFromTodo.split(
|
|
65138
|
+
const parts = relFromTodo.split(path81.sep);
|
|
64862
65139
|
const folderId = idPrefix(parts[parts.length - 2] || "");
|
|
64863
65140
|
if (folderId === null) return null;
|
|
64864
65141
|
return buildCard(folderId, file2, relFromTodo);
|
|
@@ -64869,7 +65146,7 @@ function buildCard(id2, file2, relFromTodo) {
|
|
|
64869
65146
|
const text4 = fs82.readFileSync(file2, "utf8");
|
|
64870
65147
|
const { meta: meta3, body } = parseFrontmatter(text4);
|
|
64871
65148
|
if (!meta3) return null;
|
|
64872
|
-
const relPath = relFromTodo.split(
|
|
65149
|
+
const relPath = relFromTodo.split(path81.sep).join("/");
|
|
64873
65150
|
const flow = studioFor(meta3.studio);
|
|
64874
65151
|
const plan = !!meta3.studio && archivesOnApproval(flow);
|
|
64875
65152
|
return {
|
|
@@ -64894,10 +65171,10 @@ function buildCard(id2, file2, relFromTodo) {
|
|
|
64894
65171
|
};
|
|
64895
65172
|
}
|
|
64896
65173
|
function readGroup(folderName) {
|
|
64897
|
-
const groupDir =
|
|
64898
|
-
const rootFile =
|
|
65174
|
+
const groupDir = path81.join(TODO, folderName);
|
|
65175
|
+
const rootFile = path81.join(groupDir, "root.md");
|
|
64899
65176
|
if (!fs82.existsSync(rootFile)) return null;
|
|
64900
|
-
const root2 = readCard2(rootFile,
|
|
65177
|
+
const root2 = readCard2(rootFile, path81.join(folderName, "root.md"));
|
|
64901
65178
|
if (!root2) return null;
|
|
64902
65179
|
root2.isGroup = true;
|
|
64903
65180
|
const { total, resolved } = subtaskLines(root2.body);
|
|
@@ -64905,11 +65182,11 @@ function readGroup(folderName) {
|
|
|
64905
65182
|
const subCards = [];
|
|
64906
65183
|
const recurse = (dir, relDir) => {
|
|
64907
65184
|
for (const entry of fs82.readdirSync(dir, { withFileTypes: true })) {
|
|
64908
|
-
const childRel =
|
|
65185
|
+
const childRel = path81.join(relDir, entry.name);
|
|
64909
65186
|
if (entry.isDirectory()) {
|
|
64910
|
-
recurse(
|
|
65187
|
+
recurse(path81.join(dir, entry.name), childRel);
|
|
64911
65188
|
} else if (entry.name.endsWith(".md") && entry.name !== "README.md" && entry.name !== "root.md") {
|
|
64912
|
-
const c = readCard2(
|
|
65189
|
+
const c = readCard2(path81.join(dir, entry.name), childRel);
|
|
64913
65190
|
if (c) {
|
|
64914
65191
|
c.parent = { id: root2.id, title: root2.title };
|
|
64915
65192
|
subCards.push(c);
|
|
@@ -64930,12 +65207,12 @@ function readGroup(folderName) {
|
|
|
64930
65207
|
return { root: root2, subCards };
|
|
64931
65208
|
}
|
|
64932
65209
|
function standaloneCards(dirRel) {
|
|
64933
|
-
const dir = dirRel ?
|
|
65210
|
+
const dir = dirRel ? path81.join(TODO, dirRel) : TODO;
|
|
64934
65211
|
if (!fs82.existsSync(dir)) return [];
|
|
64935
65212
|
const cards = [];
|
|
64936
65213
|
for (const entry of fs82.readdirSync(dir, { withFileTypes: true })) {
|
|
64937
65214
|
if (entry.isFile() && entry.name.endsWith(".md") && entry.name !== "README.md") {
|
|
64938
|
-
const c = readCard2(
|
|
65215
|
+
const c = readCard2(path81.join(dir, entry.name), path81.join(dirRel, entry.name));
|
|
64939
65216
|
if (c) cards.push(c);
|
|
64940
65217
|
}
|
|
64941
65218
|
}
|
|
@@ -64979,7 +65256,7 @@ function findCard(id2) {
|
|
|
64979
65256
|
}
|
|
64980
65257
|
function attachSources(card) {
|
|
64981
65258
|
try {
|
|
64982
|
-
const { meta: meta3, body } = parseFrontmatter(fs82.readFileSync(
|
|
65259
|
+
const { meta: meta3, body } = parseFrontmatter(fs82.readFileSync(path81.join(TODO, card.relPath), "utf8"));
|
|
64983
65260
|
const sources2 = meta3 ? cardSources(meta3, body) : [];
|
|
64984
65261
|
if (sources2.length) card.sources = sources2;
|
|
64985
65262
|
} catch {
|
|
@@ -66059,7 +66336,7 @@ var init_watch = __esm({
|
|
|
66059
66336
|
|
|
66060
66337
|
// ../cli/src/commands/run.ts
|
|
66061
66338
|
import fs84 from "node:fs";
|
|
66062
|
-
import
|
|
66339
|
+
import path82 from "node:path";
|
|
66063
66340
|
async function cmdStartRun(action, args2, opts, program2 = "akb") {
|
|
66064
66341
|
const { req, follow: follow2, print } = readRequest(action, args2, opts);
|
|
66065
66342
|
if (!print && (action === "approve" || action === "implement")) {
|
|
@@ -66288,7 +66565,7 @@ async function cmdSubStart(words, opts) {
|
|
|
66288
66565
|
let prompt = words.join(" ");
|
|
66289
66566
|
if (opts.file) {
|
|
66290
66567
|
try {
|
|
66291
|
-
prompt = fs84.readFileSync(
|
|
66568
|
+
prompt = fs84.readFileSync(path82.resolve(opts.file), "utf8");
|
|
66292
66569
|
} catch {
|
|
66293
66570
|
die(`--file: cannot read ${opts.file}`, { kind: "run-refused" });
|
|
66294
66571
|
}
|
|
@@ -66638,7 +66915,7 @@ var init_config3 = __esm({
|
|
|
66638
66915
|
|
|
66639
66916
|
// ../cli/src/lib/signals/migrate.ts
|
|
66640
66917
|
import fs85 from "node:fs";
|
|
66641
|
-
import
|
|
66918
|
+
import path83 from "node:path";
|
|
66642
66919
|
function readHandled() {
|
|
66643
66920
|
let text4;
|
|
66644
66921
|
try {
|
|
@@ -66660,7 +66937,7 @@ function readHandled() {
|
|
|
66660
66937
|
}
|
|
66661
66938
|
function lift(from, into) {
|
|
66662
66939
|
fs85.mkdirSync(into, { recursive: true });
|
|
66663
|
-
fs85.renameSync(from,
|
|
66940
|
+
fs85.renameSync(from, path83.join(into, freeName(into, path83.basename(from))));
|
|
66664
66941
|
}
|
|
66665
66942
|
function repoint(dir, from, into) {
|
|
66666
66943
|
let entries2;
|
|
@@ -66671,7 +66948,7 @@ function repoint(dir, from, into) {
|
|
|
66671
66948
|
}
|
|
66672
66949
|
for (const entry of entries2) {
|
|
66673
66950
|
if (!entry.isFile() || !entry.name.endsWith(".md")) continue;
|
|
66674
|
-
const file2 =
|
|
66951
|
+
const file2 = path83.join(dir, entry.name);
|
|
66675
66952
|
const text4 = fs85.readFileSync(file2, "utf8");
|
|
66676
66953
|
if (text4.includes(from)) fs85.writeFileSync(file2, text4.split(from).join(into));
|
|
66677
66954
|
}
|
|
@@ -66684,17 +66961,17 @@ function dropIfEmpty(dir) {
|
|
|
66684
66961
|
}
|
|
66685
66962
|
function liftInbox() {
|
|
66686
66963
|
if (!fs85.existsSync(SIGNALS_OLD_INBOX)) return;
|
|
66687
|
-
const oldFiles =
|
|
66964
|
+
const oldFiles = path83.join(SIGNALS_OLD_INBOX, "files");
|
|
66688
66965
|
if (fs85.existsSync(oldFiles)) {
|
|
66689
66966
|
for (const entry of fs85.readdirSync(oldFiles, { withFileTypes: true })) {
|
|
66690
|
-
if (entry.isFile()) lift(
|
|
66967
|
+
if (entry.isFile()) lift(path83.join(oldFiles, entry.name), SIGNALS_FILES);
|
|
66691
66968
|
}
|
|
66692
66969
|
dropIfEmpty(oldFiles);
|
|
66693
66970
|
}
|
|
66694
66971
|
const held4 = new Set(readFolder(TRIAGE).map((signal2) => signal2.sourceId));
|
|
66695
66972
|
for (const entry of fs85.readdirSync(SIGNALS_OLD_INBOX, { withFileTypes: true })) {
|
|
66696
66973
|
if (!entry.isFile() || !entry.name.endsWith(".md")) continue;
|
|
66697
|
-
const from =
|
|
66974
|
+
const from = path83.join(SIGNALS_OLD_INBOX, entry.name);
|
|
66698
66975
|
const item = parse3(from);
|
|
66699
66976
|
if (item && held4.has(item.sourceId)) {
|
|
66700
66977
|
fs85.rmSync(from, { force: true });
|
|
@@ -66703,7 +66980,7 @@ function liftInbox() {
|
|
|
66703
66980
|
if (item) held4.add(item.sourceId);
|
|
66704
66981
|
lift(from, TRIAGE);
|
|
66705
66982
|
}
|
|
66706
|
-
const wasAt = asWritten(
|
|
66983
|
+
const wasAt = asWritten(path83.join(SIGNALS_OLD_INBOX, "files"));
|
|
66707
66984
|
const nowAt = asWritten(SIGNALS_FILES);
|
|
66708
66985
|
for (const dir of [TRIAGE, SIGNALS_ARCHIVED, SIGNALS_DISMISSED]) repoint(dir, wasAt, nowAt);
|
|
66709
66986
|
dropIfEmpty(SIGNALS_OLD_INBOX);
|
|
@@ -66729,7 +67006,7 @@ function liftHandled() {
|
|
|
66729
67006
|
"---",
|
|
66730
67007
|
""
|
|
66731
67008
|
];
|
|
66732
|
-
fs85.writeFileSync(
|
|
67009
|
+
fs85.writeFileSync(path83.join(SIGNALS_DISMISSED, name), `${front.join("\n")}
|
|
66733
67010
|
`);
|
|
66734
67011
|
}
|
|
66735
67012
|
fs85.rmSync(SIGNALS_OLD_HANDLED, { force: true });
|
|
@@ -66750,7 +67027,7 @@ var init_migrate = __esm({
|
|
|
66750
67027
|
init_yaml();
|
|
66751
67028
|
init_inbox();
|
|
66752
67029
|
HANDLED_LINE = /^-\s+(.+?)\s+—\s+(.+)$/;
|
|
66753
|
-
asWritten = (dir) => `${rel(dir).split(
|
|
67030
|
+
asWritten = (dir) => `${rel(dir).split(path83.sep).join("/")}/`;
|
|
66754
67031
|
}
|
|
66755
67032
|
});
|
|
66756
67033
|
|
|
@@ -66804,7 +67081,7 @@ var init_identity2 = __esm({
|
|
|
66804
67081
|
|
|
66805
67082
|
// ../cli/src/lib/signals/add.ts
|
|
66806
67083
|
import fs86 from "node:fs";
|
|
66807
|
-
import
|
|
67084
|
+
import path84 from "node:path";
|
|
66808
67085
|
import { createHash as createHash8 } from "node:crypto";
|
|
66809
67086
|
function linkTitle(url2) {
|
|
66810
67087
|
let at;
|
|
@@ -66817,7 +67094,7 @@ function linkTitle(url2) {
|
|
|
66817
67094
|
return oneLine(where) || url2.slice(0, TITLE_MAX);
|
|
66818
67095
|
}
|
|
66819
67096
|
function asText(file2) {
|
|
66820
|
-
const ext =
|
|
67097
|
+
const ext = path84.extname(file2.name).toLowerCase();
|
|
66821
67098
|
if (!file2.type.startsWith("text/") && file2.type !== "application/json" && !TEXT_EXTENSIONS.has(ext)) return null;
|
|
66822
67099
|
try {
|
|
66823
67100
|
const text4 = new TextDecoder("utf-8", { fatal: true }).decode(file2.data);
|
|
@@ -66827,9 +67104,9 @@ function asText(file2) {
|
|
|
66827
67104
|
}
|
|
66828
67105
|
}
|
|
66829
67106
|
function fileName2(name, data) {
|
|
66830
|
-
const base =
|
|
66831
|
-
const ext =
|
|
66832
|
-
const word =
|
|
67107
|
+
const base = path84.basename(name);
|
|
67108
|
+
const ext = path84.extname(base).toLowerCase().slice(0, 12);
|
|
67109
|
+
const word = path84.basename(base, path84.extname(base)).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 40) || "file";
|
|
66833
67110
|
const hash2 = createHash8("sha256").update(data).digest("hex").slice(0, 8);
|
|
66834
67111
|
return `${word}-${hash2}${ext}`;
|
|
66835
67112
|
}
|
|
@@ -66838,9 +67115,9 @@ function addToInbox(drop) {
|
|
|
66838
67115
|
const typed = (drop.text ?? "").trim();
|
|
66839
67116
|
const file2 = drop.file;
|
|
66840
67117
|
if (!typed && !file2) return { ok: false, error: "nothing to add \u2014 paste a link or some text, or drop a file." };
|
|
66841
|
-
if (file2 && file2.data.length === 0) return { ok: false, error: `${
|
|
67118
|
+
if (file2 && file2.data.length === 0) return { ok: false, error: `${path84.basename(file2.name)} is empty.` };
|
|
66842
67119
|
if (file2 && file2.data.length > MAX_BYTES3) {
|
|
66843
|
-
return { ok: false, error: `${
|
|
67120
|
+
return { ok: false, error: `${path84.basename(file2.name)} is over ${MAX_BYTES3 / 1024 / 1024} MB \u2014 too big for the board.` };
|
|
66844
67121
|
}
|
|
66845
67122
|
const read5 = describe3(typed, file2);
|
|
66846
67123
|
const keep2 = read5.keep;
|
|
@@ -66877,7 +67154,7 @@ function describe3(typed, file2) {
|
|
|
66877
67154
|
return only ? [only] : [];
|
|
66878
67155
|
};
|
|
66879
67156
|
if (file2) {
|
|
66880
|
-
const name =
|
|
67157
|
+
const name = path84.basename(file2.name);
|
|
66881
67158
|
const text4 = asText(file2);
|
|
66882
67159
|
const note = typed ? `
|
|
66883
67160
|
|
|
@@ -66889,7 +67166,7 @@ ${typed}` : "";
|
|
|
66889
67166
|
const at = keepAt(file2);
|
|
66890
67167
|
return {
|
|
66891
67168
|
incoming: {
|
|
66892
|
-
title:
|
|
67169
|
+
title: path84.basename(name, path84.extname(name)) || name,
|
|
66893
67170
|
summary: `${name} \u2014 ${boardRel2(at)}${note}`,
|
|
66894
67171
|
...named2
|
|
66895
67172
|
},
|
|
@@ -66927,13 +67204,13 @@ var init_add = __esm({
|
|
|
66927
67204
|
MAX_BYTES3 = 25 * 1024 * 1024;
|
|
66928
67205
|
TITLE_MAX = 120;
|
|
66929
67206
|
TEXT_EXTENSIONS = /* @__PURE__ */ new Set([".md", ".markdown", ".txt", ".text", ".csv", ".json", ".yml", ".yaml", ".log"]);
|
|
66930
|
-
boardRel2 = (file2) => rel(file2).split(
|
|
67207
|
+
boardRel2 = (file2) => rel(file2).split(path84.sep).join("/");
|
|
66931
67208
|
oneLine = (text4) => {
|
|
66932
67209
|
const first = text4.split("\n").find((line) => line.trim()) ?? "";
|
|
66933
67210
|
const clean = first.replace(/^#+\s*/, "").trim();
|
|
66934
67211
|
return clean.length > TITLE_MAX ? `${clean.slice(0, TITLE_MAX - 1).trimEnd()}\u2026` : clean;
|
|
66935
67212
|
};
|
|
66936
|
-
keepAt = (file2) =>
|
|
67213
|
+
keepAt = (file2) => path84.join(SIGNALS_FILES, fileName2(file2.name, file2.data));
|
|
66937
67214
|
}
|
|
66938
67215
|
});
|
|
66939
67216
|
|
|
@@ -67039,8 +67316,8 @@ var init_previews = __esm({
|
|
|
67039
67316
|
|
|
67040
67317
|
// ../cli/src/commands/studio-preview.ts
|
|
67041
67318
|
import fs88 from "node:fs";
|
|
67042
|
-
import
|
|
67043
|
-
import { createHash as createHash9, randomUUID as
|
|
67319
|
+
import path85 from "node:path";
|
|
67320
|
+
import { createHash as createHash9, randomUUID as randomUUID10 } from "node:crypto";
|
|
67044
67321
|
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
67045
67322
|
function readFolder2(folder2, baseline = false) {
|
|
67046
67323
|
const root2 = fs88.realpathSync(folder2);
|
|
@@ -67048,7 +67325,7 @@ function readFolder2(folder2, baseline = false) {
|
|
|
67048
67325
|
const scan = (dir) => {
|
|
67049
67326
|
for (const e of fs88.readdirSync(dir, { withFileTypes: true })) {
|
|
67050
67327
|
if (e.name.startsWith(".")) continue;
|
|
67051
|
-
const file2 =
|
|
67328
|
+
const file2 = path85.join(dir, e.name);
|
|
67052
67329
|
if (e.isSymbolicLink()) throw Error(`${file2}: symbolic links are not allowed`);
|
|
67053
67330
|
if (e.isDirectory()) scan(file2);
|
|
67054
67331
|
else {
|
|
@@ -67065,7 +67342,7 @@ function readFolder2(folder2, baseline = false) {
|
|
|
67065
67342
|
return { files, def: checked.def, fingerprint };
|
|
67066
67343
|
}
|
|
67067
67344
|
function unified(before, after2, file2, folder2) {
|
|
67068
|
-
const a =
|
|
67345
|
+
const a = path85.join(folder2, "a"), b = path85.join(folder2, "b");
|
|
67069
67346
|
fs88.writeFileSync(a, before ?? "");
|
|
67070
67347
|
fs88.writeFileSync(b, after2 ?? "");
|
|
67071
67348
|
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 });
|
|
@@ -67077,17 +67354,17 @@ ${start < 0 ? "" : lines.slice(start + 2).join("\n")}`;
|
|
|
67077
67354
|
}
|
|
67078
67355
|
async function cmdStudioPreview(id2, opts) {
|
|
67079
67356
|
if (!locate(id2)) die(`no card ${id2}`, "no-such-card");
|
|
67080
|
-
const destination =
|
|
67357
|
+
const destination = path85.join(ASSETS, String(id2), "studio-review"), staging = `${destination}.${randomUUID10()}.tmp`, backup = `${destination}.${randomUUID10()}.previous`;
|
|
67081
67358
|
let moved = false;
|
|
67082
67359
|
try {
|
|
67083
|
-
const draft = readFolder2(
|
|
67360
|
+
const draft = readFolder2(path85.resolve(opts.folder)), base = opts.base === "empty" ? null : readFolder2(path85.resolve(opts.base), true);
|
|
67084
67361
|
const version2 = readVersion2(draft.files), baseVersion = base && readVersion2(base.files);
|
|
67085
67362
|
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");
|
|
67086
67363
|
fs88.mkdirSync(staging, { recursive: true });
|
|
67087
67364
|
const review = { version: 2, base: base && baseVersion ? { ...baseVersion, fingerprint: base.fingerprint } : null, fingerprint: draft.fingerprint, files: [] };
|
|
67088
67365
|
const save3 = (file2, bytes2) => {
|
|
67089
|
-
const target =
|
|
67090
|
-
fs88.mkdirSync(
|
|
67366
|
+
const target = path85.join(staging, file2);
|
|
67367
|
+
fs88.mkdirSync(path85.dirname(target), { recursive: true });
|
|
67091
67368
|
fs88.writeFileSync(target, bytes2);
|
|
67092
67369
|
return file2;
|
|
67093
67370
|
};
|
|
@@ -67097,10 +67374,10 @@ async function cmdStudioPreview(id2, opts) {
|
|
|
67097
67374
|
const before = base?.files[file2] ?? null, after2 = draft.files[file2] ?? null;
|
|
67098
67375
|
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)) } : {} });
|
|
67099
67376
|
}
|
|
67100
|
-
for (const p of ["a", "b"]) fs88.rmSync(
|
|
67377
|
+
for (const p of ["a", "b"]) fs88.rmSync(path85.join(staging, p), { force: true });
|
|
67101
67378
|
if (!parseReview(review)) throw Error("generated review is invalid");
|
|
67102
67379
|
save3("review.json", JSON.stringify(review, null, 2) + "\n");
|
|
67103
|
-
fs88.mkdirSync(
|
|
67380
|
+
fs88.mkdirSync(path85.dirname(destination), { recursive: true });
|
|
67104
67381
|
if (fs88.existsSync(destination)) {
|
|
67105
67382
|
fs88.renameSync(destination, backup);
|
|
67106
67383
|
moved = true;
|
|
@@ -67118,7 +67395,7 @@ ${items}
|
|
|
67118
67395
|
|
|
67119
67396
|
</Set>` : items;
|
|
67120
67397
|
say([tag, files].filter(Boolean).join("\n\n"));
|
|
67121
|
-
return { file:
|
|
67398
|
+
return { file: path85.join(destination, "review.json"), tag, files };
|
|
67122
67399
|
} catch (error62) {
|
|
67123
67400
|
if (moved && !fs88.existsSync(destination)) fs88.renameSync(backup, destination);
|
|
67124
67401
|
if (error62 && typeof error62 === "object" && "kind" in error62) throw error62;
|
|
@@ -67456,6 +67733,10 @@ function declareRuns(program2, cli) {
|
|
|
67456
67733
|
(p) => cloudMusic({ seconds: o.seconds, out: o.out, prompt: prompt.join(" ") }, p)
|
|
67457
67734
|
);
|
|
67458
67735
|
});
|
|
67736
|
+
withShared(program2.command("transcribe")).argument("<media>", "the local video or audio file").summary("transcribe an audio stream in a Runner task").option("--audio-stream <index>", "zero-based audio stream index, required when there are multiple streams").option("--language <code>", "language hint or auto (default)").requiredOption("--out <file>", "where to write the JSON transcript").requiredOption("--vtt <file>", "where to write the WebVTT captions").action(async function(media) {
|
|
67737
|
+
const options = this.opts();
|
|
67738
|
+
await boardless(this, cli, () => cmdTranscribe(media, options, cli.cwd));
|
|
67739
|
+
});
|
|
67459
67740
|
const template = withShared(program2.command("template")).summary("the shared UI and video template catalog").action(function() {
|
|
67460
67741
|
this.help();
|
|
67461
67742
|
});
|
|
@@ -67522,6 +67803,9 @@ function declareRuns(program2, cli) {
|
|
|
67522
67803
|
flowWord("pull").argument("<id>", "the studio, from `studio list`").argument("[folder]", "where to write it, empty or new; default ./<id>").summary("write the studio's current version into a folder to edit").action(async function(id2, folder2) {
|
|
67523
67804
|
await onBoard(this, cli, () => cmdStudioPull(id2, folder2));
|
|
67524
67805
|
});
|
|
67806
|
+
flowWord("clone").argument("<id>", "the studio, from `studio list`").argument("<folder>", "where to write the draft, empty or new").option("--name <name>", "the draft name; defaults to the source name with a copy suffix").summary("write an independent local draft from a Studio").action(async function(id2, folder2) {
|
|
67807
|
+
await onBoard(this, cli, () => cmdStudioClone(id2, folder2, this.opts().name));
|
|
67808
|
+
});
|
|
67525
67809
|
flowWord("create").argument("<folder>", "the studio files to create").requiredOption("--request-id <id>", "the publication request, reused on retry").option("--workspace <id>", "the target workspace; otherwise use the linked project").summary("create a workspace studio from a local folder").action(async function(folder2) {
|
|
67526
67810
|
if (this.opts().workspace) await boardless(this, cli, () => cmdStudioCreate(folder2, this.opts()));
|
|
67527
67811
|
else await onBoard(this, cli, () => cmdStudioCreate(folder2, this.opts()));
|
|
@@ -67708,6 +67992,7 @@ var init_agent2 = __esm({
|
|
|
67708
67992
|
init_manual();
|
|
67709
67993
|
init_agent();
|
|
67710
67994
|
init_cloud();
|
|
67995
|
+
init_transcribe();
|
|
67711
67996
|
init_cloud_template();
|
|
67712
67997
|
init_components2();
|
|
67713
67998
|
init_goal();
|
|
@@ -67750,7 +68035,7 @@ init_agent2();
|
|
|
67750
68035
|
|
|
67751
68036
|
// ../cli/src/lib/cli/setup.ts
|
|
67752
68037
|
import fs90 from "node:fs";
|
|
67753
|
-
import
|
|
68038
|
+
import path87 from "node:path";
|
|
67754
68039
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
67755
68040
|
|
|
67756
68041
|
// ../cli/src/commands/update.ts
|
|
@@ -67759,7 +68044,7 @@ init_config_template();
|
|
|
67759
68044
|
init_io();
|
|
67760
68045
|
init_version();
|
|
67761
68046
|
import fs89 from "node:fs";
|
|
67762
|
-
import
|
|
68047
|
+
import path86 from "node:path";
|
|
67763
68048
|
import { spawnSync as spawnSync9 } from "node:child_process";
|
|
67764
68049
|
var NAME = "wildcrane";
|
|
67765
68050
|
var REPO = "https://github.com/wildcrane-ai/wildcrane";
|
|
@@ -67800,8 +68085,8 @@ async function cmdUpdate2(ctx) {
|
|
|
67800
68085
|
return { updated: ctx.dir, from, to: SKILL_VERSION };
|
|
67801
68086
|
}
|
|
67802
68087
|
async function repairBoard(root2, report3, named2) {
|
|
67803
|
-
const legacy2 =
|
|
67804
|
-
const kept2 =
|
|
68088
|
+
const legacy2 = path86.join(root2, "docs", "kanban");
|
|
68089
|
+
const kept2 = path86.join(root2, ".akb", "kanban");
|
|
67805
68090
|
const board = named2 ?? (fs89.existsSync(legacy2) ? legacy2 : kept2);
|
|
67806
68091
|
if (!fs89.existsSync(board)) {
|
|
67807
68092
|
report3.notes.push(`No board found. ${BOARD_LINK_HINT}.`);
|
|
@@ -67814,7 +68099,7 @@ async function repairBoard(root2, report3, named2) {
|
|
|
67814
68099
|
return true;
|
|
67815
68100
|
}
|
|
67816
68101
|
function checkConfig(board, report3) {
|
|
67817
|
-
const file2 =
|
|
68102
|
+
const file2 = path86.join(board, "config.md");
|
|
67818
68103
|
const current = read4(file2);
|
|
67819
68104
|
if (!current) return;
|
|
67820
68105
|
const added = missingConfigKeys(current);
|
|
@@ -67825,7 +68110,7 @@ function checkConfig(board, report3) {
|
|
|
67825
68110
|
}
|
|
67826
68111
|
}
|
|
67827
68112
|
function checkModules(board, report3) {
|
|
67828
|
-
const file2 =
|
|
68113
|
+
const file2 = path86.join(board, "modules.md");
|
|
67829
68114
|
const map3 = read4(file2);
|
|
67830
68115
|
if (map3 && map3.includes(UNFILLED)) {
|
|
67831
68116
|
report3.notes.push(
|
|
@@ -67877,14 +68162,14 @@ function declareSetup(program2, cli) {
|
|
|
67877
68162
|
program2.version(SKILL_VERSION, "-v, --version", "print this version").addHelpText("beforeAll", spelled(cli.program));
|
|
67878
68163
|
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");
|
|
67879
68164
|
const where = (cmd) => {
|
|
67880
|
-
const dir =
|
|
68165
|
+
const dir = path87.resolve(String(cmd.optsWithGlobals().dir ?? cli.cwd));
|
|
67881
68166
|
if (!fs90.existsSync(dir)) throw new BoardError(`no such folder: ${dir}`, { kind: "no-such-folder", dir });
|
|
67882
68167
|
return dir;
|
|
67883
68168
|
};
|
|
67884
68169
|
dirOption(program2.command("update")).summary("Repair an existing board and check for CLI updates.").description("Repair an existing board and show how to upgrade the CLI. If no board exists, link this folder to a WildCrane project from the plugin.").action(async function() {
|
|
67885
68170
|
const dir = where(this);
|
|
67886
68171
|
const named2 = this.optsWithGlobals().board ?? process.env.AI4KANBAN_BOARD?.trim();
|
|
67887
|
-
const board = named2 ?
|
|
68172
|
+
const board = named2 ? path87.resolve(cli.cwd, named2) : null;
|
|
67888
68173
|
await runAction(ctxOf(this, cli.program), {}, () => cmdUpdate2({ dir, program: cli.program, board }));
|
|
67889
68174
|
});
|
|
67890
68175
|
program2.command("__rules", { hidden: true }).action(function() {
|