@skrr-ai/cli 0.1.208 → 0.1.209

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 (87) hide show
  1. package/dist/commands/agent/message/no-reply.js +1 -1
  2. package/dist/commands/agent/message/react.d.ts +23 -0
  3. package/dist/commands/agent/message/react.js +125 -0
  4. package/dist/commands/agent/message/resolve.js +1 -1
  5. package/dist/commands/agent/message/retract.js +1 -1
  6. package/dist/commands/agent/message/send.d.ts +8 -1
  7. package/dist/commands/agent/message/send.js +58 -4
  8. package/dist/commands/agents/access/approve.js +1 -1
  9. package/dist/commands/agents/access/deny.js +1 -1
  10. package/dist/commands/agents/access/list.js +3 -1
  11. package/dist/commands/agents/access/reach.js +1 -1
  12. package/dist/commands/agents/access/revoke.js +1 -1
  13. package/dist/commands/agents/always-on/recovery-review.d.ts +5 -0
  14. package/dist/commands/agents/always-on/recovery-review.js +16 -0
  15. package/dist/commands/agents/chat.d.ts +8 -0
  16. package/dist/commands/agents/chat.js +369 -90
  17. package/dist/commands/agents/import.js +3 -3
  18. package/dist/commands/agents/manager/status.js +7 -6
  19. package/dist/commands/agents/not-for-task.d.ts +24 -0
  20. package/dist/commands/agents/not-for-task.js +60 -0
  21. package/dist/commands/agents/schedule-overview.d.ts +20 -0
  22. package/dist/commands/agents/schedule-overview.js +35 -2
  23. package/dist/commands/agents/shared-memory.js +1 -1
  24. package/dist/commands/agents/stop.d.ts +23 -0
  25. package/dist/commands/agents/stop.js +61 -0
  26. package/dist/commands/agents/update.d.ts +7 -0
  27. package/dist/commands/agents/update.js +45 -2
  28. package/dist/commands/convos/messages.js +5 -0
  29. package/dist/commands/convos/transcript.js +2 -2
  30. package/dist/commands/daemon/logs.d.ts +3 -1
  31. package/dist/commands/daemon/logs.js +6 -2
  32. package/dist/commands/duties/advance-next.js +1 -1
  33. package/dist/commands/duties/preflight.js +17 -13
  34. package/dist/commands/followups/watch-pr.js +2 -1
  35. package/dist/commands/harnesses/evaluations/evidence.js +2 -2
  36. package/dist/commands/harnesses/evaluations/grant.js +1 -1
  37. package/dist/commands/harnesses/evaluations/revoke.js +1 -1
  38. package/dist/commands/harnesses/evaluations/show.js +1 -1
  39. package/dist/commands/harnesses/rollouts/grant.js +1 -1
  40. package/dist/commands/harnesses/rollouts/revoke.js +1 -1
  41. package/dist/commands/machines/hosted/identity-evaluations/revoke.js +1 -1
  42. package/dist/commands/machines/hosted/identity-evaluations/show.js +1 -1
  43. package/dist/commands/memory/consolidation/undo.js +1 -0
  44. package/dist/commands/messages/list.js +9 -1
  45. package/dist/commands/slack/mutes.js +1 -1
  46. package/dist/commands/slack/unmute.js +1 -1
  47. package/dist/commands/tasks/actionability.js +1 -0
  48. package/dist/commands/tasks/ask.js +1 -1
  49. package/dist/commands/tasks/bulk-update.js +12 -0
  50. package/dist/commands/tasks/input/show.js +2 -2
  51. package/dist/commands/tasks/list.d.ts +8 -0
  52. package/dist/commands/tasks/list.js +50 -9
  53. package/dist/commands/tasks/move.d.ts +2 -10
  54. package/dist/commands/tasks/move.js +7 -18
  55. package/dist/commands/tasks/result/show.js +19 -7
  56. package/dist/commands/tasks/show.d.ts +4 -3
  57. package/dist/commands/tasks/show.js +20 -8
  58. package/dist/commands/tasks/start.js +35 -16
  59. package/dist/commands/tasks/update.js +3 -0
  60. package/dist/commands/tasks/wait.js +2 -2
  61. package/dist/generated/agent-guides.json +433 -133
  62. package/dist/lib/chat-stop.d.ts +17 -0
  63. package/dist/lib/chat-stop.js +70 -0
  64. package/dist/lib/cloud-reply.d.ts +21 -0
  65. package/dist/lib/cloud-reply.js +52 -0
  66. package/dist/lib/duties.js +24 -4
  67. package/dist/lib/duty-ledgers.js +19 -2
  68. package/dist/lib/file-mime.js +8 -0
  69. package/dist/lib/inbound-messages.d.ts +156 -0
  70. package/dist/lib/inbound-messages.js +375 -0
  71. package/dist/lib/message-intent.d.ts +18 -2
  72. package/dist/lib/message-intent.js +23 -1
  73. package/dist/lib/preflight-copy.d.ts +16 -1
  74. package/dist/lib/preflight-copy.js +33 -1
  75. package/dist/lib/task-operations.d.ts +2 -0
  76. package/dist/lib/task-operations.js +28 -4
  77. package/dist/lib/task-preflight.js +1 -0
  78. package/dist/lib/task-review-notice.d.ts +21 -0
  79. package/dist/lib/task-review-notice.js +46 -0
  80. package/dist/lib/task-version.d.ts +9 -0
  81. package/dist/lib/task-version.js +16 -0
  82. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelopeBridge.js +6 -1
  83. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelopeBridge.js +45 -15
  84. package/dist/node_modules/@skrr-ai/auth-core/package.json +1 -1
  85. package/dist/node_modules/@skrr-ai/data-provider/index.js +11969 -11728
  86. package/oclif.manifest.json +290 -12
  87. package/package.json +6 -2
@@ -44,7 +44,7 @@ class AgentMessageNoReply extends base_command_1.BaseCommand {
44
44
  credential: (0, message_intent_1.sessionCredential)(sessionContext.token),
45
45
  body: { disposition: data_provider_1.TURN_REPLY_DISPOSITIONS[0] },
46
46
  });
47
- this.log(JSON.stringify(result, null, 2));
47
+ this.printJsonResult(result);
48
48
  }
49
49
  catch (error) {
50
50
  this.handleApiError(error);
@@ -0,0 +1,23 @@
1
+ import { BaseCommand } from '../../../base-command';
2
+ /**
3
+ * React to one of the owner's messages with an emoji, as the Agent (design §4.7, D5). A reaction
4
+ * is the lightest acknowledgement: "seen", "on it", "done", with no message to read. It replaces
5
+ * the Agent's earlier reaction to that message.
6
+ *
7
+ * Inside an interactive Agent session it reacts as that session's Agent. An unattended run is
8
+ * refused: nobody is there to acknowledge, so it sends a message instead. Outside a session the
9
+ * owner reacts as one of their Agents, named with `--agent`.
10
+ */
11
+ export default class AgentMessageReact extends BaseCommand {
12
+ static description: string;
13
+ static examples: string[];
14
+ static args: {
15
+ messageId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
16
+ emoji: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
17
+ };
18
+ static flags: {
19
+ agent: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
20
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
21
+ };
22
+ run(): Promise<void>;
23
+ }
@@ -0,0 +1,125 @@
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
+ const http_error_1 = require("../../../lib/http-error");
8
+ const inbound_messages_1 = require("../../../lib/inbound-messages");
9
+ const message_intent_1 = require("../../../lib/message-intent");
10
+ /**
11
+ * React to one of the owner's messages with an emoji, as the Agent (design §4.7, D5). A reaction
12
+ * is the lightest acknowledgement: "seen", "on it", "done", with no message to read. It replaces
13
+ * the Agent's earlier reaction to that message.
14
+ *
15
+ * Inside an interactive Agent session it reacts as that session's Agent. An unattended run is
16
+ * refused: nobody is there to acknowledge, so it sends a message instead. Outside a session the
17
+ * owner reacts as one of their Agents, named with `--agent`.
18
+ */
19
+ class AgentMessageReact extends base_command_1.BaseCommand {
20
+ static description = "React to one of the owner's messages with an emoji, as the Agent: the lightest acknowledgement. Replaces the Agent's earlier reaction to that message";
21
+ static examples = [
22
+ '<%= config.bin %> agent message react <message-id> 👀',
23
+ '<%= config.bin %> agent message react <message-id> done',
24
+ '<%= config.bin %> agent message react <message-id> thumbs-up --agent <agent-id> --json',
25
+ ];
26
+ static args = {
27
+ messageId: core_1.Args.string({
28
+ description: "The messageId of the owner's message (in `agent message context`, or from the chat)",
29
+ required: true,
30
+ ignoreStdin: true,
31
+ }),
32
+ emoji: core_1.Args.string({
33
+ description: `The reaction: ${Object.entries(inbound_messages_1.REACTION_NAMES)
34
+ .map(([emoji, name]) => `${emoji} (${name})`)
35
+ .join(', ')}`,
36
+ required: true,
37
+ ignoreStdin: true,
38
+ }),
39
+ };
40
+ static flags = {
41
+ agent: core_1.Flags.string({
42
+ description: 'The Agent that reacts (outside an Agent session; inside one it is the session’s)',
43
+ }),
44
+ json: core_1.Flags.boolean({ description: 'Print the server’s answer as JSON' }),
45
+ };
46
+ async run() {
47
+ const { args, flags } = await this.parse(AgentMessageReact);
48
+ const emoji = (0, inbound_messages_1.reactionFromInput)(args.emoji);
49
+ if (!emoji) {
50
+ this.failWithCliError({
51
+ message: inbound_messages_1.AGENT_REPLY_REFUSAL_COPY.reaction_invalid,
52
+ code: 'reaction_invalid',
53
+ exit: 2,
54
+ retryable: false,
55
+ });
56
+ }
57
+ let sessionContext;
58
+ try {
59
+ sessionContext = (0, message_intent_1.resolveMessageCommandSessionContext)({
60
+ requireHumanAuth: () => this.requireAuth(),
61
+ });
62
+ }
63
+ catch (error) {
64
+ this.failWithCliError({
65
+ message: error.message,
66
+ code: error.code || 'MESSAGE_INTENT_ERROR',
67
+ exit: 2,
68
+ retryable: false,
69
+ });
70
+ }
71
+ let agentId;
72
+ try {
73
+ agentId = sessionContext
74
+ ? (0, agent_resolver_1.resolveSessionAgentIdentity)(flags.agent).id
75
+ : (await (0, agent_resolver_1.resolveAgentIdentity)(flags.agent)).id;
76
+ }
77
+ catch (error) {
78
+ const failure = (0, agent_resolver_1.agentResolutionFailure)(error);
79
+ this.failWithCliError({
80
+ message: failure.message,
81
+ code: failure.code,
82
+ exit: 2,
83
+ retryable: false,
84
+ details: { suggestion: failure.suggestion },
85
+ });
86
+ }
87
+ let answer;
88
+ try {
89
+ answer = sessionContext
90
+ ? await (0, message_intent_1.reactAsSession)({
91
+ context: sessionContext,
92
+ messageId: args.messageId,
93
+ emoji: emoji,
94
+ })
95
+ : await data_provider_1.dataService.reactToAgentDmMessage(agentId, args.messageId, { emoji: emoji });
96
+ }
97
+ catch (error) {
98
+ if (error instanceof Error && error.name === 'MessageIntentCliError') {
99
+ this.failWithCliError({
100
+ message: error.message,
101
+ code: error.code || 'MESSAGE_INTENT_ERROR',
102
+ exit: 2,
103
+ retryable: false,
104
+ });
105
+ }
106
+ const refusal = (0, inbound_messages_1.agentReplyRefusalOf)(error);
107
+ if (refusal) {
108
+ this.failWithCliError({
109
+ message: inbound_messages_1.AGENT_REPLY_REFUSAL_COPY[refusal.code],
110
+ code: refusal.code,
111
+ status: (0, http_error_1.httpStatusOf)(error),
112
+ exit: 1,
113
+ retryable: false,
114
+ });
115
+ }
116
+ this.handleApiError(error);
117
+ }
118
+ if (flags.json) {
119
+ this.log(JSON.stringify(answer, null, 2));
120
+ return;
121
+ }
122
+ this.log(`Reacted ${emoji} to message ${answer.messageId}. The owner sees it on the message.`);
123
+ }
124
+ }
125
+ exports.default = AgentMessageReact;
@@ -90,7 +90,7 @@ class AgentMessageResolve extends base_command_1.BaseCommand {
90
90
  this.handleApiError(error);
91
91
  }
92
92
  if (flags.json) {
93
- this.log(JSON.stringify(result, null, 2));
93
+ this.printJsonResult(result);
94
94
  return;
95
95
  }
96
96
  this.log(describeAskResolution(messageId, result));
@@ -140,7 +140,7 @@ class AgentMessageRetract extends base_command_1.BaseCommand {
140
140
  this.handleApiError(error);
141
141
  }
142
142
  if (flags.json) {
143
- this.log(JSON.stringify(result, null, 2));
143
+ this.printJsonResult(result);
144
144
  return;
145
145
  }
146
146
  this.log(describeRetraction(targetMessageId, result));
@@ -38,6 +38,8 @@ export type CanonicalIntentEnvelope = {
38
38
  idempotencyKey: string;
39
39
  /** Requested Agent Chat Thread root (the server remains authoritative). */
40
40
  threadRootMessageId?: string;
41
+ /** The owner's messages this one answers, as requested (the server proved each one). */
42
+ replyTo?: string[];
41
43
  /** Sender-declared semantics echoed for auditability; not a delivery promise. */
42
44
  presentation?: CommunicationPresentation;
43
45
  /** Legacy app-DM reach ceiling echoed when explicitly supplied. */
@@ -110,6 +112,7 @@ export default class AgentMessageSend extends BaseCommand {
110
112
  channel: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
111
113
  'thread-ts': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
112
114
  'thread-root': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
115
+ 'reply-to': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
113
116
  'from-json': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
114
117
  supersedes: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
115
118
  'status-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
@@ -137,6 +140,8 @@ export default class AgentMessageSend extends BaseCommand {
137
140
  */
138
141
  private exitForDelivery;
139
142
  private readPayload;
143
+ /** A reply the server refused, in the CLI's words, with the ids it could not prove. */
144
+ private failOnReplyRefusal;
140
145
  private submitAsSession;
141
146
  private submitAsHuman;
142
147
  }
@@ -152,6 +157,7 @@ export type NormalizedIntentPayload = {
152
157
  presentation?: CommunicationPresentation;
153
158
  notificationPolicy?: 'normal' | 'silent';
154
159
  threadRootMessageId?: string;
160
+ replyTo?: string[];
155
161
  context?: {
156
162
  taskId?: string;
157
163
  spaceId?: string;
@@ -251,7 +257,7 @@ export declare function normalizeIntentPayload({ agentId, jsonBody, merged, }: {
251
257
  jsonBody: Record<string, unknown>;
252
258
  merged: Record<string, unknown>;
253
259
  }): NormalizedIntentPayload;
254
- export declare function generateIdempotencyKey(agentId: string, payload: Pick<NormalizedIntentPayload, 'destination' | 'content' | 'presentation' | 'context' | 'threadRootMessageId'>, operation?: MessageOperation): string;
260
+ export declare function generateIdempotencyKey(agentId: string, payload: Pick<NormalizedIntentPayload, 'destination' | 'content' | 'presentation' | 'context' | 'threadRootMessageId' | 'replyTo'>, operation?: MessageOperation): string;
255
261
  /**
256
262
  * The app message a person's owner-DM send became, as the session path names it (`messageId`),
257
263
  * so the text output says `Message id: …` on this path too. Only a send that reached the chat
@@ -271,6 +277,7 @@ export declare function buildEnvelope(input: {
271
277
  };
272
278
  idempotencyKey: string;
273
279
  threadRootMessageId?: string;
280
+ replyTo?: string[];
274
281
  embeds?: EntityEmbed[];
275
282
  embedRejections?: WireEmbedRejection[];
276
283
  presentation?: CommunicationPresentation;
@@ -61,6 +61,8 @@ const cli_runtime_1 = require("../../../lib/cli-runtime");
61
61
  const message_intent_1 = require("../../../lib/message-intent");
62
62
  const entity_embeds_1 = require("../../../lib/entity-embeds");
63
63
  const prompt_1 = require("../../../lib/prompt");
64
+ const http_error_1 = require("../../../lib/http-error");
65
+ const inbound_messages_1 = require("../../../lib/inbound-messages");
64
66
  const runtime_context_1 = require("../../../lib/runtime-context");
65
67
  const BUILD_DESTINATION_RE = /^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/;
66
68
  // eslint-disable-next-line no-control-regex -- Reject control characters in mail headers.
@@ -207,6 +209,12 @@ class AgentMessageSend extends base_command_1.BaseCommand {
207
209
  'thread-root': core_1.Flags.string({
208
210
  description: 'Agent Chat Thread root message ID for app_owner_dm. Do not use this for Slack; use --thread-ts.',
209
211
  }),
212
+ 'reply-to': core_1.Flags.string({
213
+ description: "The owner's message this one answers (app_owner_dm only). Repeat it for up to 10. The " +
214
+ 'owner sees a quote of it above this message. Each must be one of their messages in the ' +
215
+ 'chat this one lands in, or nothing is sent. With --part, only the first part names it.',
216
+ multiple: true,
217
+ }),
210
218
  'from-json': core_1.Flags.string({
211
219
  description: 'Path to a canonical intent JSON payload, or "-" for stdin',
212
220
  }),
@@ -273,6 +281,7 @@ class AgentMessageSend extends base_command_1.BaseCommand {
273
281
  channelId: flags.channel,
274
282
  threadTs: flags['thread-ts'],
275
283
  threadRootMessageId: flags['thread-root'],
284
+ replyTo: flags['reply-to'],
276
285
  idempotencyKey: flags['idempotency-key'],
277
286
  communicationKind: flags.kind,
278
287
  phase: flags.phase,
@@ -341,6 +350,14 @@ class AgentMessageSend extends base_command_1.BaseCommand {
341
350
  });
342
351
  if (unsupported)
343
352
  this.failWithCliError({ ...unsupported, retryable: false });
353
+ if (operation.kind === 'retract' && payload.replyTo) {
354
+ this.failWithCliError({
355
+ message: 'A withdrawal takes a message back; it answers nothing. Drop --reply-to.',
356
+ code: 'reply_to_invalid',
357
+ exit: 1,
358
+ retryable: false,
359
+ });
360
+ }
344
361
  }
345
362
  // Manual task context accepts the same titles and references as task
346
363
  // commands. Managed sessions must leave the claim-derived context alone.
@@ -397,6 +414,7 @@ class AgentMessageSend extends base_command_1.BaseCommand {
397
414
  notificationPolicy: payload.notificationPolicy,
398
415
  context: payload.context,
399
416
  threadRootMessageId: payload.threadRootMessageId,
417
+ replyTo: payload.replyTo,
400
418
  embeds,
401
419
  operation,
402
420
  });
@@ -527,12 +545,29 @@ class AgentMessageSend extends base_command_1.BaseCommand {
527
545
  });
528
546
  }
529
547
  }
548
+ /** A reply the server refused, in the CLI's words, with the ids it could not prove. */
549
+ failOnReplyRefusal(err) {
550
+ if (err instanceof Error && err.name === 'MessageIntentCliError')
551
+ return;
552
+ const refusal = (0, inbound_messages_1.agentReplyRefusalOf)(err);
553
+ if (!refusal)
554
+ return;
555
+ this.failWithCliError({
556
+ message: inbound_messages_1.AGENT_REPLY_REFUSAL_COPY[refusal.code],
557
+ code: refusal.code,
558
+ status: (0, http_error_1.httpStatusOf)(err),
559
+ exit: 1,
560
+ retryable: false,
561
+ ...(refusal.missing ? { details: { missing: refusal.missing } } : {}),
562
+ });
563
+ }
530
564
  async submitAsSession({ sessionContext, request, agentIdentity, principalSource, }) {
531
565
  let result;
532
566
  try {
533
567
  result = await (0, message_intent_1.submitSessionMessageIntent)({ context: sessionContext, request });
534
568
  }
535
569
  catch (err) {
570
+ this.failOnReplyRefusal(err);
536
571
  if (err instanceof Error && err.name === 'MessageIntentCliError') {
537
572
  this.failWithCliError({
538
573
  message: err.message,
@@ -554,6 +589,7 @@ class AgentMessageSend extends base_command_1.BaseCommand {
554
589
  content: request.content,
555
590
  idempotencyKey: request.idempotencyKey,
556
591
  threadRootMessageId: request.threadRootMessageId,
592
+ replyTo: request.replyTo,
557
593
  presentation: request.presentation,
558
594
  appliedPresentation: result.presentation,
559
595
  notificationPolicy: request.notificationPolicy,
@@ -594,11 +630,13 @@ class AgentMessageSend extends base_command_1.BaseCommand {
594
630
  ...(request.threadRootMessageId
595
631
  ? { threadRootMessageId: request.threadRootMessageId }
596
632
  : {}),
633
+ ...(request.replyTo ? { replyTo: request.replyTo } : {}),
597
634
  ...(request.embeds && request.embeds.length > 0 ? { embeds: request.embeds } : {}),
598
635
  ...(request.context || {}),
599
636
  });
600
637
  }
601
638
  catch (err) {
639
+ this.failOnReplyRefusal(err);
602
640
  this.handleApiError(err);
603
641
  }
604
642
  return buildEnvelope({
@@ -612,6 +650,7 @@ class AgentMessageSend extends base_command_1.BaseCommand {
612
650
  content: request.content,
613
651
  idempotencyKey: request.idempotencyKey,
614
652
  threadRootMessageId: request.threadRootMessageId,
653
+ replyTo: request.replyTo,
615
654
  presentation: request.presentation,
616
655
  notificationPolicy: request.notificationPolicy,
617
656
  embeds: request.embeds,
@@ -753,8 +792,11 @@ function buildSequencedRequests(request, followingParts, hasExplicitIdempotencyK
753
792
  if (!hasExplicitIdempotencyKey) {
754
793
  throw new Error('A multi-message update requires an explicit --idempotency-key for safe retries.');
755
794
  }
795
+ // A reply is named once, on the part that begins the answer; the rest continue it.
796
+ const { replyTo, ...rest } = request;
756
797
  return parts.map((text, index) => ({
757
- ...request,
798
+ ...rest,
799
+ ...(index === 0 && replyTo ? { replyTo } : {}),
758
800
  content: { text },
759
801
  idempotencyKey: sequencePartKey(request.idempotencyKey, index),
760
802
  sequence: sequenceMetadata(request.idempotencyKey, index, parts.length),
@@ -983,6 +1025,13 @@ function normalizeIntentPayload({ agentId, jsonBody, merged, }) {
983
1025
  if (threadRootMessageId && destination.kind !== 'app_owner_dm') {
984
1026
  throw invalidIntent('threadRootMessageId only applies to app_owner_dm; use --thread-ts for Slack.');
985
1027
  }
1028
+ const replyTo = (0, inbound_messages_1.normalizeReplyTo)(merged.replyTo ?? jsonBody.replyTo);
1029
+ if (replyTo === 'invalid') {
1030
+ throw invalidIntent(inbound_messages_1.AGENT_REPLY_REFUSAL_COPY.reply_to_invalid, 'reply_to_invalid');
1031
+ }
1032
+ if (replyTo && destination.kind !== 'app_owner_dm') {
1033
+ throw invalidIntent(inbound_messages_1.AGENT_REPLY_REFUSAL_COPY.reply_to_destination_unsupported, 'reply_to_destination_unsupported');
1034
+ }
986
1035
  const jsonContext = jsonBody.context && typeof jsonBody.context === 'object' && !Array.isArray(jsonBody.context)
987
1036
  ? jsonBody.context
988
1037
  : {};
@@ -1011,6 +1060,7 @@ function normalizeIntentPayload({ agentId, jsonBody, merged, }) {
1011
1060
  presentation,
1012
1061
  notificationPolicy,
1013
1062
  ...(threadRootMessageId ? { threadRootMessageId } : {}),
1063
+ ...(replyTo ? { replyTo } : {}),
1014
1064
  ...(Object.keys(context).length > 0 ? { context } : {}),
1015
1065
  };
1016
1066
  }
@@ -1172,7 +1222,7 @@ function booleanFlagInput(argv, name, parsedValue) {
1172
1222
  void parsedValue;
1173
1223
  return undefined;
1174
1224
  }
1175
- function canonicalIntentFromDestination({ agentId, idempotencyKey, destination, text, presentation, notificationPolicy, context, threadRootMessageId, embeds, operation, }) {
1225
+ function canonicalIntentFromDestination({ agentId, idempotencyKey, destination, text, presentation, notificationPolicy, context, threadRootMessageId, replyTo, embeds, operation, }) {
1176
1226
  switch (destination.kind) {
1177
1227
  case 'agent_email':
1178
1228
  return {
@@ -1192,6 +1242,7 @@ function canonicalIntentFromDestination({ agentId, idempotencyKey, destination,
1192
1242
  presentation,
1193
1243
  notificationPolicy,
1194
1244
  threadRootMessageId,
1245
+ replyTo,
1195
1246
  embeds,
1196
1247
  operation,
1197
1248
  ...context,
@@ -1264,6 +1315,8 @@ function generateIdempotencyKey(agentId, payload, operation) {
1264
1315
  presentation: payload.presentation,
1265
1316
  context: payload.context,
1266
1317
  threadRootMessageId: payload.threadRootMessageId,
1318
+ // The same words answering another message are another send; absent, the key is unchanged.
1319
+ ...(payload.replyTo ? { replyTo: payload.replyTo } : {}),
1267
1320
  // The same words correcting another message are another send. Absent for an ordinary
1268
1321
  // send, so its key is the one it had before C10.
1269
1322
  ...(operation ? { operation } : {}),
@@ -1319,6 +1372,7 @@ function buildEnvelope(input) {
1319
1372
  content: input.content,
1320
1373
  idempotencyKey: input.idempotencyKey,
1321
1374
  ...(input.threadRootMessageId ? { threadRootMessageId: input.threadRootMessageId } : {}),
1375
+ ...(input.replyTo && input.replyTo.length > 0 ? { replyTo: input.replyTo } : {}),
1322
1376
  ...(presentation ? { presentation } : {}),
1323
1377
  ...(input.notificationPolicy ? { notificationPolicy: input.notificationPolicy } : {}),
1324
1378
  ...(input.embeds && input.embeds.length > 0 ? { embeds: input.embeds } : {}),
@@ -1531,8 +1585,8 @@ function describeDestination(destination) {
1531
1585
  }
1532
1586
  return destination.kind;
1533
1587
  }
1534
- function invalidIntent(message) {
1588
+ function invalidIntent(message, code = 'INVALID_MESSAGE_INTENT') {
1535
1589
  const err = new Error(message);
1536
- err.code = 'INVALID_MESSAGE_INTENT';
1590
+ err.code = code;
1537
1591
  return err;
1538
1592
  }
@@ -85,7 +85,7 @@ class AgentsAccessApprove extends agent_access_command_1.AgentAccessCommand {
85
85
  this.handleApiError(err);
86
86
  }
87
87
  if (flags.json) {
88
- this.log(JSON.stringify(result, null, 2));
88
+ this.printJsonResult(result);
89
89
  return;
90
90
  }
91
91
  this.log(`Approved. ${personName} is trusted from their next message (${result.trustedAsker?.id ?? 'saved'}).`);
@@ -26,7 +26,7 @@ class AgentsAccessDeny extends agent_access_command_1.AgentAccessCommand {
26
26
  this.handleApiError(err);
27
27
  }
28
28
  if (flags.json) {
29
- this.log(JSON.stringify(result, null, 2));
29
+ this.printJsonResult(result);
30
30
  return;
31
31
  }
32
32
  const who = result.request?.requesterName || result.request?.platformUserId || 'They';
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const data_provider_1 = require("@skrr-ai/data-provider");
4
4
  const agent_access_command_1 = require("../../../lib/agent-access-command");
5
5
  const agent_access_1 = require("../../../lib/agent-access");
6
+ const list_output_1 = require("../../../lib/list-output");
6
7
  /**
7
8
  * Who may ask an agent for work in its channels: the people you trusted and
8
9
  * what each may reach, and the requests waiting for you.
@@ -19,7 +20,8 @@ class AgentsAccessList extends agent_access_command_1.AgentAccessCommand {
19
20
  const agentId = await this.accessAgentId(flags.agent);
20
21
  const access = await this.readAccess(agentId);
21
22
  if (flags.json) {
22
- this.log(JSON.stringify(access, null, 2));
23
+ // Rows are the trusted people; `requests` and `trustedAskers` stay beside them.
24
+ this.printJsonResult((0, list_output_1.listResult)(access, 'trustedAskers'));
23
25
  return;
24
26
  }
25
27
  const pending = access.requests.filter((request) => request.state === 'pending');
@@ -42,7 +42,7 @@ class AgentsAccessReach extends agent_access_command_1.AgentAccessCommand {
42
42
  this.handleApiError(err);
43
43
  }
44
44
  if (flags.json) {
45
- this.log(JSON.stringify(result, null, 2));
45
+ this.printJsonResult(result);
46
46
  return;
47
47
  }
48
48
  this.log(`Reach is now: ${(0, agent_access_1.reachSummary)(result.trustedAsker.reach)}`);
@@ -40,7 +40,7 @@ class AgentsAccessRevoke extends agent_access_command_1.AgentAccessCommand {
40
40
  this.handleApiError(err);
41
41
  }
42
42
  if (flags.json) {
43
- this.log(JSON.stringify(result, null, 2));
43
+ this.printJsonResult(result);
44
44
  return;
45
45
  }
46
46
  const who = result.trustedAsker?.displayName || result.trustedAsker?.platformUserId || 'They';
@@ -37,3 +37,8 @@ export default class AgentsAlwaysOnRecoveryReview extends BaseCommand {
37
37
  * server, or a hold this server cannot close: no command is offered that would be refused.
38
38
  */
39
39
  export declare function closeLines(agentId: string, review: DutyRunRecoveryReview): string[];
40
+ /**
41
+ * Why a Run stopped at its effect boundary, as its worker recorded it (OSK-33242): the server's content-free codes, as
42
+ * sent. Nothing for a Run with no record, or an older server.
43
+ */
44
+ export declare function unprovenLine(review: DutyRunRecoveryReview): string | undefined;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UNKNOWN_CODE_HINT = exports.RECOVERY_CLOSE_CODES = exports.RECOVERY_EXECUTOR_CODES = exports.RECOVERY_HOLD_CODES = void 0;
4
4
  exports.recoveryCode = recoveryCode;
5
5
  exports.closeLines = closeLines;
6
+ exports.unprovenLine = unprovenLine;
6
7
  const core_1 = require("@oclif/core");
7
8
  const data_provider_1 = require("@skrr-ai/data-provider");
8
9
  const base_command_1 = require("../../../base-command");
@@ -105,6 +106,9 @@ class AgentsAlwaysOnRecoveryReview extends base_command_1.BaseCommand {
105
106
  const receipts = receiptLine(review);
106
107
  if (receipts)
107
108
  this.log(receipts);
109
+ const unproven = unprovenLine(review);
110
+ if (unproven)
111
+ this.log(unproven);
108
112
  this.log(INTEGRITY_CAVEAT);
109
113
  for (const line of closeLines(args.id, review))
110
114
  this.log(line);
@@ -263,6 +267,18 @@ function receiptLine(review) {
263
267
  .filter(Boolean)
264
268
  .join(' ');
265
269
  }
270
+ /**
271
+ * Why a Run stopped at its effect boundary, as its worker recorded it (OSK-33242): the server's content-free codes, as
272
+ * sent. Nothing for a Run with no record, or an older server.
273
+ */
274
+ function unprovenLine(review) {
275
+ const codes = Array.isArray(review.effectsUnproven)
276
+ ? review.effectsUnproven.filter(isNonEmptyString)
277
+ : [];
278
+ if (codes.length === 0)
279
+ return undefined;
280
+ return `Stopped because it could not prove: ${codes.join(', ')}.`;
281
+ }
266
282
  /** One line per held result: what a person needs to choose which one to open. */
267
283
  function reviewLine(review) {
268
284
  const stored = review.resultCapture === 'unsealable'
@@ -283,6 +283,7 @@ export default class AgentsChat extends BaseCommand {
283
283
  jsonl: import("@oclif/core/interfaces").BooleanFlag<boolean>;
284
284
  json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
285
285
  'idempotency-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
286
+ 'after-current': import("@oclif/core/interfaces").BooleanFlag<boolean>;
286
287
  'wait-for-idle': import("@oclif/core/interfaces").BooleanFlag<boolean>;
287
288
  'wait-timeout': import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
288
289
  'when-busy': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
@@ -321,6 +322,13 @@ export default class AgentsChat extends BaseCommand {
321
322
  * message joined the running turn, or `--detach`).
322
323
  */
323
324
  private startThroughQueue;
325
+ /**
326
+ * Inbound messages: in an existing conversation the message goes to the server's ingress, which
327
+ * keeps it at once and decides how the agent sees it, so a busy agent is never a refusal.
328
+ * Returns the turn to stream, `null` when there is nothing to stream (the message reached the
329
+ * agent another way, or `--detach`), or `'legacy'` when this server has no ingress.
330
+ */
331
+ private sendThroughIngress;
324
332
  run(): Promise<void>;
325
333
  }
326
334
  export {};