wildcrane-runner 0.6.87 → 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/akb/dist/kanban.mjs +763 -658
- package/dist/akb/package.json +1 -1
- package/dist/akb-proxy.mjs +1 -1
- package/dist/codex-proxy.mjs +1 -1
- package/dist/codex-retained.mjs +1 -1
- package/dist/flow-worker-main.mjs +473 -371
- package/dist/launcher.mjs +333 -243
- package/dist/plugin.mjs +388 -298
- package/dist/runner.mjs +807 -701
- package/dist/settings.mjs +344 -254
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// wildcrane-runner 0.6.
|
|
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
|
|
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 (
|
|
1166
|
-
|
|
1165
|
+
if (path48 && path48[0] !== "/") {
|
|
1166
|
+
path48 = `/${path48}`;
|
|
1167
1167
|
}
|
|
1168
|
-
return new URL(`${origin}${
|
|
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:
|
|
2003
|
+
request: { method, path: path48, origin }
|
|
2004
2004
|
} = evt;
|
|
2005
|
-
debugLog("sending request to %s %s%s", method, origin,
|
|
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:
|
|
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
|
-
|
|
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:
|
|
2039
|
+
request: { method, path: path48, origin }
|
|
2040
2040
|
} = evt;
|
|
2041
|
-
debugLog("trailers received from %s %s%s", method, origin,
|
|
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:
|
|
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
|
-
|
|
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:
|
|
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
|
|
2187
|
+
if (typeof path48 !== "string") {
|
|
2188
2188
|
throw new InvalidArgumentError("path must be a string");
|
|
2189
|
-
} else if (
|
|
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(
|
|
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(
|
|
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:
|
|
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} ${
|
|
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:
|
|
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] =
|
|
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] =
|
|
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:
|
|
10740
|
+
path: path48 = "/",
|
|
10741
10741
|
headers = {}
|
|
10742
10742
|
} = opts;
|
|
10743
|
-
opts.path = origin +
|
|
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(
|
|
12904
|
-
if (typeof
|
|
12905
|
-
return
|
|
12903
|
+
function safeUrl(path48) {
|
|
12904
|
+
if (typeof path48 !== "string") {
|
|
12905
|
+
return path48;
|
|
12906
12906
|
}
|
|
12907
|
-
const pathSegments =
|
|
12907
|
+
const pathSegments = path48.split("?", 3);
|
|
12908
12908
|
if (pathSegments.length !== 2) {
|
|
12909
|
-
return
|
|
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:
|
|
12916
|
-
const pathMatch = matchValue(mockDispatch2.path,
|
|
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:
|
|
12942
|
-
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(
|
|
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(
|
|
12982
|
-
while (
|
|
12983
|
-
|
|
12981
|
+
function removeTrailingSlash(path48) {
|
|
12982
|
+
while (path48.endsWith("/")) {
|
|
12983
|
+
path48 = path48.slice(0, -1);
|
|
12984
12984
|
}
|
|
12985
|
-
if (
|
|
12986
|
-
|
|
12985
|
+
if (path48.length === 0) {
|
|
12986
|
+
path48 = "/";
|
|
12987
12987
|
}
|
|
12988
|
-
return
|
|
12988
|
+
return path48;
|
|
12989
12989
|
}
|
|
12990
12990
|
function buildKey(opts) {
|
|
12991
|
-
const { path:
|
|
12991
|
+
const { path: path48, method, body, headers, query } = opts;
|
|
12992
12992
|
return {
|
|
12993
|
-
path:
|
|
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:
|
|
13683
|
+
({ method, path: path48, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
13684
13684
|
Method: method,
|
|
13685
13685
|
Origin: origin,
|
|
13686
|
-
Path:
|
|
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 [
|
|
13768
|
+
const [path48, searchParams] = dispatchOpts.path.split("?");
|
|
13769
13769
|
const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
|
|
13770
|
-
dispatchOpts.path = `${
|
|
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
|
|
14172
|
-
if (!
|
|
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(
|
|
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 ${
|
|
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
|
|
14202
|
-
if (!
|
|
14201
|
+
const path48 = filePath || this.#snapshotPath;
|
|
14202
|
+
if (!path48) {
|
|
14203
14203
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
14204
14204
|
}
|
|
14205
|
-
const resolvedPath = resolve2(
|
|
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
|
|
14847
|
-
const redirectUrlString = `${origin}${
|
|
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 =
|
|
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,
|
|
16671
|
+
function deleteCachedUri(store, cacheKey, path48) {
|
|
16672
16672
|
deleteCachedValue(store, {
|
|
16673
16673
|
...cacheKey,
|
|
16674
|
-
path:
|
|
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:
|
|
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
|
|
16694
|
-
if (
|
|
16695
|
-
deleteCachedUri(store, cacheKey,
|
|
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
|
|
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 ? `${
|
|
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(
|
|
23135
|
-
for (let i = 0; i <
|
|
23136
|
-
const code =
|
|
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
|
|
26572
|
+
let path48 = opts.path;
|
|
26573
26573
|
if (!opts.path.startsWith("/")) {
|
|
26574
|
-
|
|
26574
|
+
path48 = `/${path48}`;
|
|
26575
26575
|
}
|
|
26576
|
-
url = new URL(util.parseOrigin(url).origin +
|
|
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 [
|
|
67919
|
-
prefix += `var ${resolvedName} = require("${
|
|
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
|
|
68113
|
-
if (!this.cjsAutomaticModuleNameResolutions[
|
|
68114
|
-
this.cjsAutomaticModuleNameResolutions[
|
|
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[
|
|
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 [
|
|
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(
|
|
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 [
|
|
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(
|
|
68580
|
+
this.importsToReplace.set(path48, `require('${path48}');`);
|
|
68581
68581
|
continue;
|
|
68582
68582
|
}
|
|
68583
|
-
const primaryImportName = this.getFreeIdentifierForPath(
|
|
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(
|
|
68588
|
+
secondaryImportName = wildcardNames.length > 0 ? wildcardNames[0] : this.getFreeIdentifierForPath(path48);
|
|
68589
68589
|
}
|
|
68590
|
-
let requireCode = `var ${primaryImportName} = require('${
|
|
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(
|
|
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(
|
|
68628
|
-
const components =
|
|
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
|
|
68674
|
-
const importInfo = this.getImportInfo(
|
|
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
|
|
68742
|
-
const importInfo = this.getImportInfo(
|
|
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
|
|
68758
|
-
const importInfo = this.getImportInfo(
|
|
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(
|
|
68799
|
-
const existingInfo = this.importInfoByPath.get(
|
|
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(
|
|
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
|
|
69393
|
-
return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(
|
|
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,
|
|
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:
|
|
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(
|
|
69432
|
-
if (
|
|
69433
|
-
return
|
|
69434
|
-
const index =
|
|
69435
|
-
return
|
|
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
|
|
69473
|
+
let path48 = "";
|
|
69474
69474
|
for (let i = 1; i < pointer; i++) {
|
|
69475
|
-
|
|
69475
|
+
path48 += "/" + pieces[i];
|
|
69476
69476
|
}
|
|
69477
|
-
if (!
|
|
69478
|
-
|
|
69477
|
+
if (!path48 || addTrailingSlash && !path48.endsWith("/..")) {
|
|
69478
|
+
path48 += "/";
|
|
69479
69479
|
}
|
|
69480
|
-
url.path =
|
|
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
|
|
69522
|
-
if (!
|
|
69521
|
+
const path48 = url.path.slice(1);
|
|
69522
|
+
if (!path48)
|
|
69523
69523
|
return queryHash || ".";
|
|
69524
|
-
if (isRelative(base || input) && !isRelative(
|
|
69525
|
-
return "./" +
|
|
69524
|
+
if (isRelative(base || input) && !isRelative(path48)) {
|
|
69525
|
+
return "./" + path48 + queryHash;
|
|
69526
69526
|
}
|
|
69527
|
-
return
|
|
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(
|
|
69627
|
-
if (!
|
|
69628
|
-
const index =
|
|
69629
|
-
return
|
|
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);
|
|
@@ -70834,9 +70834,9 @@ var require_util8 = __commonJS({
|
|
|
70834
70834
|
/** @class */
|
|
70835
70835
|
(function(_super) {
|
|
70836
70836
|
__extends(VError2, _super);
|
|
70837
|
-
function VError2(
|
|
70837
|
+
function VError2(path48, message) {
|
|
70838
70838
|
var _this = _super.call(this, message) || this;
|
|
70839
|
-
_this.path =
|
|
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(
|
|
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
|
-
|
|
70903
|
+
path48 += typeof p2 === "number" ? "[" + p2 + "]" : p2 ? "." + p2 : "";
|
|
70904
70904
|
var m = this._messages[i];
|
|
70905
70905
|
if (m) {
|
|
70906
|
-
msgParts.push(
|
|
70906
|
+
msgParts.push(path48 + " " + m);
|
|
70907
70907
|
}
|
|
70908
70908
|
}
|
|
70909
|
-
return new VError(
|
|
70909
|
+
return new VError(path48, msgParts.join("; "));
|
|
70910
70910
|
};
|
|
70911
|
-
DetailContext2.prototype.getErrorDetail = function(
|
|
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
|
-
|
|
70915
|
+
path48 += typeof p2 === "number" ? "[" + p2 + "]" : p2 ? "." + p2 : "";
|
|
70916
70916
|
var message = this._messages[i];
|
|
70917
70917
|
if (message) {
|
|
70918
|
-
details.push({ path:
|
|
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(
|
|
71732
|
-
this._path =
|
|
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
|
|
77166
|
-
this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(
|
|
77167
|
-
this.tokens.appendCode(this.importProcessor.claimImportCode(
|
|
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
|
|
77748
|
-
this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(
|
|
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
|
|
77763
|
-
this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(
|
|
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,
|
|
107617
|
+
getPart = (classPartObject, path48) => {
|
|
107618
107618
|
let current2 = classPartObject;
|
|
107619
|
-
const parts =
|
|
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
|
|
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
|
|
@@ -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.
|
|
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,
|
|
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,
|
|
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 = (
|
|
112291
|
-
function isBoardPath(
|
|
112292
|
-
if (!
|
|
112293
|
-
if (
|
|
112294
|
-
if (
|
|
112295
|
-
if (
|
|
112296
|
-
if (SETTINGS.includes(
|
|
112297
|
-
if (
|
|
112298
|
-
if (
|
|
112299
|
-
return ROOTS.some((root2) =>
|
|
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(
|
|
112304
|
-
const n = ROOT.exec(
|
|
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 = (
|
|
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");
|
|
@@ -113569,14 +113569,14 @@ function collectSources(sources3, card, host) {
|
|
|
113569
113569
|
const active = /* @__PURE__ */ new Set();
|
|
113570
113570
|
const out = [];
|
|
113571
113571
|
const visit = (src, types, owner2, partial = false) => {
|
|
113572
|
-
const
|
|
113572
|
+
const path48 = src.replace(/[?#].*$/, "");
|
|
113573
113573
|
let resolved;
|
|
113574
113574
|
try {
|
|
113575
|
-
resolved = host.resolve(
|
|
113575
|
+
resolved = host.resolve(path48, owner2);
|
|
113576
113576
|
} catch (error) {
|
|
113577
113577
|
if (owner2 !== card) return { key: null, error: why(error) };
|
|
113578
113578
|
if (!nodes.has(src)) {
|
|
113579
|
-
const node2 = { key: src, file: null, kind: kindAt(
|
|
113579
|
+
const node2 = { key: src, file: null, kind: kindAt(path48, types), error: why(error), problems: [], dependencies: /* @__PURE__ */ new Map(), aliases: /* @__PURE__ */ new Set([src]) };
|
|
113580
113580
|
nodes.set(src, node2);
|
|
113581
113581
|
out.push(node2);
|
|
113582
113582
|
}
|
|
@@ -113870,8 +113870,8 @@ function diff3Merge(a2, o3, b2, options) {
|
|
|
113870
113870
|
|
|
113871
113871
|
// ../cli/src/lib/shared/triage-files.ts
|
|
113872
113872
|
var ITEM = /^triage\/(?:(dismissed|archived)\/)?([^/]+)\.md$/;
|
|
113873
|
-
function itemAt(
|
|
113874
|
-
const m = ITEM.exec(
|
|
113873
|
+
function itemAt(path48) {
|
|
113874
|
+
const m = ITEM.exec(path48);
|
|
113875
113875
|
if (!m) return null;
|
|
113876
113876
|
return { state: m[1] === "dismissed" ? "dismissed" : m[1] === "archived" ? "carded" : "open", name: m[2] };
|
|
113877
113877
|
}
|
|
@@ -115132,7 +115132,7 @@ function cloudLanguage(input) {
|
|
|
115132
115132
|
|
|
115133
115133
|
// src/flow.ts
|
|
115134
115134
|
import fs34 from "node:fs";
|
|
115135
|
-
import
|
|
115135
|
+
import path38 from "node:path";
|
|
115136
115136
|
|
|
115137
115137
|
// ../cli/src/lib/question-block.ts
|
|
115138
115138
|
var MODES = ["single", "multi"];
|
|
@@ -115736,15 +115736,26 @@ var OPENAI = {
|
|
|
115736
115736
|
"gpt-5-nano": { input: 0.05, cachedInput: 5e-3, output: 0.4 },
|
|
115737
115737
|
"gpt-5-pro": { input: 15, cachedInput: 15, output: 120 }
|
|
115738
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
|
+
}
|
|
115739
115749
|
var PRICES = { openai: OPENAI, "openai-api": OPENAI };
|
|
115740
115750
|
function lookUp(table, model) {
|
|
115741
115751
|
const id = model.trim().toLowerCase().replace(/^[^/]+\//, "");
|
|
115742
115752
|
return table[id] ?? table[id.replace(/-\d{4}-\d{2}-\d{2}$/, "")];
|
|
115743
115753
|
}
|
|
115744
|
-
function priceUsd(provider, model, usage) {
|
|
115754
|
+
function priceUsd(provider, model, usage, at2 = Date.now()) {
|
|
115745
115755
|
if (!provider || !model || !usage) return void 0;
|
|
115746
|
-
const
|
|
115747
|
-
const
|
|
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));
|
|
115748
115759
|
if (!price) return void 0;
|
|
115749
115760
|
const usd = ((usage.input + usage.cacheCreation) * price.input + usage.cacheRead * price.cachedInput + usage.output * price.output) / 1e6;
|
|
115750
115761
|
return Number.isFinite(usd) && usd >= 0 ? usd : void 0;
|
|
@@ -115813,10 +115824,10 @@ function findRollout(threadId) {
|
|
|
115813
115824
|
}
|
|
115814
115825
|
for (const name of names2) {
|
|
115815
115826
|
if (!name.startsWith("rollout-") || !name.endsWith(tail)) continue;
|
|
115816
|
-
const
|
|
115827
|
+
const path48 = join(dir, name);
|
|
115817
115828
|
try {
|
|
115818
|
-
const at2 = statSync(
|
|
115819
|
-
if (!newest2 || at2 > newest2.at) newest2 = { path:
|
|
115829
|
+
const at2 = statSync(path48).mtimeMs;
|
|
115830
|
+
if (!newest2 || at2 > newest2.at) newest2 = { path: path48, at: at2 };
|
|
115820
115831
|
} catch {
|
|
115821
115832
|
}
|
|
115822
115833
|
}
|
|
@@ -115824,11 +115835,11 @@ function findRollout(threadId) {
|
|
|
115824
115835
|
return newest2?.path;
|
|
115825
115836
|
}
|
|
115826
115837
|
function readCodexRunFacts(threadId) {
|
|
115827
|
-
const
|
|
115828
|
-
if (!
|
|
115838
|
+
const path48 = findRollout(threadId);
|
|
115839
|
+
if (!path48) return void 0;
|
|
115829
115840
|
let raw;
|
|
115830
115841
|
try {
|
|
115831
|
-
raw = readFileSync(
|
|
115842
|
+
raw = readFileSync(path48, "utf8");
|
|
115832
115843
|
} catch {
|
|
115833
115844
|
return void 0;
|
|
115834
115845
|
}
|
|
@@ -115940,8 +115951,8 @@ function renderCompleted(item) {
|
|
|
115940
115951
|
const changes = Array.isArray(item.changes) ? item.changes : [];
|
|
115941
115952
|
return changes.map((raw) => {
|
|
115942
115953
|
const change = obj(raw);
|
|
115943
|
-
const
|
|
115944
|
-
return
|
|
115954
|
+
const path48 = str(change.path);
|
|
115955
|
+
return path48 ? `\u23FA ${str(change.kind) || "change"}(${path48})
|
|
115945
115956
|
` : "";
|
|
115946
115957
|
}).join("");
|
|
115947
115958
|
}
|
|
@@ -116257,10 +116268,10 @@ function readKimiRunFacts(sessionId) {
|
|
|
116257
116268
|
const total = { input: 0, cacheCreation: 0, cacheRead: 0, output: 0 };
|
|
116258
116269
|
let model;
|
|
116259
116270
|
let holding = 0;
|
|
116260
|
-
for (const { path:
|
|
116271
|
+
for (const { path: path48, main } of wireFiles(entry.sessionDir)) {
|
|
116261
116272
|
let raw;
|
|
116262
116273
|
try {
|
|
116263
|
-
raw = readFileSync2(
|
|
116274
|
+
raw = readFileSync2(path48, "utf8");
|
|
116264
116275
|
} catch {
|
|
116265
116276
|
continue;
|
|
116266
116277
|
}
|
|
@@ -116496,7 +116507,7 @@ function createTail(log) {
|
|
|
116496
116507
|
// ../cli/package.json
|
|
116497
116508
|
var package_default = {
|
|
116498
116509
|
name: "wildcrane",
|
|
116499
|
-
version: "0.11.
|
|
116510
|
+
version: "0.11.71",
|
|
116500
116511
|
akbContract: 17,
|
|
116501
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.",
|
|
116502
116513
|
keywords: [
|
|
@@ -116570,8 +116581,8 @@ var CLIENT_CAPABILITIES = {
|
|
|
116570
116581
|
};
|
|
116571
116582
|
function whereHint(update2, title) {
|
|
116572
116583
|
const locations = Array.isArray(update2.locations) ? update2.locations : [];
|
|
116573
|
-
const
|
|
116574
|
-
return
|
|
116584
|
+
const path48 = str(obj(locations[0]).path);
|
|
116585
|
+
return path48 && !title.includes(path48) ? hint(path48) : "";
|
|
116575
116586
|
}
|
|
116576
116587
|
function saidBy(update2) {
|
|
116577
116588
|
const content = Array.isArray(update2.content) ? update2.content : [];
|
|
@@ -117542,7 +117553,7 @@ async function run2(io, options, count2) {
|
|
|
117542
117553
|
startupTimer = setTimeout(() => {
|
|
117543
117554
|
if (!started) io.event?.({ kind: "log", data: { text: "[conversation] start_unconfirmed" } });
|
|
117544
117555
|
}, CONVERSATION_MS.start);
|
|
117545
|
-
await bounded(rpc.call("turn/start", { threadId, input: [{ type: "text", text: text4 }, ...images.map((
|
|
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) => {
|
|
117546
117557
|
if (!started) throw error;
|
|
117547
117558
|
});
|
|
117548
117559
|
};
|
|
@@ -117970,11 +117981,11 @@ import { spawn as spawn3 } from "node:child_process";
|
|
|
117970
117981
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
117971
117982
|
import fs31 from "node:fs";
|
|
117972
117983
|
import os5 from "node:os";
|
|
117973
|
-
import
|
|
117984
|
+
import path35 from "node:path";
|
|
117974
117985
|
|
|
117975
117986
|
// ../cli/src/lib/agent/harnesses/antigravity.ts
|
|
117976
117987
|
import fs28 from "node:fs";
|
|
117977
|
-
import
|
|
117988
|
+
import path30 from "node:path";
|
|
117978
117989
|
import { createHash as createHash4 } from "node:crypto";
|
|
117979
117990
|
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
117980
117991
|
|
|
@@ -118319,11 +118330,62 @@ function modelsIn2(file2, pick2, salt = "") {
|
|
|
118319
118330
|
return found.length ? found : hit?.found ?? [];
|
|
118320
118331
|
}
|
|
118321
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;
|
|
118380
|
+
}
|
|
118381
|
+
|
|
118322
118382
|
// ../cli/src/lib/agent/wire/antigravity.ts
|
|
118383
|
+
import path29 from "node:path";
|
|
118323
118384
|
var KINDS = {
|
|
118324
118385
|
run_command: "execute",
|
|
118325
118386
|
command_status: "execute",
|
|
118326
118387
|
send_command_input: "execute",
|
|
118388
|
+
read_file: "read",
|
|
118327
118389
|
view_file: "read",
|
|
118328
118390
|
list_dir: "read",
|
|
118329
118391
|
grep_search: "search",
|
|
@@ -118347,14 +118409,39 @@ function failureHint(reason) {
|
|
|
118347
118409
|
return hint2 ? `${reason}
|
|
118348
118410
|
${hint2}` : reason;
|
|
118349
118411
|
}
|
|
118350
|
-
|
|
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()) {
|
|
118351
118415
|
let session = expectedSession;
|
|
118352
118416
|
let model;
|
|
118417
|
+
let partial = "";
|
|
118353
118418
|
let final;
|
|
118354
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}`;
|
|
118355
118426
|
let terminal = false;
|
|
118356
118427
|
let offStream;
|
|
118357
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
|
+
};
|
|
118358
118445
|
let used;
|
|
118359
118446
|
let turnUsage = zero();
|
|
118360
118447
|
let previous;
|
|
@@ -118363,6 +118450,8 @@ function createAntigravityRenderer(expectedSession) {
|
|
|
118363
118450
|
const closed = /* @__PURE__ */ new Set();
|
|
118364
118451
|
const events = createEventCollector();
|
|
118365
118452
|
const fail = (reason) => {
|
|
118453
|
+
if (limited(reason)) rateLimit = failureHint(reason);
|
|
118454
|
+
if (failure && manualFailure(failure) && !(limited(failure) && limited(reason))) return;
|
|
118366
118455
|
failure = failureHint(reason);
|
|
118367
118456
|
events.error(failure);
|
|
118368
118457
|
};
|
|
@@ -118370,6 +118459,7 @@ function createAntigravityRenderer(expectedSession) {
|
|
|
118370
118459
|
const e2 = frame(line);
|
|
118371
118460
|
if (!e2) {
|
|
118372
118461
|
offStream = line.trim() || offStream;
|
|
118462
|
+
if (/^(?:error:|rpc error:)/i.test(line.trim()) && limited(line)) fail(line.trim());
|
|
118373
118463
|
return `${line}
|
|
118374
118464
|
`;
|
|
118375
118465
|
}
|
|
@@ -118388,10 +118478,19 @@ function createAntigravityRenderer(expectedSession) {
|
|
|
118388
118478
|
if (expectedSession && str(step.conversation_id) !== expectedSession) return "";
|
|
118389
118479
|
session = str(step.conversation_id) || session;
|
|
118390
118480
|
const id = String(step.step_index ?? "");
|
|
118481
|
+
if (step.state === "DONE" && ["agent_response", "checkpoint"].includes(str(step.step_type))) countCost(step);
|
|
118391
118482
|
if (step.step_type === "agent_response") {
|
|
118392
118483
|
const text4 = str(step.text_delta);
|
|
118484
|
+
partial += text4;
|
|
118393
118485
|
if (text4) events.update({ sessionUpdate: "agent_message_chunk", content: { text: text4 } });
|
|
118394
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
|
+
}
|
|
118395
118494
|
if (step.state === "DONE" && step.usage && !counted.has(index)) {
|
|
118396
118495
|
counted.add(index);
|
|
118397
118496
|
turnUsage = add(turnUsage, usageOf4(step.usage));
|
|
@@ -118417,7 +118516,20 @@ function createAntigravityRenderer(expectedSession) {
|
|
|
118417
118516
|
if (reason && /permission|denied|soft.den/i.test(reason)) fail(reason);
|
|
118418
118517
|
if (["DONE", "ERROR", "CANCELED", "INTERRUPTED"].includes(str(step.state)) && !closed.has(id)) {
|
|
118419
118518
|
closed.add(id);
|
|
118420
|
-
|
|
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);
|
|
118421
118533
|
}
|
|
118422
118534
|
return out;
|
|
118423
118535
|
}
|
|
@@ -118437,36 +118549,55 @@ function createAntigravityRenderer(expectedSession) {
|
|
|
118437
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;
|
|
118438
118550
|
previous = total;
|
|
118439
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();
|
|
118440
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.");
|
|
118441
118558
|
if (typeof result.response !== "string" || result.status !== "SUCCESS" || str(result.error) || result.finished_reason && result.finished_reason !== "completed" && result.finished_reason !== "success") {
|
|
118442
|
-
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"}`);
|
|
118443
118560
|
}
|
|
118444
118561
|
events.end();
|
|
118445
118562
|
turnUsage = zero();
|
|
118446
118563
|
counted.clear();
|
|
118447
|
-
return failure ? `
|
|
118448
|
-
[error] ${failure}
|
|
118564
|
+
return failure || imageFailure ? `
|
|
118565
|
+
[error] ${failure || imageFailure}
|
|
118449
118566
|
` : "";
|
|
118450
118567
|
}
|
|
118451
118568
|
return "";
|
|
118452
118569
|
});
|
|
118453
118570
|
return {
|
|
118454
118571
|
push: reader.push,
|
|
118572
|
+
setRequiredImages(files) {
|
|
118573
|
+
requiredImages = files.filter(imagePath).map((file2) => path29.resolve(cwd, file2));
|
|
118574
|
+
},
|
|
118455
118575
|
flush() {
|
|
118456
118576
|
const text4 = reader.flush();
|
|
118457
|
-
if (!terminal)
|
|
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
|
+
}
|
|
118458
118584
|
events.end();
|
|
118459
118585
|
return text4;
|
|
118460
118586
|
},
|
|
118461
118587
|
stderr(chunk) {
|
|
118462
118588
|
stderr = (stderr + chunk).slice(-16e3);
|
|
118589
|
+
if (limited(stderr)) fail(stderr.trim());
|
|
118463
118590
|
if (/soft.denied|auto-denied|permission (?:denied|required)|denied by.*(?:policy|rule)|requires? (?:user )?(?:approval|permission)/i.test(stderr)) fail(stderr.trim());
|
|
118464
118591
|
},
|
|
118465
|
-
result: () => final,
|
|
118592
|
+
result: () => final || (failure ? partial || void 0 : final),
|
|
118466
118593
|
resumeId: () => session,
|
|
118467
118594
|
model: () => model,
|
|
118468
118595
|
usage: () => used,
|
|
118469
|
-
|
|
118596
|
+
costUsd: () => cost,
|
|
118597
|
+
costIncomplete: () => incomplete || void 0,
|
|
118598
|
+
context: () => context,
|
|
118599
|
+
failure: () => failure || imageFailure,
|
|
118600
|
+
rateLimit: () => rateLimit,
|
|
118470
118601
|
offStream: () => offStream,
|
|
118471
118602
|
events: events.events
|
|
118472
118603
|
};
|
|
@@ -118539,18 +118670,19 @@ var ANTIGRAVITY = {
|
|
|
118539
118670
|
return result.status === 0 ? antigravityModels(result.stdout ?? "").map((m) => m.id) : [];
|
|
118540
118671
|
},
|
|
118541
118672
|
env: () => ({ ...process.env }),
|
|
118542
|
-
|
|
118673
|
+
images: { as: "message" },
|
|
118674
|
+
renderer: (cwd, _binary, argv = []) => {
|
|
118543
118675
|
const at2 = argv.indexOf("--conversation");
|
|
118544
|
-
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);
|
|
118545
118677
|
},
|
|
118546
118678
|
systemPrompt(text4, _argv, env2) {
|
|
118547
118679
|
const rule = `${text4}
|
|
118548
118680
|
|
|
118549
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.`;
|
|
118550
118682
|
const hash = createHash4("sha256").update(rule).digest("hex").slice(0, 16);
|
|
118551
|
-
const root2 =
|
|
118552
|
-
const file2 =
|
|
118553
|
-
fs28.mkdirSync(
|
|
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 });
|
|
118554
118686
|
fs28.writeFileSync(file2, `---
|
|
118555
118687
|
trigger: always_on
|
|
118556
118688
|
---
|
|
@@ -118559,10 +118691,11 @@ ${rule}
|
|
|
118559
118691
|
`);
|
|
118560
118692
|
return { args: ["--add-dir", root2] };
|
|
118561
118693
|
},
|
|
118562
|
-
|
|
118694
|
+
transient: ({ failure }) => providerBlip(failure),
|
|
118695
|
+
reports: ["cost", "tokens", "model", "context"],
|
|
118563
118696
|
adoptsSessionId: false,
|
|
118564
|
-
savesSessionAtOpen:
|
|
118565
|
-
stopsOnRateLimit:
|
|
118697
|
+
savesSessionAtOpen: true,
|
|
118698
|
+
stopsOnRateLimit: true,
|
|
118566
118699
|
// `models` is read-only. Only explicit authentication errors mean signed out.
|
|
118567
118700
|
login: {
|
|
118568
118701
|
args: ["models"],
|
|
@@ -118653,54 +118786,7 @@ function checkHarnesses(harnesses) {
|
|
|
118653
118786
|
}
|
|
118654
118787
|
|
|
118655
118788
|
// ../cli/src/lib/agent/harnesses/claude-code.ts
|
|
118656
|
-
import
|
|
118657
|
-
|
|
118658
|
-
// ../cli/src/lib/agent/harnesses/transient.ts
|
|
118659
|
-
var MANUAL = [
|
|
118660
|
-
/\b(401|403)\b/,
|
|
118661
|
-
/unauthorized|forbidden|permission denied/,
|
|
118662
|
-
/authenticat|invalid api key|api[_ ]key|not logged in|\/login|oauth/,
|
|
118663
|
-
/\b429\b/,
|
|
118664
|
-
/rate[_ ]limit|usage limit|quota|credit balance|insufficient|out of tokens/,
|
|
118665
|
-
/cancell?ed|aborted by|interrupted by the user/,
|
|
118666
|
-
/maximum budget|max(imum)? turns|exceeded the budget/,
|
|
118667
|
-
/model not found|unknown model|unsupported|invalid[_ ]request/
|
|
118668
|
-
];
|
|
118669
|
-
var PASSING = [
|
|
118670
|
-
// 502/503/529 are distinctive enough to read as a status wherever they appear. A bare
|
|
118671
|
-
// 500 is not — a failure line counting something would match it — so it is left to the
|
|
118672
|
-
// words below, which is how that status is actually written out.
|
|
118673
|
-
/\b(502|503|529)\b/,
|
|
118674
|
-
/overloaded|service unavailable|bad gateway|internal server error|server_error/,
|
|
118675
|
-
/connection (lost|dropped|reset|error|closed)|socket hang up|stream (error|disconnected)/,
|
|
118676
|
-
/econnreset|econnrefused|etimedout|enetunreach|enotfound|eai_again/,
|
|
118677
|
-
/fetch failed|request timed out|network error/
|
|
118678
|
-
];
|
|
118679
|
-
var RETRY_AFTER = /retry[-_\s]?after["':=\s]+(\d+)/i;
|
|
118680
|
-
var REASON_MAX = 140;
|
|
118681
|
-
function reasonLine(text4, rule) {
|
|
118682
|
-
const line = text4.split("\n").find((l2) => rule.test(l2.toLowerCase())) ?? text4;
|
|
118683
|
-
const said = line.trim().replace(/\s+/g, " ");
|
|
118684
|
-
return said.length > REASON_MAX ? `${said.slice(0, REASON_MAX - 1)}\u2026` : said;
|
|
118685
|
-
}
|
|
118686
|
-
function providerBlip(...said) {
|
|
118687
|
-
for (const text4 of said) {
|
|
118688
|
-
if (!text4?.trim()) continue;
|
|
118689
|
-
const lower = text4.toLowerCase();
|
|
118690
|
-
if (MANUAL.some((rule) => rule.test(lower))) return void 0;
|
|
118691
|
-
const hit = PASSING.find((rule) => rule.test(lower));
|
|
118692
|
-
if (!hit) continue;
|
|
118693
|
-
const asked = RETRY_AFTER.exec(text4);
|
|
118694
|
-
const seconds = asked ? Number(asked[1]) : NaN;
|
|
118695
|
-
return {
|
|
118696
|
-
reason: reasonLine(text4, hit),
|
|
118697
|
-
...Number.isFinite(seconds) && seconds > 0 ? { retryAfterMs: seconds * 1e3 } : {}
|
|
118698
|
-
};
|
|
118699
|
-
}
|
|
118700
|
-
return void 0;
|
|
118701
|
-
}
|
|
118702
|
-
|
|
118703
|
-
// ../cli/src/lib/agent/harnesses/claude-code.ts
|
|
118789
|
+
import path31 from "node:path";
|
|
118704
118790
|
var cliSaid = (said) => /^\s*API Error\b/i.test(said ?? "") ? said : void 0;
|
|
118705
118791
|
var MODEL_ALIASES = ["opus", "sonnet", "haiku", "fable"];
|
|
118706
118792
|
function claudeStreamArgs(argv) {
|
|
@@ -118712,15 +118798,15 @@ var userMessage = (prompt) => `${JSON.stringify({ type: "user", message: { role:
|
|
|
118712
118798
|
`;
|
|
118713
118799
|
function claudeOnWindows() {
|
|
118714
118800
|
const [local, roaming] = [process.env.LOCALAPPDATA?.trim(), process.env.APPDATA?.trim()];
|
|
118715
|
-
const packages = local ?
|
|
118801
|
+
const packages = local ? path31.join(local, "Packages") : "";
|
|
118716
118802
|
const data = [
|
|
118717
|
-
...folders(packages).filter((name) => /^(\w+\.)?Claude_/i.test(name)).sort().map((name) =>
|
|
118718
|
-
...roaming ? [
|
|
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")] : []
|
|
118719
118805
|
];
|
|
118720
118806
|
return data.flatMap(
|
|
118721
|
-
(dir) => latestIn(
|
|
118722
|
-
|
|
118723
|
-
...folders(version).map((build) =>
|
|
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"))
|
|
118724
118810
|
])
|
|
118725
118811
|
);
|
|
118726
118812
|
}
|
|
@@ -118976,7 +119062,7 @@ var CLAUDE_CODE = {
|
|
|
118976
119062
|
...latestIn(home2(".local", "share", "claude", "versions")),
|
|
118977
119063
|
// The copy Claude Desktop carries.
|
|
118978
119064
|
...process.platform === "win32" ? claudeOnWindows() : latestIn(home2("Library", "Application Support", "Claude", "claude-code")).flatMap(
|
|
118979
|
-
(version) => folders(version).map((build) =>
|
|
119065
|
+
(version) => folders(version).map((build) => path31.join(version, build, "claude.app", "Contents", "MacOS", "claude"))
|
|
118980
119066
|
)
|
|
118981
119067
|
],
|
|
118982
119068
|
install: "npm install -g @anthropic-ai/claude-code"
|
|
@@ -118984,7 +119070,7 @@ var CLAUDE_CODE = {
|
|
|
118984
119070
|
|
|
118985
119071
|
// ../cli/src/lib/agent/harnesses/codex.ts
|
|
118986
119072
|
import fs29 from "node:fs";
|
|
118987
|
-
import
|
|
119073
|
+
import path32 from "node:path";
|
|
118988
119074
|
|
|
118989
119075
|
// ../cli/src/lib/agent/worktree.ts
|
|
118990
119076
|
import { spawnSync as spawnSync6 } from "node:child_process";
|
|
@@ -119031,10 +119117,10 @@ function codexExtraArgs(argv, cwd = REPO_ROOT) {
|
|
|
119031
119117
|
}
|
|
119032
119118
|
const flags = [...argv, ...extra];
|
|
119033
119119
|
const workspaceWrite = flags.some((arg, i) => arg === "--full-auto" || arg === "--sandbox=workspace-write" || (arg === "--sandbox" || arg === "-s") && flags[i + 1] === "workspace-write");
|
|
119034
|
-
if (workspaceWrite &&
|
|
119120
|
+
if (workspaceWrite && path32.resolve(cwd) !== path32.resolve(REPO_ROOT)) {
|
|
119035
119121
|
for (const dir of [KANBAN, AKB_DIR]) {
|
|
119036
|
-
const relative =
|
|
119037
|
-
if (relative === ".." || relative.startsWith(`..${
|
|
119122
|
+
const relative = path32.relative(cwd, dir);
|
|
119123
|
+
if (relative === ".." || relative.startsWith(`..${path32.sep}`) || path32.isAbsolute(relative)) {
|
|
119038
119124
|
extra.push("--add-dir", dir);
|
|
119039
119125
|
}
|
|
119040
119126
|
}
|
|
@@ -119083,28 +119169,28 @@ function codexOnWindows() {
|
|
|
119083
119169
|
const local = envRoot("LOCALAPPDATA");
|
|
119084
119170
|
const profile = envRoot("USERPROFILE");
|
|
119085
119171
|
const programs = envRoot("ProgramFiles");
|
|
119086
|
-
const cache = local ?
|
|
119087
|
-
const releases = profile ?
|
|
119088
|
-
const packages = programs ?
|
|
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") : "";
|
|
119089
119175
|
return [
|
|
119090
119176
|
// Desktop's relocated CLI cache: a folder per build hash, newest file first.
|
|
119091
|
-
...byNewest(folders(cache).map((name) =>
|
|
119177
|
+
...byNewest(folders(cache).map((name) => path32.join(cache, name, "codex.exe"))),
|
|
119092
119178
|
// The separate standalone launcher, at a path with nothing variable in it.
|
|
119093
|
-
...local ? [
|
|
119179
|
+
...local ? [path32.join(local, "Programs", "OpenAI", "Codex", "bin", "codex.exe")] : [],
|
|
119094
119180
|
// That launcher's release payload: a folder per version and target.
|
|
119095
119181
|
...byVersion(folders(releases).filter(ourArch)).map(
|
|
119096
|
-
(name) =>
|
|
119182
|
+
(name) => path32.join(releases, name, "bin", "codex.exe")
|
|
119097
119183
|
),
|
|
119098
119184
|
// Desktop's own MSIX package.
|
|
119099
119185
|
...byVersion(folders(packages).filter((name) => name.startsWith("OpenAI.Codex_")).filter(ourArch)).map(
|
|
119100
|
-
(name) =>
|
|
119186
|
+
(name) => path32.join(packages, name, "app", "resources", "codex.exe")
|
|
119101
119187
|
)
|
|
119102
119188
|
];
|
|
119103
119189
|
}
|
|
119104
119190
|
function codexInstalls() {
|
|
119105
119191
|
const chosen = process.env.CODEX_INSTALL_DIR?.trim();
|
|
119106
119192
|
return [
|
|
119107
|
-
...chosen ? [
|
|
119193
|
+
...chosen ? [path32.join(chosen, "codex")] : [],
|
|
119108
119194
|
...process.platform === "win32" ? codexOnWindows() : [
|
|
119109
119195
|
// macOS, where Codex now lives in the merged app — `codex-cli/bin/` since 26.928…
|
|
119110
119196
|
"/Applications/ChatGPT.app/Contents/Resources/codex-cli/bin/codex",
|
|
@@ -119150,7 +119236,7 @@ var CODEX = {
|
|
|
119150
119236
|
systemPrompt(text4, argv) {
|
|
119151
119237
|
if (namesFlag(argv, ["developer_instructions", "model_instructions_file"])) return {};
|
|
119152
119238
|
try {
|
|
119153
|
-
const config = fs29.readFileSync(
|
|
119239
|
+
const config = fs29.readFileSync(path32.join(process.env.CODEX_HOME || home2(".codex"), "config.toml"), "utf8");
|
|
119154
119240
|
if (/^\s*(?:developer_instructions|model_instructions_file)\s*=/m.test(config)) return {};
|
|
119155
119241
|
} catch {
|
|
119156
119242
|
}
|
|
@@ -119392,23 +119478,23 @@ var CURSOR = {
|
|
|
119392
119478
|
|
|
119393
119479
|
// ../cli/src/lib/agent/harnesses/dsh.ts
|
|
119394
119480
|
import fs30 from "node:fs";
|
|
119395
|
-
import
|
|
119481
|
+
import path33 from "node:path";
|
|
119396
119482
|
function dshHome(argv) {
|
|
119397
119483
|
const binary = argv[0];
|
|
119398
119484
|
if (!binary) return void 0;
|
|
119399
|
-
const names2 = process.platform === "win32" && !
|
|
119400
|
-
const candidates = binary.includes("/") || binary.includes("\\") ? names2 : (process.env.PATH ?? "").split(
|
|
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)));
|
|
119401
119487
|
let dir;
|
|
119402
119488
|
try {
|
|
119403
119489
|
const found = candidates.find((candidate) => fs30.existsSync(candidate));
|
|
119404
119490
|
if (!found) return void 0;
|
|
119405
119491
|
const script = /\.cmd$/i.test(found) ? shimTarget(fs30.readFileSync(found, "utf8"), found)?.script : void 0;
|
|
119406
|
-
dir =
|
|
119492
|
+
dir = path33.dirname(fs30.realpathSync(script ?? found));
|
|
119407
119493
|
} catch {
|
|
119408
119494
|
return void 0;
|
|
119409
119495
|
}
|
|
119410
|
-
for (let up =
|
|
119411
|
-
if (fs30.existsSync(
|
|
119496
|
+
for (let up = path33.dirname(dir); dir !== up; up = path33.dirname(dir)) {
|
|
119497
|
+
if (fs30.existsSync(path33.join(dir, "package.json"))) return dir;
|
|
119412
119498
|
dir = up;
|
|
119413
119499
|
}
|
|
119414
119500
|
return void 0;
|
|
@@ -119996,7 +120082,7 @@ var DEFAULT_HARNESS = HARNESSES[0];
|
|
|
119996
120082
|
checkHarnesses(HARNESSES);
|
|
119997
120083
|
|
|
119998
120084
|
// ../cli/src/lib/agent/run-settings.ts
|
|
119999
|
-
import
|
|
120085
|
+
import path34 from "node:path";
|
|
120000
120086
|
|
|
120001
120087
|
// ../cli/src/lib/agent/providers.ts
|
|
120002
120088
|
function providerSetting(settings) {
|
|
@@ -120099,7 +120185,7 @@ function languageEnv(given) {
|
|
|
120099
120185
|
try {
|
|
120100
120186
|
const config = JSON.parse(env2.OPENCODE_CONFIG_CONTENT ?? "{}");
|
|
120101
120187
|
if (Array.isArray(config.instructions)) {
|
|
120102
|
-
config.instructions = config.instructions.filter((file2) => typeof file2 !== "string" ||
|
|
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)));
|
|
120103
120189
|
env2.OPENCODE_CONFIG_CONTENT = JSON.stringify(config);
|
|
120104
120190
|
}
|
|
120105
120191
|
} catch {
|
|
@@ -120115,7 +120201,7 @@ function withSystemLanguage(harness, argv, env2, language) {
|
|
|
120115
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.";
|
|
120116
120202
|
return { argv, env: env2, note };
|
|
120117
120203
|
}
|
|
120118
|
-
const at2 = /^node(?:\.exe)?$/.test(
|
|
120204
|
+
const at2 = /^node(?:\.exe)?$/.test(path34.basename(argv[0])) && argv[1] && !argv[1].startsWith("-") ? 2 : 1;
|
|
120119
120205
|
return { argv: [...argv.slice(0, at2), ...added?.args ?? [], ...argv.slice(at2)], env: { ...env2, ...added?.env } };
|
|
120120
120206
|
}
|
|
120121
120207
|
|
|
@@ -120299,8 +120385,8 @@ var sources2 = Object.fromEntries(
|
|
|
120299
120385
|
])
|
|
120300
120386
|
);
|
|
120301
120387
|
Object.assign(sources2, {
|
|
120302
|
-
"claude-code": () => claudeModels(
|
|
120303
|
-
codex: () => codexModels(
|
|
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")),
|
|
120304
120390
|
opencode: async (signal2) => opencodeModels(await output(commandOf(HARNESSES2.opencode)[0], ["models"], signal2)),
|
|
120305
120391
|
cursor: (signal2) => cursorModels(signal2),
|
|
120306
120392
|
antigravity: async (signal2) => antigravityModels(await output(commandOf(HARNESSES2.antigravity)[0], ["models"], signal2))
|
|
@@ -120388,7 +120474,7 @@ function claudeModels(dir) {
|
|
|
120388
120474
|
}
|
|
120389
120475
|
const catalogs = files.flatMap((f2) => {
|
|
120390
120476
|
try {
|
|
120391
|
-
const data = obj(JSON.parse(fs31.readFileSync(
|
|
120477
|
+
const data = obj(JSON.parse(fs31.readFileSync(path35.join(dir, f2), "utf8")));
|
|
120392
120478
|
const catalog = obj(data.catalog);
|
|
120393
120479
|
const surface = str(catalog.surface);
|
|
120394
120480
|
return surface === "cc" || surface === "ccd" ? [{ surface, at: Number(data.fetchedAt) || 0, config: obj(catalog.config) }] : [];
|
|
@@ -120435,7 +120521,7 @@ function probeLogin(binary, harness) {
|
|
|
120435
120521
|
|
|
120436
120522
|
// src/triage.ts
|
|
120437
120523
|
import fs32 from "node:fs";
|
|
120438
|
-
import
|
|
120524
|
+
import path36 from "node:path";
|
|
120439
120525
|
|
|
120440
120526
|
// ../cli/src/lib/signals/identity.ts
|
|
120441
120527
|
import { createHash as createHash5 } from "node:crypto";
|
|
@@ -120449,8 +120535,8 @@ function slugify(s) {
|
|
|
120449
120535
|
}
|
|
120450
120536
|
|
|
120451
120537
|
// src/triage.ts
|
|
120452
|
-
var triageDir = (board) =>
|
|
120453
|
-
var rejectedDir = (board) =>
|
|
120538
|
+
var triageDir = (board) => path36.join(board, "triage");
|
|
120539
|
+
var rejectedDir = (board) => path36.join(board, ".archive", REJECTIONS_TO_REVIEW);
|
|
120454
120540
|
var SCRATCH = ["dismissed", "archived"];
|
|
120455
120541
|
var stamp2 = (at2) => formatStamp(at2 ? new Date(at2) : /* @__PURE__ */ new Date());
|
|
120456
120542
|
function slugOf(title) {
|
|
@@ -120459,7 +120545,7 @@ function slugOf(title) {
|
|
|
120459
120545
|
function freeName(dir, title) {
|
|
120460
120546
|
const stem = slugOf(title);
|
|
120461
120547
|
let name = `${stem}.md`;
|
|
120462
|
-
for (let n = 2; fs32.existsSync(
|
|
120548
|
+
for (let n = 2; fs32.existsSync(path36.join(dir, name)); n++) name = `${stem}-${n}.md`;
|
|
120463
120549
|
return name;
|
|
120464
120550
|
}
|
|
120465
120551
|
function itemText(item, fields = {}) {
|
|
@@ -120481,7 +120567,7 @@ ${item.text.trim()}
|
|
|
120481
120567
|
function writeItem(dir, item, fields = {}) {
|
|
120482
120568
|
fs32.mkdirSync(dir, { recursive: true });
|
|
120483
120569
|
const name = freeName(dir, item.title);
|
|
120484
|
-
fs32.writeFileSync(
|
|
120570
|
+
fs32.writeFileSync(path36.join(dir, name), itemText(item, item.studio ? { studio: studioName(item.studio), ...fields } : fields));
|
|
120485
120571
|
return name;
|
|
120486
120572
|
}
|
|
120487
120573
|
function layOut(board, rejections) {
|
|
@@ -120489,7 +120575,7 @@ function layOut(board, rejections) {
|
|
|
120489
120575
|
const dir = rejectedDir(board);
|
|
120490
120576
|
fs32.mkdirSync(dir, { recursive: true });
|
|
120491
120577
|
for (const t of rejections.tasks) {
|
|
120492
|
-
fs32.writeFileSync(
|
|
120578
|
+
fs32.writeFileSync(path36.join(dir, `${t.number}-${slugify(t.title)}.md`), [
|
|
120493
120579
|
"---",
|
|
120494
120580
|
`title: ${yamlScalar(t.title)}`,
|
|
120495
120581
|
"status: todo",
|
|
@@ -120504,7 +120590,7 @@ function layOut(board, rejections) {
|
|
|
120504
120590
|
].join("\n"));
|
|
120505
120591
|
}
|
|
120506
120592
|
for (const item of rejections.triage) {
|
|
120507
|
-
const sub =
|
|
120593
|
+
const sub = path36.join(triageDir(board), item.state === "dismissed" ? "dismissed" : "archived");
|
|
120508
120594
|
const fields = item.state === "dismissed" ? { dismissed_at: stamp2(item.dismissed_at), dismissed_by: "user", ...item.dismissed_reason ? { dismissed_reason: item.dismissed_reason } : {} } : {};
|
|
120509
120595
|
writeItem(sub, item, fields);
|
|
120510
120596
|
}
|
|
@@ -120512,13 +120598,13 @@ function layOut(board, rejections) {
|
|
|
120512
120598
|
}
|
|
120513
120599
|
function clearLaid(board) {
|
|
120514
120600
|
fs32.rmSync(rejectedDir(board), { recursive: true, force: true });
|
|
120515
|
-
for (const sub of SCRATCH) fs32.rmSync(
|
|
120601
|
+
for (const sub of SCRATCH) fs32.rmSync(path36.join(triageDir(board), sub), { recursive: true, force: true });
|
|
120516
120602
|
}
|
|
120517
120603
|
|
|
120518
120604
|
// ../cli/src/lib/skill/hook.ts
|
|
120519
120605
|
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
120520
120606
|
import fs33 from "node:fs";
|
|
120521
|
-
import
|
|
120607
|
+
import path37 from "node:path";
|
|
120522
120608
|
var MARKER_LINE = /^# ai4kanban commit guard\b/m;
|
|
120523
120609
|
var read2 = (file2) => {
|
|
120524
120610
|
try {
|
|
@@ -120534,12 +120620,12 @@ function hooksDir(root2) {
|
|
|
120534
120620
|
windowsHide: true
|
|
120535
120621
|
});
|
|
120536
120622
|
if (out.error || out.status !== 0 || !out.stdout.trim()) return null;
|
|
120537
|
-
return
|
|
120623
|
+
return path37.resolve(root2, out.stdout.trim());
|
|
120538
120624
|
}
|
|
120539
120625
|
function installCommitHook(root2, _board) {
|
|
120540
120626
|
const dir = hooksDir(root2);
|
|
120541
120627
|
if (!dir) return {};
|
|
120542
|
-
const file2 =
|
|
120628
|
+
const file2 = path37.join(dir, "pre-commit");
|
|
120543
120629
|
if (fs33.lstatSync(file2, { throwIfNoEntry: false })?.isSymbolicLink()) return {};
|
|
120544
120630
|
const source2 = read2(file2);
|
|
120545
120631
|
if (source2 && MARKER_LINE.test(source2)) fs33.unlinkSync(file2);
|
|
@@ -120594,7 +120680,7 @@ function asks(file2) {
|
|
|
120594
120680
|
}
|
|
120595
120681
|
function mcpConfig(servers, file2) {
|
|
120596
120682
|
if (!Object.keys(servers).length) return null;
|
|
120597
|
-
fs34.mkdirSync(
|
|
120683
|
+
fs34.mkdirSync(path38.dirname(file2), { recursive: true });
|
|
120598
120684
|
fs34.writeFileSync(file2, `${JSON.stringify({ mcpServers: servers }, null, 2)}
|
|
120599
120685
|
`);
|
|
120600
120686
|
return file2;
|
|
@@ -120629,7 +120715,7 @@ function deliveryEnding(ws, id, asked = false) {
|
|
|
120629
120715
|
if (!id) return null;
|
|
120630
120716
|
let held5;
|
|
120631
120717
|
try {
|
|
120632
|
-
held5 = JSON.parse(fs34.readFileSync(
|
|
120718
|
+
held5 = JSON.parse(fs34.readFileSync(path38.join(ws.board, "deliveries", `${path38.basename(id)}.json`), "utf8"));
|
|
120633
120719
|
} catch {
|
|
120634
120720
|
return null;
|
|
120635
120721
|
}
|
|
@@ -120641,7 +120727,7 @@ function deliveryEnding(ws, id, asked = false) {
|
|
|
120641
120727
|
return null;
|
|
120642
120728
|
}
|
|
120643
120729
|
function checkoutsOf(ws, id) {
|
|
120644
|
-
const dir =
|
|
120730
|
+
const dir = path38.join(ws.board, "deliveries");
|
|
120645
120731
|
let names2;
|
|
120646
120732
|
try {
|
|
120647
120733
|
names2 = fs34.readdirSync(dir).filter((n) => n.endsWith(".json"));
|
|
@@ -120650,7 +120736,7 @@ function checkoutsOf(ws, id) {
|
|
|
120650
120736
|
}
|
|
120651
120737
|
return names2.flatMap((n) => {
|
|
120652
120738
|
try {
|
|
120653
|
-
const held5 = JSON.parse(fs34.readFileSync(
|
|
120739
|
+
const held5 = JSON.parse(fs34.readFileSync(path38.join(dir, n), "utf8"));
|
|
120654
120740
|
return held5.cardId === id && held5.deliveryId ? [held5.deliveryId] : [];
|
|
120655
120741
|
} catch {
|
|
120656
120742
|
return [];
|
|
@@ -120664,7 +120750,7 @@ var RESUME_REFUSED = {
|
|
|
120664
120750
|
deliveryRunGoing: "\u4E0A\u6B21\u7684\u8FD0\u884C\u8FD8\u6CA1\u505C\u4E0B\uFF0C\u8BF7\u7A0D\u540E\u518D\u70B9\u300C\u7EED\u8DD1\u300D\u3002",
|
|
120665
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"
|
|
120666
120752
|
};
|
|
120667
|
-
var isArchived = (ws, id) =>
|
|
120753
|
+
var isArchived = (ws, id) => path38.relative(ws.board, findCard(ws.board, id) ?? ws.board).split(path38.sep)[0] === ".archive";
|
|
120668
120754
|
var refusal2 = (ran) => ran.last.replace(/^akb( raw)?: /, "").slice(0, 300) || "akb stopped with an error.";
|
|
120669
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;
|
|
120670
120756
|
function logLines(show, event2) {
|
|
@@ -120734,7 +120820,7 @@ async function setUp(job, ws, deps, io) {
|
|
|
120734
120820
|
const runtime = job.runtime;
|
|
120735
120821
|
const missing = unavailable(runtime, await deps.runtimes());
|
|
120736
120822
|
if (missing) return missing;
|
|
120737
|
-
if (!fs34.existsSync(
|
|
120823
|
+
if (!fs34.existsSync(path38.join(ws.board, "config.md"))) {
|
|
120738
120824
|
const init = await akb(["raw", "init"]);
|
|
120739
120825
|
if (init.code !== 0) return refusal2(init);
|
|
120740
120826
|
}
|
|
@@ -120747,7 +120833,7 @@ async function setUp(job, ws, deps, io) {
|
|
|
120747
120833
|
const used = await akb(["raw", "agent", "use", runtime]);
|
|
120748
120834
|
if (used.code !== 0) return refusal2(used);
|
|
120749
120835
|
const servers = mcpServersOf(ws);
|
|
120750
|
-
const mcpFile =
|
|
120836
|
+
const mcpFile = path38.join(ws.board, ".sync", `${ws.task}.mcp.json`);
|
|
120751
120837
|
const takes = new Set(settingKeys(runtime));
|
|
120752
120838
|
const given = job.settings ?? {};
|
|
120753
120839
|
const values = valuesOf(runtime, job.model, given, servers, mcpFile);
|
|
@@ -120870,7 +120956,7 @@ async function runAgent(job, ws, deps, io) {
|
|
|
120870
120956
|
}
|
|
120871
120957
|
function writeTranscript(job, dir) {
|
|
120872
120958
|
if (!job.transcript) return "";
|
|
120873
|
-
const file2 =
|
|
120959
|
+
const file2 = path38.join(dir, "discussion.md");
|
|
120874
120960
|
fs34.mkdirSync(dir, { recursive: true });
|
|
120875
120961
|
fs34.writeFileSync(file2, `${job.transcript}
|
|
120876
120962
|
`);
|
|
@@ -120881,8 +120967,8 @@ function pictures(job, ws, id) {
|
|
|
120881
120967
|
if (!job.attachments.length || !dir) return "";
|
|
120882
120968
|
fs34.mkdirSync(dir, { recursive: true });
|
|
120883
120969
|
return job.attachments.map((a2, i) => {
|
|
120884
|
-
const file2 = `${i + 1}-${
|
|
120885
|
-
fs34.writeFileSync(
|
|
120970
|
+
const file2 = `${i + 1}-${path38.basename(a2.name).replace(/[^\w.-]+/g, "-")}`;
|
|
120971
|
+
fs34.writeFileSync(path38.join(dir, file2), Buffer.from(a2.content, "base64"));
|
|
120886
120972
|
return `
|
|
120887
120973
|
<Asset src=".assets/${id}/${file2}" label="${a2.name.replace(/["<>]/g, "") || file2}" />
|
|
120888
120974
|
`;
|
|
@@ -120890,7 +120976,7 @@ function pictures(job, ws, id) {
|
|
|
120890
120976
|
}
|
|
120891
120977
|
function cardFlags(ws, fields) {
|
|
120892
120978
|
if (!fields) return [];
|
|
120893
|
-
const open = (keys) => (keys ?? []).map((k2) => Number(/(\d+)$/.exec(k2)?.[1])).filter((n) => n > 0 && n !== ws.number && findCard(ws.board, n)?.startsWith(
|
|
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));
|
|
120894
120980
|
const lists = [["--modules", fields.modules ?? []], ["--related", open(fields.related)], ["--blocked-by", open(fields.blocked_by)]];
|
|
120895
120981
|
return [
|
|
120896
120982
|
...fields.priority ? ["--priority", fields.priority] : [],
|
|
@@ -120921,8 +121007,8 @@ async function runFlow(job, ws, deps, io) {
|
|
|
120921
121007
|
said = { title: task.value.title?.trim() ?? "", request: task.value.request?.trim() ?? "" };
|
|
120922
121008
|
}
|
|
120923
121009
|
const title = said.title || "Untitled";
|
|
120924
|
-
const body =
|
|
120925
|
-
fs34.mkdirSync(
|
|
121010
|
+
const body = path38.join(ws.board, ".sync", `${ws.task}.request.md`);
|
|
121011
|
+
fs34.mkdirSync(path38.dirname(body), { recursive: true });
|
|
120926
121012
|
if (!ws.number) return fail("This task has no number yet.");
|
|
120927
121013
|
fs34.writeFileSync(body, `${said.request || title}
|
|
120928
121014
|
${pictures(job, ws, ws.number)}`);
|
|
@@ -120962,7 +121048,7 @@ ${pictures(job, ws, ws.number)}`);
|
|
|
120962
121048
|
if (io.lost()) return fail("");
|
|
120963
121049
|
return await workOn(card);
|
|
120964
121050
|
} finally {
|
|
120965
|
-
fs34.rmSync(
|
|
121051
|
+
fs34.rmSync(path38.join(ws.board, ".sync", `${ws.task}.discussion`), { recursive: true, force: true });
|
|
120966
121052
|
const left = working.get(key) - 1;
|
|
120967
121053
|
if (left) working.set(key, left);
|
|
120968
121054
|
else working.delete(key);
|
|
@@ -121007,7 +121093,7 @@ ${pictures(job, ws, ws.number)}`);
|
|
|
121007
121093
|
const resolved = await akb(["raw", "card", "resolve", String(id2), "--follow", "--events", "--json", "--", text4], true);
|
|
121008
121094
|
if (io.lost()) return fail("");
|
|
121009
121095
|
const file2 = findCard(ws.board, id2);
|
|
121010
|
-
rejected = !!file2 &&
|
|
121096
|
+
rejected = !!file2 && path38.relative(ws.board, file2).split(path38.sep)[0] === ".archive" && parseFrontmatter(fs34.readFileSync(file2, "utf8")).meta?.rejected === true;
|
|
121011
121097
|
if (rejected) ran = resolved;
|
|
121012
121098
|
else if (resolved.code !== 0) note = text4;
|
|
121013
121099
|
}
|
|
@@ -121057,7 +121143,7 @@ ${pictures(job, ws, ws.number)}`);
|
|
|
121057
121143
|
}
|
|
121058
121144
|
function carryArgs(verb) {
|
|
121059
121145
|
if (!["refine", "resolve", "revise"].includes(verb)) return [];
|
|
121060
|
-
const transcript = writeTranscript(job,
|
|
121146
|
+
const transcript = writeTranscript(job, path38.join(ws.board, ".sync", `${ws.task}.discussion`));
|
|
121061
121147
|
return [
|
|
121062
121148
|
...job.resume ? ["--session", job.resume, ...job.fork ? ["--fork"] : []] : [],
|
|
121063
121149
|
...transcript ? ["--transcript", transcript] : []
|
|
@@ -121077,7 +121163,7 @@ async function confirmFlowStopped(ws, job, deps) {
|
|
|
121077
121163
|
|
|
121078
121164
|
// src/recovery.ts
|
|
121079
121165
|
import fs35 from "node:fs";
|
|
121080
|
-
import
|
|
121166
|
+
import path39 from "node:path";
|
|
121081
121167
|
|
|
121082
121168
|
// ../cli/src/lib/agent/retry.ts
|
|
121083
121169
|
var RETRY_WINDOW_MS = 15 * 6e4;
|
|
@@ -121090,7 +121176,7 @@ function backoffMs(attempt, random = Math.random) {
|
|
|
121090
121176
|
}
|
|
121091
121177
|
|
|
121092
121178
|
// src/recovery.ts
|
|
121093
|
-
var fileOf = (id) =>
|
|
121179
|
+
var fileOf = (id) => path39.join(runnerHome(), "checkpoints", `${encodeURIComponent(id)}.json`);
|
|
121094
121180
|
function readCheckpoint(id) {
|
|
121095
121181
|
try {
|
|
121096
121182
|
const held5 = JSON.parse(fs35.readFileSync(fileOf(id), "utf8"));
|
|
@@ -121103,7 +121189,7 @@ function readCheckpoint(id) {
|
|
|
121103
121189
|
}
|
|
121104
121190
|
function saveCheckpoint(id, checkpoint) {
|
|
121105
121191
|
const file2 = fileOf(id);
|
|
121106
|
-
fs35.mkdirSync(
|
|
121192
|
+
fs35.mkdirSync(path39.dirname(file2), { recursive: true, mode: 448 });
|
|
121107
121193
|
fs35.writeFileSync(`${file2}.tmp`, JSON.stringify(checkpoint), { mode: 384 });
|
|
121108
121194
|
fs35.renameSync(`${file2}.tmp`, file2);
|
|
121109
121195
|
}
|
|
@@ -121263,7 +121349,7 @@ function conversationProgress(attempt, send3, valid, unconfirmed) {
|
|
|
121263
121349
|
|
|
121264
121350
|
// src/reply-images.ts
|
|
121265
121351
|
import fs36 from "node:fs";
|
|
121266
|
-
import
|
|
121352
|
+
import path40 from "node:path";
|
|
121267
121353
|
import os6 from "node:os";
|
|
121268
121354
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
121269
121355
|
import { createHash as createHash6 } from "node:crypto";
|
|
@@ -121281,14 +121367,14 @@ function imageMime(bytes2) {
|
|
|
121281
121367
|
|
|
121282
121368
|
// src/reply-images.ts
|
|
121283
121369
|
var inside = (root2, file2) => {
|
|
121284
|
-
const p2 =
|
|
121285
|
-
return p2 !== ".." && !p2.startsWith(`..${
|
|
121370
|
+
const p2 = path40.relative(root2, file2);
|
|
121371
|
+
return p2 !== ".." && !p2.startsWith(`..${path40.sep}`) && !path40.isAbsolute(p2);
|
|
121286
121372
|
};
|
|
121287
121373
|
function collectReplyImages(parts, cwd) {
|
|
121288
121374
|
const files = /* @__PURE__ */ new Map();
|
|
121289
121375
|
const tools = [];
|
|
121290
121376
|
const output2 = [];
|
|
121291
|
-
const roots = [cwd,
|
|
121377
|
+
const roots = [cwd, path40.join(process.env.CODEX_HOME?.trim() || path40.join(os6.homedir(), ".codex"), "generated_images")].flatMap((p2) => {
|
|
121292
121378
|
try {
|
|
121293
121379
|
return [fs36.realpathSync(p2)];
|
|
121294
121380
|
} catch {
|
|
@@ -121298,7 +121384,7 @@ function collectReplyImages(parts, cwd) {
|
|
|
121298
121384
|
const registered = new Set(parts.flatMap((p2) => {
|
|
121299
121385
|
if (p2.type !== "image" || !p2.registered || !p2.path) return [];
|
|
121300
121386
|
try {
|
|
121301
|
-
const file2 = p2.path.startsWith("file:") ? fileURLToPath3(p2.path) :
|
|
121387
|
+
const file2 = p2.path.startsWith("file:") ? fileURLToPath3(p2.path) : path40.resolve(cwd, p2.path);
|
|
121302
121388
|
if (!fs36.lstatSync(file2).isFile()) return [];
|
|
121303
121389
|
const real = fs36.realpathSync(file2);
|
|
121304
121390
|
const fd = fs36.openSync(real, fs36.constants.O_RDONLY | (fs36.constants.O_NOFOLLOW ?? 0));
|
|
@@ -121324,7 +121410,7 @@ function collectReplyImages(parts, cwd) {
|
|
|
121324
121410
|
if (!p2.path) throw Error();
|
|
121325
121411
|
const source2 = p2.path.startsWith("file:") ? fileURLToPath3(p2.path) : decodeURIComponent(p2.path);
|
|
121326
121412
|
if (/^[a-z][a-z0-9+.-]*:/i.test(source2) && !/^[A-Za-z]:[\\/]/.test(source2)) throw Error();
|
|
121327
|
-
const real = fs36.realpathSync(
|
|
121413
|
+
const real = fs36.realpathSync(path40.resolve(cwd, source2));
|
|
121328
121414
|
if (!/\.(png|jpe?g|gif|webp)$/i.test(source2) && !registered.has(real)) throw Error();
|
|
121329
121415
|
if (!roots.some((root2) => inside(root2, real)) && !registered.has(real)) throw Error();
|
|
121330
121416
|
const fd = fs36.openSync(real, fs36.constants.O_RDONLY | (fs36.constants.O_NOFOLLOW ?? 0));
|
|
@@ -121420,7 +121506,7 @@ async function saveReplyImages(parts, cwd, upload2) {
|
|
|
121420
121506
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
121421
121507
|
import crypto5 from "node:crypto";
|
|
121422
121508
|
import fs37 from "node:fs";
|
|
121423
|
-
import
|
|
121509
|
+
import path41 from "node:path";
|
|
121424
121510
|
var gitRead = (cwd, args2) => {
|
|
121425
121511
|
try {
|
|
121426
121512
|
return execFileSync2("git", ["-C", cwd, ...args2], {
|
|
@@ -121438,7 +121524,7 @@ function authorizedFolder(folder) {
|
|
|
121438
121524
|
if (!folder) return null;
|
|
121439
121525
|
try {
|
|
121440
121526
|
const real = fs37.realpathSync(folder);
|
|
121441
|
-
return allowedProjects().some((root2) => real === root2 || real.startsWith(root2 +
|
|
121527
|
+
return allowedProjects().some((root2) => real === root2 || real.startsWith(root2 + path41.sep)) ? real : null;
|
|
121442
121528
|
} catch {
|
|
121443
121529
|
return null;
|
|
121444
121530
|
}
|
|
@@ -121448,9 +121534,9 @@ function progressFolder(job, folder) {
|
|
|
121448
121534
|
if (!token) return folder;
|
|
121449
121535
|
if (!/^[a-zA-Z0-9-]{1,80}$/.test(token)) return null;
|
|
121450
121536
|
try {
|
|
121451
|
-
const dir = fs37.realpathSync(
|
|
121452
|
-
if (!dir.startsWith(fs37.realpathSync(folder) +
|
|
121453
|
-
const marker = JSON.parse(fs37.readFileSync(
|
|
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"));
|
|
121454
121540
|
return marker.task === job.task && marker.isolation === token ? dir : null;
|
|
121455
121541
|
} catch {
|
|
121456
121542
|
return null;
|
|
@@ -121458,18 +121544,18 @@ function progressFolder(job, folder) {
|
|
|
121458
121544
|
}
|
|
121459
121545
|
function progressEvidence(job, folder) {
|
|
121460
121546
|
try {
|
|
121461
|
-
const board =
|
|
121462
|
-
const deliveries =
|
|
121463
|
-
const rows = fs37.readdirSync(deliveries).filter((name) => name.endsWith(".json")).map((name) => JSON.parse(fs37.readFileSync(
|
|
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));
|
|
121464
121550
|
const row = rows[0];
|
|
121465
121551
|
if (!row?.deliveryId) return null;
|
|
121466
|
-
const tree = fs37.realpathSync(
|
|
121467
|
-
if (tree !== fs37.realpathSync(folder) && !tree.startsWith(fs37.realpathSync(folder) +
|
|
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;
|
|
121468
121554
|
const inventory = gitRead(tree, ["worktree", "list", "--porcelain"]);
|
|
121469
121555
|
const related = (inventory ?? "").split("\n\n").flatMap((entry) => {
|
|
121470
121556
|
const branch = /^branch refs\/heads\/(.+)$/m.exec(entry)?.[1];
|
|
121471
121557
|
const dir = /^worktree (.+)$/m.exec(entry)?.[1];
|
|
121472
|
-
return branch?.startsWith(`card/${job.number}/`) && dir && dir !== tree && dir.startsWith(fs37.realpathSync(folder) +
|
|
121558
|
+
return branch?.startsWith(`card/${job.number}/`) && dir && dir !== tree && dir.startsWith(fs37.realpathSync(folder) + path41.sep) ? [dir] : [];
|
|
121473
121559
|
});
|
|
121474
121560
|
const filesIn = (tree2) => {
|
|
121475
121561
|
const changed = [];
|
|
@@ -121477,14 +121563,14 @@ function progressEvidence(job, folder) {
|
|
|
121477
121563
|
for (const entry of fs37.readdirSync(dir, { withFileTypes: true })) {
|
|
121478
121564
|
if ([".git", ".akb", "node_modules", ".claude", ".agents"].includes(entry.name)) continue;
|
|
121479
121565
|
const name = prefix + entry.name;
|
|
121480
|
-
if (entry.isDirectory()) walk(
|
|
121566
|
+
if (entry.isDirectory()) walk(path41.join(dir, entry.name), name + "/");
|
|
121481
121567
|
else changed.push(name);
|
|
121482
121568
|
}
|
|
121483
121569
|
};
|
|
121484
121570
|
walk(tree2);
|
|
121485
121571
|
changed.sort();
|
|
121486
121572
|
return changed.map((name) => {
|
|
121487
|
-
const file2 =
|
|
121573
|
+
const file2 = path41.join(tree2, name);
|
|
121488
121574
|
try {
|
|
121489
121575
|
const stat = fs37.lstatSync(file2);
|
|
121490
121576
|
if (stat.isSymbolicLink()) return [name, "link", digest(fs37.readlinkSync(file2))];
|
|
@@ -121526,9 +121612,9 @@ function progressEvidence(job, folder) {
|
|
|
121526
121612
|
function restartFolder(job, folder) {
|
|
121527
121613
|
const token = job.handoff?.isolation ?? job.id;
|
|
121528
121614
|
if (!/^[a-zA-Z0-9-]{1,80}$/.test(token)) throw new Error("\u9694\u79BB\u76EE\u5F55\u7F16\u53F7\u65E0\u6548\u3002");
|
|
121529
|
-
const dir =
|
|
121530
|
-
const marker =
|
|
121531
|
-
for (const parent of [
|
|
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]) {
|
|
121532
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");
|
|
121533
121619
|
}
|
|
121534
121620
|
if (fs37.existsSync(dir)) {
|
|
@@ -121541,14 +121627,14 @@ function restartFolder(job, folder) {
|
|
|
121541
121627
|
}
|
|
121542
121628
|
throw new Error("\u91CD\u542F\u76EE\u5F55\u5DF2\u5B58\u5728\uFF0C\u8BF7\u91CD\u65B0\u68C0\u67E5\u3002");
|
|
121543
121629
|
}
|
|
121544
|
-
fs37.mkdirSync(
|
|
121630
|
+
fs37.mkdirSync(path41.dirname(dir), { recursive: true });
|
|
121545
121631
|
fs37.mkdirSync(dir);
|
|
121546
121632
|
for (const entry of fs37.readdirSync(folder)) {
|
|
121547
121633
|
if ([".akb", ".git", "node_modules", ".claude", ".agents"].includes(entry)) continue;
|
|
121548
|
-
fs37.cpSync(
|
|
121634
|
+
fs37.cpSync(path41.join(folder, entry), path41.join(dir, entry), { recursive: true, verbatimSymlinks: true });
|
|
121549
121635
|
}
|
|
121550
|
-
if (fs37.lstatSync(
|
|
121551
|
-
fs37.mkdirSync(
|
|
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 });
|
|
121552
121638
|
fs37.writeFileSync(marker, JSON.stringify({ task: job.task, isolation: token }), { flag: "wx" });
|
|
121553
121639
|
return dir;
|
|
121554
121640
|
}
|
|
@@ -121556,16 +121642,16 @@ function restartFolder(job, folder) {
|
|
|
121556
121642
|
// src/jobs.ts
|
|
121557
121643
|
import { spawn as spawn4 } from "node:child_process";
|
|
121558
121644
|
import fs42 from "node:fs";
|
|
121559
|
-
import
|
|
121645
|
+
import path46 from "node:path";
|
|
121560
121646
|
|
|
121561
121647
|
// ../cli/src/lib/agent/catalog.ts
|
|
121562
121648
|
import fs38 from "node:fs";
|
|
121563
|
-
import
|
|
121649
|
+
import path42 from "node:path";
|
|
121564
121650
|
var CATALOGUE = "https://models.dev/api.json";
|
|
121565
121651
|
var FRESH_FOR_MS = 24 * 60 * 6e4;
|
|
121566
121652
|
var ANSWER_BY_MS = 2e4;
|
|
121567
121653
|
function cacheFile() {
|
|
121568
|
-
return
|
|
121654
|
+
return path42.join(machineHome(), "models-dev.json");
|
|
121569
121655
|
}
|
|
121570
121656
|
var held3;
|
|
121571
121657
|
function readCache() {
|
|
@@ -121618,7 +121704,7 @@ function refreshCatalog() {
|
|
|
121618
121704
|
const limits = limitsIn(await answer.json());
|
|
121619
121705
|
if (Object.keys(limits).length === 0) return;
|
|
121620
121706
|
const file2 = cacheFile();
|
|
121621
|
-
fs38.mkdirSync(
|
|
121707
|
+
fs38.mkdirSync(path42.dirname(file2), { recursive: true });
|
|
121622
121708
|
fs38.writeFileSync(file2, JSON.stringify({ fetchedAt: Date.now(), limits }));
|
|
121623
121709
|
} catch {
|
|
121624
121710
|
}
|
|
@@ -121638,6 +121724,7 @@ function spellings(model) {
|
|
|
121638
121724
|
return [.../* @__PURE__ */ new Set([id, undated])];
|
|
121639
121725
|
}
|
|
121640
121726
|
function contextLimit(harness, model) {
|
|
121727
|
+
if (harness === "antigravity") return void 0;
|
|
121641
121728
|
if (!model?.trim()) return void 0;
|
|
121642
121729
|
const limits = readCache()?.limits;
|
|
121643
121730
|
if (!limits) return void 0;
|
|
@@ -121711,10 +121798,10 @@ async function replyApprovalBridge(task, number, approve) {
|
|
|
121711
121798
|
|
|
121712
121799
|
// src/akb-version.ts
|
|
121713
121800
|
import fs39 from "node:fs";
|
|
121714
|
-
import
|
|
121715
|
-
var stateFile = () =>
|
|
121716
|
-
var akbVersionDir = (version) =>
|
|
121717
|
-
var entryOf = (dir) =>
|
|
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");
|
|
121718
121805
|
function readAkbState() {
|
|
121719
121806
|
try {
|
|
121720
121807
|
const held5 = JSON.parse(fs39.readFileSync(stateFile(), "utf8"));
|
|
@@ -121725,7 +121812,7 @@ function readAkbState() {
|
|
|
121725
121812
|
}
|
|
121726
121813
|
function contractOf(dir) {
|
|
121727
121814
|
try {
|
|
121728
|
-
return JSON.parse(fs39.readFileSync(
|
|
121815
|
+
return JSON.parse(fs39.readFileSync(path43.join(dir, "package.json"), "utf8")).akbContract ?? null;
|
|
121729
121816
|
} catch {
|
|
121730
121817
|
return null;
|
|
121731
121818
|
}
|
|
@@ -121741,24 +121828,24 @@ function currentAkb() {
|
|
|
121741
121828
|
fs39.utimesSync(dir, now, now);
|
|
121742
121829
|
} catch {
|
|
121743
121830
|
}
|
|
121744
|
-
return { command: process.execPath, args: akbArgs(entryOf(dir)), version: current2, shim:
|
|
121831
|
+
return { command: process.execPath, args: akbArgs(entryOf(dir)), version: current2, shim: path43.join(dir, "shim") };
|
|
121745
121832
|
}
|
|
121746
121833
|
|
|
121747
121834
|
// src/chats.ts
|
|
121748
121835
|
import fs41 from "node:fs";
|
|
121749
|
-
import
|
|
121836
|
+
import path45 from "node:path";
|
|
121750
121837
|
|
|
121751
121838
|
// ../cli/src/lib/shared/chats.ts
|
|
121752
121839
|
var CHAT_KEEP_DAYS = 30;
|
|
121753
121840
|
|
|
121754
121841
|
// ../cli/src/lib/agent/task-chats.ts
|
|
121755
121842
|
import fs40 from "node:fs";
|
|
121756
|
-
import
|
|
121843
|
+
import path44 from "node:path";
|
|
121757
121844
|
var TASK = /^[\w-]{1,100}$/;
|
|
121758
|
-
var taskChatsDir = (home4 = machineHome()) =>
|
|
121845
|
+
var taskChatsDir = (home4 = machineHome()) => path44.join(home4, "chats");
|
|
121759
121846
|
function taskChatFile(task, home4) {
|
|
121760
121847
|
if (!TASK.test(task)) throw new Error(`${task} is not a task id.`);
|
|
121761
|
-
return
|
|
121848
|
+
return path44.join(taskChatsDir(home4), `${task}.jsonl`);
|
|
121762
121849
|
}
|
|
121763
121850
|
function readTaskChat(task, home4) {
|
|
121764
121851
|
let text4;
|
|
@@ -121783,7 +121870,7 @@ function readTaskChat(task, home4) {
|
|
|
121783
121870
|
var DAY_MS = 24 * 60 * 6e4;
|
|
121784
121871
|
var KEEP_MS2 = CHAT_KEEP_DAYS * DAY_MS;
|
|
121785
121872
|
var home3 = () => runnerHome();
|
|
121786
|
-
var reviewedFile = () =>
|
|
121873
|
+
var reviewedFile = () => path45.join(taskChatsDir(home3()), "reviewed.json");
|
|
121787
121874
|
function readReviewed() {
|
|
121788
121875
|
try {
|
|
121789
121876
|
const held5 = JSON.parse(fs41.readFileSync(reviewedFile(), "utf8"));
|
|
@@ -121793,7 +121880,7 @@ function readReviewed() {
|
|
|
121793
121880
|
}
|
|
121794
121881
|
}
|
|
121795
121882
|
function writeReviewed(reviewed) {
|
|
121796
|
-
fs41.mkdirSync(
|
|
121883
|
+
fs41.mkdirSync(path45.dirname(reviewedFile()), { recursive: true });
|
|
121797
121884
|
fs41.writeFileSync(reviewedFile(), `${JSON.stringify(reviewed, null, 2)}
|
|
121798
121885
|
`);
|
|
121799
121886
|
}
|
|
@@ -121804,7 +121891,7 @@ function keepChat(job, reply, at2 = Date.now()) {
|
|
|
121804
121891
|
{ id: job.id, role: "agent", text: reply, at: at2, runtime: job.runtime, model: job.model ?? null }
|
|
121805
121892
|
];
|
|
121806
121893
|
const file2 = taskChatFile(job.task, home3());
|
|
121807
|
-
fs41.mkdirSync(
|
|
121894
|
+
fs41.mkdirSync(path45.dirname(file2), { recursive: true });
|
|
121808
121895
|
fs41.appendFileSync(file2, lines.map((l2) => `${JSON.stringify(l2)}
|
|
121809
121896
|
`).join(""));
|
|
121810
121897
|
}
|
|
@@ -121812,7 +121899,7 @@ function keepCloudChat(task, messages) {
|
|
|
121812
121899
|
const file2 = taskChatFile(task, home3());
|
|
121813
121900
|
if (!messages.length) return fs41.rmSync(file2, { force: true });
|
|
121814
121901
|
const lines = messages.map((m) => ({ id: m.id, role: m.role, text: m.body, at: Date.parse(m.created_at) || Date.now() }));
|
|
121815
|
-
fs41.mkdirSync(
|
|
121902
|
+
fs41.mkdirSync(path45.dirname(file2), { recursive: true });
|
|
121816
121903
|
fs41.writeFileSync(file2, lines.map((l2) => `${JSON.stringify(l2)}
|
|
121817
121904
|
`).join(""));
|
|
121818
121905
|
}
|
|
@@ -121831,7 +121918,7 @@ async function keepDecisions(task, read4) {
|
|
|
121831
121918
|
const ids = new Set(comments.map((c2) => c2.id));
|
|
121832
121919
|
const lines = [...readTaskChat(task, home3()).filter((l2) => !ids.has(l2.id)), ...comments].sort((a2, b2) => a2.at - b2.at);
|
|
121833
121920
|
const file2 = taskChatFile(task, home3());
|
|
121834
|
-
fs41.mkdirSync(
|
|
121921
|
+
fs41.mkdirSync(path45.dirname(file2), { recursive: true });
|
|
121835
121922
|
fs41.writeFileSync(file2, lines.map((l2) => `${JSON.stringify(l2)}
|
|
121836
121923
|
`).join(""));
|
|
121837
121924
|
}
|
|
@@ -121912,15 +121999,15 @@ var defaultDeps = (machineId) => ({
|
|
|
121912
121999
|
akb: currentAkb,
|
|
121913
122000
|
runtimes: detectRuntimes
|
|
121914
122001
|
});
|
|
121915
|
-
var ownFolder = () =>
|
|
122002
|
+
var ownFolder = () => path46.join(runnerHome(), "work");
|
|
121916
122003
|
function folderFor(job) {
|
|
121917
122004
|
if (!job.projectDir) {
|
|
121918
|
-
const cwd =
|
|
122005
|
+
const cwd = path46.join(ownFolder(), job.id);
|
|
121919
122006
|
fs42.mkdirSync(cwd, { recursive: true });
|
|
121920
122007
|
return { cwd };
|
|
121921
122008
|
}
|
|
121922
122009
|
const real = realpath2(job.projectDir);
|
|
121923
|
-
if (real && allowedProjects().some((root2) => real === root2 || real.startsWith(root2 +
|
|
122010
|
+
if (real && allowedProjects().some((root2) => real === root2 || real.startsWith(root2 + path46.sep))) return { cwd: real };
|
|
121924
122011
|
return { refused: `This Runner is not allowed to work in ${job.projectDir}.` };
|
|
121925
122012
|
}
|
|
121926
122013
|
function realpath2(p2) {
|
|
@@ -121930,20 +122017,20 @@ function realpath2(p2) {
|
|
|
121930
122017
|
return null;
|
|
121931
122018
|
}
|
|
121932
122019
|
}
|
|
121933
|
-
var attachmentsOf = (job) =>
|
|
122020
|
+
var attachmentsOf = (job) => path46.join(runnerHome(), "attachments", job.id);
|
|
121934
122021
|
function writeAttachments(job) {
|
|
121935
|
-
if (!job.attachments.length) return "";
|
|
122022
|
+
if (!job.attachments.length) return { text: "", files: [] };
|
|
121936
122023
|
const dir = attachmentsOf(job);
|
|
121937
122024
|
fs42.mkdirSync(dir, { recursive: true });
|
|
121938
122025
|
const files = job.attachments.map((a2) => {
|
|
121939
|
-
const file2 =
|
|
122026
|
+
const file2 = path46.join(dir, path46.basename(a2.name));
|
|
121940
122027
|
fs42.writeFileSync(file2, Buffer.from(a2.content, "base64"));
|
|
121941
122028
|
return file2;
|
|
121942
122029
|
});
|
|
121943
|
-
return `
|
|
122030
|
+
return { text: `
|
|
121944
122031
|
|
|
121945
122032
|
Attached files:
|
|
121946
|
-
${files.map((f2) => `- ${f2}`).join("\n")}
|
|
122033
|
+
${files.map((f2) => `- ${f2}`).join("\n")}`, files };
|
|
121947
122034
|
}
|
|
121948
122035
|
var cut = (text4) => text4.length > EVENT_CHARS ? text4.slice(0, EVENT_CHARS) : text4;
|
|
121949
122036
|
function toWire(events, first) {
|
|
@@ -122236,7 +122323,7 @@ async function runJob(id, deps, track = () => {
|
|
|
122236
122323
|
const releases = [];
|
|
122237
122324
|
try {
|
|
122238
122325
|
const akb = deps.akb();
|
|
122239
|
-
releases.push(hold(
|
|
122326
|
+
releases.push(hold(path46.dirname(akb.shim)));
|
|
122240
122327
|
releases.push(hold(akb.shim));
|
|
122241
122328
|
await runClaimed(job, { ...deps, akb }, track, (dir) => releases.push(hold(dir)), lease);
|
|
122242
122329
|
} finally {
|
|
@@ -122277,7 +122364,7 @@ async function runClaimedStep(job, deps, track, keep2, lease, scope, replyStream
|
|
|
122277
122364
|
}
|
|
122278
122365
|
return finish(deps, id, lease, outcome, reason, report2);
|
|
122279
122366
|
};
|
|
122280
|
-
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));
|
|
122281
122368
|
if (job.manualRecovery && !local) checkpoint.retry = void 0;
|
|
122282
122369
|
if (reply) checkpoint.retry ??= { since: Date.now(), attempt: 1 };
|
|
122283
122370
|
const recovering = checkpoint.updating === true || !!job.recoveryOf;
|
|
@@ -122295,6 +122382,9 @@ async function runClaimedStep(job, deps, track, keep2, lease, scope, replyStream
|
|
|
122295
122382
|
if (reply && previous?.started && checkpoint.completed?.outcome !== "done" && !await stopReply(readCheckpoint(id) ? id : job.recoveryOf ?? id, deps.stopMs)) {
|
|
122296
122383
|
return finishClaimed("failed", "recovery_unsafe");
|
|
122297
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
|
+
}
|
|
122298
122388
|
if (reply && recovering && !replyStream && previous?.started && !checkpoint.completed && !checkpoint.retry?.at && !(manual && !local)) {
|
|
122299
122389
|
if (checkpoint.retry.attempt === 1) checkpoint.retry.since = Date.now();
|
|
122300
122390
|
if (checkpoint.retry.attempt >= 3 || Date.now() > checkpoint.retry.since + 12e4) {
|
|
@@ -122400,14 +122490,15 @@ async function runClaimedStep(job, deps, track, keep2, lease, scope, replyStream
|
|
|
122400
122490
|
}
|
|
122401
122491
|
if (!job.flow && !job.review) {
|
|
122402
122492
|
void refreshCatalog();
|
|
122403
|
-
const
|
|
122493
|
+
const attachments = writeAttachments(job);
|
|
122494
|
+
const head2 = folderLines(ws) + attachments.text;
|
|
122404
122495
|
const file2 = writeTranscript(job, attachmentsOf(job));
|
|
122405
122496
|
const transcript = file2 ? `
|
|
122406
122497
|
|
|
122407
122498
|
This task came out of a discussion. Read it for what the card leaves out: ${file2}` : "";
|
|
122408
122499
|
const promptOf = (said2) => {
|
|
122409
122500
|
const lines = (head2 + said2).trim();
|
|
122410
|
-
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\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" : 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;
|
|
122411
122502
|
return lines ? `${lines}
|
|
122412
122503
|
|
|
122413
122504
|
---
|
|
@@ -122416,6 +122507,7 @@ ${prompt}` : prompt;
|
|
|
122416
122507
|
};
|
|
122417
122508
|
const planned = (resume, fork, said2 = "") => {
|
|
122418
122509
|
let p2 = deps.plan(job.runtime, promptOf(said2), cwd, resume, job.model, settingsOf(job), fork, cloudLanguage(job));
|
|
122510
|
+
p2.renderer?.setRequiredImages?.(attachments.files);
|
|
122419
122511
|
if (ws) p2 = { ...p2, env: akbEnv(deps.akb, ws.board, ws.task, cloudLanguage(job), p2.env) };
|
|
122420
122512
|
if (scope.preview) p2 = { ...p2, env: { ...p2.env, AI4KANBAN_PREVIEW_BRIDGE: scope.preview.env } };
|
|
122421
122513
|
if (scope.bridge) p2 = { ...p2, env: { ...p2.env, AI4KANBAN_REPLY_APPROVAL: scope.bridge.env } };
|
|
@@ -122517,6 +122609,7 @@ ${prompt}` : prompt;
|
|
|
122517
122609
|
};
|
|
122518
122610
|
const retry2 = async (reason) => {
|
|
122519
122611
|
if (!reply || !reason || stream.asked() || stream.lost()) return false;
|
|
122612
|
+
if (job.runtime === "antigravity" && manualFailure(reason)) return false;
|
|
122520
122613
|
const at2 = replyRetry(checkpoint, reason, Date.now(), deps.replyBackoff);
|
|
122521
122614
|
if (at2 === null) return false;
|
|
122522
122615
|
checkpoint.approvalCancelled = true;
|
|
@@ -122717,6 +122810,11 @@ ${prompt}` : prompt;
|
|
|
122717
122810
|
stop(child);
|
|
122718
122811
|
});
|
|
122719
122812
|
const fromAgent = (text4) => {
|
|
122813
|
+
const session = plan3.session();
|
|
122814
|
+
if (!stream.lost() && session && session !== checkpoint.session) {
|
|
122815
|
+
checkpoint.session = session;
|
|
122816
|
+
persist();
|
|
122817
|
+
}
|
|
122720
122818
|
if (!structured) {
|
|
122721
122819
|
if (text4.trim()) acted = true;
|
|
122722
122820
|
stream.out(text4);
|
|
@@ -122729,6 +122827,7 @@ ${prompt}` : prompt;
|
|
|
122729
122827
|
};
|
|
122730
122828
|
child.stdout.on("data", (chunk) => {
|
|
122731
122829
|
fromAgent(renderer2.push(chunk));
|
|
122830
|
+
if (renderer2.rateLimit?.()) stop(child, plan3.managedProcess);
|
|
122732
122831
|
if (renderer2.background?.()) backgroundWait.pending();
|
|
122733
122832
|
if (plan3.stdin && streamFinished(renderer2) && !child.stdin.writableEnded) {
|
|
122734
122833
|
backgroundWait.close();
|
|
@@ -122738,6 +122837,7 @@ ${prompt}` : prompt;
|
|
|
122738
122837
|
child.stderr.setEncoding("utf8");
|
|
122739
122838
|
child.stderr.on("data", (chunk) => {
|
|
122740
122839
|
renderer2.stderr?.(chunk);
|
|
122840
|
+
if (renderer2.rateLimit?.()) stop(child, plan3.managedProcess);
|
|
122741
122841
|
stderr = (stderr + chunk).slice(-EVENT_CHARS);
|
|
122742
122842
|
stream.out(quietLines(plan3, chunk));
|
|
122743
122843
|
});
|
|
@@ -122937,7 +123037,7 @@ async function runTest(job, deps, lease) {
|
|
|
122937
123037
|
const report2 = (await deps.runtimes()).find((r2) => r2.name === job.runtime);
|
|
122938
123038
|
if (!report2?.installed) return finish2("failed", "not_installed");
|
|
122939
123039
|
if (report2.loggedIn === false) return finish2("failed", "signed_out");
|
|
122940
|
-
const cwd =
|
|
123040
|
+
const cwd = path46.join(ownFolder(), "test");
|
|
122941
123041
|
fs42.mkdirSync(cwd, { recursive: true });
|
|
122942
123042
|
const run3 = deps.plan(job.runtime, job.prompt, cwd, null, job.model, settingsOf(job));
|
|
122943
123043
|
const startedAt = Date.now();
|
|
@@ -122975,11 +123075,13 @@ async function runTest(job, deps, lease) {
|
|
|
122975
123075
|
child.stdout.setEncoding("utf8");
|
|
122976
123076
|
child.stdout.on("data", (chunk) => {
|
|
122977
123077
|
renderer.push(chunk);
|
|
123078
|
+
if (renderer.rateLimit?.()) stop(child, run3.managedProcess);
|
|
122978
123079
|
if (run3.stdin && streamFinished(renderer) && !child.stdin.writableEnded) child.stdin.end();
|
|
122979
123080
|
});
|
|
122980
123081
|
child.stderr.setEncoding("utf8");
|
|
122981
123082
|
child.stderr.on("data", (chunk) => {
|
|
122982
123083
|
renderer.stderr?.(chunk);
|
|
123084
|
+
if (renderer.rateLimit?.()) stop(child, run3.managedProcess);
|
|
122983
123085
|
said += chunk.split("\n").filter((line) => line && !run3.quiet(line)).map((line) => `${line}
|
|
122984
123086
|
`).join("");
|
|
122985
123087
|
});
|
|
@@ -123028,8 +123130,8 @@ ${undrawn2.map((l2) => `- ${l2}`).join("\n")}` : "");
|
|
|
123028
123130
|
|
|
123029
123131
|
// src/flow-worker.ts
|
|
123030
123132
|
var FLOW_MARK = "WILDCRANE_FLOW_WORKER";
|
|
123031
|
-
var directory2 = () =>
|
|
123032
|
-
var fileOf2 = (id) =>
|
|
123133
|
+
var directory2 = () => path47.join(runnerHome(), "flow-workers");
|
|
123134
|
+
var fileOf2 = (id) => path47.join(directory2(), `${encodeURIComponent(id)}.json`);
|
|
123033
123135
|
var stopFile = (id) => `${fileOf2(id)}.stop`;
|
|
123034
123136
|
var flowWorkerEntry = fileURLToPath4(new URL("./flow-worker-main.mjs", import.meta.url));
|
|
123035
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;
|
|
@@ -123103,7 +123205,7 @@ async function reclaimFlowWorkers(machine, given, only) {
|
|
|
123103
123205
|
if (!valid()) break;
|
|
123104
123206
|
if (!name.endsWith(".json")) continue;
|
|
123105
123207
|
try {
|
|
123106
|
-
const file2 =
|
|
123208
|
+
const file2 = path47.join(directory2(), name);
|
|
123107
123209
|
const original = fs43.readFileSync(file2, "utf8");
|
|
123108
123210
|
const worker = JSON.parse(original);
|
|
123109
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;
|
|
@@ -123111,16 +123213,16 @@ async function reclaimFlowWorkers(machine, given, only) {
|
|
|
123111
123213
|
if (!only) void reclaimFlowWorkerAfterExit(worker.id, machine, given);
|
|
123112
123214
|
continue;
|
|
123113
123215
|
}
|
|
123114
|
-
const queried = tryLock(
|
|
123216
|
+
const queried = tryLock(path47.join(directory2(), ".lookup.lock"));
|
|
123115
123217
|
if (!queried) continue;
|
|
123116
123218
|
const remote2 = await readJob(worker.id).finally(queried);
|
|
123117
123219
|
if (!valid()) break;
|
|
123118
123220
|
if (!remote2.ok || remote2.value.job.id !== worker.id || remote2.value.job.state !== "finished" || !canKeepFlow(remote2.value.job)) continue;
|
|
123119
123221
|
if (!worker.markedAt) {
|
|
123120
123222
|
const job = remote2.value.job;
|
|
123121
|
-
const folder = job.projectDir ? folderFor(job) : { cwd:
|
|
123223
|
+
const folder = job.projectDir ? folderFor(job) : { cwd: path47.join(runnerHome(), "work", job.id) };
|
|
123122
123224
|
if ("refused" in folder || !job.task || !job.project) continue;
|
|
123123
|
-
const board =
|
|
123225
|
+
const board = path47.join(folder.cwd, ".akb", "kanban");
|
|
123124
123226
|
if (!fs43.existsSync(board)) continue;
|
|
123125
123227
|
const deps = given ?? defaultDeps(machine);
|
|
123126
123228
|
if (!await confirmFlowStopped(
|
|
@@ -123169,7 +123271,7 @@ async function runFlowWorker(id, token, given, entry = flowWorkerEntry) {
|
|
|
123169
123271
|
await halt?.();
|
|
123170
123272
|
};
|
|
123171
123273
|
const release2 = executorRecord();
|
|
123172
|
-
const keepVersion = hold(
|
|
123274
|
+
const keepVersion = hold(path47.resolve(path47.dirname(fileURLToPath4(import.meta.url)), ".."));
|
|
123173
123275
|
worker.pid = process.pid;
|
|
123174
123276
|
worker.processAt = Date.now();
|
|
123175
123277
|
save(worker);
|