@skrr-ai/cli 0.1.91 → 0.1.93
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/dist/base-command.d.ts +44 -0
- package/dist/base-command.js +96 -0
- package/dist/commands/agents/badge.d.ts +41 -0
- package/dist/commands/agents/badge.js +158 -0
- package/dist/commands/agents/create.d.ts +24 -0
- package/dist/commands/agents/create.js +212 -0
- package/dist/commands/agents/embed.d.ts +20 -0
- package/dist/commands/agents/embed.js +61 -0
- package/dist/commands/agents/share.d.ts +27 -0
- package/dist/commands/agents/share.js +100 -0
- package/dist/commands/agents/vanity.d.ts +21 -0
- package/dist/commands/agents/vanity.js +77 -0
- package/dist/commands/agents/visibility.d.ts +21 -1
- package/dist/commands/agents/visibility.js +112 -0
- package/dist/commands/commands.d.ts +1 -0
- package/dist/commands/commands.js +22 -9
- package/dist/commands/earnings/attributions.d.ts +17 -0
- package/dist/commands/earnings/attributions.js +82 -0
- package/dist/commands/earnings/index.js +2 -1
- package/dist/commands/generate-recovery-code.js +4 -3
- package/dist/commands/github/allow-tools.d.ts +1 -0
- package/dist/commands/github/app/install.d.ts +1 -0
- package/dist/commands/github/app/status.d.ts +1 -0
- package/dist/commands/github/connect.d.ts +1 -0
- package/dist/commands/github/connections.d.ts +1 -0
- package/dist/commands/github/disconnect.d.ts +1 -0
- package/dist/commands/github/finalize.d.ts +1 -0
- package/dist/commands/github/reconnect.d.ts +1 -0
- package/dist/commands/github/run.d.ts +1 -0
- package/dist/commands/github/tools.d.ts +1 -0
- package/dist/commands/integrations/connections/connect.d.ts +1 -0
- package/dist/commands/integrations/connections/disconnect.d.ts +1 -0
- package/dist/commands/integrations/connections/finalize.d.ts +1 -0
- package/dist/commands/integrations/connections/list.d.ts +1 -0
- package/dist/commands/integrations/connections/reconnect.d.ts +1 -0
- package/dist/commands/integrations/execute.d.ts +1 -0
- package/dist/commands/integrations/search.d.ts +1 -0
- package/dist/commands/integrations/toolkits.d.ts +1 -0
- package/dist/commands/integrations/tools/allow.d.ts +1 -0
- package/dist/commands/integrations/tools/list.d.ts +1 -0
- package/dist/commands/login.js +12 -0
- package/dist/commands/machines/dedicated/logs.d.ts +19 -0
- package/dist/commands/machines/dedicated/logs.js +103 -0
- package/dist/commands/machines/dedicated/power/index.js +3 -2
- package/dist/commands/machines/dedicated/power/set.js +1 -1
- package/dist/commands/machines/dedicated/power/waiting.d.ts +13 -0
- package/dist/commands/machines/dedicated/power/waiting.js +36 -0
- package/dist/commands/open.d.ts +24 -0
- package/dist/commands/open.js +74 -0
- package/dist/commands/projects/archive.d.ts +1 -0
- package/dist/commands/projects/archive.js +23 -0
- package/dist/commands/projects/delete.d.ts +1 -0
- package/dist/commands/projects/delete.js +23 -0
- package/dist/commands/projects/list.d.ts +3 -0
- package/dist/commands/projects/list.js +12 -2
- package/dist/commands/spaces/actions/add.js +4 -3
- package/dist/commands/spaces/actions/available.js +3 -2
- package/dist/commands/spaces/actions/list.js +5 -4
- package/dist/commands/spaces/actions/replace.js +6 -5
- package/dist/commands/spaces/archive.js +3 -2
- package/dist/commands/spaces/auto-executor/preview.js +4 -3
- package/dist/commands/spaces/auto-executor/run.js +4 -3
- package/dist/commands/spaces/auto-executor/runs.js +3 -2
- package/dist/commands/spaces/auto-executor/update.js +4 -3
- package/dist/commands/spaces/bootstrap.js +3 -2
- package/dist/commands/spaces/briefs/delete.js +3 -2
- package/dist/commands/spaces/briefs/get.js +3 -2
- package/dist/commands/spaces/briefs/list.js +3 -2
- package/dist/commands/spaces/briefs/set.js +5 -4
- package/dist/commands/spaces/capacity.js +5 -4
- package/dist/commands/spaces/conversations.js +3 -2
- package/dist/commands/spaces/cycles/create.js +3 -2
- package/dist/commands/spaces/cycles/graph.js +2 -1
- package/dist/commands/spaces/cycles/list.js +3 -2
- package/dist/commands/spaces/cycles/settings.js +4 -3
- package/dist/commands/spaces/cycles/show.js +3 -2
- package/dist/commands/spaces/cycles/update.js +3 -2
- package/dist/commands/spaces/delete.js +4 -3
- package/dist/commands/spaces/expertise-suggestions.js +4 -3
- package/dist/commands/spaces/files/delete.js +3 -2
- package/dist/commands/spaces/files/folders/create.js +3 -2
- package/dist/commands/spaces/files/folders/delete.js +3 -2
- package/dist/commands/spaces/files/folders/list.js +3 -2
- package/dist/commands/spaces/files/folders/update.js +3 -2
- package/dist/commands/spaces/files/list.js +3 -2
- package/dist/commands/spaces/files/move.js +3 -2
- package/dist/commands/spaces/files/rename.js +3 -2
- package/dist/commands/spaces/files/upload.js +6 -5
- package/dist/commands/spaces/github-automations/set.js +3 -2
- package/dist/commands/spaces/github-automations/show.js +3 -2
- package/dist/commands/spaces/goals.js +2 -1
- package/dist/commands/spaces/heartbeats/create.js +4 -3
- package/dist/commands/spaces/heartbeats/delete.js +4 -3
- package/dist/commands/spaces/heartbeats/list.js +4 -3
- package/dist/commands/spaces/heartbeats/status.js +3 -2
- package/dist/commands/spaces/heartbeats/update.js +4 -3
- package/dist/commands/spaces/insights.js +5 -4
- package/dist/commands/spaces/labels/add.js +4 -3
- package/dist/commands/spaces/labels/list.js +2 -1
- package/dist/commands/spaces/labels/remove.js +4 -3
- package/dist/commands/spaces/list.d.ts +3 -0
- package/dist/commands/spaces/list.js +11 -2
- package/dist/commands/spaces/live/cards/create.js +3 -2
- package/dist/commands/spaces/live/cards/list.js +3 -2
- package/dist/commands/spaces/live/cards/reorder.js +7 -2
- package/dist/commands/spaces/live/scene.js +4 -3
- package/dist/commands/spaces/members/add.js +7 -6
- package/dist/commands/spaces/members/list.js +4 -3
- package/dist/commands/spaces/members/remove.js +7 -6
- package/dist/commands/spaces/move.js +3 -2
- package/dist/commands/spaces/pin.js +5 -4
- package/dist/commands/spaces/preferences/show.js +4 -3
- package/dist/commands/spaces/preferences/tabs.js +4 -3
- package/dist/commands/spaces/revisions.js +3 -2
- package/dist/commands/spaces/room/ensure.js +5 -4
- package/dist/commands/spaces/room/messages.js +3 -2
- package/dist/commands/spaces/room/show.js +5 -4
- package/dist/commands/spaces/skills/add.js +4 -3
- package/dist/commands/spaces/skills/list.js +3 -2
- package/dist/commands/spaces/skills/pin.js +4 -3
- package/dist/commands/spaces/skills/remove.js +4 -3
- package/dist/commands/spaces/snapshot.js +3 -2
- package/dist/commands/spaces/states/archive.js +3 -2
- package/dist/commands/spaces/states/create.js +3 -2
- package/dist/commands/spaces/states/list.js +3 -2
- package/dist/commands/spaces/states/reorder.js +2 -1
- package/dist/commands/spaces/states/update.js +3 -2
- package/dist/commands/spaces/summary.js +4 -3
- package/dist/commands/spaces/tasks.d.ts +3 -0
- package/dist/commands/spaces/tasks.js +14 -3
- package/dist/commands/spaces/triggers/delete.js +5 -4
- package/dist/commands/spaces/triggers/set.js +4 -3
- package/dist/commands/spaces/triggers/show.js +4 -3
- package/dist/commands/spaces/unarchive.js +3 -2
- package/dist/commands/spaces/update.js +5 -4
- package/dist/commands/spaces/views/create.js +3 -2
- package/dist/commands/spaces/views/list.js +3 -2
- package/dist/commands/spaces/views/reorder.js +6 -3
- package/dist/commands/spaces/views/subscribe.js +2 -1
- package/dist/commands/spaces/views/subscriptions.js +1 -0
- package/dist/commands/spaces/views/unsubscribe.js +2 -1
- package/dist/commands/spaces/widgets/add.js +4 -3
- package/dist/commands/spaces/widgets/list.js +3 -2
- package/dist/commands/spaces/widgets/remove.js +5 -4
- package/dist/commands/spaces/work-graph.js +2 -1
- package/dist/commands/store/install.d.ts +1 -1
- package/dist/commands/store/install.js +24 -8
- package/dist/commands/store/show.d.ts +25 -0
- package/dist/commands/store/show.js +203 -0
- package/dist/commands/store/stats.d.ts +33 -0
- package/dist/commands/store/stats.js +258 -0
- package/dist/commands/tasks/actions/attach.js +1 -1
- package/dist/commands/tasks/actions/detach.js +4 -3
- package/dist/commands/tasks/activity.js +3 -2
- package/dist/commands/tasks/ancestors.js +2 -1
- package/dist/commands/tasks/approvals/create.js +2 -1
- package/dist/commands/tasks/approvals/delete.js +3 -2
- package/dist/commands/tasks/approvals/list.js +5 -4
- package/dist/commands/tasks/approvals/resolve.js +2 -1
- package/dist/commands/tasks/archive.js +3 -2
- package/dist/commands/tasks/assign.js +4 -3
- package/dist/commands/tasks/attachments/delete.js +3 -2
- package/dist/commands/tasks/attachments/download.d.ts +1 -0
- package/dist/commands/tasks/attachments/download.js +20 -1
- package/dist/commands/tasks/attachments/list.js +2 -1
- package/dist/commands/tasks/attachments/set-role.js +2 -1
- package/dist/commands/tasks/attachments/upload.js +2 -1
- package/dist/commands/tasks/bulk-update.d.ts +1 -0
- package/dist/commands/tasks/bulk-update.js +106 -15
- package/dist/commands/tasks/cancel-cascade.d.ts +1 -0
- package/dist/commands/tasks/cancel-cascade.js +13 -3
- package/dist/commands/tasks/cascade-status.js +2 -1
- package/dist/commands/tasks/chat/send.d.ts +44 -0
- package/dist/commands/tasks/chat/send.js +112 -0
- package/dist/commands/tasks/checkout.js +3 -2
- package/dist/commands/tasks/children.js +2 -1
- package/dist/commands/tasks/comments/add.js +7 -6
- package/dist/commands/tasks/comments/anchor.js +8 -7
- package/dist/commands/tasks/comments/delete.js +3 -2
- package/dist/commands/tasks/comments/list.js +2 -1
- package/dist/commands/tasks/comments/reopen.js +3 -2
- package/dist/commands/tasks/comments/resolve.js +3 -2
- package/dist/commands/tasks/create-tree.d.ts +63 -0
- package/dist/commands/tasks/create-tree.js +197 -4
- package/dist/commands/tasks/delete.js +5 -4
- package/dist/commands/tasks/descendants.js +2 -1
- package/dist/commands/tasks/dri-plan.js +3 -2
- package/dist/commands/tasks/dri-run.js +3 -2
- package/dist/commands/tasks/dri-status.js +2 -1
- package/dist/commands/tasks/duplicate-pipeline.js +2 -1
- package/dist/commands/tasks/execution-summary.js +2 -1
- package/dist/commands/tasks/execution-timeline.js +2 -1
- package/dist/commands/tasks/fork.js +1 -0
- package/dist/commands/tasks/forward.js +4 -3
- package/dist/commands/tasks/handover.js +1 -0
- package/dist/commands/tasks/interrupt.js +3 -2
- package/dist/commands/tasks/labels/attach.js +4 -3
- package/dist/commands/tasks/labels/detach.js +4 -3
- package/dist/commands/tasks/labels/suggest.js +5 -4
- package/dist/commands/tasks/list.d.ts +27 -1
- package/dist/commands/tasks/list.js +101 -3
- package/dist/commands/tasks/move.js +4 -3
- package/dist/commands/tasks/output.js +6 -5
- package/dist/commands/tasks/pause-schedule.js +3 -2
- package/dist/commands/tasks/promote.js +1 -0
- package/dist/commands/tasks/prompt-log.js +2 -1
- package/dist/commands/tasks/release.js +5 -4
- package/dist/commands/tasks/remind.js +2 -1
- package/dist/commands/tasks/replay.js +3 -2
- package/dist/commands/tasks/report.js +1 -0
- package/dist/commands/tasks/resume-schedule.js +3 -2
- package/dist/commands/tasks/retry-schedule.js +3 -2
- package/dist/commands/tasks/retry.js +10 -9
- package/dist/commands/tasks/revisions.js +2 -1
- package/dist/commands/tasks/runs.js +6 -5
- package/dist/commands/tasks/schedule.js +3 -2
- package/dist/commands/tasks/self-schedule.js +6 -5
- package/dist/commands/tasks/skills/pin.js +3 -2
- package/dist/commands/tasks/skills/unpin.js +3 -2
- package/dist/commands/tasks/snooze.js +6 -5
- package/dist/commands/tasks/start-all.js +5 -4
- package/dist/commands/tasks/subscribe.js +1 -0
- package/dist/commands/tasks/tags/add.js +4 -3
- package/dist/commands/tasks/tags/remove.js +4 -3
- package/dist/commands/tasks/timeline.js +3 -2
- package/dist/commands/tasks/today.d.ts +4 -1
- package/dist/commands/tasks/today.js +12 -2
- package/dist/commands/tasks/transcript.js +6 -5
- package/dist/commands/tasks/unschedule.js +3 -2
- package/dist/commands/tasks/unsnooze.js +3 -2
- package/dist/commands/tasks/unsubscribe.js +2 -1
- package/dist/commands/tasks/update.js +5 -4
- package/dist/commands/tasks/wait.js +5 -4
- package/dist/lib/agent-distribution.d.ts +37 -0
- package/dist/lib/agent-distribution.js +63 -0
- package/dist/lib/agent-ref.d.ts +69 -0
- package/dist/lib/agent-ref.js +168 -0
- package/dist/lib/api-fetch.d.ts +2 -0
- package/dist/lib/api-fetch.js +14 -3
- package/dist/lib/command-hygiene.d.ts +13 -0
- package/dist/lib/command-hygiene.js +62 -2
- package/dist/lib/dedicated-power.d.ts +16 -1
- package/dist/lib/dedicated-power.js +153 -2
- package/dist/lib/dry-run-plans.d.ts +50 -0
- package/dist/lib/dry-run-plans.js +85 -0
- package/dist/lib/json-output.d.ts +31 -0
- package/dist/lib/json-output.js +78 -0
- package/dist/lib/list-output.d.ts +75 -0
- package/dist/lib/list-output.js +266 -0
- package/dist/lib/machine-daemon-log.d.ts +36 -0
- package/dist/lib/machine-daemon-log.js +78 -0
- package/dist/lib/node-adapter.js +10 -1
- package/dist/lib/open-target.d.ts +12 -0
- package/dist/lib/open-target.js +108 -0
- package/dist/lib/rate-limit-retry.d.ts +45 -0
- package/dist/lib/rate-limit-retry.js +88 -0
- package/dist/lib/store-listing.d.ts +45 -0
- package/dist/lib/store-listing.js +186 -0
- package/dist/lib/task-batch.d.ts +67 -0
- package/dist/lib/task-batch.js +227 -0
- package/dist/lib/terminal-qr.d.ts +55 -0
- package/dist/lib/terminal-qr.js +119 -0
- package/dist/lib/web-url.d.ts +11 -0
- package/dist/lib/web-url.js +24 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/computerWire.d.ts +68 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/computerWire.js +47 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/computerWire.d.ts +68 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/computerWire.js +46 -0
- package/dist/node_modules/@skrr-ai/auth-core/package.json +1 -1
- package/dist/node_modules/@skrr-ai/data-provider/index.js +6615 -6112
- package/oclif.manifest.json +41499 -32585
- package/package.json +2 -1
|
@@ -48,16 +48,17 @@ class TasksSelfSchedule extends base_command_1.BaseCommand {
|
|
|
48
48
|
async run() {
|
|
49
49
|
this.requireAuth();
|
|
50
50
|
const { args, flags } = await this.parse(TasksSelfSchedule);
|
|
51
|
+
const taskRef = await this.resolveEntityRef('task', args.id);
|
|
51
52
|
if (flags.show && flags.clear) {
|
|
52
53
|
this.error('Pass at most one of --show or --clear.', { exit: 1 });
|
|
53
54
|
}
|
|
54
55
|
let result;
|
|
55
56
|
try {
|
|
56
57
|
if (flags.show) {
|
|
57
|
-
result = await task_extras_1.taskSelfScheduleApi.get(
|
|
58
|
+
result = await task_extras_1.taskSelfScheduleApi.get(taskRef);
|
|
58
59
|
}
|
|
59
60
|
else if (flags.clear) {
|
|
60
|
-
result = await task_extras_1.taskSelfScheduleApi.clear(
|
|
61
|
+
result = await task_extras_1.taskSelfScheduleApi.clear(taskRef);
|
|
61
62
|
}
|
|
62
63
|
else {
|
|
63
64
|
const runAt = resolveRunAt(flags.at, flags.in);
|
|
@@ -66,7 +67,7 @@ class TasksSelfSchedule extends base_command_1.BaseCommand {
|
|
|
66
67
|
exit: 1,
|
|
67
68
|
});
|
|
68
69
|
}
|
|
69
|
-
result = await task_extras_1.taskSelfScheduleApi.park(
|
|
70
|
+
result = await task_extras_1.taskSelfScheduleApi.park(taskRef, {
|
|
70
71
|
runAt,
|
|
71
72
|
...(flags.note ? { note: flags.note } : {}),
|
|
72
73
|
...(flags['max-per-day'] ? { maxFiresPerDay: flags['max-per-day'] } : {}),
|
|
@@ -82,14 +83,14 @@ class TasksSelfSchedule extends base_command_1.BaseCommand {
|
|
|
82
83
|
}
|
|
83
84
|
const runAt = result?.runAt;
|
|
84
85
|
if (!runAt) {
|
|
85
|
-
this.log(`Task ${
|
|
86
|
+
this.log(`Task ${taskRef} has no pending return.`);
|
|
86
87
|
return;
|
|
87
88
|
}
|
|
88
89
|
// `pending` is derived server-side: a return that has already fired keeps
|
|
89
90
|
// its instant on the row, and printing that verbatim would report a return
|
|
90
91
|
// as upcoming an hour after it happened.
|
|
91
92
|
const spent = result?.pending === false;
|
|
92
|
-
this.log(`Task ${
|
|
93
|
+
this.log(`Task ${taskRef} ${spent ? 'last returned at' : 'returns at'} ${runAt}`);
|
|
93
94
|
if (result?.note)
|
|
94
95
|
this.log(`Note: ${result.note}`);
|
|
95
96
|
if (!spent && result?.maxFiresPerDay) {
|
|
@@ -50,17 +50,18 @@ class TasksSkillsPin extends base_command_1.BaseCommand {
|
|
|
50
50
|
return this.runBulk(flags['all-in-space'], positionals, flags.status, flags.json);
|
|
51
51
|
}
|
|
52
52
|
// First positional is the task id; the rest are skill ids.
|
|
53
|
-
const
|
|
53
|
+
const rawTaskId = positionals[0];
|
|
54
54
|
const incoming = positionals
|
|
55
55
|
.slice(1)
|
|
56
56
|
.map((s) => s.trim())
|
|
57
57
|
.filter(Boolean);
|
|
58
|
-
if (!
|
|
58
|
+
if (!rawTaskId) {
|
|
59
59
|
this.error('Task ID is required.', { exit: 1 });
|
|
60
60
|
}
|
|
61
61
|
if (incoming.length === 0) {
|
|
62
62
|
this.error('At least one skill ID positional is required.', { exit: 1 });
|
|
63
63
|
}
|
|
64
|
+
const taskId = await this.resolveEntityRef('task', rawTaskId);
|
|
64
65
|
let current;
|
|
65
66
|
try {
|
|
66
67
|
current = await data_provider_1.dataService.getTask(taskId, { enrich: false });
|
|
@@ -74,17 +74,18 @@ class TasksSkillsUnpin extends base_command_1.BaseCommand {
|
|
|
74
74
|
this.exit(1);
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
|
-
const
|
|
77
|
+
const rawTaskId = positionals[0];
|
|
78
78
|
const targets = new Set(positionals
|
|
79
79
|
.slice(1)
|
|
80
80
|
.map((s) => s.trim())
|
|
81
81
|
.filter(Boolean));
|
|
82
|
-
if (!
|
|
82
|
+
if (!rawTaskId) {
|
|
83
83
|
this.error('Task ID is required.', { exit: 1 });
|
|
84
84
|
}
|
|
85
85
|
if (targets.size === 0) {
|
|
86
86
|
this.error('At least one skill ID positional is required.', { exit: 1 });
|
|
87
87
|
}
|
|
88
|
+
const taskId = await this.resolveEntityRef('task', rawTaskId);
|
|
88
89
|
let current;
|
|
89
90
|
try {
|
|
90
91
|
current = await data_provider_1.dataService.getTask(taskId, { enrich: false });
|
|
@@ -62,25 +62,26 @@ class TasksSnooze extends base_command_1.BaseCommand {
|
|
|
62
62
|
this.failWithCliError({ ...failure, exit: 2, retryable: false });
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
|
+
const taskRef = await this.resolveEntityRef('task', identity.id);
|
|
65
66
|
try {
|
|
66
67
|
if (flags.status) {
|
|
67
|
-
const response = await data_provider_1.dataService.getTaskSnooze(
|
|
68
|
+
const response = await data_provider_1.dataService.getTaskSnooze(taskRef);
|
|
68
69
|
if (flags.json)
|
|
69
70
|
this.log(JSON.stringify(response, null, 2));
|
|
70
71
|
else
|
|
71
|
-
this.log(response.snoozed ? `Snoozed ${
|
|
72
|
+
this.log(response.snoozed ? `Snoozed ${taskRef}.` : `Not snoozed: ${taskRef}.`);
|
|
72
73
|
return;
|
|
73
74
|
}
|
|
74
|
-
const response = await data_provider_1.dataService.snoozeTask(
|
|
75
|
+
const response = await data_provider_1.dataService.snoozeTask(taskRef, {
|
|
75
76
|
...(flags.until ? { until: new Date(flags.until).toISOString() } : {}),
|
|
76
77
|
...(flags['until-activity'] ? { untilActivity: true } : {}),
|
|
77
78
|
});
|
|
78
79
|
if (flags.json)
|
|
79
80
|
this.log(JSON.stringify(response, null, 2));
|
|
80
81
|
else if (flags['until-activity'])
|
|
81
|
-
this.log(`Snoozed ${
|
|
82
|
+
this.log(`Snoozed ${taskRef} until new activity.`);
|
|
82
83
|
else
|
|
83
|
-
this.log(`Snoozed ${
|
|
84
|
+
this.log(`Snoozed ${taskRef} until ${new Date(flags.until).toLocaleString()}.`);
|
|
84
85
|
}
|
|
85
86
|
catch (error) {
|
|
86
87
|
this.handleApiError(error);
|
|
@@ -24,17 +24,18 @@ class TasksStartAll extends base_command_1.BaseCommand {
|
|
|
24
24
|
async run() {
|
|
25
25
|
this.requireAuth();
|
|
26
26
|
const { args, flags } = await this.parse(TasksStartAll);
|
|
27
|
+
const taskRef = await this.resolveEntityRef('task', args.id);
|
|
27
28
|
const mode = flags.mode;
|
|
28
29
|
let result;
|
|
29
30
|
try {
|
|
30
31
|
if (mode === 'dri') {
|
|
31
|
-
result = await data_provider_1.dataService.startDRIAgent(
|
|
32
|
+
result = await data_provider_1.dataService.startDRIAgent(taskRef);
|
|
32
33
|
}
|
|
33
34
|
else if (mode === 'dri-plan') {
|
|
34
|
-
result = await data_provider_1.dataService.startDRIPlan(
|
|
35
|
+
result = await data_provider_1.dataService.startDRIPlan(taskRef);
|
|
35
36
|
}
|
|
36
37
|
else {
|
|
37
|
-
result = await data_provider_1.dataService.startAllTasks(
|
|
38
|
+
result = await data_provider_1.dataService.startAllTasks(taskRef);
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
catch (err) {
|
|
@@ -44,7 +45,7 @@ class TasksStartAll extends base_command_1.BaseCommand {
|
|
|
44
45
|
this.log(JSON.stringify(result, null, 2));
|
|
45
46
|
return;
|
|
46
47
|
}
|
|
47
|
-
this.log(`Started ${mode} pipeline for task ${
|
|
48
|
+
this.log(`Started ${mode} pipeline for task ${taskRef}`);
|
|
48
49
|
const r = result;
|
|
49
50
|
if (r.runId)
|
|
50
51
|
this.log(`Run ID: ${r.runId}`);
|
|
@@ -31,6 +31,7 @@ class TasksTagsAdd extends base_command_1.BaseCommand {
|
|
|
31
31
|
async run() {
|
|
32
32
|
this.requireAuth();
|
|
33
33
|
const { args, flags } = await this.parse(TasksTagsAdd);
|
|
34
|
+
const taskRef = await this.resolveEntityRef('task', args.id);
|
|
34
35
|
const incoming = (flags.tag ?? [])
|
|
35
36
|
.map((t) => t.trim().toLowerCase())
|
|
36
37
|
.filter((t) => t.length > 0);
|
|
@@ -39,7 +40,7 @@ class TasksTagsAdd extends base_command_1.BaseCommand {
|
|
|
39
40
|
}
|
|
40
41
|
let current;
|
|
41
42
|
try {
|
|
42
|
-
current = await data_provider_1.dataService.getTask(
|
|
43
|
+
current = await data_provider_1.dataService.getTask(taskRef, { enrich: false });
|
|
43
44
|
}
|
|
44
45
|
catch (err) {
|
|
45
46
|
this.handleApiError(err);
|
|
@@ -55,7 +56,7 @@ class TasksTagsAdd extends base_command_1.BaseCommand {
|
|
|
55
56
|
let updated;
|
|
56
57
|
try {
|
|
57
58
|
updated = await data_provider_1.dataService.updateTask({
|
|
58
|
-
taskId:
|
|
59
|
+
taskId: taskRef,
|
|
59
60
|
data: { tags: merged },
|
|
60
61
|
});
|
|
61
62
|
}
|
|
@@ -68,7 +69,7 @@ class TasksTagsAdd extends base_command_1.BaseCommand {
|
|
|
68
69
|
}
|
|
69
70
|
const t = updated;
|
|
70
71
|
const ref = t.identifier ?? (t.taskNumber ? `#${t.taskNumber}` : '');
|
|
71
|
-
this.log(`Added ${incoming.length} tag(s) to task ${t.id ??
|
|
72
|
+
this.log(`Added ${incoming.length} tag(s) to task ${t.id ?? taskRef}${ref ? ` (${ref})` : ''} — now: ${merged.join(', ')}`);
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
75
|
exports.default = TasksTagsAdd;
|
|
@@ -27,13 +27,14 @@ class TasksTagsRemove extends base_command_1.BaseCommand {
|
|
|
27
27
|
async run() {
|
|
28
28
|
this.requireAuth();
|
|
29
29
|
const { args, flags } = await this.parse(TasksTagsRemove);
|
|
30
|
+
const taskRef = await this.resolveEntityRef('task', args.id);
|
|
30
31
|
const targets = new Set((flags.tag ?? []).map((t) => t.trim().toLowerCase()).filter((t) => t.length > 0));
|
|
31
32
|
if (targets.size === 0) {
|
|
32
33
|
this.error('At least one --tag is required.', { exit: 1 });
|
|
33
34
|
}
|
|
34
35
|
let current;
|
|
35
36
|
try {
|
|
36
|
-
current = await data_provider_1.dataService.getTask(
|
|
37
|
+
current = await data_provider_1.dataService.getTask(taskRef, { enrich: false });
|
|
37
38
|
}
|
|
38
39
|
catch (err) {
|
|
39
40
|
this.handleApiError(err);
|
|
@@ -49,7 +50,7 @@ class TasksTagsRemove extends base_command_1.BaseCommand {
|
|
|
49
50
|
let updated;
|
|
50
51
|
try {
|
|
51
52
|
updated = await data_provider_1.dataService.updateTask({
|
|
52
|
-
taskId:
|
|
53
|
+
taskId: taskRef,
|
|
53
54
|
data: { tags: next },
|
|
54
55
|
});
|
|
55
56
|
}
|
|
@@ -62,7 +63,7 @@ class TasksTagsRemove extends base_command_1.BaseCommand {
|
|
|
62
63
|
}
|
|
63
64
|
const t = updated;
|
|
64
65
|
const ref = t.identifier ?? (t.taskNumber ? `#${t.taskNumber}` : '');
|
|
65
|
-
this.log(`Removed ${existing.length - next.length} tag(s) from task ${t.id ??
|
|
66
|
+
this.log(`Removed ${existing.length - next.length} tag(s) from task ${t.id ?? taskRef}${ref ? ` (${ref})` : ''} — now: ${next.join(', ') || '(none)'}`);
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
69
|
exports.default = TasksTagsRemove;
|
|
@@ -33,9 +33,10 @@ class TasksTimeline extends base_command_1.BaseCommand {
|
|
|
33
33
|
async run() {
|
|
34
34
|
this.requireAuth();
|
|
35
35
|
const { args, flags } = await this.parse(TasksTimeline);
|
|
36
|
+
const taskRef = await this.resolveEntityRef('task', args.id);
|
|
36
37
|
let result;
|
|
37
38
|
try {
|
|
38
|
-
result = await data_provider_1.dataService.getTaskTimeline(
|
|
39
|
+
result = await data_provider_1.dataService.getTaskTimeline(taskRef, {
|
|
39
40
|
limit: flags.limit,
|
|
40
41
|
cursor: flags.cursor,
|
|
41
42
|
type: flags.type,
|
|
@@ -54,7 +55,7 @@ class TasksTimeline extends base_command_1.BaseCommand {
|
|
|
54
55
|
if (rows.length === 0) {
|
|
55
56
|
// `renderTable([])` prints NOTHING — no header, no empty state, exit 0 —
|
|
56
57
|
// which is indistinguishable from a broken command. Say what happened.
|
|
57
|
-
this.log(await (0, task_legacy_1.emptyCanonicalView)(
|
|
58
|
+
this.log(await (0, task_legacy_1.emptyCanonicalView)(taskRef, 'timeline entries'));
|
|
58
59
|
return;
|
|
59
60
|
}
|
|
60
61
|
(0, format_1.renderTable)(rows.map((item) => ({
|
|
@@ -3,10 +3,13 @@ export default class TasksToday extends BaseCommand {
|
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
|
+
'include-snoozed': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
fields: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
compact: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
ndjson: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
6
10
|
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
7
11
|
limit: import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
12
|
cursor: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
-
'include-snoozed': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
13
|
};
|
|
11
14
|
run(): Promise<void>;
|
|
12
15
|
}
|
|
@@ -5,6 +5,7 @@ const data_provider_1 = require("@skrr-ai/data-provider");
|
|
|
5
5
|
const base_command_1 = require("../../base-command");
|
|
6
6
|
const web_url_1 = require("../../lib/web-url");
|
|
7
7
|
const format_1 = require("../../lib/format");
|
|
8
|
+
const list_output_1 = require("../../lib/list-output");
|
|
8
9
|
class TasksToday extends base_command_1.BaseCommand {
|
|
9
10
|
static description = "List today's tasks";
|
|
10
11
|
static examples = [
|
|
@@ -12,11 +13,13 @@ class TasksToday extends base_command_1.BaseCommand {
|
|
|
12
13
|
'<%= config.bin %> tasks today --limit 25',
|
|
13
14
|
'<%= config.bin %> tasks today --json',
|
|
14
15
|
'<%= config.bin %> tasks today --include-snoozed',
|
|
16
|
+
'<%= config.bin %> tasks today --compact --json',
|
|
15
17
|
];
|
|
16
18
|
static flags = {
|
|
17
19
|
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
18
20
|
limit: core_1.Flags.integer({ description: 'Max results', default: 50 }),
|
|
19
21
|
cursor: core_1.Flags.string({ description: 'Pagination cursor from a previous page' }),
|
|
22
|
+
...list_output_1.listOutputFlags,
|
|
20
23
|
'include-snoozed': core_1.Flags.boolean({
|
|
21
24
|
description: 'Include tasks you have personally snoozed (hidden by default)',
|
|
22
25
|
}),
|
|
@@ -35,8 +38,15 @@ class TasksToday extends base_command_1.BaseCommand {
|
|
|
35
38
|
catch (err) {
|
|
36
39
|
this.handleApiError(err);
|
|
37
40
|
}
|
|
38
|
-
if (flags.json) {
|
|
39
|
-
|
|
41
|
+
if (flags.json || flags.ndjson) {
|
|
42
|
+
// `/tasks/today` has no server-side `view=summary`, so --compact is a
|
|
43
|
+
// client-side trim here: the rows still cross the wire.
|
|
44
|
+
this.printList((0, list_output_1.shapeListResponse)((0, web_url_1.withDataUrls)(this.cliConfig.baseURL, response, web_url_1.taskUrlFrom), {
|
|
45
|
+
resource: 'task',
|
|
46
|
+
fields: flags.fields,
|
|
47
|
+
compact: flags.compact,
|
|
48
|
+
requestedLimit: flags.limit,
|
|
49
|
+
}), Boolean(flags.ndjson));
|
|
40
50
|
return;
|
|
41
51
|
}
|
|
42
52
|
const r = response;
|
|
@@ -55,9 +55,10 @@ class TasksTranscript extends base_command_1.BaseCommand {
|
|
|
55
55
|
details: { suggestion: failure.suggestion, context: failure.details },
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
+
const taskRef = await this.resolveEntityRef('task', taskIdentity.id);
|
|
58
59
|
let task;
|
|
59
60
|
try {
|
|
60
|
-
task = (await data_provider_1.dataService.getTask(
|
|
61
|
+
task = (await data_provider_1.dataService.getTask(taskRef, { enrich: false }));
|
|
61
62
|
}
|
|
62
63
|
catch (err) {
|
|
63
64
|
this.handleApiError(err);
|
|
@@ -67,13 +68,13 @@ class TasksTranscript extends base_command_1.BaseCommand {
|
|
|
67
68
|
// A task with no execution conversation has simply never been run by an
|
|
68
69
|
// agent — a real state, not a lookup failure. Say which one it is.
|
|
69
70
|
this.failWithCliError({
|
|
70
|
-
message: `Task ${task.identifier ??
|
|
71
|
+
message: `Task ${task.identifier ?? taskRef} has no execution conversation yet (status: ${task.status ?? 'unknown'}).`,
|
|
71
72
|
code: 'TASK_CONVERSATION_MISSING',
|
|
72
73
|
exit: 4,
|
|
73
74
|
retryable: false,
|
|
74
75
|
details: {
|
|
75
76
|
suggestion: 'Start the task (`skrr tasks start <task-id>`) or check `skrr tasks runs <task-id>` for a failed run.',
|
|
76
|
-
taskId:
|
|
77
|
+
taskId: taskRef,
|
|
77
78
|
status: task.status ?? null,
|
|
78
79
|
},
|
|
79
80
|
});
|
|
@@ -93,7 +94,7 @@ class TasksTranscript extends base_command_1.BaseCommand {
|
|
|
93
94
|
if (flags.json) {
|
|
94
95
|
this.log(JSON.stringify({
|
|
95
96
|
object: 'sky.task_transcript',
|
|
96
|
-
taskId: String(task.id ??
|
|
97
|
+
taskId: String(task.id ?? taskRef),
|
|
97
98
|
identifier: task.identifier ?? null,
|
|
98
99
|
status: task.status ?? null,
|
|
99
100
|
conversationId,
|
|
@@ -104,7 +105,7 @@ class TasksTranscript extends base_command_1.BaseCommand {
|
|
|
104
105
|
}, null, 2));
|
|
105
106
|
return;
|
|
106
107
|
}
|
|
107
|
-
this.log(`Task: ${task.identifier ?? task.id ??
|
|
108
|
+
this.log(`Task: ${task.identifier ?? task.id ?? taskRef} — ${task.title ?? '-'}`);
|
|
108
109
|
this.log(`Status: ${task.status ?? '-'}`);
|
|
109
110
|
this.log(`Conversation: ${conversationId}`);
|
|
110
111
|
this.log('');
|
|
@@ -19,9 +19,10 @@ class TasksUnschedule extends base_command_1.BaseCommand {
|
|
|
19
19
|
async run() {
|
|
20
20
|
this.requireAuth();
|
|
21
21
|
const { args, flags } = await this.parse(TasksUnschedule);
|
|
22
|
+
const taskRef = await this.resolveEntityRef('task', args.id);
|
|
22
23
|
let result;
|
|
23
24
|
try {
|
|
24
|
-
result = await data_provider_1.dataService.unscheduleTask(
|
|
25
|
+
result = await data_provider_1.dataService.unscheduleTask(taskRef);
|
|
25
26
|
}
|
|
26
27
|
catch (err) {
|
|
27
28
|
this.handleApiError(err);
|
|
@@ -32,7 +33,7 @@ class TasksUnschedule extends base_command_1.BaseCommand {
|
|
|
32
33
|
}
|
|
33
34
|
const t = result;
|
|
34
35
|
const ref = t.identifier ?? (t.taskNumber ? `#${t.taskNumber}` : '');
|
|
35
|
-
this.log(`Unscheduled task ${t.id ?? t._id ??
|
|
36
|
+
this.log(`Unscheduled task ${t.id ?? t._id ?? taskRef}${ref ? ` (${ref})` : ''}`);
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
exports.default = TasksUnschedule;
|
|
@@ -30,12 +30,13 @@ class TasksUnsnooze extends base_command_1.BaseCommand {
|
|
|
30
30
|
this.failWithCliError({ ...failure, exit: 2, retryable: false });
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
+
const taskRef = await this.resolveEntityRef('task', identity.id);
|
|
33
34
|
try {
|
|
34
|
-
const response = await data_provider_1.dataService.unsnoozeTask(
|
|
35
|
+
const response = await data_provider_1.dataService.unsnoozeTask(taskRef);
|
|
35
36
|
if (flags.json)
|
|
36
37
|
this.log(JSON.stringify(response, null, 2));
|
|
37
38
|
else
|
|
38
|
-
this.log(`Unsnoozed ${
|
|
39
|
+
this.log(`Unsnoozed ${taskRef}.`);
|
|
39
40
|
}
|
|
40
41
|
catch (error) {
|
|
41
42
|
this.handleApiError(error);
|
|
@@ -36,10 +36,11 @@ class TasksUnsubscribe extends base_command_1.BaseCommand {
|
|
|
36
36
|
});
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
|
+
const taskRef = await this.resolveEntityRef('task', identity.id);
|
|
39
40
|
let task;
|
|
40
41
|
let response = { unsubscribed: false };
|
|
41
42
|
try {
|
|
42
|
-
task = await data_provider_1.dataService.getTask(
|
|
43
|
+
task = await data_provider_1.dataService.getTask(taskRef);
|
|
43
44
|
const subscriptions = await data_provider_1.dataService.listEntitySubscriptions({ entityType: 'task' });
|
|
44
45
|
const subscription = subscriptions.items.find((candidate) => candidate.entityId === task.id && candidate.subscriberType === 'user');
|
|
45
46
|
if (subscription?.id)
|
|
@@ -220,6 +220,7 @@ class TasksUpdate extends base_command_1.BaseCommand {
|
|
|
220
220
|
details: { suggestion: failure.suggestion, context: failure.details },
|
|
221
221
|
});
|
|
222
222
|
}
|
|
223
|
+
const taskRef = await this.resolveEntityRef('task', taskIdentity.id);
|
|
223
224
|
// `--expect clear` is an explicit empty list, which the API turns into $unset —
|
|
224
225
|
// distinct from omitting the flag, which leaves the declaration untouched.
|
|
225
226
|
// Without the sentinel there is no way to say "stop requiring an output"
|
|
@@ -284,7 +285,7 @@ class TasksUpdate extends base_command_1.BaseCommand {
|
|
|
284
285
|
if (changesSpec) {
|
|
285
286
|
let settled = [];
|
|
286
287
|
try {
|
|
287
|
-
const acceptance = await data_provider_1.dataService.getTaskAcceptance(
|
|
288
|
+
const acceptance = await data_provider_1.dataService.getTaskAcceptance(taskRef);
|
|
288
289
|
settled = acceptance.expectations.filter((e) => e.assessmentId);
|
|
289
290
|
}
|
|
290
291
|
catch {
|
|
@@ -435,7 +436,7 @@ class TasksUpdate extends base_command_1.BaseCommand {
|
|
|
435
436
|
await this.resolveAssigneesInPayload(payload, {
|
|
436
437
|
resolveSpaceId: async () => {
|
|
437
438
|
try {
|
|
438
|
-
const task = (await data_provider_1.dataService.getTask(
|
|
439
|
+
const task = (await data_provider_1.dataService.getTask(taskRef, { enrich: false }));
|
|
439
440
|
return typeof task.spaceId === 'string' ? task.spaceId : undefined;
|
|
440
441
|
}
|
|
441
442
|
catch {
|
|
@@ -448,7 +449,7 @@ class TasksUpdate extends base_command_1.BaseCommand {
|
|
|
448
449
|
let updated;
|
|
449
450
|
try {
|
|
450
451
|
updated = await data_provider_1.dataService.updateTask({
|
|
451
|
-
taskId:
|
|
452
|
+
taskId: taskRef,
|
|
452
453
|
data: payload,
|
|
453
454
|
});
|
|
454
455
|
}
|
|
@@ -481,7 +482,7 @@ class TasksUpdate extends base_command_1.BaseCommand {
|
|
|
481
482
|
}
|
|
482
483
|
const t = updated;
|
|
483
484
|
const ref = t.identifier ?? (t.taskNumber ? `#${t.taskNumber}` : '');
|
|
484
|
-
this.log(`Updated task ${t.id ?? t._id ??
|
|
485
|
+
this.log(`Updated task ${t.id ?? t._id ?? taskRef}${ref ? ` (${ref})` : ''} — ${t.title ?? '(no title)'}`);
|
|
485
486
|
// `--yes` asserts the revocation; it does not erase that it happened.
|
|
486
487
|
// Report the cost after the write too, or the evidence is silently gone.
|
|
487
488
|
if (changesSpec && flags.yes && (settledSpecAssessments > 0 || acceptanceUnreadable)) {
|
|
@@ -54,6 +54,7 @@ class TasksWait extends base_command_1.BaseCommand {
|
|
|
54
54
|
details: { suggestion: failure.suggestion, context: failure.details },
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
+
const taskRef = await this.resolveEntityRef('task', taskIdentity.id);
|
|
57
58
|
const failOn = (0, task_execution_1.parseStatusSet)(flags['fail-on'], task_execution_1.DEFAULT_FAIL_STATUSES);
|
|
58
59
|
let timeoutMs = null;
|
|
59
60
|
try {
|
|
@@ -75,16 +76,16 @@ class TasksWait extends base_command_1.BaseCommand {
|
|
|
75
76
|
try {
|
|
76
77
|
tasks = flags.descendants
|
|
77
78
|
? await (0, task_execution_1.fetchTaskSet)({
|
|
78
|
-
rootId:
|
|
79
|
+
rootId: taskRef,
|
|
79
80
|
descendants: true,
|
|
80
81
|
childrenOnly: flags['children-only'],
|
|
81
82
|
})
|
|
82
|
-
: await (0, task_execution_1.fetchTaskSet)({ ids: [
|
|
83
|
+
: await (0, task_execution_1.fetchTaskSet)({ ids: [taskRef, ...(flags.task ?? [])] });
|
|
83
84
|
}
|
|
84
85
|
catch (err) {
|
|
85
86
|
this.handleApiError(err);
|
|
86
87
|
}
|
|
87
|
-
const snapshot = (0, task_execution_1.buildSnapshot)(tasks, failOn,
|
|
88
|
+
const snapshot = (0, task_execution_1.buildSnapshot)(tasks, failOn, taskRef);
|
|
88
89
|
const failed = snapshot.failureTasks.length > 0;
|
|
89
90
|
const satisfied = snapshot.tasks.length > 0 &&
|
|
90
91
|
snapshot.tasks.every((task) => (0, task_execution_1.satisfiesWaitTarget)(task, flags.until));
|
|
@@ -101,7 +102,7 @@ class TasksWait extends base_command_1.BaseCommand {
|
|
|
101
102
|
}
|
|
102
103
|
if (timeoutMs != null && Date.now() - startedAt >= timeoutMs) {
|
|
103
104
|
this.failWithCliError({
|
|
104
|
-
message: `Timed out waiting for ${
|
|
105
|
+
message: `Timed out waiting for ${taskRef} after ${flags.timeout}.`,
|
|
105
106
|
code: 'TASK_WAIT_TIMEOUT',
|
|
106
107
|
exit: 124,
|
|
107
108
|
retryable: true,
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type DistributionChannel, type StoreBadgeStyle } from '@skrr-ai/data-provider';
|
|
2
|
+
/**
|
|
3
|
+
* The CLI's half of agent distribution (docs/architecture/agent-distribution-2026-10-08.md):
|
|
4
|
+
* minting the sharer's attribution code for a public agent and building the
|
|
5
|
+
* addresses `skrr agents share` and `skrr agents badge` print.
|
|
6
|
+
*
|
|
7
|
+
* Every URL comes from data-provider's one builder over this deployment's web
|
|
8
|
+
* origin — never a hand-spelled `/a/…` — so a link printed here is the link the
|
|
9
|
+
* web and mobile share sheets print for the same (sharer, agent, channel).
|
|
10
|
+
*/
|
|
11
|
+
export type AgentShareLink = {
|
|
12
|
+
agentId: string;
|
|
13
|
+
channel: DistributionChannel;
|
|
14
|
+
code: string;
|
|
15
|
+
url: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The server answers every kind of not-public (private, unpublished, missing,
|
|
19
|
+
* moderated) with the same 404, so the CLI cannot — and must not try to — tell
|
|
20
|
+
* them apart. What it CAN say is what to do instead.
|
|
21
|
+
*/
|
|
22
|
+
export declare class AgentNotShareableError extends Error {
|
|
23
|
+
readonly agentId: string;
|
|
24
|
+
readonly code = "AGENT_NOT_SHAREABLE";
|
|
25
|
+
constructor(agentId: string);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Mint (idempotently — the same sharer, agent and channel always get the same
|
|
29
|
+
* code) and return the canonical attributed listing URL.
|
|
30
|
+
*/
|
|
31
|
+
export declare function mintAgentShareLink({ baseURL, agentId, channel, }: {
|
|
32
|
+
baseURL: string;
|
|
33
|
+
agentId: string;
|
|
34
|
+
channel: DistributionChannel;
|
|
35
|
+
}): Promise<AgentShareLink>;
|
|
36
|
+
/** The anonymous badge image of a public listing, on the API this CLI talks to. */
|
|
37
|
+
export declare function agentBadgeImageUrl(agentId: string, style?: StoreBadgeStyle): string;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AgentNotShareableError = void 0;
|
|
4
|
+
exports.mintAgentShareLink = mintAgentShareLink;
|
|
5
|
+
exports.agentBadgeImageUrl = agentBadgeImageUrl;
|
|
6
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
7
|
+
const http_error_1 = require("./http-error");
|
|
8
|
+
const web_url_1 = require("./web-url");
|
|
9
|
+
/**
|
|
10
|
+
* The server answers every kind of not-public (private, unpublished, missing,
|
|
11
|
+
* moderated) with the same 404, so the CLI cannot — and must not try to — tell
|
|
12
|
+
* them apart. What it CAN say is what to do instead.
|
|
13
|
+
*/
|
|
14
|
+
class AgentNotShareableError extends Error {
|
|
15
|
+
agentId;
|
|
16
|
+
code = 'AGENT_NOT_SHAREABLE';
|
|
17
|
+
constructor(agentId) {
|
|
18
|
+
super(`${agentId} has no public Store listing, so it has no public link: it is private, ` +
|
|
19
|
+
'unpublished, or does not exist. To give one person access to a private agent, use ' +
|
|
20
|
+
`\`skrr agent-shares create ${agentId} --recipient <user-id>\`; to publish it, ` +
|
|
21
|
+
`\`skrr agents visibility ${agentId} --public\`.`);
|
|
22
|
+
this.agentId = agentId;
|
|
23
|
+
this.name = 'AgentNotShareableError';
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.AgentNotShareableError = AgentNotShareableError;
|
|
27
|
+
function isNotDistributable(err) {
|
|
28
|
+
if ((0, http_error_1.httpStatusOf)(err) === 404)
|
|
29
|
+
return true;
|
|
30
|
+
const body = (0, http_error_1.httpBodyOf)(err);
|
|
31
|
+
return body?.code === 'ENTITY_NOT_FOUND';
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Mint (idempotently — the same sharer, agent and channel always get the same
|
|
35
|
+
* code) and return the canonical attributed listing URL.
|
|
36
|
+
*/
|
|
37
|
+
async function mintAgentShareLink({ baseURL, agentId, channel, }) {
|
|
38
|
+
let minted;
|
|
39
|
+
try {
|
|
40
|
+
minted = await data_provider_1.dataService.mintDistributionCode({
|
|
41
|
+
entity: { kind: 'agent', id: agentId },
|
|
42
|
+
channel,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
if (isNotDistributable(err))
|
|
47
|
+
throw new AgentNotShareableError(agentId);
|
|
48
|
+
throw err;
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
agentId,
|
|
52
|
+
channel,
|
|
53
|
+
code: minted.code,
|
|
54
|
+
url: (0, data_provider_1.buildShareUrl)((0, web_url_1.webOrigin)(baseURL), { kind: 'agent', id: agentId }, {
|
|
55
|
+
code: minted.code,
|
|
56
|
+
channel,
|
|
57
|
+
}),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/** The anonymous badge image of a public listing, on the API this CLI talks to. */
|
|
61
|
+
function agentBadgeImageUrl(agentId, style) {
|
|
62
|
+
return (0, data_provider_1.publicStoreAgentBadge)(agentId, style && style !== 'flat' ? { style } : {});
|
|
63
|
+
}
|