feat(mobile): agent message rendering with passkey-gated transaction proposals - #593
Open
Adeolu01 wants to merge 1 commit into
Open
feat(mobile): agent message rendering with passkey-gated transaction proposals#593Adeolu01 wants to merge 1 commit into
Adeolu01 wants to merge 1 commit into
Conversation
Renders each of the agent's message types and turns a transaction it builds into a proposal the user has to approve. The proposal card is built from the decoded XDR rather than from the summary the agent wrote for it, so the amounts and destinations on screen are the ones being signed, and the agent's own description sits beneath them labelled as a claim. Approving prompts the device passkey over the transaction's own hash before the fee-payer key is read from the keychain, so the assistant can never move funds on its own: a dismissed prompt is a decline, an undecodable transaction cannot be approved at all, and a transaction sourced from any account other than this wallet's fee payer is refused before the prompt is raised.
|
@Adeolu01 is attempting to deploy a commit to the miracle656's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Adeolu01 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The agent can read, explain, and propose — it cannot move funds. Each of its message types renders distinctly, and a transaction it builds becomes a proposal that stays unsigned until the user confirms it with the device passkey.
closes #494
Message types
Five, each with its own treatment rather than one bubble style for everything:
**bold**and`code`rendered as styledTextsegments. The web wallet substitutes HTML intodangerouslySetInnerHTMLfor the same two forms; this is model-generated text, and turning it into markup a renderer will interpret is a habit worth not carrying to a new surface, soparseInlineMarkupreturns segments instead.Frames from the service are decoded by
parseAgentServerEvent, which only accepts the shapespackages/agent/src/server.tssends. Anything malformed, unknown, or missing its prose is dropped rather than rendered as something the user might act on — and apendingTxXdrthat is not a non-empty string never reaches the approval path at all.The approval gate
An agent-proposed payment cannot execute without an explicit passkey confirmation, and the card is built so the user is approving the transaction rather than the agent's description of it:
reviewProposedTransactiondecodes the transaction and states each operation in the user's terms — amounts, assets, destinations, the minimum received on a swap, the fee, the memo. Fee bumps are unwrapped so the inner transaction, which is what executes, is the one described. An operation the app cannot describe is called out as such, never passed over silently.pendingTxSummaryis shown beneath the decoded facts and labelled "The agent says", so the two can be compared instead of conflated.Each proposal carries its own status, so approving one does not disturb another and a resolved card cannot be tapped twice.
Testing
npm test— 20 new unit tests inlib/__tests__/agentMessages.test.ts: every frame the service sends plus the malformed, unknown, prose-less, empty-XDR and non-string-XDR rejections; inline markup including unmatched markers, markup-looking text and the empty string; transaction review over real signed XDR for payments, strict-send swaps, multi-operation transactions, the undescribable-operation flag and unparseable input; the fee-payer source check; and Horizonresult_codesextraction. 132 tests pass on this branch.npm run typecheckpasses.The confirm flow itself is not covered end to end — it needs a device passkey and the running agent service, and the app has no component-test setup yet. The decisions that make it safe are in the tested library for that reason: the screen decides nothing about a proposal that
reviewProposedTransactionandisProposalForFeePayerhave not already established.Notes for review
lib/passkey.tsis reused as-is for the confirmation, so the agent path and the WalletConnect path prompt through the same signer.