@f-o-h/cli 0.1.38 → 0.1.40

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 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.38`
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
@@ -9927,7 +9927,12 @@ function envelopeOk(status) {
9927
9927
  function dedupeCommands(commands = []) {
9928
9928
  return Array.from(new Set(commands.map((command) => String(command || "").trim()).filter(Boolean)));
9929
9929
  }
9930
+ function defaultSafeToRetry(status) {
9931
+ return !(status === "fail" || status === "blocked" || status === "hold");
9932
+ }
9930
9933
  function cliEnvelope(input) {
9934
+ const extra = input.extra ?? {};
9935
+ const artifacts = input.artifacts ?? {};
9931
9936
  return {
9932
9937
  schema_version: input.schemaVersion ?? "foh_cli_envelope.v1",
9933
9938
  ok: envelopeOk(input.status),
@@ -9936,9 +9941,13 @@ function cliEnvelope(input) {
9936
9941
  summary: input.summary,
9937
9942
  ids: input.ids ?? {},
9938
9943
  checks: input.checks ?? [],
9939
- artifacts: input.artifacts ?? {},
9944
+ artifacts,
9945
+ spend_class: input.spendClass ?? extra.spend_class ?? null,
9946
+ safe_to_retry: input.safeToRetry ?? extra.safe_to_retry ?? defaultSafeToRetry(input.status),
9947
+ proof_artifacts: input.proofArtifacts ?? extra.proof_artifacts ?? artifacts.proof_bundle ?? artifacts.proof_report ?? null,
9948
+ operator_note: input.operatorNote ?? extra.operator_note ?? null,
9940
9949
  next_commands: dedupeCommands(input.nextCommands),
9941
- ...input.extra ?? {}
9950
+ ...extra
9942
9951
  };
9943
9952
  }
9944
9953
  function reasonCodeFromStep(step, fallback = "cli_command_failed") {
@@ -14332,6 +14341,31 @@ function boundedInt(value, params) {
14332
14341
  if (!Number.isFinite(parsed)) return params.fallback;
14333
14342
  return Math.max(params.min, Math.min(params.max, Math.trunc(parsed)));
14334
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
+ }
14335
14369
  function resolveCertifiedPublishOptions(opts) {
14336
14370
  const rawMode = String(opts.certMode || "quick").toLowerCase();
14337
14371
  const certMode = normalizeAgentCertMode(rawMode);
@@ -14383,10 +14417,22 @@ async function validateCertifyAndPublishAgent(opts) {
14383
14417
  const certificate = certification.certificate;
14384
14418
  if (!certification.ok || !certification.overall_pass || !certificate) {
14385
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
+ });
14386
14427
  throw new FohError({
14387
14428
  step: "agent.publish",
14388
- error: `Simulation certification failed before publish: ${certificate?.scenario_summary?.failed ?? "unknown"}/${certificate?.scenario_summary?.total ?? "unknown"} scenario(s) failed.`,
14389
- 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,
14390
14436
  detail: {
14391
14437
  certification,
14392
14438
  top_blocker: topBlocker ?? null
@@ -32755,7 +32801,7 @@ var StdioServerTransport = class {
32755
32801
  };
32756
32802
 
32757
32803
  // src/lib/cli-version.ts
32758
- var CLI_VERSION = "0.1.38";
32804
+ var CLI_VERSION = "0.1.40";
32759
32805
 
32760
32806
  // src/commands/mcp-serve.ts
32761
32807
  var DEFAULT_TIMEOUT_MS = 12e4;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@f-o-h/cli",
3
- "version": "0.1.38",
3
+ "version": "0.1.40",
4
4
  "description": "FOH CLI - AI-operator provisioning tool for Front Of House",
5
5
  "license": "UNLICENSED",
6
6
  "bin": {
@@ -3,7 +3,7 @@
3
3
  "$id": "https://frontofhouse.okii.uk/schemas/cli-envelope.schema.json",
4
4
  "title": "FOH CLI Envelope",
5
5
  "type": "object",
6
- "required": ["schema_version", "ok", "status", "reason_code", "summary", "ids", "checks", "artifacts", "next_commands"],
6
+ "required": ["schema_version", "ok", "status", "reason_code", "summary", "ids", "checks", "artifacts", "spend_class", "safe_to_retry", "proof_artifacts", "operator_note", "next_commands"],
7
7
  "properties": {
8
8
  "schema_version": { "type": "string" },
9
9
  "ok": { "type": "boolean" },
@@ -13,6 +13,10 @@
13
13
  "ids": { "type": "object" },
14
14
  "checks": { "type": "array" },
15
15
  "artifacts": { "type": "object" },
16
+ "spend_class": { "type": ["string", "null"] },
17
+ "safe_to_retry": { "type": "boolean" },
18
+ "proof_artifacts": { "type": ["object", "string", "null"] },
19
+ "operator_note": { "type": ["string", "null"] },
16
20
  "next_commands": {
17
21
  "type": "array",
18
22
  "items": { "type": "string" }