@zixt/host 0.0.122 → 0.0.123
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/index.js +66 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -28,7 +28,7 @@ import { homedir as homedir4 } from "node:os";
|
|
|
28
28
|
// package.json
|
|
29
29
|
var package_default = {
|
|
30
30
|
name: "@zixt/host",
|
|
31
|
-
version: "0.0.
|
|
31
|
+
version: "0.0.123",
|
|
32
32
|
type: "module",
|
|
33
33
|
exports: {
|
|
34
34
|
".": "./src/client.ts",
|
|
@@ -22448,6 +22448,17 @@ function sanitizedInstallerEnv(inherited) {
|
|
|
22448
22448
|
}
|
|
22449
22449
|
|
|
22450
22450
|
// src/runners/runner-install.ts
|
|
22451
|
+
var INSTALLABLE_RUNNERS = ["claude-code", "codex"];
|
|
22452
|
+
function parseRunnerAutoinstallSelection(value) {
|
|
22453
|
+
const trimmed = value?.trim() ?? "";
|
|
22454
|
+
if (trimmed === "" || trimmed === "on") return new Set(INSTALLABLE_RUNNERS);
|
|
22455
|
+
if (trimmed === "off") return /* @__PURE__ */ new Set();
|
|
22456
|
+
return new Set(
|
|
22457
|
+
trimmed.split(",").map((token2) => token2.trim()).filter(
|
|
22458
|
+
(token2) => INSTALLABLE_RUNNERS.includes(token2)
|
|
22459
|
+
)
|
|
22460
|
+
);
|
|
22461
|
+
}
|
|
22451
22462
|
var CLAUDE_INSTALLER_URL_POSIX = "https://claude.ai/install.sh";
|
|
22452
22463
|
var CLAUDE_INSTALLER_URL_WINDOWS = "https://claude.ai/install.ps1";
|
|
22453
22464
|
var CODEX_PACKAGE = "@openai/codex";
|
|
@@ -22626,10 +22637,12 @@ function createRunnerAutoInstaller(options) {
|
|
|
22626
22637
|
};
|
|
22627
22638
|
const install = options.install ?? ((type) => type === "claude-code" ? installClaude() : installCodex());
|
|
22628
22639
|
return {
|
|
22629
|
-
ensureInstalled(type) {
|
|
22640
|
+
ensureInstalled(type, ensureOptions) {
|
|
22630
22641
|
if (inFlight.has(type)) return;
|
|
22631
22642
|
const lastFailure = failedAt.get(type);
|
|
22632
|
-
if (lastFailure !== void 0 && now() - lastFailure < FAILURE_COOLDOWN_MS)
|
|
22643
|
+
if (!ensureOptions?.force && lastFailure !== void 0 && now() - lastFailure < FAILURE_COOLDOWN_MS) {
|
|
22644
|
+
return;
|
|
22645
|
+
}
|
|
22633
22646
|
options.onEvent({ runner: type, state: "started" });
|
|
22634
22647
|
const attempt = (async () => {
|
|
22635
22648
|
try {
|
|
@@ -22663,6 +22676,9 @@ function createRunnerAutoInstaller(options) {
|
|
|
22663
22676
|
})();
|
|
22664
22677
|
inFlight.set(type, attempt);
|
|
22665
22678
|
},
|
|
22679
|
+
isInstalling(type) {
|
|
22680
|
+
return inFlight.has(type);
|
|
22681
|
+
},
|
|
22666
22682
|
async settled() {
|
|
22667
22683
|
while (inFlight.size > 0) await Promise.allSettled([...inFlight.values()]);
|
|
22668
22684
|
}
|
|
@@ -43478,7 +43494,7 @@ async function forgetAcknowledgedAcceptedAssignments(assignments, root = default
|
|
|
43478
43494
|
}
|
|
43479
43495
|
|
|
43480
43496
|
// src/local-observability.ts
|
|
43481
|
-
import { appendFile, mkdir as mkdir19, open as open12, rename as rename11, rm as rm15, stat as stat3 } from "node:fs/promises";
|
|
43497
|
+
import { appendFile, mkdir as mkdir19, open as open12, readdir as readdir8, rename as rename11, rm as rm15, stat as stat3 } from "node:fs/promises";
|
|
43482
43498
|
import { homedir as homedir15 } from "node:os";
|
|
43483
43499
|
import { basename as basename7, dirname as dirname16, join as join26 } from "node:path";
|
|
43484
43500
|
|
|
@@ -43589,6 +43605,7 @@ function createHostLogger(options = {}) {
|
|
|
43589
43605
|
var LOCAL_CONSOLE_FILE = "console.jsonl";
|
|
43590
43606
|
var LOCAL_CONSOLE_PREVIOUS_FILE = "console.prev.jsonl";
|
|
43591
43607
|
var LOCAL_STATUS_FILE = "status.json";
|
|
43608
|
+
var LOCAL_REQUESTS_DIR = "requests";
|
|
43592
43609
|
var DEFAULT_CONSOLE_ROTATE_BYTES = 2 * 1024 * 1024;
|
|
43593
43610
|
function defaultLocalObservabilityRoot() {
|
|
43594
43611
|
return join26(homedir15(), ".zixt", "observability");
|
|
@@ -43644,6 +43661,26 @@ function createLocalConsoleSink(options = {}) {
|
|
|
43644
43661
|
settled: () => queue
|
|
43645
43662
|
};
|
|
43646
43663
|
}
|
|
43664
|
+
async function consumeRunnerInstallRequests(root = defaultLocalObservabilityRoot()) {
|
|
43665
|
+
const directory = join26(root, LOCAL_REQUESTS_DIR);
|
|
43666
|
+
const requested = /* @__PURE__ */ new Set();
|
|
43667
|
+
let names;
|
|
43668
|
+
try {
|
|
43669
|
+
names = await readdir8(directory);
|
|
43670
|
+
} catch {
|
|
43671
|
+
return requested;
|
|
43672
|
+
}
|
|
43673
|
+
for (const type of INSTALLABLE_RUNNERS) {
|
|
43674
|
+
const name = `install-runner-${type}.json`;
|
|
43675
|
+
if (!names.includes(name)) continue;
|
|
43676
|
+
try {
|
|
43677
|
+
await rm15(join26(directory, name), { force: true });
|
|
43678
|
+
requested.add(type);
|
|
43679
|
+
} catch {
|
|
43680
|
+
}
|
|
43681
|
+
}
|
|
43682
|
+
return requested;
|
|
43683
|
+
}
|
|
43647
43684
|
async function writeLocalStatus(status, root = defaultLocalObservabilityRoot()) {
|
|
43648
43685
|
const destination = join26(root, LOCAL_STATUS_FILE);
|
|
43649
43686
|
const temporary = join26(
|
|
@@ -43994,7 +44031,10 @@ if (!token) {
|
|
|
43994
44031
|
process.exit(DO_NOT_RESTART_EXIT_CODE);
|
|
43995
44032
|
}
|
|
43996
44033
|
var demoPreflightScript = forceDemo ? process.env.ZIXT_DEMO_PREFLIGHT_SCRIPT : void 0;
|
|
43997
|
-
var
|
|
44034
|
+
var runnerAutoinstallSelection = parseRunnerAutoinstallSelection(
|
|
44035
|
+
process.env.ZIXT_RUNNER_AUTOINSTALL
|
|
44036
|
+
);
|
|
44037
|
+
var runnerAutoInstaller = forceDemo ? null : createRunnerAutoInstaller({
|
|
43998
44038
|
onEvent: (event) => {
|
|
43999
44039
|
const name = event.runner === "claude-code" ? "Claude Code" : "Codex";
|
|
44000
44040
|
if (event.state === "started") {
|
|
@@ -44144,7 +44184,8 @@ async function currentBrowserCapability() {
|
|
|
44144
44184
|
return measured;
|
|
44145
44185
|
}
|
|
44146
44186
|
async function telemetry() {
|
|
44147
|
-
|
|
44187
|
+
const requestedInstalls = runnerAutoInstaller ? await consumeRunnerInstallRequests(localObservabilityRoot) : /* @__PURE__ */ new Set();
|
|
44188
|
+
if (!cachedRunners || Date.now() - cachedRunnersAt > 4 * 6e4 || requestedInstalls.size > 0) {
|
|
44148
44189
|
cachedRunners = await Promise.all([
|
|
44149
44190
|
preflightClaudeCode(
|
|
44150
44191
|
demoPreflightScript ? { command: process.execPath, commandPrefixArgs: [demoPreflightScript] } : {}
|
|
@@ -44156,7 +44197,22 @@ async function telemetry() {
|
|
|
44156
44197
|
cachedRunnersAt = Date.now();
|
|
44157
44198
|
for (const runner of cachedRunners) {
|
|
44158
44199
|
reportRunnerReadiness(runner);
|
|
44159
|
-
if (!
|
|
44200
|
+
if (!runnerAutoInstaller || runner.type !== "claude-code" && runner.type !== "codex") {
|
|
44201
|
+
continue;
|
|
44202
|
+
}
|
|
44203
|
+
const requested = requestedInstalls.has(runner.type);
|
|
44204
|
+
if (runner.installed) {
|
|
44205
|
+
if (requested) {
|
|
44206
|
+
log.info(
|
|
44207
|
+
`${runner.type === "claude-code" ? "Claude Code" : "Codex"} is already installed on this Machine`,
|
|
44208
|
+
{ machine }
|
|
44209
|
+
);
|
|
44210
|
+
}
|
|
44211
|
+
continue;
|
|
44212
|
+
}
|
|
44213
|
+
if (requested) {
|
|
44214
|
+
runnerAutoInstaller.ensureInstalled(runner.type, { force: true });
|
|
44215
|
+
} else if (runnerAutoinstallSelection.has(runner.type)) {
|
|
44160
44216
|
runnerAutoInstaller.ensureInstalled(runner.type);
|
|
44161
44217
|
}
|
|
44162
44218
|
}
|
|
@@ -44272,7 +44328,9 @@ function publishLocalStatus() {
|
|
|
44272
44328
|
...localCloudConnectedAt ? { connectedAt: localCloudConnectedAt } : {}
|
|
44273
44329
|
},
|
|
44274
44330
|
activeSessions,
|
|
44275
|
-
runners: cachedRunners ?? []
|
|
44331
|
+
runners: (cachedRunners ?? []).map(
|
|
44332
|
+
(runner) => (runner.type === "claude-code" || runner.type === "codex") && runnerAutoInstaller?.isInstalling(runner.type) ? { ...runner, installing: true } : runner
|
|
44333
|
+
),
|
|
44276
44334
|
browser: cachedBrowserCapability ?? { status: "unavailable" }
|
|
44277
44335
|
},
|
|
44278
44336
|
...localObservabilityRoot ? [localObservabilityRoot] : []
|