@vm0/cli 9.13.1 → 9.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +720 -520
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
-
import { Command as
|
|
4
|
+
import { Command as Command59 } from "commander";
|
|
5
5
|
|
|
6
6
|
// src/commands/auth/index.ts
|
|
7
7
|
import { Command as Command5 } from "commander";
|
|
@@ -2574,7 +2574,9 @@ var platformLogStatusSchema = z19.enum([
|
|
|
2574
2574
|
]);
|
|
2575
2575
|
var platformLogEntrySchema = z19.object({
|
|
2576
2576
|
id: z19.string().uuid(),
|
|
2577
|
+
sessionId: z19.string().nullable(),
|
|
2577
2578
|
agentName: z19.string(),
|
|
2579
|
+
framework: z19.string().nullable(),
|
|
2578
2580
|
status: platformLogStatusSchema,
|
|
2579
2581
|
createdAt: z19.string()
|
|
2580
2582
|
});
|
|
@@ -2649,29 +2651,67 @@ var platformArtifactDownloadContract = c15.router({
|
|
|
2649
2651
|
}
|
|
2650
2652
|
});
|
|
2651
2653
|
|
|
2652
|
-
// ../../packages/core/src/contracts/
|
|
2654
|
+
// ../../packages/core/src/contracts/llm.ts
|
|
2653
2655
|
import { z as z20 } from "zod";
|
|
2654
2656
|
var c16 = initContract();
|
|
2655
|
-
var
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2657
|
+
var messageRoleSchema = z20.enum(["user", "assistant", "system"]);
|
|
2658
|
+
var chatMessageSchema = z20.object({
|
|
2659
|
+
role: messageRoleSchema,
|
|
2660
|
+
content: z20.string()
|
|
2661
|
+
});
|
|
2662
|
+
var tokenUsageSchema = z20.object({
|
|
2663
|
+
promptTokens: z20.number(),
|
|
2664
|
+
completionTokens: z20.number(),
|
|
2665
|
+
totalTokens: z20.number()
|
|
2666
|
+
});
|
|
2667
|
+
var llmChatRequestSchema = z20.object({
|
|
2668
|
+
model: z20.string().min(1).optional(),
|
|
2669
|
+
messages: z20.array(chatMessageSchema).min(1, "At least one message is required"),
|
|
2670
|
+
stream: z20.boolean().optional().default(false)
|
|
2671
|
+
});
|
|
2672
|
+
var llmChatResponseSchema = z20.object({
|
|
2673
|
+
content: z20.string(),
|
|
2674
|
+
model: z20.string(),
|
|
2675
|
+
usage: tokenUsageSchema
|
|
2676
|
+
});
|
|
2677
|
+
var llmChatContract = c16.router({
|
|
2678
|
+
chat: {
|
|
2679
|
+
method: "POST",
|
|
2680
|
+
path: "/api/llm/chat",
|
|
2681
|
+
body: llmChatRequestSchema,
|
|
2682
|
+
responses: {
|
|
2683
|
+
200: llmChatResponseSchema,
|
|
2684
|
+
400: apiErrorSchema,
|
|
2685
|
+
500: apiErrorSchema,
|
|
2686
|
+
503: apiErrorSchema
|
|
2687
|
+
},
|
|
2688
|
+
summary: "Send a chat completion request to OpenRouter"
|
|
2689
|
+
}
|
|
2690
|
+
});
|
|
2691
|
+
|
|
2692
|
+
// ../../packages/core/src/contracts/public/agents.ts
|
|
2693
|
+
import { z as z21 } from "zod";
|
|
2694
|
+
var c17 = initContract();
|
|
2695
|
+
var publicAgentSchema = z21.object({
|
|
2696
|
+
id: z21.string(),
|
|
2697
|
+
name: z21.string(),
|
|
2698
|
+
currentVersionId: z21.string().nullable(),
|
|
2659
2699
|
createdAt: timestampSchema,
|
|
2660
2700
|
updatedAt: timestampSchema
|
|
2661
2701
|
});
|
|
2662
|
-
var agentVersionSchema =
|
|
2663
|
-
id:
|
|
2664
|
-
agentId:
|
|
2665
|
-
versionNumber:
|
|
2702
|
+
var agentVersionSchema = z21.object({
|
|
2703
|
+
id: z21.string(),
|
|
2704
|
+
agentId: z21.string(),
|
|
2705
|
+
versionNumber: z21.number(),
|
|
2666
2706
|
createdAt: timestampSchema
|
|
2667
2707
|
});
|
|
2668
2708
|
var publicAgentDetailSchema = publicAgentSchema;
|
|
2669
2709
|
var paginatedAgentsSchema = createPaginatedResponseSchema(publicAgentSchema);
|
|
2670
2710
|
var paginatedAgentVersionsSchema = createPaginatedResponseSchema(agentVersionSchema);
|
|
2671
2711
|
var agentListQuerySchema = listQuerySchema.extend({
|
|
2672
|
-
name:
|
|
2712
|
+
name: z21.string().optional()
|
|
2673
2713
|
});
|
|
2674
|
-
var publicAgentsListContract =
|
|
2714
|
+
var publicAgentsListContract = c17.router({
|
|
2675
2715
|
list: {
|
|
2676
2716
|
method: "GET",
|
|
2677
2717
|
path: "/v1/agents",
|
|
@@ -2686,13 +2726,13 @@ var publicAgentsListContract = c16.router({
|
|
|
2686
2726
|
description: "List all agents in the current scope with pagination. Use the `name` query parameter to filter by agent name."
|
|
2687
2727
|
}
|
|
2688
2728
|
});
|
|
2689
|
-
var publicAgentByIdContract =
|
|
2729
|
+
var publicAgentByIdContract = c17.router({
|
|
2690
2730
|
get: {
|
|
2691
2731
|
method: "GET",
|
|
2692
2732
|
path: "/v1/agents/:id",
|
|
2693
2733
|
headers: authHeadersSchema,
|
|
2694
|
-
pathParams:
|
|
2695
|
-
id:
|
|
2734
|
+
pathParams: z21.object({
|
|
2735
|
+
id: z21.string().min(1, "Agent ID is required")
|
|
2696
2736
|
}),
|
|
2697
2737
|
responses: {
|
|
2698
2738
|
200: publicAgentDetailSchema,
|
|
@@ -2704,13 +2744,13 @@ var publicAgentByIdContract = c16.router({
|
|
|
2704
2744
|
description: "Get agent details by ID"
|
|
2705
2745
|
}
|
|
2706
2746
|
});
|
|
2707
|
-
var publicAgentVersionsContract =
|
|
2747
|
+
var publicAgentVersionsContract = c17.router({
|
|
2708
2748
|
list: {
|
|
2709
2749
|
method: "GET",
|
|
2710
2750
|
path: "/v1/agents/:id/versions",
|
|
2711
2751
|
headers: authHeadersSchema,
|
|
2712
|
-
pathParams:
|
|
2713
|
-
id:
|
|
2752
|
+
pathParams: z21.object({
|
|
2753
|
+
id: z21.string().min(1, "Agent ID is required")
|
|
2714
2754
|
}),
|
|
2715
2755
|
query: listQuerySchema,
|
|
2716
2756
|
responses: {
|
|
@@ -2725,9 +2765,9 @@ var publicAgentVersionsContract = c16.router({
|
|
|
2725
2765
|
});
|
|
2726
2766
|
|
|
2727
2767
|
// ../../packages/core/src/contracts/public/runs.ts
|
|
2728
|
-
import { z as
|
|
2729
|
-
var
|
|
2730
|
-
var publicRunStatusSchema =
|
|
2768
|
+
import { z as z22 } from "zod";
|
|
2769
|
+
var c18 = initContract();
|
|
2770
|
+
var publicRunStatusSchema = z22.enum([
|
|
2731
2771
|
"pending",
|
|
2732
2772
|
"running",
|
|
2733
2773
|
"completed",
|
|
@@ -2735,54 +2775,54 @@ var publicRunStatusSchema = z21.enum([
|
|
|
2735
2775
|
"timeout",
|
|
2736
2776
|
"cancelled"
|
|
2737
2777
|
]);
|
|
2738
|
-
var publicRunSchema =
|
|
2739
|
-
id:
|
|
2740
|
-
agentId:
|
|
2741
|
-
agentName:
|
|
2778
|
+
var publicRunSchema = z22.object({
|
|
2779
|
+
id: z22.string(),
|
|
2780
|
+
agentId: z22.string(),
|
|
2781
|
+
agentName: z22.string(),
|
|
2742
2782
|
status: publicRunStatusSchema,
|
|
2743
|
-
prompt:
|
|
2783
|
+
prompt: z22.string(),
|
|
2744
2784
|
createdAt: timestampSchema,
|
|
2745
2785
|
startedAt: timestampSchema.nullable(),
|
|
2746
2786
|
completedAt: timestampSchema.nullable()
|
|
2747
2787
|
});
|
|
2748
2788
|
var publicRunDetailSchema = publicRunSchema.extend({
|
|
2749
|
-
error:
|
|
2750
|
-
executionTimeMs:
|
|
2751
|
-
checkpointId:
|
|
2752
|
-
sessionId:
|
|
2753
|
-
artifactName:
|
|
2754
|
-
artifactVersion:
|
|
2755
|
-
volumes:
|
|
2789
|
+
error: z22.string().nullable(),
|
|
2790
|
+
executionTimeMs: z22.number().nullable(),
|
|
2791
|
+
checkpointId: z22.string().nullable(),
|
|
2792
|
+
sessionId: z22.string().nullable(),
|
|
2793
|
+
artifactName: z22.string().nullable(),
|
|
2794
|
+
artifactVersion: z22.string().nullable(),
|
|
2795
|
+
volumes: z22.record(z22.string(), z22.string()).optional()
|
|
2756
2796
|
});
|
|
2757
2797
|
var paginatedRunsSchema = createPaginatedResponseSchema(publicRunSchema);
|
|
2758
|
-
var createRunRequestSchema =
|
|
2798
|
+
var createRunRequestSchema = z22.object({
|
|
2759
2799
|
// Agent identification (one of: agent, agentId, sessionId, checkpointId)
|
|
2760
|
-
agent:
|
|
2800
|
+
agent: z22.string().optional(),
|
|
2761
2801
|
// Agent name
|
|
2762
|
-
agentId:
|
|
2802
|
+
agentId: z22.string().optional(),
|
|
2763
2803
|
// Agent ID
|
|
2764
|
-
agentVersion:
|
|
2804
|
+
agentVersion: z22.string().optional(),
|
|
2765
2805
|
// Version specifier (e.g., "latest", "v1", specific ID)
|
|
2766
2806
|
// Continue session
|
|
2767
|
-
sessionId:
|
|
2807
|
+
sessionId: z22.string().optional(),
|
|
2768
2808
|
// Resume from checkpoint
|
|
2769
|
-
checkpointId:
|
|
2809
|
+
checkpointId: z22.string().optional(),
|
|
2770
2810
|
// Required
|
|
2771
|
-
prompt:
|
|
2811
|
+
prompt: z22.string().min(1, "Prompt is required"),
|
|
2772
2812
|
// Optional configuration
|
|
2773
|
-
variables:
|
|
2774
|
-
secrets:
|
|
2775
|
-
artifactName:
|
|
2813
|
+
variables: z22.record(z22.string(), z22.string()).optional(),
|
|
2814
|
+
secrets: z22.record(z22.string(), z22.string()).optional(),
|
|
2815
|
+
artifactName: z22.string().optional(),
|
|
2776
2816
|
// Artifact name to mount
|
|
2777
|
-
artifactVersion:
|
|
2817
|
+
artifactVersion: z22.string().optional(),
|
|
2778
2818
|
// Artifact version (defaults to latest)
|
|
2779
|
-
volumes:
|
|
2819
|
+
volumes: z22.record(z22.string(), z22.string()).optional()
|
|
2780
2820
|
// volume_name -> version
|
|
2781
2821
|
});
|
|
2782
2822
|
var runListQuerySchema = listQuerySchema.extend({
|
|
2783
2823
|
status: publicRunStatusSchema.optional()
|
|
2784
2824
|
});
|
|
2785
|
-
var publicRunsListContract =
|
|
2825
|
+
var publicRunsListContract = c18.router({
|
|
2786
2826
|
list: {
|
|
2787
2827
|
method: "GET",
|
|
2788
2828
|
path: "/v1/runs",
|
|
@@ -2814,13 +2854,13 @@ var publicRunsListContract = c17.router({
|
|
|
2814
2854
|
description: "Create and execute a new agent run. Returns 202 Accepted as runs execute asynchronously."
|
|
2815
2855
|
}
|
|
2816
2856
|
});
|
|
2817
|
-
var publicRunByIdContract =
|
|
2857
|
+
var publicRunByIdContract = c18.router({
|
|
2818
2858
|
get: {
|
|
2819
2859
|
method: "GET",
|
|
2820
2860
|
path: "/v1/runs/:id",
|
|
2821
2861
|
headers: authHeadersSchema,
|
|
2822
|
-
pathParams:
|
|
2823
|
-
id:
|
|
2862
|
+
pathParams: z22.object({
|
|
2863
|
+
id: z22.string().min(1, "Run ID is required")
|
|
2824
2864
|
}),
|
|
2825
2865
|
responses: {
|
|
2826
2866
|
200: publicRunDetailSchema,
|
|
@@ -2832,15 +2872,15 @@ var publicRunByIdContract = c17.router({
|
|
|
2832
2872
|
description: "Get run details by ID"
|
|
2833
2873
|
}
|
|
2834
2874
|
});
|
|
2835
|
-
var publicRunCancelContract =
|
|
2875
|
+
var publicRunCancelContract = c18.router({
|
|
2836
2876
|
cancel: {
|
|
2837
2877
|
method: "POST",
|
|
2838
2878
|
path: "/v1/runs/:id/cancel",
|
|
2839
2879
|
headers: authHeadersSchema,
|
|
2840
|
-
pathParams:
|
|
2841
|
-
id:
|
|
2880
|
+
pathParams: z22.object({
|
|
2881
|
+
id: z22.string().min(1, "Run ID is required")
|
|
2842
2882
|
}),
|
|
2843
|
-
body:
|
|
2883
|
+
body: z22.undefined(),
|
|
2844
2884
|
responses: {
|
|
2845
2885
|
200: publicRunDetailSchema,
|
|
2846
2886
|
400: publicApiErrorSchema,
|
|
@@ -2853,27 +2893,27 @@ var publicRunCancelContract = c17.router({
|
|
|
2853
2893
|
description: "Cancel a pending or running execution"
|
|
2854
2894
|
}
|
|
2855
2895
|
});
|
|
2856
|
-
var logEntrySchema =
|
|
2896
|
+
var logEntrySchema = z22.object({
|
|
2857
2897
|
timestamp: timestampSchema,
|
|
2858
|
-
type:
|
|
2859
|
-
level:
|
|
2860
|
-
message:
|
|
2861
|
-
metadata:
|
|
2898
|
+
type: z22.enum(["agent", "system", "network"]),
|
|
2899
|
+
level: z22.enum(["debug", "info", "warn", "error"]),
|
|
2900
|
+
message: z22.string(),
|
|
2901
|
+
metadata: z22.record(z22.string(), z22.unknown()).optional()
|
|
2862
2902
|
});
|
|
2863
2903
|
var paginatedLogsSchema = createPaginatedResponseSchema(logEntrySchema);
|
|
2864
2904
|
var logsQuerySchema = listQuerySchema.extend({
|
|
2865
|
-
type:
|
|
2905
|
+
type: z22.enum(["agent", "system", "network", "all"]).default("all"),
|
|
2866
2906
|
since: timestampSchema.optional(),
|
|
2867
2907
|
until: timestampSchema.optional(),
|
|
2868
|
-
order:
|
|
2908
|
+
order: z22.enum(["asc", "desc"]).default("asc")
|
|
2869
2909
|
});
|
|
2870
|
-
var publicRunLogsContract =
|
|
2910
|
+
var publicRunLogsContract = c18.router({
|
|
2871
2911
|
getLogs: {
|
|
2872
2912
|
method: "GET",
|
|
2873
2913
|
path: "/v1/runs/:id/logs",
|
|
2874
2914
|
headers: authHeadersSchema,
|
|
2875
|
-
pathParams:
|
|
2876
|
-
id:
|
|
2915
|
+
pathParams: z22.object({
|
|
2916
|
+
id: z22.string().min(1, "Run ID is required")
|
|
2877
2917
|
}),
|
|
2878
2918
|
query: logsQuerySchema,
|
|
2879
2919
|
responses: {
|
|
@@ -2886,30 +2926,30 @@ var publicRunLogsContract = c17.router({
|
|
|
2886
2926
|
description: "Get unified logs for a run. Combines agent, system, and network logs."
|
|
2887
2927
|
}
|
|
2888
2928
|
});
|
|
2889
|
-
var metricPointSchema =
|
|
2929
|
+
var metricPointSchema = z22.object({
|
|
2890
2930
|
timestamp: timestampSchema,
|
|
2891
|
-
cpuPercent:
|
|
2892
|
-
memoryUsedMb:
|
|
2893
|
-
memoryTotalMb:
|
|
2894
|
-
diskUsedMb:
|
|
2895
|
-
diskTotalMb:
|
|
2896
|
-
});
|
|
2897
|
-
var metricsSummarySchema =
|
|
2898
|
-
avgCpuPercent:
|
|
2899
|
-
maxMemoryUsedMb:
|
|
2900
|
-
totalDurationMs:
|
|
2901
|
-
});
|
|
2902
|
-
var metricsResponseSchema2 =
|
|
2903
|
-
data:
|
|
2931
|
+
cpuPercent: z22.number(),
|
|
2932
|
+
memoryUsedMb: z22.number(),
|
|
2933
|
+
memoryTotalMb: z22.number(),
|
|
2934
|
+
diskUsedMb: z22.number(),
|
|
2935
|
+
diskTotalMb: z22.number()
|
|
2936
|
+
});
|
|
2937
|
+
var metricsSummarySchema = z22.object({
|
|
2938
|
+
avgCpuPercent: z22.number(),
|
|
2939
|
+
maxMemoryUsedMb: z22.number(),
|
|
2940
|
+
totalDurationMs: z22.number().nullable()
|
|
2941
|
+
});
|
|
2942
|
+
var metricsResponseSchema2 = z22.object({
|
|
2943
|
+
data: z22.array(metricPointSchema),
|
|
2904
2944
|
summary: metricsSummarySchema
|
|
2905
2945
|
});
|
|
2906
|
-
var publicRunMetricsContract =
|
|
2946
|
+
var publicRunMetricsContract = c18.router({
|
|
2907
2947
|
getMetrics: {
|
|
2908
2948
|
method: "GET",
|
|
2909
2949
|
path: "/v1/runs/:id/metrics",
|
|
2910
2950
|
headers: authHeadersSchema,
|
|
2911
|
-
pathParams:
|
|
2912
|
-
id:
|
|
2951
|
+
pathParams: z22.object({
|
|
2952
|
+
id: z22.string().min(1, "Run ID is required")
|
|
2913
2953
|
}),
|
|
2914
2954
|
responses: {
|
|
2915
2955
|
200: metricsResponseSchema2,
|
|
@@ -2921,7 +2961,7 @@ var publicRunMetricsContract = c17.router({
|
|
|
2921
2961
|
description: "Get CPU, memory, and disk metrics for a run"
|
|
2922
2962
|
}
|
|
2923
2963
|
});
|
|
2924
|
-
var sseEventTypeSchema =
|
|
2964
|
+
var sseEventTypeSchema = z22.enum([
|
|
2925
2965
|
"status",
|
|
2926
2966
|
// Run status change
|
|
2927
2967
|
"output",
|
|
@@ -2933,26 +2973,26 @@ var sseEventTypeSchema = z21.enum([
|
|
|
2933
2973
|
"heartbeat"
|
|
2934
2974
|
// Keep-alive
|
|
2935
2975
|
]);
|
|
2936
|
-
var sseEventSchema =
|
|
2976
|
+
var sseEventSchema = z22.object({
|
|
2937
2977
|
event: sseEventTypeSchema,
|
|
2938
|
-
data:
|
|
2939
|
-
id:
|
|
2978
|
+
data: z22.unknown(),
|
|
2979
|
+
id: z22.string().optional()
|
|
2940
2980
|
// For Last-Event-ID reconnection
|
|
2941
2981
|
});
|
|
2942
|
-
var publicRunEventsContract =
|
|
2982
|
+
var publicRunEventsContract = c18.router({
|
|
2943
2983
|
streamEvents: {
|
|
2944
2984
|
method: "GET",
|
|
2945
2985
|
path: "/v1/runs/:id/events",
|
|
2946
2986
|
headers: authHeadersSchema,
|
|
2947
|
-
pathParams:
|
|
2948
|
-
id:
|
|
2987
|
+
pathParams: z22.object({
|
|
2988
|
+
id: z22.string().min(1, "Run ID is required")
|
|
2949
2989
|
}),
|
|
2950
|
-
query:
|
|
2951
|
-
lastEventId:
|
|
2990
|
+
query: z22.object({
|
|
2991
|
+
lastEventId: z22.string().optional()
|
|
2952
2992
|
// For reconnection
|
|
2953
2993
|
}),
|
|
2954
2994
|
responses: {
|
|
2955
|
-
200:
|
|
2995
|
+
200: z22.any(),
|
|
2956
2996
|
// SSE stream - actual content is text/event-stream
|
|
2957
2997
|
401: publicApiErrorSchema,
|
|
2958
2998
|
404: publicApiErrorSchema,
|
|
@@ -2964,28 +3004,28 @@ var publicRunEventsContract = c17.router({
|
|
|
2964
3004
|
});
|
|
2965
3005
|
|
|
2966
3006
|
// ../../packages/core/src/contracts/public/artifacts.ts
|
|
2967
|
-
import { z as
|
|
2968
|
-
var
|
|
2969
|
-
var publicArtifactSchema =
|
|
2970
|
-
id:
|
|
2971
|
-
name:
|
|
2972
|
-
currentVersionId:
|
|
2973
|
-
size:
|
|
3007
|
+
import { z as z23 } from "zod";
|
|
3008
|
+
var c19 = initContract();
|
|
3009
|
+
var publicArtifactSchema = z23.object({
|
|
3010
|
+
id: z23.string(),
|
|
3011
|
+
name: z23.string(),
|
|
3012
|
+
currentVersionId: z23.string().nullable(),
|
|
3013
|
+
size: z23.number(),
|
|
2974
3014
|
// Total size in bytes
|
|
2975
|
-
fileCount:
|
|
3015
|
+
fileCount: z23.number(),
|
|
2976
3016
|
createdAt: timestampSchema,
|
|
2977
3017
|
updatedAt: timestampSchema
|
|
2978
3018
|
});
|
|
2979
|
-
var artifactVersionSchema =
|
|
2980
|
-
id:
|
|
3019
|
+
var artifactVersionSchema = z23.object({
|
|
3020
|
+
id: z23.string(),
|
|
2981
3021
|
// SHA-256 content hash
|
|
2982
|
-
artifactId:
|
|
2983
|
-
size:
|
|
3022
|
+
artifactId: z23.string(),
|
|
3023
|
+
size: z23.number(),
|
|
2984
3024
|
// Size in bytes
|
|
2985
|
-
fileCount:
|
|
2986
|
-
message:
|
|
3025
|
+
fileCount: z23.number(),
|
|
3026
|
+
message: z23.string().nullable(),
|
|
2987
3027
|
// Optional commit message
|
|
2988
|
-
createdBy:
|
|
3028
|
+
createdBy: z23.string(),
|
|
2989
3029
|
createdAt: timestampSchema
|
|
2990
3030
|
});
|
|
2991
3031
|
var publicArtifactDetailSchema = publicArtifactSchema.extend({
|
|
@@ -2995,7 +3035,7 @@ var paginatedArtifactsSchema = createPaginatedResponseSchema(publicArtifactSchem
|
|
|
2995
3035
|
var paginatedArtifactVersionsSchema = createPaginatedResponseSchema(
|
|
2996
3036
|
artifactVersionSchema
|
|
2997
3037
|
);
|
|
2998
|
-
var publicArtifactsListContract =
|
|
3038
|
+
var publicArtifactsListContract = c19.router({
|
|
2999
3039
|
list: {
|
|
3000
3040
|
method: "GET",
|
|
3001
3041
|
path: "/v1/artifacts",
|
|
@@ -3010,13 +3050,13 @@ var publicArtifactsListContract = c18.router({
|
|
|
3010
3050
|
description: "List all artifacts in the current scope with pagination"
|
|
3011
3051
|
}
|
|
3012
3052
|
});
|
|
3013
|
-
var publicArtifactByIdContract =
|
|
3053
|
+
var publicArtifactByIdContract = c19.router({
|
|
3014
3054
|
get: {
|
|
3015
3055
|
method: "GET",
|
|
3016
3056
|
path: "/v1/artifacts/:id",
|
|
3017
3057
|
headers: authHeadersSchema,
|
|
3018
|
-
pathParams:
|
|
3019
|
-
id:
|
|
3058
|
+
pathParams: z23.object({
|
|
3059
|
+
id: z23.string().min(1, "Artifact ID is required")
|
|
3020
3060
|
}),
|
|
3021
3061
|
responses: {
|
|
3022
3062
|
200: publicArtifactDetailSchema,
|
|
@@ -3028,13 +3068,13 @@ var publicArtifactByIdContract = c18.router({
|
|
|
3028
3068
|
description: "Get artifact details by ID"
|
|
3029
3069
|
}
|
|
3030
3070
|
});
|
|
3031
|
-
var publicArtifactVersionsContract =
|
|
3071
|
+
var publicArtifactVersionsContract = c19.router({
|
|
3032
3072
|
list: {
|
|
3033
3073
|
method: "GET",
|
|
3034
3074
|
path: "/v1/artifacts/:id/versions",
|
|
3035
3075
|
headers: authHeadersSchema,
|
|
3036
|
-
pathParams:
|
|
3037
|
-
id:
|
|
3076
|
+
pathParams: z23.object({
|
|
3077
|
+
id: z23.string().min(1, "Artifact ID is required")
|
|
3038
3078
|
}),
|
|
3039
3079
|
query: listQuerySchema,
|
|
3040
3080
|
responses: {
|
|
@@ -3047,20 +3087,20 @@ var publicArtifactVersionsContract = c18.router({
|
|
|
3047
3087
|
description: "List all versions of an artifact with pagination"
|
|
3048
3088
|
}
|
|
3049
3089
|
});
|
|
3050
|
-
var publicArtifactDownloadContract =
|
|
3090
|
+
var publicArtifactDownloadContract = c19.router({
|
|
3051
3091
|
download: {
|
|
3052
3092
|
method: "GET",
|
|
3053
3093
|
path: "/v1/artifacts/:id/download",
|
|
3054
3094
|
headers: authHeadersSchema,
|
|
3055
|
-
pathParams:
|
|
3056
|
-
id:
|
|
3095
|
+
pathParams: z23.object({
|
|
3096
|
+
id: z23.string().min(1, "Artifact ID is required")
|
|
3057
3097
|
}),
|
|
3058
|
-
query:
|
|
3059
|
-
versionId:
|
|
3098
|
+
query: z23.object({
|
|
3099
|
+
versionId: z23.string().optional()
|
|
3060
3100
|
// Defaults to current version
|
|
3061
3101
|
}),
|
|
3062
3102
|
responses: {
|
|
3063
|
-
302:
|
|
3103
|
+
302: z23.undefined(),
|
|
3064
3104
|
// Redirect to presigned URL
|
|
3065
3105
|
401: publicApiErrorSchema,
|
|
3066
3106
|
404: publicApiErrorSchema,
|
|
@@ -3072,28 +3112,28 @@ var publicArtifactDownloadContract = c18.router({
|
|
|
3072
3112
|
});
|
|
3073
3113
|
|
|
3074
3114
|
// ../../packages/core/src/contracts/public/volumes.ts
|
|
3075
|
-
import { z as
|
|
3076
|
-
var
|
|
3077
|
-
var publicVolumeSchema =
|
|
3078
|
-
id:
|
|
3079
|
-
name:
|
|
3080
|
-
currentVersionId:
|
|
3081
|
-
size:
|
|
3115
|
+
import { z as z24 } from "zod";
|
|
3116
|
+
var c20 = initContract();
|
|
3117
|
+
var publicVolumeSchema = z24.object({
|
|
3118
|
+
id: z24.string(),
|
|
3119
|
+
name: z24.string(),
|
|
3120
|
+
currentVersionId: z24.string().nullable(),
|
|
3121
|
+
size: z24.number(),
|
|
3082
3122
|
// Total size in bytes
|
|
3083
|
-
fileCount:
|
|
3123
|
+
fileCount: z24.number(),
|
|
3084
3124
|
createdAt: timestampSchema,
|
|
3085
3125
|
updatedAt: timestampSchema
|
|
3086
3126
|
});
|
|
3087
|
-
var volumeVersionSchema =
|
|
3088
|
-
id:
|
|
3127
|
+
var volumeVersionSchema = z24.object({
|
|
3128
|
+
id: z24.string(),
|
|
3089
3129
|
// SHA-256 content hash
|
|
3090
|
-
volumeId:
|
|
3091
|
-
size:
|
|
3130
|
+
volumeId: z24.string(),
|
|
3131
|
+
size: z24.number(),
|
|
3092
3132
|
// Size in bytes
|
|
3093
|
-
fileCount:
|
|
3094
|
-
message:
|
|
3133
|
+
fileCount: z24.number(),
|
|
3134
|
+
message: z24.string().nullable(),
|
|
3095
3135
|
// Optional commit message
|
|
3096
|
-
createdBy:
|
|
3136
|
+
createdBy: z24.string(),
|
|
3097
3137
|
createdAt: timestampSchema
|
|
3098
3138
|
});
|
|
3099
3139
|
var publicVolumeDetailSchema = publicVolumeSchema.extend({
|
|
@@ -3101,7 +3141,7 @@ var publicVolumeDetailSchema = publicVolumeSchema.extend({
|
|
|
3101
3141
|
});
|
|
3102
3142
|
var paginatedVolumesSchema = createPaginatedResponseSchema(publicVolumeSchema);
|
|
3103
3143
|
var paginatedVolumeVersionsSchema = createPaginatedResponseSchema(volumeVersionSchema);
|
|
3104
|
-
var publicVolumesListContract =
|
|
3144
|
+
var publicVolumesListContract = c20.router({
|
|
3105
3145
|
list: {
|
|
3106
3146
|
method: "GET",
|
|
3107
3147
|
path: "/v1/volumes",
|
|
@@ -3116,13 +3156,13 @@ var publicVolumesListContract = c19.router({
|
|
|
3116
3156
|
description: "List all volumes in the current scope with pagination"
|
|
3117
3157
|
}
|
|
3118
3158
|
});
|
|
3119
|
-
var publicVolumeByIdContract =
|
|
3159
|
+
var publicVolumeByIdContract = c20.router({
|
|
3120
3160
|
get: {
|
|
3121
3161
|
method: "GET",
|
|
3122
3162
|
path: "/v1/volumes/:id",
|
|
3123
3163
|
headers: authHeadersSchema,
|
|
3124
|
-
pathParams:
|
|
3125
|
-
id:
|
|
3164
|
+
pathParams: z24.object({
|
|
3165
|
+
id: z24.string().min(1, "Volume ID is required")
|
|
3126
3166
|
}),
|
|
3127
3167
|
responses: {
|
|
3128
3168
|
200: publicVolumeDetailSchema,
|
|
@@ -3134,13 +3174,13 @@ var publicVolumeByIdContract = c19.router({
|
|
|
3134
3174
|
description: "Get volume details by ID"
|
|
3135
3175
|
}
|
|
3136
3176
|
});
|
|
3137
|
-
var publicVolumeVersionsContract =
|
|
3177
|
+
var publicVolumeVersionsContract = c20.router({
|
|
3138
3178
|
list: {
|
|
3139
3179
|
method: "GET",
|
|
3140
3180
|
path: "/v1/volumes/:id/versions",
|
|
3141
3181
|
headers: authHeadersSchema,
|
|
3142
|
-
pathParams:
|
|
3143
|
-
id:
|
|
3182
|
+
pathParams: z24.object({
|
|
3183
|
+
id: z24.string().min(1, "Volume ID is required")
|
|
3144
3184
|
}),
|
|
3145
3185
|
query: listQuerySchema,
|
|
3146
3186
|
responses: {
|
|
@@ -3153,20 +3193,20 @@ var publicVolumeVersionsContract = c19.router({
|
|
|
3153
3193
|
description: "List all versions of a volume with pagination"
|
|
3154
3194
|
}
|
|
3155
3195
|
});
|
|
3156
|
-
var publicVolumeDownloadContract =
|
|
3196
|
+
var publicVolumeDownloadContract = c20.router({
|
|
3157
3197
|
download: {
|
|
3158
3198
|
method: "GET",
|
|
3159
3199
|
path: "/v1/volumes/:id/download",
|
|
3160
3200
|
headers: authHeadersSchema,
|
|
3161
|
-
pathParams:
|
|
3162
|
-
id:
|
|
3201
|
+
pathParams: z24.object({
|
|
3202
|
+
id: z24.string().min(1, "Volume ID is required")
|
|
3163
3203
|
}),
|
|
3164
|
-
query:
|
|
3165
|
-
versionId:
|
|
3204
|
+
query: z24.object({
|
|
3205
|
+
versionId: z24.string().optional()
|
|
3166
3206
|
// Defaults to current version
|
|
3167
3207
|
}),
|
|
3168
3208
|
responses: {
|
|
3169
|
-
302:
|
|
3209
|
+
302: z24.undefined(),
|
|
3170
3210
|
// Redirect to presigned URL
|
|
3171
3211
|
401: publicApiErrorSchema,
|
|
3172
3212
|
404: publicApiErrorSchema,
|
|
@@ -3787,8 +3827,8 @@ async function getUsage(options) {
|
|
|
3787
3827
|
}
|
|
3788
3828
|
|
|
3789
3829
|
// src/lib/domain/yaml-validator.ts
|
|
3790
|
-
import { z as
|
|
3791
|
-
var cliAgentNameSchema =
|
|
3830
|
+
import { z as z25 } from "zod";
|
|
3831
|
+
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(
|
|
3792
3832
|
/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,62}[a-zA-Z0-9])?$/,
|
|
3793
3833
|
"Agent name must start and end with letter or number, and contain only letters, numbers, and hyphens"
|
|
3794
3834
|
);
|
|
@@ -3803,7 +3843,7 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
|
3803
3843
|
const skillUrl = agent.skills[i];
|
|
3804
3844
|
if (skillUrl && !validateGitHubTreeUrl(skillUrl)) {
|
|
3805
3845
|
ctx.addIssue({
|
|
3806
|
-
code:
|
|
3846
|
+
code: z25.ZodIssueCode.custom,
|
|
3807
3847
|
message: `Invalid skill URL: ${skillUrl}. Expected format: https://github.com/{owner}/{repo}/tree/{branch}/{path}`,
|
|
3808
3848
|
path: ["skills", i]
|
|
3809
3849
|
});
|
|
@@ -3812,15 +3852,15 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
|
3812
3852
|
}
|
|
3813
3853
|
}
|
|
3814
3854
|
);
|
|
3815
|
-
var cliComposeSchema =
|
|
3816
|
-
version:
|
|
3817
|
-
agents:
|
|
3818
|
-
volumes:
|
|
3855
|
+
var cliComposeSchema = z25.object({
|
|
3856
|
+
version: z25.string().min(1, "Missing config.version"),
|
|
3857
|
+
agents: z25.record(cliAgentNameSchema, cliAgentDefinitionSchema),
|
|
3858
|
+
volumes: z25.record(z25.string(), volumeConfigSchema).optional()
|
|
3819
3859
|
}).superRefine((config, ctx) => {
|
|
3820
3860
|
const agentKeys = Object.keys(config.agents);
|
|
3821
3861
|
if (agentKeys.length === 0) {
|
|
3822
3862
|
ctx.addIssue({
|
|
3823
|
-
code:
|
|
3863
|
+
code: z25.ZodIssueCode.custom,
|
|
3824
3864
|
message: "agents must have at least one agent defined",
|
|
3825
3865
|
path: ["agents"]
|
|
3826
3866
|
});
|
|
@@ -3828,7 +3868,7 @@ var cliComposeSchema = z24.object({
|
|
|
3828
3868
|
}
|
|
3829
3869
|
if (agentKeys.length > 1) {
|
|
3830
3870
|
ctx.addIssue({
|
|
3831
|
-
code:
|
|
3871
|
+
code: z25.ZodIssueCode.custom,
|
|
3832
3872
|
message: "Multiple agents not supported yet. Only one agent allowed.",
|
|
3833
3873
|
path: ["agents"]
|
|
3834
3874
|
});
|
|
@@ -3840,7 +3880,7 @@ var cliComposeSchema = z24.object({
|
|
|
3840
3880
|
if (agentVolumes && agentVolumes.length > 0) {
|
|
3841
3881
|
if (!config.volumes) {
|
|
3842
3882
|
ctx.addIssue({
|
|
3843
|
-
code:
|
|
3883
|
+
code: z25.ZodIssueCode.custom,
|
|
3844
3884
|
message: "Agent references volumes but no volumes section defined. Each volume must have explicit name and version.",
|
|
3845
3885
|
path: ["volumes"]
|
|
3846
3886
|
});
|
|
@@ -3850,7 +3890,7 @@ var cliComposeSchema = z24.object({
|
|
|
3850
3890
|
const parts = volDeclaration.split(":");
|
|
3851
3891
|
if (parts.length !== 2) {
|
|
3852
3892
|
ctx.addIssue({
|
|
3853
|
-
code:
|
|
3893
|
+
code: z25.ZodIssueCode.custom,
|
|
3854
3894
|
message: `Invalid volume declaration: ${volDeclaration}. Expected format: volume-key:/mount/path`,
|
|
3855
3895
|
path: ["agents", agentName, "volumes"]
|
|
3856
3896
|
});
|
|
@@ -3859,7 +3899,7 @@ var cliComposeSchema = z24.object({
|
|
|
3859
3899
|
const volumeKey = parts[0].trim();
|
|
3860
3900
|
if (!config.volumes[volumeKey]) {
|
|
3861
3901
|
ctx.addIssue({
|
|
3862
|
-
code:
|
|
3902
|
+
code: z25.ZodIssueCode.custom,
|
|
3863
3903
|
message: `Volume "${volumeKey}" is not defined in volumes section. Each volume must have explicit name and version.`,
|
|
3864
3904
|
path: ["volumes", volumeKey]
|
|
3865
3905
|
});
|
|
@@ -4893,7 +4933,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
4893
4933
|
)
|
|
4894
4934
|
);
|
|
4895
4935
|
if (options.autoUpdate !== false) {
|
|
4896
|
-
await silentUpgradeAfterCommand("9.
|
|
4936
|
+
await silentUpgradeAfterCommand("9.14.1");
|
|
4897
4937
|
}
|
|
4898
4938
|
} catch (error) {
|
|
4899
4939
|
if (error instanceof Error) {
|
|
@@ -5648,9 +5688,9 @@ var CodexEventParser = class {
|
|
|
5648
5688
|
}
|
|
5649
5689
|
}
|
|
5650
5690
|
if (itemType === "file_change" && item.changes && item.changes.length > 0) {
|
|
5651
|
-
const changes = item.changes.map((
|
|
5652
|
-
const action =
|
|
5653
|
-
return `${action}: ${
|
|
5691
|
+
const changes = item.changes.map((c21) => {
|
|
5692
|
+
const action = c21.kind === "add" ? "Created" : c21.kind === "modify" ? "Modified" : "Deleted";
|
|
5693
|
+
return `${action}: ${c21.path}`;
|
|
5654
5694
|
}).join("\n");
|
|
5655
5695
|
return {
|
|
5656
5696
|
type: "text",
|
|
@@ -5804,9 +5844,9 @@ var CodexEventRenderer = class {
|
|
|
5804
5844
|
return;
|
|
5805
5845
|
}
|
|
5806
5846
|
if (itemType === "file_change" && item.changes && item.changes.length > 0) {
|
|
5807
|
-
const summary = item.changes.map((
|
|
5808
|
-
const icon =
|
|
5809
|
-
return `${icon}${
|
|
5847
|
+
const summary = item.changes.map((c21) => {
|
|
5848
|
+
const icon = c21.kind === "add" ? "+" : c21.kind === "delete" ? "-" : "~";
|
|
5849
|
+
return `${icon}${c21.path}`;
|
|
5810
5850
|
}).join(", ");
|
|
5811
5851
|
console.log(chalk7.green("[files]") + ` ${summary}`);
|
|
5812
5852
|
return;
|
|
@@ -7124,7 +7164,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
7124
7164
|
}
|
|
7125
7165
|
showNextSteps(result);
|
|
7126
7166
|
if (options.autoUpdate !== false) {
|
|
7127
|
-
await silentUpgradeAfterCommand("9.
|
|
7167
|
+
await silentUpgradeAfterCommand("9.14.1");
|
|
7128
7168
|
}
|
|
7129
7169
|
} catch (error) {
|
|
7130
7170
|
handleRunError(error, identifier);
|
|
@@ -8629,8 +8669,8 @@ var cookAction = new Command27().name("cook").description("Quick start: prepare,
|
|
|
8629
8669
|
"Load environment variables from file (priority: CLI flags > file > env vars)"
|
|
8630
8670
|
).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(
|
|
8631
8671
|
async (prompt, options) => {
|
|
8632
|
-
if (
|
|
8633
|
-
const shouldExit = await checkAndUpgrade("9.
|
|
8672
|
+
if (options.autoUpdate !== false) {
|
|
8673
|
+
const shouldExit = await checkAndUpgrade("9.14.1", prompt);
|
|
8634
8674
|
if (shouldExit) {
|
|
8635
8675
|
process.exit(0);
|
|
8636
8676
|
}
|
|
@@ -9205,12 +9245,131 @@ var setCommand = new Command33().name("set").description("Set your scope slug").
|
|
|
9205
9245
|
var scopeCommand = new Command34().name("scope").description("Manage your scope (namespace for agents)").addCommand(statusCommand4).addCommand(setCommand);
|
|
9206
9246
|
|
|
9207
9247
|
// src/commands/agent/index.ts
|
|
9208
|
-
import { Command as
|
|
9248
|
+
import { Command as Command38 } from "commander";
|
|
9209
9249
|
|
|
9210
|
-
// src/commands/agent/
|
|
9250
|
+
// src/commands/agent/clone.ts
|
|
9211
9251
|
import { Command as Command35 } from "commander";
|
|
9212
9252
|
import chalk36 from "chalk";
|
|
9213
|
-
|
|
9253
|
+
import { existsSync as existsSync10, mkdtempSync as mkdtempSync5 } from "fs";
|
|
9254
|
+
import { mkdir as mkdir7, writeFile as writeFile6, readdir, copyFile, rm as rm3 } from "fs/promises";
|
|
9255
|
+
import { join as join7, dirname as dirname3 } from "path";
|
|
9256
|
+
import { tmpdir as tmpdir7 } from "os";
|
|
9257
|
+
import * as tar6 from "tar";
|
|
9258
|
+
import { stringify as yamlStringify } from "yaml";
|
|
9259
|
+
function cleanComposeContent(content) {
|
|
9260
|
+
const cleaned = {
|
|
9261
|
+
version: content.version,
|
|
9262
|
+
agents: {}
|
|
9263
|
+
};
|
|
9264
|
+
for (const [agentName, agent] of Object.entries(content.agents)) {
|
|
9265
|
+
const { image, working_dir: workingDir, ...rest } = agent;
|
|
9266
|
+
void image;
|
|
9267
|
+
void workingDir;
|
|
9268
|
+
cleaned.agents[agentName] = rest;
|
|
9269
|
+
}
|
|
9270
|
+
if (content.volumes) {
|
|
9271
|
+
cleaned.volumes = content.volumes;
|
|
9272
|
+
}
|
|
9273
|
+
return cleaned;
|
|
9274
|
+
}
|
|
9275
|
+
async function downloadInstructions(agentName, instructionsPath, destination) {
|
|
9276
|
+
const volumeName = getInstructionsStorageName(agentName);
|
|
9277
|
+
console.log(chalk36.dim("Downloading instructions..."));
|
|
9278
|
+
const downloadInfo = await getStorageDownload({
|
|
9279
|
+
name: volumeName,
|
|
9280
|
+
type: "volume"
|
|
9281
|
+
});
|
|
9282
|
+
if ("empty" in downloadInfo) {
|
|
9283
|
+
console.log(chalk36.yellow("\u26A0 Instructions volume is empty"));
|
|
9284
|
+
return false;
|
|
9285
|
+
}
|
|
9286
|
+
const response = await fetch(downloadInfo.url);
|
|
9287
|
+
if (!response.ok) {
|
|
9288
|
+
throw new Error(`Failed to download instructions: ${response.status}`);
|
|
9289
|
+
}
|
|
9290
|
+
const buffer = Buffer.from(await response.arrayBuffer());
|
|
9291
|
+
const tmpDir = mkdtempSync5(join7(tmpdir7(), "vm0-clone-"));
|
|
9292
|
+
const tarPath = join7(tmpDir, "archive.tar.gz");
|
|
9293
|
+
await writeFile6(tarPath, buffer);
|
|
9294
|
+
await tar6.extract({ file: tarPath, cwd: tmpDir, gzip: true });
|
|
9295
|
+
const files = await readdir(tmpDir);
|
|
9296
|
+
const mdFile = files.find((f) => f === "CLAUDE.md" || f === "AGENTS.md");
|
|
9297
|
+
if (!mdFile) {
|
|
9298
|
+
console.log(chalk36.yellow("\u26A0 No instructions file found in volume"));
|
|
9299
|
+
await rm3(tmpDir, { recursive: true, force: true });
|
|
9300
|
+
return false;
|
|
9301
|
+
}
|
|
9302
|
+
const destPath = join7(destination, instructionsPath);
|
|
9303
|
+
await mkdir7(dirname3(destPath), { recursive: true });
|
|
9304
|
+
await copyFile(join7(tmpDir, mdFile), destPath);
|
|
9305
|
+
await rm3(tmpDir, { recursive: true, force: true });
|
|
9306
|
+
return true;
|
|
9307
|
+
}
|
|
9308
|
+
var cloneCommand3 = new Command35().name("clone").description("Clone agent compose to local directory (latest version)").argument("<name>", "Agent compose name to clone").argument("[destination]", "Destination directory (default: agent name)").action(async (name, destination) => {
|
|
9309
|
+
try {
|
|
9310
|
+
const targetDir = destination || name;
|
|
9311
|
+
if (existsSync10(targetDir)) {
|
|
9312
|
+
console.error(chalk36.red(`\u2717 Directory "${targetDir}" already exists`));
|
|
9313
|
+
process.exit(1);
|
|
9314
|
+
}
|
|
9315
|
+
console.log(`Cloning agent compose: ${name}`);
|
|
9316
|
+
const compose = await getComposeByName(name);
|
|
9317
|
+
if (!compose) {
|
|
9318
|
+
console.error(chalk36.red(`\u2717 Agent compose not found: ${name}`));
|
|
9319
|
+
process.exit(1);
|
|
9320
|
+
}
|
|
9321
|
+
if (!compose.content || !compose.headVersionId) {
|
|
9322
|
+
console.error(chalk36.red(`\u2717 Agent compose has no content: ${name}`));
|
|
9323
|
+
process.exit(1);
|
|
9324
|
+
}
|
|
9325
|
+
const content = compose.content;
|
|
9326
|
+
const cleanedContent = cleanComposeContent(content);
|
|
9327
|
+
const yamlContent = yamlStringify(cleanedContent);
|
|
9328
|
+
await mkdir7(targetDir, { recursive: true });
|
|
9329
|
+
const yamlPath = join7(targetDir, "vm0.yaml");
|
|
9330
|
+
await writeFile6(yamlPath, yamlContent, "utf8");
|
|
9331
|
+
console.log(chalk36.green("\u2713 Created vm0.yaml"));
|
|
9332
|
+
const agentKey = Object.keys(content.agents)[0];
|
|
9333
|
+
const agent = agentKey ? content.agents[agentKey] : void 0;
|
|
9334
|
+
if (agent?.instructions) {
|
|
9335
|
+
try {
|
|
9336
|
+
const instructionsDownloaded = await downloadInstructions(
|
|
9337
|
+
name,
|
|
9338
|
+
agent.instructions,
|
|
9339
|
+
targetDir
|
|
9340
|
+
);
|
|
9341
|
+
if (instructionsDownloaded) {
|
|
9342
|
+
console.log(chalk36.green(`\u2713 Downloaded ${agent.instructions}`));
|
|
9343
|
+
}
|
|
9344
|
+
} catch (error) {
|
|
9345
|
+
console.log(
|
|
9346
|
+
chalk36.yellow(
|
|
9347
|
+
`\u26A0 Could not download instructions: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
9348
|
+
)
|
|
9349
|
+
);
|
|
9350
|
+
}
|
|
9351
|
+
}
|
|
9352
|
+
console.log();
|
|
9353
|
+
console.log(chalk36.green(`\u2713 Successfully cloned agent: ${name}`));
|
|
9354
|
+
console.log(chalk36.dim(` Location: ${targetDir}/`));
|
|
9355
|
+
console.log(chalk36.dim(` Version: ${compose.headVersionId.slice(0, 8)}`));
|
|
9356
|
+
} catch (error) {
|
|
9357
|
+
console.error(chalk36.red("\u2717 Clone failed"));
|
|
9358
|
+
if (error instanceof Error) {
|
|
9359
|
+
if (error.message.includes("Not authenticated")) {
|
|
9360
|
+
console.error(chalk36.dim(" Run: vm0 auth login"));
|
|
9361
|
+
} else {
|
|
9362
|
+
console.error(chalk36.dim(` ${error.message}`));
|
|
9363
|
+
}
|
|
9364
|
+
}
|
|
9365
|
+
process.exit(1);
|
|
9366
|
+
}
|
|
9367
|
+
});
|
|
9368
|
+
|
|
9369
|
+
// src/commands/agent/list.ts
|
|
9370
|
+
import { Command as Command36 } from "commander";
|
|
9371
|
+
import chalk37 from "chalk";
|
|
9372
|
+
var listCommand4 = new Command36().name("list").alias("ls").description("List all agent composes").action(async () => {
|
|
9214
9373
|
try {
|
|
9215
9374
|
const response = await httpGet("/api/agent/composes/list");
|
|
9216
9375
|
if (!response.ok) {
|
|
@@ -9219,19 +9378,19 @@ var listCommand4 = new Command35().name("list").alias("ls").description("List al
|
|
|
9219
9378
|
}
|
|
9220
9379
|
const data = await response.json();
|
|
9221
9380
|
if (data.composes.length === 0) {
|
|
9222
|
-
console.log(
|
|
9381
|
+
console.log(chalk37.dim("No agent composes found"));
|
|
9223
9382
|
console.log(
|
|
9224
|
-
|
|
9383
|
+
chalk37.dim(" Create one with: vm0 compose <agent-compose.yaml>")
|
|
9225
9384
|
);
|
|
9226
9385
|
return;
|
|
9227
9386
|
}
|
|
9228
|
-
const nameWidth = Math.max(4, ...data.composes.map((
|
|
9387
|
+
const nameWidth = Math.max(4, ...data.composes.map((c21) => c21.name.length));
|
|
9229
9388
|
const header = ["NAME".padEnd(nameWidth), "VERSION", "UPDATED"].join(
|
|
9230
9389
|
" "
|
|
9231
9390
|
);
|
|
9232
|
-
console.log(
|
|
9391
|
+
console.log(chalk37.dim(header));
|
|
9233
9392
|
for (const compose of data.composes) {
|
|
9234
|
-
const versionShort = compose.headVersionId ? compose.headVersionId.slice(0, 8) :
|
|
9393
|
+
const versionShort = compose.headVersionId ? compose.headVersionId.slice(0, 8) : chalk37.dim("-");
|
|
9235
9394
|
const row = [
|
|
9236
9395
|
compose.name.padEnd(nameWidth),
|
|
9237
9396
|
versionShort,
|
|
@@ -9240,12 +9399,12 @@ var listCommand4 = new Command35().name("list").alias("ls").description("List al
|
|
|
9240
9399
|
console.log(row);
|
|
9241
9400
|
}
|
|
9242
9401
|
} catch (error) {
|
|
9243
|
-
console.error(
|
|
9402
|
+
console.error(chalk37.red("\u2717 Failed to list agent composes"));
|
|
9244
9403
|
if (error instanceof Error) {
|
|
9245
9404
|
if (error.message.includes("Not authenticated")) {
|
|
9246
|
-
console.error(
|
|
9405
|
+
console.error(chalk37.dim(" Run: vm0 auth login"));
|
|
9247
9406
|
} else {
|
|
9248
|
-
console.error(
|
|
9407
|
+
console.error(chalk37.dim(` ${error.message}`));
|
|
9249
9408
|
}
|
|
9250
9409
|
}
|
|
9251
9410
|
process.exit(1);
|
|
@@ -9253,8 +9412,8 @@ var listCommand4 = new Command35().name("list").alias("ls").description("List al
|
|
|
9253
9412
|
});
|
|
9254
9413
|
|
|
9255
9414
|
// src/commands/agent/status.ts
|
|
9256
|
-
import { Command as
|
|
9257
|
-
import
|
|
9415
|
+
import { Command as Command37 } from "commander";
|
|
9416
|
+
import chalk38 from "chalk";
|
|
9258
9417
|
|
|
9259
9418
|
// src/lib/domain/source-derivation.ts
|
|
9260
9419
|
import * as fs9 from "fs/promises";
|
|
@@ -9378,27 +9537,27 @@ function formatVariableSources(sources) {
|
|
|
9378
9537
|
if (sources.secrets.length > 0) {
|
|
9379
9538
|
console.log(` Secrets:`);
|
|
9380
9539
|
for (const secret of sources.secrets) {
|
|
9381
|
-
const sourceInfo =
|
|
9540
|
+
const sourceInfo = chalk38.dim(`(${secret.source})`);
|
|
9382
9541
|
console.log(` - ${secret.name.padEnd(20)} ${sourceInfo}`);
|
|
9383
9542
|
}
|
|
9384
9543
|
}
|
|
9385
9544
|
if (sources.vars.length > 0) {
|
|
9386
9545
|
console.log(` Vars:`);
|
|
9387
9546
|
for (const v of sources.vars) {
|
|
9388
|
-
const sourceInfo =
|
|
9547
|
+
const sourceInfo = chalk38.dim(`(${v.source})`);
|
|
9389
9548
|
console.log(` - ${v.name.padEnd(20)} ${sourceInfo}`);
|
|
9390
9549
|
}
|
|
9391
9550
|
}
|
|
9392
9551
|
if (sources.credentials.length > 0) {
|
|
9393
9552
|
console.log(` Credentials:`);
|
|
9394
9553
|
for (const cred of sources.credentials) {
|
|
9395
|
-
const sourceInfo =
|
|
9554
|
+
const sourceInfo = chalk38.dim(`(${cred.source})`);
|
|
9396
9555
|
console.log(` - ${cred.name.padEnd(20)} ${sourceInfo}`);
|
|
9397
9556
|
}
|
|
9398
9557
|
}
|
|
9399
9558
|
}
|
|
9400
9559
|
function formatAgentDetails(agentName, agent, agentSources, volumeConfigs) {
|
|
9401
|
-
console.log(` ${
|
|
9560
|
+
console.log(` ${chalk38.cyan(agentName)}:`);
|
|
9402
9561
|
console.log(` Framework: ${agent.framework}`);
|
|
9403
9562
|
if (agent.image) {
|
|
9404
9563
|
console.log(` Image: ${agent.image}`);
|
|
@@ -9417,16 +9576,16 @@ function formatAgentDetails(agentName, agent, agentSources, volumeConfigs) {
|
|
|
9417
9576
|
}
|
|
9418
9577
|
}
|
|
9419
9578
|
function formatComposeOutput(name, versionId, content, variableSources) {
|
|
9420
|
-
console.log(
|
|
9421
|
-
console.log(
|
|
9579
|
+
console.log(chalk38.bold("Name:") + ` ${name}`);
|
|
9580
|
+
console.log(chalk38.bold("Version:") + ` ${versionId}`);
|
|
9422
9581
|
console.log();
|
|
9423
|
-
console.log(
|
|
9582
|
+
console.log(chalk38.bold("Agents:"));
|
|
9424
9583
|
for (const [agentName, agent] of Object.entries(content.agents)) {
|
|
9425
9584
|
const agentSources = variableSources?.get(agentName);
|
|
9426
9585
|
formatAgentDetails(agentName, agent, agentSources, content.volumes);
|
|
9427
9586
|
}
|
|
9428
9587
|
}
|
|
9429
|
-
var statusCommand5 = new
|
|
9588
|
+
var statusCommand5 = new Command37().name("status").description("Show status of agent compose").argument(
|
|
9430
9589
|
"<name[:version]>",
|
|
9431
9590
|
"Agent name with optional version (e.g., my-agent:latest or my-agent:a1b2c3d4)"
|
|
9432
9591
|
).option("--no-sources", "Skip fetching skills to determine variable sources").action(async (argument, options) => {
|
|
@@ -9443,8 +9602,8 @@ var statusCommand5 = new Command36().name("status").description("Show status of
|
|
|
9443
9602
|
}
|
|
9444
9603
|
const compose = await getComposeByName(name);
|
|
9445
9604
|
if (!compose) {
|
|
9446
|
-
console.error(
|
|
9447
|
-
console.error(
|
|
9605
|
+
console.error(chalk38.red(`\u2717 Agent compose not found: ${name}`));
|
|
9606
|
+
console.error(chalk38.dim(" Run: vm0 agent list"));
|
|
9448
9607
|
process.exit(1);
|
|
9449
9608
|
}
|
|
9450
9609
|
let resolvedVersionId = compose.headVersionId;
|
|
@@ -9455,9 +9614,9 @@ var statusCommand5 = new Command36().name("status").description("Show status of
|
|
|
9455
9614
|
resolvedVersionId = versionInfo.versionId;
|
|
9456
9615
|
} catch (error) {
|
|
9457
9616
|
if (error instanceof Error && error.message.includes("not found")) {
|
|
9458
|
-
console.error(
|
|
9617
|
+
console.error(chalk38.red(`\u2717 Version not found: ${version}`));
|
|
9459
9618
|
console.error(
|
|
9460
|
-
|
|
9619
|
+
chalk38.dim(
|
|
9461
9620
|
` HEAD version: ${compose.headVersionId?.slice(0, 8)}`
|
|
9462
9621
|
)
|
|
9463
9622
|
);
|
|
@@ -9470,7 +9629,7 @@ var statusCommand5 = new Command36().name("status").description("Show status of
|
|
|
9470
9629
|
}
|
|
9471
9630
|
}
|
|
9472
9631
|
if (!resolvedVersionId || !compose.content) {
|
|
9473
|
-
console.error(
|
|
9632
|
+
console.error(chalk38.red(`\u2717 No version found for: ${name}`));
|
|
9474
9633
|
process.exit(1);
|
|
9475
9634
|
}
|
|
9476
9635
|
const content = compose.content;
|
|
@@ -9481,7 +9640,7 @@ var statusCommand5 = new Command36().name("status").description("Show status of
|
|
|
9481
9640
|
});
|
|
9482
9641
|
} catch {
|
|
9483
9642
|
console.error(
|
|
9484
|
-
|
|
9643
|
+
chalk38.yellow(
|
|
9485
9644
|
"\u26A0 Warning: Failed to fetch skill sources, showing basic info"
|
|
9486
9645
|
)
|
|
9487
9646
|
);
|
|
@@ -9493,12 +9652,12 @@ var statusCommand5 = new Command36().name("status").description("Show status of
|
|
|
9493
9652
|
variableSources
|
|
9494
9653
|
);
|
|
9495
9654
|
} catch (error) {
|
|
9496
|
-
console.error(
|
|
9655
|
+
console.error(chalk38.red("\u2717 Failed to get agent compose status"));
|
|
9497
9656
|
if (error instanceof Error) {
|
|
9498
9657
|
if (error.message.includes("Not authenticated")) {
|
|
9499
|
-
console.error(
|
|
9658
|
+
console.error(chalk38.dim(" Run: vm0 auth login"));
|
|
9500
9659
|
} else {
|
|
9501
|
-
console.error(
|
|
9660
|
+
console.error(chalk38.dim(` ${error.message}`));
|
|
9502
9661
|
}
|
|
9503
9662
|
}
|
|
9504
9663
|
process.exit(1);
|
|
@@ -9506,14 +9665,14 @@ var statusCommand5 = new Command36().name("status").description("Show status of
|
|
|
9506
9665
|
});
|
|
9507
9666
|
|
|
9508
9667
|
// src/commands/agent/index.ts
|
|
9509
|
-
var agentCommand = new
|
|
9668
|
+
var agentCommand = new Command38().name("agent").description("Manage agent composes").addCommand(cloneCommand3).addCommand(listCommand4).addCommand(statusCommand5);
|
|
9510
9669
|
|
|
9511
9670
|
// src/commands/init/index.ts
|
|
9512
|
-
import { Command as
|
|
9513
|
-
import
|
|
9671
|
+
import { Command as Command39 } from "commander";
|
|
9672
|
+
import chalk39 from "chalk";
|
|
9514
9673
|
import path15 from "path";
|
|
9515
|
-
import { existsSync as
|
|
9516
|
-
import { writeFile as
|
|
9674
|
+
import { existsSync as existsSync11 } from "fs";
|
|
9675
|
+
import { writeFile as writeFile7 } from "fs/promises";
|
|
9517
9676
|
var VM0_YAML_FILE = "vm0.yaml";
|
|
9518
9677
|
var AGENTS_MD_FILE = "AGENTS.md";
|
|
9519
9678
|
function generateVm0Yaml(agentName) {
|
|
@@ -9544,18 +9703,18 @@ You are a HackerNews AI content curator.
|
|
|
9544
9703
|
}
|
|
9545
9704
|
function checkExistingFiles() {
|
|
9546
9705
|
const existingFiles = [];
|
|
9547
|
-
if (
|
|
9548
|
-
if (
|
|
9706
|
+
if (existsSync11(VM0_YAML_FILE)) existingFiles.push(VM0_YAML_FILE);
|
|
9707
|
+
if (existsSync11(AGENTS_MD_FILE)) existingFiles.push(AGENTS_MD_FILE);
|
|
9549
9708
|
return existingFiles;
|
|
9550
9709
|
}
|
|
9551
|
-
var initCommand3 = new
|
|
9710
|
+
var initCommand3 = new Command39().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) => {
|
|
9552
9711
|
const existingFiles = checkExistingFiles();
|
|
9553
9712
|
if (existingFiles.length > 0 && !options.force) {
|
|
9554
9713
|
for (const file of existingFiles) {
|
|
9555
|
-
console.log(
|
|
9714
|
+
console.log(chalk39.red(`\u2717 ${file} already exists`));
|
|
9556
9715
|
}
|
|
9557
9716
|
console.log();
|
|
9558
|
-
console.log(`To overwrite: ${
|
|
9717
|
+
console.log(`To overwrite: ${chalk39.cyan("vm0 init --force")}`);
|
|
9559
9718
|
process.exit(1);
|
|
9560
9719
|
}
|
|
9561
9720
|
let agentName;
|
|
@@ -9563,9 +9722,9 @@ var initCommand3 = new Command38().name("init").description("Initialize a new VM
|
|
|
9563
9722
|
agentName = options.name.trim();
|
|
9564
9723
|
} else if (!isInteractive()) {
|
|
9565
9724
|
console.error(
|
|
9566
|
-
|
|
9725
|
+
chalk39.red("\u2717 --name flag is required in non-interactive mode")
|
|
9567
9726
|
);
|
|
9568
|
-
console.error(
|
|
9727
|
+
console.error(chalk39.dim(" Usage: vm0 init --name <agent-name>"));
|
|
9569
9728
|
process.exit(1);
|
|
9570
9729
|
} else {
|
|
9571
9730
|
const dirName = path15.basename(process.cwd());
|
|
@@ -9581,47 +9740,47 @@ var initCommand3 = new Command38().name("init").description("Initialize a new VM
|
|
|
9581
9740
|
}
|
|
9582
9741
|
);
|
|
9583
9742
|
if (name === void 0) {
|
|
9584
|
-
console.log(
|
|
9743
|
+
console.log(chalk39.dim("Cancelled"));
|
|
9585
9744
|
return;
|
|
9586
9745
|
}
|
|
9587
9746
|
agentName = name;
|
|
9588
9747
|
}
|
|
9589
9748
|
if (!agentName || !validateAgentName(agentName)) {
|
|
9590
|
-
console.log(
|
|
9749
|
+
console.log(chalk39.red("\u2717 Invalid agent name"));
|
|
9591
9750
|
console.log(
|
|
9592
|
-
|
|
9751
|
+
chalk39.dim(" Must be 3-64 characters, alphanumeric and hyphens only")
|
|
9593
9752
|
);
|
|
9594
|
-
console.log(
|
|
9753
|
+
console.log(chalk39.dim(" Must start and end with letter or number"));
|
|
9595
9754
|
process.exit(1);
|
|
9596
9755
|
}
|
|
9597
|
-
await
|
|
9756
|
+
await writeFile7(VM0_YAML_FILE, generateVm0Yaml(agentName));
|
|
9598
9757
|
const vm0Status = existingFiles.includes(VM0_YAML_FILE) ? " (overwritten)" : "";
|
|
9599
|
-
console.log(
|
|
9600
|
-
await
|
|
9758
|
+
console.log(chalk39.green(`\u2713 Created ${VM0_YAML_FILE}${vm0Status}`));
|
|
9759
|
+
await writeFile7(AGENTS_MD_FILE, generateAgentsMd());
|
|
9601
9760
|
const agentsStatus = existingFiles.includes(AGENTS_MD_FILE) ? " (overwritten)" : "";
|
|
9602
|
-
console.log(
|
|
9761
|
+
console.log(chalk39.green(`\u2713 Created ${AGENTS_MD_FILE}${agentsStatus}`));
|
|
9603
9762
|
console.log();
|
|
9604
9763
|
console.log("Next steps:");
|
|
9605
9764
|
console.log(
|
|
9606
|
-
` 1. Set up model provider (one-time): ${
|
|
9765
|
+
` 1. Set up model provider (one-time): ${chalk39.cyan("vm0 model-provider setup")}`
|
|
9607
9766
|
);
|
|
9608
9767
|
console.log(
|
|
9609
|
-
` 2. Edit ${
|
|
9768
|
+
` 2. Edit ${chalk39.cyan("AGENTS.md")} to customize your agent's workflow`
|
|
9610
9769
|
);
|
|
9611
9770
|
console.log(
|
|
9612
|
-
` Or install Claude plugin: ${
|
|
9771
|
+
` Or install Claude plugin: ${chalk39.cyan(`vm0 setup-claude && claude "/vm0-agent let's build an agent"`)}`
|
|
9613
9772
|
);
|
|
9614
9773
|
console.log(
|
|
9615
|
-
` 3. Run your agent: ${
|
|
9774
|
+
` 3. Run your agent: ${chalk39.cyan(`vm0 cook "let's start working"`)}`
|
|
9616
9775
|
);
|
|
9617
9776
|
});
|
|
9618
9777
|
|
|
9619
9778
|
// src/commands/schedule/index.ts
|
|
9620
|
-
import { Command as
|
|
9779
|
+
import { Command as Command46 } from "commander";
|
|
9621
9780
|
|
|
9622
9781
|
// src/commands/schedule/setup.ts
|
|
9623
|
-
import { Command as
|
|
9624
|
-
import
|
|
9782
|
+
import { Command as Command40 } from "commander";
|
|
9783
|
+
import chalk41 from "chalk";
|
|
9625
9784
|
|
|
9626
9785
|
// src/lib/domain/schedule-utils.ts
|
|
9627
9786
|
import { parse as parseYaml5 } from "yaml";
|
|
@@ -9763,7 +9922,7 @@ async function resolveScheduleByAgent(agentName) {
|
|
|
9763
9922
|
}
|
|
9764
9923
|
|
|
9765
9924
|
// src/commands/schedule/gather-configuration.ts
|
|
9766
|
-
import
|
|
9925
|
+
import chalk40 from "chalk";
|
|
9767
9926
|
var defaultPromptDeps = {
|
|
9768
9927
|
isInteractive,
|
|
9769
9928
|
promptConfirm,
|
|
@@ -9797,7 +9956,7 @@ async function handleSecrets(optionSecrets, existingSecretNames, deps) {
|
|
|
9797
9956
|
if (keepSecrets) {
|
|
9798
9957
|
return { secrets: {}, preserveExistingSecrets: true };
|
|
9799
9958
|
}
|
|
9800
|
-
console.log(
|
|
9959
|
+
console.log(chalk40.dim(" Note: You'll need to provide new secret values"));
|
|
9801
9960
|
return { secrets: {}, preserveExistingSecrets: false };
|
|
9802
9961
|
}
|
|
9803
9962
|
return { secrets: {}, preserveExistingSecrets: false };
|
|
@@ -9818,17 +9977,17 @@ async function handleVars(optionVars, existingVars, deps) {
|
|
|
9818
9977
|
return {};
|
|
9819
9978
|
}
|
|
9820
9979
|
function displayMissingRequirements(missingSecrets, missingVars) {
|
|
9821
|
-
console.log(
|
|
9980
|
+
console.log(chalk40.yellow("\nAgent requires the following configuration:"));
|
|
9822
9981
|
if (missingSecrets.length > 0) {
|
|
9823
|
-
console.log(
|
|
9982
|
+
console.log(chalk40.dim(" Secrets:"));
|
|
9824
9983
|
for (const name of missingSecrets) {
|
|
9825
|
-
console.log(
|
|
9984
|
+
console.log(chalk40.dim(` ${name}`));
|
|
9826
9985
|
}
|
|
9827
9986
|
}
|
|
9828
9987
|
if (missingVars.length > 0) {
|
|
9829
|
-
console.log(
|
|
9988
|
+
console.log(chalk40.dim(" Vars:"));
|
|
9830
9989
|
for (const name of missingVars) {
|
|
9831
|
-
console.log(
|
|
9990
|
+
console.log(chalk40.dim(` ${name}`));
|
|
9832
9991
|
}
|
|
9833
9992
|
}
|
|
9834
9993
|
console.log("");
|
|
@@ -9836,7 +9995,7 @@ function displayMissingRequirements(missingSecrets, missingVars) {
|
|
|
9836
9995
|
async function promptForMissingSecrets(missingSecrets, secrets, deps) {
|
|
9837
9996
|
for (const name of missingSecrets) {
|
|
9838
9997
|
const value = await deps.promptPassword(
|
|
9839
|
-
`Enter value for secret ${
|
|
9998
|
+
`Enter value for secret ${chalk40.cyan(name)}`
|
|
9840
9999
|
);
|
|
9841
10000
|
if (value) {
|
|
9842
10001
|
secrets[name] = value;
|
|
@@ -9846,7 +10005,7 @@ async function promptForMissingSecrets(missingSecrets, secrets, deps) {
|
|
|
9846
10005
|
async function promptForMissingVars(missingVars, vars, deps) {
|
|
9847
10006
|
for (const name of missingVars) {
|
|
9848
10007
|
const value = await deps.promptText(
|
|
9849
|
-
`Enter value for var ${
|
|
10008
|
+
`Enter value for var ${chalk40.cyan(name)}`,
|
|
9850
10009
|
""
|
|
9851
10010
|
);
|
|
9852
10011
|
if (value) {
|
|
@@ -9936,7 +10095,7 @@ function expandEnvVars(value) {
|
|
|
9936
10095
|
const envValue = process.env[varName];
|
|
9937
10096
|
if (envValue === void 0) {
|
|
9938
10097
|
console.warn(
|
|
9939
|
-
|
|
10098
|
+
chalk41.yellow(` Warning: Environment variable ${varName} not set`)
|
|
9940
10099
|
);
|
|
9941
10100
|
return match;
|
|
9942
10101
|
}
|
|
@@ -10003,11 +10162,11 @@ async function gatherFrequency(optionFrequency, existingFrequency) {
|
|
|
10003
10162
|
}
|
|
10004
10163
|
if (!isInteractive()) {
|
|
10005
10164
|
console.error(
|
|
10006
|
-
|
|
10165
|
+
chalk41.red("\u2717 --frequency is required (daily|weekly|monthly|once)")
|
|
10007
10166
|
);
|
|
10008
10167
|
process.exit(1);
|
|
10009
10168
|
}
|
|
10010
|
-
const defaultIndex = existingFrequency ? FREQUENCY_CHOICES.findIndex((
|
|
10169
|
+
const defaultIndex = existingFrequency ? FREQUENCY_CHOICES.findIndex((c21) => c21.value === existingFrequency) : 0;
|
|
10011
10170
|
frequency = await promptSelect(
|
|
10012
10171
|
"Schedule frequency",
|
|
10013
10172
|
FREQUENCY_CHOICES,
|
|
@@ -10023,7 +10182,7 @@ async function gatherDay(frequency, optionDay, existingDay) {
|
|
|
10023
10182
|
const day2 = parseDayOption(optionDay, frequency);
|
|
10024
10183
|
if (day2 === void 0) {
|
|
10025
10184
|
console.error(
|
|
10026
|
-
|
|
10185
|
+
chalk41.red(
|
|
10027
10186
|
`\u2717 Invalid day: ${optionDay}. Use mon-sun for weekly or 1-31 for monthly.`
|
|
10028
10187
|
)
|
|
10029
10188
|
);
|
|
@@ -10032,11 +10191,11 @@ async function gatherDay(frequency, optionDay, existingDay) {
|
|
|
10032
10191
|
return day2;
|
|
10033
10192
|
}
|
|
10034
10193
|
if (!isInteractive()) {
|
|
10035
|
-
console.error(
|
|
10194
|
+
console.error(chalk41.red("\u2717 --day is required for weekly/monthly"));
|
|
10036
10195
|
process.exit(1);
|
|
10037
10196
|
}
|
|
10038
10197
|
if (frequency === "weekly") {
|
|
10039
|
-
const defaultDayIndex = existingDay !== void 0 ? DAY_OF_WEEK_CHOICES.findIndex((
|
|
10198
|
+
const defaultDayIndex = existingDay !== void 0 ? DAY_OF_WEEK_CHOICES.findIndex((c21) => c21.value === existingDay) : 0;
|
|
10040
10199
|
const day2 = await promptSelect(
|
|
10041
10200
|
"Day of week",
|
|
10042
10201
|
DAY_OF_WEEK_CHOICES,
|
|
@@ -10051,7 +10210,7 @@ async function gatherDay(frequency, optionDay, existingDay) {
|
|
|
10051
10210
|
if (!dayStr) return null;
|
|
10052
10211
|
const day = parseInt(dayStr, 10);
|
|
10053
10212
|
if (isNaN(day) || day < 1 || day > 31) {
|
|
10054
|
-
console.error(
|
|
10213
|
+
console.error(chalk41.red("\u2717 Day must be between 1 and 31"));
|
|
10055
10214
|
process.exit(1);
|
|
10056
10215
|
}
|
|
10057
10216
|
return day;
|
|
@@ -10060,13 +10219,13 @@ async function gatherRecurringTime(optionTime, existingTime) {
|
|
|
10060
10219
|
if (optionTime) {
|
|
10061
10220
|
const validation = validateTimeFormat(optionTime);
|
|
10062
10221
|
if (validation !== true) {
|
|
10063
|
-
console.error(
|
|
10222
|
+
console.error(chalk41.red(`\u2717 Invalid time: ${validation}`));
|
|
10064
10223
|
process.exit(1);
|
|
10065
10224
|
}
|
|
10066
10225
|
return optionTime;
|
|
10067
10226
|
}
|
|
10068
10227
|
if (!isInteractive()) {
|
|
10069
|
-
console.error(
|
|
10228
|
+
console.error(chalk41.red("\u2717 --time is required (HH:MM format)"));
|
|
10070
10229
|
process.exit(1);
|
|
10071
10230
|
}
|
|
10072
10231
|
return await promptText(
|
|
@@ -10079,7 +10238,7 @@ async function gatherOneTimeSchedule(optionDay, optionTime, existingTime) {
|
|
|
10079
10238
|
if (optionDay && optionTime) {
|
|
10080
10239
|
if (!validateDateFormat(optionDay)) {
|
|
10081
10240
|
console.error(
|
|
10082
|
-
|
|
10241
|
+
chalk41.red(
|
|
10083
10242
|
`\u2717 Invalid date format: ${optionDay}. Use YYYY-MM-DD format.`
|
|
10084
10243
|
)
|
|
10085
10244
|
);
|
|
@@ -10087,16 +10246,16 @@ async function gatherOneTimeSchedule(optionDay, optionTime, existingTime) {
|
|
|
10087
10246
|
}
|
|
10088
10247
|
if (!validateTimeFormat(optionTime)) {
|
|
10089
10248
|
console.error(
|
|
10090
|
-
|
|
10249
|
+
chalk41.red(`\u2717 Invalid time format: ${optionTime}. Use HH:MM format.`)
|
|
10091
10250
|
);
|
|
10092
10251
|
process.exit(1);
|
|
10093
10252
|
}
|
|
10094
10253
|
return `${optionDay} ${optionTime}`;
|
|
10095
10254
|
}
|
|
10096
10255
|
if (!isInteractive()) {
|
|
10097
|
-
console.error(
|
|
10256
|
+
console.error(chalk41.red("\u2717 One-time schedules require interactive mode"));
|
|
10098
10257
|
console.error(
|
|
10099
|
-
|
|
10258
|
+
chalk41.dim(" Or provide --day (YYYY-MM-DD) and --time (HH:MM) flags")
|
|
10100
10259
|
);
|
|
10101
10260
|
process.exit(1);
|
|
10102
10261
|
}
|
|
@@ -10127,7 +10286,7 @@ async function gatherTimezone(optionTimezone, existingTimezone) {
|
|
|
10127
10286
|
async function gatherPromptText(optionPrompt, existingPrompt) {
|
|
10128
10287
|
if (optionPrompt) return optionPrompt;
|
|
10129
10288
|
if (!isInteractive()) {
|
|
10130
|
-
console.error(
|
|
10289
|
+
console.error(chalk41.red("\u2717 --prompt is required"));
|
|
10131
10290
|
process.exit(1);
|
|
10132
10291
|
}
|
|
10133
10292
|
return await promptText(
|
|
@@ -10138,8 +10297,8 @@ async function gatherPromptText(optionPrompt, existingPrompt) {
|
|
|
10138
10297
|
async function resolveAgent(agentName) {
|
|
10139
10298
|
const compose = await getComposeByName(agentName);
|
|
10140
10299
|
if (!compose) {
|
|
10141
|
-
console.error(
|
|
10142
|
-
console.error(
|
|
10300
|
+
console.error(chalk41.red(`\u2717 Agent not found: ${agentName}`));
|
|
10301
|
+
console.error(chalk41.dim(" Make sure the agent is composed first"));
|
|
10143
10302
|
process.exit(1);
|
|
10144
10303
|
}
|
|
10145
10304
|
return {
|
|
@@ -10186,7 +10345,7 @@ async function buildAndDeploy(params) {
|
|
|
10186
10345
|
const expandedSecrets = expandEnvVarsInObject(params.secrets);
|
|
10187
10346
|
console.log(
|
|
10188
10347
|
`
|
|
10189
|
-
Deploying schedule for agent ${
|
|
10348
|
+
Deploying schedule for agent ${chalk41.cyan(params.agentName)}...`
|
|
10190
10349
|
);
|
|
10191
10350
|
const deployResult = await deploySchedule({
|
|
10192
10351
|
name: params.scheduleName,
|
|
@@ -10202,12 +10361,12 @@ Deploying schedule for agent ${chalk40.cyan(params.agentName)}...`
|
|
|
10202
10361
|
return deployResult;
|
|
10203
10362
|
}
|
|
10204
10363
|
function handleSetupError(error) {
|
|
10205
|
-
console.error(
|
|
10364
|
+
console.error(chalk41.red("\u2717 Failed to setup schedule"));
|
|
10206
10365
|
if (error instanceof Error) {
|
|
10207
10366
|
if (error.message.includes("Not authenticated")) {
|
|
10208
|
-
console.error(
|
|
10367
|
+
console.error(chalk41.dim(" Run: vm0 auth login"));
|
|
10209
10368
|
} else {
|
|
10210
|
-
console.error(
|
|
10369
|
+
console.error(chalk41.dim(` ${error.message}`));
|
|
10211
10370
|
}
|
|
10212
10371
|
}
|
|
10213
10372
|
process.exit(1);
|
|
@@ -10215,56 +10374,56 @@ function handleSetupError(error) {
|
|
|
10215
10374
|
function displayDeployResult(agentName, deployResult) {
|
|
10216
10375
|
if (deployResult.created) {
|
|
10217
10376
|
console.log(
|
|
10218
|
-
|
|
10377
|
+
chalk41.green(`\u2713 Created schedule for agent ${chalk41.cyan(agentName)}`)
|
|
10219
10378
|
);
|
|
10220
10379
|
} else {
|
|
10221
10380
|
console.log(
|
|
10222
|
-
|
|
10381
|
+
chalk41.green(`\u2713 Updated schedule for agent ${chalk41.cyan(agentName)}`)
|
|
10223
10382
|
);
|
|
10224
10383
|
}
|
|
10225
|
-
console.log(
|
|
10384
|
+
console.log(chalk41.dim(` Timezone: ${deployResult.schedule.timezone}`));
|
|
10226
10385
|
if (deployResult.schedule.cronExpression) {
|
|
10227
|
-
console.log(
|
|
10386
|
+
console.log(chalk41.dim(` Cron: ${deployResult.schedule.cronExpression}`));
|
|
10228
10387
|
if (deployResult.schedule.nextRunAt) {
|
|
10229
10388
|
const nextRun = formatInTimezone(
|
|
10230
10389
|
deployResult.schedule.nextRunAt,
|
|
10231
10390
|
deployResult.schedule.timezone
|
|
10232
10391
|
);
|
|
10233
|
-
console.log(
|
|
10392
|
+
console.log(chalk41.dim(` Next run: ${nextRun}`));
|
|
10234
10393
|
}
|
|
10235
10394
|
} else if (deployResult.schedule.atTime) {
|
|
10236
10395
|
const atTimeFormatted = formatInTimezone(
|
|
10237
10396
|
deployResult.schedule.atTime,
|
|
10238
10397
|
deployResult.schedule.timezone
|
|
10239
10398
|
);
|
|
10240
|
-
console.log(
|
|
10399
|
+
console.log(chalk41.dim(` At: ${atTimeFormatted}`));
|
|
10241
10400
|
}
|
|
10242
10401
|
}
|
|
10243
10402
|
async function tryEnableSchedule(scheduleName, composeId, agentName) {
|
|
10244
10403
|
try {
|
|
10245
10404
|
await enableSchedule({ name: scheduleName, composeId });
|
|
10246
10405
|
console.log(
|
|
10247
|
-
|
|
10406
|
+
chalk41.green(`\u2713 Enabled schedule for agent ${chalk41.cyan(agentName)}`)
|
|
10248
10407
|
);
|
|
10249
10408
|
} catch (error) {
|
|
10250
|
-
console.error(
|
|
10409
|
+
console.error(chalk41.yellow("\u26A0 Failed to enable schedule"));
|
|
10251
10410
|
if (error instanceof ApiRequestError) {
|
|
10252
10411
|
if (error.code === "SCHEDULE_PAST") {
|
|
10253
|
-
console.error(
|
|
10412
|
+
console.error(chalk41.dim(" Scheduled time has already passed"));
|
|
10254
10413
|
} else {
|
|
10255
|
-
console.error(
|
|
10414
|
+
console.error(chalk41.dim(` ${error.message}`));
|
|
10256
10415
|
}
|
|
10257
10416
|
} else if (error instanceof Error) {
|
|
10258
|
-
console.error(
|
|
10417
|
+
console.error(chalk41.dim(` ${error.message}`));
|
|
10259
10418
|
}
|
|
10260
10419
|
console.log(
|
|
10261
|
-
` To enable manually: ${
|
|
10420
|
+
` To enable manually: ${chalk41.cyan(`vm0 schedule enable ${agentName}`)}`
|
|
10262
10421
|
);
|
|
10263
10422
|
}
|
|
10264
10423
|
}
|
|
10265
10424
|
function showEnableHint(agentName) {
|
|
10266
10425
|
console.log();
|
|
10267
|
-
console.log(` To enable: ${
|
|
10426
|
+
console.log(` To enable: ${chalk41.cyan(`vm0 schedule enable ${agentName}`)}`);
|
|
10268
10427
|
}
|
|
10269
10428
|
async function handleScheduleEnabling(params) {
|
|
10270
10429
|
const { scheduleName, composeId, agentName, enableFlag, shouldPromptEnable } = params;
|
|
@@ -10285,13 +10444,13 @@ async function handleScheduleEnabling(params) {
|
|
|
10285
10444
|
showEnableHint(agentName);
|
|
10286
10445
|
}
|
|
10287
10446
|
}
|
|
10288
|
-
var setupCommand = new
|
|
10447
|
+
var setupCommand = new Command40().name("setup").description("Create or edit a schedule for an agent").argument("<agent-name>", "Agent name to configure schedule for").option("-f, --frequency <type>", "Frequency: daily|weekly|monthly|once").option("-t, --time <HH:MM>", "Time to run (24-hour format)").option("-d, --day <day>", "Day of week (mon-sun) or day of month (1-31)").option("-z, --timezone <tz>", "IANA timezone").option("-p, --prompt <text>", "Prompt to run").option("--var <name=value>", "Variable (can be repeated)", collect, []).option("--secret <name=value>", "Secret (can be repeated)", collect, []).option("--artifact-name <name>", "Artifact name", "artifact").option("-e, --enable", "Enable schedule immediately after creation").action(async (agentName, options) => {
|
|
10289
10448
|
try {
|
|
10290
10449
|
const { composeId, scheduleName, composeContent } = await resolveAgent(agentName);
|
|
10291
10450
|
const requiredConfig = extractRequiredConfiguration(composeContent);
|
|
10292
10451
|
const existingSchedule = await findExistingSchedule(agentName);
|
|
10293
10452
|
console.log(
|
|
10294
|
-
|
|
10453
|
+
chalk41.dim(
|
|
10295
10454
|
existingSchedule ? `Editing existing schedule for agent ${agentName}` : `Creating new schedule for agent ${agentName}`
|
|
10296
10455
|
)
|
|
10297
10456
|
);
|
|
@@ -10301,12 +10460,12 @@ var setupCommand = new Command39().name("setup").description("Create or edit a s
|
|
|
10301
10460
|
defaults.frequency
|
|
10302
10461
|
);
|
|
10303
10462
|
if (!frequency) {
|
|
10304
|
-
console.log(
|
|
10463
|
+
console.log(chalk41.dim("Cancelled"));
|
|
10305
10464
|
return;
|
|
10306
10465
|
}
|
|
10307
10466
|
const timing = await gatherTiming(frequency, options, defaults);
|
|
10308
10467
|
if (!timing) {
|
|
10309
|
-
console.log(
|
|
10468
|
+
console.log(chalk41.dim("Cancelled"));
|
|
10310
10469
|
return;
|
|
10311
10470
|
}
|
|
10312
10471
|
const { day, time, atTime } = timing;
|
|
@@ -10315,7 +10474,7 @@ var setupCommand = new Command39().name("setup").description("Create or edit a s
|
|
|
10315
10474
|
existingSchedule?.timezone
|
|
10316
10475
|
);
|
|
10317
10476
|
if (!timezone) {
|
|
10318
|
-
console.log(
|
|
10477
|
+
console.log(chalk41.dim("Cancelled"));
|
|
10319
10478
|
return;
|
|
10320
10479
|
}
|
|
10321
10480
|
const promptText_ = await gatherPromptText(
|
|
@@ -10323,7 +10482,7 @@ var setupCommand = new Command39().name("setup").description("Create or edit a s
|
|
|
10323
10482
|
existingSchedule?.prompt
|
|
10324
10483
|
);
|
|
10325
10484
|
if (!promptText_) {
|
|
10326
|
-
console.log(
|
|
10485
|
+
console.log(chalk41.dim("Cancelled"));
|
|
10327
10486
|
return;
|
|
10328
10487
|
}
|
|
10329
10488
|
const config = await gatherConfiguration({
|
|
@@ -10361,15 +10520,15 @@ var setupCommand = new Command39().name("setup").description("Create or edit a s
|
|
|
10361
10520
|
});
|
|
10362
10521
|
|
|
10363
10522
|
// src/commands/schedule/list.ts
|
|
10364
|
-
import { Command as
|
|
10365
|
-
import
|
|
10366
|
-
var listCommand5 = new
|
|
10523
|
+
import { Command as Command41 } from "commander";
|
|
10524
|
+
import chalk42 from "chalk";
|
|
10525
|
+
var listCommand5 = new Command41().name("list").alias("ls").description("List all schedules").action(async () => {
|
|
10367
10526
|
try {
|
|
10368
10527
|
const result = await listSchedules();
|
|
10369
10528
|
if (result.schedules.length === 0) {
|
|
10370
|
-
console.log(
|
|
10529
|
+
console.log(chalk42.dim("No schedules found"));
|
|
10371
10530
|
console.log(
|
|
10372
|
-
|
|
10531
|
+
chalk42.dim(" Create one with: vm0 schedule setup <agent-name>")
|
|
10373
10532
|
);
|
|
10374
10533
|
return;
|
|
10375
10534
|
}
|
|
@@ -10389,10 +10548,10 @@ var listCommand5 = new Command40().name("list").alias("ls").description("List al
|
|
|
10389
10548
|
"STATUS".padEnd(8),
|
|
10390
10549
|
"NEXT RUN"
|
|
10391
10550
|
].join(" ");
|
|
10392
|
-
console.log(
|
|
10551
|
+
console.log(chalk42.dim(header));
|
|
10393
10552
|
for (const schedule of result.schedules) {
|
|
10394
10553
|
const trigger = schedule.cronExpression ? `${schedule.cronExpression} (${schedule.timezone})` : schedule.atTime || "-";
|
|
10395
|
-
const status = schedule.enabled ?
|
|
10554
|
+
const status = schedule.enabled ? chalk42.green("enabled") : chalk42.yellow("disabled");
|
|
10396
10555
|
const nextRun = schedule.enabled ? formatRelativeTime2(schedule.nextRunAt) : "-";
|
|
10397
10556
|
const row = [
|
|
10398
10557
|
schedule.composeName.padEnd(agentWidth),
|
|
@@ -10404,12 +10563,12 @@ var listCommand5 = new Command40().name("list").alias("ls").description("List al
|
|
|
10404
10563
|
console.log(row);
|
|
10405
10564
|
}
|
|
10406
10565
|
} catch (error) {
|
|
10407
|
-
console.error(
|
|
10566
|
+
console.error(chalk42.red("\u2717 Failed to list schedules"));
|
|
10408
10567
|
if (error instanceof Error) {
|
|
10409
10568
|
if (error.message.includes("Not authenticated")) {
|
|
10410
|
-
console.error(
|
|
10569
|
+
console.error(chalk42.dim(" Run: vm0 auth login"));
|
|
10411
10570
|
} else {
|
|
10412
|
-
console.error(
|
|
10571
|
+
console.error(chalk42.dim(` ${error.message}`));
|
|
10413
10572
|
}
|
|
10414
10573
|
}
|
|
10415
10574
|
process.exit(1);
|
|
@@ -10417,45 +10576,45 @@ var listCommand5 = new Command40().name("list").alias("ls").description("List al
|
|
|
10417
10576
|
});
|
|
10418
10577
|
|
|
10419
10578
|
// src/commands/schedule/status.ts
|
|
10420
|
-
import { Command as
|
|
10421
|
-
import
|
|
10579
|
+
import { Command as Command42 } from "commander";
|
|
10580
|
+
import chalk43 from "chalk";
|
|
10422
10581
|
function formatDateTimeStyled(dateStr) {
|
|
10423
|
-
if (!dateStr) return
|
|
10582
|
+
if (!dateStr) return chalk43.dim("-");
|
|
10424
10583
|
const formatted = formatDateTime(dateStr);
|
|
10425
|
-
return formatted.replace(/\(([^)]+)\)$/,
|
|
10584
|
+
return formatted.replace(/\(([^)]+)\)$/, chalk43.dim("($1)"));
|
|
10426
10585
|
}
|
|
10427
10586
|
function formatTrigger(schedule) {
|
|
10428
10587
|
if (schedule.cronExpression) {
|
|
10429
10588
|
return schedule.cronExpression;
|
|
10430
10589
|
}
|
|
10431
10590
|
if (schedule.atTime) {
|
|
10432
|
-
return `${schedule.atTime} ${
|
|
10591
|
+
return `${schedule.atTime} ${chalk43.dim("(one-time)")}`;
|
|
10433
10592
|
}
|
|
10434
|
-
return
|
|
10593
|
+
return chalk43.dim("-");
|
|
10435
10594
|
}
|
|
10436
10595
|
function formatRunStatus2(status) {
|
|
10437
10596
|
switch (status) {
|
|
10438
10597
|
case "completed":
|
|
10439
|
-
return
|
|
10598
|
+
return chalk43.green(status);
|
|
10440
10599
|
case "failed":
|
|
10441
10600
|
case "timeout":
|
|
10442
|
-
return
|
|
10601
|
+
return chalk43.red(status);
|
|
10443
10602
|
case "running":
|
|
10444
|
-
return
|
|
10603
|
+
return chalk43.blue(status);
|
|
10445
10604
|
case "pending":
|
|
10446
|
-
return
|
|
10605
|
+
return chalk43.yellow(status);
|
|
10447
10606
|
default:
|
|
10448
10607
|
return status;
|
|
10449
10608
|
}
|
|
10450
10609
|
}
|
|
10451
10610
|
function printRunConfiguration(schedule) {
|
|
10452
|
-
const statusText = schedule.enabled ?
|
|
10611
|
+
const statusText = schedule.enabled ? chalk43.green("enabled") : chalk43.yellow("disabled");
|
|
10453
10612
|
console.log(`${"Status:".padEnd(16)}${statusText}`);
|
|
10454
10613
|
console.log(
|
|
10455
|
-
`${"Agent:".padEnd(16)}${schedule.composeName} ${
|
|
10614
|
+
`${"Agent:".padEnd(16)}${schedule.composeName} ${chalk43.dim(`(${schedule.scopeSlug})`)}`
|
|
10456
10615
|
);
|
|
10457
10616
|
const promptPreview = schedule.prompt.length > 60 ? schedule.prompt.slice(0, 57) + "..." : schedule.prompt;
|
|
10458
|
-
console.log(`${"Prompt:".padEnd(16)}${
|
|
10617
|
+
console.log(`${"Prompt:".padEnd(16)}${chalk43.dim(promptPreview)}`);
|
|
10459
10618
|
if (schedule.vars && Object.keys(schedule.vars).length > 0) {
|
|
10460
10619
|
console.log(
|
|
10461
10620
|
`${"Variables:".padEnd(16)}${Object.keys(schedule.vars).join(", ")}`
|
|
@@ -10492,7 +10651,7 @@ async function printRecentRuns(name, composeId, limit) {
|
|
|
10492
10651
|
console.log();
|
|
10493
10652
|
console.log("Recent Runs:");
|
|
10494
10653
|
console.log(
|
|
10495
|
-
|
|
10654
|
+
chalk43.dim("RUN ID STATUS CREATED")
|
|
10496
10655
|
);
|
|
10497
10656
|
for (const run of runs) {
|
|
10498
10657
|
const id = run.id;
|
|
@@ -10503,24 +10662,24 @@ async function printRecentRuns(name, composeId, limit) {
|
|
|
10503
10662
|
}
|
|
10504
10663
|
} catch {
|
|
10505
10664
|
console.log();
|
|
10506
|
-
console.log(
|
|
10665
|
+
console.log(chalk43.dim("Recent Runs: (unable to fetch)"));
|
|
10507
10666
|
}
|
|
10508
10667
|
}
|
|
10509
10668
|
function handleStatusError(error, agentName) {
|
|
10510
|
-
console.error(
|
|
10669
|
+
console.error(chalk43.red("\u2717 Failed to get schedule status"));
|
|
10511
10670
|
if (error instanceof Error) {
|
|
10512
10671
|
if (error.message.includes("Not authenticated")) {
|
|
10513
|
-
console.error(
|
|
10672
|
+
console.error(chalk43.dim(" Run: vm0 auth login"));
|
|
10514
10673
|
} else if (error.message.includes("not found") || error.message.includes("Not found") || error.message.includes("No schedule found")) {
|
|
10515
|
-
console.error(
|
|
10516
|
-
console.error(
|
|
10674
|
+
console.error(chalk43.dim(` No schedule found for agent "${agentName}"`));
|
|
10675
|
+
console.error(chalk43.dim(" Run: vm0 schedule list"));
|
|
10517
10676
|
} else {
|
|
10518
|
-
console.error(
|
|
10677
|
+
console.error(chalk43.dim(` ${error.message}`));
|
|
10519
10678
|
}
|
|
10520
10679
|
}
|
|
10521
10680
|
process.exit(1);
|
|
10522
10681
|
}
|
|
10523
|
-
var statusCommand6 = new
|
|
10682
|
+
var statusCommand6 = new Command42().name("status").description("Show detailed status of a schedule").argument("<agent-name>", "Agent name").option(
|
|
10524
10683
|
"-l, --limit <number>",
|
|
10525
10684
|
"Number of recent runs to show (0 to hide)",
|
|
10526
10685
|
"5"
|
|
@@ -10530,8 +10689,8 @@ var statusCommand6 = new Command41().name("status").description("Show detailed s
|
|
|
10530
10689
|
const { name, composeId } = resolved;
|
|
10531
10690
|
const schedule = await getScheduleByName({ name, composeId });
|
|
10532
10691
|
console.log();
|
|
10533
|
-
console.log(`Schedule for agent: ${
|
|
10534
|
-
console.log(
|
|
10692
|
+
console.log(`Schedule for agent: ${chalk43.cyan(agentName)}`);
|
|
10693
|
+
console.log(chalk43.dim("\u2501".repeat(50)));
|
|
10535
10694
|
printRunConfiguration(schedule);
|
|
10536
10695
|
printTimeSchedule(schedule);
|
|
10537
10696
|
const parsed = parseInt(options.limit, 10);
|
|
@@ -10547,24 +10706,24 @@ var statusCommand6 = new Command41().name("status").description("Show detailed s
|
|
|
10547
10706
|
});
|
|
10548
10707
|
|
|
10549
10708
|
// src/commands/schedule/delete.ts
|
|
10550
|
-
import { Command as
|
|
10551
|
-
import
|
|
10552
|
-
var deleteCommand = new
|
|
10709
|
+
import { Command as Command43 } from "commander";
|
|
10710
|
+
import chalk44 from "chalk";
|
|
10711
|
+
var deleteCommand = new Command43().name("delete").alias("rm").description("Delete a schedule").argument("<agent-name>", "Agent name").option("-f, --force", "Skip confirmation prompt").action(async (agentName, options) => {
|
|
10553
10712
|
try {
|
|
10554
10713
|
const resolved = await resolveScheduleByAgent(agentName);
|
|
10555
10714
|
if (!options.force) {
|
|
10556
10715
|
if (!isInteractive()) {
|
|
10557
10716
|
console.error(
|
|
10558
|
-
|
|
10717
|
+
chalk44.red("\u2717 --force required in non-interactive mode")
|
|
10559
10718
|
);
|
|
10560
10719
|
process.exit(1);
|
|
10561
10720
|
}
|
|
10562
10721
|
const confirmed = await promptConfirm(
|
|
10563
|
-
`Delete schedule for agent ${
|
|
10722
|
+
`Delete schedule for agent ${chalk44.cyan(agentName)}?`,
|
|
10564
10723
|
false
|
|
10565
10724
|
);
|
|
10566
10725
|
if (!confirmed) {
|
|
10567
|
-
console.log(
|
|
10726
|
+
console.log(chalk44.dim("Cancelled"));
|
|
10568
10727
|
return;
|
|
10569
10728
|
}
|
|
10570
10729
|
}
|
|
@@ -10573,20 +10732,20 @@ var deleteCommand = new Command42().name("delete").alias("rm").description("Dele
|
|
|
10573
10732
|
composeId: resolved.composeId
|
|
10574
10733
|
});
|
|
10575
10734
|
console.log(
|
|
10576
|
-
|
|
10735
|
+
chalk44.green(`\u2713 Deleted schedule for agent ${chalk44.cyan(agentName)}`)
|
|
10577
10736
|
);
|
|
10578
10737
|
} catch (error) {
|
|
10579
|
-
console.error(
|
|
10738
|
+
console.error(chalk44.red("\u2717 Failed to delete schedule"));
|
|
10580
10739
|
if (error instanceof Error) {
|
|
10581
10740
|
if (error.message.includes("Not authenticated")) {
|
|
10582
|
-
console.error(
|
|
10741
|
+
console.error(chalk44.dim(" Run: vm0 auth login"));
|
|
10583
10742
|
} else if (error.message.toLowerCase().includes("not found") || error.message.includes("No schedule found")) {
|
|
10584
10743
|
console.error(
|
|
10585
|
-
|
|
10744
|
+
chalk44.dim(` No schedule found for agent "${agentName}"`)
|
|
10586
10745
|
);
|
|
10587
|
-
console.error(
|
|
10746
|
+
console.error(chalk44.dim(" Run: vm0 schedule list"));
|
|
10588
10747
|
} else {
|
|
10589
|
-
console.error(
|
|
10748
|
+
console.error(chalk44.dim(` ${error.message}`));
|
|
10590
10749
|
}
|
|
10591
10750
|
}
|
|
10592
10751
|
process.exit(1);
|
|
@@ -10594,9 +10753,9 @@ var deleteCommand = new Command42().name("delete").alias("rm").description("Dele
|
|
|
10594
10753
|
});
|
|
10595
10754
|
|
|
10596
10755
|
// src/commands/schedule/enable.ts
|
|
10597
|
-
import { Command as
|
|
10598
|
-
import
|
|
10599
|
-
var enableCommand = new
|
|
10756
|
+
import { Command as Command44 } from "commander";
|
|
10757
|
+
import chalk45 from "chalk";
|
|
10758
|
+
var enableCommand = new Command44().name("enable").description("Enable a schedule").argument("<agent-name>", "Agent name").action(async (agentName) => {
|
|
10600
10759
|
try {
|
|
10601
10760
|
const resolved = await resolveScheduleByAgent(agentName);
|
|
10602
10761
|
await enableSchedule({
|
|
@@ -10604,34 +10763,34 @@ var enableCommand = new Command43().name("enable").description("Enable a schedul
|
|
|
10604
10763
|
composeId: resolved.composeId
|
|
10605
10764
|
});
|
|
10606
10765
|
console.log(
|
|
10607
|
-
|
|
10766
|
+
chalk45.green(`\u2713 Enabled schedule for agent ${chalk45.cyan(agentName)}`)
|
|
10608
10767
|
);
|
|
10609
10768
|
} catch (error) {
|
|
10610
|
-
console.error(
|
|
10769
|
+
console.error(chalk45.red("\u2717 Failed to enable schedule"));
|
|
10611
10770
|
if (error instanceof ApiRequestError) {
|
|
10612
10771
|
if (error.code === "SCHEDULE_PAST") {
|
|
10613
|
-
console.error(
|
|
10614
|
-
console.error(
|
|
10772
|
+
console.error(chalk45.dim(" Scheduled time has already passed"));
|
|
10773
|
+
console.error(chalk45.dim(` Run: vm0 schedule setup ${agentName}`));
|
|
10615
10774
|
} else if (error.code === "NOT_FOUND") {
|
|
10616
10775
|
console.error(
|
|
10617
|
-
|
|
10776
|
+
chalk45.dim(` No schedule found for agent "${agentName}"`)
|
|
10618
10777
|
);
|
|
10619
|
-
console.error(
|
|
10778
|
+
console.error(chalk45.dim(" Run: vm0 schedule list"));
|
|
10620
10779
|
} else if (error.code === "UNAUTHORIZED") {
|
|
10621
|
-
console.error(
|
|
10780
|
+
console.error(chalk45.dim(" Run: vm0 auth login"));
|
|
10622
10781
|
} else {
|
|
10623
|
-
console.error(
|
|
10782
|
+
console.error(chalk45.dim(` ${error.message}`));
|
|
10624
10783
|
}
|
|
10625
10784
|
} else if (error instanceof Error) {
|
|
10626
10785
|
if (error.message.includes("Not authenticated")) {
|
|
10627
|
-
console.error(
|
|
10786
|
+
console.error(chalk45.dim(" Run: vm0 auth login"));
|
|
10628
10787
|
} else if (error.message.includes("No schedule found")) {
|
|
10629
10788
|
console.error(
|
|
10630
|
-
|
|
10789
|
+
chalk45.dim(` No schedule found for agent "${agentName}"`)
|
|
10631
10790
|
);
|
|
10632
|
-
console.error(
|
|
10791
|
+
console.error(chalk45.dim(" Run: vm0 schedule list"));
|
|
10633
10792
|
} else {
|
|
10634
|
-
console.error(
|
|
10793
|
+
console.error(chalk45.dim(` ${error.message}`));
|
|
10635
10794
|
}
|
|
10636
10795
|
}
|
|
10637
10796
|
process.exit(1);
|
|
@@ -10639,9 +10798,9 @@ var enableCommand = new Command43().name("enable").description("Enable a schedul
|
|
|
10639
10798
|
});
|
|
10640
10799
|
|
|
10641
10800
|
// src/commands/schedule/disable.ts
|
|
10642
|
-
import { Command as
|
|
10643
|
-
import
|
|
10644
|
-
var disableCommand = new
|
|
10801
|
+
import { Command as Command45 } from "commander";
|
|
10802
|
+
import chalk46 from "chalk";
|
|
10803
|
+
var disableCommand = new Command45().name("disable").description("Disable a schedule").argument("<agent-name>", "Agent name").action(async (agentName) => {
|
|
10645
10804
|
try {
|
|
10646
10805
|
const resolved = await resolveScheduleByAgent(agentName);
|
|
10647
10806
|
await disableSchedule({
|
|
@@ -10649,20 +10808,20 @@ var disableCommand = new Command44().name("disable").description("Disable a sche
|
|
|
10649
10808
|
composeId: resolved.composeId
|
|
10650
10809
|
});
|
|
10651
10810
|
console.log(
|
|
10652
|
-
|
|
10811
|
+
chalk46.green(`\u2713 Disabled schedule for agent ${chalk46.cyan(agentName)}`)
|
|
10653
10812
|
);
|
|
10654
10813
|
} catch (error) {
|
|
10655
|
-
console.error(
|
|
10814
|
+
console.error(chalk46.red("\u2717 Failed to disable schedule"));
|
|
10656
10815
|
if (error instanceof Error) {
|
|
10657
10816
|
if (error.message.includes("Not authenticated")) {
|
|
10658
|
-
console.error(
|
|
10817
|
+
console.error(chalk46.dim(" Run: vm0 auth login"));
|
|
10659
10818
|
} else if (error.message.toLowerCase().includes("not found") || error.message.includes("No schedule found")) {
|
|
10660
10819
|
console.error(
|
|
10661
|
-
|
|
10820
|
+
chalk46.dim(` No schedule found for agent "${agentName}"`)
|
|
10662
10821
|
);
|
|
10663
|
-
console.error(
|
|
10822
|
+
console.error(chalk46.dim(" Run: vm0 schedule list"));
|
|
10664
10823
|
} else {
|
|
10665
|
-
console.error(
|
|
10824
|
+
console.error(chalk46.dim(` ${error.message}`));
|
|
10666
10825
|
}
|
|
10667
10826
|
}
|
|
10668
10827
|
process.exit(1);
|
|
@@ -10670,11 +10829,11 @@ var disableCommand = new Command44().name("disable").description("Disable a sche
|
|
|
10670
10829
|
});
|
|
10671
10830
|
|
|
10672
10831
|
// src/commands/schedule/index.ts
|
|
10673
|
-
var scheduleCommand = new
|
|
10832
|
+
var scheduleCommand = new Command46().name("schedule").description("Manage agent schedules").addCommand(setupCommand).addCommand(listCommand5).addCommand(statusCommand6).addCommand(deleteCommand).addCommand(enableCommand).addCommand(disableCommand);
|
|
10674
10833
|
|
|
10675
10834
|
// src/commands/usage/index.ts
|
|
10676
|
-
import { Command as
|
|
10677
|
-
import
|
|
10835
|
+
import { Command as Command47 } from "commander";
|
|
10836
|
+
import chalk47 from "chalk";
|
|
10678
10837
|
|
|
10679
10838
|
// src/lib/utils/duration-formatter.ts
|
|
10680
10839
|
function formatDuration(ms) {
|
|
@@ -10747,7 +10906,7 @@ function fillMissingDates(daily, startDate, endDate) {
|
|
|
10747
10906
|
result.sort((a, b) => b.date.localeCompare(a.date));
|
|
10748
10907
|
return result;
|
|
10749
10908
|
}
|
|
10750
|
-
var usageCommand = new
|
|
10909
|
+
var usageCommand = new Command47().name("usage").description("View usage statistics").option("--since <date>", "Start date (ISO format or relative: 7d, 30d)").option(
|
|
10751
10910
|
"--until <date>",
|
|
10752
10911
|
"End date (ISO format or relative, defaults to now)"
|
|
10753
10912
|
).action(async (options) => {
|
|
@@ -10761,7 +10920,7 @@ var usageCommand = new Command46().name("usage").description("View usage statist
|
|
|
10761
10920
|
endDate = new Date(untilMs);
|
|
10762
10921
|
} catch {
|
|
10763
10922
|
console.error(
|
|
10764
|
-
|
|
10923
|
+
chalk47.red(
|
|
10765
10924
|
"\u2717 Invalid --until format. Use ISO (2026-01-01) or relative (7d, 30d)"
|
|
10766
10925
|
)
|
|
10767
10926
|
);
|
|
@@ -10776,7 +10935,7 @@ var usageCommand = new Command46().name("usage").description("View usage statist
|
|
|
10776
10935
|
startDate = new Date(sinceMs);
|
|
10777
10936
|
} catch {
|
|
10778
10937
|
console.error(
|
|
10779
|
-
|
|
10938
|
+
chalk47.red(
|
|
10780
10939
|
"\u2717 Invalid --since format. Use ISO (2026-01-01) or relative (7d, 30d)"
|
|
10781
10940
|
)
|
|
10782
10941
|
);
|
|
@@ -10786,13 +10945,13 @@ var usageCommand = new Command46().name("usage").description("View usage statist
|
|
|
10786
10945
|
startDate = new Date(endDate.getTime() - DEFAULT_RANGE_MS);
|
|
10787
10946
|
}
|
|
10788
10947
|
if (startDate >= endDate) {
|
|
10789
|
-
console.error(
|
|
10948
|
+
console.error(chalk47.red("\u2717 --since must be before --until"));
|
|
10790
10949
|
process.exit(1);
|
|
10791
10950
|
}
|
|
10792
10951
|
const rangeMs = endDate.getTime() - startDate.getTime();
|
|
10793
10952
|
if (rangeMs > MAX_RANGE_MS) {
|
|
10794
10953
|
console.error(
|
|
10795
|
-
|
|
10954
|
+
chalk47.red(
|
|
10796
10955
|
"\u2717 Time range exceeds maximum of 30 days. Use --until to specify an end date"
|
|
10797
10956
|
)
|
|
10798
10957
|
);
|
|
@@ -10809,19 +10968,19 @@ var usageCommand = new Command46().name("usage").description("View usage statist
|
|
|
10809
10968
|
);
|
|
10810
10969
|
console.log();
|
|
10811
10970
|
console.log(
|
|
10812
|
-
|
|
10971
|
+
chalk47.bold(
|
|
10813
10972
|
`Usage Summary (${formatDateRange(usage.period.start, usage.period.end)})`
|
|
10814
10973
|
)
|
|
10815
10974
|
);
|
|
10816
10975
|
console.log();
|
|
10817
|
-
console.log(
|
|
10976
|
+
console.log(chalk47.dim("DATE RUNS RUN TIME"));
|
|
10818
10977
|
for (const day of filledDaily) {
|
|
10819
10978
|
const dateDisplay = formatDateDisplay(day.date).padEnd(10);
|
|
10820
10979
|
const runsDisplay = String(day.run_count).padStart(6);
|
|
10821
10980
|
const timeDisplay = formatDuration(day.run_time_ms);
|
|
10822
10981
|
console.log(`${dateDisplay}${runsDisplay} ${timeDisplay}`);
|
|
10823
10982
|
}
|
|
10824
|
-
console.log(
|
|
10983
|
+
console.log(chalk47.dim("\u2500".repeat(29)));
|
|
10825
10984
|
const totalRunsDisplay = String(usage.summary.total_runs).padStart(6);
|
|
10826
10985
|
const totalTimeDisplay = formatDuration(usage.summary.total_run_time_ms);
|
|
10827
10986
|
console.log(
|
|
@@ -10831,68 +10990,68 @@ var usageCommand = new Command46().name("usage").description("View usage statist
|
|
|
10831
10990
|
} catch (error) {
|
|
10832
10991
|
if (error instanceof Error) {
|
|
10833
10992
|
if (error.message.includes("Not authenticated")) {
|
|
10834
|
-
console.error(
|
|
10835
|
-
console.error(
|
|
10993
|
+
console.error(chalk47.red("\u2717 Not authenticated"));
|
|
10994
|
+
console.error(chalk47.dim(" Run: vm0 auth login"));
|
|
10836
10995
|
} else {
|
|
10837
|
-
console.error(
|
|
10996
|
+
console.error(chalk47.red(`\u2717 ${error.message}`));
|
|
10838
10997
|
}
|
|
10839
10998
|
} else {
|
|
10840
|
-
console.error(
|
|
10999
|
+
console.error(chalk47.red("\u2717 An unexpected error occurred"));
|
|
10841
11000
|
}
|
|
10842
11001
|
process.exit(1);
|
|
10843
11002
|
}
|
|
10844
11003
|
});
|
|
10845
11004
|
|
|
10846
11005
|
// src/commands/credential/index.ts
|
|
10847
|
-
import { Command as
|
|
11006
|
+
import { Command as Command51 } from "commander";
|
|
10848
11007
|
|
|
10849
11008
|
// src/commands/credential/list.ts
|
|
10850
|
-
import { Command as
|
|
10851
|
-
import
|
|
10852
|
-
var listCommand6 = new
|
|
11009
|
+
import { Command as Command48 } from "commander";
|
|
11010
|
+
import chalk48 from "chalk";
|
|
11011
|
+
var listCommand6 = new Command48().name("list").alias("ls").description("List all credentials").action(async () => {
|
|
10853
11012
|
try {
|
|
10854
11013
|
const result = await listCredentials();
|
|
10855
11014
|
if (result.credentials.length === 0) {
|
|
10856
|
-
console.log(
|
|
11015
|
+
console.log(chalk48.dim("No credentials found"));
|
|
10857
11016
|
console.log();
|
|
10858
11017
|
console.log("To add a credential:");
|
|
10859
|
-
console.log(
|
|
11018
|
+
console.log(chalk48.cyan(" vm0 credential set MY_API_KEY <value>"));
|
|
10860
11019
|
return;
|
|
10861
11020
|
}
|
|
10862
|
-
console.log(
|
|
11021
|
+
console.log(chalk48.bold("Credentials:"));
|
|
10863
11022
|
console.log();
|
|
10864
11023
|
for (const credential of result.credentials) {
|
|
10865
|
-
const typeIndicator = credential.type === "model-provider" ?
|
|
10866
|
-
console.log(` ${
|
|
11024
|
+
const typeIndicator = credential.type === "model-provider" ? chalk48.dim(" [model-provider]") : "";
|
|
11025
|
+
console.log(` ${chalk48.cyan(credential.name)}${typeIndicator}`);
|
|
10867
11026
|
if (credential.description) {
|
|
10868
|
-
console.log(` ${
|
|
11027
|
+
console.log(` ${chalk48.dim(credential.description)}`);
|
|
10869
11028
|
}
|
|
10870
11029
|
console.log(
|
|
10871
|
-
` ${
|
|
11030
|
+
` ${chalk48.dim(`Updated: ${new Date(credential.updatedAt).toLocaleString()}`)}`
|
|
10872
11031
|
);
|
|
10873
11032
|
console.log();
|
|
10874
11033
|
}
|
|
10875
11034
|
console.log(
|
|
10876
|
-
|
|
11035
|
+
chalk48.dim(`Total: ${result.credentials.length} credential(s)`)
|
|
10877
11036
|
);
|
|
10878
11037
|
} catch (error) {
|
|
10879
11038
|
if (error instanceof Error) {
|
|
10880
11039
|
if (error.message.includes("Not authenticated")) {
|
|
10881
|
-
console.error(
|
|
11040
|
+
console.error(chalk48.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
10882
11041
|
} else {
|
|
10883
|
-
console.error(
|
|
11042
|
+
console.error(chalk48.red(`\u2717 ${error.message}`));
|
|
10884
11043
|
}
|
|
10885
11044
|
} else {
|
|
10886
|
-
console.error(
|
|
11045
|
+
console.error(chalk48.red("\u2717 An unexpected error occurred"));
|
|
10887
11046
|
}
|
|
10888
11047
|
process.exit(1);
|
|
10889
11048
|
}
|
|
10890
11049
|
});
|
|
10891
11050
|
|
|
10892
11051
|
// src/commands/credential/set.ts
|
|
10893
|
-
import { Command as
|
|
10894
|
-
import
|
|
10895
|
-
var setCommand2 = new
|
|
11052
|
+
import { Command as Command49 } from "commander";
|
|
11053
|
+
import chalk49 from "chalk";
|
|
11054
|
+
var setCommand2 = new Command49().name("set").description("Create or update a credential").argument("<name>", "Credential name (uppercase, e.g., MY_API_KEY)").argument("<value>", "Credential value").option("-d, --description <description>", "Optional description").action(
|
|
10896
11055
|
async (name, value, options) => {
|
|
10897
11056
|
try {
|
|
10898
11057
|
const credential = await setCredential({
|
|
@@ -10900,29 +11059,29 @@ var setCommand2 = new Command48().name("set").description("Create or update a cr
|
|
|
10900
11059
|
value,
|
|
10901
11060
|
description: options.description
|
|
10902
11061
|
});
|
|
10903
|
-
console.log(
|
|
11062
|
+
console.log(chalk49.green(`\u2713 Credential "${credential.name}" saved`));
|
|
10904
11063
|
console.log();
|
|
10905
11064
|
console.log("Use in vm0.yaml:");
|
|
10906
|
-
console.log(
|
|
10907
|
-
console.log(
|
|
11065
|
+
console.log(chalk49.cyan(` environment:`));
|
|
11066
|
+
console.log(chalk49.cyan(` ${name}: \${{ credentials.${name} }}`));
|
|
10908
11067
|
} catch (error) {
|
|
10909
11068
|
if (error instanceof Error) {
|
|
10910
11069
|
if (error.message.includes("Not authenticated")) {
|
|
10911
11070
|
console.error(
|
|
10912
|
-
|
|
11071
|
+
chalk49.red("\u2717 Not authenticated. Run: vm0 auth login")
|
|
10913
11072
|
);
|
|
10914
11073
|
} else if (error.message.includes("must contain only uppercase")) {
|
|
10915
|
-
console.error(
|
|
11074
|
+
console.error(chalk49.red(`\u2717 ${error.message}`));
|
|
10916
11075
|
console.log();
|
|
10917
11076
|
console.log("Examples of valid credential names:");
|
|
10918
|
-
console.log(
|
|
10919
|
-
console.log(
|
|
10920
|
-
console.log(
|
|
11077
|
+
console.log(chalk49.dim(" MY_API_KEY"));
|
|
11078
|
+
console.log(chalk49.dim(" GITHUB_TOKEN"));
|
|
11079
|
+
console.log(chalk49.dim(" AWS_ACCESS_KEY_ID"));
|
|
10921
11080
|
} else {
|
|
10922
|
-
console.error(
|
|
11081
|
+
console.error(chalk49.red(`\u2717 ${error.message}`));
|
|
10923
11082
|
}
|
|
10924
11083
|
} else {
|
|
10925
|
-
console.error(
|
|
11084
|
+
console.error(chalk49.red("\u2717 An unexpected error occurred"));
|
|
10926
11085
|
}
|
|
10927
11086
|
process.exit(1);
|
|
10928
11087
|
}
|
|
@@ -10930,20 +11089,20 @@ var setCommand2 = new Command48().name("set").description("Create or update a cr
|
|
|
10930
11089
|
);
|
|
10931
11090
|
|
|
10932
11091
|
// src/commands/credential/delete.ts
|
|
10933
|
-
import { Command as
|
|
10934
|
-
import
|
|
10935
|
-
var deleteCommand2 = new
|
|
11092
|
+
import { Command as Command50 } from "commander";
|
|
11093
|
+
import chalk50 from "chalk";
|
|
11094
|
+
var deleteCommand2 = new Command50().name("delete").description("Delete a credential").argument("<name>", "Credential name to delete").option("-y, --yes", "Skip confirmation prompt").action(async (name, options) => {
|
|
10936
11095
|
try {
|
|
10937
11096
|
try {
|
|
10938
11097
|
await getCredential(name);
|
|
10939
11098
|
} catch {
|
|
10940
|
-
console.error(
|
|
11099
|
+
console.error(chalk50.red(`\u2717 Credential "${name}" not found`));
|
|
10941
11100
|
process.exit(1);
|
|
10942
11101
|
}
|
|
10943
11102
|
if (!options.yes) {
|
|
10944
11103
|
if (!isInteractive()) {
|
|
10945
11104
|
console.error(
|
|
10946
|
-
|
|
11105
|
+
chalk50.red("\u2717 --yes flag is required in non-interactive mode")
|
|
10947
11106
|
);
|
|
10948
11107
|
process.exit(1);
|
|
10949
11108
|
}
|
|
@@ -10952,43 +11111,43 @@ var deleteCommand2 = new Command49().name("delete").description("Delete a creden
|
|
|
10952
11111
|
false
|
|
10953
11112
|
);
|
|
10954
11113
|
if (!confirmed) {
|
|
10955
|
-
console.log(
|
|
11114
|
+
console.log(chalk50.dim("Cancelled"));
|
|
10956
11115
|
return;
|
|
10957
11116
|
}
|
|
10958
11117
|
}
|
|
10959
11118
|
await deleteCredential(name);
|
|
10960
|
-
console.log(
|
|
11119
|
+
console.log(chalk50.green(`\u2713 Credential "${name}" deleted`));
|
|
10961
11120
|
} catch (error) {
|
|
10962
11121
|
if (error instanceof Error) {
|
|
10963
11122
|
if (error.message.includes("Not authenticated")) {
|
|
10964
|
-
console.error(
|
|
11123
|
+
console.error(chalk50.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
10965
11124
|
} else {
|
|
10966
|
-
console.error(
|
|
11125
|
+
console.error(chalk50.red(`\u2717 ${error.message}`));
|
|
10967
11126
|
}
|
|
10968
11127
|
} else {
|
|
10969
|
-
console.error(
|
|
11128
|
+
console.error(chalk50.red("\u2717 An unexpected error occurred"));
|
|
10970
11129
|
}
|
|
10971
11130
|
process.exit(1);
|
|
10972
11131
|
}
|
|
10973
11132
|
});
|
|
10974
11133
|
|
|
10975
11134
|
// src/commands/credential/index.ts
|
|
10976
|
-
var credentialCommand = new
|
|
11135
|
+
var credentialCommand = new Command51().name("credential").description("Manage stored credentials for agent runs").addCommand(listCommand6).addCommand(setCommand2).addCommand(deleteCommand2);
|
|
10977
11136
|
|
|
10978
11137
|
// src/commands/model-provider/index.ts
|
|
10979
|
-
import { Command as
|
|
11138
|
+
import { Command as Command56 } from "commander";
|
|
10980
11139
|
|
|
10981
11140
|
// src/commands/model-provider/list.ts
|
|
10982
|
-
import { Command as
|
|
10983
|
-
import
|
|
10984
|
-
var listCommand7 = new
|
|
11141
|
+
import { Command as Command52 } from "commander";
|
|
11142
|
+
import chalk51 from "chalk";
|
|
11143
|
+
var listCommand7 = new Command52().name("list").alias("ls").description("List all model providers").action(async () => {
|
|
10985
11144
|
try {
|
|
10986
11145
|
const result = await listModelProviders();
|
|
10987
11146
|
if (result.modelProviders.length === 0) {
|
|
10988
|
-
console.log(
|
|
11147
|
+
console.log(chalk51.dim("No model providers configured"));
|
|
10989
11148
|
console.log();
|
|
10990
11149
|
console.log("To add a model provider:");
|
|
10991
|
-
console.log(
|
|
11150
|
+
console.log(chalk51.cyan(" vm0 model-provider setup"));
|
|
10992
11151
|
return;
|
|
10993
11152
|
}
|
|
10994
11153
|
const byFramework = result.modelProviders.reduce(
|
|
@@ -11002,16 +11161,16 @@ var listCommand7 = new Command51().name("list").alias("ls").description("List al
|
|
|
11002
11161
|
},
|
|
11003
11162
|
{}
|
|
11004
11163
|
);
|
|
11005
|
-
console.log(
|
|
11164
|
+
console.log(chalk51.bold("Model Providers:"));
|
|
11006
11165
|
console.log();
|
|
11007
11166
|
for (const [framework, providers] of Object.entries(byFramework)) {
|
|
11008
|
-
console.log(` ${
|
|
11167
|
+
console.log(` ${chalk51.cyan(framework)}:`);
|
|
11009
11168
|
for (const provider of providers) {
|
|
11010
|
-
const defaultTag = provider.isDefault ?
|
|
11011
|
-
const modelTag = provider.selectedModel ?
|
|
11169
|
+
const defaultTag = provider.isDefault ? chalk51.green(" (default)") : "";
|
|
11170
|
+
const modelTag = provider.selectedModel ? chalk51.dim(` [${provider.selectedModel}]`) : "";
|
|
11012
11171
|
console.log(` ${provider.type}${defaultTag}${modelTag}`);
|
|
11013
11172
|
console.log(
|
|
11014
|
-
|
|
11173
|
+
chalk51.dim(
|
|
11015
11174
|
` Updated: ${new Date(provider.updatedAt).toLocaleString()}`
|
|
11016
11175
|
)
|
|
11017
11176
|
);
|
|
@@ -11019,33 +11178,33 @@ var listCommand7 = new Command51().name("list").alias("ls").description("List al
|
|
|
11019
11178
|
console.log();
|
|
11020
11179
|
}
|
|
11021
11180
|
console.log(
|
|
11022
|
-
|
|
11181
|
+
chalk51.dim(`Total: ${result.modelProviders.length} provider(s)`)
|
|
11023
11182
|
);
|
|
11024
11183
|
} catch (error) {
|
|
11025
11184
|
if (error instanceof Error) {
|
|
11026
11185
|
if (error.message.includes("Not authenticated")) {
|
|
11027
|
-
console.error(
|
|
11186
|
+
console.error(chalk51.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
11028
11187
|
} else {
|
|
11029
|
-
console.error(
|
|
11188
|
+
console.error(chalk51.red(`\u2717 ${error.message}`));
|
|
11030
11189
|
}
|
|
11031
11190
|
} else {
|
|
11032
|
-
console.error(
|
|
11191
|
+
console.error(chalk51.red("\u2717 An unexpected error occurred"));
|
|
11033
11192
|
}
|
|
11034
11193
|
process.exit(1);
|
|
11035
11194
|
}
|
|
11036
11195
|
});
|
|
11037
11196
|
|
|
11038
11197
|
// src/commands/model-provider/setup.ts
|
|
11039
|
-
import { Command as
|
|
11040
|
-
import
|
|
11198
|
+
import { Command as Command53 } from "commander";
|
|
11199
|
+
import chalk52 from "chalk";
|
|
11041
11200
|
import prompts2 from "prompts";
|
|
11042
11201
|
function validateProviderType(typeStr) {
|
|
11043
11202
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(typeStr)) {
|
|
11044
|
-
console.error(
|
|
11203
|
+
console.error(chalk52.red(`\u2717 Invalid type "${typeStr}"`));
|
|
11045
11204
|
console.log();
|
|
11046
11205
|
console.log("Valid types:");
|
|
11047
11206
|
for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
|
|
11048
|
-
console.log(` ${
|
|
11207
|
+
console.log(` ${chalk52.cyan(t)} - ${config.label}`);
|
|
11049
11208
|
}
|
|
11050
11209
|
process.exit(1);
|
|
11051
11210
|
}
|
|
@@ -11054,11 +11213,11 @@ function validateProviderType(typeStr) {
|
|
|
11054
11213
|
function validateModel(type, modelStr) {
|
|
11055
11214
|
const models = getModels(type);
|
|
11056
11215
|
if (models && !models.includes(modelStr)) {
|
|
11057
|
-
console.error(
|
|
11216
|
+
console.error(chalk52.red(`\u2717 Invalid model "${modelStr}"`));
|
|
11058
11217
|
console.log();
|
|
11059
11218
|
console.log("Valid models:");
|
|
11060
11219
|
for (const m of models) {
|
|
11061
|
-
console.log(` ${
|
|
11220
|
+
console.log(` ${chalk52.cyan(m)}`);
|
|
11062
11221
|
}
|
|
11063
11222
|
process.exit(1);
|
|
11064
11223
|
}
|
|
@@ -11073,7 +11232,12 @@ function handleNonInteractiveMode(options) {
|
|
|
11073
11232
|
const defaultModel = getDefaultModel(type);
|
|
11074
11233
|
selectedModel = defaultModel || void 0;
|
|
11075
11234
|
}
|
|
11076
|
-
return {
|
|
11235
|
+
return {
|
|
11236
|
+
type,
|
|
11237
|
+
credential: options.credential,
|
|
11238
|
+
selectedModel,
|
|
11239
|
+
isInteractiveMode: false
|
|
11240
|
+
};
|
|
11077
11241
|
}
|
|
11078
11242
|
async function promptForModelSelection(type) {
|
|
11079
11243
|
if (!hasModelSelection(type)) {
|
|
@@ -11102,11 +11266,11 @@ async function promptForModelSelection(type) {
|
|
|
11102
11266
|
}
|
|
11103
11267
|
async function handleInteractiveMode() {
|
|
11104
11268
|
if (!isInteractive()) {
|
|
11105
|
-
console.error(
|
|
11269
|
+
console.error(chalk52.red("\u2717 Interactive mode requires a TTY"));
|
|
11106
11270
|
console.log();
|
|
11107
11271
|
console.log("Use non-interactive mode:");
|
|
11108
11272
|
console.log(
|
|
11109
|
-
|
|
11273
|
+
chalk52.cyan(
|
|
11110
11274
|
' vm0 model-provider setup --type <type> --credential "<value>"'
|
|
11111
11275
|
)
|
|
11112
11276
|
);
|
|
@@ -11145,13 +11309,14 @@ async function handleInteractiveMode() {
|
|
|
11145
11309
|
const provider = await convertModelProviderCredential(type);
|
|
11146
11310
|
const defaultNote = provider.isDefault ? ` (default for ${provider.framework})` : "";
|
|
11147
11311
|
console.log(
|
|
11148
|
-
|
|
11312
|
+
chalk52.green(
|
|
11149
11313
|
`\u2713 Converted "${checkResult.credentialName}" to model provider${defaultNote}`
|
|
11150
11314
|
)
|
|
11151
11315
|
);
|
|
11316
|
+
await promptSetAsDefault(type, provider.framework, provider.isDefault);
|
|
11152
11317
|
return null;
|
|
11153
11318
|
}
|
|
11154
|
-
console.log(
|
|
11319
|
+
console.log(chalk52.dim("Aborted"));
|
|
11155
11320
|
process.exit(0);
|
|
11156
11321
|
}
|
|
11157
11322
|
if (checkResult.exists && checkResult.currentType === "model-provider") {
|
|
@@ -11172,12 +11337,17 @@ async function handleInteractiveMode() {
|
|
|
11172
11337
|
);
|
|
11173
11338
|
if (actionResponse.action === "keep") {
|
|
11174
11339
|
const selectedModel2 = await promptForModelSelection(type);
|
|
11175
|
-
return {
|
|
11340
|
+
return {
|
|
11341
|
+
type,
|
|
11342
|
+
keepExistingCredential: true,
|
|
11343
|
+
selectedModel: selectedModel2,
|
|
11344
|
+
isInteractiveMode: true
|
|
11345
|
+
};
|
|
11176
11346
|
}
|
|
11177
11347
|
}
|
|
11178
11348
|
const config = MODEL_PROVIDER_TYPES[type];
|
|
11179
11349
|
console.log();
|
|
11180
|
-
console.log(
|
|
11350
|
+
console.log(chalk52.dim(config.helpText));
|
|
11181
11351
|
console.log();
|
|
11182
11352
|
const credentialResponse = await prompts2(
|
|
11183
11353
|
{
|
|
@@ -11190,26 +11360,42 @@ async function handleInteractiveMode() {
|
|
|
11190
11360
|
);
|
|
11191
11361
|
const credential = credentialResponse.credential;
|
|
11192
11362
|
const selectedModel = await promptForModelSelection(type);
|
|
11193
|
-
return { type, credential, selectedModel };
|
|
11363
|
+
return { type, credential, selectedModel, isInteractiveMode: true };
|
|
11194
11364
|
}
|
|
11195
11365
|
function handleSetupError2(error) {
|
|
11196
11366
|
if (error instanceof Error) {
|
|
11197
11367
|
if (error.message.includes("already exists")) {
|
|
11198
|
-
console.error(
|
|
11368
|
+
console.error(chalk52.red(`\u2717 ${error.message}`));
|
|
11199
11369
|
console.log();
|
|
11200
11370
|
console.log("To convert the existing credential, run:");
|
|
11201
|
-
console.log(
|
|
11371
|
+
console.log(chalk52.cyan(" vm0 model-provider setup --convert"));
|
|
11202
11372
|
} else if (error.message.includes("Not authenticated")) {
|
|
11203
|
-
console.error(
|
|
11373
|
+
console.error(chalk52.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
11204
11374
|
} else {
|
|
11205
|
-
console.error(
|
|
11375
|
+
console.error(chalk52.red(`\u2717 ${error.message}`));
|
|
11206
11376
|
}
|
|
11207
11377
|
} else {
|
|
11208
|
-
console.error(
|
|
11378
|
+
console.error(chalk52.red("\u2717 An unexpected error occurred"));
|
|
11209
11379
|
}
|
|
11210
11380
|
process.exit(1);
|
|
11211
11381
|
}
|
|
11212
|
-
|
|
11382
|
+
async function promptSetAsDefault(type, framework, isDefault) {
|
|
11383
|
+
if (isDefault) return;
|
|
11384
|
+
const response = await prompts2(
|
|
11385
|
+
{
|
|
11386
|
+
type: "confirm",
|
|
11387
|
+
name: "setDefault",
|
|
11388
|
+
message: "Set this provider as default?",
|
|
11389
|
+
initial: false
|
|
11390
|
+
},
|
|
11391
|
+
{ onCancel: () => process.exit(0) }
|
|
11392
|
+
);
|
|
11393
|
+
if (response.setDefault) {
|
|
11394
|
+
await setModelProviderDefault(type);
|
|
11395
|
+
console.log(chalk52.green(`\u2713 Default for ${framework} set to "${type}"`));
|
|
11396
|
+
}
|
|
11397
|
+
}
|
|
11398
|
+
var setupCommand2 = new Command53().name("setup").description("Configure a model provider").option("-t, --type <type>", "Provider type (for non-interactive mode)").option(
|
|
11213
11399
|
"-c, --credential <credential>",
|
|
11214
11400
|
"Credential value (for non-interactive mode)"
|
|
11215
11401
|
).option("-m, --model <model>", "Model selection (for non-interactive mode)").option("--convert", "Convert existing user credential to model provider").action(
|
|
@@ -11225,7 +11411,7 @@ var setupCommand2 = new Command52().name("setup").description("Configure a model
|
|
|
11225
11411
|
});
|
|
11226
11412
|
} else if (options.type || options.credential) {
|
|
11227
11413
|
console.error(
|
|
11228
|
-
|
|
11414
|
+
chalk52.red("\u2717 Both --type and --credential are required")
|
|
11229
11415
|
);
|
|
11230
11416
|
process.exit(1);
|
|
11231
11417
|
} else {
|
|
@@ -11244,15 +11430,22 @@ var setupCommand2 = new Command52().name("setup").description("Configure a model
|
|
|
11244
11430
|
const modelNote2 = provider2.selectedModel ? ` with model: ${provider2.selectedModel}` : "";
|
|
11245
11431
|
if (!hasModelSelection(input.type)) {
|
|
11246
11432
|
console.log(
|
|
11247
|
-
|
|
11433
|
+
chalk52.green(`\u2713 Model provider "${input.type}" unchanged`)
|
|
11248
11434
|
);
|
|
11249
11435
|
} else {
|
|
11250
11436
|
console.log(
|
|
11251
|
-
|
|
11437
|
+
chalk52.green(
|
|
11252
11438
|
`\u2713 Model provider "${input.type}" updated${defaultNote2}${modelNote2}`
|
|
11253
11439
|
)
|
|
11254
11440
|
);
|
|
11255
11441
|
}
|
|
11442
|
+
if (input.isInteractiveMode) {
|
|
11443
|
+
await promptSetAsDefault(
|
|
11444
|
+
input.type,
|
|
11445
|
+
provider2.framework,
|
|
11446
|
+
provider2.isDefault
|
|
11447
|
+
);
|
|
11448
|
+
}
|
|
11256
11449
|
return;
|
|
11257
11450
|
}
|
|
11258
11451
|
const { provider, created } = await upsertModelProvider({
|
|
@@ -11265,10 +11458,17 @@ var setupCommand2 = new Command52().name("setup").description("Configure a model
|
|
|
11265
11458
|
const defaultNote = provider.isDefault ? ` (default for ${provider.framework})` : "";
|
|
11266
11459
|
const modelNote = provider.selectedModel ? ` with model: ${provider.selectedModel}` : "";
|
|
11267
11460
|
console.log(
|
|
11268
|
-
|
|
11461
|
+
chalk52.green(
|
|
11269
11462
|
`\u2713 Model provider "${input.type}" ${action}${defaultNote}${modelNote}`
|
|
11270
11463
|
)
|
|
11271
11464
|
);
|
|
11465
|
+
if (input.isInteractiveMode) {
|
|
11466
|
+
await promptSetAsDefault(
|
|
11467
|
+
input.type,
|
|
11468
|
+
provider.framework,
|
|
11469
|
+
provider.isDefault
|
|
11470
|
+
);
|
|
11471
|
+
}
|
|
11272
11472
|
} catch (error) {
|
|
11273
11473
|
handleSetupError2(error);
|
|
11274
11474
|
}
|
|
@@ -11276,96 +11476,96 @@ var setupCommand2 = new Command52().name("setup").description("Configure a model
|
|
|
11276
11476
|
);
|
|
11277
11477
|
|
|
11278
11478
|
// src/commands/model-provider/delete.ts
|
|
11279
|
-
import { Command as
|
|
11280
|
-
import
|
|
11281
|
-
var deleteCommand3 = new
|
|
11479
|
+
import { Command as Command54 } from "commander";
|
|
11480
|
+
import chalk53 from "chalk";
|
|
11481
|
+
var deleteCommand3 = new Command54().name("delete").description("Delete a model provider").argument("<type>", "Model provider type to delete").action(async (type) => {
|
|
11282
11482
|
try {
|
|
11283
11483
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type)) {
|
|
11284
|
-
console.error(
|
|
11484
|
+
console.error(chalk53.red(`\u2717 Invalid type "${type}"`));
|
|
11285
11485
|
console.log();
|
|
11286
11486
|
console.log("Valid types:");
|
|
11287
11487
|
for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
|
|
11288
|
-
console.log(` ${
|
|
11488
|
+
console.log(` ${chalk53.cyan(t)} - ${config.label}`);
|
|
11289
11489
|
}
|
|
11290
11490
|
process.exit(1);
|
|
11291
11491
|
}
|
|
11292
11492
|
await deleteModelProvider(type);
|
|
11293
|
-
console.log(
|
|
11493
|
+
console.log(chalk53.green(`\u2713 Model provider "${type}" deleted`));
|
|
11294
11494
|
} catch (error) {
|
|
11295
11495
|
if (error instanceof Error) {
|
|
11296
11496
|
if (error.message.includes("not found")) {
|
|
11297
|
-
console.error(
|
|
11497
|
+
console.error(chalk53.red(`\u2717 Model provider "${type}" not found`));
|
|
11298
11498
|
} else if (error.message.includes("Not authenticated")) {
|
|
11299
|
-
console.error(
|
|
11499
|
+
console.error(chalk53.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
11300
11500
|
} else {
|
|
11301
|
-
console.error(
|
|
11501
|
+
console.error(chalk53.red(`\u2717 ${error.message}`));
|
|
11302
11502
|
}
|
|
11303
11503
|
} else {
|
|
11304
|
-
console.error(
|
|
11504
|
+
console.error(chalk53.red("\u2717 An unexpected error occurred"));
|
|
11305
11505
|
}
|
|
11306
11506
|
process.exit(1);
|
|
11307
11507
|
}
|
|
11308
11508
|
});
|
|
11309
11509
|
|
|
11310
11510
|
// src/commands/model-provider/set-default.ts
|
|
11311
|
-
import { Command as
|
|
11312
|
-
import
|
|
11313
|
-
var setDefaultCommand = new
|
|
11511
|
+
import { Command as Command55 } from "commander";
|
|
11512
|
+
import chalk54 from "chalk";
|
|
11513
|
+
var setDefaultCommand = new Command55().name("set-default").description("Set a model provider as default for its framework").argument("<type>", "Model provider type to set as default").action(async (type) => {
|
|
11314
11514
|
try {
|
|
11315
11515
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type)) {
|
|
11316
|
-
console.error(
|
|
11516
|
+
console.error(chalk54.red(`\u2717 Invalid type "${type}"`));
|
|
11317
11517
|
console.log();
|
|
11318
11518
|
console.log("Valid types:");
|
|
11319
11519
|
for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
|
|
11320
|
-
console.log(` ${
|
|
11520
|
+
console.log(` ${chalk54.cyan(t)} - ${config.label}`);
|
|
11321
11521
|
}
|
|
11322
11522
|
process.exit(1);
|
|
11323
11523
|
}
|
|
11324
11524
|
const provider = await setModelProviderDefault(type);
|
|
11325
11525
|
console.log(
|
|
11326
|
-
|
|
11526
|
+
chalk54.green(
|
|
11327
11527
|
`\u2713 Default for ${provider.framework} set to "${provider.type}"`
|
|
11328
11528
|
)
|
|
11329
11529
|
);
|
|
11330
11530
|
} catch (error) {
|
|
11331
11531
|
if (error instanceof Error) {
|
|
11332
11532
|
if (error.message.includes("not found")) {
|
|
11333
|
-
console.error(
|
|
11533
|
+
console.error(chalk54.red(`\u2717 Model provider "${type}" not found`));
|
|
11334
11534
|
} else if (error.message.includes("Not authenticated")) {
|
|
11335
|
-
console.error(
|
|
11535
|
+
console.error(chalk54.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
11336
11536
|
} else {
|
|
11337
|
-
console.error(
|
|
11537
|
+
console.error(chalk54.red(`\u2717 ${error.message}`));
|
|
11338
11538
|
}
|
|
11339
11539
|
} else {
|
|
11340
|
-
console.error(
|
|
11540
|
+
console.error(chalk54.red("\u2717 An unexpected error occurred"));
|
|
11341
11541
|
}
|
|
11342
11542
|
process.exit(1);
|
|
11343
11543
|
}
|
|
11344
11544
|
});
|
|
11345
11545
|
|
|
11346
11546
|
// src/commands/model-provider/index.ts
|
|
11347
|
-
var modelProviderCommand = new
|
|
11547
|
+
var modelProviderCommand = new Command56().name("model-provider").description("Manage model providers for agent runs").addCommand(listCommand7).addCommand(setupCommand2).addCommand(deleteCommand3).addCommand(setDefaultCommand);
|
|
11348
11548
|
|
|
11349
11549
|
// src/commands/onboard/index.ts
|
|
11350
|
-
import { Command as
|
|
11351
|
-
import
|
|
11352
|
-
import { mkdir as
|
|
11353
|
-
import { existsSync as
|
|
11550
|
+
import { Command as Command57 } from "commander";
|
|
11551
|
+
import chalk58 from "chalk";
|
|
11552
|
+
import { mkdir as mkdir8 } from "fs/promises";
|
|
11553
|
+
import { existsSync as existsSync12 } from "fs";
|
|
11354
11554
|
|
|
11355
11555
|
// src/lib/ui/welcome-box.ts
|
|
11356
|
-
import
|
|
11556
|
+
import chalk55 from "chalk";
|
|
11357
11557
|
var gradientColors = [
|
|
11358
|
-
|
|
11558
|
+
chalk55.hex("#FFAB5E"),
|
|
11359
11559
|
// Line 1 - lightest
|
|
11360
|
-
|
|
11560
|
+
chalk55.hex("#FF9642"),
|
|
11361
11561
|
// Line 2
|
|
11362
|
-
|
|
11562
|
+
chalk55.hex("#FF8228"),
|
|
11363
11563
|
// Line 3
|
|
11364
|
-
|
|
11564
|
+
chalk55.hex("#FF6D0A"),
|
|
11365
11565
|
// Line 4
|
|
11366
|
-
|
|
11566
|
+
chalk55.hex("#E85D00"),
|
|
11367
11567
|
// Line 5
|
|
11368
|
-
|
|
11568
|
+
chalk55.hex("#CC4E00")
|
|
11369
11569
|
// Line 6 - darkest
|
|
11370
11570
|
];
|
|
11371
11571
|
var vm0LogoLines = [
|
|
@@ -11387,15 +11587,15 @@ function renderVm0Banner() {
|
|
|
11387
11587
|
function renderOnboardWelcome() {
|
|
11388
11588
|
renderVm0Banner();
|
|
11389
11589
|
console.log(` Build agentic workflows using natural language.`);
|
|
11390
|
-
console.log(` ${
|
|
11590
|
+
console.log(` ${chalk55.dim("Currently in beta, enjoy it free.")}`);
|
|
11391
11591
|
console.log(
|
|
11392
|
-
` ${
|
|
11592
|
+
` ${chalk55.dim("Star us on GitHub: https://github.com/vm0-ai/vm0")}`
|
|
11393
11593
|
);
|
|
11394
11594
|
console.log();
|
|
11395
11595
|
}
|
|
11396
11596
|
|
|
11397
11597
|
// src/lib/ui/step-runner.ts
|
|
11398
|
-
import
|
|
11598
|
+
import chalk56 from "chalk";
|
|
11399
11599
|
function createStepRunner(options = true) {
|
|
11400
11600
|
const opts = typeof options === "boolean" ? { interactive: options } : options;
|
|
11401
11601
|
const interactive = opts.interactive ?? true;
|
|
@@ -11410,25 +11610,25 @@ function createStepRunner(options = true) {
|
|
|
11410
11610
|
}
|
|
11411
11611
|
for (const [i, step] of completedSteps.entries()) {
|
|
11412
11612
|
if (step.failed) {
|
|
11413
|
-
console.log(
|
|
11613
|
+
console.log(chalk56.red(`\u2717 ${step.label}`));
|
|
11414
11614
|
} else {
|
|
11415
|
-
console.log(
|
|
11615
|
+
console.log(chalk56.green(`\u25CF ${step.label}`));
|
|
11416
11616
|
}
|
|
11417
11617
|
const isLastStep = i === completedSteps.length - 1;
|
|
11418
11618
|
if (!isLastStep || !isFinal) {
|
|
11419
|
-
console.log(
|
|
11619
|
+
console.log(chalk56.dim("\u2502"));
|
|
11420
11620
|
}
|
|
11421
11621
|
}
|
|
11422
11622
|
}
|
|
11423
11623
|
async function executeStep(label, fn, isFinal) {
|
|
11424
11624
|
let stepFailed = false;
|
|
11425
|
-
console.log(
|
|
11625
|
+
console.log(chalk56.yellow(`\u25CB ${label}`));
|
|
11426
11626
|
const ctx = {
|
|
11427
11627
|
connector() {
|
|
11428
|
-
console.log(
|
|
11628
|
+
console.log(chalk56.dim("\u2502"));
|
|
11429
11629
|
},
|
|
11430
11630
|
detail(message) {
|
|
11431
|
-
console.log(`${
|
|
11631
|
+
console.log(`${chalk56.dim("\u2502")} ${message}`);
|
|
11432
11632
|
},
|
|
11433
11633
|
async prompt(promptFn) {
|
|
11434
11634
|
return await promptFn();
|
|
@@ -11445,12 +11645,12 @@ function createStepRunner(options = true) {
|
|
|
11445
11645
|
redrawCompletedSteps(isFinal);
|
|
11446
11646
|
} else {
|
|
11447
11647
|
if (stepFailed) {
|
|
11448
|
-
console.log(
|
|
11648
|
+
console.log(chalk56.red(`\u2717 ${label}`));
|
|
11449
11649
|
} else {
|
|
11450
|
-
console.log(
|
|
11650
|
+
console.log(chalk56.green(`\u25CF ${label}`));
|
|
11451
11651
|
}
|
|
11452
11652
|
if (!isFinal) {
|
|
11453
|
-
console.log(
|
|
11653
|
+
console.log(chalk56.dim("\u2502"));
|
|
11454
11654
|
}
|
|
11455
11655
|
}
|
|
11456
11656
|
}
|
|
@@ -11599,7 +11799,7 @@ async function setupModelProvider(type, credential, options) {
|
|
|
11599
11799
|
|
|
11600
11800
|
// src/lib/domain/onboard/claude-setup.ts
|
|
11601
11801
|
import { spawn as spawn3 } from "child_process";
|
|
11602
|
-
import
|
|
11802
|
+
import chalk57 from "chalk";
|
|
11603
11803
|
var MARKETPLACE_NAME = "vm0-skills";
|
|
11604
11804
|
var MARKETPLACE_REPO = "vm0-ai/vm0-skills";
|
|
11605
11805
|
var PLUGIN_ID = "vm0@vm0-skills";
|
|
@@ -11637,12 +11837,12 @@ async function runClaudeCommand(args, cwd) {
|
|
|
11637
11837
|
}
|
|
11638
11838
|
function handlePluginError(error, context) {
|
|
11639
11839
|
const displayContext = context ?? "Claude plugin";
|
|
11640
|
-
console.error(
|
|
11840
|
+
console.error(chalk57.red(`Failed to install ${displayContext}`));
|
|
11641
11841
|
if (error instanceof Error) {
|
|
11642
|
-
console.error(
|
|
11842
|
+
console.error(chalk57.red(error.message));
|
|
11643
11843
|
}
|
|
11644
11844
|
console.error(
|
|
11645
|
-
|
|
11845
|
+
chalk57.dim("Please ensure Claude CLI is installed and accessible.")
|
|
11646
11846
|
);
|
|
11647
11847
|
process.exit(1);
|
|
11648
11848
|
}
|
|
@@ -11685,7 +11885,7 @@ async function updateMarketplace() {
|
|
|
11685
11885
|
]);
|
|
11686
11886
|
if (!result.success) {
|
|
11687
11887
|
console.warn(
|
|
11688
|
-
|
|
11888
|
+
chalk57.yellow(
|
|
11689
11889
|
`Warning: Could not update marketplace: ${result.error ?? "unknown error"}`
|
|
11690
11890
|
)
|
|
11691
11891
|
);
|
|
@@ -11723,7 +11923,7 @@ async function handleAuthentication(ctx) {
|
|
|
11723
11923
|
return;
|
|
11724
11924
|
}
|
|
11725
11925
|
if (!ctx.interactive) {
|
|
11726
|
-
console.error(
|
|
11926
|
+
console.error(chalk58.red("Error: Not authenticated"));
|
|
11727
11927
|
console.error("Run 'vm0 auth login' first or set VM0_TOKEN");
|
|
11728
11928
|
process.exit(1);
|
|
11729
11929
|
}
|
|
@@ -11731,16 +11931,16 @@ async function handleAuthentication(ctx) {
|
|
|
11731
11931
|
onInitiating: () => {
|
|
11732
11932
|
},
|
|
11733
11933
|
onDeviceCodeReady: (url, code, expiresIn) => {
|
|
11734
|
-
step.detail(`Copy code: ${
|
|
11735
|
-
step.detail(`Open: ${
|
|
11736
|
-
step.detail(
|
|
11934
|
+
step.detail(`Copy code: ${chalk58.cyan.bold(code)}`);
|
|
11935
|
+
step.detail(`Open: ${chalk58.cyan(url)}`);
|
|
11936
|
+
step.detail(chalk58.dim(`Expires in ${expiresIn} minutes`));
|
|
11737
11937
|
},
|
|
11738
11938
|
onPolling: () => {
|
|
11739
11939
|
},
|
|
11740
11940
|
onSuccess: () => {
|
|
11741
11941
|
},
|
|
11742
11942
|
onError: (error) => {
|
|
11743
|
-
console.error(
|
|
11943
|
+
console.error(chalk58.red(`
|
|
11744
11944
|
${error.message}`));
|
|
11745
11945
|
process.exit(1);
|
|
11746
11946
|
}
|
|
@@ -11754,7 +11954,7 @@ async function handleModelProvider(ctx) {
|
|
|
11754
11954
|
return;
|
|
11755
11955
|
}
|
|
11756
11956
|
if (!ctx.interactive) {
|
|
11757
|
-
console.error(
|
|
11957
|
+
console.error(chalk58.red("Error: No model provider configured"));
|
|
11758
11958
|
console.error("Run 'vm0 model-provider setup' first");
|
|
11759
11959
|
process.exit(1);
|
|
11760
11960
|
}
|
|
@@ -11763,19 +11963,19 @@ async function handleModelProvider(ctx) {
|
|
|
11763
11963
|
const providerType = await step.prompt(
|
|
11764
11964
|
() => promptSelect(
|
|
11765
11965
|
"Select provider type:",
|
|
11766
|
-
choices.map((
|
|
11767
|
-
title:
|
|
11768
|
-
value:
|
|
11966
|
+
choices.map((c21) => ({
|
|
11967
|
+
title: c21.label,
|
|
11968
|
+
value: c21.type
|
|
11769
11969
|
}))
|
|
11770
11970
|
)
|
|
11771
11971
|
);
|
|
11772
11972
|
if (!providerType) {
|
|
11773
11973
|
process.exit(0);
|
|
11774
11974
|
}
|
|
11775
|
-
const selectedChoice = choices.find((
|
|
11975
|
+
const selectedChoice = choices.find((c21) => c21.type === providerType);
|
|
11776
11976
|
if (selectedChoice?.helpText) {
|
|
11777
11977
|
for (const line of selectedChoice.helpText.split("\n")) {
|
|
11778
|
-
step.detail(
|
|
11978
|
+
step.detail(chalk58.dim(line));
|
|
11779
11979
|
}
|
|
11780
11980
|
}
|
|
11781
11981
|
const credential = await step.prompt(
|
|
@@ -11784,7 +11984,7 @@ async function handleModelProvider(ctx) {
|
|
|
11784
11984
|
)
|
|
11785
11985
|
);
|
|
11786
11986
|
if (!credential) {
|
|
11787
|
-
console.log(
|
|
11987
|
+
console.log(chalk58.dim("Cancelled"));
|
|
11788
11988
|
process.exit(0);
|
|
11789
11989
|
}
|
|
11790
11990
|
let selectedModel;
|
|
@@ -11803,7 +12003,7 @@ async function handleModelProvider(ctx) {
|
|
|
11803
12003
|
() => promptSelect("Select model:", modelChoices)
|
|
11804
12004
|
);
|
|
11805
12005
|
if (modelSelection === void 0) {
|
|
11806
|
-
console.log(
|
|
12006
|
+
console.log(chalk58.dim("Cancelled"));
|
|
11807
12007
|
process.exit(0);
|
|
11808
12008
|
}
|
|
11809
12009
|
selectedModel = modelSelection === "" ? void 0 : modelSelection;
|
|
@@ -11813,7 +12013,7 @@ async function handleModelProvider(ctx) {
|
|
|
11813
12013
|
});
|
|
11814
12014
|
const modelNote = result.provider.selectedModel ? ` with model: ${result.provider.selectedModel}` : "";
|
|
11815
12015
|
step.detail(
|
|
11816
|
-
|
|
12016
|
+
chalk58.green(
|
|
11817
12017
|
`${providerType} ${result.created ? "created" : "updated"}${result.isDefault ? ` (default for ${result.framework})` : ""}${modelNote}`
|
|
11818
12018
|
)
|
|
11819
12019
|
);
|
|
@@ -11842,9 +12042,9 @@ async function handleAgentCreation(ctx) {
|
|
|
11842
12042
|
process.exit(0);
|
|
11843
12043
|
}
|
|
11844
12044
|
agentName = inputName;
|
|
11845
|
-
if (
|
|
12045
|
+
if (existsSync12(agentName)) {
|
|
11846
12046
|
step.detail(
|
|
11847
|
-
|
|
12047
|
+
chalk58.yellow(`${agentName}/ already exists, choose another name`)
|
|
11848
12048
|
);
|
|
11849
12049
|
} else {
|
|
11850
12050
|
folderExists = false;
|
|
@@ -11853,22 +12053,22 @@ async function handleAgentCreation(ctx) {
|
|
|
11853
12053
|
} else {
|
|
11854
12054
|
if (!validateAgentName(agentName)) {
|
|
11855
12055
|
console.error(
|
|
11856
|
-
|
|
12056
|
+
chalk58.red(
|
|
11857
12057
|
"Invalid agent name: must be 3-64 chars, alphanumeric + hyphens"
|
|
11858
12058
|
)
|
|
11859
12059
|
);
|
|
11860
12060
|
process.exit(1);
|
|
11861
12061
|
}
|
|
11862
|
-
if (
|
|
11863
|
-
console.error(
|
|
12062
|
+
if (existsSync12(agentName)) {
|
|
12063
|
+
console.error(chalk58.red(`${agentName}/ already exists`));
|
|
11864
12064
|
console.log();
|
|
11865
12065
|
console.log("Remove it first or choose a different name:");
|
|
11866
|
-
console.log(
|
|
12066
|
+
console.log(chalk58.cyan(` rm -rf ${agentName}`));
|
|
11867
12067
|
process.exit(1);
|
|
11868
12068
|
}
|
|
11869
12069
|
}
|
|
11870
|
-
await
|
|
11871
|
-
step.detail(
|
|
12070
|
+
await mkdir8(agentName, { recursive: true });
|
|
12071
|
+
step.detail(chalk58.green(`Created ${agentName}/`));
|
|
11872
12072
|
});
|
|
11873
12073
|
return agentName;
|
|
11874
12074
|
}
|
|
@@ -11884,7 +12084,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
11884
12084
|
shouldInstall = confirmed ?? true;
|
|
11885
12085
|
}
|
|
11886
12086
|
if (!shouldInstall) {
|
|
11887
|
-
step.detail(
|
|
12087
|
+
step.detail(chalk58.dim("Skipped"));
|
|
11888
12088
|
return;
|
|
11889
12089
|
}
|
|
11890
12090
|
const scope = "project";
|
|
@@ -11892,7 +12092,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
11892
12092
|
const agentDir = `${process.cwd()}/${agentName}`;
|
|
11893
12093
|
const result = await installVm0Plugin(scope, agentDir);
|
|
11894
12094
|
step.detail(
|
|
11895
|
-
|
|
12095
|
+
chalk58.green(`Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
11896
12096
|
);
|
|
11897
12097
|
pluginInstalled = true;
|
|
11898
12098
|
} catch (error) {
|
|
@@ -11903,18 +12103,18 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
11903
12103
|
}
|
|
11904
12104
|
function printNextSteps(agentName, pluginInstalled) {
|
|
11905
12105
|
console.log();
|
|
11906
|
-
console.log(
|
|
12106
|
+
console.log(chalk58.bold("Next step:"));
|
|
11907
12107
|
console.log();
|
|
11908
12108
|
if (pluginInstalled) {
|
|
11909
12109
|
console.log(
|
|
11910
|
-
` ${
|
|
12110
|
+
` ${chalk58.cyan(`cd ${agentName} && claude "/${PRIMARY_SKILL_NAME} let's build an agent"`)}`
|
|
11911
12111
|
);
|
|
11912
12112
|
} else {
|
|
11913
|
-
console.log(` ${
|
|
12113
|
+
console.log(` ${chalk58.cyan(`cd ${agentName} && vm0 init`)}`);
|
|
11914
12114
|
}
|
|
11915
12115
|
console.log();
|
|
11916
12116
|
}
|
|
11917
|
-
var onboardCommand = new
|
|
12117
|
+
var onboardCommand = new Command57().name("onboard").description("Guided setup for new VM0 users").option("-y, --yes", "Skip confirmation prompts").option("--name <name>", `Agent name (default: ${DEFAULT_AGENT_NAME})`).action(async (options) => {
|
|
11918
12118
|
const interactive = isInteractive();
|
|
11919
12119
|
if (interactive) {
|
|
11920
12120
|
process.stdout.write("\x1B[2J\x1B[H");
|
|
@@ -11937,15 +12137,15 @@ var onboardCommand = new Command56().name("onboard").description("Guided setup f
|
|
|
11937
12137
|
});
|
|
11938
12138
|
|
|
11939
12139
|
// src/commands/setup-claude/index.ts
|
|
11940
|
-
import { Command as
|
|
11941
|
-
import
|
|
11942
|
-
var setupClaudeCommand = new
|
|
11943
|
-
console.log(
|
|
12140
|
+
import { Command as Command58 } from "commander";
|
|
12141
|
+
import chalk59 from "chalk";
|
|
12142
|
+
var setupClaudeCommand = new Command58().name("setup-claude").description("Install VM0 Claude Plugin").option("--agent-dir <dir>", "Agent directory to run install in").option("--scope <scope>", "Installation scope (user or project)", "project").action(async (options) => {
|
|
12143
|
+
console.log(chalk59.dim("Installing VM0 Claude Plugin..."));
|
|
11944
12144
|
const scope = options.scope === "user" ? "user" : "project";
|
|
11945
12145
|
try {
|
|
11946
12146
|
const result = await installVm0Plugin(scope, options.agentDir);
|
|
11947
12147
|
console.log(
|
|
11948
|
-
|
|
12148
|
+
chalk59.green(`\u2713 Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
11949
12149
|
);
|
|
11950
12150
|
} catch (error) {
|
|
11951
12151
|
handlePluginError(error);
|
|
@@ -11954,15 +12154,15 @@ var setupClaudeCommand = new Command57().name("setup-claude").description("Insta
|
|
|
11954
12154
|
console.log("Next step:");
|
|
11955
12155
|
const cdPrefix = options.agentDir ? `cd ${options.agentDir} && ` : "";
|
|
11956
12156
|
console.log(
|
|
11957
|
-
|
|
12157
|
+
chalk59.cyan(
|
|
11958
12158
|
` ${cdPrefix}claude "/${PRIMARY_SKILL_NAME} let's build a workflow"`
|
|
11959
12159
|
)
|
|
11960
12160
|
);
|
|
11961
12161
|
});
|
|
11962
12162
|
|
|
11963
12163
|
// src/index.ts
|
|
11964
|
-
var program = new
|
|
11965
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.
|
|
12164
|
+
var program = new Command59();
|
|
12165
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.14.1");
|
|
11966
12166
|
program.addCommand(authCommand);
|
|
11967
12167
|
program.addCommand(infoCommand);
|
|
11968
12168
|
program.addCommand(composeCommand);
|