@zktx.io/sui-mcp 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +83 -42
- package/dist/core/activity/localDataService.js +8 -21
- package/dist/core/activity/localDataValidation.js +22 -46
- package/dist/core/activity/sqliteAccountStore.js +46 -0
- package/dist/core/activity/sqliteActivityStore.js +65 -147
- package/dist/core/activity/sqliteActivityStoreSchema.js +42 -26
- package/dist/core/activity/transactionActivityService.js +2 -2
- package/dist/core/preferences/preferencesStore.js +2 -2
- package/dist/core/preferences/sqlitePreferencesRepository.js +10 -0
- package/dist/core/session/cardResult.js +41 -0
- package/dist/core/session/cardSession.js +1 -1
- package/dist/core/session/cardSessionStore.js +51 -19
- package/dist/core/session/chainAccounts.js +120 -0
- package/dist/core/session/sessionStore.js +4 -8
- package/dist/core/session/settingsFileStore.js +3 -30
- package/dist/core/session/settingsOperation.js +27 -19
- package/dist/core/session/settingsWorkflow.js +161 -87
- package/dist/core/session/sqliteCardStore.js +34 -14
- package/dist/core/session/sqliteSessionStore.js +5 -5
- package/dist/core/session/sqliteSettingsWorkflowStore.js +135 -41
- package/dist/core/session/sqliteTransactionRequest.js +18 -0
- package/dist/core/session/sqliteWalletConnectionOperation.js +13 -0
- package/dist/core/session/sqliteWalletWorkflowStore.js +569 -333
- package/dist/core/session/status.js +2 -2
- package/dist/core/session/wait.js +6 -11
- package/dist/core/session/walletConnection.js +71 -46
- package/dist/core/session/walletConnectionOperations.js +24 -0
- package/dist/core/session/walletRuntime.js +7 -13
- package/dist/core/session/walletWorkflow.js +248 -99
- package/dist/core/session/workflowState.js +104 -38
- package/dist/core/session/workflowView.js +92 -101
- package/dist/mcp/activeAccountResponse.js +3 -0
- package/dist/mcp/responseGuidance.js +7 -9
- package/dist/mcp/serverInfo.js +11 -10
- package/dist/mcp/toolErrors.js +5 -3
- package/dist/mcp/toolNames.js +1 -0
- package/dist/mcp/tools/action/prepareSuiActionReview.js +9 -16
- package/dist/mcp/tools/read/readToolHelpers.js +9 -7
- package/dist/mcp/tools/session/executionResultTools.js +2 -2
- package/dist/mcp/tools/session/shared.js +2 -2
- package/dist/mcp/tools/session/statusTools.js +12 -10
- package/dist/mcp/tools/session/walletConnectionTools.js +26 -14
- package/dist/mcp/tools/settings/index.js +7 -4
- package/dist/mcp-app/account.html +7 -7
- package/dist/mcp-app/chart.html +3 -3
- package/dist/mcp-app/connect.html +13 -13
- package/dist/mcp-app/disconnect.html +3637 -0
- package/dist/mcp-app/disconnect.notices.txt +1480 -0
- package/dist/mcp-app/receipt.html +393 -393
- package/dist/mcp-app/review.html +459 -459
- package/dist/mcp-app/settings.html +7 -7
- package/dist/mcp-ui/contracts.js +3 -1
- package/dist/mcp-ui/tools.js +4 -4
- package/dist/runtime/application.js +1 -1
- package/dist/runtime/localSettingsService.js +7 -4
- package/dist/runtime/smokeMainnetRead.js +5 -4
- package/dist/runtime/walletConnectTransport.js +16 -16
- package/dist/runtime/walletSdkChildRuntime.js +29 -12
- package/dist/runtime/walletSdkIpc.js +5 -4
- package/dist/runtime/walletSdkProcess.js +24 -8
- package/docs/AGENT_BEHAVIOR.md +82 -54
- package/docs/LOCAL_DB_ARCHITECTURE.md +100 -70
- package/docs/MCP_SETUP.md +319 -339
- package/docs/MCP_TOOLS.md +292 -177
- package/docs/SDK_API.md +15 -6
- package/docs/TRANSACTION_ACTIVITY_LOG.md +4 -0
- package/docs/UTILITY_INDEX.md +9 -7
- package/docs/WALLET_CONNECTION.md +162 -167
- package/package.json +1 -1
package/docs/AGENT_BEHAVIOR.md
CHANGED
|
@@ -20,7 +20,7 @@ It is not the contributor rulebook and it is not enforcement. Development rules
|
|
|
20
20
|
| Transaction material and execution | Verified supported swaps under user control | Stored mainnet material is used only after review and wallet approval. External proposals stay non-signable. Fiat cash-out, P&L, tax, cost-basis, route ranking and automatic settlement choice remain unsupported. |
|
|
21
21
|
| Private-key custody, autonomous trading, fiat USD peg claims, and quote-only coverage or readiness claims | Unsupported safety and correctness boundary | Do not custody funds, hold private keys, or autonomously trade. Do not treat settlement assets as fiat USD, bank cash-out amounts, or peg guarantees. Do not turn quote-only conversion candidates into payment coverage, funding readiness, payment execution readiness, or signing readiness. |
|
|
22
22
|
| Silent settlement-token selection and route ranking | Out of scope by current design | Do not silently choose USDC, USDT, or another settlement token for the user. Do not rank venues, choose routes, or make best-price recommendations. |
|
|
23
|
-
| Other
|
|
23
|
+
| Other-chain financial actions, autonomous trading, alerts, arbitrary Move calls, investment advice | Unsupported | Ethereum and Solana address management does not add other-chain asset reads, signing or execution. Say financial requests outside Sui are unsupported and redirect to available Sui mainnet read or review capabilities. |
|
|
24
24
|
| Payment execution | Not a current capability | Intent evidence is separate from execution and does not build or execute payments. Do not describe payment execution as available. |
|
|
25
25
|
| Lending, staking, relative balance actions | Unsupported | Do not describe executable actions for these categories as available product functionality. |
|
|
26
26
|
|
|
@@ -299,28 +299,62 @@ For common USD-denominated evidence questions:
|
|
|
299
299
|
|
|
300
300
|
Describe an active wallet account as read context, not login, proof of
|
|
301
301
|
ownership, standing signature approval or custody. Explicit public-address
|
|
302
|
-
reads do not set that context. Account clearing does not disconnect a wallet.
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
302
|
+
reads do not set that context. Account clearing does not disconnect a wallet. Activity tools with an optional
|
|
303
|
+
`account` use saved read context when it exists. If it is absent or cleared, ask
|
|
304
|
+
for an explicit Sui address for that read; do not ask for a wallet connection
|
|
305
|
+
merely to restore a read filter.
|
|
306
|
+
|
|
307
|
+
- For current asset reads with no address supplied by the user, read `session_get_interaction_status` and use `assetReadAccount.account` only when its status is `available`. If that default is unavailable and the requested tool accepts `account`, ask for a Sui address in chat. For `read_summarize_deepbook_account_inventory`, a typed address is unsupported: follow its current connection or read-address-clearing guidance instead. Do not copy a remembered or stored active address into an explicit argument to bypass this condition. Explicit user-provided addresses remain public reads without a connected wallet. A stored active account is not proof of a current connection.
|
|
308
|
+
- One current connection supplies one fixed address per approved chain. Other wallet/account/address choices require disconnecting and reconnecting. Never propose Add connection or a default-account switch. A stored expired record is not proof of remote removal.
|
|
309
|
+
- Before opening a connection card, read `session_get_interaction_status.connection`, `requestedChains`, `canDisconnect` and `walletAvailability`. An already connected wallet needs no additional pairing. Missing/unavailable observation does not prove absence. Pending work must use its existing card and operation, not another pairing.
|
|
307
310
|
- Collect a missing account address or transaction hash in chat before opening an Account or Receipt card. Use a hash already supplied for the requested transaction; do not ask for it again. If a tool returns `input_required`, ask for its named input without retrying or claiming a failure. These cards have no input forms.
|
|
308
311
|
|
|
309
|
-
For a connected-account-only read,
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
312
|
+
For a connected-account-only read, distinguish unavailable service, pending work,
|
|
313
|
+
missing connection and explicit read-address clearing. Use the existing operation's
|
|
314
|
+
cardId for get/wait while it is pending. Otherwise follow the user's connection
|
|
315
|
+
request; do not initiate pairing automatically. Clearing read context is not a
|
|
316
|
+
wallet disconnection or an invitation to bypass the read guard with a remembered address.
|
|
317
|
+
|
|
318
|
+
1. `account_get_active_account` reports stored Sui read context, with its source
|
|
319
|
+
and time. Use `session_get_interaction_status.assetReadAccount` for current
|
|
320
|
+
asset eligibility. Tools with an `account` input accept a user-provided address;
|
|
321
|
+
connected-account-only tools do not. Stored context alone proves no connection.
|
|
322
|
+
2. For an explicit connect request, open `session_open_wallet_connection_card`
|
|
323
|
+
with empty input. For disconnection, open `session_open_wallet_disconnection_card`.
|
|
324
|
+
The latter fixes the current exact session and shows Confirm disconnect and
|
|
325
|
+
Cancel. Cancel ends that card without disconnecting. Neither card can switch
|
|
326
|
+
purposes or act on a replacement session; another operation requires a new
|
|
327
|
+
user prompt and purpose card. The model must not call app-only actions for the
|
|
328
|
+
user. Disconnection does not revoke onchain permissions. If the requested wallet
|
|
329
|
+
is already connected, report current interaction status without another pairing.
|
|
330
|
+
A no-session-to-disconnect refusal needs no repeated status check or new Review.
|
|
331
|
+
|
|
332
|
+
For "disconnect my wallet", open `session_open_wallet_disconnection_card` when the
|
|
333
|
+
session is manageable. Confirm disconnect removes that exact session; Cancel ends
|
|
334
|
+
only this card and leaves the session unchanged. The card starts no pairing.
|
|
335
|
+
Do not substitute Clear saved read address or claim revocation of onchain permissions.
|
|
336
|
+
If disconnection is already pending, read or wait on its exact card rather than
|
|
337
|
+
creating another operation. For a connect request, if the requested wallet is already connected,
|
|
338
|
+
report current interaction status without another pairing.
|
|
315
339
|
|
|
316
340
|
3. `session_get_wallet_connection_card` and `session_wait_wallet_connection_card` use the
|
|
317
|
-
returned cardId.
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
341
|
+
returned cardId. The response's fixed `card` is separate from its current exact
|
|
342
|
+
`operation`, service availability and evaluation time. Waiting does not create a
|
|
343
|
+
pairing or follow a later operation. Without an admitted operation, waiting ends immediately. Pairing
|
|
344
|
+
credentials and QR data never belong in chat text.
|
|
345
|
+
4. Settings selects networks for the next connection, default Sui. Only returned
|
|
346
|
+
requested networks are usable. A single distinct address binds automatically;
|
|
347
|
+
several addresses make that chain unavailable, with no chooser. Reconnect to
|
|
348
|
+
change the address or scope. Changing Settings does not modify current approval.
|
|
349
|
+
5. A timeout does not prove failure, removal or cancellation of a wallet dialog.
|
|
350
|
+
Read the saved outcome and pending cleanup separately. An approval or
|
|
351
|
+
disconnection recorded as completed remains completed while cleanup is pending;
|
|
352
|
+
do not describe that result as stopped. SDK exit and late
|
|
353
|
+
response processing must not be called user cancellation.
|
|
354
|
+
6. Explicit Cancel or Stop permanently ends that card's input. Cleanup cannot
|
|
355
|
+
restore it. Open a new card only for a new user request. Settings Clear saved
|
|
356
|
+
read address suppresses implicit read context across restart of the same
|
|
357
|
+
connection; it does not cancel a request, change fixed addresses or disconnect.
|
|
324
358
|
|
|
325
359
|
Use `session_get_interaction_status` for bounded pending interactions. A Review
|
|
326
360
|
status of `ready_for_wallet_review` is displayed as Ready for your review: the
|
|
@@ -331,7 +365,7 @@ success/failure. stopped, request_failed and outcome_unknown never imply chain
|
|
|
331
365
|
failure or absence of execution. Use `session_get_execution_result` to read the
|
|
332
366
|
known digest without resubmitting. `session_open_review_management` requires the
|
|
333
367
|
exact reviewSessionId and attemptId and grants no new signing/refresh action.
|
|
334
|
-
|
|
368
|
+
A new Review fixes the current Sui account and connection before preparation. Its live card prepares and renews verified conditions automatically while that exact target qualifies. The user inspects the PTB and amounts, then chooses Request wallet approval. Use the exact fixed target. Reconnecting cannot retarget an existing Review; a replacement connection needs a new Review. Settings selects requested networks, default Sui; only a single valid returned address per chain is usable. Do not repeat already-determined chain/address choices in a card. Failed preparation may need Retry review. Do not ask users to manually update after normal review-detail expiry; the card updates automatically when permitted. Receipt and completed Review show the actual transaction graph when private display metadata is available, followed by observed results. Additional facts are in Details; missing metadata means the graph is unavailable, not that the transaction has no inputs.
|
|
335
369
|
|
|
336
370
|
Frame recreation and chat navigation first reread the same DB state. Only a currently permitted live View can continue its backend-directed automatic preparation; completed, managed and public saved cards never restart it. SDK restoration does
|
|
337
371
|
not replay a financial request or restore cleared read context.
|
|
@@ -339,13 +373,10 @@ not replay a financial request or restore cleared read context.
|
|
|
339
373
|
Treat `walletAvailability` as the local connection service's state and
|
|
340
374
|
`walletObservation` as its last confirmed observation, not the wallet app's live
|
|
341
375
|
screen. `initializing` and `recovering` do not mean the user rejected anything.
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
them. `allowedActions` describes permitted action types, not all buttons visible
|
|
347
|
-
in a particular frame. In particular, a card without a target does not show
|
|
348
|
-
Disconnect or Use account merely because a general action name was mentioned.
|
|
376
|
+
One connection is current. Its fixed addresses, live grant and stored read context
|
|
377
|
+
are separate facts. An old Review stays bound to its original account/connection;
|
|
378
|
+
a replacement connection requires a new Review. `allowedActions` describes
|
|
379
|
+
permitted app action types, never model authority or a mandatory visible button list.
|
|
349
380
|
|
|
350
381
|
Connection-service recovery belongs to Settings. When the service is unavailable
|
|
351
382
|
or a connection operation remains unresponsive, open
|
|
@@ -356,12 +387,12 @@ A new Settings card can explicitly supersede a startup still pending. Read the
|
|
|
356
387
|
same operation's result; neither a new available run nor restart completion
|
|
357
388
|
confirms an interrupted disconnect or a transaction result. Do not repeatedly
|
|
358
389
|
request wallet approval or report recovery before its new run is observed.
|
|
359
|
-
`
|
|
360
|
-
|
|
361
|
-
present; do not describe the old failed operation as successful. If
|
|
390
|
+
`canDisconnect` qualifies the current exact cleanup target, not financial usage.
|
|
391
|
+
A terminal or older-data-generation record can remain disconnectable when its SDK
|
|
392
|
+
session is still present or unusable; do not describe the old failed operation as successful. If
|
|
362
393
|
`connectionReconciliationRequired` is true, explain that the service contains an
|
|
363
|
-
unrecorded connection.
|
|
364
|
-
wallet app, then check its status. Settings/Troubleshooting can restart the
|
|
394
|
+
unrecorded connection. New pairing and financial input are blocked. Ask the user
|
|
395
|
+
to remove that retained connection in the wallet app, then check its status. Settings/Troubleshooting can restart the
|
|
365
396
|
service to inspect it again; restarting does not approve an unrecorded session.
|
|
366
397
|
Do not infer a free pairing slot from a failed or expired record.
|
|
367
398
|
|
|
@@ -370,7 +401,7 @@ procedure in the setup guide. All participating MCP connections must stop and th
|
|
|
370
401
|
closing a peer or window can leave the owner alive. Follow the same parent
|
|
371
402
|
stop/reopen procedure for stored endpoint or installation changes. Do not kill another app's processes.
|
|
372
403
|
|
|
373
|
-
A failed `
|
|
404
|
+
A failed operation with `operation.action: "disconnect"` means removal was not confirmed.
|
|
374
405
|
Direct the user to inspect/remove the retained connection in their wallet app.
|
|
375
406
|
App restart does not prove remote revocation or cancel a transaction on Sui.
|
|
376
407
|
Already submitted transactions keep their digest and remain readable; a new
|
|
@@ -484,26 +515,23 @@ For `read_list_review_activity`, `dataScope.recordCount` is the full matching lo
|
|
|
484
515
|
|
|
485
516
|
For `read_get_review_session_detail`, transition rows with `isNoOp: true` are repeated lifecycle observations where the stored status did not change. Mention them only as audit details; do not count them as extra funnel progress.
|
|
486
517
|
|
|
487
|
-
For local settings, local records or connection-service recovery, call `settings_create_local_settings_session` to open the internal Settings card. No external URL is returned. Explain Address for viewing assets, Local records, Troubleshooting or Advanced settings as needed and leave selection/confirmation to the user.
|
|
488
|
-
|
|
489
|
-
For a backup, use
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
another file effect. Report saved-file and cleanup facts separately.
|
|
505
|
-
|
|
506
|
-
Ordinary MCP tools never apply a Settings change. Do not call `ui_act_card` or `ui_read_settings_file` as model work. Never request/paste raw backup bytes or card permissions in chat. Clear default address only changes read context, not wallet connections or admitted transactions. Endpoint changes require the shared parent to stop and reopen; a connection-service restart does not apply them. Report operation result, temporary-file cleanup and Host download acknowledgment as separate facts. A saved result is not proof that the Host saved a downloaded file. For restore validation refusal, let the user correct input or choose another file and prepare a new confirmation; reading or returning to a frame never applies it.
|
|
518
|
+
For local settings, local records or connection-service recovery, call `settings_create_local_settings_session` to open the internal Settings card. No external URL is returned. Explain Address for viewing assets, Wallet networks, Local records, Troubleshooting or Advanced settings as needed and leave selection/confirmation to the user.
|
|
519
|
+
|
|
520
|
+
For a backup, use Download backup in Settings → Local records. Do not request a
|
|
521
|
+
separate Create backup step. Report only the returned saved-file and delivery
|
|
522
|
+
facts: Host acknowledgment does not prove a saved file or its destination.
|
|
523
|
+
A completed delivery card cannot retry. For a requested retry of a retained
|
|
524
|
+
backup, open `settings_create_local_settings_session` with `backupDelivery` and
|
|
525
|
+
the exact recorded operation/file identifiers; the user chooses one delivery or
|
|
526
|
+
local-save attempt there. To check current delivery or cleanup, open the same
|
|
527
|
+
tool with `operationStatus`. Do not ask the user to press a control in an ended
|
|
528
|
+
card. Expired or invalidated backups require a new backup request. These three
|
|
529
|
+
card purposes and file outcomes are defined in [Settings Tools](MCP_TOOLS.md#settings-tools).
|
|
530
|
+
Use the same function-based instructions across apps. Neither missing capability
|
|
531
|
+
advertisement nor timeout, denial or uncertain delivery means method-not-found.
|
|
532
|
+
A local copy after a possibly handled delivery requires explicit user consent.
|
|
533
|
+
|
|
534
|
+
Ordinary MCP tools never apply a Settings change. Do not call `ui_act_card` or `ui_read_settings_file` as model work. Never request/paste raw backup bytes or card permissions in chat. Clear saved read address belongs to Settings. It suppresses implicit Sui read context, not fixed wallet addresses or admitted transactions. Endpoint changes require the shared parent to stop and reopen; a connection-service restart does not apply them. Report operation result, temporary-file cleanup and Host download acknowledgment as separate facts. A saved result is not proof that the Host saved a downloaded file. For restore validation refusal, let the user correct input or choose another file and prepare a new confirmation; reading or returning to a frame never applies it.
|
|
507
535
|
|
|
508
536
|
## User Vocabulary
|
|
509
537
|
|
|
@@ -531,7 +559,7 @@ Do not silently turn vague words into amounts.
|
|
|
531
559
|
| "Do you think I should buy this?" | Do not give investment advice. Offer price, liquidity, quote, and risk-input facts when supported. |
|
|
532
560
|
| "Tell me when the price drops." | Say alerts are unsupported. Offer a one-time price or quote check. |
|
|
533
561
|
| "Let's buy Bitcoin too." | Say this toolkit only exposes Sui mainnet surfaces. |
|
|
534
|
-
| "Am I connected? / Am I logged in?" | Read `session_get_interaction_status.
|
|
562
|
+
| "Am I connected? / Am I logged in?" | Read `session_get_interaction_status.connection` with `walletAvailability`. When unavailable, report that connection state cannot be confirmed. The stored active account is not proof of a connection or login. Do not say the user is connected to DeepBook or signed in. |
|
|
535
563
|
| "Show my balances over time." | Held-balance history and P&L are not tool surfaces. Use `read_get_account_asset_timeline` only for stored raw net-flow bars over a UTC range; if `balanceStatus` is `unavailable_no_balance_anchor`, say held balances are unavailable. `read_summarize_wallet_assets` returns a current snapshot at `fetchedAt`. |
|
|
536
564
|
| "How much profit did I make?" | Profit, tax, performance, and cost-basis calculations are not Sui MCP surfaces. Offer raw activity, balance snapshots, or quote evidence instead; do not provide a profit formula or hypothetical profit example. |
|
|
537
565
|
| "Can you calculate my profit if I bought 10 SUI for 10 USDC?" | An assumed acquisition price does not change the boundary. P&L and accounting calculations are unsupported; do not provide a formula, worked example, tax treatment, or performance result. |
|
|
@@ -33,7 +33,7 @@ User-requested bounded transaction scans can store normalized facts only when a
|
|
|
33
33
|
|
|
34
34
|
The default Sui mainnet gRPC and GraphQL endpoints are stored in the local SQLite settings table on first run.
|
|
35
35
|
|
|
36
|
-
To inspect settings or change local data, ask for the internal Settings card. Ordinary MCP creates an unsubmitted card or reads settings; scoped app-only
|
|
36
|
+
To inspect settings or change local data, ask for the internal Settings card. Ordinary MCP creates an unsubmitted card or reads settings; scoped app-only user input applies changes. Endpoint changes, data replacement and service restart require their concrete impact confirmation. No external page or Settings HTTP API exists.
|
|
37
37
|
|
|
38
38
|
Endpoint changes apply after the MCP server restarts.
|
|
39
39
|
|
|
@@ -84,8 +84,7 @@ WAL mode can create companion files next to the main database, such as `sui-mcp.
|
|
|
84
84
|
|
|
85
85
|
## Tables
|
|
86
86
|
|
|
87
|
-
- `accounts`: normalized
|
|
88
|
-
- `active_account_context`: a single-row read context. It can point to one active account or be cleared.
|
|
87
|
+
- `accounts`: normalized `(chain_id, address)` identities and first/last use timestamps for supported mainnets.
|
|
89
88
|
- `review_sessions`: review session header, current status, full action plan JSON, and materialized requested intent JSON when present.
|
|
90
89
|
- `review_state_snapshots`: append-only account-bound `ReviewState` snapshots with status and reason columns for queryability.
|
|
91
90
|
- `review_status_transitions`: append-only review lifecycle timing for funnel and review-timing analysis.
|
|
@@ -93,20 +92,21 @@ WAL mode can create companion files next to the main database, such as `sui-mcp.
|
|
|
93
92
|
- `review_executions`: verified chain success/failure, keyed by `attempt_id` and bound to review session, account, plan and digest. Wallet rejection and uncertainty never create a chain failure row.
|
|
94
93
|
- `external_activity_scans`: user-requested digest lookups, bounded account scans, or sent-function scans, including request window, endpoint host, chain identifier, continuation metadata, coverage signals, and internal scan-kind provenance.
|
|
95
94
|
- `external_activity_transactions`: normalized Sui transaction facts linked to a known local account and the first/last scan that observed them. The optional detail JSON stores typed facts such as capped Move call targets, raw balance changes, object changes, event summaries, gas raw cost fields, execution errors, and truncation flags when GraphQL returns them. Each stored detail JSON value is capped at 64 KiB.
|
|
96
|
-
- `local_settings`: allowlisted local settings. The
|
|
95
|
+
- `local_settings`: allowlisted local settings. The keys are `suiGrpcUrl`, `suiGraphqlUrl` and `walletConnectionChains`, stored as JSON. Endpoints apply after restart; requested networks apply only to new connections.
|
|
97
96
|
- `coin_metadata_cache`: account-independent positive cache for Sui coin metadata used only to format wallet balance display amounts. Rows are keyed by normalized coin type and verified mainnet chain identifier, expire after 24 hours, and are excluded from local data export/import. Read or write failures for this cache block affected wallet unit reads with `metadata_cache_unavailable`; they are not reported as unavailable token decimals.
|
|
98
97
|
|
|
99
98
|
The following live session tables hold runtime session state in the shared database so the shared backend can serve cards and sessions created by participating clients (see [Shared local server](#shared-local-server)):
|
|
100
99
|
|
|
101
100
|
- `live_review_sessions`: the live review session record — status, bound
|
|
102
|
-
account, preparation/
|
|
101
|
+
account, preparation/Sui grant revision, current attempt reference,
|
|
103
102
|
plan/review-state JSON, timestamps, revision and write-contract marker —
|
|
104
103
|
keyed by session id.
|
|
105
104
|
- `live_private_review_artifacts`: per-session private review evidence (the transaction-material handle, its digest commitment, and derived evidence), cascade-deleted with its review session.
|
|
106
105
|
- `live_transaction_materials`: locally built unsigned transaction bytes stored as a BLOB behind a redacted handle, with a TTL; retained for the admitted request. Terminal request cleanup removes only material still owned by that revision, preserving newer preparation. Owner replacement deletes old private material while retaining immutable review and chain-result evidence.
|
|
107
|
-
- `live_wallet_connections`:
|
|
106
|
+
- `live_wallet_connections`: connection history and at most one current row, enforced by nullable `current_slot` (NULL or 1) and UNIQUE. The row owns its admission `data_epoch`, private topic, immutable requested scope/`chainResults`, current grants, per-chain grant revisions and `read_address_cleared`. Fixed addresses use chain/address identity, not replaceable public account IDs.
|
|
107
|
+
- `wallet_connection_operations`: at most one Connect/Disconnect operation per card (unique card_id), exact input, owner/run/data epoch, deadline, immutable result and pending SDK settlement. Operation identity is distinct from connection identity.
|
|
108
108
|
- `live_read_cards`: public card state with private permission hash, scope, operation and CAS revision.
|
|
109
|
-
- `settings_operations`: one draft/upload/preparation/admission/result identity per Settings card, with owner/data epoch, user-data revision, fingerprint and SDK supersession
|
|
109
|
+
- `settings_operations`: one draft/upload/preparation/admission/result identity per ordinary Settings card; read-only status and new backup-delivery cards reference that operation rather than duplicating it, with owner/data epoch, user-data revision, fingerprint and SDK supersession facts. Wallet network saving binds the selected and previously displayed networks, applies the setting and records its result atomically. A download stores its typed snapshot lifetime and per-attempt delivery reports in private `preparation_json`, separately from the immutable result. Updating delivery never reserializes a terminal `result_json`.
|
|
110
110
|
- `settings_files`: private file identity, original operation, upload/export role, generated paths, lengths/hash, chunk reservation and seal/invalidation/cleanup state. `cleanup_operation_id` separately names the operation responsible for cleanup; replacement can transfer that responsibility without changing the file identity, public path or input eligibility.
|
|
111
111
|
- `settings_control`: current data epoch/user-data revision, one final-operation slot, one file-I/O reservation and the SDK input block owner. These are semantic state/authority facts, not release-version counters.
|
|
112
112
|
|
|
@@ -116,7 +116,7 @@ Database columns use snake_case. MCP and HTTP JSON fields use camelCase, so the
|
|
|
116
116
|
|
|
117
117
|
Table relationships:
|
|
118
118
|
|
|
119
|
-
- `
|
|
119
|
+
- `accounts` has an id primary key and unique `(chain_id,address)`. Sui financial history references Sui account rows; another chain cannot become a Sui history or signer target. There is no mutable per-chain default selector.
|
|
120
120
|
- `review_state_snapshots`, `review_status_transitions`, and `review_executions` point to `review_sessions.id` through `review_session_id` and can also point to `accounts.id` through `account_id`.
|
|
121
121
|
- `external_activity_scans.account_id` points to `accounts.id`. It records which known local account the user-requested lookup or scan was scoped to.
|
|
122
122
|
- `external_activity_transactions.account_id` points to `accounts.id`, and `first_scan_id` / `last_scan_id` point to `external_activity_scans.scan_id`. `known_sender_account_id` points to `accounts.id` only when the sender is also a known local account. Non-known party account addresses are not stored; normalized detail JSON keeps account-owner and event-sender fields only when they match the known local account.
|
|
@@ -144,24 +144,34 @@ never recreates that result from a callback after deleting it. Rollback
|
|
|
144
144
|
preserves the prior data, permissions and admission state.
|
|
145
145
|
The private `live_wallet_connections` service journal remains because replacing
|
|
146
146
|
user data does not end SDK sessions. It cannot restore old card permissions or
|
|
147
|
-
transaction authority and is not imported from a backup. Reset
|
|
148
|
-
|
|
149
|
-
|
|
147
|
+
transaction authority and is not imported from a backup. Reset/import advance the data generation and restore no active wallet context.
|
|
148
|
+
The retained connection is available for cleanup only; a new explicit connection
|
|
149
|
+
is required for new financial input. Outstanding connection SDK callbacks also block replacement.
|
|
150
150
|
|
|
151
151
|
User-data and wallet/request writers invalidate affected preparations and
|
|
152
|
-
increment their card revision in the same transaction. The trigger and `settings_back`
|
|
152
|
+
increment their active card revision in the same transaction; they never update a closed card. The trigger and `settings_back`
|
|
153
153
|
reuse one SQL transition: a complete, sealed, non-invalidated upload belonging
|
|
154
154
|
to that operation returns to sealed; other preparations return to draft. Old
|
|
155
155
|
confirmations cannot apply. Backup checking and final I/O still verify physical content;
|
|
156
156
|
a manifest alone is not proof of a valid file.
|
|
157
157
|
|
|
158
|
+
Settings operation writes atomically invalidate an upload when its input is
|
|
159
|
+
replaced, its draft changes away from import, or its use ends. The file keeps its
|
|
160
|
+
identity and cleanup owner until physical cleanup succeeds. Back that preserves
|
|
161
|
+
an eligible selected upload does not invalidate it. Filesystem cleanup runs after
|
|
162
|
+
the stored effect/result; cleanup failure cannot repeat that effect or replace
|
|
163
|
+
its immutable result.
|
|
164
|
+
|
|
158
165
|
A `download_backup` admission consumes one card input and captures one local-data
|
|
159
166
|
snapshot in the same SQLite transaction. The export role and exact generated
|
|
160
167
|
`.settings-staging/<fileId>.download` namespace identify its private file; an
|
|
161
168
|
export role or display name alone is insufficient. File bytes are not stored
|
|
162
169
|
in operation JSON or nested in exported local data. Physical write, fsync, length and SHA checks
|
|
163
|
-
finish before the snapshot becomes available
|
|
164
|
-
|
|
170
|
+
finish before the snapshot becomes available; readiness does not end its card.
|
|
171
|
+
Delivery attempts bind their owning card IDs in the existing journal. The card
|
|
172
|
+
closes with its Host report, verified local publication, expiry, failure or Cancel.
|
|
173
|
+
A new explicit delivery uses a new card, the exact same file and original TTL.
|
|
174
|
+
Late reports update the domain journal without altering an ended card.
|
|
165
175
|
|
|
166
176
|
An exact unsupported download report can atomically reserve final/file I/O and
|
|
167
177
|
admit local publication of that same snapshot. An earlier possibly handled
|
|
@@ -177,8 +187,8 @@ is committed before exclusive same-volume hard-link publication. The source and
|
|
|
177
187
|
target must name the recorded file and pass size/SHA checks before `saved` is
|
|
178
188
|
committed. Existing destinations are never overwritten or removed. Private
|
|
179
189
|
unlink follows that result and actual descriptor closure; the final file has
|
|
180
|
-
no automatic expiry.
|
|
181
|
-
|
|
190
|
+
no automatic expiry. Private cleanup validates the exact `.download` row identity and never removes
|
|
191
|
+
a user backup.
|
|
182
192
|
|
|
183
193
|
Unknown file effects remain `saving`, retaining their source and reservations.
|
|
184
194
|
A failed DB result write retains the ended physical outcome for settlement.
|
|
@@ -213,7 +223,7 @@ cleanup stays visible. Another operation's reservation is never released.
|
|
|
213
223
|
An explicit same-result read may finish its cleanup or verify an existing
|
|
214
224
|
published export, never regenerate a backup, repeat Host delivery, reapply data
|
|
215
225
|
or replace an SDK run. Files/permissions/SDK credentials/private transaction
|
|
216
|
-
material are excluded from public backups. Clearing the
|
|
226
|
+
material are excluded from public backups. Clearing the saved read address does
|
|
217
227
|
not invalidate account-independent coin metadata or disconnect the wallet.
|
|
218
228
|
|
|
219
229
|
Non-terminal review session expiry is recorded lazily when the session is read or mutated after its TTL. Review-session expiry has no background worker; private download retention uses the separate owner timer described above.
|
|
@@ -228,7 +238,11 @@ All state-writing MCP callers use this owner, including reads that save activity
|
|
|
228
238
|
|
|
229
239
|
### Read cards
|
|
230
240
|
|
|
231
|
-
`live_read_cards` owns the card kind (account, receipt, chart, connect, review or settings), permission hash, backend owner, revision, original/accepted input, state/reason and saved result or scoped workflow operation reference.
|
|
241
|
+
`live_read_cards` owns the card kind (account, receipt, chart, connect, disconnect, review or settings), permission hash, backend owner, revision, original/accepted input, state/reason and saved result or scoped workflow operation reference. Domain request state remains in its existing journal. At closure, a typed public
|
|
242
|
+
result is saved atomically in live_read_cards.result_json. A database trigger
|
|
243
|
+
rejects updates to closed rows. Domain callbacks skip them; closed reads return
|
|
244
|
+
only that saved result, not current wallet or Settings projections. Connect and
|
|
245
|
+
Disconnect terminal results exclude addresses and QR data. Admission and result writes use conditional updates. Expiry is applied by the backend to unsubmitted input; a View timer only requests state. Frame recreation and chat navigation perform no close transition. The backend rejects late writes after local data replacement or owner changes, and recovery closes unfinished cards without repeating their source query.
|
|
232
246
|
|
|
233
247
|
The same record contains a model-safe result and, for receipts, separately validated UI-only input values and PTB display data. They are projections of one source read. They are not activity evidence or serialized signing material. Public saved resources exclude the private partition, and product backups exclude card records and permission hashes entirely.
|
|
234
248
|
|
|
@@ -279,48 +293,61 @@ perform a current session check. After digest, signer and mainnet verification,
|
|
|
279
293
|
the parent performs a final session check before the synchronous submission CAS
|
|
280
294
|
and dispatch. A later remote event is not presumed already known.
|
|
281
295
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
296
|
+
Connect accepts no service-restart input; Settings owns that operation. Parent
|
|
297
|
+
recovery closes old card input and settles interrupted management outcomes without
|
|
298
|
+
replaying effects. Pending SDK work is released only after actual child exit or
|
|
299
|
+
confirmed acquisition of its private store by a new child. Parent verification,
|
|
300
|
+
submission and lookup retain their independent completion guards.
|
|
301
|
+
|
|
302
|
+
Recovery evaluates the one current slot against a fresh SDK run, including rows
|
|
303
|
+
from a previous owner or data generation. Missing exact topics require the SDK
|
|
304
|
+
session check before absence is recorded. Confirmed absence plus settled I/O
|
|
305
|
+
releases occupancy; a stale connected row is not a permanent lock. A valid approved
|
|
306
|
+
current-generation session can regain usage. Terminal, unusable or older-generation
|
|
307
|
+
sessions receive cleanup ownership only, allowing exact Disconnect without granting
|
|
308
|
+
financial authority. Immutable results and read-address suppression remain intact.
|
|
309
|
+
Unknown SDK sessions are never adopted and block new pairing/financial inputs.
|
|
310
|
+
|
|
311
|
+
Fixed identity is `(chainId, normalizedAddress)`. Import/reset account-ID reuse
|
|
312
|
+
cannot retarget private connections. Public backups contain address history,
|
|
313
|
+
records and settings, excluding selectors, private grants, operations and authority.
|
|
314
|
+
Data replacement increments the generation and does not activate restored accounts.
|
|
315
|
+
The retained private session can be disconnected without rewriting its old epoch.
|
|
316
|
+
Settings Clear saved read address changes only `read_address_cleared`; reconciling
|
|
317
|
+
the same session does not reset it. Another explicit connection supplies new facts.
|
|
318
|
+
|
|
319
|
+
The store reads the current supervisor snapshot inside evaluation and atomic
|
|
320
|
+
admission. Missing inspection is not an empty service. `canDisconnect` qualifies
|
|
321
|
+
the current exact target, while `usableConnectionId` qualifies its transaction
|
|
322
|
+
usage. Reconciliation notices reveal no private topic. Pending approval publication
|
|
323
|
+
is not reported as an unexpected session. Current slot transfer, new connection,
|
|
324
|
+
operation and card admission commit or roll back together before SDK I/O.
|
|
325
|
+
|
|
326
|
+
Management admission publishes its exact operation and affected current card
|
|
327
|
+
facts atomically. Scoped grant/impact revisions reject conflicting input,
|
|
328
|
+
while an unrelated chain update does not reject a still-valid Sui target.
|
|
329
|
+
Publication failure rolls back admission before SDK I/O. A reconnection cannot
|
|
330
|
+
retarget a bound Review. Grant changes invalidate only the affected chain. Admission consumes the card's one operation. Its final result closes input;
|
|
331
|
+
no later connection state can attach another effect.
|
|
332
|
+
|
|
333
|
+
After an SDK approval arrives, its exact operation, connection, run and data
|
|
334
|
+
generation own private topic retention before success publication. Retention
|
|
335
|
+
grants cleanup ownership only. Connection approval, immutable chain results,
|
|
336
|
+
address history and the operation's success result then commit in one transaction.
|
|
337
|
+
A failed success publication rolls those public effects back without discarding
|
|
338
|
+
the retained cleanup target. A duplicate response for the same completed operation
|
|
339
|
+
and topic reads its saved result without changing addresses or read suppression.
|
|
340
|
+
An unrelated topic is neither adopted nor disconnected.
|
|
341
|
+
|
|
342
|
+
If cleanup ownership cannot yet be recorded, the workflow retains the private
|
|
343
|
+
response and cleanup-only write in its existing per-operation pending writes.
|
|
344
|
+
Its callback is not settled merely because the response arrived. Once retention
|
|
345
|
+
and cleanup are resolved, database retries never repeat remote disconnection or
|
|
346
|
+
retry failed success publication. Unconfirmed remote removal remains an exact
|
|
347
|
+
cleanup target for explicit Disconnect; it is not successful absence or financial
|
|
348
|
+
authority. Owner/run/data-generation changes fence the old callback. If no topic
|
|
349
|
+
could be retained before the parent exits, recovery cannot infer its ownership:
|
|
350
|
+
the resulting unrecorded session blocks new pairing and financial input.
|
|
324
351
|
|
|
325
352
|
Service-loss authority revocation is retained against its SDK run and data
|
|
326
353
|
generation until it commits. Current wallet-state reads retry that database
|
|
@@ -353,9 +380,9 @@ This is not availability during an unreadable database or a bypass of authority
|
|
|
353
380
|
revocation failures.
|
|
354
381
|
|
|
355
382
|
Connection facts and workflow maintenance have separate internal contracts.
|
|
356
|
-
`readConnectionFacts(at)` collects recorded
|
|
383
|
+
`readConnectionFacts(at)` collects the current recorded connection, current-run SDK presence,
|
|
357
384
|
pending work and read-address provenance from one SQLite read snapshot. The
|
|
358
|
-
shared
|
|
385
|
+
shared qualification projection computes eligibility from those
|
|
359
386
|
facts; they do not update requests, expire connections or repair callbacks.
|
|
360
387
|
Settings general facts use this diagnostic path and stored counts, so another
|
|
361
388
|
request's refused deadline write does not prevent opening or reading Settings.
|
|
@@ -408,7 +435,7 @@ running. `ReviewSession.preparationError`, stored in `live_review_sessions.prepa
|
|
|
408
435
|
is a saved review message: it can record a failed preparation or invalidation
|
|
409
436
|
caused by a wallet connection change. Its presence does not prove that a
|
|
410
437
|
computation ran. The View labels it Earlier review message and keeps it distinct
|
|
411
|
-
from current
|
|
438
|
+
from current wallet-availability guidance and a command delivery failure. These
|
|
412
439
|
fields describe different facts; none grants action or retry authority.
|
|
413
440
|
|
|
414
441
|
Signature admission independently checks the current material handle, expiry,
|
|
@@ -419,9 +446,9 @@ Revision-specific evidence validity does not remove session/account pending-work
|
|
|
419
446
|
or data-replacement protections. Mandatory activity rows commit with the state;
|
|
420
447
|
optional event-log failures do not roll back that commit or repeat an operation.
|
|
421
448
|
|
|
422
|
-
Review preparation
|
|
423
|
-
|
|
424
|
-
|
|
449
|
+
Review preparation checks the immutable bound account against the current fixed
|
|
450
|
+
connection and explicit app input before writing preparation state. Saved read
|
|
451
|
+
context suppression does not alter that target. A target mismatch is a current
|
|
425
452
|
restriction, not a stored preparation error or an activity transition.
|
|
426
453
|
|
|
427
454
|
Request interruption consumes both its internal origin and the request phase.
|
|
@@ -465,9 +492,12 @@ and public backup export also read recorded facts without advancing live
|
|
|
465
492
|
requests or treating imported history as authority. Replacement warnings do not
|
|
466
493
|
claim an earlier stored-counts snapshot is the number being deleted now.
|
|
467
494
|
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
495
|
+
Workflow `pendingOperation` is derived from the current connection's one running
|
|
496
|
+
or SDK-pending operation, carrying its identity, action, status and settlement
|
|
497
|
+
flag. It uses the same read transaction as the card result. This summary creates
|
|
498
|
+
no new persisted state or authority. A completed disconnect with pending
|
|
499
|
+
settlement stays completed; only a running disconnect is in progress. Connection
|
|
500
|
+
updates preserve the original operation result and card input lifetime.
|
|
471
501
|
|
|
472
502
|
### Current format and backups
|
|
473
503
|
|
|
@@ -479,7 +509,7 @@ With a new empty data directory, users configure account context and endpoints;
|
|
|
479
509
|
|
|
480
510
|
## Boundaries
|
|
481
511
|
|
|
482
|
-
The active account is
|
|
512
|
+
The active account is the current connection's saved Sui read context. It is not signing authorization, login, custody or proof of ownership. Settings can suppress this context without changing the connection's fixed address or requests. Changing the wallet address requires disconnecting and reconnecting. Accounts retained in history are not current choices.
|
|
483
513
|
|
|
484
514
|
NDJSON event logs remain optional audit/debug logs. They are not the product activity source of truth. User-facing activity summaries read from SQLite. Event log write failures do not fail product session transitions or SQLite evidence writes.
|
|
485
515
|
|