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
package/dist/runner.mjs
CHANGED
|
@@ -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${`${random2(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, all2) {
|
|
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 all2 ? [] : 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 = path36.extname(at2) ? [at2] : [...CODE_EXTS.map((e2) => at2 + e2), ...CODE_EXTS.map((e2) => path36.join(at2, `index${e2}`))];
|
|
110886
110886
|
const file3 = tries.find((f2) => fs32.statSync(f2, { throwIfNoEntry: false })?.isFile());
|
|
110887
110887
|
if (!file3) throw new Error(`no such file: ${id}`);
|
|
110888
|
+
if (!fs32.realpathSync(file3).startsWith(fs32.realpathSync(folder) + path36.sep)) throw new Error(`${id} is outside the mockup's folder`);
|
|
110888
110889
|
return file3;
|
|
110889
110890
|
}
|
|
110890
110891
|
async function readGraph(entry) {
|
|
@@ -110923,14 +110924,15 @@ function run2(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 ? path36.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 = path36.resolve(from, id);
|
|
110935
|
+
if (!fs32.realpathSync(at2).startsWith(fs32.realpathSync(folder) + path36.sep)) throw new Error(`${id} is outside the mockup's folder`);
|
|
110934
110936
|
return { path: at2, base: path36.dirname(at2), content: fs32.readFileSync(at2, "utf8") };
|
|
110935
110937
|
}
|
|
110936
110938
|
});
|
|
@@ -110980,7 +110982,7 @@ ${graph.code.get(file3)}
|
|
|
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 = run2("__draw()", context, entry, deadline);
|
|
110983
|
-
const css = (await tailwindFor(markup, graph.sheets)).replace(/<\/style/gi, "<\\/style");
|
|
110985
|
+
const css = (await tailwindFor(markup, graph.sheets, path36.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;
|
|
@@ -112160,9 +112162,9 @@ function status(line) {
|
|
|
112160
112162
|
}
|
|
112161
112163
|
|
|
112162
112164
|
// src/protocol.ts
|
|
112163
|
-
var VERSION = true ? "0.6.
|
|
112164
|
-
var AKB_VERSION = true ? "0.11.
|
|
112165
|
-
var AKB_CONTRACT = true ?
|
|
112165
|
+
var VERSION = true ? "0.6.71" : "0.0.0";
|
|
112166
|
+
var AKB_VERSION = true ? "0.11.58" : "0.0.0";
|
|
112167
|
+
var AKB_CONTRACT = true ? 16 : 0;
|
|
112166
112168
|
var EXIT_REFUSED = 10;
|
|
112167
112169
|
var EXIT_OUTDATED = 11;
|
|
112168
112170
|
var EXIT_UPDATE = 12;
|
|
@@ -112236,13 +112238,13 @@ function cmdArg(arg) {
|
|
|
112236
112238
|
function cmdLine(file3, args2) {
|
|
112237
112239
|
return `"${[file3.replace(META, "^$1"), ...args2.map(cmdArg)].join(" ")}"`;
|
|
112238
112240
|
}
|
|
112239
|
-
function shimTarget(
|
|
112241
|
+
function shimTarget(text4, file3) {
|
|
112240
112242
|
const dir = path4.win32.dirname(file3);
|
|
112241
|
-
const found = /"%(?:~dp0|dp0%)\\?([^"%]+)"\s+%\*/i.exec(
|
|
112242
|
-
if (!found || !/\\node\.exe"/i.test(
|
|
112243
|
+
const found = /"%(?:~dp0|dp0%)\\?([^"%]+)"\s+%\*/i.exec(text4);
|
|
112244
|
+
if (!found || !/\\node\.exe"/i.test(text4)) return null;
|
|
112243
112245
|
const script = path4.win32.resolve(dir, found[1].replace(/\//g, "\\"));
|
|
112244
112246
|
const local = path4.win32.join(dir, "node.exe");
|
|
112245
|
-
const nodePath = /SET "NODE_PATH=([^"]*)"/i.exec(
|
|
112247
|
+
const nodePath = /SET "NODE_PATH=([^"]*)"/i.exec(text4)?.[1];
|
|
112246
112248
|
return { script, node: fs3.existsSync(local) ? local : "node", env: nodePath ? { NODE_PATH: nodePath } : {} };
|
|
112247
112249
|
}
|
|
112248
112250
|
function onWindowsPath(name, env2) {
|
|
@@ -112263,12 +112265,12 @@ function spawnable(command, args2, options = {}, platform = process.platform) {
|
|
|
112263
112265
|
const ext = path4.extname(file3).toLowerCase();
|
|
112264
112266
|
const hidden = { ...options, windowsHide: true, shell: false };
|
|
112265
112267
|
if (ext !== ".cmd" && ext !== ".bat") return { command: file3, args: args2, options: hidden };
|
|
112266
|
-
let
|
|
112268
|
+
let text4 = "";
|
|
112267
112269
|
try {
|
|
112268
|
-
|
|
112270
|
+
text4 = fs3.readFileSync(file3, "utf8");
|
|
112269
112271
|
} catch {
|
|
112270
112272
|
}
|
|
112271
|
-
const shim = shimTarget(
|
|
112273
|
+
const shim = shimTarget(text4, file3);
|
|
112272
112274
|
if (shim) {
|
|
112273
112275
|
return { command: shim.node, args: [shim.script, ...args2], options: { ...hidden, env: { ...env2, ...shim.env } } };
|
|
112274
112276
|
}
|
|
@@ -112579,15 +112581,15 @@ var MCP_CONFIG = {
|
|
|
112579
112581
|
placeholder: "/path/to/mcp.json",
|
|
112580
112582
|
help: "A JSON file of `mcpServers`, as Claude Code's --mcp-config takes. Empty opens no servers."
|
|
112581
112583
|
};
|
|
112582
|
-
function machineFile(name,
|
|
112583
|
-
const suffix = createHash("sha256").update(
|
|
112584
|
+
function machineFile(name, text4) {
|
|
112585
|
+
const suffix = createHash("sha256").update(text4).digest("hex").slice(0, 16);
|
|
112584
112586
|
const file3 = path6.join(machineHome(), "prompts", `${path6.parse(name).name}-${suffix}${path6.extname(name)}`);
|
|
112585
112587
|
try {
|
|
112586
|
-
if (fs5.readFileSync(file3, "utf8") ===
|
|
112588
|
+
if (fs5.readFileSync(file3, "utf8") === text4) return file3;
|
|
112587
112589
|
} catch {
|
|
112588
112590
|
}
|
|
112589
112591
|
fs5.mkdirSync(path6.dirname(file3), { recursive: true });
|
|
112590
|
-
fs5.writeFileSync(file3,
|
|
112592
|
+
fs5.writeFileSync(file3, text4);
|
|
112591
112593
|
return file3;
|
|
112592
112594
|
}
|
|
112593
112595
|
|
|
@@ -112605,15 +112607,15 @@ function isLanguage(value) {
|
|
|
112605
112607
|
// ../cli/src/lib/machine/settings.ts
|
|
112606
112608
|
var settingsFile = () => path7.join(machineHome(), "settings.json");
|
|
112607
112609
|
function heldSettings() {
|
|
112608
|
-
let
|
|
112610
|
+
let text4;
|
|
112609
112611
|
try {
|
|
112610
|
-
|
|
112612
|
+
text4 = fs6.readFileSync(settingsFile(), "utf8");
|
|
112611
112613
|
} catch (err) {
|
|
112612
112614
|
if (err.code === "ENOENT") return { unreadable: false, values: {} };
|
|
112613
112615
|
return { unreadable: true, values: {} };
|
|
112614
112616
|
}
|
|
112615
112617
|
try {
|
|
112616
|
-
const parsed = JSON.parse(
|
|
112618
|
+
const parsed = JSON.parse(text4);
|
|
112617
112619
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return { unreadable: true, values: {} };
|
|
112618
112620
|
return { unreadable: false, values: parsed };
|
|
112619
112621
|
} catch {
|
|
@@ -112638,7 +112640,7 @@ var systemLanguages = /* @__PURE__ */ new Set([
|
|
|
112638
112640
|
"\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",
|
|
112639
112641
|
"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."
|
|
112640
112642
|
]);
|
|
112641
|
-
var isSystemLanguage = (
|
|
112643
|
+
var isSystemLanguage = (text4) => systemLanguages.has(text4);
|
|
112642
112644
|
var legacy = /* @__PURE__ */ new Map([
|
|
112643
112645
|
["\u8BF7\u7528\u4E2D\u6587\u56DE\u590D\u548C\u5199\u4F5C\u3002", "zh"],
|
|
112644
112646
|
["Reply and write in English.", "en"]
|
|
@@ -112786,9 +112788,9 @@ function createEventCollector() {
|
|
|
112786
112788
|
}
|
|
112787
112789
|
},
|
|
112788
112790
|
/** A whole message, for a source that never sends one in pieces. */
|
|
112789
|
-
message(
|
|
112791
|
+
message(text4) {
|
|
112790
112792
|
close();
|
|
112791
|
-
if (
|
|
112793
|
+
if (text4.trim()) queue.push({ kind: "message", data: { text: text4.trim() } });
|
|
112792
112794
|
},
|
|
112793
112795
|
toolCall(toolCallId, title, kind, target) {
|
|
112794
112796
|
close();
|
|
@@ -112824,13 +112826,13 @@ function createEventCollector() {
|
|
|
112824
112826
|
todos = next;
|
|
112825
112827
|
queue.push({ kind: "plan", data: { entries: todos.map(({ id: _2, ...e2 }) => e2) } });
|
|
112826
112828
|
},
|
|
112827
|
-
log(
|
|
112829
|
+
log(text4) {
|
|
112828
112830
|
close();
|
|
112829
|
-
if (
|
|
112831
|
+
if (text4.trim()) queue.push({ kind: "log", data: { text: text4 } });
|
|
112830
112832
|
},
|
|
112831
|
-
error(
|
|
112833
|
+
error(text4) {
|
|
112832
112834
|
close();
|
|
112833
|
-
if (
|
|
112835
|
+
if (text4.trim()) queue.push({ kind: "error", data: { text: text4.trim() } });
|
|
112834
112836
|
},
|
|
112835
112837
|
/** The turn is over: a half-held message is finished off. */
|
|
112836
112838
|
end() {
|
|
@@ -112949,15 +112951,15 @@ function createAntigravityRenderer(expectedSession) {
|
|
|
112949
112951
|
session = str2(step.conversation_id) || session;
|
|
112950
112952
|
const id = String(step.step_index ?? "");
|
|
112951
112953
|
if (step.step_type === "agent_response") {
|
|
112952
|
-
const
|
|
112953
|
-
if (
|
|
112954
|
+
const text4 = str2(step.text_delta);
|
|
112955
|
+
if (text4) events.update({ sessionUpdate: "agent_message_chunk", content: { text: text4 } });
|
|
112954
112956
|
const index = num2(step.step_index);
|
|
112955
112957
|
if (step.state === "DONE" && step.usage && !counted.has(index)) {
|
|
112956
112958
|
counted.add(index);
|
|
112957
112959
|
turnUsage = add(turnUsage, usageOf(step.usage));
|
|
112958
112960
|
used = turnUsage;
|
|
112959
112961
|
}
|
|
112960
|
-
return
|
|
112962
|
+
return text4;
|
|
112961
112963
|
}
|
|
112962
112964
|
if (step.step_type === "tool") {
|
|
112963
112965
|
const tool = obj2(step.tool_info);
|
|
@@ -113013,10 +113015,10 @@ function createAntigravityRenderer(expectedSession) {
|
|
|
113013
113015
|
return {
|
|
113014
113016
|
push: reader.push,
|
|
113015
113017
|
flush() {
|
|
113016
|
-
const
|
|
113018
|
+
const text4 = reader.flush();
|
|
113017
113019
|
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.");
|
|
113018
113020
|
events.end();
|
|
113019
|
-
return
|
|
113021
|
+
return text4;
|
|
113020
113022
|
},
|
|
113021
113023
|
stderr(chunk) {
|
|
113022
113024
|
stderr = (stderr + chunk).slice(-16e3);
|
|
@@ -113077,8 +113079,8 @@ var ANTIGRAVITY = {
|
|
|
113077
113079
|
const at2 = argv.indexOf("--conversation");
|
|
113078
113080
|
return createAntigravityRenderer(at2 >= 0 ? argv[at2 + 1] : argv.find((a2) => a2.startsWith("--conversation="))?.slice(15));
|
|
113079
113081
|
},
|
|
113080
|
-
systemPrompt(
|
|
113081
|
-
const rule = `${
|
|
113082
|
+
systemPrompt(text4, _argv, env2) {
|
|
113083
|
+
const rule = `${text4}
|
|
113082
113084
|
|
|
113083
113085
|
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.`;
|
|
113084
113086
|
const hash = createHash2("sha256").update(rule).digest("hex").slice(0, 16);
|
|
@@ -113638,7 +113640,7 @@ function childSpend(ids, since) {
|
|
|
113638
113640
|
}
|
|
113639
113641
|
|
|
113640
113642
|
// ../cli/src/lib/agent/wire/codex-stream.ts
|
|
113641
|
-
var imageSafeText = (
|
|
113643
|
+
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]");
|
|
113642
113644
|
function renderStarted(item) {
|
|
113643
113645
|
switch (item.type) {
|
|
113644
113646
|
case "command_execution":
|
|
@@ -114025,10 +114027,10 @@ function readKimiRunFacts(sessionId) {
|
|
|
114025
114027
|
// ../cli/src/lib/agent/wire/kimi-stream.ts
|
|
114026
114028
|
var ARG_KEYS2 = ["command", "path", "pattern", "query", "url", "prompt", "prompt_template", "description"];
|
|
114027
114029
|
function callArgs(raw) {
|
|
114028
|
-
const
|
|
114029
|
-
if (!
|
|
114030
|
+
const text4 = str2(raw);
|
|
114031
|
+
if (!text4.trim()) return {};
|
|
114030
114032
|
try {
|
|
114031
|
-
return JSON.parse(
|
|
114033
|
+
return JSON.parse(text4);
|
|
114032
114034
|
} catch {
|
|
114033
114035
|
return {};
|
|
114034
114036
|
}
|
|
@@ -114104,9 +114106,9 @@ function createKimiStreamRenderer(cwd, resumeId) {
|
|
|
114104
114106
|
return row.type === "turn.step.retrying" ? retry(row) : "";
|
|
114105
114107
|
case "tool": {
|
|
114106
114108
|
const id = str2(row.tool_call_id);
|
|
114107
|
-
const
|
|
114108
|
-
if (subagents.delete(id)) events.toolResult(id, /^status: completed$/m.test(
|
|
114109
|
-
else events.toolResult(id, "completed",
|
|
114109
|
+
const text4 = str2(row.content);
|
|
114110
|
+
if (subagents.delete(id)) events.toolResult(id, /^status: completed$/m.test(text4) ? "completed" : "failed", "");
|
|
114111
|
+
else events.toolResult(id, "completed", text4);
|
|
114110
114112
|
return "";
|
|
114111
114113
|
}
|
|
114112
114114
|
default:
|
|
@@ -114304,9 +114306,9 @@ function createTail(log) {
|
|
|
114304
114306
|
log(chunk);
|
|
114305
114307
|
},
|
|
114306
114308
|
/** One line about something that isn't the agent talking. */
|
|
114307
|
-
line(
|
|
114309
|
+
line(text4) {
|
|
114308
114310
|
close();
|
|
114309
|
-
log(`${
|
|
114311
|
+
log(`${text4}
|
|
114310
114312
|
`);
|
|
114311
114313
|
},
|
|
114312
114314
|
/** End of the turn: whatever is half-written is finished off. */
|
|
@@ -114320,8 +114322,8 @@ function createTail(log) {
|
|
|
114320
114322
|
// ../cli/package.json
|
|
114321
114323
|
var package_default = {
|
|
114322
114324
|
name: "wildcrane",
|
|
114323
|
-
version: "0.11.
|
|
114324
|
-
akbContract:
|
|
114325
|
+
version: "0.11.58",
|
|
114326
|
+
akbContract: 16,
|
|
114325
114327
|
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.",
|
|
114326
114328
|
keywords: [
|
|
114327
114329
|
"kanban",
|
|
@@ -114399,8 +114401,8 @@ function saidBy(update3) {
|
|
|
114399
114401
|
const content = Array.isArray(update3.content) ? update3.content : [];
|
|
114400
114402
|
for (const raw of content) {
|
|
114401
114403
|
const part = obj2(raw);
|
|
114402
|
-
const
|
|
114403
|
-
if (
|
|
114404
|
+
const text4 = str2(obj2(part.content).text) || str2(part.text);
|
|
114405
|
+
if (text4.trim()) return text4.trim();
|
|
114404
114406
|
}
|
|
114405
114407
|
return "";
|
|
114406
114408
|
}
|
|
@@ -114703,11 +114705,11 @@ function createParts(tail) {
|
|
|
114703
114705
|
const written = /* @__PURE__ */ new Map();
|
|
114704
114706
|
const tools = /* @__PURE__ */ new Set();
|
|
114705
114707
|
const named = /* @__PURE__ */ new Map();
|
|
114706
|
-
const say = (partId, kind,
|
|
114708
|
+
const say = (partId, kind, text4) => {
|
|
114707
114709
|
const before = written.get(partId) ?? "";
|
|
114708
|
-
const fresh =
|
|
114710
|
+
const fresh = text4.startsWith(before) ? text4.slice(before.length) : text4;
|
|
114709
114711
|
if (!fresh) return;
|
|
114710
|
-
written.set(partId,
|
|
114712
|
+
written.set(partId, text4);
|
|
114711
114713
|
if (kind === "reasoning" || kind === "thought") tail.thought(fresh);
|
|
114712
114714
|
else tail.text(fresh);
|
|
114713
114715
|
};
|
|
@@ -115221,9 +115223,6 @@ var canonicalSpecAgent = (name) => {
|
|
|
115221
115223
|
return LEGACY_SPEC_AGENT_NAMES[asked] ?? asked;
|
|
115222
115224
|
};
|
|
115223
115225
|
|
|
115224
|
-
// ../cli/src/lib/agent/types.ts
|
|
115225
|
-
var NOT_COMPLETED = "The delivery has not recorded completion.";
|
|
115226
|
-
|
|
115227
115226
|
// ../cli/src/lib/agent/settings.ts
|
|
115228
115227
|
var BACKGROUND_WAIT = { minutes: 120 };
|
|
115229
115228
|
|
|
@@ -115404,7 +115403,7 @@ async function run(io, options, tasks) {
|
|
|
115404
115403
|
status: raw.status === "inProgress" ? "in_progress" : raw.status
|
|
115405
115404
|
} });
|
|
115406
115405
|
};
|
|
115407
|
-
const start = async (
|
|
115406
|
+
const start = async (text4, images = []) => {
|
|
115408
115407
|
active = true;
|
|
115409
115408
|
waiting = false;
|
|
115410
115409
|
submitted = true;
|
|
@@ -115414,7 +115413,7 @@ async function run(io, options, tasks) {
|
|
|
115414
115413
|
startupTimer = setTimeout(() => {
|
|
115415
115414
|
if (!started) io.event?.({ kind: "log", data: { text: "[conversation] start_unconfirmed" } });
|
|
115416
115415
|
}, CONVERSATION_MS.start);
|
|
115417
|
-
await bounded(rpc.call("turn/start", { threadId, input: [{ type: "text", text:
|
|
115416
|
+
await bounded(rpc.call("turn/start", { threadId, input: [{ type: "text", text: text4 }, ...images.map((path58) => ({ type: "localImage", path: path58 }))] }), CONVERSATION_MS.start, "Codex turn/start timed out; submission outcome is unknown.").catch((error) => {
|
|
115418
115417
|
if (!started) throw error;
|
|
115419
115418
|
});
|
|
115420
115419
|
};
|
|
@@ -115610,22 +115609,22 @@ var PASSING = [
|
|
|
115610
115609
|
];
|
|
115611
115610
|
var RETRY_AFTER = /retry[-_\s]?after["':=\s]+(\d+)/i;
|
|
115612
115611
|
var REASON_MAX = 140;
|
|
115613
|
-
function reasonLine(
|
|
115614
|
-
const line =
|
|
115612
|
+
function reasonLine(text4, rule) {
|
|
115613
|
+
const line = text4.split("\n").find((l2) => rule.test(l2.toLowerCase())) ?? text4;
|
|
115615
115614
|
const said = line.trim().replace(/\s+/g, " ");
|
|
115616
115615
|
return said.length > REASON_MAX ? `${said.slice(0, REASON_MAX - 1)}\u2026` : said;
|
|
115617
115616
|
}
|
|
115618
115617
|
function providerBlip(...said) {
|
|
115619
|
-
for (const
|
|
115620
|
-
if (!
|
|
115621
|
-
const lower =
|
|
115618
|
+
for (const text4 of said) {
|
|
115619
|
+
if (!text4?.trim()) continue;
|
|
115620
|
+
const lower = text4.toLowerCase();
|
|
115622
115621
|
if (MANUAL.some((rule) => rule.test(lower))) return void 0;
|
|
115623
115622
|
const hit = PASSING.find((rule) => rule.test(lower));
|
|
115624
115623
|
if (!hit) continue;
|
|
115625
|
-
const asked = RETRY_AFTER.exec(
|
|
115624
|
+
const asked = RETRY_AFTER.exec(text4);
|
|
115626
115625
|
const seconds = asked ? Number(asked[1]) : NaN;
|
|
115627
115626
|
return {
|
|
115628
|
-
reason: reasonLine(
|
|
115627
|
+
reason: reasonLine(text4, hit),
|
|
115629
115628
|
...Number.isFinite(seconds) && seconds > 0 ? { retryAfterMs: seconds * 1e3 } : {}
|
|
115630
115629
|
};
|
|
115631
115630
|
}
|
|
@@ -115685,11 +115684,11 @@ var CLAUDE_CODE = {
|
|
|
115685
115684
|
return [...claudeStreamArgs(argv), "--resume", resumeId, "--fork-session", "--session-id", sessionId];
|
|
115686
115685
|
},
|
|
115687
115686
|
// 默认快照会忽略续跑传入的新规则;仅显式关闭快照的会话支持更新。
|
|
115688
|
-
systemPrompt(
|
|
115687
|
+
systemPrompt(text4, argv) {
|
|
115689
115688
|
if (namesFlag(argv, ["--append-system-prompt", "--append-system-prompt-file"])) return {};
|
|
115690
115689
|
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);
|
|
115691
115690
|
if (namesFlag(argv, ["--resume", "-r", "--continue", "-c"]) && snapshot !== "off") return {};
|
|
115692
|
-
return { args: ["--append-system-prompt",
|
|
115691
|
+
return { args: ["--append-system-prompt", text4] };
|
|
115693
115692
|
},
|
|
115694
115693
|
// What Claude Code takes: who pays for the run, where that run goes, a model id, and how
|
|
115695
115694
|
// hard that model thinks. The provider comes first because it decides the rest — which
|
|
@@ -116081,14 +116080,14 @@ var CODEX = {
|
|
|
116081
116080
|
return [...codexExtraArgs(argv, cwd), "fork", resumeId];
|
|
116082
116081
|
},
|
|
116083
116082
|
// 自设系统指令保持原样;无法追加时由调用方明确提示。
|
|
116084
|
-
systemPrompt(
|
|
116083
|
+
systemPrompt(text4, argv) {
|
|
116085
116084
|
if (namesFlag(argv, ["developer_instructions", "model_instructions_file"])) return {};
|
|
116086
116085
|
try {
|
|
116087
116086
|
const config = fs12.readFileSync(path15.join(process.env.CODEX_HOME || home(".codex"), "config.toml"), "utf8");
|
|
116088
116087
|
if (/^\s*(?:developer_instructions|model_instructions_file)\s*=/m.test(config)) return {};
|
|
116089
116088
|
} catch {
|
|
116090
116089
|
}
|
|
116091
|
-
return { args: ["-c", `developer_instructions=${JSON.stringify(
|
|
116090
|
+
return { args: ["-c", `developer_instructions=${JSON.stringify(text4)}`] };
|
|
116092
116091
|
},
|
|
116093
116092
|
// What Codex takes, in the order Claude Code's dialog draws the same four: who pays for
|
|
116094
116093
|
// the run and where it goes, that endpoint's address, the key, a model, and how hard that
|
|
@@ -116411,11 +116410,11 @@ var DSH = {
|
|
|
116411
116410
|
// dsh-acp's persona IS its system prompt, so the ask is added to the one in effect: the
|
|
116412
116411
|
// user's own `DSH_SYSTEM_PROMPT`, else the bridge's default. A `--persona` on the command
|
|
116413
116412
|
// line outranks both, and is left alone.
|
|
116414
|
-
systemPrompt(
|
|
116413
|
+
systemPrompt(text4, argv, env2) {
|
|
116415
116414
|
if (namesFlag(argv, ["--persona"])) return {};
|
|
116416
116415
|
return { env: { DSH_SYSTEM_PROMPT: `${env2.DSH_SYSTEM_PROMPT || DSH_PERSONA}
|
|
116417
116416
|
|
|
116418
|
-
${
|
|
116417
|
+
${text4}` } };
|
|
116419
116418
|
},
|
|
116420
116419
|
// ACP carries all three in the conversation itself (agent/wire/acp.ts), so a dsh run shows a
|
|
116421
116420
|
// price, its tokens and the model the session opened on.
|
|
@@ -116466,8 +116465,8 @@ var GROK = {
|
|
|
116466
116465
|
return [];
|
|
116467
116466
|
},
|
|
116468
116467
|
// `--rules` appends to Grok's system prompt. A top-level option, so it goes before `agent`.
|
|
116469
|
-
systemPrompt(
|
|
116470
|
-
return namesFlag(argv, ["--rules"]) ? {} : { args: ["--rules",
|
|
116468
|
+
systemPrompt(text4, argv) {
|
|
116469
|
+
return namesFlag(argv, ["--rules"]) ? {} : { args: ["--rules", text4] };
|
|
116471
116470
|
},
|
|
116472
116471
|
// What Grok takes: a model, and the xAI key. Both boxes can stay empty — someone already
|
|
116473
116472
|
// set up with grok has a login in `~/.grok` and a default model in its own
|
|
@@ -116574,7 +116573,7 @@ var KIMI = {
|
|
|
116574
116573
|
},
|
|
116575
116574
|
// An agent file wrapping Kimi's own prompt in `${base_prompt}`. Only a new session takes one;
|
|
116576
116575
|
// a resumed one keeps the agent it opened with, and Kimi refuses the flag beside `--session`.
|
|
116577
|
-
systemPrompt(
|
|
116576
|
+
systemPrompt(text4, argv) {
|
|
116578
116577
|
if (namesFlag(argv, ["--session", "-S", "--resume", "-r", "--continue", "-C", "--agent", "--agent-file"])) return {};
|
|
116579
116578
|
const file3 = machineFile("kimi-language.md", `---
|
|
116580
116579
|
name: akb-language
|
|
@@ -116583,7 +116582,7 @@ description: Kimi's default agent, told which language to write in
|
|
|
116583
116582
|
|
|
116584
116583
|
\${base_prompt}
|
|
116585
116584
|
|
|
116586
|
-
${
|
|
116585
|
+
${text4}
|
|
116587
116586
|
`);
|
|
116588
116587
|
return { args: ["--agent-file", file3] };
|
|
116589
116588
|
},
|
|
@@ -116807,8 +116806,8 @@ var OPENCODE = {
|
|
|
116807
116806
|
env: () => ({ ...process.env }),
|
|
116808
116807
|
// `instructions` files join the system prompt, and OpenCode adds this config's list to the
|
|
116809
116808
|
// user's own rather than replacing it.
|
|
116810
|
-
systemPrompt(
|
|
116811
|
-
const file3 = machineFile("opencode-language.md", `${
|
|
116809
|
+
systemPrompt(text4, _argv, env2) {
|
|
116810
|
+
const file3 = machineFile("opencode-language.md", `${text4}
|
|
116812
116811
|
`);
|
|
116813
116812
|
let own2 = {};
|
|
116814
116813
|
try {
|
|
@@ -117078,9 +117077,9 @@ function languageEnv(given) {
|
|
|
117078
117077
|
}
|
|
117079
117078
|
function withSystemLanguage(harness, argv, env2, language) {
|
|
117080
117079
|
env2 = languageEnv(env2);
|
|
117081
|
-
const
|
|
117082
|
-
if (!
|
|
117083
|
-
const added = argv.length ? harness.systemPrompt?.(
|
|
117080
|
+
const text4 = systemLanguage(language);
|
|
117081
|
+
if (!text4) return { argv, env: env2 };
|
|
117082
|
+
const added = argv.length ? harness.systemPrompt?.(text4, argv, env2) : void 0;
|
|
117084
117083
|
if (!added?.args?.length && !Object.keys(added?.env ?? {}).length) {
|
|
117085
117084
|
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.";
|
|
117086
117085
|
return { argv, env: env2, note };
|
|
@@ -118077,7 +118076,7 @@ var quote = (s) => /^[\w./:@=-]+$/.test(s) ? s : `"${s}"`;
|
|
|
118077
118076
|
function shimDir(akb) {
|
|
118078
118077
|
const dir = akb.shim;
|
|
118079
118078
|
const line = [akb.command, ...akb.args].map(quote).join(" ");
|
|
118080
|
-
const [file3,
|
|
118079
|
+
const [file3, text4] = process.platform === "win32" ? [path23.join(dir, "akb.cmd"), `@${line} %*\r
|
|
118081
118080
|
`] : [path23.join(dir, "akb"), `#!/bin/sh
|
|
118082
118081
|
exec ${line} "$@"
|
|
118083
118082
|
`];
|
|
@@ -118089,11 +118088,11 @@ exec ${shellLine} "$@"
|
|
|
118089
118088
|
`, { mode: 493 });
|
|
118090
118089
|
}
|
|
118091
118090
|
try {
|
|
118092
|
-
if (fs19.readFileSync(file3, "utf8") ===
|
|
118091
|
+
if (fs19.readFileSync(file3, "utf8") === text4) return dir;
|
|
118093
118092
|
} catch {
|
|
118094
118093
|
}
|
|
118095
118094
|
fs19.mkdirSync(dir, { recursive: true });
|
|
118096
|
-
fs19.writeFileSync(file3,
|
|
118095
|
+
fs19.writeFileSync(file3, text4, { mode: 493 });
|
|
118097
118096
|
return dir;
|
|
118098
118097
|
}
|
|
118099
118098
|
function akbEnv(akb, board, task, language, base = process.env) {
|
|
@@ -118115,8 +118114,8 @@ function runAkb(akb, args2, opts) {
|
|
|
118115
118114
|
return new Promise((resolve2) => {
|
|
118116
118115
|
let out = "";
|
|
118117
118116
|
let last2 = "";
|
|
118118
|
-
const note = (
|
|
118119
|
-
const line =
|
|
118117
|
+
const note = (text4) => {
|
|
118118
|
+
const line = text4.split("\n").map((l2) => l2.trim()).filter(Boolean).at(-1);
|
|
118120
118119
|
if (line) last2 = line;
|
|
118121
118120
|
};
|
|
118122
118121
|
let child;
|
|
@@ -118297,24 +118296,24 @@ function readIcon(raw) {
|
|
|
118297
118296
|
|
|
118298
118297
|
// ../cli/src/lib/yaml.ts
|
|
118299
118298
|
function yamlScalar(s) {
|
|
118300
|
-
const
|
|
118301
|
-
if (
|
|
118302
|
-
if (/^[-?:,[\]{}#&*!|>'"%@`]/.test(
|
|
118303
|
-
return JSON.stringify(
|
|
118299
|
+
const text4 = String(s);
|
|
118300
|
+
if (text4 === "") return '""';
|
|
118301
|
+
if (/^[-?:,[\]{}#&*!|>'"%@`]/.test(text4) || /:\s/.test(text4) || /[\n"]/.test(text4) || /^\s|\s$/.test(text4)) {
|
|
118302
|
+
return JSON.stringify(text4);
|
|
118304
118303
|
}
|
|
118305
|
-
return
|
|
118304
|
+
return text4;
|
|
118306
118305
|
}
|
|
118307
118306
|
function unquote2(v) {
|
|
118308
|
-
const
|
|
118309
|
-
if (
|
|
118307
|
+
const text4 = String(v).trim();
|
|
118308
|
+
if (text4.startsWith('"') && text4.endsWith('"')) {
|
|
118310
118309
|
try {
|
|
118311
|
-
return JSON.parse(
|
|
118310
|
+
return JSON.parse(text4);
|
|
118312
118311
|
} catch {
|
|
118313
|
-
return
|
|
118312
|
+
return text4.slice(1, -1);
|
|
118314
118313
|
}
|
|
118315
118314
|
}
|
|
118316
|
-
if (
|
|
118317
|
-
return
|
|
118315
|
+
if (text4.startsWith("'") && text4.endsWith("'")) return text4.slice(1, -1);
|
|
118316
|
+
return text4;
|
|
118318
118317
|
}
|
|
118319
118318
|
|
|
118320
118319
|
// ../cli/src/lib/agents/yaml.ts
|
|
@@ -118334,9 +118333,9 @@ function stripComment(value) {
|
|
|
118334
118333
|
const hash = value.slice(from).search(/(^|[ \t])#/);
|
|
118335
118334
|
return hash < 0 ? value : value.slice(0, from + hash).trim();
|
|
118336
118335
|
}
|
|
118337
|
-
var readLines = (
|
|
118338
|
-
function parseYamlBlock(
|
|
118339
|
-
const [map2] = readMap(readLines(
|
|
118336
|
+
var readLines = (text4) => text4.split("\n").map((raw) => ({ indent: raw.match(/^[ \t]*/)[0].length, text: raw.trim() })).filter((line) => line.text && !line.text.startsWith("#"));
|
|
118337
|
+
function parseYamlBlock(text4) {
|
|
118338
|
+
const [map2] = readMap(readLines(text4), 0, 0);
|
|
118340
118339
|
return map2;
|
|
118341
118340
|
}
|
|
118342
118341
|
function readMap(lines, start, indent) {
|
|
@@ -118422,12 +118421,12 @@ function readList(lines, start, indent) {
|
|
|
118422
118421
|
}
|
|
118423
118422
|
return [out, i];
|
|
118424
118423
|
}
|
|
118425
|
-
function splitFrontmatter(
|
|
118426
|
-
const lines =
|
|
118427
|
-
if (lines[0]?.trim() !== "---") return { meta: null, body:
|
|
118424
|
+
function splitFrontmatter(text4) {
|
|
118425
|
+
const lines = text4.replace(/^/, "").split("\n");
|
|
118426
|
+
if (lines[0]?.trim() !== "---") return { meta: null, body: text4 };
|
|
118428
118427
|
let i = 1;
|
|
118429
118428
|
while (i < lines.length && lines[i].trim() !== "---") i++;
|
|
118430
|
-
if (i >= lines.length) return { meta: null, body:
|
|
118429
|
+
if (i >= lines.length) return { meta: null, body: text4 };
|
|
118431
118430
|
return { meta: lines.slice(1, i).join("\n"), body: lines.slice(i + 1).join("\n") };
|
|
118432
118431
|
}
|
|
118433
118432
|
|
|
@@ -118436,14 +118435,14 @@ var OLD_ROLE_KEYS = ["lead", "hook", "stage", "kind"];
|
|
|
118436
118435
|
var AGENT_NAME = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
118437
118436
|
var SCHEDULE_READS = ["archived-cards", "chats", "dismissals"];
|
|
118438
118437
|
var isScheduleReads = (value) => SCHEDULE_READS.includes(value);
|
|
118439
|
-
function parseSpecAgent(
|
|
118438
|
+
function parseSpecAgent(text4, from, file3, builtIn = false, list2 = () => []) {
|
|
118440
118439
|
let named = "";
|
|
118441
118440
|
const bad = (why2, old2) => ({
|
|
118442
118441
|
problem: `${from}: ${why2}`,
|
|
118443
118442
|
...named ? { name: named } : {},
|
|
118444
118443
|
...old2 ? { old: old2 } : {}
|
|
118445
118444
|
});
|
|
118446
|
-
const { meta, body } = splitFrontmatter(
|
|
118445
|
+
const { meta, body } = splitFrontmatter(text4);
|
|
118447
118446
|
if (meta === null) return bad("no `---` frontmatter, so it declares no name or description");
|
|
118448
118447
|
const front = parseYamlBlock(meta);
|
|
118449
118448
|
const name = str3(front.name);
|
|
@@ -118468,7 +118467,7 @@ function parseSpecAgent(text3, from, file3, builtIn = false, list2 = () => []) {
|
|
|
118468
118467
|
const after = names(akb.after);
|
|
118469
118468
|
const declaredSession = str3(akb.session);
|
|
118470
118469
|
if (declaredSession && declaredSession !== "new") {
|
|
118471
|
-
return bad(`\`${name}\` declares \`akb.session: ${declaredSession}\` \u2014
|
|
118470
|
+
return bad(`\`${name}\` declares \`akb.session: ${declaredSession}\` \u2014 use \`new\` to recommend a separate session, or omit the preference`);
|
|
118472
118471
|
}
|
|
118473
118472
|
let stages;
|
|
118474
118473
|
if (akb.stages !== void 0) {
|
|
@@ -118480,20 +118479,20 @@ function parseSpecAgent(text3, from, file3, builtIn = false, list2 = () => []) {
|
|
|
118480
118479
|
const title = map(row?.title);
|
|
118481
118480
|
const instructions2 = str3(row?.instructions);
|
|
118482
118481
|
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");
|
|
118483
|
-
if (!title || !str3(title.en) || Object.values(title).some((
|
|
118482
|
+
if (!title || !str3(title.en) || Object.values(title).some((text5) => typeof text5 !== "string" || !text5.trim())) return bad(`stage ${id} needs a title map with en`);
|
|
118484
118483
|
if (!instructions2.endsWith(".md") || instructions2.startsWith("/") || instructions2.includes("\\") || instructions2.split("/").some((part) => !part || part === ".." || part === ".") || !file3(instructions2)?.trim()) return bad(`stage ${id} needs an existing agent-relative instructions file`);
|
|
118485
118484
|
if (row.when !== void 0 && !str3(row.when)) return bad(`stage ${id} needs nonempty when text, or omit when for a required stage`);
|
|
118486
|
-
stages.push({ id, title: Object.fromEntries(Object.entries(title).map(([lang,
|
|
118485
|
+
stages.push({ id, title: Object.fromEntries(Object.entries(title).map(([lang, text5]) => [lang, str3(text5)])), instructions: instructions2, ...str3(row.when) ? { when: str3(row.when) } : {} });
|
|
118487
118486
|
}
|
|
118488
118487
|
}
|
|
118489
118488
|
const components = akb.components === void 0 ? ["Asset"] : akb.components;
|
|
118490
118489
|
if (!Array.isArray(components) || components.some((value) => typeof value !== "string" || !value.trim())) {
|
|
118491
118490
|
return bad(`\`${name}\` declares \`akb.components\` that is not a list of component IDs`);
|
|
118492
118491
|
}
|
|
118493
|
-
const
|
|
118494
|
-
if (
|
|
118492
|
+
const icon2 = readIcon(akb.icon);
|
|
118493
|
+
if (icon2 && typeof icon2 === "object" && "problem" in icon2) {
|
|
118495
118494
|
return bad(
|
|
118496
|
-
`\`${name}\` declares an \`akb.icon\` where ${
|
|
118495
|
+
`\`${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(", ")}`
|
|
118497
118496
|
);
|
|
118498
118497
|
}
|
|
118499
118498
|
const workspace = memoryPaths(akb.memoryFiles);
|
|
@@ -118508,7 +118507,7 @@ function parseSpecAgent(text3, from, file3, builtIn = false, list2 = () => []) {
|
|
|
118508
118507
|
after,
|
|
118509
118508
|
...stages ? { stages } : {},
|
|
118510
118509
|
components: [...new Set(components.map((value) => value.trim()))],
|
|
118511
|
-
...
|
|
118510
|
+
...icon2 ? { icon: icon2 } : {},
|
|
118512
118511
|
...akb.merges === "true" ? { merges: true } : {},
|
|
118513
118512
|
i18n: readTranslations(akb.i18n),
|
|
118514
118513
|
...declaredReads ? { reads: declaredReads } : {},
|
|
@@ -118578,9 +118577,9 @@ function readPreviews(value) {
|
|
|
118578
118577
|
}
|
|
118579
118578
|
return readGroup(value);
|
|
118580
118579
|
}
|
|
118581
|
-
function parseStudioFile(id,
|
|
118580
|
+
function parseStudioFile(id, source2, from) {
|
|
118582
118581
|
if (!STUDIO_ID.test(id)) return { problem: `${from}: \`${id}\` is not a studio id \u2014 use lowercase letters, digits and dashes` };
|
|
118583
|
-
const { meta, body } = splitFrontmatter(
|
|
118582
|
+
const { meta, body } = splitFrontmatter(source2);
|
|
118584
118583
|
if (meta === null) return { problem: `${from}: no \`---\` frontmatter` };
|
|
118585
118584
|
const raw = parseYamlBlock(meta);
|
|
118586
118585
|
const name = text2(raw.name).replace(/\s+/g, " ");
|
|
@@ -118591,10 +118590,10 @@ function parseStudioFile(id, source, from) {
|
|
|
118591
118590
|
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`
|
|
118592
118591
|
};
|
|
118593
118592
|
}
|
|
118594
|
-
const
|
|
118595
|
-
if (
|
|
118593
|
+
const icon2 = readIcon(raw.icon);
|
|
118594
|
+
if (icon2 && typeof icon2 === "object" && "problem" in icon2) {
|
|
118596
118595
|
return {
|
|
118597
|
-
problem: `${from}: its \`icon\` is wrong \u2014 ${
|
|
118596
|
+
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(", ")}`
|
|
118598
118597
|
};
|
|
118599
118598
|
}
|
|
118600
118599
|
const previews = readPreviews(raw.previews);
|
|
@@ -118623,7 +118622,7 @@ function parseStudioFile(id, source, from) {
|
|
|
118623
118622
|
description: text2(raw.description),
|
|
118624
118623
|
when: text2(raw.when),
|
|
118625
118624
|
needsArtifact: text2(raw.needsArtifact) === "true",
|
|
118626
|
-
...
|
|
118625
|
+
...icon2 ? { icon: icon2 } : {},
|
|
118627
118626
|
previews,
|
|
118628
118627
|
land,
|
|
118629
118628
|
scheduled,
|
|
@@ -118650,7 +118649,7 @@ var hashInput = (files) => JSON.stringify(Object.entries(files).sort(([a2], [b2]
|
|
|
118650
118649
|
var landsOf = (def) => ({ lands: def.land.some((h3) => !h3.off) });
|
|
118651
118650
|
var SEGMENT = /^[\w.-]+$/;
|
|
118652
118651
|
var isAboutFile = (file3) => /^ABOUT(\.[a-z]{2})?\.md$/.test(file3) || /^screenshots\/[\w.-]+\.(png|jpe?g|webp)$/.test(file3);
|
|
118653
|
-
var bytes = (
|
|
118652
|
+
var bytes = (text4) => new TextEncoder().encode(text4).length;
|
|
118654
118653
|
var isSharedFile = (file3) => {
|
|
118655
118654
|
const parts = file3.split("/");
|
|
118656
118655
|
return parts.length > 1 && parts[0] === "shared" && parts.slice(1).every((p2) => SEGMENT.test(p2) && p2 !== "." && p2 !== "..");
|
|
@@ -118661,10 +118660,10 @@ function folderPath(file3, top) {
|
|
|
118661
118660
|
if (parts.slice(2).some((p2) => !SEGMENT.test(p2) || p2 === "." || p2 === "..")) return null;
|
|
118662
118661
|
return [parts[1], parts.slice(2).join("/")];
|
|
118663
118662
|
}
|
|
118664
|
-
function mcpProblem(
|
|
118663
|
+
function mcpProblem(text4) {
|
|
118665
118664
|
let read5;
|
|
118666
118665
|
try {
|
|
118667
|
-
read5 = JSON.parse(
|
|
118666
|
+
read5 = JSON.parse(text4);
|
|
118668
118667
|
} catch {
|
|
118669
118668
|
return "is not JSON";
|
|
118670
118669
|
}
|
|
@@ -118697,8 +118696,8 @@ function inspect(value, official) {
|
|
|
118697
118696
|
let total = 0;
|
|
118698
118697
|
const folders2 = /* @__PURE__ */ new Map();
|
|
118699
118698
|
const skills = /* @__PURE__ */ new Set();
|
|
118700
|
-
for (const [file3,
|
|
118701
|
-
if (typeof
|
|
118699
|
+
for (const [file3, text4] of entries) {
|
|
118700
|
+
if (typeof text4 !== "string" || text4.includes("\0")) {
|
|
118702
118701
|
fail(file3, "is not a text file");
|
|
118703
118702
|
continue;
|
|
118704
118703
|
}
|
|
@@ -118706,13 +118705,13 @@ function inspect(value, official) {
|
|
|
118706
118705
|
fail(file3, `the path is longer than ${FILE_LIMITS.path} characters`);
|
|
118707
118706
|
continue;
|
|
118708
118707
|
}
|
|
118709
|
-
const size = bytes(
|
|
118708
|
+
const size = bytes(text4);
|
|
118710
118709
|
if (size > FILE_LIMITS.file) return fail(file3, `is larger than ${FILE_LIMITS.file / KB} KB`, true);
|
|
118711
118710
|
total += size;
|
|
118712
118711
|
if (total > FILE_LIMITS.total) return fail("files", `are larger than ${FILE_LIMITS.total / KB / KB} MB together`, true);
|
|
118713
118712
|
if (file3 === STUDIO_FILE || file3 === CARD_TEMPLATE_FILE) continue;
|
|
118714
118713
|
if (official && file3 === MCP_FILE) {
|
|
118715
|
-
const problem = mcpProblem(
|
|
118714
|
+
const problem = mcpProblem(text4);
|
|
118716
118715
|
if (problem) fail(file3, problem);
|
|
118717
118716
|
continue;
|
|
118718
118717
|
}
|
|
@@ -118729,24 +118728,24 @@ function inspect(value, official) {
|
|
|
118729
118728
|
continue;
|
|
118730
118729
|
}
|
|
118731
118730
|
if (!folders2.has(at2[0])) folders2.set(at2[0], /* @__PURE__ */ new Map());
|
|
118732
|
-
folders2.get(at2[0]).set(at2[1],
|
|
118731
|
+
folders2.get(at2[0]).set(at2[1], text4);
|
|
118733
118732
|
}
|
|
118734
118733
|
for (const name of skills) {
|
|
118735
118734
|
if (files[`skills/${name}/SKILL.md`] === void 0) fail(`skills/${name}/SKILL.md`, "is missing");
|
|
118736
118735
|
}
|
|
118737
|
-
const
|
|
118738
|
-
const read5 = typeof
|
|
118736
|
+
const source2 = files[STUDIO_FILE];
|
|
118737
|
+
const read5 = typeof source2 === "string" ? parseStudioFile("studio", source2, STUDIO_FILE) : null;
|
|
118739
118738
|
if (!read5) fail(STUDIO_FILE, "is missing");
|
|
118740
118739
|
else if ("problem" in read5) fail(STUDIO_FILE, read5.problem.replace(`${STUDIO_FILE}: `, ""));
|
|
118741
118740
|
const agents = /* @__PURE__ */ new Map();
|
|
118742
118741
|
for (const [name, own2] of folders2) {
|
|
118743
118742
|
const from = `agents/${name}/AGENT.md`;
|
|
118744
|
-
const
|
|
118745
|
-
if (
|
|
118743
|
+
const text4 = own2.get("AGENT.md");
|
|
118744
|
+
if (text4 === void 0) {
|
|
118746
118745
|
fail(from, "is missing");
|
|
118747
118746
|
continue;
|
|
118748
118747
|
}
|
|
118749
|
-
const parsed = parseSpecAgent(
|
|
118748
|
+
const parsed = parseSpecAgent(text4, from, (p2) => own2.get(p2) ?? null, false, () => [...own2.keys()].filter((p2) => p2 !== "AGENT.md"));
|
|
118750
118749
|
if ("problem" in parsed) fail(from, parsed.problem.replace(`${from}: `, ""));
|
|
118751
118750
|
else if (parsed.agent.name !== name) fail(from, `calls itself \`${parsed.agent.name}\`; it must match its folder`);
|
|
118752
118751
|
else agents.set(name, parsed.agent);
|
|
@@ -118810,7 +118809,7 @@ function packOfficial(root2 = OFFICIAL, loose = false) {
|
|
|
118810
118809
|
if ("problem" in parsed) throw new Error(parsed.problem);
|
|
118811
118810
|
const def = parsed.def;
|
|
118812
118811
|
for (const name of [...new Set([...def.previews, ...def.land, ...def.scheduled].map((h3) => h3.agent))].sort()) {
|
|
118813
|
-
for (const [f2,
|
|
118812
|
+
for (const [f2, text4] of Object.entries(agentFiles[name] ?? {})) files[`agents/${name}/${f2}`] = text4;
|
|
118814
118813
|
}
|
|
118815
118814
|
const checked = loose ? { ok: true } : checkStudioFiles(files, true);
|
|
118816
118815
|
if (!checked.ok) throw new Error(`official/studios/${folder}: ${checked.file}: ${checked.reason}`);
|
|
@@ -118957,14 +118956,14 @@ function cloudAgentFiles() {
|
|
|
118957
118956
|
const official = /* @__PURE__ */ new Set();
|
|
118958
118957
|
const owner2 = /* @__PURE__ */ new Map();
|
|
118959
118958
|
for (const flow of cloudFlows()) {
|
|
118960
|
-
for (const [name,
|
|
118959
|
+
for (const [name, text4] of Object.entries(flow.files)) {
|
|
118961
118960
|
const at2 = /^agents\/([^/]+)\/(.+)$/.exec(name);
|
|
118962
118961
|
if (!at2) continue;
|
|
118963
118962
|
const [, agent, rest] = at2;
|
|
118964
118963
|
if (owner2.has(agent) && owner2.get(agent) !== flow.cloudId) continue;
|
|
118965
118964
|
owner2.set(agent, flow.cloudId);
|
|
118966
118965
|
if (flow.builtIn) official.add(agent);
|
|
118967
|
-
files[`${agent}/${rest}`] =
|
|
118966
|
+
files[`${agent}/${rest}`] = text4;
|
|
118968
118967
|
}
|
|
118969
118968
|
}
|
|
118970
118969
|
return { files, official };
|
|
@@ -119371,14 +119370,14 @@ function taskChatFile(task, home4) {
|
|
|
119371
119370
|
return path31.join(taskChatsDir(home4), `${task}.jsonl`);
|
|
119372
119371
|
}
|
|
119373
119372
|
function readTaskChat(task, home4) {
|
|
119374
|
-
let
|
|
119373
|
+
let text4;
|
|
119375
119374
|
try {
|
|
119376
|
-
|
|
119375
|
+
text4 = fs27.readFileSync(taskChatFile(task, home4), "utf8");
|
|
119377
119376
|
} catch {
|
|
119378
119377
|
return [];
|
|
119379
119378
|
}
|
|
119380
119379
|
const lines = [];
|
|
119381
|
-
for (const raw of
|
|
119380
|
+
for (const raw of text4.split("\n")) {
|
|
119382
119381
|
if (!raw.trim()) continue;
|
|
119383
119382
|
try {
|
|
119384
119383
|
const line = JSON.parse(raw);
|
|
@@ -119560,7 +119559,7 @@ var tiled_default = `{
|
|
|
119560
119559
|
var video_default = '{ "name": "video", "title": { "en": "Video", "zh": "\u89C6\u9891" }, "types": ["video"] }\n';
|
|
119561
119560
|
|
|
119562
119561
|
// ../artifact-sdk/src/builtin/studio.json
|
|
119563
|
-
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';
|
|
119562
|
+
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';
|
|
119564
119563
|
|
|
119565
119564
|
// ../artifact-sdk/src/builtin/index.ts
|
|
119566
119565
|
var read = (m) => typeof m === "string" ? JSON.parse(m) : m;
|
|
@@ -119625,67 +119624,12 @@ function schemaProblem(schema, value, at2 = "") {
|
|
|
119625
119624
|
return null;
|
|
119626
119625
|
}
|
|
119627
119626
|
|
|
119628
|
-
// ../artifact-sdk/src/internal/manifest.ts
|
|
119629
|
-
var BUILTINS = builtin_default;
|
|
119630
|
-
var manifestOf = (type) => BUILTINS.find((m) => m.types.includes(type));
|
|
119631
|
-
function typeOf(data, types) {
|
|
119632
|
-
for (const type of types) if (!schemaProblem(manifestOf(type)?.schema, data)) return { type };
|
|
119633
|
-
if (types.length !== 1) return { type: null };
|
|
119634
|
-
return { type: types[0], problem: `does not match ${types[0]} at ${schemaProblem(manifestOf(types[0])?.schema, data)}` };
|
|
119635
|
-
}
|
|
119636
|
-
var isObject = (v) => !!v && typeof v === "object" && !Array.isArray(v);
|
|
119637
|
-
var remote = (src) => !src || /^(?:[a-z][\w+.-]*:|\/|#)/i.test(src);
|
|
119638
|
-
function mapJson(node, keys, at2, visit) {
|
|
119639
|
-
if (!keys.length) return typeof node === "string" && node ? visit(node, at2) : node;
|
|
119640
|
-
const [key, ...rest] = keys;
|
|
119641
|
-
if (Array.isArray(node)) {
|
|
119642
|
-
if (key === "*") return node.map((x2, i2) => mapJson(x2, rest, `${at2}/${i2}`, visit));
|
|
119643
|
-
const i = Number(key);
|
|
119644
|
-
return Number.isInteger(i) && i in node ? node.map((x2, j2) => j2 === i ? mapJson(x2, rest, `${at2}/${j2}`, visit) : x2) : node;
|
|
119645
|
-
}
|
|
119646
|
-
if (!isObject(node)) return node;
|
|
119647
|
-
const out = { ...node };
|
|
119648
|
-
for (const k2 of key === "*" ? Object.keys(node) : key in node ? [key] : []) out[k2] = mapJson(node[k2], rest, `${at2}/${k2}`, visit);
|
|
119649
|
-
return out;
|
|
119650
|
-
}
|
|
119651
|
-
function mapText(text3, rule, skipped, visit) {
|
|
119652
|
-
let out = "";
|
|
119653
|
-
let last2 = 0;
|
|
119654
|
-
for (const m of text3.matchAll(new RegExp(rule.text, "gid"))) {
|
|
119655
|
-
const span = m.indices?.[1];
|
|
119656
|
-
if (!span || m[1] === void 0 || skipped.some(([a2, b2]) => span[0] >= a2 && span[0] < b2)) continue;
|
|
119657
|
-
const line = text3.slice(0, span[0]).split("\n").length;
|
|
119658
|
-
const one = (src) => remote(src) ? src : visit(src, line);
|
|
119659
|
-
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]);
|
|
119660
|
-
out += text3.slice(last2, span[0]) + value;
|
|
119661
|
-
last2 = span[1];
|
|
119662
|
-
}
|
|
119663
|
-
return out + text3.slice(last2);
|
|
119664
|
-
}
|
|
119665
|
-
function mapReferences(manifest, content, map2) {
|
|
119666
|
-
const skipped = (text3) => (manifest?.skip ?? []).flatMap((re3) => [...text3.matchAll(new RegExp(re3, "gi"))].map((m) => [m.index, m.index + m[0].length]));
|
|
119667
|
-
for (const rule of manifest?.references ?? []) {
|
|
119668
|
-
const types = rule.types ?? [];
|
|
119669
|
-
if ("json" in rule) {
|
|
119670
|
-
if (typeof content !== "string") content = mapJson(content, rule.json.split("/").filter(Boolean), "", (src, at2) => map2(src, { src, types, text: false, at: at2 || "/" }));
|
|
119671
|
-
} else if (typeof content === "string") {
|
|
119672
|
-
content = mapText(content, rule, skipped(content), (src, line) => map2(src, { src, types, text: true, line }));
|
|
119673
|
-
}
|
|
119674
|
-
}
|
|
119675
|
-
return content;
|
|
119676
|
-
}
|
|
119677
|
-
function referencesOf(manifest, content) {
|
|
119678
|
-
const found = [];
|
|
119679
|
-
mapReferences(manifest, content, (src, ref) => (found.push(ref), src));
|
|
119680
|
-
return found;
|
|
119681
|
-
}
|
|
119682
|
-
|
|
119683
119627
|
// ../artifact-sdk/src/internal/references.ts
|
|
119684
119628
|
var STORYBOARD = ["storyboard"];
|
|
119685
119629
|
var STUDIO = ["studio"];
|
|
119686
119630
|
var ARRANGED = ["storyboard", "compare", "spritesheet", "studio"];
|
|
119687
119631
|
var ASSET = ["spritesheet", "asset"];
|
|
119688
|
-
var
|
|
119632
|
+
var isObject = (v) => !!v && typeof v === "object" && !Array.isArray(v);
|
|
119689
119633
|
function bodyReferences(body) {
|
|
119690
119634
|
const lines = body.replace(/<!--[^]*?-->/g, "").split(/\r?\n/);
|
|
119691
119635
|
let fence = "";
|
|
@@ -119709,9 +119653,9 @@ function bodyReferences(body) {
|
|
|
119709
119653
|
if (kept4 && /^ {0,3}<(?:Asset|Mockup|Compare|Storyboard|Studio)\b/.test(line)) inTag = true;
|
|
119710
119654
|
if (line.includes("/>")) inTag = false;
|
|
119711
119655
|
}
|
|
119712
|
-
const
|
|
119656
|
+
const text4 = visible.join("\n").replace(/(`+)[^]*?\1/g, "");
|
|
119713
119657
|
const tag = /<(Asset|Mockup|Compare|Storyboard|Studio)\b([^<>]*?)\/>/g;
|
|
119714
|
-
const blocks =
|
|
119658
|
+
const blocks = text4.matchAll(/^ {0,3}(?:<(?:Asset|Mockup|Compare|Storyboard|Studio)\b[^<>]*?\/>[ \t]*(?:\n[ \t]*)?)+$/gm);
|
|
119715
119659
|
for (const block of blocks) {
|
|
119716
119660
|
const tags = [...block[0].matchAll(tag)];
|
|
119717
119661
|
for (const m of tags) {
|
|
@@ -119725,7 +119669,7 @@ function bodyReferences(body) {
|
|
|
119725
119669
|
if (a2.variants) {
|
|
119726
119670
|
try {
|
|
119727
119671
|
const v = JSON.parse(a2.variants);
|
|
119728
|
-
if (
|
|
119672
|
+
if (isObject(v)) {
|
|
119729
119673
|
for (const src of Object.values(v)) if (typeof src === "string" && src) out.push({ src, types: m[1] === "Asset" ? ASSET : [] });
|
|
119730
119674
|
}
|
|
119731
119675
|
} catch {
|
|
@@ -119734,7 +119678,7 @@ function bodyReferences(body) {
|
|
|
119734
119678
|
}
|
|
119735
119679
|
}
|
|
119736
119680
|
}
|
|
119737
|
-
for (const m of
|
|
119681
|
+
for (const m of text4.replace(tag, "").matchAll(/\]\(\s*<?([^\s)>]+)>?(?:\s+["'][^]*?["'])?\s*\)/g)) out.push({ src: m[1], types: [] });
|
|
119738
119682
|
return out;
|
|
119739
119683
|
}
|
|
119740
119684
|
var TYPES = {
|
|
@@ -119774,6 +119718,100 @@ function kindOf2(ext) {
|
|
|
119774
119718
|
return type.startsWith("video/") || type.startsWith("audio/") ? "video" : "asset";
|
|
119775
119719
|
}
|
|
119776
119720
|
|
|
119721
|
+
// ../artifact-sdk/src/internal/format/studio.ts
|
|
119722
|
+
var text3 = (v) => typeof v === "string" && v.length > 0;
|
|
119723
|
+
var source = (v) => text3(v) && !/^(?:[a-z][\w+.-]*:|\/|#)|\\|[\u0000-\u001f]/i.test(v);
|
|
119724
|
+
var icon = (v) => v === void 0 || typeof v === "string" || Array.isArray(v) && v.length > 0 && v.length <= 12 && v.every((p2) => isObject(p2) && text3(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));
|
|
119725
|
+
var relativePath = (v) => source(v) && v.split("/").every((p2) => p2 && p2 !== "." && p2 !== "..");
|
|
119726
|
+
var optionalText = (v, keys) => keys.every((k2) => v[k2] === void 0 || typeof v[k2] === "string");
|
|
119727
|
+
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));
|
|
119728
|
+
function resultProblem(value, agents) {
|
|
119729
|
+
if (!Array.isArray(value) || value.length > 500) return "/results";
|
|
119730
|
+
for (let i = 0; i < value.length; i++) {
|
|
119731
|
+
const r2 = value[i];
|
|
119732
|
+
if (!isObject(r2) || !text3(r2.agent) || !agents.has(r2.agent) || !optionalText(r2, ["label"])) return `/results/${i}`;
|
|
119733
|
+
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);
|
|
119734
|
+
if (!valid) return `/results/${i}`;
|
|
119735
|
+
}
|
|
119736
|
+
return null;
|
|
119737
|
+
}
|
|
119738
|
+
function reviewProblem(v) {
|
|
119739
|
+
if (!isObject(v) || v.version !== 2) return "/version";
|
|
119740
|
+
if (!text3(v.fingerprint)) return "/fingerprint";
|
|
119741
|
+
if (v.base !== null && !(isObject(v.base) && text3(v.base.id) && Number.isInteger(v.base.version) && Number(v.base.version) > 0 && text3(v.base.fingerprint))) return "/base";
|
|
119742
|
+
if (!Array.isArray(v.agents) || v.agents.length > 500) return "/agents";
|
|
119743
|
+
const agents = /* @__PURE__ */ new Set();
|
|
119744
|
+
for (const a2 of v.agents) {
|
|
119745
|
+
if (!isObject(a2) || !text3(a2.agent) || !/^[a-z][a-z0-9-]*$/.test(a2.agent) || agents.has(a2.agent) || !isObject(a2.title) || !text3(a2.title.en) || !optionalText(a2.title, ["zh"]) || !icon(a2.icon)) return "/agents";
|
|
119746
|
+
agents.add(a2.agent);
|
|
119747
|
+
}
|
|
119748
|
+
if (!Array.isArray(v.files) || v.files.length > 1e3) return "/files";
|
|
119749
|
+
const paths = /* @__PURE__ */ new Set();
|
|
119750
|
+
for (const f2 of v.files) {
|
|
119751
|
+
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";
|
|
119752
|
+
if (f2.path.startsWith("agents/") && !agents.has(f2.path.split("/")[1])) return "/files";
|
|
119753
|
+
paths.add(f2.path);
|
|
119754
|
+
}
|
|
119755
|
+
return resultProblem(v.results, agents);
|
|
119756
|
+
}
|
|
119757
|
+
var isReview = (v) => isObject(v) && v.version === 2;
|
|
119758
|
+
|
|
119759
|
+
// ../artifact-sdk/src/internal/manifest.ts
|
|
119760
|
+
var BUILTINS = builtin_default;
|
|
119761
|
+
var manifestOf = (type) => BUILTINS.find((m) => m.types.includes(type));
|
|
119762
|
+
function typeOf(data, types) {
|
|
119763
|
+
const problem = (type) => type === "studio" && isReview(data) ? reviewProblem(data) : schemaProblem(manifestOf(type)?.schema, data);
|
|
119764
|
+
for (const type of types) if (!problem(type)) return { type };
|
|
119765
|
+
if (types.length !== 1) return { type: null };
|
|
119766
|
+
return { type: types[0], problem: `does not match ${types[0]} at ${problem(types[0])}` };
|
|
119767
|
+
}
|
|
119768
|
+
var isObject2 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
|
|
119769
|
+
var remote = (src) => !src || /^(?:[a-z][\w+.-]*:|\/|#)/i.test(src);
|
|
119770
|
+
function mapJson(node, keys, at2, visit) {
|
|
119771
|
+
if (!keys.length) return typeof node === "string" && node ? visit(node, at2) : node;
|
|
119772
|
+
const [key, ...rest] = keys;
|
|
119773
|
+
if (Array.isArray(node)) {
|
|
119774
|
+
if (key === "*") return node.map((x2, i2) => mapJson(x2, rest, `${at2}/${i2}`, visit));
|
|
119775
|
+
const i = Number(key);
|
|
119776
|
+
return Number.isInteger(i) && i in node ? node.map((x2, j2) => j2 === i ? mapJson(x2, rest, `${at2}/${j2}`, visit) : x2) : node;
|
|
119777
|
+
}
|
|
119778
|
+
if (!isObject2(node)) return node;
|
|
119779
|
+
const out = { ...node };
|
|
119780
|
+
for (const k2 of key === "*" ? Object.keys(node) : key in node ? [key] : []) out[k2] = mapJson(node[k2], rest, `${at2}/${k2}`, visit);
|
|
119781
|
+
return out;
|
|
119782
|
+
}
|
|
119783
|
+
function mapText(text4, rule, skipped, visit, includeRemote) {
|
|
119784
|
+
let out = "";
|
|
119785
|
+
let last2 = 0;
|
|
119786
|
+
for (const m of text4.matchAll(new RegExp(rule.text, "gid"))) {
|
|
119787
|
+
const span = m.indices?.[1];
|
|
119788
|
+
if (!span || m[1] === void 0 || skipped.some(([a2, b2]) => span[0] >= a2 && span[0] < b2)) continue;
|
|
119789
|
+
const line = text4.slice(0, span[0]).split("\n").length;
|
|
119790
|
+
const one = (src) => remote(src) && !includeRemote ? src : visit(src, line);
|
|
119791
|
+
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]);
|
|
119792
|
+
out += text4.slice(last2, span[0]) + value;
|
|
119793
|
+
last2 = span[1];
|
|
119794
|
+
}
|
|
119795
|
+
return out + text4.slice(last2);
|
|
119796
|
+
}
|
|
119797
|
+
function mapReferences(manifest, content, map2, includeRemote = false) {
|
|
119798
|
+
const skipped = (text4) => (manifest?.skip ?? []).flatMap((re3) => [...text4.matchAll(new RegExp(re3, "gi"))].map((m) => [m.index, m.index + m[0].length]));
|
|
119799
|
+
for (const rule of manifest?.references ?? []) {
|
|
119800
|
+
const types = rule.types ?? [];
|
|
119801
|
+
if ("json" in rule) {
|
|
119802
|
+
if (typeof content !== "string") content = mapJson(content, rule.json.split("/").filter(Boolean), "", (src, at2) => map2(src, { src, types, text: false, at: at2 || "/" }));
|
|
119803
|
+
} else if (typeof content === "string") {
|
|
119804
|
+
content = mapText(content, rule, skipped(content), (src, line) => map2(src, { src, types, text: true, line }), includeRemote);
|
|
119805
|
+
}
|
|
119806
|
+
}
|
|
119807
|
+
return content;
|
|
119808
|
+
}
|
|
119809
|
+
function referencesOf(manifest, content, includeRemote = false) {
|
|
119810
|
+
const found = [];
|
|
119811
|
+
mapReferences(manifest, content, (src, ref) => (found.push(ref), src), includeRemote);
|
|
119812
|
+
return found;
|
|
119813
|
+
}
|
|
119814
|
+
|
|
119777
119815
|
// ../artifact-sdk/src/internal/collect.ts
|
|
119778
119816
|
var extOf = (file3) => /\.[^./\\]+$/.exec(file3)?.[0].toLowerCase() ?? "";
|
|
119779
119817
|
var why = (error) => error instanceof Error ? error.message : String(error);
|
|
@@ -119783,10 +119821,13 @@ var textKind = (ext, types) => types.find((t2) => {
|
|
|
119783
119821
|
}) ?? kindOf2(ext);
|
|
119784
119822
|
var kindAt = (src, types) => extOf(src) === ".json" ? types.includes("asset") ? "asset" : types[0] ?? "asset" : textKind(extOf(src), types);
|
|
119785
119823
|
function collect(body, card, host) {
|
|
119824
|
+
return collectSources(bodyReferences(body), card, host);
|
|
119825
|
+
}
|
|
119826
|
+
function collectSources(sources2, card, host) {
|
|
119786
119827
|
const nodes = /* @__PURE__ */ new Map();
|
|
119787
119828
|
const active = /* @__PURE__ */ new Set();
|
|
119788
119829
|
const out = [];
|
|
119789
|
-
const visit = (src, types, owner2) => {
|
|
119830
|
+
const visit = (src, types, owner2, partial = false) => {
|
|
119790
119831
|
const path58 = src.replace(/[?#].*$/, "");
|
|
119791
119832
|
let resolved;
|
|
119792
119833
|
try {
|
|
@@ -119802,7 +119843,11 @@ function collect(body, card, host) {
|
|
|
119802
119843
|
}
|
|
119803
119844
|
if (!resolved) return { key: null };
|
|
119804
119845
|
const { key, file: file3 } = resolved;
|
|
119805
|
-
if (active.has(key))
|
|
119846
|
+
if (active.has(key)) {
|
|
119847
|
+
const error = `${owner2}: ${src}: \u8D44\u6E90\u4F9D\u8D56\u5FAA\u73AF`;
|
|
119848
|
+
if (partial) return { key: null, error };
|
|
119849
|
+
throw new Error(error);
|
|
119850
|
+
}
|
|
119806
119851
|
const json = !!file3 && extOf(file3) === ".json";
|
|
119807
119852
|
const held5 = nodes.get(key);
|
|
119808
119853
|
if (held5) {
|
|
@@ -119815,10 +119860,10 @@ function collect(body, card, host) {
|
|
|
119815
119860
|
nodes.set(key, node);
|
|
119816
119861
|
active.add(key);
|
|
119817
119862
|
const child = (ref, from) => {
|
|
119818
|
-
const found = visit(ref.src, ref.types, from);
|
|
119863
|
+
const found = visit(ref.src, ref.types, from, partial || node.kind === "studio" && node.data?.version === 2);
|
|
119819
119864
|
if (found.key) node.dependencies.set(ref.src, found.key);
|
|
119820
119865
|
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 });
|
|
119821
|
-
node.error ??= found.error;
|
|
119866
|
+
if (!(node.kind === "studio" && node.data?.version === 2)) node.error ??= found.error;
|
|
119822
119867
|
};
|
|
119823
119868
|
if (file3) {
|
|
119824
119869
|
if (json) {
|
|
@@ -119841,13 +119886,13 @@ function collect(body, card, host) {
|
|
|
119841
119886
|
node.error = node.problems[0]?.message;
|
|
119842
119887
|
if (!node.error) for (const ref of referencesOf(manifestOf(node.kind), node.data)) child(ref, file3);
|
|
119843
119888
|
} else {
|
|
119844
|
-
for (const ref of host.retained(key)) child(ref, card);
|
|
119889
|
+
for (const ref of host.retained(key, types)) child(ref, card);
|
|
119845
119890
|
}
|
|
119846
119891
|
active.delete(key);
|
|
119847
119892
|
out.push(node);
|
|
119848
119893
|
return { key, error: node.error };
|
|
119849
119894
|
};
|
|
119850
|
-
for (const ref of
|
|
119895
|
+
for (const ref of sources2) visit(ref.src, ref.types, card);
|
|
119851
119896
|
const sorted = [];
|
|
119852
119897
|
const done = /* @__PURE__ */ new Set();
|
|
119853
119898
|
const order = (node) => {
|
|
@@ -120187,9 +120232,9 @@ var officialAgent = (name) => cloudAgentFiles().official.has(name);
|
|
|
120187
120232
|
// ../cli/src/lib/agents/shared-memory.ts
|
|
120188
120233
|
function sharedMemory(board) {
|
|
120189
120234
|
const declared = /* @__PURE__ */ new Map();
|
|
120190
|
-
const take = (folder,
|
|
120191
|
-
if (
|
|
120192
|
-
const read5 = parseSpecAgent(
|
|
120235
|
+
const take = (folder, text4, builtIn) => {
|
|
120236
|
+
if (text4 === null || declared.has(folder)) return;
|
|
120237
|
+
const read5 = parseSpecAgent(text4, folder, (relative) => {
|
|
120193
120238
|
if (builtIn) return shippedAgentFiles()[`${folder}/${relative}`] ?? null;
|
|
120194
120239
|
try {
|
|
120195
120240
|
return fs31.readFileSync(path35.join(board, "agents", folder, relative), "utf8");
|
|
@@ -120199,9 +120244,9 @@ function sharedMemory(board) {
|
|
|
120199
120244
|
}, builtIn);
|
|
120200
120245
|
if ("agent" in read5 && read5.agent.name === folder) declared.set(folder, read5.agent.memoryFiles.workspace);
|
|
120201
120246
|
};
|
|
120202
|
-
for (const [key,
|
|
120247
|
+
for (const [key, text4] of Object.entries(shippedAgentFiles())) {
|
|
120203
120248
|
const at2 = /^([^/]+)\/AGENT\.md$/.exec(key);
|
|
120204
|
-
if (at2) take(at2[1],
|
|
120249
|
+
if (at2) take(at2[1], text4, officialAgent(at2[1]));
|
|
120205
120250
|
}
|
|
120206
120251
|
const root2 = path35.join(board, "agents");
|
|
120207
120252
|
let folders2 = [];
|
|
@@ -120210,12 +120255,12 @@ function sharedMemory(board) {
|
|
|
120210
120255
|
} catch {
|
|
120211
120256
|
}
|
|
120212
120257
|
for (const folder of folders2.sort()) {
|
|
120213
|
-
let
|
|
120258
|
+
let text4 = null;
|
|
120214
120259
|
try {
|
|
120215
|
-
|
|
120260
|
+
text4 = fs31.readFileSync(path35.join(root2, folder, "AGENT.md"), "utf8");
|
|
120216
120261
|
} catch {
|
|
120217
120262
|
}
|
|
120218
|
-
take(folder,
|
|
120263
|
+
take(folder, text4, false);
|
|
120219
120264
|
}
|
|
120220
120265
|
const matches = [
|
|
120221
120266
|
matcher("agents/copywriting/style.md"),
|
|
@@ -120512,13 +120557,13 @@ function pullTools(ws, record, files) {
|
|
|
120512
120557
|
const theirs = (skill) => !ours.has(skill) && SKILL_ROOTS.some((root2) => fs33.existsSync(path37.join(ws.cwd, root2, skill)));
|
|
120513
120558
|
const kept4 = Object.keys(files).map((name) => SKILL_PATH.exec(name)?.[1]).filter((skill) => skill && !theirs(skill));
|
|
120514
120559
|
const skills = {};
|
|
120515
|
-
for (const [name,
|
|
120560
|
+
for (const [name, text4] of Object.entries(files)) {
|
|
120516
120561
|
const at2 = SKILL_PATH.exec(name);
|
|
120517
120562
|
if (!at2 || at2[1] === "kanban" || !kept4.includes(at2[1]) || at2[2].split("/").includes("..")) continue;
|
|
120518
|
-
skills[name] = hashOf2(
|
|
120563
|
+
skills[name] = hashOf2(text4);
|
|
120519
120564
|
for (const root2 of SKILL_ROOTS) {
|
|
120520
120565
|
const file3 = path37.join(ws.cwd, root2, at2[1], at2[2]);
|
|
120521
|
-
if (held5[name] !== skills[name] || hashFile(file3) !== skills[name]) write(file3,
|
|
120566
|
+
if (held5[name] !== skills[name] || hashFile(file3) !== skills[name]) write(file3, text4);
|
|
120522
120567
|
}
|
|
120523
120568
|
}
|
|
120524
120569
|
for (const name of Object.keys(held5)) {
|
|
@@ -120612,9 +120657,9 @@ function stateDir(ws) {
|
|
|
120612
120657
|
return null;
|
|
120613
120658
|
}
|
|
120614
120659
|
}
|
|
120615
|
-
function assetsOf(
|
|
120660
|
+
function assetsOf(text4) {
|
|
120616
120661
|
try {
|
|
120617
|
-
const held5 = JSON.parse(
|
|
120662
|
+
const held5 = JSON.parse(text4 ?? "{}");
|
|
120618
120663
|
return held5 && typeof held5 === "object" && !Array.isArray(held5) ? held5 : {};
|
|
120619
120664
|
} catch {
|
|
120620
120665
|
return {};
|
|
@@ -120738,13 +120783,13 @@ function writeIndex(board) {
|
|
|
120738
120783
|
const id = /^(\d+)-/.exec(e2.name)?.[1];
|
|
120739
120784
|
if (!id) continue;
|
|
120740
120785
|
const link = e2.isDirectory() ? `${e2.name}/root.md` : e2.name.endsWith(".md") ? e2.name : null;
|
|
120741
|
-
const
|
|
120742
|
-
if (
|
|
120743
|
-
cards.push({ id: Number(id), title: cardFront(
|
|
120786
|
+
const text5 = link && readText(path37.join(todo, link));
|
|
120787
|
+
if (text5 === null || !link) continue;
|
|
120788
|
+
cards.push({ id: Number(id), title: cardFront(text5).title ?? e2.name.replace(/\.md$/, ""), link });
|
|
120744
120789
|
}
|
|
120745
120790
|
cards.sort((a2, b2) => a2.id - b2.id);
|
|
120746
120791
|
const list2 = cards.length ? cards.map((c2) => `- [#${c2.id} ${c2.title}](${c2.link})`).join("\n") : "_(none)_";
|
|
120747
|
-
const
|
|
120792
|
+
const text4 = `# Board
|
|
120748
120793
|
|
|
120749
120794
|
Open tasks for the kanban board. One card per file. Ids are global and never reused \u2014
|
|
120750
120795
|
the number at the front of a filename is the task id.
|
|
@@ -120753,7 +120798,7 @@ the number at the front of a filename is the task id.
|
|
|
120753
120798
|
|
|
120754
120799
|
${list2}
|
|
120755
120800
|
`;
|
|
120756
|
-
if (readText(path37.join(todo, "README.md")) !==
|
|
120801
|
+
if (readText(path37.join(todo, "README.md")) !== text4) write(path37.join(todo, "README.md"), text4);
|
|
120757
120802
|
}
|
|
120758
120803
|
var workspaceOf = (ws) => readBase(ws).workspace ?? null;
|
|
120759
120804
|
async function pullAssets(ws, record, assets) {
|
|
@@ -120840,18 +120885,18 @@ async function pullAssets(ws, record, assets) {
|
|
|
120840
120885
|
}
|
|
120841
120886
|
const json = data !== void 0 && typeof data !== "string";
|
|
120842
120887
|
if (held5?.artifact === ref.artifact && held5.version === version && !held5.localHash && json) {
|
|
120843
|
-
const
|
|
120844
|
-
if (
|
|
120888
|
+
const source2 = readText(target);
|
|
120889
|
+
if (source2 !== null) {
|
|
120845
120890
|
let same = false;
|
|
120846
120891
|
try {
|
|
120847
|
-
same = JSON.stringify(JSON.parse(
|
|
120892
|
+
same = JSON.stringify(JSON.parse(source2)) === JSON.stringify(JSON.parse(Buffer.from(local).toString()));
|
|
120848
120893
|
} catch {
|
|
120849
120894
|
}
|
|
120850
120895
|
if (!same) {
|
|
120851
120896
|
out[name] = { ...held5, kind };
|
|
120852
120897
|
continue;
|
|
120853
120898
|
}
|
|
120854
|
-
local = Buffer.from(
|
|
120899
|
+
local = Buffer.from(source2);
|
|
120855
120900
|
}
|
|
120856
120901
|
}
|
|
120857
120902
|
write(target, local);
|
|
@@ -120923,6 +120968,7 @@ async function pushAssets(ws, record, before) {
|
|
|
120923
120968
|
return path37.relative(real(path37.dirname(file3)), target).split(path37.sep).join("/");
|
|
120924
120969
|
};
|
|
120925
120970
|
try {
|
|
120971
|
+
let recoveredReferences = false;
|
|
120926
120972
|
const graph = collect(body, file3, {
|
|
120927
120973
|
resolve: (src, owner2) => {
|
|
120928
120974
|
const id = Object.entries(before).find(([, ref]) => ref.artifact === src);
|
|
@@ -120937,17 +120983,25 @@ async function pushAssets(ws, record, before) {
|
|
|
120937
120983
|
return { key: canonical(fs33.realpathSync(target)), file: target };
|
|
120938
120984
|
},
|
|
120939
120985
|
read: referenceText,
|
|
120940
|
-
retained: (key
|
|
120941
|
-
|
|
120942
|
-
|
|
120943
|
-
|
|
120986
|
+
retained: (key, types) => {
|
|
120987
|
+
let dependencies = record.assets[key]?.dependencies;
|
|
120988
|
+
if (!dependencies && types.length === 1 && types[0] === "studio" && before[key] && !recoveredReferences) {
|
|
120989
|
+
recoveredReferences = true;
|
|
120990
|
+
dependencies = Object.keys(before).filter((src) => src !== key);
|
|
120991
|
+
}
|
|
120992
|
+
return (dependencies ?? []).map((src) => {
|
|
120993
|
+
const kind = record.assets[src]?.kind;
|
|
120994
|
+
return { src, types: kind ? [kind] : [] };
|
|
120995
|
+
});
|
|
120996
|
+
}
|
|
120944
120997
|
});
|
|
120945
120998
|
for (const node of graph) {
|
|
120946
120999
|
const previous = [...node.aliases].map((key) => record.assets[key]).find(Boolean);
|
|
120947
121000
|
const old = [...node.aliases].map((key) => before[key]).find(Boolean);
|
|
120948
121001
|
const kind = node.kind;
|
|
120949
121002
|
let out;
|
|
120950
|
-
|
|
121003
|
+
const partialStudio = node.kind === "studio" && node.data?.version === 2;
|
|
121004
|
+
let why2 = node.error ?? (partialStudio ? void 0 : [...node.dependencies.values()].map((key) => refs[key]?.error).find(Boolean));
|
|
120951
121005
|
if (!why2 && node.file) {
|
|
120952
121006
|
try {
|
|
120953
121007
|
if (fs33.statSync(node.file).size > ASSET_FILE_LIMIT) throw new Error("This asset is over 100 MiB.");
|
|
@@ -121561,7 +121615,7 @@ async function answerHint(machineId2, hint2) {
|
|
|
121561
121615
|
// src/preview-bridge.ts
|
|
121562
121616
|
import http from "node:http";
|
|
121563
121617
|
import crypto6 from "node:crypto";
|
|
121564
|
-
async function previewBridge(work) {
|
|
121618
|
+
async function previewBridge(work, card) {
|
|
121565
121619
|
const token = crypto6.randomBytes(32).toString("hex");
|
|
121566
121620
|
let serial = Promise.resolve();
|
|
121567
121621
|
const server = http.createServer((req, res) => {
|
|
@@ -121579,6 +121633,7 @@ async function previewBridge(work) {
|
|
|
121579
121633
|
serial = serial.then(async () => {
|
|
121580
121634
|
try {
|
|
121581
121635
|
const fields = JSON.parse(raw);
|
|
121636
|
+
if (card !== void 0 && fields.cardId !== void 0 && fields.cardId !== card) throw Error("Only the current task can manage previews from this session.");
|
|
121582
121637
|
if (typeof fields.agent !== "string" || !/^[a-z0-9]+(-[a-z0-9]+)*$/.test(fields.agent)) throw Error("Invalid preview agent.");
|
|
121583
121638
|
answer(200, await work(fields.agent, fields));
|
|
121584
121639
|
} catch (error) {
|
|
@@ -121754,19 +121809,19 @@ import path42 from "node:path";
|
|
|
121754
121809
|
|
|
121755
121810
|
// ../cli/src/lib/question-block.ts
|
|
121756
121811
|
var MODES = ["single", "multi"];
|
|
121757
|
-
var withoutTag = (
|
|
121812
|
+
var withoutTag = (text4) => text4.replace(/^\[user\]\s+/, "");
|
|
121758
121813
|
function normalizeQuestion(raw) {
|
|
121759
121814
|
if (raw && typeof raw === "object" && !Array.isArray(raw)) {
|
|
121760
|
-
const
|
|
121761
|
-
const
|
|
121815
|
+
const source2 = raw;
|
|
121816
|
+
const text4 = withoutTag(String(source2.question ?? source2.text ?? ""));
|
|
121762
121817
|
const extra = {
|
|
121763
|
-
...typeof
|
|
121818
|
+
...typeof source2.agent === "string" && source2.agent.trim() ? { agent: source2.agent.trim() } : {}
|
|
121764
121819
|
};
|
|
121765
|
-
const options = (Array.isArray(
|
|
121766
|
-
if (options.length === 0) return { text:
|
|
121767
|
-
const mode = MODES.includes(String(
|
|
121768
|
-
const recommend = (Array.isArray(
|
|
121769
|
-
return { text:
|
|
121820
|
+
const options = (Array.isArray(source2.options) ? source2.options : []).map((o3) => String(o3).trim()).filter(Boolean);
|
|
121821
|
+
if (options.length === 0) return { text: text4, ...extra };
|
|
121822
|
+
const mode = MODES.includes(String(source2.mode)) ? String(source2.mode) : "single";
|
|
121823
|
+
const recommend = (Array.isArray(source2.recommend) ? source2.recommend : []).map(Number).filter((n) => Number.isInteger(n) && n >= 1 && n <= options.length);
|
|
121824
|
+
return { text: text4, mode, options, recommend: mode === "single" ? recommend.slice(0, 1) : recommend, ...extra };
|
|
121770
121825
|
}
|
|
121771
121826
|
return { text: withoutTag(String(raw)) };
|
|
121772
121827
|
}
|
|
@@ -121813,16 +121868,16 @@ function parseQuestionsBlock(lines) {
|
|
|
121813
121868
|
}
|
|
121814
121869
|
|
|
121815
121870
|
// ../cli/src/lib/frontmatter.ts
|
|
121816
|
-
function parseFrontmatter(
|
|
121817
|
-
const lines =
|
|
121818
|
-
if (lines[0].trim() !== "---") return { meta: null, body:
|
|
121871
|
+
function parseFrontmatter(text4) {
|
|
121872
|
+
const lines = text4.split("\n");
|
|
121873
|
+
if (lines[0].trim() !== "---") return { meta: null, body: text4 };
|
|
121819
121874
|
let i = 1;
|
|
121820
121875
|
const fm = [];
|
|
121821
121876
|
while (i < lines.length && lines[i].trim() !== "---") {
|
|
121822
121877
|
fm.push(lines[i]);
|
|
121823
121878
|
i++;
|
|
121824
121879
|
}
|
|
121825
|
-
if (i >= lines.length) return { meta: null, body:
|
|
121880
|
+
if (i >= lines.length) return { meta: null, body: text4 };
|
|
121826
121881
|
const meta = {};
|
|
121827
121882
|
for (let j2 = 0; j2 < fm.length; j2++) {
|
|
121828
121883
|
const m = fm[j2].match(/^([A-Za-z_]+):\s*(.*)$/);
|
|
@@ -122009,8 +122064,8 @@ function installCommitHook(root2, _board) {
|
|
|
122009
122064
|
if (!dir) return {};
|
|
122010
122065
|
const file3 = path41.join(dir, "pre-commit");
|
|
122011
122066
|
if (fs38.lstatSync(file3, { throwIfNoEntry: false })?.isSymbolicLink()) return {};
|
|
122012
|
-
const
|
|
122013
|
-
if (
|
|
122067
|
+
const source2 = read2(file3);
|
|
122068
|
+
if (source2 && MARKER_LINE.test(source2)) fs38.unlinkSync(file3);
|
|
122014
122069
|
return {};
|
|
122015
122070
|
}
|
|
122016
122071
|
|
|
@@ -122110,7 +122165,7 @@ function deliveryEnding(ws, id, asked = false) {
|
|
|
122110
122165
|
if (held5.status === "cancelled") {
|
|
122111
122166
|
return held5.steps?.some((s) => s.step === "discarded") ? { ok: false, reason: "The build was discarded." } : { ok: false, reason: "", stopped: true };
|
|
122112
122167
|
}
|
|
122113
|
-
if (held5.status === "active" &&
|
|
122168
|
+
if (held5.status === "active" && stopped2?.why) return { ok: false, reason: reasonOf(stopped2.why) ?? stopped2.why };
|
|
122114
122169
|
return null;
|
|
122115
122170
|
}
|
|
122116
122171
|
function checkoutsOf(ws, id) {
|
|
@@ -122139,7 +122194,7 @@ var RESUME_REFUSED = {
|
|
|
122139
122194
|
};
|
|
122140
122195
|
var isArchived = (ws, id) => path42.relative(ws.board, findCard(ws.board, id) ?? ws.board).split(path42.sep)[0] === ".archive";
|
|
122141
122196
|
var refusal3 = (ran) => ran.last.replace(/^akb( raw)?: /, "").slice(0, 300) || "akb stopped with an error.";
|
|
122142
|
-
var reasonOf = (
|
|
122197
|
+
var reasonOf = (text4) => (text4 ?? "").split("\n").map((l2) => l2.trim()).filter((l2) => l2 && !/^at\s/.test(l2)).join("\n").slice(0, 300) || void 0;
|
|
122143
122198
|
function logLines(show, event2) {
|
|
122144
122199
|
let held5 = "";
|
|
122145
122200
|
const said = (line) => {
|
|
@@ -122192,7 +122247,7 @@ function boardAkb(job, ws, deps, io, task) {
|
|
|
122192
122247
|
if (!replyAssetsSynced(ws)) return { ok: false, error: "Preview uploads are still pending." };
|
|
122193
122248
|
}
|
|
122194
122249
|
return previewOperation(deps.machineId, job.id, agent, fields);
|
|
122195
|
-
}) : null;
|
|
122250
|
+
}, ws.number ?? void 0) : null;
|
|
122196
122251
|
try {
|
|
122197
122252
|
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 });
|
|
122198
122253
|
log?.end();
|
|
@@ -122449,14 +122504,14 @@ ${pictures(job, ws, ws.number)}`);
|
|
|
122449
122504
|
if (!await stopRuns(deps.akb, ws, id2, since, deps.stopMs)) throw new Error("\u672A\u80FD\u786E\u8BA4\u539F\u6267\u884C\u5DF2\u505C\u6B62\u3002");
|
|
122450
122505
|
});
|
|
122451
122506
|
const verb = flow.verb === "create" ? flow.skip_plan ? "implement" : "refine" : flow.verb;
|
|
122452
|
-
const
|
|
122507
|
+
const text4 = flow.verb === "create" ? "" : (flow.text ?? "").trim();
|
|
122453
122508
|
if (flow.resume && isArchived(ws, id2)) return { ok: true, report: { card: id2 } };
|
|
122454
122509
|
if (flow.resume && verb === "refine") {
|
|
122455
122510
|
const review2 = reviewOf2(cardFile(ws));
|
|
122456
122511
|
if (review2) return { ok: true, report: { card: id2, ...review2 === true ? {} : { review: review2 } } };
|
|
122457
122512
|
}
|
|
122458
|
-
if (verb === "revise" && !
|
|
122459
|
-
let note = verb === "resolve" || verb === "revise" ?
|
|
122513
|
+
if (verb === "revise" && !text4) return fail("Say what to change.");
|
|
122514
|
+
let note = verb === "resolve" || verb === "revise" ? text4 : "";
|
|
122460
122515
|
let rejected = false;
|
|
122461
122516
|
let ran;
|
|
122462
122517
|
let continuation;
|
|
@@ -122477,21 +122532,21 @@ ${pictures(job, ws, ws.number)}`);
|
|
|
122477
122532
|
} else if (deliveryId) {
|
|
122478
122533
|
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];
|
|
122479
122534
|
if (previous) {
|
|
122480
|
-
continuation =
|
|
122535
|
+
continuation = ["raw", "run", "resume", previous.sessionId, "--require-session"];
|
|
122481
122536
|
}
|
|
122482
122537
|
}
|
|
122483
|
-
} else if (verb === "implement" &&
|
|
122484
|
-
const resolved = await akb(["raw", "card", "resolve", String(id2), "--follow", "--events", "--json", "--",
|
|
122538
|
+
} else if (verb === "implement" && text4) {
|
|
122539
|
+
const resolved = await akb(["raw", "card", "resolve", String(id2), "--follow", "--events", "--json", "--", text4], true);
|
|
122485
122540
|
if (io.lost()) return fail("");
|
|
122486
122541
|
const file3 = findCard(ws.board, id2);
|
|
122487
122542
|
rejected = !!file3 && path42.relative(ws.board, file3).split(path42.sep)[0] === ".archive" && parseFrontmatter(fs39.readFileSync(file3, "utf8")).meta?.rejected === true;
|
|
122488
122543
|
if (rejected) ran = resolved;
|
|
122489
|
-
else if (resolved.code !== 0) note =
|
|
122544
|
+
else if (resolved.code !== 0) note = text4;
|
|
122490
122545
|
}
|
|
122491
122546
|
const fresh = () => {
|
|
122492
122547
|
const carry = carryArgs(verb);
|
|
122493
122548
|
const costFrom = carry.includes("--session") && typeof job.resumeCostUsd === "number" ? { [SESSION_COST_ENV]: String(job.resumeCostUsd) } : void 0;
|
|
122494
|
-
if (verb === "preview") return akb(["raw", "previews",
|
|
122549
|
+
if (verb === "preview") return akb(["raw", "previews", text4, String(id2), "--continue", "--follow", "--events", "--json", ...flow.feedback ? ["--notes", flow.feedback] : []], true);
|
|
122495
122550
|
return akb(["raw", "card", verb, String(id2), "--follow", "--events", "--json", ...carry, ...note ? ["--", note] : []], true, costFrom);
|
|
122496
122551
|
};
|
|
122497
122552
|
ran ??= await (continuation ? akb([...continuation, "--follow", "--events", "--json"], true) : fresh());
|
|
@@ -122516,9 +122571,10 @@ ${pictures(job, ws, ws.number)}`);
|
|
|
122516
122571
|
const said = ((last2 ? runs.find((r2) => r2.sessionId === last2)?.result : void 0) ?? answer?.result ?? answer?.error?.result)?.trim();
|
|
122517
122572
|
const spent = spentBy([...learned, ...runs.filter((r2) => (r2.startedAt ?? 0) >= since)], job);
|
|
122518
122573
|
const commit = !rejected && ran.code === 0 ? answer?.delivery?.commit : void 0;
|
|
122574
|
+
const pending = verb === "implement" && answer?.delivery?.status === "active" ? { review: {} } : {};
|
|
122519
122575
|
const landing = commit ? { landing: { commit, branch: answer?.delivery?.branch ?? "" } } : {};
|
|
122520
122576
|
const session = answer?.agentSession ?? answer?.error?.agentSession;
|
|
122521
|
-
return { ok: true, report: { ...said ? { reply: said } : {}, ...session ? { session } : {}, ...spent, card: id2, ...review ? { review } : {}, ...landing } };
|
|
122577
|
+
return { ok: true, report: { ...said ? { reply: said } : {}, ...session ? { session } : {}, ...spent, card: id2, ...pending, ...review ? { review } : {}, ...landing } };
|
|
122522
122578
|
}
|
|
122523
122579
|
async function discardBuilds() {
|
|
122524
122580
|
const pulled = await pull(ws, deps.machineId);
|
|
@@ -122603,7 +122659,7 @@ function checkpointEvent(checkpoint, event2) {
|
|
|
122603
122659
|
}
|
|
122604
122660
|
async function stopReply(id, timeout) {
|
|
122605
122661
|
const checkpoint = readCheckpoint(id);
|
|
122606
|
-
if (!checkpoint?.mark) return
|
|
122662
|
+
if (!checkpoint?.mark) return true;
|
|
122607
122663
|
killMarked(checkpoint.mark, checkpoint.process);
|
|
122608
122664
|
const until = Date.now() + timeout;
|
|
122609
122665
|
while (!processesStopped(checkpoint.mark, checkpoint.process)) {
|
|
@@ -122875,11 +122931,11 @@ import { createHash as createHash5 } from "node:crypto";
|
|
|
122875
122931
|
// ../cli/src/lib/shared/reply-parts.ts
|
|
122876
122932
|
function imageMime(bytes2) {
|
|
122877
122933
|
const at2 = (...v) => v.every((n, i) => bytes2[i] === n);
|
|
122878
|
-
const
|
|
122879
|
-
if (bytes2.length >= 24 && at2(137, 80, 78, 71, 13, 10, 26, 10) &&
|
|
122934
|
+
const text4 = (a2, b2) => String.fromCharCode(...bytes2.slice(a2, b2));
|
|
122935
|
+
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";
|
|
122880
122936
|
if (at2(255, 216, 255)) return "image/jpeg";
|
|
122881
|
-
if (bytes2.length >= 13 && ["GIF87a", "GIF89a"].includes(
|
|
122882
|
-
if (
|
|
122937
|
+
if (bytes2.length >= 13 && ["GIF87a", "GIF89a"].includes(text4(0, 6)) && (bytes2[6] || bytes2[7]) && (bytes2[8] || bytes2[9])) return "image/gif";
|
|
122938
|
+
if (text4(0, 4) === "RIFF" && text4(8, 12) === "WEBP") return "image/webp";
|
|
122883
122939
|
return void 0;
|
|
122884
122940
|
}
|
|
122885
122941
|
|
|
@@ -122926,10 +122982,10 @@ function collectReplyImages(parts, cwd) {
|
|
|
122926
122982
|
bytes2 = Buffer.from(p2.data, "base64");
|
|
122927
122983
|
} else {
|
|
122928
122984
|
if (!p2.path) throw Error();
|
|
122929
|
-
const
|
|
122930
|
-
if (/^[a-z][a-z0-9+.-]*:/i.test(
|
|
122931
|
-
const real = fs42.realpathSync(path45.resolve(cwd,
|
|
122932
|
-
if (!/\.(png|jpe?g|gif|webp)$/i.test(
|
|
122985
|
+
const source2 = p2.path.startsWith("file:") ? fileURLToPath3(p2.path) : decodeURIComponent(p2.path);
|
|
122986
|
+
if (/^[a-z][a-z0-9+.-]*:/i.test(source2) && !/^[A-Za-z]:[\\/]/.test(source2)) throw Error();
|
|
122987
|
+
const real = fs42.realpathSync(path45.resolve(cwd, source2));
|
|
122988
|
+
if (!/\.(png|jpe?g|gif|webp)$/i.test(source2) && !registered.has(real)) throw Error();
|
|
122933
122989
|
if (!roots.some((root2) => inside(root2, real)) && !registered.has(real)) throw Error();
|
|
122934
122990
|
const fd = fs42.openSync(real, fs42.constants.O_RDONLY | (fs42.constants.O_NOFOLLOW ?? 0));
|
|
122935
122991
|
try {
|
|
@@ -123413,7 +123469,7 @@ function writeAttachments(job) {
|
|
|
123413
123469
|
Attached files:
|
|
123414
123470
|
${files.map((f2) => `- ${f2}`).join("\n")}`;
|
|
123415
123471
|
}
|
|
123416
|
-
var cut = (
|
|
123472
|
+
var cut = (text4) => text4.length > EVENT_CHARS ? text4.slice(0, EVENT_CHARS) : text4;
|
|
123417
123473
|
function toWire(events, first) {
|
|
123418
123474
|
const out = [];
|
|
123419
123475
|
let log = "";
|
|
@@ -123617,8 +123673,8 @@ function streamOut(deps, id, lease) {
|
|
|
123617
123673
|
}, deps.renewMs);
|
|
123618
123674
|
return {
|
|
123619
123675
|
event: event2,
|
|
123620
|
-
out: (
|
|
123621
|
-
if (
|
|
123676
|
+
out: (text4) => {
|
|
123677
|
+
if (text4) event2({ kind: "log", data: { text: text4 } });
|
|
123622
123678
|
},
|
|
123623
123679
|
adopt: (child) => {
|
|
123624
123680
|
if (child.pid) groups.add(child.pid);
|
|
@@ -123736,12 +123792,6 @@ async function runClaimedStep(job, deps, track, keep2, lease, scope, replyStream
|
|
|
123736
123792
|
return finish(deps, id, lease, outcome, reason, report2);
|
|
123737
123793
|
};
|
|
123738
123794
|
const replay = job.manualRecovery === true && !!previous && replayable(previous) || job.retryReplay === true && (!local || replayable(local)) || !!previous?.retry?.at && replayable(previous);
|
|
123739
|
-
if (reply && job.recoveryOf && !previous && !replay) {
|
|
123740
|
-
return finishClaimed("failed", "recovery_unsafe");
|
|
123741
|
-
}
|
|
123742
|
-
if (job.manualRecovery && (!previous && !replay || previous && !replayable(previous) && (previous.effects === void 0 || previous.pending.length || previous.opaque || !previous.session))) {
|
|
123743
|
-
return finishClaimed("failed", "recovery_unsafe");
|
|
123744
|
-
}
|
|
123745
123795
|
if (job.manualRecovery && !local) checkpoint.retry = void 0;
|
|
123746
123796
|
if (reply) checkpoint.retry ??= { since: Date.now(), attempt: 1 };
|
|
123747
123797
|
const recovering = checkpoint.updating === true || !!job.recoveryOf;
|
|
@@ -123755,10 +123805,6 @@ async function runClaimedStep(job, deps, track, keep2, lease, scope, replyStream
|
|
|
123755
123805
|
delete checkpoint.attempts;
|
|
123756
123806
|
}
|
|
123757
123807
|
checkpoint.session ??= job.resume ?? void 0;
|
|
123758
|
-
if (recovering && !checkpoint.completed && (checkpoint.pending.length || checkpoint.opaque || !job.flow && checkpoint.started && !checkpoint.session && !replay)) {
|
|
123759
|
-
saveCheckpoint(id, checkpoint);
|
|
123760
|
-
return finishClaimed("failed", job.recoveryOf ? "recovery_failed" : UNCERTAIN);
|
|
123761
|
-
}
|
|
123762
123808
|
if (reply && previous?.started && checkpoint.completed?.outcome !== "done" && !await stopReply(readCheckpoint(id) ? id : job.recoveryOf ?? id, deps.stopMs)) {
|
|
123763
123809
|
return finishClaimed("failed", "recovery_unsafe");
|
|
123764
123810
|
}
|
|
@@ -123832,7 +123878,7 @@ async function runClaimedStep(job, deps, track, keep2, lease, scope, replyStream
|
|
|
123832
123878
|
if (!sent.ok) return sent;
|
|
123833
123879
|
if (!replyAssetsSynced(folder2)) return { ok: false, error: "Preview uploads are still pending." };
|
|
123834
123880
|
return previewOperation(deps.machineId, id, agent, fields);
|
|
123835
|
-
}));
|
|
123881
|
+
}), folder2.number ?? void 0);
|
|
123836
123882
|
scope.bridge = await replyApprovalBridge(job.task, job.number, (comment, asked) => withBoard(folder2, async (send3) => {
|
|
123837
123883
|
if (checkpoint.approvalCancelled) return { ok: false, error: "This reply failed before. Ask again in a new reply." };
|
|
123838
123884
|
const pushed = await send3({ id, machineId: deps.machineId });
|
|
@@ -124163,10 +124209,10 @@ ${prompt}` : prompt;
|
|
|
124163
124209
|
backgroundError = backgroundWaitMessage(BACKGROUND_WAIT.minutes);
|
|
124164
124210
|
stop(child);
|
|
124165
124211
|
});
|
|
124166
|
-
const fromAgent = (
|
|
124212
|
+
const fromAgent = (text4) => {
|
|
124167
124213
|
if (!structured) {
|
|
124168
|
-
if (
|
|
124169
|
-
stream.out(
|
|
124214
|
+
if (text4.trim()) acted = true;
|
|
124215
|
+
stream.out(text4);
|
|
124170
124216
|
}
|
|
124171
124217
|
if (attempt) measure(report(job, plan3));
|
|
124172
124218
|
for (const e2 of renderer2.events?.() ?? []) {
|
|
@@ -124292,7 +124338,7 @@ var replyReason = (reason, job) => {
|
|
|
124292
124338
|
if (job.sessionFallback && !/auth|login|log.in|permission|directory|ENOENT|not installed|rate.limit|network|connect|登录|权限|目录/i.test(reason)) return "session_unavailable";
|
|
124293
124339
|
return reason;
|
|
124294
124340
|
};
|
|
124295
|
-
var sessionMissing = (
|
|
124341
|
+
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));
|
|
124296
124342
|
function launch(command, args2, options) {
|
|
124297
124343
|
const start = spawnable(command, args2, options);
|
|
124298
124344
|
return spawn4(start.command, start.args, start.options);
|
|
@@ -124456,7 +124502,7 @@ function report(job, run3, turn2) {
|
|
|
124456
124502
|
...context?.used !== void 0 && limit ? { context: { used: context.used, limit } } : {}
|
|
124457
124503
|
};
|
|
124458
124504
|
}
|
|
124459
|
-
var cutShort = (said,
|
|
124505
|
+
var cutShort = (said, text4) => ({ ...said, reply: said.reply || text4 || void 0, stopped: true });
|
|
124460
124506
|
function folderLines(ws) {
|
|
124461
124507
|
if (!ws) return "";
|
|
124462
124508
|
const undrawn2 = undrawnPreviews(ws);
|
|
@@ -125437,8 +125483,8 @@ var PAGE = (outcome, lang, links) => {
|
|
|
125437
125483
|
const c2 = COPY[lang];
|
|
125438
125484
|
const [title, body] = c2[outcome];
|
|
125439
125485
|
const ok = outcome === "ok";
|
|
125440
|
-
const
|
|
125441
|
-
const top = links ? `<h1>${title}</h1><p>${body}</p><form id="f" novalidate><input id="e" type="email" autocomplete="email" placeholder="${c2.email}" required><input id="c" inputmode="numeric" autocomplete="one-time-code" maxlength="10" placeholder="${c2.code}" hidden><button id="b" class="dark">${c2.send}</button><small id="m"></small><button id="x" type="button" class="link" hidden>${c2.change}</button></form><div class="or">${c2.or}</div><nav><a href="${links.github}">${GITHUB_ICON}${c2.github}</a><a href="${links.google}">${GOOGLE_ICON}${c2.google}</a></nav><script>${EMAIL_SCRIPT(c2)}</script>` : `<span class="icon"><svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${
|
|
125486
|
+
const icon2 = ok ? '<polyline points="20 6 9 17 4 12"/>' : '<path d="M18 6 6 18M6 6l12 12"/>';
|
|
125487
|
+
const top = links ? `<h1>${title}</h1><p>${body}</p><form id="f" novalidate><input id="e" type="email" autocomplete="email" placeholder="${c2.email}" required><input id="c" inputmode="numeric" autocomplete="one-time-code" maxlength="10" placeholder="${c2.code}" hidden><button id="b" class="dark">${c2.send}</button><small id="m"></small><button id="x" type="button" class="link" hidden>${c2.change}</button></form><div class="or">${c2.or}</div><nav><a href="${links.github}">${GITHUB_ICON}${c2.github}</a><a href="${links.google}">${GOOGLE_ICON}${c2.google}</a></nav><script>${EMAIL_SCRIPT(c2)}</script>` : `<span class="icon"><svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${icon2}</svg></span><h1 class="below">${title}</h1><p>${body}</p>`;
|
|
125442
125488
|
return `<!doctype html><html lang="${lang === "zh" ? "zh-CN" : "en"}"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${title} \xB7 WildCrane</title><style>*{margin:0;box-sizing:border-box}body{display:flex;flex-direction:column;min-height:100dvh;background:#fff;color:#24231f;font-family:ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif}header{padding:16px 36px 0}main{flex:1;display:flex;align-items:center;justify-content:center;padding:0 36px 64px;text-align:center}.icon{display:flex;margin:0 auto;width:44px;height:44px;border-radius:50%;align-items:center;justify-content:center;background:${ok ? "#e4f3ea" : "#f7ddce"};color:${ok ? "#2f6b46" : "#b83a12"}}h1{font-size:24px;font-weight:850;line-height:1.25;letter-spacing:-0.02em}h1.below{margin-top:16px}p{margin:8px auto 0;max-width:38ch;font-size:13px;line-height:19px;color:#565550}main>div.choose{width:100%;max-width:320px}nav{margin-top:28px;display:flex;flex-direction:column;gap:12px}nav a{display:flex;height:44px;align-items:center;justify-content:center;gap:8px;border-radius:10px;font-size:14.5px;font-weight:600;color:#24231f;text-decoration:none;background:#fff;border:1px solid rgba(36,35,31,0.14)}nav a.dark{background:#24231f;color:#fff;border-color:#24231f}form{margin-top:28px;display:flex;flex-direction:column;gap:12px}input{height:44px;padding:0 14px;border-radius:10px;border:1px solid rgba(36,35,31,0.14);font:inherit;font-size:14.5px}button{height:44px;border-radius:10px;border:0;font:inherit;font-size:14.5px;font-weight:600;cursor:pointer}button.dark{background:#24231f;color:#fff}button:disabled{opacity:.6}button.link{height:auto;background:none;color:#565550;font-size:13px;font-weight:500}small{font-size:13px;line-height:19px;color:#565550}small.bad{color:#b83a12}small:empty{display:none}.or{margin-top:20px;display:flex;align-items:center;gap:12px;font-size:13px;color:#8a8984}.or::before,.or::after{content:"";flex:1;height:1px;background:rgba(36,35,31,0.12)}.or+nav{margin-top:20px}</style><header><svg viewBox="2 4 56 52" width="23.7" height="22" aria-hidden="true"><path d="${CRANE}" fill="#24231f"/><path d="${CREST}" fill="#dd4f1e"/></svg></header><main><div${links ? ' class="choose"' : ""}>${top}</div></main></html>`;
|
|
125443
125489
|
};
|
|
125444
125490
|
async function signIn(options = {}) {
|
|
@@ -125557,13 +125603,13 @@ async function verifyCode(email, code, generation, signal2) {
|
|
|
125557
125603
|
return { ok: true };
|
|
125558
125604
|
}
|
|
125559
125605
|
async function readJson2(req) {
|
|
125560
|
-
let
|
|
125606
|
+
let text4 = "";
|
|
125561
125607
|
for await (const chunk of req) {
|
|
125562
|
-
|
|
125563
|
-
if (
|
|
125608
|
+
text4 += chunk;
|
|
125609
|
+
if (text4.length > 1e4) break;
|
|
125564
125610
|
}
|
|
125565
125611
|
try {
|
|
125566
|
-
return JSON.parse(
|
|
125612
|
+
return JSON.parse(text4);
|
|
125567
125613
|
} catch {
|
|
125568
125614
|
return {};
|
|
125569
125615
|
}
|