@lunnoa/client 2.4.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,26 +835,13 @@ 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;
838
+ UpsertWorkflowPathConditionDto: {
839
+ /** @description One step reference, e.g. ={{step:load,amount}}. */
840
+ field: string;
841
+ /** @description contains, does_not_contain, equals, does_not_equal, exists, does_not_exist, starts_with, ends_with, is_empty, is_not_empty, comes_before, comes_after, is_in_the_past, is_in_the_future, is_true, is_false, is_truthy, is_falsey, is_greater_than, is_less_than, is_greater_than_or_equal_to, is_less_than_or_equal_to, matches_regex, does_not_match_regex. */
842
+ condition: string;
843
+ /** @description Value to compare with. */
844
+ value?: string;
832
845
  };
833
846
  UpsertWorkflowTriggerInputFieldDto: {
834
847
  /** @description Field id. Callers pass this key to workflows.execute. */
@@ -839,14 +852,10 @@ interface components {
839
852
  /** @description text, number, date, or select. Defaults to text. */
840
853
  inputType?: string;
841
854
  /** @description true, or { missingMessage, missingStatus }. */
842
- required?: boolean | {
843
- [key: string]: unknown;
844
- };
855
+ required?: Record<string, never>;
845
856
  /** @description Used when the caller omits the field. */
846
- defaultValue?: unknown;
847
- selectOptions?: {
848
- [key: string]: unknown;
849
- }[];
857
+ defaultValue?: Record<string, never>;
858
+ selectOptions?: Record<string, never>[];
850
859
  };
851
860
  UpsertWorkflowTriggerDto: {
852
861
  /** @description Catalogue trigger id, for example flow-control_trigger_manual. */
@@ -865,6 +874,59 @@ interface components {
865
874
  name?: string;
866
875
  description?: string;
867
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
+ };
868
930
  UpsertWorkflowBySlugDto: {
869
931
  /**
870
932
  * @description Stable workspace-scoped slug (lowercase, digits, hyphens). Used as the upsert key.
@@ -876,12 +938,107 @@ interface components {
876
938
  description?: string;
877
939
  /** @description Whether the workflow is active. */
878
940
  isActive?: boolean;
879
- /** @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`. */
880
942
  trigger?: components["schemas"]["UpsertWorkflowTriggerDto"];
881
- /** @description Linear catalogue-action steps (v1; no branches). */
882
- steps: components["schemas"]["UpsertWorkflowStepDto"][];
883
- /** @description Marks the row as managed by code (CLI / SDK). Defaults to true on this endpoint. */
884
- 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
+ };
885
1042
  };
886
1043
  WorkflowResponseDto: {
887
1044
  /** @description Workflow ID */
@@ -890,8 +1047,16 @@ interface components {
890
1047
  name: string;
891
1048
  /** @description Stable workspace-scoped slug for CLI / code deploy upserts. Included when `expansion=slug` is requested. */
892
1049
  slug?: string | null;
893
- /** @description True when last written by code (CLI / SDK). Included when `expansion=managedByCode` is requested. */
894
- 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";
895
1060
  /** @description Workflow description. Included when `expansion=description` is requested. */
896
1061
  description?: string | null;
897
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. */
@@ -924,77 +1089,505 @@ interface components {
924
1089
  nodes?: {
925
1090
  [key: string]: unknown;
926
1091
  }[];
927
- /** @description Workflow edge definitions connecting nodes (JSON). Included when `expansion=edges` is requested. */
928
- edges?: {
929
- [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
+ };
1541
+ }[];
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
+ }[];
930
1559
  }[];
931
- /** @description The workflow trigger node definition (JSON). Included when `expansion=triggerNode` is requested. */
932
- triggerNode?: {
933
- [key: string]: unknown;
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;
934
1577
  } | null;
935
- /** @description IDs of the triggers and actions used by the workflow. Included when `expansion=triggerAndActionIds` is requested. */
936
- triggerAndActionIds?: string[];
937
- /** @description IDs of sub-workflows referenced by the workflow. Included when `expansion=subWorkflowIds` is requested. Only returned by GET /workflows/{workflowId}. */
938
- subWorkflowIds?: string[];
939
- /** @description IDs of agents referenced by the workflow. Included when `expansion=agentIds` is requested. Only returned by GET /workflows/{workflowId}. */
940
- agentIds?: string[];
941
- /** @description Internal polling trigger storage value. Included when `expansion=pollStorage` is requested. */
942
- pollStorage?: string | null;
943
- /**
944
- * Format: date-time
945
- * @description Timestamp of the next scheduled execution, if the workflow runs on a schedule. Included when `expansion=nextScheduledExecution` is requested.
946
- */
947
- nextScheduledExecution?: string | null;
948
- /**
949
- * @description Editor orientation of the workflow canvas. Included when `expansion=orientation` is requested.
950
- * @enum {string}
951
- */
952
- workflowOrientation?: "HORIZONTAL" | "VERTICAL";
953
- /** @description AI provider connection used by the workflow builder chat. Always returned on GET /workflows/{workflowId}. */
954
- aiConnectionId?: string | null;
955
- /** @description Selected model ID within the AI provider connection for workflow builder chat. Always returned on GET /workflows/{workflowId}. */
956
- selectedModelId?: string | null;
957
- };
958
- UpsertAgentToolDto: {
959
- /** @description Workflow app id (catalogue slug). */
960
- appId: string;
961
- /** @description Catalogue action id. */
962
- actionId: string;
963
- /** @description Connection instance UUID pre-bound on the tool. */
964
- connectionId?: string;
965
- /** @description Tool display name for the model. */
966
- name?: string;
967
- /** @description Tool description shown to the model. */
968
- description?: string;
969
- /** @description Pre-filled tool config (fields left empty are filled by the model). */
970
- 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: {
971
1588
  [key: string]: unknown;
972
1589
  };
973
1590
  };
974
- UpsertAgentBySlugDto: {
975
- /**
976
- * @description Stable workspace-scoped slug (lowercase, digits, hyphens). Used as the upsert key.
977
- * @example support-triage
978
- */
979
- slug: string;
980
- /** @description Display name. Defaults to the slug when omitted. */
981
- name?: string;
982
- description?: string;
983
- /** @description System instructions / prompt for the agent. */
984
- instructions: string;
985
- /** @description Catalogue model id enabled on the AI connection. Example: `deepseek-ai/DeepSeek-V4-Pro`. Discover ids with GET /api/ai-connections. */
986
- model: string;
987
- /** @description AiProviderConnection UUID. When omitted, platform AI defaults apply. */
988
- aiConnectionId?: string;
989
- /** @description App Connection UUIDs the agent may use for tools. */
990
- connectionIds?: string[];
991
- /** @description Workflow UUIDs the agent may run (AgentWorkflow links). */
992
- workflowIds?: string[];
993
- /** @description Catalogue action tools (WorkflowNodeForRunner-shaped). */
994
- tools?: components["schemas"]["UpsertAgentToolDto"][];
995
- /** @description Marks the row as managed by code (CLI / SDK). Defaults to true on this endpoint. */
996
- managedByCode?: boolean;
997
- };
998
1591
  AgentResponseDto: {
999
1592
  /**
1000
1593
  * @description Agent ID (UUID)
@@ -1008,8 +1601,16 @@ interface components {
1008
1601
  name: string;
1009
1602
  /** @description Stable workspace-scoped slug for CLI / code deploy upserts. Included when `expansion=slug` is requested. */
1010
1603
  slug?: string | null;
1011
- /** @description True when last written by code (CLI / SDK). Included when `expansion=managedByCode` is requested. */
1012
- 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";
1013
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. */
1014
1615
  FK_aiConnectionId: string | null;
1015
1616
  /** @description Agent description. Included when `expansion=description` is requested. */
@@ -1119,7 +1720,7 @@ interface components {
1119
1720
  suggestedPrompts?: string[];
1120
1721
  /**
1121
1722
  * Format: date-time
1122
- * @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.
1123
1724
  */
1124
1725
  builderSetupCompletedAt?: string | null;
1125
1726
  /** @description Saved canvas node positions for the agent builder. Included when `expansion=builderCanvasPositions` is requested. */
@@ -1250,6 +1851,25 @@ interface components {
1250
1851
  inboundCallsEnabled?: boolean;
1251
1852
  } | null;
1252
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
+ };
1253
1873
  WorkflowAppResponseDto: {
1254
1874
  /** @description App ID, e.g. `gmail`. Matches the appId used in workflow execution steps. */
1255
1875
  id: string;
@@ -2121,32 +2741,6 @@ interface components {
2121
2741
  /** Format: date-time */
2122
2742
  updatedAt: string;
2123
2743
  };
2124
- PublicAiModelResponseDto: {
2125
- /** @description Catalogue model id passed to agent deploy as `model`. Example: `deepseek-ai/DeepSeek-V4-Pro`. */
2126
- id: string;
2127
- /** @description Display name. */
2128
- name: string;
2129
- /** @description True when this is the model used if an agent deploy omits `model` on this connection. */
2130
- isDefault: boolean;
2131
- /** @description Whether the model can call tools. */
2132
- supportsTools: boolean;
2133
- /** @description Whether the model accepts image input. */
2134
- supportsVision: boolean;
2135
- /** @description Whether the model exposes a reasoning mode. */
2136
- supportsReasoning: boolean;
2137
- };
2138
- PublicAiConnectionResponseDto: {
2139
- /** @description AiProviderConnection UUID. Pass as `aiConnectionId` / `defineAiConnection({ id })` when this connection is not the default. */
2140
- id: string;
2141
- /** @description Connection display name. Example: `Lunnoa LLMs`. */
2142
- name: string;
2143
- /** @description Provider slug. Example: `featherless` or `openai`. */
2144
- provider: string;
2145
- /** @description True for the connection used when an agent deploy omits `aiConnectionId`. */
2146
- isDefault: boolean;
2147
- /** @description Models this connection accepts. Inactive models are omitted. */
2148
- models: components["schemas"]["PublicAiModelResponseDto"][];
2149
- };
2150
2744
  ConnectionWorkspaceDto: {
2151
2745
  /** @description Workspace ID. */
2152
2746
  id: string;
@@ -2268,6 +2862,20 @@ interface components {
2268
2862
  activeStreamId?: string;
2269
2863
  /** @description Durable outcome of the most recent agent-turn run. Omitted when the task has never run. */
2270
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;
2271
2879
  /** @description Task description. Included when `expansion=description` is requested. */
2272
2880
  description?: string | null;
2273
2881
  /**
@@ -2379,7 +2987,7 @@ interface components {
2379
2987
  [key: string]: unknown;
2380
2988
  }[];
2381
2989
  /**
2382
- * @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.
2383
2991
  * @example preview
2384
2992
  * @enum {string}
2385
2993
  */
@@ -2420,14 +3028,37 @@ interface components {
2420
3028
  */
2421
3029
 
2422
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
+ }
2423
3048
  type EnabledFeatures = Schemas['EnabledFeaturesResponseDto'];
2424
- type Agent = Schemas['AgentResponseDto'];
3049
+ type Agent = Omit<Schemas['AgentResponseDto'], 'managedByCode'> & {
3050
+ codeSource?: CodeSource;
3051
+ codeSyncStatus?: CodeSyncStatus;
3052
+ };
2425
3053
  type Task = Schemas['TaskResponseDto'];
2426
3054
  type TaskListItem = Schemas['TaskListItemResponseDto'];
2427
3055
  type CreateTaskInput = Schemas['CreateTaskDto'];
2428
3056
  type UpdateTaskInput = Schemas['UpdateTaskDto'];
2429
3057
  type DeletedTask = Schemas['DeletedTaskResponseDto'];
2430
- type Workflow = Schemas['WorkflowResponseDto'];
3058
+ type Workflow = Omit<Schemas['WorkflowResponseDto'], 'managedByCode'> & {
3059
+ codeSource?: CodeSource;
3060
+ codeSyncStatus?: CodeSyncStatus;
3061
+ };
2431
3062
  type Execution = Schemas['ExecutionResponseDto'];
2432
3063
  type ExecutionPathStep = Schemas['ExecutionPathStepDto'];
2433
3064
  type ExecuteWorkflowResult = Schemas['ExecuteWorkflowResponseDto'];
@@ -2685,12 +3316,189 @@ declare class ActionsResource {
2685
3316
  get(appId: string, actionId: string): Promise<Record<string, unknown> | undefined>;
2686
3317
  }
2687
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
+
2688
3495
  /**
2689
3496
  * Pure typed definition factories for local workflow/agent authoring.
2690
3497
  * These do not call the network. Deploy with the CLI; run ad-hoc with `runs.start`.
2691
3498
  *
2692
3499
  * Not the same as `@lunnoa/toolkit` `createAction` / `createApp` (in-platform apps).
2693
3500
  */
3501
+
2694
3502
  declare const DEFINE_KINDS: {
2695
3503
  readonly connection: "connection";
2696
3504
  readonly aiConnection: "aiConnection";
@@ -2778,6 +3586,41 @@ interface WorkflowStepDefinition {
2778
3586
  /** Per-step input overrides. Values may contain `ref.trigger` / `ref.step`. */
2779
3587
  input?: Record<string, unknown>;
2780
3588
  name?: string;
3589
+ description?: string;
3590
+ retrySettings?: {
3591
+ enabled: boolean;
3592
+ maxAttempts: number;
3593
+ delaySeconds: number;
3594
+ };
3595
+ continueOnFailure?: {
3596
+ enabled: boolean;
3597
+ };
3598
+ /**
3599
+ * Branches after this step. Only on Conditional Paths, Manually Decide Path,
3600
+ * or Request Approval (approved path first, then rejected), and only on the
3601
+ * last step of a list. Put later steps inside each path.
3602
+ */
3603
+ paths?: WorkflowPathDefinition[];
3604
+ }
3605
+ /** Conditions Conditional Paths evaluates (same list as the builder). */
3606
+ declare const PATH_CONDITIONS: readonly ["contains", "does_not_contain", "equals", "does_not_equal", "exists", "does_not_exist", "starts_with", "ends_with", "is_empty", "is_not_empty", "comes_before", "comes_after", "is_in_the_past", "is_in_the_future", "is_true", "is_false", "is_truthy", "is_falsey", "is_greater_than", "is_less_than", "is_greater_than_or_equal_to", "is_less_than_or_equal_to", "matches_regex", "does_not_match_regex"];
3607
+ type PathConditionType = (typeof PATH_CONDITIONS)[number];
3608
+ interface PathCondition {
3609
+ /** One reference: `ref.trigger(...)` or `ref.step(...)`. */
3610
+ field: string;
3611
+ condition: PathConditionType;
3612
+ /** Compared as text. Omit for exists / is_empty / is_true and similar. */
3613
+ value?: string;
3614
+ }
3615
+ interface WorkflowPathDefinition {
3616
+ /** Unique on its step. On Request Approval use `Approved` / `Rejected`. */
3617
+ label: string;
3618
+ /**
3619
+ * Conditional Paths only. Groups are OR-ed, conditions in a group AND-ed.
3620
+ * Omit to always take this path.
3621
+ */
3622
+ when?: PathCondition[][];
3623
+ steps: WorkflowStepDefinition[];
2781
3624
  }
2782
3625
  interface WorkflowDefinition {
2783
3626
  kind: typeof DEFINE_KINDS.workflow;
@@ -2791,7 +3634,7 @@ interface WorkflowDefinition {
2791
3634
  * `runs.start` ignores this and runs the steps only.
2792
3635
  */
2793
3636
  trigger?: TriggerDefinition;
2794
- /** Linear steps (v1; no branches). */
3637
+ /** Steps in order. The last step may branch with `paths`. */
2795
3638
  steps: WorkflowStepDefinition[];
2796
3639
  }
2797
3640
  type AgentToolDefinition = ActionDefinition | WorkflowDefinition | {
@@ -2836,6 +3679,7 @@ interface EntityTypeDefinition {
2836
3679
  }
2837
3680
 
2838
3681
  interface UpsertAgentToolInput {
3682
+ key?: string;
2839
3683
  appId: string;
2840
3684
  actionId: string;
2841
3685
  connectionId?: string;
@@ -2846,14 +3690,37 @@ interface UpsertAgentToolInput {
2846
3690
  interface UpsertAgentBySlugInput {
2847
3691
  slug: string;
2848
3692
  name?: string;
2849
- description?: string;
3693
+ /** Null clears a description that was removed from the definition file. */
3694
+ description?: string | null;
2850
3695
  instructions: string;
2851
- model: string;
3696
+ /** Null clears a model that was removed from the definition file. */
3697
+ model?: string | null;
2852
3698
  aiConnectionId?: string;
2853
3699
  connectionIds?: string[];
2854
3700
  workflowIds?: string[];
2855
3701
  tools?: UpsertAgentToolInput[];
2856
- 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;
2857
3724
  }
2858
3725
  declare class AgentsResource {
2859
3726
  private readonly http;
@@ -2862,13 +3729,13 @@ declare class AgentsResource {
2862
3729
  list(options?: ListQueryOptions): Promise<Agent[]>;
2863
3730
  /** Returns a single agent. */
2864
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>>;
2865
3734
  /**
2866
3735
  * Upsert an agent by slug inside the workspace on the API key.
2867
3736
  * Prefer the CLI (`npx @lunnoa/client agents deploy`) for happy-path deploy.
2868
3737
  */
2869
- upsertBySlug(body: UpsertAgentBySlugInput | AgentDefinition, options?: {
2870
- workflowIds?: string[];
2871
- }): Promise<Agent>;
3738
+ upsertBySlug(body: UpsertAgentBySlugInput | AgentDefinition | AgentFileDefinition, options?: AgentUpsertOptions): Promise<Agent & CodeDefinitionResponse<AgentFileDefinition>>;
2872
3739
  }
2873
3740
 
2874
3741
  /**
@@ -3555,6 +4422,13 @@ declare class VariablesResource {
3555
4422
  delete(variableId: string): Promise<boolean>;
3556
4423
  }
3557
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
+
3558
4432
  interface UpsertWorkflowStepInput {
3559
4433
  /** Name later steps use in `={{step:<key>,path}}`. Keeps the node id stable. */
3560
4434
  key?: string;
@@ -3564,6 +4438,21 @@ interface UpsertWorkflowStepInput {
3564
4438
  input?: Record<string, unknown>;
3565
4439
  name?: string;
3566
4440
  description?: string;
4441
+ retrySettings?: {
4442
+ enabled: boolean;
4443
+ maxAttempts: number;
4444
+ delaySeconds: number;
4445
+ };
4446
+ continueOnFailure?: {
4447
+ enabled: boolean;
4448
+ };
4449
+ /** Branches after this step (last step of a list only). */
4450
+ paths?: UpsertWorkflowPathInput[];
4451
+ }
4452
+ interface UpsertWorkflowPathInput {
4453
+ label: string;
4454
+ when?: WorkflowPathDefinition['when'];
4455
+ steps: UpsertWorkflowStepInput[];
3567
4456
  }
3568
4457
  interface UpsertWorkflowTriggerInput {
3569
4458
  triggerId: string;
@@ -3576,15 +4465,30 @@ interface UpsertWorkflowTriggerInput {
3576
4465
  name?: string;
3577
4466
  description?: string;
3578
4467
  }
4468
+ interface UpsertWorkflowGraphInput {
4469
+ nodes: WorkflowGraphFileDefinition['nodes'];
4470
+ edges: WorkflowGraphFileDefinition['edges'];
4471
+ }
3579
4472
  interface UpsertWorkflowBySlugInput {
3580
4473
  slug: string;
3581
4474
  name?: string;
3582
- description?: string;
4475
+ /** Null clears a description that was removed from the definition file. */
4476
+ description?: string | null;
3583
4477
  isActive?: boolean;
3584
4478
  /** Omit for Manually Run with no input fields. */
3585
4479
  trigger?: UpsertWorkflowTriggerInput;
3586
- steps: UpsertWorkflowStepInput[];
3587
- 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;
3588
4492
  }
3589
4493
  declare class WorkflowsResource {
3590
4494
  private readonly http;
@@ -3597,11 +4501,13 @@ declare class WorkflowsResource {
3597
4501
  * the manual trigger's custom input field definitions.
3598
4502
  */
3599
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>>;
3600
4506
  /**
3601
4507
  * Upsert a workflow by slug inside the workspace on the API key.
3602
4508
  * Prefer the CLI (`npx @lunnoa/client workflows deploy`) for happy-path deploy.
3603
4509
  */
3604
- upsertBySlug(body: UpsertWorkflowBySlugInput | WorkflowDefinition): Promise<Workflow>;
4510
+ upsertBySlug(body: UpsertWorkflowBySlugInput | WorkflowDefinition | WorkflowFileDefinition, options?: WorkflowUpsertOptions): Promise<Workflow & CodeDefinitionResponse<WorkflowFileDefinition>>;
3605
4511
  /**
3606
4512
  * Starts a new execution of the workflow with the given trigger inputs.
3607
4513
  * Returns immediately with the execution ID.
@@ -3669,6 +4575,8 @@ declare class LunnoaClient {
3669
4575
  readonly aiConnections: AiConnectionsResource;
3670
4576
  readonly workflowApps: WorkflowAppsResource;
3671
4577
  readonly discovery: DiscoveryResource;
4578
+ /** Workspace id for the definitions lock, and the code-sync lock flag. */
4579
+ readonly codeSync: CodeSyncResource;
3672
4580
  constructor(options: LunnoaClientOptions);
3673
4581
  }
3674
4582