overvues 0.0.1 → 0.4.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -2
- package/dist/ansi.js +24 -0
- package/dist/attach-client.js +586 -0
- package/dist/auth-connect-browser.js +112 -0
- package/dist/auth-connect.js +306 -0
- package/dist/browser-bootstrap.js +190 -0
- package/dist/browser-loopback.js +289 -0
- package/dist/build-identity.js +6 -0
- package/dist/codex-reviewer-apparmor.json +4 -0
- package/dist/codex-reviewer-seccomp.json +1238 -0
- package/dist/codex-runtime-protocol.js +1 -0
- package/dist/codex-subscription.js +53 -0
- package/dist/config.js +297 -0
- package/dist/connect-comparison-code.js +26 -0
- package/dist/development-runner.js +109 -0
- package/dist/dns-doctor.js +390 -0
- package/dist/docker-names.js +47 -0
- package/dist/doctor.js +114 -0
- package/dist/gadget-job.js +804 -0
- package/dist/health-check.js +112 -0
- package/dist/help.js +71 -0
- package/dist/host-auth.js +22 -0
- package/dist/host-diagnostics.js +20 -0
- package/dist/host-runtime-identity.js +39 -0
- package/dist/host-runtime-metadata.js +56 -0
- package/dist/host-service.js +377 -0
- package/dist/host-stack.js +484 -0
- package/dist/host-supervisor.js +237 -0
- package/dist/host-update.js +387 -0
- package/dist/hub-address.js +100 -0
- package/dist/hub-client.js +459 -0
- package/dist/hub-kind.js +88 -0
- package/dist/identity.js +73 -0
- package/dist/index.js +185 -0
- package/dist/init.js +295 -0
- package/dist/isolated-run-cache.js +116 -0
- package/dist/local-stack.js +685 -0
- package/dist/machine-capacity.js +128 -0
- package/dist/managed-runner-image.js +13 -0
- package/dist/os-acted-record.js +49 -0
- package/dist/os-adapter.js +8190 -0
- package/dist/os-command.js +292 -0
- package/dist/os-handoff.js +274 -0
- package/dist/os-keychain.js +247 -0
- package/dist/os-machine.js +818 -0
- package/dist/os-owner.js +61 -0
- package/dist/os-private-file.js +98 -0
- package/dist/os-protocol.js +468 -0
- package/dist/os-session-store.js +133 -0
- package/dist/os-status.js +102 -0
- package/dist/picker.js +863 -0
- package/dist/portable-workspace-capability.js +60 -0
- package/dist/project-environment-capability.js +62 -0
- package/dist/project-environment.js +28 -0
- package/dist/project-preparation.js +134 -0
- package/dist/readiness.js +28 -0
- package/dist/redaction.js +27 -0
- package/dist/reviewer-isolation-capability.js +61 -0
- package/dist/runner-api-auth.js +80 -0
- package/dist/runner-command-fence.js +536 -0
- package/dist/runner-inspection.js +57 -0
- package/dist/runner-inventory.js +587 -0
- package/dist/runner-server.js +2520 -0
- package/dist/runner-session.js +470 -0
- package/dist/runner-slug-folder.js +39 -0
- package/dist/runner-slug.js +40 -0
- package/dist/setup.js +139 -0
- package/dist/shutdown.js +102 -0
- package/dist/splash.js +65 -0
- package/dist/staged-workspaces.js +441 -0
- package/dist/staging-disk.js +97 -0
- package/dist/terminal-lane.js +339 -0
- package/dist/terminal-recovery.js +502 -0
- package/licenses/capnweb.txt +23 -0
- package/licenses/moby-profiles.txt +212 -0
- package/licenses/ws.txt +22 -0
- package/package.json +28 -7
- package/cli.js +0 -2
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// Where `tiller` keeps the person's OS session: on a Mac, the login keychain (`os-keychain.ts`);
|
|
2
|
+
// on any other machine, where there is no keychain, a file only the owner can read. Both are
|
|
3
|
+
// behind one interface, and `machineOsSessionStore` picks the one for the platform: a Mac never
|
|
4
|
+
// reads or writes the file. The session arrives by the handoff (`tiller os connect`) only.
|
|
5
|
+
//
|
|
6
|
+
// The session is read from here and from nowhere else: never an environment variable, never a
|
|
7
|
+
// command argument, never a session another tool saved on this machine.
|
|
8
|
+
import { join } from "node:path";
|
|
9
|
+
import { keychainOsSessionStore } from "./os-keychain.js";
|
|
10
|
+
import { osFolder, readPrivateFile, removePrivateFile, writePrivateFile } from "./os-private-file.js";
|
|
11
|
+
import { CLI, OS } from "./identity.js";
|
|
12
|
+
/**
|
|
13
|
+
* A session is stored, and it cannot be had right now. `locked` and `denied` are the keychain
|
|
14
|
+
* saying no; the answer to both is to unlock it, never to look for the session somewhere else.
|
|
15
|
+
*/
|
|
16
|
+
export class OsSessionUnavailableError extends Error {
|
|
17
|
+
reason;
|
|
18
|
+
constructor(reason, message) {
|
|
19
|
+
super(message);
|
|
20
|
+
this.reason = reason;
|
|
21
|
+
this.name = "OsSessionUnavailableError";
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/** The non-secret part of a stored session. */
|
|
25
|
+
export function osSessionInfo(stored, store) {
|
|
26
|
+
return {
|
|
27
|
+
store, osUrl: stored.osUrl, account: { id: stored.account.id, name: stored.account.name }, savedAt: stored.savedAt,
|
|
28
|
+
...(stored.expiresAt ? { expiresAt: stored.expiresAt } : {}), ...(stored.connectedBy ? { connectedBy: stored.connectedBy } : {}),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
// ── Expiry ───────────────────────────────────────────────────────────
|
|
32
|
+
/** From this many days before a session ends, the person is told to connect again. */
|
|
33
|
+
export const OS_SESSION_WARN_DAYS = 5;
|
|
34
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
35
|
+
export function osSessionExpiry(expiresAt, now) {
|
|
36
|
+
const at = expiresAt ? Date.parse(expiresAt) : Number.NaN;
|
|
37
|
+
if (!expiresAt || !Number.isFinite(at))
|
|
38
|
+
return { state: "unknown" };
|
|
39
|
+
if (at <= now)
|
|
40
|
+
return { state: "expired", expiresAt };
|
|
41
|
+
const daysLeft = Math.floor((at - now) / DAY_MS);
|
|
42
|
+
return { state: at - now <= OS_SESSION_WARN_DAYS * DAY_MS ? "soon" : "ok", expiresAt, daysLeft };
|
|
43
|
+
}
|
|
44
|
+
/** What to tell the person about the session's end, or null when there is nothing to say yet. */
|
|
45
|
+
export function osSessionExpiryLine(expiry) {
|
|
46
|
+
if (expiry.state === "expired") {
|
|
47
|
+
return `The ${OS.noun} session on this machine ran out on ${expiry.expiresAt.slice(0, 10)}. Run \`${CLI.command} os connect\` at this machine to connect it again.`;
|
|
48
|
+
}
|
|
49
|
+
if (expiry.state === "soon") {
|
|
50
|
+
const left = expiry.daysLeft < 1 ? "in less than a day" : expiry.daysLeft === 1 ? "in 1 day" : `in ${expiry.daysLeft} days`;
|
|
51
|
+
return `The ${OS.noun} session on this machine runs out ${left}, on ${expiry.expiresAt.slice(0, 10)}. Run \`${CLI.command} os connect\` at this machine before then.`;
|
|
52
|
+
}
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
const isText = (value) => typeof value === "string" && value.length > 0;
|
|
56
|
+
/**
|
|
57
|
+
* The store on a machine that is not a Mac, which has no keychain for the handoff's session:
|
|
58
|
+
* `<config folder>/os/session.json`, mode 0600, in a 0700 folder.
|
|
59
|
+
*/
|
|
60
|
+
export function fileOsSessionStore(configDir) {
|
|
61
|
+
const path = join(osFolder(configDir), "session.json");
|
|
62
|
+
return {
|
|
63
|
+
load() {
|
|
64
|
+
const text = readPrivateFile(path);
|
|
65
|
+
if (text === null)
|
|
66
|
+
return null;
|
|
67
|
+
let parsed;
|
|
68
|
+
try {
|
|
69
|
+
parsed = JSON.parse(text);
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
parsed = null;
|
|
73
|
+
}
|
|
74
|
+
const record = parsed;
|
|
75
|
+
if (!record || record.version !== 1 || !isText(record.osUrl) || !isText(record.session)
|
|
76
|
+
|| !record.account || !isText(record.account.id) || typeof record.account.name !== "string" || !isText(record.savedAt)) {
|
|
77
|
+
// Says nothing about the content: part of it may be a session.
|
|
78
|
+
throw new Error(`The stored ${OS.noun} session cannot be read. Run \`${CLI.command} os forget\`, then \`${CLI.command} os connect\`.`);
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
osUrl: record.osUrl, session: record.session, account: { id: record.account.id, name: record.account.name }, savedAt: record.savedAt,
|
|
82
|
+
...(isText(record.expiresAt) ? { expiresAt: record.expiresAt } : {}),
|
|
83
|
+
...(record.connectedBy === "handoff" ? { connectedBy: record.connectedBy } : {}),
|
|
84
|
+
};
|
|
85
|
+
},
|
|
86
|
+
save(session) {
|
|
87
|
+
writePrivateFile(path, `${JSON.stringify({ version: 1, ...session }, null, 2)}\n`);
|
|
88
|
+
},
|
|
89
|
+
forget() {
|
|
90
|
+
return removePrivateFile(path);
|
|
91
|
+
},
|
|
92
|
+
describe() {
|
|
93
|
+
const stored = this.load();
|
|
94
|
+
return stored ? osSessionInfo(stored, "file") : null;
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* The store a machine uses: the keychain on a Mac and nothing else (when it is locked or says
|
|
100
|
+
* no, `load` throws `OsSessionUnavailableError`; no file is ever tried instead), and the file on
|
|
101
|
+
* any other machine.
|
|
102
|
+
*/
|
|
103
|
+
export function machineOsSessionStore(configDir, options = {}) {
|
|
104
|
+
if ((options.platform ?? process.platform) !== "darwin") {
|
|
105
|
+
const file = fileOsSessionStore(configDir);
|
|
106
|
+
return {
|
|
107
|
+
preferred: "file",
|
|
108
|
+
load: () => file.load(),
|
|
109
|
+
describe: () => file.describe(),
|
|
110
|
+
unavailable: () => null,
|
|
111
|
+
save: (session) => file.save(session),
|
|
112
|
+
forget: () => file.forget(),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
const keychain = keychainOsSessionStore(configDir, options);
|
|
116
|
+
return {
|
|
117
|
+
preferred: "keychain",
|
|
118
|
+
load: () => keychain.load(),
|
|
119
|
+
describe: () => keychain.describe(),
|
|
120
|
+
unavailable: () => keychain.unavailable(),
|
|
121
|
+
save: (session) => keychain.save(session),
|
|
122
|
+
forget: () => {
|
|
123
|
+
try {
|
|
124
|
+
if (keychain.describe() === null)
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
// A note that cannot be read is still removed.
|
|
129
|
+
}
|
|
130
|
+
return keychain.forget();
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// What the `tiller host` daemon tells the Hub about this machine's OS session, and what it
|
|
2
|
+
// tells the person at the machine as the session nears its end.
|
|
3
|
+
//
|
|
4
|
+
// Only the store's non-secret description is read (`describe`), so with the keychain this never
|
|
5
|
+
// touches the secret and never causes an unlock prompt. The Hub hears whether a usable session
|
|
6
|
+
// is stored, for which OS, and when it ends: never the session, and not whose it is.
|
|
7
|
+
import { OS_PROTOCOL } from "./os-protocol.js";
|
|
8
|
+
import { OsSessionUnavailableError, osSessionExpiry, osSessionExpiryLine, osSessionInfo, } from "./os-session-store.js";
|
|
9
|
+
import { CLI, OS } from "./identity.js";
|
|
10
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
11
|
+
function describeStore(sessions) {
|
|
12
|
+
if (sessions.describe)
|
|
13
|
+
return sessions.describe();
|
|
14
|
+
const stored = sessions.load();
|
|
15
|
+
return stored ? osSessionInfo(stored, "file") : null;
|
|
16
|
+
}
|
|
17
|
+
export function osStatusOf(sessions, machineId, now) {
|
|
18
|
+
const base = { type: "os-status", protocol: OS_PROTOCOL, machineId };
|
|
19
|
+
let info;
|
|
20
|
+
try {
|
|
21
|
+
info = describeStore(sessions);
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
const locked = error instanceof OsSessionUnavailableError && (error.reason === "locked" || error.reason === "denied");
|
|
25
|
+
return { ...base, sessionStored: false, sessionProblem: locked ? "locked" : "unreadable" };
|
|
26
|
+
}
|
|
27
|
+
if (!info)
|
|
28
|
+
return { ...base, sessionStored: false };
|
|
29
|
+
const unavailable = sessions.unavailable?.() ?? null;
|
|
30
|
+
let osOrigin;
|
|
31
|
+
try {
|
|
32
|
+
osOrigin = new URL(info.osUrl).origin;
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
osOrigin = undefined;
|
|
36
|
+
}
|
|
37
|
+
const expiry = osSessionExpiry(info.expiresAt, now);
|
|
38
|
+
return {
|
|
39
|
+
...base,
|
|
40
|
+
sessionStored: expiry.state !== "expired" && !unavailable,
|
|
41
|
+
...(osOrigin ? { osOrigin } : {}),
|
|
42
|
+
...(expiry.state !== "unknown" ? { sessionExpiresAt: expiry.expiresAt } : {}),
|
|
43
|
+
...(expiry.state === "expired" ? { sessionProblem: "expired" }
|
|
44
|
+
: unavailable ? { sessionProblem: unavailable.reason === "locked" || unavailable.reason === "denied" ? "locked" : "unreadable" }
|
|
45
|
+
: {}),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/** The line the daemon logs when what it tells the Hub changes. */
|
|
49
|
+
export function osStatusLogLine(status) {
|
|
50
|
+
if (status.sessionStored)
|
|
51
|
+
return `${OS.noun}: this machine is now connected to ${status.osOrigin ?? OS.the}; told the Hub`;
|
|
52
|
+
if (status.sessionProblem === "expired")
|
|
53
|
+
return `${OS.noun}: this machine's ${OS.noun} session ran out; told the Hub. Run \`${CLI.command} os connect\` at this machine.`;
|
|
54
|
+
if (status.sessionProblem === "locked")
|
|
55
|
+
return `${OS.noun}: this machine's ${OS.noun} session is in a locked keychain; told the Hub. Unlock the keychain.`;
|
|
56
|
+
if (status.sessionProblem === "unreadable")
|
|
57
|
+
return `${OS.noun}: this machine's ${OS.noun} session cannot be read; told the Hub. Run \`${CLI.command} os status\` at this machine.`;
|
|
58
|
+
return `${OS.noun}: this machine no longer holds an ${OS.noun} session; told the Hub`;
|
|
59
|
+
}
|
|
60
|
+
/** The line the daemon logs each time its Hub connection opens: what it told the Hub then. */
|
|
61
|
+
export function osStatusConnectLogLine(status) {
|
|
62
|
+
const said = status.sessionStored ? `this machine is connected to ${status.osOrigin ?? OS.the}`
|
|
63
|
+
: status.sessionProblem === "expired" ? `this machine's ${OS.noun} session ran out`
|
|
64
|
+
: status.sessionProblem === "locked" ? `this machine's ${OS.noun} session is in a locked keychain`
|
|
65
|
+
: status.sessionProblem === "unreadable" ? `this machine's ${OS.noun} session cannot be read`
|
|
66
|
+
: `this machine is not connected to ${OS.the}`;
|
|
67
|
+
return `${OS.noun}: told the Hub on connecting: ${said}`;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Reads the status for the daemon and, at most once a day, logs that the session is about to
|
|
71
|
+
* run out or has.
|
|
72
|
+
*
|
|
73
|
+
* The session itself is asked for once when a stored one is first seen, so a keychain the daemon
|
|
74
|
+
* cannot read shows at once and not at the first Ship; and again while it could not be had, so
|
|
75
|
+
* the Hub hears when the person has unlocked it. The store decides how often the keychain is
|
|
76
|
+
* really asked.
|
|
77
|
+
*/
|
|
78
|
+
export function osStatusSource(sessions, machineId, now, log) {
|
|
79
|
+
let warned = null;
|
|
80
|
+
let tried = "";
|
|
81
|
+
return () => {
|
|
82
|
+
let status = osStatusOf(sessions, machineId, now());
|
|
83
|
+
const seen = status.sessionProblem === "expired" || !(status.sessionStored || status.sessionProblem) ? "" : `${status.osOrigin} ${status.sessionExpiresAt}`;
|
|
84
|
+
if (seen && (seen !== tried || status.sessionProblem)) {
|
|
85
|
+
try {
|
|
86
|
+
sessions.load();
|
|
87
|
+
}
|
|
88
|
+
catch { /* `unavailable` now says why */ }
|
|
89
|
+
status = osStatusOf(sessions, machineId, now());
|
|
90
|
+
}
|
|
91
|
+
tried = seen;
|
|
92
|
+
const line = osSessionExpiryLine(osSessionExpiry(status.sessionExpiresAt, now()));
|
|
93
|
+
if (!line) {
|
|
94
|
+
warned = null;
|
|
95
|
+
}
|
|
96
|
+
else if (!warned || warned.expiresAt !== status.sessionExpiresAt || now() - warned.at >= DAY_MS) {
|
|
97
|
+
warned = { expiresAt: status.sessionExpiresAt, at: now() };
|
|
98
|
+
log(`${OS.noun}: ${line}`);
|
|
99
|
+
}
|
|
100
|
+
return status;
|
|
101
|
+
};
|
|
102
|
+
}
|