wildcrane-runner 0.6.69 → 0.6.71
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 +87398 -2902
- package/dist/akb/package.json +1 -1
- package/dist/akb-proxy.mjs +1 -1
- package/dist/codex-proxy.mjs +1 -1
- package/dist/codex-service-main.mjs +2 -2
- package/dist/flow-worker-main.mjs +465 -420
- package/dist/launcher.mjs +6 -6
- package/dist/plugin.mjs +6 -6
- package/dist/runner.mjs +469 -423
- package/dist/settings.mjs +6 -6
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// wildcrane-runner 0.6.
|
|
1
|
+
// wildcrane-runner 0.6.71 — built by runner/scripts/build.mjs. Do not edit.
|
|
2
2
|
import { createRequire as __ai4kanbanRequire } from 'node:module'
|
|
3
3
|
const require = __ai4kanbanRequire(import.meta.url)
|
|
4
4
|
var __create = Object.create;
|
|
@@ -6427,17 +6427,17 @@ var require_body = __commonJS({
|
|
|
6427
6427
|
}
|
|
6428
6428
|
assert(webidl.is.ReadableStream(stream));
|
|
6429
6429
|
let action = null;
|
|
6430
|
-
let
|
|
6430
|
+
let source2 = null;
|
|
6431
6431
|
let length = null;
|
|
6432
6432
|
let type = null;
|
|
6433
6433
|
if (typeof object === "string") {
|
|
6434
|
-
|
|
6434
|
+
source2 = object;
|
|
6435
6435
|
type = "text/plain;charset=UTF-8";
|
|
6436
6436
|
} else if (webidl.is.URLSearchParams(object)) {
|
|
6437
|
-
|
|
6437
|
+
source2 = object.toString();
|
|
6438
6438
|
type = "application/x-www-form-urlencoded;charset=UTF-8";
|
|
6439
6439
|
} else if (webidl.is.BufferSource(object)) {
|
|
6440
|
-
|
|
6440
|
+
source2 = webidl.util.getCopyOfBytesHeldByBufferSource(object);
|
|
6441
6441
|
} else if (webidl.is.FormData(object)) {
|
|
6442
6442
|
const boundary = `----formdata-undici-0${`${random(1e11)}`.padStart(11, "0")}`;
|
|
6443
6443
|
const prefix = `--${boundary}\r
|
|
@@ -6476,7 +6476,7 @@ Content-Type: ${value.type || "application/octet-stream"}\r
|
|
|
6476
6476
|
if (hasUnknownSizeValue) {
|
|
6477
6477
|
length = null;
|
|
6478
6478
|
}
|
|
6479
|
-
|
|
6479
|
+
source2 = object;
|
|
6480
6480
|
const parts = (async function* () {
|
|
6481
6481
|
for (const part of blobParts) {
|
|
6482
6482
|
if (part.stream) {
|
|
@@ -6489,7 +6489,7 @@ Content-Type: ${value.type || "application/octet-stream"}\r
|
|
|
6489
6489
|
action = () => parts;
|
|
6490
6490
|
type = `multipart/form-data; boundary=${boundary}`;
|
|
6491
6491
|
} else if (webidl.is.Blob(object)) {
|
|
6492
|
-
|
|
6492
|
+
source2 = object;
|
|
6493
6493
|
length = object.size;
|
|
6494
6494
|
if (object.type) {
|
|
6495
6495
|
type = object.type;
|
|
@@ -6505,11 +6505,11 @@ Content-Type: ${value.type || "application/octet-stream"}\r
|
|
|
6505
6505
|
}
|
|
6506
6506
|
stream = webidl.is.ReadableStream(object) ? object : ReadableStreamFrom(object);
|
|
6507
6507
|
}
|
|
6508
|
-
if (typeof
|
|
6509
|
-
action = () =>
|
|
6510
|
-
length = typeof
|
|
6508
|
+
if (typeof source2 === "string" || isUint8Array(source2)) {
|
|
6509
|
+
action = () => source2;
|
|
6510
|
+
length = typeof source2 === "string" ? Buffer.byteLength(source2) : source2.length;
|
|
6511
6511
|
}
|
|
6512
|
-
const body = { stream, source, length };
|
|
6512
|
+
const body = { stream, source: source2, length };
|
|
6513
6513
|
return [body, type];
|
|
6514
6514
|
}
|
|
6515
6515
|
function safelyExtractBody(object, keepalive = false) {
|
|
@@ -23600,7 +23600,7 @@ var require_events = __commonJS({
|
|
|
23600
23600
|
}
|
|
23601
23601
|
return this.#eventInit.ports;
|
|
23602
23602
|
}
|
|
23603
|
-
initMessageEvent(type, bubbles = false, cancelable = false, data = null, origin = "", lastEventId = "",
|
|
23603
|
+
initMessageEvent(type, bubbles = false, cancelable = false, data = null, origin = "", lastEventId = "", source2 = null, ports = []) {
|
|
23604
23604
|
webidl.brandCheck(this, _MessageEvent);
|
|
23605
23605
|
webidl.argumentLengthCheck(arguments, 1, "MessageEvent.initMessageEvent");
|
|
23606
23606
|
return new _MessageEvent(type, {
|
|
@@ -23609,7 +23609,7 @@ var require_events = __commonJS({
|
|
|
23609
23609
|
data,
|
|
23610
23610
|
origin,
|
|
23611
23611
|
lastEventId,
|
|
23612
|
-
source,
|
|
23612
|
+
source: source2,
|
|
23613
23613
|
ports
|
|
23614
23614
|
});
|
|
23615
23615
|
}
|
|
@@ -29086,15 +29086,15 @@ var require_react_dom_server_legacy_node_production = __commonJS({
|
|
|
29086
29086
|
["xHeight", "x-height"]
|
|
29087
29087
|
]);
|
|
29088
29088
|
var matchHtmlRegExp = /["'&<>]/;
|
|
29089
|
-
function escapeTextForBrowser(
|
|
29090
|
-
if ("boolean" === typeof
|
|
29091
|
-
return "" +
|
|
29092
|
-
|
|
29093
|
-
var match = matchHtmlRegExp.exec(
|
|
29089
|
+
function escapeTextForBrowser(text4) {
|
|
29090
|
+
if ("boolean" === typeof text4 || "number" === typeof text4 || "bigint" === typeof text4)
|
|
29091
|
+
return "" + text4;
|
|
29092
|
+
text4 = "" + text4;
|
|
29093
|
+
var match = matchHtmlRegExp.exec(text4);
|
|
29094
29094
|
if (match) {
|
|
29095
29095
|
var html = "", index, lastIndex = 0;
|
|
29096
|
-
for (index = match.index; index <
|
|
29097
|
-
switch (
|
|
29096
|
+
for (index = match.index; index < text4.length; index++) {
|
|
29097
|
+
switch (text4.charCodeAt(index)) {
|
|
29098
29098
|
case 34:
|
|
29099
29099
|
match = """;
|
|
29100
29100
|
break;
|
|
@@ -29113,13 +29113,13 @@ var require_react_dom_server_legacy_node_production = __commonJS({
|
|
|
29113
29113
|
default:
|
|
29114
29114
|
continue;
|
|
29115
29115
|
}
|
|
29116
|
-
lastIndex !== index && (html +=
|
|
29116
|
+
lastIndex !== index && (html += text4.slice(lastIndex, index));
|
|
29117
29117
|
lastIndex = index + 1;
|
|
29118
29118
|
html += match;
|
|
29119
29119
|
}
|
|
29120
|
-
|
|
29120
|
+
text4 = lastIndex !== index ? html + text4.slice(lastIndex, index) : html;
|
|
29121
29121
|
}
|
|
29122
|
-
return
|
|
29122
|
+
return text4;
|
|
29123
29123
|
}
|
|
29124
29124
|
var uppercasePattern = /([A-Z])/g;
|
|
29125
29125
|
var msPattern = /^ms-/;
|
|
@@ -31140,10 +31140,10 @@ var require_react_dom_server_legacy_node_production = __commonJS({
|
|
|
31140
31140
|
generateStaticMarkup
|
|
31141
31141
|
};
|
|
31142
31142
|
}
|
|
31143
|
-
function pushTextInstance(target,
|
|
31143
|
+
function pushTextInstance(target, text4, renderState, textEmbedded) {
|
|
31144
31144
|
if (renderState.generateStaticMarkup)
|
|
31145
|
-
return target.push(escapeTextForBrowser(
|
|
31146
|
-
"" ===
|
|
31145
|
+
return target.push(escapeTextForBrowser(text4)), false;
|
|
31146
|
+
"" === text4 ? target = textEmbedded : (textEmbedded && target.push("<!-- -->"), target.push(escapeTextForBrowser(text4)), target = true);
|
|
31147
31147
|
return target;
|
|
31148
31148
|
}
|
|
31149
31149
|
function pushSegmentFinale(target, renderState, lastPushedText, textEmbedded) {
|
|
@@ -34376,15 +34376,15 @@ var require_react_dom_server_node_production = __commonJS({
|
|
|
34376
34376
|
["xHeight", "x-height"]
|
|
34377
34377
|
]);
|
|
34378
34378
|
var matchHtmlRegExp = /["'&<>]/;
|
|
34379
|
-
function escapeTextForBrowser(
|
|
34380
|
-
if ("boolean" === typeof
|
|
34381
|
-
return "" +
|
|
34382
|
-
|
|
34383
|
-
var match = matchHtmlRegExp.exec(
|
|
34379
|
+
function escapeTextForBrowser(text4) {
|
|
34380
|
+
if ("boolean" === typeof text4 || "number" === typeof text4 || "bigint" === typeof text4)
|
|
34381
|
+
return "" + text4;
|
|
34382
|
+
text4 = "" + text4;
|
|
34383
|
+
var match = matchHtmlRegExp.exec(text4);
|
|
34384
34384
|
if (match) {
|
|
34385
34385
|
var html = "", index, lastIndex = 0;
|
|
34386
|
-
for (index = match.index; index <
|
|
34387
|
-
switch (
|
|
34386
|
+
for (index = match.index; index < text4.length; index++) {
|
|
34387
|
+
switch (text4.charCodeAt(index)) {
|
|
34388
34388
|
case 34:
|
|
34389
34389
|
match = """;
|
|
34390
34390
|
break;
|
|
@@ -34403,13 +34403,13 @@ var require_react_dom_server_node_production = __commonJS({
|
|
|
34403
34403
|
default:
|
|
34404
34404
|
continue;
|
|
34405
34405
|
}
|
|
34406
|
-
lastIndex !== index && (html +=
|
|
34406
|
+
lastIndex !== index && (html += text4.slice(lastIndex, index));
|
|
34407
34407
|
lastIndex = index + 1;
|
|
34408
34408
|
html += match;
|
|
34409
34409
|
}
|
|
34410
|
-
|
|
34410
|
+
text4 = lastIndex !== index ? html + text4.slice(lastIndex, index) : html;
|
|
34411
34411
|
}
|
|
34412
|
-
return
|
|
34412
|
+
return text4;
|
|
34413
34413
|
}
|
|
34414
34414
|
var uppercasePattern = /([A-Z])/g;
|
|
34415
34415
|
var msPattern = /^ms-/;
|
|
@@ -34695,10 +34695,10 @@ var require_react_dom_server_node_production = __commonJS({
|
|
|
34695
34695
|
return resumableState + "_";
|
|
34696
34696
|
}
|
|
34697
34697
|
var textSeparator = stringToPrecomputedChunk("<!-- -->");
|
|
34698
|
-
function pushTextInstance(target,
|
|
34699
|
-
if ("" ===
|
|
34698
|
+
function pushTextInstance(target, text4, renderState, textEmbedded) {
|
|
34699
|
+
if ("" === text4) return textEmbedded;
|
|
34700
34700
|
textEmbedded && target.push(textSeparator);
|
|
34701
|
-
target.push(escapeTextForBrowser(
|
|
34701
|
+
target.push(escapeTextForBrowser(text4));
|
|
34702
34702
|
return true;
|
|
34703
34703
|
}
|
|
34704
34704
|
function pushViewTransitionAttributes(target, formatContext) {
|
|
@@ -40814,16 +40814,16 @@ var require_react_dom_server_legacy_node_development = __commonJS({
|
|
|
40814
40814
|
return character.toUpperCase();
|
|
40815
40815
|
});
|
|
40816
40816
|
}
|
|
40817
|
-
function escapeTextForBrowser(
|
|
40818
|
-
if ("boolean" === typeof
|
|
40819
|
-
return "" +
|
|
40820
|
-
checkHtmlStringCoercion(
|
|
40821
|
-
|
|
40822
|
-
var match = matchHtmlRegExp.exec(
|
|
40817
|
+
function escapeTextForBrowser(text4) {
|
|
40818
|
+
if ("boolean" === typeof text4 || "number" === typeof text4 || "bigint" === typeof text4)
|
|
40819
|
+
return "" + text4;
|
|
40820
|
+
checkHtmlStringCoercion(text4);
|
|
40821
|
+
text4 = "" + text4;
|
|
40822
|
+
var match = matchHtmlRegExp.exec(text4);
|
|
40823
40823
|
if (match) {
|
|
40824
40824
|
var html = "", index, lastIndex = 0;
|
|
40825
|
-
for (index = match.index; index <
|
|
40826
|
-
switch (
|
|
40825
|
+
for (index = match.index; index < text4.length; index++) {
|
|
40826
|
+
switch (text4.charCodeAt(index)) {
|
|
40827
40827
|
case 34:
|
|
40828
40828
|
match = """;
|
|
40829
40829
|
break;
|
|
@@ -40842,13 +40842,13 @@ var require_react_dom_server_legacy_node_development = __commonJS({
|
|
|
40842
40842
|
default:
|
|
40843
40843
|
continue;
|
|
40844
40844
|
}
|
|
40845
|
-
lastIndex !== index && (html +=
|
|
40845
|
+
lastIndex !== index && (html += text4.slice(lastIndex, index));
|
|
40846
40846
|
lastIndex = index + 1;
|
|
40847
40847
|
html += match;
|
|
40848
40848
|
}
|
|
40849
|
-
|
|
40849
|
+
text4 = lastIndex !== index ? html + text4.slice(lastIndex, index) : html;
|
|
40850
40850
|
}
|
|
40851
|
-
return
|
|
40851
|
+
return text4;
|
|
40852
40852
|
}
|
|
40853
40853
|
function sanitizeURL(url) {
|
|
40854
40854
|
return isJavaScriptProtocol.test("" + url) ? "javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')" : url;
|
|
@@ -43032,10 +43032,10 @@ var require_react_dom_server_legacy_node_development = __commonJS({
|
|
|
43032
43032
|
generateStaticMarkup
|
|
43033
43033
|
};
|
|
43034
43034
|
}
|
|
43035
|
-
function pushTextInstance(target,
|
|
43035
|
+
function pushTextInstance(target, text4, renderState, textEmbedded) {
|
|
43036
43036
|
if (renderState.generateStaticMarkup)
|
|
43037
|
-
return target.push(escapeTextForBrowser(
|
|
43038
|
-
"" ===
|
|
43037
|
+
return target.push(escapeTextForBrowser(text4)), false;
|
|
43038
|
+
"" === text4 ? target = textEmbedded : (textEmbedded && target.push("<!-- -->"), target.push(escapeTextForBrowser(text4)), target = true);
|
|
43039
43039
|
return target;
|
|
43040
43040
|
}
|
|
43041
43041
|
function pushSegmentFinale(target, renderState, lastPushedText, textEmbedded) {
|
|
@@ -48359,16 +48359,16 @@ var require_react_dom_server_node_development = __commonJS({
|
|
|
48359
48359
|
return character.toUpperCase();
|
|
48360
48360
|
});
|
|
48361
48361
|
}
|
|
48362
|
-
function escapeTextForBrowser(
|
|
48363
|
-
if ("boolean" === typeof
|
|
48364
|
-
return "" +
|
|
48365
|
-
checkHtmlStringCoercion(
|
|
48366
|
-
|
|
48367
|
-
var match = matchHtmlRegExp.exec(
|
|
48362
|
+
function escapeTextForBrowser(text4) {
|
|
48363
|
+
if ("boolean" === typeof text4 || "number" === typeof text4 || "bigint" === typeof text4)
|
|
48364
|
+
return "" + text4;
|
|
48365
|
+
checkHtmlStringCoercion(text4);
|
|
48366
|
+
text4 = "" + text4;
|
|
48367
|
+
var match = matchHtmlRegExp.exec(text4);
|
|
48368
48368
|
if (match) {
|
|
48369
48369
|
var html = "", index, lastIndex = 0;
|
|
48370
|
-
for (index = match.index; index <
|
|
48371
|
-
switch (
|
|
48370
|
+
for (index = match.index; index < text4.length; index++) {
|
|
48371
|
+
switch (text4.charCodeAt(index)) {
|
|
48372
48372
|
case 34:
|
|
48373
48373
|
match = """;
|
|
48374
48374
|
break;
|
|
@@ -48387,13 +48387,13 @@ var require_react_dom_server_node_development = __commonJS({
|
|
|
48387
48387
|
default:
|
|
48388
48388
|
continue;
|
|
48389
48389
|
}
|
|
48390
|
-
lastIndex !== index && (html +=
|
|
48390
|
+
lastIndex !== index && (html += text4.slice(lastIndex, index));
|
|
48391
48391
|
lastIndex = index + 1;
|
|
48392
48392
|
html += match;
|
|
48393
48393
|
}
|
|
48394
|
-
|
|
48394
|
+
text4 = lastIndex !== index ? html + text4.slice(lastIndex, index) : html;
|
|
48395
48395
|
}
|
|
48396
|
-
return
|
|
48396
|
+
return text4;
|
|
48397
48397
|
}
|
|
48398
48398
|
function sanitizeURL(url) {
|
|
48399
48399
|
return isJavaScriptProtocol.test("" + url) ? "javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')" : url;
|
|
@@ -48678,10 +48678,10 @@ var require_react_dom_server_node_development = __commonJS({
|
|
|
48678
48678
|
0 < localId && (resumableState += "H" + localId.toString(32));
|
|
48679
48679
|
return resumableState + "_";
|
|
48680
48680
|
}
|
|
48681
|
-
function pushTextInstance(target,
|
|
48682
|
-
if ("" ===
|
|
48681
|
+
function pushTextInstance(target, text4, renderState, textEmbedded) {
|
|
48682
|
+
if ("" === text4) return textEmbedded;
|
|
48683
48683
|
textEmbedded && target.push(textSeparator);
|
|
48684
|
-
target.push(escapeTextForBrowser(
|
|
48684
|
+
target.push(escapeTextForBrowser(text4));
|
|
48685
48685
|
return true;
|
|
48686
48686
|
}
|
|
48687
48687
|
function pushViewTransitionAttributes(target, formatContext) {
|
|
@@ -68320,13 +68320,13 @@ var require_JSXTransformer = __commonJS({
|
|
|
68320
68320
|
return firstChar >= _charcodes.charCodes.lowercaseA && firstChar <= _charcodes.charCodes.lowercaseZ;
|
|
68321
68321
|
}
|
|
68322
68322
|
exports.startsWithLowerCase = startsWithLowerCase;
|
|
68323
|
-
function formatJSXTextLiteral(
|
|
68323
|
+
function formatJSXTextLiteral(text4) {
|
|
68324
68324
|
let result = "";
|
|
68325
68325
|
let whitespace = "";
|
|
68326
68326
|
let isInInitialLineWhitespace = false;
|
|
68327
68327
|
let seenNonWhitespace = false;
|
|
68328
|
-
for (let i = 0; i <
|
|
68329
|
-
const c2 =
|
|
68328
|
+
for (let i = 0; i < text4.length; i++) {
|
|
68329
|
+
const c2 = text4[i];
|
|
68330
68330
|
if (c2 === " " || c2 === " " || c2 === "\r") {
|
|
68331
68331
|
if (!isInInitialLineWhitespace) {
|
|
68332
68332
|
whitespace += c2;
|
|
@@ -68341,7 +68341,7 @@ var require_JSXTransformer = __commonJS({
|
|
|
68341
68341
|
result += whitespace;
|
|
68342
68342
|
whitespace = "";
|
|
68343
68343
|
if (c2 === "&") {
|
|
68344
|
-
const { entity, newI } = processEntity(
|
|
68344
|
+
const { entity, newI } = processEntity(text4, i + 1);
|
|
68345
68345
|
i = newI - 1;
|
|
68346
68346
|
result += entity;
|
|
68347
68347
|
} else {
|
|
@@ -68356,10 +68356,10 @@ var require_JSXTransformer = __commonJS({
|
|
|
68356
68356
|
}
|
|
68357
68357
|
return JSON.stringify(result);
|
|
68358
68358
|
}
|
|
68359
|
-
function formatJSXTextReplacement(
|
|
68359
|
+
function formatJSXTextReplacement(text4) {
|
|
68360
68360
|
let numNewlines = 0;
|
|
68361
68361
|
let numSpaces = 0;
|
|
68362
|
-
for (const c2 of
|
|
68362
|
+
for (const c2 of text4) {
|
|
68363
68363
|
if (c2 === "\n") {
|
|
68364
68364
|
numNewlines++;
|
|
68365
68365
|
numSpaces = 0;
|
|
@@ -68369,21 +68369,21 @@ var require_JSXTransformer = __commonJS({
|
|
|
68369
68369
|
}
|
|
68370
68370
|
return "\n".repeat(numNewlines) + " ".repeat(numSpaces);
|
|
68371
68371
|
}
|
|
68372
|
-
function formatJSXStringValueLiteral(
|
|
68372
|
+
function formatJSXStringValueLiteral(text4) {
|
|
68373
68373
|
let result = "";
|
|
68374
|
-
for (let i = 0; i <
|
|
68375
|
-
const c2 =
|
|
68374
|
+
for (let i = 0; i < text4.length; i++) {
|
|
68375
|
+
const c2 = text4[i];
|
|
68376
68376
|
if (c2 === "\n") {
|
|
68377
|
-
if (/\s/.test(
|
|
68377
|
+
if (/\s/.test(text4[i + 1])) {
|
|
68378
68378
|
result += " ";
|
|
68379
|
-
while (i <
|
|
68379
|
+
while (i < text4.length && /\s/.test(text4[i + 1])) {
|
|
68380
68380
|
i++;
|
|
68381
68381
|
}
|
|
68382
68382
|
} else {
|
|
68383
68383
|
result += "\n";
|
|
68384
68384
|
}
|
|
68385
68385
|
} else if (c2 === "&") {
|
|
68386
|
-
const { entity, newI } = processEntity(
|
|
68386
|
+
const { entity, newI } = processEntity(text4, i + 1);
|
|
68387
68387
|
result += entity;
|
|
68388
68388
|
i = newI - 1;
|
|
68389
68389
|
} else {
|
|
@@ -68392,38 +68392,38 @@ var require_JSXTransformer = __commonJS({
|
|
|
68392
68392
|
}
|
|
68393
68393
|
return JSON.stringify(result);
|
|
68394
68394
|
}
|
|
68395
|
-
function processEntity(
|
|
68395
|
+
function processEntity(text4, indexAfterAmpersand) {
|
|
68396
68396
|
let str4 = "";
|
|
68397
68397
|
let count2 = 0;
|
|
68398
68398
|
let entity;
|
|
68399
68399
|
let i = indexAfterAmpersand;
|
|
68400
|
-
if (
|
|
68400
|
+
if (text4[i] === "#") {
|
|
68401
68401
|
let radix = 10;
|
|
68402
68402
|
i++;
|
|
68403
68403
|
let numStart;
|
|
68404
|
-
if (
|
|
68404
|
+
if (text4[i] === "x") {
|
|
68405
68405
|
radix = 16;
|
|
68406
68406
|
i++;
|
|
68407
68407
|
numStart = i;
|
|
68408
|
-
while (i <
|
|
68408
|
+
while (i < text4.length && isHexDigit(text4.charCodeAt(i))) {
|
|
68409
68409
|
i++;
|
|
68410
68410
|
}
|
|
68411
68411
|
} else {
|
|
68412
68412
|
numStart = i;
|
|
68413
|
-
while (i <
|
|
68413
|
+
while (i < text4.length && isDecimalDigit(text4.charCodeAt(i))) {
|
|
68414
68414
|
i++;
|
|
68415
68415
|
}
|
|
68416
68416
|
}
|
|
68417
|
-
if (
|
|
68418
|
-
const numStr =
|
|
68417
|
+
if (text4[i] === ";") {
|
|
68418
|
+
const numStr = text4.slice(numStart, i);
|
|
68419
68419
|
if (numStr) {
|
|
68420
68420
|
i++;
|
|
68421
68421
|
entity = String.fromCodePoint(parseInt(numStr, radix));
|
|
68422
68422
|
}
|
|
68423
68423
|
}
|
|
68424
68424
|
} else {
|
|
68425
|
-
while (i <
|
|
68426
|
-
const ch =
|
|
68425
|
+
while (i < text4.length && count2++ < 10) {
|
|
68426
|
+
const ch = text4[i];
|
|
68427
68427
|
i++;
|
|
68428
68428
|
if (ch === ";") {
|
|
68429
68429
|
entity = _xhtml2.default.get(str4);
|
|
@@ -69631,7 +69631,7 @@ var require_trace_mapping_umd = __commonJS({
|
|
|
69631
69631
|
function resolver(mapUrl, sourceRoot) {
|
|
69632
69632
|
const from = stripFilename(mapUrl);
|
|
69633
69633
|
const prefix = sourceRoot ? sourceRoot + "/" : "";
|
|
69634
|
-
return (
|
|
69634
|
+
return (source2) => (0, import_resolve_uri.default)(prefix + (source2 || ""), from);
|
|
69635
69635
|
}
|
|
69636
69636
|
var COLUMN = 0;
|
|
69637
69637
|
var SOURCES_INDEX = 1;
|
|
@@ -69680,15 +69680,15 @@ var require_trace_mapping_umd = __commonJS({
|
|
|
69680
69680
|
const sourceIndex2 = seg[SOURCES_INDEX];
|
|
69681
69681
|
const sourceLine = seg[SOURCE_LINE];
|
|
69682
69682
|
const sourceColumn = seg[SOURCE_COLUMN];
|
|
69683
|
-
const
|
|
69684
|
-
const segs =
|
|
69683
|
+
const source2 = sources2[sourceIndex2];
|
|
69684
|
+
const segs = source2[sourceLine] || (source2[sourceLine] = []);
|
|
69685
69685
|
segs.push([sourceColumn, i, seg[COLUMN]]);
|
|
69686
69686
|
}
|
|
69687
69687
|
}
|
|
69688
69688
|
for (let i = 0; i < sources2.length; i++) {
|
|
69689
|
-
const
|
|
69690
|
-
for (let j2 = 0; j2 <
|
|
69691
|
-
const line =
|
|
69689
|
+
const source2 = sources2[i];
|
|
69690
|
+
for (let j2 = 0; j2 < source2.length; j2++) {
|
|
69691
|
+
const line = source2[j2];
|
|
69692
69692
|
if (line) line.sort(sortComparator);
|
|
69693
69693
|
}
|
|
69694
69694
|
}
|
|
@@ -69947,12 +69947,12 @@ var require_trace_mapping_umd = __commonJS({
|
|
|
69947
69947
|
);
|
|
69948
69948
|
}
|
|
69949
69949
|
function generatedPositionFor(map2, needle) {
|
|
69950
|
-
const { source, line, column, bias } = needle;
|
|
69951
|
-
return generatedPosition(map2,
|
|
69950
|
+
const { source: source2, line, column, bias } = needle;
|
|
69951
|
+
return generatedPosition(map2, source2, line, column, bias || GREATEST_LOWER_BOUND, false);
|
|
69952
69952
|
}
|
|
69953
69953
|
function allGeneratedPositionsFor(map2, needle) {
|
|
69954
|
-
const { source, line, column, bias } = needle;
|
|
69955
|
-
return generatedPosition(map2,
|
|
69954
|
+
const { source: source2, line, column, bias } = needle;
|
|
69955
|
+
return generatedPosition(map2, source2, line, column, bias || LEAST_UPPER_BOUND, true);
|
|
69956
69956
|
}
|
|
69957
69957
|
function eachMapping(map2, cb) {
|
|
69958
69958
|
const decoded = decodedMappings(map2);
|
|
@@ -69963,12 +69963,12 @@ var require_trace_mapping_umd = __commonJS({
|
|
|
69963
69963
|
const seg = line[j2];
|
|
69964
69964
|
const generatedLine = i + 1;
|
|
69965
69965
|
const generatedColumn = seg[0];
|
|
69966
|
-
let
|
|
69966
|
+
let source2 = null;
|
|
69967
69967
|
let originalLine = null;
|
|
69968
69968
|
let originalColumn = null;
|
|
69969
69969
|
let name = null;
|
|
69970
69970
|
if (seg.length !== 1) {
|
|
69971
|
-
|
|
69971
|
+
source2 = resolvedSources[seg[1]];
|
|
69972
69972
|
originalLine = seg[2] + 1;
|
|
69973
69973
|
originalColumn = seg[3];
|
|
69974
69974
|
}
|
|
@@ -69976,7 +69976,7 @@ var require_trace_mapping_umd = __commonJS({
|
|
|
69976
69976
|
cb({
|
|
69977
69977
|
generatedLine,
|
|
69978
69978
|
generatedColumn,
|
|
69979
|
-
source,
|
|
69979
|
+
source: source2,
|
|
69980
69980
|
originalLine,
|
|
69981
69981
|
originalColumn,
|
|
69982
69982
|
name
|
|
@@ -69984,22 +69984,22 @@ var require_trace_mapping_umd = __commonJS({
|
|
|
69984
69984
|
}
|
|
69985
69985
|
}
|
|
69986
69986
|
}
|
|
69987
|
-
function sourceIndex(map2,
|
|
69987
|
+
function sourceIndex(map2, source2) {
|
|
69988
69988
|
const { sources: sources2, resolvedSources } = map2;
|
|
69989
|
-
let index = sources2.indexOf(
|
|
69990
|
-
if (index === -1) index = resolvedSources.indexOf(
|
|
69989
|
+
let index = sources2.indexOf(source2);
|
|
69990
|
+
if (index === -1) index = resolvedSources.indexOf(source2);
|
|
69991
69991
|
return index;
|
|
69992
69992
|
}
|
|
69993
|
-
function sourceContentFor(map2,
|
|
69993
|
+
function sourceContentFor(map2, source2) {
|
|
69994
69994
|
const { sourcesContent } = map2;
|
|
69995
69995
|
if (sourcesContent == null) return null;
|
|
69996
|
-
const index = sourceIndex(map2,
|
|
69996
|
+
const index = sourceIndex(map2, source2);
|
|
69997
69997
|
return index === -1 ? null : sourcesContent[index];
|
|
69998
69998
|
}
|
|
69999
|
-
function isIgnored(map2,
|
|
69999
|
+
function isIgnored(map2, source2) {
|
|
70000
70000
|
const { ignoreList } = map2;
|
|
70001
70001
|
if (ignoreList == null) return false;
|
|
70002
|
-
const index = sourceIndex(map2,
|
|
70002
|
+
const index = sourceIndex(map2, source2);
|
|
70003
70003
|
return index === -1 ? false : ignoreList.includes(index);
|
|
70004
70004
|
}
|
|
70005
70005
|
function presortedDecodedMap(map2, mapUrl) {
|
|
@@ -70025,8 +70025,8 @@ var require_trace_mapping_umd = __commonJS({
|
|
|
70025
70025
|
ignoreList: map2.ignoreList || map2.x_google_ignoreList
|
|
70026
70026
|
};
|
|
70027
70027
|
}
|
|
70028
|
-
function OMapping(
|
|
70029
|
-
return { source, line, column, name };
|
|
70028
|
+
function OMapping(source2, line, column, name) {
|
|
70029
|
+
return { source: source2, line, column, name };
|
|
70030
70030
|
}
|
|
70031
70031
|
function GMapping(line, column) {
|
|
70032
70032
|
return { line, column };
|
|
@@ -70053,14 +70053,14 @@ var require_trace_mapping_umd = __commonJS({
|
|
|
70053
70053
|
}
|
|
70054
70054
|
return result;
|
|
70055
70055
|
}
|
|
70056
|
-
function generatedPosition(map2,
|
|
70056
|
+
function generatedPosition(map2, source2, line, column, bias, all) {
|
|
70057
70057
|
var _a2, _b;
|
|
70058
70058
|
line--;
|
|
70059
70059
|
if (line < 0) throw new Error(LINE_GTR_ZERO);
|
|
70060
70060
|
if (column < 0) throw new Error(COL_GTR_EQ_ZERO);
|
|
70061
70061
|
const { sources: sources2, resolvedSources } = map2;
|
|
70062
|
-
let sourceIndex2 = sources2.indexOf(
|
|
70063
|
-
if (sourceIndex2 === -1) sourceIndex2 = resolvedSources.indexOf(
|
|
70062
|
+
let sourceIndex2 = sources2.indexOf(source2);
|
|
70063
|
+
if (sourceIndex2 === -1) sourceIndex2 = resolvedSources.indexOf(source2);
|
|
70064
70064
|
if (sourceIndex2 === -1) return all ? [] : GMapping(null, null);
|
|
70065
70065
|
const bySourceMemos = (_a2 = cast(map2))._bySourceMemos || (_a2._bySourceMemos = sources2.map(memoizedState));
|
|
70066
70066
|
const generated = (_b = cast(map2))._bySources || (_b._bySources = buildBySources(decodedMappings(map2), bySourceMemos));
|
|
@@ -70208,13 +70208,13 @@ var require_gen_mapping_umd = __commonJS({
|
|
|
70208
70208
|
function cast2(map2) {
|
|
70209
70209
|
return map2;
|
|
70210
70210
|
}
|
|
70211
|
-
function addSegment(map2, genLine, genColumn,
|
|
70211
|
+
function addSegment(map2, genLine, genColumn, source2, sourceLine, sourceColumn, name, content) {
|
|
70212
70212
|
return addSegmentInternal(
|
|
70213
70213
|
false,
|
|
70214
70214
|
map2,
|
|
70215
70215
|
genLine,
|
|
70216
70216
|
genColumn,
|
|
70217
|
-
|
|
70217
|
+
source2,
|
|
70218
70218
|
sourceLine,
|
|
70219
70219
|
sourceColumn,
|
|
70220
70220
|
name,
|
|
@@ -70224,13 +70224,13 @@ var require_gen_mapping_umd = __commonJS({
|
|
|
70224
70224
|
function addMapping(map2, mapping) {
|
|
70225
70225
|
return addMappingInternal(false, map2, mapping);
|
|
70226
70226
|
}
|
|
70227
|
-
var maybeAddSegment = (map2, genLine, genColumn,
|
|
70227
|
+
var maybeAddSegment = (map2, genLine, genColumn, source2, sourceLine, sourceColumn, name, content) => {
|
|
70228
70228
|
return addSegmentInternal(
|
|
70229
70229
|
true,
|
|
70230
70230
|
map2,
|
|
70231
70231
|
genLine,
|
|
70232
70232
|
genColumn,
|
|
70233
|
-
|
|
70233
|
+
source2,
|
|
70234
70234
|
sourceLine,
|
|
70235
70235
|
sourceColumn,
|
|
70236
70236
|
name,
|
|
@@ -70240,23 +70240,23 @@ var require_gen_mapping_umd = __commonJS({
|
|
|
70240
70240
|
var maybeAddMapping = (map2, mapping) => {
|
|
70241
70241
|
return addMappingInternal(true, map2, mapping);
|
|
70242
70242
|
};
|
|
70243
|
-
function setSourceContent(map2,
|
|
70243
|
+
function setSourceContent(map2, source2, content) {
|
|
70244
70244
|
const {
|
|
70245
70245
|
_sources: sources2,
|
|
70246
70246
|
_sourcesContent: sourcesContent
|
|
70247
70247
|
// _originalScopes: originalScopes,
|
|
70248
70248
|
} = cast2(map2);
|
|
70249
|
-
const index = put(sources2,
|
|
70249
|
+
const index = put(sources2, source2);
|
|
70250
70250
|
sourcesContent[index] = content;
|
|
70251
70251
|
}
|
|
70252
|
-
function setIgnore(map2,
|
|
70252
|
+
function setIgnore(map2, source2, ignore = true) {
|
|
70253
70253
|
const {
|
|
70254
70254
|
_sources: sources2,
|
|
70255
70255
|
_sourcesContent: sourcesContent,
|
|
70256
70256
|
_ignoreList: ignoreList
|
|
70257
70257
|
// _originalScopes: originalScopes,
|
|
70258
70258
|
} = cast2(map2);
|
|
70259
|
-
const index = put(sources2,
|
|
70259
|
+
const index = put(sources2, source2);
|
|
70260
70260
|
if (index === sourcesContent.length) sourcesContent[index] = null;
|
|
70261
70261
|
if (ignore) put(ignoreList, index);
|
|
70262
70262
|
else remove(ignoreList, index);
|
|
@@ -70311,20 +70311,20 @@ var require_gen_mapping_umd = __commonJS({
|
|
|
70311
70311
|
for (let j2 = 0; j2 < line.length; j2++) {
|
|
70312
70312
|
const seg = line[j2];
|
|
70313
70313
|
const generated = { line: i + 1, column: seg[COLUMN] };
|
|
70314
|
-
let
|
|
70314
|
+
let source2 = void 0;
|
|
70315
70315
|
let original = void 0;
|
|
70316
70316
|
let name = void 0;
|
|
70317
70317
|
if (seg.length !== 1) {
|
|
70318
|
-
|
|
70318
|
+
source2 = sources2.array[seg[SOURCES_INDEX]];
|
|
70319
70319
|
original = { line: seg[SOURCE_LINE] + 1, column: seg[SOURCE_COLUMN] };
|
|
70320
70320
|
if (seg.length === 5) name = names2.array[seg[NAMES_INDEX]];
|
|
70321
70321
|
}
|
|
70322
|
-
out.push({ generated, source, original, name });
|
|
70322
|
+
out.push({ generated, source: source2, original, name });
|
|
70323
70323
|
}
|
|
70324
70324
|
}
|
|
70325
70325
|
return out;
|
|
70326
70326
|
}
|
|
70327
|
-
function addSegmentInternal(skipable, map2, genLine, genColumn,
|
|
70327
|
+
function addSegmentInternal(skipable, map2, genLine, genColumn, source2, sourceLine, sourceColumn, name, content) {
|
|
70328
70328
|
const {
|
|
70329
70329
|
_mappings: mappings,
|
|
70330
70330
|
_sources: sources2,
|
|
@@ -70334,13 +70334,13 @@ var require_gen_mapping_umd = __commonJS({
|
|
|
70334
70334
|
} = cast2(map2);
|
|
70335
70335
|
const line = getIndex(mappings, genLine);
|
|
70336
70336
|
const index = getColumnIndex(line, genColumn);
|
|
70337
|
-
if (!
|
|
70337
|
+
if (!source2) {
|
|
70338
70338
|
if (skipable && skipSourceless(line, index)) return;
|
|
70339
70339
|
return insert(line, index, [genColumn]);
|
|
70340
70340
|
}
|
|
70341
70341
|
assert(sourceLine);
|
|
70342
70342
|
assert(sourceColumn);
|
|
70343
|
-
const sourcesIndex = put(sources2,
|
|
70343
|
+
const sourcesIndex = put(sources2, source2);
|
|
70344
70344
|
const namesIndex = name ? put(names2, name) : NO_NAME;
|
|
70345
70345
|
if (sourcesIndex === sourcesContent.length) sourcesContent[sourcesIndex] = content != null ? content : null;
|
|
70346
70346
|
if (skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex)) {
|
|
@@ -70397,8 +70397,8 @@ var require_gen_mapping_umd = __commonJS({
|
|
|
70397
70397
|
return sourcesIndex === prev[SOURCES_INDEX] && sourceLine === prev[SOURCE_LINE] && sourceColumn === prev[SOURCE_COLUMN] && namesIndex === (prev.length === 5 ? prev[NAMES_INDEX] : NO_NAME);
|
|
70398
70398
|
}
|
|
70399
70399
|
function addMappingInternal(skipable, map2, mapping) {
|
|
70400
|
-
const { generated, source, original, name, content } = mapping;
|
|
70401
|
-
if (!
|
|
70400
|
+
const { generated, source: source2, original, name, content } = mapping;
|
|
70401
|
+
if (!source2) {
|
|
70402
70402
|
return addSegmentInternal(
|
|
70403
70403
|
skipable,
|
|
70404
70404
|
map2,
|
|
@@ -70417,7 +70417,7 @@ var require_gen_mapping_umd = __commonJS({
|
|
|
70417
70417
|
map2,
|
|
70418
70418
|
generated.line - 1,
|
|
70419
70419
|
generated.column,
|
|
70420
|
-
|
|
70420
|
+
source2,
|
|
70421
70421
|
original.line - 1,
|
|
70422
70422
|
original.column,
|
|
70423
70423
|
name,
|
|
@@ -70435,8 +70435,8 @@ var require_computeSourceMap = __commonJS({
|
|
|
70435
70435
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
70436
70436
|
var _genmapping = require_gen_mapping_umd();
|
|
70437
70437
|
var _charcodes = require_charcodes();
|
|
70438
|
-
function computeSourceMap({ code: generatedCode, mappings: rawMappings }, filePath, options,
|
|
70439
|
-
const sourceColumns = computeSourceColumns(
|
|
70438
|
+
function computeSourceMap({ code: generatedCode, mappings: rawMappings }, filePath, options, source2, tokens) {
|
|
70439
|
+
const sourceColumns = computeSourceColumns(source2, tokens);
|
|
70440
70440
|
const map2 = new (0, _genmapping.GenMapping)({ file: options.compiledFilename });
|
|
70441
70441
|
let tokenIndex = 0;
|
|
70442
70442
|
let currentMapping = rawMappings[0];
|
|
@@ -110885,6 +110885,7 @@ function resolveFile(id, from, folder) {
|
|
|
110885
110885
|
const tries = path20.extname(at2) ? [at2] : [...CODE_EXTS.map((e2) => at2 + e2), ...CODE_EXTS.map((e2) => path20.join(at2, `index${e2}`))];
|
|
110886
110886
|
const file2 = tries.find((f2) => fs19.statSync(f2, { throwIfNoEntry: false })?.isFile());
|
|
110887
110887
|
if (!file2) throw new Error(`no such file: ${id}`);
|
|
110888
|
+
if (!fs19.realpathSync(file2).startsWith(fs19.realpathSync(folder) + path20.sep)) throw new Error(`${id} is outside the mockup's folder`);
|
|
110888
110889
|
return file2;
|
|
110889
110890
|
}
|
|
110890
110891
|
async function readGraph(entry) {
|
|
@@ -110923,14 +110924,15 @@ function run(script, context, name, deadline, lineOffset = 0) {
|
|
|
110923
110924
|
if (left <= 0) throw new Error(`took longer than ${DRAW_MS / 1e3}s to draw`);
|
|
110924
110925
|
return vm.runInContext(script, context, { timeout: left, filename: name, lineOffset });
|
|
110925
110926
|
}
|
|
110926
|
-
async function tailwindFor(markup, sheets) {
|
|
110927
|
-
const
|
|
110928
|
-
const compiler = await rc(
|
|
110927
|
+
async function tailwindFor(markup, sheets, folder) {
|
|
110928
|
+
const source2 = sheets.length ? sheets.map((s) => s.content).join("\n") : '@import "tailwindcss";';
|
|
110929
|
+
const compiler = await rc(source2, {
|
|
110929
110930
|
base: sheets.length ? path20.dirname(sheets[0].path) : "/",
|
|
110930
110931
|
loadStylesheet: async (id, from) => {
|
|
110931
110932
|
if (id === "tailwindcss" || id.startsWith("tailwindcss/")) return { path: "tailwindcss/index.css", base: "/", content: tailwindcss_default };
|
|
110932
110933
|
if (!id.startsWith(".")) throw new Error(`a mockup cannot import ${id}`);
|
|
110933
110934
|
const at2 = path20.resolve(from, id);
|
|
110935
|
+
if (!fs19.realpathSync(at2).startsWith(fs19.realpathSync(folder) + path20.sep)) throw new Error(`${id} is outside the mockup's folder`);
|
|
110934
110936
|
return { path: at2, base: path20.dirname(at2), content: fs19.readFileSync(at2, "utf8") };
|
|
110935
110937
|
}
|
|
110936
110938
|
});
|
|
@@ -110980,7 +110982,7 @@ ${graph.code.get(file2)}
|
|
|
110980
110982
|
if (typeof Component !== "function") throw new Error("the mockup has no default export to draw");
|
|
110981
110983
|
sandbox.__draw = () => (0, import_server.renderToStaticMarkup)(import_react3.default.createElement(Component));
|
|
110982
110984
|
const markup = run("__draw()", context, entry, deadline);
|
|
110983
|
-
const css = (await tailwindFor(markup, graph.sheets)).replace(/<\/style/gi, "<\\/style");
|
|
110985
|
+
const css = (await tailwindFor(markup, graph.sheets, path20.dirname(entry))).replace(/<\/style/gi, "<\\/style");
|
|
110984
110986
|
return `<!doctype html><html><head>${head}<style>${css}</style></head><body>${markup}</body></html>`;
|
|
110985
110987
|
}
|
|
110986
110988
|
var import_react3, JSX, import_server, import_sucrase, DRAW_MS, MAX_FILES, CODE_EXTS, REQUIRES, NOTHING, NEXT_LINK, NEXT_IMAGE, NEXT_NAVIGATION, PACKAGES, MOCKUP_IMPORTS;
|
|
@@ -111891,8 +111893,8 @@ async function studioSnapshot(workspace, catalog, list2) {
|
|
|
111891
111893
|
}
|
|
111892
111894
|
|
|
111893
111895
|
// src/protocol.ts
|
|
111894
|
-
var AKB_VERSION = true ? "0.11.
|
|
111895
|
-
var AKB_CONTRACT = true ?
|
|
111896
|
+
var AKB_VERSION = true ? "0.11.58" : "0.0.0";
|
|
111897
|
+
var AKB_CONTRACT = true ? 16 : 0;
|
|
111896
111898
|
|
|
111897
111899
|
// src/secrets.ts
|
|
111898
111900
|
import fs8 from "node:fs";
|
|
@@ -112228,24 +112230,24 @@ function readIcon(raw) {
|
|
|
112228
112230
|
|
|
112229
112231
|
// ../cli/src/lib/yaml.ts
|
|
112230
112232
|
function yamlScalar(s) {
|
|
112231
|
-
const
|
|
112232
|
-
if (
|
|
112233
|
-
if (/^[-?:,[\]{}#&*!|>'"%@`]/.test(
|
|
112234
|
-
return JSON.stringify(
|
|
112233
|
+
const text4 = String(s);
|
|
112234
|
+
if (text4 === "") return '""';
|
|
112235
|
+
if (/^[-?:,[\]{}#&*!|>'"%@`]/.test(text4) || /:\s/.test(text4) || /[\n"]/.test(text4) || /^\s|\s$/.test(text4)) {
|
|
112236
|
+
return JSON.stringify(text4);
|
|
112235
112237
|
}
|
|
112236
|
-
return
|
|
112238
|
+
return text4;
|
|
112237
112239
|
}
|
|
112238
112240
|
function unquote2(v) {
|
|
112239
|
-
const
|
|
112240
|
-
if (
|
|
112241
|
+
const text4 = String(v).trim();
|
|
112242
|
+
if (text4.startsWith('"') && text4.endsWith('"')) {
|
|
112241
112243
|
try {
|
|
112242
|
-
return JSON.parse(
|
|
112244
|
+
return JSON.parse(text4);
|
|
112243
112245
|
} catch {
|
|
112244
|
-
return
|
|
112246
|
+
return text4.slice(1, -1);
|
|
112245
112247
|
}
|
|
112246
112248
|
}
|
|
112247
|
-
if (
|
|
112248
|
-
return
|
|
112249
|
+
if (text4.startsWith("'") && text4.endsWith("'")) return text4.slice(1, -1);
|
|
112250
|
+
return text4;
|
|
112249
112251
|
}
|
|
112250
112252
|
|
|
112251
112253
|
// ../cli/src/lib/agents/yaml.ts
|
|
@@ -112265,9 +112267,9 @@ function stripComment(value) {
|
|
|
112265
112267
|
const hash = value.slice(from).search(/(^|[ \t])#/);
|
|
112266
112268
|
return hash < 0 ? value : value.slice(0, from + hash).trim();
|
|
112267
112269
|
}
|
|
112268
|
-
var readLines = (
|
|
112269
|
-
function parseYamlBlock(
|
|
112270
|
-
const [map2] = readMap(readLines(
|
|
112270
|
+
var readLines = (text4) => text4.split("\n").map((raw) => ({ indent: raw.match(/^[ \t]*/)[0].length, text: raw.trim() })).filter((line) => line.text && !line.text.startsWith("#"));
|
|
112271
|
+
function parseYamlBlock(text4) {
|
|
112272
|
+
const [map2] = readMap(readLines(text4), 0, 0);
|
|
112271
112273
|
return map2;
|
|
112272
112274
|
}
|
|
112273
112275
|
function readMap(lines, start, indent) {
|
|
@@ -112353,12 +112355,12 @@ function readList(lines, start, indent) {
|
|
|
112353
112355
|
}
|
|
112354
112356
|
return [out, i];
|
|
112355
112357
|
}
|
|
112356
|
-
function splitFrontmatter(
|
|
112357
|
-
const lines =
|
|
112358
|
-
if (lines[0]?.trim() !== "---") return { meta: null, body:
|
|
112358
|
+
function splitFrontmatter(text4) {
|
|
112359
|
+
const lines = text4.replace(/^/, "").split("\n");
|
|
112360
|
+
if (lines[0]?.trim() !== "---") return { meta: null, body: text4 };
|
|
112359
112361
|
let i = 1;
|
|
112360
112362
|
while (i < lines.length && lines[i].trim() !== "---") i++;
|
|
112361
|
-
if (i >= lines.length) return { meta: null, body:
|
|
112363
|
+
if (i >= lines.length) return { meta: null, body: text4 };
|
|
112362
112364
|
return { meta: lines.slice(1, i).join("\n"), body: lines.slice(i + 1).join("\n") };
|
|
112363
112365
|
}
|
|
112364
112366
|
|
|
@@ -112367,14 +112369,14 @@ var OLD_ROLE_KEYS = ["lead", "hook", "stage", "kind"];
|
|
|
112367
112369
|
var AGENT_NAME = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
112368
112370
|
var SCHEDULE_READS = ["archived-cards", "chats", "dismissals"];
|
|
112369
112371
|
var isScheduleReads = (value) => SCHEDULE_READS.includes(value);
|
|
112370
|
-
function parseSpecAgent(
|
|
112372
|
+
function parseSpecAgent(text4, from, file2, builtIn = false, list2 = () => []) {
|
|
112371
112373
|
let named = "";
|
|
112372
112374
|
const bad = (why2, old2) => ({
|
|
112373
112375
|
problem: `${from}: ${why2}`,
|
|
112374
112376
|
...named ? { name: named } : {},
|
|
112375
112377
|
...old2 ? { old: old2 } : {}
|
|
112376
112378
|
});
|
|
112377
|
-
const { meta, body } = splitFrontmatter(
|
|
112379
|
+
const { meta, body } = splitFrontmatter(text4);
|
|
112378
112380
|
if (meta === null) return bad("no `---` frontmatter, so it declares no name or description");
|
|
112379
112381
|
const front = parseYamlBlock(meta);
|
|
112380
112382
|
const name = str(front.name);
|
|
@@ -112399,7 +112401,7 @@ function parseSpecAgent(text3, from, file2, builtIn = false, list2 = () => []) {
|
|
|
112399
112401
|
const after = names(akb.after);
|
|
112400
112402
|
const declaredSession = str(akb.session);
|
|
112401
112403
|
if (declaredSession && declaredSession !== "new") {
|
|
112402
|
-
return bad(`\`${name}\` declares \`akb.session: ${declaredSession}\` \u2014
|
|
112404
|
+
return bad(`\`${name}\` declares \`akb.session: ${declaredSession}\` \u2014 use \`new\` to recommend a separate session, or omit the preference`);
|
|
112403
112405
|
}
|
|
112404
112406
|
let stages;
|
|
112405
112407
|
if (akb.stages !== void 0) {
|
|
@@ -112411,20 +112413,20 @@ function parseSpecAgent(text3, from, file2, builtIn = false, list2 = () => []) {
|
|
|
112411
112413
|
const title = map(row?.title);
|
|
112412
112414
|
const instructions2 = str(row?.instructions);
|
|
112413
112415
|
if (!row || Object.keys(row).some((key) => !["id", "title", "instructions", "when"].includes(key)) || !AGENT_NAME.test(id) || stages.some((stage) => stage.id === id)) return bad("`akb.stages` needs unique stage IDs and only id, title, instructions and optional when");
|
|
112414
|
-
if (!title || !str(title.en) || Object.values(title).some((
|
|
112416
|
+
if (!title || !str(title.en) || Object.values(title).some((text5) => typeof text5 !== "string" || !text5.trim())) return bad(`stage ${id} needs a title map with en`);
|
|
112415
112417
|
if (!instructions2.endsWith(".md") || instructions2.startsWith("/") || instructions2.includes("\\") || instructions2.split("/").some((part) => !part || part === ".." || part === ".") || !file2(instructions2)?.trim()) return bad(`stage ${id} needs an existing agent-relative instructions file`);
|
|
112416
112418
|
if (row.when !== void 0 && !str(row.when)) return bad(`stage ${id} needs nonempty when text, or omit when for a required stage`);
|
|
112417
|
-
stages.push({ id, title: Object.fromEntries(Object.entries(title).map(([lang,
|
|
112419
|
+
stages.push({ id, title: Object.fromEntries(Object.entries(title).map(([lang, text5]) => [lang, str(text5)])), instructions: instructions2, ...str(row.when) ? { when: str(row.when) } : {} });
|
|
112418
112420
|
}
|
|
112419
112421
|
}
|
|
112420
112422
|
const components = akb.components === void 0 ? ["Asset"] : akb.components;
|
|
112421
112423
|
if (!Array.isArray(components) || components.some((value) => typeof value !== "string" || !value.trim())) {
|
|
112422
112424
|
return bad(`\`${name}\` declares \`akb.components\` that is not a list of component IDs`);
|
|
112423
112425
|
}
|
|
112424
|
-
const
|
|
112425
|
-
if (
|
|
112426
|
+
const icon2 = readIcon(akb.icon);
|
|
112427
|
+
if (icon2 && typeof icon2 === "object" && "problem" in icon2) {
|
|
112426
112428
|
return bad(
|
|
112427
|
-
`\`${name}\` declares an \`akb.icon\` where ${
|
|
112429
|
+
`\`${name}\` declares an \`akb.icon\` where ${icon2.problem} \u2014 use one of ${ICON_NAMES.join(", ")}, or 1 to 12 parts \`{ d, f?, o?: true, s?, w? }\` coloured with ${ICON_COLORS.join(", ")}`
|
|
112428
112430
|
);
|
|
112429
112431
|
}
|
|
112430
112432
|
const workspace = memoryPaths(akb.memoryFiles);
|
|
@@ -112439,7 +112441,7 @@ function parseSpecAgent(text3, from, file2, builtIn = false, list2 = () => []) {
|
|
|
112439
112441
|
after,
|
|
112440
112442
|
...stages ? { stages } : {},
|
|
112441
112443
|
components: [...new Set(components.map((value) => value.trim()))],
|
|
112442
|
-
...
|
|
112444
|
+
...icon2 ? { icon: icon2 } : {},
|
|
112443
112445
|
...akb.merges === "true" ? { merges: true } : {},
|
|
112444
112446
|
i18n: readTranslations(akb.i18n),
|
|
112445
112447
|
...declaredReads ? { reads: declaredReads } : {},
|
|
@@ -112527,9 +112529,9 @@ function readPreviews(value) {
|
|
|
112527
112529
|
}
|
|
112528
112530
|
return readGroup(value);
|
|
112529
112531
|
}
|
|
112530
|
-
function parseStudioFile(id,
|
|
112532
|
+
function parseStudioFile(id, source2, from) {
|
|
112531
112533
|
if (!STUDIO_ID.test(id)) return { problem: `${from}: \`${id}\` is not a studio id \u2014 use lowercase letters, digits and dashes` };
|
|
112532
|
-
const { meta, body } = splitFrontmatter(
|
|
112534
|
+
const { meta, body } = splitFrontmatter(source2);
|
|
112533
112535
|
if (meta === null) return { problem: `${from}: no \`---\` frontmatter` };
|
|
112534
112536
|
const raw = parseYamlBlock(meta);
|
|
112535
112537
|
const name = text(raw.name).replace(/\s+/g, " ");
|
|
@@ -112540,10 +112542,10 @@ function parseStudioFile(id, source, from) {
|
|
|
112540
112542
|
problem: `${from}: \`${old.join("`, `")}\` ${old.length > 1 ? "are" : "is"} no longer read \u2014 list the agents under \`previews\`, \`land\` and \`scheduled\` instead (\`akb guide write-agent\`), or ask the Studio builder to rewrite it`
|
|
112541
112543
|
};
|
|
112542
112544
|
}
|
|
112543
|
-
const
|
|
112544
|
-
if (
|
|
112545
|
+
const icon2 = readIcon(raw.icon);
|
|
112546
|
+
if (icon2 && typeof icon2 === "object" && "problem" in icon2) {
|
|
112545
112547
|
return {
|
|
112546
|
-
problem: `${from}: its \`icon\` is wrong \u2014 ${
|
|
112548
|
+
problem: `${from}: its \`icon\` is wrong \u2014 ${icon2.problem}; use one of ${ICON_NAMES.join(", ")}, or 1 to 12 parts \`{ d, f?, o?: true, s?, w? }\` coloured with ${ICON_COLORS.join(", ")}`
|
|
112547
112549
|
};
|
|
112548
112550
|
}
|
|
112549
112551
|
const previews = readPreviews(raw.previews);
|
|
@@ -112572,7 +112574,7 @@ function parseStudioFile(id, source, from) {
|
|
|
112572
112574
|
description: text(raw.description),
|
|
112573
112575
|
when: text(raw.when),
|
|
112574
112576
|
needsArtifact: text(raw.needsArtifact) === "true",
|
|
112575
|
-
...
|
|
112577
|
+
...icon2 ? { icon: icon2 } : {},
|
|
112576
112578
|
previews,
|
|
112577
112579
|
land,
|
|
112578
112580
|
scheduled,
|
|
@@ -112599,7 +112601,7 @@ var hashInput = (files) => JSON.stringify(Object.entries(files).sort(([a2], [b2]
|
|
|
112599
112601
|
var landsOf = (def) => ({ lands: def.land.some((h3) => !h3.off) });
|
|
112600
112602
|
var SEGMENT = /^[\w.-]+$/;
|
|
112601
112603
|
var isAboutFile = (file2) => /^ABOUT(\.[a-z]{2})?\.md$/.test(file2) || /^screenshots\/[\w.-]+\.(png|jpe?g|webp)$/.test(file2);
|
|
112602
|
-
var bytes = (
|
|
112604
|
+
var bytes = (text4) => new TextEncoder().encode(text4).length;
|
|
112603
112605
|
var isSharedFile = (file2) => {
|
|
112604
112606
|
const parts = file2.split("/");
|
|
112605
112607
|
return parts.length > 1 && parts[0] === "shared" && parts.slice(1).every((p2) => SEGMENT.test(p2) && p2 !== "." && p2 !== "..");
|
|
@@ -112610,10 +112612,10 @@ function folderPath(file2, top) {
|
|
|
112610
112612
|
if (parts.slice(2).some((p2) => !SEGMENT.test(p2) || p2 === "." || p2 === "..")) return null;
|
|
112611
112613
|
return [parts[1], parts.slice(2).join("/")];
|
|
112612
112614
|
}
|
|
112613
|
-
function mcpProblem(
|
|
112615
|
+
function mcpProblem(text4) {
|
|
112614
112616
|
let read4;
|
|
112615
112617
|
try {
|
|
112616
|
-
read4 = JSON.parse(
|
|
112618
|
+
read4 = JSON.parse(text4);
|
|
112617
112619
|
} catch {
|
|
112618
112620
|
return "is not JSON";
|
|
112619
112621
|
}
|
|
@@ -112646,8 +112648,8 @@ function inspect(value, official) {
|
|
|
112646
112648
|
let total = 0;
|
|
112647
112649
|
const folders2 = /* @__PURE__ */ new Map();
|
|
112648
112650
|
const skills = /* @__PURE__ */ new Set();
|
|
112649
|
-
for (const [file2,
|
|
112650
|
-
if (typeof
|
|
112651
|
+
for (const [file2, text4] of entries) {
|
|
112652
|
+
if (typeof text4 !== "string" || text4.includes("\0")) {
|
|
112651
112653
|
fail(file2, "is not a text file");
|
|
112652
112654
|
continue;
|
|
112653
112655
|
}
|
|
@@ -112655,13 +112657,13 @@ function inspect(value, official) {
|
|
|
112655
112657
|
fail(file2, `the path is longer than ${FILE_LIMITS.path} characters`);
|
|
112656
112658
|
continue;
|
|
112657
112659
|
}
|
|
112658
|
-
const size = bytes(
|
|
112660
|
+
const size = bytes(text4);
|
|
112659
112661
|
if (size > FILE_LIMITS.file) return fail(file2, `is larger than ${FILE_LIMITS.file / KB} KB`, true);
|
|
112660
112662
|
total += size;
|
|
112661
112663
|
if (total > FILE_LIMITS.total) return fail("files", `are larger than ${FILE_LIMITS.total / KB / KB} MB together`, true);
|
|
112662
112664
|
if (file2 === STUDIO_FILE || file2 === CARD_TEMPLATE_FILE) continue;
|
|
112663
112665
|
if (official && file2 === MCP_FILE) {
|
|
112664
|
-
const problem = mcpProblem(
|
|
112666
|
+
const problem = mcpProblem(text4);
|
|
112665
112667
|
if (problem) fail(file2, problem);
|
|
112666
112668
|
continue;
|
|
112667
112669
|
}
|
|
@@ -112678,24 +112680,24 @@ function inspect(value, official) {
|
|
|
112678
112680
|
continue;
|
|
112679
112681
|
}
|
|
112680
112682
|
if (!folders2.has(at2[0])) folders2.set(at2[0], /* @__PURE__ */ new Map());
|
|
112681
|
-
folders2.get(at2[0]).set(at2[1],
|
|
112683
|
+
folders2.get(at2[0]).set(at2[1], text4);
|
|
112682
112684
|
}
|
|
112683
112685
|
for (const name of skills) {
|
|
112684
112686
|
if (files[`skills/${name}/SKILL.md`] === void 0) fail(`skills/${name}/SKILL.md`, "is missing");
|
|
112685
112687
|
}
|
|
112686
|
-
const
|
|
112687
|
-
const read4 = typeof
|
|
112688
|
+
const source2 = files[STUDIO_FILE];
|
|
112689
|
+
const read4 = typeof source2 === "string" ? parseStudioFile("studio", source2, STUDIO_FILE) : null;
|
|
112688
112690
|
if (!read4) fail(STUDIO_FILE, "is missing");
|
|
112689
112691
|
else if ("problem" in read4) fail(STUDIO_FILE, read4.problem.replace(`${STUDIO_FILE}: `, ""));
|
|
112690
112692
|
const agents = /* @__PURE__ */ new Map();
|
|
112691
112693
|
for (const [name, own] of folders2) {
|
|
112692
112694
|
const from = `agents/${name}/AGENT.md`;
|
|
112693
|
-
const
|
|
112694
|
-
if (
|
|
112695
|
+
const text4 = own.get("AGENT.md");
|
|
112696
|
+
if (text4 === void 0) {
|
|
112695
112697
|
fail(from, "is missing");
|
|
112696
112698
|
continue;
|
|
112697
112699
|
}
|
|
112698
|
-
const parsed = parseSpecAgent(
|
|
112700
|
+
const parsed = parseSpecAgent(text4, from, (p2) => own.get(p2) ?? null, false, () => [...own.keys()].filter((p2) => p2 !== "AGENT.md"));
|
|
112699
112701
|
if ("problem" in parsed) fail(from, parsed.problem.replace(`${from}: `, ""));
|
|
112700
112702
|
else if (parsed.agent.name !== name) fail(from, `calls itself \`${parsed.agent.name}\`; it must match its folder`);
|
|
112701
112703
|
else agents.set(name, parsed.agent);
|
|
@@ -112759,7 +112761,7 @@ function packOfficial(root2 = OFFICIAL, loose = false) {
|
|
|
112759
112761
|
if ("problem" in parsed) throw new Error(parsed.problem);
|
|
112760
112762
|
const def = parsed.def;
|
|
112761
112763
|
for (const name of [...new Set([...def.previews, ...def.land, ...def.scheduled].map((h3) => h3.agent))].sort()) {
|
|
112762
|
-
for (const [f2,
|
|
112764
|
+
for (const [f2, text4] of Object.entries(agentFiles[name] ?? {})) files[`agents/${name}/${f2}`] = text4;
|
|
112763
112765
|
}
|
|
112764
112766
|
const checked = loose ? { ok: true } : checkStudioFiles(files, true);
|
|
112765
112767
|
if (!checked.ok) throw new Error(`official/studios/${folder}: ${checked.file}: ${checked.reason}`);
|
|
@@ -112941,14 +112943,14 @@ function cloudAgentFiles() {
|
|
|
112941
112943
|
const official = /* @__PURE__ */ new Set();
|
|
112942
112944
|
const owner2 = /* @__PURE__ */ new Map();
|
|
112943
112945
|
for (const flow of cloudFlows()) {
|
|
112944
|
-
for (const [name,
|
|
112946
|
+
for (const [name, text4] of Object.entries(flow.files)) {
|
|
112945
112947
|
const at2 = /^agents\/([^/]+)\/(.+)$/.exec(name);
|
|
112946
112948
|
if (!at2) continue;
|
|
112947
112949
|
const [, agent, rest] = at2;
|
|
112948
112950
|
if (owner2.has(agent) && owner2.get(agent) !== flow.cloudId) continue;
|
|
112949
112951
|
owner2.set(agent, flow.cloudId);
|
|
112950
112952
|
if (flow.builtIn) official.add(agent);
|
|
112951
|
-
files[`${agent}/${rest}`] =
|
|
112953
|
+
files[`${agent}/${rest}`] = text4;
|
|
112952
112954
|
}
|
|
112953
112955
|
}
|
|
112954
112956
|
return { files, official };
|
|
@@ -113054,7 +113056,7 @@ var kept = (dir) => busy(dir) || unsent(dir) || paused(dir);
|
|
|
113054
113056
|
// src/preview-bridge.ts
|
|
113055
113057
|
import http from "node:http";
|
|
113056
113058
|
import crypto3 from "node:crypto";
|
|
113057
|
-
async function previewBridge(work) {
|
|
113059
|
+
async function previewBridge(work, card) {
|
|
113058
113060
|
const token = crypto3.randomBytes(32).toString("hex");
|
|
113059
113061
|
let serial = Promise.resolve();
|
|
113060
113062
|
const server = http.createServer((req, res) => {
|
|
@@ -113072,6 +113074,7 @@ async function previewBridge(work) {
|
|
|
113072
113074
|
serial = serial.then(async () => {
|
|
113073
113075
|
try {
|
|
113074
113076
|
const fields = JSON.parse(raw);
|
|
113077
|
+
if (card !== void 0 && fields.cardId !== void 0 && fields.cardId !== card) throw Error("Only the current task can manage previews from this session.");
|
|
113075
113078
|
if (typeof fields.agent !== "string" || !/^[a-z0-9]+(-[a-z0-9]+)*$/.test(fields.agent)) throw Error("Invalid preview agent.");
|
|
113076
113079
|
answer(200, await work(fields.agent, fields));
|
|
113077
113080
|
} catch (error) {
|
|
@@ -113148,7 +113151,7 @@ var tiled_default = `{
|
|
|
113148
113151
|
var video_default = '{ "name": "video", "title": { "en": "Video", "zh": "\u89C6\u9891" }, "types": ["video"] }\n';
|
|
113149
113152
|
|
|
113150
113153
|
// ../artifact-sdk/src/builtin/studio.json
|
|
113151
|
-
var studio_default = '{\n "name": "studio",\n "title": { "en": "Studio", "zh": "\u5DE5\u4F5C\u53F0" },\n "types": ["studio"],\n "schema": {\n "type": "object",\n "required": ["rounds", "land", "scheduled"],\n "properties": {\n "rounds": {\n "type": "array",\n "items": {\n "type": "array",\n "minItems": 1,\n "items": { "type": "object", "required": ["agent", "title"], "properties": { "agent": { "type": "string" }, "title": { "type": "object", "required": ["en"] } } }\n }\n },\n "land": { "type": "array", "items": { "type": "object", "required": ["agent", "title"] } },\n "scheduled": { "type": "array", "items": { "type": "object", "required": ["agent", "title"] } }\n }\n }\n}\n';
|
|
113154
|
+
var studio_default = '{\n "name": "studio",\n "title": {\n "en": "Studio",\n "zh": "\u5DE5\u4F5C\u53F0"\n },\n "types": [\n "studio"\n ],\n "schema": {\n "anyOf": [\n {\n "type": "object",\n "required": [\n "rounds",\n "land",\n "scheduled"\n ],\n "properties": {\n "rounds": {\n "type": "array",\n "items": {\n "type": "array",\n "minItems": 1,\n "items": {\n "type": "object",\n "required": [\n "agent",\n "title"\n ],\n "properties": {\n "agent": {\n "type": "string"\n },\n "title": {\n "type": "object",\n "required": [\n "en"\n ]\n }\n }\n }\n }\n },\n "land": {\n "type": "array",\n "items": {\n "type": "object",\n "required": [\n "agent",\n "title"\n ]\n }\n },\n "scheduled": {\n "type": "array",\n "items": {\n "type": "object",\n "required": [\n "agent",\n "title"\n ]\n }\n },\n "version": {\n "enum": [\n 1\n ]\n }\n }\n },\n {\n "type": "object",\n "required": [\n "version",\n "base",\n "fingerprint",\n "agents",\n "files",\n "results"\n ],\n "properties": {\n "version": {\n "const": 2\n },\n "base": {\n "anyOf": [\n {\n "type": "null"\n },\n {\n "type": "object",\n "required": [\n "id",\n "version",\n "fingerprint"\n ],\n "properties": {\n "id": {\n "type": "string",\n "minLength": 1\n },\n "version": {\n "type": "integer",\n "minimum": 1\n },\n "fingerprint": {\n "type": "string",\n "minLength": 1\n }\n }\n }\n ]\n },\n "fingerprint": {\n "type": "string",\n "minLength": 1\n },\n "agents": {\n "type": "array",\n "maxItems": 500,\n "items": {\n "type": "object",\n "required": [\n "agent",\n "title"\n ],\n "properties": {\n "agent": {\n "type": "string",\n "minLength": 1\n },\n "title": {\n "type": "object",\n "required": [\n "en"\n ],\n "properties": {\n "en": {\n "type": "string",\n "minLength": 1\n },\n "zh": {\n "type": "string"\n }\n }\n }\n }\n }\n },\n "files": {\n "type": "array",\n "maxItems": 1000,\n "items": {\n "type": "object",\n "required": [\n "path",\n "before",\n "after"\n ],\n "properties": {\n "path": {\n "type": "string",\n "minLength": 1\n },\n "before": {\n "anyOf": [\n {\n "type": "string",\n "minLength": 1\n },\n {\n "type": "null"\n }\n ]\n },\n "after": {\n "anyOf": [\n {\n "type": "string",\n "minLength": 1\n },\n {\n "type": "null"\n }\n ]\n },\n "diff": {\n "type": "string",\n "minLength": 1\n }\n }\n }\n },\n "results": {\n "type": "array",\n "maxItems": 500,\n "items": {\n "anyOf": [\n {\n "type": "object",\n "required": [\n "agent",\n "component",\n "src"\n ],\n "properties": {\n "agent": {\n "type": "string",\n "minLength": 1\n },\n "component": {\n "const": "Asset"\n },\n "src": {\n "type": "string",\n "minLength": 1\n },\n "label": {\n "type": "string"\n },\n "alt": {\n "type": "string"\n },\n "device": {\n "enum": [\n "mobile",\n "desktop"\n ]\n },\n "loop": {\n "type": "boolean"\n },\n "variants": {\n "type": "object",\n "additionalProperties": {\n "type": "string",\n "minLength": 1\n }\n }\n }\n },\n {\n "type": "object",\n "required": [\n "agent",\n "component",\n "label",\n "items"\n ],\n "properties": {\n "agent": {\n "type": "string",\n "minLength": 1\n },\n "component": {\n "const": "Set"\n },\n "label": {\n "type": "string"\n },\n "items": {\n "type": "array",\n "minItems": 1,\n "maxItems": 500,\n "items": {\n "type": "object",\n "required": [\n "src"\n ],\n "properties": {\n "src": {\n "type": "string",\n "minLength": 1\n },\n "label": {\n "type": "string"\n },\n "alt": {\n "type": "string"\n },\n "device": {\n "enum": [\n "mobile",\n "desktop"\n ]\n },\n "loop": {\n "type": "boolean"\n },\n "variants": {\n "type": "object",\n "additionalProperties": {\n "type": "string",\n "minLength": 1\n }\n }\n }\n }\n }\n }\n },\n {\n "type": "object",\n "required": [\n "agent",\n "component",\n "a",\n "b"\n ],\n "properties": {\n "agent": {\n "type": "string",\n "minLength": 1\n },\n "component": {\n "const": "Compare"\n },\n "a": {\n "type": "string",\n "minLength": 1\n },\n "b": {\n "type": "string",\n "minLength": 1\n },\n "shots": {\n "type": "string",\n "minLength": 1\n },\n "label": {\n "type": "string"\n },\n "a-label": {\n "type": "string"\n },\n "b-label": {\n "type": "string"\n }\n }\n },\n {\n "type": "object",\n "required": [\n "agent",\n "component",\n "src"\n ],\n "properties": {\n "agent": {\n "type": "string",\n "minLength": 1\n },\n "component": {\n "const": "Storyboard"\n },\n "src": {\n "type": "string",\n "minLength": 1\n },\n "label": {\n "type": "string"\n }\n }\n }\n ]\n }\n }\n }\n }\n ]\n },\n "references": [\n {\n "json": "/files/*/before"\n },\n {\n "json": "/files/*/after"\n },\n {\n "json": "/files/*/diff"\n },\n {\n "json": "/results/*/src",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/variants/*",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/a",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/b",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/shots",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/items/*/src",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/items/*/variants/*",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/items/*/a",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/items/*/b",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/items/*/shots",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n }\n ]\n}\n';
|
|
113152
113155
|
|
|
113153
113156
|
// ../artifact-sdk/src/builtin/index.ts
|
|
113154
113157
|
var read = (m) => typeof m === "string" ? JSON.parse(m) : m;
|
|
@@ -113213,67 +113216,12 @@ function schemaProblem(schema, value, at2 = "") {
|
|
|
113213
113216
|
return null;
|
|
113214
113217
|
}
|
|
113215
113218
|
|
|
113216
|
-
// ../artifact-sdk/src/internal/manifest.ts
|
|
113217
|
-
var BUILTINS = builtin_default;
|
|
113218
|
-
var manifestOf = (type) => BUILTINS.find((m) => m.types.includes(type));
|
|
113219
|
-
function typeOf(data, types) {
|
|
113220
|
-
for (const type of types) if (!schemaProblem(manifestOf(type)?.schema, data)) return { type };
|
|
113221
|
-
if (types.length !== 1) return { type: null };
|
|
113222
|
-
return { type: types[0], problem: `does not match ${types[0]} at ${schemaProblem(manifestOf(types[0])?.schema, data)}` };
|
|
113223
|
-
}
|
|
113224
|
-
var isObject = (v) => !!v && typeof v === "object" && !Array.isArray(v);
|
|
113225
|
-
var remote = (src) => !src || /^(?:[a-z][\w+.-]*:|\/|#)/i.test(src);
|
|
113226
|
-
function mapJson(node, keys, at2, visit) {
|
|
113227
|
-
if (!keys.length) return typeof node === "string" && node ? visit(node, at2) : node;
|
|
113228
|
-
const [key, ...rest] = keys;
|
|
113229
|
-
if (Array.isArray(node)) {
|
|
113230
|
-
if (key === "*") return node.map((x2, i2) => mapJson(x2, rest, `${at2}/${i2}`, visit));
|
|
113231
|
-
const i = Number(key);
|
|
113232
|
-
return Number.isInteger(i) && i in node ? node.map((x2, j2) => j2 === i ? mapJson(x2, rest, `${at2}/${j2}`, visit) : x2) : node;
|
|
113233
|
-
}
|
|
113234
|
-
if (!isObject(node)) return node;
|
|
113235
|
-
const out = { ...node };
|
|
113236
|
-
for (const k2 of key === "*" ? Object.keys(node) : key in node ? [key] : []) out[k2] = mapJson(node[k2], rest, `${at2}/${k2}`, visit);
|
|
113237
|
-
return out;
|
|
113238
|
-
}
|
|
113239
|
-
function mapText(text3, rule, skipped, visit) {
|
|
113240
|
-
let out = "";
|
|
113241
|
-
let last = 0;
|
|
113242
|
-
for (const m of text3.matchAll(new RegExp(rule.text, "gid"))) {
|
|
113243
|
-
const span = m.indices?.[1];
|
|
113244
|
-
if (!span || m[1] === void 0 || skipped.some(([a2, b2]) => span[0] >= a2 && span[0] < b2)) continue;
|
|
113245
|
-
const line = text3.slice(0, span[0]).split("\n").length;
|
|
113246
|
-
const one = (src) => remote(src) ? src : visit(src, line);
|
|
113247
|
-
const value = rule.list ? m[1].split(rule.list).map((part) => part.replace(/^(\s*)(\S+)/, (_2, space, src) => space + one(src))).join(rule.list) : one(m[1]);
|
|
113248
|
-
out += text3.slice(last, span[0]) + value;
|
|
113249
|
-
last = span[1];
|
|
113250
|
-
}
|
|
113251
|
-
return out + text3.slice(last);
|
|
113252
|
-
}
|
|
113253
|
-
function mapReferences(manifest, content, map2) {
|
|
113254
|
-
const skipped = (text3) => (manifest?.skip ?? []).flatMap((re3) => [...text3.matchAll(new RegExp(re3, "gi"))].map((m) => [m.index, m.index + m[0].length]));
|
|
113255
|
-
for (const rule of manifest?.references ?? []) {
|
|
113256
|
-
const types = rule.types ?? [];
|
|
113257
|
-
if ("json" in rule) {
|
|
113258
|
-
if (typeof content !== "string") content = mapJson(content, rule.json.split("/").filter(Boolean), "", (src, at2) => map2(src, { src, types, text: false, at: at2 || "/" }));
|
|
113259
|
-
} else if (typeof content === "string") {
|
|
113260
|
-
content = mapText(content, rule, skipped(content), (src, line) => map2(src, { src, types, text: true, line }));
|
|
113261
|
-
}
|
|
113262
|
-
}
|
|
113263
|
-
return content;
|
|
113264
|
-
}
|
|
113265
|
-
function referencesOf(manifest, content) {
|
|
113266
|
-
const found = [];
|
|
113267
|
-
mapReferences(manifest, content, (src, ref) => (found.push(ref), src));
|
|
113268
|
-
return found;
|
|
113269
|
-
}
|
|
113270
|
-
|
|
113271
113219
|
// ../artifact-sdk/src/internal/references.ts
|
|
113272
113220
|
var STORYBOARD = ["storyboard"];
|
|
113273
113221
|
var STUDIO = ["studio"];
|
|
113274
113222
|
var ARRANGED = ["storyboard", "compare", "spritesheet", "studio"];
|
|
113275
113223
|
var ASSET = ["spritesheet", "asset"];
|
|
113276
|
-
var
|
|
113224
|
+
var isObject = (v) => !!v && typeof v === "object" && !Array.isArray(v);
|
|
113277
113225
|
function bodyReferences(body) {
|
|
113278
113226
|
const lines = body.replace(/<!--[^]*?-->/g, "").split(/\r?\n/);
|
|
113279
113227
|
let fence = "";
|
|
@@ -113297,9 +113245,9 @@ function bodyReferences(body) {
|
|
|
113297
113245
|
if (kept4 && /^ {0,3}<(?:Asset|Mockup|Compare|Storyboard|Studio)\b/.test(line)) inTag = true;
|
|
113298
113246
|
if (line.includes("/>")) inTag = false;
|
|
113299
113247
|
}
|
|
113300
|
-
const
|
|
113248
|
+
const text4 = visible.join("\n").replace(/(`+)[^]*?\1/g, "");
|
|
113301
113249
|
const tag = /<(Asset|Mockup|Compare|Storyboard|Studio)\b([^<>]*?)\/>/g;
|
|
113302
|
-
const blocks =
|
|
113250
|
+
const blocks = text4.matchAll(/^ {0,3}(?:<(?:Asset|Mockup|Compare|Storyboard|Studio)\b[^<>]*?\/>[ \t]*(?:\n[ \t]*)?)+$/gm);
|
|
113303
113251
|
for (const block of blocks) {
|
|
113304
113252
|
const tags = [...block[0].matchAll(tag)];
|
|
113305
113253
|
for (const m of tags) {
|
|
@@ -113313,7 +113261,7 @@ function bodyReferences(body) {
|
|
|
113313
113261
|
if (a2.variants) {
|
|
113314
113262
|
try {
|
|
113315
113263
|
const v = JSON.parse(a2.variants);
|
|
113316
|
-
if (
|
|
113264
|
+
if (isObject(v)) {
|
|
113317
113265
|
for (const src of Object.values(v)) if (typeof src === "string" && src) out.push({ src, types: m[1] === "Asset" ? ASSET : [] });
|
|
113318
113266
|
}
|
|
113319
113267
|
} catch {
|
|
@@ -113322,7 +113270,7 @@ function bodyReferences(body) {
|
|
|
113322
113270
|
}
|
|
113323
113271
|
}
|
|
113324
113272
|
}
|
|
113325
|
-
for (const m of
|
|
113273
|
+
for (const m of text4.replace(tag, "").matchAll(/\]\(\s*<?([^\s)>]+)>?(?:\s+["'][^]*?["'])?\s*\)/g)) out.push({ src: m[1], types: [] });
|
|
113326
113274
|
return out;
|
|
113327
113275
|
}
|
|
113328
113276
|
var TYPES = {
|
|
@@ -113362,6 +113310,100 @@ function kindOf(ext) {
|
|
|
113362
113310
|
return type.startsWith("video/") || type.startsWith("audio/") ? "video" : "asset";
|
|
113363
113311
|
}
|
|
113364
113312
|
|
|
113313
|
+
// ../artifact-sdk/src/internal/format/studio.ts
|
|
113314
|
+
var text2 = (v) => typeof v === "string" && v.length > 0;
|
|
113315
|
+
var source = (v) => text2(v) && !/^(?:[a-z][\w+.-]*:|\/|#)|\\|[\u0000-\u001f]/i.test(v);
|
|
113316
|
+
var icon = (v) => v === void 0 || typeof v === "string" || Array.isArray(v) && v.length > 0 && v.length <= 12 && v.every((p2) => isObject(p2) && text2(p2.d) && /^[MmLlHhVvCcSsQqTtAaZz0-9.,\s-]+$/.test(p2.d) && ["f", "s"].every((k2) => p2[k2] === void 0 || typeof p2[k2] === "string" && /^[kwcgopsmlry]$/.test(p2[k2])) && (p2.o === void 0 || p2.o === true) && (p2.w === void 0 || typeof p2.w === "number" && p2.w > 0 && p2.w <= 3));
|
|
113317
|
+
var relativePath = (v) => source(v) && v.split("/").every((p2) => p2 && p2 !== "." && p2 !== "..");
|
|
113318
|
+
var optionalText = (v, keys) => keys.every((k2) => v[k2] === void 0 || typeof v[k2] === "string");
|
|
113319
|
+
var asset = (v) => isObject(v) && source(v.src) && optionalText(v, ["label", "alt"]) && (v.alt === void 0 || !/[<>]/.test(v.alt)) && (v.device === void 0 || v.device === "desktop" || v.device === "mobile") && (v.loop === void 0 || typeof v.loop === "boolean") && (v.variants === void 0 || isObject(v.variants) && Object.values(v.variants).every(source));
|
|
113320
|
+
function resultProblem(value, agents) {
|
|
113321
|
+
if (!Array.isArray(value) || value.length > 500) return "/results";
|
|
113322
|
+
for (let i = 0; i < value.length; i++) {
|
|
113323
|
+
const r2 = value[i];
|
|
113324
|
+
if (!isObject(r2) || !text2(r2.agent) || !agents.has(r2.agent) || !optionalText(r2, ["label"])) return `/results/${i}`;
|
|
113325
|
+
const valid = r2.component === "Asset" ? asset(r2) : r2.component === "Set" ? typeof r2.label === "string" && Array.isArray(r2.items) && r2.items.length > 0 && r2.items.length <= 500 && r2.items.every(asset) : r2.component === "Compare" ? source(r2.a) && source(r2.b) && (r2.shots === void 0 || source(r2.shots)) && optionalText(r2, ["a-label", "b-label"]) : r2.component === "Storyboard" && source(r2.src);
|
|
113326
|
+
if (!valid) return `/results/${i}`;
|
|
113327
|
+
}
|
|
113328
|
+
return null;
|
|
113329
|
+
}
|
|
113330
|
+
function reviewProblem(v) {
|
|
113331
|
+
if (!isObject(v) || v.version !== 2) return "/version";
|
|
113332
|
+
if (!text2(v.fingerprint)) return "/fingerprint";
|
|
113333
|
+
if (v.base !== null && !(isObject(v.base) && text2(v.base.id) && Number.isInteger(v.base.version) && Number(v.base.version) > 0 && text2(v.base.fingerprint))) return "/base";
|
|
113334
|
+
if (!Array.isArray(v.agents) || v.agents.length > 500) return "/agents";
|
|
113335
|
+
const agents = /* @__PURE__ */ new Set();
|
|
113336
|
+
for (const a2 of v.agents) {
|
|
113337
|
+
if (!isObject(a2) || !text2(a2.agent) || !/^[a-z][a-z0-9-]*$/.test(a2.agent) || agents.has(a2.agent) || !isObject(a2.title) || !text2(a2.title.en) || !optionalText(a2.title, ["zh"]) || !icon(a2.icon)) return "/agents";
|
|
113338
|
+
agents.add(a2.agent);
|
|
113339
|
+
}
|
|
113340
|
+
if (!Array.isArray(v.files) || v.files.length > 1e3) return "/files";
|
|
113341
|
+
const paths = /* @__PURE__ */ new Set();
|
|
113342
|
+
for (const f2 of v.files) {
|
|
113343
|
+
if (!isObject(f2) || !relativePath(f2.path) || paths.has(f2.path) || !(f2.before === null || source(f2.before)) || !(f2.after === null || source(f2.after)) || f2.before === null && f2.after === null || f2.diff !== void 0 && !source(f2.diff) || (f2.before === null || f2.after === null) && !f2.diff) return "/files";
|
|
113344
|
+
if (f2.path.startsWith("agents/") && !agents.has(f2.path.split("/")[1])) return "/files";
|
|
113345
|
+
paths.add(f2.path);
|
|
113346
|
+
}
|
|
113347
|
+
return resultProblem(v.results, agents);
|
|
113348
|
+
}
|
|
113349
|
+
var isReview = (v) => isObject(v) && v.version === 2;
|
|
113350
|
+
|
|
113351
|
+
// ../artifact-sdk/src/internal/manifest.ts
|
|
113352
|
+
var BUILTINS = builtin_default;
|
|
113353
|
+
var manifestOf = (type) => BUILTINS.find((m) => m.types.includes(type));
|
|
113354
|
+
function typeOf(data, types) {
|
|
113355
|
+
const problem = (type) => type === "studio" && isReview(data) ? reviewProblem(data) : schemaProblem(manifestOf(type)?.schema, data);
|
|
113356
|
+
for (const type of types) if (!problem(type)) return { type };
|
|
113357
|
+
if (types.length !== 1) return { type: null };
|
|
113358
|
+
return { type: types[0], problem: `does not match ${types[0]} at ${problem(types[0])}` };
|
|
113359
|
+
}
|
|
113360
|
+
var isObject2 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
|
|
113361
|
+
var remote = (src) => !src || /^(?:[a-z][\w+.-]*:|\/|#)/i.test(src);
|
|
113362
|
+
function mapJson(node, keys, at2, visit) {
|
|
113363
|
+
if (!keys.length) return typeof node === "string" && node ? visit(node, at2) : node;
|
|
113364
|
+
const [key, ...rest] = keys;
|
|
113365
|
+
if (Array.isArray(node)) {
|
|
113366
|
+
if (key === "*") return node.map((x2, i2) => mapJson(x2, rest, `${at2}/${i2}`, visit));
|
|
113367
|
+
const i = Number(key);
|
|
113368
|
+
return Number.isInteger(i) && i in node ? node.map((x2, j2) => j2 === i ? mapJson(x2, rest, `${at2}/${j2}`, visit) : x2) : node;
|
|
113369
|
+
}
|
|
113370
|
+
if (!isObject2(node)) return node;
|
|
113371
|
+
const out = { ...node };
|
|
113372
|
+
for (const k2 of key === "*" ? Object.keys(node) : key in node ? [key] : []) out[k2] = mapJson(node[k2], rest, `${at2}/${k2}`, visit);
|
|
113373
|
+
return out;
|
|
113374
|
+
}
|
|
113375
|
+
function mapText(text4, rule, skipped, visit, includeRemote) {
|
|
113376
|
+
let out = "";
|
|
113377
|
+
let last = 0;
|
|
113378
|
+
for (const m of text4.matchAll(new RegExp(rule.text, "gid"))) {
|
|
113379
|
+
const span = m.indices?.[1];
|
|
113380
|
+
if (!span || m[1] === void 0 || skipped.some(([a2, b2]) => span[0] >= a2 && span[0] < b2)) continue;
|
|
113381
|
+
const line = text4.slice(0, span[0]).split("\n").length;
|
|
113382
|
+
const one = (src) => remote(src) && !includeRemote ? src : visit(src, line);
|
|
113383
|
+
const value = rule.list ? m[1].split(rule.list).map((part) => part.replace(/^(\s*)(\S+)/, (_2, space, src) => space + one(src))).join(rule.list) : one(m[1]);
|
|
113384
|
+
out += text4.slice(last, span[0]) + value;
|
|
113385
|
+
last = span[1];
|
|
113386
|
+
}
|
|
113387
|
+
return out + text4.slice(last);
|
|
113388
|
+
}
|
|
113389
|
+
function mapReferences(manifest, content, map2, includeRemote = false) {
|
|
113390
|
+
const skipped = (text4) => (manifest?.skip ?? []).flatMap((re3) => [...text4.matchAll(new RegExp(re3, "gi"))].map((m) => [m.index, m.index + m[0].length]));
|
|
113391
|
+
for (const rule of manifest?.references ?? []) {
|
|
113392
|
+
const types = rule.types ?? [];
|
|
113393
|
+
if ("json" in rule) {
|
|
113394
|
+
if (typeof content !== "string") content = mapJson(content, rule.json.split("/").filter(Boolean), "", (src, at2) => map2(src, { src, types, text: false, at: at2 || "/" }));
|
|
113395
|
+
} else if (typeof content === "string") {
|
|
113396
|
+
content = mapText(content, rule, skipped(content), (src, line) => map2(src, { src, types, text: true, line }), includeRemote);
|
|
113397
|
+
}
|
|
113398
|
+
}
|
|
113399
|
+
return content;
|
|
113400
|
+
}
|
|
113401
|
+
function referencesOf(manifest, content, includeRemote = false) {
|
|
113402
|
+
const found = [];
|
|
113403
|
+
mapReferences(manifest, content, (src, ref) => (found.push(ref), src), includeRemote);
|
|
113404
|
+
return found;
|
|
113405
|
+
}
|
|
113406
|
+
|
|
113365
113407
|
// ../artifact-sdk/src/internal/collect.ts
|
|
113366
113408
|
var extOf = (file2) => /\.[^./\\]+$/.exec(file2)?.[0].toLowerCase() ?? "";
|
|
113367
113409
|
var why = (error) => error instanceof Error ? error.message : String(error);
|
|
@@ -113371,10 +113413,13 @@ var textKind = (ext, types) => types.find((t) => {
|
|
|
113371
113413
|
}) ?? kindOf(ext);
|
|
113372
113414
|
var kindAt = (src, types) => extOf(src) === ".json" ? types.includes("asset") ? "asset" : types[0] ?? "asset" : textKind(extOf(src), types);
|
|
113373
113415
|
function collect(body, card, host) {
|
|
113416
|
+
return collectSources(bodyReferences(body), card, host);
|
|
113417
|
+
}
|
|
113418
|
+
function collectSources(sources2, card, host) {
|
|
113374
113419
|
const nodes = /* @__PURE__ */ new Map();
|
|
113375
113420
|
const active = /* @__PURE__ */ new Set();
|
|
113376
113421
|
const out = [];
|
|
113377
|
-
const visit = (src, types, owner2) => {
|
|
113422
|
+
const visit = (src, types, owner2, partial = false) => {
|
|
113378
113423
|
const path47 = src.replace(/[?#].*$/, "");
|
|
113379
113424
|
let resolved;
|
|
113380
113425
|
try {
|
|
@@ -113390,7 +113435,11 @@ function collect(body, card, host) {
|
|
|
113390
113435
|
}
|
|
113391
113436
|
if (!resolved) return { key: null };
|
|
113392
113437
|
const { key, file: file2 } = resolved;
|
|
113393
|
-
if (active.has(key))
|
|
113438
|
+
if (active.has(key)) {
|
|
113439
|
+
const error = `${owner2}: ${src}: \u8D44\u6E90\u4F9D\u8D56\u5FAA\u73AF`;
|
|
113440
|
+
if (partial) return { key: null, error };
|
|
113441
|
+
throw new Error(error);
|
|
113442
|
+
}
|
|
113394
113443
|
const json = !!file2 && extOf(file2) === ".json";
|
|
113395
113444
|
const held5 = nodes.get(key);
|
|
113396
113445
|
if (held5) {
|
|
@@ -113403,10 +113452,10 @@ function collect(body, card, host) {
|
|
|
113403
113452
|
nodes.set(key, node);
|
|
113404
113453
|
active.add(key);
|
|
113405
113454
|
const child = (ref, from) => {
|
|
113406
|
-
const found = visit(ref.src, ref.types, from);
|
|
113455
|
+
const found = visit(ref.src, ref.types, from, partial || node.kind === "studio" && node.data?.version === 2);
|
|
113407
113456
|
if (found.key) node.dependencies.set(ref.src, found.key);
|
|
113408
113457
|
else if (found.error) node.problems.push({ src: ref.src, ..."line" in ref ? { line: ref.line } : {}, ..."at" in ref ? { at: ref.at } : {}, message: found.error });
|
|
113409
|
-
node.error ??= found.error;
|
|
113458
|
+
if (!(node.kind === "studio" && node.data?.version === 2)) node.error ??= found.error;
|
|
113410
113459
|
};
|
|
113411
113460
|
if (file2) {
|
|
113412
113461
|
if (json) {
|
|
@@ -113429,13 +113478,13 @@ function collect(body, card, host) {
|
|
|
113429
113478
|
node.error = node.problems[0]?.message;
|
|
113430
113479
|
if (!node.error) for (const ref of referencesOf(manifestOf(node.kind), node.data)) child(ref, file2);
|
|
113431
113480
|
} else {
|
|
113432
|
-
for (const ref of host.retained(key)) child(ref, card);
|
|
113481
|
+
for (const ref of host.retained(key, types)) child(ref, card);
|
|
113433
113482
|
}
|
|
113434
113483
|
active.delete(key);
|
|
113435
113484
|
out.push(node);
|
|
113436
113485
|
return { key, error: node.error };
|
|
113437
113486
|
};
|
|
113438
|
-
for (const ref of
|
|
113487
|
+
for (const ref of sources2) visit(ref.src, ref.types, card);
|
|
113439
113488
|
const sorted = [];
|
|
113440
113489
|
const done = /* @__PURE__ */ new Set();
|
|
113441
113490
|
const order = (node) => {
|
|
@@ -113766,9 +113815,9 @@ var officialAgent = (name) => cloudAgentFiles().official.has(name);
|
|
|
113766
113815
|
// ../cli/src/lib/agents/shared-memory.ts
|
|
113767
113816
|
function sharedMemory(board) {
|
|
113768
113817
|
const declared = /* @__PURE__ */ new Map();
|
|
113769
|
-
const take = (folder,
|
|
113770
|
-
if (
|
|
113771
|
-
const read4 = parseSpecAgent(
|
|
113818
|
+
const take = (folder, text4, builtIn) => {
|
|
113819
|
+
if (text4 === null || declared.has(folder)) return;
|
|
113820
|
+
const read4 = parseSpecAgent(text4, folder, (relative) => {
|
|
113772
113821
|
if (builtIn) return shippedAgentFiles()[`${folder}/${relative}`] ?? null;
|
|
113773
113822
|
try {
|
|
113774
113823
|
return fs18.readFileSync(path19.join(board, "agents", folder, relative), "utf8");
|
|
@@ -113778,9 +113827,9 @@ function sharedMemory(board) {
|
|
|
113778
113827
|
}, builtIn);
|
|
113779
113828
|
if ("agent" in read4 && read4.agent.name === folder) declared.set(folder, read4.agent.memoryFiles.workspace);
|
|
113780
113829
|
};
|
|
113781
|
-
for (const [key,
|
|
113830
|
+
for (const [key, text4] of Object.entries(shippedAgentFiles())) {
|
|
113782
113831
|
const at2 = /^([^/]+)\/AGENT\.md$/.exec(key);
|
|
113783
|
-
if (at2) take(at2[1],
|
|
113832
|
+
if (at2) take(at2[1], text4, officialAgent(at2[1]));
|
|
113784
113833
|
}
|
|
113785
113834
|
const root2 = path19.join(board, "agents");
|
|
113786
113835
|
let folders2 = [];
|
|
@@ -113789,12 +113838,12 @@ function sharedMemory(board) {
|
|
|
113789
113838
|
} catch {
|
|
113790
113839
|
}
|
|
113791
113840
|
for (const folder of folders2.sort()) {
|
|
113792
|
-
let
|
|
113841
|
+
let text4 = null;
|
|
113793
113842
|
try {
|
|
113794
|
-
|
|
113843
|
+
text4 = fs18.readFileSync(path19.join(root2, folder, "AGENT.md"), "utf8");
|
|
113795
113844
|
} catch {
|
|
113796
113845
|
}
|
|
113797
|
-
take(folder,
|
|
113846
|
+
take(folder, text4, false);
|
|
113798
113847
|
}
|
|
113799
113848
|
const matches = [
|
|
113800
113849
|
matcher("agents/copywriting/style.md"),
|
|
@@ -114085,13 +114134,13 @@ function pullTools(ws, record, files) {
|
|
|
114085
114134
|
const theirs = (skill) => !ours.has(skill) && SKILL_ROOTS.some((root2) => fs20.existsSync(path21.join(ws.cwd, root2, skill)));
|
|
114086
114135
|
const kept4 = Object.keys(files).map((name) => SKILL_PATH.exec(name)?.[1]).filter((skill) => skill && !theirs(skill));
|
|
114087
114136
|
const skills = {};
|
|
114088
|
-
for (const [name,
|
|
114137
|
+
for (const [name, text4] of Object.entries(files)) {
|
|
114089
114138
|
const at2 = SKILL_PATH.exec(name);
|
|
114090
114139
|
if (!at2 || at2[1] === "kanban" || !kept4.includes(at2[1]) || at2[2].split("/").includes("..")) continue;
|
|
114091
|
-
skills[name] = hashOf2(
|
|
114140
|
+
skills[name] = hashOf2(text4);
|
|
114092
114141
|
for (const root2 of SKILL_ROOTS) {
|
|
114093
114142
|
const file2 = path21.join(ws.cwd, root2, at2[1], at2[2]);
|
|
114094
|
-
if (held5[name] !== skills[name] || hashFile(file2) !== skills[name]) write(file2,
|
|
114143
|
+
if (held5[name] !== skills[name] || hashFile(file2) !== skills[name]) write(file2, text4);
|
|
114095
114144
|
}
|
|
114096
114145
|
}
|
|
114097
114146
|
for (const name of Object.keys(held5)) {
|
|
@@ -114185,9 +114234,9 @@ function stateDir(ws) {
|
|
|
114185
114234
|
return null;
|
|
114186
114235
|
}
|
|
114187
114236
|
}
|
|
114188
|
-
function assetsOf(
|
|
114237
|
+
function assetsOf(text4) {
|
|
114189
114238
|
try {
|
|
114190
|
-
const held5 = JSON.parse(
|
|
114239
|
+
const held5 = JSON.parse(text4 ?? "{}");
|
|
114191
114240
|
return held5 && typeof held5 === "object" && !Array.isArray(held5) ? held5 : {};
|
|
114192
114241
|
} catch {
|
|
114193
114242
|
return {};
|
|
@@ -114273,13 +114322,13 @@ function writeIndex(board) {
|
|
|
114273
114322
|
const id = /^(\d+)-/.exec(e2.name)?.[1];
|
|
114274
114323
|
if (!id) continue;
|
|
114275
114324
|
const link = e2.isDirectory() ? `${e2.name}/root.md` : e2.name.endsWith(".md") ? e2.name : null;
|
|
114276
|
-
const
|
|
114277
|
-
if (
|
|
114278
|
-
cards.push({ id: Number(id), title: cardFront(
|
|
114325
|
+
const text5 = link && readText(path21.join(todo, link));
|
|
114326
|
+
if (text5 === null || !link) continue;
|
|
114327
|
+
cards.push({ id: Number(id), title: cardFront(text5).title ?? e2.name.replace(/\.md$/, ""), link });
|
|
114279
114328
|
}
|
|
114280
114329
|
cards.sort((a2, b2) => a2.id - b2.id);
|
|
114281
114330
|
const list2 = cards.length ? cards.map((c2) => `- [#${c2.id} ${c2.title}](${c2.link})`).join("\n") : "_(none)_";
|
|
114282
|
-
const
|
|
114331
|
+
const text4 = `# Board
|
|
114283
114332
|
|
|
114284
114333
|
Open tasks for the kanban board. One card per file. Ids are global and never reused \u2014
|
|
114285
114334
|
the number at the front of a filename is the task id.
|
|
@@ -114288,7 +114337,7 @@ the number at the front of a filename is the task id.
|
|
|
114288
114337
|
|
|
114289
114338
|
${list2}
|
|
114290
114339
|
`;
|
|
114291
|
-
if (readText(path21.join(todo, "README.md")) !==
|
|
114340
|
+
if (readText(path21.join(todo, "README.md")) !== text4) write(path21.join(todo, "README.md"), text4);
|
|
114292
114341
|
}
|
|
114293
114342
|
var workspaceOf = (ws) => readBase(ws).workspace ?? null;
|
|
114294
114343
|
async function pullAssets(ws, record, assets) {
|
|
@@ -114375,18 +114424,18 @@ async function pullAssets(ws, record, assets) {
|
|
|
114375
114424
|
}
|
|
114376
114425
|
const json = data !== void 0 && typeof data !== "string";
|
|
114377
114426
|
if (held5?.artifact === ref.artifact && held5.version === version && !held5.localHash && json) {
|
|
114378
|
-
const
|
|
114379
|
-
if (
|
|
114427
|
+
const source2 = readText(target);
|
|
114428
|
+
if (source2 !== null) {
|
|
114380
114429
|
let same = false;
|
|
114381
114430
|
try {
|
|
114382
|
-
same = JSON.stringify(JSON.parse(
|
|
114431
|
+
same = JSON.stringify(JSON.parse(source2)) === JSON.stringify(JSON.parse(Buffer.from(local).toString()));
|
|
114383
114432
|
} catch {
|
|
114384
114433
|
}
|
|
114385
114434
|
if (!same) {
|
|
114386
114435
|
out[name] = { ...held5, kind };
|
|
114387
114436
|
continue;
|
|
114388
114437
|
}
|
|
114389
|
-
local = Buffer.from(
|
|
114438
|
+
local = Buffer.from(source2);
|
|
114390
114439
|
}
|
|
114391
114440
|
}
|
|
114392
114441
|
write(target, local);
|
|
@@ -114458,6 +114507,7 @@ async function pushAssets(ws, record, before) {
|
|
|
114458
114507
|
return path21.relative(real(path21.dirname(file2)), target).split(path21.sep).join("/");
|
|
114459
114508
|
};
|
|
114460
114509
|
try {
|
|
114510
|
+
let recoveredReferences = false;
|
|
114461
114511
|
const graph = collect(body, file2, {
|
|
114462
114512
|
resolve: (src, owner2) => {
|
|
114463
114513
|
const id = Object.entries(before).find(([, ref]) => ref.artifact === src);
|
|
@@ -114472,17 +114522,25 @@ async function pushAssets(ws, record, before) {
|
|
|
114472
114522
|
return { key: canonical(fs20.realpathSync(target)), file: target };
|
|
114473
114523
|
},
|
|
114474
114524
|
read: referenceText,
|
|
114475
|
-
retained: (key
|
|
114476
|
-
|
|
114477
|
-
|
|
114478
|
-
|
|
114525
|
+
retained: (key, types) => {
|
|
114526
|
+
let dependencies = record.assets[key]?.dependencies;
|
|
114527
|
+
if (!dependencies && types.length === 1 && types[0] === "studio" && before[key] && !recoveredReferences) {
|
|
114528
|
+
recoveredReferences = true;
|
|
114529
|
+
dependencies = Object.keys(before).filter((src) => src !== key);
|
|
114530
|
+
}
|
|
114531
|
+
return (dependencies ?? []).map((src) => {
|
|
114532
|
+
const kind = record.assets[src]?.kind;
|
|
114533
|
+
return { src, types: kind ? [kind] : [] };
|
|
114534
|
+
});
|
|
114535
|
+
}
|
|
114479
114536
|
});
|
|
114480
114537
|
for (const node of graph) {
|
|
114481
114538
|
const previous = [...node.aliases].map((key) => record.assets[key]).find(Boolean);
|
|
114482
114539
|
const old = [...node.aliases].map((key) => before[key]).find(Boolean);
|
|
114483
114540
|
const kind = node.kind;
|
|
114484
114541
|
let out;
|
|
114485
|
-
|
|
114542
|
+
const partialStudio = node.kind === "studio" && node.data?.version === 2;
|
|
114543
|
+
let why2 = node.error ?? (partialStudio ? void 0 : [...node.dependencies.values()].map((key) => refs[key]?.error).find(Boolean));
|
|
114486
114544
|
if (!why2 && node.file) {
|
|
114487
114545
|
try {
|
|
114488
114546
|
if (fs20.statSync(node.file).size > ASSET_FILE_LIMIT) throw new Error("This asset is over 100 MiB.");
|
|
@@ -114896,15 +114954,15 @@ function isLanguage(value) {
|
|
|
114896
114954
|
// ../cli/src/lib/machine/settings.ts
|
|
114897
114955
|
var settingsFile = () => path22.join(machineHome(), "settings.json");
|
|
114898
114956
|
function heldSettings() {
|
|
114899
|
-
let
|
|
114957
|
+
let text4;
|
|
114900
114958
|
try {
|
|
114901
|
-
|
|
114959
|
+
text4 = fs21.readFileSync(settingsFile(), "utf8");
|
|
114902
114960
|
} catch (err) {
|
|
114903
114961
|
if (err.code === "ENOENT") return { unreadable: false, values: {} };
|
|
114904
114962
|
return { unreadable: true, values: {} };
|
|
114905
114963
|
}
|
|
114906
114964
|
try {
|
|
114907
|
-
const parsed = JSON.parse(
|
|
114965
|
+
const parsed = JSON.parse(text4);
|
|
114908
114966
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return { unreadable: true, values: {} };
|
|
114909
114967
|
return { unreadable: false, values: parsed };
|
|
114910
114968
|
} catch {
|
|
@@ -114929,7 +114987,7 @@ var systemLanguages = /* @__PURE__ */ new Set([
|
|
|
114929
114987
|
"\u5BF9\u8BDD\u548C\u89E3\u91CA\u4F7F\u7528\u4E2D\u6587\uFF1B\u4EA7\u7269\u4F7F\u7528\u7528\u6237\u660E\u786E\u6307\u5B9A\u7684\u8BED\u8A00\uFF0C\u5426\u5219\u4F7F\u7528\u6240\u5C5E agent \u660E\u786E\u6307\u5B9A\u7684\u8BED\u8A00\uFF0C\u5747\u672A\u6307\u5B9A\u65F6\u4F7F\u7528\u4E2D\u6587\u3002\u4EE3\u7801\u3001\u547D\u4EE4\u3001\u6587\u4EF6\u540D\u548C\u5B57\u6BB5\u540D\u4FDD\u6301\u539F\u6587\u3002",
|
|
114930
114988
|
"Use English for conversation and explanations. For artifacts, use the language explicitly specified by the user, otherwise the responsible agent, otherwise English. Keep code, commands, filenames, and field names unchanged."
|
|
114931
114989
|
]);
|
|
114932
|
-
var isSystemLanguage = (
|
|
114990
|
+
var isSystemLanguage = (text4) => systemLanguages.has(text4);
|
|
114933
114991
|
var legacy = /* @__PURE__ */ new Map([
|
|
114934
114992
|
["\u8BF7\u7528\u4E2D\u6587\u56DE\u590D\u548C\u5199\u4F5C\u3002", "zh"],
|
|
114935
114993
|
["Reply and write in English.", "en"]
|
|
@@ -114960,24 +115018,21 @@ ${input.languageLine}`;
|
|
|
114960
115018
|
import fs34 from "node:fs";
|
|
114961
115019
|
import path37 from "node:path";
|
|
114962
115020
|
|
|
114963
|
-
// ../cli/src/lib/agent/types.ts
|
|
114964
|
-
var NOT_COMPLETED = "The delivery has not recorded completion.";
|
|
114965
|
-
|
|
114966
115021
|
// ../cli/src/lib/question-block.ts
|
|
114967
115022
|
var MODES = ["single", "multi"];
|
|
114968
|
-
var withoutTag = (
|
|
115023
|
+
var withoutTag = (text4) => text4.replace(/^\[user\]\s+/, "");
|
|
114969
115024
|
function normalizeQuestion(raw) {
|
|
114970
115025
|
if (raw && typeof raw === "object" && !Array.isArray(raw)) {
|
|
114971
|
-
const
|
|
114972
|
-
const
|
|
115026
|
+
const source2 = raw;
|
|
115027
|
+
const text4 = withoutTag(String(source2.question ?? source2.text ?? ""));
|
|
114973
115028
|
const extra = {
|
|
114974
|
-
...typeof
|
|
115029
|
+
...typeof source2.agent === "string" && source2.agent.trim() ? { agent: source2.agent.trim() } : {}
|
|
114975
115030
|
};
|
|
114976
|
-
const options = (Array.isArray(
|
|
114977
|
-
if (options.length === 0) return { text:
|
|
114978
|
-
const mode = MODES.includes(String(
|
|
114979
|
-
const recommend = (Array.isArray(
|
|
114980
|
-
return { text:
|
|
115031
|
+
const options = (Array.isArray(source2.options) ? source2.options : []).map((o3) => String(o3).trim()).filter(Boolean);
|
|
115032
|
+
if (options.length === 0) return { text: text4, ...extra };
|
|
115033
|
+
const mode = MODES.includes(String(source2.mode)) ? String(source2.mode) : "single";
|
|
115034
|
+
const recommend = (Array.isArray(source2.recommend) ? source2.recommend : []).map(Number).filter((n) => Number.isInteger(n) && n >= 1 && n <= options.length);
|
|
115035
|
+
return { text: text4, mode, options, recommend: mode === "single" ? recommend.slice(0, 1) : recommend, ...extra };
|
|
114981
115036
|
}
|
|
114982
115037
|
return { text: withoutTag(String(raw)) };
|
|
114983
115038
|
}
|
|
@@ -115024,16 +115079,16 @@ function parseQuestionsBlock(lines) {
|
|
|
115024
115079
|
}
|
|
115025
115080
|
|
|
115026
115081
|
// ../cli/src/lib/frontmatter.ts
|
|
115027
|
-
function parseFrontmatter(
|
|
115028
|
-
const lines =
|
|
115029
|
-
if (lines[0].trim() !== "---") return { meta: null, body:
|
|
115082
|
+
function parseFrontmatter(text4) {
|
|
115083
|
+
const lines = text4.split("\n");
|
|
115084
|
+
if (lines[0].trim() !== "---") return { meta: null, body: text4 };
|
|
115030
115085
|
let i = 1;
|
|
115031
115086
|
const fm = [];
|
|
115032
115087
|
while (i < lines.length && lines[i].trim() !== "---") {
|
|
115033
115088
|
fm.push(lines[i]);
|
|
115034
115089
|
i++;
|
|
115035
115090
|
}
|
|
115036
|
-
if (i >= lines.length) return { meta: null, body:
|
|
115091
|
+
if (i >= lines.length) return { meta: null, body: text4 };
|
|
115037
115092
|
const meta = {};
|
|
115038
115093
|
for (let j2 = 0; j2 < fm.length; j2++) {
|
|
115039
115094
|
const m = fm[j2].match(/^([A-Za-z_]+):\s*(.*)$/);
|
|
@@ -115224,9 +115279,9 @@ function createEventCollector() {
|
|
|
115224
115279
|
}
|
|
115225
115280
|
},
|
|
115226
115281
|
/** A whole message, for a source that never sends one in pieces. */
|
|
115227
|
-
message(
|
|
115282
|
+
message(text4) {
|
|
115228
115283
|
close();
|
|
115229
|
-
if (
|
|
115284
|
+
if (text4.trim()) queue.push({ kind: "message", data: { text: text4.trim() } });
|
|
115230
115285
|
},
|
|
115231
115286
|
toolCall(toolCallId, title, kind, target) {
|
|
115232
115287
|
close();
|
|
@@ -115262,13 +115317,13 @@ function createEventCollector() {
|
|
|
115262
115317
|
todos = next;
|
|
115263
115318
|
queue.push({ kind: "plan", data: { entries: todos.map(({ id: _2, ...e2 }) => e2) } });
|
|
115264
115319
|
},
|
|
115265
|
-
log(
|
|
115320
|
+
log(text4) {
|
|
115266
115321
|
close();
|
|
115267
|
-
if (
|
|
115322
|
+
if (text4.trim()) queue.push({ kind: "log", data: { text: text4 } });
|
|
115268
115323
|
},
|
|
115269
|
-
error(
|
|
115324
|
+
error(text4) {
|
|
115270
115325
|
close();
|
|
115271
|
-
if (
|
|
115326
|
+
if (text4.trim()) queue.push({ kind: "error", data: { text: text4.trim() } });
|
|
115272
115327
|
},
|
|
115273
115328
|
/** The turn is over: a half-held message is finished off. */
|
|
115274
115329
|
end() {
|
|
@@ -115607,7 +115662,7 @@ function priceUsd(provider, model, usage) {
|
|
|
115607
115662
|
import { readFileSync, readdirSync, statSync } from "node:fs";
|
|
115608
115663
|
import { homedir } from "node:os";
|
|
115609
115664
|
import { join } from "node:path";
|
|
115610
|
-
function
|
|
115665
|
+
function text3(value) {
|
|
115611
115666
|
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
115612
115667
|
}
|
|
115613
115668
|
function count(value) {
|
|
@@ -115713,8 +115768,8 @@ function readCodexRunFacts(threadId) {
|
|
|
115713
115768
|
} catch {
|
|
115714
115769
|
}
|
|
115715
115770
|
}
|
|
115716
|
-
if (entry.type === "session_meta") facts.provider ??=
|
|
115717
|
-
if (entry.type === "turn_context") facts.model =
|
|
115771
|
+
if (entry.type === "session_meta") facts.provider ??= text3(payload.model_provider);
|
|
115772
|
+
if (entry.type === "turn_context") facts.model = text3(payload.model) ?? facts.model;
|
|
115718
115773
|
if (payload.type === "token_count") {
|
|
115719
115774
|
facts.context = contextIn(payload.info) ?? facts.context;
|
|
115720
115775
|
const info = payload.info && typeof payload.info === "object" ? payload.info : {};
|
|
@@ -115765,7 +115820,7 @@ function childSpend(ids, since) {
|
|
|
115765
115820
|
}
|
|
115766
115821
|
|
|
115767
115822
|
// ../cli/src/lib/agent/wire/codex-stream.ts
|
|
115768
|
-
var imageSafeText = (
|
|
115823
|
+
var imageSafeText = (text4) => text4.replace(/data:image\/[a-z0-9.+-]+;base64,[A-Za-z0-9+/=]+/gi, "[image]").replace(/!\[([^\]]*)\]\((?:<)?(?:\/|[A-Za-z]:[\\/]|file:)[^\n)]*\)/g, "[$1]");
|
|
115769
115824
|
function renderStarted(item) {
|
|
115770
115825
|
switch (item.type) {
|
|
115771
115826
|
case "command_execution":
|
|
@@ -116152,10 +116207,10 @@ function readKimiRunFacts(sessionId) {
|
|
|
116152
116207
|
// ../cli/src/lib/agent/wire/kimi-stream.ts
|
|
116153
116208
|
var ARG_KEYS2 = ["command", "path", "pattern", "query", "url", "prompt", "prompt_template", "description"];
|
|
116154
116209
|
function callArgs(raw) {
|
|
116155
|
-
const
|
|
116156
|
-
if (!
|
|
116210
|
+
const text4 = str2(raw);
|
|
116211
|
+
if (!text4.trim()) return {};
|
|
116157
116212
|
try {
|
|
116158
|
-
return JSON.parse(
|
|
116213
|
+
return JSON.parse(text4);
|
|
116159
116214
|
} catch {
|
|
116160
116215
|
return {};
|
|
116161
116216
|
}
|
|
@@ -116231,9 +116286,9 @@ function createKimiStreamRenderer(cwd, resumeId) {
|
|
|
116231
116286
|
return row.type === "turn.step.retrying" ? retry(row) : "";
|
|
116232
116287
|
case "tool": {
|
|
116233
116288
|
const id = str2(row.tool_call_id);
|
|
116234
|
-
const
|
|
116235
|
-
if (subagents.delete(id)) events.toolResult(id, /^status: completed$/m.test(
|
|
116236
|
-
else events.toolResult(id, "completed",
|
|
116289
|
+
const text4 = str2(row.content);
|
|
116290
|
+
if (subagents.delete(id)) events.toolResult(id, /^status: completed$/m.test(text4) ? "completed" : "failed", "");
|
|
116291
|
+
else events.toolResult(id, "completed", text4);
|
|
116237
116292
|
return "";
|
|
116238
116293
|
}
|
|
116239
116294
|
default:
|
|
@@ -116431,9 +116486,9 @@ function createTail(log) {
|
|
|
116431
116486
|
log(chunk);
|
|
116432
116487
|
},
|
|
116433
116488
|
/** One line about something that isn't the agent talking. */
|
|
116434
|
-
line(
|
|
116489
|
+
line(text4) {
|
|
116435
116490
|
close();
|
|
116436
|
-
log(`${
|
|
116491
|
+
log(`${text4}
|
|
116437
116492
|
`);
|
|
116438
116493
|
},
|
|
116439
116494
|
/** End of the turn: whatever is half-written is finished off. */
|
|
@@ -116447,8 +116502,8 @@ function createTail(log) {
|
|
|
116447
116502
|
// ../cli/package.json
|
|
116448
116503
|
var package_default = {
|
|
116449
116504
|
name: "wildcrane",
|
|
116450
|
-
version: "0.11.
|
|
116451
|
-
akbContract:
|
|
116505
|
+
version: "0.11.58",
|
|
116506
|
+
akbContract: 16,
|
|
116452
116507
|
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.",
|
|
116453
116508
|
keywords: [
|
|
116454
116509
|
"kanban",
|
|
@@ -116526,8 +116581,8 @@ function saidBy(update2) {
|
|
|
116526
116581
|
const content = Array.isArray(update2.content) ? update2.content : [];
|
|
116527
116582
|
for (const raw of content) {
|
|
116528
116583
|
const part = obj(raw);
|
|
116529
|
-
const
|
|
116530
|
-
if (
|
|
116584
|
+
const text4 = str2(obj(part.content).text) || str2(part.text);
|
|
116585
|
+
if (text4.trim()) return text4.trim();
|
|
116531
116586
|
}
|
|
116532
116587
|
return "";
|
|
116533
116588
|
}
|
|
@@ -116830,11 +116885,11 @@ function createParts(tail) {
|
|
|
116830
116885
|
const written = /* @__PURE__ */ new Map();
|
|
116831
116886
|
const tools = /* @__PURE__ */ new Set();
|
|
116832
116887
|
const named = /* @__PURE__ */ new Map();
|
|
116833
|
-
const say = (partId, kind,
|
|
116888
|
+
const say = (partId, kind, text4) => {
|
|
116834
116889
|
const before = written.get(partId) ?? "";
|
|
116835
|
-
const fresh =
|
|
116890
|
+
const fresh = text4.startsWith(before) ? text4.slice(before.length) : text4;
|
|
116836
116891
|
if (!fresh) return;
|
|
116837
|
-
written.set(partId,
|
|
116892
|
+
written.set(partId, text4);
|
|
116838
116893
|
if (kind === "reasoning" || kind === "thought") tail.thought(fresh);
|
|
116839
116894
|
else tail.text(fresh);
|
|
116840
116895
|
};
|
|
@@ -117260,7 +117315,7 @@ async function run2(io, options, tasks) {
|
|
|
117260
117315
|
status: raw.status === "inProgress" ? "in_progress" : raw.status
|
|
117261
117316
|
} });
|
|
117262
117317
|
};
|
|
117263
|
-
const start = async (
|
|
117318
|
+
const start = async (text4, images = []) => {
|
|
117264
117319
|
active = true;
|
|
117265
117320
|
waiting = false;
|
|
117266
117321
|
submitted = true;
|
|
@@ -117270,7 +117325,7 @@ async function run2(io, options, tasks) {
|
|
|
117270
117325
|
startupTimer = setTimeout(() => {
|
|
117271
117326
|
if (!started) io.event?.({ kind: "log", data: { text: "[conversation] start_unconfirmed" } });
|
|
117272
117327
|
}, CONVERSATION_MS.start);
|
|
117273
|
-
await bounded(rpc.call("turn/start", { threadId, input: [{ type: "text", text:
|
|
117328
|
+
await bounded(rpc.call("turn/start", { threadId, input: [{ type: "text", text: text4 }, ...images.map((path47) => ({ type: "localImage", path: path47 }))] }), CONVERSATION_MS.start, "Codex turn/start timed out; submission outcome is unknown.").catch((error) => {
|
|
117274
117329
|
if (!started) throw error;
|
|
117275
117330
|
});
|
|
117276
117331
|
};
|
|
@@ -117474,7 +117529,7 @@ var quote = (s) => /^[\w./:@=-]+$/.test(s) ? s : `"${s}"`;
|
|
|
117474
117529
|
function shimDir(akb) {
|
|
117475
117530
|
const dir = akb.shim;
|
|
117476
117531
|
const line = [akb.command, ...akb.args].map(quote).join(" ");
|
|
117477
|
-
const [file2,
|
|
117532
|
+
const [file2, text4] = process.platform === "win32" ? [path25.join(dir, "akb.cmd"), `@${line} %*\r
|
|
117478
117533
|
`] : [path25.join(dir, "akb"), `#!/bin/sh
|
|
117479
117534
|
exec ${line} "$@"
|
|
117480
117535
|
`];
|
|
@@ -117486,11 +117541,11 @@ exec ${shellLine} "$@"
|
|
|
117486
117541
|
`, { mode: 493 });
|
|
117487
117542
|
}
|
|
117488
117543
|
try {
|
|
117489
|
-
if (fs24.readFileSync(file2, "utf8") ===
|
|
117544
|
+
if (fs24.readFileSync(file2, "utf8") === text4) return dir;
|
|
117490
117545
|
} catch {
|
|
117491
117546
|
}
|
|
117492
117547
|
fs24.mkdirSync(dir, { recursive: true });
|
|
117493
|
-
fs24.writeFileSync(file2,
|
|
117548
|
+
fs24.writeFileSync(file2, text4, { mode: 493 });
|
|
117494
117549
|
return dir;
|
|
117495
117550
|
}
|
|
117496
117551
|
function akbEnv(akb, board, task, language, base = process.env) {
|
|
@@ -117512,8 +117567,8 @@ function runAkb(akb, args2, opts) {
|
|
|
117512
117567
|
return new Promise((resolve2) => {
|
|
117513
117568
|
let out = "";
|
|
117514
117569
|
let last = "";
|
|
117515
|
-
const note = (
|
|
117516
|
-
const line =
|
|
117570
|
+
const note = (text4) => {
|
|
117571
|
+
const line = text4.split("\n").map((l2) => l2.trim()).filter(Boolean).at(-1);
|
|
117517
117572
|
if (line) last = line;
|
|
117518
117573
|
};
|
|
117519
117574
|
let child;
|
|
@@ -117604,15 +117659,15 @@ var MCP_CONFIG = {
|
|
|
117604
117659
|
placeholder: "/path/to/mcp.json",
|
|
117605
117660
|
help: "A JSON file of `mcpServers`, as Claude Code's --mcp-config takes. Empty opens no servers."
|
|
117606
117661
|
};
|
|
117607
|
-
function machineFile(name,
|
|
117608
|
-
const suffix = createHash2("sha256").update(
|
|
117662
|
+
function machineFile(name, text4) {
|
|
117663
|
+
const suffix = createHash2("sha256").update(text4).digest("hex").slice(0, 16);
|
|
117609
117664
|
const file2 = path26.join(machineHome(), "prompts", `${path26.parse(name).name}-${suffix}${path26.extname(name)}`);
|
|
117610
117665
|
try {
|
|
117611
|
-
if (fs25.readFileSync(file2, "utf8") ===
|
|
117666
|
+
if (fs25.readFileSync(file2, "utf8") === text4) return file2;
|
|
117612
117667
|
} catch {
|
|
117613
117668
|
}
|
|
117614
117669
|
fs25.mkdirSync(path26.dirname(file2), { recursive: true });
|
|
117615
|
-
fs25.writeFileSync(file2,
|
|
117670
|
+
fs25.writeFileSync(file2, text4);
|
|
117616
117671
|
return file2;
|
|
117617
117672
|
}
|
|
117618
117673
|
|
|
@@ -117652,13 +117707,13 @@ function cmdArg(arg) {
|
|
|
117652
117707
|
function cmdLine(file2, args2) {
|
|
117653
117708
|
return `"${[file2.replace(META, "^$1"), ...args2.map(cmdArg)].join(" ")}"`;
|
|
117654
117709
|
}
|
|
117655
|
-
function shimTarget(
|
|
117710
|
+
function shimTarget(text4, file2) {
|
|
117656
117711
|
const dir = path27.win32.dirname(file2);
|
|
117657
|
-
const found = /"%(?:~dp0|dp0%)\\?([^"%]+)"\s+%\*/i.exec(
|
|
117658
|
-
if (!found || !/\\node\.exe"/i.test(
|
|
117712
|
+
const found = /"%(?:~dp0|dp0%)\\?([^"%]+)"\s+%\*/i.exec(text4);
|
|
117713
|
+
if (!found || !/\\node\.exe"/i.test(text4)) return null;
|
|
117659
117714
|
const script = path27.win32.resolve(dir, found[1].replace(/\//g, "\\"));
|
|
117660
117715
|
const local = path27.win32.join(dir, "node.exe");
|
|
117661
|
-
const nodePath = /SET "NODE_PATH=([^"]*)"/i.exec(
|
|
117716
|
+
const nodePath = /SET "NODE_PATH=([^"]*)"/i.exec(text4)?.[1];
|
|
117662
117717
|
return { script, node: fs26.existsSync(local) ? local : "node", env: nodePath ? { NODE_PATH: nodePath } : {} };
|
|
117663
117718
|
}
|
|
117664
117719
|
function onWindowsPath(name, env2) {
|
|
@@ -117679,12 +117734,12 @@ function spawnable(command, args2, options = {}, platform = process.platform) {
|
|
|
117679
117734
|
const ext = path27.extname(file2).toLowerCase();
|
|
117680
117735
|
const hidden = { ...options, windowsHide: true, shell: false };
|
|
117681
117736
|
if (ext !== ".cmd" && ext !== ".bat") return { command: file2, args: args2, options: hidden };
|
|
117682
|
-
let
|
|
117737
|
+
let text4 = "";
|
|
117683
117738
|
try {
|
|
117684
|
-
|
|
117739
|
+
text4 = fs26.readFileSync(file2, "utf8");
|
|
117685
117740
|
} catch {
|
|
117686
117741
|
}
|
|
117687
|
-
const shim = shimTarget(
|
|
117742
|
+
const shim = shimTarget(text4, file2);
|
|
117688
117743
|
if (shim) {
|
|
117689
117744
|
return { command: shim.node, args: [shim.script, ...args2], options: { ...hidden, env: { ...env2, ...shim.env } } };
|
|
117690
117745
|
}
|
|
@@ -118041,15 +118096,15 @@ function createAntigravityRenderer(expectedSession) {
|
|
|
118041
118096
|
session = str2(step.conversation_id) || session;
|
|
118042
118097
|
const id = String(step.step_index ?? "");
|
|
118043
118098
|
if (step.step_type === "agent_response") {
|
|
118044
|
-
const
|
|
118045
|
-
if (
|
|
118099
|
+
const text4 = str2(step.text_delta);
|
|
118100
|
+
if (text4) events.update({ sessionUpdate: "agent_message_chunk", content: { text: text4 } });
|
|
118046
118101
|
const index = num(step.step_index);
|
|
118047
118102
|
if (step.state === "DONE" && step.usage && !counted.has(index)) {
|
|
118048
118103
|
counted.add(index);
|
|
118049
118104
|
turnUsage = add(turnUsage, usageOf4(step.usage));
|
|
118050
118105
|
used = turnUsage;
|
|
118051
118106
|
}
|
|
118052
|
-
return
|
|
118107
|
+
return text4;
|
|
118053
118108
|
}
|
|
118054
118109
|
if (step.step_type === "tool") {
|
|
118055
118110
|
const tool = obj(step.tool_info);
|
|
@@ -118105,10 +118160,10 @@ function createAntigravityRenderer(expectedSession) {
|
|
|
118105
118160
|
return {
|
|
118106
118161
|
push: reader.push,
|
|
118107
118162
|
flush() {
|
|
118108
|
-
const
|
|
118163
|
+
const text4 = reader.flush();
|
|
118109
118164
|
if (!terminal) fail(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.");
|
|
118110
118165
|
events.end();
|
|
118111
|
-
return
|
|
118166
|
+
return text4;
|
|
118112
118167
|
},
|
|
118113
118168
|
stderr(chunk) {
|
|
118114
118169
|
stderr = (stderr + chunk).slice(-16e3);
|
|
@@ -118169,8 +118224,8 @@ var ANTIGRAVITY = {
|
|
|
118169
118224
|
const at2 = argv.indexOf("--conversation");
|
|
118170
118225
|
return createAntigravityRenderer(at2 >= 0 ? argv[at2 + 1] : argv.find((a2) => a2.startsWith("--conversation="))?.slice(15));
|
|
118171
118226
|
},
|
|
118172
|
-
systemPrompt(
|
|
118173
|
-
const rule = `${
|
|
118227
|
+
systemPrompt(text4, _argv, env2) {
|
|
118228
|
+
const rule = `${text4}
|
|
118174
118229
|
|
|
118175
118230
|
The task working directory is ${env2.PWD ?? process.cwd()}. Use it as the base for project files and commands. This additional workspace contains only language rules; do not write task output here.`;
|
|
118176
118231
|
const hash = createHash3("sha256").update(rule).digest("hex").slice(0, 16);
|
|
@@ -118305,22 +118360,22 @@ var PASSING = [
|
|
|
118305
118360
|
];
|
|
118306
118361
|
var RETRY_AFTER = /retry[-_\s]?after["':=\s]+(\d+)/i;
|
|
118307
118362
|
var REASON_MAX = 140;
|
|
118308
|
-
function reasonLine(
|
|
118309
|
-
const line =
|
|
118363
|
+
function reasonLine(text4, rule) {
|
|
118364
|
+
const line = text4.split("\n").find((l2) => rule.test(l2.toLowerCase())) ?? text4;
|
|
118310
118365
|
const said = line.trim().replace(/\s+/g, " ");
|
|
118311
118366
|
return said.length > REASON_MAX ? `${said.slice(0, REASON_MAX - 1)}\u2026` : said;
|
|
118312
118367
|
}
|
|
118313
118368
|
function providerBlip(...said) {
|
|
118314
|
-
for (const
|
|
118315
|
-
if (!
|
|
118316
|
-
const lower =
|
|
118369
|
+
for (const text4 of said) {
|
|
118370
|
+
if (!text4?.trim()) continue;
|
|
118371
|
+
const lower = text4.toLowerCase();
|
|
118317
118372
|
if (MANUAL.some((rule) => rule.test(lower))) return void 0;
|
|
118318
118373
|
const hit = PASSING.find((rule) => rule.test(lower));
|
|
118319
118374
|
if (!hit) continue;
|
|
118320
|
-
const asked = RETRY_AFTER.exec(
|
|
118375
|
+
const asked = RETRY_AFTER.exec(text4);
|
|
118321
118376
|
const seconds = asked ? Number(asked[1]) : NaN;
|
|
118322
118377
|
return {
|
|
118323
|
-
reason: reasonLine(
|
|
118378
|
+
reason: reasonLine(text4, hit),
|
|
118324
118379
|
...Number.isFinite(seconds) && seconds > 0 ? { retryAfterMs: seconds * 1e3 } : {}
|
|
118325
118380
|
};
|
|
118326
118381
|
}
|
|
@@ -118380,11 +118435,11 @@ var CLAUDE_CODE = {
|
|
|
118380
118435
|
return [...claudeStreamArgs(argv), "--resume", resumeId, "--fork-session", "--session-id", sessionId];
|
|
118381
118436
|
},
|
|
118382
118437
|
// 默认快照会忽略续跑传入的新规则;仅显式关闭快照的会话支持更新。
|
|
118383
|
-
systemPrompt(
|
|
118438
|
+
systemPrompt(text4, argv) {
|
|
118384
118439
|
if (namesFlag(argv, ["--append-system-prompt", "--append-system-prompt-file"])) return {};
|
|
118385
118440
|
const snapshot = argv.flatMap((arg, i) => arg === "--system-prompt-snapshot" ? [argv[i + 1]] : arg.startsWith("--system-prompt-snapshot=") ? [arg.slice("--system-prompt-snapshot=".length)] : []).at(-1);
|
|
118386
118441
|
if (namesFlag(argv, ["--resume", "-r", "--continue", "-c"]) && snapshot !== "off") return {};
|
|
118387
|
-
return { args: ["--append-system-prompt",
|
|
118442
|
+
return { args: ["--append-system-prompt", text4] };
|
|
118388
118443
|
},
|
|
118389
118444
|
// What Claude Code takes: who pays for the run, where that run goes, a model id, and how
|
|
118390
118445
|
// hard that model thinks. The provider comes first because it decides the rest — which
|
|
@@ -118776,14 +118831,14 @@ var CODEX = {
|
|
|
118776
118831
|
return [...codexExtraArgs(argv, cwd), "fork", resumeId];
|
|
118777
118832
|
},
|
|
118778
118833
|
// 自设系统指令保持原样;无法追加时由调用方明确提示。
|
|
118779
|
-
systemPrompt(
|
|
118834
|
+
systemPrompt(text4, argv) {
|
|
118780
118835
|
if (namesFlag(argv, ["developer_instructions", "model_instructions_file"])) return {};
|
|
118781
118836
|
try {
|
|
118782
118837
|
const config = fs29.readFileSync(path31.join(process.env.CODEX_HOME || home2(".codex"), "config.toml"), "utf8");
|
|
118783
118838
|
if (/^\s*(?:developer_instructions|model_instructions_file)\s*=/m.test(config)) return {};
|
|
118784
118839
|
} catch {
|
|
118785
118840
|
}
|
|
118786
|
-
return { args: ["-c", `developer_instructions=${JSON.stringify(
|
|
118841
|
+
return { args: ["-c", `developer_instructions=${JSON.stringify(text4)}`] };
|
|
118787
118842
|
},
|
|
118788
118843
|
// What Codex takes, in the order Claude Code's dialog draws the same four: who pays for
|
|
118789
118844
|
// the run and where it goes, that endpoint's address, the key, a model, and how hard that
|
|
@@ -119106,11 +119161,11 @@ var DSH = {
|
|
|
119106
119161
|
// dsh-acp's persona IS its system prompt, so the ask is added to the one in effect: the
|
|
119107
119162
|
// user's own `DSH_SYSTEM_PROMPT`, else the bridge's default. A `--persona` on the command
|
|
119108
119163
|
// line outranks both, and is left alone.
|
|
119109
|
-
systemPrompt(
|
|
119164
|
+
systemPrompt(text4, argv, env2) {
|
|
119110
119165
|
if (namesFlag(argv, ["--persona"])) return {};
|
|
119111
119166
|
return { env: { DSH_SYSTEM_PROMPT: `${env2.DSH_SYSTEM_PROMPT || DSH_PERSONA}
|
|
119112
119167
|
|
|
119113
|
-
${
|
|
119168
|
+
${text4}` } };
|
|
119114
119169
|
},
|
|
119115
119170
|
// ACP carries all three in the conversation itself (agent/wire/acp.ts), so a dsh run shows a
|
|
119116
119171
|
// price, its tokens and the model the session opened on.
|
|
@@ -119161,8 +119216,8 @@ var GROK = {
|
|
|
119161
119216
|
return [];
|
|
119162
119217
|
},
|
|
119163
119218
|
// `--rules` appends to Grok's system prompt. A top-level option, so it goes before `agent`.
|
|
119164
|
-
systemPrompt(
|
|
119165
|
-
return namesFlag(argv, ["--rules"]) ? {} : { args: ["--rules",
|
|
119219
|
+
systemPrompt(text4, argv) {
|
|
119220
|
+
return namesFlag(argv, ["--rules"]) ? {} : { args: ["--rules", text4] };
|
|
119166
119221
|
},
|
|
119167
119222
|
// What Grok takes: a model, and the xAI key. Both boxes can stay empty — someone already
|
|
119168
119223
|
// set up with grok has a login in `~/.grok` and a default model in its own
|
|
@@ -119269,7 +119324,7 @@ var KIMI = {
|
|
|
119269
119324
|
},
|
|
119270
119325
|
// An agent file wrapping Kimi's own prompt in `${base_prompt}`. Only a new session takes one;
|
|
119271
119326
|
// a resumed one keeps the agent it opened with, and Kimi refuses the flag beside `--session`.
|
|
119272
|
-
systemPrompt(
|
|
119327
|
+
systemPrompt(text4, argv) {
|
|
119273
119328
|
if (namesFlag(argv, ["--session", "-S", "--resume", "-r", "--continue", "-C", "--agent", "--agent-file"])) return {};
|
|
119274
119329
|
const file2 = machineFile("kimi-language.md", `---
|
|
119275
119330
|
name: akb-language
|
|
@@ -119278,7 +119333,7 @@ description: Kimi's default agent, told which language to write in
|
|
|
119278
119333
|
|
|
119279
119334
|
\${base_prompt}
|
|
119280
119335
|
|
|
119281
|
-
${
|
|
119336
|
+
${text4}
|
|
119282
119337
|
`);
|
|
119283
119338
|
return { args: ["--agent-file", file2] };
|
|
119284
119339
|
},
|
|
@@ -119502,8 +119557,8 @@ var OPENCODE = {
|
|
|
119502
119557
|
env: () => ({ ...process.env }),
|
|
119503
119558
|
// `instructions` files join the system prompt, and OpenCode adds this config's list to the
|
|
119504
119559
|
// user's own rather than replacing it.
|
|
119505
|
-
systemPrompt(
|
|
119506
|
-
const file2 = machineFile("opencode-language.md", `${
|
|
119560
|
+
systemPrompt(text4, _argv, env2) {
|
|
119561
|
+
const file2 = machineFile("opencode-language.md", `${text4}
|
|
119507
119562
|
`);
|
|
119508
119563
|
let own = {};
|
|
119509
119564
|
try {
|
|
@@ -119763,9 +119818,9 @@ function languageEnv(given) {
|
|
|
119763
119818
|
}
|
|
119764
119819
|
function withSystemLanguage(harness, argv, env2, language) {
|
|
119765
119820
|
env2 = languageEnv(env2);
|
|
119766
|
-
const
|
|
119767
|
-
if (!
|
|
119768
|
-
const added = argv.length ? harness.systemPrompt?.(
|
|
119821
|
+
const text4 = systemLanguage(language);
|
|
119822
|
+
if (!text4) return { argv, env: env2 };
|
|
119823
|
+
const added = argv.length ? harness.systemPrompt?.(text4, argv, env2) : void 0;
|
|
119769
119824
|
if (!added?.args?.length && !Object.keys(added?.env ?? {}).length) {
|
|
119770
119825
|
const note = language === "zh" ? "\u8BED\u8A00\u89C4\u5219\u672A\u80FD\u66F4\u65B0\uFF1A\u8FDE\u63A5\u5668\u3001\u5DF2\u6709\u4F1A\u8BDD\u6216\u81EA\u8BBE\u7CFB\u7EDF\u63D0\u793A\u8BCD\u4E0D\u652F\u6301\u6CE8\u5165\u3002\u8BF7\u81EA\u884C\u53E6\u5F00\u652F\u6301\u7684\u4F1A\u8BDD\u4EE5\u91C7\u7528\u65B0\u89C4\u5219\u3002" : "Language rules could not be updated: the connector, existing session, or custom system prompt prevents injection. Open a supported new session to apply them.";
|
|
119771
119826
|
return { argv, env: env2, note };
|
|
@@ -120120,8 +120175,8 @@ function installCommitHook(root2, _board) {
|
|
|
120120
120175
|
if (!dir) return {};
|
|
120121
120176
|
const file2 = path36.join(dir, "pre-commit");
|
|
120122
120177
|
if (fs33.lstatSync(file2, { throwIfNoEntry: false })?.isSymbolicLink()) return {};
|
|
120123
|
-
const
|
|
120124
|
-
if (
|
|
120178
|
+
const source2 = read2(file2);
|
|
120179
|
+
if (source2 && MARKER_LINE.test(source2)) fs33.unlinkSync(file2);
|
|
120125
120180
|
return {};
|
|
120126
120181
|
}
|
|
120127
120182
|
|
|
@@ -120216,7 +120271,7 @@ function deliveryEnding(ws, id, asked = false) {
|
|
|
120216
120271
|
if (held5.status === "cancelled") {
|
|
120217
120272
|
return held5.steps?.some((s) => s.step === "discarded") ? { ok: false, reason: "The build was discarded." } : { ok: false, reason: "", stopped: true };
|
|
120218
120273
|
}
|
|
120219
|
-
if (held5.status === "active" &&
|
|
120274
|
+
if (held5.status === "active" && stopped2?.why) return { ok: false, reason: reasonOf(stopped2.why) ?? stopped2.why };
|
|
120220
120275
|
return null;
|
|
120221
120276
|
}
|
|
120222
120277
|
function checkoutsOf(ws, id) {
|
|
@@ -120245,7 +120300,7 @@ var RESUME_REFUSED = {
|
|
|
120245
120300
|
};
|
|
120246
120301
|
var isArchived = (ws, id) => path37.relative(ws.board, findCard(ws.board, id) ?? ws.board).split(path37.sep)[0] === ".archive";
|
|
120247
120302
|
var refusal2 = (ran) => ran.last.replace(/^akb( raw)?: /, "").slice(0, 300) || "akb stopped with an error.";
|
|
120248
|
-
var reasonOf = (
|
|
120303
|
+
var reasonOf = (text4) => (text4 ?? "").split("\n").map((l2) => l2.trim()).filter((l2) => l2 && !/^at\s/.test(l2)).join("\n").slice(0, 300) || void 0;
|
|
120249
120304
|
function logLines(show, event2) {
|
|
120250
120305
|
let held5 = "";
|
|
120251
120306
|
const said = (line) => {
|
|
@@ -120298,7 +120353,7 @@ function boardAkb(job, ws, deps, io, task) {
|
|
|
120298
120353
|
if (!replyAssetsSynced(ws)) return { ok: false, error: "Preview uploads are still pending." };
|
|
120299
120354
|
}
|
|
120300
120355
|
return previewOperation(deps.machineId, job.id, agent, fields);
|
|
120301
|
-
}) : null;
|
|
120356
|
+
}, ws.number ?? void 0) : null;
|
|
120302
120357
|
try {
|
|
120303
120358
|
const ran = await runAkb(deps.akb, full, { cwd: ws.cwd, board: ws.board, task, language: cloudLanguage(job), env: { ...env2, ...bridge ? { AI4KANBAN_PREVIEW_BRIDGE: bridge.env } : {}, AI4KANBAN_EXECUTION: JSON.stringify({ job: job.id, machine: deps.machineId }) }, show: log?.push, track: io.track });
|
|
120304
120359
|
log?.end();
|
|
@@ -120555,14 +120610,14 @@ ${pictures(job, ws, ws.number)}`);
|
|
|
120555
120610
|
if (!await stopRuns(deps.akb, ws, id2, since, deps.stopMs)) throw new Error("\u672A\u80FD\u786E\u8BA4\u539F\u6267\u884C\u5DF2\u505C\u6B62\u3002");
|
|
120556
120611
|
});
|
|
120557
120612
|
const verb = flow.verb === "create" ? flow.skip_plan ? "implement" : "refine" : flow.verb;
|
|
120558
|
-
const
|
|
120613
|
+
const text4 = flow.verb === "create" ? "" : (flow.text ?? "").trim();
|
|
120559
120614
|
if (flow.resume && isArchived(ws, id2)) return { ok: true, report: { card: id2 } };
|
|
120560
120615
|
if (flow.resume && verb === "refine") {
|
|
120561
120616
|
const review2 = reviewOf2(cardFile(ws));
|
|
120562
120617
|
if (review2) return { ok: true, report: { card: id2, ...review2 === true ? {} : { review: review2 } } };
|
|
120563
120618
|
}
|
|
120564
|
-
if (verb === "revise" && !
|
|
120565
|
-
let note = verb === "resolve" || verb === "revise" ?
|
|
120619
|
+
if (verb === "revise" && !text4) return fail("Say what to change.");
|
|
120620
|
+
let note = verb === "resolve" || verb === "revise" ? text4 : "";
|
|
120566
120621
|
let rejected = false;
|
|
120567
120622
|
let ran;
|
|
120568
120623
|
let continuation;
|
|
@@ -120583,21 +120638,21 @@ ${pictures(job, ws, ws.number)}`);
|
|
|
120583
120638
|
} else if (deliveryId) {
|
|
120584
120639
|
const previous = answerOf2(await akb(["raw", "run", "list", "--card", String(id2), "--all", "--json"]))?.runs?.filter((r2) => ["implement", "conflict", "hook"].includes(r2.action ?? "") && r2.deliveryId === deliveryId).sort((a2, b2) => (b2.startedAt ?? 0) - (a2.startedAt ?? 0))[0];
|
|
120585
120640
|
if (previous) {
|
|
120586
|
-
continuation =
|
|
120641
|
+
continuation = ["raw", "run", "resume", previous.sessionId, "--require-session"];
|
|
120587
120642
|
}
|
|
120588
120643
|
}
|
|
120589
|
-
} else if (verb === "implement" &&
|
|
120590
|
-
const resolved = await akb(["raw", "card", "resolve", String(id2), "--follow", "--events", "--json", "--",
|
|
120644
|
+
} else if (verb === "implement" && text4) {
|
|
120645
|
+
const resolved = await akb(["raw", "card", "resolve", String(id2), "--follow", "--events", "--json", "--", text4], true);
|
|
120591
120646
|
if (io.lost()) return fail("");
|
|
120592
120647
|
const file2 = findCard(ws.board, id2);
|
|
120593
120648
|
rejected = !!file2 && path37.relative(ws.board, file2).split(path37.sep)[0] === ".archive" && parseFrontmatter(fs34.readFileSync(file2, "utf8")).meta?.rejected === true;
|
|
120594
120649
|
if (rejected) ran = resolved;
|
|
120595
|
-
else if (resolved.code !== 0) note =
|
|
120650
|
+
else if (resolved.code !== 0) note = text4;
|
|
120596
120651
|
}
|
|
120597
120652
|
const fresh = () => {
|
|
120598
120653
|
const carry = carryArgs(verb);
|
|
120599
120654
|
const costFrom = carry.includes("--session") && typeof job.resumeCostUsd === "number" ? { [SESSION_COST_ENV]: String(job.resumeCostUsd) } : void 0;
|
|
120600
|
-
if (verb === "preview") return akb(["raw", "previews",
|
|
120655
|
+
if (verb === "preview") return akb(["raw", "previews", text4, String(id2), "--continue", "--follow", "--events", "--json", ...flow.feedback ? ["--notes", flow.feedback] : []], true);
|
|
120601
120656
|
return akb(["raw", "card", verb, String(id2), "--follow", "--events", "--json", ...carry, ...note ? ["--", note] : []], true, costFrom);
|
|
120602
120657
|
};
|
|
120603
120658
|
ran ??= await (continuation ? akb([...continuation, "--follow", "--events", "--json"], true) : fresh());
|
|
@@ -120622,9 +120677,10 @@ ${pictures(job, ws, ws.number)}`);
|
|
|
120622
120677
|
const said = ((last ? runs.find((r2) => r2.sessionId === last)?.result : void 0) ?? answer?.result ?? answer?.error?.result)?.trim();
|
|
120623
120678
|
const spent = spentBy([...learned, ...runs.filter((r2) => (r2.startedAt ?? 0) >= since)], job);
|
|
120624
120679
|
const commit = !rejected && ran.code === 0 ? answer?.delivery?.commit : void 0;
|
|
120680
|
+
const pending = verb === "implement" && answer?.delivery?.status === "active" ? { review: {} } : {};
|
|
120625
120681
|
const landing = commit ? { landing: { commit, branch: answer?.delivery?.branch ?? "" } } : {};
|
|
120626
120682
|
const session = answer?.agentSession ?? answer?.error?.agentSession;
|
|
120627
|
-
return { ok: true, report: { ...said ? { reply: said } : {}, ...session ? { session } : {}, ...spent, card: id2, ...review ? { review } : {}, ...landing } };
|
|
120683
|
+
return { ok: true, report: { ...said ? { reply: said } : {}, ...session ? { session } : {}, ...spent, card: id2, ...pending, ...review ? { review } : {}, ...landing } };
|
|
120628
120684
|
}
|
|
120629
120685
|
async function discardBuilds() {
|
|
120630
120686
|
const pulled = await pull(ws, deps.machineId);
|
|
@@ -120672,7 +120728,6 @@ function backoffMs(attempt, random = Math.random) {
|
|
|
120672
120728
|
}
|
|
120673
120729
|
|
|
120674
120730
|
// src/recovery.ts
|
|
120675
|
-
var UNCERTAIN = "\u66F4\u65B0\u4E2D\u65AD\u65F6\u6709\u64CD\u4F5C\u7ED3\u679C\u5C1A\u672A\u786E\u8BA4\uFF0C\u8BF7\u68C0\u67E5\u5DF2\u6709\u7ED3\u679C\u540E\u518D\u7EED\u8DD1\u3002";
|
|
120676
120731
|
var fileOf = (id) => path38.join(runnerHome(), "checkpoints", `${encodeURIComponent(id)}.json`);
|
|
120677
120732
|
function readCheckpoint(id) {
|
|
120678
120733
|
try {
|
|
@@ -120707,7 +120762,7 @@ function checkpointEvent(checkpoint, event2) {
|
|
|
120707
120762
|
}
|
|
120708
120763
|
async function stopReply(id, timeout) {
|
|
120709
120764
|
const checkpoint = readCheckpoint(id);
|
|
120710
|
-
if (!checkpoint?.mark) return
|
|
120765
|
+
if (!checkpoint?.mark) return true;
|
|
120711
120766
|
killMarked(checkpoint.mark, checkpoint.process);
|
|
120712
120767
|
const until = Date.now() + timeout;
|
|
120713
120768
|
while (!processesStopped(checkpoint.mark, checkpoint.process)) {
|
|
@@ -120852,11 +120907,11 @@ import { createHash as createHash5 } from "node:crypto";
|
|
|
120852
120907
|
// ../cli/src/lib/shared/reply-parts.ts
|
|
120853
120908
|
function imageMime(bytes2) {
|
|
120854
120909
|
const at2 = (...v) => v.every((n, i) => bytes2[i] === n);
|
|
120855
|
-
const
|
|
120856
|
-
if (bytes2.length >= 24 && at2(137, 80, 78, 71, 13, 10, 26, 10) &&
|
|
120910
|
+
const text4 = (a2, b2) => String.fromCharCode(...bytes2.slice(a2, b2));
|
|
120911
|
+
if (bytes2.length >= 24 && at2(137, 80, 78, 71, 13, 10, 26, 10) && text4(12, 16) === "IHDR" && bytes2.slice(16, 20).some(Boolean) && bytes2.slice(20, 24).some(Boolean)) return "image/png";
|
|
120857
120912
|
if (at2(255, 216, 255)) return "image/jpeg";
|
|
120858
|
-
if (bytes2.length >= 13 && ["GIF87a", "GIF89a"].includes(
|
|
120859
|
-
if (
|
|
120913
|
+
if (bytes2.length >= 13 && ["GIF87a", "GIF89a"].includes(text4(0, 6)) && (bytes2[6] || bytes2[7]) && (bytes2[8] || bytes2[9])) return "image/gif";
|
|
120914
|
+
if (text4(0, 4) === "RIFF" && text4(8, 12) === "WEBP") return "image/webp";
|
|
120860
120915
|
return void 0;
|
|
120861
120916
|
}
|
|
120862
120917
|
|
|
@@ -120903,10 +120958,10 @@ function collectReplyImages(parts, cwd) {
|
|
|
120903
120958
|
bytes2 = Buffer.from(p2.data, "base64");
|
|
120904
120959
|
} else {
|
|
120905
120960
|
if (!p2.path) throw Error();
|
|
120906
|
-
const
|
|
120907
|
-
if (/^[a-z][a-z0-9+.-]*:/i.test(
|
|
120908
|
-
const real = fs36.realpathSync(path39.resolve(cwd,
|
|
120909
|
-
if (!/\.(png|jpe?g|gif|webp)$/i.test(
|
|
120961
|
+
const source2 = p2.path.startsWith("file:") ? fileURLToPath3(p2.path) : decodeURIComponent(p2.path);
|
|
120962
|
+
if (/^[a-z][a-z0-9+.-]*:/i.test(source2) && !/^[A-Za-z]:[\\/]/.test(source2)) throw Error();
|
|
120963
|
+
const real = fs36.realpathSync(path39.resolve(cwd, source2));
|
|
120964
|
+
if (!/\.(png|jpe?g|gif|webp)$/i.test(source2) && !registered.has(real)) throw Error();
|
|
120910
120965
|
if (!roots.some((root2) => inside(root2, real)) && !registered.has(real)) throw Error();
|
|
120911
120966
|
const fd = fs36.openSync(real, fs36.constants.O_RDONLY | (fs36.constants.O_NOFOLLOW ?? 0));
|
|
120912
120967
|
try {
|
|
@@ -121342,14 +121397,14 @@ function taskChatFile(task, home4) {
|
|
|
121342
121397
|
return path43.join(taskChatsDir(home4), `${task}.jsonl`);
|
|
121343
121398
|
}
|
|
121344
121399
|
function readTaskChat(task, home4) {
|
|
121345
|
-
let
|
|
121400
|
+
let text4;
|
|
121346
121401
|
try {
|
|
121347
|
-
|
|
121402
|
+
text4 = fs40.readFileSync(taskChatFile(task, home4), "utf8");
|
|
121348
121403
|
} catch {
|
|
121349
121404
|
return [];
|
|
121350
121405
|
}
|
|
121351
121406
|
const lines = [];
|
|
121352
|
-
for (const raw of
|
|
121407
|
+
for (const raw of text4.split("\n")) {
|
|
121353
121408
|
if (!raw.trim()) continue;
|
|
121354
121409
|
try {
|
|
121355
121410
|
const line = JSON.parse(raw);
|
|
@@ -121526,7 +121581,7 @@ function writeAttachments(job) {
|
|
|
121526
121581
|
Attached files:
|
|
121527
121582
|
${files.map((f2) => `- ${f2}`).join("\n")}`;
|
|
121528
121583
|
}
|
|
121529
|
-
var cut = (
|
|
121584
|
+
var cut = (text4) => text4.length > EVENT_CHARS ? text4.slice(0, EVENT_CHARS) : text4;
|
|
121530
121585
|
function toWire(events, first) {
|
|
121531
121586
|
const out = [];
|
|
121532
121587
|
let log = "";
|
|
@@ -121730,8 +121785,8 @@ function streamOut(deps, id, lease) {
|
|
|
121730
121785
|
}, deps.renewMs);
|
|
121731
121786
|
return {
|
|
121732
121787
|
event: event2,
|
|
121733
|
-
out: (
|
|
121734
|
-
if (
|
|
121788
|
+
out: (text4) => {
|
|
121789
|
+
if (text4) event2({ kind: "log", data: { text: text4 } });
|
|
121735
121790
|
},
|
|
121736
121791
|
adopt: (child) => {
|
|
121737
121792
|
if (child.pid) groups.add(child.pid);
|
|
@@ -121849,12 +121904,6 @@ async function runClaimedStep(job, deps, track, keep2, lease, scope, replyStream
|
|
|
121849
121904
|
return finish(deps, id, lease, outcome, reason, report2);
|
|
121850
121905
|
};
|
|
121851
121906
|
const replay = job.manualRecovery === true && !!previous && replayable(previous) || job.retryReplay === true && (!local || replayable(local)) || !!previous?.retry?.at && replayable(previous);
|
|
121852
|
-
if (reply && job.recoveryOf && !previous && !replay) {
|
|
121853
|
-
return finishClaimed("failed", "recovery_unsafe");
|
|
121854
|
-
}
|
|
121855
|
-
if (job.manualRecovery && (!previous && !replay || previous && !replayable(previous) && (previous.effects === void 0 || previous.pending.length || previous.opaque || !previous.session))) {
|
|
121856
|
-
return finishClaimed("failed", "recovery_unsafe");
|
|
121857
|
-
}
|
|
121858
121907
|
if (job.manualRecovery && !local) checkpoint.retry = void 0;
|
|
121859
121908
|
if (reply) checkpoint.retry ??= { since: Date.now(), attempt: 1 };
|
|
121860
121909
|
const recovering = checkpoint.updating === true || !!job.recoveryOf;
|
|
@@ -121868,10 +121917,6 @@ async function runClaimedStep(job, deps, track, keep2, lease, scope, replyStream
|
|
|
121868
121917
|
delete checkpoint.attempts;
|
|
121869
121918
|
}
|
|
121870
121919
|
checkpoint.session ??= job.resume ?? void 0;
|
|
121871
|
-
if (recovering && !checkpoint.completed && (checkpoint.pending.length || checkpoint.opaque || !job.flow && checkpoint.started && !checkpoint.session && !replay)) {
|
|
121872
|
-
saveCheckpoint(id, checkpoint);
|
|
121873
|
-
return finishClaimed("failed", job.recoveryOf ? "recovery_failed" : UNCERTAIN);
|
|
121874
|
-
}
|
|
121875
121920
|
if (reply && previous?.started && checkpoint.completed?.outcome !== "done" && !await stopReply(readCheckpoint(id) ? id : job.recoveryOf ?? id, deps.stopMs)) {
|
|
121876
121921
|
return finishClaimed("failed", "recovery_unsafe");
|
|
121877
121922
|
}
|
|
@@ -121945,7 +121990,7 @@ async function runClaimedStep(job, deps, track, keep2, lease, scope, replyStream
|
|
|
121945
121990
|
if (!sent.ok) return sent;
|
|
121946
121991
|
if (!replyAssetsSynced(folder2)) return { ok: false, error: "Preview uploads are still pending." };
|
|
121947
121992
|
return previewOperation(deps.machineId, id, agent, fields);
|
|
121948
|
-
}));
|
|
121993
|
+
}), folder2.number ?? void 0);
|
|
121949
121994
|
scope.bridge = await replyApprovalBridge(job.task, job.number, (comment, asked) => withBoard(folder2, async (send3) => {
|
|
121950
121995
|
if (checkpoint.approvalCancelled) return { ok: false, error: "This reply failed before. Ask again in a new reply." };
|
|
121951
121996
|
const pushed = await send3({ id, machineId: deps.machineId });
|
|
@@ -122276,10 +122321,10 @@ ${prompt}` : prompt;
|
|
|
122276
122321
|
backgroundError = backgroundWaitMessage(BACKGROUND_WAIT.minutes);
|
|
122277
122322
|
stop(child);
|
|
122278
122323
|
});
|
|
122279
|
-
const fromAgent = (
|
|
122324
|
+
const fromAgent = (text4) => {
|
|
122280
122325
|
if (!structured) {
|
|
122281
|
-
if (
|
|
122282
|
-
stream.out(
|
|
122326
|
+
if (text4.trim()) acted = true;
|
|
122327
|
+
stream.out(text4);
|
|
122283
122328
|
}
|
|
122284
122329
|
if (attempt) measure(report(job, plan3));
|
|
122285
122330
|
for (const e2 of renderer2.events?.() ?? []) {
|
|
@@ -122405,7 +122450,7 @@ var replyReason = (reason, job) => {
|
|
|
122405
122450
|
if (job.sessionFallback && !/auth|login|log.in|permission|directory|ENOENT|not installed|rate.limit|network|connect|登录|权限|目录/i.test(reason)) return "session_unavailable";
|
|
122406
122451
|
return reason;
|
|
122407
122452
|
};
|
|
122408
|
-
var sessionMissing = (
|
|
122453
|
+
var sessionMissing = (text4) => !/auth|unauthorized|forbidden|login|log.in|登录|权限/i.test(text4) && (/\b(?:session|conversation|thread)\b[^\n]*(?:\bnot found\b|\bdoes not exist\b)/i.test(text4) || /\bno (?:conversation|session|thread) found\b/i.test(text4));
|
|
122409
122454
|
function launch(command, args2, options) {
|
|
122410
122455
|
const start = spawnable(command, args2, options);
|
|
122411
122456
|
return spawn4(start.command, start.args, start.options);
|
|
@@ -122569,7 +122614,7 @@ function report(job, run3, turn2) {
|
|
|
122569
122614
|
...context?.used !== void 0 && limit ? { context: { used: context.used, limit } } : {}
|
|
122570
122615
|
};
|
|
122571
122616
|
}
|
|
122572
|
-
var cutShort = (said,
|
|
122617
|
+
var cutShort = (said, text4) => ({ ...said, reply: said.reply || text4 || void 0, stopped: true });
|
|
122573
122618
|
function folderLines(ws) {
|
|
122574
122619
|
if (!ws) return "";
|
|
122575
122620
|
const undrawn2 = undrawnPreviews(ws);
|