@skrr-ai/cli 0.1.36 → 0.1.38
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/README.md +17 -4
- package/bin/dev-fallback.js +167 -4
- package/dist/base-command.js +46 -2
- package/dist/commands/agents/actions/create.d.ts +5 -0
- package/dist/commands/agents/actions/create.js +42 -5
- package/dist/commands/agents/actions/delete.d.ts +1 -0
- package/dist/commands/agents/actions/delete.js +7 -0
- package/dist/commands/agents/actions/update.d.ts +5 -0
- package/dist/commands/agents/actions/update.js +27 -1
- package/dist/commands/agents/api-actions/add.d.ts +41 -0
- package/dist/commands/agents/api-actions/add.js +205 -0
- package/dist/commands/agents/api-actions/index.d.ts +39 -0
- package/dist/commands/agents/api-actions/index.js +103 -0
- package/dist/commands/agents/api-actions/remove.d.ts +14 -0
- package/dist/commands/agents/api-actions/remove.js +36 -0
- package/dist/commands/agents/avatar/default/apply.d.ts +25 -0
- package/dist/commands/agents/avatar/default/apply.js +56 -0
- package/dist/commands/agents/avatar/default/index.d.ts +29 -0
- package/dist/commands/agents/avatar/default/index.js +61 -0
- package/dist/commands/agents/avatar/default/set.d.ts +24 -0
- package/dist/commands/agents/avatar/default/set.js +120 -0
- package/dist/commands/agents/avatar/library/delete.d.ts +20 -0
- package/dist/commands/agents/avatar/library/delete.js +47 -0
- package/dist/commands/agents/avatar/library/index.d.ts +16 -0
- package/dist/commands/agents/avatar/library/index.js +56 -0
- package/dist/commands/agents/avatar/presets.d.ts +19 -0
- package/dist/commands/agents/avatar/presets.js +56 -0
- package/dist/commands/agents/avatar/upload.js +7 -1
- package/dist/commands/agents/categories/create.d.ts +14 -0
- package/dist/commands/agents/categories/create.js +46 -0
- package/dist/commands/agents/categories/delete.d.ts +13 -0
- package/dist/commands/agents/categories/delete.js +41 -0
- package/dist/commands/agents/categories/index.d.ts +36 -0
- package/dist/commands/agents/categories/index.js +135 -0
- package/dist/commands/agents/categories/update.d.ts +22 -0
- package/dist/commands/agents/categories/update.js +59 -0
- package/dist/commands/agents/chat.d.ts +21 -0
- package/dist/commands/agents/chat.js +94 -7
- package/dist/commands/agents/create.d.ts +10 -0
- package/dist/commands/agents/create.js +64 -3
- package/dist/commands/agents/ensure-default.d.ts +27 -0
- package/dist/commands/agents/ensure-default.js +65 -0
- package/dist/commands/agents/list.d.ts +15 -0
- package/dist/commands/agents/list.js +31 -1
- package/dist/commands/agents/mute.d.ts +16 -0
- package/dist/commands/agents/mute.js +38 -0
- package/dist/commands/agents/pin.d.ts +16 -0
- package/dist/commands/agents/pin.js +38 -0
- package/dist/commands/agents/scene-background/upload.d.ts +30 -0
- package/dist/commands/agents/scene-background/upload.js +97 -0
- package/dist/commands/agents/show.js +13 -0
- package/dist/commands/agents/tools/auth.d.ts +19 -0
- package/dist/commands/agents/tools/auth.js +41 -0
- package/dist/commands/agents/tools/calls.d.ts +36 -0
- package/dist/commands/agents/tools/calls.js +117 -0
- package/dist/commands/agents/tools/index.d.ts +20 -0
- package/dist/commands/agents/tools/index.js +77 -0
- package/dist/commands/agents/unmute.d.ts +16 -0
- package/dist/commands/agents/unmute.js +38 -0
- package/dist/commands/agents/unpin.d.ts +16 -0
- package/dist/commands/agents/unpin.js +38 -0
- package/dist/commands/agents/update.d.ts +12 -0
- package/dist/commands/agents/update.js +74 -3
- package/dist/commands/code/{oversky-agent.d.ts → skrr-agent.d.ts} +3 -3
- package/dist/commands/code/{oversky-agent.js → skrr-agent.js} +11 -8
- package/dist/commands/convos/messages.d.ts +13 -0
- package/dist/commands/convos/messages.js +40 -16
- package/dist/commands/daemon/index.js +8 -1
- package/dist/commands/daemon/logs.d.ts +26 -0
- package/dist/commands/daemon/logs.js +56 -0
- package/dist/commands/daemon/uninstall.js +1 -1
- package/dist/commands/followups/act.d.ts +22 -0
- package/dist/commands/followups/act.js +103 -0
- package/dist/commands/followups/cancel.d.ts +20 -0
- package/dist/commands/followups/cancel.js +50 -0
- package/dist/commands/followups/checkin.d.ts +27 -0
- package/dist/commands/followups/checkin.js +107 -0
- package/dist/commands/followups/list.d.ts +24 -0
- package/dist/commands/followups/list.js +90 -0
- package/dist/commands/followups/observability.d.ts +23 -0
- package/dist/commands/followups/observability.js +114 -0
- package/dist/commands/followups/remind.d.ts +26 -0
- package/dist/commands/followups/remind.js +106 -0
- package/dist/commands/followups/reschedule.d.ts +15 -0
- package/dist/commands/followups/reschedule.js +48 -0
- package/dist/commands/followups/resolve.d.ts +23 -0
- package/dist/commands/followups/resolve.js +54 -0
- package/dist/commands/followups/show.d.ts +12 -0
- package/dist/commands/followups/show.js +46 -0
- package/dist/commands/followups/watch.d.ts +51 -0
- package/dist/commands/followups/watch.js +211 -0
- package/dist/commands/goals/labels/add.js +19 -2
- package/dist/commands/goals/labels/remove.js +22 -2
- package/dist/commands/harnesses/forget.js +28 -0
- package/dist/commands/harnesses/install.d.ts +41 -0
- package/dist/commands/harnesses/install.js +165 -0
- package/dist/commands/harnesses/installers.d.ts +45 -0
- package/dist/commands/harnesses/installers.js +155 -0
- package/dist/commands/harnesses/list.d.ts +82 -1
- package/dist/commands/harnesses/list.js +104 -12
- package/dist/commands/harnesses/models.js +10 -1
- package/dist/commands/harnesses/show.d.ts +15 -0
- package/dist/commands/harnesses/show.js +44 -3
- package/dist/commands/harnesses/update.js +1 -1
- package/dist/commands/harnesses/usage.d.ts +25 -0
- package/dist/commands/harnesses/usage.js +24 -2
- package/dist/commands/instructions/status.js +13 -1
- package/dist/commands/labels/list.d.ts +24 -1
- package/dist/commands/labels/list.js +62 -19
- package/dist/commands/machines/dedicated/catalog.js +4 -15
- package/dist/commands/machines/dedicated/create.d.ts +8 -0
- package/dist/commands/machines/dedicated/create.js +58 -1
- package/dist/commands/machines/dedicated/destroy.js +18 -4
- package/dist/commands/machines/dedicated/list.js +9 -6
- package/dist/commands/machines/hosted/list.js +12 -0
- package/dist/commands/machines/list.js +11 -0
- package/dist/commands/machines/show.d.ts +1 -0
- package/dist/commands/machines/show.js +40 -11
- package/dist/commands/memory/governance/index.d.ts +21 -0
- package/dist/commands/memory/governance/index.js +64 -0
- package/dist/commands/memory/governance/set.d.ts +24 -0
- package/dist/commands/memory/governance/set.js +95 -0
- package/dist/commands/memory/provenance.d.ts +18 -0
- package/dist/commands/memory/provenance.js +66 -0
- package/dist/commands/profiles/list.d.ts +23 -0
- package/dist/commands/profiles/list.js +96 -0
- package/dist/commands/search/skills.d.ts +11 -1
- package/dist/commands/search/skills.js +26 -8
- package/dist/commands/skills/details.d.ts +2 -0
- package/dist/commands/skills/details.js +24 -1
- package/dist/commands/skills/import-as-actions.d.ts +32 -0
- package/dist/commands/skills/import-as-actions.js +175 -0
- package/dist/commands/skills/install.d.ts +2 -0
- package/dist/commands/skills/install.js +24 -1
- package/dist/commands/skills/invocable.js +6 -2
- package/dist/commands/skills/local.d.ts +40 -0
- package/dist/commands/skills/local.js +160 -0
- package/dist/commands/skills/search.d.ts +11 -1
- package/dist/commands/skills/search.js +29 -8
- package/dist/commands/spaces/actions/add.js +23 -5
- package/dist/commands/spaces/actions/available.js +3 -0
- package/dist/commands/spaces/actions/list.d.ts +5 -0
- package/dist/commands/spaces/actions/list.js +49 -3
- package/dist/commands/spaces/actions/run.d.ts +28 -0
- package/dist/commands/spaces/actions/run.js +146 -0
- package/dist/commands/spaces/actions/update.js +27 -5
- package/dist/commands/spaces/create.d.ts +3 -0
- package/dist/commands/spaces/create.js +32 -2
- package/dist/commands/spaces/label-summaries.d.ts +27 -0
- package/dist/commands/spaces/label-summaries.js +64 -0
- package/dist/commands/spaces/labels/add.js +19 -2
- package/dist/commands/spaces/labels/remove.js +22 -2
- package/dist/commands/spaces/show.js +2 -0
- package/dist/commands/spaces/task-rollups.d.ts +5 -0
- package/dist/commands/spaces/task-rollups.js +15 -4
- package/dist/commands/spaces/update.d.ts +5 -0
- package/dist/commands/spaces/update.js +41 -4
- package/dist/commands/spaces/workflows/lifecycle-diagnostics.d.ts +11 -0
- package/dist/commands/spaces/workflows/lifecycle-diagnostics.js +105 -0
- package/dist/commands/tasks/actions/attach.js +32 -7
- package/dist/commands/tasks/complete.d.ts +1 -0
- package/dist/commands/tasks/complete.js +21 -1
- package/dist/commands/tasks/create.d.ts +3 -0
- package/dist/commands/tasks/create.js +34 -2
- package/dist/commands/tasks/events/append.js +29 -6
- package/dist/commands/tasks/expectations/assess.d.ts +12 -0
- package/dist/commands/tasks/expectations/assess.js +123 -14
- package/dist/commands/tasks/expectations.js +95 -17
- package/dist/commands/tasks/follow-up.js +2 -2
- package/dist/commands/tasks/labels/attach.js +20 -3
- package/dist/commands/tasks/labels/detach.js +21 -3
- package/dist/commands/tasks/lifecycle/attach.d.ts +14 -0
- package/dist/commands/tasks/lifecycle/attach.js +47 -0
- package/dist/commands/tasks/lifecycle/definitions.d.ts +11 -0
- package/dist/commands/tasks/lifecycle/definitions.js +59 -0
- package/dist/commands/tasks/lifecycle/detach.d.ts +19 -0
- package/dist/commands/tasks/lifecycle/detach.js +72 -0
- package/dist/commands/tasks/lifecycle/history.d.ts +13 -0
- package/dist/commands/tasks/lifecycle/history.js +38 -0
- package/dist/commands/tasks/lifecycle/migrate.d.ts +14 -0
- package/dist/commands/tasks/lifecycle/migrate.js +68 -0
- package/dist/commands/tasks/lifecycle/reconcile.d.ts +11 -0
- package/dist/commands/tasks/lifecycle/reconcile.js +27 -0
- package/dist/commands/tasks/lifecycle/reopen.d.ts +15 -0
- package/dist/commands/tasks/lifecycle/reopen.js +71 -0
- package/dist/commands/tasks/lifecycle/show.d.ts +11 -0
- package/dist/commands/tasks/lifecycle/show.js +27 -0
- package/dist/commands/tasks/lifecycle/start.d.ts +12 -0
- package/dist/commands/tasks/lifecycle/start.js +30 -0
- package/dist/commands/tasks/lifecycle/transition.d.ts +15 -0
- package/dist/commands/tasks/lifecycle/transition.js +109 -0
- package/dist/commands/tasks/list.js +16 -9
- package/dist/commands/tasks/move.d.ts +1 -0
- package/dist/commands/tasks/move.js +29 -0
- package/dist/commands/tasks/result/submit.js +11 -1
- package/dist/commands/tasks/review-queue.d.ts +44 -0
- package/dist/commands/tasks/review-queue.js +314 -0
- package/dist/commands/tasks/show.d.ts +11 -0
- package/dist/commands/tasks/show.js +139 -4
- package/dist/commands/tasks/trust.js +7 -2
- package/dist/commands/tasks/update.d.ts +1 -0
- package/dist/commands/tasks/update.js +83 -0
- package/dist/commands/tasks/updates/add.js +1 -1
- package/dist/commands/token/list.d.ts +22 -0
- package/dist/commands/token/list.js +68 -0
- package/dist/commands/token/revoke.d.ts +23 -0
- package/dist/commands/token/revoke.js +53 -0
- package/dist/lib/agent-actions.d.ts +92 -11
- package/dist/lib/agent-actions.js +171 -25
- package/dist/lib/agent-config.d.ts +11 -0
- package/dist/lib/agent-config.js +85 -3
- package/dist/lib/agent-pin-mute.d.ts +29 -0
- package/dist/lib/agent-pin-mute.js +30 -0
- package/dist/lib/agent-visual-refs.d.ts +33 -0
- package/dist/lib/agent-visual-refs.js +267 -0
- package/dist/lib/agentic-stream.d.ts +6 -0
- package/dist/lib/agentic-stream.js +34 -3
- package/dist/lib/assignee-resolver.d.ts +1 -1
- package/dist/lib/assignee-resolver.js +8 -0
- package/dist/lib/bulk-task-targets.d.ts +12 -0
- package/dist/lib/bulk-task-targets.js +34 -1
- package/dist/lib/cli-installers.d.ts +130 -0
- package/dist/lib/cli-installers.js +145 -0
- package/dist/lib/command-miss.js +55 -7
- package/dist/lib/dedicated-lease-command.d.ts +13 -0
- package/dist/lib/dedicated-lease-command.js +22 -1
- package/dist/lib/dedicated-machines.d.ts +95 -1
- package/dist/lib/dedicated-machines.js +236 -2
- package/dist/lib/failed-lookup.d.ts +3 -0
- package/dist/lib/failed-lookup.js +40 -0
- package/dist/lib/first-party-harness-agent.js +16 -2
- package/dist/lib/first-party-harness-doctor.d.ts +15 -0
- package/dist/lib/first-party-harness-doctor.js +126 -27
- package/dist/lib/followups.d.ts +115 -0
- package/dist/lib/followups.js +127 -0
- package/dist/lib/harnesses.d.ts +8 -0
- package/dist/lib/instruction-input.d.ts +19 -1
- package/dist/lib/instruction-input.js +52 -1
- package/dist/lib/label-ref.d.ts +95 -0
- package/dist/lib/label-ref.js +163 -0
- package/dist/lib/label-scope.d.ts +17 -2
- package/dist/lib/label-scope.js +27 -7
- package/dist/lib/local-skills.d.ts +98 -0
- package/dist/lib/local-skills.js +195 -0
- package/dist/lib/machines.d.ts +10 -10
- package/dist/lib/machines.js +23 -1
- package/dist/lib/search-query.d.ts +19 -0
- package/dist/lib/search-query.js +35 -0
- package/dist/lib/space-custom-actions.d.ts +72 -0
- package/dist/lib/space-custom-actions.js +117 -0
- package/dist/lib/space-resolver.d.ts +1 -21
- package/dist/lib/space-resolver.js +19 -10
- package/dist/lib/task-closure.d.ts +33 -0
- package/dist/lib/task-closure.js +104 -0
- package/dist/lib/task-lifecycle-output.d.ts +14 -0
- package/dist/lib/task-lifecycle-output.js +209 -0
- package/dist/lib/task-ref-resolver.d.ts +1 -17
- package/dist/lib/task-ref-resolver.js +18 -8
- package/dist/lib/tasks.d.ts +3 -0
- package/dist/lib/tasks.js +40 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessTrust.js +4 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessTrust.js +4 -0
- package/dist/node_modules/@skrr-ai/auth-core/package.json +1 -1
- package/dist/node_modules/@skrr-ai/data-provider/index.js +5559 -4897
- package/oclif.manifest.json +33890 -28690
- package/package.json +24 -6
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
5
|
+
const base_command_1 = require("../../../../base-command");
|
|
6
|
+
const agent_visual_refs_1 = require("../../../../lib/agent-visual-refs");
|
|
7
|
+
/**
|
|
8
|
+
* Choose the policy. Wraps `PUT /api/agents/avatar-default`.
|
|
9
|
+
*
|
|
10
|
+
* ONE value, not three switches: `--mode` selects which of the shapes in
|
|
11
|
+
* `AgentAvatarDefaultPolicy` is being written, and the other flags supply that
|
|
12
|
+
* shape's payload. The union is the server's contract, so the command refuses a
|
|
13
|
+
* combination that cannot be one of its members rather than sending a
|
|
14
|
+
* half-formed object and letting zod name the problem.
|
|
15
|
+
*/
|
|
16
|
+
class AgentsAvatarDefaultSet extends base_command_1.BaseCommand {
|
|
17
|
+
static description = 'Set the default-avatar policy for agents you create from now on';
|
|
18
|
+
static examples = [
|
|
19
|
+
'<%= config.bin %> agents avatar default set --mode platform',
|
|
20
|
+
'<%= config.bin %> agents avatar default set --mode fixed --ref preset:kosmo',
|
|
21
|
+
'<%= config.bin %> agents avatar default set --mode random --scope category --category illustrations',
|
|
22
|
+
'<%= config.bin %> agents avatar default set --mode random --scope mine',
|
|
23
|
+
'<%= config.bin %> agents avatar default set --clear',
|
|
24
|
+
];
|
|
25
|
+
static flags = {
|
|
26
|
+
mode: core_1.Flags.string({
|
|
27
|
+
description: 'platform = the shipped logo; fixed = one avatar; random = a different one each time',
|
|
28
|
+
options: ['platform', 'fixed', 'random'],
|
|
29
|
+
exclusive: ['clear'],
|
|
30
|
+
}),
|
|
31
|
+
clear: core_1.Flags.boolean({
|
|
32
|
+
description: 'Remove your policy entirely, so new agents follow whatever the workspace or the ' +
|
|
33
|
+
'platform ships. NOT the same as --mode platform, which pins the logo.',
|
|
34
|
+
exclusive: ['mode', 'ref', 'scope', 'category'],
|
|
35
|
+
}),
|
|
36
|
+
ref: core_1.Flags.string({
|
|
37
|
+
description: '--mode fixed: which avatar. default, preset:<id>, asset:<id>, or image:<filepath>@<source>',
|
|
38
|
+
}),
|
|
39
|
+
scope: core_1.Flags.string({
|
|
40
|
+
description: '--mode random: draw from the whole catalog, one category, or your own uploads',
|
|
41
|
+
options: ['all', 'category', 'mine'],
|
|
42
|
+
}),
|
|
43
|
+
category: core_1.Flags.string({
|
|
44
|
+
description: '--mode random --scope category: which category to draw from',
|
|
45
|
+
options: [...data_provider_1.AGENT_AVATAR_PRESET_CATEGORIES],
|
|
46
|
+
}),
|
|
47
|
+
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
48
|
+
};
|
|
49
|
+
buildPolicy(flags) {
|
|
50
|
+
if (flags.mode === 'platform')
|
|
51
|
+
return { mode: 'platform' };
|
|
52
|
+
if (flags.mode === 'fixed') {
|
|
53
|
+
if (!flags.ref) {
|
|
54
|
+
this.error('--mode fixed needs --ref to say which avatar. ' +
|
|
55
|
+
'For example --ref preset:kosmo (`skrr agents avatar presets`) or ' +
|
|
56
|
+
'--ref asset:<id> (`skrr agents avatar library`).', { exit: 1 });
|
|
57
|
+
}
|
|
58
|
+
return { mode: 'fixed', ref: (0, agent_visual_refs_1.parseAvatarRefFlag)(flags.ref) };
|
|
59
|
+
}
|
|
60
|
+
if (!flags.scope) {
|
|
61
|
+
this.error('--mode random needs --scope: all (the whole catalog), category (one category, ' +
|
|
62
|
+
'with --category), or mine (your own uploads).', { exit: 1 });
|
|
63
|
+
}
|
|
64
|
+
if (flags.scope === 'category') {
|
|
65
|
+
if (!flags.category) {
|
|
66
|
+
this.error('--scope category needs --category to say which one.', { exit: 1 });
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
mode: 'random',
|
|
70
|
+
scope: 'category',
|
|
71
|
+
category: flags.category,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return { mode: 'random', scope: flags.scope };
|
|
75
|
+
}
|
|
76
|
+
async run() {
|
|
77
|
+
this.requireAuth();
|
|
78
|
+
const { flags } = await this.parse(AgentsAvatarDefaultSet);
|
|
79
|
+
// `--mode` was `required`, which made the cleared state — the one the write
|
|
80
|
+
// route goes out of its way to support — unreachable from here: every value
|
|
81
|
+
// of `--mode` WRITES a policy, so once this command had been run there was
|
|
82
|
+
// no way back to "no opinion" short of calling the API by hand.
|
|
83
|
+
if (!flags.clear && !flags.mode) {
|
|
84
|
+
this.error('Choose --mode platform|fixed|random to set a policy, or --clear to remove yours so ' +
|
|
85
|
+
'new agents follow whatever the workspace or the platform ships.', { exit: 1 });
|
|
86
|
+
}
|
|
87
|
+
let policy = null;
|
|
88
|
+
if (!flags.clear) {
|
|
89
|
+
try {
|
|
90
|
+
policy = this.buildPolicy(flags);
|
|
91
|
+
}
|
|
92
|
+
catch (err) {
|
|
93
|
+
this.error(err.message, { exit: 1 });
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
let response;
|
|
97
|
+
try {
|
|
98
|
+
response = await data_provider_1.dataService.setAgentAvatarDefault(policy);
|
|
99
|
+
}
|
|
100
|
+
catch (err) {
|
|
101
|
+
this.handleApiError(err);
|
|
102
|
+
}
|
|
103
|
+
if (flags.json) {
|
|
104
|
+
this.log(JSON.stringify(response, null, 2));
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (flags.clear) {
|
|
108
|
+
// Say what it FOLLOWS now, not just that something was removed — the
|
|
109
|
+
// value is the same one an explicit `--mode random --scope all` would
|
|
110
|
+
// print, and the difference between them is the whole point of clearing.
|
|
111
|
+
this.log(`Cleared. New agents follow the current default: ${(0, data_provider_1.describeAgentAvatarPolicy)(response.policy)}.`);
|
|
112
|
+
this.log('If that default changes later, this account follows it.');
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
this.log(`Default avatar policy: ${(0, data_provider_1.describeAgentAvatarPolicy)(response.policy)}`);
|
|
116
|
+
}
|
|
117
|
+
this.log('Existing agents are unchanged. `skrr agents avatar default apply` changes those.');
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
exports.default = AgentsAvatarDefaultSet;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../../base-command';
|
|
2
|
+
/**
|
|
3
|
+
* Remove one image from the caller's reusable avatar library.
|
|
4
|
+
*
|
|
5
|
+
* The server refuses with 409 while any of the caller's agents still wears the
|
|
6
|
+
* image — deleting it out from under them would leave a broken face, so the
|
|
7
|
+
* conflict is the feature. Say what to do about it rather than surfacing the
|
|
8
|
+
* bare status.
|
|
9
|
+
*/
|
|
10
|
+
export default class AgentsAvatarLibraryDelete extends BaseCommand {
|
|
11
|
+
static description: string;
|
|
12
|
+
static examples: string[];
|
|
13
|
+
static args: {
|
|
14
|
+
assetId: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
15
|
+
};
|
|
16
|
+
static flags: {
|
|
17
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
18
|
+
};
|
|
19
|
+
run(): Promise<void>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
5
|
+
const base_command_1 = require("../../../../base-command");
|
|
6
|
+
/**
|
|
7
|
+
* Remove one image from the caller's reusable avatar library.
|
|
8
|
+
*
|
|
9
|
+
* The server refuses with 409 while any of the caller's agents still wears the
|
|
10
|
+
* image — deleting it out from under them would leave a broken face, so the
|
|
11
|
+
* conflict is the feature. Say what to do about it rather than surfacing the
|
|
12
|
+
* bare status.
|
|
13
|
+
*/
|
|
14
|
+
class AgentsAvatarLibraryDelete extends base_command_1.BaseCommand {
|
|
15
|
+
static description = 'Delete one image from your reusable avatar library';
|
|
16
|
+
static examples = ['<%= config.bin %> agents avatar library delete <asset-id>'];
|
|
17
|
+
static args = {
|
|
18
|
+
assetId: core_1.Args.string({ description: 'Asset ID', required: true, ignoreStdin: true }),
|
|
19
|
+
};
|
|
20
|
+
static flags = {
|
|
21
|
+
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
22
|
+
};
|
|
23
|
+
async run() {
|
|
24
|
+
this.requireAuth();
|
|
25
|
+
const { args, flags } = await this.parse(AgentsAvatarLibraryDelete);
|
|
26
|
+
let result;
|
|
27
|
+
try {
|
|
28
|
+
result = await data_provider_1.dataService.deleteAvatarLibraryAsset(args.assetId);
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
const status = err?.status ??
|
|
32
|
+
err?.response?.status;
|
|
33
|
+
if (status === 409) {
|
|
34
|
+
this.error(`Asset ${args.assetId} is still in use by at least one of your agents. ` +
|
|
35
|
+
'Point those agents at another avatar first — ' +
|
|
36
|
+
'`skrr agents update <agent-id> --avatar preset:<id>` — then delete it.', { exit: 1 });
|
|
37
|
+
}
|
|
38
|
+
this.handleApiError(err);
|
|
39
|
+
}
|
|
40
|
+
if (flags.json) {
|
|
41
|
+
this.log(JSON.stringify(result, null, 2));
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
this.log(`Deleted avatar asset ${args.assetId}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.default = AgentsAvatarLibraryDelete;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../../base-command';
|
|
2
|
+
/**
|
|
3
|
+
* The caller's own uploaded avatar images, reusable across their agents.
|
|
4
|
+
*
|
|
5
|
+
* Wraps `GET /api/agents/avatar-library`. The ids listed here are what
|
|
6
|
+
* `--avatar asset:<id>` takes, so this is the other half of making that flag
|
|
7
|
+
* usable (`agents avatar presets` covers the built-ins).
|
|
8
|
+
*/
|
|
9
|
+
export default class AgentsAvatarLibrary extends BaseCommand {
|
|
10
|
+
static description: string;
|
|
11
|
+
static examples: string[];
|
|
12
|
+
static flags: {
|
|
13
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
};
|
|
15
|
+
run(): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
5
|
+
const base_command_1 = require("../../../../base-command");
|
|
6
|
+
const format_1 = require("../../../../lib/format");
|
|
7
|
+
/**
|
|
8
|
+
* The caller's own uploaded avatar images, reusable across their agents.
|
|
9
|
+
*
|
|
10
|
+
* Wraps `GET /api/agents/avatar-library`. The ids listed here are what
|
|
11
|
+
* `--avatar asset:<id>` takes, so this is the other half of making that flag
|
|
12
|
+
* usable (`agents avatar presets` covers the built-ins).
|
|
13
|
+
*/
|
|
14
|
+
class AgentsAvatarLibrary extends base_command_1.BaseCommand {
|
|
15
|
+
static description = 'List your reusable avatar images (`--avatar asset:<id>` takes these ids)';
|
|
16
|
+
static examples = [
|
|
17
|
+
'<%= config.bin %> agents avatar library',
|
|
18
|
+
'<%= config.bin %> agents avatar library --json',
|
|
19
|
+
];
|
|
20
|
+
static flags = {
|
|
21
|
+
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
22
|
+
};
|
|
23
|
+
async run() {
|
|
24
|
+
this.requireAuth();
|
|
25
|
+
const { flags } = await this.parse(AgentsAvatarLibrary);
|
|
26
|
+
let response;
|
|
27
|
+
try {
|
|
28
|
+
response = await data_provider_1.dataService.listAvatarLibrary();
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
this.handleApiError(err);
|
|
32
|
+
}
|
|
33
|
+
const assets = response.assets ?? [];
|
|
34
|
+
if (flags.json) {
|
|
35
|
+
this.log(JSON.stringify(assets, null, 2));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (assets.length === 0) {
|
|
39
|
+
this.log('No avatar images in your library yet.');
|
|
40
|
+
this.log('Upload one with: skrr agents avatar upload <agent-id> --file <path>');
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
(0, format_1.renderTable)(assets.map((asset) => ({
|
|
44
|
+
id: asset.id,
|
|
45
|
+
name: asset.name ?? '-',
|
|
46
|
+
created: asset.createdAt ? String(asset.createdAt).slice(0, 10) : '-',
|
|
47
|
+
lastUsed: asset.lastUsedAt ? String(asset.lastUsedAt).slice(0, 10) : '-',
|
|
48
|
+
})), [
|
|
49
|
+
{ key: 'id', header: 'ID', verbatim: true },
|
|
50
|
+
{ key: 'name', header: 'NAME', maxWidth: 32 },
|
|
51
|
+
{ key: 'created', header: 'CREATED' },
|
|
52
|
+
{ key: 'lastUsed', header: 'LAST USED' },
|
|
53
|
+
], (line) => this.log(line));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.default = AgentsAvatarLibrary;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base-command';
|
|
2
|
+
/**
|
|
3
|
+
* The built-in avatar catalog.
|
|
4
|
+
*
|
|
5
|
+
* No network call, deliberately: the registry is CODE (`AGENT_AVATAR_PRESETS`
|
|
6
|
+
* in `@skrr-ai/data-provider`), which the CLI already links against, and the
|
|
7
|
+
* server has no endpoint that serves it. That is also why this command has to
|
|
8
|
+
* exist — `--avatar preset:<id>` is unusable without a way to learn the ids,
|
|
9
|
+
* and the web chooser's answer to that question is a grid of images.
|
|
10
|
+
*/
|
|
11
|
+
export default class AgentsAvatarPresets extends BaseCommand {
|
|
12
|
+
static description: string;
|
|
13
|
+
static examples: string[];
|
|
14
|
+
static flags: {
|
|
15
|
+
category: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
16
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
17
|
+
};
|
|
18
|
+
run(): Promise<void>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
5
|
+
const base_command_1 = require("../../../base-command");
|
|
6
|
+
const format_1 = require("../../../lib/format");
|
|
7
|
+
/**
|
|
8
|
+
* The built-in avatar catalog.
|
|
9
|
+
*
|
|
10
|
+
* No network call, deliberately: the registry is CODE (`AGENT_AVATAR_PRESETS`
|
|
11
|
+
* in `@skrr-ai/data-provider`), which the CLI already links against, and the
|
|
12
|
+
* server has no endpoint that serves it. That is also why this command has to
|
|
13
|
+
* exist — `--avatar preset:<id>` is unusable without a way to learn the ids,
|
|
14
|
+
* and the web chooser's answer to that question is a grid of images.
|
|
15
|
+
*/
|
|
16
|
+
class AgentsAvatarPresets extends base_command_1.BaseCommand {
|
|
17
|
+
static description = 'List the built-in avatar presets `--avatar preset:<id>` accepts';
|
|
18
|
+
static examples = [
|
|
19
|
+
'<%= config.bin %> agents avatar presets',
|
|
20
|
+
'<%= config.bin %> agents avatar presets --category illustrations',
|
|
21
|
+
'<%= config.bin %> agents avatar presets --json',
|
|
22
|
+
];
|
|
23
|
+
static flags = {
|
|
24
|
+
category: core_1.Flags.string({
|
|
25
|
+
description: 'Only presets in this category',
|
|
26
|
+
options: [...data_provider_1.AGENT_AVATAR_PRESET_CATEGORIES],
|
|
27
|
+
}),
|
|
28
|
+
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
29
|
+
};
|
|
30
|
+
async run() {
|
|
31
|
+
const { flags } = await this.parse(AgentsAvatarPresets);
|
|
32
|
+
const presets = flags.category
|
|
33
|
+
? data_provider_1.AGENT_AVATAR_PRESETS.filter((preset) => preset.category === flags.category)
|
|
34
|
+
: data_provider_1.AGENT_AVATAR_PRESETS;
|
|
35
|
+
if (flags.json) {
|
|
36
|
+
this.log(JSON.stringify(presets, null, 2));
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (presets.length === 0) {
|
|
40
|
+
this.log(`No presets in category ${flags.category}.`);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
(0, format_1.renderTable)(presets.map((preset) => ({
|
|
44
|
+
id: preset.id,
|
|
45
|
+
name: preset.name,
|
|
46
|
+
category: data_provider_1.AGENT_AVATAR_CATEGORY_LABELS[preset.category],
|
|
47
|
+
})), [
|
|
48
|
+
{ key: 'id', header: 'ID', verbatim: true },
|
|
49
|
+
{ key: 'name', header: 'NAME', maxWidth: 32 },
|
|
50
|
+
{ key: 'category', header: 'CATEGORY' },
|
|
51
|
+
], (line) => this.log(line));
|
|
52
|
+
this.log('');
|
|
53
|
+
this.log(`Use one with: skrr agents update <agent-id> --avatar preset:${presets[0].id}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.default = AgentsAvatarPresets;
|
|
@@ -5,6 +5,7 @@ const promises_1 = require("node:fs/promises");
|
|
|
5
5
|
const node_path_1 = require("node:path");
|
|
6
6
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
7
7
|
const base_command_1 = require("../../../base-command");
|
|
8
|
+
const agent_visual_refs_1 = require("../../../lib/agent-visual-refs");
|
|
8
9
|
class AgentsAvatarUpload extends base_command_1.BaseCommand {
|
|
9
10
|
static description = 'Upload an agent avatar';
|
|
10
11
|
static args = { agentId: core_1.Args.string({ required: true, ignoreStdin: true }) };
|
|
@@ -15,9 +16,14 @@ class AgentsAvatarUpload extends base_command_1.BaseCommand {
|
|
|
15
16
|
async run() {
|
|
16
17
|
this.requireAuth();
|
|
17
18
|
const { args, flags } = await this.parse(AgentsAvatarUpload);
|
|
19
|
+
const type = (0, agent_visual_refs_1.imageUploadMimeType)(flags.file);
|
|
20
|
+
if (!type) {
|
|
21
|
+
this.error(`--file must be a .png, .jpg, .jpeg, .webp or .gif image (got ${(0, node_path_1.basename)(flags.file)}).`, { exit: 1 });
|
|
22
|
+
}
|
|
18
23
|
const bytes = await (0, promises_1.readFile)(flags.file);
|
|
19
24
|
const form = new FormData();
|
|
20
|
-
|
|
25
|
+
// Typed, or the route refuses it as application/octet-stream (OSK-9841).
|
|
26
|
+
form.append('file', new Blob([new Uint8Array(bytes)], { type }), (0, node_path_1.basename)(flags.file));
|
|
21
27
|
const result = await data_provider_1.dataService.uploadAgentAvatar({ agent_id: args.agentId, formData: form });
|
|
22
28
|
this.log(flags.json
|
|
23
29
|
? this.agentJson(args.agentId, result)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base-command';
|
|
2
|
+
/** Create one of the caller's own agent categories. Wraps `POST /api/agents/categories`. */
|
|
3
|
+
export default class AgentsCategoriesCreate extends BaseCommand {
|
|
4
|
+
static description: string;
|
|
5
|
+
static examples: string[];
|
|
6
|
+
static flags: {
|
|
7
|
+
value: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
label: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
description: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
order: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
5
|
+
const base_command_1 = require("../../../base-command");
|
|
6
|
+
/** Create one of the caller's own agent categories. Wraps `POST /api/agents/categories`. */
|
|
7
|
+
class AgentsCategoriesCreate extends base_command_1.BaseCommand {
|
|
8
|
+
static description = 'Create a custom agent category';
|
|
9
|
+
static examples = [
|
|
10
|
+
'<%= config.bin %> agents categories create --value ops --label "Operations"',
|
|
11
|
+
'<%= config.bin %> agents categories create --value ops --label "Operations" --description "Runbooks and on-call" --order 3',
|
|
12
|
+
];
|
|
13
|
+
static flags = {
|
|
14
|
+
value: core_1.Flags.string({
|
|
15
|
+
description: 'Stable identifier — this is what `--category` takes',
|
|
16
|
+
required: true,
|
|
17
|
+
}),
|
|
18
|
+
label: core_1.Flags.string({ description: 'Display name', required: true }),
|
|
19
|
+
description: core_1.Flags.string({ description: 'What belongs in this category' }),
|
|
20
|
+
order: core_1.Flags.integer({ description: 'Sort position among your categories' }),
|
|
21
|
+
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
22
|
+
};
|
|
23
|
+
async run() {
|
|
24
|
+
this.requireAuth();
|
|
25
|
+
const { flags } = await this.parse(AgentsCategoriesCreate);
|
|
26
|
+
let created;
|
|
27
|
+
try {
|
|
28
|
+
created = await data_provider_1.dataService.createUserCategory({
|
|
29
|
+
value: flags.value,
|
|
30
|
+
label: flags.label,
|
|
31
|
+
...(flags.description === undefined ? {} : { description: flags.description }),
|
|
32
|
+
...(flags.order === undefined ? {} : { order: flags.order }),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
this.handleApiError(err);
|
|
37
|
+
}
|
|
38
|
+
if (flags.json) {
|
|
39
|
+
this.log(JSON.stringify(created, null, 2));
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
this.log(`Created category ${flags.value} — ${flags.label}`);
|
|
43
|
+
this.log(`Use it with: skrr agents create --category ${flags.value} …`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.default = AgentsCategoriesCreate;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base-command';
|
|
2
|
+
/** Delete one of the caller's own categories. Wraps `DELETE /api/agents/categories/:value`. */
|
|
3
|
+
export default class AgentsCategoriesDelete extends BaseCommand {
|
|
4
|
+
static description: string;
|
|
5
|
+
static examples: string[];
|
|
6
|
+
static args: {
|
|
7
|
+
value: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
8
|
+
};
|
|
9
|
+
static flags: {
|
|
10
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
};
|
|
12
|
+
run(): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
5
|
+
const base_command_1 = require("../../../base-command");
|
|
6
|
+
/** Delete one of the caller's own categories. Wraps `DELETE /api/agents/categories/:value`. */
|
|
7
|
+
class AgentsCategoriesDelete extends base_command_1.BaseCommand {
|
|
8
|
+
static description = 'Delete a custom agent category';
|
|
9
|
+
static examples = ['<%= config.bin %> agents categories delete ops'];
|
|
10
|
+
static args = {
|
|
11
|
+
value: core_1.Args.string({ description: 'Category value', required: true, ignoreStdin: true }),
|
|
12
|
+
};
|
|
13
|
+
static flags = {
|
|
14
|
+
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
15
|
+
};
|
|
16
|
+
async run() {
|
|
17
|
+
this.requireAuth();
|
|
18
|
+
const { args, flags } = await this.parse(AgentsCategoriesDelete);
|
|
19
|
+
let result;
|
|
20
|
+
try {
|
|
21
|
+
result = await data_provider_1.dataService.deleteUserCategory(args.value);
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
this.handleApiError(err);
|
|
25
|
+
}
|
|
26
|
+
if (flags.json) {
|
|
27
|
+
this.log(JSON.stringify(result, null, 2));
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const outcome = result;
|
|
31
|
+
this.log(`Deleted category ${args.value}`);
|
|
32
|
+
// Say where its agents went, because the alternative a reader assumes is
|
|
33
|
+
// that they went with it — and until the server moved them, they did not go
|
|
34
|
+
// anywhere: they kept pointing at a category that no longer existed.
|
|
35
|
+
if (outcome.reassigned) {
|
|
36
|
+
const noun = outcome.reassigned === 1 ? 'agent' : 'agents';
|
|
37
|
+
this.log(`Moved ${outcome.reassigned} ${noun} to ${outcome.reassignedTo}.`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.default = AgentsCategoriesDelete;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base-command';
|
|
2
|
+
export declare function categoryDisplayLabel(row: {
|
|
3
|
+
value?: unknown;
|
|
4
|
+
label?: unknown;
|
|
5
|
+
}): string;
|
|
6
|
+
export declare function categoryDisplayDescription(row: {
|
|
7
|
+
description?: unknown;
|
|
8
|
+
}): string;
|
|
9
|
+
/**
|
|
10
|
+
* The vocabulary `--category` accepts.
|
|
11
|
+
*
|
|
12
|
+
* The plain command used to read the GLOBAL marketplace catalog, which answers a
|
|
13
|
+
* different question: it listed `promoted`, `general` and `all` — three rows —
|
|
14
|
+
* while this account's agents actually sat in twelve categories, including the
|
|
15
|
+
* custom one the sibling `create` command had just minted. Two of the three were
|
|
16
|
+
* not categories at all but marketplace browse filters the endpoint injects. And
|
|
17
|
+
* `--mine`, described as a view, returned MORE than the default, so a flag that
|
|
18
|
+
* reads like a filter was a superset. The command's own description — "the
|
|
19
|
+
* categories `--category` accepts" — was true of none of it.
|
|
20
|
+
*
|
|
21
|
+
* So the default is now that vocabulary: the global categories plus your own,
|
|
22
|
+
* without the browse filters. The marketplace view, with its counts and filters,
|
|
23
|
+
* is `--marketplace`, named for what it is. `--mine` still works, as the default
|
|
24
|
+
* it always should have been, so nothing that scripted it breaks.
|
|
25
|
+
*/
|
|
26
|
+
export default class AgentsCategoriesList extends BaseCommand {
|
|
27
|
+
static description: string;
|
|
28
|
+
static examples: string[];
|
|
29
|
+
static flags: {
|
|
30
|
+
mine: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
31
|
+
'custom-only': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
32
|
+
marketplace: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
33
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
34
|
+
};
|
|
35
|
+
run(): Promise<void>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.categoryDisplayLabel = categoryDisplayLabel;
|
|
4
|
+
exports.categoryDisplayDescription = categoryDisplayDescription;
|
|
5
|
+
const core_1 = require("@oclif/core");
|
|
6
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
7
|
+
const base_command_1 = require("../../../base-command");
|
|
8
|
+
const format_1 = require("../../../lib/format");
|
|
9
|
+
/**
|
|
10
|
+
* Global default categories are seeded with LOCALIZATION KEYS as their label and
|
|
11
|
+
* description (`com_agents_category_general`), because the web translates them.
|
|
12
|
+
* The CLI has no translations and printed the keys: the category most agents are
|
|
13
|
+
* in read `com_agents_category_general` / `com_agents_category_general_description`,
|
|
14
|
+
* in text and `--json` alike.
|
|
15
|
+
*
|
|
16
|
+
* Copying the translations here would be a second source that drifts. A key
|
|
17
|
+
* label renders as the title-cased value instead — for `general`, the one global
|
|
18
|
+
* default left, that is exactly its English translation — and a key description
|
|
19
|
+
* renders as nothing rather than as a key. `--json` keeps the raw row; only the
|
|
20
|
+
* human rendering is touched.
|
|
21
|
+
*/
|
|
22
|
+
const LOCALIZATION_KEY = /^com_[a-z0-9_]+$/;
|
|
23
|
+
function categoryDisplayLabel(row) {
|
|
24
|
+
const label = typeof row.label === 'string' ? row.label : '';
|
|
25
|
+
if (label && !LOCALIZATION_KEY.test(label))
|
|
26
|
+
return label;
|
|
27
|
+
const value = typeof row.value === 'string' ? row.value : '';
|
|
28
|
+
if (!value)
|
|
29
|
+
return label || '-';
|
|
30
|
+
return value
|
|
31
|
+
.split(/[-_\s]+/)
|
|
32
|
+
.filter(Boolean)
|
|
33
|
+
.map((word) => word[0].toUpperCase() + word.slice(1))
|
|
34
|
+
.join(' ');
|
|
35
|
+
}
|
|
36
|
+
function categoryDisplayDescription(row) {
|
|
37
|
+
const description = typeof row.description === 'string' ? row.description : '';
|
|
38
|
+
return LOCALIZATION_KEY.test(description) ? '' : description;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The vocabulary `--category` accepts.
|
|
42
|
+
*
|
|
43
|
+
* The plain command used to read the GLOBAL marketplace catalog, which answers a
|
|
44
|
+
* different question: it listed `promoted`, `general` and `all` — three rows —
|
|
45
|
+
* while this account's agents actually sat in twelve categories, including the
|
|
46
|
+
* custom one the sibling `create` command had just minted. Two of the three were
|
|
47
|
+
* not categories at all but marketplace browse filters the endpoint injects. And
|
|
48
|
+
* `--mine`, described as a view, returned MORE than the default, so a flag that
|
|
49
|
+
* reads like a filter was a superset. The command's own description — "the
|
|
50
|
+
* categories `--category` accepts" — was true of none of it.
|
|
51
|
+
*
|
|
52
|
+
* So the default is now that vocabulary: the global categories plus your own,
|
|
53
|
+
* without the browse filters. The marketplace view, with its counts and filters,
|
|
54
|
+
* is `--marketplace`, named for what it is. `--mine` still works, as the default
|
|
55
|
+
* it always should have been, so nothing that scripted it breaks.
|
|
56
|
+
*/
|
|
57
|
+
class AgentsCategoriesList extends base_command_1.BaseCommand {
|
|
58
|
+
static description = 'List the agent categories `--category` accepts';
|
|
59
|
+
static examples = [
|
|
60
|
+
'<%= config.bin %> agents categories',
|
|
61
|
+
'<%= config.bin %> agents categories --custom-only --json',
|
|
62
|
+
'<%= config.bin %> agents categories --marketplace',
|
|
63
|
+
];
|
|
64
|
+
static flags = {
|
|
65
|
+
mine: core_1.Flags.boolean({
|
|
66
|
+
description: 'Deprecated: the default already lists your categories',
|
|
67
|
+
exclusive: ['custom-only', 'marketplace'],
|
|
68
|
+
hidden: true,
|
|
69
|
+
}),
|
|
70
|
+
'custom-only': core_1.Flags.boolean({
|
|
71
|
+
description: 'Only the custom categories you created',
|
|
72
|
+
exclusive: ['mine', 'marketplace'],
|
|
73
|
+
}),
|
|
74
|
+
marketplace: core_1.Flags.boolean({
|
|
75
|
+
description: 'The global marketplace catalog with agent counts, including its browse filters ' +
|
|
76
|
+
'(`promoted`, `all`) — not a list of values `--category` takes',
|
|
77
|
+
exclusive: ['mine', 'custom-only'],
|
|
78
|
+
}),
|
|
79
|
+
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
80
|
+
};
|
|
81
|
+
async run() {
|
|
82
|
+
this.requireAuth();
|
|
83
|
+
const { flags } = await this.parse(AgentsCategoriesList);
|
|
84
|
+
let rows;
|
|
85
|
+
try {
|
|
86
|
+
if (flags['custom-only']) {
|
|
87
|
+
rows = (await data_provider_1.dataService.getUserCustomCategories());
|
|
88
|
+
}
|
|
89
|
+
else if (flags.marketplace) {
|
|
90
|
+
rows = (await data_provider_1.dataService.getAgentCategories());
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
rows = (await data_provider_1.dataService.getUserAgentCategories()).filter((row) => !(0, data_provider_1.isAgentCategoryBrowseFilter)(row.value));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
catch (err) {
|
|
97
|
+
this.handleApiError(err);
|
|
98
|
+
}
|
|
99
|
+
const items = rows ?? [];
|
|
100
|
+
if (flags.json) {
|
|
101
|
+
this.log(JSON.stringify(items, null, 2));
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if (items.length === 0) {
|
|
105
|
+
this.log(flags['custom-only']
|
|
106
|
+
? 'You have no custom categories. Create one with: skrr agents categories create'
|
|
107
|
+
: 'No categories.');
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
(0, format_1.renderTable)(items.map((row) => ({
|
|
111
|
+
value: String(row.value ?? '-'),
|
|
112
|
+
label: categoryDisplayLabel(row),
|
|
113
|
+
custom: row.custom ? 'yes' : 'no',
|
|
114
|
+
count: row.count === undefined
|
|
115
|
+
? '-'
|
|
116
|
+
: String(row.count),
|
|
117
|
+
description: categoryDisplayDescription(row),
|
|
118
|
+
})), [
|
|
119
|
+
{ key: 'value', header: 'VALUE', verbatim: true },
|
|
120
|
+
{ key: 'label', header: 'LABEL', maxWidth: 28 },
|
|
121
|
+
{ key: 'custom', header: 'CUSTOM' },
|
|
122
|
+
{ key: 'count', header: 'AGENTS' },
|
|
123
|
+
{ key: 'description', header: 'DESCRIPTION', maxWidth: 48 },
|
|
124
|
+
], (line) => this.log(line));
|
|
125
|
+
this.log('');
|
|
126
|
+
if (flags.marketplace) {
|
|
127
|
+
this.log('Marketplace view. `promoted` and `all` are browse filters, not categories — ' +
|
|
128
|
+
'run without --marketplace for the values `--category` takes.');
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
this.log('VALUE is what `skrr agents create --category <value>` takes.');
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
exports.default = AgentsCategoriesList;
|