@f-o-h/cli 0.1.64 → 0.1.65

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 (2) hide show
  1. package/dist/foh.js +36 -2
  2. package/package.json +1 -1
package/dist/foh.js CHANGED
@@ -32877,7 +32877,7 @@ var StdioServerTransport = class {
32877
32877
  };
32878
32878
 
32879
32879
  // src/lib/cli-version.ts
32880
- var CLI_VERSION = "0.1.64";
32880
+ var CLI_VERSION = "0.1.65";
32881
32881
 
32882
32882
  // src/commands/mcp-serve.ts
32883
32883
  var DEFAULT_TIMEOUT_MS = 12e4;
@@ -34567,6 +34567,32 @@ function isAgentLimitReachedError(error2) {
34567
34567
  function shouldReuseSingleAgentForEval() {
34568
34568
  return Boolean(process.env.FOH_EXTERNAL_AGENT_RUN_DIR) && isNoSpendPolicy();
34569
34569
  }
34570
+ async function rebaseEvalAgentDraftFromTemplate(params) {
34571
+ const preview = await apiFetch(`/v1/console/templates/${params.templateId}`, {
34572
+ orgId: params.orgId,
34573
+ apiUrlOverride: params.apiUrlOverride
34574
+ });
34575
+ const draft = preview.template?.draft_config;
34576
+ if (!draft || typeof draft !== "object" || Array.isArray(draft)) {
34577
+ throw new FohError({
34578
+ step: "create_agent",
34579
+ error: "Template preview did not return a draft_config for eval reuse.",
34580
+ remediation: `Run: foh templates show --template ${params.templateId} --json, then retry setup.`,
34581
+ reasonCode: "eval_agent_template_rebase_failed"
34582
+ });
34583
+ }
34584
+ await apiFetch(`/v1/console/agents/${params.agentId}/draft`, {
34585
+ method: "PATCH",
34586
+ body: JSON.stringify({ ...draft, name: params.agentName }),
34587
+ orgId: params.orgId,
34588
+ apiUrlOverride: params.apiUrlOverride
34589
+ });
34590
+ return {
34591
+ template_rebased: true,
34592
+ template_id: params.templateId,
34593
+ draft_keys: Object.keys(draft).sort()
34594
+ };
34595
+ }
34570
34596
  function buildMissingOptionsPlan(missing, opts) {
34571
34597
  const missingFlags = missing.map(optionNameToFlag);
34572
34598
  const signInUrl = buildConsoleSignInUrl(resolveConsoleBaseUrl(opts.consoleUrl));
@@ -34948,6 +34974,13 @@ function registerSetup(program3) {
34948
34974
  if (!(error2 instanceof FohError)) throw error2;
34949
34975
  if (isAgentLimitReachedError(error2) && shouldReuseSingleAgentForEval() && existingAgents.length === 1) {
34950
34976
  const reusable = existingAgents[0];
34977
+ const rebase = await rebaseEvalAgentDraftFromTemplate({
34978
+ agentId: reusable.id,
34979
+ agentName: opts.agentName,
34980
+ templateId: opts.agentTemplate,
34981
+ orgId: opts.org,
34982
+ apiUrlOverride: opts.apiUrl
34983
+ });
34951
34984
  agentId = reusable.id;
34952
34985
  return {
34953
34986
  step: "create_agent",
@@ -34959,7 +34992,8 @@ function registerSetup(program3) {
34959
34992
  desired_agent_name: opts.agentName,
34960
34993
  reused_agent_id: reusable.id,
34961
34994
  reused_agent_name: reusable.name,
34962
- operator_note: "External-agent no-spend eval reused the single existing agent instead of creating a second bronze-tier agent."
34995
+ ...rebase,
34996
+ operator_note: "External-agent no-spend eval reused the single existing agent and rebased its draft onto the requested template instead of creating a second bronze-tier agent."
34963
34997
  }
34964
34998
  };
34965
34999
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@f-o-h/cli",
3
- "version": "0.1.64",
3
+ "version": "0.1.65",
4
4
  "description": "FOH CLI - AI-operator provisioning tool for Front Of House",
5
5
  "license": "UNLICENSED",
6
6
  "bin": {