@vm0/cli 9.148.0 → 9.148.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{chunk-7S6FB5HX.js → chunk-KAN2DFAY.js} +631 -510
- package/{chunk-7S6FB5HX.js.map → chunk-KAN2DFAY.js.map} +1 -1
- package/index.js +22 -15
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/zero.js +42 -255
- package/zero.js.map +1 -1
package/package.json
CHANGED
package/zero.js
CHANGED
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
CONNECTOR_TYPES,
|
|
7
7
|
Command,
|
|
8
8
|
EventRenderer,
|
|
9
|
+
EventStreamNormalizer,
|
|
9
10
|
MODEL_PROVIDER_TYPES,
|
|
10
11
|
Option,
|
|
11
|
-
allowsCustomModel,
|
|
12
12
|
completePhoneFileUpload,
|
|
13
13
|
completeSlackFileUpload,
|
|
14
14
|
completeTelegramFileUpload,
|
|
@@ -47,10 +47,7 @@ import {
|
|
|
47
47
|
getConnectorEnvironmentMapping,
|
|
48
48
|
getConnectorFirewall,
|
|
49
49
|
getConnectorTypeForSecretName,
|
|
50
|
-
getCustomModelPlaceholder,
|
|
51
50
|
getDefaultAuthMethod,
|
|
52
|
-
getDefaultModel,
|
|
53
|
-
getModels,
|
|
54
51
|
getScopeDiff,
|
|
55
52
|
getSecretsForAuthMethod,
|
|
56
53
|
getSelectableProviderTypes,
|
|
@@ -67,7 +64,6 @@ import {
|
|
|
67
64
|
getZeroRunContext,
|
|
68
65
|
getZeroUserPreferences,
|
|
69
66
|
hasAuthMethods,
|
|
70
|
-
hasModelSelection,
|
|
71
67
|
hasRequiredScopes,
|
|
72
68
|
initPhoneFileUpload,
|
|
73
69
|
initSlackFileUpload,
|
|
@@ -113,7 +109,6 @@ import {
|
|
|
113
109
|
sendPhoneMessage,
|
|
114
110
|
sendSlackMessage,
|
|
115
111
|
sendTelegramMessage,
|
|
116
|
-
setZeroOrgModelProviderDefault,
|
|
117
112
|
setZeroOrgSecret,
|
|
118
113
|
setZeroOrgVariable,
|
|
119
114
|
setZeroSecret,
|
|
@@ -126,14 +121,13 @@ import {
|
|
|
126
121
|
updateZeroAgent,
|
|
127
122
|
updateZeroAgentInstructions,
|
|
128
123
|
updateZeroOrg,
|
|
129
|
-
updateZeroOrgModelProviderModel,
|
|
130
124
|
updateZeroUserPreferences,
|
|
131
125
|
uploadWebFile,
|
|
132
126
|
upsertZeroOrgModelProvider,
|
|
133
127
|
withErrorHandler,
|
|
134
128
|
zeroAgentCustomSkillNameSchema,
|
|
135
129
|
zeroRemoteAgentCommand
|
|
136
|
-
} from "./chunk-
|
|
130
|
+
} from "./chunk-KAN2DFAY.js";
|
|
137
131
|
import {
|
|
138
132
|
__toESM,
|
|
139
133
|
init_esm_shims
|
|
@@ -543,23 +537,8 @@ var listCommand4 = new Command().name("list").alias("ls").description("List all
|
|
|
543
537
|
for (const [framework, providers] of Object.entries(byFramework)) {
|
|
544
538
|
console.log(` ${source_default.cyan(framework)}:`);
|
|
545
539
|
for (const provider of providers) {
|
|
546
|
-
|
|
547
|
-
const modelTag = provider.selectedModel ? source_default.dim(` [${provider.selectedModel}]`) : "";
|
|
548
|
-
console.log(` ${provider.type}${defaultTag}${modelTag}`);
|
|
540
|
+
console.log(` ${provider.type}`);
|
|
549
541
|
console.log(source_default.dim(` ID: ${provider.id}`));
|
|
550
|
-
if (provider.type in MODEL_PROVIDER_TYPES) {
|
|
551
|
-
const type = provider.type;
|
|
552
|
-
const available = getModels(type) ?? [];
|
|
553
|
-
if (available.length > 0) {
|
|
554
|
-
console.log(
|
|
555
|
-
source_default.dim(` Available models: ${available.join(", ")}`)
|
|
556
|
-
);
|
|
557
|
-
} else if (allowsCustomModel(type)) {
|
|
558
|
-
console.log(
|
|
559
|
-
source_default.dim(" Available models: (custom \u2014 any model name)")
|
|
560
|
-
);
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
542
|
console.log(
|
|
564
543
|
source_default.dim(
|
|
565
544
|
` Updated: ${new Date(provider.updatedAt).toLocaleString()}`
|
|
@@ -571,12 +550,6 @@ var listCommand4 = new Command().name("list").alias("ls").description("List all
|
|
|
571
550
|
console.log(
|
|
572
551
|
source_default.dim(`Total: ${result.modelProviders.length} provider(s)`)
|
|
573
552
|
);
|
|
574
|
-
console.log();
|
|
575
|
-
console.log(
|
|
576
|
-
source_default.dim(
|
|
577
|
-
"Use a provider ID with: zero agent edit <agent-id> --model-provider <id> --model <name>"
|
|
578
|
-
)
|
|
579
|
-
);
|
|
580
553
|
})
|
|
581
554
|
);
|
|
582
555
|
|
|
@@ -596,18 +569,6 @@ function validateProviderType(typeStr) {
|
|
|
596
569
|
}
|
|
597
570
|
return typeStr;
|
|
598
571
|
}
|
|
599
|
-
function validateModel(type, modelStr) {
|
|
600
|
-
const models = getModels(type);
|
|
601
|
-
if (allowsCustomModel(type)) {
|
|
602
|
-
return modelStr;
|
|
603
|
-
}
|
|
604
|
-
if (models && !models.includes(modelStr)) {
|
|
605
|
-
throw new Error(`Invalid model "${modelStr}"`, {
|
|
606
|
-
cause: new Error(`Valid models: ${models.join(", ")}`)
|
|
607
|
-
});
|
|
608
|
-
}
|
|
609
|
-
return modelStr;
|
|
610
|
-
}
|
|
611
572
|
function validateAuthMethod(type, authMethodStr) {
|
|
612
573
|
const authMethods = getAuthMethodsForType(type);
|
|
613
574
|
if (!authMethods || !(authMethodStr in authMethods)) {
|
|
@@ -681,13 +642,6 @@ function validateSecrets(type, authMethod, secrets) {
|
|
|
681
642
|
function handleNonInteractiveMode(options) {
|
|
682
643
|
const type = validateProviderType(options.type);
|
|
683
644
|
const cmdPrefix = options.commandPrefix ?? "zero org model-provider setup";
|
|
684
|
-
let selectedModel;
|
|
685
|
-
if (options.model) {
|
|
686
|
-
selectedModel = validateModel(type, options.model);
|
|
687
|
-
} else if (hasModelSelection(type)) {
|
|
688
|
-
const defaultModel = getDefaultModel(type);
|
|
689
|
-
selectedModel = defaultModel || void 0;
|
|
690
|
-
}
|
|
691
645
|
if (hasAuthMethods(type)) {
|
|
692
646
|
let authMethod;
|
|
693
647
|
if (options.authMethod) {
|
|
@@ -719,7 +673,6 @@ function handleNonInteractiveMode(options) {
|
|
|
719
673
|
type,
|
|
720
674
|
authMethod,
|
|
721
675
|
secrets,
|
|
722
|
-
selectedModel,
|
|
723
676
|
isInteractiveMode: false
|
|
724
677
|
};
|
|
725
678
|
}
|
|
@@ -737,68 +690,9 @@ function handleNonInteractiveMode(options) {
|
|
|
737
690
|
return {
|
|
738
691
|
type,
|
|
739
692
|
secret,
|
|
740
|
-
selectedModel,
|
|
741
693
|
isInteractiveMode: false
|
|
742
694
|
};
|
|
743
695
|
}
|
|
744
|
-
async function promptForModelSelection(type) {
|
|
745
|
-
if (!hasModelSelection(type)) {
|
|
746
|
-
return void 0;
|
|
747
|
-
}
|
|
748
|
-
const models = getModels(type) ?? [];
|
|
749
|
-
const defaultModel = getDefaultModel(type);
|
|
750
|
-
const supportsCustomModel = allowsCustomModel(type);
|
|
751
|
-
const modelChoices = [];
|
|
752
|
-
if (defaultModel === "") {
|
|
753
|
-
modelChoices.push({ title: "auto (Recommended)", value: "" });
|
|
754
|
-
}
|
|
755
|
-
for (const model of models) {
|
|
756
|
-
modelChoices.push({
|
|
757
|
-
title: model === defaultModel ? `${model} (Recommended)` : model,
|
|
758
|
-
value: model
|
|
759
|
-
});
|
|
760
|
-
}
|
|
761
|
-
if (supportsCustomModel) {
|
|
762
|
-
modelChoices.push({ title: "Custom model ID", value: "__custom__" });
|
|
763
|
-
}
|
|
764
|
-
const modelResponse = await (0, import_prompts.default)(
|
|
765
|
-
{
|
|
766
|
-
type: "select",
|
|
767
|
-
name: "model",
|
|
768
|
-
message: "Select model:",
|
|
769
|
-
choices: modelChoices
|
|
770
|
-
},
|
|
771
|
-
{
|
|
772
|
-
onCancel: () => {
|
|
773
|
-
return process.exit(0);
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
);
|
|
777
|
-
const selected = modelResponse.model;
|
|
778
|
-
if (selected === "__custom__") {
|
|
779
|
-
const placeholder = getCustomModelPlaceholder(type);
|
|
780
|
-
if (placeholder) {
|
|
781
|
-
console.log(source_default.dim(`Example: ${placeholder}`));
|
|
782
|
-
}
|
|
783
|
-
const customResponse = await (0, import_prompts.default)(
|
|
784
|
-
{
|
|
785
|
-
type: "text",
|
|
786
|
-
name: "customModel",
|
|
787
|
-
message: "Enter model ID:",
|
|
788
|
-
validate: (value) => {
|
|
789
|
-
return value.length > 0 || "Model ID is required";
|
|
790
|
-
}
|
|
791
|
-
},
|
|
792
|
-
{
|
|
793
|
-
onCancel: () => {
|
|
794
|
-
return process.exit(0);
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
);
|
|
798
|
-
return customResponse.customModel;
|
|
799
|
-
}
|
|
800
|
-
return selected === "" ? void 0 : selected;
|
|
801
|
-
}
|
|
802
696
|
async function promptForAuthMethod(type) {
|
|
803
697
|
const authMethods = getAuthMethodsForType(type);
|
|
804
698
|
const defaultAuthMethod = getDefaultAuthMethod(type);
|
|
@@ -886,11 +780,6 @@ async function promptForSecrets(type, authMethod) {
|
|
|
886
780
|
function collectSecrets(value, previous) {
|
|
887
781
|
return previous.concat([value]);
|
|
888
782
|
}
|
|
889
|
-
function parseModelFlag(value) {
|
|
890
|
-
if (value === void 0) return void 0;
|
|
891
|
-
if (value === "default") return null;
|
|
892
|
-
return value;
|
|
893
|
-
}
|
|
894
783
|
|
|
895
784
|
// src/commands/zero/org/model-provider/setup.ts
|
|
896
785
|
async function handleInteractiveMode() {
|
|
@@ -966,11 +855,9 @@ async function handleInteractiveMode() {
|
|
|
966
855
|
return null;
|
|
967
856
|
}
|
|
968
857
|
if (actionResponse.action === "keep") {
|
|
969
|
-
const selectedModel2 = await promptForModelSelection(type);
|
|
970
858
|
return {
|
|
971
859
|
type,
|
|
972
860
|
keepExistingSecret: true,
|
|
973
|
-
selectedModel: selectedModel2,
|
|
974
861
|
isInteractiveMode: true
|
|
975
862
|
};
|
|
976
863
|
}
|
|
@@ -984,12 +871,10 @@ async function handleInteractiveMode() {
|
|
|
984
871
|
if (hasAuthMethods(type)) {
|
|
985
872
|
const authMethod = await promptForAuthMethod(type);
|
|
986
873
|
const secrets = await promptForSecrets(type, authMethod);
|
|
987
|
-
const selectedModel2 = await promptForModelSelection(type);
|
|
988
874
|
return {
|
|
989
875
|
type,
|
|
990
876
|
authMethod,
|
|
991
877
|
secrets,
|
|
992
|
-
selectedModel: selectedModel2,
|
|
993
878
|
isInteractiveMode: true
|
|
994
879
|
};
|
|
995
880
|
}
|
|
@@ -1010,34 +895,7 @@ async function handleInteractiveMode() {
|
|
|
1010
895
|
return null;
|
|
1011
896
|
}
|
|
1012
897
|
const secret = secretResponse.secret;
|
|
1013
|
-
|
|
1014
|
-
return { type, secret, selectedModel, isInteractiveMode: true };
|
|
1015
|
-
}
|
|
1016
|
-
async function promptSetAsDefault(type, framework, isDefault) {
|
|
1017
|
-
if (isDefault) return;
|
|
1018
|
-
let cancelled = false;
|
|
1019
|
-
const response = await (0, import_prompts2.default)(
|
|
1020
|
-
{
|
|
1021
|
-
type: "confirm",
|
|
1022
|
-
name: "setDefault",
|
|
1023
|
-
message: "Set this provider as default?",
|
|
1024
|
-
initial: false
|
|
1025
|
-
},
|
|
1026
|
-
{
|
|
1027
|
-
onCancel: () => {
|
|
1028
|
-
cancelled = true;
|
|
1029
|
-
return false;
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
1032
|
-
);
|
|
1033
|
-
if (cancelled) {
|
|
1034
|
-
console.log(source_default.dim("Cancelled"));
|
|
1035
|
-
return;
|
|
1036
|
-
}
|
|
1037
|
-
if (response.setDefault) {
|
|
1038
|
-
await setZeroOrgModelProviderDefault(type);
|
|
1039
|
-
console.log(source_default.green(`\u2713 Default for ${framework} set to "${type}"`));
|
|
1040
|
-
}
|
|
898
|
+
return { type, secret, isInteractiveMode: true };
|
|
1041
899
|
}
|
|
1042
900
|
var setupCommand = new Command().name("setup").description("Configure an org-level model provider").option("-t, --type <type>", "Provider type (for non-interactive mode)").option(
|
|
1043
901
|
"-s, --secret <value>",
|
|
@@ -1047,7 +905,7 @@ var setupCommand = new Command().name("setup").description("Configure an org-lev
|
|
|
1047
905
|
).option(
|
|
1048
906
|
"-a, --auth-method <method>",
|
|
1049
907
|
"Auth method (required for multi-auth providers like aws-bedrock)"
|
|
1050
|
-
).
|
|
908
|
+
).action(
|
|
1051
909
|
withErrorHandler(
|
|
1052
910
|
async (options) => {
|
|
1053
911
|
let input;
|
|
@@ -1057,7 +915,6 @@ var setupCommand = new Command().name("setup").description("Configure an org-lev
|
|
|
1057
915
|
type: options.type,
|
|
1058
916
|
secret: secretArgs,
|
|
1059
917
|
authMethod: options.authMethod,
|
|
1060
|
-
model: options.model,
|
|
1061
918
|
commandPrefix: "zero org model-provider setup"
|
|
1062
919
|
});
|
|
1063
920
|
} else if (options.type || secretArgs.length > 0) {
|
|
@@ -1070,54 +927,21 @@ var setupCommand = new Command().name("setup").description("Configure an org-lev
|
|
|
1070
927
|
input = result;
|
|
1071
928
|
}
|
|
1072
929
|
if (input.keepExistingSecret) {
|
|
1073
|
-
|
|
1074
|
-
input.type
|
|
1075
|
-
input.selectedModel
|
|
930
|
+
console.log(
|
|
931
|
+
source_default.green(`\u2713 Org model provider "${input.type}" unchanged`)
|
|
1076
932
|
);
|
|
1077
|
-
const defaultNote2 = provider2.isDefault ? ` (default for ${provider2.framework})` : "";
|
|
1078
|
-
const modelNote2 = provider2.selectedModel ? ` with model: ${provider2.selectedModel}` : "";
|
|
1079
|
-
if (!hasModelSelection(input.type)) {
|
|
1080
|
-
console.log(
|
|
1081
|
-
source_default.green(`\u2713 Org model provider "${input.type}" unchanged`)
|
|
1082
|
-
);
|
|
1083
|
-
} else {
|
|
1084
|
-
console.log(
|
|
1085
|
-
source_default.green(
|
|
1086
|
-
`\u2713 Org model provider "${input.type}" updated${defaultNote2}${modelNote2}`
|
|
1087
|
-
)
|
|
1088
|
-
);
|
|
1089
|
-
}
|
|
1090
|
-
if (input.isInteractiveMode) {
|
|
1091
|
-
await promptSetAsDefault(
|
|
1092
|
-
input.type,
|
|
1093
|
-
provider2.framework,
|
|
1094
|
-
provider2.isDefault
|
|
1095
|
-
);
|
|
1096
|
-
}
|
|
1097
933
|
return;
|
|
1098
934
|
}
|
|
1099
|
-
const {
|
|
935
|
+
const { created } = await upsertZeroOrgModelProvider({
|
|
1100
936
|
type: input.type,
|
|
1101
937
|
secret: input.secret,
|
|
1102
938
|
authMethod: input.authMethod,
|
|
1103
|
-
secrets: input.secrets
|
|
1104
|
-
selectedModel: input.selectedModel
|
|
939
|
+
secrets: input.secrets
|
|
1105
940
|
});
|
|
1106
941
|
const action = created ? "created" : "updated";
|
|
1107
|
-
const defaultNote = provider.isDefault ? ` (default for ${provider.framework})` : "";
|
|
1108
|
-
const modelNote = provider.selectedModel ? ` with model: ${provider.selectedModel}` : "";
|
|
1109
942
|
console.log(
|
|
1110
|
-
source_default.green(
|
|
1111
|
-
`\u2713 Org model provider "${input.type}" ${action}${defaultNote}${modelNote}`
|
|
1112
|
-
)
|
|
943
|
+
source_default.green(`\u2713 Org model provider "${input.type}" ${action}`)
|
|
1113
944
|
);
|
|
1114
|
-
if (input.isInteractiveMode) {
|
|
1115
|
-
await promptSetAsDefault(
|
|
1116
|
-
input.type,
|
|
1117
|
-
provider.framework,
|
|
1118
|
-
provider.isDefault
|
|
1119
|
-
);
|
|
1120
|
-
}
|
|
1121
945
|
}
|
|
1122
946
|
)
|
|
1123
947
|
);
|
|
@@ -1137,29 +961,8 @@ var removeCommand4 = new Command().name("remove").description("Remove an org-lev
|
|
|
1137
961
|
})
|
|
1138
962
|
);
|
|
1139
963
|
|
|
1140
|
-
// src/commands/zero/org/model-provider/set-default.ts
|
|
1141
|
-
init_esm_shims();
|
|
1142
|
-
var setDefaultCommand = new Command().name("set-default").description("Set an org-level model provider as default for its framework").argument("<type>", "Model provider type to set as default").action(
|
|
1143
|
-
withErrorHandler(async (type) => {
|
|
1144
|
-
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type)) {
|
|
1145
|
-
const validTypes = Object.keys(MODEL_PROVIDER_TYPES).join(", ");
|
|
1146
|
-
throw new Error(`Invalid type "${type}"`, {
|
|
1147
|
-
cause: new Error(`Valid types: ${validTypes}`)
|
|
1148
|
-
});
|
|
1149
|
-
}
|
|
1150
|
-
const provider = await setZeroOrgModelProviderDefault(
|
|
1151
|
-
type
|
|
1152
|
-
);
|
|
1153
|
-
console.log(
|
|
1154
|
-
source_default.green(
|
|
1155
|
-
`\u2713 Default for ${provider.framework} set to "${provider.type}"`
|
|
1156
|
-
)
|
|
1157
|
-
);
|
|
1158
|
-
})
|
|
1159
|
-
);
|
|
1160
|
-
|
|
1161
964
|
// src/commands/zero/org/model-provider/index.ts
|
|
1162
|
-
var zeroOrgModelProviderCommand = new Command().name("model-provider").description("Manage org-level model providers").addCommand(listCommand4).addCommand(setupCommand).addCommand(removeCommand4)
|
|
965
|
+
var zeroOrgModelProviderCommand = new Command().name("model-provider").description("Manage org-level model providers").addCommand(listCommand4).addCommand(setupCommand).addCommand(removeCommand4);
|
|
1163
966
|
|
|
1164
967
|
// src/commands/zero/org/index.ts
|
|
1165
968
|
var zeroOrgCommand = new Command().name("org").description("Manage organization settings, members, and providers").addCommand(statusCommand).addCommand(setCommand).addCommand(listCommand).addCommand(useCommand).addCommand(membersCommand).addCommand(inviteCommand).addCommand(removeCommand).addCommand(leaveCommand).addCommand(deleteCommand).addCommand(zeroOrgSecretCommand).addCommand(zeroOrgVariableCommand).addCommand(zeroOrgModelProviderCommand);
|
|
@@ -1435,24 +1238,20 @@ function hasAvatarUpdate(options) {
|
|
|
1435
1238
|
return options.avatar !== void 0 || options.avatarRotation !== void 0 || options.avatarSkin !== void 0 || options.avatarHairStyle !== void 0 || options.avatarHairColor !== void 0 || options.avatarExpression !== void 0 || options.avatarIntensity !== void 0;
|
|
1436
1239
|
}
|
|
1437
1240
|
function hasAgentFieldUpdate(options) {
|
|
1438
|
-
return options.displayName !== void 0 || options.description !== void 0 || options.sound !== void 0 || hasAvatarUpdate(options) || options.skills !== void 0 || options.addSkill !== void 0 || options.removeSkill !== void 0
|
|
1241
|
+
return options.displayName !== void 0 || options.description !== void 0 || options.sound !== void 0 || hasAvatarUpdate(options) || options.skills !== void 0 || options.addSkill !== void 0 || options.removeSkill !== void 0;
|
|
1439
1242
|
}
|
|
1440
1243
|
async function applyAgentUpdate(agentId, options) {
|
|
1441
1244
|
const hasAvatar = hasAvatarUpdate(options);
|
|
1442
1245
|
const resolvedAvatarUrl = hasAvatar ? resolveAvatarUrl(options) : void 0;
|
|
1443
1246
|
const current = await getZeroAgent(agentId);
|
|
1444
1247
|
const customSkills = resolveCustomSkills(options, current.customSkills ?? []);
|
|
1445
|
-
const modelProviderId = options.modelProvider !== void 0 ? parseModelFlag(options.modelProvider) : current.modelProviderId;
|
|
1446
|
-
const selectedModel = options.model !== void 0 ? parseModelFlag(options.model) : current.selectedModel;
|
|
1447
1248
|
const avatarUrl = hasAvatar ? resolvedAvatarUrl : current.avatarUrl ?? void 0;
|
|
1448
1249
|
await updateZeroAgent(agentId, {
|
|
1449
1250
|
displayName: options.displayName !== void 0 ? options.displayName : current.displayName ?? void 0,
|
|
1450
1251
|
description: options.description !== void 0 ? options.description : current.description ?? void 0,
|
|
1451
1252
|
sound: options.sound !== void 0 ? options.sound : current.sound ?? void 0,
|
|
1452
1253
|
avatarUrl,
|
|
1453
|
-
customSkills
|
|
1454
|
-
modelProviderId,
|
|
1455
|
-
selectedModel
|
|
1254
|
+
customSkills
|
|
1456
1255
|
});
|
|
1457
1256
|
}
|
|
1458
1257
|
function validateSkillName(name) {
|
|
@@ -1515,13 +1314,7 @@ var editCommand = new Command().name("edit").description("Edit a zero agent").ar
|
|
|
1515
1314
|
).option("--avatar-intensity <level>", "Intensity: chill | normal | hyped").option(
|
|
1516
1315
|
"--skills <items>",
|
|
1517
1316
|
"Comma-separated custom skill names to attach (replaces existing)"
|
|
1518
|
-
).option("--add-skill <name>", "Add a custom skill to the agent").option("--remove-skill <name>", "Remove a custom skill from the agent").option("--instructions-file <path>", "Path to new instructions file").
|
|
1519
|
-
"--model-provider <id>",
|
|
1520
|
-
"Model provider UUID, or 'default' to inherit org default"
|
|
1521
|
-
).option(
|
|
1522
|
-
"--model <name>",
|
|
1523
|
-
"Model name (e.g. claude-sonnet-4-6, MiniMax-M2.7), or 'default' to inherit provider default"
|
|
1524
|
-
).addHelpText(
|
|
1317
|
+
).option("--add-skill <name>", "Add a custom skill to the agent").option("--remove-skill <name>", "Remove a custom skill from the agent").option("--instructions-file <path>", "Path to new instructions file").addHelpText(
|
|
1525
1318
|
"after",
|
|
1526
1319
|
`
|
|
1527
1320
|
Avatar:
|
|
@@ -1551,8 +1344,6 @@ Examples:
|
|
|
1551
1344
|
Add a skill: zero agent edit <agent-id> --add-skill my-skill
|
|
1552
1345
|
Remove a skill: zero agent edit <agent-id> --remove-skill my-skill
|
|
1553
1346
|
Update instructions: zero agent edit <agent-id> --instructions-file ./instructions.md
|
|
1554
|
-
Set model: zero agent edit <agent-id> --model-provider <provider-id> --model MiniMax-M2.7
|
|
1555
|
-
Reset model: zero agent edit <agent-id> --model-provider default --model default
|
|
1556
1347
|
Update yourself: zero agent edit $ZERO_AGENT_ID --description "new role"
|
|
1557
1348
|
|
|
1558
1349
|
Notes:
|
|
@@ -1560,14 +1351,13 @@ Notes:
|
|
|
1560
1351
|
- Unspecified fields are preserved (not cleared)
|
|
1561
1352
|
- --skills replaces the entire skill list; --add-skill/--remove-skill modify incrementally
|
|
1562
1353
|
- --skills cannot be combined with --add-skill or --remove-skill
|
|
1563
|
-
- Use 'zero org model-provider list' to see available providers and models
|
|
1564
1354
|
- To create or edit skill content, use: zero skill --help`
|
|
1565
1355
|
).action(
|
|
1566
1356
|
withErrorHandler(async (agentId, options) => {
|
|
1567
1357
|
const hasAgentUpdate = hasAgentFieldUpdate(options);
|
|
1568
1358
|
if (!hasAgentUpdate && !options.instructionsFile) {
|
|
1569
1359
|
throw new Error(
|
|
1570
|
-
"At least one option is required (--display-name, --description, --sound, --avatar, --avatar-*, --skills, --add-skill, --remove-skill, --
|
|
1360
|
+
"At least one option is required (--display-name, --description, --sound, --avatar, --avatar-*, --skills, --add-skill, --remove-skill, --instructions-file)"
|
|
1571
1361
|
);
|
|
1572
1362
|
}
|
|
1573
1363
|
if (hasAgentUpdate) {
|
|
@@ -3426,12 +3216,18 @@ function sleep(ms) {
|
|
|
3426
3216
|
}
|
|
3427
3217
|
async function pollZeroEvents(runId, options) {
|
|
3428
3218
|
const renderer = new EventRenderer({ verbose: options?.verbose });
|
|
3219
|
+
const normalizer = new EventStreamNormalizer();
|
|
3429
3220
|
let lastSequence = -1;
|
|
3430
3221
|
let complete = false;
|
|
3431
3222
|
let result = { succeeded: true, runId };
|
|
3432
3223
|
let terminalRunResponse;
|
|
3433
3224
|
let terminalSeenAt = 0;
|
|
3434
3225
|
let lastTerminalProgressAt = 0;
|
|
3226
|
+
const flushPendingEvents = () => {
|
|
3227
|
+
for (const parsed of normalizer.flush()) {
|
|
3228
|
+
renderer.render(parsed);
|
|
3229
|
+
}
|
|
3230
|
+
};
|
|
3435
3231
|
while (!complete) {
|
|
3436
3232
|
const eventsResponse = await getZeroRunAgentEvents(runId, {
|
|
3437
3233
|
since: lastSequence,
|
|
@@ -3443,9 +3239,11 @@ async function pollZeroEvents(runId, options) {
|
|
|
3443
3239
|
lastSequence
|
|
3444
3240
|
);
|
|
3445
3241
|
for (const event of contiguousEvents) {
|
|
3446
|
-
const
|
|
3447
|
-
|
|
3448
|
-
|
|
3242
|
+
const parsedEvents = normalizer.process(
|
|
3243
|
+
event.eventData,
|
|
3244
|
+
eventsResponse.framework
|
|
3245
|
+
);
|
|
3246
|
+
for (const parsed of parsedEvents) {
|
|
3449
3247
|
renderer.render(parsed);
|
|
3450
3248
|
}
|
|
3451
3249
|
}
|
|
@@ -3473,6 +3271,7 @@ async function pollZeroEvents(runId, options) {
|
|
|
3473
3271
|
lastTerminalProgressAt,
|
|
3474
3272
|
blockedByGap
|
|
3475
3273
|
)) {
|
|
3274
|
+
flushPendingEvents();
|
|
3476
3275
|
result = renderTerminalRunResult(runId, terminalRunResponse);
|
|
3477
3276
|
complete = true;
|
|
3478
3277
|
}
|
|
@@ -3947,12 +3746,6 @@ Deploying schedule for agent ${source_default.cyan(params.agentName)}...`
|
|
|
3947
3746
|
prompt: params.prompt,
|
|
3948
3747
|
...params.existingEnabled !== void 0 && {
|
|
3949
3748
|
enabled: params.existingEnabled
|
|
3950
|
-
},
|
|
3951
|
-
...params.modelProviderId !== void 0 && {
|
|
3952
|
-
modelProviderId: params.modelProviderId
|
|
3953
|
-
},
|
|
3954
|
-
...params.selectedModel !== void 0 && {
|
|
3955
|
-
selectedModel: params.selectedModel
|
|
3956
3749
|
}
|
|
3957
3750
|
});
|
|
3958
3751
|
return deployResult;
|
|
@@ -4035,13 +3828,7 @@ async function handleScheduleEnabling(params) {
|
|
|
4035
3828
|
var setupCommand2 = new Command().name("setup").description("Create or edit a schedule for a zero agent").argument("<agent-id>", "Agent ID").option("-n, --name <schedule-name>", 'Schedule name (default: "default")').option("-f, --frequency <type>", "Frequency: daily|weekly|monthly|once|loop").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("-i, --interval <seconds>", "Interval in seconds for loop mode").option("-z, --timezone <tz>", "IANA timezone").option("-p, --prompt <text>", "Prompt to run").option(
|
|
4036
3829
|
"--prompt-file <path>",
|
|
4037
3830
|
"Read prompt from file (cannot be used with --prompt)"
|
|
4038
|
-
).option("-e, --enable", "Enable schedule immediately after creation").
|
|
4039
|
-
"--model-provider <id>",
|
|
4040
|
-
"Model provider UUID, or 'default' to inherit from agent/org"
|
|
4041
|
-
).option(
|
|
4042
|
-
"--model <name>",
|
|
4043
|
-
"Model name (e.g. claude-sonnet-4-6, MiniMax-M2.7), or 'default' to inherit"
|
|
4044
|
-
).addHelpText(
|
|
3831
|
+
).option("-e, --enable", "Enable schedule immediately after creation").addHelpText(
|
|
4045
3832
|
"after",
|
|
4046
3833
|
`
|
|
4047
3834
|
Examples:
|
|
@@ -4052,14 +3839,10 @@ Examples:
|
|
|
4052
3839
|
Loop every 5 minutes: zero schedule setup <agent-id> -f loop -i 300 -p "poll for updates"
|
|
4053
3840
|
Prompt from file: zero schedule setup <agent-id> -f daily -t 09:00 --prompt-file ./prompt.md
|
|
4054
3841
|
Create and enable: zero schedule setup <agent-id> -f daily -t 09:00 -p "run report" --enable
|
|
4055
|
-
Override model: zero schedule setup <agent-id> -f daily -t 09:00 -p "..." --model-provider <id> --model MiniMax-M2.7
|
|
4056
|
-
Reset model override: zero schedule setup <agent-id> -f daily -t 09:00 -p "..." --model-provider default --model default
|
|
4057
3842
|
|
|
4058
3843
|
Notes:
|
|
4059
3844
|
- Re-running setup with the same agent updates the existing "default" schedule
|
|
4060
3845
|
- Use -n to manage multiple named schedules for the same agent
|
|
4061
|
-
- --model-provider and --model default to inheriting the agent's configuration
|
|
4062
|
-
- Use 'zero org model-provider list' to see available providers and models
|
|
4063
3846
|
- All flags are required in non-interactive mode; interactive mode prompts for missing values
|
|
4064
3847
|
- If the user wants to be notified when a schedule completes, ask them where they want to receive the notification: web chat or Slack, then include it in the prompt`
|
|
4065
3848
|
).action(
|
|
@@ -4123,9 +3906,7 @@ Notes:
|
|
|
4123
3906
|
intervalSeconds,
|
|
4124
3907
|
timezone,
|
|
4125
3908
|
prompt: promptText_,
|
|
4126
|
-
existingEnabled: existingSchedule?.enabled
|
|
4127
|
-
modelProviderId: parseModelFlag(options.modelProvider),
|
|
4128
|
-
selectedModel: parseModelFlag(options.model)
|
|
3909
|
+
existingEnabled: existingSchedule?.enabled
|
|
4129
3910
|
});
|
|
4130
3911
|
displayDeployResult(scheduleName, deployResult);
|
|
4131
3912
|
const shouldPromptEnable = deployResult.created || existingSchedule !== void 0 && !existingSchedule.enabled;
|
|
@@ -5963,11 +5744,13 @@ Examples:
|
|
|
5963
5744
|
|
|
5964
5745
|
// src/commands/zero/logs/index.ts
|
|
5965
5746
|
var PAGE_LIMIT = 100;
|
|
5966
|
-
function renderAgentEvent(event, renderer, framework) {
|
|
5967
|
-
const
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
|
|
5747
|
+
function renderAgentEvent(event, renderer, normalizer, framework) {
|
|
5748
|
+
const parsedEvents = normalizer.process(
|
|
5749
|
+
event.eventData,
|
|
5750
|
+
framework,
|
|
5751
|
+
new Date(event.createdAt)
|
|
5752
|
+
);
|
|
5753
|
+
for (const parsed of parsedEvents) {
|
|
5971
5754
|
renderer.render(parsed);
|
|
5972
5755
|
}
|
|
5973
5756
|
}
|
|
@@ -6012,9 +5795,13 @@ async function showAgentEvents(runId, options) {
|
|
|
6012
5795
|
showTimestamp: true,
|
|
6013
5796
|
verbose: true
|
|
6014
5797
|
});
|
|
5798
|
+
const normalizer = new EventStreamNormalizer();
|
|
6015
5799
|
const framework = firstResponse.framework;
|
|
6016
5800
|
for (const event of events) {
|
|
6017
|
-
renderAgentEvent(event, renderer, framework);
|
|
5801
|
+
renderAgentEvent(event, renderer, normalizer, framework);
|
|
5802
|
+
}
|
|
5803
|
+
for (const parsed of normalizer.flush()) {
|
|
5804
|
+
renderer.render(parsed);
|
|
6018
5805
|
}
|
|
6019
5806
|
}
|
|
6020
5807
|
var zeroLogsCommand = new Command().name("logs").description("View and search agent run logs").argument("[runId]", "Run ID to view agent events for").addCommand(listCommand12).addCommand(searchCommand2).option(
|
|
@@ -7648,7 +7435,7 @@ function registerZeroCommands(prog, commands) {
|
|
|
7648
7435
|
var program = new Command();
|
|
7649
7436
|
program.name("zero").description(
|
|
7650
7437
|
"Zero CLI \u2014 interact with the zero platform from inside the sandbox"
|
|
7651
|
-
).version("9.148.
|
|
7438
|
+
).version("9.148.2").addHelpText(
|
|
7652
7439
|
"after",
|
|
7653
7440
|
`
|
|
7654
7441
|
Examples:
|