@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
|
@@ -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;
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const promises_1 = require("node:fs/promises");
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const core_1 = require("@oclif/core");
|
|
9
|
+
const auth_core_1 = require("@skrr-ai/auth-core");
|
|
10
|
+
const SKILL_ROOTS = {
|
|
11
|
+
codex: '.agents',
|
|
12
|
+
claude: '.claude',
|
|
13
|
+
[auth_core_1.FIRST_PARTY_HARNESS.provider]: '.agents',
|
|
14
|
+
};
|
|
15
|
+
class InstructionsDiscovery extends core_1.Command {
|
|
16
|
+
static description = 'Install the Skrr discovery Skill for a coding agent in the current project';
|
|
17
|
+
static examples = [
|
|
18
|
+
'<%= config.bin %> instructions discovery --provider codex',
|
|
19
|
+
'<%= config.bin %> instructions discovery --provider claude --json',
|
|
20
|
+
];
|
|
21
|
+
static flags = {
|
|
22
|
+
provider: core_1.Flags.string({
|
|
23
|
+
description: 'Coding agent that should discover Skrr in this project',
|
|
24
|
+
options: Object.keys(SKILL_ROOTS),
|
|
25
|
+
required: true,
|
|
26
|
+
}),
|
|
27
|
+
json: core_1.Flags.boolean({ description: 'Output the resolved Skill path and installation status' }),
|
|
28
|
+
};
|
|
29
|
+
async run() {
|
|
30
|
+
const { flags } = await this.parse(InstructionsDiscovery);
|
|
31
|
+
const provider = flags.provider;
|
|
32
|
+
const source = node_path_1.default.join(this.config.root, 'skills', 'skrr', 'SKILL.md');
|
|
33
|
+
const project = await (0, promises_1.realpath)(process.cwd());
|
|
34
|
+
let directory = project;
|
|
35
|
+
for (const component of [SKILL_ROOTS[provider], 'skills', 'skrr']) {
|
|
36
|
+
directory = node_path_1.default.join(directory, component);
|
|
37
|
+
try {
|
|
38
|
+
await (0, promises_1.mkdir)(directory);
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
if (error.code !== 'EEXIST')
|
|
42
|
+
throw error;
|
|
43
|
+
}
|
|
44
|
+
if (!(await (0, promises_1.lstat)(directory)).isDirectory()) {
|
|
45
|
+
this.error(`The Skill needs a project-local directory at ${directory}.`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const destination = node_path_1.default.join(directory, 'SKILL.md');
|
|
49
|
+
const staging = await (0, promises_1.mkdtemp)(node_path_1.default.join(directory, '.install-'));
|
|
50
|
+
let status = 'installed';
|
|
51
|
+
try {
|
|
52
|
+
const stagedSkill = node_path_1.default.join(staging, 'SKILL.md');
|
|
53
|
+
await (0, promises_1.copyFile)(source, stagedSkill);
|
|
54
|
+
await (0, promises_1.link)(stagedSkill, destination);
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
if (error.code !== 'EEXIST')
|
|
58
|
+
throw error;
|
|
59
|
+
const existing = await (0, promises_1.lstat)(destination);
|
|
60
|
+
if (!existing.isFile() || !(await (0, promises_1.readFile)(destination)).equals(await (0, promises_1.readFile)(source))) {
|
|
61
|
+
this.error(`A different Skill already exists at ${destination}.`);
|
|
62
|
+
}
|
|
63
|
+
status = 'already-installed';
|
|
64
|
+
}
|
|
65
|
+
finally {
|
|
66
|
+
await (0, promises_1.rm)(staging, { recursive: true, force: true });
|
|
67
|
+
}
|
|
68
|
+
if (flags.json)
|
|
69
|
+
this.log(JSON.stringify({ status, provider, path: destination }));
|
|
70
|
+
else
|
|
71
|
+
this.log(`Skrr discovery Skill ${status} at ${destination}. Start a new agent session in this project.`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.default = InstructionsDiscovery;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command';
|
|
2
|
+
export default class RunsAdmission extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static args: {
|
|
6
|
+
clientRequestId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
static flags: {
|
|
9
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
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 agent_chat_start_1 = require("../../lib/agent-chat-start");
|
|
6
|
+
const agent_runs_1 = require("../../lib/agent-runs");
|
|
7
|
+
const api_fetch_1 = require("../../lib/api-fetch");
|
|
8
|
+
const format_1 = require("../../lib/format");
|
|
9
|
+
class RunsAdmission extends base_command_1.BaseCommand {
|
|
10
|
+
static description = 'Check whether a recorded Chat request has an Agent Run';
|
|
11
|
+
static examples = [
|
|
12
|
+
'<%= config.bin %> runs admission cli-chat:request-id',
|
|
13
|
+
'<%= config.bin %> runs admission cli-chat:request-id --json',
|
|
14
|
+
];
|
|
15
|
+
static args = {
|
|
16
|
+
clientRequestId: core_1.Args.string({
|
|
17
|
+
description: 'The Chat clientRequestId or --idempotency-key',
|
|
18
|
+
required: true,
|
|
19
|
+
ignoreStdin: true,
|
|
20
|
+
parse: async (key) => {
|
|
21
|
+
if (!(0, agent_chat_start_1.isValidStartKey)(key))
|
|
22
|
+
throw new Error(`Expected ${agent_chat_start_1.START_KEY_RULE}.`);
|
|
23
|
+
return key;
|
|
24
|
+
},
|
|
25
|
+
}),
|
|
26
|
+
};
|
|
27
|
+
static flags = { json: core_1.Flags.boolean({ description: 'Output as JSON' }) };
|
|
28
|
+
async run() {
|
|
29
|
+
this.requireAuth();
|
|
30
|
+
const { args: { clientRequestId }, flags } = await this.parse(RunsAdmission);
|
|
31
|
+
try {
|
|
32
|
+
const receipt = await (0, api_fetch_1.apiFetch)('/api/agentic/chat/admission?clientRequestId=' + encodeURIComponent(clientRequestId));
|
|
33
|
+
if (receipt?.clientRequestId !== clientRequestId ||
|
|
34
|
+
(receipt.phase === 'run_accepted' &&
|
|
35
|
+
(!(0, agent_runs_1.canonicalRunId)(receipt.runId) || !Number.isFinite(Date.parse(receipt.acceptedAt))))) {
|
|
36
|
+
throw new Error('Chat admission did not match the requested receipt.');
|
|
37
|
+
}
|
|
38
|
+
if (flags.json) {
|
|
39
|
+
this.log(JSON.stringify(receipt, null, 2));
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
switch (receipt.phase) {
|
|
43
|
+
case 'run_accepted':
|
|
44
|
+
this.log(`Run ${receipt.runId}`);
|
|
45
|
+
this.log(`Accepted: ${(0, format_1.localTime)(receipt.acceptedAt)}`);
|
|
46
|
+
this.log(`Conversation: ${receipt.conversationId}`);
|
|
47
|
+
if (receipt.dispatchPending)
|
|
48
|
+
this.log('Waiting for dispatch.');
|
|
49
|
+
break;
|
|
50
|
+
case 'request_recorded':
|
|
51
|
+
this.log('Chat request recorded. Waiting for Run acceptance.');
|
|
52
|
+
break;
|
|
53
|
+
case 'unconfirmed':
|
|
54
|
+
this.log('Chat Run acceptance is unconfirmed. Check this request key again.');
|
|
55
|
+
break;
|
|
56
|
+
case 'refused':
|
|
57
|
+
this.log('Chat request was refused before a Run was accepted.');
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
this.handleApiError(error);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.default = RunsAdmission;
|
|
@@ -6,9 +6,11 @@ export default class RunsEvents extends BaseCommand {
|
|
|
6
6
|
runId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
7
|
};
|
|
8
8
|
static flags: {
|
|
9
|
+
attempt: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
10
|
cursor: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
11
|
limit: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
12
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
personal: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
14
|
};
|
|
13
15
|
run(): Promise<void>;
|
|
14
16
|
}
|
|
@@ -1,31 +1,57 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const auth_core_1 = require("@skrr-ai/auth-core");
|
|
3
4
|
const core_1 = require("@oclif/core");
|
|
4
5
|
const base_command_1 = require("../../base-command");
|
|
5
6
|
const agent_runs_1 = require("../../lib/agent-runs");
|
|
6
|
-
const
|
|
7
|
+
const keychain_1 = require("../../lib/keychain");
|
|
8
|
+
const memory_history_session_1 = require("../../lib/memory-history-session");
|
|
9
|
+
const shell_quote_1 = require("../../lib/shell-quote");
|
|
7
10
|
class RunsEvents extends base_command_1.BaseCommand {
|
|
8
11
|
static description = 'Read the current Run snapshot or replay lifecycle events after a cursor';
|
|
9
12
|
static examples = [
|
|
10
13
|
'<%= config.bin %> runs events <run-id>',
|
|
11
|
-
'<%= config.bin %> runs events <run-id> --cursor <cursor> --json',
|
|
14
|
+
'<%= config.bin %> runs events <run-id> --attempt <attempt-id> --cursor <cursor> --json',
|
|
12
15
|
];
|
|
13
16
|
static args = { runId: agent_runs_1.runIdArgument };
|
|
14
17
|
static flags = {
|
|
18
|
+
attempt: core_1.Flags.string({
|
|
19
|
+
description: 'Replay only the events for this exact Attempt',
|
|
20
|
+
parse: async (input) => (0, agent_runs_1.exactAttemptId)(input),
|
|
21
|
+
}),
|
|
15
22
|
cursor: core_1.Flags.string({ description: 'Resume from the cursor returned by an earlier read' }),
|
|
16
23
|
limit: core_1.Flags.integer({ description: 'Maximum events in a replay page (1–100)', min: 1, max: 100 }),
|
|
17
|
-
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
24
|
+
json: core_1.Flags.boolean({ description: 'Output the event page and continuation argv as JSON' }),
|
|
25
|
+
personal: core_1.Flags.boolean({
|
|
26
|
+
description: 'Read only in personal scope, ignoring the saved workspace.',
|
|
27
|
+
exclusive: ['workspace'],
|
|
28
|
+
}),
|
|
18
29
|
};
|
|
19
30
|
async run() {
|
|
20
|
-
this.requireAuth();
|
|
21
31
|
const { args, flags } = await this.parse(RunsEvents);
|
|
32
|
+
if ((0, memory_history_session_1.hasBoundHistoryRuntime)()) {
|
|
33
|
+
this.failWithCliError({
|
|
34
|
+
code: 'INVALID_RUN_HISTORY_SCOPE',
|
|
35
|
+
message: 'Run event replay requires a signed-in person.',
|
|
36
|
+
exit: 2,
|
|
37
|
+
retryable: false,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
this.requireAuth();
|
|
41
|
+
const profile = (0, auth_core_1.explicitProfileArgs)((0, keychain_1.profileForChildProcess)());
|
|
42
|
+
const limit = flags.limit ? ['--limit', String(flags.limit)] : [];
|
|
43
|
+
const target = flags.attempt ? ['--attempt', flags.attempt] : [];
|
|
44
|
+
const command = [this.config.bin, 'runs', 'events', args.runId, ...target];
|
|
22
45
|
try {
|
|
23
|
-
const page = await (0, agent_runs_1.readAgentRunEvents)(args.runId, flags);
|
|
46
|
+
const { page, workspaceId } = await (0, agent_runs_1.readAgentRunEvents)(args.runId, flags);
|
|
47
|
+
const continuation = [...command, `--cursor=${page.cursor}`, ...limit, ...(0, agent_runs_1.runReadScopeArgs)(workspaceId), ...profile];
|
|
24
48
|
if (flags.json) {
|
|
25
|
-
this.log(JSON.stringify(page, null, 2));
|
|
49
|
+
this.log(JSON.stringify({ ...page, continuation: { argv: [...continuation, '--json'] } }, null, 2));
|
|
26
50
|
return;
|
|
27
51
|
}
|
|
28
52
|
this.log(`Run ${page.runId}`);
|
|
53
|
+
if (page.attemptId)
|
|
54
|
+
this.log(`Attempt: ${page.attemptId}`);
|
|
29
55
|
if (page.snapshot) {
|
|
30
56
|
this.log(`Status: ${page.snapshot.status} (sequence ${page.snapshot.sequence})`);
|
|
31
57
|
if (page.snapshot.activeAttemptId) {
|
|
@@ -37,19 +63,23 @@ class RunsEvents extends base_command_1.BaseCommand {
|
|
|
37
63
|
this.log(`${event.sequence} ${event.observedAt} ${event.type}${context ? ` (${context})` : ''}`);
|
|
38
64
|
}
|
|
39
65
|
if (!page.snapshot && !page.events.length)
|
|
40
|
-
this.log('No
|
|
66
|
+
this.log('No matching events in this page.');
|
|
41
67
|
if (page.hasMore)
|
|
42
|
-
this.log('More
|
|
68
|
+
this.log('More pages are available.');
|
|
43
69
|
this.log(`Cursor: ${page.cursor}`);
|
|
70
|
+
this.log(`Continue: ${(0, shell_quote_1.shellQuoteArgv)(continuation)}`);
|
|
44
71
|
}
|
|
45
72
|
catch (error) {
|
|
46
|
-
if (
|
|
73
|
+
if (error instanceof agent_runs_1.RunEventCursorStaleError) {
|
|
74
|
+
const recovery = (0, shell_quote_1.shellQuoteArgv)([...command, ...limit, ...(0, agent_runs_1.runReadScopeArgs)(error.workspaceId), ...profile]);
|
|
47
75
|
this.failWithCliError({
|
|
48
76
|
code: 'RUN_HISTORY_EVENT_CURSOR_STALE',
|
|
49
|
-
message: `The event cursor expired or is no longer valid. Get a fresh snapshot with ${
|
|
77
|
+
message: `The event cursor expired or is no longer valid. Get a fresh snapshot with ${recovery}.`,
|
|
50
78
|
status: 410,
|
|
51
79
|
exit: 1,
|
|
52
80
|
retryable: false,
|
|
81
|
+
details: { command: recovery, ...(flags.attempt ? { attemptId: flags.attempt } : {}),
|
|
82
|
+
...(error.workspaceId ? { workspaceId: error.workspaceId } : {}) },
|
|
53
83
|
});
|
|
54
84
|
}
|
|
55
85
|
this.handleApiError(error);
|
|
@@ -2,19 +2,25 @@ import { BaseCommand } from '../../base-command';
|
|
|
2
2
|
export default class RunsList extends BaseCommand {
|
|
3
3
|
static autonomousCredentialPolicy: "bound-session";
|
|
4
4
|
static description: string;
|
|
5
|
-
static examples: string
|
|
5
|
+
static examples: (string | {
|
|
6
|
+
description: string;
|
|
7
|
+
command: string;
|
|
8
|
+
})[];
|
|
6
9
|
static flags: {
|
|
7
10
|
task: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
11
|
cursor: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
12
|
limit: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
13
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
personal: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
15
|
from: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
16
|
to: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
17
|
since: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
18
|
timezone: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
19
|
agent: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
goal: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
21
|
conversation: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
22
|
source: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
23
|
+
evaluation: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
24
|
status: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
25
|
};
|
|
20
26
|
run(): Promise<void>;
|