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.
package/dist/launcher.mjs CHANGED
@@ -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;
@@ -1146,14 +1146,14 @@ var require_util = __commonJS({
1146
1146
  }
1147
1147
  const port = url.port != null ? url.port : url.protocol === "https:" ? 443 : 80;
1148
1148
  let origin = url.origin != null ? url.origin : `${url.protocol || ""}//${url.hostname || ""}:${port}`;
1149
- let path35 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
1149
+ let path36 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
1150
1150
  if (origin[origin.length - 1] === "/") {
1151
1151
  origin = origin.slice(0, origin.length - 1);
1152
1152
  }
1153
- if (path35 && path35[0] !== "/") {
1154
- path35 = `/${path35}`;
1153
+ if (path36 && path36[0] !== "/") {
1154
+ path36 = `/${path36}`;
1155
1155
  }
1156
- return new URL(`${origin}${path35}`);
1156
+ return new URL(`${origin}${path36}`);
1157
1157
  }
1158
1158
  if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) {
1159
1159
  throw new InvalidArgumentError("Invalid URL protocol: the URL must start with `http:` or `https:`.");
@@ -1988,9 +1988,9 @@ var require_diagnostics = __commonJS({
1988
1988
  "undici:client:sendHeaders",
1989
1989
  (evt) => {
1990
1990
  const {
1991
- request: { method, path: path35, origin }
1991
+ request: { method, path: path36, origin }
1992
1992
  } = evt;
1993
- debugLog("sending request to %s %s%s", method, origin, path35);
1993
+ debugLog("sending request to %s %s%s", method, origin, path36);
1994
1994
  }
1995
1995
  );
1996
1996
  }
@@ -2008,14 +2008,14 @@ var require_diagnostics = __commonJS({
2008
2008
  "undici:request:headers",
2009
2009
  (evt) => {
2010
2010
  const {
2011
- request: { method, path: path35, origin },
2011
+ request: { method, path: path36, origin },
2012
2012
  response: { statusCode }
2013
2013
  } = evt;
2014
2014
  debugLog(
2015
2015
  "received response to %s %s%s - HTTP %d",
2016
2016
  method,
2017
2017
  origin,
2018
- path35,
2018
+ path36,
2019
2019
  statusCode
2020
2020
  );
2021
2021
  }
@@ -2024,23 +2024,23 @@ var require_diagnostics = __commonJS({
2024
2024
  "undici:request:trailers",
2025
2025
  (evt) => {
2026
2026
  const {
2027
- request: { method, path: path35, origin }
2027
+ request: { method, path: path36, origin }
2028
2028
  } = evt;
2029
- debugLog("trailers received from %s %s%s", method, origin, path35);
2029
+ debugLog("trailers received from %s %s%s", method, origin, path36);
2030
2030
  }
2031
2031
  );
2032
2032
  diagnosticsChannel.subscribe(
2033
2033
  "undici:request:error",
2034
2034
  (evt) => {
2035
2035
  const {
2036
- request: { method, path: path35, origin },
2036
+ request: { method, path: path36, origin },
2037
2037
  error
2038
2038
  } = evt;
2039
2039
  debugLog(
2040
2040
  "request to %s %s%s errored - %s",
2041
2041
  method,
2042
2042
  origin,
2043
- path35,
2043
+ path36,
2044
2044
  error.message
2045
2045
  );
2046
2046
  }
@@ -2155,7 +2155,7 @@ var require_request = __commonJS({
2155
2155
  var kHandler = /* @__PURE__ */ Symbol("handler");
2156
2156
  var Request = class {
2157
2157
  constructor(origin, {
2158
- path: path35,
2158
+ path: path36,
2159
2159
  method,
2160
2160
  body,
2161
2161
  headers,
@@ -2172,11 +2172,11 @@ var require_request = __commonJS({
2172
2172
  maxRedirections,
2173
2173
  typeOfService
2174
2174
  }, handler) {
2175
- if (typeof path35 !== "string") {
2175
+ if (typeof path36 !== "string") {
2176
2176
  throw new InvalidArgumentError("path must be a string");
2177
- } else if (path35[0] !== "/" && !(path35.startsWith("http://") || path35.startsWith("https://")) && method !== "CONNECT") {
2177
+ } else if (path36[0] !== "/" && !(path36.startsWith("http://") || path36.startsWith("https://")) && method !== "CONNECT") {
2178
2178
  throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
2179
- } else if (invalidPathRegex.test(path35)) {
2179
+ } else if (invalidPathRegex.test(path36)) {
2180
2180
  throw new InvalidArgumentError("invalid request path");
2181
2181
  }
2182
2182
  if (typeof method !== "string") {
@@ -2251,7 +2251,7 @@ var require_request = __commonJS({
2251
2251
  this.completed = false;
2252
2252
  this.aborted = false;
2253
2253
  this.upgrade = upgrade || null;
2254
- this.path = query ? serializePathWithQuery(path35, query) : path35;
2254
+ this.path = query ? serializePathWithQuery(path36, query) : path36;
2255
2255
  this.origin = origin;
2256
2256
  this.protocol = getProtocolFromUrlString(origin);
2257
2257
  this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
@@ -7495,7 +7495,7 @@ var require_client_h1 = __commonJS({
7495
7495
  }
7496
7496
  }
7497
7497
  function writeH1(client, request2) {
7498
- const { method, path: path35, host, upgrade, blocking, reset } = request2;
7498
+ const { method, path: path36, host, upgrade, blocking, reset } = request2;
7499
7499
  let { body, headers, contentLength } = request2;
7500
7500
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
7501
7501
  if (util.isFormDataLike(body)) {
@@ -7571,7 +7571,7 @@ var require_client_h1 = __commonJS({
7571
7571
  socket[kBlocking] = true;
7572
7572
  }
7573
7573
  setTypeOfService(socket, request2);
7574
- let header = `${method} ${path35} HTTP/1.1\r
7574
+ let header = `${method} ${path36} HTTP/1.1\r
7575
7575
  `;
7576
7576
  if (typeof host === "string") {
7577
7577
  header += `host: ${host}\r
@@ -8248,7 +8248,7 @@ var require_client_h2 = __commonJS({
8248
8248
  const headersTimeout = request2.headersTimeout ?? client[kHeadersTimeout];
8249
8249
  const bodyTimeout = request2.bodyTimeout ?? client[kBodyTimeout];
8250
8250
  const session = client[kHTTP2Session];
8251
- const { method, path: path35, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request2;
8251
+ const { method, path: path36, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request2;
8252
8252
  let { body } = request2;
8253
8253
  if (upgrade != null && upgrade !== "websocket") {
8254
8254
  util.errorRequest(client, request2, new InvalidArgumentError(`Custom upgrade "${upgrade}" not supported over HTTP/2`));
@@ -8317,7 +8317,7 @@ var require_client_h2 = __commonJS({
8317
8317
  }
8318
8318
  headers[HTTP2_HEADER_METHOD] = "CONNECT";
8319
8319
  headers[HTTP2_HEADER_PROTOCOL] = "websocket";
8320
- headers[HTTP2_HEADER_PATH] = path35;
8320
+ headers[HTTP2_HEADER_PATH] = path36;
8321
8321
  if (protocol === "ws:" || protocol === "wss:") {
8322
8322
  headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
8323
8323
  } else {
@@ -8369,7 +8369,7 @@ var require_client_h2 = __commonJS({
8369
8369
  stream.setTimeout(headersTimeout);
8370
8370
  return true;
8371
8371
  }
8372
- headers[HTTP2_HEADER_PATH] = path35;
8372
+ headers[HTTP2_HEADER_PATH] = path36;
8373
8373
  headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
8374
8374
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
8375
8375
  if (body && typeof body.read === "function") {
@@ -10725,10 +10725,10 @@ var require_proxy_agent = __commonJS({
10725
10725
  };
10726
10726
  const {
10727
10727
  origin,
10728
- path: path35 = "/",
10728
+ path: path36 = "/",
10729
10729
  headers = {}
10730
10730
  } = opts;
10731
- opts.path = origin + path35;
10731
+ opts.path = origin + path36;
10732
10732
  if (!("host" in headers) && !("Host" in headers)) {
10733
10733
  const { host } = new URL(origin);
10734
10734
  headers.host = host;
@@ -12888,20 +12888,20 @@ var require_mock_utils = __commonJS({
12888
12888
  }
12889
12889
  return normalizedQp;
12890
12890
  }
12891
- function safeUrl(path35) {
12892
- if (typeof path35 !== "string") {
12893
- return path35;
12891
+ function safeUrl(path36) {
12892
+ if (typeof path36 !== "string") {
12893
+ return path36;
12894
12894
  }
12895
- const pathSegments = path35.split("?", 3);
12895
+ const pathSegments = path36.split("?", 3);
12896
12896
  if (pathSegments.length !== 2) {
12897
- return path35;
12897
+ return path36;
12898
12898
  }
12899
12899
  const qp = new URLSearchParams(pathSegments.pop());
12900
12900
  qp.sort();
12901
12901
  return [...pathSegments, qp.toString()].join("?");
12902
12902
  }
12903
- function matchKey(mockDispatch2, { path: path35, method, body, headers }) {
12904
- const pathMatch = matchValue(mockDispatch2.path, path35);
12903
+ function matchKey(mockDispatch2, { path: path36, method, body, headers }) {
12904
+ const pathMatch = matchValue(mockDispatch2.path, path36);
12905
12905
  const methodMatch = matchValue(mockDispatch2.method, method);
12906
12906
  const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
12907
12907
  const headersMatch = matchHeaders(mockDispatch2, headers);
@@ -12926,8 +12926,8 @@ var require_mock_utils = __commonJS({
12926
12926
  const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
12927
12927
  const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
12928
12928
  const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
12929
- let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path35, ignoreTrailingSlash }) => {
12930
- return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path35)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path35), resolvedPath);
12929
+ let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path36, ignoreTrailingSlash }) => {
12930
+ return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path36)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path36), resolvedPath);
12931
12931
  });
12932
12932
  if (matchedMockDispatches.length === 0) {
12933
12933
  throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
@@ -12966,19 +12966,19 @@ var require_mock_utils = __commonJS({
12966
12966
  mockDispatches.splice(index, 1);
12967
12967
  }
12968
12968
  }
12969
- function removeTrailingSlash(path35) {
12970
- while (path35.endsWith("/")) {
12971
- path35 = path35.slice(0, -1);
12969
+ function removeTrailingSlash(path36) {
12970
+ while (path36.endsWith("/")) {
12971
+ path36 = path36.slice(0, -1);
12972
12972
  }
12973
- if (path35.length === 0) {
12974
- path35 = "/";
12973
+ if (path36.length === 0) {
12974
+ path36 = "/";
12975
12975
  }
12976
- return path35;
12976
+ return path36;
12977
12977
  }
12978
12978
  function buildKey(opts) {
12979
- const { path: path35, method, body, headers, query } = opts;
12979
+ const { path: path36, method, body, headers, query } = opts;
12980
12980
  return {
12981
- path: path35,
12981
+ path: path36,
12982
12982
  method,
12983
12983
  body,
12984
12984
  headers,
@@ -13668,10 +13668,10 @@ var require_pending_interceptors_formatter = __commonJS({
13668
13668
  }
13669
13669
  format(pendingInterceptors) {
13670
13670
  const withPrettyHeaders = pendingInterceptors.map(
13671
- ({ method, path: path35, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
13671
+ ({ method, path: path36, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
13672
13672
  Method: method,
13673
13673
  Origin: origin,
13674
- Path: path35,
13674
+ Path: path36,
13675
13675
  "Status code": statusCode,
13676
13676
  Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
13677
13677
  Invocations: timesInvoked,
@@ -13753,9 +13753,9 @@ var require_mock_agent = __commonJS({
13753
13753
  const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
13754
13754
  const dispatchOpts = { ...opts };
13755
13755
  if (acceptNonStandardSearchParameters && dispatchOpts.path) {
13756
- const [path35, searchParams] = dispatchOpts.path.split("?");
13756
+ const [path36, searchParams] = dispatchOpts.path.split("?");
13757
13757
  const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
13758
- dispatchOpts.path = `${path35}?${normalizedSearchParams}`;
13758
+ dispatchOpts.path = `${path36}?${normalizedSearchParams}`;
13759
13759
  }
13760
13760
  return this[kAgent].dispatch(dispatchOpts, handler);
13761
13761
  }
@@ -14156,12 +14156,12 @@ var require_snapshot_recorder = __commonJS({
14156
14156
  * @return {Promise<void>} - Resolves when snapshots are loaded
14157
14157
  */
14158
14158
  async loadSnapshots(filePath) {
14159
- const path35 = filePath || this.#snapshotPath;
14160
- if (!path35) {
14159
+ const path36 = filePath || this.#snapshotPath;
14160
+ if (!path36) {
14161
14161
  throw new InvalidArgumentError("Snapshot path is required");
14162
14162
  }
14163
14163
  try {
14164
- const data = await readFile(resolve2(path35), "utf8");
14164
+ const data = await readFile(resolve2(path36), "utf8");
14165
14165
  const parsed = JSON.parse(data);
14166
14166
  if (Array.isArray(parsed)) {
14167
14167
  this.#snapshots.clear();
@@ -14175,7 +14175,7 @@ var require_snapshot_recorder = __commonJS({
14175
14175
  if (error.code === "ENOENT") {
14176
14176
  this.#snapshots.clear();
14177
14177
  } else {
14178
- throw new UndiciError(`Failed to load snapshots from ${path35}`, { cause: error });
14178
+ throw new UndiciError(`Failed to load snapshots from ${path36}`, { cause: error });
14179
14179
  }
14180
14180
  }
14181
14181
  }
@@ -14186,11 +14186,11 @@ var require_snapshot_recorder = __commonJS({
14186
14186
  * @returns {Promise<void>} - Resolves when snapshots are saved
14187
14187
  */
14188
14188
  async saveSnapshots(filePath) {
14189
- const path35 = filePath || this.#snapshotPath;
14190
- if (!path35) {
14189
+ const path36 = filePath || this.#snapshotPath;
14190
+ if (!path36) {
14191
14191
  throw new InvalidArgumentError("Snapshot path is required");
14192
14192
  }
14193
- const resolvedPath = resolve2(path35);
14193
+ const resolvedPath = resolve2(path36);
14194
14194
  await mkdir(dirname(resolvedPath), { recursive: true });
14195
14195
  const data = Array.from(this.#snapshots.entries()).map(([hash, snapshot]) => ({
14196
14196
  hash,
@@ -14831,15 +14831,15 @@ var require_redirect_handler = __commonJS({
14831
14831
  receivedAt: Date.now()
14832
14832
  });
14833
14833
  const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
14834
- const path35 = search ? `${pathname}${search}` : pathname;
14835
- const redirectUrlString = `${origin}${path35}`;
14834
+ const path36 = search ? `${pathname}${search}` : pathname;
14835
+ const redirectUrlString = `${origin}${path36}`;
14836
14836
  for (const historyUrl of this.history) {
14837
14837
  if (historyUrl.toString() === redirectUrlString) {
14838
14838
  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.`);
14839
14839
  }
14840
14840
  }
14841
14841
  this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
14842
- this.opts.path = path35;
14842
+ this.opts.path = path36;
14843
14843
  this.opts.origin = origin;
14844
14844
  this.opts.query = null;
14845
14845
  }
@@ -16656,10 +16656,10 @@ var require_cache_handler = __commonJS({
16656
16656
  }
16657
16657
  return locationUrl.pathname + locationUrl.search;
16658
16658
  }
16659
- function deleteCachedUri(store, cacheKey, path35) {
16659
+ function deleteCachedUri(store, cacheKey, path36) {
16660
16660
  deleteCachedValue(store, {
16661
16661
  ...cacheKey,
16662
- path: path35
16662
+ path: path36
16663
16663
  });
16664
16664
  for (let i = 0; i < util.safeHTTPMethods.length; i++) {
16665
16665
  const method = util.safeHTTPMethods[i];
@@ -16667,7 +16667,7 @@ var require_cache_handler = __commonJS({
16667
16667
  deleteCachedValue(store, {
16668
16668
  ...cacheKey,
16669
16669
  method,
16670
- path: path35
16670
+ path: path36
16671
16671
  });
16672
16672
  }
16673
16673
  }
@@ -16678,9 +16678,9 @@ var require_cache_handler = __commonJS({
16678
16678
  }
16679
16679
  const values = Array.isArray(headerValue) ? headerValue : [headerValue];
16680
16680
  for (let i = 0; i < values.length; i++) {
16681
- const path35 = getSameOriginPath(cacheKey, values[i]);
16682
- if (path35 !== void 0) {
16683
- deleteCachedUri(store, cacheKey, path35);
16681
+ const path36 = getSameOriginPath(cacheKey, values[i]);
16682
+ if (path36 !== void 0) {
16683
+ deleteCachedUri(store, cacheKey, path36);
16684
16684
  }
16685
16685
  }
16686
16686
  }
@@ -22168,11 +22168,11 @@ var require_fetch = __commonJS({
22168
22168
  function dispatch({ body }) {
22169
22169
  const url = requestCurrentURL(request2);
22170
22170
  const agent = fetchParams.controller.dispatcher;
22171
- const path35 = url.pathname + url.search;
22171
+ const path36 = url.pathname + url.search;
22172
22172
  const hasTrailingQuestionMark = url.search.length === 0 && url.href[url.href.length - url.hash.length - 1] === "?";
22173
22173
  return new Promise((resolve2, reject) => agent.dispatch(
22174
22174
  {
22175
- path: hasTrailingQuestionMark ? `${path35}?` : path35,
22175
+ path: hasTrailingQuestionMark ? `${path36}?` : path36,
22176
22176
  origin: url.origin,
22177
22177
  method: request2.method,
22178
22178
  body: agent.isMockActive ? request2.body && (request2.body.source || request2.body.stream) : body,
@@ -23119,9 +23119,9 @@ var require_util4 = __commonJS({
23119
23119
  }
23120
23120
  }
23121
23121
  }
23122
- function validateCookiePath(path35) {
23123
- for (let i = 0; i < path35.length; ++i) {
23124
- const code = path35.charCodeAt(i);
23122
+ function validateCookiePath(path36) {
23123
+ for (let i = 0; i < path36.length; ++i) {
23124
+ const code = path36.charCodeAt(i);
23125
23125
  if (code < 32 || // exclude CTLs (0-31)
23126
23126
  code > 126 || // exclude DEL and non-ascii
23127
23127
  code === 59) {
@@ -26557,11 +26557,11 @@ var require_undici = __commonJS({
26557
26557
  if (typeof opts.path !== "string") {
26558
26558
  throw new InvalidArgumentError("invalid opts.path");
26559
26559
  }
26560
- let path35 = opts.path;
26560
+ let path36 = opts.path;
26561
26561
  if (!opts.path.startsWith("/")) {
26562
- path35 = `/${path35}`;
26562
+ path36 = `/${path36}`;
26563
26563
  }
26564
- url = new URL(util.parseOrigin(url).origin + path35);
26564
+ url = new URL(util.parseOrigin(url).origin + path36);
26565
26565
  } else {
26566
26566
  if (!opts) {
26567
26567
  opts = typeof url === "object" ? url : {};
@@ -26680,7 +26680,7 @@ try {
26680
26680
  }
26681
26681
 
26682
26682
  // src/launcher-main.ts
26683
- import path34 from "node:path";
26683
+ import path35 from "node:path";
26684
26684
  import { fileURLToPath as fileURLToPath3 } from "node:url";
26685
26685
 
26686
26686
  // src/home.ts
@@ -26903,8 +26903,8 @@ function saveAlphaUpdates(value) {
26903
26903
  }
26904
26904
 
26905
26905
  // src/protocol.ts
26906
- var VERSION = true ? "0.6.86" : "0.0.0";
26907
- var AKB_VERSION = true ? "0.11.69" : "0.0.0";
26906
+ var VERSION = true ? "0.6.88" : "0.0.0";
26907
+ var AKB_VERSION = true ? "0.11.71" : "0.0.0";
26908
26908
  var EXIT_REFUSED = 10;
26909
26909
  var EXIT_OUTDATED = 11;
26910
26910
  var EXIT_UPDATE = 12;
@@ -27487,7 +27487,6 @@ import path4 from "node:path";
27487
27487
  var STUDIO_FILE = "STUDIO.md";
27488
27488
  var MCP_FILE = "mcp.json";
27489
27489
  var CARD_TEMPLATE_FILE = "CARD.md";
27490
- var SHARED_DIR = "shared/";
27491
27490
  var VERSION_FILE = "version.json";
27492
27491
  var KB = 1024;
27493
27492
  var FILE_LIMITS = { file: 2 * KB * KB, total: 2 * KB * KB, count: 500, path: 512 };
@@ -27632,32 +27631,12 @@ var OFFICIAL = path5.dirname(fileURLToPath(import.meta.url));
27632
27631
  var dirs = (dir) => fs5.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name).sort();
27633
27632
  var hashOf = (files) => crypto4.createHash("sha256").update(hashInput(files)).digest("hex");
27634
27633
  function packOfficial(root2 = OFFICIAL, loose = false) {
27635
- const agentsDir = path5.join(root2, "agents");
27636
- const agentFiles = Object.fromEntries(dirs(agentsDir).map((name) => {
27637
- const dir = path5.join(agentsDir, name);
27638
- return [name, readStudioFolder(dir)];
27639
- }));
27640
- for (const [name, own2] of Object.entries(loose ? {} : agentFiles)) {
27641
- const read2 = parseSpecAgent(own2["AGENT.md"] ?? "", `official/agents/${name}/AGENT.md`, (p) => own2[p] ?? null, true);
27642
- if ("problem" in read2) throw new Error(read2.problem);
27643
- }
27644
27634
  const studiosDir = path5.join(root2, "studios");
27645
27635
  return dirs(studiosDir).map((folder) => {
27646
- const dir = path5.join(studiosDir, folder);
27647
- const files = {};
27648
- for (const f of filesOf(dir).sort()) {
27649
- if (f === STUDIO_FILE || f === CARD_TEMPLATE_FILE || f === MCP_FILE || f.startsWith("skills/") || f.startsWith(SHARED_DIR) || isAboutFile(f)) files[f] = readStudioFile(dir, f);
27650
- }
27651
- const read2 = checkStudioFiles({ [STUDIO_FILE]: files[STUDIO_FILE], ...Object.fromEntries(
27652
- Object.entries(agentFiles).flatMap(([name, own2]) => Object.entries(own2).map(([f, t2]) => [`agents/${name}/${f}`, t2]))
27653
- ) });
27654
- if (!read2.ok && !loose) throw new Error(`official/studios/${folder}: ${read2.file}: ${read2.reason}`);
27636
+ const files = readStudioFolder(path5.join(studiosDir, folder));
27655
27637
  const parsed = parseStudioFile(folder, files[STUDIO_FILE] ?? "", STUDIO_FILE);
27656
27638
  if ("problem" in parsed) throw new Error(parsed.problem);
27657
27639
  const def = parsed.def;
27658
- for (const name of [...new Set([...def.previews, ...def.land, ...def.scheduled].map((h) => h.agent))].sort()) {
27659
- for (const [f, text3] of Object.entries(agentFiles[name] ?? {})) files[`agents/${name}/${f}`] = text3;
27660
- }
27661
27640
  const checked = loose ? { ok: true } : checkStudioFiles(files, true);
27662
27641
  if (!checked.ok) throw new Error(`official/studios/${folder}: ${checked.file}: ${checked.reason}`);
27663
27642
  if (!def.names?.zh && !loose) throw new Error(`official/studios/${folder}/${STUDIO_FILE}: add its Chinese name under \`names: zh\``);
@@ -28417,7 +28396,7 @@ var FILE_TIMEOUT_MS = 10 * 6e4;
28417
28396
  var readRunner = () => request("GET", "/v1/runner");
28418
28397
  var q = encodeURIComponent;
28419
28398
  var listFolders = (machineId2) => request("GET", `/v1/runner/folders?machine=${q(machineId2)}`);
28420
- var addFolder = (machineId2, name, path35, project) => request("POST", "/v1/runner/folders", { machineId: machineId2, name, path: path35, ...project ? { project } : {} });
28399
+ var addFolder = (machineId2, name, path36, project) => request("POST", "/v1/runner/folders", { machineId: machineId2, name, path: path36, ...project ? { project } : {} });
28421
28400
  async function createProject(name, workspace, key) {
28422
28401
  const sent = await send("POST", "/v1/projects", { name, workspace }, true, TIMEOUT_MS2, void 0, { "idempotency-key": key });
28423
28402
  return sent.ok ? answerOf(sent.value) : sent;
@@ -29093,7 +29072,7 @@ async function startSettingsServer(action, port = 0) {
29093
29072
  // src/settings.ts
29094
29073
  import crypto9 from "node:crypto";
29095
29074
  import fs29 from "node:fs";
29096
- import path33 from "node:path";
29075
+ import path34 from "node:path";
29097
29076
 
29098
29077
  // src/kanban-skill.ts
29099
29078
  import { spawnSync as spawnSync2 } from "node:child_process";
@@ -29152,11 +29131,11 @@ function retireKanbanSkill(dir) {
29152
29131
  import { spawn as spawn5 } from "node:child_process";
29153
29132
  import fs27 from "node:fs";
29154
29133
  import os6 from "node:os";
29155
- import path30 from "node:path";
29134
+ import path31 from "node:path";
29156
29135
 
29157
29136
  // ../cli/src/lib/agent/harnesses/antigravity.ts
29158
29137
  import fs22 from "node:fs";
29159
- import path24 from "node:path";
29138
+ import path25 from "node:path";
29160
29139
  import { createHash as createHash3 } from "node:crypto";
29161
29140
  import { spawnSync as spawnSync4 } from "node:child_process";
29162
29141
 
@@ -29517,8 +29496,7 @@ function modelsIn(file2, pick2, salt = "") {
29517
29496
  const stat = statSync(file2);
29518
29497
  stamp2 = `${stat.mtimeMs}:${stat.size}:${salt}`;
29519
29498
  } catch {
29520
- cached.delete(file2);
29521
- return [];
29499
+ return cached.get(file2)?.found ?? [];
29522
29500
  }
29523
29501
  const hit = cached.get(file2);
29524
29502
  if (hit?.stamp === stamp2) return hit.found;
@@ -29528,8 +29506,8 @@ function modelsIn(file2, pick2, salt = "") {
29528
29506
  } catch {
29529
29507
  found = [];
29530
29508
  }
29531
- cached.set(file2, { stamp: stamp2, found });
29532
- return found;
29509
+ if (found.length) cached.set(file2, { stamp: stamp2, found });
29510
+ return found.length ? found : hit?.found ?? [];
29533
29511
  }
29534
29512
 
29535
29513
  // ../cli/src/lib/agent/harnesses/types.ts
@@ -29567,6 +29545,55 @@ function machineFile(name, text3) {
29567
29545
  return file2;
29568
29546
  }
29569
29547
 
29548
+ // ../cli/src/lib/agent/harnesses/transient.ts
29549
+ var MANUAL = [
29550
+ /\b(401|403)\b/,
29551
+ /unauthorized|forbidden|permission (?:denied|required|check failed)|permission_denied|soft.denied|auto-denied|权限拒绝/,
29552
+ /authenticat|invalid api key|api[_ ]key|not (?:logged|signed) in|please (?:log|sign) in|\/login|oauth/,
29553
+ /\b429\b/,
29554
+ /rate[ _-]?limit|usage limit|quota|credits?|insufficient|out of tokens|resource[ _-]?exhausted/,
29555
+ /cancell?ed|aborted by|interrupted by the user/,
29556
+ /maximum budget|max(imum)? turns|exceeded the budget/,
29557
+ /model not found|unknown model|invalid model|model (?:is )?unavailable|model[^\n]+ is (?:unavailable|not recognized)|unsupported|invalid[_ ]request/
29558
+ ];
29559
+ var PASSING = [
29560
+ // 502/503/529 are distinctive enough to read as a status wherever they appear. A bare
29561
+ // 500 is not — a failure line counting something would match it — so it is left to the
29562
+ // words below, which is how that status is actually written out.
29563
+ /\b(502|503|529)\b/,
29564
+ /overloaded|service unavailable|bad gateway|internal server error|server_error/,
29565
+ /connection (lost|dropped|reset|error|closed)|socket hang up|stream (error|disconnected)/,
29566
+ /econnreset|econnrefused|etimedout|enetunreach|enotfound|eai_again/,
29567
+ /fetch failed|request timed out|network error/,
29568
+ /rpc error: code = (?:unavailable|deadlineexceeded)\b|deadline_exceeded|dial tcp[^\n]*(?:timeout|refused|no such host)/
29569
+ ];
29570
+ var RETRY_AFTER = /retry[-_\s]?after["':=\s]+(\d+)/i;
29571
+ var REASON_MAX = 140;
29572
+ function reasonLine(text3, rule) {
29573
+ const line = text3.split("\n").find((l) => rule.test(l.toLowerCase())) ?? text3;
29574
+ const said = line.trim().replace(/\s+/g, " ");
29575
+ return said.length > REASON_MAX ? `${said.slice(0, REASON_MAX - 1)}\u2026` : said;
29576
+ }
29577
+ function manualFailure(text3) {
29578
+ return MANUAL.some((rule) => rule.test(text3.toLowerCase()));
29579
+ }
29580
+ function providerBlip(...said) {
29581
+ for (const text3 of said) {
29582
+ if (!text3?.trim()) continue;
29583
+ const lower = text3.toLowerCase();
29584
+ if (manualFailure(text3)) return void 0;
29585
+ const hit = PASSING.find((rule) => rule.test(lower));
29586
+ if (!hit) continue;
29587
+ const asked = RETRY_AFTER.exec(text3);
29588
+ const seconds = asked ? Number(asked[1]) : NaN;
29589
+ return {
29590
+ reason: reasonLine(text3, hit),
29591
+ ...Number.isFinite(seconds) && seconds > 0 ? { retryAfterMs: seconds * 1e3 } : {}
29592
+ };
29593
+ }
29594
+ return void 0;
29595
+ }
29596
+
29570
29597
  // ../cli/src/lib/machine/settings.ts
29571
29598
  import fs21 from "node:fs";
29572
29599
  import path23 from "node:path";
@@ -29611,6 +29638,58 @@ function runLanguage() {
29611
29638
  }
29612
29639
  var translating = () => runLanguage() === "zh";
29613
29640
 
29641
+ // ../cli/src/lib/agent/wire/antigravity.ts
29642
+ import path24 from "node:path";
29643
+
29644
+ // ../cli/src/lib/agent/prices.ts
29645
+ var OPENAI = {
29646
+ "gpt-6.1-sol": { input: 2, cachedInput: 0.1, output: 10 },
29647
+ "gpt-6-astra": { input: 10, cachedInput: 1, output: 50 },
29648
+ "gpt-6-sol": { input: 2, cachedInput: 0.2, output: 10 },
29649
+ "gpt-6-luna": { input: 0.1, cachedInput: 0.01, output: 0.5 },
29650
+ "gpt-5.6-sol": { input: 4, cachedInput: 0.4, output: 20 },
29651
+ "gpt-5.6-terra": { input: 2, cachedInput: 0.2, output: 12 },
29652
+ "gpt-5.6-luna": { input: 0.2, cachedInput: 0.02, output: 1.2 },
29653
+ "gpt-5.5": { input: 5, cachedInput: 0.5, output: 30 },
29654
+ "gpt-5.5-pro": { input: 30, cachedInput: 30, output: 180 },
29655
+ "gpt-5.4": { input: 2.5, cachedInput: 0.25, output: 15 },
29656
+ "gpt-5.4-mini": { input: 0.75, cachedInput: 0.075, output: 4.5 },
29657
+ "gpt-5.4-nano": { input: 0.2, cachedInput: 0.02, output: 1.25 },
29658
+ "gpt-5.4-pro": { input: 30, cachedInput: 30, output: 180 },
29659
+ "gpt-5.3-codex": { input: 1.75, cachedInput: 0.175, output: 14 },
29660
+ "gpt-5.2": { input: 1.75, cachedInput: 0.175, output: 14 },
29661
+ "gpt-5.2-pro": { input: 21, cachedInput: 21, output: 168 },
29662
+ "gpt-5.1": { input: 1.25, cachedInput: 0.125, output: 10 },
29663
+ "gpt-5": { input: 1.25, cachedInput: 0.125, output: 10 },
29664
+ "gpt-5-mini": { input: 0.25, cachedInput: 0.025, output: 2 },
29665
+ "gpt-5-nano": { input: 0.05, cachedInput: 5e-3, output: 0.4 },
29666
+ "gpt-5-pro": { input: 15, cachedInput: 15, output: 120 }
29667
+ };
29668
+ function antigravityPrices(at) {
29669
+ const pro = at < Date.parse("2026-12-01T00:00:00Z") ? 2 : 4;
29670
+ const flash = at < Date.parse("2027-01-01T00:00:00Z") ? 0.75 : 1.5;
29671
+ return {
29672
+ "gemini-4-carbon": { input: pro, cachedInput: pro / 20, output: pro * 5 },
29673
+ "gemini-4-argon": { input: pro, cachedInput: pro / 20, output: pro * 5 },
29674
+ "gemini-4-hydrogen": { input: 1.5, cachedInput: 0.075, output: 7.5 },
29675
+ "gemini-3.8-flash": { input: flash, cachedInput: flash / 10, output: flash * 5 }
29676
+ };
29677
+ }
29678
+ var PRICES = { openai: OPENAI, "openai-api": OPENAI };
29679
+ function lookUp(table, model) {
29680
+ const id = model.trim().toLowerCase().replace(/^[^/]+\//, "");
29681
+ return table[id] ?? table[id.replace(/-\d{4}-\d{2}-\d{2}$/, "")];
29682
+ }
29683
+ function priceUsd(provider, model, usage, at = Date.now()) {
29684
+ if (!provider || !model || !usage) return void 0;
29685
+ const agy = provider.trim().toLowerCase() === "antigravity";
29686
+ const table = agy ? antigravityPrices(at) : PRICES[provider.trim().toLowerCase()];
29687
+ const price = table && (agy ? table[model.trim().toLowerCase().replace(/-(?:low|medium|high|xhigh|max)$/, "")] : lookUp(table, model));
29688
+ if (!price) return void 0;
29689
+ const usd = ((usage.input + usage.cacheCreation) * price.input + usage.cacheRead * price.cachedInput + usage.output * price.output) / 1e6;
29690
+ return Number.isFinite(usd) && usd >= 0 ? usd : void 0;
29691
+ }
29692
+
29614
29693
  // ../cli/src/lib/agent/wire/events.ts
29615
29694
  var TOOL_KINDS = ["read", "edit", "delete", "move", "search", "execute", "fetch", "other"];
29616
29695
  var toolKind = (v) => TOOL_KINDS.includes(str2(v)) ? v : "other";
@@ -29799,6 +29878,7 @@ var KINDS = {
29799
29878
  run_command: "execute",
29800
29879
  command_status: "execute",
29801
29880
  send_command_input: "execute",
29881
+ read_file: "read",
29802
29882
  view_file: "read",
29803
29883
  list_dir: "read",
29804
29884
  grep_search: "search",
@@ -29822,14 +29902,39 @@ function failureHint(reason) {
29822
29902
  return hint2 ? `${reason}
29823
29903
  ${hint2}` : reason;
29824
29904
  }
29825
- function createAntigravityRenderer(expectedSession) {
29905
+ 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);
29906
+ var imagePath = (target) => /\.(?:png|jpe?g|gif|webp|bmp|tiff?|svg)$/i.test(target);
29907
+ function createAntigravityRenderer(expectedSession, cwd = process.cwd()) {
29826
29908
  let session = expectedSession;
29827
29909
  let model;
29910
+ let partial = "";
29828
29911
  let final;
29829
29912
  let failure2;
29913
+ let rateLimit;
29914
+ let imageFailure;
29915
+ let requiredImages = [];
29916
+ const readImages = /* @__PURE__ */ new Set();
29917
+ const imageErrors = /* @__PURE__ */ new Map();
29918
+ const imageError = (target, reason) => translating() ? `Antigravity \u65E0\u6CD5\u8BFB\u53D6\u56FE\u7247 ${target}\uFF1A${reason}` : `Antigravity could not read image ${target}: ${reason}`;
29830
29919
  let terminal = false;
29831
29920
  let offStream;
29832
29921
  let stderr = "";
29922
+ let context;
29923
+ let contextStep = -1;
29924
+ const started = Date.now();
29925
+ let cost;
29926
+ let incomplete = false;
29927
+ const priced = /* @__PURE__ */ new Set();
29928
+ const countCost = (step) => {
29929
+ const index = step.step_index;
29930
+ if (typeof index !== "number" || !Number.isSafeInteger(index) || index < 0 || priced.has(index)) return;
29931
+ priced.add(index);
29932
+ const u = obj(step.usage);
29933
+ const valid = [u.input_tokens, u.output_tokens, u.cache_read_tokens].every((n) => typeof n === "number" && Number.isFinite(n) && n >= 0);
29934
+ const usd = valid ? priceUsd("antigravity", model, usageOf(u), started) : void 0;
29935
+ if (usd === void 0) incomplete = true;
29936
+ else cost = (cost ?? 0) + usd;
29937
+ };
29833
29938
  let used;
29834
29939
  let turnUsage = zero();
29835
29940
  let previous;
@@ -29838,6 +29943,8 @@ function createAntigravityRenderer(expectedSession) {
29838
29943
  const closed = /* @__PURE__ */ new Set();
29839
29944
  const events = createEventCollector();
29840
29945
  const fail = (reason) => {
29946
+ if (limited(reason)) rateLimit = failureHint(reason);
29947
+ if (failure2 && manualFailure(failure2) && !(limited(failure2) && limited(reason))) return;
29841
29948
  failure2 = failureHint(reason);
29842
29949
  events.error(failure2);
29843
29950
  };
@@ -29845,6 +29952,7 @@ function createAntigravityRenderer(expectedSession) {
29845
29952
  const e = frame(line);
29846
29953
  if (!e) {
29847
29954
  offStream = line.trim() || offStream;
29955
+ if (/^(?:error:|rpc error:)/i.test(line.trim()) && limited(line)) fail(line.trim());
29848
29956
  return `${line}
29849
29957
  `;
29850
29958
  }
@@ -29863,10 +29971,19 @@ function createAntigravityRenderer(expectedSession) {
29863
29971
  if (expectedSession && str2(step.conversation_id) !== expectedSession) return "";
29864
29972
  session = str2(step.conversation_id) || session;
29865
29973
  const id = String(step.step_index ?? "");
29974
+ if (step.state === "DONE" && ["agent_response", "checkpoint"].includes(str2(step.step_type))) countCost(step);
29866
29975
  if (step.step_type === "agent_response") {
29867
29976
  const text3 = str2(step.text_delta);
29977
+ partial += text3;
29868
29978
  if (text3) events.update({ sessionUpdate: "agent_message_chunk", content: { text: text3 } });
29869
29979
  const index = num(step.step_index);
29980
+ if (step.state === "DONE" && Number.isSafeInteger(index) && step.step_index === index && index > contextStep) {
29981
+ contextStep = index;
29982
+ const u = obj(step.usage);
29983
+ const counts = [u.input_tokens, u.cache_read_tokens];
29984
+ const prompt = counts.every((n) => typeof n === "number" && Number.isFinite(n) && n >= 0) ? num(u.input_tokens) + num(u.cache_read_tokens) : 0;
29985
+ context = prompt > 0 && Number.isFinite(prompt) ? { used: prompt } : void 0;
29986
+ }
29870
29987
  if (step.state === "DONE" && step.usage && !counted.has(index)) {
29871
29988
  counted.add(index);
29872
29989
  turnUsage = add(turnUsage, usageOf(step.usage));
@@ -29892,7 +30009,20 @@ function createAntigravityRenderer(expectedSession) {
29892
30009
  if (reason && /permission|denied|soft.den/i.test(reason)) fail(reason);
29893
30010
  if (["DONE", "ERROR", "CANCELED", "INTERRUPTED"].includes(str2(step.state)) && !closed.has(id)) {
29894
30011
  closed.add(id);
29895
- events.toolResult(id, reason || step.state !== "DONE" ? "failed" : "completed", str2(tool.output) || reason);
30012
+ const failed = !!reason || step.state !== "DONE";
30013
+ if (["read_file", "view_file"].includes(name) && imagePath(target)) {
30014
+ const file2 = path24.resolve(cwd, target);
30015
+ if (failed) {
30016
+ imageErrors.set(file2, reason || str2(step.state));
30017
+ out += `
30018
+ ${imageError(target, reason || str2(step.state))}
30019
+ `;
30020
+ } else {
30021
+ readImages.add(file2);
30022
+ imageErrors.delete(file2);
30023
+ }
30024
+ }
30025
+ events.toolResult(id, failed ? "failed" : "completed", str2(tool.output) || reason);
29896
30026
  }
29897
30027
  return out;
29898
30028
  }
@@ -29912,47 +30042,76 @@ function createAntigravityRenderer(expectedSession) {
29912
30042
  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;
29913
30043
  previous = total;
29914
30044
  if (!Object.values(used).some((n) => n > 0)) used = void 0;
30045
+ const missing = requiredImages.length ? requiredImages.filter((file2) => !readImages.has(file2)) : [...imageErrors.keys()];
30046
+ 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;
30047
+ if (imageFailure) events.error(imageFailure);
30048
+ readImages.clear();
30049
+ imageErrors.clear();
29915
30050
  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.");
29916
30051
  if (typeof result.response !== "string" || result.status !== "SUCCESS" || str2(result.error) || result.finished_reason && result.finished_reason !== "completed" && result.finished_reason !== "success") {
29917
- fail(str2(result.error) || `Antigravity: ${str2(result.status) || "missing status"}`);
30052
+ fail(result.status === "CANCELED" ? `Antigravity: CANCELED${result.error ? `: ${str2(result.error)}` : ""}` : str2(result.error) || `Antigravity: ${str2(result.status) || "missing status"}`);
29918
30053
  }
29919
30054
  events.end();
29920
30055
  turnUsage = zero();
29921
30056
  counted.clear();
29922
- return failure2 ? `
29923
- [error] ${failure2}
30057
+ return failure2 || imageFailure ? `
30058
+ [error] ${failure2 || imageFailure}
29924
30059
  ` : "";
29925
30060
  }
29926
30061
  return "";
29927
30062
  });
29928
30063
  return {
29929
30064
  push: reader.push,
30065
+ setRequiredImages(files) {
30066
+ requiredImages = files.filter(imagePath).map((file2) => path24.resolve(cwd, file2));
30067
+ },
29930
30068
  flush() {
29931
30069
  const text3 = reader.flush();
29932
- 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.");
30070
+ if (!terminal) {
30071
+ incomplete = true;
30072
+ const diagnostics = [stderr.trim(), offStream?.match(/^(?:error:|rpc error:)/i) ? offStream : void 0];
30073
+ const diagnostic = diagnostics.find((text4) => text4 && manualFailure(text4)) ?? diagnostics.find((text4) => text4 && providerBlip(text4));
30074
+ if (diagnostic) fail(diagnostic);
30075
+ if (!failure2) 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.");
30076
+ }
29933
30077
  events.end();
29934
30078
  return text3;
29935
30079
  },
29936
30080
  stderr(chunk) {
29937
30081
  stderr = (stderr + chunk).slice(-16e3);
30082
+ if (limited(stderr)) fail(stderr.trim());
29938
30083
  if (/soft.denied|auto-denied|permission (?:denied|required)|denied by.*(?:policy|rule)|requires? (?:user )?(?:approval|permission)/i.test(stderr)) fail(stderr.trim());
29939
30084
  },
29940
- result: () => final,
30085
+ result: () => final || (failure2 ? partial || void 0 : final),
29941
30086
  resumeId: () => session,
29942
30087
  model: () => model,
29943
30088
  usage: () => used,
29944
- failure: () => failure2,
30089
+ costUsd: () => cost,
30090
+ costIncomplete: () => incomplete || void 0,
30091
+ context: () => context,
30092
+ failure: () => failure2 || imageFailure,
30093
+ rateLimit: () => rateLimit,
29945
30094
  offStream: () => offStream,
29946
30095
  events: events.events
29947
30096
  };
29948
30097
  }
29949
30098
 
29950
30099
  // ../cli/src/lib/agent/harnesses/antigravity.ts
30100
+ var EFFORT_ID = /-(?:low|medium|high|xhigh|max)$/i;
30101
+ var EFFORT_NAME = /\s*\((?:low|medium|high|xhigh|max)\)$/i;
29951
30102
  function antigravityModels(output2) {
29952
- return output2.split("\n").flatMap((line) => {
30103
+ const seen = /* @__PURE__ */ new Set();
30104
+ const models = [];
30105
+ for (const line of output2.split("\n")) {
29953
30106
  const match = /^([^\s]+)\t(.+)$/.exec(line.trim());
29954
- return match ? [{ id: match[1], name: match[2] }] : [];
29955
- });
30107
+ if (!match) continue;
30108
+ const id = match[1].replace(EFFORT_ID, "");
30109
+ const name = match[2].replace(EFFORT_NAME, "").trim();
30110
+ if (seen.has(id)) continue;
30111
+ seen.add(id);
30112
+ models.push({ id, name });
30113
+ }
30114
+ return models;
29956
30115
  }
29957
30116
  function args(argv, resume) {
29958
30117
  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.");
@@ -29979,6 +30138,22 @@ var ANTIGRAVITY = {
29979
30138
  flags: ["--model"],
29980
30139
  placeholder: "model-id",
29981
30140
  help: "A model from agy models. Empty uses the CLI default; an invalid model fails the run."
30141
+ }, {
30142
+ key: "reasoning",
30143
+ agentOwned: true,
30144
+ label: "Reasoning effort",
30145
+ kind: "select",
30146
+ choices: [
30147
+ { value: "", label: "Agent's default" },
30148
+ { value: "low", label: "Low" },
30149
+ { value: "medium", label: "Medium" },
30150
+ { value: "high", label: "High" },
30151
+ { value: "xhigh", label: "Extra high (xhigh)" },
30152
+ { value: "max", label: "Max" }
30153
+ ],
30154
+ flags: ["--effort"],
30155
+ help: "Lower is quicker and cheaper, higher is slower and more careful.",
30156
+ overriddenHelp: `Not in effect: this agent's "command" in your ui.config.json already names an effort level, and that wins.`
29982
30157
  }],
29983
30158
  models() {
29984
30159
  const copy2 = locate(ANTIGRAVITY);
@@ -29988,18 +30163,19 @@ var ANTIGRAVITY = {
29988
30163
  return result.status === 0 ? antigravityModels(result.stdout ?? "").map((m) => m.id) : [];
29989
30164
  },
29990
30165
  env: () => ({ ...process.env }),
29991
- renderer: (_cwd, _binary, argv = []) => {
30166
+ images: { as: "message" },
30167
+ renderer: (cwd, _binary, argv = []) => {
29992
30168
  const at = argv.indexOf("--conversation");
29993
- return createAntigravityRenderer(at >= 0 ? argv[at + 1] : argv.find((a) => a.startsWith("--conversation="))?.slice(15));
30169
+ return createAntigravityRenderer(at >= 0 ? argv[at + 1] : argv.find((a) => a.startsWith("--conversation="))?.slice(15), cwd);
29994
30170
  },
29995
30171
  systemPrompt(text3, _argv, env2) {
29996
30172
  const rule = `${text3}
29997
30173
 
29998
30174
  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.`;
29999
30175
  const hash = createHash3("sha256").update(rule).digest("hex").slice(0, 16);
30000
- const root2 = path24.join(machineHome(), "prompts", `antigravity-${hash}`);
30001
- const file2 = path24.join(root2, ".agents", "rules", "language.md");
30002
- fs22.mkdirSync(path24.dirname(file2), { recursive: true });
30176
+ const root2 = path25.join(machineHome(), "prompts", `antigravity-${hash}`);
30177
+ const file2 = path25.join(root2, ".agents", "rules", "language.md");
30178
+ fs22.mkdirSync(path25.dirname(file2), { recursive: true });
30003
30179
  fs22.writeFileSync(file2, `---
30004
30180
  trigger: always_on
30005
30181
  ---
@@ -30008,10 +30184,11 @@ ${rule}
30008
30184
  `);
30009
30185
  return { args: ["--add-dir", root2] };
30010
30186
  },
30011
- reports: ["tokens", "model"],
30187
+ transient: ({ failure: failure2 }) => providerBlip(failure2),
30188
+ reports: ["cost", "tokens", "model", "context"],
30012
30189
  adoptsSessionId: false,
30013
- savesSessionAtOpen: false,
30014
- stopsOnRateLimit: false,
30190
+ savesSessionAtOpen: true,
30191
+ stopsOnRateLimit: true,
30015
30192
  // `models` is read-only. Only explicit authentication errors mean signed out.
30016
30193
  login: {
30017
30194
  args: ["models"],
@@ -30102,7 +30279,7 @@ function checkHarnesses(harnesses) {
30102
30279
  }
30103
30280
 
30104
30281
  // ../cli/src/lib/agent/harnesses/claude-code.ts
30105
- import path27 from "node:path";
30282
+ import path28 from "node:path";
30106
30283
 
30107
30284
  // ../cli/src/lib/agent/wire/claude-stream.ts
30108
30285
  var ARG_KEYS = ["command", "file_path", "path", "pattern", "description", "prompt", "query", "url"];
@@ -30347,44 +30524,6 @@ function createBackgroundWait(milliseconds, expired) {
30347
30524
  }
30348
30525
  var backgroundWaitMessage = (minutes) => `the agent's background tasks did not finish within ${minutes / 60} hours, so the run was ended.`;
30349
30526
 
30350
- // ../cli/src/lib/agent/prices.ts
30351
- var OPENAI = {
30352
- "gpt-6.1-sol": { input: 2, cachedInput: 0.1, output: 10 },
30353
- "gpt-6-astra": { input: 10, cachedInput: 1, output: 50 },
30354
- "gpt-6-sol": { input: 2, cachedInput: 0.2, output: 10 },
30355
- "gpt-6-luna": { input: 0.1, cachedInput: 0.01, output: 0.5 },
30356
- "gpt-5.6-sol": { input: 4, cachedInput: 0.4, output: 20 },
30357
- "gpt-5.6-terra": { input: 2, cachedInput: 0.2, output: 12 },
30358
- "gpt-5.6-luna": { input: 0.2, cachedInput: 0.02, output: 1.2 },
30359
- "gpt-5.5": { input: 5, cachedInput: 0.5, output: 30 },
30360
- "gpt-5.5-pro": { input: 30, cachedInput: 30, output: 180 },
30361
- "gpt-5.4": { input: 2.5, cachedInput: 0.25, output: 15 },
30362
- "gpt-5.4-mini": { input: 0.75, cachedInput: 0.075, output: 4.5 },
30363
- "gpt-5.4-nano": { input: 0.2, cachedInput: 0.02, output: 1.25 },
30364
- "gpt-5.4-pro": { input: 30, cachedInput: 30, output: 180 },
30365
- "gpt-5.3-codex": { input: 1.75, cachedInput: 0.175, output: 14 },
30366
- "gpt-5.2": { input: 1.75, cachedInput: 0.175, output: 14 },
30367
- "gpt-5.2-pro": { input: 21, cachedInput: 21, output: 168 },
30368
- "gpt-5.1": { input: 1.25, cachedInput: 0.125, output: 10 },
30369
- "gpt-5": { input: 1.25, cachedInput: 0.125, output: 10 },
30370
- "gpt-5-mini": { input: 0.25, cachedInput: 0.025, output: 2 },
30371
- "gpt-5-nano": { input: 0.05, cachedInput: 5e-3, output: 0.4 },
30372
- "gpt-5-pro": { input: 15, cachedInput: 15, output: 120 }
30373
- };
30374
- var PRICES = { openai: OPENAI, "openai-api": OPENAI };
30375
- function lookUp(table, model) {
30376
- const id = model.trim().toLowerCase().replace(/^[^/]+\//, "");
30377
- return table[id] ?? table[id.replace(/-\d{4}-\d{2}-\d{2}$/, "")];
30378
- }
30379
- function priceUsd(provider, model, usage) {
30380
- if (!provider || !model || !usage) return void 0;
30381
- const table = PRICES[provider.trim().toLowerCase()];
30382
- const price = table && lookUp(table, model);
30383
- if (!price) return void 0;
30384
- const usd = ((usage.input + usage.cacheCreation) * price.input + usage.cacheRead * price.cachedInput + usage.output * price.output) / 1e6;
30385
- return Number.isFinite(usd) && usd >= 0 ? usd : void 0;
30386
- }
30387
-
30388
30527
  // ../cli/src/lib/agent/wire/codex-session.ts
30389
30528
  import { readFileSync as readFileSync2, readdirSync, statSync as statSync2 } from "node:fs";
30390
30529
  import { homedir as homedir2 } from "node:os";
@@ -30448,10 +30587,10 @@ function findRollout(threadId) {
30448
30587
  }
30449
30588
  for (const name of names2) {
30450
30589
  if (!name.startsWith("rollout-") || !name.endsWith(tail)) continue;
30451
- const path35 = join2(dir, name);
30590
+ const path36 = join2(dir, name);
30452
30591
  try {
30453
- const at = statSync2(path35).mtimeMs;
30454
- if (!newest2 || at > newest2.at) newest2 = { path: path35, at };
30592
+ const at = statSync2(path36).mtimeMs;
30593
+ if (!newest2 || at > newest2.at) newest2 = { path: path36, at };
30455
30594
  } catch {
30456
30595
  }
30457
30596
  }
@@ -30459,11 +30598,11 @@ function findRollout(threadId) {
30459
30598
  return newest2?.path;
30460
30599
  }
30461
30600
  function readCodexRunFacts(threadId) {
30462
- const path35 = findRollout(threadId);
30463
- if (!path35) return void 0;
30601
+ const path36 = findRollout(threadId);
30602
+ if (!path36) return void 0;
30464
30603
  let raw;
30465
30604
  try {
30466
- raw = readFileSync2(path35, "utf8");
30605
+ raw = readFileSync2(path36, "utf8");
30467
30606
  } catch {
30468
30607
  return void 0;
30469
30608
  }
@@ -30575,8 +30714,8 @@ function renderCompleted(item) {
30575
30714
  const changes = Array.isArray(item.changes) ? item.changes : [];
30576
30715
  return changes.map((raw) => {
30577
30716
  const change = obj(raw);
30578
- const path35 = str2(change.path);
30579
- return path35 ? `\u23FA ${str2(change.kind) || "change"}(${path35})
30717
+ const path36 = str2(change.path);
30718
+ return path36 ? `\u23FA ${str2(change.kind) || "change"}(${path36})
30580
30719
  ` : "";
30581
30720
  }).join("");
30582
30721
  }
@@ -30892,10 +31031,10 @@ function readKimiRunFacts(sessionId) {
30892
31031
  const total = { input: 0, cacheCreation: 0, cacheRead: 0, output: 0 };
30893
31032
  let model;
30894
31033
  let holding = 0;
30895
- for (const { path: path35, main } of wireFiles(entry2.sessionDir)) {
31034
+ for (const { path: path36, main } of wireFiles(entry2.sessionDir)) {
30896
31035
  let raw;
30897
31036
  try {
30898
- raw = readFileSync3(path35, "utf8");
31037
+ raw = readFileSync3(path36, "utf8");
30899
31038
  } catch {
30900
31039
  continue;
30901
31040
  }
@@ -31053,11 +31192,11 @@ function createKimiStreamRenderer(cwd, resumeId) {
31053
31192
 
31054
31193
  // ../cli/src/lib/agent/wire/acp-cost.ts
31055
31194
  import fs23 from "node:fs";
31056
- import path25 from "node:path";
31195
+ import path26 from "node:path";
31057
31196
  import { createHash as createHash4 } from "node:crypto";
31058
31197
  function acpCostFile(tool, cwd, session) {
31059
31198
  const key = createHash4("sha256").update(JSON.stringify([tool, cwd, session])).digest("hex");
31060
- return path25.join(machineHome(), "usage", "acp", `${key}.json`);
31199
+ return path26.join(machineHome(), "usage", "acp", `${key}.json`);
31061
31200
  }
31062
31201
  function readAcpCost(file2) {
31063
31202
  try {
@@ -31070,7 +31209,7 @@ function readAcpCost(file2) {
31070
31209
  function saveAcpCost(file2, cost) {
31071
31210
  if (cost === void 0) return;
31072
31211
  try {
31073
- fs23.mkdirSync(path25.dirname(file2), { recursive: true, mode: 448 });
31212
+ fs23.mkdirSync(path26.dirname(file2), { recursive: true, mode: 448 });
31074
31213
  const tmp = `${file2}.${process.pid}.tmp`;
31075
31214
  fs23.writeFileSync(tmp, JSON.stringify(cost), { mode: 384 });
31076
31215
  fs23.renameSync(tmp, file2);
@@ -31131,7 +31270,7 @@ function createTail(log) {
31131
31270
  // ../cli/package.json
31132
31271
  var package_default = {
31133
31272
  name: "wildcrane",
31134
- version: "0.11.69",
31273
+ version: "0.11.71",
31135
31274
  akbContract: 17,
31136
31275
  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.",
31137
31276
  keywords: [
@@ -31205,8 +31344,8 @@ var CLIENT_CAPABILITIES = {
31205
31344
  };
31206
31345
  function whereHint(update3, title) {
31207
31346
  const locations = Array.isArray(update3.locations) ? update3.locations : [];
31208
- const path35 = str2(obj(locations[0]).path);
31209
- return path35 && !title.includes(path35) ? hint(path35) : "";
31347
+ const path36 = str2(obj(locations[0]).path);
31348
+ return path36 && !title.includes(path36) ? hint(path36) : "";
31210
31349
  }
31211
31350
  function saidBy(update3) {
31212
31351
  const content = Array.isArray(update3.content) ? update3.content : [];
@@ -31388,9 +31527,9 @@ async function oneTurn(io, options) {
31388
31527
  }
31389
31528
  let model = modelOf(opened);
31390
31529
  if (options.model) {
31391
- const listed2 = obj(opened.models).currentModelId !== void 0;
31392
- const picked = listed2 ? pickedModel(opened, options.model) : void 0;
31393
- 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.");
31530
+ const listed = obj(opened.models).currentModelId !== void 0;
31531
+ const picked = listed ? pickedModel(opened, options.model) : void 0;
31532
+ 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.");
31394
31533
  model = picked?.name ?? modelOf(set) ?? options.model;
31395
31534
  }
31396
31535
  if (model) io.gotModel(model);
@@ -31479,7 +31618,7 @@ function decide(params, tail, events) {
31479
31618
  }
31480
31619
 
31481
31620
  // ../cli/src/lib/agent/wire/zcode.ts
31482
- import path26 from "node:path";
31621
+ import path27 from "node:path";
31483
31622
  function whereHint2(input, title) {
31484
31623
  const named = obj(input);
31485
31624
  for (const key of ["command", "file_path", "path", "url", "pattern"]) {
@@ -31645,7 +31784,7 @@ async function oneTurn2(io, options) {
31645
31784
  { stringIds: true }
31646
31785
  );
31647
31786
  try {
31648
- const workspacePath = path26.resolve(io.cwd);
31787
+ const workspacePath = path27.resolve(io.cwd);
31649
31788
  const workspace = { workspacePath, workspaceKey: workspacePath };
31650
31789
  let opened;
31651
31790
  if (io.resumeId) {
@@ -32168,7 +32307,7 @@ async function run(io, options, count2) {
32168
32307
  startupTimer = setTimeout(() => {
32169
32308
  if (!started) io.event?.({ kind: "log", data: { text: "[conversation] start_unconfirmed" } });
32170
32309
  }, CONVERSATION_MS.start);
32171
- await bounded(rpc.call("turn/start", { threadId, input: [{ type: "text", text: text3 }, ...images.map((path35) => ({ type: "localImage", path: path35 }))] }), CONVERSATION_MS.start, "Codex turn/start timed out; submission outcome is unknown.").catch((error) => {
32310
+ await bounded(rpc.call("turn/start", { threadId, input: [{ type: "text", text: text3 }, ...images.map((path36) => ({ type: "localImage", path: path36 }))] }), CONVERSATION_MS.start, "Codex turn/start timed out; submission outcome is unknown.").catch((error) => {
32172
32311
  if (!started) throw error;
32173
32312
  });
32174
32313
  };
@@ -32419,51 +32558,6 @@ async function run(io, options, count2) {
32419
32558
  return done;
32420
32559
  }
32421
32560
 
32422
- // ../cli/src/lib/agent/harnesses/transient.ts
32423
- var MANUAL = [
32424
- /\b(401|403)\b/,
32425
- /unauthorized|forbidden|permission denied/,
32426
- /authenticat|invalid api key|api[_ ]key|not logged in|\/login|oauth/,
32427
- /\b429\b/,
32428
- /rate[_ ]limit|usage limit|quota|credit balance|insufficient|out of tokens/,
32429
- /cancell?ed|aborted by|interrupted by the user/,
32430
- /maximum budget|max(imum)? turns|exceeded the budget/,
32431
- /model not found|unknown model|unsupported|invalid[_ ]request/
32432
- ];
32433
- var PASSING = [
32434
- // 502/503/529 are distinctive enough to read as a status wherever they appear. A bare
32435
- // 500 is not — a failure line counting something would match it — so it is left to the
32436
- // words below, which is how that status is actually written out.
32437
- /\b(502|503|529)\b/,
32438
- /overloaded|service unavailable|bad gateway|internal server error|server_error/,
32439
- /connection (lost|dropped|reset|error|closed)|socket hang up|stream (error|disconnected)/,
32440
- /econnreset|econnrefused|etimedout|enetunreach|enotfound|eai_again/,
32441
- /fetch failed|request timed out|network error/
32442
- ];
32443
- var RETRY_AFTER = /retry[-_\s]?after["':=\s]+(\d+)/i;
32444
- var REASON_MAX = 140;
32445
- function reasonLine(text3, rule) {
32446
- const line = text3.split("\n").find((l) => rule.test(l.toLowerCase())) ?? text3;
32447
- const said = line.trim().replace(/\s+/g, " ");
32448
- return said.length > REASON_MAX ? `${said.slice(0, REASON_MAX - 1)}\u2026` : said;
32449
- }
32450
- function providerBlip(...said) {
32451
- for (const text3 of said) {
32452
- if (!text3?.trim()) continue;
32453
- const lower = text3.toLowerCase();
32454
- if (MANUAL.some((rule) => rule.test(lower))) return void 0;
32455
- const hit = PASSING.find((rule) => rule.test(lower));
32456
- if (!hit) continue;
32457
- const asked = RETRY_AFTER.exec(text3);
32458
- const seconds = asked ? Number(asked[1]) : NaN;
32459
- return {
32460
- reason: reasonLine(text3, hit),
32461
- ...Number.isFinite(seconds) && seconds > 0 ? { retryAfterMs: seconds * 1e3 } : {}
32462
- };
32463
- }
32464
- return void 0;
32465
- }
32466
-
32467
32561
  // ../cli/src/lib/agent/harnesses/claude-code.ts
32468
32562
  var cliSaid = (said) => /^\s*API Error\b/i.test(said ?? "") ? said : void 0;
32469
32563
  var MODEL_ALIASES = ["opus", "sonnet", "haiku", "fable"];
@@ -32476,15 +32570,15 @@ var userMessage = (prompt) => `${JSON.stringify({ type: "user", message: { role:
32476
32570
  `;
32477
32571
  function claudeOnWindows() {
32478
32572
  const [local, roaming] = [process.env.LOCALAPPDATA?.trim(), process.env.APPDATA?.trim()];
32479
- const packages = local ? path27.join(local, "Packages") : "";
32573
+ const packages = local ? path28.join(local, "Packages") : "";
32480
32574
  const data = [
32481
- ...folders(packages).filter((name) => /^(\w+\.)?Claude_/i.test(name)).sort().map((name) => path27.join(packages, name, "LocalCache", "Roaming", "Claude")),
32482
- ...roaming ? [path27.join(roaming, "Claude")] : []
32575
+ ...folders(packages).filter((name) => /^(\w+\.)?Claude_/i.test(name)).sort().map((name) => path28.join(packages, name, "LocalCache", "Roaming", "Claude")),
32576
+ ...roaming ? [path28.join(roaming, "Claude")] : []
32483
32577
  ];
32484
32578
  return data.flatMap(
32485
- (dir) => latestIn(path27.join(dir, "claude-code")).flatMap((version) => [
32486
- path27.join(version, "claude.exe"),
32487
- ...folders(version).map((build) => path27.join(version, build, "claude.exe"))
32579
+ (dir) => latestIn(path28.join(dir, "claude-code")).flatMap((version) => [
32580
+ path28.join(version, "claude.exe"),
32581
+ ...folders(version).map((build) => path28.join(version, build, "claude.exe"))
32488
32582
  ])
32489
32583
  );
32490
32584
  }
@@ -32740,7 +32834,7 @@ var CLAUDE_CODE = {
32740
32834
  ...latestIn(home(".local", "share", "claude", "versions")),
32741
32835
  // The copy Claude Desktop carries.
32742
32836
  ...process.platform === "win32" ? claudeOnWindows() : latestIn(home("Library", "Application Support", "Claude", "claude-code")).flatMap(
32743
- (version) => folders(version).map((build) => path27.join(version, build, "claude.app", "Contents", "MacOS", "claude"))
32837
+ (version) => folders(version).map((build) => path28.join(version, build, "claude.app", "Contents", "MacOS", "claude"))
32744
32838
  )
32745
32839
  ],
32746
32840
  install: "npm install -g @anthropic-ai/claude-code"
@@ -32748,7 +32842,7 @@ var CLAUDE_CODE = {
32748
32842
 
32749
32843
  // ../cli/src/lib/agent/harnesses/codex.ts
32750
32844
  import fs25 from "node:fs";
32751
- import path28 from "node:path";
32845
+ import path29 from "node:path";
32752
32846
 
32753
32847
  // ../cli/src/lib/agent/worktree.ts
32754
32848
  import { spawnSync as spawnSync5 } from "node:child_process";
@@ -32795,10 +32889,10 @@ function codexExtraArgs(argv, cwd = REPO_ROOT) {
32795
32889
  }
32796
32890
  const flags = [...argv, ...extra];
32797
32891
  const workspaceWrite = flags.some((arg, i) => arg === "--full-auto" || arg === "--sandbox=workspace-write" || (arg === "--sandbox" || arg === "-s") && flags[i + 1] === "workspace-write");
32798
- if (workspaceWrite && path28.resolve(cwd) !== path28.resolve(REPO_ROOT)) {
32892
+ if (workspaceWrite && path29.resolve(cwd) !== path29.resolve(REPO_ROOT)) {
32799
32893
  for (const dir of [KANBAN, AKB_DIR]) {
32800
- const relative = path28.relative(cwd, dir);
32801
- if (relative === ".." || relative.startsWith(`..${path28.sep}`) || path28.isAbsolute(relative)) {
32894
+ const relative = path29.relative(cwd, dir);
32895
+ if (relative === ".." || relative.startsWith(`..${path29.sep}`) || path29.isAbsolute(relative)) {
32802
32896
  extra.push("--add-dir", dir);
32803
32897
  }
32804
32898
  }
@@ -32847,28 +32941,28 @@ function codexOnWindows() {
32847
32941
  const local = envRoot("LOCALAPPDATA");
32848
32942
  const profile = envRoot("USERPROFILE");
32849
32943
  const programs = envRoot("ProgramFiles");
32850
- const cache = local ? path28.join(local, "OpenAI", "Codex", "bin") : "";
32851
- const releases = profile ? path28.join(profile, ".codex", "packages", "standalone", "releases") : "";
32852
- const packages = programs ? path28.join(programs, "WindowsApps") : "";
32944
+ const cache = local ? path29.join(local, "OpenAI", "Codex", "bin") : "";
32945
+ const releases = profile ? path29.join(profile, ".codex", "packages", "standalone", "releases") : "";
32946
+ const packages = programs ? path29.join(programs, "WindowsApps") : "";
32853
32947
  return [
32854
32948
  // Desktop's relocated CLI cache: a folder per build hash, newest file first.
32855
- ...byNewest(folders(cache).map((name) => path28.join(cache, name, "codex.exe"))),
32949
+ ...byNewest(folders(cache).map((name) => path29.join(cache, name, "codex.exe"))),
32856
32950
  // The separate standalone launcher, at a path with nothing variable in it.
32857
- ...local ? [path28.join(local, "Programs", "OpenAI", "Codex", "bin", "codex.exe")] : [],
32951
+ ...local ? [path29.join(local, "Programs", "OpenAI", "Codex", "bin", "codex.exe")] : [],
32858
32952
  // That launcher's release payload: a folder per version and target.
32859
32953
  ...byVersion(folders(releases).filter(ourArch)).map(
32860
- (name) => path28.join(releases, name, "bin", "codex.exe")
32954
+ (name) => path29.join(releases, name, "bin", "codex.exe")
32861
32955
  ),
32862
32956
  // Desktop's own MSIX package.
32863
32957
  ...byVersion(folders(packages).filter((name) => name.startsWith("OpenAI.Codex_")).filter(ourArch)).map(
32864
- (name) => path28.join(packages, name, "app", "resources", "codex.exe")
32958
+ (name) => path29.join(packages, name, "app", "resources", "codex.exe")
32865
32959
  )
32866
32960
  ];
32867
32961
  }
32868
32962
  function codexInstalls() {
32869
32963
  const chosen = process.env.CODEX_INSTALL_DIR?.trim();
32870
32964
  return [
32871
- ...chosen ? [path28.join(chosen, "codex")] : [],
32965
+ ...chosen ? [path29.join(chosen, "codex")] : [],
32872
32966
  ...process.platform === "win32" ? codexOnWindows() : [
32873
32967
  // macOS, where Codex now lives in the merged app — `codex-cli/bin/` since 26.928…
32874
32968
  "/Applications/ChatGPT.app/Contents/Resources/codex-cli/bin/codex",
@@ -32914,7 +33008,7 @@ var CODEX = {
32914
33008
  systemPrompt(text3, argv) {
32915
33009
  if (namesFlag(argv, ["developer_instructions", "model_instructions_file"])) return {};
32916
33010
  try {
32917
- const config = fs25.readFileSync(path28.join(process.env.CODEX_HOME || home(".codex"), "config.toml"), "utf8");
33011
+ const config = fs25.readFileSync(path29.join(process.env.CODEX_HOME || home(".codex"), "config.toml"), "utf8");
32918
33012
  if (/^\s*(?:developer_instructions|model_instructions_file)\s*=/m.test(config)) return {};
32919
33013
  } catch {
32920
33014
  }
@@ -33156,23 +33250,23 @@ var CURSOR = {
33156
33250
 
33157
33251
  // ../cli/src/lib/agent/harnesses/dsh.ts
33158
33252
  import fs26 from "node:fs";
33159
- import path29 from "node:path";
33253
+ import path30 from "node:path";
33160
33254
  function dshHome(argv) {
33161
33255
  const binary = argv[0];
33162
33256
  if (!binary) return void 0;
33163
- const names2 = process.platform === "win32" && !path29.extname(binary) ? [".exe", ".cmd"].map((ext) => binary + ext) : [binary];
33164
- const candidates2 = binary.includes("/") || binary.includes("\\") ? names2 : (process.env.PATH ?? "").split(path29.delimiter).filter(Boolean).flatMap((dir2) => names2.map((name) => path29.join(dir2, name)));
33257
+ const names2 = process.platform === "win32" && !path30.extname(binary) ? [".exe", ".cmd"].map((ext) => binary + ext) : [binary];
33258
+ const candidates2 = binary.includes("/") || binary.includes("\\") ? names2 : (process.env.PATH ?? "").split(path30.delimiter).filter(Boolean).flatMap((dir2) => names2.map((name) => path30.join(dir2, name)));
33165
33259
  let dir;
33166
33260
  try {
33167
33261
  const found = candidates2.find((candidate) => fs26.existsSync(candidate));
33168
33262
  if (!found) return void 0;
33169
33263
  const script = /\.cmd$/i.test(found) ? shimTarget(fs26.readFileSync(found, "utf8"), found)?.script : void 0;
33170
- dir = path29.dirname(fs26.realpathSync(script ?? found));
33264
+ dir = path30.dirname(fs26.realpathSync(script ?? found));
33171
33265
  } catch {
33172
33266
  return void 0;
33173
33267
  }
33174
- for (let up = path29.dirname(dir); dir !== up; up = path29.dirname(dir)) {
33175
- if (fs26.existsSync(path29.join(dir, "package.json"))) return dir;
33268
+ for (let up = path30.dirname(dir); dir !== up; up = path30.dirname(dir)) {
33269
+ if (fs26.existsSync(path30.join(dir, "package.json"))) return dir;
33176
33270
  dir = up;
33177
33271
  }
33178
33272
  return void 0;
@@ -33759,10 +33853,77 @@ var HARNESSES = [CLAUDE_CODE, CODEX, CURSOR, OPENCODE, KIMI, DSH, ZCODE, GROK, A
33759
33853
  var DEFAULT_HARNESS = HARNESSES[0];
33760
33854
  checkHarnesses(HARNESSES);
33761
33855
 
33856
+ // src/model-list.ts
33857
+ var MODEL_REFRESH_MS = 3e4;
33858
+ var MODEL_TIMEOUT_MS = 15e3;
33859
+ var ModelLists = class {
33860
+ constructor(sources3, interval = MODEL_REFRESH_MS, timeout = MODEL_TIMEOUT_MS) {
33861
+ this.sources = sources3;
33862
+ this.interval = interval;
33863
+ this.timeout = timeout;
33864
+ }
33865
+ sources;
33866
+ interval;
33867
+ timeout;
33868
+ listeners = /* @__PURE__ */ new Set();
33869
+ subscribe(listener) {
33870
+ this.listeners.add(listener);
33871
+ return () => {
33872
+ this.listeners.delete(listener);
33873
+ };
33874
+ }
33875
+ entries = /* @__PURE__ */ new Map();
33876
+ async read(key, previous = [], wait = false) {
33877
+ const source = this.sources[key];
33878
+ if (!source) return previous;
33879
+ let entry2 = this.entries.get(key);
33880
+ if (!entry2) {
33881
+ entry2 = { models: normalizeModels(previous), next: 0 };
33882
+ this.entries.set(key, entry2);
33883
+ }
33884
+ if (!entry2.models.length && previous.length) entry2.models = normalizeModels(previous);
33885
+ if (!entry2.pending && Date.now() >= entry2.next) {
33886
+ const held2 = entry2;
33887
+ const controller = new AbortController();
33888
+ held2.next = Date.now() + this.interval;
33889
+ let changed = false;
33890
+ held2.pending = new Promise((resolve2) => {
33891
+ let done = false;
33892
+ const finish = (models) => {
33893
+ if (done) return;
33894
+ done = true;
33895
+ clearTimeout(timer);
33896
+ controller.abort();
33897
+ const found = normalizeModels(models);
33898
+ if (found.length) {
33899
+ changed = JSON.stringify(found) !== JSON.stringify(held2.models);
33900
+ held2.models = found;
33901
+ }
33902
+ resolve2(held2.models);
33903
+ };
33904
+ const timer = setTimeout(() => finish([]), this.timeout);
33905
+ Promise.resolve().then(() => source(controller.signal)).then(finish, () => finish([]));
33906
+ }).finally(() => {
33907
+ held2.pending = void 0;
33908
+ if (changed) for (const listener of this.listeners) listener();
33909
+ });
33910
+ }
33911
+ return wait && entry2.pending ? entry2.pending : entry2.models;
33912
+ }
33913
+ };
33914
+ function normalizeModels(models) {
33915
+ const seen = /* @__PURE__ */ new Set();
33916
+ return models.flatMap((model) => {
33917
+ const id = model.id.trim();
33918
+ if (!id || seen.has(id)) return [];
33919
+ seen.add(id);
33920
+ return [{ id, name: model.name.trim() || id }];
33921
+ });
33922
+ }
33923
+
33762
33924
  // src/runtimes.ts
33763
33925
  var HARNESSES2 = Object.fromEntries(RUNTIMES.map((name) => [name, HARNESSES.find((h) => h.name === name)]));
33764
33926
  var LOGIN_PROBE_MS = 5e3;
33765
- var MODELS_MS = 3e4;
33766
33927
  var LABELS = Object.fromEntries(RUNTIMES.map((name) => [name, HARNESSES2[name].label]));
33767
33928
  var hints = (runtime) => ({ login: HARNESSES2[runtime].login?.login });
33768
33929
  function commandOf(harness) {
@@ -33790,33 +33951,30 @@ async function detectRuntimes(quick = false, only) {
33790
33951
  const copy2 = locate(harness);
33791
33952
  if (!copy2) return { name, installed: false, settings };
33792
33953
  const loggedIn = harness.login ? await probeLogin(spawnName(copy2, splitCommand(harness.command)[0]), harness) : void 0;
33793
- const models = loggedIn === false || quick && SLOW.has(name) ? [] : await readModels(name);
33954
+ const models = await modelLists.read(name, name === "claude-code" ? CLAUDE_DEFAULTS : [], !quick);
33794
33955
  return { name, installed: true, ...copy2.version ? { version: copy2.version } : {}, ...loggedIn === void 0 ? {} : { loggedIn }, ...models.length ? { models } : {}, settings };
33795
33956
  })
33796
33957
  );
33797
33958
  }
33798
- var SLOW = /* @__PURE__ */ new Set(["opencode", "cursor", "antigravity"]);
33799
- var listed = (harness) => async () => (harness.models?.() ?? []).map((id) => ({ id, name: id }));
33800
- var readModels = (name) => (MODELS[name] ?? listed(HARNESSES2[name]))().catch(() => []);
33801
- var MODELS = {
33802
- "claude-code": async () => {
33803
- const cached2 = claudeModels(path30.join(process.env.CLAUDE_CONFIG_DIR || path30.join(os6.homedir(), ".claude"), "cache", "model-catalog"));
33804
- return cached2.length ? cached2 : [
33805
- { id: "opus", name: "Opus" },
33806
- { id: "sonnet", name: "Sonnet" },
33807
- { id: "haiku", name: "Haiku" }
33808
- ];
33809
- },
33810
- codex: async () => codexModels(path30.join(process.env.CODEX_HOME || path30.join(os6.homedir(), ".codex"), "models_cache.json")),
33811
- opencode: async () => opencodeModels(await output(commandOf(HARNESSES2.opencode)[0], ["models"])),
33812
- cursor: () => cursorModels(),
33813
- antigravity: async () => antigravityModels(await output(commandOf(HARNESSES2.antigravity)[0], ["models"]))
33814
- };
33959
+ var CLAUDE_DEFAULTS = ["opus", "sonnet", "haiku"].map((id) => ({ id, name: id[0].toUpperCase() + id.slice(1) }));
33960
+ var sources2 = Object.fromEntries(
33961
+ Object.entries(HARNESSES2).filter(([, harness]) => harness.models).map(([name, harness]) => [
33962
+ name,
33963
+ () => (harness.models?.() ?? []).map((id) => ({ id, name: id }))
33964
+ ])
33965
+ );
33966
+ Object.assign(sources2, {
33967
+ "claude-code": () => claudeModels(path31.join(process.env.CLAUDE_CONFIG_DIR || path31.join(os6.homedir(), ".claude"), "cache", "model-catalog")),
33968
+ codex: () => codexModels(path31.join(process.env.CODEX_HOME || path31.join(os6.homedir(), ".codex"), "models_cache.json")),
33969
+ opencode: async (signal) => opencodeModels(await output(commandOf(HARNESSES2.opencode)[0], ["models"], signal)),
33970
+ cursor: (signal) => cursorModels(signal),
33971
+ antigravity: async (signal) => antigravityModels(await output(commandOf(HARNESSES2.antigravity)[0], ["models"], signal))
33972
+ });
33973
+ var modelLists = new ModelLists(sources2);
33815
33974
  function opencodeModels(out) {
33816
33975
  return out.split("\n").map((l) => l.trim()).filter((l) => /^\S+\/\S+$/.test(l)).map((id) => ({ id, name: id }));
33817
33976
  }
33818
- function cursorModels() {
33819
- const argv = commandOf(HARNESSES2.cursor);
33977
+ function cursorModels(signal, argv = commandOf(HARNESSES2.cursor)) {
33820
33978
  return new Promise((resolve2) => {
33821
33979
  let child;
33822
33980
  try {
@@ -33825,13 +33983,19 @@ function cursorModels() {
33825
33983
  } catch {
33826
33984
  return resolve2([]);
33827
33985
  }
33986
+ let finished = false;
33828
33987
  const done = (models) => {
33829
- clearTimeout(timer);
33988
+ if (finished) return;
33989
+ finished = true;
33990
+ signal.removeEventListener("abort", aborted);
33830
33991
  child.kill();
33831
33992
  resolve2(models);
33832
33993
  };
33833
- const timer = setTimeout(() => done([]), MODELS_MS);
33994
+ const aborted = () => done([]);
33995
+ signal.addEventListener("abort", aborted, { once: true });
33996
+ if (signal.aborted) return done([]);
33834
33997
  child.on("error", () => done([]));
33998
+ child.on("close", () => done([]));
33835
33999
  const rpc = connect(child.stdout, child.stdin, (msg) => msg.id !== void 0 && rpc.refuse(msg.id, "no"), { jsonrpc: true });
33836
34000
  rpc.call("initialize", { protocolVersion: 1, clientCapabilities: { fs: { readTextFile: false, writeTextFile: false }, terminal: false } }).then(() => rpc.call("session/new", { cwd: os6.tmpdir(), mcpServers: [] })).then((opened) => done(acpModels(opened))).catch(() => done([]));
33837
34001
  });
@@ -33843,7 +34007,7 @@ function acpModels(opened) {
33843
34007
  return id && id !== "default[]" ? [{ id, name: str2(m.name) || id }] : [];
33844
34008
  });
33845
34009
  }
33846
- function output(command, args2) {
34010
+ function output(command, args2, signal) {
33847
34011
  return new Promise((resolve2) => {
33848
34012
  let out = "";
33849
34013
  let child;
@@ -33853,16 +34017,20 @@ function output(command, args2) {
33853
34017
  } catch {
33854
34018
  return resolve2("");
33855
34019
  }
33856
- const timer = setTimeout(() => {
34020
+ let finished = false;
34021
+ const done = (value) => {
34022
+ if (finished) return;
34023
+ finished = true;
34024
+ signal.removeEventListener("abort", aborted);
33857
34025
  child.kill();
33858
- resolve2("");
33859
- }, MODELS_MS);
34026
+ resolve2(value);
34027
+ };
34028
+ const aborted = () => done("");
34029
+ signal.addEventListener("abort", aborted, { once: true });
34030
+ if (signal.aborted) return done("");
33860
34031
  child.stdout?.on("data", (d) => out += d);
33861
- child.on("error", () => resolve2(""));
33862
- child.on("close", (code) => {
33863
- clearTimeout(timer);
33864
- resolve2(code === 0 ? out : "");
33865
- });
34032
+ child.on("error", () => done(""));
34033
+ child.on("close", (code) => done(code === 0 ? out : ""));
33866
34034
  });
33867
34035
  }
33868
34036
  function codexModels(file2) {
@@ -33885,7 +34053,7 @@ function claudeModels(dir) {
33885
34053
  }
33886
34054
  const catalogs = files.flatMap((f) => {
33887
34055
  try {
33888
- const data = obj(JSON.parse(fs27.readFileSync(path30.join(dir, f), "utf8")));
34056
+ const data = obj(JSON.parse(fs27.readFileSync(path31.join(dir, f), "utf8")));
33889
34057
  const catalog = obj(data.catalog);
33890
34058
  const surface = str2(catalog.surface);
33891
34059
  return surface === "cc" || surface === "ccd" ? [{ surface, at: Number(data.fetchedAt) || 0, config: obj(catalog.config) }] : [];
@@ -33932,33 +34100,33 @@ function probeLogin(binary, harness) {
33932
34100
 
33933
34101
  // src/akb.ts
33934
34102
  import fs28 from "node:fs";
33935
- import path31 from "node:path";
34103
+ import path32 from "node:path";
33936
34104
  import { fileURLToPath as fileURLToPath2, pathToFileURL } from "node:url";
33937
- var akbHome = () => path31.join(runnerHome(), "bin", "akb");
34105
+ var akbHome = () => path32.join(runnerHome(), "bin", "akb");
33938
34106
  var BUNDLED_SHIM = `bundled-${AKB_VERSION}`;
33939
- var HERE = path31.dirname(fileURLToPath2(import.meta.url));
34107
+ var HERE = path32.dirname(fileURLToPath2(import.meta.url));
33940
34108
  function akbArgs(entry2, dist = HERE) {
33941
- const preload = path31.join(dist, "akb-proxy.mjs");
34109
+ const preload = path32.join(dist, "akb-proxy.mjs");
33942
34110
  return fs28.existsSync(preload) ? ["--import", pathToFileURL(preload).href, entry2] : [entry2];
33943
34111
  }
33944
34112
  var bundledAkb = (dist = HERE) => ({
33945
34113
  command: process.execPath,
33946
- args: akbArgs(path31.join(dist, "akb", "bin", "ai4kanban.mjs"), dist),
34114
+ args: akbArgs(path32.join(dist, "akb", "bin", "ai4kanban.mjs"), dist),
33947
34115
  version: AKB_VERSION,
33948
- shim: path31.join(akbHome(), BUNDLED_SHIM)
34116
+ shim: path32.join(akbHome(), BUNDLED_SHIM)
33949
34117
  });
33950
34118
  var quote = (s) => /^[\w./:@=-]+$/.test(s) ? s : `"${s}"`;
33951
34119
  function shimDir(akb) {
33952
34120
  const dir = akb.shim;
33953
34121
  const line = [akb.command, ...akb.args].map(quote).join(" ");
33954
- const [file2, text3] = process.platform === "win32" ? [path31.join(dir, "akb.cmd"), `@${line} %*\r
33955
- `] : [path31.join(dir, "akb"), `#!/bin/sh
34122
+ const [file2, text3] = process.platform === "win32" ? [path32.join(dir, "akb.cmd"), `@${line} %*\r
34123
+ `] : [path32.join(dir, "akb"), `#!/bin/sh
33956
34124
  exec ${line} "$@"
33957
34125
  `];
33958
34126
  if (process.platform === "win32") {
33959
34127
  fs28.mkdirSync(dir, { recursive: true });
33960
34128
  const shellLine = [akb.command, ...akb.args].map((s) => `'${s.replaceAll("\\", "/").replaceAll("'", "'\\''")}'`).join(" ");
33961
- fs28.writeFileSync(path31.join(dir, "akb"), `#!/bin/sh
34129
+ fs28.writeFileSync(path32.join(dir, "akb"), `#!/bin/sh
33962
34130
  exec ${shellLine} "$@"
33963
34131
  `, { mode: 493 });
33964
34132
  }
@@ -33975,11 +34143,11 @@ var KEEP2 = 256 * 1024;
33975
34143
  // src/lock.ts
33976
34144
  import crypto7 from "node:crypto";
33977
34145
  import net from "node:net";
33978
- import path32 from "node:path";
34146
+ import path33 from "node:path";
33979
34147
  function lockPath() {
33980
34148
  const home3 = runnerHome();
33981
34149
  if (process.platform === "win32") return `\\\\.\\pipe\\wildcrane-${crypto7.createHash("sha256").update(home3).digest("hex").slice(0, 16)}`;
33982
- return path32.join(home3, "runner.sock");
34150
+ return path33.join(home3, "runner.sock");
33983
34151
  }
33984
34152
  function runnerSettingsSupport() {
33985
34153
  return new Promise((resolve2) => {
@@ -34163,9 +34331,9 @@ async function exchange(code, verifier, generation, signal) {
34163
34331
  writeSession(session);
34164
34332
  return null;
34165
34333
  }
34166
- var authCall = (path35, body) => {
34334
+ var authCall = (path36, body) => {
34167
34335
  const { api, anonKey } = cloudEndpoints();
34168
- return fetch(`${api}/auth/v1/${path35}`, {
34336
+ return fetch(`${api}/auth/v1/${path36}`, {
34169
34337
  method: "POST",
34170
34338
  headers: { apikey: anonKey, "content-type": "application/json" },
34171
34339
  body: JSON.stringify(body),
@@ -34226,7 +34394,7 @@ var callback = () => {
34226
34394
  };
34227
34395
  var notify = () => {
34228
34396
  fs29.mkdirSync(runnerHome(), { recursive: true, mode: 448 });
34229
- fs29.writeFileSync(path33.join(runnerHome(), "settings-refresh"), crypto9.randomUUID(), { mode: 384 });
34397
+ fs29.writeFileSync(path34.join(runnerHome(), "settings-refresh"), crypto9.randomUUID(), { mode: 384 });
34230
34398
  callback();
34231
34399
  };
34232
34400
  var onSettingsChange = (next) => {
@@ -34287,7 +34455,7 @@ async function addFolder2(dir, bind, strict = false) {
34287
34455
  let project = found.folder?.project;
34288
34456
  if (found.folder && (bind ? bind !== project : strict)) return { error: "folder_taken", message: "taken", name: found.folder.name };
34289
34457
  if (!project) {
34290
- const added = await addFolder(machineId(), path33.basename(real) || real, real, bind);
34458
+ const added = await addFolder(machineId(), path34.basename(real) || real, real, bind);
34291
34459
  if (!added.ok) return failure(added);
34292
34460
  project = added.value.folder.project;
34293
34461
  }
@@ -34322,7 +34490,7 @@ async function removeFolder2(project) {
34322
34490
  }
34323
34491
  function akbFile() {
34324
34492
  try {
34325
- return path33.join(shimDir(bundledAkb()), process.platform === "win32" ? "akb.cmd" : "akb");
34493
+ return path34.join(shimDir(bundledAkb()), process.platform === "win32" ? "akb.cmd" : "akb");
34326
34494
  } catch {
34327
34495
  return null;
34328
34496
  }
@@ -34407,7 +34575,7 @@ async function settingsAction(action, body, context) {
34407
34575
  if (why) return { error: why };
34408
34576
  const real = fs29.realpathSync(dir);
34409
34577
  selected.set(context, { path: real, subject: readSession().subject });
34410
- return { path: real, name: path33.basename(real) };
34578
+ return { path: real, name: path34.basename(real) };
34411
34579
  } catch {
34412
34580
  return { error: "picker_unavailable" };
34413
34581
  }
@@ -34481,7 +34649,7 @@ async function terminalSettings(entry2) {
34481
34649
 
34482
34650
  // src/launcher-main.ts
34483
34651
  useRunnerHome();
34484
- var entry = path34.join(path34.dirname(fileURLToPath3(import.meta.url)), "runner.mjs");
34652
+ var entry = path35.join(path35.dirname(fileURLToPath3(import.meta.url)), "runner.mjs");
34485
34653
  if (process.argv.includes("--settings")) {
34486
34654
  terminalSettings(entry).catch(() => {
34487
34655
  process.stderr.write("\u65E0\u6CD5\u6253\u5F00\u672C\u673A\u8BBE\u7F6E\uFF0C\u8BF7\u91CD\u8BD5\u3002\n");