Skip to content

Demo world, step 1: new look and chapter shell - #20

Merged
Pradeeppilotdev merged 21 commits into
mainfrom
feat/demo-world
Nov 14, 2026
Merged

Pradeeppilotdev merged 21 commits into
mainfrom
feat/demo-world

Conversation

@TheGaffer7839

@TheGaffer7839 TheGaffer7839 commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Turns the local "Demo café" into its own world: a full-screen, five-chapter walkthrough where a judge plays Dave. The product views (#agent-payments, #ask-dave, tools) keep their look; all demo styles are scoped under body.demo-world. There are no contract changes, and the agent payment logic is reused unchanged; the demo-only code lives in agent/demo-cafe.ts and app/demo-route.ts.

The five steps

  1. New look and chapter shell (f09e04c): #demo/* hides the product sidebar and header. It adds a 72px top bar with chapters 01–05, vault and wallet balances, and "Exit demo → Countersign app". Bare #demo opens #demo/post. The design is dark, uses Helvetica plus monospace, and has square corners.
  2. Real invoice documents (e9da565, aa86c0b):
    • Morning post is a mailbox of every delivered invoice, including the tampered one, all drawn identically. Each opens as a paper invoice whose line items add up exactly (BigInt maths).
    • "Hand all N to my agent →" runs Pay all.
    • The tampered invoice pays bean5.test.near, a lookalike of beans.test.near. Every invoice has "Ask Dave: would you pay this account?", the existing account check with no model call: suppliers return PAY (WARN before their first payment) and the lookalike returns STOP.
    • An invoice viewer dialog opens from the results and the ledger.
  3. The bank (34bf1d4): Dave's wallet (the live owner balance, "Get 5 test NEAR") and the vault ("Deposit into vault" through the owner's fund), with "Your agent can only pay from the vault." Deposits are checked exactly: above 0 and at most the wallet minus a 0.5 NEAR gas reserve. A "Today at the bank" history list is kept. Bank operations wait for gas refunds so balances are exact.
  4. Your rules (b5310dc): an editable per-bill limit, daily budget and duration (1–24 h, the limit of the shared CLI policy operation). It saves through setDeskPolicy, keeping the suppliers and minimum. When rules expire, a banner offers "Renew for 2 hours" through the existing renewal. Approved suppliers and the Milk Co weekly service are shown read-only.
  5. Agent pays and End of day (9feef40):
    • The run fills in live, one bill at a time in processing order: "Checking…", then PAID / STOPPED / REJECTED from the real outcome.
    • A counter shows "3 paid · 3 stopped · 1 rejected · Vault 5 → 3.8 NEAR".
    • "Try again" appears only on budget-stopped bills and uses the existing resume (no model call).
    • End of day summarises the day's totals from the on-chain ledger, who got paid, what was stopped and why, and the lookalike's 0 NEAR.

Demo routes added

wallet-faucet, deposit, set-rules, renew-rules and retry. They share the existing one-at-a-time guard, refuse anything outside the local sandbox, and validate their bodies strictly. The old faucet still works but is not shown.

Tests

  • npm run test:app 82/82 · npm test 11/11 · integration/demo-cafe.test.ts 1/1.
  • The integration test adds on-chain checks:
    • receive keeps a display copy of every invoice, and the lookalike is flagged;
    • the faucet adds exactly 5 NEAR to the wallet, and a deposit moves exactly its amount;
    • the reserve limit and non-local refusals hold;
    • saved rules read back exactly, and renew keeps the limits;
    • progress reports results in processing order;
    • after the budget is raised, retry pays once and never twice.

Live check (port 4417, no model calls)

Fresh café → receive 7 → Hand all: rows filled in over about 26 s. Result: 3 paid, 3 stopped, 1 rejected; vault 5 → 3.8.

I then raised the daily budget to 2 and pressed Try again on PASTRY-02, which paid (vault 3.3). End of day showed "Paid 1.7 NEAR to 3 suppliers · Stopped 2 · Rejected 1 · Vault 5 → 3.3". "Start a new day" reset the balances, rules, mailbox and ledger.

Screenshots (local)

~/Documents/Headquarters/Countersign-video/demo-world/step1/ … step5/ (1440×900 and 390×844 per step).

🤖 Generated with Claude Code

TheGaffer7839 and others added 6 commits November 13, 2026 11:34
The #demo routes now render a full-screen demo shell instead of the
product console: a 72px top bar with five chapter tabs (#demo/bank,
rules, post, pay, end), vault and wallet balances, and an exit link
back to #agent-payments. Bare #demo opens #demo/post.

Existing café features are regrouped into chapters with unchanged
behaviour. Styles are scoped under body.demo-world so product views
keep their look. Ask Dave is restyled inside the demo and shows an
AI disclaimer there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Morning post becomes a mailbox of every invoice from the latest
receive, including the one rejected at intake, all drawn the same way.
The selected invoice opens as a paper document with exact BigInt line
items, and "Hand all N to my agent" runs the existing Pay all.

Agent pays lists one row per invoice in delivery order with PAID,
STOPPED or REJECTED and a plain reason. Invoice names in results and
ledger receipts open the same document in a dialog. The demo shows a
status line only for errors.

The demo receive step keeps a display copy of each delivered invoice
(including the tampered payee and Milk Co's service week). Import and
payment paths are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The tampered invoice now pays bean5.test.near, a lookalike of Bean Co's
payout that Ask Dave's existing lookalike check catches; it is still
rejected at intake for its broken signature. The End of day card reads
"bean5.test.near · not a supplier".

Every invoice document, genuine or tampered, offers the same "Ask Dave:
would you pay this account?" button. It runs the existing read-only
account check (no model) on the invoice's Pay to account and shows the
verdict in the Ask Dave panel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Bank chapter now shows the two places Dave's money lives: his
wallet (the owner account's live balance, with "Get 5 test NEAR") and
the vault (with a chosen-amount "Deposit into vault" through the
owner's existing fund call). The top-bar wallet balance is wired to the
same live owner balance, and a "Today at the bank" list is kept in the
café state file.

Two demo route actions are added, wallet-faucet and deposit, both
refused outside the local sandbox. Deposit amounts are validated in
exact BigInt maths: above 0, at most the wallet minus a 0.5 NEAR gas
reserve. The old one-click top-up still works but is not shown.

Bank operations and setup wait for the owner's gas refunds to settle,
so balances and deltas are exact.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Your rules becomes an editable form (most per bill, daily budget,
hours) that saves through the same setDeskPolicy operation as
`agent:desk policy`, keeping the pinned suppliers and minimum. Values
are checked in exact BigInt maths in the browser and again on the
server, with the same messages. Expired rules show a banner with
"Renew for 2 hours", which uses the existing renewal operation and
keeps the limits. Approved suppliers and the Milk Co weekly service
are shown read-only.

Two demo route actions are added, set-rules and renew-rules, refused
outside the local sandbox and sharing the one-at-a-time guard.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent pays now shows the run as it happens: the pile on the left, and
results on the right appearing one at a time in processing order, each
first as "Checking…" and then as PAID, STOPPED or REJECTED once the
server reports that bill's real outcome. A counter shows paid, stopped
and rejected totals and the vault change. Bills stopped only by the
daily budget get "Try again", which goes through the existing resume
path (no model call) via a guarded demo `retry` action.

End of day becomes a summary: headline totals from the on-chain
ledger, who got paid (each invoice opens the viewer), what was stopped
and why, the lookalike account's balance, "Ask Dave how today went"
and "Start a new day".

The demo pay run reports each finished bill through the existing
progress endpoint and records its processing order and the day's
opening vault balance in the café state file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TheGaffer7839
TheGaffer7839 marked this pull request as ready for review November 13, 2026 11:39
@Pradeeppilotdev
Pradeeppilotdev merged commit ec391ba into main Nov 14, 2026
2 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.

2 participants