@zktx.io/sui-mcp 0.5.0 → 0.6.1

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 (138) hide show
  1. package/README.md +21 -21
  2. package/dist/adapters/adapterPromptSurfaces.js +0 -20
  3. package/dist/adapters/deepbook/deepbookQuotePolicy.js +0 -4
  4. package/dist/adapters/deepbook/deepbookReviewEvidence.js +0 -9
  5. package/dist/adapters/deepbook/deepbookTransactionMaterialProducer.js +0 -9
  6. package/dist/adapters/intentPlanFactories.js +0 -6
  7. package/dist/core/action/contractNameRegistry.js +0 -53
  8. package/dist/core/action/forbiddenFields.js +0 -4
  9. package/dist/core/action/ptbVisualizationProducer.js +0 -3
  10. package/dist/core/action/receiptPtbGraph.js +0 -17
  11. package/dist/core/action/reviewTimeSimulationEvidence.js +0 -4
  12. package/dist/core/action/signableAdapterContract.js +0 -5
  13. package/dist/core/action/suiChainReceiptMapping.js +0 -18
  14. package/dist/core/action/suiChainReceiptReader.js +1 -21
  15. package/dist/core/action/suiChainReceiptVerifier.js +0 -10
  16. package/dist/core/action/transactionFunding.js +0 -7
  17. package/dist/core/action/types.js +0 -1
  18. package/dist/core/action/walletReviewContractAssembler.js +0 -2
  19. package/dist/core/activity/localDataService.js +65 -52
  20. package/dist/core/activity/localDataValidation.js +1 -3
  21. package/dist/core/activity/sqliteActivityStore.js +24 -24
  22. package/dist/core/activity/sqliteActivityStoreRows.js +0 -2
  23. package/dist/core/activity/sqliteActivityStoreSchema.js +81 -14
  24. package/dist/core/preferences/sqlitePreferencesRepository.js +5 -3
  25. package/dist/core/read/deepbookReadHelpers.js +0 -2
  26. package/dist/core/read/deepbookRegistry.js +0 -19
  27. package/dist/core/read/deepbookUsdcChartService.js +0 -2
  28. package/dist/core/read/readCardResult.js +0 -2
  29. package/dist/core/read/readService.js +0 -19
  30. package/dist/core/read/readServiceTypes.js +0 -2
  31. package/dist/core/session/cardSession.js +1 -5
  32. package/dist/core/session/cardSessionStore.js +54 -7
  33. package/dist/core/session/reviewValidity.js +0 -3
  34. package/dist/core/session/sessionRecordStore.js +0 -1
  35. package/dist/core/session/sessionStore.js +0 -32
  36. package/dist/core/session/settingsFileIdentity.js +9 -0
  37. package/dist/core/session/settingsFileProtocol.js +20 -0
  38. package/dist/core/session/settingsFileStore.js +337 -0
  39. package/dist/core/session/settingsInputError.js +32 -0
  40. package/dist/core/session/settingsOperation.js +220 -0
  41. package/dist/core/session/settingsPreparationSql.js +13 -0
  42. package/dist/core/session/settingsWorkflow.js +1183 -0
  43. package/dist/core/session/sqliteCardStore.js +0 -2
  44. package/dist/core/session/sqliteSessionStore.js +0 -51
  45. package/dist/core/session/sqliteSettingsWorkflowStore.js +453 -0
  46. package/dist/core/session/sqliteTransactionMaterialStore.js +0 -11
  47. package/dist/core/session/sqliteWalletWorkflowStore.js +160 -66
  48. package/dist/core/session/status.js +2 -4
  49. package/dist/core/session/transactionMaterialStore.js +0 -4
  50. package/dist/core/session/transactionRequest.js +0 -4
  51. package/dist/core/session/walletConnection.js +26 -10
  52. package/dist/core/session/walletWorkflow.js +70 -30
  53. package/dist/core/session/workflowState.js +14 -14
  54. package/dist/core/session/workflowView.js +18 -8
  55. package/dist/core/suiAddress.js +0 -5
  56. package/dist/core/suiEndpoint.js +0 -3
  57. package/dist/mcp/prompts.js +0 -12
  58. package/dist/mcp/responseGuidance.js +10 -5
  59. package/dist/mcp/schemas.js +0 -3
  60. package/dist/mcp/serverInfo.js +3 -4
  61. package/dist/mcp/toolNames.js +2 -2
  62. package/dist/mcp/tools/account/index.js +1 -19
  63. package/dist/mcp/tools/action/prepareSuiActionReview.js +0 -6
  64. package/dist/mcp/tools/read/readToolHelpers.js +5 -4
  65. package/dist/mcp/tools/read/serverStatusTools.js +0 -1
  66. package/dist/mcp/tools/session/executionResultTools.js +2 -2
  67. package/dist/mcp/tools/session/shared.js +1 -2
  68. package/dist/mcp/tools/session/statusTools.js +4 -5
  69. package/dist/mcp/tools/settings/index.js +8 -28
  70. package/dist/mcp-app/account.html +14 -14
  71. package/dist/mcp-app/account.notices.txt +1 -1
  72. package/dist/mcp-app/chart.html +9 -9
  73. package/dist/mcp-app/chart.notices.txt +1 -1
  74. package/dist/mcp-app/connect.html +14 -14
  75. package/dist/mcp-app/connect.notices.txt +1 -1
  76. package/dist/mcp-app/receipt.html +1298 -1463
  77. package/dist/mcp-app/receipt.notices.txt +226 -1204
  78. package/dist/mcp-app/review.html +1298 -1463
  79. package/dist/mcp-app/review.notices.txt +226 -1204
  80. package/dist/mcp-app/settings.html +3133 -0
  81. package/dist/mcp-app/settings.notices.txt +973 -0
  82. package/dist/mcp-ui/contracts.js +8 -2
  83. package/dist/mcp-ui/readCards.js +1 -1
  84. package/dist/mcp-ui/tools.js +34 -4
  85. package/dist/review-server/server.js +3 -51
  86. package/dist/runtime/application.js +41 -14
  87. package/dist/runtime/config.js +0 -2
  88. package/dist/runtime/localSettingsService.js +23 -2
  89. package/dist/runtime/logger.js +0 -2
  90. package/dist/runtime/reviewServerAcquire.js +1 -18
  91. package/dist/runtime/runtimeTermination.js +1 -4
  92. package/dist/runtime/shared/authenticatedFetch.js +2 -4
  93. package/dist/runtime/shared/control.js +4 -7
  94. package/dist/runtime/shared/dataAccess.js +0 -2
  95. package/dist/runtime/shared/http.js +14 -0
  96. package/dist/runtime/shared/mcpHttp.js +6 -6
  97. package/dist/runtime/shared/ownerLease.js +0 -4
  98. package/dist/runtime/shared/server.js +1 -2
  99. package/dist/runtime/shared/stdio.js +2 -5
  100. package/dist/runtime/smokeMainnetRead.js +0 -3
  101. package/dist/runtime/smokeReview.js +0 -4
  102. package/dist/runtime/start.js +0 -2
  103. package/dist/runtime/suiTransactionGraphqlMapping.js +0 -2
  104. package/dist/runtime/suiTransactionGraphqlQueries.js +0 -3
  105. package/dist/runtime/walletConnectConfig.js +0 -2
  106. package/dist/runtime/walletConnectStorage.js +2 -10
  107. package/dist/runtime/walletConnectTransport.js +0 -11
  108. package/dist/runtime/walletSdkChildRuntime.js +2 -6
  109. package/dist/runtime/walletSdkIpc.js +2 -1
  110. package/dist/runtime/walletSdkProcess.js +3 -8
  111. package/docs/AGENT_BEHAVIOR.md +45 -15
  112. package/docs/LOCAL_DB_ARCHITECTURE.md +145 -22
  113. package/docs/MCP_SETUP.md +99 -39
  114. package/docs/MCP_TOOLS.md +288 -24
  115. package/docs/SDK_API.md +63 -10
  116. package/docs/UTILITY_INDEX.md +9 -6
  117. package/docs/WALLET_CONNECTION.md +32 -10
  118. package/package.json +22 -8
  119. package/dist/core/activity/schemaVersion.js +0 -2
  120. package/dist/core/session/keyedRecordStore.js +0 -18
  121. package/dist/core/session/settingsSession.js +0 -1
  122. package/dist/core/session/settingsSessions.js +0 -45
  123. package/dist/review-app/brand-dark.svg +0 -1
  124. package/dist/review-app/brand-light.svg +0 -1
  125. package/dist/review-app/favicon.svg +0 -1
  126. package/dist/review-app/settings.css +0 -1
  127. package/dist/review-app/settings.js +0 -1
  128. package/dist/review-app/ui.css +0 -809
  129. package/dist/review-server/assets.js +0 -48
  130. package/dist/review-server/html.js +0 -45
  131. package/dist/review-server/http.js +0 -47
  132. package/dist/review-server/middleware/reviewToken.js +0 -7
  133. package/dist/review-server/settingsApi.js +0 -158
  134. package/docs/AGENT_DEVELOPMENT_POLICY.md +0 -815
  135. package/docs/FRONTEND_POLICY.md +0 -534
  136. package/docs/golden-scenarios/BEHAVIOR_MATRIX.md +0 -166
  137. package/docs/golden-scenarios/INTENT_EVIDENCE_GOLDEN_ANSWERS.md +0 -161
  138. package/docs/golden-scenarios/INTENT_EVIDENCE_MATRIX.md +0 -259
@@ -1,534 +0,0 @@
1
- # Frontend Policy
2
-
3
- Account, Receipt, Chart, Connect and Review use internal MCP Apps cards.
4
- Settings remains a local session-token page. Cards display backend-validated
5
- facts and forward explicit user selections through scoped app-only tools. They
6
- never hold transaction bytes/signatures or call a wallet, Sui RPC, Indexer or
7
- local HTTP endpoint directly. Direct NFT image loading is the display exception.
8
-
9
- ## Display and review facts
10
-
11
- Show what is happening, the relevant asset flow, whether an action is available,
12
- and its consequences before technical details. Backend status and validated
13
- structured facts are authoritative; AI interpretation, local timers and UI
14
- availability do not establish financial truth. Status/error changes must be
15
- textual, keyboard accessible and screen-reader labeled.
16
-
17
- Review primary facts include action, selected account, network, send limit
18
- (`up to` where relevant), expected/minimum receive, status and next action.
19
- `assetFlowPreview` display inputs are proposals, never signing quantities.
20
- Use "Minimum received on success" for the conditional minimum and label the
21
- trading fee as an estimate. Distinguish the estimated network fee from its
22
- maximum gas budget; neither is a recorded fee payment.
23
- Show the final ReviewState failed/warning checks beside the decision.
24
- The live Review action row gives roughly 70% of its width to the primary action
25
- and 30% to a warning-colored `Cancel` button (accessible name `Cancel review`).
26
- The primary action keeps the label `Request wallet approval` during renewal.
27
- Below the row, show the remaining time until this card's original review-input
28
- deadline. Refresh, Retry, visibility changes and state reads never restart that
29
- time. Use the earlier of card and review-session expiry for unsubmitted input;
30
- admitted requests retain their separate observation authority. The View displays
31
- the backend's relative remaining time and never extends a previously confirmed
32
- deadline. It cannot grant authority or declare a backend expiry on its own.
33
- The following feedback area shows a short progress hint during renewal, without
34
- a second countdown to the next condition check. Keep the request
35
- disabled until current backend facts permit approval. Normal
36
- `review_evidence_stale` renewal uses this progress hint rather than a failure
37
- warning. On an actual calculation failure, replace the unavailable approval
38
- button with `Retry review` in the same primary position. Delivery or
39
- read failures use the existing explicit retry or saved-state read in that same
40
- position. Show one primary control, with the reason below it; do not add a second
41
- disabled approval button. These recovery actions never request a signature.
42
- A successful refresh restores the approval request only after the new state is
43
- confirmed; the overall time continues decreasing. These presentation rules
44
- do not change backend checks, expiry, admission or signature authority.
45
- During renewal of the same live review, retain the graph and financial layout
46
- instead of replacing them with a short proposal placeholder. Clearly label
47
- retained material as previous and not current. Before any reviewed amounts exist,
48
- say that amounts have not been checked; do not imply there is an earlier review.
49
- The renderer owns these labels; the lifecycle selects the current or unconfirmed
50
- label without changing permissions. Current action permissions,
51
- progress and failure reasons remain separate from those display facts. Commit
52
- new financial facts together with their graph; keep approval disabled while that
53
- replacement is being drawn. Reuse an unchanged graph without resetting its
54
- controls. Never carry this retained presentation across a different session,
55
- plan or account, or use it as the graph of an observed transaction result.
56
- Human-readable evidence-stage explanatory notes precede final checks; retain them
57
- in labelled preparation details rather than presenting them as current failures. Keep raw integer amounts and
58
- pinned decimals; display signed net gas without clamping a rebate to zero.
59
- Review details include quote time, raw min-out policy, gas budget/breakdown,
60
- simulation effects, object/balance changes and a PTB graph from the same revision.
61
- PTB source labels, timestamps and name/address controls are facts,
62
- not safety or venue recommendations. No text-copy buttons or clipboard fallbacks.
63
-
64
- External proposals show source, action, recipients/targets, freshness, missing
65
- evidence, user choices, unsupported claims and nonSignableReason. They never
66
- expose a preparation/signature action or silently choose a settlement asset.
67
-
68
- ## Connect and Review behavior
69
-
70
- SQLite owns card permission/revision/deadline, wallet connections, review
71
- revisions and transaction attempts. A View owns only rendering, local resources
72
- and sequential observation. Chat changes, frame recreation and teardown never create a new request or replay an admitted action. A current authenticated live card can continue the same backend-directed preparation after confirming its saved state. With input permission, an initial authenticated DB read
73
- is required regardless of preview rendering success. Without that permission,
74
- read the same card's public saved resource before displaying its current state,
75
- even when the Host replays an older creating snapshot. This restores saved facts,
76
- never input or wallet authority. Missing permission means no business controls;
77
- unconfirmed state disables business actions. Malformed, conflicting or rejected permission is not treated
78
- as absent permission. Response identity and fixed targets must match the card.
79
-
80
- Public restoration can perform existing backend expiry and connection/session
81
- reconciliation; read-only does not mean that every database row stays unchanged.
82
- Those evaluations remain backend-owned and do not start another pairing,
83
- preparation, signature, submission or chain observation. Public restoration reads
84
- once and offers an explicit same-card read for unfinished state or a read failure;
85
- it does not start polling or expiry timers. Teardown ignores late replies. A
86
- failed read preserves an already displayed result without claiming current state.
87
-
88
- Connect shows wallet state and the selected account. The connected-wallet overview omits the separate Close action; Back in disconnection confirmation returns to the overview without sending a command. A connect-intent card prepares its QR automatically after authenticated state confirmation; manage pairs only after an explicit Connect wallet click; disconnect intent does not pair. It hides additional pairing while unexpired connected wallets or pending connection operations exist, and uses an in-card target-specific Confirm disconnect/Back step for disconnection. Confirmation is discarded when the card revision or target changes. Connect shows approved accounts and read context. An explicit connection with
89
- one approved account can set read context; multiple accounts require selection.
90
- The stored read context persists separately from default asset-read eligibility. An implicit asset read requires a usable current connection for the selected account; explicit-address reads and stored result reads do not. Clearing read context is not wallet disconnection. Reconciliation alone never
91
- sets it again. A waiting Connect card displays only the same live pairing QR
92
- from metadata bound to card/connection/revision. Missing metadata is shown as
93
- unavailable and never triggers new pairing. Terminal connections cannot be
94
- reactivated by late approval; another operation uses a new card.
95
-
96
- Connection facts and the current card operation are separate. A pending
97
- disconnect is projected from the stored accepted action, target and running
98
- card. Show its progress while retaining the last confirmed connection facts,
99
- exclude that connection from new selections, and observe until stored completion
100
- or failure. Do not end observation merely because the last connection status is
101
- connected. Frame recreation reads the same operation without sending it again.
102
- Current reads can recover completion after a storage failure; SDK unavailability
103
- must not be rendered as proof that the remote wallet connection was removed.
104
-
105
- Review preparation is separate from final admission. A current card automatically prepares a uniquely determined account/connection and renews stale verified material. The backend supplies the typed automatic action; the shared View executes it only with valid UI permission and confirmed state. A complete new review revision preserves failure information. It does not
106
- consume final selection. If a finished computation could not store its outcome,
107
- current reads can record its failed update and restore the existing update/cancel
108
- choices. The View never restarts computation to repair a progress display.
109
- The sign action requires backend-permitted
110
- ready_for_wallet_review, verified transaction review data, a matching live
111
- account and the user's wallet selection. With exactly one current candidate,
112
- show its wallet and account and use the explicit action button as that selection;
113
- do not require a dropdown. Multiple valid connections block preparation and signing; show the reason and direct the user to resolve them in Connect.
114
- Preparation never grants wallet approval. Only the approval request requires a normal-flow transaction button; failed preparation offers an explicit retry. Several approved addresses require selection within the single wallet connection. Cancel review beside the primary action explicitly ends this card’s unsubmitted input; it never cancels a submitted transaction. Only the backend sends bytes to the
115
- wallet and verifies its response. A card never reports its own chain result.
116
-
117
- Use the backend's preparation choices for account compatibility; do not recreate
118
- that rule in the View. The existing `review.error` text labels current account
119
- selection guidance and any saved review message separately. Display it
120
- as neutral explanatory text, not as a new failed state. Lifecycle alerts still
121
- report actual command, transport and display failures. Signing an already valid
122
- review and reading an admitted result retain their own backend permissions.
123
-
124
- Before submission, show the stored interruption reason without replacing wallet
125
- events with a user-stop explanation. After submission, a connection change or
126
- disconnect request preserves chain progress; only an explicit transaction stop
127
- ends observation. A later wallet event must not restart user-stopped observation.
128
-
129
- | Request state | Card behavior |
130
- | --- | --- |
131
- | No request | Show proposal/review; prepare or refresh when permitted, request wallet approval only when valid, or cancel input |
132
- | awaiting_signature | Show wallet wait; user may stop local waiting, which permanently removes submission permission |
133
- | submitting | Show submission in progress; stopping observation cannot cancel the transaction |
134
- | awaiting_chain_result | Show the exact digest and observation state; stop/resume observation when permitted |
135
- | stopped / request_failed | Show reason, without inventing chain failure; a new signature needs a newly reviewed revision |
136
- | outcome_unknown | Preserve known digest and uncertainty; read the same transaction without resubmitting |
137
- | completed | Show independently verified chain success/failure and receipt facts; no signing input restoration |
138
-
139
- Management cards bind an exact reviewSessionId and attemptId. They cannot
140
- change the original deadlines, review selection or submission permission.
141
- A valid saved history is not live management authority. Account/session changes
142
- invalidate pending approval as appropriate; they cannot silently rebind a review.
143
-
144
- ## Rendering and recovery
145
-
146
- Use the shared lifecycle for all cards. A lost action reply reads the same
147
- state once; it never resends the action. Read errors stop automatic observation
148
- and retain previous facts with explicit Check status recovery. This reads the
149
- same stored card; it does not recompute a review or submit a transaction. Rendering failures keep
150
- normal DB observation obligations, preserve previous content, and dispose only
151
- new failed resources. A rendering failure is not a reason to repeat the business
152
- query. QR and graph resources are disposed once. Review and Receipt show their transaction graph first, without an additional card frame. Review uses the current verified material, except for explicitly labelled previous material retained during same-target renewal; completed results use the executed transaction. A missing graph is labelled unavailable, never presented as current by substituting a different revision or a pre-execution graph. Opening details uses the same displayed facts without a new query or action; delayed renders cannot cross transaction identities. Backend-computed remaining
153
- time triggers a state read, not a client-written expiry reason.
154
-
155
- A renderer that fails before returning its view owns cleanup of the resources
156
- it already created. The frame cannot dispose an unfinished view it never received.
157
- View disposal is idempotent and prevents late drawing results from being applied.
158
-
159
- A failed whole-card display offers Check status even when its UI permission is
160
- present. An accepted current read can retry that display from the stored facts.
161
- A partial asynchronous drawing failure reports its actual local retry capability
162
- to the frame. Explicit Check status confirms the current card before retrying that
163
- same view's failed resource; polls and chat visibility changes do not constitute
164
- consent to repeatedly repaint an unchanged failed QR. Replaced or disposed views
165
- cannot retry their old resources. A QR failure does not disable a permitted Stop
166
- connecting or required observation. Missing private QR data is not a drawing
167
- failure: public saved reads cannot retrieve it, and navigation must not promise
168
- to restore it. None of these display callbacks requests a new pairing, review
169
- calculation, signature or submission, or clears a command's retry/pause state.
170
-
171
- A successful state read does not erase a failed command. If automatic-command admission
172
- is still unconfirmed, the View pauses automatic execution and offers Retry connection
173
- or Retry review for the failed action. Each retry starts a fresh read and confirms
174
- the same target and revision before sending once. Retry is disabled during another read; a discarded older response is not confirmation. A changed target requires a new click, not an automatic retry. An admitted
175
- operation is observed instead. Hidden/visible transitions do not clear this pause
176
- or retry a failed read. A rejected expired approval request is never replayed:
177
- after confirming state, only backend-permitted preparation may resume, and the
178
- new conditions require a new Request click.
179
-
180
- The common lifecycle owns separate facts for the accepted projection, current
181
- confirmation, in-flight communication, command delivery and relevance, local
182
- automation intent, and presentation failures. One decision supplies business
183
- controls, recovery, observation and notices. A read Promise is not confirmation:
184
- if a required confirmation joins a read started before that requirement, its
185
- successful completion is followed by one serial current read. An actual read
186
- failure requires explicit recovery; it is not retried automatically. A discarded
187
- fresh response retains a scheduled observation or explicit read recovery without
188
- a zero-delay loop. Opening-projection errors clear when the identified card's
189
- valid current read is accepted; they are not command failures or permission
190
- restoration. A missing or conflicting identity remains a rejected boundary.
191
-
192
- Command-delivery failure does not suppress state reads at backend expiry
193
- deadlines. When current state confirms that an unadmitted approval's material is
194
- stale, or its review revision has been superseded, the old command no longer
195
- blocks the current permitted preparation. Request absence alone is insufficient;
196
- never transfer an old approval click to new conditions. After failed initial
197
- preparation, a changed current account or connection is shown before an explicit
198
- Retry, which rereads and sends that displayed target once. A target change during
199
- that read requires a new click. Bound-account and wallet-change retry rules remain
200
- backend-owned.
201
-
202
- A read failure remains recoverable even if a delayed action response updates the
203
- display. Preserve the read error and Check status control, with business input
204
- and timers disabled, until an explicit current read succeeds. Validate identity,
205
- fixed inputs and non-regressing revision before clearing that error. Displayed
206
- facts, recovery controls and observation readiness must use the same decision;
207
- an older response or visibility change cannot independently restore authority.
208
-
209
- A successful response for the same card with a strictly lower revision is
210
- history, not a read failure. Check stable card identity before discarding it;
211
- validate admission-bound inputs and result targets when adopting a current
212
- snapshot. Equal revisions still require validation and may carry updated
213
- projections. A discarded response cannot replace facts, clear errors, extend
214
- deadlines or interrupt required observation. Restore a coalesced poll using the
215
- latest backend hints; an elapsed authority deadline keeps input locked until a
216
- current read is accepted. Do not spin on stale responses. Actual error envelopes
217
- remain errors even when accompanied by an old snapshot.
218
-
219
- Failed Cancel review, disconnection, account selection or stop-waiting commands
220
- retain their target-specific error after state reads. This View pauses new
221
- automatic preparation and pairing while observing any already admitted work.
222
- Current disconnection is not proof that a lost command was admitted and does not
223
- restart pairing from an earlier connect intent. Existing permitted controls
224
- provide explicit recovery. If Cancel review is unconfirmed and review material
225
- expires, show Continue review for permitted preparation; it uses a fresh target
226
- check and never requests a signature. Do not show this additional control in the
227
- normal automatic flow or restore actions to a cancelled/expired card. Local
228
- automatic pause is renderer context, not a modified backend projection or a
229
- persisted stop in other frames. Reading stored facts cannot clear that pause;
230
- the user must explicitly choose to continue. New frames follow actual DB state.
231
-
232
- Command delivery and present relevance are independent. Apply this to connection,
233
- preparation, approval, result reading, cancellation, disconnection, account
234
- selection and waiting controls, and to ordinary read-card submission. When the
235
- exact result is observed, display it without retrying a lost reply. When a failed
236
- attempt can no longer be used because its authority or target has ended, retain
237
- it under "Previous" with the specific request, selection or status check and
238
- its original error, not as a current error or a recovery demand. A previous
239
- request label must not imply that cancellation or disconnection succeeded.
240
- For unadmitted disconnection or account selection, identify the exact target in
241
- `connections`; the current card's `connection` describes an admitted operation.
242
- Target removal and account-list removal do not prove that the attempted command
243
- succeeded. Remember a confirmed end of that View attempt if the target returns,
244
- while displaying current wallet facts and allowing a new explicit selection.
245
- Missing target data or wallet unavailability alone is not proof of termination.
246
- An earlier-attempt label does not release a failed automatic command's explicit
247
- retry requirement or a user's local pause. A competing connection card points
248
- to the original waiting card; it never takes its QR or operation permission.
249
- Natural completion does not prove that a failed stop succeeded. Signing-wait
250
- `stopped` and post-submission `observationStopped` are distinct backend facts.
251
- Card authority expiry does not terminate an admitted request or lookup. Preserve
252
- its current observation even when no commands remain allowed. For an unknown
253
- result whose result-reading authority ended, the user can ask for a new management
254
- card for that same attempt; never recreate or resubmit the transaction. A separate
255
- current read failure still needs its own recovery alongside an earlier attempt.
256
-
257
- When failed review material becomes invalid, the backend preserves the original
258
- failure and stage history with `evidenceValidity: "invalidated"` and removes its
259
- material-derived facts. Those stages describe the last computation, not current
260
- evidence. This failure does not become an automatic renewal opportunity.
261
-
262
- An unadmitted ready Review also uses the backend's `nextStateReadAfterMs` hint
263
- to confirm state at its verified material expiry. Use the earlier positive
264
- interval from that hint and the card authority deadline. Lock business input
265
- until the read resolves; a failed read requires explicit recovery. Countdown
266
- hints do not identify new display content or reset a wallet selection. A stale verified review renews automatically through the same typed preparation action. A failed computation, changed account, missing permission or admitted request does not trigger automatic preparation. Countdown completion never authorizes signing or terminates an admitted request.
267
-
268
- Card state, action choices and timing hints come from the same backend
269
- evaluation. A read conflict caused by changed review evidence preserves the
270
- last display and requires explicit state-read recovery, with inputs and timers
271
- disabled. Prefer the safe error message when supplied; a reason code is not
272
- display copy. Do not recreate a business request or continuously retry a conflict.
273
-
274
- Only actions permitted by the current backend state are rendered. During an
275
- in-flight action, disable other business actions while preserving display
276
- controls. Preparation/transport failures and display failures have distinct
277
- messages and recovery. Amounts, slippage, target asset and venue are changed
278
- through a new reviewed proposal, not ad hoc frontend edits.
279
-
280
- Connect and Review show `walletAvailability` separately from stored business
281
- facts. Wallet unavailability preserves the displayed review and results, removes
282
- wallet-dependent actions, and does not become a rendering error. A connection
283
- that cannot be checked is labelled as the last recorded status with its update
284
- time. Pairing display data must be removed when the backend no longer supplies
285
- it, even if the card revision is unchanged.
286
-
287
- The backend derives `observe` from `progress.status === "waiting"`. Unavailable
288
- progress stops automatic polling and offers an explicit same-card state read;
289
- that read cannot reconnect, sign or resubmit. Existing DB expiry wake-ups remain
290
- independent of progress polling. Availability and allowed actions participate in
291
- display identity; remaining-time hints do not reset input selection.
292
-
293
- Wallet-service startup is separate from connection and transaction states.
294
- Show normal initialization neutrally. Connect owns connection, approved-address
295
- selection and exact-target disconnection; it has no Wallet service help section
296
- or service-restart control. Normal disconnected manage shows Connect wallet;
297
- opening manage never starts pairing. In `connectionConflict`, show each target
298
- and its Disconnect control in the main content, including enough identity to
299
- distinguish equal names or addresses. Hide account-use and review/signing
300
- controls until the backend reports a unique usable connection.
301
-
302
- The local confirmation stage describes presentation, not authority. Inform the
303
- common lifecycle when opening or leaving a disconnect confirmation so it applies
304
- current guidance and input locks to the new controls. Back cannot cancel a sent
305
- command, unlock another action, discard its error or resend it. Preserve the
306
- same View and opened Details during unchanged state reads; disposed callbacks
307
- cannot alter its replacement. Normal display changes do not postpone required
308
- backend state reads.
309
-
310
- For a stopped/unresponsive connection service, explain the actual operational
311
- path: fully quit all apps using Sui MCP, then reopen them. Closing a peer
312
- or window alone may not stop the shared owner. Do not promise that restart
313
- removes remote sessions or confirms an interrupted disconnect. Normal QR or
314
- initialization is not diagnosed as failure by a timer. An uncertain command
315
- first offers the same-request status check; the model cannot act for the user.
316
- Historical service-recovery cards retain their own recorded result and no new
317
- input. Their service outcome never implies connection approval, remote removal
318
- or a transaction outcome.
319
-
320
- Local-data counts describe the backend state at the time they are read. A later
321
- replacement warning must not use a stale count, especially zero, as an assurance
322
- that no unconfirmed transaction records will be deleted. Warn that replacement
323
- can remove those records and cannot cancel a transaction on Sui.
324
-
325
- ## Internal Read Cards
326
-
327
- Account and Receipt targets are established in chat, without card input forms. Missing targets produce a concise input-required message with no card record, source request, permissions or polling. The Account card shows SuiNS when available, the actual query address, coin totals, Display NFTs, an omitted-object count, fetched time and enumeration limits for an explicit or connection-qualified default address. The Receipt card shows execution outcome, balance changes, net gas, sender, digest and fetched time. The transaction graph is visible above the result. Technical input, object, call, event, identifier and timing facts are in one Details slide. Review uses the same observed-result layout and places earlier reviewed conditions in a separately labelled section of that slide, without nested disclosures. Reviewed estimates remain distinct from actual chain results. Internal request IDs, revisions and raw JSON dumps are not display requirements. Important failures, warnings and missing choices remain beside the active decision. The Chart card shows one selected DeepBook USDC pair with official intervals, the UTC period and any result-limit notice. When the pair is missing, optional interval/range choices are in Time range & interval, with an instruction to set them before choosing the pair; choosing the pair submits the complete valid query without a second Show chart button. Supplied pairs query directly. Detailed candle numbers are in an accessible disclosure. Candle count is not a form field; supplied limits, defaults and shortcut query values remain unchanged. Its initial time axis uses the saved request boundaries; omitted boundaries use available candle times, and a request without either boundary fits the returned candles. Boundary whitespace carries no price or volume. Empty results show the requested range and an explicit no-candles message. These are read-only views; they create no wallet connection, review approval, trading authority, P&L or fiat valuation.
328
-
329
- All read cards use one SQLite-backed input lifecycle and one View lifecycle. The View inserts a result node before invoking its mount callback. Size-dependent renderers wait for positive layout dimensions, ignore hidden zero-size layouts, and release observers and drawing resources on disposal. Chart resizing preserves the current viewport rather than reapplying the initial query range. Initialization reads the same card record. Chat navigation, frame recreation and teardown do not close input or cancel work. A valid unsubmitted selection remains available; admission or backend expiry ends that original input. A read may finish after its View closes. Completed results are static, remain stored until local data replacement/reset, and do not repeat the source query. A different selection after admission needs a new card.
330
-
331
- Static presentation may read the same saved result, missing details, or the state of an admitted operation when needed. Such reads do not restore controls or start a new business operation. Polling is sequential, uses the server-provided interval, and stops on completion, view closure or read error. Keep an already displayed result when a later read fails.
332
-
333
- The view uses MCP Apps host-mediated tool/resource calls. It does not fetch local HTTP endpoints, Sui RPC or the Indexer directly. App-only permissions travel in UI metadata and never appear in ordinary model content or saved resources. The backend checks permission, card, server expiry and expected revision and admits the selection atomically in SQLite. Identical duplicates return the stored request; conflicting input returns an authenticated current snapshot and an error. Lost replies require a same-card state read, never automatic resubmission.
334
-
335
- The View timer uses backend-computed remaining input time and asks for current state at expiry; it does not write an expiry or close reason. Teardown only disposes local observers, timers and rendering resources. Missing UI permission or a failed current-state read keeps input disabled without inventing a terminal state. Preserve previously displayed facts and expose recovery through a saved-state read. Server restart invalidates unfinished input/work without replaying it and preserves completed DB results.
336
-
337
- Receipt input values and their PTB graph use a typed UI-only metadata channel bound to card ID, transaction digest and revision. Model text, structured content and public saved resources omit those display details. A view displaying private receipt details must mark missing details as unavailable, not as an absence of transaction inputs. Receipt and completed Review expose those technical sections only in their Details slide. Missing private metadata cannot be recovered by weakening the public saved-resource boundary. Rendering uses the validated receipt. NFT image loading remains the permitted direct external-display exception; business queries still go through the backend.
338
-
339
- Internal cards provide no clipboard actions, copy buttons, or clipboard fallback controls. Preserve readable facts and ordinary text selection; where a PTB graph is shown, preserve its name/address controls and pan/zoom. NFT images retain no-referrer behavior and a failed-image placeholder. Theme follows the host. Card view cleanup ends timers, subscriptions and rendering observers without cancelling an already admitted server operation.
340
-
341
- All five cards, including Review management, adapt to the embedded frame width.
342
- Forms wrap, narrow fact rows stack their label above the value, and long addresses,
343
- amounts, names and records remain readable without widening the document. QR,
344
- chart and PTB drawing areas stay within the card; resizing changes presentation
345
- without repeating a business query or changing stored state. Responsive rules
346
- for shared atoms remain in the shared stylesheet.
347
-
348
- ## Language
349
-
350
- Use short, direct, non-promotional copy. Stable cards do not repeat generic
351
- "Saved result" or "Stored request state" labels above their actual facts.
352
- Lifecycle messages describe opening, unavailable current state and recovery;
353
- renderers describe business facts. Show times in UTC with exact values available.
354
- Unknown token decimals mean the display amount is unavailable; do not present
355
- raw integers as user token quantities.
356
-
357
- Do not say:
358
-
359
- - safe
360
- - recommended
361
- - best
362
- - guaranteed
363
- - approved by AI
364
-
365
- Prefer:
366
-
367
- - ready for your review
368
- - review needs updating
369
- - review blocked
370
- - expected to receive
371
- - minimum received on success
372
- - data retrieved
373
-
374
- Source fields keep their defined names and meanings. Use Data retrieved for
375
- `fetchedAt`; it is not the transaction's execution time. Use Estimates checked at
376
- and Estimates expire for review evidence, Connection expires for wallet-session
377
- expiry, and Request updated for request state changes. The overall Review expires
378
- in timer remains distinct from the shorter estimate validity period.
379
-
380
- Across cards, use these distinctions rather than treating similar words as
381
- interchangeable:
382
-
383
- | Card wording | Technical source | Meaning |
384
- | --- | --- | --- |
385
- | Sui mainnet | Verified network/chain facts; proposal `network` is a declaration | Product network; Declared network in an external proposal remains untrusted input |
386
- | Account address / Selected account / Reviewed account / Sender / Receiving account / Affected account | Query `account`, `activeAccount`, `review.account`, receipt `sender`, recipients and balance-change addresses | Query target, current selection, bound review and transaction roles; none is wallet authorization |
387
- | Ready for your review / Review needs updating / Review blocked | `ready_for_wallet_review` / `refresh_required` / `blocked`, displayed through `REVIEW_UI_LABELS` | Computed review information, not current permission to request a signature |
388
- | Transaction succeeded/failed on Sui | Verified `execution.status` / receipt `effectsStatus` | Independently observed chain outcome, not a completed tool call or wallet response |
389
- | Check status / Retry review / Check transaction result | `ui.read_card` or public saved resource / `prepare_review` / `read_result` | Read this card, recompute permitted review details, or observe the existing transaction; none requests a signature |
390
- | Retry connection / Request wallet approval | `connect` / `request_signature` | Explicit connection retry versus a permitted request for wallet approval; actual wallet approval is still required |
391
- | Continue review | `prepare_review` after the View's local pause and a fresh target check | Explicitly continue review updates; it does not authorize signing |
392
- | Stop connecting / Stop approval request / Stop checking result | `stop_connection` / `stop_waiting` in `awaiting_signature` / `stop_waiting` once submission has started | End pairing, remove this approval request's submission permission, or stop result observation; the last cannot cancel a submitted transaction |
393
- | Cancel review / Back | `cancel` / local confirmation-view navigation | End unsubmitted review input versus leave a confirmation screen without a backend action |
394
- | Estimated network fee / Network fee | Review `netGasMist` / receipt `gas.totalMist` | Simulated versus independently observed net gas after the storage rebate |
395
- | Network fee limit (gas budget) | `transactionReviewData.gas.gasBudgetRaw` / receipt `gas.budgetMist` | Transaction network-fee spending limit, distinct from an estimated or observed charge |
396
- | Earlier review message | `review.error` quotes the session's stored `preparationError` | A saved preparation failure or connection change, not proof of a previous computation attempt |
397
- | External proposal — view only | `ProposalReviewModel.nonSignableReason` and unsupported capabilities | Declared proposal information with no wallet approval or execution |
398
- | Transaction being reviewed / Executed transaction | Review PTB / receipt PTB | Candidate material versus the observed transaction; neither graph is a safety verdict or authorization |
399
-
400
- These are display-to-contract mappings, not wire-name aliases. Keep SDK method
401
- names, action/status enum values and persisted field names unchanged. The API
402
- reference owns response meanings and the local database architecture document
403
- owns storage meanings. `CardStore.readSaved` reads the persisted card projection
404
- with existing evaluation; its name does not promise a raw row read or permission
405
- recovery. Receipt code names refer to chain receipts even when the screen title
406
- is Transaction result.
407
-
408
- Advanced details retain exact gas, object, Move, event, raw-unit and protocol
409
- terms. Display labels must not rename public state enums, hide original failure
410
- causes or change their recovery actions.
411
-
412
- Ready for your review means that review details are available to inspect. It
413
- does not promise that wallet approval can currently be requested; read-only
414
- cards can show the same details without any action permission. Review needs
415
- updating describes out-of-date details, not a failed transaction. Updating review
416
- means preparing new review details; Checking status reads the existing card.
417
- Continue review changes this View's paused-update intent, so it is not renamed
418
- as a routine retry. Network fee amounts are after the storage rebate and may be
419
- negative; Network fee limit (gas budget) is a spending limit, not a fee estimate.
420
-
421
- Message producers describe confirmed facts without prescribing a View action.
422
- The View owns current guidance and names only controls that are available there,
423
- or a specific request the user can make in chat. A public or expired card must
424
- not tell its reader to click an unavailable update or approval action. Uncertain
425
- approval delivery and existing transaction results refer to the same request,
426
- never to sending another transaction. Past messages are quoted as messages from
427
- the earlier action, with its original phase and reason preserved. They are not
428
- current instructions or proof that cancellation or disconnection succeeded.
429
- External error text and known diagnostic codes retain their source meaning;
430
- unknown messages must not be translated into an invented cause. Display plain
431
- explanations of known Chart reason codes, with the original code in Details.
432
-
433
- Renderers describe their actual selection UI and domain next step; the common
434
- frame combines those facts with its current confirmation and recovery decision.
435
- The presence of a workflow button is not a proxy for an editable Chart form.
436
- An unadmitted Chart selection remains usable after a delivery failure, whereas
437
- an admitted query's result or source failure requires a new card for a new query.
438
- A confirmed expired review session needs a new-review instruction even when its
439
- later-created card record is still ready. Local timer expiry alone is not that
440
- confirmation. Connection instructions distinguish recorded connections, pending
441
- work and unavailable wallet state; an empty recorded list during unavailability
442
- does not establish that connecting is currently possible. Show each current
443
- next step once, separately from the quoted earlier-attempt message.
444
-
445
- Frontend labels stay in English. Localization must preserve protocol names, token symbols, object IDs, package IDs, and reason enums without translation.
446
-
447
- ## Shared UI And Design Principles
448
-
449
- The card views and remaining Settings page share one design-token set and one set of atomic UI
450
- components: vanilla TypeScript DOM helpers in `review-app/src/ui` plus the shared
451
- stylesheet `review-app/public/ui.css`, served at `/review-assets/ui.css`. There is
452
- no React, Vue, Svelte, or client router. Views compose the shared atoms and keep
453
- only their own layout, container, third-party-sizing, and composition CSS. The
454
- shared atoms are addressed by `ui-` prefixed classes that only the shared
455
- stylesheet declares; a page stylesheet declares no `ui-` class rule and no bare
456
- button, input, select, or textarea rule.
457
-
458
- The shared UI follows these durable principles:
459
-
460
- 1. Always-actionable controls: every actionable control shows hover, active, and
461
- keyboard-focus feedback. Controls are inert only during the deliberate,
462
- clearly-signaled async lock. Status and errors are conveyed as text, not color
463
- alone.
464
- 2. One consistent system: cards share one lifecycle, one component set, and the
465
- same element positions. Cards and token pages have no cross-page navigation.
466
- 3. Cards show the current step and next permitted action without permanently
467
- listing every earlier step. A completed transaction leads with its observed
468
- result; stored request state is not a second outcome. Settings preview and
469
- confirmation requirements are unchanged.
470
- 4. Primary result regions keep their position across data availability and show
471
- an explicit empty or unavailable state. Technical sections intentionally omitted
472
- from a summary do not require placeholder regions; the Account summary reports
473
- omitted-object counts only when there are such objects or an enumeration limit.
474
- 5. Time-based progress and quantitative completeness use different components: a
475
- progress bar only when a real value advances it, an indeterminate overlay for
476
- an unknown-duration wait, and a count plus checklist for an already-known
477
- "N of M".
478
- 6. An action's result or error is tied to that action, stays visible, and carries
479
- enough detail to diagnose afterward.
480
- 7. Restraint: each page shows only the information it needs, with generous spacing.
481
- 8. Information depth by importance: each page ranks its information and renders the
482
- user task first and most prominent. Internal cards are one document: plain sections, rows and whitespace replace nested cards. Supplementary facts use one closed Details slide with plain sections inside, never nested disclosures. Do not repeat summary values or status in another panel. Review and Receipt place the correct transaction graph above their concise decision/result. Important errors and costs remain visible. Settings retains its page layout.
483
-
484
- Theme: cards follow the host; the remaining Settings page has a theme toggle. A shared theme helper stores
485
- only the theme value (`light` or `dark`) under one fixed storage key; it never
486
- reads or writes a token, session id, wallet account, or any other state. The
487
- theme is the `data-theme` attribute on the document root and is applied through
488
- CSS variables with no inline styles, so it works under the strictest page CSP.
489
-
490
- Icons are SVG files or inline SVG, never an icon font or a CDN. The favicon
491
- (`favicon.svg`) and the theme-specific brand marks (`brand-light.svg`,
492
- `brand-dark.svg`) are served from `/review-assets/`; the header shows the brand
493
- mark for the active theme.
494
-
495
- ## Navigation
496
-
497
- Read cards open from purpose-specific MCP tools. They contain their own result and error states and do not link to removed Account, Receipt, Chart, home or HTML not-found pages. Cards and the Settings page have no cross-page navigation or linked brand exit.
498
-
499
- ## Security
500
-
501
- Tokens must not be accepted in query strings. Wallet addresses must not be written to local event logs in plaintext. Private keys, signatures, transaction bytes, and arbitrary Move calls must not appear in frontend state.
502
-
503
- Cards bundle script/style locally with the declared Host CSP and no external execution chunks. The Settings page uses local assets and Host/Origin/session-token checks. App-only tools require scoped UI permission, target and revision checks.
504
-
505
- Wallet and review screens must be keyboard reachable and screen-reader labeled. Status and error changes must be exposed as text, not color alone.
506
-
507
- Native push notifications are out of scope. A frontend may use low-authority browser affordances such as document title changes for off-tab terminal results, but only after server status changes.
508
-
509
- Each card has its own scoped input; live review and session state is shared in SQLite (see LOCAL_DB_ARCHITECTURE.md). Views never share mutable business state directly.
510
-
511
- ## Out Of Scope
512
-
513
- The frontend must not add:
514
-
515
- - additional live trading/chart dashboards beyond the read-only Chart card
516
- - portfolio dashboards
517
- - AI chat
518
- - trading recommendations
519
- - alerts
520
- - automatic transaction history dashboard pages
521
- - multi-wallet comparison
522
- - saved plans or bookmarks
523
- - arbitrary strategy controls
524
-
525
- The exclusions above target automatic, background-indexed, or
526
- recommendation-style surfaces. User-requested local record views are allowed
527
- only inside their narrow surfaces: the Account card shows a wallet
528
- asset snapshot at a fetched timestamp for an address from public on-chain reads,
529
- and the Receipt card shows server-read on-chain receipt facts
530
- for one transaction digest. Summaries of locally stored review and activity records are available through the MCP read tools. These views
531
- must not add P&L, valuation, performance, tax claims, or route ranking. They
532
- must not add background indexing.
533
-
534
- Authenticated automatic actions stop on hidden views, teardown, read errors and unavailable permission. Resuming confirms current state first; it never restarts a completed or invalidated request. SQLite admits at most one preparation at the current revision across frames. `review_evidence_stale` identifies formerly verified material that needs renewal; `quote_stale` from a failed computation requires explicit retry instead of an automatic loop. The visible countdown displays the original review-input lifetime, not financial completion percentage. Backend-directed condition checks continue independently. No automatic path requests a signature or resubmits a transaction.