omnara 1.0.28 → 1.0.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/bin.js +323 -72
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -16,10 +16,164 @@ import * as z4 from "zod";
16
16
 
17
17
  // ../sdk/src/generated/zod.gen.ts
18
18
  import * as z from "zod";
19
+ var zAgentConfigDefinitionEventWebhook = z.object({
20
+ events: z.array(z.enum([
21
+ "agent_input",
22
+ "model_output",
23
+ "tool_result",
24
+ "context_checkpoint",
25
+ "tool_call_update"
26
+ ])).min(1),
27
+ signing_secret_id: z.string().min(1).optional(),
28
+ url: z.string().min(1)
29
+ });
30
+ var zAgentConfigDefinitionGitCredentials = z.object({
31
+ integration: z.string().regex(/^[a-zA-Z][a-zA-Z0-9-]{0,31}$/)
32
+ });
33
+ var zAgentConfigDefinitionInteractionHandler = z.record(z.string(), z.never());
34
+ var zAgentConfigDefinitionInteractionHandlers = z.record(z.string(), zAgentConfigDefinitionInteractionHandler).nullable();
35
+ var zAgentConfigDefinitionMcpAuth = z.object({
36
+ region: z.string().min(1).optional(),
37
+ secret_id: z.string().min(1).regex(/^sec_[a-z2-7]{26}$/),
38
+ service: z.string().min(1).optional(),
39
+ type: z.enum([
40
+ "bearer",
41
+ "oauth",
42
+ "sigv4"
43
+ ])
44
+ });
45
+ var zAgentConfigDefinitionSkills = z.array(z.string().regex(/^skl_[a-z2-7]{26}$/)).nullable();
46
+ var zAgentConfigDefinitionSubagentInstruction = z.object({
47
+ append: z.string().optional()
48
+ });
49
+ var zAgentConfigDefinitionToolInputSchema = z.looseObject({
50
+ properties: z.record(z.string(), z.record(z.string(), z.unknown())).optional(),
51
+ required: z.array(z.string().min(1)).optional(),
52
+ type: z.literal("object")
53
+ });
54
+ var zAgentConfigDefinitionToolPermission = z.object({
55
+ mode: z.string().min(1).regex(/\S/),
56
+ parameters: z.record(z.string(), z.unknown()).optional()
57
+ });
58
+ var zAgentConfigDefinitionMcpTool = z.object({
59
+ deferred: z.boolean().nullish(),
60
+ enabled: z.boolean().nullish(),
61
+ permission: zAgentConfigDefinitionToolPermission.optional()
62
+ });
63
+ var zAgentConfigDefinitionMcpServer = z.object({
64
+ auth: zAgentConfigDefinitionMcpAuth.optional(),
65
+ default_enabled: z.boolean().nullish(),
66
+ deferred: z.boolean().optional(),
67
+ permission: zAgentConfigDefinitionToolPermission.optional(),
68
+ tools: z.record(z.string(), zAgentConfigDefinitionMcpTool).optional(),
69
+ url: z.string().min(1)
70
+ });
71
+ var zAgentConfigDefinitionMcpServers = z.record(z.string(), zAgentConfigDefinitionMcpServer).nullable();
72
+ var zAgentConfigDefinitionTool = z.object({
73
+ deferred: z.boolean().optional(),
74
+ description: z.string().min(1).optional(),
75
+ enabled: z.boolean().nullish(),
76
+ input_schema: zAgentConfigDefinitionToolInputSchema.optional(),
77
+ permission: zAgentConfigDefinitionToolPermission.optional(),
78
+ type: z.enum(["built_in", "custom"]).optional()
79
+ });
80
+ var zAgentConfigDefinitionTools = z.record(z.string(), zAgentConfigDefinitionTool).nullable();
81
+ var zEnvironmentVariableName = z.string().min(1).regex(/^[^=\x00]+$/);
82
+ var zResourceNameReference = z.string().min(1).max(64).regex(/^\S(?:.*\S)?$/);
83
+ var zAgentConfigDefinitionMachineSource = z.intersection(z.union([
84
+ z.record(z.string(), z.unknown()),
85
+ z.record(z.string(), z.unknown())
86
+ ]), z.object({
87
+ cwd: z.string().max(4096).optional(),
88
+ delete_after_idle_minutes: z.union([
89
+ z.literal(0),
90
+ z.int().gte(5).lte(2147483647)
91
+ ]).optional(),
92
+ description: z.string().max(4096).optional(),
93
+ env_overlay: z.record(z.string(), z.string().nullable()).nullish(),
94
+ initial_num_machines: z.int().gte(0).optional(),
95
+ machine_cpu: z.int().gte(1).lte(2147483647).optional(),
96
+ machine_memory_mb: z.int().gte(1).lte(2147483647).optional(),
97
+ machine_name: zResourceNameReference.optional(),
98
+ machine_pool_name: zResourceNameReference.optional(),
99
+ machine_provider_options_overlay: z.record(z.string(), z.unknown()).nullish(),
100
+ max_machines: z.int().gte(0).optional(),
101
+ secret_env_overlay: z.record(z.string(), z.string().regex(/^sec_[a-z2-7]{26}$/).nullable()).nullish()
102
+ }));
103
+ var zAgentConfigDefinitionMachineSources = z.array(zAgentConfigDefinitionMachineSource).nullable();
104
+ var zAgentConfigDefinitionModel = z.object({
105
+ cache_retention: z.enum([
106
+ "none",
107
+ "short",
108
+ "long"
109
+ ]).optional(),
110
+ context_window_tokens: z.int().gte(2).lte(2147483647).optional(),
111
+ default_max_output_tokens: z.int().gte(1).optional(),
112
+ name: zResourceNameReference,
113
+ provider_config: zResourceNameReference,
114
+ reasoning: z.object({
115
+ effort: z.string().min(1).regex(/\S/)
116
+ }).optional()
117
+ });
118
+ var zAgentConfigDefinitionSubagentModel = z.object({
119
+ cache_retention: z.enum([
120
+ "none",
121
+ "short",
122
+ "long"
123
+ ]).optional(),
124
+ context_window_tokens: z.int().gte(2).lte(2147483647).optional(),
125
+ default_max_output_tokens: z.int().gte(1).optional(),
126
+ name: zResourceNameReference.optional(),
127
+ provider_config: zResourceNameReference.optional(),
128
+ reasoning: z.object({
129
+ effort: z.string().min(1).regex(/\S/)
130
+ }).optional()
131
+ });
132
+ var zAgentConfigDefinitionSubagent = z.object({
133
+ archive_after_idle_minutes: z.int().gte(1).lte(2147483647).optional(),
134
+ description: z.string().optional(),
135
+ instruction: zAgentConfigDefinitionSubagentInstruction.optional(),
136
+ max_instances: z.int().gte(1).lte(2147483647).optional(),
137
+ model: zAgentConfigDefinitionSubagentModel.optional(),
138
+ profile: zResourceNameReference.optional(),
139
+ type: z.enum(["profile", "self"])
140
+ });
141
+ var zAgentConfigDefinitionSubagents = z.record(z.string(), zAgentConfigDefinitionSubagent).nullable();
19
142
  var zResourceName = z.string().min(1).refine((value) => Array.from(value).length <= 64, { message: "Resource name cannot exceed 64 Unicode characters" }).transform((value) => value.normalize("NFC")).refine((value) => Array.from(value).length <= 64, { message: "Resource name cannot exceed 64 Unicode characters" }).refine((value) => !new RegExp("^\\p{White_Space}|\\p{White_Space}$", "u").test(value), { message: "Resource name must not start or end with whitespace" }).refine((value) => !/[\p{Cc}\p{Cf}\p{Cs}\p{Default_Ignorable_Code_Point}⠀]/u.test(value), { message: "Resource name contains an unsupported invisible, control, or format character" }).refine((value) => !value.includes("\uFFFD"), { message: "Resource name contains the Unicode replacement character" }).refine((value) => !Array.from(value).some((character) => character !== " " && new RegExp("\\p{White_Space}", "u").test(character)), { message: "Resource name may only use ordinary spaces" });
20
143
  var zAgentName = z.string().refine((value) => Array.from(value).length <= 64, { message: "Resource name cannot exceed 64 Unicode characters" }).transform((value) => value.normalize("NFC")).refine((value) => Array.from(value).length <= 64, { message: "Resource name cannot exceed 64 Unicode characters" }).refine((value) => !new RegExp("^\\p{White_Space}|\\p{White_Space}$", "u").test(value), { message: "Resource name must not start or end with whitespace" }).refine((value) => !/[\p{Cc}\p{Cf}\p{Cs}\p{Default_Ignorable_Code_Point}⠀]/u.test(value), { message: "Resource name contains an unsupported invisible, control, or format character" }).refine((value) => !value.includes("\uFFFD"), { message: "Resource name contains the Unicode replacement character" }).refine((value) => !Array.from(value).some((character) => character !== " " && new RegExp("\\p{White_Space}", "u").test(character)), { message: "Resource name may only use ordinary spaces" });
21
144
  var zSkillName = z.string().min(1).max(64).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/);
22
145
  var zMemoryStoreName = z.string().min(1).max(64).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/);
146
+ var zAgentConfigDefinitionMemoryStore = z.object({
147
+ name: zMemoryStoreName,
148
+ access: z.enum(["read", "read_write"])
149
+ });
150
+ var zAgentConfigDefinitionMemoryStores = z.array(zAgentConfigDefinitionMemoryStore).nullable();
151
+ var zAgentConfigDefinition = z.object({
152
+ event_webhook: zAgentConfigDefinitionEventWebhook.optional(),
153
+ git_credentials: zAgentConfigDefinitionGitCredentials.optional(),
154
+ instruction: z.string().min(1).regex(/\S/),
155
+ interaction_handlers: zAgentConfigDefinitionInteractionHandlers.optional(),
156
+ machine_sources: zAgentConfigDefinitionMachineSources.optional(),
157
+ max_depth: z.int().gte(1).lte(8).optional(),
158
+ max_subagents: z.int().gte(1).lte(2147483647).optional(),
159
+ mcp: zAgentConfigDefinitionMcpServers.optional(),
160
+ memory_stores: zAgentConfigDefinitionMemoryStores.optional(),
161
+ model: zAgentConfigDefinitionModel,
162
+ skills: zAgentConfigDefinitionSkills.optional(),
163
+ subagents: zAgentConfigDefinitionSubagents.optional(),
164
+ tools: zAgentConfigDefinitionTools.optional(),
165
+ version: z.enum(["v1"]).optional()
166
+ });
167
+ var zAgentConfigToolsDefinition = z.looseObject({
168
+ git_credentials: zAgentConfigDefinitionGitCredentials.optional(),
169
+ interaction_handlers: zAgentConfigDefinitionInteractionHandlers.optional(),
170
+ machine_sources: zAgentConfigDefinitionMachineSources.optional(),
171
+ mcp: zAgentConfigDefinitionMcpServers.optional(),
172
+ memory_stores: zAgentConfigDefinitionMemoryStores.optional(),
173
+ skills: zAgentConfigDefinitionSkills.optional(),
174
+ subagents: zAgentConfigDefinitionSubagents.optional(),
175
+ tools: zAgentConfigDefinitionTools.optional()
176
+ });
23
177
  var zResourceListSort = z.enum([
24
178
  "name",
25
179
  "-name",
@@ -65,6 +219,7 @@ var zErrorCode = z.enum([
65
219
  "internal_error",
66
220
  "service_unavailable",
67
221
  "idempotency_key_conflict",
222
+ "agent_backlog_full",
68
223
  "state_transition_conflict",
69
224
  "managed_work_admission_denied",
70
225
  "pending_work",
@@ -190,7 +345,7 @@ var zCreateProjectModelGrantRequest = z.object({
190
345
  output_modalities: z.array(z.string()).optional()
191
346
  });
192
347
  var zUpdateProjectModelGrantRequest = z.object({
193
- context_window_tokens: z.int().gte(1).nullish(),
348
+ context_window_tokens: z.int().gte(2).lte(2147483647).nullish(),
194
349
  max_output_tokens: z.int().gte(1).nullish(),
195
350
  default_max_output_tokens: z.int().gte(1).nullish(),
196
351
  default_cache_retention: zModelCacheRetention.nullish(),
@@ -555,15 +710,22 @@ var zCreateSlackSetupRequest = z.object({
555
710
  return_to: z.string().optional()
556
711
  });
557
712
  var zResolveAgentConfigToolsRequest = z.object({
558
- source: z.string().min(1),
713
+ source: z.union([
714
+ z.string().min(1),
715
+ zAgentConfigToolsDefinition
716
+ ]),
559
717
  source_format: z.enum(["yaml", "json"])
560
718
  });
719
+ var zAgentConfigSourceInput = z.union([
720
+ z.string().min(1),
721
+ zAgentConfigDefinition
722
+ ]);
561
723
  var zCreateAgentConfigRequest = z.object({
562
- source: z.string().min(1),
724
+ source: zAgentConfigSourceInput,
563
725
  source_format: z.enum(["yaml", "json"])
564
726
  });
565
727
  var zUpdateAgentConfigRequest = z.object({
566
- source: z.string().min(1),
728
+ source: zAgentConfigSourceInput,
567
729
  source_format: z.enum(["yaml", "json"]),
568
730
  expected_current_config_id: zAgentConfigId.optional()
569
731
  });
@@ -829,6 +991,9 @@ var zAgentConfigSummary = z.object({
829
991
  instruction_hash: z.string().optional(),
830
992
  created_at: zTimestamp
831
993
  });
994
+ var zAgentConfigGeneratedSource = z.object({
995
+ source: z.string()
996
+ });
832
997
  var zCreateAgentProfileRequest = z.object({
833
998
  name: zResourceName,
834
999
  config: zAgentConfigId
@@ -1681,6 +1846,17 @@ var zArtifact = z.object({
1681
1846
  size_bytes: z.coerce.bigint().min(BigInt("-9223372036854775808"), { error: "Invalid value: Expected int64 to be >= -9223372036854775808" }).max(BigInt("9223372036854775807"), { error: "Invalid value: Expected int64 to be <= 9223372036854775807" }).optional(),
1682
1847
  created_at: zTimestamp
1683
1848
  });
1849
+ var zCheckMachinePoolConnectionRequest = z.object({
1850
+ provider: z.string().min(1),
1851
+ provider_auth_secret_id: zSecretId,
1852
+ provider_config: z.record(z.string(), z.unknown()).optional(),
1853
+ default_machine_provider_options: z.record(z.string(), z.unknown()).optional()
1854
+ });
1855
+ var zMachinePoolConnectionCheckError = z.object({
1856
+ error: z.string(),
1857
+ code: z.enum(["unprocessable", "upstream_unavailable"]),
1858
+ details: z.string().optional()
1859
+ });
1684
1860
  var zCreateMachinePoolRequestBase = z.object({
1685
1861
  name: zResourceName,
1686
1862
  description: z.string().optional(),
@@ -1707,11 +1883,11 @@ var zCreateMachinePoolRequestBase = z.object({
1707
1883
  var zCreateMachinePoolRequest = zCreateMachinePoolRequestBase.and(z.union([
1708
1884
  z.object({
1709
1885
  provider: z.enum([
1710
- "unikraft",
1711
- "modal",
1886
+ "arker",
1712
1887
  "freestyle",
1888
+ "modal",
1713
1889
  "tenki",
1714
- "arker"
1890
+ "unikraft"
1715
1891
  ]),
1716
1892
  default_machine_cpu: z.int().min(-2147483648, { error: "Invalid value: Expected int32 to be >= -2147483648" }).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
1717
1893
  default_machine_memory_mb: z.int().min(-2147483648, { error: "Invalid value: Expected int32 to be >= -2147483648" }).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
@@ -1722,9 +1898,9 @@ var zCreateMachinePoolRequest = zCreateMachinePoolRequestBase.and(z.union([
1722
1898
  }),
1723
1899
  z.object({
1724
1900
  provider: z.enum([
1725
- "daytona",
1726
1901
  "boxd",
1727
- "createos"
1902
+ "createos",
1903
+ "daytona"
1728
1904
  ]),
1729
1905
  max_total_cpu: z.int().min(-2147483648, { error: "Invalid value: Expected int32 to be >= -2147483648" }).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
1730
1906
  max_total_memory_mb: z.int().min(-2147483648, { error: "Invalid value: Expected int32 to be >= -2147483648" }).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
@@ -2423,24 +2599,6 @@ var zIntegrationRuntimeFailure = z.object({
2423
2599
  message: z.string(),
2424
2600
  retry_at: zTimestamp
2425
2601
  });
2426
- var zConfigAgentToolInputSchema = z.object({
2427
- properties: z.record(z.string(), z.record(z.string(), z.unknown())).optional(),
2428
- required: z.array(z.string().min(1)).optional(),
2429
- type: z.literal("object")
2430
- });
2431
- var zConfigIntegrationCapabilitySource = z.record(z.string(), z.never());
2432
- var zConfigToolPermissionSelection = z.object({
2433
- mode: z.string().min(1).regex(/\S/),
2434
- parameters: z.record(z.string(), z.unknown()).optional()
2435
- });
2436
- var zConfigToolSource = z.object({
2437
- deferred: z.boolean().optional(),
2438
- description: z.string().min(1).optional(),
2439
- enabled: z.boolean().nullish(),
2440
- input_schema: zConfigAgentToolInputSchema.optional(),
2441
- permission: zConfigToolPermissionSelection.optional(),
2442
- type: z.enum(["built_in", "custom"]).optional()
2443
- });
2444
2602
  var zIntegrationName = z.string().regex(/^[a-zA-Z][a-zA-Z0-9-]{0,31}$/);
2445
2603
  var zCompiledGitCredentials = z.object({
2446
2604
  integration: zIntegrationName,
@@ -2593,16 +2751,27 @@ var zIntegrationSubscriptionAttachment = z.object({
2593
2751
  integration_id: zIntegrationId,
2594
2752
  conversation: zIntegrationConversation
2595
2753
  });
2596
- var zCreateAgentRequest = z.object({
2754
+ var zCreateAgentRequest = z.intersection(z.union([
2755
+ z.object({
2756
+ profile: zAgentProfileId
2757
+ }),
2758
+ z.object({
2759
+ config: zAgentConfigId
2760
+ }),
2761
+ z.object({
2762
+ config_source: zCreateAgentConfigRequest
2763
+ })
2764
+ ]), z.object({
2597
2765
  profile: zAgentProfileId.optional(),
2598
- config: zAgentConfigId,
2766
+ config: zAgentConfigId.optional(),
2767
+ config_source: zCreateAgentConfigRequest.optional(),
2599
2768
  name: zAgentName.optional(),
2600
2769
  message: z.string().optional(),
2601
- tools: z.record(z.string(), zConfigToolSource).optional(),
2770
+ tools: z.record(z.string(), zAgentConfigDefinitionTool).optional(),
2602
2771
  subscriptions: z.array(zIntegrationSubscriptionAttachment).max(100).optional(),
2603
- interaction_handlers: z.record(z.string(), zConfigIntegrationCapabilitySource).optional(),
2772
+ interaction_handlers: z.record(z.string(), zAgentConfigDefinitionInteractionHandler).optional(),
2604
2773
  initial_input: zAgentLaunchInitialInput.optional()
2605
- });
2774
+ }));
2606
2775
  var zCreateIntegrationSubscriptionRequest = z.object({
2607
2776
  agent_id: zAgentId,
2608
2777
  conversation: zIntegrationConversation
@@ -3187,6 +3356,15 @@ var zGetAgentConfigPath = z.object({
3187
3356
  agentConfigID: z.string().regex(/^acfg_[a-z2-7]{26}$/)
3188
3357
  });
3189
3358
  var zGetAgentConfigResponse = zAgentConfig;
3359
+ var zGetAgentConfigGeneratedSourcePath = z.object({
3360
+ orgID: z.string().regex(/^org_[a-z2-7]{26}$/),
3361
+ projectID: z.string().regex(/^proj_[a-z2-7]{26}$/),
3362
+ agentConfigID: z.string().regex(/^acfg_[a-z2-7]{26}$/)
3363
+ });
3364
+ var zGetAgentConfigGeneratedSourceQuery = z.object({
3365
+ source_format: z.enum(["yaml", "json"]).optional().default("yaml")
3366
+ });
3367
+ var zGetAgentConfigGeneratedSourceResponse = zAgentConfigGeneratedSource;
3190
3368
  var zListAgentProfilesPath = z.object({
3191
3369
  orgID: z.string().regex(/^org_[a-z2-7]{26}$/),
3192
3370
  projectID: z.string().regex(/^proj_[a-z2-7]{26}$/)
@@ -3762,6 +3940,10 @@ var zCreateMachinePoolPath = z.object({
3762
3940
  orgID: z.string().regex(/^org_[a-z2-7]{26}$/)
3763
3941
  });
3764
3942
  var zCreateMachinePoolResponse = zMachinePool;
3943
+ var zCheckMachinePoolConnectionPath = z.object({
3944
+ orgID: z.string().regex(/^org_[a-z2-7]{26}$/)
3945
+ });
3946
+ var zCheckMachinePoolConnectionResponse = z.void();
3765
3947
  var zDeleteMachinePoolPath = z.object({
3766
3948
  orgID: z.string().regex(/^org_[a-z2-7]{26}$/),
3767
3949
  poolID: z.string().regex(/^mpo_[a-z2-7]{26}$/)
@@ -5375,6 +5557,7 @@ __export(sdk_gen_exports, {
5375
5557
  bootstrapDaemon: () => bootstrapDaemon,
5376
5558
  cancelAgent: () => cancelAgent,
5377
5559
  cancelQueuedBacklogInput: () => cancelQueuedBacklogInput,
5560
+ checkMachinePoolConnection: () => checkMachinePoolConnection,
5378
5561
  configureIntegration: () => configureIntegration,
5379
5562
  connectByoMachine: () => connectByoMachine,
5380
5563
  createAgent: () => createAgent,
@@ -5436,6 +5619,7 @@ __export(sdk_gen_exports, {
5436
5619
  getActor: () => getActor,
5437
5620
  getAgent: () => getAgent,
5438
5621
  getAgentConfig: () => getAgentConfig,
5622
+ getAgentConfigGeneratedSource: () => getAgentConfigGeneratedSource,
5439
5623
  getAgentProfile: () => getAgentProfile,
5440
5624
  getAgentProfileUsage: () => getAgentProfileUsage,
5441
5625
  getAgentUsage: () => getAgentUsage,
@@ -6786,6 +6970,20 @@ var getAgentConfig = (options) => (options.client ?? client).get({
6786
6970
  url: "/orgs/{orgID}/projects/{projectID}/agent-configs/{agentConfigID}",
6787
6971
  ...options
6788
6972
  });
6973
+ var getAgentConfigGeneratedSource = (options) => (options.client ?? client).get({
6974
+ responseValidator: relaxedResponseValidator(zGetAgentConfigGeneratedSourceResponse),
6975
+ security: [{
6976
+ key: "bearerAuth",
6977
+ scheme: "bearer",
6978
+ type: "http"
6979
+ }, {
6980
+ in: "cookie",
6981
+ name: "__Host-omnara_session",
6982
+ type: "apiKey"
6983
+ }],
6984
+ url: "/orgs/{orgID}/projects/{projectID}/agent-configs/{agentConfigID}/generated-source",
6985
+ ...options
6986
+ });
6789
6987
  var listAgentProfiles = (options) => (options.client ?? client).get({
6790
6988
  responseValidator: relaxedResponseValidator(zListAgentProfilesResponse2),
6791
6989
  security: [{
@@ -8022,6 +8220,28 @@ var createMachinePool = (options) => (options.client ?? client).post({
8022
8220
  ...options.headers
8023
8221
  }
8024
8222
  });
8223
+ var checkMachinePoolConnection = (options) => (options.client ?? client).post({
8224
+ responseValidator: relaxedResponseValidator(zCheckMachinePoolConnectionResponse),
8225
+ security: [
8226
+ {
8227
+ key: "bearerAuth",
8228
+ scheme: "bearer",
8229
+ type: "http"
8230
+ },
8231
+ {
8232
+ in: "cookie",
8233
+ name: "__Host-omnara_session",
8234
+ type: "apiKey"
8235
+ },
8236
+ { name: "X-Omnara-Csrf", type: "apiKey" }
8237
+ ],
8238
+ url: "/orgs/{orgID}/machine-pools/check-connection",
8239
+ ...options,
8240
+ headers: {
8241
+ "Content-Type": "application/json",
8242
+ ...options.headers
8243
+ }
8244
+ });
8025
8245
  var deleteMachinePool = (options) => (options.client ?? client).delete({
8026
8246
  responseValidator: relaxedResponseValidator(zDeleteMachinePoolResponse),
8027
8247
  security: [
@@ -11846,13 +12066,24 @@ function fileFormat(filePath) {
11846
12066
  if (lower.endsWith(".yaml") || lower.endsWith(".yml")) return "yaml";
11847
12067
  throw new CliInputError(`config file must end in .yaml, .yml, or .json: ${filePath}`);
11848
12068
  }
11849
- function inlineFormat(source) {
11850
- try {
11851
- JSON.parse(source);
11852
- return "json";
11853
- } catch {
11854
- return "yaml";
12069
+ var zDefinitionText = zJsonText.pipe(
12070
+ z20.custom(
12071
+ (value) => z20.record(z20.string(), z20.unknown()).safeParse(value).success,
12072
+ "expected a JSON object"
12073
+ )
12074
+ );
12075
+ function jsonSource(text, label) {
12076
+ const parsed = zDefinitionText.safeParse(text);
12077
+ if (!parsed.success) {
12078
+ throw new CliInputError(
12079
+ `${label} is not a valid JSON agent config: ${parsed.error.issues[0]?.message}`
12080
+ );
11855
12081
  }
12082
+ return { source: text, source_format: "json" };
12083
+ }
12084
+ function inlineSource(source) {
12085
+ if (!zJsonText.safeParse(source).success) return { source, source_format: "yaml" };
12086
+ return jsonSource(source, "inline config source");
11856
12087
  }
11857
12088
  function renderConfigSource(attachment) {
11858
12089
  requireExactlyOne([attachment.file, attachment.source], SOURCE_HINT);
@@ -11864,11 +12095,10 @@ function renderConfigSource(attachment) {
11864
12095
  } catch {
11865
12096
  throw new CliInputError(`could not read config file: ${attachment.file}`);
11866
12097
  }
11867
- return { source, source_format: format };
11868
- }
11869
- if (attachment.source !== void 0) {
11870
- return { source: attachment.source, source_format: inlineFormat(attachment.source) };
12098
+ if (format === "yaml") return { source, source_format: "yaml" };
12099
+ return jsonSource(source, `config file ${attachment.file}`);
11871
12100
  }
12101
+ if (attachment.source !== void 0) return inlineSource(attachment.source);
11872
12102
  throw new CliInputError(SOURCE_HINT);
11873
12103
  }
11874
12104
  async function resolveConfigId(client2, path, attachment) {
@@ -11881,6 +12111,18 @@ async function resolveConfigId(client2, path, attachment) {
11881
12111
  });
11882
12112
  return data.id;
11883
12113
  }
12114
+ var LAUNCH_HINT = "pass --profile or one of --config, --file, or --source";
12115
+ var LAUNCH_CONFIG_HINT = "pass at most one of --config, --file, or --source";
12116
+ function renderLaunchConfig(profile, attachment) {
12117
+ const provided = [attachment.config, attachment.file, attachment.source].filter(
12118
+ (value) => value !== void 0
12119
+ );
12120
+ if (provided.length > 1) throw new CliInputError(LAUNCH_CONFIG_HINT);
12121
+ if (attachment.config !== void 0) return { profile, config: attachment.config };
12122
+ if (provided.length === 1) return { profile, config_source: renderConfigSource(attachment) };
12123
+ if (profile === void 0) throw new CliInputError(LAUNCH_HINT);
12124
+ return { profile };
12125
+ }
11884
12126
  async function currentProfileConfigId(client2, path) {
11885
12127
  const { data } = await sdk_gen_exports.getAgentProfile({ client: client2, path });
11886
12128
  return data.current_config_id;
@@ -12536,32 +12778,34 @@ function serverEntry(url4, secretId) {
12536
12778
  return { url: url4, auth: { type: "oauth", secret_id: secretId } };
12537
12779
  }
12538
12780
  var zJsonRecord = z25.record(z25.string(), z25.json());
12539
- function prepareJsonConfig(config2, serverName, mcpUrl) {
12540
- const json8 = zJsonText.safeParse(config2.source ?? "");
12541
- if (!json8.success) throw new CliInputError("the current agent config contains invalid JSON");
12542
- const parsed = zJsonRecord.safeParse(json8.data);
12543
- if (!parsed.success) throw new CliInputError("the current agent config must be an object");
12544
- const mcp = zJsonRecord.optional().safeParse(parsed.data.mcp);
12545
- if (!mcp.success) {
12781
+ var zDefinitionText2 = zJsonText.pipe(
12782
+ z25.custom((value) => zJsonRecord.safeParse(value).success)
12783
+ );
12784
+ function prepareJsonConfig(configId, source, serverName, mcpUrl) {
12785
+ const parsed = zDefinitionText2.safeParse(source);
12786
+ if (!parsed.success) throw new CliInputError("the current agent config is not a JSON object");
12787
+ const definition = parsed.data;
12788
+ if (!zJsonRecord.nullish().safeParse(definition.mcp).success) {
12546
12789
  throw new CliInputError("the current agent config has an invalid mcp section");
12547
12790
  }
12548
- if (mcp.data !== void 0 && Object.hasOwn(mcp.data, serverName)) {
12791
+ if (definition.mcp != null && Object.hasOwn(definition.mcp, serverName)) {
12549
12792
  throw new CliInputError(`MCP server ${serverName} already exists in the current config`);
12550
12793
  }
12551
12794
  return {
12552
- currentConfigId: config2.id,
12795
+ currentConfigId: configId,
12553
12796
  render(secretId) {
12554
- const updated = {
12555
- ...parsed.data,
12556
- mcp: { ...mcp.data, [serverName]: serverEntry(mcpUrl, secretId) }
12797
+ return {
12798
+ source: {
12799
+ ...definition,
12800
+ mcp: { ...definition.mcp, [serverName]: serverEntry(mcpUrl, secretId) }
12801
+ },
12802
+ source_format: "json"
12557
12803
  };
12558
- return { source: `${JSON.stringify(updated, null, 2)}
12559
- `, sourceFormat: "json" };
12560
12804
  }
12561
12805
  };
12562
12806
  }
12563
- function prepareYamlConfig(config2, serverName, mcpUrl) {
12564
- const doc = parseDocument(config2.source ?? "");
12807
+ function prepareYamlConfig(configId, source, serverName, mcpUrl) {
12808
+ const doc = parseDocument(source);
12565
12809
  if (doc.errors.length > 0) {
12566
12810
  throw new CliInputError("the current agent config contains invalid YAML");
12567
12811
  }
@@ -12577,14 +12821,14 @@ function prepareYamlConfig(config2, serverName, mcpUrl) {
12577
12821
  throw new CliInputError(`MCP server ${serverName} already exists in the current config`);
12578
12822
  }
12579
12823
  return {
12580
- currentConfigId: config2.id,
12824
+ currentConfigId: configId,
12581
12825
  render(secretId) {
12582
12826
  if (isMap(mcp)) {
12583
12827
  doc.setIn(["mcp", serverName], serverEntry(mcpUrl, secretId));
12584
12828
  } else {
12585
12829
  doc.set("mcp", { [serverName]: serverEntry(mcpUrl, secretId) });
12586
12830
  }
12587
- return { source: doc.toString(), sourceFormat: "yaml" };
12831
+ return { source: doc.toString(), source_format: "yaml" };
12588
12832
  }
12589
12833
  };
12590
12834
  }
@@ -12592,7 +12836,7 @@ function prepareConfig(config2, serverName, mcpUrl) {
12592
12836
  if (config2.source === void 0 || config2.source_format === void 0) {
12593
12837
  throw new CliInputError("the current agent config source is unavailable");
12594
12838
  }
12595
- return config2.source_format === "json" ? prepareJsonConfig(config2, serverName, mcpUrl) : prepareYamlConfig(config2, serverName, mcpUrl);
12839
+ return config2.source_format === "json" ? prepareJsonConfig(config2.id, config2.source, serverName, mcpUrl) : prepareYamlConfig(config2.id, config2.source, serverName, mcpUrl);
12596
12840
  }
12597
12841
  async function loadConfig2(client2, scope, target, targetId) {
12598
12842
  const path = { orgID: scope.orgId, projectID: scope.projectId };
@@ -12609,6 +12853,14 @@ async function loadConfig2(client2, scope, target, targetId) {
12609
12853
  if (configId === void 0) throw new CliInputError("the agent has no current config");
12610
12854
  return (await sdk_gen_exports.getAgentConfig({ client: client2, path: { ...path, agentConfigID: configId } })).data;
12611
12855
  }
12856
+ async function withEditableSource(client2, scope, config2) {
12857
+ if (config2.source !== void 0) return config2;
12858
+ const { data } = await sdk_gen_exports.getAgentConfigGeneratedSource({
12859
+ client: client2,
12860
+ path: { orgID: scope.orgId, projectID: scope.projectId, agentConfigID: config2.id }
12861
+ });
12862
+ return { ...config2, source: data.source, source_format: "yaml" };
12863
+ }
12612
12864
  async function applyConfig(client2, scope, target, targetId, prepared, secret, report) {
12613
12865
  const rendered = prepared.render(secret.id);
12614
12866
  const path = { orgID: scope.orgId, projectID: scope.projectId };
@@ -12616,18 +12868,14 @@ async function applyConfig(client2, scope, target, targetId, prepared, secret, r
12616
12868
  const { data } = await sdk_gen_exports.updateAgentConfig({
12617
12869
  client: client2,
12618
12870
  path: { ...path, agentID: targetId },
12619
- body: {
12620
- source: rendered.source,
12621
- source_format: rendered.sourceFormat,
12622
- expected_current_config_id: prepared.currentConfigId
12623
- }
12871
+ body: { ...rendered, expected_current_config_id: prepared.currentConfigId }
12624
12872
  });
12625
12873
  return data.agent_config.id;
12626
12874
  }
12627
12875
  const { data: config2 } = await sdk_gen_exports.createAgentConfig({
12628
12876
  client: client2,
12629
12877
  path,
12630
- body: { source: rendered.source, source_format: rendered.sourceFormat }
12878
+ body: rendered
12631
12879
  });
12632
12880
  try {
12633
12881
  await sdk_gen_exports.updateAgentProfile({
@@ -12653,7 +12901,11 @@ async function runMcpAdd(context, target, targetId) {
12653
12901
  owner: { kind: "project", project_id: scope.projectId },
12654
12902
  name: secret_name ?? `${server_name}-mcp`
12655
12903
  };
12656
- const currentConfig = await loadConfig2(client2, scope, target, targetId);
12904
+ const currentConfig = await withEditableSource(
12905
+ client2,
12906
+ scope,
12907
+ await loadConfig2(client2, scope, target, targetId)
12908
+ );
12657
12909
  const prepared = prepareConfig(currentConfig, server_name, request.mcp_url);
12658
12910
  let secret;
12659
12911
  try {
@@ -12826,15 +13078,14 @@ var commandGroups = [
12826
13078
  format: formatRecord(),
12827
13079
  path: zCreateAgentPath,
12828
13080
  body: zConfigAttachment.extend({
12829
- profile: zAgentProfileId.optional(),
13081
+ profile: zAgentProfileId.optional().describe("agent profile ID; runs its current config unless a config is given"),
12830
13082
  name: zAgentName.optional(),
12831
13083
  message: z28.string().optional()
12832
13084
  }),
12833
- transformBody: async ({ profile, name, message, ...attachment }, { client: client2, path }) => ({
12834
- profile,
13085
+ transformBody: ({ profile, name, message, ...attachment }) => ({
12835
13086
  name,
12836
13087
  message,
12837
- config: await resolveConfigId(client2, path, attachment)
13088
+ ...renderLaunchConfig(profile, attachment)
12838
13089
  })
12839
13090
  }),
12840
13091
  op({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnara",
3
- "version": "1.0.28",
3
+ "version": "1.0.30",
4
4
  "description": "Command-line interface for Omnara: launch and manage agents, organizations, integrations, and MCP servers",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://omnara.com",