@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.
Files changed (161) hide show
  1. package/README.md +42 -4
  2. package/bin/dev.cjs +4 -1
  3. package/bin/run.js +0 -15
  4. package/dist/base-command.d.ts +6 -11
  5. package/dist/base-command.js +34 -43
  6. package/dist/commands/agenda/plan.d.ts +2 -1
  7. package/dist/commands/agenda/plan.js +18 -4
  8. package/dist/commands/agent/message/context.d.ts +2 -0
  9. package/dist/commands/agent/message/context.js +18 -3
  10. package/dist/commands/agent/message/list.d.ts +22 -0
  11. package/dist/commands/agent/message/list.js +66 -0
  12. package/dist/commands/agent/message/send.d.ts +1 -1
  13. package/dist/commands/agent/message/send.js +1 -3
  14. package/dist/commands/agent/message/show.d.ts +14 -0
  15. package/dist/commands/agent/message/show.js +39 -0
  16. package/dist/commands/agents/chat.d.ts +4 -0
  17. package/dist/commands/agents/chat.js +79 -17
  18. package/dist/commands/agents/eval/list.d.ts +4 -0
  19. package/dist/commands/agents/eval/list.js +33 -0
  20. package/dist/commands/agents/eval/show.d.ts +1 -0
  21. package/dist/commands/agents/eval/show.js +19 -0
  22. package/dist/commands/agents/intuitions/generate.js +1 -1
  23. package/dist/commands/agents/intuitions/list.js +1 -1
  24. package/dist/commands/agents/permissions/policy.js +25 -2
  25. package/dist/commands/agents/spawn.js +61 -24
  26. package/dist/commands/agents/triggers/fire.js +1 -1
  27. package/dist/commands/agents/triggers/runs.js +3 -0
  28. package/dist/commands/code/acp.js +1 -1
  29. package/dist/commands/code/handover.d.ts +3 -3
  30. package/dist/commands/code/handover.js +12 -12
  31. package/dist/commands/code/index.d.ts +3 -8
  32. package/dist/commands/code/index.js +15 -21
  33. package/dist/commands/code/jobs/approve.d.ts +1 -11
  34. package/dist/commands/code/jobs/approve.js +3 -15
  35. package/dist/commands/code/jobs/cancel.js +3 -2
  36. package/dist/commands/code/jobs/index.js +1 -1
  37. package/dist/commands/code/jobs/list.js +4 -11
  38. package/dist/commands/code/jobs/run.js +13 -7
  39. package/dist/commands/code/jobs/show.js +52 -6
  40. package/dist/commands/code/run.js +1 -1
  41. package/dist/commands/commands.d.ts +1 -0
  42. package/dist/commands/commands.js +5 -1
  43. package/dist/commands/context.d.ts +1 -0
  44. package/dist/commands/context.js +1 -0
  45. package/dist/commands/duties/catalog/add.d.ts +18 -0
  46. package/dist/commands/duties/catalog/add.js +52 -0
  47. package/dist/commands/duties/catalog/index.d.ts +18 -0
  48. package/dist/commands/duties/catalog/index.js +88 -0
  49. package/dist/commands/duties/receipt.js +56 -1
  50. package/dist/commands/goals/plan-now.d.ts +5 -3
  51. package/dist/commands/goals/plan-now.js +21 -16
  52. package/dist/commands/goals/planner-compare.js +5 -3
  53. package/dist/commands/instructions/discovery.d.ts +10 -0
  54. package/dist/commands/instructions/discovery.js +74 -0
  55. package/dist/commands/runs/admission.d.ts +12 -0
  56. package/dist/commands/runs/admission.js +66 -0
  57. package/dist/commands/runs/events.d.ts +16 -0
  58. package/dist/commands/runs/events.js +89 -0
  59. package/dist/commands/runs/list.d.ts +27 -0
  60. package/dist/commands/runs/list.js +151 -0
  61. package/dist/commands/runs/show.d.ts +14 -0
  62. package/dist/commands/runs/show.js +273 -0
  63. package/dist/commands/runs/stop.d.ts +15 -0
  64. package/dist/commands/runs/stop.js +105 -0
  65. package/dist/commands/runs/transcript.d.ts +19 -0
  66. package/dist/commands/runs/transcript.js +178 -0
  67. package/dist/commands/tasks/attachments/download.d.ts +1 -0
  68. package/dist/commands/tasks/attachments/download.js +6 -4
  69. package/dist/commands/tasks/attachments/source.d.ts +6 -0
  70. package/dist/commands/tasks/attachments/source.js +18 -0
  71. package/dist/commands/tasks/chat/exchange.d.ts +0 -14
  72. package/dist/commands/tasks/chat/exchange.js +8 -39
  73. package/dist/commands/tasks/chat/reply-run.d.ts +15 -0
  74. package/dist/commands/tasks/chat/reply-run.js +69 -0
  75. package/dist/commands/tasks/complete.js +1 -1
  76. package/dist/commands/tasks/lifecycle/transition.d.ts +1 -0
  77. package/dist/commands/tasks/lifecycle/transition.js +51 -13
  78. package/dist/commands/tasks/operations/show.js +5 -0
  79. package/dist/commands/tasks/result/submit.js +4 -2
  80. package/dist/commands/tasks/retry.js +25 -16
  81. package/dist/commands/tasks/runs.js +7 -0
  82. package/dist/commands/tasks/start-receipt.js +8 -8
  83. package/dist/commands/tasks/start.js +12 -1
  84. package/dist/commands/triggers/audit.js +3 -1
  85. package/dist/commands/triggers/fire-detail.js +4 -1
  86. package/dist/commands/triggers/fire.js +1 -1
  87. package/dist/commands/usage.d.ts +1 -0
  88. package/dist/commands/usage.js +1 -0
  89. package/dist/generated/agent-guides.json +350 -777
  90. package/dist/help.d.ts +2 -7
  91. package/dist/help.js +13 -7
  92. package/dist/hooks/init.js +10 -0
  93. package/dist/lib/agent-chat-queue.d.ts +2 -1
  94. package/dist/lib/agent-chat-queue.js +26 -21
  95. package/dist/lib/agent-evals.d.ts +1 -1
  96. package/dist/lib/agent-evals.js +13 -3
  97. package/dist/lib/agent-guides.d.ts +3 -5
  98. package/dist/lib/agent-guides.js +12 -13
  99. package/dist/lib/agent-runs.d.ts +101 -0
  100. package/dist/lib/agent-runs.js +350 -0
  101. package/dist/lib/agentic-stream.d.ts +13 -1
  102. package/dist/lib/agentic-stream.js +165 -81
  103. package/dist/lib/api-fetch.d.ts +4 -2
  104. package/dist/lib/api-fetch.js +11 -5
  105. package/dist/lib/code-handover.d.ts +2 -3
  106. package/dist/lib/code-handover.js +4 -6
  107. package/dist/lib/command-manifest.d.ts +1 -6
  108. package/dist/lib/command-manifest.js +86 -13
  109. package/dist/lib/communication-history.d.ts +27 -0
  110. package/dist/lib/communication-history.js +45 -0
  111. package/dist/lib/config.d.ts +2 -3
  112. package/dist/lib/config.js +2 -3
  113. package/dist/lib/duties.d.ts +5 -1
  114. package/dist/lib/duties.js +4 -0
  115. package/dist/lib/execution-history.d.ts +34 -0
  116. package/dist/lib/execution-history.js +7 -0
  117. package/dist/lib/first-party-harness-broker.d.ts +1 -1
  118. package/dist/lib/first-party-harness-broker.js +3 -5
  119. package/dist/lib/format.d.ts +1 -0
  120. package/dist/lib/format.js +18 -0
  121. package/dist/lib/guide-pointer.d.ts +5 -1
  122. package/dist/lib/guide-pointer.js +21 -2
  123. package/dist/lib/hosted-job-status.d.ts +4 -0
  124. package/dist/lib/hosted-job-status.js +19 -0
  125. package/dist/lib/inbound-messages.d.ts +2 -0
  126. package/dist/lib/inbound-messages.js +5 -0
  127. package/dist/lib/intuition-look.js +20 -4
  128. package/dist/lib/memory-history-session.d.ts +8 -4
  129. package/dist/lib/memory-history-session.js +30 -23
  130. package/dist/lib/roles.d.ts +2 -2
  131. package/dist/lib/schedule.d.ts +4 -0
  132. package/dist/lib/schedule.js +4 -3
  133. package/dist/lib/task-agent-run.d.ts +4 -0
  134. package/dist/lib/task-agent-run.js +15 -0
  135. package/dist/lib/task-execution.d.ts +1 -1
  136. package/dist/lib/task-execution.js +3 -19
  137. package/dist/lib/task-extras.d.ts +11 -1
  138. package/dist/lib/task-extras.js +15 -1
  139. package/dist/lib/task-transcript.js +3 -8
  140. package/dist/lib/triggers.d.ts +5 -36
  141. package/dist/lib/triggers.js +48 -33
  142. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.d.ts +9 -0
  143. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.js +40 -3
  144. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessCommand.d.ts +37 -0
  145. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessCommand.js +59 -0
  146. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/toolApprovalSignature.d.ts +62 -0
  147. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/toolApprovalSignature.js +56 -0
  148. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.d.ts +9 -0
  149. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.js +34 -3
  150. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessCommand.d.ts +37 -0
  151. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessCommand.js +57 -0
  152. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/toolApprovalSignature.d.ts +62 -0
  153. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/toolApprovalSignature.js +51 -0
  154. package/dist/node_modules/@skrr-ai/auth-core/package.json +10 -0
  155. package/dist/node_modules/@skrr-ai/data-provider/index.js +12259 -12160
  156. package/docs/v1/quickstart.md +18 -0
  157. package/oclif.manifest.json +3405 -2112
  158. package/package.json +6 -2
  159. package/skills/skrr/SKILL.md +14 -0
  160. package/dist/commands/triggers/runs.d.ts +0 -22
  161. package/dist/commands/triggers/runs.js +0 -58
@@ -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;
@@ -0,0 +1,16 @@
1
+ import { BaseCommand } from '../../base-command';
2
+ export default class RunsEvents extends BaseCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static args: {
6
+ runId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
7
+ };
8
+ static flags: {
9
+ attempt: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ cursor: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ limit: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
13
+ personal: import("@oclif/core/interfaces").BooleanFlag<boolean>;
14
+ };
15
+ run(): Promise<void>;
16
+ }
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const auth_core_1 = require("@skrr-ai/auth-core");
4
+ const core_1 = require("@oclif/core");
5
+ const base_command_1 = require("../../base-command");
6
+ const agent_runs_1 = require("../../lib/agent-runs");
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");
10
+ class RunsEvents extends base_command_1.BaseCommand {
11
+ static description = 'Read the current Run snapshot or replay lifecycle events after a cursor';
12
+ static examples = [
13
+ '<%= config.bin %> runs events <run-id>',
14
+ '<%= config.bin %> runs events <run-id> --attempt <attempt-id> --cursor <cursor> --json',
15
+ ];
16
+ static args = { runId: agent_runs_1.runIdArgument };
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
+ }),
22
+ cursor: core_1.Flags.string({ description: 'Resume from the cursor returned by an earlier read' }),
23
+ limit: core_1.Flags.integer({ description: 'Maximum events in a replay page (1–100)', min: 1, max: 100 }),
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
+ }),
29
+ };
30
+ async run() {
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];
45
+ try {
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];
48
+ if (flags.json) {
49
+ this.log(JSON.stringify({ ...page, continuation: { argv: [...continuation, '--json'] } }, null, 2));
50
+ return;
51
+ }
52
+ this.log(`Run ${page.runId}`);
53
+ if (page.attemptId)
54
+ this.log(`Attempt: ${page.attemptId}`);
55
+ if (page.snapshot) {
56
+ this.log(`Status: ${page.snapshot.status} (sequence ${page.snapshot.sequence})`);
57
+ if (page.snapshot.activeAttemptId) {
58
+ this.log(`Active Attempt: ${page.snapshot.activeAttemptId}`);
59
+ }
60
+ }
61
+ for (const event of page.events) {
62
+ const context = [event.status, event.attemptId].filter(Boolean).join(' · ');
63
+ this.log(`${event.sequence} ${event.observedAt} ${event.type}${context ? ` (${context})` : ''}`);
64
+ }
65
+ if (!page.snapshot && !page.events.length)
66
+ this.log('No matching events in this page.');
67
+ if (page.hasMore)
68
+ this.log('More pages are available.');
69
+ this.log(`Cursor: ${page.cursor}`);
70
+ this.log(`Continue: ${(0, shell_quote_1.shellQuoteArgv)(continuation)}`);
71
+ }
72
+ catch (error) {
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]);
75
+ this.failWithCliError({
76
+ code: 'RUN_HISTORY_EVENT_CURSOR_STALE',
77
+ message: `The event cursor expired or is no longer valid. Get a fresh snapshot with ${recovery}.`,
78
+ status: 410,
79
+ exit: 1,
80
+ retryable: false,
81
+ details: { command: recovery, ...(flags.attempt ? { attemptId: flags.attempt } : {}),
82
+ ...(error.workspaceId ? { workspaceId: error.workspaceId } : {}) },
83
+ });
84
+ }
85
+ this.handleApiError(error);
86
+ }
87
+ }
88
+ }
89
+ exports.default = RunsEvents;
@@ -0,0 +1,27 @@
1
+ import { BaseCommand } from '../../base-command';
2
+ export default class RunsList extends BaseCommand {
3
+ static autonomousCredentialPolicy: "bound-session";
4
+ static description: string;
5
+ static examples: (string | {
6
+ description: string;
7
+ command: string;
8
+ })[];
9
+ static flags: {
10
+ task: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ cursor: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ limit: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
14
+ personal: import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
+ from: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
16
+ to: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
+ since: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
+ timezone: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
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>;
21
+ conversation: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
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>;
24
+ status: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
25
+ };
26
+ run(): Promise<void>;
27
+ }
@@ -0,0 +1,151 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const auth_core_1 = require("@skrr-ai/auth-core");
4
+ const core_1 = require("@oclif/core");
5
+ const data_provider_1 = require("@skrr-ai/data-provider");
6
+ const base_command_1 = require("../../base-command");
7
+ const agent_runs_1 = require("../../lib/agent-runs");
8
+ const communication_history_1 = require("../../lib/communication-history");
9
+ const execution_history_1 = require("../../lib/execution-history");
10
+ const format_1 = require("../../lib/format");
11
+ const http_error_1 = require("../../lib/http-error");
12
+ const keychain_1 = require("../../lib/keychain");
13
+ const search_display_1 = require("../../lib/search-display");
14
+ const shell_quote_1 = require("../../lib/shell-quote");
15
+ class RunsList extends base_command_1.BaseCommand {
16
+ static autonomousCredentialPolicy = 'bound-session';
17
+ static description = 'List Agent Runs you can discover in Run History.\n\n' +
18
+ 'When signed in, select an Agent, a Goal, a Chat or native conversation you own, or Hosted Jobs. ' +
19
+ 'Use --from and --to for an absolute date range.\n\n' +
20
+ 'In a bound Agent session, the session supplies the scope and supports relative ranges with --since.';
21
+ static examples = [
22
+ '<%= config.bin %> runs list --agent <agent-id>',
23
+ '<%= config.bin %> runs list --agent <agent-id> --source duty --json',
24
+ '<%= config.bin %> runs list --agent <agent-id> --from 2026-12-01T00:00:00Z --status failed',
25
+ '<%= config.bin %> runs list --goal <goal-id>',
26
+ {
27
+ description: 'List Runs from a Chat you own.',
28
+ command: '<%= config.bin %> runs list --source chat --conversation <conversation-id>',
29
+ },
30
+ '<%= config.bin %> runs list --source native --conversation <conversation-id>',
31
+ '<%= config.bin %> runs list --source hosted_job',
32
+ '<%= config.bin %> runs list --agent <agent-id> --source store_trial',
33
+ '<%= config.bin %> runs list --agent <agent-id> --source release_evaluation --evaluation <evaluation-id>',
34
+ {
35
+ description: 'Find recent failures from inside a bound Agent session.',
36
+ command: '<%= config.bin %> runs list --since 7d --status failed --json',
37
+ },
38
+ ];
39
+ static flags = {
40
+ agent: core_1.Flags.string({ description: 'Agent ID for an Agent-scoped list', exclusive: ['conversation'] }),
41
+ goal: core_1.Flags.string({ description: 'Goal ID for Goal Planner Run History' }),
42
+ conversation: core_1.Flags.string({ description: 'Conversation ID for source chat or native' }),
43
+ source: core_1.Flags.string({ description: 'Limit the list to one Run History source' }),
44
+ evaluation: core_1.Flags.string({ description: 'Evaluation ID for source release_evaluation' }),
45
+ status: core_1.Flags.string({ description: 'Filter by the status shown in the list', options: data_provider_1.AGENT_RUN_HISTORY_STATUSES }),
46
+ ...communication_history_1.historyTimeFlags,
47
+ task: core_1.Flags.string({ description: 'Exact Task reference for a bound Agent session' }),
48
+ cursor: core_1.Flags.string({ description: 'Continue with the cursor from the previous page and the same filters' }),
49
+ limit: core_1.Flags.integer({ description: 'Maximum runs per page (1–50 for people, 1–8 for Agent sessions, default 3 for sessions)', min: 1, max: 50 }),
50
+ json: core_1.Flags.boolean({ description: 'Output the page and any continuation argv as JSON' }),
51
+ personal: core_1.Flags.boolean({
52
+ description: 'List only in personal scope, ignoring the saved workspace.',
53
+ exclusive: ['workspace'],
54
+ }),
55
+ };
56
+ async run() {
57
+ const { flags } = await this.parse(RunsList);
58
+ const session = (0, communication_history_1.resolveHistorySession)(() => this.requireAuth());
59
+ const { agent, conversation, goal, evaluation, from, to, status, cursor, limit, since, timezone, task, personal } = flags;
60
+ const goalScope = goal !== undefined;
61
+ const source = flags.source ?? (goalScope ? 'goal_planner' : undefined);
62
+ const conversationScope = source === 'native' || (source === 'chat' && conversation);
63
+ const validScope = goalScope ? Boolean(goal) && source === 'goal_planner' && !agent && !conversation :
64
+ conversationScope ? conversation && !agent :
65
+ source === 'hosted_job' ? !conversation && !agent : agent && !conversation;
66
+ const privateSource = source === 'store_trial' || source === 'release_evaluation';
67
+ const validEvaluation = source === 'release_evaluation' ? Boolean(evaluation) : evaluation === undefined;
68
+ if ((session && (agent || conversation || goalScope || evaluation || privateSource || personal)) ||
69
+ (!session && (!validScope || !validEvaluation || since || timezone || task))) {
70
+ this.failWithCliError({
71
+ code: 'INVALID_RUN_HISTORY_SCOPE',
72
+ message: session && personal
73
+ ? 'A bound Agent session uses its own workspace scope.'
74
+ : session
75
+ ? 'The session selects the Agent and conversation automatically. Goal and private product history require a signed-in person.'
76
+ : 'Use --agent for Agent history, --goal for Goal Planner history, --conversation with --source chat or native, or --source hosted_job for Hosted Jobs. Use --evaluation with --agent and --source release_evaluation. --since, --timezone, and --task require an Agent session.',
77
+ exit: 1,
78
+ retryable: false,
79
+ });
80
+ }
81
+ const listArgv = (workspaceId, pageCursor) => [
82
+ this.config.bin, 'runs', 'list',
83
+ ...Object.entries({ agent, conversation, goal, source: flags.source, evaluation, from, to, status, limit })
84
+ .flatMap(([name, value]) => value === undefined ? [] : [`--${name}`, String(value)]),
85
+ ...(pageCursor === undefined ? [] : [`--cursor=${pageCursor}`]),
86
+ ...(0, agent_runs_1.runReadScopeArgs)(workspaceId),
87
+ ...(0, auth_core_1.explicitProfileArgs)((0, keychain_1.profileForChildProcess)()),
88
+ ];
89
+ try {
90
+ const { page, workspaceId } = session ? {
91
+ page: await (0, execution_history_1.readExecutionHistory)(session.sessionId, 'list', {
92
+ source, from, to, status, cursor, limit, since, timezone, taskId: task,
93
+ }),
94
+ workspaceId: undefined,
95
+ } : await (0, agent_runs_1.listAgentRuns)({
96
+ agentId: agent, conversationId: conversation, goalId: goal,
97
+ source, evaluationId: evaluation, from, to, status, cursor, limit, personal,
98
+ });
99
+ const continuation = !session && page.nextCursor ? listArgv(workspaceId, page.nextCursor) : undefined;
100
+ if (flags.json) {
101
+ this.log(JSON.stringify(continuation
102
+ ? { ...page, continuation: { argv: [...continuation, '--json'] } }
103
+ : page, null, 2));
104
+ return;
105
+ }
106
+ for (const run of page.items) {
107
+ const title = (0, search_display_1.searchDisplayText)(run.title ?? '');
108
+ const acceptedAt = (0, search_display_1.searchDisplayText)((0, format_1.localTime)(run.acceptedAt));
109
+ const status = (0, data_provider_1.agentRunHistoryStatus)(run.status);
110
+ const label = status === 'timed_out' && 'endReason' in run &&
111
+ run.endReason === 'preparation_deadline_before_attempt' ? 'Preparation timed out' : status;
112
+ this.log([
113
+ run.id, (0, search_display_1.searchDisplayText)(run.source), label, acceptedAt, title,
114
+ ].filter(Boolean).join(' · '));
115
+ }
116
+ if (!page.items.length) {
117
+ this.log(page.nextCursor ? 'No matches on this page.' : 'No visible runs match these filters.');
118
+ }
119
+ if (page.coverage === 'partial')
120
+ this.log('History coverage is partial. Some runs may be missing.');
121
+ if (continuation)
122
+ this.log(`Next page ${(0, shell_quote_1.shellQuoteArgv)(continuation)}`);
123
+ else if (page.nextCursor)
124
+ this.log(`Next page Add --cursor ${(0, search_display_1.shellSearchCursor)(page.nextCursor)} to the same command.`);
125
+ }
126
+ catch (error) {
127
+ if (error instanceof agent_runs_1.RunListCursorInvalidError) {
128
+ const command = (0, shell_quote_1.shellQuoteArgv)([...listArgv(error.workspaceId), ...(flags.json ? ['--json'] : [])]);
129
+ this.failWithCliError({
130
+ code: 'INVALID_RUN_HISTORY_CURSOR',
131
+ message: `The Run History cursor expired or is no longer valid.\n → ${command}`,
132
+ status: 400,
133
+ exit: 1,
134
+ retryable: false,
135
+ details: { command, ...(error.workspaceId ? { workspaceId: error.workspaceId } : {}) },
136
+ });
137
+ }
138
+ if ((0, http_error_1.httpStatusOf)(error) === 400 && error.code === 'INVALID_RUN_HISTORY_CURSOR') {
139
+ this.failWithCliError({
140
+ code: 'INVALID_RUN_HISTORY_CURSOR',
141
+ message: 'Use the same workspace and filters as the previous page, or omit --cursor to start again.',
142
+ status: 400,
143
+ exit: 1,
144
+ retryable: false,
145
+ });
146
+ }
147
+ this.handleApiError(error);
148
+ }
149
+ }
150
+ }
151
+ exports.default = RunsList;
@@ -0,0 +1,14 @@
1
+ import { BaseCommand } from '../../base-command';
2
+ export default class RunsShow extends BaseCommand {
3
+ static autonomousCredentialPolicy: "bound-session";
4
+ static description: string;
5
+ static examples: string[];
6
+ static args: {
7
+ runId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
8
+ };
9
+ static flags: {
10
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ personal: import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
+ };
13
+ run(): Promise<void>;
14
+ }