omnara 1.0.0 → 1.0.2
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/bin.js +610 -105
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -210,7 +210,7 @@ function createSseClient({
|
|
|
210
210
|
...options
|
|
211
211
|
}) {
|
|
212
212
|
let lastEventId;
|
|
213
|
-
const sleep2 = sseSleepFn ?? ((ms) => new Promise((
|
|
213
|
+
const sleep2 = sseSleepFn ?? ((ms) => new Promise((resolve3) => setTimeout(resolve3, ms)));
|
|
214
214
|
const createStream = async function* () {
|
|
215
215
|
let retryDelay = sseDefaultRetryDelay ?? 3e3;
|
|
216
216
|
let attempt = 0;
|
|
@@ -971,6 +971,9 @@ var client = createClient(createConfig({ throwOnError: true }));
|
|
|
971
971
|
|
|
972
972
|
// ../sdk/src/generated/zod.gen.ts
|
|
973
973
|
import * as z from "zod";
|
|
974
|
+
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" });
|
|
975
|
+
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" });
|
|
976
|
+
var zSkillName = z.string().min(1).max(64).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/);
|
|
974
977
|
var zResourceListSort = z.enum([
|
|
975
978
|
"name",
|
|
976
979
|
"-name",
|
|
@@ -1098,7 +1101,7 @@ var zModelCatalog = z.object({
|
|
|
1098
1101
|
error: z.string().optional()
|
|
1099
1102
|
});
|
|
1100
1103
|
var zCreateConfiguredModelRequest = z.object({
|
|
1101
|
-
name:
|
|
1104
|
+
name: zResourceName,
|
|
1102
1105
|
provider_model_slug: z.string().min(1),
|
|
1103
1106
|
context_window_tokens: z.int().gte(2).lte(2147483647),
|
|
1104
1107
|
max_output_tokens: z.int().gte(1).lte(2147483647).optional(),
|
|
@@ -1113,7 +1116,7 @@ var zCreateConfiguredModelRequest = z.object({
|
|
|
1113
1116
|
api_variant_options: zModelApiVariantOptions.optional()
|
|
1114
1117
|
});
|
|
1115
1118
|
var zUpdateConfiguredModelRequest = z.object({
|
|
1116
|
-
name:
|
|
1119
|
+
name: zResourceName.optional(),
|
|
1117
1120
|
provider_model_slug: z.string().min(1).optional(),
|
|
1118
1121
|
context_window_tokens: z.int().gte(2).lte(2147483647).optional(),
|
|
1119
1122
|
max_output_tokens: z.int().gte(1).lte(2147483647).optional(),
|
|
@@ -1162,7 +1165,7 @@ var zSkillRevisionId = z.string().regex(/^skr_[a-z2-7]{26}$/);
|
|
|
1162
1165
|
var zSkillGrantId = z.string().regex(/^skg_[a-z2-7]{26}$/);
|
|
1163
1166
|
var zSecretId = z.string().regex(/^sec_[a-z2-7]{26}$/);
|
|
1164
1167
|
var zCreateModelProviderConfigRequest = z.object({
|
|
1165
|
-
name:
|
|
1168
|
+
name: zResourceName,
|
|
1166
1169
|
preset: z.enum([
|
|
1167
1170
|
"openai",
|
|
1168
1171
|
"openrouter",
|
|
@@ -1200,7 +1203,7 @@ var zModelProviderConfig = z.object({
|
|
|
1200
1203
|
id: zModelProviderConfigId,
|
|
1201
1204
|
org_id: zOrganizationId,
|
|
1202
1205
|
management_kind: zManagementKind,
|
|
1203
|
-
name:
|
|
1206
|
+
name: zResourceName,
|
|
1204
1207
|
api_format: zModelApiFormat,
|
|
1205
1208
|
api_variant: zModelProviderApiVariantResponse,
|
|
1206
1209
|
base_url: z.string(),
|
|
@@ -1227,7 +1230,7 @@ var zConfiguredModel = z.object({
|
|
|
1227
1230
|
org_id: zOrganizationId,
|
|
1228
1231
|
model_provider_config_id: zModelProviderConfigId,
|
|
1229
1232
|
management_kind: zManagementKind,
|
|
1230
|
-
name:
|
|
1233
|
+
name: zResourceName,
|
|
1231
1234
|
current_revision_id: zConfiguredModelRevisionId,
|
|
1232
1235
|
provider_model_slug: z.string(),
|
|
1233
1236
|
context_window_tokens: z.int(),
|
|
@@ -1274,8 +1277,8 @@ var zConfiguredModelSummary = z.object({
|
|
|
1274
1277
|
id: zConfiguredModelId,
|
|
1275
1278
|
org_id: zOrganizationId,
|
|
1276
1279
|
model_provider_config_id: zModelProviderConfigId,
|
|
1277
|
-
name:
|
|
1278
|
-
provider_config:
|
|
1280
|
+
name: zResourceName,
|
|
1281
|
+
provider_config: zResourceName,
|
|
1279
1282
|
created_at: zTimestamp,
|
|
1280
1283
|
updated_at: zTimestamp
|
|
1281
1284
|
});
|
|
@@ -1326,7 +1329,7 @@ var zSkill = z.object({
|
|
|
1326
1329
|
id: zSkillId,
|
|
1327
1330
|
org_id: zOrganizationId,
|
|
1328
1331
|
owner: zSkillOwner,
|
|
1329
|
-
name:
|
|
1332
|
+
name: zSkillName,
|
|
1330
1333
|
revision_id: zSkillRevisionId,
|
|
1331
1334
|
revision: z.int().gte(1).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
|
|
1332
1335
|
description: z.string(),
|
|
@@ -1465,8 +1468,8 @@ var zToolCatalog = z.object({
|
|
|
1465
1468
|
mcp_tool_permissions: zToolPermissionProfile
|
|
1466
1469
|
});
|
|
1467
1470
|
var zAgentConfigModel = z.object({
|
|
1468
|
-
provider_config:
|
|
1469
|
-
name:
|
|
1471
|
+
provider_config: zResourceName,
|
|
1472
|
+
name: zResourceName,
|
|
1470
1473
|
provider_model_slug: z.string(),
|
|
1471
1474
|
configured_model_id: zConfiguredModelId,
|
|
1472
1475
|
current_revision_id: zConfiguredModelRevisionId,
|
|
@@ -1497,7 +1500,7 @@ var zAgentConfig = z.object({
|
|
|
1497
1500
|
created_at: zTimestamp
|
|
1498
1501
|
});
|
|
1499
1502
|
var zCreateAgentProfileRequest = z.object({
|
|
1500
|
-
name:
|
|
1503
|
+
name: zResourceName,
|
|
1501
1504
|
config: zAgentConfigId
|
|
1502
1505
|
});
|
|
1503
1506
|
var zUpdateAgentProfileRequest = z.object({
|
|
@@ -1505,13 +1508,13 @@ var zUpdateAgentProfileRequest = z.object({
|
|
|
1505
1508
|
expected_current_config_id: zAgentConfigId
|
|
1506
1509
|
});
|
|
1507
1510
|
var zRenameAgentProfileRequest = z.object({
|
|
1508
|
-
name:
|
|
1511
|
+
name: zResourceName
|
|
1509
1512
|
});
|
|
1510
1513
|
var zAgentProfile = z.object({
|
|
1511
1514
|
id: zAgentProfileId,
|
|
1512
1515
|
org_id: zOrganizationId,
|
|
1513
1516
|
project_id: zProjectId,
|
|
1514
|
-
name:
|
|
1517
|
+
name: zResourceName,
|
|
1515
1518
|
current_config_id: zAgentConfigId,
|
|
1516
1519
|
current_generation: z.int().min(-2147483648, { error: "Invalid value: Expected int32 to be >= -2147483648" }).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
|
|
1517
1520
|
current_config: zAgentConfig,
|
|
@@ -1543,7 +1546,7 @@ var zCronTriggerFailureReport = z.object({
|
|
|
1543
1546
|
failed_at: zTimestamp
|
|
1544
1547
|
});
|
|
1545
1548
|
var zCreateCronTriggerRequest = z.object({
|
|
1546
|
-
name:
|
|
1549
|
+
name: zResourceName,
|
|
1547
1550
|
target: zCronTriggerTarget,
|
|
1548
1551
|
cron: zCronExpression,
|
|
1549
1552
|
timezone: zCronTimezone.optional(),
|
|
@@ -1551,7 +1554,7 @@ var zCreateCronTriggerRequest = z.object({
|
|
|
1551
1554
|
enabled: z.boolean().optional().default(true)
|
|
1552
1555
|
});
|
|
1553
1556
|
var zUpdateCronTriggerRequest = z.object({
|
|
1554
|
-
name:
|
|
1557
|
+
name: zResourceName.optional(),
|
|
1555
1558
|
cron: zCronExpression.optional(),
|
|
1556
1559
|
timezone: zCronTimezone.optional(),
|
|
1557
1560
|
message_template: zCronMessageTemplate.optional(),
|
|
@@ -1561,7 +1564,7 @@ var zCronTrigger = z.object({
|
|
|
1561
1564
|
id: zCronTriggerId,
|
|
1562
1565
|
org_id: zOrganizationId,
|
|
1563
1566
|
project_id: zProjectId,
|
|
1564
|
-
name:
|
|
1567
|
+
name: zResourceName,
|
|
1565
1568
|
target: zCronTriggerTarget,
|
|
1566
1569
|
cron: zCronExpression,
|
|
1567
1570
|
timezone: zCronTimezone,
|
|
@@ -1580,12 +1583,12 @@ var zListCronTriggersResponse = z.object({
|
|
|
1580
1583
|
var zCreateAgentRequest = z.object({
|
|
1581
1584
|
profile: zAgentProfileId.optional(),
|
|
1582
1585
|
config: zAgentConfigId,
|
|
1583
|
-
name:
|
|
1586
|
+
name: zAgentName.optional(),
|
|
1584
1587
|
message: z.string().optional()
|
|
1585
1588
|
});
|
|
1586
1589
|
var zAgentModel = z.object({
|
|
1587
|
-
provider_config:
|
|
1588
|
-
name:
|
|
1590
|
+
provider_config: zResourceName,
|
|
1591
|
+
name: zResourceName
|
|
1589
1592
|
});
|
|
1590
1593
|
var zIntegrationTarget = z.object({
|
|
1591
1594
|
provider: z.string(),
|
|
@@ -1600,7 +1603,7 @@ var zAgent = z.object({
|
|
|
1600
1603
|
project_id: zProjectId,
|
|
1601
1604
|
agent_profile_id: zAgentProfileId.optional(),
|
|
1602
1605
|
state: z.enum(["active", "archived"]),
|
|
1603
|
-
name:
|
|
1606
|
+
name: zAgentName,
|
|
1604
1607
|
integration_target: zIntegrationTarget.optional(),
|
|
1605
1608
|
current_config_id: zAgentConfigId.optional(),
|
|
1606
1609
|
model: zAgentModel.optional(),
|
|
@@ -2174,7 +2177,7 @@ var zSecretOwnerInput = z.discriminatedUnion("kind", [
|
|
|
2174
2177
|
var zMcpoAuthStartRequest = z.object({
|
|
2175
2178
|
owner: zSecretOwnerInput,
|
|
2176
2179
|
mcp_url: z.string().min(1),
|
|
2177
|
-
name:
|
|
2180
|
+
name: zResourceName,
|
|
2178
2181
|
return_to: z.string().optional(),
|
|
2179
2182
|
client_id: z.string().optional(),
|
|
2180
2183
|
client_secret: z.string().optional(),
|
|
@@ -2233,12 +2236,12 @@ var zSecretMaterial = z.discriminatedUnion("kind", [
|
|
|
2233
2236
|
]);
|
|
2234
2237
|
var zCreateSecretRequest = z.object({
|
|
2235
2238
|
owner: zSecretOwnerInput,
|
|
2236
|
-
name:
|
|
2239
|
+
name: zResourceName,
|
|
2237
2240
|
metadata: zMetadata.optional(),
|
|
2238
2241
|
material: zSecretMaterial
|
|
2239
2242
|
});
|
|
2240
2243
|
var zUpdateSecretRequest = z.object({
|
|
2241
|
-
name:
|
|
2244
|
+
name: zResourceName.optional(),
|
|
2242
2245
|
metadata: zMetadata.optional()
|
|
2243
2246
|
});
|
|
2244
2247
|
var zSecretVersionRequest = z.object({
|
|
@@ -2258,7 +2261,7 @@ var zSecret = z.object({
|
|
|
2258
2261
|
org_id: zOrganizationId,
|
|
2259
2262
|
management_kind: zManagementKind,
|
|
2260
2263
|
owner: zSecretOwner,
|
|
2261
|
-
name:
|
|
2264
|
+
name: zResourceName,
|
|
2262
2265
|
kind: zSecretKind,
|
|
2263
2266
|
metadata: zMetadata,
|
|
2264
2267
|
current_version_number: z.int().min(-2147483648, { error: "Invalid value: Expected int32 to be >= -2147483648" }).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
|
|
@@ -2299,11 +2302,11 @@ var zSecretGrant = z.object({
|
|
|
2299
2302
|
created_at: zTimestamp
|
|
2300
2303
|
});
|
|
2301
2304
|
var zCreateOrganizationRequest = z.object({
|
|
2302
|
-
name:
|
|
2305
|
+
name: zResourceName
|
|
2303
2306
|
});
|
|
2304
2307
|
var zOrganization = z.object({
|
|
2305
2308
|
id: zOrganizationId,
|
|
2306
|
-
name:
|
|
2309
|
+
name: zResourceName,
|
|
2307
2310
|
created_at: zTimestamp,
|
|
2308
2311
|
updated_at: zTimestamp
|
|
2309
2312
|
});
|
|
@@ -2316,7 +2319,7 @@ var zOrganizationMembership = z.object({
|
|
|
2316
2319
|
var zOrgInvitation = z.object({
|
|
2317
2320
|
id: zOrgInvitationId,
|
|
2318
2321
|
org_id: zOrganizationId,
|
|
2319
|
-
org_name:
|
|
2322
|
+
org_name: zResourceName,
|
|
2320
2323
|
email: z.email(),
|
|
2321
2324
|
org_role: z.string(),
|
|
2322
2325
|
created_at: zTimestamp
|
|
@@ -2330,12 +2333,12 @@ var zCreateOrgInvitationRequest = z.object({
|
|
|
2330
2333
|
role: z.string()
|
|
2331
2334
|
});
|
|
2332
2335
|
var zCreatePersonalAccessTokenRequest = z.object({
|
|
2333
|
-
name:
|
|
2336
|
+
name: zResourceName
|
|
2334
2337
|
});
|
|
2335
2338
|
var zPersonalAccessToken = z.object({
|
|
2336
2339
|
id: zPersonalAccessTokenId,
|
|
2337
2340
|
user_id: zUserId,
|
|
2338
|
-
name:
|
|
2341
|
+
name: zResourceName,
|
|
2339
2342
|
token_id: z.string(),
|
|
2340
2343
|
created_at: zTimestamp,
|
|
2341
2344
|
last_used_at: zTimestamp.nullable(),
|
|
@@ -2349,7 +2352,7 @@ var zOrgApiKeyRole = z.enum(["admin", "member"]);
|
|
|
2349
2352
|
var zOrgApiKey = z.object({
|
|
2350
2353
|
id: zOrgApiKeyId,
|
|
2351
2354
|
org_id: zOrganizationId,
|
|
2352
|
-
name:
|
|
2355
|
+
name: zResourceName,
|
|
2353
2356
|
token_id: z.string(),
|
|
2354
2357
|
org_role: z.string(),
|
|
2355
2358
|
created_by_user_id: zUserId,
|
|
@@ -2359,7 +2362,7 @@ var zOrgApiKey = z.object({
|
|
|
2359
2362
|
revoked_at: zTimestamp.nullable()
|
|
2360
2363
|
});
|
|
2361
2364
|
var zCreateOrgApiKeyRequest = z.object({
|
|
2362
|
-
name:
|
|
2365
|
+
name: zResourceName,
|
|
2363
2366
|
org_role: zOrgApiKeyRole
|
|
2364
2367
|
});
|
|
2365
2368
|
var zCreateOrgApiKeyResponse = z.object({
|
|
@@ -2367,7 +2370,7 @@ var zCreateOrgApiKeyResponse = z.object({
|
|
|
2367
2370
|
api_key: zOrgApiKey
|
|
2368
2371
|
});
|
|
2369
2372
|
var zUpdateOrgApiKeyRequest = z.object({
|
|
2370
|
-
name:
|
|
2373
|
+
name: zResourceName.optional(),
|
|
2371
2374
|
org_role: zOrgApiKeyRole.optional()
|
|
2372
2375
|
});
|
|
2373
2376
|
var zListOrgApiKeysResponse = z.object({
|
|
@@ -2386,7 +2389,7 @@ var zArtifact = z.object({
|
|
|
2386
2389
|
created_at: zTimestamp
|
|
2387
2390
|
});
|
|
2388
2391
|
var zCreateMachinePoolRequestBase = z.object({
|
|
2389
|
-
name:
|
|
2392
|
+
name: zResourceName,
|
|
2390
2393
|
description: z.string().optional(),
|
|
2391
2394
|
provider: z.string().min(1),
|
|
2392
2395
|
default_machine_cpu: z.int().gte(1).lte(2147483647).optional(),
|
|
@@ -2405,6 +2408,7 @@ var zCreateMachinePoolRequestBase = z.object({
|
|
|
2405
2408
|
min_machine_memory_mb: z.int().gte(0).lte(2147483647).optional(),
|
|
2406
2409
|
max_machine_cpu: z.int().gte(1).lte(2147483647).optional(),
|
|
2407
2410
|
max_machine_memory_mb: z.int().gte(1).lte(2147483647).optional(),
|
|
2411
|
+
delete_after_idle_minutes: z.int().gte(5).lte(2147483647).optional(),
|
|
2408
2412
|
metadata: zMachineMetadata.optional()
|
|
2409
2413
|
});
|
|
2410
2414
|
var zCreateMachinePoolRequest = zCreateMachinePoolRequestBase.and(z.union([
|
|
@@ -2432,7 +2436,7 @@ var zCreateMachinePoolRequest = zCreateMachinePoolRequestBase.and(z.union([
|
|
|
2432
2436
|
})
|
|
2433
2437
|
]));
|
|
2434
2438
|
var zUpdateMachinePoolRequest = z.object({
|
|
2435
|
-
name:
|
|
2439
|
+
name: zResourceName.optional(),
|
|
2436
2440
|
description: z.string().optional(),
|
|
2437
2441
|
default_machine_cpu: z.int().gte(1).lte(2147483647).nullish(),
|
|
2438
2442
|
default_machine_memory_mb: z.int().gte(1).lte(2147483647).nullish(),
|
|
@@ -2450,6 +2454,7 @@ var zUpdateMachinePoolRequest = z.object({
|
|
|
2450
2454
|
min_machine_memory_mb: z.int().gte(0).lte(2147483647).nullish(),
|
|
2451
2455
|
max_machine_cpu: z.int().gte(1).lte(2147483647).nullish(),
|
|
2452
2456
|
max_machine_memory_mb: z.int().gte(1).lte(2147483647).nullish(),
|
|
2457
|
+
delete_after_idle_minutes: z.int().gte(5).lte(2147483647).nullish(),
|
|
2453
2458
|
metadata: zMachineMetadata.optional()
|
|
2454
2459
|
});
|
|
2455
2460
|
var zMachinePoolUsage = z.object({
|
|
@@ -2460,7 +2465,7 @@ var zMachinePoolUsage = z.object({
|
|
|
2460
2465
|
var zMachinePool = z.object({
|
|
2461
2466
|
id: zMachinePoolId,
|
|
2462
2467
|
org_id: zOrganizationId,
|
|
2463
|
-
name:
|
|
2468
|
+
name: zResourceName,
|
|
2464
2469
|
management_kind: zManagementKind,
|
|
2465
2470
|
description: z.string(),
|
|
2466
2471
|
provider: z.string(),
|
|
@@ -2480,6 +2485,7 @@ var zMachinePool = z.object({
|
|
|
2480
2485
|
min_machine_memory_mb: z.int().gte(0).lte(2147483647).nullable(),
|
|
2481
2486
|
max_machine_cpu: z.int().gte(1).lte(2147483647).nullable(),
|
|
2482
2487
|
max_machine_memory_mb: z.int().gte(1).lte(2147483647).nullable(),
|
|
2488
|
+
delete_after_idle_minutes: z.int().gte(5).lte(2147483647).nullable(),
|
|
2483
2489
|
metadata: zMetadata,
|
|
2484
2490
|
created_at: zTimestamp,
|
|
2485
2491
|
updated_at: zTimestamp,
|
|
@@ -2510,7 +2516,7 @@ var zMachine = z.object({
|
|
|
2510
2516
|
org_id: zOrganizationId,
|
|
2511
2517
|
source_kind: zMachineSourceKind,
|
|
2512
2518
|
machine_pool_id: zMachinePoolId.nullish(),
|
|
2513
|
-
display_name:
|
|
2519
|
+
display_name: zResourceName,
|
|
2514
2520
|
description: z.string(),
|
|
2515
2521
|
provider: z.string(),
|
|
2516
2522
|
lifecycle_state: zMachineLifecycleState,
|
|
@@ -2532,7 +2538,7 @@ var zMachine = z.object({
|
|
|
2532
2538
|
updated_at: zTimestamp
|
|
2533
2539
|
});
|
|
2534
2540
|
var zCreateMachineRequest = z.object({
|
|
2535
|
-
display_name:
|
|
2541
|
+
display_name: zResourceName,
|
|
2536
2542
|
description: z.string().optional(),
|
|
2537
2543
|
cwd: z.string().optional(),
|
|
2538
2544
|
env: z.record(z.string(), z.string()).optional(),
|
|
@@ -2540,8 +2546,14 @@ var zCreateMachineRequest = z.object({
|
|
|
2540
2546
|
metadata: zMachineMetadata.optional()
|
|
2541
2547
|
});
|
|
2542
2548
|
var zConnectByoMachineRequest = z.object({
|
|
2543
|
-
display_name:
|
|
2544
|
-
|
|
2549
|
+
display_name: zResourceName,
|
|
2550
|
+
description: z.string().optional(),
|
|
2551
|
+
cwd: z.string().optional(),
|
|
2552
|
+
env: z.record(z.string(), z.string()).optional(),
|
|
2553
|
+
secret_env: z.record(z.string(), zSecretId).optional(),
|
|
2554
|
+
metadata: zMachineMetadata.optional(),
|
|
2555
|
+
project_ids: z.array(zProjectId).max(100).optional(),
|
|
2556
|
+
token_name: zResourceName.optional()
|
|
2545
2557
|
});
|
|
2546
2558
|
var zUpdateMachineRequest = z.object({
|
|
2547
2559
|
cwd: z.string().optional(),
|
|
@@ -2552,7 +2564,7 @@ var zMachineSummaryFields = z.object({
|
|
|
2552
2564
|
id: zMachineId,
|
|
2553
2565
|
org_id: zOrganizationId,
|
|
2554
2566
|
source_kind: zMachineSourceKind,
|
|
2555
|
-
display_name:
|
|
2567
|
+
display_name: zResourceName,
|
|
2556
2568
|
description: z.string(),
|
|
2557
2569
|
provider: z.string(),
|
|
2558
2570
|
lifecycle_state: zMachineLifecycleState,
|
|
@@ -2628,6 +2640,10 @@ var zProjectMachinePoolGrant = z.object({
|
|
|
2628
2640
|
min_machine_memory_mb: z.int().gte(0).lte(2147483647).nullable(),
|
|
2629
2641
|
max_machine_cpu: z.int().gte(1).lte(2147483647).nullable(),
|
|
2630
2642
|
max_machine_memory_mb: z.int().gte(1).lte(2147483647).nullable(),
|
|
2643
|
+
delete_after_idle_minutes: z.union([
|
|
2644
|
+
z.literal(0),
|
|
2645
|
+
z.int().gte(5).lte(2147483647)
|
|
2646
|
+
]).nullable(),
|
|
2631
2647
|
metadata: zMetadata,
|
|
2632
2648
|
created_at: zTimestamp,
|
|
2633
2649
|
updated_at: zTimestamp
|
|
@@ -2648,6 +2664,10 @@ var zCreateProjectMachinePoolGrantRequest = z.object({
|
|
|
2648
2664
|
min_machine_memory_mb: z.int().gte(0).lte(2147483647).optional(),
|
|
2649
2665
|
max_machine_cpu: z.int().gte(1).lte(2147483647).optional(),
|
|
2650
2666
|
max_machine_memory_mb: z.int().gte(1).lte(2147483647).optional(),
|
|
2667
|
+
delete_after_idle_minutes: z.union([
|
|
2668
|
+
z.literal(0),
|
|
2669
|
+
z.int().gte(5).lte(2147483647)
|
|
2670
|
+
]).optional(),
|
|
2651
2671
|
metadata: zMetadata.optional()
|
|
2652
2672
|
});
|
|
2653
2673
|
var zUpdateProjectMachinePoolGrantRequest = z.object({
|
|
@@ -2665,12 +2685,16 @@ var zUpdateProjectMachinePoolGrantRequest = z.object({
|
|
|
2665
2685
|
min_machine_memory_mb: z.int().gte(0).lte(2147483647).nullish(),
|
|
2666
2686
|
max_machine_cpu: z.int().gte(1).lte(2147483647).nullish(),
|
|
2667
2687
|
max_machine_memory_mb: z.int().gte(1).lte(2147483647).nullish(),
|
|
2688
|
+
delete_after_idle_minutes: z.union([
|
|
2689
|
+
z.literal(0),
|
|
2690
|
+
z.int().gte(5).lte(2147483647)
|
|
2691
|
+
]).nullish(),
|
|
2668
2692
|
metadata: zMetadata.optional()
|
|
2669
2693
|
});
|
|
2670
2694
|
var zMachinePoolSummary = z.object({
|
|
2671
2695
|
id: zMachinePoolId,
|
|
2672
2696
|
org_id: zOrganizationId,
|
|
2673
|
-
name:
|
|
2697
|
+
name: zResourceName,
|
|
2674
2698
|
management_kind: zManagementKind,
|
|
2675
2699
|
description: z.string(),
|
|
2676
2700
|
provider: z.string(),
|
|
@@ -2686,14 +2710,14 @@ var zListProjectMachinePoolGrantsResponse = z.object({
|
|
|
2686
2710
|
next_cursor: z.string().nullable()
|
|
2687
2711
|
});
|
|
2688
2712
|
var zCreateMachineDaemonTokenRequest = z.object({
|
|
2689
|
-
name:
|
|
2713
|
+
name: zResourceName.optional(),
|
|
2690
2714
|
metadata: zMetadata.optional()
|
|
2691
2715
|
});
|
|
2692
2716
|
var zMachineDaemonToken = z.object({
|
|
2693
2717
|
id: zMachineDaemonTokenId,
|
|
2694
2718
|
org_id: zOrganizationId,
|
|
2695
2719
|
machine_id: zMachineId,
|
|
2696
|
-
name:
|
|
2720
|
+
name: zResourceName,
|
|
2697
2721
|
metadata: zMetadata,
|
|
2698
2722
|
created_at: zTimestamp,
|
|
2699
2723
|
last_used_at: zTimestamp.nullable(),
|
|
@@ -2803,12 +2827,12 @@ var zBootstrapDaemonResponse = z.object({
|
|
|
2803
2827
|
machine_id: zMachineId
|
|
2804
2828
|
});
|
|
2805
2829
|
var zCreateProjectRequest = z.object({
|
|
2806
|
-
name:
|
|
2830
|
+
name: zResourceName
|
|
2807
2831
|
});
|
|
2808
2832
|
var zProjectFields = z.object({
|
|
2809
2833
|
id: zProjectId,
|
|
2810
2834
|
org_id: zOrganizationId,
|
|
2811
|
-
name:
|
|
2835
|
+
name: zResourceName,
|
|
2812
2836
|
created_at: zTimestamp,
|
|
2813
2837
|
updated_at: zTimestamp
|
|
2814
2838
|
});
|
|
@@ -2859,7 +2883,7 @@ var zCurrentUserIdentity = z.object({
|
|
|
2859
2883
|
});
|
|
2860
2884
|
var zCurrentUserOrg = z.object({
|
|
2861
2885
|
id: zOrganizationId,
|
|
2862
|
-
name:
|
|
2886
|
+
name: zResourceName,
|
|
2863
2887
|
role: z.string(),
|
|
2864
2888
|
created_at: zTimestamp
|
|
2865
2889
|
});
|
|
@@ -2890,7 +2914,7 @@ var zSetProjectMembershipRequest = z.object({
|
|
|
2890
2914
|
});
|
|
2891
2915
|
var zProjectMembershipGrant = z.object({
|
|
2892
2916
|
project_id: zProjectId,
|
|
2893
|
-
project_name:
|
|
2917
|
+
project_name: zResourceName,
|
|
2894
2918
|
role: z.string(),
|
|
2895
2919
|
created_at: zTimestamp
|
|
2896
2920
|
});
|
|
@@ -3274,7 +3298,6 @@ var zListAgentProfilesQuery = z.object({
|
|
|
3274
3298
|
cursor: z.string().max(1024).optional()
|
|
3275
3299
|
});
|
|
3276
3300
|
var zListAgentProfilesResponse2 = zListAgentProfilesResponse;
|
|
3277
|
-
var zCreateAgentProfileBody = zCreateAgentProfileRequest;
|
|
3278
3301
|
var zCreateAgentProfileHeaders = z.object({
|
|
3279
3302
|
"Idempotency-Key": z.string().min(1).max(255).optional()
|
|
3280
3303
|
});
|
|
@@ -3376,7 +3399,6 @@ var zListAgentsQuery = z.object({
|
|
|
3376
3399
|
cursor: z.string().max(1024).optional()
|
|
3377
3400
|
});
|
|
3378
3401
|
var zListAgentsResponse2 = zListAgentsResponse;
|
|
3379
|
-
var zCreateAgentBody = zCreateAgentRequest;
|
|
3380
3402
|
var zCreateAgentHeaders = z.object({
|
|
3381
3403
|
"Idempotency-Key": z.string().min(1).max(255).optional()
|
|
3382
3404
|
});
|
|
@@ -3656,7 +3678,6 @@ var zListVisibleMachinesQuery = z.object({
|
|
|
3656
3678
|
cursor: z.string().max(1024).optional()
|
|
3657
3679
|
});
|
|
3658
3680
|
var zListVisibleMachinesResponse2 = zListVisibleMachinesResponse;
|
|
3659
|
-
var zCreateMachineBody = zCreateMachineRequest;
|
|
3660
3681
|
var zCreateMachineHeaders = z.object({
|
|
3661
3682
|
"Idempotency-Key": z.string().min(1).max(255).optional()
|
|
3662
3683
|
});
|
|
@@ -3664,6 +3685,7 @@ var zCreateMachinePath = z.object({
|
|
|
3664
3685
|
orgID: z.string().regex(/^org_[a-z2-7]{26}$/)
|
|
3665
3686
|
});
|
|
3666
3687
|
var zCreateMachineResponse = zMachine;
|
|
3688
|
+
var zConnectByoMachineBody = zConnectByoMachineRequest;
|
|
3667
3689
|
var zConnectByoMachinePath = z.object({
|
|
3668
3690
|
orgID: zOrganizationId
|
|
3669
3691
|
});
|
|
@@ -5677,11 +5699,19 @@ var createMachine = (options) => (options.client ?? client).post({
|
|
|
5677
5699
|
});
|
|
5678
5700
|
var connectByoMachine = (options) => (options.client ?? client).post({
|
|
5679
5701
|
responseValidator: async (data) => await validateResponse(zConnectByoMachineResponse2, data),
|
|
5680
|
-
security: [
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5702
|
+
security: [
|
|
5703
|
+
{
|
|
5704
|
+
key: "bearerAuth",
|
|
5705
|
+
scheme: "bearer",
|
|
5706
|
+
type: "http"
|
|
5707
|
+
},
|
|
5708
|
+
{
|
|
5709
|
+
in: "cookie",
|
|
5710
|
+
name: "__Host-omnara_session",
|
|
5711
|
+
type: "apiKey"
|
|
5712
|
+
},
|
|
5713
|
+
{ name: "X-Omnara-Csrf", type: "apiKey" }
|
|
5714
|
+
],
|
|
5685
5715
|
url: "/api/v1/orgs/{orgID}/machines/connect",
|
|
5686
5716
|
...options,
|
|
5687
5717
|
headers: {
|
|
@@ -6289,10 +6319,10 @@ var getDaemonSkillArchive = (options) => (options.client ?? client).get({
|
|
|
6289
6319
|
|
|
6290
6320
|
// ../sdk/src/auth.ts
|
|
6291
6321
|
function bearerToken(token) {
|
|
6292
|
-
const
|
|
6322
|
+
const resolve3 = typeof token === "function" ? token : () => token;
|
|
6293
6323
|
return {
|
|
6294
6324
|
async authenticate(request) {
|
|
6295
|
-
const value = await
|
|
6325
|
+
const value = await resolve3();
|
|
6296
6326
|
if (value) request.headers.set("Authorization", `Bearer ${value}`);
|
|
6297
6327
|
}
|
|
6298
6328
|
};
|
|
@@ -6330,6 +6360,32 @@ var ApiError = class _ApiError extends Error {
|
|
|
6330
6360
|
};
|
|
6331
6361
|
|
|
6332
6362
|
// ../sdk/src/client.ts
|
|
6363
|
+
function stripClientSelector(client2) {
|
|
6364
|
+
const strip = (dispatch) => (options) => {
|
|
6365
|
+
if (options == null || !("client" in options)) return dispatch(options);
|
|
6366
|
+
const rest = { ...options };
|
|
6367
|
+
delete rest.client;
|
|
6368
|
+
return dispatch(rest);
|
|
6369
|
+
};
|
|
6370
|
+
const methods = [
|
|
6371
|
+
"connect",
|
|
6372
|
+
"delete",
|
|
6373
|
+
"get",
|
|
6374
|
+
"head",
|
|
6375
|
+
"options",
|
|
6376
|
+
"patch",
|
|
6377
|
+
"post",
|
|
6378
|
+
"put",
|
|
6379
|
+
"request",
|
|
6380
|
+
"trace"
|
|
6381
|
+
];
|
|
6382
|
+
const wrap = (target) => {
|
|
6383
|
+
const dispatches = target;
|
|
6384
|
+
for (const method of methods) dispatches[method] &&= strip(dispatches[method]);
|
|
6385
|
+
};
|
|
6386
|
+
wrap(client2);
|
|
6387
|
+
wrap(client2.sse);
|
|
6388
|
+
}
|
|
6333
6389
|
function createOmnaraClient(options = {}) {
|
|
6334
6390
|
const client2 = createClient(
|
|
6335
6391
|
createConfig({
|
|
@@ -6352,6 +6408,7 @@ function createOmnaraClient(options = {}) {
|
|
|
6352
6408
|
if (!response.ok) throw await ApiError.fromResponse(response);
|
|
6353
6409
|
return response;
|
|
6354
6410
|
});
|
|
6411
|
+
stripClientSelector(client2);
|
|
6355
6412
|
return client2;
|
|
6356
6413
|
}
|
|
6357
6414
|
|
|
@@ -6413,7 +6470,7 @@ async function startDeviceAuth(options) {
|
|
|
6413
6470
|
};
|
|
6414
6471
|
}
|
|
6415
6472
|
function defaultSleep(seconds) {
|
|
6416
|
-
return new Promise((
|
|
6473
|
+
return new Promise((resolve3) => setTimeout(resolve3, seconds * 1e3));
|
|
6417
6474
|
}
|
|
6418
6475
|
async function pollDeviceAuthToken(options) {
|
|
6419
6476
|
const fetchImpl = options.fetch ?? fetch;
|
|
@@ -7009,6 +7066,7 @@ function flowOp(spec) {
|
|
|
7009
7066
|
type: "flow",
|
|
7010
7067
|
execute: (input) => run({
|
|
7011
7068
|
client: input.client,
|
|
7069
|
+
baseUrl: input.baseUrl,
|
|
7012
7070
|
path: parseWithSchema(spec.path, input.path, "arguments"),
|
|
7013
7071
|
body: parseWithSchema(spec.body, input.body, "flags"),
|
|
7014
7072
|
report: createFlowReporter(spec.summary)
|
|
@@ -7208,14 +7266,17 @@ function registerOperation(parent, config2, spec) {
|
|
|
7208
7266
|
const base = options.body === void 0 ? {} : parseWithSchema(zBodyObject, options.body, "--body");
|
|
7209
7267
|
const body = deepMerge(base, collectFlagValues(bodyFlags, options));
|
|
7210
7268
|
const parsed = parseWithSchema(spec.body, body, "request body");
|
|
7211
|
-
input.body = spec.transformBody ? await spec.transformBody(parsed
|
|
7269
|
+
input.body = spec.transformBody ? await spec.transformBody(parsed, {
|
|
7270
|
+
client: config2.client,
|
|
7271
|
+
path: input.path ?? {}
|
|
7272
|
+
}) : parsed;
|
|
7212
7273
|
}
|
|
7213
7274
|
const data = await callOperation(spec, input);
|
|
7214
7275
|
if (options.json === true) {
|
|
7215
7276
|
renderResult(data, true);
|
|
7216
7277
|
return;
|
|
7217
7278
|
}
|
|
7218
|
-
const formatted = spec.format(data);
|
|
7279
|
+
const formatted = spec.format(data, { baseUrl: config2.baseUrl });
|
|
7219
7280
|
renderResult(formatted.value, false, { columns: formatted.columns });
|
|
7220
7281
|
});
|
|
7221
7282
|
});
|
|
@@ -7231,6 +7292,7 @@ function registerFlow(parent, config2, spec) {
|
|
|
7231
7292
|
const options = command.opts();
|
|
7232
7293
|
await spec.execute({
|
|
7233
7294
|
client: config2.client,
|
|
7295
|
+
baseUrl: config2.baseUrl,
|
|
7234
7296
|
path: await resolvePathValues(plan, args, options, config2),
|
|
7235
7297
|
body: collectFlagValues(bodyFlags, options)
|
|
7236
7298
|
});
|
|
@@ -7249,6 +7311,7 @@ function registerGroup(program2, config2, group) {
|
|
|
7249
7311
|
// src/login.ts
|
|
7250
7312
|
import { hostname } from "node:os";
|
|
7251
7313
|
import { intro as intro2, log as log2, note as note2, outro as outro2, spinner as spinner2 } from "@clack/prompts";
|
|
7314
|
+
import * as z7 from "zod";
|
|
7252
7315
|
|
|
7253
7316
|
// src/browser.ts
|
|
7254
7317
|
import { spawn } from "node:child_process";
|
|
@@ -7346,6 +7409,14 @@ function plainReporter2() {
|
|
|
7346
7409
|
}
|
|
7347
7410
|
};
|
|
7348
7411
|
}
|
|
7412
|
+
function loginTokenName(explicit, hostName) {
|
|
7413
|
+
const candidate = explicit ?? `Omnara CLI on ${hostName}`;
|
|
7414
|
+
const result = zResourceName.safeParse(candidate);
|
|
7415
|
+
if (result.success) return result.data;
|
|
7416
|
+
if (explicit === void 0) return "Omnara CLI";
|
|
7417
|
+
throw new CliInputError(`invalid token name:
|
|
7418
|
+
${z7.prettifyError(result.error)}`);
|
|
7419
|
+
}
|
|
7349
7420
|
function registerLoginCommand(program2, cli) {
|
|
7350
7421
|
program2.command("login").description("Log in via the browser and save an API token").option("--no-browser", "print the approval URL instead of opening a browser").option("--token-name <name>", "name for the created API token").action(async (options) => {
|
|
7351
7422
|
await runCliAction(async () => {
|
|
@@ -7354,7 +7425,7 @@ function registerLoginCommand(program2, cli) {
|
|
|
7354
7425
|
const start = await startDeviceAuth({
|
|
7355
7426
|
baseUrl: cli.baseUrl,
|
|
7356
7427
|
clientName: "Omnara CLI",
|
|
7357
|
-
tokenName: options.tokenName
|
|
7428
|
+
tokenName: loginTokenName(options.tokenName, hostname())
|
|
7358
7429
|
});
|
|
7359
7430
|
report.showCode(start.userCode, start.verificationUriComplete);
|
|
7360
7431
|
if (options.browser) {
|
|
@@ -7424,7 +7495,75 @@ function registerLoginCommand(program2, cli) {
|
|
|
7424
7495
|
}
|
|
7425
7496
|
|
|
7426
7497
|
// src/manifest.ts
|
|
7427
|
-
import * as
|
|
7498
|
+
import * as z14 from "zod";
|
|
7499
|
+
|
|
7500
|
+
// src/config-attachment.ts
|
|
7501
|
+
import { readFileSync as readFileSync2 } from "node:fs";
|
|
7502
|
+
import * as z8 from "zod";
|
|
7503
|
+
var zConfigSourceAttachment = z8.object({
|
|
7504
|
+
file: z8.string().min(1).optional().describe("path to an agent config file (.yaml, .yml, or .json)"),
|
|
7505
|
+
source: z8.string().min(1).optional().describe("inline agent config source (YAML or JSON)")
|
|
7506
|
+
});
|
|
7507
|
+
var zConfigAttachment = z8.object({
|
|
7508
|
+
config: zAgentConfigId.optional().describe("existing agent config ID"),
|
|
7509
|
+
...zConfigSourceAttachment.shape
|
|
7510
|
+
});
|
|
7511
|
+
var ATTACHMENT_HINT = "pass exactly one of --config, --file, or --source";
|
|
7512
|
+
var SOURCE_HINT = "pass exactly one of --file or --source";
|
|
7513
|
+
function requireExactlyOne(values, hint) {
|
|
7514
|
+
const provided = values.filter((value) => value !== void 0);
|
|
7515
|
+
if (provided.length !== 1) throw new CliInputError(hint);
|
|
7516
|
+
}
|
|
7517
|
+
function fileFormat(filePath) {
|
|
7518
|
+
const lower = filePath.toLowerCase();
|
|
7519
|
+
if (lower.endsWith(".json")) return "json";
|
|
7520
|
+
if (lower.endsWith(".yaml") || lower.endsWith(".yml")) return "yaml";
|
|
7521
|
+
throw new CliInputError(`config file must end in .yaml, .yml, or .json: ${filePath}`);
|
|
7522
|
+
}
|
|
7523
|
+
function inlineFormat(source) {
|
|
7524
|
+
try {
|
|
7525
|
+
JSON.parse(source);
|
|
7526
|
+
return "json";
|
|
7527
|
+
} catch {
|
|
7528
|
+
return "yaml";
|
|
7529
|
+
}
|
|
7530
|
+
}
|
|
7531
|
+
function renderConfigSource(attachment) {
|
|
7532
|
+
requireExactlyOne([attachment.file, attachment.source], SOURCE_HINT);
|
|
7533
|
+
if (attachment.file !== void 0) {
|
|
7534
|
+
const format = fileFormat(attachment.file);
|
|
7535
|
+
let source;
|
|
7536
|
+
try {
|
|
7537
|
+
source = readFileSync2(attachment.file, "utf8");
|
|
7538
|
+
} catch {
|
|
7539
|
+
throw new CliInputError(`could not read config file: ${attachment.file}`);
|
|
7540
|
+
}
|
|
7541
|
+
return { source, source_format: format };
|
|
7542
|
+
}
|
|
7543
|
+
if (attachment.source !== void 0) {
|
|
7544
|
+
return { source: attachment.source, source_format: inlineFormat(attachment.source) };
|
|
7545
|
+
}
|
|
7546
|
+
throw new CliInputError(SOURCE_HINT);
|
|
7547
|
+
}
|
|
7548
|
+
var zProjectScope = z8.object({
|
|
7549
|
+
orgID: z8.string().min(1),
|
|
7550
|
+
projectID: z8.string().min(1)
|
|
7551
|
+
});
|
|
7552
|
+
async function resolveConfigId(client2, path, attachment) {
|
|
7553
|
+
requireExactlyOne([attachment.config, attachment.file, attachment.source], ATTACHMENT_HINT);
|
|
7554
|
+
if (attachment.config !== void 0) return attachment.config;
|
|
7555
|
+
const { data } = await sdk_gen_exports.createAgentConfig({
|
|
7556
|
+
client: client2,
|
|
7557
|
+
path: zProjectScope.parse(path),
|
|
7558
|
+
body: renderConfigSource(attachment)
|
|
7559
|
+
});
|
|
7560
|
+
return data.id;
|
|
7561
|
+
}
|
|
7562
|
+
var zProfilePath = zProjectScope.extend({ agentProfileID: z8.string().min(1) });
|
|
7563
|
+
async function currentProfileConfigId(client2, path) {
|
|
7564
|
+
const { data } = await sdk_gen_exports.getAgentProfile({ client: client2, path: zProfilePath.parse(path) });
|
|
7565
|
+
return data.current_config_id;
|
|
7566
|
+
}
|
|
7428
7567
|
|
|
7429
7568
|
// src/format.ts
|
|
7430
7569
|
function pickFields(source, fields) {
|
|
@@ -7451,18 +7590,332 @@ function formatVoid(message = "ok") {
|
|
|
7451
7590
|
return () => ({ value: message });
|
|
7452
7591
|
}
|
|
7453
7592
|
|
|
7593
|
+
// src/machine-setup.ts
|
|
7594
|
+
import { spawn as spawn2, spawnSync } from "node:child_process";
|
|
7595
|
+
import { accessSync, constants, existsSync as existsSync2, readdirSync, readFileSync as readFileSync3 } from "node:fs";
|
|
7596
|
+
import { homedir as homedir2 } from "node:os";
|
|
7597
|
+
import { basename, dirname as dirname2, isAbsolute, join as join2, resolve } from "node:path";
|
|
7598
|
+
import * as z9 from "zod";
|
|
7599
|
+
var zMachineSetupBody = zConnectByoMachineRequest;
|
|
7600
|
+
async function connectMachine(context) {
|
|
7601
|
+
const { client: client2, path, body, report } = context;
|
|
7602
|
+
report.start("Creating machine with a daemon token");
|
|
7603
|
+
try {
|
|
7604
|
+
const { data } = await sdk_gen_exports.connectByoMachine({ client: client2, path, body });
|
|
7605
|
+
report.stop(`Machine created: ${data.machine.id}`);
|
|
7606
|
+
if (data.project_grants.length > 0) {
|
|
7607
|
+
report.info(`Granted to ${data.project_grants.length} project(s)`);
|
|
7608
|
+
}
|
|
7609
|
+
return data;
|
|
7610
|
+
} catch (error) {
|
|
7611
|
+
report.fail("Machine could not be created");
|
|
7612
|
+
throw error;
|
|
7613
|
+
}
|
|
7614
|
+
}
|
|
7615
|
+
function shellQuote(value) {
|
|
7616
|
+
return `'${value.replaceAll("'", `'\\''`)}'`;
|
|
7617
|
+
}
|
|
7618
|
+
function installCommand(baseUrl) {
|
|
7619
|
+
return `curl -fsSL ${shellQuote(`${baseUrl}/install/omnarad.sh`)} | sh`;
|
|
7620
|
+
}
|
|
7621
|
+
var formatMachineSetup = (response, { baseUrl }) => ({
|
|
7622
|
+
value: {
|
|
7623
|
+
...response,
|
|
7624
|
+
install_command: installCommand(baseUrl),
|
|
7625
|
+
install_note: "Run install_command on the target machine and paste the token when prompted."
|
|
7626
|
+
}
|
|
7627
|
+
});
|
|
7628
|
+
var daemonConfigFileName = "daemon.json";
|
|
7629
|
+
var installLockFileName = "install.lock";
|
|
7630
|
+
var daemonLockFileName = "daemon.lock";
|
|
7631
|
+
var daemonLockPollMs = 250;
|
|
7632
|
+
var zDaemonConfigFile = z9.looseObject({
|
|
7633
|
+
machine_id: z9.string().optional(),
|
|
7634
|
+
api_url: z9.string().optional()
|
|
7635
|
+
});
|
|
7636
|
+
function daemonHome() {
|
|
7637
|
+
const override = process.env.OMNARA_HOME;
|
|
7638
|
+
if (override !== void 0 && override !== "") {
|
|
7639
|
+
if (!isAbsolute(override) || resolve(override) !== override) {
|
|
7640
|
+
throw new CliInputError("OMNARA_HOME must be an absolute clean path");
|
|
7641
|
+
}
|
|
7642
|
+
if (dirname2(override) === override) {
|
|
7643
|
+
throw new CliInputError("OMNARA_HOME cannot be a filesystem root");
|
|
7644
|
+
}
|
|
7645
|
+
return override;
|
|
7646
|
+
}
|
|
7647
|
+
const userHome = homedir2();
|
|
7648
|
+
if (userHome === "" || !isAbsolute(userHome) || userHome.trim() !== userHome) {
|
|
7649
|
+
throw new CliInputError("HOME must be an absolute path so omnarad can install under ~/.omnarad");
|
|
7650
|
+
}
|
|
7651
|
+
return join2(userHome, ".omnarad");
|
|
7652
|
+
}
|
|
7653
|
+
var supportedPlatforms = /* @__PURE__ */ new Set(["darwin", "linux"]);
|
|
7654
|
+
var supportedArchitectures = /* @__PURE__ */ new Set(["x64", "arm64"]);
|
|
7655
|
+
function ensureSupportedPlatform(platform, architecture) {
|
|
7656
|
+
if (!supportedPlatforms.has(platform)) {
|
|
7657
|
+
throw new CliInputError(`omnarad supports macOS and Linux; this machine reports ${platform}`);
|
|
7658
|
+
}
|
|
7659
|
+
if (!supportedArchitectures.has(architecture)) {
|
|
7660
|
+
throw new CliInputError(
|
|
7661
|
+
`omnarad supports amd64 and arm64; this machine reports ${architecture}`
|
|
7662
|
+
);
|
|
7663
|
+
}
|
|
7664
|
+
}
|
|
7665
|
+
function isLoopbackHost(hostname2) {
|
|
7666
|
+
if (hostname2 === "localhost" || hostname2 === "[::1]" || hostname2 === "::1") return true;
|
|
7667
|
+
const octets = hostname2.split(".");
|
|
7668
|
+
return octets.length === 4 && octets[0] === "127" && octets.every((octet) => /^\d{1,3}$/.test(octet));
|
|
7669
|
+
}
|
|
7670
|
+
function ensureDaemonApiUrl(raw) {
|
|
7671
|
+
const trimmed = raw.trim();
|
|
7672
|
+
let parsed;
|
|
7673
|
+
try {
|
|
7674
|
+
parsed = new URL(trimmed);
|
|
7675
|
+
} catch {
|
|
7676
|
+
throw new CliInputError(`omnarad rejects the API URL ${raw}: it must be an absolute URL`);
|
|
7677
|
+
}
|
|
7678
|
+
const reject = (reason) => {
|
|
7679
|
+
throw new CliInputError(`omnarad rejects the API URL ${raw}: ${reason}`);
|
|
7680
|
+
};
|
|
7681
|
+
if (parsed.protocol !== "https:" && parsed.protocol !== "http:") {
|
|
7682
|
+
reject("the scheme must be https or loopback http");
|
|
7683
|
+
}
|
|
7684
|
+
if (parsed.hostname === "") reject("a host is required");
|
|
7685
|
+
if (parsed.username !== "" || parsed.password !== "") reject("it must not contain user info");
|
|
7686
|
+
if (trimmed.includes("?") || trimmed.includes("#")) {
|
|
7687
|
+
reject("it must not contain a query or fragment");
|
|
7688
|
+
}
|
|
7689
|
+
const hostname2 = parsed.hostname.toLowerCase();
|
|
7690
|
+
if (parsed.protocol === "http:" && hostname2 !== "host.docker.internal" && !isLoopbackHost(hostname2)) {
|
|
7691
|
+
reject("it must use https unless the host is local");
|
|
7692
|
+
}
|
|
7693
|
+
}
|
|
7694
|
+
function describeDaemonConfig(configPath) {
|
|
7695
|
+
try {
|
|
7696
|
+
const config2 = zDaemonConfigFile.parse(JSON.parse(readFileSync3(configPath, "utf8")));
|
|
7697
|
+
const details = [
|
|
7698
|
+
...config2.machine_id === void 0 ? [] : [`machine ${config2.machine_id}`],
|
|
7699
|
+
...config2.api_url === void 0 ? [] : [`API ${config2.api_url}`]
|
|
7700
|
+
];
|
|
7701
|
+
return details.length === 0 ? configPath : `${configPath} (${details.join(", ")})`;
|
|
7702
|
+
} catch {
|
|
7703
|
+
return configPath;
|
|
7704
|
+
}
|
|
7705
|
+
}
|
|
7706
|
+
function describeExistingInstallation(home) {
|
|
7707
|
+
const configPath = join2(home, daemonConfigFileName);
|
|
7708
|
+
if (existsSync2(configPath)) return describeDaemonConfig(configPath);
|
|
7709
|
+
if (!existsSync2(home)) return void 0;
|
|
7710
|
+
const leftovers = readdirSync(home).filter((name) => name !== installLockFileName);
|
|
7711
|
+
return leftovers.length === 0 ? void 0 : `${home} already contains ${leftovers.join(", ")}`;
|
|
7712
|
+
}
|
|
7713
|
+
function nearestExistingAncestor(path) {
|
|
7714
|
+
const parent = dirname2(path);
|
|
7715
|
+
return existsSync2(path) || parent === path ? path : nearestExistingAncestor(parent);
|
|
7716
|
+
}
|
|
7717
|
+
function ensureDaemonHomeWritable(home) {
|
|
7718
|
+
const target = nearestExistingAncestor(home);
|
|
7719
|
+
try {
|
|
7720
|
+
accessSync(target, constants.W_OK);
|
|
7721
|
+
} catch {
|
|
7722
|
+
throw new CliInputError(`omnarad cannot be installed because ${target} is not writable`);
|
|
7723
|
+
}
|
|
7724
|
+
}
|
|
7725
|
+
var DaemonExitError = class extends Error {
|
|
7726
|
+
};
|
|
7727
|
+
async function runMachineCreateLocal(context) {
|
|
7728
|
+
const { report, baseUrl } = context;
|
|
7729
|
+
ensureSupportedPlatform(process.platform, process.arch);
|
|
7730
|
+
ensureDaemonApiUrl(baseUrl);
|
|
7731
|
+
const home = daemonHome();
|
|
7732
|
+
const existing = describeExistingInstallation(home);
|
|
7733
|
+
if (existing !== void 0) {
|
|
7734
|
+
report.warn(`omnarad is already installed on this computer: ${existing}`);
|
|
7735
|
+
report.info(
|
|
7736
|
+
[
|
|
7737
|
+
"Nothing was created. Check the daemon with: omnarad status, or start it with: omnarad restart",
|
|
7738
|
+
"To connect this computer as a new machine, run: omnarad uninstall, then re-run this command"
|
|
7739
|
+
].join("\n")
|
|
7740
|
+
);
|
|
7741
|
+
throw new CliInputError("omnarad is already installed on this machine");
|
|
7742
|
+
}
|
|
7743
|
+
ensureDaemonHomeWritable(home);
|
|
7744
|
+
const { machine, token } = await connectMachine(context);
|
|
7745
|
+
report.info(`Machine ID: ${machine.id}`);
|
|
7746
|
+
report.start("Installing omnarad on this machine");
|
|
7747
|
+
try {
|
|
7748
|
+
await runInstaller(report, baseUrl, token, machine.id, home);
|
|
7749
|
+
} catch (error) {
|
|
7750
|
+
if (error instanceof DaemonExitError) {
|
|
7751
|
+
report.fail("omnarad exited after it was installed");
|
|
7752
|
+
report.info(
|
|
7753
|
+
[
|
|
7754
|
+
`omnarad is installed and registered as machine ${machine.id}; nothing needs to be reinstalled.`,
|
|
7755
|
+
"Check the daemon with: omnarad status, or launch it again with: omnarad start"
|
|
7756
|
+
].join("\n")
|
|
7757
|
+
);
|
|
7758
|
+
throw error;
|
|
7759
|
+
}
|
|
7760
|
+
report.fail("omnarad installation failed");
|
|
7761
|
+
report.info(`Machine daemon token (shown only once):
|
|
7762
|
+
${token}`);
|
|
7763
|
+
report.url(
|
|
7764
|
+
"Finish setup by running this, then paste the machine token when prompted",
|
|
7765
|
+
installCommand(baseUrl)
|
|
7766
|
+
);
|
|
7767
|
+
throw error;
|
|
7768
|
+
}
|
|
7769
|
+
report.done();
|
|
7770
|
+
}
|
|
7771
|
+
function daemonGuidance(machineId) {
|
|
7772
|
+
return [
|
|
7773
|
+
"omnarad is connected to Omnara as this machine.",
|
|
7774
|
+
"Manage the daemon with: omnarad status | stop | restart | uninstall",
|
|
7775
|
+
`Let agents in a project use this machine with: omnara grant machines add --machine-id ${machineId}`,
|
|
7776
|
+
"Learn more: https://docs.omnara.com/machines/connect"
|
|
7777
|
+
].join("\n");
|
|
7778
|
+
}
|
|
7779
|
+
var foregroundGuidance = [
|
|
7780
|
+
"No launchd/systemd user service manager is available, so omnarad is running in the foreground.",
|
|
7781
|
+
"Its logs stream below; press Ctrl-C to stop the daemon, and run omnarad start to launch it again."
|
|
7782
|
+
].join("\n");
|
|
7783
|
+
var serviceManagerCommands = /* @__PURE__ */ new Set(["launchd", "systemd"]);
|
|
7784
|
+
function parentProcess(pid) {
|
|
7785
|
+
if (process.platform === "linux") {
|
|
7786
|
+
try {
|
|
7787
|
+
const stat = readFileSync3(`/proc/${pid}/stat`, "utf8");
|
|
7788
|
+
const fields = stat.slice(stat.lastIndexOf(")") + 2).split(" ");
|
|
7789
|
+
const ppid2 = Number(fields[1]);
|
|
7790
|
+
const parentStat = readFileSync3(`/proc/${ppid2}/stat`, "utf8");
|
|
7791
|
+
const command = parentStat.slice(parentStat.indexOf("(") + 1, parentStat.lastIndexOf(")"));
|
|
7792
|
+
return Number.isInteger(ppid2) && ppid2 > 0 ? { pid: ppid2, command } : void 0;
|
|
7793
|
+
} catch {
|
|
7794
|
+
return void 0;
|
|
7795
|
+
}
|
|
7796
|
+
}
|
|
7797
|
+
const result = spawnSync("ps", ["-o", "ppid=", "-p", String(pid)], { encoding: "utf8" });
|
|
7798
|
+
const ppid = Number(result.stdout.trim());
|
|
7799
|
+
if (result.status !== 0 || !Number.isInteger(ppid) || ppid <= 0) return void 0;
|
|
7800
|
+
const parent = spawnSync("ps", ["-o", "comm=", "-p", String(ppid)], { encoding: "utf8" });
|
|
7801
|
+
return { pid: ppid, command: basename(parent.stdout.trim()) };
|
|
7802
|
+
}
|
|
7803
|
+
function classifyDaemonSupervision(daemonPid, installerPid, lookupParent) {
|
|
7804
|
+
let current = daemonPid;
|
|
7805
|
+
for (let depth = 0; depth < 16; depth += 1) {
|
|
7806
|
+
const parent = lookupParent(current);
|
|
7807
|
+
if (parent === void 0) return void 0;
|
|
7808
|
+
if (parent.pid === installerPid) return "foreground";
|
|
7809
|
+
if (parent.pid === 1 || serviceManagerCommands.has(parent.command)) return "service";
|
|
7810
|
+
current = parent.pid;
|
|
7811
|
+
}
|
|
7812
|
+
return void 0;
|
|
7813
|
+
}
|
|
7814
|
+
function readDaemonLockPid(home) {
|
|
7815
|
+
try {
|
|
7816
|
+
const pid = Number(readFileSync3(join2(home, daemonLockFileName), "utf8").trim());
|
|
7817
|
+
return Number.isInteger(pid) && pid > 0 ? pid : void 0;
|
|
7818
|
+
} catch {
|
|
7819
|
+
return void 0;
|
|
7820
|
+
}
|
|
7821
|
+
}
|
|
7822
|
+
function installerScript(baseUrl) {
|
|
7823
|
+
return [
|
|
7824
|
+
"installer=$(mktemp)",
|
|
7825
|
+
`trap 'rm -f "$installer"' EXIT`,
|
|
7826
|
+
`curl -qfsSL --connect-timeout 10 -m 60 --max-redirs 5 --max-filesize 1048576 --proto '=http,https' --proto-redir '=https' -o "$installer" ${shellQuote(`${baseUrl}/install/omnarad.sh`)}`,
|
|
7827
|
+
'sh "$installer"'
|
|
7828
|
+
].join(" && ");
|
|
7829
|
+
}
|
|
7830
|
+
function installerFailure(code, signal, log3) {
|
|
7831
|
+
const reason = signal === null ? `exit code ${code}` : `signal ${signal}`;
|
|
7832
|
+
return new Error(`omnarad installer failed (${reason})${log3 === "" ? "" : `
|
|
7833
|
+
${log3}`}`);
|
|
7834
|
+
}
|
|
7835
|
+
function runInstaller(report, baseUrl, token, machineId, home) {
|
|
7836
|
+
return new Promise((resolve3, reject) => {
|
|
7837
|
+
const child = spawn2("/bin/sh", ["-c", installerScript(baseUrl)], {
|
|
7838
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
7839
|
+
env: { ...process.env, OMNARA_API_URL: baseUrl, OMNARA_MACHINE_TOKEN: token }
|
|
7840
|
+
});
|
|
7841
|
+
const relay = (signal) => {
|
|
7842
|
+
child.kill(signal);
|
|
7843
|
+
};
|
|
7844
|
+
process.on("SIGINT", relay);
|
|
7845
|
+
process.on("SIGTERM", relay);
|
|
7846
|
+
const buffered = [];
|
|
7847
|
+
let transcript = "";
|
|
7848
|
+
let supervision;
|
|
7849
|
+
const enterForeground = () => {
|
|
7850
|
+
supervision = "foreground";
|
|
7851
|
+
report.stop("omnarad installed");
|
|
7852
|
+
report.info(daemonGuidance(machineId));
|
|
7853
|
+
report.info(foregroundGuidance);
|
|
7854
|
+
for (const [target, data] of buffered) target.write(data);
|
|
7855
|
+
};
|
|
7856
|
+
const lockWatch = setInterval(() => {
|
|
7857
|
+
if (supervision !== void 0 || child.pid === void 0) return;
|
|
7858
|
+
const daemonPid = readDaemonLockPid(home);
|
|
7859
|
+
if (daemonPid === void 0) return;
|
|
7860
|
+
const detected = classifyDaemonSupervision(daemonPid, child.pid, parentProcess);
|
|
7861
|
+
if (detected === "foreground") enterForeground();
|
|
7862
|
+
else if (detected === "service") supervision = "service";
|
|
7863
|
+
}, daemonLockPollMs);
|
|
7864
|
+
const settle = (outcome) => {
|
|
7865
|
+
clearInterval(lockWatch);
|
|
7866
|
+
process.off("SIGINT", relay);
|
|
7867
|
+
process.off("SIGTERM", relay);
|
|
7868
|
+
outcome();
|
|
7869
|
+
};
|
|
7870
|
+
const consume = (stream) => (chunk) => {
|
|
7871
|
+
if (supervision === "foreground") {
|
|
7872
|
+
stream.write(chunk);
|
|
7873
|
+
return;
|
|
7874
|
+
}
|
|
7875
|
+
buffered.push([stream, chunk]);
|
|
7876
|
+
transcript += chunk.toString();
|
|
7877
|
+
};
|
|
7878
|
+
child.stdout.on("data", consume(process.stdout));
|
|
7879
|
+
child.stderr.on("data", consume(process.stderr));
|
|
7880
|
+
child.on("error", (error) => {
|
|
7881
|
+
settle(() => {
|
|
7882
|
+
reject(new Error(`could not run the omnarad installer: ${error.message}`));
|
|
7883
|
+
});
|
|
7884
|
+
});
|
|
7885
|
+
child.on("close", (code, signal) => {
|
|
7886
|
+
settle(() => {
|
|
7887
|
+
const foreground = supervision === "foreground";
|
|
7888
|
+
if (foreground && (code === 0 || signal === "SIGINT")) {
|
|
7889
|
+
report.info("omnarad stopped");
|
|
7890
|
+
resolve3();
|
|
7891
|
+
} else if (foreground) {
|
|
7892
|
+
const reason = signal === null ? `exit code ${code}` : `signal ${signal}`;
|
|
7893
|
+
reject(new DaemonExitError(`omnarad exited while running in the foreground (${reason})`));
|
|
7894
|
+
} else if (code === 0) {
|
|
7895
|
+
report.stop("omnarad installed and started as a background service");
|
|
7896
|
+
for (const [target, data] of buffered) target.write(data);
|
|
7897
|
+
report.info(daemonGuidance(machineId));
|
|
7898
|
+
resolve3();
|
|
7899
|
+
} else {
|
|
7900
|
+
reject(installerFailure(code, signal, transcript.trim()));
|
|
7901
|
+
}
|
|
7902
|
+
});
|
|
7903
|
+
});
|
|
7904
|
+
});
|
|
7905
|
+
}
|
|
7906
|
+
|
|
7454
7907
|
// src/mcp-add.ts
|
|
7455
7908
|
import { isMap, isScalar as isScalar2, parseDocument } from "yaml";
|
|
7456
|
-
import * as
|
|
7909
|
+
import * as z11 from "zod";
|
|
7457
7910
|
|
|
7458
7911
|
// src/mcp-oauth.ts
|
|
7459
|
-
import * as
|
|
7912
|
+
import * as z10 from "zod";
|
|
7460
7913
|
|
|
7461
7914
|
// src/poll.ts
|
|
7462
7915
|
var POLL_INTERVAL_SECONDS = 2;
|
|
7463
7916
|
var MAX_CONSECUTIVE_POLL_FAILURES = 3;
|
|
7464
7917
|
function sleep(seconds) {
|
|
7465
|
-
return new Promise((
|
|
7918
|
+
return new Promise((resolve3) => setTimeout(resolve3, seconds * 1e3));
|
|
7466
7919
|
}
|
|
7467
7920
|
async function pollUntilDeadline(options) {
|
|
7468
7921
|
const deadline = Date.parse(options.expiresAt);
|
|
@@ -7504,7 +7957,7 @@ async function authorizeMcpOAuthSecret(options) {
|
|
|
7504
7957
|
}
|
|
7505
7958
|
});
|
|
7506
7959
|
}
|
|
7507
|
-
var zBrowserFlag =
|
|
7960
|
+
var zBrowserFlag = z10.boolean().default(true).describe("open the authorization URL in a browser");
|
|
7508
7961
|
function openAuthorizationUrl(report, title, url3, browser) {
|
|
7509
7962
|
report.url(title, url3);
|
|
7510
7963
|
if (browser) {
|
|
@@ -7540,11 +7993,11 @@ async function runMcpOAuth(context) {
|
|
|
7540
7993
|
// src/mcp-add.ts
|
|
7541
7994
|
var SERVER_KEY_PATTERN = /^[a-zA-Z][a-zA-Z0-9-]{0,31}$/;
|
|
7542
7995
|
var zMcpAddBody = zMcpoAuthStartRequest.omit({ owner: true, name: true }).extend({
|
|
7543
|
-
server_name:
|
|
7996
|
+
server_name: z11.string().regex(
|
|
7544
7997
|
SERVER_KEY_PATTERN,
|
|
7545
7998
|
"must start with a letter and contain at most 32 letters, digits, or hyphens"
|
|
7546
7999
|
).describe("MCP server key used in the agent config"),
|
|
7547
|
-
secret_name:
|
|
8000
|
+
secret_name: zResourceName.optional().describe("OAuth secret name; defaults to <server-name>-mcp"),
|
|
7548
8001
|
browser: zBrowserFlag
|
|
7549
8002
|
});
|
|
7550
8003
|
function targetLabel(target) {
|
|
@@ -7553,7 +8006,7 @@ function targetLabel(target) {
|
|
|
7553
8006
|
function serverEntry(url3, secretId) {
|
|
7554
8007
|
return { url: url3, auth: { type: "oauth", secret_id: secretId } };
|
|
7555
8008
|
}
|
|
7556
|
-
var zJsonRecord =
|
|
8009
|
+
var zJsonRecord = z11.record(z11.string(), z11.json());
|
|
7557
8010
|
function prepareJsonConfig(config2, serverName, mcpUrl) {
|
|
7558
8011
|
let parsedJson;
|
|
7559
8012
|
try {
|
|
@@ -7717,18 +8170,18 @@ function runProfileMcpAdd(context) {
|
|
|
7717
8170
|
}
|
|
7718
8171
|
|
|
7719
8172
|
// src/skill-archive.ts
|
|
7720
|
-
import { readdirSync, readFileSync as
|
|
7721
|
-
import { basename, dirname as
|
|
8173
|
+
import { readdirSync as readdirSync2, readFileSync as readFileSync4, statSync } from "node:fs";
|
|
8174
|
+
import { basename as basename2, dirname as dirname3, join as join3, resolve as resolve2 } from "node:path";
|
|
7722
8175
|
import * as tar from "tar";
|
|
7723
|
-
import * as
|
|
7724
|
-
var zCreateSkillCliBody =
|
|
8176
|
+
import * as z12 from "zod";
|
|
8177
|
+
var zCreateSkillCliBody = z12.object({
|
|
7725
8178
|
owner: zSkillOwnerInput,
|
|
7726
|
-
archive:
|
|
8179
|
+
archive: z12.string().min(1).describe("path to a skill directory (packed automatically) or a .zip/.tar.gz archive")
|
|
7727
8180
|
});
|
|
7728
8181
|
var ARCHIVE_SUFFIXES = [".zip", ".tar.gz", ".tgz"];
|
|
7729
8182
|
function assertPackable(dir) {
|
|
7730
|
-
for (const entry of
|
|
7731
|
-
const fullPath =
|
|
8183
|
+
for (const entry of readdirSync2(dir, { withFileTypes: true })) {
|
|
8184
|
+
const fullPath = join3(dir, entry.name);
|
|
7732
8185
|
if (entry.isSymbolicLink()) {
|
|
7733
8186
|
throw new CliInputError(`cannot pack ${fullPath}: symlinks are not allowed in skill archives`);
|
|
7734
8187
|
}
|
|
@@ -7737,9 +8190,9 @@ function assertPackable(dir) {
|
|
|
7737
8190
|
}
|
|
7738
8191
|
}
|
|
7739
8192
|
async function packDirectory(dir) {
|
|
7740
|
-
const root =
|
|
8193
|
+
const root = resolve2(dir);
|
|
7741
8194
|
assertPackable(root);
|
|
7742
|
-
const stream = tar.create({ cwd:
|
|
8195
|
+
const stream = tar.create({ cwd: dirname3(root), gzip: true, portable: true }, [basename2(root)]);
|
|
7743
8196
|
const chunks = [];
|
|
7744
8197
|
for await (const chunk of stream) chunks.push(chunk);
|
|
7745
8198
|
return Buffer.concat(chunks);
|
|
@@ -7753,28 +8206,28 @@ async function loadSkillArchive(archivePath) {
|
|
|
7753
8206
|
}
|
|
7754
8207
|
if (isDirectory) {
|
|
7755
8208
|
const buffer = await packDirectory(archivePath);
|
|
7756
|
-
return new File([new Uint8Array(buffer)], `${
|
|
8209
|
+
return new File([new Uint8Array(buffer)], `${basename2(resolve2(archivePath))}.tar.gz`);
|
|
7757
8210
|
}
|
|
7758
|
-
const filename =
|
|
8211
|
+
const filename = basename2(archivePath);
|
|
7759
8212
|
if (!ARCHIVE_SUFFIXES.some((suffix) => filename.toLowerCase().endsWith(suffix))) {
|
|
7760
8213
|
throw new CliInputError(
|
|
7761
8214
|
`archive must be a directory or a ${ARCHIVE_SUFFIXES.join("/")} file: ${archivePath}`
|
|
7762
8215
|
);
|
|
7763
8216
|
}
|
|
7764
|
-
return new File([new Uint8Array(
|
|
8217
|
+
return new File([new Uint8Array(readFileSync4(archivePath))], filename);
|
|
7765
8218
|
}
|
|
7766
8219
|
|
|
7767
8220
|
// src/slack-integration.ts
|
|
7768
|
-
import * as
|
|
7769
|
-
var zSlackBody =
|
|
7770
|
-
app_name:
|
|
7771
|
-
app_configuration_token:
|
|
7772
|
-
icon_filename:
|
|
7773
|
-
icon_data_base64:
|
|
7774
|
-
client_id:
|
|
7775
|
-
client_secret:
|
|
7776
|
-
signing_secret:
|
|
7777
|
-
return_to:
|
|
8221
|
+
import * as z13 from "zod";
|
|
8222
|
+
var zSlackBody = z13.object({
|
|
8223
|
+
app_name: z13.string().optional().describe("name for a new Slack app"),
|
|
8224
|
+
app_configuration_token: z13.string().optional().describe("Slack app configuration token for a new app"),
|
|
8225
|
+
icon_filename: z13.string().optional().describe("filename for the new Slack app icon"),
|
|
8226
|
+
icon_data_base64: z13.string().optional().describe("base64-encoded Slack app icon"),
|
|
8227
|
+
client_id: z13.string().optional().describe("existing Slack app client ID"),
|
|
8228
|
+
client_secret: z13.string().optional().describe("existing Slack app client secret"),
|
|
8229
|
+
signing_secret: z13.string().optional().describe("existing Slack app signing secret"),
|
|
8230
|
+
return_to: z13.string().optional().describe("console-relative path opened after authorization"),
|
|
7778
8231
|
browser: zBrowserFlag
|
|
7779
8232
|
});
|
|
7780
8233
|
function parseRequest(body) {
|
|
@@ -7803,7 +8256,7 @@ function parseRequest(body) {
|
|
|
7803
8256
|
if (!result2.success) {
|
|
7804
8257
|
throw new CliInputError(
|
|
7805
8258
|
`invalid existing Slack app parameters:
|
|
7806
|
-
${
|
|
8259
|
+
${z13.prettifyError(result2.error)}`
|
|
7807
8260
|
);
|
|
7808
8261
|
}
|
|
7809
8262
|
return { kind: "existing-app", body: result2.data };
|
|
@@ -7825,7 +8278,7 @@ ${z10.prettifyError(result2.error)}`
|
|
|
7825
8278
|
if (!result.success) {
|
|
7826
8279
|
throw new CliInputError(
|
|
7827
8280
|
`invalid Slack app parameters:
|
|
7828
|
-
${
|
|
8281
|
+
${z13.prettifyError(result.error)}
|
|
7829
8282
|
Pass --app-name and --app-configuration-token, or existing app credentials.`
|
|
7830
8283
|
);
|
|
7831
8284
|
}
|
|
@@ -7917,7 +8370,31 @@ var commandGroups = [
|
|
|
7917
8370
|
fn: sdk_gen_exports.createAgent,
|
|
7918
8371
|
format: formatRecord(),
|
|
7919
8372
|
path: zCreateAgentPath,
|
|
7920
|
-
body:
|
|
8373
|
+
body: zConfigAttachment.extend({
|
|
8374
|
+
profile: zAgentProfileId.optional(),
|
|
8375
|
+
name: zAgentName.optional(),
|
|
8376
|
+
message: z14.string().optional()
|
|
8377
|
+
}),
|
|
8378
|
+
transformBody: async ({ profile, name, message, ...attachment }, { client: client2, path }) => ({
|
|
8379
|
+
profile,
|
|
8380
|
+
name,
|
|
8381
|
+
message,
|
|
8382
|
+
config: await resolveConfigId(client2, path, attachment)
|
|
8383
|
+
})
|
|
8384
|
+
}),
|
|
8385
|
+
op({
|
|
8386
|
+
verb: "update",
|
|
8387
|
+
summary: "Replace a running agent's config",
|
|
8388
|
+
fn: sdk_gen_exports.updateAgentConfig,
|
|
8389
|
+
format: (response) => formatRecord()(response.agent_config),
|
|
8390
|
+
path: zUpdateAgentConfigPath,
|
|
8391
|
+
body: zConfigSourceAttachment.extend({
|
|
8392
|
+
expected_current_config_id: zAgentConfigId.optional().describe("fail unless the agent still runs this config")
|
|
8393
|
+
}),
|
|
8394
|
+
transformBody: ({ expected_current_config_id, ...attachment }) => ({
|
|
8395
|
+
...renderConfigSource(attachment),
|
|
8396
|
+
expected_current_config_id
|
|
8397
|
+
})
|
|
7921
8398
|
}),
|
|
7922
8399
|
op({
|
|
7923
8400
|
verb: "cancel",
|
|
@@ -7937,7 +8414,7 @@ var commandGroups = [
|
|
|
7937
8414
|
flowOp({
|
|
7938
8415
|
verb: "mcp-add",
|
|
7939
8416
|
summary: "Create an OAuth secret and add an MCP server to an agent",
|
|
7940
|
-
path:
|
|
8417
|
+
path: z14.object({
|
|
7941
8418
|
orgID: zOrganizationId,
|
|
7942
8419
|
projectID: zProjectId,
|
|
7943
8420
|
agentID: zAgentId
|
|
@@ -8182,11 +8659,18 @@ var commandGroups = [
|
|
|
8182
8659
|
}),
|
|
8183
8660
|
op({
|
|
8184
8661
|
verb: "create",
|
|
8185
|
-
summary: "Create a machine",
|
|
8186
|
-
fn: sdk_gen_exports.
|
|
8187
|
-
format:
|
|
8188
|
-
path:
|
|
8189
|
-
body:
|
|
8662
|
+
summary: "Create a machine with a daemon token and show how to install omnarad",
|
|
8663
|
+
fn: sdk_gen_exports.connectByoMachine,
|
|
8664
|
+
format: formatMachineSetup,
|
|
8665
|
+
path: zConnectByoMachinePath,
|
|
8666
|
+
body: zConnectByoMachineBody
|
|
8667
|
+
}),
|
|
8668
|
+
flowOp({
|
|
8669
|
+
verb: "create-local",
|
|
8670
|
+
summary: "Create a machine and install omnarad on this machine",
|
|
8671
|
+
path: zConnectByoMachinePath,
|
|
8672
|
+
body: zMachineSetupBody,
|
|
8673
|
+
run: runMachineCreateLocal
|
|
8190
8674
|
}),
|
|
8191
8675
|
op({
|
|
8192
8676
|
verb: "update",
|
|
@@ -8399,7 +8883,7 @@ var commandGroups = [
|
|
|
8399
8883
|
flowOp({
|
|
8400
8884
|
verb: "mcp-oauth",
|
|
8401
8885
|
summary: "Create a secret through an MCP server OAuth flow",
|
|
8402
|
-
path:
|
|
8886
|
+
path: z14.object({ orgID: zOrganizationId }),
|
|
8403
8887
|
body: zMcpOAuthBody,
|
|
8404
8888
|
run: runMcpOAuth
|
|
8405
8889
|
})
|
|
@@ -8472,7 +8956,28 @@ var commandGroups = [
|
|
|
8472
8956
|
fn: sdk_gen_exports.createAgentProfile,
|
|
8473
8957
|
format: formatRecord(),
|
|
8474
8958
|
path: zCreateAgentProfilePath,
|
|
8475
|
-
body:
|
|
8959
|
+
body: zConfigAttachment.extend({ name: zResourceName }),
|
|
8960
|
+
transformBody: async ({ name, ...attachment }, { client: client2, path }) => ({
|
|
8961
|
+
name,
|
|
8962
|
+
config: await resolveConfigId(client2, path, attachment)
|
|
8963
|
+
})
|
|
8964
|
+
}),
|
|
8965
|
+
op({
|
|
8966
|
+
verb: "update",
|
|
8967
|
+
summary: "Point an agent profile at a new config",
|
|
8968
|
+
fn: sdk_gen_exports.updateAgentProfile,
|
|
8969
|
+
format: formatRecord(),
|
|
8970
|
+
path: zUpdateAgentProfilePath,
|
|
8971
|
+
body: zConfigAttachment.extend({
|
|
8972
|
+
expected_current_config_id: zAgentConfigId.optional().describe("fail unless the profile still points at this config")
|
|
8973
|
+
}),
|
|
8974
|
+
transformBody: async ({ expected_current_config_id, ...attachment }, { client: client2, path }) => {
|
|
8975
|
+
const expected = expected_current_config_id ?? await currentProfileConfigId(client2, path);
|
|
8976
|
+
return {
|
|
8977
|
+
config: await resolveConfigId(client2, path, attachment),
|
|
8978
|
+
expected_current_config_id: expected
|
|
8979
|
+
};
|
|
8980
|
+
}
|
|
8476
8981
|
}),
|
|
8477
8982
|
op({
|
|
8478
8983
|
verb: "rename",
|
|
@@ -8492,7 +8997,7 @@ var commandGroups = [
|
|
|
8492
8997
|
flowOp({
|
|
8493
8998
|
verb: "mcp-add",
|
|
8494
8999
|
summary: "Create an OAuth secret and add an MCP server to an agent profile",
|
|
8495
|
-
path:
|
|
9000
|
+
path: z14.object({
|
|
8496
9001
|
orgID: zOrganizationId,
|
|
8497
9002
|
projectID: zProjectId,
|
|
8498
9003
|
agentProfileID: zAgentProfileId
|
|
@@ -8504,7 +9009,7 @@ var commandGroups = [
|
|
|
8504
9009
|
verb: "slack",
|
|
8505
9010
|
aliases: ["slack-setup"],
|
|
8506
9011
|
summary: "Connect Slack to an agent profile through OAuth",
|
|
8507
|
-
path:
|
|
9012
|
+
path: z14.object({
|
|
8508
9013
|
orgID: zOrganizationId,
|
|
8509
9014
|
projectID: zProjectId,
|
|
8510
9015
|
agentProfileID: zAgentProfileId
|
package/package.json
CHANGED