@rosthq/cli 0.7.134 → 0.7.135
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.
|
@@ -7,5 +7,6 @@ export type FlagOverrides = {
|
|
|
7
7
|
negatedFlags?: Readonly<Record<string, string>>;
|
|
8
8
|
};
|
|
9
9
|
export declare function booleanFlagsFor(entry: CommandManifestEntry, overrides?: FlagOverrides): Set<string>;
|
|
10
|
+
export declare function assertKnownFlags(entry: CommandManifestEntry, parsed: ParsedFlags, overrides: FlagOverrides, extraKnownFlags?: ReadonlySet<string>): void;
|
|
10
11
|
export declare function buildBodyFromFlags(entry: CommandManifestEntry, parsed: ParsedFlags, positional?: string, overrides?: FlagOverrides): Record<string, unknown>;
|
|
11
12
|
//# sourceMappingURL=flags.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../../src/generator/flags.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,oBAAoB,EAAiB,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAwB,KAAK,WAAW,EAAc,MAAM,cAAc,CAAC;AA2BlF,MAAM,MAAM,aAAa,GAAG;IAG1B,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAE/C,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAI3B,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAI7C,YAAY,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACjD,CAAC;AAMF,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,EAAE,SAAS,GAAE,aAAkB,GAAG,GAAG,CAAC,MAAM,CAAC,CAsBvG;
|
|
1
|
+
{"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../../src/generator/flags.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,oBAAoB,EAAiB,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAwB,KAAK,WAAW,EAAc,MAAM,cAAc,CAAC;AA2BlF,MAAM,MAAM,aAAa,GAAG;IAG1B,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAE/C,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAI3B,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAI7C,YAAY,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACjD,CAAC;AAMF,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,EAAE,SAAS,GAAE,aAAkB,GAAG,GAAG,CAAC,MAAM,CAAC,CAsBvG;AAqJD,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,oBAAoB,EAC3B,MAAM,EAAE,WAAW,EACnB,SAAS,EAAE,aAAa,EACxB,eAAe,GAAE,WAAW,CAAC,MAAM,CAAa,GAC/C,IAAI,CAUN;AAKD,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,oBAAoB,EAC3B,MAAM,EAAE,WAAW,EACnB,UAAU,CAAC,EAAE,MAAM,EACnB,SAAS,GAAE,aAAkB,GAC5B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA0FzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verbs.d.ts","sourceRoot":"","sources":["../../src/generator/verbs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"verbs.d.ts","sourceRoot":"","sources":["../../src/generator/verbs.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,EAAyD,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAEvG,OAAO,EAQL,KAAK,OAAO,EAEb,MAAM,cAAc,CAAC;AAItB,MAAM,MAAM,QAAQ,GAAG,aAAa,GAAG;IACrC,SAAS,EAAE,MAAM,CAAC;IAElB,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,MAAM,CAAC;IAIrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IAEtB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAEhC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAsBF,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,CAEhF;AAGD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,oBAAoB,GAAG,MAAM,CAgCpE;AAeD,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,MAAM,CAa9E;AA+GD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAMxE"}
|
package/dist/index.js
CHANGED
|
@@ -53680,7 +53680,7 @@ External connectors are being rolled out provider by provider, conservatively (r
|
|
|
53680
53680
|
order: 48,
|
|
53681
53681
|
title: "CLI and MCP installation guide",
|
|
53682
53682
|
summary: "Install the public CLI, register remote token-backed MCP clients, and find the full command and tool catalog.",
|
|
53683
|
-
version: "2026-07-30.
|
|
53683
|
+
version: "2026-07-30.3",
|
|
53684
53684
|
public: true,
|
|
53685
53685
|
audiences: ["human", "cli", "mcp", "in_app_agent"],
|
|
53686
53686
|
stages: ["company_setup", "staffing"],
|
|
@@ -54265,7 +54265,7 @@ Ergonomic subcommands for everyday operation. Each wrapper is sugar over the sam
|
|
|
54265
54265
|
|
|
54266
54266
|
These ergonomic wrappers (including the \`{{cli}} agent\` group) require **{{cli}} 0.2.0 or newer** \u2014 run \`npx {{cliPackage}}@latest \u2026\` to get them. Older versions can still reach every command through the \`{{cli}} command <id> --json\` floor, since command execution is server-side.
|
|
54267
54267
|
|
|
54268
|
-
**Generated verbs (0.6.0+).** Every registry command now has a first-class \`{{cli}} <namespace> <action>\` verb, projected directly from the command's input schema \u2014 so namespaces that previously had no ergonomic wrapper (for example \`{{cli}} measurable create\`, \`{{cli}} work_order enqueue\`, \`{{cli}} mcp_token create\`) are usable without dropping to the raw \`command <id>\` path. Flags follow the schema field names (\`--seat-id\`, \`--name\`, \u2026); read a command's exact input offline with \`{{cli}} <namespace> <action> --schema\` before calling it, and pass a nested payload with \`--input '<json>'\` when a field is a complex object. \`--json\` still selects machine output, \`--seat <id>\` still sets seat scope, and \`{{cli}} command <id> --json '<body>'\` remains the universal fallback.
|
|
54268
|
+
**Generated verbs (0.6.0+).** Every registry command now has a first-class \`{{cli}} <namespace> <action>\` verb, projected directly from the command's input schema \u2014 so namespaces that previously had no ergonomic wrapper (for example \`{{cli}} measurable create\`, \`{{cli}} work_order enqueue\`, \`{{cli}} mcp_token create\`) are usable without dropping to the raw \`command <id>\` path. Flags follow the schema field names (\`--seat-id\`, \`--name\`, \u2026); read a command's exact input offline with \`{{cli}} <namespace> <action> --schema\` before calling it, and pass a nested payload with \`--input '<json>'\` or \`--input-file <path>\` (a JSON file read client-side) when a field is a complex object \u2014 explicit field flags merge on top of either payload form. On these generated verbs, a flag the verb does not support is a usage error naming the flag before anything is sent, never silently ignored (the bespoke handler verbs, such as \`status record\` and \`agent create\`, still parse flags by hand and are being hardened separately). \`--json\` still selects machine output, \`--seat <id>\` still sets seat scope, and \`{{cli}} command <id> --json '<body>'\` remains the universal fallback.
|
|
54269
54269
|
|
|
54270
54270
|
For a complete Seat, inspect \`{{cli}} seat create-complete --schema\`, then pass the strict nested request with \`{{cli}} seat create-complete --input '<json>' --json\`. The generic \`{{cli}} command seat.create_complete --json '<json>'\` path and the generated MCP tool \`rost_create_complete_seat\` expose the same registry schema and server-side command. \`seat create-complete\` authenticates with an existing implementation-bootstrap credential first (it is one of the vetted bootstrap staging primitives) and falls back to the user session. Staging surfaces as the CLI's confirmation-required envelope: a \`COMMAND_CONFIRMATION_REQUIRED\` JSON object on stderr, exit code 3, whose \`details\` carry the pending confirmation id and the exact approval URL (\`details.approveVia.webUrl\`) \u2014 read the URL from there; the command has done its job at that point. The human owner reviews one card covering the Seat, canonical Charter and permission manifest, disclosed staffing, effective agent lane/readiness, exact pinned Skill versions and dependency state, and schedule. Approval applies the proposal in one transaction and returns its application and receipt ids. Any failure rolls back the whole proposal. An optional agent remains in \`dry_run\`; this command never approves go-live. Direct calls use existing parent and Steward Seat ids\u2014logical references are reserved for the later composite onboarding flow. Retained source ingestion is not available on this direct command yet, so \`sources\` and every \`source_uses\` collection must be empty and planned staffing must omit \`source_ref\`; the command rejects source-backed provenance instead of accepting an unverified upload id or caller-supplied digest.
|
|
54271
54271
|
|
|
@@ -59836,10 +59836,36 @@ function explicitArgvValue(entry, field4, parsed, positional, overrides, aliasFl
|
|
|
59836
59836
|
}
|
|
59837
59837
|
return { provided: true, value: coerceScalar(field4, raw) };
|
|
59838
59838
|
}
|
|
59839
|
+
var RESERVED_FLAGS = /* @__PURE__ */ new Set(["json", "seat", "input", "body", "yes", "y", "schema"]);
|
|
59840
|
+
function knownFlagsFor(entry, overrides) {
|
|
59841
|
+
const known = new Set(RESERVED_FLAGS);
|
|
59842
|
+
for (const field4 of entry.fields) {
|
|
59843
|
+
known.add(field4.flag);
|
|
59844
|
+
}
|
|
59845
|
+
for (const aliasFlag of Object.keys(overrides.flagAliases ?? {})) {
|
|
59846
|
+
known.add(aliasFlag);
|
|
59847
|
+
}
|
|
59848
|
+
for (const negatedFlag of Object.keys(overrides.negatedFlags ?? {})) {
|
|
59849
|
+
known.add(negatedFlag);
|
|
59850
|
+
}
|
|
59851
|
+
return known;
|
|
59852
|
+
}
|
|
59853
|
+
function assertKnownFlags(entry, parsed, overrides, extraKnownFlags = /* @__PURE__ */ new Set()) {
|
|
59854
|
+
const knownFlags = knownFlagsFor(entry, overrides);
|
|
59855
|
+
for (const flag of extraKnownFlags) {
|
|
59856
|
+
knownFlags.add(flag);
|
|
59857
|
+
}
|
|
59858
|
+
for (const key of [...parsed.values.keys(), ...parsed.flags]) {
|
|
59859
|
+
if (!knownFlags.has(key)) {
|
|
59860
|
+
throw new UsageError(`Unknown flag: --${key}. Run this command with --schema to see its supported flags.`);
|
|
59861
|
+
}
|
|
59862
|
+
}
|
|
59863
|
+
}
|
|
59839
59864
|
function buildBodyFromFlags(entry, parsed, positional, overrides = {}) {
|
|
59840
59865
|
if (entry.secretBlocked) {
|
|
59841
59866
|
throw new UsageError(SECRET_ARGV_GUIDANCE);
|
|
59842
59867
|
}
|
|
59868
|
+
assertKnownFlags(entry, parsed, overrides);
|
|
59843
59869
|
const aliasFlags = new Map(Object.entries(overrides.flagAliases ?? {}));
|
|
59844
59870
|
const booleanFields = new Set(entry.fields.filter((field4) => field4.type === "boolean").map((field4) => field4.name));
|
|
59845
59871
|
for (const [negatedFlag, fieldName] of Object.entries(overrides.negatedFlags ?? {})) {
|
|
@@ -60022,7 +60048,12 @@ function renderCommandOutput(output) {
|
|
|
60022
60048
|
}
|
|
60023
60049
|
|
|
60024
60050
|
// src/generator/verbs.ts
|
|
60051
|
+
import { readFile as readFile6 } from "node:fs/promises";
|
|
60025
60052
|
var MANIFEST_BY_ID = new Map(COMMAND_MANIFEST.map((entry) => [entry.id, entry]));
|
|
60053
|
+
function hasBespokeHandler(verbSpec) {
|
|
60054
|
+
return verbSpec.handler !== void 0;
|
|
60055
|
+
}
|
|
60056
|
+
var INPUT_FILE_FLAG = /* @__PURE__ */ new Set(["input-file"]);
|
|
60026
60057
|
function manifestById(commandId) {
|
|
60027
60058
|
return MANIFEST_BY_ID.get(commandId);
|
|
60028
60059
|
}
|
|
@@ -60047,6 +60078,7 @@ function renderVerbSchema(entry) {
|
|
|
60047
60078
|
}
|
|
60048
60079
|
if (entry.hasComplexInput) {
|
|
60049
60080
|
lines.push(" --input '<json>' \u2014 nested payload (this command has complex input fields)");
|
|
60081
|
+
lines.push(" --input-file <path> \u2014 read the nested payload from a JSON file (same merge rules as --input)");
|
|
60050
60082
|
}
|
|
60051
60083
|
}
|
|
60052
60084
|
if (entry.example !== void 0) {
|
|
@@ -60054,12 +60086,12 @@ function renderVerbSchema(entry) {
|
|
|
60054
60086
|
}
|
|
60055
60087
|
return lines.join("\n");
|
|
60056
60088
|
}
|
|
60057
|
-
function verbUsageLine(bin, group, verb, entry) {
|
|
60089
|
+
function verbUsageLine(bin, group, verb, entry, advertiseComplexInput) {
|
|
60058
60090
|
const parts = entry.fields.map((field4) => {
|
|
60059
60091
|
const token = field4.type === "boolean" ? `--${field4.flag}` : `--${field4.flag} <${field4.type === "enum" && field4.enumValues ? field4.enumValues.join("|") : field4.name}>`;
|
|
60060
60092
|
return field4.required ? token : `[${token}]`;
|
|
60061
60093
|
});
|
|
60062
|
-
const complex = entry.hasComplexInput ? " [--input '<json>']" : "";
|
|
60094
|
+
const complex = entry.hasComplexInput && advertiseComplexInput ? " [--input '<json>' | --input-file <path>]" : "";
|
|
60063
60095
|
return ` ${bin} ${group} ${verb} ${parts.join(" ")}${complex}`.replace(/\s+$/, "");
|
|
60064
60096
|
}
|
|
60065
60097
|
function groupUsage(bin, group, spec) {
|
|
@@ -60071,16 +60103,47 @@ function groupUsage(bin, group, spec) {
|
|
|
60071
60103
|
if (verbSpec.usage) {
|
|
60072
60104
|
lines.push(` ${verbSpec.usage}`);
|
|
60073
60105
|
} else if (entry) {
|
|
60074
|
-
lines.push(verbUsageLine(bin, group, verb, entry));
|
|
60106
|
+
lines.push(verbUsageLine(bin, group, verb, entry, !hasBespokeHandler(verbSpec)));
|
|
60075
60107
|
}
|
|
60076
60108
|
}
|
|
60077
60109
|
return lines.join("\n");
|
|
60078
60110
|
}
|
|
60111
|
+
async function resolveInputFileFlag(parsed) {
|
|
60112
|
+
const inputFile = parsed.values.get("input-file");
|
|
60113
|
+
if (inputFile === void 0) {
|
|
60114
|
+
if (parsed.flags.has("input-file")) {
|
|
60115
|
+
throw new UsageError("Missing required --input-file value.");
|
|
60116
|
+
}
|
|
60117
|
+
return;
|
|
60118
|
+
}
|
|
60119
|
+
if (parsed.values.has("input") || parsed.values.has("body") || parsed.flags.has("input") || parsed.flags.has("body")) {
|
|
60120
|
+
throw new UsageError("Use only one of --input, --body, or --input-file.");
|
|
60121
|
+
}
|
|
60122
|
+
let text;
|
|
60123
|
+
try {
|
|
60124
|
+
text = await readFile6(inputFile, "utf8");
|
|
60125
|
+
} catch (error51) {
|
|
60126
|
+
throw new UsageError(
|
|
60127
|
+
`Could not read --input-file ${inputFile}: ${error51 instanceof Error ? error51.message : String(error51)}`
|
|
60128
|
+
);
|
|
60129
|
+
}
|
|
60130
|
+
let fileJson;
|
|
60131
|
+
try {
|
|
60132
|
+
fileJson = JSON.parse(text);
|
|
60133
|
+
} catch {
|
|
60134
|
+
throw new UsageError(`--input-file ${inputFile} must be valid JSON.`);
|
|
60135
|
+
}
|
|
60136
|
+
if (typeof fileJson !== "object" || fileJson === null || Array.isArray(fileJson)) {
|
|
60137
|
+
throw new UsageError(`--input-file ${inputFile} must contain a JSON object.`);
|
|
60138
|
+
}
|
|
60139
|
+
parsed.values.set("input", text);
|
|
60140
|
+
parsed.values.delete("input-file");
|
|
60141
|
+
}
|
|
60079
60142
|
function makeVerb(commandId, verbSpec) {
|
|
60080
|
-
if (verbSpec
|
|
60143
|
+
if (hasBespokeHandler(verbSpec)) {
|
|
60081
60144
|
return verbSpec.handler;
|
|
60082
60145
|
}
|
|
60083
|
-
return (context, rest) => {
|
|
60146
|
+
return async (context, rest) => {
|
|
60084
60147
|
const entry = MANIFEST_BY_ID.get(commandId);
|
|
60085
60148
|
if (!entry) {
|
|
60086
60149
|
throw new UsageError(`Unknown command ${commandId}.`);
|
|
@@ -60105,6 +60168,11 @@ function makeVerb(commandId, verbSpec) {
|
|
|
60105
60168
|
const positional = hasPositional ? rest[0] : void 0;
|
|
60106
60169
|
const flagArgs = hasPositional ? rest.slice(1) : rest;
|
|
60107
60170
|
const parsed = parseFlags(flagArgs, booleanFlagsFor(entry, overrides));
|
|
60171
|
+
assertKnownFlags(entry, parsed, overrides, INPUT_FILE_FLAG);
|
|
60172
|
+
if (flagArgs.filter((token) => token === "--input-file").length > 1) {
|
|
60173
|
+
throw new UsageError("Pass --input-file at most once.");
|
|
60174
|
+
}
|
|
60175
|
+
await resolveInputFileFlag(parsed);
|
|
60108
60176
|
const body = buildBodyFromFlags(entry, parsed, positional, overrides);
|
|
60109
60177
|
const render = verbSpec.render ?? renderCommandOutput;
|
|
60110
60178
|
return execute(context, parsed, commandId, body, render);
|
|
@@ -63575,7 +63643,7 @@ async function sweepStaleRunnerTempFiles(dir, options = {}) {
|
|
|
63575
63643
|
// src/runner-service.ts
|
|
63576
63644
|
import { execFile as execFileCallback2 } from "node:child_process";
|
|
63577
63645
|
import { realpathSync as realpathSync2 } from "node:fs";
|
|
63578
|
-
import { access, mkdir as mkdir4, readFile as
|
|
63646
|
+
import { access, mkdir as mkdir4, readFile as readFile7, readdir as readdir2, rm as rm4, writeFile as writeFile4 } from "node:fs/promises";
|
|
63579
63647
|
import { homedir as homedir4 } from "node:os";
|
|
63580
63648
|
import path7 from "node:path";
|
|
63581
63649
|
import { promisify as promisify2 } from "node:util";
|
|
@@ -63989,7 +64057,7 @@ async function inspectRunnerService(options) {
|
|
|
63989
64057
|
const paths = runnerServicePaths(options.homeDir, safeName);
|
|
63990
64058
|
const label = serviceLabel(safeName);
|
|
63991
64059
|
const installed = await fileExists(paths.launchAgentPath);
|
|
63992
|
-
const plist = installed ? await
|
|
64060
|
+
const plist = installed ? await readFile7(paths.launchAgentPath, "utf8").catch(() => null) : null;
|
|
63993
64061
|
const programArgs = plist ? extractProgramArguments(plist) : [];
|
|
63994
64062
|
const appUrl2 = plist ? extractPlistEnvironmentValue(plist, `${cliBrand.envPrefix}_APP_URL`) : null;
|
|
63995
64063
|
const urlPolicyEnv = extractPlistEnvironmentValue(plist ?? "", allowInsecureAppUrlEnv) === "1" ? "set" : "unset";
|
|
@@ -64257,7 +64325,7 @@ async function fileExists(file2) {
|
|
|
64257
64325
|
}
|
|
64258
64326
|
async function readTail(file2, maxBytes) {
|
|
64259
64327
|
try {
|
|
64260
|
-
const content = await
|
|
64328
|
+
const content = await readFile7(file2, "utf8");
|
|
64261
64329
|
return content.length > maxBytes ? content.slice(content.length - maxBytes) : content;
|
|
64262
64330
|
} catch {
|
|
64263
64331
|
return null;
|
|
@@ -64405,7 +64473,7 @@ function parseSemver2(value) {
|
|
|
64405
64473
|
import { execFile as execFileCallback5, spawn } from "node:child_process";
|
|
64406
64474
|
import { createHash as createHash4, randomUUID } from "node:crypto";
|
|
64407
64475
|
import { constants as fsConstants4 } from "node:fs";
|
|
64408
|
-
import { access as access3, chmod as chmod2, lstat as lstat2, mkdir as mkdir6, open as open2, readFile as
|
|
64476
|
+
import { access as access3, chmod as chmod2, lstat as lstat2, mkdir as mkdir6, open as open2, readFile as readFile9, rename as rename2, rm as rm6, statfs, writeFile as writeFile6 } from "node:fs/promises";
|
|
64409
64477
|
import { cpus, homedir as homedir5, hostname as hostname3, platform, totalmem, tmpdir as tmpdir2 } from "node:os";
|
|
64410
64478
|
import path10 from "node:path";
|
|
64411
64479
|
import { setTimeout as sleep3 } from "node:timers/promises";
|
|
@@ -64415,7 +64483,7 @@ import { promisify as promisify5 } from "node:util";
|
|
|
64415
64483
|
import { execFile as execFileCallback4 } from "node:child_process";
|
|
64416
64484
|
import { createHash as createHash3, randomBytes } from "node:crypto";
|
|
64417
64485
|
import { constants as fsConstants3 } from "node:fs";
|
|
64418
|
-
import { chmod, link, lstat, mkdir as mkdir5, mkdtemp, open, readdir as readdir3, readFile as
|
|
64486
|
+
import { chmod, link, lstat, mkdir as mkdir5, mkdtemp, open, readdir as readdir3, readFile as readFile8, realpath, rename, rm as rm5, stat as stat4, writeFile as writeFile5 } from "node:fs/promises";
|
|
64419
64487
|
import os3 from "node:os";
|
|
64420
64488
|
import path8 from "node:path";
|
|
64421
64489
|
import { setTimeout as sleep2 } from "node:timers/promises";
|
|
@@ -64527,7 +64595,7 @@ async function provisionIsolatedClaudeConfigDir(base, configDir, onRepair) {
|
|
|
64527
64595
|
const source = resolveSourceClaudeConfigDir(base);
|
|
64528
64596
|
for (const file2 of CLAUDE_CONFIG_AUTH_FILES) {
|
|
64529
64597
|
try {
|
|
64530
|
-
const data = await
|
|
64598
|
+
const data = await readFile8(path8.join(source, file2));
|
|
64531
64599
|
await writeFileAtomicNoFollow(path8.join(configDir, file2), data, { mode: 384 });
|
|
64532
64600
|
} catch {
|
|
64533
64601
|
}
|
|
@@ -64730,7 +64798,7 @@ trust_level = "untrusted"
|
|
|
64730
64798
|
await rm5(dest, { recursive: true, force: true });
|
|
64731
64799
|
}
|
|
64732
64800
|
const source = resolveSourceCodexHomeDir(base);
|
|
64733
|
-
const data = await
|
|
64801
|
+
const data = await readFile8(path8.join(source, CODEX_HOME_AUTH_FILE)).catch(() => null);
|
|
64734
64802
|
if (data === null) {
|
|
64735
64803
|
return homeDir;
|
|
64736
64804
|
}
|
|
@@ -64813,7 +64881,7 @@ async function acquireCodexHomeLock(homeDir, options = {}) {
|
|
|
64813
64881
|
ino = String((await handle.stat()).ino);
|
|
64814
64882
|
} catch (error51) {
|
|
64815
64883
|
await handle.close().catch(() => void 0);
|
|
64816
|
-
const stillOurs = await
|
|
64884
|
+
const stillOurs = await readFile8(lockPath, "utf8").then((raw) => JSON.parse(raw).nonce === nonce).catch(() => false);
|
|
64817
64885
|
if (stillOurs) {
|
|
64818
64886
|
await rm5(lockPath, { force: true }).catch(() => void 0);
|
|
64819
64887
|
}
|
|
@@ -64856,7 +64924,7 @@ async function breakCodexHomeLock(lockPath, expected) {
|
|
|
64856
64924
|
}
|
|
64857
64925
|
let raw;
|
|
64858
64926
|
try {
|
|
64859
|
-
raw = await
|
|
64927
|
+
raw = await readFile8(lockPath, "utf8");
|
|
64860
64928
|
} catch {
|
|
64861
64929
|
return;
|
|
64862
64930
|
}
|
|
@@ -64873,7 +64941,7 @@ async function judgeCodexHomeLock(lockPath, staleMs) {
|
|
|
64873
64941
|
}
|
|
64874
64942
|
let raw;
|
|
64875
64943
|
try {
|
|
64876
|
-
raw = await
|
|
64944
|
+
raw = await readFile8(lockPath, "utf8");
|
|
64877
64945
|
} catch (error51) {
|
|
64878
64946
|
if (error51.code === "ENOENT") {
|
|
64879
64947
|
return { stale: false, identity: null };
|
|
@@ -66436,7 +66504,7 @@ async function migrateOneLegacyCodexHome(legacyHome, newHome, io) {
|
|
|
66436
66504
|
}
|
|
66437
66505
|
async function loadState(filePath, expectedTenantId) {
|
|
66438
66506
|
try {
|
|
66439
|
-
const parsed = JSON.parse(await
|
|
66507
|
+
const parsed = JSON.parse(await readFile9(filePath, "utf8"));
|
|
66440
66508
|
if (typeof parsed.runner_id === "string" && typeof parsed.runner_secret === "string") {
|
|
66441
66509
|
if (expectedTenantId && parsed.tenant_id !== expectedTenantId) {
|
|
66442
66510
|
return null;
|
|
@@ -68259,7 +68327,7 @@ async function reconcileOrphanedInFlightWorkOrders(deps) {
|
|
|
68259
68327
|
const transcriptPath = await findClaudeTranscriptPath(entry.claude_config_dir, entry.claude_session_id);
|
|
68260
68328
|
if (transcriptPath) {
|
|
68261
68329
|
try {
|
|
68262
|
-
const content = await
|
|
68330
|
+
const content = await readFile9(transcriptPath, "utf8");
|
|
68263
68331
|
verdict = classifyClaudeTranscript(content);
|
|
68264
68332
|
} catch {
|
|
68265
68333
|
verdict = { kind: "missing" };
|