@skrr-ai/cli 0.1.206 → 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 (155) 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/models.d.ts +11 -0
  29. package/dist/commands/agents/models.js +51 -0
  30. package/dist/commands/agents/shared-memory.d.ts +24 -0
  31. package/dist/commands/agents/shared-memory.js +67 -0
  32. package/dist/commands/agents/visibility.d.ts +1 -0
  33. package/dist/commands/agents/visibility.js +14 -0
  34. package/dist/commands/balance/route-premiums.d.ts +9 -0
  35. package/dist/commands/balance/route-premiums.js +33 -0
  36. package/dist/commands/code/migrate.js +3 -1
  37. package/dist/commands/convos/transcript.d.ts +0 -1
  38. package/dist/commands/convos/transcript.js +0 -1
  39. package/dist/commands/duties/advance-next.js +15 -6
  40. package/dist/commands/followups/show.js +9 -0
  41. package/dist/commands/followups/watch-pr.d.ts +27 -0
  42. package/dist/commands/followups/watch-pr.js +123 -0
  43. package/dist/commands/goals/create.d.ts +1 -0
  44. package/dist/commands/goals/create.js +8 -0
  45. package/dist/commands/goals/creation-receipt.d.ts +10 -0
  46. package/dist/commands/goals/creation-receipt.js +43 -0
  47. package/dist/commands/goals/key-results/create.d.ts +2 -0
  48. package/dist/commands/goals/key-results/create.js +14 -0
  49. package/dist/commands/goals/key-results/creation-receipt.d.ts +13 -0
  50. package/dist/commands/goals/key-results/creation-receipt.js +51 -0
  51. package/dist/commands/harnesses/forget.d.ts +2 -0
  52. package/dist/commands/harnesses/forget.js +31 -0
  53. package/dist/commands/harnesses/removal-receipt.d.ts +11 -0
  54. package/dist/commands/harnesses/removal-receipt.js +32 -0
  55. package/dist/commands/harnesses/removal-review.d.ts +11 -0
  56. package/dist/commands/harnesses/removal-review.js +28 -0
  57. package/dist/commands/memory/consolidation/index.d.ts +20 -0
  58. package/dist/commands/memory/consolidation/index.js +78 -0
  59. package/dist/commands/memory/consolidation/resume.d.ts +14 -0
  60. package/dist/commands/memory/consolidation/resume.js +46 -0
  61. package/dist/commands/memory/consolidation/undo.d.ts +18 -0
  62. package/dist/commands/memory/consolidation/undo.js +60 -0
  63. package/dist/commands/slack/mutes.d.ts +10 -0
  64. package/dist/commands/slack/mutes.js +62 -0
  65. package/dist/commands/slack/unmute.d.ts +12 -0
  66. package/dist/commands/slack/unmute.js +44 -0
  67. package/dist/commands/spaces/loops/release-receipt.d.ts +14 -0
  68. package/dist/commands/spaces/loops/release-receipt.js +48 -0
  69. package/dist/commands/spaces/loops/release.js +1 -1
  70. package/dist/commands/spaces/workflow-templates/archive.d.ts +1 -0
  71. package/dist/commands/spaces/workflow-templates/archive.js +9 -1
  72. package/dist/commands/spaces/workflow-templates/show.js +2 -0
  73. package/dist/commands/spaces/workflow-templates/update.d.ts +1 -0
  74. package/dist/commands/spaces/workflow-templates/update.js +12 -1
  75. package/dist/commands/spaces/workflows/publish.d.ts +1 -0
  76. package/dist/commands/spaces/workflows/publish.js +41 -2
  77. package/dist/commands/tasks/actionability.js +9 -0
  78. package/dist/commands/tasks/ask.d.ts +50 -0
  79. package/dist/commands/tasks/ask.js +190 -0
  80. package/dist/commands/tasks/create.d.ts +2 -0
  81. package/dist/commands/tasks/create.js +19 -6
  82. package/dist/commands/tasks/creation-receipt.d.ts +12 -0
  83. package/dist/commands/tasks/creation-receipt.js +53 -0
  84. package/dist/commands/tasks/delete.d.ts +1 -0
  85. package/dist/commands/tasks/delete.js +22 -4
  86. package/dist/commands/tasks/deletion-receipt.d.ts +12 -0
  87. package/dist/commands/tasks/deletion-receipt.js +37 -0
  88. package/dist/commands/tasks/handover.js +14 -0
  89. package/dist/commands/tasks/input/answer.js +8 -2
  90. package/dist/commands/tasks/input/show.d.ts +26 -0
  91. package/dist/commands/tasks/input/show.js +185 -17
  92. package/dist/commands/tasks/move.d.ts +11 -0
  93. package/dist/commands/tasks/move.js +82 -1
  94. package/dist/commands/tasks/result/submit.js +3 -0
  95. package/dist/commands/tasks/runs.d.ts +4 -1
  96. package/dist/commands/tasks/runs.js +22 -3
  97. package/dist/commands/tasks/show.js +22 -1
  98. package/dist/commands/tasks/update.d.ts +1 -0
  99. package/dist/commands/tasks/update.js +52 -1
  100. package/dist/commands/tasks/updates/add.js +3 -0
  101. package/dist/commands/tasks/wait.d.ts +20 -0
  102. package/dist/commands/tasks/wait.js +102 -1
  103. package/dist/generated/agent-guides.json +501 -92
  104. package/dist/generated/managed-instruction-guides.json +1 -1
  105. package/dist/lib/agent-access-command.d.ts +19 -0
  106. package/dist/lib/agent-access-command.js +44 -0
  107. package/dist/lib/agent-access.d.ts +18 -0
  108. package/dist/lib/agent-access.js +48 -0
  109. package/dist/lib/agent-import/apply.d.ts +50 -0
  110. package/dist/lib/agent-import/apply.js +85 -0
  111. package/dist/lib/agent-import/plan.d.ts +132 -0
  112. package/dist/lib/agent-import/plan.js +504 -0
  113. package/dist/lib/agent-import/reader.d.ts +94 -0
  114. package/dist/lib/agent-import/reader.js +326 -0
  115. package/dist/lib/agent-import/schedule.d.ts +46 -0
  116. package/dist/lib/agent-import/schedule.js +220 -0
  117. package/dist/lib/agent-import/sources.d.ts +124 -0
  118. package/dist/lib/agent-import/sources.js +797 -0
  119. package/dist/lib/execution-target.d.ts +1 -1
  120. package/dist/lib/execution-target.js +4 -0
  121. package/dist/lib/followups.d.ts +61 -0
  122. package/dist/lib/followups.js +39 -0
  123. package/dist/lib/handover-interview.d.ts +18 -0
  124. package/dist/lib/handover-interview.js +53 -0
  125. package/dist/lib/harnesses.d.ts +25 -0
  126. package/dist/lib/harnesses.js +15 -0
  127. package/dist/lib/input-queue.js +2 -1
  128. package/dist/lib/intuition-look.d.ts +10 -0
  129. package/dist/lib/intuition-look.js +64 -0
  130. package/dist/lib/record-output.d.ts +1 -1
  131. package/dist/lib/record-output.js +2 -0
  132. package/dist/lib/request-uuid.d.ts +2 -0
  133. package/dist/lib/request-uuid.js +10 -0
  134. package/dist/lib/skill-import.d.ts +19 -0
  135. package/dist/lib/skill-import.js +34 -0
  136. package/dist/lib/slack-thread-mutes.d.ts +25 -0
  137. package/dist/lib/slack-thread-mutes.js +12 -0
  138. package/dist/lib/task-carriers.d.ts +18 -0
  139. package/dist/lib/task-carriers.js +43 -0
  140. package/dist/lib/task-extras.d.ts +5 -0
  141. package/dist/lib/task-extras.js +5 -0
  142. package/dist/lib/task-recurrence-summary.d.ts +15 -0
  143. package/dist/lib/task-recurrence-summary.js +22 -0
  144. package/dist/lib/task-version.d.ts +44 -0
  145. package/dist/lib/task-version.js +73 -0
  146. package/dist/lib/task-write-attribution.d.ts +7 -0
  147. package/dist/lib/task-write-attribution.js +14 -0
  148. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/turnPacing.d.ts +75 -0
  149. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/turnPacing.js +124 -0
  150. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/turnPacing.d.ts +75 -0
  151. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/turnPacing.js +141 -0
  152. package/dist/node_modules/@skrr-ai/auth-core/package.json +10 -0
  153. package/dist/node_modules/@skrr-ai/data-provider/index.js +13350 -12579
  154. package/oclif.manifest.json +3044 -563
  155. package/package.json +5 -2
@@ -11,6 +11,7 @@ const data_provider_1 = require("@skrr-ai/data-provider");
11
11
  const base_command_1 = require("../../base-command");
12
12
  const label_ref_1 = require("../../lib/label-ref");
13
13
  const prompt_1 = require("../../lib/prompt");
14
+ const request_uuid_1 = require("../../lib/request-uuid");
14
15
  const tasks_1 = require("../../lib/tasks");
15
16
  const task_instruction_offer_1 = require("../../lib/task-instruction-offer");
16
17
  const list_workspace_1 = require("../../lib/list-workspace");
@@ -187,6 +188,10 @@ class TasksCreate extends base_command_1.BaseCommand {
187
188
  'external-key': core_1.Flags.string({
188
189
  description: 'Stable caller-supplied idempotency key for create/upsert workflows',
189
190
  }),
191
+ 'request-id': core_1.Flags.string({
192
+ description: 'UUID for this exact create payload, recoverable with `tasks creation-receipt`',
193
+ parse: request_uuid_1.parseRequestUuid,
194
+ }),
190
195
  'default-agent': core_1.Flags.string({
191
196
  description: 'Override the automatic assignee with an Agent (it becomes the assignee that runs the task; ' +
192
197
  '--assignee-agent names one directly). Use "auto" to inherit the space lead ' +
@@ -467,7 +472,7 @@ class TasksCreate extends base_command_1.BaseCommand {
467
472
  }
468
473
  let instantiated;
469
474
  try {
470
- instantiated = (await data_provider_1.dataService.createTask(payload));
475
+ instantiated = (await this.sendCreateRequest(payload, flags['request-id']));
471
476
  }
472
477
  catch (err) {
473
478
  this.failTaskCreate(err, payload, flags.goal !== undefined);
@@ -595,7 +600,7 @@ class TasksCreate extends base_command_1.BaseCommand {
595
600
  let created;
596
601
  let createRecovery;
597
602
  try {
598
- const result = await this.createTaskOrRecover(payload);
603
+ const result = await this.createTaskOrRecover(payload, flags['request-id']);
599
604
  created = result.task;
600
605
  createRecovery = result.recovery;
601
606
  }
@@ -622,7 +627,9 @@ class TasksCreate extends base_command_1.BaseCommand {
622
627
  /* non-JSON body carries no code */
623
628
  }
624
629
  }
625
- if (!(defaultAgentResolution.applied && failureCode === 'ASSIGNEE_NOT_IN_SPACE')) {
630
+ // A caller who pins a request ID must be able to recover the exact original body.
631
+ if (flags['request-id'] ||
632
+ !(defaultAgentResolution.applied && failureCode === 'ASSIGNEE_NOT_IN_SPACE')) {
626
633
  this.failTaskCreate(err, payload, flags.goal !== undefined);
627
634
  }
628
635
  delete payload.assigneeAgentIds;
@@ -736,15 +743,21 @@ class TasksCreate extends base_command_1.BaseCommand {
736
743
  }
737
744
  this.handleApiError(err);
738
745
  }
739
- async createTaskOrRecover(payload) {
746
+ sendCreateRequest(payload, requestId) {
747
+ const data = payload;
748
+ return requestId
749
+ ? data_provider_1.dataService.createTask(data, { idempotencyKey: requestId })
750
+ : data_provider_1.dataService.createTask(data);
751
+ }
752
+ async createTaskOrRecover(payload, requestId) {
740
753
  try {
741
754
  return {
742
- task: await data_provider_1.dataService.createTask(payload),
755
+ task: await this.sendCreateRequest(payload, requestId),
743
756
  };
744
757
  }
745
758
  catch (error) {
746
759
  const externalKey = typeof payload.externalKey === 'string' ? payload.externalKey.trim() : '';
747
- if (!externalKey || !taskCreateMayHaveCommitted(error))
760
+ if (requestId || !externalKey || !taskCreateMayHaveCommitted(error))
748
761
  throw error;
749
762
  try {
750
763
  const existing = await (0, tasks_1.findTaskByExternalKey)({
@@ -0,0 +1,12 @@
1
+ import { BaseCommand } from '../../base-command';
2
+ export default class TasksCreationReceipt extends BaseCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ 'request-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
7
+ 'from-json': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
8
+ 'create-and-start': import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
+ };
11
+ run(): Promise<void>;
12
+ }
@@ -0,0 +1,53 @@
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 prompt_1 = require("../../lib/prompt");
7
+ const request_uuid_1 = require("../../lib/request-uuid");
8
+ class TasksCreationReceipt extends base_command_1.BaseCommand {
9
+ static description = 'Check whether the original Task creation request completed';
10
+ static examples = [
11
+ '<%= config.bin %> tasks creation-receipt --request-id <uuid> --from-json payload.json --workspace <workspace-id>',
12
+ ];
13
+ static flags = {
14
+ 'request-id': core_1.Flags.string({
15
+ description: 'UUID used for the original create request', required: true, parse: request_uuid_1.parseRequestUuid,
16
+ }),
17
+ 'from-json': core_1.Flags.string({
18
+ description: 'Original request body, such as .payload from `tasks create --dry-run --json` ("-" for stdin)',
19
+ required: true,
20
+ }),
21
+ 'create-and-start': core_1.Flags.boolean({ description: 'Look up a combined create-and-start request' }),
22
+ json: core_1.Flags.boolean({ description: 'Output the receipt as JSON' }),
23
+ };
24
+ async run() {
25
+ this.requireAuth();
26
+ const { flags } = await this.parse(TasksCreationReceipt);
27
+ let payload;
28
+ try {
29
+ payload = await (0, prompt_1.readJsonBody)(flags['from-json']);
30
+ }
31
+ catch (error) {
32
+ this.error(error.message, { exit: 2 });
33
+ }
34
+ try {
35
+ const receipt = await data_provider_1.dataService.getTaskCreationReceipt({
36
+ requestId: flags['request-id'],
37
+ payload,
38
+ ...(flags['create-and-start'] ? { action: 'create-and-start' } : {}),
39
+ });
40
+ if (flags.json)
41
+ return this.printJsonResult(receipt);
42
+ if (receipt.state === 'unknown')
43
+ return this.log('The server could not confirm that Task creation.');
44
+ this.log(`Created Task ${receipt.taskId}.`);
45
+ if (receipt.started !== undefined)
46
+ this.log(`Start accepted: ${receipt.started ? 'yes' : 'no'}`);
47
+ }
48
+ catch (error) {
49
+ this.handleApiError(error, { subject: 'Task creation receipt' });
50
+ }
51
+ }
52
+ }
53
+ exports.default = TasksCreationReceipt;
@@ -8,6 +8,7 @@ export default class TasksDelete extends BaseCommand {
8
8
  static flags: {
9
9
  yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
10
  json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ 'deletion-command-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
12
  };
12
13
  run(): Promise<void>;
13
14
  }
@@ -4,6 +4,7 @@ const core_1 = require("@oclif/core");
4
4
  const data_provider_1 = require("@skrr-ai/data-provider");
5
5
  const base_command_1 = require("../../base-command");
6
6
  const prompt_1 = require("../../lib/prompt");
7
+ const request_uuid_1 = require("../../lib/request-uuid");
7
8
  class TasksDelete extends base_command_1.BaseCommand {
8
9
  static description = 'Delete a task (irreversible)';
9
10
  static examples = [
@@ -20,11 +21,15 @@ class TasksDelete extends base_command_1.BaseCommand {
20
21
  // CLI_PARSE_ERROR, so a loop that discarded output — the normal shape for a
21
22
  // cleanup loop — deleted nothing and reported nothing.
22
23
  json: core_1.Flags.boolean({ description: 'Output as JSON' }),
24
+ 'deletion-command-id': core_1.Flags.string({
25
+ description: 'UUID for this deletion, recoverable with `tasks deletion-receipt`',
26
+ parse: request_uuid_1.parseRequestUuid,
27
+ }),
23
28
  };
24
29
  async run() {
25
30
  this.requireAuth();
26
31
  const { args, flags } = await this.parse(TasksDelete);
27
- const taskId = await this.resolveEntityRef('task', args.id);
32
+ let taskId = await this.resolveEntityRef('task', args.id);
28
33
  let confirmed;
29
34
  try {
30
35
  confirmed = await (0, prompt_1.confirmDestructive)(`Delete task ${taskId === args.id ? taskId : `${args.id} (${taskId})`}? This cannot be undone.`, flags.yes);
@@ -41,14 +46,27 @@ class TasksDelete extends base_command_1.BaseCommand {
41
46
  this.log('Cancelled.');
42
47
  return;
43
48
  }
49
+ const deletionCommandId = flags['deletion-command-id'];
44
50
  try {
45
- await data_provider_1.dataService.deleteTask(taskId);
51
+ if (deletionCommandId) {
52
+ const task = await data_provider_1.dataService.getTask(taskId);
53
+ if (!task.id)
54
+ throw new Error('The Task lookup returned no canonical ID.');
55
+ taskId = task.id;
56
+ this.logToStderr(`Check the deletion in the same workspace with ${this.config.bin} tasks deletion-receipt ${taskId} --deletion-command-id ${deletionCommandId}`);
57
+ await data_provider_1.dataService.deleteTask(taskId, { deletionCommandId });
58
+ }
59
+ else {
60
+ await data_provider_1.dataService.deleteTask(taskId);
61
+ }
46
62
  }
47
63
  catch (err) {
48
64
  this.handleApiError(err);
49
65
  }
50
- if (flags.json)
51
- return this.log(JSON.stringify({ deleted: true, id: taskId }, null, 2));
66
+ if (flags.json) {
67
+ const result = { deleted: true, id: taskId, ...(deletionCommandId ? { deletionCommandId } : {}) };
68
+ return this.log(JSON.stringify(result, null, 2));
69
+ }
52
70
  this.log(`Deleted task ${args.id}`);
53
71
  }
54
72
  }
@@ -0,0 +1,12 @@
1
+ import { BaseCommand } from '../../base-command';
2
+ export default class TasksDeletionReceipt extends BaseCommand {
3
+ static description: string;
4
+ static args: {
5
+ canonicalTaskId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
6
+ };
7
+ static flags: {
8
+ 'deletion-command-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
9
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
+ };
11
+ run(): Promise<void>;
12
+ }
@@ -0,0 +1,37 @@
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 request_uuid_1 = require("../../lib/request-uuid");
7
+ class TasksDeletionReceipt extends base_command_1.BaseCommand {
8
+ static description = 'Check the durable receipt for one Task deletion';
9
+ static args = {
10
+ canonicalTaskId: core_1.Args.string({
11
+ description: 'Original canonical Task ID from `tasks delete`', required: true, ignoreStdin: true,
12
+ parse: request_uuid_1.parseRequestUuid,
13
+ }),
14
+ };
15
+ static flags = {
16
+ 'deletion-command-id': core_1.Flags.string({
17
+ description: 'Original deletion UUID', required: true, parse: request_uuid_1.parseRequestUuid,
18
+ }),
19
+ json: core_1.Flags.boolean({ description: 'Output the receipt as JSON' }),
20
+ };
21
+ async run() {
22
+ this.requireAuth();
23
+ const { args, flags } = await this.parse(TasksDeletionReceipt);
24
+ try {
25
+ const receipt = await data_provider_1.dataService.getTaskDeletionReceipt(args.canonicalTaskId, flags['deletion-command-id']);
26
+ if (flags.json)
27
+ return this.printJsonResult(receipt);
28
+ this.log(receipt.state === 'deleted'
29
+ ? `Deletion is recorded for Task ${args.canonicalTaskId}.`
30
+ : `The server could not confirm deletion of Task ${args.canonicalTaskId}.`);
31
+ }
32
+ catch (error) {
33
+ this.handleApiError(error, { subject: `Task ${args.canonicalTaskId} deletion receipt` });
34
+ }
35
+ }
36
+ }
37
+ exports.default = TasksDeletionReceipt;
@@ -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
  }
@@ -1,38 +1,206 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.humanInputOptionsLine = humanInputOptionsLine;
4
+ exports.humanInputContextLines = humanInputContextLines;
5
+ exports.humanInputOptionDescriptionLines = humanInputOptionDescriptionLines;
6
+ exports.parseWaitTimeoutMs = parseWaitTimeoutMs;
7
+ exports.humanInputAnswerLines = humanInputAnswerLines;
3
8
  const core_1 = require("@oclif/core");
4
9
  const data_provider_1 = require("@skrr-ai/data-provider");
5
10
  const base_command_1 = require("../../../base-command");
11
+ const task_execution_1 = require("../../../lib/task-execution");
12
+ const WAIT_DURATION_RE = /^(\d+)\s*(s|m|h)?$/i;
13
+ /**
14
+ * A question's options as one line, the asker's recommendation marked. Marked,
15
+ * never chosen: the person (or the agent answering for them) still picks.
16
+ */
17
+ function humanInputOptionsLine(question) {
18
+ if (!question.options?.length)
19
+ return null;
20
+ return question.options
21
+ .map((option, position) => position === question.recommendedIndex ? `${option} (recommended)` : option)
22
+ .join(', ');
23
+ }
24
+ /**
25
+ * A question's background, under the question it explains: each of its lines
26
+ * indented by `indent`, so a context of several lines stays one block.
27
+ */
28
+ function humanInputContextLines(question, indent) {
29
+ if (!question.context?.trim())
30
+ return [];
31
+ return question.context
32
+ .trim()
33
+ .split(/\r?\n/)
34
+ .map((line) => `${indent}${line}`);
35
+ }
36
+ /**
37
+ * What each option means, one line per described option, under the options
38
+ * line and indented by `indent`: `Annual: billed once a year`. An option with
39
+ * no description gets no line.
40
+ */
41
+ function humanInputOptionDescriptionLines(question, indent) {
42
+ if (!question.options?.length || !question.optionDescriptions?.length)
43
+ return [];
44
+ return question.options.flatMap((option, position) => {
45
+ const description = question.optionDescriptions?.[position]?.replace(/\s+/g, ' ').trim();
46
+ return description ? [`${indent}${option}: ${description}`] : [];
47
+ });
48
+ }
49
+ /** `--timeout` for `--wait`: 90s, 10m, 2h (a bare number is seconds). */
50
+ function parseWaitTimeoutMs(value) {
51
+ if (value === undefined)
52
+ return null;
53
+ const match = value.trim().match(WAIT_DURATION_RE);
54
+ if (!match)
55
+ throw new Error(`--timeout takes a length such as 90s, 10m, 2h: ${value}`);
56
+ const unit = (match[2] || 's').toLowerCase();
57
+ return Number(match[1]) * (unit === 'h' ? 3_600_000 : unit === 'm' ? 60_000 : 1000);
58
+ }
59
+ /** Each answer as the asker reads it, beside the question it answers. */
60
+ function humanInputAnswerLines(request) {
61
+ const lines = [];
62
+ for (const [index, question] of request.questions.entries()) {
63
+ lines.push(`${index + 1}. ${question.header ? `${question.header}: ` : ''}${question.prompt}`);
64
+ lines.push(...humanInputContextLines(question, ' '));
65
+ const options = humanInputOptionsLine(question);
66
+ if (options)
67
+ lines.push(` Options: ${options}`);
68
+ lines.push(...humanInputOptionDescriptionLines(question, ' '));
69
+ const answer = request.answers?.find((a) => a.questionId === question.questionId);
70
+ if (answer) {
71
+ const value = [
72
+ ...(answer.selectedOptions || []),
73
+ ...(answer.freeText ? [answer.freeText] : []),
74
+ ]
75
+ .filter(Boolean)
76
+ .join(', ');
77
+ lines.push(` Answer: ${value}`);
78
+ }
79
+ }
80
+ return lines;
81
+ }
82
+ /** Seconds between reads while `--wait` polls the request. */
83
+ const DEFAULT_WAIT_INTERVAL_SECONDS = 5;
6
84
  class TasksInputShow extends base_command_1.BaseCommand {
7
- static description = 'Show the open Human-input request for a task';
85
+ static description = 'Show a Human-input request for a task: the open one, or one by id in any state with its answer (--request), waiting for it to be answered (--wait)';
86
+ static examples = [
87
+ '<%= config.bin %> tasks input show OSK-42',
88
+ '<%= config.bin %> tasks input show OSK-42 --request thi_... --wait --timeout 30m',
89
+ ];
8
90
  static args = {
9
91
  id: core_1.Args.string({ description: 'Task ID/ref', required: true, ignoreStdin: true }),
10
92
  };
11
- static flags = { json: core_1.Flags.boolean({ description: 'Output as JSON' }) };
93
+ static flags = {
94
+ json: core_1.Flags.boolean({ description: 'Output as JSON' }),
95
+ request: core_1.Flags.string({
96
+ description: 'A request by id, in any state, with its answer once there is one',
97
+ }),
98
+ wait: core_1.Flags.boolean({
99
+ description: 'Wait until the request is no longer open (answered, expired or dismissed); with no --request, the current open one',
100
+ }),
101
+ timeout: core_1.Flags.string({
102
+ description: 'With --wait, stop waiting after 90s, 10m, 2h (default: until it closes)',
103
+ dependsOn: ['wait'],
104
+ }),
105
+ // No `default:` here. oclif fills a flag's default in BEFORE it checks `dependsOn`,
106
+ // so a defaulted `--interval` always "depends on --wait" and refused every plain
107
+ // read (`tasks input show <task> --json` exited 2). The default lives in run().
108
+ interval: core_1.Flags.integer({
109
+ description: `With --wait, seconds between reads (default: ${DEFAULT_WAIT_INTERVAL_SECONDS})`,
110
+ dependsOn: ['wait'],
111
+ }),
112
+ };
12
113
  async run() {
13
114
  this.requireAuth();
14
115
  const { args, flags } = await this.parse(TasksInputShow);
15
116
  const taskId = await this.resolveTaskReference(args.id);
16
- let response;
117
+ if (!flags.request && !flags.wait) {
118
+ let response;
119
+ try {
120
+ response = await data_provider_1.dataService.getTaskHumanInput(taskId);
121
+ }
122
+ catch (err) {
123
+ this.handleApiError(err);
124
+ }
125
+ if (flags.json) {
126
+ this.log(JSON.stringify(response, null, 2));
127
+ return;
128
+ }
129
+ if (!response.data) {
130
+ this.log('No open Human-input request.');
131
+ return;
132
+ }
133
+ this.log(`Request: ${response.data.requestId}`);
134
+ for (const line of humanInputAnswerLines(response.data))
135
+ this.log(line);
136
+ return;
137
+ }
138
+ let timeoutMs = null;
17
139
  try {
18
- response = await data_provider_1.dataService.getTaskHumanInput(taskId);
140
+ timeoutMs = parseWaitTimeoutMs(flags.timeout);
19
141
  }
20
142
  catch (err) {
21
- this.handleApiError(err);
143
+ this.failWithCliError({
144
+ message: err.message,
145
+ code: 'TASK_HUMAN_INPUT_WAIT_TIMEOUT_INVALID',
146
+ exit: 2,
147
+ retryable: false,
148
+ });
22
149
  }
23
- if (flags.json) {
24
- this.log(JSON.stringify(response, null, 2));
25
- return;
26
- }
27
- if (!response.data) {
28
- this.log('No open Human-input request.');
29
- return;
150
+ let requestId = flags.request;
151
+ if (!requestId) {
152
+ // --wait on the current question: take its id now, so the answer can be
153
+ // read after it stops being the open one.
154
+ try {
155
+ requestId = (await data_provider_1.dataService.getTaskHumanInput(taskId)).data?.requestId;
156
+ }
157
+ catch (err) {
158
+ this.handleApiError(err);
159
+ }
160
+ if (!requestId)
161
+ this.error('No open Human-input request exists for this task', { exit: 4 });
30
162
  }
31
- this.log(`Request: ${response.data.requestId}`);
32
- for (const [index, question] of response.data.questions.entries()) {
33
- this.log(`${index + 1}. ${question.header ? `${question.header}: ` : ''}${question.prompt}`);
34
- if (question.options?.length)
35
- this.log(` Options: ${question.options.join(', ')}`);
163
+ const startedAt = Date.now();
164
+ const intervalMs = Math.max(1, flags.interval ?? DEFAULT_WAIT_INTERVAL_SECONDS) * 1000;
165
+ let announced = false;
166
+ while (true) {
167
+ let request;
168
+ try {
169
+ request = (await data_provider_1.dataService.getTaskHumanInputRequest(taskId, requestId)).data;
170
+ }
171
+ catch (err) {
172
+ this.handleApiError(err);
173
+ }
174
+ if (!request)
175
+ this.error(`No Human-input request ${requestId} on this task`, { exit: 4 });
176
+ const open = request.status === 'open';
177
+ if (!flags.wait || !open) {
178
+ if (flags.json)
179
+ this.log(JSON.stringify({ data: request }, null, 2));
180
+ else {
181
+ this.log(`Request: ${request.requestId} (${request.status})`);
182
+ for (const line of humanInputAnswerLines(request))
183
+ this.log(line);
184
+ }
185
+ // Waiting ends in one of three ways, and only an answer is the one
186
+ // the waiter asked for.
187
+ if (flags.wait && request.status !== 'answered')
188
+ this.exit(1);
189
+ return;
190
+ }
191
+ if (timeoutMs !== null && Date.now() - startedAt >= timeoutMs) {
192
+ this.failWithCliError({
193
+ message: `Request ${requestId} is still open after ${flags.timeout}.`,
194
+ code: 'TASK_HUMAN_INPUT_WAIT_TIMEOUT',
195
+ exit: 124,
196
+ retryable: true,
197
+ });
198
+ }
199
+ if (!announced && !flags.json) {
200
+ this.log(`Waiting for an answer to ${requestId}...`);
201
+ announced = true;
202
+ }
203
+ await (0, task_execution_1.sleep)(intervalMs);
36
204
  }
37
205
  }
38
206
  }
@@ -1,4 +1,14 @@
1
1
  import { BaseCommand } from '../../base-command';
2
+ /**
3
+ * The notice for a Task moved into review that no Review is owed for.
4
+ *
5
+ * Review is where a Review the Task's own `reviewPolicy` requires is waited
6
+ * for. Under `none` (the default) nobody owes one, so a Task parked there
7
+ * waits on a person who was never asked: thousands sat in review that way
8
+ * (OSK-33196). The move still lands; this says what it means, at the moment
9
+ * an agent made it.
10
+ */
11
+ export declare function unowedReviewNotice(task: unknown, bin: string): string | null;
2
12
  /**
3
13
  * `tasks move` is the documented way to change a task's status. The data
4
14
  * provider's `TaskUpdateParams` (used by `tasks update`) does not expose a
@@ -22,6 +32,7 @@ export default class TasksMove extends BaseCommand {
22
32
  reason: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
23
33
  'resolution-actor': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
24
34
  force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
35
+ 'expected-version': import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
25
36
  };
26
37
  run(): Promise<void>;
27
38
  /**