Repository navigation
Let nibblets ask for cards, and kill them, within their limits - #25
Merged
Merged
Conversation
IAmJSD
added this pull request to stack #29
October 19, 2026 15:34
IAmJSD
force-pushed
the
bank/2-cards
branch
3 times, most recently
from
October 19, 2026 21:28
80a5b19 to
3c173e2
Compare
`card_request`, `card_list` and `card_kill` on the nibblet tools, offered when a bank plugin is set up. The server checks the request against the nibblet's spending limit, has the plugin issue the card, and sends its details over the runner socket; the runner writes them to a 0600 file outside the home folder and the tool returns only the path, so a card's number stays out of the thread, the database and snapshots. Cards are written again when a runner reconnects, checked with their providers every minute (single-use cards close once used), and killed when their nibblet is deleted. The API gains `bank.*` for Settings and the UI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KGXXQcj3hZN2jiB6As6kk5
… flag refusals - The runner writes and removes each card's file one at a time, so a removal sent while a slow put is still landing can't leave a killed card's details behind. - A killed card's closedAt is set when it's killed, and the day it has to settle counts from then, not from when it was made. - A refused card request or kill is a tool error, not a plain answer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Part 2 of 7 in the bank stack, on #24.
What this adds
card_request(single or multi use, with a limit and a purpose),card_listandcard_killon the nibblet MCP server. They're only offered when a bank is set up, and the system prompt gains a Spending section once a nibblet has a limit.card_put).$TMPDIR/nibblet-cards/<id>.json,0600in a0700folder, and the tool returns only the path.pendingbefore the provider is asked, so a card made before a timeout is found (find) and closed by the minute-by-minute check.closingand is retried.BankErrormessages from plugins reach the nibblet. Anything else, which could hold an RPC URL with its key, is logged on the server.bank.status,bank.cards,bank.allowances,bank.kill, and acards_changedlive message.Screenshots
From #28's UI, in the mock server (
?mock=1): a nibblet's cards counted against its limits, each with a Kill button, and one waiting to close.Review fixes
closedAtis set when it's killed, and the day it has to settle counts from then, not from when it was made.card_requestorcard_killis returned as a tool error (isError), not a plain answer.Checks
pnpm format:check,pnpm -r typecheckandpnpm testpass on this branch on its own.apps/server/src/bank.test.tscovers limits, races, recovery, settling, scrubbing and deletion.Generated by Claude Code