omnara 1.0.28 → 1.0.29

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 +321 -71
  2. package/package.json +3 -3
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(1).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(1).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",
@@ -555,15 +709,22 @@ var zCreateSlackSetupRequest = z.object({
555
709
  return_to: z.string().optional()
556
710
  });
557
711
  var zResolveAgentConfigToolsRequest = z.object({
558
- source: z.string().min(1),
712
+ source: z.union([
713
+ z.string().min(1),
714
+ zAgentConfigToolsDefinition
715
+ ]),
559
716
  source_format: z.enum(["yaml", "json"])
560
717
  });
718
+ var zAgentConfigSourceInput = z.union([
719
+ z.string().min(1),
720
+ zAgentConfigDefinition
721
+ ]);
561
722
  var zCreateAgentConfigRequest = z.object({
562
- source: z.string().min(1),
723
+ source: zAgentConfigSourceInput,
563
724
  source_format: z.enum(["yaml", "json"])
564
725
  });
565
726
  var zUpdateAgentConfigRequest = z.object({
566
- source: z.string().min(1),
727
+ source: zAgentConfigSourceInput,
567
728
  source_format: z.enum(["yaml", "json"]),
568
729
  expected_current_config_id: zAgentConfigId.optional()
569
730
  });
@@ -829,6 +990,9 @@ var zAgentConfigSummary = z.object({
829
990
  instruction_hash: z.string().optional(),
830
991
  created_at: zTimestamp
831
992
  });
993
+ var zAgentConfigGeneratedSource = z.object({
994
+ source: z.string()
995
+ });
832
996
  var zCreateAgentProfileRequest = z.object({
833
997
  name: zResourceName,
834
998
  config: zAgentConfigId
@@ -1681,6 +1845,17 @@ var zArtifact = z.object({
1681
1845
  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
1846
  created_at: zTimestamp
1683
1847
  });
1848
+ var zCheckMachinePoolConnectionRequest = z.object({
1849
+ provider: z.string().min(1),
1850
+ provider_auth_secret_id: zSecretId,
1851
+ provider_config: z.record(z.string(), z.unknown()).optional(),
1852
+ default_machine_provider_options: z.record(z.string(), z.unknown()).optional()
1853
+ });
1854
+ var zMachinePoolConnectionCheckError = z.object({
1855
+ error: z.string(),
1856
+ code: z.enum(["unprocessable", "upstream_unavailable"]),
1857
+ details: z.string().optional()
1858
+ });
1684
1859
  var zCreateMachinePoolRequestBase = z.object({
1685
1860
  name: zResourceName,
1686
1861
  description: z.string().optional(),
@@ -1707,11 +1882,11 @@ var zCreateMachinePoolRequestBase = z.object({
1707
1882
  var zCreateMachinePoolRequest = zCreateMachinePoolRequestBase.and(z.union([
1708
1883
  z.object({
1709
1884
  provider: z.enum([
1710
- "unikraft",
1711
- "modal",
1885
+ "arker",
1712
1886
  "freestyle",
1887
+ "modal",
1713
1888
  "tenki",
1714
- "arker"
1889
+ "unikraft"
1715
1890
  ]),
1716
1891
  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
1892
  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 +1897,9 @@ var zCreateMachinePoolRequest = zCreateMachinePoolRequestBase.and(z.union([
1722
1897
  }),
1723
1898
  z.object({
1724
1899
  provider: z.enum([
1725
- "daytona",
1726
1900
  "boxd",
1727
- "createos"
1901
+ "createos",
1902
+ "daytona"
1728
1903
  ]),
1729
1904
  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
1905
  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 +2598,6 @@ var zIntegrationRuntimeFailure = z.object({
2423
2598
  message: z.string(),
2424
2599
  retry_at: zTimestamp
2425
2600
  });
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
2601
  var zIntegrationName = z.string().regex(/^[a-zA-Z][a-zA-Z0-9-]{0,31}$/);
2445
2602
  var zCompiledGitCredentials = z.object({
2446
2603
  integration: zIntegrationName,
@@ -2593,16 +2750,27 @@ var zIntegrationSubscriptionAttachment = z.object({
2593
2750
  integration_id: zIntegrationId,
2594
2751
  conversation: zIntegrationConversation
2595
2752
  });
2596
- var zCreateAgentRequest = z.object({
2753
+ var zCreateAgentRequest = z.intersection(z.union([
2754
+ z.object({
2755
+ profile: zAgentProfileId
2756
+ }),
2757
+ z.object({
2758
+ config: zAgentConfigId
2759
+ }),
2760
+ z.object({
2761
+ config_source: zCreateAgentConfigRequest
2762
+ })
2763
+ ]), z.object({
2597
2764
  profile: zAgentProfileId.optional(),
2598
- config: zAgentConfigId,
2765
+ config: zAgentConfigId.optional(),
2766
+ config_source: zCreateAgentConfigRequest.optional(),
2599
2767
  name: zAgentName.optional(),
2600
2768
  message: z.string().optional(),
2601
- tools: z.record(z.string(), zConfigToolSource).optional(),
2769
+ tools: z.record(z.string(), zAgentConfigDefinitionTool).optional(),
2602
2770
  subscriptions: z.array(zIntegrationSubscriptionAttachment).max(100).optional(),
2603
- interaction_handlers: z.record(z.string(), zConfigIntegrationCapabilitySource).optional(),
2771
+ interaction_handlers: z.record(z.string(), zAgentConfigDefinitionInteractionHandler).optional(),
2604
2772
  initial_input: zAgentLaunchInitialInput.optional()
2605
- });
2773
+ }));
2606
2774
  var zCreateIntegrationSubscriptionRequest = z.object({
2607
2775
  agent_id: zAgentId,
2608
2776
  conversation: zIntegrationConversation
@@ -3187,6 +3355,15 @@ var zGetAgentConfigPath = z.object({
3187
3355
  agentConfigID: z.string().regex(/^acfg_[a-z2-7]{26}$/)
3188
3356
  });
3189
3357
  var zGetAgentConfigResponse = zAgentConfig;
3358
+ var zGetAgentConfigGeneratedSourcePath = z.object({
3359
+ orgID: z.string().regex(/^org_[a-z2-7]{26}$/),
3360
+ projectID: z.string().regex(/^proj_[a-z2-7]{26}$/),
3361
+ agentConfigID: z.string().regex(/^acfg_[a-z2-7]{26}$/)
3362
+ });
3363
+ var zGetAgentConfigGeneratedSourceQuery = z.object({
3364
+ source_format: z.enum(["yaml", "json"]).optional().default("yaml")
3365
+ });
3366
+ var zGetAgentConfigGeneratedSourceResponse = zAgentConfigGeneratedSource;
3190
3367
  var zListAgentProfilesPath = z.object({
3191
3368
  orgID: z.string().regex(/^org_[a-z2-7]{26}$/),
3192
3369
  projectID: z.string().regex(/^proj_[a-z2-7]{26}$/)
@@ -3762,6 +3939,10 @@ var zCreateMachinePoolPath = z.object({
3762
3939
  orgID: z.string().regex(/^org_[a-z2-7]{26}$/)
3763
3940
  });
3764
3941
  var zCreateMachinePoolResponse = zMachinePool;
3942
+ var zCheckMachinePoolConnectionPath = z.object({
3943
+ orgID: z.string().regex(/^org_[a-z2-7]{26}$/)
3944
+ });
3945
+ var zCheckMachinePoolConnectionResponse = z.void();
3765
3946
  var zDeleteMachinePoolPath = z.object({
3766
3947
  orgID: z.string().regex(/^org_[a-z2-7]{26}$/),
3767
3948
  poolID: z.string().regex(/^mpo_[a-z2-7]{26}$/)
@@ -5375,6 +5556,7 @@ __export(sdk_gen_exports, {
5375
5556
  bootstrapDaemon: () => bootstrapDaemon,
5376
5557
  cancelAgent: () => cancelAgent,
5377
5558
  cancelQueuedBacklogInput: () => cancelQueuedBacklogInput,
5559
+ checkMachinePoolConnection: () => checkMachinePoolConnection,
5378
5560
  configureIntegration: () => configureIntegration,
5379
5561
  connectByoMachine: () => connectByoMachine,
5380
5562
  createAgent: () => createAgent,
@@ -5436,6 +5618,7 @@ __export(sdk_gen_exports, {
5436
5618
  getActor: () => getActor,
5437
5619
  getAgent: () => getAgent,
5438
5620
  getAgentConfig: () => getAgentConfig,
5621
+ getAgentConfigGeneratedSource: () => getAgentConfigGeneratedSource,
5439
5622
  getAgentProfile: () => getAgentProfile,
5440
5623
  getAgentProfileUsage: () => getAgentProfileUsage,
5441
5624
  getAgentUsage: () => getAgentUsage,
@@ -6786,6 +6969,20 @@ var getAgentConfig = (options) => (options.client ?? client).get({
6786
6969
  url: "/orgs/{orgID}/projects/{projectID}/agent-configs/{agentConfigID}",
6787
6970
  ...options
6788
6971
  });
6972
+ var getAgentConfigGeneratedSource = (options) => (options.client ?? client).get({
6973
+ responseValidator: relaxedResponseValidator(zGetAgentConfigGeneratedSourceResponse),
6974
+ security: [{
6975
+ key: "bearerAuth",
6976
+ scheme: "bearer",
6977
+ type: "http"
6978
+ }, {
6979
+ in: "cookie",
6980
+ name: "__Host-omnara_session",
6981
+ type: "apiKey"
6982
+ }],
6983
+ url: "/orgs/{orgID}/projects/{projectID}/agent-configs/{agentConfigID}/generated-source",
6984
+ ...options
6985
+ });
6789
6986
  var listAgentProfiles = (options) => (options.client ?? client).get({
6790
6987
  responseValidator: relaxedResponseValidator(zListAgentProfilesResponse2),
6791
6988
  security: [{
@@ -8022,6 +8219,28 @@ var createMachinePool = (options) => (options.client ?? client).post({
8022
8219
  ...options.headers
8023
8220
  }
8024
8221
  });
8222
+ var checkMachinePoolConnection = (options) => (options.client ?? client).post({
8223
+ responseValidator: relaxedResponseValidator(zCheckMachinePoolConnectionResponse),
8224
+ security: [
8225
+ {
8226
+ key: "bearerAuth",
8227
+ scheme: "bearer",
8228
+ type: "http"
8229
+ },
8230
+ {
8231
+ in: "cookie",
8232
+ name: "__Host-omnara_session",
8233
+ type: "apiKey"
8234
+ },
8235
+ { name: "X-Omnara-Csrf", type: "apiKey" }
8236
+ ],
8237
+ url: "/orgs/{orgID}/machine-pools/check-connection",
8238
+ ...options,
8239
+ headers: {
8240
+ "Content-Type": "application/json",
8241
+ ...options.headers
8242
+ }
8243
+ });
8025
8244
  var deleteMachinePool = (options) => (options.client ?? client).delete({
8026
8245
  responseValidator: relaxedResponseValidator(zDeleteMachinePoolResponse),
8027
8246
  security: [
@@ -11846,13 +12065,24 @@ function fileFormat(filePath) {
11846
12065
  if (lower.endsWith(".yaml") || lower.endsWith(".yml")) return "yaml";
11847
12066
  throw new CliInputError(`config file must end in .yaml, .yml, or .json: ${filePath}`);
11848
12067
  }
11849
- function inlineFormat(source) {
11850
- try {
11851
- JSON.parse(source);
11852
- return "json";
11853
- } catch {
11854
- return "yaml";
12068
+ var zDefinitionText = zJsonText.pipe(
12069
+ z20.custom(
12070
+ (value) => z20.record(z20.string(), z20.unknown()).safeParse(value).success,
12071
+ "expected a JSON object"
12072
+ )
12073
+ );
12074
+ function jsonSource(text, label) {
12075
+ const parsed = zDefinitionText.safeParse(text);
12076
+ if (!parsed.success) {
12077
+ throw new CliInputError(
12078
+ `${label} is not a valid JSON agent config: ${parsed.error.issues[0]?.message}`
12079
+ );
11855
12080
  }
12081
+ return { source: text, source_format: "json" };
12082
+ }
12083
+ function inlineSource(source) {
12084
+ if (!zJsonText.safeParse(source).success) return { source, source_format: "yaml" };
12085
+ return jsonSource(source, "inline config source");
11856
12086
  }
11857
12087
  function renderConfigSource(attachment) {
11858
12088
  requireExactlyOne([attachment.file, attachment.source], SOURCE_HINT);
@@ -11864,11 +12094,10 @@ function renderConfigSource(attachment) {
11864
12094
  } catch {
11865
12095
  throw new CliInputError(`could not read config file: ${attachment.file}`);
11866
12096
  }
11867
- return { source, source_format: format };
11868
- }
11869
- if (attachment.source !== void 0) {
11870
- return { source: attachment.source, source_format: inlineFormat(attachment.source) };
12097
+ if (format === "yaml") return { source, source_format: "yaml" };
12098
+ return jsonSource(source, `config file ${attachment.file}`);
11871
12099
  }
12100
+ if (attachment.source !== void 0) return inlineSource(attachment.source);
11872
12101
  throw new CliInputError(SOURCE_HINT);
11873
12102
  }
11874
12103
  async function resolveConfigId(client2, path, attachment) {
@@ -11881,6 +12110,18 @@ async function resolveConfigId(client2, path, attachment) {
11881
12110
  });
11882
12111
  return data.id;
11883
12112
  }
12113
+ var LAUNCH_HINT = "pass --profile or one of --config, --file, or --source";
12114
+ var LAUNCH_CONFIG_HINT = "pass at most one of --config, --file, or --source";
12115
+ function renderLaunchConfig(profile, attachment) {
12116
+ const provided = [attachment.config, attachment.file, attachment.source].filter(
12117
+ (value) => value !== void 0
12118
+ );
12119
+ if (provided.length > 1) throw new CliInputError(LAUNCH_CONFIG_HINT);
12120
+ if (attachment.config !== void 0) return { profile, config: attachment.config };
12121
+ if (provided.length === 1) return { profile, config_source: renderConfigSource(attachment) };
12122
+ if (profile === void 0) throw new CliInputError(LAUNCH_HINT);
12123
+ return { profile };
12124
+ }
11884
12125
  async function currentProfileConfigId(client2, path) {
11885
12126
  const { data } = await sdk_gen_exports.getAgentProfile({ client: client2, path });
11886
12127
  return data.current_config_id;
@@ -12536,32 +12777,34 @@ function serverEntry(url4, secretId) {
12536
12777
  return { url: url4, auth: { type: "oauth", secret_id: secretId } };
12537
12778
  }
12538
12779
  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) {
12780
+ var zDefinitionText2 = zJsonText.pipe(
12781
+ z25.custom((value) => zJsonRecord.safeParse(value).success)
12782
+ );
12783
+ function prepareJsonConfig(configId, source, serverName, mcpUrl) {
12784
+ const parsed = zDefinitionText2.safeParse(source);
12785
+ if (!parsed.success) throw new CliInputError("the current agent config is not a JSON object");
12786
+ const definition = parsed.data;
12787
+ if (!zJsonRecord.nullish().safeParse(definition.mcp).success) {
12546
12788
  throw new CliInputError("the current agent config has an invalid mcp section");
12547
12789
  }
12548
- if (mcp.data !== void 0 && Object.hasOwn(mcp.data, serverName)) {
12790
+ if (definition.mcp != null && Object.hasOwn(definition.mcp, serverName)) {
12549
12791
  throw new CliInputError(`MCP server ${serverName} already exists in the current config`);
12550
12792
  }
12551
12793
  return {
12552
- currentConfigId: config2.id,
12794
+ currentConfigId: configId,
12553
12795
  render(secretId) {
12554
- const updated = {
12555
- ...parsed.data,
12556
- mcp: { ...mcp.data, [serverName]: serverEntry(mcpUrl, secretId) }
12796
+ return {
12797
+ source: {
12798
+ ...definition,
12799
+ mcp: { ...definition.mcp, [serverName]: serverEntry(mcpUrl, secretId) }
12800
+ },
12801
+ source_format: "json"
12557
12802
  };
12558
- return { source: `${JSON.stringify(updated, null, 2)}
12559
- `, sourceFormat: "json" };
12560
12803
  }
12561
12804
  };
12562
12805
  }
12563
- function prepareYamlConfig(config2, serverName, mcpUrl) {
12564
- const doc = parseDocument(config2.source ?? "");
12806
+ function prepareYamlConfig(configId, source, serverName, mcpUrl) {
12807
+ const doc = parseDocument(source);
12565
12808
  if (doc.errors.length > 0) {
12566
12809
  throw new CliInputError("the current agent config contains invalid YAML");
12567
12810
  }
@@ -12577,14 +12820,14 @@ function prepareYamlConfig(config2, serverName, mcpUrl) {
12577
12820
  throw new CliInputError(`MCP server ${serverName} already exists in the current config`);
12578
12821
  }
12579
12822
  return {
12580
- currentConfigId: config2.id,
12823
+ currentConfigId: configId,
12581
12824
  render(secretId) {
12582
12825
  if (isMap(mcp)) {
12583
12826
  doc.setIn(["mcp", serverName], serverEntry(mcpUrl, secretId));
12584
12827
  } else {
12585
12828
  doc.set("mcp", { [serverName]: serverEntry(mcpUrl, secretId) });
12586
12829
  }
12587
- return { source: doc.toString(), sourceFormat: "yaml" };
12830
+ return { source: doc.toString(), source_format: "yaml" };
12588
12831
  }
12589
12832
  };
12590
12833
  }
@@ -12592,7 +12835,7 @@ function prepareConfig(config2, serverName, mcpUrl) {
12592
12835
  if (config2.source === void 0 || config2.source_format === void 0) {
12593
12836
  throw new CliInputError("the current agent config source is unavailable");
12594
12837
  }
12595
- return config2.source_format === "json" ? prepareJsonConfig(config2, serverName, mcpUrl) : prepareYamlConfig(config2, serverName, mcpUrl);
12838
+ return config2.source_format === "json" ? prepareJsonConfig(config2.id, config2.source, serverName, mcpUrl) : prepareYamlConfig(config2.id, config2.source, serverName, mcpUrl);
12596
12839
  }
12597
12840
  async function loadConfig2(client2, scope, target, targetId) {
12598
12841
  const path = { orgID: scope.orgId, projectID: scope.projectId };
@@ -12609,6 +12852,14 @@ async function loadConfig2(client2, scope, target, targetId) {
12609
12852
  if (configId === void 0) throw new CliInputError("the agent has no current config");
12610
12853
  return (await sdk_gen_exports.getAgentConfig({ client: client2, path: { ...path, agentConfigID: configId } })).data;
12611
12854
  }
12855
+ async function withEditableSource(client2, scope, config2) {
12856
+ if (config2.source !== void 0) return config2;
12857
+ const { data } = await sdk_gen_exports.getAgentConfigGeneratedSource({
12858
+ client: client2,
12859
+ path: { orgID: scope.orgId, projectID: scope.projectId, agentConfigID: config2.id }
12860
+ });
12861
+ return { ...config2, source: data.source, source_format: "yaml" };
12862
+ }
12612
12863
  async function applyConfig(client2, scope, target, targetId, prepared, secret, report) {
12613
12864
  const rendered = prepared.render(secret.id);
12614
12865
  const path = { orgID: scope.orgId, projectID: scope.projectId };
@@ -12616,18 +12867,14 @@ async function applyConfig(client2, scope, target, targetId, prepared, secret, r
12616
12867
  const { data } = await sdk_gen_exports.updateAgentConfig({
12617
12868
  client: client2,
12618
12869
  path: { ...path, agentID: targetId },
12619
- body: {
12620
- source: rendered.source,
12621
- source_format: rendered.sourceFormat,
12622
- expected_current_config_id: prepared.currentConfigId
12623
- }
12870
+ body: { ...rendered, expected_current_config_id: prepared.currentConfigId }
12624
12871
  });
12625
12872
  return data.agent_config.id;
12626
12873
  }
12627
12874
  const { data: config2 } = await sdk_gen_exports.createAgentConfig({
12628
12875
  client: client2,
12629
12876
  path,
12630
- body: { source: rendered.source, source_format: rendered.sourceFormat }
12877
+ body: rendered
12631
12878
  });
12632
12879
  try {
12633
12880
  await sdk_gen_exports.updateAgentProfile({
@@ -12653,7 +12900,11 @@ async function runMcpAdd(context, target, targetId) {
12653
12900
  owner: { kind: "project", project_id: scope.projectId },
12654
12901
  name: secret_name ?? `${server_name}-mcp`
12655
12902
  };
12656
- const currentConfig = await loadConfig2(client2, scope, target, targetId);
12903
+ const currentConfig = await withEditableSource(
12904
+ client2,
12905
+ scope,
12906
+ await loadConfig2(client2, scope, target, targetId)
12907
+ );
12657
12908
  const prepared = prepareConfig(currentConfig, server_name, request.mcp_url);
12658
12909
  let secret;
12659
12910
  try {
@@ -12826,15 +13077,14 @@ var commandGroups = [
12826
13077
  format: formatRecord(),
12827
13078
  path: zCreateAgentPath,
12828
13079
  body: zConfigAttachment.extend({
12829
- profile: zAgentProfileId.optional(),
13080
+ profile: zAgentProfileId.optional().describe("agent profile ID; runs its current config unless a config is given"),
12830
13081
  name: zAgentName.optional(),
12831
13082
  message: z28.string().optional()
12832
13083
  }),
12833
- transformBody: async ({ profile, name, message, ...attachment }, { client: client2, path }) => ({
12834
- profile,
13084
+ transformBody: ({ profile, name, message, ...attachment }) => ({
12835
13085
  name,
12836
13086
  message,
12837
- config: await resolveConfigId(client2, path, attachment)
13087
+ ...renderLaunchConfig(profile, attachment)
12838
13088
  })
12839
13089
  }),
12840
13090
  op({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnara",
3
- "version": "1.0.28",
3
+ "version": "1.0.29",
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",
@@ -36,8 +36,8 @@
36
36
  "tsx": "^4.19.0",
37
37
  "typescript": "^5.6.0",
38
38
  "vitest": "4.1.9",
39
- "@omnara/react": "0.0.0",
40
- "@omnara/sdk": "0.0.0"
39
+ "@omnara/sdk": "0.0.0",
40
+ "@omnara/react": "0.0.0"
41
41
  },
42
42
  "scripts": {
43
43
  "build": "esbuild src/bin.ts --bundle --platform=node --format=esm --target=node22 --outfile=dist/bin.js --banner:js='#!/usr/bin/env node' --external:@clack/prompts --external:@tanstack/react-query --external:commander --external:ink --external:react --external:tar --external:yaml --external:zod",