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.
@@ -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${`${random(1e11)}`.padStart(11, "0")}`;
6443
6443
  const prefix = `--${boundary}\r
@@ -6476,7 +6476,7 @@ Content-Type: ${value.type || "application/octet-stream"}\r
6476
6476
  if (hasUnknownSizeValue) {
6477
6477
  length = null;
6478
6478
  }
6479
- 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, all) {
70056
+ function generatedPosition(map2, source2, line, column, bias, all) {
70057
70057
  var _a2, _b;
70058
70058
  line--;
70059
70059
  if (line < 0) throw new Error(LINE_GTR_ZERO);
70060
70060
  if (column < 0) throw new Error(COL_GTR_EQ_ZERO);
70061
70061
  const { sources: sources2, resolvedSources } = map2;
70062
- let sourceIndex2 = sources2.indexOf(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 all ? [] : GMapping(null, null);
70065
70065
  const bySourceMemos = (_a2 = cast(map2))._bySourceMemos || (_a2._bySourceMemos = sources2.map(memoizedState));
70066
70066
  const generated = (_b = cast(map2))._bySources || (_b._bySources = buildBySources(decodedMappings(map2), bySourceMemos));
@@ -70208,13 +70208,13 @@ var require_gen_mapping_umd = __commonJS({
70208
70208
  function cast2(map2) {
70209
70209
  return map2;
70210
70210
  }
70211
- function addSegment(map2, genLine, genColumn, 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 = path20.extname(at2) ? [at2] : [...CODE_EXTS.map((e2) => at2 + e2), ...CODE_EXTS.map((e2) => path20.join(at2, `index${e2}`))];
110886
110886
  const file2 = tries.find((f2) => fs19.statSync(f2, { throwIfNoEntry: false })?.isFile());
110887
110887
  if (!file2) throw new Error(`no such file: ${id}`);
110888
+ if (!fs19.realpathSync(file2).startsWith(fs19.realpathSync(folder) + path20.sep)) throw new Error(`${id} is outside the mockup's folder`);
110888
110889
  return file2;
110889
110890
  }
110890
110891
  async function readGraph(entry) {
@@ -110923,14 +110924,15 @@ function run(script, context, name, deadline, lineOffset = 0) {
110923
110924
  if (left <= 0) throw new Error(`took longer than ${DRAW_MS / 1e3}s to draw`);
110924
110925
  return vm.runInContext(script, context, { timeout: left, filename: name, lineOffset });
110925
110926
  }
110926
- async function tailwindFor(markup, sheets) {
110927
- const 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 ? path20.dirname(sheets[0].path) : "/",
110930
110931
  loadStylesheet: async (id, from) => {
110931
110932
  if (id === "tailwindcss" || id.startsWith("tailwindcss/")) return { path: "tailwindcss/index.css", base: "/", content: tailwindcss_default };
110932
110933
  if (!id.startsWith(".")) throw new Error(`a mockup cannot import ${id}`);
110933
110934
  const at2 = path20.resolve(from, id);
110935
+ if (!fs19.realpathSync(at2).startsWith(fs19.realpathSync(folder) + path20.sep)) throw new Error(`${id} is outside the mockup's folder`);
110934
110936
  return { path: at2, base: path20.dirname(at2), content: fs19.readFileSync(at2, "utf8") };
110935
110937
  }
110936
110938
  });
@@ -110980,7 +110982,7 @@ ${graph.code.get(file2)}
110980
110982
  if (typeof Component !== "function") throw new Error("the mockup has no default export to draw");
110981
110983
  sandbox.__draw = () => (0, import_server.renderToStaticMarkup)(import_react3.default.createElement(Component));
110982
110984
  const markup = run("__draw()", context, entry, deadline);
110983
- const css = (await tailwindFor(markup, graph.sheets)).replace(/<\/style/gi, "<\\/style");
110985
+ const css = (await tailwindFor(markup, graph.sheets, path20.dirname(entry))).replace(/<\/style/gi, "<\\/style");
110984
110986
  return `<!doctype html><html><head>${head}<style>${css}</style></head><body>${markup}</body></html>`;
110985
110987
  }
110986
110988
  var import_react3, JSX, import_server, import_sucrase, DRAW_MS, MAX_FILES, CODE_EXTS, REQUIRES, NOTHING, NEXT_LINK, NEXT_IMAGE, NEXT_NAVIGATION, PACKAGES, MOCKUP_IMPORTS;
@@ -111891,7 +111893,7 @@ async function studioSnapshot(workspace, catalog, list2) {
111891
111893
  }
111892
111894
 
111893
111895
  // src/protocol.ts
111894
- var AKB_VERSION = true ? "0.11.54" : "0.0.0";
111896
+ var AKB_VERSION = true ? "0.11.56" : "0.0.0";
111895
111897
  var AKB_CONTRACT = true ? 15 : 0;
111896
111898
 
111897
111899
  // src/secrets.ts
@@ -112228,24 +112230,24 @@ function readIcon(raw) {
112228
112230
 
112229
112231
  // ../cli/src/lib/yaml.ts
112230
112232
  function yamlScalar(s) {
112231
- const text3 = String(s);
112232
- if (text3 === "") return '""';
112233
- if (/^[-?:,[\]{}#&*!|>'"%@`]/.test(text3) || /:\s/.test(text3) || /[\n"]/.test(text3) || /^\s|\s$/.test(text3)) {
112234
- return JSON.stringify(text3);
112233
+ const text4 = String(s);
112234
+ if (text4 === "") return '""';
112235
+ if (/^[-?:,[\]{}#&*!|>'"%@`]/.test(text4) || /:\s/.test(text4) || /[\n"]/.test(text4) || /^\s|\s$/.test(text4)) {
112236
+ return JSON.stringify(text4);
112235
112237
  }
112236
- return text3;
112238
+ return text4;
112237
112239
  }
112238
112240
  function unquote2(v) {
112239
- const text3 = String(v).trim();
112240
- if (text3.startsWith('"') && text3.endsWith('"')) {
112241
+ const text4 = String(v).trim();
112242
+ if (text4.startsWith('"') && text4.endsWith('"')) {
112241
112243
  try {
112242
- return JSON.parse(text3);
112244
+ return JSON.parse(text4);
112243
112245
  } catch {
112244
- return text3.slice(1, -1);
112246
+ return text4.slice(1, -1);
112245
112247
  }
112246
112248
  }
112247
- if (text3.startsWith("'") && text3.endsWith("'")) return text3.slice(1, -1);
112248
- return text3;
112249
+ if (text4.startsWith("'") && text4.endsWith("'")) return text4.slice(1, -1);
112250
+ return text4;
112249
112251
  }
112250
112252
 
112251
112253
  // ../cli/src/lib/agents/yaml.ts
@@ -112265,9 +112267,9 @@ function stripComment(value) {
112265
112267
  const hash = value.slice(from).search(/(^|[ \t])#/);
112266
112268
  return hash < 0 ? value : value.slice(0, from + hash).trim();
112267
112269
  }
112268
- var readLines = (text3) => text3.split("\n").map((raw) => ({ indent: raw.match(/^[ \t]*/)[0].length, text: raw.trim() })).filter((line) => line.text && !line.text.startsWith("#"));
112269
- function parseYamlBlock(text3) {
112270
- const [map2] = readMap(readLines(text3), 0, 0);
112270
+ var readLines = (text4) => text4.split("\n").map((raw) => ({ indent: raw.match(/^[ \t]*/)[0].length, text: raw.trim() })).filter((line) => line.text && !line.text.startsWith("#"));
112271
+ function parseYamlBlock(text4) {
112272
+ const [map2] = readMap(readLines(text4), 0, 0);
112271
112273
  return map2;
112272
112274
  }
112273
112275
  function readMap(lines, start, indent) {
@@ -112353,12 +112355,12 @@ function readList(lines, start, indent) {
112353
112355
  }
112354
112356
  return [out, i];
112355
112357
  }
112356
- function splitFrontmatter(text3) {
112357
- const lines = text3.replace(/^/, "").split("\n");
112358
- if (lines[0]?.trim() !== "---") return { meta: null, body: text3 };
112358
+ function splitFrontmatter(text4) {
112359
+ const lines = text4.replace(/^/, "").split("\n");
112360
+ if (lines[0]?.trim() !== "---") return { meta: null, body: text4 };
112359
112361
  let i = 1;
112360
112362
  while (i < lines.length && lines[i].trim() !== "---") i++;
112361
- if (i >= lines.length) return { meta: null, body: text3 };
112363
+ if (i >= lines.length) return { meta: null, body: text4 };
112362
112364
  return { meta: lines.slice(1, i).join("\n"), body: lines.slice(i + 1).join("\n") };
112363
112365
  }
112364
112366
 
@@ -112367,14 +112369,14 @@ var OLD_ROLE_KEYS = ["lead", "hook", "stage", "kind"];
112367
112369
  var AGENT_NAME = /^[a-z0-9]+(-[a-z0-9]+)*$/;
112368
112370
  var SCHEDULE_READS = ["archived-cards", "chats", "dismissals"];
112369
112371
  var isScheduleReads = (value) => SCHEDULE_READS.includes(value);
112370
- function parseSpecAgent(text3, from, file2, builtIn = false, list2 = () => []) {
112372
+ function parseSpecAgent(text4, from, file2, builtIn = false, list2 = () => []) {
112371
112373
  let named = "";
112372
112374
  const bad = (why2, old2) => ({
112373
112375
  problem: `${from}: ${why2}`,
112374
112376
  ...named ? { name: named } : {},
112375
112377
  ...old2 ? { old: old2 } : {}
112376
112378
  });
112377
- const { meta, body } = splitFrontmatter(text3);
112379
+ const { meta, body } = splitFrontmatter(text4);
112378
112380
  if (meta === null) return bad("no `---` frontmatter, so it declares no name or description");
112379
112381
  const front = parseYamlBlock(meta);
112380
112382
  const name = str(front.name);
@@ -112411,20 +112413,20 @@ function parseSpecAgent(text3, from, file2, builtIn = false, list2 = () => []) {
112411
112413
  const title = map(row?.title);
112412
112414
  const instructions2 = str(row?.instructions);
112413
112415
  if (!row || Object.keys(row).some((key) => !["id", "title", "instructions", "when"].includes(key)) || !AGENT_NAME.test(id) || stages.some((stage) => stage.id === id)) return bad("`akb.stages` needs unique stage IDs and only id, title, instructions and optional when");
112414
- if (!title || !str(title.en) || Object.values(title).some((text4) => typeof text4 !== "string" || !text4.trim())) return bad(`stage ${id} needs a title map with en`);
112416
+ if (!title || !str(title.en) || Object.values(title).some((text5) => typeof text5 !== "string" || !text5.trim())) return bad(`stage ${id} needs a title map with en`);
112415
112417
  if (!instructions2.endsWith(".md") || instructions2.startsWith("/") || instructions2.includes("\\") || instructions2.split("/").some((part) => !part || part === ".." || part === ".") || !file2(instructions2)?.trim()) return bad(`stage ${id} needs an existing agent-relative instructions file`);
112416
112418
  if (row.when !== void 0 && !str(row.when)) return bad(`stage ${id} needs nonempty when text, or omit when for a required stage`);
112417
- stages.push({ id, title: Object.fromEntries(Object.entries(title).map(([lang, text4]) => [lang, str(text4)])), instructions: instructions2, ...str(row.when) ? { when: str(row.when) } : {} });
112419
+ stages.push({ id, title: Object.fromEntries(Object.entries(title).map(([lang, text5]) => [lang, str(text5)])), instructions: instructions2, ...str(row.when) ? { when: str(row.when) } : {} });
112418
112420
  }
112419
112421
  }
112420
112422
  const components = akb.components === void 0 ? ["Asset"] : akb.components;
112421
112423
  if (!Array.isArray(components) || components.some((value) => typeof value !== "string" || !value.trim())) {
112422
112424
  return bad(`\`${name}\` declares \`akb.components\` that is not a list of component IDs`);
112423
112425
  }
112424
- const icon = readIcon(akb.icon);
112425
- if (icon && typeof icon === "object" && "problem" in icon) {
112426
+ const icon2 = readIcon(akb.icon);
112427
+ if (icon2 && typeof icon2 === "object" && "problem" in icon2) {
112426
112428
  return bad(
112427
- `\`${name}\` declares an \`akb.icon\` where ${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(", ")}`
112429
+ `\`${name}\` declares an \`akb.icon\` where ${icon2.problem} \u2014 use one of ${ICON_NAMES.join(", ")}, or 1 to 12 parts \`{ d, f?, o?: true, s?, w? }\` coloured with ${ICON_COLORS.join(", ")}`
112428
112430
  );
112429
112431
  }
112430
112432
  const workspace = memoryPaths(akb.memoryFiles);
@@ -112439,7 +112441,7 @@ function parseSpecAgent(text3, from, file2, builtIn = false, list2 = () => []) {
112439
112441
  after,
112440
112442
  ...stages ? { stages } : {},
112441
112443
  components: [...new Set(components.map((value) => value.trim()))],
112442
- ...icon ? { icon } : {},
112444
+ ...icon2 ? { icon: icon2 } : {},
112443
112445
  ...akb.merges === "true" ? { merges: true } : {},
112444
112446
  i18n: readTranslations(akb.i18n),
112445
112447
  ...declaredReads ? { reads: declaredReads } : {},
@@ -112527,9 +112529,9 @@ function readPreviews(value) {
112527
112529
  }
112528
112530
  return readGroup(value);
112529
112531
  }
112530
- function parseStudioFile(id, source, from) {
112532
+ function parseStudioFile(id, source2, from) {
112531
112533
  if (!STUDIO_ID.test(id)) return { problem: `${from}: \`${id}\` is not a studio id \u2014 use lowercase letters, digits and dashes` };
112532
- const { meta, body } = splitFrontmatter(source);
112534
+ const { meta, body } = splitFrontmatter(source2);
112533
112535
  if (meta === null) return { problem: `${from}: no \`---\` frontmatter` };
112534
112536
  const raw = parseYamlBlock(meta);
112535
112537
  const name = text(raw.name).replace(/\s+/g, " ");
@@ -112540,10 +112542,10 @@ function parseStudioFile(id, source, from) {
112540
112542
  problem: `${from}: \`${old.join("`, `")}\` ${old.length > 1 ? "are" : "is"} no longer read \u2014 list the agents under \`previews\`, \`land\` and \`scheduled\` instead (\`akb guide write-agent\`), or ask the Studio builder to rewrite it`
112541
112543
  };
112542
112544
  }
112543
- const icon = readIcon(raw.icon);
112544
- if (icon && typeof icon === "object" && "problem" in icon) {
112545
+ const icon2 = readIcon(raw.icon);
112546
+ if (icon2 && typeof icon2 === "object" && "problem" in icon2) {
112545
112547
  return {
112546
- problem: `${from}: its \`icon\` is wrong \u2014 ${icon.problem}; use one of ${ICON_NAMES.join(", ")}, or 1 to 12 parts \`{ d, f?, o?: true, s?, w? }\` coloured with ${ICON_COLORS.join(", ")}`
112548
+ problem: `${from}: its \`icon\` is wrong \u2014 ${icon2.problem}; use one of ${ICON_NAMES.join(", ")}, or 1 to 12 parts \`{ d, f?, o?: true, s?, w? }\` coloured with ${ICON_COLORS.join(", ")}`
112547
112549
  };
112548
112550
  }
112549
112551
  const previews = readPreviews(raw.previews);
@@ -112572,7 +112574,7 @@ function parseStudioFile(id, source, from) {
112572
112574
  description: text(raw.description),
112573
112575
  when: text(raw.when),
112574
112576
  needsArtifact: text(raw.needsArtifact) === "true",
112575
- ...icon ? { icon } : {},
112577
+ ...icon2 ? { icon: icon2 } : {},
112576
112578
  previews,
112577
112579
  land,
112578
112580
  scheduled,
@@ -112599,7 +112601,7 @@ var hashInput = (files) => JSON.stringify(Object.entries(files).sort(([a2], [b2]
112599
112601
  var landsOf = (def) => ({ lands: def.land.some((h3) => !h3.off) });
112600
112602
  var SEGMENT = /^[\w.-]+$/;
112601
112603
  var isAboutFile = (file2) => /^ABOUT(\.[a-z]{2})?\.md$/.test(file2) || /^screenshots\/[\w.-]+\.(png|jpe?g|webp)$/.test(file2);
112602
- var bytes = (text3) => new TextEncoder().encode(text3).length;
112604
+ var bytes = (text4) => new TextEncoder().encode(text4).length;
112603
112605
  var isSharedFile = (file2) => {
112604
112606
  const parts = file2.split("/");
112605
112607
  return parts.length > 1 && parts[0] === "shared" && parts.slice(1).every((p2) => SEGMENT.test(p2) && p2 !== "." && p2 !== "..");
@@ -112610,10 +112612,10 @@ function folderPath(file2, top) {
112610
112612
  if (parts.slice(2).some((p2) => !SEGMENT.test(p2) || p2 === "." || p2 === "..")) return null;
112611
112613
  return [parts[1], parts.slice(2).join("/")];
112612
112614
  }
112613
- function mcpProblem(text3) {
112615
+ function mcpProblem(text4) {
112614
112616
  let read4;
112615
112617
  try {
112616
- read4 = JSON.parse(text3);
112618
+ read4 = JSON.parse(text4);
112617
112619
  } catch {
112618
112620
  return "is not JSON";
112619
112621
  }
@@ -112646,8 +112648,8 @@ function inspect(value, official) {
112646
112648
  let total = 0;
112647
112649
  const folders2 = /* @__PURE__ */ new Map();
112648
112650
  const skills = /* @__PURE__ */ new Set();
112649
- for (const [file2, text3] of entries) {
112650
- if (typeof text3 !== "string" || text3.includes("\0")) {
112651
+ for (const [file2, text4] of entries) {
112652
+ if (typeof text4 !== "string" || text4.includes("\0")) {
112651
112653
  fail(file2, "is not a text file");
112652
112654
  continue;
112653
112655
  }
@@ -112655,13 +112657,13 @@ function inspect(value, official) {
112655
112657
  fail(file2, `the path is longer than ${FILE_LIMITS.path} characters`);
112656
112658
  continue;
112657
112659
  }
112658
- const size = bytes(text3);
112660
+ const size = bytes(text4);
112659
112661
  if (size > FILE_LIMITS.file) return fail(file2, `is larger than ${FILE_LIMITS.file / KB} KB`, true);
112660
112662
  total += size;
112661
112663
  if (total > FILE_LIMITS.total) return fail("files", `are larger than ${FILE_LIMITS.total / KB / KB} MB together`, true);
112662
112664
  if (file2 === STUDIO_FILE || file2 === CARD_TEMPLATE_FILE) continue;
112663
112665
  if (official && file2 === MCP_FILE) {
112664
- const problem = mcpProblem(text3);
112666
+ const problem = mcpProblem(text4);
112665
112667
  if (problem) fail(file2, problem);
112666
112668
  continue;
112667
112669
  }
@@ -112678,24 +112680,24 @@ function inspect(value, official) {
112678
112680
  continue;
112679
112681
  }
112680
112682
  if (!folders2.has(at2[0])) folders2.set(at2[0], /* @__PURE__ */ new Map());
112681
- folders2.get(at2[0]).set(at2[1], text3);
112683
+ folders2.get(at2[0]).set(at2[1], text4);
112682
112684
  }
112683
112685
  for (const name of skills) {
112684
112686
  if (files[`skills/${name}/SKILL.md`] === void 0) fail(`skills/${name}/SKILL.md`, "is missing");
112685
112687
  }
112686
- const source = files[STUDIO_FILE];
112687
- const read4 = typeof source === "string" ? parseStudioFile("studio", source, STUDIO_FILE) : null;
112688
+ const source2 = files[STUDIO_FILE];
112689
+ const read4 = typeof source2 === "string" ? parseStudioFile("studio", source2, STUDIO_FILE) : null;
112688
112690
  if (!read4) fail(STUDIO_FILE, "is missing");
112689
112691
  else if ("problem" in read4) fail(STUDIO_FILE, read4.problem.replace(`${STUDIO_FILE}: `, ""));
112690
112692
  const agents = /* @__PURE__ */ new Map();
112691
112693
  for (const [name, own] of folders2) {
112692
112694
  const from = `agents/${name}/AGENT.md`;
112693
- const text3 = own.get("AGENT.md");
112694
- if (text3 === void 0) {
112695
+ const text4 = own.get("AGENT.md");
112696
+ if (text4 === void 0) {
112695
112697
  fail(from, "is missing");
112696
112698
  continue;
112697
112699
  }
112698
- const parsed = parseSpecAgent(text3, from, (p2) => own.get(p2) ?? null, false, () => [...own.keys()].filter((p2) => p2 !== "AGENT.md"));
112700
+ const parsed = parseSpecAgent(text4, from, (p2) => own.get(p2) ?? null, false, () => [...own.keys()].filter((p2) => p2 !== "AGENT.md"));
112699
112701
  if ("problem" in parsed) fail(from, parsed.problem.replace(`${from}: `, ""));
112700
112702
  else if (parsed.agent.name !== name) fail(from, `calls itself \`${parsed.agent.name}\`; it must match its folder`);
112701
112703
  else agents.set(name, parsed.agent);
@@ -112759,7 +112761,7 @@ function packOfficial(root2 = OFFICIAL, loose = false) {
112759
112761
  if ("problem" in parsed) throw new Error(parsed.problem);
112760
112762
  const def = parsed.def;
112761
112763
  for (const name of [...new Set([...def.previews, ...def.land, ...def.scheduled].map((h3) => h3.agent))].sort()) {
112762
- for (const [f2, text3] of Object.entries(agentFiles[name] ?? {})) files[`agents/${name}/${f2}`] = text3;
112764
+ for (const [f2, text4] of Object.entries(agentFiles[name] ?? {})) files[`agents/${name}/${f2}`] = text4;
112763
112765
  }
112764
112766
  const checked = loose ? { ok: true } : checkStudioFiles(files, true);
112765
112767
  if (!checked.ok) throw new Error(`official/studios/${folder}: ${checked.file}: ${checked.reason}`);
@@ -112941,14 +112943,14 @@ function cloudAgentFiles() {
112941
112943
  const official = /* @__PURE__ */ new Set();
112942
112944
  const owner2 = /* @__PURE__ */ new Map();
112943
112945
  for (const flow of cloudFlows()) {
112944
- for (const [name, text3] of Object.entries(flow.files)) {
112946
+ for (const [name, text4] of Object.entries(flow.files)) {
112945
112947
  const at2 = /^agents\/([^/]+)\/(.+)$/.exec(name);
112946
112948
  if (!at2) continue;
112947
112949
  const [, agent, rest] = at2;
112948
112950
  if (owner2.has(agent) && owner2.get(agent) !== flow.cloudId) continue;
112949
112951
  owner2.set(agent, flow.cloudId);
112950
112952
  if (flow.builtIn) official.add(agent);
112951
- files[`${agent}/${rest}`] = text3;
112953
+ files[`${agent}/${rest}`] = text4;
112952
112954
  }
112953
112955
  }
112954
112956
  return { files, official };
@@ -113148,7 +113150,7 @@ var tiled_default = `{
113148
113150
  var video_default = '{ "name": "video", "title": { "en": "Video", "zh": "\u89C6\u9891" }, "types": ["video"] }\n';
113149
113151
 
113150
113152
  // ../artifact-sdk/src/builtin/studio.json
113151
- var studio_default = '{\n "name": "studio",\n "title": { "en": "Studio", "zh": "\u5DE5\u4F5C\u53F0" },\n "types": ["studio"],\n "schema": {\n "type": "object",\n "required": ["rounds", "land", "scheduled"],\n "properties": {\n "rounds": {\n "type": "array",\n "items": {\n "type": "array",\n "minItems": 1,\n "items": { "type": "object", "required": ["agent", "title"], "properties": { "agent": { "type": "string" }, "title": { "type": "object", "required": ["en"] } } }\n }\n },\n "land": { "type": "array", "items": { "type": "object", "required": ["agent", "title"] } },\n "scheduled": { "type": "array", "items": { "type": "object", "required": ["agent", "title"] } }\n }\n }\n}\n';
113153
+ var studio_default = '{\n "name": "studio",\n "title": {\n "en": "Studio",\n "zh": "\u5DE5\u4F5C\u53F0"\n },\n "types": [\n "studio"\n ],\n "schema": {\n "anyOf": [\n {\n "type": "object",\n "required": [\n "rounds",\n "land",\n "scheduled"\n ],\n "properties": {\n "rounds": {\n "type": "array",\n "items": {\n "type": "array",\n "minItems": 1,\n "items": {\n "type": "object",\n "required": [\n "agent",\n "title"\n ],\n "properties": {\n "agent": {\n "type": "string"\n },\n "title": {\n "type": "object",\n "required": [\n "en"\n ]\n }\n }\n }\n }\n },\n "land": {\n "type": "array",\n "items": {\n "type": "object",\n "required": [\n "agent",\n "title"\n ]\n }\n },\n "scheduled": {\n "type": "array",\n "items": {\n "type": "object",\n "required": [\n "agent",\n "title"\n ]\n }\n },\n "version": {\n "enum": [\n 1\n ]\n }\n }\n },\n {\n "type": "object",\n "required": [\n "version",\n "base",\n "fingerprint",\n "agents",\n "files",\n "results"\n ],\n "properties": {\n "version": {\n "const": 2\n },\n "base": {\n "anyOf": [\n {\n "type": "null"\n },\n {\n "type": "object",\n "required": [\n "id",\n "version",\n "fingerprint"\n ],\n "properties": {\n "id": {\n "type": "string",\n "minLength": 1\n },\n "version": {\n "type": "integer",\n "minimum": 1\n },\n "fingerprint": {\n "type": "string",\n "minLength": 1\n }\n }\n }\n ]\n },\n "fingerprint": {\n "type": "string",\n "minLength": 1\n },\n "agents": {\n "type": "array",\n "maxItems": 500,\n "items": {\n "type": "object",\n "required": [\n "agent",\n "title"\n ],\n "properties": {\n "agent": {\n "type": "string",\n "minLength": 1\n },\n "title": {\n "type": "object",\n "required": [\n "en"\n ],\n "properties": {\n "en": {\n "type": "string",\n "minLength": 1\n },\n "zh": {\n "type": "string"\n }\n }\n }\n }\n }\n },\n "files": {\n "type": "array",\n "maxItems": 1000,\n "items": {\n "type": "object",\n "required": [\n "path",\n "before",\n "after"\n ],\n "properties": {\n "path": {\n "type": "string",\n "minLength": 1\n },\n "before": {\n "anyOf": [\n {\n "type": "string",\n "minLength": 1\n },\n {\n "type": "null"\n }\n ]\n },\n "after": {\n "anyOf": [\n {\n "type": "string",\n "minLength": 1\n },\n {\n "type": "null"\n }\n ]\n },\n "diff": {\n "type": "string",\n "minLength": 1\n }\n }\n }\n },\n "results": {\n "type": "array",\n "maxItems": 500,\n "items": {\n "anyOf": [\n {\n "type": "object",\n "required": [\n "agent",\n "component",\n "src"\n ],\n "properties": {\n "agent": {\n "type": "string",\n "minLength": 1\n },\n "component": {\n "const": "Asset"\n },\n "src": {\n "type": "string",\n "minLength": 1\n },\n "label": {\n "type": "string"\n },\n "alt": {\n "type": "string"\n },\n "device": {\n "enum": [\n "mobile",\n "desktop"\n ]\n },\n "loop": {\n "type": "boolean"\n },\n "variants": {\n "type": "object",\n "additionalProperties": {\n "type": "string",\n "minLength": 1\n }\n }\n }\n },\n {\n "type": "object",\n "required": [\n "agent",\n "component",\n "label",\n "items"\n ],\n "properties": {\n "agent": {\n "type": "string",\n "minLength": 1\n },\n "component": {\n "const": "Set"\n },\n "label": {\n "type": "string"\n },\n "items": {\n "type": "array",\n "minItems": 1,\n "maxItems": 500,\n "items": {\n "type": "object",\n "required": [\n "src"\n ],\n "properties": {\n "src": {\n "type": "string",\n "minLength": 1\n },\n "label": {\n "type": "string"\n },\n "alt": {\n "type": "string"\n },\n "device": {\n "enum": [\n "mobile",\n "desktop"\n ]\n },\n "loop": {\n "type": "boolean"\n },\n "variants": {\n "type": "object",\n "additionalProperties": {\n "type": "string",\n "minLength": 1\n }\n }\n }\n }\n }\n }\n },\n {\n "type": "object",\n "required": [\n "agent",\n "component",\n "a",\n "b"\n ],\n "properties": {\n "agent": {\n "type": "string",\n "minLength": 1\n },\n "component": {\n "const": "Compare"\n },\n "a": {\n "type": "string",\n "minLength": 1\n },\n "b": {\n "type": "string",\n "minLength": 1\n },\n "shots": {\n "type": "string",\n "minLength": 1\n },\n "label": {\n "type": "string"\n },\n "a-label": {\n "type": "string"\n },\n "b-label": {\n "type": "string"\n }\n }\n },\n {\n "type": "object",\n "required": [\n "agent",\n "component",\n "src"\n ],\n "properties": {\n "agent": {\n "type": "string",\n "minLength": 1\n },\n "component": {\n "const": "Storyboard"\n },\n "src": {\n "type": "string",\n "minLength": 1\n },\n "label": {\n "type": "string"\n }\n }\n }\n ]\n }\n }\n }\n }\n ]\n },\n "references": [\n {\n "json": "/files/*/before"\n },\n {\n "json": "/files/*/after"\n },\n {\n "json": "/files/*/diff"\n },\n {\n "json": "/results/*/src",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/variants/*",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/a",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/b",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/shots",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/items/*/src",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/items/*/variants/*",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/items/*/a",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/items/*/b",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/items/*/shots",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n }\n ]\n}\n';
113152
113154
 
113153
113155
  // ../artifact-sdk/src/builtin/index.ts
113154
113156
  var read = (m) => typeof m === "string" ? JSON.parse(m) : m;
@@ -113213,67 +113215,12 @@ function schemaProblem(schema, value, at2 = "") {
113213
113215
  return null;
113214
113216
  }
113215
113217
 
113216
- // ../artifact-sdk/src/internal/manifest.ts
113217
- var BUILTINS = builtin_default;
113218
- var manifestOf = (type) => BUILTINS.find((m) => m.types.includes(type));
113219
- function typeOf(data, types) {
113220
- for (const type of types) if (!schemaProblem(manifestOf(type)?.schema, data)) return { type };
113221
- if (types.length !== 1) return { type: null };
113222
- return { type: types[0], problem: `does not match ${types[0]} at ${schemaProblem(manifestOf(types[0])?.schema, data)}` };
113223
- }
113224
- var isObject = (v) => !!v && typeof v === "object" && !Array.isArray(v);
113225
- var remote = (src) => !src || /^(?:[a-z][\w+.-]*:|\/|#)/i.test(src);
113226
- function mapJson(node, keys, at2, visit) {
113227
- if (!keys.length) return typeof node === "string" && node ? visit(node, at2) : node;
113228
- const [key, ...rest] = keys;
113229
- if (Array.isArray(node)) {
113230
- if (key === "*") return node.map((x2, i2) => mapJson(x2, rest, `${at2}/${i2}`, visit));
113231
- const i = Number(key);
113232
- return Number.isInteger(i) && i in node ? node.map((x2, j2) => j2 === i ? mapJson(x2, rest, `${at2}/${j2}`, visit) : x2) : node;
113233
- }
113234
- if (!isObject(node)) return node;
113235
- const out = { ...node };
113236
- for (const k2 of key === "*" ? Object.keys(node) : key in node ? [key] : []) out[k2] = mapJson(node[k2], rest, `${at2}/${k2}`, visit);
113237
- return out;
113238
- }
113239
- function mapText(text3, rule, skipped, visit) {
113240
- let out = "";
113241
- let last = 0;
113242
- for (const m of text3.matchAll(new RegExp(rule.text, "gid"))) {
113243
- const span = m.indices?.[1];
113244
- if (!span || m[1] === void 0 || skipped.some(([a2, b2]) => span[0] >= a2 && span[0] < b2)) continue;
113245
- const line = text3.slice(0, span[0]).split("\n").length;
113246
- const one = (src) => remote(src) ? src : visit(src, line);
113247
- const value = rule.list ? m[1].split(rule.list).map((part) => part.replace(/^(\s*)(\S+)/, (_2, space, src) => space + one(src))).join(rule.list) : one(m[1]);
113248
- out += text3.slice(last, span[0]) + value;
113249
- last = span[1];
113250
- }
113251
- return out + text3.slice(last);
113252
- }
113253
- function mapReferences(manifest, content, map2) {
113254
- const skipped = (text3) => (manifest?.skip ?? []).flatMap((re3) => [...text3.matchAll(new RegExp(re3, "gi"))].map((m) => [m.index, m.index + m[0].length]));
113255
- for (const rule of manifest?.references ?? []) {
113256
- const types = rule.types ?? [];
113257
- if ("json" in rule) {
113258
- if (typeof content !== "string") content = mapJson(content, rule.json.split("/").filter(Boolean), "", (src, at2) => map2(src, { src, types, text: false, at: at2 || "/" }));
113259
- } else if (typeof content === "string") {
113260
- content = mapText(content, rule, skipped(content), (src, line) => map2(src, { src, types, text: true, line }));
113261
- }
113262
- }
113263
- return content;
113264
- }
113265
- function referencesOf(manifest, content) {
113266
- const found = [];
113267
- mapReferences(manifest, content, (src, ref) => (found.push(ref), src));
113268
- return found;
113269
- }
113270
-
113271
113218
  // ../artifact-sdk/src/internal/references.ts
113272
113219
  var STORYBOARD = ["storyboard"];
113273
113220
  var STUDIO = ["studio"];
113274
113221
  var ARRANGED = ["storyboard", "compare", "spritesheet", "studio"];
113275
113222
  var ASSET = ["spritesheet", "asset"];
113276
- var isObject2 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
113223
+ var isObject = (v) => !!v && typeof v === "object" && !Array.isArray(v);
113277
113224
  function bodyReferences(body) {
113278
113225
  const lines = body.replace(/<!--[^]*?-->/g, "").split(/\r?\n/);
113279
113226
  let fence = "";
@@ -113297,9 +113244,9 @@ function bodyReferences(body) {
113297
113244
  if (kept4 && /^ {0,3}<(?:Asset|Mockup|Compare|Storyboard|Studio)\b/.test(line)) inTag = true;
113298
113245
  if (line.includes("/>")) inTag = false;
113299
113246
  }
113300
- const text3 = visible.join("\n").replace(/(`+)[^]*?\1/g, "");
113247
+ const text4 = visible.join("\n").replace(/(`+)[^]*?\1/g, "");
113301
113248
  const tag = /<(Asset|Mockup|Compare|Storyboard|Studio)\b([^<>]*?)\/>/g;
113302
- const blocks = text3.matchAll(/^ {0,3}(?:<(?:Asset|Mockup|Compare|Storyboard|Studio)\b[^<>]*?\/>[ \t]*(?:\n[ \t]*)?)+$/gm);
113249
+ const blocks = text4.matchAll(/^ {0,3}(?:<(?:Asset|Mockup|Compare|Storyboard|Studio)\b[^<>]*?\/>[ \t]*(?:\n[ \t]*)?)+$/gm);
113303
113250
  for (const block of blocks) {
113304
113251
  const tags = [...block[0].matchAll(tag)];
113305
113252
  for (const m of tags) {
@@ -113313,7 +113260,7 @@ function bodyReferences(body) {
113313
113260
  if (a2.variants) {
113314
113261
  try {
113315
113262
  const v = JSON.parse(a2.variants);
113316
- if (isObject2(v)) {
113263
+ if (isObject(v)) {
113317
113264
  for (const src of Object.values(v)) if (typeof src === "string" && src) out.push({ src, types: m[1] === "Asset" ? ASSET : [] });
113318
113265
  }
113319
113266
  } catch {
@@ -113322,7 +113269,7 @@ function bodyReferences(body) {
113322
113269
  }
113323
113270
  }
113324
113271
  }
113325
- for (const m of text3.replace(tag, "").matchAll(/\]\(\s*<?([^\s)>]+)>?(?:\s+["'][^]*?["'])?\s*\)/g)) out.push({ src: m[1], types: [] });
113272
+ for (const m of text4.replace(tag, "").matchAll(/\]\(\s*<?([^\s)>]+)>?(?:\s+["'][^]*?["'])?\s*\)/g)) out.push({ src: m[1], types: [] });
113326
113273
  return out;
113327
113274
  }
113328
113275
  var TYPES = {
@@ -113362,6 +113309,100 @@ function kindOf(ext) {
113362
113309
  return type.startsWith("video/") || type.startsWith("audio/") ? "video" : "asset";
113363
113310
  }
113364
113311
 
113312
+ // ../artifact-sdk/src/internal/format/studio.ts
113313
+ var text2 = (v) => typeof v === "string" && v.length > 0;
113314
+ var source = (v) => text2(v) && !/^(?:[a-z][\w+.-]*:|\/|#)|\\|[\u0000-\u001f]/i.test(v);
113315
+ var icon = (v) => v === void 0 || typeof v === "string" || Array.isArray(v) && v.length > 0 && v.length <= 12 && v.every((p2) => isObject(p2) && text2(p2.d) && /^[MmLlHhVvCcSsQqTtAaZz0-9.,\s-]+$/.test(p2.d) && ["f", "s"].every((k2) => p2[k2] === void 0 || typeof p2[k2] === "string" && /^[kwcgopsmlry]$/.test(p2[k2])) && (p2.o === void 0 || p2.o === true) && (p2.w === void 0 || typeof p2.w === "number" && p2.w > 0 && p2.w <= 3));
113316
+ var relativePath = (v) => source(v) && v.split("/").every((p2) => p2 && p2 !== "." && p2 !== "..");
113317
+ var optionalText = (v, keys) => keys.every((k2) => v[k2] === void 0 || typeof v[k2] === "string");
113318
+ 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));
113319
+ function resultProblem(value, agents) {
113320
+ if (!Array.isArray(value) || value.length > 500) return "/results";
113321
+ for (let i = 0; i < value.length; i++) {
113322
+ const r2 = value[i];
113323
+ if (!isObject(r2) || !text2(r2.agent) || !agents.has(r2.agent) || !optionalText(r2, ["label"])) return `/results/${i}`;
113324
+ 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);
113325
+ if (!valid) return `/results/${i}`;
113326
+ }
113327
+ return null;
113328
+ }
113329
+ function reviewProblem(v) {
113330
+ if (!isObject(v) || v.version !== 2) return "/version";
113331
+ if (!text2(v.fingerprint)) return "/fingerprint";
113332
+ if (v.base !== null && !(isObject(v.base) && text2(v.base.id) && Number.isInteger(v.base.version) && Number(v.base.version) > 0 && text2(v.base.fingerprint))) return "/base";
113333
+ if (!Array.isArray(v.agents) || v.agents.length > 500) return "/agents";
113334
+ const agents = /* @__PURE__ */ new Set();
113335
+ for (const a2 of v.agents) {
113336
+ if (!isObject(a2) || !text2(a2.agent) || !/^[a-z][a-z0-9-]*$/.test(a2.agent) || agents.has(a2.agent) || !isObject(a2.title) || !text2(a2.title.en) || !optionalText(a2.title, ["zh"]) || !icon(a2.icon)) return "/agents";
113337
+ agents.add(a2.agent);
113338
+ }
113339
+ if (!Array.isArray(v.files) || v.files.length > 1e3) return "/files";
113340
+ const paths = /* @__PURE__ */ new Set();
113341
+ for (const f2 of v.files) {
113342
+ 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";
113343
+ if (f2.path.startsWith("agents/") && !agents.has(f2.path.split("/")[1])) return "/files";
113344
+ paths.add(f2.path);
113345
+ }
113346
+ return resultProblem(v.results, agents);
113347
+ }
113348
+ var isReview = (v) => isObject(v) && v.version === 2;
113349
+
113350
+ // ../artifact-sdk/src/internal/manifest.ts
113351
+ var BUILTINS = builtin_default;
113352
+ var manifestOf = (type) => BUILTINS.find((m) => m.types.includes(type));
113353
+ function typeOf(data, types) {
113354
+ const problem = (type) => type === "studio" && isReview(data) ? reviewProblem(data) : schemaProblem(manifestOf(type)?.schema, data);
113355
+ for (const type of types) if (!problem(type)) return { type };
113356
+ if (types.length !== 1) return { type: null };
113357
+ return { type: types[0], problem: `does not match ${types[0]} at ${problem(types[0])}` };
113358
+ }
113359
+ var isObject2 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
113360
+ var remote = (src) => !src || /^(?:[a-z][\w+.-]*:|\/|#)/i.test(src);
113361
+ function mapJson(node, keys, at2, visit) {
113362
+ if (!keys.length) return typeof node === "string" && node ? visit(node, at2) : node;
113363
+ const [key, ...rest] = keys;
113364
+ if (Array.isArray(node)) {
113365
+ if (key === "*") return node.map((x2, i2) => mapJson(x2, rest, `${at2}/${i2}`, visit));
113366
+ const i = Number(key);
113367
+ return Number.isInteger(i) && i in node ? node.map((x2, j2) => j2 === i ? mapJson(x2, rest, `${at2}/${j2}`, visit) : x2) : node;
113368
+ }
113369
+ if (!isObject2(node)) return node;
113370
+ const out = { ...node };
113371
+ for (const k2 of key === "*" ? Object.keys(node) : key in node ? [key] : []) out[k2] = mapJson(node[k2], rest, `${at2}/${k2}`, visit);
113372
+ return out;
113373
+ }
113374
+ function mapText(text4, rule, skipped, visit, includeRemote) {
113375
+ let out = "";
113376
+ let last = 0;
113377
+ for (const m of text4.matchAll(new RegExp(rule.text, "gid"))) {
113378
+ const span = m.indices?.[1];
113379
+ if (!span || m[1] === void 0 || skipped.some(([a2, b2]) => span[0] >= a2 && span[0] < b2)) continue;
113380
+ const line = text4.slice(0, span[0]).split("\n").length;
113381
+ const one = (src) => remote(src) && !includeRemote ? src : visit(src, line);
113382
+ 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]);
113383
+ out += text4.slice(last, span[0]) + value;
113384
+ last = span[1];
113385
+ }
113386
+ return out + text4.slice(last);
113387
+ }
113388
+ function mapReferences(manifest, content, map2, includeRemote = false) {
113389
+ const skipped = (text4) => (manifest?.skip ?? []).flatMap((re3) => [...text4.matchAll(new RegExp(re3, "gi"))].map((m) => [m.index, m.index + m[0].length]));
113390
+ for (const rule of manifest?.references ?? []) {
113391
+ const types = rule.types ?? [];
113392
+ if ("json" in rule) {
113393
+ if (typeof content !== "string") content = mapJson(content, rule.json.split("/").filter(Boolean), "", (src, at2) => map2(src, { src, types, text: false, at: at2 || "/" }));
113394
+ } else if (typeof content === "string") {
113395
+ content = mapText(content, rule, skipped(content), (src, line) => map2(src, { src, types, text: true, line }), includeRemote);
113396
+ }
113397
+ }
113398
+ return content;
113399
+ }
113400
+ function referencesOf(manifest, content, includeRemote = false) {
113401
+ const found = [];
113402
+ mapReferences(manifest, content, (src, ref) => (found.push(ref), src), includeRemote);
113403
+ return found;
113404
+ }
113405
+
113365
113406
  // ../artifact-sdk/src/internal/collect.ts
113366
113407
  var extOf = (file2) => /\.[^./\\]+$/.exec(file2)?.[0].toLowerCase() ?? "";
113367
113408
  var why = (error) => error instanceof Error ? error.message : String(error);
@@ -113371,10 +113412,13 @@ var textKind = (ext, types) => types.find((t) => {
113371
113412
  }) ?? kindOf(ext);
113372
113413
  var kindAt = (src, types) => extOf(src) === ".json" ? types.includes("asset") ? "asset" : types[0] ?? "asset" : textKind(extOf(src), types);
113373
113414
  function collect(body, card, host) {
113415
+ return collectSources(bodyReferences(body), card, host);
113416
+ }
113417
+ function collectSources(sources2, card, host) {
113374
113418
  const nodes = /* @__PURE__ */ new Map();
113375
113419
  const active = /* @__PURE__ */ new Set();
113376
113420
  const out = [];
113377
- const visit = (src, types, owner2) => {
113421
+ const visit = (src, types, owner2, partial = false) => {
113378
113422
  const path47 = src.replace(/[?#].*$/, "");
113379
113423
  let resolved;
113380
113424
  try {
@@ -113390,7 +113434,11 @@ function collect(body, card, host) {
113390
113434
  }
113391
113435
  if (!resolved) return { key: null };
113392
113436
  const { key, file: file2 } = resolved;
113393
- if (active.has(key)) throw new Error(`${owner2}: ${src}: \u8D44\u6E90\u4F9D\u8D56\u5FAA\u73AF`);
113437
+ if (active.has(key)) {
113438
+ const error = `${owner2}: ${src}: \u8D44\u6E90\u4F9D\u8D56\u5FAA\u73AF`;
113439
+ if (partial) return { key: null, error };
113440
+ throw new Error(error);
113441
+ }
113394
113442
  const json = !!file2 && extOf(file2) === ".json";
113395
113443
  const held5 = nodes.get(key);
113396
113444
  if (held5) {
@@ -113403,10 +113451,10 @@ function collect(body, card, host) {
113403
113451
  nodes.set(key, node);
113404
113452
  active.add(key);
113405
113453
  const child = (ref, from) => {
113406
- const found = visit(ref.src, ref.types, from);
113454
+ const found = visit(ref.src, ref.types, from, partial || node.kind === "studio" && node.data?.version === 2);
113407
113455
  if (found.key) node.dependencies.set(ref.src, found.key);
113408
113456
  else if (found.error) node.problems.push({ src: ref.src, ..."line" in ref ? { line: ref.line } : {}, ..."at" in ref ? { at: ref.at } : {}, message: found.error });
113409
- node.error ??= found.error;
113457
+ if (!(node.kind === "studio" && node.data?.version === 2)) node.error ??= found.error;
113410
113458
  };
113411
113459
  if (file2) {
113412
113460
  if (json) {
@@ -113429,13 +113477,13 @@ function collect(body, card, host) {
113429
113477
  node.error = node.problems[0]?.message;
113430
113478
  if (!node.error) for (const ref of referencesOf(manifestOf(node.kind), node.data)) child(ref, file2);
113431
113479
  } else {
113432
- for (const ref of host.retained(key)) child(ref, card);
113480
+ for (const ref of host.retained(key, types)) child(ref, card);
113433
113481
  }
113434
113482
  active.delete(key);
113435
113483
  out.push(node);
113436
113484
  return { key, error: node.error };
113437
113485
  };
113438
- for (const ref of bodyReferences(body)) visit(ref.src, ref.types, card);
113486
+ for (const ref of sources2) visit(ref.src, ref.types, card);
113439
113487
  const sorted = [];
113440
113488
  const done = /* @__PURE__ */ new Set();
113441
113489
  const order = (node) => {
@@ -113766,9 +113814,9 @@ var officialAgent = (name) => cloudAgentFiles().official.has(name);
113766
113814
  // ../cli/src/lib/agents/shared-memory.ts
113767
113815
  function sharedMemory(board) {
113768
113816
  const declared = /* @__PURE__ */ new Map();
113769
- const take = (folder, text3, builtIn) => {
113770
- if (text3 === null || declared.has(folder)) return;
113771
- const read4 = parseSpecAgent(text3, folder, (relative) => {
113817
+ const take = (folder, text4, builtIn) => {
113818
+ if (text4 === null || declared.has(folder)) return;
113819
+ const read4 = parseSpecAgent(text4, folder, (relative) => {
113772
113820
  if (builtIn) return shippedAgentFiles()[`${folder}/${relative}`] ?? null;
113773
113821
  try {
113774
113822
  return fs18.readFileSync(path19.join(board, "agents", folder, relative), "utf8");
@@ -113778,9 +113826,9 @@ function sharedMemory(board) {
113778
113826
  }, builtIn);
113779
113827
  if ("agent" in read4 && read4.agent.name === folder) declared.set(folder, read4.agent.memoryFiles.workspace);
113780
113828
  };
113781
- for (const [key, text3] of Object.entries(shippedAgentFiles())) {
113829
+ for (const [key, text4] of Object.entries(shippedAgentFiles())) {
113782
113830
  const at2 = /^([^/]+)\/AGENT\.md$/.exec(key);
113783
- if (at2) take(at2[1], text3, officialAgent(at2[1]));
113831
+ if (at2) take(at2[1], text4, officialAgent(at2[1]));
113784
113832
  }
113785
113833
  const root2 = path19.join(board, "agents");
113786
113834
  let folders2 = [];
@@ -113789,12 +113837,12 @@ function sharedMemory(board) {
113789
113837
  } catch {
113790
113838
  }
113791
113839
  for (const folder of folders2.sort()) {
113792
- let text3 = null;
113840
+ let text4 = null;
113793
113841
  try {
113794
- text3 = fs18.readFileSync(path19.join(root2, folder, "AGENT.md"), "utf8");
113842
+ text4 = fs18.readFileSync(path19.join(root2, folder, "AGENT.md"), "utf8");
113795
113843
  } catch {
113796
113844
  }
113797
- take(folder, text3, false);
113845
+ take(folder, text4, false);
113798
113846
  }
113799
113847
  const matches = [
113800
113848
  matcher("agents/copywriting/style.md"),
@@ -114085,13 +114133,13 @@ function pullTools(ws, record, files) {
114085
114133
  const theirs = (skill) => !ours.has(skill) && SKILL_ROOTS.some((root2) => fs20.existsSync(path21.join(ws.cwd, root2, skill)));
114086
114134
  const kept4 = Object.keys(files).map((name) => SKILL_PATH.exec(name)?.[1]).filter((skill) => skill && !theirs(skill));
114087
114135
  const skills = {};
114088
- for (const [name, text3] of Object.entries(files)) {
114136
+ for (const [name, text4] of Object.entries(files)) {
114089
114137
  const at2 = SKILL_PATH.exec(name);
114090
114138
  if (!at2 || at2[1] === "kanban" || !kept4.includes(at2[1]) || at2[2].split("/").includes("..")) continue;
114091
- skills[name] = hashOf2(text3);
114139
+ skills[name] = hashOf2(text4);
114092
114140
  for (const root2 of SKILL_ROOTS) {
114093
114141
  const file2 = path21.join(ws.cwd, root2, at2[1], at2[2]);
114094
- if (held5[name] !== skills[name] || hashFile(file2) !== skills[name]) write(file2, text3);
114142
+ if (held5[name] !== skills[name] || hashFile(file2) !== skills[name]) write(file2, text4);
114095
114143
  }
114096
114144
  }
114097
114145
  for (const name of Object.keys(held5)) {
@@ -114185,9 +114233,9 @@ function stateDir(ws) {
114185
114233
  return null;
114186
114234
  }
114187
114235
  }
114188
- function assetsOf(text3) {
114236
+ function assetsOf(text4) {
114189
114237
  try {
114190
- const held5 = JSON.parse(text3 ?? "{}");
114238
+ const held5 = JSON.parse(text4 ?? "{}");
114191
114239
  return held5 && typeof held5 === "object" && !Array.isArray(held5) ? held5 : {};
114192
114240
  } catch {
114193
114241
  return {};
@@ -114273,13 +114321,13 @@ function writeIndex(board) {
114273
114321
  const id = /^(\d+)-/.exec(e2.name)?.[1];
114274
114322
  if (!id) continue;
114275
114323
  const link = e2.isDirectory() ? `${e2.name}/root.md` : e2.name.endsWith(".md") ? e2.name : null;
114276
- const text4 = link && readText(path21.join(todo, link));
114277
- if (text4 === null || !link) continue;
114278
- cards.push({ id: Number(id), title: cardFront(text4).title ?? e2.name.replace(/\.md$/, ""), link });
114324
+ const text5 = link && readText(path21.join(todo, link));
114325
+ if (text5 === null || !link) continue;
114326
+ cards.push({ id: Number(id), title: cardFront(text5).title ?? e2.name.replace(/\.md$/, ""), link });
114279
114327
  }
114280
114328
  cards.sort((a2, b2) => a2.id - b2.id);
114281
114329
  const list2 = cards.length ? cards.map((c2) => `- [#${c2.id} ${c2.title}](${c2.link})`).join("\n") : "_(none)_";
114282
- const text3 = `# Board
114330
+ const text4 = `# Board
114283
114331
 
114284
114332
  Open tasks for the kanban board. One card per file. Ids are global and never reused \u2014
114285
114333
  the number at the front of a filename is the task id.
@@ -114288,7 +114336,7 @@ the number at the front of a filename is the task id.
114288
114336
 
114289
114337
  ${list2}
114290
114338
  `;
114291
- if (readText(path21.join(todo, "README.md")) !== text3) write(path21.join(todo, "README.md"), text3);
114339
+ if (readText(path21.join(todo, "README.md")) !== text4) write(path21.join(todo, "README.md"), text4);
114292
114340
  }
114293
114341
  var workspaceOf = (ws) => readBase(ws).workspace ?? null;
114294
114342
  async function pullAssets(ws, record, assets) {
@@ -114375,18 +114423,18 @@ async function pullAssets(ws, record, assets) {
114375
114423
  }
114376
114424
  const json = data !== void 0 && typeof data !== "string";
114377
114425
  if (held5?.artifact === ref.artifact && held5.version === version && !held5.localHash && json) {
114378
- const source = readText(target);
114379
- if (source !== null) {
114426
+ const source2 = readText(target);
114427
+ if (source2 !== null) {
114380
114428
  let same = false;
114381
114429
  try {
114382
- same = JSON.stringify(JSON.parse(source)) === JSON.stringify(JSON.parse(Buffer.from(local).toString()));
114430
+ same = JSON.stringify(JSON.parse(source2)) === JSON.stringify(JSON.parse(Buffer.from(local).toString()));
114383
114431
  } catch {
114384
114432
  }
114385
114433
  if (!same) {
114386
114434
  out[name] = { ...held5, kind };
114387
114435
  continue;
114388
114436
  }
114389
- local = Buffer.from(source);
114437
+ local = Buffer.from(source2);
114390
114438
  }
114391
114439
  }
114392
114440
  write(target, local);
@@ -114458,6 +114506,7 @@ async function pushAssets(ws, record, before) {
114458
114506
  return path21.relative(real(path21.dirname(file2)), target).split(path21.sep).join("/");
114459
114507
  };
114460
114508
  try {
114509
+ let recoveredReferences = false;
114461
114510
  const graph = collect(body, file2, {
114462
114511
  resolve: (src, owner2) => {
114463
114512
  const id = Object.entries(before).find(([, ref]) => ref.artifact === src);
@@ -114472,17 +114521,25 @@ async function pushAssets(ws, record, before) {
114472
114521
  return { key: canonical(fs20.realpathSync(target)), file: target };
114473
114522
  },
114474
114523
  read: referenceText,
114475
- retained: (key) => (record.assets[key]?.dependencies ?? []).map((src) => {
114476
- const kind = record.assets[src]?.kind;
114477
- return { src, types: kind ? [kind] : [] };
114478
- })
114524
+ retained: (key, types) => {
114525
+ let dependencies = record.assets[key]?.dependencies;
114526
+ if (!dependencies && types.length === 1 && types[0] === "studio" && before[key] && !recoveredReferences) {
114527
+ recoveredReferences = true;
114528
+ dependencies = Object.keys(before).filter((src) => src !== key);
114529
+ }
114530
+ return (dependencies ?? []).map((src) => {
114531
+ const kind = record.assets[src]?.kind;
114532
+ return { src, types: kind ? [kind] : [] };
114533
+ });
114534
+ }
114479
114535
  });
114480
114536
  for (const node of graph) {
114481
114537
  const previous = [...node.aliases].map((key) => record.assets[key]).find(Boolean);
114482
114538
  const old = [...node.aliases].map((key) => before[key]).find(Boolean);
114483
114539
  const kind = node.kind;
114484
114540
  let out;
114485
- let why2 = node.error ?? [...node.dependencies.values()].map((key) => refs[key]?.error).find(Boolean);
114541
+ const partialStudio = node.kind === "studio" && node.data?.version === 2;
114542
+ let why2 = node.error ?? (partialStudio ? void 0 : [...node.dependencies.values()].map((key) => refs[key]?.error).find(Boolean));
114486
114543
  if (!why2 && node.file) {
114487
114544
  try {
114488
114545
  if (fs20.statSync(node.file).size > ASSET_FILE_LIMIT) throw new Error("This asset is over 100 MiB.");
@@ -114896,15 +114953,15 @@ function isLanguage(value) {
114896
114953
  // ../cli/src/lib/machine/settings.ts
114897
114954
  var settingsFile = () => path22.join(machineHome(), "settings.json");
114898
114955
  function heldSettings() {
114899
- let text3;
114956
+ let text4;
114900
114957
  try {
114901
- text3 = fs21.readFileSync(settingsFile(), "utf8");
114958
+ text4 = fs21.readFileSync(settingsFile(), "utf8");
114902
114959
  } catch (err) {
114903
114960
  if (err.code === "ENOENT") return { unreadable: false, values: {} };
114904
114961
  return { unreadable: true, values: {} };
114905
114962
  }
114906
114963
  try {
114907
- const parsed = JSON.parse(text3);
114964
+ const parsed = JSON.parse(text4);
114908
114965
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return { unreadable: true, values: {} };
114909
114966
  return { unreadable: false, values: parsed };
114910
114967
  } catch {
@@ -114929,7 +114986,7 @@ var systemLanguages = /* @__PURE__ */ new Set([
114929
114986
  "\u5BF9\u8BDD\u548C\u89E3\u91CA\u4F7F\u7528\u4E2D\u6587\uFF1B\u4EA7\u7269\u4F7F\u7528\u7528\u6237\u660E\u786E\u6307\u5B9A\u7684\u8BED\u8A00\uFF0C\u5426\u5219\u4F7F\u7528\u6240\u5C5E agent \u660E\u786E\u6307\u5B9A\u7684\u8BED\u8A00\uFF0C\u5747\u672A\u6307\u5B9A\u65F6\u4F7F\u7528\u4E2D\u6587\u3002\u4EE3\u7801\u3001\u547D\u4EE4\u3001\u6587\u4EF6\u540D\u548C\u5B57\u6BB5\u540D\u4FDD\u6301\u539F\u6587\u3002",
114930
114987
  "Use English for conversation and explanations. For artifacts, use the language explicitly specified by the user, otherwise the responsible agent, otherwise English. Keep code, commands, filenames, and field names unchanged."
114931
114988
  ]);
114932
- var isSystemLanguage = (text3) => systemLanguages.has(text3);
114989
+ var isSystemLanguage = (text4) => systemLanguages.has(text4);
114933
114990
  var legacy = /* @__PURE__ */ new Map([
114934
114991
  ["\u8BF7\u7528\u4E2D\u6587\u56DE\u590D\u548C\u5199\u4F5C\u3002", "zh"],
114935
114992
  ["Reply and write in English.", "en"]
@@ -114965,19 +115022,19 @@ var NOT_COMPLETED = "The delivery has not recorded completion.";
114965
115022
 
114966
115023
  // ../cli/src/lib/question-block.ts
114967
115024
  var MODES = ["single", "multi"];
114968
- var withoutTag = (text3) => text3.replace(/^\[user\]\s+/, "");
115025
+ var withoutTag = (text4) => text4.replace(/^\[user\]\s+/, "");
114969
115026
  function normalizeQuestion(raw) {
114970
115027
  if (raw && typeof raw === "object" && !Array.isArray(raw)) {
114971
- const source = raw;
114972
- const text3 = withoutTag(String(source.question ?? source.text ?? ""));
115028
+ const source2 = raw;
115029
+ const text4 = withoutTag(String(source2.question ?? source2.text ?? ""));
114973
115030
  const extra = {
114974
- ...typeof source.agent === "string" && source.agent.trim() ? { agent: source.agent.trim() } : {}
115031
+ ...typeof source2.agent === "string" && source2.agent.trim() ? { agent: source2.agent.trim() } : {}
114975
115032
  };
114976
- const options = (Array.isArray(source.options) ? source.options : []).map((o3) => String(o3).trim()).filter(Boolean);
114977
- if (options.length === 0) return { text: text3, ...extra };
114978
- const mode = MODES.includes(String(source.mode)) ? String(source.mode) : "single";
114979
- const recommend = (Array.isArray(source.recommend) ? source.recommend : []).map(Number).filter((n) => Number.isInteger(n) && n >= 1 && n <= options.length);
114980
- return { text: text3, mode, options, recommend: mode === "single" ? recommend.slice(0, 1) : recommend, ...extra };
115033
+ const options = (Array.isArray(source2.options) ? source2.options : []).map((o3) => String(o3).trim()).filter(Boolean);
115034
+ if (options.length === 0) return { text: text4, ...extra };
115035
+ const mode = MODES.includes(String(source2.mode)) ? String(source2.mode) : "single";
115036
+ const recommend = (Array.isArray(source2.recommend) ? source2.recommend : []).map(Number).filter((n) => Number.isInteger(n) && n >= 1 && n <= options.length);
115037
+ return { text: text4, mode, options, recommend: mode === "single" ? recommend.slice(0, 1) : recommend, ...extra };
114981
115038
  }
114982
115039
  return { text: withoutTag(String(raw)) };
114983
115040
  }
@@ -115024,16 +115081,16 @@ function parseQuestionsBlock(lines) {
115024
115081
  }
115025
115082
 
115026
115083
  // ../cli/src/lib/frontmatter.ts
115027
- function parseFrontmatter(text3) {
115028
- const lines = text3.split("\n");
115029
- if (lines[0].trim() !== "---") return { meta: null, body: text3 };
115084
+ function parseFrontmatter(text4) {
115085
+ const lines = text4.split("\n");
115086
+ if (lines[0].trim() !== "---") return { meta: null, body: text4 };
115030
115087
  let i = 1;
115031
115088
  const fm = [];
115032
115089
  while (i < lines.length && lines[i].trim() !== "---") {
115033
115090
  fm.push(lines[i]);
115034
115091
  i++;
115035
115092
  }
115036
- if (i >= lines.length) return { meta: null, body: text3 };
115093
+ if (i >= lines.length) return { meta: null, body: text4 };
115037
115094
  const meta = {};
115038
115095
  for (let j2 = 0; j2 < fm.length; j2++) {
115039
115096
  const m = fm[j2].match(/^([A-Za-z_]+):\s*(.*)$/);
@@ -115224,9 +115281,9 @@ function createEventCollector() {
115224
115281
  }
115225
115282
  },
115226
115283
  /** A whole message, for a source that never sends one in pieces. */
115227
- message(text3) {
115284
+ message(text4) {
115228
115285
  close();
115229
- if (text3.trim()) queue.push({ kind: "message", data: { text: text3.trim() } });
115286
+ if (text4.trim()) queue.push({ kind: "message", data: { text: text4.trim() } });
115230
115287
  },
115231
115288
  toolCall(toolCallId, title, kind, target) {
115232
115289
  close();
@@ -115262,13 +115319,13 @@ function createEventCollector() {
115262
115319
  todos = next;
115263
115320
  queue.push({ kind: "plan", data: { entries: todos.map(({ id: _2, ...e2 }) => e2) } });
115264
115321
  },
115265
- log(text3) {
115322
+ log(text4) {
115266
115323
  close();
115267
- if (text3.trim()) queue.push({ kind: "log", data: { text: text3 } });
115324
+ if (text4.trim()) queue.push({ kind: "log", data: { text: text4 } });
115268
115325
  },
115269
- error(text3) {
115326
+ error(text4) {
115270
115327
  close();
115271
- if (text3.trim()) queue.push({ kind: "error", data: { text: text3.trim() } });
115328
+ if (text4.trim()) queue.push({ kind: "error", data: { text: text4.trim() } });
115272
115329
  },
115273
115330
  /** The turn is over: a half-held message is finished off. */
115274
115331
  end() {
@@ -115607,7 +115664,7 @@ function priceUsd(provider, model, usage) {
115607
115664
  import { readFileSync, readdirSync, statSync } from "node:fs";
115608
115665
  import { homedir } from "node:os";
115609
115666
  import { join } from "node:path";
115610
- function text2(value) {
115667
+ function text3(value) {
115611
115668
  return typeof value === "string" && value.trim() ? value.trim() : void 0;
115612
115669
  }
115613
115670
  function count(value) {
@@ -115713,8 +115770,8 @@ function readCodexRunFacts(threadId) {
115713
115770
  } catch {
115714
115771
  }
115715
115772
  }
115716
- if (entry.type === "session_meta") facts.provider ??= text2(payload.model_provider);
115717
- if (entry.type === "turn_context") facts.model = text2(payload.model) ?? facts.model;
115773
+ if (entry.type === "session_meta") facts.provider ??= text3(payload.model_provider);
115774
+ if (entry.type === "turn_context") facts.model = text3(payload.model) ?? facts.model;
115718
115775
  if (payload.type === "token_count") {
115719
115776
  facts.context = contextIn(payload.info) ?? facts.context;
115720
115777
  const info = payload.info && typeof payload.info === "object" ? payload.info : {};
@@ -115765,7 +115822,7 @@ function childSpend(ids, since) {
115765
115822
  }
115766
115823
 
115767
115824
  // ../cli/src/lib/agent/wire/codex-stream.ts
115768
- 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]");
115825
+ var imageSafeText = (text4) => text4.replace(/data:image\/[a-z0-9.+-]+;base64,[A-Za-z0-9+/=]+/gi, "[image]").replace(/!\[([^\]]*)\]\((?:<)?(?:\/|[A-Za-z]:[\\/]|file:)[^\n)]*\)/g, "[$1]");
115769
115826
  function renderStarted(item) {
115770
115827
  switch (item.type) {
115771
115828
  case "command_execution":
@@ -116152,10 +116209,10 @@ function readKimiRunFacts(sessionId) {
116152
116209
  // ../cli/src/lib/agent/wire/kimi-stream.ts
116153
116210
  var ARG_KEYS2 = ["command", "path", "pattern", "query", "url", "prompt", "prompt_template", "description"];
116154
116211
  function callArgs(raw) {
116155
- const text3 = str2(raw);
116156
- if (!text3.trim()) return {};
116212
+ const text4 = str2(raw);
116213
+ if (!text4.trim()) return {};
116157
116214
  try {
116158
- return JSON.parse(text3);
116215
+ return JSON.parse(text4);
116159
116216
  } catch {
116160
116217
  return {};
116161
116218
  }
@@ -116231,9 +116288,9 @@ function createKimiStreamRenderer(cwd, resumeId) {
116231
116288
  return row.type === "turn.step.retrying" ? retry(row) : "";
116232
116289
  case "tool": {
116233
116290
  const id = str2(row.tool_call_id);
116234
- const text3 = str2(row.content);
116235
- if (subagents.delete(id)) events.toolResult(id, /^status: completed$/m.test(text3) ? "completed" : "failed", "");
116236
- else events.toolResult(id, "completed", text3);
116291
+ const text4 = str2(row.content);
116292
+ if (subagents.delete(id)) events.toolResult(id, /^status: completed$/m.test(text4) ? "completed" : "failed", "");
116293
+ else events.toolResult(id, "completed", text4);
116237
116294
  return "";
116238
116295
  }
116239
116296
  default:
@@ -116431,9 +116488,9 @@ function createTail(log) {
116431
116488
  log(chunk);
116432
116489
  },
116433
116490
  /** One line about something that isn't the agent talking. */
116434
- line(text3) {
116491
+ line(text4) {
116435
116492
  close();
116436
- log(`${text3}
116493
+ log(`${text4}
116437
116494
  `);
116438
116495
  },
116439
116496
  /** End of the turn: whatever is half-written is finished off. */
@@ -116447,7 +116504,7 @@ function createTail(log) {
116447
116504
  // ../cli/package.json
116448
116505
  var package_default = {
116449
116506
  name: "wildcrane",
116450
- version: "0.11.54",
116507
+ version: "0.11.56",
116451
116508
  akbContract: 15,
116452
116509
  description: "WildCrane's `akb` command \u2014 scaffold the Markdown board under docs/kanban/, put an agent on a card, and carry the flows the agent works by.",
116453
116510
  keywords: [
@@ -116526,8 +116583,8 @@ function saidBy(update2) {
116526
116583
  const content = Array.isArray(update2.content) ? update2.content : [];
116527
116584
  for (const raw of content) {
116528
116585
  const part = obj(raw);
116529
- const text3 = str2(obj(part.content).text) || str2(part.text);
116530
- if (text3.trim()) return text3.trim();
116586
+ const text4 = str2(obj(part.content).text) || str2(part.text);
116587
+ if (text4.trim()) return text4.trim();
116531
116588
  }
116532
116589
  return "";
116533
116590
  }
@@ -116830,11 +116887,11 @@ function createParts(tail) {
116830
116887
  const written = /* @__PURE__ */ new Map();
116831
116888
  const tools = /* @__PURE__ */ new Set();
116832
116889
  const named = /* @__PURE__ */ new Map();
116833
- const say = (partId, kind, text3) => {
116890
+ const say = (partId, kind, text4) => {
116834
116891
  const before = written.get(partId) ?? "";
116835
- const fresh = text3.startsWith(before) ? text3.slice(before.length) : text3;
116892
+ const fresh = text4.startsWith(before) ? text4.slice(before.length) : text4;
116836
116893
  if (!fresh) return;
116837
- written.set(partId, text3);
116894
+ written.set(partId, text4);
116838
116895
  if (kind === "reasoning" || kind === "thought") tail.thought(fresh);
116839
116896
  else tail.text(fresh);
116840
116897
  };
@@ -117260,7 +117317,7 @@ async function run2(io, options, tasks) {
117260
117317
  status: raw.status === "inProgress" ? "in_progress" : raw.status
117261
117318
  } });
117262
117319
  };
117263
- const start = async (text3, images = []) => {
117320
+ const start = async (text4, images = []) => {
117264
117321
  active = true;
117265
117322
  waiting = false;
117266
117323
  submitted = true;
@@ -117270,7 +117327,7 @@ async function run2(io, options, tasks) {
117270
117327
  startupTimer = setTimeout(() => {
117271
117328
  if (!started) io.event?.({ kind: "log", data: { text: "[conversation] start_unconfirmed" } });
117272
117329
  }, CONVERSATION_MS.start);
117273
- await bounded(rpc.call("turn/start", { threadId, input: [{ type: "text", text: text3 }, ...images.map((path47) => ({ type: "localImage", path: path47 }))] }), CONVERSATION_MS.start, "Codex turn/start timed out; submission outcome is unknown.").catch((error) => {
117330
+ await bounded(rpc.call("turn/start", { threadId, input: [{ type: "text", text: text4 }, ...images.map((path47) => ({ type: "localImage", path: path47 }))] }), CONVERSATION_MS.start, "Codex turn/start timed out; submission outcome is unknown.").catch((error) => {
117274
117331
  if (!started) throw error;
117275
117332
  });
117276
117333
  };
@@ -117474,7 +117531,7 @@ var quote = (s) => /^[\w./:@=-]+$/.test(s) ? s : `"${s}"`;
117474
117531
  function shimDir(akb) {
117475
117532
  const dir = akb.shim;
117476
117533
  const line = [akb.command, ...akb.args].map(quote).join(" ");
117477
- const [file2, text3] = process.platform === "win32" ? [path25.join(dir, "akb.cmd"), `@${line} %*\r
117534
+ const [file2, text4] = process.platform === "win32" ? [path25.join(dir, "akb.cmd"), `@${line} %*\r
117478
117535
  `] : [path25.join(dir, "akb"), `#!/bin/sh
117479
117536
  exec ${line} "$@"
117480
117537
  `];
@@ -117486,11 +117543,11 @@ exec ${shellLine} "$@"
117486
117543
  `, { mode: 493 });
117487
117544
  }
117488
117545
  try {
117489
- if (fs24.readFileSync(file2, "utf8") === text3) return dir;
117546
+ if (fs24.readFileSync(file2, "utf8") === text4) return dir;
117490
117547
  } catch {
117491
117548
  }
117492
117549
  fs24.mkdirSync(dir, { recursive: true });
117493
- fs24.writeFileSync(file2, text3, { mode: 493 });
117550
+ fs24.writeFileSync(file2, text4, { mode: 493 });
117494
117551
  return dir;
117495
117552
  }
117496
117553
  function akbEnv(akb, board, task, language, base = process.env) {
@@ -117512,8 +117569,8 @@ function runAkb(akb, args2, opts) {
117512
117569
  return new Promise((resolve2) => {
117513
117570
  let out = "";
117514
117571
  let last = "";
117515
- const note = (text3) => {
117516
- const line = text3.split("\n").map((l2) => l2.trim()).filter(Boolean).at(-1);
117572
+ const note = (text4) => {
117573
+ const line = text4.split("\n").map((l2) => l2.trim()).filter(Boolean).at(-1);
117517
117574
  if (line) last = line;
117518
117575
  };
117519
117576
  let child;
@@ -117604,15 +117661,15 @@ var MCP_CONFIG = {
117604
117661
  placeholder: "/path/to/mcp.json",
117605
117662
  help: "A JSON file of `mcpServers`, as Claude Code's --mcp-config takes. Empty opens no servers."
117606
117663
  };
117607
- function machineFile(name, text3) {
117608
- const suffix = createHash2("sha256").update(text3).digest("hex").slice(0, 16);
117664
+ function machineFile(name, text4) {
117665
+ const suffix = createHash2("sha256").update(text4).digest("hex").slice(0, 16);
117609
117666
  const file2 = path26.join(machineHome(), "prompts", `${path26.parse(name).name}-${suffix}${path26.extname(name)}`);
117610
117667
  try {
117611
- if (fs25.readFileSync(file2, "utf8") === text3) return file2;
117668
+ if (fs25.readFileSync(file2, "utf8") === text4) return file2;
117612
117669
  } catch {
117613
117670
  }
117614
117671
  fs25.mkdirSync(path26.dirname(file2), { recursive: true });
117615
- fs25.writeFileSync(file2, text3);
117672
+ fs25.writeFileSync(file2, text4);
117616
117673
  return file2;
117617
117674
  }
117618
117675
 
@@ -117652,13 +117709,13 @@ function cmdArg(arg) {
117652
117709
  function cmdLine(file2, args2) {
117653
117710
  return `"${[file2.replace(META, "^$1"), ...args2.map(cmdArg)].join(" ")}"`;
117654
117711
  }
117655
- function shimTarget(text3, file2) {
117712
+ function shimTarget(text4, file2) {
117656
117713
  const dir = path27.win32.dirname(file2);
117657
- const found = /"%(?:~dp0|dp0%)\\?([^"%]+)"\s+%\*/i.exec(text3);
117658
- if (!found || !/\\node\.exe"/i.test(text3)) return null;
117714
+ const found = /"%(?:~dp0|dp0%)\\?([^"%]+)"\s+%\*/i.exec(text4);
117715
+ if (!found || !/\\node\.exe"/i.test(text4)) return null;
117659
117716
  const script = path27.win32.resolve(dir, found[1].replace(/\//g, "\\"));
117660
117717
  const local = path27.win32.join(dir, "node.exe");
117661
- const nodePath = /SET "NODE_PATH=([^"]*)"/i.exec(text3)?.[1];
117718
+ const nodePath = /SET "NODE_PATH=([^"]*)"/i.exec(text4)?.[1];
117662
117719
  return { script, node: fs26.existsSync(local) ? local : "node", env: nodePath ? { NODE_PATH: nodePath } : {} };
117663
117720
  }
117664
117721
  function onWindowsPath(name, env2) {
@@ -117679,12 +117736,12 @@ function spawnable(command, args2, options = {}, platform = process.platform) {
117679
117736
  const ext = path27.extname(file2).toLowerCase();
117680
117737
  const hidden = { ...options, windowsHide: true, shell: false };
117681
117738
  if (ext !== ".cmd" && ext !== ".bat") return { command: file2, args: args2, options: hidden };
117682
- let text3 = "";
117739
+ let text4 = "";
117683
117740
  try {
117684
- text3 = fs26.readFileSync(file2, "utf8");
117741
+ text4 = fs26.readFileSync(file2, "utf8");
117685
117742
  } catch {
117686
117743
  }
117687
- const shim = shimTarget(text3, file2);
117744
+ const shim = shimTarget(text4, file2);
117688
117745
  if (shim) {
117689
117746
  return { command: shim.node, args: [shim.script, ...args2], options: { ...hidden, env: { ...env2, ...shim.env } } };
117690
117747
  }
@@ -118041,15 +118098,15 @@ function createAntigravityRenderer(expectedSession) {
118041
118098
  session = str2(step.conversation_id) || session;
118042
118099
  const id = String(step.step_index ?? "");
118043
118100
  if (step.step_type === "agent_response") {
118044
- const text3 = str2(step.text_delta);
118045
- if (text3) events.update({ sessionUpdate: "agent_message_chunk", content: { text: text3 } });
118101
+ const text4 = str2(step.text_delta);
118102
+ if (text4) events.update({ sessionUpdate: "agent_message_chunk", content: { text: text4 } });
118046
118103
  const index = num(step.step_index);
118047
118104
  if (step.state === "DONE" && step.usage && !counted.has(index)) {
118048
118105
  counted.add(index);
118049
118106
  turnUsage = add(turnUsage, usageOf4(step.usage));
118050
118107
  used = turnUsage;
118051
118108
  }
118052
- return text3;
118109
+ return text4;
118053
118110
  }
118054
118111
  if (step.step_type === "tool") {
118055
118112
  const tool = obj(step.tool_info);
@@ -118105,10 +118162,10 @@ function createAntigravityRenderer(expectedSession) {
118105
118162
  return {
118106
118163
  push: reader.push,
118107
118164
  flush() {
118108
- const text3 = reader.flush();
118165
+ const text4 = reader.flush();
118109
118166
  if (!terminal) fail(translating() ? "Antigravity \u672A\u8FD4\u56DE\u6700\u7EC8\u7ED3\u679C\uFF0C\u8BF7\u68C0\u67E5\u65E5\u5FD7\u540E\u91CD\u8BD5\u3002" : "Antigravity returned no final result. Check the log, then retry.");
118110
118167
  events.end();
118111
- return text3;
118168
+ return text4;
118112
118169
  },
118113
118170
  stderr(chunk) {
118114
118171
  stderr = (stderr + chunk).slice(-16e3);
@@ -118169,8 +118226,8 @@ var ANTIGRAVITY = {
118169
118226
  const at2 = argv.indexOf("--conversation");
118170
118227
  return createAntigravityRenderer(at2 >= 0 ? argv[at2 + 1] : argv.find((a2) => a2.startsWith("--conversation="))?.slice(15));
118171
118228
  },
118172
- systemPrompt(text3, _argv, env2) {
118173
- const rule = `${text3}
118229
+ systemPrompt(text4, _argv, env2) {
118230
+ const rule = `${text4}
118174
118231
 
118175
118232
  The task working directory is ${env2.PWD ?? process.cwd()}. Use it as the base for project files and commands. This additional workspace contains only language rules; do not write task output here.`;
118176
118233
  const hash = createHash3("sha256").update(rule).digest("hex").slice(0, 16);
@@ -118305,22 +118362,22 @@ var PASSING = [
118305
118362
  ];
118306
118363
  var RETRY_AFTER = /retry[-_\s]?after["':=\s]+(\d+)/i;
118307
118364
  var REASON_MAX = 140;
118308
- function reasonLine(text3, rule) {
118309
- const line = text3.split("\n").find((l2) => rule.test(l2.toLowerCase())) ?? text3;
118365
+ function reasonLine(text4, rule) {
118366
+ const line = text4.split("\n").find((l2) => rule.test(l2.toLowerCase())) ?? text4;
118310
118367
  const said = line.trim().replace(/\s+/g, " ");
118311
118368
  return said.length > REASON_MAX ? `${said.slice(0, REASON_MAX - 1)}\u2026` : said;
118312
118369
  }
118313
118370
  function providerBlip(...said) {
118314
- for (const text3 of said) {
118315
- if (!text3?.trim()) continue;
118316
- const lower = text3.toLowerCase();
118371
+ for (const text4 of said) {
118372
+ if (!text4?.trim()) continue;
118373
+ const lower = text4.toLowerCase();
118317
118374
  if (MANUAL.some((rule) => rule.test(lower))) return void 0;
118318
118375
  const hit = PASSING.find((rule) => rule.test(lower));
118319
118376
  if (!hit) continue;
118320
- const asked = RETRY_AFTER.exec(text3);
118377
+ const asked = RETRY_AFTER.exec(text4);
118321
118378
  const seconds = asked ? Number(asked[1]) : NaN;
118322
118379
  return {
118323
- reason: reasonLine(text3, hit),
118380
+ reason: reasonLine(text4, hit),
118324
118381
  ...Number.isFinite(seconds) && seconds > 0 ? { retryAfterMs: seconds * 1e3 } : {}
118325
118382
  };
118326
118383
  }
@@ -118380,11 +118437,11 @@ var CLAUDE_CODE = {
118380
118437
  return [...claudeStreamArgs(argv), "--resume", resumeId, "--fork-session", "--session-id", sessionId];
118381
118438
  },
118382
118439
  // 默认快照会忽略续跑传入的新规则;仅显式关闭快照的会话支持更新。
118383
- systemPrompt(text3, argv) {
118440
+ systemPrompt(text4, argv) {
118384
118441
  if (namesFlag(argv, ["--append-system-prompt", "--append-system-prompt-file"])) return {};
118385
118442
  const snapshot = argv.flatMap((arg, i) => arg === "--system-prompt-snapshot" ? [argv[i + 1]] : arg.startsWith("--system-prompt-snapshot=") ? [arg.slice("--system-prompt-snapshot=".length)] : []).at(-1);
118386
118443
  if (namesFlag(argv, ["--resume", "-r", "--continue", "-c"]) && snapshot !== "off") return {};
118387
- return { args: ["--append-system-prompt", text3] };
118444
+ return { args: ["--append-system-prompt", text4] };
118388
118445
  },
118389
118446
  // What Claude Code takes: who pays for the run, where that run goes, a model id, and how
118390
118447
  // hard that model thinks. The provider comes first because it decides the rest — which
@@ -118776,14 +118833,14 @@ var CODEX = {
118776
118833
  return [...codexExtraArgs(argv, cwd), "fork", resumeId];
118777
118834
  },
118778
118835
  // 自设系统指令保持原样;无法追加时由调用方明确提示。
118779
- systemPrompt(text3, argv) {
118836
+ systemPrompt(text4, argv) {
118780
118837
  if (namesFlag(argv, ["developer_instructions", "model_instructions_file"])) return {};
118781
118838
  try {
118782
118839
  const config = fs29.readFileSync(path31.join(process.env.CODEX_HOME || home2(".codex"), "config.toml"), "utf8");
118783
118840
  if (/^\s*(?:developer_instructions|model_instructions_file)\s*=/m.test(config)) return {};
118784
118841
  } catch {
118785
118842
  }
118786
- return { args: ["-c", `developer_instructions=${JSON.stringify(text3)}`] };
118843
+ return { args: ["-c", `developer_instructions=${JSON.stringify(text4)}`] };
118787
118844
  },
118788
118845
  // What Codex takes, in the order Claude Code's dialog draws the same four: who pays for
118789
118846
  // the run and where it goes, that endpoint's address, the key, a model, and how hard that
@@ -119106,11 +119163,11 @@ var DSH = {
119106
119163
  // dsh-acp's persona IS its system prompt, so the ask is added to the one in effect: the
119107
119164
  // user's own `DSH_SYSTEM_PROMPT`, else the bridge's default. A `--persona` on the command
119108
119165
  // line outranks both, and is left alone.
119109
- systemPrompt(text3, argv, env2) {
119166
+ systemPrompt(text4, argv, env2) {
119110
119167
  if (namesFlag(argv, ["--persona"])) return {};
119111
119168
  return { env: { DSH_SYSTEM_PROMPT: `${env2.DSH_SYSTEM_PROMPT || DSH_PERSONA}
119112
119169
 
119113
- ${text3}` } };
119170
+ ${text4}` } };
119114
119171
  },
119115
119172
  // ACP carries all three in the conversation itself (agent/wire/acp.ts), so a dsh run shows a
119116
119173
  // price, its tokens and the model the session opened on.
@@ -119161,8 +119218,8 @@ var GROK = {
119161
119218
  return [];
119162
119219
  },
119163
119220
  // `--rules` appends to Grok's system prompt. A top-level option, so it goes before `agent`.
119164
- systemPrompt(text3, argv) {
119165
- return namesFlag(argv, ["--rules"]) ? {} : { args: ["--rules", text3] };
119221
+ systemPrompt(text4, argv) {
119222
+ return namesFlag(argv, ["--rules"]) ? {} : { args: ["--rules", text4] };
119166
119223
  },
119167
119224
  // What Grok takes: a model, and the xAI key. Both boxes can stay empty — someone already
119168
119225
  // set up with grok has a login in `~/.grok` and a default model in its own
@@ -119269,7 +119326,7 @@ var KIMI = {
119269
119326
  },
119270
119327
  // An agent file wrapping Kimi's own prompt in `${base_prompt}`. Only a new session takes one;
119271
119328
  // a resumed one keeps the agent it opened with, and Kimi refuses the flag beside `--session`.
119272
- systemPrompt(text3, argv) {
119329
+ systemPrompt(text4, argv) {
119273
119330
  if (namesFlag(argv, ["--session", "-S", "--resume", "-r", "--continue", "-C", "--agent", "--agent-file"])) return {};
119274
119331
  const file2 = machineFile("kimi-language.md", `---
119275
119332
  name: akb-language
@@ -119278,7 +119335,7 @@ description: Kimi's default agent, told which language to write in
119278
119335
 
119279
119336
  \${base_prompt}
119280
119337
 
119281
- ${text3}
119338
+ ${text4}
119282
119339
  `);
119283
119340
  return { args: ["--agent-file", file2] };
119284
119341
  },
@@ -119502,8 +119559,8 @@ var OPENCODE = {
119502
119559
  env: () => ({ ...process.env }),
119503
119560
  // `instructions` files join the system prompt, and OpenCode adds this config's list to the
119504
119561
  // user's own rather than replacing it.
119505
- systemPrompt(text3, _argv, env2) {
119506
- const file2 = machineFile("opencode-language.md", `${text3}
119562
+ systemPrompt(text4, _argv, env2) {
119563
+ const file2 = machineFile("opencode-language.md", `${text4}
119507
119564
  `);
119508
119565
  let own = {};
119509
119566
  try {
@@ -119763,9 +119820,9 @@ function languageEnv(given) {
119763
119820
  }
119764
119821
  function withSystemLanguage(harness, argv, env2, language) {
119765
119822
  env2 = languageEnv(env2);
119766
- const text3 = systemLanguage(language);
119767
- if (!text3) return { argv, env: env2 };
119768
- const added = argv.length ? harness.systemPrompt?.(text3, argv, env2) : void 0;
119823
+ const text4 = systemLanguage(language);
119824
+ if (!text4) return { argv, env: env2 };
119825
+ const added = argv.length ? harness.systemPrompt?.(text4, argv, env2) : void 0;
119769
119826
  if (!added?.args?.length && !Object.keys(added?.env ?? {}).length) {
119770
119827
  const note = language === "zh" ? "\u8BED\u8A00\u89C4\u5219\u672A\u80FD\u66F4\u65B0\uFF1A\u8FDE\u63A5\u5668\u3001\u5DF2\u6709\u4F1A\u8BDD\u6216\u81EA\u8BBE\u7CFB\u7EDF\u63D0\u793A\u8BCD\u4E0D\u652F\u6301\u6CE8\u5165\u3002\u8BF7\u81EA\u884C\u53E6\u5F00\u652F\u6301\u7684\u4F1A\u8BDD\u4EE5\u91C7\u7528\u65B0\u89C4\u5219\u3002" : "Language rules could not be updated: the connector, existing session, or custom system prompt prevents injection. Open a supported new session to apply them.";
119771
119828
  return { argv, env: env2, note };
@@ -120120,8 +120177,8 @@ function installCommitHook(root2, _board) {
120120
120177
  if (!dir) return {};
120121
120178
  const file2 = path36.join(dir, "pre-commit");
120122
120179
  if (fs33.lstatSync(file2, { throwIfNoEntry: false })?.isSymbolicLink()) return {};
120123
- const source = read2(file2);
120124
- if (source && MARKER_LINE.test(source)) fs33.unlinkSync(file2);
120180
+ const source2 = read2(file2);
120181
+ if (source2 && MARKER_LINE.test(source2)) fs33.unlinkSync(file2);
120125
120182
  return {};
120126
120183
  }
120127
120184
 
@@ -120245,7 +120302,7 @@ var RESUME_REFUSED = {
120245
120302
  };
120246
120303
  var isArchived = (ws, id) => path37.relative(ws.board, findCard(ws.board, id) ?? ws.board).split(path37.sep)[0] === ".archive";
120247
120304
  var refusal2 = (ran) => ran.last.replace(/^akb( raw)?: /, "").slice(0, 300) || "akb stopped with an error.";
120248
- var reasonOf = (text3) => (text3 ?? "").split("\n").map((l2) => l2.trim()).filter((l2) => l2 && !/^at\s/.test(l2)).join("\n").slice(0, 300) || void 0;
120305
+ var reasonOf = (text4) => (text4 ?? "").split("\n").map((l2) => l2.trim()).filter((l2) => l2 && !/^at\s/.test(l2)).join("\n").slice(0, 300) || void 0;
120249
120306
  function logLines(show, event2) {
120250
120307
  let held5 = "";
120251
120308
  const said = (line) => {
@@ -120555,14 +120612,14 @@ ${pictures(job, ws, ws.number)}`);
120555
120612
  if (!await stopRuns(deps.akb, ws, id2, since, deps.stopMs)) throw new Error("\u672A\u80FD\u786E\u8BA4\u539F\u6267\u884C\u5DF2\u505C\u6B62\u3002");
120556
120613
  });
120557
120614
  const verb = flow.verb === "create" ? flow.skip_plan ? "implement" : "refine" : flow.verb;
120558
- const text3 = flow.verb === "create" ? "" : (flow.text ?? "").trim();
120615
+ const text4 = flow.verb === "create" ? "" : (flow.text ?? "").trim();
120559
120616
  if (flow.resume && isArchived(ws, id2)) return { ok: true, report: { card: id2 } };
120560
120617
  if (flow.resume && verb === "refine") {
120561
120618
  const review2 = reviewOf2(cardFile(ws));
120562
120619
  if (review2) return { ok: true, report: { card: id2, ...review2 === true ? {} : { review: review2 } } };
120563
120620
  }
120564
- if (verb === "revise" && !text3) return fail("Say what to change.");
120565
- let note = verb === "resolve" || verb === "revise" ? text3 : "";
120621
+ if (verb === "revise" && !text4) return fail("Say what to change.");
120622
+ let note = verb === "resolve" || verb === "revise" ? text4 : "";
120566
120623
  let rejected = false;
120567
120624
  let ran;
120568
120625
  let continuation;
@@ -120586,18 +120643,18 @@ ${pictures(job, ws, ws.number)}`);
120586
120643
  continuation = previous.status === "done" ? ["raw", "run", "log", previous.sessionId] : ["raw", "run", "resume", previous.sessionId, "--require-session"];
120587
120644
  }
120588
120645
  }
120589
- } else if (verb === "implement" && text3) {
120590
- const resolved = await akb(["raw", "card", "resolve", String(id2), "--follow", "--events", "--json", "--", text3], true);
120646
+ } else if (verb === "implement" && text4) {
120647
+ const resolved = await akb(["raw", "card", "resolve", String(id2), "--follow", "--events", "--json", "--", text4], true);
120591
120648
  if (io.lost()) return fail("");
120592
120649
  const file2 = findCard(ws.board, id2);
120593
120650
  rejected = !!file2 && path37.relative(ws.board, file2).split(path37.sep)[0] === ".archive" && parseFrontmatter(fs34.readFileSync(file2, "utf8")).meta?.rejected === true;
120594
120651
  if (rejected) ran = resolved;
120595
- else if (resolved.code !== 0) note = text3;
120652
+ else if (resolved.code !== 0) note = text4;
120596
120653
  }
120597
120654
  const fresh = () => {
120598
120655
  const carry = carryArgs(verb);
120599
120656
  const costFrom = carry.includes("--session") && typeof job.resumeCostUsd === "number" ? { [SESSION_COST_ENV]: String(job.resumeCostUsd) } : void 0;
120600
- if (verb === "preview") return akb(["raw", "previews", text3, String(id2), "--continue", "--follow", "--events", "--json", ...flow.feedback ? ["--notes", flow.feedback] : []], true);
120657
+ if (verb === "preview") return akb(["raw", "previews", text4, String(id2), "--continue", "--follow", "--events", "--json", ...flow.feedback ? ["--notes", flow.feedback] : []], true);
120601
120658
  return akb(["raw", "card", verb, String(id2), "--follow", "--events", "--json", ...carry, ...note ? ["--", note] : []], true, costFrom);
120602
120659
  };
120603
120660
  ran ??= await (continuation ? akb([...continuation, "--follow", "--events", "--json"], true) : fresh());
@@ -120852,11 +120909,11 @@ import { createHash as createHash5 } from "node:crypto";
120852
120909
  // ../cli/src/lib/shared/reply-parts.ts
120853
120910
  function imageMime(bytes2) {
120854
120911
  const at2 = (...v) => v.every((n, i) => bytes2[i] === n);
120855
- const text3 = (a2, b2) => String.fromCharCode(...bytes2.slice(a2, b2));
120856
- 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";
120912
+ const text4 = (a2, b2) => String.fromCharCode(...bytes2.slice(a2, b2));
120913
+ if (bytes2.length >= 24 && at2(137, 80, 78, 71, 13, 10, 26, 10) && text4(12, 16) === "IHDR" && bytes2.slice(16, 20).some(Boolean) && bytes2.slice(20, 24).some(Boolean)) return "image/png";
120857
120914
  if (at2(255, 216, 255)) return "image/jpeg";
120858
- if (bytes2.length >= 13 && ["GIF87a", "GIF89a"].includes(text3(0, 6)) && (bytes2[6] || bytes2[7]) && (bytes2[8] || bytes2[9])) return "image/gif";
120859
- if (text3(0, 4) === "RIFF" && text3(8, 12) === "WEBP") return "image/webp";
120915
+ if (bytes2.length >= 13 && ["GIF87a", "GIF89a"].includes(text4(0, 6)) && (bytes2[6] || bytes2[7]) && (bytes2[8] || bytes2[9])) return "image/gif";
120916
+ if (text4(0, 4) === "RIFF" && text4(8, 12) === "WEBP") return "image/webp";
120860
120917
  return void 0;
120861
120918
  }
120862
120919
 
@@ -120903,10 +120960,10 @@ function collectReplyImages(parts, cwd) {
120903
120960
  bytes2 = Buffer.from(p2.data, "base64");
120904
120961
  } else {
120905
120962
  if (!p2.path) throw Error();
120906
- const source = p2.path.startsWith("file:") ? fileURLToPath3(p2.path) : decodeURIComponent(p2.path);
120907
- if (/^[a-z][a-z0-9+.-]*:/i.test(source) && !/^[A-Za-z]:[\\/]/.test(source)) throw Error();
120908
- const real = fs36.realpathSync(path39.resolve(cwd, source));
120909
- if (!/\.(png|jpe?g|gif|webp)$/i.test(source) && !registered.has(real)) throw Error();
120963
+ const source2 = p2.path.startsWith("file:") ? fileURLToPath3(p2.path) : decodeURIComponent(p2.path);
120964
+ if (/^[a-z][a-z0-9+.-]*:/i.test(source2) && !/^[A-Za-z]:[\\/]/.test(source2)) throw Error();
120965
+ const real = fs36.realpathSync(path39.resolve(cwd, source2));
120966
+ if (!/\.(png|jpe?g|gif|webp)$/i.test(source2) && !registered.has(real)) throw Error();
120910
120967
  if (!roots.some((root2) => inside(root2, real)) && !registered.has(real)) throw Error();
120911
120968
  const fd = fs36.openSync(real, fs36.constants.O_RDONLY | (fs36.constants.O_NOFOLLOW ?? 0));
120912
120969
  try {
@@ -121342,14 +121399,14 @@ function taskChatFile(task, home4) {
121342
121399
  return path43.join(taskChatsDir(home4), `${task}.jsonl`);
121343
121400
  }
121344
121401
  function readTaskChat(task, home4) {
121345
- let text3;
121402
+ let text4;
121346
121403
  try {
121347
- text3 = fs40.readFileSync(taskChatFile(task, home4), "utf8");
121404
+ text4 = fs40.readFileSync(taskChatFile(task, home4), "utf8");
121348
121405
  } catch {
121349
121406
  return [];
121350
121407
  }
121351
121408
  const lines = [];
121352
- for (const raw of text3.split("\n")) {
121409
+ for (const raw of text4.split("\n")) {
121353
121410
  if (!raw.trim()) continue;
121354
121411
  try {
121355
121412
  const line = JSON.parse(raw);
@@ -121526,7 +121583,7 @@ function writeAttachments(job) {
121526
121583
  Attached files:
121527
121584
  ${files.map((f2) => `- ${f2}`).join("\n")}`;
121528
121585
  }
121529
- var cut = (text3) => text3.length > EVENT_CHARS ? text3.slice(0, EVENT_CHARS) : text3;
121586
+ var cut = (text4) => text4.length > EVENT_CHARS ? text4.slice(0, EVENT_CHARS) : text4;
121530
121587
  function toWire(events, first) {
121531
121588
  const out = [];
121532
121589
  let log = "";
@@ -121730,8 +121787,8 @@ function streamOut(deps, id, lease) {
121730
121787
  }, deps.renewMs);
121731
121788
  return {
121732
121789
  event: event2,
121733
- out: (text3) => {
121734
- if (text3) event2({ kind: "log", data: { text: text3 } });
121790
+ out: (text4) => {
121791
+ if (text4) event2({ kind: "log", data: { text: text4 } });
121735
121792
  },
121736
121793
  adopt: (child) => {
121737
121794
  if (child.pid) groups.add(child.pid);
@@ -122276,10 +122333,10 @@ ${prompt}` : prompt;
122276
122333
  backgroundError = backgroundWaitMessage(BACKGROUND_WAIT.minutes);
122277
122334
  stop(child);
122278
122335
  });
122279
- const fromAgent = (text3) => {
122336
+ const fromAgent = (text4) => {
122280
122337
  if (!structured) {
122281
- if (text3.trim()) acted = true;
122282
- stream.out(text3);
122338
+ if (text4.trim()) acted = true;
122339
+ stream.out(text4);
122283
122340
  }
122284
122341
  if (attempt) measure(report(job, plan3));
122285
122342
  for (const e2 of renderer2.events?.() ?? []) {
@@ -122405,7 +122462,7 @@ var replyReason = (reason, job) => {
122405
122462
  if (job.sessionFallback && !/auth|login|log.in|permission|directory|ENOENT|not installed|rate.limit|network|connect|登录|权限|目录/i.test(reason)) return "session_unavailable";
122406
122463
  return reason;
122407
122464
  };
122408
- 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));
122465
+ var sessionMissing = (text4) => !/auth|unauthorized|forbidden|login|log.in|登录|权限/i.test(text4) && (/\b(?:session|conversation|thread)\b[^\n]*(?:\bnot found\b|\bdoes not exist\b)/i.test(text4) || /\bno (?:conversation|session|thread) found\b/i.test(text4));
122409
122466
  function launch(command, args2, options) {
122410
122467
  const start = spawnable(command, args2, options);
122411
122468
  return spawn4(start.command, start.args, start.options);
@@ -122569,7 +122626,7 @@ function report(job, run3, turn2) {
122569
122626
  ...context?.used !== void 0 && limit ? { context: { used: context.used, limit } } : {}
122570
122627
  };
122571
122628
  }
122572
- var cutShort = (said, text3) => ({ ...said, reply: said.reply || text3 || void 0, stopped: true });
122629
+ var cutShort = (said, text4) => ({ ...said, reply: said.reply || text4 || void 0, stopped: true });
122573
122630
  function folderLines(ws) {
122574
122631
  if (!ws) return "";
122575
122632
  const undrawn2 = undrawnPreviews(ws);