@skrr-ai/cli 0.1.162 → 0.1.164

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 (95) hide show
  1. package/dist/base-command.d.ts +5 -2
  2. package/dist/base-command.js +108 -39
  3. package/dist/commands/activity/list.d.ts +7 -0
  4. package/dist/commands/activity/list.js +17 -0
  5. package/dist/commands/activity/scan-older.d.ts +2 -2
  6. package/dist/commands/activity/scan-older.js +6 -5
  7. package/dist/commands/activity/show.d.ts +0 -2
  8. package/dist/commands/activity/show.js +21 -42
  9. package/dist/commands/agents/always-on/release-run.d.ts +3 -3
  10. package/dist/commands/agents/always-on/release-run.js +5 -6
  11. package/dist/commands/agents/mini-computer/app/reset.d.ts +1 -0
  12. package/dist/commands/agents/mini-computer/app/reset.js +5 -2
  13. package/dist/commands/agents/mini-computer/app/set.js +1 -1
  14. package/dist/commands/agents/mini-computer/show.js +10 -2
  15. package/dist/commands/agents/mini-computer/tasks-view.js +2 -2
  16. package/dist/commands/agents/supervision.d.ts +25 -0
  17. package/dist/commands/agents/supervision.js +129 -0
  18. package/dist/commands/agents/triggers/replay.js +1 -1
  19. package/dist/commands/agents/triggers/runs.d.ts +2 -3
  20. package/dist/commands/agents/triggers/runs.js +4 -5
  21. package/dist/commands/apps/auto-apply.js +31 -10
  22. package/dist/commands/apps/check.js +8 -0
  23. package/dist/commands/apps/data/batch.js +16 -5
  24. package/dist/commands/apps/data/collections.js +1 -1
  25. package/dist/commands/apps/data/delete.js +12 -4
  26. package/dist/commands/apps/data/patch.js +11 -4
  27. package/dist/commands/apps/data/put.js +13 -6
  28. package/dist/commands/apps/data/query.js +3 -3
  29. package/dist/commands/apps/install.js +24 -7
  30. package/dist/commands/apps/installations/events.d.ts +1 -0
  31. package/dist/commands/apps/installations/events.js +63 -10
  32. package/dist/commands/apps/installations/show.js +26 -5
  33. package/dist/commands/apps/installations/snapshot.js +1 -1
  34. package/dist/commands/apps/installations/versions.js +25 -9
  35. package/dist/commands/apps/logs.js +4 -1
  36. package/dist/commands/apps/push.js +10 -2
  37. package/dist/commands/apps/reconsent.js +7 -1
  38. package/dist/commands/apps/rollback.js +2 -2
  39. package/dist/commands/apps/settings/set.js +81 -4
  40. package/dist/commands/apps/settings/show.js +38 -7
  41. package/dist/commands/duties/action-proposal.js +19 -11
  42. package/dist/commands/duties/cadence-decisions.js +7 -0
  43. package/dist/commands/duties/status.js +20 -15
  44. package/dist/commands/duties/trigger-status.js +2 -2
  45. package/dist/commands/duties/wake-capabilities.js +12 -6
  46. package/dist/commands/outbox/drop.js +21 -15
  47. package/dist/commands/outbox/list.d.ts +2 -1
  48. package/dist/commands/outbox/list.js +20 -11
  49. package/dist/commands/outbox/retry.d.ts +8 -11
  50. package/dist/commands/outbox/retry.js +135 -92
  51. package/dist/commands/spaces/create.js +1 -1
  52. package/dist/commands/tasks/comments/add.js +1 -1
  53. package/dist/commands/triggers/audit.js +3 -5
  54. package/dist/commands/triggers/fire-detail.js +7 -1
  55. package/dist/commands/triggers/replay.js +1 -1
  56. package/dist/commands/triggers/runs.d.ts +2 -4
  57. package/dist/commands/triggers/runs.js +3 -5
  58. package/dist/generated/agent-guides.json +19 -19
  59. package/dist/lib/agent-activity.d.ts +21 -1
  60. package/dist/lib/agent-activity.js +98 -29
  61. package/dist/lib/api-fetch.d.ts +2 -0
  62. package/dist/lib/api-fetch.js +5 -5
  63. package/dist/lib/appData.d.ts +43 -5
  64. package/dist/lib/appData.js +117 -25
  65. package/dist/lib/appInstallations.d.ts +5 -5
  66. package/dist/lib/appInstallations.js +232 -74
  67. package/dist/lib/appSettings.d.ts +2 -0
  68. package/dist/lib/appSettings.js +36 -3
  69. package/dist/lib/apps-command.d.ts +9 -0
  70. package/dist/lib/apps-command.js +191 -7
  71. package/dist/lib/appsCheck.js +40 -3
  72. package/dist/lib/appsFs.d.ts +1 -1
  73. package/dist/lib/chat-supervision.d.ts +21 -0
  74. package/dist/lib/chat-supervision.js +37 -0
  75. package/dist/lib/duties.d.ts +4 -0
  76. package/dist/lib/json-output.d.ts +4 -0
  77. package/dist/lib/json-output.js +38 -0
  78. package/dist/lib/miniComputer.d.ts +1 -0
  79. package/dist/lib/miniComputer.js +16 -4
  80. package/dist/lib/miniComputerCommand.js +4 -1
  81. package/dist/lib/node-adapter.js +35 -2
  82. package/dist/lib/outbox.d.ts +20 -5
  83. package/dist/lib/outbox.js +233 -76
  84. package/dist/lib/rate-limit-retry.d.ts +3 -2
  85. package/dist/lib/rate-limit-retry.js +3 -2
  86. package/dist/lib/roles.d.ts +1 -1
  87. package/dist/lib/triggers.d.ts +3 -0
  88. package/dist/lib/triggers.js +10 -0
  89. package/dist/lib/widgetCheck.js +30 -4
  90. package/dist/lib/widgetStaticScan.d.ts +17 -6
  91. package/dist/lib/widgetStaticScan.js +336 -94
  92. package/dist/node_modules/@skrr-ai/data-provider/APP_HTML_PARSER_LICENSES.txt +36 -0
  93. package/dist/node_modules/@skrr-ai/data-provider/index.js +15543 -10133
  94. package/oclif.manifest.json +334 -47
  95. package/package.json +5 -3
@@ -3,8 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  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
+ const base_command_1 = require("../../../base-command");
7
+ const appSettings_1 = require("../../../lib/appSettings");
8
+ const json_output_1 = require("../../../lib/json-output");
6
9
  class AppsSettingsShow extends apps_command_1.AppsCommand {
7
- static description = 'Show installation settings, declared fields and the resulting job schedules. Includes the exact version, settings and consent timestamp required for a safe update.';
10
+ static description = 'Show a snapshot of saved settings, fallback defaults and resulting job schedules. A later update reads the installation again; this snapshot does not bind it.';
8
11
  static args = { installation: core_1.Args.string({ required: true, ignoreStdin: true }) };
9
12
  static flags = {
10
13
  json: core_1.Flags.boolean({ description: 'Output settings and update preconditions as JSON' }),
@@ -14,16 +17,44 @@ class AppsSettingsShow extends apps_command_1.AppsCommand {
14
17
  const { args, flags } = await this.parse(AppsSettingsShow);
15
18
  try {
16
19
  const current = await data_provider_1.dataService.getAppInstallationSettings(args.installation);
20
+ if (!data_provider_1.AppSettingsSchema.safeParse(current?.settings).success ||
21
+ !data_provider_1.AppSettingsManifestSchema.safeParse(current?.configuration).success ||
22
+ typeof current?.expectedVersionId !== 'string' || !current.expectedVersionId ||
23
+ typeof current.expectedGrantedAt !== 'string' || !Number.isFinite(Date.parse(current.expectedGrantedAt)) ||
24
+ typeof current.timezone !== 'string' || !current.timezone ||
25
+ typeof current.canEdit !== 'boolean') {
26
+ return this.failWithCliError({
27
+ message: 'The current settings or configuration declaration could not be read.',
28
+ code: 'APP_SETTINGS_UNREADABLE', exit: 1, retryable: false,
29
+ });
30
+ }
17
31
  if (flags.json)
18
32
  return this.printJsonResult(current);
19
- this.log(JSON.stringify(current.settings, null, 2));
20
- this.log(`Version ${current.expectedVersionId}; consent ${current.expectedGrantedAt}; timezone ${current.timezone}`);
21
- for (const job of (0, data_provider_1.appSettingsSchedulePreview)(current.configuration, current.settings))
22
- this.log(`${(0, data_provider_1.plainAppLabel)(job.title)}: ${job.problem ?? job.schedule}`);
23
- if (!current.canEdit)
24
- this.log('Settings cannot be changed with this grant. The installer must approve the current version first.');
33
+ this.log('Explicitly saved settings:');
34
+ this.log((0, json_output_1.escapeJsonForTerminal)(JSON.stringify(current.settings, null, 2)));
35
+ if (!(0, data_provider_1.parseAppSettings)(current.configuration, current.settings).ok)
36
+ this.log('Some saved values are not accepted by the current declaration and are not used when resolving app configuration or schedules.');
37
+ for (const line of (0, appSettings_1.formatInstallDefaults)(current.configuration, current.settings, 'saved'))
38
+ this.log(line);
39
+ this.log(`Version ${(0, data_provider_1.plainAppLabel)(current.expectedVersionId)}; consent ${(0, data_provider_1.plainAppLabel)(current.expectedGrantedAt)}; installer timezone ${(0, data_provider_1.plainAppLabel)(current.timezone)}`);
40
+ const jobs = (0, data_provider_1.appSettingsSchedulePreview)(current.configuration, current.settings);
41
+ if (jobs.length)
42
+ this.log('Schedules calculated from this snapshot; actual job state may differ:');
43
+ for (const job of jobs)
44
+ this.log(`${(0, data_provider_1.plainAppLabel)(job.title)}: ${(0, data_provider_1.plainAppLabel)(job.problem ?? job.schedule, 8192)}`);
45
+ if (!current.canEdit) {
46
+ this.log('Settings are not editable under the current access and approval state.');
47
+ if (current.canReviewBundleApproval === true) {
48
+ const displayId = /^appi_[A-Za-z0-9_-]+(?![\s\S])/.test(args.installation)
49
+ ? args.installation : '<installation-id>';
50
+ this.log(`To review the current version, run \`${this.config.bin} apps reconsent ${displayId}\` without --yes.`);
51
+ }
52
+ }
25
53
  }
26
54
  catch (error) {
55
+ if (error instanceof Error && ((0, base_command_1.isOclifExitError)(error) ||
56
+ typeof error.oclif?.exit === 'number'))
57
+ throw error;
27
58
  this.failInstallation(error);
28
59
  }
29
60
  }
@@ -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;
@@ -3,6 +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");
7
+ const duty_loop_status_1 = require("../../lib/duty-loop-status");
8
+ const LOOP_STATUS_UNAVAILABLE = 'Loop status is unavailable because its historical source identity cannot be verified.';
6
9
  /**
7
10
  * Is this duty's loop installed and working? Names the loop state and
8
11
  * why, the next wakes, each watched source's access, the last stop and its
@@ -22,29 +25,31 @@ class DutiesStatus extends base_command_1.BaseCommand {
22
25
  };
23
26
  async run() {
24
27
  this.requireAuth();
25
- const { args } = await this.parse(DutiesStatus);
28
+ const { args, flags } = await this.parse(DutiesStatus);
29
+ let status;
26
30
  try {
27
- // Older servers can return a successful response that associates Check
28
- // and Run history by logical Duty ID alone. Its provenance is not
29
- // verifiable, including in machine-readable output.
30
- await duties_1.dutyApi.loopStatus(args.dutyId);
31
+ status = await duties_1.dutyApi.loopStatus(args.dutyId);
31
32
  }
32
33
  catch (err) {
33
- const code = err
34
- ?.response?.data;
34
+ const code = err?.response
35
+ ?.data;
35
36
  if (code?.error === 'DUTY_LOOP_STATUS_SOURCE_UNVERIFIED' ||
36
37
  code?.code === 'DUTY_LOOP_STATUS_SOURCE_UNVERIFIED') {
37
- this.error('Loop status is unavailable because its historical source identity cannot be verified.', {
38
- code: 'DUTY_LOOP_STATUS_SOURCE_UNVERIFIED',
39
- });
38
+ this.error(LOOP_STATUS_UNAVAILABLE, { code: 'DUTY_LOOP_STATUS_SOURCE_UNVERIFIED' });
40
39
  }
41
40
  this.handleApiError(err);
42
41
  }
43
- // Until a verified provenance contract is available, do not display an
44
- // old server's successful response. Preserve the same error for --json.
45
- this.error('Loop status is unavailable because its historical source identity cannot be verified.', {
46
- code: 'DUTY_LOOP_STATUS_SOURCE_UNVERIFIED',
47
- });
42
+ // An older server answered 200 from the logical Duty id alone and said nothing about its
43
+ // sources. Print a response only when the server declares its coverage, in JSON too.
44
+ if (!(0, duty_history_source_1.hasVerifiedDutyHistorySource)(status)) {
45
+ this.error(LOOP_STATUS_UNAVAILABLE, { code: 'DUTY_LOOP_STATUS_SOURCE_UNVERIFIED' });
46
+ }
47
+ if (flags.json) {
48
+ this.log(JSON.stringify(status, null, 2));
49
+ return;
50
+ }
51
+ for (const line of (0, duty_loop_status_1.formatDutyLoopStatus)(status))
52
+ this.log(line);
48
53
  }
49
54
  }
50
55
  exports.default = DutiesStatus;
@@ -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(),
@@ -24,23 +24,29 @@ class OutboxDrop extends base_command_1.BaseCommand {
24
24
  async run() {
25
25
  const { args, flags } = await this.parse(OutboxDrop);
26
26
  const profile = (0, keychain_1.getActiveProfile)();
27
- const entry = (0, outbox_1.listWrites)(profile).find((e) => e.id === args.id);
28
- if (!entry) {
29
- this.failWithCliError({
30
- message: `No queued write with id ${args.id}.`,
31
- code: 'NOT_FOUND',
32
- exit: 4,
33
- retryable: false,
34
- });
27
+ const releaseReplay = await (0, outbox_1.lockOutboxReplay)(profile);
28
+ try {
29
+ const entry = (0, outbox_1.listWrites)(profile).find((e) => e.id === args.id);
30
+ if (!entry) {
31
+ this.failWithCliError({
32
+ message: `No queued write with id ${args.id}.`,
33
+ code: 'NOT_FOUND',
34
+ exit: 4,
35
+ retryable: false,
36
+ });
37
+ }
38
+ (0, outbox_1.dropWrite)(args.id, profile);
39
+ if (flags.json) {
40
+ this.log(JSON.stringify({ dropped: entry }, null, 2));
41
+ return;
42
+ }
43
+ this.log(`Dropped the local record ${entry.id} (${entry.summary}). A previous attempt may have reached the server.`);
44
+ this.log('Payload, in case you still need it:');
45
+ this.log(JSON.stringify(entry.body, null, 2));
35
46
  }
36
- (0, outbox_1.dropWrite)(args.id, profile);
37
- if (flags.json) {
38
- this.log(JSON.stringify({ dropped: entry }, null, 2));
39
- return;
47
+ finally {
48
+ await releaseReplay();
40
49
  }
41
- this.log(`Dropped ${entry.id} (${entry.summary}). It was never sent.`);
42
- this.log('Payload, in case you still need it:');
43
- this.log(JSON.stringify(entry.body, null, 2));
44
50
  }
45
51
  }
46
52
  exports.default = OutboxDrop;
@@ -6,7 +6,7 @@ import { type OutboxEntry } from '../../lib/outbox';
6
6
  * sign-in — and a list that described every entry as "the API was unavailable"
7
7
  * sent a signed-out reader to wait for an outage that was not happening.
8
8
  */
9
- export declare function queuedBecause(entry: Pick<OutboxEntry, 'reason'>): {
9
+ export declare function queuedBecause(entry: Pick<OutboxEntry, 'reason' | 'replay'>): {
10
10
  label: string;
11
11
  kind: 'auth' | 'throttled' | 'unavailable' | 'other';
12
12
  };
@@ -14,6 +14,7 @@ export declare function outboxListSnapshot(profile?: string): {
14
14
  queued: OutboxEntry[];
15
15
  incident: import("../../lib/outbox").IncidentState | null;
16
16
  incidentActive: boolean;
17
+ originalContext: "unverified" | "not_applicable";
17
18
  };
18
19
  /**
19
20
  * `skrr outbox list` — what is queued, and why.
@@ -15,6 +15,10 @@ const outbox_1 = require("../../lib/outbox");
15
15
  * sent a signed-out reader to wait for an outage that was not happening.
16
16
  */
17
17
  function queuedBecause(entry) {
18
+ if (entry.replay?.state === 'sending')
19
+ return { label: 'outcome unknown', kind: 'other' };
20
+ if (entry.replay?.state === 'result_recorded')
21
+ return { label: 'result recorded', kind: 'other' };
18
22
  const status = entry.reason?.status;
19
23
  if (status === 401)
20
24
  return { label: 'sign-in refused (401)', kind: 'auth' };
@@ -32,6 +36,7 @@ function outboxListSnapshot(profile) {
32
36
  queued,
33
37
  incident,
34
38
  incidentActive: Boolean(incident && (0, outbox_1.isIncidentActive)(profile)),
39
+ originalContext: queued.length > 0 ? 'unverified' : 'not_applicable',
35
40
  };
36
41
  }
37
42
  /**
@@ -54,13 +59,13 @@ class OutboxList extends base_command_1.BaseCommand {
54
59
  async run() {
55
60
  const { flags } = await this.parse(OutboxList);
56
61
  const profile = (0, keychain_1.getActiveProfile)();
57
- const { queued: entries, incident, incidentActive } = outboxListSnapshot(profile);
62
+ const { queued: entries, incident, incidentActive, originalContext } = outboxListSnapshot(profile);
58
63
  if (flags.json) {
59
- this.printJsonResult((0, list_output_1.listResult)({ queued: entries, incident, incidentActive }, 'queued'));
64
+ this.printJsonResult((0, list_output_1.listResult)({ queued: entries, incident, incidentActive, originalContext }, 'queued'));
60
65
  return;
61
66
  }
62
67
  if (incident && incidentActive) {
63
- this.log(`Service state: ${incident.baseURL} last failed at ${incident.lastOutageAt}` +
68
+ this.log(`Local incident observation: configured server ${incident.baseURL}; failure recorded at ${incident.lastOutageAt}` +
64
69
  `${incident.status ? ` (HTTP ${incident.status})` : ''}, ` +
65
70
  `${incident.consecutive} consecutive failure(s).`);
66
71
  this.log('');
@@ -68,15 +73,17 @@ class OutboxList extends base_command_1.BaseCommand {
68
73
  else if (incident && entries.some((e) => queuedBecause(e).kind === 'unavailable')) {
69
74
  // A past incident is context only for entries an outage put here. Beside
70
75
  // a queue of sign-in refusals it reads as the explanation, and is not.
71
- this.log(`Last service incident: ${incident.baseURL} failed at ${incident.lastOutageAt}` +
76
+ this.log(`Last local incident observation: configured server ${incident.baseURL}; failure recorded at ${incident.lastOutageAt}` +
72
77
  `${incident.status ? ` (HTTP ${incident.status})` : ''}. ` +
73
78
  'No current outage is confirmed.');
74
79
  this.log('');
75
80
  }
76
81
  if (entries.length === 0) {
77
- this.log('Nothing queued — every write reached the server.');
82
+ this.log('Nothing is currently queued.');
78
83
  return;
79
84
  }
85
+ this.log('These records do not prove their original server, account, and workspace. Automatic replay is paused; inspect the JSON and reconcile the original result and target before taking further action.');
86
+ this.log('');
80
87
  (0, format_1.renderTable)(entries.map((e) => ({
81
88
  id: e.id,
82
89
  queued: e.queuedAt,
@@ -94,21 +101,23 @@ class OutboxList extends base_command_1.BaseCommand {
94
101
  { key: 'why', header: 'WHY', maxWidth: 24 },
95
102
  { key: 'attempts', header: 'TRIES' },
96
103
  ], (line) => this.log(line));
104
+ if (entries.some((e) => e.replay)) {
105
+ this.log('');
106
+ this.log('Started entries are not replayed again. Inspect their original target and result before deciding how to handle them.');
107
+ }
97
108
  const exhausted = entries.filter((e) => e.attempts >= outbox_1.MAX_REPLAY_ATTEMPTS);
98
109
  if (exhausted.length > 0) {
99
110
  this.log('');
100
- this.log(`${exhausted.length} entry(ies) hit the ${outbox_1.MAX_REPLAY_ATTEMPTS}-attempt cap and will not be ` +
101
- 'retried automatically. Inspect the failure, then retry or drop them explicitly.');
111
+ this.log(`${exhausted.length} entry(ies) hit the ${outbox_1.MAX_REPLAY_ATTEMPTS}-attempt cap. ` +
112
+ 'Automatic replay is paused; inspect their records and reconcile the original results.');
102
113
  }
103
114
  const authQueued = entries.filter((e) => queuedBecause(e).kind === 'auth').length;
104
115
  if (authQueued > 0) {
105
116
  this.log('');
106
- this.log(`${authQueued} entry(ies) were queued because the server refused this sign-in, not because ` +
107
- `it was down. Sign in with \`${this.config.bin} login\` first; a replay before that is ` +
108
- 'refused the same way.');
117
+ this.log(`${authQueued} entry(ies) were queued after a sign-in refusal. Signing in now does not prove which account originally made the request.`);
109
118
  }
110
119
  this.log('');
111
- this.log(`Replay: ${this.config.bin} outbox retry`);
120
+ this.log(`Inspect: ${this.config.bin} outbox list --json`);
112
121
  this.log(`Discard: ${this.config.bin} outbox drop <id>`);
113
122
  }
114
123
  }
@@ -1,19 +1,16 @@
1
1
  import { BaseCommand } from '../../base-command';
2
2
  /**
3
- * `skrr outbox retry` — replay queued writes once the service recovers.
3
+ * `skrr outbox retry` — inspect queued writes for safe replay.
4
+ * Existing records lack verified original context, so replay is paused.
4
5
  *
5
- * Safe to run at any time, and safe to run twice, because every entry carries
6
- * the idempotency key the original attempt would have used: a replay of a write
7
- * that DID land server-side collapses onto the original rather than creating a
8
- * second one. That property is what makes an automatic-looking retry acceptable
9
- * at all — without it this command would be a duplicate-content generator.
6
+ * A queued request can already have reached the server. Its key prevents a
7
+ * duplicate only when that endpoint actually enforces durable idempotency;
8
+ * the client cannot infer that guarantee from a key alone.
10
9
  *
11
10
  * Outcomes are kept distinct on purpose:
12
- * - sent — the server accepted it; the entry is removed.
13
- * - refused — the server rejected it (4xx). Retrying will not help, so the
14
- * entry is removed and reported; the content is echoed so it is
15
- * not lost silently.
16
- * - deferred — still an outage. The entry stays, its attempt count rises.
11
+ * - sent — a recognizable result was recorded; the local entry is kept.
12
+ * - refused — retained in the output shape for older consumers.
13
+ * - deferred — no confirmed success. The entry stays for reconciliation.
17
14
  */
18
15
  export default class OutboxRetry extends BaseCommand {
19
16
  static description: string;