wildcrane-runner 0.6.32 → 0.6.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/runner.mjs CHANGED
@@ -1,4 +1,4 @@
1
- // wildcrane-runner 0.6.32 — built by runner/scripts/build.mjs. Do not edit.
1
+ // wildcrane-runner 0.6.33 — 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;
@@ -1158,14 +1158,14 @@ var require_util = __commonJS({
1158
1158
  }
1159
1159
  const port = url.port != null ? url.port : url.protocol === "https:" ? 443 : 80;
1160
1160
  let origin = url.origin != null ? url.origin : `${url.protocol || ""}//${url.hostname || ""}:${port}`;
1161
- let path49 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
1161
+ let path50 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
1162
1162
  if (origin[origin.length - 1] === "/") {
1163
1163
  origin = origin.slice(0, origin.length - 1);
1164
1164
  }
1165
- if (path49 && path49[0] !== "/") {
1166
- path49 = `/${path49}`;
1165
+ if (path50 && path50[0] !== "/") {
1166
+ path50 = `/${path50}`;
1167
1167
  }
1168
- return new URL(`${origin}${path49}`);
1168
+ return new URL(`${origin}${path50}`);
1169
1169
  }
1170
1170
  if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) {
1171
1171
  throw new InvalidArgumentError("Invalid URL protocol: the URL must start with `http:` or `https:`.");
@@ -2000,9 +2000,9 @@ var require_diagnostics = __commonJS({
2000
2000
  "undici:client:sendHeaders",
2001
2001
  (evt) => {
2002
2002
  const {
2003
- request: { method, path: path49, origin }
2003
+ request: { method, path: path50, origin }
2004
2004
  } = evt;
2005
- debugLog("sending request to %s %s%s", method, origin, path49);
2005
+ debugLog("sending request to %s %s%s", method, origin, path50);
2006
2006
  }
2007
2007
  );
2008
2008
  }
@@ -2020,14 +2020,14 @@ var require_diagnostics = __commonJS({
2020
2020
  "undici:request:headers",
2021
2021
  (evt) => {
2022
2022
  const {
2023
- request: { method, path: path49, origin },
2023
+ request: { method, path: path50, origin },
2024
2024
  response: { statusCode }
2025
2025
  } = evt;
2026
2026
  debugLog(
2027
2027
  "received response to %s %s%s - HTTP %d",
2028
2028
  method,
2029
2029
  origin,
2030
- path49,
2030
+ path50,
2031
2031
  statusCode
2032
2032
  );
2033
2033
  }
@@ -2036,23 +2036,23 @@ var require_diagnostics = __commonJS({
2036
2036
  "undici:request:trailers",
2037
2037
  (evt) => {
2038
2038
  const {
2039
- request: { method, path: path49, origin }
2039
+ request: { method, path: path50, origin }
2040
2040
  } = evt;
2041
- debugLog("trailers received from %s %s%s", method, origin, path49);
2041
+ debugLog("trailers received from %s %s%s", method, origin, path50);
2042
2042
  }
2043
2043
  );
2044
2044
  diagnosticsChannel.subscribe(
2045
2045
  "undici:request:error",
2046
2046
  (evt) => {
2047
2047
  const {
2048
- request: { method, path: path49, origin },
2048
+ request: { method, path: path50, origin },
2049
2049
  error
2050
2050
  } = evt;
2051
2051
  debugLog(
2052
2052
  "request to %s %s%s errored - %s",
2053
2053
  method,
2054
2054
  origin,
2055
- path49,
2055
+ path50,
2056
2056
  error.message
2057
2057
  );
2058
2058
  }
@@ -2167,7 +2167,7 @@ var require_request = __commonJS({
2167
2167
  var kHandler = /* @__PURE__ */ Symbol("handler");
2168
2168
  var Request = class {
2169
2169
  constructor(origin, {
2170
- path: path49,
2170
+ path: path50,
2171
2171
  method,
2172
2172
  body,
2173
2173
  headers,
@@ -2184,11 +2184,11 @@ var require_request = __commonJS({
2184
2184
  maxRedirections,
2185
2185
  typeOfService
2186
2186
  }, handler) {
2187
- if (typeof path49 !== "string") {
2187
+ if (typeof path50 !== "string") {
2188
2188
  throw new InvalidArgumentError("path must be a string");
2189
- } else if (path49[0] !== "/" && !(path49.startsWith("http://") || path49.startsWith("https://")) && method !== "CONNECT") {
2189
+ } else if (path50[0] !== "/" && !(path50.startsWith("http://") || path50.startsWith("https://")) && method !== "CONNECT") {
2190
2190
  throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
2191
- } else if (invalidPathRegex.test(path49)) {
2191
+ } else if (invalidPathRegex.test(path50)) {
2192
2192
  throw new InvalidArgumentError("invalid request path");
2193
2193
  }
2194
2194
  if (typeof method !== "string") {
@@ -2263,7 +2263,7 @@ var require_request = __commonJS({
2263
2263
  this.completed = false;
2264
2264
  this.aborted = false;
2265
2265
  this.upgrade = upgrade || null;
2266
- this.path = query ? serializePathWithQuery(path49, query) : path49;
2266
+ this.path = query ? serializePathWithQuery(path50, query) : path50;
2267
2267
  this.origin = origin;
2268
2268
  this.protocol = getProtocolFromUrlString(origin);
2269
2269
  this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
@@ -7507,7 +7507,7 @@ var require_client_h1 = __commonJS({
7507
7507
  }
7508
7508
  }
7509
7509
  function writeH1(client, request2) {
7510
- const { method, path: path49, host, upgrade, blocking, reset } = request2;
7510
+ const { method, path: path50, host, upgrade, blocking, reset } = request2;
7511
7511
  let { body, headers, contentLength } = request2;
7512
7512
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
7513
7513
  if (util.isFormDataLike(body)) {
@@ -7583,7 +7583,7 @@ var require_client_h1 = __commonJS({
7583
7583
  socket[kBlocking] = true;
7584
7584
  }
7585
7585
  setTypeOfService(socket, request2);
7586
- let header = `${method} ${path49} HTTP/1.1\r
7586
+ let header = `${method} ${path50} HTTP/1.1\r
7587
7587
  `;
7588
7588
  if (typeof host === "string") {
7589
7589
  header += `host: ${host}\r
@@ -8260,7 +8260,7 @@ var require_client_h2 = __commonJS({
8260
8260
  const headersTimeout = request2.headersTimeout ?? client[kHeadersTimeout];
8261
8261
  const bodyTimeout = request2.bodyTimeout ?? client[kBodyTimeout];
8262
8262
  const session = client[kHTTP2Session];
8263
- const { method, path: path49, host, upgrade, expectContinue, signal: signal2, protocol, headers: reqHeaders } = request2;
8263
+ const { method, path: path50, host, upgrade, expectContinue, signal: signal2, protocol, headers: reqHeaders } = request2;
8264
8264
  let { body } = request2;
8265
8265
  if (upgrade != null && upgrade !== "websocket") {
8266
8266
  util.errorRequest(client, request2, new InvalidArgumentError(`Custom upgrade "${upgrade}" not supported over HTTP/2`));
@@ -8329,7 +8329,7 @@ var require_client_h2 = __commonJS({
8329
8329
  }
8330
8330
  headers[HTTP2_HEADER_METHOD] = "CONNECT";
8331
8331
  headers[HTTP2_HEADER_PROTOCOL] = "websocket";
8332
- headers[HTTP2_HEADER_PATH] = path49;
8332
+ headers[HTTP2_HEADER_PATH] = path50;
8333
8333
  if (protocol === "ws:" || protocol === "wss:") {
8334
8334
  headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
8335
8335
  } else {
@@ -8381,7 +8381,7 @@ var require_client_h2 = __commonJS({
8381
8381
  stream.setTimeout(headersTimeout);
8382
8382
  return true;
8383
8383
  }
8384
- headers[HTTP2_HEADER_PATH] = path49;
8384
+ headers[HTTP2_HEADER_PATH] = path50;
8385
8385
  headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
8386
8386
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
8387
8387
  if (body && typeof body.read === "function") {
@@ -10737,10 +10737,10 @@ var require_proxy_agent = __commonJS({
10737
10737
  };
10738
10738
  const {
10739
10739
  origin,
10740
- path: path49 = "/",
10740
+ path: path50 = "/",
10741
10741
  headers = {}
10742
10742
  } = opts;
10743
- opts.path = origin + path49;
10743
+ opts.path = origin + path50;
10744
10744
  if (!("host" in headers) && !("Host" in headers)) {
10745
10745
  const { host } = new URL(origin);
10746
10746
  headers.host = host;
@@ -12900,20 +12900,20 @@ var require_mock_utils = __commonJS({
12900
12900
  }
12901
12901
  return normalizedQp;
12902
12902
  }
12903
- function safeUrl(path49) {
12904
- if (typeof path49 !== "string") {
12905
- return path49;
12903
+ function safeUrl(path50) {
12904
+ if (typeof path50 !== "string") {
12905
+ return path50;
12906
12906
  }
12907
- const pathSegments = path49.split("?", 3);
12907
+ const pathSegments = path50.split("?", 3);
12908
12908
  if (pathSegments.length !== 2) {
12909
- return path49;
12909
+ return path50;
12910
12910
  }
12911
12911
  const qp = new URLSearchParams(pathSegments.pop());
12912
12912
  qp.sort();
12913
12913
  return [...pathSegments, qp.toString()].join("?");
12914
12914
  }
12915
- function matchKey(mockDispatch2, { path: path49, method, body, headers }) {
12916
- const pathMatch = matchValue(mockDispatch2.path, path49);
12915
+ function matchKey(mockDispatch2, { path: path50, method, body, headers }) {
12916
+ const pathMatch = matchValue(mockDispatch2.path, path50);
12917
12917
  const methodMatch = matchValue(mockDispatch2.method, method);
12918
12918
  const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
12919
12919
  const headersMatch = matchHeaders(mockDispatch2, headers);
@@ -12938,8 +12938,8 @@ var require_mock_utils = __commonJS({
12938
12938
  const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
12939
12939
  const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
12940
12940
  const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
12941
- let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path49, ignoreTrailingSlash }) => {
12942
- return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path49)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path49), resolvedPath);
12941
+ let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path50, ignoreTrailingSlash }) => {
12942
+ return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path50)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path50), resolvedPath);
12943
12943
  });
12944
12944
  if (matchedMockDispatches.length === 0) {
12945
12945
  throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
@@ -12978,19 +12978,19 @@ var require_mock_utils = __commonJS({
12978
12978
  mockDispatches.splice(index, 1);
12979
12979
  }
12980
12980
  }
12981
- function removeTrailingSlash(path49) {
12982
- while (path49.endsWith("/")) {
12983
- path49 = path49.slice(0, -1);
12981
+ function removeTrailingSlash(path50) {
12982
+ while (path50.endsWith("/")) {
12983
+ path50 = path50.slice(0, -1);
12984
12984
  }
12985
- if (path49.length === 0) {
12986
- path49 = "/";
12985
+ if (path50.length === 0) {
12986
+ path50 = "/";
12987
12987
  }
12988
- return path49;
12988
+ return path50;
12989
12989
  }
12990
12990
  function buildKey(opts) {
12991
- const { path: path49, method, body, headers, query } = opts;
12991
+ const { path: path50, method, body, headers, query } = opts;
12992
12992
  return {
12993
- path: path49,
12993
+ path: path50,
12994
12994
  method,
12995
12995
  body,
12996
12996
  headers,
@@ -13680,10 +13680,10 @@ var require_pending_interceptors_formatter = __commonJS({
13680
13680
  }
13681
13681
  format(pendingInterceptors) {
13682
13682
  const withPrettyHeaders = pendingInterceptors.map(
13683
- ({ method, path: path49, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
13683
+ ({ method, path: path50, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
13684
13684
  Method: method,
13685
13685
  Origin: origin,
13686
- Path: path49,
13686
+ Path: path50,
13687
13687
  "Status code": statusCode,
13688
13688
  Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
13689
13689
  Invocations: timesInvoked,
@@ -13765,9 +13765,9 @@ var require_mock_agent = __commonJS({
13765
13765
  const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
13766
13766
  const dispatchOpts = { ...opts };
13767
13767
  if (acceptNonStandardSearchParameters && dispatchOpts.path) {
13768
- const [path49, searchParams] = dispatchOpts.path.split("?");
13768
+ const [path50, searchParams] = dispatchOpts.path.split("?");
13769
13769
  const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
13770
- dispatchOpts.path = `${path49}?${normalizedSearchParams}`;
13770
+ dispatchOpts.path = `${path50}?${normalizedSearchParams}`;
13771
13771
  }
13772
13772
  return this[kAgent].dispatch(dispatchOpts, handler);
13773
13773
  }
@@ -14168,12 +14168,12 @@ var require_snapshot_recorder = __commonJS({
14168
14168
  * @return {Promise<void>} - Resolves when snapshots are loaded
14169
14169
  */
14170
14170
  async loadSnapshots(filePath) {
14171
- const path49 = filePath || this.#snapshotPath;
14172
- if (!path49) {
14171
+ const path50 = filePath || this.#snapshotPath;
14172
+ if (!path50) {
14173
14173
  throw new InvalidArgumentError("Snapshot path is required");
14174
14174
  }
14175
14175
  try {
14176
- const data = await readFile(resolve2(path49), "utf8");
14176
+ const data = await readFile(resolve2(path50), "utf8");
14177
14177
  const parsed = JSON.parse(data);
14178
14178
  if (Array.isArray(parsed)) {
14179
14179
  this.#snapshots.clear();
@@ -14187,7 +14187,7 @@ var require_snapshot_recorder = __commonJS({
14187
14187
  if (error.code === "ENOENT") {
14188
14188
  this.#snapshots.clear();
14189
14189
  } else {
14190
- throw new UndiciError(`Failed to load snapshots from ${path49}`, { cause: error });
14190
+ throw new UndiciError(`Failed to load snapshots from ${path50}`, { cause: error });
14191
14191
  }
14192
14192
  }
14193
14193
  }
@@ -14198,11 +14198,11 @@ var require_snapshot_recorder = __commonJS({
14198
14198
  * @returns {Promise<void>} - Resolves when snapshots are saved
14199
14199
  */
14200
14200
  async saveSnapshots(filePath) {
14201
- const path49 = filePath || this.#snapshotPath;
14202
- if (!path49) {
14201
+ const path50 = filePath || this.#snapshotPath;
14202
+ if (!path50) {
14203
14203
  throw new InvalidArgumentError("Snapshot path is required");
14204
14204
  }
14205
- const resolvedPath = resolve2(path49);
14205
+ const resolvedPath = resolve2(path50);
14206
14206
  await mkdir(dirname(resolvedPath), { recursive: true });
14207
14207
  const data = Array.from(this.#snapshots.entries()).map(([hash, snapshot]) => ({
14208
14208
  hash,
@@ -14843,15 +14843,15 @@ var require_redirect_handler = __commonJS({
14843
14843
  receivedAt: Date.now()
14844
14844
  });
14845
14845
  const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
14846
- const path49 = search ? `${pathname}${search}` : pathname;
14847
- const redirectUrlString = `${origin}${path49}`;
14846
+ const path50 = search ? `${pathname}${search}` : pathname;
14847
+ const redirectUrlString = `${origin}${path50}`;
14848
14848
  for (const historyUrl of this.history) {
14849
14849
  if (historyUrl.toString() === redirectUrlString) {
14850
14850
  throw new InvalidArgumentError(`Redirect loop detected. Cannot redirect to ${origin}. This typically happens when using a Client or Pool with cross-origin redirects. Use an Agent for cross-origin redirects.`);
14851
14851
  }
14852
14852
  }
14853
14853
  this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
14854
- this.opts.path = path49;
14854
+ this.opts.path = path50;
14855
14855
  this.opts.origin = origin;
14856
14856
  this.opts.query = null;
14857
14857
  }
@@ -16668,10 +16668,10 @@ var require_cache_handler = __commonJS({
16668
16668
  }
16669
16669
  return locationUrl.pathname + locationUrl.search;
16670
16670
  }
16671
- function deleteCachedUri(store, cacheKey, path49) {
16671
+ function deleteCachedUri(store, cacheKey, path50) {
16672
16672
  deleteCachedValue(store, {
16673
16673
  ...cacheKey,
16674
- path: path49
16674
+ path: path50
16675
16675
  });
16676
16676
  for (let i = 0; i < util.safeHTTPMethods.length; i++) {
16677
16677
  const method = util.safeHTTPMethods[i];
@@ -16679,7 +16679,7 @@ var require_cache_handler = __commonJS({
16679
16679
  deleteCachedValue(store, {
16680
16680
  ...cacheKey,
16681
16681
  method,
16682
- path: path49
16682
+ path: path50
16683
16683
  });
16684
16684
  }
16685
16685
  }
@@ -16690,9 +16690,9 @@ var require_cache_handler = __commonJS({
16690
16690
  }
16691
16691
  const values = Array.isArray(headerValue) ? headerValue : [headerValue];
16692
16692
  for (let i = 0; i < values.length; i++) {
16693
- const path49 = getSameOriginPath(cacheKey, values[i]);
16694
- if (path49 !== void 0) {
16695
- deleteCachedUri(store, cacheKey, path49);
16693
+ const path50 = getSameOriginPath(cacheKey, values[i]);
16694
+ if (path50 !== void 0) {
16695
+ deleteCachedUri(store, cacheKey, path50);
16696
16696
  }
16697
16697
  }
16698
16698
  }
@@ -22180,11 +22180,11 @@ var require_fetch = __commonJS({
22180
22180
  function dispatch({ body }) {
22181
22181
  const url = requestCurrentURL(request2);
22182
22182
  const agent = fetchParams.controller.dispatcher;
22183
- const path49 = url.pathname + url.search;
22183
+ const path50 = url.pathname + url.search;
22184
22184
  const hasTrailingQuestionMark = url.search.length === 0 && url.href[url.href.length - url.hash.length - 1] === "?";
22185
22185
  return new Promise((resolve2, reject) => agent.dispatch(
22186
22186
  {
22187
- path: hasTrailingQuestionMark ? `${path49}?` : path49,
22187
+ path: hasTrailingQuestionMark ? `${path50}?` : path50,
22188
22188
  origin: url.origin,
22189
22189
  method: request2.method,
22190
22190
  body: agent.isMockActive ? request2.body && (request2.body.source || request2.body.stream) : body,
@@ -23131,9 +23131,9 @@ var require_util4 = __commonJS({
23131
23131
  }
23132
23132
  }
23133
23133
  }
23134
- function validateCookiePath(path49) {
23135
- for (let i = 0; i < path49.length; ++i) {
23136
- const code = path49.charCodeAt(i);
23134
+ function validateCookiePath(path50) {
23135
+ for (let i = 0; i < path50.length; ++i) {
23136
+ const code = path50.charCodeAt(i);
23137
23137
  if (code < 32 || // exclude CTLs (0-31)
23138
23138
  code > 126 || // exclude DEL and non-ascii
23139
23139
  code === 59) {
@@ -26569,11 +26569,11 @@ var require_undici = __commonJS({
26569
26569
  if (typeof opts.path !== "string") {
26570
26570
  throw new InvalidArgumentError("invalid opts.path");
26571
26571
  }
26572
- let path49 = opts.path;
26572
+ let path50 = opts.path;
26573
26573
  if (!opts.path.startsWith("/")) {
26574
- path49 = `/${path49}`;
26574
+ path50 = `/${path50}`;
26575
26575
  }
26576
- url = new URL(util.parseOrigin(url).origin + path49);
26576
+ url = new URL(util.parseOrigin(url).origin + path50);
26577
26577
  } else {
26578
26578
  if (!opts) {
26579
26579
  opts = typeof url === "object" ? url : {};
@@ -67889,8 +67889,8 @@ var require_JSXTransformer = __commonJS({
67889
67889
  }
67890
67890
  if (this.isAutomaticRuntime) {
67891
67891
  if (this.importProcessor) {
67892
- for (const [path49, resolvedName] of Object.entries(this.cjsAutomaticModuleNameResolutions)) {
67893
- prefix += `var ${resolvedName} = require("${path49}");`;
67892
+ for (const [path50, resolvedName] of Object.entries(this.cjsAutomaticModuleNameResolutions)) {
67893
+ prefix += `var ${resolvedName} = require("${path50}");`;
67894
67894
  }
67895
67895
  } else {
67896
67896
  const { createElement: createElementResolution, ...otherResolutions } = this.esmAutomaticImportNameResolutions;
@@ -68083,11 +68083,11 @@ var require_JSXTransformer = __commonJS({
68083
68083
  }
68084
68084
  claimAutoImportedName(funcName, importPathSuffix) {
68085
68085
  if (this.importProcessor) {
68086
- const path49 = this.jsxImportSource + importPathSuffix;
68087
- if (!this.cjsAutomaticModuleNameResolutions[path49]) {
68088
- this.cjsAutomaticModuleNameResolutions[path49] = this.importProcessor.getFreeIdentifierForPath(path49);
68086
+ const path50 = this.jsxImportSource + importPathSuffix;
68087
+ if (!this.cjsAutomaticModuleNameResolutions[path50]) {
68088
+ this.cjsAutomaticModuleNameResolutions[path50] = this.importProcessor.getFreeIdentifierForPath(path50);
68089
68089
  }
68090
- return `${this.cjsAutomaticModuleNameResolutions[path49]}.${funcName}`;
68090
+ return `${this.cjsAutomaticModuleNameResolutions[path50]}.${funcName}`;
68091
68091
  } else {
68092
68092
  if (!this.esmAutomaticImportNameResolutions[funcName]) {
68093
68093
  this.esmAutomaticImportNameResolutions[funcName] = this.nameManager.claimFreeName(
@@ -68523,7 +68523,7 @@ var require_CJSImportProcessor = __commonJS({
68523
68523
  */
68524
68524
  pruneTypeOnlyImports() {
68525
68525
  this.nonTypeIdentifiers = _getNonTypeIdentifiers.getNonTypeIdentifiers.call(void 0, this.tokens, this.options);
68526
- for (const [path49, importInfo] of this.importInfoByPath.entries()) {
68526
+ for (const [path50, importInfo] of this.importInfoByPath.entries()) {
68527
68527
  if (importInfo.hasBareImport || importInfo.hasStarExport || importInfo.exportStarNames.length > 0 || importInfo.namedExports.length > 0) {
68528
68528
  continue;
68529
68529
  }
@@ -68533,7 +68533,7 @@ var require_CJSImportProcessor = __commonJS({
68533
68533
  ...importInfo.namedImports.map(({ localName }) => localName)
68534
68534
  ];
68535
68535
  if (names2.every((name) => this.shouldAutomaticallyElideImportedName(name))) {
68536
- this.importsToReplace.set(path49, "");
68536
+ this.importsToReplace.set(path50, "");
68537
68537
  }
68538
68538
  }
68539
68539
  }
@@ -68541,7 +68541,7 @@ var require_CJSImportProcessor = __commonJS({
68541
68541
  return this.isTypeScriptTransformEnabled && !this.keepUnusedImports && !this.nonTypeIdentifiers.has(name);
68542
68542
  }
68543
68543
  generateImportReplacements() {
68544
- for (const [path49, importInfo] of this.importInfoByPath.entries()) {
68544
+ for (const [path50, importInfo] of this.importInfoByPath.entries()) {
68545
68545
  const {
68546
68546
  defaultNames,
68547
68547
  wildcardNames,
@@ -68551,17 +68551,17 @@ var require_CJSImportProcessor = __commonJS({
68551
68551
  hasStarExport
68552
68552
  } = importInfo;
68553
68553
  if (defaultNames.length === 0 && wildcardNames.length === 0 && namedImports.length === 0 && namedExports.length === 0 && exportStarNames.length === 0 && !hasStarExport) {
68554
- this.importsToReplace.set(path49, `require('${path49}');`);
68554
+ this.importsToReplace.set(path50, `require('${path50}');`);
68555
68555
  continue;
68556
68556
  }
68557
- const primaryImportName = this.getFreeIdentifierForPath(path49);
68557
+ const primaryImportName = this.getFreeIdentifierForPath(path50);
68558
68558
  let secondaryImportName;
68559
68559
  if (this.enableLegacyTypeScriptModuleInterop) {
68560
68560
  secondaryImportName = primaryImportName;
68561
68561
  } else {
68562
- secondaryImportName = wildcardNames.length > 0 ? wildcardNames[0] : this.getFreeIdentifierForPath(path49);
68562
+ secondaryImportName = wildcardNames.length > 0 ? wildcardNames[0] : this.getFreeIdentifierForPath(path50);
68563
68563
  }
68564
- let requireCode = `var ${primaryImportName} = require('${path49}');`;
68564
+ let requireCode = `var ${primaryImportName} = require('${path50}');`;
68565
68565
  if (wildcardNames.length > 0) {
68566
68566
  for (const wildcardName of wildcardNames) {
68567
68567
  const moduleExpr = this.enableLegacyTypeScriptModuleInterop ? primaryImportName : `${this.helperManager.getHelperName("interopRequireWildcard")}(${primaryImportName})`;
@@ -68589,7 +68589,7 @@ var require_CJSImportProcessor = __commonJS({
68589
68589
  "createStarExport"
68590
68590
  )}(${primaryImportName});`;
68591
68591
  }
68592
- this.importsToReplace.set(path49, requireCode);
68592
+ this.importsToReplace.set(path50, requireCode);
68593
68593
  for (const defaultName of defaultNames) {
68594
68594
  this.identifierReplacements.set(defaultName, `${secondaryImportName}.default`);
68595
68595
  }
@@ -68598,8 +68598,8 @@ var require_CJSImportProcessor = __commonJS({
68598
68598
  }
68599
68599
  }
68600
68600
  }
68601
- getFreeIdentifierForPath(path49) {
68602
- const components = path49.split("/");
68601
+ getFreeIdentifierForPath(path50) {
68602
+ const components = path50.split("/");
68603
68603
  const lastComponent = components[components.length - 1];
68604
68604
  const baseName = lastComponent.replace(/\W/g, "");
68605
68605
  return this.nameManager.claimFreeName(`_${baseName}`);
@@ -68644,8 +68644,8 @@ var require_CJSImportProcessor = __commonJS({
68644
68644
  if (!this.tokens.matches1AtIndex(index, _types.TokenType.string)) {
68645
68645
  throw new Error("Expected string token at the end of import statement.");
68646
68646
  }
68647
- const path49 = this.tokens.stringValueAtIndex(index);
68648
- const importInfo = this.getImportInfo(path49);
68647
+ const path50 = this.tokens.stringValueAtIndex(index);
68648
+ const importInfo = this.getImportInfo(path50);
68649
68649
  importInfo.defaultNames.push(...defaultNames);
68650
68650
  importInfo.wildcardNames.push(...wildcardNames);
68651
68651
  importInfo.namedImports.push(...namedImports);
@@ -68712,8 +68712,8 @@ var require_CJSImportProcessor = __commonJS({
68712
68712
  if (!this.tokens.matches1AtIndex(index, _types.TokenType.string)) {
68713
68713
  throw new Error("Expected string token at the end of import statement.");
68714
68714
  }
68715
- const path49 = this.tokens.stringValueAtIndex(index);
68716
- const importInfo = this.getImportInfo(path49);
68715
+ const path50 = this.tokens.stringValueAtIndex(index);
68716
+ const importInfo = this.getImportInfo(path50);
68717
68717
  importInfo.namedExports.push(...namedImports);
68718
68718
  }
68719
68719
  preprocessExportStarAtIndex(index) {
@@ -68728,8 +68728,8 @@ var require_CJSImportProcessor = __commonJS({
68728
68728
  if (!this.tokens.matches1AtIndex(index, _types.TokenType.string)) {
68729
68729
  throw new Error("Expected string token at the end of star export statement.");
68730
68730
  }
68731
- const path49 = this.tokens.stringValueAtIndex(index);
68732
- const importInfo = this.getImportInfo(path49);
68731
+ const path50 = this.tokens.stringValueAtIndex(index);
68732
+ const importInfo = this.getImportInfo(path50);
68733
68733
  if (exportedName !== null) {
68734
68734
  importInfo.exportStarNames.push(exportedName);
68735
68735
  } else {
@@ -68769,8 +68769,8 @@ var require_CJSImportProcessor = __commonJS({
68769
68769
  * Get a mutable import info object for this path, creating one if it doesn't
68770
68770
  * exist yet.
68771
68771
  */
68772
- getImportInfo(path49) {
68773
- const existingInfo = this.importInfoByPath.get(path49);
68772
+ getImportInfo(path50) {
68773
+ const existingInfo = this.importInfoByPath.get(path50);
68774
68774
  if (existingInfo) {
68775
68775
  return existingInfo;
68776
68776
  }
@@ -68783,7 +68783,7 @@ var require_CJSImportProcessor = __commonJS({
68783
68783
  exportStarNames: [],
68784
68784
  hasStarExport: false
68785
68785
  };
68786
- this.importInfoByPath.set(path49, newInfo);
68786
+ this.importInfoByPath.set(path50, newInfo);
68787
68787
  return newInfo;
68788
68788
  }
68789
68789
  addExportBinding(localName, exportedName) {
@@ -69363,16 +69363,16 @@ var require_resolve_uri_umd = __commonJS({
69363
69363
  }
69364
69364
  function parseFileUrl(input) {
69365
69365
  const match = fileRegex.exec(input);
69366
- const path49 = match[2];
69367
- return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path49) ? path49 : "/" + path49, match[3] || "", match[4] || "");
69366
+ const path50 = match[2];
69367
+ return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path50) ? path50 : "/" + path50, match[3] || "", match[4] || "");
69368
69368
  }
69369
- function makeUrl(scheme, user, host, port, path49, query, hash) {
69369
+ function makeUrl(scheme, user, host, port, path50, query, hash) {
69370
69370
  return {
69371
69371
  scheme,
69372
69372
  user,
69373
69373
  host,
69374
69374
  port,
69375
- path: path49,
69375
+ path: path50,
69376
69376
  query,
69377
69377
  hash,
69378
69378
  type: 7
@@ -69402,11 +69402,11 @@ var require_resolve_uri_umd = __commonJS({
69402
69402
  url.type = input ? input.startsWith("?") ? 3 : input.startsWith("#") ? 2 : 4 : 1;
69403
69403
  return url;
69404
69404
  }
69405
- function stripPathFilename(path49) {
69406
- if (path49.endsWith("/.."))
69407
- return path49;
69408
- const index = path49.lastIndexOf("/");
69409
- return path49.slice(0, index + 1);
69405
+ function stripPathFilename(path50) {
69406
+ if (path50.endsWith("/.."))
69407
+ return path50;
69408
+ const index = path50.lastIndexOf("/");
69409
+ return path50.slice(0, index + 1);
69410
69410
  }
69411
69411
  function mergePaths(url, base) {
69412
69412
  normalizePath(base, base.type);
@@ -69444,14 +69444,14 @@ var require_resolve_uri_umd = __commonJS({
69444
69444
  pieces[pointer++] = piece;
69445
69445
  positive++;
69446
69446
  }
69447
- let path49 = "";
69447
+ let path50 = "";
69448
69448
  for (let i = 1; i < pointer; i++) {
69449
- path49 += "/" + pieces[i];
69449
+ path50 += "/" + pieces[i];
69450
69450
  }
69451
- if (!path49 || addTrailingSlash && !path49.endsWith("/..")) {
69452
- path49 += "/";
69451
+ if (!path50 || addTrailingSlash && !path50.endsWith("/..")) {
69452
+ path50 += "/";
69453
69453
  }
69454
- url.path = path49;
69454
+ url.path = path50;
69455
69455
  }
69456
69456
  function resolve2(input, base) {
69457
69457
  if (!input && !base)
@@ -69492,13 +69492,13 @@ var require_resolve_uri_umd = __commonJS({
69492
69492
  case 3:
69493
69493
  return queryHash;
69494
69494
  case 4: {
69495
- const path49 = url.path.slice(1);
69496
- if (!path49)
69495
+ const path50 = url.path.slice(1);
69496
+ if (!path50)
69497
69497
  return queryHash || ".";
69498
- if (isRelative(base || input) && !isRelative(path49)) {
69499
- return "./" + path49 + queryHash;
69498
+ if (isRelative(base || input) && !isRelative(path50)) {
69499
+ return "./" + path50 + queryHash;
69500
69500
  }
69501
- return path49 + queryHash;
69501
+ return path50 + queryHash;
69502
69502
  }
69503
69503
  case 5:
69504
69504
  return url.path + queryHash;
@@ -69597,10 +69597,10 @@ var require_trace_mapping_umd = __commonJS({
69597
69597
  module2.exports = __toCommonJS(trace_mapping_exports);
69598
69598
  var import_sourcemap_codec = __toESM2(require_sourcemap_codec());
69599
69599
  var import_resolve_uri = __toESM2(require_resolve_uri());
69600
- function stripFilename(path49) {
69601
- if (!path49) return "";
69602
- const index = path49.lastIndexOf("/");
69603
- return path49.slice(0, index + 1);
69600
+ function stripFilename(path50) {
69601
+ if (!path50) return "";
69602
+ const index = path50.lastIndexOf("/");
69603
+ return path50.slice(0, index + 1);
69604
69604
  }
69605
69605
  function resolver(mapUrl, sourceRoot) {
69606
69606
  const from = stripFilename(mapUrl);
@@ -70808,9 +70808,9 @@ var require_util8 = __commonJS({
70808
70808
  /** @class */
70809
70809
  (function(_super) {
70810
70810
  __extends(VError2, _super);
70811
- function VError2(path49, message) {
70811
+ function VError2(path50, message) {
70812
70812
  var _this = _super.call(this, message) || this;
70813
- _this.path = path49;
70813
+ _this.path = path50;
70814
70814
  Object.setPrototypeOf(_this, VError2.prototype);
70815
70815
  return _this;
70816
70816
  }
@@ -70870,26 +70870,26 @@ var require_util8 = __commonJS({
70870
70870
  (_b = this._messages).push.apply(_b, best._messages);
70871
70871
  }
70872
70872
  };
70873
- DetailContext2.prototype.getError = function(path49) {
70873
+ DetailContext2.prototype.getError = function(path50) {
70874
70874
  var msgParts = [];
70875
70875
  for (var i = this._propNames.length - 1; i >= 0; i--) {
70876
70876
  var p2 = this._propNames[i];
70877
- path49 += typeof p2 === "number" ? "[" + p2 + "]" : p2 ? "." + p2 : "";
70877
+ path50 += typeof p2 === "number" ? "[" + p2 + "]" : p2 ? "." + p2 : "";
70878
70878
  var m = this._messages[i];
70879
70879
  if (m) {
70880
- msgParts.push(path49 + " " + m);
70880
+ msgParts.push(path50 + " " + m);
70881
70881
  }
70882
70882
  }
70883
- return new VError(path49, msgParts.join("; "));
70883
+ return new VError(path50, msgParts.join("; "));
70884
70884
  };
70885
- DetailContext2.prototype.getErrorDetail = function(path49) {
70885
+ DetailContext2.prototype.getErrorDetail = function(path50) {
70886
70886
  var details = [];
70887
70887
  for (var i = this._propNames.length - 1; i >= 0; i--) {
70888
70888
  var p2 = this._propNames[i];
70889
- path49 += typeof p2 === "number" ? "[" + p2 + "]" : p2 ? "." + p2 : "";
70889
+ path50 += typeof p2 === "number" ? "[" + p2 + "]" : p2 ? "." + p2 : "";
70890
70890
  var message = this._messages[i];
70891
70891
  if (message) {
70892
- details.push({ path: path49, message });
70892
+ details.push({ path: path50, message });
70893
70893
  }
70894
70894
  }
70895
70895
  var detail = null;
@@ -71702,8 +71702,8 @@ var require_dist = __commonJS({
71702
71702
  this.checkerPlain = this.ttype.getChecker(suite, false);
71703
71703
  this.checkerStrict = this.ttype.getChecker(suite, true);
71704
71704
  }
71705
- Checker2.prototype.setReportedPath = function(path49) {
71706
- this._path = path49;
71705
+ Checker2.prototype.setReportedPath = function(path50) {
71706
+ this._path = path50;
71707
71707
  };
71708
71708
  Checker2.prototype.check = function(value) {
71709
71709
  return this._doCheck(this.checkerPlain, value);
@@ -77136,9 +77136,9 @@ var require_CJSImportTransformer = __commonJS({
77136
77136
  if (shouldElideImport) {
77137
77137
  this.tokens.removeToken();
77138
77138
  } else {
77139
- const path49 = this.tokens.stringValue();
77140
- this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(path49));
77141
- this.tokens.appendCode(this.importProcessor.claimImportCode(path49));
77139
+ const path50 = this.tokens.stringValue();
77140
+ this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(path50));
77141
+ this.tokens.appendCode(this.importProcessor.claimImportCode(path50));
77142
77142
  }
77143
77143
  _removeMaybeImportAttributes.removeMaybeImportAttributes.call(void 0, this.tokens);
77144
77144
  if (this.tokens.matches1(_types.TokenType.semi)) {
@@ -77718,8 +77718,8 @@ var require_CJSImportTransformer = __commonJS({
77718
77718
  }
77719
77719
  if (this.tokens.matchesContextual(_keywords.ContextualKeyword._from)) {
77720
77720
  this.tokens.removeToken();
77721
- const path49 = this.tokens.stringValue();
77722
- this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(path49));
77721
+ const path50 = this.tokens.stringValue();
77722
+ this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(path50));
77723
77723
  _removeMaybeImportAttributes.removeMaybeImportAttributes.call(void 0, this.tokens);
77724
77724
  } else {
77725
77725
  this.tokens.appendCode(exportStatements.join(" "));
@@ -77733,8 +77733,8 @@ var require_CJSImportTransformer = __commonJS({
77733
77733
  while (!this.tokens.matches1(_types.TokenType.string)) {
77734
77734
  this.tokens.removeToken();
77735
77735
  }
77736
- const path49 = this.tokens.stringValue();
77737
- this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(path49));
77736
+ const path50 = this.tokens.stringValue();
77737
+ this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(path50));
77738
77738
  _removeMaybeImportAttributes.removeMaybeImportAttributes.call(void 0, this.tokens);
77739
77739
  if (this.tokens.matches1(_types.TokenType.semi)) {
77740
77740
  this.tokens.removeToken();
@@ -85862,16 +85862,16 @@ var init_tailwindcss = __esm({
85862
85862
  });
85863
85863
 
85864
85864
  // ../cli/src/lib/dress-page.ts
85865
- import fs28 from "node:fs";
85866
- import path32 from "node:path";
85865
+ import fs29 from "node:fs";
85866
+ import path33 from "node:path";
85867
85867
  function dressPage(file2) {
85868
- const folder = path32.dirname(file2);
85869
- const html = fs28.readFileSync(file2, "utf8").replace(/<link\b[^>]*>/gi, (tag) => {
85868
+ const folder = path33.dirname(file2);
85869
+ const html = fs29.readFileSync(file2, "utf8").replace(/<link\b[^>]*>/gi, (tag) => {
85870
85870
  const href = /\bhref\s*=\s*["']?([^"'\s>]+)/i.exec(tag)?.[1];
85871
85871
  if (!/\brel\s*=\s*["']?stylesheet/i.test(tag) || !href || /^[a-z][\w+.-]*:|^\/\//i.test(href)) return tag;
85872
- const at3 = path32.resolve(folder, href);
85873
- if (!at3.startsWith(folder + path32.sep) || !fs28.existsSync(at3)) return tag;
85874
- const css = fs28.readFileSync(at3, "utf8").replace(/url\(\s*(["']?)([^"')]+?)\1\s*\)/gi, (whole, quote2, src) => /^(?:[a-z][\w+.-]*:|\/|#)/i.test(src) ? whole : `url(${quote2}${path32.relative(folder, path32.resolve(path32.dirname(at3), src)).split(path32.sep).join("/")}${quote2})`);
85872
+ const at3 = path33.resolve(folder, href);
85873
+ if (!at3.startsWith(folder + path33.sep) || !fs29.existsSync(at3)) return tag;
85874
+ const css = fs29.readFileSync(at3, "utf8").replace(/url\(\s*(["']?)([^"')]+?)\1\s*\)/gi, (whole, quote2, src) => /^(?:[a-z][\w+.-]*:|\/|#)/i.test(src) ? whole : `url(${quote2}${path33.relative(folder, path33.resolve(path33.dirname(at3), src)).split(path33.sep).join("/")}${quote2})`);
85875
85875
  return `<style>${css.replace(/\r?\n/g, " ").replace(/<\/style/gi, "<\\/style")}</style>`;
85876
85876
  });
85877
85877
  const at2 = /^\uFEFF?\s*(?:<!--[\s\S]*?-->\s*)*(?:<!doctype\b[^>]*>)?/i.exec(html)[0].length;
@@ -85883,7 +85883,7 @@ var init_dress_page = __esm({
85883
85883
  "use strict";
85884
85884
  CSP = "default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data: blob:; media-src data: blob:; font-src data: blob:; worker-src 'none'; base-uri 'none'; form-action 'none'";
85885
85885
  head = `<meta http-equiv="Content-Security-Policy" content="${CSP}"><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><style>html{overflow-x:hidden;overscroll-behavior:contain}</style>`;
85886
- referenceText = (file2) => /\.html$/i.test(file2) ? dressPage(file2) : fs28.readFileSync(file2, "utf8");
85886
+ referenceText = (file2) => /\.html$/i.test(file2) ? dressPage(file2) : fs29.readFileSync(file2, "utf8");
85887
85887
  }
85888
85888
  });
85889
85889
 
@@ -107614,9 +107614,9 @@ var init_bundle_mjs = __esm({
107614
107614
  processClassesRecursively(value, getPart(classPartObject, key), classGroupId, theme);
107615
107615
  }
107616
107616
  };
107617
- getPart = (classPartObject, path49) => {
107617
+ getPart = (classPartObject, path50) => {
107618
107618
  let current2 = classPartObject;
107619
- const parts = path49.split(CLASS_PART_SEPARATOR);
107619
+ const parts = path50.split(CLASS_PART_SEPARATOR);
107620
107620
  const len = parts.length;
107621
107621
  for (let i = 0; i < len; i++) {
107622
107622
  const part = parts[i];
@@ -110866,8 +110866,8 @@ var init_dist = __esm({
110866
110866
  });
110867
110867
 
110868
110868
  // ../cli/src/lib/draw-mockup.ts
110869
- import fs29 from "node:fs";
110870
- import path33 from "node:path";
110869
+ import fs30 from "node:fs";
110870
+ import path34 from "node:path";
110871
110871
  import vm from "node:vm";
110872
110872
  async function loadPackage(id) {
110873
110873
  if (id === "react") return import_react3.default;
@@ -110880,22 +110880,22 @@ async function loadPackage(id) {
110880
110880
  return { __esModule: true, ...await load() };
110881
110881
  }
110882
110882
  function resolveFile(id, from, folder) {
110883
- const at2 = path33.resolve(path33.dirname(from), id);
110884
- if (at2 !== folder && !at2.startsWith(folder + path33.sep)) throw new Error(`${id} is outside the mockup's folder`);
110885
- const tries = path33.extname(at2) ? [at2] : [...CODE_EXTS.map((e2) => at2 + e2), ...CODE_EXTS.map((e2) => path33.join(at2, `index${e2}`))];
110886
- const file2 = tries.find((f2) => fs29.statSync(f2, { throwIfNoEntry: false })?.isFile());
110883
+ const at2 = path34.resolve(path34.dirname(from), id);
110884
+ if (at2 !== folder && !at2.startsWith(folder + path34.sep)) throw new Error(`${id} is outside the mockup's folder`);
110885
+ const tries = path34.extname(at2) ? [at2] : [...CODE_EXTS.map((e2) => at2 + e2), ...CODE_EXTS.map((e2) => path34.join(at2, `index${e2}`))];
110886
+ const file2 = tries.find((f2) => fs30.statSync(f2, { throwIfNoEntry: false })?.isFile());
110887
110887
  if (!file2) throw new Error(`no such file: ${id}`);
110888
110888
  return file2;
110889
110889
  }
110890
110890
  async function readGraph(entry) {
110891
- const folder = path33.dirname(entry);
110891
+ const folder = path34.dirname(entry);
110892
110892
  const graph = { code: /* @__PURE__ */ new Map(), links: /* @__PURE__ */ new Map(), sheets: [], packages: /* @__PURE__ */ new Map() };
110893
110893
  const walk = async (file2) => {
110894
110894
  if (graph.code.has(file2)) return;
110895
110895
  if (graph.code.size >= MAX_FILES) throw new Error(`a mockup imports more than ${MAX_FILES} files`);
110896
110896
  let location = file2;
110897
110897
  try {
110898
- const js = (0, import_sucrase.transform)(fs29.readFileSync(file2, "utf8"), { transforms: ["typescript", "jsx", "imports"], jsxRuntime: "automatic", production: true, filePath: file2 }).code;
110898
+ const js = (0, import_sucrase.transform)(fs30.readFileSync(file2, "utf8"), { transforms: ["typescript", "jsx", "imports"], jsxRuntime: "automatic", production: true, filePath: file2 }).code;
110899
110899
  graph.code.set(file2, js);
110900
110900
  const link = /* @__PURE__ */ new Map();
110901
110901
  graph.links.set(file2, link);
@@ -110909,7 +110909,7 @@ async function readGraph(entry) {
110909
110909
  const target = resolveFile(id, file2, folder);
110910
110910
  link.set(id, target);
110911
110911
  if (!target.endsWith(".css")) await walk(target);
110912
- else if (!graph.sheets.some((s) => s.path === target)) graph.sheets.push({ path: target, content: fs29.readFileSync(target, "utf8") });
110912
+ else if (!graph.sheets.some((s) => s.path === target)) graph.sheets.push({ path: target, content: fs30.readFileSync(target, "utf8") });
110913
110913
  }
110914
110914
  } catch (error) {
110915
110915
  throw new Error(`${location}: ${error instanceof Error ? error.message : String(error)}`);
@@ -110926,12 +110926,12 @@ function run(script, context, name, deadline, lineOffset = 0) {
110926
110926
  async function tailwindFor(markup, sheets) {
110927
110927
  const source = sheets.length ? sheets.map((s) => s.content).join("\n") : '@import "tailwindcss";';
110928
110928
  const compiler = await rc(source, {
110929
- base: sheets.length ? path33.dirname(sheets[0].path) : "/",
110929
+ base: sheets.length ? path34.dirname(sheets[0].path) : "/",
110930
110930
  loadStylesheet: async (id, from) => {
110931
110931
  if (id === "tailwindcss" || id.startsWith("tailwindcss/")) return { path: "tailwindcss/index.css", base: "/", content: tailwindcss_default };
110932
110932
  if (!id.startsWith(".")) throw new Error(`a mockup cannot import ${id}`);
110933
- const at2 = path33.resolve(from, id);
110934
- return { path: at2, base: path33.dirname(at2), content: fs29.readFileSync(at2, "utf8") };
110933
+ const at2 = path34.resolve(from, id);
110934
+ return { path: at2, base: path34.dirname(at2), content: fs30.readFileSync(at2, "utf8") };
110935
110935
  }
110936
110936
  });
110937
110937
  const classes = [...markup.matchAll(/class="([^"]*)"/g)].flatMap((m) => m[1].split(/\s+/));
@@ -111400,8 +111400,8 @@ function status(line) {
111400
111400
  }
111401
111401
 
111402
111402
  // src/protocol.ts
111403
- var VERSION = true ? "0.6.32" : "0.0.0";
111404
- var AKB_VERSION = true ? "0.11.29" : "0.0.0";
111403
+ var VERSION = true ? "0.6.33" : "0.0.0";
111404
+ var AKB_VERSION = true ? "0.11.30" : "0.0.0";
111405
111405
  var AKB_CONTRACT = true ? 7 : 0;
111406
111406
  var EXIT_REFUSED = 10;
111407
111407
  var EXIT_OUTDATED = 11;
@@ -112292,10 +112292,10 @@ function findRollout(threadId) {
112292
112292
  }
112293
112293
  for (const name of names2) {
112294
112294
  if (!name.startsWith("rollout-") || !name.endsWith(tail)) continue;
112295
- const path49 = join(dir, name);
112295
+ const path50 = join(dir, name);
112296
112296
  try {
112297
- const at2 = statSync(path49).mtimeMs;
112298
- if (!newest2 || at2 > newest2.at) newest2 = { path: path49, at: at2 };
112297
+ const at2 = statSync(path50).mtimeMs;
112298
+ if (!newest2 || at2 > newest2.at) newest2 = { path: path50, at: at2 };
112299
112299
  } catch {
112300
112300
  }
112301
112301
  }
@@ -112303,11 +112303,11 @@ function findRollout(threadId) {
112303
112303
  return newest2?.path;
112304
112304
  }
112305
112305
  function readCodexRunFacts(threadId) {
112306
- const path49 = findRollout(threadId);
112307
- if (!path49) return void 0;
112306
+ const path50 = findRollout(threadId);
112307
+ if (!path50) return void 0;
112308
112308
  let raw;
112309
112309
  try {
112310
- raw = readFileSync(path49, "utf8");
112310
+ raw = readFileSync(path50, "utf8");
112311
112311
  } catch {
112312
112312
  return void 0;
112313
112313
  }
@@ -112415,8 +112415,8 @@ function renderCompleted(item) {
112415
112415
  const changes = Array.isArray(item.changes) ? item.changes : [];
112416
112416
  return changes.map((raw) => {
112417
112417
  const change = obj(raw);
112418
- const path49 = str(change.path);
112419
- return path49 ? `\u23FA ${str(change.kind) || "change"}(${path49})
112418
+ const path50 = str(change.path);
112419
+ return path50 ? `\u23FA ${str(change.kind) || "change"}(${path50})
112420
112420
  ` : "";
112421
112421
  }).join("");
112422
112422
  }
@@ -112667,10 +112667,10 @@ function readKimiRunFacts(sessionId) {
112667
112667
  const total = { input: 0, cacheCreation: 0, cacheRead: 0, output: 0 };
112668
112668
  let model;
112669
112669
  let holding = 0;
112670
- for (const { path: path49, main: main2 } of wireFiles(entry.sessionDir)) {
112670
+ for (const { path: path50, main: main2 } of wireFiles(entry.sessionDir)) {
112671
112671
  let raw;
112672
112672
  try {
112673
- raw = readFileSync2(path49, "utf8");
112673
+ raw = readFileSync2(path50, "utf8");
112674
112674
  } catch {
112675
112675
  continue;
112676
112676
  }
@@ -112926,7 +112926,7 @@ function createTail(log) {
112926
112926
  // ../cli/package.json
112927
112927
  var package_default = {
112928
112928
  name: "wildcrane",
112929
- version: "0.11.29",
112929
+ version: "0.11.30",
112930
112930
  akbContract: 7,
112931
112931
  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.",
112932
112932
  keywords: [
@@ -112998,8 +112998,8 @@ var CLIENT_CAPABILITIES = {
112998
112998
  };
112999
112999
  function whereHint(update3, title) {
113000
113000
  const locations = Array.isArray(update3.locations) ? update3.locations : [];
113001
- const path49 = str(obj(locations[0]).path);
113002
- return path49 && !title.includes(path49) ? hint(path49) : "";
113001
+ const path50 = str(obj(locations[0]).path);
113002
+ return path50 && !title.includes(path50) ? hint(path50) : "";
113003
113003
  }
113004
113004
  function saidBy(update3) {
113005
113005
  const content = Array.isArray(update3.content) ? update3.content : [];
@@ -115416,7 +115416,7 @@ var listFolders = (machineId2) => request("GET", `/v1/runner/folders?machine=${q
115416
115416
  var listElsewhere = (machineId2) => request("GET", `/v1/runner/folders?machine=${q(machineId2)}&elsewhere=1`);
115417
115417
  var listMachineTasks = (machineId2) => request("GET", `/v1/runner/tasks?machine=${q(machineId2)}`);
115418
115418
  var stopTask = (task, how) => request("POST", how === "chat" ? `/v1/tasks/${q(task)}/chat/stop` : `/v1/tasks/${q(task)}/stop`, {});
115419
- var addFolder = (machineId2, name, path49, project) => request("POST", "/v1/runner/folders", { machineId: machineId2, name, path: path49, ...project ? { project } : {} });
115419
+ var addFolder = (machineId2, name, path50, project) => request("POST", "/v1/runner/folders", { machineId: machineId2, name, path: path50, ...project ? { project } : {} });
115420
115420
  async function createProject(name, workspace, key) {
115421
115421
  const sent = await send("POST", "/v1/projects", { name, workspace }, true, TIMEOUT_MS, void 0, { "idempotency-key": key });
115422
115422
  return sent.ok ? answerOf(sent.value) : sent;
@@ -115946,8 +115946,8 @@ function allowedProjects() {
115946
115946
  }
115947
115947
 
115948
115948
  // src/connect.ts
115949
- import fs45 from "node:fs";
115950
- import path48 from "node:path";
115949
+ import fs46 from "node:fs";
115950
+ import path49 from "node:path";
115951
115951
 
115952
115952
  // src/settings-control.ts
115953
115953
  import fs13 from "node:fs";
@@ -116702,28 +116702,28 @@ async function reviewChats(machineId2, runtimes, now = Date.now()) {
116702
116702
  }
116703
116703
 
116704
116704
  // src/board-watch.ts
116705
- import fs32 from "node:fs";
116706
- import path36 from "node:path";
116705
+ import fs33 from "node:fs";
116706
+ import path37 from "node:path";
116707
116707
 
116708
116708
  // ../cli/src/lib/shared/board-files.ts
116709
116709
  var ROOTS = ["todo/", ".archive/", "memory/", "workflows/", "triage/", "assets/", "rules/"];
116710
116710
  var SETTINGS = ["modules.md", "config.md"];
116711
- var isSettingsPath = (path49) => SETTINGS.includes(path49) || /^rules\/(?:workflows\/)?[^/]+\.md$/.test(path49);
116711
+ var isSettingsPath = (path50) => SETTINGS.includes(path50) || /^rules\/(?:workflows\/)?[^/]+\.md$/.test(path50);
116712
116712
  var BOARD_FILE_LIMIT = 256 * 1024;
116713
- function isBoardPath(path49) {
116714
- if (!path49 || path49.length > 500 || path49.startsWith("/") || path49.includes("\\") || path49.includes("\0")) return false;
116715
- if (path49.split("/").some((part) => !part || part === "." || part === "..")) return false;
116716
- if (path49 === "todo/README.md" || path49.split("/").includes(".sync")) return false;
116717
- if (path49.startsWith("workflows/")) return true;
116718
- if (SETTINGS.includes(path49)) return true;
116719
- if (path49.startsWith("rules/")) return isSettingsPath(path49);
116720
- if (path49.startsWith("assets/")) return path49.endsWith(".json");
116721
- return ROOTS.some((root2) => path49.startsWith(root2)) && path49.endsWith(".md");
116713
+ function isBoardPath(path50) {
116714
+ if (!path50 || path50.length > 500 || path50.startsWith("/") || path50.includes("\\") || path50.includes("\0")) return false;
116715
+ if (path50.split("/").some((part) => !part || part === "." || part === "..")) return false;
116716
+ if (path50 === "todo/README.md" || path50.split("/").includes(".sync")) return false;
116717
+ if (path50.startsWith("workflows/")) return true;
116718
+ if (SETTINGS.includes(path50)) return true;
116719
+ if (path50.startsWith("rules/")) return isSettingsPath(path50);
116720
+ if (path50.startsWith("assets/")) return path50.endsWith(".json");
116721
+ return ROOTS.some((root2) => path50.startsWith(root2)) && path50.endsWith(".md");
116722
116722
  }
116723
116723
  var CARD = /^(?:todo|\.archive)\/(?:[^/]+\/)*(\d+)-[^/]*\.md$/;
116724
116724
  var ROOT = /^(?:todo|\.archive)\/(?:[^/]+\/)*(\d+)-[^/]+\/root\.md$/;
116725
- function numberOfCard(path49) {
116726
- const n = ROOT.exec(path49)?.[1] ?? CARD.exec(path49)?.[1];
116725
+ function numberOfCard(path50) {
116726
+ const n = ROOT.exec(path50)?.[1] ?? CARD.exec(path50)?.[1];
116727
116727
  return n ? Number(n) : null;
116728
116728
  }
116729
116729
  var cardSlug = (task) => task.toLowerCase().replace(/_/g, "-");
@@ -117036,14 +117036,14 @@ function collect(body, card, host) {
117036
117036
  const active = /* @__PURE__ */ new Set();
117037
117037
  const out = [];
117038
117038
  const visit = (src, types, owner) => {
117039
- const path49 = src.replace(/[?#].*$/, "");
117039
+ const path50 = src.replace(/[?#].*$/, "");
117040
117040
  let resolved2;
117041
117041
  try {
117042
- resolved2 = host.resolve(path49, owner);
117042
+ resolved2 = host.resolve(path50, owner);
117043
117043
  } catch (error) {
117044
117044
  if (owner !== card) return { key: null, error: why(error) };
117045
117045
  if (!nodes.has(src)) {
117046
- const node2 = { key: src, file: null, kind: kindAt(path49, types), error: why(error), problems: [], dependencies: /* @__PURE__ */ new Map(), aliases: /* @__PURE__ */ new Set([src]) };
117046
+ const node2 = { key: src, file: null, kind: kindAt(path50, types), error: why(error), problems: [], dependencies: /* @__PURE__ */ new Map(), aliases: /* @__PURE__ */ new Set([src]) };
117047
117047
  nodes.set(src, node2);
117048
117048
  out.push(node2);
117049
117049
  }
@@ -117115,8 +117115,8 @@ function collect(body, card, host) {
117115
117115
  // src/task-folder.ts
117116
117116
  import { spawnSync as spawnSync3 } from "node:child_process";
117117
117117
  import crypto5 from "node:crypto";
117118
- import fs31 from "node:fs";
117119
- import path35 from "node:path";
117118
+ import fs32 from "node:fs";
117119
+ import path36 from "node:path";
117120
117120
 
117121
117121
  // node_modules/node-diff3/dist/diff3.mjs
117122
117122
  function LCS(buffer1, buffer2) {
@@ -117355,8 +117355,8 @@ function unquote2(v) {
117355
117355
 
117356
117356
  // ../cli/src/lib/shared/triage-files.ts
117357
117357
  var ITEM = /^triage\/(?:(dismissed|archived)\/)?([^/]+)\.md$/;
117358
- function itemAt(path49) {
117359
- const m = ITEM.exec(path49);
117358
+ function itemAt(path50) {
117359
+ const m = ITEM.exec(path50);
117360
117360
  if (!m) return null;
117361
117361
  return { state: m[1] === "dismissed" ? "dismissed" : m[1] === "archived" ? "carded" : "open", name: m[2] };
117362
117362
  }
@@ -117373,13 +117373,13 @@ function stampItem(content, fields) {
117373
117373
  }
117374
117374
 
117375
117375
  // ../cli/src/lib/agent/cloud-workflows.ts
117376
- import fs23 from "node:fs";
117377
- import path27 from "node:path";
117376
+ import fs24 from "node:fs";
117377
+ import path28 from "node:path";
117378
117378
 
117379
117379
  // ../official/pack.ts
117380
117380
  import crypto4 from "node:crypto";
117381
- import fs20 from "node:fs";
117382
- import path24 from "node:path";
117381
+ import fs21 from "node:fs";
117382
+ import path25 from "node:path";
117383
117383
  import { fileURLToPath as fileURLToPath2 } from "node:url";
117384
117384
 
117385
117385
  // ../cli/src/lib/agents/icon.ts
@@ -117767,11 +117767,17 @@ function parseWorkflowFile(id, source, from) {
117767
117767
  };
117768
117768
  }
117769
117769
 
117770
+ // ../cli/src/lib/agent/workflow-folder.ts
117771
+ import fs20 from "node:fs";
117772
+ import path24 from "node:path";
117773
+
117770
117774
  // ../cli/src/lib/shared/workflow-files.ts
117771
117775
  var WORKFLOW_FILE = "WORKFLOW.md";
117772
117776
  var MCP_FILE = "mcp.json";
117773
117777
  var KB = 1024;
117774
- var FILE_LIMITS = { file: 256 * KB, total: 2 * KB * KB, count: 500, path: 512 };
117778
+ var FILE_LIMITS = { file: 2 * KB * KB, total: 2 * KB * KB, count: 500, path: 512 };
117779
+ var officialId = (folder) => `wf_builtin_${folder.replace(/-/g, "_")}`;
117780
+ var hashInput = (files) => JSON.stringify(Object.entries(files).sort(([a2], [b2]) => a2 < b2 ? -1 : 1));
117775
117781
  var landsOf = (def) => ({ lands: def.land.some((h3) => !h3.off) });
117776
117782
  var SEGMENT = /^[\w.-]+$/;
117777
117783
  var isAboutFile = (file2) => /^ABOUT(\.[a-z]{2})?\.md$/.test(file2) || /^screenshots\/[\w.-]+\.(png|jpe?g|webp)$/.test(file2);
@@ -117861,35 +117867,40 @@ function checkWorkflowFiles(value, official = false) {
117861
117867
  return { ok: true, def, files: value };
117862
117868
  }
117863
117869
 
117864
- // ../official/pack.ts
117865
- var OFFICIAL = path24.dirname(fileURLToPath2(import.meta.url));
117870
+ // ../cli/src/lib/agent/workflow-folder.ts
117866
117871
  var MIME = { ".png": "image/png", ".jpg": "image/jpeg", ".jpeg": "image/jpeg", ".webp": "image/webp" };
117867
- var dirs = (dir) => fs20.readdirSync(dir, { withFileTypes: true }).filter((e2) => e2.isDirectory()).map((e2) => e2.name).sort();
117868
117872
  function filesOf(dir, base = dir) {
117869
- return fs20.readdirSync(dir, { withFileTypes: true }).flatMap((e2) => {
117873
+ return fs20.readdirSync(dir, { withFileTypes: true }).filter((e2) => !e2.name.startsWith(".")).flatMap((e2) => {
117870
117874
  const full = path24.join(dir, e2.name);
117871
117875
  return e2.isDirectory() ? filesOf(full, base) : [path24.relative(base, full).split(path24.sep).join("/")];
117872
117876
  });
117873
117877
  }
117874
- var officialId = (folder) => `wf_builtin_${folder.replace(/-/g, "_")}`;
117875
- var hashOf = (files) => crypto4.createHash("sha256").update(JSON.stringify(Object.entries(files).sort(([a2], [b2]) => a2 < b2 ? -1 : 1))).digest("hex");
117878
+ function readWorkflowFile(dir, file2) {
117879
+ const full = path24.join(dir, file2);
117880
+ return isAboutFile(file2) && !file2.endsWith(".md") ? `data:${MIME[path24.extname(file2)]};base64,${fs20.readFileSync(full).toString("base64")}` : fs20.readFileSync(full, "utf8");
117881
+ }
117882
+ var readWorkflowFolder = (dir) => Object.fromEntries(filesOf(dir).sort().map((f2) => [f2, readWorkflowFile(dir, f2)]));
117883
+
117884
+ // ../official/pack.ts
117885
+ var OFFICIAL = path25.dirname(fileURLToPath2(import.meta.url));
117886
+ var dirs = (dir) => fs21.readdirSync(dir, { withFileTypes: true }).filter((e2) => e2.isDirectory()).map((e2) => e2.name).sort();
117887
+ var hashOf = (files) => crypto4.createHash("sha256").update(hashInput(files)).digest("hex");
117876
117888
  function packOfficial(root2 = OFFICIAL, loose = false) {
117877
- const agentsDir = path24.join(root2, "agents");
117889
+ const agentsDir = path25.join(root2, "agents");
117878
117890
  const agentFiles = Object.fromEntries(dirs(agentsDir).map((name) => {
117879
- const dir = path24.join(agentsDir, name);
117880
- return [name, Object.fromEntries(filesOf(dir).sort().map((f2) => [f2, fs20.readFileSync(path24.join(dir, f2), "utf8")]))];
117891
+ const dir = path25.join(agentsDir, name);
117892
+ return [name, readWorkflowFolder(dir)];
117881
117893
  }));
117882
117894
  for (const [name, own] of Object.entries(loose ? {} : agentFiles)) {
117883
117895
  const read3 = parseSpecAgent(own["AGENT.md"] ?? "", `official/agents/${name}/AGENT.md`, (p2) => own[p2] ?? null, true);
117884
117896
  if ("problem" in read3) throw new Error(read3.problem);
117885
117897
  }
117886
- const workflowsDir = path24.join(root2, "workflows");
117898
+ const workflowsDir = path25.join(root2, "workflows");
117887
117899
  return dirs(workflowsDir).map((folder) => {
117888
- const dir = path24.join(workflowsDir, folder);
117900
+ const dir = path25.join(workflowsDir, folder);
117889
117901
  const files = {};
117890
117902
  for (const f2 of filesOf(dir).sort()) {
117891
- if (f2 === WORKFLOW_FILE || f2 === MCP_FILE || f2.startsWith("skills/") || /^ABOUT(\.[a-z]{2})?\.md$/.test(f2)) files[f2] = fs20.readFileSync(path24.join(dir, f2), "utf8");
117892
- else if (isAboutFile(f2)) files[f2] = `data:${MIME[path24.extname(f2)]};base64,${fs20.readFileSync(path24.join(dir, f2)).toString("base64")}`;
117903
+ if (f2 === WORKFLOW_FILE || f2 === MCP_FILE || f2.startsWith("skills/") || isAboutFile(f2)) files[f2] = readWorkflowFile(dir, f2);
117893
117904
  }
117894
117905
  const read3 = checkWorkflowFiles({ [WORKFLOW_FILE]: files[WORKFLOW_FILE], ...Object.fromEntries(
117895
117906
  Object.entries(agentFiles).flatMap(([name, own]) => Object.entries(own).map(([f2, t2]) => [`agents/${name}/${f2}`, t2]))
@@ -117918,23 +117929,23 @@ function packOfficial(root2 = OFFICIAL, loose = false) {
117918
117929
  }
117919
117930
 
117920
117931
  // ../cli/src/lib/cloud/tasks.ts
117921
- import fs21 from "node:fs";
117922
- import path25 from "node:path";
117932
+ import fs22 from "node:fs";
117933
+ import path26 from "node:path";
117923
117934
  var TASK_ENV = "AI4KANBAN_TASK";
117924
117935
  function workspaceTask() {
117925
117936
  const id = process.env[TASK_ENV];
117926
117937
  return id && id.trim() ? id.trim() : null;
117927
117938
  }
117928
117939
  function runnerProject(board) {
117929
- if (path25.basename(board) !== "kanban" || path25.basename(path25.dirname(board)) !== ".akb") return null;
117930
- const linked = linkedProject(board, path25.dirname(path25.dirname(board)));
117940
+ if (path26.basename(board) !== "kanban" || path26.basename(path26.dirname(board)) !== ".akb") return null;
117941
+ const linked = linkedProject(board, path26.dirname(path26.dirname(board)));
117931
117942
  return linked.ok ? linked.value : null;
117932
117943
  }
117933
117944
  function linkedProject(board, root2) {
117934
- const file2 = path25.join(root2, ".akb", "base.json");
117935
- if (!fs21.existsSync(file2)) return { ok: true, value: null };
117945
+ const file2 = path26.join(root2, ".akb", "base.json");
117946
+ if (!fs22.existsSync(file2)) return { ok: true, value: null };
117936
117947
  try {
117937
- const base = JSON.parse(fs21.readFileSync(file2, "utf8"));
117948
+ const base = JSON.parse(fs22.readFileSync(file2, "utf8"));
117938
117949
  if (!base || typeof base !== "object" || base.project !== void 0 && (typeof base.project !== "string" || !base.project.trim()) || base.files !== void 0 && (!base.files || typeof base.files !== "object" || Array.isArray(base.files))) throw new Error();
117939
117950
  const projects = new Set(Object.keys(base.files ?? {}).flatMap((p2) => /^projects\/([^/]+)\//.exec(p2)?.[1] ?? []));
117940
117951
  if (typeof base.project === "string") projects.add(base.project);
@@ -117946,14 +117957,14 @@ function linkedProject(board, root2) {
117946
117957
  }
117947
117958
 
117948
117959
  // ../cli/src/lib/file-memo.ts
117949
- import fs22 from "node:fs";
117950
- import path26 from "node:path";
117960
+ import fs23 from "node:fs";
117961
+ import path27 from "node:path";
117951
117962
  function stamp(paths) {
117952
117963
  const parts = [];
117953
117964
  const visit = (p2) => {
117954
117965
  let st2;
117955
117966
  try {
117956
- st2 = fs22.statSync(p2, { bigint: true });
117967
+ st2 = fs23.statSync(p2, { bigint: true });
117957
117968
  } catch {
117958
117969
  parts.push(`${p2}:-`);
117959
117970
  return;
@@ -117965,11 +117976,11 @@ function stamp(paths) {
117965
117976
  parts.push(`${p2}/`);
117966
117977
  let names2;
117967
117978
  try {
117968
- names2 = fs22.readdirSync(p2).sort();
117979
+ names2 = fs23.readdirSync(p2).sort();
117969
117980
  } catch {
117970
117981
  return;
117971
117982
  }
117972
- for (const name of names2) if (name !== "node_modules" && name !== ".git") visit(path26.join(p2, name));
117983
+ for (const name of names2) if (name !== "node_modules" && name !== ".git") visit(path27.join(p2, name));
117973
117984
  };
117974
117985
  for (const p2 of paths) visit(p2);
117975
117986
  return parts.join("\n");
@@ -118015,29 +118026,29 @@ function memoByFiles(paths, read3) {
118015
118026
 
118016
118027
  // ../cli/src/lib/agent/cloud-workflows.ts
118017
118028
  var DEV = "AI4KANBAN_WORKFLOWS";
118018
- var root = () => path27.join(machineHome(), "workflows");
118029
+ var root = () => path28.join(machineHome(), "workflows");
118019
118030
  var safe = (name) => name.replace(/[^\w.@-]/g, "_");
118020
- var versionFile = (id, version) => path27.join(root(), "versions", `${safe(id)}@${version}.json`);
118021
- var listFile = (project) => path27.join(root(), "lists", `${safe(project)}.json`);
118022
- var pinFile = (task) => path27.join(root(), "tasks", `${safe(task)}.json`);
118031
+ var versionFile = (id, version) => path28.join(root(), "versions", `${safe(id)}@${version}.json`);
118032
+ var listFile = (project) => path28.join(root(), "lists", `${safe(project)}.json`);
118033
+ var pinFile = (task) => path28.join(root(), "tasks", `${safe(task)}.json`);
118023
118034
  function readJson(file2) {
118024
118035
  try {
118025
- return JSON.parse(fs23.readFileSync(file2, "utf8"));
118036
+ return JSON.parse(fs24.readFileSync(file2, "utf8"));
118026
118037
  } catch {
118027
118038
  return null;
118028
118039
  }
118029
118040
  }
118030
118041
  function writeJson(file2, value) {
118031
- fs23.mkdirSync(path27.dirname(file2), { recursive: true });
118042
+ fs24.mkdirSync(path28.dirname(file2), { recursive: true });
118032
118043
  const tmp = `${file2}.${process.pid}.tmp`;
118033
- fs23.writeFileSync(tmp, `${JSON.stringify(value)}
118044
+ fs24.writeFileSync(tmp, `${JSON.stringify(value)}
118034
118045
  `);
118035
- fs23.renameSync(tmp, file2);
118046
+ fs24.renameSync(tmp, file2);
118036
118047
  }
118037
118048
  var readVersion2 = (id, version) => readJson(versionFile(id, version));
118038
118049
  function saveVersion(held4) {
118039
118050
  const file2 = versionFile(held4.id, held4.version);
118040
- if (!fs23.existsSync(file2)) writeJson(file2, { id: held4.id, version: held4.version, name: held4.name, names: held4.names, files: held4.files });
118051
+ if (!fs24.existsSync(file2)) writeJson(file2, { id: held4.id, version: held4.version, name: held4.name, names: held4.names, files: held4.files });
118041
118052
  }
118042
118053
  function savePin(task, held4) {
118043
118054
  saveVersion(held4);
@@ -118114,8 +118125,8 @@ function executionOf(value = process.env.AI4KANBAN_EXECUTION) {
118114
118125
  }
118115
118126
 
118116
118127
  // ../cli/src/lib/agent/store.ts
118117
- import fs24 from "node:fs";
118118
- import path28 from "node:path";
118128
+ import fs25 from "node:fs";
118129
+ import path29 from "node:path";
118119
118130
 
118120
118131
  // ../cli/src/lib/agent/log.ts
118121
118132
  var STRAY_MS = 24 * 60 * 60 * 1e3;
@@ -118141,9 +118152,9 @@ function asContext(v) {
118141
118152
  }
118142
118153
 
118143
118154
  // ../cli/src/lib/agent/store.ts
118144
- var logPathOf = (sessionId) => path28.join(SESSIONS_DIR, `${sessionId}.log`);
118155
+ var logPathOf = (sessionId) => path29.join(SESSIONS_DIR, `${sessionId}.log`);
118145
118156
  function logPathIn(held4, sessionId) {
118146
- return typeof held4 === "string" && held4.startsWith(SESSIONS_DIR + path28.sep) ? held4 : logPathOf(sessionId);
118157
+ return typeof held4 === "string" && held4.startsWith(SESSIONS_DIR + path29.sep) ? held4 : logPathOf(sessionId);
118147
118158
  }
118148
118159
  var WAS_CLARIFY = /* @__PURE__ */ new Set(["auto-refine", "refine", "raise-questions"]);
118149
118160
  var RETIRED_ACTIONS = /* @__PURE__ */ new Set([
@@ -118168,7 +118179,7 @@ var readStore = memoByFiles(() => [SESSIONS], parseStore);
118168
118179
  function parseStore() {
118169
118180
  let data;
118170
118181
  try {
118171
- data = JSON.parse(fs24.readFileSync(SESSIONS, "utf8"));
118182
+ data = JSON.parse(fs25.readFileSync(SESSIONS, "utf8"));
118172
118183
  } catch {
118173
118184
  return { runs: [], deliveries: [], marks: {} };
118174
118185
  }
@@ -118617,8 +118628,8 @@ var FLOWS = [
118617
118628
  ];
118618
118629
 
118619
118630
  // ../cli/src/lib/agents/catalog.ts
118620
- import fs25 from "node:fs";
118621
- import path29 from "node:path";
118631
+ import fs26 from "node:fs";
118632
+ import path30 from "node:path";
118622
118633
 
118623
118634
  // ../cli/src/lib/agents/bundled.ts
118624
118635
  var shippedAgentFiles = () => cloudAgentFiles().files;
@@ -118675,7 +118686,7 @@ function readCatalog() {
118675
118686
  }
118676
118687
  for (const folder of projectFolders(LEGACY_AGENTS)) {
118677
118688
  take(readProject2(LEGACY_AGENTS, folder), folder);
118678
- problems.push(`${rel(path29.join(LEGACY_AGENTS, folder))}: move it to ${rel(path29.join(AGENTS, folder))}/`);
118689
+ problems.push(`${rel(path30.join(LEGACY_AGENTS, folder))}: move it to ${rel(path30.join(AGENTS, folder))}/`);
118679
118690
  }
118680
118691
  return { agents, problems, refused };
118681
118692
  }
@@ -118740,7 +118751,7 @@ function readBundled(folder) {
118740
118751
  function projectFolders(root2) {
118741
118752
  let entries;
118742
118753
  try {
118743
- entries = fs25.readdirSync(root2, { withFileTypes: true });
118754
+ entries = fs26.readdirSync(root2, { withFileTypes: true });
118744
118755
  } catch {
118745
118756
  return [];
118746
118757
  }
@@ -118751,10 +118762,10 @@ var LEGACY_AGENT_FILE = "SKILL.md";
118751
118762
  var AGENT_FILES = [AGENT_FILE, LEGACY_AGENT_FILE];
118752
118763
  function agentFileReader(dir) {
118753
118764
  return (relative) => {
118754
- const target = path29.resolve(dir, relative);
118755
- if (target !== dir && !target.startsWith(dir + path29.sep)) return null;
118765
+ const target = path30.resolve(dir, relative);
118766
+ if (target !== dir && !target.startsWith(dir + path30.sep)) return null;
118756
118767
  try {
118757
- return fs25.readFileSync(target, "utf8");
118768
+ return fs26.readFileSync(target, "utf8");
118758
118769
  } catch {
118759
118770
  return null;
118760
118771
  }
@@ -118764,22 +118775,22 @@ var ownFiles = (paths) => paths.filter((p2) => !AGENT_FILES.includes(p2) && !p2.
118764
118775
  function walkFolder(dir, prefix) {
118765
118776
  let entries;
118766
118777
  try {
118767
- entries = fs25.readdirSync(dir, { withFileTypes: true });
118778
+ entries = fs26.readdirSync(dir, { withFileTypes: true });
118768
118779
  } catch {
118769
118780
  return [];
118770
118781
  }
118771
118782
  return entries.flatMap((e2) => {
118772
118783
  const here = prefix ? `${prefix}/${e2.name}` : e2.name;
118773
- return e2.isDirectory() ? walkFolder(path29.join(dir, e2.name), here) : [here];
118784
+ return e2.isDirectory() ? walkFolder(path30.join(dir, e2.name), here) : [here];
118774
118785
  });
118775
118786
  }
118776
118787
  function readProject2(root2, folder) {
118777
- const dir = path29.join(root2, folder);
118788
+ const dir = path30.join(root2, folder);
118778
118789
  const file2 = agentFileReader(dir);
118779
118790
  const found = AGENT_FILES.map((name) => ({ name, text: file2(name) })).find((f2) => f2.text !== null);
118780
- const missing = rel(path29.join(dir, AGENT_FILE));
118791
+ const missing = rel(path30.join(dir, AGENT_FILE));
118781
118792
  if (!found) return { problem: `${missing} is missing`, file: missing, missing: true };
118782
- const from = rel(path29.join(dir, found.name));
118793
+ const from = rel(path30.join(dir, found.name));
118783
118794
  const read3 = parseSpecAgent(found.text, from, file2, false, () => ownFiles(walkFolder(dir, "")));
118784
118795
  if ("problem" in read3) return { ...read3, file: from };
118785
118796
  if ("agent" in read3) Object.assign(read3.agent, { dir, text: found.text });
@@ -118981,8 +118992,8 @@ var SEEDED_GOAL_PARAGRAPHS = new Set(
118981
118992
  );
118982
118993
 
118983
118994
  // ../cli/src/lib/agent/settings.ts
118984
- import fs26 from "node:fs";
118985
- import path30 from "node:path";
118995
+ import fs27 from "node:fs";
118996
+ import path31 from "node:path";
118986
118997
 
118987
118998
  // ../cli/src/lib/agent/types.ts
118988
118999
  var NOT_COMPLETED = "The delivery has not recorded completion.";
@@ -118994,8 +119005,8 @@ function configBlock(value) {
118994
119005
  }
118995
119006
  function readConfigRaw() {
118996
119007
  adoptLegacyConfig();
118997
- if (!fs26.existsSync(UI_CONFIG)) return {};
118998
- return adoptProjectNames(JSON.parse(fs26.readFileSync(UI_CONFIG, "utf8")));
119008
+ if (!fs27.existsSync(UI_CONFIG)) return {};
119009
+ return adoptProjectNames(JSON.parse(fs27.readFileSync(UI_CONFIG, "utf8")));
118999
119010
  }
119000
119011
  function adoptProjectNames(cfg) {
119001
119012
  if (!cfg || typeof cfg !== "object") return cfg;
@@ -119010,12 +119021,12 @@ function adoptProjectNames(cfg) {
119010
119021
  return cfg;
119011
119022
  }
119012
119023
  function adoptLegacyConfig() {
119013
- if (!LEGACY_UI_CONFIG || !fs26.existsSync(LEGACY_UI_CONFIG)) return;
119014
- if (!fs26.existsSync(UI_CONFIG)) {
119015
- fs26.mkdirSync(path30.dirname(UI_CONFIG), { recursive: true });
119016
- fs26.copyFileSync(LEGACY_UI_CONFIG, UI_CONFIG);
119024
+ if (!LEGACY_UI_CONFIG || !fs27.existsSync(LEGACY_UI_CONFIG)) return;
119025
+ if (!fs27.existsSync(UI_CONFIG)) {
119026
+ fs27.mkdirSync(path31.dirname(UI_CONFIG), { recursive: true });
119027
+ fs27.copyFileSync(LEGACY_UI_CONFIG, UI_CONFIG);
119017
119028
  }
119018
- fs26.rmSync(LEGACY_UI_CONFIG, { force: true });
119029
+ fs27.rmSync(LEGACY_UI_CONFIG, { force: true });
119019
119030
  forgetFileMemos();
119020
119031
  }
119021
119032
  function safeConfig() {
@@ -119027,21 +119038,21 @@ function safeConfig() {
119027
119038
  }
119028
119039
 
119029
119040
  // ../cli/src/lib/agent/workflow-file.ts
119030
- import fs27 from "node:fs";
119031
- import path31 from "node:path";
119041
+ import fs28 from "node:fs";
119042
+ import path32 from "node:path";
119032
119043
  var WORKFLOW_FILE2 = "WORKFLOW.md";
119033
119044
  var builtinDefs = () => cloudFlows().filter((f2) => f2.builtIn).map((f2) => f2.def);
119034
- var fileOf = (id) => path31.join(WORKFLOWS, id, WORKFLOW_FILE2);
119045
+ var fileOf = (id) => path32.join(WORKFLOWS, id, WORKFLOW_FILE2);
119035
119046
  function draftId() {
119036
119047
  const task = workspaceTask();
119037
119048
  if (!task) return null;
119038
119049
  const id = draftFolder(task);
119039
- return fs27.existsSync(fileOf(id)) ? id : null;
119050
+ return fs28.existsSync(fileOf(id)) ? id : null;
119040
119051
  }
119041
119052
  function readFolder(id, problems) {
119042
119053
  let source;
119043
119054
  try {
119044
- source = fs27.readFileSync(fileOf(id), "utf8");
119055
+ source = fs28.readFileSync(fileOf(id), "utf8");
119045
119056
  } catch {
119046
119057
  problems.push(`${rel(fileOf(id))} is missing`);
119047
119058
  return null;
@@ -119236,8 +119247,8 @@ function renderError(error) {
119236
119247
  init_dress_page();
119237
119248
 
119238
119249
  // ../cli/src/lib/agents/shared-memory.ts
119239
- import fs30 from "node:fs";
119240
- import path34 from "node:path";
119250
+ import fs31 from "node:fs";
119251
+ import path35 from "node:path";
119241
119252
  function sharedMemory(board) {
119242
119253
  const declared = /* @__PURE__ */ new Map();
119243
119254
  const take = (folder, text4, builtIn) => {
@@ -119249,16 +119260,16 @@ function sharedMemory(board) {
119249
119260
  const at2 = /^([^/]+)\/AGENT\.md$/.exec(key);
119250
119261
  if (at2) take(at2[1], text4, officialAgent(at2[1]));
119251
119262
  }
119252
- const root2 = path34.join(board, "agents");
119263
+ const root2 = path35.join(board, "agents");
119253
119264
  let folders2 = [];
119254
119265
  try {
119255
- folders2 = fs30.readdirSync(root2, { withFileTypes: true }).filter((e2) => e2.isDirectory() && !e2.name.startsWith(".")).map((e2) => e2.name);
119266
+ folders2 = fs31.readdirSync(root2, { withFileTypes: true }).filter((e2) => e2.isDirectory() && !e2.name.startsWith(".")).map((e2) => e2.name);
119256
119267
  } catch {
119257
119268
  }
119258
119269
  for (const folder of folders2.sort()) {
119259
119270
  let text4 = null;
119260
119271
  try {
119261
- text4 = fs30.readFileSync(path34.join(root2, folder, "AGENT.md"), "utf8");
119272
+ text4 = fs31.readFileSync(path35.join(root2, folder, "AGENT.md"), "utf8");
119262
119273
  } catch {
119263
119274
  }
119264
119275
  take(folder, text4, false);
@@ -119283,16 +119294,16 @@ function openTaskFolder(job, projectDir2) {
119283
119294
  if (!projectDir2) throw new Error(NO_FOLDER);
119284
119295
  keepOutOfGit(projectDir2);
119285
119296
  markUsed(projectDir2);
119286
- const board = path35.join(projectDir2, ".akb", "kanban");
119287
- fs31.mkdirSync(board, { recursive: true });
119297
+ const board = path36.join(projectDir2, ".akb", "kanban");
119298
+ fs32.mkdirSync(board, { recursive: true });
119288
119299
  return { task, cloudTask: task, board, cwd: projectDir2, project: job.project, number: job.number ?? null, workflow: job.workflow ?? job.flow?.workflow ?? null };
119289
119300
  }
119290
119301
  function openAgentFolder(job, projectDir2) {
119291
119302
  if (!job.project || !job.agent) throw new Error("This job names no project.");
119292
119303
  keepOutOfGit(projectDir2);
119293
119304
  markUsed(projectDir2);
119294
- const board = path35.join(projectDir2, ".akb", "kanban");
119295
- fs31.mkdirSync(board, { recursive: true });
119305
+ const board = path36.join(projectDir2, ".akb", "kanban");
119306
+ fs32.mkdirSync(board, { recursive: true });
119296
119307
  return {
119297
119308
  task: `agent-${safe2(job.agent.workflow ? `${job.agent.workflow}-${job.agent.name}` : job.agent.name)}`,
119298
119309
  cloudTask: job.agent.tasks?.[0]?.id ?? null,
@@ -119307,13 +119318,13 @@ function openDiscussionFolder(job, projectDir2) {
119307
119318
  if (!job.project) throw new Error("This job names no project.");
119308
119319
  keepOutOfGit(projectDir2);
119309
119320
  markUsed(projectDir2);
119310
- const board = path35.join(projectDir2, ".akb", "kanban");
119311
- fs31.mkdirSync(board, { recursive: true });
119321
+ const board = path36.join(projectDir2, ".akb", "kanban");
119322
+ fs32.mkdirSync(board, { recursive: true });
119312
119323
  return { task: "discussion", cloudTask: null, board, cwd: projectDir2, project: job.project, number: null, workflow: null };
119313
119324
  }
119314
119325
  var boardFolder = (ws) => ({ task: "board", cloudTask: null, board: ws.board, cwd: ws.cwd, project: ws.project, number: null, workflow: null });
119315
119326
  function keptBoard(cwd) {
119316
- const board = path35.join(cwd, ".akb", "kanban");
119327
+ const board = path36.join(cwd, ".akb", "kanban");
119317
119328
  const base = readBase({ cwd });
119318
119329
  const project = base.project ?? /^projects\/([^/]+)\//.exec(Object.keys(base.files).find((p2) => p2.startsWith("projects/")) ?? "")?.[1];
119319
119330
  return base.head_seq === null || !project ? null : boardFolder({ board, cwd, project });
@@ -119336,56 +119347,56 @@ function keepOutOfGit(dir, folders2 = SKILL_FOLDERS) {
119336
119347
  if (inside.status !== 0) return;
119337
119348
  const missing = [".akb/", ...folders2.map((f2) => `${f2}/`)].filter((p2) => git3("check-ignore", "-q", p2).status !== 0);
119338
119349
  if (!missing.length) return;
119339
- const exclude = path35.resolve(dir, inside.stdout.trim());
119340
- fs31.mkdirSync(path35.dirname(exclude), { recursive: true });
119341
- const held4 = fs31.existsSync(exclude) ? fs31.readFileSync(exclude, "utf8") : "";
119342
- fs31.writeFileSync(exclude, `${held4}${held4 && !held4.endsWith("\n") ? "\n" : ""}${missing.join("\n")}
119350
+ const exclude = path36.resolve(dir, inside.stdout.trim());
119351
+ fs32.mkdirSync(path36.dirname(exclude), { recursive: true });
119352
+ const held4 = fs32.existsSync(exclude) ? fs32.readFileSync(exclude, "utf8") : "";
119353
+ fs32.writeFileSync(exclude, `${held4}${held4 && !held4.endsWith("\n") ? "\n" : ""}${missing.join("\n")}
119343
119354
  `);
119344
119355
  }
119345
- var cardFile = (ws) => (ws.number ? findCard(ws.board, ws.number) : null) ?? path35.join(ws.board, "todo", `${ws.number ?? 0}-task.md`);
119356
+ var cardFile = (ws) => (ws.number ? findCard(ws.board, ws.number) : null) ?? path36.join(ws.board, "todo", `${ws.number ?? 0}-task.md`);
119346
119357
  function findCard(board, number) {
119347
119358
  const named2 = new RegExp(`^${number}-`);
119348
119359
  const walk = (dir) => {
119349
119360
  let entries;
119350
119361
  try {
119351
- entries = fs31.readdirSync(dir, { withFileTypes: true });
119362
+ entries = fs32.readdirSync(dir, { withFileTypes: true });
119352
119363
  } catch {
119353
119364
  return null;
119354
119365
  }
119355
119366
  for (const e2 of entries) {
119356
119367
  if (!named2.test(e2.name)) continue;
119357
- if (e2.isFile() && e2.name.endsWith(".md")) return path35.join(dir, e2.name);
119358
- const root2 = path35.join(dir, e2.name, "root.md");
119359
- if (e2.isDirectory() && fs31.existsSync(root2)) return root2;
119368
+ if (e2.isFile() && e2.name.endsWith(".md")) return path36.join(dir, e2.name);
119369
+ const root2 = path36.join(dir, e2.name, "root.md");
119370
+ if (e2.isDirectory() && fs32.existsSync(root2)) return root2;
119360
119371
  }
119361
119372
  for (const e2 of entries) if (e2.isDirectory() && !e2.name.startsWith(".")) {
119362
- const hit = walk(path35.join(dir, e2.name));
119373
+ const hit = walk(path36.join(dir, e2.name));
119363
119374
  if (hit) return hit;
119364
119375
  }
119365
119376
  return null;
119366
119377
  };
119367
- return walk(path35.join(board, "todo")) ?? walk(path35.join(board, ".archive"));
119378
+ return walk(path36.join(board, "todo")) ?? walk(path36.join(board, ".archive"));
119368
119379
  }
119369
119380
  function akbCardOf(ws) {
119370
119381
  return ws.number && findCard(ws.board, ws.number) ? ws.number : void 0;
119371
119382
  }
119372
- var recordFile = (ws) => path35.join(ws.board, ".sync", `${ws.task}.json`);
119383
+ var recordFile = (ws) => path36.join(ws.board, ".sync", `${ws.task}.json`);
119373
119384
  function readRecord(ws) {
119374
119385
  try {
119375
- return { ...EMPTY, ...JSON.parse(fs31.readFileSync(recordFile(ws), "utf8")) };
119386
+ return { ...EMPTY, ...JSON.parse(fs32.readFileSync(recordFile(ws), "utf8")) };
119376
119387
  } catch {
119377
119388
  return structuredClone(EMPTY);
119378
119389
  }
119379
119390
  }
119380
119391
  function writeRecord(ws, record) {
119381
- fs31.mkdirSync(path35.dirname(recordFile(ws)), { recursive: true });
119382
- fs31.writeFileSync(recordFile(ws), `${JSON.stringify(record, null, 2)}
119392
+ fs32.mkdirSync(path36.dirname(recordFile(ws)), { recursive: true });
119393
+ fs32.writeFileSync(recordFile(ws), `${JSON.stringify(record, null, 2)}
119383
119394
  `);
119384
119395
  }
119385
- var baseFile = (ws) => path35.join(ws.cwd, ".akb", "base.json");
119396
+ var baseFile = (ws) => path36.join(ws.cwd, ".akb", "base.json");
119386
119397
  function readBase(ws) {
119387
119398
  try {
119388
- const base = JSON.parse(fs31.readFileSync(baseFile(ws), "utf8"));
119399
+ const base = JSON.parse(fs32.readFileSync(baseFile(ws), "utf8"));
119389
119400
  if (base.layout === "workspace") return base;
119390
119401
  } catch {
119391
119402
  }
@@ -119393,25 +119404,25 @@ function readBase(ws) {
119393
119404
  }
119394
119405
  function writeBase(ws, base) {
119395
119406
  const file2 = baseFile(ws);
119396
- fs31.mkdirSync(path35.dirname(file2), { recursive: true });
119397
- fs31.writeFileSync(`${file2}.tmp`, JSON.stringify(base));
119398
- fs31.renameSync(`${file2}.tmp`, file2);
119407
+ fs32.mkdirSync(path36.dirname(file2), { recursive: true });
119408
+ fs32.writeFileSync(`${file2}.tmp`, JSON.stringify(base));
119409
+ fs32.renameSync(`${file2}.tmp`, file2);
119399
119410
  }
119400
119411
  var hashOf2 = (bytes2) => crypto5.createHash("sha256").update(bytes2).digest("hex");
119401
119412
  function hashFile(file2) {
119402
119413
  try {
119403
- return hashOf2(fs31.readFileSync(file2));
119414
+ return hashOf2(fs32.readFileSync(file2));
119404
119415
  } catch {
119405
119416
  return null;
119406
119417
  }
119407
119418
  }
119408
119419
  function write(file2, bytes2) {
119409
- fs31.mkdirSync(path35.dirname(file2), { recursive: true });
119410
- fs31.writeFileSync(file2, bytes2);
119420
+ fs32.mkdirSync(path36.dirname(file2), { recursive: true });
119421
+ fs32.writeFileSync(file2, bytes2);
119411
119422
  }
119412
119423
  function readText(file2) {
119413
119424
  try {
119414
- return fs31.readFileSync(file2, "utf8");
119425
+ return fs32.readFileSync(file2, "utf8");
119415
119426
  } catch {
119416
119427
  return null;
119417
119428
  }
@@ -119419,14 +119430,14 @@ function readText(file2) {
119419
119430
  function filesUnder(dir, base = dir) {
119420
119431
  let entries;
119421
119432
  try {
119422
- entries = fs31.readdirSync(dir, { withFileTypes: true });
119433
+ entries = fs32.readdirSync(dir, { withFileTypes: true });
119423
119434
  } catch {
119424
119435
  return [];
119425
119436
  }
119426
119437
  return entries.flatMap((e2) => {
119427
- const full = path35.join(dir, e2.name);
119438
+ const full = path36.join(dir, e2.name);
119428
119439
  if (e2.isDirectory()) return filesUnder(full, base);
119429
- return e2.isFile() ? [path35.relative(base, full).split(path35.sep).join("/")] : [];
119440
+ return e2.isFile() ? [path36.relative(base, full).split(path36.sep).join("/")] : [];
119430
119441
  });
119431
119442
  }
119432
119443
  var kept3 = isBoardPath;
@@ -119449,18 +119460,18 @@ function assetFiles(ws, list) {
119449
119460
  return null;
119450
119461
  }
119451
119462
  };
119452
- return new Set(Object.keys(assetsOf(list)).map(at2).filter((f2) => !!f2).map((f2) => path35.relative(ws.board, f2).split(path35.sep).join("/")));
119463
+ return new Set(Object.keys(assetsOf(list)).map(at2).filter((f2) => !!f2).map((f2) => path36.relative(ws.board, f2).split(path36.sep).join("/")));
119453
119464
  }
119454
119465
  var assetsListOf = (ws, base) => base.files[rootOf(ws) + assetsFile(ws.task)]?.content;
119455
119466
  var localFiles = (ws, base) => {
119456
- const assets = /* @__PURE__ */ new Set([...assetFiles(ws, assetsListOf(ws, base)), ...assetFiles(ws, readText(path35.join(ws.board, assetsFile(ws.task))))]);
119467
+ const assets = /* @__PURE__ */ new Set([...assetFiles(ws, assetsListOf(ws, base)), ...assetFiles(ws, readText(path36.join(ws.board, assetsFile(ws.task))))]);
119457
119468
  return filesUnder(ws.board).filter((p2) => kept3(p2) && !assets.has(p2));
119458
119469
  };
119459
119470
  var SKILL_PATH = /^skills\/([a-z0-9]+(?:-[a-z0-9]+)*)\/((?:[\w.-]+\/)*[\w.-]+)$/;
119460
119471
  function pullTools(ws, record, files) {
119461
119472
  const held4 = record.tools?.skills ?? {};
119462
119473
  const ours = new Set(Object.keys(held4).map((name) => name.split("/")[1]));
119463
- const theirs = (skill) => !ours.has(skill) && SKILL_ROOTS.some((root2) => fs31.existsSync(path35.join(ws.cwd, root2, skill)));
119474
+ const theirs = (skill) => !ours.has(skill) && SKILL_ROOTS.some((root2) => fs32.existsSync(path36.join(ws.cwd, root2, skill)));
119464
119475
  const kept4 = Object.keys(files).map((name) => SKILL_PATH.exec(name)?.[1]).filter((skill) => skill && !theirs(skill));
119465
119476
  const skills = {};
119466
119477
  for (const [name, text4] of Object.entries(files)) {
@@ -119468,7 +119479,7 @@ function pullTools(ws, record, files) {
119468
119479
  if (!at2 || at2[1] === "kanban" || !kept4.includes(at2[1]) || at2[2].split("/").includes("..")) continue;
119469
119480
  skills[name] = hashOf2(text4);
119470
119481
  for (const root2 of SKILL_ROOTS) {
119471
- const file2 = path35.join(ws.cwd, root2, at2[1], at2[2]);
119482
+ const file2 = path36.join(ws.cwd, root2, at2[1], at2[2]);
119472
119483
  if (held4[name] !== skills[name] || hashFile(file2) !== skills[name]) write(file2, text4);
119473
119484
  }
119474
119485
  }
@@ -119477,8 +119488,8 @@ function pullTools(ws, record, files) {
119477
119488
  const [, skill, rest] = SKILL_PATH.exec(name) ?? [];
119478
119489
  if (!skill || !rest) continue;
119479
119490
  for (const root2 of SKILL_ROOTS) {
119480
- fs31.rmSync(path35.join(ws.cwd, root2, skill, rest), { force: true });
119481
- if (!Object.keys(skills).some((n) => n.startsWith(`skills/${skill}/`))) fs31.rmSync(path35.join(ws.cwd, root2, skill), { recursive: true, force: true });
119491
+ fs32.rmSync(path36.join(ws.cwd, root2, skill, rest), { force: true });
119492
+ if (!Object.keys(skills).some((n) => n.startsWith(`skills/${skill}/`))) fs32.rmSync(path36.join(ws.cwd, root2, skill), { recursive: true, force: true });
119482
119493
  }
119483
119494
  }
119484
119495
  const names2 = [...new Set(Object.keys(skills).map((name) => name.split("/")[1]))];
@@ -119515,57 +119526,57 @@ async function pullWorkflow(ws, record) {
119515
119526
  if (files.ok) pullTools(ws, record, files.value);
119516
119527
  }
119517
119528
  dropPlacedAgents(ws);
119518
- for (const name of Object.keys(record.agents ?? {})) fs31.rmSync(path35.join(ws.board, name), { force: true });
119529
+ for (const name of Object.keys(record.agents ?? {})) fs32.rmSync(path36.join(ws.board, name), { force: true });
119519
119530
  record.agents = {};
119520
119531
  return { ok: true, value: void 0 };
119521
119532
  }
119522
- var agentsRecord = (ws) => path35.join(ws.board, ".sync", "agents.json");
119533
+ var agentsRecord = (ws) => path36.join(ws.board, ".sync", "agents.json");
119523
119534
  function readPlaced(ws) {
119524
119535
  try {
119525
- return JSON.parse(fs31.readFileSync(agentsRecord(ws), "utf8"));
119536
+ return JSON.parse(fs32.readFileSync(agentsRecord(ws), "utf8"));
119526
119537
  } catch {
119527
119538
  return {};
119528
119539
  }
119529
119540
  }
119530
119541
  function dropPlacedAgents(ws) {
119531
119542
  const placed = readPlaced(ws);
119532
- for (const name of Object.keys(placed)) if (hashFile(path35.join(ws.board, name)) === placed[name]) fs31.rmSync(path35.join(ws.board, name), { force: true });
119533
- fs31.rmSync(agentsRecord(ws), { force: true });
119543
+ for (const name of Object.keys(placed)) if (hashFile(path36.join(ws.board, name)) === placed[name]) fs32.rmSync(path36.join(ws.board, name), { force: true });
119544
+ fs32.rmSync(agentsRecord(ws), { force: true });
119534
119545
  }
119535
119546
  function pullDraftAgents(ws, record) {
119536
119547
  if (ws.workflow !== BUILDER) return;
119537
- const root2 = path35.join(ws.board, "workflows", draftFolder(ws.task), "agents");
119548
+ const root2 = path36.join(ws.board, "workflows", draftFolder(ws.task), "agents");
119538
119549
  record.agents ??= {};
119539
119550
  for (const name of filesUnder(root2)) {
119540
- const text4 = fs31.readFileSync(path35.join(root2, name));
119551
+ const text4 = fs32.readFileSync(path36.join(root2, name));
119541
119552
  const at2 = `agents/${name}`;
119542
119553
  record.agents[at2] = hashOf2(text4);
119543
- if (hashFile(path35.join(ws.board, at2)) !== record.agents[at2]) write(path35.join(ws.board, at2), text4);
119554
+ if (hashFile(path36.join(ws.board, at2)) !== record.agents[at2]) write(path36.join(ws.board, at2), text4);
119544
119555
  }
119545
119556
  }
119546
119557
  function assetPath(ws, name, owner) {
119547
119558
  if (/^[a-z][\w+.-]*:/i.test(name) || name.startsWith("#") || name.startsWith("//")) return null;
119548
- if (path35.isAbsolute(name)) throw new Error(`absolute path: ${name}`);
119559
+ if (path36.isAbsolute(name)) throw new Error(`absolute path: ${name}`);
119549
119560
  const held4 = /^\.(assets|mockups)\//.exec(name);
119550
119561
  const state = stateDir(ws);
119551
- const root2 = held4 && state ? path35.join(state, held4[1]) : ws.board;
119552
- const file2 = held4 && state ? path35.resolve(root2, name.slice(held4[0].length)) : path35.resolve(path35.dirname(owner), name);
119553
- const roots = [ws.board, ...state ? ["assets", "mockups"].map((folder) => path35.join(state, folder, ...ws.number ? [String(ws.number)] : [])) : []];
119554
- const inside = (file3, root3) => file3.startsWith(root3 + path35.sep);
119562
+ const root2 = held4 && state ? path36.join(state, held4[1]) : ws.board;
119563
+ const file2 = held4 && state ? path36.resolve(root2, name.slice(held4[0].length)) : path36.resolve(path36.dirname(owner), name);
119564
+ const roots = [ws.board, ...state ? ["assets", "mockups"].map((folder) => path36.join(state, folder, ...ws.number ? [String(ws.number)] : [])) : []];
119565
+ const inside = (file3, root3) => file3.startsWith(root3 + path36.sep);
119555
119566
  if (!roots.some((root3) => inside(file2, root3))) throw new Error(`outside the board: ${name}`);
119556
119567
  let existing = file2;
119557
- while (!fs31.existsSync(existing) && path35.dirname(existing) !== existing) existing = path35.dirname(existing);
119558
- const real = path35.join(fs31.realpathSync(existing), path35.relative(existing, file2));
119568
+ while (!fs32.existsSync(existing) && path36.dirname(existing) !== existing) existing = path36.dirname(existing);
119569
+ const real = path36.join(fs32.realpathSync(existing), path36.relative(existing, file2));
119559
119570
  let stateParent = state;
119560
- while (stateParent && !fs31.existsSync(stateParent) && path35.dirname(stateParent) !== stateParent) stateParent = path35.dirname(stateParent);
119561
- const realState = state && stateParent ? path35.resolve(fs31.realpathSync(stateParent), path35.relative(stateParent, state)) : null;
119562
- const realRoots = [fs31.realpathSync(ws.board), ...realState ? ["assets", "mockups"].map((folder) => path35.join(realState, folder, ...ws.number ? [String(ws.number)] : [])) : []];
119571
+ while (stateParent && !fs32.existsSync(stateParent) && path36.dirname(stateParent) !== stateParent) stateParent = path36.dirname(stateParent);
119572
+ const realState = state && stateParent ? path36.resolve(fs32.realpathSync(stateParent), path36.relative(stateParent, state)) : null;
119573
+ const realRoots = [fs32.realpathSync(ws.board), ...realState ? ["assets", "mockups"].map((folder) => path36.join(realState, folder, ...ws.number ? [String(ws.number)] : [])) : []];
119563
119574
  if (!realRoots.some((root3) => real === root3 || inside(real, root3))) throw new Error(`link outside the board: ${name}`);
119564
119575
  return file2;
119565
119576
  }
119566
119577
  function cardAssetsDir(ws, id) {
119567
119578
  const state = stateDir(ws);
119568
- return state && path35.join(state, "assets", String(id));
119579
+ return state && path36.join(state, "assets", String(id));
119569
119580
  }
119570
119581
  function stateDir(ws) {
119571
119582
  try {
@@ -119607,13 +119618,13 @@ var pullChanges = (ws) => inFolder(ws.cwd, async () => {
119607
119618
  const p2 = f2.path.startsWith(root2) ? f2.path.slice(root2.length) : f2.path;
119608
119619
  const isShared = p2.startsWith(MEMORY2) && shared(p2.slice(MEMORY2.length));
119609
119620
  if (kept3(p2) && isShared === !f2.path.startsWith(root2)) {
119610
- const file2 = path35.join(ws.board, p2);
119621
+ const file2 = path36.join(ws.board, p2);
119611
119622
  const here = readText(file2);
119612
119623
  if (here !== f2.content && here !== (base.files[f2.path]?.content ?? null)) {
119613
119624
  skipped = true;
119614
119625
  continue;
119615
119626
  }
119616
- if (f2.content === null) fs31.rmSync(file2, { force: true });
119627
+ if (f2.content === null) fs32.rmSync(file2, { force: true });
119617
119628
  else if (here !== f2.content) write(file2, f2.content);
119618
119629
  }
119619
119630
  if (f2.content === null) delete base.files[f2.path];
@@ -119627,7 +119638,7 @@ var pullChanges = (ws) => inFolder(ws.cwd, async () => {
119627
119638
  async function readCloud(ws) {
119628
119639
  const base = readBase(ws);
119629
119640
  const known2 = new Set(Object.keys(base.files));
119630
- const keepDraft = new Set((base.deferred ?? []).filter((p2) => readText(path35.join(ws.board, p2)) !== (base.files[rootOf(ws) + p2]?.content ?? null)));
119641
+ const keepDraft = new Set((base.deferred ?? []).filter((p2) => readText(path36.join(ws.board, p2)) !== (base.files[rootOf(ws) + p2]?.content ?? null)));
119631
119642
  if (base.workspace === void 0) {
119632
119643
  const project = await readProject(ws.project);
119633
119644
  if (!project.ok) return project;
@@ -119645,13 +119656,13 @@ async function readCloud(ws) {
119645
119656
  writeBase(ws, base);
119646
119657
  const reset = (view2) => {
119647
119658
  for (const [p2, content] of view2) {
119648
- const file2 = path35.join(ws.board, p2);
119659
+ const file2 = path36.join(ws.board, p2);
119649
119660
  if (!keepDraft.has(p2) && kept3(p2) && readText(file2) !== content) write(file2, content);
119650
119661
  }
119651
119662
  };
119652
119663
  const view = viewOf(ws, base, sharedMemory(ws.board));
119653
119664
  const first = (p2) => isSettingsPath(p2) && !known2.has(rootOf(ws) + p2);
119654
- for (const p2 of localFiles(ws, base)) if (!keepDraft.has(p2) && !view.has(p2) && !first(p2)) fs31.rmSync(path35.join(ws.board, p2), { force: true });
119665
+ for (const p2 of localFiles(ws, base)) if (!keepDraft.has(p2) && !view.has(p2) && !first(p2)) fs32.rmSync(path36.join(ws.board, p2), { force: true });
119655
119666
  reset(view);
119656
119667
  const record = readRecord(ws);
119657
119668
  const workflow = await pullWorkflow(ws, record);
@@ -119665,18 +119676,18 @@ async function readCloud(ws) {
119665
119676
  return { ok: true, value: void 0 };
119666
119677
  }
119667
119678
  function writeIndex(board) {
119668
- const todo = path35.join(board, "todo");
119679
+ const todo = path36.join(board, "todo");
119669
119680
  const cards = [];
119670
119681
  let entries = [];
119671
119682
  try {
119672
- entries = fs31.readdirSync(todo, { withFileTypes: true });
119683
+ entries = fs32.readdirSync(todo, { withFileTypes: true });
119673
119684
  } catch {
119674
119685
  }
119675
119686
  for (const e2 of entries) {
119676
119687
  const id = /^(\d+)-/.exec(e2.name)?.[1];
119677
119688
  if (!id) continue;
119678
119689
  const link = e2.isDirectory() ? `${e2.name}/root.md` : e2.name.endsWith(".md") ? e2.name : null;
119679
- const text5 = link && readText(path35.join(todo, link));
119690
+ const text5 = link && readText(path36.join(todo, link));
119680
119691
  if (text5 === null || !link) continue;
119681
119692
  cards.push({ id: Number(id), title: cardFront(text5).title ?? e2.name.replace(/\.md$/, ""), link });
119682
119693
  }
@@ -119691,7 +119702,7 @@ the number at the front of a filename is the task id.
119691
119702
 
119692
119703
  ${list}
119693
119704
  `;
119694
- if (readText(path35.join(todo, "README.md")) !== text4) write(path35.join(todo, "README.md"), text4);
119705
+ if (readText(path36.join(todo, "README.md")) !== text4) write(path36.join(todo, "README.md"), text4);
119695
119706
  }
119696
119707
  var workspaceOf = (ws) => readBase(ws).workspace ?? null;
119697
119708
  async function pullAssets(ws, record, assets) {
@@ -119770,7 +119781,7 @@ async function pullAssets(ws, record, assets) {
119770
119781
  }
119771
119782
  if (!child) return src;
119772
119783
  dependencies.push(name2);
119773
- const back = !found.text && /^\.(assets|mockups)\//.test(name2) ? name2 : path35.relative(path35.dirname(target), child).split(path35.sep).join("/");
119784
+ const back = !found.text && /^\.(assets|mockups)\//.test(name2) ? name2 : path36.relative(path36.dirname(target), child).split(path36.sep).join("/");
119774
119785
  if (back !== src) changed = true;
119775
119786
  return back;
119776
119787
  });
@@ -119807,16 +119818,16 @@ async function readAsset(artifact, version) {
119807
119818
  return { ok: true, value: Buffer.from(typeof content === "string" ? content : JSON.stringify(content)) };
119808
119819
  }
119809
119820
  async function sentOf(file2, kind) {
119810
- const ext = path35.extname(file2).toLowerCase();
119811
- if (kind !== "html") return { bytes: fs31.readFileSync(file2), type: kind === "tiled" && ext === ".tsx" ? "application/xml" : TYPES[ext] ?? "application/octet-stream", kind };
119821
+ const ext = path36.extname(file2).toLowerCase();
119822
+ if (kind !== "html") return { bytes: fs32.readFileSync(file2), type: kind === "tiled" && ext === ".tsx" ? "application/xml" : TYPES[ext] ?? "application/octet-stream", kind };
119812
119823
  const page = await (await Promise.resolve().then(() => (init_mockup(), mockup_exports))).drawMockup(file2);
119813
119824
  return { bytes: Buffer.from(page), type: "text/html", kind };
119814
119825
  }
119815
- var undrawnPreviews = (ws) => Object.entries(assetsOf(readText(path35.join(ws.board, assetsFile(ws.task))))).flatMap(([key, ref]) => ref.error ? [`${key}: ${ref.error}`] : []);
119826
+ var undrawnPreviews = (ws) => Object.entries(assetsOf(readText(path36.join(ws.board, assetsFile(ws.task))))).flatMap(([key, ref]) => ref.error ? [`${key}: ${ref.error}`] : []);
119816
119827
  function undrawn(ws, reason) {
119817
119828
  const state = stateDir(ws);
119818
- for (const [root2, shown] of [...state ? [[path35.join(state, "assets"), ".assets"], [path35.join(state, "mockups"), ".mockups"]] : [], [ws.board, ""]]) {
119819
- reason = reason.split(`file://${root2}${path35.sep}`).join(shown && `${shown}/`).split(`${root2}${path35.sep}`).join(shown && `${shown}/`);
119829
+ for (const [root2, shown] of [...state ? [[path36.join(state, "assets"), ".assets"], [path36.join(state, "mockups"), ".mockups"]] : [], [ws.board, ""]]) {
119830
+ reason = reason.split(`file://${root2}${path36.sep}`).join(shown && `${shown}/`).split(`${root2}${path36.sep}`).join(shown && `${shown}/`);
119820
119831
  }
119821
119832
  return reason.replace(/ \(at [^)]*file:\/\/[^)]*\)$/, "").slice(0, 500);
119822
119833
  }
@@ -119839,14 +119850,14 @@ async function pushAssets(ws, record, before) {
119839
119850
  if (body === null) return { ok: true, value: void 0 };
119840
119851
  const refs = {};
119841
119852
  const canonical = (target) => {
119842
- const real = (file3) => fs31.existsSync(file3) ? fs31.realpathSync(file3) : path35.dirname(file3) === file3 ? file3 : path35.join(real(path35.dirname(file3)), path35.basename(file3));
119853
+ const real = (file3) => fs32.existsSync(file3) ? fs32.realpathSync(file3) : path36.dirname(file3) === file3 ? file3 : path36.join(real(path36.dirname(file3)), path36.basename(file3));
119843
119854
  target = real(target);
119844
119855
  const state = stateDir(ws);
119845
119856
  for (const folder of ["assets", "mockups"]) {
119846
- const root2 = state && real(path35.join(state, folder));
119847
- if (root2 && target.startsWith(root2 + path35.sep)) return `.${folder}/${path35.relative(root2, target).split(path35.sep).join("/")}`;
119857
+ const root2 = state && real(path36.join(state, folder));
119858
+ if (root2 && target.startsWith(root2 + path36.sep)) return `.${folder}/${path36.relative(root2, target).split(path36.sep).join("/")}`;
119848
119859
  }
119849
- return path35.relative(real(path35.dirname(file2)), target).split(path35.sep).join("/");
119860
+ return path36.relative(real(path36.dirname(file2)), target).split(path36.sep).join("/");
119850
119861
  };
119851
119862
  try {
119852
119863
  const graph = collect(body, file2, {
@@ -119856,11 +119867,11 @@ async function pushAssets(ws, record, before) {
119856
119867
  const target = assetPath(ws, src, owner);
119857
119868
  if (!target) return null;
119858
119869
  const key = owner === file2 && before[src] ? src : canonical(target);
119859
- if (!fs31.statSync(target, { throwIfNoEntry: false })?.isFile()) {
119870
+ if (!fs32.statSync(target, { throwIfNoEntry: false })?.isFile()) {
119860
119871
  if (before[key]) return { key, file: null };
119861
119872
  throw new Error(`file not found: ${target}`);
119862
119873
  }
119863
- return { key: canonical(fs31.realpathSync(target)), file: target };
119874
+ return { key: canonical(fs32.realpathSync(target)), file: target };
119864
119875
  },
119865
119876
  read: referenceText,
119866
119877
  retained: (key) => (record.assets[key]?.dependencies ?? []).map((src) => {
@@ -119933,7 +119944,7 @@ async function pushAssets(ws, record, before) {
119933
119944
  const unchanged = restored && previous && (previous.kind ?? out.kind) === out.kind && localHash === (previous.localHash ?? previous.hash) && [...node.dependencies.values()].every((key) => refs[key]?.artifact === before[key]?.artifact);
119934
119945
  if (!entry || !unchanged && entry.hash !== hash || entry.kind && entry.kind !== out.kind) {
119935
119946
  if (!ws.cloudTask) continue;
119936
- let artifact = previous && (previous.kind ?? kindOf(path35.extname(node.file).toLowerCase())) === out.kind ? previous.artifact : void 0;
119947
+ let artifact = previous && (previous.kind ?? kindOf(path36.extname(node.file).toLowerCase())) === out.kind ? previous.artifact : void 0;
119937
119948
  if (!artifact) {
119938
119949
  const made = await createArtifact(ws.cloudTask, node.key.slice(0, 200), out.kind);
119939
119950
  if (!made.ok) return { ...made, error: `${node.key}: ${made.error}` };
@@ -119953,24 +119964,24 @@ async function pushAssets(ws, record, before) {
119953
119964
  } catch (error) {
119954
119965
  return { ok: false, code: "bad_request", error: error instanceof Error ? error.message : String(error) };
119955
119966
  }
119956
- const list = path35.join(ws.board, assetsFile(ws.task));
119957
- if (Object.keys(refs).length || fs31.existsSync(list)) {
119967
+ const list = path36.join(ws.board, assetsFile(ws.task));
119968
+ if (Object.keys(refs).length || fs32.existsSync(list)) {
119958
119969
  if (JSON.stringify(assetsOf(readText(list))) !== JSON.stringify(refs)) write(list, assetsText(refs));
119959
119970
  }
119960
119971
  return { ok: true, value: void 0 };
119961
119972
  }
119962
119973
  function resetSorted(ws) {
119963
- for (const sub of ["dismissed", "archived"]) fs31.rmSync(path35.join(ws.board, "triage", sub), { recursive: true, force: true });
119974
+ for (const sub of ["dismissed", "archived"]) fs32.rmSync(path36.join(ws.board, "triage", sub), { recursive: true, force: true });
119964
119975
  for (const [p2, content] of viewOf(ws, readBase(ws), sharedMemory(ws.board))) {
119965
- if (/^triage\/(?:dismissed|archived)\//.test(p2)) write(path35.join(ws.board, p2), content);
119976
+ if (/^triage\/(?:dismissed|archived)\//.test(p2)) write(path36.join(ws.board, p2), content);
119966
119977
  }
119967
119978
  }
119968
119979
  function proposeItems(ws, base) {
119969
119980
  const root2 = rootOf(ws);
119970
119981
  for (const p2 of localFiles(ws, base)) {
119971
119982
  if (itemAt(p2)?.state !== "open" || base.files[root2 + p2]) continue;
119972
- const file2 = path35.join(ws.board, p2);
119973
- const content = fs31.readFileSync(file2, "utf8");
119983
+ const file2 = path36.join(ws.board, p2);
119984
+ const content = fs32.readFileSync(file2, "utf8");
119974
119985
  const said = (key) => new RegExp(`^${key}:`, "m").test(content.split(/\n---/)[0] ?? "");
119975
119986
  const fields = {
119976
119987
  ...ws.cloudTask && !said("source_task") ? { source_task: ws.cloudTask } : {},
@@ -120010,9 +120021,9 @@ async function send2(ws, job) {
120010
120021
  const record = readRecord(ws);
120011
120022
  const base = readBase(ws);
120012
120023
  const fail = (error, conflict = false, code) => ({ ok: false, conflict, error, ...code ? {} : { offline: true } });
120013
- const tasks = ws.cloudTask ? [{ folder: ws, record }] : filesUnder(path35.join(ws.board, ".sync")).filter((name) => name.endsWith(".json")).flatMap((name) => {
120024
+ const tasks = ws.cloudTask ? [{ folder: ws, record }] : filesUnder(path36.join(ws.board, ".sync")).filter((name) => name.endsWith(".json")).flatMap((name) => {
120014
120025
  try {
120015
- const held4 = JSON.parse(fs31.readFileSync(path35.join(ws.board, ".sync", name), "utf8"));
120026
+ const held4 = JSON.parse(fs32.readFileSync(path36.join(ws.board, ".sync", name), "utf8"));
120016
120027
  if (!held4.task || !TASK_ID.test(held4.task) || !held4.number) return [];
120017
120028
  return [{ folder: { ...ws, task: held4.task, cloudTask: held4.task, number: held4.number }, record: held4 }];
120018
120029
  } catch {
@@ -120024,7 +120035,7 @@ async function send2(ws, job) {
120024
120035
  const deferredLists = /* @__PURE__ */ new Set();
120025
120036
  const assetErrors = {};
120026
120037
  for (const item of tasks) {
120027
- const card = path35.relative(ws.board, cardFile(item.folder)).split(path35.sep).join("/");
120038
+ const card = path36.relative(ws.board, cardFile(item.folder)).split(path36.sep).join("/");
120028
120039
  const archived = boardSync && card.startsWith(".archive/") && base.files[rootOf(ws) + card];
120029
120040
  if (!archived) {
120030
120041
  const assets = await pushAssets(item.folder, item.record, assetsOf(assetsListOf(item.folder, base)));
@@ -120066,7 +120077,7 @@ async function send2(ws, job) {
120066
120077
  const owed = (p2) => !job.id && busy(ws.cwd) && itemAt(p2)?.state === "open" && !base.files[rootOf(ws) + p2];
120067
120078
  for (const p2 of local) {
120068
120079
  if (defer(p2) || owed(p2)) continue;
120069
- const content = fs31.readFileSync(path35.join(ws.board, p2), "utf8");
120080
+ const content = fs32.readFileSync(path36.join(ws.board, p2), "utf8");
120070
120081
  const remote2 = remoteOf(ws, shared, p2);
120071
120082
  localOf.set(remote2, p2);
120072
120083
  const held4 = base.files[remote2];
@@ -120098,15 +120109,15 @@ async function send2(ws, job) {
120098
120109
  changes.splice(at2, 1);
120099
120110
  delete base.files[theirs.path];
120100
120111
  writeBase(ws, base);
120101
- fs31.rmSync(path35.join(ws.board, p2), { force: true });
120112
+ fs32.rmSync(path36.join(ws.board, p2), { force: true });
120102
120113
  writeIndex(ws.board);
120103
120114
  continue;
120104
120115
  }
120105
120116
  if (at2 < 0) continue;
120106
120117
  const merged = itemAt(p2) ? { content: theirs.content } : mergeFile(base.files[theirs.path]?.content ?? null, changes[at2].content, theirs.content);
120107
120118
  changes[at2] = { path: theirs.path, content: merged.content, base_seq: theirs.seq };
120108
- if (merged.content === null) fs31.rmSync(path35.join(ws.board, p2), { force: true });
120109
- else write(path35.join(ws.board, p2), merged.content);
120119
+ if (merged.content === null) fs32.rmSync(path36.join(ws.board, p2), { force: true });
120120
+ else write(path36.join(ws.board, p2), merged.content);
120110
120121
  }
120111
120122
  if (!changes.length) return success(false);
120112
120123
  sent = await commitBoard(ws.project, job.id, job.machineId, changes);
@@ -120127,7 +120138,7 @@ var BUSY_MS = 3e4;
120127
120138
  function keptFolders() {
120128
120139
  let cached2 = [];
120129
120140
  try {
120130
- cached2 = fs32.readdirSync(cacheRoot()).map((name) => fs32.realpathSync(path36.join(cacheRoot(), name)));
120141
+ cached2 = fs33.readdirSync(cacheRoot()).map((name) => fs33.realpathSync(path37.join(cacheRoot(), name)));
120131
120142
  } catch {
120132
120143
  }
120133
120144
  return [.../* @__PURE__ */ new Set([...allowedProjects(), ...cached2])].flatMap((dir) => [keptBoard(dir)].filter((ws) => !!ws));
@@ -120163,8 +120174,8 @@ function watchBoards(machineId2, ms, lookMs = LOOK_MS, pullMs = PULL_MS, busyMs
120163
120174
  const watch = (ws) => {
120164
120175
  let watcher;
120165
120176
  try {
120166
- watcher = fs32.watch(ws.board, { recursive: true }, (_event, name) => {
120167
- const p2 = name && String(name).split(path36.sep).join("/");
120177
+ watcher = fs33.watch(ws.board, { recursive: true }, (_event, name) => {
120178
+ const p2 = name && String(name).split(path37.sep).join("/");
120168
120179
  const held4 = watched.get(ws.cwd);
120169
120180
  if (closed || !p2 || !isBoardPath(p2) || !held4) return;
120170
120181
  const job = busy(ws.cwd);
@@ -120227,8 +120238,8 @@ function watchBoards(machineId2, ms, lookMs = LOOK_MS, pullMs = PULL_MS, busyMs
120227
120238
 
120228
120239
  // src/diff.ts
120229
120240
  import { execFile as execFile2 } from "node:child_process";
120230
- import fs33 from "node:fs";
120231
- import path37 from "node:path";
120241
+ import fs34 from "node:fs";
120242
+ import path38 from "node:path";
120232
120243
  var FILE_BYTES = 256 * 1024;
120233
120244
  var TOTAL_BYTES = 1024 * 1024;
120234
120245
  var EMPTY_TREE = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
@@ -120245,7 +120256,7 @@ var git2 = (dir, args, maxBuffer = 4 * TOTAL_BYTES) => new Promise(
120245
120256
  function projectDir(placed, project) {
120246
120257
  if (placed) {
120247
120258
  const real = realpath3(placed);
120248
- return real && allowedProjects().some((root2) => real === root2 || real.startsWith(root2 + path37.sep)) ? real : null;
120259
+ return real && allowedProjects().some((root2) => real === root2 || real.startsWith(root2 + path38.sep)) ? real : null;
120249
120260
  }
120250
120261
  let cached2;
120251
120262
  try {
@@ -120253,11 +120264,11 @@ function projectDir(placed, project) {
120253
120264
  } catch {
120254
120265
  return null;
120255
120266
  }
120256
- return fs33.existsSync(path37.join(cached2, ".git")) ? cached2 : null;
120267
+ return fs34.existsSync(path38.join(cached2, ".git")) ? cached2 : null;
120257
120268
  }
120258
120269
  function realpath3(p2) {
120259
120270
  try {
120260
- return fs33.realpathSync(p2);
120271
+ return fs34.realpathSync(p2);
120261
120272
  } catch {
120262
120273
  return null;
120263
120274
  }
@@ -120304,20 +120315,20 @@ async function answerHint(machineId2, hint2) {
120304
120315
  // ../cli/src/lib/agent/stop.ts
120305
120316
  import { spawnSync as spawnSync4 } from "node:child_process";
120306
120317
  import { randomUUID as randomUUID2 } from "node:crypto";
120307
- import fs34 from "node:fs";
120318
+ import fs35 from "node:fs";
120308
120319
  var runMark = (sessionId) => ({ name: RUN_ENV, value: sessionId });
120309
120320
  var stopMark = () => ({ name: STOP_ENV, value: randomUUID2() });
120310
120321
  var markEnv = (env2, mark) => ({ ...env2, [mark.name]: mark.value });
120311
120322
  var WINDOWS3 = process.platform === "win32";
120312
120323
  function markedInProc(entry, strict = false) {
120313
120324
  const pids = [];
120314
- for (const name of fs34.readdirSync("/proc")) {
120325
+ for (const name of fs35.readdirSync("/proc")) {
120315
120326
  if (!/^\d+$/.test(name)) continue;
120316
120327
  try {
120317
- if (fs34.readFileSync(`/proc/${name}/environ`, "utf8").split("\0").includes(entry)) pids.push(Number(name));
120328
+ if (fs35.readFileSync(`/proc/${name}/environ`, "utf8").split("\0").includes(entry)) pids.push(Number(name));
120318
120329
  } catch (error) {
120319
120330
  if (strict && !["ENOENT", "ESRCH"].includes(error.code ?? "")) {
120320
- const stat = fs34.statSync(`/proc/${name}`, { throwIfNoEntry: false });
120331
+ const stat = fs35.statSync(`/proc/${name}`, { throwIfNoEntry: false });
120321
120332
  if (stat?.uid === process.getuid?.()) throw error;
120322
120333
  }
120323
120334
  }
@@ -120443,8 +120454,8 @@ function processesStopped(mark, root2) {
120443
120454
  }
120444
120455
 
120445
120456
  // src/flow.ts
120446
- import fs39 from "node:fs";
120447
- import path42 from "node:path";
120457
+ import fs40 from "node:fs";
120458
+ import path43 from "node:path";
120448
120459
 
120449
120460
  // ../cli/src/lib/card-review.ts
120450
120461
  function reviewOf(meta) {
@@ -120459,8 +120470,8 @@ function reviewOf(meta) {
120459
120470
  }
120460
120471
 
120461
120472
  // src/triage.ts
120462
- import fs35 from "node:fs";
120463
- import path38 from "node:path";
120473
+ import fs36 from "node:fs";
120474
+ import path39 from "node:path";
120464
120475
 
120465
120476
  // ../cli/src/lib/signals/identity.ts
120466
120477
  import { createHash as createHash2 } from "node:crypto";
@@ -120468,8 +120479,8 @@ var DERIVED = "derived-";
120468
120479
  var derivedSourceId = (seed) => `${DERIVED}${createHash2("sha256").update(seed).digest("hex").slice(0, 16)}`;
120469
120480
 
120470
120481
  // src/triage.ts
120471
- var triageDir = (board) => path38.join(board, "triage");
120472
- var rejectedDir = (board) => path38.join(board, ".archive", REJECTIONS_TO_REVIEW);
120482
+ var triageDir = (board) => path39.join(board, "triage");
120483
+ var rejectedDir = (board) => path39.join(board, ".archive", REJECTIONS_TO_REVIEW);
120473
120484
  var SCRATCH = ["dismissed", "archived"];
120474
120485
  var stamp2 = (at2) => formatStamp(at2 ? new Date(at2) : /* @__PURE__ */ new Date());
120475
120486
  function slugOf(title) {
@@ -120478,7 +120489,7 @@ function slugOf(title) {
120478
120489
  function freeName(dir, title) {
120479
120490
  const stem = slugOf(title);
120480
120491
  let name = `${stem}.md`;
120481
- for (let n = 2; fs35.existsSync(path38.join(dir, name)); n++) name = `${stem}-${n}.md`;
120492
+ for (let n = 2; fs36.existsSync(path39.join(dir, name)); n++) name = `${stem}-${n}.md`;
120482
120493
  return name;
120483
120494
  }
120484
120495
  function itemText(item, fields = {}) {
@@ -120498,17 +120509,17 @@ ${item.text.trim()}
120498
120509
  `;
120499
120510
  }
120500
120511
  function writeItem(dir, item, fields = {}) {
120501
- fs35.mkdirSync(dir, { recursive: true });
120512
+ fs36.mkdirSync(dir, { recursive: true });
120502
120513
  const name = freeName(dir, item.title);
120503
- fs35.writeFileSync(path38.join(dir, name), itemText(item, item.workflow ? { workflow: workflowName(item.workflow), ...fields } : fields));
120514
+ fs36.writeFileSync(path39.join(dir, name), itemText(item, item.workflow ? { workflow: workflowName(item.workflow), ...fields } : fields));
120504
120515
  return name;
120505
120516
  }
120506
120517
  function layOut(board, rejections) {
120507
120518
  clearLaid(board);
120508
120519
  const dir = rejectedDir(board);
120509
- fs35.mkdirSync(dir, { recursive: true });
120520
+ fs36.mkdirSync(dir, { recursive: true });
120510
120521
  for (const t2 of rejections.tasks) {
120511
- fs35.writeFileSync(path38.join(dir, `${t2.number}-${slugify(t2.title)}.md`), [
120522
+ fs36.writeFileSync(path39.join(dir, `${t2.number}-${slugify(t2.title)}.md`), [
120512
120523
  "---",
120513
120524
  `title: ${yamlScalar(t2.title)}`,
120514
120525
  "status: todo",
@@ -120523,20 +120534,20 @@ function layOut(board, rejections) {
120523
120534
  ].join("\n"));
120524
120535
  }
120525
120536
  for (const item of rejections.triage) {
120526
- const sub = path38.join(triageDir(board), item.state === "dismissed" ? "dismissed" : "archived");
120537
+ const sub = path39.join(triageDir(board), item.state === "dismissed" ? "dismissed" : "archived");
120527
120538
  const fields = item.state === "dismissed" ? { dismissed_at: stamp2(item.dismissed_at), dismissed_by: "user", ...item.dismissed_reason ? { dismissed_reason: item.dismissed_reason } : {} } : {};
120528
120539
  writeItem(sub, item, fields);
120529
120540
  }
120530
120541
  return { tasks: rejections.tasks.map((t2) => t2.id), triage: rejections.triage.map((i) => i.id) };
120531
120542
  }
120532
120543
  function clearLaid(board) {
120533
- fs35.rmSync(rejectedDir(board), { recursive: true, force: true });
120534
- for (const sub of SCRATCH) fs35.rmSync(path38.join(triageDir(board), sub), { recursive: true, force: true });
120544
+ fs36.rmSync(rejectedDir(board), { recursive: true, force: true });
120545
+ for (const sub of SCRATCH) fs36.rmSync(path39.join(triageDir(board), sub), { recursive: true, force: true });
120535
120546
  }
120536
120547
 
120537
120548
  // src/kanban-skill.ts
120538
- import fs36 from "node:fs";
120539
- import path39 from "node:path";
120549
+ import fs37 from "node:fs";
120550
+ import path40 from "node:path";
120540
120551
 
120541
120552
  // ../skill/SKILL.md
120542
120553
  var SKILL_default = '---\nname: kanban\ndescription: Manage the file-based task board with akb. Use for creating and planning tasks, revising or implementing cards, and managing background runs; also for "what\'s running".\n---\n\n# Kanban board\n\nThe board is worked only through `akb`. Find the command for the job in `akb help` and run\nit; never do its work by hand or from memory.\n\n- **`--print` does it here**: `akb card revise 12 --print "drop the export"` prints the whole\n flow for that card on this board; follow it to its closing steps. Without `--print` the\n same command starts a separate agent.\n- **Keys**: never read or write API keys; the user sets them with `akb agent set apiKey`.\n';
@@ -120549,24 +120560,24 @@ var CONTENT = `${SKILL_default.trimEnd()}
120549
120560
  var MANAGED = /^<!-- ai4kanban \S+ -->$/m;
120550
120561
  function prepareKanbanSkill(root2) {
120551
120562
  for (const folder of SKILL_FOLDERS) {
120552
- const dir = path39.join(root2, folder);
120553
- const file2 = path39.join(dir, "SKILL.md");
120563
+ const dir = path40.join(root2, folder);
120564
+ const file2 = path40.join(dir, "SKILL.md");
120554
120565
  try {
120555
120566
  let linked = false;
120556
120567
  let at2 = root2;
120557
120568
  for (const name of `${folder}/SKILL.md`.split("/")) {
120558
- at2 = path39.join(at2, name);
120559
- if (fs36.lstatSync(at2, { throwIfNoEntry: false })?.isSymbolicLink()) linked = true;
120569
+ at2 = path40.join(at2, name);
120570
+ if (fs37.lstatSync(at2, { throwIfNoEntry: false })?.isSymbolicLink()) linked = true;
120560
120571
  }
120561
- const held4 = fs36.existsSync(file2) ? fs36.readFileSync(file2, "utf8") : null;
120562
- const exists = fs36.lstatSync(dir, { throwIfNoEntry: false }) !== void 0;
120572
+ const held4 = fs37.existsSync(file2) ? fs37.readFileSync(file2, "utf8") : null;
120573
+ const exists = fs37.lstatSync(dir, { throwIfNoEntry: false }) !== void 0;
120563
120574
  if (linked || exists && !MANAGED.test(held4 ?? "")) {
120564
120575
  if (!held4?.trim()) throw new Error("\u7528\u6237\u81EA\u6709\u76EE\u5F55\u6216\u7B26\u53F7\u94FE\u63A5\u4E2D\u7F3A\u5C11\u53EF\u8BFB\u7684 SKILL.md");
120565
120576
  continue;
120566
120577
  }
120567
120578
  if (held4 !== CONTENT) {
120568
- fs36.mkdirSync(dir, { recursive: true });
120569
- fs36.writeFileSync(file2, CONTENT);
120579
+ fs37.mkdirSync(dir, { recursive: true });
120580
+ fs37.writeFileSync(file2, CONTENT);
120570
120581
  }
120571
120582
  } catch (e2) {
120572
120583
  throw new Error(`\u65E0\u6CD5\u51C6\u5907 ${folder}\uFF1A${e2 instanceof Error ? e2.message : String(e2)}`);
@@ -120576,12 +120587,12 @@ function prepareKanbanSkill(root2) {
120576
120587
 
120577
120588
  // ../cli/src/lib/skill/hook.ts
120578
120589
  import { spawnSync as spawnSync5 } from "node:child_process";
120579
- import fs37 from "node:fs";
120580
- import path40 from "node:path";
120590
+ import fs38 from "node:fs";
120591
+ import path41 from "node:path";
120581
120592
  var MARKER_LINE = /^# ai4kanban commit guard\b/m;
120582
120593
  var read2 = (file2) => {
120583
120594
  try {
120584
- return fs37.readFileSync(file2, "utf8");
120595
+ return fs38.readFileSync(file2, "utf8");
120585
120596
  } catch {
120586
120597
  return null;
120587
120598
  }
@@ -120593,28 +120604,28 @@ function hooksDir(root2) {
120593
120604
  windowsHide: true
120594
120605
  });
120595
120606
  if (out.error || out.status !== 0 || !out.stdout.trim()) return null;
120596
- return path40.resolve(root2, out.stdout.trim());
120607
+ return path41.resolve(root2, out.stdout.trim());
120597
120608
  }
120598
120609
  function installCommitHook(root2, _board) {
120599
120610
  const dir = hooksDir(root2);
120600
120611
  if (!dir) return {};
120601
- const file2 = path40.join(dir, "pre-commit");
120602
- if (fs37.lstatSync(file2, { throwIfNoEntry: false })?.isSymbolicLink()) return {};
120612
+ const file2 = path41.join(dir, "pre-commit");
120613
+ if (fs38.lstatSync(file2, { throwIfNoEntry: false })?.isSymbolicLink()) return {};
120603
120614
  const source = read2(file2);
120604
- if (source && MARKER_LINE.test(source)) fs37.unlinkSync(file2);
120615
+ if (source && MARKER_LINE.test(source)) fs38.unlinkSync(file2);
120605
120616
  return {};
120606
120617
  }
120607
120618
 
120608
120619
  // src/built.ts
120609
- import fs38 from "node:fs";
120610
- import path41 from "node:path";
120620
+ import fs39 from "node:fs";
120621
+ import path42 from "node:path";
120611
120622
  var isBuilder = (ws) => ws.workflow === BUILDER;
120612
- var draftDir = (ws) => path41.join(ws.board, "workflows", draftFolder(ws.task));
120613
- var draftLine = (ws) => `<!-- workflow folder: ${path41.relative(ws.cwd, draftDir(ws)).split(path41.sep).join("/")}/ -->`;
120623
+ var draftDir = (ws) => path42.join(ws.board, "workflows", draftFolder(ws.task));
120624
+ var draftLine = (ws) => `<!-- workflow folder: ${path42.relative(ws.cwd, draftDir(ws)).split(path42.sep).join("/")}/ -->`;
120614
120625
  var skeleton = (name) => ["---", `name: ${/\s#/.test(name) ? JSON.stringify(name) : yamlScalar(name)}`, "needsArtifact: false", "---", ""].join("\n");
120615
120626
  async function placeDraft(ws, read3) {
120616
120627
  const dir = draftDir(ws);
120617
- if (fs38.existsSync(path41.join(dir, WORKFLOW_FILE))) return { ok: true, value: void 0 };
120628
+ if (fs39.existsSync(path42.join(dir, WORKFLOW_FILE))) return { ok: true, value: void 0 };
120618
120629
  const task = await read3.readTask(ws.task);
120619
120630
  if (!task.ok) return task;
120620
120631
  let files = { [WORKFLOW_FILE]: skeleton(task.value.title.trim() || "Untitled") };
@@ -120625,10 +120636,10 @@ async function placeDraft(ws, read3) {
120625
120636
  files = held4.value.files;
120626
120637
  }
120627
120638
  for (const [name, text4] of Object.entries(files)) {
120628
- const file2 = path41.resolve(dir, name);
120629
- if (!file2.startsWith(dir + path41.sep)) continue;
120630
- fs38.mkdirSync(path41.dirname(file2), { recursive: true });
120631
- fs38.writeFileSync(file2, text4);
120639
+ const file2 = path42.resolve(dir, name);
120640
+ if (!file2.startsWith(dir + path42.sep)) continue;
120641
+ fs39.mkdirSync(path42.dirname(file2), { recursive: true });
120642
+ fs39.writeFileSync(file2, text4);
120632
120643
  }
120633
120644
  return { ok: true, value: void 0 };
120634
120645
  }
@@ -120640,7 +120651,7 @@ async function builtWorkflow(ws, akb) {
120640
120651
  const dir = draftDir(ws);
120641
120652
  let source;
120642
120653
  try {
120643
- source = fs38.readFileSync(path41.join(dir, WORKFLOW_FILE), "utf8");
120654
+ source = fs39.readFileSync(path42.join(dir, WORKFLOW_FILE), "utf8");
120644
120655
  } catch {
120645
120656
  return fail(`workflows/${id}/${WORKFLOW_FILE} is missing.`);
120646
120657
  }
@@ -120648,25 +120659,25 @@ async function builtWorkflow(ws, akb) {
120648
120659
  if ("problem" in read3) return fail(read3.problem);
120649
120660
  const names2 = named(read3.def);
120650
120661
  const run2 = async (args) => answerOf2(await runAkb(akb, [...args, "--json", "--board", ws.board], { cwd: ws.cwd, board: ws.board }));
120651
- const agents = path41.join(dir, "agents");
120652
- for (const old of fs38.existsSync(agents) ? fs38.readdirSync(agents) : []) {
120653
- if (!names2.includes(old)) fs38.rmSync(path41.join(agents, old), { recursive: true, force: true });
120662
+ const agents = path42.join(dir, "agents");
120663
+ for (const old of fs39.existsSync(agents) ? fs39.readdirSync(agents) : []) {
120664
+ if (!names2.includes(old)) fs39.rmSync(path42.join(agents, old), { recursive: true, force: true });
120654
120665
  }
120655
120666
  for (const name of names2) {
120656
- const from = path41.join(ws.board, "agents", name);
120657
- const to = path41.join(agents, name);
120658
- if (fs38.existsSync(from)) {
120659
- fs38.rmSync(to, { recursive: true, force: true });
120660
- fs38.cpSync(from, to, { recursive: true });
120661
- } else if (!fs38.existsSync(path41.join(to, "AGENT.md"))) {
120667
+ const from = path42.join(ws.board, "agents", name);
120668
+ const to = path42.join(agents, name);
120669
+ if (fs39.existsSync(from)) {
120670
+ fs39.rmSync(to, { recursive: true, force: true });
120671
+ fs39.cpSync(from, to, { recursive: true });
120672
+ } else if (!fs39.existsSync(path42.join(to, "AGENT.md"))) {
120662
120673
  const own = await run2(["raw", "agent-file", name, "AGENT.md"]);
120663
120674
  if (own?.text) {
120664
- fs38.mkdirSync(to, { recursive: true });
120665
- fs38.writeFileSync(path41.join(to, "AGENT.md"), own.text);
120675
+ fs39.mkdirSync(to, { recursive: true });
120676
+ fs39.writeFileSync(path42.join(to, "AGENT.md"), own.text);
120666
120677
  }
120667
120678
  }
120668
120679
  }
120669
- const files = Object.fromEntries(filesUnder(dir).map((f2) => [f2, fs38.readFileSync(path41.join(dir, f2), "utf8")]));
120680
+ const files = Object.fromEntries(filesUnder(dir).map((f2) => [f2, fs39.readFileSync(path42.join(dir, f2), "utf8")]));
120670
120681
  const checked = checkWorkflowFiles(files);
120671
120682
  if (!checked.ok) return fail(`${checked.file} ${checked.reason}.`);
120672
120683
  const list = await run2(["workflow", "list"]);
@@ -120700,7 +120711,7 @@ function spentBy(runs) {
120700
120711
  }
120701
120712
  function reviewOf2(file2) {
120702
120713
  try {
120703
- const meta = parseFrontmatter(fs39.readFileSync(file2, "utf8")).meta;
120714
+ const meta = parseFrontmatter(fs40.readFileSync(file2, "utf8")).meta;
120704
120715
  return meta ? reviewOf(meta) : null;
120705
120716
  } catch {
120706
120717
  return null;
@@ -120708,15 +120719,15 @@ function reviewOf2(file2) {
120708
120719
  }
120709
120720
  function asks(file2) {
120710
120721
  try {
120711
- return openOf(parseFrontmatter(fs39.readFileSync(file2, "utf8")).meta?.questions ?? []).length > 0;
120722
+ return openOf(parseFrontmatter(fs40.readFileSync(file2, "utf8")).meta?.questions ?? []).length > 0;
120712
120723
  } catch {
120713
120724
  return false;
120714
120725
  }
120715
120726
  }
120716
120727
  function mcpConfig(servers, file2) {
120717
120728
  if (!Object.keys(servers).length) return null;
120718
- fs39.mkdirSync(path42.dirname(file2), { recursive: true });
120719
- fs39.writeFileSync(file2, `${JSON.stringify({ mcpServers: servers }, null, 2)}
120729
+ fs40.mkdirSync(path43.dirname(file2), { recursive: true });
120730
+ fs40.writeFileSync(file2, `${JSON.stringify({ mcpServers: servers }, null, 2)}
120720
120731
  `);
120721
120732
  return file2;
120722
120733
  }
@@ -120755,7 +120766,7 @@ function deliveryEnding(ws, id, asked = false) {
120755
120766
  if (!id) return null;
120756
120767
  let held4;
120757
120768
  try {
120758
- held4 = JSON.parse(fs39.readFileSync(path42.join(ws.board, "deliveries", `${path42.basename(id)}.json`), "utf8"));
120769
+ held4 = JSON.parse(fs40.readFileSync(path43.join(ws.board, "deliveries", `${path43.basename(id)}.json`), "utf8"));
120759
120770
  } catch {
120760
120771
  return null;
120761
120772
  }
@@ -120767,16 +120778,16 @@ function deliveryEnding(ws, id, asked = false) {
120767
120778
  return null;
120768
120779
  }
120769
120780
  function checkoutsOf(ws, id) {
120770
- const dir = path42.join(ws.board, "deliveries");
120781
+ const dir = path43.join(ws.board, "deliveries");
120771
120782
  let names2;
120772
120783
  try {
120773
- names2 = fs39.readdirSync(dir).filter((n) => n.endsWith(".json"));
120784
+ names2 = fs40.readdirSync(dir).filter((n) => n.endsWith(".json"));
120774
120785
  } catch {
120775
120786
  return [];
120776
120787
  }
120777
120788
  return names2.flatMap((n) => {
120778
120789
  try {
120779
- const held4 = JSON.parse(fs39.readFileSync(path42.join(dir, n), "utf8"));
120790
+ const held4 = JSON.parse(fs40.readFileSync(path43.join(dir, n), "utf8"));
120780
120791
  return held4.cardId === id && held4.deliveryId ? [held4.deliveryId] : [];
120781
120792
  } catch {
120782
120793
  return [];
@@ -120790,7 +120801,7 @@ var RESUME_REFUSED = {
120790
120801
  deliveryRunGoing: "\u4E0A\u6B21\u7684\u8FD0\u884C\u8FD8\u6CA1\u505C\u4E0B\uFF0C\u8BF7\u7A0D\u540E\u518D\u70B9\u300C\u7EED\u8DD1\u300D\u3002",
120791
120802
  deliveryCardGone: "\u8FD9\u5F20\u5361\u5DF2\u4E0D\u5728\u770B\u677F\u4E0A\uFF0C\u6CA1\u6709\u53EF\u7EED\u8DD1\u7684\u5185\u5BB9\uFF0C\u8BF7\u70B9\u300C\u91CD\u65B0\u53D1\u8D77\u300D\u3002"
120792
120803
  };
120793
- var isArchived = (ws, id) => path42.relative(ws.board, findCard(ws.board, id) ?? ws.board).split(path42.sep)[0] === ".archive";
120804
+ var isArchived = (ws, id) => path43.relative(ws.board, findCard(ws.board, id) ?? ws.board).split(path43.sep)[0] === ".archive";
120794
120805
  var refusal2 = (ran) => ran.last.replace(/^akb( raw)?: /, "").slice(0, 300) || "akb stopped with an error.";
120795
120806
  var firstLine = (text4) => (text4 ?? "").split("\n").map((l2) => l2.trim()).find(Boolean)?.slice(0, 300);
120796
120807
  function logLines(show, event2) {
@@ -120848,7 +120859,7 @@ async function setUp(job, ws, deps, io) {
120848
120859
  const runtime = job.runtime;
120849
120860
  const missing = unavailable(runtime, await deps.runtimes());
120850
120861
  if (missing) return missing;
120851
- if (!fs39.existsSync(path42.join(ws.board, "config.md"))) {
120862
+ if (!fs40.existsSync(path43.join(ws.board, "config.md"))) {
120852
120863
  const init = await akb(["raw", "init"]);
120853
120864
  if (init.code !== 0) return refusal2(init);
120854
120865
  }
@@ -120865,7 +120876,7 @@ async function setUp(job, ws, deps, io) {
120865
120876
  const used = await akb(["agent", "use", runtime]);
120866
120877
  if (used.code !== 0) return refusal2(used);
120867
120878
  const servers = mcpServersOf(ws);
120868
- const mcpFile = path42.join(ws.board, ".sync", `${ws.task}.mcp.json`);
120879
+ const mcpFile = path43.join(ws.board, ".sync", `${ws.task}.mcp.json`);
120869
120880
  const takes = new Set(settingKeys(runtime));
120870
120881
  const given = job.settings ?? {};
120871
120882
  const values = { ...given, model: job.model ?? "" };
@@ -120965,19 +120976,19 @@ async function runAgent(job, ws, deps, io) {
120965
120976
  }
120966
120977
  function writeTranscript(job, dir) {
120967
120978
  if (!job.transcript) return "";
120968
- const file2 = path42.join(dir, "discussion.md");
120969
- fs39.mkdirSync(dir, { recursive: true });
120970
- fs39.writeFileSync(file2, `${job.transcript}
120979
+ const file2 = path43.join(dir, "discussion.md");
120980
+ fs40.mkdirSync(dir, { recursive: true });
120981
+ fs40.writeFileSync(file2, `${job.transcript}
120971
120982
  `);
120972
120983
  return file2;
120973
120984
  }
120974
120985
  function pictures(job, ws, id) {
120975
120986
  const dir = cardAssetsDir(ws, id);
120976
120987
  if (!job.attachments.length || !dir) return "";
120977
- fs39.mkdirSync(dir, { recursive: true });
120988
+ fs40.mkdirSync(dir, { recursive: true });
120978
120989
  return job.attachments.map((a2, i) => {
120979
- const file2 = `${i + 1}-${path42.basename(a2.name).replace(/[^\w.-]+/g, "-")}`;
120980
- fs39.writeFileSync(path42.join(dir, file2), Buffer.from(a2.content, "base64"));
120990
+ const file2 = `${i + 1}-${path43.basename(a2.name).replace(/[^\w.-]+/g, "-")}`;
120991
+ fs40.writeFileSync(path43.join(dir, file2), Buffer.from(a2.content, "base64"));
120981
120992
  return `
120982
120993
  <Asset src=".assets/${id}/${file2}" label="${a2.name.replace(/["<>]/g, "") || file2}" />
120983
120994
  `;
@@ -120985,7 +120996,7 @@ function pictures(job, ws, id) {
120985
120996
  }
120986
120997
  function cardFlags(ws, fields) {
120987
120998
  if (!fields) return [];
120988
- const open = (keys) => (keys ?? []).map((k2) => Number(/(\d+)$/.exec(k2)?.[1])).filter((n) => n > 0 && n !== ws.number && findCard(ws.board, n)?.startsWith(path42.join(ws.board, "todo") + path42.sep));
120999
+ const open = (keys) => (keys ?? []).map((k2) => Number(/(\d+)$/.exec(k2)?.[1])).filter((n) => n > 0 && n !== ws.number && findCard(ws.board, n)?.startsWith(path43.join(ws.board, "todo") + path43.sep));
120989
121000
  const lists = [["--modules", fields.modules ?? []], ["--related", open(fields.related)], ["--blocked-by", open(fields.blocked_by)]];
120990
121001
  return [
120991
121002
  ...fields.priority ? ["--priority", fields.priority] : [],
@@ -121020,10 +121031,10 @@ async function runFlow(job, ws, deps, io) {
121020
121031
  const placed = await placeDraft(ws, deps.api);
121021
121032
  if (!placed.ok) return fail(placed.error);
121022
121033
  }
121023
- const body = path42.join(ws.board, ".sync", `${ws.task}.request.md`);
121024
- fs39.mkdirSync(path42.dirname(body), { recursive: true });
121034
+ const body = path43.join(ws.board, ".sync", `${ws.task}.request.md`);
121035
+ fs40.mkdirSync(path43.dirname(body), { recursive: true });
121025
121036
  if (!ws.number) return fail("This task has no number yet.");
121026
- fs39.writeFileSync(body, `${said.request || title}
121037
+ fs40.writeFileSync(body, `${said.request || title}
121027
121038
  ${isBuilder(ws) ? `
121028
121039
  ${draftLine(ws)}
121029
121040
  ` : ""}${pictures(job, ws, ws.number)}`);
@@ -121041,7 +121052,7 @@ ${draftLine(ws)}
121041
121052
  ...cardFlags(ws, flow.metadata),
121042
121053
  "--json"
121043
121054
  ]));
121044
- fs39.rmSync(body, { force: true });
121055
+ fs40.rmSync(body, { force: true });
121045
121056
  if (!created.ok) return fail(created.error);
121046
121057
  id = created.value;
121047
121058
  }
@@ -121057,7 +121068,7 @@ ${draftLine(ws)}
121057
121068
  if (io.lost()) return fail("");
121058
121069
  return await workOn(card);
121059
121070
  } finally {
121060
- fs39.rmSync(path42.join(ws.board, ".sync", `${ws.task}.discussion`), { recursive: true, force: true });
121071
+ fs40.rmSync(path43.join(ws.board, ".sync", `${ws.task}.discussion`), { recursive: true, force: true });
121061
121072
  const left = working.get(key) - 1;
121062
121073
  if (left) working.set(key, left);
121063
121074
  else working.delete(key);
@@ -121102,7 +121113,7 @@ ${draftLine(ws)}
121102
121113
  const resolved2 = await akb(["card", "resolve", String(id2), "--follow", "--events", "--json", "--", text4], true);
121103
121114
  if (io.lost()) return fail("");
121104
121115
  const file2 = findCard(ws.board, id2);
121105
- rejected = !!file2 && path42.relative(ws.board, file2).split(path42.sep)[0] === ".archive" && parseFrontmatter(fs39.readFileSync(file2, "utf8")).meta?.rejected === true;
121116
+ rejected = !!file2 && path43.relative(ws.board, file2).split(path43.sep)[0] === ".archive" && parseFrontmatter(fs40.readFileSync(file2, "utf8")).meta?.rejected === true;
121106
121117
  if (rejected) ran = resolved2;
121107
121118
  else if (resolved2.code !== 0) note = text4;
121108
121119
  }
@@ -121146,7 +121157,7 @@ ${draftLine(ws)}
121146
121157
  }
121147
121158
  function carryArgs(verb) {
121148
121159
  if (!["refine", "resolve", "revise", "implement"].includes(verb)) return [];
121149
- const transcript = writeTranscript(job, path42.join(ws.board, ".sync", `${ws.task}.discussion`));
121160
+ const transcript = writeTranscript(job, path43.join(ws.board, ".sync", `${ws.task}.discussion`));
121150
121161
  return [
121151
121162
  ...job.resume ? ["--session", job.resume, ...job.fork ? ["--fork"] : []] : [],
121152
121163
  ...transcript ? ["--transcript", transcript] : []
@@ -121165,8 +121176,8 @@ async function confirmFlowStopped(ws, job, deps) {
121165
121176
  }
121166
121177
 
121167
121178
  // src/recovery.ts
121168
- import fs40 from "node:fs";
121169
- import path43 from "node:path";
121179
+ import fs41 from "node:fs";
121180
+ import path44 from "node:path";
121170
121181
 
121171
121182
  // ../cli/src/lib/agent/retry.ts
121172
121183
  var RETRY_WINDOW_MS = 15 * 6e4;
@@ -121182,10 +121193,10 @@ function backoffMs(attempt, random = Math.random) {
121182
121193
  var PREPARE_REASON = "Runner update prepare.";
121183
121194
  var UPDATE_REASON = "Runner update checkpoint.";
121184
121195
  var UNCERTAIN = "\u66F4\u65B0\u4E2D\u65AD\u65F6\u6709\u64CD\u4F5C\u7ED3\u679C\u5C1A\u672A\u786E\u8BA4\uFF0C\u8BF7\u68C0\u67E5\u5DF2\u6709\u7ED3\u679C\u540E\u518D\u7EED\u8DD1\u3002";
121185
- var fileOf2 = (id) => path43.join(runnerHome(), "checkpoints", `${encodeURIComponent(id)}.json`);
121196
+ var fileOf2 = (id) => path44.join(runnerHome(), "checkpoints", `${encodeURIComponent(id)}.json`);
121186
121197
  function readCheckpoint(id) {
121187
121198
  try {
121188
- const held4 = JSON.parse(fs40.readFileSync(fileOf2(id), "utf8"));
121199
+ const held4 = JSON.parse(fs41.readFileSync(fileOf2(id), "utf8"));
121189
121200
  if (!held4 || !Array.isArray(held4.pending) || !held4.pending.every((id2) => typeof id2 === "string")) throw new Error("\u8FDB\u5EA6\u683C\u5F0F\u9519\u8BEF");
121190
121201
  return held4;
121191
121202
  } catch (e2) {
@@ -121195,12 +121206,12 @@ function readCheckpoint(id) {
121195
121206
  }
121196
121207
  function saveCheckpoint(id, checkpoint) {
121197
121208
  const file2 = fileOf2(id);
121198
- fs40.mkdirSync(path43.dirname(file2), { recursive: true, mode: 448 });
121199
- fs40.writeFileSync(`${file2}.tmp`, JSON.stringify(checkpoint), { mode: 384 });
121200
- fs40.renameSync(`${file2}.tmp`, file2);
121209
+ fs41.mkdirSync(path44.dirname(file2), { recursive: true, mode: 448 });
121210
+ fs41.writeFileSync(`${file2}.tmp`, JSON.stringify(checkpoint), { mode: 384 });
121211
+ fs41.renameSync(`${file2}.tmp`, file2);
121201
121212
  }
121202
121213
  function clearCheckpoint(id) {
121203
- fs40.rmSync(fileOf2(id), { force: true });
121214
+ fs41.rmSync(fileOf2(id), { force: true });
121204
121215
  }
121205
121216
  function checkpointEvent(checkpoint, event2) {
121206
121217
  if (event2.kind === "tool_call") {
@@ -121257,16 +121268,16 @@ function replySpent(checkpoint, runtime) {
121257
121268
 
121258
121269
  // src/lock.ts
121259
121270
  import crypto6 from "node:crypto";
121260
- import fs41 from "node:fs";
121271
+ import fs42 from "node:fs";
121261
121272
  import net from "node:net";
121262
- import path44 from "node:path";
121273
+ import path45 from "node:path";
121263
121274
  var RETRY_MS = 5e3;
121264
121275
  var KIND_MS = 1e3;
121265
121276
  var HOLDERS = ["claude-code", "codex", "terminal"];
121266
121277
  function lockPath() {
121267
121278
  const home4 = runnerHome();
121268
121279
  if (process.platform === "win32") return `\\\\.\\pipe\\wildcrane-${crypto6.createHash("sha256").update(home4).digest("hex").slice(0, 16)}`;
121269
- return path44.join(home4, "runner.sock");
121280
+ return path45.join(home4, "runner.sock");
121270
121281
  }
121271
121282
  function holdMachine(kind, onHeld, onWaiting) {
121272
121283
  const where = lockPath();
@@ -121281,7 +121292,7 @@ function holdMachine(kind, onHeld, onWaiting) {
121281
121292
  const attempt = () => {
121282
121293
  timer = null;
121283
121294
  if (closed) return;
121284
- if (process.platform !== "win32") fs41.mkdirSync(path44.dirname(where), { recursive: true, mode: 448 });
121295
+ if (process.platform !== "win32") fs42.mkdirSync(path45.dirname(where), { recursive: true, mode: 448 });
121285
121296
  const s = net.createServer((peer) => {
121286
121297
  peers.add(peer);
121287
121298
  peer.on("error", () => {
@@ -121329,7 +121340,7 @@ function holdMachine(kind, onHeld, onWaiting) {
121329
121340
  later(0);
121330
121341
  });
121331
121342
  removeIfStill.once("error", () => {
121332
- fs41.rmSync(where, { force: true });
121343
+ fs42.rmSync(where, { force: true });
121333
121344
  later(50 + Math.random() * 200);
121334
121345
  });
121335
121346
  return;
@@ -121360,8 +121371,8 @@ function holdMachine(kind, onHeld, onWaiting) {
121360
121371
  // src/handoff.ts
121361
121372
  import { execFileSync as execFileSync2 } from "node:child_process";
121362
121373
  import crypto7 from "node:crypto";
121363
- import fs42 from "node:fs";
121364
- import path45 from "node:path";
121374
+ import fs43 from "node:fs";
121375
+ import path46 from "node:path";
121365
121376
  var gitRead = (cwd, args) => {
121366
121377
  try {
121367
121378
  return execFileSync2("git", ["-C", cwd, ...args], {
@@ -121378,8 +121389,8 @@ var digest = (value) => crypto7.createHash("sha256").update(value).digest("hex")
121378
121389
  function authorizedFolder(folder) {
121379
121390
  if (!folder) return null;
121380
121391
  try {
121381
- const real = fs42.realpathSync(folder);
121382
- return allowedProjects().some((root2) => real === root2 || real.startsWith(root2 + path45.sep)) ? real : null;
121392
+ const real = fs43.realpathSync(folder);
121393
+ return allowedProjects().some((root2) => real === root2 || real.startsWith(root2 + path46.sep)) ? real : null;
121383
121394
  } catch {
121384
121395
  return null;
121385
121396
  }
@@ -121389,9 +121400,9 @@ function progressFolder(job, folder) {
121389
121400
  if (!token) return folder;
121390
121401
  if (!/^[a-zA-Z0-9-]{1,80}$/.test(token)) return null;
121391
121402
  try {
121392
- const dir = fs42.realpathSync(path45.join(folder, ".akb", "handoffs", token));
121393
- if (!dir.startsWith(fs42.realpathSync(folder) + path45.sep)) return null;
121394
- const marker = JSON.parse(fs42.readFileSync(path45.join(dir, ".akb", "handoff.json"), "utf8"));
121403
+ const dir = fs43.realpathSync(path46.join(folder, ".akb", "handoffs", token));
121404
+ if (!dir.startsWith(fs43.realpathSync(folder) + path46.sep)) return null;
121405
+ const marker = JSON.parse(fs43.readFileSync(path46.join(dir, ".akb", "handoff.json"), "utf8"));
121395
121406
  return marker.task === job.task && marker.isolation === token ? dir : null;
121396
121407
  } catch {
121397
121408
  return null;
@@ -121399,38 +121410,38 @@ function progressFolder(job, folder) {
121399
121410
  }
121400
121411
  function progressEvidence(job, folder) {
121401
121412
  try {
121402
- const board = path45.join(folder, ".akb", "kanban");
121403
- const deliveries = path45.join(board, "deliveries");
121404
- const rows = fs42.readdirSync(deliveries).filter((name) => name.endsWith(".json")).map((name) => JSON.parse(fs42.readFileSync(path45.join(deliveries, name), "utf8"))).filter((row2) => row2.cardId === job.number).sort((a2, b2) => (b2.startedAt ?? 0) - (a2.startedAt ?? 0));
121413
+ const board = path46.join(folder, ".akb", "kanban");
121414
+ const deliveries = path46.join(board, "deliveries");
121415
+ const rows = fs43.readdirSync(deliveries).filter((name) => name.endsWith(".json")).map((name) => JSON.parse(fs43.readFileSync(path46.join(deliveries, name), "utf8"))).filter((row2) => row2.cardId === job.number).sort((a2, b2) => (b2.startedAt ?? 0) - (a2.startedAt ?? 0));
121405
121416
  const row = rows[0];
121406
121417
  if (!row?.deliveryId) return null;
121407
- const tree = fs42.realpathSync(path45.resolve(folder, row.worktree ?? "."));
121408
- if (tree !== fs42.realpathSync(folder) && !tree.startsWith(fs42.realpathSync(folder) + path45.sep)) return null;
121418
+ const tree = fs43.realpathSync(path46.resolve(folder, row.worktree ?? "."));
121419
+ if (tree !== fs43.realpathSync(folder) && !tree.startsWith(fs43.realpathSync(folder) + path46.sep)) return null;
121409
121420
  const inventory = gitRead(tree, ["worktree", "list", "--porcelain"]);
121410
121421
  const related = (inventory ?? "").split("\n\n").flatMap((entry) => {
121411
121422
  const branch = /^branch refs\/heads\/(.+)$/m.exec(entry)?.[1];
121412
121423
  const dir = /^worktree (.+)$/m.exec(entry)?.[1];
121413
- return branch?.startsWith(`card/${job.number}/`) && dir && dir !== tree && dir.startsWith(fs42.realpathSync(folder) + path45.sep) ? [dir] : [];
121424
+ return branch?.startsWith(`card/${job.number}/`) && dir && dir !== tree && dir.startsWith(fs43.realpathSync(folder) + path46.sep) ? [dir] : [];
121414
121425
  });
121415
121426
  const filesIn = (tree2) => {
121416
121427
  const changed = [];
121417
121428
  const walk = (dir, prefix = "") => {
121418
- for (const entry of fs42.readdirSync(dir, { withFileTypes: true })) {
121429
+ for (const entry of fs43.readdirSync(dir, { withFileTypes: true })) {
121419
121430
  if ([".git", ".akb", "node_modules", ".claude", ".agents"].includes(entry.name)) continue;
121420
121431
  const name = prefix + entry.name;
121421
- if (entry.isDirectory()) walk(path45.join(dir, entry.name), name + "/");
121432
+ if (entry.isDirectory()) walk(path46.join(dir, entry.name), name + "/");
121422
121433
  else changed.push(name);
121423
121434
  }
121424
121435
  };
121425
121436
  walk(tree2);
121426
121437
  changed.sort();
121427
121438
  return changed.map((name) => {
121428
- const file2 = path45.join(tree2, name);
121439
+ const file2 = path46.join(tree2, name);
121429
121440
  try {
121430
- const stat = fs42.lstatSync(file2);
121431
- if (stat.isSymbolicLink()) return [name, "link", digest(fs42.readlinkSync(file2))];
121441
+ const stat = fs43.lstatSync(file2);
121442
+ if (stat.isSymbolicLink()) return [name, "link", digest(fs43.readlinkSync(file2))];
121432
121443
  if (!stat.isFile()) throw new Error("\u65E0\u6CD5\u9A8C\u8BC1\u6587\u4EF6\u7C7B\u578B");
121433
- return [name, stat.mode & 511, digest(fs42.readFileSync(file2))];
121444
+ return [name, stat.mode & 511, digest(fs43.readFileSync(file2))];
121434
121445
  } catch (e2) {
121435
121446
  if (e2.code === "ENOENT") return [name, "deleted"];
121436
121447
  throw e2;
@@ -121467,60 +121478,60 @@ function progressEvidence(job, folder) {
121467
121478
  function restartFolder(job, folder) {
121468
121479
  const token = job.handoff?.isolation ?? job.id;
121469
121480
  if (!/^[a-zA-Z0-9-]{1,80}$/.test(token)) throw new Error("\u9694\u79BB\u76EE\u5F55\u7F16\u53F7\u65E0\u6548\u3002");
121470
- const dir = path45.join(folder, ".akb", "handoffs", token);
121471
- const marker = path45.join(dir, ".akb", "handoff.json");
121472
- for (const parent of [path45.join(folder, ".akb"), path45.dirname(dir), dir]) {
121473
- if (fs42.lstatSync(parent, { throwIfNoEntry: false })?.isSymbolicLink()) throw new Error("\u9694\u79BB\u76EE\u5F55\u4E0D\u80FD\u901A\u8FC7\u7B26\u53F7\u94FE\u63A5\u521B\u5EFA\u3002");
121481
+ const dir = path46.join(folder, ".akb", "handoffs", token);
121482
+ const marker = path46.join(dir, ".akb", "handoff.json");
121483
+ for (const parent of [path46.join(folder, ".akb"), path46.dirname(dir), dir]) {
121484
+ if (fs43.lstatSync(parent, { throwIfNoEntry: false })?.isSymbolicLink()) throw new Error("\u9694\u79BB\u76EE\u5F55\u4E0D\u80FD\u901A\u8FC7\u7B26\u53F7\u94FE\u63A5\u521B\u5EFA\u3002");
121474
121485
  }
121475
- if (fs42.existsSync(dir)) {
121486
+ if (fs43.existsSync(dir)) {
121476
121487
  if (job.handoff?.recovering) {
121477
121488
  try {
121478
- const saved = JSON.parse(fs42.readFileSync(marker, "utf8"));
121489
+ const saved = JSON.parse(fs43.readFileSync(marker, "utf8"));
121479
121490
  if (saved.task === job.task && saved.isolation === token) return dir;
121480
121491
  } catch {
121481
121492
  }
121482
121493
  }
121483
121494
  throw new Error("\u91CD\u542F\u76EE\u5F55\u5DF2\u5B58\u5728\uFF0C\u8BF7\u91CD\u65B0\u68C0\u67E5\u3002");
121484
121495
  }
121485
- fs42.mkdirSync(path45.dirname(dir), { recursive: true });
121486
- fs42.mkdirSync(dir);
121487
- for (const entry of fs42.readdirSync(folder)) {
121496
+ fs43.mkdirSync(path46.dirname(dir), { recursive: true });
121497
+ fs43.mkdirSync(dir);
121498
+ for (const entry of fs43.readdirSync(folder)) {
121488
121499
  if ([".akb", ".git", "node_modules", ".claude", ".agents"].includes(entry)) continue;
121489
- fs42.cpSync(path45.join(folder, entry), path45.join(dir, entry), { recursive: true, verbatimSymlinks: true });
121500
+ fs43.cpSync(path46.join(folder, entry), path46.join(dir, entry), { recursive: true, verbatimSymlinks: true });
121490
121501
  }
121491
- if (fs42.lstatSync(path45.dirname(marker), { throwIfNoEntry: false })?.isSymbolicLink()) throw new Error("\u9694\u79BB\u6807\u8BB0\u76EE\u5F55\u65E0\u6548\u3002");
121492
- fs42.mkdirSync(path45.dirname(marker), { recursive: true });
121493
- fs42.writeFileSync(marker, JSON.stringify({ task: job.task, isolation: token }), { flag: "wx" });
121502
+ if (fs43.lstatSync(path46.dirname(marker), { throwIfNoEntry: false })?.isSymbolicLink()) throw new Error("\u9694\u79BB\u6807\u8BB0\u76EE\u5F55\u65E0\u6548\u3002");
121503
+ fs43.mkdirSync(path46.dirname(marker), { recursive: true });
121504
+ fs43.writeFileSync(marker, JSON.stringify({ task: job.task, isolation: token }), { flag: "wx" });
121494
121505
  return dir;
121495
121506
  }
121496
121507
 
121497
121508
  // src/jobs.ts
121498
121509
  import { spawn as spawn4 } from "node:child_process";
121499
- import fs44 from "node:fs";
121500
- import path47 from "node:path";
121510
+ import fs45 from "node:fs";
121511
+ import path48 from "node:path";
121501
121512
 
121502
121513
  // ../cli/src/lib/agent/catalog.ts
121503
- import fs43 from "node:fs";
121504
- import path46 from "node:path";
121514
+ import fs44 from "node:fs";
121515
+ import path47 from "node:path";
121505
121516
  var CATALOGUE = "https://models.dev/api.json";
121506
121517
  var FRESH_FOR_MS = 24 * 60 * 6e4;
121507
121518
  var ANSWER_BY_MS = 2e4;
121508
121519
  function cacheFile() {
121509
- return path46.join(machineHome(), "models-dev.json");
121520
+ return path47.join(machineHome(), "models-dev.json");
121510
121521
  }
121511
121522
  var held2;
121512
121523
  function readCache() {
121513
121524
  const file2 = cacheFile();
121514
121525
  let stamp3;
121515
121526
  try {
121516
- const stat = fs43.statSync(file2);
121527
+ const stat = fs44.statSync(file2);
121517
121528
  stamp3 = `${stat.mtimeMs}:${stat.size}`;
121518
121529
  } catch {
121519
121530
  return void 0;
121520
121531
  }
121521
121532
  if (held2?.stamp === stamp3) return held2.cached;
121522
121533
  try {
121523
- const data = JSON.parse(fs43.readFileSync(file2, "utf8"));
121534
+ const data = JSON.parse(fs44.readFileSync(file2, "utf8"));
121524
121535
  if (!data || typeof data.limits !== "object" || !data.limits) return void 0;
121525
121536
  const cached2 = {
121526
121537
  fetchedAt: typeof data.fetchedAt === "number" ? data.fetchedAt : 0,
@@ -121559,8 +121570,8 @@ function refreshCatalog() {
121559
121570
  const limits = limitsIn(await answer.json());
121560
121571
  if (Object.keys(limits).length === 0) return;
121561
121572
  const file2 = cacheFile();
121562
- fs43.mkdirSync(path46.dirname(file2), { recursive: true });
121563
- fs43.writeFileSync(file2, JSON.stringify({ fetchedAt: Date.now(), limits }));
121573
+ fs44.mkdirSync(path47.dirname(file2), { recursive: true });
121574
+ fs44.writeFileSync(file2, JSON.stringify({ fetchedAt: Date.now(), limits }));
121564
121575
  } catch {
121565
121576
  }
121566
121577
  })();
@@ -121635,32 +121646,32 @@ var defaultDeps = (machineId2) => ({
121635
121646
  akb: currentAkb,
121636
121647
  runtimes: detectRuntimes
121637
121648
  });
121638
- var ownFolder = () => path47.join(runnerHome(), "work");
121649
+ var ownFolder = () => path48.join(runnerHome(), "work");
121639
121650
  function folderFor(job) {
121640
121651
  if (!job.projectDir) {
121641
- const cwd = path47.join(ownFolder(), job.id);
121642
- fs44.mkdirSync(cwd, { recursive: true });
121652
+ const cwd = path48.join(ownFolder(), job.id);
121653
+ fs45.mkdirSync(cwd, { recursive: true });
121643
121654
  return { cwd };
121644
121655
  }
121645
121656
  const real = realpath4(job.projectDir);
121646
- if (real && allowedProjects().some((root2) => real === root2 || real.startsWith(root2 + path47.sep))) return { cwd: real };
121657
+ if (real && allowedProjects().some((root2) => real === root2 || real.startsWith(root2 + path48.sep))) return { cwd: real };
121647
121658
  return { refused: `This Runner is not allowed to work in ${job.projectDir}.` };
121648
121659
  }
121649
121660
  function realpath4(p2) {
121650
121661
  try {
121651
- return fs44.realpathSync(p2);
121662
+ return fs45.realpathSync(p2);
121652
121663
  } catch {
121653
121664
  return null;
121654
121665
  }
121655
121666
  }
121656
- var attachmentsOf = (job) => path47.join(runnerHome(), "attachments", job.id);
121667
+ var attachmentsOf = (job) => path48.join(runnerHome(), "attachments", job.id);
121657
121668
  function writeAttachments(job) {
121658
121669
  if (!job.attachments.length) return "";
121659
121670
  const dir = attachmentsOf(job);
121660
- fs44.mkdirSync(dir, { recursive: true });
121671
+ fs45.mkdirSync(dir, { recursive: true });
121661
121672
  const files = job.attachments.map((a2) => {
121662
- const file2 = path47.join(dir, path47.basename(a2.name));
121663
- fs44.writeFileSync(file2, Buffer.from(a2.content, "base64"));
121673
+ const file2 = path48.join(dir, path48.basename(a2.name));
121674
+ fs45.writeFileSync(file2, Buffer.from(a2.content, "base64"));
121664
121675
  return file2;
121665
121676
  });
121666
121677
  return `
@@ -121943,7 +121954,7 @@ async function runJob(id, deps, track = () => {
121943
121954
  await runClaimed(job, { ...deps, akb: deps.akb() }, track, (dir) => releases.push(hold(dir)), lease);
121944
121955
  } finally {
121945
121956
  for (const release2 of releases) release2();
121946
- fs44.rmSync(attachmentsOf(job), { recursive: true, force: true });
121957
+ fs45.rmSync(attachmentsOf(job), { recursive: true, force: true });
121947
121958
  }
121948
121959
  }
121949
121960
  async function runClaimed(job, deps, track, keep2, lease, replyStream) {
@@ -122066,7 +122077,7 @@ async function runClaimed(job, deps, track, keep2, lease, replyStream) {
122066
122077
  discussed = board.board;
122067
122078
  }
122068
122079
  if (job.discussion) {
122069
- const wrote = recovering && fs44.existsSync(goalsFileOf(job)) ? { file: goalsFileOf(job) } : await writeGoals({ ...job, discussion: job.discussion }, deps.api.listWorkflows);
122080
+ const wrote = recovering && fs45.existsSync(goalsFileOf(job)) ? { file: goalsFileOf(job) } : await writeGoals({ ...job, discussion: job.discussion }, deps.api.listWorkflows);
122070
122081
  if ("error" in wrote) throw new Error(wrote.error);
122071
122082
  goalFile = wrote.file;
122072
122083
  }
@@ -122501,8 +122512,8 @@ async function runTest(job, deps, lease) {
122501
122512
  const report2 = (await deps.runtimes()).find((r2) => r2.name === job.runtime);
122502
122513
  if (!report2?.installed) return finish2("failed", "not_installed");
122503
122514
  if (report2.loggedIn === false) return finish2("failed", "signed_out");
122504
- const cwd = path47.join(ownFolder(), "test");
122505
- fs44.mkdirSync(cwd, { recursive: true });
122515
+ const cwd = path48.join(ownFolder(), "test");
122516
+ fs45.mkdirSync(cwd, { recursive: true });
122506
122517
  const run2 = deps.plan(job.runtime, job.prompt, cwd, null, job.model, settingsOf(job));
122507
122518
  const startedAt = Date.now();
122508
122519
  if (run2.converse) {
@@ -122953,7 +122964,7 @@ function startRunner(options) {
122953
122964
  let refresh2 = "";
122954
122965
  const accountWatch = setInterval(() => {
122955
122966
  try {
122956
- const value = fs45.readFileSync(path48.join(runnerHome(), "settings-refresh"), "utf8");
122967
+ const value = fs46.readFileSync(path49.join(runnerHome(), "settings-refresh"), "utf8");
122957
122968
  if (value !== refresh2) {
122958
122969
  refresh2 = value;
122959
122970
  redetect = true;