@f-o-h/cli 0.1.72 → 0.1.73
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/foh.js +43 -8
- package/package.json +41 -42
package/dist/foh.js
CHANGED
|
@@ -32790,7 +32790,7 @@ var StdioServerTransport = class {
|
|
|
32790
32790
|
};
|
|
32791
32791
|
|
|
32792
32792
|
// src/lib/cli-version.ts
|
|
32793
|
-
var CLI_VERSION = "0.1.
|
|
32793
|
+
var CLI_VERSION = "0.1.73";
|
|
32794
32794
|
|
|
32795
32795
|
// src/commands/mcp-serve.ts
|
|
32796
32796
|
var DEFAULT_TIMEOUT_MS = 12e4;
|
|
@@ -39659,23 +39659,58 @@ function firstCommandTime(commands) {
|
|
|
39659
39659
|
const times = commands.map((command) => String(command.started_at || command.recorded_at || command.completed_at || "")).map((raw) => ({ raw, time: Date.parse(raw) })).filter((entry) => Number.isFinite(entry.time)).sort((a, b) => a.time - b.time);
|
|
39660
39660
|
return times[0]?.raw ?? null;
|
|
39661
39661
|
}
|
|
39662
|
+
function commandReasonCodes(commands) {
|
|
39663
|
+
const codes = /* @__PURE__ */ new Set();
|
|
39664
|
+
for (const command of commands) {
|
|
39665
|
+
if (command.reason_code) codes.add(String(command.reason_code));
|
|
39666
|
+
for (const reasonCode of toArray2(command.check_reason_codes)) {
|
|
39667
|
+
if (reasonCode) codes.add(String(reasonCode));
|
|
39668
|
+
}
|
|
39669
|
+
}
|
|
39670
|
+
return Array.from(codes);
|
|
39671
|
+
}
|
|
39672
|
+
function syntheticStatusFromCommands(commands) {
|
|
39673
|
+
const commandReasons = commandReasonCodes(commands);
|
|
39674
|
+
const failed = commands.find((command) => {
|
|
39675
|
+
const status = String(command.status || "").toLowerCase();
|
|
39676
|
+
return status === "fail" || typeof command.exit_code === "number" && command.exit_code !== 0 && status !== "hold";
|
|
39677
|
+
});
|
|
39678
|
+
if (failed) {
|
|
39679
|
+
return {
|
|
39680
|
+
status: "fail",
|
|
39681
|
+
reasonCode: String(failed.reason_code || commandReasons[0] || "external_agent_command_failed")
|
|
39682
|
+
};
|
|
39683
|
+
}
|
|
39684
|
+
const held = commands.find((command) => String(command.status || "").toLowerCase() === "hold");
|
|
39685
|
+
if (held) {
|
|
39686
|
+
return {
|
|
39687
|
+
status: "hold",
|
|
39688
|
+
reasonCode: String(held.reason_code || commandReasons[0] || "external_agent_command_held")
|
|
39689
|
+
};
|
|
39690
|
+
}
|
|
39691
|
+
if (commands.length === 0) {
|
|
39692
|
+
return { status: "hold", reasonCode: "external_agent_capture_empty" };
|
|
39693
|
+
}
|
|
39694
|
+
return { status: "pass", reasonCode: null };
|
|
39695
|
+
}
|
|
39662
39696
|
function synthesizeRunFromCapture(runPath) {
|
|
39663
39697
|
const runDir = (0, import_path15.dirname)(runPath);
|
|
39664
39698
|
const commands = collapseCommandRecords(readNdjson((0, import_path15.join)(runDir, "commands.ndjson")));
|
|
39665
39699
|
const metadata = asObject((0, import_fs16.existsSync)((0, import_path15.join)(runDir, "external-agent-metadata.json")) ? readJson((0, import_path15.join)(runDir, "external-agent-metadata.json")) : {});
|
|
39666
39700
|
const blockerCodes = toArray2(metadata?.blocker_reason_codes).map(String).filter(Boolean);
|
|
39667
|
-
const
|
|
39701
|
+
const commandClassification = syntheticStatusFromCommands(commands);
|
|
39702
|
+
const status = commandClassification.status === "fail" ? "fail" : blockerCodes.length > 0 ? "hold" : commandClassification.status;
|
|
39703
|
+
const reasonCode = commandClassification.status === "fail" ? commandClassification.reasonCode : blockerCodes[0] || commandClassification.reasonCode;
|
|
39668
39704
|
const firstCommand = commands[0] || {};
|
|
39669
39705
|
const startedAt = firstCommandTime(commands) || (/* @__PURE__ */ new Date(0)).toISOString();
|
|
39670
39706
|
const endedAt = latestCommandTime(commands) || startedAt;
|
|
39671
|
-
const status = blockerCodes.length > 0 ? "hold" : "pass";
|
|
39672
39707
|
const docs = toArray2(metadata?.docs_pages_used).map(String).filter(Boolean);
|
|
39673
39708
|
const runId = (0, import_path15.dirname)(runPath).split(/[\\/]/).filter(Boolean).slice(-3).join("-") || "capture-only-run";
|
|
39674
39709
|
return {
|
|
39675
39710
|
schema_version: "external_agent_run.v1",
|
|
39676
39711
|
run_id: runId,
|
|
39677
39712
|
status,
|
|
39678
|
-
failure_reason_code: status === "pass" ? null :
|
|
39713
|
+
failure_reason_code: status === "pass" ? null : reasonCode || "external_agent_capture_unfinalized",
|
|
39679
39714
|
model_provider: "unknown",
|
|
39680
39715
|
model_name: "unknown",
|
|
39681
39716
|
prompt_version: String(firstCommand.prompt_version || "unknown"),
|
|
@@ -39872,7 +39907,7 @@ function summarizeExternalAgentRuns(options) {
|
|
|
39872
39907
|
for (const page of toArray2(artifactSummary.docs_pages_observed)) increment(docsCounts, page);
|
|
39873
39908
|
}
|
|
39874
39909
|
const topFailures = ranked(failureCounts);
|
|
39875
|
-
const
|
|
39910
|
+
const commandReasonCodes2 = ranked(commandReasonCounts);
|
|
39876
39911
|
const recommendedFixes = topFailures.map((failure) => ({
|
|
39877
39912
|
reason_code: failure.key,
|
|
39878
39913
|
count: failure.count,
|
|
@@ -39900,7 +39935,7 @@ function summarizeExternalAgentRuns(options) {
|
|
|
39900
39935
|
missing_completion_count: missingCompletionCount,
|
|
39901
39936
|
commands_with_duration_count: commandsWithDurationCount,
|
|
39902
39937
|
total_command_duration_ms: totalCommandDurationMs,
|
|
39903
|
-
command_reason_codes:
|
|
39938
|
+
command_reason_codes: commandReasonCodes2,
|
|
39904
39939
|
slow_steps: slowSteps.sort((a, b) => Number(b.duration_ms || 0) - Number(a.duration_ms || 0) || String(a.command || "").localeCompare(String(b.command || ""))).slice(0, 20)
|
|
39905
39940
|
},
|
|
39906
39941
|
codex_telemetry: {
|
|
@@ -39974,11 +40009,11 @@ function classifyExternalAgentRun(input) {
|
|
|
39974
40009
|
if (observedVersions.some((version2) => version2 !== CLI_VERSION)) {
|
|
39975
40010
|
return { status: "hold", reasonCode: "external_agent_cli_version_drift" };
|
|
39976
40011
|
}
|
|
39977
|
-
const
|
|
40012
|
+
const commandReasonCodes2 = completedCommands.flatMap((record2) => [
|
|
39978
40013
|
String(record2.reason_code || ""),
|
|
39979
40014
|
...Array.isArray(record2.check_reason_codes) ? record2.check_reason_codes.map((code) => String(code || "")) : []
|
|
39980
40015
|
]).filter(Boolean);
|
|
39981
|
-
const hasCommandReason = (pattern) =>
|
|
40016
|
+
const hasCommandReason = (pattern) => commandReasonCodes2.some((reason) => pattern.test(reason));
|
|
39982
40017
|
if (hasCommandReason(new RegExp(PAID_RESOURCE_BLOCKED_REASON_CODE, "i"))) {
|
|
39983
40018
|
return { status: "hold", reasonCode: PAID_RESOURCE_BLOCKED_REASON_CODE };
|
|
39984
40019
|
}
|
package/package.json
CHANGED
|
@@ -1,42 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
"name": "@f-o-h/cli",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "FOH CLI - AI-operator provisioning tool for Front Of House",
|
|
5
|
-
"license": "UNLICENSED",
|
|
6
|
-
"bin": {
|
|
7
|
-
"foh": "dist/foh.js"
|
|
8
|
-
},
|
|
9
|
-
"main": "dist/foh.js",
|
|
10
|
-
"files": [
|
|
11
|
-
"dist/",
|
|
12
|
-
"examples/",
|
|
13
|
-
"schemas/",
|
|
14
|
-
"README.md",
|
|
15
|
-
"package.json"
|
|
16
|
-
],
|
|
17
|
-
"publishConfig": {
|
|
18
|
-
"access": "public"
|
|
19
|
-
},
|
|
20
|
-
"engines": {
|
|
21
|
-
"node": ">=18"
|
|
22
|
-
},
|
|
23
|
-
"scripts": {
|
|
24
|
-
"build": "node build.mjs",
|
|
25
|
-
"test": "vitest run",
|
|
26
|
-
"typecheck": "tsc --noEmit"
|
|
27
|
-
},
|
|
28
|
-
"dependencies": {
|
|
29
|
-
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
30
|
-
"commander": "^12.1.0",
|
|
31
|
-
"js-yaml": "^4.1.1",
|
|
32
|
-
"picocolors": "^1.1.1",
|
|
33
|
-
"zod": "^4.3.6"
|
|
34
|
-
},
|
|
35
|
-
"devDependencies": {
|
|
36
|
-
"@types/js-yaml": "^4.0.9",
|
|
37
|
-
"@types/node": "^22.0.0",
|
|
38
|
-
"esbuild": "^0.24.0",
|
|
39
|
-
"vitest": "^2.0.0"
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@f-o-h/cli",
|
|
3
|
+
"version": "0.1.73",
|
|
4
|
+
"description": "FOH CLI - AI-operator provisioning tool for Front Of House",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"bin": {
|
|
7
|
+
"foh": "dist/foh.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "dist/foh.js",
|
|
10
|
+
"files": [
|
|
11
|
+
"dist/",
|
|
12
|
+
"examples/",
|
|
13
|
+
"schemas/",
|
|
14
|
+
"README.md",
|
|
15
|
+
"package.json"
|
|
16
|
+
],
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=18"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "node build.mjs",
|
|
25
|
+
"test": "vitest run",
|
|
26
|
+
"typecheck": "tsc --noEmit"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
30
|
+
"commander": "^12.1.0",
|
|
31
|
+
"js-yaml": "^4.1.1",
|
|
32
|
+
"picocolors": "^1.1.1",
|
|
33
|
+
"zod": "^4.3.6"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/js-yaml": "^4.0.9",
|
|
37
|
+
"@types/node": "^22.0.0",
|
|
38
|
+
"esbuild": "^0.24.0",
|
|
39
|
+
"vitest": "^2.0.0"
|
|
40
|
+
}
|
|
41
|
+
}
|