@runtypelabs/cli 2.56.3 → 2.56.5

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/index.js +283 -254
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -135,7 +135,7 @@ const SURFACE_OUTBOUND_CREDENTIAL_KEYS = credentialKeysOf({
135
135
  smtpPassword: true
136
136
  });
137
137
  [.../* @__PURE__ */ new Set([...SURFACE_INBOUND_CREDENTIAL_KEYS, ...SURFACE_OUTBOUND_CREDENTIAL_KEYS])];
138
- // ../shared/dist/chunk-BP5cqd2d.mjs
138
+ // ../shared/dist/chunk-vz6TYCzg.mjs
139
139
  /** Every evaluation model the gateway lists, keyed by the gateway id a call names. */
140
140
  const GATEWAY_EVALUATION_MODELS = Object.freeze({
141
141
  "baseten/elephant-1": Object.freeze({
@@ -151,6 +151,19 @@ const GATEWAY_EVALUATION_MODELS = Object.freeze({
151
151
  outputPer1MTokens: 0
152
152
  })
153
153
  }),
154
+ "baseten/joey-1": Object.freeze({
155
+ id: "baseten/joey-1",
156
+ name: "Joey-1",
157
+ description: "Joey-1 is a 2B decision model from Baseten's Base Labs for classification, routing, and scoring. It evaluates text context against choice, yes/no, and ordered scoring questions, returning answer probabilities and confidence in a single forward pass without generating free-form text.",
158
+ contextWindow: 16384,
159
+ supportedSpecifications: Object.freeze(["v4"]),
160
+ pricing: Object.freeze({
161
+ inputPerToken: "0.00000001",
162
+ outputPerToken: "0",
163
+ inputPer1MTokens: .01,
164
+ outputPer1MTokens: 0
165
+ })
166
+ }),
154
167
  "baseten/mammoth-1": Object.freeze({
155
168
  id: "baseten/mammoth-1",
156
169
  name: "Mammoth-1",
@@ -171,22 +184,9 @@ const GATEWAY_EVALUATION_MODELS = Object.freeze({
171
184
  contextWindow: 8192,
172
185
  supportedSpecifications: Object.freeze(["v4"]),
173
186
  pricing: Object.freeze({
174
- inputPerToken: "0",
175
- outputPerToken: "0",
176
- inputPer1MTokens: 0,
177
- outputPer1MTokens: 0
178
- })
179
- }),
180
- "convaiinnovations/laya-free": Object.freeze({
181
- id: "convaiinnovations/laya-free",
182
- name: "Laya (Free)",
183
- description: "Laya is Convai Innovations’ System One evaluation model for fast, structured decisions. It evaluates shared state against choice, score, and yes/no questions and returns typed answers with probabilities in a single forward pass. It supports classification, routing, guardrail checks, and rubric-based assessment without generating free-form text.",
184
- contextWindow: 8192,
185
- supportedSpecifications: Object.freeze(["v4"]),
186
- pricing: Object.freeze({
187
- inputPerToken: "0",
187
+ inputPerToken: "0.0000000105",
188
188
  outputPerToken: "0",
189
- inputPer1MTokens: 0,
189
+ inputPer1MTokens: .0105,
190
190
  outputPer1MTokens: 0
191
191
  })
192
192
  }),
@@ -6471,7 +6471,7 @@ function date(params) {
6471
6471
  function number$1(params) {
6472
6472
  return /* @__PURE__ */ _coercedNumber(ZodNumber, params);
6473
6473
  }
6474
- // ../shared/dist/chunk-VCYa1mc5.mjs
6474
+ // ../shared/dist/chunk-7fo51oVg.mjs
6475
6475
  const judgmentJsonValueSchema = lazy(() => union([
6476
6476
  _null(),
6477
6477
  string$2(),
@@ -11498,7 +11498,7 @@ const transcriptToolCallSchema = object$4({
11498
11498
  const transcriptToolResultSchema = object$4({
11499
11499
  toolCallId: string$2().min(1).describe("Must answer a toolCalls entry issued earlier."),
11500
11500
  toolName: string$2().min(1),
11501
- result: unknown().describe("Whatever the tool returned."),
11501
+ result: unknown().default(null).describe("Whatever the tool returned."),
11502
11502
  providerOptions: record$2(string$2(), unknown()).optional()
11503
11503
  });
11504
11504
  const CONVERSATION_TRANSCRIPT_ROLES = [
@@ -11539,7 +11539,7 @@ object$4({
11539
11539
  externalId: string$2().min(1).max(500).optional().describe("The conversation id in the source system. Re-creating with the same system and externalId returns the existing conversation with imported: false instead of a duplicate."),
11540
11540
  importedAt: string$2().datetime({ offset: true }).optional()
11541
11541
  });
11542
- // ../shared/dist/chunk-Ckhkn6K-.mjs
11542
+ // ../shared/dist/chunk-BD17-E7U.mjs
11543
11543
  const voiceInterruptionModeSchema = _enum([
11544
11544
  "none",
11545
11545
  "cancel",
@@ -21152,6 +21152,25 @@ function finalize(r) {
21152
21152
  r.valid = r.errors.length === 0;
21153
21153
  return r;
21154
21154
  }
21155
+ /**
21156
+ * The setup mode a stored Claude Managed config is committed to. With no `setupMode`, a config that
21157
+ * names an `anthropicAgentId` is connect, which is how the FPO schema reads an omitted mode.
21158
+ * Returns undefined when the config commits to neither mode.
21159
+ */
21160
+ function resolveClaudeManagedSetupMode(stored) {
21161
+ if (!stored) return void 0;
21162
+ if (stored.setupMode === "create" || stored.setupMode === "connect") return stored.setupMode;
21163
+ const agentId = stored.anthropicAgentId;
21164
+ return typeof agentId === "string" && agentId.trim() ? "connect" : void 0;
21165
+ }
21166
+ /** Stable code for a create-mode Claude Managed config whose `mcpServers` are stored but never sent (#9588). */
21167
+ const CLAUDE_MANAGED_MCP_SERVERS_NOT_SENT_CODE = "CLAUDE_MANAGED_MCP_SERVERS_NOT_SENT";
21168
+ const CLAUDE_MANAGED_MCP_SERVERS_NOT_SENT_MESSAGE = "claudeManagedConfig.mcpServers is saved but not sent to Anthropic: Claude Managed agents do not connect Anthropic-native MCP servers yet. Add each MCP server as a Runtype tool instead (capabilities or config.tools.toolIds); Runtype tools reach the Anthropic agent as custom tools.";
21169
+ /** True when a create-mode config carries MCP servers Runtype will not send; connect mode never writes them. */
21170
+ function hasUnsentClaudeManagedMcpServers(config) {
21171
+ if (resolveClaudeManagedSetupMode(config) !== "create") return false;
21172
+ return Array.isArray(config?.mcpServers) && config.mcpServers.length > 0;
21173
+ }
21155
21174
  function getAgentSandboxCapabilityIssues(config) {
21156
21175
  if (!config || typeof config !== "object" || !("enabled" in config) || config.enabled !== true) return [];
21157
21176
  const sandbox = config;
@@ -21324,6 +21343,7 @@ function validateAgentDefinition(agent, capIndex) {
21324
21343
  const base = `capabilities[${capIndex}].agent`;
21325
21344
  if (!agent.name || agent.name.trim() === "") result.errors.push(createIssue("error", "AGENT_NAME_EMPTY", "Agent name is required", `${base}.name`));
21326
21345
  pushAgentTypeConfigMismatchIssues(agent, base, result);
21346
+ if (hasUnsentClaudeManagedMcpServers(agent.claudeManagedConfig)) result.warnings.push(createIssue("warning", CLAUDE_MANAGED_MCP_SERVERS_NOT_SENT_CODE, CLAUDE_MANAGED_MCP_SERVERS_NOT_SENT_MESSAGE, `${base}.claudeManagedConfig.mcpServers`));
21327
21347
  if (isNestedFpoAgent(agent)) {
21328
21348
  for (const issue of getAgentSandboxCapabilityIssues(agent.config?.sandbox)) result.errors.push(createIssue("error", issue.code, issue.message, `${base}.${issue.path}`, void 0, {
21329
21349
  requested: issue.requested,
@@ -24665,7 +24685,7 @@ _enum([
24665
24685
  "cancelled",
24666
24686
  "interrupted"
24667
24687
  ]);
24668
- // ../shared/dist/chunk-DA5hhace.mjs
24688
+ // ../shared/dist/chunk-22MoSt_7.mjs
24669
24689
  /**
24670
24690
  * Maps model families to provider-specific model IDs.
24671
24691
  * Use for routing: family + provider → exact model ID
@@ -24861,7 +24881,6 @@ const MODEL_FAMILY_PROVIDER_IDS = {
24861
24881
  "google": "gemini-3.5-flash",
24862
24882
  "vercel": "google/gemini-3.5-flash"
24863
24883
  },
24864
- "gemini-3-5-flash-batch": { "vercel": "google/gemini-3.5-flash-batch" },
24865
24884
  "gemini-3-5-flash-lite": {
24866
24885
  "google": "gemini-3.5-flash-lite",
24867
24886
  "vercel": "google/gemini-3.5-flash-lite"
@@ -24876,7 +24895,6 @@ const MODEL_FAMILY_PROVIDER_IDS = {
24876
24895
  "google": "gemini-3.7-flash",
24877
24896
  "vercel": "google/gemini-3.7-flash"
24878
24897
  },
24879
- "gemini-3-7-flash-batch": { "vercel": "google/gemini-3.7-flash-batch" },
24880
24898
  "gemini-3-8-flash": {
24881
24899
  "google": "gemini-3.8-flash",
24882
24900
  "vercel": "google/gemini-3.8-flash"
@@ -24914,7 +24932,6 @@ const MODEL_FAMILY_PROVIDER_IDS = {
24914
24932
  "google": "gemini-3.5-flash",
24915
24933
  "vercel": "google/gemini-3.5-flash"
24916
24934
  },
24917
- "gemini-3.5-flash-batch": { "vercel": "google/gemini-3.5-flash-batch" },
24918
24935
  "gemini-3.5-flash-lite": {
24919
24936
  "google": "gemini-3.5-flash-lite",
24920
24937
  "vercel": "google/gemini-3.5-flash-lite"
@@ -24929,7 +24946,6 @@ const MODEL_FAMILY_PROVIDER_IDS = {
24929
24946
  "google": "gemini-3.7-flash",
24930
24947
  "vercel": "google/gemini-3.7-flash"
24931
24948
  },
24932
- "gemini-3.7-flash-batch": { "vercel": "google/gemini-3.7-flash-batch" },
24933
24949
  "gemini-3.8-flash": {
24934
24950
  "google": "gemini-3.8-flash",
24935
24951
  "vercel": "google/gemini-3.8-flash"
@@ -24962,6 +24978,7 @@ const MODEL_FAMILY_PROVIDER_IDS = {
24962
24978
  "glm-5-3-fast": { "vercel": "zai/glm-5.3-fast" },
24963
24979
  "glm-5-3-flash": { "vercel": "zai/glm-5.3-flash" },
24964
24980
  "glm-5-3-flashx": { "vercel": "zai/glm-5.3-flashx" },
24981
+ "glm-5-3-flashx-legal": { "vercel": "zai/glm-5.3-flashx-legal" },
24965
24982
  "glm-5.2": { "vercel": "zai/glm-5.2" },
24966
24983
  "glm-5.2-fast": { "vercel": "zai/glm-5.2-fast" },
24967
24984
  "glm-5.3": {
@@ -24971,6 +24988,7 @@ const MODEL_FAMILY_PROVIDER_IDS = {
24971
24988
  "glm-5.3-fast": { "vercel": "zai/glm-5.3-fast" },
24972
24989
  "glm-5.3-flash": { "vercel": "zai/glm-5.3-flash" },
24973
24990
  "glm-5.3-flashx": { "vercel": "zai/glm-5.3-flashx" },
24991
+ "glm-5.3-flashx-legal": { "vercel": "zai/glm-5.3-flashx-legal" },
24974
24992
  "gpt-4-1": {
24975
24993
  "openai": "gpt-4.1",
24976
24994
  "vercel": "openai/gpt-4.1"
@@ -25291,8 +25309,6 @@ const MODEL_FAMILY_PROVIDER_IDS = {
25291
25309
  "vercel": "spacexai/grok-build-0.1",
25292
25310
  "xai": "grok-build-0.1"
25293
25311
  },
25294
- "grok-voice-think-fast-2-0": { "vercel": "spacexai/grok-voice-think-fast-2.0" },
25295
- "grok-voice-think-fast-2.0": { "vercel": "spacexai/grok-voice-think-fast-2.0" },
25296
25312
  "hy-mt2-lite": { "vercel": "tencent/hy-mt2-lite" },
25297
25313
  "hy-mt2-plus": { "vercel": "tencent/hy-mt2-plus" },
25298
25314
  "hy-mt2-pro": { "vercel": "tencent/hy-mt2-pro" },
@@ -25316,27 +25332,27 @@ const MODEL_FAMILY_PROVIDER_IDS = {
25316
25332
  "kimi-k3.1-pro": { "vercel": "moonshotai/kimi-k3.1-pro" },
25317
25333
  "kimi-k3.1-pro-highspeed": { "vercel": "moonshotai/kimi-k3.1-pro-highspeed" },
25318
25334
  "laguna-s-2-1": { "vercel": "poolside/laguna-s-2.1" },
25319
- "laguna-s-2-1-free": { "vercel": "poolside/laguna-s-2.1-free" },
25320
25335
  "laguna-s-2.1": { "vercel": "poolside/laguna-s-2.1" },
25321
- "laguna-s-2.1-free": { "vercel": "poolside/laguna-s-2.1-free" },
25322
25336
  "lfm2-5-24b-a2b": { "vercel": "liquid/lfm2.5-24b-a2b" },
25323
25337
  "lfm2.5-24b-a2b": { "vercel": "liquid/lfm2.5-24b-a2b" },
25324
25338
  "ling-3-0-flash": { "vercel": "inclusionai/ling-3.0-flash" },
25325
25339
  "ling-3-0-flash-sante": { "vercel": "inclusionai/ling-3.0-flash-sante" },
25326
25340
  "ling-3-0-flash-vl": { "vercel": "inclusionai/ling-3.0-flash-vl" },
25327
25341
  "ling-3-1-flash": { "vercel": "inclusionai/ling-3.1-flash" },
25342
+ "ling-3-1-flash-1019": { "vercel": "inclusionai/ling-3.1-flash-1019" },
25328
25343
  "ling-3.0-flash": { "vercel": "inclusionai/ling-3.0-flash" },
25329
25344
  "ling-3.0-flash-sante": { "vercel": "inclusionai/ling-3.0-flash-sante" },
25330
25345
  "ling-3.0-flash-vl": { "vercel": "inclusionai/ling-3.0-flash-vl" },
25331
25346
  "ling-3.1-flash": { "vercel": "inclusionai/ling-3.1-flash" },
25347
+ "ling-3.1-flash-1019": { "vercel": "inclusionai/ling-3.1-flash-1019" },
25332
25348
  "llama-3.1-70b": { "vercel": "meta/llama-3.1-70b" },
25333
25349
  "llama-3.1-8b": { "vercel": "meta/llama-3.1-8b" },
25334
25350
  "llama-3.3-70b": { "vercel": "meta/llama-3.3-70b" },
25335
25351
  "llama3-1-70b": { "vercel": "meta/llama-3.1-70b" },
25336
25352
  "llama3-1-8b": { "vercel": "meta/llama-3.1-8b" },
25337
25353
  "llama3-3-70b": { "vercel": "meta/llama-3.3-70b" },
25338
- "longcat-2-5": { "vercel": "meituan/longcat-2.5-preview" },
25339
- "longcat-2.5-preview": { "vercel": "meituan/longcat-2.5-preview" },
25354
+ "longcat-2-5": { "vercel": "meituan/longcat-2.5" },
25355
+ "longcat-2.5": { "vercel": "meituan/longcat-2.5" },
25340
25356
  "lyria-3-clip": { "google": "lyria-3-clip-preview" },
25341
25357
  "lyria-3-clip-preview": { "google": "lyria-3-clip-preview" },
25342
25358
  "lyria-3-pro": { "google": "lyria-3-pro-preview" },
@@ -25346,13 +25362,9 @@ const MODEL_FAMILY_PROVIDER_IDS = {
25346
25362
  "mercury-2.5": { "vercel": "inception/mercury-2.5" },
25347
25363
  "mercury-3": { "vercel": "inception/mercury-3" },
25348
25364
  "mercury-coder-small": { "vercel": "inception/mercury-coder-small" },
25349
- "mimo-v2-5": { "vercel": "xiaomi/mimo-v2.5" },
25350
- "mimo-v2-5-pro": { "vercel": "xiaomi/mimo-v2.5-pro" },
25351
25365
  "mimo-v2-6-flash": { "vercel": "xiaomi/mimo-v2.6-flash" },
25352
25366
  "mimo-v2-6-pro": { "vercel": "xiaomi/mimo-v2.6-pro" },
25353
25367
  "mimo-v2-6-pro-ultraspeed": { "vercel": "xiaomi/mimo-v2.6-pro-ultraspeed" },
25354
- "mimo-v2.5": { "vercel": "xiaomi/mimo-v2.5" },
25355
- "mimo-v2.5-pro": { "vercel": "xiaomi/mimo-v2.5-pro" },
25356
25368
  "mimo-v2.6-flash": { "vercel": "xiaomi/mimo-v2.6-flash" },
25357
25369
  "mimo-v2.6-pro": { "vercel": "xiaomi/mimo-v2.6-pro" },
25358
25370
  "mimo-v2.6-pro-ultraspeed": { "vercel": "xiaomi/mimo-v2.6-pro-ultraspeed" },
@@ -25404,6 +25416,7 @@ const MODEL_FAMILY_PROVIDER_IDS = {
25404
25416
  "nova-lite": { "vercel": "amazon/nova-lite" },
25405
25417
  "nova-micro": { "vercel": "amazon/nova-micro" },
25406
25418
  "nova-pro": { "vercel": "amazon/nova-pro" },
25419
+ "particle-1": { "vercel": "particle/particle-1" },
25407
25420
  "qwen-3-14b": { "vercel": "alibaba/qwen-3-14b" },
25408
25421
  "qwen-3-235b": { "vercel": "alibaba/qwen-3-235b" },
25409
25422
  "qwen-3-30b": { "vercel": "alibaba/qwen-3-30b" },
@@ -25482,9 +25495,7 @@ const MODEL_FAMILY_PROVIDER_IDS = {
25482
25495
  "text-embedding-3-large": { "openai": "text-embedding-3-large" },
25483
25496
  "text-embedding-3-small": { "openai": "text-embedding-3-small" },
25484
25497
  "text-embedding-ada-002": { "openai": "text-embedding-ada-002" },
25485
- "toast-1": { "vercel": "mixedbread/toast-1" },
25486
- "trinity-large": { "vercel": "arcee-ai/trinity-large-thinking" },
25487
- "trinity-large-thinking": { "vercel": "arcee-ai/trinity-large-thinking" }
25498
+ "toast-1": { "vercel": "mixedbread/toast-1" }
25488
25499
  };
25489
25500
  new Set(Object.entries({
25490
25501
  "mixlayer": true,
@@ -25770,7 +25781,7 @@ const CREATOR_TO_PROVIDER = {
25770
25781
  "xiaomi": "vercel",
25771
25782
  "unknown": "openai"
25772
25783
  };
25773
- // ../shared/dist/chunk-Dq3RIWqI.mjs
25784
+ // ../shared/dist/chunk-Dga31wP2.mjs
25774
25785
  const DEFAULT_GENERIC_OPENAI_API_FORMAT = "chat-completions";
25775
25786
  /** Provider defaults shared by every execution engine and deploy guidance. */
25776
25787
  const DEFAULT_BEDROCK_REGION = "us-east-1";
@@ -26208,7 +26219,7 @@ function loadBrandConfig(env) {
26208
26219
  }
26209
26220
  loadBrandConfig();
26210
26221
  BRAND_CONFIGS[DEFAULT_BRAND_NAME];
26211
- // ../shared/dist/chunk-DQAiGaWP.mjs
26222
+ // ../shared/dist/chunk-C0kBjss_.mjs
26212
26223
  const ARCHITECTURE_PREVIEW_SURFACE_TYPES = [
26213
26224
  "chat",
26214
26225
  "api",
@@ -31397,6 +31408,48 @@ function MutationResult({ loading, loadingLabel = "Processing...", success, succ
31397
31408
  });
31398
31409
  return null;
31399
31410
  }
31411
+ // src/ink/shared/useMutationState.ts
31412
+ function useMutationState(initial = "loading") {
31413
+ const [state, setState] = useState({ status: initial });
31414
+ return {
31415
+ state,
31416
+ start: useCallback(() => setState({ status: "loading" }), []),
31417
+ succeed: useCallback((result) => setState({
31418
+ status: "success",
31419
+ result
31420
+ }), []),
31421
+ fail: useCallback((error) => setState({
31422
+ status: "error",
31423
+ error: error instanceof Error ? error : new Error(String(error))
31424
+ }), [])
31425
+ };
31426
+ }
31427
+ /** The MutationResult props a lifecycle state renders as. */
31428
+ function mutationResultProps(state) {
31429
+ switch (state.status) {
31430
+ case "idle": return {
31431
+ loading: false,
31432
+ success: null,
31433
+ error: null
31434
+ };
31435
+ case "loading": return {
31436
+ loading: true,
31437
+ success: null,
31438
+ error: null
31439
+ };
31440
+ case "success": return {
31441
+ loading: false,
31442
+ success: true,
31443
+ error: null,
31444
+ result: state.result
31445
+ };
31446
+ case "error": return {
31447
+ loading: false,
31448
+ success: false,
31449
+ error: state.error
31450
+ };
31451
+ }
31452
+ }
31400
31453
  // src/ink/shared/account-picker.ts
31401
31454
  /** Interactive picker over stored logins; resolves undefined if the user exits without choosing. */
31402
31455
  async function promptForAccount(accounts) {
@@ -31755,27 +31808,19 @@ async function getBillingInfo(apiKey, apiUrl) {
31755
31808
  /** Run one async step under the shared spinner/result chrome. */
31756
31809
  async function renderTask(loadingLabel, task) {
31757
31810
  const App = () => {
31758
- const [loading, setLoading] = useState(true);
31759
31811
  const [label, setLabel] = useState(loadingLabel);
31760
- const [success, setSuccess] = useState(null);
31761
- const [error, setError] = useState(null);
31762
- const [outcome, setOutcome] = useState(null);
31812
+ const [message, setMessage] = useState("");
31813
+ const mutation = useMutationState();
31763
31814
  useEffect(() => {
31764
31815
  task(setLabel).then((value) => {
31765
- setOutcome(value);
31766
- setSuccess(true);
31767
- }).catch((err) => {
31768
- setError(err instanceof Error ? err : new Error(String(err)));
31769
- setSuccess(false);
31770
- }).finally(() => setLoading(false));
31816
+ setMessage(value.message);
31817
+ mutation.succeed(value.result);
31818
+ }).catch((err) => mutation.fail(err));
31771
31819
  }, []);
31772
31820
  return React.createElement(MutationResult, {
31773
- loading,
31821
+ ...mutationResultProps(mutation.state),
31774
31822
  loadingLabel: label,
31775
- success,
31776
- successMessage: outcome?.message ?? "",
31777
- error,
31778
- result: outcome?.result
31823
+ successMessage: message
31779
31824
  });
31780
31825
  };
31781
31826
  const { waitUntilExit } = render(React.createElement(App));
@@ -35044,6 +35089,30 @@ promptsCommand.command("delete <id>").description("Delete a prompt").option("--t
35044
35089
  const { waitUntilExit } = render(React.createElement(runDelete()));
35045
35090
  await waitUntilExit();
35046
35091
  });
35092
+ // ../shared/dist/batch-execution-status.mjs
35093
+ /**
35094
+ * Lifecycle of a batch execution as the API writes it: `batch_executions.status` and the
35095
+ * BatchExecutionDO state. Every SDK, CLI and MCP consumer classifies batch status through this list.
35096
+ */
35097
+ const BATCH_EXECUTION_STATUSES = [
35098
+ "queued",
35099
+ "processing",
35100
+ "completed",
35101
+ "failed",
35102
+ "cancelled"
35103
+ ];
35104
+ const TERMINAL_BATCH_EXECUTION_STATUSES = [
35105
+ "completed",
35106
+ "failed",
35107
+ "cancelled"
35108
+ ];
35109
+ function isBatchExecutionStatus(value) {
35110
+ return BATCH_EXECUTION_STATUSES.includes(value);
35111
+ }
35112
+ /** False for an unknown status: a value this list does not name must never read as finished. */
35113
+ function isTerminalBatchExecutionStatus(status) {
35114
+ return TERMINAL_BATCH_EXECUTION_STATUSES.includes(status);
35115
+ }
35047
35116
  // src/lib/wait-for-status.ts
35048
35117
  const MAX_WAIT_DURATION_MS = 2147483647;
35049
35118
  /** Poll read-only status until terminal, timeout, or caller abort; never cancel the remote task. */
@@ -35097,18 +35166,16 @@ function parseWatchDuration(value) {
35097
35166
  if (!/^\d+$/.test(value) || !Number.isInteger(duration) || duration <= 0 || duration > 2147483647) throw new InvalidArgumentError(`Expected an integer between 1 and ${MAX_WAIT_DURATION_MS} ms`);
35098
35167
  return duration;
35099
35168
  }
35100
- function isTerminalBatchStatus(data) {
35101
- switch (data.status) {
35102
- case "queued":
35103
- case "pending":
35104
- case "processing":
35105
- case "running": return false;
35106
- case "completed":
35107
- case "failed":
35108
- case "cancelled":
35109
- case "partial": return true;
35110
- default: throw new Error(`Unknown batch status: ${data.status}`);
35111
- }
35169
+ /** Unknown statuses keep polling with one warning each, so a newer API state never ends a watch early. */
35170
+ function createBatchTerminalCheck(warn) {
35171
+ const warnedStatuses = /* @__PURE__ */ new Set();
35172
+ return (data) => {
35173
+ if (!isBatchExecutionStatus(data.status) && !warnedStatuses.has(data.status)) {
35174
+ warnedStatuses.add(data.status);
35175
+ warn(`Unknown batch status "${data.status}"; continuing to poll until a terminal status`);
35176
+ }
35177
+ return isTerminalBatchExecutionStatus(data.status);
35178
+ };
35112
35179
  }
35113
35180
  function parseBatchStatusResponse(value) {
35114
35181
  if (!value || typeof value !== "object" || !("status" in value) || typeof value.status !== "string") throw new Error("Invalid batch status response: expected an object with a status string");
@@ -35218,7 +35285,7 @@ batchCommand.command("status <id>").description("Check batch job status").option
35218
35285
  signal
35219
35286
  })).json());
35220
35287
  },
35221
- isTerminal: isTerminalBatchStatus,
35288
+ isTerminal: createBatchTerminalCheck((message) => console.error(message)),
35222
35289
  timeoutMs,
35223
35290
  intervalMs: options.interval ?? 2e3,
35224
35291
  onStatus: (data) => {
@@ -35812,15 +35879,12 @@ secretsCommand.command("get <id>").description("Get secret metadata (value is ne
35812
35879
  return;
35813
35880
  }
35814
35881
  const App = () => {
35815
- const [loading, setLoading] = useState(true);
35816
- const [success, setSuccess] = useState(null);
35817
- const [error, setError] = useState(null);
35818
- const [resultNode, setResultNode] = useState(void 0);
35882
+ const mutation = useMutationState();
35819
35883
  useEffect(() => {
35820
35884
  const run = async () => {
35821
35885
  try {
35822
35886
  const s = (await client.get(`/secrets/${id}`)).data;
35823
- setResultNode(React.createElement(EntityCard, { fields: [
35887
+ mutation.succeed(React.createElement(EntityCard, { fields: [
35824
35888
  {
35825
35889
  label: "ID",
35826
35890
  value: s.id,
@@ -35851,23 +35915,16 @@ secretsCommand.command("get <id>").description("Get secret metadata (value is ne
35851
35915
  value: s.createdAt
35852
35916
  }
35853
35917
  ] }));
35854
- setSuccess(true);
35855
- setLoading(false);
35856
35918
  } catch (err) {
35857
- setError(err instanceof Error ? err : new Error(String(err)));
35858
- setSuccess(false);
35859
- setLoading(false);
35919
+ mutation.fail(err);
35860
35920
  }
35861
35921
  };
35862
35922
  run();
35863
35923
  }, []);
35864
35924
  return React.createElement(MutationResult, {
35865
- loading,
35925
+ ...mutationResultProps(mutation.state),
35866
35926
  loadingLabel: "Fetching secret...",
35867
- success,
35868
- successMessage: "Secret",
35869
- error,
35870
- result: resultNode
35927
+ successMessage: "Secret"
35871
35928
  });
35872
35929
  };
35873
35930
  const { waitUntilExit } = render(React.createElement(App));
@@ -35912,15 +35969,12 @@ secretsCommand.command("create").description("Create a new secret (provide the v
35912
35969
  return;
35913
35970
  }
35914
35971
  const App = () => {
35915
- const [loading, setLoading] = useState(true);
35916
- const [success, setSuccess] = useState(null);
35917
- const [error, setError] = useState(null);
35918
- const [resultNode, setResultNode] = useState(void 0);
35972
+ const mutation = useMutationState();
35919
35973
  useEffect(() => {
35920
35974
  const run = async () => {
35921
35975
  try {
35922
35976
  const data = await client.post("/secrets", body);
35923
- setResultNode(React.createElement(EntityCard, { fields: [
35977
+ mutation.succeed(React.createElement(EntityCard, { fields: [
35924
35978
  {
35925
35979
  label: "ID",
35926
35980
  value: data.data.id,
@@ -35935,23 +35989,16 @@ secretsCommand.command("create").description("Create a new secret (provide the v
35935
35989
  value: data.data.status
35936
35990
  }
35937
35991
  ] }));
35938
- setSuccess(true);
35939
- setLoading(false);
35940
35992
  } catch (err) {
35941
- setError(err instanceof Error ? err : new Error(String(err)));
35942
- setSuccess(false);
35943
- setLoading(false);
35993
+ mutation.fail(err);
35944
35994
  }
35945
35995
  };
35946
35996
  run();
35947
35997
  }, []);
35948
35998
  return React.createElement(MutationResult, {
35949
- loading,
35999
+ ...mutationResultProps(mutation.state),
35950
36000
  loadingLabel: "Creating secret...",
35951
- success,
35952
- successMessage: "Secret created",
35953
- error,
35954
- result: resultNode
36001
+ successMessage: "Secret created"
35955
36002
  });
35956
36003
  };
35957
36004
  const { waitUntilExit } = render(React.createElement(App));
@@ -36004,15 +36051,12 @@ secretsCommand.command("update <id>").description("Update or rotate a secret (va
36004
36051
  return;
36005
36052
  }
36006
36053
  const App = () => {
36007
- const [loading, setLoading] = useState(true);
36008
- const [success, setSuccess] = useState(null);
36009
- const [error, setError] = useState(null);
36010
- const [resultNode, setResultNode] = useState(void 0);
36054
+ const mutation = useMutationState();
36011
36055
  useEffect(() => {
36012
36056
  const run = async () => {
36013
36057
  try {
36014
36058
  const data = await client.put(`/secrets/${id}`, body);
36015
- setResultNode(React.createElement(EntityCard, { fields: [
36059
+ mutation.succeed(React.createElement(EntityCard, { fields: [
36016
36060
  {
36017
36061
  label: "ID",
36018
36062
  value: data.data.id,
@@ -36027,23 +36071,16 @@ secretsCommand.command("update <id>").description("Update or rotate a secret (va
36027
36071
  value: String(data.data.version)
36028
36072
  }
36029
36073
  ] }));
36030
- setSuccess(true);
36031
- setLoading(false);
36032
36074
  } catch (err) {
36033
- setError(err instanceof Error ? err : new Error(String(err)));
36034
- setSuccess(false);
36035
- setLoading(false);
36075
+ mutation.fail(err);
36036
36076
  }
36037
36077
  };
36038
36078
  run();
36039
36079
  }, []);
36040
36080
  return React.createElement(MutationResult, {
36041
- loading,
36081
+ ...mutationResultProps(mutation.state),
36042
36082
  loadingLabel: "Updating secret...",
36043
- success,
36044
- successMessage: "Secret updated",
36045
- error,
36046
- result: resultNode
36083
+ successMessage: "Secret updated"
36047
36084
  });
36048
36085
  };
36049
36086
  const { waitUntilExit } = render(React.createElement(App));
@@ -36066,25 +36103,18 @@ secretsCommand.command("delete <id>").description("Delete a secret").option("--t
36066
36103
  }
36067
36104
  const runDelete = () => {
36068
36105
  const App = () => {
36069
- const [loading, setLoading] = useState(true);
36070
- const [success, setSuccess] = useState(null);
36071
- const [error, setError] = useState(null);
36106
+ const mutation = useMutationState();
36072
36107
  useEffect(() => {
36073
36108
  client.delete(`/secrets/${id}`).then(() => {
36074
- setSuccess(true);
36075
- setLoading(false);
36109
+ mutation.succeed();
36076
36110
  }).catch((err) => {
36077
- setError(err instanceof Error ? err : new Error(String(err)));
36078
- setSuccess(false);
36079
- setLoading(false);
36111
+ mutation.fail(err);
36080
36112
  });
36081
36113
  }, []);
36082
36114
  return React.createElement(MutationResult, {
36083
- loading,
36115
+ ...mutationResultProps(mutation.state),
36084
36116
  loadingLabel: "Deleting secret...",
36085
- success,
36086
- successMessage: "Secret deleted",
36087
- error
36117
+ successMessage: "Secret deleted"
36088
36118
  });
36089
36119
  };
36090
36120
  return App;
@@ -36131,15 +36161,12 @@ secretsCommand.command("check <keys...>").description("Check which secret keys e
36131
36161
  return;
36132
36162
  }
36133
36163
  const App = () => {
36134
- const [loading, setLoading] = useState(true);
36135
- const [success, setSuccess] = useState(null);
36136
- const [error, setError] = useState(null);
36137
- const [resultNode, setResultNode] = useState(void 0);
36164
+ const mutation = useMutationState();
36138
36165
  useEffect(() => {
36139
36166
  const run = async () => {
36140
36167
  try {
36141
36168
  const data = await client.post("/secrets/check", body);
36142
- setResultNode(React.createElement(EntityCard, { fields: [
36169
+ mutation.succeed(React.createElement(EntityCard, { fields: [
36143
36170
  {
36144
36171
  label: "Found",
36145
36172
  value: data.found.join(", ") || "(none)",
@@ -36156,23 +36183,16 @@ secretsCommand.command("check <keys...>").description("Check which secret keys e
36156
36183
  color: "red"
36157
36184
  }
36158
36185
  ] }));
36159
- setSuccess(true);
36160
- setLoading(false);
36161
36186
  } catch (err) {
36162
- setError(err instanceof Error ? err : new Error(String(err)));
36163
- setSuccess(false);
36164
- setLoading(false);
36187
+ mutation.fail(err);
36165
36188
  }
36166
36189
  };
36167
36190
  run();
36168
36191
  }, []);
36169
36192
  return React.createElement(MutationResult, {
36170
- loading,
36193
+ ...mutationResultProps(mutation.state),
36171
36194
  loadingLabel: "Checking secrets...",
36172
- success,
36173
- successMessage: "Secret check",
36174
- error,
36175
- result: resultNode
36195
+ successMessage: "Secret check"
36176
36196
  });
36177
36197
  };
36178
36198
  const { waitUntilExit } = render(React.createElement(App));
@@ -39521,6 +39541,10 @@ const INITIAL_STATE = {
39521
39541
  totalOutputTokens: 0,
39522
39542
  contextCompaction: null
39523
39543
  };
39544
+ /** Frames arriving after a leg completed never move the phase; only a new start or a lifecycle action does. */
39545
+ function streamFramePhase(current, next) {
39546
+ return current === "complete" || current === "checkpoint" ? current : next;
39547
+ }
39524
39548
  /** Max raw events to keep in memory */
39525
39549
  const MAX_RAW_EVENTS = 15e3;
39526
39550
  const TOOL_PREVIEW_FIELD_LIMIT = 2;
@@ -39746,15 +39770,15 @@ function useMarathonStream() {
39746
39770
  setState((prev) => ({
39747
39771
  ...prev,
39748
39772
  ...event.contentType === "text" ? {
39749
- phase: "streaming",
39773
+ phase: streamFramePhase(prev.phase, "streaming"),
39750
39774
  content: appendTranscriptText(prev.content, event.delta, prev.lastTranscriptKind),
39751
39775
  lastTranscriptKind: "text",
39752
39776
  thinkingStartedAt: null
39753
39777
  } : event.contentType === "tool_input" ? {
39754
- phase: "tool",
39778
+ phase: streamFramePhase(prev.phase, "tool"),
39755
39779
  thinkingStartedAt: null
39756
39780
  } : {
39757
- phase: "thinking",
39781
+ phase: streamFramePhase(prev.phase, "thinking"),
39758
39782
  reasoning: prev.reasoning + event.delta,
39759
39783
  thinkingStartedAt: prev.thinkingStartedAt ?? Date.now()
39760
39784
  }
@@ -39796,7 +39820,7 @@ function useMarathonStream() {
39796
39820
  });
39797
39821
  return {
39798
39822
  ...prev,
39799
- phase: "tool",
39823
+ phase: streamFramePhase(prev.phase, "tool"),
39800
39824
  thinkingStartedAt: null,
39801
39825
  tools
39802
39826
  };
@@ -39808,7 +39832,7 @@ function useMarathonStream() {
39808
39832
  setStoredToolPayloadField(toolPayloadsRef.current, uniqueId, "parameters", inlineParameters ? void 0 : event.parameters);
39809
39833
  return {
39810
39834
  ...prev,
39811
- phase: "tool",
39835
+ phase: streamFramePhase(prev.phase, "tool"),
39812
39836
  thinkingStartedAt: null,
39813
39837
  content: appendContentLine(prev.content, `[${sequence}] ${event.toolName}`),
39814
39838
  lastTranscriptKind: "tool",
@@ -39851,7 +39875,7 @@ function useMarathonStream() {
39851
39875
  });
39852
39876
  return {
39853
39877
  ...prev,
39854
- phase: "tool",
39878
+ phase: streamFramePhase(prev.phase, "tool"),
39855
39879
  thinkingStartedAt: null,
39856
39880
  tools
39857
39881
  };
@@ -39880,7 +39904,7 @@ function useMarathonStream() {
39880
39904
  });
39881
39905
  return {
39882
39906
  ...prev,
39883
- phase: "tool",
39907
+ phase: streamFramePhase(prev.phase, "tool"),
39884
39908
  thinkingStartedAt: null,
39885
39909
  tools
39886
39910
  };
@@ -39911,7 +39935,7 @@ function useMarathonStream() {
39911
39935
  });
39912
39936
  return {
39913
39937
  ...prev,
39914
- phase: "streaming",
39938
+ phase: streamFramePhase(prev.phase, "streaming"),
39915
39939
  tools
39916
39940
  };
39917
39941
  });
@@ -39937,7 +39961,7 @@ function useMarathonStream() {
39937
39961
  pushRawEvent(rawEventsRef, "agent_await", { ...event }, eventWriterRef, awaitListData);
39938
39962
  setState((prev) => ({
39939
39963
  ...prev,
39940
- phase: "tool",
39964
+ phase: streamFramePhase(prev.phase, "tool"),
39941
39965
  thinkingStartedAt: null,
39942
39966
  tools: prev.tools.map((t) => {
39943
39967
  if (t.status !== "running") return t;
@@ -39967,7 +39991,7 @@ function useMarathonStream() {
39967
39991
  pushRawEvent(rawEventsRef, "local_tool_execution_start", { ...event }, eventWriterRef, listData);
39968
39992
  setState((prev) => ({
39969
39993
  ...prev,
39970
- phase: "tool",
39994
+ phase: streamFramePhase(prev.phase, "tool"),
39971
39995
  thinkingStartedAt: null,
39972
39996
  tools: prev.tools.map((tool) => {
39973
39997
  if (!(tool.status === "running" && (tool.localToolCallId === event.toolCallId || tool.sourceToolCallId === event.toolCallId || tool.name === event.toolName))) return tool;
@@ -45630,7 +45654,7 @@ function MarathonApp({ taskName, agentId, model, sandbox, goal, initialSessionCo
45630
45654
  const { exit } = useApp();
45631
45655
  const { stdout } = useStdout();
45632
45656
  const separator = theme.separator ?? " · ";
45633
- const checkpointResolveRef = useRef(null);
45657
+ const pendingCheckpointRef = useRef(null);
45634
45658
  const [checkpointRecap, setCheckpointRecap] = useState(null);
45635
45659
  const [currentModel, setCurrentModel] = useState(model || "default");
45636
45660
  const [currentSandbox, setCurrentSandbox] = useState(sandbox);
@@ -45666,19 +45690,14 @@ function MarathonApp({ taskName, agentId, model, sandbox, goal, initialSessionCo
45666
45690
  setCheckpointInitialMessage(void 0);
45667
45691
  if (result.model) setCurrentModel(result.model);
45668
45692
  if (result.sandbox !== void 0) setCurrentSandbox(result.sandbox || void 0);
45669
- if (isTerminalCheckpointRef.current) {
45670
- if (checkpointResolveRef.current) {
45671
- checkpointResolveRef.current(result);
45672
- checkpointResolveRef.current = null;
45673
- }
45674
- } else {
45693
+ const pending = pendingCheckpointRef.current;
45694
+ pendingCheckpointRef.current = null;
45695
+ if (isTerminalCheckpointRef.current) pending?.resolve(result);
45696
+ else {
45675
45697
  resetForNewSession();
45676
45698
  setIsTerminalCheckpoint(false);
45677
45699
  isTerminalCheckpointRef.current = false;
45678
- if (checkpointResolveRef.current) {
45679
- checkpointResolveRef.current(result);
45680
- checkpointResolveRef.current = null;
45681
- }
45700
+ pending?.resolve(result);
45682
45701
  }
45683
45702
  }, [resetForNewSession]);
45684
45703
  useEffect(() => {
@@ -45712,15 +45731,22 @@ function MarathonApp({ taskName, agentId, model, sandbox, goal, initialSessionCo
45712
45731
  setFollowLatest(true);
45713
45732
  setLatestUnreadKey(void 0);
45714
45733
  },
45715
- requestCheckpoint: async (recap, isTerminal) => {
45734
+ requestCheckpoint: (recap, isTerminal) => {
45735
+ if (pendingCheckpointRef.current) return pendingCheckpointRef.current.promise;
45716
45736
  setCheckpoint();
45717
45737
  setCheckpointRecap(recap);
45718
45738
  setIsCheckpointExploring(false);
45719
45739
  setIsTerminalCheckpoint(Boolean(isTerminal));
45720
45740
  isTerminalCheckpointRef.current = Boolean(isTerminal);
45721
- return new Promise((resolve) => {
45722
- checkpointResolveRef.current = resolve;
45741
+ let resolve = () => {};
45742
+ const promise = new Promise((settle) => {
45743
+ resolve = settle;
45723
45744
  });
45745
+ pendingCheckpointRef.current = {
45746
+ promise,
45747
+ resolve
45748
+ };
45749
+ return promise;
45724
45750
  },
45725
45751
  updateMilestone: (milestone) => {
45726
45752
  setCurrentMilestone(milestone);
@@ -47889,6 +47915,62 @@ async function promptSelect(message, choices, options) {
47889
47915
  renderMenu();
47890
47916
  });
47891
47917
  }
47918
+ // src/marathon/run-task-status.ts
47919
+ const RUN_TASK_STATUS_CLASSIFICATION = {
47920
+ complete: {
47921
+ terminalCheckpoint: true,
47922
+ resumable: false,
47923
+ resumeCheckpoint: false,
47924
+ tone: "success",
47925
+ snapshotStatus: "complete"
47926
+ },
47927
+ budget_exceeded: {
47928
+ terminalCheckpoint: true,
47929
+ resumable: false,
47930
+ resumeCheckpoint: false,
47931
+ tone: "failure",
47932
+ snapshotStatus: "budget_exceeded"
47933
+ },
47934
+ max_sessions: {
47935
+ terminalCheckpoint: true,
47936
+ resumable: true,
47937
+ resumeCheckpoint: false,
47938
+ tone: "warning",
47939
+ snapshotStatus: null
47940
+ },
47941
+ stalled: {
47942
+ terminalCheckpoint: true,
47943
+ resumable: true,
47944
+ resumeCheckpoint: false,
47945
+ tone: "warning",
47946
+ snapshotStatus: null
47947
+ },
47948
+ error: {
47949
+ terminalCheckpoint: false,
47950
+ resumable: true,
47951
+ resumeCheckpoint: false,
47952
+ tone: "failure",
47953
+ snapshotStatus: "error"
47954
+ },
47955
+ paused: {
47956
+ terminalCheckpoint: false,
47957
+ resumable: true,
47958
+ resumeCheckpoint: true,
47959
+ tone: "warning",
47960
+ snapshotStatus: null
47961
+ },
47962
+ running: {
47963
+ terminalCheckpoint: false,
47964
+ resumable: true,
47965
+ resumeCheckpoint: true,
47966
+ tone: "warning",
47967
+ snapshotStatus: null
47968
+ }
47969
+ };
47970
+ /** A status this table does not name (an older or newer saved state) is treated like an interrupted run. */
47971
+ function classifyRunTaskStatus(status) {
47972
+ return RUN_TASK_STATUS_CLASSIFICATION[status] ?? RUN_TASK_STATUS_CLASSIFICATION.running;
47973
+ }
47892
47974
  // src/marathon/state.ts
47893
47975
  function defaultStateDir$1() {
47894
47976
  return getMarathonStateDir();
@@ -48038,13 +48120,10 @@ function buildMarathonSessionSnapshot(liveState, sessionSummary, model, status =
48038
48120
  };
48039
48121
  }
48040
48122
  function mapRunTaskStatusToSnapshotStatus(status, fallback) {
48041
- if (status === "complete") return "complete";
48042
- if (status === "error") return "error";
48043
- if (status === "budget_exceeded") return "budget_exceeded";
48044
- return fallback;
48123
+ return classifyRunTaskStatus(status).snapshotStatus ?? fallback;
48045
48124
  }
48046
48125
  function isMarathonResumableStatus(status) {
48047
- return status === "paused" || status === "max_sessions" || status === "error";
48126
+ return classifyRunTaskStatus(status).resumable;
48048
48127
  }
48049
48128
  function sanitizeLoadedMarathonState(state) {
48050
48129
  const planPath = normalizeMarathonStatePath(state.planPath) || state.planPath;
@@ -49959,7 +50038,7 @@ function normalizeFallbackModel(input) {
49959
50038
  }
49960
50039
  // src/commands/agents-task.ts
49961
50040
  function shouldRequestResumeCheckpoint(status, resumeMessage, noCheckpoint, originalMessage, continuations) {
49962
- if (status !== "paused" || noCheckpoint) return false;
50041
+ if (!classifyRunTaskStatus(status).resumeCheckpoint || noCheckpoint) return false;
49963
50042
  const normalizedResumeMessage = resumeMessage?.trim();
49964
50043
  if (!normalizedResumeMessage) return true;
49965
50044
  const normalizedOriginalMessage = originalMessage?.trim();
@@ -51073,7 +51152,7 @@ async function taskAction(agent, options) {
51073
51152
  useCompact = false;
51074
51153
  resumeState = extractRunTaskResumeState(lastKnownState);
51075
51154
  }
51076
- if (wasAborted || result.status === "complete" || result.status === "budget_exceeded" || result.status === "max_sessions") {
51155
+ if (wasAborted || classifyRunTaskStatus(result.status).terminalCheckpoint) {
51077
51156
  if (options.noCheckpoint) {
51078
51157
  if (wasAborted) undeliveredSteering = streamRef.current?.drainSteeringQueue?.() ?? [];
51079
51158
  break;
@@ -51180,7 +51259,8 @@ async function taskAction(agent, options) {
51180
51259
  })]);
51181
51260
  }
51182
51261
  console.log();
51183
- const statusColor = result.status === "complete" ? chalk.green : result.status === "budget_exceeded" || result.status === "error" ? chalk.red : chalk.yellow;
51262
+ const statusTone = classifyRunTaskStatus(result.status).tone;
51263
+ const statusColor = statusTone === "success" ? chalk.green : statusTone === "failure" ? chalk.red : chalk.yellow;
51184
51264
  console.log(`Status: ${statusColor(result.status)}`);
51185
51265
  console.log(`Sessions: ${finalState.sessionCount}`);
51186
51266
  console.log(`Total cost: ${chalk.yellow(`$${finalState.totalCost.toFixed(4)}`)}`);
@@ -55821,15 +55901,12 @@ apiKeysCommand.command("get <id>").description("Get API key details").option("--
55821
55901
  return;
55822
55902
  }
55823
55903
  const App = () => {
55824
- const [loading, setLoading] = useState(true);
55825
- const [success, setSuccess] = useState(null);
55826
- const [error, setError] = useState(null);
55827
- const [resultNode, setResultNode] = useState(void 0);
55904
+ const mutation = useMutationState();
55828
55905
  useEffect(() => {
55829
55906
  const run = async () => {
55830
55907
  try {
55831
55908
  const data = await client.get(`/api-keys/${id}`);
55832
- setResultNode(React.createElement(EntityCard, { fields: [
55909
+ mutation.succeed(React.createElement(EntityCard, { fields: [
55833
55910
  {
55834
55911
  label: "ID",
55835
55912
  value: data.id
@@ -55855,23 +55932,16 @@ apiKeysCommand.command("get <id>").description("Get API key details").option("--
55855
55932
  value: data.createdAt
55856
55933
  }
55857
55934
  ] }));
55858
- setSuccess(true);
55859
- setLoading(false);
55860
55935
  } catch (err) {
55861
- setError(err instanceof Error ? err : new Error(String(err)));
55862
- setSuccess(false);
55863
- setLoading(false);
55936
+ mutation.fail(err);
55864
55937
  }
55865
55938
  };
55866
55939
  run();
55867
55940
  }, []);
55868
55941
  return React.createElement(MutationResult, {
55869
- loading,
55942
+ ...mutationResultProps(mutation.state),
55870
55943
  loadingLabel: "Fetching API key...",
55871
- success,
55872
- successMessage: "API Key",
55873
- error,
55874
- result: resultNode
55944
+ successMessage: "API Key"
55875
55945
  });
55876
55946
  };
55877
55947
  const { waitUntilExit } = render(React.createElement(App));
@@ -55936,10 +56006,7 @@ apiKeysCommand.command("create").description("Create a new API key").requiredOpt
55936
56006
  return;
55937
56007
  }
55938
56008
  const App = () => {
55939
- const [loading, setLoading] = useState(true);
55940
- const [success, setSuccess] = useState(null);
55941
- const [error, setError] = useState(null);
55942
- const [resultNode, setResultNode] = useState(void 0);
56009
+ const mutation = useMutationState();
55943
56010
  useEffect(() => {
55944
56011
  const run = async () => {
55945
56012
  try {
@@ -55977,24 +56044,17 @@ apiKeysCommand.command("create").description("Create a new API key").requiredOpt
55977
56044
  value: "Save this key - it will not be shown again"
55978
56045
  });
55979
56046
  }
55980
- setResultNode(React.createElement(EntityCard, { fields }));
55981
- setSuccess(true);
55982
- setLoading(false);
56047
+ mutation.succeed(React.createElement(EntityCard, { fields }));
55983
56048
  } catch (err) {
55984
- setError(err instanceof Error ? err : new Error(String(err)));
55985
- setSuccess(false);
55986
- setLoading(false);
56049
+ mutation.fail(err);
55987
56050
  }
55988
56051
  };
55989
56052
  run();
55990
56053
  }, []);
55991
56054
  return React.createElement(MutationResult, {
55992
- loading,
56055
+ ...mutationResultProps(mutation.state),
55993
56056
  loadingLabel: "Creating API key...",
55994
- success,
55995
- successMessage: "API key created",
55996
- error,
55997
- result: resultNode
56057
+ successMessage: "API key created"
55998
56058
  });
55999
56059
  };
56000
56060
  const { waitUntilExit } = render(React.createElement(App));
@@ -56018,29 +56078,22 @@ apiKeysCommand.command("delete <id>").description("Delete an API key").option("-
56018
56078
  }
56019
56079
  if (options.yes) {
56020
56080
  const App = () => {
56021
- const [loading, setLoading] = useState(true);
56022
- const [success, setSuccess] = useState(null);
56023
- const [error, setError] = useState(null);
56081
+ const mutation = useMutationState();
56024
56082
  useEffect(() => {
56025
56083
  const run = async () => {
56026
56084
  try {
56027
56085
  await client.apiKeys.delete(id);
56028
- setSuccess(true);
56029
- setLoading(false);
56086
+ mutation.succeed();
56030
56087
  } catch (err) {
56031
- setError(err instanceof Error ? err : new Error(String(err)));
56032
- setSuccess(false);
56033
- setLoading(false);
56088
+ mutation.fail(err);
56034
56089
  }
56035
56090
  };
56036
56091
  run();
56037
56092
  }, []);
56038
56093
  return React.createElement(MutationResult, {
56039
- loading,
56094
+ ...mutationResultProps(mutation.state),
56040
56095
  loadingLabel: "Deleting API key...",
56041
- success,
56042
- successMessage: "API key deleted",
56043
- error
56096
+ successMessage: "API key deleted"
56044
56097
  });
56045
56098
  };
56046
56099
  const { waitUntilExit } = render(React.createElement(App));
@@ -56058,29 +56111,22 @@ apiKeysCommand.command("delete <id>").description("Delete an API key").option("-
56058
56111
  }));
56059
56112
  })) return;
56060
56113
  const DeleteApp = () => {
56061
- const [loading, setLoading] = useState(true);
56062
- const [success, setSuccess] = useState(null);
56063
- const [error, setError] = useState(null);
56114
+ const mutation = useMutationState();
56064
56115
  useEffect(() => {
56065
56116
  const run = async () => {
56066
56117
  try {
56067
56118
  await client.apiKeys.delete(id);
56068
- setSuccess(true);
56069
- setLoading(false);
56119
+ mutation.succeed();
56070
56120
  } catch (err) {
56071
- setError(err instanceof Error ? err : new Error(String(err)));
56072
- setSuccess(false);
56073
- setLoading(false);
56121
+ mutation.fail(err);
56074
56122
  }
56075
56123
  };
56076
56124
  run();
56077
56125
  }, []);
56078
56126
  return React.createElement(MutationResult, {
56079
- loading,
56127
+ ...mutationResultProps(mutation.state),
56080
56128
  loadingLabel: "Deleting API key...",
56081
- success,
56082
- successMessage: "API key deleted",
56083
- error
56129
+ successMessage: "API key deleted"
56084
56130
  });
56085
56131
  };
56086
56132
  const { waitUntilExit } = render(React.createElement(DeleteApp));
@@ -56110,39 +56156,29 @@ apiKeysCommand.command("regenerate <id>").description("Regenerate an API key").o
56110
56156
  return;
56111
56157
  }
56112
56158
  const App = () => {
56113
- const [loading, setLoading] = useState(true);
56114
- const [success, setSuccess] = useState(null);
56115
- const [error, setError] = useState(null);
56116
- const [resultNode, setResultNode] = useState(void 0);
56159
+ const mutation = useMutationState();
56117
56160
  useEffect(() => {
56118
56161
  const run = async () => {
56119
56162
  try {
56120
56163
  const data = await client.post(`/api-keys/${id}/regenerate`);
56121
- if (data.key) setResultNode(React.createElement(EntityCard, { fields: [{
56164
+ mutation.succeed(data.key ? React.createElement(EntityCard, { fields: [{
56122
56165
  label: "New Key",
56123
56166
  value: data.key,
56124
56167
  color: "yellow"
56125
56168
  }, {
56126
56169
  label: "Note",
56127
56170
  value: "Save this key - it will not be shown again"
56128
- }] }));
56129
- setSuccess(true);
56130
- setLoading(false);
56171
+ }] }) : void 0);
56131
56172
  } catch (err) {
56132
- setError(err instanceof Error ? err : new Error(String(err)));
56133
- setSuccess(false);
56134
- setLoading(false);
56173
+ mutation.fail(err);
56135
56174
  }
56136
56175
  };
56137
56176
  run();
56138
56177
  }, []);
56139
56178
  return React.createElement(MutationResult, {
56140
- loading,
56179
+ ...mutationResultProps(mutation.state),
56141
56180
  loadingLabel: "Regenerating API key...",
56142
- success,
56143
- successMessage: "API key regenerated",
56144
- error,
56145
- result: resultNode
56181
+ successMessage: "API key regenerated"
56146
56182
  });
56147
56183
  };
56148
56184
  const { waitUntilExit } = render(React.createElement(App));
@@ -56165,30 +56201,23 @@ apiKeysCommand.command("analytics").description("Show API key usage analytics").
56165
56201
  return;
56166
56202
  }
56167
56203
  const App = () => {
56168
- const [loading, setLoading] = useState(true);
56169
- const [success, setSuccess] = useState(null);
56170
- const [error, setError] = useState(null);
56204
+ const mutation = useMutationState();
56171
56205
  useEffect(() => {
56172
56206
  const run = async () => {
56173
56207
  try {
56174
56208
  const path = options.key ? `/api-keys/${options.key}/analytics` : "/api-keys/analytics";
56175
56209
  printJson(await client.get(path));
56176
- setSuccess(true);
56177
- setLoading(false);
56210
+ mutation.succeed();
56178
56211
  } catch (err) {
56179
- setError(err instanceof Error ? err : new Error(String(err)));
56180
- setSuccess(false);
56181
- setLoading(false);
56212
+ mutation.fail(err);
56182
56213
  }
56183
56214
  };
56184
56215
  run();
56185
56216
  }, []);
56186
56217
  return React.createElement(MutationResult, {
56187
- loading,
56218
+ ...mutationResultProps(mutation.state),
56188
56219
  loadingLabel: "Fetching analytics...",
56189
- success,
56190
- successMessage: "Analytics",
56191
- error
56220
+ successMessage: "Analytics"
56192
56221
  });
56193
56222
  };
56194
56223
  const { waitUntilExit } = render(React.createElement(App));
@@ -69110,7 +69139,7 @@ const productKindSchema = _enum([
69110
69139
  "external",
69111
69140
  "spec_only"
69112
69141
  ]);
69113
- // ../shared/dist/chunk-BM4DAX8-.mjs
69142
+ // ../shared/dist/chunk-Ibmsq8NB.mjs
69114
69143
  const amount = number$2().finite().nonnegative();
69115
69144
  const tokens = amount.int();
69116
69145
  /** Producer estimates for one turn, independent of Runtype's measured usage and billing. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runtypelabs/cli",
3
- "version": "2.56.3",
3
+ "version": "2.56.5",
4
4
  "description": "Command-line interface for Runtype AI platform",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -13,9 +13,9 @@
13
13
  "@modelcontextprotocol/core": "2.3.1",
14
14
  "@napi-rs/keyring": "2.1.0",
15
15
  "@runtypelabs/ink-components": "0.3.13",
16
- "@runtypelabs/sdk": "11.13.1",
16
+ "@runtypelabs/sdk": "11.14.0",
17
17
  "@runtypelabs/terminal-animations": "0.2.4",
18
- "add-mcp": "2.0.0",
18
+ "add-mcp": "2.6.0",
19
19
  "chalk": "^5.3.0",
20
20
  "commander": "^15.0.0",
21
21
  "conf": "^15.1.0",
@@ -37,9 +37,9 @@
37
37
  "devDependencies": {
38
38
  "@modelcontextprotocol/server": "2.3.1",
39
39
  "@runtypelabs/device-bridge": "0.2.5",
40
- "@runtypelabs/model-execution": "0.41.1",
40
+ "@runtypelabs/model-execution": "0.41.4",
41
41
  "@runtypelabs/persona": "4.34.0",
42
- "@runtypelabs/shared": "3.104.3",
42
+ "@runtypelabs/shared": "3.105.1",
43
43
  "@types/express": "^5.0.6",
44
44
  "@types/micromatch": "^4.0.9",
45
45
  "@types/node": "^25.3.3",