suzi-cli 0.1.25 → 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/TEST_CHECKLIST.md +243 -0
- package/dist/commands/accounts.d.ts.map +1 -1
- package/dist/commands/accounts.js +68 -33
- package/dist/commands/accounts.js.map +1 -1
- package/dist/commands/agent.d.ts +12 -2
- package/dist/commands/agent.d.ts.map +1 -1
- package/dist/commands/agent.js +322 -72
- 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/debug.d.ts.map +1 -1
- package/dist/commands/debug.js +14 -14
- package/dist/commands/debug.js.map +1 -1
- package/dist/commands/env.d.ts.map +1 -1
- package/dist/commands/env.js +22 -21
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/feedback.js +4 -4
- package/dist/commands/feedback.js.map +1 -1
- package/dist/commands/import.js +13 -16
- package/dist/commands/import.js.map +1 -1
- package/dist/commands/list-actions.d.ts.map +1 -1
- package/dist/commands/list-actions.js +4 -4
- package/dist/commands/list-actions.js.map +1 -1
- package/dist/commands/list-triggers.d.ts.map +1 -1
- package/dist/commands/list-triggers.js +3 -3
- package/dist/commands/list-triggers.js.map +1 -1
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +7 -6
- package/dist/commands/login.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/portfolio.d.ts.map +1 -1
- package/dist/commands/portfolio.js +105 -6
- package/dist/commands/portfolio.js.map +1 -1
- package/dist/commands/preferences.d.ts.map +1 -1
- package/dist/commands/preferences.js +7 -6
- package/dist/commands/preferences.js.map +1 -1
- 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/run.d.ts.map +1 -1
- package/dist/commands/run.js +16 -13
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/share.d.ts.map +1 -1
- package/dist/commands/share.js +48 -24
- package/dist/commands/share.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/commands/transactions.d.ts.map +1 -1
- package/dist/commands/transactions.js +7 -9
- package/dist/commands/transactions.js.map +1 -1
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -1
- package/dist/types/portfolio.d.ts +9 -0
- package/dist/types/portfolio.d.ts.map +1 -1
- package/dist/utils/tty.d.ts +15 -3
- package/dist/utils/tty.d.ts.map +1 -1
- package/dist/utils/tty.js +54 -5
- package/dist/utils/tty.js.map +1 -1
- package/dist/utils/ui.d.ts +1 -1
- package/dist/utils/ui.d.ts.map +1 -1
- package/dist/utils/ui.js +17 -6
- package/dist/utils/ui.js.map +1 -1
- package/package.json +1 -1
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')
|
|
@@ -311,9 +377,9 @@ function registerAgentCommand(program) {
|
|
|
311
377
|
// Command Implementations
|
|
312
378
|
// ============================================================================
|
|
313
379
|
async function listAgentsCommand(opts) {
|
|
314
|
-
if (!(0, ui_1.requireAuth)())
|
|
315
|
-
return;
|
|
316
380
|
const jsonMode = opts?.json || false;
|
|
381
|
+
if (!(0, ui_1.requireAuth)(jsonMode))
|
|
382
|
+
return;
|
|
317
383
|
const spinner = (0, tty_1.createSpinner)('Loading agents...', jsonMode);
|
|
318
384
|
spinner?.start();
|
|
319
385
|
const resp = await (0, api_1.get)('/api/agent?limit=50');
|
|
@@ -350,7 +416,7 @@ async function listAgentsCommand(opts) {
|
|
|
350
416
|
chalk_1.default.gray('ID'),
|
|
351
417
|
chalk_1.default.gray('Created'),
|
|
352
418
|
],
|
|
353
|
-
style: { head: [], border: ['gray'] },
|
|
419
|
+
style: { head: [], border: chalk_1.default.level > 0 ? ['gray'] : [] },
|
|
354
420
|
});
|
|
355
421
|
for (let i = 0; i < agentList.length; i++) {
|
|
356
422
|
const agent = agentList[i];
|
|
@@ -365,9 +431,9 @@ async function listAgentsCommand(opts) {
|
|
|
365
431
|
console.log(table.toString());
|
|
366
432
|
}
|
|
367
433
|
async function viewAgentCommand(idOrName, opts) {
|
|
368
|
-
if (!(0, ui_1.requireAuth)())
|
|
369
|
-
return;
|
|
370
434
|
const jsonMode = opts?.json || false;
|
|
435
|
+
if (!(0, ui_1.requireAuth)(jsonMode))
|
|
436
|
+
return;
|
|
371
437
|
const agent = await (0, agent_picker_1.fetchAndPickAgent)(idOrName, jsonMode);
|
|
372
438
|
if (!agent)
|
|
373
439
|
return;
|
|
@@ -497,7 +563,7 @@ function printAgentConfig(agent, configData) {
|
|
|
497
563
|
chalk_1.default.gray('Default'),
|
|
498
564
|
chalk_1.default.gray('Constraints'),
|
|
499
565
|
],
|
|
500
|
-
style: { head: [], border: ['gray'] },
|
|
566
|
+
style: { head: [], border: chalk_1.default.level > 0 ? ['gray'] : [] },
|
|
501
567
|
wordWrap: true,
|
|
502
568
|
});
|
|
503
569
|
for (const [key, field] of schemaEntries) {
|
|
@@ -525,7 +591,7 @@ function printAgentConfig(agent, configData) {
|
|
|
525
591
|
chalk_1.default.gray('Need'),
|
|
526
592
|
chalk_1.default.gray('Description'),
|
|
527
593
|
],
|
|
528
|
-
style: { head: [], border: ['gray'] },
|
|
594
|
+
style: { head: [], border: chalk_1.default.level > 0 ? ['gray'] : [] },
|
|
529
595
|
wordWrap: true,
|
|
530
596
|
});
|
|
531
597
|
for (const [name, requirement] of requirementEntries) {
|
|
@@ -567,9 +633,9 @@ async function fetchAgentConfig(agentId, jsonMode) {
|
|
|
567
633
|
return resp.data;
|
|
568
634
|
}
|
|
569
635
|
async function getAgentConfigCommand(idOrName, opts) {
|
|
570
|
-
if (!(0, ui_1.requireAuth)())
|
|
571
|
-
return;
|
|
572
636
|
const jsonMode = opts?.json || false;
|
|
637
|
+
if (!(0, ui_1.requireAuth)(jsonMode))
|
|
638
|
+
return;
|
|
573
639
|
const agent = await (0, agent_picker_1.fetchAndPickAgent)(idOrName, jsonMode);
|
|
574
640
|
if (!agent)
|
|
575
641
|
return;
|
|
@@ -595,7 +661,7 @@ function printUpdatedConfigValues(updatedKeys, schema, values) {
|
|
|
595
661
|
chalk_1.default.gray('Saved Value'),
|
|
596
662
|
chalk_1.default.gray('Type'),
|
|
597
663
|
],
|
|
598
|
-
style: { head: [], border: ['gray'] },
|
|
664
|
+
style: { head: [], border: chalk_1.default.level > 0 ? ['gray'] : [] },
|
|
599
665
|
});
|
|
600
666
|
for (const key of updatedKeys) {
|
|
601
667
|
table.push([
|
|
@@ -607,9 +673,9 @@ function printUpdatedConfigValues(updatedKeys, schema, values) {
|
|
|
607
673
|
console.log(table.toString());
|
|
608
674
|
}
|
|
609
675
|
async function setAgentConfigCommand(idOrName, updatesArgs = [], opts) {
|
|
610
|
-
if (!(0, ui_1.requireAuth)())
|
|
611
|
-
return;
|
|
612
676
|
const jsonMode = opts?.json || false;
|
|
677
|
+
if (!(0, ui_1.requireAuth)(jsonMode))
|
|
678
|
+
return;
|
|
613
679
|
const agent = await (0, agent_picker_1.fetchAndPickAgent)(idOrName, jsonMode);
|
|
614
680
|
if (!agent)
|
|
615
681
|
return;
|
|
@@ -787,10 +853,211 @@ async function setAgentConfigCommand(idOrName, updatesArgs = [], opts) {
|
|
|
787
853
|
console.log();
|
|
788
854
|
printUpdatedConfigValues(updatedKeys, configData.schema, updateResp.data.values);
|
|
789
855
|
}
|
|
790
|
-
|
|
791
|
-
|
|
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
|
+
}
|
|
792
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) {
|
|
793
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
|
+
}
|
|
1057
|
+
async function deployAgentCommand(file, opts) {
|
|
1058
|
+
const jsonMode = opts?.json || false;
|
|
1059
|
+
if (!(0, ui_1.requireAuth)(jsonMode))
|
|
1060
|
+
return;
|
|
794
1061
|
// Find the agent file
|
|
795
1062
|
let filePath = file;
|
|
796
1063
|
if (!filePath) {
|
|
@@ -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') {
|
|
@@ -1007,9 +1257,9 @@ async function deployAgentCommand(file, opts) {
|
|
|
1007
1257
|
}
|
|
1008
1258
|
}
|
|
1009
1259
|
async function validateAgentCommand(file, opts) {
|
|
1010
|
-
if (!(0, ui_1.requireAuth)())
|
|
1011
|
-
return;
|
|
1012
1260
|
const jsonMode = opts?.json || false;
|
|
1261
|
+
if (!(0, ui_1.requireAuth)(jsonMode))
|
|
1262
|
+
return;
|
|
1013
1263
|
// Resolve file path
|
|
1014
1264
|
let filePath = file;
|
|
1015
1265
|
if (!filePath && !jsonMode && (0, tty_1.shouldUseInteractive)()) {
|
|
@@ -1193,9 +1443,9 @@ async function validateAgentCommand(file, opts) {
|
|
|
1193
1443
|
}
|
|
1194
1444
|
}
|
|
1195
1445
|
async function activateAgentCommand(idOrName, opts) {
|
|
1196
|
-
if (!(0, ui_1.requireAuth)())
|
|
1197
|
-
return;
|
|
1198
1446
|
const jsonMode = opts?.json || false;
|
|
1447
|
+
if (!(0, ui_1.requireAuth)(jsonMode))
|
|
1448
|
+
return;
|
|
1199
1449
|
const agent = await (0, agent_picker_1.fetchAndPickAgent)(idOrName, jsonMode);
|
|
1200
1450
|
if (!agent)
|
|
1201
1451
|
return;
|
|
@@ -1220,9 +1470,9 @@ async function activateAgentCommand(idOrName, opts) {
|
|
|
1220
1470
|
}
|
|
1221
1471
|
}
|
|
1222
1472
|
async function deactivateAgentCommand(idOrName, opts) {
|
|
1223
|
-
if (!(0, ui_1.requireAuth)())
|
|
1224
|
-
return;
|
|
1225
1473
|
const jsonMode = opts?.json || false;
|
|
1474
|
+
if (!(0, ui_1.requireAuth)(jsonMode))
|
|
1475
|
+
return;
|
|
1226
1476
|
const agent = await (0, agent_picker_1.fetchAndPickAgent)(idOrName, jsonMode);
|
|
1227
1477
|
if (!agent)
|
|
1228
1478
|
return;
|
|
@@ -1262,9 +1512,9 @@ async function deactivateAgentCommand(idOrName, opts) {
|
|
|
1262
1512
|
}
|
|
1263
1513
|
}
|
|
1264
1514
|
async function executeAgentCommand(idOrName, trigger, opts) {
|
|
1265
|
-
if (!(0, ui_1.requireAuth)())
|
|
1266
|
-
return;
|
|
1267
1515
|
const jsonMode = opts?.json || false;
|
|
1516
|
+
if (!(0, ui_1.requireAuth)(jsonMode))
|
|
1517
|
+
return;
|
|
1268
1518
|
const agent = await (0, agent_picker_1.fetchAndPickAgent)(idOrName, jsonMode);
|
|
1269
1519
|
if (!agent)
|
|
1270
1520
|
return;
|
|
@@ -1345,9 +1595,9 @@ async function executeAgentCommand(idOrName, trigger, opts) {
|
|
|
1345
1595
|
}
|
|
1346
1596
|
}
|
|
1347
1597
|
async function logsAgentCommand(idOrName, opts) {
|
|
1348
|
-
if (!(0, ui_1.requireAuth)())
|
|
1349
|
-
return;
|
|
1350
1598
|
const jsonMode = opts?.json || false;
|
|
1599
|
+
if (!(0, ui_1.requireAuth)(jsonMode))
|
|
1600
|
+
return;
|
|
1351
1601
|
const agent = await (0, agent_picker_1.fetchAndPickAgent)(idOrName, jsonMode);
|
|
1352
1602
|
if (!agent)
|
|
1353
1603
|
return;
|
|
@@ -1393,9 +1643,9 @@ async function logsAgentCommand(idOrName, opts) {
|
|
|
1393
1643
|
}
|
|
1394
1644
|
}
|
|
1395
1645
|
async function codeAgentCommand(idOrName, opts) {
|
|
1396
|
-
if (!(0, ui_1.requireAuth)())
|
|
1397
|
-
return;
|
|
1398
1646
|
const jsonMode = opts?.json || false;
|
|
1647
|
+
if (!(0, ui_1.requireAuth)(jsonMode))
|
|
1648
|
+
return;
|
|
1399
1649
|
const agent = await (0, agent_picker_1.fetchAndPickAgent)(idOrName, jsonMode);
|
|
1400
1650
|
if (!agent)
|
|
1401
1651
|
return;
|
|
@@ -1440,9 +1690,9 @@ async function codeAgentCommand(idOrName, opts) {
|
|
|
1440
1690
|
console.log(ui_1.colors.muted(` ${lines.length} lines`));
|
|
1441
1691
|
}
|
|
1442
1692
|
async function deleteAgentCommand(idOrName, opts) {
|
|
1443
|
-
if (!(0, ui_1.requireAuth)())
|
|
1444
|
-
return;
|
|
1445
1693
|
const jsonMode = opts?.json || false;
|
|
1694
|
+
if (!(0, ui_1.requireAuth)(jsonMode))
|
|
1695
|
+
return;
|
|
1446
1696
|
const agent = await (0, agent_picker_1.fetchAndPickAgent)(idOrName, jsonMode);
|
|
1447
1697
|
if (!agent)
|
|
1448
1698
|
return;
|
|
@@ -1486,9 +1736,9 @@ async function deleteAgentCommand(idOrName, opts) {
|
|
|
1486
1736
|
// Git Version Control Commands
|
|
1487
1737
|
// ============================================================================
|
|
1488
1738
|
async function historyCommand(idOrName, opts) {
|
|
1489
|
-
if (!(0, ui_1.requireAuth)())
|
|
1490
|
-
return;
|
|
1491
1739
|
const jsonMode = opts?.json || false;
|
|
1740
|
+
if (!(0, ui_1.requireAuth)(jsonMode))
|
|
1741
|
+
return;
|
|
1492
1742
|
const agent = await (0, agent_picker_1.fetchAndPickAgent)(idOrName, jsonMode);
|
|
1493
1743
|
if (!agent)
|
|
1494
1744
|
return;
|
|
@@ -1531,9 +1781,9 @@ async function historyCommand(idOrName, opts) {
|
|
|
1531
1781
|
console.log(ui_1.colors.muted(` ${commits.length} commit(s)`));
|
|
1532
1782
|
}
|
|
1533
1783
|
async function diffCommand(idOrName, sha, opts) {
|
|
1534
|
-
if (!(0, ui_1.requireAuth)())
|
|
1535
|
-
return;
|
|
1536
1784
|
const jsonMode = opts?.json || false;
|
|
1785
|
+
if (!(0, ui_1.requireAuth)(jsonMode))
|
|
1786
|
+
return;
|
|
1537
1787
|
const agent = await (0, agent_picker_1.fetchAndPickAgent)(idOrName, jsonMode);
|
|
1538
1788
|
if (!agent)
|
|
1539
1789
|
return;
|
|
@@ -1617,9 +1867,9 @@ async function diffCommand(idOrName, sha, opts) {
|
|
|
1617
1867
|
}
|
|
1618
1868
|
}
|
|
1619
1869
|
async function versionCommand(idOrName, sha, opts) {
|
|
1620
|
-
if (!(0, ui_1.requireAuth)())
|
|
1621
|
-
return;
|
|
1622
1870
|
const jsonMode = opts?.json || false;
|
|
1871
|
+
if (!(0, ui_1.requireAuth)(jsonMode))
|
|
1872
|
+
return;
|
|
1623
1873
|
const agent = await (0, agent_picker_1.fetchAndPickAgent)(idOrName, jsonMode);
|
|
1624
1874
|
if (!agent)
|
|
1625
1875
|
return;
|
|
@@ -1688,9 +1938,9 @@ async function versionCommand(idOrName, sha, opts) {
|
|
|
1688
1938
|
console.log(ui_1.colors.muted(` ${lines.length} lines`));
|
|
1689
1939
|
}
|
|
1690
1940
|
async function checkoutCommand(idOrName, sha, opts) {
|
|
1691
|
-
if (!(0, ui_1.requireAuth)())
|
|
1692
|
-
return;
|
|
1693
1941
|
const jsonMode = opts?.json || false;
|
|
1942
|
+
if (!(0, ui_1.requireAuth)(jsonMode))
|
|
1943
|
+
return;
|
|
1694
1944
|
const agent = await (0, agent_picker_1.fetchAndPickAgent)(idOrName, jsonMode);
|
|
1695
1945
|
if (!agent)
|
|
1696
1946
|
return;
|
|
@@ -1762,9 +2012,9 @@ async function checkoutCommand(idOrName, sha, opts) {
|
|
|
1762
2012
|
}
|
|
1763
2013
|
}
|
|
1764
2014
|
async function forkCommand(idOrName, opts) {
|
|
1765
|
-
if (!(0, ui_1.requireAuth)())
|
|
1766
|
-
return;
|
|
1767
2015
|
const jsonMode = opts?.json || false;
|
|
2016
|
+
if (!(0, ui_1.requireAuth)(jsonMode))
|
|
2017
|
+
return;
|
|
1768
2018
|
const agent = await (0, agent_picker_1.fetchAndPickAgent)(idOrName, jsonMode);
|
|
1769
2019
|
if (!agent)
|
|
1770
2020
|
return;
|
|
@@ -1800,9 +2050,9 @@ async function forkCommand(idOrName, opts) {
|
|
|
1800
2050
|
(0, ui_1.divider)();
|
|
1801
2051
|
}
|
|
1802
2052
|
async function upstreamCommand(idOrName, opts) {
|
|
1803
|
-
if (!(0, ui_1.requireAuth)())
|
|
1804
|
-
return;
|
|
1805
2053
|
const jsonMode = opts?.json || false;
|
|
2054
|
+
if (!(0, ui_1.requireAuth)(jsonMode))
|
|
2055
|
+
return;
|
|
1806
2056
|
const agent = await (0, agent_picker_1.fetchAndPickAgent)(idOrName, jsonMode);
|
|
1807
2057
|
if (!agent)
|
|
1808
2058
|
return;
|
|
@@ -1847,9 +2097,9 @@ async function upstreamCommand(idOrName, opts) {
|
|
|
1847
2097
|
}
|
|
1848
2098
|
}
|
|
1849
2099
|
async function pullCommand(idOrName, opts) {
|
|
1850
|
-
if (!(0, ui_1.requireAuth)())
|
|
1851
|
-
return;
|
|
1852
2100
|
const jsonMode = opts?.json || false;
|
|
2101
|
+
if (!(0, ui_1.requireAuth)(jsonMode))
|
|
2102
|
+
return;
|
|
1853
2103
|
const agent = await (0, agent_picker_1.fetchAndPickAgent)(idOrName, jsonMode);
|
|
1854
2104
|
if (!agent)
|
|
1855
2105
|
return;
|
|
@@ -1938,9 +2188,9 @@ async function pullCommand(idOrName, opts) {
|
|
|
1938
2188
|
(0, ui_1.info)(`Pull result: ${result.status || 'unknown'}`);
|
|
1939
2189
|
}
|
|
1940
2190
|
async function listForksCommand(idOrName, opts) {
|
|
1941
|
-
if (!(0, ui_1.requireAuth)())
|
|
1942
|
-
return;
|
|
1943
2191
|
const jsonMode = opts?.json || false;
|
|
2192
|
+
if (!(0, ui_1.requireAuth)(jsonMode))
|
|
2193
|
+
return;
|
|
1944
2194
|
const agent = await (0, agent_picker_1.fetchAndPickAgent)(idOrName, jsonMode);
|
|
1945
2195
|
if (!agent)
|
|
1946
2196
|
return;
|
|
@@ -1979,7 +2229,7 @@ async function listForksCommand(idOrName, opts) {
|
|
|
1979
2229
|
chalk_1.default.gray('Last Synced'),
|
|
1980
2230
|
chalk_1.default.gray('Created'),
|
|
1981
2231
|
],
|
|
1982
|
-
style: { head: [], border: ['gray'] },
|
|
2232
|
+
style: { head: [], border: chalk_1.default.level > 0 ? ['gray'] : [] },
|
|
1983
2233
|
});
|
|
1984
2234
|
for (let i = 0; i < forks.length; i++) {
|
|
1985
2235
|
const f = forks[i];
|