@edgehero/pi-dispatch 5.2.0 → 5.2.1
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/package.json +1 -1
- package/src/auth-cli.mjs +76 -5
- package/src/cancel-cli.mjs +95 -6
- package/src/cancel-state.mjs +76 -17
- package/src/connection.mjs +207 -6
- package/src/doctor.mjs +23 -18
- package/src/env-allowlist.mjs +9 -1
- package/src/github-app-setup.mjs +17 -4
- package/src/host-loads.mjs +58 -4
- package/src/job-size.mjs +27 -0
- package/src/json-duplicates.mjs +53 -42
- package/src/mcp-preflight.mjs +2 -2
- package/src/reason-catalog.mjs +1 -1
- package/src/redact-secrets.mjs +4 -0
- package/src/reserved-env.mjs +4 -0
- package/src/sandbox-cli.mjs +9 -3
- package/src/sandbox-deployment.mjs +38 -5
- package/src/sandbox-prepare.mjs +16 -2
- package/src/sandbox.mjs +10 -3
- package/src/service-env.mjs +4 -3
- package/src/size-suggest.mjs +118 -8
- package/src/touch-outbox.mjs +5 -0
- package/src/valkey-endpoint.mjs +9 -6
package/src/valkey-endpoint.mjs
CHANGED
|
@@ -58,7 +58,7 @@ export function defaultValkeyContext() {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
|
-
* Where a client stands (issue #464, gate round 3): `{ envPath, shared, rootRefused, error, password }`.
|
|
61
|
+
* Where a client stands (issue #464, gate round 3): `{ envPath, shared, rootRefused, error, absent, password, url }`.
|
|
62
62
|
*
|
|
63
63
|
* The owner decision itself does not depend on this (gate round 3's simpler rule): on Linux EVERY client refuses a
|
|
64
64
|
* listener held by a uid that is neither this account's euid, nor one of its subordinate uids, nor root, from any cwd.
|
|
@@ -86,10 +86,12 @@ export function valkeyClientContext({ env = process.env, cwd = process.cwd(), pl
|
|
|
86
86
|
const envPath = join(cwd, ".env");
|
|
87
87
|
let content = null;
|
|
88
88
|
let error = null;
|
|
89
|
+
let absent = false;
|
|
89
90
|
try {
|
|
90
91
|
content = readEnv(envPath);
|
|
91
92
|
} catch (err) {
|
|
92
|
-
if (err?.code
|
|
93
|
+
if (err?.code === "ENOENT") absent = true;
|
|
94
|
+
else error = `${envPath} could not be read (${err?.code ?? err?.message})`;
|
|
93
95
|
}
|
|
94
96
|
const fileKeys = {};
|
|
95
97
|
if (content !== null) {
|
|
@@ -104,7 +106,7 @@ export function valkeyClientContext({ env = process.env, cwd = process.cwd(), pl
|
|
|
104
106
|
if (keys.error) error ??= keys.error;
|
|
105
107
|
else for (const k of [VALKEY_SHARED_KEY, VALKEY_PASSWORD_KEY, "VALKEY_URL"]) if (typeof keys.keys[k] === "string") fileKeys[k] = keys.keys[k];
|
|
106
108
|
}
|
|
107
|
-
return valkeyContextFromKeys({ env, envPath, fileKeys, error, platform, rootRefused });
|
|
109
|
+
return valkeyContextFromKeys({ env, envPath, fileKeys, error, absent, platform, rootRefused });
|
|
108
110
|
}
|
|
109
111
|
|
|
110
112
|
/**
|
|
@@ -138,9 +140,10 @@ export const VALKEY_CONTEXT_KEYS = Object.freeze(["VALKEY_URL", VALKEY_PASSWORD_
|
|
|
138
140
|
* A context from keys a caller has already read out of the deployment's `.env` (`fileKeys`, the `VALKEY_CONTEXT_KEYS`
|
|
139
141
|
* it supplied) and this process's environment. `valkeyClientContext` reads the file itself; the admin panel passes what
|
|
140
142
|
* issue #471's resolver read, so the panel has one `.env` reader. `error` is a reason the file could not be read, as
|
|
141
|
-
* `valkeyClientContext`'s.
|
|
143
|
+
* `valkeyClientContext`'s. `absent` (issue #845) is true when nothing is at `envPath`: no file, which is not a file that
|
|
144
|
+
* sets nothing, so a client that reads its password again at each connect keeps the one it has (`freshPassword`).
|
|
142
145
|
*/
|
|
143
|
-
export function valkeyContextFromKeys({ env = process.env, envPath = null, fileKeys = {}, error = null, platform = process.platform, rootRefused } = {}) {
|
|
146
|
+
export function valkeyContextFromKeys({ env = process.env, envPath = null, fileKeys = {}, error = null, absent = false, platform = process.platform, rootRefused } = {}) {
|
|
144
147
|
const fileVenue = typeof fileKeys.PI_BACKENDS === "string" ? { PI_BACKENDS: fileKeys.PI_BACKENDS } : {};
|
|
145
148
|
const shared = valkeySharedOn(fileKeys[VALKEY_SHARED_KEY]);
|
|
146
149
|
const filePassword = fileKeys[VALKEY_PASSWORD_KEY] || null;
|
|
@@ -156,7 +159,7 @@ export function valkeyContextFromKeys({ env = process.env, envPath = null, fileK
|
|
|
156
159
|
const engine = typeof env.PI_OPENSHELL_ENGINE === "string" ? env.PI_OPENSHELL_ENGINE : fileKeys.PI_OPENSHELL_ENGINE;
|
|
157
160
|
const derived = platform === "linux" && ((venues.podmanUsed && !venues.localUsed) || openshellSetupOf(venues, { PI_OPENSHELL_ENGINE: engine }).valkeyEngine === "podman");
|
|
158
161
|
const envUrl = typeof env.VALKEY_URL === "string" ? env.VALKEY_URL : null;
|
|
159
|
-
return { envPath, shared, rootRefused: typeof rootRefused === "boolean" ? rootRefused : derived, error, password: { environment: envPassword, file: filePassword }, url: { environment: envUrl, file: fileUrl } };
|
|
162
|
+
return { envPath, shared, rootRefused: typeof rootRefused === "boolean" ? rootRefused : derived, error, absent: absent === true, password: { environment: envPassword, file: filePassword }, url: { environment: envUrl, file: fileUrl } };
|
|
160
163
|
}
|
|
161
164
|
|
|
162
165
|
/**
|