@f-o-h/cli 0.1.39 → 0.1.41

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/dist/foh.js +77 -10
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -4,7 +4,7 @@ AI-operator provisioning CLI for Front Of House.
4
4
 
5
5
  Public mirror: https://github.com/iiko38/front-of-house-cli
6
6
 
7
- Current published baseline: `@f-o-h/cli@0.1.39`
7
+ Current published baseline: `@f-o-h/cli@0.1.40`
8
8
 
9
9
  This mirror is a generated release artifact. The private product monorepo is not
10
10
  published here, and no open-source license is granted unless stated separately.
package/dist/foh.js CHANGED
@@ -14341,6 +14341,31 @@ function boundedInt(value, params) {
14341
14341
  if (!Number.isFinite(parsed)) return params.fallback;
14342
14342
  return Math.max(params.min, Math.min(params.max, Math.trunc(parsed)));
14343
14343
  }
14344
+ function certModeFlag(mode) {
14345
+ if (mode === "full") return ["--full"];
14346
+ if (mode === "stress") return ["--stress"];
14347
+ return [];
14348
+ }
14349
+ function buildCertificationFailureCommands(params) {
14350
+ const modeFlags = certModeFlag(params.certMode);
14351
+ const orgFlags = params.orgId ? ["--org", params.orgId] : [];
14352
+ const scenarioFlags = params.topBlocker?.scenario_id ? ["--scenario-ids", params.topBlocker.scenario_id] : [];
14353
+ const command = [
14354
+ "foh",
14355
+ "sim",
14356
+ "certify-loop",
14357
+ "--agent",
14358
+ params.agentId,
14359
+ ...orgFlags,
14360
+ ...modeFlags,
14361
+ ...scenarioFlags,
14362
+ "--json"
14363
+ ].join(" ");
14364
+ return [
14365
+ command,
14366
+ `foh bug improve --from external-agent-run --file <run_dir>/run.json --json`
14367
+ ];
14368
+ }
14344
14369
  function resolveCertifiedPublishOptions(opts) {
14345
14370
  const rawMode = String(opts.certMode || "quick").toLowerCase();
14346
14371
  const certMode = normalizeAgentCertMode(rawMode);
@@ -14392,10 +14417,22 @@ async function validateCertifyAndPublishAgent(opts) {
14392
14417
  const certificate = certification.certificate;
14393
14418
  if (!certification.ok || !certification.overall_pass || !certificate) {
14394
14419
  const topBlocker = certificate?.blockers?.[0];
14420
+ const blockerLabel = topBlocker?.invariant && topBlocker?.scenario_id ? `${topBlocker.invariant} in ${topBlocker.scenario_id}` : "unknown";
14421
+ const nextCommands = buildCertificationFailureCommands({
14422
+ agentId: opts.agentId,
14423
+ orgId: opts.orgId,
14424
+ certMode,
14425
+ topBlocker
14426
+ });
14395
14427
  throw new FohError({
14396
14428
  step: "agent.publish",
14397
- error: `Simulation certification failed before publish: ${certificate?.scenario_summary?.failed ?? "unknown"}/${certificate?.scenario_summary?.total ?? "unknown"} scenario(s) failed.`,
14398
- remediation: topBlocker?.suggested_fix ?? certificate?.recommendations?.[0] ?? `Run: foh sim certify-loop --agent ${opts.agentId} --${certMode === "quick" ? "full" : certMode} for detailed output.`,
14429
+ error: `Simulation certification failed before publish: ${certificate?.scenario_summary?.failed ?? "unknown"}/${certificate?.scenario_summary?.total ?? "unknown"} scenario(s) failed. Top blocker: ${blockerLabel}.`,
14430
+ remediation: [
14431
+ topBlocker?.suggested_fix ?? certificate?.recommendations?.[0] ?? "Fix the top simulation blocker before publishing.",
14432
+ `Re-run: ${nextCommands[0]}`
14433
+ ].filter(Boolean).join(" "),
14434
+ reasonCode: "simulation_certification_failed",
14435
+ nextCommands,
14399
14436
  detail: {
14400
14437
  certification,
14401
14438
  top_blocker: topBlocker ?? null
@@ -32764,7 +32801,7 @@ var StdioServerTransport = class {
32764
32801
  };
32765
32802
 
32766
32803
  // src/lib/cli-version.ts
32767
- var CLI_VERSION = "0.1.39";
32804
+ var CLI_VERSION = "0.1.41";
32768
32805
 
32769
32806
  // src/commands/mcp-serve.ts
32770
32807
  var DEFAULT_TIMEOUT_MS = 12e4;
@@ -39017,7 +39054,13 @@ function resolveCodexExecutionCommand() {
39017
39054
  }
39018
39055
  function validateCodexRunner(options) {
39019
39056
  if (options.skipRunnerProbe) {
39020
- return { binaryChecked: false, requiredFlagsChecked: false };
39057
+ return {
39058
+ binaryChecked: false,
39059
+ requiredFlagsChecked: false,
39060
+ automationMode: "ask-for-approval-never",
39061
+ globalArgs: ["--ask-for-approval", "never"],
39062
+ execArgs: []
39063
+ };
39021
39064
  }
39022
39065
  const probe = options.runnerProbe ?? defaultRunnerProbe;
39023
39066
  const probeCommand = resolveCodexProbeCommand();
@@ -39029,26 +39072,48 @@ function validateCodexRunner(options) {
39029
39072
  if (help.error || help.status !== 0) {
39030
39073
  throw new ExternalAgentExecutorError("external_agent_runner_help_unavailable", "Codex runner probe failed: `codex exec --help` did not exit 0.");
39031
39074
  }
39032
- const helpText = `${help.stdout}
39075
+ const execHelpText = `${help.stdout}
39033
39076
  ${help.stderr}`;
39034
- const requiredFlags = [
39077
+ const rootHelp = probe(probeCommand, ["--help"]);
39078
+ const rootHelpText = `${rootHelp.stdout}
39079
+ ${rootHelp.stderr}`;
39080
+ const commonExecFlags = [
39035
39081
  "--cd",
39036
39082
  "--skip-git-repo-check",
39037
39083
  "--ephemeral",
39038
39084
  "--ignore-rules",
39039
39085
  "--sandbox",
39040
- "--full-auto",
39041
39086
  "--json",
39042
39087
  "--output-last-message"
39043
39088
  ];
39044
- const missing = requiredFlags.filter((flag) => !helpText.includes(flag));
39089
+ const missing = commonExecFlags.filter((flag) => !execHelpText.includes(flag));
39090
+ const supportsLegacyFullAuto = execHelpText.includes("--full-auto");
39091
+ const supportsModernApprovalMode = rootHelp.status === 0 && rootHelpText.includes("--ask-for-approval");
39092
+ if (!supportsLegacyFullAuto && !supportsModernApprovalMode) {
39093
+ missing.push("--full-auto or --ask-for-approval");
39094
+ }
39045
39095
  if (missing.length > 0) {
39046
39096
  throw new ExternalAgentExecutorError(
39047
39097
  "external_agent_runner_required_flags_missing",
39048
39098
  `Codex runner is missing required exec flag(s): ${missing.join(", ")}`
39049
39099
  );
39050
39100
  }
39051
- return { binaryChecked: true, requiredFlagsChecked: true };
39101
+ if (supportsModernApprovalMode) {
39102
+ return {
39103
+ binaryChecked: true,
39104
+ requiredFlagsChecked: true,
39105
+ automationMode: "ask-for-approval-never",
39106
+ globalArgs: ["--ask-for-approval", "never"],
39107
+ execArgs: []
39108
+ };
39109
+ }
39110
+ return {
39111
+ binaryChecked: true,
39112
+ requiredFlagsChecked: true,
39113
+ automationMode: "full-auto",
39114
+ globalArgs: [],
39115
+ execArgs: ["--full-auto"]
39116
+ };
39052
39117
  }
39053
39118
  function normalizeCodexSandboxBackend(value) {
39054
39119
  const normalized = (value || "default").trim().toLowerCase();
@@ -39138,6 +39203,7 @@ function createExternalAgentExecutorPlan(options) {
39138
39203
  const runPath = (0, import_path12.join)(runDir, "run.json");
39139
39204
  const artifactSafetyPath = (0, import_path12.join)(runDir, "artifact-safety.json");
39140
39205
  const args = [
39206
+ ...runnerProbe.globalArgs,
39141
39207
  "exec",
39142
39208
  ...codexConfigArgs({ backend: codexSandboxBackend, networkAccess: codexNetworkAccess }),
39143
39209
  "--cd",
@@ -39147,7 +39213,7 @@ function createExternalAgentExecutorPlan(options) {
39147
39213
  "--ignore-rules",
39148
39214
  "--sandbox",
39149
39215
  "workspace-write",
39150
- "--full-auto",
39216
+ ...runnerProbe.execArgs,
39151
39217
  "--json",
39152
39218
  "--output-last-message",
39153
39219
  lastMessagePath,
@@ -39193,6 +39259,7 @@ function createExternalAgentExecutorPlan(options) {
39193
39259
  binary_checked: runnerProbe.binaryChecked,
39194
39260
  required_flags_checked: runnerProbe.requiredFlagsChecked
39195
39261
  },
39262
+ codex_automation_mode: runnerProbe.automationMode,
39196
39263
  codex_sandbox_backend: codexSandboxBackend,
39197
39264
  codex_network_access: codexNetworkAccess
39198
39265
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@f-o-h/cli",
3
- "version": "0.1.39",
3
+ "version": "0.1.41",
4
4
  "description": "FOH CLI - AI-operator provisioning tool for Front Of House",
5
5
  "license": "UNLICENSED",
6
6
  "bin": {