@vm0/cli 4.37.0 → 4.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +1344 -95
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -6,8 +6,8 @@ var __export = (target, all) => {
6
6
  };
7
7
 
8
8
  // src/index.ts
9
- import { Command as Command24 } from "commander";
10
- import chalk27 from "chalk";
9
+ import { Command as Command27 } from "commander";
10
+ import chalk29 from "chalk";
11
11
 
12
12
  // src/lib/auth.ts
13
13
  import chalk from "chalk";
@@ -984,10 +984,10 @@ function mergeDefs(...defs) {
984
984
  function cloneDef(schema) {
985
985
  return mergeDefs(schema._zod.def);
986
986
  }
987
- function getElementAtPath(obj, path15) {
988
- if (!path15)
987
+ function getElementAtPath(obj, path16) {
988
+ if (!path16)
989
989
  return obj;
990
- return path15.reduce((acc, key) => acc?.[key], obj);
990
+ return path16.reduce((acc, key) => acc?.[key], obj);
991
991
  }
992
992
  function promiseAllObject(promisesObj) {
993
993
  const keys = Object.keys(promisesObj);
@@ -1346,11 +1346,11 @@ function aborted(x, startIndex = 0) {
1346
1346
  }
1347
1347
  return false;
1348
1348
  }
1349
- function prefixIssues(path15, issues) {
1349
+ function prefixIssues(path16, issues) {
1350
1350
  return issues.map((iss) => {
1351
1351
  var _a;
1352
1352
  (_a = iss).path ?? (_a.path = []);
1353
- iss.path.unshift(path15);
1353
+ iss.path.unshift(path16);
1354
1354
  return iss;
1355
1355
  });
1356
1356
  }
@@ -1518,7 +1518,7 @@ function treeifyError(error43, _mapper) {
1518
1518
  return issue2.message;
1519
1519
  };
1520
1520
  const result = { errors: [] };
1521
- const processError = (error44, path15 = []) => {
1521
+ const processError = (error44, path16 = []) => {
1522
1522
  var _a, _b;
1523
1523
  for (const issue2 of error44.issues) {
1524
1524
  if (issue2.code === "invalid_union" && issue2.errors.length) {
@@ -1528,7 +1528,7 @@ function treeifyError(error43, _mapper) {
1528
1528
  } else if (issue2.code === "invalid_element") {
1529
1529
  processError({ issues: issue2.issues }, issue2.path);
1530
1530
  } else {
1531
- const fullpath = [...path15, ...issue2.path];
1531
+ const fullpath = [...path16, ...issue2.path];
1532
1532
  if (fullpath.length === 0) {
1533
1533
  result.errors.push(mapper(issue2));
1534
1534
  continue;
@@ -1560,8 +1560,8 @@ function treeifyError(error43, _mapper) {
1560
1560
  }
1561
1561
  function toDotPath(_path) {
1562
1562
  const segs = [];
1563
- const path15 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1564
- for (const seg of path15) {
1563
+ const path16 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1564
+ for (const seg of path16) {
1565
1565
  if (typeof seg === "number")
1566
1566
  segs.push(`[${seg}]`);
1567
1567
  else if (typeof seg === "symbol")
@@ -2760,7 +2760,7 @@ var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
2760
2760
  function isValidBase64URL(data) {
2761
2761
  if (!base64url.test(data))
2762
2762
  return false;
2763
- const base643 = data.replace(/[-_]/g, (c11) => c11 === "-" ? "+" : "/");
2763
+ const base643 = data.replace(/[-_]/g, (c16) => c16 === "-" ? "+" : "/");
2764
2764
  const padded = base643.padEnd(Math.ceil(base643.length / 4) * 4, "=");
2765
2765
  return isValidBase64(padded);
2766
2766
  }
@@ -11672,9 +11672,9 @@ var ZodDate = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {
11672
11672
  ZodType.init(inst, def);
11673
11673
  inst.min = (value, params) => inst.check(_gte(value, params));
11674
11674
  inst.max = (value, params) => inst.check(_lte(value, params));
11675
- const c11 = inst._zod.bag;
11676
- inst.minDate = c11.minimum ? new Date(c11.minimum) : null;
11677
- inst.maxDate = c11.maximum ? new Date(c11.maximum) : null;
11675
+ const c16 = inst._zod.bag;
11676
+ inst.minDate = c16.minimum ? new Date(c16.minimum) : null;
11677
+ inst.maxDate = c16.maximum ? new Date(c16.maximum) : null;
11678
11678
  });
11679
11679
  function date3(params) {
11680
11680
  return _date(ZodDate, params);
@@ -12448,6 +12448,33 @@ var composesVersionsContract = c.router({
12448
12448
  summary: "Resolve version specifier to full version ID"
12449
12449
  }
12450
12450
  });
12451
+ var composeListItemSchema = external_exports.object({
12452
+ name: external_exports.string(),
12453
+ headVersionId: external_exports.string().nullable(),
12454
+ updatedAt: external_exports.string()
12455
+ });
12456
+ var composesListContract = c.router({
12457
+ /**
12458
+ * GET /api/agent/composes/list?scope={scope}
12459
+ * List all agent composes for a scope
12460
+ * If scope is not provided, uses the authenticated user's default scope
12461
+ */
12462
+ list: {
12463
+ method: "GET",
12464
+ path: "/api/agent/composes/list",
12465
+ query: external_exports.object({
12466
+ scope: external_exports.string().optional()
12467
+ }),
12468
+ responses: {
12469
+ 200: external_exports.object({
12470
+ composes: external_exports.array(composeListItemSchema)
12471
+ }),
12472
+ 400: apiErrorSchema,
12473
+ 401: apiErrorSchema
12474
+ },
12475
+ summary: "List all agent composes for a scope"
12476
+ }
12477
+ });
12451
12478
 
12452
12479
  // ../../packages/core/src/contracts/runs.ts
12453
12480
  var c2 = initContract();
@@ -13625,6 +13652,913 @@ var runnersJobClaimContract = c10.router({
13625
13652
  }
13626
13653
  });
13627
13654
 
13655
+ // ../../packages/core/src/contracts/public/common.ts
13656
+ var publicApiErrorTypeSchema = external_exports.enum([
13657
+ "api_error",
13658
+ // Internal server error (5xx)
13659
+ "invalid_request_error",
13660
+ // Bad parameters (400)
13661
+ "authentication_error",
13662
+ // Auth failure (401)
13663
+ "not_found_error",
13664
+ // Resource missing (404)
13665
+ "conflict_error"
13666
+ // Resource conflict (409)
13667
+ ]);
13668
+ var publicApiErrorSchema = external_exports.object({
13669
+ error: external_exports.object({
13670
+ type: publicApiErrorTypeSchema,
13671
+ code: external_exports.string(),
13672
+ message: external_exports.string(),
13673
+ param: external_exports.string().optional(),
13674
+ doc_url: external_exports.string().url().optional()
13675
+ })
13676
+ });
13677
+ var paginationSchema = external_exports.object({
13678
+ has_more: external_exports.boolean(),
13679
+ next_cursor: external_exports.string().nullable()
13680
+ });
13681
+ function createPaginatedResponseSchema(dataSchema) {
13682
+ return external_exports.object({
13683
+ data: external_exports.array(dataSchema),
13684
+ pagination: paginationSchema
13685
+ });
13686
+ }
13687
+ var listQuerySchema = external_exports.object({
13688
+ cursor: external_exports.string().optional(),
13689
+ limit: external_exports.coerce.number().min(1).max(100).default(20)
13690
+ });
13691
+ var requestIdSchema = external_exports.string().uuid();
13692
+ var timestampSchema = external_exports.string().datetime();
13693
+
13694
+ // ../../packages/core/src/contracts/public/agents.ts
13695
+ var c11 = initContract();
13696
+ var publicAgentSchema = external_exports.object({
13697
+ id: external_exports.string(),
13698
+ name: external_exports.string(),
13699
+ current_version_id: external_exports.string().nullable(),
13700
+ created_at: timestampSchema,
13701
+ updated_at: timestampSchema
13702
+ });
13703
+ var agentVersionSchema = external_exports.object({
13704
+ id: external_exports.string(),
13705
+ agent_id: external_exports.string(),
13706
+ version_number: external_exports.number(),
13707
+ config: external_exports.unknown(),
13708
+ // Agent YAML configuration
13709
+ created_at: timestampSchema
13710
+ });
13711
+ var publicAgentDetailSchema = publicAgentSchema.extend({
13712
+ config: external_exports.unknown().optional()
13713
+ });
13714
+ var paginatedAgentsSchema = createPaginatedResponseSchema(publicAgentSchema);
13715
+ var paginatedAgentVersionsSchema = createPaginatedResponseSchema(agentVersionSchema);
13716
+ var createAgentRequestSchema = external_exports.object({
13717
+ name: external_exports.string().min(1).max(100).regex(
13718
+ /^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]$/,
13719
+ "Name must be lowercase alphanumeric with hyphens, not starting or ending with hyphen"
13720
+ ),
13721
+ config: external_exports.unknown()
13722
+ // Agent YAML configuration
13723
+ });
13724
+ var updateAgentRequestSchema = external_exports.object({
13725
+ config: external_exports.unknown()
13726
+ // New agent configuration (creates new version)
13727
+ });
13728
+ var publicAgentsListContract = c11.router({
13729
+ list: {
13730
+ method: "GET",
13731
+ path: "/v1/agents",
13732
+ query: listQuerySchema,
13733
+ responses: {
13734
+ 200: paginatedAgentsSchema,
13735
+ 401: publicApiErrorSchema,
13736
+ 500: publicApiErrorSchema
13737
+ },
13738
+ summary: "List agents",
13739
+ description: "List all agents in the current scope with pagination"
13740
+ },
13741
+ create: {
13742
+ method: "POST",
13743
+ path: "/v1/agents",
13744
+ body: createAgentRequestSchema,
13745
+ responses: {
13746
+ 201: publicAgentDetailSchema,
13747
+ 400: publicApiErrorSchema,
13748
+ 401: publicApiErrorSchema,
13749
+ 409: publicApiErrorSchema,
13750
+ 500: publicApiErrorSchema
13751
+ },
13752
+ summary: "Create agent",
13753
+ description: "Create a new agent with the given configuration"
13754
+ }
13755
+ });
13756
+ var publicAgentByIdContract = c11.router({
13757
+ get: {
13758
+ method: "GET",
13759
+ path: "/v1/agents/:id",
13760
+ pathParams: external_exports.object({
13761
+ id: external_exports.string().min(1, "Agent ID is required")
13762
+ }),
13763
+ responses: {
13764
+ 200: publicAgentDetailSchema,
13765
+ 401: publicApiErrorSchema,
13766
+ 404: publicApiErrorSchema,
13767
+ 500: publicApiErrorSchema
13768
+ },
13769
+ summary: "Get agent",
13770
+ description: "Get agent details by ID"
13771
+ },
13772
+ update: {
13773
+ method: "PUT",
13774
+ path: "/v1/agents/:id",
13775
+ pathParams: external_exports.object({
13776
+ id: external_exports.string().min(1, "Agent ID is required")
13777
+ }),
13778
+ body: updateAgentRequestSchema,
13779
+ responses: {
13780
+ 200: publicAgentDetailSchema,
13781
+ 400: publicApiErrorSchema,
13782
+ 401: publicApiErrorSchema,
13783
+ 404: publicApiErrorSchema,
13784
+ 500: publicApiErrorSchema
13785
+ },
13786
+ summary: "Update agent",
13787
+ description: "Update agent configuration. Creates a new version if config changes."
13788
+ },
13789
+ delete: {
13790
+ method: "DELETE",
13791
+ path: "/v1/agents/:id",
13792
+ pathParams: external_exports.object({
13793
+ id: external_exports.string().min(1, "Agent ID is required")
13794
+ }),
13795
+ body: external_exports.undefined(),
13796
+ responses: {
13797
+ 204: external_exports.undefined(),
13798
+ 401: publicApiErrorSchema,
13799
+ 404: publicApiErrorSchema,
13800
+ 500: publicApiErrorSchema
13801
+ },
13802
+ summary: "Delete agent",
13803
+ description: "Archive an agent (soft delete)"
13804
+ }
13805
+ });
13806
+ var publicAgentVersionsContract = c11.router({
13807
+ list: {
13808
+ method: "GET",
13809
+ path: "/v1/agents/:id/versions",
13810
+ pathParams: external_exports.object({
13811
+ id: external_exports.string().min(1, "Agent ID is required")
13812
+ }),
13813
+ query: listQuerySchema,
13814
+ responses: {
13815
+ 200: paginatedAgentVersionsSchema,
13816
+ 401: publicApiErrorSchema,
13817
+ 404: publicApiErrorSchema,
13818
+ 500: publicApiErrorSchema
13819
+ },
13820
+ summary: "List agent versions",
13821
+ description: "List all versions of an agent with pagination"
13822
+ }
13823
+ });
13824
+
13825
+ // ../../packages/core/src/contracts/public/runs.ts
13826
+ var c12 = initContract();
13827
+ var publicRunStatusSchema = external_exports.enum([
13828
+ "pending",
13829
+ "running",
13830
+ "completed",
13831
+ "failed",
13832
+ "timeout",
13833
+ "cancelled"
13834
+ ]);
13835
+ var publicRunSchema = external_exports.object({
13836
+ id: external_exports.string(),
13837
+ agent_id: external_exports.string(),
13838
+ agent_name: external_exports.string(),
13839
+ status: publicRunStatusSchema,
13840
+ prompt: external_exports.string(),
13841
+ created_at: timestampSchema,
13842
+ started_at: timestampSchema.nullable(),
13843
+ completed_at: timestampSchema.nullable()
13844
+ });
13845
+ var publicRunDetailSchema = publicRunSchema.extend({
13846
+ output: external_exports.string().nullable(),
13847
+ error: external_exports.string().nullable(),
13848
+ execution_time_ms: external_exports.number().nullable(),
13849
+ checkpoint_id: external_exports.string().nullable(),
13850
+ session_id: external_exports.string().nullable(),
13851
+ artifacts: external_exports.record(external_exports.string(), external_exports.string()).optional(),
13852
+ volumes: external_exports.record(external_exports.string(), external_exports.string()).optional()
13853
+ });
13854
+ var paginatedRunsSchema = createPaginatedResponseSchema(publicRunSchema);
13855
+ var createRunRequestSchema = external_exports.object({
13856
+ // Agent identification (one of: agent, agent_id, session_id, checkpoint_id)
13857
+ agent: external_exports.string().optional(),
13858
+ // Agent name
13859
+ agent_id: external_exports.string().optional(),
13860
+ // Agent ID
13861
+ agent_version: external_exports.string().optional(),
13862
+ // Version specifier (e.g., "latest", "v1", specific ID)
13863
+ // Continue session
13864
+ session_id: external_exports.string().optional(),
13865
+ // Resume from checkpoint
13866
+ checkpoint_id: external_exports.string().optional(),
13867
+ // Required
13868
+ prompt: external_exports.string().min(1, "Prompt is required"),
13869
+ // Optional configuration
13870
+ variables: external_exports.record(external_exports.string(), external_exports.string()).optional(),
13871
+ secrets: external_exports.record(external_exports.string(), external_exports.string()).optional(),
13872
+ artifacts: external_exports.record(external_exports.string(), external_exports.string()).optional(),
13873
+ // artifact_name -> version
13874
+ volumes: external_exports.record(external_exports.string(), external_exports.string()).optional()
13875
+ // volume_name -> version
13876
+ });
13877
+ var runListQuerySchema = listQuerySchema.extend({
13878
+ agent_id: external_exports.string().optional(),
13879
+ status: publicRunStatusSchema.optional(),
13880
+ since: timestampSchema.optional()
13881
+ });
13882
+ var publicRunsListContract = c12.router({
13883
+ list: {
13884
+ method: "GET",
13885
+ path: "/v1/runs",
13886
+ query: runListQuerySchema,
13887
+ responses: {
13888
+ 200: paginatedRunsSchema,
13889
+ 401: publicApiErrorSchema,
13890
+ 500: publicApiErrorSchema
13891
+ },
13892
+ summary: "List runs",
13893
+ description: "List runs with optional filtering by agent, status, and time"
13894
+ },
13895
+ create: {
13896
+ method: "POST",
13897
+ path: "/v1/runs",
13898
+ body: createRunRequestSchema,
13899
+ responses: {
13900
+ 202: publicRunDetailSchema,
13901
+ // Async operation
13902
+ 400: publicApiErrorSchema,
13903
+ 401: publicApiErrorSchema,
13904
+ 404: publicApiErrorSchema,
13905
+ 500: publicApiErrorSchema
13906
+ },
13907
+ summary: "Create run",
13908
+ description: "Create and execute a new agent run. Returns 202 Accepted as runs execute asynchronously."
13909
+ }
13910
+ });
13911
+ var publicRunByIdContract = c12.router({
13912
+ get: {
13913
+ method: "GET",
13914
+ path: "/v1/runs/:id",
13915
+ pathParams: external_exports.object({
13916
+ id: external_exports.string().min(1, "Run ID is required")
13917
+ }),
13918
+ responses: {
13919
+ 200: publicRunDetailSchema,
13920
+ 401: publicApiErrorSchema,
13921
+ 404: publicApiErrorSchema,
13922
+ 500: publicApiErrorSchema
13923
+ },
13924
+ summary: "Get run",
13925
+ description: "Get run details by ID"
13926
+ }
13927
+ });
13928
+ var publicRunCancelContract = c12.router({
13929
+ cancel: {
13930
+ method: "POST",
13931
+ path: "/v1/runs/:id/cancel",
13932
+ pathParams: external_exports.object({
13933
+ id: external_exports.string().min(1, "Run ID is required")
13934
+ }),
13935
+ body: external_exports.undefined(),
13936
+ responses: {
13937
+ 200: publicRunDetailSchema,
13938
+ 400: publicApiErrorSchema,
13939
+ // Run not in cancellable state
13940
+ 401: publicApiErrorSchema,
13941
+ 404: publicApiErrorSchema,
13942
+ 500: publicApiErrorSchema
13943
+ },
13944
+ summary: "Cancel run",
13945
+ description: "Cancel a pending or running execution"
13946
+ }
13947
+ });
13948
+ var logEntrySchema = external_exports.object({
13949
+ timestamp: timestampSchema,
13950
+ type: external_exports.enum(["agent", "system", "network"]),
13951
+ level: external_exports.enum(["debug", "info", "warn", "error"]),
13952
+ message: external_exports.string(),
13953
+ metadata: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
13954
+ });
13955
+ var paginatedLogsSchema = createPaginatedResponseSchema(logEntrySchema);
13956
+ var logsQuerySchema = listQuerySchema.extend({
13957
+ type: external_exports.enum(["agent", "system", "network", "all"]).default("all"),
13958
+ since: timestampSchema.optional(),
13959
+ until: timestampSchema.optional(),
13960
+ order: external_exports.enum(["asc", "desc"]).default("asc")
13961
+ });
13962
+ var publicRunLogsContract = c12.router({
13963
+ getLogs: {
13964
+ method: "GET",
13965
+ path: "/v1/runs/:id/logs",
13966
+ pathParams: external_exports.object({
13967
+ id: external_exports.string().min(1, "Run ID is required")
13968
+ }),
13969
+ query: logsQuerySchema,
13970
+ responses: {
13971
+ 200: paginatedLogsSchema,
13972
+ 401: publicApiErrorSchema,
13973
+ 404: publicApiErrorSchema,
13974
+ 500: publicApiErrorSchema
13975
+ },
13976
+ summary: "Get run logs",
13977
+ description: "Get unified logs for a run. Combines agent, system, and network logs."
13978
+ }
13979
+ });
13980
+ var metricPointSchema = external_exports.object({
13981
+ timestamp: timestampSchema,
13982
+ cpu_percent: external_exports.number(),
13983
+ memory_used_mb: external_exports.number(),
13984
+ memory_total_mb: external_exports.number(),
13985
+ disk_used_mb: external_exports.number(),
13986
+ disk_total_mb: external_exports.number()
13987
+ });
13988
+ var metricsSummarySchema = external_exports.object({
13989
+ avg_cpu_percent: external_exports.number(),
13990
+ max_memory_used_mb: external_exports.number(),
13991
+ total_duration_ms: external_exports.number().nullable()
13992
+ });
13993
+ var metricsResponseSchema2 = external_exports.object({
13994
+ data: external_exports.array(metricPointSchema),
13995
+ summary: metricsSummarySchema
13996
+ });
13997
+ var publicRunMetricsContract = c12.router({
13998
+ getMetrics: {
13999
+ method: "GET",
14000
+ path: "/v1/runs/:id/metrics",
14001
+ pathParams: external_exports.object({
14002
+ id: external_exports.string().min(1, "Run ID is required")
14003
+ }),
14004
+ responses: {
14005
+ 200: metricsResponseSchema2,
14006
+ 401: publicApiErrorSchema,
14007
+ 404: publicApiErrorSchema,
14008
+ 500: publicApiErrorSchema
14009
+ },
14010
+ summary: "Get run metrics",
14011
+ description: "Get CPU, memory, and disk metrics for a run"
14012
+ }
14013
+ });
14014
+ var sseEventTypeSchema = external_exports.enum([
14015
+ "status",
14016
+ // Run status change
14017
+ "output",
14018
+ // Agent output
14019
+ "error",
14020
+ // Error occurred
14021
+ "complete",
14022
+ // Run completed
14023
+ "heartbeat"
14024
+ // Keep-alive
14025
+ ]);
14026
+ var sseEventSchema = external_exports.object({
14027
+ event: sseEventTypeSchema,
14028
+ data: external_exports.unknown(),
14029
+ id: external_exports.string().optional()
14030
+ // For Last-Event-ID reconnection
14031
+ });
14032
+ var publicRunEventsContract = c12.router({
14033
+ streamEvents: {
14034
+ method: "GET",
14035
+ path: "/v1/runs/:id/events",
14036
+ pathParams: external_exports.object({
14037
+ id: external_exports.string().min(1, "Run ID is required")
14038
+ }),
14039
+ query: external_exports.object({
14040
+ last_event_id: external_exports.string().optional()
14041
+ // For reconnection
14042
+ }),
14043
+ responses: {
14044
+ 200: external_exports.any(),
14045
+ // SSE stream - actual content is text/event-stream
14046
+ 401: publicApiErrorSchema,
14047
+ 404: publicApiErrorSchema,
14048
+ 500: publicApiErrorSchema
14049
+ },
14050
+ summary: "Stream run events",
14051
+ description: "Stream real-time events for a run using Server-Sent Events (SSE). Set Accept: text/event-stream header."
14052
+ }
14053
+ });
14054
+
14055
+ // ../../packages/core/src/contracts/public/artifacts.ts
14056
+ var c13 = initContract();
14057
+ var publicArtifactSchema = external_exports.object({
14058
+ id: external_exports.string(),
14059
+ name: external_exports.string(),
14060
+ current_version_id: external_exports.string().nullable(),
14061
+ size: external_exports.number(),
14062
+ // Total size in bytes
14063
+ file_count: external_exports.number(),
14064
+ created_at: timestampSchema,
14065
+ updated_at: timestampSchema
14066
+ });
14067
+ var artifactVersionSchema = external_exports.object({
14068
+ id: external_exports.string(),
14069
+ // SHA-256 content hash
14070
+ artifact_id: external_exports.string(),
14071
+ size: external_exports.number(),
14072
+ // Size in bytes
14073
+ file_count: external_exports.number(),
14074
+ message: external_exports.string().nullable(),
14075
+ // Optional commit message
14076
+ created_by: external_exports.string(),
14077
+ created_at: timestampSchema
14078
+ });
14079
+ var publicArtifactDetailSchema = publicArtifactSchema.extend({
14080
+ current_version: artifactVersionSchema.nullable()
14081
+ });
14082
+ var paginatedArtifactsSchema = createPaginatedResponseSchema(publicArtifactSchema);
14083
+ var paginatedArtifactVersionsSchema = createPaginatedResponseSchema(
14084
+ artifactVersionSchema
14085
+ );
14086
+ var createArtifactRequestSchema = external_exports.object({
14087
+ name: external_exports.string().min(1).max(100).regex(
14088
+ /^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]$/,
14089
+ "Name must be lowercase alphanumeric with hyphens, not starting or ending with hyphen"
14090
+ )
14091
+ });
14092
+ var fileEntrySchema = external_exports.object({
14093
+ path: external_exports.string(),
14094
+ size: external_exports.number(),
14095
+ hash: external_exports.string().optional()
14096
+ // SHA-256 hash of file content
14097
+ });
14098
+ var prepareUploadRequestSchema = external_exports.object({
14099
+ files: external_exports.array(fileEntrySchema),
14100
+ message: external_exports.string().optional()
14101
+ // Optional commit message
14102
+ });
14103
+ var presignedUploadSchema2 = external_exports.object({
14104
+ path: external_exports.string(),
14105
+ upload_url: external_exports.string(),
14106
+ // Presigned S3 URL
14107
+ upload_id: external_exports.string()
14108
+ // For multi-part uploads
14109
+ });
14110
+ var prepareUploadResponseSchema = external_exports.object({
14111
+ upload_session_id: external_exports.string(),
14112
+ files: external_exports.array(presignedUploadSchema2),
14113
+ expires_at: timestampSchema
14114
+ });
14115
+ var commitUploadRequestSchema = external_exports.object({
14116
+ upload_session_id: external_exports.string(),
14117
+ message: external_exports.string().optional()
14118
+ });
14119
+ var downloadResponseSchema = external_exports.object({
14120
+ version_id: external_exports.string(),
14121
+ files: external_exports.array(
14122
+ external_exports.object({
14123
+ path: external_exports.string(),
14124
+ size: external_exports.number(),
14125
+ download_url: external_exports.string()
14126
+ // Presigned S3 URL
14127
+ })
14128
+ ),
14129
+ expires_at: timestampSchema
14130
+ });
14131
+ var publicArtifactsListContract = c13.router({
14132
+ list: {
14133
+ method: "GET",
14134
+ path: "/v1/artifacts",
14135
+ query: listQuerySchema,
14136
+ responses: {
14137
+ 200: paginatedArtifactsSchema,
14138
+ 401: publicApiErrorSchema,
14139
+ 500: publicApiErrorSchema
14140
+ },
14141
+ summary: "List artifacts",
14142
+ description: "List all artifacts in the current scope with pagination"
14143
+ },
14144
+ create: {
14145
+ method: "POST",
14146
+ path: "/v1/artifacts",
14147
+ body: createArtifactRequestSchema,
14148
+ responses: {
14149
+ 201: publicArtifactDetailSchema,
14150
+ 400: publicApiErrorSchema,
14151
+ 401: publicApiErrorSchema,
14152
+ 409: publicApiErrorSchema,
14153
+ 500: publicApiErrorSchema
14154
+ },
14155
+ summary: "Create artifact",
14156
+ description: "Create a new empty artifact container"
14157
+ }
14158
+ });
14159
+ var publicArtifactByIdContract = c13.router({
14160
+ get: {
14161
+ method: "GET",
14162
+ path: "/v1/artifacts/:id",
14163
+ pathParams: external_exports.object({
14164
+ id: external_exports.string().min(1, "Artifact ID is required")
14165
+ }),
14166
+ responses: {
14167
+ 200: publicArtifactDetailSchema,
14168
+ 401: publicApiErrorSchema,
14169
+ 404: publicApiErrorSchema,
14170
+ 500: publicApiErrorSchema
14171
+ },
14172
+ summary: "Get artifact",
14173
+ description: "Get artifact details by ID"
14174
+ },
14175
+ delete: {
14176
+ method: "DELETE",
14177
+ path: "/v1/artifacts/:id",
14178
+ pathParams: external_exports.object({
14179
+ id: external_exports.string().min(1, "Artifact ID is required")
14180
+ }),
14181
+ body: external_exports.undefined(),
14182
+ responses: {
14183
+ 204: external_exports.undefined(),
14184
+ 401: publicApiErrorSchema,
14185
+ 404: publicApiErrorSchema,
14186
+ 500: publicApiErrorSchema
14187
+ },
14188
+ summary: "Delete artifact",
14189
+ description: "Delete an artifact and all its versions"
14190
+ }
14191
+ });
14192
+ var publicArtifactVersionsContract = c13.router({
14193
+ list: {
14194
+ method: "GET",
14195
+ path: "/v1/artifacts/:id/versions",
14196
+ pathParams: external_exports.object({
14197
+ id: external_exports.string().min(1, "Artifact ID is required")
14198
+ }),
14199
+ query: listQuerySchema,
14200
+ responses: {
14201
+ 200: paginatedArtifactVersionsSchema,
14202
+ 401: publicApiErrorSchema,
14203
+ 404: publicApiErrorSchema,
14204
+ 500: publicApiErrorSchema
14205
+ },
14206
+ summary: "List artifact versions",
14207
+ description: "List all versions of an artifact with pagination"
14208
+ }
14209
+ });
14210
+ var publicArtifactUploadContract = c13.router({
14211
+ prepareUpload: {
14212
+ method: "POST",
14213
+ path: "/v1/artifacts/:id/upload",
14214
+ pathParams: external_exports.object({
14215
+ id: external_exports.string().min(1, "Artifact ID is required")
14216
+ }),
14217
+ body: prepareUploadRequestSchema,
14218
+ responses: {
14219
+ 200: prepareUploadResponseSchema,
14220
+ 400: publicApiErrorSchema,
14221
+ 401: publicApiErrorSchema,
14222
+ 404: publicApiErrorSchema,
14223
+ 500: publicApiErrorSchema
14224
+ },
14225
+ summary: "Prepare artifact upload",
14226
+ description: "Get presigned URLs for direct S3 upload. Returns upload URLs for each file."
14227
+ }
14228
+ });
14229
+ var publicArtifactCommitContract = c13.router({
14230
+ commitUpload: {
14231
+ method: "POST",
14232
+ path: "/v1/artifacts/:id/commit",
14233
+ pathParams: external_exports.object({
14234
+ id: external_exports.string().min(1, "Artifact ID is required")
14235
+ }),
14236
+ body: commitUploadRequestSchema,
14237
+ responses: {
14238
+ 200: artifactVersionSchema,
14239
+ 400: publicApiErrorSchema,
14240
+ 401: publicApiErrorSchema,
14241
+ 404: publicApiErrorSchema,
14242
+ 500: publicApiErrorSchema
14243
+ },
14244
+ summary: "Commit artifact upload",
14245
+ description: "Finalize an upload session and create a new artifact version."
14246
+ }
14247
+ });
14248
+ var publicArtifactDownloadContract = c13.router({
14249
+ download: {
14250
+ method: "GET",
14251
+ path: "/v1/artifacts/:id/download",
14252
+ pathParams: external_exports.object({
14253
+ id: external_exports.string().min(1, "Artifact ID is required")
14254
+ }),
14255
+ query: external_exports.object({
14256
+ version_id: external_exports.string().optional()
14257
+ // Defaults to current version
14258
+ }),
14259
+ responses: {
14260
+ 200: downloadResponseSchema,
14261
+ 401: publicApiErrorSchema,
14262
+ 404: publicApiErrorSchema,
14263
+ 500: publicApiErrorSchema
14264
+ },
14265
+ summary: "Download artifact",
14266
+ description: "Get presigned URLs for downloading artifact files. Defaults to current version."
14267
+ }
14268
+ });
14269
+
14270
+ // ../../packages/core/src/contracts/public/volumes.ts
14271
+ var c14 = initContract();
14272
+ var publicVolumeSchema = external_exports.object({
14273
+ id: external_exports.string(),
14274
+ name: external_exports.string(),
14275
+ current_version_id: external_exports.string().nullable(),
14276
+ size: external_exports.number(),
14277
+ // Total size in bytes
14278
+ file_count: external_exports.number(),
14279
+ created_at: timestampSchema,
14280
+ updated_at: timestampSchema
14281
+ });
14282
+ var volumeVersionSchema = external_exports.object({
14283
+ id: external_exports.string(),
14284
+ // SHA-256 content hash
14285
+ volume_id: external_exports.string(),
14286
+ size: external_exports.number(),
14287
+ // Size in bytes
14288
+ file_count: external_exports.number(),
14289
+ message: external_exports.string().nullable(),
14290
+ // Optional commit message
14291
+ created_by: external_exports.string(),
14292
+ created_at: timestampSchema
14293
+ });
14294
+ var publicVolumeDetailSchema = publicVolumeSchema.extend({
14295
+ current_version: volumeVersionSchema.nullable()
14296
+ });
14297
+ var paginatedVolumesSchema = createPaginatedResponseSchema(publicVolumeSchema);
14298
+ var paginatedVolumeVersionsSchema = createPaginatedResponseSchema(volumeVersionSchema);
14299
+ var createVolumeRequestSchema = external_exports.object({
14300
+ name: external_exports.string().min(1).max(100).regex(
14301
+ /^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]$/,
14302
+ "Name must be lowercase alphanumeric with hyphens, not starting or ending with hyphen"
14303
+ )
14304
+ });
14305
+ var fileEntrySchema2 = external_exports.object({
14306
+ path: external_exports.string(),
14307
+ size: external_exports.number(),
14308
+ hash: external_exports.string().optional()
14309
+ // SHA-256 hash of file content
14310
+ });
14311
+ var prepareUploadRequestSchema2 = external_exports.object({
14312
+ files: external_exports.array(fileEntrySchema2),
14313
+ message: external_exports.string().optional()
14314
+ // Optional commit message
14315
+ });
14316
+ var presignedUploadSchema3 = external_exports.object({
14317
+ path: external_exports.string(),
14318
+ upload_url: external_exports.string(),
14319
+ // Presigned S3 URL
14320
+ upload_id: external_exports.string()
14321
+ // For multi-part uploads
14322
+ });
14323
+ var prepareUploadResponseSchema2 = external_exports.object({
14324
+ upload_session_id: external_exports.string(),
14325
+ files: external_exports.array(presignedUploadSchema3),
14326
+ expires_at: timestampSchema
14327
+ });
14328
+ var commitUploadRequestSchema2 = external_exports.object({
14329
+ upload_session_id: external_exports.string(),
14330
+ message: external_exports.string().optional()
14331
+ });
14332
+ var downloadResponseSchema2 = external_exports.object({
14333
+ version_id: external_exports.string(),
14334
+ files: external_exports.array(
14335
+ external_exports.object({
14336
+ path: external_exports.string(),
14337
+ size: external_exports.number(),
14338
+ download_url: external_exports.string()
14339
+ // Presigned S3 URL
14340
+ })
14341
+ ),
14342
+ expires_at: timestampSchema
14343
+ });
14344
+ var publicVolumesListContract = c14.router({
14345
+ list: {
14346
+ method: "GET",
14347
+ path: "/v1/volumes",
14348
+ query: listQuerySchema,
14349
+ responses: {
14350
+ 200: paginatedVolumesSchema,
14351
+ 401: publicApiErrorSchema,
14352
+ 500: publicApiErrorSchema
14353
+ },
14354
+ summary: "List volumes",
14355
+ description: "List all volumes in the current scope with pagination"
14356
+ },
14357
+ create: {
14358
+ method: "POST",
14359
+ path: "/v1/volumes",
14360
+ body: createVolumeRequestSchema,
14361
+ responses: {
14362
+ 201: publicVolumeDetailSchema,
14363
+ 400: publicApiErrorSchema,
14364
+ 401: publicApiErrorSchema,
14365
+ 409: publicApiErrorSchema,
14366
+ 500: publicApiErrorSchema
14367
+ },
14368
+ summary: "Create volume",
14369
+ description: "Create a new empty volume container"
14370
+ }
14371
+ });
14372
+ var publicVolumeByIdContract = c14.router({
14373
+ get: {
14374
+ method: "GET",
14375
+ path: "/v1/volumes/:id",
14376
+ pathParams: external_exports.object({
14377
+ id: external_exports.string().min(1, "Volume ID is required")
14378
+ }),
14379
+ responses: {
14380
+ 200: publicVolumeDetailSchema,
14381
+ 401: publicApiErrorSchema,
14382
+ 404: publicApiErrorSchema,
14383
+ 500: publicApiErrorSchema
14384
+ },
14385
+ summary: "Get volume",
14386
+ description: "Get volume details by ID"
14387
+ },
14388
+ delete: {
14389
+ method: "DELETE",
14390
+ path: "/v1/volumes/:id",
14391
+ pathParams: external_exports.object({
14392
+ id: external_exports.string().min(1, "Volume ID is required")
14393
+ }),
14394
+ body: external_exports.undefined(),
14395
+ responses: {
14396
+ 204: external_exports.undefined(),
14397
+ 401: publicApiErrorSchema,
14398
+ 404: publicApiErrorSchema,
14399
+ 500: publicApiErrorSchema
14400
+ },
14401
+ summary: "Delete volume",
14402
+ description: "Delete a volume and all its versions"
14403
+ }
14404
+ });
14405
+ var publicVolumeVersionsContract = c14.router({
14406
+ list: {
14407
+ method: "GET",
14408
+ path: "/v1/volumes/:id/versions",
14409
+ pathParams: external_exports.object({
14410
+ id: external_exports.string().min(1, "Volume ID is required")
14411
+ }),
14412
+ query: listQuerySchema,
14413
+ responses: {
14414
+ 200: paginatedVolumeVersionsSchema,
14415
+ 401: publicApiErrorSchema,
14416
+ 404: publicApiErrorSchema,
14417
+ 500: publicApiErrorSchema
14418
+ },
14419
+ summary: "List volume versions",
14420
+ description: "List all versions of a volume with pagination"
14421
+ }
14422
+ });
14423
+ var publicVolumeUploadContract = c14.router({
14424
+ prepareUpload: {
14425
+ method: "POST",
14426
+ path: "/v1/volumes/:id/upload",
14427
+ pathParams: external_exports.object({
14428
+ id: external_exports.string().min(1, "Volume ID is required")
14429
+ }),
14430
+ body: prepareUploadRequestSchema2,
14431
+ responses: {
14432
+ 200: prepareUploadResponseSchema2,
14433
+ 400: publicApiErrorSchema,
14434
+ 401: publicApiErrorSchema,
14435
+ 404: publicApiErrorSchema,
14436
+ 500: publicApiErrorSchema
14437
+ },
14438
+ summary: "Prepare volume upload",
14439
+ description: "Get presigned URLs for direct S3 upload. Returns upload URLs for each file."
14440
+ }
14441
+ });
14442
+ var publicVolumeCommitContract = c14.router({
14443
+ commitUpload: {
14444
+ method: "POST",
14445
+ path: "/v1/volumes/:id/commit",
14446
+ pathParams: external_exports.object({
14447
+ id: external_exports.string().min(1, "Volume ID is required")
14448
+ }),
14449
+ body: commitUploadRequestSchema2,
14450
+ responses: {
14451
+ 200: volumeVersionSchema,
14452
+ 400: publicApiErrorSchema,
14453
+ 401: publicApiErrorSchema,
14454
+ 404: publicApiErrorSchema,
14455
+ 500: publicApiErrorSchema
14456
+ },
14457
+ summary: "Commit volume upload",
14458
+ description: "Finalize an upload session and create a new volume version."
14459
+ }
14460
+ });
14461
+ var publicVolumeDownloadContract = c14.router({
14462
+ download: {
14463
+ method: "GET",
14464
+ path: "/v1/volumes/:id/download",
14465
+ pathParams: external_exports.object({
14466
+ id: external_exports.string().min(1, "Volume ID is required")
14467
+ }),
14468
+ query: external_exports.object({
14469
+ version_id: external_exports.string().optional()
14470
+ // Defaults to current version
14471
+ }),
14472
+ responses: {
14473
+ 200: downloadResponseSchema2,
14474
+ 401: publicApiErrorSchema,
14475
+ 404: publicApiErrorSchema,
14476
+ 500: publicApiErrorSchema
14477
+ },
14478
+ summary: "Download volume",
14479
+ description: "Get presigned URLs for downloading volume files. Defaults to current version."
14480
+ }
14481
+ });
14482
+
14483
+ // ../../packages/core/src/contracts/public/tokens.ts
14484
+ var c15 = initContract();
14485
+ var publicTokenSchema = external_exports.object({
14486
+ id: external_exports.string(),
14487
+ name: external_exports.string(),
14488
+ token_prefix: external_exports.string(),
14489
+ // First 12 chars for identification (e.g., "vm0_live_abc")
14490
+ last_used_at: timestampSchema.nullable(),
14491
+ expires_at: timestampSchema,
14492
+ created_at: timestampSchema
14493
+ });
14494
+ var publicTokenDetailSchema = publicTokenSchema.extend({
14495
+ token: external_exports.string().optional()
14496
+ // Full token value, only returned on creation
14497
+ });
14498
+ var paginatedTokensSchema = createPaginatedResponseSchema(publicTokenSchema);
14499
+ var createTokenRequestSchema = external_exports.object({
14500
+ name: external_exports.string().min(1, "Name is required").max(100, "Name too long"),
14501
+ expires_in_days: external_exports.number().min(1).max(365).optional()
14502
+ // null for no expiry (default 90 days)
14503
+ });
14504
+ var publicTokensListContract = c15.router({
14505
+ list: {
14506
+ method: "GET",
14507
+ path: "/v1/tokens",
14508
+ query: listQuerySchema,
14509
+ responses: {
14510
+ 200: paginatedTokensSchema,
14511
+ 401: publicApiErrorSchema
14512
+ },
14513
+ summary: "List API tokens",
14514
+ description: "List all API tokens for the authenticated user"
14515
+ },
14516
+ create: {
14517
+ method: "POST",
14518
+ path: "/v1/tokens",
14519
+ body: createTokenRequestSchema,
14520
+ responses: {
14521
+ 201: publicTokenDetailSchema,
14522
+ // Includes full token value
14523
+ 400: publicApiErrorSchema,
14524
+ 401: publicApiErrorSchema
14525
+ },
14526
+ summary: "Create API token",
14527
+ description: "Create a new API token. The token value is only returned once on creation."
14528
+ }
14529
+ });
14530
+ var publicTokenByIdContract = c15.router({
14531
+ get: {
14532
+ method: "GET",
14533
+ path: "/v1/tokens/:id",
14534
+ pathParams: external_exports.object({
14535
+ id: external_exports.string()
14536
+ }),
14537
+ responses: {
14538
+ 200: publicTokenSchema,
14539
+ // Does NOT include token value
14540
+ 401: publicApiErrorSchema,
14541
+ 404: publicApiErrorSchema
14542
+ },
14543
+ summary: "Get API token",
14544
+ description: "Get details of an API token (does not include the token value)"
14545
+ },
14546
+ delete: {
14547
+ method: "DELETE",
14548
+ path: "/v1/tokens/:id",
14549
+ pathParams: external_exports.object({
14550
+ id: external_exports.string()
14551
+ }),
14552
+ responses: {
14553
+ 204: external_exports.undefined(),
14554
+ 401: publicApiErrorSchema,
14555
+ 404: publicApiErrorSchema
14556
+ },
14557
+ summary: "Revoke API token",
14558
+ description: "Permanently revoke an API token. This action cannot be undone."
14559
+ }
14560
+ });
14561
+
13628
14562
  // ../../packages/core/src/scope-reference.ts
13629
14563
  function getLegacySystemTemplateWarning(legacyFormat) {
13630
14564
  if (!isLegacySystemTemplate(legacyFormat)) {
@@ -14067,7 +15001,7 @@ var ApiClient = class {
14067
15001
  /**
14068
15002
  * Generic GET request
14069
15003
  */
14070
- async get(path15) {
15004
+ async get(path16) {
14071
15005
  const baseUrl = await this.getBaseUrl();
14072
15006
  const token = await getToken();
14073
15007
  if (!token) {
@@ -14080,7 +15014,7 @@ var ApiClient = class {
14080
15014
  if (bypassSecret) {
14081
15015
  headers["x-vercel-protection-bypass"] = bypassSecret;
14082
15016
  }
14083
- return fetch(`${baseUrl}${path15}`, {
15017
+ return fetch(`${baseUrl}${path16}`, {
14084
15018
  method: "GET",
14085
15019
  headers
14086
15020
  });
@@ -14088,7 +15022,7 @@ var ApiClient = class {
14088
15022
  /**
14089
15023
  * Generic POST request
14090
15024
  */
14091
- async post(path15, options) {
15025
+ async post(path16, options) {
14092
15026
  const baseUrl = await this.getBaseUrl();
14093
15027
  const token = await getToken();
14094
15028
  if (!token) {
@@ -14104,7 +15038,7 @@ var ApiClient = class {
14104
15038
  if (bypassSecret) {
14105
15039
  headers["x-vercel-protection-bypass"] = bypassSecret;
14106
15040
  }
14107
- return fetch(`${baseUrl}${path15}`, {
15041
+ return fetch(`${baseUrl}${path16}`, {
14108
15042
  method: "POST",
14109
15043
  headers,
14110
15044
  body: options?.body
@@ -14113,7 +15047,7 @@ var ApiClient = class {
14113
15047
  /**
14114
15048
  * Generic DELETE request
14115
15049
  */
14116
- async delete(path15) {
15050
+ async delete(path16) {
14117
15051
  const baseUrl = await this.getBaseUrl();
14118
15052
  const token = await getToken();
14119
15053
  if (!token) {
@@ -14126,7 +15060,7 @@ var ApiClient = class {
14126
15060
  if (bypassSecret) {
14127
15061
  headers["x-vercel-protection-bypass"] = bypassSecret;
14128
15062
  }
14129
- return fetch(`${baseUrl}${path15}`, {
15063
+ return fetch(`${baseUrl}${path16}`, {
14130
15064
  method: "DELETE",
14131
15065
  headers
14132
15066
  });
@@ -15460,9 +16394,9 @@ var CodexEventParser = class {
15460
16394
  }
15461
16395
  }
15462
16396
  if (itemType === "file_change" && item.changes && item.changes.length > 0) {
15463
- const changes = item.changes.map((c11) => {
15464
- const action = c11.kind === "add" ? "Created" : c11.kind === "modify" ? "Modified" : "Deleted";
15465
- return `${action}: ${c11.path}`;
16397
+ const changes = item.changes.map((c16) => {
16398
+ const action = c16.kind === "add" ? "Created" : c16.kind === "modify" ? "Modified" : "Deleted";
16399
+ return `${action}: ${c16.path}`;
15466
16400
  }).join("\n");
15467
16401
  return {
15468
16402
  type: "text",
@@ -15803,9 +16737,9 @@ var CodexEventRenderer = class {
15803
16737
  return;
15804
16738
  }
15805
16739
  if (itemType === "file_change" && item.changes && item.changes.length > 0) {
15806
- const summary = item.changes.map((c11) => {
15807
- const icon = c11.kind === "add" ? "+" : c11.kind === "delete" ? "-" : "~";
15808
- return `${icon}${c11.path}`;
16740
+ const summary = item.changes.map((c16) => {
16741
+ const icon = c16.kind === "add" ? "+" : c16.kind === "delete" ? "-" : "~";
16742
+ return `${icon}${c16.path}`;
15809
16743
  }).join(", ");
15810
16744
  console.log(chalk4.green("[files]") + ` ${summary}`);
15811
16745
  return;
@@ -17694,7 +18628,7 @@ async function autoPullArtifact(runOutput, artifactDir) {
17694
18628
  }
17695
18629
  var cookCmd = new Command17().name("cook").description("One-click agent preparation and execution from vm0.yaml");
17696
18630
  cookCmd.argument("[prompt]", "Prompt for the agent").option("-y, --yes", "Skip confirmation prompts").action(async (prompt, options) => {
17697
- const shouldExit = await checkAndUpgrade("4.37.0", prompt);
18631
+ const shouldExit = await checkAndUpgrade("4.38.0", prompt);
17698
18632
  if (shouldExit) {
17699
18633
  process.exit(0);
17700
18634
  }
@@ -18344,10 +19278,324 @@ var setCommand = new Command20().name("set").description("Set your scope slug").
18344
19278
  // src/commands/scope/index.ts
18345
19279
  var scopeCommand = new Command21().name("scope").description("Manage your scope (namespace for images)").addCommand(statusCommand3).addCommand(setCommand);
18346
19280
 
18347
- // src/commands/init.ts
19281
+ // src/commands/agents/index.ts
19282
+ import { Command as Command24 } from "commander";
19283
+
19284
+ // src/commands/agents/list.ts
18348
19285
  import { Command as Command22 } from "commander";
18349
19286
  import chalk25 from "chalk";
18350
- import path13 from "path";
19287
+ var listCommand3 = new Command22().name("list").alias("ls").description("List all agent composes").option("-s, --scope <scope>", "Scope to list composes from").action(async (options) => {
19288
+ try {
19289
+ const url2 = options.scope ? `/api/agent/composes/list?scope=${encodeURIComponent(options.scope)}` : "/api/agent/composes/list";
19290
+ const response = await apiClient.get(url2);
19291
+ if (!response.ok) {
19292
+ const error43 = await response.json();
19293
+ throw new Error(error43.error?.message || "List failed");
19294
+ }
19295
+ const data = await response.json();
19296
+ if (data.composes.length === 0) {
19297
+ console.log(chalk25.dim("No agent composes found"));
19298
+ console.log(
19299
+ chalk25.dim(" Create one with: vm0 compose <agent-compose.yaml>")
19300
+ );
19301
+ return;
19302
+ }
19303
+ const nameWidth = Math.max(4, ...data.composes.map((c16) => c16.name.length));
19304
+ const header = ["NAME".padEnd(nameWidth), "VERSION", "UPDATED"].join(
19305
+ " "
19306
+ );
19307
+ console.log(chalk25.dim(header));
19308
+ for (const compose of data.composes) {
19309
+ const versionShort = compose.headVersionId ? compose.headVersionId.slice(0, 8) : chalk25.dim("-");
19310
+ const row = [
19311
+ compose.name.padEnd(nameWidth),
19312
+ versionShort,
19313
+ formatRelativeTime(compose.updatedAt)
19314
+ ].join(" ");
19315
+ console.log(row);
19316
+ }
19317
+ } catch (error43) {
19318
+ console.error(chalk25.red("\u2717 Failed to list agent composes"));
19319
+ if (error43 instanceof Error) {
19320
+ if (error43.message.includes("Not authenticated")) {
19321
+ console.error(chalk25.dim(" Run: vm0 auth login"));
19322
+ } else {
19323
+ console.error(chalk25.dim(` ${error43.message}`));
19324
+ }
19325
+ }
19326
+ process.exit(1);
19327
+ }
19328
+ });
19329
+
19330
+ // src/commands/agents/inspect.ts
19331
+ import { Command as Command23 } from "commander";
19332
+ import chalk26 from "chalk";
19333
+
19334
+ // src/lib/source-derivation.ts
19335
+ import * as fs9 from "fs/promises";
19336
+ import * as path13 from "path";
19337
+ import * as os7 from "os";
19338
+ function extractVariableReferences2(environment) {
19339
+ const secrets = [];
19340
+ const vars = [];
19341
+ for (const value of Object.values(environment)) {
19342
+ const matches = value.matchAll(/\$\{?([A-Z_][A-Z0-9_]*)\}?/g);
19343
+ for (const match of matches) {
19344
+ const varName = match[1];
19345
+ if (!varName) continue;
19346
+ if (varName.endsWith("_KEY") || varName.endsWith("_SECRET") || varName.endsWith("_TOKEN") || varName.endsWith("_PASSWORD") || varName.includes("API_KEY") || varName.includes("SECRET")) {
19347
+ if (!secrets.includes(varName)) {
19348
+ secrets.push(varName);
19349
+ }
19350
+ } else {
19351
+ if (!vars.includes(varName)) {
19352
+ vars.push(varName);
19353
+ }
19354
+ }
19355
+ }
19356
+ }
19357
+ return { secrets: secrets.sort(), vars: vars.sort() };
19358
+ }
19359
+ async function fetchSkillFrontmatter(skillUrl, tempDir) {
19360
+ try {
19361
+ const parsed = parseGitHubTreeUrl2(skillUrl);
19362
+ const skillDir = await downloadGitHubSkill(parsed, tempDir);
19363
+ const frontmatter = await readSkillFrontmatter(skillDir);
19364
+ return { skillName: parsed.skillName, frontmatter };
19365
+ } catch {
19366
+ return null;
19367
+ }
19368
+ }
19369
+ async function deriveAgentVariableSources(agent, options) {
19370
+ const { secrets: secretNames, vars: varNames } = agent.environment ? extractVariableReferences2(agent.environment) : { secrets: [], vars: [] };
19371
+ const secretSources = /* @__PURE__ */ new Map();
19372
+ const varSources = /* @__PURE__ */ new Map();
19373
+ for (const name of secretNames) {
19374
+ secretSources.set(name, { name, source: "agent environment" });
19375
+ }
19376
+ for (const name of varNames) {
19377
+ varSources.set(name, { name, source: "agent environment" });
19378
+ }
19379
+ if (options?.skipNetwork || !agent.skills || agent.skills.length === 0) {
19380
+ return {
19381
+ secrets: Array.from(secretSources.values()),
19382
+ vars: Array.from(varSources.values())
19383
+ };
19384
+ }
19385
+ const tempDir = await fs9.mkdtemp(
19386
+ path13.join(os7.tmpdir(), "vm0-source-derivation-")
19387
+ );
19388
+ try {
19389
+ const skillResults = await Promise.all(
19390
+ agent.skills.map((url2) => fetchSkillFrontmatter(url2, tempDir))
19391
+ );
19392
+ for (const result of skillResults) {
19393
+ if (!result) continue;
19394
+ const { skillName, frontmatter } = result;
19395
+ if (frontmatter.vm0_secrets) {
19396
+ for (const secretName of frontmatter.vm0_secrets) {
19397
+ if (secretSources.has(secretName)) {
19398
+ secretSources.set(secretName, {
19399
+ name: secretName,
19400
+ source: `skill: ${skillName}`,
19401
+ skillName
19402
+ });
19403
+ }
19404
+ }
19405
+ }
19406
+ if (frontmatter.vm0_vars) {
19407
+ for (const varName of frontmatter.vm0_vars) {
19408
+ if (varSources.has(varName)) {
19409
+ varSources.set(varName, {
19410
+ name: varName,
19411
+ source: `skill: ${skillName}`,
19412
+ skillName
19413
+ });
19414
+ }
19415
+ }
19416
+ }
19417
+ }
19418
+ } finally {
19419
+ await fs9.rm(tempDir, { recursive: true, force: true });
19420
+ }
19421
+ return {
19422
+ secrets: Array.from(secretSources.values()),
19423
+ vars: Array.from(varSources.values())
19424
+ };
19425
+ }
19426
+ async function deriveComposeVariableSources(content, options) {
19427
+ const results = /* @__PURE__ */ new Map();
19428
+ const entries = Object.entries(content.agents);
19429
+ const sourcesPromises = entries.map(async ([agentName, agent]) => {
19430
+ const sources = await deriveAgentVariableSources(agent, options);
19431
+ return { agentName, sources };
19432
+ });
19433
+ const sourcesResults = await Promise.all(sourcesPromises);
19434
+ for (const { agentName, sources } of sourcesResults) {
19435
+ results.set(agentName, sources);
19436
+ }
19437
+ return results;
19438
+ }
19439
+
19440
+ // src/commands/agents/inspect.ts
19441
+ function formatComposeOutput(name, versionId, content, variableSources) {
19442
+ console.log(chalk26.bold("Name:") + ` ${name}`);
19443
+ console.log(chalk26.bold("Version:") + ` ${versionId}`);
19444
+ console.log();
19445
+ console.log(chalk26.bold("Agents:"));
19446
+ for (const [agentName, agent] of Object.entries(content.agents)) {
19447
+ console.log(` ${chalk26.cyan(agentName)}:`);
19448
+ console.log(` Provider: ${agent.provider}`);
19449
+ if (agent.image) {
19450
+ console.log(` Image: ${agent.image}`);
19451
+ }
19452
+ if (agent.apps && agent.apps.length > 0) {
19453
+ console.log(` Apps:`);
19454
+ for (const app of agent.apps) {
19455
+ console.log(` - ${app}`);
19456
+ }
19457
+ }
19458
+ if (agent.working_dir) {
19459
+ console.log(` Working Dir: ${agent.working_dir}`);
19460
+ }
19461
+ if (agent.volumes && agent.volumes.length > 0) {
19462
+ console.log(` Volumes:`);
19463
+ for (const vol of agent.volumes) {
19464
+ const volumeDef = content.volumes?.[vol];
19465
+ if (volumeDef) {
19466
+ console.log(` - ${vol}:${volumeDef.version.slice(0, 8)}`);
19467
+ } else {
19468
+ console.log(` - ${vol}`);
19469
+ }
19470
+ }
19471
+ }
19472
+ if (agent.skills && agent.skills.length > 0) {
19473
+ console.log(` Skills:`);
19474
+ for (const skill of agent.skills) {
19475
+ console.log(` - ${skill}`);
19476
+ }
19477
+ }
19478
+ const agentSources = variableSources?.get(agentName);
19479
+ if (agentSources) {
19480
+ if (agentSources.secrets.length > 0) {
19481
+ console.log(` Secrets:`);
19482
+ for (const secret of agentSources.secrets) {
19483
+ const sourceInfo = chalk26.dim(`(${secret.source})`);
19484
+ console.log(` - ${secret.name.padEnd(20)} ${sourceInfo}`);
19485
+ }
19486
+ }
19487
+ if (agentSources.vars.length > 0) {
19488
+ console.log(` Vars:`);
19489
+ for (const v of agentSources.vars) {
19490
+ const sourceInfo = chalk26.dim(`(${v.source})`);
19491
+ console.log(` - ${v.name.padEnd(20)} ${sourceInfo}`);
19492
+ }
19493
+ }
19494
+ }
19495
+ if (agent.experimental_runner) {
19496
+ console.log(` Runner: ${agent.experimental_runner.group}`);
19497
+ }
19498
+ if (agent.experimental_network_security) {
19499
+ console.log(` Network Security: enabled`);
19500
+ }
19501
+ }
19502
+ }
19503
+ var inspectCommand = new Command23().name("inspect").description("Inspect an agent compose").argument(
19504
+ "<name[:version]>",
19505
+ "Agent name with optional version (e.g., my-agent:latest or my-agent:a1b2c3d4)"
19506
+ ).option("-s, --scope <scope>", "Scope to look up the compose from").option("--no-sources", "Skip fetching skills to determine variable sources").action(
19507
+ async (argument, options) => {
19508
+ try {
19509
+ const colonIndex = argument.lastIndexOf(":");
19510
+ let name;
19511
+ let version2;
19512
+ if (colonIndex === -1) {
19513
+ name = argument;
19514
+ version2 = "latest";
19515
+ } else {
19516
+ name = argument.slice(0, colonIndex);
19517
+ version2 = argument.slice(colonIndex + 1) || "latest";
19518
+ }
19519
+ let compose;
19520
+ try {
19521
+ compose = await apiClient.getComposeByName(name, options.scope);
19522
+ } catch (error43) {
19523
+ if (error43 instanceof Error && error43.message.includes("not found")) {
19524
+ console.error(chalk26.red(`\u2717 Agent compose not found: ${name}`));
19525
+ console.error(chalk26.dim(" Run: vm0 agents list"));
19526
+ process.exit(1);
19527
+ }
19528
+ throw error43;
19529
+ }
19530
+ let resolvedVersionId = compose.headVersionId;
19531
+ if (version2 !== "latest" && compose.headVersionId) {
19532
+ if (version2.length < 64) {
19533
+ try {
19534
+ const versionInfo = await apiClient.getComposeVersion(
19535
+ compose.id,
19536
+ version2
19537
+ );
19538
+ resolvedVersionId = versionInfo.versionId;
19539
+ } catch (error43) {
19540
+ if (error43 instanceof Error && error43.message.includes("not found")) {
19541
+ console.error(chalk26.red(`\u2717 Version not found: ${version2}`));
19542
+ console.error(
19543
+ chalk26.dim(
19544
+ ` HEAD version: ${compose.headVersionId?.slice(0, 8)}`
19545
+ )
19546
+ );
19547
+ process.exit(1);
19548
+ }
19549
+ throw error43;
19550
+ }
19551
+ } else {
19552
+ resolvedVersionId = version2;
19553
+ }
19554
+ }
19555
+ if (!resolvedVersionId || !compose.content) {
19556
+ console.error(chalk26.red(`\u2717 No version found for: ${name}`));
19557
+ process.exit(1);
19558
+ }
19559
+ const content = compose.content;
19560
+ let variableSources;
19561
+ if (options.sources !== false) {
19562
+ try {
19563
+ variableSources = await deriveComposeVariableSources(content);
19564
+ } catch {
19565
+ console.error(
19566
+ chalk26.yellow(
19567
+ "\u26A0 Warning: Failed to fetch skill sources, showing basic info"
19568
+ )
19569
+ );
19570
+ }
19571
+ }
19572
+ formatComposeOutput(
19573
+ compose.name,
19574
+ resolvedVersionId,
19575
+ content,
19576
+ variableSources
19577
+ );
19578
+ } catch (error43) {
19579
+ console.error(chalk26.red("\u2717 Failed to inspect agent compose"));
19580
+ if (error43 instanceof Error) {
19581
+ if (error43.message.includes("Not authenticated")) {
19582
+ console.error(chalk26.dim(" Run: vm0 auth login"));
19583
+ } else {
19584
+ console.error(chalk26.dim(` ${error43.message}`));
19585
+ }
19586
+ }
19587
+ process.exit(1);
19588
+ }
19589
+ }
19590
+ );
19591
+
19592
+ // src/commands/agents/index.ts
19593
+ var agentsCommand = new Command24().name("agents").description("Manage agent composes").addCommand(listCommand3).addCommand(inspectCommand);
19594
+
19595
+ // src/commands/init.ts
19596
+ import { Command as Command25 } from "commander";
19597
+ import chalk27 from "chalk";
19598
+ import path14 from "path";
18351
19599
  import { existsSync as existsSync9 } from "fs";
18352
19600
  import { writeFile as writeFile7 } from "fs/promises";
18353
19601
  var VM0_YAML_FILE = "vm0.yaml";
@@ -18387,14 +19635,14 @@ function checkExistingFiles() {
18387
19635
  if (existsSync9(AGENTS_MD_FILE)) existingFiles.push(AGENTS_MD_FILE);
18388
19636
  return existingFiles;
18389
19637
  }
18390
- var initCommand3 = new Command22().name("init").description("Initialize a new VM0 project in the current directory").option("-f, --force", "Overwrite existing files").option("-n, --name <name>", "Agent name (required in non-interactive mode)").action(async (options) => {
19638
+ var initCommand3 = new Command25().name("init").description("Initialize a new VM0 project in the current directory").option("-f, --force", "Overwrite existing files").option("-n, --name <name>", "Agent name (required in non-interactive mode)").action(async (options) => {
18391
19639
  const existingFiles = checkExistingFiles();
18392
19640
  if (existingFiles.length > 0 && !options.force) {
18393
19641
  for (const file2 of existingFiles) {
18394
- console.log(chalk25.red(`\u2717 ${file2} already exists`));
19642
+ console.log(chalk27.red(`\u2717 ${file2} already exists`));
18395
19643
  }
18396
19644
  console.log();
18397
- console.log(`To overwrite: ${chalk25.cyan("vm0 init --force")}`);
19645
+ console.log(`To overwrite: ${chalk27.cyan("vm0 init --force")}`);
18398
19646
  process.exit(1);
18399
19647
  }
18400
19648
  let agentName;
@@ -18402,12 +19650,12 @@ var initCommand3 = new Command22().name("init").description("Initialize a new VM
18402
19650
  agentName = options.name.trim();
18403
19651
  } else if (!isInteractive()) {
18404
19652
  console.error(
18405
- chalk25.red("\u2717 --name flag is required in non-interactive mode")
19653
+ chalk27.red("\u2717 --name flag is required in non-interactive mode")
18406
19654
  );
18407
- console.error(chalk25.dim(" Usage: vm0 init --name <agent-name>"));
19655
+ console.error(chalk27.dim(" Usage: vm0 init --name <agent-name>"));
18408
19656
  process.exit(1);
18409
19657
  } else {
18410
- const dirName = path13.basename(process.cwd());
19658
+ const dirName = path14.basename(process.cwd());
18411
19659
  const defaultName = validateAgentName(dirName) ? dirName : void 0;
18412
19660
  const name = await promptText(
18413
19661
  "Enter agent name",
@@ -18420,42 +19668,42 @@ var initCommand3 = new Command22().name("init").description("Initialize a new VM
18420
19668
  }
18421
19669
  );
18422
19670
  if (name === void 0) {
18423
- console.log(chalk25.dim("Cancelled"));
19671
+ console.log(chalk27.dim("Cancelled"));
18424
19672
  return;
18425
19673
  }
18426
19674
  agentName = name;
18427
19675
  }
18428
19676
  if (!agentName || !validateAgentName(agentName)) {
18429
- console.log(chalk25.red("\u2717 Invalid agent name"));
19677
+ console.log(chalk27.red("\u2717 Invalid agent name"));
18430
19678
  console.log(
18431
- chalk25.dim(" Must be 3-64 characters, alphanumeric and hyphens only")
19679
+ chalk27.dim(" Must be 3-64 characters, alphanumeric and hyphens only")
18432
19680
  );
18433
- console.log(chalk25.dim(" Must start and end with letter or number"));
19681
+ console.log(chalk27.dim(" Must start and end with letter or number"));
18434
19682
  process.exit(1);
18435
19683
  }
18436
19684
  await writeFile7(VM0_YAML_FILE, generateVm0Yaml(agentName));
18437
19685
  const vm0Status = existingFiles.includes(VM0_YAML_FILE) ? " (overwritten)" : "";
18438
- console.log(chalk25.green(`\u2713 Created ${VM0_YAML_FILE}${vm0Status}`));
19686
+ console.log(chalk27.green(`\u2713 Created ${VM0_YAML_FILE}${vm0Status}`));
18439
19687
  await writeFile7(AGENTS_MD_FILE, generateAgentsMd());
18440
19688
  const agentsStatus = existingFiles.includes(AGENTS_MD_FILE) ? " (overwritten)" : "";
18441
- console.log(chalk25.green(`\u2713 Created ${AGENTS_MD_FILE}${agentsStatus}`));
19689
+ console.log(chalk27.green(`\u2713 Created ${AGENTS_MD_FILE}${agentsStatus}`));
18442
19690
  console.log();
18443
19691
  console.log("Next steps:");
18444
19692
  console.log(
18445
- ` 1. Get your Claude Code token: ${chalk25.cyan("claude setup-token")}`
19693
+ ` 1. Get your Claude Code token: ${chalk27.cyan("claude setup-token")}`
18446
19694
  );
18447
19695
  console.log(` 2. Set the environment variable (or add to .env file):`);
18448
- console.log(chalk25.dim(` export CLAUDE_CODE_OAUTH_TOKEN=<your-token>`));
18449
- console.log(` 3. Run your agent: ${chalk25.cyan('vm0 cook "your prompt"')}`);
19696
+ console.log(chalk27.dim(` export CLAUDE_CODE_OAUTH_TOKEN=<your-token>`));
19697
+ console.log(` 3. Run your agent: ${chalk27.cyan('vm0 cook "your prompt"')}`);
18450
19698
  });
18451
19699
 
18452
19700
  // src/commands/setup-github.ts
18453
- import { Command as Command23 } from "commander";
18454
- import chalk26 from "chalk";
19701
+ import { Command as Command26 } from "commander";
19702
+ import chalk28 from "chalk";
18455
19703
  import { existsSync as existsSync10 } from "fs";
18456
19704
  import { mkdir as mkdir7, readFile as readFile8, writeFile as writeFile8 } from "fs/promises";
18457
19705
  import { execSync, spawnSync } from "child_process";
18458
- import path14 from "path";
19706
+ import path15 from "path";
18459
19707
  import { parse as parseYaml5 } from "yaml";
18460
19708
  function isGhInstalled() {
18461
19709
  try {
@@ -18487,74 +19735,74 @@ function getRelativeWorkingDir(gitRoot) {
18487
19735
  if (cwd === gitRoot) {
18488
19736
  return null;
18489
19737
  }
18490
- const relativePath = path14.relative(gitRoot, cwd);
19738
+ const relativePath = path15.relative(gitRoot, cwd);
18491
19739
  return relativePath.replace(/\\/g, "/");
18492
19740
  }
18493
19741
  async function checkPrerequisites() {
18494
19742
  console.log("Checking prerequisites...");
18495
19743
  const gitRoot = getGitRoot();
18496
19744
  if (!gitRoot) {
18497
- console.log(chalk26.red("\u2717 Not in a git repository"));
19745
+ console.log(chalk28.red("\u2717 Not in a git repository"));
18498
19746
  console.log();
18499
19747
  console.log("This command must be run from within a git repository.");
18500
19748
  console.log();
18501
19749
  console.log("To initialize a git repository, run:");
18502
- console.log(` ${chalk26.cyan("git init")}`);
19750
+ console.log(` ${chalk28.cyan("git init")}`);
18503
19751
  process.exit(1);
18504
19752
  }
18505
- console.log(chalk26.green("\u2713 Git repository detected"));
19753
+ console.log(chalk28.green("\u2713 Git repository detected"));
18506
19754
  if (!isGhInstalled()) {
18507
- console.log(chalk26.red("\u2717 GitHub CLI (gh) is not installed"));
19755
+ console.log(chalk28.red("\u2717 GitHub CLI (gh) is not installed"));
18508
19756
  console.log();
18509
19757
  console.log("GitHub CLI is required for this command.");
18510
19758
  console.log();
18511
- console.log(` macOS: ${chalk26.cyan("brew install gh")}`);
18512
- console.log(` Other: ${chalk26.cyan("https://cli.github.com/")}`);
19759
+ console.log(` macOS: ${chalk28.cyan("brew install gh")}`);
19760
+ console.log(` Other: ${chalk28.cyan("https://cli.github.com/")}`);
18513
19761
  console.log();
18514
19762
  console.log("After installation, run:");
18515
- console.log(` ${chalk26.cyan("gh auth login")}`);
19763
+ console.log(` ${chalk28.cyan("gh auth login")}`);
18516
19764
  console.log();
18517
19765
  console.log("Then try again:");
18518
- console.log(` ${chalk26.cyan("vm0 setup-github")}`);
19766
+ console.log(` ${chalk28.cyan("vm0 setup-github")}`);
18519
19767
  process.exit(1);
18520
19768
  }
18521
- console.log(chalk26.green("\u2713 GitHub CLI (gh) is installed"));
19769
+ console.log(chalk28.green("\u2713 GitHub CLI (gh) is installed"));
18522
19770
  if (!isGhAuthenticated()) {
18523
- console.log(chalk26.red("\u2717 GitHub CLI is not authenticated"));
19771
+ console.log(chalk28.red("\u2717 GitHub CLI is not authenticated"));
18524
19772
  console.log();
18525
19773
  console.log("Please authenticate GitHub CLI first:");
18526
- console.log(` ${chalk26.cyan("gh auth login")}`);
19774
+ console.log(` ${chalk28.cyan("gh auth login")}`);
18527
19775
  console.log();
18528
19776
  console.log("Then try again:");
18529
- console.log(` ${chalk26.cyan("vm0 setup-github")}`);
19777
+ console.log(` ${chalk28.cyan("vm0 setup-github")}`);
18530
19778
  process.exit(1);
18531
19779
  }
18532
- console.log(chalk26.green("\u2713 GitHub CLI is authenticated"));
19780
+ console.log(chalk28.green("\u2713 GitHub CLI is authenticated"));
18533
19781
  const token = await getToken();
18534
19782
  if (!token) {
18535
- console.log(chalk26.red("\u2717 VM0 not authenticated"));
19783
+ console.log(chalk28.red("\u2717 VM0 not authenticated"));
18536
19784
  console.log();
18537
19785
  console.log("Please authenticate with VM0 first:");
18538
- console.log(` ${chalk26.cyan("vm0 auth login")}`);
19786
+ console.log(` ${chalk28.cyan("vm0 auth login")}`);
18539
19787
  console.log();
18540
19788
  console.log("Then try again:");
18541
- console.log(` ${chalk26.cyan("vm0 setup-github")}`);
19789
+ console.log(` ${chalk28.cyan("vm0 setup-github")}`);
18542
19790
  process.exit(1);
18543
19791
  }
18544
- console.log(chalk26.green("\u2713 VM0 authenticated"));
19792
+ console.log(chalk28.green("\u2713 VM0 authenticated"));
18545
19793
  if (!existsSync10("vm0.yaml")) {
18546
- console.log(chalk26.red("\u2717 vm0.yaml not found"));
19794
+ console.log(chalk28.red("\u2717 vm0.yaml not found"));
18547
19795
  console.log();
18548
19796
  console.log("This command requires a vm0.yaml configuration file.");
18549
19797
  console.log();
18550
19798
  console.log("To create one, run:");
18551
- console.log(` ${chalk26.cyan("vm0 init")}`);
19799
+ console.log(` ${chalk28.cyan("vm0 init")}`);
18552
19800
  console.log();
18553
19801
  console.log("Then try again:");
18554
- console.log(` ${chalk26.cyan("vm0 setup-github")}`);
19802
+ console.log(` ${chalk28.cyan("vm0 setup-github")}`);
18555
19803
  process.exit(1);
18556
19804
  }
18557
- console.log(chalk26.green("\u2713 vm0.yaml found"));
19805
+ console.log(chalk28.green("\u2713 vm0.yaml found"));
18558
19806
  return { token, gitRoot };
18559
19807
  }
18560
19808
  function generatePublishYaml(workingDir) {
@@ -18711,7 +19959,7 @@ function displaySecretsTable(secretStatuses, varStatuses) {
18711
19959
  if (secretStatuses.length > 0) {
18712
19960
  console.log("\u2502 Secrets: \u2502");
18713
19961
  for (const s of secretStatuses) {
18714
- const status = s.found ? chalk26.green("\u2713") : chalk26.red("\u2717");
19962
+ const status = s.found ? chalk28.green("\u2713") : chalk28.red("\u2717");
18715
19963
  const source = s.found ? `(from ${s.source})` : "not found";
18716
19964
  const paddedName = (s.name + " ").padEnd(23, ".");
18717
19965
  console.log(`\u2502 ${status} ${paddedName} ${source.padEnd(19)}\u2502`);
@@ -18720,7 +19968,7 @@ function displaySecretsTable(secretStatuses, varStatuses) {
18720
19968
  if (varStatuses.length > 0) {
18721
19969
  console.log("\u2502 Variables: \u2502");
18722
19970
  for (const v of varStatuses) {
18723
- const status = v.found ? chalk26.green("\u2713") : chalk26.red("\u2717");
19971
+ const status = v.found ? chalk28.green("\u2713") : chalk28.red("\u2717");
18724
19972
  const source = v.found ? `(from ${v.source})` : "not found";
18725
19973
  const paddedName = (v.name + " ").padEnd(23, ".");
18726
19974
  console.log(`\u2502 ${status} ${paddedName} ${source.padEnd(19)}\u2502`);
@@ -18732,17 +19980,17 @@ function showManualSetupInstructions(secrets, vars) {
18732
19980
  console.log("Skipped automatic setup. Configure secrets manually:");
18733
19981
  console.log();
18734
19982
  console.log(" Step 1: Get your VM0 token");
18735
- console.log(` ${chalk26.cyan("vm0 auth setup-token")}`);
19983
+ console.log(` ${chalk28.cyan("vm0 auth setup-token")}`);
18736
19984
  console.log();
18737
19985
  console.log(" Step 2: Set GitHub secrets");
18738
19986
  for (const s of secrets) {
18739
- console.log(` ${chalk26.cyan(`gh secret set ${s}`)}`);
19987
+ console.log(` ${chalk28.cyan(`gh secret set ${s}`)}`);
18740
19988
  }
18741
19989
  if (vars.length > 0) {
18742
19990
  console.log();
18743
19991
  console.log(" Step 3: Set GitHub variables");
18744
19992
  for (const v of vars) {
18745
- console.log(` ${chalk26.cyan(`gh variable set ${v}`)}`);
19993
+ console.log(` ${chalk28.cyan(`gh variable set ${v}`)}`);
18746
19994
  }
18747
19995
  }
18748
19996
  }
@@ -18785,7 +20033,7 @@ function showWorkflowsCreatedMessage() {
18785
20033
  console.log("\u2502 3. Push to main branch to trigger publish \u2502");
18786
20034
  console.log("\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518");
18787
20035
  }
18788
- var setupGithubCommand = new Command23().name("setup-github").description("Initialize GitHub Actions workflows for agent deployment").option("-f, --force", "Overwrite existing workflow files").option("-y, --yes", "Auto-confirm all prompts").option("--skip-secrets", "Skip automatic secrets/variables setup").action(
20036
+ var setupGithubCommand = new Command26().name("setup-github").description("Initialize GitHub Actions workflows for agent deployment").option("-f, --force", "Overwrite existing workflow files").option("-y, --yes", "Auto-confirm all prompts").option("--skip-secrets", "Skip automatic secrets/variables setup").action(
18789
20037
  async (options) => {
18790
20038
  const prereqs = await checkPrerequisites();
18791
20039
  if (!prereqs) {
@@ -18799,23 +20047,23 @@ var setupGithubCommand = new Command23().name("setup-github").description("Initi
18799
20047
  const config2 = parseYaml5(content);
18800
20048
  const agents = config2.agents;
18801
20049
  const agentName = Object.keys(agents)[0];
18802
- console.log(chalk26.green(`\u2713 Agent: ${agentName}`));
20050
+ console.log(chalk28.green(`\u2713 Agent: ${agentName}`));
18803
20051
  const { secrets, vars } = extractSecretsAndVars(config2);
18804
20052
  console.log(
18805
- chalk26.green(
20053
+ chalk28.green(
18806
20054
  `\u2713 Found ${secrets.length} secrets, ${vars.length} variables`
18807
20055
  )
18808
20056
  );
18809
20057
  console.log();
18810
- const publishPath = path14.join(gitRoot, ".github/workflows/publish.yml");
18811
- const runPath = path14.join(gitRoot, ".github/workflows/run.yml");
20058
+ const publishPath = path15.join(gitRoot, ".github/workflows/publish.yml");
20059
+ const runPath = path15.join(gitRoot, ".github/workflows/run.yml");
18812
20060
  const displayPublishPath = ".github/workflows/publish.yml";
18813
20061
  const displayRunPath = ".github/workflows/run.yml";
18814
20062
  const existingFiles = [];
18815
20063
  if (existsSync10(publishPath)) existingFiles.push(displayPublishPath);
18816
20064
  if (existsSync10(runPath)) existingFiles.push(displayRunPath);
18817
20065
  if (existingFiles.length > 0 && !options.force) {
18818
- console.log(chalk26.yellow("\u26A0 Existing workflow files detected:"));
20066
+ console.log(chalk28.yellow("\u26A0 Existing workflow files detected:"));
18819
20067
  for (const file2 of existingFiles) {
18820
20068
  console.log(` \u2022 ${file2}`);
18821
20069
  }
@@ -18828,23 +20076,23 @@ var setupGithubCommand = new Command23().name("setup-github").description("Initi
18828
20076
  if (!overwrite) {
18829
20077
  console.log();
18830
20078
  console.log("Aborted. To force overwrite, run:");
18831
- console.log(` ${chalk26.cyan("vm0 setup-github --force")}`);
20079
+ console.log(` ${chalk28.cyan("vm0 setup-github --force")}`);
18832
20080
  process.exit(0);
18833
20081
  }
18834
20082
  }
18835
20083
  console.log();
18836
20084
  }
18837
20085
  console.log("Creating workflow files...");
18838
- await mkdir7(path14.join(gitRoot, ".github/workflows"), { recursive: true });
20086
+ await mkdir7(path15.join(gitRoot, ".github/workflows"), { recursive: true });
18839
20087
  await writeFile8(publishPath, generatePublishYaml(workingDir));
18840
20088
  const publishStatus = existingFiles.includes(displayPublishPath) ? "Overwrote" : "Created";
18841
- console.log(chalk26.green(`\u2713 ${publishStatus} ${displayPublishPath}`));
20089
+ console.log(chalk28.green(`\u2713 ${publishStatus} ${displayPublishPath}`));
18842
20090
  await writeFile8(runPath, generateRunYaml(agentName, secrets, vars));
18843
20091
  const runStatus = existingFiles.includes(displayRunPath) ? "Overwrote" : "Created";
18844
- console.log(chalk26.green(`\u2713 ${runStatus} ${displayRunPath}`));
20092
+ console.log(chalk28.green(`\u2713 ${runStatus} ${displayRunPath}`));
18845
20093
  console.log();
18846
20094
  if (options.skipSecrets) {
18847
- console.log(chalk26.green("\u2713 Done (secrets setup skipped)"));
20095
+ console.log(chalk28.green("\u2713 Done (secrets setup skipped)"));
18848
20096
  return;
18849
20097
  }
18850
20098
  const { secretStatuses, varStatuses } = await detectSecretValues(
@@ -18884,14 +20132,14 @@ var setupGithubCommand = new Command23().name("setup-github").description("Initi
18884
20132
  if (s.found && s.value) {
18885
20133
  const success2 = setGitHubSecret(s.name, s.value);
18886
20134
  if (success2) {
18887
- console.log(` ${chalk26.green("\u2713")} ${s.name}`);
20135
+ console.log(` ${chalk28.green("\u2713")} ${s.name}`);
18888
20136
  } else {
18889
- console.log(` ${chalk26.red("\u2717")} ${s.name} (failed)`);
20137
+ console.log(` ${chalk28.red("\u2717")} ${s.name} (failed)`);
18890
20138
  failedSecrets.push(s.name);
18891
20139
  }
18892
20140
  } else {
18893
20141
  console.log(
18894
- ` ${chalk26.yellow("\u26A0")} ${s.name} (skipped - not found)`
20142
+ ` ${chalk28.yellow("\u26A0")} ${s.name} (skipped - not found)`
18895
20143
  );
18896
20144
  }
18897
20145
  }
@@ -18903,14 +20151,14 @@ var setupGithubCommand = new Command23().name("setup-github").description("Initi
18903
20151
  if (v.found && v.value) {
18904
20152
  const success2 = setGitHubVariable(v.name, v.value);
18905
20153
  if (success2) {
18906
- console.log(` ${chalk26.green("\u2713")} ${v.name}`);
20154
+ console.log(` ${chalk28.green("\u2713")} ${v.name}`);
18907
20155
  } else {
18908
- console.log(` ${chalk26.red("\u2717")} ${v.name} (failed)`);
20156
+ console.log(` ${chalk28.red("\u2717")} ${v.name} (failed)`);
18909
20157
  failedVars.push(v.name);
18910
20158
  }
18911
20159
  } else {
18912
20160
  console.log(
18913
- ` ${chalk26.yellow("\u26A0")} ${v.name} (skipped - not found)`
20161
+ ` ${chalk28.yellow("\u26A0")} ${v.name} (skipped - not found)`
18914
20162
  );
18915
20163
  }
18916
20164
  }
@@ -18933,10 +20181,10 @@ var setupGithubCommand = new Command23().name("setup-github").description("Initi
18933
20181
  );
18934
20182
 
18935
20183
  // src/index.ts
18936
- var program = new Command24();
18937
- program.name("vm0").description("VM0 CLI - A modern build tool").version("4.37.0");
20184
+ var program = new Command27();
20185
+ program.name("vm0").description("VM0 CLI - A modern build tool").version("4.38.0");
18938
20186
  program.command("info").description("Display environment information").action(async () => {
18939
- console.log(chalk27.bold("System Information:"));
20187
+ console.log(chalk29.bold("System Information:"));
18940
20188
  console.log(`Node Version: ${process.version}`);
18941
20189
  console.log(`Platform: ${process.platform}`);
18942
20190
  console.log(`Architecture: ${process.arch}`);
@@ -18963,6 +20211,7 @@ program.addCommand(artifactCommand);
18963
20211
  program.addCommand(cookCommand);
18964
20212
  program.addCommand(logsCommand);
18965
20213
  program.addCommand(scopeCommand);
20214
+ program.addCommand(agentsCommand);
18966
20215
  program.addCommand(initCommand3);
18967
20216
  program.addCommand(setupGithubCommand);
18968
20217
  if (process.argv[1]?.endsWith("index.js") || process.argv[1]?.endsWith("index.ts") || process.argv[1]?.endsWith("vm0")) {