Skip to content

feat(dapp): help button with an assistant, tickets, and an admin Tickets page - #196

Merged
0xDeon merged 7 commits into
mainfrom
feat/support-tickets
Nov 16, 2026
Merged

0xDeon merged 7 commits into
mainfrom
feat/support-tickets

Conversation

@0xDeon

@0xDeon 0xDeon commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

What this adds

For people using the app

  • A Help button at the bottom right of every chain page. On a phone it sits just above the message box.
  • An assistant answers first. It reads that person's recent off-ramp orders (read only, no bank details) and can:
    • answer;
    • offer a Send this to the team button;
    • file a ticket straight away. It does this when the person asks for a human, when money left the wallet and the payout is past its usual time, or for a suggestion or complaint.
  • Once a ticket exists, the thread is between the person and the team. Replies show in the widget, and a count on the Help button says when one is new. People who signed in with an email also get an email.

For the team

  • A new Tickets page in the admin, beside Payouts.
  • Filters for status (Needs a reply, Answered, Closed, All), for kind (problem, suggestion, complaint), and for chain through the admin's existing chain switcher.
  • Each ticket shows the conversation, a reply box, Close or Reopen, and the person's orders both now and when they filed.
  • New tickets and replies email ALERT_EMAIL when it is set.

How it works

  • lib/support/assistant.ts
    • Model: claude-opus-5-5 at low effort, with server-side refusal fallbacks.
    • Returns structured output with three fields: a reply, a next step (none, offer_ticket or file_ticket), and a draft ticket.
    • It cannot move money or change orders.
  • lib/support/context.ts looks up the person's orders on the server, from both weave_orders and naira_orders. Every value goes through promptSafe. A ticket never takes orders from the page.
  • lib/support/tickets.ts holds two tables, support_tickets and support_messages. They are created on first use; migration 018 keeps them in sync.
  • A ticket is keyed by requester, the same key requesterOf uses: the email, or wallet:<address>. A person can only read and reply to their own tickets.
  • New support rate-limit family: 10 a minute and 100 a day per caller, since every assistant message is a paid call.

Tests

  • 28 new tests:
    • the ticket store over an in-memory fake;
    • the assistant: structured output, refusals, malformed answers, pasted role lines;
    • the order lookup: no bank details, one line per order;
    • every route: wallet required, ownership, admin auth, the reply and unread flow, closing.
  • Full non-live suite: 385 files, 9123 tests passing. Lint, Prettier and typecheck are clean.
  • Simulated end to end on a local dev server with the real routes and Postgres, driven by Playwright. The model was a local stand-in returning scripted replies, because no Anthropic key is set locally. The run confirmed the seeded order reaches the assistant's context. The simulation also caught a useEffect that returned a promise in Edge, which is fixed.

Before or after merge

  • ANTHROPIC_API_KEY must be set on prod for the assistant to answer. Without it the widget says so and offers Send this to the team.
  • ALERT_EMAIL on prod decides whether the team gets an email per ticket. It is not changed here.
  • Wallet-only users are identified by the wallet header, as the rest of the app does today. That keeps one wallet's tickets apart from another's for honest use, but it is not proof of who holds the wallet.

…nd files tickets

A help button sits at the bottom right of every chain page. An assistant on
Claude answers first, reading the person's recent off-ramp orders (read only,
no bank details), and either answers, offers to send it to the team, or files
a ticket when the person asks for a human or money looks stuck. Tickets carry
the conversation and the orders as the server looked them up.

The team reads and replies from a new Tickets page in the admin, beside the
orders as they stand now. Replies show in the widget with a count on the
button, and by email when the person signed in with one. New tickets and
replies email ALERT_EMAIL when it is set.

Assistant calls get their own rate-limit family: 10 a minute, 100 a day.
@netlify

netlify Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for useintentadapp ready!

Name Link
🔨 Latest commit a5af58f
🔍 Latest deploy log https://app.netlify.com/projects/useintentadapp/deploys/6afaee9d832a665b21d4a514
😎 Deploy Preview https://deploy-preview-196--useintentadapp.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for useintent ready!

Name Link
🔨 Latest commit a5af58f
🔍 Latest deploy log https://app.netlify.com/projects/useintent/deploys/6afaee9dcfde0c1fc89a90f3
😎 Deploy Preview https://deploy-preview-196--useintent.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

The help button is now an icon with the reply count on its corner. The
first time someone opens a chain page with a wallet connected, a short
note beside it says they can ask for help, raise a ticket or leave a
suggestion there. It waits for any other notice on screen to close, and
shows once per browser.
The header carries the Intent mark, a name and a status line, with a
menu for a new conversation and the person's tickets. An empty chat
shows one line and three ways to start; the composer is a single box
with the send button inside it.
After the chain's beta notice is closed, the page dims and the help
button stays bright beside a note that help, tickets and suggestions
are here. A click outside, Escape, "Got it" or "Open help" ends it, and
it shows once per browser.
The notice now matches the chat's cards: the chain's mark in a tile
beside the title, the three risks as rows with a short lead to scan
and the detail under it, and one button that is also the promise it
asks for, "I'll start small". On a phone it rises as a bottom sheet.
The uppercase release pill and the grey advice box are gone.
…ter it

The browser specs pressed "I understand", which is now "I'll start
small". Specs that start with the notice already seen have the help
note seen too, so it never sits over what they test; the beta notice
spec walks the whole first visit, notice then help note, and checks
neither comes back after a reload.
@0xDeon
0xDeon merged commit e4cc901 into main Nov 16, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant