@deepnoodle/mobius 0.0.40 → 0.0.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.
@@ -1165,6 +1165,8 @@ export interface paths {
1165
1165
  /**
1166
1166
  * Cancel the session's active turn
1167
1167
  * @description Cancels whichever turn is currently active in the session. Queued and running turns for the session are marked cancelled and a terminal `turn.cancelled` event is emitted. Returns the updated session. Requires the `mobius.agent.invoke` permission (or the agent's own backing principal).
1168
+ *
1169
+ * By default loop-owned turns are left to the loop engine and skipped. Set `force=true` to also cancel loop-owned turns — the recovery path for a session wedged on a turn whose run is dead or stuck. Forcing may leave that run inconsistent, so use it only to unlock an otherwise stuck session, not as a routine stop.
1168
1170
  */
1169
1171
  post: operations["cancelSession"];
1170
1172
  delete?: never;
@@ -1345,6 +1347,46 @@ export interface paths {
1345
1347
  patch?: never;
1346
1348
  trace?: never;
1347
1349
  };
1350
+ "/v1/projects/{project_handle}/runs/{resource_id}/resume": {
1351
+ parameters: {
1352
+ query?: never;
1353
+ header?: never;
1354
+ path?: never;
1355
+ cookie?: never;
1356
+ };
1357
+ get?: never;
1358
+ put?: never;
1359
+ /**
1360
+ * Resume failed run
1361
+ * @description Resumes a failed run in place from the last durable checkpoint. The run must still reference the current runnable loop version. Guardrail failures require a higher limit in the request body before the run can continue.
1362
+ */
1363
+ post: operations["resumeRun"];
1364
+ delete?: never;
1365
+ options?: never;
1366
+ head?: never;
1367
+ patch?: never;
1368
+ trace?: never;
1369
+ };
1370
+ "/v1/projects/{project_handle}/runs/{resource_id}/retry": {
1371
+ parameters: {
1372
+ query?: never;
1373
+ header?: never;
1374
+ path?: never;
1375
+ cookie?: never;
1376
+ };
1377
+ get?: never;
1378
+ put?: never;
1379
+ /**
1380
+ * Retry failed run
1381
+ * @description Resumes a failed run in place from the last durable checkpoint. This is equivalent to resume, but records the operator intent as a retry in the run event log.
1382
+ */
1383
+ post: operations["retryRun"];
1384
+ delete?: never;
1385
+ options?: never;
1386
+ head?: never;
1387
+ patch?: never;
1388
+ trace?: never;
1389
+ };
1348
1390
  "/v1/projects/{project_handle}/runs/{resource_id}/steps": {
1349
1391
  parameters: {
1350
1392
  query?: never;
@@ -1921,7 +1963,7 @@ export interface components {
1921
1963
  * @description Server timestamp when this live preview frame was emitted.
1922
1964
  */
1923
1965
  emitted_at?: string | null;
1924
- /** @description Token preview payload, usually `{ "text": "..." }`. */
1966
+ /** @description Token preview payload. Normal answer text arrives as `{ "text": "..." }`; summarized reasoning/thinking arrives as `{ "type": "thinking", "thinking": "..." }`. */
1925
1967
  delta: {
1926
1968
  [key: string]: unknown;
1927
1969
  };
@@ -2145,163 +2187,533 @@ export interface components {
2145
2187
  items: components["schemas"]["Agent"][];
2146
2188
  };
2147
2189
  /**
2148
- * @description Stored API credential metadata for loop and service access. The raw secret is never returned here; use this object to list, audit, expire, or identify keys by prefix without exposing tokens.
2190
+ * @description Step type: `agent`, `action`, `sleep`, `wait_for_event`, `interaction`, `loop`, `check`, or system-materialized `cleanup`. `cleanup` appears in run step listings for terminal cleanup work but cannot be authored in a `LoopSpec`.
2191
+ * @enum {string}
2192
+ */
2193
+ LoopRunStepKind: "agent" | "action" | "sleep" | "wait_for_event" | "interaction" | "loop" | "check" | "cleanup";
2194
+ /**
2195
+ * @description Step lifecycle state: `pending`, `running`, `suspended`, `completed`, `failed`, `skipped`, or `cancelled`.
2196
+ * @enum {string}
2197
+ */
2198
+ LoopRunStepStatus: "pending" | "running" | "suspended" | "completed" | "failed" | "skipped" | "cancelled";
2199
+ /**
2200
+ * @description One execution step inside a loop run.
2149
2201
  * @example {
2150
- * "id": "cred_1jz8q2m7xp9vn4kt",
2151
- * "name": "CI worker",
2152
- * "key_prefix": "mbx_7q2v",
2153
- * "principal_id": "svc_7q2v9x6m3n8p5r4t",
2154
- * "tags": {
2155
- * "owner": "product"
2202
+ * "id": "run_8q5m2x9v7p3n4r6t:review",
2203
+ * "run_id": "run_8q5m2x9v7p3n4r6t",
2204
+ * "step_key": "review",
2205
+ * "step_name": "Review pull requests",
2206
+ * "kind": "agent",
2207
+ * "status": "running",
2208
+ * "seq": 0,
2209
+ * "attempt": 1,
2210
+ * "inputs": {
2211
+ * "repository": "deepnoodle-ai/mobius-cloud"
2156
2212
  * },
2157
2213
  * "created_at": "2026-06-15T14:30:00Z",
2158
- * "updated_at": "2026-06-15T14:30:00Z"
2214
+ * "updated_at": "2026-06-15T14:31:00Z"
2159
2215
  * }
2160
2216
  */
2161
- APIKey: {
2162
- /** @description Unique identifier for this API key. */
2217
+ LoopRunStep: {
2218
+ /** @description Stable step identifier. */
2163
2219
  id: string;
2164
- /** @description Human-readable label, unique within the project. */
2165
- name: string;
2166
- /** @description First 8 characters of the key, used to identify it without exposing the secret. */
2167
- key_prefix: string;
2168
- /** @description Principal this key authenticates as. */
2169
- principal_id: string;
2170
- /** @description Optional role whose permissions cap this key below its principal's full grants. */
2171
- scope_role_id?: string;
2172
- /** @description For organization-level keys, the system role the key acts as org-wide (e.g. `Admin`). Absent for project-scoped keys. */
2173
- org_role?: string;
2174
- /**
2175
- * Format: date-time
2176
- * @description Hard expiry timestamp. Requests using an expired key receive 401.
2177
- */
2178
- expires_at?: string;
2179
- /**
2180
- * Format: date-time
2181
- * @description Timestamp of the most recent authenticated request using this key.
2182
- */
2183
- last_used_at?: string;
2184
- /** @description Free-form labels used for filtering, ownership, or rotation policy. */
2185
- tags?: components["schemas"]["TagMap"];
2220
+ /** @description Run this step belongs to. */
2221
+ run_id: string;
2222
+ /** @description Stable key for this step within its loop version. */
2223
+ step_key: string;
2224
+ /** @description Display name from the authored spec, when present. */
2225
+ step_name?: string;
2226
+ /** @description Step kind copied from the authored spec or system cleanup step. */
2227
+ kind: components["schemas"]["LoopRunStepKind"];
2228
+ /** @description Current lifecycle state of this run step. */
2229
+ status: components["schemas"]["LoopRunStepStatus"];
2186
2230
  /**
2187
- * Format: date-time
2188
- * @description Timestamp when this key was created.
2231
+ * Format: int64
2232
+ * @description Zero-indexed ordinal of this step within its run.
2189
2233
  */
2190
- created_at: string;
2234
+ seq: number;
2235
+ /** @description Number of times this step has been attempted. */
2236
+ attempt: number;
2237
+ /** @description Resolved inputs passed into the step, after template rendering. */
2238
+ inputs?: {
2239
+ [key: string]: unknown;
2240
+ };
2241
+ /** @description Authored step parameters, before template rendering. */
2242
+ parameters?: {
2243
+ [key: string]: unknown;
2244
+ };
2245
+ /** @description Step output (shape varies by kind); absent until completion. Downstream step templates reach this value at `${{ steps.<id>.output }}` or `${{ steps[0].output }}`. */
2246
+ result?: unknown;
2247
+ /** @description Worker job that executed this step, when applicable. */
2248
+ job_id?: string | null;
2249
+ /** @description Wait record this step is suspended on, when applicable. */
2250
+ wait_id?: string | null;
2251
+ /** @description Session the agent ran in, for `agent`-kind steps. Present once the step has started a turn; links the step to its conversation so the UI can open the transcript with this step's messages highlighted. */
2252
+ session_id?: string;
2253
+ /** @description Agent that executed this step, for `agent`-kind steps. */
2254
+ agent_id?: string;
2255
+ /** @description Most recent AgentTurn this step ran (its latest attempt), for `agent`-kind steps. Resolves to the step's messages within the session via their `turn_id`. */
2256
+ agent_turn_id?: string;
2257
+ /** @description Machine-readable error code populated on failure. */
2258
+ error_type?: string;
2259
+ /** @description Human-readable error message populated on failure. */
2260
+ error_message?: string;
2191
2261
  /**
2192
- * Format: date-time
2193
- * @description Timestamp when this key was last updated.
2262
+ * @description Check outcome for `check`-kind steps: `pass` or `fail`; absent on every other kind. A failed check routed `on_fail: continue` completes the step with `verdict: fail` — status and verdict are separate axes (the step did its job: it checked).
2263
+ * @enum {string}
2194
2264
  */
2195
- updated_at: string;
2196
- };
2197
- /**
2198
- * @description Returned only on key creation. Contains the raw `key` value which is not retrievable after this response.
2199
- * @example {
2200
- * "id": "cred_1jz8q2m7xp9vn4kt",
2201
- * "name": "CI worker",
2202
- * "key_prefix": "mbx_7q2v",
2203
- * "principal_id": "svc_7q2v9x6m3n8p5r4t",
2204
- * "tags": {
2205
- * "owner": "product"
2206
- * },
2207
- * "created_at": "2026-06-15T14:30:00Z",
2208
- * "updated_at": "2026-06-15T14:30:00Z",
2209
- * "key": "mbx_7q2v9k1m_redacted"
2210
- * }
2211
- */
2212
- APIKeyCreateResult: {
2213
- /** @description Unique identifier for the created API key. */
2214
- id: string;
2215
- /** @description Human-readable name for the key. */
2216
- name: string;
2217
- /** @description First 8 characters of the key for identification. */
2218
- key_prefix: string;
2219
- /** @description Principal this key authenticates as. */
2220
- principal_id: string;
2221
- /** @description Optional role whose permissions cap this key below its principal's full grants. */
2222
- scope_role_id?: string;
2223
- /** @description For organization-level keys, the system role the key acts as org-wide (e.g. `Admin`). Absent for project-scoped keys. */
2224
- org_role?: string;
2265
+ verdict?: "pass" | "fail";
2266
+ /** @description Verdict document for `check`-kind steps: `verdict`, `on_fail`, `checks` (per-assertion results — name, kind, pass, expr or judge reason, judge identity, evidence refs), `failed` (red assertion names), and `overridden_by` / `gate` records when an approval gate resolved the verdict. */
2267
+ verdict_detail?: {
2268
+ [key: string]: unknown;
2269
+ };
2225
2270
  /**
2226
2271
  * Format: date-time
2227
- * @description Timestamp when this key expires. Omitted if it does not expire.
2272
+ * @description Time the step entered `running`; null until the step starts.
2228
2273
  */
2229
- expires_at?: string;
2274
+ started_at?: string | null;
2230
2275
  /**
2231
2276
  * Format: date-time
2232
- * @description Timestamp of the most recent authenticated request using this key.
2277
+ * @description Time the step reached a terminal status; null until the step completes.
2233
2278
  */
2234
- last_used_at?: string;
2235
- /** @description Labels applied to the newly created key. */
2236
- tags?: components["schemas"]["TagMap"];
2279
+ completed_at?: string | null;
2237
2280
  /**
2238
2281
  * Format: date-time
2239
- * @description Timestamp when this key was created.
2282
+ * @description Record creation timestamp.
2240
2283
  */
2241
2284
  created_at: string;
2242
2285
  /**
2243
2286
  * Format: date-time
2244
- * @description Timestamp when this key was last updated.
2287
+ * @description Last update timestamp.
2245
2288
  */
2246
2289
  updated_at: string;
2247
- /** @description The raw API key. Returned only once at creation — store it securely immediately. */
2248
- key: string;
2249
2290
  };
2250
- /**
2251
- * @example {
2252
- * "items": [
2253
- * {
2254
- * "id": "cred_1jz8q2m7xp9vn4kt",
2255
- * "name": "CI worker",
2256
- * "key_prefix": "mbx_7q2v",
2257
- * "principal_id": "svc_7q2v9x6m3n8p5r4t",
2258
- * "tags": {
2259
- * "owner": "product"
2260
- * },
2261
- * "created_at": "2026-06-15T14:30:00Z",
2262
- * "updated_at": "2026-06-15T14:30:00Z"
2263
- * }
2264
- * ],
2265
- * "has_more": false
2266
- * }
2267
- */
2268
- APIKeyListResponse: {
2269
- /** @description The list of results for this page. */
2270
- items: components["schemas"]["APIKey"][];
2271
- /** @description Opaque cursor to pass as `cursor` on the next request. Absent when `has_more` is false. */
2272
- next_cursor?: string;
2273
- /** @description Whether additional pages are available. */
2274
- has_more: boolean;
2291
+ RunStartedPayload: {
2292
+ loop_id?: string;
2293
+ loop_version_id?: string;
2294
+ source_event_id?: string;
2295
+ trigger_id?: string;
2296
+ } & {
2297
+ [key: string]: unknown;
2275
2298
  };
2276
- /**
2277
- * @description Request shape for creating a project API key bound to a machine principal. The key authenticates as that principal; permissions are managed by assigning roles to the principal, not by granting permissions to the key.
2278
- * @example {
2279
- * "name": "CI worker",
2280
- * "principal_id": "svc_7q2v9x6m3n8p5r4t",
2281
- * "tags": {
2282
- * "owner": "product"
2283
- * }
2284
- * }
2285
- */
2286
- CreateAPIKeyRequest: {
2287
- /** @description Human-readable label, unique within the project. */
2288
- name: string;
2289
- /** @description Principal this key authenticates as. */
2290
- principal_id: string;
2291
- /** @description Optional role whose permissions cap this key below its principal's full grants. */
2292
- scope_role_id?: string;
2299
+ WaitPayload: {
2300
+ step?: string;
2301
+ /** @description Source event type or pattern this wait is listening for. */
2302
+ event_type?: string;
2303
+ /** @description Optional source identifier that scopes event matching. */
2304
+ source_id?: string;
2305
+ /** @description Optional matcher fields required on the source event. */
2306
+ match?: {
2307
+ [key: string]: unknown;
2308
+ };
2309
+ wait_id?: string;
2310
+ wait_kind?: string;
2293
2311
  /**
2294
2312
  * Format: date-time
2295
- * @description Optional hard expiry. Omit for a non-expiring key.
2313
+ * @description Wall-clock expiry for the wait, when bounded.
2296
2314
  */
2297
2315
  expires_at?: string;
2298
- /** @description Labels to apply to the new API key. */
2299
- tags?: components["schemas"]["TagMap"];
2300
- };
2301
- /**
2302
- * @description Request shape for creating an organization-level API key. The key authenticates as the organization's system principal and acts with the chosen `role` applied org-wide across every project.
2303
- * @example {
2304
- * "name": "Org automation",
2316
+ /** Format: date-time */
2317
+ deadline?: string;
2318
+ subject?: {
2319
+ [key: string]: unknown;
2320
+ };
2321
+ } & {
2322
+ [key: string]: unknown;
2323
+ };
2324
+ RunResumedPayload: {
2325
+ step?: string;
2326
+ reason?: string;
2327
+ /** @enum {string} */
2328
+ recovery_action?: "resume" | "retry";
2329
+ attempt?: number;
2330
+ } & {
2331
+ [key: string]: unknown;
2332
+ };
2333
+ RunCompletedPayload: {
2334
+ output?: {
2335
+ [key: string]: unknown;
2336
+ };
2337
+ } & {
2338
+ [key: string]: unknown;
2339
+ };
2340
+ RunFailedPayload: {
2341
+ error?: string;
2342
+ error_type?: string;
2343
+ step?: string;
2344
+ } & {
2345
+ [key: string]: unknown;
2346
+ };
2347
+ RunCancelledPayload: {
2348
+ reason?: string;
2349
+ } & {
2350
+ [key: string]: unknown;
2351
+ };
2352
+ StepStartedPayload: {
2353
+ step?: string;
2354
+ kind?: string;
2355
+ agent_id?: string;
2356
+ } & {
2357
+ [key: string]: unknown;
2358
+ };
2359
+ StepCompletedPayload: {
2360
+ step?: string;
2361
+ output?: {
2362
+ [key: string]: unknown;
2363
+ };
2364
+ } & {
2365
+ [key: string]: unknown;
2366
+ };
2367
+ StepFailedPayload: {
2368
+ step?: string;
2369
+ error?: string;
2370
+ error_type?: string;
2371
+ } & {
2372
+ [key: string]: unknown;
2373
+ };
2374
+ StepRetriedPayload: {
2375
+ step?: string;
2376
+ kind?: string;
2377
+ attempt?: number;
2378
+ max_attempts?: number;
2379
+ /**
2380
+ * @description Retry source. `step_policy` means the authored step retry policy was consumed, `transient` means Mobius retried a transient provider failure before spending step retry budget, and `run_recovery` means an operator resumed or retried a failed run in place.
2381
+ * @enum {string}
2382
+ */
2383
+ retry_scope?: "step_policy" | "transient" | "run_recovery";
2384
+ /**
2385
+ * @description Operator intent for a `run_recovery` retry. Named consistently with `RunResumedPayload.recovery_action`.
2386
+ * @enum {string}
2387
+ */
2388
+ recovery_action?: "resume" | "retry";
2389
+ error_type?: string;
2390
+ error?: string;
2391
+ } & {
2392
+ [key: string]: unknown;
2393
+ };
2394
+ StepResumedPayload: {
2395
+ step?: string;
2396
+ kind?: string;
2397
+ } & {
2398
+ [key: string]: unknown;
2399
+ };
2400
+ StepSkippedPayload: {
2401
+ step?: string;
2402
+ kind?: string;
2403
+ reason?: string;
2404
+ } & {
2405
+ [key: string]: unknown;
2406
+ };
2407
+ ActionCalledPayload: {
2408
+ action?: string;
2409
+ step?: string;
2410
+ parameters?: {
2411
+ [key: string]: unknown;
2412
+ };
2413
+ } & {
2414
+ [key: string]: unknown;
2415
+ };
2416
+ ActionCompletedPayload: {
2417
+ action?: string;
2418
+ step?: string;
2419
+ result?: {
2420
+ [key: string]: unknown;
2421
+ };
2422
+ } & {
2423
+ [key: string]: unknown;
2424
+ };
2425
+ ActionFailedPayload: {
2426
+ action?: string;
2427
+ step?: string;
2428
+ error?: string;
2429
+ error_type?: string;
2430
+ } & {
2431
+ [key: string]: unknown;
2432
+ };
2433
+ ActionRetriedPayload: {
2434
+ action?: string;
2435
+ attempt?: number;
2436
+ max_attempts?: number;
2437
+ } & {
2438
+ [key: string]: unknown;
2439
+ };
2440
+ ActionResultPayload: {
2441
+ action?: string;
2442
+ result?: {
2443
+ [key: string]: unknown;
2444
+ };
2445
+ } & {
2446
+ [key: string]: unknown;
2447
+ };
2448
+ CheckVerdictPayload: {
2449
+ step?: string;
2450
+ verdict?: string;
2451
+ on_fail?: string;
2452
+ failed?: string[];
2453
+ } & {
2454
+ [key: string]: unknown;
2455
+ };
2456
+ InteractionRespondedPayload: {
2457
+ interaction_id?: string;
2458
+ response?: {
2459
+ [key: string]: unknown;
2460
+ };
2461
+ responder?: {
2462
+ [key: string]: unknown;
2463
+ };
2464
+ } & {
2465
+ [key: string]: unknown;
2466
+ };
2467
+ WaitResumedPayload: {
2468
+ step?: string;
2469
+ wait_id?: string;
2470
+ payload?: {
2471
+ [key: string]: unknown;
2472
+ };
2473
+ } & {
2474
+ [key: string]: unknown;
2475
+ };
2476
+ WaitTimedOutPayload: {
2477
+ step?: string;
2478
+ wait_id?: string;
2479
+ reason?: string;
2480
+ } & {
2481
+ [key: string]: unknown;
2482
+ };
2483
+ BudgetExceededPayload: {
2484
+ step?: string;
2485
+ credit_spent?: number;
2486
+ credit_budget?: number;
2487
+ percent_used?: number;
2488
+ } & {
2489
+ [key: string]: unknown;
2490
+ };
2491
+ ProgressStalledPayload: {
2492
+ step?: string;
2493
+ tool?: string;
2494
+ duplicate_calls?: number;
2495
+ limit?: number;
2496
+ } & {
2497
+ [key: string]: unknown;
2498
+ };
2499
+ LimitReachedPayload: {
2500
+ step?: string;
2501
+ limit_kind?: string;
2502
+ used?: number;
2503
+ limit?: number;
2504
+ } & {
2505
+ [key: string]: unknown;
2506
+ };
2507
+ ArtifactCreatedPayload: {
2508
+ artifact_id?: string;
2509
+ name?: string;
2510
+ content_type?: string;
2511
+ step?: string;
2512
+ } & {
2513
+ [key: string]: unknown;
2514
+ };
2515
+ /** @description Typed payloads for common durable run event types. The containing `LoopRunEvent.event_type` selects the payload shape; payload objects do not duplicate that discriminator because some payloads use fields such as `event_type` for their own lifecycle data (for example, the external matcher recorded by `wait.opened`). */
2516
+ RunEventPayload: components["schemas"]["RunStartedPayload"] | components["schemas"]["WaitPayload"] | components["schemas"]["RunResumedPayload"] | components["schemas"]["RunCompletedPayload"] | components["schemas"]["RunFailedPayload"] | components["schemas"]["RunCancelledPayload"] | components["schemas"]["StepStartedPayload"] | components["schemas"]["StepCompletedPayload"] | components["schemas"]["StepFailedPayload"] | components["schemas"]["StepRetriedPayload"] | components["schemas"]["StepResumedPayload"] | components["schemas"]["StepSkippedPayload"] | components["schemas"]["ActionCalledPayload"] | components["schemas"]["ActionCompletedPayload"] | components["schemas"]["ActionFailedPayload"] | components["schemas"]["ActionRetriedPayload"] | components["schemas"]["ActionResultPayload"] | components["schemas"]["CheckVerdictPayload"] | components["schemas"]["InteractionRespondedPayload"] | components["schemas"]["WaitResumedPayload"] | components["schemas"]["WaitTimedOutPayload"] | components["schemas"]["BudgetExceededPayload"] | components["schemas"]["ProgressStalledPayload"] | components["schemas"]["LimitReachedPayload"] | components["schemas"]["ArtifactCreatedPayload"] | components["schemas"]["GenericEventPayload"];
2517
+ /**
2518
+ * @description One durable event emitted while a loop run progresses.
2519
+ * @example {
2520
+ * "id": "run_8q5m2x9v7p3n4r6t:evt:000001",
2521
+ * "run_id": "run_8q5m2x9v7p3n4r6t",
2522
+ * "sequence": 1,
2523
+ * "event_type": "step.started",
2524
+ * "step_id": "run_8q5m2x9v7p3n4r6t:review",
2525
+ * "step_key": "review",
2526
+ * "payload": {
2527
+ * "agent_id": "agent_5n8p2q7m4x9r3v6t"
2528
+ * },
2529
+ * "created_at": "2026-06-15T14:30:10Z"
2530
+ * }
2531
+ */
2532
+ LoopRunEvent: {
2533
+ /** @description Stable event identifier. */
2534
+ id: string;
2535
+ /** @description Run this event belongs to. */
2536
+ run_id: string;
2537
+ /**
2538
+ * Format: int64
2539
+ * @description Monotonic per-run sequence number used for ordering and resume.
2540
+ */
2541
+ sequence: number;
2542
+ /**
2543
+ * @description Event type from the run-stream taxonomy (e.g. `run.started`, `step.completed`, `wait.opened`, `action.called`, `action.completed`, `action.failed`, `artifact.created`, `limit.reached`).
2544
+ *
2545
+ * Guardrail events: `run.budget_exceeded` fires when the budget halts the run at a checkpoint (payload: `credit_budget`, `credit_spent`, `percent_used`, plus the `step` it halted before). Metered spend is recorded in the billing ledger and denormalized onto the run's `credit_spent`; it is not represented as a timeline event.
2546
+ */
2547
+ event_type: string;
2548
+ /** @description ID of the step this event belongs to, when applicable. */
2549
+ step_id?: string | null;
2550
+ /** @description Legacy alias for the loop step ID this event belongs to, when applicable. */
2551
+ step_key?: string | null;
2552
+ payload?: components["schemas"]["RunEventPayload"];
2553
+ /**
2554
+ * Format: date-time
2555
+ * @description Server timestamp when the event was recorded.
2556
+ */
2557
+ created_at: string;
2558
+ };
2559
+ /**
2560
+ * @description Stored API credential metadata for loop and service access. The raw secret is never returned here; use this object to list, audit, expire, or identify keys by prefix without exposing tokens.
2561
+ * @example {
2562
+ * "id": "cred_1jz8q2m7xp9vn4kt",
2563
+ * "name": "CI worker",
2564
+ * "key_prefix": "mbx_7q2v",
2565
+ * "principal_id": "svc_7q2v9x6m3n8p5r4t",
2566
+ * "tags": {
2567
+ * "owner": "product"
2568
+ * },
2569
+ * "created_at": "2026-06-15T14:30:00Z",
2570
+ * "updated_at": "2026-06-15T14:30:00Z"
2571
+ * }
2572
+ */
2573
+ APIKey: {
2574
+ /** @description Unique identifier for this API key. */
2575
+ id: string;
2576
+ /** @description Human-readable label, unique within the project. */
2577
+ name: string;
2578
+ /** @description First 8 characters of the key, used to identify it without exposing the secret. */
2579
+ key_prefix: string;
2580
+ /** @description Principal this key authenticates as. */
2581
+ principal_id: string;
2582
+ /** @description Optional role whose permissions cap this key below its principal's full grants. */
2583
+ scope_role_id?: string;
2584
+ /** @description For organization-level keys, the system role the key acts as org-wide (e.g. `Admin`). Absent for project-scoped keys. */
2585
+ org_role?: string;
2586
+ /**
2587
+ * Format: date-time
2588
+ * @description Hard expiry timestamp. Requests using an expired key receive 401.
2589
+ */
2590
+ expires_at?: string;
2591
+ /**
2592
+ * Format: date-time
2593
+ * @description Timestamp of the most recent authenticated request using this key.
2594
+ */
2595
+ last_used_at?: string;
2596
+ /** @description Free-form labels used for filtering, ownership, or rotation policy. */
2597
+ tags?: components["schemas"]["TagMap"];
2598
+ /**
2599
+ * Format: date-time
2600
+ * @description Timestamp when this key was created.
2601
+ */
2602
+ created_at: string;
2603
+ /**
2604
+ * Format: date-time
2605
+ * @description Timestamp when this key was last updated.
2606
+ */
2607
+ updated_at: string;
2608
+ };
2609
+ /**
2610
+ * @description Returned only on key creation. Contains the raw `key` value which is not retrievable after this response.
2611
+ * @example {
2612
+ * "id": "cred_1jz8q2m7xp9vn4kt",
2613
+ * "name": "CI worker",
2614
+ * "key_prefix": "mbx_7q2v",
2615
+ * "principal_id": "svc_7q2v9x6m3n8p5r4t",
2616
+ * "tags": {
2617
+ * "owner": "product"
2618
+ * },
2619
+ * "created_at": "2026-06-15T14:30:00Z",
2620
+ * "updated_at": "2026-06-15T14:30:00Z",
2621
+ * "key": "mbx_7q2v9k1m_redacted"
2622
+ * }
2623
+ */
2624
+ APIKeyCreateResult: {
2625
+ /** @description Unique identifier for the created API key. */
2626
+ id: string;
2627
+ /** @description Human-readable name for the key. */
2628
+ name: string;
2629
+ /** @description First 8 characters of the key for identification. */
2630
+ key_prefix: string;
2631
+ /** @description Principal this key authenticates as. */
2632
+ principal_id: string;
2633
+ /** @description Optional role whose permissions cap this key below its principal's full grants. */
2634
+ scope_role_id?: string;
2635
+ /** @description For organization-level keys, the system role the key acts as org-wide (e.g. `Admin`). Absent for project-scoped keys. */
2636
+ org_role?: string;
2637
+ /**
2638
+ * Format: date-time
2639
+ * @description Timestamp when this key expires. Omitted if it does not expire.
2640
+ */
2641
+ expires_at?: string;
2642
+ /**
2643
+ * Format: date-time
2644
+ * @description Timestamp of the most recent authenticated request using this key.
2645
+ */
2646
+ last_used_at?: string;
2647
+ /** @description Labels applied to the newly created key. */
2648
+ tags?: components["schemas"]["TagMap"];
2649
+ /**
2650
+ * Format: date-time
2651
+ * @description Timestamp when this key was created.
2652
+ */
2653
+ created_at: string;
2654
+ /**
2655
+ * Format: date-time
2656
+ * @description Timestamp when this key was last updated.
2657
+ */
2658
+ updated_at: string;
2659
+ /** @description The raw API key. Returned only once at creation — store it securely immediately. */
2660
+ key: string;
2661
+ };
2662
+ /**
2663
+ * @example {
2664
+ * "items": [
2665
+ * {
2666
+ * "id": "cred_1jz8q2m7xp9vn4kt",
2667
+ * "name": "CI worker",
2668
+ * "key_prefix": "mbx_7q2v",
2669
+ * "principal_id": "svc_7q2v9x6m3n8p5r4t",
2670
+ * "tags": {
2671
+ * "owner": "product"
2672
+ * },
2673
+ * "created_at": "2026-06-15T14:30:00Z",
2674
+ * "updated_at": "2026-06-15T14:30:00Z"
2675
+ * }
2676
+ * ],
2677
+ * "has_more": false
2678
+ * }
2679
+ */
2680
+ APIKeyListResponse: {
2681
+ /** @description The list of results for this page. */
2682
+ items: components["schemas"]["APIKey"][];
2683
+ /** @description Opaque cursor to pass as `cursor` on the next request. Absent when `has_more` is false. */
2684
+ next_cursor?: string;
2685
+ /** @description Whether additional pages are available. */
2686
+ has_more: boolean;
2687
+ };
2688
+ /**
2689
+ * @description Request shape for creating a project API key bound to a machine principal. The key authenticates as that principal; permissions are managed by assigning roles to the principal, not by granting permissions to the key.
2690
+ * @example {
2691
+ * "name": "CI worker",
2692
+ * "principal_id": "svc_7q2v9x6m3n8p5r4t",
2693
+ * "tags": {
2694
+ * "owner": "product"
2695
+ * }
2696
+ * }
2697
+ */
2698
+ CreateAPIKeyRequest: {
2699
+ /** @description Human-readable label, unique within the project. */
2700
+ name: string;
2701
+ /** @description Principal this key authenticates as. */
2702
+ principal_id: string;
2703
+ /** @description Optional role whose permissions cap this key below its principal's full grants. */
2704
+ scope_role_id?: string;
2705
+ /**
2706
+ * Format: date-time
2707
+ * @description Optional hard expiry. Omit for a non-expiring key.
2708
+ */
2709
+ expires_at?: string;
2710
+ /** @description Labels to apply to the new API key. */
2711
+ tags?: components["schemas"]["TagMap"];
2712
+ };
2713
+ /**
2714
+ * @description Request shape for creating an organization-level API key. The key authenticates as the organization's system principal and acts with the chosen `role` applied org-wide across every project.
2715
+ * @example {
2716
+ * "name": "Org automation",
2305
2717
  * "role": "Admin",
2306
2718
  * "tags": {
2307
2719
  * "owner": "platform"
@@ -5690,120 +6102,24 @@ export interface components {
5690
6102
  /** @description Free-form JSON object delivered to the HTTP trigger. The payload is recorded on the source event and forwarded to the run as the event. */
5691
6103
  HTTPTriggerDeliveryRequest: {
5692
6104
  [key: string]: unknown;
5693
- };
5694
- /** @description Synchronous receipt for an inbound HTTP-trigger delivery. The trigger dispatch and run start happen asynchronously after this response. Clients can poll via `GET /v1/projects/{project_handle}/runs?source_event_id=<source_event_id>` to discover the run once the source-event processor reserves it. */
5695
- HTTPTriggerDeliveryResult: {
5696
- /** @description Durable source-event id (also the `dedup_key` seed). Stable across retries with the same `Idempotency-Key`. */
5697
- source_event_id: string;
5698
- /**
5699
- * @description Acceptance status of the source-event row. The only synchronous success value is `accepted`; processing happens asynchronously after the source event is durable.
5700
- * @enum {string}
5701
- */
5702
- status: "accepted";
5703
- /** @description True when an existing source-event row was returned for the same idempotency key. */
5704
- deduped?: boolean;
5705
- };
5706
- /**
5707
- * @description Body for `POST /v1/projects/{project_handle}/loops/{resource_id}/runs`. All fields are optional; an empty body starts a run with an empty event/config envelope and no attribution.
5708
- * @example {
5709
- * "event": {
5710
- * "issue_id": "42",
5711
- * "repository": "deepnoodle-ai/mobius-cloud"
5712
- * },
5713
- * "config": {
5714
- * "priority": "normal"
5715
- * },
5716
- * "source": {
5717
- * "type": "api",
5718
- * "id": "review-service",
5719
- * "label": "review-service"
5720
- * },
5721
- * "idempotency_key": "review-service:issue-42",
5722
- * "credit_budget": 1000
5723
- * }
5724
- */
5725
- StartLoopRunRequest: {
5726
- /** @description Exact event object that starts the run. Manual/API starts use this object the same way integration, HTTP, and schedule triggers do. Templates reference it via `${{ event.<key> }}`. */
5727
- event?: {
5728
- [key: string]: unknown;
5729
- };
5730
- /** @description Optional event metadata supplied by the caller. Mobius also adds provenance such as run, loop, source, trigger, and source-event ids. */
5731
- meta?: {
5732
- [key: string]: unknown;
5733
- };
5734
- /** @description Optional static or caller-provided configuration for handling the event. Templates reference it via `config.*`. */
5735
- config?: {
5736
- [key: string]: unknown;
5737
- };
5738
- /** @description Attribution for the call that starts the run. */
5739
- source?: components["schemas"]["LoopRunSource"];
5740
- /** @description Caller-supplied idempotency key, scoped to (org, project). Repeat calls with the same `idempotency_key` while the prior run is still non-terminal return the existing run (same `id`). A repeat after the prior run terminated returns `409 Conflict` with code `idempotency_key_conflict` and details containing the existing run id and its terminal status. */
5741
- idempotency_key?: string;
5742
- /**
5743
- * Format: double
5744
- * @description Per-run budget override in US dollars (1 credit = $0.01). Overrides the loop spec's `limits` budget for this run only. Mutually exclusive with `credit_budget` — setting both is a `400`. Values finer than 0.001 credit ($0.00001) are rejected. The run halts at the next checkpoint (step boundary or agent tool iteration) once spend reaches the budget; enforcement granularity is one model call or metered action.
5745
- */
5746
- budget_usd?: number;
5747
- /**
5748
- * Format: int64
5749
- * @description Per-run budget override in whole credits (1 credit = $0.01). Same ceiling semantics as `budget_usd`; set exactly one.
5750
- */
5751
- credit_budget?: number;
5752
- };
5753
- /**
5754
- * @description Body for the cancellation endpoint. All fields optional.
5755
- * @example {
5756
- * "reason": "superseded by manual remediation"
5757
- * }
5758
- */
5759
- CancelLoopRunRequest: {
5760
- /** @description Human-readable cancellation reason recorded on the run. */
5761
- reason?: string;
5762
- };
5763
- /**
5764
- * @description Body for resuming a suspended loop step.
5765
- * @example {
5766
- * "step_key": "wait_for_external_result",
5767
- * "result": {
5768
- * "status": "complete",
5769
- * "source": "ci"
5770
- * }
5771
- * }
5772
- */
5773
- SignalLoopRunRequest: {
5774
- /** @description Step key currently in `suspended` state that should resume. Must match a step declared in the run's loop version spec. */
5775
- step_key: string;
5776
- /** @description Free-form payload saved as the resumed step's output. */
5777
- result?: {
5778
- [key: string]: unknown;
5779
- };
5780
- };
5781
- /** @description Optional attribution for the call that started this run. Triggers and HTTP trigger dispatch populate `trigger_id` and `trigger_fire_id`. API callers usually only set `type` and `id`. */
5782
- LoopRunSource: {
6105
+ };
6106
+ /** @description Synchronous receipt for an inbound HTTP-trigger delivery. The trigger dispatch and run start happen asynchronously after this response. Clients can poll via `GET /v1/projects/{project_handle}/runs?source_event_id=<source_event_id>` to discover the run once the source-event processor reserves it. */
6107
+ HTTPTriggerDeliveryResult: {
6108
+ /** @description Durable source-event id (also the `dedup_key` seed). Stable across retries with the same `Idempotency-Key`. */
6109
+ source_event_id: string;
5783
6110
  /**
5784
- * @description Source category for the run start: `api`, `trigger`, `manual`, or `signal`.
6111
+ * @description Acceptance status of the source-event row. The only synchronous success value is `accepted`; processing happens asynchronously after the source event is durable.
5785
6112
  * @enum {string}
5786
6113
  */
5787
- type?: "api" | "trigger" | "manual" | "signal";
5788
- /** @description Identifier within the source type's namespace. */
5789
- id?: string;
5790
- /** @description Display label. */
5791
- label?: string;
5792
- /** @description Trigger that fired this run, if any. */
5793
- readonly trigger_id?: string;
6114
+ status: "accepted";
6115
+ /** @description True when an existing source-event row was returned for the same idempotency key. */
6116
+ deduped?: boolean;
5794
6117
  };
5795
6118
  /**
5796
- * @description One loop run record.
6119
+ * @description Body for `POST /v1/projects/{project_handle}/loops/{resource_id}/runs`. All fields are optional; an empty body starts a run with an empty event/config envelope and no attribution.
5797
6120
  * @example {
5798
- * "id": "run_8q5m2x9v7p3n4r6t",
5799
- * "loop_id": "loop_9q2m7x5v3p8n4r6t",
5800
- * "loop_name": "Daily security check",
5801
- * "loop_version_id": "lver_4v9n2q7m5x8p3r6t",
5802
- * "loop_version": 3,
5803
- * "status": "running",
5804
- * "credit_budget": 1000,
5805
- * "credit_spent": 12.5,
5806
6121
  * "event": {
6122
+ * "issue_id": "42",
5807
6123
  * "repository": "deepnoodle-ai/mobius-cloud"
5808
6124
  * },
5809
6125
  * "config": {
@@ -5814,506 +6130,273 @@ export interface components {
5814
6130
  * "id": "review-service",
5815
6131
  * "label": "review-service"
5816
6132
  * },
5817
- * "created_at": "2026-06-15T14:30:00Z",
5818
- * "updated_at": "2026-06-15T14:31:00Z"
6133
+ * "idempotency_key": "review-service:issue-42",
6134
+ * "credit_budget": 1000
5819
6135
  * }
5820
6136
  */
5821
- LoopRun: {
5822
- /** @description Stable run identifier. */
5823
- id: string;
5824
- /** @description Loop this run belongs to. */
5825
- loop_id: string;
5826
- /** @description Human-readable name of the loop this run belongs to. */
5827
- loop_name?: string;
5828
- /** @description LoopVersion record this run is executing. */
5829
- loop_version_id: string;
5830
- /** @description Version number of the LoopVersion this run is executing. */
5831
- loop_version: number;
5832
- /** @description Current lifecycle state of this run. */
5833
- status: components["schemas"]["LoopRunStatus"];
5834
- /** @description Gate that placed this run in the durable queue. Present only while `status` is `queued`. */
5835
- queue_reason?: components["schemas"]["LoopRunQueueReason"];
5836
- /** @description Org-wide concurrent-run ceiling stamped at run start. Present when the run was evaluated against a plan concurrency limit. */
5837
- plan_concurrency_limit?: number;
5838
- /** @description Terminal reason recorded when the run stops. */
5839
- stop_reason?: components["schemas"]["LoopRunStopReason"];
5840
- /**
5841
- * Format: double
5842
- * @description The run's budget ceiling in credits (1 credit = $0.01), with up to 3 decimal places. Resolved at run start from the StartRun override, the loop spec's `limits` block, or the trial-plan default, in that order. Absent when the run is unbounded.
5843
- */
5844
- credit_budget?: number;
5845
- /**
5846
- * Format: double
5847
- * @description Metered spend attributed to this run so far, in credits (up to 3 decimal places). Incremented atomically with each usage-ledger insert that carries this run's id. Counts all metered work regardless of credential source (BYOK calls count at their rate-card equivalent even though they bill zero credits).
5848
- */
5849
- credit_spent?: number;
5850
- /** @description Run-wide cap on agent turns across all steps, from the loop spec's `limits.max_agent_turns`. Absent when unbounded. */
5851
- max_agent_turns?: number;
5852
- /** @description Number of agent turns started for this run so far. Compared against `max_agent_turns` when that cap is set. */
5853
- agent_turns_used?: number;
5854
- /** @description Exact safe/canonical event object that started the run, reachable in templates at `event.*`. */
6137
+ StartLoopRunRequest: {
6138
+ /** @description Exact event object that starts the run. Manual/API starts use this object the same way integration, HTTP, and schedule triggers do. Templates reference it via `${{ event.<key> }}`. */
5855
6139
  event?: {
5856
6140
  [key: string]: unknown;
5857
6141
  };
5858
- /** @description Run and trigger metadata envelope, reachable in templates at `${{ meta.* }}`: `run_id`, `loop_id`, `source`, `trigger`, plus trigger-supplied facts such as `event_type`, `source_event_id`, and `scheduled_at`. */
6142
+ /** @description Optional event metadata supplied by the caller. Mobius also adds provenance such as run, loop, source, trigger, and source-event ids. */
5859
6143
  meta?: {
5860
6144
  [key: string]: unknown;
5861
6145
  };
5862
- /** @description Optional static or caller-provided configuration resolved when the run started, reachable in templates at `config.*`. */
6146
+ /** @description Optional static or caller-provided configuration for handling the event. Templates reference it via `config.*`. */
5863
6147
  config?: {
5864
6148
  [key: string]: unknown;
5865
6149
  };
5866
- /** @description Final result payload. When the loop declares an `output:` block this is that block rendered at completion; otherwise it is the run's accumulated step outputs, keyed by step id. Absent until the run terminates successfully. */
5867
- result?: {
5868
- [key: string]: unknown;
5869
- };
5870
- /** @description Source that started this run. */
6150
+ /** @description Attribution for the call that starts the run. */
5871
6151
  source?: components["schemas"]["LoopRunSource"];
5872
- /** @description Run that triggered this run via an `loop` step. Present only on child runs; absent for top-level runs. */
5873
- parent_run_id?: string;
5874
- /** @description Loop that triggered this run via an `loop` step. Present only on child runs. */
5875
- parent_loop_id?: string;
5876
- /** @description Step key within the parent run's loop that triggered this run. Present only on child runs. */
5877
- parent_step_key?: string;
5878
- /** @description Human-readable failure summary; populated on `failed` runs. */
5879
- error_message?: string;
5880
- /** @description Machine-readable failure classification when available. */
5881
- error_type?: string;
5882
- /**
5883
- * Format: date-time
5884
- * @description Scheduled wake time for a suspended run.
5885
- */
5886
- wake_at?: string;
5887
- /**
5888
- * Format: date-time
5889
- * @description Deadline after which the loop reaper fails the run.
5890
- */
5891
- wall_clock_deadline_at?: string;
5892
- /**
5893
- * Format: date-time
5894
- * @description Time the engine moved the run to `running`.
5895
- */
5896
- started_at?: string;
5897
- /**
5898
- * Format: date-time
5899
- * @description Time the run reached a terminal status.
5900
- */
5901
- completed_at?: string;
5902
- /**
5903
- * Format: date-time
5904
- * @description Record creation timestamp.
5905
- */
5906
- created_at: string;
5907
- /**
5908
- * Format: date-time
5909
- * @description Last update timestamp.
5910
- */
5911
- updated_at: string;
5912
- };
5913
- /**
5914
- * @description Run lifecycle state: `queued`, `running`, `suspended`, `completed`, `failed`, or `cancelled`.
5915
- * @enum {string}
5916
- */
5917
- LoopRunStatus: "queued" | "running" | "suspended" | "completed" | "failed" | "cancelled";
5918
- /**
5919
- * @description Why a run is waiting in the queue. `plan_concurrency` means the organization's current plan has no active-run capacity available. `loop_policy` and `trigger_concurrency` mean authored concurrency policy deferred the run.
5920
- * @enum {string}
5921
- */
5922
- LoopRunQueueReason: "plan_concurrency" | "loop_policy" | "trigger_concurrency";
5923
- /**
5924
- * @description Why a run stopped. Set exactly once when the run reaches a terminal status; absent on non-terminal runs. `status` carries the lifecycle state and `error_type` classifies the error when one occurred; `stop_reason` classifies the stop itself.
5925
- *
5926
- * Grouping: `completed` is the success terminal. `step_failed`, `check_failed`, and `gate_rejected` mean the work failed (an error, a failed verification, or a human rejection at a gate). `budget_exceeded`, `turn_limit_reached`, `wall_clock_exceeded`, `step_limit_reached`, and `progress_stalled` mean a configured guardrail halted the run — the limit worked; the loop did not break. `cancelled` and `replaced` mean somebody (or a concurrency policy) chose to stop it.
5927
- * @enum {string}
5928
- */
5929
- LoopRunStopReason: "completed" | "step_failed" | "check_failed" | "gate_rejected" | "cancelled" | "replaced" | "wall_clock_exceeded" | "budget_exceeded" | "turn_limit_reached" | "progress_stalled" | "step_limit_reached";
5930
- /**
5931
- * @example {
5932
- * "items": [
5933
- * {
5934
- * "id": "run_8q5m2x9v7p3n4r6t",
5935
- * "loop_id": "loop_9q2m7x5v3p8n4r6t",
5936
- * "loop_version_id": "lver_4v9n2q7m5x8p3r6t",
5937
- * "loop_version": 3,
5938
- * "status": "running",
5939
- * "created_at": "2026-06-15T14:30:00Z",
5940
- * "updated_at": "2026-06-15T14:31:00Z"
5941
- * }
5942
- * ],
5943
- * "has_more": false
5944
- * }
5945
- */
5946
- LoopRunListResponse: {
5947
- /** @description The list of results for this page. */
5948
- items: components["schemas"]["LoopRun"][];
5949
- /** @description Opaque cursor for the next page; absent when no more results. */
5950
- next_cursor?: string;
5951
- /** @description True when more items exist after this page. */
5952
- has_more?: boolean;
5953
- };
5954
- /**
5955
- * @description Step type: `agent`, `action`, `sleep`, `wait_for_event`, `interaction`, `loop`, `check`, or system-materialized `cleanup`. `cleanup` appears in run step listings for terminal cleanup work but cannot be authored in a `LoopSpec`.
5956
- * @enum {string}
5957
- */
5958
- LoopRunStepKind: "agent" | "action" | "sleep" | "wait_for_event" | "interaction" | "loop" | "check" | "cleanup";
5959
- /**
5960
- * @description Step lifecycle state: `pending`, `running`, `suspended`, `completed`, `failed`, `skipped`, or `cancelled`.
5961
- * @enum {string}
5962
- */
5963
- LoopRunStepStatus: "pending" | "running" | "suspended" | "completed" | "failed" | "skipped" | "cancelled";
5964
- /**
5965
- * @description One execution step inside a loop run.
5966
- * @example {
5967
- * "id": "run_8q5m2x9v7p3n4r6t:review",
5968
- * "run_id": "run_8q5m2x9v7p3n4r6t",
5969
- * "step_key": "review",
5970
- * "step_name": "Review pull requests",
5971
- * "kind": "agent",
5972
- * "status": "running",
5973
- * "seq": 0,
5974
- * "attempt": 1,
5975
- * "inputs": {
5976
- * "repository": "deepnoodle-ai/mobius-cloud"
5977
- * },
5978
- * "created_at": "2026-06-15T14:30:00Z",
5979
- * "updated_at": "2026-06-15T14:31:00Z"
5980
- * }
5981
- */
5982
- LoopRunStep: {
5983
- /** @description Stable step identifier. */
5984
- id: string;
5985
- /** @description Run this step belongs to. */
5986
- run_id: string;
5987
- /** @description Stable key for this step within its loop version. */
5988
- step_key: string;
5989
- /** @description Display name from the authored spec, when present. */
5990
- step_name?: string;
5991
- /** @description Step kind copied from the authored spec or system cleanup step. */
5992
- kind: components["schemas"]["LoopRunStepKind"];
5993
- /** @description Current lifecycle state of this run step. */
5994
- status: components["schemas"]["LoopRunStepStatus"];
5995
- /**
5996
- * Format: int64
5997
- * @description Zero-indexed ordinal of this step within its run.
5998
- */
5999
- seq: number;
6000
- /** @description Number of times this step has been attempted. */
6001
- attempt: number;
6002
- /** @description Resolved inputs passed into the step, after template rendering. */
6003
- inputs?: {
6004
- [key: string]: unknown;
6005
- };
6006
- /** @description Authored step parameters, before template rendering. */
6007
- parameters?: {
6008
- [key: string]: unknown;
6009
- };
6010
- /** @description Step output (shape varies by kind); absent until completion. Downstream step templates reach this value at `${{ steps.<id>.output }}` or `${{ steps[0].output }}`. */
6011
- result?: unknown;
6012
- /** @description Worker job that executed this step, when applicable. */
6013
- job_id?: string | null;
6014
- /** @description Wait record this step is suspended on, when applicable. */
6015
- wait_id?: string | null;
6016
- /** @description Session the agent ran in, for `agent`-kind steps. Present once the step has started a turn; links the step to its conversation so the UI can open the transcript with this step's messages highlighted. */
6017
- session_id?: string;
6018
- /** @description Agent that executed this step, for `agent`-kind steps. */
6019
- agent_id?: string;
6020
- /** @description Most recent AgentTurn this step ran (its latest attempt), for `agent`-kind steps. Resolves to the step's messages within the session via their `turn_id`. */
6021
- agent_turn_id?: string;
6022
- /** @description Machine-readable error code populated on failure. */
6023
- error_type?: string;
6024
- /** @description Human-readable error message populated on failure. */
6025
- error_message?: string;
6026
- /**
6027
- * @description Check outcome for `check`-kind steps: `pass` or `fail`; absent on every other kind. A failed check routed `on_fail: continue` completes the step with `verdict: fail` — status and verdict are separate axes (the step did its job: it checked).
6028
- * @enum {string}
6029
- */
6030
- verdict?: "pass" | "fail";
6031
- /** @description Verdict document for `check`-kind steps: `verdict`, `on_fail`, `checks` (per-assertion results — name, kind, pass, expr or judge reason, judge identity, evidence refs), `failed` (red assertion names), and `overridden_by` / `gate` records when an approval gate resolved the verdict. */
6032
- verdict_detail?: {
6033
- [key: string]: unknown;
6034
- };
6035
- /**
6036
- * Format: date-time
6037
- * @description Time the step entered `running`; null until the step starts.
6038
- */
6039
- started_at?: string | null;
6040
- /**
6041
- * Format: date-time
6042
- * @description Time the step reached a terminal status; null until the step completes.
6043
- */
6044
- completed_at?: string | null;
6045
- /**
6046
- * Format: date-time
6047
- * @description Record creation timestamp.
6152
+ /** @description Caller-supplied idempotency key, scoped to (org, project). Repeat calls with the same `idempotency_key` while the prior run is still non-terminal return the existing run (same `id`). A repeat after the prior run terminated returns `409 Conflict` with code `idempotency_key_conflict` and details containing the existing run id and its terminal status. */
6153
+ idempotency_key?: string;
6154
+ /**
6155
+ * Format: double
6156
+ * @description Per-run budget override in US dollars (1 credit = $0.01). Overrides the loop spec's `limits` budget for this run only. Mutually exclusive with `credit_budget` — setting both is a `400`. Values finer than 0.001 credit ($0.00001) are rejected. The run halts at the next checkpoint (step boundary or agent tool iteration) once spend reaches the budget; enforcement granularity is one model call or metered action.
6048
6157
  */
6049
- created_at: string;
6158
+ budget_usd?: number;
6050
6159
  /**
6051
- * Format: date-time
6052
- * @description Last update timestamp.
6160
+ * Format: int64
6161
+ * @description Per-run budget override in whole credits (1 credit = $0.01). Same ceiling semantics as `budget_usd`; set exactly one.
6053
6162
  */
6054
- updated_at: string;
6163
+ credit_budget?: number;
6055
6164
  };
6056
- LoopRunStepListResponse: {
6057
- /** @description Steps for this run in `seq` order. */
6058
- items: components["schemas"]["LoopRunStep"][];
6165
+ /**
6166
+ * @description Body for the cancellation endpoint. All fields optional.
6167
+ * @example {
6168
+ * "reason": "superseded by manual remediation"
6169
+ * }
6170
+ */
6171
+ CancelLoopRunRequest: {
6172
+ /** @description Human-readable cancellation reason recorded on the run. */
6173
+ reason?: string;
6059
6174
  };
6060
6175
  /**
6061
- * @description One durable event emitted while a loop run progresses.
6176
+ * @description Body for resuming or retrying a failed loop run in place. Limit fields are optional unless the prior failure was caused by that guardrail; in that case the replacement limit must be greater than the amount already consumed by the run.
6062
6177
  * @example {
6063
- * "id": "run_8q5m2x9v7p3n4r6t:evt:000001",
6064
- * "run_id": "run_8q5m2x9v7p3n4r6t",
6065
- * "sequence": 1,
6066
- * "event_type": "step.started",
6067
- * "step_id": "run_8q5m2x9v7p3n4r6t:review",
6068
- * "step_key": "review",
6069
- * "payload": {
6070
- * "agent_id": "agent_5n8p2q7m4x9r3v6t"
6071
- * },
6072
- * "created_at": "2026-06-15T14:30:10Z"
6178
+ * "reason": "transient provider failure cleared"
6073
6179
  * }
6074
6180
  */
6075
- LoopRunEvent: {
6076
- /** @description Stable event identifier. */
6077
- id: string;
6078
- /** @description Run this event belongs to. */
6079
- run_id: string;
6080
- /**
6081
- * Format: int64
6082
- * @description Monotonic per-run sequence number used for ordering and resume.
6083
- */
6084
- sequence: number;
6181
+ RecoverLoopRunRequest: {
6182
+ /** @description Human-readable recovery reason recorded on the run event log. */
6183
+ reason?: string;
6085
6184
  /**
6086
- * @description Event type from the run-stream taxonomy (e.g. `run.started`, `step.completed`, `wait.opened`, `action.called`, `action.completed`, `action.failed`, `artifact.created`, `limit.reached`).
6087
- *
6088
- * Guardrail events: `run.budget_exceeded` fires when the budget halts the run at a checkpoint (payload: `credit_budget`, `credit_spent`, `percent_used`, plus the `step` it halted before). Metered spend is recorded in the billing ledger and denormalized onto the run's `credit_spent`; it is not represented as a timeline event.
6185
+ * Format: double
6186
+ * @description Replacement run budget in US dollars (1 credit = $0.01). Mutually exclusive with `credit_budget`; setting both is a `400`.
6089
6187
  */
6090
- event_type: string;
6091
- /** @description ID of the step this event belongs to, when applicable. */
6092
- step_id?: string | null;
6093
- /** @description Legacy alias for the loop step ID this event belongs to, when applicable. */
6094
- step_key?: string | null;
6095
- payload?: components["schemas"]["RunEventPayload"];
6188
+ budget_usd?: number;
6096
6189
  /**
6097
- * Format: date-time
6098
- * @description Server timestamp when the event was recorded.
6190
+ * Format: int64
6191
+ * @description Replacement run budget in whole credits (1 credit = $0.01). Must be greater than `credit_spent`.
6099
6192
  */
6100
- created_at: string;
6101
- };
6102
- /** @description Durable run lifecycle frame. SSE messages carrying this shape include `id: <sequence>`, and that value is the only cursor clients should persist for `after_sequence` or `Last-Event-ID` resume. */
6103
- LoopRunLifecycleFrame: components["schemas"]["LoopRunEvent"];
6104
- /** @description JSON payload of a single `data:` line on the run event SSE stream. Run stream frames are lifecycle/observability events and are replayable with an SSE `id:`. Agent transcript content is delivered by the referenced session stream. */
6105
- LoopRunStreamFrame: components["schemas"]["LoopRunLifecycleFrame"];
6106
- /** @description Typed payloads for common durable run event types. The containing `LoopRunEvent.event_type` selects the payload shape; payload objects do not duplicate that discriminator because some payloads use fields such as `event_type` for their own lifecycle data (for example, the external matcher recorded by `wait.opened`). */
6107
- RunEventPayload: components["schemas"]["RunStartedPayload"] | components["schemas"]["WaitPayload"] | components["schemas"]["RunResumedPayload"] | components["schemas"]["RunCompletedPayload"] | components["schemas"]["RunFailedPayload"] | components["schemas"]["RunCancelledPayload"] | components["schemas"]["StepStartedPayload"] | components["schemas"]["StepCompletedPayload"] | components["schemas"]["StepFailedPayload"] | components["schemas"]["StepRetriedPayload"] | components["schemas"]["StepResumedPayload"] | components["schemas"]["StepSkippedPayload"] | components["schemas"]["ActionCalledPayload"] | components["schemas"]["ActionCompletedPayload"] | components["schemas"]["ActionFailedPayload"] | components["schemas"]["ActionRetriedPayload"] | components["schemas"]["ActionResultPayload"] | components["schemas"]["CheckVerdictPayload"] | components["schemas"]["InteractionRespondedPayload"] | components["schemas"]["WaitResumedPayload"] | components["schemas"]["WaitTimedOutPayload"] | components["schemas"]["BudgetExceededPayload"] | components["schemas"]["ProgressStalledPayload"] | components["schemas"]["LimitReachedPayload"] | components["schemas"]["ArtifactCreatedPayload"] | components["schemas"]["GenericEventPayload"];
6108
- RunStartedPayload: {
6109
- loop_id?: string;
6110
- loop_version_id?: string;
6111
- source_event_id?: string;
6112
- trigger_id?: string;
6113
- } & {
6114
- [key: string]: unknown;
6115
- };
6116
- RunResumedPayload: {
6117
- step?: string;
6118
- reason?: string;
6119
- } & {
6120
- [key: string]: unknown;
6121
- };
6122
- RunCompletedPayload: {
6123
- output?: {
6124
- [key: string]: unknown;
6125
- };
6126
- } & {
6127
- [key: string]: unknown;
6128
- };
6129
- RunFailedPayload: {
6130
- error?: string;
6131
- error_type?: string;
6132
- step?: string;
6133
- } & {
6134
- [key: string]: unknown;
6135
- };
6136
- RunCancelledPayload: {
6137
- reason?: string;
6138
- } & {
6139
- [key: string]: unknown;
6140
- };
6141
- StepStartedPayload: {
6142
- step?: string;
6143
- kind?: string;
6144
- agent_id?: string;
6145
- } & {
6146
- [key: string]: unknown;
6147
- };
6148
- StepCompletedPayload: {
6149
- step?: string;
6150
- output?: {
6151
- [key: string]: unknown;
6152
- };
6153
- } & {
6154
- [key: string]: unknown;
6155
- };
6156
- StepFailedPayload: {
6157
- step?: string;
6158
- error?: string;
6159
- error_type?: string;
6160
- } & {
6161
- [key: string]: unknown;
6162
- };
6163
- StepRetriedPayload: {
6164
- step?: string;
6165
- attempt?: number;
6166
- max_attempts?: number;
6167
- error?: string;
6168
- } & {
6169
- [key: string]: unknown;
6170
- };
6171
- StepResumedPayload: {
6172
- step?: string;
6173
- kind?: string;
6174
- } & {
6175
- [key: string]: unknown;
6176
- };
6177
- StepSkippedPayload: {
6178
- step?: string;
6179
- kind?: string;
6180
- reason?: string;
6181
- } & {
6182
- [key: string]: unknown;
6183
- };
6184
- ActionCalledPayload: {
6185
- action?: string;
6186
- step?: string;
6187
- parameters?: {
6188
- [key: string]: unknown;
6189
- };
6190
- } & {
6191
- [key: string]: unknown;
6193
+ credit_budget?: number;
6194
+ /** @description Replacement run-wide agent turn cap. Must be greater than `agent_turns_used`. */
6195
+ max_agent_turns?: number;
6196
+ /** @description Additional wall-clock time, in seconds, granted from the recovery request time. Required when the run stopped on `wall_clock_exceeded`. */
6197
+ wall_clock_extend_seconds?: number;
6192
6198
  };
6193
- ActionCompletedPayload: {
6194
- action?: string;
6195
- step?: string;
6199
+ /**
6200
+ * @description Body for resuming a suspended loop step.
6201
+ * @example {
6202
+ * "step_key": "wait_for_external_result",
6203
+ * "result": {
6204
+ * "status": "complete",
6205
+ * "source": "ci"
6206
+ * }
6207
+ * }
6208
+ */
6209
+ SignalLoopRunRequest: {
6210
+ /** @description Step key currently in `suspended` state that should resume. Must match a step declared in the run's loop version spec. */
6211
+ step_key: string;
6212
+ /** @description Free-form payload saved as the resumed step's output. */
6196
6213
  result?: {
6197
6214
  [key: string]: unknown;
6198
6215
  };
6199
- } & {
6200
- [key: string]: unknown;
6201
6216
  };
6202
- ActionFailedPayload: {
6203
- action?: string;
6204
- step?: string;
6205
- error?: string;
6206
- error_type?: string;
6207
- } & {
6208
- [key: string]: unknown;
6217
+ /** @description Optional attribution for the call that started this run. Triggers and HTTP trigger dispatch populate `trigger_id` and `trigger_fire_id`. API callers usually only set `type` and `id`. */
6218
+ LoopRunSource: {
6219
+ /**
6220
+ * @description Source category for the run start: `api`, `trigger`, `manual`, or `signal`.
6221
+ * @enum {string}
6222
+ */
6223
+ type?: "api" | "trigger" | "manual" | "signal";
6224
+ /** @description Identifier within the source type's namespace. */
6225
+ id?: string;
6226
+ /** @description Display label. */
6227
+ label?: string;
6228
+ /** @description Trigger that fired this run, if any. */
6229
+ readonly trigger_id?: string;
6209
6230
  };
6210
- ActionRetriedPayload: {
6211
- action?: string;
6231
+ /**
6232
+ * @description One loop run record.
6233
+ * @example {
6234
+ * "id": "run_8q5m2x9v7p3n4r6t",
6235
+ * "loop_id": "loop_9q2m7x5v3p8n4r6t",
6236
+ * "loop_name": "Daily security check",
6237
+ * "loop_version_id": "lver_4v9n2q7m5x8p3r6t",
6238
+ * "loop_version": 3,
6239
+ * "status": "running",
6240
+ * "credit_budget": 1000,
6241
+ * "credit_spent": 12.5,
6242
+ * "event": {
6243
+ * "repository": "deepnoodle-ai/mobius-cloud"
6244
+ * },
6245
+ * "config": {
6246
+ * "priority": "normal"
6247
+ * },
6248
+ * "source": {
6249
+ * "type": "api",
6250
+ * "id": "review-service",
6251
+ * "label": "review-service"
6252
+ * },
6253
+ * "created_at": "2026-06-15T14:30:00Z",
6254
+ * "updated_at": "2026-06-15T14:31:00Z"
6255
+ * }
6256
+ */
6257
+ LoopRun: {
6258
+ /** @description Stable run identifier. */
6259
+ id: string;
6260
+ /** @description Loop this run belongs to. */
6261
+ loop_id: string;
6262
+ /** @description Human-readable name of the loop this run belongs to. */
6263
+ loop_name?: string;
6264
+ /** @description LoopVersion record this run is executing. */
6265
+ loop_version_id: string;
6266
+ /** @description Version number of the LoopVersion this run is executing. */
6267
+ loop_version: number;
6268
+ /** @description Current lifecycle state of this run. */
6269
+ status: components["schemas"]["LoopRunStatus"];
6270
+ /** @description One-based execution attempt for this run. The original run starts at 1 and increments each time the run is resumed or retried in place. */
6212
6271
  attempt?: number;
6213
- max_attempts?: number;
6214
- } & {
6215
- [key: string]: unknown;
6216
- };
6217
- ActionResultPayload: {
6218
- action?: string;
6219
- result?: {
6272
+ /** @description Gate that placed this run in the durable queue. Present only while `status` is `queued`. */
6273
+ queue_reason?: components["schemas"]["LoopRunQueueReason"];
6274
+ /** @description Org-wide concurrent-run ceiling stamped at run start. Present when the run was evaluated against a plan concurrency limit. */
6275
+ plan_concurrency_limit?: number;
6276
+ /** @description Terminal reason recorded when the run stops. */
6277
+ stop_reason?: components["schemas"]["LoopRunStopReason"];
6278
+ /**
6279
+ * Format: double
6280
+ * @description The run's budget ceiling in credits (1 credit = $0.01), with up to 3 decimal places. Resolved at run start from the StartRun override, the loop spec's `limits` block, or the trial-plan default, in that order. Absent when the run is unbounded.
6281
+ */
6282
+ credit_budget?: number;
6283
+ /**
6284
+ * Format: double
6285
+ * @description Metered spend attributed to this run so far, in credits (up to 3 decimal places). Incremented atomically with each usage-ledger insert that carries this run's id. Counts all metered work regardless of credential source (BYOK calls count at their rate-card equivalent even though they bill zero credits).
6286
+ */
6287
+ credit_spent?: number;
6288
+ /** @description Run-wide cap on agent turns across all steps, from the loop spec's `limits.max_agent_turns`. Absent when unbounded. */
6289
+ max_agent_turns?: number;
6290
+ /** @description Number of agent turns started for this run so far. Compared against `max_agent_turns` when that cap is set. */
6291
+ agent_turns_used?: number;
6292
+ /** @description Exact safe/canonical event object that started the run, reachable in templates at `event.*`. */
6293
+ event?: {
6220
6294
  [key: string]: unknown;
6221
6295
  };
6222
- } & {
6223
- [key: string]: unknown;
6224
- };
6225
- CheckVerdictPayload: {
6226
- step?: string;
6227
- verdict?: string;
6228
- on_fail?: string;
6229
- failed?: string[];
6230
- } & {
6231
- [key: string]: unknown;
6232
- };
6233
- InteractionRespondedPayload: {
6234
- interaction_id?: string;
6235
- response?: {
6296
+ /** @description Run and trigger metadata envelope, reachable in templates at `${{ meta.* }}`: `run_id`, `loop_id`, `source`, `trigger`, plus trigger-supplied facts such as `event_type`, `source_event_id`, and `scheduled_at`. */
6297
+ meta?: {
6236
6298
  [key: string]: unknown;
6237
6299
  };
6238
- responder?: {
6300
+ /** @description Optional static or caller-provided configuration resolved when the run started, reachable in templates at `config.*`. */
6301
+ config?: {
6239
6302
  [key: string]: unknown;
6240
6303
  };
6241
- } & {
6242
- [key: string]: unknown;
6243
- };
6244
- WaitPayload: {
6245
- step?: string;
6246
- /** @description Source event type or pattern this wait is listening for. */
6247
- event_type?: string;
6248
- /** @description Optional source identifier that scopes event matching. */
6249
- source_id?: string;
6250
- /** @description Optional matcher fields required on the source event. */
6251
- match?: {
6304
+ /** @description Final result payload. When the loop declares an `output:` block this is that block rendered at completion; otherwise it is the run's accumulated step outputs, keyed by step id. Absent until the run terminates successfully. */
6305
+ result?: {
6252
6306
  [key: string]: unknown;
6253
6307
  };
6254
- wait_id?: string;
6255
- wait_kind?: string;
6308
+ /** @description Source that started this run. */
6309
+ source?: components["schemas"]["LoopRunSource"];
6310
+ /** @description Run that triggered this run via an `loop` step. Present only on child runs; absent for top-level runs. */
6311
+ parent_run_id?: string;
6312
+ /** @description Loop that triggered this run via an `loop` step. Present only on child runs. */
6313
+ parent_loop_id?: string;
6314
+ /** @description Step key within the parent run's loop that triggered this run. Present only on child runs. */
6315
+ parent_step_key?: string;
6316
+ /** @description Human-readable failure summary; populated on `failed` runs. */
6317
+ error_message?: string;
6318
+ /** @description Machine-readable failure classification when available. */
6319
+ error_type?: string;
6256
6320
  /**
6257
6321
  * Format: date-time
6258
- * @description Wall-clock expiry for the wait, when bounded.
6322
+ * @description Scheduled wake time for a suspended run.
6259
6323
  */
6260
- expires_at?: string;
6261
- /** Format: date-time */
6262
- deadline?: string;
6263
- subject?: {
6264
- [key: string]: unknown;
6265
- };
6266
- } & {
6267
- [key: string]: unknown;
6268
- };
6269
- WaitResumedPayload: {
6270
- step?: string;
6271
- wait_id?: string;
6272
- payload?: {
6273
- [key: string]: unknown;
6274
- };
6275
- } & {
6276
- [key: string]: unknown;
6277
- };
6278
- WaitTimedOutPayload: {
6279
- step?: string;
6280
- wait_id?: string;
6281
- reason?: string;
6282
- } & {
6283
- [key: string]: unknown;
6284
- };
6285
- BudgetExceededPayload: {
6286
- step?: string;
6287
- credit_spent?: number;
6288
- credit_budget?: number;
6289
- percent_used?: number;
6290
- } & {
6291
- [key: string]: unknown;
6292
- };
6293
- ProgressStalledPayload: {
6294
- step?: string;
6295
- tool?: string;
6296
- duplicate_calls?: number;
6297
- limit?: number;
6298
- } & {
6299
- [key: string]: unknown;
6324
+ wake_at?: string;
6325
+ /**
6326
+ * Format: date-time
6327
+ * @description Deadline after which the loop reaper fails the run.
6328
+ */
6329
+ wall_clock_deadline_at?: string;
6330
+ /**
6331
+ * Format: date-time
6332
+ * @description Time the engine moved the run to `running`.
6333
+ */
6334
+ started_at?: string;
6335
+ /**
6336
+ * Format: date-time
6337
+ * @description Time the run reached a terminal status.
6338
+ */
6339
+ completed_at?: string;
6340
+ /**
6341
+ * Format: date-time
6342
+ * @description Record creation timestamp.
6343
+ */
6344
+ created_at: string;
6345
+ /**
6346
+ * Format: date-time
6347
+ * @description Last update timestamp.
6348
+ */
6349
+ updated_at: string;
6300
6350
  };
6301
- LimitReachedPayload: {
6302
- step?: string;
6303
- limit_kind?: string;
6304
- used?: number;
6305
- limit?: number;
6306
- } & {
6307
- [key: string]: unknown;
6351
+ /**
6352
+ * @description Run lifecycle state: `queued`, `running`, `suspended`, `completed`, `failed`, or `cancelled`.
6353
+ * @enum {string}
6354
+ */
6355
+ LoopRunStatus: "queued" | "running" | "suspended" | "completed" | "failed" | "cancelled";
6356
+ /**
6357
+ * @description Why a run is waiting in the queue. `plan_concurrency` means the organization's current plan has no active-run capacity available. `loop_policy` and `trigger_concurrency` mean authored concurrency policy deferred the run.
6358
+ * @enum {string}
6359
+ */
6360
+ LoopRunQueueReason: "plan_concurrency" | "loop_policy" | "trigger_concurrency";
6361
+ /**
6362
+ * @description Why a run stopped. Set exactly once when the run reaches a terminal status; absent on non-terminal runs. `status` carries the lifecycle state and `error_type` classifies the error when one occurred; `stop_reason` classifies the stop itself.
6363
+ *
6364
+ * Grouping: `completed` is the success terminal. `step_failed`, `check_failed`, and `gate_rejected` mean the work failed (an error, a failed verification, or a human rejection at a gate). `budget_exceeded`, `turn_limit_reached`, `wall_clock_exceeded`, `step_limit_reached`, and `progress_stalled` mean a configured guardrail halted the run — the limit worked; the loop did not break. `cancelled` and `replaced` mean somebody (or a concurrency policy) chose to stop it.
6365
+ * @enum {string}
6366
+ */
6367
+ LoopRunStopReason: "completed" | "step_failed" | "check_failed" | "gate_rejected" | "cancelled" | "replaced" | "wall_clock_exceeded" | "budget_exceeded" | "turn_limit_reached" | "progress_stalled" | "step_limit_reached";
6368
+ /**
6369
+ * @example {
6370
+ * "items": [
6371
+ * {
6372
+ * "id": "run_8q5m2x9v7p3n4r6t",
6373
+ * "loop_id": "loop_9q2m7x5v3p8n4r6t",
6374
+ * "loop_version_id": "lver_4v9n2q7m5x8p3r6t",
6375
+ * "loop_version": 3,
6376
+ * "status": "running",
6377
+ * "created_at": "2026-06-15T14:30:00Z",
6378
+ * "updated_at": "2026-06-15T14:31:00Z"
6379
+ * }
6380
+ * ],
6381
+ * "has_more": false
6382
+ * }
6383
+ */
6384
+ LoopRunListResponse: {
6385
+ /** @description The list of results for this page. */
6386
+ items: components["schemas"]["LoopRun"][];
6387
+ /** @description Opaque cursor for the next page; absent when no more results. */
6388
+ next_cursor?: string;
6389
+ /** @description True when more items exist after this page. */
6390
+ has_more?: boolean;
6308
6391
  };
6309
- ArtifactCreatedPayload: {
6310
- artifact_id?: string;
6311
- name?: string;
6312
- content_type?: string;
6313
- step?: string;
6314
- } & {
6315
- [key: string]: unknown;
6392
+ LoopRunStepListResponse: {
6393
+ /** @description Steps for this run in `seq` order. */
6394
+ items: components["schemas"]["LoopRunStep"][];
6316
6395
  };
6396
+ /** @description Durable run lifecycle frame. SSE messages carrying this shape include `id: <sequence>`, and that value is the only cursor clients should persist for `after_sequence` or `Last-Event-ID` resume. */
6397
+ LoopRunLifecycleFrame: components["schemas"]["LoopRunEvent"];
6398
+ /** @description JSON payload of a single `data:` line on the run event SSE stream. Run stream frames are lifecycle/observability events and are replayable with an SSE `id:`. Agent transcript content is delivered by the referenced session stream. */
6399
+ LoopRunStreamFrame: components["schemas"]["LoopRunLifecycleFrame"];
6317
6400
  LoopRunEventListResponse: {
6318
6401
  /** @description Run events in this page, ordered by `sequence` ascending. */
6319
6402
  items: components["schemas"]["LoopRunEvent"][];
@@ -7220,6 +7303,10 @@ export interface components {
7220
7303
  LastEventIDParam: number;
7221
7304
  /** @description ID of the target organization for the admin operation. */
7222
7305
  AdminOrgIDParam: string;
7306
+ /** @description ID of the target loop run for the admin operation. */
7307
+ AdminRunIDParam: string;
7308
+ /** @description ID of the target human principal for the admin operation. */
7309
+ AdminUserIDParam: string;
7223
7310
  /** @description Environment ID. */
7224
7311
  EnvironmentIDParam: string;
7225
7312
  /** @description Secret ID or secret name. */
@@ -10264,7 +10351,10 @@ export interface operations {
10264
10351
  };
10265
10352
  cancelSession: {
10266
10353
  parameters: {
10267
- query?: never;
10354
+ query?: {
10355
+ /** @description When true, also cancel loop-owned turns to unlock a wedged session. Use only for recovery; the owning run may be left inconsistent. */
10356
+ force?: boolean;
10357
+ };
10268
10358
  header?: never;
10269
10359
  path: {
10270
10360
  /** @description Project handle */
@@ -10816,6 +10906,87 @@ export interface operations {
10816
10906
  429: components["responses"]["TooManyRequests"];
10817
10907
  };
10818
10908
  };
10909
+ resumeRun: {
10910
+ parameters: {
10911
+ query?: never;
10912
+ header?: never;
10913
+ path: {
10914
+ /** @description Project handle */
10915
+ project_handle: components["parameters"]["ProjectHandleParam"];
10916
+ /** @description Resource ID. */
10917
+ resource_id: components["parameters"]["IDParam"];
10918
+ };
10919
+ cookie?: never;
10920
+ };
10921
+ requestBody?: {
10922
+ content: {
10923
+ /**
10924
+ * @example {
10925
+ * "reason": "operator raised run budget",
10926
+ * "credit_budget": 1500
10927
+ * }
10928
+ */
10929
+ "application/json": components["schemas"]["RecoverLoopRunRequest"];
10930
+ };
10931
+ };
10932
+ responses: {
10933
+ /** @description Accepted. Returns the resumed run. */
10934
+ 202: {
10935
+ headers: {
10936
+ [name: string]: unknown;
10937
+ };
10938
+ content: {
10939
+ "application/json": components["schemas"]["LoopRun"];
10940
+ };
10941
+ };
10942
+ 400: components["responses"]["BadRequest"];
10943
+ 401: components["responses"]["Unauthorized"];
10944
+ 403: components["responses"]["Forbidden"];
10945
+ 404: components["responses"]["NotFound"];
10946
+ 409: components["responses"]["Conflict"];
10947
+ 429: components["responses"]["TooManyRequests"];
10948
+ };
10949
+ };
10950
+ retryRun: {
10951
+ parameters: {
10952
+ query?: never;
10953
+ header?: never;
10954
+ path: {
10955
+ /** @description Project handle */
10956
+ project_handle: components["parameters"]["ProjectHandleParam"];
10957
+ /** @description Resource ID. */
10958
+ resource_id: components["parameters"]["IDParam"];
10959
+ };
10960
+ cookie?: never;
10961
+ };
10962
+ requestBody?: {
10963
+ content: {
10964
+ /**
10965
+ * @example {
10966
+ * "reason": "transient provider failure cleared"
10967
+ * }
10968
+ */
10969
+ "application/json": components["schemas"]["RecoverLoopRunRequest"];
10970
+ };
10971
+ };
10972
+ responses: {
10973
+ /** @description Accepted. Returns the resumed run. */
10974
+ 202: {
10975
+ headers: {
10976
+ [name: string]: unknown;
10977
+ };
10978
+ content: {
10979
+ "application/json": components["schemas"]["LoopRun"];
10980
+ };
10981
+ };
10982
+ 400: components["responses"]["BadRequest"];
10983
+ 401: components["responses"]["Unauthorized"];
10984
+ 403: components["responses"]["Forbidden"];
10985
+ 404: components["responses"]["NotFound"];
10986
+ 409: components["responses"]["Conflict"];
10987
+ 429: components["responses"]["TooManyRequests"];
10988
+ };
10989
+ };
10819
10990
  listRunSteps: {
10820
10991
  parameters: {
10821
10992
  query?: never;