@skrr-ai/cli 0.1.208 → 0.1.210

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 (105) hide show
  1. package/dist/base-command.js +2 -1
  2. package/dist/commands/agent/message/no-reply.js +1 -1
  3. package/dist/commands/agent/message/react.d.ts +23 -0
  4. package/dist/commands/agent/message/react.js +128 -0
  5. package/dist/commands/agent/message/resolve.js +1 -1
  6. package/dist/commands/agent/message/retract.js +1 -1
  7. package/dist/commands/agent/message/send.d.ts +8 -13
  8. package/dist/commands/agent/message/send.js +60 -28
  9. package/dist/commands/agents/access/approve.js +1 -1
  10. package/dist/commands/agents/access/deny.js +1 -1
  11. package/dist/commands/agents/access/list.js +3 -1
  12. package/dist/commands/agents/access/reach.js +1 -1
  13. package/dist/commands/agents/access/revoke.js +1 -1
  14. package/dist/commands/agents/always-on/recovery-review.d.ts +10 -0
  15. package/dist/commands/agents/always-on/recovery-review.js +45 -0
  16. package/dist/commands/agents/chat.d.ts +22 -0
  17. package/dist/commands/agents/chat.js +400 -90
  18. package/dist/commands/agents/import.js +3 -3
  19. package/dist/commands/agents/manager/status.js +7 -6
  20. package/dist/commands/agents/not-for-task.d.ts +24 -0
  21. package/dist/commands/agents/not-for-task.js +64 -0
  22. package/dist/commands/agents/schedule-overview.d.ts +20 -0
  23. package/dist/commands/agents/schedule-overview.js +35 -2
  24. package/dist/commands/agents/shared-memory.js +1 -1
  25. package/dist/commands/agents/stop.d.ts +23 -0
  26. package/dist/commands/agents/stop.js +61 -0
  27. package/dist/commands/agents/update.d.ts +7 -0
  28. package/dist/commands/agents/update.js +45 -2
  29. package/dist/commands/convos/messages.js +5 -0
  30. package/dist/commands/convos/transcript.js +2 -2
  31. package/dist/commands/daemon/logs.d.ts +3 -1
  32. package/dist/commands/daemon/logs.js +6 -2
  33. package/dist/commands/dm/work.js +38 -9
  34. package/dist/commands/duties/advance-next.js +1 -1
  35. package/dist/commands/duties/preflight.js +17 -13
  36. package/dist/commands/duties/show.js +5 -0
  37. package/dist/commands/followups/watch-pr.js +2 -1
  38. package/dist/commands/harnesses/evaluations/evidence.js +2 -2
  39. package/dist/commands/harnesses/evaluations/grant.js +1 -1
  40. package/dist/commands/harnesses/evaluations/revoke.js +1 -1
  41. package/dist/commands/harnesses/evaluations/show.js +1 -1
  42. package/dist/commands/harnesses/rollouts/grant.js +1 -1
  43. package/dist/commands/harnesses/rollouts/revoke.js +1 -1
  44. package/dist/commands/machines/hosted/identity-evaluations/revoke.js +1 -1
  45. package/dist/commands/machines/hosted/identity-evaluations/show.js +1 -1
  46. package/dist/commands/memory/consolidation/undo.js +1 -0
  47. package/dist/commands/messages/list.js +9 -1
  48. package/dist/commands/slack/mutes.js +1 -1
  49. package/dist/commands/slack/unmute.js +1 -1
  50. package/dist/commands/tasks/actionability.js +1 -0
  51. package/dist/commands/tasks/ask.d.ts +2 -0
  52. package/dist/commands/tasks/ask.js +7 -1
  53. package/dist/commands/tasks/bulk-update.js +12 -0
  54. package/dist/commands/tasks/deliverable/add.d.ts +2 -0
  55. package/dist/commands/tasks/deliverable/add.js +25 -6
  56. package/dist/commands/tasks/input/show.d.ts +2 -0
  57. package/dist/commands/tasks/input/show.js +18 -3
  58. package/dist/commands/tasks/list.d.ts +8 -0
  59. package/dist/commands/tasks/list.js +50 -9
  60. package/dist/commands/tasks/move.d.ts +2 -10
  61. package/dist/commands/tasks/move.js +7 -18
  62. package/dist/commands/tasks/resource/add.d.ts +2 -0
  63. package/dist/commands/tasks/resource/add.js +11 -1
  64. package/dist/commands/tasks/result/show.js +19 -7
  65. package/dist/commands/tasks/show.d.ts +4 -3
  66. package/dist/commands/tasks/show.js +20 -8
  67. package/dist/commands/tasks/start.js +35 -16
  68. package/dist/commands/tasks/update.js +3 -0
  69. package/dist/commands/tasks/wait.js +2 -2
  70. package/dist/generated/agent-guides.json +483 -183
  71. package/dist/lib/agent-proactive-baseline.js +4 -1
  72. package/dist/lib/chat-stop.d.ts +17 -0
  73. package/dist/lib/chat-stop.js +70 -0
  74. package/dist/lib/cloud-reply.d.ts +21 -0
  75. package/dist/lib/cloud-reply.js +52 -0
  76. package/dist/lib/duties.d.ts +10 -0
  77. package/dist/lib/duties.js +111 -7
  78. package/dist/lib/duty-ledgers.js +19 -2
  79. package/dist/lib/file-mime.js +8 -0
  80. package/dist/lib/inbound-messages.d.ts +156 -0
  81. package/dist/lib/inbound-messages.js +375 -0
  82. package/dist/lib/message-intent.d.ts +18 -2
  83. package/dist/lib/message-intent.js +23 -1
  84. package/dist/lib/preflight-copy.d.ts +16 -1
  85. package/dist/lib/preflight-copy.js +33 -1
  86. package/dist/lib/space-resolver.d.ts +9 -0
  87. package/dist/lib/space-resolver.js +13 -0
  88. package/dist/lib/task-operations.d.ts +2 -0
  89. package/dist/lib/task-operations.js +28 -4
  90. package/dist/lib/task-preflight.js +1 -0
  91. package/dist/lib/task-review-notice.d.ts +21 -0
  92. package/dist/lib/task-review-notice.js +46 -0
  93. package/dist/lib/task-version.d.ts +9 -0
  94. package/dist/lib/task-version.js +16 -0
  95. package/dist/lib/task-work.js +5 -0
  96. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelopeBridge.js +6 -1
  97. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/managedWorkRuntime.d.ts +5 -0
  98. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/managedWorkRuntime.js +21 -4
  99. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelopeBridge.js +45 -15
  100. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/managedWorkRuntime.d.ts +5 -0
  101. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/managedWorkRuntime.js +31 -5
  102. package/dist/node_modules/@skrr-ai/auth-core/package.json +1 -1
  103. package/dist/node_modules/@skrr-ai/data-provider/index.js +12307 -11838
  104. package/oclif.manifest.json +307 -23
  105. package/package.json +6 -2
@@ -0,0 +1,24 @@
1
+ import { BaseCommand } from '../../base-command';
2
+ /**
3
+ * `skrr agents not-for-task <message> --conversation <id>`: a message of yours that your agent
4
+ * passed to a Task was not for that Task. It comes back to the conversation and is delivered there
5
+ * again; the Task is told, and its response is stopped when it was for this message alone.
6
+ * Running it again answers with the message as it is and changes nothing.
7
+ */
8
+ export default class AgentsNotForTask extends BaseCommand {
9
+ static description: string;
10
+ static examples: string[];
11
+ static args: {
12
+ message: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
13
+ };
14
+ static flags: {
15
+ conversation: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
16
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
17
+ bare: import("@oclif/core/interfaces").BooleanFlag<boolean>;
18
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
+ workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
20
+ profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
21
+ raw: import("@oclif/core/interfaces").BooleanFlag<boolean>;
22
+ };
23
+ run(): Promise<void>;
24
+ }
@@ -0,0 +1,64 @@
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 inbound_messages_1 = require("../../lib/inbound-messages");
6
+ /**
7
+ * `skrr agents not-for-task <message> --conversation <id>`: a message of yours that your agent
8
+ * passed to a Task was not for that Task. It comes back to the conversation and is delivered there
9
+ * again; the Task is told, and its response is stopped when it was for this message alone.
10
+ * Running it again answers with the message as it is and changes nothing.
11
+ */
12
+ class AgentsNotForTask extends base_command_1.BaseCommand {
13
+ static description = 'Bring back a message your agent passed to a Task, and have it answered in the conversation';
14
+ static examples = [
15
+ '<%= config.bin %> agents not-for-task msg_3f9a1c2b --conversation <conversation-id>',
16
+ '<%= config.bin %> agents not-for-task msg_3f9a1c2b --conversation <conversation-id> --json',
17
+ ];
18
+ static args = {
19
+ message: core_1.Args.string({
20
+ description: 'The id of your message',
21
+ required: true,
22
+ ignoreStdin: true,
23
+ }),
24
+ };
25
+ static flags = {
26
+ ...base_command_1.BaseCommand.baseFlags,
27
+ conversation: core_1.Flags.string({ description: 'Conversation the message is in', required: true }),
28
+ json: core_1.Flags.boolean({ description: 'Output as JSON' }),
29
+ };
30
+ async run() {
31
+ this.requireAuth();
32
+ const { args, flags } = await this.parse(AgentsNotForTask);
33
+ let answer;
34
+ try {
35
+ answer = await (0, inbound_messages_1.returnInboundMessage)(flags.conversation, args.message);
36
+ }
37
+ catch (err) {
38
+ const refusal = (0, inbound_messages_1.returnRefusalOf)(err);
39
+ if (refusal) {
40
+ this.failWithCliError({
41
+ message: refusal,
42
+ code: 'MESSAGE_NOT_RETURNED',
43
+ exit: 1,
44
+ retryable: false,
45
+ details: { messageId: args.message, conversationId: flags.conversation },
46
+ });
47
+ }
48
+ this.handleApiError(err);
49
+ }
50
+ if (flags.json)
51
+ return this.printJsonResult(answer);
52
+ this.log((0, inbound_messages_1.returnedSentence)(answer.returned ?? {}));
53
+ // How it is delivered here now: why it waits or failed, else what its route says.
54
+ const state = answer.delivery?.state;
55
+ const now = state === 'held' || state === 'failed'
56
+ ? (0, inbound_messages_1.deliverySentence)(answer.delivery)
57
+ : answer.route
58
+ ? inbound_messages_1.ROUTE_COPY[answer.route]
59
+ : null;
60
+ if (now)
61
+ this.log(now);
62
+ }
63
+ }
64
+ exports.default = AgentsNotForTask;
@@ -63,3 +63,23 @@ export interface WithheldTrigger {
63
63
  * agent's Always-On switch. A server that predates `reasonText` still prints the code.
64
64
  */
65
65
  export declare function withheldLine(trigger: WithheldTrigger): string;
66
+ /**
67
+ * Why the Recent fires section has no rows, when the read did not succeed. The states and reasons are
68
+ * the ones the agent's own overview tool answers with (`self_schedule_overview`'s `recentFiresCoverage`),
69
+ * so a person and an agent are told the same thing.
70
+ *
71
+ * The server refuses an Agent's fire history (409 `FIRE_SOURCE_UNVERIFIED`): a fire row records the
72
+ * Trigger's and the Agent's logical ids only, and an Agent recreated under the same id, or a Duty
73
+ * handed to another executor, shares them. That refusal is `unsupported`; any other failure is
74
+ * `unavailable`. Either way the section used to print "No fire audit records." under the error, which
75
+ * read as "nothing fired" (OSK-33261). Undefined for a read that succeeded, even with no rows.
76
+ */
77
+ export interface RecentFiresCoverage {
78
+ state: 'unsupported' | 'unavailable';
79
+ reason: string;
80
+ }
81
+ export declare const RECENT_FIRES_UNSUPPORTED_REASON = "Historical fires do not prove the physical Agent at occurrence time.";
82
+ export declare const RECENT_FIRES_UNAVAILABLE_REASON = "Recent fire history could not be read.";
83
+ export declare function recentFiresCoverage(result: PromiseSettledResult<unknown>): RecentFiresCoverage | undefined;
84
+ /** The one line the text view prints instead of the list. An unavailable read keeps its error. */
85
+ export declare function recentFiresCoverageLine(coverage: RecentFiresCoverage, result: PromiseSettledResult<unknown>): string;
@@ -1,15 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RECENT_FIRES_UNAVAILABLE_REASON = exports.RECENT_FIRES_UNSUPPORTED_REASON = void 0;
3
4
  exports.pausedTriggers = pausedTriggers;
4
5
  exports.pausedTriggerLines = pausedTriggerLines;
5
6
  exports.reflectionSummary = reflectionSummary;
6
7
  exports.reflectionLine = reflectionLine;
7
8
  exports.reflectionNoteLine = reflectionNoteLine;
8
9
  exports.withheldLine = withheldLine;
10
+ exports.recentFiresCoverage = recentFiresCoverage;
11
+ exports.recentFiresCoverageLine = recentFiresCoverageLine;
9
12
  const core_1 = require("@oclif/core");
10
13
  const data_provider_1 = require("@skrr-ai/data-provider");
11
14
  const base_command_1 = require("../../base-command");
12
15
  const format_1 = require("../../lib/format");
16
+ const http_error_1 = require("../../lib/http-error");
13
17
  const triggers_1 = require("../../lib/triggers");
14
18
  const schedule_1 = require("../../lib/schedule");
15
19
  const planOutcome_1 = require("../../lib/planOutcome");
@@ -79,6 +83,8 @@ class AgentsScheduleOverview extends base_command_1.BaseCommand {
79
83
  // reports them here so "nothing upcoming" is never mistaken for a break.
80
84
  const blockedUpcoming = settledValue(upcomingR)?.blocked ?? [];
81
85
  const fires = settledValue(firesR)?.fires ?? [];
86
+ // A history that could not be read is not an empty one (OSK-33261).
87
+ const firesCoverage = recentFiresCoverage(firesR);
82
88
  const triggers = settledValue(triggersR)?.triggers ?? [];
83
89
  const todos = settledValue(todosR)?.todos ?? [];
84
90
  const openTasks = filterAgentOpenTasks(settledValue(tasksR), agentId);
@@ -90,6 +96,8 @@ class AgentsScheduleOverview extends base_command_1.BaseCommand {
90
96
  upcoming,
91
97
  pausedTriggers: pausedTriggers(triggers, reflection),
92
98
  recentFires: fires,
99
+ // `recentFires` keeps its array shape; this says when that `[]` means "not read".
100
+ ...(firesCoverage ? { recentFiresCoverage: firesCoverage } : {}),
93
101
  openTasks,
94
102
  todos,
95
103
  triggers,
@@ -162,8 +170,12 @@ class AgentsScheduleOverview extends base_command_1.BaseCommand {
162
170
  // PAST.
163
171
  this.log('');
164
172
  this.log('■ Recent fires');
165
- reportError(firesR, (line) => this.log(` ${line}`));
166
- (0, triggers_1.renderFireAudit)(fires, (line) => this.log(line), undefined, { timeZone: todayZone });
173
+ if (firesCoverage) {
174
+ this.log(` ${recentFiresCoverageLine(firesCoverage, firesR)}`);
175
+ }
176
+ else {
177
+ (0, triggers_1.renderFireAudit)(fires, (line) => this.log(line), undefined, { timeZone: todayZone });
178
+ }
167
179
  // Open tasks assigned to this agent.
168
180
  this.log('');
169
181
  this.log('■ Open tasks (assigned to this agent)');
@@ -272,6 +284,27 @@ function withheldLine(trigger) {
272
284
  function settledValue(result) {
273
285
  return result.status === 'fulfilled' ? result.value : undefined;
274
286
  }
287
+ exports.RECENT_FIRES_UNSUPPORTED_REASON = 'Historical fires do not prove the physical Agent at occurrence time.';
288
+ exports.RECENT_FIRES_UNAVAILABLE_REASON = 'Recent fire history could not be read.';
289
+ function recentFiresCoverage(result) {
290
+ if (result.status === 'fulfilled')
291
+ return undefined;
292
+ return (0, http_error_1.httpBodyOf)(result.reason)?.code === 'FIRE_SOURCE_UNVERIFIED'
293
+ ? { state: 'unsupported', reason: exports.RECENT_FIRES_UNSUPPORTED_REASON }
294
+ : { state: 'unavailable', reason: exports.RECENT_FIRES_UNAVAILABLE_REASON };
295
+ }
296
+ /** The one line the text view prints instead of the list. An unavailable read keeps its error. */
297
+ function recentFiresCoverageLine(coverage, result) {
298
+ if (coverage.state === 'unsupported')
299
+ return `Unsupported: ${coverage.reason}`;
300
+ const reason = result.status === 'rejected' ? result.reason : undefined;
301
+ let detail = '';
302
+ if (reason instanceof Error)
303
+ detail = reason.message;
304
+ else if (reason !== undefined && reason !== null)
305
+ detail = String(reason);
306
+ return `Unavailable: ${coverage.reason}${detail ? ` (${detail})` : ''}`;
307
+ }
275
308
  /** Print a one-line "(unavailable: …)" note for a rejected source. */
276
309
  function reportError(result, log) {
277
310
  if (result.status === 'rejected') {
@@ -40,7 +40,7 @@ class AgentsSharedMemory extends base_command_1.BaseCommand {
40
40
  this.handleApiError(err);
41
41
  }
42
42
  if (flags.json) {
43
- this.log(JSON.stringify(preview, null, 2));
43
+ this.printJsonResult(preview);
44
44
  return;
45
45
  }
46
46
  const { memories, withheld, omitted, digest } = preview;
@@ -0,0 +1,23 @@
1
+ import { BaseCommand } from '../../base-command';
2
+ /**
3
+ * `skrr agents stop --conversation <id> [--all]`: stop what an Agent is doing in one of your
4
+ * conversations, from any terminal. Stop stops the conversation's own work and its sub-agents and
5
+ * background commands; it never stops a Task. `--all` also stops the Tasks started from that
6
+ * conversation that are still running. `--dry-run` says what each would stop and stops nothing.
7
+ */
8
+ export default class AgentsStop extends BaseCommand {
9
+ static description: string;
10
+ static examples: string[];
11
+ static flags: {
12
+ conversation: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
13
+ all: import("@oclif/core/interfaces").BooleanFlag<boolean>;
14
+ 'dry-run': import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
+ bare: import("@oclif/core/interfaces").BooleanFlag<boolean>;
17
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
+ workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
+ profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
20
+ raw: import("@oclif/core/interfaces").BooleanFlag<boolean>;
21
+ };
22
+ run(): Promise<void>;
23
+ }
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const node_crypto_1 = require("node:crypto");
4
+ const core_1 = require("@oclif/core");
5
+ const base_command_1 = require("../../base-command");
6
+ const chat_stop_1 = require("../../lib/chat-stop");
7
+ /**
8
+ * `skrr agents stop --conversation <id> [--all]`: stop what an Agent is doing in one of your
9
+ * conversations, from any terminal. Stop stops the conversation's own work and its sub-agents and
10
+ * background commands; it never stops a Task. `--all` also stops the Tasks started from that
11
+ * conversation that are still running. `--dry-run` says what each would stop and stops nothing.
12
+ */
13
+ class AgentsStop extends base_command_1.BaseCommand {
14
+ static description = 'Stop what your agent is doing in a conversation; --all also stops the Tasks it started there';
15
+ static examples = [
16
+ '<%= config.bin %> agents stop --conversation <conversation-id>',
17
+ '<%= config.bin %> agents stop --conversation <conversation-id> --all',
18
+ '<%= config.bin %> agents stop --conversation <conversation-id> --dry-run',
19
+ ];
20
+ static flags = {
21
+ ...base_command_1.BaseCommand.baseFlags,
22
+ conversation: core_1.Flags.string({ description: 'Conversation to stop', required: true }),
23
+ all: core_1.Flags.boolean({
24
+ description: 'Also stop the Tasks started from this conversation that are still running',
25
+ }),
26
+ 'dry-run': core_1.Flags.boolean({ description: 'Say what would stop, and stop nothing' }),
27
+ json: core_1.Flags.boolean({ description: 'Output as JSON' }),
28
+ };
29
+ async run() {
30
+ this.requireAuth();
31
+ const { flags } = await this.parse(AgentsStop);
32
+ const conversationId = flags.conversation;
33
+ if (flags['dry-run']) {
34
+ let preview;
35
+ try {
36
+ preview = await (0, chat_stop_1.readStopPreview)(conversationId);
37
+ }
38
+ catch (err) {
39
+ this.handleApiError(err);
40
+ }
41
+ if (flags.json)
42
+ return this.printJsonResult(preview);
43
+ for (const line of (0, chat_stop_1.describeStopPreview)(preview))
44
+ this.log(line);
45
+ return;
46
+ }
47
+ let receipt;
48
+ try {
49
+ receipt = await (0, chat_stop_1.requestStop)(conversationId, flags.all ? 'all' : 'session', `cli-${(0, node_crypto_1.randomUUID)()}`);
50
+ }
51
+ catch (err) {
52
+ this.handleApiError(err);
53
+ }
54
+ if (flags.json)
55
+ return this.printJsonResult(receipt);
56
+ for (const line of (0, chat_stop_1.describeStopReceipt)(receipt, { bin: this.config.bin, conversationId })) {
57
+ this.log(line);
58
+ }
59
+ }
60
+ }
61
+ exports.default = AgentsStop;
@@ -17,6 +17,7 @@ export default class AgentsUpdate extends BaseCommand {
17
17
  category: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
18
  target: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
19
  'next-target': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
20
+ 'cloud-reply': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
20
21
  'working-directory': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
21
22
  'default-permission-mode': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
22
23
  'clear-default-permission-mode': import("@oclif/core/interfaces").BooleanFlag<boolean>;
@@ -123,6 +124,12 @@ export declare const AGENT_FENCE_RETRY_CODES: ReadonlySet<string>;
123
124
  export declare function retryOnceOnAgentFence<T>(operation: () => Promise<T>, { delayMs }?: {
124
125
  delayMs?: number;
125
126
  }): Promise<T>;
127
+ /**
128
+ * What the cloud-reply setting is now, after a write that sent it or changed the runtime order
129
+ * (inbound messages D4). The server turns it off in the same write that removes the last cloud
130
+ * runtime, so a `--target` change that did that says so. Exported for tests.
131
+ */
132
+ export declare function cloudReplyNote(payload: Record<string, unknown>, updated: Record<string, unknown>): string | null;
126
133
  /**
127
134
  * The `defaultPermissionMode` a PATCH carries for these flags. `null` is the
128
135
  * server's clear, the same spelling `harnesses update --clear-default-permission-mode`
@@ -6,6 +6,7 @@ exports.agentRowFromUpdate = agentRowFromUpdate;
6
6
  exports.alwaysOnReceiptLine = alwaysOnReceiptLine;
7
7
  exports.writeReceiptWarnings = writeReceiptWarnings;
8
8
  exports.retryOnceOnAgentFence = retryOnceOnAgentFence;
9
+ exports.cloudReplyNote = cloudReplyNote;
9
10
  exports.defaultPermissionModePatch = defaultPermissionModePatch;
10
11
  exports.defaultPermissionModeNote = defaultPermissionModeNote;
11
12
  const core_1 = require("@oclif/core");
@@ -19,6 +20,7 @@ const execution_target_1 = require("../../lib/execution-target");
19
20
  const prompt_1 = require("../../lib/prompt");
20
21
  const agent_config_1 = require("../../lib/agent-config");
21
22
  const web_url_1 = require("../../lib/web-url");
23
+ const cloud_reply_1 = require("../../lib/cloud-reply");
22
24
  class AgentsUpdate extends base_command_1.BaseCommand {
23
25
  static description = 'Update an existing agent (partial patch)';
24
26
  static examples = [
@@ -27,6 +29,7 @@ class AgentsUpdate extends base_command_1.BaseCommand {
27
29
  '<%= config.bin %> agents update <agent-id> --model claude-sonnet-5',
28
30
  '<%= config.bin %> agents update <agent-id> --target sbs_123',
29
31
  '<%= config.bin %> agents update <agent-id> --target rt_local --next-target hosted-machine',
32
+ '<%= config.bin %> agents update <agent-id> --cloud-reply on',
30
33
  '<%= config.bin %> agents update <agent-id> --from-json patch.json',
31
34
  ];
32
35
  static args = {
@@ -54,6 +57,12 @@ class AgentsUpdate extends base_command_1.BaseCommand {
54
57
  description: 'Next execution target in exact execution order after --target. Repeat in the order it should be tried.',
55
58
  multiple: true,
56
59
  }),
60
+ 'cloud-reply': core_1.Flags.string({
61
+ description: 'Whether this agent answers from the cloud while the computer it works on is offline or ' +
62
+ "too busy (off unless turned on). The reply sees the conversation and the state of its work, never that computer's files, " +
63
+ 'and uses your usage like any cloud run. Needs an Agent Worker, or a Hosted Machine you approved, in its runtime order.',
64
+ options: ['on', 'off'],
65
+ }),
57
66
  'working-directory': core_1.Flags.string({
58
67
  description: 'Default working directory for local Harness sessions',
59
68
  }),
@@ -173,6 +182,7 @@ class AgentsUpdate extends base_command_1.BaseCommand {
173
182
  model: flags.model,
174
183
  category: flags.category,
175
184
  executionPolicy,
185
+ cloudReplyWhenMachineUnavailable: flags['cloud-reply'] === undefined ? undefined : flags['cloud-reply'] === 'on',
176
186
  workingDirectory: flags['working-directory'],
177
187
  defaultPermissionMode: defaultPermissionModePatch(flags),
178
188
  });
@@ -199,6 +209,11 @@ class AgentsUpdate extends base_command_1.BaseCommand {
199
209
  }));
200
210
  }
201
211
  catch (err) {
212
+ // A refusal of the cloud-reply setting answers in the CLI's own words, never the error's.
213
+ const { code } = (0, base_command_1.apiRefusal)(err);
214
+ if (code && code in cloud_reply_1.CLOUD_REPLY_SETTING_REFUSAL_COPY) {
215
+ this.error(cloud_reply_1.CLOUD_REPLY_SETTING_REFUSAL_COPY[code], { exit: 1 });
216
+ }
202
217
  this.handleApiError(err);
203
218
  }
204
219
  for (const warning of agentUpdateWarnings(payload, updated))
@@ -235,6 +250,9 @@ class AgentsUpdate extends base_command_1.BaseCommand {
235
250
  if (alwaysOnLine)
236
251
  this.log(alwaysOnLine);
237
252
  this.log(`URL: ${(0, web_url_1.withAgentUrl)(this.cliConfig.baseURL, { ...a, id: a.id ?? a._id ?? args.id }).url ?? '-'}`);
253
+ const cloudLine = cloudReplyNote(payload, a);
254
+ if (cloudLine)
255
+ this.log(cloudLine);
238
256
  const modeNote = defaultPermissionModeNote(flags['default-permission-mode'], a);
239
257
  if (modeNote)
240
258
  this.log(modeNote);
@@ -352,8 +370,8 @@ function alwaysOnReceiptLine(payload, updated) {
352
370
  ? `turned ${state}`
353
371
  : null;
354
372
  if (action) {
355
- return `Always-On: ${action} at generation ${command.generation}; ` +
356
- `now ${current.isAlwaysOn ? 'on' : 'off'} at generation ${command.supersededByGeneration}.`;
373
+ return (`Always-On: ${action} at generation ${command.generation}; ` +
374
+ `now ${current.isAlwaysOn ? 'on' : 'off'} at generation ${command.supersededByGeneration}.`);
357
375
  }
358
376
  }
359
377
  if (receipt.unchanged.some((entry) => entry.field === 'isAlwaysOn')) {
@@ -428,6 +446,31 @@ async function retryOnceOnAgentFence(operation, { delayMs = 750 } = {}) {
428
446
  return operation();
429
447
  }
430
448
  }
449
+ /**
450
+ * What the cloud-reply setting is now, after a write that sent it or changed the runtime order
451
+ * (inbound messages D4). The server turns it off in the same write that removes the last cloud
452
+ * runtime, so a `--target` change that did that says so. Exported for tests.
453
+ */
454
+ function cloudReplyNote(payload, updated) {
455
+ const sent = payload.cloudReplyWhenMachineUnavailable;
456
+ const stored = updated.cloudReplyWhenMachineUnavailable;
457
+ if (typeof sent === 'boolean') {
458
+ const on = typeof stored === 'boolean' ? stored : sent;
459
+ return on
460
+ ? 'Cloud replies: on. While its computer is offline or too busy, this agent answers from ' +
461
+ "the cloud. It sees the conversation and the state of its work, never that computer's " +
462
+ 'files, and those replies use your usage.'
463
+ : "Cloud replies: off. Messages wait for this agent's computer.";
464
+ }
465
+ // Said in the present tense: the prior setting is not in the reply, the current order is.
466
+ if (payload.executionPolicy !== undefined &&
467
+ stored === false &&
468
+ !(0, data_provider_1.cloudReplyPossible)(updated.executionPolicy)) {
469
+ return ('Cloud replies: off. The runtime order has no cloud runtime that may answer, so messages ' +
470
+ 'wait for its computer.');
471
+ }
472
+ return null;
473
+ }
431
474
  /**
432
475
  * The `defaultPermissionMode` a PATCH carries for these flags. `null` is the
433
476
  * server's clear, the same spelling `harnesses update --clear-default-permission-mode`
@@ -5,6 +5,7 @@ const core_1 = require("@oclif/core");
5
5
  const data_provider_1 = require("@skrr-ai/data-provider");
6
6
  const base_command_1 = require("../../base-command");
7
7
  const message_content_1 = require("../../lib/message-content");
8
+ const cloud_reply_1 = require("../../lib/cloud-reply");
8
9
  const FORMAT_MESSAGE_LINES_RE_2 = /\s+/g;
9
10
  const FORMAT_MESSAGE_LINES_RE = /\s+/g;
10
11
  /**
@@ -30,6 +31,10 @@ function formatMessageLines(m, options = {}) {
30
31
  .join('\n\n');
31
32
  const clipped = body.length > 300 ? `${body.slice(0, 300)}…` : body;
32
33
  const lines = [`${when} ${who}${failure ? ' [failed]' : ''}`];
34
+ // Written from the cloud while the machine could not answer: it could not see that machine.
35
+ const cloud = m.isCreatedByUser ? null : (0, cloud_reply_1.cloudReplyLine)(m.metadata);
36
+ if (cloud)
37
+ lines.push(` ${cloud}`);
33
38
  if (clipped || !failure) {
34
39
  for (const line of clipped.split('\n')) {
35
40
  lines.push(` ${line}`);
@@ -404,7 +404,7 @@ class ConvosTranscript extends base_command_1.BaseCommand {
404
404
  : {}),
405
405
  };
406
406
  if (flags.json) {
407
- this.log(JSON.stringify(result, null, 2));
407
+ this.printJsonResult(result);
408
408
  return;
409
409
  }
410
410
  if (result.items.length === 0) {
@@ -450,7 +450,7 @@ class ConvosTranscript extends base_command_1.BaseCommand {
450
450
  ...(first.events ? { events: pages.flatMap((page) => page.events ?? []) } : {}),
451
451
  };
452
452
  if (json) {
453
- this.log(JSON.stringify(body, null, 2));
453
+ this.printJsonResult(body);
454
454
  return;
455
455
  }
456
456
  for (const line of formatTurnBody(body))
@@ -144,7 +144,9 @@ export declare const ROTATED_WINDOW_NOTE_RUNTIME_VERSION = "0.8.121";
144
144
  * 10 MB (`daemon/src/logger.ts` `maybeRotate`), and `logs` never reached them —
145
145
  * `--lines 5000 | grep <run id>` found nothing while `daemon.app.1.log` held the
146
146
  * run. A copy of `daemon/src/rotated-log-files.ts`, for runtimes that predate
147
- * `--rotated`. Never throws.
147
+ * `--rotated`. Never throws. The supervisor capture's `<file>.previous` (the
148
+ * only log a `skrrd install` daemon has) is listed last, since it holds what
149
+ * came just before the current file.
148
150
  */
149
151
  export declare function rotatedLogSiblings(filePath: string, readdir?: (dir: string) => string[]): string[];
150
152
  /** The sentence shown when rotated siblings hold older lines the view leaves out. */
@@ -263,7 +263,9 @@ exports.ROTATED_WINDOW_NOTE_RUNTIME_VERSION = '0.8.121';
263
263
  * 10 MB (`daemon/src/logger.ts` `maybeRotate`), and `logs` never reached them —
264
264
  * `--lines 5000 | grep <run id>` found nothing while `daemon.app.1.log` held the
265
265
  * run. A copy of `daemon/src/rotated-log-files.ts`, for runtimes that predate
266
- * `--rotated`. Never throws.
266
+ * `--rotated`. Never throws. The supervisor capture's `<file>.previous` (the
267
+ * only log a `skrrd install` daemon has) is listed last, since it holds what
268
+ * came just before the current file.
267
269
  */
268
270
  function rotatedLogSiblings(filePath, readdir = (dir) => (0, node_fs_1.readdirSync)(dir)) {
269
271
  const dir = node_path_1.default.dirname(filePath);
@@ -278,11 +280,13 @@ function rotatedLogSiblings(filePath, readdir = (dir) => (0, node_fs_1.readdirSy
278
280
  catch {
279
281
  return [];
280
282
  }
281
- return names
283
+ const numbered = names
282
284
  .map((name) => ({ name, index: Number(pattern.exec(name)?.[1] ?? NaN) }))
283
285
  .filter(({ index }) => Number.isSafeInteger(index) && index >= 1)
284
286
  .sort((a, b) => b.index - a.index)
285
287
  .map(({ name }) => node_path_1.default.join(dir, name));
288
+ const previous = `${node_path_1.default.basename(filePath)}.previous`;
289
+ return names.includes(previous) ? [...numbered, node_path_1.default.join(dir, previous)] : numbered;
286
290
  }
287
291
  /** The sentence shown when rotated siblings hold older lines the view leaves out. */
288
292
  function describeRotatedSiblings(filePath, siblings) {
@@ -6,16 +6,30 @@ const base_command_1 = require("../../base-command");
6
6
  const agent_resolver_1 = require("../../lib/agent-resolver");
7
7
  class DmWork extends base_command_1.BaseCommand {
8
8
  static description = 'List the authorized Tasks managed in an agent’s main chat';
9
- static args = { agent: core_1.Args.string({ required: false, ignoreStdin: true, description: 'Agent ID; uses authenticated runtime context when omitted' }) };
9
+ static args = {
10
+ agent: core_1.Args.string({
11
+ required: false,
12
+ ignoreStdin: true,
13
+ description: 'Agent ID; uses authenticated runtime context when omitted',
14
+ }),
15
+ };
10
16
  static flags = {
11
17
  limit: core_1.Flags.integer({ min: 1, max: 100, default: 20 }),
12
18
  cursor: core_1.Flags.string({ description: 'Opaque nextCursor from the previous page' }),
13
- task: core_1.Flags.string({ description: 'Read one exact managed Task link, including Tasks beyond the first page' }),
19
+ task: core_1.Flags.string({
20
+ description: 'Read one exact managed Task link, including Tasks beyond the first page',
21
+ }),
14
22
  commands: core_1.Flags.boolean({ description: 'List durable launch command receipts' }),
15
- pending: core_1.Flags.boolean({ description: 'With --commands, include only commands still preparing or awaiting effects' }),
16
- 'source-message': core_1.Flags.string({ description: 'With --commands, filter by one source message within this main chat' }),
23
+ pending: core_1.Flags.boolean({
24
+ description: 'With --commands, include only commands still preparing or awaiting effects',
25
+ }),
26
+ 'source-message': core_1.Flags.string({
27
+ description: 'With --commands, filter by one source message within this main chat',
28
+ }),
17
29
  command: core_1.Flags.string({ description: 'Read one exact launch command receipt' }),
18
- capabilities: core_1.Flags.boolean({ description: 'Read managed-work protocol and rollout capabilities' }),
30
+ capabilities: core_1.Flags.boolean({
31
+ description: 'Read managed-work protocol and rollout capabilities',
32
+ }),
19
33
  json: core_1.Flags.boolean({ description: 'Output JSON (including pagination)' }),
20
34
  };
21
35
  async run() {
@@ -23,7 +37,12 @@ class DmWork extends base_command_1.BaseCommand {
23
37
  const { args, flags } = await this.parse(DmWork);
24
38
  try {
25
39
  const { id } = await (0, agent_resolver_1.resolveAgentIdentity)(args.agent);
26
- if ([Boolean(flags.task), Boolean(flags.commands), Boolean(flags.command), Boolean(flags.capabilities)].filter(Boolean).length > 1) {
40
+ if ([
41
+ Boolean(flags.task),
42
+ Boolean(flags.commands),
43
+ Boolean(flags.command),
44
+ Boolean(flags.capabilities),
45
+ ].filter(Boolean).length > 1) {
27
46
  this.error('Use only one of --task, --commands, --command or --capabilities.', { exit: 2 });
28
47
  }
29
48
  if (flags.capabilities)
@@ -36,14 +55,24 @@ class DmWork extends base_command_1.BaseCommand {
36
55
  this.error('--pending and --source-message require --commands.', { exit: 2 });
37
56
  if (flags.commands)
38
57
  return this.printJsonResult(await data_provider_1.dataService.listAgentChatWorkCommands(id, {
39
- limit: flags.limit, cursor: flags.cursor, pendingOnly: flags.pending,
58
+ limit: flags.limit,
59
+ cursor: flags.cursor,
60
+ pendingOnly: flags.pending,
40
61
  sourceMessageId: flags['source-message'],
41
62
  }));
42
- const page = await data_provider_1.dataService.listAgentChatWorkTasks(id, { limit: flags.limit, cursor: flags.cursor });
63
+ const page = await data_provider_1.dataService.listAgentChatWorkTasks(id, {
64
+ limit: flags.limit,
65
+ cursor: flags.cursor,
66
+ });
43
67
  if (flags.json)
44
68
  return this.printJsonResult(page);
45
- for (const task of page.items)
69
+ for (const task of page.items) {
46
70
  this.log(`${task.taskId} ${task.title ?? ''}`.trimEnd());
71
+ const handling = (0, data_provider_1.readCoordinatorSignalReason)(task.lastReturn?.reason);
72
+ if (task.lastReturn && handling) {
73
+ this.log(` Last update (${task.lastReturn.kind.replaceAll('_', ' ')}): ${(0, data_provider_1.describeCoordinatorHandling)(handling)}`);
74
+ }
75
+ }
47
76
  this.log(`${page.items.length} shown; ${page.total} authorized Task(s)${page.hasMore ? `; next cursor ${page.nextCursor}` : ''}.`);
48
77
  }
49
78
  catch (error) {
@@ -77,7 +77,7 @@ class DutiesAdvanceNext extends base_command_1.BaseCommand {
77
77
  }
78
78
  const url = (0, web_url_1.dutyUrlFrom)(this.cliConfig.baseURL, { id });
79
79
  if (flags.json) {
80
- this.log(JSON.stringify({ ...result, url }, null, 2));
80
+ this.printJsonResult({ ...result, url });
81
81
  return;
82
82
  }
83
83
  if (result.proposal) {
@@ -107,6 +107,10 @@ function preflightHeadline(report, persisted) {
107
107
  const caveats = [];
108
108
  if (noActionRuns)
109
109
  caveats.push('its daily Run budget is 0, so no agent turn will start');
110
+ // Spent for today is a different fact from a budget of 0: it clears at 00:00 UTC (OSK-33248).
111
+ else if (gateById('run_budget')?.verdict === 'block') {
112
+ caveats.push('today\u2019s Run budget is spent, so no agent turn starts until it resets');
113
+ }
110
114
  if (gateById('endpoint')?.verdict === 'block') {
111
115
  caveats.push('no connected endpoint can deliver its reports');
112
116
  }
@@ -164,7 +168,13 @@ function preflightGateLines(gate, verbose = false, refusesActivation = false, un
164
168
  // answers 409 for it, so it is tagged BLOCK and says what it stops. `info (advisory: does not stop a
165
169
  // run)` beside an "Activation: would be refused" section naming the same gate was two answers to one
166
170
  // question.
167
- const advisoryBlock = gate.verdict === 'block' && gate.admission === 'advisory' && !refusesActivation;
171
+ // A spent run budget is advisory because it clears by itself and must not refuse activation, but
172
+ // it does refuse the next agent turn, so "does not stop a run" would be false (OSK-33248).
173
+ const spentRunBudget = gate.id === 'run_budget' && gate.verdict === 'block';
174
+ const advisoryBlock = gate.verdict === 'block' &&
175
+ gate.admission === 'advisory' &&
176
+ !refusesActivation &&
177
+ !spentRunBudget;
168
178
  const stopsActivationOnly = gate.verdict === 'block' && gate.admission === 'advisory' && refusesActivation;
169
179
  // A deleted Sensor is the one advisory block that must not read lower than a silent one (`warn`):
170
180
  // it is the more serious state (OSK-22592).
@@ -195,7 +205,10 @@ function preflightGateLines(gate, verbose = false, refusesActivation = false, un
195
205
  const lines = [
196
206
  ` ${mark.padEnd(5)} ${gate.label}${showReason && gate.reason ? ` — ${gate.reason}` : ''}` +
197
207
  (advisoryBlock ? ' (advisory: does not stop a run)' : '') +
198
- (stopsActivationOnly ? ' (stops activation, not a run that is already live)' : ''),
208
+ (stopsActivationOnly && !spentRunBudget
209
+ ? ' (stops activation, not a run that is already live)'
210
+ : '') +
211
+ (spentRunBudget ? ' (stops agent turns, not activation)' : ''),
199
212
  ];
200
213
  if (hasNote) {
201
214
  lines.push(` ${String(note).trim()}`);
@@ -396,18 +409,9 @@ class DutiesPreflight extends base_command_1.BaseCommand {
396
409
  }
397
410
  if (report.capabilities?.length) {
398
411
  this.log('\nWhere access comes from:');
399
- const sourceLabels = {
400
- event_payload: 'Event facts',
401
- platform_grant: 'Platform-attested access',
402
- local_harness: 'This machine’s tooling',
403
- cloud_runtime: 'Runtime-scoped access',
404
- };
405
412
  for (const capability of report.capabilities) {
406
- this.log(` ${sourceLabels[capability.source]} · ${capability.provider} · ${capability.capability}${capability.scope ? ` · ${capability.scope}` : ''}: ${(0, preflight_copy_1.capabilityStatusLabel)(capability)}`);
407
- if (capability.testedAt)
408
- this.log(` Tested: ${capability.testedAt}${capability.expiresAt ? ` · expires ${capability.expiresAt}` : ''}`);
409
- if (capability.attestation === 'machine')
410
- this.log(' Machine-attested; not platform-attested.');
413
+ for (const line of (0, preflight_copy_1.capabilityLines)(capability))
414
+ this.log(line);
411
415
  }
412
416
  }
413
417
  for (const line of nextRunsLines(report, activation === true))