wildcrane-runner 0.6.86 → 0.6.88

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- // wildcrane-runner 0.6.86 — built by runner/scripts/build.mjs. Do not edit.
1
+ // wildcrane-runner 0.6.88 — 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 path47 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
1161
+ let path48 = 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 (path47 && path47[0] !== "/") {
1166
- path47 = `/${path47}`;
1165
+ if (path48 && path48[0] !== "/") {
1166
+ path48 = `/${path48}`;
1167
1167
  }
1168
- return new URL(`${origin}${path47}`);
1168
+ return new URL(`${origin}${path48}`);
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: path47, origin }
2003
+ request: { method, path: path48, origin }
2004
2004
  } = evt;
2005
- debugLog("sending request to %s %s%s", method, origin, path47);
2005
+ debugLog("sending request to %s %s%s", method, origin, path48);
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: path47, origin },
2023
+ request: { method, path: path48, 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
- path47,
2030
+ path48,
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: path47, origin }
2039
+ request: { method, path: path48, origin }
2040
2040
  } = evt;
2041
- debugLog("trailers received from %s %s%s", method, origin, path47);
2041
+ debugLog("trailers received from %s %s%s", method, origin, path48);
2042
2042
  }
2043
2043
  );
2044
2044
  diagnosticsChannel.subscribe(
2045
2045
  "undici:request:error",
2046
2046
  (evt) => {
2047
2047
  const {
2048
- request: { method, path: path47, origin },
2048
+ request: { method, path: path48, 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
- path47,
2055
+ path48,
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: path47,
2170
+ path: path48,
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 path47 !== "string") {
2187
+ if (typeof path48 !== "string") {
2188
2188
  throw new InvalidArgumentError("path must be a string");
2189
- } else if (path47[0] !== "/" && !(path47.startsWith("http://") || path47.startsWith("https://")) && method !== "CONNECT") {
2189
+ } else if (path48[0] !== "/" && !(path48.startsWith("http://") || path48.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(path47)) {
2191
+ } else if (invalidPathRegex.test(path48)) {
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(path47, query) : path47;
2266
+ this.path = query ? serializePathWithQuery(path48, query) : path48;
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: path47, host, upgrade, blocking, reset } = request2;
7510
+ const { method, path: path48, 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} ${path47} HTTP/1.1\r
7586
+ let header = `${method} ${path48} 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: path47, host, upgrade, expectContinue, signal: signal2, protocol, headers: reqHeaders } = request2;
8263
+ const { method, path: path48, 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] = path47;
8332
+ headers[HTTP2_HEADER_PATH] = path48;
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] = path47;
8384
+ headers[HTTP2_HEADER_PATH] = path48;
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: path47 = "/",
10740
+ path: path48 = "/",
10741
10741
  headers = {}
10742
10742
  } = opts;
10743
- opts.path = origin + path47;
10743
+ opts.path = origin + path48;
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(path47) {
12904
- if (typeof path47 !== "string") {
12905
- return path47;
12903
+ function safeUrl(path48) {
12904
+ if (typeof path48 !== "string") {
12905
+ return path48;
12906
12906
  }
12907
- const pathSegments = path47.split("?", 3);
12907
+ const pathSegments = path48.split("?", 3);
12908
12908
  if (pathSegments.length !== 2) {
12909
- return path47;
12909
+ return path48;
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: path47, method, body, headers }) {
12916
- const pathMatch = matchValue(mockDispatch2.path, path47);
12915
+ function matchKey(mockDispatch2, { path: path48, method, body, headers }) {
12916
+ const pathMatch = matchValue(mockDispatch2.path, path48);
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: path47, ignoreTrailingSlash }) => {
12942
- return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path47)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path47), resolvedPath);
12941
+ let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path48, ignoreTrailingSlash }) => {
12942
+ return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path48)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path48), 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(path47) {
12982
- while (path47.endsWith("/")) {
12983
- path47 = path47.slice(0, -1);
12981
+ function removeTrailingSlash(path48) {
12982
+ while (path48.endsWith("/")) {
12983
+ path48 = path48.slice(0, -1);
12984
12984
  }
12985
- if (path47.length === 0) {
12986
- path47 = "/";
12985
+ if (path48.length === 0) {
12986
+ path48 = "/";
12987
12987
  }
12988
- return path47;
12988
+ return path48;
12989
12989
  }
12990
12990
  function buildKey(opts) {
12991
- const { path: path47, method, body, headers, query } = opts;
12991
+ const { path: path48, method, body, headers, query } = opts;
12992
12992
  return {
12993
- path: path47,
12993
+ path: path48,
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: path47, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
13683
+ ({ method, path: path48, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
13684
13684
  Method: method,
13685
13685
  Origin: origin,
13686
- Path: path47,
13686
+ Path: path48,
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 [path47, searchParams] = dispatchOpts.path.split("?");
13768
+ const [path48, searchParams] = dispatchOpts.path.split("?");
13769
13769
  const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
13770
- dispatchOpts.path = `${path47}?${normalizedSearchParams}`;
13770
+ dispatchOpts.path = `${path48}?${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 path47 = filePath || this.#snapshotPath;
14172
- if (!path47) {
14171
+ const path48 = filePath || this.#snapshotPath;
14172
+ if (!path48) {
14173
14173
  throw new InvalidArgumentError("Snapshot path is required");
14174
14174
  }
14175
14175
  try {
14176
- const data = await readFile(resolve2(path47), "utf8");
14176
+ const data = await readFile(resolve2(path48), "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 ${path47}`, { cause: error });
14190
+ throw new UndiciError(`Failed to load snapshots from ${path48}`, { 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 path47 = filePath || this.#snapshotPath;
14202
- if (!path47) {
14201
+ const path48 = filePath || this.#snapshotPath;
14202
+ if (!path48) {
14203
14203
  throw new InvalidArgumentError("Snapshot path is required");
14204
14204
  }
14205
- const resolvedPath = resolve2(path47);
14205
+ const resolvedPath = resolve2(path48);
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 path47 = search ? `${pathname}${search}` : pathname;
14847
- const redirectUrlString = `${origin}${path47}`;
14846
+ const path48 = search ? `${pathname}${search}` : pathname;
14847
+ const redirectUrlString = `${origin}${path48}`;
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 = path47;
14854
+ this.opts.path = path48;
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, path47) {
16671
+ function deleteCachedUri(store, cacheKey, path48) {
16672
16672
  deleteCachedValue(store, {
16673
16673
  ...cacheKey,
16674
- path: path47
16674
+ path: path48
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: path47
16682
+ path: path48
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 path47 = getSameOriginPath(cacheKey, values[i]);
16694
- if (path47 !== void 0) {
16695
- deleteCachedUri(store, cacheKey, path47);
16693
+ const path48 = getSameOriginPath(cacheKey, values[i]);
16694
+ if (path48 !== void 0) {
16695
+ deleteCachedUri(store, cacheKey, path48);
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 path47 = url.pathname + url.search;
22183
+ const path48 = 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 ? `${path47}?` : path47,
22187
+ path: hasTrailingQuestionMark ? `${path48}?` : path48,
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(path47) {
23135
- for (let i = 0; i < path47.length; ++i) {
23136
- const code = path47.charCodeAt(i);
23134
+ function validateCookiePath(path48) {
23135
+ for (let i = 0; i < path48.length; ++i) {
23136
+ const code = path48.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 path47 = opts.path;
26572
+ let path48 = opts.path;
26573
26573
  if (!opts.path.startsWith("/")) {
26574
- path47 = `/${path47}`;
26574
+ path48 = `/${path48}`;
26575
26575
  }
26576
- url = new URL(util.parseOrigin(url).origin + path47);
26576
+ url = new URL(util.parseOrigin(url).origin + path48);
26577
26577
  } else {
26578
26578
  if (!opts) {
26579
26579
  opts = typeof url === "object" ? url : {};
@@ -67915,8 +67915,8 @@ var require_JSXTransformer = __commonJS({
67915
67915
  }
67916
67916
  if (this.isAutomaticRuntime) {
67917
67917
  if (this.importProcessor) {
67918
- for (const [path47, resolvedName] of Object.entries(this.cjsAutomaticModuleNameResolutions)) {
67919
- prefix += `var ${resolvedName} = require("${path47}");`;
67918
+ for (const [path48, resolvedName] of Object.entries(this.cjsAutomaticModuleNameResolutions)) {
67919
+ prefix += `var ${resolvedName} = require("${path48}");`;
67920
67920
  }
67921
67921
  } else {
67922
67922
  const { createElement: createElementResolution, ...otherResolutions } = this.esmAutomaticImportNameResolutions;
@@ -68109,11 +68109,11 @@ var require_JSXTransformer = __commonJS({
68109
68109
  }
68110
68110
  claimAutoImportedName(funcName, importPathSuffix) {
68111
68111
  if (this.importProcessor) {
68112
- const path47 = this.jsxImportSource + importPathSuffix;
68113
- if (!this.cjsAutomaticModuleNameResolutions[path47]) {
68114
- this.cjsAutomaticModuleNameResolutions[path47] = this.importProcessor.getFreeIdentifierForPath(path47);
68112
+ const path48 = this.jsxImportSource + importPathSuffix;
68113
+ if (!this.cjsAutomaticModuleNameResolutions[path48]) {
68114
+ this.cjsAutomaticModuleNameResolutions[path48] = this.importProcessor.getFreeIdentifierForPath(path48);
68115
68115
  }
68116
- return `${this.cjsAutomaticModuleNameResolutions[path47]}.${funcName}`;
68116
+ return `${this.cjsAutomaticModuleNameResolutions[path48]}.${funcName}`;
68117
68117
  } else {
68118
68118
  if (!this.esmAutomaticImportNameResolutions[funcName]) {
68119
68119
  this.esmAutomaticImportNameResolutions[funcName] = this.nameManager.claimFreeName(
@@ -68549,7 +68549,7 @@ var require_CJSImportProcessor = __commonJS({
68549
68549
  */
68550
68550
  pruneTypeOnlyImports() {
68551
68551
  this.nonTypeIdentifiers = _getNonTypeIdentifiers.getNonTypeIdentifiers.call(void 0, this.tokens, this.options);
68552
- for (const [path47, importInfo] of this.importInfoByPath.entries()) {
68552
+ for (const [path48, importInfo] of this.importInfoByPath.entries()) {
68553
68553
  if (importInfo.hasBareImport || importInfo.hasStarExport || importInfo.exportStarNames.length > 0 || importInfo.namedExports.length > 0) {
68554
68554
  continue;
68555
68555
  }
@@ -68559,7 +68559,7 @@ var require_CJSImportProcessor = __commonJS({
68559
68559
  ...importInfo.namedImports.map(({ localName }) => localName)
68560
68560
  ];
68561
68561
  if (names2.every((name) => this.shouldAutomaticallyElideImportedName(name))) {
68562
- this.importsToReplace.set(path47, "");
68562
+ this.importsToReplace.set(path48, "");
68563
68563
  }
68564
68564
  }
68565
68565
  }
@@ -68567,7 +68567,7 @@ var require_CJSImportProcessor = __commonJS({
68567
68567
  return this.isTypeScriptTransformEnabled && !this.keepUnusedImports && !this.nonTypeIdentifiers.has(name);
68568
68568
  }
68569
68569
  generateImportReplacements() {
68570
- for (const [path47, importInfo] of this.importInfoByPath.entries()) {
68570
+ for (const [path48, importInfo] of this.importInfoByPath.entries()) {
68571
68571
  const {
68572
68572
  defaultNames,
68573
68573
  wildcardNames,
@@ -68577,17 +68577,17 @@ var require_CJSImportProcessor = __commonJS({
68577
68577
  hasStarExport
68578
68578
  } = importInfo;
68579
68579
  if (defaultNames.length === 0 && wildcardNames.length === 0 && namedImports.length === 0 && namedExports.length === 0 && exportStarNames.length === 0 && !hasStarExport) {
68580
- this.importsToReplace.set(path47, `require('${path47}');`);
68580
+ this.importsToReplace.set(path48, `require('${path48}');`);
68581
68581
  continue;
68582
68582
  }
68583
- const primaryImportName = this.getFreeIdentifierForPath(path47);
68583
+ const primaryImportName = this.getFreeIdentifierForPath(path48);
68584
68584
  let secondaryImportName;
68585
68585
  if (this.enableLegacyTypeScriptModuleInterop) {
68586
68586
  secondaryImportName = primaryImportName;
68587
68587
  } else {
68588
- secondaryImportName = wildcardNames.length > 0 ? wildcardNames[0] : this.getFreeIdentifierForPath(path47);
68588
+ secondaryImportName = wildcardNames.length > 0 ? wildcardNames[0] : this.getFreeIdentifierForPath(path48);
68589
68589
  }
68590
- let requireCode = `var ${primaryImportName} = require('${path47}');`;
68590
+ let requireCode = `var ${primaryImportName} = require('${path48}');`;
68591
68591
  if (wildcardNames.length > 0) {
68592
68592
  for (const wildcardName of wildcardNames) {
68593
68593
  const moduleExpr = this.enableLegacyTypeScriptModuleInterop ? primaryImportName : `${this.helperManager.getHelperName("interopRequireWildcard")}(${primaryImportName})`;
@@ -68615,7 +68615,7 @@ var require_CJSImportProcessor = __commonJS({
68615
68615
  "createStarExport"
68616
68616
  )}(${primaryImportName});`;
68617
68617
  }
68618
- this.importsToReplace.set(path47, requireCode);
68618
+ this.importsToReplace.set(path48, requireCode);
68619
68619
  for (const defaultName of defaultNames) {
68620
68620
  this.identifierReplacements.set(defaultName, `${secondaryImportName}.default`);
68621
68621
  }
@@ -68624,8 +68624,8 @@ var require_CJSImportProcessor = __commonJS({
68624
68624
  }
68625
68625
  }
68626
68626
  }
68627
- getFreeIdentifierForPath(path47) {
68628
- const components = path47.split("/");
68627
+ getFreeIdentifierForPath(path48) {
68628
+ const components = path48.split("/");
68629
68629
  const lastComponent = components[components.length - 1];
68630
68630
  const baseName = lastComponent.replace(/\W/g, "");
68631
68631
  return this.nameManager.claimFreeName(`_${baseName}`);
@@ -68670,8 +68670,8 @@ var require_CJSImportProcessor = __commonJS({
68670
68670
  if (!this.tokens.matches1AtIndex(index, _types.TokenType.string)) {
68671
68671
  throw new Error("Expected string token at the end of import statement.");
68672
68672
  }
68673
- const path47 = this.tokens.stringValueAtIndex(index);
68674
- const importInfo = this.getImportInfo(path47);
68673
+ const path48 = this.tokens.stringValueAtIndex(index);
68674
+ const importInfo = this.getImportInfo(path48);
68675
68675
  importInfo.defaultNames.push(...defaultNames);
68676
68676
  importInfo.wildcardNames.push(...wildcardNames);
68677
68677
  importInfo.namedImports.push(...namedImports);
@@ -68738,8 +68738,8 @@ var require_CJSImportProcessor = __commonJS({
68738
68738
  if (!this.tokens.matches1AtIndex(index, _types.TokenType.string)) {
68739
68739
  throw new Error("Expected string token at the end of import statement.");
68740
68740
  }
68741
- const path47 = this.tokens.stringValueAtIndex(index);
68742
- const importInfo = this.getImportInfo(path47);
68741
+ const path48 = this.tokens.stringValueAtIndex(index);
68742
+ const importInfo = this.getImportInfo(path48);
68743
68743
  importInfo.namedExports.push(...namedImports);
68744
68744
  }
68745
68745
  preprocessExportStarAtIndex(index) {
@@ -68754,8 +68754,8 @@ var require_CJSImportProcessor = __commonJS({
68754
68754
  if (!this.tokens.matches1AtIndex(index, _types.TokenType.string)) {
68755
68755
  throw new Error("Expected string token at the end of star export statement.");
68756
68756
  }
68757
- const path47 = this.tokens.stringValueAtIndex(index);
68758
- const importInfo = this.getImportInfo(path47);
68757
+ const path48 = this.tokens.stringValueAtIndex(index);
68758
+ const importInfo = this.getImportInfo(path48);
68759
68759
  if (exportedName !== null) {
68760
68760
  importInfo.exportStarNames.push(exportedName);
68761
68761
  } else {
@@ -68795,8 +68795,8 @@ var require_CJSImportProcessor = __commonJS({
68795
68795
  * Get a mutable import info object for this path, creating one if it doesn't
68796
68796
  * exist yet.
68797
68797
  */
68798
- getImportInfo(path47) {
68799
- const existingInfo = this.importInfoByPath.get(path47);
68798
+ getImportInfo(path48) {
68799
+ const existingInfo = this.importInfoByPath.get(path48);
68800
68800
  if (existingInfo) {
68801
68801
  return existingInfo;
68802
68802
  }
@@ -68809,7 +68809,7 @@ var require_CJSImportProcessor = __commonJS({
68809
68809
  exportStarNames: [],
68810
68810
  hasStarExport: false
68811
68811
  };
68812
- this.importInfoByPath.set(path47, newInfo);
68812
+ this.importInfoByPath.set(path48, newInfo);
68813
68813
  return newInfo;
68814
68814
  }
68815
68815
  addExportBinding(localName, exportedName) {
@@ -69389,16 +69389,16 @@ var require_resolve_uri_umd = __commonJS({
69389
69389
  }
69390
69390
  function parseFileUrl(input) {
69391
69391
  const match = fileRegex.exec(input);
69392
- const path47 = match[2];
69393
- return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path47) ? path47 : "/" + path47, match[3] || "", match[4] || "");
69392
+ const path48 = match[2];
69393
+ return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path48) ? path48 : "/" + path48, match[3] || "", match[4] || "");
69394
69394
  }
69395
- function makeUrl(scheme, user, host, port, path47, query, hash) {
69395
+ function makeUrl(scheme, user, host, port, path48, query, hash) {
69396
69396
  return {
69397
69397
  scheme,
69398
69398
  user,
69399
69399
  host,
69400
69400
  port,
69401
- path: path47,
69401
+ path: path48,
69402
69402
  query,
69403
69403
  hash,
69404
69404
  type: 7
@@ -69428,11 +69428,11 @@ var require_resolve_uri_umd = __commonJS({
69428
69428
  url.type = input ? input.startsWith("?") ? 3 : input.startsWith("#") ? 2 : 4 : 1;
69429
69429
  return url;
69430
69430
  }
69431
- function stripPathFilename(path47) {
69432
- if (path47.endsWith("/.."))
69433
- return path47;
69434
- const index = path47.lastIndexOf("/");
69435
- return path47.slice(0, index + 1);
69431
+ function stripPathFilename(path48) {
69432
+ if (path48.endsWith("/.."))
69433
+ return path48;
69434
+ const index = path48.lastIndexOf("/");
69435
+ return path48.slice(0, index + 1);
69436
69436
  }
69437
69437
  function mergePaths(url, base) {
69438
69438
  normalizePath(base, base.type);
@@ -69470,14 +69470,14 @@ var require_resolve_uri_umd = __commonJS({
69470
69470
  pieces[pointer++] = piece;
69471
69471
  positive++;
69472
69472
  }
69473
- let path47 = "";
69473
+ let path48 = "";
69474
69474
  for (let i = 1; i < pointer; i++) {
69475
- path47 += "/" + pieces[i];
69475
+ path48 += "/" + pieces[i];
69476
69476
  }
69477
- if (!path47 || addTrailingSlash && !path47.endsWith("/..")) {
69478
- path47 += "/";
69477
+ if (!path48 || addTrailingSlash && !path48.endsWith("/..")) {
69478
+ path48 += "/";
69479
69479
  }
69480
- url.path = path47;
69480
+ url.path = path48;
69481
69481
  }
69482
69482
  function resolve2(input, base) {
69483
69483
  if (!input && !base)
@@ -69518,13 +69518,13 @@ var require_resolve_uri_umd = __commonJS({
69518
69518
  case 3:
69519
69519
  return queryHash;
69520
69520
  case 4: {
69521
- const path47 = url.path.slice(1);
69522
- if (!path47)
69521
+ const path48 = url.path.slice(1);
69522
+ if (!path48)
69523
69523
  return queryHash || ".";
69524
- if (isRelative(base || input) && !isRelative(path47)) {
69525
- return "./" + path47 + queryHash;
69524
+ if (isRelative(base || input) && !isRelative(path48)) {
69525
+ return "./" + path48 + queryHash;
69526
69526
  }
69527
- return path47 + queryHash;
69527
+ return path48 + queryHash;
69528
69528
  }
69529
69529
  case 5:
69530
69530
  return url.path + queryHash;
@@ -69623,10 +69623,10 @@ var require_trace_mapping_umd = __commonJS({
69623
69623
  module2.exports = __toCommonJS(trace_mapping_exports);
69624
69624
  var import_sourcemap_codec = __toESM2(require_sourcemap_codec());
69625
69625
  var import_resolve_uri = __toESM2(require_resolve_uri());
69626
- function stripFilename(path47) {
69627
- if (!path47) return "";
69628
- const index = path47.lastIndexOf("/");
69629
- return path47.slice(0, index + 1);
69626
+ function stripFilename(path48) {
69627
+ if (!path48) return "";
69628
+ const index = path48.lastIndexOf("/");
69629
+ return path48.slice(0, index + 1);
69630
69630
  }
69631
69631
  function resolver(mapUrl, sourceRoot) {
69632
69632
  const from = stripFilename(mapUrl);
@@ -69671,7 +69671,7 @@ var require_trace_mapping_umd = __commonJS({
69671
69671
  return a2[COLUMN] - b2[COLUMN];
69672
69672
  }
69673
69673
  function buildBySources(decoded, memos) {
69674
- const sources2 = memos.map(() => []);
69674
+ const sources3 = memos.map(() => []);
69675
69675
  for (let i = 0; i < decoded.length; i++) {
69676
69676
  const line = decoded[i];
69677
69677
  for (let j2 = 0; j2 < line.length; j2++) {
@@ -69680,19 +69680,19 @@ var require_trace_mapping_umd = __commonJS({
69680
69680
  const sourceIndex2 = seg[SOURCES_INDEX];
69681
69681
  const sourceLine = seg[SOURCE_LINE];
69682
69682
  const sourceColumn = seg[SOURCE_COLUMN];
69683
- const source2 = sources2[sourceIndex2];
69683
+ const source2 = sources3[sourceIndex2];
69684
69684
  const segs = source2[sourceLine] || (source2[sourceLine] = []);
69685
69685
  segs.push([sourceColumn, i, seg[COLUMN]]);
69686
69686
  }
69687
69687
  }
69688
- for (let i = 0; i < sources2.length; i++) {
69689
- const source2 = sources2[i];
69688
+ for (let i = 0; i < sources3.length; i++) {
69689
+ const source2 = sources3[i];
69690
69690
  for (let j2 = 0; j2 < source2.length; j2++) {
69691
69691
  const line = source2[j2];
69692
69692
  if (line) line.sort(sortComparator);
69693
69693
  }
69694
69694
  }
69695
- return sources2;
69695
+ return sources3;
69696
69696
  }
69697
69697
  var found = false;
69698
69698
  function binarySearch(haystack, needle, low, high) {
@@ -69759,7 +69759,7 @@ var require_trace_mapping_umd = __commonJS({
69759
69759
  return new TraceMap(parsed, mapUrl);
69760
69760
  }
69761
69761
  const mappings = [];
69762
- const sources2 = [];
69762
+ const sources3 = [];
69763
69763
  const sourcesContent = [];
69764
69764
  const names2 = [];
69765
69765
  const ignoreList = [];
@@ -69767,7 +69767,7 @@ var require_trace_mapping_umd = __commonJS({
69767
69767
  parsed,
69768
69768
  mapUrl,
69769
69769
  mappings,
69770
- sources2,
69770
+ sources3,
69771
69771
  sourcesContent,
69772
69772
  names2,
69773
69773
  ignoreList,
@@ -69780,14 +69780,14 @@ var require_trace_mapping_umd = __commonJS({
69780
69780
  version: 3,
69781
69781
  file: parsed.file,
69782
69782
  names: names2,
69783
- sources: sources2,
69783
+ sources: sources3,
69784
69784
  sourcesContent,
69785
69785
  mappings,
69786
69786
  ignoreList
69787
69787
  };
69788
69788
  return presortedDecodedMap(joined);
69789
69789
  };
69790
- function recurse(input, mapUrl, mappings, sources2, sourcesContent, names2, ignoreList, lineOffset, columnOffset, stopLine, stopColumn) {
69790
+ function recurse(input, mapUrl, mappings, sources3, sourcesContent, names2, ignoreList, lineOffset, columnOffset, stopLine, stopColumn) {
69791
69791
  const { sections } = input;
69792
69792
  for (let i = 0; i < sections.length; i++) {
69793
69793
  const { map: map2, offset } = sections[i];
@@ -69806,7 +69806,7 @@ var require_trace_mapping_umd = __commonJS({
69806
69806
  map2,
69807
69807
  mapUrl,
69808
69808
  mappings,
69809
- sources2,
69809
+ sources3,
69810
69810
  sourcesContent,
69811
69811
  names2,
69812
69812
  ignoreList,
@@ -69817,15 +69817,15 @@ var require_trace_mapping_umd = __commonJS({
69817
69817
  );
69818
69818
  }
69819
69819
  }
69820
- function addSection(input, mapUrl, mappings, sources2, sourcesContent, names2, ignoreList, lineOffset, columnOffset, stopLine, stopColumn) {
69820
+ function addSection(input, mapUrl, mappings, sources3, sourcesContent, names2, ignoreList, lineOffset, columnOffset, stopLine, stopColumn) {
69821
69821
  const parsed = parse(input);
69822
69822
  if ("sections" in parsed) return recurse(...arguments);
69823
69823
  const map2 = new TraceMap(parsed, mapUrl);
69824
- const sourcesOffset = sources2.length;
69824
+ const sourcesOffset = sources3.length;
69825
69825
  const namesOffset = names2.length;
69826
69826
  const decoded = decodedMappings(map2);
69827
69827
  const { resolvedSources, sourcesContent: contents, ignoreList: ignores } = map2;
69828
- append(sources2, resolvedSources);
69828
+ append(sources3, resolvedSources);
69829
69829
  append(names2, map2.names);
69830
69830
  if (contents) append(sourcesContent, contents);
69831
69831
  else for (let i = 0; i < resolvedSources.length; i++) sourcesContent.push(null);
@@ -69869,16 +69869,16 @@ var require_trace_mapping_umd = __commonJS({
69869
69869
  const isString = typeof map2 === "string";
69870
69870
  if (!isString && map2._decodedMemo) return map2;
69871
69871
  const parsed = parse(map2);
69872
- const { version, file: file2, names: names2, sourceRoot, sources: sources2, sourcesContent } = parsed;
69872
+ const { version, file: file2, names: names2, sourceRoot, sources: sources3, sourcesContent } = parsed;
69873
69873
  this.version = version;
69874
69874
  this.file = file2;
69875
69875
  this.names = names2 || [];
69876
69876
  this.sourceRoot = sourceRoot;
69877
- this.sources = sources2;
69877
+ this.sources = sources3;
69878
69878
  this.sourcesContent = sourcesContent;
69879
69879
  this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;
69880
69880
  const resolve2 = resolver(mapUrl, sourceRoot);
69881
- this.resolvedSources = sources2.map(resolve2);
69881
+ this.resolvedSources = sources3.map(resolve2);
69882
69882
  const { mappings } = parsed;
69883
69883
  if (typeof mappings === "string") {
69884
69884
  this._encoded = mappings;
@@ -69985,8 +69985,8 @@ var require_trace_mapping_umd = __commonJS({
69985
69985
  }
69986
69986
  }
69987
69987
  function sourceIndex(map2, source2) {
69988
- const { sources: sources2, resolvedSources } = map2;
69989
- let index = sources2.indexOf(source2);
69988
+ const { sources: sources3, resolvedSources } = map2;
69989
+ let index = sources3.indexOf(source2);
69990
69990
  if (index === -1) index = resolvedSources.indexOf(source2);
69991
69991
  return index;
69992
69992
  }
@@ -70058,11 +70058,11 @@ var require_trace_mapping_umd = __commonJS({
70058
70058
  line--;
70059
70059
  if (line < 0) throw new Error(LINE_GTR_ZERO);
70060
70060
  if (column < 0) throw new Error(COL_GTR_EQ_ZERO);
70061
- const { sources: sources2, resolvedSources } = map2;
70062
- let sourceIndex2 = sources2.indexOf(source2);
70061
+ const { sources: sources3, resolvedSources } = map2;
70062
+ let sourceIndex2 = sources3.indexOf(source2);
70063
70063
  if (sourceIndex2 === -1) sourceIndex2 = resolvedSources.indexOf(source2);
70064
70064
  if (sourceIndex2 === -1) return all ? [] : GMapping(null, null);
70065
- const bySourceMemos = (_a2 = cast(map2))._bySourceMemos || (_a2._bySourceMemos = sources2.map(memoizedState));
70065
+ const bySourceMemos = (_a2 = cast(map2))._bySourceMemos || (_a2._bySourceMemos = sources3.map(memoizedState));
70066
70066
  const generated = (_b = cast(map2))._bySources || (_b._bySources = buildBySources(decodedMappings(map2), bySourceMemos));
70067
70067
  const segments = generated[sourceIndex2][line];
70068
70068
  if (segments == null) return all ? [] : GMapping(null, null);
@@ -70242,21 +70242,21 @@ var require_gen_mapping_umd = __commonJS({
70242
70242
  };
70243
70243
  function setSourceContent(map2, source2, content) {
70244
70244
  const {
70245
- _sources: sources2,
70245
+ _sources: sources3,
70246
70246
  _sourcesContent: sourcesContent
70247
70247
  // _originalScopes: originalScopes,
70248
70248
  } = cast2(map2);
70249
- const index = put(sources2, source2);
70249
+ const index = put(sources3, source2);
70250
70250
  sourcesContent[index] = content;
70251
70251
  }
70252
70252
  function setIgnore(map2, source2, ignore = true) {
70253
70253
  const {
70254
- _sources: sources2,
70254
+ _sources: sources3,
70255
70255
  _sourcesContent: sourcesContent,
70256
70256
  _ignoreList: ignoreList
70257
70257
  // _originalScopes: originalScopes,
70258
70258
  } = cast2(map2);
70259
- const index = put(sources2, source2);
70259
+ const index = put(sources3, source2);
70260
70260
  if (index === sourcesContent.length) sourcesContent[index] = null;
70261
70261
  if (ignore) put(ignoreList, index);
70262
70262
  else remove(ignoreList, index);
@@ -70264,7 +70264,7 @@ var require_gen_mapping_umd = __commonJS({
70264
70264
  function toDecodedMap(map2) {
70265
70265
  const {
70266
70266
  _mappings: mappings,
70267
- _sources: sources2,
70267
+ _sources: sources3,
70268
70268
  _sourcesContent: sourcesContent,
70269
70269
  _names: names2,
70270
70270
  _ignoreList: ignoreList
@@ -70277,7 +70277,7 @@ var require_gen_mapping_umd = __commonJS({
70277
70277
  file: map2.file || void 0,
70278
70278
  names: names2.array,
70279
70279
  sourceRoot: map2.sourceRoot || void 0,
70280
- sources: sources2.array,
70280
+ sources: sources3.array,
70281
70281
  sourcesContent,
70282
70282
  mappings,
70283
70283
  // originalScopes,
@@ -70305,7 +70305,7 @@ var require_gen_mapping_umd = __commonJS({
70305
70305
  }
70306
70306
  function allMappings(map2) {
70307
70307
  const out = [];
70308
- const { _mappings: mappings, _sources: sources2, _names: names2 } = cast2(map2);
70308
+ const { _mappings: mappings, _sources: sources3, _names: names2 } = cast2(map2);
70309
70309
  for (let i = 0; i < mappings.length; i++) {
70310
70310
  const line = mappings[i];
70311
70311
  for (let j2 = 0; j2 < line.length; j2++) {
@@ -70315,7 +70315,7 @@ var require_gen_mapping_umd = __commonJS({
70315
70315
  let original = void 0;
70316
70316
  let name = void 0;
70317
70317
  if (seg.length !== 1) {
70318
- source2 = sources2.array[seg[SOURCES_INDEX]];
70318
+ source2 = sources3.array[seg[SOURCES_INDEX]];
70319
70319
  original = { line: seg[SOURCE_LINE] + 1, column: seg[SOURCE_COLUMN] };
70320
70320
  if (seg.length === 5) name = names2.array[seg[NAMES_INDEX]];
70321
70321
  }
@@ -70327,7 +70327,7 @@ var require_gen_mapping_umd = __commonJS({
70327
70327
  function addSegmentInternal(skipable, map2, genLine, genColumn, source2, sourceLine, sourceColumn, name, content) {
70328
70328
  const {
70329
70329
  _mappings: mappings,
70330
- _sources: sources2,
70330
+ _sources: sources3,
70331
70331
  _sourcesContent: sourcesContent,
70332
70332
  _names: names2
70333
70333
  // _originalScopes: originalScopes,
@@ -70340,7 +70340,7 @@ var require_gen_mapping_umd = __commonJS({
70340
70340
  }
70341
70341
  assert(sourceLine);
70342
70342
  assert(sourceColumn);
70343
- const sourcesIndex = put(sources2, source2);
70343
+ const sourcesIndex = put(sources3, source2);
70344
70344
  const namesIndex = name ? put(names2, name) : NO_NAME;
70345
70345
  if (sourcesIndex === sourcesContent.length) sourcesContent[sourcesIndex] = content != null ? content : null;
70346
70346
  if (skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex)) {
@@ -70834,9 +70834,9 @@ var require_util8 = __commonJS({
70834
70834
  /** @class */
70835
70835
  (function(_super) {
70836
70836
  __extends(VError2, _super);
70837
- function VError2(path47, message) {
70837
+ function VError2(path48, message) {
70838
70838
  var _this = _super.call(this, message) || this;
70839
- _this.path = path47;
70839
+ _this.path = path48;
70840
70840
  Object.setPrototypeOf(_this, VError2.prototype);
70841
70841
  return _this;
70842
70842
  }
@@ -70896,26 +70896,26 @@ var require_util8 = __commonJS({
70896
70896
  (_b = this._messages).push.apply(_b, best._messages);
70897
70897
  }
70898
70898
  };
70899
- DetailContext2.prototype.getError = function(path47) {
70899
+ DetailContext2.prototype.getError = function(path48) {
70900
70900
  var msgParts = [];
70901
70901
  for (var i = this._propNames.length - 1; i >= 0; i--) {
70902
70902
  var p2 = this._propNames[i];
70903
- path47 += typeof p2 === "number" ? "[" + p2 + "]" : p2 ? "." + p2 : "";
70903
+ path48 += typeof p2 === "number" ? "[" + p2 + "]" : p2 ? "." + p2 : "";
70904
70904
  var m = this._messages[i];
70905
70905
  if (m) {
70906
- msgParts.push(path47 + " " + m);
70906
+ msgParts.push(path48 + " " + m);
70907
70907
  }
70908
70908
  }
70909
- return new VError(path47, msgParts.join("; "));
70909
+ return new VError(path48, msgParts.join("; "));
70910
70910
  };
70911
- DetailContext2.prototype.getErrorDetail = function(path47) {
70911
+ DetailContext2.prototype.getErrorDetail = function(path48) {
70912
70912
  var details = [];
70913
70913
  for (var i = this._propNames.length - 1; i >= 0; i--) {
70914
70914
  var p2 = this._propNames[i];
70915
- path47 += typeof p2 === "number" ? "[" + p2 + "]" : p2 ? "." + p2 : "";
70915
+ path48 += typeof p2 === "number" ? "[" + p2 + "]" : p2 ? "." + p2 : "";
70916
70916
  var message = this._messages[i];
70917
70917
  if (message) {
70918
- details.push({ path: path47, message });
70918
+ details.push({ path: path48, message });
70919
70919
  }
70920
70920
  }
70921
70921
  var detail = null;
@@ -71728,8 +71728,8 @@ var require_dist = __commonJS({
71728
71728
  this.checkerPlain = this.ttype.getChecker(suite, false);
71729
71729
  this.checkerStrict = this.ttype.getChecker(suite, true);
71730
71730
  }
71731
- Checker2.prototype.setReportedPath = function(path47) {
71732
- this._path = path47;
71731
+ Checker2.prototype.setReportedPath = function(path48) {
71732
+ this._path = path48;
71733
71733
  };
71734
71734
  Checker2.prototype.check = function(value) {
71735
71735
  return this._doCheck(this.checkerPlain, value);
@@ -77162,9 +77162,9 @@ var require_CJSImportTransformer = __commonJS({
77162
77162
  if (shouldElideImport) {
77163
77163
  this.tokens.removeToken();
77164
77164
  } else {
77165
- const path47 = this.tokens.stringValue();
77166
- this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(path47));
77167
- this.tokens.appendCode(this.importProcessor.claimImportCode(path47));
77165
+ const path48 = this.tokens.stringValue();
77166
+ this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(path48));
77167
+ this.tokens.appendCode(this.importProcessor.claimImportCode(path48));
77168
77168
  }
77169
77169
  _removeMaybeImportAttributes.removeMaybeImportAttributes.call(void 0, this.tokens);
77170
77170
  if (this.tokens.matches1(_types.TokenType.semi)) {
@@ -77744,8 +77744,8 @@ var require_CJSImportTransformer = __commonJS({
77744
77744
  }
77745
77745
  if (this.tokens.matchesContextual(_keywords.ContextualKeyword._from)) {
77746
77746
  this.tokens.removeToken();
77747
- const path47 = this.tokens.stringValue();
77748
- this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(path47));
77747
+ const path48 = this.tokens.stringValue();
77748
+ this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(path48));
77749
77749
  _removeMaybeImportAttributes.removeMaybeImportAttributes.call(void 0, this.tokens);
77750
77750
  } else {
77751
77751
  this.tokens.appendCode(exportStatements.join(" "));
@@ -77759,8 +77759,8 @@ var require_CJSImportTransformer = __commonJS({
77759
77759
  while (!this.tokens.matches1(_types.TokenType.string)) {
77760
77760
  this.tokens.removeToken();
77761
77761
  }
77762
- const path47 = this.tokens.stringValue();
77763
- this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(path47));
77762
+ const path48 = this.tokens.stringValue();
77763
+ this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(path48));
77764
77764
  _removeMaybeImportAttributes.removeMaybeImportAttributes.call(void 0, this.tokens);
77765
77765
  if (this.tokens.matches1(_types.TokenType.semi)) {
77766
77766
  this.tokens.removeToken();
@@ -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, path47) => {
107617
+ getPart = (classPartObject, path48) => {
107618
107618
  let current2 = classPartObject;
107619
- const parts = path47.split(CLASS_PART_SEPARATOR);
107619
+ const parts = path48.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];
@@ -111173,7 +111173,7 @@ function loadProxyFile() {
111173
111173
  // src/flow-worker.ts
111174
111174
  import { spawn as spawn5 } from "node:child_process";
111175
111175
  import fs43 from "node:fs";
111176
- import path46 from "node:path";
111176
+ import path47 from "node:path";
111177
111177
  import { fileURLToPath as fileURLToPath4 } from "node:url";
111178
111178
 
111179
111179
  // ../cli/src/lib/cloud/session.ts
@@ -111571,18 +111571,18 @@ function markedInPs(entry, roots) {
111571
111571
  });
111572
111572
  if (ps.status !== 0 || !ps.stdout) throw new Error("\u65E0\u6CD5\u67E5\u8BE2\u8FDB\u7A0B\u6811\u3002");
111573
111573
  const children = /* @__PURE__ */ new Map();
111574
- const listed2 = /* @__PURE__ */ new Set();
111574
+ const listed = /* @__PURE__ */ new Set();
111575
111575
  const found = /* @__PURE__ */ new Set();
111576
111576
  for (const line of ps.stdout.split("\n")) {
111577
111577
  const m = /^\s*(\d+)\s+(\d+)\s(.*)$/.exec(line);
111578
111578
  if (!m) continue;
111579
111579
  const pid = Number(m[1]);
111580
111580
  const ppid = Number(m[2]);
111581
- listed2.add(pid);
111581
+ listed.add(pid);
111582
111582
  children.set(ppid, [...children.get(ppid) ?? [], pid]);
111583
111583
  if (`${m[3]} `.includes(` ${entry} `)) found.add(pid);
111584
111584
  }
111585
- const queue = [...found, ...roots.filter((pid) => listed2.has(pid))];
111585
+ const queue = [...found, ...roots.filter((pid) => listed.has(pid))];
111586
111586
  for (const pid of queue) {
111587
111587
  found.add(pid);
111588
111588
  for (const child of children.get(pid) ?? []) if (!found.has(child)) queue.push(child);
@@ -112081,7 +112081,7 @@ async function studioSnapshot(workspace, catalog, list3) {
112081
112081
  }
112082
112082
 
112083
112083
  // src/protocol.ts
112084
- var AKB_VERSION = true ? "0.11.69" : "0.0.0";
112084
+ var AKB_VERSION = true ? "0.11.71" : "0.0.0";
112085
112085
  var AKB_CONTRACT = true ? 17 : 0;
112086
112086
 
112087
112087
  // src/secrets.ts
@@ -112172,7 +112172,7 @@ async function upload(route, bytes2, type) {
112172
112172
  }
112173
112173
  async function uploadReplyImage(machine, job, key, bytes2, mime) {
112174
112174
  const route = `/v1/runner/jobs/${encodeURIComponent(job)}/images/${key}?machine=${encodeURIComponent(machine)}`;
112175
- const sent = await send("PUT", route, bytes2, true, 15e3, mime);
112175
+ const sent = await send("PUT", route, bytes2, true, 9e4, mime);
112176
112176
  return sent.ok ? answerOf(sent.value) : sent;
112177
112177
  }
112178
112178
  var register = (r2) => request("POST", "/v1/runner", { ...r2, secrets: secretsSet(), protocol: PROTOCOL, akbContract: AKB_CONTRACT });
@@ -112211,7 +112211,7 @@ var listFolders = (machineId) => request("GET", `/v1/runner/folders?machine=${q(
112211
112211
  var listElsewhere = (machineId) => request("GET", `/v1/runner/folders?machine=${q(machineId)}&elsewhere=1`);
112212
112212
  var listMachineTasks = (machineId) => request("GET", `/v1/runner/tasks?machine=${q(machineId)}`);
112213
112213
  var stopTask = (task, how) => request("POST", how === "chat" ? `/v1/tasks/${q(task)}/chat/stop` : `/v1/tasks/${q(task)}/stop`, {});
112214
- var addFolder = (machineId, name, path47, project) => request("POST", "/v1/runner/folders", { machineId, name, path: path47, ...project ? { project } : {} });
112214
+ var addFolder = (machineId, name, path48, project) => request("POST", "/v1/runner/folders", { machineId, name, path: path48, ...project ? { project } : {} });
112215
112215
  async function createProject(name, workspace, key) {
112216
112216
  const sent = await send("POST", "/v1/projects", { name, workspace }, true, TIMEOUT_MS, void 0, { "idempotency-key": key });
112217
112217
  return sent.ok ? answerOf(sent.value) : sent;
@@ -112287,25 +112287,25 @@ var ASSET_FILE_LIMIT = 100 * 1024 * 1024;
112287
112287
  // ../cli/src/lib/shared/board-files.ts
112288
112288
  var ROOTS = ["todo/", ".archive/", "memory/", "studios/", "triage/", "assets/", "rules/"];
112289
112289
  var SETTINGS = ["modules.md", "config.md"];
112290
- var isSettingsPath = (path47) => SETTINGS.includes(path47) || /^rules\/(?:studios\/)?[^/]+\.md$/.test(path47);
112291
- function isBoardPath(path47) {
112292
- if (!path47 || path47.length > 500 || path47.startsWith("/") || path47.includes("\\") || path47.includes("\0")) return false;
112293
- if (path47.split("/").some((part) => !part || part === "." || part === "..")) return false;
112294
- if (path47 === "todo/README.md" || path47.split("/").includes(".sync")) return false;
112295
- if (path47.startsWith("studios/")) return true;
112296
- if (SETTINGS.includes(path47)) return true;
112297
- if (path47.startsWith("rules/")) return isSettingsPath(path47);
112298
- if (path47.startsWith("assets/")) return taskOfAssets(path47) !== null;
112299
- return ROOTS.some((root2) => path47.startsWith(root2)) && path47.endsWith(".md");
112290
+ var isSettingsPath = (path48) => SETTINGS.includes(path48) || /^rules\/(?:studios\/)?[^/]+\.md$/.test(path48);
112291
+ function isBoardPath(path48) {
112292
+ if (!path48 || path48.length > 500 || path48.startsWith("/") || path48.includes("\\") || path48.includes("\0")) return false;
112293
+ if (path48.split("/").some((part) => !part || part === "." || part === "..")) return false;
112294
+ if (path48 === "todo/README.md" || path48.split("/").includes(".sync")) return false;
112295
+ if (path48.startsWith("studios/")) return true;
112296
+ if (SETTINGS.includes(path48)) return true;
112297
+ if (path48.startsWith("rules/")) return isSettingsPath(path48);
112298
+ if (path48.startsWith("assets/")) return taskOfAssets(path48) !== null;
112299
+ return ROOTS.some((root2) => path48.startsWith(root2)) && path48.endsWith(".md");
112300
112300
  }
112301
112301
  var CARD = /^(?:todo|\.archive)\/(?:[^/]+\/)*(\d+)-[^/]*\.md$/;
112302
112302
  var ROOT = /^(?:todo|\.archive)\/(?:[^/]+\/)*(\d+)-[^/]+\/root\.md$/;
112303
- function numberOfCard(path47) {
112304
- const n = ROOT.exec(path47)?.[1] ?? CARD.exec(path47)?.[1];
112303
+ function numberOfCard(path48) {
112304
+ const n = ROOT.exec(path48)?.[1] ?? CARD.exec(path48)?.[1];
112305
112305
  return n ? Number(n) : null;
112306
112306
  }
112307
112307
  var assetsFile = (task) => `assets/${task}.json`;
112308
- var taskOfAssets = (path47) => /^assets\/(task_[0-9a-f]+)\.json$/.exec(path47)?.[1] ?? null;
112308
+ var taskOfAssets = (path48) => /^assets\/(task_[0-9a-f]+)\.json$/.exec(path48)?.[1] ?? null;
112309
112309
  var studioFolder = (id) => id.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
112310
112310
  var studioName = (id) => id.startsWith("wf_builtin_") ? id.slice("wf_builtin_".length).replace(/_/g, "-") : studioFolder(id);
112311
112311
  var unquote = (value) => value.trim().replace(/^(["'])(.*)\1$/, "$2");
@@ -112762,7 +112762,6 @@ import path10 from "node:path";
112762
112762
  var STUDIO_FILE = "STUDIO.md";
112763
112763
  var MCP_FILE = "mcp.json";
112764
112764
  var CARD_TEMPLATE_FILE = "CARD.md";
112765
- var SHARED_DIR = "shared/";
112766
112765
  var VERSION_FILE = "version.json";
112767
112766
  var KB = 1024;
112768
112767
  var FILE_LIMITS = { file: 2 * KB * KB, total: 2 * KB * KB, count: 500, path: 512 };
@@ -112907,32 +112906,12 @@ var OFFICIAL = path11.dirname(fileURLToPath(import.meta.url));
112907
112906
  var dirs = (dir) => fs10.readdirSync(dir, { withFileTypes: true }).filter((e2) => e2.isDirectory()).map((e2) => e2.name).sort();
112908
112907
  var hashOf = (files) => crypto.createHash("sha256").update(hashInput(files)).digest("hex");
112909
112908
  function packOfficial(root2 = OFFICIAL, loose = false) {
112910
- const agentsDir = path11.join(root2, "agents");
112911
- const agentFiles = Object.fromEntries(dirs(agentsDir).map((name) => {
112912
- const dir = path11.join(agentsDir, name);
112913
- return [name, readStudioFolder(dir)];
112914
- }));
112915
- for (const [name, own] of Object.entries(loose ? {} : agentFiles)) {
112916
- const read4 = parseSpecAgent(own["AGENT.md"] ?? "", `official/agents/${name}/AGENT.md`, (p2) => own[p2] ?? null, true);
112917
- if ("problem" in read4) throw new Error(read4.problem);
112918
- }
112919
112909
  const studiosDir = path11.join(root2, "studios");
112920
112910
  return dirs(studiosDir).map((folder) => {
112921
- const dir = path11.join(studiosDir, folder);
112922
- const files = {};
112923
- for (const f2 of filesOf(dir).sort()) {
112924
- if (f2 === STUDIO_FILE || f2 === CARD_TEMPLATE_FILE || f2 === MCP_FILE || f2.startsWith("skills/") || f2.startsWith(SHARED_DIR) || isAboutFile(f2)) files[f2] = readStudioFile(dir, f2);
112925
- }
112926
- const read4 = checkStudioFiles({ [STUDIO_FILE]: files[STUDIO_FILE], ...Object.fromEntries(
112927
- Object.entries(agentFiles).flatMap(([name, own]) => Object.entries(own).map(([f2, t]) => [`agents/${name}/${f2}`, t]))
112928
- ) });
112929
- if (!read4.ok && !loose) throw new Error(`official/studios/${folder}: ${read4.file}: ${read4.reason}`);
112911
+ const files = readStudioFolder(path11.join(studiosDir, folder));
112930
112912
  const parsed = parseStudioFile(folder, files[STUDIO_FILE] ?? "", STUDIO_FILE);
112931
112913
  if ("problem" in parsed) throw new Error(parsed.problem);
112932
112914
  const def = parsed.def;
112933
- for (const name of [...new Set([...def.previews, ...def.land, ...def.scheduled].map((h3) => h3.agent))].sort()) {
112934
- for (const [f2, text4] of Object.entries(agentFiles[name] ?? {})) files[`agents/${name}/${f2}`] = text4;
112935
- }
112936
112915
  const checked = loose ? { ok: true } : checkStudioFiles(files, true);
112937
112916
  if (!checked.ok) throw new Error(`official/studios/${folder}: ${checked.file}: ${checked.reason}`);
112938
112917
  if (!def.names?.zh && !loose) throw new Error(`official/studios/${folder}/${STUDIO_FILE}: add its Chinese name under \`names: zh\``);
@@ -113585,19 +113564,19 @@ var kindAt = (src, types) => extOf(src) === ".json" ? types.includes("asset") ?
113585
113564
  function collect(body, card, host) {
113586
113565
  return collectSources(bodyReferences(body), card, host);
113587
113566
  }
113588
- function collectSources(sources2, card, host) {
113567
+ function collectSources(sources3, card, host) {
113589
113568
  const nodes = /* @__PURE__ */ new Map();
113590
113569
  const active = /* @__PURE__ */ new Set();
113591
113570
  const out = [];
113592
113571
  const visit = (src, types, owner2, partial = false) => {
113593
- const path47 = src.replace(/[?#].*$/, "");
113572
+ const path48 = src.replace(/[?#].*$/, "");
113594
113573
  let resolved;
113595
113574
  try {
113596
- resolved = host.resolve(path47, owner2);
113575
+ resolved = host.resolve(path48, owner2);
113597
113576
  } catch (error) {
113598
113577
  if (owner2 !== card) return { key: null, error: why(error) };
113599
113578
  if (!nodes.has(src)) {
113600
- const node2 = { key: src, file: null, kind: kindAt(path47, types), error: why(error), problems: [], dependencies: /* @__PURE__ */ new Map(), aliases: /* @__PURE__ */ new Set([src]) };
113579
+ const node2 = { key: src, file: null, kind: kindAt(path48, types), error: why(error), problems: [], dependencies: /* @__PURE__ */ new Map(), aliases: /* @__PURE__ */ new Set([src]) };
113601
113580
  nodes.set(src, node2);
113602
113581
  out.push(node2);
113603
113582
  }
@@ -113654,7 +113633,7 @@ function collectSources(sources2, card, host) {
113654
113633
  out.push(node);
113655
113634
  return { key, error: node.error };
113656
113635
  };
113657
- for (const ref of sources2) visit(ref.src, ref.types, card);
113636
+ for (const ref of sources3) visit(ref.src, ref.types, card);
113658
113637
  const sorted = [];
113659
113638
  const done = /* @__PURE__ */ new Set();
113660
113639
  const order = (node) => {
@@ -113891,8 +113870,8 @@ function diff3Merge(a2, o3, b2, options) {
113891
113870
 
113892
113871
  // ../cli/src/lib/shared/triage-files.ts
113893
113872
  var ITEM = /^triage\/(?:(dismissed|archived)\/)?([^/]+)\.md$/;
113894
- function itemAt(path47) {
113895
- const m = ITEM.exec(path47);
113873
+ function itemAt(path48) {
113874
+ const m = ITEM.exec(path48);
113896
113875
  if (!m) return null;
113897
113876
  return { state: m[1] === "dismissed" ? "dismissed" : m[1] === "archived" ? "carded" : "open", name: m[2] };
113898
113877
  }
@@ -115153,7 +115132,7 @@ function cloudLanguage(input) {
115153
115132
 
115154
115133
  // src/flow.ts
115155
115134
  import fs34 from "node:fs";
115156
- import path37 from "node:path";
115135
+ import path38 from "node:path";
115157
115136
 
115158
115137
  // ../cli/src/lib/question-block.ts
115159
115138
  var MODES = ["single", "multi"];
@@ -115757,15 +115736,26 @@ var OPENAI = {
115757
115736
  "gpt-5-nano": { input: 0.05, cachedInput: 5e-3, output: 0.4 },
115758
115737
  "gpt-5-pro": { input: 15, cachedInput: 15, output: 120 }
115759
115738
  };
115739
+ function antigravityPrices(at2) {
115740
+ const pro = at2 < Date.parse("2026-12-01T00:00:00Z") ? 2 : 4;
115741
+ const flash = at2 < Date.parse("2027-01-01T00:00:00Z") ? 0.75 : 1.5;
115742
+ return {
115743
+ "gemini-4-carbon": { input: pro, cachedInput: pro / 20, output: pro * 5 },
115744
+ "gemini-4-argon": { input: pro, cachedInput: pro / 20, output: pro * 5 },
115745
+ "gemini-4-hydrogen": { input: 1.5, cachedInput: 0.075, output: 7.5 },
115746
+ "gemini-3.8-flash": { input: flash, cachedInput: flash / 10, output: flash * 5 }
115747
+ };
115748
+ }
115760
115749
  var PRICES = { openai: OPENAI, "openai-api": OPENAI };
115761
115750
  function lookUp(table, model) {
115762
115751
  const id = model.trim().toLowerCase().replace(/^[^/]+\//, "");
115763
115752
  return table[id] ?? table[id.replace(/-\d{4}-\d{2}-\d{2}$/, "")];
115764
115753
  }
115765
- function priceUsd(provider, model, usage) {
115754
+ function priceUsd(provider, model, usage, at2 = Date.now()) {
115766
115755
  if (!provider || !model || !usage) return void 0;
115767
- const table = PRICES[provider.trim().toLowerCase()];
115768
- const price = table && lookUp(table, model);
115756
+ const agy = provider.trim().toLowerCase() === "antigravity";
115757
+ const table = agy ? antigravityPrices(at2) : PRICES[provider.trim().toLowerCase()];
115758
+ const price = table && (agy ? table[model.trim().toLowerCase().replace(/-(?:low|medium|high|xhigh|max)$/, "")] : lookUp(table, model));
115769
115759
  if (!price) return void 0;
115770
115760
  const usd = ((usage.input + usage.cacheCreation) * price.input + usage.cacheRead * price.cachedInput + usage.output * price.output) / 1e6;
115771
115761
  return Number.isFinite(usd) && usd >= 0 ? usd : void 0;
@@ -115834,10 +115824,10 @@ function findRollout(threadId) {
115834
115824
  }
115835
115825
  for (const name of names2) {
115836
115826
  if (!name.startsWith("rollout-") || !name.endsWith(tail)) continue;
115837
- const path47 = join(dir, name);
115827
+ const path48 = join(dir, name);
115838
115828
  try {
115839
- const at2 = statSync(path47).mtimeMs;
115840
- if (!newest2 || at2 > newest2.at) newest2 = { path: path47, at: at2 };
115829
+ const at2 = statSync(path48).mtimeMs;
115830
+ if (!newest2 || at2 > newest2.at) newest2 = { path: path48, at: at2 };
115841
115831
  } catch {
115842
115832
  }
115843
115833
  }
@@ -115845,11 +115835,11 @@ function findRollout(threadId) {
115845
115835
  return newest2?.path;
115846
115836
  }
115847
115837
  function readCodexRunFacts(threadId) {
115848
- const path47 = findRollout(threadId);
115849
- if (!path47) return void 0;
115838
+ const path48 = findRollout(threadId);
115839
+ if (!path48) return void 0;
115850
115840
  let raw;
115851
115841
  try {
115852
- raw = readFileSync(path47, "utf8");
115842
+ raw = readFileSync(path48, "utf8");
115853
115843
  } catch {
115854
115844
  return void 0;
115855
115845
  }
@@ -115961,8 +115951,8 @@ function renderCompleted(item) {
115961
115951
  const changes = Array.isArray(item.changes) ? item.changes : [];
115962
115952
  return changes.map((raw) => {
115963
115953
  const change = obj(raw);
115964
- const path47 = str(change.path);
115965
- return path47 ? `\u23FA ${str(change.kind) || "change"}(${path47})
115954
+ const path48 = str(change.path);
115955
+ return path48 ? `\u23FA ${str(change.kind) || "change"}(${path48})
115966
115956
  ` : "";
115967
115957
  }).join("");
115968
115958
  }
@@ -116278,10 +116268,10 @@ function readKimiRunFacts(sessionId) {
116278
116268
  const total = { input: 0, cacheCreation: 0, cacheRead: 0, output: 0 };
116279
116269
  let model;
116280
116270
  let holding = 0;
116281
- for (const { path: path47, main } of wireFiles(entry.sessionDir)) {
116271
+ for (const { path: path48, main } of wireFiles(entry.sessionDir)) {
116282
116272
  let raw;
116283
116273
  try {
116284
- raw = readFileSync2(path47, "utf8");
116274
+ raw = readFileSync2(path48, "utf8");
116285
116275
  } catch {
116286
116276
  continue;
116287
116277
  }
@@ -116517,7 +116507,7 @@ function createTail(log) {
116517
116507
  // ../cli/package.json
116518
116508
  var package_default = {
116519
116509
  name: "wildcrane",
116520
- version: "0.11.69",
116510
+ version: "0.11.71",
116521
116511
  akbContract: 17,
116522
116512
  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.",
116523
116513
  keywords: [
@@ -116591,8 +116581,8 @@ var CLIENT_CAPABILITIES = {
116591
116581
  };
116592
116582
  function whereHint(update2, title) {
116593
116583
  const locations = Array.isArray(update2.locations) ? update2.locations : [];
116594
- const path47 = str(obj(locations[0]).path);
116595
- return path47 && !title.includes(path47) ? hint(path47) : "";
116584
+ const path48 = str(obj(locations[0]).path);
116585
+ return path48 && !title.includes(path48) ? hint(path48) : "";
116596
116586
  }
116597
116587
  function saidBy(update2) {
116598
116588
  const content = Array.isArray(update2.content) ? update2.content : [];
@@ -116774,9 +116764,9 @@ async function oneTurn(io, options) {
116774
116764
  }
116775
116765
  let model = modelOf(opened);
116776
116766
  if (options.model) {
116777
- const listed2 = obj(opened.models).currentModelId !== void 0;
116778
- const picked = listed2 ? pickedModel(opened, options.model) : void 0;
116779
- const set = listed2 ? await bounded(rpc.call("session/set_model", { sessionId, modelId: picked?.modelId ?? options.model }), preparingUntil - Date.now(), "ACP session/set_model timed out.") : await bounded(rpc.call("session/set_config_option", { sessionId, configId: "model", value: options.model }), preparingUntil - Date.now(), "ACP session/set_config_option timed out.");
116767
+ const listed = obj(opened.models).currentModelId !== void 0;
116768
+ const picked = listed ? pickedModel(opened, options.model) : void 0;
116769
+ const set = listed ? await bounded(rpc.call("session/set_model", { sessionId, modelId: picked?.modelId ?? options.model }), preparingUntil - Date.now(), "ACP session/set_model timed out.") : await bounded(rpc.call("session/set_config_option", { sessionId, configId: "model", value: options.model }), preparingUntil - Date.now(), "ACP session/set_config_option timed out.");
116780
116770
  model = picked?.name ?? modelOf(set) ?? options.model;
116781
116771
  }
116782
116772
  if (model) io.gotModel(model);
@@ -117563,7 +117553,7 @@ async function run2(io, options, count2) {
117563
117553
  startupTimer = setTimeout(() => {
117564
117554
  if (!started) io.event?.({ kind: "log", data: { text: "[conversation] start_unconfirmed" } });
117565
117555
  }, CONVERSATION_MS.start);
117566
- await bounded(rpc.call("turn/start", { threadId, input: [{ type: "text", text: text4 }, ...images.map((path47) => ({ type: "localImage", path: path47 }))] }), CONVERSATION_MS.start, "Codex turn/start timed out; submission outcome is unknown.").catch((error) => {
117556
+ await bounded(rpc.call("turn/start", { threadId, input: [{ type: "text", text: text4 }, ...images.map((path48) => ({ type: "localImage", path: path48 }))] }), CONVERSATION_MS.start, "Codex turn/start timed out; submission outcome is unknown.").catch((error) => {
117567
117557
  if (!started) throw error;
117568
117558
  });
117569
117559
  };
@@ -117991,11 +117981,11 @@ import { spawn as spawn3 } from "node:child_process";
117991
117981
  import { randomUUID as randomUUID4 } from "node:crypto";
117992
117982
  import fs31 from "node:fs";
117993
117983
  import os5 from "node:os";
117994
- import path34 from "node:path";
117984
+ import path35 from "node:path";
117995
117985
 
117996
117986
  // ../cli/src/lib/agent/harnesses/antigravity.ts
117997
117987
  import fs28 from "node:fs";
117998
- import path29 from "node:path";
117988
+ import path30 from "node:path";
117999
117989
  import { createHash as createHash4 } from "node:crypto";
118000
117990
  import { spawnSync as spawnSync5 } from "node:child_process";
118001
117991
 
@@ -118326,8 +118316,7 @@ function modelsIn2(file2, pick2, salt = "") {
118326
118316
  const stat = statSync3(file2);
118327
118317
  stamp3 = `${stat.mtimeMs}:${stat.size}:${salt}`;
118328
118318
  } catch {
118329
- cached.delete(file2);
118330
- return [];
118319
+ return cached.get(file2)?.found ?? [];
118331
118320
  }
118332
118321
  const hit = cached.get(file2);
118333
118322
  if (hit?.stamp === stamp3) return hit.found;
@@ -118337,15 +118326,66 @@ function modelsIn2(file2, pick2, salt = "") {
118337
118326
  } catch {
118338
118327
  found = [];
118339
118328
  }
118340
- cached.set(file2, { stamp: stamp3, found });
118341
- return found;
118329
+ if (found.length) cached.set(file2, { stamp: stamp3, found });
118330
+ return found.length ? found : hit?.found ?? [];
118331
+ }
118332
+
118333
+ // ../cli/src/lib/agent/harnesses/transient.ts
118334
+ var MANUAL = [
118335
+ /\b(401|403)\b/,
118336
+ /unauthorized|forbidden|permission (?:denied|required|check failed)|permission_denied|soft.denied|auto-denied|权限拒绝/,
118337
+ /authenticat|invalid api key|api[_ ]key|not (?:logged|signed) in|please (?:log|sign) in|\/login|oauth/,
118338
+ /\b429\b/,
118339
+ /rate[ _-]?limit|usage limit|quota|credits?|insufficient|out of tokens|resource[ _-]?exhausted/,
118340
+ /cancell?ed|aborted by|interrupted by the user/,
118341
+ /maximum budget|max(imum)? turns|exceeded the budget/,
118342
+ /model not found|unknown model|invalid model|model (?:is )?unavailable|model[^\n]+ is (?:unavailable|not recognized)|unsupported|invalid[_ ]request/
118343
+ ];
118344
+ var PASSING = [
118345
+ // 502/503/529 are distinctive enough to read as a status wherever they appear. A bare
118346
+ // 500 is not — a failure line counting something would match it — so it is left to the
118347
+ // words below, which is how that status is actually written out.
118348
+ /\b(502|503|529)\b/,
118349
+ /overloaded|service unavailable|bad gateway|internal server error|server_error/,
118350
+ /connection (lost|dropped|reset|error|closed)|socket hang up|stream (error|disconnected)/,
118351
+ /econnreset|econnrefused|etimedout|enetunreach|enotfound|eai_again/,
118352
+ /fetch failed|request timed out|network error/,
118353
+ /rpc error: code = (?:unavailable|deadlineexceeded)\b|deadline_exceeded|dial tcp[^\n]*(?:timeout|refused|no such host)/
118354
+ ];
118355
+ var RETRY_AFTER = /retry[-_\s]?after["':=\s]+(\d+)/i;
118356
+ var REASON_MAX = 140;
118357
+ function reasonLine(text4, rule) {
118358
+ const line = text4.split("\n").find((l2) => rule.test(l2.toLowerCase())) ?? text4;
118359
+ const said = line.trim().replace(/\s+/g, " ");
118360
+ return said.length > REASON_MAX ? `${said.slice(0, REASON_MAX - 1)}\u2026` : said;
118361
+ }
118362
+ function manualFailure(text4) {
118363
+ return MANUAL.some((rule) => rule.test(text4.toLowerCase()));
118364
+ }
118365
+ function providerBlip(...said) {
118366
+ for (const text4 of said) {
118367
+ if (!text4?.trim()) continue;
118368
+ const lower = text4.toLowerCase();
118369
+ if (manualFailure(text4)) return void 0;
118370
+ const hit = PASSING.find((rule) => rule.test(lower));
118371
+ if (!hit) continue;
118372
+ const asked = RETRY_AFTER.exec(text4);
118373
+ const seconds = asked ? Number(asked[1]) : NaN;
118374
+ return {
118375
+ reason: reasonLine(text4, hit),
118376
+ ...Number.isFinite(seconds) && seconds > 0 ? { retryAfterMs: seconds * 1e3 } : {}
118377
+ };
118378
+ }
118379
+ return void 0;
118342
118380
  }
118343
118381
 
118344
118382
  // ../cli/src/lib/agent/wire/antigravity.ts
118383
+ import path29 from "node:path";
118345
118384
  var KINDS = {
118346
118385
  run_command: "execute",
118347
118386
  command_status: "execute",
118348
118387
  send_command_input: "execute",
118388
+ read_file: "read",
118349
118389
  view_file: "read",
118350
118390
  list_dir: "read",
118351
118391
  grep_search: "search",
@@ -118369,14 +118409,39 @@ function failureHint(reason) {
118369
118409
  return hint2 ? `${reason}
118370
118410
  ${hint2}` : reason;
118371
118411
  }
118372
- function createAntigravityRenderer(expectedSession) {
118412
+ var limited = (reason) => /\b429\b|rate[ _-]?limit|resource[ _-]?exhausted|quota[^\n]*\b(?:exceeded|exhausted|depleted|reached)\b|(?:exceed|exhaust|deplet)[^\n]*quota|(?:insufficient|exhausted|out of|no remaining) (?:credits?|quota)|credits?[^\n]*(?:exhaust|deplet|exceed)/i.test(reason);
118413
+ var imagePath = (target) => /\.(?:png|jpe?g|gif|webp|bmp|tiff?|svg)$/i.test(target);
118414
+ function createAntigravityRenderer(expectedSession, cwd = process.cwd()) {
118373
118415
  let session = expectedSession;
118374
118416
  let model;
118417
+ let partial = "";
118375
118418
  let final;
118376
118419
  let failure;
118420
+ let rateLimit;
118421
+ let imageFailure;
118422
+ let requiredImages = [];
118423
+ const readImages = /* @__PURE__ */ new Set();
118424
+ const imageErrors = /* @__PURE__ */ new Map();
118425
+ const imageError = (target, reason) => translating() ? `Antigravity \u65E0\u6CD5\u8BFB\u53D6\u56FE\u7247 ${target}\uFF1A${reason}` : `Antigravity could not read image ${target}: ${reason}`;
118377
118426
  let terminal = false;
118378
118427
  let offStream;
118379
118428
  let stderr = "";
118429
+ let context;
118430
+ let contextStep = -1;
118431
+ const started = Date.now();
118432
+ let cost;
118433
+ let incomplete = false;
118434
+ const priced = /* @__PURE__ */ new Set();
118435
+ const countCost = (step) => {
118436
+ const index = step.step_index;
118437
+ if (typeof index !== "number" || !Number.isSafeInteger(index) || index < 0 || priced.has(index)) return;
118438
+ priced.add(index);
118439
+ const u2 = obj(step.usage);
118440
+ const valid = [u2.input_tokens, u2.output_tokens, u2.cache_read_tokens].every((n) => typeof n === "number" && Number.isFinite(n) && n >= 0);
118441
+ const usd = valid ? priceUsd("antigravity", model, usageOf4(u2), started) : void 0;
118442
+ if (usd === void 0) incomplete = true;
118443
+ else cost = (cost ?? 0) + usd;
118444
+ };
118380
118445
  let used;
118381
118446
  let turnUsage = zero();
118382
118447
  let previous;
@@ -118385,6 +118450,8 @@ function createAntigravityRenderer(expectedSession) {
118385
118450
  const closed = /* @__PURE__ */ new Set();
118386
118451
  const events = createEventCollector();
118387
118452
  const fail = (reason) => {
118453
+ if (limited(reason)) rateLimit = failureHint(reason);
118454
+ if (failure && manualFailure(failure) && !(limited(failure) && limited(reason))) return;
118388
118455
  failure = failureHint(reason);
118389
118456
  events.error(failure);
118390
118457
  };
@@ -118392,6 +118459,7 @@ function createAntigravityRenderer(expectedSession) {
118392
118459
  const e2 = frame(line);
118393
118460
  if (!e2) {
118394
118461
  offStream = line.trim() || offStream;
118462
+ if (/^(?:error:|rpc error:)/i.test(line.trim()) && limited(line)) fail(line.trim());
118395
118463
  return `${line}
118396
118464
  `;
118397
118465
  }
@@ -118410,10 +118478,19 @@ function createAntigravityRenderer(expectedSession) {
118410
118478
  if (expectedSession && str(step.conversation_id) !== expectedSession) return "";
118411
118479
  session = str(step.conversation_id) || session;
118412
118480
  const id = String(step.step_index ?? "");
118481
+ if (step.state === "DONE" && ["agent_response", "checkpoint"].includes(str(step.step_type))) countCost(step);
118413
118482
  if (step.step_type === "agent_response") {
118414
118483
  const text4 = str(step.text_delta);
118484
+ partial += text4;
118415
118485
  if (text4) events.update({ sessionUpdate: "agent_message_chunk", content: { text: text4 } });
118416
118486
  const index = num(step.step_index);
118487
+ if (step.state === "DONE" && Number.isSafeInteger(index) && step.step_index === index && index > contextStep) {
118488
+ contextStep = index;
118489
+ const u2 = obj(step.usage);
118490
+ const counts2 = [u2.input_tokens, u2.cache_read_tokens];
118491
+ const prompt = counts2.every((n) => typeof n === "number" && Number.isFinite(n) && n >= 0) ? num(u2.input_tokens) + num(u2.cache_read_tokens) : 0;
118492
+ context = prompt > 0 && Number.isFinite(prompt) ? { used: prompt } : void 0;
118493
+ }
118417
118494
  if (step.state === "DONE" && step.usage && !counted.has(index)) {
118418
118495
  counted.add(index);
118419
118496
  turnUsage = add(turnUsage, usageOf4(step.usage));
@@ -118439,7 +118516,20 @@ function createAntigravityRenderer(expectedSession) {
118439
118516
  if (reason && /permission|denied|soft.den/i.test(reason)) fail(reason);
118440
118517
  if (["DONE", "ERROR", "CANCELED", "INTERRUPTED"].includes(str(step.state)) && !closed.has(id)) {
118441
118518
  closed.add(id);
118442
- events.toolResult(id, reason || step.state !== "DONE" ? "failed" : "completed", str(tool.output) || reason);
118519
+ const failed = !!reason || step.state !== "DONE";
118520
+ if (["read_file", "view_file"].includes(name) && imagePath(target)) {
118521
+ const file2 = path29.resolve(cwd, target);
118522
+ if (failed) {
118523
+ imageErrors.set(file2, reason || str(step.state));
118524
+ out += `
118525
+ ${imageError(target, reason || str(step.state))}
118526
+ `;
118527
+ } else {
118528
+ readImages.add(file2);
118529
+ imageErrors.delete(file2);
118530
+ }
118531
+ }
118532
+ events.toolResult(id, failed ? "failed" : "completed", str(tool.output) || reason);
118443
118533
  }
118444
118534
  return out;
118445
118535
  }
@@ -118459,47 +118549,76 @@ function createAntigravityRenderer(expectedSession) {
118459
118549
  used = previous ? { input: Math.max(0, total.input - previous.input), output: Math.max(0, total.output - previous.output), cacheRead: Math.max(0, total.cacheRead - previous.cacheRead), cacheCreation: 0 } : num(result.num_turns) === 1 ? total : turnUsage;
118460
118550
  previous = total;
118461
118551
  if (!Object.values(used).some((n) => n > 0)) used = void 0;
118552
+ const missing = requiredImages.length ? requiredImages.filter((file2) => !readImages.has(file2)) : [...imageErrors.keys()];
118553
+ imageFailure = missing.length ? missing.map((file2) => imageError(file2, imageErrors.get(file2) || (translating() ? "\u672C\u8F6E\u672A\u6210\u529F\u8BFB\u53D6\u6240\u9700\u56FE\u7247\u3002" : "Required image was not successfully read this turn."))).join("\n") : void 0;
118554
+ if (imageFailure) events.error(imageFailure);
118555
+ readImages.clear();
118556
+ imageErrors.clear();
118462
118557
  if (Array.isArray(result.denied_actions) && result.denied_actions.length) fail(translating() ? "Antigravity \u6743\u9650\u62D2\u7EDD\uFF0C\u8BF7\u68C0\u67E5\u6743\u9650\u89C4\u5219\u540E\u91CD\u8BD5\u3002" : "Antigravity permission denied. Check permission rules, then retry.");
118463
118558
  if (typeof result.response !== "string" || result.status !== "SUCCESS" || str(result.error) || result.finished_reason && result.finished_reason !== "completed" && result.finished_reason !== "success") {
118464
- fail(str(result.error) || `Antigravity: ${str(result.status) || "missing status"}`);
118559
+ fail(result.status === "CANCELED" ? `Antigravity: CANCELED${result.error ? `: ${str(result.error)}` : ""}` : str(result.error) || `Antigravity: ${str(result.status) || "missing status"}`);
118465
118560
  }
118466
118561
  events.end();
118467
118562
  turnUsage = zero();
118468
118563
  counted.clear();
118469
- return failure ? `
118470
- [error] ${failure}
118564
+ return failure || imageFailure ? `
118565
+ [error] ${failure || imageFailure}
118471
118566
  ` : "";
118472
118567
  }
118473
118568
  return "";
118474
118569
  });
118475
118570
  return {
118476
118571
  push: reader.push,
118572
+ setRequiredImages(files) {
118573
+ requiredImages = files.filter(imagePath).map((file2) => path29.resolve(cwd, file2));
118574
+ },
118477
118575
  flush() {
118478
118576
  const text4 = reader.flush();
118479
- if (!terminal) fail(translating() ? "Antigravity \u672A\u8FD4\u56DE\u6700\u7EC8\u7ED3\u679C\uFF0C\u8BF7\u68C0\u67E5\u65E5\u5FD7\u540E\u91CD\u8BD5\u3002" : "Antigravity returned no final result. Check the log, then retry.");
118577
+ if (!terminal) {
118578
+ incomplete = true;
118579
+ const diagnostics = [stderr.trim(), offStream?.match(/^(?:error:|rpc error:)/i) ? offStream : void 0];
118580
+ const diagnostic = diagnostics.find((text5) => text5 && manualFailure(text5)) ?? diagnostics.find((text5) => text5 && providerBlip(text5));
118581
+ if (diagnostic) fail(diagnostic);
118582
+ if (!failure) fail(translating() ? "Antigravity \u672A\u8FD4\u56DE\u6700\u7EC8\u7ED3\u679C\uFF0C\u8BF7\u68C0\u67E5\u65E5\u5FD7\u540E\u91CD\u8BD5\u3002" : "Antigravity returned no final result. Check the log, then retry.");
118583
+ }
118480
118584
  events.end();
118481
118585
  return text4;
118482
118586
  },
118483
118587
  stderr(chunk) {
118484
118588
  stderr = (stderr + chunk).slice(-16e3);
118589
+ if (limited(stderr)) fail(stderr.trim());
118485
118590
  if (/soft.denied|auto-denied|permission (?:denied|required)|denied by.*(?:policy|rule)|requires? (?:user )?(?:approval|permission)/i.test(stderr)) fail(stderr.trim());
118486
118591
  },
118487
- result: () => final,
118592
+ result: () => final || (failure ? partial || void 0 : final),
118488
118593
  resumeId: () => session,
118489
118594
  model: () => model,
118490
118595
  usage: () => used,
118491
- failure: () => failure,
118596
+ costUsd: () => cost,
118597
+ costIncomplete: () => incomplete || void 0,
118598
+ context: () => context,
118599
+ failure: () => failure || imageFailure,
118600
+ rateLimit: () => rateLimit,
118492
118601
  offStream: () => offStream,
118493
118602
  events: events.events
118494
118603
  };
118495
118604
  }
118496
118605
 
118497
118606
  // ../cli/src/lib/agent/harnesses/antigravity.ts
118607
+ var EFFORT_ID = /-(?:low|medium|high|xhigh|max)$/i;
118608
+ var EFFORT_NAME = /\s*\((?:low|medium|high|xhigh|max)\)$/i;
118498
118609
  function antigravityModels(output2) {
118499
- return output2.split("\n").flatMap((line) => {
118610
+ const seen = /* @__PURE__ */ new Set();
118611
+ const models = [];
118612
+ for (const line of output2.split("\n")) {
118500
118613
  const match = /^([^\s]+)\t(.+)$/.exec(line.trim());
118501
- return match ? [{ id: match[1], name: match[2] }] : [];
118502
- });
118614
+ if (!match) continue;
118615
+ const id = match[1].replace(EFFORT_ID, "");
118616
+ const name = match[2].replace(EFFORT_NAME, "").trim();
118617
+ if (seen.has(id)) continue;
118618
+ seen.add(id);
118619
+ models.push({ id, name });
118620
+ }
118621
+ return models;
118503
118622
  }
118504
118623
  function args(argv, resume) {
118505
118624
  if (namesFlag(argv, ["--continue", "-c", "--conversation", "--remote-agent"])) throw new Error(translating() ? "\u8BF7\u901A\u8FC7 WildCrane \u9009\u62E9 Antigravity \u4F1A\u8BDD\uFF0C\u4E0D\u8981\u5728\u989D\u5916\u53C2\u6570\u4E2D\u6307\u5B9A\u4F1A\u8BDD\u6216\u8FDC\u7A0B\u6267\u884C\u3002" : "Antigravity: select a session through WildCrane, not extra arguments.");
@@ -118526,6 +118645,22 @@ var ANTIGRAVITY = {
118526
118645
  flags: ["--model"],
118527
118646
  placeholder: "model-id",
118528
118647
  help: "A model from agy models. Empty uses the CLI default; an invalid model fails the run."
118648
+ }, {
118649
+ key: "reasoning",
118650
+ agentOwned: true,
118651
+ label: "Reasoning effort",
118652
+ kind: "select",
118653
+ choices: [
118654
+ { value: "", label: "Agent's default" },
118655
+ { value: "low", label: "Low" },
118656
+ { value: "medium", label: "Medium" },
118657
+ { value: "high", label: "High" },
118658
+ { value: "xhigh", label: "Extra high (xhigh)" },
118659
+ { value: "max", label: "Max" }
118660
+ ],
118661
+ flags: ["--effort"],
118662
+ help: "Lower is quicker and cheaper, higher is slower and more careful.",
118663
+ overriddenHelp: `Not in effect: this agent's "command" in your ui.config.json already names an effort level, and that wins.`
118529
118664
  }],
118530
118665
  models() {
118531
118666
  const copy2 = locate(ANTIGRAVITY);
@@ -118535,18 +118670,19 @@ var ANTIGRAVITY = {
118535
118670
  return result.status === 0 ? antigravityModels(result.stdout ?? "").map((m) => m.id) : [];
118536
118671
  },
118537
118672
  env: () => ({ ...process.env }),
118538
- renderer: (_cwd, _binary, argv = []) => {
118673
+ images: { as: "message" },
118674
+ renderer: (cwd, _binary, argv = []) => {
118539
118675
  const at2 = argv.indexOf("--conversation");
118540
- return createAntigravityRenderer(at2 >= 0 ? argv[at2 + 1] : argv.find((a2) => a2.startsWith("--conversation="))?.slice(15));
118676
+ return createAntigravityRenderer(at2 >= 0 ? argv[at2 + 1] : argv.find((a2) => a2.startsWith("--conversation="))?.slice(15), cwd);
118541
118677
  },
118542
118678
  systemPrompt(text4, _argv, env2) {
118543
118679
  const rule = `${text4}
118544
118680
 
118545
118681
  The task working directory is ${env2.PWD ?? process.cwd()}. Use it as the base for project files and commands. This additional workspace contains only language rules; do not write task output here.`;
118546
118682
  const hash = createHash4("sha256").update(rule).digest("hex").slice(0, 16);
118547
- const root2 = path29.join(machineHome(), "prompts", `antigravity-${hash}`);
118548
- const file2 = path29.join(root2, ".agents", "rules", "language.md");
118549
- fs28.mkdirSync(path29.dirname(file2), { recursive: true });
118683
+ const root2 = path30.join(machineHome(), "prompts", `antigravity-${hash}`);
118684
+ const file2 = path30.join(root2, ".agents", "rules", "language.md");
118685
+ fs28.mkdirSync(path30.dirname(file2), { recursive: true });
118550
118686
  fs28.writeFileSync(file2, `---
118551
118687
  trigger: always_on
118552
118688
  ---
@@ -118555,10 +118691,11 @@ ${rule}
118555
118691
  `);
118556
118692
  return { args: ["--add-dir", root2] };
118557
118693
  },
118558
- reports: ["tokens", "model"],
118694
+ transient: ({ failure }) => providerBlip(failure),
118695
+ reports: ["cost", "tokens", "model", "context"],
118559
118696
  adoptsSessionId: false,
118560
- savesSessionAtOpen: false,
118561
- stopsOnRateLimit: false,
118697
+ savesSessionAtOpen: true,
118698
+ stopsOnRateLimit: true,
118562
118699
  // `models` is read-only. Only explicit authentication errors mean signed out.
118563
118700
  login: {
118564
118701
  args: ["models"],
@@ -118649,54 +118786,7 @@ function checkHarnesses(harnesses) {
118649
118786
  }
118650
118787
 
118651
118788
  // ../cli/src/lib/agent/harnesses/claude-code.ts
118652
- import path30 from "node:path";
118653
-
118654
- // ../cli/src/lib/agent/harnesses/transient.ts
118655
- var MANUAL = [
118656
- /\b(401|403)\b/,
118657
- /unauthorized|forbidden|permission denied/,
118658
- /authenticat|invalid api key|api[_ ]key|not logged in|\/login|oauth/,
118659
- /\b429\b/,
118660
- /rate[_ ]limit|usage limit|quota|credit balance|insufficient|out of tokens/,
118661
- /cancell?ed|aborted by|interrupted by the user/,
118662
- /maximum budget|max(imum)? turns|exceeded the budget/,
118663
- /model not found|unknown model|unsupported|invalid[_ ]request/
118664
- ];
118665
- var PASSING = [
118666
- // 502/503/529 are distinctive enough to read as a status wherever they appear. A bare
118667
- // 500 is not — a failure line counting something would match it — so it is left to the
118668
- // words below, which is how that status is actually written out.
118669
- /\b(502|503|529)\b/,
118670
- /overloaded|service unavailable|bad gateway|internal server error|server_error/,
118671
- /connection (lost|dropped|reset|error|closed)|socket hang up|stream (error|disconnected)/,
118672
- /econnreset|econnrefused|etimedout|enetunreach|enotfound|eai_again/,
118673
- /fetch failed|request timed out|network error/
118674
- ];
118675
- var RETRY_AFTER = /retry[-_\s]?after["':=\s]+(\d+)/i;
118676
- var REASON_MAX = 140;
118677
- function reasonLine(text4, rule) {
118678
- const line = text4.split("\n").find((l2) => rule.test(l2.toLowerCase())) ?? text4;
118679
- const said = line.trim().replace(/\s+/g, " ");
118680
- return said.length > REASON_MAX ? `${said.slice(0, REASON_MAX - 1)}\u2026` : said;
118681
- }
118682
- function providerBlip(...said) {
118683
- for (const text4 of said) {
118684
- if (!text4?.trim()) continue;
118685
- const lower = text4.toLowerCase();
118686
- if (MANUAL.some((rule) => rule.test(lower))) return void 0;
118687
- const hit = PASSING.find((rule) => rule.test(lower));
118688
- if (!hit) continue;
118689
- const asked = RETRY_AFTER.exec(text4);
118690
- const seconds = asked ? Number(asked[1]) : NaN;
118691
- return {
118692
- reason: reasonLine(text4, hit),
118693
- ...Number.isFinite(seconds) && seconds > 0 ? { retryAfterMs: seconds * 1e3 } : {}
118694
- };
118695
- }
118696
- return void 0;
118697
- }
118698
-
118699
- // ../cli/src/lib/agent/harnesses/claude-code.ts
118789
+ import path31 from "node:path";
118700
118790
  var cliSaid = (said) => /^\s*API Error\b/i.test(said ?? "") ? said : void 0;
118701
118791
  var MODEL_ALIASES = ["opus", "sonnet", "haiku", "fable"];
118702
118792
  function claudeStreamArgs(argv) {
@@ -118708,15 +118798,15 @@ var userMessage = (prompt) => `${JSON.stringify({ type: "user", message: { role:
118708
118798
  `;
118709
118799
  function claudeOnWindows() {
118710
118800
  const [local, roaming] = [process.env.LOCALAPPDATA?.trim(), process.env.APPDATA?.trim()];
118711
- const packages = local ? path30.join(local, "Packages") : "";
118801
+ const packages = local ? path31.join(local, "Packages") : "";
118712
118802
  const data = [
118713
- ...folders(packages).filter((name) => /^(\w+\.)?Claude_/i.test(name)).sort().map((name) => path30.join(packages, name, "LocalCache", "Roaming", "Claude")),
118714
- ...roaming ? [path30.join(roaming, "Claude")] : []
118803
+ ...folders(packages).filter((name) => /^(\w+\.)?Claude_/i.test(name)).sort().map((name) => path31.join(packages, name, "LocalCache", "Roaming", "Claude")),
118804
+ ...roaming ? [path31.join(roaming, "Claude")] : []
118715
118805
  ];
118716
118806
  return data.flatMap(
118717
- (dir) => latestIn(path30.join(dir, "claude-code")).flatMap((version) => [
118718
- path30.join(version, "claude.exe"),
118719
- ...folders(version).map((build) => path30.join(version, build, "claude.exe"))
118807
+ (dir) => latestIn(path31.join(dir, "claude-code")).flatMap((version) => [
118808
+ path31.join(version, "claude.exe"),
118809
+ ...folders(version).map((build) => path31.join(version, build, "claude.exe"))
118720
118810
  ])
118721
118811
  );
118722
118812
  }
@@ -118972,7 +119062,7 @@ var CLAUDE_CODE = {
118972
119062
  ...latestIn(home2(".local", "share", "claude", "versions")),
118973
119063
  // The copy Claude Desktop carries.
118974
119064
  ...process.platform === "win32" ? claudeOnWindows() : latestIn(home2("Library", "Application Support", "Claude", "claude-code")).flatMap(
118975
- (version) => folders(version).map((build) => path30.join(version, build, "claude.app", "Contents", "MacOS", "claude"))
119065
+ (version) => folders(version).map((build) => path31.join(version, build, "claude.app", "Contents", "MacOS", "claude"))
118976
119066
  )
118977
119067
  ],
118978
119068
  install: "npm install -g @anthropic-ai/claude-code"
@@ -118980,7 +119070,7 @@ var CLAUDE_CODE = {
118980
119070
 
118981
119071
  // ../cli/src/lib/agent/harnesses/codex.ts
118982
119072
  import fs29 from "node:fs";
118983
- import path31 from "node:path";
119073
+ import path32 from "node:path";
118984
119074
 
118985
119075
  // ../cli/src/lib/agent/worktree.ts
118986
119076
  import { spawnSync as spawnSync6 } from "node:child_process";
@@ -119027,10 +119117,10 @@ function codexExtraArgs(argv, cwd = REPO_ROOT) {
119027
119117
  }
119028
119118
  const flags = [...argv, ...extra];
119029
119119
  const workspaceWrite = flags.some((arg, i) => arg === "--full-auto" || arg === "--sandbox=workspace-write" || (arg === "--sandbox" || arg === "-s") && flags[i + 1] === "workspace-write");
119030
- if (workspaceWrite && path31.resolve(cwd) !== path31.resolve(REPO_ROOT)) {
119120
+ if (workspaceWrite && path32.resolve(cwd) !== path32.resolve(REPO_ROOT)) {
119031
119121
  for (const dir of [KANBAN, AKB_DIR]) {
119032
- const relative = path31.relative(cwd, dir);
119033
- if (relative === ".." || relative.startsWith(`..${path31.sep}`) || path31.isAbsolute(relative)) {
119122
+ const relative = path32.relative(cwd, dir);
119123
+ if (relative === ".." || relative.startsWith(`..${path32.sep}`) || path32.isAbsolute(relative)) {
119034
119124
  extra.push("--add-dir", dir);
119035
119125
  }
119036
119126
  }
@@ -119079,28 +119169,28 @@ function codexOnWindows() {
119079
119169
  const local = envRoot("LOCALAPPDATA");
119080
119170
  const profile = envRoot("USERPROFILE");
119081
119171
  const programs = envRoot("ProgramFiles");
119082
- const cache = local ? path31.join(local, "OpenAI", "Codex", "bin") : "";
119083
- const releases = profile ? path31.join(profile, ".codex", "packages", "standalone", "releases") : "";
119084
- const packages = programs ? path31.join(programs, "WindowsApps") : "";
119172
+ const cache = local ? path32.join(local, "OpenAI", "Codex", "bin") : "";
119173
+ const releases = profile ? path32.join(profile, ".codex", "packages", "standalone", "releases") : "";
119174
+ const packages = programs ? path32.join(programs, "WindowsApps") : "";
119085
119175
  return [
119086
119176
  // Desktop's relocated CLI cache: a folder per build hash, newest file first.
119087
- ...byNewest(folders(cache).map((name) => path31.join(cache, name, "codex.exe"))),
119177
+ ...byNewest(folders(cache).map((name) => path32.join(cache, name, "codex.exe"))),
119088
119178
  // The separate standalone launcher, at a path with nothing variable in it.
119089
- ...local ? [path31.join(local, "Programs", "OpenAI", "Codex", "bin", "codex.exe")] : [],
119179
+ ...local ? [path32.join(local, "Programs", "OpenAI", "Codex", "bin", "codex.exe")] : [],
119090
119180
  // That launcher's release payload: a folder per version and target.
119091
119181
  ...byVersion(folders(releases).filter(ourArch)).map(
119092
- (name) => path31.join(releases, name, "bin", "codex.exe")
119182
+ (name) => path32.join(releases, name, "bin", "codex.exe")
119093
119183
  ),
119094
119184
  // Desktop's own MSIX package.
119095
119185
  ...byVersion(folders(packages).filter((name) => name.startsWith("OpenAI.Codex_")).filter(ourArch)).map(
119096
- (name) => path31.join(packages, name, "app", "resources", "codex.exe")
119186
+ (name) => path32.join(packages, name, "app", "resources", "codex.exe")
119097
119187
  )
119098
119188
  ];
119099
119189
  }
119100
119190
  function codexInstalls() {
119101
119191
  const chosen = process.env.CODEX_INSTALL_DIR?.trim();
119102
119192
  return [
119103
- ...chosen ? [path31.join(chosen, "codex")] : [],
119193
+ ...chosen ? [path32.join(chosen, "codex")] : [],
119104
119194
  ...process.platform === "win32" ? codexOnWindows() : [
119105
119195
  // macOS, where Codex now lives in the merged app — `codex-cli/bin/` since 26.928…
119106
119196
  "/Applications/ChatGPT.app/Contents/Resources/codex-cli/bin/codex",
@@ -119146,7 +119236,7 @@ var CODEX = {
119146
119236
  systemPrompt(text4, argv) {
119147
119237
  if (namesFlag(argv, ["developer_instructions", "model_instructions_file"])) return {};
119148
119238
  try {
119149
- const config = fs29.readFileSync(path31.join(process.env.CODEX_HOME || home2(".codex"), "config.toml"), "utf8");
119239
+ const config = fs29.readFileSync(path32.join(process.env.CODEX_HOME || home2(".codex"), "config.toml"), "utf8");
119150
119240
  if (/^\s*(?:developer_instructions|model_instructions_file)\s*=/m.test(config)) return {};
119151
119241
  } catch {
119152
119242
  }
@@ -119388,23 +119478,23 @@ var CURSOR = {
119388
119478
 
119389
119479
  // ../cli/src/lib/agent/harnesses/dsh.ts
119390
119480
  import fs30 from "node:fs";
119391
- import path32 from "node:path";
119481
+ import path33 from "node:path";
119392
119482
  function dshHome(argv) {
119393
119483
  const binary = argv[0];
119394
119484
  if (!binary) return void 0;
119395
- const names2 = process.platform === "win32" && !path32.extname(binary) ? [".exe", ".cmd"].map((ext) => binary + ext) : [binary];
119396
- const candidates = binary.includes("/") || binary.includes("\\") ? names2 : (process.env.PATH ?? "").split(path32.delimiter).filter(Boolean).flatMap((dir2) => names2.map((name) => path32.join(dir2, name)));
119485
+ const names2 = process.platform === "win32" && !path33.extname(binary) ? [".exe", ".cmd"].map((ext) => binary + ext) : [binary];
119486
+ const candidates = binary.includes("/") || binary.includes("\\") ? names2 : (process.env.PATH ?? "").split(path33.delimiter).filter(Boolean).flatMap((dir2) => names2.map((name) => path33.join(dir2, name)));
119397
119487
  let dir;
119398
119488
  try {
119399
119489
  const found = candidates.find((candidate) => fs30.existsSync(candidate));
119400
119490
  if (!found) return void 0;
119401
119491
  const script = /\.cmd$/i.test(found) ? shimTarget(fs30.readFileSync(found, "utf8"), found)?.script : void 0;
119402
- dir = path32.dirname(fs30.realpathSync(script ?? found));
119492
+ dir = path33.dirname(fs30.realpathSync(script ?? found));
119403
119493
  } catch {
119404
119494
  return void 0;
119405
119495
  }
119406
- for (let up = path32.dirname(dir); dir !== up; up = path32.dirname(dir)) {
119407
- if (fs30.existsSync(path32.join(dir, "package.json"))) return dir;
119496
+ for (let up = path33.dirname(dir); dir !== up; up = path33.dirname(dir)) {
119497
+ if (fs30.existsSync(path33.join(dir, "package.json"))) return dir;
119408
119498
  dir = up;
119409
119499
  }
119410
119500
  return void 0;
@@ -119992,7 +120082,7 @@ var DEFAULT_HARNESS = HARNESSES[0];
119992
120082
  checkHarnesses(HARNESSES);
119993
120083
 
119994
120084
  // ../cli/src/lib/agent/run-settings.ts
119995
- import path33 from "node:path";
120085
+ import path34 from "node:path";
119996
120086
 
119997
120087
  // ../cli/src/lib/agent/providers.ts
119998
120088
  function providerSetting(settings) {
@@ -120095,7 +120185,7 @@ function languageEnv(given) {
120095
120185
  try {
120096
120186
  const config = JSON.parse(env2.OPENCODE_CONFIG_CONTENT ?? "{}");
120097
120187
  if (Array.isArray(config.instructions)) {
120098
- config.instructions = config.instructions.filter((file2) => typeof file2 !== "string" || path33.dirname(file2) !== path33.join(machineHome(), "prompts") || !/^opencode-language(?:-[a-f0-9]{16})?\.md$/.test(path33.basename(file2)));
120188
+ config.instructions = config.instructions.filter((file2) => typeof file2 !== "string" || path34.dirname(file2) !== path34.join(machineHome(), "prompts") || !/^opencode-language(?:-[a-f0-9]{16})?\.md$/.test(path34.basename(file2)));
120099
120189
  env2.OPENCODE_CONFIG_CONTENT = JSON.stringify(config);
120100
120190
  }
120101
120191
  } catch {
@@ -120111,14 +120201,81 @@ function withSystemLanguage(harness, argv, env2, language) {
120111
120201
  const note = language === "zh" ? "\u8BED\u8A00\u89C4\u5219\u672A\u80FD\u66F4\u65B0\uFF1A\u8FDE\u63A5\u5668\u3001\u5DF2\u6709\u4F1A\u8BDD\u6216\u81EA\u8BBE\u7CFB\u7EDF\u63D0\u793A\u8BCD\u4E0D\u652F\u6301\u6CE8\u5165\u3002\u8BF7\u81EA\u884C\u53E6\u5F00\u652F\u6301\u7684\u4F1A\u8BDD\u4EE5\u91C7\u7528\u65B0\u89C4\u5219\u3002" : "Language rules could not be updated: the connector, existing session, or custom system prompt prevents injection. Open a supported new session to apply them.";
120112
120202
  return { argv, env: env2, note };
120113
120203
  }
120114
- const at2 = /^node(?:\.exe)?$/.test(path33.basename(argv[0])) && argv[1] && !argv[1].startsWith("-") ? 2 : 1;
120204
+ const at2 = /^node(?:\.exe)?$/.test(path34.basename(argv[0])) && argv[1] && !argv[1].startsWith("-") ? 2 : 1;
120115
120205
  return { argv: [...argv.slice(0, at2), ...added?.args ?? [], ...argv.slice(at2)], env: { ...env2, ...added?.env } };
120116
120206
  }
120117
120207
 
120208
+ // src/model-list.ts
120209
+ var MODEL_REFRESH_MS = 3e4;
120210
+ var MODEL_TIMEOUT_MS = 15e3;
120211
+ var ModelLists = class {
120212
+ constructor(sources3, interval = MODEL_REFRESH_MS, timeout = MODEL_TIMEOUT_MS) {
120213
+ this.sources = sources3;
120214
+ this.interval = interval;
120215
+ this.timeout = timeout;
120216
+ }
120217
+ sources;
120218
+ interval;
120219
+ timeout;
120220
+ listeners = /* @__PURE__ */ new Set();
120221
+ subscribe(listener) {
120222
+ this.listeners.add(listener);
120223
+ return () => {
120224
+ this.listeners.delete(listener);
120225
+ };
120226
+ }
120227
+ entries = /* @__PURE__ */ new Map();
120228
+ async read(key, previous = [], wait3 = false) {
120229
+ const source2 = this.sources[key];
120230
+ if (!source2) return previous;
120231
+ let entry = this.entries.get(key);
120232
+ if (!entry) {
120233
+ entry = { models: normalizeModels(previous), next: 0 };
120234
+ this.entries.set(key, entry);
120235
+ }
120236
+ if (!entry.models.length && previous.length) entry.models = normalizeModels(previous);
120237
+ if (!entry.pending && Date.now() >= entry.next) {
120238
+ const held5 = entry;
120239
+ const controller = new AbortController();
120240
+ held5.next = Date.now() + this.interval;
120241
+ let changed = false;
120242
+ held5.pending = new Promise((resolve2) => {
120243
+ let done = false;
120244
+ const finish2 = (models) => {
120245
+ if (done) return;
120246
+ done = true;
120247
+ clearTimeout(timer);
120248
+ controller.abort();
120249
+ const found = normalizeModels(models);
120250
+ if (found.length) {
120251
+ changed = JSON.stringify(found) !== JSON.stringify(held5.models);
120252
+ held5.models = found;
120253
+ }
120254
+ resolve2(held5.models);
120255
+ };
120256
+ const timer = setTimeout(() => finish2([]), this.timeout);
120257
+ Promise.resolve().then(() => source2(controller.signal)).then(finish2, () => finish2([]));
120258
+ }).finally(() => {
120259
+ held5.pending = void 0;
120260
+ if (changed) for (const listener of this.listeners) listener();
120261
+ });
120262
+ }
120263
+ return wait3 && entry.pending ? entry.pending : entry.models;
120264
+ }
120265
+ };
120266
+ function normalizeModels(models) {
120267
+ const seen = /* @__PURE__ */ new Set();
120268
+ return models.flatMap((model) => {
120269
+ const id = model.id.trim();
120270
+ if (!id || seen.has(id)) return [];
120271
+ seen.add(id);
120272
+ return [{ id, name: model.name.trim() || id }];
120273
+ });
120274
+ }
120275
+
120118
120276
  // src/runtimes.ts
120119
120277
  var HARNESSES2 = Object.fromEntries(RUNTIMES.map((name) => [name, HARNESSES.find((h3) => h3.name === name)]));
120120
120278
  var LOGIN_PROBE_MS = 5e3;
120121
- var MODELS_MS = 3e4;
120122
120279
  var LABELS = Object.fromEntries(RUNTIMES.map((name) => [name, HARNESSES2[name].label]));
120123
120280
  var settingKeys = (runtime) => HARNESSES2[runtime].settings.map((s) => s.key);
120124
120281
  var secretKeys = (runtime) => HARNESSES2[runtime].settings.filter((s) => s.kind === "secret").map((s) => s.key);
@@ -120215,33 +120372,30 @@ async function detectRuntimes(quick = false, only) {
120215
120372
  const copy2 = locate(harness);
120216
120373
  if (!copy2) return { name, installed: false, settings };
120217
120374
  const loggedIn = harness.login ? await probeLogin(spawnName(copy2, splitCommand(harness.command)[0]), harness) : void 0;
120218
- const models = loggedIn === false || quick && SLOW.has(name) ? [] : await readModels(name);
120375
+ const models = await modelLists.read(name, name === "claude-code" ? CLAUDE_DEFAULTS : [], !quick);
120219
120376
  return { name, installed: true, ...copy2.version ? { version: copy2.version } : {}, ...loggedIn === void 0 ? {} : { loggedIn }, ...models.length ? { models } : {}, settings };
120220
120377
  })
120221
120378
  );
120222
120379
  }
120223
- var SLOW = /* @__PURE__ */ new Set(["opencode", "cursor", "antigravity"]);
120224
- var listed = (harness) => async () => (harness.models?.() ?? []).map((id) => ({ id, name: id }));
120225
- var readModels = (name) => (MODELS[name] ?? listed(HARNESSES2[name]))().catch(() => []);
120226
- var MODELS = {
120227
- "claude-code": async () => {
120228
- const cached2 = claudeModels(path34.join(process.env.CLAUDE_CONFIG_DIR || path34.join(os5.homedir(), ".claude"), "cache", "model-catalog"));
120229
- return cached2.length ? cached2 : [
120230
- { id: "opus", name: "Opus" },
120231
- { id: "sonnet", name: "Sonnet" },
120232
- { id: "haiku", name: "Haiku" }
120233
- ];
120234
- },
120235
- codex: async () => codexModels(path34.join(process.env.CODEX_HOME || path34.join(os5.homedir(), ".codex"), "models_cache.json")),
120236
- opencode: async () => opencodeModels(await output(commandOf(HARNESSES2.opencode)[0], ["models"])),
120237
- cursor: () => cursorModels(),
120238
- antigravity: async () => antigravityModels(await output(commandOf(HARNESSES2.antigravity)[0], ["models"]))
120239
- };
120380
+ var CLAUDE_DEFAULTS = ["opus", "sonnet", "haiku"].map((id) => ({ id, name: id[0].toUpperCase() + id.slice(1) }));
120381
+ var sources2 = Object.fromEntries(
120382
+ Object.entries(HARNESSES2).filter(([, harness]) => harness.models).map(([name, harness]) => [
120383
+ name,
120384
+ () => (harness.models?.() ?? []).map((id) => ({ id, name: id }))
120385
+ ])
120386
+ );
120387
+ Object.assign(sources2, {
120388
+ "claude-code": () => claudeModels(path35.join(process.env.CLAUDE_CONFIG_DIR || path35.join(os5.homedir(), ".claude"), "cache", "model-catalog")),
120389
+ codex: () => codexModels(path35.join(process.env.CODEX_HOME || path35.join(os5.homedir(), ".codex"), "models_cache.json")),
120390
+ opencode: async (signal2) => opencodeModels(await output(commandOf(HARNESSES2.opencode)[0], ["models"], signal2)),
120391
+ cursor: (signal2) => cursorModels(signal2),
120392
+ antigravity: async (signal2) => antigravityModels(await output(commandOf(HARNESSES2.antigravity)[0], ["models"], signal2))
120393
+ });
120394
+ var modelLists = new ModelLists(sources2);
120240
120395
  function opencodeModels(out) {
120241
120396
  return out.split("\n").map((l2) => l2.trim()).filter((l2) => /^\S+\/\S+$/.test(l2)).map((id) => ({ id, name: id }));
120242
120397
  }
120243
- function cursorModels() {
120244
- const argv = commandOf(HARNESSES2.cursor);
120398
+ function cursorModels(signal2, argv = commandOf(HARNESSES2.cursor)) {
120245
120399
  return new Promise((resolve2) => {
120246
120400
  let child;
120247
120401
  try {
@@ -120250,13 +120404,19 @@ function cursorModels() {
120250
120404
  } catch {
120251
120405
  return resolve2([]);
120252
120406
  }
120407
+ let finished = false;
120253
120408
  const done = (models) => {
120254
- clearTimeout(timer);
120409
+ if (finished) return;
120410
+ finished = true;
120411
+ signal2.removeEventListener("abort", aborted);
120255
120412
  child.kill();
120256
120413
  resolve2(models);
120257
120414
  };
120258
- const timer = setTimeout(() => done([]), MODELS_MS);
120415
+ const aborted = () => done([]);
120416
+ signal2.addEventListener("abort", aborted, { once: true });
120417
+ if (signal2.aborted) return done([]);
120259
120418
  child.on("error", () => done([]));
120419
+ child.on("close", () => done([]));
120260
120420
  const rpc = connect(child.stdout, child.stdin, (msg) => msg.id !== void 0 && rpc.refuse(msg.id, "no"), { jsonrpc: true });
120261
120421
  rpc.call("initialize", { protocolVersion: 1, clientCapabilities: { fs: { readTextFile: false, writeTextFile: false }, terminal: false } }).then(() => rpc.call("session/new", { cwd: os5.tmpdir(), mcpServers: [] })).then((opened) => done(acpModels(opened))).catch(() => done([]));
120262
120422
  });
@@ -120268,7 +120428,7 @@ function acpModels(opened) {
120268
120428
  return id && id !== "default[]" ? [{ id, name: str(m.name) || id }] : [];
120269
120429
  });
120270
120430
  }
120271
- function output(command, args2) {
120431
+ function output(command, args2, signal2) {
120272
120432
  return new Promise((resolve2) => {
120273
120433
  let out = "";
120274
120434
  let child;
@@ -120278,16 +120438,20 @@ function output(command, args2) {
120278
120438
  } catch {
120279
120439
  return resolve2("");
120280
120440
  }
120281
- const timer = setTimeout(() => {
120441
+ let finished = false;
120442
+ const done = (value) => {
120443
+ if (finished) return;
120444
+ finished = true;
120445
+ signal2.removeEventListener("abort", aborted);
120282
120446
  child.kill();
120283
- resolve2("");
120284
- }, MODELS_MS);
120447
+ resolve2(value);
120448
+ };
120449
+ const aborted = () => done("");
120450
+ signal2.addEventListener("abort", aborted, { once: true });
120451
+ if (signal2.aborted) return done("");
120285
120452
  child.stdout?.on("data", (d2) => out += d2);
120286
- child.on("error", () => resolve2(""));
120287
- child.on("close", (code) => {
120288
- clearTimeout(timer);
120289
- resolve2(code === 0 ? out : "");
120290
- });
120453
+ child.on("error", () => done(""));
120454
+ child.on("close", (code) => done(code === 0 ? out : ""));
120291
120455
  });
120292
120456
  }
120293
120457
  function codexModels(file2) {
@@ -120310,7 +120474,7 @@ function claudeModels(dir) {
120310
120474
  }
120311
120475
  const catalogs = files.flatMap((f2) => {
120312
120476
  try {
120313
- const data = obj(JSON.parse(fs31.readFileSync(path34.join(dir, f2), "utf8")));
120477
+ const data = obj(JSON.parse(fs31.readFileSync(path35.join(dir, f2), "utf8")));
120314
120478
  const catalog = obj(data.catalog);
120315
120479
  const surface = str(catalog.surface);
120316
120480
  return surface === "cc" || surface === "ccd" ? [{ surface, at: Number(data.fetchedAt) || 0, config: obj(catalog.config) }] : [];
@@ -120357,7 +120521,7 @@ function probeLogin(binary, harness) {
120357
120521
 
120358
120522
  // src/triage.ts
120359
120523
  import fs32 from "node:fs";
120360
- import path35 from "node:path";
120524
+ import path36 from "node:path";
120361
120525
 
120362
120526
  // ../cli/src/lib/signals/identity.ts
120363
120527
  import { createHash as createHash5 } from "node:crypto";
@@ -120371,8 +120535,8 @@ function slugify(s) {
120371
120535
  }
120372
120536
 
120373
120537
  // src/triage.ts
120374
- var triageDir = (board) => path35.join(board, "triage");
120375
- var rejectedDir = (board) => path35.join(board, ".archive", REJECTIONS_TO_REVIEW);
120538
+ var triageDir = (board) => path36.join(board, "triage");
120539
+ var rejectedDir = (board) => path36.join(board, ".archive", REJECTIONS_TO_REVIEW);
120376
120540
  var SCRATCH = ["dismissed", "archived"];
120377
120541
  var stamp2 = (at2) => formatStamp(at2 ? new Date(at2) : /* @__PURE__ */ new Date());
120378
120542
  function slugOf(title) {
@@ -120381,7 +120545,7 @@ function slugOf(title) {
120381
120545
  function freeName(dir, title) {
120382
120546
  const stem = slugOf(title);
120383
120547
  let name = `${stem}.md`;
120384
- for (let n = 2; fs32.existsSync(path35.join(dir, name)); n++) name = `${stem}-${n}.md`;
120548
+ for (let n = 2; fs32.existsSync(path36.join(dir, name)); n++) name = `${stem}-${n}.md`;
120385
120549
  return name;
120386
120550
  }
120387
120551
  function itemText(item, fields = {}) {
@@ -120403,7 +120567,7 @@ ${item.text.trim()}
120403
120567
  function writeItem(dir, item, fields = {}) {
120404
120568
  fs32.mkdirSync(dir, { recursive: true });
120405
120569
  const name = freeName(dir, item.title);
120406
- fs32.writeFileSync(path35.join(dir, name), itemText(item, item.studio ? { studio: studioName(item.studio), ...fields } : fields));
120570
+ fs32.writeFileSync(path36.join(dir, name), itemText(item, item.studio ? { studio: studioName(item.studio), ...fields } : fields));
120407
120571
  return name;
120408
120572
  }
120409
120573
  function layOut(board, rejections) {
@@ -120411,7 +120575,7 @@ function layOut(board, rejections) {
120411
120575
  const dir = rejectedDir(board);
120412
120576
  fs32.mkdirSync(dir, { recursive: true });
120413
120577
  for (const t of rejections.tasks) {
120414
- fs32.writeFileSync(path35.join(dir, `${t.number}-${slugify(t.title)}.md`), [
120578
+ fs32.writeFileSync(path36.join(dir, `${t.number}-${slugify(t.title)}.md`), [
120415
120579
  "---",
120416
120580
  `title: ${yamlScalar(t.title)}`,
120417
120581
  "status: todo",
@@ -120426,7 +120590,7 @@ function layOut(board, rejections) {
120426
120590
  ].join("\n"));
120427
120591
  }
120428
120592
  for (const item of rejections.triage) {
120429
- const sub = path35.join(triageDir(board), item.state === "dismissed" ? "dismissed" : "archived");
120593
+ const sub = path36.join(triageDir(board), item.state === "dismissed" ? "dismissed" : "archived");
120430
120594
  const fields = item.state === "dismissed" ? { dismissed_at: stamp2(item.dismissed_at), dismissed_by: "user", ...item.dismissed_reason ? { dismissed_reason: item.dismissed_reason } : {} } : {};
120431
120595
  writeItem(sub, item, fields);
120432
120596
  }
@@ -120434,13 +120598,13 @@ function layOut(board, rejections) {
120434
120598
  }
120435
120599
  function clearLaid(board) {
120436
120600
  fs32.rmSync(rejectedDir(board), { recursive: true, force: true });
120437
- for (const sub of SCRATCH) fs32.rmSync(path35.join(triageDir(board), sub), { recursive: true, force: true });
120601
+ for (const sub of SCRATCH) fs32.rmSync(path36.join(triageDir(board), sub), { recursive: true, force: true });
120438
120602
  }
120439
120603
 
120440
120604
  // ../cli/src/lib/skill/hook.ts
120441
120605
  import { spawnSync as spawnSync7 } from "node:child_process";
120442
120606
  import fs33 from "node:fs";
120443
- import path36 from "node:path";
120607
+ import path37 from "node:path";
120444
120608
  var MARKER_LINE = /^# ai4kanban commit guard\b/m;
120445
120609
  var read2 = (file2) => {
120446
120610
  try {
@@ -120456,12 +120620,12 @@ function hooksDir(root2) {
120456
120620
  windowsHide: true
120457
120621
  });
120458
120622
  if (out.error || out.status !== 0 || !out.stdout.trim()) return null;
120459
- return path36.resolve(root2, out.stdout.trim());
120623
+ return path37.resolve(root2, out.stdout.trim());
120460
120624
  }
120461
120625
  function installCommitHook(root2, _board) {
120462
120626
  const dir = hooksDir(root2);
120463
120627
  if (!dir) return {};
120464
- const file2 = path36.join(dir, "pre-commit");
120628
+ const file2 = path37.join(dir, "pre-commit");
120465
120629
  if (fs33.lstatSync(file2, { throwIfNoEntry: false })?.isSymbolicLink()) return {};
120466
120630
  const source2 = read2(file2);
120467
120631
  if (source2 && MARKER_LINE.test(source2)) fs33.unlinkSync(file2);
@@ -120516,7 +120680,7 @@ function asks(file2) {
120516
120680
  }
120517
120681
  function mcpConfig(servers, file2) {
120518
120682
  if (!Object.keys(servers).length) return null;
120519
- fs34.mkdirSync(path37.dirname(file2), { recursive: true });
120683
+ fs34.mkdirSync(path38.dirname(file2), { recursive: true });
120520
120684
  fs34.writeFileSync(file2, `${JSON.stringify({ mcpServers: servers }, null, 2)}
120521
120685
  `);
120522
120686
  return file2;
@@ -120551,7 +120715,7 @@ function deliveryEnding(ws, id, asked = false) {
120551
120715
  if (!id) return null;
120552
120716
  let held5;
120553
120717
  try {
120554
- held5 = JSON.parse(fs34.readFileSync(path37.join(ws.board, "deliveries", `${path37.basename(id)}.json`), "utf8"));
120718
+ held5 = JSON.parse(fs34.readFileSync(path38.join(ws.board, "deliveries", `${path38.basename(id)}.json`), "utf8"));
120555
120719
  } catch {
120556
120720
  return null;
120557
120721
  }
@@ -120563,7 +120727,7 @@ function deliveryEnding(ws, id, asked = false) {
120563
120727
  return null;
120564
120728
  }
120565
120729
  function checkoutsOf(ws, id) {
120566
- const dir = path37.join(ws.board, "deliveries");
120730
+ const dir = path38.join(ws.board, "deliveries");
120567
120731
  let names2;
120568
120732
  try {
120569
120733
  names2 = fs34.readdirSync(dir).filter((n) => n.endsWith(".json"));
@@ -120572,7 +120736,7 @@ function checkoutsOf(ws, id) {
120572
120736
  }
120573
120737
  return names2.flatMap((n) => {
120574
120738
  try {
120575
- const held5 = JSON.parse(fs34.readFileSync(path37.join(dir, n), "utf8"));
120739
+ const held5 = JSON.parse(fs34.readFileSync(path38.join(dir, n), "utf8"));
120576
120740
  return held5.cardId === id && held5.deliveryId ? [held5.deliveryId] : [];
120577
120741
  } catch {
120578
120742
  return [];
@@ -120586,7 +120750,7 @@ var RESUME_REFUSED = {
120586
120750
  deliveryRunGoing: "\u4E0A\u6B21\u7684\u8FD0\u884C\u8FD8\u6CA1\u505C\u4E0B\uFF0C\u8BF7\u7A0D\u540E\u518D\u70B9\u300C\u7EED\u8DD1\u300D\u3002",
120587
120751
  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"
120588
120752
  };
120589
- var isArchived = (ws, id) => path37.relative(ws.board, findCard(ws.board, id) ?? ws.board).split(path37.sep)[0] === ".archive";
120753
+ var isArchived = (ws, id) => path38.relative(ws.board, findCard(ws.board, id) ?? ws.board).split(path38.sep)[0] === ".archive";
120590
120754
  var refusal2 = (ran) => ran.last.replace(/^akb( raw)?: /, "").slice(0, 300) || "akb stopped with an error.";
120591
120755
  var reasonOf = (text4) => (text4 ?? "").split("\n").map((l2) => l2.trim()).filter((l2) => l2 && !/^at\s/.test(l2)).join("\n").slice(0, 300) || void 0;
120592
120756
  function logLines(show, event2) {
@@ -120656,7 +120820,7 @@ async function setUp(job, ws, deps, io) {
120656
120820
  const runtime = job.runtime;
120657
120821
  const missing = unavailable(runtime, await deps.runtimes());
120658
120822
  if (missing) return missing;
120659
- if (!fs34.existsSync(path37.join(ws.board, "config.md"))) {
120823
+ if (!fs34.existsSync(path38.join(ws.board, "config.md"))) {
120660
120824
  const init = await akb(["raw", "init"]);
120661
120825
  if (init.code !== 0) return refusal2(init);
120662
120826
  }
@@ -120669,7 +120833,7 @@ async function setUp(job, ws, deps, io) {
120669
120833
  const used = await akb(["raw", "agent", "use", runtime]);
120670
120834
  if (used.code !== 0) return refusal2(used);
120671
120835
  const servers = mcpServersOf(ws);
120672
- const mcpFile = path37.join(ws.board, ".sync", `${ws.task}.mcp.json`);
120836
+ const mcpFile = path38.join(ws.board, ".sync", `${ws.task}.mcp.json`);
120673
120837
  const takes = new Set(settingKeys(runtime));
120674
120838
  const given = job.settings ?? {};
120675
120839
  const values = valuesOf(runtime, job.model, given, servers, mcpFile);
@@ -120792,7 +120956,7 @@ async function runAgent(job, ws, deps, io) {
120792
120956
  }
120793
120957
  function writeTranscript(job, dir) {
120794
120958
  if (!job.transcript) return "";
120795
- const file2 = path37.join(dir, "discussion.md");
120959
+ const file2 = path38.join(dir, "discussion.md");
120796
120960
  fs34.mkdirSync(dir, { recursive: true });
120797
120961
  fs34.writeFileSync(file2, `${job.transcript}
120798
120962
  `);
@@ -120803,8 +120967,8 @@ function pictures(job, ws, id) {
120803
120967
  if (!job.attachments.length || !dir) return "";
120804
120968
  fs34.mkdirSync(dir, { recursive: true });
120805
120969
  return job.attachments.map((a2, i) => {
120806
- const file2 = `${i + 1}-${path37.basename(a2.name).replace(/[^\w.-]+/g, "-")}`;
120807
- fs34.writeFileSync(path37.join(dir, file2), Buffer.from(a2.content, "base64"));
120970
+ const file2 = `${i + 1}-${path38.basename(a2.name).replace(/[^\w.-]+/g, "-")}`;
120971
+ fs34.writeFileSync(path38.join(dir, file2), Buffer.from(a2.content, "base64"));
120808
120972
  return `
120809
120973
  <Asset src=".assets/${id}/${file2}" label="${a2.name.replace(/["<>]/g, "") || file2}" />
120810
120974
  `;
@@ -120812,7 +120976,7 @@ function pictures(job, ws, id) {
120812
120976
  }
120813
120977
  function cardFlags(ws, fields) {
120814
120978
  if (!fields) return [];
120815
- const open = (keys) => (keys ?? []).map((k2) => Number(/(\d+)$/.exec(k2)?.[1])).filter((n) => n > 0 && n !== ws.number && findCard(ws.board, n)?.startsWith(path37.join(ws.board, "todo") + path37.sep));
120979
+ const open = (keys) => (keys ?? []).map((k2) => Number(/(\d+)$/.exec(k2)?.[1])).filter((n) => n > 0 && n !== ws.number && findCard(ws.board, n)?.startsWith(path38.join(ws.board, "todo") + path38.sep));
120816
120980
  const lists = [["--modules", fields.modules ?? []], ["--related", open(fields.related)], ["--blocked-by", open(fields.blocked_by)]];
120817
120981
  return [
120818
120982
  ...fields.priority ? ["--priority", fields.priority] : [],
@@ -120843,8 +121007,8 @@ async function runFlow(job, ws, deps, io) {
120843
121007
  said = { title: task.value.title?.trim() ?? "", request: task.value.request?.trim() ?? "" };
120844
121008
  }
120845
121009
  const title = said.title || "Untitled";
120846
- const body = path37.join(ws.board, ".sync", `${ws.task}.request.md`);
120847
- fs34.mkdirSync(path37.dirname(body), { recursive: true });
121010
+ const body = path38.join(ws.board, ".sync", `${ws.task}.request.md`);
121011
+ fs34.mkdirSync(path38.dirname(body), { recursive: true });
120848
121012
  if (!ws.number) return fail("This task has no number yet.");
120849
121013
  fs34.writeFileSync(body, `${said.request || title}
120850
121014
  ${pictures(job, ws, ws.number)}`);
@@ -120884,7 +121048,7 @@ ${pictures(job, ws, ws.number)}`);
120884
121048
  if (io.lost()) return fail("");
120885
121049
  return await workOn(card);
120886
121050
  } finally {
120887
- fs34.rmSync(path37.join(ws.board, ".sync", `${ws.task}.discussion`), { recursive: true, force: true });
121051
+ fs34.rmSync(path38.join(ws.board, ".sync", `${ws.task}.discussion`), { recursive: true, force: true });
120888
121052
  const left = working.get(key) - 1;
120889
121053
  if (left) working.set(key, left);
120890
121054
  else working.delete(key);
@@ -120929,7 +121093,7 @@ ${pictures(job, ws, ws.number)}`);
120929
121093
  const resolved = await akb(["raw", "card", "resolve", String(id2), "--follow", "--events", "--json", "--", text4], true);
120930
121094
  if (io.lost()) return fail("");
120931
121095
  const file2 = findCard(ws.board, id2);
120932
- rejected = !!file2 && path37.relative(ws.board, file2).split(path37.sep)[0] === ".archive" && parseFrontmatter(fs34.readFileSync(file2, "utf8")).meta?.rejected === true;
121096
+ rejected = !!file2 && path38.relative(ws.board, file2).split(path38.sep)[0] === ".archive" && parseFrontmatter(fs34.readFileSync(file2, "utf8")).meta?.rejected === true;
120933
121097
  if (rejected) ran = resolved;
120934
121098
  else if (resolved.code !== 0) note = text4;
120935
121099
  }
@@ -120979,7 +121143,7 @@ ${pictures(job, ws, ws.number)}`);
120979
121143
  }
120980
121144
  function carryArgs(verb) {
120981
121145
  if (!["refine", "resolve", "revise"].includes(verb)) return [];
120982
- const transcript = writeTranscript(job, path37.join(ws.board, ".sync", `${ws.task}.discussion`));
121146
+ const transcript = writeTranscript(job, path38.join(ws.board, ".sync", `${ws.task}.discussion`));
120983
121147
  return [
120984
121148
  ...job.resume ? ["--session", job.resume, ...job.fork ? ["--fork"] : []] : [],
120985
121149
  ...transcript ? ["--transcript", transcript] : []
@@ -120999,7 +121163,7 @@ async function confirmFlowStopped(ws, job, deps) {
120999
121163
 
121000
121164
  // src/recovery.ts
121001
121165
  import fs35 from "node:fs";
121002
- import path38 from "node:path";
121166
+ import path39 from "node:path";
121003
121167
 
121004
121168
  // ../cli/src/lib/agent/retry.ts
121005
121169
  var RETRY_WINDOW_MS = 15 * 6e4;
@@ -121012,7 +121176,7 @@ function backoffMs(attempt, random = Math.random) {
121012
121176
  }
121013
121177
 
121014
121178
  // src/recovery.ts
121015
- var fileOf = (id) => path38.join(runnerHome(), "checkpoints", `${encodeURIComponent(id)}.json`);
121179
+ var fileOf = (id) => path39.join(runnerHome(), "checkpoints", `${encodeURIComponent(id)}.json`);
121016
121180
  function readCheckpoint(id) {
121017
121181
  try {
121018
121182
  const held5 = JSON.parse(fs35.readFileSync(fileOf(id), "utf8"));
@@ -121025,7 +121189,7 @@ function readCheckpoint(id) {
121025
121189
  }
121026
121190
  function saveCheckpoint(id, checkpoint) {
121027
121191
  const file2 = fileOf(id);
121028
- fs35.mkdirSync(path38.dirname(file2), { recursive: true, mode: 448 });
121192
+ fs35.mkdirSync(path39.dirname(file2), { recursive: true, mode: 448 });
121029
121193
  fs35.writeFileSync(`${file2}.tmp`, JSON.stringify(checkpoint), { mode: 384 });
121030
121194
  fs35.renameSync(`${file2}.tmp`, file2);
121031
121195
  }
@@ -121185,7 +121349,7 @@ function conversationProgress(attempt, send3, valid, unconfirmed) {
121185
121349
 
121186
121350
  // src/reply-images.ts
121187
121351
  import fs36 from "node:fs";
121188
- import path39 from "node:path";
121352
+ import path40 from "node:path";
121189
121353
  import os6 from "node:os";
121190
121354
  import { fileURLToPath as fileURLToPath3 } from "node:url";
121191
121355
  import { createHash as createHash6 } from "node:crypto";
@@ -121203,14 +121367,14 @@ function imageMime(bytes2) {
121203
121367
 
121204
121368
  // src/reply-images.ts
121205
121369
  var inside = (root2, file2) => {
121206
- const p2 = path39.relative(root2, file2);
121207
- return p2 !== ".." && !p2.startsWith(`..${path39.sep}`) && !path39.isAbsolute(p2);
121370
+ const p2 = path40.relative(root2, file2);
121371
+ return p2 !== ".." && !p2.startsWith(`..${path40.sep}`) && !path40.isAbsolute(p2);
121208
121372
  };
121209
121373
  function collectReplyImages(parts, cwd) {
121210
121374
  const files = /* @__PURE__ */ new Map();
121211
121375
  const tools = [];
121212
121376
  const output2 = [];
121213
- const roots = [cwd, path39.join(process.env.CODEX_HOME?.trim() || path39.join(os6.homedir(), ".codex"), "generated_images")].flatMap((p2) => {
121377
+ const roots = [cwd, path40.join(process.env.CODEX_HOME?.trim() || path40.join(os6.homedir(), ".codex"), "generated_images")].flatMap((p2) => {
121214
121378
  try {
121215
121379
  return [fs36.realpathSync(p2)];
121216
121380
  } catch {
@@ -121220,7 +121384,7 @@ function collectReplyImages(parts, cwd) {
121220
121384
  const registered = new Set(parts.flatMap((p2) => {
121221
121385
  if (p2.type !== "image" || !p2.registered || !p2.path) return [];
121222
121386
  try {
121223
- const file2 = p2.path.startsWith("file:") ? fileURLToPath3(p2.path) : path39.resolve(cwd, p2.path);
121387
+ const file2 = p2.path.startsWith("file:") ? fileURLToPath3(p2.path) : path40.resolve(cwd, p2.path);
121224
121388
  if (!fs36.lstatSync(file2).isFile()) return [];
121225
121389
  const real = fs36.realpathSync(file2);
121226
121390
  const fd = fs36.openSync(real, fs36.constants.O_RDONLY | (fs36.constants.O_NOFOLLOW ?? 0));
@@ -121246,7 +121410,7 @@ function collectReplyImages(parts, cwd) {
121246
121410
  if (!p2.path) throw Error();
121247
121411
  const source2 = p2.path.startsWith("file:") ? fileURLToPath3(p2.path) : decodeURIComponent(p2.path);
121248
121412
  if (/^[a-z][a-z0-9+.-]*:/i.test(source2) && !/^[A-Za-z]:[\\/]/.test(source2)) throw Error();
121249
- const real = fs36.realpathSync(path39.resolve(cwd, source2));
121413
+ const real = fs36.realpathSync(path40.resolve(cwd, source2));
121250
121414
  if (!/\.(png|jpe?g|gif|webp)$/i.test(source2) && !registered.has(real)) throw Error();
121251
121415
  if (!roots.some((root2) => inside(root2, real)) && !registered.has(real)) throw Error();
121252
121416
  const fd = fs36.openSync(real, fs36.constants.O_RDONLY | (fs36.constants.O_NOFOLLOW ?? 0));
@@ -121342,7 +121506,7 @@ async function saveReplyImages(parts, cwd, upload2) {
121342
121506
  import { execFileSync as execFileSync2 } from "node:child_process";
121343
121507
  import crypto5 from "node:crypto";
121344
121508
  import fs37 from "node:fs";
121345
- import path40 from "node:path";
121509
+ import path41 from "node:path";
121346
121510
  var gitRead = (cwd, args2) => {
121347
121511
  try {
121348
121512
  return execFileSync2("git", ["-C", cwd, ...args2], {
@@ -121360,7 +121524,7 @@ function authorizedFolder(folder) {
121360
121524
  if (!folder) return null;
121361
121525
  try {
121362
121526
  const real = fs37.realpathSync(folder);
121363
- return allowedProjects().some((root2) => real === root2 || real.startsWith(root2 + path40.sep)) ? real : null;
121527
+ return allowedProjects().some((root2) => real === root2 || real.startsWith(root2 + path41.sep)) ? real : null;
121364
121528
  } catch {
121365
121529
  return null;
121366
121530
  }
@@ -121370,9 +121534,9 @@ function progressFolder(job, folder) {
121370
121534
  if (!token) return folder;
121371
121535
  if (!/^[a-zA-Z0-9-]{1,80}$/.test(token)) return null;
121372
121536
  try {
121373
- const dir = fs37.realpathSync(path40.join(folder, ".akb", "handoffs", token));
121374
- if (!dir.startsWith(fs37.realpathSync(folder) + path40.sep)) return null;
121375
- const marker = JSON.parse(fs37.readFileSync(path40.join(dir, ".akb", "handoff.json"), "utf8"));
121537
+ const dir = fs37.realpathSync(path41.join(folder, ".akb", "handoffs", token));
121538
+ if (!dir.startsWith(fs37.realpathSync(folder) + path41.sep)) return null;
121539
+ const marker = JSON.parse(fs37.readFileSync(path41.join(dir, ".akb", "handoff.json"), "utf8"));
121376
121540
  return marker.task === job.task && marker.isolation === token ? dir : null;
121377
121541
  } catch {
121378
121542
  return null;
@@ -121380,18 +121544,18 @@ function progressFolder(job, folder) {
121380
121544
  }
121381
121545
  function progressEvidence(job, folder) {
121382
121546
  try {
121383
- const board = path40.join(folder, ".akb", "kanban");
121384
- const deliveries = path40.join(board, "deliveries");
121385
- const rows = fs37.readdirSync(deliveries).filter((name) => name.endsWith(".json")).map((name) => JSON.parse(fs37.readFileSync(path40.join(deliveries, name), "utf8"))).filter((row2) => row2.cardId === job.number).sort((a2, b2) => (b2.startedAt ?? 0) - (a2.startedAt ?? 0));
121547
+ const board = path41.join(folder, ".akb", "kanban");
121548
+ const deliveries = path41.join(board, "deliveries");
121549
+ const rows = fs37.readdirSync(deliveries).filter((name) => name.endsWith(".json")).map((name) => JSON.parse(fs37.readFileSync(path41.join(deliveries, name), "utf8"))).filter((row2) => row2.cardId === job.number).sort((a2, b2) => (b2.startedAt ?? 0) - (a2.startedAt ?? 0));
121386
121550
  const row = rows[0];
121387
121551
  if (!row?.deliveryId) return null;
121388
- const tree = fs37.realpathSync(path40.resolve(folder, row.worktree ?? "."));
121389
- if (tree !== fs37.realpathSync(folder) && !tree.startsWith(fs37.realpathSync(folder) + path40.sep)) return null;
121552
+ const tree = fs37.realpathSync(path41.resolve(folder, row.worktree ?? "."));
121553
+ if (tree !== fs37.realpathSync(folder) && !tree.startsWith(fs37.realpathSync(folder) + path41.sep)) return null;
121390
121554
  const inventory = gitRead(tree, ["worktree", "list", "--porcelain"]);
121391
121555
  const related = (inventory ?? "").split("\n\n").flatMap((entry) => {
121392
121556
  const branch = /^branch refs\/heads\/(.+)$/m.exec(entry)?.[1];
121393
121557
  const dir = /^worktree (.+)$/m.exec(entry)?.[1];
121394
- return branch?.startsWith(`card/${job.number}/`) && dir && dir !== tree && dir.startsWith(fs37.realpathSync(folder) + path40.sep) ? [dir] : [];
121558
+ return branch?.startsWith(`card/${job.number}/`) && dir && dir !== tree && dir.startsWith(fs37.realpathSync(folder) + path41.sep) ? [dir] : [];
121395
121559
  });
121396
121560
  const filesIn = (tree2) => {
121397
121561
  const changed = [];
@@ -121399,14 +121563,14 @@ function progressEvidence(job, folder) {
121399
121563
  for (const entry of fs37.readdirSync(dir, { withFileTypes: true })) {
121400
121564
  if ([".git", ".akb", "node_modules", ".claude", ".agents"].includes(entry.name)) continue;
121401
121565
  const name = prefix + entry.name;
121402
- if (entry.isDirectory()) walk(path40.join(dir, entry.name), name + "/");
121566
+ if (entry.isDirectory()) walk(path41.join(dir, entry.name), name + "/");
121403
121567
  else changed.push(name);
121404
121568
  }
121405
121569
  };
121406
121570
  walk(tree2);
121407
121571
  changed.sort();
121408
121572
  return changed.map((name) => {
121409
- const file2 = path40.join(tree2, name);
121573
+ const file2 = path41.join(tree2, name);
121410
121574
  try {
121411
121575
  const stat = fs37.lstatSync(file2);
121412
121576
  if (stat.isSymbolicLink()) return [name, "link", digest(fs37.readlinkSync(file2))];
@@ -121448,9 +121612,9 @@ function progressEvidence(job, folder) {
121448
121612
  function restartFolder(job, folder) {
121449
121613
  const token = job.handoff?.isolation ?? job.id;
121450
121614
  if (!/^[a-zA-Z0-9-]{1,80}$/.test(token)) throw new Error("\u9694\u79BB\u76EE\u5F55\u7F16\u53F7\u65E0\u6548\u3002");
121451
- const dir = path40.join(folder, ".akb", "handoffs", token);
121452
- const marker = path40.join(dir, ".akb", "handoff.json");
121453
- for (const parent of [path40.join(folder, ".akb"), path40.dirname(dir), dir]) {
121615
+ const dir = path41.join(folder, ".akb", "handoffs", token);
121616
+ const marker = path41.join(dir, ".akb", "handoff.json");
121617
+ for (const parent of [path41.join(folder, ".akb"), path41.dirname(dir), dir]) {
121454
121618
  if (fs37.lstatSync(parent, { throwIfNoEntry: false })?.isSymbolicLink()) throw new Error("\u9694\u79BB\u76EE\u5F55\u4E0D\u80FD\u901A\u8FC7\u7B26\u53F7\u94FE\u63A5\u521B\u5EFA\u3002");
121455
121619
  }
121456
121620
  if (fs37.existsSync(dir)) {
@@ -121463,14 +121627,14 @@ function restartFolder(job, folder) {
121463
121627
  }
121464
121628
  throw new Error("\u91CD\u542F\u76EE\u5F55\u5DF2\u5B58\u5728\uFF0C\u8BF7\u91CD\u65B0\u68C0\u67E5\u3002");
121465
121629
  }
121466
- fs37.mkdirSync(path40.dirname(dir), { recursive: true });
121630
+ fs37.mkdirSync(path41.dirname(dir), { recursive: true });
121467
121631
  fs37.mkdirSync(dir);
121468
121632
  for (const entry of fs37.readdirSync(folder)) {
121469
121633
  if ([".akb", ".git", "node_modules", ".claude", ".agents"].includes(entry)) continue;
121470
- fs37.cpSync(path40.join(folder, entry), path40.join(dir, entry), { recursive: true, verbatimSymlinks: true });
121634
+ fs37.cpSync(path41.join(folder, entry), path41.join(dir, entry), { recursive: true, verbatimSymlinks: true });
121471
121635
  }
121472
- if (fs37.lstatSync(path40.dirname(marker), { throwIfNoEntry: false })?.isSymbolicLink()) throw new Error("\u9694\u79BB\u6807\u8BB0\u76EE\u5F55\u65E0\u6548\u3002");
121473
- fs37.mkdirSync(path40.dirname(marker), { recursive: true });
121636
+ if (fs37.lstatSync(path41.dirname(marker), { throwIfNoEntry: false })?.isSymbolicLink()) throw new Error("\u9694\u79BB\u6807\u8BB0\u76EE\u5F55\u65E0\u6548\u3002");
121637
+ fs37.mkdirSync(path41.dirname(marker), { recursive: true });
121474
121638
  fs37.writeFileSync(marker, JSON.stringify({ task: job.task, isolation: token }), { flag: "wx" });
121475
121639
  return dir;
121476
121640
  }
@@ -121478,16 +121642,16 @@ function restartFolder(job, folder) {
121478
121642
  // src/jobs.ts
121479
121643
  import { spawn as spawn4 } from "node:child_process";
121480
121644
  import fs42 from "node:fs";
121481
- import path45 from "node:path";
121645
+ import path46 from "node:path";
121482
121646
 
121483
121647
  // ../cli/src/lib/agent/catalog.ts
121484
121648
  import fs38 from "node:fs";
121485
- import path41 from "node:path";
121649
+ import path42 from "node:path";
121486
121650
  var CATALOGUE = "https://models.dev/api.json";
121487
121651
  var FRESH_FOR_MS = 24 * 60 * 6e4;
121488
121652
  var ANSWER_BY_MS = 2e4;
121489
121653
  function cacheFile() {
121490
- return path41.join(machineHome(), "models-dev.json");
121654
+ return path42.join(machineHome(), "models-dev.json");
121491
121655
  }
121492
121656
  var held3;
121493
121657
  function readCache() {
@@ -121540,7 +121704,7 @@ function refreshCatalog() {
121540
121704
  const limits = limitsIn(await answer.json());
121541
121705
  if (Object.keys(limits).length === 0) return;
121542
121706
  const file2 = cacheFile();
121543
- fs38.mkdirSync(path41.dirname(file2), { recursive: true });
121707
+ fs38.mkdirSync(path42.dirname(file2), { recursive: true });
121544
121708
  fs38.writeFileSync(file2, JSON.stringify({ fetchedAt: Date.now(), limits }));
121545
121709
  } catch {
121546
121710
  }
@@ -121560,6 +121724,7 @@ function spellings(model) {
121560
121724
  return [.../* @__PURE__ */ new Set([id, undated])];
121561
121725
  }
121562
121726
  function contextLimit(harness, model) {
121727
+ if (harness === "antigravity") return void 0;
121563
121728
  if (!model?.trim()) return void 0;
121564
121729
  const limits = readCache()?.limits;
121565
121730
  if (!limits) return void 0;
@@ -121633,10 +121798,10 @@ async function replyApprovalBridge(task, number, approve) {
121633
121798
 
121634
121799
  // src/akb-version.ts
121635
121800
  import fs39 from "node:fs";
121636
- import path42 from "node:path";
121637
- var stateFile = () => path42.join(akbHome(), "state.json");
121638
- var akbVersionDir = (version) => path42.join(akbHome(), version);
121639
- var entryOf = (dir) => path42.join(dir, "bin", "ai4kanban.mjs");
121801
+ import path43 from "node:path";
121802
+ var stateFile = () => path43.join(akbHome(), "state.json");
121803
+ var akbVersionDir = (version) => path43.join(akbHome(), version);
121804
+ var entryOf = (dir) => path43.join(dir, "bin", "ai4kanban.mjs");
121640
121805
  function readAkbState() {
121641
121806
  try {
121642
121807
  const held5 = JSON.parse(fs39.readFileSync(stateFile(), "utf8"));
@@ -121647,7 +121812,7 @@ function readAkbState() {
121647
121812
  }
121648
121813
  function contractOf(dir) {
121649
121814
  try {
121650
- return JSON.parse(fs39.readFileSync(path42.join(dir, "package.json"), "utf8")).akbContract ?? null;
121815
+ return JSON.parse(fs39.readFileSync(path43.join(dir, "package.json"), "utf8")).akbContract ?? null;
121651
121816
  } catch {
121652
121817
  return null;
121653
121818
  }
@@ -121663,24 +121828,24 @@ function currentAkb() {
121663
121828
  fs39.utimesSync(dir, now, now);
121664
121829
  } catch {
121665
121830
  }
121666
- return { command: process.execPath, args: akbArgs(entryOf(dir)), version: current2, shim: path42.join(dir, "shim") };
121831
+ return { command: process.execPath, args: akbArgs(entryOf(dir)), version: current2, shim: path43.join(dir, "shim") };
121667
121832
  }
121668
121833
 
121669
121834
  // src/chats.ts
121670
121835
  import fs41 from "node:fs";
121671
- import path44 from "node:path";
121836
+ import path45 from "node:path";
121672
121837
 
121673
121838
  // ../cli/src/lib/shared/chats.ts
121674
121839
  var CHAT_KEEP_DAYS = 30;
121675
121840
 
121676
121841
  // ../cli/src/lib/agent/task-chats.ts
121677
121842
  import fs40 from "node:fs";
121678
- import path43 from "node:path";
121843
+ import path44 from "node:path";
121679
121844
  var TASK = /^[\w-]{1,100}$/;
121680
- var taskChatsDir = (home4 = machineHome()) => path43.join(home4, "chats");
121845
+ var taskChatsDir = (home4 = machineHome()) => path44.join(home4, "chats");
121681
121846
  function taskChatFile(task, home4) {
121682
121847
  if (!TASK.test(task)) throw new Error(`${task} is not a task id.`);
121683
- return path43.join(taskChatsDir(home4), `${task}.jsonl`);
121848
+ return path44.join(taskChatsDir(home4), `${task}.jsonl`);
121684
121849
  }
121685
121850
  function readTaskChat(task, home4) {
121686
121851
  let text4;
@@ -121705,7 +121870,7 @@ function readTaskChat(task, home4) {
121705
121870
  var DAY_MS = 24 * 60 * 6e4;
121706
121871
  var KEEP_MS2 = CHAT_KEEP_DAYS * DAY_MS;
121707
121872
  var home3 = () => runnerHome();
121708
- var reviewedFile = () => path44.join(taskChatsDir(home3()), "reviewed.json");
121873
+ var reviewedFile = () => path45.join(taskChatsDir(home3()), "reviewed.json");
121709
121874
  function readReviewed() {
121710
121875
  try {
121711
121876
  const held5 = JSON.parse(fs41.readFileSync(reviewedFile(), "utf8"));
@@ -121715,7 +121880,7 @@ function readReviewed() {
121715
121880
  }
121716
121881
  }
121717
121882
  function writeReviewed(reviewed) {
121718
- fs41.mkdirSync(path44.dirname(reviewedFile()), { recursive: true });
121883
+ fs41.mkdirSync(path45.dirname(reviewedFile()), { recursive: true });
121719
121884
  fs41.writeFileSync(reviewedFile(), `${JSON.stringify(reviewed, null, 2)}
121720
121885
  `);
121721
121886
  }
@@ -121726,7 +121891,7 @@ function keepChat(job, reply, at2 = Date.now()) {
121726
121891
  { id: job.id, role: "agent", text: reply, at: at2, runtime: job.runtime, model: job.model ?? null }
121727
121892
  ];
121728
121893
  const file2 = taskChatFile(job.task, home3());
121729
- fs41.mkdirSync(path44.dirname(file2), { recursive: true });
121894
+ fs41.mkdirSync(path45.dirname(file2), { recursive: true });
121730
121895
  fs41.appendFileSync(file2, lines.map((l2) => `${JSON.stringify(l2)}
121731
121896
  `).join(""));
121732
121897
  }
@@ -121734,7 +121899,7 @@ function keepCloudChat(task, messages) {
121734
121899
  const file2 = taskChatFile(task, home3());
121735
121900
  if (!messages.length) return fs41.rmSync(file2, { force: true });
121736
121901
  const lines = messages.map((m) => ({ id: m.id, role: m.role, text: m.body, at: Date.parse(m.created_at) || Date.now() }));
121737
- fs41.mkdirSync(path44.dirname(file2), { recursive: true });
121902
+ fs41.mkdirSync(path45.dirname(file2), { recursive: true });
121738
121903
  fs41.writeFileSync(file2, lines.map((l2) => `${JSON.stringify(l2)}
121739
121904
  `).join(""));
121740
121905
  }
@@ -121753,7 +121918,7 @@ async function keepDecisions(task, read4) {
121753
121918
  const ids = new Set(comments.map((c2) => c2.id));
121754
121919
  const lines = [...readTaskChat(task, home3()).filter((l2) => !ids.has(l2.id)), ...comments].sort((a2, b2) => a2.at - b2.at);
121755
121920
  const file2 = taskChatFile(task, home3());
121756
- fs41.mkdirSync(path44.dirname(file2), { recursive: true });
121921
+ fs41.mkdirSync(path45.dirname(file2), { recursive: true });
121757
121922
  fs41.writeFileSync(file2, lines.map((l2) => `${JSON.stringify(l2)}
121758
121923
  `).join(""));
121759
121924
  }
@@ -121834,15 +121999,15 @@ var defaultDeps = (machineId) => ({
121834
121999
  akb: currentAkb,
121835
122000
  runtimes: detectRuntimes
121836
122001
  });
121837
- var ownFolder = () => path45.join(runnerHome(), "work");
122002
+ var ownFolder = () => path46.join(runnerHome(), "work");
121838
122003
  function folderFor(job) {
121839
122004
  if (!job.projectDir) {
121840
- const cwd = path45.join(ownFolder(), job.id);
122005
+ const cwd = path46.join(ownFolder(), job.id);
121841
122006
  fs42.mkdirSync(cwd, { recursive: true });
121842
122007
  return { cwd };
121843
122008
  }
121844
122009
  const real = realpath2(job.projectDir);
121845
- if (real && allowedProjects().some((root2) => real === root2 || real.startsWith(root2 + path45.sep))) return { cwd: real };
122010
+ if (real && allowedProjects().some((root2) => real === root2 || real.startsWith(root2 + path46.sep))) return { cwd: real };
121846
122011
  return { refused: `This Runner is not allowed to work in ${job.projectDir}.` };
121847
122012
  }
121848
122013
  function realpath2(p2) {
@@ -121852,20 +122017,20 @@ function realpath2(p2) {
121852
122017
  return null;
121853
122018
  }
121854
122019
  }
121855
- var attachmentsOf = (job) => path45.join(runnerHome(), "attachments", job.id);
122020
+ var attachmentsOf = (job) => path46.join(runnerHome(), "attachments", job.id);
121856
122021
  function writeAttachments(job) {
121857
- if (!job.attachments.length) return "";
122022
+ if (!job.attachments.length) return { text: "", files: [] };
121858
122023
  const dir = attachmentsOf(job);
121859
122024
  fs42.mkdirSync(dir, { recursive: true });
121860
122025
  const files = job.attachments.map((a2) => {
121861
- const file2 = path45.join(dir, path45.basename(a2.name));
122026
+ const file2 = path46.join(dir, path46.basename(a2.name));
121862
122027
  fs42.writeFileSync(file2, Buffer.from(a2.content, "base64"));
121863
122028
  return file2;
121864
122029
  });
121865
- return `
122030
+ return { text: `
121866
122031
 
121867
122032
  Attached files:
121868
- ${files.map((f2) => `- ${f2}`).join("\n")}`;
122033
+ ${files.map((f2) => `- ${f2}`).join("\n")}`, files };
121869
122034
  }
121870
122035
  var cut = (text4) => text4.length > EVENT_CHARS ? text4.slice(0, EVENT_CHARS) : text4;
121871
122036
  function toWire(events, first) {
@@ -122158,7 +122323,7 @@ async function runJob(id, deps, track = () => {
122158
122323
  const releases = [];
122159
122324
  try {
122160
122325
  const akb = deps.akb();
122161
- releases.push(hold(path45.dirname(akb.shim)));
122326
+ releases.push(hold(path46.dirname(akb.shim)));
122162
122327
  releases.push(hold(akb.shim));
122163
122328
  await runClaimed(job, { ...deps, akb }, track, (dir) => releases.push(hold(dir)), lease);
122164
122329
  } finally {
@@ -122186,6 +122351,9 @@ async function runClaimedStep(job, deps, track, keep2, lease, scope, replyStream
122186
122351
  const finishClaimed = (outcome, reason = "", said2) => {
122187
122352
  const before = spent();
122188
122353
  let report2 = before ? { ...before, ...said2 } : said2;
122354
+ if (reply && outcome === "failed" && !report2?.reply && checkpoint.partialReply) {
122355
+ report2 = { ...report2, reply: checkpoint.partialReply };
122356
+ }
122189
122357
  if (reply && outcome === "failed" && checkpoint.started === false && checkpoint.effects === false && !checkpoint.pending.length && !checkpoint.opaque && (!(job.recoveryOf || job.manualRecovery) || previous || job.retryReplay === true)) {
122190
122358
  report2 = { ...report2, recovery: { safe: true, stopped: true, resumable: false } };
122191
122359
  saveCheckpoint(id, checkpoint);
@@ -122196,7 +122364,7 @@ async function runClaimedStep(job, deps, track, keep2, lease, scope, replyStream
122196
122364
  }
122197
122365
  return finish(deps, id, lease, outcome, reason, report2);
122198
122366
  };
122199
- const replay = job.manualRecovery === true && !!previous && replayable(previous) || job.retryReplay === true && (!local || replayable(local)) || !!previous?.retry?.at && replayable(previous);
122367
+ const replay = !(job.runtime === "antigravity" && previous?.session) && (job.manualRecovery === true && !!previous && replayable(previous) || job.retryReplay === true && (!local || replayable(local)) || !!previous?.retry?.at && replayable(previous));
122200
122368
  if (job.manualRecovery && !local) checkpoint.retry = void 0;
122201
122369
  if (reply) checkpoint.retry ??= { since: Date.now(), attempt: 1 };
122202
122370
  const recovering = checkpoint.updating === true || !!job.recoveryOf;
@@ -122208,11 +122376,15 @@ async function runClaimedStep(job, deps, track, keep2, lease, scope, replyStream
122208
122376
  if (manual && !local && checkpoint.completed?.outcome === "failed") {
122209
122377
  delete checkpoint.completed;
122210
122378
  delete checkpoint.attempts;
122379
+ delete checkpoint.partialReply;
122211
122380
  }
122212
122381
  checkpoint.session ??= job.resume ?? void 0;
122213
122382
  if (reply && previous?.started && checkpoint.completed?.outcome !== "done" && !await stopReply(readCheckpoint(id) ? id : job.recoveryOf ?? id, deps.stopMs)) {
122214
122383
  return finishClaimed("failed", "recovery_unsafe");
122215
122384
  }
122385
+ if (reply && recovering && job.runtime === "antigravity" && checkpoint.started && !checkpoint.session && !checkpoint.completed) {
122386
+ return finishClaimed("failed", "Antigravity did not record a conversation ID before interruption. The original session cannot be resumed.");
122387
+ }
122216
122388
  if (reply && recovering && !replyStream && previous?.started && !checkpoint.completed && !checkpoint.retry?.at && !(manual && !local)) {
122217
122389
  if (checkpoint.retry.attempt === 1) checkpoint.retry.since = Date.now();
122218
122390
  if (checkpoint.retry.attempt >= 3 || Date.now() > checkpoint.retry.since + 12e4) {
@@ -122318,14 +122490,15 @@ async function runClaimedStep(job, deps, track, keep2, lease, scope, replyStream
122318
122490
  }
122319
122491
  if (!job.flow && !job.review) {
122320
122492
  void refreshCatalog();
122321
- const head2 = folderLines(ws) + writeAttachments(job);
122493
+ const attachments = writeAttachments(job);
122494
+ const head2 = folderLines(ws) + attachments.text;
122322
122495
  const file2 = writeTranscript(job, attachmentsOf(job));
122323
122496
  const transcript = file2 ? `
122324
122497
 
122325
122498
  This task came out of a discussion. Read it for what the card leaves out: ${file2}` : "";
122326
122499
  const promptOf = (said2) => {
122327
122500
  const lines = (head2 + said2).trim();
122328
- const prompt = recovering && !replay && (checkpoint.started || job.recoveryOf) ? "\u8FDE\u63A5\u6062\u590D\u540E\u7EE7\u7EED\u4E4B\u524D\u4E2D\u65AD\u7684\u56DE\u590D\u3002\u5148\u6838\u5BF9\u5DF2\u6709\u8FDB\u5EA6\u548C\u7ED3\u679C\uFF0C\u4FDD\u7559\u5B8C\u6210\u7684\u5DE5\u4F5C\uFF0C\u4E0D\u8981\u91CD\u590D\u5DF2\u7ECF\u6267\u884C\u7684\u64CD\u4F5C\u3002" : job.prompt;
122501
+ const prompt = recovering && !replay && (checkpoint.started || job.recoveryOf) ? [job.runtime === "antigravity" ? job.prompt : "", "\u8FDE\u63A5\u6062\u590D\u540E\u7EE7\u7EED\u4E4B\u524D\u4E2D\u65AD\u7684\u56DE\u590D\u3002\u5148\u6838\u5BF9\u5DF2\u6709\u8FDB\u5EA6\u548C\u64CD\u4F5C\u7ED3\u679C\uFF0C\u4FDD\u7559\u5B8C\u6210\u7684\u5DE5\u4F5C\u4E0E\u7528\u6237\u51B3\u5B9A\uFF0C\u4E0D\u8981\u91CD\u590D\u5DF2\u7ECF\u6267\u884C\u7684\u64CD\u4F5C\uFF1B\u7ED3\u679C\u5C1A\u672A\u786E\u8BA4\u65F6\u5148\u68C0\u67E5\u5B9E\u9645\u72B6\u6001\u3002"].filter(Boolean).join("\n\n") : job.prompt;
122329
122502
  return lines ? `${lines}
122330
122503
 
122331
122504
  ---
@@ -122334,6 +122507,7 @@ ${prompt}` : prompt;
122334
122507
  };
122335
122508
  const planned = (resume, fork, said2 = "") => {
122336
122509
  let p2 = deps.plan(job.runtime, promptOf(said2), cwd, resume, job.model, settingsOf(job), fork, cloudLanguage(job));
122510
+ p2.renderer?.setRequiredImages?.(attachments.files);
122337
122511
  if (ws) p2 = { ...p2, env: akbEnv(deps.akb, ws.board, ws.task, cloudLanguage(job), p2.env) };
122338
122512
  if (scope.preview) p2 = { ...p2, env: { ...p2.env, AI4KANBAN_PREVIEW_BRIDGE: scope.preview.env } };
122339
122513
  if (scope.bridge) p2 = { ...p2, env: { ...p2.env, AI4KANBAN_REPLY_APPROVAL: scope.bridge.env } };
@@ -122394,6 +122568,16 @@ ${prompt}` : prompt;
122394
122568
  return { ...rest, ...replySpent(checkpoint, job.runtime) };
122395
122569
  };
122396
122570
  let replyProgress = false;
122571
+ const messages = [];
122572
+ const retainReply = (report2, failed) => {
122573
+ if (!reply) return report2;
122574
+ const text4 = report2.reply?.trim() ? report2.reply : messages.join("\n\n") || (failed ? checkpoint.partialReply : void 0);
122575
+ if (text4) {
122576
+ checkpoint.partialReply = text4;
122577
+ persist();
122578
+ }
122579
+ return text4 ? { ...report2, reply: text4 } : report2;
122580
+ };
122397
122581
  const account = readSession()?.subject;
122398
122582
  const generation = accountGeneration();
122399
122583
  const evidence = scope.progress = conversationProgress(checkpoint.retry?.attempt ?? 1, async (progress) => {
@@ -122413,6 +122597,10 @@ ${prompt}` : prompt;
122413
122597
  evidence.observe(event2, at2);
122414
122598
  subagents.event(event2);
122415
122599
  checkpointEvent(checkpoint, event2);
122600
+ if (reply && event2.kind === "message" && event2.data.text.trim()) {
122601
+ messages.push(event2.data.text);
122602
+ checkpoint.partialReply = messages.join("\n\n");
122603
+ }
122416
122604
  const session = run3?.session();
122417
122605
  if (session) checkpoint.session = session;
122418
122606
  if (attempt && !run3?.converse) measure(report(job, run3));
@@ -122421,15 +122609,14 @@ ${prompt}` : prompt;
122421
122609
  };
122422
122610
  const retry2 = async (reason) => {
122423
122611
  if (!reply || !reason || stream.asked() || stream.lost()) return false;
122424
- if ((checkpoint.retry?.attempt ?? 1) >= 2 || !/timed out|ECONNRESET|ETIMEDOUT|temporar|overload|capacity|rate.limit|429|503|network|connection.*(reset|closed)/i.test(reason)) return false;
122425
- if (/timed out|start_unconfirmed/i.test(reason) && (!/initialize|session\/(new|load)|thread\/(start|resume|fork)/i.test(reason) || Date.now() >= checkpoint.retry.since + CONVERSATION_MS.prepare)) return false;
122612
+ if (job.runtime === "antigravity" && manualFailure(reason)) return false;
122613
+ const at2 = replyRetry(checkpoint, reason, Date.now(), deps.replyBackoff);
122614
+ if (at2 === null) return false;
122426
122615
  checkpoint.approvalCancelled = true;
122427
122616
  persist();
122428
122617
  if (job.chat && checkpoint.approvalRequested) await cancelReplyApproval(deps.machineId, id);
122429
122618
  const safe3 = replayable(checkpoint);
122430
- if (checkpoint.pending.length || checkpoint.opaque || !safe3 && (!checkpoint.session || sessionMissing(reason))) return false;
122431
- const at2 = replyRetry(checkpoint, reason, Date.now(), deps.replyBackoff);
122432
- if (at2 === null) return false;
122619
+ if (checkpoint.opaque || !safe3 && (!checkpoint.session || sessionMissing(reason))) return false;
122433
122620
  if (!await stopReply(id, deps.stopMs) || !await stream.confirmed()) return false;
122434
122621
  checkpoint.retry.at = at2;
122435
122622
  persist();
@@ -122448,7 +122635,7 @@ ${prompt}` : prompt;
122448
122635
  persist();
122449
122636
  stream.event({ kind: "log", data: { text: "[chat-recovery] running" } });
122450
122637
  evidence.cancel();
122451
- await runClaimed({ ...job, manualRecovery: false, retryReplay: safe3 }, deps, track, keep2, lease, stream);
122638
+ await runClaimed({ ...job, manualRecovery: false, retryReplay: safe3 && !job.resume }, deps, track, keep2, lease, stream);
122452
122639
  await stream.end();
122453
122640
  return true;
122454
122641
  };
@@ -122488,12 +122675,12 @@ ${prompt}` : prompt;
122488
122675
  if (chat.ok) keepCloudChat(task2, chat.value.messages);
122489
122676
  await keepDecisions(task2, deps.api.readDecisions);
122490
122677
  }
122491
- const listed2 = await deps.api.listChats(deps.machineId);
122492
- if (!listed2.ok) {
122678
+ const listed = await deps.api.listChats(deps.machineId);
122679
+ if (!listed.ok) {
122493
122680
  await stream.end();
122494
- return finishClaimed("failed", listed2.error);
122681
+ return finishClaimed("failed", listed.error);
122495
122682
  }
122496
- const tasks = listed2.value.chats.filter((c2) => job.review.tasks.includes(c2.task));
122683
+ const tasks = listed.value.chats.filter((c2) => job.review.tasks.includes(c2.task));
122497
122684
  const marks = reviewMarks(tasks);
122498
122685
  const refs = tasks.map((c2) => `${c2.task}:${c2.number}`);
122499
122686
  const ended3 = refs.length ? await runReview(job, ws, refs, deps, io) : { ok: true, report: {} };
@@ -122580,7 +122767,8 @@ ${prompt}` : prompt;
122580
122767
  checkpoint.session = void 0;
122581
122768
  persist();
122582
122769
  }
122583
- if (await retry2(end.ok ? void 0 : end.error)) return;
122770
+ measured2 = retainReply(measured2, !end.ok);
122771
+ if (await retry2(end.ok ? void 0 : end.error ?? "The agent did not complete the reply.")) return;
122584
122772
  await evidence.drain(deps.endMs);
122585
122773
  const stopped3 = await stopReply(id, deps.stopMs);
122586
122774
  stop(child, plan3.managedProcess);
@@ -122622,6 +122810,11 @@ ${prompt}` : prompt;
122622
122810
  stop(child);
122623
122811
  });
122624
122812
  const fromAgent = (text4) => {
122813
+ const session = plan3.session();
122814
+ if (!stream.lost() && session && session !== checkpoint.session) {
122815
+ checkpoint.session = session;
122816
+ persist();
122817
+ }
122625
122818
  if (!structured) {
122626
122819
  if (text4.trim()) acted = true;
122627
122820
  stream.out(text4);
@@ -122634,6 +122827,7 @@ ${prompt}` : prompt;
122634
122827
  };
122635
122828
  child.stdout.on("data", (chunk) => {
122636
122829
  fromAgent(renderer2.push(chunk));
122830
+ if (renderer2.rateLimit?.()) stop(child, plan3.managedProcess);
122637
122831
  if (renderer2.background?.()) backgroundWait.pending();
122638
122832
  if (plan3.stdin && streamFinished(renderer2) && !child.stdin.writableEnded) {
122639
122833
  backgroundWait.close();
@@ -122643,6 +122837,7 @@ ${prompt}` : prompt;
122643
122837
  child.stderr.setEncoding("utf8");
122644
122838
  child.stderr.on("data", (chunk) => {
122645
122839
  renderer2.stderr?.(chunk);
122840
+ if (renderer2.rateLimit?.()) stop(child, plan3.managedProcess);
122646
122841
  stderr = (stderr + chunk).slice(-EVENT_CHARS);
122647
122842
  stream.out(quietLines(plan3, chunk));
122648
122843
  });
@@ -122686,6 +122881,7 @@ ${plan2.renderer.failure?.() ?? ""}`)) && (checkpoint.retry?.attempt ?? 1) < 3 &
122686
122881
  if (parts) measured = { ...measured, parts, reply: parts.filter((p2) => p2.type === "text").map((p2) => p2.text).join("") };
122687
122882
  }
122688
122883
  const rawFailure = ended2.error ?? renderer.failure?.() ?? (ended2.code === 0 ? void 0 : `Exited with code ${ended2.code}.`);
122884
+ measured = retainReply(measured, !!rawFailure);
122689
122885
  if (job.runtime !== "antigravity" && sessionMissing(rawFailure ?? "") && !replayable(checkpoint)) {
122690
122886
  checkpoint.session = void 0;
122691
122887
  persist();
@@ -122841,7 +123037,7 @@ async function runTest(job, deps, lease) {
122841
123037
  const report2 = (await deps.runtimes()).find((r2) => r2.name === job.runtime);
122842
123038
  if (!report2?.installed) return finish2("failed", "not_installed");
122843
123039
  if (report2.loggedIn === false) return finish2("failed", "signed_out");
122844
- const cwd = path45.join(ownFolder(), "test");
123040
+ const cwd = path46.join(ownFolder(), "test");
122845
123041
  fs42.mkdirSync(cwd, { recursive: true });
122846
123042
  const run3 = deps.plan(job.runtime, job.prompt, cwd, null, job.model, settingsOf(job));
122847
123043
  const startedAt = Date.now();
@@ -122879,11 +123075,13 @@ async function runTest(job, deps, lease) {
122879
123075
  child.stdout.setEncoding("utf8");
122880
123076
  child.stdout.on("data", (chunk) => {
122881
123077
  renderer.push(chunk);
123078
+ if (renderer.rateLimit?.()) stop(child, run3.managedProcess);
122882
123079
  if (run3.stdin && streamFinished(renderer) && !child.stdin.writableEnded) child.stdin.end();
122883
123080
  });
122884
123081
  child.stderr.setEncoding("utf8");
122885
123082
  child.stderr.on("data", (chunk) => {
122886
123083
  renderer.stderr?.(chunk);
123084
+ if (renderer.rateLimit?.()) stop(child, run3.managedProcess);
122887
123085
  said += chunk.split("\n").filter((line) => line && !run3.quiet(line)).map((line) => `${line}
122888
123086
  `).join("");
122889
123087
  });
@@ -122932,8 +123130,8 @@ ${undrawn2.map((l2) => `- ${l2}`).join("\n")}` : "");
122932
123130
 
122933
123131
  // src/flow-worker.ts
122934
123132
  var FLOW_MARK = "WILDCRANE_FLOW_WORKER";
122935
- var directory2 = () => path46.join(runnerHome(), "flow-workers");
122936
- var fileOf2 = (id) => path46.join(directory2(), `${encodeURIComponent(id)}.json`);
123133
+ var directory2 = () => path47.join(runnerHome(), "flow-workers");
123134
+ var fileOf2 = (id) => path47.join(directory2(), `${encodeURIComponent(id)}.json`);
122937
123135
  var stopFile = (id) => `${fileOf2(id)}.stop`;
122938
123136
  var flowWorkerEntry = fileURLToPath4(new URL("./flow-worker-main.mjs", import.meta.url));
122939
123137
  var canKeepFlow = (job) => !!job.task && !!job.flow && ["create", "refine", "implement", "preview"].includes(job.flow.verb) && !job.agent && !job.review && !job.discussion && !job.test && !job.secret;
@@ -123007,7 +123205,7 @@ async function reclaimFlowWorkers(machine, given, only) {
123007
123205
  if (!valid()) break;
123008
123206
  if (!name.endsWith(".json")) continue;
123009
123207
  try {
123010
- const file2 = path46.join(directory2(), name);
123208
+ const file2 = path47.join(directory2(), name);
123011
123209
  const original = fs43.readFileSync(file2, "utf8");
123012
123210
  const worker = JSON.parse(original);
123013
123211
  if (!worker || typeof worker.id !== "string" || name !== `${encodeURIComponent(worker.id)}.json` || typeof worker.token !== "string" || !worker.token || worker.machine !== machine || worker.account !== account || typeof worker.generation !== "string" || !Number.isFinite(worker.at)) continue;
@@ -123015,16 +123213,16 @@ async function reclaimFlowWorkers(machine, given, only) {
123015
123213
  if (!only) void reclaimFlowWorkerAfterExit(worker.id, machine, given);
123016
123214
  continue;
123017
123215
  }
123018
- const queried = tryLock(path46.join(directory2(), ".lookup.lock"));
123216
+ const queried = tryLock(path47.join(directory2(), ".lookup.lock"));
123019
123217
  if (!queried) continue;
123020
123218
  const remote2 = await readJob(worker.id).finally(queried);
123021
123219
  if (!valid()) break;
123022
123220
  if (!remote2.ok || remote2.value.job.id !== worker.id || remote2.value.job.state !== "finished" || !canKeepFlow(remote2.value.job)) continue;
123023
123221
  if (!worker.markedAt) {
123024
123222
  const job = remote2.value.job;
123025
- const folder = job.projectDir ? folderFor(job) : { cwd: path46.join(runnerHome(), "work", job.id) };
123223
+ const folder = job.projectDir ? folderFor(job) : { cwd: path47.join(runnerHome(), "work", job.id) };
123026
123224
  if ("refused" in folder || !job.task || !job.project) continue;
123027
- const board = path46.join(folder.cwd, ".akb", "kanban");
123225
+ const board = path47.join(folder.cwd, ".akb", "kanban");
123028
123226
  if (!fs43.existsSync(board)) continue;
123029
123227
  const deps = given ?? defaultDeps(machine);
123030
123228
  if (!await confirmFlowStopped(
@@ -123073,7 +123271,7 @@ async function runFlowWorker(id, token, given, entry = flowWorkerEntry) {
123073
123271
  await halt?.();
123074
123272
  };
123075
123273
  const release2 = executorRecord();
123076
- const keepVersion = hold(path46.resolve(path46.dirname(fileURLToPath4(import.meta.url)), ".."));
123274
+ const keepVersion = hold(path47.resolve(path47.dirname(fileURLToPath4(import.meta.url)), ".."));
123077
123275
  worker.pid = process.pid;
123078
123276
  worker.processAt = Date.now();
123079
123277
  save(worker);