wildcrane-runner 0.6.104 → 0.6.105
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/akb/dist/kanban.mjs +262 -110
- package/dist/akb/package.json +1 -1
- package/dist/akb-proxy.mjs +1 -1
- package/dist/codex-proxy.mjs +356 -219
- package/dist/codex-retained.mjs +145 -51
- package/dist/flow-worker-main.mjs +924 -783
- package/dist/launcher.mjs +4 -4
- package/dist/plugin.mjs +4 -4
- package/dist/runner.mjs +847 -661
- package/dist/settings.mjs +4 -4
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// wildcrane-runner 0.6.
|
|
1
|
+
// wildcrane-runner 0.6.105 — 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;
|
|
@@ -1159,14 +1159,14 @@ var require_util = __commonJS({
|
|
|
1159
1159
|
}
|
|
1160
1160
|
const port = url2.port != null ? url2.port : url2.protocol === "https:" ? 443 : 80;
|
|
1161
1161
|
let origin = url2.origin != null ? url2.origin : `${url2.protocol || ""}//${url2.hostname || ""}:${port}`;
|
|
1162
|
-
let
|
|
1162
|
+
let path56 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
|
|
1163
1163
|
if (origin[origin.length - 1] === "/") {
|
|
1164
1164
|
origin = origin.slice(0, origin.length - 1);
|
|
1165
1165
|
}
|
|
1166
|
-
if (
|
|
1167
|
-
|
|
1166
|
+
if (path56 && path56[0] !== "/") {
|
|
1167
|
+
path56 = `/${path56}`;
|
|
1168
1168
|
}
|
|
1169
|
-
return new URL(`${origin}${
|
|
1169
|
+
return new URL(`${origin}${path56}`);
|
|
1170
1170
|
}
|
|
1171
1171
|
if (!isHttpOrHttpsPrefixed(url2.origin || url2.protocol)) {
|
|
1172
1172
|
throw new InvalidArgumentError("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
@@ -2001,9 +2001,9 @@ var require_diagnostics = __commonJS({
|
|
|
2001
2001
|
"undici:client:sendHeaders",
|
|
2002
2002
|
(evt) => {
|
|
2003
2003
|
const {
|
|
2004
|
-
request: { method, path:
|
|
2004
|
+
request: { method, path: path56, origin }
|
|
2005
2005
|
} = evt;
|
|
2006
|
-
debugLog("sending request to %s %s%s", method, origin,
|
|
2006
|
+
debugLog("sending request to %s %s%s", method, origin, path56);
|
|
2007
2007
|
}
|
|
2008
2008
|
);
|
|
2009
2009
|
}
|
|
@@ -2021,14 +2021,14 @@ var require_diagnostics = __commonJS({
|
|
|
2021
2021
|
"undici:request:headers",
|
|
2022
2022
|
(evt) => {
|
|
2023
2023
|
const {
|
|
2024
|
-
request: { method, path:
|
|
2024
|
+
request: { method, path: path56, origin },
|
|
2025
2025
|
response: { statusCode }
|
|
2026
2026
|
} = evt;
|
|
2027
2027
|
debugLog(
|
|
2028
2028
|
"received response to %s %s%s - HTTP %d",
|
|
2029
2029
|
method,
|
|
2030
2030
|
origin,
|
|
2031
|
-
|
|
2031
|
+
path56,
|
|
2032
2032
|
statusCode
|
|
2033
2033
|
);
|
|
2034
2034
|
}
|
|
@@ -2037,23 +2037,23 @@ var require_diagnostics = __commonJS({
|
|
|
2037
2037
|
"undici:request:trailers",
|
|
2038
2038
|
(evt) => {
|
|
2039
2039
|
const {
|
|
2040
|
-
request: { method, path:
|
|
2040
|
+
request: { method, path: path56, origin }
|
|
2041
2041
|
} = evt;
|
|
2042
|
-
debugLog("trailers received from %s %s%s", method, origin,
|
|
2042
|
+
debugLog("trailers received from %s %s%s", method, origin, path56);
|
|
2043
2043
|
}
|
|
2044
2044
|
);
|
|
2045
2045
|
diagnosticsChannel.subscribe(
|
|
2046
2046
|
"undici:request:error",
|
|
2047
2047
|
(evt) => {
|
|
2048
2048
|
const {
|
|
2049
|
-
request: { method, path:
|
|
2049
|
+
request: { method, path: path56, origin },
|
|
2050
2050
|
error: error62
|
|
2051
2051
|
} = evt;
|
|
2052
2052
|
debugLog(
|
|
2053
2053
|
"request to %s %s%s errored - %s",
|
|
2054
2054
|
method,
|
|
2055
2055
|
origin,
|
|
2056
|
-
|
|
2056
|
+
path56,
|
|
2057
2057
|
error62.message
|
|
2058
2058
|
);
|
|
2059
2059
|
}
|
|
@@ -2168,7 +2168,7 @@ var require_request = __commonJS({
|
|
|
2168
2168
|
var kHandler = /* @__PURE__ */ Symbol("handler");
|
|
2169
2169
|
var Request = class {
|
|
2170
2170
|
constructor(origin, {
|
|
2171
|
-
path:
|
|
2171
|
+
path: path56,
|
|
2172
2172
|
method,
|
|
2173
2173
|
body,
|
|
2174
2174
|
headers,
|
|
@@ -2185,11 +2185,11 @@ var require_request = __commonJS({
|
|
|
2185
2185
|
maxRedirections,
|
|
2186
2186
|
typeOfService
|
|
2187
2187
|
}, handler) {
|
|
2188
|
-
if (typeof
|
|
2188
|
+
if (typeof path56 !== "string") {
|
|
2189
2189
|
throw new InvalidArgumentError("path must be a string");
|
|
2190
|
-
} else if (
|
|
2190
|
+
} else if (path56[0] !== "/" && !(path56.startsWith("http://") || path56.startsWith("https://")) && method !== "CONNECT") {
|
|
2191
2191
|
throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
|
|
2192
|
-
} else if (invalidPathRegex.test(
|
|
2192
|
+
} else if (invalidPathRegex.test(path56)) {
|
|
2193
2193
|
throw new InvalidArgumentError("invalid request path");
|
|
2194
2194
|
}
|
|
2195
2195
|
if (typeof method !== "string") {
|
|
@@ -2264,7 +2264,7 @@ var require_request = __commonJS({
|
|
|
2264
2264
|
this.completed = false;
|
|
2265
2265
|
this.aborted = false;
|
|
2266
2266
|
this.upgrade = upgrade || null;
|
|
2267
|
-
this.path = query ? serializePathWithQuery(
|
|
2267
|
+
this.path = query ? serializePathWithQuery(path56, query) : path56;
|
|
2268
2268
|
this.origin = origin;
|
|
2269
2269
|
this.protocol = getProtocolFromUrlString(origin);
|
|
2270
2270
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
@@ -7508,7 +7508,7 @@ var require_client_h1 = __commonJS({
|
|
|
7508
7508
|
}
|
|
7509
7509
|
}
|
|
7510
7510
|
function writeH1(client, request2) {
|
|
7511
|
-
const { method, path:
|
|
7511
|
+
const { method, path: path56, host, upgrade, blocking, reset } = request2;
|
|
7512
7512
|
let { body, headers, contentLength } = request2;
|
|
7513
7513
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
7514
7514
|
if (util.isFormDataLike(body)) {
|
|
@@ -7584,7 +7584,7 @@ var require_client_h1 = __commonJS({
|
|
|
7584
7584
|
socket[kBlocking] = true;
|
|
7585
7585
|
}
|
|
7586
7586
|
setTypeOfService(socket, request2);
|
|
7587
|
-
let header = `${method} ${
|
|
7587
|
+
let header = `${method} ${path56} HTTP/1.1\r
|
|
7588
7588
|
`;
|
|
7589
7589
|
if (typeof host === "string") {
|
|
7590
7590
|
header += `host: ${host}\r
|
|
@@ -8261,7 +8261,7 @@ var require_client_h2 = __commonJS({
|
|
|
8261
8261
|
const headersTimeout = request2.headersTimeout ?? client[kHeadersTimeout];
|
|
8262
8262
|
const bodyTimeout = request2.bodyTimeout ?? client[kBodyTimeout];
|
|
8263
8263
|
const session = client[kHTTP2Session];
|
|
8264
|
-
const { method, path:
|
|
8264
|
+
const { method, path: path56, host, upgrade, expectContinue, signal: signal2, protocol, headers: reqHeaders } = request2;
|
|
8265
8265
|
let { body } = request2;
|
|
8266
8266
|
if (upgrade != null && upgrade !== "websocket") {
|
|
8267
8267
|
util.errorRequest(client, request2, new InvalidArgumentError(`Custom upgrade "${upgrade}" not supported over HTTP/2`));
|
|
@@ -8330,7 +8330,7 @@ var require_client_h2 = __commonJS({
|
|
|
8330
8330
|
}
|
|
8331
8331
|
headers[HTTP2_HEADER_METHOD] = "CONNECT";
|
|
8332
8332
|
headers[HTTP2_HEADER_PROTOCOL] = "websocket";
|
|
8333
|
-
headers[HTTP2_HEADER_PATH] =
|
|
8333
|
+
headers[HTTP2_HEADER_PATH] = path56;
|
|
8334
8334
|
if (protocol === "ws:" || protocol === "wss:") {
|
|
8335
8335
|
headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
|
|
8336
8336
|
} else {
|
|
@@ -8382,7 +8382,7 @@ var require_client_h2 = __commonJS({
|
|
|
8382
8382
|
stream.setTimeout(headersTimeout);
|
|
8383
8383
|
return true;
|
|
8384
8384
|
}
|
|
8385
|
-
headers[HTTP2_HEADER_PATH] =
|
|
8385
|
+
headers[HTTP2_HEADER_PATH] = path56;
|
|
8386
8386
|
headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
|
|
8387
8387
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
8388
8388
|
if (body && typeof body.read === "function") {
|
|
@@ -10738,10 +10738,10 @@ var require_proxy_agent = __commonJS({
|
|
|
10738
10738
|
};
|
|
10739
10739
|
const {
|
|
10740
10740
|
origin,
|
|
10741
|
-
path:
|
|
10741
|
+
path: path56 = "/",
|
|
10742
10742
|
headers = {}
|
|
10743
10743
|
} = opts;
|
|
10744
|
-
opts.path = origin +
|
|
10744
|
+
opts.path = origin + path56;
|
|
10745
10745
|
if (!("host" in headers) && !("Host" in headers)) {
|
|
10746
10746
|
const { host } = new URL(origin);
|
|
10747
10747
|
headers.host = host;
|
|
@@ -12901,20 +12901,20 @@ var require_mock_utils = __commonJS({
|
|
|
12901
12901
|
}
|
|
12902
12902
|
return normalizedQp;
|
|
12903
12903
|
}
|
|
12904
|
-
function safeUrl(
|
|
12905
|
-
if (typeof
|
|
12906
|
-
return
|
|
12904
|
+
function safeUrl(path56) {
|
|
12905
|
+
if (typeof path56 !== "string") {
|
|
12906
|
+
return path56;
|
|
12907
12907
|
}
|
|
12908
|
-
const pathSegments =
|
|
12908
|
+
const pathSegments = path56.split("?", 3);
|
|
12909
12909
|
if (pathSegments.length !== 2) {
|
|
12910
|
-
return
|
|
12910
|
+
return path56;
|
|
12911
12911
|
}
|
|
12912
12912
|
const qp = new URLSearchParams(pathSegments.pop());
|
|
12913
12913
|
qp.sort();
|
|
12914
12914
|
return [...pathSegments, qp.toString()].join("?");
|
|
12915
12915
|
}
|
|
12916
|
-
function matchKey(mockDispatch2, { path:
|
|
12917
|
-
const pathMatch = matchValue(mockDispatch2.path,
|
|
12916
|
+
function matchKey(mockDispatch2, { path: path56, method, body, headers }) {
|
|
12917
|
+
const pathMatch = matchValue(mockDispatch2.path, path56);
|
|
12918
12918
|
const methodMatch = matchValue(mockDispatch2.method, method);
|
|
12919
12919
|
const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
|
|
12920
12920
|
const headersMatch = matchHeaders(mockDispatch2, headers);
|
|
@@ -12939,8 +12939,8 @@ var require_mock_utils = __commonJS({
|
|
|
12939
12939
|
const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
|
|
12940
12940
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
12941
12941
|
const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
|
|
12942
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path:
|
|
12943
|
-
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(
|
|
12942
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path56, ignoreTrailingSlash }) => {
|
|
12943
|
+
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path56)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path56), resolvedPath);
|
|
12944
12944
|
});
|
|
12945
12945
|
if (matchedMockDispatches.length === 0) {
|
|
12946
12946
|
throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
@@ -12979,19 +12979,19 @@ var require_mock_utils = __commonJS({
|
|
|
12979
12979
|
mockDispatches.splice(index, 1);
|
|
12980
12980
|
}
|
|
12981
12981
|
}
|
|
12982
|
-
function removeTrailingSlash(
|
|
12983
|
-
while (
|
|
12984
|
-
|
|
12982
|
+
function removeTrailingSlash(path56) {
|
|
12983
|
+
while (path56.endsWith("/")) {
|
|
12984
|
+
path56 = path56.slice(0, -1);
|
|
12985
12985
|
}
|
|
12986
|
-
if (
|
|
12987
|
-
|
|
12986
|
+
if (path56.length === 0) {
|
|
12987
|
+
path56 = "/";
|
|
12988
12988
|
}
|
|
12989
|
-
return
|
|
12989
|
+
return path56;
|
|
12990
12990
|
}
|
|
12991
12991
|
function buildKey(opts) {
|
|
12992
|
-
const { path:
|
|
12992
|
+
const { path: path56, method, body, headers, query } = opts;
|
|
12993
12993
|
return {
|
|
12994
|
-
path:
|
|
12994
|
+
path: path56,
|
|
12995
12995
|
method,
|
|
12996
12996
|
body,
|
|
12997
12997
|
headers,
|
|
@@ -13681,10 +13681,10 @@ var require_pending_interceptors_formatter = __commonJS({
|
|
|
13681
13681
|
}
|
|
13682
13682
|
format(pendingInterceptors) {
|
|
13683
13683
|
const withPrettyHeaders = pendingInterceptors.map(
|
|
13684
|
-
({ method, path:
|
|
13684
|
+
({ method, path: path56, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
13685
13685
|
Method: method,
|
|
13686
13686
|
Origin: origin,
|
|
13687
|
-
Path:
|
|
13687
|
+
Path: path56,
|
|
13688
13688
|
"Status code": statusCode,
|
|
13689
13689
|
Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
|
|
13690
13690
|
Invocations: timesInvoked,
|
|
@@ -13766,9 +13766,9 @@ var require_mock_agent = __commonJS({
|
|
|
13766
13766
|
const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
|
|
13767
13767
|
const dispatchOpts = { ...opts };
|
|
13768
13768
|
if (acceptNonStandardSearchParameters && dispatchOpts.path) {
|
|
13769
|
-
const [
|
|
13769
|
+
const [path56, searchParams] = dispatchOpts.path.split("?");
|
|
13770
13770
|
const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
|
|
13771
|
-
dispatchOpts.path = `${
|
|
13771
|
+
dispatchOpts.path = `${path56}?${normalizedSearchParams}`;
|
|
13772
13772
|
}
|
|
13773
13773
|
return this[kAgent].dispatch(dispatchOpts, handler);
|
|
13774
13774
|
}
|
|
@@ -14169,12 +14169,12 @@ var require_snapshot_recorder = __commonJS({
|
|
|
14169
14169
|
* @return {Promise<void>} - Resolves when snapshots are loaded
|
|
14170
14170
|
*/
|
|
14171
14171
|
async loadSnapshots(filePath) {
|
|
14172
|
-
const
|
|
14173
|
-
if (!
|
|
14172
|
+
const path56 = filePath || this.#snapshotPath;
|
|
14173
|
+
if (!path56) {
|
|
14174
14174
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
14175
14175
|
}
|
|
14176
14176
|
try {
|
|
14177
|
-
const data = await readFile2(resolve2(
|
|
14177
|
+
const data = await readFile2(resolve2(path56), "utf8");
|
|
14178
14178
|
const parsed = JSON.parse(data);
|
|
14179
14179
|
if (Array.isArray(parsed)) {
|
|
14180
14180
|
this.#snapshots.clear();
|
|
@@ -14188,7 +14188,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
14188
14188
|
if (error62.code === "ENOENT") {
|
|
14189
14189
|
this.#snapshots.clear();
|
|
14190
14190
|
} else {
|
|
14191
|
-
throw new UndiciError(`Failed to load snapshots from ${
|
|
14191
|
+
throw new UndiciError(`Failed to load snapshots from ${path56}`, { cause: error62 });
|
|
14192
14192
|
}
|
|
14193
14193
|
}
|
|
14194
14194
|
}
|
|
@@ -14199,11 +14199,11 @@ var require_snapshot_recorder = __commonJS({
|
|
|
14199
14199
|
* @returns {Promise<void>} - Resolves when snapshots are saved
|
|
14200
14200
|
*/
|
|
14201
14201
|
async saveSnapshots(filePath) {
|
|
14202
|
-
const
|
|
14203
|
-
if (!
|
|
14202
|
+
const path56 = filePath || this.#snapshotPath;
|
|
14203
|
+
if (!path56) {
|
|
14204
14204
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
14205
14205
|
}
|
|
14206
|
-
const resolvedPath = resolve2(
|
|
14206
|
+
const resolvedPath = resolve2(path56);
|
|
14207
14207
|
await mkdir2(dirname(resolvedPath), { recursive: true });
|
|
14208
14208
|
const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
|
|
14209
14209
|
hash: hash2,
|
|
@@ -14844,15 +14844,15 @@ var require_redirect_handler = __commonJS({
|
|
|
14844
14844
|
receivedAt: Date.now()
|
|
14845
14845
|
});
|
|
14846
14846
|
const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
14847
|
-
const
|
|
14848
|
-
const redirectUrlString = `${origin}${
|
|
14847
|
+
const path56 = search ? `${pathname}${search}` : pathname;
|
|
14848
|
+
const redirectUrlString = `${origin}${path56}`;
|
|
14849
14849
|
for (const historyUrl of this.history) {
|
|
14850
14850
|
if (historyUrl.toString() === redirectUrlString) {
|
|
14851
14851
|
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.`);
|
|
14852
14852
|
}
|
|
14853
14853
|
}
|
|
14854
14854
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
|
|
14855
|
-
this.opts.path =
|
|
14855
|
+
this.opts.path = path56;
|
|
14856
14856
|
this.opts.origin = origin;
|
|
14857
14857
|
this.opts.query = null;
|
|
14858
14858
|
}
|
|
@@ -16669,10 +16669,10 @@ var require_cache_handler = __commonJS({
|
|
|
16669
16669
|
}
|
|
16670
16670
|
return locationUrl.pathname + locationUrl.search;
|
|
16671
16671
|
}
|
|
16672
|
-
function deleteCachedUri(store, cacheKey,
|
|
16672
|
+
function deleteCachedUri(store, cacheKey, path56) {
|
|
16673
16673
|
deleteCachedValue(store, {
|
|
16674
16674
|
...cacheKey,
|
|
16675
|
-
path:
|
|
16675
|
+
path: path56
|
|
16676
16676
|
});
|
|
16677
16677
|
for (let i = 0; i < util.safeHTTPMethods.length; i++) {
|
|
16678
16678
|
const method = util.safeHTTPMethods[i];
|
|
@@ -16680,7 +16680,7 @@ var require_cache_handler = __commonJS({
|
|
|
16680
16680
|
deleteCachedValue(store, {
|
|
16681
16681
|
...cacheKey,
|
|
16682
16682
|
method,
|
|
16683
|
-
path:
|
|
16683
|
+
path: path56
|
|
16684
16684
|
});
|
|
16685
16685
|
}
|
|
16686
16686
|
}
|
|
@@ -16691,9 +16691,9 @@ var require_cache_handler = __commonJS({
|
|
|
16691
16691
|
}
|
|
16692
16692
|
const values = Array.isArray(headerValue) ? headerValue : [headerValue];
|
|
16693
16693
|
for (let i = 0; i < values.length; i++) {
|
|
16694
|
-
const
|
|
16695
|
-
if (
|
|
16696
|
-
deleteCachedUri(store, cacheKey,
|
|
16694
|
+
const path56 = getSameOriginPath(cacheKey, values[i]);
|
|
16695
|
+
if (path56 !== void 0) {
|
|
16696
|
+
deleteCachedUri(store, cacheKey, path56);
|
|
16697
16697
|
}
|
|
16698
16698
|
}
|
|
16699
16699
|
}
|
|
@@ -22181,11 +22181,11 @@ var require_fetch = __commonJS({
|
|
|
22181
22181
|
function dispatch({ body }) {
|
|
22182
22182
|
const url2 = requestCurrentURL(request2);
|
|
22183
22183
|
const agent = fetchParams.controller.dispatcher;
|
|
22184
|
-
const
|
|
22184
|
+
const path56 = url2.pathname + url2.search;
|
|
22185
22185
|
const hasTrailingQuestionMark = url2.search.length === 0 && url2.href[url2.href.length - url2.hash.length - 1] === "?";
|
|
22186
22186
|
return new Promise((resolve2, reject) => agent.dispatch(
|
|
22187
22187
|
{
|
|
22188
|
-
path: hasTrailingQuestionMark ? `${
|
|
22188
|
+
path: hasTrailingQuestionMark ? `${path56}?` : path56,
|
|
22189
22189
|
origin: url2.origin,
|
|
22190
22190
|
method: request2.method,
|
|
22191
22191
|
body: agent.isMockActive ? request2.body && (request2.body.source || request2.body.stream) : body,
|
|
@@ -23132,9 +23132,9 @@ var require_util4 = __commonJS({
|
|
|
23132
23132
|
}
|
|
23133
23133
|
}
|
|
23134
23134
|
}
|
|
23135
|
-
function validateCookiePath(
|
|
23136
|
-
for (let i = 0; i <
|
|
23137
|
-
const code =
|
|
23135
|
+
function validateCookiePath(path56) {
|
|
23136
|
+
for (let i = 0; i < path56.length; ++i) {
|
|
23137
|
+
const code = path56.charCodeAt(i);
|
|
23138
23138
|
if (code < 32 || // exclude CTLs (0-31)
|
|
23139
23139
|
code > 126 || // exclude DEL and non-ascii
|
|
23140
23140
|
code === 59) {
|
|
@@ -26570,11 +26570,11 @@ var require_undici = __commonJS({
|
|
|
26570
26570
|
if (typeof opts.path !== "string") {
|
|
26571
26571
|
throw new InvalidArgumentError("invalid opts.path");
|
|
26572
26572
|
}
|
|
26573
|
-
let
|
|
26573
|
+
let path56 = opts.path;
|
|
26574
26574
|
if (!opts.path.startsWith("/")) {
|
|
26575
|
-
|
|
26575
|
+
path56 = `/${path56}`;
|
|
26576
26576
|
}
|
|
26577
|
-
url2 = new URL(util.parseOrigin(url2).origin +
|
|
26577
|
+
url2 = new URL(util.parseOrigin(url2).origin + path56);
|
|
26578
26578
|
} else {
|
|
26579
26579
|
if (!opts) {
|
|
26580
26580
|
opts = typeof url2 === "object" ? url2 : {};
|
|
@@ -26760,17 +26760,17 @@ var require_visit = __commonJS({
|
|
|
26760
26760
|
visit2.BREAK = BREAK;
|
|
26761
26761
|
visit2.SKIP = SKIP;
|
|
26762
26762
|
visit2.REMOVE = REMOVE;
|
|
26763
|
-
function visit_(key, node2, visitor,
|
|
26764
|
-
const ctrl = callVisitor(key, node2, visitor,
|
|
26763
|
+
function visit_(key, node2, visitor, path56) {
|
|
26764
|
+
const ctrl = callVisitor(key, node2, visitor, path56);
|
|
26765
26765
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
26766
|
-
replaceNode(key,
|
|
26767
|
-
return visit_(key, ctrl, visitor,
|
|
26766
|
+
replaceNode(key, path56, ctrl);
|
|
26767
|
+
return visit_(key, ctrl, visitor, path56);
|
|
26768
26768
|
}
|
|
26769
26769
|
if (typeof ctrl !== "symbol") {
|
|
26770
26770
|
if (identity.isCollection(node2)) {
|
|
26771
|
-
|
|
26771
|
+
path56 = Object.freeze(path56.concat(node2));
|
|
26772
26772
|
for (let i = 0; i < node2.items.length; ++i) {
|
|
26773
|
-
const ci2 = visit_(i, node2.items[i], visitor,
|
|
26773
|
+
const ci2 = visit_(i, node2.items[i], visitor, path56);
|
|
26774
26774
|
if (typeof ci2 === "number")
|
|
26775
26775
|
i = ci2 - 1;
|
|
26776
26776
|
else if (ci2 === BREAK)
|
|
@@ -26781,13 +26781,13 @@ var require_visit = __commonJS({
|
|
|
26781
26781
|
}
|
|
26782
26782
|
}
|
|
26783
26783
|
} else if (identity.isPair(node2)) {
|
|
26784
|
-
|
|
26785
|
-
const ck = visit_("key", node2.key, visitor,
|
|
26784
|
+
path56 = Object.freeze(path56.concat(node2));
|
|
26785
|
+
const ck = visit_("key", node2.key, visitor, path56);
|
|
26786
26786
|
if (ck === BREAK)
|
|
26787
26787
|
return BREAK;
|
|
26788
26788
|
else if (ck === REMOVE)
|
|
26789
26789
|
node2.key = null;
|
|
26790
|
-
const cv = visit_("value", node2.value, visitor,
|
|
26790
|
+
const cv = visit_("value", node2.value, visitor, path56);
|
|
26791
26791
|
if (cv === BREAK)
|
|
26792
26792
|
return BREAK;
|
|
26793
26793
|
else if (cv === REMOVE)
|
|
@@ -26808,17 +26808,17 @@ var require_visit = __commonJS({
|
|
|
26808
26808
|
visitAsync.BREAK = BREAK;
|
|
26809
26809
|
visitAsync.SKIP = SKIP;
|
|
26810
26810
|
visitAsync.REMOVE = REMOVE;
|
|
26811
|
-
async function visitAsync_(key, node2, visitor,
|
|
26812
|
-
const ctrl = await callVisitor(key, node2, visitor,
|
|
26811
|
+
async function visitAsync_(key, node2, visitor, path56) {
|
|
26812
|
+
const ctrl = await callVisitor(key, node2, visitor, path56);
|
|
26813
26813
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
26814
|
-
replaceNode(key,
|
|
26815
|
-
return visitAsync_(key, ctrl, visitor,
|
|
26814
|
+
replaceNode(key, path56, ctrl);
|
|
26815
|
+
return visitAsync_(key, ctrl, visitor, path56);
|
|
26816
26816
|
}
|
|
26817
26817
|
if (typeof ctrl !== "symbol") {
|
|
26818
26818
|
if (identity.isCollection(node2)) {
|
|
26819
|
-
|
|
26819
|
+
path56 = Object.freeze(path56.concat(node2));
|
|
26820
26820
|
for (let i = 0; i < node2.items.length; ++i) {
|
|
26821
|
-
const ci2 = await visitAsync_(i, node2.items[i], visitor,
|
|
26821
|
+
const ci2 = await visitAsync_(i, node2.items[i], visitor, path56);
|
|
26822
26822
|
if (typeof ci2 === "number")
|
|
26823
26823
|
i = ci2 - 1;
|
|
26824
26824
|
else if (ci2 === BREAK)
|
|
@@ -26829,13 +26829,13 @@ var require_visit = __commonJS({
|
|
|
26829
26829
|
}
|
|
26830
26830
|
}
|
|
26831
26831
|
} else if (identity.isPair(node2)) {
|
|
26832
|
-
|
|
26833
|
-
const ck = await visitAsync_("key", node2.key, visitor,
|
|
26832
|
+
path56 = Object.freeze(path56.concat(node2));
|
|
26833
|
+
const ck = await visitAsync_("key", node2.key, visitor, path56);
|
|
26834
26834
|
if (ck === BREAK)
|
|
26835
26835
|
return BREAK;
|
|
26836
26836
|
else if (ck === REMOVE)
|
|
26837
26837
|
node2.key = null;
|
|
26838
|
-
const cv = await visitAsync_("value", node2.value, visitor,
|
|
26838
|
+
const cv = await visitAsync_("value", node2.value, visitor, path56);
|
|
26839
26839
|
if (cv === BREAK)
|
|
26840
26840
|
return BREAK;
|
|
26841
26841
|
else if (cv === REMOVE)
|
|
@@ -26862,23 +26862,23 @@ var require_visit = __commonJS({
|
|
|
26862
26862
|
}
|
|
26863
26863
|
return visitor;
|
|
26864
26864
|
}
|
|
26865
|
-
function callVisitor(key, node2, visitor,
|
|
26865
|
+
function callVisitor(key, node2, visitor, path56) {
|
|
26866
26866
|
if (typeof visitor === "function")
|
|
26867
|
-
return visitor(key, node2,
|
|
26867
|
+
return visitor(key, node2, path56);
|
|
26868
26868
|
if (identity.isMap(node2))
|
|
26869
|
-
return visitor.Map?.(key, node2,
|
|
26869
|
+
return visitor.Map?.(key, node2, path56);
|
|
26870
26870
|
if (identity.isSeq(node2))
|
|
26871
|
-
return visitor.Seq?.(key, node2,
|
|
26871
|
+
return visitor.Seq?.(key, node2, path56);
|
|
26872
26872
|
if (identity.isPair(node2))
|
|
26873
|
-
return visitor.Pair?.(key, node2,
|
|
26873
|
+
return visitor.Pair?.(key, node2, path56);
|
|
26874
26874
|
if (identity.isScalar(node2))
|
|
26875
|
-
return visitor.Scalar?.(key, node2,
|
|
26875
|
+
return visitor.Scalar?.(key, node2, path56);
|
|
26876
26876
|
if (identity.isAlias(node2))
|
|
26877
|
-
return visitor.Alias?.(key, node2,
|
|
26877
|
+
return visitor.Alias?.(key, node2, path56);
|
|
26878
26878
|
return void 0;
|
|
26879
26879
|
}
|
|
26880
|
-
function replaceNode(key,
|
|
26881
|
-
const parent =
|
|
26880
|
+
function replaceNode(key, path56, node2) {
|
|
26881
|
+
const parent = path56[path56.length - 1];
|
|
26882
26882
|
if (identity.isCollection(parent)) {
|
|
26883
26883
|
parent.items[key] = node2;
|
|
26884
26884
|
} else if (identity.isPair(parent)) {
|
|
@@ -27490,10 +27490,10 @@ var require_Collection = __commonJS({
|
|
|
27490
27490
|
var createNode = require_createNode();
|
|
27491
27491
|
var identity = require_identity();
|
|
27492
27492
|
var Node = require_Node();
|
|
27493
|
-
function collectionFromPath(schema,
|
|
27493
|
+
function collectionFromPath(schema, path56, value) {
|
|
27494
27494
|
let v = value;
|
|
27495
|
-
for (let i =
|
|
27496
|
-
const k2 =
|
|
27495
|
+
for (let i = path56.length - 1; i >= 0; --i) {
|
|
27496
|
+
const k2 = path56[i];
|
|
27497
27497
|
if (typeof k2 === "number" && Number.isInteger(k2) && k2 >= 0) {
|
|
27498
27498
|
const a2 = [];
|
|
27499
27499
|
a2[k2] = v;
|
|
@@ -27512,7 +27512,7 @@ var require_Collection = __commonJS({
|
|
|
27512
27512
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
27513
27513
|
});
|
|
27514
27514
|
}
|
|
27515
|
-
var isEmptyPath = (
|
|
27515
|
+
var isEmptyPath = (path56) => path56 == null || typeof path56 === "object" && !!path56[Symbol.iterator]().next().done;
|
|
27516
27516
|
var Collection = class extends Node.NodeBase {
|
|
27517
27517
|
constructor(type, schema) {
|
|
27518
27518
|
super(type);
|
|
@@ -27542,11 +27542,11 @@ var require_Collection = __commonJS({
|
|
|
27542
27542
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
27543
27543
|
* that already exists in the map.
|
|
27544
27544
|
*/
|
|
27545
|
-
addIn(
|
|
27546
|
-
if (isEmptyPath(
|
|
27545
|
+
addIn(path56, value) {
|
|
27546
|
+
if (isEmptyPath(path56))
|
|
27547
27547
|
this.add(value);
|
|
27548
27548
|
else {
|
|
27549
|
-
const [key, ...rest] =
|
|
27549
|
+
const [key, ...rest] = path56;
|
|
27550
27550
|
const node2 = this.get(key, true);
|
|
27551
27551
|
if (identity.isCollection(node2))
|
|
27552
27552
|
node2.addIn(rest, value);
|
|
@@ -27560,8 +27560,8 @@ var require_Collection = __commonJS({
|
|
|
27560
27560
|
* Removes a value from the collection.
|
|
27561
27561
|
* @returns `true` if the item was found and removed.
|
|
27562
27562
|
*/
|
|
27563
|
-
deleteIn(
|
|
27564
|
-
const [key, ...rest] =
|
|
27563
|
+
deleteIn(path56) {
|
|
27564
|
+
const [key, ...rest] = path56;
|
|
27565
27565
|
if (rest.length === 0)
|
|
27566
27566
|
return this.delete(key);
|
|
27567
27567
|
const node2 = this.get(key, true);
|
|
@@ -27575,8 +27575,8 @@ var require_Collection = __commonJS({
|
|
|
27575
27575
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
27576
27576
|
* `true` (collections are always returned intact).
|
|
27577
27577
|
*/
|
|
27578
|
-
getIn(
|
|
27579
|
-
const [key, ...rest] =
|
|
27578
|
+
getIn(path56, keepScalar) {
|
|
27579
|
+
const [key, ...rest] = path56;
|
|
27580
27580
|
const node2 = this.get(key, true);
|
|
27581
27581
|
if (rest.length === 0)
|
|
27582
27582
|
return !keepScalar && identity.isScalar(node2) ? node2.value : node2;
|
|
@@ -27594,8 +27594,8 @@ var require_Collection = __commonJS({
|
|
|
27594
27594
|
/**
|
|
27595
27595
|
* Checks if the collection includes a value with the key `key`.
|
|
27596
27596
|
*/
|
|
27597
|
-
hasIn(
|
|
27598
|
-
const [key, ...rest] =
|
|
27597
|
+
hasIn(path56) {
|
|
27598
|
+
const [key, ...rest] = path56;
|
|
27599
27599
|
if (rest.length === 0)
|
|
27600
27600
|
return this.has(key);
|
|
27601
27601
|
const node2 = this.get(key, true);
|
|
@@ -27605,8 +27605,8 @@ var require_Collection = __commonJS({
|
|
|
27605
27605
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
27606
27606
|
* boolean to add/remove the item from the set.
|
|
27607
27607
|
*/
|
|
27608
|
-
setIn(
|
|
27609
|
-
const [key, ...rest] =
|
|
27608
|
+
setIn(path56, value) {
|
|
27609
|
+
const [key, ...rest] = path56;
|
|
27610
27610
|
if (rest.length === 0) {
|
|
27611
27611
|
this.set(key, value);
|
|
27612
27612
|
} else {
|
|
@@ -30121,9 +30121,9 @@ var require_Document = __commonJS({
|
|
|
30121
30121
|
this.contents.add(value);
|
|
30122
30122
|
}
|
|
30123
30123
|
/** Adds a value to the document. */
|
|
30124
|
-
addIn(
|
|
30124
|
+
addIn(path56, value) {
|
|
30125
30125
|
if (assertCollection(this.contents))
|
|
30126
|
-
this.contents.addIn(
|
|
30126
|
+
this.contents.addIn(path56, value);
|
|
30127
30127
|
}
|
|
30128
30128
|
/**
|
|
30129
30129
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -30198,14 +30198,14 @@ var require_Document = __commonJS({
|
|
|
30198
30198
|
* Removes a value from the document.
|
|
30199
30199
|
* @returns `true` if the item was found and removed.
|
|
30200
30200
|
*/
|
|
30201
|
-
deleteIn(
|
|
30202
|
-
if (Collection.isEmptyPath(
|
|
30201
|
+
deleteIn(path56) {
|
|
30202
|
+
if (Collection.isEmptyPath(path56)) {
|
|
30203
30203
|
if (this.contents == null)
|
|
30204
30204
|
return false;
|
|
30205
30205
|
this.contents = null;
|
|
30206
30206
|
return true;
|
|
30207
30207
|
}
|
|
30208
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
30208
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path56) : false;
|
|
30209
30209
|
}
|
|
30210
30210
|
/**
|
|
30211
30211
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -30220,10 +30220,10 @@ var require_Document = __commonJS({
|
|
|
30220
30220
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
30221
30221
|
* `true` (collections are always returned intact).
|
|
30222
30222
|
*/
|
|
30223
|
-
getIn(
|
|
30224
|
-
if (Collection.isEmptyPath(
|
|
30223
|
+
getIn(path56, keepScalar) {
|
|
30224
|
+
if (Collection.isEmptyPath(path56))
|
|
30225
30225
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
30226
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
30226
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path56, keepScalar) : void 0;
|
|
30227
30227
|
}
|
|
30228
30228
|
/**
|
|
30229
30229
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -30234,10 +30234,10 @@ var require_Document = __commonJS({
|
|
|
30234
30234
|
/**
|
|
30235
30235
|
* Checks if the document includes a value at `path`.
|
|
30236
30236
|
*/
|
|
30237
|
-
hasIn(
|
|
30238
|
-
if (Collection.isEmptyPath(
|
|
30237
|
+
hasIn(path56) {
|
|
30238
|
+
if (Collection.isEmptyPath(path56))
|
|
30239
30239
|
return this.contents !== void 0;
|
|
30240
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
30240
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path56) : false;
|
|
30241
30241
|
}
|
|
30242
30242
|
/**
|
|
30243
30243
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -30254,13 +30254,13 @@ var require_Document = __commonJS({
|
|
|
30254
30254
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
30255
30255
|
* boolean to add/remove the item from the set.
|
|
30256
30256
|
*/
|
|
30257
|
-
setIn(
|
|
30258
|
-
if (Collection.isEmptyPath(
|
|
30257
|
+
setIn(path56, value) {
|
|
30258
|
+
if (Collection.isEmptyPath(path56)) {
|
|
30259
30259
|
this.contents = value;
|
|
30260
30260
|
} else if (this.contents == null) {
|
|
30261
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
30261
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path56), value);
|
|
30262
30262
|
} else if (assertCollection(this.contents)) {
|
|
30263
|
-
this.contents.setIn(
|
|
30263
|
+
this.contents.setIn(path56, value);
|
|
30264
30264
|
}
|
|
30265
30265
|
}
|
|
30266
30266
|
/**
|
|
@@ -32221,9 +32221,9 @@ var require_cst_visit = __commonJS({
|
|
|
32221
32221
|
visit2.BREAK = BREAK;
|
|
32222
32222
|
visit2.SKIP = SKIP;
|
|
32223
32223
|
visit2.REMOVE = REMOVE;
|
|
32224
|
-
visit2.itemAtPath = (cst,
|
|
32224
|
+
visit2.itemAtPath = (cst, path56) => {
|
|
32225
32225
|
let item = cst;
|
|
32226
|
-
for (const [field, index] of
|
|
32226
|
+
for (const [field, index] of path56) {
|
|
32227
32227
|
const tok = item?.[field];
|
|
32228
32228
|
if (tok && "items" in tok) {
|
|
32229
32229
|
item = tok.items[index];
|
|
@@ -32232,23 +32232,23 @@ var require_cst_visit = __commonJS({
|
|
|
32232
32232
|
}
|
|
32233
32233
|
return item;
|
|
32234
32234
|
};
|
|
32235
|
-
visit2.parentCollection = (cst,
|
|
32236
|
-
const parent = visit2.itemAtPath(cst,
|
|
32237
|
-
const field =
|
|
32235
|
+
visit2.parentCollection = (cst, path56) => {
|
|
32236
|
+
const parent = visit2.itemAtPath(cst, path56.slice(0, -1));
|
|
32237
|
+
const field = path56[path56.length - 1][0];
|
|
32238
32238
|
const coll = parent?.[field];
|
|
32239
32239
|
if (coll && "items" in coll)
|
|
32240
32240
|
return coll;
|
|
32241
32241
|
throw new Error("Parent collection not found");
|
|
32242
32242
|
};
|
|
32243
|
-
function _visit(
|
|
32244
|
-
let ctrl = visitor(item,
|
|
32243
|
+
function _visit(path56, item, visitor) {
|
|
32244
|
+
let ctrl = visitor(item, path56);
|
|
32245
32245
|
if (typeof ctrl === "symbol")
|
|
32246
32246
|
return ctrl;
|
|
32247
32247
|
for (const field of ["key", "value"]) {
|
|
32248
32248
|
const token = item[field];
|
|
32249
32249
|
if (token && "items" in token) {
|
|
32250
32250
|
for (let i = 0; i < token.items.length; ++i) {
|
|
32251
|
-
const ci2 = _visit(Object.freeze(
|
|
32251
|
+
const ci2 = _visit(Object.freeze(path56.concat([[field, i]])), token.items[i], visitor);
|
|
32252
32252
|
if (typeof ci2 === "number")
|
|
32253
32253
|
i = ci2 - 1;
|
|
32254
32254
|
else if (ci2 === BREAK)
|
|
@@ -32259,10 +32259,10 @@ var require_cst_visit = __commonJS({
|
|
|
32259
32259
|
}
|
|
32260
32260
|
}
|
|
32261
32261
|
if (typeof ctrl === "function" && field === "key")
|
|
32262
|
-
ctrl = ctrl(item,
|
|
32262
|
+
ctrl = ctrl(item, path56);
|
|
32263
32263
|
}
|
|
32264
32264
|
}
|
|
32265
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
32265
|
+
return typeof ctrl === "function" ? ctrl(item, path56) : ctrl;
|
|
32266
32266
|
}
|
|
32267
32267
|
exports.visit = visit2;
|
|
32268
32268
|
}
|
|
@@ -33564,14 +33564,14 @@ var require_parser = __commonJS({
|
|
|
33564
33564
|
case "scalar":
|
|
33565
33565
|
case "single-quoted-scalar":
|
|
33566
33566
|
case "double-quoted-scalar": {
|
|
33567
|
-
const
|
|
33567
|
+
const fs51 = this.flowScalar(this.type);
|
|
33568
33568
|
if (atNextItem || it2.value) {
|
|
33569
|
-
map3.items.push({ start, key:
|
|
33569
|
+
map3.items.push({ start, key: fs51, sep: [] });
|
|
33570
33570
|
this.onKeyLine = true;
|
|
33571
33571
|
} else if (it2.sep) {
|
|
33572
|
-
this.stack.push(
|
|
33572
|
+
this.stack.push(fs51);
|
|
33573
33573
|
} else {
|
|
33574
|
-
Object.assign(it2, { key:
|
|
33574
|
+
Object.assign(it2, { key: fs51, sep: [] });
|
|
33575
33575
|
this.onKeyLine = true;
|
|
33576
33576
|
}
|
|
33577
33577
|
return;
|
|
@@ -33699,13 +33699,13 @@ var require_parser = __commonJS({
|
|
|
33699
33699
|
case "scalar":
|
|
33700
33700
|
case "single-quoted-scalar":
|
|
33701
33701
|
case "double-quoted-scalar": {
|
|
33702
|
-
const
|
|
33702
|
+
const fs51 = this.flowScalar(this.type);
|
|
33703
33703
|
if (!it2 || it2.value)
|
|
33704
|
-
fc.items.push({ start: [], key:
|
|
33704
|
+
fc.items.push({ start: [], key: fs51, sep: [] });
|
|
33705
33705
|
else if (it2.sep)
|
|
33706
|
-
this.stack.push(
|
|
33706
|
+
this.stack.push(fs51);
|
|
33707
33707
|
else
|
|
33708
|
-
Object.assign(it2, { key:
|
|
33708
|
+
Object.assign(it2, { key: fs51, sep: [] });
|
|
33709
33709
|
return;
|
|
33710
33710
|
}
|
|
33711
33711
|
case "flow-map-end":
|
|
@@ -37252,8 +37252,8 @@ var require_utils2 = __commonJS({
|
|
|
37252
37252
|
}
|
|
37253
37253
|
return ind;
|
|
37254
37254
|
}
|
|
37255
|
-
function removeDotSegments(
|
|
37256
|
-
let input2 =
|
|
37255
|
+
function removeDotSegments(path56) {
|
|
37256
|
+
let input2 = path56;
|
|
37257
37257
|
const output3 = [];
|
|
37258
37258
|
let nextSlash = -1;
|
|
37259
37259
|
let len = 0;
|
|
@@ -37327,11 +37327,11 @@ var require_utils2 = __commonJS({
|
|
|
37327
37327
|
}
|
|
37328
37328
|
return output3.join("");
|
|
37329
37329
|
}
|
|
37330
|
-
function removeDotSegmentsRelative(
|
|
37331
|
-
if (
|
|
37332
|
-
return removeDotSegments(
|
|
37330
|
+
function removeDotSegmentsRelative(path56) {
|
|
37331
|
+
if (path56 === "" || path56[0] === "/") {
|
|
37332
|
+
return removeDotSegments(path56);
|
|
37333
37333
|
}
|
|
37334
|
-
const segments =
|
|
37334
|
+
const segments = path56.split("/");
|
|
37335
37335
|
const last = segments.length - 1;
|
|
37336
37336
|
const output3 = [];
|
|
37337
37337
|
let trailingDirectory = false;
|
|
@@ -37694,8 +37694,8 @@ var require_schemes = __commonJS({
|
|
|
37694
37694
|
}
|
|
37695
37695
|
if (wsComponent.resourceName) {
|
|
37696
37696
|
const queryIndex = wsComponent.resourceName.indexOf("?");
|
|
37697
|
-
const
|
|
37698
|
-
wsComponent.path =
|
|
37697
|
+
const path56 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
|
|
37698
|
+
wsComponent.path = path56 && path56 !== "/" ? path56 : void 0;
|
|
37699
37699
|
wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
|
|
37700
37700
|
wsComponent.resourceName = void 0;
|
|
37701
37701
|
}
|
|
@@ -82162,8 +82162,8 @@ var require_JSXTransformer = __commonJS({
|
|
|
82162
82162
|
}
|
|
82163
82163
|
if (this.isAutomaticRuntime) {
|
|
82164
82164
|
if (this.importProcessor) {
|
|
82165
|
-
for (const [
|
|
82166
|
-
prefix += `var ${resolvedName} = require("${
|
|
82165
|
+
for (const [path56, resolvedName] of Object.entries(this.cjsAutomaticModuleNameResolutions)) {
|
|
82166
|
+
prefix += `var ${resolvedName} = require("${path56}");`;
|
|
82167
82167
|
}
|
|
82168
82168
|
} else {
|
|
82169
82169
|
const { createElement: createElementResolution, ...otherResolutions } = this.esmAutomaticImportNameResolutions;
|
|
@@ -82356,11 +82356,11 @@ var require_JSXTransformer = __commonJS({
|
|
|
82356
82356
|
}
|
|
82357
82357
|
claimAutoImportedName(funcName, importPathSuffix) {
|
|
82358
82358
|
if (this.importProcessor) {
|
|
82359
|
-
const
|
|
82360
|
-
if (!this.cjsAutomaticModuleNameResolutions[
|
|
82361
|
-
this.cjsAutomaticModuleNameResolutions[
|
|
82359
|
+
const path56 = this.jsxImportSource + importPathSuffix;
|
|
82360
|
+
if (!this.cjsAutomaticModuleNameResolutions[path56]) {
|
|
82361
|
+
this.cjsAutomaticModuleNameResolutions[path56] = this.importProcessor.getFreeIdentifierForPath(path56);
|
|
82362
82362
|
}
|
|
82363
|
-
return `${this.cjsAutomaticModuleNameResolutions[
|
|
82363
|
+
return `${this.cjsAutomaticModuleNameResolutions[path56]}.${funcName}`;
|
|
82364
82364
|
} else {
|
|
82365
82365
|
if (!this.esmAutomaticImportNameResolutions[funcName]) {
|
|
82366
82366
|
this.esmAutomaticImportNameResolutions[funcName] = this.nameManager.claimFreeName(
|
|
@@ -82796,7 +82796,7 @@ var require_CJSImportProcessor = __commonJS({
|
|
|
82796
82796
|
*/
|
|
82797
82797
|
pruneTypeOnlyImports() {
|
|
82798
82798
|
this.nonTypeIdentifiers = _getNonTypeIdentifiers.getNonTypeIdentifiers.call(void 0, this.tokens, this.options);
|
|
82799
|
-
for (const [
|
|
82799
|
+
for (const [path56, importInfo] of this.importInfoByPath.entries()) {
|
|
82800
82800
|
if (importInfo.hasBareImport || importInfo.hasStarExport || importInfo.exportStarNames.length > 0 || importInfo.namedExports.length > 0) {
|
|
82801
82801
|
continue;
|
|
82802
82802
|
}
|
|
@@ -82806,7 +82806,7 @@ var require_CJSImportProcessor = __commonJS({
|
|
|
82806
82806
|
...importInfo.namedImports.map(({ localName }) => localName)
|
|
82807
82807
|
];
|
|
82808
82808
|
if (names2.every((name) => this.shouldAutomaticallyElideImportedName(name))) {
|
|
82809
|
-
this.importsToReplace.set(
|
|
82809
|
+
this.importsToReplace.set(path56, "");
|
|
82810
82810
|
}
|
|
82811
82811
|
}
|
|
82812
82812
|
}
|
|
@@ -82814,7 +82814,7 @@ var require_CJSImportProcessor = __commonJS({
|
|
|
82814
82814
|
return this.isTypeScriptTransformEnabled && !this.keepUnusedImports && !this.nonTypeIdentifiers.has(name);
|
|
82815
82815
|
}
|
|
82816
82816
|
generateImportReplacements() {
|
|
82817
|
-
for (const [
|
|
82817
|
+
for (const [path56, importInfo] of this.importInfoByPath.entries()) {
|
|
82818
82818
|
const {
|
|
82819
82819
|
defaultNames,
|
|
82820
82820
|
wildcardNames,
|
|
@@ -82824,17 +82824,17 @@ var require_CJSImportProcessor = __commonJS({
|
|
|
82824
82824
|
hasStarExport
|
|
82825
82825
|
} = importInfo;
|
|
82826
82826
|
if (defaultNames.length === 0 && wildcardNames.length === 0 && namedImports.length === 0 && namedExports.length === 0 && exportStarNames.length === 0 && !hasStarExport) {
|
|
82827
|
-
this.importsToReplace.set(
|
|
82827
|
+
this.importsToReplace.set(path56, `require('${path56}');`);
|
|
82828
82828
|
continue;
|
|
82829
82829
|
}
|
|
82830
|
-
const primaryImportName = this.getFreeIdentifierForPath(
|
|
82830
|
+
const primaryImportName = this.getFreeIdentifierForPath(path56);
|
|
82831
82831
|
let secondaryImportName;
|
|
82832
82832
|
if (this.enableLegacyTypeScriptModuleInterop) {
|
|
82833
82833
|
secondaryImportName = primaryImportName;
|
|
82834
82834
|
} else {
|
|
82835
|
-
secondaryImportName = wildcardNames.length > 0 ? wildcardNames[0] : this.getFreeIdentifierForPath(
|
|
82835
|
+
secondaryImportName = wildcardNames.length > 0 ? wildcardNames[0] : this.getFreeIdentifierForPath(path56);
|
|
82836
82836
|
}
|
|
82837
|
-
let requireCode = `var ${primaryImportName} = require('${
|
|
82837
|
+
let requireCode = `var ${primaryImportName} = require('${path56}');`;
|
|
82838
82838
|
if (wildcardNames.length > 0) {
|
|
82839
82839
|
for (const wildcardName of wildcardNames) {
|
|
82840
82840
|
const moduleExpr = this.enableLegacyTypeScriptModuleInterop ? primaryImportName : `${this.helperManager.getHelperName("interopRequireWildcard")}(${primaryImportName})`;
|
|
@@ -82862,7 +82862,7 @@ var require_CJSImportProcessor = __commonJS({
|
|
|
82862
82862
|
"createStarExport"
|
|
82863
82863
|
)}(${primaryImportName});`;
|
|
82864
82864
|
}
|
|
82865
|
-
this.importsToReplace.set(
|
|
82865
|
+
this.importsToReplace.set(path56, requireCode);
|
|
82866
82866
|
for (const defaultName of defaultNames) {
|
|
82867
82867
|
this.identifierReplacements.set(defaultName, `${secondaryImportName}.default`);
|
|
82868
82868
|
}
|
|
@@ -82871,8 +82871,8 @@ var require_CJSImportProcessor = __commonJS({
|
|
|
82871
82871
|
}
|
|
82872
82872
|
}
|
|
82873
82873
|
}
|
|
82874
|
-
getFreeIdentifierForPath(
|
|
82875
|
-
const components =
|
|
82874
|
+
getFreeIdentifierForPath(path56) {
|
|
82875
|
+
const components = path56.split("/");
|
|
82876
82876
|
const lastComponent = components[components.length - 1];
|
|
82877
82877
|
const baseName = lastComponent.replace(/\W/g, "");
|
|
82878
82878
|
return this.nameManager.claimFreeName(`_${baseName}`);
|
|
@@ -82917,8 +82917,8 @@ var require_CJSImportProcessor = __commonJS({
|
|
|
82917
82917
|
if (!this.tokens.matches1AtIndex(index, _types.TokenType.string)) {
|
|
82918
82918
|
throw new Error("Expected string token at the end of import statement.");
|
|
82919
82919
|
}
|
|
82920
|
-
const
|
|
82921
|
-
const importInfo = this.getImportInfo(
|
|
82920
|
+
const path56 = this.tokens.stringValueAtIndex(index);
|
|
82921
|
+
const importInfo = this.getImportInfo(path56);
|
|
82922
82922
|
importInfo.defaultNames.push(...defaultNames);
|
|
82923
82923
|
importInfo.wildcardNames.push(...wildcardNames);
|
|
82924
82924
|
importInfo.namedImports.push(...namedImports);
|
|
@@ -82985,8 +82985,8 @@ var require_CJSImportProcessor = __commonJS({
|
|
|
82985
82985
|
if (!this.tokens.matches1AtIndex(index, _types.TokenType.string)) {
|
|
82986
82986
|
throw new Error("Expected string token at the end of import statement.");
|
|
82987
82987
|
}
|
|
82988
|
-
const
|
|
82989
|
-
const importInfo = this.getImportInfo(
|
|
82988
|
+
const path56 = this.tokens.stringValueAtIndex(index);
|
|
82989
|
+
const importInfo = this.getImportInfo(path56);
|
|
82990
82990
|
importInfo.namedExports.push(...namedImports);
|
|
82991
82991
|
}
|
|
82992
82992
|
preprocessExportStarAtIndex(index) {
|
|
@@ -83001,8 +83001,8 @@ var require_CJSImportProcessor = __commonJS({
|
|
|
83001
83001
|
if (!this.tokens.matches1AtIndex(index, _types.TokenType.string)) {
|
|
83002
83002
|
throw new Error("Expected string token at the end of star export statement.");
|
|
83003
83003
|
}
|
|
83004
|
-
const
|
|
83005
|
-
const importInfo = this.getImportInfo(
|
|
83004
|
+
const path56 = this.tokens.stringValueAtIndex(index);
|
|
83005
|
+
const importInfo = this.getImportInfo(path56);
|
|
83006
83006
|
if (exportedName !== null) {
|
|
83007
83007
|
importInfo.exportStarNames.push(exportedName);
|
|
83008
83008
|
} else {
|
|
@@ -83042,8 +83042,8 @@ var require_CJSImportProcessor = __commonJS({
|
|
|
83042
83042
|
* Get a mutable import info object for this path, creating one if it doesn't
|
|
83043
83043
|
* exist yet.
|
|
83044
83044
|
*/
|
|
83045
|
-
getImportInfo(
|
|
83046
|
-
const existingInfo = this.importInfoByPath.get(
|
|
83045
|
+
getImportInfo(path56) {
|
|
83046
|
+
const existingInfo = this.importInfoByPath.get(path56);
|
|
83047
83047
|
if (existingInfo) {
|
|
83048
83048
|
return existingInfo;
|
|
83049
83049
|
}
|
|
@@ -83056,7 +83056,7 @@ var require_CJSImportProcessor = __commonJS({
|
|
|
83056
83056
|
exportStarNames: [],
|
|
83057
83057
|
hasStarExport: false
|
|
83058
83058
|
};
|
|
83059
|
-
this.importInfoByPath.set(
|
|
83059
|
+
this.importInfoByPath.set(path56, newInfo);
|
|
83060
83060
|
return newInfo;
|
|
83061
83061
|
}
|
|
83062
83062
|
addExportBinding(localName, exportedName) {
|
|
@@ -83636,16 +83636,16 @@ var require_resolve_uri_umd = __commonJS({
|
|
|
83636
83636
|
}
|
|
83637
83637
|
function parseFileUrl(input2) {
|
|
83638
83638
|
const match = fileRegex.exec(input2);
|
|
83639
|
-
const
|
|
83640
|
-
return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(
|
|
83639
|
+
const path56 = match[2];
|
|
83640
|
+
return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path56) ? path56 : "/" + path56, match[3] || "", match[4] || "");
|
|
83641
83641
|
}
|
|
83642
|
-
function makeUrl(scheme, user, host, port,
|
|
83642
|
+
function makeUrl(scheme, user, host, port, path56, query, hash2) {
|
|
83643
83643
|
return {
|
|
83644
83644
|
scheme,
|
|
83645
83645
|
user,
|
|
83646
83646
|
host,
|
|
83647
83647
|
port,
|
|
83648
|
-
path:
|
|
83648
|
+
path: path56,
|
|
83649
83649
|
query,
|
|
83650
83650
|
hash: hash2,
|
|
83651
83651
|
type: 7
|
|
@@ -83675,11 +83675,11 @@ var require_resolve_uri_umd = __commonJS({
|
|
|
83675
83675
|
url2.type = input2 ? input2.startsWith("?") ? 3 : input2.startsWith("#") ? 2 : 4 : 1;
|
|
83676
83676
|
return url2;
|
|
83677
83677
|
}
|
|
83678
|
-
function stripPathFilename(
|
|
83679
|
-
if (
|
|
83680
|
-
return
|
|
83681
|
-
const index =
|
|
83682
|
-
return
|
|
83678
|
+
function stripPathFilename(path56) {
|
|
83679
|
+
if (path56.endsWith("/.."))
|
|
83680
|
+
return path56;
|
|
83681
|
+
const index = path56.lastIndexOf("/");
|
|
83682
|
+
return path56.slice(0, index + 1);
|
|
83683
83683
|
}
|
|
83684
83684
|
function mergePaths(url2, base) {
|
|
83685
83685
|
normalizePath(base, base.type);
|
|
@@ -83717,14 +83717,14 @@ var require_resolve_uri_umd = __commonJS({
|
|
|
83717
83717
|
pieces[pointer++] = piece;
|
|
83718
83718
|
positive++;
|
|
83719
83719
|
}
|
|
83720
|
-
let
|
|
83720
|
+
let path56 = "";
|
|
83721
83721
|
for (let i = 1; i < pointer; i++) {
|
|
83722
|
-
|
|
83722
|
+
path56 += "/" + pieces[i];
|
|
83723
83723
|
}
|
|
83724
|
-
if (!
|
|
83725
|
-
|
|
83724
|
+
if (!path56 || addTrailingSlash && !path56.endsWith("/..")) {
|
|
83725
|
+
path56 += "/";
|
|
83726
83726
|
}
|
|
83727
|
-
url2.path =
|
|
83727
|
+
url2.path = path56;
|
|
83728
83728
|
}
|
|
83729
83729
|
function resolve2(input2, base) {
|
|
83730
83730
|
if (!input2 && !base)
|
|
@@ -83765,13 +83765,13 @@ var require_resolve_uri_umd = __commonJS({
|
|
|
83765
83765
|
case 3:
|
|
83766
83766
|
return queryHash;
|
|
83767
83767
|
case 4: {
|
|
83768
|
-
const
|
|
83769
|
-
if (!
|
|
83768
|
+
const path56 = url2.path.slice(1);
|
|
83769
|
+
if (!path56)
|
|
83770
83770
|
return queryHash || ".";
|
|
83771
|
-
if (isRelative(base || input2) && !isRelative(
|
|
83772
|
-
return "./" +
|
|
83771
|
+
if (isRelative(base || input2) && !isRelative(path56)) {
|
|
83772
|
+
return "./" + path56 + queryHash;
|
|
83773
83773
|
}
|
|
83774
|
-
return
|
|
83774
|
+
return path56 + queryHash;
|
|
83775
83775
|
}
|
|
83776
83776
|
case 5:
|
|
83777
83777
|
return url2.path + queryHash;
|
|
@@ -83870,10 +83870,10 @@ var require_trace_mapping_umd = __commonJS({
|
|
|
83870
83870
|
module2.exports = __toCommonJS2(trace_mapping_exports);
|
|
83871
83871
|
var import_sourcemap_codec = __toESM2(require_sourcemap_codec());
|
|
83872
83872
|
var import_resolve_uri = __toESM2(require_resolve_uri());
|
|
83873
|
-
function stripFilename(
|
|
83874
|
-
if (!
|
|
83875
|
-
const index =
|
|
83876
|
-
return
|
|
83873
|
+
function stripFilename(path56) {
|
|
83874
|
+
if (!path56) return "";
|
|
83875
|
+
const index = path56.lastIndexOf("/");
|
|
83876
|
+
return path56.slice(0, index + 1);
|
|
83877
83877
|
}
|
|
83878
83878
|
function resolver(mapUrl, sourceRoot) {
|
|
83879
83879
|
const from = stripFilename(mapUrl);
|
|
@@ -85081,9 +85081,9 @@ var require_util9 = __commonJS({
|
|
|
85081
85081
|
/** @class */
|
|
85082
85082
|
(function(_super) {
|
|
85083
85083
|
__extends2(VError2, _super);
|
|
85084
|
-
function VError2(
|
|
85084
|
+
function VError2(path56, message) {
|
|
85085
85085
|
var _this = _super.call(this, message) || this;
|
|
85086
|
-
_this.path =
|
|
85086
|
+
_this.path = path56;
|
|
85087
85087
|
Object.setPrototypeOf(_this, VError2.prototype);
|
|
85088
85088
|
return _this;
|
|
85089
85089
|
}
|
|
@@ -85143,26 +85143,26 @@ var require_util9 = __commonJS({
|
|
|
85143
85143
|
(_b = this._messages).push.apply(_b, best._messages);
|
|
85144
85144
|
}
|
|
85145
85145
|
};
|
|
85146
|
-
DetailContext2.prototype.getError = function(
|
|
85146
|
+
DetailContext2.prototype.getError = function(path56) {
|
|
85147
85147
|
var msgParts = [];
|
|
85148
85148
|
for (var i = this._propNames.length - 1; i >= 0; i--) {
|
|
85149
85149
|
var p2 = this._propNames[i];
|
|
85150
|
-
|
|
85150
|
+
path56 += typeof p2 === "number" ? "[" + p2 + "]" : p2 ? "." + p2 : "";
|
|
85151
85151
|
var m = this._messages[i];
|
|
85152
85152
|
if (m) {
|
|
85153
|
-
msgParts.push(
|
|
85153
|
+
msgParts.push(path56 + " " + m);
|
|
85154
85154
|
}
|
|
85155
85155
|
}
|
|
85156
|
-
return new VError(
|
|
85156
|
+
return new VError(path56, msgParts.join("; "));
|
|
85157
85157
|
};
|
|
85158
|
-
DetailContext2.prototype.getErrorDetail = function(
|
|
85158
|
+
DetailContext2.prototype.getErrorDetail = function(path56) {
|
|
85159
85159
|
var details = [];
|
|
85160
85160
|
for (var i = this._propNames.length - 1; i >= 0; i--) {
|
|
85161
85161
|
var p2 = this._propNames[i];
|
|
85162
|
-
|
|
85162
|
+
path56 += typeof p2 === "number" ? "[" + p2 + "]" : p2 ? "." + p2 : "";
|
|
85163
85163
|
var message = this._messages[i];
|
|
85164
85164
|
if (message) {
|
|
85165
|
-
details.push({ path:
|
|
85165
|
+
details.push({ path: path56, message });
|
|
85166
85166
|
}
|
|
85167
85167
|
}
|
|
85168
85168
|
var detail = null;
|
|
@@ -85975,8 +85975,8 @@ var require_dist2 = __commonJS({
|
|
|
85975
85975
|
this.checkerPlain = this.ttype.getChecker(suite, false);
|
|
85976
85976
|
this.checkerStrict = this.ttype.getChecker(suite, true);
|
|
85977
85977
|
}
|
|
85978
|
-
Checker2.prototype.setReportedPath = function(
|
|
85979
|
-
this._path =
|
|
85978
|
+
Checker2.prototype.setReportedPath = function(path56) {
|
|
85979
|
+
this._path = path56;
|
|
85980
85980
|
};
|
|
85981
85981
|
Checker2.prototype.check = function(value) {
|
|
85982
85982
|
return this._doCheck(this.checkerPlain, value);
|
|
@@ -91409,9 +91409,9 @@ var require_CJSImportTransformer = __commonJS({
|
|
|
91409
91409
|
if (shouldElideImport) {
|
|
91410
91410
|
this.tokens.removeToken();
|
|
91411
91411
|
} else {
|
|
91412
|
-
const
|
|
91413
|
-
this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(
|
|
91414
|
-
this.tokens.appendCode(this.importProcessor.claimImportCode(
|
|
91412
|
+
const path56 = this.tokens.stringValue();
|
|
91413
|
+
this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(path56));
|
|
91414
|
+
this.tokens.appendCode(this.importProcessor.claimImportCode(path56));
|
|
91415
91415
|
}
|
|
91416
91416
|
_removeMaybeImportAttributes.removeMaybeImportAttributes.call(void 0, this.tokens);
|
|
91417
91417
|
if (this.tokens.matches1(_types.TokenType.semi)) {
|
|
@@ -91991,8 +91991,8 @@ var require_CJSImportTransformer = __commonJS({
|
|
|
91991
91991
|
}
|
|
91992
91992
|
if (this.tokens.matchesContextual(_keywords.ContextualKeyword._from)) {
|
|
91993
91993
|
this.tokens.removeToken();
|
|
91994
|
-
const
|
|
91995
|
-
this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(
|
|
91994
|
+
const path56 = this.tokens.stringValue();
|
|
91995
|
+
this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(path56));
|
|
91996
91996
|
_removeMaybeImportAttributes.removeMaybeImportAttributes.call(void 0, this.tokens);
|
|
91997
91997
|
} else {
|
|
91998
91998
|
this.tokens.appendCode(exportStatements.join(" "));
|
|
@@ -92006,8 +92006,8 @@ var require_CJSImportTransformer = __commonJS({
|
|
|
92006
92006
|
while (!this.tokens.matches1(_types.TokenType.string)) {
|
|
92007
92007
|
this.tokens.removeToken();
|
|
92008
92008
|
}
|
|
92009
|
-
const
|
|
92010
|
-
this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(
|
|
92009
|
+
const path56 = this.tokens.stringValue();
|
|
92010
|
+
this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(path56));
|
|
92011
92011
|
_removeMaybeImportAttributes.removeMaybeImportAttributes.call(void 0, this.tokens);
|
|
92012
92012
|
if (this.tokens.matches1(_types.TokenType.semi)) {
|
|
92013
92013
|
this.tokens.removeToken();
|
|
@@ -121861,9 +121861,9 @@ var init_bundle_mjs = __esm({
|
|
|
121861
121861
|
processClassesRecursively(value, getPart(classPartObject, key), classGroupId, theme);
|
|
121862
121862
|
}
|
|
121863
121863
|
};
|
|
121864
|
-
getPart = (classPartObject,
|
|
121864
|
+
getPart = (classPartObject, path56) => {
|
|
121865
121865
|
let current2 = classPartObject;
|
|
121866
|
-
const parts =
|
|
121866
|
+
const parts = path56.split(CLASS_PART_SEPARATOR);
|
|
121867
121867
|
const len = parts.length;
|
|
121868
121868
|
for (let i = 0; i < len; i++) {
|
|
121869
121869
|
const part = parts[i];
|
|
@@ -144279,14 +144279,14 @@ var require_svgPath = __commonJS({
|
|
|
144279
144279
|
["Z", 0],
|
|
144280
144280
|
["z", 0]
|
|
144281
144281
|
]);
|
|
144282
|
-
var parse4 = function(
|
|
144282
|
+
var parse4 = function(path56) {
|
|
144283
144283
|
var cmd;
|
|
144284
144284
|
var ret = [];
|
|
144285
144285
|
var args2 = [];
|
|
144286
144286
|
var curArg = "";
|
|
144287
144287
|
var foundDecimal = false;
|
|
144288
144288
|
var params = 0;
|
|
144289
|
-
for (var _i2 = 0, path_1 =
|
|
144289
|
+
for (var _i2 = 0, path_1 = path56; _i2 < path_1.length; _i2++) {
|
|
144290
144290
|
var c2 = path_1[_i2];
|
|
144291
144291
|
if (parameters.has(c2)) {
|
|
144292
144292
|
params = parameters.get(c2);
|
|
@@ -144600,8 +144600,8 @@ var require_svgPath = __commonJS({
|
|
|
144600
144600
|
];
|
|
144601
144601
|
return result;
|
|
144602
144602
|
};
|
|
144603
|
-
exports.svgPathToOperators = function(
|
|
144604
|
-
return apply(parse4(
|
|
144603
|
+
exports.svgPathToOperators = function(path56) {
|
|
144604
|
+
return apply(parse4(path56));
|
|
144605
144605
|
};
|
|
144606
144606
|
}
|
|
144607
144607
|
});
|
|
@@ -144784,7 +144784,7 @@ var require_operations = __commonJS({
|
|
|
144784
144784
|
operators_1.popGraphicsState()
|
|
144785
144785
|
]).filter(Boolean);
|
|
144786
144786
|
};
|
|
144787
|
-
exports.drawSvgPath = function(
|
|
144787
|
+
exports.drawSvgPath = function(path56, options) {
|
|
144788
144788
|
var _a4, _b, _c;
|
|
144789
144789
|
return tslib_1.__spreadArrays([
|
|
144790
144790
|
operators_1.pushGraphicsState(),
|
|
@@ -144798,7 +144798,7 @@ var require_operations = __commonJS({
|
|
|
144798
144798
|
options.borderWidth && operators_1.setLineWidth(options.borderWidth),
|
|
144799
144799
|
options.borderLineCap && operators_1.setLineCap(options.borderLineCap),
|
|
144800
144800
|
operators_1.setDashPattern((_b = options.borderDashArray) !== null && _b !== void 0 ? _b : [], (_c = options.borderDashPhase) !== null && _c !== void 0 ? _c : 0)
|
|
144801
|
-
], svgPath_1.svgPathToOperators(
|
|
144801
|
+
], svgPath_1.svgPathToOperators(path56), [
|
|
144802
144802
|
// prettier-ignore
|
|
144803
144803
|
options.color && options.borderWidth ? operators_1.fillAndStroke() : options.color ? operators_1.fill() : options.borderColor ? operators_1.stroke() : operators_1.closePath(),
|
|
144804
144804
|
operators_1.popGraphicsState()
|
|
@@ -149096,12 +149096,12 @@ var require_PDFPage = __commonJS({
|
|
|
149096
149096
|
graphicsState: graphicsStateKey
|
|
149097
149097
|
}));
|
|
149098
149098
|
};
|
|
149099
|
-
PDFPage2.prototype.drawSvgPath = function(
|
|
149099
|
+
PDFPage2.prototype.drawSvgPath = function(path56, options) {
|
|
149100
149100
|
var _a4, _b, _c, _d, _e2, _f, _g, _h, _j;
|
|
149101
149101
|
if (options === void 0) {
|
|
149102
149102
|
options = {};
|
|
149103
149103
|
}
|
|
149104
|
-
utils_1.assertIs(
|
|
149104
|
+
utils_1.assertIs(path56, "path", ["string"]);
|
|
149105
149105
|
utils_1.assertOrUndefined(options.x, "options.x", ["number"]);
|
|
149106
149106
|
utils_1.assertOrUndefined(options.y, "options.y", ["number"]);
|
|
149107
149107
|
utils_1.assertOrUndefined(options.scale, "options.scale", ["number"]);
|
|
@@ -149130,7 +149130,7 @@ var require_PDFPage = __commonJS({
|
|
|
149130
149130
|
options.borderColor = colors_1.rgb(0, 0, 0);
|
|
149131
149131
|
}
|
|
149132
149132
|
var contentStream = this.getContentStream();
|
|
149133
|
-
contentStream.push.apply(contentStream, operations_1.drawSvgPath(
|
|
149133
|
+
contentStream.push.apply(contentStream, operations_1.drawSvgPath(path56, {
|
|
149134
149134
|
x: (_a4 = options.x) !== null && _a4 !== void 0 ? _a4 : this.x,
|
|
149135
149135
|
y: (_b = options.y) !== null && _b !== void 0 ? _b : this.y,
|
|
149136
149136
|
scale: options.scale,
|
|
@@ -151571,8 +151571,8 @@ function checkPackage(bytes2, mainPart) {
|
|
|
151571
151571
|
xml.on("opentag", ({ local, attributes }) => {
|
|
151572
151572
|
if (local !== "Relationship") return;
|
|
151573
151573
|
const target = attributes.Target?.value ?? "";
|
|
151574
|
-
const
|
|
151575
|
-
if (
|
|
151574
|
+
const external2 = (attributes.TargetMode?.value ?? "").toLowerCase() === "external" || /^(?:[a-z][\w+.-]*:|\/\/|\\)/i.test(target.trim());
|
|
151575
|
+
if (external2 && !attributes.Type?.value.endsWith("/hyperlink")) throw Error("Office package links to external content");
|
|
151576
151576
|
});
|
|
151577
151577
|
xml.write((0, import_fflate.strFromU8)(part)).close();
|
|
151578
151578
|
}
|
|
@@ -151764,8 +151764,8 @@ function useRunnerHome() {
|
|
|
151764
151764
|
|
|
151765
151765
|
// src/flow-worker.ts
|
|
151766
151766
|
import { spawn as spawn6 } from "node:child_process";
|
|
151767
|
-
import
|
|
151768
|
-
import
|
|
151767
|
+
import fs50 from "node:fs";
|
|
151768
|
+
import path55 from "node:path";
|
|
151769
151769
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
151770
151770
|
|
|
151771
151771
|
// ../cli/src/lib/cloud/session.ts
|
|
@@ -153280,10 +153280,10 @@ function mergeDefs(...defs) {
|
|
|
153280
153280
|
function cloneDef(schema) {
|
|
153281
153281
|
return mergeDefs(schema._zod.def);
|
|
153282
153282
|
}
|
|
153283
|
-
function getElementAtPath(obj3,
|
|
153284
|
-
if (!
|
|
153283
|
+
function getElementAtPath(obj3, path56) {
|
|
153284
|
+
if (!path56)
|
|
153285
153285
|
return obj3;
|
|
153286
|
-
return
|
|
153286
|
+
return path56.reduce((acc, key) => acc?.[key], obj3);
|
|
153287
153287
|
}
|
|
153288
153288
|
function promiseAllObject(promisesObj) {
|
|
153289
153289
|
const keys = Object.keys(promisesObj);
|
|
@@ -153623,11 +153623,11 @@ function explicitlyAborted(x2, startIndex = 0) {
|
|
|
153623
153623
|
}
|
|
153624
153624
|
return false;
|
|
153625
153625
|
}
|
|
153626
|
-
function prefixIssues(
|
|
153626
|
+
function prefixIssues(path56, issues) {
|
|
153627
153627
|
return issues.map((iss) => {
|
|
153628
153628
|
var _a4;
|
|
153629
153629
|
(_a4 = iss).path ?? (_a4.path = []);
|
|
153630
|
-
iss.path.unshift(
|
|
153630
|
+
iss.path.unshift(path56);
|
|
153631
153631
|
return iss;
|
|
153632
153632
|
});
|
|
153633
153633
|
}
|
|
@@ -154089,16 +154089,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
|
|
|
154089
154089
|
}
|
|
154090
154090
|
function formatError(error62, mapper = (issue2) => issue2.message) {
|
|
154091
154091
|
const fieldErrors = { _errors: [] };
|
|
154092
|
-
const processError = (error63,
|
|
154092
|
+
const processError = (error63, path56 = []) => {
|
|
154093
154093
|
for (const issue2 of error63.issues) {
|
|
154094
154094
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
154095
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
154095
|
+
issue2.errors.map((issues) => processError({ issues }, [...path56, ...issue2.path]));
|
|
154096
154096
|
} else if (issue2.code === "invalid_key") {
|
|
154097
|
-
processError({ issues: issue2.issues }, [...
|
|
154097
|
+
processError({ issues: issue2.issues }, [...path56, ...issue2.path]);
|
|
154098
154098
|
} else if (issue2.code === "invalid_element") {
|
|
154099
|
-
processError({ issues: issue2.issues }, [...
|
|
154099
|
+
processError({ issues: issue2.issues }, [...path56, ...issue2.path]);
|
|
154100
154100
|
} else {
|
|
154101
|
-
const fullpath = [...
|
|
154101
|
+
const fullpath = [...path56, ...issue2.path];
|
|
154102
154102
|
if (fullpath.length === 0) {
|
|
154103
154103
|
fieldErrors._errors.push(mapper(issue2));
|
|
154104
154104
|
} else {
|
|
@@ -154137,17 +154137,17 @@ function formatError(error62, mapper = (issue2) => issue2.message) {
|
|
|
154137
154137
|
}
|
|
154138
154138
|
function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
154139
154139
|
const result = { errors: [] };
|
|
154140
|
-
const processError = (error63,
|
|
154140
|
+
const processError = (error63, path56 = []) => {
|
|
154141
154141
|
var _a4;
|
|
154142
154142
|
for (const issue2 of error63.issues) {
|
|
154143
154143
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
154144
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
154144
|
+
issue2.errors.map((issues) => processError({ issues }, [...path56, ...issue2.path]));
|
|
154145
154145
|
} else if (issue2.code === "invalid_key") {
|
|
154146
|
-
processError({ issues: issue2.issues }, [...
|
|
154146
|
+
processError({ issues: issue2.issues }, [...path56, ...issue2.path]);
|
|
154147
154147
|
} else if (issue2.code === "invalid_element") {
|
|
154148
|
-
processError({ issues: issue2.issues }, [...
|
|
154148
|
+
processError({ issues: issue2.issues }, [...path56, ...issue2.path]);
|
|
154149
154149
|
} else {
|
|
154150
|
-
const fullpath = [...
|
|
154150
|
+
const fullpath = [...path56, ...issue2.path];
|
|
154151
154151
|
if (fullpath.length === 0) {
|
|
154152
154152
|
result.errors.push(mapper(issue2));
|
|
154153
154153
|
continue;
|
|
@@ -154186,8 +154186,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
|
154186
154186
|
}
|
|
154187
154187
|
function toDotPath(_path) {
|
|
154188
154188
|
const segs = [];
|
|
154189
|
-
const
|
|
154190
|
-
for (const seg of
|
|
154189
|
+
const path56 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
154190
|
+
for (const seg of path56) {
|
|
154191
154191
|
if (typeof seg === "number")
|
|
154192
154192
|
segs.push(`[${seg}]`);
|
|
154193
154193
|
else if (typeof seg === "symbol")
|
|
@@ -169327,12 +169327,12 @@ function toJSONSchema(input2, params) {
|
|
|
169327
169327
|
processSchema(schema, ctx2);
|
|
169328
169328
|
}
|
|
169329
169329
|
const schemas = {};
|
|
169330
|
-
const
|
|
169330
|
+
const external2 = {
|
|
169331
169331
|
registry: registry2,
|
|
169332
169332
|
uri: params?.uri,
|
|
169333
169333
|
defs
|
|
169334
169334
|
};
|
|
169335
|
-
ctx2.external =
|
|
169335
|
+
ctx2.external = external2;
|
|
169336
169336
|
for (const entry of registry2._idmap.entries()) {
|
|
169337
169337
|
const [key, schema] = entry;
|
|
169338
169338
|
extractDefs(ctx2, schema);
|
|
@@ -171325,13 +171325,13 @@ function resolveRef(ref, ctx) {
|
|
|
171325
171325
|
if (!ref.startsWith("#")) {
|
|
171326
171326
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
171327
171327
|
}
|
|
171328
|
-
const
|
|
171329
|
-
if (
|
|
171328
|
+
const path56 = ref.slice(1).split("/").filter(Boolean);
|
|
171329
|
+
if (path56.length === 0) {
|
|
171330
171330
|
return ctx.rootSchema;
|
|
171331
171331
|
}
|
|
171332
171332
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
171333
|
-
if (
|
|
171334
|
-
const key =
|
|
171333
|
+
if (path56[0] === defsKey) {
|
|
171334
|
+
const key = path56[1] === void 0 ? void 0 : decodeJSONPointerSegment(path56[1]);
|
|
171335
171335
|
if (!key || !ctx.defs[key]) {
|
|
171336
171336
|
throw new Error(`Reference not found: ${ref}`);
|
|
171337
171337
|
}
|
|
@@ -172321,7 +172321,7 @@ function cloudProblem(response, body) {
|
|
|
172321
172321
|
}
|
|
172322
172322
|
|
|
172323
172323
|
// src/protocol.ts
|
|
172324
|
-
var AKB_VERSION = true ? "0.11.
|
|
172324
|
+
var AKB_VERSION = true ? "0.11.85" : "0.0.0";
|
|
172325
172325
|
var AKB_CONTRACT = true ? 28 : 0;
|
|
172326
172326
|
|
|
172327
172327
|
// src/secrets.ts
|
|
@@ -172496,7 +172496,7 @@ var listFolders = (machineId) => request("GET", `/v1/runner/folders?machine=${q(
|
|
|
172496
172496
|
var listElsewhere = (machineId) => request("GET", `/v1/runner/folders?machine=${q(machineId)}&elsewhere=1`);
|
|
172497
172497
|
var listMachineTasks = (machineId) => request("GET", `/v1/runner/tasks?machine=${q(machineId)}`);
|
|
172498
172498
|
var stopTask = (task, how) => request("POST", how === "chat" ? `/v1/tasks/${q(task)}/chat/stop` : `/v1/tasks/${q(task)}/stop`, {});
|
|
172499
|
-
var addFolder = (machineId, name,
|
|
172499
|
+
var addFolder = (machineId, name, path56, project) => request("POST", "/v1/runner/folders", { machineId, name, path: path56, ...project ? { project } : {} });
|
|
172500
172500
|
async function createProject(name, workspace, key) {
|
|
172501
172501
|
const sent = await send("POST", "/v1/projects", { name, workspace }, true, TIMEOUT_MS, void 0, { "idempotency-key": key });
|
|
172502
172502
|
return sent.ok ? answerOf(sent.value) : sent;
|
|
@@ -172577,25 +172577,25 @@ import path12 from "node:path";
|
|
|
172577
172577
|
init_file_limits();
|
|
172578
172578
|
var ROOTS = ["todo/", ".archive/", "memory/", "studios/", "triage/", "assets/", "rules/"];
|
|
172579
172579
|
var SETTINGS = ["modules.md", "config.md"];
|
|
172580
|
-
var isSettingsPath = (
|
|
172581
|
-
function isBoardPath(
|
|
172582
|
-
if (!
|
|
172583
|
-
if (
|
|
172584
|
-
if (
|
|
172585
|
-
if (
|
|
172586
|
-
if (SETTINGS.includes(
|
|
172587
|
-
if (
|
|
172588
|
-
if (
|
|
172589
|
-
return ROOTS.some((root2) =>
|
|
172580
|
+
var isSettingsPath = (path56) => SETTINGS.includes(path56) || /^rules\/(?:studios\/[^/]+|proposer|project-writer|dismissal-reviewer|memory-pruner)\.md$/.test(path56);
|
|
172581
|
+
function isBoardPath(path56) {
|
|
172582
|
+
if (!path56 || path56.length > 500 || path56.startsWith("/") || path56.includes("\\") || path56.includes("\0")) return false;
|
|
172583
|
+
if (path56.split("/").some((part) => !part || part === "." || part === "..")) return false;
|
|
172584
|
+
if (path56 === "todo/README.md" || path56.split("/").includes(".sync")) return false;
|
|
172585
|
+
if (path56.startsWith("studios/")) return true;
|
|
172586
|
+
if (SETTINGS.includes(path56)) return true;
|
|
172587
|
+
if (path56.startsWith("rules/")) return isSettingsPath(path56);
|
|
172588
|
+
if (path56.startsWith("assets/")) return taskOfAssets(path56) !== null;
|
|
172589
|
+
return ROOTS.some((root2) => path56.startsWith(root2)) && path56.endsWith(".md");
|
|
172590
172590
|
}
|
|
172591
172591
|
var CARD = /^(?:todo|\.archive)\/(?:[^/]+\/)*(\d+)-[^/]*\.md$/;
|
|
172592
172592
|
var ROOT = /^(?:todo|\.archive)\/(?:[^/]+\/)*(\d+)-[^/]+\/root\.md$/;
|
|
172593
|
-
function numberOfCard(
|
|
172594
|
-
const n = ROOT.exec(
|
|
172593
|
+
function numberOfCard(path56) {
|
|
172594
|
+
const n = ROOT.exec(path56)?.[1] ?? CARD.exec(path56)?.[1];
|
|
172595
172595
|
return n ? Number(n) : null;
|
|
172596
172596
|
}
|
|
172597
172597
|
var assetsFile = (task) => `assets/${task}.json`;
|
|
172598
|
-
var taskOfAssets = (
|
|
172598
|
+
var taskOfAssets = (path56) => /^assets\/(task_[0-9a-f]+)\.json$/.exec(path56)?.[1] ?? null;
|
|
172599
172599
|
var studioFolder = (id2) => id2.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
172600
172600
|
var studioName = (id2) => id2.startsWith("wf_builtin_") ? id2.slice("wf_builtin_".length).replace(/_/g, "-") : studioFolder(id2);
|
|
172601
172601
|
var studioRuleFile = (id2) => `rules/studios/${studioName(id2)}.md`;
|
|
@@ -172857,7 +172857,7 @@ function landSections(body, previews) {
|
|
|
172857
172857
|
}
|
|
172858
172858
|
function parseStudioFile(id2, source2, from, { requirePreviewCopy = false, requireLand = false } = {}) {
|
|
172859
172859
|
const problems = [];
|
|
172860
|
-
const fail = (offset,
|
|
172860
|
+
const fail = (offset, path56, code, message, hint2) => problems.push({ file: from, ...sourcePosition(source2, offset), path: path56, code, message, hint: hint2 });
|
|
172861
172861
|
const result = () => ({ problem: problems.map((p2) => `${p2.file}:${p2.line}:${p2.column} ${p2.path}: ${p2.code} \u2014 ${p2.message}. ${p2.hint}`).join("\n"), problems });
|
|
172862
172862
|
if (!STUDIO_ID.test(id2)) fail(0, "id", "studio-schema", `Invalid Studio ID ${id2}`, "Use lowercase letters, digits and dashes.");
|
|
172863
172863
|
const front = /^---\r?\n([^]*?)\r?\n---(?:\r?\n|$)/.exec(source2);
|
|
@@ -174069,14 +174069,137 @@ async function stopConnection(root2, timeout) {
|
|
|
174069
174069
|
}
|
|
174070
174070
|
|
|
174071
174071
|
// src/flow.ts
|
|
174072
|
-
import
|
|
174072
|
+
import fs38 from "node:fs";
|
|
174073
174073
|
import os6 from "node:os";
|
|
174074
|
-
import
|
|
174074
|
+
import path44 from "node:path";
|
|
174075
174075
|
import { isDeepStrictEqual as isDeepStrictEqual2 } from "node:util";
|
|
174076
174076
|
|
|
174077
174077
|
// ../cli/src/lib/agent/approved-ui.ts
|
|
174078
174078
|
import path18 from "node:path";
|
|
174079
174079
|
|
|
174080
|
+
// ../artifact-sdk/src/builtin/compare.json
|
|
174081
|
+
var compare_default = '{\n "name": "compare",\n "title": { "en": "Compare", "zh": "\u5BF9\u6BD4" },\n "types": ["compare"],\n "schema": {\n "type": "object",\n "required": ["a", "b"],\n "properties": { "a": { "type": "string" }, "b": { "type": "string" } }\n },\n "references": [\n { "json": "/a", "types": ["storyboard", "compare", "spritesheet", "studio"] },\n { "json": "/b", "types": ["storyboard", "compare", "spritesheet", "studio"] },\n { "json": "/shots", "types": ["storyboard", "compare", "spritesheet", "studio"] }\n ]\n}\n';
|
|
174082
|
+
|
|
174083
|
+
// ../artifact-sdk/src/builtin/html.json
|
|
174084
|
+
var html_default = `{
|
|
174085
|
+
"name": "html",
|
|
174086
|
+
"title": { "en": "Page", "zh": "\u9875\u9762" },
|
|
174087
|
+
"types": ["html"],
|
|
174088
|
+
"references": [
|
|
174089
|
+
{ "text": "<[a-z][^<>]*?\\\\ssrc\\\\s*=\\\\s*[\\"']([^\\"']+)[\\"']" },
|
|
174090
|
+
{ "text": "<[a-z][^<>]*?\\\\sposter\\\\s*=\\\\s*[\\"']([^\\"']+)[\\"']" },
|
|
174091
|
+
{ "text": "<[a-z][^<>]*?\\\\ssrcset\\\\s*=\\\\s*[\\"']([^\\"']+)[\\"']", "list": "," },
|
|
174092
|
+
{ "text": "<link\\\\b[^<>]*?\\\\shref\\\\s*=\\\\s*[\\"']([^\\"']+)[\\"']" },
|
|
174093
|
+
{ "text": "url\\\\(\\\\s*[\\"']?([^\\"')]+?)[\\"']?\\\\s*\\\\)" }
|
|
174094
|
+
],
|
|
174095
|
+
"skip": ["(?<=<script\\\\b[^<>]*>)[\\\\s\\\\S]*?(?=</script\\\\s*>|$)"]
|
|
174096
|
+
}
|
|
174097
|
+
`;
|
|
174098
|
+
|
|
174099
|
+
// ../artifact-sdk/src/builtin/image.json
|
|
174100
|
+
var image_default = '{ "name": "image", "title": { "en": "Image", "zh": "\u56FE\u7247" }, "types": ["image"] }\n';
|
|
174101
|
+
|
|
174102
|
+
// ../artifact-sdk/src/builtin/markdown.json
|
|
174103
|
+
var markdown_default = `{
|
|
174104
|
+
"name": "markdown",
|
|
174105
|
+
"title": { "en": "Document", "zh": "\u6587\u6863" },
|
|
174106
|
+
"types": ["markdown"],
|
|
174107
|
+
"references": [
|
|
174108
|
+
{ "text": "!\\\\[[^\\\\]\\\\n]*\\\\]\\\\(\\\\s*<?([^\\\\s)>]+)>?(?:\\\\s+[\\"'][^\\"'\\\\n]*[\\"'])?\\\\s*\\\\)" },
|
|
174109
|
+
{ "text": "<img\\\\b[^<>]*?\\\\ssrc\\\\s*=\\\\s*[\\"']([^\\"']+)[\\"']" }
|
|
174110
|
+
]
|
|
174111
|
+
}
|
|
174112
|
+
`;
|
|
174113
|
+
|
|
174114
|
+
// ../artifact-sdk/src/builtin/spritesheet.json
|
|
174115
|
+
var spritesheet_default = '{\n "name": "spritesheet",\n "title": { "en": "Sprite animation", "zh": "\u7CBE\u7075\u52A8\u753B" },\n "types": ["spritesheet"],\n "schema": {\n "type": "object",\n "required": ["frames", "meta"],\n "properties": {\n "frames": {\n "anyOf": [\n { "type": "array", "minItems": 1, "items": { "type": "object", "required": ["frame"] } },\n { "type": "object", "additionalProperties": { "type": "object", "required": ["frame"] } }\n ]\n },\n "meta": {\n "type": "object",\n "required": ["app", "image"],\n "properties": { "app": { "type": "string", "pattern": "codeandweb\\\\.com/texturepacker" }, "image": { "type": "string" } }\n }\n }\n },\n "references": [{ "json": "/meta/image" }]\n}\n';
|
|
174116
|
+
|
|
174117
|
+
// ../artifact-sdk/src/builtin/storyboard.json
|
|
174118
|
+
var storyboard_default = '{\n "name": "storyboard",\n "title": { "en": "Storyboard", "zh": "\u5206\u955C" },\n "types": ["storyboard"],\n "schema": {\n "type": "object",\n "anyOf": [{ "required": ["shots"] }, { "required": ["slides"] }],\n "properties": {\n "shots": {\n "type": "array",\n "items": {\n "type": "object",\n "properties": { "frames": { "type": "array", "items": { "type": "object", "properties": { "src": { "type": "string" } } } } }\n }\n },\n "slides": {\n "type": "array",\n "items": {\n "type": "object",\n "properties": {\n "preview": { "type": "object", "properties": { "src": { "type": "string" } } },\n "assets": { "type": "array", "items": { "type": "string" } }\n }\n }\n }\n }\n },\n "references": [\n { "json": "/shots/*/frames/*/src", "types": ["storyboard", "compare", "spritesheet", "studio"] },\n { "json": "/slides/*/preview/src", "types": ["storyboard", "compare", "spritesheet", "studio"] },\n { "json": "/slides/*/assets/*" }\n ]\n}\n';
|
|
174119
|
+
|
|
174120
|
+
// ../artifact-sdk/src/builtin/tiled.json
|
|
174121
|
+
var tiled_default = `{
|
|
174122
|
+
"name": "tiled",
|
|
174123
|
+
"title": { "en": "Tiled map", "zh": "Tiled \u5730\u56FE" },
|
|
174124
|
+
"types": ["tiled"],
|
|
174125
|
+
"references": [
|
|
174126
|
+
{ "text": "<tileset\\\\b[^<>]*?\\\\ssource\\\\s*=\\\\s*[\\"']([^\\"']+)[\\"']", "types": ["tiled"] },
|
|
174127
|
+
{ "text": "<image\\\\b[^<>]*?\\\\ssource\\\\s*=\\\\s*[\\"']([^\\"']+)[\\"']" },
|
|
174128
|
+
{ "text": "\\"source\\"\\\\s*:\\\\s*\\"([^\\"]+)\\"", "types": ["tiled"] },
|
|
174129
|
+
{ "text": "\\"image\\"\\\\s*:\\\\s*\\"([^\\"]+)\\"" }
|
|
174130
|
+
]
|
|
174131
|
+
}
|
|
174132
|
+
`;
|
|
174133
|
+
|
|
174134
|
+
// ../artifact-sdk/src/builtin/video.json
|
|
174135
|
+
var video_default = '{ "name": "video", "title": { "en": "Video", "zh": "\u89C6\u9891" }, "types": ["video"] }\n';
|
|
174136
|
+
|
|
174137
|
+
// ../artifact-sdk/src/builtin/studio.json
|
|
174138
|
+
var studio_default = '{\n "name": "studio",\n "title": {\n "en": "Studio",\n "zh": "\\u5de5\\u4f5c\\u53f0"\n },\n "types": [\n "studio"\n ],\n "schema": {\n "anyOf": [\n {\n "type": "object",\n "required": [\n "rounds",\n "land",\n "scheduled"\n ],\n "properties": {\n "rounds": {\n "type": "array",\n "items": {\n "type": "array",\n "minItems": 1,\n "items": {\n "type": "object",\n "required": [\n "agent",\n "title"\n ],\n "properties": {\n "agent": {\n "type": "string"\n },\n "title": {\n "type": "object",\n "required": [\n "en"\n ]\n }\n }\n }\n }\n },\n "land": {\n "type": "array",\n "items": {\n "type": "object",\n "required": [\n "agent",\n "title"\n ]\n }\n },\n "scheduled": {\n "type": "array",\n "items": {\n "type": "object",\n "required": [\n "agent",\n "title"\n ]\n }\n },\n "version": {\n "enum": [\n 1\n ]\n }\n }\n },\n {\n "type": "object",\n "required": [\n "version",\n "base",\n "fingerprint",\n "files"\n ],\n "properties": {\n "version": {\n "const": 2\n },\n "base": {\n "anyOf": [\n {\n "type": "null"\n },\n {\n "type": "object",\n "required": [\n "id",\n "version",\n "fingerprint"\n ],\n "properties": {\n "id": {\n "type": "string",\n "minLength": 1\n },\n "version": {\n "type": "integer",\n "minimum": 1\n },\n "fingerprint": {\n "type": "string",\n "minLength": 1\n }\n }\n }\n ]\n },\n "fingerprint": {\n "type": "string",\n "minLength": 1\n },\n "agents": {\n "type": "array",\n "maxItems": 500,\n "items": {\n "type": "object",\n "required": [\n "agent",\n "title"\n ],\n "properties": {\n "agent": {\n "type": "string",\n "minLength": 1\n },\n "title": {\n "type": "object",\n "required": [\n "en"\n ],\n "properties": {\n "en": {\n "type": "string",\n "minLength": 1\n },\n "zh": {\n "type": "string"\n }\n }\n }\n }\n }\n },\n "files": {\n "type": "array",\n "maxItems": 1000,\n "items": {\n "type": "object",\n "required": [\n "path",\n "before",\n "after"\n ],\n "properties": {\n "path": {\n "type": "string",\n "minLength": 1\n },\n "before": {\n "anyOf": [\n {\n "type": "string",\n "minLength": 1\n },\n {\n "type": "null"\n }\n ]\n },\n "after": {\n "anyOf": [\n {\n "type": "string",\n "minLength": 1\n },\n {\n "type": "null"\n }\n ]\n },\n "diff": {\n "type": "string",\n "minLength": 1\n }\n }\n }\n },\n "results": {\n "type": "array",\n "maxItems": 500,\n "items": {\n "anyOf": [\n {\n "type": "object",\n "required": [\n "agent",\n "component",\n "src"\n ],\n "properties": {\n "agent": {\n "type": "string",\n "minLength": 1\n },\n "component": {\n "const": "Asset"\n },\n "src": {\n "type": "string",\n "minLength": 1\n },\n "label": {\n "type": "string"\n },\n "alt": {\n "type": "string"\n },\n "device": {\n "enum": [\n "mobile",\n "desktop"\n ]\n },\n "loop": {\n "type": "boolean"\n },\n "variants": {\n "type": "object",\n "additionalProperties": {\n "type": "string",\n "minLength": 1\n }\n }\n }\n },\n {\n "type": "object",\n "required": [\n "agent",\n "component",\n "label",\n "items"\n ],\n "properties": {\n "agent": {\n "type": "string",\n "minLength": 1\n },\n "component": {\n "const": "Set"\n },\n "label": {\n "type": "string"\n },\n "items": {\n "type": "array",\n "minItems": 1,\n "maxItems": 500,\n "items": {\n "type": "object",\n "required": [\n "src"\n ],\n "properties": {\n "src": {\n "type": "string",\n "minLength": 1\n },\n "label": {\n "type": "string"\n },\n "alt": {\n "type": "string"\n },\n "device": {\n "enum": [\n "mobile",\n "desktop"\n ]\n },\n "loop": {\n "type": "boolean"\n },\n "variants": {\n "type": "object",\n "additionalProperties": {\n "type": "string",\n "minLength": 1\n }\n }\n }\n }\n }\n }\n },\n {\n "type": "object",\n "required": [\n "agent",\n "component",\n "a",\n "b"\n ],\n "properties": {\n "agent": {\n "type": "string",\n "minLength": 1\n },\n "component": {\n "const": "Compare"\n },\n "a": {\n "type": "string",\n "minLength": 1\n },\n "b": {\n "type": "string",\n "minLength": 1\n },\n "shots": {\n "type": "string",\n "minLength": 1\n },\n "label": {\n "type": "string"\n },\n "a-label": {\n "type": "string"\n },\n "b-label": {\n "type": "string"\n }\n }\n },\n {\n "type": "object",\n "required": [\n "agent",\n "component",\n "src"\n ],\n "properties": {\n "agent": {\n "type": "string",\n "minLength": 1\n },\n "component": {\n "const": "Storyboard"\n },\n "src": {\n "type": "string",\n "minLength": 1\n },\n "label": {\n "type": "string"\n }\n }\n }\n ]\n }\n }\n }\n }\n ]\n },\n "references": [\n {\n "json": "/files/*/before"\n },\n {\n "json": "/files/*/after"\n },\n {\n "json": "/files/*/diff"\n },\n {\n "json": "/results/*/src",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/variants/*",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/a",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/b",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/shots",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/items/*/src",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/items/*/variants/*",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/items/*/a",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/items/*/b",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/items/*/shots",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n }\n ]\n}\n';
|
|
174139
|
+
|
|
174140
|
+
// ../artifact-sdk/src/builtin/index.ts
|
|
174141
|
+
var read2 = (m) => typeof m === "string" ? JSON.parse(m) : m;
|
|
174142
|
+
var builtin_default = [html_default, image_default, video_default, markdown_default, storyboard_default, compare_default, studio_default, tiled_default, spritesheet_default].map(read2);
|
|
174143
|
+
|
|
174144
|
+
// ../artifact-sdk/src/internal/schema.ts
|
|
174145
|
+
var isObj = (v) => !!v && typeof v === "object" && !Array.isArray(v);
|
|
174146
|
+
function typeOk(type, v) {
|
|
174147
|
+
const types = Array.isArray(type) ? type : [type];
|
|
174148
|
+
return types.some(
|
|
174149
|
+
(t) => t === "null" ? v === null : t === "array" ? Array.isArray(v) : t === "object" ? isObj(v) : t === "integer" ? Number.isInteger(v) : t === "number" ? typeof v === "number" && Number.isFinite(v) : typeof v === t
|
|
174150
|
+
);
|
|
174151
|
+
}
|
|
174152
|
+
function schemaProblem(schema, value, at2 = "") {
|
|
174153
|
+
if (!isObj(schema)) return null;
|
|
174154
|
+
const s = schema;
|
|
174155
|
+
const here = at2 || "/";
|
|
174156
|
+
if (s.type !== void 0 && !typeOk(s.type, value)) return here;
|
|
174157
|
+
if (Array.isArray(s.enum) && !s.enum.some((e2) => JSON.stringify(e2) === JSON.stringify(value))) return here;
|
|
174158
|
+
if (s.const !== void 0 && JSON.stringify(s.const) !== JSON.stringify(value)) return here;
|
|
174159
|
+
if (Array.isArray(s.anyOf) && !s.anyOf.some((x2) => !schemaProblem(x2, value, at2))) return here;
|
|
174160
|
+
if (typeof value === "string") {
|
|
174161
|
+
if (typeof s.minLength === "number" && value.length < s.minLength) return here;
|
|
174162
|
+
if (typeof s.maxLength === "number" && value.length > s.maxLength) return here;
|
|
174163
|
+
if (typeof s.pattern === "string") {
|
|
174164
|
+
try {
|
|
174165
|
+
if (!new RegExp(s.pattern, "u").test(value)) return here;
|
|
174166
|
+
} catch {
|
|
174167
|
+
}
|
|
174168
|
+
}
|
|
174169
|
+
}
|
|
174170
|
+
if (typeof value === "number") {
|
|
174171
|
+
if (typeof s.minimum === "number" && value < s.minimum) return here;
|
|
174172
|
+
if (typeof s.maximum === "number" && value > s.maximum) return here;
|
|
174173
|
+
}
|
|
174174
|
+
if (Array.isArray(value)) {
|
|
174175
|
+
if (typeof s.minItems === "number" && value.length < s.minItems) return here;
|
|
174176
|
+
if (typeof s.maxItems === "number" && value.length > s.maxItems) return here;
|
|
174177
|
+
if (isObj(s.items)) {
|
|
174178
|
+
for (let i = 0; i < value.length; i++) {
|
|
174179
|
+
const bad = schemaProblem(s.items, value[i], `${at2}/${i}`);
|
|
174180
|
+
if (bad) return bad;
|
|
174181
|
+
}
|
|
174182
|
+
}
|
|
174183
|
+
}
|
|
174184
|
+
if (isObj(value)) {
|
|
174185
|
+
const props = isObj(s.properties) ? s.properties : {};
|
|
174186
|
+
if (Array.isArray(s.required)) {
|
|
174187
|
+
for (const k2 of s.required) if (typeof k2 === "string" && !(k2 in value)) return `${at2}/${k2}`;
|
|
174188
|
+
}
|
|
174189
|
+
for (const [k2, v] of Object.entries(value)) {
|
|
174190
|
+
if (k2 in props) {
|
|
174191
|
+
const bad = schemaProblem(props[k2], v, `${at2}/${k2}`);
|
|
174192
|
+
if (bad) return bad;
|
|
174193
|
+
} else if (s.additionalProperties === false) return `${at2}/${k2}`;
|
|
174194
|
+
else if (isObj(s.additionalProperties)) {
|
|
174195
|
+
const bad = schemaProblem(s.additionalProperties, v, `${at2}/${k2}`);
|
|
174196
|
+
if (bad) return bad;
|
|
174197
|
+
}
|
|
174198
|
+
}
|
|
174199
|
+
}
|
|
174200
|
+
return null;
|
|
174201
|
+
}
|
|
174202
|
+
|
|
174080
174203
|
// ../artifact-sdk/src/internal/references.ts
|
|
174081
174204
|
var STORYBOARD = ["storyboard"];
|
|
174082
174205
|
var STUDIO = ["studio"];
|
|
@@ -174181,6 +174304,124 @@ function kindOf(ext) {
|
|
|
174181
174304
|
return type.startsWith("video/") || type.startsWith("audio/") ? "video" : "asset";
|
|
174182
174305
|
}
|
|
174183
174306
|
|
|
174307
|
+
// ../artifact-sdk/src/internal/format/studio.ts
|
|
174308
|
+
var text = (v) => typeof v === "string" && v.length > 0;
|
|
174309
|
+
var source = (v) => text(v) && !/^(?:[a-z][\w+.-]*:|\/|#)|\\|[\u0000-\u001f]/i.test(v);
|
|
174310
|
+
var icon2 = (v) => v === void 0 || typeof v === "string" || Array.isArray(v) && v.length > 0 && v.length <= 12 && v.every((p2) => isObject2(p2) && text(p2.d) && /^[MmLlHhVvCcSsQqTtAaZz0-9.,\s-]+$/.test(p2.d) && ["f", "s"].every((k2) => p2[k2] === void 0 || typeof p2[k2] === "string" && /^[kwcgopsmlry]$/.test(p2[k2])) && (p2.o === void 0 || p2.o === true) && (p2.w === void 0 || typeof p2.w === "number" && p2.w > 0 && p2.w <= 3));
|
|
174311
|
+
var relativePath = (v) => source(v) && v.split("/").every((p2) => p2 && p2 !== "." && p2 !== "..");
|
|
174312
|
+
var optionalText = (v, keys) => keys.every((k2) => v[k2] === void 0 || typeof v[k2] === "string");
|
|
174313
|
+
var asset = (v) => isObject2(v) && source(v.src) && optionalText(v, ["label", "alt"]) && (v.alt === void 0 || !/[<>]/.test(v.alt)) && (v.device === void 0 || v.device === "desktop" || v.device === "mobile") && (v.loop === void 0 || typeof v.loop === "boolean") && (v.variants === void 0 || isObject2(v.variants) && Object.values(v.variants).every(source));
|
|
174314
|
+
function resultProblem(value, agents) {
|
|
174315
|
+
if (!Array.isArray(value) || value.length > 500) return "/results";
|
|
174316
|
+
for (let i = 0; i < value.length; i++) {
|
|
174317
|
+
const r2 = value[i];
|
|
174318
|
+
if (!isObject2(r2) || !text(r2.agent) || !agents.has(r2.agent) || !optionalText(r2, ["label"])) return `/results/${i}`;
|
|
174319
|
+
const valid = r2.component === "Asset" ? asset(r2) : r2.component === "Set" ? typeof r2.label === "string" && Array.isArray(r2.items) && r2.items.length > 0 && r2.items.length <= 500 && r2.items.every(asset) : r2.component === "Compare" ? source(r2.a) && source(r2.b) && (r2.shots === void 0 || source(r2.shots)) && optionalText(r2, ["a-label", "b-label"]) : r2.component === "Storyboard" && source(r2.src);
|
|
174320
|
+
if (!valid) return `/results/${i}`;
|
|
174321
|
+
}
|
|
174322
|
+
return null;
|
|
174323
|
+
}
|
|
174324
|
+
function reviewProblem(v) {
|
|
174325
|
+
if (!isObject2(v) || v.version !== 2) return "/version";
|
|
174326
|
+
if (!text(v.fingerprint)) return "/fingerprint";
|
|
174327
|
+
if (v.base !== null && !(isObject2(v.base) && text(v.base.id) && Number.isInteger(v.base.version) && Number(v.base.version) > 0 && text(v.base.fingerprint))) return "/base";
|
|
174328
|
+
if (v.agents !== void 0 && (!Array.isArray(v.agents) || v.agents.length > 500)) return "/agents";
|
|
174329
|
+
const agents = /* @__PURE__ */ new Set();
|
|
174330
|
+
for (const a2 of v.agents ?? []) {
|
|
174331
|
+
if (!isObject2(a2) || !text(a2.agent) || !/^[a-z][a-z0-9-]*$/.test(a2.agent) || agents.has(a2.agent) || !isObject2(a2.title) || !text(a2.title.en) || !optionalText(a2.title, ["zh"]) || !icon2(a2.icon)) return "/agents";
|
|
174332
|
+
agents.add(a2.agent);
|
|
174333
|
+
}
|
|
174334
|
+
if (!Array.isArray(v.files) || v.files.length > 1e3) return "/files";
|
|
174335
|
+
const paths = /* @__PURE__ */ new Set();
|
|
174336
|
+
for (const f2 of v.files) {
|
|
174337
|
+
if (!isObject2(f2) || !relativePath(f2.path) || paths.has(f2.path) || !(f2.before === null || source(f2.before)) || !(f2.after === null || source(f2.after)) || f2.before === null && f2.after === null || f2.diff !== void 0 && !source(f2.diff) || (f2.before === null || f2.after === null) && !f2.diff) return "/files";
|
|
174338
|
+
if (f2.path.startsWith("agents/") && !agents.has(f2.path.split("/")[1])) return "/files";
|
|
174339
|
+
paths.add(f2.path);
|
|
174340
|
+
}
|
|
174341
|
+
return v.results === void 0 ? null : resultProblem(v.results, agents);
|
|
174342
|
+
}
|
|
174343
|
+
var isReview = (v) => isObject2(v) && v.version === 2;
|
|
174344
|
+
|
|
174345
|
+
// ../artifact-sdk/src/internal/manifest.ts
|
|
174346
|
+
var BUILTINS = builtin_default;
|
|
174347
|
+
var manifestOf = (type) => BUILTINS.find((m) => m.types.includes(type));
|
|
174348
|
+
function typeOf(data, types) {
|
|
174349
|
+
const problem = (type) => type === "studio" && isReview(data) ? reviewProblem(data) : schemaProblem(manifestOf(type)?.schema, data);
|
|
174350
|
+
for (const type of types) if (!problem(type)) return { type };
|
|
174351
|
+
if (types.length !== 1) return { type: null };
|
|
174352
|
+
return { type: types[0], problem: `does not match ${types[0]} at ${problem(types[0])}` };
|
|
174353
|
+
}
|
|
174354
|
+
var isObject3 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
|
|
174355
|
+
var remote = (src) => !src || /^(?:[a-z][\w+.-]*:|\/|#)/i.test(src);
|
|
174356
|
+
function mapJson(node2, keys, at2, visit2) {
|
|
174357
|
+
if (!keys.length) return typeof node2 === "string" && node2 ? visit2(node2, at2) : node2;
|
|
174358
|
+
const [key, ...rest] = keys;
|
|
174359
|
+
if (Array.isArray(node2)) {
|
|
174360
|
+
if (key === "*") return node2.map((x2, i2) => mapJson(x2, rest, `${at2}/${i2}`, visit2));
|
|
174361
|
+
const i = Number(key);
|
|
174362
|
+
return Number.isInteger(i) && i in node2 ? node2.map((x2, j2) => j2 === i ? mapJson(x2, rest, `${at2}/${j2}`, visit2) : x2) : node2;
|
|
174363
|
+
}
|
|
174364
|
+
if (!isObject3(node2)) return node2;
|
|
174365
|
+
const out = { ...node2 };
|
|
174366
|
+
for (const k2 of key === "*" ? Object.keys(node2) : key in node2 ? [key] : []) out[k2] = mapJson(node2[k2], rest, `${at2}/${k2}`, visit2);
|
|
174367
|
+
return out;
|
|
174368
|
+
}
|
|
174369
|
+
function mapText(text3, rule, skipped, visit2, includeRemote) {
|
|
174370
|
+
let out = "";
|
|
174371
|
+
let last = 0;
|
|
174372
|
+
for (const m of text3.matchAll(new RegExp(rule.text, "gid"))) {
|
|
174373
|
+
const span = m.indices?.[1];
|
|
174374
|
+
if (!span || m[1] === void 0 || skipped.some(([a2, b2]) => span[0] >= a2 && span[0] < b2)) continue;
|
|
174375
|
+
const line = text3.slice(0, span[0]).split("\n").length;
|
|
174376
|
+
const one = (src) => remote(src) && !includeRemote ? src : visit2(src, line);
|
|
174377
|
+
const value = rule.list ? m[1].split(rule.list).map((part) => part.replace(/^(\s*)(\S+)/, (_2, space, src) => space + one(src))).join(rule.list) : one(m[1]);
|
|
174378
|
+
out += text3.slice(last, span[0]) + value;
|
|
174379
|
+
last = span[1];
|
|
174380
|
+
}
|
|
174381
|
+
return out + text3.slice(last);
|
|
174382
|
+
}
|
|
174383
|
+
function mapReferences(manifest, content, map3, includeRemote = false) {
|
|
174384
|
+
const skipped = (text3) => (manifest?.skip ?? []).flatMap((re3) => [...text3.matchAll(new RegExp(re3, "gi"))].map((m) => [m.index, m.index + m[0].length]));
|
|
174385
|
+
for (const rule of manifest?.references ?? []) {
|
|
174386
|
+
const types = rule.types ?? [];
|
|
174387
|
+
if ("json" in rule) {
|
|
174388
|
+
if (typeof content !== "string") content = mapJson(content, rule.json.split("/").filter(Boolean), "", (src, at2) => map3(src, { src, types, text: false, at: at2 || "/" }));
|
|
174389
|
+
} else if (typeof content === "string") {
|
|
174390
|
+
content = mapText(content, rule, skipped(content), (src, line) => map3(src, { src, types, text: true, line }), includeRemote);
|
|
174391
|
+
}
|
|
174392
|
+
}
|
|
174393
|
+
return content;
|
|
174394
|
+
}
|
|
174395
|
+
function referencesOf(manifest, content, includeRemote = false) {
|
|
174396
|
+
const found = [];
|
|
174397
|
+
mapReferences(manifest, content, (src, ref) => (found.push(ref), src), includeRemote);
|
|
174398
|
+
return found;
|
|
174399
|
+
}
|
|
174400
|
+
|
|
174401
|
+
// ../artifact-sdk/src/internal/file-references.ts
|
|
174402
|
+
var CSS = {
|
|
174403
|
+
name: "css",
|
|
174404
|
+
types: ["css"],
|
|
174405
|
+
references: [
|
|
174406
|
+
{ text: `@import\\s+["']([^"']+)["']` },
|
|
174407
|
+
{ text: `url\\(\\s*["']?([^"')]+?)["']?\\s*\\)` }
|
|
174408
|
+
],
|
|
174409
|
+
skip: ["/\\*[\\s\\S]*?\\*/"]
|
|
174410
|
+
};
|
|
174411
|
+
var fileManifest = (type, name) => type === "asset" && /\.css$/i.test(name) ? CSS : manifestOf(type);
|
|
174412
|
+
function splitFileReference(src) {
|
|
174413
|
+
const end = src.search(/[?#]/);
|
|
174414
|
+
return end < 0 ? [src, ""] : [src.slice(0, end), src.slice(end)];
|
|
174415
|
+
}
|
|
174416
|
+
function relativeFileReference(src, owner2) {
|
|
174417
|
+
const parts = owner2.split("/").slice(0, -1);
|
|
174418
|
+
for (const part of src.split("/")) {
|
|
174419
|
+
if (part === ".." && parts.length && parts.at(-1) !== "..") parts.pop();
|
|
174420
|
+
else if (part && part !== ".") parts.push(part);
|
|
174421
|
+
}
|
|
174422
|
+
return parts.join("/");
|
|
174423
|
+
}
|
|
174424
|
+
|
|
174184
174425
|
// ../artifact-sdk/src/internal/tags.ts
|
|
174185
174426
|
function variantsOf(raw, src) {
|
|
174186
174427
|
if (!raw) return [];
|
|
@@ -174212,13 +174453,34 @@ var APPROVED_UI_DIR_ENV = "AI4KANBAN_APPROVED_UI_DIR";
|
|
|
174212
174453
|
var UI_PREVIEW = "ui-design";
|
|
174213
174454
|
var historicalUiIds = Object.keys(CODING_PREVIEWS).filter((id2) => id2 !== UI_PREVIEW && CODING_PREVIEWS[id2] === UI_PREVIEW);
|
|
174214
174455
|
var object2 = (value) => isObject2(value) ? value : {};
|
|
174456
|
+
var artifactId = /^art_[a-z0-9]+$/i;
|
|
174457
|
+
var external = /^(?:[a-z][\w+.-]*:|\/|#)/i;
|
|
174458
|
+
function approvedUiSource(pins, src, owner2) {
|
|
174459
|
+
const [ref] = splitFileReference(src);
|
|
174460
|
+
if (artifactId.test(ref)) {
|
|
174461
|
+
const version2 = approvedUiPin(pins, ref).version;
|
|
174462
|
+
const names2 = Object.keys(pins).filter((name) => {
|
|
174463
|
+
const pin = approvedUiPin(pins, name);
|
|
174464
|
+
return pin.artifact === ref && (version2 === void 0 || pin.version === version2);
|
|
174465
|
+
});
|
|
174466
|
+
return names2.find((name) => !artifactId.test(name)) ?? names2[0] ?? ref;
|
|
174467
|
+
}
|
|
174468
|
+
const local = owner2 && !ref.startsWith(".assets/") ? relativeFileReference(ref, owner2) : ref;
|
|
174469
|
+
return [local, src, ref, path18.posix.normalize(local)].find((key) => Object.hasOwn(pins, key)) ?? local;
|
|
174470
|
+
}
|
|
174471
|
+
function approvedUiPin(pins, source2) {
|
|
174472
|
+
return object2(Object.hasOwn(pins, source2) ? pins[source2] : void 0);
|
|
174473
|
+
}
|
|
174474
|
+
function validUiPin(pin) {
|
|
174475
|
+
return !pin.error && pin.status !== "pending" && pin.status !== "failed" && typeof pin.artifact === "string" && artifactId.test(pin.artifact) && typeof pin.version === "number" && Number.isSafeInteger(pin.version) && pin.version > 0;
|
|
174476
|
+
}
|
|
174215
174477
|
function approvedUiPreviews(review) {
|
|
174216
174478
|
if (reviewAuthorization(review).kind !== "delivery") return [];
|
|
174217
174479
|
const result = [];
|
|
174218
|
-
for (const node2 of review.plan ?? []) {
|
|
174480
|
+
for (const [index, node2] of (review.plan ?? []).entries()) {
|
|
174219
174481
|
const stage = review.stages.find((stage2) => stage2.id === node2.id);
|
|
174220
174482
|
const snapshot = stage?.snapshot;
|
|
174221
|
-
if (!stage || !snapshot) continue;
|
|
174483
|
+
if (node2.kind === "work" || !stage || !snapshot) continue;
|
|
174222
174484
|
const evidence = object2(snapshot.evidence);
|
|
174223
174485
|
const content = object2(evidence.content);
|
|
174224
174486
|
const frozenPreviews = Array.isArray(snapshot.previews) ? snapshot.previews.filter(isObject2) : [];
|
|
@@ -174226,17 +174488,17 @@ function approvedUiPreviews(review) {
|
|
|
174226
174488
|
const preview = object2(content[id2]);
|
|
174227
174489
|
const body = typeof preview.body === "string" ? preview.body : typeof snapshot.body === "string" ? parsePreviewBlocks(snapshot.body).blocks.find((block) => block.id === id2)?.instructions : void 0;
|
|
174228
174490
|
if (!body) continue;
|
|
174229
|
-
const pins = { ...object2(frozenPreviews.find((preview2) => preview2.id === id2)?.assets), ...object2(evidence.assets) };
|
|
174491
|
+
const pins = { ...object2(evidence.dependencies), ...object2(frozenPreviews.find((preview2) => preview2.id === id2)?.assets), ...object2(evidence.assets) };
|
|
174230
174492
|
const files = /* @__PURE__ */ new Map();
|
|
174231
|
-
const add2 = (src, label, device) => {
|
|
174232
|
-
|
|
174233
|
-
const
|
|
174234
|
-
if (
|
|
174493
|
+
const add2 = (src, label, device, required2 = true) => {
|
|
174494
|
+
if (external.test(src)) return;
|
|
174495
|
+
const source2 = approvedUiSource(pins, src);
|
|
174496
|
+
if (!required2 && !Object.hasOwn(pins, source2) && !/\.(?:html?|tsx)$/i.test(source2)) return;
|
|
174235
174497
|
const name = label.trim() || path18.posix.basename(src);
|
|
174236
174498
|
const key = JSON.stringify([src, name]);
|
|
174237
174499
|
let file3 = files.get(key);
|
|
174238
174500
|
if (!file3) {
|
|
174239
|
-
file3 = { src,
|
|
174501
|
+
file3 = { src, source: source2, label: name, devices: /* @__PURE__ */ new Set() };
|
|
174240
174502
|
files.set(key, file3);
|
|
174241
174503
|
}
|
|
174242
174504
|
file3.devices.add(device === "mobile" ? "Mobile" : device === "desktop" ? "Desktop" : "Device unspecified");
|
|
@@ -174256,16 +174518,30 @@ function approvedUiPreviews(review) {
|
|
|
174256
174518
|
}
|
|
174257
174519
|
}
|
|
174258
174520
|
const listed = new Set([...files.values()].map((file3) => file3.src));
|
|
174259
|
-
for (const src of bodySources(body)) if (!listed.has(src)) add2(src, "");
|
|
174260
|
-
result.push(
|
|
174521
|
+
for (const src of bodySources(body)) if (!listed.has(src)) add2(src, "", void 0, false);
|
|
174522
|
+
if (files.size) result.push({
|
|
174523
|
+
id: id2,
|
|
174524
|
+
revision: stage.revision,
|
|
174525
|
+
directory: `review-${stage.revision}-${index}/${id2}`,
|
|
174526
|
+
body,
|
|
174527
|
+
pins,
|
|
174528
|
+
files: [...files.values()]
|
|
174529
|
+
});
|
|
174261
174530
|
}
|
|
174262
174531
|
}
|
|
174263
174532
|
return result;
|
|
174264
174533
|
}
|
|
174265
|
-
function approvedUiFile(directory3,
|
|
174266
|
-
const
|
|
174267
|
-
|
|
174268
|
-
|
|
174534
|
+
function approvedUiFile(directory3, preview, source2) {
|
|
174535
|
+
const parts = path18.posix.normalize(splitFileReference(source2)[0]).split("/");
|
|
174536
|
+
let parents = 0;
|
|
174537
|
+
while (parts[0] === "..") {
|
|
174538
|
+
parts.shift();
|
|
174539
|
+
parents++;
|
|
174540
|
+
}
|
|
174541
|
+
const rendered = /\.tsx$/i.test(parts.at(-1) ?? "");
|
|
174542
|
+
if (rendered) parts[parts.length - 1] = parts.at(-1).replace(/\.tsx$/i, ".html");
|
|
174543
|
+
const safe3 = parts.map((part) => !part || part === "." ? "%00" : part.replace(/[\\:*?"<>|%\x00-\x1f]/g, (char) => `%${char.charCodeAt(0).toString(16).padStart(2, "0")}`));
|
|
174544
|
+
return path18.join(directory3, preview.directory, `${rendered ? "rendered" : "files"}-${parents}`, ...safe3);
|
|
174269
174545
|
}
|
|
174270
174546
|
|
|
174271
174547
|
// ../cli/src/lib/agent/wire/json.ts
|
|
@@ -174846,7 +175122,7 @@ function priceUsd(provider, model, usage, at2 = Date.now()) {
|
|
|
174846
175122
|
import { readFileSync, readdirSync, statSync } from "node:fs";
|
|
174847
175123
|
import { homedir } from "node:os";
|
|
174848
175124
|
import { join } from "node:path";
|
|
174849
|
-
function
|
|
175125
|
+
function text2(value) {
|
|
174850
175126
|
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
174851
175127
|
}
|
|
174852
175128
|
function count(value) {
|
|
@@ -174905,10 +175181,10 @@ function findRollout(threadId) {
|
|
|
174905
175181
|
}
|
|
174906
175182
|
for (const name of names2) {
|
|
174907
175183
|
if (!name.startsWith("rollout-") || !name.endsWith(tail)) continue;
|
|
174908
|
-
const
|
|
175184
|
+
const path56 = join(dir, name);
|
|
174909
175185
|
try {
|
|
174910
|
-
const at2 = statSync(
|
|
174911
|
-
if (!newest2 || at2 > newest2.at) newest2 = { path:
|
|
175186
|
+
const at2 = statSync(path56).mtimeMs;
|
|
175187
|
+
if (!newest2 || at2 > newest2.at) newest2 = { path: path56, at: at2 };
|
|
174912
175188
|
} catch {
|
|
174913
175189
|
}
|
|
174914
175190
|
}
|
|
@@ -174916,11 +175192,11 @@ function findRollout(threadId) {
|
|
|
174916
175192
|
return newest2?.path;
|
|
174917
175193
|
}
|
|
174918
175194
|
function readCodexRunFacts(threadId) {
|
|
174919
|
-
const
|
|
174920
|
-
if (!
|
|
175195
|
+
const path56 = findRollout(threadId);
|
|
175196
|
+
if (!path56) return void 0;
|
|
174921
175197
|
let raw;
|
|
174922
175198
|
try {
|
|
174923
|
-
raw = readFileSync(
|
|
175199
|
+
raw = readFileSync(path56, "utf8");
|
|
174924
175200
|
} catch {
|
|
174925
175201
|
return void 0;
|
|
174926
175202
|
}
|
|
@@ -174952,8 +175228,8 @@ function readCodexRunFacts(threadId) {
|
|
|
174952
175228
|
} catch {
|
|
174953
175229
|
}
|
|
174954
175230
|
}
|
|
174955
|
-
if (entry.type === "session_meta") facts.provider ??=
|
|
174956
|
-
if (entry.type === "turn_context") facts.model =
|
|
175231
|
+
if (entry.type === "session_meta") facts.provider ??= text2(payload.model_provider);
|
|
175232
|
+
if (entry.type === "turn_context") facts.model = text2(payload.model) ?? facts.model;
|
|
174957
175233
|
if (payload.type === "token_count") {
|
|
174958
175234
|
facts.context = contextIn(payload.info) ?? facts.context;
|
|
174959
175235
|
const info = payload.info && typeof payload.info === "object" ? payload.info : {};
|
|
@@ -175032,8 +175308,8 @@ function renderCompleted(item) {
|
|
|
175032
175308
|
const changes = Array.isArray(item.changes) ? item.changes : [];
|
|
175033
175309
|
return changes.map((raw) => {
|
|
175034
175310
|
const change = obj(raw);
|
|
175035
|
-
const
|
|
175036
|
-
return
|
|
175311
|
+
const path56 = str2(change.path);
|
|
175312
|
+
return path56 ? `\u23FA ${str2(change.kind) || "change"}(${path56})
|
|
175037
175313
|
` : "";
|
|
175038
175314
|
}).join("");
|
|
175039
175315
|
}
|
|
@@ -175351,10 +175627,10 @@ function readKimiRunFacts(sessionId) {
|
|
|
175351
175627
|
const total = { input: 0, cacheCreation: 0, cacheRead: 0, output: 0 };
|
|
175352
175628
|
let model;
|
|
175353
175629
|
let holding = 0;
|
|
175354
|
-
for (const { path:
|
|
175630
|
+
for (const { path: path56, main } of wireFiles(entry.sessionDir)) {
|
|
175355
175631
|
let raw;
|
|
175356
175632
|
try {
|
|
175357
|
-
raw = readFileSync2(
|
|
175633
|
+
raw = readFileSync2(path56, "utf8");
|
|
175358
175634
|
} catch {
|
|
175359
175635
|
continue;
|
|
175360
175636
|
}
|
|
@@ -175692,7 +175968,7 @@ function createTail(log) {
|
|
|
175692
175968
|
// ../cli/package.json
|
|
175693
175969
|
var package_default = {
|
|
175694
175970
|
name: "wildcrane",
|
|
175695
|
-
version: "0.11.
|
|
175971
|
+
version: "0.11.85",
|
|
175696
175972
|
akbContract: 28,
|
|
175697
175973
|
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.",
|
|
175698
175974
|
keywords: [
|
|
@@ -175769,8 +176045,8 @@ var CLIENT_CAPABILITIES = {
|
|
|
175769
176045
|
};
|
|
175770
176046
|
function whereHint(update2, title) {
|
|
175771
176047
|
const locations = Array.isArray(update2.locations) ? update2.locations : [];
|
|
175772
|
-
const
|
|
175773
|
-
return
|
|
176048
|
+
const path56 = str2(obj(locations[0]).path);
|
|
176049
|
+
return path56 && !title.includes(path56) ? hint(path56) : "";
|
|
175774
176050
|
}
|
|
175775
176051
|
function saidBy(update2) {
|
|
175776
176052
|
const content = Array.isArray(update2.content) ? update2.content : [];
|
|
@@ -176896,7 +177172,7 @@ async function run(io, options, count2) {
|
|
|
176896
177172
|
startupTimer = setTimeout(() => {
|
|
176897
177173
|
if (!started) io.event?.({ kind: "log", data: { text: "[conversation] start_unconfirmed" } });
|
|
176898
177174
|
}, CONVERSATION_MS.start);
|
|
176899
|
-
await bounded(rpc.call("turn/start", { threadId, input: [{ type: "text", text: text3 }, ...images.map((
|
|
177175
|
+
await bounded(rpc.call("turn/start", { threadId, input: [{ type: "text", text: text3 }, ...images.map((path56) => ({ type: "localImage", path: path56 }))] }), CONVERSATION_MS.start, "Codex turn/start timed out; submission outcome is unknown.").catch((error62) => {
|
|
176900
177176
|
if (!started) throw error62;
|
|
176901
177177
|
});
|
|
176902
177178
|
};
|
|
@@ -180405,223 +180681,6 @@ var DOCUMENTS = { Asset: Asset_default, Compare: Compare_default, Storyboard: St
|
|
|
180405
180681
|
var allComponents = () => Object.entries(DOCUMENTS).map(([name, text3]) => ({ name, text: boardText(text3) }));
|
|
180406
180682
|
var componentDocsText = (docs) => docs.length ? [shared_default, ...docs.map((doc) => doc.text)].map((text3) => text3.trim()).join("\n\n") : "";
|
|
180407
180683
|
|
|
180408
|
-
// ../artifact-sdk/src/builtin/compare.json
|
|
180409
|
-
var compare_default = '{\n "name": "compare",\n "title": { "en": "Compare", "zh": "\u5BF9\u6BD4" },\n "types": ["compare"],\n "schema": {\n "type": "object",\n "required": ["a", "b"],\n "properties": { "a": { "type": "string" }, "b": { "type": "string" } }\n },\n "references": [\n { "json": "/a", "types": ["storyboard", "compare", "spritesheet", "studio"] },\n { "json": "/b", "types": ["storyboard", "compare", "spritesheet", "studio"] },\n { "json": "/shots", "types": ["storyboard", "compare", "spritesheet", "studio"] }\n ]\n}\n';
|
|
180410
|
-
|
|
180411
|
-
// ../artifact-sdk/src/builtin/html.json
|
|
180412
|
-
var html_default = `{
|
|
180413
|
-
"name": "html",
|
|
180414
|
-
"title": { "en": "Page", "zh": "\u9875\u9762" },
|
|
180415
|
-
"types": ["html"],
|
|
180416
|
-
"references": [
|
|
180417
|
-
{ "text": "<[a-z][^<>]*?\\\\ssrc\\\\s*=\\\\s*[\\"']([^\\"']+)[\\"']" },
|
|
180418
|
-
{ "text": "<[a-z][^<>]*?\\\\sposter\\\\s*=\\\\s*[\\"']([^\\"']+)[\\"']" },
|
|
180419
|
-
{ "text": "<[a-z][^<>]*?\\\\ssrcset\\\\s*=\\\\s*[\\"']([^\\"']+)[\\"']", "list": "," },
|
|
180420
|
-
{ "text": "<link\\\\b[^<>]*?\\\\shref\\\\s*=\\\\s*[\\"']([^\\"']+)[\\"']" },
|
|
180421
|
-
{ "text": "url\\\\(\\\\s*[\\"']?([^\\"')]+?)[\\"']?\\\\s*\\\\)" }
|
|
180422
|
-
],
|
|
180423
|
-
"skip": ["(?<=<script\\\\b[^<>]*>)[\\\\s\\\\S]*?(?=</script\\\\s*>|$)"]
|
|
180424
|
-
}
|
|
180425
|
-
`;
|
|
180426
|
-
|
|
180427
|
-
// ../artifact-sdk/src/builtin/image.json
|
|
180428
|
-
var image_default = '{ "name": "image", "title": { "en": "Image", "zh": "\u56FE\u7247" }, "types": ["image"] }\n';
|
|
180429
|
-
|
|
180430
|
-
// ../artifact-sdk/src/builtin/markdown.json
|
|
180431
|
-
var markdown_default = `{
|
|
180432
|
-
"name": "markdown",
|
|
180433
|
-
"title": { "en": "Document", "zh": "\u6587\u6863" },
|
|
180434
|
-
"types": ["markdown"],
|
|
180435
|
-
"references": [
|
|
180436
|
-
{ "text": "!\\\\[[^\\\\]\\\\n]*\\\\]\\\\(\\\\s*<?([^\\\\s)>]+)>?(?:\\\\s+[\\"'][^\\"'\\\\n]*[\\"'])?\\\\s*\\\\)" },
|
|
180437
|
-
{ "text": "<img\\\\b[^<>]*?\\\\ssrc\\\\s*=\\\\s*[\\"']([^\\"']+)[\\"']" }
|
|
180438
|
-
]
|
|
180439
|
-
}
|
|
180440
|
-
`;
|
|
180441
|
-
|
|
180442
|
-
// ../artifact-sdk/src/builtin/spritesheet.json
|
|
180443
|
-
var spritesheet_default = '{\n "name": "spritesheet",\n "title": { "en": "Sprite animation", "zh": "\u7CBE\u7075\u52A8\u753B" },\n "types": ["spritesheet"],\n "schema": {\n "type": "object",\n "required": ["frames", "meta"],\n "properties": {\n "frames": {\n "anyOf": [\n { "type": "array", "minItems": 1, "items": { "type": "object", "required": ["frame"] } },\n { "type": "object", "additionalProperties": { "type": "object", "required": ["frame"] } }\n ]\n },\n "meta": {\n "type": "object",\n "required": ["app", "image"],\n "properties": { "app": { "type": "string", "pattern": "codeandweb\\\\.com/texturepacker" }, "image": { "type": "string" } }\n }\n }\n },\n "references": [{ "json": "/meta/image" }]\n}\n';
|
|
180444
|
-
|
|
180445
|
-
// ../artifact-sdk/src/builtin/storyboard.json
|
|
180446
|
-
var storyboard_default = '{\n "name": "storyboard",\n "title": { "en": "Storyboard", "zh": "\u5206\u955C" },\n "types": ["storyboard"],\n "schema": {\n "type": "object",\n "anyOf": [{ "required": ["shots"] }, { "required": ["slides"] }],\n "properties": {\n "shots": {\n "type": "array",\n "items": {\n "type": "object",\n "properties": { "frames": { "type": "array", "items": { "type": "object", "properties": { "src": { "type": "string" } } } } }\n }\n },\n "slides": {\n "type": "array",\n "items": {\n "type": "object",\n "properties": {\n "preview": { "type": "object", "properties": { "src": { "type": "string" } } },\n "assets": { "type": "array", "items": { "type": "string" } }\n }\n }\n }\n }\n },\n "references": [\n { "json": "/shots/*/frames/*/src", "types": ["storyboard", "compare", "spritesheet", "studio"] },\n { "json": "/slides/*/preview/src", "types": ["storyboard", "compare", "spritesheet", "studio"] },\n { "json": "/slides/*/assets/*" }\n ]\n}\n';
|
|
180447
|
-
|
|
180448
|
-
// ../artifact-sdk/src/builtin/tiled.json
|
|
180449
|
-
var tiled_default = `{
|
|
180450
|
-
"name": "tiled",
|
|
180451
|
-
"title": { "en": "Tiled map", "zh": "Tiled \u5730\u56FE" },
|
|
180452
|
-
"types": ["tiled"],
|
|
180453
|
-
"references": [
|
|
180454
|
-
{ "text": "<tileset\\\\b[^<>]*?\\\\ssource\\\\s*=\\\\s*[\\"']([^\\"']+)[\\"']", "types": ["tiled"] },
|
|
180455
|
-
{ "text": "<image\\\\b[^<>]*?\\\\ssource\\\\s*=\\\\s*[\\"']([^\\"']+)[\\"']" },
|
|
180456
|
-
{ "text": "\\"source\\"\\\\s*:\\\\s*\\"([^\\"]+)\\"", "types": ["tiled"] },
|
|
180457
|
-
{ "text": "\\"image\\"\\\\s*:\\\\s*\\"([^\\"]+)\\"" }
|
|
180458
|
-
]
|
|
180459
|
-
}
|
|
180460
|
-
`;
|
|
180461
|
-
|
|
180462
|
-
// ../artifact-sdk/src/builtin/video.json
|
|
180463
|
-
var video_default = '{ "name": "video", "title": { "en": "Video", "zh": "\u89C6\u9891" }, "types": ["video"] }\n';
|
|
180464
|
-
|
|
180465
|
-
// ../artifact-sdk/src/builtin/studio.json
|
|
180466
|
-
var studio_default = '{\n "name": "studio",\n "title": {\n "en": "Studio",\n "zh": "\\u5de5\\u4f5c\\u53f0"\n },\n "types": [\n "studio"\n ],\n "schema": {\n "anyOf": [\n {\n "type": "object",\n "required": [\n "rounds",\n "land",\n "scheduled"\n ],\n "properties": {\n "rounds": {\n "type": "array",\n "items": {\n "type": "array",\n "minItems": 1,\n "items": {\n "type": "object",\n "required": [\n "agent",\n "title"\n ],\n "properties": {\n "agent": {\n "type": "string"\n },\n "title": {\n "type": "object",\n "required": [\n "en"\n ]\n }\n }\n }\n }\n },\n "land": {\n "type": "array",\n "items": {\n "type": "object",\n "required": [\n "agent",\n "title"\n ]\n }\n },\n "scheduled": {\n "type": "array",\n "items": {\n "type": "object",\n "required": [\n "agent",\n "title"\n ]\n }\n },\n "version": {\n "enum": [\n 1\n ]\n }\n }\n },\n {\n "type": "object",\n "required": [\n "version",\n "base",\n "fingerprint",\n "files"\n ],\n "properties": {\n "version": {\n "const": 2\n },\n "base": {\n "anyOf": [\n {\n "type": "null"\n },\n {\n "type": "object",\n "required": [\n "id",\n "version",\n "fingerprint"\n ],\n "properties": {\n "id": {\n "type": "string",\n "minLength": 1\n },\n "version": {\n "type": "integer",\n "minimum": 1\n },\n "fingerprint": {\n "type": "string",\n "minLength": 1\n }\n }\n }\n ]\n },\n "fingerprint": {\n "type": "string",\n "minLength": 1\n },\n "agents": {\n "type": "array",\n "maxItems": 500,\n "items": {\n "type": "object",\n "required": [\n "agent",\n "title"\n ],\n "properties": {\n "agent": {\n "type": "string",\n "minLength": 1\n },\n "title": {\n "type": "object",\n "required": [\n "en"\n ],\n "properties": {\n "en": {\n "type": "string",\n "minLength": 1\n },\n "zh": {\n "type": "string"\n }\n }\n }\n }\n }\n },\n "files": {\n "type": "array",\n "maxItems": 1000,\n "items": {\n "type": "object",\n "required": [\n "path",\n "before",\n "after"\n ],\n "properties": {\n "path": {\n "type": "string",\n "minLength": 1\n },\n "before": {\n "anyOf": [\n {\n "type": "string",\n "minLength": 1\n },\n {\n "type": "null"\n }\n ]\n },\n "after": {\n "anyOf": [\n {\n "type": "string",\n "minLength": 1\n },\n {\n "type": "null"\n }\n ]\n },\n "diff": {\n "type": "string",\n "minLength": 1\n }\n }\n }\n },\n "results": {\n "type": "array",\n "maxItems": 500,\n "items": {\n "anyOf": [\n {\n "type": "object",\n "required": [\n "agent",\n "component",\n "src"\n ],\n "properties": {\n "agent": {\n "type": "string",\n "minLength": 1\n },\n "component": {\n "const": "Asset"\n },\n "src": {\n "type": "string",\n "minLength": 1\n },\n "label": {\n "type": "string"\n },\n "alt": {\n "type": "string"\n },\n "device": {\n "enum": [\n "mobile",\n "desktop"\n ]\n },\n "loop": {\n "type": "boolean"\n },\n "variants": {\n "type": "object",\n "additionalProperties": {\n "type": "string",\n "minLength": 1\n }\n }\n }\n },\n {\n "type": "object",\n "required": [\n "agent",\n "component",\n "label",\n "items"\n ],\n "properties": {\n "agent": {\n "type": "string",\n "minLength": 1\n },\n "component": {\n "const": "Set"\n },\n "label": {\n "type": "string"\n },\n "items": {\n "type": "array",\n "minItems": 1,\n "maxItems": 500,\n "items": {\n "type": "object",\n "required": [\n "src"\n ],\n "properties": {\n "src": {\n "type": "string",\n "minLength": 1\n },\n "label": {\n "type": "string"\n },\n "alt": {\n "type": "string"\n },\n "device": {\n "enum": [\n "mobile",\n "desktop"\n ]\n },\n "loop": {\n "type": "boolean"\n },\n "variants": {\n "type": "object",\n "additionalProperties": {\n "type": "string",\n "minLength": 1\n }\n }\n }\n }\n }\n }\n },\n {\n "type": "object",\n "required": [\n "agent",\n "component",\n "a",\n "b"\n ],\n "properties": {\n "agent": {\n "type": "string",\n "minLength": 1\n },\n "component": {\n "const": "Compare"\n },\n "a": {\n "type": "string",\n "minLength": 1\n },\n "b": {\n "type": "string",\n "minLength": 1\n },\n "shots": {\n "type": "string",\n "minLength": 1\n },\n "label": {\n "type": "string"\n },\n "a-label": {\n "type": "string"\n },\n "b-label": {\n "type": "string"\n }\n }\n },\n {\n "type": "object",\n "required": [\n "agent",\n "component",\n "src"\n ],\n "properties": {\n "agent": {\n "type": "string",\n "minLength": 1\n },\n "component": {\n "const": "Storyboard"\n },\n "src": {\n "type": "string",\n "minLength": 1\n },\n "label": {\n "type": "string"\n }\n }\n }\n ]\n }\n }\n }\n }\n ]\n },\n "references": [\n {\n "json": "/files/*/before"\n },\n {\n "json": "/files/*/after"\n },\n {\n "json": "/files/*/diff"\n },\n {\n "json": "/results/*/src",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/variants/*",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/a",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/b",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/shots",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/items/*/src",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/items/*/variants/*",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/items/*/a",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/items/*/b",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n },\n {\n "json": "/results/*/items/*/shots",\n "types": [\n "storyboard",\n "compare",\n "spritesheet",\n "studio",\n "asset"\n ]\n }\n ]\n}\n';
|
|
180467
|
-
|
|
180468
|
-
// ../artifact-sdk/src/builtin/index.ts
|
|
180469
|
-
var read2 = (m) => typeof m === "string" ? JSON.parse(m) : m;
|
|
180470
|
-
var builtin_default = [html_default, image_default, video_default, markdown_default, storyboard_default, compare_default, studio_default, tiled_default, spritesheet_default].map(read2);
|
|
180471
|
-
|
|
180472
|
-
// ../artifact-sdk/src/internal/schema.ts
|
|
180473
|
-
var isObj = (v) => !!v && typeof v === "object" && !Array.isArray(v);
|
|
180474
|
-
function typeOk(type, v) {
|
|
180475
|
-
const types = Array.isArray(type) ? type : [type];
|
|
180476
|
-
return types.some(
|
|
180477
|
-
(t) => t === "null" ? v === null : t === "array" ? Array.isArray(v) : t === "object" ? isObj(v) : t === "integer" ? Number.isInteger(v) : t === "number" ? typeof v === "number" && Number.isFinite(v) : typeof v === t
|
|
180478
|
-
);
|
|
180479
|
-
}
|
|
180480
|
-
function schemaProblem(schema, value, at2 = "") {
|
|
180481
|
-
if (!isObj(schema)) return null;
|
|
180482
|
-
const s = schema;
|
|
180483
|
-
const here = at2 || "/";
|
|
180484
|
-
if (s.type !== void 0 && !typeOk(s.type, value)) return here;
|
|
180485
|
-
if (Array.isArray(s.enum) && !s.enum.some((e2) => JSON.stringify(e2) === JSON.stringify(value))) return here;
|
|
180486
|
-
if (s.const !== void 0 && JSON.stringify(s.const) !== JSON.stringify(value)) return here;
|
|
180487
|
-
if (Array.isArray(s.anyOf) && !s.anyOf.some((x2) => !schemaProblem(x2, value, at2))) return here;
|
|
180488
|
-
if (typeof value === "string") {
|
|
180489
|
-
if (typeof s.minLength === "number" && value.length < s.minLength) return here;
|
|
180490
|
-
if (typeof s.maxLength === "number" && value.length > s.maxLength) return here;
|
|
180491
|
-
if (typeof s.pattern === "string") {
|
|
180492
|
-
try {
|
|
180493
|
-
if (!new RegExp(s.pattern, "u").test(value)) return here;
|
|
180494
|
-
} catch {
|
|
180495
|
-
}
|
|
180496
|
-
}
|
|
180497
|
-
}
|
|
180498
|
-
if (typeof value === "number") {
|
|
180499
|
-
if (typeof s.minimum === "number" && value < s.minimum) return here;
|
|
180500
|
-
if (typeof s.maximum === "number" && value > s.maximum) return here;
|
|
180501
|
-
}
|
|
180502
|
-
if (Array.isArray(value)) {
|
|
180503
|
-
if (typeof s.minItems === "number" && value.length < s.minItems) return here;
|
|
180504
|
-
if (typeof s.maxItems === "number" && value.length > s.maxItems) return here;
|
|
180505
|
-
if (isObj(s.items)) {
|
|
180506
|
-
for (let i = 0; i < value.length; i++) {
|
|
180507
|
-
const bad = schemaProblem(s.items, value[i], `${at2}/${i}`);
|
|
180508
|
-
if (bad) return bad;
|
|
180509
|
-
}
|
|
180510
|
-
}
|
|
180511
|
-
}
|
|
180512
|
-
if (isObj(value)) {
|
|
180513
|
-
const props = isObj(s.properties) ? s.properties : {};
|
|
180514
|
-
if (Array.isArray(s.required)) {
|
|
180515
|
-
for (const k2 of s.required) if (typeof k2 === "string" && !(k2 in value)) return `${at2}/${k2}`;
|
|
180516
|
-
}
|
|
180517
|
-
for (const [k2, v] of Object.entries(value)) {
|
|
180518
|
-
if (k2 in props) {
|
|
180519
|
-
const bad = schemaProblem(props[k2], v, `${at2}/${k2}`);
|
|
180520
|
-
if (bad) return bad;
|
|
180521
|
-
} else if (s.additionalProperties === false) return `${at2}/${k2}`;
|
|
180522
|
-
else if (isObj(s.additionalProperties)) {
|
|
180523
|
-
const bad = schemaProblem(s.additionalProperties, v, `${at2}/${k2}`);
|
|
180524
|
-
if (bad) return bad;
|
|
180525
|
-
}
|
|
180526
|
-
}
|
|
180527
|
-
}
|
|
180528
|
-
return null;
|
|
180529
|
-
}
|
|
180530
|
-
|
|
180531
|
-
// ../artifact-sdk/src/internal/format/studio.ts
|
|
180532
|
-
var text2 = (v) => typeof v === "string" && v.length > 0;
|
|
180533
|
-
var source = (v) => text2(v) && !/^(?:[a-z][\w+.-]*:|\/|#)|\\|[\u0000-\u001f]/i.test(v);
|
|
180534
|
-
var icon2 = (v) => v === void 0 || typeof v === "string" || Array.isArray(v) && v.length > 0 && v.length <= 12 && v.every((p2) => isObject2(p2) && text2(p2.d) && /^[MmLlHhVvCcSsQqTtAaZz0-9.,\s-]+$/.test(p2.d) && ["f", "s"].every((k2) => p2[k2] === void 0 || typeof p2[k2] === "string" && /^[kwcgopsmlry]$/.test(p2[k2])) && (p2.o === void 0 || p2.o === true) && (p2.w === void 0 || typeof p2.w === "number" && p2.w > 0 && p2.w <= 3));
|
|
180535
|
-
var relativePath = (v) => source(v) && v.split("/").every((p2) => p2 && p2 !== "." && p2 !== "..");
|
|
180536
|
-
var optionalText = (v, keys) => keys.every((k2) => v[k2] === void 0 || typeof v[k2] === "string");
|
|
180537
|
-
var asset = (v) => isObject2(v) && source(v.src) && optionalText(v, ["label", "alt"]) && (v.alt === void 0 || !/[<>]/.test(v.alt)) && (v.device === void 0 || v.device === "desktop" || v.device === "mobile") && (v.loop === void 0 || typeof v.loop === "boolean") && (v.variants === void 0 || isObject2(v.variants) && Object.values(v.variants).every(source));
|
|
180538
|
-
function resultProblem(value, agents) {
|
|
180539
|
-
if (!Array.isArray(value) || value.length > 500) return "/results";
|
|
180540
|
-
for (let i = 0; i < value.length; i++) {
|
|
180541
|
-
const r2 = value[i];
|
|
180542
|
-
if (!isObject2(r2) || !text2(r2.agent) || !agents.has(r2.agent) || !optionalText(r2, ["label"])) return `/results/${i}`;
|
|
180543
|
-
const valid = r2.component === "Asset" ? asset(r2) : r2.component === "Set" ? typeof r2.label === "string" && Array.isArray(r2.items) && r2.items.length > 0 && r2.items.length <= 500 && r2.items.every(asset) : r2.component === "Compare" ? source(r2.a) && source(r2.b) && (r2.shots === void 0 || source(r2.shots)) && optionalText(r2, ["a-label", "b-label"]) : r2.component === "Storyboard" && source(r2.src);
|
|
180544
|
-
if (!valid) return `/results/${i}`;
|
|
180545
|
-
}
|
|
180546
|
-
return null;
|
|
180547
|
-
}
|
|
180548
|
-
function reviewProblem(v) {
|
|
180549
|
-
if (!isObject2(v) || v.version !== 2) return "/version";
|
|
180550
|
-
if (!text2(v.fingerprint)) return "/fingerprint";
|
|
180551
|
-
if (v.base !== null && !(isObject2(v.base) && text2(v.base.id) && Number.isInteger(v.base.version) && Number(v.base.version) > 0 && text2(v.base.fingerprint))) return "/base";
|
|
180552
|
-
if (v.agents !== void 0 && (!Array.isArray(v.agents) || v.agents.length > 500)) return "/agents";
|
|
180553
|
-
const agents = /* @__PURE__ */ new Set();
|
|
180554
|
-
for (const a2 of v.agents ?? []) {
|
|
180555
|
-
if (!isObject2(a2) || !text2(a2.agent) || !/^[a-z][a-z0-9-]*$/.test(a2.agent) || agents.has(a2.agent) || !isObject2(a2.title) || !text2(a2.title.en) || !optionalText(a2.title, ["zh"]) || !icon2(a2.icon)) return "/agents";
|
|
180556
|
-
agents.add(a2.agent);
|
|
180557
|
-
}
|
|
180558
|
-
if (!Array.isArray(v.files) || v.files.length > 1e3) return "/files";
|
|
180559
|
-
const paths = /* @__PURE__ */ new Set();
|
|
180560
|
-
for (const f2 of v.files) {
|
|
180561
|
-
if (!isObject2(f2) || !relativePath(f2.path) || paths.has(f2.path) || !(f2.before === null || source(f2.before)) || !(f2.after === null || source(f2.after)) || f2.before === null && f2.after === null || f2.diff !== void 0 && !source(f2.diff) || (f2.before === null || f2.after === null) && !f2.diff) return "/files";
|
|
180562
|
-
if (f2.path.startsWith("agents/") && !agents.has(f2.path.split("/")[1])) return "/files";
|
|
180563
|
-
paths.add(f2.path);
|
|
180564
|
-
}
|
|
180565
|
-
return v.results === void 0 ? null : resultProblem(v.results, agents);
|
|
180566
|
-
}
|
|
180567
|
-
var isReview = (v) => isObject2(v) && v.version === 2;
|
|
180568
|
-
|
|
180569
|
-
// ../artifact-sdk/src/internal/manifest.ts
|
|
180570
|
-
var BUILTINS = builtin_default;
|
|
180571
|
-
var manifestOf = (type) => BUILTINS.find((m) => m.types.includes(type));
|
|
180572
|
-
function typeOf(data, types) {
|
|
180573
|
-
const problem = (type) => type === "studio" && isReview(data) ? reviewProblem(data) : schemaProblem(manifestOf(type)?.schema, data);
|
|
180574
|
-
for (const type of types) if (!problem(type)) return { type };
|
|
180575
|
-
if (types.length !== 1) return { type: null };
|
|
180576
|
-
return { type: types[0], problem: `does not match ${types[0]} at ${problem(types[0])}` };
|
|
180577
|
-
}
|
|
180578
|
-
var isObject3 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
|
|
180579
|
-
var remote = (src) => !src || /^(?:[a-z][\w+.-]*:|\/|#)/i.test(src);
|
|
180580
|
-
function mapJson(node2, keys, at2, visit2) {
|
|
180581
|
-
if (!keys.length) return typeof node2 === "string" && node2 ? visit2(node2, at2) : node2;
|
|
180582
|
-
const [key, ...rest] = keys;
|
|
180583
|
-
if (Array.isArray(node2)) {
|
|
180584
|
-
if (key === "*") return node2.map((x2, i2) => mapJson(x2, rest, `${at2}/${i2}`, visit2));
|
|
180585
|
-
const i = Number(key);
|
|
180586
|
-
return Number.isInteger(i) && i in node2 ? node2.map((x2, j2) => j2 === i ? mapJson(x2, rest, `${at2}/${j2}`, visit2) : x2) : node2;
|
|
180587
|
-
}
|
|
180588
|
-
if (!isObject3(node2)) return node2;
|
|
180589
|
-
const out = { ...node2 };
|
|
180590
|
-
for (const k2 of key === "*" ? Object.keys(node2) : key in node2 ? [key] : []) out[k2] = mapJson(node2[k2], rest, `${at2}/${k2}`, visit2);
|
|
180591
|
-
return out;
|
|
180592
|
-
}
|
|
180593
|
-
function mapText(text3, rule, skipped, visit2, includeRemote) {
|
|
180594
|
-
let out = "";
|
|
180595
|
-
let last = 0;
|
|
180596
|
-
for (const m of text3.matchAll(new RegExp(rule.text, "gid"))) {
|
|
180597
|
-
const span = m.indices?.[1];
|
|
180598
|
-
if (!span || m[1] === void 0 || skipped.some(([a2, b2]) => span[0] >= a2 && span[0] < b2)) continue;
|
|
180599
|
-
const line = text3.slice(0, span[0]).split("\n").length;
|
|
180600
|
-
const one = (src) => remote(src) && !includeRemote ? src : visit2(src, line);
|
|
180601
|
-
const value = rule.list ? m[1].split(rule.list).map((part) => part.replace(/^(\s*)(\S+)/, (_2, space, src) => space + one(src))).join(rule.list) : one(m[1]);
|
|
180602
|
-
out += text3.slice(last, span[0]) + value;
|
|
180603
|
-
last = span[1];
|
|
180604
|
-
}
|
|
180605
|
-
return out + text3.slice(last);
|
|
180606
|
-
}
|
|
180607
|
-
function mapReferences(manifest, content, map3, includeRemote = false) {
|
|
180608
|
-
const skipped = (text3) => (manifest?.skip ?? []).flatMap((re3) => [...text3.matchAll(new RegExp(re3, "gi"))].map((m) => [m.index, m.index + m[0].length]));
|
|
180609
|
-
for (const rule of manifest?.references ?? []) {
|
|
180610
|
-
const types = rule.types ?? [];
|
|
180611
|
-
if ("json" in rule) {
|
|
180612
|
-
if (typeof content !== "string") content = mapJson(content, rule.json.split("/").filter(Boolean), "", (src, at2) => map3(src, { src, types, text: false, at: at2 || "/" }));
|
|
180613
|
-
} else if (typeof content === "string") {
|
|
180614
|
-
content = mapText(content, rule, skipped(content), (src, line) => map3(src, { src, types, text: true, line }), includeRemote);
|
|
180615
|
-
}
|
|
180616
|
-
}
|
|
180617
|
-
return content;
|
|
180618
|
-
}
|
|
180619
|
-
function referencesOf(manifest, content, includeRemote = false) {
|
|
180620
|
-
const found = [];
|
|
180621
|
-
mapReferences(manifest, content, (src, ref) => (found.push(ref), src), includeRemote);
|
|
180622
|
-
return found;
|
|
180623
|
-
}
|
|
180624
|
-
|
|
180625
180684
|
// ../artifact-sdk/src/internal/collect.ts
|
|
180626
180685
|
var extOf = (file3) => /\.[^./\\]+$/.exec(file3)?.[0].toLowerCase() ?? "";
|
|
180627
180686
|
var why = (error62) => error62 instanceof Error ? error62.message : String(error62);
|
|
@@ -180638,14 +180697,14 @@ function collectSources(sources3, card, host) {
|
|
|
180638
180697
|
const active = /* @__PURE__ */ new Set();
|
|
180639
180698
|
const out = [];
|
|
180640
180699
|
const visit2 = (src, types, owner2, partial2 = false) => {
|
|
180641
|
-
const
|
|
180700
|
+
const [path56] = splitFileReference(src);
|
|
180642
180701
|
let resolved;
|
|
180643
180702
|
try {
|
|
180644
|
-
resolved = host.resolve(
|
|
180703
|
+
resolved = host.resolve(path56, owner2);
|
|
180645
180704
|
} catch (error62) {
|
|
180646
180705
|
if (owner2 !== card) return { key: null, error: why(error62) };
|
|
180647
180706
|
if (!nodes.has(src)) {
|
|
180648
|
-
const node3 = { key: src, file: null, kind: kindAt(
|
|
180707
|
+
const node3 = { key: src, file: null, kind: kindAt(path56, types), error: why(error62), problems: [], dependencies: /* @__PURE__ */ new Map(), aliases: /* @__PURE__ */ new Set([src]) };
|
|
180649
180708
|
nodes.set(src, node3);
|
|
180650
180709
|
out.push(node3);
|
|
180651
180710
|
}
|
|
@@ -180688,13 +180747,13 @@ function collectSources(sources3, card, host) {
|
|
|
180688
180747
|
} else {
|
|
180689
180748
|
node2.kind = textKind(extOf(file3), types);
|
|
180690
180749
|
try {
|
|
180691
|
-
if (
|
|
180750
|
+
if (fileManifest(node2.kind, file3)?.references) node2.data = host.read(file3);
|
|
180692
180751
|
} catch (error62) {
|
|
180693
180752
|
node2.problems.push({ src: file3, message: why(error62) });
|
|
180694
180753
|
}
|
|
180695
180754
|
}
|
|
180696
180755
|
node2.error = node2.problems[0]?.message;
|
|
180697
|
-
if (!node2.error) for (const ref of referencesOf(
|
|
180756
|
+
if (!node2.error) for (const ref of referencesOf(fileManifest(node2.kind, file3), node2.data)) child(ref, file3);
|
|
180698
180757
|
} else {
|
|
180699
180758
|
for (const ref of host.retained(key, types)) child(ref, card);
|
|
180700
180759
|
}
|
|
@@ -181004,8 +181063,8 @@ ${groups.get(id2).join("\n\n")}
|
|
|
181004
181063
|
|
|
181005
181064
|
// ../cli/src/lib/shared/triage-files.ts
|
|
181006
181065
|
var ITEM = /^triage\/(?:(dismissed|archived)\/)?([^/]+)\.md$/;
|
|
181007
|
-
function itemAt(
|
|
181008
|
-
const m = ITEM.exec(
|
|
181066
|
+
function itemAt(path56) {
|
|
181067
|
+
const m = ITEM.exec(path56);
|
|
181009
181068
|
if (!m) return null;
|
|
181010
181069
|
return { state: m[1] === "dismissed" ? "dismissed" : m[1] === "archived" ? "carded" : "open", name: m[2] };
|
|
181011
181070
|
}
|
|
@@ -181547,7 +181606,7 @@ async function prepareConflictTask(ws) {
|
|
|
181547
181606
|
writeRecord(ws, record2);
|
|
181548
181607
|
return { ok: true, value: void 0 };
|
|
181549
181608
|
}
|
|
181550
|
-
var
|
|
181609
|
+
var taskAssetsSynced = (ws) => !readBase(ws).pendingAssets?.includes(ws.task);
|
|
181551
181610
|
function syncedCardVersion(ws) {
|
|
181552
181611
|
const base = readBase(ws);
|
|
181553
181612
|
const card = Object.entries(base.files).find(([p2]) => p2.startsWith(rootOf(ws) + "todo/") && numberOfCard(p2.slice(rootOf(ws).length)) === ws.number);
|
|
@@ -181772,7 +181831,7 @@ async function pullAssets(ws, record2, assets, preserve = false) {
|
|
|
181772
181831
|
if (!bytes2.ok) return bytes2;
|
|
181773
181832
|
let local = bytes2.value;
|
|
181774
181833
|
const dependencies = [];
|
|
181775
|
-
const manifest =
|
|
181834
|
+
const manifest = fileManifest(kind, name);
|
|
181776
181835
|
let data;
|
|
181777
181836
|
if (manifest?.references) {
|
|
181778
181837
|
data = Buffer.from(local).toString();
|
|
@@ -181787,7 +181846,8 @@ async function pullAssets(ws, record2, assets, preserve = false) {
|
|
|
181787
181846
|
if (data !== void 0) {
|
|
181788
181847
|
let changed = false;
|
|
181789
181848
|
const restored = mapReferences(manifest, data, (src, found) => {
|
|
181790
|
-
const
|
|
181849
|
+
const [ref2, suffix] = found.text ? splitFileReference(src) : [src, ""];
|
|
181850
|
+
const name2 = Object.entries(assets).find(([, r2]) => r2.artifact === ref2)?.[0];
|
|
181791
181851
|
if (!name2) return src;
|
|
181792
181852
|
let child = null;
|
|
181793
181853
|
try {
|
|
@@ -181796,7 +181856,7 @@ async function pullAssets(ws, record2, assets, preserve = false) {
|
|
|
181796
181856
|
}
|
|
181797
181857
|
if (!child) return src;
|
|
181798
181858
|
dependencies.push(name2);
|
|
181799
|
-
const back = !found.text && /^\.assets\//.test(name2) ? name2 : path39.relative(path39.dirname(target), child).split(path39.sep).join("/");
|
|
181859
|
+
const back = !found.text && /^\.assets\//.test(name2) ? name2 : path39.relative(path39.dirname(target), child).split(path39.sep).join("/") + suffix;
|
|
181800
181860
|
if (back !== src) changed = true;
|
|
181801
181861
|
return back;
|
|
181802
181862
|
});
|
|
@@ -181825,11 +181885,17 @@ async function pullAssets(ws, record2, assets, preserve = false) {
|
|
|
181825
181885
|
record2.assets = out;
|
|
181826
181886
|
return { ok: true, value: void 0 };
|
|
181827
181887
|
}
|
|
181828
|
-
async function readAsset(artifact, version2) {
|
|
181888
|
+
async function readAsset(artifact, version2, textField) {
|
|
181829
181889
|
const held5 = await readVersion(artifact, version2);
|
|
181830
181890
|
if (!held5.ok) return held5;
|
|
181831
181891
|
if (held5.value.file) return download(held5.value.file.url);
|
|
181832
181892
|
const content = held5.value.content;
|
|
181893
|
+
if (content === void 0) return { ok: false, code: "bad_request", error: "The version has no saved content." };
|
|
181894
|
+
if (textField && typeof content !== "string") {
|
|
181895
|
+
const text3 = content && typeof content === "object" ? content[textField] : void 0;
|
|
181896
|
+
if (typeof text3 !== "string") return { ok: false, code: "bad_request", error: "The version has no HTML content." };
|
|
181897
|
+
return { ok: true, value: Buffer.from(text3) };
|
|
181898
|
+
}
|
|
181833
181899
|
return { ok: true, value: Buffer.from(typeof content === "string" ? content : JSON.stringify(content)) };
|
|
181834
181900
|
}
|
|
181835
181901
|
async function sentOf(file3, kind) {
|
|
@@ -181921,6 +181987,8 @@ async function pushAssets(ws, record2, before) {
|
|
|
181921
181987
|
const body = readText(file3);
|
|
181922
181988
|
if (body === null) return { ok: true, value: void 0 };
|
|
181923
181989
|
const refs = {};
|
|
181990
|
+
const currentDocumentPreviews = /* @__PURE__ */ new Set();
|
|
181991
|
+
let retryPreviews = false;
|
|
181924
181992
|
const canonical = (target) => {
|
|
181925
181993
|
const real = (file4) => fs33.existsSync(file4) ? fs33.realpathSync(file4) : path39.dirname(file4) === file4 ? file4 : path39.join(real(path39.dirname(file4)), path39.basename(file4));
|
|
181926
181994
|
target = real(target);
|
|
@@ -182009,6 +182077,7 @@ async function pushAssets(ws, record2, before) {
|
|
|
182009
182077
|
}
|
|
182010
182078
|
for (const alias of node2.aliases) refs[alias] = { artifact: old.artifact, version: version2, ...old.dependencies ? { dependencies: old.dependencies } : {} };
|
|
182011
182079
|
const previewKey = documentPreviewKey(old.artifact, version2);
|
|
182080
|
+
currentDocumentPreviews.add(previewKey);
|
|
182012
182081
|
if (before[previewKey]) refs[previewKey] = before[previewKey];
|
|
182013
182082
|
}
|
|
182014
182083
|
continue;
|
|
@@ -182019,12 +182088,13 @@ async function pushAssets(ws, record2, before) {
|
|
|
182019
182088
|
if (!artifact.value.type) return { ok: false, code: "bad_request", error: `${node2.key}: \u8D44\u6E90\u7C7B\u578B\u7F3A\u5931` };
|
|
182020
182089
|
previous.kind = artifact.value.type;
|
|
182021
182090
|
}
|
|
182022
|
-
const manifest =
|
|
182091
|
+
const manifest = fileManifest(kind, node2.file);
|
|
182023
182092
|
const json2 = !!manifest?.references && node2.data !== void 0 && typeof node2.data !== "string";
|
|
182024
182093
|
if (manifest?.references && node2.data !== void 0) {
|
|
182025
182094
|
const map3 = (src) => {
|
|
182026
182095
|
const key = node2.dependencies.get(src);
|
|
182027
|
-
|
|
182096
|
+
const artifact = key && refs[key]?.artifact;
|
|
182097
|
+
return artifact ? artifact + (json2 ? "" : splitFileReference(src)[1]) : src;
|
|
182028
182098
|
};
|
|
182029
182099
|
out = json2 ? { kind, type: "application/json", bytes: Buffer.from(JSON.stringify(mapReferences(manifest, node2.data, map3))) } : { ...out, bytes: Buffer.from(mapReferences(manifest, Buffer.from(out.bytes).toString(), map3)) };
|
|
182030
182100
|
}
|
|
@@ -182068,8 +182138,13 @@ async function pushAssets(ws, record2, before) {
|
|
|
182068
182138
|
const office = out.kind === "asset" && officeExtension(node2.file);
|
|
182069
182139
|
if (office && entry.version > 0) {
|
|
182070
182140
|
const key = documentPreviewKey(entry.artifact, entry.version);
|
|
182141
|
+
currentDocumentPreviews.add(key);
|
|
182071
182142
|
const preview = before[key]?.version ? { ok: true, value: before[key] } : await pushDocumentPreview(ws, record2, key, office, out.bytes);
|
|
182072
|
-
if (!preview.ok)
|
|
182143
|
+
if (!preview.ok) {
|
|
182144
|
+
retryPreviews ||= temporaryCloudFailure(preview);
|
|
182145
|
+
logSync("assets.documentPreviewUnavailable", { project: ws.project, task: ws.task, reason: preview.error });
|
|
182146
|
+
continue;
|
|
182147
|
+
}
|
|
182073
182148
|
if (preview.value) {
|
|
182074
182149
|
refs[key] = preview.value;
|
|
182075
182150
|
for (const alias of node2.aliases) {
|
|
@@ -182082,11 +182157,14 @@ async function pushAssets(ws, record2, before) {
|
|
|
182082
182157
|
for (const name of Object.keys(record2.assets)) {
|
|
182083
182158
|
if (isDocumentPreview(name) && !refs[name]) delete record2.assets[name];
|
|
182084
182159
|
}
|
|
182160
|
+
for (const name of Object.keys(record2.pendingVersions ?? {})) {
|
|
182161
|
+
if (isDocumentPreview(name) && !currentDocumentPreviews.has(name)) delete record2.pendingVersions[name];
|
|
182162
|
+
}
|
|
182085
182163
|
} catch (error62) {
|
|
182086
182164
|
return { ok: false, code: "bad_request", error: error62 instanceof Error ? error62.message : String(error62) };
|
|
182087
182165
|
}
|
|
182088
182166
|
logSync("assets.end", { project: ws.project, task: ws.task, ms: Math.round(performance.now() - started) });
|
|
182089
|
-
return { ok: true, value: refs };
|
|
182167
|
+
return { ok: true, value: { refs, retryPreviews } };
|
|
182090
182168
|
}
|
|
182091
182169
|
function proposeItems(ws, base, paths) {
|
|
182092
182170
|
const root2 = rootOf(ws);
|
|
@@ -182310,17 +182388,20 @@ async function send2(ws, job, { paths, taskChat }) {
|
|
|
182310
182388
|
const archive = boardSync && card.startsWith(".archive/") && !item.record.deleted;
|
|
182311
182389
|
const listPath = assetsFile(item.folder.task);
|
|
182312
182390
|
const archived = !selected && archive && !retryAssets.has(item.folder.task) && !Object.keys(item.record.pendingVersions ?? {}).length && readText(path39.join(ws.board, listPath)) === (base.files[rootOf(ws) + listPath]?.content ?? null) && readText(path39.join(ws.board, card)) === base.files[rootOf(ws) + card]?.content && !newer && clean();
|
|
182391
|
+
retryAssets.delete(item.folder.task);
|
|
182313
182392
|
if (!archived && !item.record.deleted) {
|
|
182314
182393
|
const refreshed = newer && clean() ? await pullAssets(item.folder, item.record, before, true) : { ok: true, value: void 0 };
|
|
182315
182394
|
const assets = refreshed.ok ? await pushAssets(item.folder, item.record, before) : refreshed;
|
|
182316
182395
|
if (assets.ok) {
|
|
182396
|
+
if (assets.value?.retryPreviews) retryAssets.add(item.folder.task);
|
|
182317
182397
|
writeRecord(item.folder, item.record);
|
|
182318
182398
|
indexTask(item.folder, item.record);
|
|
182319
182399
|
if (archive) archives.set(item.folder.task, card);
|
|
182320
182400
|
const list3 = listPath;
|
|
182321
182401
|
const local2 = readText(path39.join(ws.board, list3));
|
|
182322
|
-
|
|
182323
|
-
|
|
182402
|
+
const refs = assets.value?.refs;
|
|
182403
|
+
if (refs && (local2 !== null || Object.keys(refs).length)) {
|
|
182404
|
+
const content = isDeepStrictEqual(assetsOf(local2), refs) && local2 !== null ? local2 : assetsText(refs);
|
|
182324
182405
|
assetLists.set(list3, { local: local2, content });
|
|
182325
182406
|
for (const file3 of assetFiles(item.folder, content, path39.join(ws.board, card))) generatedAssets.add(file3);
|
|
182326
182407
|
}
|
|
@@ -182330,6 +182411,7 @@ async function send2(ws, job, { paths, taskChat }) {
|
|
|
182330
182411
|
if (!boardSync && !assets.failure) return fail(assets.error, false, assets.code, assets.status);
|
|
182331
182412
|
if (job.id && ws.cloudTask && assets.failure) return { ok: false, conflict: false, error: assets.error, failure: assets.failure };
|
|
182332
182413
|
if (assets.code !== "conflict" || !assets.error.endsWith(": This task has finished.")) {
|
|
182414
|
+
retryAssets.add(item.folder.task);
|
|
182333
182415
|
assetErrors[item.folder.task] = { error: assets.error, failure: assets.failure, code: assets.code, ...temporaryCloudFailure(assets) ? { offline: true } : {} };
|
|
182334
182416
|
}
|
|
182335
182417
|
}
|
|
@@ -182364,7 +182446,7 @@ async function send2(ws, job, { paths, taskChat }) {
|
|
|
182364
182446
|
const oversize = /* @__PURE__ */ new Set();
|
|
182365
182447
|
const success2 = async (changed) => {
|
|
182366
182448
|
const refreshDeferred = deferred.size !== (base.deferred?.length ?? 0) || base.deferred?.some((p2) => !deferred.has(p2));
|
|
182367
|
-
const pendingAssets = [
|
|
182449
|
+
const pendingAssets = [...retryAssets];
|
|
182368
182450
|
const refreshPending = JSON.stringify(pendingAssets) !== JSON.stringify(base.pendingAssets ?? []);
|
|
182369
182451
|
if (refreshDeferred) base.deferred = [...deferred];
|
|
182370
182452
|
if (refreshPending) base.pendingAssets = pendingAssets;
|
|
@@ -182680,7 +182762,7 @@ ${notes}
|
|
|
182680
182762
|
].filter(Boolean).join("\n\n");
|
|
182681
182763
|
}
|
|
182682
182764
|
|
|
182683
|
-
// src/
|
|
182765
|
+
// src/approved-ui.ts
|
|
182684
182766
|
import fs34 from "node:fs";
|
|
182685
182767
|
import path40 from "node:path";
|
|
182686
182768
|
|
|
@@ -182716,11 +182798,65 @@ function syncWaitCode(failure2) {
|
|
|
182716
182798
|
if (failure2.code === "storage_limit_reached" || failure2.code === "quota_exceeded" && !/takes files up to/i.test(failure2.error)) return "storage";
|
|
182717
182799
|
}
|
|
182718
182800
|
|
|
182801
|
+
// src/approved-ui.ts
|
|
182802
|
+
async function stageApprovedUi(directory3, previews, stopped2, chinese = false) {
|
|
182803
|
+
for (const preview of previews) {
|
|
182804
|
+
const visited = /* @__PURE__ */ new Set();
|
|
182805
|
+
const stage = async (source2) => {
|
|
182806
|
+
if (stopped2()) return syncStopped;
|
|
182807
|
+
if (visited.has(source2)) return { ok: true, value: void 0 };
|
|
182808
|
+
visited.add(source2);
|
|
182809
|
+
const pin = approvedUiPin(preview.pins, source2);
|
|
182810
|
+
const context = [
|
|
182811
|
+
chinese ? `\u5BA1\u6838\u4FEE\u8BA2 ${preview.revision}` : `review revision ${preview.revision}`,
|
|
182812
|
+
...typeof pin.artifact === "string" && pin.artifact ? [pin.artifact] : [],
|
|
182813
|
+
...typeof pin.version === "number" ? [chinese ? `\u7248\u672C ${pin.version}` : `version ${pin.version}`] : []
|
|
182814
|
+
].join(", ");
|
|
182815
|
+
const label = `${source2} (${context})`;
|
|
182816
|
+
if (!validUiPin(pin)) {
|
|
182817
|
+
const reason = pin.error || (chinese ? "\u7F3A\u5C11\u83B7\u6279\u7684\u6587\u4EF6\u7248\u672C\u3002" : "Missing approved asset version.");
|
|
182818
|
+
return { ok: false, code: "bad_request", error: `${label}: ${reason}` };
|
|
182819
|
+
}
|
|
182820
|
+
const kind = kindOf(path40.posix.extname(splitFileReference(source2)[0]).toLowerCase());
|
|
182821
|
+
const bytes2 = await readAsset(pin.artifact, pin.version, kind === "html" ? "html" : void 0);
|
|
182822
|
+
if (!bytes2.ok) return { ...bytes2, error: `${label}: ${bytes2.error}` };
|
|
182823
|
+
const target = approvedUiFile(directory3, preview, source2);
|
|
182824
|
+
const manifest = fileManifest(kind, source2);
|
|
182825
|
+
let content = bytes2.value;
|
|
182826
|
+
if (kind === "html" || manifest?.name === "css") {
|
|
182827
|
+
const dependencies = /* @__PURE__ */ new Set();
|
|
182828
|
+
const rewritten = mapReferences(manifest, Buffer.from(content).toString(), (src) => {
|
|
182829
|
+
const child = approvedUiSource(preview.pins, src, source2);
|
|
182830
|
+
dependencies.add(child);
|
|
182831
|
+
const local = approvedUiFile(directory3, preview, child);
|
|
182832
|
+
const relative = path40.relative(path40.dirname(target), local).split(path40.sep).map((part) => encodeURIComponent(part).replace(/['()]/g, (char) => `%${char.charCodeAt(0).toString(16)}`)).join("/");
|
|
182833
|
+
return relative + splitFileReference(src)[1];
|
|
182834
|
+
});
|
|
182835
|
+
for (const child of dependencies) {
|
|
182836
|
+
const result = await stage(child);
|
|
182837
|
+
if (!result.ok) return result;
|
|
182838
|
+
}
|
|
182839
|
+
content = Buffer.from(rewritten);
|
|
182840
|
+
}
|
|
182841
|
+
fs34.mkdirSync(path40.dirname(target), { recursive: true });
|
|
182842
|
+
fs34.writeFileSync(target, content);
|
|
182843
|
+
return { ok: true, value: void 0 };
|
|
182844
|
+
};
|
|
182845
|
+
for (const file3 of preview.files) {
|
|
182846
|
+
const result = await stage(file3.source);
|
|
182847
|
+
if (!result.ok) return result;
|
|
182848
|
+
}
|
|
182849
|
+
}
|
|
182850
|
+
return { ok: true, value: void 0 };
|
|
182851
|
+
}
|
|
182852
|
+
|
|
182719
182853
|
// src/saved-previews.ts
|
|
182720
|
-
|
|
182854
|
+
import fs35 from "node:fs";
|
|
182855
|
+
import path41 from "node:path";
|
|
182856
|
+
async function stageSavedPreviews(directory3, inputs, plan2, stopped2, custom2 = [], frozen = []) {
|
|
182721
182857
|
const saved = Object.keys(inputs.sections);
|
|
182722
182858
|
const planned = reviewPreviewIds(plan2);
|
|
182723
|
-
const ids = planned.length ? [.../* @__PURE__ */ new Set([...planned, ...saved.filter((id2) => custom2.includes(id2))])] : saved;
|
|
182859
|
+
const ids = (planned.length ? [.../* @__PURE__ */ new Set([...planned, ...saved.filter((id2) => custom2.includes(id2))])] : saved).filter((id2) => !frozen.includes(id2));
|
|
182724
182860
|
if (!ids.length) return { ok: true, value: void 0 };
|
|
182725
182861
|
const invalid = (name) => ({ ok: false, code: "bad_request", error: `Sync the saved Preview and its assets first: ${name}` });
|
|
182726
182862
|
const files = /* @__PURE__ */ new Map();
|
|
@@ -182745,10 +182881,10 @@ async function stageSavedPreviews(directory3, inputs, plan2, stopped2, custom2 =
|
|
|
182745
182881
|
const version2 = asset2.version;
|
|
182746
182882
|
const bytes2 = await readAsset(asset2.artifact, version2);
|
|
182747
182883
|
if (!bytes2.ok) return { ...bytes2, error: `${source2} (saved version ${version2}): ${bytes2.error}` };
|
|
182748
|
-
const extension =
|
|
182884
|
+
const extension = path41.posix.extname(source2).toLowerCase();
|
|
182749
182885
|
const suffix = extension === ".tsx" && /^\s*(?:<!doctype html|<html)\b/i.test(Buffer.from(bytes2.value.subarray(0, 256)).toString()) ? ".html" : /^\.[a-z0-9]+$/.test(extension) ? extension : "";
|
|
182750
|
-
const file3 =
|
|
182751
|
-
|
|
182886
|
+
const file3 = path41.join(directory3, `${files.size + 1}-${asset2.artifact}-${version2}${suffix}`);
|
|
182887
|
+
fs35.writeFileSync(file3, bytes2.value);
|
|
182752
182888
|
savedFile = { artifact: asset2.artifact, version: version2, file: file3 };
|
|
182753
182889
|
files.set(source2, savedFile);
|
|
182754
182890
|
}
|
|
@@ -182758,14 +182894,14 @@ async function stageSavedPreviews(directory3, inputs, plan2, stopped2, custom2 =
|
|
|
182758
182894
|
|
|
182759
182895
|
${section.body}${attachments.length ? "\n\nPinned files:\n" + attachments.join("\n") : ""}`);
|
|
182760
182896
|
}
|
|
182761
|
-
const manifest =
|
|
182762
|
-
|
|
182897
|
+
const manifest = path41.join(directory3, "previews.md");
|
|
182898
|
+
fs35.writeFileSync(manifest, sections.join("\n\n") + "\n");
|
|
182763
182899
|
return { ok: true, value: manifest };
|
|
182764
182900
|
}
|
|
182765
182901
|
|
|
182766
182902
|
// src/triage.ts
|
|
182767
|
-
import
|
|
182768
|
-
import
|
|
182903
|
+
import fs36 from "node:fs";
|
|
182904
|
+
import path42 from "node:path";
|
|
182769
182905
|
|
|
182770
182906
|
// ../cli/src/lib/signals/identity.ts
|
|
182771
182907
|
import { createHash as createHash5 } from "node:crypto";
|
|
@@ -182773,8 +182909,8 @@ var DERIVED = "derived-";
|
|
|
182773
182909
|
var derivedSourceId = (seed) => `${DERIVED}${createHash5("sha256").update(seed).digest("hex").slice(0, 16)}`;
|
|
182774
182910
|
|
|
182775
182911
|
// src/triage.ts
|
|
182776
|
-
var triageDir = (board) =>
|
|
182777
|
-
var rejectedDir = (board) =>
|
|
182912
|
+
var triageDir = (board) => path42.join(board, "triage");
|
|
182913
|
+
var rejectedDir = (board) => path42.join(board, ".archive", REJECTIONS_TO_REVIEW);
|
|
182778
182914
|
var stamp2 = (at2) => formatStamp(at2 ? new Date(at2) : /* @__PURE__ */ new Date());
|
|
182779
182915
|
function slugOf(title) {
|
|
182780
182916
|
return title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 56).replace(/-+$/, "") || "item";
|
|
@@ -182782,7 +182918,7 @@ function slugOf(title) {
|
|
|
182782
182918
|
function freeName(dir, title) {
|
|
182783
182919
|
const stem = slugOf(title);
|
|
182784
182920
|
let name = `${stem}.md`;
|
|
182785
|
-
for (let n = 2;
|
|
182921
|
+
for (let n = 2; fs36.existsSync(path42.join(dir, name)); n++) name = `${stem}-${n}.md`;
|
|
182786
182922
|
return name;
|
|
182787
182923
|
}
|
|
182788
182924
|
function itemText(item, fields2 = {}) {
|
|
@@ -182802,16 +182938,16 @@ ${item.text.trim()}
|
|
|
182802
182938
|
`;
|
|
182803
182939
|
}
|
|
182804
182940
|
function writeItem(dir, item, fields2 = {}) {
|
|
182805
|
-
|
|
182941
|
+
fs36.mkdirSync(dir, { recursive: true });
|
|
182806
182942
|
const name = freeName(dir, item.title);
|
|
182807
|
-
|
|
182943
|
+
fs36.writeFileSync(path42.join(dir, name), itemText(item, item.studio ? { studio: studioName(item.studio), ...fields2 } : fields2));
|
|
182808
182944
|
return name;
|
|
182809
182945
|
}
|
|
182810
182946
|
function layOut(board, rejections) {
|
|
182811
182947
|
const dir = rejectedDir(board);
|
|
182812
|
-
|
|
182948
|
+
fs36.mkdirSync(dir, { recursive: true });
|
|
182813
182949
|
for (const t of rejections.tasks) {
|
|
182814
|
-
|
|
182950
|
+
fs36.writeFileSync(path42.join(dir, `${t.number}-${slugify2(t.title)}.md`), [
|
|
182815
182951
|
"---",
|
|
182816
182952
|
`title: ${yamlScalar(t.title)}`,
|
|
182817
182953
|
"status: todo",
|
|
@@ -182826,7 +182962,7 @@ function layOut(board, rejections) {
|
|
|
182826
182962
|
].join("\n"));
|
|
182827
182963
|
}
|
|
182828
182964
|
for (const item of rejections.triage) {
|
|
182829
|
-
const sub =
|
|
182965
|
+
const sub = path42.join(triageDir(board), item.state === "dismissed" ? "dismissed" : "archived");
|
|
182830
182966
|
const fields2 = item.state === "dismissed" ? { dismissed_at: stamp2(item.dismissed_at), dismissed_by: "user", ...item.dismissed_reason ? { dismissed_reason: item.dismissed_reason } : {} } : {};
|
|
182831
182967
|
writeItem(sub, item, fields2);
|
|
182832
182968
|
}
|
|
@@ -182835,12 +182971,12 @@ function layOut(board, rejections) {
|
|
|
182835
182971
|
|
|
182836
182972
|
// ../cli/src/lib/skill/hook.ts
|
|
182837
182973
|
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
182838
|
-
import
|
|
182839
|
-
import
|
|
182974
|
+
import fs37 from "node:fs";
|
|
182975
|
+
import path43 from "node:path";
|
|
182840
182976
|
var MARKER_LINE = /^# ai4kanban commit guard\b/m;
|
|
182841
182977
|
var read3 = (file3) => {
|
|
182842
182978
|
try {
|
|
182843
|
-
return
|
|
182979
|
+
return fs37.readFileSync(file3, "utf8");
|
|
182844
182980
|
} catch {
|
|
182845
182981
|
return null;
|
|
182846
182982
|
}
|
|
@@ -182852,15 +182988,15 @@ function hooksDir(root2) {
|
|
|
182852
182988
|
windowsHide: true
|
|
182853
182989
|
});
|
|
182854
182990
|
if (out.error || out.status !== 0 || !out.stdout.trim()) return null;
|
|
182855
|
-
return
|
|
182991
|
+
return path43.resolve(root2, out.stdout.trim());
|
|
182856
182992
|
}
|
|
182857
182993
|
function installCommitHook(root2, _board) {
|
|
182858
182994
|
const dir = hooksDir(root2);
|
|
182859
182995
|
if (!dir) return {};
|
|
182860
|
-
const file3 =
|
|
182861
|
-
if (
|
|
182996
|
+
const file3 = path43.join(dir, "pre-commit");
|
|
182997
|
+
if (fs37.lstatSync(file3, { throwIfNoEntry: false })?.isSymbolicLink()) return {};
|
|
182862
182998
|
const source2 = read3(file3);
|
|
182863
|
-
if (source2 && MARKER_LINE.test(source2))
|
|
182999
|
+
if (source2 && MARKER_LINE.test(source2)) fs37.unlinkSync(file3);
|
|
182864
183000
|
return {};
|
|
182865
183001
|
}
|
|
182866
183002
|
|
|
@@ -182904,7 +183040,7 @@ function runtimeCosts(runs, job) {
|
|
|
182904
183040
|
}
|
|
182905
183041
|
function reviewOf2(file3, questionsOnly = false) {
|
|
182906
183042
|
try {
|
|
182907
|
-
const meta3 = parseFrontmatter(
|
|
183043
|
+
const meta3 = parseFrontmatter(fs38.readFileSync(file3, "utf8")).meta;
|
|
182908
183044
|
return meta3 && (!questionsOnly || meta3.questions?.length) ? reviewOf(meta3) : null;
|
|
182909
183045
|
} catch {
|
|
182910
183046
|
return null;
|
|
@@ -182912,15 +183048,15 @@ function reviewOf2(file3, questionsOnly = false) {
|
|
|
182912
183048
|
}
|
|
182913
183049
|
function asks(file3) {
|
|
182914
183050
|
try {
|
|
182915
|
-
return (parseFrontmatter(
|
|
183051
|
+
return (parseFrontmatter(fs38.readFileSync(file3, "utf8")).meta?.questions ?? []).length > 0;
|
|
182916
183052
|
} catch {
|
|
182917
183053
|
return false;
|
|
182918
183054
|
}
|
|
182919
183055
|
}
|
|
182920
183056
|
function mcpConfig(servers, file3) {
|
|
182921
183057
|
if (!Object.keys(servers).length) return null;
|
|
182922
|
-
|
|
182923
|
-
|
|
183058
|
+
fs38.mkdirSync(path44.dirname(file3), { recursive: true });
|
|
183059
|
+
fs38.writeFileSync(file3, `${JSON.stringify({ mcpServers: servers }, null, 2)}
|
|
182924
183060
|
`);
|
|
182925
183061
|
return file3;
|
|
182926
183062
|
}
|
|
@@ -182951,16 +183087,16 @@ async function stopRuns(akb, ws, id2, since, ms) {
|
|
|
182951
183087
|
var working = /* @__PURE__ */ new Map();
|
|
182952
183088
|
var workKey = (ws, id2) => `${ws.board}#${id2}`;
|
|
182953
183089
|
function checkoutsOf(ws, id2) {
|
|
182954
|
-
const dir =
|
|
183090
|
+
const dir = path44.join(ws.board, "deliveries");
|
|
182955
183091
|
let names2;
|
|
182956
183092
|
try {
|
|
182957
|
-
names2 =
|
|
183093
|
+
names2 = fs38.readdirSync(dir).filter((n) => n.endsWith(".json"));
|
|
182958
183094
|
} catch {
|
|
182959
183095
|
return [];
|
|
182960
183096
|
}
|
|
182961
183097
|
return names2.flatMap((n) => {
|
|
182962
183098
|
try {
|
|
182963
|
-
const held5 = JSON.parse(
|
|
183099
|
+
const held5 = JSON.parse(fs38.readFileSync(path44.join(dir, n), "utf8"));
|
|
182964
183100
|
return held5.cardId === id2 && held5.deliveryId ? [held5.deliveryId] : [];
|
|
182965
183101
|
} catch {
|
|
182966
183102
|
return [];
|
|
@@ -182974,7 +183110,7 @@ var RESUME_REFUSED = {
|
|
|
182974
183110
|
deliveryRunGoing: "\u4E0A\u6B21\u7684\u8FD0\u884C\u8FD8\u6CA1\u505C\u4E0B\uFF0C\u8BF7\u7A0D\u540E\u518D\u70B9\u300C\u7EED\u8DD1\u300D\u3002",
|
|
182975
183111
|
deliveryCardGone: "\u8FD9\u5F20\u5361\u5DF2\u4E0D\u5728\u770B\u677F\u4E0A\uFF0C\u6CA1\u6709\u53EF\u7EED\u8DD1\u7684\u5185\u5BB9\uFF0C\u8BF7\u70B9\u300C\u91CD\u65B0\u53D1\u8D77\u300D\u3002"
|
|
182976
183112
|
};
|
|
182977
|
-
var isArchived = (ws, id2) =>
|
|
183113
|
+
var isArchived = (ws, id2) => path44.relative(ws.board, findCard(ws.board, id2) ?? ws.board).split(path44.sep)[0] === ".archive";
|
|
182978
183114
|
var refusal2 = (ran) => ran.last.replace(/^akb( raw)?: /, "").slice(0, 300) || "akb stopped with an error.";
|
|
182979
183115
|
var reasonOf = (text3) => (text3 ?? "").split("\n").map((l2) => l2.trim()).filter((l2) => l2 && !/^at\s/.test(l2)).join("\n").slice(0, 300) || void 0;
|
|
182980
183116
|
function logLines(show, event2) {
|
|
@@ -183036,7 +183172,7 @@ async function setUp(job, ws, deps, io) {
|
|
|
183036
183172
|
const runtime = job.runtime;
|
|
183037
183173
|
const missing = io.flowRun?.finished ? void 0 : unavailable(runtime, await deps.runtimes());
|
|
183038
183174
|
if (missing) return missing;
|
|
183039
|
-
if (!
|
|
183175
|
+
if (!fs38.existsSync(path44.join(ws.board, "config.md"))) {
|
|
183040
183176
|
const init = await akb(["raw", "init"]);
|
|
183041
183177
|
if (init.code !== 0) return refusal2(init);
|
|
183042
183178
|
}
|
|
@@ -183053,7 +183189,7 @@ async function setUp(job, ws, deps, io) {
|
|
|
183053
183189
|
const used = await akb(["raw", "agent", "use", runtime]);
|
|
183054
183190
|
if (used.code !== 0) return refusal2(used);
|
|
183055
183191
|
const servers = mcpServersOf(ws);
|
|
183056
|
-
const mcpFile =
|
|
183192
|
+
const mcpFile = path44.join(ws.board, ".sync", `${ws.task}.mcp.json`);
|
|
183057
183193
|
const takes = new Set(settingKeys(runtime));
|
|
183058
183194
|
const given = job.settings ?? {};
|
|
183059
183195
|
const values = valuesOf(runtime, job.model, given, servers, mcpFile);
|
|
@@ -183133,9 +183269,9 @@ async function reviewRejections(job, ws, deps, io, refreshReview) {
|
|
|
183133
183269
|
if (!read5.value.tasks.length && !read5.value.triage.length || stopping(io)) return { runs: [] };
|
|
183134
183270
|
const since = Date.now();
|
|
183135
183271
|
const akb = boardAkb(job, ws, deps, io);
|
|
183136
|
-
const directory3 =
|
|
183137
|
-
|
|
183138
|
-
const scratch =
|
|
183272
|
+
const directory3 = path44.join(ws.board, ".sync");
|
|
183273
|
+
fs38.mkdirSync(directory3, { recursive: true });
|
|
183274
|
+
const scratch = fs38.mkdtempSync(path44.join(directory3, "rejection-review-"));
|
|
183139
183275
|
try {
|
|
183140
183276
|
const laid = layOut(scratch, read5.value);
|
|
183141
183277
|
const denied = await refreshReview?.();
|
|
@@ -183146,7 +183282,7 @@ async function reviewRejections(job, ws, deps, io, refreshReview) {
|
|
|
183146
183282
|
if (ran.code !== 0) return { runs, failure: refusal2(ran) };
|
|
183147
183283
|
return { runs, laid, session: answerOf2(ran)?.agentSession };
|
|
183148
183284
|
} finally {
|
|
183149
|
-
|
|
183285
|
+
fs38.rmSync(scratch, { recursive: true, force: true });
|
|
183150
183286
|
}
|
|
183151
183287
|
}
|
|
183152
183288
|
async function learnRejections(job, ws, deps, io, refreshReview) {
|
|
@@ -183196,19 +183332,19 @@ async function runAgent(job, ws, deps, io) {
|
|
|
183196
183332
|
}
|
|
183197
183333
|
function writeTranscript(job, dir) {
|
|
183198
183334
|
if (!job.transcript) return "";
|
|
183199
|
-
const file3 =
|
|
183200
|
-
|
|
183201
|
-
|
|
183335
|
+
const file3 = path44.join(dir, "discussion.md");
|
|
183336
|
+
fs38.mkdirSync(dir, { recursive: true });
|
|
183337
|
+
fs38.writeFileSync(file3, `${job.transcript}
|
|
183202
183338
|
`);
|
|
183203
183339
|
return file3;
|
|
183204
183340
|
}
|
|
183205
183341
|
function pictures(job, ws, id2) {
|
|
183206
183342
|
const dir = cardAssetsDir(ws, id2);
|
|
183207
183343
|
if (!job.attachments.length || !dir) return "";
|
|
183208
|
-
|
|
183344
|
+
fs38.mkdirSync(dir, { recursive: true });
|
|
183209
183345
|
return job.attachments.map((a2, i) => {
|
|
183210
|
-
const file3 = `${i + 1}-${
|
|
183211
|
-
|
|
183346
|
+
const file3 = `${i + 1}-${path44.basename(a2.name).replace(/[^\w.-]+/g, "-")}`;
|
|
183347
|
+
fs38.writeFileSync(path44.join(dir, file3), Buffer.from(a2.content, "base64"));
|
|
183212
183348
|
return `
|
|
183213
183349
|
<Asset src=".assets/${id2}/${file3}" label="${a2.name.replace(/["<>]/g, "") || file3}" />
|
|
183214
183350
|
`;
|
|
@@ -183216,7 +183352,7 @@ function pictures(job, ws, id2) {
|
|
|
183216
183352
|
}
|
|
183217
183353
|
function cardFlags(ws, fields2) {
|
|
183218
183354
|
if (!fields2) return [];
|
|
183219
|
-
const open2 = (keys) => (keys ?? []).map((k2) => Number(/(\d+)$/.exec(k2)?.[1])).filter((n) => n > 0 && n !== ws.number && findCard(ws.board, n)?.startsWith(
|
|
183355
|
+
const open2 = (keys) => (keys ?? []).map((k2) => Number(/(\d+)$/.exec(k2)?.[1])).filter((n) => n > 0 && n !== ws.number && findCard(ws.board, n)?.startsWith(path44.join(ws.board, "todo") + path44.sep));
|
|
183220
183356
|
const lists = [["--modules", fields2.modules ?? []], ["--related", open2(fields2.related)], ["--blocked-by", open2(fields2.blocked_by)]];
|
|
183221
183357
|
return [
|
|
183222
183358
|
...fields2.priority ? ["--priority", fields2.priority] : [],
|
|
@@ -183261,6 +183397,7 @@ async function runFlow(job, ws, deps, io) {
|
|
|
183261
183397
|
currentTask = current2.value;
|
|
183262
183398
|
}
|
|
183263
183399
|
let previewDirectory;
|
|
183400
|
+
let stagedUiRevision;
|
|
183264
183401
|
async function launch2(args2, show = false, env2) {
|
|
183265
183402
|
const denied = await refreshReview();
|
|
183266
183403
|
const refuse = (reason) => ({ code: 1, out: "", last: reason, reviewRefused: reason });
|
|
@@ -183268,44 +183405,46 @@ async function runFlow(job, ws, deps, io) {
|
|
|
183268
183405
|
const review = job.taskReview;
|
|
183269
183406
|
const task = currentTask;
|
|
183270
183407
|
const startsDelivery = ["delivery resume", "run resume", "card implement"].includes(args2.slice(1, 3).join(" "));
|
|
183271
|
-
if (review &&
|
|
183272
|
-
const inputs = task
|
|
183273
|
-
|
|
183274
|
-
|
|
183275
|
-
|
|
183276
|
-
|
|
183277
|
-
inputs,
|
|
183278
|
-
review.plan,
|
|
183279
|
-
() => stopping(io),
|
|
183280
|
-
review.preview_definitions?.map((p2) => p2.id)
|
|
183281
|
-
));
|
|
183282
|
-
if (!staged.ok) return refuse(refusedSync(job, staged));
|
|
183283
|
-
if (staged.value) {
|
|
183284
|
-
const changed = await refreshReview();
|
|
183285
|
-
if (changed) return refuse(changed);
|
|
183286
|
-
if (job.taskReview?.revision !== review.revision || currentTask?.card_version !== task.card_version || !isDeepStrictEqual2(currentTask?.preview_inputs, inputs)) return refuse("The saved Previews changed. Read the task again.");
|
|
183287
|
-
env2 = { ...env2, [SAVED_PREVIEW_FILE_ENV]: staged.value };
|
|
183288
|
-
}
|
|
183289
|
-
} else if (review && verb === "implement" && startsDelivery && studioName(ws.studio ?? flow.studio ?? "") === "coding") {
|
|
183290
|
-
const files = approvedUiPreviews(review);
|
|
183291
|
-
if (files.length) {
|
|
183292
|
-
previewDirectory ??= fs37.mkdtempSync(path43.join(os6.tmpdir(), "wildcrane-approved-ui-"));
|
|
183408
|
+
if (review && verb === "implement" && startsDelivery) {
|
|
183409
|
+
const inputs = task?.preview_inputs;
|
|
183410
|
+
const previews = coding ? approvedUiPreviews(review) : [];
|
|
183411
|
+
let saved;
|
|
183412
|
+
if (inputs || previews.length) {
|
|
183413
|
+
previewDirectory ??= fs38.mkdtempSync(path44.join(os6.tmpdir(), "wildcrane-previews-"));
|
|
183293
183414
|
const directory3 = previewDirectory;
|
|
183294
|
-
|
|
183295
|
-
|
|
183296
|
-
|
|
183297
|
-
const
|
|
183298
|
-
if (
|
|
183299
|
-
|
|
183300
|
-
|
|
183301
|
-
|
|
183302
|
-
|
|
183303
|
-
|
|
183304
|
-
|
|
183305
|
-
|
|
183415
|
+
if (previews.length) {
|
|
183416
|
+
const uiDirectory = path44.join(directory3, "approved-ui");
|
|
183417
|
+
if (stagedUiRevision !== review.revision) {
|
|
183418
|
+
const staged = await attemptSync(io, "review", () => stageApprovedUi(uiDirectory, previews, () => stopping(io), cloudLanguage(job) === "zh"));
|
|
183419
|
+
if (!staged.ok) {
|
|
183420
|
+
const reason = refusedSync(job, staged);
|
|
183421
|
+
return refuse(reason && staged.error);
|
|
183422
|
+
}
|
|
183423
|
+
stagedUiRevision = review.revision;
|
|
183424
|
+
}
|
|
183425
|
+
env2 = { ...env2, [APPROVED_UI_DIR_ENV]: uiDirectory };
|
|
183426
|
+
}
|
|
183427
|
+
if (inputs) {
|
|
183428
|
+
const staged = await attemptSync(io, "review", () => stageSavedPreviews(
|
|
183429
|
+
directory3,
|
|
183430
|
+
inputs,
|
|
183431
|
+
review.plan,
|
|
183432
|
+
() => stopping(io),
|
|
183433
|
+
review.preview_definitions?.map((p2) => p2.id),
|
|
183434
|
+
previews.map((preview) => preview.id)
|
|
183435
|
+
));
|
|
183436
|
+
if (!staged.ok) return refuse(refusedSync(job, staged));
|
|
183437
|
+
saved = staged.value;
|
|
183438
|
+
}
|
|
183439
|
+
}
|
|
183440
|
+
if (saved || previews.length) {
|
|
183306
183441
|
const changed = await refreshReview();
|
|
183307
|
-
if (changed
|
|
183308
|
-
|
|
183442
|
+
if (changed) return refuse(changed);
|
|
183443
|
+
if (job.taskReview?.revision !== review.revision) return refuse("Review authorization changed. Read the task again.");
|
|
183444
|
+
if (saved && (currentTask?.card_version !== task?.card_version || !isDeepStrictEqual2(currentTask?.preview_inputs, inputs))) {
|
|
183445
|
+
return refuse("The saved Previews changed. Read the task again.");
|
|
183446
|
+
}
|
|
183447
|
+
if (saved) env2 = { ...env2, [SAVED_PREVIEW_FILE_ENV]: saved };
|
|
183309
183448
|
}
|
|
183310
183449
|
}
|
|
183311
183450
|
return akb(args2, show, env2);
|
|
@@ -183324,13 +183463,13 @@ async function runFlow(job, ws, deps, io) {
|
|
|
183324
183463
|
said = { title: task.value.title?.trim() ?? "", request: task.value.request?.trim() ?? "" };
|
|
183325
183464
|
}
|
|
183326
183465
|
const title = said.title || "Untitled";
|
|
183327
|
-
const body =
|
|
183328
|
-
|
|
183466
|
+
const body = path44.join(ws.board, ".sync", `${ws.task}.request.md`);
|
|
183467
|
+
fs38.mkdirSync(path44.dirname(body), { recursive: true });
|
|
183329
183468
|
if (!ws.number) return fail("This task has no number yet.");
|
|
183330
183469
|
const created = await withBoard(ws, async () => {
|
|
183331
183470
|
const existing = akbCardOf(ws);
|
|
183332
183471
|
if (existing) return { ok: true, value: existing };
|
|
183333
|
-
|
|
183472
|
+
fs38.writeFileSync(body, `${said.request || title}
|
|
183334
183473
|
${pictures(job, ws, ws.number)}`);
|
|
183335
183474
|
return akb([
|
|
183336
183475
|
"raw",
|
|
@@ -183345,7 +183484,7 @@ ${pictures(job, ws, ws.number)}`);
|
|
|
183345
183484
|
String(ws.number),
|
|
183346
183485
|
...cardFlags(ws, flow.metadata),
|
|
183347
183486
|
"--json"
|
|
183348
|
-
]).then(made).finally(() =>
|
|
183487
|
+
]).then(made).finally(() => fs38.rmSync(body, { force: true }));
|
|
183349
183488
|
}, () => stopping(io));
|
|
183350
183489
|
if (!created || stopping(io)) return fail("");
|
|
183351
183490
|
if (!created.ok) return fail(created.error);
|
|
@@ -183441,8 +183580,8 @@ ${pictures(job, ws, ws.number)}`);
|
|
|
183441
183580
|
if (ended.ok && !coding && flow.verb === "create" && verb === "implement" && job.taskReview && reviewAuthorization(job.taskReview).kind === "unreviewed" && !ended.report.review) ended.report.deliveryCompleted = true;
|
|
183442
183581
|
return ended;
|
|
183443
183582
|
} finally {
|
|
183444
|
-
if (previewDirectory)
|
|
183445
|
-
|
|
183583
|
+
if (previewDirectory) fs38.rmSync(previewDirectory, { recursive: true, force: true });
|
|
183584
|
+
fs38.rmSync(path44.join(ws.board, ".sync", `${ws.task}.discussion`), { recursive: true, force: true });
|
|
183446
183585
|
const left = working.get(key) - 1;
|
|
183447
183586
|
if (left) working.set(key, left);
|
|
183448
183587
|
else working.delete(key);
|
|
@@ -183454,7 +183593,7 @@ ${pictures(job, ws, ws.number)}`);
|
|
|
183454
183593
|
});
|
|
183455
183594
|
const text3 = flow.verb === "create" ? "" : (flow.text ?? "").trim();
|
|
183456
183595
|
const archived = !io.flowRun && flow.resume && isArchived(ws, id3);
|
|
183457
|
-
if (archived && (!coding || parseFrontmatter(
|
|
183596
|
+
if (archived && (!coding || parseFrontmatter(fs38.readFileSync(cardFile(ws), "utf8")).meta?.rejected)) {
|
|
183458
183597
|
return { ok: true, report: { card: id3, ...coding ? { deliveryCompleted: false } : {} } };
|
|
183459
183598
|
}
|
|
183460
183599
|
if (!io.flowRun && flow.resume && verb === "refine" && !hasReview && (!reconciled || reconciled.kind === "none")) {
|
|
@@ -183462,7 +183601,7 @@ ${pictures(job, ws, ws.number)}`);
|
|
|
183462
183601
|
if (review2) return { ok: true, report: { card: id3, ...review2 === true ? {} : { review: review2 } } };
|
|
183463
183602
|
}
|
|
183464
183603
|
let note = verb === "resolve" || verb === "revise" ? text3 : "";
|
|
183465
|
-
const isRejected = () => isArchived(ws, id3) && parseFrontmatter(
|
|
183604
|
+
const isRejected = () => isArchived(ws, id3) && parseFrontmatter(fs38.readFileSync(cardFile(ws), "utf8")).meta?.rejected === true;
|
|
183466
183605
|
let ran;
|
|
183467
183606
|
let continuation;
|
|
183468
183607
|
let expectedDelivery;
|
|
@@ -183597,11 +183736,11 @@ ${pictures(job, ws, ws.number)}`);
|
|
|
183597
183736
|
function carryArgs(verb2) {
|
|
183598
183737
|
if (flow.replan) return ["--new-session"];
|
|
183599
183738
|
if (verb2 === "implement" && flow.verb === "create") {
|
|
183600
|
-
const transcript2 = writeTranscript(job,
|
|
183739
|
+
const transcript2 = writeTranscript(job, path44.join(ws.board, ".sync", `${ws.task}.discussion`));
|
|
183601
183740
|
return transcript2 ? ["--transcript", transcript2] : [];
|
|
183602
183741
|
}
|
|
183603
183742
|
if (!["refine", "resolve", "revise"].includes(verb2)) return [];
|
|
183604
|
-
const transcript = writeTranscript(job,
|
|
183743
|
+
const transcript = writeTranscript(job, path44.join(ws.board, ".sync", `${ws.task}.discussion`));
|
|
183605
183744
|
return [
|
|
183606
183745
|
...job.resume ? ["--session", job.resume, ...job.fork ? ["--fork"] : []] : [],
|
|
183607
183746
|
...transcript ? ["--transcript", transcript] : []
|
|
@@ -183660,8 +183799,8 @@ async function flowRunEvidence(ws, job, deps, execution = job.id, prior) {
|
|
|
183660
183799
|
}
|
|
183661
183800
|
|
|
183662
183801
|
// src/recovery.ts
|
|
183663
|
-
import
|
|
183664
|
-
import
|
|
183802
|
+
import fs39 from "node:fs";
|
|
183803
|
+
import path45 from "node:path";
|
|
183665
183804
|
|
|
183666
183805
|
// ../cli/src/lib/agent/wire/codex-background-types.ts
|
|
183667
183806
|
function idleStopConfirmed(cleanup, session) {
|
|
@@ -183670,10 +183809,10 @@ function idleStopConfirmed(cleanup, session) {
|
|
|
183670
183809
|
|
|
183671
183810
|
// src/recovery.ts
|
|
183672
183811
|
var recoveryBlocked = (job) => cloudLanguage(job) === "zh" ? "\u65E0\u6CD5\u6838\u5BF9\u4E0A\u6B21\u6267\u884C\uFF0C\u5DF2\u6709\u6210\u679C\u5DF2\u4FDD\u7559\u3002" : "The previous execution could not be verified. Saved work was preserved.";
|
|
183673
|
-
var fileOf2 = (id2) =>
|
|
183812
|
+
var fileOf2 = (id2) => path45.join(runnerHome(), "checkpoints", `${encodeURIComponent(id2)}.json`);
|
|
183674
183813
|
function readCheckpoint(id2) {
|
|
183675
183814
|
try {
|
|
183676
|
-
const held5 = JSON.parse(
|
|
183815
|
+
const held5 = JSON.parse(fs39.readFileSync(fileOf2(id2), "utf8"));
|
|
183677
183816
|
if (!held5 || !Array.isArray(held5.pending) || !held5.pending.every((id3) => typeof id3 === "string")) throw new Error("\u8FDB\u5EA6\u683C\u5F0F\u9519\u8BEF");
|
|
183678
183817
|
if (held5.syncRetry && (!Number.isSafeInteger(held5.syncRetry.attempt) || held5.syncRetry.attempt < 1 || !Number.isFinite(held5.syncRetry.at))) {
|
|
183679
183818
|
delete held5.syncRetry;
|
|
@@ -183692,12 +183831,12 @@ function readCheckpoint(id2) {
|
|
|
183692
183831
|
}
|
|
183693
183832
|
function saveCheckpoint(id2, checkpoint) {
|
|
183694
183833
|
const file3 = fileOf2(id2);
|
|
183695
|
-
|
|
183696
|
-
|
|
183697
|
-
|
|
183834
|
+
fs39.mkdirSync(path45.dirname(file3), { recursive: true, mode: 448 });
|
|
183835
|
+
fs39.writeFileSync(`${file3}.tmp`, JSON.stringify(checkpoint), { mode: 384 });
|
|
183836
|
+
fs39.renameSync(`${file3}.tmp`, file3);
|
|
183698
183837
|
}
|
|
183699
183838
|
function clearCheckpoint(id2) {
|
|
183700
|
-
|
|
183839
|
+
fs39.rmSync(fileOf2(id2), { force: true });
|
|
183701
183840
|
}
|
|
183702
183841
|
function checkpointEvent(checkpoint, event2) {
|
|
183703
183842
|
if (event2.kind === "phase" && event2.data.phase === "submitted" || event2.kind === "message" && event2.data.text.trim() || event2.kind === "tool_call" || event2.kind === "plan") {
|
|
@@ -183905,32 +184044,32 @@ function conversationProgress(attempt, send3, valid, unconfirmed) {
|
|
|
183905
184044
|
}
|
|
183906
184045
|
|
|
183907
184046
|
// src/settings-control.ts
|
|
183908
|
-
import
|
|
183909
|
-
import
|
|
184047
|
+
import fs40 from "node:fs";
|
|
184048
|
+
import path46 from "node:path";
|
|
183910
184049
|
|
|
183911
184050
|
// src/codex-native.ts
|
|
183912
184051
|
var import_undici2 = __toESM(require_undici(), 1);
|
|
183913
184052
|
|
|
183914
184053
|
// src/settings-control.ts
|
|
183915
|
-
var directory = () =>
|
|
183916
|
-
var epochFile = () =>
|
|
184054
|
+
var directory = () => path46.join(runnerHome(), "executors");
|
|
184055
|
+
var epochFile = () => path46.join(runnerHome(), "account-generation");
|
|
183917
184056
|
function accountGeneration() {
|
|
183918
184057
|
try {
|
|
183919
|
-
return
|
|
184058
|
+
return fs40.readFileSync(epochFile(), "utf8");
|
|
183920
184059
|
} catch {
|
|
183921
184060
|
return "";
|
|
183922
184061
|
}
|
|
183923
184062
|
}
|
|
183924
184063
|
function executorRecord() {
|
|
183925
|
-
|
|
183926
|
-
const file3 =
|
|
183927
|
-
|
|
183928
|
-
return () =>
|
|
184064
|
+
fs40.mkdirSync(directory(), { recursive: true, mode: 448 });
|
|
184065
|
+
const file3 = path46.join(directory(), `${process.pid}.json`);
|
|
184066
|
+
fs40.writeFileSync(file3, "{}", { mode: 384 });
|
|
184067
|
+
return () => fs40.rmSync(file3, { force: true });
|
|
183929
184068
|
}
|
|
183930
184069
|
|
|
183931
184070
|
// src/reply-images.ts
|
|
183932
|
-
import
|
|
183933
|
-
import
|
|
184071
|
+
import fs41 from "node:fs";
|
|
184072
|
+
import path47 from "node:path";
|
|
183934
184073
|
import os7 from "node:os";
|
|
183935
184074
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
183936
184075
|
import { createHash as createHash6 } from "node:crypto";
|
|
@@ -183949,16 +184088,16 @@ function imageMime(bytes2) {
|
|
|
183949
184088
|
// src/reply-images.ts
|
|
183950
184089
|
init_file_limits();
|
|
183951
184090
|
var inside = (root2, file3) => {
|
|
183952
|
-
const p2 =
|
|
183953
|
-
return p2 !== ".." && !p2.startsWith(`..${
|
|
184091
|
+
const p2 = path47.relative(root2, file3);
|
|
184092
|
+
return p2 !== ".." && !p2.startsWith(`..${path47.sep}`) && !path47.isAbsolute(p2);
|
|
183954
184093
|
};
|
|
183955
184094
|
function collectReplyImages(parts, cwd) {
|
|
183956
184095
|
const files = /* @__PURE__ */ new Map();
|
|
183957
184096
|
const tools = [];
|
|
183958
184097
|
const output3 = [];
|
|
183959
|
-
const roots = [cwd,
|
|
184098
|
+
const roots = [cwd, path47.join(process.env.CODEX_HOME?.trim() || path47.join(os7.homedir(), ".codex"), "generated_images")].flatMap((p2) => {
|
|
183960
184099
|
try {
|
|
183961
|
-
return [
|
|
184100
|
+
return [fs41.realpathSync(p2)];
|
|
183962
184101
|
} catch {
|
|
183963
184102
|
return [];
|
|
183964
184103
|
}
|
|
@@ -183966,17 +184105,17 @@ function collectReplyImages(parts, cwd) {
|
|
|
183966
184105
|
const registered = new Set(parts.flatMap((p2) => {
|
|
183967
184106
|
if (p2.type !== "image" || !p2.registered || !p2.path) return [];
|
|
183968
184107
|
try {
|
|
183969
|
-
const file3 = p2.path.startsWith("file:") ? fileURLToPath3(p2.path) :
|
|
183970
|
-
if (!
|
|
183971
|
-
const real =
|
|
183972
|
-
const fd =
|
|
184108
|
+
const file3 = p2.path.startsWith("file:") ? fileURLToPath3(p2.path) : path47.resolve(cwd, p2.path);
|
|
184109
|
+
if (!fs41.lstatSync(file3).isFile()) return [];
|
|
184110
|
+
const real = fs41.realpathSync(file3);
|
|
184111
|
+
const fd = fs41.openSync(real, fs41.constants.O_RDONLY | (fs41.constants.O_NOFOLLOW ?? 0));
|
|
183973
184112
|
try {
|
|
183974
|
-
const stat2 =
|
|
184113
|
+
const stat2 = fs41.fstatSync(fd);
|
|
183975
184114
|
if (!stat2.isFile() || stat2.size > ASSET_FILE_LIMIT) return [];
|
|
183976
|
-
const mime = imageMime(
|
|
184115
|
+
const mime = imageMime(fs41.readFileSync(fd));
|
|
183977
184116
|
return mime && (!p2.mime || p2.mime === mime) ? [real] : [];
|
|
183978
184117
|
} finally {
|
|
183979
|
-
|
|
184118
|
+
fs41.closeSync(fd);
|
|
183980
184119
|
}
|
|
183981
184120
|
} catch {
|
|
183982
184121
|
return [];
|
|
@@ -183992,16 +184131,16 @@ function collectReplyImages(parts, cwd) {
|
|
|
183992
184131
|
if (!p2.path) throw Error();
|
|
183993
184132
|
const source2 = p2.path.startsWith("file:") ? fileURLToPath3(p2.path) : decodeURIComponent(p2.path);
|
|
183994
184133
|
if (/^[a-z][a-z0-9+.-]*:/i.test(source2) && !/^[A-Za-z]:[\\/]/.test(source2)) throw Error();
|
|
183995
|
-
const real =
|
|
184134
|
+
const real = fs41.realpathSync(path47.resolve(cwd, source2));
|
|
183996
184135
|
if (!/\.(png|jpe?g|gif|webp)$/i.test(source2) && !registered.has(real)) throw Error();
|
|
183997
184136
|
if (!roots.some((root2) => inside(root2, real)) && !registered.has(real)) throw Error();
|
|
183998
|
-
const fd =
|
|
184137
|
+
const fd = fs41.openSync(real, fs41.constants.O_RDONLY | (fs41.constants.O_NOFOLLOW ?? 0));
|
|
183999
184138
|
try {
|
|
184000
|
-
const stat2 =
|
|
184139
|
+
const stat2 = fs41.fstatSync(fd);
|
|
184001
184140
|
if (!stat2.isFile() || stat2.size > ASSET_FILE_LIMIT) throw Error();
|
|
184002
|
-
bytes2 =
|
|
184141
|
+
bytes2 = fs41.readFileSync(fd);
|
|
184003
184142
|
} finally {
|
|
184004
|
-
|
|
184143
|
+
fs41.closeSync(fd);
|
|
184005
184144
|
}
|
|
184006
184145
|
}
|
|
184007
184146
|
return bytes2;
|
|
@@ -184087,8 +184226,8 @@ async function saveReplyImages(parts, cwd, upload2) {
|
|
|
184087
184226
|
// src/handoff.ts
|
|
184088
184227
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
184089
184228
|
import crypto5 from "node:crypto";
|
|
184090
|
-
import
|
|
184091
|
-
import
|
|
184229
|
+
import fs42 from "node:fs";
|
|
184230
|
+
import path48 from "node:path";
|
|
184092
184231
|
var gitRead = (cwd, args2) => {
|
|
184093
184232
|
try {
|
|
184094
184233
|
return execFileSync2("git", ["-C", cwd, ...args2], {
|
|
@@ -184105,8 +184244,8 @@ var digest = (value) => crypto5.createHash("sha256").update(value).digest("hex")
|
|
|
184105
184244
|
function authorizedFolder(folder2) {
|
|
184106
184245
|
if (!folder2) return null;
|
|
184107
184246
|
try {
|
|
184108
|
-
const real =
|
|
184109
|
-
return allowedProjects().some((root2) => real === root2 || real.startsWith(root2 +
|
|
184247
|
+
const real = fs42.realpathSync(folder2);
|
|
184248
|
+
return allowedProjects().some((root2) => real === root2 || real.startsWith(root2 + path48.sep)) ? real : null;
|
|
184110
184249
|
} catch {
|
|
184111
184250
|
return null;
|
|
184112
184251
|
}
|
|
@@ -184116,9 +184255,9 @@ function progressFolder(job, folder2) {
|
|
|
184116
184255
|
if (!token) return folder2;
|
|
184117
184256
|
if (!/^[a-zA-Z0-9-]{1,80}$/.test(token)) return null;
|
|
184118
184257
|
try {
|
|
184119
|
-
const dir =
|
|
184120
|
-
if (!dir.startsWith(
|
|
184121
|
-
const marker = JSON.parse(
|
|
184258
|
+
const dir = fs42.realpathSync(path48.join(folder2, ".akb", "handoffs", token));
|
|
184259
|
+
if (!dir.startsWith(fs42.realpathSync(folder2) + path48.sep)) return null;
|
|
184260
|
+
const marker = JSON.parse(fs42.readFileSync(path48.join(dir, ".akb", "handoff.json"), "utf8"));
|
|
184122
184261
|
return marker.task === job.task && marker.isolation === token ? dir : null;
|
|
184123
184262
|
} catch {
|
|
184124
184263
|
return null;
|
|
@@ -184126,38 +184265,38 @@ function progressFolder(job, folder2) {
|
|
|
184126
184265
|
}
|
|
184127
184266
|
function progressEvidence(job, folder2) {
|
|
184128
184267
|
try {
|
|
184129
|
-
const board =
|
|
184130
|
-
const deliveries =
|
|
184131
|
-
const rows =
|
|
184268
|
+
const board = path48.join(folder2, ".akb", "kanban");
|
|
184269
|
+
const deliveries = path48.join(board, "deliveries");
|
|
184270
|
+
const rows = fs42.readdirSync(deliveries).filter((name) => name.endsWith(".json")).map((name) => JSON.parse(fs42.readFileSync(path48.join(deliveries, name), "utf8"))).filter((row2) => row2.cardId === job.number).sort((a2, b2) => (b2.startedAt ?? 0) - (a2.startedAt ?? 0));
|
|
184132
184271
|
const row = rows[0];
|
|
184133
184272
|
if (!row?.deliveryId) return null;
|
|
184134
|
-
const tree =
|
|
184135
|
-
if (tree !==
|
|
184273
|
+
const tree = fs42.realpathSync(path48.resolve(folder2, row.worktree ?? "."));
|
|
184274
|
+
if (tree !== fs42.realpathSync(folder2) && !tree.startsWith(fs42.realpathSync(folder2) + path48.sep)) return null;
|
|
184136
184275
|
const inventory = gitRead(tree, ["worktree", "list", "--porcelain"]);
|
|
184137
184276
|
const related = (inventory ?? "").split("\n\n").flatMap((entry) => {
|
|
184138
184277
|
const branch = /^branch refs\/heads\/(.+)$/m.exec(entry)?.[1];
|
|
184139
184278
|
const dir = /^worktree (.+)$/m.exec(entry)?.[1];
|
|
184140
|
-
return branch?.startsWith(`card/${job.number}/`) && dir && dir !== tree && dir.startsWith(
|
|
184279
|
+
return branch?.startsWith(`card/${job.number}/`) && dir && dir !== tree && dir.startsWith(fs42.realpathSync(folder2) + path48.sep) ? [dir] : [];
|
|
184141
184280
|
});
|
|
184142
184281
|
const filesIn = (tree2) => {
|
|
184143
184282
|
const changed = [];
|
|
184144
184283
|
const walk = (dir, prefix = "") => {
|
|
184145
|
-
for (const entry of
|
|
184284
|
+
for (const entry of fs42.readdirSync(dir, { withFileTypes: true })) {
|
|
184146
184285
|
if ([".git", ".akb", "node_modules", ".claude", ".agents"].includes(entry.name)) continue;
|
|
184147
184286
|
const name = prefix + entry.name;
|
|
184148
|
-
if (entry.isDirectory()) walk(
|
|
184287
|
+
if (entry.isDirectory()) walk(path48.join(dir, entry.name), name + "/");
|
|
184149
184288
|
else changed.push(name);
|
|
184150
184289
|
}
|
|
184151
184290
|
};
|
|
184152
184291
|
walk(tree2);
|
|
184153
184292
|
changed.sort();
|
|
184154
184293
|
return changed.map((name) => {
|
|
184155
|
-
const file3 =
|
|
184294
|
+
const file3 = path48.join(tree2, name);
|
|
184156
184295
|
try {
|
|
184157
|
-
const stat2 =
|
|
184158
|
-
if (stat2.isSymbolicLink()) return [name, "link", digest(
|
|
184296
|
+
const stat2 = fs42.lstatSync(file3);
|
|
184297
|
+
if (stat2.isSymbolicLink()) return [name, "link", digest(fs42.readlinkSync(file3))];
|
|
184159
184298
|
if (!stat2.isFile()) throw new Error("\u65E0\u6CD5\u9A8C\u8BC1\u6587\u4EF6\u7C7B\u578B");
|
|
184160
|
-
return [name, stat2.mode & 511, digest(
|
|
184299
|
+
return [name, stat2.mode & 511, digest(fs42.readFileSync(file3))];
|
|
184161
184300
|
} catch (e2) {
|
|
184162
184301
|
if (e2.code === "ENOENT") return [name, "deleted"];
|
|
184163
184302
|
throw e2;
|
|
@@ -184194,61 +184333,61 @@ function progressEvidence(job, folder2) {
|
|
|
184194
184333
|
function restartFolder(job, folder2) {
|
|
184195
184334
|
const token = job.handoff?.isolation ?? job.id;
|
|
184196
184335
|
if (!/^[a-zA-Z0-9-]{1,80}$/.test(token)) throw new Error("\u9694\u79BB\u76EE\u5F55\u7F16\u53F7\u65E0\u6548\u3002");
|
|
184197
|
-
const dir =
|
|
184198
|
-
const marker =
|
|
184199
|
-
for (const parent of [
|
|
184200
|
-
if (
|
|
184336
|
+
const dir = path48.join(folder2, ".akb", "handoffs", token);
|
|
184337
|
+
const marker = path48.join(dir, ".akb", "handoff.json");
|
|
184338
|
+
for (const parent of [path48.join(folder2, ".akb"), path48.dirname(dir), dir]) {
|
|
184339
|
+
if (fs42.lstatSync(parent, { throwIfNoEntry: false })?.isSymbolicLink()) throw new Error("\u9694\u79BB\u76EE\u5F55\u4E0D\u80FD\u901A\u8FC7\u7B26\u53F7\u94FE\u63A5\u521B\u5EFA\u3002");
|
|
184201
184340
|
}
|
|
184202
|
-
if (
|
|
184341
|
+
if (fs42.existsSync(dir)) {
|
|
184203
184342
|
if (job.handoff?.recovering) {
|
|
184204
184343
|
try {
|
|
184205
|
-
const saved = JSON.parse(
|
|
184344
|
+
const saved = JSON.parse(fs42.readFileSync(marker, "utf8"));
|
|
184206
184345
|
if (saved.task === job.task && saved.isolation === token) return dir;
|
|
184207
184346
|
} catch {
|
|
184208
184347
|
}
|
|
184209
184348
|
}
|
|
184210
184349
|
throw new Error("\u91CD\u542F\u76EE\u5F55\u5DF2\u5B58\u5728\uFF0C\u8BF7\u91CD\u65B0\u68C0\u67E5\u3002");
|
|
184211
184350
|
}
|
|
184212
|
-
|
|
184213
|
-
|
|
184214
|
-
for (const entry of
|
|
184351
|
+
fs42.mkdirSync(path48.dirname(dir), { recursive: true });
|
|
184352
|
+
fs42.mkdirSync(dir);
|
|
184353
|
+
for (const entry of fs42.readdirSync(folder2)) {
|
|
184215
184354
|
if ([".akb", ".git", "node_modules", ".claude", ".agents"].includes(entry)) continue;
|
|
184216
|
-
|
|
184355
|
+
fs42.cpSync(path48.join(folder2, entry), path48.join(dir, entry), { recursive: true, verbatimSymlinks: true });
|
|
184217
184356
|
}
|
|
184218
|
-
if (
|
|
184219
|
-
|
|
184220
|
-
|
|
184357
|
+
if (fs42.lstatSync(path48.dirname(marker), { throwIfNoEntry: false })?.isSymbolicLink()) throw new Error("\u9694\u79BB\u6807\u8BB0\u76EE\u5F55\u65E0\u6548\u3002");
|
|
184358
|
+
fs42.mkdirSync(path48.dirname(marker), { recursive: true });
|
|
184359
|
+
fs42.writeFileSync(marker, JSON.stringify({ task: job.task, isolation: token }), { flag: "wx" });
|
|
184221
184360
|
return dir;
|
|
184222
184361
|
}
|
|
184223
184362
|
|
|
184224
184363
|
// src/jobs.ts
|
|
184225
184364
|
import { spawn as spawn5 } from "node:child_process";
|
|
184226
|
-
import
|
|
184227
|
-
import
|
|
184365
|
+
import fs49 from "node:fs";
|
|
184366
|
+
import path54 from "node:path";
|
|
184228
184367
|
import { isDeepStrictEqual as isDeepStrictEqual3 } from "node:util";
|
|
184229
184368
|
|
|
184230
184369
|
// ../cli/src/lib/agent/catalog.ts
|
|
184231
|
-
import
|
|
184232
|
-
import
|
|
184370
|
+
import fs43 from "node:fs";
|
|
184371
|
+
import path49 from "node:path";
|
|
184233
184372
|
var CATALOGUE = "https://models.dev/api.json";
|
|
184234
184373
|
var FRESH_FOR_MS = 24 * 60 * 6e4;
|
|
184235
184374
|
var ANSWER_BY_MS = 2e4;
|
|
184236
184375
|
function cacheFile() {
|
|
184237
|
-
return
|
|
184376
|
+
return path49.join(machineHome(), "models-dev.json");
|
|
184238
184377
|
}
|
|
184239
184378
|
var held3;
|
|
184240
184379
|
function readCache() {
|
|
184241
184380
|
const file3 = cacheFile();
|
|
184242
184381
|
let stamp3;
|
|
184243
184382
|
try {
|
|
184244
|
-
const stat2 =
|
|
184383
|
+
const stat2 = fs43.statSync(file3);
|
|
184245
184384
|
stamp3 = `${stat2.mtimeMs}:${stat2.size}`;
|
|
184246
184385
|
} catch {
|
|
184247
184386
|
return void 0;
|
|
184248
184387
|
}
|
|
184249
184388
|
if (held3?.stamp === stamp3) return held3.cached;
|
|
184250
184389
|
try {
|
|
184251
|
-
const data = JSON.parse(
|
|
184390
|
+
const data = JSON.parse(fs43.readFileSync(file3, "utf8"));
|
|
184252
184391
|
if (!data || typeof data.limits !== "object" || !data.limits) return void 0;
|
|
184253
184392
|
const cached3 = {
|
|
184254
184393
|
fetchedAt: typeof data.fetchedAt === "number" ? data.fetchedAt : 0,
|
|
@@ -184287,8 +184426,8 @@ function refreshCatalog() {
|
|
|
184287
184426
|
const limits = limitsIn(await answer.json());
|
|
184288
184427
|
if (Object.keys(limits).length === 0) return;
|
|
184289
184428
|
const file3 = cacheFile();
|
|
184290
|
-
|
|
184291
|
-
|
|
184429
|
+
fs43.mkdirSync(path49.dirname(file3), { recursive: true });
|
|
184430
|
+
fs43.writeFileSync(file3, JSON.stringify({ fetchedAt: Date.now(), limits }));
|
|
184292
184431
|
} catch {
|
|
184293
184432
|
}
|
|
184294
184433
|
})();
|
|
@@ -184381,14 +184520,14 @@ async function replyApprovalBridge(task, number4, approve) {
|
|
|
184381
184520
|
}
|
|
184382
184521
|
|
|
184383
184522
|
// src/akb-version.ts
|
|
184384
|
-
import
|
|
184385
|
-
import
|
|
184386
|
-
var stateFile = () =>
|
|
184387
|
-
var akbVersionDir = (version2) =>
|
|
184388
|
-
var entryOf = (dir) =>
|
|
184523
|
+
import fs44 from "node:fs";
|
|
184524
|
+
import path50 from "node:path";
|
|
184525
|
+
var stateFile = () => path50.join(akbHome(), "state.json");
|
|
184526
|
+
var akbVersionDir = (version2) => path50.join(akbHome(), version2);
|
|
184527
|
+
var entryOf = (dir) => path50.join(dir, "bin", "ai4kanban.mjs");
|
|
184389
184528
|
function readAkbState() {
|
|
184390
184529
|
try {
|
|
184391
|
-
const held5 = JSON.parse(
|
|
184530
|
+
const held5 = JSON.parse(fs44.readFileSync(stateFile(), "utf8"));
|
|
184392
184531
|
return { current: held5.current ?? null, bad: held5.bad ?? [] };
|
|
184393
184532
|
} catch {
|
|
184394
184533
|
return { current: null, bad: [] };
|
|
@@ -184396,12 +184535,12 @@ function readAkbState() {
|
|
|
184396
184535
|
}
|
|
184397
184536
|
function contractOf(dir) {
|
|
184398
184537
|
try {
|
|
184399
|
-
return JSON.parse(
|
|
184538
|
+
return JSON.parse(fs44.readFileSync(path50.join(dir, "package.json"), "utf8")).akbContract ?? null;
|
|
184400
184539
|
} catch {
|
|
184401
184540
|
return null;
|
|
184402
184541
|
}
|
|
184403
184542
|
}
|
|
184404
|
-
var usable = (dir) =>
|
|
184543
|
+
var usable = (dir) => fs44.existsSync(entryOf(dir)) && contractOf(dir) === AKB_CONTRACT;
|
|
184405
184544
|
function currentAkb() {
|
|
184406
184545
|
const { current: current2 } = readAkbState();
|
|
184407
184546
|
if (!current2) return bundledAkb();
|
|
@@ -184409,32 +184548,32 @@ function currentAkb() {
|
|
|
184409
184548
|
if (!usable(dir)) return bundledAkb();
|
|
184410
184549
|
try {
|
|
184411
184550
|
const now = /* @__PURE__ */ new Date();
|
|
184412
|
-
|
|
184551
|
+
fs44.utimesSync(dir, now, now);
|
|
184413
184552
|
} catch {
|
|
184414
184553
|
}
|
|
184415
|
-
return { command: process.execPath, args: akbArgs(entryOf(dir)), version: current2, shim:
|
|
184554
|
+
return { command: process.execPath, args: akbArgs(entryOf(dir)), version: current2, shim: path50.join(dir, "shim") };
|
|
184416
184555
|
}
|
|
184417
184556
|
|
|
184418
184557
|
// src/chats.ts
|
|
184419
|
-
import
|
|
184420
|
-
import
|
|
184558
|
+
import fs46 from "node:fs";
|
|
184559
|
+
import path52 from "node:path";
|
|
184421
184560
|
|
|
184422
184561
|
// ../cli/src/lib/shared/chats.ts
|
|
184423
184562
|
var CHAT_KEEP_DAYS = 30;
|
|
184424
184563
|
|
|
184425
184564
|
// ../cli/src/lib/agent/task-chats.ts
|
|
184426
|
-
import
|
|
184427
|
-
import
|
|
184565
|
+
import fs45 from "node:fs";
|
|
184566
|
+
import path51 from "node:path";
|
|
184428
184567
|
var TASK = /^[\w-]{1,100}$/;
|
|
184429
|
-
var taskChatsDir = (home4 = machineHome()) =>
|
|
184568
|
+
var taskChatsDir = (home4 = machineHome()) => path51.join(home4, "chats");
|
|
184430
184569
|
function taskChatFile(task, home4) {
|
|
184431
184570
|
if (!TASK.test(task)) throw new Error(`${task} is not a task id.`);
|
|
184432
|
-
return
|
|
184571
|
+
return path51.join(taskChatsDir(home4), `${task}.jsonl`);
|
|
184433
184572
|
}
|
|
184434
184573
|
function readTaskChat(task, home4) {
|
|
184435
184574
|
let text3;
|
|
184436
184575
|
try {
|
|
184437
|
-
text3 =
|
|
184576
|
+
text3 = fs45.readFileSync(taskChatFile(task, home4), "utf8");
|
|
184438
184577
|
} catch {
|
|
184439
184578
|
return [];
|
|
184440
184579
|
}
|
|
@@ -184454,18 +184593,18 @@ function readTaskChat(task, home4) {
|
|
|
184454
184593
|
var DAY_MS = 24 * 60 * 6e4;
|
|
184455
184594
|
var KEEP_MS2 = CHAT_KEEP_DAYS * DAY_MS;
|
|
184456
184595
|
var home3 = () => runnerHome();
|
|
184457
|
-
var reviewedFile = () =>
|
|
184596
|
+
var reviewedFile = () => path52.join(taskChatsDir(home3()), "reviewed.json");
|
|
184458
184597
|
function readReviewed() {
|
|
184459
184598
|
try {
|
|
184460
|
-
const held5 = JSON.parse(
|
|
184599
|
+
const held5 = JSON.parse(fs46.readFileSync(reviewedFile(), "utf8"));
|
|
184461
184600
|
return { checkedAt: Number(held5.checkedAt) || 0, tasks: held5.tasks ?? {} };
|
|
184462
184601
|
} catch {
|
|
184463
184602
|
return { checkedAt: 0, tasks: {} };
|
|
184464
184603
|
}
|
|
184465
184604
|
}
|
|
184466
184605
|
function writeReviewed(reviewed) {
|
|
184467
|
-
|
|
184468
|
-
|
|
184606
|
+
fs46.mkdirSync(path52.dirname(reviewedFile()), { recursive: true });
|
|
184607
|
+
fs46.writeFileSync(reviewedFile(), `${JSON.stringify(reviewed, null, 2)}
|
|
184469
184608
|
`);
|
|
184470
184609
|
}
|
|
184471
184610
|
function keepChat(job, reply, at2 = Date.now()) {
|
|
@@ -184475,16 +184614,16 @@ function keepChat(job, reply, at2 = Date.now()) {
|
|
|
184475
184614
|
{ id: job.id, role: "agent", text: reply, at: at2, runtime: job.runtime, model: job.model ?? null }
|
|
184476
184615
|
];
|
|
184477
184616
|
const file3 = taskChatFile(job.task, home3());
|
|
184478
|
-
|
|
184479
|
-
|
|
184617
|
+
fs46.mkdirSync(path52.dirname(file3), { recursive: true });
|
|
184618
|
+
fs46.appendFileSync(file3, lines.map((l2) => `${JSON.stringify(l2)}
|
|
184480
184619
|
`).join(""));
|
|
184481
184620
|
}
|
|
184482
184621
|
function keepCloudChat(task, messages) {
|
|
184483
184622
|
const file3 = taskChatFile(task, home3());
|
|
184484
|
-
if (!messages.length) return
|
|
184623
|
+
if (!messages.length) return fs46.rmSync(file3, { force: true });
|
|
184485
184624
|
const lines = messages.map((m) => ({ id: m.id, role: m.role, text: m.body, at: Date.parse(m.created_at) || Date.now() }));
|
|
184486
|
-
|
|
184487
|
-
|
|
184625
|
+
fs46.mkdirSync(path52.dirname(file3), { recursive: true });
|
|
184626
|
+
fs46.writeFileSync(file3, lines.map((l2) => `${JSON.stringify(l2)}
|
|
184488
184627
|
`).join(""));
|
|
184489
184628
|
}
|
|
184490
184629
|
async function keepDecisions(task, read5) {
|
|
@@ -184502,8 +184641,8 @@ async function keepDecisions(task, read5) {
|
|
|
184502
184641
|
const ids = new Set(comments.map((c2) => c2.id));
|
|
184503
184642
|
const lines = [...readTaskChat(task, home3()).filter((l2) => !ids.has(l2.id)), ...comments].sort((a2, b2) => a2.at - b2.at);
|
|
184504
184643
|
const file3 = taskChatFile(task, home3());
|
|
184505
|
-
|
|
184506
|
-
|
|
184644
|
+
fs46.mkdirSync(path52.dirname(file3), { recursive: true });
|
|
184645
|
+
fs46.writeFileSync(file3, lines.map((l2) => `${JSON.stringify(l2)}
|
|
184507
184646
|
`).join(""));
|
|
184508
184647
|
return true;
|
|
184509
184648
|
}
|
|
@@ -184518,36 +184657,36 @@ function markReviewed2(marks) {
|
|
|
184518
184657
|
}
|
|
184519
184658
|
|
|
184520
184659
|
// src/goals.ts
|
|
184521
|
-
import
|
|
184522
|
-
import
|
|
184660
|
+
import fs48 from "node:fs";
|
|
184661
|
+
import path53 from "node:path";
|
|
184523
184662
|
|
|
184524
184663
|
// ../cli/src/lib/goal-draft.ts
|
|
184525
|
-
import
|
|
184664
|
+
import fs47 from "node:fs";
|
|
184526
184665
|
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
184527
184666
|
var goalDraftEnv = (file3) => ({ KANBAN_GOALS: file3, KANBAN_IDEAS: file3 });
|
|
184528
184667
|
function readGoalDraft(file3) {
|
|
184529
|
-
return decodeGoals(JSON.parse(
|
|
184668
|
+
return decodeGoals(JSON.parse(fs47.readFileSync(file3, "utf8")));
|
|
184530
184669
|
}
|
|
184531
184670
|
function writeGoalDraft(file3, { goals, ...draft }, field) {
|
|
184532
184671
|
const entries = field === "goals" ? goals : goals.map(({ task, ...goal }) => ({ ...goal, task: task?.key ? task : task?.id ?? null }));
|
|
184533
184672
|
const temporary = `${file3}.${randomUUID5()}.tmp`;
|
|
184534
184673
|
try {
|
|
184535
|
-
|
|
184674
|
+
fs47.writeFileSync(temporary, `${JSON.stringify({ ...draft, [field]: entries }, null, 2)}
|
|
184536
184675
|
`, { mode: 384, flag: "wx" });
|
|
184537
|
-
|
|
184676
|
+
fs47.renameSync(temporary, file3);
|
|
184538
184677
|
} finally {
|
|
184539
|
-
|
|
184678
|
+
fs47.rmSync(temporary, { force: true });
|
|
184540
184679
|
}
|
|
184541
184680
|
}
|
|
184542
184681
|
|
|
184543
184682
|
// src/goals.ts
|
|
184544
|
-
var goalsFileOf = (job) =>
|
|
184683
|
+
var goalsFileOf = (job) => path53.join(runnerHome(), "ideas", `${job.id}.json`);
|
|
184545
184684
|
async function writeGoals(job, list3, preserveGoals = false) {
|
|
184546
184685
|
const file3 = goalsFileOf(job);
|
|
184547
184686
|
try {
|
|
184548
|
-
const goals = preserveGoals &&
|
|
184687
|
+
const goals = preserveGoals && fs48.existsSync(file3) ? readGoalDraft(file3).value.goals : job.discussion.goals;
|
|
184549
184688
|
const studios = await studioSnapshot(job.discussion.workspace, job.discussion.catalog, list3);
|
|
184550
|
-
|
|
184689
|
+
fs48.mkdirSync(path53.dirname(file3), { recursive: true });
|
|
184551
184690
|
writeGoalDraft(file3, { workspace: job.discussion.workspace, studios, goals }, "ideas");
|
|
184552
184691
|
return { file: file3 };
|
|
184553
184692
|
} catch (e2) {
|
|
@@ -184560,7 +184699,7 @@ function readGoals(file3) {
|
|
|
184560
184699
|
} catch {
|
|
184561
184700
|
return void 0;
|
|
184562
184701
|
} finally {
|
|
184563
|
-
|
|
184702
|
+
fs48.rmSync(file3, { force: true });
|
|
184564
184703
|
}
|
|
184565
184704
|
}
|
|
184566
184705
|
var owner = "";
|
|
@@ -184673,32 +184812,32 @@ var defaultDeps = (machineId) => ({
|
|
|
184673
184812
|
akb: currentAkb,
|
|
184674
184813
|
runtimes: detectRuntimes
|
|
184675
184814
|
});
|
|
184676
|
-
var ownFolder = () =>
|
|
184815
|
+
var ownFolder = () => path54.join(runnerHome(), "work");
|
|
184677
184816
|
function folderFor(job) {
|
|
184678
184817
|
if (!job.projectDir) {
|
|
184679
|
-
const cwd =
|
|
184680
|
-
|
|
184818
|
+
const cwd = path54.join(ownFolder(), job.id);
|
|
184819
|
+
fs49.mkdirSync(cwd, { recursive: true });
|
|
184681
184820
|
return { cwd };
|
|
184682
184821
|
}
|
|
184683
184822
|
const real = realpath2(job.projectDir);
|
|
184684
|
-
if (real && allowedProjects().some((root2) => real === root2 || real.startsWith(root2 +
|
|
184823
|
+
if (real && allowedProjects().some((root2) => real === root2 || real.startsWith(root2 + path54.sep))) return { cwd: real };
|
|
184685
184824
|
return { refused: `This Runner is not allowed to work in ${job.projectDir}.` };
|
|
184686
184825
|
}
|
|
184687
184826
|
function realpath2(p2) {
|
|
184688
184827
|
try {
|
|
184689
|
-
return
|
|
184828
|
+
return fs49.realpathSync(p2);
|
|
184690
184829
|
} catch {
|
|
184691
184830
|
return null;
|
|
184692
184831
|
}
|
|
184693
184832
|
}
|
|
184694
|
-
var attachmentsOf = (job) =>
|
|
184833
|
+
var attachmentsOf = (job) => path54.join(runnerHome(), "attachments", job.id);
|
|
184695
184834
|
function writeAttachments(job) {
|
|
184696
184835
|
if (!job.attachments.length) return { text: "", files: [] };
|
|
184697
184836
|
const dir = attachmentsOf(job);
|
|
184698
|
-
|
|
184837
|
+
fs49.mkdirSync(dir, { recursive: true });
|
|
184699
184838
|
const files = job.attachments.map((a2) => {
|
|
184700
|
-
const file3 =
|
|
184701
|
-
|
|
184839
|
+
const file3 = path54.join(dir, path54.basename(a2.name));
|
|
184840
|
+
fs49.writeFileSync(file3, Buffer.from(a2.content, "base64"));
|
|
184702
184841
|
return file3;
|
|
184703
184842
|
});
|
|
184704
184843
|
return { text: `
|
|
@@ -184995,12 +185134,12 @@ async function runJob(id2, deps, track = () => {
|
|
|
184995
185134
|
const releases = [];
|
|
184996
185135
|
try {
|
|
184997
185136
|
const akb = deps.akb();
|
|
184998
|
-
releases.push(hold(
|
|
185137
|
+
releases.push(hold(path54.dirname(akb.shim)));
|
|
184999
185138
|
releases.push(hold(akb.shim));
|
|
185000
185139
|
await runClaimed(job, { ...deps, akb }, track, (dir) => releases.push(hold(dir)), lease);
|
|
185001
185140
|
} finally {
|
|
185002
185141
|
for (const release2 of releases) release2();
|
|
185003
|
-
|
|
185142
|
+
fs49.rmSync(attachmentsOf(job), { recursive: true, force: true });
|
|
185004
185143
|
}
|
|
185005
185144
|
return "changed";
|
|
185006
185145
|
}
|
|
@@ -185425,7 +185564,7 @@ async function runClaimedStep(job, deps, track, keep2, lease, scope, replyStream
|
|
|
185425
185564
|
if (checkpoint.approvalCancelled) return { ok: false, error: "This reply failed before. Ask again in a new reply." };
|
|
185426
185565
|
const pushed = await send3({ id: id2, machineId: deps.machineId });
|
|
185427
185566
|
if (!pushed.ok) return { ok: false, error: pushed.error };
|
|
185428
|
-
if (!
|
|
185567
|
+
if (!taskAssetsSynced(folder3)) return { ok: false, error: "Preview uploads are still pending. Try again after they finish." };
|
|
185429
185568
|
const version2 = syncedCardVersion(folder3);
|
|
185430
185569
|
const task2 = await deps.api.readTask(job.task);
|
|
185431
185570
|
if (!task2.ok) return task2;
|
|
@@ -186027,8 +186166,10 @@ async function finish(deps, id2, lease, outcome, reason = "", report2) {
|
|
|
186027
186166
|
await finishAndConfirm(deps, id2, lease, outcome, reason, report2);
|
|
186028
186167
|
}
|
|
186029
186168
|
async function sendBack(job, deps, lease, ws, report2, sync, stream, landed, repair, confirm) {
|
|
186169
|
+
const closesTask = job.flow && !report2.review && (report2.deliveryCompleted ?? (job.flow.verb === "implement" || job.flow.verb === "create" && job.flow.skip_plan));
|
|
186030
186170
|
const result = await sync("publish", async () => {
|
|
186031
186171
|
const pushed2 = await push(ws, { id: job.id, machineId: deps.machineId }, () => stream.asked() || stream.lost());
|
|
186172
|
+
if (pushed2.ok && closesTask && !taskAssetsSynced(ws)) return { ok: false, code: "service_unavailable", error: "Office preview uploads are pending." };
|
|
186032
186173
|
if (!pushed2.ok && job.flow && syncWaitCode(pushed2)) return pushed2;
|
|
186033
186174
|
return !pushed2.ok && pushed2.offline ? { ok: false, error: pushed2.error } : { ok: true, value: pushed2 };
|
|
186034
186175
|
});
|
|
@@ -186045,7 +186186,7 @@ async function sendBack(job, deps, lease, ws, report2, sync, stream, landed, rep
|
|
|
186045
186186
|
console.error("runner: task sync refused", { job: job.id, code: denied.code, error: denied.error });
|
|
186046
186187
|
return finish(deps, job.id, lease, "failed", syncRefusal(job, denied), report2);
|
|
186047
186188
|
}
|
|
186048
|
-
if (await finishAndConfirm(deps, job.id, lease, "done", "", { ...report2, ...readCheckpoint(job.id)?.approvalRequested ? { replyApprovalSynced: report2.replyApprovalSynced !== false &&
|
|
186189
|
+
if (await finishAndConfirm(deps, job.id, lease, "done", "", { ...report2, ...readCheckpoint(job.id)?.approvalRequested ? { replyApprovalSynced: report2.replyApprovalSynced !== false && taskAssetsSynced(ws) } : {} })) landed();
|
|
186049
186190
|
}
|
|
186050
186191
|
var settingsOf = (job) => ({ settings: job.settings, secrets: secretsOf(job.runtimeId) });
|
|
186051
186192
|
async function runSecret(job, deps) {
|
|
@@ -186066,8 +186207,8 @@ async function runTest(job, deps, lease) {
|
|
|
186066
186207
|
const report2 = (await deps.runtimes()).find((r2) => r2.name === job.runtime);
|
|
186067
186208
|
if (!report2?.installed) return finish2("failed", "not_installed");
|
|
186068
186209
|
if (report2.loggedIn === false) return finish2("failed", "signed_out");
|
|
186069
|
-
const cwd =
|
|
186070
|
-
|
|
186210
|
+
const cwd = path54.join(ownFolder(), "test");
|
|
186211
|
+
fs49.mkdirSync(cwd, { recursive: true });
|
|
186071
186212
|
const run3 = deps.plan(job.runtime, job.prompt, cwd, null, job.model, settingsOf(job));
|
|
186072
186213
|
const startedAt = Date.now();
|
|
186073
186214
|
if (run3.converse) {
|
|
@@ -186156,22 +186297,22 @@ ${undrawn2.map((l2) => `- ${l2}`).join("\n")}` : "");
|
|
|
186156
186297
|
|
|
186157
186298
|
// src/flow-worker.ts
|
|
186158
186299
|
var FLOW_MARK = "WILDCRANE_FLOW_WORKER";
|
|
186159
|
-
var directory2 = () =>
|
|
186160
|
-
var fileOf3 = (id2) =>
|
|
186300
|
+
var directory2 = () => path55.join(runnerHome(), "flow-workers");
|
|
186301
|
+
var fileOf3 = (id2) => path55.join(directory2(), `${encodeURIComponent(id2)}.json`);
|
|
186161
186302
|
var stopFile = (id2) => `${fileOf3(id2)}.stop`;
|
|
186162
186303
|
var flowWorkerEntry = fileURLToPath4(new URL("./flow-worker-main.mjs", import.meta.url));
|
|
186163
186304
|
var canKeepFlow = (job) => !!job.task && !!job.flow && ["create", "refine", "implement", "preview"].includes(job.flow.verb) && !job.agent && !job.review && !job.discussion && !job.test && !job.secret;
|
|
186164
186305
|
function read4(id2) {
|
|
186165
186306
|
try {
|
|
186166
|
-
return JSON.parse(
|
|
186307
|
+
return JSON.parse(fs50.readFileSync(fileOf3(id2), "utf8"));
|
|
186167
186308
|
} catch {
|
|
186168
186309
|
return null;
|
|
186169
186310
|
}
|
|
186170
186311
|
}
|
|
186171
186312
|
function save2(worker) {
|
|
186172
186313
|
const file3 = fileOf3(worker.id);
|
|
186173
|
-
|
|
186174
|
-
|
|
186314
|
+
fs50.writeFileSync(`${file3}.${process.pid}.tmp`, JSON.stringify(worker), { mode: 384 });
|
|
186315
|
+
fs50.renameSync(`${file3}.${process.pid}.tmp`, file3);
|
|
186175
186316
|
}
|
|
186176
186317
|
function writerStopped(worker) {
|
|
186177
186318
|
if (!Number.isSafeInteger(worker.pid) || worker.pid <= 0 || pidAlive(worker.pid)) return false;
|
|
@@ -186228,7 +186369,7 @@ async function reclaimFlowWorkers(machine, given, only) {
|
|
|
186228
186369
|
const sweep = async () => {
|
|
186229
186370
|
let names2;
|
|
186230
186371
|
try {
|
|
186231
|
-
names2 = only ? [`${encodeURIComponent(only)}.json`] :
|
|
186372
|
+
names2 = only ? [`${encodeURIComponent(only)}.json`] : fs50.readdirSync(directory2());
|
|
186232
186373
|
} catch {
|
|
186233
186374
|
return;
|
|
186234
186375
|
}
|
|
@@ -186236,8 +186377,8 @@ async function reclaimFlowWorkers(machine, given, only) {
|
|
|
186236
186377
|
if (!valid()) break;
|
|
186237
186378
|
if (!name.endsWith(".json")) continue;
|
|
186238
186379
|
try {
|
|
186239
|
-
const file3 =
|
|
186240
|
-
const original =
|
|
186380
|
+
const file3 = path55.join(directory2(), name);
|
|
186381
|
+
const original = fs50.readFileSync(file3, "utf8");
|
|
186241
186382
|
const worker = JSON.parse(original);
|
|
186242
186383
|
if (!worker || typeof worker.id !== "string" || name !== `${encodeURIComponent(worker.id)}.json` || typeof worker.token !== "string" || !worker.token || worker.machine !== machine || worker.account !== account || typeof worker.generation !== "string" || !Number.isFinite(worker.at)) continue;
|
|
186243
186384
|
if (!writerStopped(worker)) {
|
|
@@ -186247,8 +186388,8 @@ async function reclaimFlowWorkers(machine, given, only) {
|
|
|
186247
186388
|
const release2 = tryLock(`${file3}.lock`);
|
|
186248
186389
|
if (!release2) continue;
|
|
186249
186390
|
try {
|
|
186250
|
-
if (
|
|
186251
|
-
const queried = tryLock(
|
|
186391
|
+
if (fs50.readFileSync(file3, "utf8") !== original) continue;
|
|
186392
|
+
const queried = tryLock(path55.join(directory2(), ".lookup.lock"));
|
|
186252
186393
|
if (!queried) continue;
|
|
186253
186394
|
const remote2 = await readJob(worker.id).finally(queried);
|
|
186254
186395
|
if (!valid()) break;
|
|
@@ -186274,10 +186415,10 @@ async function reclaimFlowWorkers(machine, given, only) {
|
|
|
186274
186415
|
} else if (job.state !== "finished" && !(job.state === "waiting" && readCheckpoint(job.id)?.updating)) continue;
|
|
186275
186416
|
if (!worker.markedAt) {
|
|
186276
186417
|
const job2 = remote2.value.job;
|
|
186277
|
-
const folder2 = job2.projectDir ? folderFor(job2) : { cwd:
|
|
186418
|
+
const folder2 = job2.projectDir ? folderFor(job2) : { cwd: path55.join(runnerHome(), "work", job2.id) };
|
|
186278
186419
|
if ("refused" in folder2 || !job2.task || !job2.project) continue;
|
|
186279
|
-
const board =
|
|
186280
|
-
if (!
|
|
186420
|
+
const board = path55.join(folder2.cwd, ".akb", "kanban");
|
|
186421
|
+
if (!fs50.existsSync(board)) continue;
|
|
186281
186422
|
const deps = given ?? defaultDeps(machine);
|
|
186282
186423
|
if (!await confirmFlowStopped(
|
|
186283
186424
|
{
|
|
@@ -186295,10 +186436,10 @@ async function reclaimFlowWorkers(machine, given, only) {
|
|
|
186295
186436
|
const checkpoint = readCheckpoint(worker.id);
|
|
186296
186437
|
if (checkpoint && (!checkpoint.mark || !processesStopped(checkpoint.mark, checkpoint.process))) continue;
|
|
186297
186438
|
}
|
|
186298
|
-
if (!writerStopped(worker) || !valid() ||
|
|
186299
|
-
|
|
186300
|
-
|
|
186301
|
-
|
|
186439
|
+
if (!writerStopped(worker) || !valid() || fs50.readFileSync(file3, "utf8") !== original) continue;
|
|
186440
|
+
fs50.rmSync(`${file3}.log`, { force: true });
|
|
186441
|
+
fs50.rmSync(`${file3}.stop`, { force: true });
|
|
186442
|
+
fs50.unlinkSync(file3);
|
|
186302
186443
|
if (job.state === "finished" && job.outcome === "done") clearCheckpoint(job.id);
|
|
186303
186444
|
} finally {
|
|
186304
186445
|
release2();
|
|
@@ -186323,14 +186464,14 @@ async function runFlowWorker(id2, token, given, entry = flowWorkerEntry) {
|
|
|
186323
186464
|
await halt?.();
|
|
186324
186465
|
};
|
|
186325
186466
|
const release2 = executorRecord();
|
|
186326
|
-
const keepVersion = hold(
|
|
186467
|
+
const keepVersion = hold(path55.resolve(path55.dirname(fileURLToPath4(import.meta.url)), ".."));
|
|
186327
186468
|
worker.pid = process.pid;
|
|
186328
186469
|
worker.processAt = Date.now();
|
|
186329
186470
|
save2(worker);
|
|
186330
186471
|
const timer = setInterval(() => {
|
|
186331
186472
|
let asked = false;
|
|
186332
186473
|
try {
|
|
186333
|
-
asked =
|
|
186474
|
+
asked = fs50.readFileSync(stopFile(id2), "utf8") === token;
|
|
186334
186475
|
} catch {
|
|
186335
186476
|
}
|
|
186336
186477
|
if (!valid() || asked) void stop2();
|