wildcrane-runner 0.6.31 → 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.31 — 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.31" : "0.0.0";
111404
- var AKB_VERSION = true ? "0.11.28" : "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.28",
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);
@@ -119274,24 +119285,25 @@ function matcher(entry) {
119274
119285
 
119275
119286
  // src/task-folder.ts
119276
119287
  var TASK_ID = /^[\w-]{1,100}$/;
119288
+ var NO_FOLDER = "This project has no folder on this computer. Link one, then try again.";
119277
119289
  var EMPTY = { assets: {} };
119278
119290
  function openTaskFolder(job, projectDir2) {
119279
119291
  const task = job.task ?? "";
119280
119292
  if (!TASK_ID.test(task)) throw new Error("This job names no task.");
119281
119293
  if (!job.project) throw new Error("This job names no project.");
119282
- projectDir2 ??= openCached(job.project);
119294
+ if (!projectDir2) throw new Error(NO_FOLDER);
119283
119295
  keepOutOfGit(projectDir2);
119284
119296
  markUsed(projectDir2);
119285
- const board = path35.join(projectDir2, ".akb", "kanban");
119286
- fs31.mkdirSync(board, { recursive: true });
119297
+ const board = path36.join(projectDir2, ".akb", "kanban");
119298
+ fs32.mkdirSync(board, { recursive: true });
119287
119299
  return { task, cloudTask: task, board, cwd: projectDir2, project: job.project, number: job.number ?? null, workflow: job.workflow ?? job.flow?.workflow ?? null };
119288
119300
  }
119289
119301
  function openAgentFolder(job, projectDir2) {
119290
119302
  if (!job.project || !job.agent) throw new Error("This job names no project.");
119291
119303
  keepOutOfGit(projectDir2);
119292
119304
  markUsed(projectDir2);
119293
- const board = path35.join(projectDir2, ".akb", "kanban");
119294
- fs31.mkdirSync(board, { recursive: true });
119305
+ const board = path36.join(projectDir2, ".akb", "kanban");
119306
+ fs32.mkdirSync(board, { recursive: true });
119295
119307
  return {
119296
119308
  task: `agent-${safe2(job.agent.workflow ? `${job.agent.workflow}-${job.agent.name}` : job.agent.name)}`,
119297
119309
  cloudTask: job.agent.tasks?.[0]?.id ?? null,
@@ -119306,13 +119318,13 @@ function openDiscussionFolder(job, projectDir2) {
119306
119318
  if (!job.project) throw new Error("This job names no project.");
119307
119319
  keepOutOfGit(projectDir2);
119308
119320
  markUsed(projectDir2);
119309
- const board = path35.join(projectDir2, ".akb", "kanban");
119310
- fs31.mkdirSync(board, { recursive: true });
119321
+ const board = path36.join(projectDir2, ".akb", "kanban");
119322
+ fs32.mkdirSync(board, { recursive: true });
119311
119323
  return { task: "discussion", cloudTask: null, board, cwd: projectDir2, project: job.project, number: null, workflow: null };
119312
119324
  }
119313
119325
  var boardFolder = (ws) => ({ task: "board", cloudTask: null, board: ws.board, cwd: ws.cwd, project: ws.project, number: null, workflow: null });
119314
119326
  function keptBoard(cwd) {
119315
- const board = path35.join(cwd, ".akb", "kanban");
119327
+ const board = path36.join(cwd, ".akb", "kanban");
119316
119328
  const base = readBase({ cwd });
119317
119329
  const project = base.project ?? /^projects\/([^/]+)\//.exec(Object.keys(base.files).find((p2) => p2.startsWith("projects/")) ?? "")?.[1];
119318
119330
  return base.head_seq === null || !project ? null : boardFolder({ board, cwd, project });
@@ -119327,11 +119339,6 @@ function inFolder(dir, work) {
119327
119339
  return next;
119328
119340
  }
119329
119341
  var safe2 = (name) => name.replace(/[^\w.-]/g, "_") || "default";
119330
- function openCached(project) {
119331
- const dir = cacheDir(project);
119332
- fs31.mkdirSync(dir, { recursive: true });
119333
- return dir;
119334
- }
119335
119342
  var SKILL_FOLDERS = [".claude/skills/kanban", ".agents/skills/kanban"];
119336
119343
  var SKILL_ROOTS = [".claude/skills", ".agents/skills"];
119337
119344
  function keepOutOfGit(dir, folders2 = SKILL_FOLDERS) {
@@ -119340,56 +119347,56 @@ function keepOutOfGit(dir, folders2 = SKILL_FOLDERS) {
119340
119347
  if (inside.status !== 0) return;
119341
119348
  const missing = [".akb/", ...folders2.map((f2) => `${f2}/`)].filter((p2) => git3("check-ignore", "-q", p2).status !== 0);
119342
119349
  if (!missing.length) return;
119343
- const exclude = path35.resolve(dir, inside.stdout.trim());
119344
- fs31.mkdirSync(path35.dirname(exclude), { recursive: true });
119345
- const held4 = fs31.existsSync(exclude) ? fs31.readFileSync(exclude, "utf8") : "";
119346
- 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")}
119347
119354
  `);
119348
119355
  }
119349
- 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`);
119350
119357
  function findCard(board, number) {
119351
119358
  const named2 = new RegExp(`^${number}-`);
119352
119359
  const walk = (dir) => {
119353
119360
  let entries;
119354
119361
  try {
119355
- entries = fs31.readdirSync(dir, { withFileTypes: true });
119362
+ entries = fs32.readdirSync(dir, { withFileTypes: true });
119356
119363
  } catch {
119357
119364
  return null;
119358
119365
  }
119359
119366
  for (const e2 of entries) {
119360
119367
  if (!named2.test(e2.name)) continue;
119361
- if (e2.isFile() && e2.name.endsWith(".md")) return path35.join(dir, e2.name);
119362
- const root2 = path35.join(dir, e2.name, "root.md");
119363
- 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;
119364
119371
  }
119365
119372
  for (const e2 of entries) if (e2.isDirectory() && !e2.name.startsWith(".")) {
119366
- const hit = walk(path35.join(dir, e2.name));
119373
+ const hit = walk(path36.join(dir, e2.name));
119367
119374
  if (hit) return hit;
119368
119375
  }
119369
119376
  return null;
119370
119377
  };
119371
- return walk(path35.join(board, "todo")) ?? walk(path35.join(board, ".archive"));
119378
+ return walk(path36.join(board, "todo")) ?? walk(path36.join(board, ".archive"));
119372
119379
  }
119373
119380
  function akbCardOf(ws) {
119374
119381
  return ws.number && findCard(ws.board, ws.number) ? ws.number : void 0;
119375
119382
  }
119376
- var recordFile = (ws) => path35.join(ws.board, ".sync", `${ws.task}.json`);
119383
+ var recordFile = (ws) => path36.join(ws.board, ".sync", `${ws.task}.json`);
119377
119384
  function readRecord(ws) {
119378
119385
  try {
119379
- return { ...EMPTY, ...JSON.parse(fs31.readFileSync(recordFile(ws), "utf8")) };
119386
+ return { ...EMPTY, ...JSON.parse(fs32.readFileSync(recordFile(ws), "utf8")) };
119380
119387
  } catch {
119381
119388
  return structuredClone(EMPTY);
119382
119389
  }
119383
119390
  }
119384
119391
  function writeRecord(ws, record) {
119385
- fs31.mkdirSync(path35.dirname(recordFile(ws)), { recursive: true });
119386
- 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)}
119387
119394
  `);
119388
119395
  }
119389
- var baseFile = (ws) => path35.join(ws.cwd, ".akb", "base.json");
119396
+ var baseFile = (ws) => path36.join(ws.cwd, ".akb", "base.json");
119390
119397
  function readBase(ws) {
119391
119398
  try {
119392
- const base = JSON.parse(fs31.readFileSync(baseFile(ws), "utf8"));
119399
+ const base = JSON.parse(fs32.readFileSync(baseFile(ws), "utf8"));
119393
119400
  if (base.layout === "workspace") return base;
119394
119401
  } catch {
119395
119402
  }
@@ -119397,25 +119404,25 @@ function readBase(ws) {
119397
119404
  }
119398
119405
  function writeBase(ws, base) {
119399
119406
  const file2 = baseFile(ws);
119400
- fs31.mkdirSync(path35.dirname(file2), { recursive: true });
119401
- fs31.writeFileSync(`${file2}.tmp`, JSON.stringify(base));
119402
- 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);
119403
119410
  }
119404
119411
  var hashOf2 = (bytes2) => crypto5.createHash("sha256").update(bytes2).digest("hex");
119405
119412
  function hashFile(file2) {
119406
119413
  try {
119407
- return hashOf2(fs31.readFileSync(file2));
119414
+ return hashOf2(fs32.readFileSync(file2));
119408
119415
  } catch {
119409
119416
  return null;
119410
119417
  }
119411
119418
  }
119412
119419
  function write(file2, bytes2) {
119413
- fs31.mkdirSync(path35.dirname(file2), { recursive: true });
119414
- fs31.writeFileSync(file2, bytes2);
119420
+ fs32.mkdirSync(path36.dirname(file2), { recursive: true });
119421
+ fs32.writeFileSync(file2, bytes2);
119415
119422
  }
119416
119423
  function readText(file2) {
119417
119424
  try {
119418
- return fs31.readFileSync(file2, "utf8");
119425
+ return fs32.readFileSync(file2, "utf8");
119419
119426
  } catch {
119420
119427
  return null;
119421
119428
  }
@@ -119423,14 +119430,14 @@ function readText(file2) {
119423
119430
  function filesUnder(dir, base = dir) {
119424
119431
  let entries;
119425
119432
  try {
119426
- entries = fs31.readdirSync(dir, { withFileTypes: true });
119433
+ entries = fs32.readdirSync(dir, { withFileTypes: true });
119427
119434
  } catch {
119428
119435
  return [];
119429
119436
  }
119430
119437
  return entries.flatMap((e2) => {
119431
- const full = path35.join(dir, e2.name);
119438
+ const full = path36.join(dir, e2.name);
119432
119439
  if (e2.isDirectory()) return filesUnder(full, base);
119433
- return e2.isFile() ? [path35.relative(base, full).split(path35.sep).join("/")] : [];
119440
+ return e2.isFile() ? [path36.relative(base, full).split(path36.sep).join("/")] : [];
119434
119441
  });
119435
119442
  }
119436
119443
  var kept3 = isBoardPath;
@@ -119453,18 +119460,18 @@ function assetFiles(ws, list) {
119453
119460
  return null;
119454
119461
  }
119455
119462
  };
119456
- 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("/")));
119457
119464
  }
119458
119465
  var assetsListOf = (ws, base) => base.files[rootOf(ws) + assetsFile(ws.task)]?.content;
119459
119466
  var localFiles = (ws, base) => {
119460
- 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))))]);
119461
119468
  return filesUnder(ws.board).filter((p2) => kept3(p2) && !assets.has(p2));
119462
119469
  };
119463
119470
  var SKILL_PATH = /^skills\/([a-z0-9]+(?:-[a-z0-9]+)*)\/((?:[\w.-]+\/)*[\w.-]+)$/;
119464
119471
  function pullTools(ws, record, files) {
119465
119472
  const held4 = record.tools?.skills ?? {};
119466
119473
  const ours = new Set(Object.keys(held4).map((name) => name.split("/")[1]));
119467
- 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)));
119468
119475
  const kept4 = Object.keys(files).map((name) => SKILL_PATH.exec(name)?.[1]).filter((skill) => skill && !theirs(skill));
119469
119476
  const skills = {};
119470
119477
  for (const [name, text4] of Object.entries(files)) {
@@ -119472,7 +119479,7 @@ function pullTools(ws, record, files) {
119472
119479
  if (!at2 || at2[1] === "kanban" || !kept4.includes(at2[1]) || at2[2].split("/").includes("..")) continue;
119473
119480
  skills[name] = hashOf2(text4);
119474
119481
  for (const root2 of SKILL_ROOTS) {
119475
- const file2 = path35.join(ws.cwd, root2, at2[1], at2[2]);
119482
+ const file2 = path36.join(ws.cwd, root2, at2[1], at2[2]);
119476
119483
  if (held4[name] !== skills[name] || hashFile(file2) !== skills[name]) write(file2, text4);
119477
119484
  }
119478
119485
  }
@@ -119481,8 +119488,8 @@ function pullTools(ws, record, files) {
119481
119488
  const [, skill, rest] = SKILL_PATH.exec(name) ?? [];
119482
119489
  if (!skill || !rest) continue;
119483
119490
  for (const root2 of SKILL_ROOTS) {
119484
- fs31.rmSync(path35.join(ws.cwd, root2, skill, rest), { force: true });
119485
- 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 });
119486
119493
  }
119487
119494
  }
119488
119495
  const names2 = [...new Set(Object.keys(skills).map((name) => name.split("/")[1]))];
@@ -119519,57 +119526,57 @@ async function pullWorkflow(ws, record) {
119519
119526
  if (files.ok) pullTools(ws, record, files.value);
119520
119527
  }
119521
119528
  dropPlacedAgents(ws);
119522
- 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 });
119523
119530
  record.agents = {};
119524
119531
  return { ok: true, value: void 0 };
119525
119532
  }
119526
- var agentsRecord = (ws) => path35.join(ws.board, ".sync", "agents.json");
119533
+ var agentsRecord = (ws) => path36.join(ws.board, ".sync", "agents.json");
119527
119534
  function readPlaced(ws) {
119528
119535
  try {
119529
- return JSON.parse(fs31.readFileSync(agentsRecord(ws), "utf8"));
119536
+ return JSON.parse(fs32.readFileSync(agentsRecord(ws), "utf8"));
119530
119537
  } catch {
119531
119538
  return {};
119532
119539
  }
119533
119540
  }
119534
119541
  function dropPlacedAgents(ws) {
119535
119542
  const placed = readPlaced(ws);
119536
- 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 });
119537
- 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 });
119538
119545
  }
119539
119546
  function pullDraftAgents(ws, record) {
119540
119547
  if (ws.workflow !== BUILDER) return;
119541
- const root2 = path35.join(ws.board, "workflows", draftFolder(ws.task), "agents");
119548
+ const root2 = path36.join(ws.board, "workflows", draftFolder(ws.task), "agents");
119542
119549
  record.agents ??= {};
119543
119550
  for (const name of filesUnder(root2)) {
119544
- const text4 = fs31.readFileSync(path35.join(root2, name));
119551
+ const text4 = fs32.readFileSync(path36.join(root2, name));
119545
119552
  const at2 = `agents/${name}`;
119546
119553
  record.agents[at2] = hashOf2(text4);
119547
- 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);
119548
119555
  }
119549
119556
  }
119550
119557
  function assetPath(ws, name, owner) {
119551
119558
  if (/^[a-z][\w+.-]*:/i.test(name) || name.startsWith("#") || name.startsWith("//")) return null;
119552
- if (path35.isAbsolute(name)) throw new Error(`absolute path: ${name}`);
119559
+ if (path36.isAbsolute(name)) throw new Error(`absolute path: ${name}`);
119553
119560
  const held4 = /^\.(assets|mockups)\//.exec(name);
119554
119561
  const state = stateDir(ws);
119555
- const root2 = held4 && state ? path35.join(state, held4[1]) : ws.board;
119556
- const file2 = held4 && state ? path35.resolve(root2, name.slice(held4[0].length)) : path35.resolve(path35.dirname(owner), name);
119557
- const roots = [ws.board, ...state ? ["assets", "mockups"].map((folder) => path35.join(state, folder, ...ws.number ? [String(ws.number)] : [])) : []];
119558
- 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);
119559
119566
  if (!roots.some((root3) => inside(file2, root3))) throw new Error(`outside the board: ${name}`);
119560
119567
  let existing = file2;
119561
- while (!fs31.existsSync(existing) && path35.dirname(existing) !== existing) existing = path35.dirname(existing);
119562
- const real = fs31.realpathSync(existing);
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));
119563
119570
  let stateParent = state;
119564
- while (stateParent && !fs31.existsSync(stateParent) && path35.dirname(stateParent) !== stateParent) stateParent = path35.dirname(stateParent);
119565
- const realState = state && stateParent ? path35.resolve(fs31.realpathSync(stateParent), path35.relative(stateParent, state)) : null;
119566
- 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)] : [])) : []];
119567
119574
  if (!realRoots.some((root3) => real === root3 || inside(real, root3))) throw new Error(`link outside the board: ${name}`);
119568
119575
  return file2;
119569
119576
  }
119570
119577
  function cardAssetsDir(ws, id) {
119571
119578
  const state = stateDir(ws);
119572
- return state && path35.join(state, "assets", String(id));
119579
+ return state && path36.join(state, "assets", String(id));
119573
119580
  }
119574
119581
  function stateDir(ws) {
119575
119582
  try {
@@ -119611,13 +119618,13 @@ var pullChanges = (ws) => inFolder(ws.cwd, async () => {
119611
119618
  const p2 = f2.path.startsWith(root2) ? f2.path.slice(root2.length) : f2.path;
119612
119619
  const isShared = p2.startsWith(MEMORY2) && shared(p2.slice(MEMORY2.length));
119613
119620
  if (kept3(p2) && isShared === !f2.path.startsWith(root2)) {
119614
- const file2 = path35.join(ws.board, p2);
119621
+ const file2 = path36.join(ws.board, p2);
119615
119622
  const here = readText(file2);
119616
119623
  if (here !== f2.content && here !== (base.files[f2.path]?.content ?? null)) {
119617
119624
  skipped = true;
119618
119625
  continue;
119619
119626
  }
119620
- if (f2.content === null) fs31.rmSync(file2, { force: true });
119627
+ if (f2.content === null) fs32.rmSync(file2, { force: true });
119621
119628
  else if (here !== f2.content) write(file2, f2.content);
119622
119629
  }
119623
119630
  if (f2.content === null) delete base.files[f2.path];
@@ -119631,7 +119638,7 @@ var pullChanges = (ws) => inFolder(ws.cwd, async () => {
119631
119638
  async function readCloud(ws) {
119632
119639
  const base = readBase(ws);
119633
119640
  const known2 = new Set(Object.keys(base.files));
119634
- 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)));
119635
119642
  if (base.workspace === void 0) {
119636
119643
  const project = await readProject(ws.project);
119637
119644
  if (!project.ok) return project;
@@ -119649,13 +119656,13 @@ async function readCloud(ws) {
119649
119656
  writeBase(ws, base);
119650
119657
  const reset = (view2) => {
119651
119658
  for (const [p2, content] of view2) {
119652
- const file2 = path35.join(ws.board, p2);
119659
+ const file2 = path36.join(ws.board, p2);
119653
119660
  if (!keepDraft.has(p2) && kept3(p2) && readText(file2) !== content) write(file2, content);
119654
119661
  }
119655
119662
  };
119656
119663
  const view = viewOf(ws, base, sharedMemory(ws.board));
119657
119664
  const first = (p2) => isSettingsPath(p2) && !known2.has(rootOf(ws) + p2);
119658
- 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 });
119659
119666
  reset(view);
119660
119667
  const record = readRecord(ws);
119661
119668
  const workflow = await pullWorkflow(ws, record);
@@ -119669,18 +119676,18 @@ async function readCloud(ws) {
119669
119676
  return { ok: true, value: void 0 };
119670
119677
  }
119671
119678
  function writeIndex(board) {
119672
- const todo = path35.join(board, "todo");
119679
+ const todo = path36.join(board, "todo");
119673
119680
  const cards = [];
119674
119681
  let entries = [];
119675
119682
  try {
119676
- entries = fs31.readdirSync(todo, { withFileTypes: true });
119683
+ entries = fs32.readdirSync(todo, { withFileTypes: true });
119677
119684
  } catch {
119678
119685
  }
119679
119686
  for (const e2 of entries) {
119680
119687
  const id = /^(\d+)-/.exec(e2.name)?.[1];
119681
119688
  if (!id) continue;
119682
119689
  const link = e2.isDirectory() ? `${e2.name}/root.md` : e2.name.endsWith(".md") ? e2.name : null;
119683
- const text5 = link && readText(path35.join(todo, link));
119690
+ const text5 = link && readText(path36.join(todo, link));
119684
119691
  if (text5 === null || !link) continue;
119685
119692
  cards.push({ id: Number(id), title: cardFront(text5).title ?? e2.name.replace(/\.md$/, ""), link });
119686
119693
  }
@@ -119695,7 +119702,7 @@ the number at the front of a filename is the task id.
119695
119702
 
119696
119703
  ${list}
119697
119704
  `;
119698
- 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);
119699
119706
  }
119700
119707
  var workspaceOf = (ws) => readBase(ws).workspace ?? null;
119701
119708
  async function pullAssets(ws, record, assets) {
@@ -119711,7 +119718,13 @@ async function pullAssets(ws, record, assets) {
119711
119718
  if (held4?.artifact === ref.artifact) out[name] = held4;
119712
119719
  continue;
119713
119720
  }
119714
- const target = assetPath(ws, name, file2);
119721
+ let target;
119722
+ try {
119723
+ target = assetPath(ws, name, file2);
119724
+ } catch {
119725
+ if (held4) out[name] = held4;
119726
+ continue;
119727
+ }
119715
119728
  if (!target) continue;
119716
119729
  let kind = held4?.artifact === ref.artifact ? held4.kind : void 0;
119717
119730
  let version = ref.version;
@@ -119719,6 +119732,10 @@ async function pullAssets(ws, record, assets) {
119719
119732
  const current2 = held4?.artifact === ref.artifact && held4.version === version && localHash === (held4.localHash ?? held4.hash);
119720
119733
  if (version === void 0 || !kind || !current2 && kind !== "html") {
119721
119734
  const latest = await readArtifact(ref.artifact);
119735
+ if (!latest.ok && latest.code === "not_found") {
119736
+ if (held4) out[name] = held4;
119737
+ continue;
119738
+ }
119722
119739
  if (!latest.ok) return latest;
119723
119740
  version ??= latest.value.latest_version ?? 0;
119724
119741
  kind = latest.value.type;
@@ -119733,6 +119750,10 @@ async function pullAssets(ws, record, assets) {
119733
119750
  continue;
119734
119751
  }
119735
119752
  const bytes2 = await readAsset(ref.artifact, version);
119753
+ if (!bytes2.ok && bytes2.code === "not_found") {
119754
+ if (held4) out[name] = held4;
119755
+ continue;
119756
+ }
119736
119757
  if (!bytes2.ok) return bytes2;
119737
119758
  let local = bytes2.value;
119738
119759
  const dependencies = [];
@@ -119753,10 +119774,14 @@ async function pullAssets(ws, record, assets) {
119753
119774
  const restored = mapReferences(manifest, data, (src, found) => {
119754
119775
  const name2 = Object.entries(assets).find(([, r2]) => r2.artifact === src)?.[0];
119755
119776
  if (!name2) return src;
119756
- const child = assetPath(ws, name2, file2);
119777
+ let child = null;
119778
+ try {
119779
+ child = assetPath(ws, name2, file2);
119780
+ } catch {
119781
+ }
119757
119782
  if (!child) return src;
119758
119783
  dependencies.push(name2);
119759
- 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("/");
119760
119785
  if (back !== src) changed = true;
119761
119786
  return back;
119762
119787
  });
@@ -119793,16 +119818,16 @@ async function readAsset(artifact, version) {
119793
119818
  return { ok: true, value: Buffer.from(typeof content === "string" ? content : JSON.stringify(content)) };
119794
119819
  }
119795
119820
  async function sentOf(file2, kind) {
119796
- const ext = path35.extname(file2).toLowerCase();
119797
- 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 };
119798
119823
  const page = await (await Promise.resolve().then(() => (init_mockup(), mockup_exports))).drawMockup(file2);
119799
119824
  return { bytes: Buffer.from(page), type: "text/html", kind };
119800
119825
  }
119801
- 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}`] : []);
119802
119827
  function undrawn(ws, reason) {
119803
119828
  const state = stateDir(ws);
119804
- for (const [root2, shown] of [...state ? [[path35.join(state, "assets"), ".assets"], [path35.join(state, "mockups"), ".mockups"]] : [], [ws.board, ""]]) {
119805
- 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}/`);
119806
119831
  }
119807
119832
  return reason.replace(/ \(at [^)]*file:\/\/[^)]*\)$/, "").slice(0, 500);
119808
119833
  }
@@ -119825,14 +119850,14 @@ async function pushAssets(ws, record, before) {
119825
119850
  if (body === null) return { ok: true, value: void 0 };
119826
119851
  const refs = {};
119827
119852
  const canonical = (target) => {
119828
- 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));
119829
119854
  target = real(target);
119830
119855
  const state = stateDir(ws);
119831
119856
  for (const folder of ["assets", "mockups"]) {
119832
- const root2 = state && real(path35.join(state, folder));
119833
- 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("/")}`;
119834
119859
  }
119835
- 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("/");
119836
119861
  };
119837
119862
  try {
119838
119863
  const graph = collect(body, file2, {
@@ -119842,11 +119867,11 @@ async function pushAssets(ws, record, before) {
119842
119867
  const target = assetPath(ws, src, owner);
119843
119868
  if (!target) return null;
119844
119869
  const key = owner === file2 && before[src] ? src : canonical(target);
119845
- if (!fs31.statSync(target, { throwIfNoEntry: false })?.isFile()) {
119870
+ if (!fs32.statSync(target, { throwIfNoEntry: false })?.isFile()) {
119846
119871
  if (before[key]) return { key, file: null };
119847
119872
  throw new Error(`file not found: ${target}`);
119848
119873
  }
119849
- return { key: canonical(fs31.realpathSync(target)), file: target };
119874
+ return { key: canonical(fs32.realpathSync(target)), file: target };
119850
119875
  },
119851
119876
  read: referenceText,
119852
119877
  retained: (key) => (record.assets[key]?.dependencies ?? []).map((src) => {
@@ -119919,7 +119944,7 @@ async function pushAssets(ws, record, before) {
119919
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);
119920
119945
  if (!entry || !unchanged && entry.hash !== hash || entry.kind && entry.kind !== out.kind) {
119921
119946
  if (!ws.cloudTask) continue;
119922
- 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;
119923
119948
  if (!artifact) {
119924
119949
  const made = await createArtifact(ws.cloudTask, node.key.slice(0, 200), out.kind);
119925
119950
  if (!made.ok) return { ...made, error: `${node.key}: ${made.error}` };
@@ -119939,24 +119964,24 @@ async function pushAssets(ws, record, before) {
119939
119964
  } catch (error) {
119940
119965
  return { ok: false, code: "bad_request", error: error instanceof Error ? error.message : String(error) };
119941
119966
  }
119942
- const list = path35.join(ws.board, assetsFile(ws.task));
119943
- 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)) {
119944
119969
  if (JSON.stringify(assetsOf(readText(list))) !== JSON.stringify(refs)) write(list, assetsText(refs));
119945
119970
  }
119946
119971
  return { ok: true, value: void 0 };
119947
119972
  }
119948
119973
  function resetSorted(ws) {
119949
- 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 });
119950
119975
  for (const [p2, content] of viewOf(ws, readBase(ws), sharedMemory(ws.board))) {
119951
- 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);
119952
119977
  }
119953
119978
  }
119954
119979
  function proposeItems(ws, base) {
119955
119980
  const root2 = rootOf(ws);
119956
119981
  for (const p2 of localFiles(ws, base)) {
119957
119982
  if (itemAt(p2)?.state !== "open" || base.files[root2 + p2]) continue;
119958
- const file2 = path35.join(ws.board, p2);
119959
- const content = fs31.readFileSync(file2, "utf8");
119983
+ const file2 = path36.join(ws.board, p2);
119984
+ const content = fs32.readFileSync(file2, "utf8");
119960
119985
  const said = (key) => new RegExp(`^${key}:`, "m").test(content.split(/\n---/)[0] ?? "");
119961
119986
  const fields = {
119962
119987
  ...ws.cloudTask && !said("source_task") ? { source_task: ws.cloudTask } : {},
@@ -119996,9 +120021,9 @@ async function send2(ws, job) {
119996
120021
  const record = readRecord(ws);
119997
120022
  const base = readBase(ws);
119998
120023
  const fail = (error, conflict = false, code) => ({ ok: false, conflict, error, ...code ? {} : { offline: true } });
119999
- 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) => {
120000
120025
  try {
120001
- 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"));
120002
120027
  if (!held4.task || !TASK_ID.test(held4.task) || !held4.number) return [];
120003
120028
  return [{ folder: { ...ws, task: held4.task, cloudTask: held4.task, number: held4.number }, record: held4 }];
120004
120029
  } catch {
@@ -120010,7 +120035,7 @@ async function send2(ws, job) {
120010
120035
  const deferredLists = /* @__PURE__ */ new Set();
120011
120036
  const assetErrors = {};
120012
120037
  for (const item of tasks) {
120013
- 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("/");
120014
120039
  const archived = boardSync && card.startsWith(".archive/") && base.files[rootOf(ws) + card];
120015
120040
  if (!archived) {
120016
120041
  const assets = await pushAssets(item.folder, item.record, assetsOf(assetsListOf(item.folder, base)));
@@ -120052,7 +120077,7 @@ async function send2(ws, job) {
120052
120077
  const owed = (p2) => !job.id && busy(ws.cwd) && itemAt(p2)?.state === "open" && !base.files[rootOf(ws) + p2];
120053
120078
  for (const p2 of local) {
120054
120079
  if (defer(p2) || owed(p2)) continue;
120055
- const content = fs31.readFileSync(path35.join(ws.board, p2), "utf8");
120080
+ const content = fs32.readFileSync(path36.join(ws.board, p2), "utf8");
120056
120081
  const remote2 = remoteOf(ws, shared, p2);
120057
120082
  localOf.set(remote2, p2);
120058
120083
  const held4 = base.files[remote2];
@@ -120084,15 +120109,15 @@ async function send2(ws, job) {
120084
120109
  changes.splice(at2, 1);
120085
120110
  delete base.files[theirs.path];
120086
120111
  writeBase(ws, base);
120087
- fs31.rmSync(path35.join(ws.board, p2), { force: true });
120112
+ fs32.rmSync(path36.join(ws.board, p2), { force: true });
120088
120113
  writeIndex(ws.board);
120089
120114
  continue;
120090
120115
  }
120091
120116
  if (at2 < 0) continue;
120092
120117
  const merged = itemAt(p2) ? { content: theirs.content } : mergeFile(base.files[theirs.path]?.content ?? null, changes[at2].content, theirs.content);
120093
120118
  changes[at2] = { path: theirs.path, content: merged.content, base_seq: theirs.seq };
120094
- if (merged.content === null) fs31.rmSync(path35.join(ws.board, p2), { force: true });
120095
- 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);
120096
120121
  }
120097
120122
  if (!changes.length) return success(false);
120098
120123
  sent = await commitBoard(ws.project, job.id, job.machineId, changes);
@@ -120113,7 +120138,7 @@ var BUSY_MS = 3e4;
120113
120138
  function keptFolders() {
120114
120139
  let cached2 = [];
120115
120140
  try {
120116
- cached2 = fs32.readdirSync(cacheRoot()).map((name) => path36.join(cacheRoot(), name));
120141
+ cached2 = fs33.readdirSync(cacheRoot()).map((name) => fs33.realpathSync(path37.join(cacheRoot(), name)));
120117
120142
  } catch {
120118
120143
  }
120119
120144
  return [.../* @__PURE__ */ new Set([...allowedProjects(), ...cached2])].flatMap((dir) => [keptBoard(dir)].filter((ws) => !!ws));
@@ -120149,8 +120174,8 @@ function watchBoards(machineId2, ms, lookMs = LOOK_MS, pullMs = PULL_MS, busyMs
120149
120174
  const watch = (ws) => {
120150
120175
  let watcher;
120151
120176
  try {
120152
- watcher = fs32.watch(ws.board, { recursive: true }, (_event, name) => {
120153
- 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("/");
120154
120179
  const held4 = watched.get(ws.cwd);
120155
120180
  if (closed || !p2 || !isBoardPath(p2) || !held4) return;
120156
120181
  const job = busy(ws.cwd);
@@ -120213,8 +120238,8 @@ function watchBoards(machineId2, ms, lookMs = LOOK_MS, pullMs = PULL_MS, busyMs
120213
120238
 
120214
120239
  // src/diff.ts
120215
120240
  import { execFile as execFile2 } from "node:child_process";
120216
- import fs33 from "node:fs";
120217
- import path37 from "node:path";
120241
+ import fs34 from "node:fs";
120242
+ import path38 from "node:path";
120218
120243
  var FILE_BYTES = 256 * 1024;
120219
120244
  var TOTAL_BYTES = 1024 * 1024;
120220
120245
  var EMPTY_TREE = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
@@ -120231,7 +120256,7 @@ var git2 = (dir, args, maxBuffer = 4 * TOTAL_BYTES) => new Promise(
120231
120256
  function projectDir(placed, project) {
120232
120257
  if (placed) {
120233
120258
  const real = realpath3(placed);
120234
- 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;
120235
120260
  }
120236
120261
  let cached2;
120237
120262
  try {
@@ -120239,11 +120264,11 @@ function projectDir(placed, project) {
120239
120264
  } catch {
120240
120265
  return null;
120241
120266
  }
120242
- return fs33.existsSync(path37.join(cached2, ".git")) ? cached2 : null;
120267
+ return fs34.existsSync(path38.join(cached2, ".git")) ? cached2 : null;
120243
120268
  }
120244
120269
  function realpath3(p2) {
120245
120270
  try {
120246
- return fs33.realpathSync(p2);
120271
+ return fs34.realpathSync(p2);
120247
120272
  } catch {
120248
120273
  return null;
120249
120274
  }
@@ -120290,20 +120315,20 @@ async function answerHint(machineId2, hint2) {
120290
120315
  // ../cli/src/lib/agent/stop.ts
120291
120316
  import { spawnSync as spawnSync4 } from "node:child_process";
120292
120317
  import { randomUUID as randomUUID2 } from "node:crypto";
120293
- import fs34 from "node:fs";
120318
+ import fs35 from "node:fs";
120294
120319
  var runMark = (sessionId) => ({ name: RUN_ENV, value: sessionId });
120295
120320
  var stopMark = () => ({ name: STOP_ENV, value: randomUUID2() });
120296
120321
  var markEnv = (env2, mark) => ({ ...env2, [mark.name]: mark.value });
120297
120322
  var WINDOWS3 = process.platform === "win32";
120298
120323
  function markedInProc(entry, strict = false) {
120299
120324
  const pids = [];
120300
- for (const name of fs34.readdirSync("/proc")) {
120325
+ for (const name of fs35.readdirSync("/proc")) {
120301
120326
  if (!/^\d+$/.test(name)) continue;
120302
120327
  try {
120303
- 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));
120304
120329
  } catch (error) {
120305
120330
  if (strict && !["ENOENT", "ESRCH"].includes(error.code ?? "")) {
120306
- const stat = fs34.statSync(`/proc/${name}`, { throwIfNoEntry: false });
120331
+ const stat = fs35.statSync(`/proc/${name}`, { throwIfNoEntry: false });
120307
120332
  if (stat?.uid === process.getuid?.()) throw error;
120308
120333
  }
120309
120334
  }
@@ -120429,8 +120454,8 @@ function processesStopped(mark, root2) {
120429
120454
  }
120430
120455
 
120431
120456
  // src/flow.ts
120432
- import fs39 from "node:fs";
120433
- import path42 from "node:path";
120457
+ import fs40 from "node:fs";
120458
+ import path43 from "node:path";
120434
120459
 
120435
120460
  // ../cli/src/lib/card-review.ts
120436
120461
  function reviewOf(meta) {
@@ -120445,8 +120470,8 @@ function reviewOf(meta) {
120445
120470
  }
120446
120471
 
120447
120472
  // src/triage.ts
120448
- import fs35 from "node:fs";
120449
- import path38 from "node:path";
120473
+ import fs36 from "node:fs";
120474
+ import path39 from "node:path";
120450
120475
 
120451
120476
  // ../cli/src/lib/signals/identity.ts
120452
120477
  import { createHash as createHash2 } from "node:crypto";
@@ -120454,8 +120479,8 @@ var DERIVED = "derived-";
120454
120479
  var derivedSourceId = (seed) => `${DERIVED}${createHash2("sha256").update(seed).digest("hex").slice(0, 16)}`;
120455
120480
 
120456
120481
  // src/triage.ts
120457
- var triageDir = (board) => path38.join(board, "triage");
120458
- 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);
120459
120484
  var SCRATCH = ["dismissed", "archived"];
120460
120485
  var stamp2 = (at2) => formatStamp(at2 ? new Date(at2) : /* @__PURE__ */ new Date());
120461
120486
  function slugOf(title) {
@@ -120464,7 +120489,7 @@ function slugOf(title) {
120464
120489
  function freeName(dir, title) {
120465
120490
  const stem = slugOf(title);
120466
120491
  let name = `${stem}.md`;
120467
- 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`;
120468
120493
  return name;
120469
120494
  }
120470
120495
  function itemText(item, fields = {}) {
@@ -120484,17 +120509,17 @@ ${item.text.trim()}
120484
120509
  `;
120485
120510
  }
120486
120511
  function writeItem(dir, item, fields = {}) {
120487
- fs35.mkdirSync(dir, { recursive: true });
120512
+ fs36.mkdirSync(dir, { recursive: true });
120488
120513
  const name = freeName(dir, item.title);
120489
- 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));
120490
120515
  return name;
120491
120516
  }
120492
120517
  function layOut(board, rejections) {
120493
120518
  clearLaid(board);
120494
120519
  const dir = rejectedDir(board);
120495
- fs35.mkdirSync(dir, { recursive: true });
120520
+ fs36.mkdirSync(dir, { recursive: true });
120496
120521
  for (const t2 of rejections.tasks) {
120497
- fs35.writeFileSync(path38.join(dir, `${t2.number}-${slugify(t2.title)}.md`), [
120522
+ fs36.writeFileSync(path39.join(dir, `${t2.number}-${slugify(t2.title)}.md`), [
120498
120523
  "---",
120499
120524
  `title: ${yamlScalar(t2.title)}`,
120500
120525
  "status: todo",
@@ -120509,20 +120534,20 @@ function layOut(board, rejections) {
120509
120534
  ].join("\n"));
120510
120535
  }
120511
120536
  for (const item of rejections.triage) {
120512
- const sub = path38.join(triageDir(board), item.state === "dismissed" ? "dismissed" : "archived");
120537
+ const sub = path39.join(triageDir(board), item.state === "dismissed" ? "dismissed" : "archived");
120513
120538
  const fields = item.state === "dismissed" ? { dismissed_at: stamp2(item.dismissed_at), dismissed_by: "user", ...item.dismissed_reason ? { dismissed_reason: item.dismissed_reason } : {} } : {};
120514
120539
  writeItem(sub, item, fields);
120515
120540
  }
120516
120541
  return { tasks: rejections.tasks.map((t2) => t2.id), triage: rejections.triage.map((i) => i.id) };
120517
120542
  }
120518
120543
  function clearLaid(board) {
120519
- fs35.rmSync(rejectedDir(board), { recursive: true, force: true });
120520
- 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 });
120521
120546
  }
120522
120547
 
120523
120548
  // src/kanban-skill.ts
120524
- import fs36 from "node:fs";
120525
- import path39 from "node:path";
120549
+ import fs37 from "node:fs";
120550
+ import path40 from "node:path";
120526
120551
 
120527
120552
  // ../skill/SKILL.md
120528
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';
@@ -120535,24 +120560,24 @@ var CONTENT = `${SKILL_default.trimEnd()}
120535
120560
  var MANAGED = /^<!-- ai4kanban \S+ -->$/m;
120536
120561
  function prepareKanbanSkill(root2) {
120537
120562
  for (const folder of SKILL_FOLDERS) {
120538
- const dir = path39.join(root2, folder);
120539
- const file2 = path39.join(dir, "SKILL.md");
120563
+ const dir = path40.join(root2, folder);
120564
+ const file2 = path40.join(dir, "SKILL.md");
120540
120565
  try {
120541
120566
  let linked = false;
120542
120567
  let at2 = root2;
120543
120568
  for (const name of `${folder}/SKILL.md`.split("/")) {
120544
- at2 = path39.join(at2, name);
120545
- 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;
120546
120571
  }
120547
- const held4 = fs36.existsSync(file2) ? fs36.readFileSync(file2, "utf8") : null;
120548
- 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;
120549
120574
  if (linked || exists && !MANAGED.test(held4 ?? "")) {
120550
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");
120551
120576
  continue;
120552
120577
  }
120553
120578
  if (held4 !== CONTENT) {
120554
- fs36.mkdirSync(dir, { recursive: true });
120555
- fs36.writeFileSync(file2, CONTENT);
120579
+ fs37.mkdirSync(dir, { recursive: true });
120580
+ fs37.writeFileSync(file2, CONTENT);
120556
120581
  }
120557
120582
  } catch (e2) {
120558
120583
  throw new Error(`\u65E0\u6CD5\u51C6\u5907 ${folder}\uFF1A${e2 instanceof Error ? e2.message : String(e2)}`);
@@ -120562,12 +120587,12 @@ function prepareKanbanSkill(root2) {
120562
120587
 
120563
120588
  // ../cli/src/lib/skill/hook.ts
120564
120589
  import { spawnSync as spawnSync5 } from "node:child_process";
120565
- import fs37 from "node:fs";
120566
- import path40 from "node:path";
120590
+ import fs38 from "node:fs";
120591
+ import path41 from "node:path";
120567
120592
  var MARKER_LINE = /^# ai4kanban commit guard\b/m;
120568
120593
  var read2 = (file2) => {
120569
120594
  try {
120570
- return fs37.readFileSync(file2, "utf8");
120595
+ return fs38.readFileSync(file2, "utf8");
120571
120596
  } catch {
120572
120597
  return null;
120573
120598
  }
@@ -120579,28 +120604,28 @@ function hooksDir(root2) {
120579
120604
  windowsHide: true
120580
120605
  });
120581
120606
  if (out.error || out.status !== 0 || !out.stdout.trim()) return null;
120582
- return path40.resolve(root2, out.stdout.trim());
120607
+ return path41.resolve(root2, out.stdout.trim());
120583
120608
  }
120584
120609
  function installCommitHook(root2, _board) {
120585
120610
  const dir = hooksDir(root2);
120586
120611
  if (!dir) return {};
120587
- const file2 = path40.join(dir, "pre-commit");
120588
- 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 {};
120589
120614
  const source = read2(file2);
120590
- if (source && MARKER_LINE.test(source)) fs37.unlinkSync(file2);
120615
+ if (source && MARKER_LINE.test(source)) fs38.unlinkSync(file2);
120591
120616
  return {};
120592
120617
  }
120593
120618
 
120594
120619
  // src/built.ts
120595
- import fs38 from "node:fs";
120596
- import path41 from "node:path";
120620
+ import fs39 from "node:fs";
120621
+ import path42 from "node:path";
120597
120622
  var isBuilder = (ws) => ws.workflow === BUILDER;
120598
- var draftDir = (ws) => path41.join(ws.board, "workflows", draftFolder(ws.task));
120599
- 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("/")}/ -->`;
120600
120625
  var skeleton = (name) => ["---", `name: ${/\s#/.test(name) ? JSON.stringify(name) : yamlScalar(name)}`, "needsArtifact: false", "---", ""].join("\n");
120601
120626
  async function placeDraft(ws, read3) {
120602
120627
  const dir = draftDir(ws);
120603
- 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 };
120604
120629
  const task = await read3.readTask(ws.task);
120605
120630
  if (!task.ok) return task;
120606
120631
  let files = { [WORKFLOW_FILE]: skeleton(task.value.title.trim() || "Untitled") };
@@ -120611,10 +120636,10 @@ async function placeDraft(ws, read3) {
120611
120636
  files = held4.value.files;
120612
120637
  }
120613
120638
  for (const [name, text4] of Object.entries(files)) {
120614
- const file2 = path41.resolve(dir, name);
120615
- if (!file2.startsWith(dir + path41.sep)) continue;
120616
- fs38.mkdirSync(path41.dirname(file2), { recursive: true });
120617
- 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);
120618
120643
  }
120619
120644
  return { ok: true, value: void 0 };
120620
120645
  }
@@ -120626,7 +120651,7 @@ async function builtWorkflow(ws, akb) {
120626
120651
  const dir = draftDir(ws);
120627
120652
  let source;
120628
120653
  try {
120629
- source = fs38.readFileSync(path41.join(dir, WORKFLOW_FILE), "utf8");
120654
+ source = fs39.readFileSync(path42.join(dir, WORKFLOW_FILE), "utf8");
120630
120655
  } catch {
120631
120656
  return fail(`workflows/${id}/${WORKFLOW_FILE} is missing.`);
120632
120657
  }
@@ -120634,25 +120659,25 @@ async function builtWorkflow(ws, akb) {
120634
120659
  if ("problem" in read3) return fail(read3.problem);
120635
120660
  const names2 = named(read3.def);
120636
120661
  const run2 = async (args) => answerOf2(await runAkb(akb, [...args, "--json", "--board", ws.board], { cwd: ws.cwd, board: ws.board }));
120637
- const agents = path41.join(dir, "agents");
120638
- for (const old of fs38.existsSync(agents) ? fs38.readdirSync(agents) : []) {
120639
- 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 });
120640
120665
  }
120641
120666
  for (const name of names2) {
120642
- const from = path41.join(ws.board, "agents", name);
120643
- const to = path41.join(agents, name);
120644
- if (fs38.existsSync(from)) {
120645
- fs38.rmSync(to, { recursive: true, force: true });
120646
- fs38.cpSync(from, to, { recursive: true });
120647
- } 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"))) {
120648
120673
  const own = await run2(["raw", "agent-file", name, "AGENT.md"]);
120649
120674
  if (own?.text) {
120650
- fs38.mkdirSync(to, { recursive: true });
120651
- 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);
120652
120677
  }
120653
120678
  }
120654
120679
  }
120655
- 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")]));
120656
120681
  const checked = checkWorkflowFiles(files);
120657
120682
  if (!checked.ok) return fail(`${checked.file} ${checked.reason}.`);
120658
120683
  const list = await run2(["workflow", "list"]);
@@ -120686,7 +120711,7 @@ function spentBy(runs) {
120686
120711
  }
120687
120712
  function reviewOf2(file2) {
120688
120713
  try {
120689
- const meta = parseFrontmatter(fs39.readFileSync(file2, "utf8")).meta;
120714
+ const meta = parseFrontmatter(fs40.readFileSync(file2, "utf8")).meta;
120690
120715
  return meta ? reviewOf(meta) : null;
120691
120716
  } catch {
120692
120717
  return null;
@@ -120694,15 +120719,15 @@ function reviewOf2(file2) {
120694
120719
  }
120695
120720
  function asks(file2) {
120696
120721
  try {
120697
- return openOf(parseFrontmatter(fs39.readFileSync(file2, "utf8")).meta?.questions ?? []).length > 0;
120722
+ return openOf(parseFrontmatter(fs40.readFileSync(file2, "utf8")).meta?.questions ?? []).length > 0;
120698
120723
  } catch {
120699
120724
  return false;
120700
120725
  }
120701
120726
  }
120702
120727
  function mcpConfig(servers, file2) {
120703
120728
  if (!Object.keys(servers).length) return null;
120704
- fs39.mkdirSync(path42.dirname(file2), { recursive: true });
120705
- 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)}
120706
120731
  `);
120707
120732
  return file2;
120708
120733
  }
@@ -120741,7 +120766,7 @@ function deliveryEnding(ws, id, asked = false) {
120741
120766
  if (!id) return null;
120742
120767
  let held4;
120743
120768
  try {
120744
- 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"));
120745
120770
  } catch {
120746
120771
  return null;
120747
120772
  }
@@ -120753,16 +120778,16 @@ function deliveryEnding(ws, id, asked = false) {
120753
120778
  return null;
120754
120779
  }
120755
120780
  function checkoutsOf(ws, id) {
120756
- const dir = path42.join(ws.board, "deliveries");
120781
+ const dir = path43.join(ws.board, "deliveries");
120757
120782
  let names2;
120758
120783
  try {
120759
- names2 = fs39.readdirSync(dir).filter((n) => n.endsWith(".json"));
120784
+ names2 = fs40.readdirSync(dir).filter((n) => n.endsWith(".json"));
120760
120785
  } catch {
120761
120786
  return [];
120762
120787
  }
120763
120788
  return names2.flatMap((n) => {
120764
120789
  try {
120765
- const held4 = JSON.parse(fs39.readFileSync(path42.join(dir, n), "utf8"));
120790
+ const held4 = JSON.parse(fs40.readFileSync(path43.join(dir, n), "utf8"));
120766
120791
  return held4.cardId === id && held4.deliveryId ? [held4.deliveryId] : [];
120767
120792
  } catch {
120768
120793
  return [];
@@ -120776,7 +120801,7 @@ var RESUME_REFUSED = {
120776
120801
  deliveryRunGoing: "\u4E0A\u6B21\u7684\u8FD0\u884C\u8FD8\u6CA1\u505C\u4E0B\uFF0C\u8BF7\u7A0D\u540E\u518D\u70B9\u300C\u7EED\u8DD1\u300D\u3002",
120777
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"
120778
120803
  };
120779
- 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";
120780
120805
  var refusal2 = (ran) => ran.last.replace(/^akb( raw)?: /, "").slice(0, 300) || "akb stopped with an error.";
120781
120806
  var firstLine = (text4) => (text4 ?? "").split("\n").map((l2) => l2.trim()).find(Boolean)?.slice(0, 300);
120782
120807
  function logLines(show, event2) {
@@ -120834,7 +120859,7 @@ async function setUp(job, ws, deps, io) {
120834
120859
  const runtime = job.runtime;
120835
120860
  const missing = unavailable(runtime, await deps.runtimes());
120836
120861
  if (missing) return missing;
120837
- if (!fs39.existsSync(path42.join(ws.board, "config.md"))) {
120862
+ if (!fs40.existsSync(path43.join(ws.board, "config.md"))) {
120838
120863
  const init = await akb(["raw", "init"]);
120839
120864
  if (init.code !== 0) return refusal2(init);
120840
120865
  }
@@ -120851,7 +120876,7 @@ async function setUp(job, ws, deps, io) {
120851
120876
  const used = await akb(["agent", "use", runtime]);
120852
120877
  if (used.code !== 0) return refusal2(used);
120853
120878
  const servers = mcpServersOf(ws);
120854
- const mcpFile = path42.join(ws.board, ".sync", `${ws.task}.mcp.json`);
120879
+ const mcpFile = path43.join(ws.board, ".sync", `${ws.task}.mcp.json`);
120855
120880
  const takes = new Set(settingKeys(runtime));
120856
120881
  const given = job.settings ?? {};
120857
120882
  const values = { ...given, model: job.model ?? "" };
@@ -120951,19 +120976,19 @@ async function runAgent(job, ws, deps, io) {
120951
120976
  }
120952
120977
  function writeTranscript(job, dir) {
120953
120978
  if (!job.transcript) return "";
120954
- const file2 = path42.join(dir, "discussion.md");
120955
- fs39.mkdirSync(dir, { recursive: true });
120956
- 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}
120957
120982
  `);
120958
120983
  return file2;
120959
120984
  }
120960
120985
  function pictures(job, ws, id) {
120961
120986
  const dir = cardAssetsDir(ws, id);
120962
120987
  if (!job.attachments.length || !dir) return "";
120963
- fs39.mkdirSync(dir, { recursive: true });
120988
+ fs40.mkdirSync(dir, { recursive: true });
120964
120989
  return job.attachments.map((a2, i) => {
120965
- const file2 = `${i + 1}-${path42.basename(a2.name).replace(/[^\w.-]+/g, "-")}`;
120966
- 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"));
120967
120992
  return `
120968
120993
  <Asset src=".assets/${id}/${file2}" label="${a2.name.replace(/["<>]/g, "") || file2}" />
120969
120994
  `;
@@ -120971,7 +120996,7 @@ function pictures(job, ws, id) {
120971
120996
  }
120972
120997
  function cardFlags(ws, fields) {
120973
120998
  if (!fields) return [];
120974
- 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));
120975
121000
  const lists = [["--modules", fields.modules ?? []], ["--related", open(fields.related)], ["--blocked-by", open(fields.blocked_by)]];
120976
121001
  return [
120977
121002
  ...fields.priority ? ["--priority", fields.priority] : [],
@@ -121006,10 +121031,10 @@ async function runFlow(job, ws, deps, io) {
121006
121031
  const placed = await placeDraft(ws, deps.api);
121007
121032
  if (!placed.ok) return fail(placed.error);
121008
121033
  }
121009
- const body = path42.join(ws.board, ".sync", `${ws.task}.request.md`);
121010
- 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 });
121011
121036
  if (!ws.number) return fail("This task has no number yet.");
121012
- fs39.writeFileSync(body, `${said.request || title}
121037
+ fs40.writeFileSync(body, `${said.request || title}
121013
121038
  ${isBuilder(ws) ? `
121014
121039
  ${draftLine(ws)}
121015
121040
  ` : ""}${pictures(job, ws, ws.number)}`);
@@ -121027,7 +121052,7 @@ ${draftLine(ws)}
121027
121052
  ...cardFlags(ws, flow.metadata),
121028
121053
  "--json"
121029
121054
  ]));
121030
- fs39.rmSync(body, { force: true });
121055
+ fs40.rmSync(body, { force: true });
121031
121056
  if (!created.ok) return fail(created.error);
121032
121057
  id = created.value;
121033
121058
  }
@@ -121043,7 +121068,7 @@ ${draftLine(ws)}
121043
121068
  if (io.lost()) return fail("");
121044
121069
  return await workOn(card);
121045
121070
  } finally {
121046
- 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 });
121047
121072
  const left = working.get(key) - 1;
121048
121073
  if (left) working.set(key, left);
121049
121074
  else working.delete(key);
@@ -121088,7 +121113,7 @@ ${draftLine(ws)}
121088
121113
  const resolved2 = await akb(["card", "resolve", String(id2), "--follow", "--events", "--json", "--", text4], true);
121089
121114
  if (io.lost()) return fail("");
121090
121115
  const file2 = findCard(ws.board, id2);
121091
- 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;
121092
121117
  if (rejected) ran = resolved2;
121093
121118
  else if (resolved2.code !== 0) note = text4;
121094
121119
  }
@@ -121132,7 +121157,7 @@ ${draftLine(ws)}
121132
121157
  }
121133
121158
  function carryArgs(verb) {
121134
121159
  if (!["refine", "resolve", "revise", "implement"].includes(verb)) return [];
121135
- 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`));
121136
121161
  return [
121137
121162
  ...job.resume ? ["--session", job.resume, ...job.fork ? ["--fork"] : []] : [],
121138
121163
  ...transcript ? ["--transcript", transcript] : []
@@ -121151,8 +121176,8 @@ async function confirmFlowStopped(ws, job, deps) {
121151
121176
  }
121152
121177
 
121153
121178
  // src/recovery.ts
121154
- import fs40 from "node:fs";
121155
- import path43 from "node:path";
121179
+ import fs41 from "node:fs";
121180
+ import path44 from "node:path";
121156
121181
 
121157
121182
  // ../cli/src/lib/agent/retry.ts
121158
121183
  var RETRY_WINDOW_MS = 15 * 6e4;
@@ -121168,10 +121193,10 @@ function backoffMs(attempt, random = Math.random) {
121168
121193
  var PREPARE_REASON = "Runner update prepare.";
121169
121194
  var UPDATE_REASON = "Runner update checkpoint.";
121170
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";
121171
- var fileOf2 = (id) => path43.join(runnerHome(), "checkpoints", `${encodeURIComponent(id)}.json`);
121196
+ var fileOf2 = (id) => path44.join(runnerHome(), "checkpoints", `${encodeURIComponent(id)}.json`);
121172
121197
  function readCheckpoint(id) {
121173
121198
  try {
121174
- const held4 = JSON.parse(fs40.readFileSync(fileOf2(id), "utf8"));
121199
+ const held4 = JSON.parse(fs41.readFileSync(fileOf2(id), "utf8"));
121175
121200
  if (!held4 || !Array.isArray(held4.pending) || !held4.pending.every((id2) => typeof id2 === "string")) throw new Error("\u8FDB\u5EA6\u683C\u5F0F\u9519\u8BEF");
121176
121201
  return held4;
121177
121202
  } catch (e2) {
@@ -121181,12 +121206,12 @@ function readCheckpoint(id) {
121181
121206
  }
121182
121207
  function saveCheckpoint(id, checkpoint) {
121183
121208
  const file2 = fileOf2(id);
121184
- fs40.mkdirSync(path43.dirname(file2), { recursive: true, mode: 448 });
121185
- fs40.writeFileSync(`${file2}.tmp`, JSON.stringify(checkpoint), { mode: 384 });
121186
- 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);
121187
121212
  }
121188
121213
  function clearCheckpoint(id) {
121189
- fs40.rmSync(fileOf2(id), { force: true });
121214
+ fs41.rmSync(fileOf2(id), { force: true });
121190
121215
  }
121191
121216
  function checkpointEvent(checkpoint, event2) {
121192
121217
  if (event2.kind === "tool_call") {
@@ -121243,16 +121268,16 @@ function replySpent(checkpoint, runtime) {
121243
121268
 
121244
121269
  // src/lock.ts
121245
121270
  import crypto6 from "node:crypto";
121246
- import fs41 from "node:fs";
121271
+ import fs42 from "node:fs";
121247
121272
  import net from "node:net";
121248
- import path44 from "node:path";
121273
+ import path45 from "node:path";
121249
121274
  var RETRY_MS = 5e3;
121250
121275
  var KIND_MS = 1e3;
121251
121276
  var HOLDERS = ["claude-code", "codex", "terminal"];
121252
121277
  function lockPath() {
121253
121278
  const home4 = runnerHome();
121254
121279
  if (process.platform === "win32") return `\\\\.\\pipe\\wildcrane-${crypto6.createHash("sha256").update(home4).digest("hex").slice(0, 16)}`;
121255
- return path44.join(home4, "runner.sock");
121280
+ return path45.join(home4, "runner.sock");
121256
121281
  }
121257
121282
  function holdMachine(kind, onHeld, onWaiting) {
121258
121283
  const where = lockPath();
@@ -121267,7 +121292,7 @@ function holdMachine(kind, onHeld, onWaiting) {
121267
121292
  const attempt = () => {
121268
121293
  timer = null;
121269
121294
  if (closed) return;
121270
- 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 });
121271
121296
  const s = net.createServer((peer) => {
121272
121297
  peers.add(peer);
121273
121298
  peer.on("error", () => {
@@ -121315,7 +121340,7 @@ function holdMachine(kind, onHeld, onWaiting) {
121315
121340
  later(0);
121316
121341
  });
121317
121342
  removeIfStill.once("error", () => {
121318
- fs41.rmSync(where, { force: true });
121343
+ fs42.rmSync(where, { force: true });
121319
121344
  later(50 + Math.random() * 200);
121320
121345
  });
121321
121346
  return;
@@ -121346,8 +121371,8 @@ function holdMachine(kind, onHeld, onWaiting) {
121346
121371
  // src/handoff.ts
121347
121372
  import { execFileSync as execFileSync2 } from "node:child_process";
121348
121373
  import crypto7 from "node:crypto";
121349
- import fs42 from "node:fs";
121350
- import path45 from "node:path";
121374
+ import fs43 from "node:fs";
121375
+ import path46 from "node:path";
121351
121376
  var gitRead = (cwd, args) => {
121352
121377
  try {
121353
121378
  return execFileSync2("git", ["-C", cwd, ...args], {
@@ -121364,8 +121389,8 @@ var digest = (value) => crypto7.createHash("sha256").update(value).digest("hex")
121364
121389
  function authorizedFolder(folder) {
121365
121390
  if (!folder) return null;
121366
121391
  try {
121367
- const real = fs42.realpathSync(folder);
121368
- 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;
121369
121394
  } catch {
121370
121395
  return null;
121371
121396
  }
@@ -121375,9 +121400,9 @@ function progressFolder(job, folder) {
121375
121400
  if (!token) return folder;
121376
121401
  if (!/^[a-zA-Z0-9-]{1,80}$/.test(token)) return null;
121377
121402
  try {
121378
- const dir = fs42.realpathSync(path45.join(folder, ".akb", "handoffs", token));
121379
- if (!dir.startsWith(fs42.realpathSync(folder) + path45.sep)) return null;
121380
- 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"));
121381
121406
  return marker.task === job.task && marker.isolation === token ? dir : null;
121382
121407
  } catch {
121383
121408
  return null;
@@ -121385,38 +121410,38 @@ function progressFolder(job, folder) {
121385
121410
  }
121386
121411
  function progressEvidence(job, folder) {
121387
121412
  try {
121388
- const board = path45.join(folder, ".akb", "kanban");
121389
- const deliveries = path45.join(board, "deliveries");
121390
- 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));
121391
121416
  const row = rows[0];
121392
121417
  if (!row?.deliveryId) return null;
121393
- const tree = fs42.realpathSync(path45.resolve(folder, row.worktree ?? "."));
121394
- 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;
121395
121420
  const inventory = gitRead(tree, ["worktree", "list", "--porcelain"]);
121396
121421
  const related = (inventory ?? "").split("\n\n").flatMap((entry) => {
121397
121422
  const branch = /^branch refs\/heads\/(.+)$/m.exec(entry)?.[1];
121398
121423
  const dir = /^worktree (.+)$/m.exec(entry)?.[1];
121399
- 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] : [];
121400
121425
  });
121401
121426
  const filesIn = (tree2) => {
121402
121427
  const changed = [];
121403
121428
  const walk = (dir, prefix = "") => {
121404
- for (const entry of fs42.readdirSync(dir, { withFileTypes: true })) {
121429
+ for (const entry of fs43.readdirSync(dir, { withFileTypes: true })) {
121405
121430
  if ([".git", ".akb", "node_modules", ".claude", ".agents"].includes(entry.name)) continue;
121406
121431
  const name = prefix + entry.name;
121407
- if (entry.isDirectory()) walk(path45.join(dir, entry.name), name + "/");
121432
+ if (entry.isDirectory()) walk(path46.join(dir, entry.name), name + "/");
121408
121433
  else changed.push(name);
121409
121434
  }
121410
121435
  };
121411
121436
  walk(tree2);
121412
121437
  changed.sort();
121413
121438
  return changed.map((name) => {
121414
- const file2 = path45.join(tree2, name);
121439
+ const file2 = path46.join(tree2, name);
121415
121440
  try {
121416
- const stat = fs42.lstatSync(file2);
121417
- 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))];
121418
121443
  if (!stat.isFile()) throw new Error("\u65E0\u6CD5\u9A8C\u8BC1\u6587\u4EF6\u7C7B\u578B");
121419
- return [name, stat.mode & 511, digest(fs42.readFileSync(file2))];
121444
+ return [name, stat.mode & 511, digest(fs43.readFileSync(file2))];
121420
121445
  } catch (e2) {
121421
121446
  if (e2.code === "ENOENT") return [name, "deleted"];
121422
121447
  throw e2;
@@ -121453,60 +121478,60 @@ function progressEvidence(job, folder) {
121453
121478
  function restartFolder(job, folder) {
121454
121479
  const token = job.handoff?.isolation ?? job.id;
121455
121480
  if (!/^[a-zA-Z0-9-]{1,80}$/.test(token)) throw new Error("\u9694\u79BB\u76EE\u5F55\u7F16\u53F7\u65E0\u6548\u3002");
121456
- const dir = path45.join(folder, ".akb", "handoffs", token);
121457
- const marker = path45.join(dir, ".akb", "handoff.json");
121458
- for (const parent of [path45.join(folder, ".akb"), path45.dirname(dir), dir]) {
121459
- 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");
121460
121485
  }
121461
- if (fs42.existsSync(dir)) {
121486
+ if (fs43.existsSync(dir)) {
121462
121487
  if (job.handoff?.recovering) {
121463
121488
  try {
121464
- const saved = JSON.parse(fs42.readFileSync(marker, "utf8"));
121489
+ const saved = JSON.parse(fs43.readFileSync(marker, "utf8"));
121465
121490
  if (saved.task === job.task && saved.isolation === token) return dir;
121466
121491
  } catch {
121467
121492
  }
121468
121493
  }
121469
121494
  throw new Error("\u91CD\u542F\u76EE\u5F55\u5DF2\u5B58\u5728\uFF0C\u8BF7\u91CD\u65B0\u68C0\u67E5\u3002");
121470
121495
  }
121471
- fs42.mkdirSync(path45.dirname(dir), { recursive: true });
121472
- fs42.mkdirSync(dir);
121473
- 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)) {
121474
121499
  if ([".akb", ".git", "node_modules", ".claude", ".agents"].includes(entry)) continue;
121475
- 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 });
121476
121501
  }
121477
- if (fs42.lstatSync(path45.dirname(marker), { throwIfNoEntry: false })?.isSymbolicLink()) throw new Error("\u9694\u79BB\u6807\u8BB0\u76EE\u5F55\u65E0\u6548\u3002");
121478
- fs42.mkdirSync(path45.dirname(marker), { recursive: true });
121479
- 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" });
121480
121505
  return dir;
121481
121506
  }
121482
121507
 
121483
121508
  // src/jobs.ts
121484
121509
  import { spawn as spawn4 } from "node:child_process";
121485
- import fs44 from "node:fs";
121486
- import path47 from "node:path";
121510
+ import fs45 from "node:fs";
121511
+ import path48 from "node:path";
121487
121512
 
121488
121513
  // ../cli/src/lib/agent/catalog.ts
121489
- import fs43 from "node:fs";
121490
- import path46 from "node:path";
121514
+ import fs44 from "node:fs";
121515
+ import path47 from "node:path";
121491
121516
  var CATALOGUE = "https://models.dev/api.json";
121492
121517
  var FRESH_FOR_MS = 24 * 60 * 6e4;
121493
121518
  var ANSWER_BY_MS = 2e4;
121494
121519
  function cacheFile() {
121495
- return path46.join(machineHome(), "models-dev.json");
121520
+ return path47.join(machineHome(), "models-dev.json");
121496
121521
  }
121497
121522
  var held2;
121498
121523
  function readCache() {
121499
121524
  const file2 = cacheFile();
121500
121525
  let stamp3;
121501
121526
  try {
121502
- const stat = fs43.statSync(file2);
121527
+ const stat = fs44.statSync(file2);
121503
121528
  stamp3 = `${stat.mtimeMs}:${stat.size}`;
121504
121529
  } catch {
121505
121530
  return void 0;
121506
121531
  }
121507
121532
  if (held2?.stamp === stamp3) return held2.cached;
121508
121533
  try {
121509
- const data = JSON.parse(fs43.readFileSync(file2, "utf8"));
121534
+ const data = JSON.parse(fs44.readFileSync(file2, "utf8"));
121510
121535
  if (!data || typeof data.limits !== "object" || !data.limits) return void 0;
121511
121536
  const cached2 = {
121512
121537
  fetchedAt: typeof data.fetchedAt === "number" ? data.fetchedAt : 0,
@@ -121545,8 +121570,8 @@ function refreshCatalog() {
121545
121570
  const limits = limitsIn(await answer.json());
121546
121571
  if (Object.keys(limits).length === 0) return;
121547
121572
  const file2 = cacheFile();
121548
- fs43.mkdirSync(path46.dirname(file2), { recursive: true });
121549
- 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 }));
121550
121575
  } catch {
121551
121576
  }
121552
121577
  })();
@@ -121621,32 +121646,32 @@ var defaultDeps = (machineId2) => ({
121621
121646
  akb: currentAkb,
121622
121647
  runtimes: detectRuntimes
121623
121648
  });
121624
- var ownFolder = () => path47.join(runnerHome(), "work");
121649
+ var ownFolder = () => path48.join(runnerHome(), "work");
121625
121650
  function folderFor(job) {
121626
121651
  if (!job.projectDir) {
121627
- const cwd = path47.join(ownFolder(), job.id);
121628
- fs44.mkdirSync(cwd, { recursive: true });
121652
+ const cwd = path48.join(ownFolder(), job.id);
121653
+ fs45.mkdirSync(cwd, { recursive: true });
121629
121654
  return { cwd };
121630
121655
  }
121631
121656
  const real = realpath4(job.projectDir);
121632
- 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 };
121633
121658
  return { refused: `This Runner is not allowed to work in ${job.projectDir}.` };
121634
121659
  }
121635
121660
  function realpath4(p2) {
121636
121661
  try {
121637
- return fs44.realpathSync(p2);
121662
+ return fs45.realpathSync(p2);
121638
121663
  } catch {
121639
121664
  return null;
121640
121665
  }
121641
121666
  }
121642
- var attachmentsOf = (job) => path47.join(runnerHome(), "attachments", job.id);
121667
+ var attachmentsOf = (job) => path48.join(runnerHome(), "attachments", job.id);
121643
121668
  function writeAttachments(job) {
121644
121669
  if (!job.attachments.length) return "";
121645
121670
  const dir = attachmentsOf(job);
121646
- fs44.mkdirSync(dir, { recursive: true });
121671
+ fs45.mkdirSync(dir, { recursive: true });
121647
121672
  const files = job.attachments.map((a2) => {
121648
- const file2 = path47.join(dir, path47.basename(a2.name));
121649
- 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"));
121650
121675
  return file2;
121651
121676
  });
121652
121677
  return `
@@ -121929,7 +121954,7 @@ async function runJob(id, deps, track = () => {
121929
121954
  await runClaimed(job, { ...deps, akb: deps.akb() }, track, (dir) => releases.push(hold(dir)), lease);
121930
121955
  } finally {
121931
121956
  for (const release2 of releases) release2();
121932
- fs44.rmSync(attachmentsOf(job), { recursive: true, force: true });
121957
+ fs45.rmSync(attachmentsOf(job), { recursive: true, force: true });
121933
121958
  }
121934
121959
  }
121935
121960
  async function runClaimed(job, deps, track, keep2, lease, replyStream) {
@@ -122017,7 +122042,7 @@ async function runClaimed(job, deps, track, keep2, lease, replyStream) {
122017
122042
  if (job.test) return runTest(job, deps, lease);
122018
122043
  if (job.agent) return runAgentJob(job, deps, track, keep2, lease, checkpoint, persist);
122019
122044
  const task = job.task ?? job.review?.tasks[0] ?? null;
122020
- const folder = task && !job.projectDir ? null : folderFor(job);
122045
+ const folder = task && !job.projectDir ? { refused: NO_FOLDER } : folderFor(job);
122021
122046
  if (folder && "refused" in folder) {
122022
122047
  return finishClaimed("failed", folder.refused);
122023
122048
  }
@@ -122052,7 +122077,7 @@ async function runClaimed(job, deps, track, keep2, lease, replyStream) {
122052
122077
  discussed = board.board;
122053
122078
  }
122054
122079
  if (job.discussion) {
122055
- 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);
122056
122081
  if ("error" in wrote) throw new Error(wrote.error);
122057
122082
  goalFile = wrote.file;
122058
122083
  }
@@ -122487,8 +122512,8 @@ async function runTest(job, deps, lease) {
122487
122512
  const report2 = (await deps.runtimes()).find((r2) => r2.name === job.runtime);
122488
122513
  if (!report2?.installed) return finish2("failed", "not_installed");
122489
122514
  if (report2.loggedIn === false) return finish2("failed", "signed_out");
122490
- const cwd = path47.join(ownFolder(), "test");
122491
- fs44.mkdirSync(cwd, { recursive: true });
122515
+ const cwd = path48.join(ownFolder(), "test");
122516
+ fs45.mkdirSync(cwd, { recursive: true });
122492
122517
  const run2 = deps.plan(job.runtime, job.prompt, cwd, null, job.model, settingsOf(job));
122493
122518
  const startedAt = Date.now();
122494
122519
  if (run2.converse) {
@@ -122939,7 +122964,7 @@ function startRunner(options) {
122939
122964
  let refresh2 = "";
122940
122965
  const accountWatch = setInterval(() => {
122941
122966
  try {
122942
- const value = fs45.readFileSync(path48.join(runnerHome(), "settings-refresh"), "utf8");
122967
+ const value = fs46.readFileSync(path49.join(runnerHome(), "settings-refresh"), "utf8");
122943
122968
  if (value !== refresh2) {
122944
122969
  refresh2 = value;
122945
122970
  redetect = true;