@autohq/cli 0.1.129 → 0.1.130

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/index.js CHANGED
@@ -16052,7 +16052,7 @@ var init_zod = __esm({
16052
16052
  });
16053
16053
 
16054
16054
  // ../../packages/schemas/src/ids.ts
16055
- var OpaqueIdSchema, ProfileIdSchema, EnvironmentIdSchema, ConnectionIdSchema, ExternalAccountIdSchema, OrganizationIdSchema, ProjectIdSchema, ProviderGrantIdSchema, ServiceAccountIdSchema, SessionIdSchema, SessionRunIdSchema, SessionRunCommandIdSchema, RuntimeIdSchema, RuntimeBridgeLeaseIdSchema, EnvironmentSetupSnapshotIdSchema, ToolIdSchema, UserIdSchema;
16055
+ var OpaqueIdSchema, ProfileIdSchema, EnvironmentIdSchema, IdentityIdSchema, ConnectionIdSchema, ExternalAccountIdSchema, OrganizationIdSchema, ProjectIdSchema, ProviderGrantIdSchema, ServiceAccountIdSchema, SessionIdSchema, SessionRunIdSchema, SessionRunCommandIdSchema, RuntimeIdSchema, RuntimeBridgeLeaseIdSchema, EnvironmentSetupSnapshotIdSchema, ToolIdSchema, UserIdSchema;
16056
16056
  var init_ids = __esm({
16057
16057
  "../../packages/schemas/src/ids.ts"() {
16058
16058
  "use strict";
@@ -16060,6 +16060,7 @@ var init_ids = __esm({
16060
16060
  OpaqueIdSchema = external_exports.string().trim().min(1);
16061
16061
  ProfileIdSchema = OpaqueIdSchema.brand();
16062
16062
  EnvironmentIdSchema = OpaqueIdSchema.brand();
16063
+ IdentityIdSchema = OpaqueIdSchema.brand();
16063
16064
  ConnectionIdSchema = OpaqueIdSchema.brand();
16064
16065
  ExternalAccountIdSchema = OpaqueIdSchema.brand();
16065
16066
  OrganizationIdSchema = OpaqueIdSchema.brand();
@@ -17431,193 +17432,6 @@ var init_github_mcp_catalog = __esm({
17431
17432
  }
17432
17433
  });
17433
17434
 
17434
- // ../../packages/schemas/src/secrets.ts
17435
- var SECRET_ENCRYPTION_ALGORITHM, SecretEnvNameSchema, SecretCiphertextFieldSchema, SecretAesGcmIvSchema, SecretAesGcmAuthTagSchema, SecretEnvValueSchema, SecretEnvSchema, EncryptedSecretValueSchema, SecretSetRequestSchema, SecretMetadataSchema, SecretSetResponseSchema, SecretListResponseSchema, SecretDeleteResponseSchema;
17436
- var init_secrets = __esm({
17437
- "../../packages/schemas/src/secrets.ts"() {
17438
- "use strict";
17439
- init_zod();
17440
- init_resources();
17441
- SECRET_ENCRYPTION_ALGORITHM = "AES-256-GCM";
17442
- SecretEnvNameSchema = external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/);
17443
- SecretCiphertextFieldSchema = external_exports.string().trim().min(1).regex(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/);
17444
- SecretAesGcmIvSchema = external_exports.string().trim().regex(/^[A-Za-z0-9+/]{16}$/);
17445
- SecretAesGcmAuthTagSchema = external_exports.string().trim().regex(/^[A-Za-z0-9+/]{22}==$/);
17446
- SecretEnvValueSchema = external_exports.union([
17447
- external_exports.string(),
17448
- external_exports.object({
17449
- $secret: ResourceNameSchema,
17450
- optional: external_exports.boolean().optional()
17451
- })
17452
- ]);
17453
- SecretEnvSchema = external_exports.record(
17454
- SecretEnvNameSchema,
17455
- SecretEnvValueSchema
17456
- );
17457
- EncryptedSecretValueSchema = external_exports.object({
17458
- keyVersion: external_exports.string().trim().min(1),
17459
- algorithm: external_exports.literal(SECRET_ENCRYPTION_ALGORITHM),
17460
- ciphertext: SecretCiphertextFieldSchema,
17461
- valueIv: SecretAesGcmIvSchema,
17462
- valueAuthTag: SecretAesGcmAuthTagSchema,
17463
- encryptedDek: SecretCiphertextFieldSchema,
17464
- dekIv: SecretAesGcmIvSchema,
17465
- dekAuthTag: SecretAesGcmAuthTagSchema
17466
- });
17467
- SecretSetRequestSchema = external_exports.object({
17468
- value: external_exports.string()
17469
- });
17470
- SecretMetadataSchema = external_exports.object({
17471
- id: external_exports.string().trim().min(1),
17472
- organizationId: external_exports.string().trim().min(1),
17473
- projectId: external_exports.string().trim().min(1).nullable(),
17474
- name: ResourceNameSchema,
17475
- createdAt: external_exports.string().datetime(),
17476
- updatedAt: external_exports.string().datetime()
17477
- });
17478
- SecretSetResponseSchema = external_exports.object({
17479
- secret: SecretMetadataSchema
17480
- });
17481
- SecretListResponseSchema = external_exports.object({
17482
- secrets: external_exports.array(SecretMetadataSchema)
17483
- });
17484
- SecretDeleteResponseSchema = external_exports.object({
17485
- secret: SecretMetadataSchema
17486
- });
17487
- }
17488
- });
17489
-
17490
- // ../../packages/schemas/src/environments.ts
17491
- function environmentSetupSchema(cachePathSchema) {
17492
- return external_exports.object({
17493
- name: ResourceNameSchema,
17494
- commands: external_exports.array(external_exports.string().trim().min(1)).min(1),
17495
- cache: external_exports.object({
17496
- key: ResourceNameSchema.optional(),
17497
- files: external_exports.array(
17498
- external_exports.string().trim().refine(isSafeRelativePath, {
17499
- message: "Expected a relative path without traversal"
17500
- })
17501
- ).default([]),
17502
- paths: external_exports.array(cachePathSchema).default([])
17503
- }).strict().default({ files: [], paths: [] })
17504
- }).strict();
17505
- }
17506
- function environmentSpecSchema(setupSchema) {
17507
- return external_exports.object({
17508
- image: EnvironmentImageSchema,
17509
- env: SecretEnvSchema.default({}),
17510
- resources: EnvironmentResourcesSchema.optional(),
17511
- steps: external_exports.array(external_exports.string()).default([]),
17512
- setup: external_exports.array(setupSchema).default([]),
17513
- setupCache: EnvironmentSetupCacheSchema.optional()
17514
- }).strict();
17515
- }
17516
- function isSafeSandboxUserHomePath(value, options = {}) {
17517
- return (options.allowedHomes ?? [CURRENT_SANDBOX_USER_HOME]).some(
17518
- (home) => isSafePathUnderHome(value, home)
17519
- );
17520
- }
17521
- function isSafePathUnderHome(value, home) {
17522
- const prefix = `${home}/`;
17523
- if (!value.startsWith(prefix)) {
17524
- return false;
17525
- }
17526
- const relative = value.slice(prefix.length);
17527
- return relative.split("/").every((segment) => segment !== "" && segment !== "." && segment !== "..");
17528
- }
17529
- function isSafeRelativePath(value) {
17530
- if (!value || value.startsWith("/")) {
17531
- return false;
17532
- }
17533
- return value.split("/").every((segment) => segment !== "" && segment !== "." && segment !== "..");
17534
- }
17535
- function isSetupCacheTtl(value) {
17536
- return /^[1-9][0-9]*(s|m|h|d)$/.test(value);
17537
- }
17538
- var RESOURCE_KIND_ENVIRONMENT, CURRENT_SANDBOX_USER_HOME, LEGACY_SANDBOX_USER_HOMES, STORED_SANDBOX_USER_HOMES, EnvironmentSetupCachePathSchema, StoredEnvironmentSetupCachePathSchema, EnvironmentImageSchema, EnvironmentSetupSchema, EnvironmentApplySetupSchema, EnvironmentSetupCacheSchema, EnvironmentResourcesSchema, EnvironmentSpecSchema, EnvironmentApplySpecSchema, EnvironmentResourceSchema, EnvironmentApplyRequestSchema;
17539
- var init_environments = __esm({
17540
- "../../packages/schemas/src/environments.ts"() {
17541
- "use strict";
17542
- init_zod();
17543
- init_resources();
17544
- init_secrets();
17545
- RESOURCE_KIND_ENVIRONMENT = "environment";
17546
- CURRENT_SANDBOX_USER_HOME = "/home/user";
17547
- LEGACY_SANDBOX_USER_HOMES = ["/home/auto", "/home/node"];
17548
- STORED_SANDBOX_USER_HOMES = [
17549
- CURRENT_SANDBOX_USER_HOME,
17550
- ...LEGACY_SANDBOX_USER_HOMES
17551
- ];
17552
- EnvironmentSetupCachePathSchema = external_exports.string().trim().refine((value) => isSafeSandboxUserHomePath(value), {
17553
- message: `Expected an absolute path under ${CURRENT_SANDBOX_USER_HOME}`
17554
- });
17555
- StoredEnvironmentSetupCachePathSchema = external_exports.string().trim().refine(
17556
- (value) => isSafeSandboxUserHomePath(value, {
17557
- allowedHomes: STORED_SANDBOX_USER_HOMES
17558
- }),
17559
- {
17560
- message: `Expected an absolute path under ${CURRENT_SANDBOX_USER_HOME}`
17561
- }
17562
- );
17563
- EnvironmentImageSchema = external_exports.object({
17564
- kind: external_exports.literal("preset"),
17565
- name: ResourceNameSchema
17566
- }).strict();
17567
- EnvironmentSetupSchema = environmentSetupSchema(
17568
- StoredEnvironmentSetupCachePathSchema
17569
- );
17570
- EnvironmentApplySetupSchema = environmentSetupSchema(
17571
- EnvironmentSetupCachePathSchema
17572
- );
17573
- EnvironmentSetupCacheSchema = external_exports.object({
17574
- ttl: external_exports.string().trim().refine(isSetupCacheTtl, {
17575
- message: "Expected a positive setup cache TTL such as 30m, 24h, or 7d"
17576
- })
17577
- }).strict();
17578
- EnvironmentResourcesSchema = external_exports.object({
17579
- cpuCount: external_exports.number().int().min(1).optional(),
17580
- memoryMB: external_exports.number().int().min(128).optional()
17581
- }).strict().refine(
17582
- (resources) => resources.cpuCount !== void 0 || resources.memoryMB !== void 0,
17583
- {
17584
- message: "Expected at least one runtime resource setting"
17585
- }
17586
- );
17587
- EnvironmentSpecSchema = environmentSpecSchema(
17588
- EnvironmentSetupSchema
17589
- );
17590
- EnvironmentApplySpecSchema = environmentSpecSchema(
17591
- EnvironmentApplySetupSchema
17592
- );
17593
- EnvironmentResourceSchema = resourceEnvelopeSchema(
17594
- EnvironmentSpecSchema
17595
- );
17596
- EnvironmentApplyRequestSchema = resourceApplySchema(
17597
- EnvironmentApplySpecSchema
17598
- );
17599
- }
17600
- });
17601
-
17602
- // ../../packages/schemas/src/mcp.ts
17603
- var McpToolCallMessageSchema, McpJsonRpcMessageSchema, McpPostBodySchema;
17604
- var init_mcp = __esm({
17605
- "../../packages/schemas/src/mcp.ts"() {
17606
- "use strict";
17607
- init_zod();
17608
- McpToolCallMessageSchema = external_exports.object({
17609
- method: external_exports.literal("tools/call"),
17610
- params: external_exports.object({
17611
- name: external_exports.string().trim().min(1)
17612
- })
17613
- });
17614
- McpJsonRpcMessageSchema = external_exports.object({
17615
- method: external_exports.string().optional()
17616
- }).passthrough();
17617
- McpPostBodySchema = external_exports.union([McpJsonRpcMessageSchema, external_exports.array(McpJsonRpcMessageSchema)]).transform((body) => Array.isArray(body) ? body : [body]);
17618
- }
17619
- });
17620
-
17621
17435
  // ../../packages/schemas/src/mounts.ts
17622
17436
  var AbsoluteMountPathSchema, GITHUB_MOUNT_CAPABILITY_LEVELS, GithubMountCapabilityLevelSchema, GITHUB_MOUNT_MERGE_CAPABILITY_LEVELS, GithubMountMergeCapabilityLevelSchema, DEFAULT_GITHUB_MOUNT_CAPABILITIES, GitMountAuthSchema, GitMountSchema, SessionMountSchema;
17623
17437
  var init_mounts = __esm({
@@ -17696,43 +17510,58 @@ var init_mounts = __esm({
17696
17510
  }
17697
17511
  });
17698
17512
 
17699
- // ../../packages/schemas/src/project-service-accounts.ts
17700
- var ProjectServiceAccountSchema, ProjectServiceAccountCreateRequestSchema, ProjectServiceAccountUpdateRequestSchema, ProjectServiceAccountTokenResponseSchema, ProjectServiceAccountUpdateResponseSchema, ProjectServiceAccountRemoveResponseSchema, ProjectServiceAccountListResponseSchema;
17701
- var init_project_service_accounts = __esm({
17702
- "../../packages/schemas/src/project-service-accounts.ts"() {
17513
+ // ../../packages/schemas/src/secrets.ts
17514
+ var SECRET_ENCRYPTION_ALGORITHM, SecretEnvNameSchema, SecretCiphertextFieldSchema, SecretAesGcmIvSchema, SecretAesGcmAuthTagSchema, SecretEnvValueSchema, SecretEnvSchema, EncryptedSecretValueSchema, SecretSetRequestSchema, SecretMetadataSchema, SecretSetResponseSchema, SecretListResponseSchema, SecretDeleteResponseSchema;
17515
+ var init_secrets = __esm({
17516
+ "../../packages/schemas/src/secrets.ts"() {
17703
17517
  "use strict";
17704
17518
  init_zod();
17705
- init_auth();
17706
- init_ids();
17707
17519
  init_resources();
17708
- ProjectServiceAccountSchema = external_exports.object({
17709
- id: ServiceAccountIdSchema,
17710
- organizationId: OrganizationIdSchema,
17711
- projectId: ProjectIdSchema,
17712
- name: ResourceNameSchema,
17713
- scopes: external_exports.array(AuthScopeSchema),
17714
- createdAt: external_exports.string().datetime()
17715
- });
17716
- ProjectServiceAccountCreateRequestSchema = external_exports.object({
17717
- name: ResourceNameSchema,
17718
- scopes: external_exports.array(AuthScopeSchema).min(1)
17520
+ SECRET_ENCRYPTION_ALGORITHM = "AES-256-GCM";
17521
+ SecretEnvNameSchema = external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/);
17522
+ SecretCiphertextFieldSchema = external_exports.string().trim().min(1).regex(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/);
17523
+ SecretAesGcmIvSchema = external_exports.string().trim().regex(/^[A-Za-z0-9+/]{16}$/);
17524
+ SecretAesGcmAuthTagSchema = external_exports.string().trim().regex(/^[A-Za-z0-9+/]{22}==$/);
17525
+ SecretEnvValueSchema = external_exports.union([
17526
+ external_exports.string(),
17527
+ external_exports.object({
17528
+ $secret: ResourceNameSchema,
17529
+ optional: external_exports.boolean().optional()
17530
+ })
17531
+ ]);
17532
+ SecretEnvSchema = external_exports.record(
17533
+ SecretEnvNameSchema,
17534
+ SecretEnvValueSchema
17535
+ );
17536
+ EncryptedSecretValueSchema = external_exports.object({
17537
+ keyVersion: external_exports.string().trim().min(1),
17538
+ algorithm: external_exports.literal(SECRET_ENCRYPTION_ALGORITHM),
17539
+ ciphertext: SecretCiphertextFieldSchema,
17540
+ valueIv: SecretAesGcmIvSchema,
17541
+ valueAuthTag: SecretAesGcmAuthTagSchema,
17542
+ encryptedDek: SecretCiphertextFieldSchema,
17543
+ dekIv: SecretAesGcmIvSchema,
17544
+ dekAuthTag: SecretAesGcmAuthTagSchema
17719
17545
  });
17720
- ProjectServiceAccountUpdateRequestSchema = external_exports.object({
17721
- scopes: external_exports.array(AuthScopeSchema).min(1)
17546
+ SecretSetRequestSchema = external_exports.object({
17547
+ value: external_exports.string()
17722
17548
  });
17723
- ProjectServiceAccountTokenResponseSchema = external_exports.object({
17724
- serviceAccount: ProjectServiceAccountSchema,
17725
- token: external_exports.string().min(1)
17549
+ SecretMetadataSchema = external_exports.object({
17550
+ id: external_exports.string().trim().min(1),
17551
+ organizationId: external_exports.string().trim().min(1),
17552
+ projectId: external_exports.string().trim().min(1).nullable(),
17553
+ name: ResourceNameSchema,
17554
+ createdAt: external_exports.string().datetime(),
17555
+ updatedAt: external_exports.string().datetime()
17726
17556
  });
17727
- ProjectServiceAccountUpdateResponseSchema = external_exports.object({
17728
- serviceAccount: ProjectServiceAccountSchema
17557
+ SecretSetResponseSchema = external_exports.object({
17558
+ secret: SecretMetadataSchema
17729
17559
  });
17730
- ProjectServiceAccountRemoveResponseSchema = external_exports.object({
17731
- serviceAccount: ProjectServiceAccountSchema,
17732
- removed: external_exports.literal(true)
17560
+ SecretListResponseSchema = external_exports.object({
17561
+ secrets: external_exports.array(SecretMetadataSchema)
17733
17562
  });
17734
- ProjectServiceAccountListResponseSchema = external_exports.object({
17735
- serviceAccounts: external_exports.array(ProjectServiceAccountSchema)
17563
+ SecretDeleteResponseSchema = external_exports.object({
17564
+ secret: SecretMetadataSchema
17736
17565
  });
17737
17566
  }
17738
17567
  });
@@ -18436,13 +18265,13 @@ var init_sessions = __esm({
18436
18265
  }
18437
18266
  ).optional()
18438
18267
  }).strict().refine((identity2) => Object.keys(identity2).length > 0, {
18439
- message: "Session identity requires at least one field"
18268
+ message: "Identity requires at least one field"
18440
18269
  });
18441
18270
  SessionSpecFieldsSchema = external_exports.object({
18442
18271
  harness: external_exports.enum(SESSION_HARNESSES).optional(),
18443
18272
  systemPrompt: external_exports.string().trim().min(1).max(1e5).optional(),
18444
18273
  environment: ResourceNameSchema.optional(),
18445
- identity: SessionIdentitySchema.optional(),
18274
+ identity: external_exports.union([ResourceNameSchema, SessionIdentitySchema]).optional(),
18446
18275
  initialPrompt: external_exports.string().trim().min(1).max(2e4).optional(),
18447
18276
  env: SecretEnvSchema.default({}),
18448
18277
  mounts: external_exports.array(SessionMountSchema).default([]),
@@ -18578,13 +18407,200 @@ var init_sessions = __esm({
18578
18407
  }
18579
18408
  });
18580
18409
 
18410
+ // ../../packages/schemas/src/identities.ts
18411
+ var RESOURCE_KIND_IDENTITY, IdentitySpecSchema, IdentityResourceSchema, IdentityApplyRequestSchema;
18412
+ var init_identities = __esm({
18413
+ "../../packages/schemas/src/identities.ts"() {
18414
+ "use strict";
18415
+ init_resources();
18416
+ init_sessions();
18417
+ RESOURCE_KIND_IDENTITY = "identity";
18418
+ IdentitySpecSchema = SessionIdentitySchema;
18419
+ IdentityResourceSchema = resourceEnvelopeSchema(IdentitySpecSchema);
18420
+ IdentityApplyRequestSchema = resourceApplySchema(IdentitySpecSchema);
18421
+ }
18422
+ });
18423
+
18424
+ // ../../packages/schemas/src/environments.ts
18425
+ function environmentSetupSchema(cachePathSchema) {
18426
+ return external_exports.object({
18427
+ name: ResourceNameSchema,
18428
+ commands: external_exports.array(external_exports.string().trim().min(1)).min(1),
18429
+ cache: external_exports.object({
18430
+ key: ResourceNameSchema.optional(),
18431
+ files: external_exports.array(
18432
+ external_exports.string().trim().refine(isSafeRelativePath, {
18433
+ message: "Expected a relative path without traversal"
18434
+ })
18435
+ ).default([]),
18436
+ paths: external_exports.array(cachePathSchema).default([])
18437
+ }).strict().default({ files: [], paths: [] })
18438
+ }).strict();
18439
+ }
18440
+ function environmentSpecSchema(setupSchema) {
18441
+ return external_exports.object({
18442
+ image: EnvironmentImageSchema,
18443
+ env: SecretEnvSchema.default({}),
18444
+ resources: EnvironmentResourcesSchema.optional(),
18445
+ steps: external_exports.array(external_exports.string()).default([]),
18446
+ setup: external_exports.array(setupSchema).default([]),
18447
+ setupCache: EnvironmentSetupCacheSchema.optional()
18448
+ }).strict();
18449
+ }
18450
+ function isSafeSandboxUserHomePath(value, options = {}) {
18451
+ return (options.allowedHomes ?? [CURRENT_SANDBOX_USER_HOME]).some(
18452
+ (home) => isSafePathUnderHome(value, home)
18453
+ );
18454
+ }
18455
+ function isSafePathUnderHome(value, home) {
18456
+ const prefix = `${home}/`;
18457
+ if (!value.startsWith(prefix)) {
18458
+ return false;
18459
+ }
18460
+ const relative = value.slice(prefix.length);
18461
+ return relative.split("/").every((segment) => segment !== "" && segment !== "." && segment !== "..");
18462
+ }
18463
+ function isSafeRelativePath(value) {
18464
+ if (!value || value.startsWith("/")) {
18465
+ return false;
18466
+ }
18467
+ return value.split("/").every((segment) => segment !== "" && segment !== "." && segment !== "..");
18468
+ }
18469
+ function isSetupCacheTtl(value) {
18470
+ return /^[1-9][0-9]*(s|m|h|d)$/.test(value);
18471
+ }
18472
+ var RESOURCE_KIND_ENVIRONMENT, CURRENT_SANDBOX_USER_HOME, LEGACY_SANDBOX_USER_HOMES, STORED_SANDBOX_USER_HOMES, EnvironmentSetupCachePathSchema, StoredEnvironmentSetupCachePathSchema, EnvironmentImageSchema, EnvironmentSetupSchema, EnvironmentApplySetupSchema, EnvironmentSetupCacheSchema, EnvironmentResourcesSchema, EnvironmentSpecSchema, EnvironmentApplySpecSchema, EnvironmentResourceSchema, EnvironmentApplyRequestSchema;
18473
+ var init_environments = __esm({
18474
+ "../../packages/schemas/src/environments.ts"() {
18475
+ "use strict";
18476
+ init_zod();
18477
+ init_resources();
18478
+ init_secrets();
18479
+ RESOURCE_KIND_ENVIRONMENT = "environment";
18480
+ CURRENT_SANDBOX_USER_HOME = "/home/user";
18481
+ LEGACY_SANDBOX_USER_HOMES = ["/home/auto", "/home/node"];
18482
+ STORED_SANDBOX_USER_HOMES = [
18483
+ CURRENT_SANDBOX_USER_HOME,
18484
+ ...LEGACY_SANDBOX_USER_HOMES
18485
+ ];
18486
+ EnvironmentSetupCachePathSchema = external_exports.string().trim().refine((value) => isSafeSandboxUserHomePath(value), {
18487
+ message: `Expected an absolute path under ${CURRENT_SANDBOX_USER_HOME}`
18488
+ });
18489
+ StoredEnvironmentSetupCachePathSchema = external_exports.string().trim().refine(
18490
+ (value) => isSafeSandboxUserHomePath(value, {
18491
+ allowedHomes: STORED_SANDBOX_USER_HOMES
18492
+ }),
18493
+ {
18494
+ message: `Expected an absolute path under ${CURRENT_SANDBOX_USER_HOME}`
18495
+ }
18496
+ );
18497
+ EnvironmentImageSchema = external_exports.object({
18498
+ kind: external_exports.literal("preset"),
18499
+ name: ResourceNameSchema
18500
+ }).strict();
18501
+ EnvironmentSetupSchema = environmentSetupSchema(
18502
+ StoredEnvironmentSetupCachePathSchema
18503
+ );
18504
+ EnvironmentApplySetupSchema = environmentSetupSchema(
18505
+ EnvironmentSetupCachePathSchema
18506
+ );
18507
+ EnvironmentSetupCacheSchema = external_exports.object({
18508
+ ttl: external_exports.string().trim().refine(isSetupCacheTtl, {
18509
+ message: "Expected a positive setup cache TTL such as 30m, 24h, or 7d"
18510
+ })
18511
+ }).strict();
18512
+ EnvironmentResourcesSchema = external_exports.object({
18513
+ cpuCount: external_exports.number().int().min(1).optional(),
18514
+ memoryMB: external_exports.number().int().min(128).optional()
18515
+ }).strict().refine(
18516
+ (resources) => resources.cpuCount !== void 0 || resources.memoryMB !== void 0,
18517
+ {
18518
+ message: "Expected at least one runtime resource setting"
18519
+ }
18520
+ );
18521
+ EnvironmentSpecSchema = environmentSpecSchema(
18522
+ EnvironmentSetupSchema
18523
+ );
18524
+ EnvironmentApplySpecSchema = environmentSpecSchema(
18525
+ EnvironmentApplySetupSchema
18526
+ );
18527
+ EnvironmentResourceSchema = resourceEnvelopeSchema(
18528
+ EnvironmentSpecSchema
18529
+ );
18530
+ EnvironmentApplyRequestSchema = resourceApplySchema(
18531
+ EnvironmentApplySpecSchema
18532
+ );
18533
+ }
18534
+ });
18535
+
18536
+ // ../../packages/schemas/src/mcp.ts
18537
+ var McpToolCallMessageSchema, McpJsonRpcMessageSchema, McpPostBodySchema;
18538
+ var init_mcp = __esm({
18539
+ "../../packages/schemas/src/mcp.ts"() {
18540
+ "use strict";
18541
+ init_zod();
18542
+ McpToolCallMessageSchema = external_exports.object({
18543
+ method: external_exports.literal("tools/call"),
18544
+ params: external_exports.object({
18545
+ name: external_exports.string().trim().min(1)
18546
+ })
18547
+ });
18548
+ McpJsonRpcMessageSchema = external_exports.object({
18549
+ method: external_exports.string().optional()
18550
+ }).passthrough();
18551
+ McpPostBodySchema = external_exports.union([McpJsonRpcMessageSchema, external_exports.array(McpJsonRpcMessageSchema)]).transform((body) => Array.isArray(body) ? body : [body]);
18552
+ }
18553
+ });
18554
+
18555
+ // ../../packages/schemas/src/project-service-accounts.ts
18556
+ var ProjectServiceAccountSchema, ProjectServiceAccountCreateRequestSchema, ProjectServiceAccountUpdateRequestSchema, ProjectServiceAccountTokenResponseSchema, ProjectServiceAccountUpdateResponseSchema, ProjectServiceAccountRemoveResponseSchema, ProjectServiceAccountListResponseSchema;
18557
+ var init_project_service_accounts = __esm({
18558
+ "../../packages/schemas/src/project-service-accounts.ts"() {
18559
+ "use strict";
18560
+ init_zod();
18561
+ init_auth();
18562
+ init_ids();
18563
+ init_resources();
18564
+ ProjectServiceAccountSchema = external_exports.object({
18565
+ id: ServiceAccountIdSchema,
18566
+ organizationId: OrganizationIdSchema,
18567
+ projectId: ProjectIdSchema,
18568
+ name: ResourceNameSchema,
18569
+ scopes: external_exports.array(AuthScopeSchema),
18570
+ createdAt: external_exports.string().datetime()
18571
+ });
18572
+ ProjectServiceAccountCreateRequestSchema = external_exports.object({
18573
+ name: ResourceNameSchema,
18574
+ scopes: external_exports.array(AuthScopeSchema).min(1)
18575
+ });
18576
+ ProjectServiceAccountUpdateRequestSchema = external_exports.object({
18577
+ scopes: external_exports.array(AuthScopeSchema).min(1)
18578
+ });
18579
+ ProjectServiceAccountTokenResponseSchema = external_exports.object({
18580
+ serviceAccount: ProjectServiceAccountSchema,
18581
+ token: external_exports.string().min(1)
18582
+ });
18583
+ ProjectServiceAccountUpdateResponseSchema = external_exports.object({
18584
+ serviceAccount: ProjectServiceAccountSchema
18585
+ });
18586
+ ProjectServiceAccountRemoveResponseSchema = external_exports.object({
18587
+ serviceAccount: ProjectServiceAccountSchema,
18588
+ removed: external_exports.literal(true)
18589
+ });
18590
+ ProjectServiceAccountListResponseSchema = external_exports.object({
18591
+ serviceAccounts: external_exports.array(ProjectServiceAccountSchema)
18592
+ });
18593
+ }
18594
+ });
18595
+
18581
18596
  // ../../packages/schemas/src/project-resources.ts
18582
- var EnvironmentApplyDocumentSchema, ToolApplyDocumentSchema, SessionApplyDocumentSchema, ProjectApplyResourceSchema, PROJECT_RESOURCE_APPLY_ORDER, PROJECT_RESOURCE_KINDS, ProjectDeleteResourceSchema, AVATAR_ASSET_CONTENT_TYPES, MAX_AVATAR_ASSET_BASE64_LENGTH, ProjectApplyAssetSchema, ProjectApplyAssetsSchema, AvatarAssetUploadRequestSchema, AvatarAssetUploadResponseSchema, ProjectApplyRequestSchema, ProjectApplySystemConfigSchema, ProjectAppliedResourceSchema, ProjectApplyDiagnosticSchema, ProjectApplyResponseSchema;
18597
+ var EnvironmentApplyDocumentSchema, IdentityApplyDocumentSchema, ToolApplyDocumentSchema, SessionApplyDocumentSchema, ProjectApplyResourceSchema, PROJECT_RESOURCE_APPLY_ORDER, PROJECT_RESOURCE_KINDS, ProjectDeleteResourceSchema, AVATAR_ASSET_CONTENT_TYPES, MAX_AVATAR_ASSET_BASE64_LENGTH, ProjectApplyAssetSchema, ProjectApplyAssetsSchema, AvatarAssetUploadRequestSchema, AvatarAssetUploadResponseSchema, ProjectApplyRequestSchema, ProjectApplySystemConfigSchema, ProjectAppliedResourceSchema, ProjectApplyDiagnosticSchema, ProjectApplyResponseSchema;
18583
18598
  var init_project_resources = __esm({
18584
18599
  "../../packages/schemas/src/project-resources.ts"() {
18585
18600
  "use strict";
18586
18601
  init_zod();
18587
18602
  init_environments();
18603
+ init_identities();
18588
18604
  init_resources();
18589
18605
  init_sessions();
18590
18606
  init_tools();
@@ -18592,6 +18608,10 @@ var init_project_resources = __esm({
18592
18608
  RESOURCE_KIND_ENVIRONMENT,
18593
18609
  EnvironmentApplyRequestSchema.shape.spec
18594
18610
  );
18611
+ IdentityApplyDocumentSchema = resourceApplyDocumentSchema(
18612
+ RESOURCE_KIND_IDENTITY,
18613
+ IdentityApplyRequestSchema.shape.spec
18614
+ );
18595
18615
  ToolApplyDocumentSchema = resourceApplyDocumentSchema(
18596
18616
  RESOURCE_KIND_TOOL,
18597
18617
  ToolApplyRequestSchema.shape.spec
@@ -18602,11 +18622,13 @@ var init_project_resources = __esm({
18602
18622
  );
18603
18623
  ProjectApplyResourceSchema = external_exports.discriminatedUnion("kind", [
18604
18624
  EnvironmentApplyDocumentSchema,
18625
+ IdentityApplyDocumentSchema,
18605
18626
  ToolApplyDocumentSchema,
18606
18627
  SessionApplyDocumentSchema
18607
18628
  ]);
18608
18629
  PROJECT_RESOURCE_APPLY_ORDER = [
18609
18630
  RESOURCE_KIND_ENVIRONMENT,
18631
+ RESOURCE_KIND_IDENTITY,
18610
18632
  RESOURCE_KIND_TOOL,
18611
18633
  RESOURCE_KIND_SESSION
18612
18634
  ];
@@ -18652,6 +18674,7 @@ var init_project_resources = __esm({
18652
18674
  });
18653
18675
  ProjectAppliedResourceSchema = external_exports.union([
18654
18676
  EnvironmentResourceSchema,
18677
+ IdentityResourceSchema,
18655
18678
  ToolResourceSchema,
18656
18679
  SessionResourceSchema
18657
18680
  ]);
@@ -18663,6 +18686,7 @@ var init_project_resources = __esm({
18663
18686
  action: external_exports.enum(["create", "update", "unchanged"]),
18664
18687
  kind: external_exports.enum([
18665
18688
  RESOURCE_KIND_ENVIRONMENT,
18689
+ RESOURCE_KIND_IDENTITY,
18666
18690
  RESOURCE_KIND_TOOL,
18667
18691
  RESOURCE_KIND_SESSION
18668
18692
  ]),
@@ -18678,6 +18702,7 @@ var init_project_resources = __esm({
18678
18702
  action: external_exports.enum(["create", "update", "unchanged", "archive"]),
18679
18703
  kind: external_exports.enum([
18680
18704
  RESOURCE_KIND_ENVIRONMENT,
18705
+ RESOURCE_KIND_IDENTITY,
18681
18706
  RESOURCE_KIND_TOOL,
18682
18707
  RESOURCE_KIND_SESSION
18683
18708
  ]),
@@ -18689,6 +18714,7 @@ var init_project_resources = __esm({
18689
18714
  external_exports.object({
18690
18715
  kind: external_exports.enum([
18691
18716
  RESOURCE_KIND_ENVIRONMENT,
18717
+ RESOURCE_KIND_IDENTITY,
18692
18718
  RESOURCE_KIND_TOOL,
18693
18719
  RESOURCE_KIND_SESSION
18694
18720
  ]),
@@ -19416,6 +19442,7 @@ var init_src = __esm({
19416
19442
  init_connections();
19417
19443
  init_github_credentials();
19418
19444
  init_github_mcp_catalog();
19445
+ init_identities();
19419
19446
  init_ids();
19420
19447
  init_environments();
19421
19448
  init_mcp();
@@ -19631,6 +19658,13 @@ function createResourceApi(context) {
19631
19658
  path: "/tools",
19632
19659
  applyResponseSchema: ToolResourceSchema
19633
19660
  });
19661
+ const identities = projectResource(
19662
+ context,
19663
+ {
19664
+ path: "/identities",
19665
+ applyResponseSchema: IdentityResourceSchema
19666
+ }
19667
+ );
19634
19668
  return {
19635
19669
  applyEnvironmentResource: environments.apply,
19636
19670
  hasAvatarAsset: (request, options) => hasAvatarAsset(context, request, options ?? {}),
@@ -19645,6 +19679,7 @@ function createResourceApi(context) {
19645
19679
  createProjectServiceAccount: (request, options) => createProjectServiceAccount(context, request, options ?? {}),
19646
19680
  deleteProjectResource: (request, options) => deleteProjectResource(context, request, options ?? {}),
19647
19681
  listEnvironments: environments.list,
19682
+ listIdentities: identities.list,
19648
19683
  listProjectServiceAccounts: (options) => listProjectServiceAccounts(context, options ?? {}),
19649
19684
  listSessions: sessions.list,
19650
19685
  listTools: tools.list,
@@ -21190,7 +21225,7 @@ var init_package = __esm({
21190
21225
  "package.json"() {
21191
21226
  package_default = {
21192
21227
  name: "@autohq/cli",
21193
- version: "0.1.129",
21228
+ version: "0.1.130",
21194
21229
  license: "SEE LICENSE IN README.md",
21195
21230
  publishConfig: {
21196
21231
  access: "public"
@@ -21437,28 +21472,39 @@ async function uploadAvatarAsset2(client, asset, apiBaseUrl) {
21437
21472
  }
21438
21473
  }
21439
21474
  function stampAvatarSha256(resource, assets) {
21440
- if (resource.kind !== "session") {
21441
- return resource;
21442
- }
21443
- const identity2 = resource.spec.identity;
21444
- const avatar = identity2?.avatar;
21445
- if (!identity2 || !avatar) {
21446
- return resource;
21447
- }
21448
- const asset = assets[avatar.asset];
21449
- if (!asset) {
21450
- return resource;
21451
- }
21452
- return {
21453
- ...resource,
21454
- spec: {
21455
- ...resource.spec,
21456
- identity: {
21457
- ...identity2,
21475
+ if (resource.kind === "identity") {
21476
+ const avatar = resource.spec.avatar;
21477
+ const asset = avatar ? assets[avatar.asset] : void 0;
21478
+ if (!avatar || !asset) {
21479
+ return resource;
21480
+ }
21481
+ return {
21482
+ ...resource,
21483
+ spec: {
21484
+ ...resource.spec,
21458
21485
  avatar: { asset: avatar.asset, sha256: asset.sha256 }
21459
21486
  }
21487
+ };
21488
+ }
21489
+ if (resource.kind === "session" && typeof resource.spec.identity === "object" && resource.spec.identity !== null && !Array.isArray(resource.spec.identity)) {
21490
+ const identity2 = resource.spec.identity;
21491
+ const avatar = identity2.avatar;
21492
+ const asset = avatar ? assets[avatar.asset] : void 0;
21493
+ if (!avatar || !asset) {
21494
+ return resource;
21460
21495
  }
21461
- };
21496
+ return {
21497
+ ...resource,
21498
+ spec: {
21499
+ ...resource.spec,
21500
+ identity: {
21501
+ ...identity2,
21502
+ avatar: { asset: avatar.asset, sha256: asset.sha256 }
21503
+ }
21504
+ }
21505
+ };
21506
+ }
21507
+ return resource;
21462
21508
  }
21463
21509
  function formatMegabytes(bytes) {
21464
21510
  return (bytes / (1024 * 1024)).toFixed(1);
@@ -21624,26 +21670,23 @@ function readApplyDocument(document) {
21624
21670
  function readApplyAssets(resources, projectRoot) {
21625
21671
  const assets = {};
21626
21672
  for (const resource of resources) {
21627
- if (resource.kind !== RESOURCE_KIND_SESSION) {
21628
- continue;
21629
- }
21630
- const avatarAsset = resource.spec.identity?.avatar?.asset;
21631
- if (!avatarAsset || assets[avatarAsset]) {
21673
+ const target = avatarAssetTarget(resource);
21674
+ if (!target || assets[target.asset]) {
21632
21675
  continue;
21633
21676
  }
21634
21677
  const resolvedPath = validateSessionAvatarAsset({
21635
- asset: avatarAsset,
21636
- resourceName: resource.metadata.name,
21678
+ asset: target.asset,
21679
+ resourceName: target.resourceName,
21637
21680
  projectRoot
21638
21681
  });
21639
21682
  const bytes = readFileSync3(resolvedPath);
21640
21683
  const dimensionsProblem = avatarAssetDimensionsProblem(bytes);
21641
21684
  if (dimensionsProblem) {
21642
21685
  throw new Error(
21643
- `Invalid session identity avatar asset for "${resource.metadata.name}": ${dimensionsProblem}`
21686
+ `Invalid identity avatar asset for "${target.resourceName}": ${dimensionsProblem}`
21644
21687
  );
21645
21688
  }
21646
- assets[avatarAsset] = {
21689
+ assets[target.asset] = {
21647
21690
  sha256: createHash3("sha256").update(bytes).digest("hex"),
21648
21691
  contentType: extname(resolvedPath).toLowerCase() === ".png" ? "image/png" : "image/jpeg",
21649
21692
  dataBase64: bytes.toString("base64")
@@ -21651,16 +21694,27 @@ function readApplyAssets(resources, projectRoot) {
21651
21694
  }
21652
21695
  return assets;
21653
21696
  }
21697
+ function avatarAssetTarget(resource) {
21698
+ if (resource.kind === RESOURCE_KIND_IDENTITY) {
21699
+ const asset = resource.spec.avatar?.asset;
21700
+ return asset ? { asset, resourceName: resource.metadata.name } : void 0;
21701
+ }
21702
+ if (resource.kind === RESOURCE_KIND_SESSION && typeof resource.spec.identity === "object" && resource.spec.identity !== null && !Array.isArray(resource.spec.identity)) {
21703
+ const asset = resource.spec.identity.avatar?.asset;
21704
+ return asset ? { asset, resourceName: resource.metadata.name } : void 0;
21705
+ }
21706
+ return void 0;
21707
+ }
21654
21708
  function validateSessionAvatarAsset(input) {
21655
21709
  if (isAbsolute(input.asset)) {
21656
21710
  throw new Error(
21657
- `Invalid session identity avatar asset for "${input.resourceName}": asset path must be relative`
21711
+ `Invalid identity avatar asset for "${input.resourceName}": asset path must be relative`
21658
21712
  );
21659
21713
  }
21660
21714
  const relativeAssetPath = input.asset.replaceAll("\\", "/");
21661
21715
  if (!relativeAssetPath.startsWith(".auto/assets/") && relativeAssetPath !== ".auto/assets") {
21662
21716
  throw new Error(
21663
- `Invalid session identity avatar asset for "${input.resourceName}": asset path must be under .auto/assets`
21717
+ `Invalid identity avatar asset for "${input.resourceName}": asset path must be under .auto/assets`
21664
21718
  );
21665
21719
  }
21666
21720
  const projectRoot = realpathSync(input.projectRoot);
@@ -21670,7 +21724,7 @@ function validateSessionAvatarAsset(input) {
21670
21724
  assetsRoot = realpathSync(resolve(projectRoot, ".auto", "assets"));
21671
21725
  } catch {
21672
21726
  throw new Error(
21673
- `Invalid session identity avatar asset for "${input.resourceName}": .auto/assets directory does not exist`
21727
+ `Invalid identity avatar asset for "${input.resourceName}": .auto/assets directory does not exist`
21674
21728
  );
21675
21729
  }
21676
21730
  let resolvedAssetPath;
@@ -21680,28 +21734,28 @@ function validateSessionAvatarAsset(input) {
21680
21734
  stat = statSync(resolvedAssetPath);
21681
21735
  } catch {
21682
21736
  throw new Error(
21683
- `Invalid session identity avatar asset for "${input.resourceName}": ${input.asset} does not exist`
21737
+ `Invalid identity avatar asset for "${input.resourceName}": ${input.asset} does not exist`
21684
21738
  );
21685
21739
  }
21686
21740
  if (!(resolvedAssetPath === assetsRoot || isInside(resolvedAssetPath, assetsRoot))) {
21687
21741
  throw new Error(
21688
- `Invalid session identity avatar asset for "${input.resourceName}": asset path must stay inside .auto/assets`
21742
+ `Invalid identity avatar asset for "${input.resourceName}": asset path must stay inside .auto/assets`
21689
21743
  );
21690
21744
  }
21691
21745
  if (!stat.isFile()) {
21692
21746
  throw new Error(
21693
- `Invalid session identity avatar asset for "${input.resourceName}": asset must be a file`
21747
+ `Invalid identity avatar asset for "${input.resourceName}": asset must be a file`
21694
21748
  );
21695
21749
  }
21696
21750
  if (stat.size > MAX_AVATAR_ASSET_BYTES) {
21697
21751
  throw new Error(
21698
- `Invalid session identity avatar asset for "${input.resourceName}": asset must be ${MAX_AVATAR_ASSET_BYTES} bytes or smaller`
21752
+ `Invalid identity avatar asset for "${input.resourceName}": asset must be ${MAX_AVATAR_ASSET_BYTES} bytes or smaller`
21699
21753
  );
21700
21754
  }
21701
21755
  const extension = extname(resolvedAssetPath).toLowerCase();
21702
21756
  if (!ALLOWED_AVATAR_EXTENSIONS.has(extension)) {
21703
21757
  throw new Error(
21704
- `Invalid session identity avatar asset for "${input.resourceName}": asset must be a PNG or JPEG image`
21758
+ `Invalid identity avatar asset for "${input.resourceName}": asset must be a PNG or JPEG image`
21705
21759
  );
21706
21760
  }
21707
21761
  return resolvedAssetPath;
@@ -21770,11 +21824,13 @@ var init_files = __esm({
21770
21824
  init_src();
21771
21825
  APPLY_DIRECTORIES = {
21772
21826
  environment: "environments",
21827
+ identity: "identities",
21773
21828
  tool: "tools",
21774
21829
  session: "sessions"
21775
21830
  };
21776
21831
  APPLY_SCHEMAS = {
21777
21832
  environment: EnvironmentApplyRequestSchema,
21833
+ identity: IdentityApplyRequestSchema,
21778
21834
  tool: ToolApplyRequestSchema,
21779
21835
  session: SessionApplyRequestSchema
21780
21836
  };
@@ -21946,6 +22002,8 @@ async function listProjectResources2(client, kind, options) {
21946
22002
  switch (kind) {
21947
22003
  case RESOURCE_KIND_ENVIRONMENT:
21948
22004
  return (await client.listEnvironments(options)).environments;
22005
+ case RESOURCE_KIND_IDENTITY:
22006
+ return (await client.listIdentities(options)).identities;
21949
22007
  case RESOURCE_KIND_TOOL:
21950
22008
  return (await client.listTools(options)).tools;
21951
22009
  case RESOURCE_KIND_SESSION:
@@ -21980,6 +22038,12 @@ var init_resources3 = __esm({
21980
22038
  label: "Tool",
21981
22039
  pluralLabel: "Tools"
21982
22040
  },
22041
+ [RESOURCE_KIND_IDENTITY]: {
22042
+ kind: RESOURCE_KIND_IDENTITY,
22043
+ section: "identities",
22044
+ label: "Identity",
22045
+ pluralLabel: "Identities"
22046
+ },
21983
22047
  [RESOURCE_KIND_SESSION]: {
21984
22048
  kind: RESOURCE_KIND_SESSION,
21985
22049
  section: "sessions",
@@ -21989,6 +22053,7 @@ var init_resources3 = __esm({
21989
22053
  };
21990
22054
  PROJECT_RESOURCE_TUI_ORDER = [
21991
22055
  RESOURCE_KIND_SESSION,
22056
+ RESOURCE_KIND_IDENTITY,
21992
22057
  RESOURCE_KIND_ENVIRONMENT,
21993
22058
  RESOURCE_KIND_TOOL
21994
22059
  ];
@@ -24443,6 +24508,32 @@ function ToolsView({
24443
24508
  }
24444
24509
  );
24445
24510
  }
24511
+ function IdentitiesView({
24512
+ resources,
24513
+ selectedIndex,
24514
+ error: error51
24515
+ }) {
24516
+ return /* @__PURE__ */ jsx9(
24517
+ ResourceTable,
24518
+ {
24519
+ rows: resources.map((identity2) => ({
24520
+ id: identity2.metadata.uid,
24521
+ name: identity2.metadata.name,
24522
+ kind: identity2.spec.displayName ?? "",
24523
+ target: identity2.spec.username ?? "",
24524
+ detail: identity2.spec.avatar?.asset ?? identity2.spec.description ?? "",
24525
+ updatedAt: identity2.metadata.updatedAt
24526
+ })),
24527
+ selectedIndex,
24528
+ error: error51,
24529
+ empty: "no identities found",
24530
+ kindHeader: "DISPLAY",
24531
+ targetHeader: "USERNAME",
24532
+ detailHeader: "AVATAR / DESCRIPTION",
24533
+ flexColumn: "detail"
24534
+ }
24535
+ );
24536
+ }
24446
24537
  function ServiceAccountsView({
24447
24538
  resources,
24448
24539
  selectedIndex,
@@ -24627,6 +24718,10 @@ function useEnvironments(apiUrl) {
24627
24718
  const client = useApiClient();
24628
24719
  return useQuery(environmentsQueryOptions(client, apiUrl));
24629
24720
  }
24721
+ function useIdentities(apiUrl) {
24722
+ const client = useApiClient();
24723
+ return useQuery(identitiesQueryOptions(client, apiUrl));
24724
+ }
24630
24725
  function useTools(apiUrl) {
24631
24726
  const client = useApiClient();
24632
24727
  return useQuery(toolsQueryOptions(client, apiUrl));
@@ -24904,6 +24999,14 @@ function environmentsQueryOptions(client, apiUrl) {
24904
24999
  staleTime: Number.POSITIVE_INFINITY
24905
25000
  });
24906
25001
  }
25002
+ function identitiesQueryOptions(client, apiUrl) {
25003
+ return queryOptions({
25004
+ queryKey: queryKeys.identities(apiUrl),
25005
+ queryFn: async () => (await client.listIdentities({ apiBaseUrl: apiUrl })).identities,
25006
+ select: sortByName,
25007
+ staleTime: Number.POSITIVE_INFINITY
25008
+ });
25009
+ }
24907
25010
  function sessionsQueryOptions(client, apiUrl) {
24908
25011
  return queryOptions({
24909
25012
  queryKey: queryKeys.sessions(apiUrl),
@@ -24999,6 +25102,7 @@ var init_queries = __esm({
24999
25102
  TUI_RUN_LIST_LIMIT = 200;
25000
25103
  queryKeys = {
25001
25104
  environments: (apiUrl) => ["environments", apiUrl],
25105
+ identities: (apiUrl) => ["identities", apiUrl],
25002
25106
  sessions: (apiUrl) => ["sessions", apiUrl],
25003
25107
  tools: (apiUrl) => ["tools", apiUrl],
25004
25108
  projects: (apiUrl) => ["projects", apiUrl],
@@ -25463,6 +25567,8 @@ function selectedNamedResourceForSection(input) {
25463
25567
  switch (input.activeSection) {
25464
25568
  case "environments":
25465
25569
  return input.selectedEnvironment ?? null;
25570
+ case "identities":
25571
+ return input.selectedIdentity ?? null;
25466
25572
  case "sessions":
25467
25573
  return input.selectedSession ?? null;
25468
25574
  case "tools":
@@ -25505,6 +25611,7 @@ function HomeView({ apiUrl, notice, returnToSession }) {
25505
25611
  );
25506
25612
  const [sessionIndex, setSessionIndex] = useState3(0);
25507
25613
  const [environmentIndex, setEnvironmentIndex] = useState3(0);
25614
+ const [identityIndex, setIdentityIndex] = useState3(0);
25508
25615
  const [toolIndex, setToolIndex] = useState3(0);
25509
25616
  const [projectIndex, setProjectIndex] = useState3(0);
25510
25617
  const [serviceAccountIndex, setServiceAccountIndex] = useState3(0);
@@ -25540,6 +25647,11 @@ function HomeView({ apiUrl, notice, returnToSession }) {
25540
25647
  isLoading: isEnvironmentsLoading,
25541
25648
  error: environmentsError
25542
25649
  } = useEnvironments(apiUrl);
25650
+ const {
25651
+ data: identities = [],
25652
+ isLoading: isIdentitiesLoading,
25653
+ error: identitiesError
25654
+ } = useIdentities(apiUrl);
25543
25655
  const {
25544
25656
  data: tools = [],
25545
25657
  isLoading: isToolsLoading,
@@ -25632,11 +25744,13 @@ function HomeView({ apiUrl, notice, returnToSession }) {
25632
25744
  const selectedServiceAccount = serviceAccounts[serviceAccountIndex];
25633
25745
  const selectedSession = sessions[sessionIndex];
25634
25746
  const selectedEnvironment = environments[environmentIndex];
25747
+ const selectedIdentity = identities[identityIndex];
25635
25748
  const selectedTool = tools[toolIndex];
25636
25749
  const selectedInspectableResource = useMemo3(() => {
25637
25750
  const selectedEditable = editableResourceForSelection({
25638
25751
  activeSection,
25639
25752
  selectedEnvironment,
25753
+ selectedIdentity,
25640
25754
  selectedSession,
25641
25755
  selectedTool
25642
25756
  });
@@ -25656,6 +25770,12 @@ function HomeView({ apiUrl, notice, returnToSession }) {
25656
25770
  name: selectedEditable.name,
25657
25771
  spec: selectedEnvironment.spec
25658
25772
  } : null;
25773
+ case "identities":
25774
+ return selectedIdentity ? {
25775
+ kind: selectedEditable.kind,
25776
+ name: selectedEditable.name,
25777
+ spec: selectedIdentity.spec
25778
+ } : null;
25659
25779
  case "tools":
25660
25780
  return selectedTool ? {
25661
25781
  kind: selectedEditable.kind,
@@ -25665,15 +25785,28 @@ function HomeView({ apiUrl, notice, returnToSession }) {
25665
25785
  default:
25666
25786
  return null;
25667
25787
  }
25668
- }, [activeSection, selectedEnvironment, selectedSession, selectedTool]);
25788
+ }, [
25789
+ activeSection,
25790
+ selectedEnvironment,
25791
+ selectedIdentity,
25792
+ selectedSession,
25793
+ selectedTool
25794
+ ]);
25669
25795
  const selectedEditableResource = useMemo3(
25670
25796
  () => editableResourceForSelection({
25671
25797
  activeSection,
25672
25798
  selectedEnvironment,
25799
+ selectedIdentity,
25673
25800
  selectedSession,
25674
25801
  selectedTool
25675
25802
  }),
25676
- [activeSection, selectedEnvironment, selectedSession, selectedTool]
25803
+ [
25804
+ activeSection,
25805
+ selectedEnvironment,
25806
+ selectedIdentity,
25807
+ selectedSession,
25808
+ selectedTool
25809
+ ]
25677
25810
  );
25678
25811
  const inspectPanelHeight = Math.max(1, termHeight - 12);
25679
25812
  const scopedSession = runScopeSessionName ? sessions.find((session) => session.metadata.name === runScopeSessionName) : void 0;
@@ -26267,6 +26400,16 @@ function HomeView({ apiUrl, notice, returnToSession }) {
26267
26400
  return;
26268
26401
  }
26269
26402
  }
26403
+ if (activeSection === "identities") {
26404
+ if (key.upArrow) {
26405
+ setIdentityIndex((i) => Math.max(0, i - 1));
26406
+ return;
26407
+ }
26408
+ if (key.downArrow) {
26409
+ setIdentityIndex((i) => clampListIndex(i + 1, identities.length));
26410
+ return;
26411
+ }
26412
+ }
26270
26413
  if (activeSection === "tools") {
26271
26414
  if (key.upArrow) {
26272
26415
  setToolIndex((i) => Math.max(0, i - 1));
@@ -26557,9 +26700,10 @@ function HomeView({ apiUrl, notice, returnToSession }) {
26557
26700
  sectionTitle = `Service Accounts[${serviceAccounts.length}]`;
26558
26701
  break;
26559
26702
  case "environments":
26703
+ case "identities":
26560
26704
  case "tools": {
26561
26705
  const definition = PROJECT_RESOURCE_TUI_DEFINITIONS_BY_SECTION.get(activeSection);
26562
- const count = activeSection === "environments" ? environments.length : tools.length;
26706
+ const count = activeSection === "environments" ? environments.length : activeSection === "identities" ? identities.length : tools.length;
26563
26707
  sectionTitle = `${definition?.pluralLabel ?? activeSection}[${count}]`;
26564
26708
  break;
26565
26709
  }
@@ -26738,6 +26882,13 @@ function HomeView({ apiUrl, notice, returnToSession }) {
26738
26882
  selectedSession,
26739
26883
  error: toolsError instanceof Error ? toolsError.message : toolsError ? String(toolsError) : null
26740
26884
  }
26885
+ ) : activeSection === "identities" ? isIdentitiesLoading ? /* @__PURE__ */ jsx14(Box13, { padding: 2, children: /* @__PURE__ */ jsx14(Spinner, { label: "loading identities\u2026" }) }) : /* @__PURE__ */ jsx14(
26886
+ IdentitiesView,
26887
+ {
26888
+ resources: identities,
26889
+ selectedIndex: identityIndex,
26890
+ error: identitiesError instanceof Error ? identitiesError.message : identitiesError ? String(identitiesError) : null
26891
+ }
26741
26892
  ) : activeSection === "sessions" ? /* @__PURE__ */ jsx14(
26742
26893
  SessionsView,
26743
26894
  {
@@ -26842,7 +26993,7 @@ function HomeView({ apiUrl, notice, returnToSession }) {
26842
26993
  /* @__PURE__ */ jsx14(Text14, { dimColor: true, children: ` ${inspectedResource.name} ` }),
26843
26994
  /* @__PURE__ */ jsx14(Text14, { dimColor: true, children: "\u203A" }),
26844
26995
  /* @__PURE__ */ jsx14(Text14, { backgroundColor: "cyan", color: "black", children: " inspect " })
26845
- ] }) : (activeSection === "projects" || activeSection === "environments" || activeSection === "tools" || activeSection === "serviceAccounts" || activeSection === "connections") && /* @__PURE__ */ jsx14(
26996
+ ] }) : (activeSection === "projects" || activeSection === "environments" || activeSection === "identities" || activeSection === "tools" || activeSection === "serviceAccounts" || activeSection === "connections") && /* @__PURE__ */ jsx14(
26846
26997
  Text14,
26847
26998
  {
26848
26999
  backgroundColor: "cyan",
@@ -27082,10 +27233,11 @@ var init_HomeView = __esm({
27082
27233
  resourceNavItem({ k: "1", section: "sessions" }),
27083
27234
  { k: "2", label: "Runs", activeSection: "runs" },
27084
27235
  resourceNavItem({ k: "3", section: "environments" }),
27085
- resourceNavItem({ k: "4", section: "tools" }),
27086
- { k: "5", label: "Projects", activeSection: "projects" },
27087
- { k: "6", label: "Service Accounts", activeSection: "serviceAccounts" },
27088
- { k: "7", label: "Connections", activeSection: "connections" }
27236
+ resourceNavItem({ k: "4", section: "identities" }),
27237
+ resourceNavItem({ k: "5", section: "tools" }),
27238
+ { k: "6", label: "Projects", activeSection: "projects" },
27239
+ { k: "7", label: "Service Accounts", activeSection: "serviceAccounts" },
27240
+ { k: "8", label: "Connections", activeSection: "connections" }
27089
27241
  ];
27090
27242
  RESOURCES_PER_COLUMN = 4;
27091
27243
  }
@@ -27194,6 +27346,7 @@ async function launch(opts) {
27194
27346
  });
27195
27347
  const prefetchP = Promise.allSettled([
27196
27348
  apiClient.listSessions({ apiBaseUrl: apiUrl }),
27349
+ apiClient.listIdentities({ apiBaseUrl: apiUrl }),
27197
27350
  apiClient.listProjects({ apiBaseUrl: apiUrl }),
27198
27351
  apiClient.listProjectServiceAccounts({ apiBaseUrl: apiUrl }),
27199
27352
  apiClient.listConnections({ apiBaseUrl: apiUrl }),
@@ -27206,6 +27359,7 @@ async function launch(opts) {
27206
27359
  const [, prefetchResult] = await Promise.all([waitSplash(), prefetchP]);
27207
27360
  const [
27208
27361
  sessionsResult,
27362
+ identitiesResult,
27209
27363
  projectsResult,
27210
27364
  serviceAccountsResult,
27211
27365
  connectionsResult,
@@ -27217,6 +27371,12 @@ async function launch(opts) {
27217
27371
  sortSessions(sessionsResult.value.sessions)
27218
27372
  );
27219
27373
  }
27374
+ if (identitiesResult.status === "fulfilled") {
27375
+ queryClient.setQueryData(
27376
+ queryKeys.identities(apiUrl),
27377
+ sortByResourceName(identitiesResult.value.identities)
27378
+ );
27379
+ }
27220
27380
  if (projectsResult.status === "fulfilled") {
27221
27381
  queryClient.setQueryData(
27222
27382
  queryKeys.projects(apiUrl),
@@ -27348,6 +27508,13 @@ var init_launcher = __esm({
27348
27508
  queryKey: queryKeys.tools,
27349
27509
  sort: sortByResourceName
27350
27510
  },
27511
+ [RESOURCE_KIND_IDENTITY]: {
27512
+ async list({ apiClient, apiUrl }) {
27513
+ return (await apiClient.listIdentities({ apiBaseUrl: apiUrl })).identities;
27514
+ },
27515
+ queryKey: queryKeys.identities,
27516
+ sort: sortByResourceName
27517
+ },
27351
27518
  [RESOURCE_KIND_SESSION]: {
27352
27519
  async list({ apiClient, apiUrl }) {
27353
27520
  return (await apiClient.listSessions({ apiBaseUrl: apiUrl })).sessions;