@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/react.d.ts CHANGED
@@ -206,6 +206,32 @@ declare class AgentChatClient {
206
206
 
207
207
  interface components {
208
208
  schemas: {
209
+ PublicAiModelResponseDto: {
210
+ /** @description Catalogue model id passed to agent deploy as `model`. Example: `deepseek-ai/DeepSeek-V4-Pro`. */
211
+ id: string;
212
+ /** @description Display name. */
213
+ name: string;
214
+ /** @description True when this is the model used if an agent deploy omits `model` on this connection. */
215
+ isDefault: boolean;
216
+ /** @description Whether the model can call tools. */
217
+ supportsTools: boolean;
218
+ /** @description Whether the model accepts image input. */
219
+ supportsVision: boolean;
220
+ /** @description Whether the model exposes a reasoning mode. */
221
+ supportsReasoning: boolean;
222
+ };
223
+ PublicAiConnectionResponseDto: {
224
+ /** @description AiProviderConnection UUID. Pass as `aiConnectionId` / `defineAiConnection({ id })` when this connection is not the default. */
225
+ id: string;
226
+ /** @description Connection display name. Example: `Lunnoa LLMs`. */
227
+ name: string;
228
+ /** @description Provider slug. Example: `featherless` or `openai`. */
229
+ provider: string;
230
+ /** @description True for the connection used when an agent deploy omits `aiConnectionId`. */
231
+ isDefault: boolean;
232
+ /** @description Models this connection accepts. Inactive models are omitted. */
233
+ models: components["schemas"]["PublicAiModelResponseDto"][];
234
+ };
209
235
  AuthMethodFlagsDto: {
210
236
  /** @description True when password-based login is disabled for this deployment (via AUTH_DISABLED_METHODS). */
211
237
  passwordDisabled: boolean;
@@ -809,29 +835,6 @@ interface components {
809
835
  /** @description Number of item IDs submitted for deletion. */
810
836
  requestedCount: number;
811
837
  };
812
- UpsertWorkflowStepDto: {
813
- /**
814
- * @description Name later steps use in ={{step:<key>,path}}. Keyed steps keep their node id across deploys. "trigger" is reserved.
815
- * @example loadCase
816
- */
817
- key?: string;
818
- /** @description Workflow app id (catalogue slug). */
819
- appId: string;
820
- /** @description Catalogue action id. */
821
- actionId: string;
822
- /** @description Connection instance UUID for this step. */
823
- connectionId?: string;
824
- /** @description Action input / config fields. String values may use ={{step:trigger,field}} or ={{step:<key>,path,to,value}}. */
825
- input?: {
826
- [key: string]: unknown;
827
- };
828
- /** @description Display name for the step node. */
829
- name?: string;
830
- /** @description Step description. */
831
- description?: string;
832
- /** @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. */
833
- paths?: components["schemas"]["UpsertWorkflowPathDto"][];
834
- };
835
838
  UpsertWorkflowPathConditionDto: {
836
839
  /** @description One step reference, e.g. ={{step:load,amount}}. */
837
840
  field: string;
@@ -840,14 +843,6 @@ interface components {
840
843
  /** @description Value to compare with. */
841
844
  value?: string;
842
845
  };
843
- UpsertWorkflowPathDto: {
844
- /** @description Path label, unique on its step. */
845
- label: string;
846
- /** @description Conditional Paths only. Groups are OR-ed, conditions inside a group AND-ed. Omit to always take this path. */
847
- when?: components["schemas"]["UpsertWorkflowPathConditionDto"][][];
848
- /** @description Steps on this path. */
849
- steps: components["schemas"]["UpsertWorkflowStepDto"][];
850
- };
851
846
  UpsertWorkflowTriggerInputFieldDto: {
852
847
  /** @description Field id. Callers pass this key to workflows.execute. */
853
848
  id: string;
@@ -857,14 +852,10 @@ interface components {
857
852
  /** @description text, number, date, or select. Defaults to text. */
858
853
  inputType?: string;
859
854
  /** @description true, or { missingMessage, missingStatus }. */
860
- required?: boolean | {
861
- [key: string]: unknown;
862
- };
855
+ required?: Record<string, never>;
863
856
  /** @description Used when the caller omits the field. */
864
- defaultValue?: unknown;
865
- selectOptions?: {
866
- [key: string]: unknown;
867
- }[];
857
+ defaultValue?: Record<string, never>;
858
+ selectOptions?: Record<string, never>[];
868
859
  };
869
860
  UpsertWorkflowTriggerDto: {
870
861
  /** @description Catalogue trigger id, for example flow-control_trigger_manual. */
@@ -883,6 +874,59 @@ interface components {
883
874
  name?: string;
884
875
  description?: string;
885
876
  };
877
+ UpsertWorkflowRetrySettingsDto: {
878
+ enabled: boolean;
879
+ /** @description How many times to attempt the step. */
880
+ maxAttempts: number;
881
+ /** @description Delay between attempts, in seconds. */
882
+ delaySeconds: number;
883
+ };
884
+ UpsertWorkflowContinueOnFailureDto: {
885
+ enabled: boolean;
886
+ };
887
+ UpsertWorkflowPathDto: {
888
+ /** @description Path label, unique on its step. */
889
+ label: string;
890
+ /** @description Conditional Paths only. Groups are OR-ed, conditions inside a group AND-ed. Omit to always take this path. */
891
+ when?: components["schemas"]["UpsertWorkflowPathConditionDto"][][];
892
+ /** @description Steps on this path. */
893
+ steps: components["schemas"]["UpsertWorkflowStepDto"][];
894
+ };
895
+ UpsertWorkflowStepDto: {
896
+ /**
897
+ * @description Name later steps use in ={{step:<key>,path}}. Keyed steps keep their node id across deploys. "trigger" is reserved.
898
+ * @example loadCase
899
+ */
900
+ key?: string;
901
+ /** @description Workflow app id (catalogue slug). */
902
+ appId: string;
903
+ /** @description Catalogue action id. */
904
+ actionId: string;
905
+ /** @description Connection instance UUID for this step. */
906
+ connectionId?: string;
907
+ /** @description Action input / config fields. String values may use ={{step:trigger,field}} or ={{step:<key>,path,to,value}}. */
908
+ input?: {
909
+ [key: string]: unknown;
910
+ };
911
+ /** @description Display name for the step node. */
912
+ name?: string;
913
+ /** @description Step description. */
914
+ description?: string;
915
+ retrySettings?: components["schemas"]["UpsertWorkflowRetrySettingsDto"];
916
+ continueOnFailure?: components["schemas"]["UpsertWorkflowContinueOnFailureDto"];
917
+ /** @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. */
918
+ paths?: components["schemas"]["UpsertWorkflowPathDto"][];
919
+ };
920
+ UpsertWorkflowGraphDto: {
921
+ /** @description Graph-file nodes. Each node has key, nodeType, appId, name, and value. The trigger key is "trigger". */
922
+ nodes: {
923
+ [key: string]: unknown;
924
+ }[];
925
+ /** @description Edges. source and target are node keys. */
926
+ edges: {
927
+ [key: string]: unknown;
928
+ }[];
929
+ };
886
930
  UpsertWorkflowBySlugDto: {
887
931
  /**
888
932
  * @description Stable workspace-scoped slug (lowercase, digits, hyphens). Used as the upsert key.
@@ -894,12 +938,107 @@ interface components {
894
938
  description?: string;
895
939
  /** @description Whether the workflow is active. */
896
940
  isActive?: boolean;
897
- /** @description Catalogue trigger. Omit for a Manually Run trigger with no input fields. */
941
+ /** @description Catalogue trigger for a steps body. Omit for a Manually Run trigger with no input fields. Not valid with `graph`. */
898
942
  trigger?: components["schemas"]["UpsertWorkflowTriggerDto"];
899
- /** @description Catalogue-action steps in order. The last step may branch with `paths`. */
900
- steps: components["schemas"]["UpsertWorkflowStepDto"][];
901
- /** @description Marks the row as managed by code (CLI / SDK). Defaults to true on this endpoint. */
902
- managedByCode?: boolean;
943
+ /** @description Catalogue-action steps in order. The last step may branch with `paths`. Send this or `graph`, not both. */
944
+ steps?: components["schemas"]["UpsertWorkflowStepDto"][];
945
+ /** @description Full graph in the graph-file shape. Send this or `steps`, not both. `trigger` is not valid with a graph. */
946
+ graph?: components["schemas"]["UpsertWorkflowGraphDto"];
947
+ /** @description Revision from the last pull. Required when updating a workflow that the UI can edit, unless `force` is true. */
948
+ baseRevision?: string;
949
+ /** @description Overwrite an existing workflow even when `baseRevision` is missing or stale. */
950
+ force?: boolean;
951
+ /**
952
+ * @description How code owns this workflow. Defaults to generated on this endpoint.
953
+ * @enum {string}
954
+ */
955
+ codeSource?: "synced" | "generated";
956
+ };
957
+ UpsertWorkflowResponseDto: {
958
+ /** @description Workflow ID */
959
+ id: string;
960
+ /** @description Workflow name */
961
+ name: string;
962
+ /** @description Stable workspace-scoped slug for CLI / code deploy upserts. Included when `expansion=slug` is requested. */
963
+ slug?: string | null;
964
+ /**
965
+ * @description Code source stored by this push. `generated` when the request omits it.
966
+ * @enum {string}
967
+ */
968
+ codeSource?: "none" | "synced" | "generated";
969
+ /**
970
+ * @description Sync state against the definitions folder. Included when `expansion=codeSyncStatus` is requested.
971
+ * @enum {string}
972
+ */
973
+ codeSyncStatus?: "none" | "in_sync" | "changed_in_ui" | "locked";
974
+ /** @description Workflow description. Included when `expansion=description` is requested. */
975
+ description?: string | null;
976
+ /** @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. */
977
+ output?: {
978
+ [key: string]: unknown;
979
+ } | null;
980
+ /**
981
+ * Format: date-time
982
+ * @description Creation timestamp. Included when `expansion=createdAt` is requested.
983
+ */
984
+ createdAt?: string;
985
+ /**
986
+ * Format: date-time
987
+ * @description Last update timestamp. Included when `expansion=updatedAt` is requested.
988
+ */
989
+ updatedAt?: string;
990
+ /** @description Whether the workflow is active and can be triggered. Included when `expansion=isActive` is requested. */
991
+ isActive?: boolean;
992
+ /** @description Whether the workflow is internal (hidden from default listings). Included when `expansion=isInternal` is requested. */
993
+ isInternal?: boolean;
994
+ /** @description Object type whose records list this workflow's runs. Included when `expansion=objectLink` is requested. */
995
+ objectTypeId?: string | null;
996
+ /** @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. */
997
+ objectIdPath?: string | null;
998
+ /** @description Create a record when the unique key value is not found, then file the run on it. Included when `expansion=objectLink` is requested. */
999
+ createObjectIfMissing?: boolean;
1000
+ /** @description Unique key on the linked object type (`name` or `attribute:<field>`). Included when `expansion=objectLink` is requested. */
1001
+ uniqueKeyField?: string | null;
1002
+ /** @description Workflow node definitions (JSON). Included when `expansion=nodes` is requested. */
1003
+ nodes?: {
1004
+ [key: string]: unknown;
1005
+ }[];
1006
+ /** @description Workflow edge definitions connecting nodes (JSON). Included when `expansion=edges` is requested. */
1007
+ edges?: {
1008
+ [key: string]: unknown;
1009
+ }[];
1010
+ /** @description The workflow trigger node definition (JSON). Included when `expansion=triggerNode` is requested. */
1011
+ triggerNode?: {
1012
+ [key: string]: unknown;
1013
+ } | null;
1014
+ /** @description IDs of the triggers and actions used by the workflow. Included when `expansion=triggerAndActionIds` is requested. */
1015
+ triggerAndActionIds?: string[];
1016
+ /** @description IDs of sub-workflows referenced by the workflow. Included when `expansion=subWorkflowIds` is requested. Only returned by GET /workflows/{workflowId}. */
1017
+ subWorkflowIds?: string[];
1018
+ /** @description IDs of agents referenced by the workflow. Included when `expansion=agentIds` is requested. Only returned by GET /workflows/{workflowId}. */
1019
+ agentIds?: string[];
1020
+ /** @description Internal polling trigger storage value. Included when `expansion=pollStorage` is requested. */
1021
+ pollStorage?: string | null;
1022
+ /**
1023
+ * Format: date-time
1024
+ * @description Timestamp of the next scheduled execution, if the workflow runs on a schedule. Included when `expansion=nextScheduledExecution` is requested.
1025
+ */
1026
+ nextScheduledExecution?: string | null;
1027
+ /**
1028
+ * @description Editor orientation of the workflow canvas. Included when `expansion=orientation` is requested.
1029
+ * @enum {string}
1030
+ */
1031
+ workflowOrientation?: "HORIZONTAL" | "VERTICAL";
1032
+ /** @description AI provider connection used by the workflow builder chat. Always returned on GET /workflows/{workflowId}. */
1033
+ aiConnectionId?: string | null;
1034
+ /** @description Selected model ID within the AI provider connection for workflow builder chat. Always returned on GET /workflows/{workflowId}. */
1035
+ selectedModelId?: string | null;
1036
+ /** @description sha256 hex of the canonical definition that was stored. */
1037
+ revision: string;
1038
+ /** @description Definition that was stored. Steps format when it round-trips, otherwise graph format. */
1039
+ definition: {
1040
+ [key: string]: unknown;
1041
+ };
903
1042
  };
904
1043
  WorkflowResponseDto: {
905
1044
  /** @description Workflow ID */
@@ -908,8 +1047,16 @@ interface components {
908
1047
  name: string;
909
1048
  /** @description Stable workspace-scoped slug for CLI / code deploy upserts. Included when `expansion=slug` is requested. */
910
1049
  slug?: string | null;
911
- /** @description True when last written by code (CLI / SDK). Included when `expansion=managedByCode` is requested. */
912
- managedByCode?: boolean;
1050
+ /**
1051
+ * @description Where this workflow is defined. Included when `expansion=codeSource` is requested.
1052
+ * @enum {string}
1053
+ */
1054
+ codeSource?: "none" | "synced" | "generated";
1055
+ /**
1056
+ * @description Sync state against the definitions folder. Included when `expansion=codeSyncStatus` is requested.
1057
+ * @enum {string}
1058
+ */
1059
+ codeSyncStatus?: "none" | "in_sync" | "changed_in_ui" | "locked";
913
1060
  /** @description Workflow description. Included when `expansion=description` is requested. */
914
1061
  description?: string | null;
915
1062
  /** @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. */
@@ -942,77 +1089,505 @@ interface components {
942
1089
  nodes?: {
943
1090
  [key: string]: unknown;
944
1091
  }[];
945
- /** @description Workflow edge definitions connecting nodes (JSON). Included when `expansion=edges` is requested. */
946
- edges?: {
947
- [key: string]: unknown;
1092
+ /** @description Workflow edge definitions connecting nodes (JSON). Included when `expansion=edges` is requested. */
1093
+ edges?: {
1094
+ [key: string]: unknown;
1095
+ }[];
1096
+ /** @description The workflow trigger node definition (JSON). Included when `expansion=triggerNode` is requested. */
1097
+ triggerNode?: {
1098
+ [key: string]: unknown;
1099
+ } | null;
1100
+ /** @description IDs of the triggers and actions used by the workflow. Included when `expansion=triggerAndActionIds` is requested. */
1101
+ triggerAndActionIds?: string[];
1102
+ /** @description IDs of sub-workflows referenced by the workflow. Included when `expansion=subWorkflowIds` is requested. Only returned by GET /workflows/{workflowId}. */
1103
+ subWorkflowIds?: string[];
1104
+ /** @description IDs of agents referenced by the workflow. Included when `expansion=agentIds` is requested. Only returned by GET /workflows/{workflowId}. */
1105
+ agentIds?: string[];
1106
+ /** @description Internal polling trigger storage value. Included when `expansion=pollStorage` is requested. */
1107
+ pollStorage?: string | null;
1108
+ /**
1109
+ * Format: date-time
1110
+ * @description Timestamp of the next scheduled execution, if the workflow runs on a schedule. Included when `expansion=nextScheduledExecution` is requested.
1111
+ */
1112
+ nextScheduledExecution?: string | null;
1113
+ /**
1114
+ * @description Editor orientation of the workflow canvas. Included when `expansion=orientation` is requested.
1115
+ * @enum {string}
1116
+ */
1117
+ workflowOrientation?: "HORIZONTAL" | "VERTICAL";
1118
+ /** @description AI provider connection used by the workflow builder chat. Always returned on GET /workflows/{workflowId}. */
1119
+ aiConnectionId?: string | null;
1120
+ /** @description Selected model ID within the AI provider connection for workflow builder chat. Always returned on GET /workflows/{workflowId}. */
1121
+ selectedModelId?: string | null;
1122
+ };
1123
+ WorkflowDefinitionResponseDto: {
1124
+ /** @description Workflow ID. */
1125
+ id: string;
1126
+ /** @description Workspace-scoped slug. */
1127
+ slug: string;
1128
+ /** @description Workspace that owns the workflow. */
1129
+ workspaceId: string;
1130
+ /**
1131
+ * @description Where this workflow is defined.
1132
+ * @enum {string}
1133
+ */
1134
+ codeSource: "none" | "synced" | "generated";
1135
+ /** @description sha256 hex of the canonical workflow definition. */
1136
+ revision: string;
1137
+ /** @description Steps format when the graph round-trips through it, otherwise the graph format. */
1138
+ definition: {
1139
+ [key: string]: unknown;
1140
+ };
1141
+ };
1142
+ CodeSyncContextResponseDto: {
1143
+ /** @description Active workspace id. */
1144
+ workspaceId: string;
1145
+ /** @description When true, synced agents and workflows can only be changed by a code push. */
1146
+ lockCodeSyncedResources: boolean;
1147
+ };
1148
+ AgentSlugOrIdDto: {
1149
+ /**
1150
+ * @description Workspace slug. Send exactly one of slug or id.
1151
+ * @example support-triage
1152
+ */
1153
+ slug?: string;
1154
+ /**
1155
+ * Format: uuid
1156
+ * @description Resource UUID. Send exactly one of slug or id.
1157
+ */
1158
+ id?: string;
1159
+ };
1160
+ UpsertAgentMcpServerDto: {
1161
+ /**
1162
+ * Format: uuid
1163
+ * @description MCP server UUID.
1164
+ */
1165
+ id: string;
1166
+ /**
1167
+ * Format: uuid
1168
+ * @description User connection UUID for this server. Null clears a pinned connection.
1169
+ */
1170
+ connectionId?: string | null;
1171
+ };
1172
+ UpsertAgentToolDto: {
1173
+ /** @description Stable tool key. Omitted keys are assigned from the tool name. Pattern: ^[A-Za-z][A-Za-z0-9_-]*$. */
1174
+ key?: string;
1175
+ /** @description Workflow app id (catalogue slug). */
1176
+ appId: string;
1177
+ /** @description Catalogue action id. */
1178
+ actionId: string;
1179
+ /** @description Connection instance UUID pre-bound on the tool. */
1180
+ connectionId?: string;
1181
+ /** @description Tool display name for the model. */
1182
+ name?: string;
1183
+ /** @description Tool description shown to the model. */
1184
+ description?: string;
1185
+ /** @description Pre-filled tool config (fields left empty are filled by the model). */
1186
+ input?: {
1187
+ [key: string]: unknown;
1188
+ };
1189
+ };
1190
+ UpsertAgentSettingsDto: {
1191
+ /** @description Model temperature. */
1192
+ temperature?: number;
1193
+ /** @description Top-p sampling. */
1194
+ topP?: number;
1195
+ /** @description Maximum output tokens per turn. Null clears the cap. */
1196
+ maxOutputTokens?: number | null;
1197
+ /** @description Frequency penalty. */
1198
+ frequencyPenalty?: number;
1199
+ /** @description Presence penalty. */
1200
+ presencePenalty?: number;
1201
+ /** @description Fixed sampling seed. Null clears it. */
1202
+ seed?: number | null;
1203
+ /** @description Maximum retries for a failed model call. */
1204
+ maxRetries?: number;
1205
+ /** @description Maximum tool roundtrips per turn. */
1206
+ maxToolRoundtrips?: number;
1207
+ /** @description How many previous messages are sent to the model. */
1208
+ messageLookbackLimit?: number;
1209
+ /** @description Instructions used when auto-naming new tasks. Null clears them. */
1210
+ taskNamingInstructions?: string | null;
1211
+ /** @description IDs of enabled provider built-in tools. */
1212
+ enabledBuiltInTools?: string[];
1213
+ /** @description IDs of enabled platform tools. */
1214
+ enabledPlatformTools?: string[];
1215
+ /** @description Enabled tool-policy ids. */
1216
+ enabledToolPolicies?: string[];
1217
+ /** @description Per-tool force overrides, stored as JSON. */
1218
+ forcedTools?: {
1219
+ [key: string]: unknown;
1220
+ }[];
1221
+ /** @description Suggested prompts, in stored order. */
1222
+ suggestedPrompts?: string[];
1223
+ /** @description Index the workflow-app catalogue for discovery. */
1224
+ dynamicActionDiscoveryEnabled?: boolean;
1225
+ /** @description Index MCP servers visible to the user for discovery. */
1226
+ dynamicMcpDiscoveryEnabled?: boolean;
1227
+ /** @description Let the agent propose updates to its own instructions. */
1228
+ dynamicSelfInstructionsEnabled?: boolean;
1229
+ /** @description Whether agent memory is enabled. */
1230
+ memoryEnabled?: boolean;
1231
+ /**
1232
+ * @description Whose memories this agent reads and writes.
1233
+ * @enum {string}
1234
+ */
1235
+ memoryScope?: "PER_USER" | "PER_AGENT" | "PER_USER_PER_AGENT";
1236
+ /** @description How many days memories are kept. */
1237
+ memoryRetentionDays?: number;
1238
+ /** @description Opt in to runtime planning tools. */
1239
+ enablePlanning?: boolean;
1240
+ /** @description Gate heavy tools until the user approves a runtime plan. */
1241
+ requirePlanApproval?: boolean;
1242
+ /** @description Offload oversized tool results. */
1243
+ enableToolResultOffload?: boolean;
1244
+ /** @description Byte threshold for tool-result offload. */
1245
+ toolResultOffloadThresholdBytes?: number;
1246
+ /** @description Elevated step budget for long-running work. */
1247
+ longHorizonMode?: boolean;
1248
+ /** @description Step budget when long-horizon mode is on. Null clears it. */
1249
+ longHorizonMaxSteps?: number | null;
1250
+ /** @description Soft token budget for a long-horizon run. Null clears it. */
1251
+ longHorizonMaxTokensPerRun?: number | null;
1252
+ /**
1253
+ * @description How this agent routes prompts that contain PII.
1254
+ * @enum {string}
1255
+ */
1256
+ piiRoutingMode?: "INHERIT" | "AUTO_FALLBACK" | "ASK" | "BLOCK" | "ANONYMIZE";
1257
+ /**
1258
+ * Format: uuid
1259
+ * @description AI connection used when PII routing falls back. Null clears it.
1260
+ */
1261
+ piiFallbackConnectionId?: string | null;
1262
+ /** @description Model used when PII routing falls back. Null clears it. */
1263
+ piiFallbackModelId?: string | null;
1264
+ /** @description Web search access. Null removes the web-access row. */
1265
+ webAccess?: boolean | null;
1266
+ /** @description Outbound phone access. Null removes the phone-access row. */
1267
+ phoneAccess?: boolean | null;
1268
+ };
1269
+ UpsertAgentBySlugDto: {
1270
+ /**
1271
+ * @description Stable workspace-scoped slug (lowercase, digits, hyphens). Used as the upsert key.
1272
+ * @example support-triage
1273
+ */
1274
+ slug: string;
1275
+ /** @description Display name. Defaults to the slug when omitted on create. */
1276
+ name?: string;
1277
+ /** @description Agent description. Null clears it. */
1278
+ description?: string | null;
1279
+ /** @description System instructions / prompt for the agent. */
1280
+ instructions: string;
1281
+ /** @description Catalogue model id enabled on the AI connection. Omit or null when the definition has no model. Example: `deepseek-ai/DeepSeek-V4-Pro`. */
1282
+ model?: string | null;
1283
+ /**
1284
+ * Format: uuid
1285
+ * @description AiProviderConnection UUID. When omitted on create, platform AI defaults apply. Null clears it.
1286
+ */
1287
+ aiConnectionId?: string | null;
1288
+ /** @description App Connection UUIDs the agent may use for tools. */
1289
+ connectionIds?: string[];
1290
+ /** @description Workflow UUIDs the agent may run (AgentWorkflow links). */
1291
+ workflowIds?: string[];
1292
+ /** @description Workflows the agent may run, each by slug or id. Combined with workflowIds when both are sent. */
1293
+ workflows?: components["schemas"]["AgentSlugOrIdDto"][];
1294
+ /** @description Sub-agents, each by slug or id. */
1295
+ agents?: components["schemas"]["AgentSlugOrIdDto"][];
1296
+ /** @description Knowledge item UUIDs attached to the agent. */
1297
+ knowledgeIds?: string[];
1298
+ /** @description Variable UUIDs attached to the agent. */
1299
+ variableIds?: string[];
1300
+ /** @description Object UUIDs attached to the agent. */
1301
+ objectIds?: string[];
1302
+ /** @description Object type UUIDs attached to the agent. */
1303
+ objectTypeIds?: string[];
1304
+ /** @description A2A agent UUIDs attached to the agent. */
1305
+ a2aAgentIds?: string[];
1306
+ /** @description MCP servers pinned on the agent. */
1307
+ mcpServers?: components["schemas"]["UpsertAgentMcpServerDto"][];
1308
+ /** @description Catalogue action tools. A tool key is kept across pushes. */
1309
+ tools?: components["schemas"]["UpsertAgentToolDto"][];
1310
+ /** @description Agent settings. Omitted keys are left unchanged on update. */
1311
+ settings?: components["schemas"]["UpsertAgentSettingsDto"];
1312
+ /**
1313
+ * @description How code owns this agent. Defaults to generated on this endpoint.
1314
+ * @enum {string}
1315
+ */
1316
+ codeSource?: "synced" | "generated";
1317
+ /** @description Revision from the last pull. Required when updating an agent that is not a generated redeploy, unless force is set. */
1318
+ baseRevision?: string;
1319
+ /** @description Overwrite even when baseRevision is missing or stale. */
1320
+ force?: boolean;
1321
+ };
1322
+ AgentUpsertResponseDto: {
1323
+ /**
1324
+ * @description Agent ID (UUID)
1325
+ * @example 4f7c9d2e-8a1b-4c3d-9e5f-6a7b8c9d0e1f
1326
+ */
1327
+ id: string;
1328
+ /**
1329
+ * @description Agent name
1330
+ * @example Invoice Triage Agent
1331
+ */
1332
+ name: string;
1333
+ /** @description Stable workspace-scoped slug for CLI / code deploy upserts. Included when `expansion=slug` is requested. */
1334
+ slug?: string | null;
1335
+ /**
1336
+ * @description Where this agent is defined. Taken from the request, or generated when omitted.
1337
+ * @enum {string}
1338
+ */
1339
+ codeSource?: "none" | "synced" | "generated";
1340
+ /**
1341
+ * @description Sync state against the definitions folder. Included when `expansion=codeSyncStatus` is requested.
1342
+ * @enum {string}
1343
+ */
1344
+ codeSyncStatus?: "none" | "in_sync" | "changed_in_ui" | "locked";
1345
+ /** @description ID of the AI provider connection assigned to the agent. Always included. Null when the agent falls back to the workspace default connection. */
1346
+ FK_aiConnectionId: string | null;
1347
+ /** @description Agent description. Included when `expansion=description` is requested. */
1348
+ description?: string | null;
1349
+ /** @description Public URL of the agent profile image. Included when `expansion=profileImageUrl` is requested. */
1350
+ profileImageUrl?: string | null;
1351
+ /**
1352
+ * Format: date-time
1353
+ * @description Creation timestamp. Included when `expansion=createdAt` is requested.
1354
+ */
1355
+ createdAt?: string;
1356
+ /**
1357
+ * Format: date-time
1358
+ * @description Last update timestamp. Included when `expansion=updatedAt` is requested.
1359
+ */
1360
+ updatedAt?: string;
1361
+ /** @description System instructions authored for the agent. Included when `expansion=instructions` is requested. */
1362
+ instructions?: string | null;
1363
+ /**
1364
+ * @description Model temperature. Included when `expansion=temperature` is requested.
1365
+ * @example 1
1366
+ */
1367
+ temperature?: number;
1368
+ /** @description Maximum output tokens per turn. Included when `expansion=maxOutputTokens` is requested. */
1369
+ maxOutputTokens?: number | null;
1370
+ /**
1371
+ * @description Top-p sampling. Included when `expansion=topP` is requested.
1372
+ * @example 1
1373
+ */
1374
+ topP?: number;
1375
+ /**
1376
+ * @description Frequency penalty. Included when `expansion=frequencyPenalty` is requested.
1377
+ * @example 0
1378
+ */
1379
+ frequencyPenalty?: number;
1380
+ /**
1381
+ * @description Presence penalty. Included when `expansion=presencePenalty` is requested.
1382
+ * @example 0
1383
+ */
1384
+ presencePenalty?: number;
1385
+ /**
1386
+ * @description Maximum retries for a failed model call. Included when `expansion=maxRetries` is requested.
1387
+ * @example 0
1388
+ */
1389
+ maxRetries?: number;
1390
+ /** @description Fixed sampling seed. Included when `expansion=seed` is requested. */
1391
+ seed?: number | null;
1392
+ /**
1393
+ * @description Maximum tool roundtrips per turn. Included when `expansion=maxToolRoundtrips` is requested.
1394
+ * @example 5
1395
+ */
1396
+ maxToolRoundtrips?: number;
1397
+ /**
1398
+ * @description How many previous messages are sent to the model. Included when `expansion=messageLookbackLimit` is requested.
1399
+ * @example 40
1400
+ */
1401
+ messageLookbackLimit?: number;
1402
+ /** @description Configured tool nodes (app actions) for the agent. Included when `expansion=tools` is requested. */
1403
+ tools?: {
1404
+ [key: string]: unknown;
1405
+ }[] | null;
1406
+ /** @description Action IDs of the configured tools. Included when `expansion=toolIds` is requested. */
1407
+ toolIds?: string[];
1408
+ /** @description Instructions used when auto-naming new tasks. Included when `expansion=taskNamingInstructions` is requested. */
1409
+ taskNamingInstructions?: string | null;
1410
+ /** @description IDs of enabled provider built-in tools. Included when `expansion=enabledBuiltInTools` is requested. */
1411
+ enabledBuiltInTools?: string[];
1412
+ /** @description IDs of enabled platform tools. Included when `expansion=enabledPlatformTools` is requested. */
1413
+ enabledPlatformTools?: string[];
1414
+ /** @description Whether dynamic workflow-app action discovery is enabled. Included when `expansion=dynamicActionDiscoveryEnabled` is requested. */
1415
+ dynamicActionDiscoveryEnabled?: boolean;
1416
+ /** @description Whether dynamic MCP server discovery is enabled. Included when `expansion=dynamicMcpDiscoveryEnabled` is requested. */
1417
+ dynamicMcpDiscoveryEnabled?: boolean;
1418
+ /** @description Whether the agent maintains its own instructions. Included when `expansion=dynamicSelfInstructionsEnabled` is requested. */
1419
+ dynamicSelfInstructionsEnabled?: boolean;
1420
+ /** @description Whether long-term memory is enabled. Included when `expansion=memoryEnabled` is requested. */
1421
+ memoryEnabled?: boolean;
1422
+ /** @description Whether runtime planning tools are enabled. Included when `expansion=enablePlanning` is requested. */
1423
+ enablePlanning?: boolean;
1424
+ /** @description Whether oversized tool-result offload is enabled. Included when `expansion=enableToolResultOffload` is requested. */
1425
+ enableToolResultOffload?: boolean;
1426
+ /** @description Byte threshold for tool-result offload. Included when `expansion=toolResultOffloadThresholdBytes` is requested. */
1427
+ toolResultOffloadThresholdBytes?: number;
1428
+ /** @description Whether long-horizon mode is enabled. Included when `expansion=longHorizonMode` is requested. */
1429
+ longHorizonMode?: boolean;
1430
+ /** @description prepareStep safety-net policy ids. Included when `expansion=enabledToolPolicies` is requested. */
1431
+ enabledToolPolicies?: string[];
1432
+ /** @description Per-tool force overrides. Included when `expansion=forcedTools` is requested. */
1433
+ forcedTools?: string[];
1434
+ /** @description When true with planning, gate heavy tools until plan approval. Included when `expansion=requirePlanApproval` is requested. */
1435
+ requirePlanApproval?: boolean;
1436
+ /** @description Optional elevated max steps for long-horizon mode. Included when `expansion=longHorizonMaxSteps` is requested. */
1437
+ longHorizonMaxSteps?: number | null;
1438
+ /** @description Optional max tokens per run hint for long-horizon mode. Included when `expansion=longHorizonMaxTokensPerRun` is requested. */
1439
+ longHorizonMaxTokensPerRun?: number | null;
1440
+ /**
1441
+ * @description Memory partitioning scope. Included when `expansion=memoryScope` is requested.
1442
+ * @enum {string}
1443
+ */
1444
+ memoryScope?: "PER_USER" | "PER_AGENT" | "PER_USER_PER_AGENT";
1445
+ /**
1446
+ * @description Days memories are retained. Included when `expansion=memoryRetentionDays` is requested.
1447
+ * @example 90
1448
+ */
1449
+ memoryRetentionDays?: number;
1450
+ /** @description Suggested prompts shown to users starting a conversation. Included when `expansion=suggestedPrompts` is requested. */
1451
+ suggestedPrompts?: string[];
1452
+ /**
1453
+ * Format: date-time
1454
+ * @description When builder setup was completed (the first-time wizard, or a code deploy). Included when `expansion=builderSetupCompletedAt` is requested.
1455
+ */
1456
+ builderSetupCompletedAt?: string | null;
1457
+ /** @description Saved canvas node positions for the agent builder. Included when `expansion=builderCanvasPositions` is requested. */
1458
+ builderCanvasPositions?: {
1459
+ [key: string]: unknown;
1460
+ } | null;
1461
+ /** @description Selected model ID within the AI provider connection. Included when `expansion=selectedModelId` is requested. */
1462
+ selectedModelId?: string | null;
1463
+ /** @description Assigned AI provider connection. Included when `expansion=aiConnection` is requested. */
1464
+ aiConnection?: {
1465
+ id?: string;
1466
+ name?: string;
1467
+ providerConfig?: {
1468
+ id?: string;
1469
+ providerSlug?: string;
1470
+ };
1471
+ } | null;
1472
+ /** @description Knowledge notebooks attached to the agent. Included when `expansion=knowledge` is requested. */
1473
+ agentKnowledge?: {
1474
+ id?: string;
1475
+ knowledge?: {
1476
+ id?: string;
1477
+ name?: string;
1478
+ };
1479
+ }[];
1480
+ /** @description Object types attached to the agent. Included when `expansion=objectTypes` is requested. */
1481
+ agentObjectTypes?: {
1482
+ id?: string;
1483
+ scope?: string;
1484
+ objectType?: {
1485
+ id?: string;
1486
+ name?: string;
1487
+ slug?: string;
1488
+ icon?: string | null;
1489
+ color?: string | null;
1490
+ };
1491
+ }[];
1492
+ /** @description Objects attached to the agent. Included when `expansion=objects` is requested. */
1493
+ agentObjects?: {
1494
+ id?: string;
1495
+ scope?: string;
1496
+ object?: {
1497
+ id?: string;
1498
+ name?: string;
1499
+ state?: string;
1500
+ objectType?: {
1501
+ id?: string;
1502
+ name?: string;
1503
+ slug?: string;
1504
+ icon?: string | null;
1505
+ color?: string | null;
1506
+ };
1507
+ };
1508
+ }[];
1509
+ /** @description App connections available to the agent. Included when `expansion=connections` is requested. */
1510
+ connections?: {
1511
+ id?: string;
1512
+ name?: string;
1513
+ }[];
1514
+ /** @description Variables attached to the agent. Included when `expansion=variables` is requested. */
1515
+ agentVariables?: {
1516
+ id?: string;
1517
+ variable?: {
1518
+ id?: string;
1519
+ name?: string;
1520
+ };
1521
+ }[];
1522
+ /** @description Workflows the agent can trigger. Included when `expansion=workflows` is requested. */
1523
+ agentWorkflows?: {
1524
+ id?: string;
1525
+ workflow?: {
1526
+ id?: string;
1527
+ name?: string;
1528
+ };
1529
+ }[];
1530
+ /** @description Sub-agent links for the agent. Included when `expansion=subAgents` is requested. */
1531
+ agentSubAgents?: {
1532
+ id?: string;
1533
+ subagent?: {
1534
+ id?: string;
1535
+ name?: string;
1536
+ };
1537
+ parentAgent?: {
1538
+ id?: string;
1539
+ name?: string;
1540
+ };
948
1541
  }[];
949
- /** @description The workflow trigger node definition (JSON). Included when `expansion=triggerNode` is requested. */
950
- triggerNode?: {
951
- [key: string]: unknown;
1542
+ /** @description MCP servers attached to the agent, with per-tool overrides. Included when `expansion=mcpServers` is requested. */
1543
+ agentMcpServers?: {
1544
+ id?: string;
1545
+ mcpServer?: {
1546
+ id?: string;
1547
+ slug?: string;
1548
+ name?: string;
1549
+ provider?: string;
1550
+ logoUrl?: string | null;
1551
+ description?: string | null;
1552
+ };
1553
+ toolOverrides?: {
1554
+ id?: string;
1555
+ toolName?: string;
1556
+ enabled?: boolean;
1557
+ requireApproval?: boolean;
1558
+ }[];
1559
+ }[];
1560
+ /** @description A2A (agent-to-agent) endpoints attached to the agent. Included when `expansion=a2aAgents` is requested. */
1561
+ agentA2aAgents?: {
1562
+ id?: string;
1563
+ a2aAgent?: {
1564
+ id?: string;
1565
+ slug?: string;
1566
+ name?: string;
1567
+ logoUrl?: string | null;
1568
+ description?: string | null;
1569
+ authType?: string;
1570
+ };
1571
+ }[];
1572
+ /** @description Web access configuration. Included when `expansion=webAccess` is requested. */
1573
+ agentWebAccess?: {
1574
+ service?: string;
1575
+ webSearchEnabled?: boolean;
1576
+ websiteAccessEnabled?: boolean;
952
1577
  } | null;
953
- /** @description IDs of the triggers and actions used by the workflow. Included when `expansion=triggerAndActionIds` is requested. */
954
- triggerAndActionIds?: string[];
955
- /** @description IDs of sub-workflows referenced by the workflow. Included when `expansion=subWorkflowIds` is requested. Only returned by GET /workflows/{workflowId}. */
956
- subWorkflowIds?: string[];
957
- /** @description IDs of agents referenced by the workflow. Included when `expansion=agentIds` is requested. Only returned by GET /workflows/{workflowId}. */
958
- agentIds?: string[];
959
- /** @description Internal polling trigger storage value. Included when `expansion=pollStorage` is requested. */
960
- pollStorage?: string | null;
961
- /**
962
- * Format: date-time
963
- * @description Timestamp of the next scheduled execution, if the workflow runs on a schedule. Included when `expansion=nextScheduledExecution` is requested.
964
- */
965
- nextScheduledExecution?: string | null;
966
- /**
967
- * @description Editor orientation of the workflow canvas. Included when `expansion=orientation` is requested.
968
- * @enum {string}
969
- */
970
- workflowOrientation?: "HORIZONTAL" | "VERTICAL";
971
- /** @description AI provider connection used by the workflow builder chat. Always returned on GET /workflows/{workflowId}. */
972
- aiConnectionId?: string | null;
973
- /** @description Selected model ID within the AI provider connection for workflow builder chat. Always returned on GET /workflows/{workflowId}. */
974
- selectedModelId?: string | null;
975
- };
976
- UpsertAgentToolDto: {
977
- /** @description Workflow app id (catalogue slug). */
978
- appId: string;
979
- /** @description Catalogue action id. */
980
- actionId: string;
981
- /** @description Connection instance UUID pre-bound on the tool. */
982
- connectionId?: string;
983
- /** @description Tool display name for the model. */
984
- name?: string;
985
- /** @description Tool description shown to the model. */
986
- description?: string;
987
- /** @description Pre-filled tool config (fields left empty are filled by the model). */
988
- input?: {
1578
+ /** @description Phone access configuration. Included when `expansion=phoneAccess` is requested. */
1579
+ agentPhoneAccess?: {
1580
+ service?: string;
1581
+ outboundCallsEnabled?: boolean;
1582
+ inboundCallsEnabled?: boolean;
1583
+ } | null;
1584
+ /** @description sha256 hex of the stored agent definition. */
1585
+ revision: string;
1586
+ /** @description Stored agent definition in the file shape, including settings, tools, and linked resources. */
1587
+ definition: {
989
1588
  [key: string]: unknown;
990
1589
  };
991
1590
  };
992
- UpsertAgentBySlugDto: {
993
- /**
994
- * @description Stable workspace-scoped slug (lowercase, digits, hyphens). Used as the upsert key.
995
- * @example support-triage
996
- */
997
- slug: string;
998
- /** @description Display name. Defaults to the slug when omitted. */
999
- name?: string;
1000
- description?: string;
1001
- /** @description System instructions / prompt for the agent. */
1002
- instructions: string;
1003
- /** @description Catalogue model id enabled on the AI connection. Example: `deepseek-ai/DeepSeek-V4-Pro`. Discover ids with GET /api/ai-connections. */
1004
- model: string;
1005
- /** @description AiProviderConnection UUID. When omitted, platform AI defaults apply. */
1006
- aiConnectionId?: string;
1007
- /** @description App Connection UUIDs the agent may use for tools. */
1008
- connectionIds?: string[];
1009
- /** @description Workflow UUIDs the agent may run (AgentWorkflow links). */
1010
- workflowIds?: string[];
1011
- /** @description Catalogue action tools (WorkflowNodeForRunner-shaped). */
1012
- tools?: components["schemas"]["UpsertAgentToolDto"][];
1013
- /** @description Marks the row as managed by code (CLI / SDK). Defaults to true on this endpoint. */
1014
- managedByCode?: boolean;
1015
- };
1016
1591
  AgentResponseDto: {
1017
1592
  /**
1018
1593
  * @description Agent ID (UUID)
@@ -1026,8 +1601,16 @@ interface components {
1026
1601
  name: string;
1027
1602
  /** @description Stable workspace-scoped slug for CLI / code deploy upserts. Included when `expansion=slug` is requested. */
1028
1603
  slug?: string | null;
1029
- /** @description True when last written by code (CLI / SDK). Included when `expansion=managedByCode` is requested. */
1030
- managedByCode?: boolean;
1604
+ /**
1605
+ * @description Where this agent is defined. Included when `expansion=codeSource` is requested.
1606
+ * @enum {string}
1607
+ */
1608
+ codeSource?: "none" | "synced" | "generated";
1609
+ /**
1610
+ * @description Sync state against the definitions folder. Included when `expansion=codeSyncStatus` is requested.
1611
+ * @enum {string}
1612
+ */
1613
+ codeSyncStatus?: "none" | "in_sync" | "changed_in_ui" | "locked";
1031
1614
  /** @description ID of the AI provider connection assigned to the agent. Always included. Null when the agent falls back to the workspace default connection. */
1032
1615
  FK_aiConnectionId: string | null;
1033
1616
  /** @description Agent description. Included when `expansion=description` is requested. */
@@ -1137,7 +1720,7 @@ interface components {
1137
1720
  suggestedPrompts?: string[];
1138
1721
  /**
1139
1722
  * Format: date-time
1140
- * @description When the first-time builder setup wizard was completed. Included when `expansion=builderSetupCompletedAt` is requested.
1723
+ * @description When builder setup was completed (the first-time wizard, or a code deploy). Included when `expansion=builderSetupCompletedAt` is requested.
1141
1724
  */
1142
1725
  builderSetupCompletedAt?: string | null;
1143
1726
  /** @description Saved canvas node positions for the agent builder. Included when `expansion=builderCanvasPositions` is requested. */
@@ -1268,6 +1851,25 @@ interface components {
1268
1851
  inboundCallsEnabled?: boolean;
1269
1852
  } | null;
1270
1853
  };
1854
+ AgentDefinitionResponseDto: {
1855
+ /** @description Agent ID (UUID). */
1856
+ id: string;
1857
+ /** @description Workspace-scoped slug. */
1858
+ slug: string;
1859
+ /** @description Workspace that owns the agent. */
1860
+ workspaceId: string;
1861
+ /**
1862
+ * @description Where this agent is defined.
1863
+ * @enum {string}
1864
+ */
1865
+ codeSource: "none" | "synced" | "generated";
1866
+ /** @description sha256 hex of the canonical agent definition. */
1867
+ revision: string;
1868
+ /** @description Agent definition in the file shape (kind, slug, settings, tools, and linked resources). */
1869
+ definition: {
1870
+ [key: string]: unknown;
1871
+ };
1872
+ };
1271
1873
  WorkflowAppResponseDto: {
1272
1874
  /** @description App ID, e.g. `gmail`. Matches the appId used in workflow execution steps. */
1273
1875
  id: string;
@@ -2139,32 +2741,6 @@ interface components {
2139
2741
  /** Format: date-time */
2140
2742
  updatedAt: string;
2141
2743
  };
2142
- PublicAiModelResponseDto: {
2143
- /** @description Catalogue model id passed to agent deploy as `model`. Example: `deepseek-ai/DeepSeek-V4-Pro`. */
2144
- id: string;
2145
- /** @description Display name. */
2146
- name: string;
2147
- /** @description True when this is the model used if an agent deploy omits `model` on this connection. */
2148
- isDefault: boolean;
2149
- /** @description Whether the model can call tools. */
2150
- supportsTools: boolean;
2151
- /** @description Whether the model accepts image input. */
2152
- supportsVision: boolean;
2153
- /** @description Whether the model exposes a reasoning mode. */
2154
- supportsReasoning: boolean;
2155
- };
2156
- PublicAiConnectionResponseDto: {
2157
- /** @description AiProviderConnection UUID. Pass as `aiConnectionId` / `defineAiConnection({ id })` when this connection is not the default. */
2158
- id: string;
2159
- /** @description Connection display name. Example: `Lunnoa LLMs`. */
2160
- name: string;
2161
- /** @description Provider slug. Example: `featherless` or `openai`. */
2162
- provider: string;
2163
- /** @description True for the connection used when an agent deploy omits `aiConnectionId`. */
2164
- isDefault: boolean;
2165
- /** @description Models this connection accepts. Inactive models are omitted. */
2166
- models: components["schemas"]["PublicAiModelResponseDto"][];
2167
- };
2168
2744
  ConnectionWorkspaceDto: {
2169
2745
  /** @description Workspace ID. */
2170
2746
  id: string;
@@ -2286,6 +2862,20 @@ interface components {
2286
2862
  activeStreamId?: string;
2287
2863
  /** @description Durable outcome of the most recent agent-turn run. Omitted when the task has never run. */
2288
2864
  latestRun?: components["schemas"]["TaskLatestRunDto"];
2865
+ /** @description Runtime todo/plan for this task when the agent has planning enabled (CTO-258). Always returned from the single-task endpoints. */
2866
+ runtimePlan?: {
2867
+ id?: string;
2868
+ content?: string;
2869
+ /** @enum {string} */
2870
+ status?: "pending" | "in_progress" | "completed" | "cancelled";
2871
+ /** Format: date-time */
2872
+ updatedAt?: string;
2873
+ }[] | null;
2874
+ /**
2875
+ * Format: date-time
2876
+ * @description When the current runtime plan was approved (HITL). Null until approved or after the plan is rewritten.
2877
+ */
2878
+ planApprovedAt?: string | null;
2289
2879
  /** @description Task description. Included when `expansion=description` is requested. */
2290
2880
  description?: string | null;
2291
2881
  /**
@@ -2397,7 +2987,7 @@ interface components {
2397
2987
  [key: string]: unknown;
2398
2988
  }[];
2399
2989
  /**
2400
- * @description Agent chat mode
2990
+ * @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.
2401
2991
  * @example preview
2402
2992
  * @enum {string}
2403
2993
  */
@@ -2438,14 +3028,37 @@ interface components {
2438
3028
  */
2439
3029
 
2440
3030
  type Schemas = components['schemas'];
3031
+ /** Where an agent or workflow definition was last written from. */
3032
+ type CodeSource = 'none' | 'synced' | 'generated';
3033
+ /** Computed on read. `locked` means the UI cannot edit the definition. */
3034
+ type CodeSyncStatus = 'none' | 'in_sync' | 'changed_in_ui' | 'locked';
3035
+ interface CodeSyncContext {
3036
+ workspaceId: string;
3037
+ lockCodeSyncedResources: boolean;
3038
+ }
3039
+ /** `GET /api/{agents|workflows}/slug/:slug/definition`. */
3040
+ interface CodeDefinitionResponse<TDefinition> {
3041
+ id: string;
3042
+ slug: string;
3043
+ workspaceId: string;
3044
+ codeSource: CodeSource;
3045
+ revision: string;
3046
+ definition: TDefinition;
3047
+ }
2441
3048
  type EnabledFeatures = Schemas['EnabledFeaturesResponseDto'];
2442
- type Agent = Schemas['AgentResponseDto'];
3049
+ type Agent = Omit<Schemas['AgentResponseDto'], 'managedByCode'> & {
3050
+ codeSource?: CodeSource;
3051
+ codeSyncStatus?: CodeSyncStatus;
3052
+ };
2443
3053
  type Task = Schemas['TaskResponseDto'];
2444
3054
  type TaskListItem = Schemas['TaskListItemResponseDto'];
2445
3055
  type CreateTaskInput = Schemas['CreateTaskDto'];
2446
3056
  type UpdateTaskInput = Schemas['UpdateTaskDto'];
2447
3057
  type DeletedTask = Schemas['DeletedTaskResponseDto'];
2448
- type Workflow = Schemas['WorkflowResponseDto'];
3058
+ type Workflow = Omit<Schemas['WorkflowResponseDto'], 'managedByCode'> & {
3059
+ codeSource?: CodeSource;
3060
+ codeSyncStatus?: CodeSyncStatus;
3061
+ };
2449
3062
  type Execution = Schemas['ExecutionResponseDto'];
2450
3063
  type ExecutionPathStep = Schemas['ExecutionPathStepDto'];
2451
3064
  type ExecuteWorkflowResult = Schemas['ExecuteWorkflowResponseDto'];
@@ -2703,12 +3316,189 @@ declare class ActionsResource {
2703
3316
  get(appId: string, actionId: string): Promise<Record<string, unknown> | undefined>;
2704
3317
  }
2705
3318
 
3319
+ /**
3320
+ * On-disk agent and workflow definitions (the pull/push file shape).
3321
+ * `$schema` is allowed on input and stripped; the CLI adds it when writing.
3322
+ */
3323
+ interface RetrySettings {
3324
+ enabled: boolean;
3325
+ maxAttempts: number;
3326
+ delaySeconds: number;
3327
+ }
3328
+ interface ContinueOnFailureSettings {
3329
+ enabled: boolean;
3330
+ }
3331
+ /** Every key is present on files the API returns. Hand-written files may omit unset keys. */
3332
+ interface AgentFileSettings {
3333
+ temperature?: number;
3334
+ topP?: number;
3335
+ maxOutputTokens?: number | null;
3336
+ frequencyPenalty?: number;
3337
+ presencePenalty?: number;
3338
+ seed?: number | null;
3339
+ maxRetries?: number;
3340
+ maxToolRoundtrips?: number;
3341
+ messageLookbackLimit?: number;
3342
+ taskNamingInstructions?: string | null;
3343
+ enabledBuiltInTools?: string[];
3344
+ enabledPlatformTools?: string[];
3345
+ enabledToolPolicies?: string[];
3346
+ forcedTools?: unknown;
3347
+ suggestedPrompts?: string[];
3348
+ dynamicActionDiscoveryEnabled?: boolean;
3349
+ dynamicMcpDiscoveryEnabled?: boolean;
3350
+ dynamicSelfInstructionsEnabled?: boolean;
3351
+ memoryEnabled?: boolean;
3352
+ memoryScope?: string;
3353
+ memoryRetentionDays?: number;
3354
+ enablePlanning?: boolean;
3355
+ requirePlanApproval?: boolean;
3356
+ enableToolResultOffload?: boolean;
3357
+ toolResultOffloadThresholdBytes?: number;
3358
+ longHorizonMode?: boolean;
3359
+ longHorizonMaxSteps?: number | null;
3360
+ longHorizonMaxTokensPerRun?: number | null;
3361
+ piiRoutingMode?: string;
3362
+ piiFallbackConnectionId?: string | null;
3363
+ piiFallbackModelId?: string | null;
3364
+ webAccess?: boolean | null;
3365
+ phoneAccess?: boolean | null;
3366
+ }
3367
+ interface AgentFileTool {
3368
+ key: string;
3369
+ /** Catalogue action id. */
3370
+ id: string;
3371
+ appId?: string;
3372
+ connection?: {
3373
+ id: string;
3374
+ };
3375
+ name: string;
3376
+ description?: string;
3377
+ input: Record<string, unknown>;
3378
+ }
3379
+ interface AgentLinkBySlug {
3380
+ slug: string;
3381
+ }
3382
+ interface AgentLinkById {
3383
+ id: string;
3384
+ }
3385
+ type AgentSlugOrId = AgentLinkBySlug | AgentLinkById;
3386
+ interface AgentFileDefinition {
3387
+ kind: 'agent';
3388
+ slug: string;
3389
+ name: string;
3390
+ description?: string;
3391
+ model?: string;
3392
+ aiConnection?: {
3393
+ id: string;
3394
+ };
3395
+ /**
3396
+ * API and TypeScript use a string. Files on disk point at
3397
+ * `<slug>.instructions.md`; only the CLI reads that file.
3398
+ */
3399
+ instructions: string | {
3400
+ file: string;
3401
+ };
3402
+ settings: AgentFileSettings;
3403
+ tools: AgentFileTool[];
3404
+ workflows: AgentSlugOrId[];
3405
+ agents: AgentSlugOrId[];
3406
+ connections: AgentLinkById[];
3407
+ knowledge: AgentLinkById[];
3408
+ variables: AgentLinkById[];
3409
+ objects: AgentLinkById[];
3410
+ objectTypes: AgentLinkById[];
3411
+ mcpServers: Array<{
3412
+ id: string;
3413
+ connectionId?: string;
3414
+ }>;
3415
+ a2aAgents: AgentLinkById[];
3416
+ }
3417
+ interface WorkflowUseFile {
3418
+ id: string;
3419
+ appId?: string;
3420
+ connection?: {
3421
+ id: string;
3422
+ };
3423
+ }
3424
+ interface WorkflowTriggerFile {
3425
+ id: string;
3426
+ appId?: string;
3427
+ connection?: {
3428
+ id: string;
3429
+ };
3430
+ input?: Record<string, unknown>;
3431
+ inputs?: Array<Record<string, unknown>>;
3432
+ name: string;
3433
+ description?: string;
3434
+ }
3435
+ interface WorkflowStepFile {
3436
+ key: string;
3437
+ name: string;
3438
+ description?: string;
3439
+ use: WorkflowUseFile;
3440
+ input: Record<string, unknown>;
3441
+ retrySettings?: RetrySettings;
3442
+ continueOnFailure?: ContinueOnFailureSettings;
3443
+ paths?: Array<{
3444
+ label: string;
3445
+ when?: Array<Array<{
3446
+ field: string;
3447
+ condition: string;
3448
+ value?: string;
3449
+ }>>;
3450
+ steps: WorkflowStepFile[];
3451
+ }>;
3452
+ }
3453
+ interface WorkflowStepsFileDefinition {
3454
+ kind: 'workflow';
3455
+ format: 'steps';
3456
+ slug: string;
3457
+ name: string;
3458
+ description?: string;
3459
+ trigger: WorkflowTriggerFile;
3460
+ steps: WorkflowStepFile[];
3461
+ }
3462
+ interface WorkflowGraphNode {
3463
+ id?: string;
3464
+ key: string;
3465
+ nodeType: 'trigger' | 'action';
3466
+ appId: string;
3467
+ actionId?: string;
3468
+ triggerId?: string;
3469
+ name: string;
3470
+ description?: string;
3471
+ value: Record<string, unknown>;
3472
+ retrySettings?: Record<string, unknown>;
3473
+ continueOnFailure?: Record<string, unknown>;
3474
+ [other: string]: unknown;
3475
+ }
3476
+ interface WorkflowGraphEdge {
3477
+ id?: string;
3478
+ source: string;
3479
+ target: string;
3480
+ sourceHandle?: string;
3481
+ targetHandle?: string;
3482
+ type?: string;
3483
+ }
3484
+ interface WorkflowGraphFileDefinition {
3485
+ kind: 'workflow';
3486
+ format: 'graph';
3487
+ slug: string;
3488
+ name: string;
3489
+ description?: string;
3490
+ nodes: WorkflowGraphNode[];
3491
+ edges: WorkflowGraphEdge[];
3492
+ }
3493
+ type WorkflowFileDefinition = WorkflowStepsFileDefinition | WorkflowGraphFileDefinition;
3494
+
2706
3495
  /**
2707
3496
  * Pure typed definition factories for local workflow/agent authoring.
2708
3497
  * These do not call the network. Deploy with the CLI; run ad-hoc with `runs.start`.
2709
3498
  *
2710
3499
  * Not the same as `@lunnoa/toolkit` `createAction` / `createApp` (in-platform apps).
2711
3500
  */
3501
+
2712
3502
  declare const DEFINE_KINDS: {
2713
3503
  readonly connection: "connection";
2714
3504
  readonly aiConnection: "aiConnection";
@@ -2796,6 +3586,15 @@ interface WorkflowStepDefinition {
2796
3586
  /** Per-step input overrides. Values may contain `ref.trigger` / `ref.step`. */
2797
3587
  input?: Record<string, unknown>;
2798
3588
  name?: string;
3589
+ description?: string;
3590
+ retrySettings?: {
3591
+ enabled: boolean;
3592
+ maxAttempts: number;
3593
+ delaySeconds: number;
3594
+ };
3595
+ continueOnFailure?: {
3596
+ enabled: boolean;
3597
+ };
2799
3598
  /**
2800
3599
  * Branches after this step. Only on Conditional Paths, Manually Decide Path,
2801
3600
  * or Request Approval (approved path first, then rejected), and only on the
@@ -2880,6 +3679,7 @@ interface EntityTypeDefinition {
2880
3679
  }
2881
3680
 
2882
3681
  interface UpsertAgentToolInput {
3682
+ key?: string;
2883
3683
  appId: string;
2884
3684
  actionId: string;
2885
3685
  connectionId?: string;
@@ -2890,14 +3690,37 @@ interface UpsertAgentToolInput {
2890
3690
  interface UpsertAgentBySlugInput {
2891
3691
  slug: string;
2892
3692
  name?: string;
2893
- description?: string;
3693
+ /** Null clears a description that was removed from the definition file. */
3694
+ description?: string | null;
2894
3695
  instructions: string;
2895
- model: string;
3696
+ /** Null clears a model that was removed from the definition file. */
3697
+ model?: string | null;
2896
3698
  aiConnectionId?: string;
2897
3699
  connectionIds?: string[];
2898
3700
  workflowIds?: string[];
2899
3701
  tools?: UpsertAgentToolInput[];
2900
- managedByCode?: boolean;
3702
+ settings?: Partial<AgentFileSettings>;
3703
+ workflows?: AgentSlugOrId[];
3704
+ agents?: AgentSlugOrId[];
3705
+ knowledgeIds?: string[];
3706
+ variableIds?: string[];
3707
+ objectIds?: string[];
3708
+ objectTypeIds?: string[];
3709
+ mcpServers?: Array<{
3710
+ id: string;
3711
+ connectionId?: string;
3712
+ }>;
3713
+ a2aAgentIds?: string[];
3714
+ /** `generated` for TypeScript deploys, `synced` for definition files. */
3715
+ codeSource?: Extract<CodeSource, 'synced' | 'generated'>;
3716
+ baseRevision?: string;
3717
+ force?: boolean;
3718
+ }
3719
+ interface AgentUpsertOptions {
3720
+ workflowIds?: string[];
3721
+ codeSource?: Extract<CodeSource, 'synced' | 'generated'>;
3722
+ baseRevision?: string;
3723
+ force?: boolean;
2901
3724
  }
2902
3725
  declare class AgentsResource {
2903
3726
  private readonly http;
@@ -2906,13 +3729,13 @@ declare class AgentsResource {
2906
3729
  list(options?: ListQueryOptions): Promise<Agent[]>;
2907
3730
  /** Returns a single agent. */
2908
3731
  get(agentId: string, options?: Pick<ListQueryOptions, 'expansion'>): Promise<Agent>;
3732
+ /** Exported definition for `lunnoa/agents/<slug>.json`. */
3733
+ getDefinition(slug: string): Promise<CodeDefinitionResponse<AgentFileDefinition>>;
2909
3734
  /**
2910
3735
  * Upsert an agent by slug inside the workspace on the API key.
2911
3736
  * Prefer the CLI (`npx @lunnoa/client agents deploy`) for happy-path deploy.
2912
3737
  */
2913
- upsertBySlug(body: UpsertAgentBySlugInput | AgentDefinition, options?: {
2914
- workflowIds?: string[];
2915
- }): Promise<Agent>;
3738
+ upsertBySlug(body: UpsertAgentBySlugInput | AgentDefinition | AgentFileDefinition, options?: AgentUpsertOptions): Promise<Agent & CodeDefinitionResponse<AgentFileDefinition>>;
2916
3739
  }
2917
3740
 
2918
3741
  /**
@@ -3599,6 +4422,13 @@ declare class VariablesResource {
3599
4422
  delete(variableId: string): Promise<boolean>;
3600
4423
  }
3601
4424
 
4425
+ declare class CodeSyncResource {
4426
+ private readonly http;
4427
+ constructor(http: HttpClient);
4428
+ /** Workspace id and whether synced resources are locked in the UI. */
4429
+ context(): Promise<CodeSyncContext>;
4430
+ }
4431
+
3602
4432
  interface UpsertWorkflowStepInput {
3603
4433
  /** Name later steps use in `={{step:<key>,path}}`. Keeps the node id stable. */
3604
4434
  key?: string;
@@ -3608,6 +4438,14 @@ interface UpsertWorkflowStepInput {
3608
4438
  input?: Record<string, unknown>;
3609
4439
  name?: string;
3610
4440
  description?: string;
4441
+ retrySettings?: {
4442
+ enabled: boolean;
4443
+ maxAttempts: number;
4444
+ delaySeconds: number;
4445
+ };
4446
+ continueOnFailure?: {
4447
+ enabled: boolean;
4448
+ };
3611
4449
  /** Branches after this step (last step of a list only). */
3612
4450
  paths?: UpsertWorkflowPathInput[];
3613
4451
  }
@@ -3627,15 +4465,30 @@ interface UpsertWorkflowTriggerInput {
3627
4465
  name?: string;
3628
4466
  description?: string;
3629
4467
  }
4468
+ interface UpsertWorkflowGraphInput {
4469
+ nodes: WorkflowGraphFileDefinition['nodes'];
4470
+ edges: WorkflowGraphFileDefinition['edges'];
4471
+ }
3630
4472
  interface UpsertWorkflowBySlugInput {
3631
4473
  slug: string;
3632
4474
  name?: string;
3633
- description?: string;
4475
+ /** Null clears a description that was removed from the definition file. */
4476
+ description?: string | null;
3634
4477
  isActive?: boolean;
3635
4478
  /** Omit for Manually Run with no input fields. */
3636
4479
  trigger?: UpsertWorkflowTriggerInput;
3637
- steps: UpsertWorkflowStepInput[];
3638
- managedByCode?: boolean;
4480
+ steps?: UpsertWorkflowStepInput[];
4481
+ /** Lossless graph. Not sent together with `trigger` / `steps`. */
4482
+ graph?: UpsertWorkflowGraphInput;
4483
+ /** `generated` for TypeScript deploys, `synced` for definition files. */
4484
+ codeSource?: Extract<CodeSource, 'synced' | 'generated'>;
4485
+ baseRevision?: string;
4486
+ force?: boolean;
4487
+ }
4488
+ interface WorkflowUpsertOptions {
4489
+ codeSource?: Extract<CodeSource, 'synced' | 'generated'>;
4490
+ baseRevision?: string;
4491
+ force?: boolean;
3639
4492
  }
3640
4493
  declare class WorkflowsResource {
3641
4494
  private readonly http;
@@ -3648,11 +4501,13 @@ declare class WorkflowsResource {
3648
4501
  * the manual trigger's custom input field definitions.
3649
4502
  */
3650
4503
  get(workflowId: string, options?: Pick<ListQueryOptions, 'expansion'>): Promise<Workflow>;
4504
+ /** Exported definition for `lunnoa/workflows/<slug>.json`. */
4505
+ getDefinition(slug: string): Promise<CodeDefinitionResponse<WorkflowFileDefinition>>;
3651
4506
  /**
3652
4507
  * Upsert a workflow by slug inside the workspace on the API key.
3653
4508
  * Prefer the CLI (`npx @lunnoa/client workflows deploy`) for happy-path deploy.
3654
4509
  */
3655
- upsertBySlug(body: UpsertWorkflowBySlugInput | WorkflowDefinition): Promise<Workflow>;
4510
+ upsertBySlug(body: UpsertWorkflowBySlugInput | WorkflowDefinition | WorkflowFileDefinition, options?: WorkflowUpsertOptions): Promise<Workflow & CodeDefinitionResponse<WorkflowFileDefinition>>;
3656
4511
  /**
3657
4512
  * Starts a new execution of the workflow with the given trigger inputs.
3658
4513
  * Returns immediately with the execution ID.
@@ -3720,6 +4575,8 @@ declare class LunnoaClient {
3720
4575
  readonly aiConnections: AiConnectionsResource;
3721
4576
  readonly workflowApps: WorkflowAppsResource;
3722
4577
  readonly discovery: DiscoveryResource;
4578
+ /** Workspace id for the definitions lock, and the code-sync lock flag. */
4579
+ readonly codeSync: CodeSyncResource;
3723
4580
  constructor(options: LunnoaClientOptions);
3724
4581
  }
3725
4582