@skrr-ai/cli 0.1.232 → 0.1.233
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 +29 -13
- package/bin/dev.cjs +0 -1
- package/bin/run.js +0 -15
- package/dist/base-command.d.ts +6 -1
- package/dist/base-command.js +24 -4
- package/dist/commands/agenda/plan.d.ts +2 -1
- package/dist/commands/agenda/plan.js +18 -4
- package/dist/commands/agents/chat.d.ts +2 -0
- package/dist/commands/agents/chat.js +59 -13
- package/dist/commands/agents/eval/list.d.ts +4 -0
- package/dist/commands/agents/eval/list.js +33 -0
- package/dist/commands/agents/permissions/policy.js +25 -2
- package/dist/commands/agents/spawn.js +61 -24
- package/dist/commands/agents/triggers/fire.js +1 -1
- package/dist/commands/agents/triggers/runs.js +3 -0
- package/dist/commands/code/jobs/approve.d.ts +1 -11
- package/dist/commands/code/jobs/approve.js +3 -15
- package/dist/commands/code/jobs/cancel.js +3 -2
- package/dist/commands/code/jobs/index.js +1 -1
- package/dist/commands/code/jobs/list.js +4 -11
- package/dist/commands/code/jobs/run.js +13 -7
- package/dist/commands/code/jobs/show.js +51 -6
- package/dist/commands/commands.d.ts +1 -0
- package/dist/commands/commands.js +5 -1
- package/dist/commands/context.d.ts +1 -0
- package/dist/commands/context.js +1 -0
- package/dist/commands/duties/catalog/add.d.ts +18 -0
- package/dist/commands/duties/catalog/add.js +52 -0
- package/dist/commands/duties/catalog/index.d.ts +18 -0
- package/dist/commands/duties/catalog/index.js +88 -0
- package/dist/commands/duties/receipt.js +56 -1
- package/dist/commands/goals/planner-compare.js +5 -3
- package/dist/commands/instructions/discovery.d.ts +10 -0
- package/dist/commands/instructions/discovery.js +74 -0
- package/dist/commands/runs/admission.d.ts +12 -0
- package/dist/commands/runs/admission.js +66 -0
- package/dist/commands/runs/events.d.ts +2 -0
- package/dist/commands/runs/events.js +40 -10
- package/dist/commands/runs/list.d.ts +7 -1
- package/dist/commands/runs/list.js +81 -17
- package/dist/commands/runs/show.d.ts +1 -0
- package/dist/commands/runs/show.js +225 -15
- package/dist/commands/runs/stop.d.ts +1 -0
- package/dist/commands/runs/stop.js +34 -7
- package/dist/commands/runs/transcript.d.ts +2 -0
- package/dist/commands/runs/transcript.js +102 -17
- package/dist/commands/tasks/attachments/download.d.ts +1 -0
- package/dist/commands/tasks/attachments/download.js +6 -4
- package/dist/commands/tasks/attachments/source.d.ts +6 -0
- package/dist/commands/tasks/attachments/source.js +18 -0
- package/dist/commands/tasks/chat/exchange.d.ts +0 -14
- package/dist/commands/tasks/chat/exchange.js +8 -39
- package/dist/commands/tasks/chat/reply-run.d.ts +15 -0
- package/dist/commands/tasks/chat/reply-run.js +69 -0
- package/dist/commands/tasks/complete.js +1 -1
- package/dist/commands/tasks/lifecycle/transition.d.ts +1 -0
- package/dist/commands/tasks/lifecycle/transition.js +51 -13
- package/dist/commands/tasks/operations/show.js +5 -0
- package/dist/commands/tasks/result/submit.js +4 -2
- package/dist/commands/tasks/retry.js +25 -16
- package/dist/commands/triggers/audit.js +3 -1
- package/dist/commands/triggers/fire-detail.js +4 -1
- package/dist/commands/triggers/fire.js +1 -1
- package/dist/commands/usage.d.ts +1 -0
- package/dist/commands/usage.js +1 -0
- package/dist/generated/agent-guides.json +64 -712
- package/dist/help.d.ts +2 -7
- package/dist/help.js +13 -7
- package/dist/hooks/init.js +10 -0
- package/dist/lib/agent-evals.d.ts +1 -1
- package/dist/lib/agent-evals.js +13 -3
- package/dist/lib/agent-guides.d.ts +3 -5
- package/dist/lib/agent-guides.js +12 -13
- package/dist/lib/agent-runs.d.ts +69 -9
- package/dist/lib/agent-runs.js +208 -35
- package/dist/lib/agentic-stream.d.ts +12 -0
- package/dist/lib/agentic-stream.js +163 -79
- package/dist/lib/api-fetch.d.ts +2 -0
- package/dist/lib/api-fetch.js +6 -1
- package/dist/lib/command-manifest.d.ts +1 -6
- package/dist/lib/command-manifest.js +86 -13
- package/dist/lib/config.d.ts +2 -3
- package/dist/lib/config.js +2 -3
- package/dist/lib/duties.d.ts +5 -1
- package/dist/lib/duties.js +4 -0
- package/dist/lib/execution-history.d.ts +3 -0
- package/dist/lib/format.d.ts +1 -0
- package/dist/lib/format.js +18 -0
- package/dist/lib/guide-pointer.d.ts +5 -1
- package/dist/lib/guide-pointer.js +21 -2
- package/dist/lib/hosted-job-status.d.ts +4 -0
- package/dist/lib/hosted-job-status.js +19 -0
- package/dist/lib/inbound-messages.d.ts +1 -0
- package/dist/lib/inbound-messages.js +2 -0
- package/dist/lib/roles.d.ts +2 -2
- package/dist/lib/schedule.d.ts +4 -0
- package/dist/lib/schedule.js +4 -3
- package/dist/lib/task-execution.d.ts +1 -1
- package/dist/lib/task-execution.js +3 -19
- package/dist/lib/task-extras.d.ts +11 -1
- package/dist/lib/task-extras.js +15 -1
- package/dist/lib/task-transcript.js +3 -8
- package/dist/lib/triggers.d.ts +5 -36
- package/dist/lib/triggers.js +48 -33
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.js +5 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessCommand.d.ts +37 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessCommand.js +59 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.js +5 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessCommand.d.ts +37 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessCommand.js +57 -0
- package/dist/node_modules/@skrr-ai/auth-core/package.json +10 -0
- package/dist/node_modules/@skrr-ai/data-provider/index.js +12261 -12172
- package/docs/v1/quickstart.md +18 -0
- package/oclif.manifest.json +2505 -629
- package/package.json +3 -2
- package/skills/skrr/SKILL.md +14 -0
- package/dist/commands/triggers/runs.d.ts +0 -22
- package/dist/commands/triggers/runs.js +0 -58
|
@@ -27,7 +27,9 @@ function workerPolicyWindowLines(policy) {
|
|
|
27
27
|
continue;
|
|
28
28
|
const state = window.enabled === undefined
|
|
29
29
|
? 'disabled; enabled not specified'
|
|
30
|
-
: window.enabled
|
|
30
|
+
: window.enabled
|
|
31
|
+
? 'enabled'
|
|
32
|
+
: 'disabled';
|
|
31
33
|
lines.push(` ${label}: ${window.start}–${window.end} ${window.timezone ?? '(no zone recorded)'} (${state})`);
|
|
32
34
|
}
|
|
33
35
|
return lines;
|
|
@@ -37,8 +39,14 @@ function specWithEffectiveWindowFlags(spec) {
|
|
|
37
39
|
const policy = spec.worker?.policy;
|
|
38
40
|
if (!spec.worker || !policy)
|
|
39
41
|
return spec;
|
|
40
|
-
const workingHours = policy.workingHours && {
|
|
41
|
-
|
|
42
|
+
const workingHours = policy.workingHours && {
|
|
43
|
+
...policy.workingHours,
|
|
44
|
+
enabled: policy.workingHours.enabled ?? false,
|
|
45
|
+
};
|
|
46
|
+
const quietHours = policy.quietHours && {
|
|
47
|
+
...policy.quietHours,
|
|
48
|
+
enabled: policy.quietHours.enabled ?? false,
|
|
49
|
+
};
|
|
42
50
|
return {
|
|
43
51
|
...spec,
|
|
44
52
|
worker: {
|
|
@@ -69,7 +77,12 @@ exports.SPEC_TEMPLATE = {
|
|
|
69
77
|
watchers: [{ source: 'task_goal_watcher', intervalMinutes: 60 }],
|
|
70
78
|
policy: {
|
|
71
79
|
mode: 'ask_first',
|
|
72
|
-
workingHours: {
|
|
80
|
+
workingHours: {
|
|
81
|
+
enabled: true,
|
|
82
|
+
start: '09:00',
|
|
83
|
+
end: '18:00',
|
|
84
|
+
timezone: 'America/Los_Angeles',
|
|
85
|
+
},
|
|
73
86
|
},
|
|
74
87
|
},
|
|
75
88
|
orchestrator: {
|
|
@@ -107,7 +120,7 @@ function installPlanLines(items, bin) {
|
|
|
107
120
|
? 'will be blocked'
|
|
108
121
|
: item.origin;
|
|
109
122
|
const note = item.status === 'declined'
|
|
110
|
-
? item.reason ?? 'declined'
|
|
123
|
+
? (item.reason ?? 'declined')
|
|
111
124
|
: item.status === 'will_be_blocked'
|
|
112
125
|
? `${item.reason ?? 'blocked'}: ${item.detail ?? 'the runtime cannot run it'}`
|
|
113
126
|
: item.origin === 'default'
|
|
@@ -180,11 +193,19 @@ function initializeSummary(initialize) {
|
|
|
180
193
|
const goals = initialize.goals.filter((item) => item.ok);
|
|
181
194
|
const tasks = initialize.tasks.filter((item) => item.ok);
|
|
182
195
|
const jobs = initialize.jobs.filter((item) => item.ok);
|
|
183
|
-
const failed = initialize.goals.length +
|
|
184
|
-
|
|
196
|
+
const failed = initialize.goals.length +
|
|
197
|
+
initialize.tasks.length +
|
|
198
|
+
initialize.jobs.length -
|
|
199
|
+
goals.length -
|
|
200
|
+
tasks.length -
|
|
201
|
+
jobs.length;
|
|
185
202
|
if (!goals.length && !tasks.length && !jobs.length && !failed)
|
|
186
203
|
return null;
|
|
187
|
-
const parts = [
|
|
204
|
+
const parts = [
|
|
205
|
+
noun(goals.length, 'goal'),
|
|
206
|
+
noun(tasks.length, 'task'),
|
|
207
|
+
noun(jobs.length, 'scheduled job'),
|
|
208
|
+
];
|
|
188
209
|
const existing = [...goals, ...tasks].filter((item) => item.existing).length;
|
|
189
210
|
return (parts.join(', ') +
|
|
190
211
|
(existing ? ` (${existing} already existed)` : '') +
|
|
@@ -214,8 +235,11 @@ function proactiveInstallReadiness(result, bin) {
|
|
|
214
235
|
// A Duty the owner deleted is reported, not repaired: it was not recreated on
|
|
215
236
|
// purpose, and a repair command that names its id is a dead end (OSK-22381).
|
|
216
237
|
const deleted = (result.installed.duties || []).filter((duty) => duty.status === 'deleted');
|
|
217
|
-
const affected = (result.installed.duties || []).filter((duty) => duty.status !== 'deleted' &&
|
|
218
|
-
|
|
238
|
+
const affected = (result.installed.duties || []).filter((duty) => duty.status !== 'deleted' &&
|
|
239
|
+
(duty.status !== 'active' ||
|
|
240
|
+
result.warnings.some((warning) => warning.step === `duty.${duty.title}`)));
|
|
241
|
+
if (deleted.length &&
|
|
242
|
+
!affected.length &&
|
|
219
243
|
result.warnings.every((warning) => warning.code === 'duty_deleted_not_recreated')) {
|
|
220
244
|
return {
|
|
221
245
|
status: 'degraded',
|
|
@@ -230,9 +254,10 @@ function proactiveInstallReadiness(result, bin) {
|
|
|
230
254
|
// stopped activation was a gate that clears by itself. Say so and name the
|
|
231
255
|
// command that finishes the job; `duties preflight` is a dry run that
|
|
232
256
|
// never mentions resume (OSK-22351).
|
|
233
|
-
const stillStarting = affected.length > 0 &&
|
|
234
|
-
(duty
|
|
235
|
-
|
|
257
|
+
const stillStarting = affected.length > 0 &&
|
|
258
|
+
affected.every((duty) => duty.status === 'draft' &&
|
|
259
|
+
(duty.activationBlockedBy || []).length > 0 &&
|
|
260
|
+
(duty.activationBlockedBy || []).every((entry) => entry.gate === 'always_on' && entry.reason === 'reconcile_pending'));
|
|
236
261
|
if (stillStarting && ids.length) {
|
|
237
262
|
return {
|
|
238
263
|
status: 'degraded',
|
|
@@ -266,7 +291,9 @@ function proactiveInstallReadiness(result, bin) {
|
|
|
266
291
|
: 'A requested Duty needs attention. Review the setup warnings and inspect the Agent’s existing Duties before deciding what to do next.',
|
|
267
292
|
...(ids.length === 1
|
|
268
293
|
? { repairCommand: `${bin} duties preflight ${ids[0]}` }
|
|
269
|
-
: safeAgentId
|
|
294
|
+
: safeAgentId
|
|
295
|
+
? { repairCommand: `${bin} duties list --agent ${safeAgentId}` }
|
|
296
|
+
: {}),
|
|
270
297
|
};
|
|
271
298
|
}
|
|
272
299
|
if (result.warnings.some((warning) => ['job_preserved_disabled', 'job_already_fired', 'job_state_unavailable'].includes(warning.code))) {
|
|
@@ -307,9 +334,7 @@ function proactiveInstallReadiness(result, bin) {
|
|
|
307
334
|
status: 'degraded',
|
|
308
335
|
message: 'What the spec asked for is installed. Part of the new Agent\u2019s own setup did not finish; ' +
|
|
309
336
|
'the warning below says which part and why. Re-running the spec does not change that.',
|
|
310
|
-
...(inspectAgent
|
|
311
|
-
? { repairCommand: `${bin} duties operating-review ${inspectAgent}` }
|
|
312
|
-
: {}),
|
|
337
|
+
...(inspectAgent ? { repairCommand: `${bin} duties operating-review ${inspectAgent}` } : {}),
|
|
313
338
|
};
|
|
314
339
|
}
|
|
315
340
|
// A full trigger budget must not make a new persona-only Agent look broken
|
|
@@ -349,7 +374,8 @@ function proactiveInstallReadiness(result, bin) {
|
|
|
349
374
|
* `--from-spec` for an exact, reviewed install (which may carry higher autonomy).
|
|
350
375
|
*/
|
|
351
376
|
class AgentsSpawn extends base_command_1.BaseCommand {
|
|
352
|
-
static description = 'Spawn a complete proactive agent from one sentence (plan → review → approve)\n\n' +
|
|
377
|
+
static description = 'Spawn a complete proactive agent from one sentence (plan → review → approve)\n\n' +
|
|
378
|
+
exports.SPEC_FORMAT_HELP;
|
|
353
379
|
static examples = [
|
|
354
380
|
'<%= config.bin %> agents spawn "watch my Slack and flag urgent unanswered messages"',
|
|
355
381
|
'<%= config.bin %> agents spawn "plan my day every morning, working hours 9-6" --approve',
|
|
@@ -395,7 +421,7 @@ class AgentsSpawn extends base_command_1.BaseCommand {
|
|
|
395
421
|
description: 'Print a valid spec JSON to edit and pass to --from-spec, and exit (creates nothing)',
|
|
396
422
|
}),
|
|
397
423
|
minimal: core_1.Flags.boolean({
|
|
398
|
-
description: 'Install only what the spec asks for: decline every default the platform would add (the memory and task/goal scans, the initiative follow-through loop, the
|
|
424
|
+
description: 'Install only what the spec asks for: decline every default the platform would add (the memory and task/goal scans, the initiative follow-through loop, the five default loops). The plan lists each default first',
|
|
399
425
|
}),
|
|
400
426
|
without: core_1.Flags.string({
|
|
401
427
|
description: `Decline one default by name; repeatable. One of: ${proactiveApi_1.DECLINABLE_DEFAULTS.join(', ')}. Refused when the spec itself asks for it`,
|
|
@@ -754,7 +780,8 @@ class AgentsSpawn extends base_command_1.BaseCommand {
|
|
|
754
780
|
// these; the text plan showed none of them, so "Create it" created a goal, tasks
|
|
755
781
|
// and a scheduled job the reader had never been shown (OSK-22349, OSK-22358).
|
|
756
782
|
const initialize = spec.initialize;
|
|
757
|
-
if (initialize &&
|
|
783
|
+
if (initialize &&
|
|
784
|
+
(initialize.goals?.length || initialize.tasks?.length || initialize.jobs?.length)) {
|
|
758
785
|
this.log('');
|
|
759
786
|
this.log('It will also create:');
|
|
760
787
|
for (const goal of initialize.goals || [])
|
|
@@ -765,7 +792,9 @@ class AgentsSpawn extends base_command_1.BaseCommand {
|
|
|
765
792
|
for (const job of initialize.jobs || []) {
|
|
766
793
|
const when = job.cron
|
|
767
794
|
? `cron ${job.cron}`
|
|
768
|
-
: job.runAtIso
|
|
795
|
+
: job.runAtIso
|
|
796
|
+
? `once at ${job.runAtIso}`
|
|
797
|
+
: 'no schedule';
|
|
769
798
|
this.log(` job: ${job.label} — ${when}${job.timezone ? ` ${job.timezone}` : ''}`);
|
|
770
799
|
}
|
|
771
800
|
}
|
|
@@ -808,7 +837,11 @@ class AgentsSpawn extends base_command_1.BaseCommand {
|
|
|
808
837
|
for (const schedule of o.schedules || []) {
|
|
809
838
|
const state = !schedule.triggerId
|
|
810
839
|
? 'not scheduled'
|
|
811
|
-
: schedule.enabled === null
|
|
840
|
+
: schedule.enabled === null
|
|
841
|
+
? 'unknown'
|
|
842
|
+
: schedule.enabled
|
|
843
|
+
? 'enabled'
|
|
844
|
+
: 'disabled';
|
|
812
845
|
this.log(` ${schedule.kind}: ${state}` +
|
|
813
846
|
(schedule.triggerId ? ` (${schedule.triggerId})` : '') +
|
|
814
847
|
(schedule.reason ? ` — ${schedule.reason}` : ''));
|
|
@@ -833,8 +866,12 @@ class AgentsSpawn extends base_command_1.BaseCommand {
|
|
|
833
866
|
const alwaysOn = result.installed.alwaysOn;
|
|
834
867
|
if (alwaysOn) {
|
|
835
868
|
const state = alwaysOn.desiredEnabled === undefined
|
|
836
|
-
? alwaysOn.ok
|
|
837
|
-
|
|
869
|
+
? alwaysOn.ok
|
|
870
|
+
? 'set'
|
|
871
|
+
: 'failed'
|
|
872
|
+
: alwaysOn.desiredEnabled
|
|
873
|
+
? 'on'
|
|
874
|
+
: 'off';
|
|
838
875
|
this.log(` always-on: ${state}${alwaysOn.operationalState ? ` (${alwaysOn.operationalState})` : ''}`);
|
|
839
876
|
}
|
|
840
877
|
const compass = result.installed.compass;
|
|
@@ -81,7 +81,7 @@ class AgentsTriggersFire extends base_command_1.BaseCommand {
|
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
83
|
this.log(`Fire requested: outcome=${String(result.outcome ?? '-')} reason=${String(result.reason ?? '-')}`);
|
|
84
|
-
for (const line of (0, triggers_1.describeFireDetail)(result))
|
|
84
|
+
for (const line of (0, triggers_1.describeFireDetail)(result, this.config.bin))
|
|
85
85
|
this.log(line);
|
|
86
86
|
const note = (0, triggers_1.describeScheduledFire)(result);
|
|
87
87
|
if (note)
|
|
@@ -50,6 +50,9 @@ class AgentsTriggersRuns extends base_command_1.BaseCommand {
|
|
|
50
50
|
this.log(`Duration: ${detail.durationMs}ms`);
|
|
51
51
|
if (detail.conversationId)
|
|
52
52
|
this.log(`Conversation: ${detail.conversationId}`);
|
|
53
|
+
const runCommand = (0, triggers_1.fireRunHistoryCommand)(detail.agentRun, this.config.bin);
|
|
54
|
+
if (runCommand)
|
|
55
|
+
this.log(`Run History: ${runCommand}`);
|
|
53
56
|
return;
|
|
54
57
|
}
|
|
55
58
|
const path = (0, triggers_1.withQuery)(`/api/triggers/${encodeURIComponent(args.triggerId)}/audit`, {
|
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import { BaseCommand } from '../../../base-command';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* OSK-7789 listed six verbs on `/api/cloud-coding` and one CLI binding. Four of
|
|
6
|
-
* the missing five are now bound; this is the last, and it is the one that
|
|
7
|
-
* FINISHES the work. Without it a headless operator could start a job, watch
|
|
8
|
-
* it, and stop it — and still had to open a browser to get the result merged,
|
|
9
|
-
* which is the same shape as the create-only path the finding was about.
|
|
10
|
-
*
|
|
11
|
-
* Only a repository-backed job has a pull request. `code jobs run` is bare
|
|
12
|
-
* compute with no repo, so there is nothing here to approve, and the refusal
|
|
13
|
-
* says which command produces one rather than reporting a bare 4xx.
|
|
3
|
+
* Approve opening the pull request for a repository-backed job awaiting review.
|
|
14
4
|
*/
|
|
15
5
|
export default class CodeJobsApprove extends BaseCommand {
|
|
16
6
|
static description: string;
|
|
@@ -4,20 +4,10 @@ const core_1 = require("@oclif/core");
|
|
|
4
4
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
5
5
|
const base_command_1 = require("../../../base-command");
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* OSK-7789 listed six verbs on `/api/cloud-coding` and one CLI binding. Four of
|
|
10
|
-
* the missing five are now bound; this is the last, and it is the one that
|
|
11
|
-
* FINISHES the work. Without it a headless operator could start a job, watch
|
|
12
|
-
* it, and stop it — and still had to open a browser to get the result merged,
|
|
13
|
-
* which is the same shape as the create-only path the finding was about.
|
|
14
|
-
*
|
|
15
|
-
* Only a repository-backed job has a pull request. `code jobs run` is bare
|
|
16
|
-
* compute with no repo, so there is nothing here to approve, and the refusal
|
|
17
|
-
* says which command produces one rather than reporting a bare 4xx.
|
|
7
|
+
* Approve opening the pull request for a repository-backed job awaiting review.
|
|
18
8
|
*/
|
|
19
9
|
class CodeJobsApprove extends base_command_1.BaseCommand {
|
|
20
|
-
static description = 'Approve
|
|
10
|
+
static description = 'Approve opening the pull request for a Hosted Job Machine job';
|
|
21
11
|
static examples = [
|
|
22
12
|
'<%= config.bin %> code jobs approve <job-id>',
|
|
23
13
|
'<%= config.bin %> code jobs approve <job-id> --json',
|
|
@@ -41,9 +31,7 @@ class CodeJobsApprove extends base_command_1.BaseCommand {
|
|
|
41
31
|
this.log(JSON.stringify(task, null, 2));
|
|
42
32
|
return;
|
|
43
33
|
}
|
|
44
|
-
//
|
|
45
|
-
// branch someone merged by hand, and printing an outcome we did not observe
|
|
46
|
-
// is how a CLI starts inventing them.
|
|
34
|
+
// Approval and GitHub delivery can settle separately.
|
|
47
35
|
this.log(`Job ${task?.id ?? args.job} is now ${task?.status ?? 'unknown'}.`);
|
|
48
36
|
if (task?.prUrl)
|
|
49
37
|
this.log(` ${String(task.prUrl)}`);
|
|
@@ -3,8 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const core_1 = require("@oclif/core");
|
|
4
4
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
5
5
|
const base_command_1 = require("../../../base-command");
|
|
6
|
+
const hosted_job_status_1 = require("../../../lib/hosted-job-status");
|
|
6
7
|
class CodeJobsCancel extends base_command_1.BaseCommand {
|
|
7
|
-
static description = '
|
|
8
|
+
static description = 'Request a stop for a Hosted Job Machine job';
|
|
8
9
|
static examples = [
|
|
9
10
|
'<%= config.bin %> code jobs cancel <job-id>',
|
|
10
11
|
'<%= config.bin %> code jobs cancel <job-id> --json',
|
|
@@ -31,7 +32,7 @@ class CodeJobsCancel extends base_command_1.BaseCommand {
|
|
|
31
32
|
// Report the status the SERVER came back with, never the one we asked for.
|
|
32
33
|
// Cancel races a job that is already finishing, and printing "cancelled"
|
|
33
34
|
// over a `completed` row would be the CLI inventing an outcome.
|
|
34
|
-
this.log(`Job ${task?.id ?? args.job} is now ${task
|
|
35
|
+
this.log(`Job ${task?.id ?? args.job} is now ${(0, hosted_job_status_1.hostedJobDisplayStatus)(task) ?? 'unknown'}.`);
|
|
35
36
|
if (task?.prUrl)
|
|
36
37
|
this.log(` ${String(task.prUrl)}`);
|
|
37
38
|
}
|
|
@@ -29,7 +29,7 @@ class CodeJobs extends core_1.Command {
|
|
|
29
29
|
this.log(' skrr code jobs list list your jobs, newest first');
|
|
30
30
|
this.log(' skrr code jobs show show one job and its timeline');
|
|
31
31
|
this.log(' skrr code jobs cancel stop a job and its billing');
|
|
32
|
-
this.log(' skrr code jobs approve
|
|
32
|
+
this.log(' skrr code jobs approve approve opening the pull request for a repo job');
|
|
33
33
|
this.log('');
|
|
34
34
|
this.log('`run` needs no repository. For a job that clones a repo and opens a');
|
|
35
35
|
this.log('pull request, use `skrr code handover`.');
|
|
@@ -5,8 +5,7 @@ const core_1 = require("@oclif/core");
|
|
|
5
5
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
6
6
|
const base_command_1 = require("../../../base-command");
|
|
7
7
|
const format_1 = require("../../../lib/format");
|
|
8
|
-
|
|
9
|
-
const TERMINAL = new Set(['completed', 'failed', 'cancelled', 'timed_out']);
|
|
8
|
+
const hosted_job_status_1 = require("../../../lib/hosted-job-status");
|
|
10
9
|
/** Cents are the server's unit for money everywhere else; jobs report dollars. */
|
|
11
10
|
function costCell(task) {
|
|
12
11
|
const raw = task.costUsd;
|
|
@@ -26,12 +25,8 @@ class CodeJobsList extends base_command_1.BaseCommand {
|
|
|
26
25
|
status: core_1.Flags.string({
|
|
27
26
|
description: 'Filter by one exact status (e.g. running, failed, completed)',
|
|
28
27
|
}),
|
|
29
|
-
// The question an operator actually opens this with is "what is costing me
|
|
30
|
-
// money right now", and the server has no such filter -- it takes one exact
|
|
31
|
-
// status. Filtering client-side is honest here because the page is already
|
|
32
|
-
// bounded by --limit.
|
|
33
28
|
active: core_1.Flags.boolean({
|
|
34
|
-
description: 'Show
|
|
29
|
+
description: 'Show in-progress jobs in the returned page',
|
|
35
30
|
default: false,
|
|
36
31
|
exclusive: ['status'],
|
|
37
32
|
}),
|
|
@@ -55,17 +50,15 @@ class CodeJobsList extends base_command_1.BaseCommand {
|
|
|
55
50
|
this.handleApiError(err);
|
|
56
51
|
}
|
|
57
52
|
if (flags.active) {
|
|
58
|
-
tasks = tasks.filter((
|
|
53
|
+
tasks = tasks.filter((task) => (0, hosted_job_status_1.isHostedJobInProgress)(task.status));
|
|
59
54
|
}
|
|
60
55
|
if (flags.json) {
|
|
61
56
|
this.printJsonResult((0, list_output_1.listResult)({ ...response, data: tasks }));
|
|
62
57
|
return;
|
|
63
58
|
}
|
|
64
59
|
if (tasks.length === 0) {
|
|
65
|
-
// Say what empty MEANS. With --active it is the reassuring answer, not an
|
|
66
|
-
// empty query: nothing is running, so nothing is being billed.
|
|
67
60
|
this.log(flags.active
|
|
68
|
-
? 'No jobs
|
|
61
|
+
? 'No in-progress jobs in the returned page.'
|
|
69
62
|
: 'No jobs. Start one with `skrr code jobs run`, or `skrr code handover`\n' +
|
|
70
63
|
'for a job that clones a repository and opens a pull request.');
|
|
71
64
|
return;
|
|
@@ -6,6 +6,7 @@ const node_crypto_1 = require("node:crypto");
|
|
|
6
6
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
7
7
|
const base_command_1 = require("../../../base-command");
|
|
8
8
|
const code_handover_1 = require("../../../lib/code-handover");
|
|
9
|
+
const hosted_job_status_1 = require("../../../lib/hosted-job-status");
|
|
9
10
|
const TERMINAL = new Set(['completed', 'failed', 'cancelled', 'timed_out']);
|
|
10
11
|
/**
|
|
11
12
|
* `skrr code jobs run` — one-shot managed compute with no repository.
|
|
@@ -114,7 +115,7 @@ class CodeJobsRun extends base_command_1.BaseCommand {
|
|
|
114
115
|
}
|
|
115
116
|
const deadline = Date.now() + flags.timeout * 60_000;
|
|
116
117
|
let current = task;
|
|
117
|
-
while (!TERMINAL.has(
|
|
118
|
+
while (!TERMINAL.has((0, hosted_job_status_1.hostedJobDisplayStatus)(current) ?? '') && Date.now() < deadline) {
|
|
118
119
|
await this.sleep(Math.max(1, flags.interval) * 1000);
|
|
119
120
|
try {
|
|
120
121
|
current = (await data_provider_1.dataService.getCloudCodingTask(jobId))?.task;
|
|
@@ -127,15 +128,20 @@ class CodeJobsRun extends base_command_1.BaseCommand {
|
|
|
127
128
|
this.log(JSON.stringify(current, null, 2));
|
|
128
129
|
return;
|
|
129
130
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
const status = (0, hosted_job_status_1.hostedJobDisplayStatus)(current);
|
|
132
|
+
if (!TERMINAL.has(status ?? '')) {
|
|
133
|
+
if (status === 'stop_requested') {
|
|
134
|
+
this.log(`Stop requested for Job ${jobId}. Confirmation is still pending.`);
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
this.log(`Still ${status ?? 'running'} after ${flags.timeout}m — the job continues.`);
|
|
138
|
+
}
|
|
134
139
|
this.log(` ${this.config.bin} code jobs show ${jobId}`);
|
|
135
|
-
|
|
140
|
+
if (status !== 'stop_requested')
|
|
141
|
+
this.log(` ${this.config.bin} code jobs cancel ${jobId}`);
|
|
136
142
|
return;
|
|
137
143
|
}
|
|
138
|
-
this.log(`Job ${jobId} ${
|
|
144
|
+
this.log(`Job ${jobId} ${status}`);
|
|
139
145
|
const result = current?.result;
|
|
140
146
|
if (result?.text) {
|
|
141
147
|
this.log('');
|
|
@@ -1,10 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const core_1 = require("@oclif/core");
|
|
4
|
+
const auth_core_1 = require("@skrr-ai/auth-core");
|
|
4
5
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
5
6
|
const base_command_1 = require("../../../base-command");
|
|
7
|
+
const agent_runs_1 = require("../../../lib/agent-runs");
|
|
6
8
|
const format_1 = require("../../../lib/format");
|
|
7
|
-
const
|
|
9
|
+
const hosted_job_status_1 = require("../../../lib/hosted-job-status");
|
|
10
|
+
const keychain_1 = require("../../../lib/keychain");
|
|
11
|
+
const shell_quote_1 = require("../../../lib/shell-quote");
|
|
12
|
+
const workspace_header_1 = require("../../../lib/workspace-header");
|
|
13
|
+
function retainedAttempt(task) {
|
|
14
|
+
const runId = (0, agent_runs_1.canonicalRunId)(task.runId);
|
|
15
|
+
const attempt = task.runHistoryAttempt;
|
|
16
|
+
if (!runId || attempt?.runId !== runId || typeof attempt.attemptId !== 'string')
|
|
17
|
+
return null;
|
|
18
|
+
try {
|
|
19
|
+
return { runId, attemptId: (0, agent_runs_1.exactAttemptId)(attempt.attemptId) };
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
8
25
|
class CodeJobsShow extends base_command_1.BaseCommand {
|
|
9
26
|
static description = 'Show one Hosted Job Machine job and its timeline';
|
|
10
27
|
static examples = [
|
|
@@ -18,6 +35,7 @@ class CodeJobsShow extends base_command_1.BaseCommand {
|
|
|
18
35
|
async run() {
|
|
19
36
|
this.requireAuth();
|
|
20
37
|
const { args, flags } = await this.parse(CodeJobsShow);
|
|
38
|
+
const workspaceId = (0, workspace_header_1.withWorkspaceHeader)({})['X-Workspace-Id'];
|
|
21
39
|
let task;
|
|
22
40
|
try {
|
|
23
41
|
const res = await data_provider_1.dataService.getCloudCodingTask(args.job);
|
|
@@ -41,7 +59,20 @@ class CodeJobsShow extends base_command_1.BaseCommand {
|
|
|
41
59
|
};
|
|
42
60
|
line('ID:', task.id);
|
|
43
61
|
line('Agent Run:', task.runId);
|
|
44
|
-
line('Status:',
|
|
62
|
+
line('Status:', (0, hosted_job_status_1.hostedJobDisplayStatus)(task));
|
|
63
|
+
if (task.status === 'timed_out')
|
|
64
|
+
line('Checkpoint:', task.checkpointDeliveryStatus);
|
|
65
|
+
const attempt = retainedAttempt(task);
|
|
66
|
+
if (attempt) {
|
|
67
|
+
line('Attempt:', attempt.attemptId);
|
|
68
|
+
const scope = workspaceId ? ['--workspace', workspaceId] : ['--personal'];
|
|
69
|
+
line('Transcript:', (0, shell_quote_1.shellQuoteArgv)([
|
|
70
|
+
this.config.bin, 'runs', 'transcript', attempt.runId, '--attempt', attempt.attemptId,
|
|
71
|
+
...scope, ...(0, auth_core_1.explicitProfileArgs)((0, keychain_1.profileForChildProcess)()),
|
|
72
|
+
]));
|
|
73
|
+
if (task.reviewDiff?.text)
|
|
74
|
+
line('Review diff:', 'available in --json');
|
|
75
|
+
}
|
|
45
76
|
line('Agent:', task.agentId);
|
|
46
77
|
if (task.repoFullName) {
|
|
47
78
|
line('Repo:', `${task.repoFullName}@${task.baseBranch ?? 'main'}`);
|
|
@@ -52,6 +83,10 @@ class CodeJobsShow extends base_command_1.BaseCommand {
|
|
|
52
83
|
line('Model:', task.model);
|
|
53
84
|
if (typeof task.costUsd === 'number')
|
|
54
85
|
line('Cost:', `$${task.costUsd.toFixed(2)}`);
|
|
86
|
+
const settlement = task.billing
|
|
87
|
+
?.computeSettlementStatus;
|
|
88
|
+
if (typeof settlement === 'string')
|
|
89
|
+
line('Compute hold:', settlement);
|
|
55
90
|
line('PR:', task.prUrl);
|
|
56
91
|
line('Parent Task:', task.lineage?.taskId);
|
|
57
92
|
line('Task run:', task.lineage?.taskExecutionRunId);
|
|
@@ -85,11 +120,21 @@ class CodeJobsShow extends base_command_1.BaseCommand {
|
|
|
85
120
|
this.log(` ${at} ${String(entry.state ?? '-').padEnd(14)}${took}${note}`);
|
|
86
121
|
}
|
|
87
122
|
}
|
|
88
|
-
|
|
89
|
-
// this is the whole reason the cancel binding exists.
|
|
90
|
-
if (!TERMINAL.has(String(task.status))) {
|
|
123
|
+
if (task.status === 'review_pending') {
|
|
91
124
|
this.log('');
|
|
92
|
-
this.log(
|
|
125
|
+
this.log('Awaiting approval to open the pull request:');
|
|
126
|
+
this.log(` ${this.config.bin} code jobs approve ${task.id}`);
|
|
127
|
+
}
|
|
128
|
+
else if (task.status === 'pr_open') {
|
|
129
|
+
this.log('');
|
|
130
|
+
this.log('The pull request is open.');
|
|
131
|
+
}
|
|
132
|
+
else if ((0, hosted_job_status_1.isHostedJobInProgress)(task.status)) {
|
|
133
|
+
this.log('');
|
|
134
|
+
if (task.status === 'pr_opening' && task.prDeliveryStatus === 'unconfirmed') {
|
|
135
|
+
this.log('Pull request delivery is unconfirmed. Recheck it from the Hosted Job page.');
|
|
136
|
+
}
|
|
137
|
+
this.log('To request cancellation:');
|
|
93
138
|
this.log(` ${this.config.bin} code jobs cancel ${task.id}`);
|
|
94
139
|
}
|
|
95
140
|
this.log('');
|
|
@@ -4,8 +4,10 @@ const core_1 = require("@oclif/core");
|
|
|
4
4
|
const base_command_1 = require("../base-command");
|
|
5
5
|
const command_manifest_1 = require("../lib/command-manifest");
|
|
6
6
|
const command_hygiene_1 = require("../lib/command-hygiene");
|
|
7
|
+
const guide_pointer_1 = require("../lib/guide-pointer");
|
|
7
8
|
const RUN_RE = /:/g;
|
|
8
9
|
class Commands extends base_command_1.BaseCommand {
|
|
10
|
+
static credentialMode = 'local';
|
|
9
11
|
static description = 'List skrr commands or print a machine-readable command schema';
|
|
10
12
|
static examples = [
|
|
11
13
|
'<%= config.bin %> commands',
|
|
@@ -27,7 +29,7 @@ class Commands extends base_command_1.BaseCommand {
|
|
|
27
29
|
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
28
30
|
search: core_1.Flags.string({
|
|
29
31
|
char: 'q',
|
|
30
|
-
description: '
|
|
32
|
+
description: 'Find commands by name, common intent, description, or examples',
|
|
31
33
|
}),
|
|
32
34
|
schema: core_1.Flags.boolean({ description: 'Return one command schema instead of the full list' }),
|
|
33
35
|
brief: core_1.Flags.boolean({
|
|
@@ -100,6 +102,7 @@ class Commands extends base_command_1.BaseCommand {
|
|
|
100
102
|
retryable: false,
|
|
101
103
|
});
|
|
102
104
|
}
|
|
105
|
+
const guide = (0, guide_pointer_1.agentGuidePointerForCommand)(key);
|
|
103
106
|
const payload = {
|
|
104
107
|
id: key,
|
|
105
108
|
command: key.replace(RUN_RE, ' '),
|
|
@@ -108,6 +111,7 @@ class Commands extends base_command_1.BaseCommand {
|
|
|
108
111
|
args: command.args ?? {},
|
|
109
112
|
flags: command.flags ?? {},
|
|
110
113
|
examples: command.examples ?? [],
|
|
114
|
+
...(guide ? { guide } : {}),
|
|
111
115
|
};
|
|
112
116
|
this.log(JSON.stringify(payload, null, 2));
|
|
113
117
|
return;
|
package/dist/commands/context.js
CHANGED
|
@@ -11,6 +11,7 @@ const runtime_context_1 = require("../lib/runtime-context");
|
|
|
11
11
|
const task_resolver_1 = require("../lib/task-resolver");
|
|
12
12
|
const task_write_attribution_1 = require("../lib/task-write-attribution");
|
|
13
13
|
class Context extends base_command_1.BaseCommand {
|
|
14
|
+
static credentialMode = 'borrow-only';
|
|
14
15
|
static description = 'Print the current skrr CLI runtime context for agent automation';
|
|
15
16
|
static examples = [
|
|
16
17
|
'<%= config.bin %> context --json',
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base-command';
|
|
2
|
+
/**
|
|
3
|
+
* Add a catalog system role the Agent does not have yet (OSK-33996). Owner
|
|
4
|
+
* only. Adding is idempotent: a role the Agent already has is returned as it
|
|
5
|
+
* is, and a paused one stays paused (turn it on with `duties resume`).
|
|
6
|
+
*/
|
|
7
|
+
export default class DutiesCatalogAdd extends BaseCommand {
|
|
8
|
+
static description: string;
|
|
9
|
+
static examples: string[];
|
|
10
|
+
static args: {
|
|
11
|
+
entry: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
12
|
+
};
|
|
13
|
+
static flags: {
|
|
14
|
+
agent: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
|
+
};
|
|
17
|
+
run(): Promise<void>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const base_command_1 = require("../../../base-command");
|
|
5
|
+
const duties_1 = require("../../../lib/duties");
|
|
6
|
+
const web_url_1 = require("../../../lib/web-url");
|
|
7
|
+
/**
|
|
8
|
+
* Add a catalog system role the Agent does not have yet (OSK-33996). Owner
|
|
9
|
+
* only. Adding is idempotent: a role the Agent already has is returned as it
|
|
10
|
+
* is, and a paused one stays paused (turn it on with `duties resume`).
|
|
11
|
+
*/
|
|
12
|
+
class DutiesCatalogAdd extends base_command_1.BaseCommand {
|
|
13
|
+
static description = 'Add a preconfigured platform Duty to one of your Agents';
|
|
14
|
+
static examples = [
|
|
15
|
+
'<%= config.bin %> duties catalog add open_loop_closer --agent agent_abc123',
|
|
16
|
+
];
|
|
17
|
+
static args = {
|
|
18
|
+
entry: core_1.Args.string({
|
|
19
|
+
description: 'Catalog entry id, as `skrr duties catalog` lists it',
|
|
20
|
+
required: true,
|
|
21
|
+
}),
|
|
22
|
+
};
|
|
23
|
+
static flags = {
|
|
24
|
+
agent: core_1.Flags.string({ description: 'Agent ID', required: true }),
|
|
25
|
+
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
26
|
+
};
|
|
27
|
+
async run() {
|
|
28
|
+
this.requireAuth();
|
|
29
|
+
const { args, flags } = await this.parse(DutiesCatalogAdd);
|
|
30
|
+
let result;
|
|
31
|
+
try {
|
|
32
|
+
result = await duties_1.dutyApi.addCatalogEntry(flags.agent, args.entry);
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
this.handleApiError(err);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (flags.json) {
|
|
39
|
+
this.log(JSON.stringify(result, null, 2));
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const { duty } = result;
|
|
43
|
+
const verb = result.installation === 'created' ? 'Added' : 'Already there';
|
|
44
|
+
this.log(`${verb}: ${duty.title || args.entry} · ${duty.status} · ${duty.id}`);
|
|
45
|
+
const url = (0, web_url_1.dutyUrlFrom)(this.cliConfig.baseURL, { id: duty.id });
|
|
46
|
+
if (url)
|
|
47
|
+
this.log(url);
|
|
48
|
+
if (duty.status !== 'active')
|
|
49
|
+
this.log(`Turn on with skrr duties resume ${duty.id}`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.default = DutiesCatalogAdd;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { DutyCatalogItem } from '@skrr-ai/data-provider';
|
|
2
|
+
import { BaseCommand } from '../../../base-command';
|
|
3
|
+
/**
|
|
4
|
+
* The preconfigured Duties an owner can choose for one Agent (OSK-33996), and
|
|
5
|
+
* whether each is on. The same catalog the Agent page shows. A system role is
|
|
6
|
+
* turned off and on with `duties pause` / `duties resume`; one the Agent does
|
|
7
|
+
* not have is added with `duties catalog add`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function catalogLines(items: DutyCatalogItem[], agentId: string, canAdd: boolean): string[];
|
|
10
|
+
export default class DutiesCatalog extends BaseCommand {
|
|
11
|
+
static description: string;
|
|
12
|
+
static examples: string[];
|
|
13
|
+
static flags: {
|
|
14
|
+
agent: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
|
+
};
|
|
17
|
+
run(): Promise<void>;
|
|
18
|
+
}
|