wildcrane-runner 0.6.26 → 0.6.28
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/README.md +9 -0
- package/dist/akb/dist/kanban.mjs +1386 -827
- package/dist/akb/package.json +1 -1
- package/dist/akb-proxy.mjs +1 -1
- package/dist/launcher.mjs +515 -421
- package/dist/runner.mjs +603 -291
- package/package.json +1 -1
package/dist/launcher.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// wildcrane-runner 0.6.
|
|
1
|
+
// wildcrane-runner 0.6.28 — built by runner/scripts/build.mjs. Do not edit.
|
|
2
2
|
import { createRequire as __ai4kanbanRequire } from 'node:module'
|
|
3
3
|
const require = __ai4kanbanRequire(import.meta.url)
|
|
4
4
|
var __create = Object.create;
|
|
@@ -1146,14 +1146,14 @@ var require_util = __commonJS({
|
|
|
1146
1146
|
}
|
|
1147
1147
|
const port = url.port != null ? url.port : url.protocol === "https:" ? 443 : 80;
|
|
1148
1148
|
let origin = url.origin != null ? url.origin : `${url.protocol || ""}//${url.hostname || ""}:${port}`;
|
|
1149
|
-
let
|
|
1149
|
+
let path23 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
|
|
1150
1150
|
if (origin[origin.length - 1] === "/") {
|
|
1151
1151
|
origin = origin.slice(0, origin.length - 1);
|
|
1152
1152
|
}
|
|
1153
|
-
if (
|
|
1154
|
-
|
|
1153
|
+
if (path23 && path23[0] !== "/") {
|
|
1154
|
+
path23 = `/${path23}`;
|
|
1155
1155
|
}
|
|
1156
|
-
return new URL(`${origin}${
|
|
1156
|
+
return new URL(`${origin}${path23}`);
|
|
1157
1157
|
}
|
|
1158
1158
|
if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) {
|
|
1159
1159
|
throw new InvalidArgumentError("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
@@ -1988,9 +1988,9 @@ var require_diagnostics = __commonJS({
|
|
|
1988
1988
|
"undici:client:sendHeaders",
|
|
1989
1989
|
(evt) => {
|
|
1990
1990
|
const {
|
|
1991
|
-
request: { method, path:
|
|
1991
|
+
request: { method, path: path23, origin }
|
|
1992
1992
|
} = evt;
|
|
1993
|
-
debugLog("sending request to %s %s%s", method, origin,
|
|
1993
|
+
debugLog("sending request to %s %s%s", method, origin, path23);
|
|
1994
1994
|
}
|
|
1995
1995
|
);
|
|
1996
1996
|
}
|
|
@@ -2008,14 +2008,14 @@ var require_diagnostics = __commonJS({
|
|
|
2008
2008
|
"undici:request:headers",
|
|
2009
2009
|
(evt) => {
|
|
2010
2010
|
const {
|
|
2011
|
-
request: { method, path:
|
|
2011
|
+
request: { method, path: path23, origin },
|
|
2012
2012
|
response: { statusCode }
|
|
2013
2013
|
} = evt;
|
|
2014
2014
|
debugLog(
|
|
2015
2015
|
"received response to %s %s%s - HTTP %d",
|
|
2016
2016
|
method,
|
|
2017
2017
|
origin,
|
|
2018
|
-
|
|
2018
|
+
path23,
|
|
2019
2019
|
statusCode
|
|
2020
2020
|
);
|
|
2021
2021
|
}
|
|
@@ -2024,23 +2024,23 @@ var require_diagnostics = __commonJS({
|
|
|
2024
2024
|
"undici:request:trailers",
|
|
2025
2025
|
(evt) => {
|
|
2026
2026
|
const {
|
|
2027
|
-
request: { method, path:
|
|
2027
|
+
request: { method, path: path23, origin }
|
|
2028
2028
|
} = evt;
|
|
2029
|
-
debugLog("trailers received from %s %s%s", method, origin,
|
|
2029
|
+
debugLog("trailers received from %s %s%s", method, origin, path23);
|
|
2030
2030
|
}
|
|
2031
2031
|
);
|
|
2032
2032
|
diagnosticsChannel.subscribe(
|
|
2033
2033
|
"undici:request:error",
|
|
2034
2034
|
(evt) => {
|
|
2035
2035
|
const {
|
|
2036
|
-
request: { method, path:
|
|
2036
|
+
request: { method, path: path23, origin },
|
|
2037
2037
|
error
|
|
2038
2038
|
} = evt;
|
|
2039
2039
|
debugLog(
|
|
2040
2040
|
"request to %s %s%s errored - %s",
|
|
2041
2041
|
method,
|
|
2042
2042
|
origin,
|
|
2043
|
-
|
|
2043
|
+
path23,
|
|
2044
2044
|
error.message
|
|
2045
2045
|
);
|
|
2046
2046
|
}
|
|
@@ -2155,7 +2155,7 @@ var require_request = __commonJS({
|
|
|
2155
2155
|
var kHandler = /* @__PURE__ */ Symbol("handler");
|
|
2156
2156
|
var Request = class {
|
|
2157
2157
|
constructor(origin, {
|
|
2158
|
-
path:
|
|
2158
|
+
path: path23,
|
|
2159
2159
|
method,
|
|
2160
2160
|
body,
|
|
2161
2161
|
headers,
|
|
@@ -2172,11 +2172,11 @@ var require_request = __commonJS({
|
|
|
2172
2172
|
maxRedirections,
|
|
2173
2173
|
typeOfService
|
|
2174
2174
|
}, handler) {
|
|
2175
|
-
if (typeof
|
|
2175
|
+
if (typeof path23 !== "string") {
|
|
2176
2176
|
throw new InvalidArgumentError("path must be a string");
|
|
2177
|
-
} else if (
|
|
2177
|
+
} else if (path23[0] !== "/" && !(path23.startsWith("http://") || path23.startsWith("https://")) && method !== "CONNECT") {
|
|
2178
2178
|
throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
|
|
2179
|
-
} else if (invalidPathRegex.test(
|
|
2179
|
+
} else if (invalidPathRegex.test(path23)) {
|
|
2180
2180
|
throw new InvalidArgumentError("invalid request path");
|
|
2181
2181
|
}
|
|
2182
2182
|
if (typeof method !== "string") {
|
|
@@ -2251,7 +2251,7 @@ var require_request = __commonJS({
|
|
|
2251
2251
|
this.completed = false;
|
|
2252
2252
|
this.aborted = false;
|
|
2253
2253
|
this.upgrade = upgrade || null;
|
|
2254
|
-
this.path = query ? serializePathWithQuery(
|
|
2254
|
+
this.path = query ? serializePathWithQuery(path23, query) : path23;
|
|
2255
2255
|
this.origin = origin;
|
|
2256
2256
|
this.protocol = getProtocolFromUrlString(origin);
|
|
2257
2257
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
@@ -7495,7 +7495,7 @@ var require_client_h1 = __commonJS({
|
|
|
7495
7495
|
}
|
|
7496
7496
|
}
|
|
7497
7497
|
function writeH1(client, request2) {
|
|
7498
|
-
const { method, path:
|
|
7498
|
+
const { method, path: path23, host, upgrade, blocking, reset } = request2;
|
|
7499
7499
|
let { body, headers, contentLength } = request2;
|
|
7500
7500
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
7501
7501
|
if (util.isFormDataLike(body)) {
|
|
@@ -7571,7 +7571,7 @@ var require_client_h1 = __commonJS({
|
|
|
7571
7571
|
socket[kBlocking] = true;
|
|
7572
7572
|
}
|
|
7573
7573
|
setTypeOfService(socket, request2);
|
|
7574
|
-
let header = `${method} ${
|
|
7574
|
+
let header = `${method} ${path23} HTTP/1.1\r
|
|
7575
7575
|
`;
|
|
7576
7576
|
if (typeof host === "string") {
|
|
7577
7577
|
header += `host: ${host}\r
|
|
@@ -8248,7 +8248,7 @@ var require_client_h2 = __commonJS({
|
|
|
8248
8248
|
const headersTimeout = request2.headersTimeout ?? client[kHeadersTimeout];
|
|
8249
8249
|
const bodyTimeout = request2.bodyTimeout ?? client[kBodyTimeout];
|
|
8250
8250
|
const session = client[kHTTP2Session];
|
|
8251
|
-
const { method, path:
|
|
8251
|
+
const { method, path: path23, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request2;
|
|
8252
8252
|
let { body } = request2;
|
|
8253
8253
|
if (upgrade != null && upgrade !== "websocket") {
|
|
8254
8254
|
util.errorRequest(client, request2, new InvalidArgumentError(`Custom upgrade "${upgrade}" not supported over HTTP/2`));
|
|
@@ -8317,7 +8317,7 @@ var require_client_h2 = __commonJS({
|
|
|
8317
8317
|
}
|
|
8318
8318
|
headers[HTTP2_HEADER_METHOD] = "CONNECT";
|
|
8319
8319
|
headers[HTTP2_HEADER_PROTOCOL] = "websocket";
|
|
8320
|
-
headers[HTTP2_HEADER_PATH] =
|
|
8320
|
+
headers[HTTP2_HEADER_PATH] = path23;
|
|
8321
8321
|
if (protocol === "ws:" || protocol === "wss:") {
|
|
8322
8322
|
headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
|
|
8323
8323
|
} else {
|
|
@@ -8369,7 +8369,7 @@ var require_client_h2 = __commonJS({
|
|
|
8369
8369
|
stream.setTimeout(headersTimeout);
|
|
8370
8370
|
return true;
|
|
8371
8371
|
}
|
|
8372
|
-
headers[HTTP2_HEADER_PATH] =
|
|
8372
|
+
headers[HTTP2_HEADER_PATH] = path23;
|
|
8373
8373
|
headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
|
|
8374
8374
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
8375
8375
|
if (body && typeof body.read === "function") {
|
|
@@ -10725,10 +10725,10 @@ var require_proxy_agent = __commonJS({
|
|
|
10725
10725
|
};
|
|
10726
10726
|
const {
|
|
10727
10727
|
origin,
|
|
10728
|
-
path:
|
|
10728
|
+
path: path23 = "/",
|
|
10729
10729
|
headers = {}
|
|
10730
10730
|
} = opts;
|
|
10731
|
-
opts.path = origin +
|
|
10731
|
+
opts.path = origin + path23;
|
|
10732
10732
|
if (!("host" in headers) && !("Host" in headers)) {
|
|
10733
10733
|
const { host } = new URL(origin);
|
|
10734
10734
|
headers.host = host;
|
|
@@ -12888,20 +12888,20 @@ var require_mock_utils = __commonJS({
|
|
|
12888
12888
|
}
|
|
12889
12889
|
return normalizedQp;
|
|
12890
12890
|
}
|
|
12891
|
-
function safeUrl(
|
|
12892
|
-
if (typeof
|
|
12893
|
-
return
|
|
12891
|
+
function safeUrl(path23) {
|
|
12892
|
+
if (typeof path23 !== "string") {
|
|
12893
|
+
return path23;
|
|
12894
12894
|
}
|
|
12895
|
-
const pathSegments =
|
|
12895
|
+
const pathSegments = path23.split("?", 3);
|
|
12896
12896
|
if (pathSegments.length !== 2) {
|
|
12897
|
-
return
|
|
12897
|
+
return path23;
|
|
12898
12898
|
}
|
|
12899
12899
|
const qp = new URLSearchParams(pathSegments.pop());
|
|
12900
12900
|
qp.sort();
|
|
12901
12901
|
return [...pathSegments, qp.toString()].join("?");
|
|
12902
12902
|
}
|
|
12903
|
-
function matchKey(mockDispatch2, { path:
|
|
12904
|
-
const pathMatch = matchValue(mockDispatch2.path,
|
|
12903
|
+
function matchKey(mockDispatch2, { path: path23, method, body, headers }) {
|
|
12904
|
+
const pathMatch = matchValue(mockDispatch2.path, path23);
|
|
12905
12905
|
const methodMatch = matchValue(mockDispatch2.method, method);
|
|
12906
12906
|
const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
|
|
12907
12907
|
const headersMatch = matchHeaders(mockDispatch2, headers);
|
|
@@ -12926,8 +12926,8 @@ var require_mock_utils = __commonJS({
|
|
|
12926
12926
|
const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
|
|
12927
12927
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
12928
12928
|
const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
|
|
12929
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path:
|
|
12930
|
-
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(
|
|
12929
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path23, ignoreTrailingSlash }) => {
|
|
12930
|
+
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path23)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path23), resolvedPath);
|
|
12931
12931
|
});
|
|
12932
12932
|
if (matchedMockDispatches.length === 0) {
|
|
12933
12933
|
throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
@@ -12966,19 +12966,19 @@ var require_mock_utils = __commonJS({
|
|
|
12966
12966
|
mockDispatches.splice(index, 1);
|
|
12967
12967
|
}
|
|
12968
12968
|
}
|
|
12969
|
-
function removeTrailingSlash(
|
|
12970
|
-
while (
|
|
12971
|
-
|
|
12969
|
+
function removeTrailingSlash(path23) {
|
|
12970
|
+
while (path23.endsWith("/")) {
|
|
12971
|
+
path23 = path23.slice(0, -1);
|
|
12972
12972
|
}
|
|
12973
|
-
if (
|
|
12974
|
-
|
|
12973
|
+
if (path23.length === 0) {
|
|
12974
|
+
path23 = "/";
|
|
12975
12975
|
}
|
|
12976
|
-
return
|
|
12976
|
+
return path23;
|
|
12977
12977
|
}
|
|
12978
12978
|
function buildKey(opts) {
|
|
12979
|
-
const { path:
|
|
12979
|
+
const { path: path23, method, body, headers, query } = opts;
|
|
12980
12980
|
return {
|
|
12981
|
-
path:
|
|
12981
|
+
path: path23,
|
|
12982
12982
|
method,
|
|
12983
12983
|
body,
|
|
12984
12984
|
headers,
|
|
@@ -13668,10 +13668,10 @@ var require_pending_interceptors_formatter = __commonJS({
|
|
|
13668
13668
|
}
|
|
13669
13669
|
format(pendingInterceptors) {
|
|
13670
13670
|
const withPrettyHeaders = pendingInterceptors.map(
|
|
13671
|
-
({ method, path:
|
|
13671
|
+
({ method, path: path23, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
13672
13672
|
Method: method,
|
|
13673
13673
|
Origin: origin,
|
|
13674
|
-
Path:
|
|
13674
|
+
Path: path23,
|
|
13675
13675
|
"Status code": statusCode,
|
|
13676
13676
|
Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
|
|
13677
13677
|
Invocations: timesInvoked,
|
|
@@ -13753,9 +13753,9 @@ var require_mock_agent = __commonJS({
|
|
|
13753
13753
|
const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
|
|
13754
13754
|
const dispatchOpts = { ...opts };
|
|
13755
13755
|
if (acceptNonStandardSearchParameters && dispatchOpts.path) {
|
|
13756
|
-
const [
|
|
13756
|
+
const [path23, searchParams] = dispatchOpts.path.split("?");
|
|
13757
13757
|
const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
|
|
13758
|
-
dispatchOpts.path = `${
|
|
13758
|
+
dispatchOpts.path = `${path23}?${normalizedSearchParams}`;
|
|
13759
13759
|
}
|
|
13760
13760
|
return this[kAgent].dispatch(dispatchOpts, handler);
|
|
13761
13761
|
}
|
|
@@ -13883,8 +13883,8 @@ var require_snapshot_utils = __commonJS({
|
|
|
13883
13883
|
match: new Set(matchHeaders.map((header) => caseSensitive ? header : header.toLowerCase()))
|
|
13884
13884
|
};
|
|
13885
13885
|
}
|
|
13886
|
-
var
|
|
13887
|
-
var hashId =
|
|
13886
|
+
var crypto9 = runtimeFeatures.has("crypto") ? __require("node:crypto") : null;
|
|
13887
|
+
var hashId = crypto9?.hash ? (value) => crypto9.hash("sha256", value, "base64url") : (value) => Buffer.from(value).toString("base64url");
|
|
13888
13888
|
function isUndiciHeaders(headers) {
|
|
13889
13889
|
return Array.isArray(headers) && (headers.length & 1) === 0;
|
|
13890
13890
|
}
|
|
@@ -14156,12 +14156,12 @@ var require_snapshot_recorder = __commonJS({
|
|
|
14156
14156
|
* @return {Promise<void>} - Resolves when snapshots are loaded
|
|
14157
14157
|
*/
|
|
14158
14158
|
async loadSnapshots(filePath) {
|
|
14159
|
-
const
|
|
14160
|
-
if (!
|
|
14159
|
+
const path23 = filePath || this.#snapshotPath;
|
|
14160
|
+
if (!path23) {
|
|
14161
14161
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
14162
14162
|
}
|
|
14163
14163
|
try {
|
|
14164
|
-
const data = await readFile(resolve2(
|
|
14164
|
+
const data = await readFile(resolve2(path23), "utf8");
|
|
14165
14165
|
const parsed = JSON.parse(data);
|
|
14166
14166
|
if (Array.isArray(parsed)) {
|
|
14167
14167
|
this.#snapshots.clear();
|
|
@@ -14175,7 +14175,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
14175
14175
|
if (error.code === "ENOENT") {
|
|
14176
14176
|
this.#snapshots.clear();
|
|
14177
14177
|
} else {
|
|
14178
|
-
throw new UndiciError(`Failed to load snapshots from ${
|
|
14178
|
+
throw new UndiciError(`Failed to load snapshots from ${path23}`, { cause: error });
|
|
14179
14179
|
}
|
|
14180
14180
|
}
|
|
14181
14181
|
}
|
|
@@ -14186,11 +14186,11 @@ var require_snapshot_recorder = __commonJS({
|
|
|
14186
14186
|
* @returns {Promise<void>} - Resolves when snapshots are saved
|
|
14187
14187
|
*/
|
|
14188
14188
|
async saveSnapshots(filePath) {
|
|
14189
|
-
const
|
|
14190
|
-
if (!
|
|
14189
|
+
const path23 = filePath || this.#snapshotPath;
|
|
14190
|
+
if (!path23) {
|
|
14191
14191
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
14192
14192
|
}
|
|
14193
|
-
const resolvedPath = resolve2(
|
|
14193
|
+
const resolvedPath = resolve2(path23);
|
|
14194
14194
|
await mkdir(dirname(resolvedPath), { recursive: true });
|
|
14195
14195
|
const data = Array.from(this.#snapshots.entries()).map(([hash, snapshot]) => ({
|
|
14196
14196
|
hash,
|
|
@@ -14831,15 +14831,15 @@ var require_redirect_handler = __commonJS({
|
|
|
14831
14831
|
receivedAt: Date.now()
|
|
14832
14832
|
});
|
|
14833
14833
|
const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
14834
|
-
const
|
|
14835
|
-
const redirectUrlString = `${origin}${
|
|
14834
|
+
const path23 = search ? `${pathname}${search}` : pathname;
|
|
14835
|
+
const redirectUrlString = `${origin}${path23}`;
|
|
14836
14836
|
for (const historyUrl of this.history) {
|
|
14837
14837
|
if (historyUrl.toString() === redirectUrlString) {
|
|
14838
14838
|
throw new InvalidArgumentError(`Redirect loop detected. Cannot redirect to ${origin}. This typically happens when using a Client or Pool with cross-origin redirects. Use an Agent for cross-origin redirects.`);
|
|
14839
14839
|
}
|
|
14840
14840
|
}
|
|
14841
14841
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
|
|
14842
|
-
this.opts.path =
|
|
14842
|
+
this.opts.path = path23;
|
|
14843
14843
|
this.opts.origin = origin;
|
|
14844
14844
|
this.opts.query = null;
|
|
14845
14845
|
}
|
|
@@ -16656,10 +16656,10 @@ var require_cache_handler = __commonJS({
|
|
|
16656
16656
|
}
|
|
16657
16657
|
return locationUrl.pathname + locationUrl.search;
|
|
16658
16658
|
}
|
|
16659
|
-
function deleteCachedUri(store, cacheKey,
|
|
16659
|
+
function deleteCachedUri(store, cacheKey, path23) {
|
|
16660
16660
|
deleteCachedValue(store, {
|
|
16661
16661
|
...cacheKey,
|
|
16662
|
-
path:
|
|
16662
|
+
path: path23
|
|
16663
16663
|
});
|
|
16664
16664
|
for (let i = 0; i < util.safeHTTPMethods.length; i++) {
|
|
16665
16665
|
const method = util.safeHTTPMethods[i];
|
|
@@ -16667,7 +16667,7 @@ var require_cache_handler = __commonJS({
|
|
|
16667
16667
|
deleteCachedValue(store, {
|
|
16668
16668
|
...cacheKey,
|
|
16669
16669
|
method,
|
|
16670
|
-
path:
|
|
16670
|
+
path: path23
|
|
16671
16671
|
});
|
|
16672
16672
|
}
|
|
16673
16673
|
}
|
|
@@ -16678,9 +16678,9 @@ var require_cache_handler = __commonJS({
|
|
|
16678
16678
|
}
|
|
16679
16679
|
const values = Array.isArray(headerValue) ? headerValue : [headerValue];
|
|
16680
16680
|
for (let i = 0; i < values.length; i++) {
|
|
16681
|
-
const
|
|
16682
|
-
if (
|
|
16683
|
-
deleteCachedUri(store, cacheKey,
|
|
16681
|
+
const path23 = getSameOriginPath(cacheKey, values[i]);
|
|
16682
|
+
if (path23 !== void 0) {
|
|
16683
|
+
deleteCachedUri(store, cacheKey, path23);
|
|
16684
16684
|
}
|
|
16685
16685
|
}
|
|
16686
16686
|
}
|
|
@@ -21082,10 +21082,10 @@ var require_subresource_integrity = __commonJS({
|
|
|
21082
21082
|
var { runtimeFeatures } = require_runtime_features();
|
|
21083
21083
|
var { asciiLowercase } = require_infra();
|
|
21084
21084
|
var validSRIHashAlgorithmTokenSet = /* @__PURE__ */ new Map([["sha256", 0], ["sha384", 1], ["sha512", 2]]);
|
|
21085
|
-
var
|
|
21085
|
+
var crypto9;
|
|
21086
21086
|
if (runtimeFeatures.has("crypto")) {
|
|
21087
|
-
|
|
21088
|
-
const cryptoHashes =
|
|
21087
|
+
crypto9 = __require("node:crypto");
|
|
21088
|
+
const cryptoHashes = crypto9.getHashes();
|
|
21089
21089
|
if (cryptoHashes.length === 0) {
|
|
21090
21090
|
validSRIHashAlgorithmTokenSet.clear();
|
|
21091
21091
|
}
|
|
@@ -21173,7 +21173,7 @@ var require_subresource_integrity = __commonJS({
|
|
|
21173
21173
|
return result;
|
|
21174
21174
|
}
|
|
21175
21175
|
var applyAlgorithmToBytes = (algorithm, bytes) => {
|
|
21176
|
-
return
|
|
21176
|
+
return crypto9.hash(algorithm, bytes, "base64");
|
|
21177
21177
|
};
|
|
21178
21178
|
function caseSensitiveMatch(actualValue, expectedValue) {
|
|
21179
21179
|
let actualValueLength = actualValue.length;
|
|
@@ -22168,11 +22168,11 @@ var require_fetch = __commonJS({
|
|
|
22168
22168
|
function dispatch({ body }) {
|
|
22169
22169
|
const url = requestCurrentURL(request2);
|
|
22170
22170
|
const agent = fetchParams.controller.dispatcher;
|
|
22171
|
-
const
|
|
22171
|
+
const path23 = url.pathname + url.search;
|
|
22172
22172
|
const hasTrailingQuestionMark = url.search.length === 0 && url.href[url.href.length - url.hash.length - 1] === "?";
|
|
22173
22173
|
return new Promise((resolve2, reject) => agent.dispatch(
|
|
22174
22174
|
{
|
|
22175
|
-
path: hasTrailingQuestionMark ? `${
|
|
22175
|
+
path: hasTrailingQuestionMark ? `${path23}?` : path23,
|
|
22176
22176
|
origin: url.origin,
|
|
22177
22177
|
method: request2.method,
|
|
22178
22178
|
body: agent.isMockActive ? request2.body && (request2.body.source || request2.body.stream) : body,
|
|
@@ -23119,9 +23119,9 @@ var require_util4 = __commonJS({
|
|
|
23119
23119
|
}
|
|
23120
23120
|
}
|
|
23121
23121
|
}
|
|
23122
|
-
function validateCookiePath(
|
|
23123
|
-
for (let i = 0; i <
|
|
23124
|
-
const code =
|
|
23122
|
+
function validateCookiePath(path23) {
|
|
23123
|
+
for (let i = 0; i < path23.length; ++i) {
|
|
23124
|
+
const code = path23.charCodeAt(i);
|
|
23125
23125
|
if (code < 32 || // exclude CTLs (0-31)
|
|
23126
23126
|
code > 126 || // exclude DEL and non-ascii
|
|
23127
23127
|
code === 59) {
|
|
@@ -24161,7 +24161,7 @@ var require_connection = __commonJS({
|
|
|
24161
24161
|
var { WebsocketFrameSend } = require_frame();
|
|
24162
24162
|
var assert = __require("node:assert");
|
|
24163
24163
|
var { runtimeFeatures } = require_runtime_features();
|
|
24164
|
-
var
|
|
24164
|
+
var crypto9 = runtimeFeatures.has("crypto") ? __require("node:crypto") : null;
|
|
24165
24165
|
var warningEmitted = false;
|
|
24166
24166
|
function establishWebSocketConnection(url, protocols, client, handler, options) {
|
|
24167
24167
|
const requestURL = url;
|
|
@@ -24181,7 +24181,7 @@ var require_connection = __commonJS({
|
|
|
24181
24181
|
const headersList = getHeadersList(new Headers(options.headers));
|
|
24182
24182
|
request2.headersList = headersList;
|
|
24183
24183
|
}
|
|
24184
|
-
const keyValue =
|
|
24184
|
+
const keyValue = crypto9.randomBytes(16).toString("base64");
|
|
24185
24185
|
request2.headersList.append("sec-websocket-key", keyValue, true);
|
|
24186
24186
|
request2.headersList.append("sec-websocket-version", "13", true);
|
|
24187
24187
|
for (const protocol of protocols) {
|
|
@@ -24221,7 +24221,7 @@ var require_connection = __commonJS({
|
|
|
24221
24221
|
return;
|
|
24222
24222
|
}
|
|
24223
24223
|
const secWSAccept = response.headersList.get("Sec-WebSocket-Accept");
|
|
24224
|
-
const digest =
|
|
24224
|
+
const digest = crypto9.hash("sha1", keyValue + uid, "base64");
|
|
24225
24225
|
if (secWSAccept !== digest) {
|
|
24226
24226
|
failHandshake(handler, response, 1002, "Incorrect hash received in Sec-WebSocket-Accept header.");
|
|
24227
24227
|
return;
|
|
@@ -26557,11 +26557,11 @@ var require_undici = __commonJS({
|
|
|
26557
26557
|
if (typeof opts.path !== "string") {
|
|
26558
26558
|
throw new InvalidArgumentError("invalid opts.path");
|
|
26559
26559
|
}
|
|
26560
|
-
let
|
|
26560
|
+
let path23 = opts.path;
|
|
26561
26561
|
if (!opts.path.startsWith("/")) {
|
|
26562
|
-
|
|
26562
|
+
path23 = `/${path23}`;
|
|
26563
26563
|
}
|
|
26564
|
-
url = new URL(util.parseOrigin(url).origin +
|
|
26564
|
+
url = new URL(util.parseOrigin(url).origin + path23);
|
|
26565
26565
|
} else {
|
|
26566
26566
|
if (!opts) {
|
|
26567
26567
|
opts = typeof url === "object" ? url : {};
|
|
@@ -26671,7 +26671,7 @@ ${captureLines}` : capture.stack;
|
|
|
26671
26671
|
});
|
|
26672
26672
|
|
|
26673
26673
|
// src/launcher-main.ts
|
|
26674
|
-
import
|
|
26674
|
+
import path22 from "node:path";
|
|
26675
26675
|
import { fileURLToPath } from "node:url";
|
|
26676
26676
|
|
|
26677
26677
|
// src/home.ts
|
|
@@ -26687,12 +26687,12 @@ var import_undici = __toESM(require_undici(), 1);
|
|
|
26687
26687
|
// ../cli/src/lib/agent/proxy.ts
|
|
26688
26688
|
import { execFileSync } from "node:child_process";
|
|
26689
26689
|
var PROXY_KEYS = ["HTTPS_PROXY", "https_proxy", "HTTP_PROXY", "http_proxy", "ALL_PROXY", "all_proxy"];
|
|
26690
|
-
function withSystemProxy(env2 = process.env, platform = process.platform,
|
|
26690
|
+
function withSystemProxy(env2 = process.env, platform = process.platform, read2 = () => execFileSync("/usr/sbin/scutil", ["--proxy"], { encoding: "utf8", timeout: 1e3, stdio: ["ignore", "pipe", "ignore"] })) {
|
|
26691
26691
|
const out = { ...env2 };
|
|
26692
26692
|
if (platform !== "darwin" || PROXY_KEYS.some((key) => env2[key] !== void 0)) return out;
|
|
26693
26693
|
let raw;
|
|
26694
26694
|
try {
|
|
26695
|
-
raw =
|
|
26695
|
+
raw = read2();
|
|
26696
26696
|
} catch {
|
|
26697
26697
|
return out;
|
|
26698
26698
|
}
|
|
@@ -26734,8 +26734,8 @@ function hostProxy() {
|
|
|
26734
26734
|
[...PROXY_KEYS, "NO_PROXY", "no_proxy"].flatMap((key) => process.env[key] === void 0 ? [] : [[key, process.env[key]]])
|
|
26735
26735
|
);
|
|
26736
26736
|
}
|
|
26737
|
-
function followProxy(
|
|
26738
|
-
current =
|
|
26737
|
+
function followProxy(read2) {
|
|
26738
|
+
current = read2 ? withSystemProxy(hostProxy(), process.platform, read2) : withSystemProxy(hostProxy());
|
|
26739
26739
|
const httpProxy = current.HTTP_PROXY || current.http_proxy || current.ALL_PROXY || current.all_proxy || void 0;
|
|
26740
26740
|
const route = {
|
|
26741
26741
|
httpProxy,
|
|
@@ -26774,15 +26774,15 @@ function loadProxyFile() {
|
|
|
26774
26774
|
}
|
|
26775
26775
|
}
|
|
26776
26776
|
function machineId() {
|
|
26777
|
-
const
|
|
26777
|
+
const file2 = path.join(runnerHome(), "machine.json");
|
|
26778
26778
|
try {
|
|
26779
|
-
const held = JSON.parse(fs.readFileSync(
|
|
26779
|
+
const held = JSON.parse(fs.readFileSync(file2, "utf8"));
|
|
26780
26780
|
if (held.id && /^[0-9a-f-]{36}$/i.test(held.id)) return held.id;
|
|
26781
26781
|
} catch {
|
|
26782
26782
|
}
|
|
26783
26783
|
const id = crypto.randomUUID();
|
|
26784
26784
|
fs.mkdirSync(runnerHome(), { recursive: true, mode: 448 });
|
|
26785
|
-
fs.writeFileSync(
|
|
26785
|
+
fs.writeFileSync(file2, `${JSON.stringify({ id })}
|
|
26786
26786
|
`);
|
|
26787
26787
|
return id;
|
|
26788
26788
|
}
|
|
@@ -26790,8 +26790,8 @@ var machineName = () => os.hostname().replace(/\.local$/, "");
|
|
|
26790
26790
|
|
|
26791
26791
|
// src/launcher.ts
|
|
26792
26792
|
import { spawn } from "node:child_process";
|
|
26793
|
-
import
|
|
26794
|
-
import
|
|
26793
|
+
import fs4 from "node:fs";
|
|
26794
|
+
import path4 from "node:path";
|
|
26795
26795
|
|
|
26796
26796
|
// ../cli/src/lib/cloud/config.ts
|
|
26797
26797
|
var SUPABASE_URL = "https://yajrbpprmdvtkvjjfpbk.supabase.co";
|
|
@@ -26863,29 +26863,54 @@ function status(line) {
|
|
|
26863
26863
|
`);
|
|
26864
26864
|
}
|
|
26865
26865
|
|
|
26866
|
+
// src/preferences.ts
|
|
26867
|
+
import crypto2 from "node:crypto";
|
|
26868
|
+
import fs2 from "node:fs";
|
|
26869
|
+
import path2 from "node:path";
|
|
26870
|
+
var file = () => path2.join(runnerHome(), "preferences.json");
|
|
26871
|
+
function read() {
|
|
26872
|
+
try {
|
|
26873
|
+
const value = JSON.parse(fs2.readFileSync(file(), "utf8"));
|
|
26874
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
26875
|
+
} catch {
|
|
26876
|
+
return {};
|
|
26877
|
+
}
|
|
26878
|
+
}
|
|
26879
|
+
var acceptAlphaUpdates = () => read().acceptAlphaUpdates === true;
|
|
26880
|
+
function saveAlphaUpdates(value) {
|
|
26881
|
+
const target = file(), temporary = `${target}.${crypto2.randomUUID()}.tmp`;
|
|
26882
|
+
fs2.mkdirSync(runnerHome(), { recursive: true, mode: 448 });
|
|
26883
|
+
try {
|
|
26884
|
+
fs2.writeFileSync(temporary, JSON.stringify({ ...read(), acceptAlphaUpdates: value }) + "\n", { mode: 384 });
|
|
26885
|
+
fs2.renameSync(temporary, target);
|
|
26886
|
+
} finally {
|
|
26887
|
+
fs2.rmSync(temporary, { force: true });
|
|
26888
|
+
}
|
|
26889
|
+
}
|
|
26890
|
+
|
|
26866
26891
|
// src/protocol.ts
|
|
26867
|
-
var VERSION = true ? "0.6.
|
|
26892
|
+
var VERSION = true ? "0.6.28" : "0.0.0";
|
|
26868
26893
|
var EXIT_REFUSED = 10;
|
|
26869
26894
|
var EXIT_OUTDATED = 11;
|
|
26870
26895
|
var EXIT_UPDATE = 12;
|
|
26871
26896
|
|
|
26872
26897
|
// src/update.ts
|
|
26873
|
-
import
|
|
26874
|
-
import
|
|
26875
|
-
import
|
|
26898
|
+
import crypto3 from "node:crypto";
|
|
26899
|
+
import fs3 from "node:fs";
|
|
26900
|
+
import path3 from "node:path";
|
|
26876
26901
|
import zlib from "node:zlib";
|
|
26877
26902
|
var PACKAGE = "wildcrane-runner";
|
|
26878
26903
|
var TIMEOUT_MS = 6e4;
|
|
26879
|
-
var versionsDir = () =>
|
|
26880
|
-
var legacyVersionsDir = () =>
|
|
26881
|
-
var versionDir = (version) =>
|
|
26882
|
-
var entryOf = (dir) =>
|
|
26904
|
+
var versionsDir = () => path3.join(runnerHome(), "bin", "runner");
|
|
26905
|
+
var legacyVersionsDir = () => path3.join(runnerHome(), "runner");
|
|
26906
|
+
var versionDir = (version) => path3.join(versionsDir(), version);
|
|
26907
|
+
var entryOf = (dir) => path3.join(dir, "dist", "runner.mjs");
|
|
26883
26908
|
var RUNNER = { name: PACKAGE, dirOf: versionDir, entryOf };
|
|
26884
26909
|
var registry = () => (process.env.npm_config_registry || "https://registry.npmjs.org").replace(/\/+$/, "");
|
|
26885
26910
|
var install2 = (version, nodeVersion) => installPackage(RUNNER, version, nodeVersion);
|
|
26886
26911
|
async function installPackage(pkg, version, nodeVersion = process.versions.node) {
|
|
26887
26912
|
const dir = pkg.dirOf(version);
|
|
26888
|
-
if (
|
|
26913
|
+
if (fs3.existsSync(pkg.entryOf(dir))) return { ok: true, dir };
|
|
26889
26914
|
let meta;
|
|
26890
26915
|
let tarball;
|
|
26891
26916
|
try {
|
|
@@ -26902,17 +26927,17 @@ async function installPackage(pkg, version, nodeVersion = process.versions.node)
|
|
|
26902
26927
|
return { ok: false, why: "unreachable", detail: e instanceof Error ? e.message : String(e) };
|
|
26903
26928
|
}
|
|
26904
26929
|
const expected = /^sha512-(.+)$/.exec(meta.dist.integrity ?? "")?.[1];
|
|
26905
|
-
const actual =
|
|
26930
|
+
const actual = crypto3.createHash("sha512").update(tarball).digest("base64");
|
|
26906
26931
|
if (!expected || expected !== actual) return { ok: false, why: "integrity", detail: "sha512 mismatch" };
|
|
26907
26932
|
const staging = `${dir}.${process.pid}.tmp`;
|
|
26908
26933
|
try {
|
|
26909
|
-
|
|
26934
|
+
fs3.rmSync(staging, { recursive: true, force: true });
|
|
26910
26935
|
extract(zlib.gunzipSync(tarball), staging);
|
|
26911
|
-
if (!
|
|
26912
|
-
|
|
26913
|
-
|
|
26936
|
+
if (!fs3.existsSync(pkg.entryOf(staging))) throw new Error(`the package carries no ${path3.relative(staging, pkg.entryOf(staging))}`);
|
|
26937
|
+
fs3.rmSync(dir, { recursive: true, force: true });
|
|
26938
|
+
fs3.renameSync(staging, dir);
|
|
26914
26939
|
} catch (e) {
|
|
26915
|
-
|
|
26940
|
+
fs3.rmSync(staging, { recursive: true, force: true });
|
|
26916
26941
|
return { ok: false, why: "integrity", detail: e instanceof Error ? e.message : String(e) };
|
|
26917
26942
|
}
|
|
26918
26943
|
return { ok: true, dir };
|
|
@@ -26942,12 +26967,12 @@ function extract(tar, into) {
|
|
|
26942
26967
|
if (type !== "0" && type !== "5") continue;
|
|
26943
26968
|
const relative = name.replace(/^[^/]+\//, "");
|
|
26944
26969
|
if (!relative) continue;
|
|
26945
|
-
const target =
|
|
26946
|
-
if (!target.startsWith(
|
|
26947
|
-
if (type === "5")
|
|
26970
|
+
const target = path3.resolve(into, relative);
|
|
26971
|
+
if (!target.startsWith(path3.resolve(into) + path3.sep)) throw new Error(`refusing ${name}`);
|
|
26972
|
+
if (type === "5") fs3.mkdirSync(target, { recursive: true });
|
|
26948
26973
|
else {
|
|
26949
|
-
|
|
26950
|
-
|
|
26974
|
+
fs3.mkdirSync(path3.dirname(target), { recursive: true });
|
|
26975
|
+
fs3.writeFileSync(target, body);
|
|
26951
26976
|
}
|
|
26952
26977
|
}
|
|
26953
26978
|
}
|
|
@@ -26958,6 +26983,19 @@ var parse = (v) => {
|
|
|
26958
26983
|
function compare(a, b) {
|
|
26959
26984
|
const [x, y] = [parse(a) ?? [0, 0, 0], parse(b) ?? [0, 0, 0]];
|
|
26960
26985
|
for (let i = 0; i < 3; i++) if (x[i] !== y[i]) return x[i] - y[i];
|
|
26986
|
+
const pre = (v) => /^v?\d+\.\d+\.\d+-([^+]+)/.exec(v)?.[1]?.split(".");
|
|
26987
|
+
const ap = pre(a), bp = pre(b);
|
|
26988
|
+
if (!ap || !bp) return ap ? -1 : bp ? 1 : 0;
|
|
26989
|
+
for (let i = 0; i < Math.max(ap.length, bp.length); i++) {
|
|
26990
|
+
const av = ap[i], bv = bp[i];
|
|
26991
|
+
if (av === bv) continue;
|
|
26992
|
+
if (av === void 0) return -1;
|
|
26993
|
+
if (bv === void 0) return 1;
|
|
26994
|
+
const an = /^\d+$/.test(av), bn = /^\d+$/.test(bv);
|
|
26995
|
+
if (an && bn) return Number(av) - Number(bv);
|
|
26996
|
+
if (an !== bn) return an ? -1 : 1;
|
|
26997
|
+
return av < bv ? -1 : 1;
|
|
26998
|
+
}
|
|
26961
26999
|
return 0;
|
|
26962
27000
|
}
|
|
26963
27001
|
function satisfies(version, range) {
|
|
@@ -26996,27 +27034,27 @@ function meets(version, comparator) {
|
|
|
26996
27034
|
var ASK_MS = 5e3;
|
|
26997
27035
|
var CONNECT_MS = 2 * 6e4;
|
|
26998
27036
|
var KEEP = 2;
|
|
26999
|
-
var stateFile = () =>
|
|
27037
|
+
var stateFile = () => path4.join(versionsDir(), "state.json");
|
|
27000
27038
|
function readState() {
|
|
27001
27039
|
try {
|
|
27002
|
-
const held = JSON.parse(
|
|
27003
|
-
return { good: held.good ?? [], bad: held.bad ?? [] };
|
|
27040
|
+
const held = JSON.parse(fs4.readFileSync(stateFile(), "utf8"));
|
|
27041
|
+
return { ...held, good: held.good ?? [], bad: held.bad ?? [] };
|
|
27004
27042
|
} catch {
|
|
27005
27043
|
return { good: [], bad: [] };
|
|
27006
27044
|
}
|
|
27007
27045
|
}
|
|
27008
27046
|
function writeState(state) {
|
|
27009
|
-
|
|
27010
|
-
|
|
27047
|
+
fs4.mkdirSync(versionsDir(), { recursive: true });
|
|
27048
|
+
fs4.writeFileSync(stateFile(), `${JSON.stringify(state, null, 2)}
|
|
27011
27049
|
`);
|
|
27012
27050
|
}
|
|
27013
27051
|
function markGood(version) {
|
|
27014
27052
|
const state = readState();
|
|
27015
27053
|
state.good = [version, ...state.good.filter((v) => v !== version)].slice(0, KEEP);
|
|
27016
27054
|
writeState(state);
|
|
27017
|
-
for (const name of
|
|
27055
|
+
for (const name of fs4.readdirSync(versionsDir())) {
|
|
27018
27056
|
if (name === "state.json" || state.good.includes(name) || name.endsWith(".tmp")) continue;
|
|
27019
|
-
|
|
27057
|
+
fs4.rmSync(path4.join(versionsDir(), name), { recursive: true, force: true });
|
|
27020
27058
|
}
|
|
27021
27059
|
}
|
|
27022
27060
|
function markBad(version) {
|
|
@@ -27026,26 +27064,49 @@ function markBad(version) {
|
|
|
27026
27064
|
writeState(state);
|
|
27027
27065
|
}
|
|
27028
27066
|
async function askTarget(machine) {
|
|
27067
|
+
const alpha = acceptAlphaUpdates();
|
|
27029
27068
|
try {
|
|
27030
|
-
const answer = await fetch(`${cloudEndpoints().api}/v1/runner/version?machine=${machine}`, {
|
|
27069
|
+
const answer = await fetch(`${cloudEndpoints().api}/v1/runner/version?machine=${machine}&alpha=${alpha}`, {
|
|
27031
27070
|
signal: AbortSignal.timeout(ASK_MS)
|
|
27032
27071
|
});
|
|
27033
27072
|
if (!answer.ok) return null;
|
|
27034
|
-
const { version, restartable } = await answer.json();
|
|
27035
|
-
|
|
27073
|
+
const { version, restartable, alpha: selectedAlpha, rollback } = await answer.json();
|
|
27074
|
+
if (acceptAlphaUpdates() !== alpha) return null;
|
|
27075
|
+
return typeof version === "string" && /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/.test(version) ? { version, restartable: restartable === true, alpha: selectedAlpha === true, rollback } : null;
|
|
27036
27076
|
} catch {
|
|
27037
27077
|
return null;
|
|
27038
27078
|
}
|
|
27039
27079
|
}
|
|
27080
|
+
function waiting(target, current2) {
|
|
27081
|
+
const state = readState();
|
|
27082
|
+
return !target.alpha && !!state.alpha?.includes(current2) && compare(target.version, current2) < 0 && (target.rollback === void 0 || target.rollback === (state.rollbackAt?.[current2] ?? 0));
|
|
27083
|
+
}
|
|
27084
|
+
function remember(target) {
|
|
27085
|
+
const state = readState();
|
|
27086
|
+
if (target.alpha) state.alpha = [.../* @__PURE__ */ new Set([...state.alpha ?? [], target.version])];
|
|
27087
|
+
if (target.rollback !== void 0) state.rollbackAt = { ...state.rollbackAt, [target.version]: target.rollback };
|
|
27088
|
+
writeState(state);
|
|
27089
|
+
}
|
|
27040
27090
|
async function candidates(own2) {
|
|
27041
27091
|
const state = readState();
|
|
27042
|
-
const proven = state.good.find((v) =>
|
|
27092
|
+
const proven = state.good.find((v) => fs4.existsSync(entryOf(versionDir(v))));
|
|
27043
27093
|
const current2 = proven && compare(proven, own2.version) > 0 ? { version: proven, entry: entryOf(versionDir(proven)) } : own2;
|
|
27044
|
-
const
|
|
27045
|
-
|
|
27046
|
-
if (target
|
|
27094
|
+
const desired = await askTarget(machineId());
|
|
27095
|
+
const target = desired?.version;
|
|
27096
|
+
if (!desired || !target || waiting(desired, current2.version) || state.bad.includes(target)) return [current2];
|
|
27097
|
+
if (target === current2.version) {
|
|
27098
|
+
remember(desired);
|
|
27099
|
+
return [current2];
|
|
27100
|
+
}
|
|
27101
|
+
if (target === own2.version) {
|
|
27102
|
+
remember(desired);
|
|
27103
|
+
return [own2, current2];
|
|
27104
|
+
}
|
|
27047
27105
|
const got = await install2(target);
|
|
27048
27106
|
if (got.ok) {
|
|
27107
|
+
const latest = await askTarget(machineId());
|
|
27108
|
+
if (!latest || latest.version !== target || waiting(latest, current2.version)) return [current2];
|
|
27109
|
+
remember(latest);
|
|
27049
27110
|
const known2 = state.good.includes(target);
|
|
27050
27111
|
return [{ version: target, entry: entryOf(got.dir), fresh: !known2 }, current2];
|
|
27051
27112
|
}
|
|
@@ -27069,7 +27130,7 @@ function runOnce(candidate, options) {
|
|
|
27069
27130
|
checking = true;
|
|
27070
27131
|
try {
|
|
27071
27132
|
const desired = await askTarget(machineId());
|
|
27072
|
-
if (!desired?.restartable) return;
|
|
27133
|
+
if (!desired?.restartable || waiting(desired, candidate.version)) return;
|
|
27073
27134
|
const target = desired.version;
|
|
27074
27135
|
if (!target || target === candidate.version || readState().bad.includes(target)) return;
|
|
27075
27136
|
const got = await install2(target);
|
|
@@ -27078,7 +27139,9 @@ function runOnce(candidate, options) {
|
|
|
27078
27139
|
return;
|
|
27079
27140
|
}
|
|
27080
27141
|
if (stopping2 || child.exitCode !== null || child.signalCode !== null) return;
|
|
27081
|
-
|
|
27142
|
+
const latest = await askTarget(machineId());
|
|
27143
|
+
if (!latest?.restartable || latest.version !== target || waiting(latest, candidate.version)) return;
|
|
27144
|
+
remember(latest);
|
|
27082
27145
|
update3 = { version: target, entry: entryOf(got.dir), fresh: !readState().good.includes(target) };
|
|
27083
27146
|
child.send({ type: "update" }, () => {
|
|
27084
27147
|
});
|
|
@@ -27122,7 +27185,7 @@ function runOnce(candidate, options) {
|
|
|
27122
27185
|
if (message.type === "connected" && !connected) {
|
|
27123
27186
|
connected = true;
|
|
27124
27187
|
if (timer) clearTimeout(timer);
|
|
27125
|
-
if (candidate.entry.startsWith(versionsDir() +
|
|
27188
|
+
if (candidate.entry.startsWith(versionsDir() + path4.sep)) fs4.rmSync(legacyVersionsDir(), { recursive: true, force: true });
|
|
27126
27189
|
if (candidate.fresh) {
|
|
27127
27190
|
markGood(candidate.version);
|
|
27128
27191
|
status(t.updated(candidate.version));
|
|
@@ -27152,6 +27215,11 @@ async function launch(own2, options = {}) {
|
|
|
27152
27215
|
const outcome = await runOnce(candidate, options);
|
|
27153
27216
|
if ("exit" in outcome) return outcome.exit;
|
|
27154
27217
|
if ("update" in outcome) {
|
|
27218
|
+
const latest = await askTarget(machineId());
|
|
27219
|
+
if (!latest || latest.version !== outcome.update.version || waiting(latest, candidate.version)) {
|
|
27220
|
+
list.splice(i + 1, list.length, candidate);
|
|
27221
|
+
continue;
|
|
27222
|
+
}
|
|
27155
27223
|
list.splice(i + 1, list.length, outcome.update, candidate);
|
|
27156
27224
|
continue;
|
|
27157
27225
|
}
|
|
@@ -27163,14 +27231,14 @@ async function launch(own2, options = {}) {
|
|
|
27163
27231
|
}
|
|
27164
27232
|
|
|
27165
27233
|
// ../cli/src/lib/cloud/session.ts
|
|
27166
|
-
import
|
|
27167
|
-
import
|
|
27234
|
+
import fs5 from "node:fs";
|
|
27235
|
+
import path6 from "node:path";
|
|
27168
27236
|
|
|
27169
27237
|
// ../cli/src/lib/machine/home.ts
|
|
27170
27238
|
import os2 from "node:os";
|
|
27171
|
-
import
|
|
27239
|
+
import path5 from "node:path";
|
|
27172
27240
|
function machineHome() {
|
|
27173
|
-
return process.env.AI4KANBAN_HOME ||
|
|
27241
|
+
return process.env.AI4KANBAN_HOME || path5.join(os2.homedir(), ".ai4kanban");
|
|
27174
27242
|
}
|
|
27175
27243
|
|
|
27176
27244
|
// ../cli/src/lib/cloud/session.ts
|
|
@@ -27178,13 +27246,13 @@ var REFRESH_MARGIN_MS = 6e4;
|
|
|
27178
27246
|
var LOCK_STALE_MS = 3e4;
|
|
27179
27247
|
var LOCK_WAIT_MS = 2e4;
|
|
27180
27248
|
var LOCK_RETRY_MS = 50;
|
|
27181
|
-
var sessionFile = () =>
|
|
27182
|
-
var lockDir = () =>
|
|
27183
|
-
var lockOwner = () =>
|
|
27249
|
+
var sessionFile = () => path6.join(machineHome(), "session.json");
|
|
27250
|
+
var lockDir = () => path6.join(machineHome(), "session.lock");
|
|
27251
|
+
var lockOwner = () => path6.join(lockDir(), "owner");
|
|
27184
27252
|
function readSession() {
|
|
27185
27253
|
let raw;
|
|
27186
27254
|
try {
|
|
27187
|
-
raw =
|
|
27255
|
+
raw = fs5.readFileSync(sessionFile(), "utf8");
|
|
27188
27256
|
} catch {
|
|
27189
27257
|
return null;
|
|
27190
27258
|
}
|
|
@@ -27198,15 +27266,15 @@ function readSession() {
|
|
|
27198
27266
|
}
|
|
27199
27267
|
}
|
|
27200
27268
|
function writeSession(session) {
|
|
27201
|
-
|
|
27269
|
+
fs5.mkdirSync(machineHome(), { recursive: true, mode: 448 });
|
|
27202
27270
|
const tmp = `${sessionFile()}.${process.pid}.tmp`;
|
|
27203
|
-
|
|
27271
|
+
fs5.writeFileSync(tmp, `${JSON.stringify(session, null, 2)}
|
|
27204
27272
|
`, { mode: 384 });
|
|
27205
|
-
|
|
27273
|
+
fs5.renameSync(tmp, sessionFile());
|
|
27206
27274
|
}
|
|
27207
27275
|
function clearSession() {
|
|
27208
27276
|
try {
|
|
27209
|
-
|
|
27277
|
+
fs5.rmSync(sessionFile());
|
|
27210
27278
|
} catch {
|
|
27211
27279
|
}
|
|
27212
27280
|
}
|
|
@@ -27275,23 +27343,23 @@ async function takeLock() {
|
|
|
27275
27343
|
const until = Date.now() + LOCK_WAIT_MS;
|
|
27276
27344
|
for (; ; ) {
|
|
27277
27345
|
try {
|
|
27278
|
-
|
|
27279
|
-
|
|
27346
|
+
fs5.mkdirSync(machineHome(), { recursive: true, mode: 448 });
|
|
27347
|
+
fs5.mkdirSync(lockDir());
|
|
27280
27348
|
try {
|
|
27281
|
-
|
|
27349
|
+
fs5.writeFileSync(lockOwner(), `${process.pid}
|
|
27282
27350
|
`);
|
|
27283
27351
|
} catch {
|
|
27284
27352
|
}
|
|
27285
27353
|
return () => {
|
|
27286
27354
|
try {
|
|
27287
|
-
|
|
27355
|
+
fs5.rmSync(lockDir(), { recursive: true, force: true });
|
|
27288
27356
|
} catch {
|
|
27289
27357
|
}
|
|
27290
27358
|
};
|
|
27291
27359
|
} catch (err) {
|
|
27292
27360
|
if (err.code !== "EEXIST") throw err;
|
|
27293
27361
|
if (stale()) {
|
|
27294
|
-
|
|
27362
|
+
fs5.rmSync(lockDir(), { recursive: true, force: true });
|
|
27295
27363
|
continue;
|
|
27296
27364
|
}
|
|
27297
27365
|
if (Date.now() > until) return () => {
|
|
@@ -27303,14 +27371,14 @@ async function takeLock() {
|
|
|
27303
27371
|
function stale() {
|
|
27304
27372
|
let held;
|
|
27305
27373
|
try {
|
|
27306
|
-
const pid = Number(
|
|
27374
|
+
const pid = Number(fs5.readFileSync(lockOwner(), "utf8").trim());
|
|
27307
27375
|
held = Number.isInteger(pid) && pid > 0 ? pid : void 0;
|
|
27308
27376
|
} catch {
|
|
27309
27377
|
held = void 0;
|
|
27310
27378
|
}
|
|
27311
27379
|
if (held !== void 0 && !alive(held)) return true;
|
|
27312
27380
|
try {
|
|
27313
|
-
return Date.now() -
|
|
27381
|
+
return Date.now() - fs5.statSync(lockDir()).mtimeMs > LOCK_STALE_MS;
|
|
27314
27382
|
} catch {
|
|
27315
27383
|
return false;
|
|
27316
27384
|
}
|
|
@@ -27326,10 +27394,10 @@ function alive(pid) {
|
|
|
27326
27394
|
var sleep = (ms) => new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
27327
27395
|
|
|
27328
27396
|
// src/settings-server.ts
|
|
27329
|
-
import
|
|
27330
|
-
import
|
|
27397
|
+
import crypto4 from "node:crypto";
|
|
27398
|
+
import fs6 from "node:fs";
|
|
27331
27399
|
import http from "node:http";
|
|
27332
|
-
import
|
|
27400
|
+
import path7 from "node:path";
|
|
27333
27401
|
|
|
27334
27402
|
// src/settings-browser.ts
|
|
27335
27403
|
import { spawn as spawn2, execFile } from "node:child_process";
|
|
@@ -27368,13 +27436,15 @@ const ICON = {folder:'<path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1
|
|
|
27368
27436
|
function icon(name){const span=document.createElement('span');span.className='icon';span.innerHTML='<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">'+ICON[name]+'</svg>';return span;}
|
|
27369
27437
|
const style = document.createElement('style');
|
|
27370
27438
|
style.textContent = \`*{box-sizing:border-box}body{margin:0;background:#fff;color:#24231f;font:13px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}button,select,input{font:inherit;color:inherit}button{cursor:pointer;background:#fff;border:0;border-radius:6px;padding:7px 10px;font-weight:600}button:hover{background:#f4f3f0}button:disabled{opacity:.45;cursor:default}button.primary{background:#24231f;color:white}button.danger{color:#b83a12}button:focus-visible,select:focus-visible,input:focus-visible{outline:2px solid #dd4f1e;outline-offset:3px}header{height:56px;border-bottom:1px solid #24231f1a;padding:0 32px;display:flex;align-items:center;justify-content:space-between}.brand{display:flex;align-items:center;gap:6px}.brand svg:first-child{height:22px;width:23.7px}.brand svg:last-child{height:13px;width:82px}main{max-width:800px;margin:0 auto;padding:40px 32px 48px}h1{font-size:22px;letter-spacing:-.02em;margin:0;font-weight:800}h2{font-size:14px;margin:0;font-weight:750}p{margin:4px 0}.muted{color:#77756f}.row{display:flex;align-items:center;gap:12px}.between{justify-content:space-between}.grow{flex:1;min-width:0}.section{margin-top:32px}.heading{margin-bottom:28px}.account{padding-bottom:24px;margin-bottom:36px;border-bottom:1px solid #24231f1a}.account-email{font-size:12px;color:#565550;margin-left:12px}.account .row>strong{font-size:14px}.account button{font-size:12px;padding:0}.account .connection{display:flex;align-items:center;gap:8px;margin-top:12px;font-size:12px;color:#565550}.title{margin-bottom:12px;min-height:21px}.title button{padding:0;font-size:12px}.projects{margin-top:0}.projects>.title button{font-size:13px;color:#b83a12}.icon{display:inline-flex;align-items:center;flex-shrink:0}.project,.tool{border-bottom:1px solid #24231f1a;padding:16px 0;min-height:56px}.project-name{font-weight:700;font-size:13px}.workspace-name{font-weight:400;color:#565550;margin-left:8px}.project{border:1px solid #24231f1a;border-radius:10px;padding:16px;min-height:80px;margin-top:8px}.project>button{padding:0;font-size:12px}.project .path{margin-top:4px;display:flex;align-items:center;gap:8px}.path button{padding:0;color:inherit}.path{overflow-wrap:anywhere;color:#77756f;font-size:12px;font-family:inherit}.tool{padding:12px 0}.tool-mark{display:inline-flex;width:20px;height:20px}.tool-mark svg{width:100%;height:100%}.status{font-size:12px;color:#565550}.online:before{content:'\u25CF';color:#66815e;margin-right:6px}.error{color:#b83a12;font-size:12px;margin:12px 0;white-space:pre-line}.menu-wrap{position:relative}.menu{position:absolute;right:0;top:38px;width:280px;max-width:calc(100vw - 32px);z-index:2;background:white;border:1px solid #deddd7;border-radius:8px;box-shadow:0 8px 30px #24231f14;padding:4px}.menu-list{max-height:240px;overflow:auto}.menu button{display:block;width:100%;text-align:left}.group{color:#77756f;font-size:11px;padding:8px}.new-project{border-top:1px solid #24231f1a;border-radius:0!important}.popover{position:fixed;width:280px;max-width:calc(100vw - 24px);padding:16px;border:1px solid #deddd7;border-radius:8px;box-shadow:0 8px 30px #24231f22;background:white;z-index:4}.actions{display:flex;justify-content:flex-end;gap:8px;margin-top:20px}dialog{border:1px solid #deddd7;border-radius:12px;padding:24px;width:440px;max-width:calc(100vw - 32px);color:inherit;box-shadow:0 20px 80px #24231f1a}dialog::backdrop{background:#24231f33}dialog h2{font-size:17px}label{display:block;font-size:12px;font-weight:600;margin:20px 0 7px}input,select{width:100%;border:1px solid #d9d8d2;border-radius:6px;padding:9px;background:white}header select{width:auto;border:0;font-size:12px}#signing-link{display:inline-block;margin:10px 0;color:inherit}.folder{display:flex;gap:12px;align-items:center;padding:10px 0}.info{display:inline-flex;margin-left:6px;color:#77756f}.empty{color:#77756f;padding:16px 0}.closed{padding:48px 0}a{color:inherit}@media(max-width:600px){header{padding:0 16px}main{padding:28px 20px}.account{flex-wrap:wrap}dialog{padding:20px}.project{gap:6px}}\`;
|
|
27439
|
+
style.textContent += '.update-option{display:flex;align-items:flex-start;gap:10px;margin:0;font-size:13px;font-weight:600}.update-option input{width:16px;height:16px;margin:2px 0 0;accent-color:#dd4f1e;flex-shrink:0}.update-hint{font-weight:400;font-size:12px;color:#77756f;margin-top:4px}.update-feedback{margin:8px 0 0 26px;font-size:12px;color:#565550}.update-feedback.error{color:#b83a12}.update-feedback button{padding:0;margin-left:10px;font-size:12px;color:#b83a12}';
|
|
27371
27440
|
document.head.append(style);
|
|
27372
27441
|
const words = {
|
|
27373
|
-
zh: { title:'\u672C\u673A\u8BBE\u7F6E', upgrade:'\u8BF7\u91CD\u65B0\u6253\u5F00\u63D2\u4EF6', upgradeHow:'\u5173\u95ED\u8FD9\u53F0\u7535\u8111\u4E0A\u4ECD\u5728\u4F7F\u7528\u65E7\u7248\u672C\u7684 WildCrane \u63D2\u4EF6\uFF0C\u518D\u91CD\u65B0\u6253\u5F00\u8BBE\u7F6E\u3002', projects:'\u9879\u76EE\u76EE\u5F55', add:'\u6DFB\u52A0\u9879\u76EE', new:'\uFF0B \u65B0\u5EFA\u9879\u76EE\u2026', tools:'AI \u5DE5\u5177', recheck:'\u91CD\u65B0\u68C0\u6D4B', out:'\u9000\u51FA\u767B\u5F55', connected:'\u5DF2\u8FDE\u63A5', offline:'\u4E91\u7AEF\u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u8BF7\u91CD\u8BD5\u3002', empty:'\u8FD8\u6CA1\u6709\u9879\u76EE\u76EE\u5F55', remove:'\u89E3\u9664\u7ED1\u5B9A', removeAsk:'\u89E3\u9664\u540E\uFF0C\u8BE5\u9879\u76EE\u7684\u65B0\u4EFB\u52A1\u5C06\u4E0D\u518D\u4F7F\u7528\u6B64\u6587\u4EF6\u5939\u3002\u9879\u76EE\u3001\u4EFB\u52A1\u548C\u6E90\u6587\u4EF6\u4FDD\u7559\u3002', cancel:'\u53D6\u6D88', confirm:'\u786E\u8BA4\u89E3\u9664', bindTitle:'\u7ED1\u5B9A\u5DF2\u6709\u9879\u76EE', newTitle:'\u65B0\u5EFA\u9879\u76EE', project:'\u9879\u76EE', workspace:'\u6240\u5C5E\u7A7A\u95F4', chooseWorkspace:'\u9009\u62E9\u7A7A\u95F4', name:'\u9879\u76EE\u540D\u79F0', folder:'\u9879\u76EE\u6587\u4EF6\u5939', folderHint:'\u7ED1\u5B9A\u4EC5\u6307\u5B9A\u4EFB\u52A1\u76EE\u5F55\uFF0C\u4E0D\u9650\u5236 AI \u5DE5\u5177\u8BBF\u95EE\u5176\u4ED6\u6587\u4EF6\u3002', choose:'\u9009\u62E9\u6587\u4EF6\u5939', current:'\u4F7F\u7528\u5F53\u524D\u4F1A\u8BDD\u6587\u4EF6\u5939', change:'\u66F4\u6362', create:'\u521B\u5EFA\u9879\u76EE', bind:'\u7ED1\u5B9A\u6587\u4EF6\u5939', signIn:'\u767B\u5F55 WildCrane', signing:'\u7B49\u5F85\u6D4F\u89C8\u5668\u5B8C\u6210\u767B\u5F55\u2026', signFailed:'\u767B\u5F55\u672A\u5B8C\u6210\uFF0C\u8BF7\u91CD\u8BD5\u3002', outTitle:'\u9000\u51FA\u8D26\u53F7\uFF1F', outAsk:'\u9000\u51FA\u540E\uFF0C\u8FD9\u53F0\u8FD0\u884C\u7535\u8111\u4E0A\u7684\u4EFB\u52A1\u5C06\u505C\u6B62\u3002', closed:'\u8BBE\u7F6E\u5DF2\u65AD\u5F00', reopen:'\u8BF7\u4ECE Claude Code\u3001Codex \u6216\u7EC8\u7AEF\u91CD\u65B0\u6253\u5F00 WildCrane \u8BBE\u7F6E\u3002', ready:'\u53EF\u7528', notInstalled:'\u672A\u5B89\u88C5', signedOut:'\u672A\u767B\u5F55', detecting:'\u68C0\u6D4B\u4E2D\u2026', retry:'\u91CD\u8BD5', noComputer:'\u672A\u8FDE\u63A5', errors:{ missing:'\u6587\u4EF6\u5939\u4E0D\u5B58\u5728\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\u3002', home:'\u4E0D\u80FD\u9009\u62E9\u4E3B\u76EE\u5F55\u6216\u5305\u542B\u4E3B\u76EE\u5F55\u7684\u6587\u4EF6\u5939\u3002', disk:'\u4E0D\u80FD\u9009\u62E9\u6574\u76D8\u3002', system:'\u4E0D\u80FD\u9009\u62E9\u7CFB\u7EDF\u76EE\u5F55\u3002', folder_taken:'\u8BE5\u6587\u4EF6\u5939\u5DF2\u7ED1\u5B9A\u5176\u4ED6\u9879\u76EE\uFF0C\u8BF7\u66F4\u6362\u3002', picker_unavailable:'\u65E0\u6CD5\u6253\u5F00\u7CFB\u7EDF\u6587\u4EF6\u5939\u9009\u62E9\u7A97\u53E3\u3002\u53EF\u91CD\u8BD5\u6216\u4F7F\u7528\u5F53\u524D\u4F1A\u8BDD\u6587\u4EF6\u5939\u3002', busy:'\u4EFB\u52A1\u3001\u672A\u540C\u6B65\u5185\u5BB9\u6216\u6682\u505C\u4EA4\u4ED8\u6B63\u5728\u5360\u7528\u76EE\u5F55\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002', authorization_write:'\u672C\u673A\u6388\u6743\u4FDD\u5B58\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002', authorization_busy:'\u5176\u4ED6\u4F1A\u8BDD\u6B63\u5728\u4FDD\u5B58\u6388\u6743\uFF0C\u8BF7\u91CD\u8BD5\u3002', not_found:'\u9879\u76EE\u4E0D\u53EF\u8BBF\u95EE\uFF0C\u8BF7\u91CD\u65B0\u6253\u5F00\u8BBE\u7F6E\u3002', forbidden:'\u4F60\u6CA1\u6709\u6B64\u7A7A\u95F4\u7684\u521B\u5EFA\u6743\u9650\u3002', offline:'\u4E91\u7AEF\u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u8BF7\u91CD\u8BD5\u3002', signed_out:'\u8D26\u53F7\u5DF2\u9000\u51FA\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55\u3002', stopping:'\u4EFB\u52A1\u4ECD\u5728\u505C\u6B62\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002', failed:'\u64CD\u4F5C\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002' } },
|
|
27374
|
-
en: { title:'Local settings', upgrade:'Reopen the plugin', upgradeHow:'Close the older WildCrane plugins on this computer, then reopen settings.', projects:'Project folders', add:'Add project', new:'+ New project\u2026', tools:'AI tools', recheck:'Check again', out:'Sign out', connected:'Connected', offline:'Cloud unavailable. Try again.', empty:'No project folders yet', remove:'Unbind', removeAsk:'New tasks will stop using this folder. The project, tasks and source files stay.', cancel:'Cancel', confirm:'Unbind folder', bindTitle:'Bind existing project', newTitle:'New project', project:'Project', workspace:'Workspace', chooseWorkspace:'Choose workspace', name:'Project name', folder:'Project folder', folderHint:'Binding selects a task folder; it does not restrict AI tools from accessing other files.', choose:'Choose folder', current:'Use current session folder', change:'Change', create:'Create project', bind:'Bind folder', signIn:'Sign in to WildCrane', signing:'Waiting for browser sign-in\u2026', signFailed:'Sign-in did not finish. Try again.', outTitle:'Sign out?', outAsk:'Tasks on this computer will stop.', closed:'Settings disconnected', reopen:'Reopen WildCrane settings from Claude Code, Codex or the terminal.', ready:'Ready', notInstalled:'Not installed', signedOut:'Signed out', detecting:'Checking\u2026', retry:'Try again', noComputer:'Disconnected', errors:{ missing:'Folder not found. Choose again.', home:'Choose a folder outside your home directory root.', disk:'A whole disk cannot be a project.', system:'Choose a folder outside system directories.', folder_taken:'This folder belongs to another project. Choose another.', picker_unavailable:'The system folder picker is unavailable. Try again or use the current session folder.', busy:'A task, unsent work or paused delivery holds this folder. Try again later.', authorization_write:'Could not save local permission. Try again.', authorization_busy:'Another session is saving permissions. Try again.', not_found:'Project unavailable. Reopen settings.', forbidden:'You cannot create projects in this workspace.', offline:'Cloud unavailable. Try again.', signed_out:'Signed out. Sign in again.', stopping:'Tasks are still stopping. Try again shortly.', failed:'Something went wrong. Try again.' } }
|
|
27442
|
+
zh: { updates:'\u7248\u672C\u66F4\u65B0', alpha:'\u63A5\u53D7 Alpha \u7248\u672C\u66F4\u65B0', hint:'Alpha \u7248\u672C\u98CE\u9669\u8F83\u9AD8\uFF0C\u4E0D\u5EFA\u8BAE\u65E5\u5E38\u4F7F\u7528\u3002', saving:'\u4FDD\u5B58\u4E2D\u2026', saved:'\u5DF2\u4FDD\u5B58', saveFailed:'\u672A\u80FD\u4FDD\u5B58\uFF0C\u66F4\u6539\u672A\u751F\u6548\u3002', title:'\u672C\u673A\u8BBE\u7F6E', upgrade:'\u8BF7\u91CD\u65B0\u6253\u5F00\u63D2\u4EF6', upgradeHow:'\u5173\u95ED\u8FD9\u53F0\u7535\u8111\u4E0A\u4ECD\u5728\u4F7F\u7528\u65E7\u7248\u672C\u7684 WildCrane \u63D2\u4EF6\uFF0C\u518D\u91CD\u65B0\u6253\u5F00\u8BBE\u7F6E\u3002', projects:'\u9879\u76EE\u76EE\u5F55', add:'\u6DFB\u52A0\u9879\u76EE', new:'\uFF0B \u65B0\u5EFA\u9879\u76EE\u2026', tools:'AI \u5DE5\u5177', recheck:'\u91CD\u65B0\u68C0\u6D4B', out:'\u9000\u51FA\u767B\u5F55', connected:'\u5DF2\u8FDE\u63A5', offline:'\u4E91\u7AEF\u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u8BF7\u91CD\u8BD5\u3002', empty:'\u8FD8\u6CA1\u6709\u9879\u76EE\u76EE\u5F55', remove:'\u89E3\u9664\u7ED1\u5B9A', removeAsk:'\u89E3\u9664\u540E\uFF0C\u8BE5\u9879\u76EE\u7684\u65B0\u4EFB\u52A1\u5C06\u4E0D\u518D\u4F7F\u7528\u6B64\u6587\u4EF6\u5939\u3002\u9879\u76EE\u3001\u4EFB\u52A1\u548C\u6E90\u6587\u4EF6\u4FDD\u7559\u3002', cancel:'\u53D6\u6D88', confirm:'\u786E\u8BA4\u89E3\u9664', bindTitle:'\u7ED1\u5B9A\u5DF2\u6709\u9879\u76EE', newTitle:'\u65B0\u5EFA\u9879\u76EE', project:'\u9879\u76EE', workspace:'\u6240\u5C5E\u7A7A\u95F4', chooseWorkspace:'\u9009\u62E9\u7A7A\u95F4', name:'\u9879\u76EE\u540D\u79F0', folder:'\u9879\u76EE\u6587\u4EF6\u5939', folderHint:'\u7ED1\u5B9A\u4EC5\u6307\u5B9A\u4EFB\u52A1\u76EE\u5F55\uFF0C\u4E0D\u9650\u5236 AI \u5DE5\u5177\u8BBF\u95EE\u5176\u4ED6\u6587\u4EF6\u3002', choose:'\u9009\u62E9\u6587\u4EF6\u5939', current:'\u4F7F\u7528\u5F53\u524D\u4F1A\u8BDD\u6587\u4EF6\u5939', change:'\u66F4\u6362', create:'\u521B\u5EFA\u9879\u76EE', bind:'\u7ED1\u5B9A\u6587\u4EF6\u5939', signIn:'\u767B\u5F55 WildCrane', signing:'\u7B49\u5F85\u6D4F\u89C8\u5668\u5B8C\u6210\u767B\u5F55\u2026', signFailed:'\u767B\u5F55\u672A\u5B8C\u6210\uFF0C\u8BF7\u91CD\u8BD5\u3002', outTitle:'\u9000\u51FA\u8D26\u53F7\uFF1F', outAsk:'\u9000\u51FA\u540E\uFF0C\u8FD9\u53F0\u8FD0\u884C\u7535\u8111\u4E0A\u7684\u4EFB\u52A1\u5C06\u505C\u6B62\u3002', closed:'\u8BBE\u7F6E\u5DF2\u65AD\u5F00', reopen:'\u8BF7\u4ECE Claude Code\u3001Codex \u6216\u7EC8\u7AEF\u91CD\u65B0\u6253\u5F00 WildCrane \u8BBE\u7F6E\u3002', ready:'\u53EF\u7528', notInstalled:'\u672A\u5B89\u88C5', signedOut:'\u672A\u767B\u5F55', detecting:'\u68C0\u6D4B\u4E2D\u2026', retry:'\u91CD\u8BD5', noComputer:'\u672A\u8FDE\u63A5', errors:{ missing:'\u6587\u4EF6\u5939\u4E0D\u5B58\u5728\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\u3002', home:'\u4E0D\u80FD\u9009\u62E9\u4E3B\u76EE\u5F55\u6216\u5305\u542B\u4E3B\u76EE\u5F55\u7684\u6587\u4EF6\u5939\u3002', disk:'\u4E0D\u80FD\u9009\u62E9\u6574\u76D8\u3002', system:'\u4E0D\u80FD\u9009\u62E9\u7CFB\u7EDF\u76EE\u5F55\u3002', folder_taken:'\u8BE5\u6587\u4EF6\u5939\u5DF2\u7ED1\u5B9A\u5176\u4ED6\u9879\u76EE\uFF0C\u8BF7\u66F4\u6362\u3002', picker_unavailable:'\u65E0\u6CD5\u6253\u5F00\u7CFB\u7EDF\u6587\u4EF6\u5939\u9009\u62E9\u7A97\u53E3\u3002\u53EF\u91CD\u8BD5\u6216\u4F7F\u7528\u5F53\u524D\u4F1A\u8BDD\u6587\u4EF6\u5939\u3002', busy:'\u4EFB\u52A1\u3001\u672A\u540C\u6B65\u5185\u5BB9\u6216\u6682\u505C\u4EA4\u4ED8\u6B63\u5728\u5360\u7528\u76EE\u5F55\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002', authorization_write:'\u672C\u673A\u6388\u6743\u4FDD\u5B58\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002', authorization_busy:'\u5176\u4ED6\u4F1A\u8BDD\u6B63\u5728\u4FDD\u5B58\u6388\u6743\uFF0C\u8BF7\u91CD\u8BD5\u3002', not_found:'\u9879\u76EE\u4E0D\u53EF\u8BBF\u95EE\uFF0C\u8BF7\u91CD\u65B0\u6253\u5F00\u8BBE\u7F6E\u3002', forbidden:'\u4F60\u6CA1\u6709\u6B64\u7A7A\u95F4\u7684\u521B\u5EFA\u6743\u9650\u3002', offline:'\u4E91\u7AEF\u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u8BF7\u91CD\u8BD5\u3002', signed_out:'\u8D26\u53F7\u5DF2\u9000\u51FA\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55\u3002', stopping:'\u4EFB\u52A1\u4ECD\u5728\u505C\u6B62\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002', failed:'\u64CD\u4F5C\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002' } },
|
|
27443
|
+
en: { updates:'Updates', alpha:'Receive Alpha updates', hint:'Alpha versions carry higher risk. Not recommended for everyday use.', saving:'Saving\u2026', saved:'Saved', saveFailed:'Could not save. Your setting has not changed.', title:'Local settings', upgrade:'Reopen the plugin', upgradeHow:'Close the older WildCrane plugins on this computer, then reopen settings.', projects:'Project folders', add:'Add project', new:'+ New project\u2026', tools:'AI tools', recheck:'Check again', out:'Sign out', connected:'Connected', offline:'Cloud unavailable. Try again.', empty:'No project folders yet', remove:'Unbind', removeAsk:'New tasks will stop using this folder. The project, tasks and source files stay.', cancel:'Cancel', confirm:'Unbind folder', bindTitle:'Bind existing project', newTitle:'New project', project:'Project', workspace:'Workspace', chooseWorkspace:'Choose workspace', name:'Project name', folder:'Project folder', folderHint:'Binding selects a task folder; it does not restrict AI tools from accessing other files.', choose:'Choose folder', current:'Use current session folder', change:'Change', create:'Create project', bind:'Bind folder', signIn:'Sign in to WildCrane', signing:'Waiting for browser sign-in\u2026', signFailed:'Sign-in did not finish. Try again.', outTitle:'Sign out?', outAsk:'Tasks on this computer will stop.', closed:'Settings disconnected', reopen:'Reopen WildCrane settings from Claude Code, Codex or the terminal.', ready:'Ready', notInstalled:'Not installed', signedOut:'Signed out', detecting:'Checking\u2026', retry:'Try again', noComputer:'Disconnected', errors:{ missing:'Folder not found. Choose again.', home:'Choose a folder outside your home directory root.', disk:'A whole disk cannot be a project.', system:'Choose a folder outside system directories.', folder_taken:'This folder belongs to another project. Choose another.', picker_unavailable:'The system folder picker is unavailable. Try again or use the current session folder.', busy:'A task, unsent work or paused delivery holds this folder. Try again later.', authorization_write:'Could not save local permission. Try again.', authorization_busy:'Another session is saving permissions. Try again.', not_found:'Project unavailable. Reopen settings.', forbidden:'You cannot create projects in this workspace.', offline:'Cloud unavailable. Try again.', signed_out:'Signed out. Sign in again.', stopping:'Tasks are still stopping. Try again shortly.', failed:'Something went wrong. Try again.' } }
|
|
27375
27444
|
};
|
|
27376
27445
|
let lang = navigator.language.startsWith('zh') ? 'zh' : 'en';
|
|
27377
27446
|
let state = {}, tools = null, csrf = '', disconnected = false, busy = false, modal = null, pop = null, menu = null, pageError = '';
|
|
27447
|
+
let updateStatus='', updateWanted=false;
|
|
27378
27448
|
const app = document.querySelector('#app');
|
|
27379
27449
|
const t = () => words[lang];
|
|
27380
27450
|
function el(tag, text, cls) { const node = document.createElement(tag); if(text != null) node.textContent = text; if(cls) node.className = cls; return node; }
|
|
@@ -27435,6 +27505,21 @@ function projectMenu(anchor, wrap) {
|
|
|
27435
27505
|
box.onkeydown=e=>{const items=[...box.querySelectorAll('button')];let i=items.indexOf(document.activeElement);if(e.key==='ArrowDown'||e.key==='ArrowUp'){e.preventDefault();items[(i+(e.key==='ArrowDown'?1:items.length-1))%items.length]?.focus();}if(e.key==='Home'){e.preventDefault();items[0]?.focus();}if(e.key==='End'){e.preventDefault();items.at(-1)?.focus();}};
|
|
27436
27506
|
}
|
|
27437
27507
|
async function checkTools(){tools=null;render();try{const found=await api('connections');if(found.error)pageError=message(found.error);else tools=found.connections;}catch{pageError=t().offline;}render();}
|
|
27508
|
+
async function saveUpdates(value){
|
|
27509
|
+
if(updateStatus==='saving')return;
|
|
27510
|
+
updateWanted=value;updateStatus='saving';render();
|
|
27511
|
+
try{const result=await api('updates',{acceptAlphaUpdates:value});if(result.error){if(typeof result.acceptAlphaUpdates==='boolean')state.acceptAlphaUpdates=result.acceptAlphaUpdates;updateStatus='failed';}else{state.acceptAlphaUpdates=result.acceptAlphaUpdates;updateStatus='saved';}}
|
|
27512
|
+
catch{updateStatus='failed';}
|
|
27513
|
+
render();document.querySelector('.update-option input')?.focus();
|
|
27514
|
+
}
|
|
27515
|
+
function updatesSection(){
|
|
27516
|
+
const section=el('section',null,'section'),label=el('label',null,'update-option'),input=el('input');
|
|
27517
|
+
input.type='checkbox';input.checked=updateStatus==='saving'?updateWanted:state.acceptAlphaUpdates===true;input.disabled=updateStatus==='saving';input.setAttribute('aria-describedby','alpha-hint');input.onchange=()=>saveUpdates(input.checked);
|
|
27518
|
+
const hint=el('p',t().hint,'update-hint');hint.id='alpha-hint';
|
|
27519
|
+
append(section,append(el('div',null,'title'),el('h2',t().updates)),append(label,input,append(el('span',t().alpha),hint)));
|
|
27520
|
+
if(updateStatus){const feedback=el('p',updateStatus==='failed'?t().saveFailed:t()[updateStatus],'update-feedback'+(updateStatus==='failed'?' error':''));feedback.role=updateStatus==='failed'?'alert':'status';if(updateStatus==='failed')feedback.append(button(t().retry,()=>saveUpdates(updateWanted)));section.append(feedback);}
|
|
27521
|
+
return section;
|
|
27522
|
+
}
|
|
27438
27523
|
function render(){
|
|
27439
27524
|
if(modal||(!disconnected&&(menu||pop)))return;
|
|
27440
27525
|
closeFloating();app.replaceChildren();document.documentElement.lang=lang;
|
|
@@ -27444,7 +27529,7 @@ function render(){
|
|
|
27444
27529
|
if(disconnected){append(main,el('h1',t().closed),el('p',t().reopen,'muted'));return;}
|
|
27445
27530
|
append(main,append(el('div',null,'row heading'),el('h1',t().title),el('span',state.machine||'','status')));
|
|
27446
27531
|
if(state.upgrade){append(main,el('h2',t().upgrade),el('p',t().upgradeHow,'muted'));return;}
|
|
27447
|
-
if(!state.signedIn){const section=el('section',null,'section');if(state.signing&&!state.signing.failed){append(section,el('p',t().signing));if(state.signing.url){const link=el('a',t().signIn);link.href=state.signing.url;link.id='signing-link';link.rel='noreferrer';link.target='_blank';section.append(link);}}else{if(state.signing?.failed)section.append(el('p',t().signFailed,'error'));section.append(button(t().signIn,async()=>{try{await api('signIn');await refresh();}catch{pageError=t().offline;render();}},'primary'));}append(main,section);return;}
|
|
27532
|
+
if(!state.signedIn){const section=el('section',null,'section');if(state.signing&&!state.signing.failed){append(section,el('p',t().signing));if(state.signing.url){const link=el('a',t().signIn);link.href=state.signing.url;link.id='signing-link';link.rel='noreferrer';link.target='_blank';section.append(link);}}else{if(state.signing?.failed)section.append(el('p',t().signFailed,'error'));section.append(button(t().signIn,async()=>{try{await api('signIn');await refresh();}catch{pageError=t().offline;render();}},'primary'));}append(main,section,updatesSection());return;}
|
|
27448
27533
|
const account=state.account||{};const out=button(t().out,()=>outDialog(out));append(main,append(el('section',null,'account'),append(el('div',null,'row between'),append(el('div',null,'row grow'),el('strong',account.name||account.email),el('span',account.email,'account-email')),out),append(el('div',null,'connection'),icon('monitor'),el('span',state.connected?t().connected:t().noComputer))));
|
|
27449
27534
|
if(state.error||pageError){const error=el('div',null,'error');append(error,el('span',pageError||message(state.error)),button(t().retry,()=>{pageError='';void refresh();}));main.append(error);}
|
|
27450
27535
|
const projects=el('section',null,'projects'),wrap=el('div',null,'menu-wrap'),add=button(t().add+' \u2304',()=>projectMenu(add,wrap));wrap.append(add);append(projects,append(el('div',null,'row between title'),el('h2',t().projects),wrap));
|
|
@@ -27454,19 +27539,19 @@ function render(){
|
|
|
27454
27539
|
const section=el('section',null,'section');const recheck=button('',checkTools);append(recheck,icon('refresh'),el('span',t().recheck));recheck.className='row';recheck.style.gap='4px';append(section,append(el('div',null,'row between title'),el('h2',t().tools),recheck));
|
|
27455
27540
|
if(!tools)section.append(el('p',t().detecting,'muted'));
|
|
27456
27541
|
for(const tool of tools||[]){if(!['claude-code','codex','opencode'].includes(tool.name)&&tool.state==='notInstalled')continue;const mark=el('span',null,'tool-mark');if(MARKS[tool.name])mark.innerHTML=MARKS[tool.name];append(section,append(el('div',null,'row tool'),mark,el('strong',tool.label,'grow'),el('span',t()[tool.state]||tool.state,'status')));}
|
|
27457
|
-
append(main,projects,section);
|
|
27542
|
+
append(main,projects,section,updatesSection());
|
|
27458
27543
|
}
|
|
27459
27544
|
let refreshing=false;
|
|
27460
|
-
async function refresh(){if(refreshing||disconnected)return;refreshing=true;try{const next=await api('state');if(next.error&&next.account?.id===state.account?.id)state={...state,...next};else {if(next.account?.id!==state.account?.id)tools=null;state=next;}render();if(state.signedIn&&!tools)void checkTools();}catch{disconnected=true;render();}finally{refreshing=false;}}
|
|
27545
|
+
async function refresh(){if(refreshing||disconnected||updateStatus==='saving')return;refreshing=true;try{const next=await api('state');if(next.error&&next.account?.id===state.account?.id)state={...state,...next};else {if(next.account?.id!==state.account?.id)tools=null;state=next;}render();if(state.signedIn&&!tools)void checkTools();}catch{disconnected=true;render();}finally{refreshing=false;}}
|
|
27461
27546
|
(async()=>{const ticket=location.hash.slice(1);history.replaceState(null,'','/');try{if(!ticket){csrf=sessionStorage.getItem('wc_settings_csrf')||'';if(!csrf)throw Error('expired');await refresh();return;}const response=await fetch('/session',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({ticket})});const session=await response.json();if(!response.ok)throw Error('expired');csrf=session.csrf;sessionStorage.setItem('wc_settings_csrf',csrf);await refresh();const context=state.context?.project;const project=(state.elsewhere||[]).find(p=>p.project===context);if(project)projectDialog(project,null);}catch{disconnected=true;render();}})();
|
|
27462
27547
|
setInterval(()=>{if(document.visibilityState==='visible'&&!modal&&!menu&&!pop&&!busy)void refresh();},3000);
|
|
27463
27548
|
document.addEventListener('visibilitychange',()=>{if(document.visibilityState==='visible')void refresh();});
|
|
27464
27549
|
`;
|
|
27465
27550
|
|
|
27466
27551
|
// src/settings-server.ts
|
|
27467
|
-
var recordFile = () =>
|
|
27552
|
+
var recordFile = () => path7.join(runnerHome(), "settings.json");
|
|
27468
27553
|
var sleep2 = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
27469
|
-
var random = () =>
|
|
27554
|
+
var random = () => crypto4.randomBytes(32).toString("hex");
|
|
27470
27555
|
var own = null;
|
|
27471
27556
|
async function control(record, action, body = {}) {
|
|
27472
27557
|
return fetch(`http://127.0.0.1:${record.port}/control/${action}`, {
|
|
@@ -27478,14 +27563,14 @@ async function control(record, action, body = {}) {
|
|
|
27478
27563
|
}
|
|
27479
27564
|
function discover() {
|
|
27480
27565
|
try {
|
|
27481
|
-
return JSON.parse(
|
|
27566
|
+
return JSON.parse(fs6.readFileSync(recordFile(), "utf8"));
|
|
27482
27567
|
} catch {
|
|
27483
27568
|
return null;
|
|
27484
27569
|
}
|
|
27485
27570
|
}
|
|
27486
27571
|
async function openSettings(action, context = {}, open = true) {
|
|
27487
27572
|
if (process.env.WILDCRANE_JOB) throw new Error("nested_session");
|
|
27488
|
-
|
|
27573
|
+
fs6.mkdirSync(runnerHome(), { recursive: true, mode: 448 });
|
|
27489
27574
|
const lock = `${recordFile()}.lock`;
|
|
27490
27575
|
for (let attempt = 0; attempt < 100; attempt++) {
|
|
27491
27576
|
const held = discover();
|
|
@@ -27500,16 +27585,16 @@ async function openSettings(action, context = {}, open = true) {
|
|
|
27500
27585
|
}
|
|
27501
27586
|
}
|
|
27502
27587
|
try {
|
|
27503
|
-
const fd =
|
|
27504
|
-
|
|
27505
|
-
|
|
27588
|
+
const fd = fs6.openSync(lock, "wx", 384);
|
|
27589
|
+
fs6.writeFileSync(fd, String(process.pid));
|
|
27590
|
+
fs6.closeSync(fd);
|
|
27506
27591
|
} catch {
|
|
27507
27592
|
try {
|
|
27508
|
-
const pid = Number(
|
|
27593
|
+
const pid = Number(fs6.readFileSync(lock, "utf8"));
|
|
27509
27594
|
try {
|
|
27510
27595
|
process.kill(pid, 0);
|
|
27511
27596
|
} catch {
|
|
27512
|
-
|
|
27597
|
+
fs6.rmSync(lock, { force: true });
|
|
27513
27598
|
}
|
|
27514
27599
|
} catch {
|
|
27515
27600
|
}
|
|
@@ -27526,7 +27611,7 @@ async function openSettings(action, context = {}, open = true) {
|
|
|
27526
27611
|
}
|
|
27527
27612
|
own = await startSettingsServer(action);
|
|
27528
27613
|
} finally {
|
|
27529
|
-
|
|
27614
|
+
fs6.rmSync(lock, { force: true });
|
|
27530
27615
|
}
|
|
27531
27616
|
}
|
|
27532
27617
|
throw new Error("settings_unavailable");
|
|
@@ -27602,12 +27687,12 @@ async function startSettingsServer(action) {
|
|
|
27602
27687
|
origin = `http://127.0.0.1:${port}`;
|
|
27603
27688
|
record = { port, secret, pid: process.pid };
|
|
27604
27689
|
const tmp = `${recordFile()}.${process.pid}.tmp`;
|
|
27605
|
-
|
|
27606
|
-
|
|
27690
|
+
fs6.writeFileSync(tmp, JSON.stringify(record), { mode: 384 });
|
|
27691
|
+
fs6.renameSync(tmp, recordFile());
|
|
27607
27692
|
return {
|
|
27608
27693
|
origin,
|
|
27609
27694
|
async close() {
|
|
27610
|
-
if (discover()?.secret === secret)
|
|
27695
|
+
if (discover()?.secret === secret) fs6.rmSync(recordFile(), { force: true });
|
|
27611
27696
|
server.closeAllConnections();
|
|
27612
27697
|
await new Promise((resolve2) => server.close(() => resolve2()));
|
|
27613
27698
|
}
|
|
@@ -27615,9 +27700,9 @@ async function startSettingsServer(action) {
|
|
|
27615
27700
|
}
|
|
27616
27701
|
|
|
27617
27702
|
// src/settings.ts
|
|
27618
|
-
import
|
|
27619
|
-
import
|
|
27620
|
-
import
|
|
27703
|
+
import crypto8 from "node:crypto";
|
|
27704
|
+
import fs17 from "node:fs";
|
|
27705
|
+
import path21 from "node:path";
|
|
27621
27706
|
|
|
27622
27707
|
// src/api.ts
|
|
27623
27708
|
var RUNTIMES = ["claude-code", "codex", "cursor", "opencode", "kimi", "dsh", "zcode", "grok"];
|
|
@@ -27663,7 +27748,7 @@ var FILE_TIMEOUT_MS = 10 * 6e4;
|
|
|
27663
27748
|
var readRunner = () => request("GET", "/v1/runner");
|
|
27664
27749
|
var q = encodeURIComponent;
|
|
27665
27750
|
var listFolders = (machineId2) => request("GET", `/v1/runner/folders?machine=${q(machineId2)}`);
|
|
27666
|
-
var addFolder = (machineId2, name,
|
|
27751
|
+
var addFolder = (machineId2, name, path23, project) => request("POST", "/v1/runner/folders", { machineId: machineId2, name, path: path23, ...project ? { project } : {} });
|
|
27667
27752
|
async function createProject(name, workspace, key) {
|
|
27668
27753
|
const sent = await send("POST", "/v1/projects", { name, workspace }, true, TIMEOUT_MS2, void 0, { "idempotency-key": key });
|
|
27669
27754
|
return sent.ok ? answerOf(sent.value) : sent;
|
|
@@ -27671,13 +27756,13 @@ async function createProject(name, workspace, key) {
|
|
|
27671
27756
|
var removeFolder = (machineId2, project) => request("POST", `/v1/runner/folders/${q(project)}/remove`, { machineId: machineId2 });
|
|
27672
27757
|
|
|
27673
27758
|
// src/cache.ts
|
|
27674
|
-
import
|
|
27675
|
-
import
|
|
27676
|
-
import
|
|
27759
|
+
import crypto5 from "node:crypto";
|
|
27760
|
+
import fs9 from "node:fs";
|
|
27761
|
+
import path10 from "node:path";
|
|
27677
27762
|
|
|
27678
27763
|
// ../cli/src/lib/machine/project.ts
|
|
27679
|
-
import
|
|
27680
|
-
import
|
|
27764
|
+
import fs7 from "node:fs";
|
|
27765
|
+
import path8 from "node:path";
|
|
27681
27766
|
var SESSIONS_FILE = "sessions.json";
|
|
27682
27767
|
var SESSIONS_FOLDER = "sessions";
|
|
27683
27768
|
var ASSETS_FOLDER = "assets";
|
|
@@ -27686,16 +27771,16 @@ var SESSIONS_LOCK = "sessions.lock";
|
|
|
27686
27771
|
var INDEX_LOCK = "index.lock";
|
|
27687
27772
|
var UI_CONFIG_FILE = "ui.config.json";
|
|
27688
27773
|
function realPathOf(dir) {
|
|
27689
|
-
const here2 =
|
|
27774
|
+
const here2 = path8.resolve(dir);
|
|
27690
27775
|
const rest = [];
|
|
27691
27776
|
let at = here2;
|
|
27692
27777
|
for (; ; ) {
|
|
27693
27778
|
try {
|
|
27694
|
-
return
|
|
27779
|
+
return path8.join(fs7.realpathSync(at), ...rest);
|
|
27695
27780
|
} catch {
|
|
27696
|
-
const up =
|
|
27781
|
+
const up = path8.dirname(at);
|
|
27697
27782
|
if (up === at) return here2;
|
|
27698
|
-
rest.unshift(
|
|
27783
|
+
rest.unshift(path8.basename(at));
|
|
27699
27784
|
at = up;
|
|
27700
27785
|
}
|
|
27701
27786
|
}
|
|
@@ -27703,40 +27788,40 @@ function realPathOf(dir) {
|
|
|
27703
27788
|
function stateRootOf(board) {
|
|
27704
27789
|
let dir = realPathOf(board);
|
|
27705
27790
|
for (; ; ) {
|
|
27706
|
-
if (
|
|
27707
|
-
const up =
|
|
27791
|
+
if (fs7.existsSync(path8.join(dir, ".git"))) return dir;
|
|
27792
|
+
const up = path8.dirname(dir);
|
|
27708
27793
|
if (up === dir) break;
|
|
27709
27794
|
dir = up;
|
|
27710
27795
|
}
|
|
27711
27796
|
return rootAbove(realPathOf(board));
|
|
27712
27797
|
}
|
|
27713
27798
|
function rootAbove(board) {
|
|
27714
|
-
const parent =
|
|
27715
|
-
return ["docs", ".akb"].includes(
|
|
27799
|
+
const parent = path8.dirname(board);
|
|
27800
|
+
return ["docs", ".akb"].includes(path8.basename(parent)) ? path8.dirname(parent) : parent;
|
|
27716
27801
|
}
|
|
27717
27802
|
function projectStateDir(board, root = stateRootOf(board)) {
|
|
27718
|
-
const relative =
|
|
27719
|
-
if (relative === ".." || relative.startsWith(`..${
|
|
27803
|
+
const relative = path8.relative(realPathOf(root), realPathOf(board));
|
|
27804
|
+
if (relative === ".." || relative.startsWith(`..${path8.sep}`) || path8.isAbsolute(relative)) {
|
|
27720
27805
|
throw new Error("The board must be inside its project root.");
|
|
27721
27806
|
}
|
|
27722
|
-
return
|
|
27807
|
+
return path8.join(realPathOf(root), ".akb", "boards", relative || "_root");
|
|
27723
27808
|
}
|
|
27724
27809
|
|
|
27725
27810
|
// src/folders.ts
|
|
27726
|
-
import
|
|
27811
|
+
import fs8 from "node:fs";
|
|
27727
27812
|
import os3 from "node:os";
|
|
27728
|
-
import
|
|
27729
|
-
var projectsFile = () =>
|
|
27813
|
+
import path9 from "node:path";
|
|
27814
|
+
var projectsFile = () => path9.join(runnerHome(), "projects.json");
|
|
27730
27815
|
function realpath(p) {
|
|
27731
27816
|
try {
|
|
27732
|
-
return
|
|
27817
|
+
return fs8.realpathSync(p);
|
|
27733
27818
|
} catch {
|
|
27734
27819
|
return null;
|
|
27735
27820
|
}
|
|
27736
27821
|
}
|
|
27737
27822
|
function readGrants() {
|
|
27738
27823
|
try {
|
|
27739
|
-
const held = JSON.parse(
|
|
27824
|
+
const held = JSON.parse(fs8.readFileSync(projectsFile(), "utf8"));
|
|
27740
27825
|
if (!Array.isArray(held.projects)) throw new Error("invalid_projects");
|
|
27741
27826
|
return held;
|
|
27742
27827
|
} catch (error) {
|
|
@@ -27750,23 +27835,23 @@ function listOf(held) {
|
|
|
27750
27835
|
return subject ? held.accounts[subject] ?? [] : [];
|
|
27751
27836
|
}
|
|
27752
27837
|
function update(change) {
|
|
27753
|
-
|
|
27838
|
+
fs8.mkdirSync(runnerHome(), { recursive: true, mode: 448 });
|
|
27754
27839
|
const lock = `${projectsFile()}.lock`;
|
|
27755
27840
|
let fd;
|
|
27756
27841
|
const until = Date.now() + 2e3;
|
|
27757
27842
|
for (; ; ) {
|
|
27758
27843
|
try {
|
|
27759
|
-
fd =
|
|
27760
|
-
|
|
27844
|
+
fd = fs8.openSync(lock, "wx", 384);
|
|
27845
|
+
fs8.writeFileSync(fd, String(process.pid));
|
|
27761
27846
|
break;
|
|
27762
27847
|
} catch {
|
|
27763
27848
|
try {
|
|
27764
|
-
const pid = Number(
|
|
27849
|
+
const pid = Number(fs8.readFileSync(lock, "utf8"));
|
|
27765
27850
|
if (pid > 0) {
|
|
27766
27851
|
try {
|
|
27767
27852
|
process.kill(pid, 0);
|
|
27768
27853
|
} catch {
|
|
27769
|
-
|
|
27854
|
+
fs8.rmSync(lock, { force: true });
|
|
27770
27855
|
}
|
|
27771
27856
|
}
|
|
27772
27857
|
} catch {
|
|
@@ -27789,13 +27874,13 @@ function update(change) {
|
|
|
27789
27874
|
held.projects = after;
|
|
27790
27875
|
} else held.projects = after;
|
|
27791
27876
|
const tmp = `${projectsFile()}.${process.pid}.tmp`;
|
|
27792
|
-
|
|
27877
|
+
fs8.writeFileSync(tmp, `${JSON.stringify(held, null, 2)}
|
|
27793
27878
|
`, { mode: 384 });
|
|
27794
|
-
|
|
27879
|
+
fs8.renameSync(tmp, projectsFile());
|
|
27795
27880
|
return before.filter((p) => !after.includes(p));
|
|
27796
27881
|
} finally {
|
|
27797
|
-
|
|
27798
|
-
|
|
27882
|
+
fs8.closeSync(fd);
|
|
27883
|
+
fs8.rmSync(lock, { force: true });
|
|
27799
27884
|
}
|
|
27800
27885
|
}
|
|
27801
27886
|
function adoptLegacy() {
|
|
@@ -27810,9 +27895,9 @@ var SYSTEM_WIN = ["Windows", "Program Files", "Program Files (x86)", "ProgramDat
|
|
|
27810
27895
|
var here = () => ({ platform: process.platform, home: os3.homedir(), resolve: realpath });
|
|
27811
27896
|
function refusal(picked, where = here()) {
|
|
27812
27897
|
const win = where.platform === "win32";
|
|
27813
|
-
const p = win ?
|
|
27898
|
+
const p = win ? path9.win32 : path9.posix;
|
|
27814
27899
|
const real = where.resolve(picked);
|
|
27815
|
-
if (!real || !p.isAbsolute(real) || where.resolve === realpath && !
|
|
27900
|
+
if (!real || !p.isAbsolute(real) || where.resolve === realpath && !fs8.statSync(real).isDirectory()) return "missing";
|
|
27816
27901
|
const norm = (d) => {
|
|
27817
27902
|
const n = p.normalize(d).replace(/[\\/]+$/, "") || p.sep;
|
|
27818
27903
|
return win ? n.toLowerCase() : n;
|
|
@@ -27835,16 +27920,16 @@ function refusal(picked, where = here()) {
|
|
|
27835
27920
|
// src/cache.ts
|
|
27836
27921
|
var IDLE_MS = 7 * 24 * 60 * 6e4;
|
|
27837
27922
|
var SWEEP_MS = 24 * 60 * 6e4;
|
|
27838
|
-
var akbDir = (dir) =>
|
|
27839
|
-
var unsentFile = (dir) =>
|
|
27840
|
-
var unsent = (dir) =>
|
|
27923
|
+
var akbDir = (dir) => path10.join(dir, ".akb");
|
|
27924
|
+
var unsentFile = (dir) => path10.join(akbDir(dir), "unsent");
|
|
27925
|
+
var unsent = (dir) => fs9.existsSync(unsentFile(dir));
|
|
27841
27926
|
var holds = /* @__PURE__ */ new Map();
|
|
27842
|
-
var holdsDir = () =>
|
|
27843
|
-
var holdFile = (dir) =>
|
|
27927
|
+
var holdsDir = () => path10.join(runnerHome(), "holds");
|
|
27928
|
+
var holdFile = (dir) => path10.join(holdsDir(), `${crypto5.createHash("sha256").update(dir).digest("hex")}.${process.pid}`);
|
|
27844
27929
|
function paused(dir) {
|
|
27845
27930
|
try {
|
|
27846
|
-
const
|
|
27847
|
-
const held = JSON.parse(
|
|
27931
|
+
const file2 = path10.join(projectStateDir(path10.join(akbDir(dir), "kanban")), SESSIONS_FILE);
|
|
27932
|
+
const held = JSON.parse(fs9.readFileSync(file2, "utf8"));
|
|
27848
27933
|
return (held.deliveries ?? []).some((d) => d.status === "active");
|
|
27849
27934
|
} catch {
|
|
27850
27935
|
return false;
|
|
@@ -27852,14 +27937,14 @@ function paused(dir) {
|
|
|
27852
27937
|
}
|
|
27853
27938
|
function busy(dir) {
|
|
27854
27939
|
if (holds.has(dir)) return true;
|
|
27855
|
-
const prefix =
|
|
27940
|
+
const prefix = path10.basename(holdFile(dir)).split(".")[0] + ".";
|
|
27856
27941
|
try {
|
|
27857
|
-
return
|
|
27942
|
+
return fs9.readdirSync(holdsDir()).filter((file2) => file2.startsWith(prefix)).some((file2) => {
|
|
27858
27943
|
try {
|
|
27859
|
-
process.kill(Number(
|
|
27944
|
+
process.kill(Number(file2.split(".")[1]), 0);
|
|
27860
27945
|
return true;
|
|
27861
27946
|
} catch {
|
|
27862
|
-
|
|
27947
|
+
fs9.rmSync(path10.join(holdsDir(), file2), { force: true });
|
|
27863
27948
|
return false;
|
|
27864
27949
|
}
|
|
27865
27950
|
});
|
|
@@ -27870,19 +27955,19 @@ function busy(dir) {
|
|
|
27870
27955
|
var kept = (dir) => busy(dir) || unsent(dir) || paused(dir);
|
|
27871
27956
|
function clearAkb(dir) {
|
|
27872
27957
|
dir = realpath2(dir);
|
|
27873
|
-
if (kept(dir) ||
|
|
27958
|
+
if (kept(dir) || fs9.existsSync(path10.join(akbDir(dir), "worktrees")) || fs9.existsSync(path10.join(akbDir(dir), "handoffs"))) return false;
|
|
27874
27959
|
let entries;
|
|
27875
27960
|
try {
|
|
27876
|
-
entries =
|
|
27961
|
+
entries = fs9.readdirSync(akbDir(dir));
|
|
27877
27962
|
} catch {
|
|
27878
27963
|
return true;
|
|
27879
27964
|
}
|
|
27880
|
-
for (const name of entries)
|
|
27965
|
+
for (const name of entries) fs9.rmSync(path10.join(akbDir(dir), name), { recursive: true, force: true });
|
|
27881
27966
|
return true;
|
|
27882
27967
|
}
|
|
27883
27968
|
function realpath2(p) {
|
|
27884
27969
|
try {
|
|
27885
|
-
return
|
|
27970
|
+
return fs9.realpathSync(p);
|
|
27886
27971
|
} catch {
|
|
27887
27972
|
return p;
|
|
27888
27973
|
}
|
|
@@ -27890,9 +27975,9 @@ function realpath2(p) {
|
|
|
27890
27975
|
|
|
27891
27976
|
// src/runtimes.ts
|
|
27892
27977
|
import { spawn as spawn4 } from "node:child_process";
|
|
27893
|
-
import
|
|
27978
|
+
import fs15 from "node:fs";
|
|
27894
27979
|
import os5 from "node:os";
|
|
27895
|
-
import
|
|
27980
|
+
import path18 from "node:path";
|
|
27896
27981
|
|
|
27897
27982
|
// ../cli/src/lib/agent/argv.ts
|
|
27898
27983
|
function splitCommand(command) {
|
|
@@ -27929,8 +28014,8 @@ function quoteArg(arg) {
|
|
|
27929
28014
|
|
|
27930
28015
|
// ../cli/src/lib/agent/harnesses/types.ts
|
|
27931
28016
|
import { createHash } from "node:crypto";
|
|
27932
|
-
import
|
|
27933
|
-
import
|
|
28017
|
+
import fs10 from "node:fs";
|
|
28018
|
+
import path11 from "node:path";
|
|
27934
28019
|
var SKILL_SENTENCE = "Use the kanban skill";
|
|
27935
28020
|
function namesFlag(argv, flags) {
|
|
27936
28021
|
return argv.some((tok) => flags.some((flag) => tok === flag || tok.startsWith(`${flag}=`)));
|
|
@@ -27953,14 +28038,14 @@ var MCP_CONFIG = {
|
|
|
27953
28038
|
};
|
|
27954
28039
|
function machineFile(name, text2) {
|
|
27955
28040
|
const suffix = createHash("sha256").update(text2).digest("hex").slice(0, 16);
|
|
27956
|
-
const
|
|
28041
|
+
const file2 = path11.join(machineHome(), "prompts", `${path11.parse(name).name}-${suffix}${path11.extname(name)}`);
|
|
27957
28042
|
try {
|
|
27958
|
-
if (
|
|
28043
|
+
if (fs10.readFileSync(file2, "utf8") === text2) return file2;
|
|
27959
28044
|
} catch {
|
|
27960
28045
|
}
|
|
27961
|
-
|
|
27962
|
-
|
|
27963
|
-
return
|
|
28046
|
+
fs10.mkdirSync(path11.dirname(file2), { recursive: true });
|
|
28047
|
+
fs10.writeFileSync(file2, text2);
|
|
28048
|
+
return file2;
|
|
27964
28049
|
}
|
|
27965
28050
|
|
|
27966
28051
|
// ../cli/src/lib/agent/harnesses/check.ts
|
|
@@ -28041,13 +28126,13 @@ function checkHarnesses(harnesses) {
|
|
|
28041
28126
|
}
|
|
28042
28127
|
|
|
28043
28128
|
// ../cli/src/lib/agent/harnesses/claude-code.ts
|
|
28044
|
-
import
|
|
28129
|
+
import path14 from "node:path";
|
|
28045
28130
|
|
|
28046
28131
|
// ../cli/src/lib/agent/locate.ts
|
|
28047
28132
|
import { spawn as spawn3, spawnSync } from "node:child_process";
|
|
28048
|
-
import
|
|
28133
|
+
import fs11 from "node:fs";
|
|
28049
28134
|
import os4 from "node:os";
|
|
28050
|
-
import
|
|
28135
|
+
import path12 from "node:path";
|
|
28051
28136
|
|
|
28052
28137
|
// ../cli/src/lib/agent/installed.ts
|
|
28053
28138
|
var WINDOWS = process.platform === "win32";
|
|
@@ -28105,7 +28190,7 @@ function pick(copies) {
|
|
|
28105
28190
|
}
|
|
28106
28191
|
function folders(parent) {
|
|
28107
28192
|
try {
|
|
28108
|
-
return
|
|
28193
|
+
return fs11.readdirSync(parent, { withFileTypes: true }).filter((one) => one.isDirectory()).map((one) => one.name);
|
|
28109
28194
|
} catch {
|
|
28110
28195
|
return [];
|
|
28111
28196
|
}
|
|
@@ -28124,29 +28209,29 @@ function byVersion(names) {
|
|
|
28124
28209
|
function latestIn(parent, tail = "") {
|
|
28125
28210
|
let names;
|
|
28126
28211
|
try {
|
|
28127
|
-
names =
|
|
28212
|
+
names = fs11.readdirSync(parent);
|
|
28128
28213
|
} catch {
|
|
28129
28214
|
return [];
|
|
28130
28215
|
}
|
|
28131
|
-
return byVersion(names.filter((name) => !name.startsWith("."))).slice(0, 2).map((name) =>
|
|
28216
|
+
return byVersion(names.filter((name) => !name.startsWith("."))).slice(0, 2).map((name) => path12.join(parent, name, tail));
|
|
28132
28217
|
}
|
|
28133
28218
|
var env = (name) => process.env[name]?.trim() ?? "";
|
|
28134
28219
|
function commonDirs() {
|
|
28135
28220
|
const home3 = os4.homedir();
|
|
28136
|
-
const under = (...parts) =>
|
|
28137
|
-
const nodes = (root, tail = []) => root ? folders(root).map((version) =>
|
|
28221
|
+
const under = (...parts) => path12.join(home3, ...parts);
|
|
28222
|
+
const nodes = (root, tail = []) => root ? folders(root).map((version) => path12.join(root, version, ...tail)) : [];
|
|
28138
28223
|
if (WINDOWS2) {
|
|
28139
28224
|
const [app, local, data, programs] = [env("APPDATA"), env("LOCALAPPDATA"), env("ProgramData"), env("ProgramFiles")];
|
|
28140
28225
|
return [
|
|
28141
28226
|
under(".local", "bin"),
|
|
28142
28227
|
under(".bun", "bin"),
|
|
28143
28228
|
under("scoop", "shims"),
|
|
28144
|
-
...app ? [
|
|
28145
|
-
...local ? [
|
|
28146
|
-
...data ? [
|
|
28147
|
-
...programs ? [
|
|
28229
|
+
...app ? [path12.join(app, "npm")] : [],
|
|
28230
|
+
...local ? [path12.join(local, "pnpm"), path12.join(local, "Volta", "bin"), path12.join(local, "Microsoft", "WinGet", "Links")] : [],
|
|
28231
|
+
...data ? [path12.join(data, "chocolatey", "bin")] : [],
|
|
28232
|
+
...programs ? [path12.join(programs, "nodejs")] : [],
|
|
28148
28233
|
...nodes(env("NVM_HOME")),
|
|
28149
|
-
...app ? nodes(
|
|
28234
|
+
...app ? nodes(path12.join(app, "fnm", "node-versions"), ["installation"]) : []
|
|
28150
28235
|
];
|
|
28151
28236
|
}
|
|
28152
28237
|
const support = process.platform === "darwin" ? under("Library", "Application Support") : under(".local", "share");
|
|
@@ -28163,10 +28248,10 @@ function commonDirs() {
|
|
|
28163
28248
|
...env("PNPM_HOME") ? [env("PNPM_HOME")] : [],
|
|
28164
28249
|
under("Library", "pnpm"),
|
|
28165
28250
|
under(".local", "share", "pnpm"),
|
|
28166
|
-
|
|
28167
|
-
...nodes(
|
|
28168
|
-
...nodes(
|
|
28169
|
-
...nodes(
|
|
28251
|
+
path12.join(env("VOLTA_HOME") || under(".volta"), "bin"),
|
|
28252
|
+
...nodes(path12.join(env("NVM_DIR") || under(".nvm"), "versions", "node"), ["bin"]),
|
|
28253
|
+
...nodes(path12.join(env("FNM_DIR") || path12.join(support, "fnm"), "node-versions"), ["installation", "bin"]),
|
|
28254
|
+
...nodes(path12.join(env("ASDF_DATA_DIR") || under(".asdf"), "installs", "nodejs"), ["bin"]),
|
|
28170
28255
|
...nodes(under(".local", "share", "mise", "installs", "node"), ["bin"]),
|
|
28171
28256
|
...nodes(under(".nodenv", "versions"), ["bin"]),
|
|
28172
28257
|
...nodes("/usr/local/n/versions/node", ["bin"])
|
|
@@ -28174,11 +28259,11 @@ function commonDirs() {
|
|
|
28174
28259
|
}
|
|
28175
28260
|
function onPath(binary) {
|
|
28176
28261
|
const names = WINDOWS2 ? [binary, ...(process.env.PATHEXT || ".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean).map((ext) => `${binary}${ext.toLowerCase()}`)] : [binary];
|
|
28177
|
-
return (process.env.PATH ?? "").split(
|
|
28262
|
+
return (process.env.PATH ?? "").split(path12.delimiter).filter(Boolean).flatMap((dir) => names.map((name) => path12.join(dir, name)));
|
|
28178
28263
|
}
|
|
28179
|
-
var isFile = (
|
|
28264
|
+
var isFile = (file2) => {
|
|
28180
28265
|
try {
|
|
28181
|
-
return
|
|
28266
|
+
return fs11.statSync(file2).isFile();
|
|
28182
28267
|
} catch {
|
|
28183
28268
|
return false;
|
|
28184
28269
|
}
|
|
@@ -28187,73 +28272,73 @@ function copyFiles(harness) {
|
|
|
28187
28272
|
const pinned = harness.pinned?.();
|
|
28188
28273
|
if (pinned && isFile(pinned)) return [{ file: pinned, entry: false }];
|
|
28189
28274
|
const binary = commandBinary(harness.command);
|
|
28190
|
-
const exe = (
|
|
28275
|
+
const exe = (file2) => WINDOWS2 && !path12.extname(file2) ? `${file2}.exe` : file2;
|
|
28191
28276
|
const path_ = onPath(binary).filter(isFile);
|
|
28192
|
-
const elsewhere = process.env.AI4KANBAN_PATH_ONLY ? [] : [...harness.installs?.() ?? [], ...commonDirs().map((dir) =>
|
|
28277
|
+
const elsewhere = process.env.AI4KANBAN_PATH_ONLY ? [] : [...harness.installs?.() ?? [], ...commonDirs().map((dir) => path12.join(dir, binary))];
|
|
28193
28278
|
const others = elsewhere.map(exe).filter(isFile);
|
|
28194
28279
|
const seen = /* @__PURE__ */ new Set();
|
|
28195
|
-
return [...path_, ...others].flatMap((
|
|
28196
|
-
const real =
|
|
28280
|
+
return [...path_, ...others].flatMap((file2, i) => {
|
|
28281
|
+
const real = fs11.realpathSync.native(file2);
|
|
28197
28282
|
if (seen.has(real)) return [];
|
|
28198
28283
|
seen.add(real);
|
|
28199
|
-
return [{ file, entry: i === 0 && path_.length > 0 }];
|
|
28284
|
+
return [{ file: file2, entry: i === 0 && path_.length > 0 }];
|
|
28200
28285
|
});
|
|
28201
28286
|
}
|
|
28202
28287
|
var answers;
|
|
28203
|
-
var answersFile = () =>
|
|
28288
|
+
var answersFile = () => path12.join(machineHome(), "agent-copies.json");
|
|
28204
28289
|
function kept2() {
|
|
28205
28290
|
if (answers) return answers;
|
|
28206
28291
|
try {
|
|
28207
|
-
answers = JSON.parse(
|
|
28292
|
+
answers = JSON.parse(fs11.readFileSync(answersFile(), "utf8"));
|
|
28208
28293
|
} catch {
|
|
28209
28294
|
answers = {};
|
|
28210
28295
|
}
|
|
28211
28296
|
return answers;
|
|
28212
28297
|
}
|
|
28213
|
-
function keep(
|
|
28214
|
-
kept2()[
|
|
28298
|
+
function keep(file2, answer) {
|
|
28299
|
+
kept2()[file2] = answer;
|
|
28215
28300
|
try {
|
|
28216
|
-
|
|
28301
|
+
fs11.mkdirSync(machineHome(), { recursive: true });
|
|
28217
28302
|
const staged = `${answersFile()}.${process.pid}`;
|
|
28218
|
-
|
|
28219
|
-
|
|
28303
|
+
fs11.writeFileSync(staged, JSON.stringify(answers));
|
|
28304
|
+
fs11.renameSync(staged, answersFile());
|
|
28220
28305
|
} catch {
|
|
28221
28306
|
}
|
|
28222
28307
|
}
|
|
28223
|
-
function keyOf(
|
|
28224
|
-
const real =
|
|
28225
|
-
const stat =
|
|
28308
|
+
function keyOf(file2) {
|
|
28309
|
+
const real = fs11.realpathSync.native(file2);
|
|
28310
|
+
const stat = fs11.statSync(real);
|
|
28226
28311
|
return `${real}|${stat.size}|${stat.mtimeMs}`;
|
|
28227
28312
|
}
|
|
28228
|
-
function known(
|
|
28229
|
-
const answer = kept2()[
|
|
28230
|
-
return answer && answer.key === keyOf(
|
|
28313
|
+
function known(file2, maxAge) {
|
|
28314
|
+
const answer = kept2()[file2];
|
|
28315
|
+
return answer && answer.key === keyOf(file2) && Date.now() - answer.at < maxAge ? answer : void 0;
|
|
28231
28316
|
}
|
|
28232
28317
|
function judge(code, status2, stdout, stderr) {
|
|
28233
28318
|
if (code && ["ENOENT", "EACCES", "EPERM", "ENOEXEC", "EINVAL"].includes(code)) return { starts: false, version: null };
|
|
28234
28319
|
if ((status2 === 126 || status2 === 127) && !stdout.trim()) return { starts: false, version: null };
|
|
28235
28320
|
return { starts: true, version: status2 === 0 ? versionIn(stdout) ?? versionIn(stderr) : null };
|
|
28236
28321
|
}
|
|
28237
|
-
function copyEnv(
|
|
28238
|
-
if (!
|
|
28239
|
-
return { ...given, PATH: [
|
|
28322
|
+
function copyEnv(file2, given = process.env) {
|
|
28323
|
+
if (!path12.isAbsolute(file2)) return given;
|
|
28324
|
+
return { ...given, PATH: [path12.dirname(file2), given.PATH].filter(Boolean).join(path12.delimiter) };
|
|
28240
28325
|
}
|
|
28241
|
-
var probeOptions = (
|
|
28242
|
-
function probe(
|
|
28243
|
-
const key = keyOf(
|
|
28244
|
-
const run = spawnSync(
|
|
28326
|
+
var probeOptions = (file2) => ({ cwd: os4.tmpdir(), env: copyEnv(file2), windowsHide: true, shell: false });
|
|
28327
|
+
function probe(file2) {
|
|
28328
|
+
const key = keyOf(file2);
|
|
28329
|
+
const run = spawnSync(file2, ["--version"], { ...probeOptions(file2), stdio: ["ignore", "pipe", "pipe"], timeout: PROBE_MS, encoding: "utf8" });
|
|
28245
28330
|
const code = run.error?.code;
|
|
28246
28331
|
const answer = { key, at: Date.now(), ...judge(code, run.status, run.stdout ?? "", run.stderr ?? "") };
|
|
28247
|
-
keep(
|
|
28332
|
+
keep(file2, answer);
|
|
28248
28333
|
return answer;
|
|
28249
28334
|
}
|
|
28250
|
-
function probeAsync(
|
|
28251
|
-
const key = keyOf(
|
|
28335
|
+
function probeAsync(file2) {
|
|
28336
|
+
const key = keyOf(file2);
|
|
28252
28337
|
return new Promise((resolve2) => {
|
|
28253
28338
|
let [stdout, stderr] = ["", ""];
|
|
28254
|
-
const child = spawn3(
|
|
28339
|
+
const child = spawn3(file2, ["--version"], { ...probeOptions(file2), stdio: ["ignore", "pipe", "pipe"], timeout: PROBE_MS });
|
|
28255
28340
|
const done = (code, status2) => {
|
|
28256
|
-
keep(
|
|
28341
|
+
keep(file2, { key, at: Date.now(), ...judge(code, status2, stdout, stderr) });
|
|
28257
28342
|
resolve2();
|
|
28258
28343
|
};
|
|
28259
28344
|
child.stdout.on("data", (d) => stdout += d);
|
|
@@ -28263,13 +28348,13 @@ function probeAsync(file) {
|
|
|
28263
28348
|
});
|
|
28264
28349
|
}
|
|
28265
28350
|
async function warm(harness) {
|
|
28266
|
-
await Promise.all(copyFiles(harness).filter(({ file }) => !known(
|
|
28351
|
+
await Promise.all(copyFiles(harness).filter(({ file: file2 }) => !known(file2, KEEP_MS)).map(({ file: file2 }) => probeAsync(file2)));
|
|
28267
28352
|
}
|
|
28268
28353
|
function locate(harness, maxAge = KEEP_MS) {
|
|
28269
28354
|
const files = copyFiles(harness);
|
|
28270
|
-
const copies = files.map(({ file, entry: entry2 }) => {
|
|
28271
|
-
const { starts, version } = known(
|
|
28272
|
-
return { file, entry: entry2, starts, version };
|
|
28355
|
+
const copies = files.map(({ file: file2, entry: entry2 }) => {
|
|
28356
|
+
const { starts, version } = known(file2, KEEP_MS) ?? probe(file2);
|
|
28357
|
+
return { file: file2, entry: entry2, starts, version };
|
|
28273
28358
|
});
|
|
28274
28359
|
for (; ; ) {
|
|
28275
28360
|
const best = pick(copies);
|
|
@@ -28732,10 +28817,10 @@ function findRollout(threadId) {
|
|
|
28732
28817
|
}
|
|
28733
28818
|
for (const name of names) {
|
|
28734
28819
|
if (!name.startsWith("rollout-") || !name.endsWith(tail)) continue;
|
|
28735
|
-
const
|
|
28820
|
+
const path23 = join(dir, name);
|
|
28736
28821
|
try {
|
|
28737
|
-
const at = statSync(
|
|
28738
|
-
if (!newest2 || at > newest2.at) newest2 = { path:
|
|
28822
|
+
const at = statSync(path23).mtimeMs;
|
|
28823
|
+
if (!newest2 || at > newest2.at) newest2 = { path: path23, at };
|
|
28739
28824
|
} catch {
|
|
28740
28825
|
}
|
|
28741
28826
|
}
|
|
@@ -28743,11 +28828,11 @@ function findRollout(threadId) {
|
|
|
28743
28828
|
return newest2?.path;
|
|
28744
28829
|
}
|
|
28745
28830
|
function readCodexRunFacts(threadId) {
|
|
28746
|
-
const
|
|
28747
|
-
if (!
|
|
28831
|
+
const path23 = findRollout(threadId);
|
|
28832
|
+
if (!path23) return void 0;
|
|
28748
28833
|
let raw;
|
|
28749
28834
|
try {
|
|
28750
|
-
raw = readFileSync(
|
|
28835
|
+
raw = readFileSync(path23, "utf8");
|
|
28751
28836
|
} catch {
|
|
28752
28837
|
return void 0;
|
|
28753
28838
|
}
|
|
@@ -28855,8 +28940,8 @@ function renderCompleted(item) {
|
|
|
28855
28940
|
const changes = Array.isArray(item.changes) ? item.changes : [];
|
|
28856
28941
|
return changes.map((raw) => {
|
|
28857
28942
|
const change = obj(raw);
|
|
28858
|
-
const
|
|
28859
|
-
return
|
|
28943
|
+
const path23 = str(change.path);
|
|
28944
|
+
return path23 ? `\u23FA ${str(change.kind) || "change"}(${path23})
|
|
28860
28945
|
` : "";
|
|
28861
28946
|
}).join("");
|
|
28862
28947
|
}
|
|
@@ -29107,10 +29192,10 @@ function readKimiRunFacts(sessionId) {
|
|
|
29107
29192
|
const total = { input: 0, cacheCreation: 0, cacheRead: 0, output: 0 };
|
|
29108
29193
|
let model;
|
|
29109
29194
|
let holding = 0;
|
|
29110
|
-
for (const { path:
|
|
29195
|
+
for (const { path: path23, main } of wireFiles(entry2.sessionDir)) {
|
|
29111
29196
|
let raw;
|
|
29112
29197
|
try {
|
|
29113
|
-
raw = readFileSync2(
|
|
29198
|
+
raw = readFileSync2(path23, "utf8");
|
|
29114
29199
|
} catch {
|
|
29115
29200
|
continue;
|
|
29116
29201
|
}
|
|
@@ -29236,7 +29321,7 @@ function createKimiStreamRenderer(cwd) {
|
|
|
29236
29321
|
}
|
|
29237
29322
|
|
|
29238
29323
|
// ../cli/src/lib/agent/wire/acp.ts
|
|
29239
|
-
import
|
|
29324
|
+
import fs12 from "node:fs";
|
|
29240
29325
|
|
|
29241
29326
|
// ../cli/src/lib/agent/wire/rpc.ts
|
|
29242
29327
|
var RpcError = class extends Error {
|
|
@@ -29251,7 +29336,7 @@ function connect(stdout, stdin, onCall, dialect = {}) {
|
|
|
29251
29336
|
let buf = "";
|
|
29252
29337
|
let nextId = 1;
|
|
29253
29338
|
let gone;
|
|
29254
|
-
const
|
|
29339
|
+
const waiting2 = /* @__PURE__ */ new Map();
|
|
29255
29340
|
const send2 = (msg) => {
|
|
29256
29341
|
if (gone) return;
|
|
29257
29342
|
try {
|
|
@@ -29263,8 +29348,8 @@ function connect(stdout, stdin, onCall, dialect = {}) {
|
|
|
29263
29348
|
const closed = (why) => {
|
|
29264
29349
|
if (gone) return;
|
|
29265
29350
|
gone = why;
|
|
29266
|
-
for (const { fail } of
|
|
29267
|
-
|
|
29351
|
+
for (const { fail } of waiting2.values()) fail(new Error(why));
|
|
29352
|
+
waiting2.clear();
|
|
29268
29353
|
};
|
|
29269
29354
|
stdout.on("data", (chunk) => {
|
|
29270
29355
|
buf += chunk.toString();
|
|
@@ -29283,9 +29368,9 @@ function connect(stdout, stdin, onCall, dialect = {}) {
|
|
|
29283
29368
|
continue;
|
|
29284
29369
|
}
|
|
29285
29370
|
if (msg.id === void 0) continue;
|
|
29286
|
-
const pending =
|
|
29371
|
+
const pending = waiting2.get(String(msg.id));
|
|
29287
29372
|
if (!pending) continue;
|
|
29288
|
-
|
|
29373
|
+
waiting2.delete(String(msg.id));
|
|
29289
29374
|
if (msg.error) {
|
|
29290
29375
|
const said = [str(msg.error.message), str(obj(msg.error.data).message)].filter(Boolean).join(": ");
|
|
29291
29376
|
pending.fail(new RpcError(said || `the agent refused (${msg.error.code ?? "no code"})`, msg.error.code));
|
|
@@ -29300,7 +29385,7 @@ function connect(stdout, stdin, onCall, dialect = {}) {
|
|
|
29300
29385
|
if (gone) return Promise.reject(new Error(gone));
|
|
29301
29386
|
const id = dialect.stringIds ? String(nextId++) : nextId++;
|
|
29302
29387
|
return new Promise((ok, fail) => {
|
|
29303
|
-
|
|
29388
|
+
waiting2.set(String(id), { ok, fail });
|
|
29304
29389
|
send2({ id, method, params });
|
|
29305
29390
|
});
|
|
29306
29391
|
},
|
|
@@ -29366,7 +29451,7 @@ function createTail(log) {
|
|
|
29366
29451
|
// ../cli/package.json
|
|
29367
29452
|
var package_default = {
|
|
29368
29453
|
name: "wildcrane",
|
|
29369
|
-
version: "0.11.
|
|
29454
|
+
version: "0.11.25",
|
|
29370
29455
|
akbContract: 7,
|
|
29371
29456
|
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.",
|
|
29372
29457
|
keywords: [
|
|
@@ -29438,8 +29523,8 @@ var CLIENT_CAPABILITIES = {
|
|
|
29438
29523
|
};
|
|
29439
29524
|
function whereHint(update3, title) {
|
|
29440
29525
|
const locations = Array.isArray(update3.locations) ? update3.locations : [];
|
|
29441
|
-
const
|
|
29442
|
-
return
|
|
29526
|
+
const path23 = str(obj(locations[0]).path);
|
|
29527
|
+
return path23 && !title.includes(path23) ? hint(path23) : "";
|
|
29443
29528
|
}
|
|
29444
29529
|
function saidBy(update3) {
|
|
29445
29530
|
const content = Array.isArray(update3.content) ? update3.content : [];
|
|
@@ -29508,8 +29593,8 @@ var STOPPED = {
|
|
|
29508
29593
|
refusal: "the agent refused to continue",
|
|
29509
29594
|
cancelled: "the turn was cancelled"
|
|
29510
29595
|
};
|
|
29511
|
-
function mcpServersIn(
|
|
29512
|
-
const servers = obj(obj(JSON.parse(
|
|
29596
|
+
function mcpServersIn(file2) {
|
|
29597
|
+
const servers = obj(obj(JSON.parse(fs12.readFileSync(file2, "utf8"))).mcpServers);
|
|
29513
29598
|
return Object.entries(servers).map(([name, raw]) => {
|
|
29514
29599
|
const s = obj(raw);
|
|
29515
29600
|
return {
|
|
@@ -29680,7 +29765,7 @@ function decide(params, tail, events) {
|
|
|
29680
29765
|
}
|
|
29681
29766
|
|
|
29682
29767
|
// ../cli/src/lib/agent/wire/zcode.ts
|
|
29683
|
-
import
|
|
29768
|
+
import path13 from "node:path";
|
|
29684
29769
|
function whereHint2(input, title) {
|
|
29685
29770
|
const named = obj(input);
|
|
29686
29771
|
for (const key of ["command", "file_path", "path", "url", "pattern"]) {
|
|
@@ -29846,7 +29931,7 @@ async function oneTurn2(io, options) {
|
|
|
29846
29931
|
{ stringIds: true }
|
|
29847
29932
|
);
|
|
29848
29933
|
try {
|
|
29849
|
-
const workspacePath =
|
|
29934
|
+
const workspacePath = path13.resolve(io.cwd);
|
|
29850
29935
|
const workspace = { workspacePath, workspaceKey: workspacePath };
|
|
29851
29936
|
let opened;
|
|
29852
29937
|
if (io.resumeId) {
|
|
@@ -29909,8 +29994,8 @@ async function tokensOf(rpc, sessionId) {
|
|
|
29909
29994
|
}
|
|
29910
29995
|
async function contextOf(rpc, sessionId) {
|
|
29911
29996
|
try {
|
|
29912
|
-
const
|
|
29913
|
-
const state = obj(
|
|
29997
|
+
const read2 = await rpc.call("session/read", { sessionId, messageLimit: 1 });
|
|
29998
|
+
const state = obj(read2.projection);
|
|
29914
29999
|
const used = num(state.contextUsed);
|
|
29915
30000
|
const limit = num(state.contextWindow);
|
|
29916
30001
|
return used > 0 ? { used, limit: limit > 0 ? limit : void 0 } : void 0;
|
|
@@ -29980,24 +30065,24 @@ function uniqueIds(list) {
|
|
|
29980
30065
|
return [...new Set(list.map((id) => id.trim()).filter(Boolean))];
|
|
29981
30066
|
}
|
|
29982
30067
|
var cached = /* @__PURE__ */ new Map();
|
|
29983
|
-
function modelsIn2(
|
|
30068
|
+
function modelsIn2(file2, pick2, salt = "") {
|
|
29984
30069
|
let stamp;
|
|
29985
30070
|
try {
|
|
29986
|
-
const stat = statSync3(
|
|
30071
|
+
const stat = statSync3(file2);
|
|
29987
30072
|
stamp = `${stat.mtimeMs}:${stat.size}:${salt}`;
|
|
29988
30073
|
} catch {
|
|
29989
|
-
cached.delete(
|
|
30074
|
+
cached.delete(file2);
|
|
29990
30075
|
return [];
|
|
29991
30076
|
}
|
|
29992
|
-
const hit = cached.get(
|
|
30077
|
+
const hit = cached.get(file2);
|
|
29993
30078
|
if (hit?.stamp === stamp) return hit.found;
|
|
29994
30079
|
let found = [];
|
|
29995
30080
|
try {
|
|
29996
|
-
found = uniqueIds(pick2(JSON.parse(readFileSync3(
|
|
30081
|
+
found = uniqueIds(pick2(JSON.parse(readFileSync3(file2, "utf8"))));
|
|
29997
30082
|
} catch {
|
|
29998
30083
|
found = [];
|
|
29999
30084
|
}
|
|
30000
|
-
cached.set(
|
|
30085
|
+
cached.set(file2, { stamp, found });
|
|
30001
30086
|
return found;
|
|
30002
30087
|
}
|
|
30003
30088
|
|
|
@@ -30310,18 +30395,18 @@ var CLAUDE_CODE = {
|
|
|
30310
30395
|
...latestIn(home2(".local", "share", "claude", "versions")),
|
|
30311
30396
|
// The copy Claude Desktop carries.
|
|
30312
30397
|
...latestIn(home2("Library", "Application Support", "Claude", "claude-code")).flatMap(
|
|
30313
|
-
(version) => folders(version).map((build) =>
|
|
30398
|
+
(version) => folders(version).map((build) => path14.join(version, build, "claude.app", "Contents", "MacOS", "claude"))
|
|
30314
30399
|
)
|
|
30315
30400
|
],
|
|
30316
30401
|
install: "npm install -g @anthropic-ai/claude-code"
|
|
30317
30402
|
};
|
|
30318
30403
|
|
|
30319
30404
|
// ../cli/src/lib/agent/harnesses/codex.ts
|
|
30320
|
-
import
|
|
30321
|
-
import
|
|
30405
|
+
import fs13 from "node:fs";
|
|
30406
|
+
import path16 from "node:path";
|
|
30322
30407
|
|
|
30323
30408
|
// ../cli/src/lib/paths.ts
|
|
30324
|
-
import
|
|
30409
|
+
import path15 from "node:path";
|
|
30325
30410
|
var REPO_ROOT = "";
|
|
30326
30411
|
var KANBAN = "";
|
|
30327
30412
|
var TODO = "";
|
|
@@ -30364,60 +30449,60 @@ var SIGNALS_OLD_HANDLED = "";
|
|
|
30364
30449
|
var AKB_DIR = "";
|
|
30365
30450
|
var ROOT_GITIGNORE = "";
|
|
30366
30451
|
function boardLockName(kanban, root) {
|
|
30367
|
-
const from =
|
|
30368
|
-
const name = from && !from.startsWith("..") ? from :
|
|
30369
|
-
return `${name.split(
|
|
30452
|
+
const from = path15.relative(root, kanban);
|
|
30453
|
+
const name = from && !from.startsWith("..") ? from : path15.basename(kanban);
|
|
30454
|
+
return `${name.split(path15.sep).join("-")}.lock`;
|
|
30370
30455
|
}
|
|
30371
30456
|
var BOARD_FLAG = "";
|
|
30372
30457
|
function setBoard(kanban, root, flag) {
|
|
30373
|
-
REPO_ROOT =
|
|
30374
|
-
KANBAN =
|
|
30458
|
+
REPO_ROOT = path15.resolve(root);
|
|
30459
|
+
KANBAN = path15.resolve(kanban);
|
|
30375
30460
|
BOARD_FLAG = flag;
|
|
30376
|
-
TODO =
|
|
30377
|
-
ARCHIVE =
|
|
30378
|
-
ARCHIVE_MD =
|
|
30379
|
-
README =
|
|
30380
|
-
MODULES_MD =
|
|
30381
|
-
CONFIG =
|
|
30382
|
-
KANBAN_GITIGNORE =
|
|
30383
|
-
RELEASES =
|
|
30384
|
-
RELEASE_SUMMARIES =
|
|
30385
|
-
AGENTS =
|
|
30386
|
-
WORKFLOWS =
|
|
30387
|
-
LEGACY_AGENTS =
|
|
30388
|
-
MEMORY =
|
|
30389
|
-
AGENT_MEMORY =
|
|
30390
|
-
PROJECT_MD =
|
|
30391
|
-
LEGACY_UI_CONFIG =
|
|
30392
|
-
LOCAL_CONFIG =
|
|
30393
|
-
ENV_FILE =
|
|
30461
|
+
TODO = path15.join(KANBAN, "todo");
|
|
30462
|
+
ARCHIVE = path15.join(KANBAN, ".archive");
|
|
30463
|
+
ARCHIVE_MD = path15.join(KANBAN, "archive.md");
|
|
30464
|
+
README = path15.join(TODO, "README.md");
|
|
30465
|
+
MODULES_MD = path15.join(KANBAN, "modules.md");
|
|
30466
|
+
CONFIG = path15.join(KANBAN, "config.md");
|
|
30467
|
+
KANBAN_GITIGNORE = path15.join(KANBAN, ".gitignore");
|
|
30468
|
+
RELEASES = path15.join(KANBAN, "releases.md");
|
|
30469
|
+
RELEASE_SUMMARIES = path15.join(KANBAN, ".release-summaries");
|
|
30470
|
+
AGENTS = path15.join(KANBAN, "agents");
|
|
30471
|
+
WORKFLOWS = path15.join(KANBAN, "workflows");
|
|
30472
|
+
LEGACY_AGENTS = path15.join(KANBAN, "skills");
|
|
30473
|
+
MEMORY = path15.join(KANBAN, "memory");
|
|
30474
|
+
AGENT_MEMORY = path15.join(MEMORY, "agents");
|
|
30475
|
+
PROJECT_MD = path15.join(MEMORY, "project.md");
|
|
30476
|
+
LEGACY_UI_CONFIG = path15.join(KANBAN, UI_CONFIG_FILE);
|
|
30477
|
+
LOCAL_CONFIG = path15.join(KANBAN, ".local.json");
|
|
30478
|
+
ENV_FILE = path15.join(KANBAN, ".env");
|
|
30394
30479
|
const machine = projectStateDir(KANBAN, REPO_ROOT);
|
|
30395
30480
|
BOARD_STATE = machine;
|
|
30396
|
-
UI_CONFIG =
|
|
30397
|
-
ASSETS =
|
|
30398
|
-
MOCKUPS =
|
|
30399
|
-
SESSIONS =
|
|
30400
|
-
SESSIONS_DIR =
|
|
30401
|
-
SESSIONS_LOCK2 =
|
|
30402
|
-
INDEX_LOCK2 =
|
|
30403
|
-
DELIVERIES =
|
|
30404
|
-
RULES =
|
|
30405
|
-
PLANS =
|
|
30406
|
-
PLANS_ARCHIVE =
|
|
30407
|
-
TRIAGE =
|
|
30408
|
-
SIGNALS_ARCHIVED =
|
|
30409
|
-
SIGNALS_DISMISSED =
|
|
30410
|
-
SIGNALS_FILES =
|
|
30411
|
-
SIGNALS_OLD_INBOX =
|
|
30412
|
-
SIGNALS_OLD_HANDLED =
|
|
30413
|
-
AKB_DIR =
|
|
30414
|
-
ROOT_GITIGNORE =
|
|
30415
|
-
LOCK =
|
|
30481
|
+
UI_CONFIG = path15.join(machine, UI_CONFIG_FILE);
|
|
30482
|
+
ASSETS = path15.join(machine, ASSETS_FOLDER);
|
|
30483
|
+
MOCKUPS = path15.join(machine, MOCKUPS_FOLDER);
|
|
30484
|
+
SESSIONS = path15.join(machine, SESSIONS_FILE);
|
|
30485
|
+
SESSIONS_DIR = path15.join(machine, SESSIONS_FOLDER);
|
|
30486
|
+
SESSIONS_LOCK2 = path15.join(machine, SESSIONS_LOCK);
|
|
30487
|
+
INDEX_LOCK2 = path15.join(machine, INDEX_LOCK);
|
|
30488
|
+
DELIVERIES = path15.join(KANBAN, "deliveries");
|
|
30489
|
+
RULES = path15.join(KANBAN, "rules");
|
|
30490
|
+
PLANS = path15.join(machine, "plans");
|
|
30491
|
+
PLANS_ARCHIVE = path15.join(PLANS, "archive");
|
|
30492
|
+
TRIAGE = path15.join(KANBAN, "triage");
|
|
30493
|
+
SIGNALS_ARCHIVED = path15.join(TRIAGE, "archived");
|
|
30494
|
+
SIGNALS_DISMISSED = path15.join(TRIAGE, "dismissed");
|
|
30495
|
+
SIGNALS_FILES = path15.join(TRIAGE, "files");
|
|
30496
|
+
SIGNALS_OLD_INBOX = path15.join(TRIAGE, "inbox");
|
|
30497
|
+
SIGNALS_OLD_HANDLED = path15.join(TRIAGE, "handled.md");
|
|
30498
|
+
AKB_DIR = path15.join(REPO_ROOT, ".akb");
|
|
30499
|
+
ROOT_GITIGNORE = path15.join(REPO_ROOT, ".gitignore");
|
|
30500
|
+
LOCK = path15.join(AKB_DIR, boardLockName(KANBAN, REPO_ROOT));
|
|
30416
30501
|
return REPO_ROOT;
|
|
30417
30502
|
}
|
|
30418
30503
|
function setBoardRoot(root, named = false) {
|
|
30419
|
-
const project =
|
|
30420
|
-
return setBoard(
|
|
30504
|
+
const project = path15.resolve(root);
|
|
30505
|
+
return setBoard(path15.join(project, "docs", "kanban"), project, named ? ` --dir ${project}` : "");
|
|
30421
30506
|
}
|
|
30422
30507
|
setBoardRoot(process.cwd());
|
|
30423
30508
|
|
|
@@ -30466,10 +30551,10 @@ function codexExtraArgs(argv, cwd = REPO_ROOT) {
|
|
|
30466
30551
|
}
|
|
30467
30552
|
const flags = [...argv, ...extra];
|
|
30468
30553
|
const workspaceWrite = flags.some((arg, i) => arg === "--full-auto" || arg === "--sandbox=workspace-write" || (arg === "--sandbox" || arg === "-s") && flags[i + 1] === "workspace-write");
|
|
30469
|
-
if (workspaceWrite &&
|
|
30554
|
+
if (workspaceWrite && path16.resolve(cwd) !== path16.resolve(REPO_ROOT)) {
|
|
30470
30555
|
for (const dir of [KANBAN, AKB_DIR]) {
|
|
30471
|
-
const relative =
|
|
30472
|
-
if (relative === ".." || relative.startsWith(`..${
|
|
30556
|
+
const relative = path16.relative(cwd, dir);
|
|
30557
|
+
if (relative === ".." || relative.startsWith(`..${path16.sep}`) || path16.isAbsolute(relative)) {
|
|
30473
30558
|
extra.push("--add-dir", dir);
|
|
30474
30559
|
}
|
|
30475
30560
|
}
|
|
@@ -30490,9 +30575,9 @@ function codexProvider(id, name, baseUrl) {
|
|
|
30490
30575
|
function envRoot(name) {
|
|
30491
30576
|
return process.env[name]?.trim() ?? "";
|
|
30492
30577
|
}
|
|
30493
|
-
function modified(
|
|
30578
|
+
function modified(file2) {
|
|
30494
30579
|
try {
|
|
30495
|
-
return
|
|
30580
|
+
return fs13.statSync(file2).mtimeMs;
|
|
30496
30581
|
} catch {
|
|
30497
30582
|
return 0;
|
|
30498
30583
|
}
|
|
@@ -30501,7 +30586,7 @@ function byPath(a, b) {
|
|
|
30501
30586
|
return a < b ? -1 : a > b ? 1 : 0;
|
|
30502
30587
|
}
|
|
30503
30588
|
function byNewest(files) {
|
|
30504
|
-
return files.map((
|
|
30589
|
+
return files.map((file2) => ({ file: file2, at: modified(file2) })).sort((a, b) => b.at - a.at || byPath(a.file, b.file)).map((one) => one.file);
|
|
30505
30590
|
}
|
|
30506
30591
|
var ARCHES = ["x86_64", "aarch64", "i686", "x64", "arm64", "x86"];
|
|
30507
30592
|
function ourArches() {
|
|
@@ -30518,28 +30603,28 @@ function codexOnWindows() {
|
|
|
30518
30603
|
const local = envRoot("LOCALAPPDATA");
|
|
30519
30604
|
const profile = envRoot("USERPROFILE");
|
|
30520
30605
|
const programs = envRoot("ProgramFiles");
|
|
30521
|
-
const cache = local ?
|
|
30522
|
-
const releases = profile ?
|
|
30523
|
-
const packages = programs ?
|
|
30606
|
+
const cache = local ? path16.join(local, "OpenAI", "Codex", "bin") : "";
|
|
30607
|
+
const releases = profile ? path16.join(profile, ".codex", "packages", "standalone", "releases") : "";
|
|
30608
|
+
const packages = programs ? path16.join(programs, "WindowsApps") : "";
|
|
30524
30609
|
return [
|
|
30525
30610
|
// Desktop's relocated CLI cache: a folder per build hash, newest file first.
|
|
30526
|
-
...byNewest(folders(cache).map((name) =>
|
|
30611
|
+
...byNewest(folders(cache).map((name) => path16.join(cache, name, "codex.exe"))),
|
|
30527
30612
|
// The separate standalone launcher, at a path with nothing variable in it.
|
|
30528
|
-
...local ? [
|
|
30613
|
+
...local ? [path16.join(local, "Programs", "OpenAI", "Codex", "bin", "codex.exe")] : [],
|
|
30529
30614
|
// That launcher's release payload: a folder per version and target.
|
|
30530
30615
|
...byVersion(folders(releases).filter(ourArch)).map(
|
|
30531
|
-
(name) =>
|
|
30616
|
+
(name) => path16.join(releases, name, "bin", "codex.exe")
|
|
30532
30617
|
),
|
|
30533
30618
|
// Desktop's own MSIX package.
|
|
30534
30619
|
...byVersion(folders(packages).filter((name) => name.startsWith("OpenAI.Codex_")).filter(ourArch)).map(
|
|
30535
|
-
(name) =>
|
|
30620
|
+
(name) => path16.join(packages, name, "app", "resources", "codex.exe")
|
|
30536
30621
|
)
|
|
30537
30622
|
];
|
|
30538
30623
|
}
|
|
30539
30624
|
function codexInstalls() {
|
|
30540
30625
|
const chosen = process.env.CODEX_INSTALL_DIR?.trim();
|
|
30541
30626
|
return [
|
|
30542
|
-
...chosen ? [
|
|
30627
|
+
...chosen ? [path16.join(chosen, "codex")] : [],
|
|
30543
30628
|
...process.platform === "win32" ? codexOnWindows() : [
|
|
30544
30629
|
// macOS, where Codex now lives in the merged app — `codex-cli/bin/` since 26.928…
|
|
30545
30630
|
"/Applications/ChatGPT.app/Contents/Resources/codex-cli/bin/codex",
|
|
@@ -30584,7 +30669,7 @@ var CODEX = {
|
|
|
30584
30669
|
systemPrompt(text2, argv) {
|
|
30585
30670
|
if (namesFlag(argv, ["developer_instructions", "model_instructions_file"])) return {};
|
|
30586
30671
|
try {
|
|
30587
|
-
const config =
|
|
30672
|
+
const config = fs13.readFileSync(path16.join(process.env.CODEX_HOME || home2(".codex"), "config.toml"), "utf8");
|
|
30588
30673
|
if (/^\s*(?:developer_instructions|model_instructions_file)\s*=/m.test(config)) return {};
|
|
30589
30674
|
} catch {
|
|
30590
30675
|
}
|
|
@@ -30751,7 +30836,7 @@ var CODEX = {
|
|
|
30751
30836
|
// not a style choice: on `codex exec` the flag is `--image <FILE>...`, and spelt as two
|
|
30752
30837
|
// tokens it would swallow the prompt that follows it as a second file — Codex would then
|
|
30753
30838
|
// read the prompt from a stdin the board never opens and send an empty turn.
|
|
30754
|
-
images: { as: "args", args: (
|
|
30839
|
+
images: { as: "args", args: (file2) => [`--image=${file2}`] },
|
|
30755
30840
|
// Codex ignores a slash name — it reads as plain chat text — and triggers a skill from a
|
|
30756
30841
|
// `$` name. The install already writes the skill to `.agents/skills/kanban/`, which is
|
|
30757
30842
|
// where Codex looks.
|
|
@@ -30830,22 +30915,22 @@ var CURSOR = {
|
|
|
30830
30915
|
};
|
|
30831
30916
|
|
|
30832
30917
|
// ../cli/src/lib/agent/harnesses/dsh.ts
|
|
30833
|
-
import
|
|
30834
|
-
import
|
|
30918
|
+
import fs14 from "node:fs";
|
|
30919
|
+
import path17 from "node:path";
|
|
30835
30920
|
function dshHome(argv) {
|
|
30836
30921
|
const binary = argv[0];
|
|
30837
30922
|
if (!binary) return void 0;
|
|
30838
|
-
const candidates2 = binary.includes("/") || binary.includes("\\") ? [binary] : (process.env.PATH ?? "").split(
|
|
30923
|
+
const candidates2 = binary.includes("/") || binary.includes("\\") ? [binary] : (process.env.PATH ?? "").split(path17.delimiter).filter(Boolean).map((dir2) => path17.join(dir2, binary));
|
|
30839
30924
|
let dir;
|
|
30840
30925
|
try {
|
|
30841
|
-
const found = candidates2.find((candidate) =>
|
|
30926
|
+
const found = candidates2.find((candidate) => fs14.existsSync(candidate));
|
|
30842
30927
|
if (!found) return void 0;
|
|
30843
|
-
dir =
|
|
30928
|
+
dir = path17.dirname(fs14.realpathSync(found));
|
|
30844
30929
|
} catch {
|
|
30845
30930
|
return void 0;
|
|
30846
30931
|
}
|
|
30847
|
-
for (let up =
|
|
30848
|
-
if (
|
|
30932
|
+
for (let up = path17.dirname(dir); dir !== up; up = path17.dirname(dir)) {
|
|
30933
|
+
if (fs14.existsSync(path17.join(dir, "package.json"))) return dir;
|
|
30849
30934
|
dir = up;
|
|
30850
30935
|
}
|
|
30851
30936
|
return void 0;
|
|
@@ -31074,7 +31159,7 @@ var KIMI = {
|
|
|
31074
31159
|
// a resumed one keeps the agent it opened with, and Kimi refuses the flag beside `--session`.
|
|
31075
31160
|
systemPrompt(text2, argv) {
|
|
31076
31161
|
if (namesFlag(argv, ["--session", "-S", "--resume", "-r", "--continue", "-C", "--agent", "--agent-file"])) return {};
|
|
31077
|
-
const
|
|
31162
|
+
const file2 = machineFile("kimi-language.md", `---
|
|
31078
31163
|
name: akb-language
|
|
31079
31164
|
description: Kimi's default agent, told which language to write in
|
|
31080
31165
|
---
|
|
@@ -31083,7 +31168,7 @@ description: Kimi's default agent, told which language to write in
|
|
|
31083
31168
|
|
|
31084
31169
|
${text2}
|
|
31085
31170
|
`);
|
|
31086
|
-
return { args: ["--agent-file",
|
|
31171
|
+
return { args: ["--agent-file", file2] };
|
|
31087
31172
|
},
|
|
31088
31173
|
// What Kimi takes: who pays for the run and where it goes, then the model. The provider
|
|
31089
31174
|
// comes first because it decides the rest.
|
|
@@ -31303,14 +31388,14 @@ var OPENCODE = {
|
|
|
31303
31388
|
// `instructions` files join the system prompt, and OpenCode adds this config's list to the
|
|
31304
31389
|
// user's own rather than replacing it.
|
|
31305
31390
|
systemPrompt(text2, _argv, env2) {
|
|
31306
|
-
const
|
|
31391
|
+
const file2 = machineFile("opencode-language.md", `${text2}
|
|
31307
31392
|
`);
|
|
31308
31393
|
let own2 = {};
|
|
31309
31394
|
try {
|
|
31310
31395
|
own2 = obj2(JSON.parse(env2.OPENCODE_CONFIG_CONTENT ?? "{}"));
|
|
31311
31396
|
} catch {
|
|
31312
31397
|
}
|
|
31313
|
-
const instructions = [...Array.isArray(own2.instructions) ? own2.instructions : [],
|
|
31398
|
+
const instructions = [...Array.isArray(own2.instructions) ? own2.instructions : [], file2];
|
|
31314
31399
|
return { env: { OPENCODE_CONFIG_CONTENT: JSON.stringify({ ...own2, instructions }) } };
|
|
31315
31400
|
},
|
|
31316
31401
|
// All four come out of the conversation (agent/wire/acp.ts). A blank cost is a real answer:
|
|
@@ -31491,14 +31576,14 @@ var listed = (harness) => async () => (harness.models?.() ?? []).map((id) => ({
|
|
|
31491
31576
|
var readModels = (name) => (MODELS[name] ?? listed(HARNESSES2[name]))().catch(() => []);
|
|
31492
31577
|
var MODELS = {
|
|
31493
31578
|
"claude-code": async () => {
|
|
31494
|
-
const cached2 = claudeModels(
|
|
31579
|
+
const cached2 = claudeModels(path18.join(process.env.CLAUDE_CONFIG_DIR || path18.join(os5.homedir(), ".claude"), "cache", "model-catalog"));
|
|
31495
31580
|
return cached2.length ? cached2 : [
|
|
31496
31581
|
{ id: "opus", name: "Opus" },
|
|
31497
31582
|
{ id: "sonnet", name: "Sonnet" },
|
|
31498
31583
|
{ id: "haiku", name: "Haiku" }
|
|
31499
31584
|
];
|
|
31500
31585
|
},
|
|
31501
|
-
codex: async () => codexModels(
|
|
31586
|
+
codex: async () => codexModels(path18.join(process.env.CODEX_HOME || path18.join(os5.homedir(), ".codex"), "models_cache.json")),
|
|
31502
31587
|
opencode: async () => opencodeModels(await output(commandOf(HARNESSES2.opencode)[0], ["models"])),
|
|
31503
31588
|
cursor: () => cursorModels()
|
|
31504
31589
|
};
|
|
@@ -31550,9 +31635,9 @@ function output(command, args) {
|
|
|
31550
31635
|
});
|
|
31551
31636
|
});
|
|
31552
31637
|
}
|
|
31553
|
-
function codexModels(
|
|
31638
|
+
function codexModels(file2) {
|
|
31554
31639
|
try {
|
|
31555
|
-
const cache = JSON.parse(
|
|
31640
|
+
const cache = JSON.parse(fs15.readFileSync(file2, "utf8"));
|
|
31556
31641
|
if (!Array.isArray(cache.models)) return [];
|
|
31557
31642
|
return cache.models.flatMap(
|
|
31558
31643
|
(m) => m.visibility === "list" && typeof m.slug === "string" && m.slug ? [{ id: m.slug, name: typeof m.display_name === "string" && m.display_name ? m.display_name : m.slug }] : []
|
|
@@ -31564,13 +31649,13 @@ function codexModels(file) {
|
|
|
31564
31649
|
function claudeModels(dir) {
|
|
31565
31650
|
let files;
|
|
31566
31651
|
try {
|
|
31567
|
-
files =
|
|
31652
|
+
files = fs15.readdirSync(dir).filter((f) => f.endsWith(".json"));
|
|
31568
31653
|
} catch {
|
|
31569
31654
|
return [];
|
|
31570
31655
|
}
|
|
31571
31656
|
const catalogs = files.flatMap((f) => {
|
|
31572
31657
|
try {
|
|
31573
|
-
const data = obj(JSON.parse(
|
|
31658
|
+
const data = obj(JSON.parse(fs15.readFileSync(path18.join(dir, f), "utf8")));
|
|
31574
31659
|
const catalog = obj(data.catalog);
|
|
31575
31660
|
const surface = str(catalog.surface);
|
|
31576
31661
|
return surface === "cc" || surface === "ccd" ? [{ surface, at: Number(data.fetchedAt) || 0, config: obj(catalog.config) }] : [];
|
|
@@ -31612,13 +31697,13 @@ function probeLogin(binary, harness) {
|
|
|
31612
31697
|
}
|
|
31613
31698
|
|
|
31614
31699
|
// src/lock.ts
|
|
31615
|
-
import
|
|
31700
|
+
import crypto6 from "node:crypto";
|
|
31616
31701
|
import net from "node:net";
|
|
31617
|
-
import
|
|
31702
|
+
import path19 from "node:path";
|
|
31618
31703
|
function lockPath() {
|
|
31619
31704
|
const home3 = runnerHome();
|
|
31620
|
-
if (process.platform === "win32") return `\\\\.\\pipe\\wildcrane-${
|
|
31621
|
-
return
|
|
31705
|
+
if (process.platform === "win32") return `\\\\.\\pipe\\wildcrane-${crypto6.createHash("sha256").update(home3).digest("hex").slice(0, 16)}`;
|
|
31706
|
+
return path19.join(home3, "runner.sock");
|
|
31622
31707
|
}
|
|
31623
31708
|
function runnerSettingsSupport() {
|
|
31624
31709
|
return new Promise((resolve2) => {
|
|
@@ -31648,31 +31733,31 @@ function runnerSettingsSupport() {
|
|
|
31648
31733
|
|
|
31649
31734
|
// src/signin.ts
|
|
31650
31735
|
import { spawn as spawn5 } from "node:child_process";
|
|
31651
|
-
import
|
|
31736
|
+
import crypto7 from "node:crypto";
|
|
31652
31737
|
import http2 from "node:http";
|
|
31653
31738
|
|
|
31654
31739
|
// src/settings-control.ts
|
|
31655
|
-
import
|
|
31656
|
-
import
|
|
31657
|
-
var directory = () =>
|
|
31658
|
-
var epochFile = () =>
|
|
31740
|
+
import fs16 from "node:fs";
|
|
31741
|
+
import path20 from "node:path";
|
|
31742
|
+
var directory = () => path20.join(runnerHome(), "executors");
|
|
31743
|
+
var epochFile = () => path20.join(runnerHome(), "account-generation");
|
|
31659
31744
|
function accountGeneration() {
|
|
31660
31745
|
try {
|
|
31661
|
-
return
|
|
31746
|
+
return fs16.readFileSync(epochFile(), "utf8");
|
|
31662
31747
|
} catch {
|
|
31663
31748
|
return "";
|
|
31664
31749
|
}
|
|
31665
31750
|
}
|
|
31666
31751
|
async function stopExecutors() {
|
|
31667
|
-
|
|
31668
|
-
|
|
31752
|
+
fs16.mkdirSync(runnerHome(), { recursive: true, mode: 448 });
|
|
31753
|
+
fs16.writeFileSync(epochFile(), `${Date.now()}-${process.pid}`, { mode: 384 });
|
|
31669
31754
|
for (let n = 0; n < 160; n++) {
|
|
31670
|
-
const active =
|
|
31755
|
+
const active = fs16.existsSync(directory()) ? fs16.readdirSync(directory()).filter((name) => {
|
|
31671
31756
|
try {
|
|
31672
31757
|
process.kill(Number(name.split(".")[0]), 0);
|
|
31673
31758
|
return true;
|
|
31674
31759
|
} catch {
|
|
31675
|
-
|
|
31760
|
+
fs16.rmSync(path20.join(directory(), name), { force: true });
|
|
31676
31761
|
return false;
|
|
31677
31762
|
}
|
|
31678
31763
|
}) : [];
|
|
@@ -31707,8 +31792,8 @@ var PAGE = (outcome, lang) => {
|
|
|
31707
31792
|
};
|
|
31708
31793
|
async function signIn(options = {}) {
|
|
31709
31794
|
const generation = accountGeneration();
|
|
31710
|
-
const verifier = base64url(
|
|
31711
|
-
const challenge = base64url(
|
|
31795
|
+
const verifier = base64url(crypto7.randomBytes(32));
|
|
31796
|
+
const challenge = base64url(crypto7.createHash("sha256").update(verifier).digest());
|
|
31712
31797
|
let finish = () => {
|
|
31713
31798
|
};
|
|
31714
31799
|
const answered = new Promise((resolve2) => finish = resolve2);
|
|
@@ -31789,8 +31874,8 @@ var stopping = false;
|
|
|
31789
31874
|
var callback = () => {
|
|
31790
31875
|
};
|
|
31791
31876
|
var notify = () => {
|
|
31792
|
-
|
|
31793
|
-
|
|
31877
|
+
fs17.mkdirSync(runnerHome(), { recursive: true, mode: 448 });
|
|
31878
|
+
fs17.writeFileSync(path21.join(runnerHome(), "settings-refresh"), crypto8.randomUUID(), { mode: 384 });
|
|
31794
31879
|
callback();
|
|
31795
31880
|
};
|
|
31796
31881
|
var onSettingsChange = (next) => {
|
|
@@ -31832,7 +31917,7 @@ async function folderOf(cwd) {
|
|
|
31832
31917
|
if (!list.ok) return { ...failure(list), folders: [], folder: null };
|
|
31833
31918
|
const real = (dir) => {
|
|
31834
31919
|
try {
|
|
31835
|
-
return
|
|
31920
|
+
return fs17.realpathSync(dir);
|
|
31836
31921
|
} catch {
|
|
31837
31922
|
return dir;
|
|
31838
31923
|
}
|
|
@@ -31845,13 +31930,13 @@ async function addFolder2(dir, bind, strict = false) {
|
|
|
31845
31930
|
const subject = readSession().subject;
|
|
31846
31931
|
const why = refusal(dir);
|
|
31847
31932
|
if (why) return { error: why };
|
|
31848
|
-
const real =
|
|
31933
|
+
const real = fs17.realpathSync(dir);
|
|
31849
31934
|
const found = await folderOf(real);
|
|
31850
31935
|
if ("error" in found) return found;
|
|
31851
31936
|
let project = found.folder?.project;
|
|
31852
31937
|
if (found.folder && (bind ? bind !== project : strict)) return { error: "folder_taken", message: "taken", name: found.folder.name };
|
|
31853
31938
|
if (!project) {
|
|
31854
|
-
const added = await addFolder(machineId(),
|
|
31939
|
+
const added = await addFolder(machineId(), path21.basename(real) || real, real, bind);
|
|
31855
31940
|
if (!added.ok) return failure(added);
|
|
31856
31941
|
project = added.value.folder.project;
|
|
31857
31942
|
}
|
|
@@ -31905,7 +31990,7 @@ async function all(route) {
|
|
|
31905
31990
|
async function settingsState(context) {
|
|
31906
31991
|
adoptLegacy();
|
|
31907
31992
|
const session = readSession();
|
|
31908
|
-
const base = { machine: machineName(), machineId: machineId(), signedIn: !!session, signing, context };
|
|
31993
|
+
const base = { machine: machineName(), machineId: machineId(), signedIn: !!session, signing, context, acceptAlphaUpdates: acceptAlphaUpdates() };
|
|
31909
31994
|
if (await runnerSettingsSupport() === false) return { ...base, upgrade: true };
|
|
31910
31995
|
if (!session) return base;
|
|
31911
31996
|
const account = { id: session.subject, name: session.name ?? session.handle, email: session.email };
|
|
@@ -31929,7 +32014,7 @@ async function settingsState(context) {
|
|
|
31929
32014
|
account,
|
|
31930
32015
|
connected: runner.ok && runner.value.runner?.connected,
|
|
31931
32016
|
workspaces: workspaces.value,
|
|
31932
|
-
projects: folders2.value.folders.map((f) => ({ ...f, ...metadata(f.project), busy: kept(f.path), missing: !
|
|
32017
|
+
projects: folders2.value.folders.map((f) => ({ ...f, ...metadata(f.project), busy: kept(f.path), missing: !fs17.existsSync(f.path) })),
|
|
31933
32018
|
elsewhere: projects.filter((p) => !p.general && !folders2.value.folders.some((f) => f.project === p.id)).map((p) => ({ project: p.id, name: p.name, ...metadata(p.id) })),
|
|
31934
32019
|
...context.project && !projects.some((p) => p.id === context.project) ? { error: "not_found" } : {}
|
|
31935
32020
|
};
|
|
@@ -31937,6 +32022,15 @@ async function settingsState(context) {
|
|
|
31937
32022
|
var selected = /* @__PURE__ */ new WeakMap();
|
|
31938
32023
|
async function settingsAction(action, body, context) {
|
|
31939
32024
|
if (action === "state") return settingsState(context);
|
|
32025
|
+
if (action === "updates") {
|
|
32026
|
+
if (typeof body.acceptAlphaUpdates !== "boolean") return { error: "bad_request" };
|
|
32027
|
+
try {
|
|
32028
|
+
saveAlphaUpdates(body.acceptAlphaUpdates);
|
|
32029
|
+
return { acceptAlphaUpdates: acceptAlphaUpdates() };
|
|
32030
|
+
} catch {
|
|
32031
|
+
return { error: "preferences_write", acceptAlphaUpdates: acceptAlphaUpdates() };
|
|
32032
|
+
}
|
|
32033
|
+
}
|
|
31940
32034
|
if (action === "signIn") {
|
|
31941
32035
|
startSignIn();
|
|
31942
32036
|
return { signing };
|
|
@@ -31952,9 +32046,9 @@ async function settingsAction(action, body, context) {
|
|
|
31952
32046
|
if (!dir) return { cancelled: true };
|
|
31953
32047
|
const why = refusal(dir);
|
|
31954
32048
|
if (why) return { error: why };
|
|
31955
|
-
const real =
|
|
32049
|
+
const real = fs17.realpathSync(dir);
|
|
31956
32050
|
selected.set(context, { path: real, subject: readSession().subject });
|
|
31957
|
-
return { path: real, name:
|
|
32051
|
+
return { path: real, name: path21.basename(real) };
|
|
31958
32052
|
} catch {
|
|
31959
32053
|
return { error: "picker_unavailable" };
|
|
31960
32054
|
}
|
|
@@ -31981,7 +32075,7 @@ async function settingsAction(action, body, context) {
|
|
|
31981
32075
|
if ("error" in found) return found;
|
|
31982
32076
|
if (found.folder) return { error: "folder_taken" };
|
|
31983
32077
|
if (choice.subject !== readSession()?.subject) return { error: "signed_out" };
|
|
31984
|
-
if (!choice.creation || choice.creation.name !== name || choice.creation.workspace !== body.workspace) choice.creation = { key:
|
|
32078
|
+
if (!choice.creation || choice.creation.name !== name || choice.creation.workspace !== body.workspace) choice.creation = { key: crypto8.randomUUID(), name, workspace: body.workspace };
|
|
31985
32079
|
const created = choice.creation.project ? { ok: true, value: { id: choice.creation.project } } : await createProject(name, body.workspace, choice.creation.key);
|
|
31986
32080
|
if (!created.ok) return failure(created);
|
|
31987
32081
|
project = created.value.id;
|
|
@@ -32028,7 +32122,7 @@ async function terminalSettings(entry2) {
|
|
|
32028
32122
|
|
|
32029
32123
|
// src/launcher-main.ts
|
|
32030
32124
|
useRunnerHome();
|
|
32031
|
-
var entry =
|
|
32125
|
+
var entry = path22.join(path22.dirname(fileURLToPath(import.meta.url)), "runner.mjs");
|
|
32032
32126
|
if (process.argv.includes("--settings")) {
|
|
32033
32127
|
terminalSettings(entry).catch(() => {
|
|
32034
32128
|
process.stderr.write("\u65E0\u6CD5\u6253\u5F00\u672C\u673A\u8BBE\u7F6E\uFF0C\u8BF7\u91CD\u8BD5\u3002\n");
|