@skrr-ai/cli 0.1.207 → 0.1.208

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 (111) hide show
  1. package/dist/commands/agent/message/resolve.d.ts +31 -0
  2. package/dist/commands/agent/message/resolve.js +111 -0
  3. package/dist/commands/agent/message/send.d.ts +17 -5
  4. package/dist/commands/agent/message/send.js +77 -26
  5. package/dist/commands/agent/request/list.d.ts +15 -0
  6. package/dist/commands/agent/request/list.js +82 -0
  7. package/dist/commands/agent/request/send.d.ts +18 -0
  8. package/dist/commands/agent/request/send.js +56 -0
  9. package/dist/commands/agents/access/approve.d.ts +17 -0
  10. package/dist/commands/agents/access/approve.js +94 -0
  11. package/dist/commands/agents/access/deny.d.ts +10 -0
  12. package/dist/commands/agents/access/deny.js +36 -0
  13. package/dist/commands/agents/access/list.d.ts +10 -0
  14. package/dist/commands/agents/access/list.js +53 -0
  15. package/dist/commands/agents/access/reach.d.ts +13 -0
  16. package/dist/commands/agents/access/reach.js +53 -0
  17. package/dist/commands/agents/access/revoke.d.ts +13 -0
  18. package/dist/commands/agents/access/revoke.js +50 -0
  19. package/dist/commands/agents/import.d.ts +15 -1
  20. package/dist/commands/agents/import.js +211 -23
  21. package/dist/commands/agents/intuitions/accept.d.ts +0 -1
  22. package/dist/commands/agents/intuitions/accept.js +22 -7
  23. package/dist/commands/agents/intuitions/generate.d.ts +0 -1
  24. package/dist/commands/agents/intuitions/generate.js +4 -16
  25. package/dist/commands/agents/intuitions/list.js +9 -3
  26. package/dist/commands/agents/intuitions/resume.d.ts +11 -0
  27. package/dist/commands/agents/intuitions/resume.js +37 -0
  28. package/dist/commands/agents/shared-memory.d.ts +24 -0
  29. package/dist/commands/agents/shared-memory.js +67 -0
  30. package/dist/commands/agents/visibility.d.ts +1 -0
  31. package/dist/commands/agents/visibility.js +14 -0
  32. package/dist/commands/code/migrate.js +3 -1
  33. package/dist/commands/duties/advance-next.js +15 -6
  34. package/dist/commands/followups/show.js +9 -0
  35. package/dist/commands/followups/watch-pr.d.ts +27 -0
  36. package/dist/commands/followups/watch-pr.js +123 -0
  37. package/dist/commands/memory/consolidation/index.d.ts +20 -0
  38. package/dist/commands/memory/consolidation/index.js +78 -0
  39. package/dist/commands/memory/consolidation/resume.d.ts +14 -0
  40. package/dist/commands/memory/consolidation/resume.js +46 -0
  41. package/dist/commands/memory/consolidation/undo.d.ts +18 -0
  42. package/dist/commands/memory/consolidation/undo.js +60 -0
  43. package/dist/commands/slack/mutes.d.ts +10 -0
  44. package/dist/commands/slack/mutes.js +62 -0
  45. package/dist/commands/slack/unmute.d.ts +12 -0
  46. package/dist/commands/slack/unmute.js +44 -0
  47. package/dist/commands/tasks/actionability.js +9 -0
  48. package/dist/commands/tasks/ask.d.ts +50 -0
  49. package/dist/commands/tasks/ask.js +190 -0
  50. package/dist/commands/tasks/handover.js +14 -0
  51. package/dist/commands/tasks/input/answer.js +8 -2
  52. package/dist/commands/tasks/input/show.d.ts +26 -0
  53. package/dist/commands/tasks/input/show.js +185 -17
  54. package/dist/commands/tasks/move.d.ts +11 -0
  55. package/dist/commands/tasks/move.js +82 -1
  56. package/dist/commands/tasks/result/submit.js +3 -0
  57. package/dist/commands/tasks/runs.d.ts +4 -1
  58. package/dist/commands/tasks/runs.js +22 -3
  59. package/dist/commands/tasks/show.js +22 -1
  60. package/dist/commands/tasks/update.d.ts +1 -0
  61. package/dist/commands/tasks/update.js +52 -1
  62. package/dist/commands/tasks/updates/add.js +3 -0
  63. package/dist/commands/tasks/wait.d.ts +20 -0
  64. package/dist/commands/tasks/wait.js +102 -1
  65. package/dist/generated/agent-guides.json +501 -92
  66. package/dist/generated/managed-instruction-guides.json +1 -1
  67. package/dist/lib/agent-access-command.d.ts +19 -0
  68. package/dist/lib/agent-access-command.js +44 -0
  69. package/dist/lib/agent-access.d.ts +18 -0
  70. package/dist/lib/agent-access.js +48 -0
  71. package/dist/lib/agent-import/apply.d.ts +50 -0
  72. package/dist/lib/agent-import/apply.js +85 -0
  73. package/dist/lib/agent-import/plan.d.ts +132 -0
  74. package/dist/lib/agent-import/plan.js +504 -0
  75. package/dist/lib/agent-import/reader.d.ts +94 -0
  76. package/dist/lib/agent-import/reader.js +326 -0
  77. package/dist/lib/agent-import/schedule.d.ts +46 -0
  78. package/dist/lib/agent-import/schedule.js +220 -0
  79. package/dist/lib/agent-import/sources.d.ts +124 -0
  80. package/dist/lib/agent-import/sources.js +797 -0
  81. package/dist/lib/followups.d.ts +61 -0
  82. package/dist/lib/followups.js +39 -0
  83. package/dist/lib/handover-interview.d.ts +18 -0
  84. package/dist/lib/handover-interview.js +53 -0
  85. package/dist/lib/input-queue.js +2 -1
  86. package/dist/lib/intuition-look.d.ts +10 -0
  87. package/dist/lib/intuition-look.js +64 -0
  88. package/dist/lib/record-output.d.ts +1 -1
  89. package/dist/lib/record-output.js +2 -0
  90. package/dist/lib/skill-import.d.ts +19 -0
  91. package/dist/lib/skill-import.js +34 -0
  92. package/dist/lib/slack-thread-mutes.d.ts +25 -0
  93. package/dist/lib/slack-thread-mutes.js +12 -0
  94. package/dist/lib/task-carriers.d.ts +18 -0
  95. package/dist/lib/task-carriers.js +43 -0
  96. package/dist/lib/task-extras.d.ts +5 -0
  97. package/dist/lib/task-extras.js +5 -0
  98. package/dist/lib/task-recurrence-summary.d.ts +15 -0
  99. package/dist/lib/task-recurrence-summary.js +22 -0
  100. package/dist/lib/task-version.d.ts +44 -0
  101. package/dist/lib/task-version.js +73 -0
  102. package/dist/lib/task-write-attribution.d.ts +7 -0
  103. package/dist/lib/task-write-attribution.js +14 -0
  104. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/turnPacing.d.ts +75 -0
  105. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/turnPacing.js +124 -0
  106. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/turnPacing.d.ts +75 -0
  107. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/turnPacing.js +141 -0
  108. package/dist/node_modules/@skrr-ai/auth-core/package.json +10 -0
  109. package/dist/node_modules/@skrr-ai/data-provider/index.js +13323 -12577
  110. package/oclif.manifest.json +1787 -107
  111. package/package.json +5 -2
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const data_provider_1 = require("@skrr-ai/data-provider");
5
+ const base_command_1 = require("../../../base-command");
6
+ const agent_resolver_1 = require("../../../lib/agent-resolver");
7
+ /**
8
+ * Resume a nightly memory tidy-up that paused after failing several nights in
9
+ * a row. The failure count starts again from zero. Requires EDIT on the agent.
10
+ */
11
+ class MemoryConsolidationResume extends base_command_1.BaseCommand {
12
+ static description = 'Resume a paused nightly memory tidy-up (requires EDIT)';
13
+ static examples = ['<%= config.bin %> memory consolidation resume --agent <agent-id>'];
14
+ static flags = {
15
+ agent: core_1.Flags.string({
16
+ description: 'Agent ID (falls back to OVERSKY_AGENT_ID, then your primary agent)',
17
+ }),
18
+ json: core_1.Flags.boolean({ description: 'Output as JSON' }),
19
+ };
20
+ async run() {
21
+ this.requireAuth();
22
+ const { flags } = await this.parse(MemoryConsolidationResume);
23
+ let agentId;
24
+ try {
25
+ agentId = await (0, agent_resolver_1.resolveAgentId)(flags.agent);
26
+ }
27
+ catch (err) {
28
+ this.error(err.message, { exit: 1 });
29
+ }
30
+ let response;
31
+ try {
32
+ response = await data_provider_1.dataService.resumeAgentMemoryConsolidation(agentId);
33
+ }
34
+ catch (err) {
35
+ this.handleApiError(err);
36
+ }
37
+ if (flags.json) {
38
+ this.log(this.agentJson(agentId, response));
39
+ return;
40
+ }
41
+ this.log(response.state.paused
42
+ ? 'The tidy-up is still paused.'
43
+ : 'Overnight memory tidy-up resumed. It runs again tonight.');
44
+ }
45
+ }
46
+ exports.default = MemoryConsolidationResume;
@@ -0,0 +1,18 @@
1
+ import { BaseCommand } from '../../../base-command';
2
+ /**
3
+ * Revert everything one nightly tidy-up wrote, as new versions (history is
4
+ * kept). An entry changed since that night is left as it is now, and the
5
+ * command says so for each one. Requires EDIT on the agent.
6
+ */
7
+ export default class MemoryConsolidationUndo extends BaseCommand {
8
+ static description: string;
9
+ static examples: string[];
10
+ static args: {
11
+ cycleId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
12
+ };
13
+ static flags: {
14
+ agent: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
+ };
17
+ run(): Promise<void>;
18
+ }
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const data_provider_1 = require("@skrr-ai/data-provider");
5
+ const base_command_1 = require("../../../base-command");
6
+ const agent_resolver_1 = require("../../../lib/agent-resolver");
7
+ /**
8
+ * Revert everything one nightly tidy-up wrote, as new versions (history is
9
+ * kept). An entry changed since that night is left as it is now, and the
10
+ * command says so for each one. Requires EDIT on the agent.
11
+ */
12
+ class MemoryConsolidationUndo extends base_command_1.BaseCommand {
13
+ static description = 'Undo everything one nightly memory tidy-up changed (requires EDIT)';
14
+ static examples = [
15
+ '<%= config.bin %> memory consolidation undo <cycle-id> --agent <agent-id>',
16
+ ];
17
+ static args = {
18
+ cycleId: core_1.Args.string({
19
+ description: 'Tidy-up id, from `skrr memory consolidation`',
20
+ required: true,
21
+ }),
22
+ };
23
+ static flags = {
24
+ agent: core_1.Flags.string({
25
+ description: 'Agent ID (falls back to OVERSKY_AGENT_ID, then your primary agent)',
26
+ }),
27
+ json: core_1.Flags.boolean({ description: 'Output as JSON' }),
28
+ };
29
+ async run() {
30
+ this.requireAuth();
31
+ const { args, flags } = await this.parse(MemoryConsolidationUndo);
32
+ let agentId;
33
+ try {
34
+ agentId = await (0, agent_resolver_1.resolveAgentId)(flags.agent);
35
+ }
36
+ catch (err) {
37
+ this.error(err.message, { exit: 1 });
38
+ }
39
+ let response;
40
+ try {
41
+ response = await data_provider_1.dataService.undoAgentMemoryConsolidationCycle(agentId, args.cycleId);
42
+ }
43
+ catch (err) {
44
+ this.handleApiError(err);
45
+ }
46
+ if (flags.json) {
47
+ this.log(this.agentJson(agentId, response));
48
+ return;
49
+ }
50
+ const { result } = response;
51
+ this.log(`Restored ${result.restored.length} memory entries.`);
52
+ if (result.skipped.length) {
53
+ this.log(`Left ${result.skipped.length} as they are:`);
54
+ for (const skipped of result.skipped) {
55
+ this.log(` ${skipped.memoryId}: ${(0, data_provider_1.consolidationUndoSkipCopy)(skipped.reason)}`);
56
+ }
57
+ }
58
+ }
59
+ }
60
+ exports.default = MemoryConsolidationUndo;
@@ -0,0 +1,10 @@
1
+ import { BaseCommand } from '../../base-command';
2
+ export default class SlackMutes extends BaseCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ agent: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
+ };
9
+ run(): Promise<void>;
10
+ }
@@ -0,0 +1,62 @@
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 format_1 = require("../../lib/format");
6
+ const agent_resolver_1 = require("../../lib/agent-resolver");
7
+ const slack_thread_mutes_1 = require("../../lib/slack-thread-mutes");
8
+ class SlackMutes extends base_command_1.BaseCommand {
9
+ static description = 'List the Slack threads an agent left, and who asked it to leave';
10
+ static examples = [
11
+ '<%= config.bin %> slack mutes --agent agent_123',
12
+ '<%= config.bin %> slack mutes --json',
13
+ ];
14
+ static flags = {
15
+ agent: core_1.Flags.string({
16
+ description: 'Agent ID. Local daemon sessions prefer OVERSKY_SESSION_AGENT_ID and reject mismatches.',
17
+ }),
18
+ json: core_1.Flags.boolean({ description: 'Output as JSON' }),
19
+ };
20
+ async run() {
21
+ this.requireAuth();
22
+ const { flags } = await this.parse(SlackMutes);
23
+ let agentId;
24
+ try {
25
+ agentId = await (0, agent_resolver_1.resolveAgentId)(flags.agent);
26
+ }
27
+ catch (err) {
28
+ this.error(err.message, { exit: 2 });
29
+ }
30
+ let mutes;
31
+ try {
32
+ mutes = await (0, slack_thread_mutes_1.listSlackThreadMutes)(agentId);
33
+ }
34
+ catch (err) {
35
+ this.handleApiError(err);
36
+ }
37
+ if (flags.json) {
38
+ this.log(JSON.stringify({ mutes: mutes }, null, 2));
39
+ return;
40
+ }
41
+ if (mutes.length === 0) {
42
+ this.log('This agent has not left any Slack thread.');
43
+ return;
44
+ }
45
+ (0, format_1.renderTable)(mutes.map((mute) => ({
46
+ channel: mute.conversationName
47
+ ? `#${mute.conversationName} (${mute.channelId})`
48
+ : mute.channelId,
49
+ thread: mute.threadId,
50
+ askedBy: `${mute.mutedBy.userName || mute.mutedBy.userId || 'unknown'}${mute.mutedBy.role === 'owner' ? ' (owner)' : ''}`,
51
+ since: mute.mutedAt || '',
52
+ })), [
53
+ { key: 'channel', header: 'CHANNEL', maxWidth: 40 },
54
+ { key: 'thread', header: 'THREAD TS' },
55
+ { key: 'askedBy', header: 'ASKED BY', maxWidth: 30 },
56
+ { key: 'since', header: 'SINCE' },
57
+ ], (line) => this.log(line));
58
+ this.log('');
59
+ this.log('A person @mentioning the agent in a thread brings it back. To clear one yourself: skrr slack unmute --channel <id> --thread-ts <ts>');
60
+ }
61
+ }
62
+ exports.default = SlackMutes;
@@ -0,0 +1,12 @@
1
+ import { BaseCommand } from '../../base-command';
2
+ export default class SlackUnmute extends BaseCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ agent: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
+ channel: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
9
+ 'thread-ts': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
+ };
11
+ run(): Promise<void>;
12
+ }
@@ -0,0 +1,44 @@
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_resolver_1 = require("../../lib/agent-resolver");
6
+ const slack_thread_mutes_1 = require("../../lib/slack-thread-mutes");
7
+ class SlackUnmute extends base_command_1.BaseCommand {
8
+ static description = 'Let an agent follow a Slack thread it left again, without waiting for a mention';
9
+ static examples = [
10
+ '<%= config.bin %> slack unmute --channel C123 --thread-ts 1710000000.000100',
11
+ ];
12
+ static flags = {
13
+ agent: core_1.Flags.string({
14
+ description: 'Agent ID. Local daemon sessions prefer OVERSKY_SESSION_AGENT_ID and reject mismatches.',
15
+ }),
16
+ json: core_1.Flags.boolean({ description: 'Output as JSON' }),
17
+ channel: core_1.Flags.string({ description: 'Slack channel ID of the thread', required: true }),
18
+ 'thread-ts': core_1.Flags.string({ description: 'Slack parent thread timestamp', required: true }),
19
+ };
20
+ async run() {
21
+ this.requireAuth();
22
+ const { flags } = await this.parse(SlackUnmute);
23
+ let agentId;
24
+ try {
25
+ agentId = await (0, agent_resolver_1.resolveAgentId)(flags.agent);
26
+ }
27
+ catch (err) {
28
+ this.error(err.message, { exit: 2 });
29
+ }
30
+ let result;
31
+ try {
32
+ result = await (0, slack_thread_mutes_1.clearSlackThreadMute)(agentId, flags.channel, flags['thread-ts']);
33
+ }
34
+ catch (err) {
35
+ this.handleApiError(err);
36
+ }
37
+ if (flags.json) {
38
+ this.log(JSON.stringify(result, null, 2));
39
+ return;
40
+ }
41
+ this.log(`The agent follows thread ${flags['thread-ts']} in ${flags.channel} again. Nothing was posted.`);
42
+ }
43
+ }
44
+ exports.default = SlackUnmute;
@@ -5,6 +5,7 @@ const data_provider_1 = require("@skrr-ai/data-provider");
5
5
  const base_command_1 = require("../../base-command");
6
6
  const task_resolver_1 = require("../../lib/task-resolver");
7
7
  const task_operations_1 = require("../../lib/task-operations");
8
+ const task_carriers_1 = require("../../lib/task-carriers");
8
9
  class TasksActionability extends base_command_1.BaseCommand {
9
10
  static description = 'Show the canonical next actor and why this task can or cannot move';
10
11
  static args = {
@@ -56,6 +57,14 @@ class TasksActionability extends base_command_1.BaseCommand {
56
57
  if (a.actorRefs?.length) {
57
58
  this.log(`Eligible: ${a.actorRefs.map((ref) => `${ref.kind}:${ref.id}`).join(', ')}`);
58
59
  }
60
+ // Who is next is not the same as whether anything will act: an Agent can be next on a Task no
61
+ // Run, wake or person will ever move.
62
+ for (const line of (0, task_carriers_1.taskCarrierLines)(a, {
63
+ taskRef: response.identifier || response.taskId,
64
+ bin: this.config.bin,
65
+ })) {
66
+ this.log(line);
67
+ }
59
68
  if (a.allowedActions.length) {
60
69
  // These are SERVER action names, not commands, and printing them bare as
61
70
  // `Actions: retry_task, resolve_task_hold` reads as a list of things to
@@ -0,0 +1,50 @@
1
+ import { type AskTaskHumanInputBody } from '@skrr-ai/data-provider';
2
+ import { BaseCommand } from '../../base-command';
3
+ /**
4
+ * `--expires`: an ISO date-time, or a length of time from now (`30m`, `4h`, `2d`).
5
+ * The server keeps the workspace's longest wait and refuses a later deadline
6
+ * with the limit in its words; this only turns the flag into a time.
7
+ */
8
+ export declare function parseAskExpiry(value: string | undefined, now?: number): string | undefined;
9
+ /**
10
+ * `--option-description <n>=<text>`: what choosing the `--option` at position
11
+ * `n` (counted from 1, as `--recommended` is) means. The position is explicit so
12
+ * a description can never land under another option, whatever the order of the
13
+ * flags; the text is everything after the first `=`. The result is aligned with
14
+ * the options, `''` where an option has none, or `undefined` when none was given.
15
+ */
16
+ export declare function parseOptionDescriptions(values: string[] | undefined, optionCount: number): string[] | undefined;
17
+ /** The one question a `tasks ask` sends, with `--recommended` counted from 1 as it is shown. */
18
+ export declare function buildAskBody(flags: {
19
+ question: string;
20
+ context?: string;
21
+ option?: string[];
22
+ 'option-description'?: string[];
23
+ recommended?: number;
24
+ multi?: boolean;
25
+ header?: string;
26
+ 'no-free-text'?: boolean;
27
+ expires?: string;
28
+ key?: string;
29
+ }): AskTaskHumanInputBody;
30
+ export default class TasksAsk extends BaseCommand {
31
+ static description: string;
32
+ static examples: string[];
33
+ static args: {
34
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
35
+ };
36
+ static flags: {
37
+ question: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
38
+ context: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
39
+ option: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
40
+ 'option-description': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
41
+ recommended: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
42
+ multi: import("@oclif/core/interfaces").BooleanFlag<boolean>;
43
+ header: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
44
+ 'no-free-text': import("@oclif/core/interfaces").BooleanFlag<boolean>;
45
+ expires: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
46
+ key: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
47
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
48
+ };
49
+ run(): Promise<void>;
50
+ }
@@ -0,0 +1,190 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseAskExpiry = parseAskExpiry;
4
+ exports.parseOptionDescriptions = parseOptionDescriptions;
5
+ exports.buildAskBody = buildAskBody;
6
+ const core_1 = require("@oclif/core");
7
+ const data_provider_1 = require("@skrr-ai/data-provider");
8
+ const base_command_1 = require("../../base-command");
9
+ const show_1 = require("./input/show");
10
+ const RELATIVE_EXPIRY_RE = /^(\d+)\s*(m|h|d)$/i;
11
+ const UNIT_MS = { m: 60_000, h: 3_600_000, d: 86_400_000 };
12
+ /**
13
+ * `--expires`: an ISO date-time, or a length of time from now (`30m`, `4h`, `2d`).
14
+ * The server keeps the workspace's longest wait and refuses a later deadline
15
+ * with the limit in its words; this only turns the flag into a time.
16
+ */
17
+ function parseAskExpiry(value, now = Date.now()) {
18
+ if (value === undefined)
19
+ return undefined;
20
+ const trimmed = value.trim();
21
+ const relative = trimmed.match(RELATIVE_EXPIRY_RE);
22
+ if (relative) {
23
+ return new Date(now + Number(relative[1]) * UNIT_MS[relative[2].toLowerCase()]).toISOString();
24
+ }
25
+ const at = new Date(trimmed);
26
+ if (!/\d{4}-\d{2}-\d{2}/.test(trimmed) || !Number.isFinite(at.getTime())) {
27
+ throw new Error(`--expires takes an ISO date-time or a length such as 30m, 4h, 2d: ${value}`);
28
+ }
29
+ return at.toISOString();
30
+ }
31
+ const OPTION_DESCRIPTION_RE = /^\s*(\d+)\s*=([\s\S]*)$/;
32
+ /**
33
+ * `--option-description <n>=<text>`: what choosing the `--option` at position
34
+ * `n` (counted from 1, as `--recommended` is) means. The position is explicit so
35
+ * a description can never land under another option, whatever the order of the
36
+ * flags; the text is everything after the first `=`. The result is aligned with
37
+ * the options, `''` where an option has none, or `undefined` when none was given.
38
+ */
39
+ function parseOptionDescriptions(values, optionCount) {
40
+ if (!values?.length)
41
+ return undefined;
42
+ if (!optionCount)
43
+ throw new Error('--option-description needs the --option it describes');
44
+ const descriptions = new Array(optionCount).fill('');
45
+ for (const value of values) {
46
+ const match = value.match(OPTION_DESCRIPTION_RE);
47
+ if (!match) {
48
+ throw new Error(`--option-description takes the option's position and what choosing it means, as 2="Billed every month, cancel any time": ${value}`);
49
+ }
50
+ const position = Number(match[1]);
51
+ if (position < 1 || position > optionCount) {
52
+ throw new Error(`--option-description names an --option by its position, from 1 to ${optionCount}: ${position}`);
53
+ }
54
+ if (descriptions[position - 1]) {
55
+ throw new Error(`--option-description describes option ${position} twice`);
56
+ }
57
+ const description = match[2].trim();
58
+ if (!description)
59
+ throw new Error(`--option-description ${position}= has no description`);
60
+ if (description.length > data_provider_1.TASK_HUMAN_INPUT_OPTION_DESCRIPTION_MAX) {
61
+ throw new Error(`--option-description takes at most ${data_provider_1.TASK_HUMAN_INPUT_OPTION_DESCRIPTION_MAX} characters (option ${position}'s is ${description.length}): say what choosing it means, and put the rest in --context`);
62
+ }
63
+ descriptions[position - 1] = description;
64
+ }
65
+ return descriptions;
66
+ }
67
+ /** The one question a `tasks ask` sends, with `--recommended` counted from 1 as it is shown. */
68
+ function buildAskBody(flags) {
69
+ const options = (flags.option || []).map((option) => option.trim()).filter(Boolean);
70
+ if (flags.recommended !== undefined) {
71
+ if (!options.length)
72
+ throw new Error('--recommended needs the --option it names');
73
+ if (flags.recommended < 1 || flags.recommended > options.length) {
74
+ throw new Error(`--recommended is the position of an --option, from 1 to ${options.length}: ${flags.recommended}`);
75
+ }
76
+ }
77
+ if (flags.multi && options.length < 2)
78
+ throw new Error('--multi needs at least two --option');
79
+ if (flags['no-free-text'] && !options.length) {
80
+ throw new Error('--no-free-text needs --option: the person must be able to answer');
81
+ }
82
+ const context = flags.context?.trim();
83
+ if (context && context.length > data_provider_1.TASK_HUMAN_INPUT_CONTEXT_MAX) {
84
+ throw new Error(`--context takes at most ${data_provider_1.TASK_HUMAN_INPUT_CONTEXT_MAX} characters (this one is ${context.length}): keep the evidence and the trade-off, and leave the rest on the task`);
85
+ }
86
+ const optionDescriptions = parseOptionDescriptions(flags['option-description'], options.length);
87
+ const expiresAt = parseAskExpiry(flags.expires);
88
+ return {
89
+ questions: [
90
+ {
91
+ prompt: flags.question.trim(),
92
+ ...(context ? { context } : {}),
93
+ ...(flags.header ? { header: flags.header.trim() } : {}),
94
+ ...(options.length ? { options } : {}),
95
+ ...(optionDescriptions ? { optionDescriptions } : {}),
96
+ ...(flags.recommended !== undefined ? { recommendedIndex: flags.recommended - 1 } : {}),
97
+ ...(flags.multi ? { multiSelect: true } : {}),
98
+ ...(flags['no-free-text'] ? { allowFreeText: false } : {}),
99
+ },
100
+ ],
101
+ ...(expiresAt ? { expiresAt } : {}),
102
+ ...(flags.key ? { askKey: flags.key } : {}),
103
+ };
104
+ }
105
+ class TasksAsk extends base_command_1.BaseCommand {
106
+ static description = 'Ask a person one question on a task, outside any run. The task keeps the question until it is answered, expires or is dismissed; the answer starts nothing and is read with `tasks input show --request <id> --wait`';
107
+ static examples = [
108
+ '<%= config.bin %> tasks ask OSK-42 --question "Lead the pricing page with annual or monthly prices?" --option Annual --option Monthly --recommended 1 --context "Annual-first lifted team-plan signups 11% in the last test; monthly-first tested better with solo users."',
109
+ '<%= config.bin %> tasks ask OSK-42 --question "Which plan should the trial default to?" --option Team --option Solo --option-description 1="Five seats, billed yearly" --option-description 2="One seat, billed monthly"',
110
+ '<%= config.bin %> tasks ask OSK-42 --question "Is staging safe to reset?" --expires 4h --key reset-staging',
111
+ ];
112
+ static args = {
113
+ id: core_1.Args.string({ description: 'Task ID/ref', required: true, ignoreStdin: true }),
114
+ };
115
+ static flags = {
116
+ question: core_1.Flags.string({
117
+ description: 'The question, in one line of 140 characters or fewer. Put the background in --context',
118
+ required: true,
119
+ }),
120
+ context: core_1.Flags.string({
121
+ description: `What the person needs to know to answer: the evidence, the trade-off, why you recommend what you recommend (${data_provider_1.TASK_HUMAN_INPUT_CONTEXT_MAX} characters). Shown beneath the question; the choices go in --option`,
122
+ }),
123
+ option: core_1.Flags.string({ description: 'A choice (repeatable, in order)', multiple: true }),
124
+ 'option-description': core_1.Flags.string({
125
+ description: `What choosing an --option means, as <position>=<text> counting from 1 (repeatable; ${data_provider_1.TASK_HUMAN_INPUT_OPTION_DESCRIPTION_MAX} characters each). Shown with that option`,
126
+ multiple: true,
127
+ }),
128
+ recommended: core_1.Flags.integer({
129
+ description: 'The --option you recommend, by its position counting from 1',
130
+ }),
131
+ multi: core_1.Flags.boolean({ description: 'More than one option may be chosen' }),
132
+ header: core_1.Flags.string({ description: 'A short label for the question (80 characters)' }),
133
+ 'no-free-text': core_1.Flags.boolean({ description: 'Only the options may be chosen, not words' }),
134
+ expires: core_1.Flags.string({
135
+ description: "When it stops waiting: an ISO date-time or 30m, 4h, 2d (default and maximum: the workspace's policy)",
136
+ }),
137
+ key: core_1.Flags.string({
138
+ description: 'Your key for this question: the same key returns the same question, and names only one',
139
+ }),
140
+ json: core_1.Flags.boolean({ description: 'Output as JSON' }),
141
+ };
142
+ async run() {
143
+ this.requireAuth();
144
+ const { args, flags } = await this.parse(TasksAsk);
145
+ let body;
146
+ try {
147
+ body = buildAskBody(flags);
148
+ }
149
+ catch (err) {
150
+ this.failWithCliError({
151
+ message: err.message,
152
+ code: 'TASK_HUMAN_INPUT_ASK_INVALID',
153
+ exit: 2,
154
+ retryable: false,
155
+ });
156
+ }
157
+ const taskId = await this.resolveTaskReference(args.id);
158
+ let response;
159
+ try {
160
+ response = await data_provider_1.dataService.askTaskHumanInput(taskId, body);
161
+ }
162
+ catch (err) {
163
+ this.handleApiError(err);
164
+ }
165
+ if (flags.json) {
166
+ this.log(JSON.stringify(response, null, 2));
167
+ return;
168
+ }
169
+ const request = response.data;
170
+ const route = (request.replyRoute?.kind || 'poll');
171
+ this.log(`${response.created ? 'Asked' : 'Already asked (same key)'} on ${args.id}: request ${request.requestId}`);
172
+ for (const question of request.questions) {
173
+ this.log(` ${question.header ? `${question.header}: ` : ''}${question.prompt}`);
174
+ for (const line of (0, show_1.humanInputContextLines)(question, ' '))
175
+ this.log(line);
176
+ const options = (0, show_1.humanInputOptionsLine)(question);
177
+ if (options)
178
+ this.log(` Options: ${options}`);
179
+ for (const line of (0, show_1.humanInputOptionDescriptionLines)(question, ' '))
180
+ this.log(line);
181
+ }
182
+ if (request.expiresAt)
183
+ this.log(` Expires: ${new Date(request.expiresAt).toISOString()}`);
184
+ this.log(data_provider_1.TASK_HUMAN_INPUT_REPLY_ROUTE_LABELS[route]);
185
+ this.log(`Read the answer: ${this.config.bin} tasks input show ${args.id} --request ${request.requestId} --wait`);
186
+ if (response.advice?.tip)
187
+ this.log(`Tip for your next question: ${response.advice.tip}`);
188
+ }
189
+ }
190
+ exports.default = TasksAsk;
@@ -8,6 +8,7 @@ const code_handover_1 = require("../../lib/code-handover");
8
8
  const task_extras_1 = require("../../lib/task-extras");
9
9
  const task_resolver_1 = require("../../lib/task-resolver");
10
10
  const format_1 = require("../../lib/format");
11
+ const handover_interview_1 = require("../../lib/handover-interview");
11
12
  /**
12
13
  * `skrr tasks handover` — continue a task's work under a different agent or a
13
14
  * different execution target, from where a finished run left off.
@@ -25,6 +26,11 @@ const format_1 = require("../../lib/format");
25
26
  * What does not move is declared, not implied: the response's `packet.notCarried`
26
27
  * names what stayed behind (provider session, agent-private memory, local
27
28
  * machine state) and is printed verbatim rather than paraphrased.
29
+ *
30
+ * Beside it, never in it: the previous owner's handover notes (§4.8). When another
31
+ * agent takes over, the server asks the previous one once, briefly, what the record
32
+ * does not say; the response carries where that stands (`interview`), and
33
+ * `skrr tasks runs` prints the notes once they arrive.
28
34
  */
29
35
  /** The run statuses from which a handover can source a Resume Point. */
30
36
  const HANDOVER_SOURCE_RUN_STATUSES = new Set([
@@ -201,6 +207,14 @@ class TasksHandover extends base_command_1.BaseCommand {
201
207
  ? r.packet.notCarried.map(String).filter(Boolean)
202
208
  : [];
203
209
  this.log(`Not carried: ${notCarried.length ? notCarried.join(', ') : '(nothing declared)'}`);
210
+ const interviewLines = (0, handover_interview_1.renderHandoverInterview)(r.interview ?? newRun.handoverInterview);
211
+ if (interviewLines.length) {
212
+ for (const line of interviewLines)
213
+ this.log(line);
214
+ if (r.interview?.state === 'pending') {
215
+ this.log(` Read them with \`${this.config.bin} tasks runs ${taskId}\` once they arrive.`);
216
+ }
217
+ }
204
218
  }
205
219
  }
206
220
  exports.default = TasksHandover;
@@ -16,7 +16,7 @@ function parseAnswers(values) {
16
16
  });
17
17
  }
18
18
  class TasksInputAnswer extends base_command_1.BaseCommand {
19
- static description = 'Answer an open Human-input request and start the next exchange';
19
+ static description = 'Answer an open Human-input request. A Run-carried question starts the next exchange; a question asked outside a Run is answered in place';
20
20
  static args = {
21
21
  id: core_1.Args.string({ description: 'Task ID/ref', required: true, ignoreStdin: true }),
22
22
  };
@@ -64,8 +64,14 @@ class TasksInputAnswer extends base_command_1.BaseCommand {
64
64
  }
65
65
  if (flags.json)
66
66
  this.log(JSON.stringify(result, null, 2));
67
- else
67
+ else if ('exchangeId' in result && result.exchangeId)
68
68
  this.log(`Answered Human-input request ${requestId}; exchange ${result.exchangeId} started.`);
69
+ else
70
+ // A question asked outside a Run: answered in place, nothing starts.
71
+ this.log(`Answered Human-input request ${requestId}. ` +
72
+ (('replyRoute' in result &&
73
+ data_provider_1.TASK_HUMAN_INPUT_REPLY_ROUTE_LABELS[result.replyRoute]) ||
74
+ ''));
69
75
  }
70
76
  }
71
77
  exports.default = TasksInputAnswer;
@@ -1,11 +1,37 @@
1
+ import { type TaskHumanInputQuestion, type TaskHumanInputRequest } from '@skrr-ai/data-provider';
1
2
  import { BaseCommand } from '../../../base-command';
3
+ /**
4
+ * A question's options as one line, the asker's recommendation marked. Marked,
5
+ * never chosen: the person (or the agent answering for them) still picks.
6
+ */
7
+ export declare function humanInputOptionsLine(question: Pick<TaskHumanInputQuestion, 'options' | 'recommendedIndex'>): string | null;
8
+ /**
9
+ * A question's background, under the question it explains: each of its lines
10
+ * indented by `indent`, so a context of several lines stays one block.
11
+ */
12
+ export declare function humanInputContextLines(question: Pick<TaskHumanInputQuestion, 'context'>, indent: string): string[];
13
+ /**
14
+ * What each option means, one line per described option, under the options
15
+ * line and indented by `indent`: `Annual: billed once a year`. An option with
16
+ * no description gets no line.
17
+ */
18
+ export declare function humanInputOptionDescriptionLines(question: Pick<TaskHumanInputQuestion, 'options' | 'optionDescriptions'>, indent: string): string[];
19
+ /** `--timeout` for `--wait`: 90s, 10m, 2h (a bare number is seconds). */
20
+ export declare function parseWaitTimeoutMs(value: string | undefined): number | null;
21
+ /** Each answer as the asker reads it, beside the question it answers. */
22
+ export declare function humanInputAnswerLines(request: TaskHumanInputRequest): string[];
2
23
  export default class TasksInputShow extends BaseCommand {
3
24
  static description: string;
25
+ static examples: string[];
4
26
  static args: {
5
27
  id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
6
28
  };
7
29
  static flags: {
8
30
  json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
31
+ request: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
32
+ wait: import("@oclif/core/interfaces").BooleanFlag<boolean>;
33
+ timeout: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
34
+ interval: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
35
  };
10
36
  run(): Promise<void>;
11
37
  }