suzi-cli 0.1.26 → 0.1.27
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/CLAUDE.md +1 -0
- package/dist/commands/agent.d.ts +12 -2
- package/dist/commands/agent.d.ts.map +1 -1
- package/dist/commands/agent.js +277 -27
- package/dist/commands/agent.js.map +1 -1
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +1 -0
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/orders.d.ts +3 -0
- package/dist/commands/orders.d.ts.map +1 -0
- package/dist/commands/orders.js +156 -0
- package/dist/commands/orders.js.map +1 -0
- package/dist/commands/prompt-suggestions.d.ts.map +1 -1
- package/dist/commands/prompt-suggestions.js +19 -0
- package/dist/commands/prompt-suggestions.js.map +1 -1
- package/dist/commands/subagents.d.ts.map +1 -1
- package/dist/commands/subagents.js +2 -3
- package/dist/commands/subagents.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CLAUDE.md
CHANGED
|
@@ -48,6 +48,7 @@ src/
|
|
|
48
48
|
├── create.ts # AI-assisted agent creation (supports Claude Code + Codex)
|
|
49
49
|
├── accounts.ts # Multi-account switching
|
|
50
50
|
├── transactions.ts # Transaction history viewer
|
|
51
|
+
├── orders.ts # Agent orders, fills, and positions viewer
|
|
51
52
|
├── list-tools.ts # Browse protocols/actions with local caching
|
|
52
53
|
├── skills.ts # Skill installation for Claude Code + Codex
|
|
53
54
|
├── import.ts # Clone shared agents
|
package/dist/commands/agent.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
interface DeployAgentOptions {
|
|
3
3
|
json?: boolean;
|
|
4
|
-
title?: string;
|
|
5
|
-
description?: string;
|
|
6
4
|
update?: string;
|
|
7
5
|
activate?: boolean;
|
|
8
6
|
}
|
|
@@ -27,6 +25,18 @@ export declare function viewAgentCommand(idOrName?: string, opts?: {
|
|
|
27
25
|
}): Promise<void>;
|
|
28
26
|
export declare function getAgentConfigCommand(idOrName?: string, opts?: AgentConfigCommandOptions): Promise<void>;
|
|
29
27
|
export declare function setAgentConfigCommand(idOrName?: string, updatesArgs?: string[], opts?: AgentConfigCommandOptions): Promise<void>;
|
|
28
|
+
export declare function listStoreCommand(idOrName?: string, opts?: {
|
|
29
|
+
json?: boolean;
|
|
30
|
+
}): Promise<void>;
|
|
31
|
+
export declare function getStoreKeyCommand(idOrName: string | undefined, key: string, opts?: {
|
|
32
|
+
json?: boolean;
|
|
33
|
+
}): Promise<void>;
|
|
34
|
+
export declare function setStoreKeyCommand(idOrName: string | undefined, key: string, rawValue: string, opts?: {
|
|
35
|
+
json?: boolean;
|
|
36
|
+
}): Promise<void>;
|
|
37
|
+
export declare function deleteStoreKeyCommand(idOrName: string | undefined, key: string, opts?: {
|
|
38
|
+
json?: boolean;
|
|
39
|
+
}): Promise<void>;
|
|
30
40
|
export declare function deployAgentCommand(file?: string, opts?: DeployAgentOptions): Promise<void>;
|
|
31
41
|
export declare function validateAgentCommand(file?: string, opts?: {
|
|
32
42
|
json?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/commands/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAyBpC,UAAU,kBAAkB;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/commands/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAyBpC,UAAU,kBAAkB;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAYD,UAAU,gBAAgB;IACxB,IAAI,CAAC,E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,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA2C7F;AAED,wBAAsB,eAAe,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAqDjG;AAED,wBAAsB,WAAW,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAkG7F;AAED,wBAAsB,gBAAgB,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA8DlG"}
|
package/dist/commands/agent.js
CHANGED
|
@@ -41,6 +41,10 @@ exports.listAgentsCommand = listAgentsCommand;
|
|
|
41
41
|
exports.viewAgentCommand = viewAgentCommand;
|
|
42
42
|
exports.getAgentConfigCommand = getAgentConfigCommand;
|
|
43
43
|
exports.setAgentConfigCommand = setAgentConfigCommand;
|
|
44
|
+
exports.listStoreCommand = listStoreCommand;
|
|
45
|
+
exports.getStoreKeyCommand = getStoreKeyCommand;
|
|
46
|
+
exports.setStoreKeyCommand = setStoreKeyCommand;
|
|
47
|
+
exports.deleteStoreKeyCommand = deleteStoreKeyCommand;
|
|
44
48
|
exports.deployAgentCommand = deployAgentCommand;
|
|
45
49
|
exports.validateAgentCommand = validateAgentCommand;
|
|
46
50
|
exports.activateAgentCommand = activateAgentCommand;
|
|
@@ -150,12 +154,74 @@ function registerAgentCommand(program) {
|
|
|
150
154
|
const parsed = (0, agent_config_1.splitConfigSetArgs)(args || []);
|
|
151
155
|
await setAgentConfigCommand(parsed.idOrName, parsed.updates, opts);
|
|
152
156
|
});
|
|
157
|
+
// ── Store commands ──
|
|
158
|
+
const storeCommand = agent
|
|
159
|
+
.command('store')
|
|
160
|
+
.description('View and manage agent key-value store');
|
|
161
|
+
storeCommand
|
|
162
|
+
.argument('[id]', 'Agent ID or name')
|
|
163
|
+
.option('--json', 'Output as JSON')
|
|
164
|
+
.action(async (id, opts) => {
|
|
165
|
+
await listStoreCommand(id, opts);
|
|
166
|
+
});
|
|
167
|
+
storeCommand
|
|
168
|
+
.command('list [id]')
|
|
169
|
+
.description('List all store keys')
|
|
170
|
+
.option('--json', 'Output as JSON')
|
|
171
|
+
.action(async (id, opts) => {
|
|
172
|
+
await listStoreCommand(id, opts);
|
|
173
|
+
});
|
|
174
|
+
storeCommand
|
|
175
|
+
.command('get <idOrKey> [key]')
|
|
176
|
+
.description('Get a specific store key value')
|
|
177
|
+
.option('--json', 'Output as JSON')
|
|
178
|
+
.action(async (idOrKey, key, opts) => {
|
|
179
|
+
// If only one arg, it's the key — pick agent interactively
|
|
180
|
+
if (!key) {
|
|
181
|
+
await getStoreKeyCommand(undefined, idOrKey, opts);
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
await getStoreKeyCommand(idOrKey, key, opts);
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
storeCommand
|
|
188
|
+
.command('set <args...>')
|
|
189
|
+
.description('Set a store key value (value is JSON-parsed)')
|
|
190
|
+
.option('--json', 'Output as JSON')
|
|
191
|
+
.action(async (args, opts) => {
|
|
192
|
+
let parsed;
|
|
193
|
+
try {
|
|
194
|
+
parsed = parseStoreSetArgs(args);
|
|
195
|
+
}
|
|
196
|
+
catch (err) {
|
|
197
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
198
|
+
process.exitCode = 1;
|
|
199
|
+
if (opts?.json) {
|
|
200
|
+
(0, tty_1.outputJson)({ success: false, error: msg });
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
(0, ui_1.error)(msg);
|
|
204
|
+
}
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
await setStoreKeyCommand(parsed.idOrName, parsed.key, parsed.value, opts);
|
|
208
|
+
});
|
|
209
|
+
storeCommand
|
|
210
|
+
.command('delete <idOrKey> [key]')
|
|
211
|
+
.description('Delete a store key')
|
|
212
|
+
.option('--json', 'Output as JSON')
|
|
213
|
+
.action(async (idOrKey, key, opts) => {
|
|
214
|
+
if (!key) {
|
|
215
|
+
await deleteStoreKeyCommand(undefined, idOrKey, opts);
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
await deleteStoreKeyCommand(idOrKey, key, opts);
|
|
219
|
+
}
|
|
220
|
+
});
|
|
153
221
|
// suzi agents deploy [file]
|
|
154
222
|
agent
|
|
155
223
|
.command('deploy [file]')
|
|
156
224
|
.description('Deploy an agent from a TypeScript file')
|
|
157
|
-
.option('-t, --title <title>', 'Agent title')
|
|
158
|
-
.option('-d, --description <desc>', 'Agent description')
|
|
159
225
|
.option('--update <agentId>', 'Update an existing agent instead of creating new')
|
|
160
226
|
.option('--activate', 'Activate the agent after deploying')
|
|
161
227
|
.option('--json', 'Output as JSON')
|
|
@@ -787,6 +853,207 @@ async function setAgentConfigCommand(idOrName, updatesArgs = [], opts) {
|
|
|
787
853
|
console.log();
|
|
788
854
|
printUpdatedConfigValues(updatedKeys, configData.schema, updateResp.data.values);
|
|
789
855
|
}
|
|
856
|
+
// ── Store command helpers & implementations ──
|
|
857
|
+
function parseStoreSetArgs(args) {
|
|
858
|
+
if (args.length < 2) {
|
|
859
|
+
throw new Error('Usage: suzi agents store set [agent] <key> <value>');
|
|
860
|
+
}
|
|
861
|
+
if (args.length === 2) {
|
|
862
|
+
return { key: args[0], value: args[1] };
|
|
863
|
+
}
|
|
864
|
+
// 3+ args: first is agent id/name, second is key, rest is value
|
|
865
|
+
return { idOrName: args[0], key: args[1], value: args.slice(2).join(' ') };
|
|
866
|
+
}
|
|
867
|
+
function smartParseValue(raw) {
|
|
868
|
+
try {
|
|
869
|
+
return JSON.parse(raw);
|
|
870
|
+
}
|
|
871
|
+
catch {
|
|
872
|
+
return raw;
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
function truncateValue(val, max = 60) {
|
|
876
|
+
const str = typeof val === 'string' ? val : JSON.stringify(val);
|
|
877
|
+
if (str.length <= max)
|
|
878
|
+
return str;
|
|
879
|
+
return str.slice(0, max - 3) + '...';
|
|
880
|
+
}
|
|
881
|
+
function typeLabel(val) {
|
|
882
|
+
if (val === null)
|
|
883
|
+
return 'null';
|
|
884
|
+
if (Array.isArray(val))
|
|
885
|
+
return 'array';
|
|
886
|
+
return typeof val;
|
|
887
|
+
}
|
|
888
|
+
async function listStoreCommand(idOrName, opts) {
|
|
889
|
+
const jsonMode = opts?.json || false;
|
|
890
|
+
if (!(0, ui_1.requireAuth)(jsonMode))
|
|
891
|
+
return;
|
|
892
|
+
const agent = await (0, agent_picker_1.fetchAndPickAgent)(idOrName, jsonMode);
|
|
893
|
+
if (!agent)
|
|
894
|
+
return;
|
|
895
|
+
const spinner = (0, tty_1.createSpinner)('Fetching store...', jsonMode);
|
|
896
|
+
spinner?.start();
|
|
897
|
+
const resp = await (0, api_1.get)(`/api/agent/${agent.id}/store`);
|
|
898
|
+
if (!resp.ok) {
|
|
899
|
+
spinner?.fail();
|
|
900
|
+
process.exitCode = 1;
|
|
901
|
+
const msg = `Failed to fetch store: ${resp.data?.error || resp.status}`;
|
|
902
|
+
if (jsonMode) {
|
|
903
|
+
(0, tty_1.outputJson)({ success: false, error: msg });
|
|
904
|
+
}
|
|
905
|
+
else {
|
|
906
|
+
(0, ui_1.error)(msg);
|
|
907
|
+
}
|
|
908
|
+
return;
|
|
909
|
+
}
|
|
910
|
+
spinner?.succeed();
|
|
911
|
+
const store = resp.data.store;
|
|
912
|
+
const keys = Object.keys(store);
|
|
913
|
+
if (jsonMode) {
|
|
914
|
+
(0, tty_1.outputJson)({ success: true, data: { agentId: agent.id, store, updatedAt: resp.data.updatedAt } });
|
|
915
|
+
return;
|
|
916
|
+
}
|
|
917
|
+
(0, ui_1.header)(`Store: ${agent.title || agent.id}`);
|
|
918
|
+
if (keys.length === 0) {
|
|
919
|
+
(0, ui_1.info)('Store is empty.');
|
|
920
|
+
return;
|
|
921
|
+
}
|
|
922
|
+
const table = new cli_table3_1.default({
|
|
923
|
+
head: [chalk_1.default.gray('Key'), chalk_1.default.gray('Value'), chalk_1.default.gray('Type')],
|
|
924
|
+
style: { head: [], border: chalk_1.default.level > 0 ? ['gray'] : [] },
|
|
925
|
+
});
|
|
926
|
+
for (const k of keys) {
|
|
927
|
+
table.push([
|
|
928
|
+
chalk_1.default.bold(k),
|
|
929
|
+
truncateValue(store[k]),
|
|
930
|
+
ui_1.colors.muted(typeLabel(store[k])),
|
|
931
|
+
]);
|
|
932
|
+
}
|
|
933
|
+
console.log(table.toString());
|
|
934
|
+
console.log(ui_1.colors.muted(` ${keys.length} key${keys.length === 1 ? '' : 's'}`));
|
|
935
|
+
}
|
|
936
|
+
async function getStoreKeyCommand(idOrName, key, opts) {
|
|
937
|
+
const jsonMode = opts?.json || false;
|
|
938
|
+
if (!(0, ui_1.requireAuth)(jsonMode))
|
|
939
|
+
return;
|
|
940
|
+
const agent = await (0, agent_picker_1.fetchAndPickAgent)(idOrName, jsonMode);
|
|
941
|
+
if (!agent)
|
|
942
|
+
return;
|
|
943
|
+
const spinner = (0, tty_1.createSpinner)('Fetching key...', jsonMode);
|
|
944
|
+
spinner?.start();
|
|
945
|
+
const resp = await (0, api_1.get)(`/api/agent/${agent.id}/store?key=${encodeURIComponent(key)}`);
|
|
946
|
+
if (!resp.ok) {
|
|
947
|
+
spinner?.fail();
|
|
948
|
+
process.exitCode = 1;
|
|
949
|
+
const msg = `Failed to fetch store key: ${resp.data?.error || resp.status}`;
|
|
950
|
+
if (jsonMode) {
|
|
951
|
+
(0, tty_1.outputJson)({ success: false, error: msg });
|
|
952
|
+
}
|
|
953
|
+
else {
|
|
954
|
+
(0, ui_1.error)(msg);
|
|
955
|
+
}
|
|
956
|
+
return;
|
|
957
|
+
}
|
|
958
|
+
spinner?.succeed();
|
|
959
|
+
if (jsonMode) {
|
|
960
|
+
(0, tty_1.outputJson)({ success: true, data: { agentId: agent.id, ...resp.data } });
|
|
961
|
+
return;
|
|
962
|
+
}
|
|
963
|
+
if (!resp.data.exists) {
|
|
964
|
+
(0, ui_1.warn)(`Key "${key}" does not exist in store.`);
|
|
965
|
+
return;
|
|
966
|
+
}
|
|
967
|
+
const val = resp.data.value;
|
|
968
|
+
(0, ui_1.label)('Key', key);
|
|
969
|
+
if (typeof val === 'object' && val !== null) {
|
|
970
|
+
(0, ui_1.label)('Value', '');
|
|
971
|
+
console.log(JSON.stringify(val, null, 2));
|
|
972
|
+
}
|
|
973
|
+
else {
|
|
974
|
+
(0, ui_1.label)('Value', String(val));
|
|
975
|
+
}
|
|
976
|
+
(0, ui_1.label)('Type', typeLabel(val));
|
|
977
|
+
}
|
|
978
|
+
async function setStoreKeyCommand(idOrName, key, rawValue, opts) {
|
|
979
|
+
const jsonMode = opts?.json || false;
|
|
980
|
+
if (!(0, ui_1.requireAuth)(jsonMode))
|
|
981
|
+
return;
|
|
982
|
+
const agent = await (0, agent_picker_1.fetchAndPickAgent)(idOrName, jsonMode);
|
|
983
|
+
if (!agent)
|
|
984
|
+
return;
|
|
985
|
+
if (key === '__v') {
|
|
986
|
+
process.exitCode = 1;
|
|
987
|
+
if (jsonMode) {
|
|
988
|
+
(0, tty_1.outputJson)({ success: false, error: '__v is a reserved internal key' });
|
|
989
|
+
}
|
|
990
|
+
else {
|
|
991
|
+
(0, ui_1.error)('__v is a reserved internal key.');
|
|
992
|
+
}
|
|
993
|
+
return;
|
|
994
|
+
}
|
|
995
|
+
const value = smartParseValue(rawValue);
|
|
996
|
+
const spinner = (0, tty_1.createSpinner)('Setting key...', jsonMode);
|
|
997
|
+
spinner?.start();
|
|
998
|
+
const resp = await (0, api_1.put)(`/api/agent/${agent.id}/store`, { key, value });
|
|
999
|
+
if (!resp.ok) {
|
|
1000
|
+
spinner?.fail();
|
|
1001
|
+
process.exitCode = 1;
|
|
1002
|
+
const msg = `Failed to set store key: ${resp.data?.error || resp.status}`;
|
|
1003
|
+
if (jsonMode) {
|
|
1004
|
+
(0, tty_1.outputJson)({ success: false, error: msg });
|
|
1005
|
+
}
|
|
1006
|
+
else {
|
|
1007
|
+
(0, ui_1.error)(msg);
|
|
1008
|
+
}
|
|
1009
|
+
return;
|
|
1010
|
+
}
|
|
1011
|
+
spinner?.succeed();
|
|
1012
|
+
if (jsonMode) {
|
|
1013
|
+
(0, tty_1.outputJson)({ success: true, data: { agentId: agent.id, key, value } });
|
|
1014
|
+
return;
|
|
1015
|
+
}
|
|
1016
|
+
(0, ui_1.success)(`Set "${key}" = ${truncateValue(value)}`);
|
|
1017
|
+
}
|
|
1018
|
+
async function deleteStoreKeyCommand(idOrName, key, opts) {
|
|
1019
|
+
const jsonMode = opts?.json || false;
|
|
1020
|
+
if (!(0, ui_1.requireAuth)(jsonMode))
|
|
1021
|
+
return;
|
|
1022
|
+
const agent = await (0, agent_picker_1.fetchAndPickAgent)(idOrName, jsonMode);
|
|
1023
|
+
if (!agent)
|
|
1024
|
+
return;
|
|
1025
|
+
if (key === '__v') {
|
|
1026
|
+
process.exitCode = 1;
|
|
1027
|
+
if (jsonMode) {
|
|
1028
|
+
(0, tty_1.outputJson)({ success: false, error: '__v is a reserved internal key' });
|
|
1029
|
+
}
|
|
1030
|
+
else {
|
|
1031
|
+
(0, ui_1.error)('__v is a reserved internal key.');
|
|
1032
|
+
}
|
|
1033
|
+
return;
|
|
1034
|
+
}
|
|
1035
|
+
const spinner = (0, tty_1.createSpinner)('Deleting key...', jsonMode);
|
|
1036
|
+
spinner?.start();
|
|
1037
|
+
const resp = await (0, api_1.del)(`/api/agent/${agent.id}/store/${encodeURIComponent(key)}`);
|
|
1038
|
+
if (!resp.ok) {
|
|
1039
|
+
spinner?.fail();
|
|
1040
|
+
process.exitCode = 1;
|
|
1041
|
+
const msg = `Failed to delete store key: ${resp.data?.error || resp.status}`;
|
|
1042
|
+
if (jsonMode) {
|
|
1043
|
+
(0, tty_1.outputJson)({ success: false, error: msg });
|
|
1044
|
+
}
|
|
1045
|
+
else {
|
|
1046
|
+
(0, ui_1.error)(msg);
|
|
1047
|
+
}
|
|
1048
|
+
return;
|
|
1049
|
+
}
|
|
1050
|
+
spinner?.succeed();
|
|
1051
|
+
if (jsonMode) {
|
|
1052
|
+
(0, tty_1.outputJson)({ success: true, data: { agentId: agent.id, key } });
|
|
1053
|
+
return;
|
|
1054
|
+
}
|
|
1055
|
+
(0, ui_1.success)(`Deleted key "${key}".`);
|
|
1056
|
+
}
|
|
790
1057
|
async function deployAgentCommand(file, opts) {
|
|
791
1058
|
const jsonMode = opts?.json || false;
|
|
792
1059
|
if (!(0, ui_1.requireAuth)(jsonMode))
|
|
@@ -850,26 +1117,6 @@ async function deployAgentCommand(file, opts) {
|
|
|
850
1117
|
(0, ui_1.label)('Size', `${source.length} bytes`);
|
|
851
1118
|
console.log();
|
|
852
1119
|
}
|
|
853
|
-
// Determine title
|
|
854
|
-
let title = opts?.title;
|
|
855
|
-
if (!title && !opts?.update && !jsonMode && (0, tty_1.shouldUseInteractive)()) {
|
|
856
|
-
// Try to extract from source
|
|
857
|
-
const metaMatch = source.match(/name:\s*['"]([^'"]+)['"]/);
|
|
858
|
-
if (metaMatch) {
|
|
859
|
-
title = metaMatch[1];
|
|
860
|
-
}
|
|
861
|
-
else {
|
|
862
|
-
const answers = await inquirer_1.default.prompt([
|
|
863
|
-
{
|
|
864
|
-
type: 'input',
|
|
865
|
-
name: 'title',
|
|
866
|
-
message: 'Agent title:',
|
|
867
|
-
default: path_1.default.basename(resolvedPath, path_1.default.extname(resolvedPath)),
|
|
868
|
-
},
|
|
869
|
-
]);
|
|
870
|
-
title = answers.title;
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
1120
|
const spinner = (0, tty_1.createSpinner)('Deploying agent...', jsonMode);
|
|
874
1121
|
spinner?.start();
|
|
875
1122
|
try {
|
|
@@ -880,18 +1127,14 @@ async function deployAgentCommand(file, opts) {
|
|
|
880
1127
|
spinner.text = 'Updating agent...';
|
|
881
1128
|
resp = await (0, api_1.put)(`/api/agent/${opts.update}`, {
|
|
882
1129
|
code: source,
|
|
883
|
-
...(title ? { title } : {}),
|
|
884
|
-
...(opts?.description ? { description: opts.description } : {}),
|
|
885
1130
|
});
|
|
886
1131
|
}
|
|
887
1132
|
else {
|
|
888
|
-
// Create new agent
|
|
1133
|
+
// Create new agent (title/description derived from meta.name and meta.description in source)
|
|
889
1134
|
if (spinner)
|
|
890
1135
|
spinner.text = 'Creating agent...';
|
|
891
1136
|
resp = await (0, api_1.post)('/api/agent', {
|
|
892
1137
|
code: source,
|
|
893
|
-
title: title || 'CLI Agent',
|
|
894
|
-
...(opts?.description ? { description: opts.description } : {}),
|
|
895
1138
|
});
|
|
896
1139
|
}
|
|
897
1140
|
if (!resp.ok) {
|
|
@@ -988,6 +1231,13 @@ async function deployAgentCommand(file, opts) {
|
|
|
988
1231
|
console.log();
|
|
989
1232
|
(0, ui_1.info)('Run `suzi agents validate` for detailed validation.');
|
|
990
1233
|
}
|
|
1234
|
+
// Show compiler warnings (e.g. missing meta.description)
|
|
1235
|
+
if (agentData.warnings?.length > 0) {
|
|
1236
|
+
console.log();
|
|
1237
|
+
for (const w of agentData.warnings) {
|
|
1238
|
+
(0, ui_1.warn)(w);
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
991
1241
|
console.log();
|
|
992
1242
|
(0, ui_1.divider)();
|
|
993
1243
|
if (agentData.status === 'draft') {
|