@rosthq/cli 0.7.18 → 0.7.19

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.
@@ -1 +1 @@
1
- {"version":3,"file":"command-manifest.d.ts","sourceRoot":"","sources":["../../src/generated/command-manifest.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAE3E,eAAO,MAAM,gBAAgB,EAAE,SAAS,oBAAoB,EAkN3D,CAAC"}
1
+ {"version":3,"file":"command-manifest.d.ts","sourceRoot":"","sources":["../../src/generated/command-manifest.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAE3E,eAAO,MAAM,gBAAgB,EAAE,SAAS,oBAAoB,EAoN3D,CAAC"}
package/dist/index.js CHANGED
@@ -38735,6 +38735,16 @@ var agentTurnExecutionBrainSchema = external_exports.enum([
38735
38735
  "claude-cli",
38736
38736
  "codex-cli"
38737
38737
  ]);
38738
+ var aicosCloudBrainPreferenceSchema = external_exports.enum(["managed", "byok"]);
38739
+ var aicosRunnerBrainPreferenceSchema = external_exports.enum(["claude-cli", "codex-cli"]);
38740
+ var aicosAnswerBrainSchema = external_exports.enum(["managed", "byok", "claude-cli", "codex-cli", "mcp-client"]);
38741
+ var aicosBrainSelectionSchema = external_exports.object({
38742
+ cloud: aicosCloudBrainPreferenceSchema.default("managed"),
38743
+ runner: aicosRunnerBrainPreferenceSchema.default("claude-cli"),
38744
+ mcp: external_exports.literal("mcp-client").default("mcp-client"),
38745
+ effective: aicosAnswerBrainSchema.default("managed"),
38746
+ label: external_exports.string().min(1).max(80).default("Managed cloud")
38747
+ }).strict();
38738
38748
  var agentTurnExecutionLaneSchema = external_exports.enum(["cloud", "mcp_session", "runner"]);
38739
38749
  var agentTurnExecutionSchema = external_exports.object({
38740
38750
  id: uuidSchema4,
@@ -38754,6 +38764,17 @@ var agentTurnExecutionSchema = external_exports.object({
38754
38764
  createdAt: external_exports.string().datetime({ offset: true }),
38755
38765
  updatedAt: external_exports.string().datetime({ offset: true })
38756
38766
  }).strict();
38767
+ var aicosPendingTurnSchema = external_exports.object({
38768
+ id: uuidSchema4,
38769
+ userMessageId: uuidSchema4,
38770
+ assistantMessageId: uuidSchema4.nullable(),
38771
+ lane: agentTurnExecutionLaneSchema,
38772
+ brain: agentTurnExecutionBrainSchema,
38773
+ status: agentTurnExecutionStatusSchema,
38774
+ linkedRunId: uuidSchema4.nullable(),
38775
+ interactiveDeadline: external_exports.string().datetime({ offset: true }),
38776
+ updatedAt: external_exports.string().datetime({ offset: true })
38777
+ }).strict();
38757
38778
  var aicosMessageRoleSchema = external_exports.enum(["user", "assistant", "tool", "system"]);
38758
38779
  var aicosActorKindSchema = external_exports.enum(["user", "agent", "system"]);
38759
38780
  var aicosSourceKindSchema = external_exports.enum([
@@ -38829,12 +38850,40 @@ var aicosCapabilitySnapshotSchema = external_exports.object({
38829
38850
  runnerReady: external_exports.boolean().default(false),
38830
38851
  laneReadiness: aicosLaneReadinessSchema.default(defaultLaneReadiness),
38831
38852
  model: aicosModelSelectionSchema,
38853
+ brainSelection: aicosBrainSelectionSchema.default({
38854
+ cloud: "managed",
38855
+ runner: "claude-cli",
38856
+ mcp: "mcp-client",
38857
+ effective: "managed",
38858
+ label: "Managed cloud"
38859
+ }),
38832
38860
  // Null/absent in company/general mode; set only for an authorized seat-scoped session.
38833
38861
  seatScope: aicosSeatScopeSchema.nullable().optional()
38834
38862
  }).strict();
38835
38863
  var aicosLaneSettingsRequestSchema = external_exports.object({
38836
- lane: aicosLaneSchema
38864
+ lane: aicosLaneSchema,
38865
+ cloudBrain: aicosCloudBrainPreferenceSchema.optional(),
38866
+ runnerBrain: aicosRunnerBrainPreferenceSchema.optional()
38837
38867
  }).strict();
38868
+ var aicosBrainSettingsSchema = external_exports.object({
38869
+ lane: aicosLaneSchema,
38870
+ cloud_brain: aicosCloudBrainPreferenceSchema,
38871
+ runner_brain: aicosRunnerBrainPreferenceSchema,
38872
+ effective_brain: aicosAnswerBrainSchema,
38873
+ label: external_exports.string().min(1).max(80)
38874
+ }).strict();
38875
+ var aicosBrainSettingsGetInputSchema = external_exports.object({}).strict();
38876
+ var aicosBrainSettingsGetOutputSchema = external_exports.object({
38877
+ aicos: aicosBrainSettingsSchema
38878
+ }).strict();
38879
+ var aicosBrainSettingsUpdateInputSchema = external_exports.object({
38880
+ lane: aicosLaneSchema.optional(),
38881
+ cloud_brain: aicosCloudBrainPreferenceSchema.optional(),
38882
+ runner_brain: aicosRunnerBrainPreferenceSchema.optional()
38883
+ }).strict().refine(
38884
+ (value) => value.lane !== void 0 || value.cloud_brain !== void 0 || value.runner_brain !== void 0,
38885
+ "At least one AICOS lane or brain setting must be provided."
38886
+ );
38838
38887
  var aicosSessionSchema = external_exports.object({
38839
38888
  id: uuidSchema4,
38840
38889
  title: external_exports.string().min(1),
@@ -38854,6 +38903,7 @@ var aicosMessageSchema = external_exports.object({
38854
38903
  contentText: external_exports.string(),
38855
38904
  routeContext: jsonObjectSchema,
38856
38905
  onboardingContext: jsonObjectSchema,
38906
+ metadata: jsonObjectSchema.default({}),
38857
38907
  linkedRunId: uuidSchema4.nullable(),
38858
38908
  linkedWorkOrderId: uuidSchema4.nullable(),
38859
38909
  sourceCount: external_exports.number().int().nonnegative().default(0),
@@ -38882,6 +38932,7 @@ var aicosTurnResultSchema = external_exports.object({
38882
38932
  sources: external_exports.array(aicosSourceSchema).default([]),
38883
38933
  executionBackend: aicosLaneSchema,
38884
38934
  status: aicosTurnStatusSchema,
38935
+ pendingTurn: aicosPendingTurnSchema.nullable().default(null),
38885
38936
  userVisibleNextStep: external_exports.string().min(1),
38886
38937
  capabilitySnapshot: aicosCapabilitySnapshotSchema,
38887
38938
  context: aicosContextSummarySchema.optional()
@@ -43460,11 +43511,11 @@ The Compass is drafted, then activated by a human through supersession.
43460
43511
  order: 15,
43461
43512
  title: "AICOS chat guide",
43462
43513
  summary: "How the AI Chief of Staff chat works in the authenticated app shell and what it can safely do today.",
43463
- version: "2026-07-04.6",
43514
+ version: "2026-07-04.8",
43464
43515
  public: true,
43465
43516
  audiences: ["human", "in_app_agent"],
43466
43517
  stages: ["company_setup", "operating_rhythm"],
43467
- relatedCommandIds: ["confirmation.approve", "onboarding.status", "graph.get", "seat.get", "mcp_token.list", "runner.list"],
43518
+ relatedCommandIds: ["confirmation.approve", "onboarding.status", "graph.get", "seat.get", "mcp_token.list", "runner.list", "aicos.brain_settings.get", "aicos.brain_settings.update"],
43468
43519
  legal: {
43469
43520
  publicRisk: "low",
43470
43521
  notes: [
@@ -43514,6 +43565,8 @@ Each turn carries server-normalized page context: route template, current path,
43514
43565
 
43515
43566
  The current chat harness shows the effective lane and model. Cloud is the default and remains the enforced lane during onboarding, even if a post-onboarding lane has been selected. After onboarding, an owner or admin can select cloud, runner, or MCP only when the server says that lane is ready. Lane changes update the governed AICOS agent seat and write an append-only audit event; the browser never decides tenant authority or runner/MCP readiness.
43516
43567
 
43568
+ AICOS also has an explicit brain selection. Cloud can use the included managed allowance or a tenant Anthropic key (BYOK). Runner can target the paired machine's Claude subscription or Codex subscription. MCP is labeled as the MCP client. Read this selection with \`aicos.brain_settings.get\`; owners can update it with \`aicos.brain_settings.update\` (CLI flags: \`--lane\`, \`--cloud-brain managed|byok\`, \`--runner-brain claude-cli|codex-cli\`). BYOK requires an active tenant Anthropic key. Runner and MCP answers are labeled in the transcript and do not consume the managed cloud allowance.
43569
+
43517
43570
  Runner mode uses the same AICOS sessions and transcript. Interactive chat turns are tracked separately from scheduled work orders: each user message has one user-owned turn execution with a short deadline, so two users' chat messages cannot collapse into the same scheduled-work slot. Scheduled and Forge runner work still use work orders. Runner claim packets carry ids and execution metadata, not the user's free-text request. After claim, the local runner calls the governed AICOS context-load tool, which re-checks seat scope and returns the bounded transcript, session summary, route context, tenant clock, grounding text, and source counts authorized for that turn. The runner treats that loaded tenant clock and context as authoritative instead of substituting its own runtime clock or local files. A runner must be paired, execute-ready, and backed by the live AICOS agent before it can be selected.
43518
43571
 
43519
43572
  When a runner claims an interactive AICOS turn, the runner reports start and final result back to {{brand}}. The server appends exactly one assistant transcript message for the result, links that message to run evidence, and treats duplicate or late result reports as idempotent. If a queued, claimed, or running interactive turn passes its short deadline before a runner writes back, the turn is marked offline and the transcript receives a terminal assistant message instead of leaving a permanent "queued" placeholder.
@@ -43522,7 +43575,7 @@ MCP mode uses the existing tenant-authorized MCP surfaces. It requires an active
43522
43575
 
43523
43576
  Model behavior is now explicit in the AICOS session contract. A thread can run in **Auto** or use a pinned compatible model from the guided catalog. Auto chooses a fast tier for short low-risk turns, the balanced default for normal operating help, and a higher-reasoning tier for onboarding synthesis or large context. The panel shows the effective model, disables lower-context choices once the active thread outgrows them, and tells the user to start a new session for those models. Session context is estimated and maintained as a bounded rolling summary for memory search; when the thread crosses the configured threshold, that summary becomes the compacted context for future model calls rather than resending the whole thread. Raw messages remain in history. Summaries preserve durable decision cues, open questions, linked artifacts or objects, and unresolved setup facts where the transcript contains them.
43524
43577
 
43525
- Assistant answers render safe Markdown for headings, short lists, emphasis, code, tables, and in-app links. User messages remain plain escaped text. Links only become clickable when they target same-origin app routes such as \`/inbox\` or \`/settings\`; external, protocol, script, or API-style targets are not activated in the chat panel.
43578
+ Assistant answers render safe Markdown for headings, short lists, emphasis, code, tables, and in-app links. User messages remain plain escaped text. Links only become clickable when they target same-origin app routes such as \`/inbox\` or \`/settings\`; external, protocol, script, API-style, or traversal targets are stripped to plain text before transcript storage. When an answer includes a validated app route, the chat can surface one consent-required navigation suggestion and, if the user has enabled the local preference, open that route automatically. Navigation is never authorization; destination pages still enforce their own tenant, role, and seat checks.
43526
43579
 
43527
43580
  AICOS can also retrieve bounded summaries from prior sessions owned by the same tenant user and surface them as session-memory read models. Setup-limited users do not retrieve sensitive historical run or company-memory summaries through this path. This is a practical memory seam for AICOS continuity; it is not yet the future Company Brain, and it does not make unaccepted knowledge authoritative.
43528
43581
 
@@ -44339,7 +44392,7 @@ External connectors are being rolled out provider by provider, conservatively (r
44339
44392
  order: 48,
44340
44393
  title: "CLI and MCP installation guide",
44341
44394
  summary: "Install the public CLI, register remote token-backed MCP clients, and find the full command and tool catalog.",
44342
- version: "2026-07-03.14",
44395
+ version: "2026-07-03.15",
44343
44396
  public: true,
44344
44397
  audiences: ["human", "cli", "mcp", "in_app_agent"],
44345
44398
  stages: ["company_setup", "staffing"],
@@ -44988,6 +45041,8 @@ Several rows here are seat-operating commands (\`task.create\`, the \`signal.*\`
44988
45041
  | \`rost_update_product_learning_policy\` | \`settings.product_learning.update\` | Set product-learning mode. | Tenant-admin | Human-gated; call with \`{"mode":"enabled"}\`, \`{"mode":"disabled"}\`, or \`{"mode":"enterprise_contract"}\`. |
44989
45042
  | \`rost_get_company_autonomy_ceiling\` | \`settings.agent_policy.get\` | Read the company autonomy ceiling (Company Guardrails): profile, enforcement, and max_autonomous_risk. | Tenant | Call with \`{}\`; metadata only. |
44990
45043
  | \`rost_set_company_autonomy_ceiling\` | \`settings.agent_policy.update\` | Set the company autonomy ceiling. | Tenant-admin | Owner-only, human-gated; call with \`{"profile":"locked_down"}\` (or \`balanced\`/\`high_autonomy\`, or \`{"profile":"custom","max_autonomous_risk":"high"}\`). Enforced by default. |
45044
+ | \`rost_get_aicos_brain_settings\` | \`aicos.brain_settings.get\` | Read AICOS lane and brain labels for cloud managed/BYOK, runner Claude/Codex, and MCP client. | Tenant | Call with \`{}\`; returns enum labels only, never keys, vault refs, or runner secrets. |
45045
+ | \`rost_update_aicos_brain_settings\` | \`aicos.brain_settings.update\` | Update AICOS lane and cloud/runner brain preferences. | Tenant-admin | Owner-only and human-gated; call with \`{"lane":"runner","runner_brain":"codex-cli"}\` or \`{"cloud_brain":"byok"}\`. BYOK requires an active tenant Anthropic key. |
44991
45046
  | \`rost_list_signals\` | \`signal.list\` | List measurables with their latest reading and on/off-track state. | Seat or tenant-admin | Call with \`{}\` to find measurable ids. |
44992
45047
  | \`rost_get_signal\` | \`signal.get\` | Read a measurable with its full reading history. | Seat or tenant-admin | Call with \`{"measurable_id":"<id>"}\`. |
44993
45048
  | \`rost_confirm_signal_reading\` | \`signal.confirm_reading\` | Confirm an unconfirmed reading as human-verified. | Seat or tenant-admin | Humans confirm; call with \`{"reading_id":"<id>"}\`. |
@@ -46085,11 +46140,11 @@ Do not claim that a live charge happened unless Stripe test/live evidence proves
46085
46140
  order: 72,
46086
46141
  title: "Settings guide",
46087
46142
  summary: "How to use Settings as the control plane for company access, channels, providers, tokens, and operating defaults.",
46088
- version: "2026-07-03.1",
46143
+ version: "2026-07-03.2",
46089
46144
  public: true,
46090
46145
  audiences: ["human", "cli", "mcp", "in_app_agent"],
46091
46146
  stages: ["company_setup", "staffing"],
46092
- relatedCommandIds: ["onboarding.create_invite", "mcp_token.create", "mcp_token.revoke", "mcp_token.list", "integration.list", "integration.readiness", "integration.status", "integration.test", "settings.get", "settings.update", "tenant.rename", "settings.sync_brief_scope.get", "settings.sync_brief_scope.update", "settings.product_learning.get", "settings.product_learning.update", "settings.agent_policy.get", "settings.agent_policy.update"],
46147
+ relatedCommandIds: ["onboarding.create_invite", "mcp_token.create", "mcp_token.revoke", "mcp_token.list", "integration.list", "integration.readiness", "integration.status", "integration.test", "settings.get", "settings.update", "tenant.rename", "settings.sync_brief_scope.get", "settings.sync_brief_scope.update", "settings.product_learning.get", "settings.product_learning.update", "settings.agent_policy.get", "settings.agent_policy.update", "aicos.brain_settings.get", "aicos.brain_settings.update"],
46093
46148
  legal: { publicRisk: "low", notes: ["{{brand}}-native settings guidance."] },
46094
46149
  sources: [
46095
46150
  {
@@ -46164,6 +46219,7 @@ Agents that run on {{brand}}-managed inference draw against a tenant inference b
46164
46219
  - Set the hard cap with \`settings.update\` (CLI: \`{{cli}} settings update --hard-cap-usd <amount>\`). The optional soft cap warns before the hard cap and must be less than or equal to it.
46165
46220
  - The sandbox dry run is free and is never blocked by the cap, so a fresh company can charter, dry-run, and take an agent live before setting a budget. The cap applies only to real managed-inference runs.
46166
46221
  - A company that brings its own provider key (BYOK) is metered on that key and is not subject to the {{brand}}-managed hard cap. BYOK changes the provider account used for eligible cloud calls, not the Charter, tool guard, human gate, or data-retention posture; see the ai-model-data-handling-guide before making provider-handling claims.
46222
+ - AICOS cloud brain selection is managed with \`aicos.brain_settings.get\` and owner-gated \`aicos.brain_settings.update\`. Managed cloud answers draw from the included allowance; BYOK cloud answers meter against the tenant key. Runner Claude, Runner Codex, and MCP client answers are labeled separately and do not draw from the managed cloud allowance.
46167
46223
 
46168
46224
  ## Company autonomy ceiling (Company Guardrails)
46169
46225
 
@@ -48108,6 +48164,8 @@ var COMMAND_MANIFEST = [
48108
48164
  { "id": "agent.show_markdown", "namespace": "agent", "action": "show_markdown", "title": "Show agent setup as markdown", "description": "Compose a seat's agent setup, steward, model, tools, and Charter into a clean, human-skimmable markdown card for review.", "requiredScope": "tenant", "confirmation": "none", "exposeOverMcp": true, "fields": [{ "name": "seat_id", "flag": "seat-id", "type": "string", "required": true }], "hasComplexInput": false, "help": "Render a seat's agent setup, model, steward, tools, and Charter as a clean markdown card to show your human a quick review." },
48109
48165
  { "id": "agent.status", "namespace": "agent", "action": "status", "title": "Get agent status", "description": "Return the agent occupancy, lane, schedule, live/offline state, steward chain, dry-run result, and Runner availability for a seat.", "requiredScope": "seat", "confirmation": "none", "exposeOverMcp": true, "fields": [{ "name": "seat_id", "flag": "seat-id", "type": "string", "required": true }], "hasComplexInput": false, "help": "Check an agent's lane, live state, steward chain, dry-run result, and Runner availability before relying on it." },
48110
48166
  { "id": "agent.update_schedule", "namespace": "agent", "action": "update_schedule", "title": "Update agent schedule", "description": "Set or clear the scheduled execution cron for a draft or live agent on a seat.", "requiredScope": "tenant", "confirmation": "human_required", "exposeOverMcp": true, "fields": [{ "name": "seat_id", "flag": "seat-id", "type": "string", "required": true }, { "name": "schedule_cron", "flag": "schedule-cron", "type": "string", "required": true }], "hasComplexInput": false, "help": "Set or clear an agent's scheduled execution; a live scheduled agent must keep a steward chain resolving to a human." },
48167
+ { "id": "aicos.brain_settings.get", "namespace": "aicos", "action": "brain_settings.get", "title": "Get AICOS brain settings", "description": "Read the AICOS run lane and brain selection. Returns labels and enum settings only; no secrets or vault refs.", "requiredScope": "tenant", "confirmation": "none", "exposeOverMcp": true, "fields": [], "hasComplexInput": false, "help": "Read the AICOS lane and brain selection labels without returning provider keys, vault refs, or runner secrets." },
48168
+ { "id": "aicos.brain_settings.update", "namespace": "aicos", "action": "brain_settings.update", "title": "Update AICOS brain settings", "description": "Update the AICOS lane and cloud/runner brain preferences. Owner-only and audited.", "requiredScope": "tenant_admin", "confirmation": "human_required", "exposeOverMcp": true, "fields": [{ "name": "lane", "flag": "lane", "type": "enum", "required": false, "enumValues": ["cloud", "runner", "mcp"] }, { "name": "cloud_brain", "flag": "cloud-brain", "type": "enum", "required": false, "enumValues": ["managed", "byok"] }, { "name": "runner_brain", "flag": "runner-brain", "type": "enum", "required": false, "enumValues": ["claude-cli", "codex-cli"] }], "hasComplexInput": false, "help": "Owner-only update for AICOS cloud managed/BYOK and runner Claude/Codex preferences; BYOK requires an active tenant Anthropic key." },
48111
48169
  { "id": "cascade.import", "namespace": "cascade", "action": "import", "title": "Import Rocks from a ninety Rocks export", "description": "Bulk-import a ninety Rocks export into the Cascade as cycle goals under a company objective in the active cycle. Owners are seat names resolved to seats. Requires an active cycle and a target company objective (auto-selected when exactly one exists, else pass parent_objective_id). Idempotent \u2014 re-importing the same export is a no-op, and an existing cycle goal with the same objective + seat + title is skipped.", "requiredScope": "tenant_admin", "confirmation": "none", "exposeOverMcp": true, "fields": [{ "name": "dry_run", "flag": "dry-run", "type": "boolean", "required": false }, { "name": "parent_objective_id", "flag": "parent-objective-id", "type": "string", "required": false }], "hasComplexInput": true, "help": "Import a ninety Rocks export into the Cascade as cycle goals under a company objective in the active cycle; owners resolve to seats." },
48112
48170
  { "id": "charter.apply_seat_type_recommendation", "namespace": "charter", "action": "apply_seat_type_recommendation", "title": "Apply Charter seat-type recommendation", "description": "Apply the seat-type recommendation from a draft Charter.", "requiredScope": "seat", "confirmation": "human_required", "exposeOverMcp": true, "fields": [{ "name": "charter_version_id", "flag": "charter-version-id", "type": "string", "required": true }], "hasComplexInput": false, "help": "Apply seat-type recommendations only after the Charter clarifies work shape, risk, and Steward accountability." },
48113
48171
  { "id": "charter.approve", "namespace": "charter", "action": "approve", "title": "Approve charter", "description": "Approve a draft Charter as a human owner.", "requiredScope": "seat", "confirmation": "human_required", "exposeOverMcp": true, "fields": [{ "name": "seat_id", "flag": "seat-id", "type": "string", "required": false }, { "name": "charter_version_id", "flag": "charter-version-id", "type": "string", "required": false }, { "name": "apply_seat_type", "flag": "apply-seat-type", "type": "boolean", "required": false }], "hasComplexInput": true, "help": "Charter approval is a human decision that activates the seat's operating contract." },
@@ -50823,7 +50881,8 @@ ${usage()}
50823
50881
  let failed = false;
50824
50882
  let activeSessions = 0;
50825
50883
  do {
50826
- const capabilities = await detectCapabilities();
50884
+ const detectedCapabilities = await detectCapabilities();
50885
+ const capabilities = capabilitiesForConfiguredRuntime(detectedCapabilities, config2.runtime);
50827
50886
  try {
50828
50887
  const heartbeat = await post2(fetchImpl, options.appUrl, "/api/runner/heartbeat", {
50829
50888
  capabilities,
@@ -50928,6 +50987,19 @@ function effectiveExecutionRuntime(runtime, capabilities) {
50928
50987
  }
50929
50988
  return capabilities.claude.installed ? "claude" : null;
50930
50989
  }
50990
+ function capabilitiesForConfiguredRuntime(capabilities, runtime) {
50991
+ return {
50992
+ ...capabilities,
50993
+ claude: {
50994
+ ...capabilities.claude,
50995
+ installed: runtime === "codex" ? false : capabilities.claude.installed
50996
+ },
50997
+ codex: {
50998
+ ...capabilities.codex,
50999
+ installed: runtime === "codex" ? capabilities.codex.installed : false
51000
+ }
51001
+ };
51002
+ }
50931
51003
  function requiredValue(args, index) {
50932
51004
  const value = args[index + 1];
50933
51005
  if (value === void 0 || value.startsWith("--")) {
@@ -51085,12 +51157,16 @@ async function executeClaimedUnit(fetchImpl, appUrl2, state, io, runtime, input)
51085
51157
  if (started.status !== 200) {
51086
51158
  throw new Error(`${claimedUnitLabel(input.kind)} start failed ${started.status}: ${redactForLog(JSON.stringify(started.json))}`);
51087
51159
  }
51088
- const result = await runLocalTurn(appUrl2, input.item, runtime, input.kind);
51160
+ const turnRuntime = runtimeForClaimedUnit(input.item, runtime, input.kind);
51161
+ const result = turnRuntime ? await runLocalTurn(appUrl2, input.item, turnRuntime, input.kind) : {
51162
+ ok: false,
51163
+ summary: `Runner runtime ${runtime} cannot execute requested ${String(input.item.brain ?? "unknown")} turn.`
51164
+ };
51089
51165
  const reported = await post2(fetchImpl, appUrl2, input.resultPath(id), {
51090
51166
  status: result.ok ? "succeeded" : "failed",
51091
51167
  summary: result.summary,
51092
51168
  log_ref: input.logRef(id),
51093
- model: runtime === "codex" ? "codex-cli" : "claude-cli"
51169
+ model: (turnRuntime ?? runtime) === "codex" ? "codex-cli" : "claude-cli"
51094
51170
  }, state.runner_secret);
51095
51171
  if (reported.status !== 200) {
51096
51172
  throw new Error(`${claimedUnitLabel(input.kind)} result failed ${reported.status}: ${redactForLog(JSON.stringify(reported.json))}`);
@@ -51101,6 +51177,15 @@ async function executeClaimedUnit(fetchImpl, appUrl2, state, io, runtime, input)
51101
51177
  function claimedUnitLabel(kind) {
51102
51178
  return kind === "work_order" ? "work order" : "turn execution";
51103
51179
  }
51180
+ function runtimeForClaimedUnit(item, fallback, kind) {
51181
+ if (kind !== "turn_execution") {
51182
+ return fallback;
51183
+ }
51184
+ if (item.brain === "codex-cli") {
51185
+ return fallback === "codex" ? "codex" : null;
51186
+ }
51187
+ return fallback === "claude" ? "claude" : null;
51188
+ }
51104
51189
  function runLocalTurn(appUrl2, workOrder, runtime, kind) {
51105
51190
  return runtime === "codex" ? runCodexTurn(appUrl2, workOrder, kind) : runClaudeTurn(appUrl2, workOrder, kind);
51106
51191
  }