@skrr-ai/cli 0.1.151 → 0.1.153

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 (76) hide show
  1. package/dist/commands/agent/message/send.d.ts +3 -1
  2. package/dist/commands/agent/message/send.js +52 -1
  3. package/dist/commands/agents/always-on/held-messages.d.ts +22 -0
  4. package/dist/commands/agents/always-on/held-messages.js +62 -0
  5. package/dist/commands/agents/always-on/release-run.d.ts +37 -0
  6. package/dist/commands/agents/always-on/release-run.js +92 -0
  7. package/dist/commands/agents/always-on/status.js +5 -0
  8. package/dist/commands/agents/chat.d.ts +3 -0
  9. package/dist/commands/agents/chat.js +27 -0
  10. package/dist/commands/agents/plan-day.d.ts +3 -0
  11. package/dist/commands/agents/plan-day.js +31 -8
  12. package/dist/commands/agents/show.d.ts +3 -0
  13. package/dist/commands/agents/show.js +59 -3
  14. package/dist/commands/agents/triggers/list.js +2 -1
  15. package/dist/commands/balance/usage/breakdown.d.ts +1 -1
  16. package/dist/commands/balance/usage/breakdown.js +22 -6
  17. package/dist/commands/balance/usage/events.d.ts +3 -2
  18. package/dist/commands/balance/usage/events.js +34 -7
  19. package/dist/commands/duties/create.js +24 -9
  20. package/dist/commands/duties/export.js +2 -1
  21. package/dist/commands/duties/observation/summary.js +25 -3
  22. package/dist/commands/duties/preflight.js +17 -0
  23. package/dist/commands/duties/update.d.ts +1 -0
  24. package/dist/commands/duties/update.js +87 -66
  25. package/dist/commands/goals/plan-now.js +1 -0
  26. package/dist/commands/goals/planner-compare.js +11 -0
  27. package/dist/commands/harnesses/list.d.ts +2 -1
  28. package/dist/commands/harnesses/list.js +7 -5
  29. package/dist/commands/harnesses/models.js +1 -1
  30. package/dist/commands/harnesses/quota.d.ts +9 -11
  31. package/dist/commands/harnesses/quota.js +83 -18
  32. package/dist/commands/harnesses/show.js +1 -1
  33. package/dist/commands/harnesses/usage.d.ts +19 -0
  34. package/dist/commands/harnesses/usage.js +27 -7
  35. package/dist/commands/memory/topics/create.js +4 -1
  36. package/dist/commands/tokens/create.d.ts +3 -4
  37. package/dist/commands/tokens/create.js +20 -7
  38. package/dist/commands/triggers/fire-detail.js +19 -0
  39. package/dist/commands/triggers/preflight.js +9 -2
  40. package/dist/generated/agent-guides.json +35 -35
  41. package/dist/lib/agent-model-check.js +3 -1
  42. package/dist/lib/agentic-stream.js +6 -7
  43. package/dist/lib/balance.d.ts +5 -2
  44. package/dist/lib/balance.js +26 -0
  45. package/dist/lib/config.d.ts +1 -1
  46. package/dist/lib/config.js +1 -0
  47. package/dist/lib/duties.d.ts +5 -0
  48. package/dist/lib/duties.js +75 -1
  49. package/dist/lib/duty-event-wakes.js +6 -3
  50. package/dist/lib/duty-loop-status.js +26 -2
  51. package/dist/lib/duty-product.js +4 -1
  52. package/dist/lib/harness-labels.d.ts +1 -0
  53. package/dist/lib/harness-labels.js +4 -0
  54. package/dist/lib/harnesses.d.ts +35 -0
  55. package/dist/lib/harnesses.js +8 -0
  56. package/dist/lib/held-messages.d.ts +11 -0
  57. package/dist/lib/held-messages.js +93 -0
  58. package/dist/lib/machines.d.ts +2 -1
  59. package/dist/lib/machines.js +2 -2
  60. package/dist/lib/message-intent.d.ts +15 -0
  61. package/dist/lib/publicEndpoints.generated.d.ts +4 -0
  62. package/dist/lib/publicEndpoints.generated.js +4 -0
  63. package/dist/lib/roles.d.ts +1 -1
  64. package/dist/lib/schedule.d.ts +1 -0
  65. package/dist/lib/schedule.js +4 -4
  66. package/dist/lib/triggers.d.ts +15 -3
  67. package/dist/lib/triggers.js +57 -6
  68. package/dist/lib/update-check.d.ts +1 -1
  69. package/dist/lib/update-check.js +21 -10
  70. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/dutyExecutionContract.d.ts +1 -1
  71. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/dutyExecutionContract.js +1 -1
  72. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/dutyExecutionContract.d.ts +1 -1
  73. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/dutyExecutionContract.js +1 -1
  74. package/dist/node_modules/@skrr-ai/data-provider/index.js +7609 -7567
  75. package/oclif.manifest.json +229 -17
  76. package/package.json +4 -3
@@ -1,7 +1,7 @@
1
1
  import { type EntityEmbed } from '@skrr-ai/data-provider';
2
2
  import { BaseCommand } from '../../../base-command';
3
3
  import { type ResolvedAgentIdentity } from '../../../lib/agent-resolver';
4
- import { type CanonicalMessageDestination, type CanonicalMessageIntentRequest, type CanonicalMessageIntentResponse, type CommunicationPresentation } from '../../../lib/message-intent';
4
+ import { type CanonicalMessageDestination, type CanonicalMessageIntentRequest, type CanonicalMessageIntentResponse, type CommunicationPresentation, type OneVoiceOutcome } from '../../../lib/message-intent';
5
5
  import { type WireEmbedRejection } from '../../../lib/entity-embeds';
6
6
  /**
7
7
  * A reading-comfort prompt, not a protocol limit. The Gateway deliberately
@@ -60,6 +60,8 @@ export type CanonicalIntentEnvelope = {
60
60
  initiativeId?: string;
61
61
  /** The owner replied after this update began — withhold the tail. */
62
62
  ownerInterjected?: boolean;
63
+ /** Whether One Voice counted this message against the owner's attention budget (OSK-22367). */
64
+ oneVoice?: OneVoiceOutcome;
63
65
  };
64
66
  };
65
67
  /**
@@ -479,6 +479,7 @@ class AgentMessageSend extends base_command_1.BaseCommand {
479
479
  retryable: result.retryable,
480
480
  initiativeId: result.initiativeId,
481
481
  ownerInterjected: result.ownerInterjected,
482
+ oneVoice: result.oneVoice,
482
483
  },
483
484
  });
484
485
  }
@@ -1227,7 +1228,57 @@ function formatEnvelope(envelope) {
1227
1228
  ? '; reach=user-controlled; presentation=user-controlled'
1228
1229
  : ''}]`
1229
1230
  : '';
1230
- return `Agent message intent for ${envelope.agent.id} → ${destination}: ${status}${suffix}.${presentation}`;
1231
+ const consequence = STATUS_CONSEQUENCE[status];
1232
+ return `Agent message intent for ${envelope.agent.id} → ${destination}: ${status}${suffix}.${presentation}${describeOneVoice(envelope.intent.oneVoice)}${consequence ? ` ${consequence}` : ''}`;
1233
+ }
1234
+ /**
1235
+ * What a status other than `delivered` means for the sender, in the words of
1236
+ * `skrr guide communication delivery-statuses` (OSK-23276). The exit code is 0 for
1237
+ * several of these on purpose (the platform still owns the outcome), so the exit code
1238
+ * cannot say "this did not reach the owner" and the text has to. It is appended after
1239
+ * the existing line, so anything that reads the old prefix keeps working, and `--json`
1240
+ * is unchanged. A status with no entry prints nothing extra rather than a guess.
1241
+ */
1242
+ const STATUS_CONSEQUENCE = {
1243
+ submitted: 'Recorded and not dispatched yet; the platform still owns it. Do not resend.',
1244
+ held: 'Not delivered yet: policy is withholding it and it may still be delivered. Do not resend.',
1245
+ re_evaluation: 'Being re-checked against policy; the platform still owns it. Do not resend.',
1246
+ approval_required: "Not delivered yet: it is waiting for the owner's approval. Do not resend.",
1247
+ authorized: 'Cleared for dispatch; the platform still owns it. Do not resend.',
1248
+ dispatching: 'Being delivered right now. Do not resend.',
1249
+ transport_failed: 'Delivery errored; retryable and retryAfter in --json say whether to try again.',
1250
+ dropped: 'Will not be delivered. Read the reason and change the request before resending.',
1251
+ expired: 'It outlived its window before delivery.',
1252
+ cancelled: 'It was withdrawn before delivery.',
1253
+ duplicate: 'Nothing new was sent: this key already carried this identical update, so the earlier send stands.',
1254
+ accepted: 'An earlier send already delivered this update.',
1255
+ failed: 'The transport could not deliver it; retryable in --json says whether a retry can help.',
1256
+ queued_offline: 'Held by the local daemon until it can reach the platform; still in flight, do not resend.',
1257
+ refused: 'A guard declined the send; the reason names it.',
1258
+ unknown: 'The transport could not certify the outcome; do not assume it arrived or that it did not.',
1259
+ };
1260
+ /**
1261
+ * What the sender is told about the owner's attention budget (OSK-22367). Silence used to cover
1262
+ * three different facts: counted, not counted by design, and not counted because the write failed.
1263
+ * Only the last one is a defect, and it is spelled differently so a skim does not read it as the
1264
+ * second.
1265
+ */
1266
+ const ONE_VOICE_REASON_TEXT = {
1267
+ interactive_session: 'an interactive session, so the owner is present',
1268
+ not_owner_attention_destination: "not a destination that spends the owner's attention",
1269
+ };
1270
+ function describeOneVoice(outcome) {
1271
+ if (!outcome)
1272
+ return '';
1273
+ if (outcome.counted)
1274
+ return ' One Voice: counted.';
1275
+ if (outcome.reason === 'accounting_failed') {
1276
+ return ' One Voice: NOT counted (accounting failed; heuristic producers may not back off for this message).';
1277
+ }
1278
+ const reason = outcome.reason
1279
+ ? (ONE_VOICE_REASON_TEXT[outcome.reason] ?? outcome.reason)
1280
+ : 'no reason given';
1281
+ return ` One Voice: not counted (${reason}).`;
1231
1282
  }
1232
1283
  function describeDestination(destination) {
1233
1284
  if (destination.kind === 'agent_email')
@@ -0,0 +1,22 @@
1
+ import { BaseCommand } from '../../../base-command';
2
+ /**
3
+ * `skrr agents always-on held-messages <agent-id>` — list the session messages the delivery policy
4
+ * is holding for an agent (`GET /api/agents/:id/always-on/held-messages`).
5
+ *
6
+ * Metadata only: an id, when it was submitted, when the hold expires and a neutral reason. The API
7
+ * never returns message text, and a held message follows the delivery policy with no manual release,
8
+ * so this command is a read and has no sibling that decides one. (The `ask_first` queue is a
9
+ * different thing: `skrr agent message pending|approve|decline`.)
10
+ */
11
+ export default class AgentsAlwaysOnHeldMessages extends BaseCommand {
12
+ static description: string;
13
+ static examples: string[];
14
+ static args: {
15
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
16
+ };
17
+ static flags: {
18
+ cursor: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
20
+ };
21
+ run(): Promise<void>;
22
+ }
@@ -0,0 +1,62 @@
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 held_messages_1 = require("../../../lib/held-messages");
7
+ /**
8
+ * `skrr agents always-on held-messages <agent-id>` — list the session messages the delivery policy
9
+ * is holding for an agent (`GET /api/agents/:id/always-on/held-messages`).
10
+ *
11
+ * Metadata only: an id, when it was submitted, when the hold expires and a neutral reason. The API
12
+ * never returns message text, and a held message follows the delivery policy with no manual release,
13
+ * so this command is a read and has no sibling that decides one. (The `ask_first` queue is a
14
+ * different thing: `skrr agent message pending|approve|decline`.)
15
+ */
16
+ class AgentsAlwaysOnHeldMessages extends base_command_1.BaseCommand {
17
+ static description = 'List the session messages held by delivery policy for an agent (metadata only; message text is never returned)';
18
+ static examples = [
19
+ '<%= config.bin %> agents always-on held-messages <agent-id>',
20
+ '<%= config.bin %> agents always-on held-messages <agent-id> --json',
21
+ '<%= config.bin %> agents always-on held-messages <agent-id> --cursor <nextCursor>',
22
+ ];
23
+ static args = {
24
+ id: core_1.Args.string({ description: 'Agent ID', required: true, ignoreStdin: true }),
25
+ };
26
+ static flags = {
27
+ cursor: core_1.Flags.string({ description: "Cursor from a previous page's nextCursor" }),
28
+ json: core_1.Flags.boolean({ description: 'Output the server response as JSON' }),
29
+ };
30
+ async run() {
31
+ this.requireAuth();
32
+ const { args, flags } = await this.parse(AgentsAlwaysOnHeldMessages);
33
+ let response;
34
+ try {
35
+ response = await data_provider_1.dataService.getAlwaysOnHeldMessages(args.id, flags.cursor);
36
+ }
37
+ catch (err) {
38
+ this.handleApiError(err);
39
+ }
40
+ // A body that is not the documented shape is an error, not an empty list: "none held" is the
41
+ // reading that would reassure about exactly what this command exists to show.
42
+ const result = (0, held_messages_1.parseHeldOwnerMessages)(response);
43
+ if (!result) {
44
+ this.failWithCliError({
45
+ message: 'The server returned a held-messages response this CLI does not recognise.',
46
+ code: 'HELD_MESSAGES_RESPONSE_UNEXPECTED',
47
+ exit: 1,
48
+ retryable: false,
49
+ details: {
50
+ suggestion: 'Update skrr, and check that the server is a release that serves GET /api/agents/:id/always-on/held-messages.',
51
+ },
52
+ });
53
+ }
54
+ if (flags.json) {
55
+ this.log(JSON.stringify(response, null, 2));
56
+ return;
57
+ }
58
+ for (const line of (0, held_messages_1.heldMessageLines)(args.id, result))
59
+ this.log(line);
60
+ }
61
+ }
62
+ exports.default = AgentsAlwaysOnHeldMessages;
@@ -0,0 +1,37 @@
1
+ import { BaseCommand } from '../../../base-command';
2
+ /**
3
+ * `skrr agents always-on release-run <agent-id> <run-id>` — the owner lets ONE queued Run start although the machine that
4
+ * ran it never confirmed it stopped, via `POST /api/agents/:id/always-on/runs/:runId/stop-release` (OSK-22700).
5
+ *
6
+ * A Run whose daemon was killed mid-turn is queued again and refused as `previous_execution_stopping`: the platform will
7
+ * not start a second provider request while the first may still run. `skrr triggers fire-detail` shows that wait and the
8
+ * generation to pass here. Releasing is the one exit that does not wait for the machine, so it costs something the
9
+ * platform cannot take back: the provider may receive a SECOND request for the same turn.
10
+ *
11
+ * So the command refuses to go anywhere without `--accept-duplicate-risk`: with the flag missing it prints the risk and
12
+ * exits non-zero WITHOUT calling the API. With it, the server still decides: it requires you to be the Agent's owner
13
+ * signed in as a person (`skrr login`; a personal access token never reaches the route, and an Agent's CLI session, a workload
14
+ * credential and a daemon are refused), checks the generation you read, and releases only a queued, non-Task Run that really
15
+ * is held by this check. Nothing about who you are or which dispatch is released is taken from the command line.
16
+ *
17
+ * What this does NOT guarantee, and the help says so: your own `skrr login` IS you to the server, so a program running on your
18
+ * machine with your login (a coding agent, a script) passes every check above. `--accept-duplicate-risk` is the flag a person
19
+ * adds after reading the risk; it is friction, not a barrier, and nothing on the server can tell a person typing it from a
20
+ * script. That is also why `triggers fire-detail` prints this command WITHOUT the flag. Do not hand your login to a program
21
+ * you would not trust to make this decision; give it its own delegated session, which the server refuses.
22
+ */
23
+ export default class AgentsAlwaysOnReleaseRun extends BaseCommand {
24
+ static description: string;
25
+ static examples: string[];
26
+ static args: {
27
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
28
+ runId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
29
+ };
30
+ static flags: {
31
+ 'expected-generation': import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
32
+ 'accept-duplicate-risk': import("@oclif/core/interfaces").BooleanFlag<boolean>;
33
+ reason: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
34
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
35
+ };
36
+ run(): Promise<void>;
37
+ }
@@ -0,0 +1,92 @@
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
+ /**
7
+ * `skrr agents always-on release-run <agent-id> <run-id>` — the owner lets ONE queued Run start although the machine that
8
+ * ran it never confirmed it stopped, via `POST /api/agents/:id/always-on/runs/:runId/stop-release` (OSK-22700).
9
+ *
10
+ * A Run whose daemon was killed mid-turn is queued again and refused as `previous_execution_stopping`: the platform will
11
+ * not start a second provider request while the first may still run. `skrr triggers fire-detail` shows that wait and the
12
+ * generation to pass here. Releasing is the one exit that does not wait for the machine, so it costs something the
13
+ * platform cannot take back: the provider may receive a SECOND request for the same turn.
14
+ *
15
+ * So the command refuses to go anywhere without `--accept-duplicate-risk`: with the flag missing it prints the risk and
16
+ * exits non-zero WITHOUT calling the API. With it, the server still decides: it requires you to be the Agent's owner
17
+ * signed in as a person (`skrr login`; a personal access token never reaches the route, and an Agent's CLI session, a workload
18
+ * credential and a daemon are refused), checks the generation you read, and releases only a queued, non-Task Run that really
19
+ * is held by this check. Nothing about who you are or which dispatch is released is taken from the command line.
20
+ *
21
+ * What this does NOT guarantee, and the help says so: your own `skrr login` IS you to the server, so a program running on your
22
+ * machine with your login (a coding agent, a script) passes every check above. `--accept-duplicate-risk` is the flag a person
23
+ * adds after reading the risk; it is friction, not a barrier, and nothing on the server can tell a person typing it from a
24
+ * script. That is also why `triggers fire-detail` prints this command WITHOUT the flag. Do not hand your login to a program
25
+ * you would not trust to make this decision; give it its own delegated session, which the server refuses.
26
+ */
27
+ class AgentsAlwaysOnReleaseRun extends base_command_1.BaseCommand {
28
+ static description = 'Let one queued Run start although the machine that ran it never confirmed it stopped (Agent owner only; the provider may receive a second request for the same turn). Release it only when its machine is online and ready: the claim spends the release even if the new attempt then parks before it reaches a machine, and the Run then needs another. It runs as you, so a program using your login can do this too: --accept-duplicate-risk is a deliberate step, not a barrier';
29
+ static examples = [
30
+ '<%= config.bin %> triggers fire-detail <trigger-id> <fire-id> # shows the Run, the wait and the generation',
31
+ '<%= config.bin %> agents always-on release-run <agent-id> <run-id> --expected-generation 3 --accept-duplicate-risk',
32
+ '<%= config.bin %> agents always-on release-run <agent-id> <run-id> --expected-generation 3 --accept-duplicate-risk --reason "Laptop was destroyed" --json',
33
+ ];
34
+ static args = {
35
+ id: core_1.Args.string({ description: 'Agent ID', required: true, ignoreStdin: true }),
36
+ runId: core_1.Args.string({
37
+ description: 'Run ID (the `Run:` line of `triggers fire-detail`)',
38
+ required: true,
39
+ ignoreStdin: true,
40
+ }),
41
+ };
42
+ static flags = {
43
+ 'expected-generation': core_1.Flags.integer({
44
+ min: 0,
45
+ required: true,
46
+ description: 'The generation `triggers fire-detail` printed for this wait. A stale one is refused, so you cannot release a wait you did not read.',
47
+ }),
48
+ 'accept-duplicate-risk': core_1.Flags.boolean({
49
+ description: 'I understand the provider may receive a second request for the same turn. Required: without it nothing is sent.',
50
+ }),
51
+ reason: core_1.Flags.string({
52
+ description: `Why you know the machine is gone (up to ${data_provider_1.RUN_STOP_RELEASE.reasonMaxLength} characters), kept on the Run`,
53
+ }),
54
+ json: core_1.Flags.boolean({ description: 'Print the server answer as JSON' }),
55
+ };
56
+ async run() {
57
+ this.requireAuth();
58
+ const { args, flags } = await this.parse(AgentsAlwaysOnReleaseRun);
59
+ if (!flags['accept-duplicate-risk']) {
60
+ // Before any API call: the cost is named first, and a script that forgot the flag fails instead of releasing.
61
+ this.failWithCliError({
62
+ message: `${data_provider_1.RUN_STOP_RELEASE_RISK}\n` +
63
+ '→ If you are sure, run the same command again with --accept-duplicate-risk.',
64
+ code: 'DUPLICATE_RISK_NOT_ACCEPTED',
65
+ exit: 1,
66
+ retryable: false,
67
+ });
68
+ }
69
+ let result;
70
+ try {
71
+ result = await data_provider_1.dataService.releaseAlwaysOnRunStop(args.id, args.runId, {
72
+ expectedGeneration: flags['expected-generation'],
73
+ acknowledged: data_provider_1.RUN_STOP_RELEASE.acknowledged,
74
+ ...(flags.reason ? { reason: flags.reason } : {}),
75
+ });
76
+ }
77
+ catch (err) {
78
+ // The server's refusals carry their own sentence and `code` (`not_owner`, `generation_conflict`, ...), which is shown as is.
79
+ this.handleApiError(err);
80
+ }
81
+ if (flags.json) {
82
+ this.printJsonResult(result);
83
+ return;
84
+ }
85
+ // `result.message` is the server's account (the risk, what a stored result does, that the Run stays under the stop check).
86
+ this.log(result.alreadyReleased
87
+ ? `Run ${result.runId} was already released (generation ${result.generation}).`
88
+ : `Released run ${result.runId} of agent ${result.agentId} (generation ${result.generation}).`);
89
+ this.log(result.message);
90
+ }
91
+ }
92
+ exports.default = AgentsAlwaysOnReleaseRun;
@@ -116,6 +116,11 @@ class AgentsAlwaysOnStatus extends base_command_1.BaseCommand {
116
116
  else {
117
117
  this.log('Checks/Runs: unavailable');
118
118
  }
119
+ // Queued Runs held back by a refused claim (for example waiting for the previous executor's stop
120
+ // receipt) are otherwise indistinguishable from Runs behind others in the queue (OSK-22700).
121
+ const waitingOnClaim = (0, data_provider_1.describeRunClaimRefusalSummary)(cr?.claimRefusals);
122
+ if (waitingOnClaim)
123
+ this.log(`Waiting: ${waitingOnClaim}`);
119
124
  if (status.messaging?.degraded) {
120
125
  const reasons = (status.messaging.degradedReasons || []).join(', ') || 'unknown';
121
126
  this.log(`Messaging: degraded (${reasons})`);
@@ -208,12 +208,15 @@ export declare function noOutputFailureMessage(input: {
208
208
  * the generic sentence.
209
209
  */
210
210
  export declare function agentRunFailureMessage(result: Pick<AgenticStreamResult, 'lastEvent'>): string;
211
+ /** The acceptance response is a plan, not proof of the eventual executor. */
212
+ export declare function admittedRouting(runtime: unknown): Record<string, unknown> | undefined;
211
213
  export declare function noStreamJsonPayload(input: {
212
214
  result: AgenticStreamResult;
213
215
  conversationId?: string;
214
216
  agentId: string;
215
217
  baseURL: string;
216
218
  threadRootMessageId?: string;
219
+ admittedRuntime?: unknown;
217
220
  }): Record<string, unknown>;
218
221
  /**
219
222
  * OSK-4854 — the human header printed `Streaming agent <id> (<uuid>)` with the
@@ -14,6 +14,7 @@ exports.interruptAction = interruptAction;
14
14
  exports.inspectTurnCommand = inspectTurnCommand;
15
15
  exports.noOutputFailureMessage = noOutputFailureMessage;
16
16
  exports.agentRunFailureMessage = agentRunFailureMessage;
17
+ exports.admittedRouting = admittedRouting;
17
18
  exports.noStreamJsonPayload = noStreamJsonPayload;
18
19
  exports.chatStreamHeaderLines = chatStreamHeaderLines;
19
20
  exports.daemonPinFields = daemonPinFields;
@@ -325,8 +326,25 @@ function noOutputFailureMessage(input) {
325
326
  function agentRunFailureMessage(result) {
326
327
  return (0, agentic_stream_1.terminalFailureMessage)(result.lastEvent) ?? 'Agent run failed';
327
328
  }
329
+ /** The acceptance response is a plan, not proof of the eventual executor. */
330
+ function admittedRouting(runtime) {
331
+ if (!runtime || typeof runtime !== 'object' || Array.isArray(runtime))
332
+ return undefined;
333
+ const plan = runtime.executionPlan;
334
+ if (!plan || typeof plan !== 'object' || Array.isArray(plan))
335
+ return undefined;
336
+ const { selectedKind, selectedExecutionSelector, fallbackUsed } = plan;
337
+ const routing = {
338
+ ...(typeof selectedKind === 'string' && selectedKind ? { selectedKind } : {}),
339
+ ...(typeof selectedExecutionSelector === 'string' && selectedExecutionSelector
340
+ ? { selectedExecutionSelector } : {}),
341
+ ...(typeof fallbackUsed === 'boolean' ? { fallbackUsed } : {}),
342
+ };
343
+ return Object.keys(routing).length ? routing : undefined;
344
+ }
328
345
  function noStreamJsonPayload(input) {
329
346
  const { result, conversationId, agentId, baseURL, threadRootMessageId } = input;
347
+ const routing = admittedRouting(input.admittedRuntime);
330
348
  return {
331
349
  mode: 'no-stream',
332
350
  executed: true,
@@ -345,6 +363,13 @@ function noStreamJsonPayload(input) {
345
363
  }
346
364
  : {}),
347
365
  response: result.text,
366
+ ...(routing ? { admittedRouting: routing } : {}),
367
+ // A terminal worker result can name its producer after dispatch. This is
368
+ // distinct from the initial routing plan and from billing settlement.
369
+ ...(result.lastEvent?.executionAttribution &&
370
+ typeof result.lastEvent.executionAttribution === 'object'
371
+ ? { executionAttribution: result.lastEvent.executionAttribution }
372
+ : {}),
348
373
  // The model a local harness reported running (OSK-12111). Absent on a
349
374
  // cloud turn and on a harness that reports none.
350
375
  ...(typeof result.lastEvent?.harnessModel === 'string' && result.lastEvent.harnessModel
@@ -854,6 +879,7 @@ class AgentsChat extends base_command_1.BaseCommand {
854
879
  conversationId: started.conversationId,
855
880
  ...(flags['thread-root'] ? { threadRootMessageId: flags['thread-root'] } : {}),
856
881
  responseMessageId: started.responseMessageId,
882
+ ...(admittedRouting(started.runtime) ? { admittedRouting: admittedRouting(started.runtime) } : {}),
857
883
  // OSK-13599 — where the turn runs and who chose it, when the server
858
884
  // says (`request` | `agent_home`); absent against an older server.
859
885
  ...(workspaceDefault === 'supported'
@@ -1100,6 +1126,7 @@ class AgentsChat extends base_command_1.BaseCommand {
1100
1126
  // A real executed turn — the metadata says so, unlike `--quick`.
1101
1127
  this.log(JSON.stringify(noStreamJsonPayload({
1102
1128
  result,
1129
+ admittedRuntime: started.runtime,
1103
1130
  conversationId: started.conversationId,
1104
1131
  agentId: args.agentId,
1105
1132
  baseURL: this.cliConfig.baseURL,
@@ -1,4 +1,7 @@
1
1
  import { BaseCommand } from '../../base-command';
2
+ import { type SmartSchedulePlanRequest } from '../../lib/schedule';
3
+ /** Keep historical failures distinct from a newly requested plan. */
4
+ export declare function previousPlanNotice(request: SmartSchedulePlanRequest, regenerating: boolean): string;
2
5
  /**
3
6
  * `skrr agents plan-day <agent-id>` — Smart Schedule ("Plan my day").
4
7
  *
@@ -1,9 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.previousPlanNotice = previousPlanNotice;
3
4
  const core_1 = require("@oclif/core");
4
5
  const base_command_1 = require("../../base-command");
5
6
  const format_1 = require("../../lib/format");
6
7
  const schedule_1 = require("../../lib/schedule");
8
+ /** Keep historical failures distinct from a newly requested plan. */
9
+ function previousPlanNotice(request, regenerating) {
10
+ if (!regenerating)
11
+ return (0, schedule_1.describePlanRequest)(request) ?? '';
12
+ if (request.state === 'unknown') {
13
+ return 'An earlier planning attempt did not report a result and may still finish. A new request could produce a second draft.';
14
+ }
15
+ return 'A previous planning attempt failed. The new request may have a different result.';
16
+ }
7
17
  /**
8
18
  * `skrr agents plan-day <agent-id>` — Smart Schedule ("Plan my day").
9
19
  *
@@ -26,7 +36,7 @@ const schedule_1 = require("../../lib/schedule");
26
36
  * `todos list` use, so one agent-day is one zone across the commands.
27
37
  */
28
38
  class AgentsPlanDay extends base_command_1.BaseCommand {
29
- static description = "Smart Schedule an agent's day: propose a plan, then approve or dismiss it";
39
+ static description = "Smart Schedule an agent's day: propose a plan, then approve or dismiss it. Tasks are checked only in a Space led by the agent; unscoped tasks are not checked. After a failed or unknown request, use --regenerate to explicitly request another plan.";
30
40
  static examples = [
31
41
  '<%= config.bin %> agents plan-day <agent-id>',
32
42
  '<%= config.bin %> agents plan-day <agent-id> --approve',
@@ -230,7 +240,7 @@ class AgentsPlanDay extends base_command_1.BaseCommand {
230
240
  message: (0, schedule_1.describePlanRequest)(request) ?? 'The planning request failed.',
231
241
  code: 'SMART_SCHEDULE_PLAN_FAILED',
232
242
  exit: 1,
233
- retryable: true,
243
+ retryable: !['INFERENCE_CREDENTIAL_UNAVAILABLE', 'INFERENCE_TARGET_UNAVAILABLE'].includes(request.failure?.code ?? ''),
234
244
  details: { agentId, planRequest: request },
235
245
  });
236
246
  }
@@ -342,9 +352,13 @@ class AgentsPlanDay extends base_command_1.BaseCommand {
342
352
  proposal = waited.proposal;
343
353
  }
344
354
  else if (waited.outcome === 'unknown') {
345
- this.warn('That request stopped reporting and may have been interrupted, so it no longer blocks planning.');
346
- before = { ...before, planRequest: null };
347
- proposal = before.proposal;
355
+ this.failWithCliError({
356
+ message: `The earlier request stopped reporting and may still finish. Check \`${this.config.bin} agents schedule-trace ${agentId}\` before explicitly requesting a new plan with \`--regenerate "..."\`.`,
357
+ code: 'SMART_SCHEDULE_PREVIOUS_OUTCOME_UNKNOWN',
358
+ exit: 1,
359
+ retryable: false,
360
+ details: { agentId, planRequest: before.planRequest },
361
+ });
348
362
  }
349
363
  else {
350
364
  this.failWithCliError({
@@ -361,12 +375,21 @@ class AgentsPlanDay extends base_command_1.BaseCommand {
361
375
  // Recover a pending draft unless the caller explicitly wants a fresh one.
362
376
  proposal = before?.proposal ?? null;
363
377
  }
364
- // A planning attempt that FAILED is history the person should see, but not a
365
- // reason to refuse: they asked to plan, and the next attempt may work.
378
+ // A bare read after failure must not silently start another billable run.
379
+ // Explicit regeneration remains available after the user checks the outcome.
366
380
  let priorAttempt = null;
367
381
  if (before?.planRequest?.state === 'failed' || before?.planRequest?.state === 'unknown') {
368
382
  priorAttempt = before.planRequest;
369
- this.warn((0, schedule_1.describePlanRequest)(priorAttempt) ?? '');
383
+ if (!proposal && flags.regenerate === undefined) {
384
+ this.failWithCliError({
385
+ message: `${(0, schedule_1.describePlanRequest)(priorAttempt) ?? 'The previous planning request did not complete.'} To request another plan, explicitly run \`${this.config.bin} agents plan-day ${agentId} --regenerate "..."\`.`,
386
+ code: 'SMART_SCHEDULE_PREVIOUS_REQUEST_NOT_COMPLETED',
387
+ exit: 1,
388
+ retryable: false,
389
+ details: { agentId, planRequest: priorAttempt },
390
+ });
391
+ }
392
+ this.warn(previousPlanNotice(priorAttempt, flags.regenerate !== undefined));
370
393
  }
371
394
  const showingPending = proposal !== null;
372
395
  if (!proposal) {
@@ -22,9 +22,12 @@ export declare function agentToneLine(agent: {
22
22
  * resolution, and says that is all it knows.
23
23
  */
24
24
  export declare function agentPermissionLines(agent: Record<string, unknown>, harness: string): string[];
25
+ export declare function agentHarnessStatus(status: unknown, presence: unknown): string | null;
25
26
  /** Text rendering is deliberately based on the server projection, with a
26
27
  * storage-shape fallback while all stored policies are migrated. */
27
28
  export declare function agentExecutionOrderLines(agent: Record<string, unknown>): string[];
29
+ /** Saved policy, not a prediction of availability, authorization or cost. */
30
+ export declare function agentFallbackPolicyLines(agent: Record<string, unknown>): string[];
28
31
  export default class AgentsShow extends BaseCommand {
29
32
  static description: string;
30
33
  static examples: string[];
@@ -2,7 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.agentToneLine = agentToneLine;
4
4
  exports.agentPermissionLines = agentPermissionLines;
5
+ exports.agentHarnessStatus = agentHarnessStatus;
5
6
  exports.agentExecutionOrderLines = agentExecutionOrderLines;
7
+ exports.agentFallbackPolicyLines = agentFallbackPolicyLines;
6
8
  const core_1 = require("@oclif/core");
7
9
  const data_provider_1 = require("@skrr-ai/data-provider");
8
10
  const base_command_1 = require("../../base-command");
@@ -83,6 +85,13 @@ function agentPermissionLines(agent, harness) {
83
85
  lines.push(`${pad}A turn's own mode (\`agents chat --permission-mode\`) overrides this for that turn.`);
84
86
  return lines;
85
87
  }
88
+ function agentHarnessStatus(status, presence) {
89
+ if (presence === 'unconfirmed')
90
+ return 'connection to this server unconfirmed';
91
+ if (presence === 'unknown')
92
+ return 'connection status unknown';
93
+ return typeof status === 'string' && status ? status : null;
94
+ }
86
95
  /** Text rendering is deliberately based on the server projection, with a
87
96
  * storage-shape fallback while all stored policies are migrated. */
88
97
  function agentExecutionOrderLines(agent) {
@@ -120,8 +129,15 @@ function agentExecutionOrderLines(agent) {
120
129
  ...entries.map((entry, index) => {
121
130
  const position = Number.isInteger(entry.position) ? entry.position : index + 1;
122
131
  const target = typeof entry.name === 'string' && entry.name ? entry.name : entry.selector;
132
+ // The name is not a unique registration. Keep the configured selector
133
+ // visible even when the server resolves a friendly display name.
134
+ const selector = typeof entry.selector === 'string' && entry.selector &&
135
+ entry.selector !== target && !isSynthetic(entry)
136
+ ? ` [selector: ${entry.selector}]`
137
+ : '';
123
138
  const label = typeof entry.label === 'string' && entry.label ? ` — ${entry.label}` : '';
124
- const status = typeof entry.status === 'string' ? ` (${entry.status})` : '';
139
+ const statusLabel = agentHarnessStatus(entry.status, entry.presenceStatus);
140
+ const status = statusLabel ? ` (${statusLabel})` : '';
125
141
  // An UNRESOLVABLE target used to render as an absence — no name, no
126
142
  // `(online)`/`(offline)` marker — on a line that otherwise looks like a
127
143
  // normal one. `attach-harness` accepts an id that resolves to nothing
@@ -137,7 +153,7 @@ function agentExecutionOrderLines(agent) {
137
153
  !isSynthetic(entry)
138
154
  ? ' [!] no such harness — nothing is registered under this id'
139
155
  : '';
140
- return ` ${position}. ${target || '(invalid target)'}${status}${label}${unresolvable}`;
156
+ return ` ${position}. ${target || '(invalid target)'}${status}${selector}${label}${unresolvable}`;
141
157
  }),
142
158
  ];
143
159
  }
@@ -150,6 +166,42 @@ function isSynthetic(entry) {
150
166
  const selector = typeof entry.selector === 'string' ? entry.selector : '';
151
167
  return selector.startsWith('__oversky_') || selector.startsWith('sbs_');
152
168
  }
169
+ /** Saved policy, not a prediction of availability, authorization or cost. */
170
+ function agentFallbackPolicyLines(agent) {
171
+ const policy = agent.executionPolicy;
172
+ if (!policy || policy.mode !== 'ordered' || !Array.isArray(policy.targets)) {
173
+ return ['Fallback policy: not available in this response'];
174
+ }
175
+ const targets = policy.targets.filter((value) => Boolean(value && typeof value === 'object') && value.enabled !== false);
176
+ const defaults = agent.executionPolicyDefaults;
177
+ const savedConsent = typeof policy.handoverConsent === 'string' &&
178
+ ['ask', 'configured', 'permissive'].includes(policy.handoverConsent) ? policy.handoverConsent : null;
179
+ const defaultConsent = typeof defaults?.handoverConsent === 'string' ? defaults.handoverConsent : null;
180
+ const effectiveConsent = savedConsent || defaultConsent;
181
+ const consent = savedConsent || (defaultConsent ? `${defaultConsent} (server default)` : 'not explicitly saved (server default unavailable)');
182
+ const lines = [
183
+ 'Fallback policy (saved configuration; actual routing can differ):',
184
+ ` Handover consent: ${consent}`,
185
+ ];
186
+ if (effectiveConsent === 'configured')
187
+ lines.push(' Configured managed fallbacks may run; Hosted Machine also needs its acknowledgement.');
188
+ else if (effectiveConsent === 'ask')
189
+ lines.push(' Managed fallback requires approval before it can run.');
190
+ else if (effectiveConsent === 'permissive')
191
+ lines.push(' Managed fallbacks may run without a per-target acknowledgement.');
192
+ targets.forEach((target, index) => {
193
+ const selector = target.harnessId || target.machineSessionId || target.kind || '(invalid target)';
194
+ const advance = Array.isArray(target.advanceOn)
195
+ ? target.advanceOn.filter((value) => typeof value === 'string' && Boolean(value)).join(', ') || 'none'
196
+ : Array.isArray(defaults?.advanceOn) && defaults.advanceOn.every((value) => typeof value === 'string')
197
+ ? `${defaults.advanceOn.join(', ') || 'none'} (server default)`
198
+ : 'not explicitly saved (server default unavailable)';
199
+ lines.push(` ${index + 1}. ${String(selector)} — advance on: ${advance}`);
200
+ if (target.kind === 'hosted-machine')
201
+ lines.push(` Hosted Machine managed usage acknowledgement: ${target.managedUsageConsent === true ? 'yes' : target.managedUsageConsent === false ? 'no' : 'not explicitly saved'}`);
202
+ });
203
+ return lines;
204
+ }
153
205
  class AgentsShow extends base_command_1.BaseCommand {
154
206
  static description = 'Show details for a single agent';
155
207
  static examples = [
@@ -213,8 +265,12 @@ class AgentsShow extends base_command_1.BaseCommand {
213
265
  : 'unlimited'}`);
214
266
  for (const line of agentExecutionOrderLines(a))
215
267
  this.log(line);
268
+ if (flags.expanded)
269
+ for (const line of agentFallbackPolicyLines(a))
270
+ this.log(line);
216
271
  if (a.harnessName || a.harnessProvider || a.harnessStatus) {
217
- this.log(`Harness: ${a.harnessName ?? (typeof a.harnessProvider === 'string' ? (0, harness_provider_input_1.canonicalHarnessInput)(a.harnessProvider) : a.harnessProvider) ?? '-'}${a.harnessStatus ? ` (${a.harnessStatus})` : ''}`);
272
+ const harnessStatus = agentHarnessStatus(a.harnessStatus, a.harnessPresenceStatus);
273
+ this.log(`Harness: ${a.harnessName ?? (typeof a.harnessProvider === 'string' ? (0, harness_provider_input_1.canonicalHarnessInput)(a.harnessProvider) : a.harnessProvider) ?? '-'}${harnessStatus ? ` (${harnessStatus})` : ''}`);
218
274
  // On a harness, the HARNESS decides what runs and which permission modes
219
275
  // exist — `Provider` is only the cloud model contract, so an agent read
220
276
  // as "anthropic" while running Codex (OSK-12071). And the mode itself was
@@ -19,7 +19,7 @@ const triggers_1 = require("../../../lib/triggers");
19
19
  * `skrr triggers <verb> <trigger-id>` for those (the ids printed below).
20
20
  */
21
21
  class AgentsTriggersList extends base_command_1.BaseCommand {
22
- static description = 'List the universal triggers scoped to an agent';
22
+ static description = 'List directly Agent-scoped triggers; search other scopes that reference the Agent with `skrr triggers list --ref agentId=<agent-id>`';
23
23
  static examples = [
24
24
  '<%= config.bin %> agents triggers list <agent-id>',
25
25
  '<%= config.bin %> agents triggers list <agent-id> --kind schedule --enabled',
@@ -57,6 +57,7 @@ class AgentsTriggersList extends base_command_1.BaseCommand {
57
57
  this.printJsonResult((0, list_output_1.listResult)(response, 'triggers'));
58
58
  return;
59
59
  }
60
+ this.log('Showing only directly Agent-scoped triggers. To search other scopes that reference this Agent, use `skrr triggers list --ref agentId=<agent-id>`.');
60
61
  (0, triggers_1.renderTriggerList)(response.triggers ?? [], (line) => this.log(line));
61
62
  }
62
63
  }
@@ -11,4 +11,4 @@ export default class BalanceUsageBreakdown extends BaseCommand {
11
11
  };
12
12
  run(): Promise<void>;
13
13
  }
14
- export declare function renderSkyCodeUsageBreakdown(breakdown: TSkyCodeUsageBreakdown, log: (line: string) => void): void;
14
+ export declare function renderSkyCodeUsageBreakdown(breakdown: TSkyCodeUsageBreakdown, log: (line: string) => void, agentNames?: ReadonlyMap<string, string>): void;