@zktx.io/sui-mcp 0.6.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 (103) hide show
  1. package/README.md +18 -18
  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 +0 -6
  20. package/dist/core/activity/sqliteActivityStore.js +0 -8
  21. package/dist/core/activity/sqliteActivityStoreRows.js +0 -2
  22. package/dist/core/activity/sqliteActivityStoreSchema.js +0 -4
  23. package/dist/core/read/deepbookReadHelpers.js +0 -2
  24. package/dist/core/read/deepbookRegistry.js +0 -19
  25. package/dist/core/read/deepbookUsdcChartService.js +0 -2
  26. package/dist/core/read/readCardResult.js +0 -2
  27. package/dist/core/read/readService.js +0 -19
  28. package/dist/core/read/readServiceTypes.js +0 -2
  29. package/dist/core/session/cardSession.js +0 -4
  30. package/dist/core/session/cardSessionStore.js +1 -4
  31. package/dist/core/session/reviewValidity.js +0 -3
  32. package/dist/core/session/sessionRecordStore.js +0 -1
  33. package/dist/core/session/sessionStore.js +0 -15
  34. package/dist/core/session/settingsFileIdentity.js +0 -2
  35. package/dist/core/session/settingsFileProtocol.js +0 -5
  36. package/dist/core/session/settingsFileStore.js +1 -10
  37. package/dist/core/session/settingsInputError.js +0 -2
  38. package/dist/core/session/settingsOperation.js +0 -4
  39. package/dist/core/session/settingsPreparationSql.js +0 -2
  40. package/dist/core/session/settingsWorkflow.js +1 -37
  41. package/dist/core/session/sqliteCardStore.js +0 -2
  42. package/dist/core/session/sqliteSessionStore.js +0 -11
  43. package/dist/core/session/sqliteSettingsWorkflowStore.js +0 -10
  44. package/dist/core/session/sqliteTransactionMaterialStore.js +0 -11
  45. package/dist/core/session/sqliteWalletWorkflowStore.js +0 -29
  46. package/dist/core/session/status.js +0 -2
  47. package/dist/core/session/transactionMaterialStore.js +0 -4
  48. package/dist/core/session/transactionRequest.js +0 -4
  49. package/dist/core/session/walletConnection.js +0 -3
  50. package/dist/core/session/walletWorkflow.js +3 -21
  51. package/dist/core/session/workflowState.js +0 -8
  52. package/dist/core/session/workflowView.js +0 -6
  53. package/dist/core/suiAddress.js +0 -5
  54. package/dist/core/suiEndpoint.js +0 -3
  55. package/dist/mcp/prompts.js +0 -12
  56. package/dist/mcp/schemas.js +0 -3
  57. package/dist/mcp/tools/action/prepareSuiActionReview.js +0 -6
  58. package/dist/mcp/tools/read/serverStatusTools.js +0 -1
  59. package/dist/mcp/tools/session/shared.js +0 -2
  60. package/dist/mcp/tools/session/statusTools.js +0 -2
  61. package/dist/mcp-app/account.html +1 -1
  62. package/dist/mcp-app/chart.html +6 -6
  63. package/dist/mcp-app/connect.html +6 -6
  64. package/dist/mcp-app/receipt.html +298 -298
  65. package/dist/mcp-app/review.html +237 -237
  66. package/dist/mcp-app/settings.html +1 -1
  67. package/dist/mcp-ui/tools.js +3 -4
  68. package/dist/review-server/server.js +0 -2
  69. package/dist/runtime/application.js +1 -1
  70. package/dist/runtime/config.js +0 -2
  71. package/dist/runtime/localSettingsService.js +0 -3
  72. package/dist/runtime/logger.js +0 -2
  73. package/dist/runtime/reviewServerAcquire.js +1 -18
  74. package/dist/runtime/runtimeTermination.js +1 -4
  75. package/dist/runtime/shared/authenticatedFetch.js +0 -6
  76. package/dist/runtime/shared/control.js +0 -2
  77. package/dist/runtime/shared/dataAccess.js +0 -2
  78. package/dist/runtime/shared/mcpHttp.js +0 -5
  79. package/dist/runtime/shared/ownerLease.js +0 -4
  80. package/dist/runtime/shared/server.js +0 -1
  81. package/dist/runtime/shared/stdio.js +2 -5
  82. package/dist/runtime/smokeMainnetRead.js +0 -2
  83. package/dist/runtime/smokeReview.js +0 -4
  84. package/dist/runtime/start.js +0 -2
  85. package/dist/runtime/suiTransactionGraphqlMapping.js +0 -2
  86. package/dist/runtime/suiTransactionGraphqlQueries.js +0 -3
  87. package/dist/runtime/walletConnectConfig.js +0 -2
  88. package/dist/runtime/walletConnectStorage.js +0 -6
  89. package/dist/runtime/walletConnectTransport.js +0 -11
  90. package/dist/runtime/walletSdkChildRuntime.js +0 -5
  91. package/dist/runtime/walletSdkProcess.js +0 -6
  92. package/docs/AGENT_BEHAVIOR.md +1 -5
  93. package/docs/LOCAL_DB_ARCHITECTURE.md +3 -3
  94. package/docs/MCP_SETUP.md +14 -14
  95. package/docs/MCP_TOOLS.md +15 -0
  96. package/docs/SDK_API.md +12 -0
  97. package/docs/WALLET_CONNECTION.md +2 -1
  98. package/package.json +10 -2
  99. package/docs/AGENT_DEVELOPMENT_POLICY.md +0 -819
  100. package/docs/FRONTEND_POLICY.md +0 -611
  101. package/docs/golden-scenarios/BEHAVIOR_MATRIX.md +0 -166
  102. package/docs/golden-scenarios/INTENT_EVIDENCE_GOLDEN_ANSWERS.md +0 -161
  103. package/docs/golden-scenarios/INTENT_EVIDENCE_MATRIX.md +0 -259
@@ -1,611 +0,0 @@
1
- # Frontend Policy
2
-
3
- Account, Receipt, Chart, Connect, Review and Settings use internal MCP Apps cards.
4
- There is no external Settings 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
- All six cards use the same product UI and interaction rules across desktop
10
- Hosts. Equivalent validated data, authority, time, theme and viewport produce
11
- the same information, labels, controls and recovery flow. Qualified transport
12
- formats are normalized at the common integration boundary; Host names do not
13
- select product features or grant authority. Native window chrome and file
14
- pickers belong to the Host. Actual delivery remains a required integration
15
- check; a common error screen does not establish working file delivery.
16
-
17
- ## Display and review facts
18
-
19
- Show what is happening, the relevant asset flow, whether an action is available,
20
- and its consequences before technical details. Backend status and validated
21
- structured facts are authoritative; AI interpretation, local timers and UI
22
- availability do not establish financial truth. Status/error changes must be
23
- textual, keyboard accessible and screen-reader labeled.
24
-
25
- Review primary facts include action, selected account, network, send limit
26
- (`up to` where relevant), expected/minimum receive, status and next action.
27
- `assetFlowPreview` display inputs are proposals, never signing quantities.
28
- Use "Minimum received on success" for the conditional minimum and label the
29
- trading fee as an estimate. Distinguish the estimated network fee from its
30
- maximum gas budget; neither is a recorded fee payment.
31
- Show the final ReviewState failed/warning checks beside the decision.
32
- The live Review action row gives roughly 70% of its width to the primary action
33
- and 30% to a warning-colored `Cancel` button (accessible name `Cancel review`).
34
- The primary action keeps the label `Request wallet approval` during renewal.
35
- Below the row, show the remaining time until this card's original review-input
36
- deadline. Refresh, Retry, visibility changes and state reads never restart that
37
- time. Use the earlier of card and review-session expiry for unsubmitted input;
38
- admitted requests retain their separate observation authority. The View displays
39
- the backend's relative remaining time and never extends a previously confirmed
40
- deadline. It cannot grant authority or declare a backend expiry on its own.
41
- The following feedback area shows a short progress hint during renewal, without
42
- a second countdown to the next condition check. Keep the request
43
- disabled until current backend facts permit approval. Normal
44
- `review_evidence_stale` renewal uses this progress hint rather than a failure
45
- warning. On an actual calculation failure, replace the unavailable approval
46
- button with `Retry review` in the same primary position. Delivery or
47
- read failures use the existing explicit retry or saved-state read in that same
48
- position. Show one primary control, with the reason below it; do not add a second
49
- disabled approval button. These recovery actions never request a signature.
50
- A successful refresh restores the approval request only after the new state is
51
- confirmed; the overall time continues decreasing. These presentation rules
52
- do not change backend checks, expiry, admission or signature authority.
53
- During renewal of the same live review, retain the graph and financial layout
54
- instead of replacing them with a short proposal placeholder. Clearly label
55
- retained material as previous and not current. Before any reviewed amounts exist,
56
- say that amounts have not been checked; do not imply there is an earlier review.
57
- The renderer owns these labels; the lifecycle selects the current or unconfirmed
58
- label without changing permissions. Current action permissions,
59
- progress and failure reasons remain separate from those display facts. Commit
60
- new financial facts together with their graph; keep approval disabled while that
61
- replacement is being drawn. Reuse an unchanged graph without resetting its
62
- controls. Never carry this retained presentation across a different session,
63
- plan or account, or use it as the graph of an observed transaction result.
64
- Human-readable evidence-stage explanatory notes precede final checks; retain them
65
- in labelled preparation details rather than presenting them as current failures. Keep raw integer amounts and
66
- pinned decimals; display signed net gas without clamping a rebate to zero.
67
- Review details include quote time, raw min-out policy, gas budget/breakdown,
68
- simulation effects, object/balance changes and a PTB graph from the same revision.
69
- PTB source labels, timestamps and name/address controls are facts,
70
- not safety or venue recommendations. No text-copy buttons or clipboard fallbacks.
71
-
72
- External proposals show source, action, recipients/targets, freshness, missing
73
- evidence, user choices, unsupported claims and nonSignableReason. They never
74
- expose a preparation/signature action or silently choose a settlement asset.
75
-
76
- ## Connect and Review behavior
77
-
78
- SQLite owns card permission/revision/deadline, wallet connections, review
79
- revisions and transaction attempts. A View owns only rendering, local resources
80
- 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
81
- is required regardless of preview rendering success. Without that permission,
82
- read the same card's public saved resource before displaying its current state,
83
- even when the Host replays an older creating snapshot. This restores saved facts,
84
- never input or wallet authority. Missing permission means no business controls;
85
- unconfirmed state disables business actions. Malformed, conflicting or rejected permission is not treated
86
- as absent permission. Response identity and fixed targets must match the card.
87
-
88
- Public restoration can perform existing backend expiry and connection/session
89
- reconciliation; read-only does not mean that every database row stays unchanged.
90
- Those evaluations remain backend-owned and do not start another pairing,
91
- preparation, signature, submission or chain observation. Public restoration reads
92
- once and offers an explicit same-card read for unfinished state or a read failure;
93
- it does not start polling or expiry timers. Teardown ignores late replies. A
94
- failed read preserves an already displayed result without claiming current state.
95
-
96
- 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
97
- one approved account can set read context; multiple accounts require selection.
98
- 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
99
- sets it again. A waiting Connect card displays only the same live pairing QR
100
- from metadata bound to card/connection/revision. Missing metadata is shown as
101
- unavailable and never triggers new pairing. Terminal connections cannot be
102
- reactivated by late approval; another operation uses a new card.
103
-
104
- Connection facts and the current card operation are separate. A pending
105
- disconnect is projected from the stored accepted action, target and running
106
- card. Show its progress while retaining the last confirmed connection facts,
107
- exclude that connection from new selections, and observe until stored completion
108
- or failure. Do not end observation merely because the last connection status is
109
- connected. Frame recreation reads the same operation without sending it again.
110
- Current reads can recover completion after a storage failure; SDK unavailability
111
- must not be rendered as proof that the remote wallet connection was removed.
112
-
113
- 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
114
- consume final selection. If a finished computation could not store its outcome,
115
- current reads can record its failed update and restore the existing update/cancel
116
- choices. The View never restarts computation to repair a progress display.
117
- The sign action requires backend-permitted
118
- ready_for_wallet_review, verified transaction review data, a matching live
119
- account and the user's wallet selection. With exactly one current candidate,
120
- show its wallet and account and use the explicit action button as that selection;
121
- do not require a dropdown. Multiple valid connections block preparation and signing; show the reason and direct the user to resolve them in Connect.
122
- 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
123
- wallet and verifies its response. A card never reports its own chain result.
124
-
125
- Use the backend's preparation choices for account compatibility; do not recreate
126
- that rule in the View. The existing `review.error` text labels current account
127
- selection guidance and any saved review message separately. Display it
128
- as neutral explanatory text, not as a new failed state. Lifecycle alerts still
129
- report actual command, transport and display failures. Signing an already valid
130
- review and reading an admitted result retain their own backend permissions.
131
-
132
- Before submission, show the stored interruption reason without replacing wallet
133
- events with a user-stop explanation. After submission, a connection change or
134
- disconnect request preserves chain progress; only an explicit transaction stop
135
- ends observation. A later wallet event must not restart user-stopped observation.
136
-
137
- | Request state | Card behavior |
138
- | --- | --- |
139
- | No request | Show proposal/review; prepare or refresh when permitted, request wallet approval only when valid, or cancel input |
140
- | awaiting_signature | Show wallet wait; user may stop local waiting, which permanently removes submission permission |
141
- | submitting | Show submission in progress; stopping observation cannot cancel the transaction |
142
- | awaiting_chain_result | Show the exact digest and observation state; stop/resume observation when permitted |
143
- | stopped / request_failed | Show reason, without inventing chain failure; a new signature needs a newly reviewed revision |
144
- | outcome_unknown | Preserve known digest and uncertainty; read the same transaction without resubmitting |
145
- | completed | Show independently verified chain success/failure and receipt facts; no signing input restoration |
146
-
147
- Management cards bind an exact reviewSessionId and attemptId. They cannot
148
- change the original deadlines, review selection or submission permission.
149
- A valid saved history is not live management authority. Account/session changes
150
- invalidate pending approval as appropriate; they cannot silently rebind a review.
151
-
152
- ## Rendering and recovery
153
-
154
- Use the shared lifecycle for all cards. A lost action reply reads the same
155
- state once; it never resends the action. Read errors stop automatic observation
156
- and retain previous facts with explicit Check status recovery. This reads the
157
- same stored card; it does not recompute a review or submit a transaction. Rendering failures keep
158
- normal DB observation obligations, preserve previous content, and dispose only
159
- new failed resources. A rendering failure is not a reason to repeat the business
160
- 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
161
- time triggers a state read, not a client-written expiry reason.
162
-
163
- A renderer that fails before returning its view owns cleanup of the resources
164
- it already created. The frame cannot dispose an unfinished view it never received.
165
- View disposal is idempotent and prevents late drawing results from being applied.
166
-
167
- A failed whole-card display offers Check status even when its UI permission is
168
- present. An accepted current read can retry that display from the stored facts.
169
- A partial asynchronous drawing failure reports its actual local retry capability
170
- to the frame. Explicit Check status confirms the current card before retrying that
171
- same view's failed resource; polls and chat visibility changes do not constitute
172
- consent to repeatedly repaint an unchanged failed QR. Replaced or disposed views
173
- cannot retry their old resources. A QR failure does not disable a permitted Stop
174
- connecting or required observation. Missing private QR data is not a drawing
175
- failure: public saved reads cannot retrieve it, and navigation must not promise
176
- to restore it. None of these display callbacks requests a new pairing, review
177
- calculation, signature or submission, or clears a command's retry/pause state.
178
-
179
- A successful state read does not erase a failed command. If automatic-command admission
180
- is still unconfirmed, the View pauses automatic execution and offers Retry connection
181
- or Retry review for the failed action. Each retry starts a fresh read and confirms
182
- 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
183
- operation is observed instead. Hidden/visible transitions do not clear this pause
184
- or retry a failed read. A rejected expired approval request is never replayed:
185
- after confirming state, only backend-permitted preparation may resume, and the
186
- new conditions require a new Request click.
187
-
188
- The common lifecycle owns separate facts for the accepted projection, current
189
- confirmation, in-flight communication, command delivery and relevance, local
190
- automation intent, and presentation failures. One decision supplies business
191
- controls, recovery, observation and notices. A read Promise is not confirmation:
192
- if a required confirmation joins a read started before that requirement, its
193
- successful completion is followed by one serial current read. An actual read
194
- failure requires explicit recovery; it is not retried automatically. A discarded
195
- fresh response retains a scheduled observation or explicit read recovery without
196
- a zero-delay loop. Opening-projection errors clear when the identified card's
197
- valid current read is accepted; they are not command failures or permission
198
- restoration. A missing or conflicting identity remains a rejected boundary.
199
-
200
- Command-delivery failure does not suppress state reads at backend expiry
201
- deadlines. When current state confirms that an unadmitted approval's material is
202
- stale, or its review revision has been superseded, the old command no longer
203
- blocks the current permitted preparation. Request absence alone is insufficient;
204
- never transfer an old approval click to new conditions. After failed initial
205
- preparation, a changed current account or connection is shown before an explicit
206
- Retry, which rereads and sends that displayed target once. A target change during
207
- that read requires a new click. Bound-account and wallet-change retry rules remain
208
- backend-owned.
209
-
210
- A read failure remains recoverable even if a delayed action response updates the
211
- display. Preserve the read error and Check status control, with business input
212
- and timers disabled, until an explicit current read succeeds. Validate identity,
213
- fixed inputs and non-regressing revision before clearing that error. Displayed
214
- facts, recovery controls and observation readiness must use the same decision;
215
- an older response or visibility change cannot independently restore authority.
216
-
217
- A successful response for the same card with a strictly lower revision is
218
- history, not a read failure. Check stable card identity before discarding it;
219
- validate admission-bound inputs and result targets when adopting a current
220
- snapshot. Equal revisions still require validation and may carry updated
221
- projections. A discarded response cannot replace facts, clear errors, extend
222
- deadlines or interrupt required observation. Restore a coalesced poll using the
223
- latest backend hints; an elapsed authority deadline keeps input locked until a
224
- current read is accepted. Do not spin on stale responses. Actual error envelopes
225
- remain errors even when accompanied by an old snapshot.
226
-
227
- Failed Cancel review, disconnection, account selection or stop-waiting commands
228
- retain their target-specific error after state reads. This View pauses new
229
- automatic preparation and pairing while observing any already admitted work.
230
- Current disconnection is not proof that a lost command was admitted and does not
231
- restart pairing from an earlier connect intent. Existing permitted controls
232
- provide explicit recovery. If Cancel review is unconfirmed and review material
233
- expires, show Continue review for permitted preparation; it uses a fresh target
234
- check and never requests a signature. Do not show this additional control in the
235
- normal automatic flow or restore actions to a cancelled/expired card. Local
236
- automatic pause is renderer context, not a modified backend projection or a
237
- persisted stop in other frames. Reading stored facts cannot clear that pause;
238
- the user must explicitly choose to continue. New frames follow actual DB state.
239
-
240
- Command delivery and present relevance are independent. Apply this to connection,
241
- preparation, approval, result reading, cancellation, disconnection, account
242
- selection and waiting controls, and to ordinary read-card submission. When the
243
- exact result is observed, display it without retrying a lost reply. When a failed
244
- attempt can no longer be used because its authority or target has ended, retain
245
- it under "Previous" with the specific request, selection or status check and
246
- its original error, not as a current error or a recovery demand. A previous
247
- request label must not imply that cancellation or disconnection succeeded.
248
- For unadmitted disconnection or account selection, identify the exact target in
249
- `connections`; the current card's `connection` describes an admitted operation.
250
- Target removal and account-list removal do not prove that the attempted command
251
- succeeded. Remember a confirmed end of that View attempt if the target returns,
252
- while displaying current wallet facts and allowing a new explicit selection.
253
- Missing target data or wallet unavailability alone is not proof of termination.
254
- An earlier-attempt label does not release a failed automatic command's explicit
255
- retry requirement or a user's local pause. A competing connection card points
256
- to the original waiting card; it never takes its QR or operation permission.
257
- Natural completion does not prove that a failed stop succeeded. Signing-wait
258
- `stopped` and post-submission `observationStopped` are distinct backend facts.
259
- Card authority expiry does not terminate an admitted request or lookup. Preserve
260
- its current observation even when no commands remain allowed. For an unknown
261
- result whose result-reading authority ended, the user can ask for a new management
262
- card for that same attempt; never recreate or resubmit the transaction. A separate
263
- current read failure still needs its own recovery alongside an earlier attempt.
264
-
265
- When failed review material becomes invalid, the backend preserves the original
266
- failure and stage history with `evidenceValidity: "invalidated"` and removes its
267
- material-derived facts. Those stages describe the last computation, not current
268
- evidence. This failure does not become an automatic renewal opportunity.
269
-
270
- An unadmitted ready Review also uses the backend's `nextStateReadAfterMs` hint
271
- to confirm state at its verified material expiry. Use the earlier positive
272
- interval from that hint and the card authority deadline. Lock business input
273
- until the read resolves; a failed read requires explicit recovery. Countdown
274
- 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.
275
-
276
- Card state, action choices and timing hints come from the same backend
277
- evaluation. A read conflict caused by changed review evidence preserves the
278
- last display and requires explicit state-read recovery, with inputs and timers
279
- disabled. Prefer the safe error message when supplied; a reason code is not
280
- display copy. Do not recreate a business request or continuously retry a conflict.
281
-
282
- Only actions permitted by the current backend state are rendered. During an
283
- in-flight action, disable other business actions while preserving display
284
- controls. Preparation/transport failures and display failures have distinct
285
- messages and recovery. Amounts, slippage, target asset and venue are changed
286
- through a new reviewed proposal, not ad hoc frontend edits.
287
-
288
- Connect and Review show `walletAvailability` separately from stored business
289
- facts. Wallet unavailability preserves the displayed review and results, removes
290
- wallet-dependent actions, and does not become a rendering error. A connection
291
- that cannot be checked is labelled as the last recorded status with its update
292
- time. Pairing display data must be removed when the backend no longer supplies
293
- it, even if the card revision is unchanged.
294
-
295
- The backend derives `observe` from `progress.status === "waiting"`. Unavailable
296
- progress stops automatic polling and offers an explicit same-card state read;
297
- that read cannot reconnect, sign or resubmit. Existing DB expiry wake-ups remain
298
- independent of progress polling. Availability and allowed actions participate in
299
- display identity; remaining-time hints do not reset input selection.
300
-
301
- Wallet-service startup is separate from connection and transaction states.
302
- Show normal initialization neutrally. Connect owns connection, approved-address
303
- selection and exact-target disconnection; it has no Wallet service help section
304
- or service-restart control. Normal disconnected manage shows Connect wallet;
305
- opening manage never starts pairing. In `connectionConflict`, show each target
306
- and its Disconnect control in the main content, including enough identity to
307
- distinguish equal names or addresses. Hide account-use and review/signing
308
- controls until the backend reports a unique usable connection.
309
-
310
- The local confirmation stage describes presentation, not authority. Inform the
311
- common lifecycle when opening or leaving a disconnect confirmation so it applies
312
- current guidance and input locks to the new controls. Back cannot cancel a sent
313
- command, unlock another action, discard its error or resend it. Preserve the
314
- same View and opened Details during unchanged state reads; disposed callbacks
315
- cannot alter its replacement. Normal display changes do not postpone required
316
- backend state reads.
317
-
318
- Connection-service recovery belongs to Settings/Troubleshooting and requires
319
- explicit user preparation/confirmation of the affected SDK run and requests.
320
- Connect/Review explain that path when recovery is relevant; they do not host
321
- service-restart controls. Normal QR approval or initialization is not a failure
322
- diagnosis. An uncertain command first offers its same-request status check.
323
- If the parent/Settings is unavailable or a parent endpoint/installation change
324
- must apply, explain full exit/reopen of all participating apps. Child restart
325
- never implies remote disconnection, connection approval or chain outcome.
326
-
327
- Settings separates ordinary Read address, Local records and Troubleshooting
328
- from Advanced endpoint controls. Show operation impact and errors in the body;
329
- technical values use the existing Details disclosure. Each card owns one
330
- operation and its stored result. Preview, Back, chat navigation and state reads
331
- do not apply settings, create another file or restart the SDK. A valid sealed
332
- upload remains available for a new Preview after preparation invalidation;
333
- explicit file change uses the backend selection action. Validation rejection
334
- retains the actual current card and a usable correction/selection path.
335
-
336
- Local records offers Download backup as one explicit action. Snapshot creation
337
- and verification are internal progress, without a separate creation or
338
- confirmation page. New downloads use one private temporary snapshot. A supported
339
- download does not publish a permanent server backup. Other Settings choices do not appear on
340
- its progress or result page. File delivery uses the standard Host-mediated
341
- request, without hiding the action according to a Host name or download
342
- advertisement. Missing card authority still prevents actions.
343
-
344
- If that actual `ui/download-file` request returns method-not-found (-32601),
345
- the same snapshot is saved once in the Sui MCP backup folder. The initial choice
346
- explains this conditional destination. A verified local result shows Backup
347
- saved with a readable, selectable Folder and File name. It offers no second
348
- download action. Missing advertisement, cancellation, denial, invalid parameters,
349
- timeouts and errors from other methods do not select this path. Application
350
- names do not select either path.
351
-
352
- An earlier possibly handled attempt requires Save a local copy before local
353
- saving, with a warning that another copy may exist. A local save in progress
354
- offers status observation, not another save, Host retry or cancellation. A
355
- confirmed failure with no publication can offer Retry save within the original
356
- period; an uncertain result offers only Check status. State, authority, expiry,
357
- navigation and controls use the same current projection. Recorded saving and
358
- temporary cleanup remain separate facts, including when cleanup fails.
359
-
360
- Results distinguish snapshot preparation, Host-reported delivery, temporary
361
- cleanup and actual user file storage. Suggested file name is not a confirmed
362
- save location. Host acknowledgment ends server retention but is not proof of a
363
- saved file; isError does not classify cancellation, denial or failure. Lost
364
- responses are unconfirmed. An explicit retry uses the same verified snapshot
365
- within its fixed transfer period and warns when a prior request may already
366
- have been handled. Frame recreation and state reads never download again.
367
- Cancel download ends further transfer and cleans the temporary snapshot; it
368
- cannot close a Host dialog or delete a saved user file. A new frame needs an
369
- explicit retry, and a server restart ends the old transfer. An already-admitted
370
- local save may be settled by verifying its existing artifact after restart;
371
- recovery never creates a missing backup or restores old input permission.
372
-
373
- The backend owns a thirty-minute transfer period starting when the snapshot is
374
- physically ready, separately from the original card-input deadline. Reads and
375
- retries do not extend it. The View consumes relative remaining time without
376
- extending a confirmed deadline. Permission, operation, file, attempt and current
377
- state are checked before delivery. The elapsed time of the authenticated
378
- pre-delivery read, including a coalesced read, reduces the remaining period; a
379
- delayed reply cannot grant a fresh transfer period. A corrupt or unavailable snapshot sends no
380
- bytes to the Host. A local save admitted before the deadline finishes its file work and result
381
- settlement; the verified final backup is not subject to the private-file TTL.
382
- Existing saved backup results retain their recorded facts;
383
- their public files are not removed by temporary cleanup.
384
-
385
- Incomplete cleanup offers Check status for the same operation. Cleanup includes
386
- settlement of that operation's ended I/O reservation and waits for its actual
387
- file reads/writes to end. A stored result remains readable while settlement is
388
- retried; it does not release another operation's running I/O. Reading a recorded
389
- Host report resolves a lost reply without sending the file again.
390
-
391
- Local-data counts describe the backend state at the time they are read. A later
392
- replacement warning must not use a stale count, especially zero, as an assurance
393
- that no unconfirmed transaction records will be deleted. Warn that replacement
394
- can remove those records and cannot cancel a transaction on Sui.
395
- The private connection-service journal remains; Reset does not claim that the
396
- SDK is empty or grant a new pairing. Connect controls use backend
397
- `manageableConnectionIds`, separately from `usableConnectionId`. Unrecorded SDK
398
- presence uses conditional Settings recovery guidance after registration ends,
399
- without a synthetic target or global recovery controls in Connect.
400
-
401
- Endpoint confirmations name Sui node (gRPC) or Activity data (GraphQL), show the
402
- stored value before the change and the exact value to store. Their result labels
403
- the effective value and source at save time. Explain an active environment
404
- override in the body: restart alone will not apply the stored value while that
405
- override remains. Do not substitute a current configuration read for the saved
406
- result or copy default URLs into the View.
407
-
408
- ## Internal Read Cards
409
-
410
- 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.
411
-
412
- 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.
413
-
414
- 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.
415
-
416
- 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.
417
-
418
- 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.
419
-
420
- 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.
421
-
422
- 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.
423
-
424
- All six cards, including Review management, adapt to the embedded frame width.
425
- Forms wrap, narrow fact rows stack their label above the value, and long addresses,
426
- amounts, names and records remain readable without widening the document. QR,
427
- chart and PTB drawing areas stay within the card; resizing changes presentation
428
- without repeating a business query or changing stored state. Responsive rules
429
- for shared atoms remain in the shared stylesheet.
430
-
431
- ## Language
432
-
433
- Use short, direct, non-promotional copy. Stable cards do not repeat generic
434
- "Saved result" or "Stored request state" labels above their actual facts.
435
- Lifecycle messages describe opening, unavailable current state and recovery;
436
- renderers describe business facts. Show times in UTC with exact values available.
437
- Unknown token decimals mean the display amount is unavailable; do not present
438
- raw integers as user token quantities.
439
-
440
- Do not say:
441
-
442
- - safe
443
- - recommended
444
- - best
445
- - guaranteed
446
- - approved by AI
447
-
448
- Prefer:
449
-
450
- - ready for your review
451
- - review needs updating
452
- - review blocked
453
- - expected to receive
454
- - minimum received on success
455
- - data retrieved
456
-
457
- Source fields keep their defined names and meanings. Use Data retrieved for
458
- `fetchedAt`; it is not the transaction's execution time. Use Estimates checked at
459
- and Estimates expire for review evidence, Connection expires for wallet-session
460
- expiry, and Request updated for request state changes. The overall Review expires
461
- in timer remains distinct from the shorter estimate validity period.
462
-
463
- Across cards, use these distinctions rather than treating similar words as
464
- interchangeable:
465
-
466
- | Card wording | Technical source | Meaning |
467
- | --- | --- | --- |
468
- | Sui mainnet | Verified network/chain facts; proposal `network` is a declaration | Product network; Declared network in an external proposal remains untrusted input |
469
- | 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 |
470
- | 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 |
471
- | Transaction succeeded/failed on Sui | Verified `execution.status` / receipt `effectsStatus` | Independently observed chain outcome, not a completed tool call or wallet response |
472
- | 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 |
473
- | Retry connection / Request wallet approval | `connect` / `request_signature` | Explicit connection retry versus a permitted request for wallet approval; actual wallet approval is still required |
474
- | Continue review | `prepare_review` after the View's local pause and a fresh target check | Explicitly continue review updates; it does not authorize signing |
475
- | 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 |
476
- | Cancel review / Back | `cancel` / local confirmation-view navigation | End unsubmitted review input versus leave a confirmation screen without a backend action |
477
- | Estimated network fee / Network fee | Review `netGasMist` / receipt `gas.totalMist` | Simulated versus independently observed net gas after the storage rebate |
478
- | Network fee limit (gas budget) | `transactionReviewData.gas.gasBudgetRaw` / receipt `gas.budgetMist` | Transaction network-fee spending limit, distinct from an estimated or observed charge |
479
- | 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 |
480
- | External proposal — view only | `ProposalReviewModel.nonSignableReason` and unsupported capabilities | Declared proposal information with no wallet approval or execution |
481
- | Transaction being reviewed / Executed transaction | Review PTB / receipt PTB | Candidate material versus the observed transaction; neither graph is a safety verdict or authorization |
482
-
483
- These are display-to-contract mappings, not wire-name aliases. Keep SDK method
484
- names, action/status enum values and persisted field names unchanged. The API
485
- reference owns response meanings and the local database architecture document
486
- owns storage meanings. `CardStore.readSaved` reads the persisted card projection
487
- with existing evaluation; its name does not promise a raw row read or permission
488
- recovery. Receipt code names refer to chain receipts even when the screen title
489
- is Transaction result.
490
-
491
- Advanced details retain exact gas, object, Move, event, raw-unit and protocol
492
- terms. Display labels must not rename public state enums, hide original failure
493
- causes or change their recovery actions.
494
-
495
- Ready for your review means that review details are available to inspect. It
496
- does not promise that wallet approval can currently be requested; read-only
497
- cards can show the same details without any action permission. Review needs
498
- updating describes out-of-date details, not a failed transaction. Updating review
499
- means preparing new review details; Checking status reads the existing card.
500
- Continue review changes this View's paused-update intent, so it is not renamed
501
- as a routine retry. Network fee amounts are after the storage rebate and may be
502
- negative; Network fee limit (gas budget) is a spending limit, not a fee estimate.
503
-
504
- Message producers describe confirmed facts without prescribing a View action.
505
- The View owns current guidance and names only controls that are available there,
506
- or a specific request the user can make in chat. A public or expired card must
507
- not tell its reader to click an unavailable update or approval action. Uncertain
508
- approval delivery and existing transaction results refer to the same request,
509
- never to sending another transaction. Past messages are quoted as messages from
510
- the earlier action, with its original phase and reason preserved. They are not
511
- current instructions or proof that cancellation or disconnection succeeded.
512
- External error text and known diagnostic codes retain their source meaning;
513
- unknown messages must not be translated into an invented cause. Display plain
514
- explanations of known Chart reason codes, with the original code in Details.
515
-
516
- Renderers describe their actual selection UI and domain next step; the common
517
- frame combines those facts with its current confirmation and recovery decision.
518
- The presence of a workflow button is not a proxy for an editable Chart form.
519
- An unadmitted Chart selection remains usable after a delivery failure, whereas
520
- an admitted query's result or source failure requires a new card for a new query.
521
- A confirmed expired review session needs a new-review instruction even when its
522
- later-created card record is still ready. Local timer expiry alone is not that
523
- confirmation. Connection instructions distinguish recorded connections, pending
524
- work and unavailable wallet state; an empty recorded list during unavailability
525
- does not establish that connecting is currently possible. Show each current
526
- next step once, separately from the quoted earlier-attempt message.
527
-
528
- Frontend labels stay in English. Localization must preserve protocol names, token symbols, object IDs, package IDs, and reason enums without translation.
529
-
530
- ## Shared UI And Design Principles
531
-
532
- The card views share one design-token set and one set of atomic UI
533
- components: vanilla TypeScript DOM helpers in `review-app/src/ui` plus the shared
534
- stylesheet `review-app/public/ui.css`, bundled into each self-contained card HTML. There is
535
- no React, Vue, Svelte, or client router. Views compose the shared atoms and keep
536
- only their own layout, container, third-party-sizing, and composition CSS. The
537
- shared atoms are addressed by `ui-` prefixed classes that only the shared
538
- stylesheet declares; a page stylesheet declares no `ui-` class rule and no bare
539
- button, input, select, or textarea rule.
540
-
541
- The shared UI follows these durable principles:
542
-
543
- 1. Always-actionable controls: every actionable control shows hover, active, and
544
- keyboard-focus feedback. Controls are inert only during the deliberate,
545
- clearly-signaled async lock. Status and errors are conveyed as text, not color
546
- alone.
547
- 2. One consistent system: cards share one lifecycle, one component set, and the
548
- same element positions. Cards have no cross-page navigation.
549
- 3. Cards show the current step and next permitted action without permanently
550
- listing every earlier step. A completed transaction leads with its observed
551
- result; stored request state is not a second outcome. Settings preview and
552
- confirmation requirements are unchanged.
553
- 4. Primary result regions keep their position across data availability and show
554
- an explicit empty or unavailable state. Technical sections intentionally omitted
555
- from a summary do not require placeholder regions; the Account summary reports
556
- omitted-object counts only when there are such objects or an enumeration limit.
557
- 5. Time-based progress and quantitative completeness use different components: a
558
- progress bar only when a real value advances it, an indeterminate overlay for
559
- an unknown-duration wait, and a count plus checklist for an already-known
560
- "N of M".
561
- 6. An action's result or error is tied to that action, stays visible, and carries
562
- enough detail to diagnose afterward.
563
- 7. Restraint: each page shows only the information it needs, with generous spacing.
564
- 8. Information depth by importance: each page ranks its information and renders the
565
- 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 uses the same plain sections/rows and one Details disclosure.
566
-
567
- All cards follow Host light/dark theme through the document's `data-theme`
568
- attribute and shared CSS tokens. They do not persist a separate theme choice.
569
- Use inline SVG icons or bundled assets, never an icon font/CDN or retired
570
- `/review-assets/` route.
571
-
572
- ## Navigation
573
-
574
- 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 have no cross-page navigation or linked brand exit.
575
-
576
- ## Security
577
-
578
- 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.
579
-
580
- Cards bundle script/style locally with the declared Host CSP and no external execution chunks. There is no external page/asset or HTTP mutation fallback. Shared private HTTP transport retains Host/Origin and transport authentication checks. App-only tools require scoped UI permission, target and revision checks.
581
-
582
- Wallet and review screens must be keyboard reachable and screen-reader labeled. Status and error changes must be exposed as text, not color alone.
583
-
584
- 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.
585
-
586
- 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.
587
-
588
- ## Out Of Scope
589
-
590
- The frontend must not add:
591
-
592
- - additional live trading/chart dashboards beyond the read-only Chart card
593
- - portfolio dashboards
594
- - AI chat
595
- - trading recommendations
596
- - alerts
597
- - automatic transaction history dashboard pages
598
- - multi-wallet comparison
599
- - saved plans or bookmarks
600
- - arbitrary strategy controls
601
-
602
- The exclusions above target automatic, background-indexed, or
603
- recommendation-style surfaces. User-requested local record views are allowed
604
- only inside their narrow surfaces: the Account card shows a wallet
605
- asset snapshot at a fetched timestamp for an address from public on-chain reads,
606
- and the Receipt card shows server-read on-chain receipt facts
607
- for one transaction digest. Summaries of locally stored review and activity records are available through the MCP read tools. These views
608
- must not add P&L, valuation, performance, tax claims, or route ranking. They
609
- must not add background indexing.
610
-
611
- 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.