@allocator-one/rcl 4.5.3 → 4.5.4

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.
package/dist/index.js CHANGED
@@ -6,6 +6,7 @@ import { retainAssemblyRefusal } from './output/assembly-refusal.js';
6
6
  import { createReviewCycleRemote } from './converge/cycle-remote.js';
7
7
  import { assertNoPendingFreshReview, freshReviewOutputPaths } from './converge/fresh-review.js';
8
8
  import { previewStaleReport, applyStaleReport } from './converge/stale-report.js';
9
+ import { previewHistoricalDeliveryReconciliation, applyHistoricalDeliveryReconciliation } from './converge/historical-delivery-reconciliation.js';
9
10
  import { Command, InvalidArgumentError } from 'commander';
10
11
  import ora from 'ora';
11
12
  import chalk from 'chalk';
@@ -108,7 +109,7 @@ program.hook('preAction', async (_thisCommand, actionCommand) => {
108
109
  // Reads and explicit repairs must not flush unrelated evidence, even in preview.
109
110
  if (actionCommand.parent?.name() === 'evidence' && (name === 'show' || name === 'status'))
110
111
  return;
111
- if (name === 'converge-rejected' || name === 'converge-stale' || name === 'converge-gap' || name === 'recover-run' || name === 'recover-finding' || name === 'retriage-finding' || name === 'telemetry' || actionCommand.parent?.name() === 'telemetry' || name.includes('worker'))
112
+ if (name === 'converge-rejected' || name === 'converge-stale' || name === 'converge-gap' || name === 'converge-reconcile-history' || name === 'recover-run' || name === 'recover-finding' || name === 'retriage-finding' || name === 'telemetry' || actionCommand.parent?.name() === 'telemetry' || name.includes('worker'))
112
113
  return;
113
114
  const flags = actionCommand.opts();
114
115
  if (flags.telemetry === false || (process.env['RCL_TELEMETRY'] ?? '').trim().toLowerCase() === 'off')
@@ -417,6 +418,47 @@ program
417
418
  }
418
419
  });
419
420
  // Cross-round finding identity + machine-enforced round cap (RCL-24).
421
+ program
422
+ .command('converge-reconcile-history')
423
+ .description('Preview or apply an exact historical delivery reconciliation after lastLaunch advanced')
424
+ .option('--preview').option('--apply')
425
+ .option('--manifest <path>', 'Exact reviewed preview output for apply')
426
+ .option('--manifest-sha256 <sha256>', 'Exact reviewed manifest digest for apply')
427
+ .option('--target <target>').option('--run <uuid>')
428
+ .action(async (opts) => {
429
+ try {
430
+ if ([opts.preview, opts.apply].filter(Boolean).length !== 1)
431
+ throw new Error('choose_exactly_one_historical_reconciliation_mode');
432
+ const common = await resolveGitCommonDir();
433
+ const opened = await openReadSink({ rclVersion: RCL_VERSION });
434
+ if (!opened.sink)
435
+ throw new Error(`historical_delivery_reconciliation_credential_unavailable: ${opened.note}`);
436
+ if (opts.preview) {
437
+ if (opts.manifest !== undefined || opts.manifestSha256 !== undefined ||
438
+ typeof opts.target !== 'string' || typeof opts.run !== 'string') {
439
+ throw new Error('historical_delivery_reconciliation_preview_arguments_invalid');
440
+ }
441
+ const manifest = await previewHistoricalDeliveryReconciliation({ target: opts.target, runId: opts.run }, common, opened.sink);
442
+ const bytes = serializeRecoveryDocument(manifest);
443
+ process.stderr.write(`manifest-sha256 ${sha256(bytes)}\n`);
444
+ process.stdout.write(bytes);
445
+ }
446
+ else {
447
+ if (opts.target !== undefined || opts.run !== undefined || typeof opts.manifest !== 'string' ||
448
+ typeof opts.manifestSha256 !== 'string')
449
+ throw new Error('apply_uses_only_pinned_manifest');
450
+ const result = await applyHistoricalDeliveryReconciliation({ manifest: opts.manifest,
451
+ manifestSha256: opts.manifestSha256 }, common, opened.sink);
452
+ console.log(JSON.stringify({ mode: 'apply', result, accounting: 'unchanged',
453
+ scope: 'historical local authority receipt only; no admission, provider calls or approval' }));
454
+ }
455
+ }
456
+ catch (error) {
457
+ console.error(JSON.stringify({ error: { code: 'RCL_CONVERGE_RECONCILE_HISTORY',
458
+ message: error instanceof Error ? error.message : String(error) } }));
459
+ process.exitCode = 3;
460
+ }
461
+ });
420
462
  program
421
463
  .command('converge-stale')
422
464
  .description('Preview/apply/resume an audited stale unadmitted report disposition; preserves reports, attempts and findings')