@skrr-ai/cli 0.1.231 → 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 +42 -4
- package/bin/dev.cjs +4 -1
- package/bin/run.js +0 -15
- package/dist/base-command.d.ts +6 -11
- package/dist/base-command.js +34 -43
- package/dist/commands/agenda/plan.d.ts +2 -1
- package/dist/commands/agenda/plan.js +18 -4
- package/dist/commands/agent/message/context.d.ts +2 -0
- package/dist/commands/agent/message/context.js +18 -3
- package/dist/commands/agent/message/list.d.ts +22 -0
- package/dist/commands/agent/message/list.js +66 -0
- package/dist/commands/agent/message/send.d.ts +1 -1
- package/dist/commands/agent/message/send.js +1 -3
- package/dist/commands/agent/message/show.d.ts +14 -0
- package/dist/commands/agent/message/show.js +39 -0
- package/dist/commands/agents/chat.d.ts +4 -0
- package/dist/commands/agents/chat.js +79 -17
- package/dist/commands/agents/eval/list.d.ts +4 -0
- package/dist/commands/agents/eval/list.js +33 -0
- package/dist/commands/agents/eval/show.d.ts +1 -0
- package/dist/commands/agents/eval/show.js +19 -0
- package/dist/commands/agents/intuitions/generate.js +1 -1
- package/dist/commands/agents/intuitions/list.js +1 -1
- 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/acp.js +1 -1
- package/dist/commands/code/handover.d.ts +3 -3
- package/dist/commands/code/handover.js +12 -12
- package/dist/commands/code/index.d.ts +3 -8
- package/dist/commands/code/index.js +15 -21
- 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 +52 -6
- package/dist/commands/code/run.js +1 -1
- 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/plan-now.d.ts +5 -3
- package/dist/commands/goals/plan-now.js +21 -16
- 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 +16 -0
- package/dist/commands/runs/events.js +89 -0
- package/dist/commands/runs/list.d.ts +27 -0
- package/dist/commands/runs/list.js +151 -0
- package/dist/commands/runs/show.d.ts +14 -0
- package/dist/commands/runs/show.js +273 -0
- package/dist/commands/runs/stop.d.ts +15 -0
- package/dist/commands/runs/stop.js +105 -0
- package/dist/commands/runs/transcript.d.ts +19 -0
- package/dist/commands/runs/transcript.js +178 -0
- 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/tasks/runs.js +7 -0
- package/dist/commands/tasks/start-receipt.js +8 -8
- package/dist/commands/tasks/start.js +12 -1
- 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 +350 -777
- package/dist/help.d.ts +2 -7
- package/dist/help.js +13 -7
- package/dist/hooks/init.js +10 -0
- package/dist/lib/agent-chat-queue.d.ts +2 -1
- package/dist/lib/agent-chat-queue.js +26 -21
- 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 +101 -0
- package/dist/lib/agent-runs.js +350 -0
- package/dist/lib/agentic-stream.d.ts +13 -1
- package/dist/lib/agentic-stream.js +165 -81
- package/dist/lib/api-fetch.d.ts +4 -2
- package/dist/lib/api-fetch.js +11 -5
- package/dist/lib/code-handover.d.ts +2 -3
- package/dist/lib/code-handover.js +4 -6
- package/dist/lib/command-manifest.d.ts +1 -6
- package/dist/lib/command-manifest.js +86 -13
- package/dist/lib/communication-history.d.ts +27 -0
- package/dist/lib/communication-history.js +45 -0
- 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 +34 -0
- package/dist/lib/execution-history.js +7 -0
- package/dist/lib/first-party-harness-broker.d.ts +1 -1
- package/dist/lib/first-party-harness-broker.js +3 -5
- 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 +2 -0
- package/dist/lib/inbound-messages.js +5 -0
- package/dist/lib/intuition-look.js +20 -4
- package/dist/lib/memory-history-session.d.ts +8 -4
- package/dist/lib/memory-history-session.js +30 -23
- 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-agent-run.d.ts +4 -0
- package/dist/lib/task-agent-run.js +15 -0
- 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.d.ts +9 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.js +40 -3
- 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/cjs/toolApprovalSignature.d.ts +62 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/toolApprovalSignature.js +56 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.d.ts +9 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.js +34 -3
- 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/dist/esm/toolApprovalSignature.d.ts +62 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/toolApprovalSignature.js +51 -0
- package/dist/node_modules/@skrr-ai/auth-core/package.json +10 -0
- package/dist/node_modules/@skrr-ai/data-provider/index.js +12259 -12160
- package/docs/v1/quickstart.md +18 -0
- package/oclif.manifest.json +3405 -2112
- package/package.json +6 -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
|
@@ -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);
|
|
@@ -40,7 +58,21 @@ class CodeJobsShow extends base_command_1.BaseCommand {
|
|
|
40
58
|
this.log(`${label.padEnd(14)}${String(value)}`);
|
|
41
59
|
};
|
|
42
60
|
line('ID:', task.id);
|
|
43
|
-
line('
|
|
61
|
+
line('Agent Run:', task.runId);
|
|
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
|
+
}
|
|
44
76
|
line('Agent:', task.agentId);
|
|
45
77
|
if (task.repoFullName) {
|
|
46
78
|
line('Repo:', `${task.repoFullName}@${task.baseBranch ?? 'main'}`);
|
|
@@ -51,6 +83,10 @@ class CodeJobsShow extends base_command_1.BaseCommand {
|
|
|
51
83
|
line('Model:', task.model);
|
|
52
84
|
if (typeof task.costUsd === 'number')
|
|
53
85
|
line('Cost:', `$${task.costUsd.toFixed(2)}`);
|
|
86
|
+
const settlement = task.billing
|
|
87
|
+
?.computeSettlementStatus;
|
|
88
|
+
if (typeof settlement === 'string')
|
|
89
|
+
line('Compute hold:', settlement);
|
|
54
90
|
line('PR:', task.prUrl);
|
|
55
91
|
line('Parent Task:', task.lineage?.taskId);
|
|
56
92
|
line('Task run:', task.lineage?.taskExecutionRunId);
|
|
@@ -84,11 +120,21 @@ class CodeJobsShow extends base_command_1.BaseCommand {
|
|
|
84
120
|
this.log(` ${at} ${String(entry.state ?? '-').padEnd(14)}${took}${note}`);
|
|
85
121
|
}
|
|
86
122
|
}
|
|
87
|
-
|
|
88
|
-
// this is the whole reason the cancel binding exists.
|
|
89
|
-
if (!TERMINAL.has(String(task.status))) {
|
|
123
|
+
if (task.status === 'review_pending') {
|
|
90
124
|
this.log('');
|
|
91
|
-
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:');
|
|
92
138
|
this.log(` ${this.config.bin} code jobs cancel ${task.id}`);
|
|
93
139
|
}
|
|
94
140
|
this.log('');
|
|
@@ -35,7 +35,7 @@ class CodeRun extends core_1.Command {
|
|
|
35
35
|
// `headless`: project configuration is gated exactly as for the TUI, but
|
|
36
36
|
// nobody is asked and the engine keeps its own permission config — an `ask`
|
|
37
37
|
// default would be auto-rejected by a headless run (OSK-11958).
|
|
38
|
-
await (0, index_1.forwardToEngine)(this, 'run', this.argv, {
|
|
38
|
+
await (0, index_1.forwardToEngine)(this, 'run', this.argv, { brokerInference: true, projectPolicy: 'headless' });
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
exports.default = CodeRun;
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.catalogLines = catalogLines;
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const base_command_1 = require("../../../base-command");
|
|
6
|
+
const duties_1 = require("../../../lib/duties");
|
|
7
|
+
/**
|
|
8
|
+
* The preconfigured Duties an owner can choose for one Agent (OSK-33996), and
|
|
9
|
+
* whether each is on. The same catalog the Agent page shows. A system role is
|
|
10
|
+
* turned off and on with `duties pause` / `duties resume`; one the Agent does
|
|
11
|
+
* not have is added with `duties catalog add`.
|
|
12
|
+
*/
|
|
13
|
+
function catalogLines(items, agentId, canAdd) {
|
|
14
|
+
const lines = [];
|
|
15
|
+
const section = (title, rows) => {
|
|
16
|
+
if (!rows.length)
|
|
17
|
+
return;
|
|
18
|
+
lines.push(title);
|
|
19
|
+
for (const item of rows) {
|
|
20
|
+
const { entry } = item;
|
|
21
|
+
const state = item.state === 'available' ? entry.control : item.state;
|
|
22
|
+
const id = item.duty?.id ? ` · ${item.duty.id}` : '';
|
|
23
|
+
lines.push(` ${entry.id.padEnd(24)} ${state.padEnd(9)} ${entry.label}${id}`);
|
|
24
|
+
lines.push(` ${''.padEnd(24)} ${''.padEnd(9)} ${entry.summary}`);
|
|
25
|
+
const hint = nextStep(item, agentId, canAdd);
|
|
26
|
+
if (hint)
|
|
27
|
+
lines.push(` ${''.padEnd(24)} ${''.padEnd(9)} ${hint}`);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
section('Listed', items.filter((item) => item.entry.visibility === 'listed'));
|
|
31
|
+
section('Platform defaults (hidden on the Agent page; each can be turned off)', items.filter((item) => item.entry.visibility === 'hidden'));
|
|
32
|
+
return lines;
|
|
33
|
+
}
|
|
34
|
+
function nextStep(item, agentId, canAdd) {
|
|
35
|
+
const { entry, duty } = item;
|
|
36
|
+
if (entry.backing === 'template') {
|
|
37
|
+
return `Draft one: skrr duties plan --agent ${agentId} --template ${entry.templateId} --sentence "<what to hold>"`;
|
|
38
|
+
}
|
|
39
|
+
if (entry.backing === 'pack') {
|
|
40
|
+
return `Set one up: skrr duties pack plan --agent ${agentId} --pack ${entry.packId}`;
|
|
41
|
+
}
|
|
42
|
+
if (entry.control === 'dedicated') {
|
|
43
|
+
return item.state === 'absent' ? 'Turned on from the chat it follows.' : null;
|
|
44
|
+
}
|
|
45
|
+
if (item.state === 'on' && duty)
|
|
46
|
+
return `Turn off: skrr duties pause ${duty.id}`;
|
|
47
|
+
if (item.state === 'off' && duty)
|
|
48
|
+
return `Turn on: skrr duties resume ${duty.id}`;
|
|
49
|
+
if (item.state === 'ended' && duty)
|
|
50
|
+
return `Ended (${duty.status}): skrr duties show ${duty.id}`;
|
|
51
|
+
if (item.state === 'absent' && canAdd) {
|
|
52
|
+
return entry.control === 'scoped'
|
|
53
|
+
? `Add: skrr duties install-look-around --agent ${agentId} --scope "<sources>"`
|
|
54
|
+
: `Add: skrr duties catalog add ${entry.id} --agent ${agentId}`;
|
|
55
|
+
}
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
class DutiesCatalog extends base_command_1.BaseCommand {
|
|
59
|
+
static description = 'List the preconfigured Duties for one Agent and whether each is on';
|
|
60
|
+
static examples = [
|
|
61
|
+
'<%= config.bin %> duties catalog --agent agent_abc123',
|
|
62
|
+
'<%= config.bin %> duties catalog --agent agent_abc123 --json',
|
|
63
|
+
];
|
|
64
|
+
static flags = {
|
|
65
|
+
agent: core_1.Flags.string({ description: 'Agent ID', required: true }),
|
|
66
|
+
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
67
|
+
};
|
|
68
|
+
async run() {
|
|
69
|
+
this.requireAuth();
|
|
70
|
+
const { flags } = await this.parse(DutiesCatalog);
|
|
71
|
+
let catalog;
|
|
72
|
+
try {
|
|
73
|
+
catalog = await duties_1.dutyApi.catalog(flags.agent);
|
|
74
|
+
}
|
|
75
|
+
catch (err) {
|
|
76
|
+
this.handleApiError(err);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (flags.json) {
|
|
80
|
+
this.log(JSON.stringify(catalog, null, 2));
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
for (const line of catalogLines(catalog.items, catalog.agentId, catalog.canAdd)) {
|
|
84
|
+
this.log(line);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.default = DutiesCatalog;
|
|
@@ -1,12 +1,58 @@
|
|
|
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 base_command_1 = require("../../base-command");
|
|
6
|
+
const agent_runs_1 = require("../../lib/agent-runs");
|
|
5
7
|
const duties_1 = require("../../lib/duties");
|
|
6
8
|
const duty_product_1 = require("../../lib/duty-product");
|
|
7
9
|
const duty_receipt_source_1 = require("../../lib/duty-receipt-source");
|
|
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");
|
|
8
13
|
const OBSERVATION_UNAVAILABLE_MESSAGE = 'The selected observation could not be verified for this Run. ' +
|
|
9
14
|
'Rerun the same command without --observation to request the Run receipt.';
|
|
15
|
+
function receiptRunCommands(receipt, selectedRunId, workspaceId) {
|
|
16
|
+
const { agentRunReferences, evidence } = receipt;
|
|
17
|
+
if (!Array.isArray(agentRunReferences) || !Array.isArray(evidence?.runIds))
|
|
18
|
+
return [];
|
|
19
|
+
if (workspaceId !== undefined && !/^[A-Za-z0-9][A-Za-z0-9._-]{0,239}$/.test(workspaceId))
|
|
20
|
+
return [];
|
|
21
|
+
const dutyRunCounts = new Map();
|
|
22
|
+
const canonicalRunCounts = new Map();
|
|
23
|
+
for (const ref of agentRunReferences) {
|
|
24
|
+
if (!ref)
|
|
25
|
+
continue;
|
|
26
|
+
dutyRunCounts.set(ref.dutyRunId, (dutyRunCounts.get(ref.dutyRunId) ?? 0) + 1);
|
|
27
|
+
canonicalRunCounts.set(ref.agentRunId, (canonicalRunCounts.get(ref.agentRunId) ?? 0) + 1);
|
|
28
|
+
}
|
|
29
|
+
const evidencedRuns = new Set(evidence.runIds);
|
|
30
|
+
const commands = [];
|
|
31
|
+
for (const ref of agentRunReferences) {
|
|
32
|
+
if (!ref)
|
|
33
|
+
continue;
|
|
34
|
+
const { dutyRunId, agentRunId, agentRunAttemptId, agentRunWorkspaceId } = ref;
|
|
35
|
+
const runId = (0, agent_runs_1.canonicalRunId)(agentRunId);
|
|
36
|
+
if (!runId || typeof dutyRunId !== 'string' || !dutyRunId || !evidencedRuns.has(dutyRunId) ||
|
|
37
|
+
(selectedRunId !== undefined && dutyRunId !== selectedRunId) ||
|
|
38
|
+
agentRunWorkspaceId !== workspaceId ||
|
|
39
|
+
dutyRunCounts.get(dutyRunId) !== 1 || canonicalRunCounts.get(runId) !== 1)
|
|
40
|
+
continue;
|
|
41
|
+
let command = ['runs', 'show', runId];
|
|
42
|
+
if (agentRunAttemptId !== undefined) {
|
|
43
|
+
if (typeof agentRunAttemptId !== 'string')
|
|
44
|
+
continue;
|
|
45
|
+
try {
|
|
46
|
+
command = ['runs', 'transcript', runId, '--attempt', (0, agent_runs_1.exactAttemptId)(agentRunAttemptId)];
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
commands.push([...command, ...(0, agent_runs_1.runReadScopeArgs)(workspaceId)]);
|
|
53
|
+
}
|
|
54
|
+
return commands;
|
|
55
|
+
}
|
|
10
56
|
class DutiesReceipt extends base_command_1.BaseCommand {
|
|
11
57
|
static description = 'Explain what happened from the event through work, delivery, and verification';
|
|
12
58
|
static examples = [
|
|
@@ -37,6 +83,7 @@ class DutiesReceipt extends base_command_1.BaseCommand {
|
|
|
37
83
|
const unavailableMessage = flags.observation
|
|
38
84
|
? OBSERVATION_UNAVAILABLE_MESSAGE
|
|
39
85
|
: duty_receipt_source_1.RECEIPT_UNAVAILABLE_MESSAGE;
|
|
86
|
+
const workspaceId = (0, workspace_header_1.withWorkspaceHeader)({})['X-Workspace-Id'];
|
|
40
87
|
let result;
|
|
41
88
|
try {
|
|
42
89
|
result = await duties_1.dutyApi.receipts(args.id, {
|
|
@@ -72,8 +119,16 @@ class DutiesReceipt extends base_command_1.BaseCommand {
|
|
|
72
119
|
return this.log(JSON.stringify(result, null, 2));
|
|
73
120
|
if (!result.receipts.length)
|
|
74
121
|
return this.log('No wake has been observed yet.');
|
|
75
|
-
for (const receipt of result.receipts)
|
|
122
|
+
for (const receipt of result.receipts) {
|
|
76
123
|
(0, duty_product_1.renderExecutionReceipt)(receipt, (line) => this.log(line), flags.verbose);
|
|
124
|
+
if (result.dutyId !== args.id || receipt.dutyId !== args.id ||
|
|
125
|
+
(flags.check !== undefined && receipt.checkId !== flags.check))
|
|
126
|
+
continue;
|
|
127
|
+
for (const command of receiptRunCommands(receipt, flags.run, workspaceId)) {
|
|
128
|
+
const argv = [this.config.bin, ...command, ...(0, auth_core_1.explicitProfileArgs)((0, keychain_1.profileForChildProcess)())];
|
|
129
|
+
this.log(`Run History ${(0, shell_quote_1.shellQuoteArgv)(argv)}`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
77
132
|
}
|
|
78
133
|
}
|
|
79
134
|
exports.default = DutiesReceipt;
|
|
@@ -42,14 +42,15 @@ export declare function isPlannerRequestTimeout(err: unknown): boolean;
|
|
|
42
42
|
* dangerous half, because it invites a retry of a non-idempotent, task-creating,
|
|
43
43
|
* billable operation.
|
|
44
44
|
*
|
|
45
|
-
* A
|
|
46
|
-
*
|
|
47
|
-
* that CAN answer it.
|
|
45
|
+
* A timeout leaves the result unknown. Repeating the original command with
|
|
46
|
+
* its key can recover the same planner tick.
|
|
48
47
|
*/
|
|
49
48
|
export declare function plannerTimeoutMessage(opts: {
|
|
50
49
|
goalId: string;
|
|
51
50
|
status: number;
|
|
52
51
|
bin: string;
|
|
52
|
+
spaceId?: string;
|
|
53
|
+
idempotencyKey: string;
|
|
53
54
|
}): string;
|
|
54
55
|
/**
|
|
55
56
|
* `skrr goals plan-now <goal-id>` — run a single planner tick immediately,
|
|
@@ -75,6 +76,7 @@ export default class GoalsPlanNow extends BaseCommand {
|
|
|
75
76
|
};
|
|
76
77
|
static flags: {
|
|
77
78
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
79
|
+
'idempotency-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
78
80
|
space: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
79
81
|
};
|
|
80
82
|
run(): Promise<void>;
|
|
@@ -5,6 +5,7 @@ exports.plannerTickDidNotRun = plannerTickDidNotRun;
|
|
|
5
5
|
exports.plannerTickAccepted = plannerTickAccepted;
|
|
6
6
|
exports.isPlannerRequestTimeout = isPlannerRequestTimeout;
|
|
7
7
|
exports.plannerTimeoutMessage = plannerTimeoutMessage;
|
|
8
|
+
const node_crypto_1 = require("node:crypto");
|
|
8
9
|
const core_1 = require("@oclif/core");
|
|
9
10
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
10
11
|
const base_command_1 = require("../../base-command");
|
|
@@ -119,18 +120,17 @@ function isPlannerRequestTimeout(err) {
|
|
|
119
120
|
* dangerous half, because it invites a retry of a non-idempotent, task-creating,
|
|
120
121
|
* billable operation.
|
|
121
122
|
*
|
|
122
|
-
* A
|
|
123
|
-
*
|
|
124
|
-
* that CAN answer it.
|
|
123
|
+
* A timeout leaves the result unknown. Repeating the original command with
|
|
124
|
+
* its key can recover the same planner tick.
|
|
125
125
|
*/
|
|
126
126
|
function plannerTimeoutMessage(opts) {
|
|
127
|
-
const { goalId, status, bin } = opts;
|
|
127
|
+
const { goalId, status, bin, spaceId, idempotencyKey } = opts;
|
|
128
|
+
const original = `${bin} goals plan-now ${goalId} --idempotency-key ${idempotencyKey}` +
|
|
129
|
+
(spaceId ? ` --space ${spaceId}` : '');
|
|
128
130
|
return (`The planner tick for goal ${goalId} outlived this request (HTTP ${status}). ` +
|
|
129
|
-
'
|
|
130
|
-
|
|
131
|
-
`
|
|
132
|
-
`running — or \`${bin} goals tasks ${goalId}\` to see what it produced. ` +
|
|
133
|
-
'Do not retry blindly: a second tick is a second billable agent run.');
|
|
131
|
+
'The tick may still be running and creating tasks. ' +
|
|
132
|
+
`Retry this request with \`${original}\`. ` +
|
|
133
|
+
`Use \`${bin} goals tasks ${goalId}\` to see the goal's tasks.`);
|
|
134
134
|
}
|
|
135
135
|
/**
|
|
136
136
|
* `skrr goals plan-now <goal-id>` — run a single planner tick immediately,
|
|
@@ -160,6 +160,7 @@ class GoalsPlanNow extends base_command_1.BaseCommand {
|
|
|
160
160
|
};
|
|
161
161
|
static flags = {
|
|
162
162
|
json: core_1.Flags.boolean({ description: 'Output the planner result as JSON' }),
|
|
163
|
+
'idempotency-key': core_1.Flags.string({ description: 'Reuse the key from the original plan request' }),
|
|
163
164
|
space: core_1.Flags.string({
|
|
164
165
|
description: "Scope created tasks to this space (also backfills spaceId on the goal's existing tasks)",
|
|
165
166
|
}),
|
|
@@ -167,16 +168,19 @@ class GoalsPlanNow extends base_command_1.BaseCommand {
|
|
|
167
168
|
async run() {
|
|
168
169
|
this.requireAuth();
|
|
169
170
|
const { args, flags } = await this.parse(GoalsPlanNow);
|
|
171
|
+
const idempotencyKey = flags['idempotency-key'] ?? `goal-plan:${(0, node_crypto_1.randomUUID)()}`;
|
|
170
172
|
// A tick is an LLM run; minutes of silence is normal and used to be
|
|
171
173
|
// indistinguishable from a hung command. stderr, so `--json` stdout stays a
|
|
172
174
|
// single parseable document.
|
|
173
175
|
this.logToStderr(`Running one planner tick for goal ${args.id}. This is a live agent turn and can take minutes.`);
|
|
174
176
|
let result;
|
|
175
177
|
try {
|
|
176
|
-
result = await data_provider_1.dataService.planGoalNow(args.id, flags.space ? { spaceId: flags.space } : {}
|
|
178
|
+
result = await data_provider_1.dataService.planGoalNow(args.id, flags.space ? { spaceId: flags.space } : {}, {
|
|
179
|
+
idempotencyKey,
|
|
180
|
+
});
|
|
177
181
|
}
|
|
178
182
|
catch (err) {
|
|
179
|
-
this.failIfRequestTimedOut(err, args.id);
|
|
183
|
+
this.failIfRequestTimedOut(err, args.id, idempotencyKey, flags.space);
|
|
180
184
|
this.handleApiError(err);
|
|
181
185
|
}
|
|
182
186
|
const r = result;
|
|
@@ -191,6 +195,8 @@ class GoalsPlanNow extends base_command_1.BaseCommand {
|
|
|
191
195
|
return;
|
|
192
196
|
}
|
|
193
197
|
this.log(`Planner tick accepted for goal ${args.id} — running in the background.`);
|
|
198
|
+
if (r.tickId)
|
|
199
|
+
this.log(` tick: ${r.tickId}`);
|
|
194
200
|
if (r.backfilledCount) {
|
|
195
201
|
this.log(` backfilled: ${r.backfilledCount} existing task(s) tagged to the space.`);
|
|
196
202
|
}
|
|
@@ -243,18 +249,17 @@ class GoalsPlanNow extends base_command_1.BaseCommand {
|
|
|
243
249
|
}
|
|
244
250
|
}
|
|
245
251
|
/** A gateway timeout on THIS request, reported as what it is. */
|
|
246
|
-
failIfRequestTimedOut(err, goalId) {
|
|
252
|
+
failIfRequestTimedOut(err, goalId, idempotencyKey, spaceId) {
|
|
247
253
|
if (!isPlannerRequestTimeout(err))
|
|
248
254
|
return;
|
|
249
255
|
const status = err.status;
|
|
250
256
|
this.failWithCliError({
|
|
251
|
-
message: plannerTimeoutMessage({ goalId, status, bin: this.config.bin }),
|
|
257
|
+
message: plannerTimeoutMessage({ goalId, status, bin: this.config.bin, spaceId, idempotencyKey }),
|
|
252
258
|
code: 'PLANNER_TICK_TIMED_OUT',
|
|
253
259
|
status,
|
|
254
260
|
exit: 5,
|
|
255
|
-
|
|
256
|
-
//
|
|
257
|
-
// this as "safe to send again".
|
|
261
|
+
details: { idempotencyKey },
|
|
262
|
+
// Automatically invoking the command again could mint a fresh key.
|
|
258
263
|
retryable: false,
|
|
259
264
|
});
|
|
260
265
|
}
|
|
@@ -56,9 +56,11 @@ function comparisonLines(result) {
|
|
|
56
56
|
? 'The configured inference target was unavailable. Check the Agent harness and daemon connection, then retry.'
|
|
57
57
|
: failure.code === 'INFERENCE_AGENT_UNAVAILABLE'
|
|
58
58
|
? 'The configured Agent is unavailable. Check the Goal owner Agent, then retry.'
|
|
59
|
-
: failure.code === '
|
|
60
|
-
? 'The
|
|
61
|
-
:
|
|
59
|
+
: failure.code === 'INFERENCE_LOCAL_RATE_LIMITED'
|
|
60
|
+
? 'The local Claude provider reported a rate limit. The execution outcome is still unverified.'
|
|
61
|
+
: failure.code === 'INFERENCE_OUTCOME_UNKNOWN'
|
|
62
|
+
? 'The inference outcome is unknown. Check for existing results before retrying.'
|
|
63
|
+
: 'The planner failed; the cause was not recorded. Check the planner logs.';
|
|
62
64
|
lines.push(`Latest planner failure (${failure.at}): ${detail}`);
|
|
63
65
|
}
|
|
64
66
|
lines.push(`${pad('Tasks created')}${String(result.goalPlanner.created).padEnd(column)}${result.goalLoop.tasksCreated}`);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class InstructionsDiscovery extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
provider: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
};
|
|
9
|
+
run(): Promise<void>;
|
|
10
|
+
}
|