wildcrane-runner 0.6.68 → 0.6.70

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/runner.mjs CHANGED
@@ -1,4 +1,4 @@
1
- // wildcrane-runner 0.6.68 — built by runner/scripts/build.mjs. Do not edit.
1
+ // wildcrane-runner 0.6.70 — 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 source = null;
6430
+ let source2 = null;
6431
6431
  let length = null;
6432
6432
  let type = null;
6433
6433
  if (typeof object === "string") {
6434
- source = object;
6434
+ source2 = object;
6435
6435
  type = "text/plain;charset=UTF-8";
6436
6436
  } else if (webidl.is.URLSearchParams(object)) {
6437
- source = object.toString();
6437
+ source2 = object.toString();
6438
6438
  type = "application/x-www-form-urlencoded;charset=UTF-8";
6439
6439
  } else if (webidl.is.BufferSource(object)) {
6440
- source = webidl.util.getCopyOfBytesHeldByBufferSource(object);
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
- source = object;
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
- source = object;
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 source === "string" || isUint8Array(source)) {
6509
- action = () => source;
6510
- length = typeof source === "string" ? Buffer.byteLength(source) : source.length;
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 = "", source = null, ports = []) {
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(text3) {
29090
- if ("boolean" === typeof text3 || "number" === typeof text3 || "bigint" === typeof text3)
29091
- return "" + text3;
29092
- text3 = "" + text3;
29093
- var match = matchHtmlRegExp.exec(text3);
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 < text3.length; index++) {
29097
- switch (text3.charCodeAt(index)) {
29096
+ for (index = match.index; index < text4.length; index++) {
29097
+ switch (text4.charCodeAt(index)) {
29098
29098
  case 34:
29099
29099
  match = "&quot;";
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 += text3.slice(lastIndex, index));
29116
+ lastIndex !== index && (html += text4.slice(lastIndex, index));
29117
29117
  lastIndex = index + 1;
29118
29118
  html += match;
29119
29119
  }
29120
- text3 = lastIndex !== index ? html + text3.slice(lastIndex, index) : html;
29120
+ text4 = lastIndex !== index ? html + text4.slice(lastIndex, index) : html;
29121
29121
  }
29122
- return text3;
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, text3, renderState, textEmbedded) {
31143
+ function pushTextInstance(target, text4, renderState, textEmbedded) {
31144
31144
  if (renderState.generateStaticMarkup)
31145
- return target.push(escapeTextForBrowser(text3)), false;
31146
- "" === text3 ? target = textEmbedded : (textEmbedded && target.push("<!-- -->"), target.push(escapeTextForBrowser(text3)), target = true);
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(text3) {
34380
- if ("boolean" === typeof text3 || "number" === typeof text3 || "bigint" === typeof text3)
34381
- return "" + text3;
34382
- text3 = "" + text3;
34383
- var match = matchHtmlRegExp.exec(text3);
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 < text3.length; index++) {
34387
- switch (text3.charCodeAt(index)) {
34386
+ for (index = match.index; index < text4.length; index++) {
34387
+ switch (text4.charCodeAt(index)) {
34388
34388
  case 34:
34389
34389
  match = "&quot;";
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 += text3.slice(lastIndex, index));
34406
+ lastIndex !== index && (html += text4.slice(lastIndex, index));
34407
34407
  lastIndex = index + 1;
34408
34408
  html += match;
34409
34409
  }
34410
- text3 = lastIndex !== index ? html + text3.slice(lastIndex, index) : html;
34410
+ text4 = lastIndex !== index ? html + text4.slice(lastIndex, index) : html;
34411
34411
  }
34412
- return text3;
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, text3, renderState, textEmbedded) {
34699
- if ("" === text3) return textEmbedded;
34698
+ function pushTextInstance(target, text4, renderState, textEmbedded) {
34699
+ if ("" === text4) return textEmbedded;
34700
34700
  textEmbedded && target.push(textSeparator);
34701
- target.push(escapeTextForBrowser(text3));
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(text3) {
40818
- if ("boolean" === typeof text3 || "number" === typeof text3 || "bigint" === typeof text3)
40819
- return "" + text3;
40820
- checkHtmlStringCoercion(text3);
40821
- text3 = "" + text3;
40822
- var match = matchHtmlRegExp.exec(text3);
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 < text3.length; index++) {
40826
- switch (text3.charCodeAt(index)) {
40825
+ for (index = match.index; index < text4.length; index++) {
40826
+ switch (text4.charCodeAt(index)) {
40827
40827
  case 34:
40828
40828
  match = "&quot;";
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 += text3.slice(lastIndex, index));
40845
+ lastIndex !== index && (html += text4.slice(lastIndex, index));
40846
40846
  lastIndex = index + 1;
40847
40847
  html += match;
40848
40848
  }
40849
- text3 = lastIndex !== index ? html + text3.slice(lastIndex, index) : html;
40849
+ text4 = lastIndex !== index ? html + text4.slice(lastIndex, index) : html;
40850
40850
  }
40851
- return text3;
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, text3, renderState, textEmbedded) {
43035
+ function pushTextInstance(target, text4, renderState, textEmbedded) {
43036
43036
  if (renderState.generateStaticMarkup)
43037
- return target.push(escapeTextForBrowser(text3)), false;
43038
- "" === text3 ? target = textEmbedded : (textEmbedded && target.push("<!-- -->"), target.push(escapeTextForBrowser(text3)), target = true);
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(text3) {
48363
- if ("boolean" === typeof text3 || "number" === typeof text3 || "bigint" === typeof text3)
48364
- return "" + text3;
48365
- checkHtmlStringCoercion(text3);
48366
- text3 = "" + text3;
48367
- var match = matchHtmlRegExp.exec(text3);
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 < text3.length; index++) {
48371
- switch (text3.charCodeAt(index)) {
48370
+ for (index = match.index; index < text4.length; index++) {
48371
+ switch (text4.charCodeAt(index)) {
48372
48372
  case 34:
48373
48373
  match = "&quot;";
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 += text3.slice(lastIndex, index));
48390
+ lastIndex !== index && (html += text4.slice(lastIndex, index));
48391
48391
  lastIndex = index + 1;
48392
48392
  html += match;
48393
48393
  }
48394
- text3 = lastIndex !== index ? html + text3.slice(lastIndex, index) : html;
48394
+ text4 = lastIndex !== index ? html + text4.slice(lastIndex, index) : html;
48395
48395
  }
48396
- return text3;
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, text3, renderState, textEmbedded) {
48682
- if ("" === text3) return textEmbedded;
48681
+ function pushTextInstance(target, text4, renderState, textEmbedded) {
48682
+ if ("" === text4) return textEmbedded;
48683
48683
  textEmbedded && target.push(textSeparator);
48684
- target.push(escapeTextForBrowser(text3));
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(text3) {
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 < text3.length; i++) {
68329
- const c2 = text3[i];
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(text3, i + 1);
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(text3) {
68359
+ function formatJSXTextReplacement(text4) {
68360
68360
  let numNewlines = 0;
68361
68361
  let numSpaces = 0;
68362
- for (const c2 of text3) {
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(text3) {
68372
+ function formatJSXStringValueLiteral(text4) {
68373
68373
  let result = "";
68374
- for (let i = 0; i < text3.length; i++) {
68375
- const c2 = text3[i];
68374
+ for (let i = 0; i < text4.length; i++) {
68375
+ const c2 = text4[i];
68376
68376
  if (c2 === "\n") {
68377
- if (/\s/.test(text3[i + 1])) {
68377
+ if (/\s/.test(text4[i + 1])) {
68378
68378
  result += " ";
68379
- while (i < text3.length && /\s/.test(text3[i + 1])) {
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(text3, i + 1);
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(text3, indexAfterAmpersand) {
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 (text3[i] === "#") {
68400
+ if (text4[i] === "#") {
68401
68401
  let radix = 10;
68402
68402
  i++;
68403
68403
  let numStart;
68404
- if (text3[i] === "x") {
68404
+ if (text4[i] === "x") {
68405
68405
  radix = 16;
68406
68406
  i++;
68407
68407
  numStart = i;
68408
- while (i < text3.length && isHexDigit(text3.charCodeAt(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 < text3.length && isDecimalDigit(text3.charCodeAt(i))) {
68413
+ while (i < text4.length && isDecimalDigit(text4.charCodeAt(i))) {
68414
68414
  i++;
68415
68415
  }
68416
68416
  }
68417
- if (text3[i] === ";") {
68418
- const numStr = text3.slice(numStart, i);
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 < text3.length && count2++ < 10) {
68426
- const ch = text3[i];
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 (source) => (0, import_resolve_uri.default)(prefix + (source || ""), from);
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 source = sources2[sourceIndex2];
69684
- const segs = source[sourceLine] || (source[sourceLine] = []);
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 source = sources2[i];
69690
- for (let j2 = 0; j2 < source.length; j2++) {
69691
- const line = source[j2];
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, source, line, column, bias || GREATEST_LOWER_BOUND, false);
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, source, line, column, bias || LEAST_UPPER_BOUND, true);
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 source = null;
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
- source = resolvedSources[seg[1]];
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, source) {
69987
+ function sourceIndex(map2, source2) {
69988
69988
  const { sources: sources2, resolvedSources } = map2;
69989
- let index = sources2.indexOf(source);
69990
- if (index === -1) index = resolvedSources.indexOf(source);
69989
+ let index = sources2.indexOf(source2);
69990
+ if (index === -1) index = resolvedSources.indexOf(source2);
69991
69991
  return index;
69992
69992
  }
69993
- function sourceContentFor(map2, source) {
69993
+ function sourceContentFor(map2, source2) {
69994
69994
  const { sourcesContent } = map2;
69995
69995
  if (sourcesContent == null) return null;
69996
- const index = sourceIndex(map2, source);
69996
+ const index = sourceIndex(map2, source2);
69997
69997
  return index === -1 ? null : sourcesContent[index];
69998
69998
  }
69999
- function isIgnored(map2, source) {
69999
+ function isIgnored(map2, source2) {
70000
70000
  const { ignoreList } = map2;
70001
70001
  if (ignoreList == null) return false;
70002
- const index = sourceIndex(map2, source);
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(source, line, column, name) {
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, source, line, column, bias, all2) {
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(source);
70063
- if (sourceIndex2 === -1) sourceIndex2 = resolvedSources.indexOf(source);
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, source, sourceLine, sourceColumn, name, content) {
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
- source,
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, source, sourceLine, sourceColumn, name, content) => {
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
- source,
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, source, content) {
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, source);
70249
+ const index = put(sources2, source2);
70250
70250
  sourcesContent[index] = content;
70251
70251
  }
70252
- function setIgnore(map2, source, ignore = true) {
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, source);
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 source = void 0;
70314
+ let source2 = void 0;
70315
70315
  let original = void 0;
70316
70316
  let name = void 0;
70317
70317
  if (seg.length !== 1) {
70318
- source = sources2.array[seg[SOURCES_INDEX]];
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, source, sourceLine, sourceColumn, name, content) {
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 (!source) {
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, source);
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 (!source) {
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
- source,
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, source, tokens) {
70439
- const sourceColumns = computeSourceColumns(source, tokens);
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 source = sheets.length ? sheets.map((s) => s.content).join("\n") : '@import "tailwindcss";';
110928
- const compiler = await rc(source, {
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,8 +112162,8 @@ function status(line) {
112160
112162
  }
112161
112163
 
112162
112164
  // src/protocol.ts
112163
- var VERSION = true ? "0.6.68" : "0.0.0";
112164
- var AKB_VERSION = true ? "0.11.54" : "0.0.0";
112165
+ var VERSION = true ? "0.6.70" : "0.0.0";
112166
+ var AKB_VERSION = true ? "0.11.56" : "0.0.0";
112165
112167
  var AKB_CONTRACT = true ? 15 : 0;
112166
112168
  var EXIT_REFUSED = 10;
112167
112169
  var EXIT_OUTDATED = 11;
@@ -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(text3, file3) {
112241
+ function shimTarget(text4, file3) {
112240
112242
  const dir = path4.win32.dirname(file3);
112241
- const found = /"%(?:~dp0|dp0%)\\?([^"%]+)"\s+%\*/i.exec(text3);
112242
- if (!found || !/\\node\.exe"/i.test(text3)) return null;
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(text3)?.[1];
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 text3 = "";
112268
+ let text4 = "";
112267
112269
  try {
112268
- text3 = fs3.readFileSync(file3, "utf8");
112270
+ text4 = fs3.readFileSync(file3, "utf8");
112269
112271
  } catch {
112270
112272
  }
112271
- const shim = shimTarget(text3, file3);
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, text3) {
112583
- const suffix = createHash("sha256").update(text3).digest("hex").slice(0, 16);
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") === text3) return file3;
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, text3);
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 text3;
112610
+ let text4;
112609
112611
  try {
112610
- text3 = fs6.readFileSync(settingsFile(), "utf8");
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(text3);
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 = (text3) => systemLanguages.has(text3);
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(text3) {
112791
+ message(text4) {
112790
112792
  close();
112791
- if (text3.trim()) queue.push({ kind: "message", data: { text: text3.trim() } });
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(text3) {
112829
+ log(text4) {
112828
112830
  close();
112829
- if (text3.trim()) queue.push({ kind: "log", data: { text: text3 } });
112831
+ if (text4.trim()) queue.push({ kind: "log", data: { text: text4 } });
112830
112832
  },
112831
- error(text3) {
112833
+ error(text4) {
112832
112834
  close();
112833
- if (text3.trim()) queue.push({ kind: "error", data: { text: text3.trim() } });
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 text3 = str2(step.text_delta);
112953
- if (text3) events.update({ sessionUpdate: "agent_message_chunk", content: { text: text3 } });
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 text3;
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 text3 = reader.flush();
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 text3;
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(text3, _argv, env2) {
113081
- const rule = `${text3}
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 = (text3) => text3.replace(/data:image\/[a-z0-9.+-]+;base64,[A-Za-z0-9+/=]+/gi, "[image]").replace(/!\[([^\]]*)\]\((?:<)?(?:\/|[A-Za-z]:[\\/]|file:)[^\n)]*\)/g, "[$1]");
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 text3 = str2(raw);
114029
- if (!text3.trim()) return {};
114030
+ const text4 = str2(raw);
114031
+ if (!text4.trim()) return {};
114030
114032
  try {
114031
- return JSON.parse(text3);
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 text3 = str2(row.content);
114108
- if (subagents.delete(id)) events.toolResult(id, /^status: completed$/m.test(text3) ? "completed" : "failed", "");
114109
- else events.toolResult(id, "completed", text3);
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(text3) {
114309
+ line(text4) {
114308
114310
  close();
114309
- log(`${text3}
114311
+ log(`${text4}
114310
114312
  `);
114311
114313
  },
114312
114314
  /** End of the turn: whatever is half-written is finished off. */
@@ -114320,7 +114322,7 @@ function createTail(log) {
114320
114322
  // ../cli/package.json
114321
114323
  var package_default = {
114322
114324
  name: "wildcrane",
114323
- version: "0.11.54",
114325
+ version: "0.11.56",
114324
114326
  akbContract: 15,
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: [
@@ -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 text3 = str2(obj2(part.content).text) || str2(part.text);
114403
- if (text3.trim()) return text3.trim();
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, text3) => {
114708
+ const say = (partId, kind, text4) => {
114707
114709
  const before = written.get(partId) ?? "";
114708
- const fresh = text3.startsWith(before) ? text3.slice(before.length) : text3;
114710
+ const fresh = text4.startsWith(before) ? text4.slice(before.length) : text4;
114709
114711
  if (!fresh) return;
114710
- written.set(partId, text3);
114712
+ written.set(partId, text4);
114711
114713
  if (kind === "reasoning" || kind === "thought") tail.thought(fresh);
114712
114714
  else tail.text(fresh);
114713
114715
  };
@@ -115404,7 +115406,7 @@ async function run(io, options, tasks) {
115404
115406
  status: raw.status === "inProgress" ? "in_progress" : raw.status
115405
115407
  } });
115406
115408
  };
115407
- const start = async (text3, images = []) => {
115409
+ const start = async (text4, images = []) => {
115408
115410
  active = true;
115409
115411
  waiting = false;
115410
115412
  submitted = true;
@@ -115414,7 +115416,7 @@ async function run(io, options, tasks) {
115414
115416
  startupTimer = setTimeout(() => {
115415
115417
  if (!started) io.event?.({ kind: "log", data: { text: "[conversation] start_unconfirmed" } });
115416
115418
  }, CONVERSATION_MS.start);
115417
- await bounded(rpc.call("turn/start", { threadId, input: [{ type: "text", text: text3 }, ...images.map((path58) => ({ type: "localImage", path: path58 }))] }), CONVERSATION_MS.start, "Codex turn/start timed out; submission outcome is unknown.").catch((error) => {
115419
+ 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
115420
  if (!started) throw error;
115419
115421
  });
115420
115422
  };
@@ -115610,22 +115612,22 @@ var PASSING = [
115610
115612
  ];
115611
115613
  var RETRY_AFTER = /retry[-_\s]?after["':=\s]+(\d+)/i;
115612
115614
  var REASON_MAX = 140;
115613
- function reasonLine(text3, rule) {
115614
- const line = text3.split("\n").find((l2) => rule.test(l2.toLowerCase())) ?? text3;
115615
+ function reasonLine(text4, rule) {
115616
+ const line = text4.split("\n").find((l2) => rule.test(l2.toLowerCase())) ?? text4;
115615
115617
  const said = line.trim().replace(/\s+/g, " ");
115616
115618
  return said.length > REASON_MAX ? `${said.slice(0, REASON_MAX - 1)}\u2026` : said;
115617
115619
  }
115618
115620
  function providerBlip(...said) {
115619
- for (const text3 of said) {
115620
- if (!text3?.trim()) continue;
115621
- const lower = text3.toLowerCase();
115621
+ for (const text4 of said) {
115622
+ if (!text4?.trim()) continue;
115623
+ const lower = text4.toLowerCase();
115622
115624
  if (MANUAL.some((rule) => rule.test(lower))) return void 0;
115623
115625
  const hit = PASSING.find((rule) => rule.test(lower));
115624
115626
  if (!hit) continue;
115625
- const asked = RETRY_AFTER.exec(text3);
115627
+ const asked = RETRY_AFTER.exec(text4);
115626
115628
  const seconds = asked ? Number(asked[1]) : NaN;
115627
115629
  return {
115628
- reason: reasonLine(text3, hit),
115630
+ reason: reasonLine(text4, hit),
115629
115631
  ...Number.isFinite(seconds) && seconds > 0 ? { retryAfterMs: seconds * 1e3 } : {}
115630
115632
  };
115631
115633
  }
@@ -115685,11 +115687,11 @@ var CLAUDE_CODE = {
115685
115687
  return [...claudeStreamArgs(argv), "--resume", resumeId, "--fork-session", "--session-id", sessionId];
115686
115688
  },
115687
115689
  // 默认快照会忽略续跑传入的新规则;仅显式关闭快照的会话支持更新。
115688
- systemPrompt(text3, argv) {
115690
+ systemPrompt(text4, argv) {
115689
115691
  if (namesFlag(argv, ["--append-system-prompt", "--append-system-prompt-file"])) return {};
115690
115692
  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
115693
  if (namesFlag(argv, ["--resume", "-r", "--continue", "-c"]) && snapshot !== "off") return {};
115692
- return { args: ["--append-system-prompt", text3] };
115694
+ return { args: ["--append-system-prompt", text4] };
115693
115695
  },
115694
115696
  // What Claude Code takes: who pays for the run, where that run goes, a model id, and how
115695
115697
  // hard that model thinks. The provider comes first because it decides the rest — which
@@ -116081,14 +116083,14 @@ var CODEX = {
116081
116083
  return [...codexExtraArgs(argv, cwd), "fork", resumeId];
116082
116084
  },
116083
116085
  // 自设系统指令保持原样;无法追加时由调用方明确提示。
116084
- systemPrompt(text3, argv) {
116086
+ systemPrompt(text4, argv) {
116085
116087
  if (namesFlag(argv, ["developer_instructions", "model_instructions_file"])) return {};
116086
116088
  try {
116087
116089
  const config = fs12.readFileSync(path15.join(process.env.CODEX_HOME || home(".codex"), "config.toml"), "utf8");
116088
116090
  if (/^\s*(?:developer_instructions|model_instructions_file)\s*=/m.test(config)) return {};
116089
116091
  } catch {
116090
116092
  }
116091
- return { args: ["-c", `developer_instructions=${JSON.stringify(text3)}`] };
116093
+ return { args: ["-c", `developer_instructions=${JSON.stringify(text4)}`] };
116092
116094
  },
116093
116095
  // What Codex takes, in the order Claude Code's dialog draws the same four: who pays for
116094
116096
  // the run and where it goes, that endpoint's address, the key, a model, and how hard that
@@ -116411,11 +116413,11 @@ var DSH = {
116411
116413
  // dsh-acp's persona IS its system prompt, so the ask is added to the one in effect: the
116412
116414
  // user's own `DSH_SYSTEM_PROMPT`, else the bridge's default. A `--persona` on the command
116413
116415
  // line outranks both, and is left alone.
116414
- systemPrompt(text3, argv, env2) {
116416
+ systemPrompt(text4, argv, env2) {
116415
116417
  if (namesFlag(argv, ["--persona"])) return {};
116416
116418
  return { env: { DSH_SYSTEM_PROMPT: `${env2.DSH_SYSTEM_PROMPT || DSH_PERSONA}
116417
116419
 
116418
- ${text3}` } };
116420
+ ${text4}` } };
116419
116421
  },
116420
116422
  // ACP carries all three in the conversation itself (agent/wire/acp.ts), so a dsh run shows a
116421
116423
  // price, its tokens and the model the session opened on.
@@ -116466,8 +116468,8 @@ var GROK = {
116466
116468
  return [];
116467
116469
  },
116468
116470
  // `--rules` appends to Grok's system prompt. A top-level option, so it goes before `agent`.
116469
- systemPrompt(text3, argv) {
116470
- return namesFlag(argv, ["--rules"]) ? {} : { args: ["--rules", text3] };
116471
+ systemPrompt(text4, argv) {
116472
+ return namesFlag(argv, ["--rules"]) ? {} : { args: ["--rules", text4] };
116471
116473
  },
116472
116474
  // What Grok takes: a model, and the xAI key. Both boxes can stay empty — someone already
116473
116475
  // set up with grok has a login in `~/.grok` and a default model in its own
@@ -116574,7 +116576,7 @@ var KIMI = {
116574
116576
  },
116575
116577
  // An agent file wrapping Kimi's own prompt in `${base_prompt}`. Only a new session takes one;
116576
116578
  // a resumed one keeps the agent it opened with, and Kimi refuses the flag beside `--session`.
116577
- systemPrompt(text3, argv) {
116579
+ systemPrompt(text4, argv) {
116578
116580
  if (namesFlag(argv, ["--session", "-S", "--resume", "-r", "--continue", "-C", "--agent", "--agent-file"])) return {};
116579
116581
  const file3 = machineFile("kimi-language.md", `---
116580
116582
  name: akb-language
@@ -116583,7 +116585,7 @@ description: Kimi's default agent, told which language to write in
116583
116585
 
116584
116586
  \${base_prompt}
116585
116587
 
116586
- ${text3}
116588
+ ${text4}
116587
116589
  `);
116588
116590
  return { args: ["--agent-file", file3] };
116589
116591
  },
@@ -116807,8 +116809,8 @@ var OPENCODE = {
116807
116809
  env: () => ({ ...process.env }),
116808
116810
  // `instructions` files join the system prompt, and OpenCode adds this config's list to the
116809
116811
  // user's own rather than replacing it.
116810
- systemPrompt(text3, _argv, env2) {
116811
- const file3 = machineFile("opencode-language.md", `${text3}
116812
+ systemPrompt(text4, _argv, env2) {
116813
+ const file3 = machineFile("opencode-language.md", `${text4}
116812
116814
  `);
116813
116815
  let own2 = {};
116814
116816
  try {
@@ -117078,9 +117080,9 @@ function languageEnv(given) {
117078
117080
  }
117079
117081
  function withSystemLanguage(harness, argv, env2, language) {
117080
117082
  env2 = languageEnv(env2);
117081
- const text3 = systemLanguage(language);
117082
- if (!text3) return { argv, env: env2 };
117083
- const added = argv.length ? harness.systemPrompt?.(text3, argv, env2) : void 0;
117083
+ const text4 = systemLanguage(language);
117084
+ if (!text4) return { argv, env: env2 };
117085
+ const added = argv.length ? harness.systemPrompt?.(text4, argv, env2) : void 0;
117084
117086
  if (!added?.args?.length && !Object.keys(added?.env ?? {}).length) {
117085
117087
  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
117088
  return { argv, env: env2, note };
@@ -118077,7 +118079,7 @@ var quote = (s) => /^[\w./:@=-]+$/.test(s) ? s : `"${s}"`;
118077
118079
  function shimDir(akb) {
118078
118080
  const dir = akb.shim;
118079
118081
  const line = [akb.command, ...akb.args].map(quote).join(" ");
118080
- const [file3, text3] = process.platform === "win32" ? [path23.join(dir, "akb.cmd"), `@${line} %*\r
118082
+ const [file3, text4] = process.platform === "win32" ? [path23.join(dir, "akb.cmd"), `@${line} %*\r
118081
118083
  `] : [path23.join(dir, "akb"), `#!/bin/sh
118082
118084
  exec ${line} "$@"
118083
118085
  `];
@@ -118089,11 +118091,11 @@ exec ${shellLine} "$@"
118089
118091
  `, { mode: 493 });
118090
118092
  }
118091
118093
  try {
118092
- if (fs19.readFileSync(file3, "utf8") === text3) return dir;
118094
+ if (fs19.readFileSync(file3, "utf8") === text4) return dir;
118093
118095
  } catch {
118094
118096
  }
118095
118097
  fs19.mkdirSync(dir, { recursive: true });
118096
- fs19.writeFileSync(file3, text3, { mode: 493 });
118098
+ fs19.writeFileSync(file3, text4, { mode: 493 });
118097
118099
  return dir;
118098
118100
  }
118099
118101
  function akbEnv(akb, board, task, language, base = process.env) {
@@ -118115,8 +118117,8 @@ function runAkb(akb, args2, opts) {
118115
118117
  return new Promise((resolve2) => {
118116
118118
  let out = "";
118117
118119
  let last2 = "";
118118
- const note = (text3) => {
118119
- const line = text3.split("\n").map((l2) => l2.trim()).filter(Boolean).at(-1);
118120
+ const note = (text4) => {
118121
+ const line = text4.split("\n").map((l2) => l2.trim()).filter(Boolean).at(-1);
118120
118122
  if (line) last2 = line;
118121
118123
  };
118122
118124
  let child;
@@ -118297,24 +118299,24 @@ function readIcon(raw) {
118297
118299
 
118298
118300
  // ../cli/src/lib/yaml.ts
118299
118301
  function yamlScalar(s) {
118300
- const text3 = String(s);
118301
- if (text3 === "") return '""';
118302
- if (/^[-?:,[\]{}#&*!|>'"%@`]/.test(text3) || /:\s/.test(text3) || /[\n"]/.test(text3) || /^\s|\s$/.test(text3)) {
118303
- return JSON.stringify(text3);
118302
+ const text4 = String(s);
118303
+ if (text4 === "") return '""';
118304
+ if (/^[-?:,[\]{}#&*!|>'"%@`]/.test(text4) || /:\s/.test(text4) || /[\n"]/.test(text4) || /^\s|\s$/.test(text4)) {
118305
+ return JSON.stringify(text4);
118304
118306
  }
118305
- return text3;
118307
+ return text4;
118306
118308
  }
118307
118309
  function unquote2(v) {
118308
- const text3 = String(v).trim();
118309
- if (text3.startsWith('"') && text3.endsWith('"')) {
118310
+ const text4 = String(v).trim();
118311
+ if (text4.startsWith('"') && text4.endsWith('"')) {
118310
118312
  try {
118311
- return JSON.parse(text3);
118313
+ return JSON.parse(text4);
118312
118314
  } catch {
118313
- return text3.slice(1, -1);
118315
+ return text4.slice(1, -1);
118314
118316
  }
118315
118317
  }
118316
- if (text3.startsWith("'") && text3.endsWith("'")) return text3.slice(1, -1);
118317
- return text3;
118318
+ if (text4.startsWith("'") && text4.endsWith("'")) return text4.slice(1, -1);
118319
+ return text4;
118318
118320
  }
118319
118321
 
118320
118322
  // ../cli/src/lib/agents/yaml.ts
@@ -118334,9 +118336,9 @@ function stripComment(value) {
118334
118336
  const hash = value.slice(from).search(/(^|[ \t])#/);
118335
118337
  return hash < 0 ? value : value.slice(0, from + hash).trim();
118336
118338
  }
118337
- var readLines = (text3) => text3.split("\n").map((raw) => ({ indent: raw.match(/^[ \t]*/)[0].length, text: raw.trim() })).filter((line) => line.text && !line.text.startsWith("#"));
118338
- function parseYamlBlock(text3) {
118339
- const [map2] = readMap(readLines(text3), 0, 0);
118339
+ var readLines = (text4) => text4.split("\n").map((raw) => ({ indent: raw.match(/^[ \t]*/)[0].length, text: raw.trim() })).filter((line) => line.text && !line.text.startsWith("#"));
118340
+ function parseYamlBlock(text4) {
118341
+ const [map2] = readMap(readLines(text4), 0, 0);
118340
118342
  return map2;
118341
118343
  }
118342
118344
  function readMap(lines, start, indent) {
@@ -118422,12 +118424,12 @@ function readList(lines, start, indent) {
118422
118424
  }
118423
118425
  return [out, i];
118424
118426
  }
118425
- function splitFrontmatter(text3) {
118426
- const lines = text3.replace(/^/, "").split("\n");
118427
- if (lines[0]?.trim() !== "---") return { meta: null, body: text3 };
118427
+ function splitFrontmatter(text4) {
118428
+ const lines = text4.replace(/^/, "").split("\n");
118429
+ if (lines[0]?.trim() !== "---") return { meta: null, body: text4 };
118428
118430
  let i = 1;
118429
118431
  while (i < lines.length && lines[i].trim() !== "---") i++;
118430
- if (i >= lines.length) return { meta: null, body: text3 };
118432
+ if (i >= lines.length) return { meta: null, body: text4 };
118431
118433
  return { meta: lines.slice(1, i).join("\n"), body: lines.slice(i + 1).join("\n") };
118432
118434
  }
118433
118435
 
@@ -118436,14 +118438,14 @@ var OLD_ROLE_KEYS = ["lead", "hook", "stage", "kind"];
118436
118438
  var AGENT_NAME = /^[a-z0-9]+(-[a-z0-9]+)*$/;
118437
118439
  var SCHEDULE_READS = ["archived-cards", "chats", "dismissals"];
118438
118440
  var isScheduleReads = (value) => SCHEDULE_READS.includes(value);
118439
- function parseSpecAgent(text3, from, file3, builtIn = false, list2 = () => []) {
118441
+ function parseSpecAgent(text4, from, file3, builtIn = false, list2 = () => []) {
118440
118442
  let named = "";
118441
118443
  const bad = (why2, old2) => ({
118442
118444
  problem: `${from}: ${why2}`,
118443
118445
  ...named ? { name: named } : {},
118444
118446
  ...old2 ? { old: old2 } : {}
118445
118447
  });
118446
- const { meta, body } = splitFrontmatter(text3);
118448
+ const { meta, body } = splitFrontmatter(text4);
118447
118449
  if (meta === null) return bad("no `---` frontmatter, so it declares no name or description");
118448
118450
  const front = parseYamlBlock(meta);
118449
118451
  const name = str3(front.name);
@@ -118480,20 +118482,20 @@ function parseSpecAgent(text3, from, file3, builtIn = false, list2 = () => []) {
118480
118482
  const title = map(row?.title);
118481
118483
  const instructions2 = str3(row?.instructions);
118482
118484
  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((text4) => typeof text4 !== "string" || !text4.trim())) return bad(`stage ${id} needs a title map with en`);
118485
+ 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
118486
  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
118487
  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, text4]) => [lang, str3(text4)])), instructions: instructions2, ...str3(row.when) ? { when: str3(row.when) } : {} });
118488
+ 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
118489
  }
118488
118490
  }
118489
118491
  const components = akb.components === void 0 ? ["Asset"] : akb.components;
118490
118492
  if (!Array.isArray(components) || components.some((value) => typeof value !== "string" || !value.trim())) {
118491
118493
  return bad(`\`${name}\` declares \`akb.components\` that is not a list of component IDs`);
118492
118494
  }
118493
- const icon = readIcon(akb.icon);
118494
- if (icon && typeof icon === "object" && "problem" in icon) {
118495
+ const icon2 = readIcon(akb.icon);
118496
+ if (icon2 && typeof icon2 === "object" && "problem" in icon2) {
118495
118497
  return bad(
118496
- `\`${name}\` declares an \`akb.icon\` where ${icon.problem} \u2014 use one of ${ICON_NAMES.join(", ")}, or 1 to 12 parts \`{ d, f?, o?: true, s?, w? }\` coloured with ${ICON_COLORS.join(", ")}`
118498
+ `\`${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
118499
  );
118498
118500
  }
118499
118501
  const workspace = memoryPaths(akb.memoryFiles);
@@ -118508,7 +118510,7 @@ function parseSpecAgent(text3, from, file3, builtIn = false, list2 = () => []) {
118508
118510
  after,
118509
118511
  ...stages ? { stages } : {},
118510
118512
  components: [...new Set(components.map((value) => value.trim()))],
118511
- ...icon ? { icon } : {},
118513
+ ...icon2 ? { icon: icon2 } : {},
118512
118514
  ...akb.merges === "true" ? { merges: true } : {},
118513
118515
  i18n: readTranslations(akb.i18n),
118514
118516
  ...declaredReads ? { reads: declaredReads } : {},
@@ -118578,9 +118580,9 @@ function readPreviews(value) {
118578
118580
  }
118579
118581
  return readGroup(value);
118580
118582
  }
118581
- function parseStudioFile(id, source, from) {
118583
+ function parseStudioFile(id, source2, from) {
118582
118584
  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(source);
118585
+ const { meta, body } = splitFrontmatter(source2);
118584
118586
  if (meta === null) return { problem: `${from}: no \`---\` frontmatter` };
118585
118587
  const raw = parseYamlBlock(meta);
118586
118588
  const name = text2(raw.name).replace(/\s+/g, " ");
@@ -118591,10 +118593,10 @@ function parseStudioFile(id, source, from) {
118591
118593
  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
118594
  };
118593
118595
  }
118594
- const icon = readIcon(raw.icon);
118595
- if (icon && typeof icon === "object" && "problem" in icon) {
118596
+ const icon2 = readIcon(raw.icon);
118597
+ if (icon2 && typeof icon2 === "object" && "problem" in icon2) {
118596
118598
  return {
118597
- problem: `${from}: its \`icon\` is wrong \u2014 ${icon.problem}; use one of ${ICON_NAMES.join(", ")}, or 1 to 12 parts \`{ d, f?, o?: true, s?, w? }\` coloured with ${ICON_COLORS.join(", ")}`
118599
+ 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
118600
  };
118599
118601
  }
118600
118602
  const previews = readPreviews(raw.previews);
@@ -118623,7 +118625,7 @@ function parseStudioFile(id, source, from) {
118623
118625
  description: text2(raw.description),
118624
118626
  when: text2(raw.when),
118625
118627
  needsArtifact: text2(raw.needsArtifact) === "true",
118626
- ...icon ? { icon } : {},
118628
+ ...icon2 ? { icon: icon2 } : {},
118627
118629
  previews,
118628
118630
  land,
118629
118631
  scheduled,
@@ -118650,7 +118652,7 @@ var hashInput = (files) => JSON.stringify(Object.entries(files).sort(([a2], [b2]
118650
118652
  var landsOf = (def) => ({ lands: def.land.some((h3) => !h3.off) });
118651
118653
  var SEGMENT = /^[\w.-]+$/;
118652
118654
  var isAboutFile = (file3) => /^ABOUT(\.[a-z]{2})?\.md$/.test(file3) || /^screenshots\/[\w.-]+\.(png|jpe?g|webp)$/.test(file3);
118653
- var bytes = (text3) => new TextEncoder().encode(text3).length;
118655
+ var bytes = (text4) => new TextEncoder().encode(text4).length;
118654
118656
  var isSharedFile = (file3) => {
118655
118657
  const parts = file3.split("/");
118656
118658
  return parts.length > 1 && parts[0] === "shared" && parts.slice(1).every((p2) => SEGMENT.test(p2) && p2 !== "." && p2 !== "..");
@@ -118661,10 +118663,10 @@ function folderPath(file3, top) {
118661
118663
  if (parts.slice(2).some((p2) => !SEGMENT.test(p2) || p2 === "." || p2 === "..")) return null;
118662
118664
  return [parts[1], parts.slice(2).join("/")];
118663
118665
  }
118664
- function mcpProblem(text3) {
118666
+ function mcpProblem(text4) {
118665
118667
  let read5;
118666
118668
  try {
118667
- read5 = JSON.parse(text3);
118669
+ read5 = JSON.parse(text4);
118668
118670
  } catch {
118669
118671
  return "is not JSON";
118670
118672
  }
@@ -118697,8 +118699,8 @@ function inspect(value, official) {
118697
118699
  let total = 0;
118698
118700
  const folders2 = /* @__PURE__ */ new Map();
118699
118701
  const skills = /* @__PURE__ */ new Set();
118700
- for (const [file3, text3] of entries) {
118701
- if (typeof text3 !== "string" || text3.includes("\0")) {
118702
+ for (const [file3, text4] of entries) {
118703
+ if (typeof text4 !== "string" || text4.includes("\0")) {
118702
118704
  fail(file3, "is not a text file");
118703
118705
  continue;
118704
118706
  }
@@ -118706,13 +118708,13 @@ function inspect(value, official) {
118706
118708
  fail(file3, `the path is longer than ${FILE_LIMITS.path} characters`);
118707
118709
  continue;
118708
118710
  }
118709
- const size = bytes(text3);
118711
+ const size = bytes(text4);
118710
118712
  if (size > FILE_LIMITS.file) return fail(file3, `is larger than ${FILE_LIMITS.file / KB} KB`, true);
118711
118713
  total += size;
118712
118714
  if (total > FILE_LIMITS.total) return fail("files", `are larger than ${FILE_LIMITS.total / KB / KB} MB together`, true);
118713
118715
  if (file3 === STUDIO_FILE || file3 === CARD_TEMPLATE_FILE) continue;
118714
118716
  if (official && file3 === MCP_FILE) {
118715
- const problem = mcpProblem(text3);
118717
+ const problem = mcpProblem(text4);
118716
118718
  if (problem) fail(file3, problem);
118717
118719
  continue;
118718
118720
  }
@@ -118729,24 +118731,24 @@ function inspect(value, official) {
118729
118731
  continue;
118730
118732
  }
118731
118733
  if (!folders2.has(at2[0])) folders2.set(at2[0], /* @__PURE__ */ new Map());
118732
- folders2.get(at2[0]).set(at2[1], text3);
118734
+ folders2.get(at2[0]).set(at2[1], text4);
118733
118735
  }
118734
118736
  for (const name of skills) {
118735
118737
  if (files[`skills/${name}/SKILL.md`] === void 0) fail(`skills/${name}/SKILL.md`, "is missing");
118736
118738
  }
118737
- const source = files[STUDIO_FILE];
118738
- const read5 = typeof source === "string" ? parseStudioFile("studio", source, STUDIO_FILE) : null;
118739
+ const source2 = files[STUDIO_FILE];
118740
+ const read5 = typeof source2 === "string" ? parseStudioFile("studio", source2, STUDIO_FILE) : null;
118739
118741
  if (!read5) fail(STUDIO_FILE, "is missing");
118740
118742
  else if ("problem" in read5) fail(STUDIO_FILE, read5.problem.replace(`${STUDIO_FILE}: `, ""));
118741
118743
  const agents = /* @__PURE__ */ new Map();
118742
118744
  for (const [name, own2] of folders2) {
118743
118745
  const from = `agents/${name}/AGENT.md`;
118744
- const text3 = own2.get("AGENT.md");
118745
- if (text3 === void 0) {
118746
+ const text4 = own2.get("AGENT.md");
118747
+ if (text4 === void 0) {
118746
118748
  fail(from, "is missing");
118747
118749
  continue;
118748
118750
  }
118749
- const parsed = parseSpecAgent(text3, from, (p2) => own2.get(p2) ?? null, false, () => [...own2.keys()].filter((p2) => p2 !== "AGENT.md"));
118751
+ const parsed = parseSpecAgent(text4, from, (p2) => own2.get(p2) ?? null, false, () => [...own2.keys()].filter((p2) => p2 !== "AGENT.md"));
118750
118752
  if ("problem" in parsed) fail(from, parsed.problem.replace(`${from}: `, ""));
118751
118753
  else if (parsed.agent.name !== name) fail(from, `calls itself \`${parsed.agent.name}\`; it must match its folder`);
118752
118754
  else agents.set(name, parsed.agent);
@@ -118810,7 +118812,7 @@ function packOfficial(root2 = OFFICIAL, loose = false) {
118810
118812
  if ("problem" in parsed) throw new Error(parsed.problem);
118811
118813
  const def = parsed.def;
118812
118814
  for (const name of [...new Set([...def.previews, ...def.land, ...def.scheduled].map((h3) => h3.agent))].sort()) {
118813
- for (const [f2, text3] of Object.entries(agentFiles[name] ?? {})) files[`agents/${name}/${f2}`] = text3;
118815
+ for (const [f2, text4] of Object.entries(agentFiles[name] ?? {})) files[`agents/${name}/${f2}`] = text4;
118814
118816
  }
118815
118817
  const checked = loose ? { ok: true } : checkStudioFiles(files, true);
118816
118818
  if (!checked.ok) throw new Error(`official/studios/${folder}: ${checked.file}: ${checked.reason}`);
@@ -118957,14 +118959,14 @@ function cloudAgentFiles() {
118957
118959
  const official = /* @__PURE__ */ new Set();
118958
118960
  const owner2 = /* @__PURE__ */ new Map();
118959
118961
  for (const flow of cloudFlows()) {
118960
- for (const [name, text3] of Object.entries(flow.files)) {
118962
+ for (const [name, text4] of Object.entries(flow.files)) {
118961
118963
  const at2 = /^agents\/([^/]+)\/(.+)$/.exec(name);
118962
118964
  if (!at2) continue;
118963
118965
  const [, agent, rest] = at2;
118964
118966
  if (owner2.has(agent) && owner2.get(agent) !== flow.cloudId) continue;
118965
118967
  owner2.set(agent, flow.cloudId);
118966
118968
  if (flow.builtIn) official.add(agent);
118967
- files[`${agent}/${rest}`] = text3;
118969
+ files[`${agent}/${rest}`] = text4;
118968
118970
  }
118969
118971
  }
118970
118972
  return { files, official };
@@ -119371,14 +119373,14 @@ function taskChatFile(task, home4) {
119371
119373
  return path31.join(taskChatsDir(home4), `${task}.jsonl`);
119372
119374
  }
119373
119375
  function readTaskChat(task, home4) {
119374
- let text3;
119376
+ let text4;
119375
119377
  try {
119376
- text3 = fs27.readFileSync(taskChatFile(task, home4), "utf8");
119378
+ text4 = fs27.readFileSync(taskChatFile(task, home4), "utf8");
119377
119379
  } catch {
119378
119380
  return [];
119379
119381
  }
119380
119382
  const lines = [];
119381
- for (const raw of text3.split("\n")) {
119383
+ for (const raw of text4.split("\n")) {
119382
119384
  if (!raw.trim()) continue;
119383
119385
  try {
119384
119386
  const line = JSON.parse(raw);
@@ -119560,7 +119562,7 @@ var tiled_default = `{
119560
119562
  var video_default = '{ "name": "video", "title": { "en": "Video", "zh": "\u89C6\u9891" }, "types": ["video"] }\n';
119561
119563
 
119562
119564
  // ../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';
119565
+ 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
119566
 
119565
119567
  // ../artifact-sdk/src/builtin/index.ts
119566
119568
  var read = (m) => typeof m === "string" ? JSON.parse(m) : m;
@@ -119625,67 +119627,12 @@ function schemaProblem(schema, value, at2 = "") {
119625
119627
  return null;
119626
119628
  }
119627
119629
 
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
119630
  // ../artifact-sdk/src/internal/references.ts
119684
119631
  var STORYBOARD = ["storyboard"];
119685
119632
  var STUDIO = ["studio"];
119686
119633
  var ARRANGED = ["storyboard", "compare", "spritesheet", "studio"];
119687
119634
  var ASSET = ["spritesheet", "asset"];
119688
- var isObject2 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
119635
+ var isObject = (v) => !!v && typeof v === "object" && !Array.isArray(v);
119689
119636
  function bodyReferences(body) {
119690
119637
  const lines = body.replace(/<!--[^]*?-->/g, "").split(/\r?\n/);
119691
119638
  let fence = "";
@@ -119709,9 +119656,9 @@ function bodyReferences(body) {
119709
119656
  if (kept4 && /^ {0,3}<(?:Asset|Mockup|Compare|Storyboard|Studio)\b/.test(line)) inTag = true;
119710
119657
  if (line.includes("/>")) inTag = false;
119711
119658
  }
119712
- const text3 = visible.join("\n").replace(/(`+)[^]*?\1/g, "");
119659
+ const text4 = visible.join("\n").replace(/(`+)[^]*?\1/g, "");
119713
119660
  const tag = /<(Asset|Mockup|Compare|Storyboard|Studio)\b([^<>]*?)\/>/g;
119714
- const blocks = text3.matchAll(/^ {0,3}(?:<(?:Asset|Mockup|Compare|Storyboard|Studio)\b[^<>]*?\/>[ \t]*(?:\n[ \t]*)?)+$/gm);
119661
+ const blocks = text4.matchAll(/^ {0,3}(?:<(?:Asset|Mockup|Compare|Storyboard|Studio)\b[^<>]*?\/>[ \t]*(?:\n[ \t]*)?)+$/gm);
119715
119662
  for (const block of blocks) {
119716
119663
  const tags = [...block[0].matchAll(tag)];
119717
119664
  for (const m of tags) {
@@ -119725,7 +119672,7 @@ function bodyReferences(body) {
119725
119672
  if (a2.variants) {
119726
119673
  try {
119727
119674
  const v = JSON.parse(a2.variants);
119728
- if (isObject2(v)) {
119675
+ if (isObject(v)) {
119729
119676
  for (const src of Object.values(v)) if (typeof src === "string" && src) out.push({ src, types: m[1] === "Asset" ? ASSET : [] });
119730
119677
  }
119731
119678
  } catch {
@@ -119734,7 +119681,7 @@ function bodyReferences(body) {
119734
119681
  }
119735
119682
  }
119736
119683
  }
119737
- for (const m of text3.replace(tag, "").matchAll(/\]\(\s*<?([^\s)>]+)>?(?:\s+["'][^]*?["'])?\s*\)/g)) out.push({ src: m[1], types: [] });
119684
+ for (const m of text4.replace(tag, "").matchAll(/\]\(\s*<?([^\s)>]+)>?(?:\s+["'][^]*?["'])?\s*\)/g)) out.push({ src: m[1], types: [] });
119738
119685
  return out;
119739
119686
  }
119740
119687
  var TYPES = {
@@ -119774,6 +119721,100 @@ function kindOf2(ext) {
119774
119721
  return type.startsWith("video/") || type.startsWith("audio/") ? "video" : "asset";
119775
119722
  }
119776
119723
 
119724
+ // ../artifact-sdk/src/internal/format/studio.ts
119725
+ var text3 = (v) => typeof v === "string" && v.length > 0;
119726
+ var source = (v) => text3(v) && !/^(?:[a-z][\w+.-]*:|\/|#)|\\|[\u0000-\u001f]/i.test(v);
119727
+ 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));
119728
+ var relativePath = (v) => source(v) && v.split("/").every((p2) => p2 && p2 !== "." && p2 !== "..");
119729
+ var optionalText = (v, keys) => keys.every((k2) => v[k2] === void 0 || typeof v[k2] === "string");
119730
+ 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));
119731
+ function resultProblem(value, agents) {
119732
+ if (!Array.isArray(value) || value.length > 500) return "/results";
119733
+ for (let i = 0; i < value.length; i++) {
119734
+ const r2 = value[i];
119735
+ if (!isObject(r2) || !text3(r2.agent) || !agents.has(r2.agent) || !optionalText(r2, ["label"])) return `/results/${i}`;
119736
+ 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);
119737
+ if (!valid) return `/results/${i}`;
119738
+ }
119739
+ return null;
119740
+ }
119741
+ function reviewProblem(v) {
119742
+ if (!isObject(v) || v.version !== 2) return "/version";
119743
+ if (!text3(v.fingerprint)) return "/fingerprint";
119744
+ 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";
119745
+ if (!Array.isArray(v.agents) || v.agents.length > 500) return "/agents";
119746
+ const agents = /* @__PURE__ */ new Set();
119747
+ for (const a2 of v.agents) {
119748
+ 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";
119749
+ agents.add(a2.agent);
119750
+ }
119751
+ if (!Array.isArray(v.files) || v.files.length > 1e3) return "/files";
119752
+ const paths = /* @__PURE__ */ new Set();
119753
+ for (const f2 of v.files) {
119754
+ 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";
119755
+ if (f2.path.startsWith("agents/") && !agents.has(f2.path.split("/")[1])) return "/files";
119756
+ paths.add(f2.path);
119757
+ }
119758
+ return resultProblem(v.results, agents);
119759
+ }
119760
+ var isReview = (v) => isObject(v) && v.version === 2;
119761
+
119762
+ // ../artifact-sdk/src/internal/manifest.ts
119763
+ var BUILTINS = builtin_default;
119764
+ var manifestOf = (type) => BUILTINS.find((m) => m.types.includes(type));
119765
+ function typeOf(data, types) {
119766
+ const problem = (type) => type === "studio" && isReview(data) ? reviewProblem(data) : schemaProblem(manifestOf(type)?.schema, data);
119767
+ for (const type of types) if (!problem(type)) return { type };
119768
+ if (types.length !== 1) return { type: null };
119769
+ return { type: types[0], problem: `does not match ${types[0]} at ${problem(types[0])}` };
119770
+ }
119771
+ var isObject2 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
119772
+ var remote = (src) => !src || /^(?:[a-z][\w+.-]*:|\/|#)/i.test(src);
119773
+ function mapJson(node, keys, at2, visit) {
119774
+ if (!keys.length) return typeof node === "string" && node ? visit(node, at2) : node;
119775
+ const [key, ...rest] = keys;
119776
+ if (Array.isArray(node)) {
119777
+ if (key === "*") return node.map((x2, i2) => mapJson(x2, rest, `${at2}/${i2}`, visit));
119778
+ const i = Number(key);
119779
+ return Number.isInteger(i) && i in node ? node.map((x2, j2) => j2 === i ? mapJson(x2, rest, `${at2}/${j2}`, visit) : x2) : node;
119780
+ }
119781
+ if (!isObject2(node)) return node;
119782
+ const out = { ...node };
119783
+ for (const k2 of key === "*" ? Object.keys(node) : key in node ? [key] : []) out[k2] = mapJson(node[k2], rest, `${at2}/${k2}`, visit);
119784
+ return out;
119785
+ }
119786
+ function mapText(text4, rule, skipped, visit, includeRemote) {
119787
+ let out = "";
119788
+ let last2 = 0;
119789
+ for (const m of text4.matchAll(new RegExp(rule.text, "gid"))) {
119790
+ const span = m.indices?.[1];
119791
+ if (!span || m[1] === void 0 || skipped.some(([a2, b2]) => span[0] >= a2 && span[0] < b2)) continue;
119792
+ const line = text4.slice(0, span[0]).split("\n").length;
119793
+ const one = (src) => remote(src) && !includeRemote ? src : visit(src, line);
119794
+ 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]);
119795
+ out += text4.slice(last2, span[0]) + value;
119796
+ last2 = span[1];
119797
+ }
119798
+ return out + text4.slice(last2);
119799
+ }
119800
+ function mapReferences(manifest, content, map2, includeRemote = false) {
119801
+ const skipped = (text4) => (manifest?.skip ?? []).flatMap((re3) => [...text4.matchAll(new RegExp(re3, "gi"))].map((m) => [m.index, m.index + m[0].length]));
119802
+ for (const rule of manifest?.references ?? []) {
119803
+ const types = rule.types ?? [];
119804
+ if ("json" in rule) {
119805
+ if (typeof content !== "string") content = mapJson(content, rule.json.split("/").filter(Boolean), "", (src, at2) => map2(src, { src, types, text: false, at: at2 || "/" }));
119806
+ } else if (typeof content === "string") {
119807
+ content = mapText(content, rule, skipped(content), (src, line) => map2(src, { src, types, text: true, line }), includeRemote);
119808
+ }
119809
+ }
119810
+ return content;
119811
+ }
119812
+ function referencesOf(manifest, content, includeRemote = false) {
119813
+ const found = [];
119814
+ mapReferences(manifest, content, (src, ref) => (found.push(ref), src), includeRemote);
119815
+ return found;
119816
+ }
119817
+
119777
119818
  // ../artifact-sdk/src/internal/collect.ts
119778
119819
  var extOf = (file3) => /\.[^./\\]+$/.exec(file3)?.[0].toLowerCase() ?? "";
119779
119820
  var why = (error) => error instanceof Error ? error.message : String(error);
@@ -119783,10 +119824,13 @@ var textKind = (ext, types) => types.find((t2) => {
119783
119824
  }) ?? kindOf2(ext);
119784
119825
  var kindAt = (src, types) => extOf(src) === ".json" ? types.includes("asset") ? "asset" : types[0] ?? "asset" : textKind(extOf(src), types);
119785
119826
  function collect(body, card, host) {
119827
+ return collectSources(bodyReferences(body), card, host);
119828
+ }
119829
+ function collectSources(sources2, card, host) {
119786
119830
  const nodes = /* @__PURE__ */ new Map();
119787
119831
  const active = /* @__PURE__ */ new Set();
119788
119832
  const out = [];
119789
- const visit = (src, types, owner2) => {
119833
+ const visit = (src, types, owner2, partial = false) => {
119790
119834
  const path58 = src.replace(/[?#].*$/, "");
119791
119835
  let resolved;
119792
119836
  try {
@@ -119802,7 +119846,11 @@ function collect(body, card, host) {
119802
119846
  }
119803
119847
  if (!resolved) return { key: null };
119804
119848
  const { key, file: file3 } = resolved;
119805
- if (active.has(key)) throw new Error(`${owner2}: ${src}: \u8D44\u6E90\u4F9D\u8D56\u5FAA\u73AF`);
119849
+ if (active.has(key)) {
119850
+ const error = `${owner2}: ${src}: \u8D44\u6E90\u4F9D\u8D56\u5FAA\u73AF`;
119851
+ if (partial) return { key: null, error };
119852
+ throw new Error(error);
119853
+ }
119806
119854
  const json = !!file3 && extOf(file3) === ".json";
119807
119855
  const held5 = nodes.get(key);
119808
119856
  if (held5) {
@@ -119815,10 +119863,10 @@ function collect(body, card, host) {
119815
119863
  nodes.set(key, node);
119816
119864
  active.add(key);
119817
119865
  const child = (ref, from) => {
119818
- const found = visit(ref.src, ref.types, from);
119866
+ const found = visit(ref.src, ref.types, from, partial || node.kind === "studio" && node.data?.version === 2);
119819
119867
  if (found.key) node.dependencies.set(ref.src, found.key);
119820
119868
  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;
119869
+ if (!(node.kind === "studio" && node.data?.version === 2)) node.error ??= found.error;
119822
119870
  };
119823
119871
  if (file3) {
119824
119872
  if (json) {
@@ -119841,13 +119889,13 @@ function collect(body, card, host) {
119841
119889
  node.error = node.problems[0]?.message;
119842
119890
  if (!node.error) for (const ref of referencesOf(manifestOf(node.kind), node.data)) child(ref, file3);
119843
119891
  } else {
119844
- for (const ref of host.retained(key)) child(ref, card);
119892
+ for (const ref of host.retained(key, types)) child(ref, card);
119845
119893
  }
119846
119894
  active.delete(key);
119847
119895
  out.push(node);
119848
119896
  return { key, error: node.error };
119849
119897
  };
119850
- for (const ref of bodyReferences(body)) visit(ref.src, ref.types, card);
119898
+ for (const ref of sources2) visit(ref.src, ref.types, card);
119851
119899
  const sorted = [];
119852
119900
  const done = /* @__PURE__ */ new Set();
119853
119901
  const order = (node) => {
@@ -120187,9 +120235,9 @@ var officialAgent = (name) => cloudAgentFiles().official.has(name);
120187
120235
  // ../cli/src/lib/agents/shared-memory.ts
120188
120236
  function sharedMemory(board) {
120189
120237
  const declared = /* @__PURE__ */ new Map();
120190
- const take = (folder, text3, builtIn) => {
120191
- if (text3 === null || declared.has(folder)) return;
120192
- const read5 = parseSpecAgent(text3, folder, (relative) => {
120238
+ const take = (folder, text4, builtIn) => {
120239
+ if (text4 === null || declared.has(folder)) return;
120240
+ const read5 = parseSpecAgent(text4, folder, (relative) => {
120193
120241
  if (builtIn) return shippedAgentFiles()[`${folder}/${relative}`] ?? null;
120194
120242
  try {
120195
120243
  return fs31.readFileSync(path35.join(board, "agents", folder, relative), "utf8");
@@ -120199,9 +120247,9 @@ function sharedMemory(board) {
120199
120247
  }, builtIn);
120200
120248
  if ("agent" in read5 && read5.agent.name === folder) declared.set(folder, read5.agent.memoryFiles.workspace);
120201
120249
  };
120202
- for (const [key, text3] of Object.entries(shippedAgentFiles())) {
120250
+ for (const [key, text4] of Object.entries(shippedAgentFiles())) {
120203
120251
  const at2 = /^([^/]+)\/AGENT\.md$/.exec(key);
120204
- if (at2) take(at2[1], text3, officialAgent(at2[1]));
120252
+ if (at2) take(at2[1], text4, officialAgent(at2[1]));
120205
120253
  }
120206
120254
  const root2 = path35.join(board, "agents");
120207
120255
  let folders2 = [];
@@ -120210,12 +120258,12 @@ function sharedMemory(board) {
120210
120258
  } catch {
120211
120259
  }
120212
120260
  for (const folder of folders2.sort()) {
120213
- let text3 = null;
120261
+ let text4 = null;
120214
120262
  try {
120215
- text3 = fs31.readFileSync(path35.join(root2, folder, "AGENT.md"), "utf8");
120263
+ text4 = fs31.readFileSync(path35.join(root2, folder, "AGENT.md"), "utf8");
120216
120264
  } catch {
120217
120265
  }
120218
- take(folder, text3, false);
120266
+ take(folder, text4, false);
120219
120267
  }
120220
120268
  const matches = [
120221
120269
  matcher("agents/copywriting/style.md"),
@@ -120512,13 +120560,13 @@ function pullTools(ws, record, files) {
120512
120560
  const theirs = (skill) => !ours.has(skill) && SKILL_ROOTS.some((root2) => fs33.existsSync(path37.join(ws.cwd, root2, skill)));
120513
120561
  const kept4 = Object.keys(files).map((name) => SKILL_PATH.exec(name)?.[1]).filter((skill) => skill && !theirs(skill));
120514
120562
  const skills = {};
120515
- for (const [name, text3] of Object.entries(files)) {
120563
+ for (const [name, text4] of Object.entries(files)) {
120516
120564
  const at2 = SKILL_PATH.exec(name);
120517
120565
  if (!at2 || at2[1] === "kanban" || !kept4.includes(at2[1]) || at2[2].split("/").includes("..")) continue;
120518
- skills[name] = hashOf2(text3);
120566
+ skills[name] = hashOf2(text4);
120519
120567
  for (const root2 of SKILL_ROOTS) {
120520
120568
  const file3 = path37.join(ws.cwd, root2, at2[1], at2[2]);
120521
- if (held5[name] !== skills[name] || hashFile(file3) !== skills[name]) write(file3, text3);
120569
+ if (held5[name] !== skills[name] || hashFile(file3) !== skills[name]) write(file3, text4);
120522
120570
  }
120523
120571
  }
120524
120572
  for (const name of Object.keys(held5)) {
@@ -120612,9 +120660,9 @@ function stateDir(ws) {
120612
120660
  return null;
120613
120661
  }
120614
120662
  }
120615
- function assetsOf(text3) {
120663
+ function assetsOf(text4) {
120616
120664
  try {
120617
- const held5 = JSON.parse(text3 ?? "{}");
120665
+ const held5 = JSON.parse(text4 ?? "{}");
120618
120666
  return held5 && typeof held5 === "object" && !Array.isArray(held5) ? held5 : {};
120619
120667
  } catch {
120620
120668
  return {};
@@ -120738,13 +120786,13 @@ function writeIndex(board) {
120738
120786
  const id = /^(\d+)-/.exec(e2.name)?.[1];
120739
120787
  if (!id) continue;
120740
120788
  const link = e2.isDirectory() ? `${e2.name}/root.md` : e2.name.endsWith(".md") ? e2.name : null;
120741
- const text4 = link && readText(path37.join(todo, link));
120742
- if (text4 === null || !link) continue;
120743
- cards.push({ id: Number(id), title: cardFront(text4).title ?? e2.name.replace(/\.md$/, ""), link });
120789
+ const text5 = link && readText(path37.join(todo, link));
120790
+ if (text5 === null || !link) continue;
120791
+ cards.push({ id: Number(id), title: cardFront(text5).title ?? e2.name.replace(/\.md$/, ""), link });
120744
120792
  }
120745
120793
  cards.sort((a2, b2) => a2.id - b2.id);
120746
120794
  const list2 = cards.length ? cards.map((c2) => `- [#${c2.id} ${c2.title}](${c2.link})`).join("\n") : "_(none)_";
120747
- const text3 = `# Board
120795
+ const text4 = `# Board
120748
120796
 
120749
120797
  Open tasks for the kanban board. One card per file. Ids are global and never reused \u2014
120750
120798
  the number at the front of a filename is the task id.
@@ -120753,7 +120801,7 @@ the number at the front of a filename is the task id.
120753
120801
 
120754
120802
  ${list2}
120755
120803
  `;
120756
- if (readText(path37.join(todo, "README.md")) !== text3) write(path37.join(todo, "README.md"), text3);
120804
+ if (readText(path37.join(todo, "README.md")) !== text4) write(path37.join(todo, "README.md"), text4);
120757
120805
  }
120758
120806
  var workspaceOf = (ws) => readBase(ws).workspace ?? null;
120759
120807
  async function pullAssets(ws, record, assets) {
@@ -120840,18 +120888,18 @@ async function pullAssets(ws, record, assets) {
120840
120888
  }
120841
120889
  const json = data !== void 0 && typeof data !== "string";
120842
120890
  if (held5?.artifact === ref.artifact && held5.version === version && !held5.localHash && json) {
120843
- const source = readText(target);
120844
- if (source !== null) {
120891
+ const source2 = readText(target);
120892
+ if (source2 !== null) {
120845
120893
  let same = false;
120846
120894
  try {
120847
- same = JSON.stringify(JSON.parse(source)) === JSON.stringify(JSON.parse(Buffer.from(local).toString()));
120895
+ same = JSON.stringify(JSON.parse(source2)) === JSON.stringify(JSON.parse(Buffer.from(local).toString()));
120848
120896
  } catch {
120849
120897
  }
120850
120898
  if (!same) {
120851
120899
  out[name] = { ...held5, kind };
120852
120900
  continue;
120853
120901
  }
120854
- local = Buffer.from(source);
120902
+ local = Buffer.from(source2);
120855
120903
  }
120856
120904
  }
120857
120905
  write(target, local);
@@ -120923,6 +120971,7 @@ async function pushAssets(ws, record, before) {
120923
120971
  return path37.relative(real(path37.dirname(file3)), target).split(path37.sep).join("/");
120924
120972
  };
120925
120973
  try {
120974
+ let recoveredReferences = false;
120926
120975
  const graph = collect(body, file3, {
120927
120976
  resolve: (src, owner2) => {
120928
120977
  const id = Object.entries(before).find(([, ref]) => ref.artifact === src);
@@ -120937,17 +120986,25 @@ async function pushAssets(ws, record, before) {
120937
120986
  return { key: canonical(fs33.realpathSync(target)), file: target };
120938
120987
  },
120939
120988
  read: referenceText,
120940
- retained: (key) => (record.assets[key]?.dependencies ?? []).map((src) => {
120941
- const kind = record.assets[src]?.kind;
120942
- return { src, types: kind ? [kind] : [] };
120943
- })
120989
+ retained: (key, types) => {
120990
+ let dependencies = record.assets[key]?.dependencies;
120991
+ if (!dependencies && types.length === 1 && types[0] === "studio" && before[key] && !recoveredReferences) {
120992
+ recoveredReferences = true;
120993
+ dependencies = Object.keys(before).filter((src) => src !== key);
120994
+ }
120995
+ return (dependencies ?? []).map((src) => {
120996
+ const kind = record.assets[src]?.kind;
120997
+ return { src, types: kind ? [kind] : [] };
120998
+ });
120999
+ }
120944
121000
  });
120945
121001
  for (const node of graph) {
120946
121002
  const previous = [...node.aliases].map((key) => record.assets[key]).find(Boolean);
120947
121003
  const old = [...node.aliases].map((key) => before[key]).find(Boolean);
120948
121004
  const kind = node.kind;
120949
121005
  let out;
120950
- let why2 = node.error ?? [...node.dependencies.values()].map((key) => refs[key]?.error).find(Boolean);
121006
+ const partialStudio = node.kind === "studio" && node.data?.version === 2;
121007
+ let why2 = node.error ?? (partialStudio ? void 0 : [...node.dependencies.values()].map((key) => refs[key]?.error).find(Boolean));
120951
121008
  if (!why2 && node.file) {
120952
121009
  try {
120953
121010
  if (fs33.statSync(node.file).size > ASSET_FILE_LIMIT) throw new Error("This asset is over 100 MiB.");
@@ -121754,19 +121811,19 @@ import path42 from "node:path";
121754
121811
 
121755
121812
  // ../cli/src/lib/question-block.ts
121756
121813
  var MODES = ["single", "multi"];
121757
- var withoutTag = (text3) => text3.replace(/^\[user\]\s+/, "");
121814
+ var withoutTag = (text4) => text4.replace(/^\[user\]\s+/, "");
121758
121815
  function normalizeQuestion(raw) {
121759
121816
  if (raw && typeof raw === "object" && !Array.isArray(raw)) {
121760
- const source = raw;
121761
- const text3 = withoutTag(String(source.question ?? source.text ?? ""));
121817
+ const source2 = raw;
121818
+ const text4 = withoutTag(String(source2.question ?? source2.text ?? ""));
121762
121819
  const extra = {
121763
- ...typeof source.agent === "string" && source.agent.trim() ? { agent: source.agent.trim() } : {}
121820
+ ...typeof source2.agent === "string" && source2.agent.trim() ? { agent: source2.agent.trim() } : {}
121764
121821
  };
121765
- const options = (Array.isArray(source.options) ? source.options : []).map((o3) => String(o3).trim()).filter(Boolean);
121766
- if (options.length === 0) return { text: text3, ...extra };
121767
- const mode = MODES.includes(String(source.mode)) ? String(source.mode) : "single";
121768
- const recommend = (Array.isArray(source.recommend) ? source.recommend : []).map(Number).filter((n) => Number.isInteger(n) && n >= 1 && n <= options.length);
121769
- return { text: text3, mode, options, recommend: mode === "single" ? recommend.slice(0, 1) : recommend, ...extra };
121822
+ const options = (Array.isArray(source2.options) ? source2.options : []).map((o3) => String(o3).trim()).filter(Boolean);
121823
+ if (options.length === 0) return { text: text4, ...extra };
121824
+ const mode = MODES.includes(String(source2.mode)) ? String(source2.mode) : "single";
121825
+ const recommend = (Array.isArray(source2.recommend) ? source2.recommend : []).map(Number).filter((n) => Number.isInteger(n) && n >= 1 && n <= options.length);
121826
+ return { text: text4, mode, options, recommend: mode === "single" ? recommend.slice(0, 1) : recommend, ...extra };
121770
121827
  }
121771
121828
  return { text: withoutTag(String(raw)) };
121772
121829
  }
@@ -121813,16 +121870,16 @@ function parseQuestionsBlock(lines) {
121813
121870
  }
121814
121871
 
121815
121872
  // ../cli/src/lib/frontmatter.ts
121816
- function parseFrontmatter(text3) {
121817
- const lines = text3.split("\n");
121818
- if (lines[0].trim() !== "---") return { meta: null, body: text3 };
121873
+ function parseFrontmatter(text4) {
121874
+ const lines = text4.split("\n");
121875
+ if (lines[0].trim() !== "---") return { meta: null, body: text4 };
121819
121876
  let i = 1;
121820
121877
  const fm = [];
121821
121878
  while (i < lines.length && lines[i].trim() !== "---") {
121822
121879
  fm.push(lines[i]);
121823
121880
  i++;
121824
121881
  }
121825
- if (i >= lines.length) return { meta: null, body: text3 };
121882
+ if (i >= lines.length) return { meta: null, body: text4 };
121826
121883
  const meta = {};
121827
121884
  for (let j2 = 0; j2 < fm.length; j2++) {
121828
121885
  const m = fm[j2].match(/^([A-Za-z_]+):\s*(.*)$/);
@@ -122009,8 +122066,8 @@ function installCommitHook(root2, _board) {
122009
122066
  if (!dir) return {};
122010
122067
  const file3 = path41.join(dir, "pre-commit");
122011
122068
  if (fs38.lstatSync(file3, { throwIfNoEntry: false })?.isSymbolicLink()) return {};
122012
- const source = read2(file3);
122013
- if (source && MARKER_LINE.test(source)) fs38.unlinkSync(file3);
122069
+ const source2 = read2(file3);
122070
+ if (source2 && MARKER_LINE.test(source2)) fs38.unlinkSync(file3);
122014
122071
  return {};
122015
122072
  }
122016
122073
 
@@ -122139,7 +122196,7 @@ var RESUME_REFUSED = {
122139
122196
  };
122140
122197
  var isArchived = (ws, id) => path42.relative(ws.board, findCard(ws.board, id) ?? ws.board).split(path42.sep)[0] === ".archive";
122141
122198
  var refusal3 = (ran) => ran.last.replace(/^akb( raw)?: /, "").slice(0, 300) || "akb stopped with an error.";
122142
- var reasonOf = (text3) => (text3 ?? "").split("\n").map((l2) => l2.trim()).filter((l2) => l2 && !/^at\s/.test(l2)).join("\n").slice(0, 300) || void 0;
122199
+ 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
122200
  function logLines(show, event2) {
122144
122201
  let held5 = "";
122145
122202
  const said = (line) => {
@@ -122449,14 +122506,14 @@ ${pictures(job, ws, ws.number)}`);
122449
122506
  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
122507
  });
122451
122508
  const verb = flow.verb === "create" ? flow.skip_plan ? "implement" : "refine" : flow.verb;
122452
- const text3 = flow.verb === "create" ? "" : (flow.text ?? "").trim();
122509
+ const text4 = flow.verb === "create" ? "" : (flow.text ?? "").trim();
122453
122510
  if (flow.resume && isArchived(ws, id2)) return { ok: true, report: { card: id2 } };
122454
122511
  if (flow.resume && verb === "refine") {
122455
122512
  const review2 = reviewOf2(cardFile(ws));
122456
122513
  if (review2) return { ok: true, report: { card: id2, ...review2 === true ? {} : { review: review2 } } };
122457
122514
  }
122458
- if (verb === "revise" && !text3) return fail("Say what to change.");
122459
- let note = verb === "resolve" || verb === "revise" ? text3 : "";
122515
+ if (verb === "revise" && !text4) return fail("Say what to change.");
122516
+ let note = verb === "resolve" || verb === "revise" ? text4 : "";
122460
122517
  let rejected = false;
122461
122518
  let ran;
122462
122519
  let continuation;
@@ -122480,18 +122537,18 @@ ${pictures(job, ws, ws.number)}`);
122480
122537
  continuation = previous.status === "done" ? ["raw", "run", "log", previous.sessionId] : ["raw", "run", "resume", previous.sessionId, "--require-session"];
122481
122538
  }
122482
122539
  }
122483
- } else if (verb === "implement" && text3) {
122484
- const resolved = await akb(["raw", "card", "resolve", String(id2), "--follow", "--events", "--json", "--", text3], true);
122540
+ } else if (verb === "implement" && text4) {
122541
+ const resolved = await akb(["raw", "card", "resolve", String(id2), "--follow", "--events", "--json", "--", text4], true);
122485
122542
  if (io.lost()) return fail("");
122486
122543
  const file3 = findCard(ws.board, id2);
122487
122544
  rejected = !!file3 && path42.relative(ws.board, file3).split(path42.sep)[0] === ".archive" && parseFrontmatter(fs39.readFileSync(file3, "utf8")).meta?.rejected === true;
122488
122545
  if (rejected) ran = resolved;
122489
- else if (resolved.code !== 0) note = text3;
122546
+ else if (resolved.code !== 0) note = text4;
122490
122547
  }
122491
122548
  const fresh = () => {
122492
122549
  const carry = carryArgs(verb);
122493
122550
  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", text3, String(id2), "--continue", "--follow", "--events", "--json", ...flow.feedback ? ["--notes", flow.feedback] : []], true);
122551
+ if (verb === "preview") return akb(["raw", "previews", text4, String(id2), "--continue", "--follow", "--events", "--json", ...flow.feedback ? ["--notes", flow.feedback] : []], true);
122495
122552
  return akb(["raw", "card", verb, String(id2), "--follow", "--events", "--json", ...carry, ...note ? ["--", note] : []], true, costFrom);
122496
122553
  };
122497
122554
  ran ??= await (continuation ? akb([...continuation, "--follow", "--events", "--json"], true) : fresh());
@@ -122875,11 +122932,11 @@ import { createHash as createHash5 } from "node:crypto";
122875
122932
  // ../cli/src/lib/shared/reply-parts.ts
122876
122933
  function imageMime(bytes2) {
122877
122934
  const at2 = (...v) => v.every((n, i) => bytes2[i] === n);
122878
- const text3 = (a2, b2) => String.fromCharCode(...bytes2.slice(a2, b2));
122879
- if (bytes2.length >= 24 && at2(137, 80, 78, 71, 13, 10, 26, 10) && text3(12, 16) === "IHDR" && bytes2.slice(16, 20).some(Boolean) && bytes2.slice(20, 24).some(Boolean)) return "image/png";
122935
+ const text4 = (a2, b2) => String.fromCharCode(...bytes2.slice(a2, b2));
122936
+ 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
122937
  if (at2(255, 216, 255)) return "image/jpeg";
122881
- if (bytes2.length >= 13 && ["GIF87a", "GIF89a"].includes(text3(0, 6)) && (bytes2[6] || bytes2[7]) && (bytes2[8] || bytes2[9])) return "image/gif";
122882
- if (text3(0, 4) === "RIFF" && text3(8, 12) === "WEBP") return "image/webp";
122938
+ if (bytes2.length >= 13 && ["GIF87a", "GIF89a"].includes(text4(0, 6)) && (bytes2[6] || bytes2[7]) && (bytes2[8] || bytes2[9])) return "image/gif";
122939
+ if (text4(0, 4) === "RIFF" && text4(8, 12) === "WEBP") return "image/webp";
122883
122940
  return void 0;
122884
122941
  }
122885
122942
 
@@ -122926,10 +122983,10 @@ function collectReplyImages(parts, cwd) {
122926
122983
  bytes2 = Buffer.from(p2.data, "base64");
122927
122984
  } else {
122928
122985
  if (!p2.path) throw Error();
122929
- const source = p2.path.startsWith("file:") ? fileURLToPath3(p2.path) : decodeURIComponent(p2.path);
122930
- if (/^[a-z][a-z0-9+.-]*:/i.test(source) && !/^[A-Za-z]:[\\/]/.test(source)) throw Error();
122931
- const real = fs42.realpathSync(path45.resolve(cwd, source));
122932
- if (!/\.(png|jpe?g|gif|webp)$/i.test(source) && !registered.has(real)) throw Error();
122986
+ const source2 = p2.path.startsWith("file:") ? fileURLToPath3(p2.path) : decodeURIComponent(p2.path);
122987
+ if (/^[a-z][a-z0-9+.-]*:/i.test(source2) && !/^[A-Za-z]:[\\/]/.test(source2)) throw Error();
122988
+ const real = fs42.realpathSync(path45.resolve(cwd, source2));
122989
+ if (!/\.(png|jpe?g|gif|webp)$/i.test(source2) && !registered.has(real)) throw Error();
122933
122990
  if (!roots.some((root2) => inside(root2, real)) && !registered.has(real)) throw Error();
122934
122991
  const fd = fs42.openSync(real, fs42.constants.O_RDONLY | (fs42.constants.O_NOFOLLOW ?? 0));
122935
122992
  try {
@@ -123413,7 +123470,7 @@ function writeAttachments(job) {
123413
123470
  Attached files:
123414
123471
  ${files.map((f2) => `- ${f2}`).join("\n")}`;
123415
123472
  }
123416
- var cut = (text3) => text3.length > EVENT_CHARS ? text3.slice(0, EVENT_CHARS) : text3;
123473
+ var cut = (text4) => text4.length > EVENT_CHARS ? text4.slice(0, EVENT_CHARS) : text4;
123417
123474
  function toWire(events, first) {
123418
123475
  const out = [];
123419
123476
  let log = "";
@@ -123617,8 +123674,8 @@ function streamOut(deps, id, lease) {
123617
123674
  }, deps.renewMs);
123618
123675
  return {
123619
123676
  event: event2,
123620
- out: (text3) => {
123621
- if (text3) event2({ kind: "log", data: { text: text3 } });
123677
+ out: (text4) => {
123678
+ if (text4) event2({ kind: "log", data: { text: text4 } });
123622
123679
  },
123623
123680
  adopt: (child) => {
123624
123681
  if (child.pid) groups.add(child.pid);
@@ -124163,10 +124220,10 @@ ${prompt}` : prompt;
124163
124220
  backgroundError = backgroundWaitMessage(BACKGROUND_WAIT.minutes);
124164
124221
  stop(child);
124165
124222
  });
124166
- const fromAgent = (text3) => {
124223
+ const fromAgent = (text4) => {
124167
124224
  if (!structured) {
124168
- if (text3.trim()) acted = true;
124169
- stream.out(text3);
124225
+ if (text4.trim()) acted = true;
124226
+ stream.out(text4);
124170
124227
  }
124171
124228
  if (attempt) measure(report(job, plan3));
124172
124229
  for (const e2 of renderer2.events?.() ?? []) {
@@ -124292,7 +124349,7 @@ var replyReason = (reason, job) => {
124292
124349
  if (job.sessionFallback && !/auth|login|log.in|permission|directory|ENOENT|not installed|rate.limit|network|connect|登录|权限|目录/i.test(reason)) return "session_unavailable";
124293
124350
  return reason;
124294
124351
  };
124295
- var sessionMissing = (text3) => !/auth|unauthorized|forbidden|login|log.in|登录|权限/i.test(text3) && (/\b(?:session|conversation|thread)\b[^\n]*(?:\bnot found\b|\bdoes not exist\b)/i.test(text3) || /\bno (?:conversation|session|thread) found\b/i.test(text3));
124352
+ 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
124353
  function launch(command, args2, options) {
124297
124354
  const start = spawnable(command, args2, options);
124298
124355
  return spawn4(start.command, start.args, start.options);
@@ -124456,7 +124513,7 @@ function report(job, run3, turn2) {
124456
124513
  ...context?.used !== void 0 && limit ? { context: { used: context.used, limit } } : {}
124457
124514
  };
124458
124515
  }
124459
- var cutShort = (said, text3) => ({ ...said, reply: said.reply || text3 || void 0, stopped: true });
124516
+ var cutShort = (said, text4) => ({ ...said, reply: said.reply || text4 || void 0, stopped: true });
124460
124517
  function folderLines(ws) {
124461
124518
  if (!ws) return "";
124462
124519
  const undrawn2 = undrawnPreviews(ws);
@@ -125437,8 +125494,8 @@ var PAGE = (outcome, lang, links) => {
125437
125494
  const c2 = COPY[lang];
125438
125495
  const [title, body] = c2[outcome];
125439
125496
  const ok = outcome === "ok";
125440
- const icon = ok ? '<polyline points="20 6 9 17 4 12"/>' : '<path d="M18 6 6 18M6 6l12 12"/>';
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">${icon}</svg></span><h1 class="below">${title}</h1><p>${body}</p>`;
125497
+ const icon2 = ok ? '<polyline points="20 6 9 17 4 12"/>' : '<path d="M18 6 6 18M6 6l12 12"/>';
125498
+ 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
125499
  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
125500
  };
125444
125501
  async function signIn(options = {}) {
@@ -125557,13 +125614,13 @@ async function verifyCode(email, code, generation, signal2) {
125557
125614
  return { ok: true };
125558
125615
  }
125559
125616
  async function readJson2(req) {
125560
- let text3 = "";
125617
+ let text4 = "";
125561
125618
  for await (const chunk of req) {
125562
- text3 += chunk;
125563
- if (text3.length > 1e4) break;
125619
+ text4 += chunk;
125620
+ if (text4.length > 1e4) break;
125564
125621
  }
125565
125622
  try {
125566
- return JSON.parse(text3);
125623
+ return JSON.parse(text4);
125567
125624
  } catch {
125568
125625
  return {};
125569
125626
  }