@vm0/cli 9.14.0 → 9.15.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 +638 -205
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1969,6 +1969,71 @@ var MODEL_PROVIDER_TYPES = {
1969
1969
  },
1970
1970
  models: ["MiniMax-M2.1"],
1971
1971
  defaultModel: "MiniMax-M2.1"
1972
+ },
1973
+ "aws-bedrock": {
1974
+ framework: "claude-code",
1975
+ label: "AWS Bedrock",
1976
+ helpText: "Run Claude on AWS Bedrock.\nSetup guide: https://docs.anthropic.com/en/docs/claude-code/bedrock",
1977
+ authMethods: {
1978
+ "api-key": {
1979
+ label: "Bedrock API Key",
1980
+ helpText: "Use a Bedrock API key for authentication",
1981
+ credentials: {
1982
+ AWS_BEARER_TOKEN_BEDROCK: {
1983
+ label: "AWS_BEARER_TOKEN_BEDROCK",
1984
+ required: true,
1985
+ helpText: "Bedrock API key from AWS console"
1986
+ },
1987
+ AWS_REGION: {
1988
+ label: "AWS_REGION",
1989
+ required: true,
1990
+ placeholder: "us-east-1",
1991
+ helpText: "e.g., us-east-1, us-west-2"
1992
+ }
1993
+ }
1994
+ },
1995
+ "access-keys": {
1996
+ label: "IAM Access Keys",
1997
+ helpText: "Use IAM access key credentials",
1998
+ credentials: {
1999
+ AWS_ACCESS_KEY_ID: {
2000
+ label: "AWS_ACCESS_KEY_ID",
2001
+ required: true,
2002
+ helpText: "IAM access key ID"
2003
+ },
2004
+ AWS_SECRET_ACCESS_KEY: {
2005
+ label: "AWS_SECRET_ACCESS_KEY",
2006
+ required: true,
2007
+ helpText: "IAM secret access key"
2008
+ },
2009
+ AWS_SESSION_TOKEN: {
2010
+ label: "AWS_SESSION_TOKEN",
2011
+ required: false,
2012
+ helpText: "Optional, for temporary credentials"
2013
+ },
2014
+ AWS_REGION: {
2015
+ label: "AWS_REGION",
2016
+ required: true,
2017
+ placeholder: "us-east-1",
2018
+ helpText: "e.g., us-east-1, us-west-2"
2019
+ }
2020
+ }
2021
+ }
2022
+ },
2023
+ defaultAuthMethod: "api-key",
2024
+ environmentMapping: {
2025
+ CLAUDE_CODE_USE_BEDROCK: "1",
2026
+ AWS_REGION: "$credentials.AWS_REGION",
2027
+ AWS_BEARER_TOKEN_BEDROCK: "$credentials.AWS_BEARER_TOKEN_BEDROCK",
2028
+ AWS_ACCESS_KEY_ID: "$credentials.AWS_ACCESS_KEY_ID",
2029
+ AWS_SECRET_ACCESS_KEY: "$credentials.AWS_SECRET_ACCESS_KEY",
2030
+ AWS_SESSION_TOKEN: "$credentials.AWS_SESSION_TOKEN",
2031
+ ANTHROPIC_MODEL: "$model"
2032
+ },
2033
+ models: [],
2034
+ defaultModel: "",
2035
+ allowCustomModel: true,
2036
+ customModelPlaceholder: "anthropic.claude-sonnet-4-20250514-v1:0"
1972
2037
  }
1973
2038
  };
1974
2039
  var modelProviderTypeSchema = z14.enum([
@@ -1976,9 +2041,30 @@ var modelProviderTypeSchema = z14.enum([
1976
2041
  "anthropic-api-key",
1977
2042
  "openrouter-api-key",
1978
2043
  "moonshot-api-key",
1979
- "minimax-api-key"
2044
+ "minimax-api-key",
2045
+ "aws-bedrock"
1980
2046
  ]);
1981
2047
  var modelProviderFrameworkSchema = z14.enum(["claude-code", "codex"]);
2048
+ function hasAuthMethods(type) {
2049
+ const config = MODEL_PROVIDER_TYPES[type];
2050
+ return "authMethods" in config;
2051
+ }
2052
+ function getAuthMethodsForType(type) {
2053
+ const config = MODEL_PROVIDER_TYPES[type];
2054
+ return "authMethods" in config ? config.authMethods : void 0;
2055
+ }
2056
+ function getDefaultAuthMethod(type) {
2057
+ const config = MODEL_PROVIDER_TYPES[type];
2058
+ return "defaultAuthMethod" in config ? config.defaultAuthMethod : void 0;
2059
+ }
2060
+ function getCredentialsForAuthMethod(type, authMethod) {
2061
+ const authMethods = getAuthMethodsForType(type);
2062
+ if (!authMethods || !(authMethod in authMethods)) {
2063
+ return void 0;
2064
+ }
2065
+ const method = authMethods[authMethod];
2066
+ return method?.credentials;
2067
+ }
1982
2068
  function getModels(type) {
1983
2069
  const config = MODEL_PROVIDER_TYPES[type];
1984
2070
  return "models" in config ? config.models : void 0;
@@ -1989,13 +2075,26 @@ function getDefaultModel(type) {
1989
2075
  }
1990
2076
  function hasModelSelection(type) {
1991
2077
  const config = MODEL_PROVIDER_TYPES[type];
1992
- return "models" in config && config.models.length > 0;
2078
+ return "models" in config && config.models.length > 0 || "allowCustomModel" in config && config.allowCustomModel === true;
2079
+ }
2080
+ function allowsCustomModel(type) {
2081
+ const config = MODEL_PROVIDER_TYPES[type];
2082
+ return "allowCustomModel" in config && config.allowCustomModel === true;
2083
+ }
2084
+ function getCustomModelPlaceholder(type) {
2085
+ const config = MODEL_PROVIDER_TYPES[type];
2086
+ return "customModelPlaceholder" in config ? config.customModelPlaceholder : void 0;
1993
2087
  }
1994
2088
  var modelProviderResponseSchema = z14.object({
1995
2089
  id: z14.string().uuid(),
1996
2090
  type: modelProviderTypeSchema,
1997
2091
  framework: modelProviderFrameworkSchema,
1998
- credentialName: z14.string(),
2092
+ credentialName: z14.string().nullable(),
2093
+ // Legacy single-credential (deprecated for multi-auth)
2094
+ authMethod: z14.string().nullable(),
2095
+ // For multi-auth providers
2096
+ credentialNames: z14.array(z14.string()).nullable(),
2097
+ // For multi-auth providers
1999
2098
  isDefault: z14.boolean(),
2000
2099
  selectedModel: z14.string().nullable(),
2001
2100
  createdAt: z14.string(),
@@ -2006,7 +2105,12 @@ var modelProviderListResponseSchema = z14.object({
2006
2105
  });
2007
2106
  var upsertModelProviderRequestSchema = z14.object({
2008
2107
  type: modelProviderTypeSchema,
2009
- credential: z14.string().min(1, "Credential is required"),
2108
+ credential: z14.string().min(1).optional(),
2109
+ // Legacy single credential
2110
+ authMethod: z14.string().optional(),
2111
+ // For multi-auth providers
2112
+ credentials: z14.record(z14.string(), z14.string()).optional(),
2113
+ // For multi-auth providers
2010
2114
  convert: z14.boolean().optional(),
2011
2115
  selectedModel: z14.string().optional()
2012
2116
  });
@@ -2651,29 +2755,67 @@ var platformArtifactDownloadContract = c15.router({
2651
2755
  }
2652
2756
  });
2653
2757
 
2654
- // ../../packages/core/src/contracts/public/agents.ts
2758
+ // ../../packages/core/src/contracts/llm.ts
2655
2759
  import { z as z20 } from "zod";
2656
2760
  var c16 = initContract();
2657
- var publicAgentSchema = z20.object({
2658
- id: z20.string(),
2659
- name: z20.string(),
2660
- currentVersionId: z20.string().nullable(),
2761
+ var messageRoleSchema = z20.enum(["user", "assistant", "system"]);
2762
+ var chatMessageSchema = z20.object({
2763
+ role: messageRoleSchema,
2764
+ content: z20.string()
2765
+ });
2766
+ var tokenUsageSchema = z20.object({
2767
+ promptTokens: z20.number(),
2768
+ completionTokens: z20.number(),
2769
+ totalTokens: z20.number()
2770
+ });
2771
+ var llmChatRequestSchema = z20.object({
2772
+ model: z20.string().min(1).optional(),
2773
+ messages: z20.array(chatMessageSchema).min(1, "At least one message is required"),
2774
+ stream: z20.boolean().optional().default(false)
2775
+ });
2776
+ var llmChatResponseSchema = z20.object({
2777
+ content: z20.string(),
2778
+ model: z20.string(),
2779
+ usage: tokenUsageSchema
2780
+ });
2781
+ var llmChatContract = c16.router({
2782
+ chat: {
2783
+ method: "POST",
2784
+ path: "/api/llm/chat",
2785
+ body: llmChatRequestSchema,
2786
+ responses: {
2787
+ 200: llmChatResponseSchema,
2788
+ 400: apiErrorSchema,
2789
+ 500: apiErrorSchema,
2790
+ 503: apiErrorSchema
2791
+ },
2792
+ summary: "Send a chat completion request to OpenRouter"
2793
+ }
2794
+ });
2795
+
2796
+ // ../../packages/core/src/contracts/public/agents.ts
2797
+ import { z as z21 } from "zod";
2798
+ var c17 = initContract();
2799
+ var publicAgentSchema = z21.object({
2800
+ id: z21.string(),
2801
+ name: z21.string(),
2802
+ currentVersionId: z21.string().nullable(),
2661
2803
  createdAt: timestampSchema,
2662
2804
  updatedAt: timestampSchema
2663
2805
  });
2664
- var agentVersionSchema = z20.object({
2665
- id: z20.string(),
2666
- agentId: z20.string(),
2667
- versionNumber: z20.number(),
2806
+ var agentVersionSchema = z21.object({
2807
+ id: z21.string(),
2808
+ agentId: z21.string(),
2809
+ versionNumber: z21.number(),
2668
2810
  createdAt: timestampSchema
2669
2811
  });
2670
2812
  var publicAgentDetailSchema = publicAgentSchema;
2671
2813
  var paginatedAgentsSchema = createPaginatedResponseSchema(publicAgentSchema);
2672
2814
  var paginatedAgentVersionsSchema = createPaginatedResponseSchema(agentVersionSchema);
2673
2815
  var agentListQuerySchema = listQuerySchema.extend({
2674
- name: z20.string().optional()
2816
+ name: z21.string().optional()
2675
2817
  });
2676
- var publicAgentsListContract = c16.router({
2818
+ var publicAgentsListContract = c17.router({
2677
2819
  list: {
2678
2820
  method: "GET",
2679
2821
  path: "/v1/agents",
@@ -2688,13 +2830,13 @@ var publicAgentsListContract = c16.router({
2688
2830
  description: "List all agents in the current scope with pagination. Use the `name` query parameter to filter by agent name."
2689
2831
  }
2690
2832
  });
2691
- var publicAgentByIdContract = c16.router({
2833
+ var publicAgentByIdContract = c17.router({
2692
2834
  get: {
2693
2835
  method: "GET",
2694
2836
  path: "/v1/agents/:id",
2695
2837
  headers: authHeadersSchema,
2696
- pathParams: z20.object({
2697
- id: z20.string().min(1, "Agent ID is required")
2838
+ pathParams: z21.object({
2839
+ id: z21.string().min(1, "Agent ID is required")
2698
2840
  }),
2699
2841
  responses: {
2700
2842
  200: publicAgentDetailSchema,
@@ -2706,13 +2848,13 @@ var publicAgentByIdContract = c16.router({
2706
2848
  description: "Get agent details by ID"
2707
2849
  }
2708
2850
  });
2709
- var publicAgentVersionsContract = c16.router({
2851
+ var publicAgentVersionsContract = c17.router({
2710
2852
  list: {
2711
2853
  method: "GET",
2712
2854
  path: "/v1/agents/:id/versions",
2713
2855
  headers: authHeadersSchema,
2714
- pathParams: z20.object({
2715
- id: z20.string().min(1, "Agent ID is required")
2856
+ pathParams: z21.object({
2857
+ id: z21.string().min(1, "Agent ID is required")
2716
2858
  }),
2717
2859
  query: listQuerySchema,
2718
2860
  responses: {
@@ -2727,9 +2869,9 @@ var publicAgentVersionsContract = c16.router({
2727
2869
  });
2728
2870
 
2729
2871
  // ../../packages/core/src/contracts/public/runs.ts
2730
- import { z as z21 } from "zod";
2731
- var c17 = initContract();
2732
- var publicRunStatusSchema = z21.enum([
2872
+ import { z as z22 } from "zod";
2873
+ var c18 = initContract();
2874
+ var publicRunStatusSchema = z22.enum([
2733
2875
  "pending",
2734
2876
  "running",
2735
2877
  "completed",
@@ -2737,54 +2879,54 @@ var publicRunStatusSchema = z21.enum([
2737
2879
  "timeout",
2738
2880
  "cancelled"
2739
2881
  ]);
2740
- var publicRunSchema = z21.object({
2741
- id: z21.string(),
2742
- agentId: z21.string(),
2743
- agentName: z21.string(),
2882
+ var publicRunSchema = z22.object({
2883
+ id: z22.string(),
2884
+ agentId: z22.string(),
2885
+ agentName: z22.string(),
2744
2886
  status: publicRunStatusSchema,
2745
- prompt: z21.string(),
2887
+ prompt: z22.string(),
2746
2888
  createdAt: timestampSchema,
2747
2889
  startedAt: timestampSchema.nullable(),
2748
2890
  completedAt: timestampSchema.nullable()
2749
2891
  });
2750
2892
  var publicRunDetailSchema = publicRunSchema.extend({
2751
- error: z21.string().nullable(),
2752
- executionTimeMs: z21.number().nullable(),
2753
- checkpointId: z21.string().nullable(),
2754
- sessionId: z21.string().nullable(),
2755
- artifactName: z21.string().nullable(),
2756
- artifactVersion: z21.string().nullable(),
2757
- volumes: z21.record(z21.string(), z21.string()).optional()
2893
+ error: z22.string().nullable(),
2894
+ executionTimeMs: z22.number().nullable(),
2895
+ checkpointId: z22.string().nullable(),
2896
+ sessionId: z22.string().nullable(),
2897
+ artifactName: z22.string().nullable(),
2898
+ artifactVersion: z22.string().nullable(),
2899
+ volumes: z22.record(z22.string(), z22.string()).optional()
2758
2900
  });
2759
2901
  var paginatedRunsSchema = createPaginatedResponseSchema(publicRunSchema);
2760
- var createRunRequestSchema = z21.object({
2902
+ var createRunRequestSchema = z22.object({
2761
2903
  // Agent identification (one of: agent, agentId, sessionId, checkpointId)
2762
- agent: z21.string().optional(),
2904
+ agent: z22.string().optional(),
2763
2905
  // Agent name
2764
- agentId: z21.string().optional(),
2906
+ agentId: z22.string().optional(),
2765
2907
  // Agent ID
2766
- agentVersion: z21.string().optional(),
2908
+ agentVersion: z22.string().optional(),
2767
2909
  // Version specifier (e.g., "latest", "v1", specific ID)
2768
2910
  // Continue session
2769
- sessionId: z21.string().optional(),
2911
+ sessionId: z22.string().optional(),
2770
2912
  // Resume from checkpoint
2771
- checkpointId: z21.string().optional(),
2913
+ checkpointId: z22.string().optional(),
2772
2914
  // Required
2773
- prompt: z21.string().min(1, "Prompt is required"),
2915
+ prompt: z22.string().min(1, "Prompt is required"),
2774
2916
  // Optional configuration
2775
- variables: z21.record(z21.string(), z21.string()).optional(),
2776
- secrets: z21.record(z21.string(), z21.string()).optional(),
2777
- artifactName: z21.string().optional(),
2917
+ variables: z22.record(z22.string(), z22.string()).optional(),
2918
+ secrets: z22.record(z22.string(), z22.string()).optional(),
2919
+ artifactName: z22.string().optional(),
2778
2920
  // Artifact name to mount
2779
- artifactVersion: z21.string().optional(),
2921
+ artifactVersion: z22.string().optional(),
2780
2922
  // Artifact version (defaults to latest)
2781
- volumes: z21.record(z21.string(), z21.string()).optional()
2923
+ volumes: z22.record(z22.string(), z22.string()).optional()
2782
2924
  // volume_name -> version
2783
2925
  });
2784
2926
  var runListQuerySchema = listQuerySchema.extend({
2785
2927
  status: publicRunStatusSchema.optional()
2786
2928
  });
2787
- var publicRunsListContract = c17.router({
2929
+ var publicRunsListContract = c18.router({
2788
2930
  list: {
2789
2931
  method: "GET",
2790
2932
  path: "/v1/runs",
@@ -2816,13 +2958,13 @@ var publicRunsListContract = c17.router({
2816
2958
  description: "Create and execute a new agent run. Returns 202 Accepted as runs execute asynchronously."
2817
2959
  }
2818
2960
  });
2819
- var publicRunByIdContract = c17.router({
2961
+ var publicRunByIdContract = c18.router({
2820
2962
  get: {
2821
2963
  method: "GET",
2822
2964
  path: "/v1/runs/:id",
2823
2965
  headers: authHeadersSchema,
2824
- pathParams: z21.object({
2825
- id: z21.string().min(1, "Run ID is required")
2966
+ pathParams: z22.object({
2967
+ id: z22.string().min(1, "Run ID is required")
2826
2968
  }),
2827
2969
  responses: {
2828
2970
  200: publicRunDetailSchema,
@@ -2834,15 +2976,15 @@ var publicRunByIdContract = c17.router({
2834
2976
  description: "Get run details by ID"
2835
2977
  }
2836
2978
  });
2837
- var publicRunCancelContract = c17.router({
2979
+ var publicRunCancelContract = c18.router({
2838
2980
  cancel: {
2839
2981
  method: "POST",
2840
2982
  path: "/v1/runs/:id/cancel",
2841
2983
  headers: authHeadersSchema,
2842
- pathParams: z21.object({
2843
- id: z21.string().min(1, "Run ID is required")
2984
+ pathParams: z22.object({
2985
+ id: z22.string().min(1, "Run ID is required")
2844
2986
  }),
2845
- body: z21.undefined(),
2987
+ body: z22.undefined(),
2846
2988
  responses: {
2847
2989
  200: publicRunDetailSchema,
2848
2990
  400: publicApiErrorSchema,
@@ -2855,27 +2997,27 @@ var publicRunCancelContract = c17.router({
2855
2997
  description: "Cancel a pending or running execution"
2856
2998
  }
2857
2999
  });
2858
- var logEntrySchema = z21.object({
3000
+ var logEntrySchema = z22.object({
2859
3001
  timestamp: timestampSchema,
2860
- type: z21.enum(["agent", "system", "network"]),
2861
- level: z21.enum(["debug", "info", "warn", "error"]),
2862
- message: z21.string(),
2863
- metadata: z21.record(z21.string(), z21.unknown()).optional()
3002
+ type: z22.enum(["agent", "system", "network"]),
3003
+ level: z22.enum(["debug", "info", "warn", "error"]),
3004
+ message: z22.string(),
3005
+ metadata: z22.record(z22.string(), z22.unknown()).optional()
2864
3006
  });
2865
3007
  var paginatedLogsSchema = createPaginatedResponseSchema(logEntrySchema);
2866
3008
  var logsQuerySchema = listQuerySchema.extend({
2867
- type: z21.enum(["agent", "system", "network", "all"]).default("all"),
3009
+ type: z22.enum(["agent", "system", "network", "all"]).default("all"),
2868
3010
  since: timestampSchema.optional(),
2869
3011
  until: timestampSchema.optional(),
2870
- order: z21.enum(["asc", "desc"]).default("asc")
3012
+ order: z22.enum(["asc", "desc"]).default("asc")
2871
3013
  });
2872
- var publicRunLogsContract = c17.router({
3014
+ var publicRunLogsContract = c18.router({
2873
3015
  getLogs: {
2874
3016
  method: "GET",
2875
3017
  path: "/v1/runs/:id/logs",
2876
3018
  headers: authHeadersSchema,
2877
- pathParams: z21.object({
2878
- id: z21.string().min(1, "Run ID is required")
3019
+ pathParams: z22.object({
3020
+ id: z22.string().min(1, "Run ID is required")
2879
3021
  }),
2880
3022
  query: logsQuerySchema,
2881
3023
  responses: {
@@ -2888,30 +3030,30 @@ var publicRunLogsContract = c17.router({
2888
3030
  description: "Get unified logs for a run. Combines agent, system, and network logs."
2889
3031
  }
2890
3032
  });
2891
- var metricPointSchema = z21.object({
3033
+ var metricPointSchema = z22.object({
2892
3034
  timestamp: timestampSchema,
2893
- cpuPercent: z21.number(),
2894
- memoryUsedMb: z21.number(),
2895
- memoryTotalMb: z21.number(),
2896
- diskUsedMb: z21.number(),
2897
- diskTotalMb: z21.number()
2898
- });
2899
- var metricsSummarySchema = z21.object({
2900
- avgCpuPercent: z21.number(),
2901
- maxMemoryUsedMb: z21.number(),
2902
- totalDurationMs: z21.number().nullable()
2903
- });
2904
- var metricsResponseSchema2 = z21.object({
2905
- data: z21.array(metricPointSchema),
3035
+ cpuPercent: z22.number(),
3036
+ memoryUsedMb: z22.number(),
3037
+ memoryTotalMb: z22.number(),
3038
+ diskUsedMb: z22.number(),
3039
+ diskTotalMb: z22.number()
3040
+ });
3041
+ var metricsSummarySchema = z22.object({
3042
+ avgCpuPercent: z22.number(),
3043
+ maxMemoryUsedMb: z22.number(),
3044
+ totalDurationMs: z22.number().nullable()
3045
+ });
3046
+ var metricsResponseSchema2 = z22.object({
3047
+ data: z22.array(metricPointSchema),
2906
3048
  summary: metricsSummarySchema
2907
3049
  });
2908
- var publicRunMetricsContract = c17.router({
3050
+ var publicRunMetricsContract = c18.router({
2909
3051
  getMetrics: {
2910
3052
  method: "GET",
2911
3053
  path: "/v1/runs/:id/metrics",
2912
3054
  headers: authHeadersSchema,
2913
- pathParams: z21.object({
2914
- id: z21.string().min(1, "Run ID is required")
3055
+ pathParams: z22.object({
3056
+ id: z22.string().min(1, "Run ID is required")
2915
3057
  }),
2916
3058
  responses: {
2917
3059
  200: metricsResponseSchema2,
@@ -2923,7 +3065,7 @@ var publicRunMetricsContract = c17.router({
2923
3065
  description: "Get CPU, memory, and disk metrics for a run"
2924
3066
  }
2925
3067
  });
2926
- var sseEventTypeSchema = z21.enum([
3068
+ var sseEventTypeSchema = z22.enum([
2927
3069
  "status",
2928
3070
  // Run status change
2929
3071
  "output",
@@ -2935,26 +3077,26 @@ var sseEventTypeSchema = z21.enum([
2935
3077
  "heartbeat"
2936
3078
  // Keep-alive
2937
3079
  ]);
2938
- var sseEventSchema = z21.object({
3080
+ var sseEventSchema = z22.object({
2939
3081
  event: sseEventTypeSchema,
2940
- data: z21.unknown(),
2941
- id: z21.string().optional()
3082
+ data: z22.unknown(),
3083
+ id: z22.string().optional()
2942
3084
  // For Last-Event-ID reconnection
2943
3085
  });
2944
- var publicRunEventsContract = c17.router({
3086
+ var publicRunEventsContract = c18.router({
2945
3087
  streamEvents: {
2946
3088
  method: "GET",
2947
3089
  path: "/v1/runs/:id/events",
2948
3090
  headers: authHeadersSchema,
2949
- pathParams: z21.object({
2950
- id: z21.string().min(1, "Run ID is required")
3091
+ pathParams: z22.object({
3092
+ id: z22.string().min(1, "Run ID is required")
2951
3093
  }),
2952
- query: z21.object({
2953
- lastEventId: z21.string().optional()
3094
+ query: z22.object({
3095
+ lastEventId: z22.string().optional()
2954
3096
  // For reconnection
2955
3097
  }),
2956
3098
  responses: {
2957
- 200: z21.any(),
3099
+ 200: z22.any(),
2958
3100
  // SSE stream - actual content is text/event-stream
2959
3101
  401: publicApiErrorSchema,
2960
3102
  404: publicApiErrorSchema,
@@ -2966,28 +3108,28 @@ var publicRunEventsContract = c17.router({
2966
3108
  });
2967
3109
 
2968
3110
  // ../../packages/core/src/contracts/public/artifacts.ts
2969
- import { z as z22 } from "zod";
2970
- var c18 = initContract();
2971
- var publicArtifactSchema = z22.object({
2972
- id: z22.string(),
2973
- name: z22.string(),
2974
- currentVersionId: z22.string().nullable(),
2975
- size: z22.number(),
3111
+ import { z as z23 } from "zod";
3112
+ var c19 = initContract();
3113
+ var publicArtifactSchema = z23.object({
3114
+ id: z23.string(),
3115
+ name: z23.string(),
3116
+ currentVersionId: z23.string().nullable(),
3117
+ size: z23.number(),
2976
3118
  // Total size in bytes
2977
- fileCount: z22.number(),
3119
+ fileCount: z23.number(),
2978
3120
  createdAt: timestampSchema,
2979
3121
  updatedAt: timestampSchema
2980
3122
  });
2981
- var artifactVersionSchema = z22.object({
2982
- id: z22.string(),
3123
+ var artifactVersionSchema = z23.object({
3124
+ id: z23.string(),
2983
3125
  // SHA-256 content hash
2984
- artifactId: z22.string(),
2985
- size: z22.number(),
3126
+ artifactId: z23.string(),
3127
+ size: z23.number(),
2986
3128
  // Size in bytes
2987
- fileCount: z22.number(),
2988
- message: z22.string().nullable(),
3129
+ fileCount: z23.number(),
3130
+ message: z23.string().nullable(),
2989
3131
  // Optional commit message
2990
- createdBy: z22.string(),
3132
+ createdBy: z23.string(),
2991
3133
  createdAt: timestampSchema
2992
3134
  });
2993
3135
  var publicArtifactDetailSchema = publicArtifactSchema.extend({
@@ -2997,7 +3139,7 @@ var paginatedArtifactsSchema = createPaginatedResponseSchema(publicArtifactSchem
2997
3139
  var paginatedArtifactVersionsSchema = createPaginatedResponseSchema(
2998
3140
  artifactVersionSchema
2999
3141
  );
3000
- var publicArtifactsListContract = c18.router({
3142
+ var publicArtifactsListContract = c19.router({
3001
3143
  list: {
3002
3144
  method: "GET",
3003
3145
  path: "/v1/artifacts",
@@ -3012,13 +3154,13 @@ var publicArtifactsListContract = c18.router({
3012
3154
  description: "List all artifacts in the current scope with pagination"
3013
3155
  }
3014
3156
  });
3015
- var publicArtifactByIdContract = c18.router({
3157
+ var publicArtifactByIdContract = c19.router({
3016
3158
  get: {
3017
3159
  method: "GET",
3018
3160
  path: "/v1/artifacts/:id",
3019
3161
  headers: authHeadersSchema,
3020
- pathParams: z22.object({
3021
- id: z22.string().min(1, "Artifact ID is required")
3162
+ pathParams: z23.object({
3163
+ id: z23.string().min(1, "Artifact ID is required")
3022
3164
  }),
3023
3165
  responses: {
3024
3166
  200: publicArtifactDetailSchema,
@@ -3030,13 +3172,13 @@ var publicArtifactByIdContract = c18.router({
3030
3172
  description: "Get artifact details by ID"
3031
3173
  }
3032
3174
  });
3033
- var publicArtifactVersionsContract = c18.router({
3175
+ var publicArtifactVersionsContract = c19.router({
3034
3176
  list: {
3035
3177
  method: "GET",
3036
3178
  path: "/v1/artifacts/:id/versions",
3037
3179
  headers: authHeadersSchema,
3038
- pathParams: z22.object({
3039
- id: z22.string().min(1, "Artifact ID is required")
3180
+ pathParams: z23.object({
3181
+ id: z23.string().min(1, "Artifact ID is required")
3040
3182
  }),
3041
3183
  query: listQuerySchema,
3042
3184
  responses: {
@@ -3049,20 +3191,20 @@ var publicArtifactVersionsContract = c18.router({
3049
3191
  description: "List all versions of an artifact with pagination"
3050
3192
  }
3051
3193
  });
3052
- var publicArtifactDownloadContract = c18.router({
3194
+ var publicArtifactDownloadContract = c19.router({
3053
3195
  download: {
3054
3196
  method: "GET",
3055
3197
  path: "/v1/artifacts/:id/download",
3056
3198
  headers: authHeadersSchema,
3057
- pathParams: z22.object({
3058
- id: z22.string().min(1, "Artifact ID is required")
3199
+ pathParams: z23.object({
3200
+ id: z23.string().min(1, "Artifact ID is required")
3059
3201
  }),
3060
- query: z22.object({
3061
- versionId: z22.string().optional()
3202
+ query: z23.object({
3203
+ versionId: z23.string().optional()
3062
3204
  // Defaults to current version
3063
3205
  }),
3064
3206
  responses: {
3065
- 302: z22.undefined(),
3207
+ 302: z23.undefined(),
3066
3208
  // Redirect to presigned URL
3067
3209
  401: publicApiErrorSchema,
3068
3210
  404: publicApiErrorSchema,
@@ -3074,28 +3216,28 @@ var publicArtifactDownloadContract = c18.router({
3074
3216
  });
3075
3217
 
3076
3218
  // ../../packages/core/src/contracts/public/volumes.ts
3077
- import { z as z23 } from "zod";
3078
- var c19 = initContract();
3079
- var publicVolumeSchema = z23.object({
3080
- id: z23.string(),
3081
- name: z23.string(),
3082
- currentVersionId: z23.string().nullable(),
3083
- size: z23.number(),
3219
+ import { z as z24 } from "zod";
3220
+ var c20 = initContract();
3221
+ var publicVolumeSchema = z24.object({
3222
+ id: z24.string(),
3223
+ name: z24.string(),
3224
+ currentVersionId: z24.string().nullable(),
3225
+ size: z24.number(),
3084
3226
  // Total size in bytes
3085
- fileCount: z23.number(),
3227
+ fileCount: z24.number(),
3086
3228
  createdAt: timestampSchema,
3087
3229
  updatedAt: timestampSchema
3088
3230
  });
3089
- var volumeVersionSchema = z23.object({
3090
- id: z23.string(),
3231
+ var volumeVersionSchema = z24.object({
3232
+ id: z24.string(),
3091
3233
  // SHA-256 content hash
3092
- volumeId: z23.string(),
3093
- size: z23.number(),
3234
+ volumeId: z24.string(),
3235
+ size: z24.number(),
3094
3236
  // Size in bytes
3095
- fileCount: z23.number(),
3096
- message: z23.string().nullable(),
3237
+ fileCount: z24.number(),
3238
+ message: z24.string().nullable(),
3097
3239
  // Optional commit message
3098
- createdBy: z23.string(),
3240
+ createdBy: z24.string(),
3099
3241
  createdAt: timestampSchema
3100
3242
  });
3101
3243
  var publicVolumeDetailSchema = publicVolumeSchema.extend({
@@ -3103,7 +3245,7 @@ var publicVolumeDetailSchema = publicVolumeSchema.extend({
3103
3245
  });
3104
3246
  var paginatedVolumesSchema = createPaginatedResponseSchema(publicVolumeSchema);
3105
3247
  var paginatedVolumeVersionsSchema = createPaginatedResponseSchema(volumeVersionSchema);
3106
- var publicVolumesListContract = c19.router({
3248
+ var publicVolumesListContract = c20.router({
3107
3249
  list: {
3108
3250
  method: "GET",
3109
3251
  path: "/v1/volumes",
@@ -3118,13 +3260,13 @@ var publicVolumesListContract = c19.router({
3118
3260
  description: "List all volumes in the current scope with pagination"
3119
3261
  }
3120
3262
  });
3121
- var publicVolumeByIdContract = c19.router({
3263
+ var publicVolumeByIdContract = c20.router({
3122
3264
  get: {
3123
3265
  method: "GET",
3124
3266
  path: "/v1/volumes/:id",
3125
3267
  headers: authHeadersSchema,
3126
- pathParams: z23.object({
3127
- id: z23.string().min(1, "Volume ID is required")
3268
+ pathParams: z24.object({
3269
+ id: z24.string().min(1, "Volume ID is required")
3128
3270
  }),
3129
3271
  responses: {
3130
3272
  200: publicVolumeDetailSchema,
@@ -3136,13 +3278,13 @@ var publicVolumeByIdContract = c19.router({
3136
3278
  description: "Get volume details by ID"
3137
3279
  }
3138
3280
  });
3139
- var publicVolumeVersionsContract = c19.router({
3281
+ var publicVolumeVersionsContract = c20.router({
3140
3282
  list: {
3141
3283
  method: "GET",
3142
3284
  path: "/v1/volumes/:id/versions",
3143
3285
  headers: authHeadersSchema,
3144
- pathParams: z23.object({
3145
- id: z23.string().min(1, "Volume ID is required")
3286
+ pathParams: z24.object({
3287
+ id: z24.string().min(1, "Volume ID is required")
3146
3288
  }),
3147
3289
  query: listQuerySchema,
3148
3290
  responses: {
@@ -3155,20 +3297,20 @@ var publicVolumeVersionsContract = c19.router({
3155
3297
  description: "List all versions of a volume with pagination"
3156
3298
  }
3157
3299
  });
3158
- var publicVolumeDownloadContract = c19.router({
3300
+ var publicVolumeDownloadContract = c20.router({
3159
3301
  download: {
3160
3302
  method: "GET",
3161
3303
  path: "/v1/volumes/:id/download",
3162
3304
  headers: authHeadersSchema,
3163
- pathParams: z23.object({
3164
- id: z23.string().min(1, "Volume ID is required")
3305
+ pathParams: z24.object({
3306
+ id: z24.string().min(1, "Volume ID is required")
3165
3307
  }),
3166
- query: z23.object({
3167
- versionId: z23.string().optional()
3308
+ query: z24.object({
3309
+ versionId: z24.string().optional()
3168
3310
  // Defaults to current version
3169
3311
  }),
3170
3312
  responses: {
3171
- 302: z23.undefined(),
3313
+ 302: z24.undefined(),
3172
3314
  // Redirect to presigned URL
3173
3315
  401: publicApiErrorSchema,
3174
3316
  404: publicApiErrorSchema,
@@ -3789,8 +3931,8 @@ async function getUsage(options) {
3789
3931
  }
3790
3932
 
3791
3933
  // src/lib/domain/yaml-validator.ts
3792
- import { z as z24 } from "zod";
3793
- var cliAgentNameSchema = z24.string().min(3, "Agent name must be at least 3 characters").max(64, "Agent name must be 64 characters or less").regex(
3934
+ import { z as z25 } from "zod";
3935
+ var cliAgentNameSchema = z25.string().min(3, "Agent name must be at least 3 characters").max(64, "Agent name must be 64 characters or less").regex(
3794
3936
  /^[a-zA-Z0-9]([a-zA-Z0-9-]{0,62}[a-zA-Z0-9])?$/,
3795
3937
  "Agent name must start and end with letter or number, and contain only letters, numbers, and hyphens"
3796
3938
  );
@@ -3805,7 +3947,7 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
3805
3947
  const skillUrl = agent.skills[i];
3806
3948
  if (skillUrl && !validateGitHubTreeUrl(skillUrl)) {
3807
3949
  ctx.addIssue({
3808
- code: z24.ZodIssueCode.custom,
3950
+ code: z25.ZodIssueCode.custom,
3809
3951
  message: `Invalid skill URL: ${skillUrl}. Expected format: https://github.com/{owner}/{repo}/tree/{branch}/{path}`,
3810
3952
  path: ["skills", i]
3811
3953
  });
@@ -3814,15 +3956,15 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
3814
3956
  }
3815
3957
  }
3816
3958
  );
3817
- var cliComposeSchema = z24.object({
3818
- version: z24.string().min(1, "Missing config.version"),
3819
- agents: z24.record(cliAgentNameSchema, cliAgentDefinitionSchema),
3820
- volumes: z24.record(z24.string(), volumeConfigSchema).optional()
3959
+ var cliComposeSchema = z25.object({
3960
+ version: z25.string().min(1, "Missing config.version"),
3961
+ agents: z25.record(cliAgentNameSchema, cliAgentDefinitionSchema),
3962
+ volumes: z25.record(z25.string(), volumeConfigSchema).optional()
3821
3963
  }).superRefine((config, ctx) => {
3822
3964
  const agentKeys = Object.keys(config.agents);
3823
3965
  if (agentKeys.length === 0) {
3824
3966
  ctx.addIssue({
3825
- code: z24.ZodIssueCode.custom,
3967
+ code: z25.ZodIssueCode.custom,
3826
3968
  message: "agents must have at least one agent defined",
3827
3969
  path: ["agents"]
3828
3970
  });
@@ -3830,7 +3972,7 @@ var cliComposeSchema = z24.object({
3830
3972
  }
3831
3973
  if (agentKeys.length > 1) {
3832
3974
  ctx.addIssue({
3833
- code: z24.ZodIssueCode.custom,
3975
+ code: z25.ZodIssueCode.custom,
3834
3976
  message: "Multiple agents not supported yet. Only one agent allowed.",
3835
3977
  path: ["agents"]
3836
3978
  });
@@ -3842,7 +3984,7 @@ var cliComposeSchema = z24.object({
3842
3984
  if (agentVolumes && agentVolumes.length > 0) {
3843
3985
  if (!config.volumes) {
3844
3986
  ctx.addIssue({
3845
- code: z24.ZodIssueCode.custom,
3987
+ code: z25.ZodIssueCode.custom,
3846
3988
  message: "Agent references volumes but no volumes section defined. Each volume must have explicit name and version.",
3847
3989
  path: ["volumes"]
3848
3990
  });
@@ -3852,7 +3994,7 @@ var cliComposeSchema = z24.object({
3852
3994
  const parts = volDeclaration.split(":");
3853
3995
  if (parts.length !== 2) {
3854
3996
  ctx.addIssue({
3855
- code: z24.ZodIssueCode.custom,
3997
+ code: z25.ZodIssueCode.custom,
3856
3998
  message: `Invalid volume declaration: ${volDeclaration}. Expected format: volume-key:/mount/path`,
3857
3999
  path: ["agents", agentName, "volumes"]
3858
4000
  });
@@ -3861,7 +4003,7 @@ var cliComposeSchema = z24.object({
3861
4003
  const volumeKey = parts[0].trim();
3862
4004
  if (!config.volumes[volumeKey]) {
3863
4005
  ctx.addIssue({
3864
- code: z24.ZodIssueCode.custom,
4006
+ code: z25.ZodIssueCode.custom,
3865
4007
  message: `Volume "${volumeKey}" is not defined in volumes section. Each volume must have explicit name and version.`,
3866
4008
  path: ["volumes", volumeKey]
3867
4009
  });
@@ -4895,7 +5037,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
4895
5037
  )
4896
5038
  );
4897
5039
  if (options.autoUpdate !== false) {
4898
- await silentUpgradeAfterCommand("9.14.0");
5040
+ await silentUpgradeAfterCommand("9.15.0");
4899
5041
  }
4900
5042
  } catch (error) {
4901
5043
  if (error instanceof Error) {
@@ -5650,9 +5792,9 @@ var CodexEventParser = class {
5650
5792
  }
5651
5793
  }
5652
5794
  if (itemType === "file_change" && item.changes && item.changes.length > 0) {
5653
- const changes = item.changes.map((c20) => {
5654
- const action = c20.kind === "add" ? "Created" : c20.kind === "modify" ? "Modified" : "Deleted";
5655
- return `${action}: ${c20.path}`;
5795
+ const changes = item.changes.map((c21) => {
5796
+ const action = c21.kind === "add" ? "Created" : c21.kind === "modify" ? "Modified" : "Deleted";
5797
+ return `${action}: ${c21.path}`;
5656
5798
  }).join("\n");
5657
5799
  return {
5658
5800
  type: "text",
@@ -5806,9 +5948,9 @@ var CodexEventRenderer = class {
5806
5948
  return;
5807
5949
  }
5808
5950
  if (itemType === "file_change" && item.changes && item.changes.length > 0) {
5809
- const summary = item.changes.map((c20) => {
5810
- const icon = c20.kind === "add" ? "+" : c20.kind === "delete" ? "-" : "~";
5811
- return `${icon}${c20.path}`;
5951
+ const summary = item.changes.map((c21) => {
5952
+ const icon = c21.kind === "add" ? "+" : c21.kind === "delete" ? "-" : "~";
5953
+ return `${icon}${c21.path}`;
5812
5954
  }).join(", ");
5813
5955
  console.log(chalk7.green("[files]") + ` ${summary}`);
5814
5956
  return;
@@ -7126,7 +7268,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
7126
7268
  }
7127
7269
  showNextSteps(result);
7128
7270
  if (options.autoUpdate !== false) {
7129
- await silentUpgradeAfterCommand("9.14.0");
7271
+ await silentUpgradeAfterCommand("9.15.0");
7130
7272
  }
7131
7273
  } catch (error) {
7132
7274
  handleRunError(error, identifier);
@@ -8631,8 +8773,8 @@ var cookAction = new Command27().name("cook").description("Quick start: prepare,
8631
8773
  "Load environment variables from file (priority: CLI flags > file > env vars)"
8632
8774
  ).option("-y, --yes", "Skip confirmation prompts").option("-v, --verbose", "Show full tool inputs and outputs").addOption(new Option5("--debug-no-mock-claude").hideHelp()).addOption(new Option5("--no-auto-update").hideHelp()).action(
8633
8775
  async (prompt, options) => {
8634
- if (!options.noAutoUpdate) {
8635
- const shouldExit = await checkAndUpgrade("9.14.0", prompt);
8776
+ if (options.autoUpdate !== false) {
8777
+ const shouldExit = await checkAndUpgrade("9.15.0", prompt);
8636
8778
  if (shouldExit) {
8637
8779
  process.exit(0);
8638
8780
  }
@@ -9346,7 +9488,7 @@ var listCommand4 = new Command36().name("list").alias("ls").description("List al
9346
9488
  );
9347
9489
  return;
9348
9490
  }
9349
- const nameWidth = Math.max(4, ...data.composes.map((c20) => c20.name.length));
9491
+ const nameWidth = Math.max(4, ...data.composes.map((c21) => c21.name.length));
9350
9492
  const header = ["NAME".padEnd(nameWidth), "VERSION", "UPDATED"].join(
9351
9493
  " "
9352
9494
  );
@@ -10128,7 +10270,7 @@ async function gatherFrequency(optionFrequency, existingFrequency) {
10128
10270
  );
10129
10271
  process.exit(1);
10130
10272
  }
10131
- const defaultIndex = existingFrequency ? FREQUENCY_CHOICES.findIndex((c20) => c20.value === existingFrequency) : 0;
10273
+ const defaultIndex = existingFrequency ? FREQUENCY_CHOICES.findIndex((c21) => c21.value === existingFrequency) : 0;
10132
10274
  frequency = await promptSelect(
10133
10275
  "Schedule frequency",
10134
10276
  FREQUENCY_CHOICES,
@@ -10157,7 +10299,7 @@ async function gatherDay(frequency, optionDay, existingDay) {
10157
10299
  process.exit(1);
10158
10300
  }
10159
10301
  if (frequency === "weekly") {
10160
- const defaultDayIndex = existingDay !== void 0 ? DAY_OF_WEEK_CHOICES.findIndex((c20) => c20.value === existingDay) : 0;
10302
+ const defaultDayIndex = existingDay !== void 0 ? DAY_OF_WEEK_CHOICES.findIndex((c21) => c21.value === existingDay) : 0;
10161
10303
  const day2 = await promptSelect(
10162
10304
  "Day of week",
10163
10305
  DAY_OF_WEEK_CHOICES,
@@ -11174,6 +11316,9 @@ function validateProviderType(typeStr) {
11174
11316
  }
11175
11317
  function validateModel(type, modelStr) {
11176
11318
  const models = getModels(type);
11319
+ if (allowsCustomModel(type)) {
11320
+ return modelStr;
11321
+ }
11177
11322
  if (models && !models.includes(modelStr)) {
11178
11323
  console.error(chalk52.red(`\u2717 Invalid model "${modelStr}"`));
11179
11324
  console.log();
@@ -11185,6 +11330,98 @@ function validateModel(type, modelStr) {
11185
11330
  }
11186
11331
  return modelStr;
11187
11332
  }
11333
+ function validateAuthMethod(type, authMethodStr) {
11334
+ const authMethods = getAuthMethodsForType(type);
11335
+ if (!authMethods || !(authMethodStr in authMethods)) {
11336
+ console.error(chalk52.red(`\u2717 Invalid auth method "${authMethodStr}"`));
11337
+ console.log();
11338
+ console.log("Valid auth methods:");
11339
+ if (authMethods) {
11340
+ for (const [method, config] of Object.entries(authMethods)) {
11341
+ console.log(` ${chalk52.cyan(method)} - ${config.label}`);
11342
+ }
11343
+ }
11344
+ process.exit(1);
11345
+ }
11346
+ return authMethodStr;
11347
+ }
11348
+ function parseCredentials(type, authMethod, credentialArgs) {
11349
+ const credentialsConfig = getCredentialsForAuthMethod(type, authMethod);
11350
+ if (!credentialsConfig) {
11351
+ console.error(chalk52.red(`\u2717 Invalid auth method "${authMethod}"`));
11352
+ process.exit(1);
11353
+ }
11354
+ const credentialNames = Object.keys(credentialsConfig);
11355
+ const firstArg = credentialArgs[0];
11356
+ if (credentialArgs.length === 1 && firstArg && !firstArg.includes("=")) {
11357
+ if (credentialNames.length !== 1) {
11358
+ console.error(
11359
+ chalk52.red(
11360
+ "\u2717 Must use KEY=VALUE format for multi-credential auth methods"
11361
+ )
11362
+ );
11363
+ console.log();
11364
+ console.log("Required credentials:");
11365
+ for (const [name, fieldConfig] of Object.entries(credentialsConfig)) {
11366
+ const requiredNote = fieldConfig.required ? " (required)" : "";
11367
+ console.log(` ${chalk52.cyan(name)}${requiredNote}`);
11368
+ }
11369
+ process.exit(1);
11370
+ }
11371
+ const firstCredentialName = credentialNames[0];
11372
+ if (!firstCredentialName) {
11373
+ console.error(chalk52.red("\u2717 No credentials defined for this auth method"));
11374
+ process.exit(1);
11375
+ }
11376
+ return { [firstCredentialName]: firstArg };
11377
+ }
11378
+ const credentials = {};
11379
+ for (const arg of credentialArgs) {
11380
+ const eqIndex = arg.indexOf("=");
11381
+ if (eqIndex === -1) {
11382
+ console.error(chalk52.red(`\u2717 Invalid credential format "${arg}"`));
11383
+ console.log();
11384
+ console.log("Use KEY=VALUE format (e.g., AWS_REGION=us-east-1)");
11385
+ process.exit(1);
11386
+ }
11387
+ const key = arg.slice(0, eqIndex);
11388
+ const value = arg.slice(eqIndex + 1);
11389
+ credentials[key] = value;
11390
+ }
11391
+ return credentials;
11392
+ }
11393
+ function validateCredentials(type, authMethod, credentials) {
11394
+ const credentialsConfig = getCredentialsForAuthMethod(type, authMethod);
11395
+ if (!credentialsConfig) {
11396
+ console.error(chalk52.red(`\u2717 Invalid auth method "${authMethod}"`));
11397
+ process.exit(1);
11398
+ }
11399
+ for (const [name, fieldConfig] of Object.entries(credentialsConfig)) {
11400
+ if (fieldConfig.required && !credentials[name]) {
11401
+ console.error(chalk52.red(`\u2717 Missing required credential: ${name}`));
11402
+ console.log();
11403
+ console.log("Required credentials:");
11404
+ for (const [n, fc] of Object.entries(credentialsConfig)) {
11405
+ if (fc.required) {
11406
+ console.log(` ${chalk52.cyan(n)} - ${fc.label}`);
11407
+ }
11408
+ }
11409
+ process.exit(1);
11410
+ }
11411
+ }
11412
+ for (const name of Object.keys(credentials)) {
11413
+ if (!(name in credentialsConfig)) {
11414
+ console.error(chalk52.red(`\u2717 Unknown credential: ${name}`));
11415
+ console.log();
11416
+ console.log("Valid credentials:");
11417
+ for (const [n, fc] of Object.entries(credentialsConfig)) {
11418
+ const requiredNote = fc.required ? " (required)" : " (optional)";
11419
+ console.log(` ${chalk52.cyan(n)}${requiredNote}`);
11420
+ }
11421
+ process.exit(1);
11422
+ }
11423
+ }
11424
+ }
11188
11425
  function handleNonInteractiveMode(options) {
11189
11426
  const type = validateProviderType(options.type);
11190
11427
  let selectedModel;
@@ -11194,9 +11431,69 @@ function handleNonInteractiveMode(options) {
11194
11431
  const defaultModel = getDefaultModel(type);
11195
11432
  selectedModel = defaultModel || void 0;
11196
11433
  }
11434
+ if (hasAuthMethods(type)) {
11435
+ let authMethod;
11436
+ if (options.authMethod) {
11437
+ authMethod = validateAuthMethod(type, options.authMethod);
11438
+ } else {
11439
+ const defaultAuthMethod = getDefaultAuthMethod(type);
11440
+ const authMethods = getAuthMethodsForType(type);
11441
+ if (!defaultAuthMethod || !authMethods) {
11442
+ console.error(chalk52.red(`\u2717 Provider "${type}" requires --auth-method`));
11443
+ process.exit(1);
11444
+ }
11445
+ const authMethodNames = Object.keys(authMethods);
11446
+ if (authMethodNames.length === 1) {
11447
+ authMethod = authMethodNames[0];
11448
+ } else {
11449
+ console.error(
11450
+ chalk52.red(
11451
+ `\u2717 --auth-method is required for "${type}" (multiple auth methods available)`
11452
+ )
11453
+ );
11454
+ console.log();
11455
+ console.log("Available auth methods:");
11456
+ for (const [method, config] of Object.entries(authMethods)) {
11457
+ const defaultNote = method === defaultAuthMethod ? " (default)" : "";
11458
+ console.log(
11459
+ ` ${chalk52.cyan(method)} - ${config.label}${defaultNote}`
11460
+ );
11461
+ }
11462
+ console.log();
11463
+ console.log("Example:");
11464
+ console.log(
11465
+ chalk52.cyan(
11466
+ ` vm0 model-provider setup --type ${type} --auth-method ${authMethodNames[0]} --credential KEY=VALUE`
11467
+ )
11468
+ );
11469
+ process.exit(1);
11470
+ }
11471
+ }
11472
+ const credentials = parseCredentials(type, authMethod, options.credential);
11473
+ validateCredentials(type, authMethod, credentials);
11474
+ return {
11475
+ type,
11476
+ authMethod,
11477
+ credentials,
11478
+ selectedModel,
11479
+ isInteractiveMode: false
11480
+ };
11481
+ }
11482
+ const credentialArgs = options.credential;
11483
+ const firstArg = credentialArgs[0];
11484
+ if (!firstArg) {
11485
+ console.error(chalk52.red("\u2717 Credential is required"));
11486
+ process.exit(1);
11487
+ }
11488
+ let credential;
11489
+ if (firstArg.includes("=")) {
11490
+ credential = firstArg.slice(firstArg.indexOf("=") + 1);
11491
+ } else {
11492
+ credential = firstArg;
11493
+ }
11197
11494
  return {
11198
11495
  type,
11199
- credential: options.credential,
11496
+ credential,
11200
11497
  selectedModel,
11201
11498
  isInteractiveMode: false
11202
11499
  };
@@ -11207,13 +11504,20 @@ async function promptForModelSelection(type) {
11207
11504
  }
11208
11505
  const models = getModels(type) ?? [];
11209
11506
  const defaultModel = getDefaultModel(type);
11210
- const modelChoices = defaultModel === "" ? [
11211
- { title: "auto (Recommended)", value: "" },
11212
- ...models.map((model) => ({ title: model, value: model }))
11213
- ] : models.map((model) => ({
11214
- title: model === defaultModel ? `${model} (Recommended)` : model,
11215
- value: model
11216
- }));
11507
+ const supportsCustomModel = allowsCustomModel(type);
11508
+ const modelChoices = [];
11509
+ if (defaultModel === "") {
11510
+ modelChoices.push({ title: "auto (Recommended)", value: "" });
11511
+ }
11512
+ for (const model of models) {
11513
+ modelChoices.push({
11514
+ title: model === defaultModel ? `${model} (Recommended)` : model,
11515
+ value: model
11516
+ });
11517
+ }
11518
+ if (supportsCustomModel) {
11519
+ modelChoices.push({ title: "Custom model ID", value: "__custom__" });
11520
+ }
11217
11521
  const modelResponse = await prompts2(
11218
11522
  {
11219
11523
  type: "select",
@@ -11224,8 +11528,93 @@ async function promptForModelSelection(type) {
11224
11528
  { onCancel: () => process.exit(0) }
11225
11529
  );
11226
11530
  const selected = modelResponse.model;
11531
+ if (selected === "__custom__") {
11532
+ const placeholder = getCustomModelPlaceholder(type);
11533
+ if (placeholder) {
11534
+ console.log(chalk52.dim(`Example: ${placeholder}`));
11535
+ }
11536
+ const customResponse = await prompts2(
11537
+ {
11538
+ type: "text",
11539
+ name: "customModel",
11540
+ message: "Enter model ID:",
11541
+ validate: (value) => value.length > 0 || "Model ID is required"
11542
+ },
11543
+ { onCancel: () => process.exit(0) }
11544
+ );
11545
+ return customResponse.customModel;
11546
+ }
11227
11547
  return selected === "" ? void 0 : selected;
11228
11548
  }
11549
+ async function promptForAuthMethod(type) {
11550
+ const authMethods = getAuthMethodsForType(type);
11551
+ const defaultAuthMethod = getDefaultAuthMethod(type);
11552
+ if (!authMethods) {
11553
+ return "default";
11554
+ }
11555
+ const choices = Object.entries(authMethods).map(([method, config]) => ({
11556
+ title: method === defaultAuthMethod ? `${config.label} (Recommended)` : config.label,
11557
+ value: method
11558
+ }));
11559
+ const response = await prompts2(
11560
+ {
11561
+ type: "select",
11562
+ name: "authMethod",
11563
+ message: "Select authentication method:",
11564
+ choices
11565
+ },
11566
+ { onCancel: () => process.exit(0) }
11567
+ );
11568
+ return response.authMethod;
11569
+ }
11570
+ function isSecretCredential(name) {
11571
+ const nonSecretPatterns = ["REGION", "ENDPOINT", "URL"];
11572
+ return !nonSecretPatterns.some(
11573
+ (pattern) => name.toUpperCase().includes(pattern)
11574
+ );
11575
+ }
11576
+ async function promptForCredentials(type, authMethod) {
11577
+ const credentialsConfig = getCredentialsForAuthMethod(type, authMethod);
11578
+ if (!credentialsConfig) {
11579
+ console.error(chalk52.red(`\u2717 Invalid auth method "${authMethod}"`));
11580
+ process.exit(1);
11581
+ }
11582
+ const credentials = {};
11583
+ for (const [name, fieldConfig] of Object.entries(credentialsConfig)) {
11584
+ if (fieldConfig.helpText) {
11585
+ console.log(chalk52.dim(fieldConfig.helpText));
11586
+ }
11587
+ const isSecret = isSecretCredential(name);
11588
+ const placeholder = "placeholder" in fieldConfig ? fieldConfig.placeholder : "";
11589
+ if (fieldConfig.required) {
11590
+ const response = await prompts2(
11591
+ {
11592
+ type: isSecret ? "password" : "text",
11593
+ name: "value",
11594
+ message: `${fieldConfig.label}:`,
11595
+ initial: placeholder ? "" : void 0,
11596
+ validate: (value) => value.length > 0 || `${fieldConfig.label} is required`
11597
+ },
11598
+ { onCancel: () => process.exit(0) }
11599
+ );
11600
+ credentials[name] = response.value;
11601
+ } else {
11602
+ const response = await prompts2(
11603
+ {
11604
+ type: isSecret ? "password" : "text",
11605
+ name: "value",
11606
+ message: `${fieldConfig.label} (optional):`
11607
+ },
11608
+ { onCancel: () => process.exit(0) }
11609
+ );
11610
+ const value = response.value;
11611
+ if (value && value.trim()) {
11612
+ credentials[name] = value.trim();
11613
+ }
11614
+ }
11615
+ }
11616
+ return credentials;
11617
+ }
11229
11618
  async function handleInteractiveMode() {
11230
11619
  if (!isInteractive()) {
11231
11620
  console.error(chalk52.red("\u2717 Interactive mode requires a TTY"));
@@ -11241,10 +11630,21 @@ async function handleInteractiveMode() {
11241
11630
  const { modelProviders: configuredProviders } = await listModelProviders();
11242
11631
  const configuredTypes = new Set(configuredProviders.map((p) => p.type));
11243
11632
  const annotatedChoices = Object.entries(MODEL_PROVIDER_TYPES).map(
11244
- ([type2, config2]) => ({
11245
- title: configuredTypes.has(type2) ? `${config2.label} \u2713` : config2.label,
11246
- value: type2
11247
- })
11633
+ ([type2, config2]) => {
11634
+ const isConfigured = configuredTypes.has(type2);
11635
+ const isExperimental = hasAuthMethods(type2);
11636
+ let title = config2.label;
11637
+ if (isConfigured) {
11638
+ title = `${title} \u2713`;
11639
+ }
11640
+ if (isExperimental) {
11641
+ title = `${title} ${chalk52.dim("(experimental)")}`;
11642
+ }
11643
+ return {
11644
+ title,
11645
+ value: type2
11646
+ };
11647
+ }
11248
11648
  );
11249
11649
  const typeResponse = await prompts2(
11250
11650
  {
@@ -11311,12 +11711,25 @@ async function handleInteractiveMode() {
11311
11711
  console.log();
11312
11712
  console.log(chalk52.dim(config.helpText));
11313
11713
  console.log();
11714
+ if (hasAuthMethods(type)) {
11715
+ const authMethod = await promptForAuthMethod(type);
11716
+ const credentials = await promptForCredentials(type, authMethod);
11717
+ const selectedModel2 = await promptForModelSelection(type);
11718
+ return {
11719
+ type,
11720
+ authMethod,
11721
+ credentials,
11722
+ selectedModel: selectedModel2,
11723
+ isInteractiveMode: true
11724
+ };
11725
+ }
11726
+ const credentialLabel = "credentialLabel" in config ? config.credentialLabel : "credential";
11314
11727
  const credentialResponse = await prompts2(
11315
11728
  {
11316
11729
  type: "password",
11317
11730
  name: "credential",
11318
- message: `Enter your ${config.credentialLabel}:`,
11319
- validate: (value) => value.length > 0 || `${config.credentialLabel} is required`
11731
+ message: `Enter your ${credentialLabel}:`,
11732
+ validate: (value) => value.length > 0 || `${credentialLabel} is required`
11320
11733
  },
11321
11734
  { onCancel: () => process.exit(0) }
11322
11735
  );
@@ -11357,21 +11770,31 @@ async function promptSetAsDefault(type, framework, isDefault) {
11357
11770
  console.log(chalk52.green(`\u2713 Default for ${framework} set to "${type}"`));
11358
11771
  }
11359
11772
  }
11773
+ function collectCredentials(value, previous) {
11774
+ return previous.concat([value]);
11775
+ }
11360
11776
  var setupCommand2 = new Command53().name("setup").description("Configure a model provider").option("-t, --type <type>", "Provider type (for non-interactive mode)").option(
11361
- "-c, --credential <credential>",
11362
- "Credential value (for non-interactive mode)"
11777
+ "-c, --credential <value>",
11778
+ "Credential value (can be used multiple times, supports VALUE or KEY=VALUE format)",
11779
+ collectCredentials,
11780
+ []
11781
+ ).option(
11782
+ "-a, --auth-method <method>",
11783
+ "Auth method (required for multi-auth providers like aws-bedrock)"
11363
11784
  ).option("-m, --model <model>", "Model selection (for non-interactive mode)").option("--convert", "Convert existing user credential to model provider").action(
11364
11785
  async (options) => {
11365
11786
  try {
11366
11787
  let input;
11367
11788
  const shouldConvert = options.convert ?? false;
11368
- if (options.type && options.credential) {
11789
+ const credentialArgs = options.credential ?? [];
11790
+ if (options.type && credentialArgs.length > 0) {
11369
11791
  input = handleNonInteractiveMode({
11370
11792
  type: options.type,
11371
- credential: options.credential,
11793
+ credential: credentialArgs,
11794
+ authMethod: options.authMethod,
11372
11795
  model: options.model
11373
11796
  });
11374
- } else if (options.type || options.credential) {
11797
+ } else if (options.type || credentialArgs.length > 0) {
11375
11798
  console.error(
11376
11799
  chalk52.red("\u2717 Both --type and --credential are required")
11377
11800
  );
@@ -11413,6 +11836,8 @@ var setupCommand2 = new Command53().name("setup").description("Configure a model
11413
11836
  const { provider, created } = await upsertModelProvider({
11414
11837
  type: input.type,
11415
11838
  credential: input.credential,
11839
+ authMethod: input.authMethod,
11840
+ credentials: input.credentials,
11416
11841
  convert: shouldConvert,
11417
11842
  selectedModel: input.selectedModel
11418
11843
  });
@@ -11725,6 +12150,13 @@ async function runAuthFlow(callbacks, apiUrl) {
11725
12150
  }
11726
12151
 
11727
12152
  // src/lib/domain/onboard/model-provider.ts
12153
+ var ONBOARD_PROVIDER_TYPES = [
12154
+ "claude-code-oauth-token",
12155
+ "anthropic-api-key",
12156
+ "openrouter-api-key",
12157
+ "moonshot-api-key",
12158
+ "minimax-api-key"
12159
+ ];
11728
12160
  async function checkModelProviderStatus() {
11729
12161
  const response = await listModelProviders();
11730
12162
  return {
@@ -11733,16 +12165,17 @@ async function checkModelProviderStatus() {
11733
12165
  };
11734
12166
  }
11735
12167
  function getProviderChoices() {
11736
- return Object.keys(MODEL_PROVIDER_TYPES).map(
11737
- (type) => ({
12168
+ return ONBOARD_PROVIDER_TYPES.map((type) => {
12169
+ const config = MODEL_PROVIDER_TYPES[type];
12170
+ return {
11738
12171
  type,
11739
- label: MODEL_PROVIDER_TYPES[type].label,
11740
- helpText: MODEL_PROVIDER_TYPES[type].helpText,
11741
- credentialLabel: MODEL_PROVIDER_TYPES[type].credentialLabel,
12172
+ label: config.label,
12173
+ helpText: config.helpText,
12174
+ credentialLabel: "credentialLabel" in config ? config.credentialLabel : "",
11742
12175
  models: getModels(type),
11743
12176
  defaultModel: getDefaultModel(type)
11744
- })
11745
- );
12177
+ };
12178
+ });
11746
12179
  }
11747
12180
  async function setupModelProvider(type, credential, options) {
11748
12181
  const response = await upsertModelProvider({
@@ -11925,16 +12358,16 @@ async function handleModelProvider(ctx) {
11925
12358
  const providerType = await step.prompt(
11926
12359
  () => promptSelect(
11927
12360
  "Select provider type:",
11928
- choices.map((c20) => ({
11929
- title: c20.label,
11930
- value: c20.type
12361
+ choices.map((c21) => ({
12362
+ title: c21.label,
12363
+ value: c21.type
11931
12364
  }))
11932
12365
  )
11933
12366
  );
11934
12367
  if (!providerType) {
11935
12368
  process.exit(0);
11936
12369
  }
11937
- const selectedChoice = choices.find((c20) => c20.type === providerType);
12370
+ const selectedChoice = choices.find((c21) => c21.type === providerType);
11938
12371
  if (selectedChoice?.helpText) {
11939
12372
  for (const line of selectedChoice.helpText.split("\n")) {
11940
12373
  step.detail(chalk58.dim(line));
@@ -12124,7 +12557,7 @@ var setupClaudeCommand = new Command58().name("setup-claude").description("Insta
12124
12557
 
12125
12558
  // src/index.ts
12126
12559
  var program = new Command59();
12127
- program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.14.0");
12560
+ program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.15.0");
12128
12561
  program.addCommand(authCommand);
12129
12562
  program.addCommand(infoCommand);
12130
12563
  program.addCommand(composeCommand);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vm0/cli",
3
- "version": "9.14.0",
3
+ "version": "9.15.0",
4
4
  "description": "CLI application",
5
5
  "repository": {
6
6
  "type": "git",