@plasius/economy 0.6.0 → 0.8.0

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/README.md CHANGED
@@ -186,6 +186,29 @@ one boundary to durably accept verified evidence before acknowledgement and a
186
186
  second boundary to record the externally reconciled completed, failed, or
187
187
  no-op result.
188
188
 
189
+ ## Dual-approved operator adjustments
190
+
191
+ `OperatorAdjustmentPreviewV1` is the immutable value plan prepared by a
192
+ trusted site adapter. It binds the target account and component to the
193
+ server-resolved wallet, target and offset ledger accounts, deterministic
194
+ source lot, positive TokenSubunit magnitude, bounded reason, hashed ticket
195
+ reference, transfer/refund policy, and expiry. Browser and MCP callers may
196
+ request an account and component, but their wallet or ledger identifiers are
197
+ never authority.
198
+
199
+ `OperatorAdjustmentProposalV1` records the first operator's pending proposal.
200
+ `OperatorAdjustmentDecisionV1` requires another stable account and binds the
201
+ exact preview and proposal hashes. `OperatorAdjustmentExecutionV1` links an
202
+ approved plan to its source lot, immutable journal transaction and terminal
203
+ result receipt. A correction is a new `reverse-credit` proposal tied to the
204
+ original lot and transaction; the package exposes no set-balance or delete
205
+ operation.
206
+
207
+ The package validates and canonicalizes these records but deliberately does
208
+ not resolve platform owners, perform MFA step-up, evaluate capabilities or
209
+ flags, hash ticket references, persist proposals, or execute transactions.
210
+ Those controls stay in the consuming authority adapter.
211
+
189
212
  `verifyJournalChainSegment()` accepts an approved canonical-payload hash
190
213
  function, recomputes every transaction hash, checks previous-hash links and
191
214
  duplicate transaction IDs, and proves the resulting head against an expected
@@ -420,6 +443,68 @@ whose signed display amount it represents. Cursor contents and signatures are
420
443
  adapter concerns; `assertWalletActivityPageForPortfolio()` proves that a result
421
444
  never expands the authorized portfolio scope.
422
445
 
446
+ ## Pseudonymous Admin reporting
447
+
448
+ `AdminEconomyReportingQueryPortV1` defines provider-neutral global summary,
449
+ pseudonymous wallet balance, activity, and trend results for governed finance
450
+ operations. It does not grant access or query a database. A host must
451
+ authenticate the caller, enforce the stored rollout flags
452
+ `economy.admin-history.enabled` and `mcp.admin-economy-history.enabled` as
453
+ applicable, re-check the finance capability, and use a least-privilege
454
+ reporting projection.
455
+
456
+ The global summary is an identifier-free point-read projection. It contains
457
+ exact available, reserved, held, reward-progress and lifetime totals, wallet
458
+ counts, and the canonical positive authority sequence through which the
459
+ projection is current. Wallet balance pages contain separate audience-bound
460
+ wallet and subject aliases, a closed component/status code, exact non-negative
461
+ amounts, update time, and authority sequence. They are capped at 100 rows and
462
+ support stable available-descending or update-time-descending pagination.
463
+
464
+ Activity rows are deliberately narrow:
465
+
466
+ - timestamp, normalized type/status/source, and exact signed TokenSubunits;
467
+ - a closed non-identifying label code that the presentation layer maps to
468
+ localized text; and
469
+ - distinct opaque row and subject aliases produced by a versioned,
470
+ audience- and purpose-separated HMAC adapter.
471
+
472
+ The label-code allowlist is `token-acquisition`, `token-spend`,
473
+ `token-reversal`, `token-hold`, `token-activity-failed`,
474
+ `token-system-adjustment`, and `token-activity-unclassified`. A label must also
475
+ be valid for its activity type.
476
+
477
+ Failure rows may use exact zero when a failed workflow has no related economic
478
+ transaction or attempted amount. Zero remains invalid for every economically
479
+ meaningful activity type.
480
+
481
+ The validator accepts only plain enumerable data properties and rejects
482
+ serialization hooks and undeclared properties, including raw account, wallet,
483
+ transaction, order, payment, provider-event, idempotency, and journal-integrity
484
+ identifiers. It also rejects provider-specific source names and free-form
485
+ labels. Result metadata fixes `rawIdentifiersIncluded` to `false`.
486
+
487
+ Activity pages are capped at 100 rows. Cursor values use a versioned `c1.`
488
+ base64url confidentiality-protected opaque format and cannot contain raw
489
+ identifiers. A resumed request carries both that value and its trusted,
490
+ server-decoded binding to the original window, sort, filters, pseudonym
491
+ audience, and version. Result metadata echoes the normalized filter. The
492
+ deterministic default reporting window is 30 days and the interactive maximum
493
+ is 365 days.
494
+
495
+ Hourly trends are limited to 31 days and daily trends may cover the maximum
496
+ window. The result ceiling is 3,720 points, covering all five activity types
497
+ through the maximum hourly window. Trend cohorts with fewer than five distinct
498
+ subjects contain only a suppression marker.
499
+
500
+ Reported trend points carry either a calculated 28-window same-time
501
+ conventional median/MAD indicator or an explicit unavailable result. Only
502
+ non-suppressed baseline cohorts may enter the calculation. Median and MAD
503
+ values use reduced exact rational TokenSubunits with denominators up to two,
504
+ so no floating point or rounding is introduced. Indicators are review alerts
505
+ only and never mutate the ledger. Routine contracts contain no
506
+ identity-resolution operation.
507
+
423
508
  ## Persistence ports
424
509
 
425
510
  `EconomyPersistencePort` remains exported unchanged for existing consumers.