@skrr-ai/cli 0.1.170 → 0.1.171

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.
@@ -8,6 +8,10 @@ import { BaseCommand } from '../../../base-command';
8
8
  * Duty re-decides at its next Check, from what it finds then. Closing says nothing about effects: anything the turn
9
9
  * already did stays done.
10
10
  *
11
+ * A Run that was applying its result under an effect boundary (OSK-24399 F4) is closed the same way, once the worker
12
+ * applying it has let its lease lapse: what it applied with a receipt stays applied and nothing more is applied. The
13
+ * ref then names the boundary, and the close records which effect classes its receipts had settled.
14
+ *
11
15
  * `--hold` is the ref `recovery-review <agent-id> <run-id>` prints. It binds the close to the hold you read: if the Run
12
16
  * was held again since, the server refuses. The server also requires you to be the Agent's owner signed in as a person
13
17
  * (`skrr login`; a personal access token never reaches the route), that you can see the review, and that the machine
@@ -12,13 +12,17 @@ const base_command_1 = require("../../../base-command");
12
12
  * Duty re-decides at its next Check, from what it finds then. Closing says nothing about effects: anything the turn
13
13
  * already did stays done.
14
14
  *
15
+ * A Run that was applying its result under an effect boundary (OSK-24399 F4) is closed the same way, once the worker
16
+ * applying it has let its lease lapse: what it applied with a receipt stays applied and nothing more is applied. The
17
+ * ref then names the boundary, and the close records which effect classes its receipts had settled.
18
+ *
15
19
  * `--hold` is the ref `recovery-review <agent-id> <run-id>` prints. It binds the close to the hold you read: if the Run
16
20
  * was held again since, the server refuses. The server also requires you to be the Agent's owner signed in as a person
17
21
  * (`skrr login`; a personal access token never reaches the route), that you can see the review, and that the machine
18
22
  * that ran the turn confirmed it stopped. Nothing about who you are is taken from the command line.
19
23
  */
20
24
  class AgentsAlwaysOnRecoveryClose extends base_command_1.BaseCommand {
21
- static description = 'Close one held Duty result as the Agent owner: the Run ends cancelled, its held result is not applied, and the Duty re-decides at its next Check. Its effects stay unknown';
25
+ static description = 'Close one held Duty result as the Agent owner: the Run ends cancelled, nothing more of its result is applied, and the Duty re-decides at its next Check. Effects without a receipt stay unknown';
22
26
  static examples = [
23
27
  '<%= config.bin %> agents always-on recovery-close <agent-id> <run-id> --hold <hold-ref>',
24
28
  '<%= config.bin %> agents always-on recovery-close <agent-id> <run-id> --hold <hold-ref> --json',
@@ -65,6 +65,9 @@ class AgentsAlwaysOnRecoveryReview extends base_command_1.BaseCommand {
65
65
  this.log(`Status: ${review.status}; generation: ${review.generation ?? 'unknown'}; attempt: ${review.attempt ?? 'unknown'}`);
66
66
  this.log(`Recovery: ${review.hold}; stored result: ${review.result}`);
67
67
  this.log(`Executor: ${review.executor}; effects: ${review.effects}`);
68
+ const receipts = receiptLine(review);
69
+ if (receipts)
70
+ this.log(receipts);
68
71
  this.log(INTEGRITY_CAVEAT);
69
72
  for (const line of closeLines(args.id, review))
70
73
  this.log(line);
@@ -138,9 +141,13 @@ exports.default = AgentsAlwaysOnRecoveryReview;
138
141
  * server, or a hold this server cannot close: no command is offered that would be refused.
139
142
  */
140
143
  function closeLines(agentId, review) {
144
+ // Only a server that names the receipts can close a Run at its effect boundary (OSK-24399 F4).
145
+ const boundary = review.effectReceipts !== undefined;
141
146
  if (review.close === 'available' && isNonEmptyString(review.holdRef)) {
142
147
  return [
143
- 'Close: available. Closing ends the Run without applying its held result; the Duty re-decides at its next Check.',
148
+ boundary
149
+ ? 'Close: available. Closing ends the Run: what it applied with a receipt stays applied, and nothing more of its result is applied. The Duty re-decides at its next Check.'
150
+ : 'Close: available. Closing ends the Run without applying its held result; the Duty re-decides at its next Check.',
144
151
  `→ skrr agents always-on recovery-close ${agentId} ${review.runId} --hold ${review.holdRef}`,
145
152
  ];
146
153
  }
@@ -151,11 +158,31 @@ function closeLines(agentId, review) {
151
158
  }
152
159
  if (review.close === 'effect_boundary') {
153
160
  return [
154
- 'Close: not available. This Run started applying its result, and closing it would hide which effects happened.',
161
+ boundary
162
+ ? 'Close: not yet. The worker applying this result may still hold the Run; read this again once its lease has lapsed (a few minutes).'
163
+ : 'Close: not available. This Run started applying its result, and closing it would hide which effects happened.',
155
164
  ];
156
165
  }
157
166
  return [];
158
167
  }
168
+ /** What the boundary's receipts settled, by class. Every class not named stays unknown, which the line says. */
169
+ function receiptLine(review) {
170
+ const receipts = review.effectReceipts;
171
+ if (!receipts)
172
+ return undefined;
173
+ const applied = Array.isArray(receipts.applied) ? receipts.applied : [];
174
+ const none = Array.isArray(receipts.none) ? receipts.none : [];
175
+ if (applied.length === 0 && none.length === 0)
176
+ return 'Receipts: none yet. Every effect of this result is unknown.';
177
+ return [
178
+ 'Receipts:',
179
+ applied.length ? `applied ${applied.join(', ')};` : '',
180
+ none.length ? `owed nothing for ${none.join(', ')}.` : '',
181
+ 'Any other effect is unknown.',
182
+ ]
183
+ .filter(Boolean)
184
+ .join(' ');
185
+ }
159
186
  /** One line per held result: what a person needs to choose which one to open. */
160
187
  function reviewLine(review) {
161
188
  const stored = review.resultCapture === 'unsealable'