wildcrane-runner 0.6.116 → 0.6.117

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/settings.mjs CHANGED
@@ -1,4 +1,4 @@
1
- // wildcrane-runner 0.6.116 — built by runner/scripts/build.mjs. Do not edit.
1
+ // wildcrane-runner 0.6.117 — 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;
@@ -4041,8 +4041,8 @@ var require_infra = __commonJS({
4041
4041
  assert(!invalidIsomorphicEncodeValueRegex.test(input));
4042
4042
  return input;
4043
4043
  }
4044
- function parseJSONFromBytes(bytes2) {
4045
- return JSON.parse(utf8DecodeBytes(bytes2));
4044
+ function parseJSONFromBytes(bytes) {
4045
+ return JSON.parse(utf8DecodeBytes(bytes));
4046
4046
  }
4047
4047
  function removeASCIIWhitespace(str3, leading = true, trailing = true) {
4048
4048
  return removeChars(str3, leading, trailing, isASCIIWhitespace);
@@ -4088,7 +4088,7 @@ var require_data_url = __commonJS({
4088
4088
  "use strict";
4089
4089
  var assert = __require("node:assert");
4090
4090
  var { forgivingBase64, collectASequenceOfCodePoints, collectASequenceOfCodePointsFast, isomorphicDecode, removeASCIIWhitespace, removeChars } = require_infra();
4091
- var encoder = new TextEncoder();
4091
+ var encoder3 = new TextEncoder();
4092
4092
  var HTTP_TOKEN_CODEPOINTS = /^[-!#$%&'*+.^_|~A-Za-z0-9]+$/u;
4093
4093
  var HTTP_WHITESPACE_REGEX = /[\u000A\u000D\u0009\u0020]/u;
4094
4094
  var HTTP_QUOTED_STRING_TOKENS = /^[\u0009\u0020-\u007E\u0080-\u00FF]+$/u;
@@ -4142,8 +4142,8 @@ var require_data_url = __commonJS({
4142
4142
  return serialized;
4143
4143
  }
4144
4144
  function stringPercentDecode(input) {
4145
- const bytes2 = encoder.encode(input);
4146
- return percentDecode(bytes2);
4145
+ const bytes = encoder3.encode(input);
4146
+ return percentDecode(bytes);
4147
4147
  }
4148
4148
  function isHexCharByte(byte) {
4149
4149
  return byte >= 48 && byte <= 57 || byte >= 65 && byte <= 70 || byte >= 97 && byte <= 102;
@@ -4829,10 +4829,10 @@ var require_webidl = __commonJS({
4829
4829
  if (jsArrayBuffer.detached) {
4830
4830
  return new Uint8Array(0);
4831
4831
  }
4832
- const bytes2 = new Uint8Array(length);
4832
+ const bytes = new Uint8Array(length);
4833
4833
  const view = new Uint8Array(jsArrayBuffer, offset, length);
4834
- bytes2.set(view);
4835
- return bytes2;
4834
+ bytes.set(view);
4835
+ return bytes;
4836
4836
  };
4837
4837
  webidl.converters.DOMString = function(V, prefix, argument, flags) {
4838
4838
  if (V === null && webidl.util.HasFlag(flags, webidl.attributes.LegacyNullToEmptyString)) {
@@ -5548,19 +5548,19 @@ var require_util2 = __commonJS({
5548
5548
  }
5549
5549
  async function readAllBytes(reader, successSteps, failureSteps) {
5550
5550
  try {
5551
- const bytes2 = [];
5551
+ const bytes = [];
5552
5552
  let byteLength = 0;
5553
5553
  do {
5554
5554
  const { done, value: chunk } = await reader.read();
5555
5555
  if (done) {
5556
- successSteps(Buffer.concat(bytes2, byteLength));
5556
+ successSteps(Buffer.concat(bytes, byteLength));
5557
5557
  return;
5558
5558
  }
5559
5559
  if (!isUint8Array(chunk)) {
5560
5560
  failureSteps(new TypeError("Received non-Uint8Array chunk"));
5561
5561
  return;
5562
5562
  }
5563
- bytes2.push(chunk);
5563
+ bytes.push(chunk);
5564
5564
  byteLength += chunk.length;
5565
5565
  } while (true);
5566
5566
  } catch (e) {
@@ -6005,7 +6005,7 @@ var require_formdata_parser = __commonJS({
6005
6005
  var assert = __require("node:assert");
6006
6006
  var { isomorphicDecode } = require_infra();
6007
6007
  var dd = Buffer.from("--");
6008
- var decoder = new TextDecoder();
6008
+ var decoder2 = new TextDecoder();
6009
6009
  var decoderIgnoreBOM = new TextDecoder("utf-8", { ignoreBOM: true });
6010
6010
  function isAsciiString(chars) {
6011
6011
  for (let i = 0; i < chars.length; ++i) {
@@ -6137,7 +6137,7 @@ var require_formdata_parser = __commonJS({
6137
6137
  headerValue[4] !== 56) {
6138
6138
  throw parsingError("unknown encoding, expected utf-8''");
6139
6139
  }
6140
- value = decodeURIComponent(decoder.decode(headerValue.subarray(7)));
6140
+ value = decodeURIComponent(decoder2.decode(headerValue.subarray(7)));
6141
6141
  } else if (input[position.position] === 34) {
6142
6142
  position.position++;
6143
6143
  const quotedValue = collectASequenceOfBytes(
@@ -6150,7 +6150,7 @@ var require_formdata_parser = __commonJS({
6150
6150
  throw parsingError("Closing quote not found");
6151
6151
  }
6152
6152
  position.position++;
6153
- value = decoder.decode(quotedValue).replace(/%0A/ig, "\n").replace(/%0D/ig, "\r").replace(/%22/g, '"');
6153
+ value = decoder2.decode(quotedValue).replace(/%0A/ig, "\n").replace(/%0D/ig, "\r").replace(/%22/g, '"');
6154
6154
  } else {
6155
6155
  const tokenValue = collectASequenceOfBytes(
6156
6156
  (char) => isToken(char) && char !== 59,
@@ -6158,7 +6158,7 @@ var require_formdata_parser = __commonJS({
6158
6158
  input,
6159
6159
  position
6160
6160
  );
6161
- value = decoder.decode(tokenValue);
6161
+ value = decoder2.decode(tokenValue);
6162
6162
  }
6163
6163
  return { name: attrNameStr, value, extended: isExtended };
6164
6164
  }
@@ -6519,19 +6519,19 @@ Content-Type: ${value.type || "application/octet-stream"}\r
6519
6519
  function bodyMixinMethods(instance, getInternalState) {
6520
6520
  const methods = {
6521
6521
  blob() {
6522
- return consumeBody(this, (bytes2) => {
6522
+ return consumeBody(this, (bytes) => {
6523
6523
  let mimeType = bodyMimeType(getInternalState(this));
6524
6524
  if (mimeType === null) {
6525
6525
  mimeType = "";
6526
6526
  } else if (mimeType) {
6527
6527
  mimeType = serializeAMimeType(mimeType);
6528
6528
  }
6529
- return new Blob([bytes2], { type: mimeType });
6529
+ return new Blob([bytes], { type: mimeType });
6530
6530
  }, instance, getInternalState);
6531
6531
  },
6532
6532
  arrayBuffer() {
6533
- return consumeBody(this, (bytes2) => {
6534
- return new Uint8Array(bytes2).buffer;
6533
+ return consumeBody(this, (bytes) => {
6534
+ return new Uint8Array(bytes).buffer;
6535
6535
  }, instance, getInternalState);
6536
6536
  },
6537
6537
  text() {
@@ -6567,8 +6567,8 @@ Content-Type: ${value.type || "application/octet-stream"}\r
6567
6567
  }, instance, getInternalState);
6568
6568
  },
6569
6569
  bytes() {
6570
- return consumeBody(this, (bytes2) => {
6571
- return new Uint8Array(bytes2);
6570
+ return consumeBody(this, (bytes) => {
6571
+ return new Uint8Array(bytes);
6572
6572
  }, instance, getInternalState);
6573
6573
  }
6574
6574
  };
@@ -13883,8 +13883,8 @@ var require_snapshot_utils = __commonJS({
13883
13883
  match: new Set(matchHeaders.map((header) => caseSensitive ? header : header.toLowerCase()))
13884
13884
  };
13885
13885
  }
13886
- var crypto9 = runtimeFeatures.has("crypto") ? __require("node:crypto") : null;
13887
- var hashId = crypto9?.hash ? (value) => crypto9.hash("sha256", value, "base64url") : (value) => Buffer.from(value).toString("base64url");
13886
+ var crypto10 = runtimeFeatures.has("crypto") ? __require("node:crypto") : null;
13887
+ var hashId = crypto10?.hash ? (value) => crypto10.hash("sha256", value, "base64url") : (value) => Buffer.from(value).toString("base64url");
13888
13888
  function isUndiciHeaders(headers) {
13889
13889
  return Array.isArray(headers) && (headers.length & 1) === 0;
13890
13890
  }
@@ -19937,10 +19937,10 @@ var require_response = __commonJS({
19937
19937
  if (init !== null) {
19938
19938
  init = webidl.converters.ResponseInit(init);
19939
19939
  }
19940
- const bytes2 = textEncoder.encode(
19940
+ const bytes = textEncoder.encode(
19941
19941
  serializeJavascriptValueToJSONString(data)
19942
19942
  );
19943
- const body = extractBody(bytes2);
19943
+ const body = extractBody(bytes);
19944
19944
  const responseObject = fromInnerResponse(makeResponse({}), "response");
19945
19945
  initializeResponse(responseObject, init, { body: body[0], type: "application/json" });
19946
19946
  return responseObject;
@@ -21082,10 +21082,10 @@ var require_subresource_integrity = __commonJS({
21082
21082
  var { runtimeFeatures } = require_runtime_features();
21083
21083
  var { asciiLowercase } = require_infra();
21084
21084
  var validSRIHashAlgorithmTokenSet = /* @__PURE__ */ new Map([["sha256", 0], ["sha384", 1], ["sha512", 2]]);
21085
- var crypto9;
21085
+ var crypto10;
21086
21086
  if (runtimeFeatures.has("crypto")) {
21087
- crypto9 = __require("node:crypto");
21088
- const cryptoHashes = crypto9.getHashes();
21087
+ crypto10 = __require("node:crypto");
21088
+ const cryptoHashes = crypto10.getHashes();
21089
21089
  if (cryptoHashes.length === 0) {
21090
21090
  validSRIHashAlgorithmTokenSet.clear();
21091
21091
  }
@@ -21104,7 +21104,7 @@ var require_subresource_integrity = __commonJS({
21104
21104
  )
21105
21105
  );
21106
21106
  var isValidSRIHashAlgorithm = (algorithm) => validSRIHashAlgorithmTokenSet.has(asciiLowercase(algorithm));
21107
- var bytesMatch = runtimeFeatures.has("crypto") === false || validSRIHashAlgorithmTokenSet.size === 0 ? () => true : (bytes2, metadataList) => {
21107
+ var bytesMatch = runtimeFeatures.has("crypto") === false || validSRIHashAlgorithmTokenSet.size === 0 ? () => true : (bytes, metadataList) => {
21108
21108
  const parsedMetadata = parseMetadata(metadataList);
21109
21109
  if (parsedMetadata.length === 0) {
21110
21110
  return true;
@@ -21113,7 +21113,7 @@ var require_subresource_integrity = __commonJS({
21113
21113
  for (const item of metadata) {
21114
21114
  const algorithm = item.alg;
21115
21115
  const expectedValue = item.val;
21116
- const actualValue = applyAlgorithmToBytes(algorithm, bytes2);
21116
+ const actualValue = applyAlgorithmToBytes(algorithm, bytes);
21117
21117
  if (caseSensitiveMatch(actualValue, expectedValue)) {
21118
21118
  return true;
21119
21119
  }
@@ -21172,8 +21172,8 @@ var require_subresource_integrity = __commonJS({
21172
21172
  }
21173
21173
  return result;
21174
21174
  }
21175
- var applyAlgorithmToBytes = (algorithm, bytes2) => {
21176
- return crypto9.hash(algorithm, bytes2, "base64");
21175
+ var applyAlgorithmToBytes = (algorithm, bytes) => {
21176
+ return crypto10.hash(algorithm, bytes, "base64");
21177
21177
  };
21178
21178
  function caseSensitiveMatch(actualValue, expectedValue) {
21179
21179
  let actualValueLength = actualValue.length;
@@ -21584,12 +21584,12 @@ var require_fetch = __commonJS({
21584
21584
  processBodyError(response.error);
21585
21585
  return;
21586
21586
  }
21587
- const processBody = (bytes2) => {
21588
- if (!bytesMatch(bytes2, request2.integrity)) {
21587
+ const processBody = (bytes) => {
21588
+ if (!bytesMatch(bytes, request2.integrity)) {
21589
21589
  processBodyError("integrity mismatch");
21590
21590
  return;
21591
21591
  }
21592
- response.body = safelyExtractBody(bytes2)[0];
21592
+ response.body = safelyExtractBody(bytes)[0];
21593
21593
  fetchFinale(fetchParams, response);
21594
21594
  };
21595
21595
  fullyReadBody(response.body, processBody, processBodyError);
@@ -22032,12 +22032,12 @@ var require_fetch = __commonJS({
22032
22032
  if (request2.body == null && fetchParams.processRequestEndOfBody) {
22033
22033
  queueMicrotask(() => fetchParams.processRequestEndOfBody());
22034
22034
  } else if (request2.body != null) {
22035
- const processBodyChunk = async function* (bytes2) {
22035
+ const processBodyChunk = async function* (bytes) {
22036
22036
  if (isCancelled(fetchParams)) {
22037
22037
  return;
22038
22038
  }
22039
- yield bytes2;
22040
- fetchParams.processRequestBodyChunkLength?.(bytes2.byteLength);
22039
+ yield bytes;
22040
+ fetchParams.processRequestBodyChunkLength?.(bytes.byteLength);
22041
22041
  };
22042
22042
  const processEndOfBody = () => {
22043
22043
  if (isCancelled(fetchParams)) {
@@ -22059,8 +22059,8 @@ var require_fetch = __commonJS({
22059
22059
  };
22060
22060
  requestBody = (async function* () {
22061
22061
  try {
22062
- for await (const bytes2 of request2.body.stream) {
22063
- yield* processBodyChunk(bytes2);
22062
+ for await (const bytes of request2.body.stream) {
22063
+ yield* processBodyChunk(bytes);
22064
22064
  }
22065
22065
  processEndOfBody();
22066
22066
  } catch (err) {
@@ -22108,33 +22108,33 @@ var require_fetch = __commonJS({
22108
22108
  }
22109
22109
  fetchParams.controller.resume = async () => {
22110
22110
  while (true) {
22111
- let bytes2;
22111
+ let bytes;
22112
22112
  let isFailure;
22113
22113
  try {
22114
22114
  const { done, value } = await fetchParams.controller.next();
22115
22115
  if (isAborted(fetchParams)) {
22116
22116
  break;
22117
22117
  }
22118
- bytes2 = done ? void 0 : value;
22118
+ bytes = done ? void 0 : value;
22119
22119
  } catch (err) {
22120
22120
  if (fetchParams.controller.ended && !timingInfo.encodedBodySize) {
22121
- bytes2 = void 0;
22121
+ bytes = void 0;
22122
22122
  } else {
22123
- bytes2 = err;
22123
+ bytes = err;
22124
22124
  isFailure = true;
22125
22125
  }
22126
22126
  }
22127
- if (bytes2 === void 0) {
22127
+ if (bytes === void 0) {
22128
22128
  readableStreamClose(fetchParams.controller.controller);
22129
22129
  finalizeResponse(fetchParams, response);
22130
22130
  return;
22131
22131
  }
22132
- timingInfo.decodedBodySize += bytes2?.byteLength ?? 0;
22132
+ timingInfo.decodedBodySize += bytes?.byteLength ?? 0;
22133
22133
  if (isFailure) {
22134
- fetchParams.controller.terminate(bytes2);
22134
+ fetchParams.controller.terminate(bytes);
22135
22135
  return;
22136
22136
  }
22137
- const buffer = new Uint8Array(bytes2);
22137
+ const buffer = new Uint8Array(bytes);
22138
22138
  if (buffer.byteLength) {
22139
22139
  fetchParams.controller.controller.enqueue(buffer);
22140
22140
  }
@@ -22274,9 +22274,9 @@ var require_fetch = __commonJS({
22274
22274
  if (fetchParams.controller.dump) {
22275
22275
  return;
22276
22276
  }
22277
- const bytes2 = chunk;
22278
- timingInfo.encodedBodySize += bytes2.byteLength;
22279
- return this.body.push(bytes2);
22277
+ const bytes = chunk;
22278
+ timingInfo.encodedBodySize += bytes.byteLength;
22279
+ return this.body.push(bytes);
22280
22280
  },
22281
22281
  onComplete() {
22282
22282
  if (this.abort) {
@@ -22607,9 +22607,9 @@ var require_cache3 = __commonJS({
22607
22607
  // 16.
22608
22608
  };
22609
22609
  operations.push(operation);
22610
- const bytes2 = await bodyReadPromise.promise;
22610
+ const bytes = await bodyReadPromise.promise;
22611
22611
  if (clonedResponse.body != null) {
22612
- clonedResponse.body.source = bytes2;
22612
+ clonedResponse.body.source = bytes;
22613
22613
  }
22614
22614
  const cacheJobPromise = createDeferredPromise();
22615
22615
  let errorData = null;
@@ -24161,7 +24161,7 @@ var require_connection = __commonJS({
24161
24161
  var { WebsocketFrameSend } = require_frame();
24162
24162
  var assert = __require("node:assert");
24163
24163
  var { runtimeFeatures } = require_runtime_features();
24164
- var crypto9 = runtimeFeatures.has("crypto") ? __require("node:crypto") : null;
24164
+ var crypto10 = runtimeFeatures.has("crypto") ? __require("node:crypto") : null;
24165
24165
  var warningEmitted = false;
24166
24166
  function establishWebSocketConnection(url, protocols, client, handler, options) {
24167
24167
  const requestURL = url;
@@ -24181,7 +24181,7 @@ var require_connection = __commonJS({
24181
24181
  const headersList = getHeadersList(new Headers(options.headers));
24182
24182
  request2.headersList = headersList;
24183
24183
  }
24184
- const keyValue = crypto9.randomBytes(16).toString("base64");
24184
+ const keyValue = crypto10.randomBytes(16).toString("base64");
24185
24185
  request2.headersList.append("sec-websocket-key", keyValue, true);
24186
24186
  request2.headersList.append("sec-websocket-version", "13", true);
24187
24187
  for (const protocol of protocols) {
@@ -24221,7 +24221,7 @@ var require_connection = __commonJS({
24221
24221
  return;
24222
24222
  }
24223
24223
  const secWSAccept = response.headersList.get("Sec-WebSocket-Accept");
24224
- const digest = crypto9.hash("sha1", keyValue + uid, "base64");
24224
+ const digest = crypto10.hash("sha1", keyValue + uid, "base64");
24225
24225
  if (secWSAccept !== digest) {
24226
24226
  failHandshake(handler, response, 1002, "Incorrect hash received in Sec-WebSocket-Accept header.");
24227
24227
  return;
@@ -26683,7 +26683,7 @@ var require_identity = __commonJS({
26683
26683
  var NODE_TYPE = /* @__PURE__ */ Symbol.for("yaml.node.type");
26684
26684
  var isAlias = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === ALIAS;
26685
26685
  var isDocument = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === DOC;
26686
- var isMap = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === MAP;
26686
+ var isMap2 = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === MAP;
26687
26687
  var isPair = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === PAIR;
26688
26688
  var isScalar = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === SCALAR;
26689
26689
  var isSeq = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === SEQ;
@@ -26719,7 +26719,7 @@ var require_identity = __commonJS({
26719
26719
  exports.isAlias = isAlias;
26720
26720
  exports.isCollection = isCollection;
26721
26721
  exports.isDocument = isDocument;
26722
- exports.isMap = isMap;
26722
+ exports.isMap = isMap2;
26723
26723
  exports.isNode = isNode;
26724
26724
  exports.isPair = isPair;
26725
26725
  exports.isScalar = isScalar;
@@ -30831,9 +30831,9 @@ var require_resolve_flow_collection = __commonJS({
30831
30831
  var blockMsg = "Block collections are not allowed within flow collections";
30832
30832
  var isBlock = (token) => token && (token.type === "block-map" || token.type === "block-seq");
30833
30833
  function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onError, tag) {
30834
- const isMap = fc.start.source === "{";
30835
- const fcName = isMap ? "flow map" : "flow sequence";
30836
- const NodeClass = tag?.nodeClass ?? (isMap ? YAMLMap.YAMLMap : YAMLSeq.YAMLSeq);
30834
+ const isMap2 = fc.start.source === "{";
30835
+ const fcName = isMap2 ? "flow map" : "flow sequence";
30836
+ const NodeClass = tag?.nodeClass ?? (isMap2 ? YAMLMap.YAMLMap : YAMLSeq.YAMLSeq);
30837
30837
  const coll = new NodeClass(ctx.schema);
30838
30838
  coll.flow = true;
30839
30839
  const atRoot = ctx.atRoot;
@@ -30869,7 +30869,7 @@ var require_resolve_flow_collection = __commonJS({
30869
30869
  offset = props.end;
30870
30870
  continue;
30871
30871
  }
30872
- if (!isMap && ctx.options.strict && utilContainsNewline.containsNewline(key))
30872
+ if (!isMap2 && ctx.options.strict && utilContainsNewline.containsNewline(key))
30873
30873
  onError(
30874
30874
  key,
30875
30875
  // checked by containsNewline()
@@ -30909,7 +30909,7 @@ var require_resolve_flow_collection = __commonJS({
30909
30909
  }
30910
30910
  }
30911
30911
  }
30912
- if (!isMap && !sep && !props.found) {
30912
+ if (!isMap2 && !sep && !props.found) {
30913
30913
  const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep, null, props, onError);
30914
30914
  coll.items.push(valueNode);
30915
30915
  offset = valueNode.range[2];
@@ -30932,7 +30932,7 @@ var require_resolve_flow_collection = __commonJS({
30932
30932
  startOnNewline: false
30933
30933
  });
30934
30934
  if (valueProps.found) {
30935
- if (!isMap && !props.found && ctx.options.strict) {
30935
+ if (!isMap2 && !props.found && ctx.options.strict) {
30936
30936
  if (sep)
30937
30937
  for (const st of sep) {
30938
30938
  if (st === valueProps.found)
@@ -30964,7 +30964,7 @@ var require_resolve_flow_collection = __commonJS({
30964
30964
  const pair = new Pair.Pair(keyNode, valueNode);
30965
30965
  if (ctx.options.keepSourceTokens)
30966
30966
  pair.srcToken = collItem;
30967
- if (isMap) {
30967
+ if (isMap2) {
30968
30968
  const map = coll;
30969
30969
  if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
30970
30970
  onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
@@ -30980,7 +30980,7 @@ var require_resolve_flow_collection = __commonJS({
30980
30980
  offset = valueNode ? valueNode.range[2] : valueProps.end;
30981
30981
  }
30982
30982
  }
30983
- const expectedEnd = isMap ? "}" : "]";
30983
+ const expectedEnd = isMap2 ? "}" : "]";
30984
30984
  const [ce, ...ee] = fc.end;
30985
30985
  let cePos = offset;
30986
30986
  if (ce?.source === expectedEnd)
@@ -40915,7 +40915,7 @@ try {
40915
40915
  }
40916
40916
 
40917
40917
  // src/home.ts
40918
- import crypto from "node:crypto";
40918
+ import crypto2 from "node:crypto";
40919
40919
  import fs from "node:fs";
40920
40920
  import os2 from "node:os";
40921
40921
  import path from "node:path";
@@ -41011,7 +41011,7 @@ function machineId() {
41011
41011
  if (held2.id && /^[0-9a-f-]{36}$/i.test(held2.id)) return held2.id;
41012
41012
  } catch {
41013
41013
  }
41014
- const id = crypto.randomUUID();
41014
+ const id = crypto2.randomUUID();
41015
41015
  fs.mkdirSync(runnerHome(), { recursive: true, mode: 448 });
41016
41016
  fs.writeFileSync(file2, `${JSON.stringify({ id })}
41017
41017
  `);
@@ -41020,7 +41020,7 @@ function machineId() {
41020
41020
  var machineName = () => os2.hostname().replace(/\.local$/, "");
41021
41021
 
41022
41022
  // src/settings.ts
41023
- import crypto7 from "node:crypto";
41023
+ import crypto8 from "node:crypto";
41024
41024
  import fs27 from "node:fs";
41025
41025
  import path32 from "node:path";
41026
41026
 
@@ -41245,6 +41245,469 @@ function alive(pid) {
41245
41245
  }
41246
41246
  var sleep = (ms) => new Promise((resolve2) => setTimeout(resolve2, ms));
41247
41247
 
41248
+ // ../cli/src/lib/shared/studio-files.ts
41249
+ var import_yaml3 = __toESM(require_dist(), 1);
41250
+
41251
+ // ../cli/src/lib/agent/studio-def.ts
41252
+ var import_ajv = __toESM(require_ajv(), 1);
41253
+ var import_yaml = __toESM(require_dist(), 1);
41254
+
41255
+ // ../cli/src/lib/agents/icon.ts
41256
+ var ICON_NAMES = [
41257
+ "file",
41258
+ "text",
41259
+ "article",
41260
+ "outline",
41261
+ "script",
41262
+ "prompt",
41263
+ "email",
41264
+ "image",
41265
+ "post-image",
41266
+ "social-image",
41267
+ "cover",
41268
+ "carousel",
41269
+ "carousel-outline",
41270
+ "slides",
41271
+ "wireframe",
41272
+ "screen",
41273
+ "video",
41274
+ "storyboard",
41275
+ "template",
41276
+ "shots",
41277
+ "api",
41278
+ "schema",
41279
+ "compare",
41280
+ "stack",
41281
+ "studio",
41282
+ "code",
41283
+ "checklist",
41284
+ "card",
41285
+ "plan",
41286
+ "proposal",
41287
+ "dismissed",
41288
+ "inbox",
41289
+ "notebook",
41290
+ "squeeze",
41291
+ "folder",
41292
+ "reply",
41293
+ "feedback",
41294
+ "software",
41295
+ "product-video",
41296
+ "social-post",
41297
+ "blog",
41298
+ "deck",
41299
+ "video-clone",
41300
+ "studio-kit"
41301
+ ];
41302
+ var ICON_COLORS = ["k", "w", "c", "g", "o", "p", "s", "m", "l", "r", "y"];
41303
+
41304
+ // ../cli/src/lib/shared/preview-blocks.ts
41305
+ var PREVIEW_ID = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
41306
+ function sourcePosition(source, offset) {
41307
+ const before = source.slice(0, offset);
41308
+ return { line: before.split("\n").length, column: offset - before.lastIndexOf("\n") };
41309
+ }
41310
+ function withoutCode(source) {
41311
+ const blank2 = (s) => s.replace(/[^\n\r]/g, " ");
41312
+ let fence;
41313
+ let indented = false, afterBlank = true, inList = false;
41314
+ return source.split(/(?<=\n)/).map((line) => {
41315
+ const marker = /^ {0,3}(`{3,}|~{3,})(.*)/.exec(line);
41316
+ if (fence) {
41317
+ if (marker && marker[1][0] === fence.char && marker[1].length >= fence.length && !marker[2].trim()) fence = void 0;
41318
+ return blank2(line);
41319
+ }
41320
+ if (marker) {
41321
+ fence = { char: marker[1][0], length: marker[1].length };
41322
+ return blank2(line);
41323
+ }
41324
+ if (!line.trim()) {
41325
+ afterBlank = true;
41326
+ return line;
41327
+ }
41328
+ const hasIndent = /^(?: {4}|\t)/.test(line);
41329
+ if (!hasIndent) indented = false;
41330
+ if (/^ {0,3}(?:[-+*]|\d+[.)])\s/.test(line)) inList = true;
41331
+ else if (/^\S/.test(line)) inList = false;
41332
+ if (hasIndent && (indented || afterBlank && !inList)) {
41333
+ indented = true;
41334
+ return blank2(line);
41335
+ }
41336
+ afterBlank = false;
41337
+ return line;
41338
+ }).join("").replace(/(`+)([^]*?)\1(?!`)/g, blank2);
41339
+ }
41340
+ function parsePreviewBlocks(source, file2 = "STUDIO.md") {
41341
+ const blocks = [], problems = [];
41342
+ const masked = withoutCode(source);
41343
+ let open;
41344
+ const seen = /* @__PURE__ */ new Set();
41345
+ const fail = (offset, id, code, message, hint2) => problems.push({ file: file2, ...sourcePosition(source, offset), path: id ? `previews.${id}` : "previews", code, message, hint: hint2 });
41346
+ for (const tag of masked.matchAll(/<\/?Preview\b[^>]*(?:>|$)/g)) {
41347
+ const offset = tag.index, text2 = tag[0];
41348
+ const closing = /^<\/Preview\s*>$/.test(text2);
41349
+ if (closing) {
41350
+ if (!open) fail(offset, "", "preview-unexpected-close", "Preview has no opening tag", "Remove it or restore its opening tag.");
41351
+ else {
41352
+ const instructions = source.slice(open.content, offset).trim();
41353
+ if (!instructions) fail(open.start, open.id, "preview-empty", `Preview ${open.id} is empty`, "Describe the requested output inside the block.");
41354
+ blocks.push({ id: open.id, instructions, start: open.start, end: offset + text2.length });
41355
+ open = void 0;
41356
+ }
41357
+ continue;
41358
+ }
41359
+ const opening = /^<Preview\s+id=(?:"([^"]*)"|'([^']*)')\s*>$/.exec(text2);
41360
+ if (!opening || open) {
41361
+ fail(offset, open?.id ?? "", "preview-tag", "Malformed or nested Preview tag", 'Use one non-nested <Preview id="stable-id"> block with only id.');
41362
+ continue;
41363
+ }
41364
+ const id = opening[1] ?? opening[2];
41365
+ if (!PREVIEW_ID.test(id) || seen.has(id)) fail(offset, id, "preview-id", `Invalid or repeated Preview ID ${id}`, "Use a unique lowercase ID with digits and dashes.");
41366
+ seen.add(id);
41367
+ open = { id, start: offset, content: offset + text2.length };
41368
+ }
41369
+ if (open) fail(open.start, open.id, "preview-unclosed", `Preview ${open.id} is not closed`, "Add </Preview> after this block.");
41370
+ return { blocks, problems };
41371
+ }
41372
+
41373
+ // ../cli/src/lib/agent/studio-def.ts
41374
+ var STUDIO_ID = PREVIEW_ID;
41375
+ var titles = { type: "object", minProperties: 1, propertyNames: { pattern: "^[a-z]{2,3}(?:-[A-Za-z0-9]+)*$" }, additionalProperties: { type: "string", minLength: 1, pattern: "\\S" } };
41376
+ var icon = { anyOf: [
41377
+ { type: "string", enum: ICON_NAMES },
41378
+ { type: "array", minItems: 1, maxItems: 12, items: { type: "object", required: ["d"], additionalProperties: false, properties: {
41379
+ d: { type: "string", minLength: 1, pattern: "^[MmLlHhVvCcSsQqTtAaZz0-9.,\\s-]+$" },
41380
+ f: { enum: ICON_COLORS },
41381
+ o: { const: true },
41382
+ s: { enum: ICON_COLORS },
41383
+ w: { type: "number", exclusiveMinimum: 0, maximum: 3 }
41384
+ } } }
41385
+ ] };
41386
+ var STUDIO_SCHEMA = {
41387
+ type: "object",
41388
+ required: ["name"],
41389
+ additionalProperties: false,
41390
+ properties: {
41391
+ name: { type: "string", minLength: 1, pattern: "\\S" },
41392
+ names: titles,
41393
+ description: { type: "string" },
41394
+ summaries: titles,
41395
+ entrypoints: { type: "array", minItems: 1, maxItems: 10, uniqueItems: true, items: { type: "string", pattern: PREVIEW_ID.source } },
41396
+ needsArtifact: { type: "boolean" },
41397
+ icon,
41398
+ previews: { type: "object", propertyNames: { pattern: PREVIEW_ID.source }, additionalProperties: {
41399
+ type: "object",
41400
+ additionalProperties: false,
41401
+ properties: { title: titles, description: titles, icon }
41402
+ } }
41403
+ }
41404
+ };
41405
+ var validate = new import_ajv.Ajv({ allErrors: true, meta: false, validateSchema: false }).compile(STUDIO_SCHEMA);
41406
+ var comments = /<!--[^]*?(?:-->|$)/g;
41407
+ var blank = (text2) => text2.replace(/[^\r\n]/g, " ");
41408
+ var headingsOf = (body) => [...withoutCode(body).replace(comments, blank).matchAll(/^ {0,3}#{1,2}(?=[ \t\r\n]|$)[^\r\n]*/gm)];
41409
+ function landSections(body, previews) {
41410
+ let visible = "", at = 0;
41411
+ for (const { start, end } of previews) {
41412
+ visible += body.slice(at, start) + blank(body.slice(start, end));
41413
+ at = end;
41414
+ }
41415
+ visible += body.slice(at);
41416
+ const headings = headingsOf(visible);
41417
+ return headings.flatMap((heading, index) => {
41418
+ const start = heading.index;
41419
+ const end = start + heading[0].length;
41420
+ if (!/^ {0,3}##[ \t]+Land(?:[ \t]+#+)?[ \t]*$/.test(visible.slice(start, end))) return [];
41421
+ return [{
41422
+ offset: start + heading[0].indexOf("#"),
41423
+ empty: !visible.slice(end, headings[index + 1]?.index).replace(comments, "").trim()
41424
+ }];
41425
+ });
41426
+ }
41427
+ function parseStudioFile(id, source, from, { requirePreviewCopy = false, requireLand = false } = {}) {
41428
+ const problems = [];
41429
+ const fail = (offset, path36, code, message, hint2) => problems.push({ file: from, ...sourcePosition(source, offset), path: path36, code, message, hint: hint2 });
41430
+ const result = () => ({ problem: problems.map((p) => `${p.file}:${p.line}:${p.column} ${p.path}: ${p.code} \u2014 ${p.message}. ${p.hint}`).join("\n"), problems });
41431
+ if (!STUDIO_ID.test(id)) fail(0, "id", "studio-schema", `Invalid Studio ID ${id}`, "Use lowercase letters, digits and dashes.");
41432
+ const front = /^---\r?\n([^]*?)\r?\n---(?:\r?\n|$)/.exec(source);
41433
+ if (!front) {
41434
+ fail(0, "", "yaml-syntax", "Missing YAML frontmatter", "Enclose metadata between --- lines.");
41435
+ return result();
41436
+ }
41437
+ const metaOffset = source.indexOf("\n") + 1, bodyOffset = front[0].length;
41438
+ const counter = new import_yaml.LineCounter();
41439
+ const document = (0, import_yaml.parseDocument)(front[1], { lineCounter: counter, uniqueKeys: true, strict: true });
41440
+ for (const error of document.errors) fail(metaOffset + (error.pos[0] ?? 0), "", error.code === "DUPLICATE_KEY" ? "yaml-duplicate-key" : "yaml-syntax", error.message.split("\n")[0], "Correct the indicated YAML location.");
41441
+ if (problems.length) return result();
41442
+ let raw;
41443
+ try {
41444
+ raw = document.toJS({ maxAliasCount: 0 });
41445
+ } catch {
41446
+ fail(metaOffset, "", "yaml-syntax", "YAML aliases are not supported", "Write metadata explicitly.");
41447
+ return result();
41448
+ }
41449
+ if (!validate(raw)) {
41450
+ for (const error of validate.errors ?? []) {
41451
+ const parts = error.instancePath.split("/").slice(1);
41452
+ const key = error.params.additionalProperty ?? error.params.missingProperty;
41453
+ if (key) parts.push(String(key));
41454
+ const node = parts.length ? document.getIn(parts, true) : document.contents;
41455
+ fail(metaOffset + (node?.range?.[0] ?? 0), parts.join("."), "studio-schema", `${parts.join(".") || "metadata"} ${error.message}`, "Use only Studio metadata and previews: {id: {title?, description?, icon?}} with the declared field types.");
41456
+ }
41457
+ }
41458
+ const body = source.slice(bodyOffset);
41459
+ const parsed = parsePreviewBlocks(body, from);
41460
+ problems.push(...parsed.problems.map((p) => ({ ...p, line: p.line + source.slice(0, bodyOffset).split("\n").length - 1 })));
41461
+ if (problems.length) return result();
41462
+ const map = raw.previews ?? {};
41463
+ for (const block of parsed.blocks) if (!Object.hasOwn(map, block.id)) fail(bodyOffset + block.start, `previews.${block.id}`, "preview-metadata-missing", `Preview ${block.id} has no metadata entry`, "Add the ID under previews, using {} if needed.");
41464
+ for (const key of Object.keys(map)) if (!parsed.blocks.some((b) => b.id === key)) fail(metaOffset + (document.getIn(["previews", key], true)?.range?.[0] ?? 0), `previews.${key}`, "preview-body-missing", `Preview ${key} has no body`, "Add its block or remove unused metadata.");
41465
+ if (requirePreviewCopy) for (const block of parsed.blocks) {
41466
+ const metadata = Object.hasOwn(map, block.id) ? map[block.id] : void 0;
41467
+ if (!metadata) continue;
41468
+ for (const field of ["title", "description"]) for (const lang of ["en", "zh"]) {
41469
+ if (metadata[field]?.[lang]) continue;
41470
+ fail(
41471
+ bodyOffset + block.start,
41472
+ `previews.${block.id}.${field}.${lang}`,
41473
+ "preview-display-missing",
41474
+ `Preview ${block.id} needs a ${lang} ${field}`,
41475
+ "Add non-blank en and zh display text in the Preview metadata."
41476
+ );
41477
+ }
41478
+ }
41479
+ if (requireLand) {
41480
+ const sections = landSections(body, parsed.blocks);
41481
+ if (!sections.length) fail(bodyOffset, "Land", "studio-land-missing", "Missing ## Land section", "Add ## Land to the Studio body and describe delivery, checks and what to record.");
41482
+ for (const [index, { offset, empty }] of sections.entries()) {
41483
+ if (index) fail(bodyOffset + offset, "Land", "studio-land-duplicate", "Repeated ## Land section", "Combine delivery instructions under one ## Land heading.");
41484
+ if (empty) fail(bodyOffset + offset, "Land", "studio-land-empty", "The ## Land section is empty", "Describe delivery, checks and what to record under ## Land.");
41485
+ }
41486
+ }
41487
+ if (problems.length) return result();
41488
+ let rules = "", at = 0;
41489
+ for (const block of parsed.blocks) {
41490
+ rules += body.slice(at, block.start);
41491
+ at = block.end;
41492
+ }
41493
+ rules += body.slice(at);
41494
+ return { def: {
41495
+ id,
41496
+ name: raw.name.trim(),
41497
+ ...raw.names ? { names: raw.names } : {},
41498
+ description: raw.description ?? "",
41499
+ needsArtifact: raw.needsArtifact ?? false,
41500
+ ...raw.summaries ? { summaries: raw.summaries } : {},
41501
+ ...raw.entrypoints ? { entrypoints: raw.entrypoints } : {},
41502
+ ...raw.icon ? { icon: raw.icon } : {},
41503
+ previews: parsed.blocks.map((b) => ({ id: b.id, instructions: b.instructions, ...map[b.id] })),
41504
+ rules: rules.trim()
41505
+ } };
41506
+ }
41507
+
41508
+ // ../cli/src/lib/shared/guide-topics.ts
41509
+ var GUIDE_TOPICS = ["board", "writing", "add-task", "follow-up", "discuss-goal", "troubleshoot", "card-chat", "task-ui-en", "task-ui-zh", "update-studio", "implement", "settle-background", "archive", "update-questions", "refine", "revise", "resolve", "prune-memory", "review-memory", "describe-project", "review-rejections", "reflect", "write-agent", "write-prompt", "module-map"];
41510
+
41511
+ // ../cli/src/lib/shared/studio-files.ts
41512
+ var STUDIO_FILE = "STUDIO.md";
41513
+ var MCP_FILE = "mcp.json";
41514
+ var VERSION_FILE = "version.json";
41515
+ var PUBLICATION_FILE = ".publication.json";
41516
+ var STUDIO_CATALOG_FILE = "catalog.json";
41517
+ var KB = 1024;
41518
+ var FILE_LIMITS = { file: 2 * KB * KB, total: 10 * KB * KB, count: 500, path: 512 };
41519
+ var officialId = (folder2) => `wf_builtin_${folder2.replace(/-/g, "_")}`;
41520
+ var hashInput = (files) => JSON.stringify(Object.entries(files).sort(([a], [b]) => a < b ? -1 : 1));
41521
+ var landsOf = (_def) => ({ lands: true });
41522
+ var encoder = new TextEncoder();
41523
+ var safeStudioPath = (file2) => encoder.encode(file2).length <= FILE_LIMITS.path && !/[<>:"\\|?*\x00-\x1f\x7f]/.test(file2) && file2.split("/").every((part) => !!part && encoder.encode(part).length <= 255 && !/[. ]$/.test(part) && !/^(?:\.git$|(?:con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$))/i.test(part));
41524
+ var SKILL_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
41525
+ var skillFile = (name) => "skills/" + name + "/SKILL.md";
41526
+ function skillMetadata(source, directory2) {
41527
+ const front = /^\uFEFF?---[^\S\r\n]*\r?\n([\s\S]*?)^---[^\S\r\n]*(?:\r?\n|$)/m.exec(source);
41528
+ if (!front || front.index !== 0) return "Start SKILL.md with YAML frontmatter";
41529
+ const doc = (0, import_yaml3.parseDocument)(front[1]);
41530
+ if (doc.errors.length || !(0, import_yaml3.isMap)(doc.contents)) return "Use valid YAML frontmatter with unique keys";
41531
+ let data;
41532
+ try {
41533
+ data = doc.toJS({ maxAliasCount: 0 });
41534
+ } catch {
41535
+ return "Use literal YAML metadata";
41536
+ }
41537
+ const { name, description, license, compatibility, metadata, "allowed-tools": allowedTools, ...extra } = data;
41538
+ if (name !== directory2 || !SKILL_NAME.test(directory2) || directory2.length > 64) return "Set name to match the containing skill directory (1\u201364 lowercase letters, digits and single hyphens)";
41539
+ if (typeof description !== "string" || !description.trim() || [...description].length > 1024) return "Set description to 1\u20131024 characters";
41540
+ if (license !== void 0 && typeof license !== "string") return "Set license to a string";
41541
+ if (compatibility !== void 0 && (typeof compatibility !== "string" || !compatibility.trim() || [...compatibility].length > 500)) return "Set compatibility to 1\u2013500 characters";
41542
+ if (metadata !== void 0 && (!metadata || typeof metadata !== "object" || Array.isArray(metadata) || Object.values(metadata).some((value) => typeof value !== "string"))) return "Set metadata to a map of strings";
41543
+ if (allowedTools !== void 0 && typeof allowedTools !== "string") return "Set allowed-tools to a string";
41544
+ if (Object.keys(extra).length) return "Use standard Agent Skills fields and put custom fields under metadata";
41545
+ return { name: directory2, description: description.trim().replace(/\s+/g, " ") };
41546
+ }
41547
+ var isAboutFile = (file2) => /^ABOUT(\.[a-z]{2})?\.md$/.test(file2) || /^screenshots\/[\w.-]+\.(png|jpe?g|webp)$/.test(file2);
41548
+ var studioScreenshotPrefix = (path36) => "data:" + (path36.endsWith(".png") ? "image/png" : /\.jpe?g$/.test(path36) ? "image/jpeg" : "image/webp") + ";base64,";
41549
+ function studioFileBody(path36, text2) {
41550
+ if (path36.startsWith("screenshots/") && isAboutFile(path36)) {
41551
+ const prefix = studioScreenshotPrefix(path36);
41552
+ if (text2.startsWith(prefix)) {
41553
+ const data = text2.slice(prefix.length);
41554
+ if (/^[A-Za-z0-9+/]*={0,2}$/.test(data) && data.length % 4 === 0) {
41555
+ const raw = atob(data);
41556
+ if (btoa(raw) === data) return { bytes: Uint8Array.from(raw, (c) => c.charCodeAt(0)), binary: true };
41557
+ }
41558
+ }
41559
+ }
41560
+ const bytes = encoder.encode(text2);
41561
+ if (new TextDecoder("utf-8", { ignoreBOM: true }).decode(bytes) !== text2) throw Error("Invalid UTF-8.");
41562
+ return { bytes, binary: false };
41563
+ }
41564
+ function studioSizeProblem(file2, size, total) {
41565
+ if (size > FILE_LIMITS.file) return { file: file2, reason: "is larger than 2 MiB", tooLarge: true };
41566
+ if (total > FILE_LIMITS.total) return { file: "files", reason: "are larger than 10 MiB together", tooLarge: true };
41567
+ }
41568
+ function mcpProblem(text2) {
41569
+ let read3;
41570
+ try {
41571
+ read3 = JSON.parse(text2);
41572
+ } catch {
41573
+ return "is not JSON";
41574
+ }
41575
+ const servers = read3?.mcpServers;
41576
+ if (!servers || typeof servers !== "object" || Array.isArray(servers)) return "must hold `mcpServers`, an object of name \u2192 server";
41577
+ for (const [name, server] of Object.entries(servers)) {
41578
+ const { command, args: args2, ...rest } = server ?? {};
41579
+ if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(name)) return `names a server \`${name}\`; use lowercase letters, digits and dashes`;
41580
+ if (typeof command !== "string" || !command) return `server \`${name}\` needs a \`command\``;
41581
+ if (args2 !== void 0 && !(Array.isArray(args2) && args2.every((a) => typeof a === "string"))) return `server \`${name}\`: \`args\` must be a list of strings`;
41582
+ if (Object.keys(rest).length) return `server \`${name}\` takes only \`command\` and \`args\``;
41583
+ }
41584
+ return null;
41585
+ }
41586
+ function formatStudioProblem({ file: file2, line, column, reason, hint: hint2 }) {
41587
+ const location = line === void 0 ? file2 : `${file2}:${line}:${column ?? 1}`;
41588
+ return `${location}: ${reason}${hint2 ? `. ${hint2}` : ""}`;
41589
+ }
41590
+ function checkStudioFiles(value, official = false, checks = {}) {
41591
+ const read3 = inspect(value, official, checks);
41592
+ const first = read3.problems[0];
41593
+ return first ? { ok: false, ...first, problems: read3.problems } : { ok: true, def: read3.def, files: read3.files };
41594
+ }
41595
+ function inspect(value, official, { allowLegacyPreviewCopy, allowLegacyLand } = {}) {
41596
+ const problems = [];
41597
+ const fail = (file2, reason, tooLarge = false) => {
41598
+ problems.push({ file: file2, reason, ...tooLarge ? { tooLarge } : {} });
41599
+ return { problems };
41600
+ };
41601
+ if (!value || typeof value !== "object" || Array.isArray(value)) return fail("files", "must be an object of path \u2192 text");
41602
+ const files = Object.assign(/* @__PURE__ */ Object.create(null), Object.fromEntries(Object.entries(value).filter(([file2]) => file2 !== VERSION_FILE && file2 !== PUBLICATION_FILE)));
41603
+ const entries = Object.entries(files);
41604
+ if (entries.length > FILE_LIMITS.count) return fail("files", `holds at most ${FILE_LIMITS.count} files`, true);
41605
+ let total = 0;
41606
+ const skills = /* @__PURE__ */ new Set();
41607
+ const paths = new Map([VERSION_FILE, PUBLICATION_FILE].map((file2) => [file2, { path: file2, file: true }]));
41608
+ const pathProblem = (file2, reason) => problems.push({ file: file2, reason, code: "studio-path", hint: "Use a safe relative file path unique within the Studio." });
41609
+ for (const [file2, text2] of entries) {
41610
+ if (typeof text2 !== "string" || text2.includes("\0")) {
41611
+ fail(file2, "is not a text file");
41612
+ continue;
41613
+ }
41614
+ let size;
41615
+ try {
41616
+ size = studioFileBody(file2, text2).bytes.length;
41617
+ } catch {
41618
+ fail(file2, "is not valid UTF-8");
41619
+ continue;
41620
+ }
41621
+ total += size;
41622
+ const limit = studioSizeProblem(file2, size, total);
41623
+ if (limit) return fail(limit.file, limit.reason, true);
41624
+ if (!safeStudioPath(file2)) {
41625
+ pathProblem(file2, "Unsafe Studio path");
41626
+ continue;
41627
+ }
41628
+ const parts = file2.split("/");
41629
+ for (let i = 1; i <= parts.length; i++) {
41630
+ const at = parts.slice(0, i).join("/");
41631
+ const key = at.normalize("NFC").toLowerCase();
41632
+ const prior = paths.get(key);
41633
+ if (prior && (prior.path !== at || prior.file || i === parts.length)) {
41634
+ pathProblem(file2, "Path conflicts with " + prior.path);
41635
+ break;
41636
+ }
41637
+ paths.set(key, { path: at, file: i === parts.length });
41638
+ }
41639
+ if (file2.toLowerCase() === STUDIO_CATALOG_FILE && (!official || file2 !== STUDIO_CATALOG_FILE)) {
41640
+ pathProblem(file2, "The root catalog.json is reserved for official Studio metadata");
41641
+ }
41642
+ if (file2 === MCP_FILE) {
41643
+ const problem = official ? mcpProblem(text2) : "MCP servers are available to official Studios";
41644
+ if (problem) fail(file2, problem);
41645
+ }
41646
+ if (parts[0] === "skills") {
41647
+ const name = parts[1];
41648
+ if (parts.length < 3 || !name || !SKILL_NAME.test(name) || name.length > 64) {
41649
+ pathProblem(file2, "Expected skills/<name>/<path> with a valid Agent Skills name");
41650
+ } else skills.add(name);
41651
+ }
41652
+ }
41653
+ for (const name of skills) {
41654
+ const file2 = skillFile(name);
41655
+ const text2 = files[file2];
41656
+ const problem = text2 === void 0 ? "SKILL.md is missing" : typeof text2 === "string" ? skillMetadata(text2, name) : null;
41657
+ if (typeof problem === "string") problems.push({
41658
+ file: file2,
41659
+ line: 1,
41660
+ column: 1,
41661
+ code: "studio-skill",
41662
+ message: problem,
41663
+ reason: problem,
41664
+ hint: "Follow the Agent Skills specification at https://agentskills.io/specification."
41665
+ });
41666
+ }
41667
+ const source = files[STUDIO_FILE];
41668
+ const read3 = typeof source === "string" ? parseStudioFile("studio", source, STUDIO_FILE, { requirePreviewCopy: !official && !allowLegacyPreviewCopy, requireLand: !allowLegacyLand }) : null;
41669
+ if (!read3) fail(STUDIO_FILE, "is missing");
41670
+ else if ("problem" in read3) for (const problem of read3.problems) problems.push({ ...problem, reason: problem.message });
41671
+ if (!read3 || "problem" in read3) return { problems };
41672
+ const def = read3.def;
41673
+ for (const [file2, text2] of Object.entries(files)) {
41674
+ if (typeof text2 !== "string" || !file2.endsWith(".md")) continue;
41675
+ const masked = withoutCode(text2);
41676
+ const reference = (offset, link, message) => problems.push({ file: file2, ...sourcePosition(text2, offset), path: link, code: "studio-reference", message, reason: message, hint: "Use an existing safe relative resource or a shipped AKB Guide." });
41677
+ for (const match of masked.matchAll(/!?\[[^\]]*\]\((<[^>\r\n]+>|[^\s)]+)(?:\s+[^)]*)?\)/g)) {
41678
+ const link = match[1].replace(/^<|>$/g, "");
41679
+ if (/^(?:https?:|mailto:|#)/i.test(link)) continue;
41680
+ let decoded;
41681
+ try {
41682
+ decoded = decodeURIComponent(link.split(/[?#]/)[0]);
41683
+ } catch {
41684
+ reference(match.index, link, "Invalid resource URL");
41685
+ continue;
41686
+ }
41687
+ if (/^(?:[a-z][\w+.-]*:|[/\\])|\\/i.test(decoded) || decoded.split("/").includes("..")) {
41688
+ reference(match.index, link, "Unsafe resource path");
41689
+ continue;
41690
+ }
41691
+ const target = [...file2.split("/").slice(0, -1), ...decoded.split("/").filter((p) => p !== ".")].join("/");
41692
+ if (!Object.hasOwn(files, target)) reference(match.index, link, `Missing resource ${target}`);
41693
+ }
41694
+ for (const match of text2.matchAll(/akb guide ([a-z][a-z-]*)/g)) if (!GUIDE_TOPICS.includes(match[1])) reference(match.index, match[1], `Unknown AKB Guide ${match[1]}`);
41695
+ }
41696
+ return { problems, def, files };
41697
+ }
41698
+
41699
+ // ../cli/src/lib/shared/studio-package.ts
41700
+ var LOCAL = 30;
41701
+ var CENTRAL = 46;
41702
+ var END = 22;
41703
+ var encoder2 = new TextEncoder();
41704
+ var decoder = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
41705
+ var crcTable = Uint32Array.from({ length: 256 }, (_, byte) => {
41706
+ for (let bit = 0; bit < 8; bit++) byte = byte >>> 1 ^ (byte & 1 ? 3988292384 : 0);
41707
+ return byte;
41708
+ });
41709
+ var STUDIO_ZIP_LIMIT = FILE_LIMITS.total + FILE_LIMITS.count * (LOCAL + CENTRAL + 2 * FILE_LIMITS.path) + END;
41710
+
41248
41711
  // ../cli/src/lib/io.ts
41249
41712
  var BoardError = class extends Error {
41250
41713
  // `kind` is the machine-readable name of the refusal (card-not-found, no-board,
@@ -41288,8 +41751,8 @@ function cloudProblem(response, body) {
41288
41751
  }
41289
41752
 
41290
41753
  // src/protocol.ts
41291
- var VERSION = true ? "0.6.116" : "0.0.0";
41292
- var AKB_VERSION = true ? "0.11.98" : "0.0.0";
41754
+ var VERSION = true ? "0.6.117" : "0.0.0";
41755
+ var AKB_VERSION = true ? "0.11.99" : "0.0.0";
41293
41756
 
41294
41757
  // ../cli/src/lib/agent/harnesses/antigravity.ts
41295
41758
  import fs10 from "node:fs";
@@ -42097,12 +42560,12 @@ function bounded(work, ms, reason) {
42097
42560
  }
42098
42561
 
42099
42562
  // ../cli/src/lib/shared/reply-parts.ts
42100
- function imageMime(bytes2) {
42101
- const at = (...v) => v.every((n, i) => bytes2[i] === n);
42102
- const text2 = (a, b) => String.fromCharCode(...bytes2.slice(a, b));
42103
- if (bytes2.length >= 24 && at(137, 80, 78, 71, 13, 10, 26, 10) && text2(12, 16) === "IHDR" && bytes2.slice(16, 20).some(Boolean) && bytes2.slice(20, 24).some(Boolean)) return "image/png";
42563
+ function imageMime(bytes) {
42564
+ const at = (...v) => v.every((n, i) => bytes[i] === n);
42565
+ const text2 = (a, b) => String.fromCharCode(...bytes.slice(a, b));
42566
+ if (bytes.length >= 24 && at(137, 80, 78, 71, 13, 10, 26, 10) && text2(12, 16) === "IHDR" && bytes.slice(16, 20).some(Boolean) && bytes.slice(20, 24).some(Boolean)) return "image/png";
42104
42567
  if (at(255, 216, 255)) return "image/jpeg";
42105
- if (bytes2.length >= 13 && ["GIF87a", "GIF89a"].includes(text2(0, 6)) && (bytes2[6] || bytes2[7]) && (bytes2[8] || bytes2[9])) return "image/gif";
42568
+ if (bytes.length >= 13 && ["GIF87a", "GIF89a"].includes(text2(0, 6)) && (bytes[6] || bytes[7]) && (bytes[8] || bytes[9])) return "image/gif";
42106
42569
  if (text2(0, 4) === "RIFF" && text2(8, 12) === "WEBP") return "image/webp";
42107
42570
  return void 0;
42108
42571
  }
@@ -42417,8 +42880,8 @@ function createTail(log) {
42417
42880
  // ../cli/package.json
42418
42881
  var package_default = {
42419
42882
  name: "wildcrane",
42420
- version: "0.11.98",
42421
- akbContract: 32,
42883
+ version: "0.11.99",
42884
+ akbContract: 33,
42422
42885
  canonicalCommands: true,
42423
42886
  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.",
42424
42887
  keywords: [
@@ -42711,9 +43174,9 @@ async function oneTurn(io, options) {
42711
43174
  const images = [];
42712
43175
  const files = [];
42713
43176
  for (const file2 of io.imageFiles ?? []) {
42714
- const bytes2 = caps.image === true ? fs9.readFileSync(file2) : void 0;
42715
- const mimeType = bytes2 && imageMime(bytes2);
42716
- if (mimeType) images.push({ type: "image", mimeType, data: bytes2.toString("base64") });
43177
+ const bytes = caps.image === true ? fs9.readFileSync(file2) : void 0;
43178
+ const mimeType = bytes && imageMime(bytes);
43179
+ if (mimeType) images.push({ type: "image", mimeType, data: bytes.toString("base64") });
42717
43180
  else files.push(file2);
42718
43181
  }
42719
43182
  if (Date.now() >= preparingUntil) throw Error("ACP preparation timed out.");
@@ -42892,30 +43355,30 @@ import { existsSync } from "node:fs";
42892
43355
  function antigravityConversationFile(session) {
42893
43356
  if (/^[a-f0-9-]{36}$/i.test(session)) return home(".gemini", "antigravity-cli", "conversations", `${session}.db`);
42894
43357
  }
42895
- function varint(bytes2, offset) {
43358
+ function varint(bytes, offset) {
42896
43359
  let value = 0;
42897
- for (let shift = 0; shift < 70 && offset.value < bytes2.length; shift += 7) {
42898
- const byte = bytes2[offset.value++];
43360
+ for (let shift = 0; shift < 70 && offset.value < bytes.length; shift += 7) {
43361
+ const byte = bytes[offset.value++];
42899
43362
  value += (byte & 127) * 2 ** shift;
42900
43363
  if (byte < 128) return value;
42901
43364
  }
42902
43365
  throw new Error("Invalid Antigravity conversation metadata");
42903
43366
  }
42904
- function* fields(bytes2) {
43367
+ function* fields(bytes) {
42905
43368
  const offset = { value: 0 };
42906
- while (offset.value < bytes2.length) {
42907
- const tag = varint(bytes2, offset);
43369
+ while (offset.value < bytes.length) {
43370
+ const tag = varint(bytes, offset);
42908
43371
  const number = Math.floor(tag / 8);
42909
43372
  const wire = tag % 8;
42910
43373
  if (number < 1 || number >= 2 ** 29) throw new Error("Invalid Antigravity conversation metadata");
42911
43374
  if (wire === 0) {
42912
- yield [number, varint(bytes2, offset)];
43375
+ yield [number, varint(bytes, offset)];
42913
43376
  continue;
42914
43377
  }
42915
- const size = wire === 2 ? varint(bytes2, offset) : wire === 1 ? 8 : wire === 5 ? 4 : -1;
43378
+ const size = wire === 2 ? varint(bytes, offset) : wire === 1 ? 8 : wire === 5 ? 4 : -1;
42916
43379
  const end = offset.value + size;
42917
- if (size < 0 || end > bytes2.length) throw new Error("Invalid Antigravity conversation metadata");
42918
- if (wire === 2) yield [number, bytes2.subarray(offset.value, end)];
43380
+ if (size < 0 || end > bytes.length) throw new Error("Invalid Antigravity conversation metadata");
43381
+ if (wire === 2) yield [number, bytes.subarray(offset.value, end)];
42919
43382
  offset.value = end;
42920
43383
  }
42921
43384
  }
@@ -42947,7 +43410,7 @@ function recordedContextLimit(data) {
42947
43410
  const limit = varintField(bytesField(bytesField(bytesField(data, 1), 9), 10), 4);
42948
43411
  return limit !== void 0 && Number.isSafeInteger(limit) && limit > 0 ? limit : void 0;
42949
43412
  }
42950
- var utf8 = (bytes2) => bytes2 && Buffer.from(bytes2).toString("utf8");
43413
+ var utf8 = (bytes) => bytes && Buffer.from(bytes).toString("utf8");
42951
43414
  function stepUuid(stepRow, index) {
42952
43415
  if (!Number.isSafeInteger(index) || index < 0) return;
42953
43416
  const id = bytesField(stepRow.get(index)?.metadata, 12);
@@ -44719,19 +45182,19 @@ var settle_background_default = "Wait for and collect needed results from this t
44719
45182
 
44720
45183
  // ../cli/src/lib/agent/wire/codex-background.ts
44721
45184
  var CODEX_SETTLE_MS = { turn: 6e4, verify: 1e4 };
44722
- function summary(text2, bytes2 = 1800) {
44723
- if (Buffer.byteLength(text2) <= bytes2) return text2;
44724
- return Buffer.from(text2).subarray(0, bytes2).toString("utf8") + " [truncated; see the original thread item in the run log]";
45185
+ function summary(text2, bytes = 1800) {
45186
+ if (Buffer.byteLength(text2) <= bytes) return text2;
45187
+ return Buffer.from(text2).subarray(0, bytes).toString("utf8") + " [truncated; see the original thread item in the run log]";
44725
45188
  }
44726
45189
  function batch(work) {
44727
45190
  const result = [];
44728
- let bytes2 = 0;
45191
+ let bytes = 0;
44729
45192
  for (const entry of work) {
44730
45193
  const size = Buffer.byteLength(JSON.stringify(entry));
44731
45194
  if (size > 15e3) throw Error("A Codex background identifier exceeds the snapshot limit.");
44732
- if (bytes2 + size > 15e3) break;
45195
+ if (bytes + size > 15e3) break;
44733
45196
  result.push(entry);
44734
- bytes2 += size;
45197
+ bytes += size;
44735
45198
  }
44736
45199
  return result;
44737
45200
  }
@@ -46885,6 +47348,7 @@ var removeFolder = (machineId2, project) => request("POST", `/v1/runner/folders/
46885
47348
  var import_yaml8 = __toESM(require_dist(), 1);
46886
47349
 
46887
47350
  // ../cli/src/lib/agent/cloud-studios.ts
47351
+ import { createHash as createHash5, randomUUID as randomUUID2 } from "node:crypto";
46888
47352
  import fs17 from "node:fs";
46889
47353
  import path21 from "node:path";
46890
47354
 
@@ -46913,423 +47377,49 @@ var projectConfigFile = "rules/config.md";
46913
47377
  var isStudioConfigPath = (path36) => /^rules\/studios\/[^/]+(?:\/config)?\.md$/.test(path36);
46914
47378
 
46915
47379
  // ../official/pack.ts
46916
- import crypto2 from "node:crypto";
47380
+ import crypto3 from "node:crypto";
46917
47381
  import fs15 from "node:fs";
46918
47382
  import path19 from "node:path";
46919
47383
  import { fileURLToPath } from "node:url";
46920
47384
 
46921
- // ../cli/src/lib/agent/studio-def.ts
46922
- var import_ajv = __toESM(require_ajv(), 1);
46923
- var import_yaml3 = __toESM(require_dist(), 1);
46924
-
46925
- // ../cli/src/lib/agents/icon.ts
46926
- var ICON_NAMES = [
46927
- "file",
46928
- "text",
46929
- "article",
46930
- "outline",
46931
- "script",
46932
- "prompt",
46933
- "email",
46934
- "image",
46935
- "post-image",
46936
- "social-image",
46937
- "cover",
46938
- "carousel",
46939
- "carousel-outline",
46940
- "slides",
46941
- "wireframe",
46942
- "screen",
46943
- "video",
46944
- "storyboard",
46945
- "template",
46946
- "shots",
46947
- "api",
46948
- "schema",
46949
- "compare",
46950
- "stack",
46951
- "studio",
46952
- "code",
46953
- "checklist",
46954
- "card",
46955
- "plan",
46956
- "proposal",
46957
- "dismissed",
46958
- "inbox",
46959
- "notebook",
46960
- "squeeze",
46961
- "folder",
46962
- "reply",
46963
- "feedback",
46964
- "software",
46965
- "product-video",
46966
- "social-post",
46967
- "blog",
46968
- "deck",
46969
- "video-clone",
46970
- "studio-kit"
46971
- ];
46972
- var ICON_COLORS = ["k", "w", "c", "g", "o", "p", "s", "m", "l", "r", "y"];
46973
-
46974
- // ../cli/src/lib/shared/preview-blocks.ts
46975
- var PREVIEW_ID = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
46976
- function sourcePosition(source, offset) {
46977
- const before = source.slice(0, offset);
46978
- return { line: before.split("\n").length, column: offset - before.lastIndexOf("\n") };
46979
- }
46980
- function withoutCode(source) {
46981
- const blank2 = (s) => s.replace(/[^\n\r]/g, " ");
46982
- let fence;
46983
- let indented = false, afterBlank = true, inList = false;
46984
- return source.split(/(?<=\n)/).map((line) => {
46985
- const marker = /^ {0,3}(`{3,}|~{3,})(.*)/.exec(line);
46986
- if (fence) {
46987
- if (marker && marker[1][0] === fence.char && marker[1].length >= fence.length && !marker[2].trim()) fence = void 0;
46988
- return blank2(line);
46989
- }
46990
- if (marker) {
46991
- fence = { char: marker[1][0], length: marker[1].length };
46992
- return blank2(line);
46993
- }
46994
- if (!line.trim()) {
46995
- afterBlank = true;
46996
- return line;
46997
- }
46998
- const hasIndent = /^(?: {4}|\t)/.test(line);
46999
- if (!hasIndent) indented = false;
47000
- if (/^ {0,3}(?:[-+*]|\d+[.)])\s/.test(line)) inList = true;
47001
- else if (/^\S/.test(line)) inList = false;
47002
- if (hasIndent && (indented || afterBlank && !inList)) {
47003
- indented = true;
47004
- return blank2(line);
47005
- }
47006
- afterBlank = false;
47007
- return line;
47008
- }).join("").replace(/(`+)([^]*?)\1(?!`)/g, blank2);
47009
- }
47010
- function parsePreviewBlocks(source, file2 = "STUDIO.md") {
47011
- const blocks = [], problems = [];
47012
- const masked = withoutCode(source);
47013
- let open;
47014
- const seen = /* @__PURE__ */ new Set();
47015
- const fail = (offset, id, code, message, hint2) => problems.push({ file: file2, ...sourcePosition(source, offset), path: id ? `previews.${id}` : "previews", code, message, hint: hint2 });
47016
- for (const tag of masked.matchAll(/<\/?Preview\b[^>]*(?:>|$)/g)) {
47017
- const offset = tag.index, text2 = tag[0];
47018
- const closing = /^<\/Preview\s*>$/.test(text2);
47019
- if (closing) {
47020
- if (!open) fail(offset, "", "preview-unexpected-close", "Preview has no opening tag", "Remove it or restore its opening tag.");
47021
- else {
47022
- const instructions = source.slice(open.content, offset).trim();
47023
- if (!instructions) fail(open.start, open.id, "preview-empty", `Preview ${open.id} is empty`, "Describe the requested output inside the block.");
47024
- blocks.push({ id: open.id, instructions, start: open.start, end: offset + text2.length });
47025
- open = void 0;
47026
- }
47027
- continue;
47028
- }
47029
- const opening = /^<Preview\s+id=(?:"([^"]*)"|'([^']*)')\s*>$/.exec(text2);
47030
- if (!opening || open) {
47031
- fail(offset, open?.id ?? "", "preview-tag", "Malformed or nested Preview tag", 'Use one non-nested <Preview id="stable-id"> block with only id.');
47032
- continue;
47033
- }
47034
- const id = opening[1] ?? opening[2];
47035
- if (!PREVIEW_ID.test(id) || seen.has(id)) fail(offset, id, "preview-id", `Invalid or repeated Preview ID ${id}`, "Use a unique lowercase ID with digits and dashes.");
47036
- seen.add(id);
47037
- open = { id, start: offset, content: offset + text2.length };
47038
- }
47039
- if (open) fail(open.start, open.id, "preview-unclosed", `Preview ${open.id} is not closed`, "Add </Preview> after this block.");
47040
- return { blocks, problems };
47041
- }
47042
-
47043
- // ../cli/src/lib/agent/studio-def.ts
47044
- var STUDIO_ID = PREVIEW_ID;
47045
- var titles = { type: "object", minProperties: 1, propertyNames: { pattern: "^[a-z]{2,3}(?:-[A-Za-z0-9]+)*$" }, additionalProperties: { type: "string", minLength: 1, pattern: "\\S" } };
47046
- var icon = { anyOf: [
47047
- { type: "string", enum: ICON_NAMES },
47048
- { type: "array", minItems: 1, maxItems: 12, items: { type: "object", required: ["d"], additionalProperties: false, properties: {
47049
- d: { type: "string", minLength: 1, pattern: "^[MmLlHhVvCcSsQqTtAaZz0-9.,\\s-]+$" },
47050
- f: { enum: ICON_COLORS },
47051
- o: { const: true },
47052
- s: { enum: ICON_COLORS },
47053
- w: { type: "number", exclusiveMinimum: 0, maximum: 3 }
47054
- } } }
47055
- ] };
47056
- var STUDIO_SCHEMA = {
47057
- type: "object",
47058
- required: ["name"],
47059
- additionalProperties: false,
47060
- properties: {
47061
- name: { type: "string", minLength: 1, pattern: "\\S" },
47062
- names: titles,
47063
- description: { type: "string" },
47064
- summaries: titles,
47065
- entrypoints: { type: "array", minItems: 1, maxItems: 10, uniqueItems: true, items: { type: "string", pattern: PREVIEW_ID.source } },
47066
- needsArtifact: { type: "boolean" },
47067
- icon,
47068
- previews: { type: "object", propertyNames: { pattern: PREVIEW_ID.source }, additionalProperties: {
47069
- type: "object",
47070
- additionalProperties: false,
47071
- properties: { title: titles, description: titles, icon }
47072
- } }
47073
- }
47074
- };
47075
- var validate = new import_ajv.Ajv({ allErrors: true, meta: false, validateSchema: false }).compile(STUDIO_SCHEMA);
47076
- var comments = /<!--[^]*?(?:-->|$)/g;
47077
- var blank = (text2) => text2.replace(/[^\r\n]/g, " ");
47078
- var headingsOf = (body) => [...withoutCode(body).replace(comments, blank).matchAll(/^ {0,3}#{1,2}(?=[ \t\r\n]|$)[^\r\n]*/gm)];
47079
- function landSections(body, previews) {
47080
- let visible = "", at = 0;
47081
- for (const { start, end } of previews) {
47082
- visible += body.slice(at, start) + blank(body.slice(start, end));
47083
- at = end;
47084
- }
47085
- visible += body.slice(at);
47086
- const headings = headingsOf(visible);
47087
- return headings.flatMap((heading, index) => {
47088
- const start = heading.index;
47089
- const end = start + heading[0].length;
47090
- if (!/^ {0,3}##[ \t]+Land(?:[ \t]+#+)?[ \t]*$/.test(visible.slice(start, end))) return [];
47091
- return [{
47092
- offset: start + heading[0].indexOf("#"),
47093
- empty: !visible.slice(end, headings[index + 1]?.index).replace(comments, "").trim()
47094
- }];
47095
- });
47096
- }
47097
- function parseStudioFile(id, source, from, { requirePreviewCopy = false, requireLand = false } = {}) {
47098
- const problems = [];
47099
- const fail = (offset, path36, code, message, hint2) => problems.push({ file: from, ...sourcePosition(source, offset), path: path36, code, message, hint: hint2 });
47100
- const result = () => ({ problem: problems.map((p) => `${p.file}:${p.line}:${p.column} ${p.path}: ${p.code} \u2014 ${p.message}. ${p.hint}`).join("\n"), problems });
47101
- if (!STUDIO_ID.test(id)) fail(0, "id", "studio-schema", `Invalid Studio ID ${id}`, "Use lowercase letters, digits and dashes.");
47102
- const front = /^---\r?\n([^]*?)\r?\n---(?:\r?\n|$)/.exec(source);
47103
- if (!front) {
47104
- fail(0, "", "yaml-syntax", "Missing YAML frontmatter", "Enclose metadata between --- lines.");
47105
- return result();
47106
- }
47107
- const metaOffset = source.indexOf("\n") + 1, bodyOffset = front[0].length;
47108
- const counter = new import_yaml3.LineCounter();
47109
- const document = (0, import_yaml3.parseDocument)(front[1], { lineCounter: counter, uniqueKeys: true, strict: true });
47110
- for (const error of document.errors) fail(metaOffset + (error.pos[0] ?? 0), "", error.code === "DUPLICATE_KEY" ? "yaml-duplicate-key" : "yaml-syntax", error.message.split("\n")[0], "Correct the indicated YAML location.");
47111
- if (problems.length) return result();
47112
- let raw;
47113
- try {
47114
- raw = document.toJS({ maxAliasCount: 0 });
47115
- } catch {
47116
- fail(metaOffset, "", "yaml-syntax", "YAML aliases are not supported", "Write metadata explicitly.");
47117
- return result();
47118
- }
47119
- if (!validate(raw)) {
47120
- for (const error of validate.errors ?? []) {
47121
- const parts = error.instancePath.split("/").slice(1);
47122
- const key = error.params.additionalProperty ?? error.params.missingProperty;
47123
- if (key) parts.push(String(key));
47124
- const node = parts.length ? document.getIn(parts, true) : document.contents;
47125
- fail(metaOffset + (node?.range?.[0] ?? 0), parts.join("."), "studio-schema", `${parts.join(".") || "metadata"} ${error.message}`, "Use only Studio metadata and previews: {id: {title?, description?, icon?}} with the declared field types.");
47126
- }
47127
- }
47128
- const body = source.slice(bodyOffset);
47129
- const parsed = parsePreviewBlocks(body, from);
47130
- problems.push(...parsed.problems.map((p) => ({ ...p, line: p.line + source.slice(0, bodyOffset).split("\n").length - 1 })));
47131
- if (problems.length) return result();
47132
- const map = raw.previews ?? {};
47133
- for (const block of parsed.blocks) if (!Object.hasOwn(map, block.id)) fail(bodyOffset + block.start, `previews.${block.id}`, "preview-metadata-missing", `Preview ${block.id} has no metadata entry`, "Add the ID under previews, using {} if needed.");
47134
- for (const key of Object.keys(map)) if (!parsed.blocks.some((b) => b.id === key)) fail(metaOffset + (document.getIn(["previews", key], true)?.range?.[0] ?? 0), `previews.${key}`, "preview-body-missing", `Preview ${key} has no body`, "Add its block or remove unused metadata.");
47135
- if (requirePreviewCopy) for (const block of parsed.blocks) {
47136
- const metadata = Object.hasOwn(map, block.id) ? map[block.id] : void 0;
47137
- if (!metadata) continue;
47138
- for (const field of ["title", "description"]) for (const lang of ["en", "zh"]) {
47139
- if (metadata[field]?.[lang]) continue;
47140
- fail(
47141
- bodyOffset + block.start,
47142
- `previews.${block.id}.${field}.${lang}`,
47143
- "preview-display-missing",
47144
- `Preview ${block.id} needs a ${lang} ${field}`,
47145
- "Add non-blank en and zh display text in the Preview metadata."
47146
- );
47147
- }
47148
- }
47149
- if (requireLand) {
47150
- const sections = landSections(body, parsed.blocks);
47151
- if (!sections.length) fail(bodyOffset, "Land", "studio-land-missing", "Missing ## Land section", "Add ## Land to the Studio body and describe delivery, checks and what to record.");
47152
- for (const [index, { offset, empty }] of sections.entries()) {
47153
- if (index) fail(bodyOffset + offset, "Land", "studio-land-duplicate", "Repeated ## Land section", "Combine delivery instructions under one ## Land heading.");
47154
- if (empty) fail(bodyOffset + offset, "Land", "studio-land-empty", "The ## Land section is empty", "Describe delivery, checks and what to record under ## Land.");
47155
- }
47156
- }
47157
- if (problems.length) return result();
47158
- let rules = "", at = 0;
47159
- for (const block of parsed.blocks) {
47160
- rules += body.slice(at, block.start);
47161
- at = block.end;
47162
- }
47163
- rules += body.slice(at);
47164
- return { def: {
47165
- id,
47166
- name: raw.name.trim(),
47167
- ...raw.names ? { names: raw.names } : {},
47168
- description: raw.description ?? "",
47169
- needsArtifact: raw.needsArtifact ?? false,
47170
- ...raw.summaries ? { summaries: raw.summaries } : {},
47171
- ...raw.entrypoints ? { entrypoints: raw.entrypoints } : {},
47172
- ...raw.icon ? { icon: raw.icon } : {},
47173
- previews: parsed.blocks.map((b) => ({ id: b.id, instructions: b.instructions, ...map[b.id] })),
47174
- rules: rules.trim()
47175
- } };
47176
- }
47177
-
47178
47385
  // ../cli/src/lib/agent/studio-folder.ts
47179
47386
  import fs14 from "node:fs";
47180
47387
  import path18 from "node:path";
47181
-
47182
- // ../cli/src/lib/shared/studio-files.ts
47183
- var import_yaml5 = __toESM(require_dist(), 1);
47184
-
47185
- // ../cli/src/lib/shared/guide-topics.ts
47186
- var GUIDE_TOPICS = ["board", "writing", "add-task", "follow-up", "discuss-goal", "troubleshoot", "card-chat", "task-ui-en", "task-ui-zh", "update-studio", "implement", "settle-background", "archive", "update-questions", "refine", "revise", "resolve", "prune-memory", "review-memory", "describe-project", "review-rejections", "reflect", "write-agent", "write-prompt", "module-map"];
47187
-
47188
- // ../cli/src/lib/shared/studio-files.ts
47189
- var STUDIO_FILE = "STUDIO.md";
47190
- var MCP_FILE = "mcp.json";
47191
- var CARD_TEMPLATE_FILE = "CARD.md";
47192
- var VERSION_FILE = "version.json";
47193
- var KB = 1024;
47194
- var FILE_LIMITS = { file: 2 * KB * KB, total: 2 * KB * KB, count: 500, path: 512 };
47195
- var officialId = (folder2) => `wf_builtin_${folder2.replace(/-/g, "_")}`;
47196
- var hashInput = (files) => JSON.stringify(Object.entries(files).sort(([a], [b]) => a < b ? -1 : 1));
47197
- var landsOf = (_def) => ({ lands: true });
47198
- var SEGMENT = /^[\w.-]+$/;
47199
- var isAboutFile = (file2) => /^ABOUT(\.[a-z]{2})?\.md$/.test(file2) || /^screenshots\/[\w.-]+\.(png|jpe?g|webp)$/.test(file2);
47200
- var bytes = (text2) => new TextEncoder().encode(text2).length;
47201
- var isSharedFile = (file2) => {
47202
- const parts = file2.split("/");
47203
- return parts.length > 1 && parts[0] === "shared" && parts.slice(1).every((p) => SEGMENT.test(p) && p !== "." && p !== "..");
47204
- };
47205
- function folderPath(file2, top) {
47206
- const parts = file2.split("/");
47207
- if (parts.length < 3 || parts[0] !== top || !/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(parts[1])) return null;
47208
- if (parts.slice(2).some((p) => !SEGMENT.test(p) || p === "." || p === "..")) return null;
47209
- return [parts[1], parts.slice(2).join("/")];
47210
- }
47211
- function mcpProblem(text2) {
47212
- let read3;
47213
- try {
47214
- read3 = JSON.parse(text2);
47215
- } catch {
47216
- return "is not JSON";
47217
- }
47218
- const servers = read3?.mcpServers;
47219
- if (!servers || typeof servers !== "object" || Array.isArray(servers)) return "must hold `mcpServers`, an object of name \u2192 server";
47220
- for (const [name, server] of Object.entries(servers)) {
47221
- const { command, args: args2, ...rest } = server ?? {};
47222
- if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(name)) return `names a server \`${name}\`; use lowercase letters, digits and dashes`;
47223
- if (typeof command !== "string" || !command) return `server \`${name}\` needs a \`command\``;
47224
- if (args2 !== void 0 && !(Array.isArray(args2) && args2.every((a) => typeof a === "string"))) return `server \`${name}\`: \`args\` must be a list of strings`;
47225
- if (Object.keys(rest).length) return `server \`${name}\` takes only \`command\` and \`args\``;
47226
- }
47227
- return null;
47228
- }
47229
- function formatStudioProblem({ file: file2, line, column, reason, hint: hint2 }) {
47230
- const location = line === void 0 ? file2 : `${file2}:${line}:${column ?? 1}`;
47231
- return `${location}: ${reason}${hint2 ? `. ${hint2}` : ""}`;
47232
- }
47233
- function checkStudioFiles(value, official = false, checks = {}) {
47234
- const read3 = inspect(value, official, checks);
47235
- const first = read3.problems[0];
47236
- return first ? { ok: false, ...first, problems: read3.problems } : { ok: true, def: read3.def, files: read3.files };
47237
- }
47238
- function inspect(value, official, { allowLegacyPreviewCopy, allowLegacyLand } = {}) {
47239
- const problems = [];
47240
- const fail = (file2, reason, tooLarge = false) => {
47241
- problems.push({ file: file2, reason, ...tooLarge ? { tooLarge } : {} });
47242
- return { problems };
47243
- };
47244
- if (!value || typeof value !== "object" || Array.isArray(value)) return fail("files", "must be an object of path \u2192 text");
47245
- const files = Object.fromEntries(Object.entries(value).filter(([file2]) => file2 !== VERSION_FILE));
47246
- const entries = Object.entries(files);
47247
- if (entries.length > FILE_LIMITS.count) return fail("files", `holds at most ${FILE_LIMITS.count} files`, true);
47248
- let total = 0;
47249
- const skills = /* @__PURE__ */ new Set();
47250
- for (const [file2, text2] of entries) {
47251
- if (typeof text2 !== "string" || text2.includes("\0")) {
47252
- fail(file2, "is not a text file");
47253
- continue;
47254
- }
47255
- if (file2.length > FILE_LIMITS.path) {
47256
- fail(file2, `the path is longer than ${FILE_LIMITS.path} characters`);
47257
- continue;
47258
- }
47259
- const size = bytes(text2);
47260
- if (size > FILE_LIMITS.file) return fail(file2, `is larger than ${FILE_LIMITS.file / KB} KB`, true);
47261
- total += size;
47262
- if (total > FILE_LIMITS.total) return fail("files", `are larger than ${FILE_LIMITS.total / KB / KB} MB together`, true);
47263
- if (file2 === STUDIO_FILE || file2 === CARD_TEMPLATE_FILE) continue;
47264
- if (official && file2 === MCP_FILE) {
47265
- const problem = mcpProblem(text2);
47266
- if (problem) fail(file2, problem);
47267
- continue;
47268
- }
47269
- if (official && isAboutFile(file2)) continue;
47270
- if (official && file2.startsWith("skills/")) {
47271
- if (!folderPath(file2, "skills")) fail(file2, "is not inside skills/<name>/");
47272
- else skills.add(file2.split("/")[1]);
47273
- continue;
47274
- }
47275
- if (isSharedFile(file2)) continue;
47276
- if (/^(?:references|scripts)\//.test(file2) && file2.split("/").every((p) => SEGMENT.test(p) && p !== "." && p !== "..")) continue;
47277
- fail(file2, `use ${STUDIO_FILE}, ${CARD_TEMPLATE_FILE}, references/, scripts/ or shared/`);
47278
- }
47279
- for (const name of skills) {
47280
- if (files[`skills/${name}/SKILL.md`] === void 0) fail(`skills/${name}/SKILL.md`, "is missing");
47281
- }
47282
- const source = files[STUDIO_FILE];
47283
- const read3 = typeof source === "string" ? parseStudioFile("studio", source, STUDIO_FILE, { requirePreviewCopy: !official && !allowLegacyPreviewCopy, requireLand: !allowLegacyLand }) : null;
47284
- if (!read3) fail(STUDIO_FILE, "is missing");
47285
- else if ("problem" in read3) for (const problem of read3.problems) problems.push({ ...problem, reason: problem.message });
47286
- if (!read3 || "problem" in read3) return { problems };
47287
- const def = read3.def;
47288
- for (const [file2, text2] of Object.entries(files)) {
47289
- if (typeof text2 !== "string" || !file2.endsWith(".md")) continue;
47290
- const masked = withoutCode(text2);
47291
- const reference = (offset, link, message) => problems.push({ file: file2, ...sourcePosition(text2, offset), path: link, code: "studio-reference", message, reason: message, hint: "Use an existing safe relative resource or a shipped AKB Guide." });
47292
- for (const match of masked.matchAll(/!?\[[^\]]*\]\(([^\s)]+)(?:\s+[^)]*)?\)/g)) {
47293
- const link = match[1].replace(/^<|>$/g, "");
47294
- if (/^(?:https?:|mailto:|#)/i.test(link)) continue;
47295
- let decoded;
47296
- try {
47297
- decoded = decodeURIComponent(link.split(/[?#]/)[0]);
47298
- } catch {
47299
- reference(match.index, link, "Invalid resource URL");
47300
- continue;
47301
- }
47302
- if (/^(?:[a-z][\w+.-]*:|[/\\])|\\/i.test(decoded) || decoded.split("/").includes("..")) {
47303
- reference(match.index, link, "Unsafe resource path");
47304
- continue;
47305
- }
47306
- const target = [...file2.split("/").slice(0, -1), ...decoded.split("/").filter((p) => p !== ".")].join("/");
47307
- if (!Object.hasOwn(files, target)) reference(match.index, link, `Missing resource ${target}`);
47308
- }
47309
- for (const match of text2.matchAll(/akb guide ([a-z][a-z-]*)/g)) if (!GUIDE_TOPICS.includes(match[1])) reference(match.index, match[1], `Unknown AKB Guide ${match[1]}`);
47310
- }
47311
- return { problems, def, files };
47312
- }
47313
-
47314
- // ../cli/src/lib/agent/studio-folder.ts
47315
47388
  var MIME = { ".png": "image/png", ".jpg": "image/jpeg", ".jpeg": "image/jpeg", ".webp": "image/webp" };
47316
47389
  function filesOf(dir, base = dir) {
47317
- return fs14.readdirSync(dir, { withFileTypes: true }).filter((e) => !e.name.startsWith(".")).flatMap((e) => {
47390
+ return fs14.readdirSync(dir, { withFileTypes: true }).filter((e) => e.name.toLowerCase() !== ".git" && (dir !== base || e.name !== PUBLICATION_FILE)).flatMap((e) => {
47318
47391
  const full = path18.join(dir, e.name);
47319
- if (e.isSymbolicLink()) throw new Error(`${full}: symbolic links are not allowed`);
47392
+ if (!e.isFile() && !e.isDirectory()) throw new Error(full + ": only regular files and directories are allowed");
47320
47393
  return e.isDirectory() ? filesOf(full, base) : [path18.relative(base, full).split(path18.sep).join("/")];
47321
47394
  });
47322
47395
  }
47323
47396
  function readStudioFile(dir, file2) {
47324
47397
  const full = path18.join(dir, file2);
47325
- return isAboutFile(file2) && !file2.endsWith(".md") ? `data:${MIME[path18.extname(file2)]};base64,${fs14.readFileSync(full).toString("base64")}` : fs14.readFileSync(full, "utf8");
47398
+ const bytes = fs14.readFileSync(full);
47399
+ if (isAboutFile(file2) && !file2.endsWith(".md")) return "data:" + MIME[path18.extname(file2)] + ";base64," + bytes.toString("base64");
47400
+ try {
47401
+ return new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(bytes);
47402
+ } catch {
47403
+ throw new Error(file2 + ": expected a UTF-8 text file");
47404
+ }
47405
+ }
47406
+ function readStudioFolder(dir) {
47407
+ const files = filesOf(dir).sort();
47408
+ if (files.filter((file2) => file2 !== VERSION_FILE).length > FILE_LIMITS.count) throw new Error("Studio file count limit exceeded");
47409
+ let total = 0;
47410
+ return Object.fromEntries(files.map((file2) => {
47411
+ const size = fs14.statSync(path18.join(dir, file2)).size;
47412
+ if (file2 !== VERSION_FILE) total += size;
47413
+ const problem = studioSizeProblem(file2, size, total);
47414
+ if (problem) throw new Error(problem.file + ": " + problem.reason);
47415
+ return [file2, readStudioFile(dir, file2)];
47416
+ }));
47326
47417
  }
47327
- var readStudioFolder = (dir) => Object.fromEntries(filesOf(dir).sort().map((f) => [f, readStudioFile(dir, f)]));
47328
47418
 
47329
47419
  // ../official/pack.ts
47330
47420
  var OFFICIAL = path19.dirname(fileURLToPath(import.meta.url));
47331
47421
  var dirs = (dir) => fs15.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name).sort();
47332
- var hashOf = (files) => crypto2.createHash("sha256").update(hashInput(files)).digest("hex");
47422
+ var hashOf = (files) => crypto3.createHash("sha256").update(hashInput(files)).digest("hex");
47333
47423
  function packOfficial(root2 = OFFICIAL, loose = false) {
47334
47424
  const studiosDir = path19.join(root2, "studios");
47335
47425
  return dirs(studiosDir).map((folder2) => {
@@ -47382,6 +47472,7 @@ function linkedProject(board, root2) {
47382
47472
  }
47383
47473
 
47384
47474
  // ../cli/src/lib/agent/cloud-studios.ts
47475
+ var STUDIO_SNAPSHOT_ENV = "AI4KANBAN_STUDIO_SNAPSHOT";
47385
47476
  var DEV = "AI4KANBAN_STUDIOS";
47386
47477
  var root = () => path21.join(machineHome(), "studios");
47387
47478
  var safe = (name) => name.replace(/[^\w.@-]/g, "_");
@@ -47395,10 +47486,26 @@ function readJson(file2) {
47395
47486
  return null;
47396
47487
  }
47397
47488
  }
47398
- var readVersion = (id, version) => readJson(versionFile(id, version));
47489
+ var filesHash = (files) => createHash5("sha256").update(hashInput(files)).digest("hex");
47490
+ var readVersion = (id, version) => {
47491
+ const held2 = readJson(versionFile(id, version));
47492
+ return held2?.id === id && held2.version === version && isStudioFiles(held2.files) && (!held2.filesSha256 || filesHash(held2.files) === held2.filesSha256) ? held2 : null;
47493
+ };
47399
47494
  var readPin = (task) => readJson(pinFile(task));
47400
47495
  var boardProject = () => KANBAN ? runnerProject(KANBAN) : null;
47401
47496
  var devFolder = () => process.env[DEV]?.trim() || "";
47497
+ var isStudioVersion = (value) => typeof value === "number" && Number.isSafeInteger(value) && value > 0;
47498
+ function isStudioFiles(value) {
47499
+ return isRecord(value) && hasText(value["STUDIO.md"]) && Object.entries(value).every(([file2, text2]) => typeof text2 === "string" && safeStudioPath(file2));
47500
+ }
47501
+ function executionSnapshot() {
47502
+ try {
47503
+ const value = JSON.parse(process.env[STUDIO_SNAPSHOT_ENV] ?? "null");
47504
+ if (hasText(value?.studio) && isStudioVersion(value.version)) return value;
47505
+ } catch {
47506
+ }
47507
+ }
47508
+ var activeStudioPin = (task) => executionSnapshot() ?? readPin(task);
47402
47509
  var flowOf = (held2) => {
47403
47510
  const id = studioName(held2.id);
47404
47511
  const read3 = parseStudioFile(id, held2.files["STUDIO.md"] ?? "", `the \`${id}\` studio`);
@@ -47418,17 +47525,23 @@ function readFlows() {
47418
47525
  return held2 ? flowOf(held2) ?? [] : [];
47419
47526
  });
47420
47527
  const task = workspaceTask();
47421
- const pin = task ? readPin(task) : null;
47528
+ const pin = task ? activeStudioPin(task) : null;
47422
47529
  const pinned = pin && readVersion(pin.studio, pin.version);
47423
47530
  const mine = pinned && flowOf(pinned);
47424
- if (!mine) return flows2;
47531
+ if (!mine) return pin ? flows2.filter((flow) => flow.cloudId !== pin.studio) : flows2;
47425
47532
  return [mine, ...flows2.filter((f) => f.cloudId !== mine.cloudId)];
47426
47533
  }
47427
47534
  var sources = () => {
47428
47535
  if (devFolder()) return [devFolder()];
47429
47536
  const project = boardProject();
47430
47537
  const task = workspaceTask();
47431
- return [sessionFile(), ...project ? [listFile(project)] : [], ...task ? [pinFile(task)] : []];
47538
+ const pin = task && activeStudioPin(task);
47539
+ return [
47540
+ sessionFile(),
47541
+ ...project ? [listFile(project)] : [],
47542
+ ...task ? [pinFile(task)] : [],
47543
+ ...pin ? [versionFile(pin.studio, pin.version)] : []
47544
+ ];
47432
47545
  };
47433
47546
  var flows = memoByFiles(sources, readFlows);
47434
47547
 
@@ -47476,7 +47589,7 @@ function conflictRecords(board) {
47476
47589
  var pendingConflicts = (board) => conflictRecords(board).filter((r) => r.state !== "resolved");
47477
47590
 
47478
47591
  // src/cache.ts
47479
- import crypto3 from "node:crypto";
47592
+ import crypto4 from "node:crypto";
47480
47593
  import fs20 from "node:fs";
47481
47594
  import path24 from "node:path";
47482
47595
 
@@ -47598,7 +47711,7 @@ var unsentFile = (dir) => path24.join(akbDir(dir), "unsent");
47598
47711
  var unsent = (dir) => fs20.existsSync(unsentFile(dir));
47599
47712
  var holds = /* @__PURE__ */ new Map();
47600
47713
  var holdsDir = () => path24.join(runnerHome(), "holds");
47601
- var holdFile = (dir) => path24.join(holdsDir(), `${crypto3.createHash("sha256").update(dir).digest("hex")}.${process.pid}`);
47714
+ var holdFile = (dir) => path24.join(holdsDir(), `${crypto4.createHash("sha256").update(dir).digest("hex")}.${process.pid}`);
47602
47715
  function paused(dir) {
47603
47716
  try {
47604
47717
  const file2 = path24.join(projectStateDir(path24.join(akbDir(dir), "kanban")), SESSIONS_FILE);
@@ -48012,12 +48125,12 @@ exec ${shellLine} "$@"
48012
48125
  var KEEP = 256 * 1024;
48013
48126
 
48014
48127
  // src/lock.ts
48015
- import crypto4 from "node:crypto";
48128
+ import crypto5 from "node:crypto";
48016
48129
  import net from "node:net";
48017
48130
  import path28 from "node:path";
48018
48131
  function lockPath() {
48019
48132
  const home3 = runnerHome();
48020
- if (process.platform === "win32") return `\\\\.\\pipe\\wildcrane-${crypto4.createHash("sha256").update(home3).digest("hex").slice(0, 16)}`;
48133
+ if (process.platform === "win32") return `\\\\.\\pipe\\wildcrane-${crypto5.createHash("sha256").update(home3).digest("hex").slice(0, 16)}`;
48021
48134
  return path28.join(home3, "runner.sock");
48022
48135
  }
48023
48136
  function runnerSettingsSupport() {
@@ -48048,7 +48161,7 @@ function runnerSettingsSupport() {
48048
48161
 
48049
48162
  // src/signin.ts
48050
48163
  import { spawn as spawn3 } from "node:child_process";
48051
- import crypto5 from "node:crypto";
48164
+ import crypto6 from "node:crypto";
48052
48165
  import http from "node:http";
48053
48166
 
48054
48167
  // src/settings-control.ts
@@ -48256,8 +48369,8 @@ var PAGE = (outcome, lang, links) => {
48256
48369
  };
48257
48370
  async function signIn(options = {}) {
48258
48371
  const generation = accountGeneration();
48259
- const verifier = base64url(crypto5.randomBytes(32));
48260
- const challenge = base64url(crypto5.createHash("sha256").update(verifier).digest());
48372
+ const verifier = base64url(crypto6.randomBytes(32));
48373
+ const challenge = base64url(crypto6.createHash("sha256").update(verifier).digest());
48261
48374
  let finish = () => {
48262
48375
  };
48263
48376
  const answered = new Promise((resolve2) => finish = resolve2);
@@ -48389,10 +48502,10 @@ function openBrowser(url) {
48389
48502
  } catch {
48390
48503
  }
48391
48504
  }
48392
- var base64url = (bytes2) => bytes2.toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
48505
+ var base64url = (bytes) => bytes.toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
48393
48506
 
48394
48507
  // src/preferences.ts
48395
- import crypto6 from "node:crypto";
48508
+ import crypto7 from "node:crypto";
48396
48509
  import fs26 from "node:fs";
48397
48510
  import path31 from "node:path";
48398
48511
  var file = () => path31.join(runnerHome(), "preferences.json");
@@ -48406,7 +48519,7 @@ function read2() {
48406
48519
  }
48407
48520
  var acceptAlphaUpdates = () => read2().acceptAlphaUpdates === true;
48408
48521
  function saveAlphaUpdates(value) {
48409
- const target = file(), temporary = `${target}.${crypto6.randomUUID()}.tmp`;
48522
+ const target = file(), temporary = `${target}.${crypto7.randomUUID()}.tmp`;
48410
48523
  fs26.mkdirSync(runnerHome(), { recursive: true, mode: 448 });
48411
48524
  try {
48412
48525
  fs26.writeFileSync(temporary, JSON.stringify({ ...read2(), acceptAlphaUpdates: value }) + "\n", { mode: 384 });
@@ -48452,7 +48565,7 @@ var callback = () => {
48452
48565
  };
48453
48566
  var notify = () => {
48454
48567
  fs27.mkdirSync(runnerHome(), { recursive: true, mode: 448 });
48455
- fs27.writeFileSync(path32.join(runnerHome(), "settings-refresh"), crypto7.randomUUID(), { mode: 384 });
48568
+ fs27.writeFileSync(path32.join(runnerHome(), "settings-refresh"), crypto8.randomUUID(), { mode: 384 });
48456
48569
  callback();
48457
48570
  };
48458
48571
  function startSignIn() {
@@ -48658,7 +48771,7 @@ async function settingsAction(action, body, context) {
48658
48771
  if ("error" in found) return found;
48659
48772
  if (found.folder) return { error: "folder_taken" };
48660
48773
  if (choice.subject !== readSession()?.subject) return { error: "signed_out" };
48661
- if (!choice.creation || choice.creation.name !== name || choice.creation.workspace !== body.workspace) choice.creation = { key: crypto7.randomUUID(), name, workspace: body.workspace };
48774
+ if (!choice.creation || choice.creation.name !== name || choice.creation.workspace !== body.workspace) choice.creation = { key: crypto8.randomUUID(), name, workspace: body.workspace };
48662
48775
  const created = choice.creation.project ? { ok: true, value: { id: choice.creation.project } } : await createProject(name, body.workspace, choice.creation.key);
48663
48776
  if (!created.ok) return failure(created);
48664
48777
  project = created.value.id;
@@ -48675,7 +48788,7 @@ async function settingsAction(action, body, context) {
48675
48788
 
48676
48789
  // src/settings-server.ts
48677
48790
  import { spawn as spawn5 } from "node:child_process";
48678
- import crypto8 from "node:crypto";
48791
+ import crypto9 from "node:crypto";
48679
48792
  import fs29 from "node:fs";
48680
48793
  import http2 from "node:http";
48681
48794
  import path35 from "node:path";
@@ -48738,7 +48851,7 @@ var settings_client_default = '"use strict";(()=>{var Q6=Object.create;var Gf=Ob
48738
48851
  var recordFile = () => path35.join(runnerHome(), "settings-page.json");
48739
48852
  var sessionsFile = () => path35.join(runnerHome(), "settings-sessions.json");
48740
48853
  var sleep2 = (ms) => new Promise((r) => setTimeout(r, ms));
48741
- var random = () => crypto8.randomBytes(32).toString("hex");
48854
+ var random = () => crypto9.randomBytes(32).toString("hex");
48742
48855
  var PAGE_VERSION = process.env.WILDCRANE_SETTINGS_VERSION ?? VERSION;
48743
48856
  var own = null;
48744
48857
  var helper = null;