@skrr-ai/cli 0.1.163 → 0.1.165

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 (102) hide show
  1. package/README.md +13 -0
  2. package/dist/base-command.d.ts +14 -1
  3. package/dist/base-command.js +190 -58
  4. package/dist/commands/agent/message/send.d.ts +1 -0
  5. package/dist/commands/agent/message/send.js +3 -0
  6. package/dist/commands/agents/mini-computer/app/set.js +1 -1
  7. package/dist/commands/agents/mini-computer/show.js +7 -1
  8. package/dist/commands/agents/mini-computer/tasks-view.js +1 -1
  9. package/dist/commands/agents/supervision.d.ts +25 -0
  10. package/dist/commands/agents/supervision.js +129 -0
  11. package/dist/commands/apps/check.js +3 -8
  12. package/dist/commands/apps/data/batch.d.ts +1 -0
  13. package/dist/commands/apps/data/batch.js +19 -2
  14. package/dist/commands/apps/data/delete.d.ts +1 -0
  15. package/dist/commands/apps/data/delete.js +14 -2
  16. package/dist/commands/apps/data/patch.d.ts +1 -0
  17. package/dist/commands/apps/data/patch.js +11 -2
  18. package/dist/commands/apps/data/put.d.ts +1 -0
  19. package/dist/commands/apps/data/put.js +17 -3
  20. package/dist/commands/apps/install.js +7 -2
  21. package/dist/commands/apps/installations/compatibility.d.ts +13 -0
  22. package/dist/commands/apps/installations/compatibility.js +60 -0
  23. package/dist/commands/apps/installations/show.js +9 -3
  24. package/dist/commands/apps/installations/snapshot.js +5 -2
  25. package/dist/commands/apps/operations/check.d.ts +16 -0
  26. package/dist/commands/apps/operations/check.js +127 -0
  27. package/dist/commands/apps/publish/propose.js +33 -4
  28. package/dist/commands/apps/reconsent.js +7 -1
  29. package/dist/commands/apps/reference.d.ts +4 -2
  30. package/dist/commands/apps/reference.js +7 -4
  31. package/dist/commands/apps/rollback.d.ts +9 -0
  32. package/dist/commands/apps/rollback.js +81 -2
  33. package/dist/commands/apps/upgrade.d.ts +8 -0
  34. package/dist/commands/apps/upgrade.js +67 -2
  35. package/dist/commands/apps/version/cat.d.ts +22 -0
  36. package/dist/commands/apps/version/cat.js +220 -0
  37. package/dist/commands/apps/version/show.js +3 -1
  38. package/dist/commands/commerce/incidents/release.d.ts +24 -0
  39. package/dist/commands/commerce/incidents/release.js +46 -0
  40. package/dist/commands/duties/action-proposal.js +19 -11
  41. package/dist/commands/duties/cadence-decisions.js +7 -0
  42. package/dist/commands/duties/cases.js +12 -1
  43. package/dist/commands/duties/hypotheses.js +10 -3
  44. package/dist/commands/duties/observations.d.ts +4 -0
  45. package/dist/commands/duties/observations.js +14 -3
  46. package/dist/commands/duties/trigger-status.js +2 -2
  47. package/dist/commands/duties/wake-capabilities.js +12 -6
  48. package/dist/commands/outbox/list.d.ts +11 -4
  49. package/dist/commands/outbox/list.js +56 -9
  50. package/dist/commands/outbox/retry.d.ts +8 -2
  51. package/dist/commands/outbox/retry.js +76 -16
  52. package/dist/commands/outbox/show.d.ts +20 -0
  53. package/dist/commands/outbox/show.js +83 -0
  54. package/dist/commands/proposals/list.js +13 -9
  55. package/dist/commands/requests/show.d.ts +12 -0
  56. package/dist/commands/requests/show.js +42 -23
  57. package/dist/commands/spaces/deletion/cancel.d.ts +21 -0
  58. package/dist/commands/spaces/deletion/cancel.js +70 -0
  59. package/dist/commands/spaces/workflows/run.js +12 -0
  60. package/dist/commands/widgets/check.d.ts +9 -0
  61. package/dist/commands/widgets/check.js +16 -3
  62. package/dist/generated/agent-guides.json +17 -17
  63. package/dist/lib/api-fetch.d.ts +5 -0
  64. package/dist/lib/api-fetch.js +53 -21
  65. package/dist/lib/appCompatibility.d.ts +31 -0
  66. package/dist/lib/appCompatibility.js +66 -0
  67. package/dist/lib/appData.d.ts +46 -4
  68. package/dist/lib/appData.js +156 -31
  69. package/dist/lib/appInstallations.d.ts +32 -5
  70. package/dist/lib/appInstallations.js +218 -34
  71. package/dist/lib/appVersionFile.d.ts +82 -0
  72. package/dist/lib/appVersionFile.js +195 -0
  73. package/dist/lib/apps-command.d.ts +14 -3
  74. package/dist/lib/apps-command.js +68 -60
  75. package/dist/lib/appsCheck.js +31 -6
  76. package/dist/lib/chat-supervision.d.ts +21 -0
  77. package/dist/lib/chat-supervision.js +37 -0
  78. package/dist/lib/commerce.d.ts +6 -0
  79. package/dist/lib/commerce.js +9 -0
  80. package/dist/lib/duties.d.ts +19 -1
  81. package/dist/lib/duties.js +21 -3
  82. package/dist/lib/json-output.d.ts +2 -0
  83. package/dist/lib/json-output.js +8 -4
  84. package/dist/lib/miniComputer.d.ts +1 -0
  85. package/dist/lib/miniComputer.js +7 -2
  86. package/dist/lib/miniComputerCommand.js +4 -1
  87. package/dist/lib/node-adapter.d.ts +2 -0
  88. package/dist/lib/node-adapter.js +35 -8
  89. package/dist/lib/outbox.d.ts +110 -1
  90. package/dist/lib/outbox.js +261 -35
  91. package/dist/lib/roles.d.ts +1 -1
  92. package/dist/lib/space-deletion-cancel.d.ts +47 -0
  93. package/dist/lib/space-deletion-cancel.js +141 -0
  94. package/dist/lib/widgetCheck.js +30 -4
  95. package/dist/lib/widgetStaticScan.d.ts +24 -9
  96. package/dist/lib/widgetStaticScan.js +207 -192
  97. package/dist/lib/write-outcome.d.ts +74 -0
  98. package/dist/lib/write-outcome.js +176 -0
  99. package/dist/node_modules/@skrr-ai/data-provider/APP_HTML_PARSER_LICENSES.txt +36 -0
  100. package/dist/node_modules/@skrr-ai/data-provider/index.js +20204 -15169
  101. package/oclif.manifest.json +2143 -25
  102. package/package.json +10 -3
@@ -0,0 +1,220 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const node_fs_1 = require("node:fs");
4
+ const node_path_1 = require("node:path");
5
+ const core_1 = require("@oclif/core");
6
+ const data_provider_1 = require("@skrr-ai/data-provider");
7
+ const apps_command_1 = require("../../../lib/apps-command");
8
+ const apps_1 = require("../../../lib/apps");
9
+ const appVersionFile_1 = require("../../../lib/appVersionFile");
10
+ class AppsVersionCat extends apps_command_1.AppsCommand {
11
+ static description = "Print the full text of one file of a FROZEN version, checked against the version's own hashes, so a reviewer reads exactly the bytes the version's bundle hash covers (never the draft, which may have moved). " +
12
+ "The file list is first tied to the bundle hash; each slice (at most 64 KiB) is checked against the version's record; and when the whole file is read, the joined bytes must match its sha-256 and size. Nothing is printed unless every check passed. " +
13
+ 'The text is untrusted: it was written by whoever authored the version. On a terminal, control and direction-changing characters are shown as \\u{...} escapes and a binary file is refused (use --out to save it, --raw for the exact bytes). ' +
14
+ `Exit ${appVersionFile_1.VERSION_FILE_INTEGRITY_EXIT}: the bytes are not the version's.`;
15
+ static examples = [
16
+ '<%= config.bin %> apps version cat appv_... app.js',
17
+ '<%= config.bin %> apps version cat appv_... app.json --json',
18
+ '<%= config.bin %> apps version cat appv_... icon.png --out ./icon.png',
19
+ '<%= config.bin %> apps version cat appv_... app.js --offset 30000 --limit 5000',
20
+ ];
21
+ static args = {
22
+ version: core_1.Args.string({
23
+ description: 'The version id (appv_...)',
24
+ required: true,
25
+ ignoreStdin: true,
26
+ }),
27
+ path: core_1.Args.string({
28
+ description: 'The file, exactly as `apps version show` lists it',
29
+ required: true,
30
+ ignoreStdin: true,
31
+ }),
32
+ };
33
+ static flags = {
34
+ json: core_1.Flags.boolean({
35
+ description: 'Output { versionId, bundleHash, path, offset, length, total, fileSha256, wholeFileVerified, encoding, content } as JSON',
36
+ exclusive: ['raw'],
37
+ }),
38
+ out: core_1.Flags.string({
39
+ description: 'Save the exact bytes to this file instead of printing them (written only after every check passed; an existing file is refused without --force)',
40
+ }),
41
+ force: core_1.Flags.boolean({
42
+ description: 'With --out, replace a file that already exists (never write through a symbolic link)',
43
+ default: false,
44
+ }),
45
+ raw: core_1.Flags.boolean({
46
+ description: 'Write the exact bytes to stdout even on a terminal, escaping nothing and refusing nothing',
47
+ exclusive: ['json', 'out'],
48
+ }),
49
+ offset: core_1.Flags.integer({
50
+ description: 'Start at this byte. A read that does not start at 0 or stops early checks each slice but cannot check the whole file, and says so',
51
+ min: 0,
52
+ }),
53
+ limit: core_1.Flags.integer({
54
+ description: `Read at most this many bytes in all (the server answers in slices of at most ${data_provider_1.APP_VERSION_FILE_LIMITS.chunkBytesMax})`,
55
+ min: 1,
56
+ }),
57
+ };
58
+ async run() {
59
+ this.requireAuth();
60
+ const { args, flags } = await this.parse(AppsVersionCat);
61
+ let read;
62
+ try {
63
+ read = await (0, appVersionFile_1.readVersionFile)({
64
+ getVersion: (versionId) => data_provider_1.dataService.getAppVersion(versionId),
65
+ readChunk: (versionId, params) => data_provider_1.dataService.readAppVersionFile(versionId, params),
66
+ }, {
67
+ versionId: args.version,
68
+ path: args.path,
69
+ ...(flags.offset === undefined ? {} : { offset: flags.offset }),
70
+ ...(flags.limit === undefined ? {} : { limit: flags.limit }),
71
+ });
72
+ }
73
+ catch (error) {
74
+ return this.failVersionFile(error);
75
+ }
76
+ const summary = {
77
+ versionId: read.versionId,
78
+ bundleHash: read.bundleHash,
79
+ path: read.path,
80
+ offset: read.offset,
81
+ length: read.length,
82
+ total: read.total,
83
+ fileSha256: read.fileSha256,
84
+ wholeFileVerified: read.wholeFileVerified,
85
+ };
86
+ if (flags.out !== undefined) {
87
+ try {
88
+ saveVerified(flags.out, read.bytes, flags.force);
89
+ }
90
+ catch (error) {
91
+ return this.failWithCliError({
92
+ message: `Could not write ${flags.out}: ${error.message}`,
93
+ code: 'APP_VERSION_FILE_OUT',
94
+ exit: 1,
95
+ retryable: false,
96
+ });
97
+ }
98
+ if (flags.json) {
99
+ this.printJsonResult({ ...summary, out: flags.out, bytesWritten: read.bytes.length });
100
+ }
101
+ else {
102
+ this.log(`wrote ${read.bytes.length} bytes to ${flags.out}`);
103
+ this.note(read);
104
+ }
105
+ return;
106
+ }
107
+ if (flags.json) {
108
+ const text = (0, appVersionFile_1.isBinary)(read.bytes) ? null : read.bytes.toString('utf8');
109
+ this.printJsonResult({
110
+ ...summary,
111
+ ...(text === null
112
+ ? { encoding: 'base64', content: read.bytes.toString('base64') }
113
+ : { encoding: 'utf8', content: text }),
114
+ });
115
+ return;
116
+ }
117
+ if (flags.raw || !process.stdout.isTTY) {
118
+ // The exact bytes, for a pipe or a file: `apps version cat ... > file` makes a clean file.
119
+ process.stdout.write(read.bytes);
120
+ this.note(read);
121
+ return;
122
+ }
123
+ if ((0, appVersionFile_1.isBinary)(read.bytes)) {
124
+ return this.failWithCliError({
125
+ message: `"${read.path}" is binary (${read.length} bytes), so it is not printed to a terminal. Save it with --out <file>, or write the exact bytes with --raw.`,
126
+ code: 'APP_VERSION_FILE_BINARY',
127
+ exit: 2,
128
+ retryable: false,
129
+ });
130
+ }
131
+ const shown = (0, appVersionFile_1.escapeForTerminal)(read.bytes.toString('utf8'));
132
+ process.stdout.write(shown.text);
133
+ if (!shown.text.endsWith('\n'))
134
+ process.stdout.write('\n');
135
+ if (shown.escaped > 0) {
136
+ process.stderr.write(`${shown.escaped} control or direction-changing character${shown.escaped === 1 ? '' : 's'} shown as \\u{...} escapes; --raw writes the exact bytes.\n`);
137
+ }
138
+ this.note(read);
139
+ }
140
+ /** What was checked, on stderr so stdout stays the file. */
141
+ note(read) {
142
+ const bundle = read.bundleHash.slice(0, 12);
143
+ process.stderr.write(read.wholeFileVerified
144
+ ? `verified: ${read.length} bytes, sha-256 ${read.fileSha256.slice(0, 12)} matches the record of version ${read.versionId} (bundle ${bundle})\n`
145
+ : `partial read (bytes ${read.offset}-${read.offset + read.length} of ${read.total}): each slice matches the record of version ${read.versionId}, but the whole file was not read, so its sha-256 was not checked\n`);
146
+ }
147
+ /** Say what went wrong, in this command's terms where it has them. Never returns. */
148
+ failVersionFile(error) {
149
+ if (error instanceof appVersionFile_1.VersionFileIntegrityError) {
150
+ return this.failWithCliError({
151
+ message: `${error.message} Nothing was printed. Do not approve this version on the strength of this file.`,
152
+ code: appVersionFile_1.VERSION_FILE_INTEGRITY_CODE,
153
+ exit: appVersionFile_1.VERSION_FILE_INTEGRITY_EXIT,
154
+ retryable: false,
155
+ details: { problem: error.kind, ...error.details },
156
+ });
157
+ }
158
+ if (error instanceof appVersionFile_1.VersionFileNotListedError) {
159
+ return this.failWithCliError({
160
+ message: `${error.message} It lists: ${error.listed.join(', ')}. \`${this.config.bin} apps version show <version>\` lists them with their hashes.`,
161
+ code: 'APP_VERSION_FILE_NOT_LISTED',
162
+ exit: 4,
163
+ retryable: false,
164
+ details: { path: error.path, listed: error.listed },
165
+ });
166
+ }
167
+ if (error instanceof appVersionFile_1.VersionFileInputError) {
168
+ return this.failWithCliError({
169
+ message: error.message,
170
+ code: error.code,
171
+ exit: 2,
172
+ retryable: false,
173
+ });
174
+ }
175
+ // The server checks the stored bytes against the record first and refuses, with the reason, when they disagree.
176
+ const refusal = (0, apps_1.readAppsRefusal)(error);
177
+ if (refusal?.error === 'integrity_mismatch') {
178
+ return this.failWithCliError({
179
+ message: `${refusal.message ?? 'The stored bytes of this file are not the bytes the version recorded.'} Nothing was printed. Do not approve this version on the strength of this file.`,
180
+ code: appVersionFile_1.VERSION_FILE_INTEGRITY_CODE,
181
+ ...(refusal.status === undefined ? {} : { status: refusal.status }),
182
+ exit: appVersionFile_1.VERSION_FILE_INTEGRITY_EXIT,
183
+ retryable: false,
184
+ details: {
185
+ problem: 'server_integrity',
186
+ ...(refusal.reason ? { reason: refusal.reason } : {}),
187
+ },
188
+ });
189
+ }
190
+ return this.failApps(error);
191
+ }
192
+ }
193
+ exports.default = AppsVersionCat;
194
+ /**
195
+ * Write `bytes` to `target` only once they are verified, and so that no reader sees a part of them: a file of the same name
196
+ * in the same directory, then a rename. An existing target is refused unless `force`, and a symbolic link is never written
197
+ * through (the rename replaces the link itself).
198
+ */
199
+ function saveVerified(target, bytes, force) {
200
+ let existing = null;
201
+ try {
202
+ existing = (0, node_fs_1.lstatSync)(target);
203
+ }
204
+ catch (error) {
205
+ if (error.code !== 'ENOENT')
206
+ throw error;
207
+ }
208
+ if (existing && !force)
209
+ throw new Error('it already exists; use --force to replace it');
210
+ if (existing?.isDirectory())
211
+ throw new Error('it is a directory');
212
+ const staging = (0, node_path_1.join)((0, node_path_1.dirname)(target), `.${(0, node_path_1.basename)(target)}.${process.pid}.partial`);
213
+ try {
214
+ (0, node_fs_1.writeFileSync)(staging, bytes, { flag: 'wx', mode: 0o644 });
215
+ (0, node_fs_1.renameSync)(staging, target);
216
+ }
217
+ finally {
218
+ (0, node_fs_1.rmSync)(staging, { force: true });
219
+ }
220
+ }
@@ -4,7 +4,7 @@ const core_1 = require("@oclif/core");
4
4
  const data_provider_1 = require("@skrr-ai/data-provider");
5
5
  const apps_command_1 = require("../../../lib/apps-command");
6
6
  class AppsVersionShow extends apps_command_1.AppsCommand {
7
- static description = 'Show one version: its bundle hash, its files, what it declares and where it stands.';
7
+ static description = 'Show one version: its bundle hash, its files, what it declares and where it stands. To read the full text of a file, checked against these hashes, use `apps version cat`.';
8
8
  static examples = ['<%= config.bin %> apps version show appv_...'];
9
9
  static args = {
10
10
  version: core_1.Args.string({
@@ -30,6 +30,8 @@ class AppsVersionShow extends apps_command_1.AppsCommand {
30
30
  this.log(`bundle ${version.bundleHash}`);
31
31
  for (const file of version.files)
32
32
  this.log(`${file.path} ${file.size} bytes ${file.sha256.slice(0, 12)}`);
33
+ // a digest is not something a person can read: the text itself, checked against these hashes, is one command away
34
+ this.log(`read a file in full, checked against its hash: ${this.config.bin} apps version cat ${version.id} <path>`);
33
35
  }
34
36
  catch (error) {
35
37
  this.failApps(error);
@@ -0,0 +1,24 @@
1
+ import { BaseCommand } from '../../../base-command';
2
+ /**
3
+ * `skrr commerce incidents release` — a person's decision to release a held refund.
4
+ *
5
+ * An open Store Agent incident whose id another Agent now holds cannot prove its access is
6
+ * gone, so a retry (manual or automatic) never moves it. This records the decision to release
7
+ * it anyway, with a reason and evidence, then runs it: the pinned Agent's own permissions are
8
+ * removed, the replacement's data under the id is left in place, and the buyer is refunded
9
+ * through the ordinary path. It is a decision, not a retry, which is why it is its own verb and
10
+ * why the body is required: an administrator cannot release a refund without saying why.
11
+ * The server refuses unless that is exactly the live state of the incident.
12
+ */
13
+ export default class CommerceIncidentsRelease extends BaseCommand {
14
+ static description: string;
15
+ static examples: string[];
16
+ static args: {
17
+ reconciliation: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
18
+ };
19
+ static flags: {
20
+ file: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
21
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
22
+ };
23
+ run(): Promise<void>;
24
+ }
@@ -0,0 +1,46 @@
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 commerce_1 = require("../../../lib/commerce");
6
+ const commerce_command_1 = require("../../../lib/commerce-command");
7
+ /**
8
+ * `skrr commerce incidents release` — a person's decision to release a held refund.
9
+ *
10
+ * An open Store Agent incident whose id another Agent now holds cannot prove its access is
11
+ * gone, so a retry (manual or automatic) never moves it. This records the decision to release
12
+ * it anyway, with a reason and evidence, then runs it: the pinned Agent's own permissions are
13
+ * removed, the replacement's data under the id is left in place, and the buyer is refunded
14
+ * through the ordinary path. It is a decision, not a retry, which is why it is its own verb and
15
+ * why the body is required: an administrator cannot release a refund without saying why.
16
+ * The server refuses unless that is exactly the live state of the incident.
17
+ */
18
+ class CommerceIncidentsRelease extends base_command_1.BaseCommand {
19
+ static description = "Release a Store refund held because another Agent holds the install's id (admin). A recorded decision with a reason and evidence — not a retry; for that see `commerce incidents retry`.";
20
+ static examples = [
21
+ '<%= config.bin %> commerce incidents release <reconciliation-id> --file ./release.json',
22
+ ];
23
+ static args = {
24
+ reconciliation: core_1.Args.string({
25
+ description: 'Fulfillment reconciliation id',
26
+ required: true,
27
+ ignoreStdin: true,
28
+ }),
29
+ };
30
+ static flags = { ...commerce_command_1.jsonBodyFlags };
31
+ async run() {
32
+ this.requireAuth();
33
+ const { args, flags } = await this.parse(CommerceIncidentsRelease);
34
+ const body = await (0, commerce_command_1.jsonBodyFrom)(this, flags.file, { required: true });
35
+ let result;
36
+ try {
37
+ result = await (0, commerce_1.releaseFulfillmentReplacementHold)(args.reconciliation, body);
38
+ }
39
+ catch (error) {
40
+ this.handleApiError(error);
41
+ return;
42
+ }
43
+ this.printJsonResult(result);
44
+ }
45
+ }
46
+ exports.default = CommerceIncidentsRelease;
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
4
  const base_command_1 = require("../../base-command");
5
5
  const duties_1 = require("../../lib/duties");
6
+ const duty_history_source_1 = require("../../lib/duty-history-source");
7
+ const ACTION_PROPOSAL_UNAVAILABLE = 'Action proposals are unavailable because their source cannot be verified.';
6
8
  /** Read the exact Action Bundle execution receipt before any retry. */
7
9
  class DutiesActionProposal extends base_command_1.BaseCommand {
8
10
  static description = 'Show one frozen Action Bundle and its execution receipt';
@@ -18,22 +20,28 @@ class DutiesActionProposal extends base_command_1.BaseCommand {
18
20
  async run() {
19
21
  this.requireAuth();
20
22
  const { args, flags } = await this.parse(DutiesActionProposal);
23
+ let result;
21
24
  try {
22
- const result = await duties_1.dutyApi.actionProposal(args.dutyId, args.proposalId);
23
- if (flags.json)
24
- this.printJsonResult(result);
25
- else {
26
- const proposal = result.proposal;
27
- const execution = result.execution;
28
- this.log(`Action Bundle: ${String(proposal?.status || 'unknown')}`);
29
- this.log(`Operation: ${String(execution?.operationId || 'unavailable')}`);
30
- const receipt = execution?.receipt;
31
- this.log(`Receipt: ${String(receipt?.state || 'unknown')}`);
32
- }
25
+ result = await duties_1.dutyApi.actionProposal(args.dutyId, args.proposalId);
33
26
  }
34
27
  catch (error) {
35
28
  this.handleApiError(error);
36
29
  }
30
+ // A server that answered 200 from the logical Duty id alone said nothing about its sources.
31
+ // Print a response only when the server declares its coverage, in JSON too.
32
+ if (!(0, duty_history_source_1.hasVerifiedDutyHistorySource)(result)) {
33
+ this.error(ACTION_PROPOSAL_UNAVAILABLE, { code: 'DUTY_ACTION_PROPOSAL_SOURCE_UNVERIFIED' });
34
+ }
35
+ if (flags.json)
36
+ this.printJsonResult(result);
37
+ else {
38
+ const proposal = result.proposal;
39
+ const execution = result.execution;
40
+ this.log(`Action Bundle: ${String(proposal?.status || 'unknown')}`);
41
+ this.log(`Operation: ${String(execution?.operationId || 'unavailable')}`);
42
+ const receipt = execution?.receipt;
43
+ this.log(`Receipt: ${String(receipt?.state || 'unknown')}`);
44
+ }
37
45
  }
38
46
  }
39
47
  exports.default = DutiesActionProposal;
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
4
  const base_command_1 = require("../../base-command");
5
5
  const duties_1 = require("../../lib/duties");
6
+ const duty_history_source_1 = require("../../lib/duty-history-source");
6
7
  const duty_ledgers_1 = require("../../lib/duty-ledgers");
8
+ const CADENCE_UNAVAILABLE = 'Cadence history is unavailable because its Duty source cannot be verified.';
7
9
  /**
8
10
  * `skrr duties cadence-decisions <id>` — the adaptive controller's
9
11
  * append-only decision ledger, including shadow recommendations.
@@ -31,6 +33,11 @@ class DutiesCadenceDecisions extends base_command_1.BaseCommand {
31
33
  catch (error) {
32
34
  this.handleApiError(error);
33
35
  }
36
+ // A server that answered 200 from the logical Duty id alone said nothing about its sources.
37
+ // Print a response only when the server declares its coverage, in JSON too.
38
+ if (!(0, duty_history_source_1.hasVerifiedDutyHistorySource)(response)) {
39
+ this.error(CADENCE_UNAVAILABLE, { code: 'DUTY_CADENCE_SOURCE_UNVERIFIED' });
40
+ }
34
41
  if (flags.json) {
35
42
  this.log(JSON.stringify(response, null, 2));
36
43
  return;
@@ -35,7 +35,18 @@ class DutiesCases extends base_command_1.BaseCommand {
35
35
  this.log(JSON.stringify(result, null, 2));
36
36
  return;
37
37
  }
38
- (0, duties_1.renderDutyCases)(result, (line) => this.log(line));
38
+ // A bound-only list (OSK-23203) leaves out Cases that cannot be tied to this Duty document, so it must say so,
39
+ // and an empty one must not claim that nothing was recorded.
40
+ const bound = (0, duties_1.boundHistoryCoverage)(result);
41
+ if (bound?.someHidden)
42
+ this.log(`NOTE: ${duties_1.BOUND_CASES_NOTE}`);
43
+ (0, duties_1.renderDutyCases)(result, (line) => this.log(line), {
44
+ ...(bound?.someHidden
45
+ ? {
46
+ emptyMessage: `No cases are shown${flags.status ? ` with status ${flags.status}` : ''}. ${duties_1.BOUND_CASES_NOTE}`,
47
+ }
48
+ : {}),
49
+ });
39
50
  (0, duties_1.renderListPageHint)(result, (line) => this.log(line));
40
51
  }
41
52
  }
@@ -65,9 +65,16 @@ class DutiesHypotheses extends base_command_1.BaseCommand {
65
65
  flags.status ? `--status ${flags.status}` : null,
66
66
  flags['investigation-key'] ? `--investigation-key ${flags['investigation-key']}` : null,
67
67
  ].filter(Boolean);
68
- const emptyMessage = filters.length
69
- ? `No hypotheses match ${filters.join(' ')}.`
70
- : 'No hypotheses recorded.';
68
+ // A bound-only list (OSK-23203) leaves out claims that cannot be tied to this Duty document, so it must say so,
69
+ // and an empty one must not claim that nothing was recorded.
70
+ const bound = (0, duties_1.boundHistoryCoverage)(response);
71
+ const emptyMessage = bound?.someHidden
72
+ ? `No hypotheses are shown${filters.length ? ` that match ${filters.join(' ')}` : ''}. ${duties_1.BOUND_HYPOTHESES_NOTE}`
73
+ : filters.length
74
+ ? `No hypotheses match ${filters.join(' ')}.`
75
+ : 'No hypotheses recorded.';
76
+ if (bound?.someHidden)
77
+ this.log(`NOTE: ${duties_1.BOUND_HYPOTHESES_NOTE}`);
71
78
  (0, duties_1.renderDutyHypotheses)(response, (line) => this.log(line), { emptyMessage });
72
79
  (0, duties_1.renderListPageHint)(response, (line) => this.log(line));
73
80
  }
@@ -1,4 +1,8 @@
1
1
  import { BaseCommand } from '../../base-command';
2
+ import { boundHistoryCoverage } from '../../lib/duties';
3
+ /** What the server says about a bound-only history: only readings tied to THIS Duty document are shown. */
4
+ export declare const BOUND_HISTORY_NOTE = "Only readings tied to this Duty document are shown. Other readings carry this Duty\u2019s id but cannot be tied to it (an earlier Duty with the same id, or recorded before the link existed), so they are left out.";
5
+ export { boundHistoryCoverage };
2
6
  /** Explicit ISO FROM/TO intervals avoid local-time or rolling-window ambiguity. */
3
7
  export declare function parseObservationWindow(value: string): {
4
8
  from: string;
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.boundHistoryCoverage = exports.BOUND_HISTORY_NOTE = void 0;
3
4
  exports.parseObservationWindow = parseObservationWindow;
4
5
  exports.renderObservationWindow = renderObservationWindow;
5
6
  const core_1 = require("@oclif/core");
6
7
  const data_provider_1 = require("@skrr-ai/data-provider");
7
8
  const base_command_1 = require("../../base-command");
8
9
  const duties_1 = require("../../lib/duties");
10
+ Object.defineProperty(exports, "boundHistoryCoverage", { enumerable: true, get: function () { return duties_1.boundHistoryCoverage; } });
9
11
  const TIMESTAMP_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/;
10
12
  /** Legacy responses cannot prove that historical observations belong to this
11
13
  * physical Duty. Never print rows or aggregate values without a source policy. */
@@ -15,6 +17,8 @@ function hasVerifiedSource(value) {
15
17
  const policy = value.sourcePolicy;
16
18
  return policy?.status === 'supported' || policy?.status === 'partial';
17
19
  }
20
+ /** What the server says about a bound-only history: only readings tied to THIS Duty document are shown. */
21
+ exports.BOUND_HISTORY_NOTE = 'Only readings tied to this Duty document are shown. Other readings carry this Duty’s id but cannot be tied to it (an earlier Duty with the same id, or recorded before the link existed), so they are left out.';
18
22
  /** Explicit ISO FROM/TO intervals avoid local-time or rolling-window ambiguity. */
19
23
  function parseObservationWindow(value) {
20
24
  const parts = value.split('/');
@@ -178,9 +182,16 @@ class DutiesObservations extends base_command_1.BaseCommand {
178
182
  flags['changed-only'] ? '--changed-only' : null,
179
183
  flags.since ? `--since ${flags.since}` : null,
180
184
  ].filter(Boolean);
181
- const emptyMessage = filters.length
182
- ? `No observations match ${filters.join(' ')}.`
183
- : 'No observations recorded.';
185
+ // A bound-only history (OSK-23203) leaves out readings that cannot be tied to this Duty document, so an
186
+ // empty page must not claim that nothing was recorded, and a non-empty one must say it is partial.
187
+ const bound = (0, duties_1.boundHistoryCoverage)(response);
188
+ const emptyMessage = bound?.someHidden
189
+ ? `No observations are shown${filters.length ? ` that match ${filters.join(' ')}` : ''}. ${exports.BOUND_HISTORY_NOTE}`
190
+ : filters.length
191
+ ? `No observations match ${filters.join(' ')}.`
192
+ : 'No observations recorded.';
193
+ if (bound?.someHidden)
194
+ this.log(`NOTE: ${exports.BOUND_HISTORY_NOTE}`);
184
195
  if (response?.truncated)
185
196
  this.log(`TRUNCATED: ${response.omitted} current keys omitted; increase --limit (max 200).`);
186
197
  (0, duties_1.renderDutyObservations)(response, (line) => this.log(line), { emptyMessage });
@@ -53,7 +53,7 @@ exports.default = DutiesTriggerStatus;
53
53
  /** Hide unverified legacy fields in JSON as well as human output. */
54
54
  function safeTriggerStatus(status) {
55
55
  const policy = status.sourcePolicy;
56
- if (['complete', 'partial'].includes(String(policy?.status)))
56
+ if (['complete', 'partial', 'supported'].includes(String(policy?.status)))
57
57
  return status;
58
58
  return {
59
59
  dutyId: status.dutyId,
@@ -75,7 +75,7 @@ function formatTriggerStatus(status) {
75
75
  const lines = [];
76
76
  const dutyId = String(status.dutyId ?? '-');
77
77
  const sourcePolicy = status.sourcePolicy;
78
- if (!['complete', 'partial'].includes(String(sourcePolicy?.status))) {
78
+ if (!['complete', 'partial', 'supported'].includes(String(sourcePolicy?.status))) {
79
79
  return [
80
80
  `Trigger status for ${dutyId}: unavailable.`,
81
81
  'The historical sources cannot be verified for this Duty. This does not mean no triggers or fires exist.',
@@ -21,14 +21,20 @@ function wakePolicyHeadline(_result) {
21
21
  /** Do not pass legacy standing rows through --json without source proof. */
22
22
  function safeWakeCapabilities(result) {
23
23
  if (result.sourcePolicy?.status === 'unsupported') {
24
- return { eligibleCapabilities: [], visibleCapabilities: [],
25
- sourcePolicy: { status: 'unsupported', reason: 'unverified_duty_lineage' } };
24
+ return {
25
+ eligibleCapabilities: [],
26
+ visibleCapabilities: [],
27
+ sourcePolicy: { status: 'unsupported', reason: 'unverified_duty_lineage' },
28
+ };
26
29
  }
27
- if (['complete', 'partial'].includes(String(result.standingEventWakesSourcePolicy?.status)) &&
30
+ if (['complete', 'partial', 'supported'].includes(String(result.standingEventWakesSourcePolicy?.status)) &&
28
31
  result.standingEventWakes?.sourcePolicy?.status !== 'unsupported')
29
32
  return result;
30
- return { ...result, standingEventWakes: null,
31
- standingEventWakesSourcePolicy: { status: 'unsupported', reason: 'unverified_duty_lineage' } };
33
+ return {
34
+ ...result,
35
+ standingEventWakes: null,
36
+ standingEventWakesSourcePolicy: { status: 'unsupported', reason: 'unverified_duty_lineage' },
37
+ };
32
38
  }
33
39
  /**
34
40
  * The lines above the table. The table is what the Agent may PICK; what is bound is the server's
@@ -45,7 +51,7 @@ function wakePolicyLines(result) {
45
51
  'This does not mean no wake capabilities or triggers exist.',
46
52
  ];
47
53
  }
48
- if (!['complete', 'partial'].includes(String(result?.standingEventWakesSourcePolicy?.status)) ||
54
+ if (!['complete', 'partial', 'supported'].includes(String(result?.standingEventWakesSourcePolicy?.status)) ||
49
55
  wakes?.sourcePolicy?.status === 'unsupported') {
50
56
  return [
51
57
  wakePolicyHeadline(),
@@ -1,5 +1,5 @@
1
1
  import { BaseCommand } from '../../base-command';
2
- import { type OutboxEntry } from '../../lib/outbox';
2
+ import { type OutboxEntry, type ReplayContext, type ReplayContextVerdict } from '../../lib/outbox';
3
3
  /**
4
4
  * Why one entry was queued, in words (OSK-12121). The queue holds more than
5
5
  * outage casualties — a 401 is queued too, so authored content survives a lapsed
@@ -10,11 +10,18 @@ export declare function queuedBecause(entry: Pick<OutboxEntry, 'reason' | 'repla
10
10
  label: string;
11
11
  kind: 'auth' | 'throttled' | 'unavailable' | 'other';
12
12
  };
13
- export declare function outboxListSnapshot(profile?: string): {
14
- queued: OutboxEntry[];
13
+ /**
14
+ * Where an entry will be replayed, in a cell: the server and the account it was
15
+ * queued as, or the plain statement that it recorded neither (OSK-23807).
16
+ */
17
+ export declare function boundTo(entry: Pick<OutboxEntry, 'origin' | 'account'>): string;
18
+ export declare function outboxListSnapshot(profile?: string, current?: ReplayContext): {
19
+ queued: (OutboxEntry & {
20
+ replayContext?: ReplayContextVerdict;
21
+ })[];
15
22
  incident: import("../../lib/outbox").IncidentState | null;
16
23
  incidentActive: boolean;
17
- originalContext: "unverified" | "not_applicable";
24
+ originalContext: "unverified" | "bound" | "not_applicable";
18
25
  };
19
26
  /**
20
27
  * `skrr outbox list` — what is queued, and why.