@silgrid/pi-web 0.0.2 → 0.0.4
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/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +6 -6
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +3 -3
- package/.next/required-server-files.js +2 -2
- package/.next/required-server-files.json +2 -2
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +3 -3
- package/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +3 -3
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/api/agent/[id]/events/route.js +2 -2
- package/.next/server/app/api/app-update/route.js +1 -1
- package/.next/server/app/api/auth/api-key/[provider]/route.js +1 -1
- package/.next/server/app/api/auth/login/[provider]/route.js +2 -2
- package/.next/server/app/api/auth/logout/[provider]/route.js +1 -1
- package/.next/server/app/api/auth/providers/route.js +1 -1
- package/.next/server/app/api/default-cwd/route.js +1 -1
- package/.next/server/app/api/plugins/check/route.js +1 -1
- package/.next/server/app/api/plugins/route.js +1 -1
- package/.next/server/app/api/provider-usage/query/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/auto-name/route.js +4 -3
- package/.next/server/app/api/sessions/[id]/auto-name/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/install/route.js +1 -1
- package/.next/server/app/api/skills/search/route.js +1 -1
- package/.next/server/app/api/skills/update/route.js +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +5 -5
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +5 -5
- package/.next/server/app/index.segments/_full.segment.rsc +5 -5
- package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/server/app/login.html +1 -1
- package/.next/server/app/login.rsc +4 -4
- package/.next/server/app/login.segments/_full.segment.rsc +4 -4
- package/.next/server/app/login.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +4 -4
- package/.next/server/app/page.js +20 -20
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +6 -6
- package/.next/server/chunks/210.js +1 -0
- package/.next/server/chunks/2238.js +1 -1
- package/.next/server/chunks/2243.js +1 -1
- package/.next/server/chunks/3573.js +1 -1
- package/.next/server/chunks/6429.js +6 -4
- package/.next/server/instrumentation.js +1 -1
- package/.next/server/instrumentation.js.nft.json +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/next-font-manifest.js +1 -1
- package/.next/server/next-font-manifest.json +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/1278-b726924fe981dfeb.js +1 -0
- package/.next/static/chunks/app/{layout-4a5043f9656bc733.js → layout-086ebea140156248.js} +1 -1
- package/.next/static/chunks/app/page-dcf005385eca02c4.js +283 -0
- package/.next/static/css/bf8c57dddea37459.css +1 -0
- package/.next/trace +40 -40
- package/.next/trace-build +1 -1
- package/README.md +1 -0
- package/bin/pi-web-deploy.js +42 -0
- package/bin/pi-web-node-args.js +11 -0
- package/bin/pi-web.js +3 -1
- package/deploy-piweb.sh +53 -0
- package/next.config.ts +7 -0
- package/package.json +5 -3
- package/public/sw.js +23 -2
- package/public/sw.test.mjs +107 -1
- package/.next/server/chunks/2349.js +0 -1
- package/.next/server/chunks/7916.js +0 -1
- package/.next/static/chunks/1278-7c90e5bb63a1e42e.js +0 -1
- package/.next/static/chunks/app/page-08ee27b22eca5469.js +0 -283
- package/.next/static/css/99d403e3f3e28297.css +0 -1
- /package/.next/static/{Wb40Uvk0OOvG534LH39MI → xCLbQwA_rhqUShzC_irNH}/_buildManifest.js +0 -0
- /package/.next/static/{Wb40Uvk0OOvG534LH39MI → xCLbQwA_rhqUShzC_irNH}/_ssgManifest.js +0 -0
package/.next/trace-build
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"name":"run-webpack","duration":
|
|
1
|
+
[{"name":"run-webpack","duration":27837502,"timestamp":53733199,"id":14,"parentId":1,"tags":{},"startTime":1790038463473,"traceId":"fbe07f2176cdf790"},{"name":"run-typescript","duration":12046055,"timestamp":81595040,"id":8509,"parentId":1,"tags":{},"startTime":1790038491335,"traceId":"fbe07f2176cdf790"},{"name":"static-check","duration":1919001,"timestamp":93653882,"id":8512,"parentId":1,"tags":{},"startTime":1790038503394,"traceId":"fbe07f2176cdf790"},{"name":"static-generation","duration":4534325,"timestamp":95810715,"id":8642,"parentId":1,"tags":{},"startTime":1790038505551,"traceId":"fbe07f2176cdf790"},{"name":"collect-build-traces","duration":33674648,"timestamp":95575432,"id":8639,"parentId":1,"tags":{},"startTime":1790038505316,"traceId":"fbe07f2176cdf790"},{"name":"telemetry-flush","duration":51,"timestamp":129253117,"id":8651,"parentId":1,"tags":{},"startTime":1790038538993,"traceId":"fbe07f2176cdf790"},{"name":"next-build","duration":75697525,"timestamp":53555653,"id":1,"tags":{"buildMode":"default","version":"16.3.5","bundler":"webpack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1790038463296,"traceId":"fbe07f2176cdf790"}]
|
package/README.md
CHANGED
|
@@ -11,6 +11,7 @@ This is the **@silgrid/pi-web** fork of [agegr/pi-web](https://github.com/agegr/
|
|
|
11
11
|
| Fork version | Upstream version | Upstream commit |
|
|
12
12
|
|---|---|---|
|
|
13
13
|
| 0.0.1 | 0.9.1 | `ffb2daf` |
|
|
14
|
+
| 0.0.4 | 0.9.1 | `1eb5e66` |
|
|
14
15
|
|
|
15
16
|
Update one row per upstream merge so the table stays the mapping between the fork line and the upstream baseline.
|
|
16
17
|
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
// Global `pi-web-deploy` entry: runs deploy-piweb.sh from the installed
|
|
5
|
+
// package directory, passing through arguments and the calling environment.
|
|
6
|
+
// The script itself requires bash, so this shim exists to give Windows
|
|
7
|
+
// installs a Node-based bin target; in the Linux container scenario the
|
|
8
|
+
// script executes unchanged either way.
|
|
9
|
+
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
11
|
+
const { spawn } = require("child_process");
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
13
|
+
const path = require("path");
|
|
14
|
+
|
|
15
|
+
const scriptPath = path.join(__dirname, "..", "deploy-piweb.sh");
|
|
16
|
+
const child = spawn("bash", [scriptPath, ...process.argv.slice(2)], {
|
|
17
|
+
stdio: "inherit",
|
|
18
|
+
env: process.env,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
function fail(message) {
|
|
22
|
+
console.error(`[pi-web-deploy] ${message}`);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
child.on("error", (error) => {
|
|
27
|
+
fail(`could not run deploy-piweb.sh: ${error.message}`);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
for (const forwardableSignal of ["SIGINT", "SIGTERM"]) {
|
|
31
|
+
process.on(forwardableSignal, () => {
|
|
32
|
+
child.kill(forwardableSignal);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
child.on("close", (code, signal) => {
|
|
37
|
+
if (signal) {
|
|
38
|
+
process.kill(process.pid, signal);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
process.exit(code ?? 1);
|
|
42
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function getNextNodeArgs(nextBin, nextArgs, arch = process.arch) {
|
|
4
|
+
if (arch === "riscv64") {
|
|
5
|
+
return ["--no-wasm-lazy-compilation", nextBin, ...nextArgs];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
return [nextBin, ...nextArgs];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
module.exports = { getNextNodeArgs };
|
package/bin/pi-web.js
CHANGED
|
@@ -18,6 +18,8 @@ const fs = require("fs");
|
|
|
18
18
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
19
19
|
const { getHelpText, parseLaunchOptions } = require("./pi-web-options");
|
|
20
20
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
21
|
+
const { getNextNodeArgs } = require("./pi-web-node-args");
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
21
23
|
const { wireChildProcessLifecycle } = require("./process-lifecycle");
|
|
22
24
|
|
|
23
25
|
let launchOptions;
|
|
@@ -81,7 +83,7 @@ nextArgs.push("-H", hostname);
|
|
|
81
83
|
|
|
82
84
|
// Always run next's JS entry with node directly — avoids .bin symlink issues
|
|
83
85
|
// and path-with-spaces problems on Windows when shell: true is used.
|
|
84
|
-
const child = spawn(process.execPath,
|
|
86
|
+
const child = spawn(process.execPath, getNextNodeArgs(nextBin, nextArgs), {
|
|
85
87
|
cwd: pkgDir,
|
|
86
88
|
stdio: ["inherit", "pipe", "inherit"],
|
|
87
89
|
env: { ...process.env, PI_WEB_HOSTNAME: hostname },
|
package/deploy-piweb.sh
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# deploy-piweb.sh — update and restart the @silgrid/pi-web service in this container.
|
|
3
|
+
#
|
|
4
|
+
# This container has no systemd; pi-web runs inside a detached tmux session
|
|
5
|
+
# ("piweb" by default) with a restart loop. PI_WEB_IDLE_TIMEOUT_MS=0 disables
|
|
6
|
+
# the 10-minute idle auto-exit so the server does not appear to "self-exit"
|
|
7
|
+
# while running unattended as a service.
|
|
8
|
+
#
|
|
9
|
+
# The server binds 0.0.0.0 (override with PIWEB_HOST) so it is reachable from
|
|
10
|
+
# outside the container, and PI_WEB_PASSWORD set in the calling environment is
|
|
11
|
+
# passed through so the deployed service keeps its existing auth behavior.
|
|
12
|
+
#
|
|
13
|
+
# Two invocation modes:
|
|
14
|
+
# 1. From the repository root: ./deploy-piweb.sh
|
|
15
|
+
# 2. After a global npm install: pi-web-deploy
|
|
16
|
+
# (the bin/pi/pi-web-deploy shim runs this same script from inside the
|
|
17
|
+
# installed package directory; arguments and env are passed through)
|
|
18
|
+
#
|
|
19
|
+
# Usage: ./deploy-piweb.sh (or: pi-web-deploy after `npm i -g @silgrid/pi-web`)
|
|
20
|
+
# Env:
|
|
21
|
+
# PIWEB_TMUX_SESSION tmux session name (default: piweb)
|
|
22
|
+
# PIWEB_PORT optional port override passed to pi-web
|
|
23
|
+
# PIWEB_HOST bind address (default: 0.0.0.0)
|
|
24
|
+
# PI_WEB_PASSWORD optional web-auth password passed through to pi-web
|
|
25
|
+
set -euo pipefail
|
|
26
|
+
|
|
27
|
+
SESSION="${PIWEB_TMUX_SESSION:-piweb}"
|
|
28
|
+
PKG="@silgrid/pi-web"
|
|
29
|
+
HOST="${PIWEB_HOST:-0.0.0.0}"
|
|
30
|
+
|
|
31
|
+
# The upstream @agegr/pi-web package owns the same global bin name (pi-web);
|
|
32
|
+
# uninstall it first so installing ours does not fail with EEXIST. Harmless
|
|
33
|
+
# when it is already gone.
|
|
34
|
+
if npm ls -g @agegr/pi-web >/dev/null 2>&1; then
|
|
35
|
+
echo "==> Removing superseded @agegr/pi-web global install (same pi-web bin)"
|
|
36
|
+
npm uninstall -g @agegr/pi-web
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
echo "==> Installing ${PKG}@latest"
|
|
40
|
+
npm install -g "${PKG}@latest"
|
|
41
|
+
|
|
42
|
+
echo "==> Restarting tmux session '${SESSION}'"
|
|
43
|
+
tmux kill-session -t "${SESSION}" 2>/dev/null || true
|
|
44
|
+
tmux new-session -d -s "${SESSION}" "
|
|
45
|
+
while true; do
|
|
46
|
+
PI_WEB_IDLE_TIMEOUT_MS=0 ${PI_WEB_PASSWORD:+PI_WEB_PASSWORD='${PI_WEB_PASSWORD}'} pi-web -H ${HOST} ${PIWEB_PORT:+--port ${PIWEB_PORT}}
|
|
47
|
+
echo '[piweb] pi-web exited; restarting in 5s' >&2
|
|
48
|
+
sleep 5
|
|
49
|
+
done
|
|
50
|
+
"
|
|
51
|
+
|
|
52
|
+
echo "==> pi-web running in tmux session '${SESSION}'"
|
|
53
|
+
tmux ls
|
package/next.config.ts
CHANGED
|
@@ -13,6 +13,13 @@ try {
|
|
|
13
13
|
|
|
14
14
|
const nextConfig: NextConfig = {
|
|
15
15
|
outputFileTracingRoot: configDir,
|
|
16
|
+
experimental: {
|
|
17
|
+
// proxy.ts matches /api/:path*, and Next buffers the request body whenever
|
|
18
|
+
// a proxy is present, capped at 10 MB by default. The upload route accepts
|
|
19
|
+
// up to 100 MB per request, so raise the buffer above that or large uploads
|
|
20
|
+
// are truncated and fail with "Failed to parse body as FormData."
|
|
21
|
+
proxyClientMaxBodySize: "128mb",
|
|
22
|
+
},
|
|
16
23
|
// next/image is only used for the static logo, so the /_next/image optimizer
|
|
17
24
|
// (and its sharp/libheif attack surface, see GHSA-2xp9-vwfh-vxw4) is not needed.
|
|
18
25
|
images: { unoptimized: true },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@silgrid/pi-web",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Fork of @agegr/pi-web: local web UI for the pi coding agent with split-pane chat and background task panels",
|
|
5
5
|
"homepage": "https://github.com/silgrid/pi-web#readme",
|
|
6
6
|
"repository": {
|
|
@@ -15,10 +15,12 @@
|
|
|
15
15
|
"node": ">=22.19.0"
|
|
16
16
|
},
|
|
17
17
|
"bin": {
|
|
18
|
-
"pi-web": "bin/pi-web.js"
|
|
18
|
+
"pi-web": "bin/pi-web.js",
|
|
19
|
+
"pi-web-deploy": "bin/pi-web-deploy.js"
|
|
19
20
|
},
|
|
20
21
|
"files": [
|
|
21
22
|
"bin",
|
|
23
|
+
"deploy-piweb.sh",
|
|
22
24
|
".next",
|
|
23
25
|
"!.next/cache",
|
|
24
26
|
"!.next/dev",
|
|
@@ -36,7 +38,7 @@
|
|
|
36
38
|
"start:lan": "next start -H 0.0.0.0 -p 30141",
|
|
37
39
|
"lint": "eslint .",
|
|
38
40
|
"test:terminal": "node e2e/terminal.mjs",
|
|
39
|
-
"test:e2e": "node e2e/run.mjs",
|
|
41
|
+
"test:e2e": "node --experimental-strip-types e2e/run.mjs",
|
|
40
42
|
"test": "node --experimental-strip-types --test \"app/**/*.test.mjs\" \"components/**/*.test.mjs\" \"hooks/**/*.test.mjs\" \"lib/**/*.test.mjs\" \"public/**/*.test.mjs\"",
|
|
41
43
|
"release": "npm version patch --no-git-tag-version && npm run build && npm publish --access public"
|
|
42
44
|
},
|
package/public/sw.js
CHANGED
|
@@ -9,6 +9,11 @@ const PRECACHE_URLS = [
|
|
|
9
9
|
"/icons/icon-512.png",
|
|
10
10
|
"/icons/apple-touch-icon.png",
|
|
11
11
|
];
|
|
12
|
+
// A reachable port backed by a dead upstream accepts the connection and then
|
|
13
|
+
// never answers: fetch() neither resolves nor rejects, so the navigation hangs
|
|
14
|
+
// forever instead of falling back to offline.html. Bound every network wait.
|
|
15
|
+
const NAVIGATION_TIMEOUT_MS = 8000;
|
|
16
|
+
const ASSET_TIMEOUT_MS = 8000;
|
|
12
17
|
|
|
13
18
|
self.addEventListener("install", (event) => {
|
|
14
19
|
event.waitUntil(
|
|
@@ -46,7 +51,7 @@ self.addEventListener("fetch", (event) => {
|
|
|
46
51
|
|
|
47
52
|
if (request.mode === "navigate") {
|
|
48
53
|
event.respondWith(
|
|
49
|
-
|
|
54
|
+
fetchWithTimeout(request, NAVIGATION_TIMEOUT_MS).catch(async () => {
|
|
50
55
|
const fallback = await caches.match(OFFLINE_URL);
|
|
51
56
|
return fallback ?? Response.error();
|
|
52
57
|
}),
|
|
@@ -130,11 +135,27 @@ async function focusOrOpenWindow(targetUrl) {
|
|
|
130
135
|
await self.clients.openWindow(targetUrl);
|
|
131
136
|
}
|
|
132
137
|
|
|
138
|
+
/**
|
|
139
|
+
* Fetch with a ceiling on the wait for the response headers (time to first
|
|
140
|
+
* byte). The timer is cleared as soon as they arrive, so a response that
|
|
141
|
+
* streams a long body — Next.js streams SSR output — is never cut off
|
|
142
|
+
* mid-stream.
|
|
143
|
+
*/
|
|
144
|
+
async function fetchWithTimeout(request, timeoutMs) {
|
|
145
|
+
const controller = new AbortController();
|
|
146
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
147
|
+
try {
|
|
148
|
+
return await fetch(request, { signal: controller.signal });
|
|
149
|
+
} finally {
|
|
150
|
+
clearTimeout(timer);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
133
154
|
async function cacheFirst(request) {
|
|
134
155
|
const cached = await caches.match(request);
|
|
135
156
|
if (cached) return cached;
|
|
136
157
|
|
|
137
|
-
const response = await
|
|
158
|
+
const response = await fetchWithTimeout(request, ASSET_TIMEOUT_MS);
|
|
138
159
|
if (response.ok && response.type === "basic") {
|
|
139
160
|
const cache = await caches.open(STATIC_CACHE);
|
|
140
161
|
await cache.put(request, response.clone());
|
package/public/sw.test.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
|
-
import test from "node:test";
|
|
2
|
+
import test, { mock } from "node:test";
|
|
3
3
|
|
|
4
4
|
const listeners = new Map();
|
|
5
5
|
globalThis.self = {
|
|
@@ -139,3 +139,109 @@ test("notification click opens a window and rejects cross-origin targets", async
|
|
|
139
139
|
|
|
140
140
|
assert.deepEqual(opened, ["https://pi.test/"]);
|
|
141
141
|
});
|
|
142
|
+
|
|
143
|
+
// A reachable port backed by a dead upstream answers nothing at all, so these
|
|
144
|
+
// tests drive fetch() with a stub that only settles once the worker aborts it.
|
|
145
|
+
function installOfflineStub() {
|
|
146
|
+
const offline = new Response("<!doctype html><title>Pi Web is offline</title>", {
|
|
147
|
+
status: 200,
|
|
148
|
+
headers: { "Content-Type": "text/html" },
|
|
149
|
+
});
|
|
150
|
+
globalThis.caches = {
|
|
151
|
+
match: async (request) => ((typeof request === "string" ? request : request.url).endsWith("/offline.html")
|
|
152
|
+
? offline
|
|
153
|
+
: undefined),
|
|
154
|
+
open: async () => ({ put: async () => {} }),
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function dispatchFetch(url, { mode = "cors", method = "GET" } = {}) {
|
|
159
|
+
let pending;
|
|
160
|
+
const request = new Request(url, { method });
|
|
161
|
+
Object.defineProperty(request, "mode", { value: mode });
|
|
162
|
+
listeners.get("fetch")({
|
|
163
|
+
request,
|
|
164
|
+
respondWith: (promise) => { pending = promise; },
|
|
165
|
+
});
|
|
166
|
+
return pending;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** fetch() that never settles until the signal it was handed is aborted. */
|
|
170
|
+
function installHungNetwork() {
|
|
171
|
+
let aborted = false;
|
|
172
|
+
globalThis.fetch = (_request, init) =>
|
|
173
|
+
new Promise((_resolve, reject) => {
|
|
174
|
+
init.signal.addEventListener("abort", () => {
|
|
175
|
+
aborted = true;
|
|
176
|
+
reject(new DOMException("The operation was aborted.", "AbortError"));
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
return () => aborted;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Let a handler's await chain reach its fetch (and schedule its timer) before
|
|
184
|
+
* the fake clock is ticked. setImmediate is not faked, unlike setTimeout.
|
|
185
|
+
*/
|
|
186
|
+
const flushMicrotasks = () => new Promise((resolve) => setImmediate(resolve));
|
|
187
|
+
|
|
188
|
+
test("a stalled navigation falls back to offline.html", async () => {
|
|
189
|
+
installOfflineStub();
|
|
190
|
+
const wasAborted = installHungNetwork();
|
|
191
|
+
|
|
192
|
+
mock.timers.enable({ apis: ["setTimeout"] });
|
|
193
|
+
try {
|
|
194
|
+
const pending = dispatchFetch("https://pi.test/", { mode: "navigate" });
|
|
195
|
+
await flushMicrotasks();
|
|
196
|
+
mock.timers.tick(8000);
|
|
197
|
+
const response = await pending;
|
|
198
|
+
|
|
199
|
+
assert.equal(wasAborted(), true, "a hung upstream must be aborted, not awaited forever");
|
|
200
|
+
assert.match(await response.text(), /Pi Web is offline/);
|
|
201
|
+
} finally {
|
|
202
|
+
mock.timers.reset();
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
test("a stalled static asset request is bounded as well", async () => {
|
|
207
|
+
installOfflineStub();
|
|
208
|
+
const wasAborted = installHungNetwork();
|
|
209
|
+
|
|
210
|
+
mock.timers.enable({ apis: ["setTimeout"] });
|
|
211
|
+
try {
|
|
212
|
+
const pending = dispatchFetch("https://pi.test/_next/static/chunks/app.js");
|
|
213
|
+
// cacheFirst awaits the cache lookup before it reaches the network.
|
|
214
|
+
await flushMicrotasks();
|
|
215
|
+
mock.timers.tick(8000);
|
|
216
|
+
|
|
217
|
+
assert.equal(wasAborted(), true);
|
|
218
|
+
await assert.rejects(pending, /abort/i);
|
|
219
|
+
} finally {
|
|
220
|
+
mock.timers.reset();
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
test("a response that arrives in time is not cut off mid-stream", async () => {
|
|
225
|
+
installOfflineStub();
|
|
226
|
+
let signal;
|
|
227
|
+
globalThis.fetch = async (_request, init) => {
|
|
228
|
+
signal = init.signal;
|
|
229
|
+
return new Response("<!doctype html><title>Pi Web</title>", {
|
|
230
|
+
status: 200,
|
|
231
|
+
headers: { "Content-Type": "text/html" },
|
|
232
|
+
});
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
mock.timers.enable({ apis: ["setTimeout"] });
|
|
236
|
+
try {
|
|
237
|
+
const response = await dispatchFetch("https://pi.test/", { mode: "navigate" });
|
|
238
|
+
// The budget only covers time to first byte: a long-lived body keeps
|
|
239
|
+
// streaming past it (Next.js streams its SSR payload).
|
|
240
|
+
mock.timers.tick(60000);
|
|
241
|
+
|
|
242
|
+
assert.equal(signal.aborted, false);
|
|
243
|
+
assert.match(await response.text(), /<title>Pi Web<\/title>/);
|
|
244
|
+
} finally {
|
|
245
|
+
mock.timers.reset();
|
|
246
|
+
}
|
|
247
|
+
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";exports.id=2349,exports.ids=[2349],exports.modules={42349:(a,b,c)=>{c.d(b,{configureHttpDispatcher:()=>l});var d=c(78474),e=c(9956);let f=globalThis,g=globalThis.fetch,h=()=>{};function i(a){return a instanceof d.EventEmitter&&d.EventEmitter.prototype.on.call(a,"error",h),a}function j(a,b){return i(new e.Client(a,b))}function k(a,b){return 1===b.connections?j(a,b):i(new e.Pool(a,{...b,factory:j}))}function l(a=3e5){if(f.__piWebHttpDispatcherConfigured)return;let b=function a(b){if("string"==typeof b){let c=b.trim();if("disabled"===c.toLowerCase())return 0;if(0===c.length)return;return a(Number(c))}if("number"==typeof b&&Number.isFinite(b)&&!(b<0))return Math.floor(b)}(a);if(void 0===b)throw Error(`Invalid HTTP idle timeout: ${String(a)}`);let c=i(new e.EnvHttpProxyAgent({allowH2:!1,bodyTimeout:b,headersTimeout:b,clientFactory:j,factory:k}));e.setGlobalDispatcher(c),globalThis.fetch===g&&e.install?.(),f.__piWebHttpDispatcherConfigured=!0}}};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";exports.id=7916,exports.ids=[7916],exports.modules={4658:(a,b,c)=>{},7535:(a,b,c)=>{c(76760)},7561:(a,b,c)=>{c.d(b,{$:()=>f});var d=c(76760),e=c.n(d);function f(a,b=process.platform){let c="win32"===b?e().win32.normalize(a):e().posix.normalize(a);return"win32"===b?c.toLowerCase():c}},12969:(a,b,c)=>{c(55511),c(29021),c(33873)},14916:(a,b,c)=>{c.d(b,{kU:()=>d});let d=["read","grep","find","ls"]},15011:(a,b,c)=>{c(33873)},28112:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{ensureSessionWatcher:()=>r});var e=c(29021),f=c(33873),g=c(75430),h=c(69453),i=c(7561),j=a([g,h]);[g,h]=j.then?(await j)():j;let s="pi-web:session-watcher";function k(a){let b=globalThis;a?b[Symbol.for(s)]=a:delete b[Symbol.for(s)]}function l(a){for(let b of a.watchers)try{b.close()}catch{}a.watchers.clear()}function m(a){null!==a.debounceTimer&&(clearTimeout(a.debounceTimer),a.debounceTimer=null)}function n(a,b){a.failed=!0,a.degradedLogged||(a.degradedLogged=!0,console.warn(`[pi-web] session watcher unavailable (${b}); falling back to the 30s session list cache. External session writes appear after the next cache refresh.`))}let t=new Set(["darwin","win32"]);function o(a,b,c){return b.on("error",c=>{a.watchers.delete(b);try{b.close()}catch{}0===a.watchers.size&&n(a,String(c))}),b.on("change",(b,d)=>{let e=null===d?void 0:d.toString();if("root-rescan"===c.kind)return void p(a,{rescan:!0});if(!e)return void p(a,{rescan:!1,path:c.dir});let g=(0,f.join)(c.dir,e);g.endsWith(".jsonl")&&p(a,{rescan:!1,path:g})}),"function"==typeof b.unref&&b.unref(),a.watchers.add(b),b}function p(a,b){var c;b.rescan&&(a.pendingRescan=!0),b.path&&a.pendingWrites.set((0,i.$)(b.path),b.path),null!==a.debounceTimer&&clearTimeout(a.debounceTimer),a.debounceTimer=setTimeout(()=>{a.debounceTimer=null,function(a){if(a.pendingWrites.size>0){let b=Date.now();for(let[c,d]of a.pendingWrites){let e=(a.generations.get(c)??0)+1;a.generations.set(c,e),a.recentWrites=a.recentWrites.filter(a=>a.pathKey!==c),a.recentWrites.push({path:d,pathKey:c,generation:e,timestamp:b})}a.recentWrites.length>32&&a.recentWrites.splice(0,a.recentWrites.length-32),a.pendingWrites.clear(),(0,h.mD)()}(!a.recursive||a.pendingRescan)&&(a.pendingRescan=!1,q(a))}(a)},a.debounceMs),c=a.debounceTimer,"object"==typeof c&&null!==c&&"unref"in c&&"function"==typeof c.unref&&c.unref()}function q(a){let b;if(a.recursive)return;try{b=(0,e.readdirSync)(a.root,{withFileTypes:!0})}catch{return}let c=new Set;for(let d of b){if(!d.isDirectory()&&!d.isSymbolicLink())continue;let b=(0,f.join)(a.root,d.name);if(c.add(b),![...a.watchers].some(a=>a.__piWebWatchDir===b))try{let c=(0,e.watch)(b);c.__piWebWatchDir=b,o(a,c,{kind:"sessions",dir:b})}catch{}}for(let b of[...a.watchers]){let d=b.__piWebWatchDir;if(void 0!==d&&!c.has(d)){a.watchers.delete(b);try{b.close()}catch{}}}}function r(a={}){var b;let c,d=(0,f.resolve)(a.root??(0,f.resolve)((0,f.join)((0,g.getAgentDir)(),"sessions"))),h=a.debounceMs??300,i=(b=c=globalThis[Symbol.for(s)],"object"==typeof b&&null!==b&&"string"==typeof b.root)?c:void 0;if(i&&i.root===d&&i.watchers.size>0&&!i.failed)return;i&&i.root!==d&&(l(i),m(i),k(void 0));let j=i&&i.root===d?i:{root:d,debounceMs:h,recursive:!0,watchers:new Set,failed:!1,degradedLogged:i?.degradedLogged??!1,generations:new Map,recentWrites:[],pendingWrites:new Map,pendingRescan:!1,debounceTimer:null};i&&i.root===d&&(l(i),m(i),j.debounceMs=h),k(j),function(a){if(a.failed=!1,t.has(process.platform)){a.recursive=!0;try{let b=(0,e.watch)(a.root,{recursive:!0});o(a,b,{kind:"sessions",dir:a.root});return}catch(c){let b=c?.code;if("ENOENT"===b||"EACCES"===b)return void n(a,b)}}a.recursive=!1;try{let b=(0,e.watch)(a.root);o(a,b,{kind:"root-rescan"})}catch(b){n(a,String(b?.code??b));return}q(a)}(j)}d()}catch(a){d(a)}})},37173:(a,b,c)=>{c(82249)},41035:(a,b,c)=>{c.a(a,async(a,b)=>{try{var d=c(75430);c(82249),c(29021),c(33873),c(37173),c(12969),c(83739);var e=c(14916),f=a([d]);d=(f.then?(await f)():f)[0],[...e.kU],[...e.kU],b()}catch(a){b(a)}})},69453:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{mD:()=>j});var e=c(75430);c(29021),c(79748),c(33873),c(7535),c(7561),c(4658),c(88002);var f=c(41035),g=c(88449),h=c(28112),i=a([e,f,g,h]);function j(){globalThis.__piSessionListGeneration=(globalThis.__piSessionListGeneration??0)+1,globalThis.__piSessionListCache=void 0}[e,f,g,h]=i.then?(await i)():i,d()}catch(a){d(a)}})},82249:(a,b,c)=>{var d=Symbol("NOT_RESOLVED"),e=Symbol("MERGE_KEY");function f(a,b){return{tagName:a,nodeKind:"scalar",implicit:b.implicit??!1,matchByTagPrefix:b.matchByTagPrefix??!1,implicitFirstChars:b.implicitFirstChars??null,resolve:b.resolve,identify:b.identify??null,represent:b.represent??(a=>String(a)),representTagName:b.representTagName??null}}function g(a,b){let c=void 0===b.finalize;return{tagName:a,nodeKind:"sequence",implicit:!1,matchByTagPrefix:b.matchByTagPrefix??!1,create:b.create,addItem:b.addItem,finalize:b.finalize??(a=>a),carrierIsResult:c,identify:b.identify??null,represent:b.represent??(a=>a),representTagName:b.representTagName??null}}function h(a,b){let c=void 0===b.finalize;return{tagName:a,nodeKind:"mapping",implicit:!1,matchByTagPrefix:b.matchByTagPrefix??!1,create:b.create,addPair:b.addPair,has:b.has,keys:b.keys,get:b.get,finalize:b.finalize??(a=>a),carrierIsResult:c,identify:b.identify??null,represent:b.represent??(a=>a),representTagName:b.representTagName??null}}var i=f("tag:yaml.org,2002:str",{resolve:a=>a,identify:a=>"string"==typeof a}),j=["","~","null","Null","NULL"],k=f("tag:yaml.org,2002:null",{implicit:!0,implicitFirstChars:["","~","n","N"],resolve:a=>-1!==j.indexOf(a)?null:d,identify:a=>null===a,represent:()=>"null"}),l=f("tag:yaml.org,2002:null",{implicit:!0,implicitFirstChars:["n"],resolve:(a,b)=>"null"===a||b&&""===a?null:d,identify:a=>null===a,represent:()=>"null"}),m=["","~","null","Null","NULL"],n=f("tag:yaml.org,2002:null",{implicit:!0,implicitFirstChars:["","~","n","N"],resolve:a=>-1!==m.indexOf(a)?null:d,identify:a=>null===a,represent:()=>"null"}),o=["true","True","TRUE"],p=["false","False","FALSE"],q=f("tag:yaml.org,2002:bool",{implicit:!0,implicitFirstChars:["t","T","f","F"],resolve:a=>-1!==o.indexOf(a)||-1===p.indexOf(a)&&d,identify:a=>"[object Boolean]"===Object.prototype.toString.call(a),represent:a=>a?"true":"false"}),r=["true"],s=["false"],t=f("tag:yaml.org,2002:bool",{implicit:!0,implicitFirstChars:["t","f"],resolve:a=>-1!==r.indexOf(a)||-1===s.indexOf(a)&&d,identify:a=>"[object Boolean]"===Object.prototype.toString.call(a),represent:a=>a?"true":"false"}),u=["true","True","TRUE","y","Y","yes","Yes","YES","on","On","ON"],v=["false","False","FALSE","n","N","no","No","NO","off","Off","OFF"],w=f("tag:yaml.org,2002:bool",{implicit:!0,implicitFirstChars:["y","Y","n","N","t","T","f","F","o","O"],resolve:a=>-1!==u.indexOf(a)||-1===v.indexOf(a)&&d,identify:a=>"[object Boolean]"===Object.prototype.toString.call(a),represent:a=>a?"true":"false"}),x=RegExp("^(?:0o[0-7]+|0x[0-9a-fA-F]+|[-+]?[0-9]+)$"),y=RegExp("^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$"),z=f("tag:yaml.org,2002:int",{implicit:!0,implicitFirstChars:["-","+",..."0123456789"],resolve:function(a,b){let c,e;if(b){if(!y.test(a))return d}else if(!x.test(a))return d;let f=(e=1,(("-"===(c=a)[0]||"+"===c[0])&&("-"===c[0]&&(e=-1),c=c.slice(1)),c.startsWith("0b"))?e*parseInt(c.slice(2),2):c.startsWith("0o")?e*parseInt(c.slice(2),8):c.startsWith("0x")?e*parseInt(c.slice(2),16):e*parseInt(c,10));return Number.isFinite(f)?f:d},identify:a=>Number.isInteger(a)&&!Object.is(a,-0)&&0>a.toString(10).indexOf("e"),represent:a=>a.toString(10)}),A=RegExp("^-?(?:0|[1-9][0-9]*)$"),B=RegExp("^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$"),C=f("tag:yaml.org,2002:int",{implicit:!0,implicitFirstChars:["-",..."0123456789"],resolve:function(a,b){let c,e;if(b){if(!B.test(a))return d}else if(!A.test(a))return d;let f=(e=1,(("-"===(c=a)[0]||"+"===c[0])&&("-"===c[0]&&(e=-1),c=c.slice(1)),c.startsWith("0b"))?e*parseInt(c.slice(2),2):c.startsWith("0o")?e*parseInt(c.slice(2),8):c.startsWith("0x")?e*parseInt(c.slice(2),16):e*parseInt(c,10));return Number.isFinite(f)?f:d},identify:a=>Number.isInteger(a)&&!Object.is(a,-0)&&0>a.toString(10).indexOf("e"),represent:a=>a.toString(10)}),D=RegExp("^(?:[-+]?0b[0-1_]+|[-+]?0[0-7_]+|[-+]?0x[0-9a-fA-F_]+|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+|[-+]?(?:0|[1-9][0-9_]*))$"),E=f("tag:yaml.org,2002:int",{implicit:!0,implicitFirstChars:["-","+",..."0123456789"],resolve:function(a){if(!D.test(a))return d;let b=function(a){let b=a.replace(/_/g,""),c=1;if(("-"===b[0]||"+"===b[0])&&("-"===b[0]&&(c=-1),b=b.slice(1)),b.startsWith("0b"))return c*parseInt(b.slice(2),2);if(b.startsWith("0x"))return c*parseInt(b.slice(2),16);if(b.includes(":")){let a=0;for(let c of b.split(":"))a=60*a+Number(c);return c*a}return"0"!==b&&"0"===b[0]?c*parseInt(b,8):c*parseInt(b,10)}(a);return Number.isFinite(b)?b:d},identify:a=>Number.isInteger(a)&&!Object.is(a,-0)&&0>a.toString(10).indexOf("e"),represent:a=>a.toString(10)}),F=RegExp("^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),G=RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),H=f("tag:yaml.org,2002:float",{implicit:!0,implicitFirstChars:["-","+",".",..."0123456789"],resolve:function(a){if(!F.test(a))return d;let b=a.toLowerCase(),c="-"===b[0]?-1:1;if("+-".includes(b[0])&&(b=b.slice(1)),".inf"===b)return 1===c?1/0:-1/0;if(".nan"===b)return NaN;let e=c*parseFloat(b);return Number.isFinite(e)||G.test(a)?e:d},identify:a=>"number"==typeof a&&(!Number.isInteger(a)||Object.is(a,-0)||a.toString(10).indexOf("e")>=0),represent:function(a){if(isNaN(a))return".nan";if(a===1/0)return".inf";if(a===-1/0)return"-.inf";if(Object.is(a,-0))return"-0.0";let b=a.toString(10);return/^[-+]?[0-9]+e/.test(b)?b.replace("e",".e"):b}}),I=RegExp("^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$"),J=RegExp("^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),K=f("tag:yaml.org,2002:float",{implicit:!0,implicitFirstChars:["-",..."0123456789"],resolve:function(a,b){if(b){if(!J.test(a))return d;let b=a.toLowerCase(),c="-"===b[0]?-1:1;if("+-".includes(b[0])&&(b=b.slice(1)),".inf"===b)return 1===c?1/0:-1/0;if(".nan"===b)return NaN;let e=c*parseFloat(b);return Number.isFinite(e)?e:d}if(!I.test(a))return d;let c=Number(a);return Number.isFinite(c)?c:d},identify:a=>"number"==typeof a&&(!Number.isInteger(a)||Object.is(a,-0)||a.toString(10).indexOf("e")>=0),represent:function(a){if(isNaN(a))return".nan";if(a===1/0)return".inf";if(a===-1/0)return"-.inf";if(Object.is(a,-0))return"-0.0";let b=a.toString(10);return/^[-+]?[0-9]+e/.test(b)?b.replace("e",".e"):b}}),L=RegExp("^(?:[-+]?(?:(?:[0-9][0-9_]*)?\\.[0-9_]*)(?:[eE][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),M=RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),N=f("tag:yaml.org,2002:float",{implicit:!0,implicitFirstChars:["-","+",".",..."0123456789"],resolve:function(a){if(!L.test(a))return d;let b=a.toLowerCase().replace(/_/g,""),c="-"===b[0]?-1:1;if("+-".includes(b[0])&&(b=b.slice(1)),".inf"===b)return 1===c?1/0:-1/0;if(".nan"===b)return NaN;let e=0;if(b.includes(":")){for(let a of b.split(":"))e=60*e+Number(a);e*=c}else e=c*parseFloat(b);return Number.isFinite(e)||M.test(a)?e:d},identify:a=>"number"==typeof a&&(!Number.isInteger(a)||Object.is(a,-0)||a.toString(10).indexOf("e")>=0),represent:function(a){if(isNaN(a))return".nan";if(a===1/0)return".inf";if(a===-1/0)return"-.inf";if(Object.is(a,-0))return"-0.0";let b=a.toString(10);return/^[-+]?[0-9]+e/.test(b)?b.replace("e",".e"):b}}),O=f("tag:yaml.org,2002:merge",{implicit:!0,implicitFirstChars:["<"],resolve:(a,b)=>"<<"===a||b&&""===a?e:d}),P=/^[A-Za-z0-9+/]*={0,2}$/,Q=f("tag:yaml.org,2002:binary",{resolve:function(a){let b=a.replace(/\s/g,"");if(b.length%4!=0||!P.test(b))return d;let c=atob(b),e=new Uint8Array(c.length);for(let a=0;a<c.length;a++)e[a]=c.charCodeAt(a);return e},identify:a=>"[object Uint8Array]"===Object.prototype.toString.call(a),represent:function(a){let b="";for(let c=0;c<a.length;c++)b+=String.fromCharCode(a[c]);return btoa(b)}}),R=RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),S=RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function T(a,b,c,d=0,e=0,f=0,g=0){let h=new Date(Date.UTC(a,b,c,d,e,f,g));return h.setUTCFullYear(a,b,c),h}var U=f("tag:yaml.org,2002:timestamp",{implicit:!0,implicitFirstChars:[..."0123456789"],resolve:function(a){let b=R.exec(a);if(null===b&&(b=S.exec(a)),null===b)return d;let c=+b[1],e=b[2]-1,f=+b[3];if(!b[4]){let a=T(c,e,f);return a.getUTCFullYear()!==c||a.getUTCMonth()!==e||a.getUTCDate()!==f?d:a}let g=+b[4],h=+b[5],i=+b[6],j=0;if(g>23||h>59||i>59)return d;if(b[7]){let a=b[7].slice(0,3);for(;a.length<3;)a+="0";j=+a}let k=T(c,e,f,g,h,i,j);if(k.getUTCFullYear()!==c||k.getUTCMonth()!==e||k.getUTCDate()!==f)return d;if(b[9]){let a=+b[10],c=+(b[11]||0);if(a>23||c>59)return d;let e=(60*a+c)*6e4;k.setTime(k.getTime()-("-"===b[9]?-e:e))}return k},identify:a=>a instanceof Date,represent:a=>a.toISOString()}),V=g("tag:yaml.org,2002:seq",{create:()=>[],addItem:(a,b)=>{a.push(b)},identify:Array.isArray});function W(a){if(null===a||"object"!=typeof a||Array.isArray(a))return!1;let b=Object.getPrototypeOf(a);return null===b||b===Object.prototype}var X=g("tag:yaml.org,2002:omap",{create:()=>({list:[],seen:new Set}),addItem:(a,b)=>{let c;if(b instanceof Map){if(1!==b.size)return"cannot resolve an ordered map item";c=b.keys().next().value}else{if(!W(b))return"cannot resolve an ordered map item";let a=Object.keys(b);if(1!==a.length)return"cannot resolve an ordered map item";c=a[0]}return a.seen.has(c)?"duplicate key in ordered map":(a.seen.add(c),a.list.push(b),"")},finalize:a=>a.list}),Y=g("tag:yaml.org,2002:pairs",{create:()=>[],addItem:(a,b)=>{if(b instanceof Map)return 1!==b.size?"cannot resolve a pairs item":(a.push(b.entries().next().value),"");if("[object Object]"!==Object.prototype.toString.call(b))return"cannot resolve a pairs item";let c=Object.keys(b);return 1!==c.length?"cannot resolve a pairs item":(a.push([c[0],b[c[0]]]),"")}}),Z=h("tag:yaml.org,2002:map",{create:()=>({}),identify:W,represent:a=>{let b=new Map;for(let c of Object.keys(a))b.set(c,a[c]);return b},addPair:(a,b,c)=>{if(null!==b&&"object"==typeof b)return"object-based map does not support complex keys";let d=String(b);return"__proto__"===d?Object.defineProperty(a,d,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[d]=c,""},has:(a,b)=>(null===b||"object"!=typeof b)&&Object.prototype.hasOwnProperty.call(a,String(b)),keys:a=>Object.keys(a),get:(a,b)=>{let c=String(b);return Object.prototype.hasOwnProperty.call(a,c)?a[c]:null}}),$=h("tag:yaml.org,2002:set",{create:()=>new Set,identify:a=>a instanceof Set,represent:a=>{let b=new Map;for(let c of a)b.set(c,null);return b},addPair:(a,b,c)=>null!==c?"cannot resolve a set item":(a.add(b),""),has:(a,b)=>a.has(b),keys:a=>a.keys(),get:()=>null}),_=class a{tags;implicitScalarTags;implicitScalarByFirstChar;implicitScalarAnyFirstChar;defaultScalarTag;defaultSequenceTag;defaultMappingTag;exact;prefix;constructor(a){const b=function(a){let b=[];for(let c of a){let a=b.length;for(let d=0;d<b.length;d++){let e=b[d];if(e.nodeKind===c.nodeKind&&e.tagName===c.tagName&&e.matchByTagPrefix===c.matchByTagPrefix){a=d;break}}b[a]=c}return b}(a),c=[],d={scalar:Object.create(null),sequence:Object.create(null),mapping:Object.create(null)},e={scalar:[],sequence:[],mapping:[]};for(const a of b){if("scalar"===a.nodeKind&&a.implicit){if(a.matchByTagPrefix)throw Error("Implicit scalar tags cannot match by tag prefix");c.push(a)}switch(a.nodeKind){case"scalar":a.matchByTagPrefix?e.scalar.push(a):d.scalar[a.tagName]=a;break;case"sequence":a.matchByTagPrefix?e.sequence.push(a):d.sequence[a.tagName]=a;break;case"mapping":a.matchByTagPrefix?e.mapping.push(a):d.mapping[a.tagName]=a}}const f=c.filter(a=>null===a.implicitFirstChars),g=new Set;for(const a of c)if(null!==a.implicitFirstChars)for(const b of a.implicitFirstChars)g.add(b);const h=new Map;for(const a of g)h.set(a,c.filter(b=>null===b.implicitFirstChars||-1!==b.implicitFirstChars.indexOf(a)));const i=d.scalar["tag:yaml.org,2002:str"];if(!i)throw Error("schema does not define the default scalar tag (tag:yaml.org,2002:str)");this.tags=b,this.implicitScalarTags=c,this.implicitScalarByFirstChar=h,this.implicitScalarAnyFirstChar=f,this.defaultScalarTag=i,this.defaultSequenceTag=d.sequence["tag:yaml.org,2002:seq"],this.defaultMappingTag=d.mapping["tag:yaml.org,2002:map"],this.exact=d,this.prefix=e}withTags(...b){let c=[];for(let a of b)c=c.concat(a);return new a([...this.tags,...c])}},aa=new _([i,V,Z]);new _([...aa.tags,l,t,C,K]),new _([...aa.tags,k,q,z,H]);var ab=new _([...aa.tags,n,w,E,N,U,O,Q,X,Y,$]);function ac(a){if(Array.isArray(a)){let b=Array.prototype.slice.call(a);for(let a=0;a<b.length;a++){if(Array.isArray(b[a]))return null;"object"==typeof b[a]&&"[object Object]"===Object.prototype.toString.call(b[a])&&(b[a]="[object Object]")}return String(b)}return"object"==typeof a&&"[object Object]"===Object.prototype.toString.call(a)?"[object Object]":String(a)}function ad(a){switch(a){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:case 9:return" ";case 110:return"\n";case 118:return"\v";case 102:return"\f";case 114:return"\r";case 101:return"\x1b";case 32:return" ";case 34:return'"';case 47:return"/";case 92:return"\\";case 78:return"\x85";case 95:return"\xa0";case 76:return"\u2028";case 80:return"\u2029";default:return""}}h("tag:yaml.org,2002:map",{create:()=>new Map,addPair:(a,b,c)=>(a.set(b,c),""),has:(a,b)=>a.has(b),keys:a=>a.keys(),get:(a,b)=>a.get(b),identify:a=>a instanceof Map||W(a),represent:a=>{if(a instanceof Map)return a;let b=new Map;for(let c of Object.keys(a))b.set(c,a[c]);return b}}),h("tag:yaml.org,2002:map",{create:()=>({}),identify:W,represent:a=>{let b=new Map;for(let c of Object.keys(a))b.set(c,a[c]);return b},addPair:(a,b,c)=>{let d=ac(b);return null===d?"nested arrays are not supported inside keys":("__proto__"===d?Object.defineProperty(a,d,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[d]=c,"")},has:(a,b)=>{let c=ac(b);return null!==c&&Object.prototype.hasOwnProperty.call(a,c)},keys:a=>Object.keys(a),get:(a,b)=>{let c=String(b);return Object.prototype.hasOwnProperty.call(a,c)?a[c]:null}});var ae=Array(256),af=Array(256);for(let a=0;a<256;a++)ae[a]=+!!ad(a),af[a]=ad(a);Object.assign(Object.create(null),{"!":"!","!!":"tag:yaml.org,2002:"}),Object.prototype.hasOwnProperty;var ag=String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-#;/?:@&=+$,_.!~*'()\[\]])`,ah=String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-#;/?:@&=+$.~*'()_])`;RegExp(`^(?:${ag})*$`),RegExp(`^(?:${ah})+$`),RegExp(`^(?:!(?:${ag})*|${ah}(?:${ag})*)$`),Symbol("INVALID"),Symbol("visit:break"),Symbol("visit:skip");var ai={};ai[0]="\\0",ai[7]="\\a",ai[8]="\\b",ai[9]="\\t",ai[10]="\\n",ai[11]="\\v",ai[12]="\\f",ai[13]="\\r",ai[27]="\\e",ai[34]='\\"',ai[92]="\\\\",ai[133]="\\N",ai[160]="\\_",ai[8232]="\\L",ai[8233]="\\P",ab.withTags({...E,resolve:(a,b,c)=>{let e=E.resolve(a,b,c);return e===d?z.resolve(a,b,c):e}},{...N,resolve:(a,b,c)=>{let e=N.resolve(a,b,c);return e===d?H.resolve(a,b,c):e}})},83739:(a,b,c)=>{c(29021),c(33873),c(15011)},88002:(a,b,c)=>{var d=c(79646);c(29021),c(33873);var e=c(28354);c(15011),(0,e.promisify)(d.execFile)},88449:(a,b,c)=>{c.a(a,async(a,b)=>{try{c(73024),c(51455),c(76760),c(80481);var d=c(75430);c(12969);var e=a([d]);d=(e.then?(await e)():e)[0],b()}catch(a){b(a)}})}};
|