@lunnoa/client 2.5.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -232,6 +232,26 @@ declare class AgentChatClient {
232
232
  */
233
233
 
234
234
  interface paths {
235
+ "/api/ai-connections": {
236
+ parameters: {
237
+ query?: never;
238
+ header?: never;
239
+ path?: never;
240
+ cookie?: never;
241
+ };
242
+ /**
243
+ * List AI connections available to the caller
244
+ * @description Returns AI provider connections the caller may assign to an agent, each with the catalogue model ids that connection accepts. Use `models[].id` as the agent `model`. `isDefault` marks the connection and model applied when a deploy omits them. App connections (Gmail, HTTP, and similar) are listed separately at `GET /api/connections`. Credentials are never returned. Requires `agents:create`.
245
+ */
246
+ get: operations["AiConnectionsController_list"];
247
+ put?: never;
248
+ post?: never;
249
+ delete?: never;
250
+ options?: never;
251
+ head?: never;
252
+ patch?: never;
253
+ trace?: never;
254
+ };
235
255
  "/api/discovery/enabled-features": {
236
256
  parameters: {
237
257
  query?: never;
@@ -714,8 +734,8 @@ interface paths {
714
734
  get?: never;
715
735
  put?: never;
716
736
  /**
717
- * Upsert a workflow by slug from a linear step list
718
- * @description Creates or updates a workflow identified by workspace-scoped `slug`. Builds a minimal valid graph (one catalogue trigger, Manually Run when omitted, then catalogue-action steps; the last step may branch with `paths`). Marks `managedByCode` by default. Prefer the CLI (`npx @lunnoa/client workflows deploy`) over calling this from application code.
737
+ * Upsert a workflow by slug
738
+ * @description Creates or replaces the workflow identified by a workspace-scoped slug. Send either catalogue steps (optional trigger; Manually Run when the trigger is omitted; the last step may branch with paths) or a graph of nodes and edges. Not both. codeSource defaults to generated. Updating a workflow the UI can edit is refused with 409 unless baseRevision is the current revision or force is true; both sides generated skips that check. A lost update race is the same 409. isActive changes only when the request sends it. Prefer the CLI (`npx @lunnoa/client workflows deploy`).
719
739
  */
720
740
  post: operations["WorkflowsController_upsertBySlug"];
721
741
  delete?: never;
@@ -724,6 +744,26 @@ interface paths {
724
744
  patch?: never;
725
745
  trace?: never;
726
746
  };
747
+ "/api/workflows/slug/{slug}/definition": {
748
+ parameters: {
749
+ query?: never;
750
+ header?: never;
751
+ path?: never;
752
+ cookie?: never;
753
+ };
754
+ /**
755
+ * Get a workflow definition by slug
756
+ * @description Returns the steps format when the stored graph round-trips through it, otherwise the graph format. Placeholder nodes are omitted.
757
+ */
758
+ get: operations["WorkflowsController_getDefinitionBySlug"];
759
+ put?: never;
760
+ post?: never;
761
+ delete?: never;
762
+ options?: never;
763
+ head?: never;
764
+ patch?: never;
765
+ trace?: never;
766
+ };
727
767
  "/api/workflows/{workflowId}": {
728
768
  parameters: {
729
769
  query?: never;
@@ -744,6 +784,26 @@ interface paths {
744
784
  patch?: never;
745
785
  trace?: never;
746
786
  };
787
+ "/api/code-sync/context": {
788
+ parameters: {
789
+ query?: never;
790
+ header?: never;
791
+ path?: never;
792
+ cookie?: never;
793
+ };
794
+ /**
795
+ * Get code-sync context for the current workspace
796
+ * @description Returns the workspace id and whether code-synced agents and workflows are locked so they can only be changed by a push.
797
+ */
798
+ get: operations["CodeSyncController_getContext"];
799
+ put?: never;
800
+ post?: never;
801
+ delete?: never;
802
+ options?: never;
803
+ head?: never;
804
+ patch?: never;
805
+ trace?: never;
806
+ };
747
807
  "/api/agents": {
748
808
  parameters: {
749
809
  query?: never;
@@ -775,7 +835,7 @@ interface paths {
775
835
  put?: never;
776
836
  /**
777
837
  * Upsert an agent by slug
778
- * @description Creates or updates an agent identified by workspace-scoped `slug`. Accepts instructions, model, optional aiConnectionId / connectionIds / workflowIds, and catalogue action tools. Marks `managedByCode` by default. Prefer the CLI (`npx @lunnoa/client agents deploy`) over calling this from application code.
838
+ * @description Creates or updates an agent identified by workspace-scoped `slug`. A field that is omitted is left unchanged on update. `codeSource` defaults to `generated`. Conflict rules: a generated redeploy over a generated agent needs no revision; otherwise an existing agent requires `baseRevision` equal to the current revision, or `force`. A missing or stale `baseRevision` answers 409, and so does a lost race with a UI edit. The 409 body includes `currentRevision` when it is known. Prefer the CLI (`npx @lunnoa/client agents deploy`) over calling this from application code.
779
839
  */
780
840
  post: operations["AgentsController_upsertBySlug"];
781
841
  delete?: never;
@@ -784,6 +844,26 @@ interface paths {
784
844
  patch?: never;
785
845
  trace?: never;
786
846
  };
847
+ "/api/agents/slug/{slug}/definition": {
848
+ parameters: {
849
+ query?: never;
850
+ header?: never;
851
+ path?: never;
852
+ cookie?: never;
853
+ };
854
+ /**
855
+ * Get an agent definition by slug
856
+ * @description Returns the agent definition in the file shape used by code sync, plus its id, code source, and revision.
857
+ */
858
+ get: operations["AgentsController_getDefinitionBySlug"];
859
+ put?: never;
860
+ post?: never;
861
+ delete?: never;
862
+ options?: never;
863
+ head?: never;
864
+ patch?: never;
865
+ trace?: never;
866
+ };
787
867
  "/api/agents/{agentId}": {
788
868
  parameters: {
789
869
  query?: never;
@@ -1452,26 +1532,6 @@ interface paths {
1452
1532
  patch?: never;
1453
1533
  trace?: never;
1454
1534
  };
1455
- "/api/ai-connections": {
1456
- parameters: {
1457
- query?: never;
1458
- header?: never;
1459
- path?: never;
1460
- cookie?: never;
1461
- };
1462
- /**
1463
- * List AI connections available to the caller
1464
- * @description Returns AI provider connections the caller may assign to an agent, each with the catalogue model ids that connection accepts. Use `models[].id` as the agent `model`. `isDefault` marks the connection and model applied when a deploy omits them. App connections (Gmail, HTTP, and similar) are listed separately at `GET /api/connections`. Credentials are never returned. Requires `agents:create`.
1465
- */
1466
- get: operations["AiConnectionsController_list"];
1467
- put?: never;
1468
- post?: never;
1469
- delete?: never;
1470
- options?: never;
1471
- head?: never;
1472
- patch?: never;
1473
- trace?: never;
1474
- };
1475
1535
  "/api/connections": {
1476
1536
  parameters: {
1477
1537
  query?: never;
@@ -1695,6 +1755,32 @@ interface paths {
1695
1755
  }
1696
1756
  interface components {
1697
1757
  schemas: {
1758
+ PublicAiModelResponseDto: {
1759
+ /** @description Catalogue model id passed to agent deploy as `model`. Example: `deepseek-ai/DeepSeek-V4-Pro`. */
1760
+ id: string;
1761
+ /** @description Display name. */
1762
+ name: string;
1763
+ /** @description True when this is the model used if an agent deploy omits `model` on this connection. */
1764
+ isDefault: boolean;
1765
+ /** @description Whether the model can call tools. */
1766
+ supportsTools: boolean;
1767
+ /** @description Whether the model accepts image input. */
1768
+ supportsVision: boolean;
1769
+ /** @description Whether the model exposes a reasoning mode. */
1770
+ supportsReasoning: boolean;
1771
+ };
1772
+ PublicAiConnectionResponseDto: {
1773
+ /** @description AiProviderConnection UUID. Pass as `aiConnectionId` / `defineAiConnection({ id })` when this connection is not the default. */
1774
+ id: string;
1775
+ /** @description Connection display name. Example: `Lunnoa LLMs`. */
1776
+ name: string;
1777
+ /** @description Provider slug. Example: `featherless` or `openai`. */
1778
+ provider: string;
1779
+ /** @description True for the connection used when an agent deploy omits `aiConnectionId`. */
1780
+ isDefault: boolean;
1781
+ /** @description Models this connection accepts. Inactive models are omitted. */
1782
+ models: components["schemas"]["PublicAiModelResponseDto"][];
1783
+ };
1698
1784
  AuthMethodFlagsDto: {
1699
1785
  /** @description True when password-based login is disabled for this deployment (via AUTH_DISABLED_METHODS). */
1700
1786
  passwordDisabled: boolean;
@@ -2298,29 +2384,6 @@ interface components {
2298
2384
  /** @description Number of item IDs submitted for deletion. */
2299
2385
  requestedCount: number;
2300
2386
  };
2301
- UpsertWorkflowStepDto: {
2302
- /**
2303
- * @description Name later steps use in ={{step:<key>,path}}. Keyed steps keep their node id across deploys. "trigger" is reserved.
2304
- * @example loadCase
2305
- */
2306
- key?: string;
2307
- /** @description Workflow app id (catalogue slug). */
2308
- appId: string;
2309
- /** @description Catalogue action id. */
2310
- actionId: string;
2311
- /** @description Connection instance UUID for this step. */
2312
- connectionId?: string;
2313
- /** @description Action input / config fields. String values may use ={{step:trigger,field}} or ={{step:<key>,path,to,value}}. */
2314
- input?: {
2315
- [key: string]: unknown;
2316
- };
2317
- /** @description Display name for the step node. */
2318
- name?: string;
2319
- /** @description Step description. */
2320
- description?: string;
2321
- /** @description Branches after this step. Only on flow-control_action_conditional-paths, flow-control_action_manually-decide-paths, or flow-control_action_request-approval (approved path first, then rejected), and only on the last step of a list. */
2322
- paths?: components["schemas"]["UpsertWorkflowPathDto"][];
2323
- };
2324
2387
  UpsertWorkflowPathConditionDto: {
2325
2388
  /** @description One step reference, e.g. ={{step:load,amount}}. */
2326
2389
  field: string;
@@ -2329,14 +2392,6 @@ interface components {
2329
2392
  /** @description Value to compare with. */
2330
2393
  value?: string;
2331
2394
  };
2332
- UpsertWorkflowPathDto: {
2333
- /** @description Path label, unique on its step. */
2334
- label: string;
2335
- /** @description Conditional Paths only. Groups are OR-ed, conditions inside a group AND-ed. Omit to always take this path. */
2336
- when?: components["schemas"]["UpsertWorkflowPathConditionDto"][][];
2337
- /** @description Steps on this path. */
2338
- steps: components["schemas"]["UpsertWorkflowStepDto"][];
2339
- };
2340
2395
  UpsertWorkflowTriggerInputFieldDto: {
2341
2396
  /** @description Field id. Callers pass this key to workflows.execute. */
2342
2397
  id: string;
@@ -2346,14 +2401,10 @@ interface components {
2346
2401
  /** @description text, number, date, or select. Defaults to text. */
2347
2402
  inputType?: string;
2348
2403
  /** @description true, or { missingMessage, missingStatus }. */
2349
- required?: boolean | {
2350
- [key: string]: unknown;
2351
- };
2404
+ required?: Record<string, never>;
2352
2405
  /** @description Used when the caller omits the field. */
2353
- defaultValue?: unknown;
2354
- selectOptions?: {
2355
- [key: string]: unknown;
2356
- }[];
2406
+ defaultValue?: Record<string, never>;
2407
+ selectOptions?: Record<string, never>[];
2357
2408
  };
2358
2409
  UpsertWorkflowTriggerDto: {
2359
2410
  /** @description Catalogue trigger id, for example flow-control_trigger_manual. */
@@ -2372,6 +2423,59 @@ interface components {
2372
2423
  name?: string;
2373
2424
  description?: string;
2374
2425
  };
2426
+ UpsertWorkflowRetrySettingsDto: {
2427
+ enabled: boolean;
2428
+ /** @description How many times to attempt the step. */
2429
+ maxAttempts: number;
2430
+ /** @description Delay between attempts, in seconds. */
2431
+ delaySeconds: number;
2432
+ };
2433
+ UpsertWorkflowContinueOnFailureDto: {
2434
+ enabled: boolean;
2435
+ };
2436
+ UpsertWorkflowPathDto: {
2437
+ /** @description Path label, unique on its step. */
2438
+ label: string;
2439
+ /** @description Conditional Paths only. Groups are OR-ed, conditions inside a group AND-ed. Omit to always take this path. */
2440
+ when?: components["schemas"]["UpsertWorkflowPathConditionDto"][][];
2441
+ /** @description Steps on this path. */
2442
+ steps: components["schemas"]["UpsertWorkflowStepDto"][];
2443
+ };
2444
+ UpsertWorkflowStepDto: {
2445
+ /**
2446
+ * @description Name later steps use in ={{step:<key>,path}}. Keyed steps keep their node id across deploys. "trigger" is reserved.
2447
+ * @example loadCase
2448
+ */
2449
+ key?: string;
2450
+ /** @description Workflow app id (catalogue slug). */
2451
+ appId: string;
2452
+ /** @description Catalogue action id. */
2453
+ actionId: string;
2454
+ /** @description Connection instance UUID for this step. */
2455
+ connectionId?: string;
2456
+ /** @description Action input / config fields. String values may use ={{step:trigger,field}} or ={{step:<key>,path,to,value}}. */
2457
+ input?: {
2458
+ [key: string]: unknown;
2459
+ };
2460
+ /** @description Display name for the step node. */
2461
+ name?: string;
2462
+ /** @description Step description. */
2463
+ description?: string;
2464
+ retrySettings?: components["schemas"]["UpsertWorkflowRetrySettingsDto"];
2465
+ continueOnFailure?: components["schemas"]["UpsertWorkflowContinueOnFailureDto"];
2466
+ /** @description Branches after this step. Only on flow-control_action_conditional-paths, flow-control_action_manually-decide-paths, or flow-control_action_request-approval (approved path first, then rejected), and only on the last step of a list. */
2467
+ paths?: components["schemas"]["UpsertWorkflowPathDto"][];
2468
+ };
2469
+ UpsertWorkflowGraphDto: {
2470
+ /** @description Graph-file nodes. Each node has key, nodeType, appId, name, and value. The trigger key is "trigger". */
2471
+ nodes: {
2472
+ [key: string]: unknown;
2473
+ }[];
2474
+ /** @description Edges. source and target are node keys. */
2475
+ edges: {
2476
+ [key: string]: unknown;
2477
+ }[];
2478
+ };
2375
2479
  UpsertWorkflowBySlugDto: {
2376
2480
  /**
2377
2481
  * @description Stable workspace-scoped slug (lowercase, digits, hyphens). Used as the upsert key.
@@ -2383,22 +2487,39 @@ interface components {
2383
2487
  description?: string;
2384
2488
  /** @description Whether the workflow is active. */
2385
2489
  isActive?: boolean;
2386
- /** @description Catalogue trigger. Omit for a Manually Run trigger with no input fields. */
2490
+ /** @description Catalogue trigger for a steps body. Omit for a Manually Run trigger with no input fields. Not valid with `graph`. */
2387
2491
  trigger?: components["schemas"]["UpsertWorkflowTriggerDto"];
2388
- /** @description Catalogue-action steps in order. The last step may branch with `paths`. */
2389
- steps: components["schemas"]["UpsertWorkflowStepDto"][];
2390
- /** @description Marks the row as managed by code (CLI / SDK). Defaults to true on this endpoint. */
2391
- managedByCode?: boolean;
2492
+ /** @description Catalogue-action steps in order. The last step may branch with `paths`. Send this or `graph`, not both. */
2493
+ steps?: components["schemas"]["UpsertWorkflowStepDto"][];
2494
+ /** @description Full graph in the graph-file shape. Send this or `steps`, not both. `trigger` is not valid with a graph. */
2495
+ graph?: components["schemas"]["UpsertWorkflowGraphDto"];
2496
+ /** @description Revision from the last pull. Required when updating a workflow that the UI can edit, unless `force` is true. */
2497
+ baseRevision?: string;
2498
+ /** @description Overwrite an existing workflow even when `baseRevision` is missing or stale. */
2499
+ force?: boolean;
2500
+ /**
2501
+ * @description How code owns this workflow. Defaults to generated on this endpoint.
2502
+ * @enum {string}
2503
+ */
2504
+ codeSource?: "synced" | "generated";
2392
2505
  };
2393
- WorkflowResponseDto: {
2506
+ UpsertWorkflowResponseDto: {
2394
2507
  /** @description Workflow ID */
2395
2508
  id: string;
2396
2509
  /** @description Workflow name */
2397
2510
  name: string;
2398
2511
  /** @description Stable workspace-scoped slug for CLI / code deploy upserts. Included when `expansion=slug` is requested. */
2399
2512
  slug?: string | null;
2400
- /** @description True when last written by code (CLI / SDK). Included when `expansion=managedByCode` is requested. */
2401
- managedByCode?: boolean;
2513
+ /**
2514
+ * @description Code source stored by this push. `generated` when the request omits it.
2515
+ * @enum {string}
2516
+ */
2517
+ codeSource?: "none" | "synced" | "generated";
2518
+ /**
2519
+ * @description Sync state against the definitions folder. Included when `expansion=codeSyncStatus` is requested.
2520
+ * @enum {string}
2521
+ */
2522
+ codeSyncStatus?: "none" | "in_sync" | "changed_in_ui" | "locked";
2402
2523
  /** @description Workflow description. Included when `expansion=description` is requested. */
2403
2524
  description?: string | null;
2404
2525
  /** @description Declared output schema from the workflow's Output Workflow Data node. Shape is a map of field ID to `{ type, description? }`. Included when `expansion=output` is requested. Null when the workflow has no declared output schema. */
@@ -2461,62 +2582,584 @@ interface components {
2461
2582
  aiConnectionId?: string | null;
2462
2583
  /** @description Selected model ID within the AI provider connection for workflow builder chat. Always returned on GET /workflows/{workflowId}. */
2463
2584
  selectedModelId?: string | null;
2464
- };
2465
- UpsertAgentToolDto: {
2466
- /** @description Workflow app id (catalogue slug). */
2467
- appId: string;
2468
- /** @description Catalogue action id. */
2469
- actionId: string;
2470
- /** @description Connection instance UUID pre-bound on the tool. */
2471
- connectionId?: string;
2472
- /** @description Tool display name for the model. */
2473
- name?: string;
2474
- /** @description Tool description shown to the model. */
2475
- description?: string;
2476
- /** @description Pre-filled tool config (fields left empty are filled by the model). */
2477
- input?: {
2585
+ /** @description sha256 hex of the canonical definition that was stored. */
2586
+ revision: string;
2587
+ /** @description Definition that was stored. Steps format when it round-trips, otherwise graph format. */
2588
+ definition: {
2478
2589
  [key: string]: unknown;
2479
2590
  };
2480
2591
  };
2481
- UpsertAgentBySlugDto: {
2592
+ WorkflowResponseDto: {
2593
+ /** @description Workflow ID */
2594
+ id: string;
2595
+ /** @description Workflow name */
2596
+ name: string;
2597
+ /** @description Stable workspace-scoped slug for CLI / code deploy upserts. Included when `expansion=slug` is requested. */
2598
+ slug?: string | null;
2482
2599
  /**
2483
- * @description Stable workspace-scoped slug (lowercase, digits, hyphens). Used as the upsert key.
2484
- * @example support-triage
2600
+ * @description Where this workflow is defined. Included when `expansion=codeSource` is requested.
2601
+ * @enum {string}
2485
2602
  */
2486
- slug: string;
2487
- /** @description Display name. Defaults to the slug when omitted. */
2488
- name?: string;
2489
- description?: string;
2490
- /** @description System instructions / prompt for the agent. */
2491
- instructions: string;
2492
- /** @description Catalogue model id enabled on the AI connection. Example: `deepseek-ai/DeepSeek-V4-Pro`. Discover ids with GET /api/ai-connections. */
2493
- model: string;
2494
- /** @description AiProviderConnection UUID. When omitted, platform AI defaults apply. */
2495
- aiConnectionId?: string;
2496
- /** @description App Connection UUIDs the agent may use for tools. */
2497
- connectionIds?: string[];
2498
- /** @description Workflow UUIDs the agent may run (AgentWorkflow links). */
2499
- workflowIds?: string[];
2500
- /** @description Catalogue action tools (WorkflowNodeForRunner-shaped). */
2501
- tools?: components["schemas"]["UpsertAgentToolDto"][];
2502
- /** @description Marks the row as managed by code (CLI / SDK). Defaults to true on this endpoint. */
2503
- managedByCode?: boolean;
2504
- };
2505
- AgentResponseDto: {
2603
+ codeSource?: "none" | "synced" | "generated";
2506
2604
  /**
2507
- * @description Agent ID (UUID)
2508
- * @example 4f7c9d2e-8a1b-4c3d-9e5f-6a7b8c9d0e1f
2605
+ * @description Sync state against the definitions folder. Included when `expansion=codeSyncStatus` is requested.
2606
+ * @enum {string}
2509
2607
  */
2510
- id: string;
2608
+ codeSyncStatus?: "none" | "in_sync" | "changed_in_ui" | "locked";
2609
+ /** @description Workflow description. Included when `expansion=description` is requested. */
2610
+ description?: string | null;
2611
+ /** @description Declared output schema from the workflow's Output Workflow Data node. Shape is a map of field ID to `{ type, description? }`. Included when `expansion=output` is requested. Null when the workflow has no declared output schema. */
2612
+ output?: {
2613
+ [key: string]: unknown;
2614
+ } | null;
2511
2615
  /**
2512
- * @description Agent name
2513
- * @example Invoice Triage Agent
2616
+ * Format: date-time
2617
+ * @description Creation timestamp. Included when `expansion=createdAt` is requested.
2514
2618
  */
2515
- name: string;
2516
- /** @description Stable workspace-scoped slug for CLI / code deploy upserts. Included when `expansion=slug` is requested. */
2517
- slug?: string | null;
2518
- /** @description True when last written by code (CLI / SDK). Included when `expansion=managedByCode` is requested. */
2519
- managedByCode?: boolean;
2619
+ createdAt?: string;
2620
+ /**
2621
+ * Format: date-time
2622
+ * @description Last update timestamp. Included when `expansion=updatedAt` is requested.
2623
+ */
2624
+ updatedAt?: string;
2625
+ /** @description Whether the workflow is active and can be triggered. Included when `expansion=isActive` is requested. */
2626
+ isActive?: boolean;
2627
+ /** @description Whether the workflow is internal (hidden from default listings). Included when `expansion=isInternal` is requested. */
2628
+ isInternal?: boolean;
2629
+ /** @description Object type whose records list this workflow's runs. Included when `expansion=objectLink` is requested. */
2630
+ objectTypeId?: string | null;
2631
+ /** @description Dot path on the trigger payload. A Lunnoa id when the type has no unique key, otherwise that key's value. Included when `expansion=objectLink` is requested. */
2632
+ objectIdPath?: string | null;
2633
+ /** @description Create a record when the unique key value is not found, then file the run on it. Included when `expansion=objectLink` is requested. */
2634
+ createObjectIfMissing?: boolean;
2635
+ /** @description Unique key on the linked object type (`name` or `attribute:<field>`). Included when `expansion=objectLink` is requested. */
2636
+ uniqueKeyField?: string | null;
2637
+ /** @description Workflow node definitions (JSON). Included when `expansion=nodes` is requested. */
2638
+ nodes?: {
2639
+ [key: string]: unknown;
2640
+ }[];
2641
+ /** @description Workflow edge definitions connecting nodes (JSON). Included when `expansion=edges` is requested. */
2642
+ edges?: {
2643
+ [key: string]: unknown;
2644
+ }[];
2645
+ /** @description The workflow trigger node definition (JSON). Included when `expansion=triggerNode` is requested. */
2646
+ triggerNode?: {
2647
+ [key: string]: unknown;
2648
+ } | null;
2649
+ /** @description IDs of the triggers and actions used by the workflow. Included when `expansion=triggerAndActionIds` is requested. */
2650
+ triggerAndActionIds?: string[];
2651
+ /** @description IDs of sub-workflows referenced by the workflow. Included when `expansion=subWorkflowIds` is requested. Only returned by GET /workflows/{workflowId}. */
2652
+ subWorkflowIds?: string[];
2653
+ /** @description IDs of agents referenced by the workflow. Included when `expansion=agentIds` is requested. Only returned by GET /workflows/{workflowId}. */
2654
+ agentIds?: string[];
2655
+ /** @description Internal polling trigger storage value. Included when `expansion=pollStorage` is requested. */
2656
+ pollStorage?: string | null;
2657
+ /**
2658
+ * Format: date-time
2659
+ * @description Timestamp of the next scheduled execution, if the workflow runs on a schedule. Included when `expansion=nextScheduledExecution` is requested.
2660
+ */
2661
+ nextScheduledExecution?: string | null;
2662
+ /**
2663
+ * @description Editor orientation of the workflow canvas. Included when `expansion=orientation` is requested.
2664
+ * @enum {string}
2665
+ */
2666
+ workflowOrientation?: "HORIZONTAL" | "VERTICAL";
2667
+ /** @description AI provider connection used by the workflow builder chat. Always returned on GET /workflows/{workflowId}. */
2668
+ aiConnectionId?: string | null;
2669
+ /** @description Selected model ID within the AI provider connection for workflow builder chat. Always returned on GET /workflows/{workflowId}. */
2670
+ selectedModelId?: string | null;
2671
+ };
2672
+ WorkflowDefinitionResponseDto: {
2673
+ /** @description Workflow ID. */
2674
+ id: string;
2675
+ /** @description Workspace-scoped slug. */
2676
+ slug: string;
2677
+ /** @description Workspace that owns the workflow. */
2678
+ workspaceId: string;
2679
+ /**
2680
+ * @description Where this workflow is defined.
2681
+ * @enum {string}
2682
+ */
2683
+ codeSource: "none" | "synced" | "generated";
2684
+ /** @description sha256 hex of the canonical workflow definition. */
2685
+ revision: string;
2686
+ /** @description Steps format when the graph round-trips through it, otherwise the graph format. */
2687
+ definition: {
2688
+ [key: string]: unknown;
2689
+ };
2690
+ };
2691
+ CodeSyncContextResponseDto: {
2692
+ /** @description Active workspace id. */
2693
+ workspaceId: string;
2694
+ /** @description When true, synced agents and workflows can only be changed by a code push. */
2695
+ lockCodeSyncedResources: boolean;
2696
+ };
2697
+ AgentSlugOrIdDto: {
2698
+ /**
2699
+ * @description Workspace slug. Send exactly one of slug or id.
2700
+ * @example support-triage
2701
+ */
2702
+ slug?: string;
2703
+ /**
2704
+ * Format: uuid
2705
+ * @description Resource UUID. Send exactly one of slug or id.
2706
+ */
2707
+ id?: string;
2708
+ };
2709
+ UpsertAgentMcpServerDto: {
2710
+ /**
2711
+ * Format: uuid
2712
+ * @description MCP server UUID.
2713
+ */
2714
+ id: string;
2715
+ /**
2716
+ * Format: uuid
2717
+ * @description User connection UUID for this server. Null clears a pinned connection.
2718
+ */
2719
+ connectionId?: string | null;
2720
+ };
2721
+ UpsertAgentToolDto: {
2722
+ /** @description Stable tool key. Omitted keys are assigned from the tool name. Pattern: ^[A-Za-z][A-Za-z0-9_-]*$. */
2723
+ key?: string;
2724
+ /** @description Workflow app id (catalogue slug). */
2725
+ appId: string;
2726
+ /** @description Catalogue action id. */
2727
+ actionId: string;
2728
+ /** @description Connection instance UUID pre-bound on the tool. */
2729
+ connectionId?: string;
2730
+ /** @description Tool display name for the model. */
2731
+ name?: string;
2732
+ /** @description Tool description shown to the model. */
2733
+ description?: string;
2734
+ /** @description Pre-filled tool config (fields left empty are filled by the model). */
2735
+ input?: {
2736
+ [key: string]: unknown;
2737
+ };
2738
+ };
2739
+ UpsertAgentSettingsDto: {
2740
+ /** @description Model temperature. */
2741
+ temperature?: number;
2742
+ /** @description Top-p sampling. */
2743
+ topP?: number;
2744
+ /** @description Maximum output tokens per turn. Null clears the cap. */
2745
+ maxOutputTokens?: number | null;
2746
+ /** @description Frequency penalty. */
2747
+ frequencyPenalty?: number;
2748
+ /** @description Presence penalty. */
2749
+ presencePenalty?: number;
2750
+ /** @description Fixed sampling seed. Null clears it. */
2751
+ seed?: number | null;
2752
+ /** @description Maximum retries for a failed model call. */
2753
+ maxRetries?: number;
2754
+ /** @description Maximum tool roundtrips per turn. */
2755
+ maxToolRoundtrips?: number;
2756
+ /** @description How many previous messages are sent to the model. */
2757
+ messageLookbackLimit?: number;
2758
+ /** @description Instructions used when auto-naming new tasks. Null clears them. */
2759
+ taskNamingInstructions?: string | null;
2760
+ /** @description IDs of enabled provider built-in tools. */
2761
+ enabledBuiltInTools?: string[];
2762
+ /** @description IDs of enabled platform tools. */
2763
+ enabledPlatformTools?: string[];
2764
+ /** @description Enabled tool-policy ids. */
2765
+ enabledToolPolicies?: string[];
2766
+ /** @description Per-tool force overrides, stored as JSON. */
2767
+ forcedTools?: {
2768
+ [key: string]: unknown;
2769
+ }[];
2770
+ /** @description Suggested prompts, in stored order. */
2771
+ suggestedPrompts?: string[];
2772
+ /** @description Index the workflow-app catalogue for discovery. */
2773
+ dynamicActionDiscoveryEnabled?: boolean;
2774
+ /** @description Index MCP servers visible to the user for discovery. */
2775
+ dynamicMcpDiscoveryEnabled?: boolean;
2776
+ /** @description Let the agent propose updates to its own instructions. */
2777
+ dynamicSelfInstructionsEnabled?: boolean;
2778
+ /** @description Whether agent memory is enabled. */
2779
+ memoryEnabled?: boolean;
2780
+ /**
2781
+ * @description Whose memories this agent reads and writes.
2782
+ * @enum {string}
2783
+ */
2784
+ memoryScope?: "PER_USER" | "PER_AGENT" | "PER_USER_PER_AGENT";
2785
+ /** @description How many days memories are kept. */
2786
+ memoryRetentionDays?: number;
2787
+ /** @description Opt in to runtime planning tools. */
2788
+ enablePlanning?: boolean;
2789
+ /** @description Gate heavy tools until the user approves a runtime plan. */
2790
+ requirePlanApproval?: boolean;
2791
+ /** @description Offload oversized tool results. */
2792
+ enableToolResultOffload?: boolean;
2793
+ /** @description Byte threshold for tool-result offload. */
2794
+ toolResultOffloadThresholdBytes?: number;
2795
+ /** @description Elevated step budget for long-running work. */
2796
+ longHorizonMode?: boolean;
2797
+ /** @description Step budget when long-horizon mode is on. Null clears it. */
2798
+ longHorizonMaxSteps?: number | null;
2799
+ /** @description Soft token budget for a long-horizon run. Null clears it. */
2800
+ longHorizonMaxTokensPerRun?: number | null;
2801
+ /**
2802
+ * @description How this agent routes prompts that contain PII.
2803
+ * @enum {string}
2804
+ */
2805
+ piiRoutingMode?: "INHERIT" | "AUTO_FALLBACK" | "ASK" | "BLOCK" | "ANONYMIZE";
2806
+ /**
2807
+ * Format: uuid
2808
+ * @description AI connection used when PII routing falls back. Null clears it.
2809
+ */
2810
+ piiFallbackConnectionId?: string | null;
2811
+ /** @description Model used when PII routing falls back. Null clears it. */
2812
+ piiFallbackModelId?: string | null;
2813
+ /** @description Web search access. Null removes the web-access row. */
2814
+ webAccess?: boolean | null;
2815
+ /** @description Outbound phone access. Null removes the phone-access row. */
2816
+ phoneAccess?: boolean | null;
2817
+ };
2818
+ UpsertAgentBySlugDto: {
2819
+ /**
2820
+ * @description Stable workspace-scoped slug (lowercase, digits, hyphens). Used as the upsert key.
2821
+ * @example support-triage
2822
+ */
2823
+ slug: string;
2824
+ /** @description Display name. Defaults to the slug when omitted on create. */
2825
+ name?: string;
2826
+ /** @description Agent description. Null clears it. */
2827
+ description?: string | null;
2828
+ /** @description System instructions / prompt for the agent. */
2829
+ instructions: string;
2830
+ /** @description Catalogue model id enabled on the AI connection. Omit or null when the definition has no model. Example: `deepseek-ai/DeepSeek-V4-Pro`. */
2831
+ model?: string | null;
2832
+ /**
2833
+ * Format: uuid
2834
+ * @description AiProviderConnection UUID. When omitted on create, platform AI defaults apply. Null clears it.
2835
+ */
2836
+ aiConnectionId?: string | null;
2837
+ /** @description App Connection UUIDs the agent may use for tools. */
2838
+ connectionIds?: string[];
2839
+ /** @description Workflow UUIDs the agent may run (AgentWorkflow links). */
2840
+ workflowIds?: string[];
2841
+ /** @description Workflows the agent may run, each by slug or id. Combined with workflowIds when both are sent. */
2842
+ workflows?: components["schemas"]["AgentSlugOrIdDto"][];
2843
+ /** @description Sub-agents, each by slug or id. */
2844
+ agents?: components["schemas"]["AgentSlugOrIdDto"][];
2845
+ /** @description Knowledge item UUIDs attached to the agent. */
2846
+ knowledgeIds?: string[];
2847
+ /** @description Variable UUIDs attached to the agent. */
2848
+ variableIds?: string[];
2849
+ /** @description Object UUIDs attached to the agent. */
2850
+ objectIds?: string[];
2851
+ /** @description Object type UUIDs attached to the agent. */
2852
+ objectTypeIds?: string[];
2853
+ /** @description A2A agent UUIDs attached to the agent. */
2854
+ a2aAgentIds?: string[];
2855
+ /** @description MCP servers pinned on the agent. */
2856
+ mcpServers?: components["schemas"]["UpsertAgentMcpServerDto"][];
2857
+ /** @description Catalogue action tools. A tool key is kept across pushes. */
2858
+ tools?: components["schemas"]["UpsertAgentToolDto"][];
2859
+ /** @description Agent settings. Omitted keys are left unchanged on update. */
2860
+ settings?: components["schemas"]["UpsertAgentSettingsDto"];
2861
+ /**
2862
+ * @description How code owns this agent. Defaults to generated on this endpoint.
2863
+ * @enum {string}
2864
+ */
2865
+ codeSource?: "synced" | "generated";
2866
+ /** @description Revision from the last pull. Required when updating an agent that is not a generated redeploy, unless force is set. */
2867
+ baseRevision?: string;
2868
+ /** @description Overwrite even when baseRevision is missing or stale. */
2869
+ force?: boolean;
2870
+ };
2871
+ AgentUpsertResponseDto: {
2872
+ /**
2873
+ * @description Agent ID (UUID)
2874
+ * @example 4f7c9d2e-8a1b-4c3d-9e5f-6a7b8c9d0e1f
2875
+ */
2876
+ id: string;
2877
+ /**
2878
+ * @description Agent name
2879
+ * @example Invoice Triage Agent
2880
+ */
2881
+ name: string;
2882
+ /** @description Stable workspace-scoped slug for CLI / code deploy upserts. Included when `expansion=slug` is requested. */
2883
+ slug?: string | null;
2884
+ /**
2885
+ * @description Where this agent is defined. Taken from the request, or generated when omitted.
2886
+ * @enum {string}
2887
+ */
2888
+ codeSource?: "none" | "synced" | "generated";
2889
+ /**
2890
+ * @description Sync state against the definitions folder. Included when `expansion=codeSyncStatus` is requested.
2891
+ * @enum {string}
2892
+ */
2893
+ codeSyncStatus?: "none" | "in_sync" | "changed_in_ui" | "locked";
2894
+ /** @description ID of the AI provider connection assigned to the agent. Always included. Null when the agent falls back to the workspace default connection. */
2895
+ FK_aiConnectionId: string | null;
2896
+ /** @description Agent description. Included when `expansion=description` is requested. */
2897
+ description?: string | null;
2898
+ /** @description Public URL of the agent profile image. Included when `expansion=profileImageUrl` is requested. */
2899
+ profileImageUrl?: string | null;
2900
+ /**
2901
+ * Format: date-time
2902
+ * @description Creation timestamp. Included when `expansion=createdAt` is requested.
2903
+ */
2904
+ createdAt?: string;
2905
+ /**
2906
+ * Format: date-time
2907
+ * @description Last update timestamp. Included when `expansion=updatedAt` is requested.
2908
+ */
2909
+ updatedAt?: string;
2910
+ /** @description System instructions authored for the agent. Included when `expansion=instructions` is requested. */
2911
+ instructions?: string | null;
2912
+ /**
2913
+ * @description Model temperature. Included when `expansion=temperature` is requested.
2914
+ * @example 1
2915
+ */
2916
+ temperature?: number;
2917
+ /** @description Maximum output tokens per turn. Included when `expansion=maxOutputTokens` is requested. */
2918
+ maxOutputTokens?: number | null;
2919
+ /**
2920
+ * @description Top-p sampling. Included when `expansion=topP` is requested.
2921
+ * @example 1
2922
+ */
2923
+ topP?: number;
2924
+ /**
2925
+ * @description Frequency penalty. Included when `expansion=frequencyPenalty` is requested.
2926
+ * @example 0
2927
+ */
2928
+ frequencyPenalty?: number;
2929
+ /**
2930
+ * @description Presence penalty. Included when `expansion=presencePenalty` is requested.
2931
+ * @example 0
2932
+ */
2933
+ presencePenalty?: number;
2934
+ /**
2935
+ * @description Maximum retries for a failed model call. Included when `expansion=maxRetries` is requested.
2936
+ * @example 0
2937
+ */
2938
+ maxRetries?: number;
2939
+ /** @description Fixed sampling seed. Included when `expansion=seed` is requested. */
2940
+ seed?: number | null;
2941
+ /**
2942
+ * @description Maximum tool roundtrips per turn. Included when `expansion=maxToolRoundtrips` is requested.
2943
+ * @example 5
2944
+ */
2945
+ maxToolRoundtrips?: number;
2946
+ /**
2947
+ * @description How many previous messages are sent to the model. Included when `expansion=messageLookbackLimit` is requested.
2948
+ * @example 40
2949
+ */
2950
+ messageLookbackLimit?: number;
2951
+ /** @description Configured tool nodes (app actions) for the agent. Included when `expansion=tools` is requested. */
2952
+ tools?: {
2953
+ [key: string]: unknown;
2954
+ }[] | null;
2955
+ /** @description Action IDs of the configured tools. Included when `expansion=toolIds` is requested. */
2956
+ toolIds?: string[];
2957
+ /** @description Instructions used when auto-naming new tasks. Included when `expansion=taskNamingInstructions` is requested. */
2958
+ taskNamingInstructions?: string | null;
2959
+ /** @description IDs of enabled provider built-in tools. Included when `expansion=enabledBuiltInTools` is requested. */
2960
+ enabledBuiltInTools?: string[];
2961
+ /** @description IDs of enabled platform tools. Included when `expansion=enabledPlatformTools` is requested. */
2962
+ enabledPlatformTools?: string[];
2963
+ /** @description Whether dynamic workflow-app action discovery is enabled. Included when `expansion=dynamicActionDiscoveryEnabled` is requested. */
2964
+ dynamicActionDiscoveryEnabled?: boolean;
2965
+ /** @description Whether dynamic MCP server discovery is enabled. Included when `expansion=dynamicMcpDiscoveryEnabled` is requested. */
2966
+ dynamicMcpDiscoveryEnabled?: boolean;
2967
+ /** @description Whether the agent maintains its own instructions. Included when `expansion=dynamicSelfInstructionsEnabled` is requested. */
2968
+ dynamicSelfInstructionsEnabled?: boolean;
2969
+ /** @description Whether long-term memory is enabled. Included when `expansion=memoryEnabled` is requested. */
2970
+ memoryEnabled?: boolean;
2971
+ /** @description Whether runtime planning tools are enabled. Included when `expansion=enablePlanning` is requested. */
2972
+ enablePlanning?: boolean;
2973
+ /** @description Whether oversized tool-result offload is enabled. Included when `expansion=enableToolResultOffload` is requested. */
2974
+ enableToolResultOffload?: boolean;
2975
+ /** @description Byte threshold for tool-result offload. Included when `expansion=toolResultOffloadThresholdBytes` is requested. */
2976
+ toolResultOffloadThresholdBytes?: number;
2977
+ /** @description Whether long-horizon mode is enabled. Included when `expansion=longHorizonMode` is requested. */
2978
+ longHorizonMode?: boolean;
2979
+ /** @description prepareStep safety-net policy ids. Included when `expansion=enabledToolPolicies` is requested. */
2980
+ enabledToolPolicies?: string[];
2981
+ /** @description Per-tool force overrides. Included when `expansion=forcedTools` is requested. */
2982
+ forcedTools?: string[];
2983
+ /** @description When true with planning, gate heavy tools until plan approval. Included when `expansion=requirePlanApproval` is requested. */
2984
+ requirePlanApproval?: boolean;
2985
+ /** @description Optional elevated max steps for long-horizon mode. Included when `expansion=longHorizonMaxSteps` is requested. */
2986
+ longHorizonMaxSteps?: number | null;
2987
+ /** @description Optional max tokens per run hint for long-horizon mode. Included when `expansion=longHorizonMaxTokensPerRun` is requested. */
2988
+ longHorizonMaxTokensPerRun?: number | null;
2989
+ /**
2990
+ * @description Memory partitioning scope. Included when `expansion=memoryScope` is requested.
2991
+ * @enum {string}
2992
+ */
2993
+ memoryScope?: "PER_USER" | "PER_AGENT" | "PER_USER_PER_AGENT";
2994
+ /**
2995
+ * @description Days memories are retained. Included when `expansion=memoryRetentionDays` is requested.
2996
+ * @example 90
2997
+ */
2998
+ memoryRetentionDays?: number;
2999
+ /** @description Suggested prompts shown to users starting a conversation. Included when `expansion=suggestedPrompts` is requested. */
3000
+ suggestedPrompts?: string[];
3001
+ /**
3002
+ * Format: date-time
3003
+ * @description When builder setup was completed (the first-time wizard, or a code deploy). Included when `expansion=builderSetupCompletedAt` is requested.
3004
+ */
3005
+ builderSetupCompletedAt?: string | null;
3006
+ /** @description Saved canvas node positions for the agent builder. Included when `expansion=builderCanvasPositions` is requested. */
3007
+ builderCanvasPositions?: {
3008
+ [key: string]: unknown;
3009
+ } | null;
3010
+ /** @description Selected model ID within the AI provider connection. Included when `expansion=selectedModelId` is requested. */
3011
+ selectedModelId?: string | null;
3012
+ /** @description Assigned AI provider connection. Included when `expansion=aiConnection` is requested. */
3013
+ aiConnection?: {
3014
+ id?: string;
3015
+ name?: string;
3016
+ providerConfig?: {
3017
+ id?: string;
3018
+ providerSlug?: string;
3019
+ };
3020
+ } | null;
3021
+ /** @description Knowledge notebooks attached to the agent. Included when `expansion=knowledge` is requested. */
3022
+ agentKnowledge?: {
3023
+ id?: string;
3024
+ knowledge?: {
3025
+ id?: string;
3026
+ name?: string;
3027
+ };
3028
+ }[];
3029
+ /** @description Object types attached to the agent. Included when `expansion=objectTypes` is requested. */
3030
+ agentObjectTypes?: {
3031
+ id?: string;
3032
+ scope?: string;
3033
+ objectType?: {
3034
+ id?: string;
3035
+ name?: string;
3036
+ slug?: string;
3037
+ icon?: string | null;
3038
+ color?: string | null;
3039
+ };
3040
+ }[];
3041
+ /** @description Objects attached to the agent. Included when `expansion=objects` is requested. */
3042
+ agentObjects?: {
3043
+ id?: string;
3044
+ scope?: string;
3045
+ object?: {
3046
+ id?: string;
3047
+ name?: string;
3048
+ state?: string;
3049
+ objectType?: {
3050
+ id?: string;
3051
+ name?: string;
3052
+ slug?: string;
3053
+ icon?: string | null;
3054
+ color?: string | null;
3055
+ };
3056
+ };
3057
+ }[];
3058
+ /** @description App connections available to the agent. Included when `expansion=connections` is requested. */
3059
+ connections?: {
3060
+ id?: string;
3061
+ name?: string;
3062
+ }[];
3063
+ /** @description Variables attached to the agent. Included when `expansion=variables` is requested. */
3064
+ agentVariables?: {
3065
+ id?: string;
3066
+ variable?: {
3067
+ id?: string;
3068
+ name?: string;
3069
+ };
3070
+ }[];
3071
+ /** @description Workflows the agent can trigger. Included when `expansion=workflows` is requested. */
3072
+ agentWorkflows?: {
3073
+ id?: string;
3074
+ workflow?: {
3075
+ id?: string;
3076
+ name?: string;
3077
+ };
3078
+ }[];
3079
+ /** @description Sub-agent links for the agent. Included when `expansion=subAgents` is requested. */
3080
+ agentSubAgents?: {
3081
+ id?: string;
3082
+ subagent?: {
3083
+ id?: string;
3084
+ name?: string;
3085
+ };
3086
+ parentAgent?: {
3087
+ id?: string;
3088
+ name?: string;
3089
+ };
3090
+ }[];
3091
+ /** @description MCP servers attached to the agent, with per-tool overrides. Included when `expansion=mcpServers` is requested. */
3092
+ agentMcpServers?: {
3093
+ id?: string;
3094
+ mcpServer?: {
3095
+ id?: string;
3096
+ slug?: string;
3097
+ name?: string;
3098
+ provider?: string;
3099
+ logoUrl?: string | null;
3100
+ description?: string | null;
3101
+ };
3102
+ toolOverrides?: {
3103
+ id?: string;
3104
+ toolName?: string;
3105
+ enabled?: boolean;
3106
+ requireApproval?: boolean;
3107
+ }[];
3108
+ }[];
3109
+ /** @description A2A (agent-to-agent) endpoints attached to the agent. Included when `expansion=a2aAgents` is requested. */
3110
+ agentA2aAgents?: {
3111
+ id?: string;
3112
+ a2aAgent?: {
3113
+ id?: string;
3114
+ slug?: string;
3115
+ name?: string;
3116
+ logoUrl?: string | null;
3117
+ description?: string | null;
3118
+ authType?: string;
3119
+ };
3120
+ }[];
3121
+ /** @description Web access configuration. Included when `expansion=webAccess` is requested. */
3122
+ agentWebAccess?: {
3123
+ service?: string;
3124
+ webSearchEnabled?: boolean;
3125
+ websiteAccessEnabled?: boolean;
3126
+ } | null;
3127
+ /** @description Phone access configuration. Included when `expansion=phoneAccess` is requested. */
3128
+ agentPhoneAccess?: {
3129
+ service?: string;
3130
+ outboundCallsEnabled?: boolean;
3131
+ inboundCallsEnabled?: boolean;
3132
+ } | null;
3133
+ /** @description sha256 hex of the stored agent definition. */
3134
+ revision: string;
3135
+ /** @description Stored agent definition in the file shape, including settings, tools, and linked resources. */
3136
+ definition: {
3137
+ [key: string]: unknown;
3138
+ };
3139
+ };
3140
+ AgentResponseDto: {
3141
+ /**
3142
+ * @description Agent ID (UUID)
3143
+ * @example 4f7c9d2e-8a1b-4c3d-9e5f-6a7b8c9d0e1f
3144
+ */
3145
+ id: string;
3146
+ /**
3147
+ * @description Agent name
3148
+ * @example Invoice Triage Agent
3149
+ */
3150
+ name: string;
3151
+ /** @description Stable workspace-scoped slug for CLI / code deploy upserts. Included when `expansion=slug` is requested. */
3152
+ slug?: string | null;
3153
+ /**
3154
+ * @description Where this agent is defined. Included when `expansion=codeSource` is requested.
3155
+ * @enum {string}
3156
+ */
3157
+ codeSource?: "none" | "synced" | "generated";
3158
+ /**
3159
+ * @description Sync state against the definitions folder. Included when `expansion=codeSyncStatus` is requested.
3160
+ * @enum {string}
3161
+ */
3162
+ codeSyncStatus?: "none" | "in_sync" | "changed_in_ui" | "locked";
2520
3163
  /** @description ID of the AI provider connection assigned to the agent. Always included. Null when the agent falls back to the workspace default connection. */
2521
3164
  FK_aiConnectionId: string | null;
2522
3165
  /** @description Agent description. Included when `expansion=description` is requested. */
@@ -2626,7 +3269,7 @@ interface components {
2626
3269
  suggestedPrompts?: string[];
2627
3270
  /**
2628
3271
  * Format: date-time
2629
- * @description When the first-time builder setup wizard was completed. Included when `expansion=builderSetupCompletedAt` is requested.
3272
+ * @description When builder setup was completed (the first-time wizard, or a code deploy). Included when `expansion=builderSetupCompletedAt` is requested.
2630
3273
  */
2631
3274
  builderSetupCompletedAt?: string | null;
2632
3275
  /** @description Saved canvas node positions for the agent builder. Included when `expansion=builderCanvasPositions` is requested. */
@@ -2757,6 +3400,25 @@ interface components {
2757
3400
  inboundCallsEnabled?: boolean;
2758
3401
  } | null;
2759
3402
  };
3403
+ AgentDefinitionResponseDto: {
3404
+ /** @description Agent ID (UUID). */
3405
+ id: string;
3406
+ /** @description Workspace-scoped slug. */
3407
+ slug: string;
3408
+ /** @description Workspace that owns the agent. */
3409
+ workspaceId: string;
3410
+ /**
3411
+ * @description Where this agent is defined.
3412
+ * @enum {string}
3413
+ */
3414
+ codeSource: "none" | "synced" | "generated";
3415
+ /** @description sha256 hex of the canonical agent definition. */
3416
+ revision: string;
3417
+ /** @description Agent definition in the file shape (kind, slug, settings, tools, and linked resources). */
3418
+ definition: {
3419
+ [key: string]: unknown;
3420
+ };
3421
+ };
2760
3422
  WorkflowAppResponseDto: {
2761
3423
  /** @description App ID, e.g. `gmail`. Matches the appId used in workflow execution steps. */
2762
3424
  id: string;
@@ -3628,32 +4290,6 @@ interface components {
3628
4290
  /** Format: date-time */
3629
4291
  updatedAt: string;
3630
4292
  };
3631
- PublicAiModelResponseDto: {
3632
- /** @description Catalogue model id passed to agent deploy as `model`. Example: `deepseek-ai/DeepSeek-V4-Pro`. */
3633
- id: string;
3634
- /** @description Display name. */
3635
- name: string;
3636
- /** @description True when this is the model used if an agent deploy omits `model` on this connection. */
3637
- isDefault: boolean;
3638
- /** @description Whether the model can call tools. */
3639
- supportsTools: boolean;
3640
- /** @description Whether the model accepts image input. */
3641
- supportsVision: boolean;
3642
- /** @description Whether the model exposes a reasoning mode. */
3643
- supportsReasoning: boolean;
3644
- };
3645
- PublicAiConnectionResponseDto: {
3646
- /** @description AiProviderConnection UUID. Pass as `aiConnectionId` / `defineAiConnection({ id })` when this connection is not the default. */
3647
- id: string;
3648
- /** @description Connection display name. Example: `Lunnoa LLMs`. */
3649
- name: string;
3650
- /** @description Provider slug. Example: `featherless` or `openai`. */
3651
- provider: string;
3652
- /** @description True for the connection used when an agent deploy omits `aiConnectionId`. */
3653
- isDefault: boolean;
3654
- /** @description Models this connection accepts. Inactive models are omitted. */
3655
- models: components["schemas"]["PublicAiModelResponseDto"][];
3656
- };
3657
4293
  ConnectionWorkspaceDto: {
3658
4294
  /** @description Workspace ID. */
3659
4295
  id: string;
@@ -3775,6 +4411,20 @@ interface components {
3775
4411
  activeStreamId?: string;
3776
4412
  /** @description Durable outcome of the most recent agent-turn run. Omitted when the task has never run. */
3777
4413
  latestRun?: components["schemas"]["TaskLatestRunDto"];
4414
+ /** @description Runtime todo/plan for this task when the agent has planning enabled (CTO-258). Always returned from the single-task endpoints. */
4415
+ runtimePlan?: {
4416
+ id?: string;
4417
+ content?: string;
4418
+ /** @enum {string} */
4419
+ status?: "pending" | "in_progress" | "completed" | "cancelled";
4420
+ /** Format: date-time */
4421
+ updatedAt?: string;
4422
+ }[] | null;
4423
+ /**
4424
+ * Format: date-time
4425
+ * @description When the current runtime plan was approved (HITL). Null until approved or after the plan is rewritten.
4426
+ */
4427
+ planApprovedAt?: string | null;
3778
4428
  /** @description Task description. Included when `expansion=description` is requested. */
3779
4429
  description?: string | null;
3780
4430
  /**
@@ -3886,7 +4536,7 @@ interface components {
3886
4536
  [key: string]: unknown;
3887
4537
  }[];
3888
4538
  /**
3889
- * @description Agent chat mode
4539
+ * @description Loop to run. Omit or send `preview` for an app, public chat, or workflow turn (10 model rounds). `builder` is the agent-editor interview and stops after 4 rounds.
3890
4540
  * @example preview
3891
4541
  * @enum {string}
3892
4542
  */
@@ -3918,6 +4568,26 @@ interface components {
3918
4568
  pathItems: never;
3919
4569
  }
3920
4570
  interface operations {
4571
+ AiConnectionsController_list: {
4572
+ parameters: {
4573
+ query?: never;
4574
+ header?: never;
4575
+ path?: never;
4576
+ cookie?: never;
4577
+ };
4578
+ requestBody?: never;
4579
+ responses: {
4580
+ /** @description AI connections and the models each one accepts. */
4581
+ 200: {
4582
+ headers: {
4583
+ [name: string]: unknown;
4584
+ };
4585
+ content: {
4586
+ "application/json": components["schemas"]["PublicAiConnectionResponseDto"][];
4587
+ };
4588
+ };
4589
+ };
4590
+ };
3921
4591
  DiscoveryController_getEnabledWorkspaceFeatures: {
3922
4592
  parameters: {
3923
4593
  query?: never;
@@ -4705,7 +5375,7 @@ interface operations {
4705
5375
  includeType?: string;
4706
5376
  /** @description Comma-separated key:value filters. Available: agentCanTrigger. Example: filterBy=agentCanTrigger:true */
4707
5377
  filterBy?: string;
4708
- /** @description Comma-separated fields to expand. Available: createdAt, updatedAt, isActive, isInternal, description, output, nodes, edges, triggerNode, triggerAndActionIds, pollStorage, nextScheduledExecution, orientation. Example: expansion=description,isActive */
5378
+ /** @description Comma-separated fields to expand. Available: createdAt, updatedAt, isActive, isInternal, slug, codeSource, codeSyncStatus, description, output, nodes, edges, triggerNode, triggerAndActionIds, pollStorage, nextScheduledExecution, orientation. Example: expansion=description,isActive */
4709
5379
  expansion?: string;
4710
5380
  };
4711
5381
  header?: never;
@@ -4738,21 +5408,57 @@ interface operations {
4738
5408
  };
4739
5409
  };
4740
5410
  responses: {
4741
- /** @description The created or updated workflow. */
5411
+ /** @description The created or updated workflow, including its stored revision and definition. */
4742
5412
  200: {
4743
5413
  headers: {
4744
5414
  [name: string]: unknown;
4745
5415
  };
4746
5416
  content: {
4747
- "application/json": components["schemas"]["WorkflowResponseDto"];
5417
+ "application/json": components["schemas"]["UpsertWorkflowResponseDto"];
5418
+ };
5419
+ };
5420
+ /** @description The slug already exists and baseRevision was omitted, or the workflow changed in the UI since baseRevision. The body message explains which, and currentRevision is set when the revision check failed. A lost optimistic-concurrency race returns the same 409. */
5421
+ 409: {
5422
+ headers: {
5423
+ [name: string]: unknown;
5424
+ };
5425
+ content?: never;
5426
+ };
5427
+ };
5428
+ };
5429
+ WorkflowsController_getDefinitionBySlug: {
5430
+ parameters: {
5431
+ query?: never;
5432
+ header?: never;
5433
+ path: {
5434
+ slug: string;
5435
+ };
5436
+ cookie?: never;
5437
+ };
5438
+ requestBody?: never;
5439
+ responses: {
5440
+ /** @description The workflow id, code source, revision, and definition. */
5441
+ 200: {
5442
+ headers: {
5443
+ [name: string]: unknown;
5444
+ };
5445
+ content: {
5446
+ "application/json": components["schemas"]["WorkflowDefinitionResponseDto"];
5447
+ };
5448
+ };
5449
+ /** @description No workflow with this slug exists in the workspace. */
5450
+ 404: {
5451
+ headers: {
5452
+ [name: string]: unknown;
4748
5453
  };
5454
+ content?: never;
4749
5455
  };
4750
5456
  };
4751
5457
  };
4752
5458
  WorkflowsController_findOne: {
4753
5459
  parameters: {
4754
5460
  query?: {
4755
- /** @description Comma-separated fields to expand. Available: createdAt, updatedAt, isActive, isInternal, description, output, project, nodes, edges, triggerNode, triggerAndActionIds, subWorkflowIds, agentIds, pollStorage, nextScheduledExecution, orientation. Example: expansion=description,nodes,edges */
5461
+ /** @description Comma-separated fields to expand. Available: createdAt, updatedAt, isActive, isInternal, slug, codeSource, codeSyncStatus, description, output, project, nodes, edges, triggerNode, triggerAndActionIds, subWorkflowIds, agentIds, pollStorage, nextScheduledExecution, orientation. Example: expansion=description,nodes,edges */
4756
5462
  expansion?: string;
4757
5463
  };
4758
5464
  header?: never;
@@ -4774,6 +5480,26 @@ interface operations {
4774
5480
  };
4775
5481
  };
4776
5482
  };
5483
+ CodeSyncController_getContext: {
5484
+ parameters: {
5485
+ query?: never;
5486
+ header?: never;
5487
+ path?: never;
5488
+ cookie?: never;
5489
+ };
5490
+ requestBody?: never;
5491
+ responses: {
5492
+ /** @description Workspace id and the lock-code-synced-resources preference. */
5493
+ 200: {
5494
+ headers: {
5495
+ [name: string]: unknown;
5496
+ };
5497
+ content: {
5498
+ "application/json": components["schemas"]["CodeSyncContextResponseDto"];
5499
+ };
5500
+ };
5501
+ };
5502
+ };
4777
5503
  AgentsController_findAllForWorkspace: {
4778
5504
  parameters: {
4779
5505
  query?: {
@@ -4781,7 +5507,7 @@ interface operations {
4781
5507
  includeType?: string;
4782
5508
  /** @description Filters in `key:value` format, comma-separated. */
4783
5509
  filterBy?: string;
4784
- /** @description Comma-separated fields to expand, e.g. `expansion=description,createdAt`. Available: createdAt, updatedAt, description, profileImageUrl, instructions, temperature, maxOutputTokens, topP, frequencyPenalty, presencePenalty, maxRetries, seed, maxToolRoundtrips, messageLookbackLimit, tools, toolIds, knowledge, objects, objectTypes, connections, variables, workflows, subAgents, webAccess, phoneAccess, aiConnection, selectedModelId, taskNamingInstructions, enabledBuiltInTools, enabledPlatformTools, mcpServers, a2aAgents, dynamicActionDiscoveryEnabled, dynamicMcpDiscoveryEnabled, dynamicSelfInstructionsEnabled, memoryEnabled, memoryScope, memoryRetentionDays, enablePlanning, enableToolResultOffload, toolResultOffloadThresholdBytes, longHorizonMode, longHorizonMaxSteps, longHorizonMaxTokensPerRun, enabledToolPolicies, forcedTools, requirePlanApproval, suggestedPrompts, builderSetupCompletedAt, builderCanvasPositions, slug, managedByCode */
5510
+ /** @description Comma-separated fields to expand, e.g. `expansion=description,createdAt`. Available: createdAt, updatedAt, description, profileImageUrl, instructions, temperature, maxOutputTokens, topP, frequencyPenalty, presencePenalty, maxRetries, seed, maxToolRoundtrips, messageLookbackLimit, tools, toolIds, knowledge, objects, objectTypes, connections, variables, workflows, subAgents, webAccess, phoneAccess, aiConnection, selectedModelId, taskNamingInstructions, enabledBuiltInTools, enabledPlatformTools, mcpServers, a2aAgents, dynamicActionDiscoveryEnabled, dynamicMcpDiscoveryEnabled, dynamicSelfInstructionsEnabled, memoryEnabled, memoryScope, memoryRetentionDays, enablePlanning, enableToolResultOffload, toolResultOffloadThresholdBytes, longHorizonMode, longHorizonMaxSteps, longHorizonMaxTokensPerRun, enabledToolPolicies, forcedTools, requirePlanApproval, suggestedPrompts, builderSetupCompletedAt, builderCanvasPositions, slug, codeSource, codeSyncStatus */
4785
5511
  expansion?: string;
4786
5512
  };
4787
5513
  header?: never;
@@ -4814,21 +5540,57 @@ interface operations {
4814
5540
  };
4815
5541
  };
4816
5542
  responses: {
4817
- /** @description The created or updated agent. */
5543
+ /** @description The created or updated agent, including its stored definition and revision. */
4818
5544
  200: {
4819
5545
  headers: {
4820
5546
  [name: string]: unknown;
4821
5547
  };
4822
5548
  content: {
4823
- "application/json": components["schemas"]["AgentResponseDto"];
5549
+ "application/json": components["schemas"]["AgentUpsertResponseDto"];
5550
+ };
5551
+ };
5552
+ /** @description The slug already exists and baseRevision is missing or stale, or the agent changed during the write. The body includes the server message and, when known, currentRevision. */
5553
+ 409: {
5554
+ headers: {
5555
+ [name: string]: unknown;
5556
+ };
5557
+ content?: never;
5558
+ };
5559
+ };
5560
+ };
5561
+ AgentsController_getDefinitionBySlug: {
5562
+ parameters: {
5563
+ query?: never;
5564
+ header?: never;
5565
+ path: {
5566
+ slug: string;
5567
+ };
5568
+ cookie?: never;
5569
+ };
5570
+ requestBody?: never;
5571
+ responses: {
5572
+ /** @description The agent definition and its revision. */
5573
+ 200: {
5574
+ headers: {
5575
+ [name: string]: unknown;
5576
+ };
5577
+ content: {
5578
+ "application/json": components["schemas"]["AgentDefinitionResponseDto"];
5579
+ };
5580
+ };
5581
+ /** @description No agent with this slug exists in the workspace. */
5582
+ 404: {
5583
+ headers: {
5584
+ [name: string]: unknown;
4824
5585
  };
5586
+ content?: never;
4825
5587
  };
4826
5588
  };
4827
5589
  };
4828
5590
  AgentsController_findOne: {
4829
5591
  parameters: {
4830
5592
  query?: {
4831
- /** @description Comma-separated fields to expand, e.g. `expansion=description,createdAt`. Available: createdAt, updatedAt, description, profileImageUrl, instructions, temperature, maxOutputTokens, topP, frequencyPenalty, presencePenalty, maxRetries, seed, maxToolRoundtrips, messageLookbackLimit, tools, toolIds, knowledge, objects, objectTypes, connections, variables, workflows, subAgents, webAccess, phoneAccess, aiConnection, selectedModelId, taskNamingInstructions, enabledBuiltInTools, enabledPlatformTools, mcpServers, a2aAgents, dynamicActionDiscoveryEnabled, dynamicMcpDiscoveryEnabled, dynamicSelfInstructionsEnabled, memoryEnabled, memoryScope, memoryRetentionDays, enablePlanning, enableToolResultOffload, toolResultOffloadThresholdBytes, longHorizonMode, longHorizonMaxSteps, longHorizonMaxTokensPerRun, enabledToolPolicies, forcedTools, requirePlanApproval, suggestedPrompts, builderSetupCompletedAt, builderCanvasPositions, slug, managedByCode */
5593
+ /** @description Comma-separated fields to expand, e.g. `expansion=description,createdAt`. Available: createdAt, updatedAt, description, profileImageUrl, instructions, temperature, maxOutputTokens, topP, frequencyPenalty, presencePenalty, maxRetries, seed, maxToolRoundtrips, messageLookbackLimit, tools, toolIds, knowledge, objects, objectTypes, connections, variables, workflows, subAgents, webAccess, phoneAccess, aiConnection, selectedModelId, taskNamingInstructions, enabledBuiltInTools, enabledPlatformTools, mcpServers, a2aAgents, dynamicActionDiscoveryEnabled, dynamicMcpDiscoveryEnabled, dynamicSelfInstructionsEnabled, memoryEnabled, memoryScope, memoryRetentionDays, enablePlanning, enableToolResultOffload, toolResultOffloadThresholdBytes, longHorizonMode, longHorizonMaxSteps, longHorizonMaxTokensPerRun, enabledToolPolicies, forcedTools, requirePlanApproval, suggestedPrompts, builderSetupCompletedAt, builderCanvasPositions, slug, codeSource, codeSyncStatus */
4832
5594
  expansion?: string;
4833
5595
  };
4834
5596
  header?: never;
@@ -5923,26 +6685,6 @@ interface operations {
5923
6685
  };
5924
6686
  };
5925
6687
  };
5926
- AiConnectionsController_list: {
5927
- parameters: {
5928
- query?: never;
5929
- header?: never;
5930
- path?: never;
5931
- cookie?: never;
5932
- };
5933
- requestBody?: never;
5934
- responses: {
5935
- /** @description AI connections and the models each one accepts. */
5936
- 200: {
5937
- headers: {
5938
- [name: string]: unknown;
5939
- };
5940
- content: {
5941
- "application/json": components["schemas"]["PublicAiConnectionResponseDto"][];
5942
- };
5943
- };
5944
- };
5945
- };
5946
6688
  ConnectionsController_findAllForWorkspace: {
5947
6689
  parameters: {
5948
6690
  query?: {
@@ -6367,15 +7109,38 @@ interface operations {
6367
7109
  */
6368
7110
 
6369
7111
  type Schemas = components['schemas'];
7112
+ /** Where an agent or workflow definition was last written from. */
7113
+ type CodeSource = 'none' | 'synced' | 'generated';
7114
+ /** Computed on read. `locked` means the UI cannot edit the definition. */
7115
+ type CodeSyncStatus = 'none' | 'in_sync' | 'changed_in_ui' | 'locked';
7116
+ interface CodeSyncContext {
7117
+ workspaceId: string;
7118
+ lockCodeSyncedResources: boolean;
7119
+ }
7120
+ /** `GET /api/{agents|workflows}/slug/:slug/definition`. */
7121
+ interface CodeDefinitionResponse<TDefinition> {
7122
+ id: string;
7123
+ slug: string;
7124
+ workspaceId: string;
7125
+ codeSource: CodeSource;
7126
+ revision: string;
7127
+ definition: TDefinition;
7128
+ }
6370
7129
  type EnabledFeatures = Schemas['EnabledFeaturesResponseDto'];
6371
- type Agent = Schemas['AgentResponseDto'];
7130
+ type Agent = Omit<Schemas['AgentResponseDto'], 'managedByCode'> & {
7131
+ codeSource?: CodeSource;
7132
+ codeSyncStatus?: CodeSyncStatus;
7133
+ };
6372
7134
  type Task = Schemas['TaskResponseDto'];
6373
7135
  type TaskListItem = Schemas['TaskListItemResponseDto'];
6374
7136
  type CreateTaskInput = Schemas['CreateTaskDto'];
6375
7137
  type UpdateTaskInput = Schemas['UpdateTaskDto'];
6376
7138
  type DeletedTask = Schemas['DeletedTaskResponseDto'];
6377
7139
  type MessageTaskInput = Schemas['MessageTaskDto'];
6378
- type Workflow = Schemas['WorkflowResponseDto'];
7140
+ type Workflow = Omit<Schemas['WorkflowResponseDto'], 'managedByCode'> & {
7141
+ codeSource?: CodeSource;
7142
+ codeSyncStatus?: CodeSyncStatus;
7143
+ };
6379
7144
  type Execution = Schemas['ExecutionResponseDto'];
6380
7145
  type ExecutionPathStep = Schemas['ExecutionPathStepDto'];
6381
7146
  type ExecuteWorkflowResult = Schemas['ExecuteWorkflowResponseDto'];
@@ -6657,12 +7422,222 @@ declare class ActionsResource {
6657
7422
  get(appId: string, actionId: string): Promise<Record<string, unknown> | undefined>;
6658
7423
  }
6659
7424
 
7425
+ /**
7426
+ * On-disk agent and workflow definitions (the pull/push file shape).
7427
+ * `$schema` is allowed on input and stripped; the CLI adds it when writing.
7428
+ */
7429
+ interface RetrySettings {
7430
+ enabled: boolean;
7431
+ maxAttempts: number;
7432
+ delaySeconds: number;
7433
+ }
7434
+ interface ContinueOnFailureSettings {
7435
+ enabled: boolean;
7436
+ }
7437
+ /** Every key is present on files the API returns. Hand-written files may omit unset keys. */
7438
+ interface AgentFileSettings {
7439
+ temperature?: number;
7440
+ topP?: number;
7441
+ maxOutputTokens?: number | null;
7442
+ frequencyPenalty?: number;
7443
+ presencePenalty?: number;
7444
+ seed?: number | null;
7445
+ maxRetries?: number;
7446
+ maxToolRoundtrips?: number;
7447
+ messageLookbackLimit?: number;
7448
+ taskNamingInstructions?: string | null;
7449
+ enabledBuiltInTools?: string[];
7450
+ enabledPlatformTools?: string[];
7451
+ enabledToolPolicies?: string[];
7452
+ forcedTools?: unknown;
7453
+ suggestedPrompts?: string[];
7454
+ dynamicActionDiscoveryEnabled?: boolean;
7455
+ dynamicMcpDiscoveryEnabled?: boolean;
7456
+ dynamicSelfInstructionsEnabled?: boolean;
7457
+ memoryEnabled?: boolean;
7458
+ memoryScope?: string;
7459
+ memoryRetentionDays?: number;
7460
+ enablePlanning?: boolean;
7461
+ requirePlanApproval?: boolean;
7462
+ enableToolResultOffload?: boolean;
7463
+ toolResultOffloadThresholdBytes?: number;
7464
+ longHorizonMode?: boolean;
7465
+ longHorizonMaxSteps?: number | null;
7466
+ longHorizonMaxTokensPerRun?: number | null;
7467
+ piiRoutingMode?: string;
7468
+ piiFallbackConnectionId?: string | null;
7469
+ piiFallbackModelId?: string | null;
7470
+ webAccess?: boolean | null;
7471
+ phoneAccess?: boolean | null;
7472
+ }
7473
+ interface AgentFileTool {
7474
+ key: string;
7475
+ /** Catalogue action id. */
7476
+ id: string;
7477
+ appId?: string;
7478
+ connection?: {
7479
+ id: string;
7480
+ };
7481
+ name: string;
7482
+ description?: string;
7483
+ input: Record<string, unknown>;
7484
+ }
7485
+ interface AgentLinkBySlug {
7486
+ slug: string;
7487
+ }
7488
+ interface AgentLinkById {
7489
+ id: string;
7490
+ }
7491
+ type AgentSlugOrId = AgentLinkBySlug | AgentLinkById;
7492
+ interface AgentFileDefinition {
7493
+ kind: 'agent';
7494
+ slug: string;
7495
+ name: string;
7496
+ description?: string;
7497
+ model?: string;
7498
+ aiConnection?: {
7499
+ id: string;
7500
+ };
7501
+ /**
7502
+ * API and TypeScript use a string. Files on disk point at
7503
+ * `<slug>.instructions.md`; only the CLI reads that file.
7504
+ */
7505
+ instructions: string | {
7506
+ file: string;
7507
+ };
7508
+ settings: AgentFileSettings;
7509
+ tools: AgentFileTool[];
7510
+ workflows: AgentSlugOrId[];
7511
+ agents: AgentSlugOrId[];
7512
+ connections: AgentLinkById[];
7513
+ knowledge: AgentLinkById[];
7514
+ variables: AgentLinkById[];
7515
+ objects: AgentLinkById[];
7516
+ objectTypes: AgentLinkById[];
7517
+ mcpServers: Array<{
7518
+ id: string;
7519
+ connectionId?: string;
7520
+ }>;
7521
+ a2aAgents: AgentLinkById[];
7522
+ }
7523
+ /** Authoring / `JSON.parse` input. Lists and settings may be omitted; pulled files include them. */
7524
+ type AgentFileInput = Omit<AgentFileDefinition, 'kind' | 'name' | 'instructions' | 'settings' | 'tools' | 'workflows' | 'agents' | 'connections' | 'knowledge' | 'variables' | 'objects' | 'objectTypes' | 'mcpServers' | 'a2aAgents'> & {
7525
+ $schema?: string;
7526
+ kind?: 'agent';
7527
+ name?: string;
7528
+ instructions: string | {
7529
+ file: string;
7530
+ };
7531
+ settings?: Partial<AgentFileSettings>;
7532
+ tools?: AgentFileTool[];
7533
+ workflows?: AgentSlugOrId[];
7534
+ agents?: AgentSlugOrId[];
7535
+ connections?: AgentLinkById[];
7536
+ knowledge?: AgentLinkById[];
7537
+ variables?: AgentLinkById[];
7538
+ objects?: AgentLinkById[];
7539
+ objectTypes?: AgentLinkById[];
7540
+ mcpServers?: Array<{
7541
+ id: string;
7542
+ connectionId?: string;
7543
+ }>;
7544
+ a2aAgents?: AgentLinkById[];
7545
+ };
7546
+ interface WorkflowUseFile {
7547
+ id: string;
7548
+ appId?: string;
7549
+ connection?: {
7550
+ id: string;
7551
+ };
7552
+ }
7553
+ interface WorkflowTriggerFile {
7554
+ id: string;
7555
+ appId?: string;
7556
+ connection?: {
7557
+ id: string;
7558
+ };
7559
+ input?: Record<string, unknown>;
7560
+ inputs?: Array<Record<string, unknown>>;
7561
+ name: string;
7562
+ description?: string;
7563
+ }
7564
+ interface WorkflowStepFile {
7565
+ key: string;
7566
+ name: string;
7567
+ description?: string;
7568
+ use: WorkflowUseFile;
7569
+ input: Record<string, unknown>;
7570
+ retrySettings?: RetrySettings;
7571
+ continueOnFailure?: ContinueOnFailureSettings;
7572
+ paths?: Array<{
7573
+ label: string;
7574
+ when?: Array<Array<{
7575
+ field: string;
7576
+ condition: string;
7577
+ value?: string;
7578
+ }>>;
7579
+ steps: WorkflowStepFile[];
7580
+ }>;
7581
+ }
7582
+ interface WorkflowStepsFileDefinition {
7583
+ kind: 'workflow';
7584
+ format: 'steps';
7585
+ slug: string;
7586
+ name: string;
7587
+ description?: string;
7588
+ trigger: WorkflowTriggerFile;
7589
+ steps: WorkflowStepFile[];
7590
+ }
7591
+ type WorkflowStepsFileInput = Omit<WorkflowStepsFileDefinition, 'kind'> & {
7592
+ $schema?: string;
7593
+ kind?: 'workflow';
7594
+ };
7595
+ interface WorkflowGraphNode {
7596
+ id?: string;
7597
+ key: string;
7598
+ nodeType: 'trigger' | 'action';
7599
+ appId: string;
7600
+ actionId?: string;
7601
+ triggerId?: string;
7602
+ name: string;
7603
+ description?: string;
7604
+ value: Record<string, unknown>;
7605
+ retrySettings?: Record<string, unknown>;
7606
+ continueOnFailure?: Record<string, unknown>;
7607
+ [other: string]: unknown;
7608
+ }
7609
+ interface WorkflowGraphEdge {
7610
+ id?: string;
7611
+ source: string;
7612
+ target: string;
7613
+ sourceHandle?: string;
7614
+ targetHandle?: string;
7615
+ type?: string;
7616
+ }
7617
+ interface WorkflowGraphFileDefinition {
7618
+ kind: 'workflow';
7619
+ format: 'graph';
7620
+ slug: string;
7621
+ name: string;
7622
+ description?: string;
7623
+ nodes: WorkflowGraphNode[];
7624
+ edges: WorkflowGraphEdge[];
7625
+ }
7626
+ type WorkflowGraphFileInput = Omit<WorkflowGraphFileDefinition, 'kind'> & {
7627
+ $schema?: string;
7628
+ kind?: 'workflow';
7629
+ };
7630
+ type WorkflowFileDefinition = WorkflowStepsFileDefinition | WorkflowGraphFileDefinition;
7631
+ /** True for a file-shaped agent after `$schema` has been stripped. */
7632
+ declare function isAgentFileShape(config: unknown): config is AgentFileDefinition;
7633
+
6660
7634
  /**
6661
7635
  * Pure typed definition factories for local workflow/agent authoring.
6662
7636
  * These do not call the network. Deploy with the CLI; run ad-hoc with `runs.start`.
6663
7637
  *
6664
7638
  * Not the same as `@lunnoa/toolkit` `createAction` / `createApp` (in-platform apps).
6665
7639
  */
7640
+
6666
7641
  declare const DEFINE_KINDS: {
6667
7642
  readonly connection: "connection";
6668
7643
  readonly aiConnection: "aiConnection";
@@ -6751,6 +7726,15 @@ interface WorkflowStepDefinition {
6751
7726
  /** Per-step input overrides. Values may contain `ref.trigger` / `ref.step`. */
6752
7727
  input?: Record<string, unknown>;
6753
7728
  name?: string;
7729
+ description?: string;
7730
+ retrySettings?: {
7731
+ enabled: boolean;
7732
+ maxAttempts: number;
7733
+ delaySeconds: number;
7734
+ };
7735
+ continueOnFailure?: {
7736
+ enabled: boolean;
7737
+ };
6754
7738
  /**
6755
7739
  * Branches after this step. Only on Conditional Paths, Manually Decide Path,
6756
7740
  * or Request Approval (approved path first, then rejected), and only on the
@@ -6830,7 +7814,10 @@ declare const ref: {
6830
7814
  step: (key: string, ...path: Array<string | number>) => string;
6831
7815
  };
6832
7816
  declare function defineWorkflow(config: Omit<WorkflowDefinition, 'kind'>): WorkflowDefinition;
7817
+ declare function defineWorkflow(config: WorkflowStepsFileInput): WorkflowStepsFileDefinition;
7818
+ declare function defineWorkflow(config: WorkflowGraphFileInput): WorkflowGraphFileDefinition;
6833
7819
  declare function defineAgent(config: Omit<AgentDefinition, 'kind'>): AgentDefinition;
7820
+ declare function defineAgent(config: AgentFileInput): AgentFileDefinition;
6834
7821
  interface EntityTypeDefinition {
6835
7822
  kind: typeof DEFINE_KINDS.entityType;
6836
7823
  /** Stable deployment-wide slug (upsert key). Granted to the deployer's workspace when new. */
@@ -6856,9 +7843,11 @@ declare function resolveActionAppId(action: ActionDefinition): string;
6856
7843
  /** Infer appId from catalogue trigger ids like `flow-control_trigger_manual`. */
6857
7844
  declare function resolveTriggerAppId(trigger: TriggerDefinition): string;
6858
7845
  declare function resolveTriggerId(trigger: TriggerDefinition): string;
7846
+
6859
7847
  declare function resolveActionId(action: ActionDefinition): string;
6860
7848
 
6861
7849
  interface UpsertAgentToolInput {
7850
+ key?: string;
6862
7851
  appId: string;
6863
7852
  actionId: string;
6864
7853
  connectionId?: string;
@@ -6869,14 +7858,37 @@ interface UpsertAgentToolInput {
6869
7858
  interface UpsertAgentBySlugInput {
6870
7859
  slug: string;
6871
7860
  name?: string;
6872
- description?: string;
7861
+ /** Null clears a description that was removed from the definition file. */
7862
+ description?: string | null;
6873
7863
  instructions: string;
6874
- model: string;
7864
+ /** Null clears a model that was removed from the definition file. */
7865
+ model?: string | null;
6875
7866
  aiConnectionId?: string;
6876
7867
  connectionIds?: string[];
6877
7868
  workflowIds?: string[];
6878
7869
  tools?: UpsertAgentToolInput[];
6879
- managedByCode?: boolean;
7870
+ settings?: Partial<AgentFileSettings>;
7871
+ workflows?: AgentSlugOrId[];
7872
+ agents?: AgentSlugOrId[];
7873
+ knowledgeIds?: string[];
7874
+ variableIds?: string[];
7875
+ objectIds?: string[];
7876
+ objectTypeIds?: string[];
7877
+ mcpServers?: Array<{
7878
+ id: string;
7879
+ connectionId?: string;
7880
+ }>;
7881
+ a2aAgentIds?: string[];
7882
+ /** `generated` for TypeScript deploys, `synced` for definition files. */
7883
+ codeSource?: Extract<CodeSource, 'synced' | 'generated'>;
7884
+ baseRevision?: string;
7885
+ force?: boolean;
7886
+ }
7887
+ interface AgentUpsertOptions {
7888
+ workflowIds?: string[];
7889
+ codeSource?: Extract<CodeSource, 'synced' | 'generated'>;
7890
+ baseRevision?: string;
7891
+ force?: boolean;
6880
7892
  }
6881
7893
  declare class AgentsResource {
6882
7894
  private readonly http;
@@ -6885,13 +7897,13 @@ declare class AgentsResource {
6885
7897
  list(options?: ListQueryOptions): Promise<Agent[]>;
6886
7898
  /** Returns a single agent. */
6887
7899
  get(agentId: string, options?: Pick<ListQueryOptions, 'expansion'>): Promise<Agent>;
7900
+ /** Exported definition for `lunnoa/agents/<slug>.json`. */
7901
+ getDefinition(slug: string): Promise<CodeDefinitionResponse<AgentFileDefinition>>;
6888
7902
  /**
6889
7903
  * Upsert an agent by slug inside the workspace on the API key.
6890
7904
  * Prefer the CLI (`npx @lunnoa/client agents deploy`) for happy-path deploy.
6891
7905
  */
6892
- upsertBySlug(body: UpsertAgentBySlugInput | AgentDefinition, options?: {
6893
- workflowIds?: string[];
6894
- }): Promise<Agent>;
7906
+ upsertBySlug(body: UpsertAgentBySlugInput | AgentDefinition | AgentFileDefinition, options?: AgentUpsertOptions): Promise<Agent & CodeDefinitionResponse<AgentFileDefinition>>;
6895
7907
  }
6896
7908
 
6897
7909
  /**
@@ -7580,6 +8592,13 @@ declare class VariablesResource {
7580
8592
  delete(variableId: string): Promise<boolean>;
7581
8593
  }
7582
8594
 
8595
+ declare class CodeSyncResource {
8596
+ private readonly http;
8597
+ constructor(http: HttpClient);
8598
+ /** Workspace id and whether synced resources are locked in the UI. */
8599
+ context(): Promise<CodeSyncContext>;
8600
+ }
8601
+
7583
8602
  interface UpsertWorkflowStepInput {
7584
8603
  /** Name later steps use in `={{step:<key>,path}}`. Keeps the node id stable. */
7585
8604
  key?: string;
@@ -7589,6 +8608,14 @@ interface UpsertWorkflowStepInput {
7589
8608
  input?: Record<string, unknown>;
7590
8609
  name?: string;
7591
8610
  description?: string;
8611
+ retrySettings?: {
8612
+ enabled: boolean;
8613
+ maxAttempts: number;
8614
+ delaySeconds: number;
8615
+ };
8616
+ continueOnFailure?: {
8617
+ enabled: boolean;
8618
+ };
7592
8619
  /** Branches after this step (last step of a list only). */
7593
8620
  paths?: UpsertWorkflowPathInput[];
7594
8621
  }
@@ -7608,15 +8635,30 @@ interface UpsertWorkflowTriggerInput {
7608
8635
  name?: string;
7609
8636
  description?: string;
7610
8637
  }
8638
+ interface UpsertWorkflowGraphInput {
8639
+ nodes: WorkflowGraphFileDefinition['nodes'];
8640
+ edges: WorkflowGraphFileDefinition['edges'];
8641
+ }
7611
8642
  interface UpsertWorkflowBySlugInput {
7612
8643
  slug: string;
7613
8644
  name?: string;
7614
- description?: string;
8645
+ /** Null clears a description that was removed from the definition file. */
8646
+ description?: string | null;
7615
8647
  isActive?: boolean;
7616
8648
  /** Omit for Manually Run with no input fields. */
7617
8649
  trigger?: UpsertWorkflowTriggerInput;
7618
- steps: UpsertWorkflowStepInput[];
7619
- managedByCode?: boolean;
8650
+ steps?: UpsertWorkflowStepInput[];
8651
+ /** Lossless graph. Not sent together with `trigger` / `steps`. */
8652
+ graph?: UpsertWorkflowGraphInput;
8653
+ /** `generated` for TypeScript deploys, `synced` for definition files. */
8654
+ codeSource?: Extract<CodeSource, 'synced' | 'generated'>;
8655
+ baseRevision?: string;
8656
+ force?: boolean;
8657
+ }
8658
+ interface WorkflowUpsertOptions {
8659
+ codeSource?: Extract<CodeSource, 'synced' | 'generated'>;
8660
+ baseRevision?: string;
8661
+ force?: boolean;
7620
8662
  }
7621
8663
  declare class WorkflowsResource {
7622
8664
  private readonly http;
@@ -7629,11 +8671,13 @@ declare class WorkflowsResource {
7629
8671
  * the manual trigger's custom input field definitions.
7630
8672
  */
7631
8673
  get(workflowId: string, options?: Pick<ListQueryOptions, 'expansion'>): Promise<Workflow>;
8674
+ /** Exported definition for `lunnoa/workflows/<slug>.json`. */
8675
+ getDefinition(slug: string): Promise<CodeDefinitionResponse<WorkflowFileDefinition>>;
7632
8676
  /**
7633
8677
  * Upsert a workflow by slug inside the workspace on the API key.
7634
8678
  * Prefer the CLI (`npx @lunnoa/client workflows deploy`) for happy-path deploy.
7635
8679
  */
7636
- upsertBySlug(body: UpsertWorkflowBySlugInput | WorkflowDefinition): Promise<Workflow>;
8680
+ upsertBySlug(body: UpsertWorkflowBySlugInput | WorkflowDefinition | WorkflowFileDefinition, options?: WorkflowUpsertOptions): Promise<Workflow & CodeDefinitionResponse<WorkflowFileDefinition>>;
7637
8681
  /**
7638
8682
  * Starts a new execution of the workflow with the given trigger inputs.
7639
8683
  * Returns immediately with the execution ID.
@@ -7701,6 +8745,8 @@ declare class LunnoaClient {
7701
8745
  readonly aiConnections: AiConnectionsResource;
7702
8746
  readonly workflowApps: WorkflowAppsResource;
7703
8747
  readonly discovery: DiscoveryResource;
8748
+ /** Workspace id for the definitions lock, and the code-sync lock flag. */
8749
+ readonly codeSync: CodeSyncResource;
7704
8750
  constructor(options: LunnoaClientOptions);
7705
8751
  }
7706
8752
 
@@ -7714,6 +8760,8 @@ declare class LunnoaApiError extends Error {
7714
8760
  readonly method: string;
7715
8761
  /** Path of the failed request (without the base URL). */
7716
8762
  readonly path: string;
8763
+ /** Present on definition-sync 409s when the server sends the current revision. */
8764
+ readonly currentRevision?: string;
7717
8765
  constructor(args: {
7718
8766
  status: number;
7719
8767
  body: unknown;
@@ -7843,4 +8891,4 @@ interface CreateServerClientOptions {
7843
8891
  */
7844
8892
  declare function createServerClient(options: CreateServerClientOptions): LunnoaClient;
7845
8893
 
7846
- export { API_KEY_PREFIX, type ActionDefinition, ActionsResource, type AddQueueItemErrorInput, type Agent, AgentChatClient, AgentChatStream, type AgentDefinition, type AgentToolDefinition, AgentsResource, type AiConnection, type AiConnectionDefinition, type AiConnectionModel, AiConnectionsResource, type ApprovalInboxItem, ApprovalsResource, AuthResource, type AuthTokens, type BulkCreateQueueItemsInput, type BulkCreateQueueItemsResult, type ChangeEntityStateInput, type ChangeEntityStateResult, type ChatMode, type Connection, type ConnectionDefinition, ConnectionsResource, type CreateBrowserClientOptions, type CreateEntityInput, type CreateKnowledgeInput, type CreateQueueInput, type CreateQueueItemInput, type CreateServerClientOptions, type CreateTaskInput, type CreateVariableInput, type CurrentUser, DEFINE_KINDS, type DefineKind, type DeletedTask, DiscoveryResource, type EligibleApprover, type EnabledFeatures, EntitiesResource, type Entity, type EntityStateHistoryEntry, type EntityStateTransitions, type EntityType, type EntityTypeDefinition, type EntityTypeReadOptions, EntityTypesResource, type ExecuteWorkflowResult, type Execution, type ExecutionPathStep, type ExecutionProgress, type ExecutionProgressPayload, type ExecutionProgressStep, ExecutionProgressStream, type ExecutionStatus, type ExecutionStreamEvent, type ExecutionStreamEventType, ExecutionTimeoutError, ExecutionsResource, type ExportEntitiesInput, type FetchLike, HttpClient, type ImportEntitiesInput, type ImportEntitiesResult, type ImportTemplate, type Knowledge, type KnowledgeDocument, type KnowledgeDocumentGroup, KnowledgeResource, type ListEntitiesOptions, type ListQueryOptions, type ListQueueItemsByObjectOptions, type ListQueueItemsOptions, type LocalStorageTokenStoreOptions, type LoginRequires2FA, type LoginResult, type LoginSuccess, LunnoaApiError, LunnoaClient, type LunnoaClientOptions, type MessageTaskInput, type OffsetPagination, PATH_CONDITIONS, type PagePagination, type PaginatedEntities, type PathCondition, type PathConditionType, type PendingInput, type PendingInputField, type QueryValue, type Queue, type QueueAllowedObjectType, type QueueItem, type QueueItemCreated, type QueueItemErrorEntry, type QueueItemFull, type QueueItemList, type QueueItemObjectSummary, type QueueItemStats, type QueueItemStatus, QueueItemsResource, type QueueStats, QueuesResource, type RecordMeasureValueInput, type RequestOptions, type RunActionInput, type RunActionOptions, type RunActionResult, RunsResource, type SaveUploadedTextInput, type Scorecard, type ScorecardMeasure, type ScorecardMeasureStatus, type ScorecardMeasureValue, type ScorecardObjective, type ScorecardSummary, ScorecardsResource, type SseEvent, SsoAuthResource, type SsoProviderSummary, type SsoProvidersResponse, type StartRunInput, type StartRunInputDto, type StartRunOptions, type StartRunStep, type StopStreamOptions, type StreamMessageOptions, type Table, TablesResource, type Task, type TaskListItem, TasksResource, type TokenStore, type TriggerDefinition, type TriggerInputFieldDefinition, type UpdateEntityInput, type UpdateKnowledgeInput, type UpdateQueueInput, type UpdateQueueItemInput, type UpdateTaskInput, type UpdateVariableInput, type UpsertAgentBySlugInput, type UpsertAgentBySlugInputDto, type UpsertAgentToolInput, type UpsertEntityTypeBySlugInput, type UpsertTableBySlugInput, type UpsertWorkflowBySlugInput, type UpsertWorkflowBySlugInputDto, type UpsertWorkflowPathInput, type UpsertWorkflowStepInput, type UpsertWorkflowTriggerInput, type Variable, VariablesResource, type WaitUntilFinishedOptions, type WatchProgressOptions, type Workflow, type WorkflowApp, WorkflowAppsResource, type WorkflowDefinition, type WorkflowPathDefinition, type WorkflowStepDefinition, WorkflowsResource, assertApiKeyAllowedInEnvironment, type components, createBrowserClient, createLocalStorageTokenStore, createMemoryTokenStore, createServerClient, defineAction, defineAgent, defineAiConnection, defineConnection, defineEntityType, defineTrigger, defineWorkflow, entityTypeDefinitionToUpsert, isBrowserEnvironment, isLoginRequires2FA, iterateOffset, iteratePages, type operations, parseSseEvents, parseSseStream, type paths, ref, resolveActionAppId, resolveActionId, resolveTriggerAppId, resolveTriggerId };
8894
+ export { API_KEY_PREFIX, type ActionDefinition, ActionsResource, type AddQueueItemErrorInput, type Agent, AgentChatClient, AgentChatStream, type AgentDefinition, type AgentFileDefinition, type AgentFileInput, type AgentFileSettings, type AgentFileTool, type AgentSlugOrId, type AgentToolDefinition, type AgentUpsertOptions, AgentsResource, type AiConnection, type AiConnectionDefinition, type AiConnectionModel, AiConnectionsResource, type ApprovalInboxItem, ApprovalsResource, AuthResource, type AuthTokens, type BulkCreateQueueItemsInput, type BulkCreateQueueItemsResult, type ChangeEntityStateInput, type ChangeEntityStateResult, type ChatMode, type CodeDefinitionResponse, type CodeSource, type CodeSyncContext, CodeSyncResource, type CodeSyncStatus, type Connection, type ConnectionDefinition, ConnectionsResource, type CreateBrowserClientOptions, type CreateEntityInput, type CreateKnowledgeInput, type CreateQueueInput, type CreateQueueItemInput, type CreateServerClientOptions, type CreateTaskInput, type CreateVariableInput, type CurrentUser, DEFINE_KINDS, type DefineKind, type DeletedTask, DiscoveryResource, type EligibleApprover, type EnabledFeatures, EntitiesResource, type Entity, type EntityStateHistoryEntry, type EntityStateTransitions, type EntityType, type EntityTypeDefinition, type EntityTypeReadOptions, EntityTypesResource, type ExecuteWorkflowResult, type Execution, type ExecutionPathStep, type ExecutionProgress, type ExecutionProgressPayload, type ExecutionProgressStep, ExecutionProgressStream, type ExecutionStatus, type ExecutionStreamEvent, type ExecutionStreamEventType, ExecutionTimeoutError, ExecutionsResource, type ExportEntitiesInput, type FetchLike, HttpClient, type ImportEntitiesInput, type ImportEntitiesResult, type ImportTemplate, type Knowledge, type KnowledgeDocument, type KnowledgeDocumentGroup, KnowledgeResource, type ListEntitiesOptions, type ListQueryOptions, type ListQueueItemsByObjectOptions, type ListQueueItemsOptions, type LocalStorageTokenStoreOptions, type LoginRequires2FA, type LoginResult, type LoginSuccess, LunnoaApiError, LunnoaClient, type LunnoaClientOptions, type MessageTaskInput, type OffsetPagination, PATH_CONDITIONS, type PagePagination, type PaginatedEntities, type PathCondition, type PathConditionType, type PendingInput, type PendingInputField, type QueryValue, type Queue, type QueueAllowedObjectType, type QueueItem, type QueueItemCreated, type QueueItemErrorEntry, type QueueItemFull, type QueueItemList, type QueueItemObjectSummary, type QueueItemStats, type QueueItemStatus, QueueItemsResource, type QueueStats, QueuesResource, type RecordMeasureValueInput, type RequestOptions, type RunActionInput, type RunActionOptions, type RunActionResult, RunsResource, type SaveUploadedTextInput, type Scorecard, type ScorecardMeasure, type ScorecardMeasureStatus, type ScorecardMeasureValue, type ScorecardObjective, type ScorecardSummary, ScorecardsResource, type SseEvent, SsoAuthResource, type SsoProviderSummary, type SsoProvidersResponse, type StartRunInput, type StartRunInputDto, type StartRunOptions, type StartRunStep, type StopStreamOptions, type StreamMessageOptions, type Table, TablesResource, type Task, type TaskListItem, TasksResource, type TokenStore, type TriggerDefinition, type TriggerInputFieldDefinition, type UpdateEntityInput, type UpdateKnowledgeInput, type UpdateQueueInput, type UpdateQueueItemInput, type UpdateTaskInput, type UpdateVariableInput, type UpsertAgentBySlugInput, type UpsertAgentBySlugInputDto, type UpsertAgentToolInput, type UpsertEntityTypeBySlugInput, type UpsertTableBySlugInput, type UpsertWorkflowBySlugInput, type UpsertWorkflowBySlugInputDto, type UpsertWorkflowGraphInput, type UpsertWorkflowPathInput, type UpsertWorkflowStepInput, type UpsertWorkflowTriggerInput, type Variable, VariablesResource, type WaitUntilFinishedOptions, type WatchProgressOptions, type Workflow, type WorkflowApp, WorkflowAppsResource, type WorkflowDefinition, type WorkflowFileDefinition, type WorkflowGraphFileDefinition, type WorkflowPathDefinition, type WorkflowStepDefinition, type WorkflowStepFile, type WorkflowStepsFileDefinition, type WorkflowTriggerFile, type WorkflowUpsertOptions, WorkflowsResource, assertApiKeyAllowedInEnvironment, type components, createBrowserClient, createLocalStorageTokenStore, createMemoryTokenStore, createServerClient, defineAction, defineAgent, defineAiConnection, defineConnection, defineEntityType, defineTrigger, defineWorkflow, entityTypeDefinitionToUpsert, isAgentFileShape, isBrowserEnvironment, isLoginRequires2FA, iterateOffset, iteratePages, type operations, parseSseEvents, parseSseStream, type paths, ref, resolveActionAppId, resolveActionId, resolveTriggerAppId, resolveTriggerId };