Repository navigation
v0.15.0
Router purchases recover after an interruption without a second charge, swarm dissolution refuses while a worker is active or unresolved, and vapi login works on more Linux keyrings.
Added
- CLI
vapi router clear-pending --confirm-settledsaves any missing succeeded receipt, prints payment evidence and support guidance, then retires a settled journal under the purchase lock. JSON addsreceipt,receiptAppendedandnotice; prepared, signed and unknown entries are refused. The flag is exclusive with--confirm-unpaidand has no MCP equivalent. - CLI purchase/refill JSON and MCP purchase/refill output add optional
receipt.settlement(succeeded,rejectedorunknown). MCP output schemas acceptsettlement_unconfirmed,credit_pendingandpending_purchase_unlinkedwarnings. - The Router subentry exports
ensureRouterPurchaseReceiptto record settled purchase evidence; a separate strict sync gates retirement. Pending purchase journals optionally recordbaselinePurchasedUsd; older entries remain recoverable through a successful balance-key chat. - Payment warnings add
settlement_unconfirmed,credit_pendingandpending_purchase_unlinkedto distinguish unconfirmed authorizations, credit awaiting confirmation, and settled purchases whose link changed. vapi router clear-pending [--confirm-unpaid]prints public payment evidence and explorer instructions. Before clearing, the CLI uses the same receipt/authorization-state resolution as automatic recovery: paid attempts and live authorizations are refused, and unused expired authorizations can clear. Only when chain evidence is unavailable may explicit human confirmation override the guard; output identifies that confirmation as lacking chain evidence. There is no MCP equivalent.- CLI
vapi swarm forget-run <swarm> <runId> --confirm-destroyedlets an owner confirm a verified unknown/orphaned sandbox is destroyed. It prints the original recorded scope and check command, retains a timestampedforgottenrun record and retires the matching sidecar. Missing scope is reported rather than guessed. - MCP adds
swarm.stopwithnameand exactly one ofrunIdorall: true.VapiServerOptions.runtimeForStopoptionally resolves stop-only adapters by runtime kind. The CLI-hosted server supplies local/Railway stop adapters without enabling remote startup or stale-start confirmation over MCP. PayRequestArgsadds optionalbeforeSign(also on x402 payment builders) for durable public authorization journaling before signing, and optionalreceiptIdto correlate a durable purchase reservation with its receipt ledger entry. The Router subentry exportsrouterPurchaseView, the shared public receipt/warning projection.- Core exports the
PaymentWarningtype. The Router subentry exportsRouterPurchaseResult,RouterPurchaseWarningandrouterPurchaseSummary. - Core exports
PAYMENT_WARNING_CODES, the list every payment warning schema is derived from, andswarmRunRefillSchema. Swarm member results, delegation records and the MCP Router tools accept the same warning codes and the receipt'ssettlementoutcome, so a refill with an unconfirmed settlement or pending credit no longer fails output validation in a swarm run. - Core exports
RouterPendingPurchase. Wallet entries expose its public recovery metadata in memory, whileWalletStore.setRouterPendingPurchaseatomically reserves, updates or clears the matching record inrouter-pending/<wallet>.json, separate from the v1 wallet registry. Older registry writers cannot erase it. Existing registry records migrate on read; legacypreparedrecords remainunknownbecause older clients did not journal signing. Empty tombstones prevent stale registry snapshots from resurrecting cleared purchases.
Breaking
- MCP runtime
RuntimeError.codeaddsswarm_unavailableandlaunch_ambiguous.startDetachedRunreserves swarm members under the swarm lock before taking their member lock, revalidates membership and can reject withswarm_unavailable; this applies to local and Railway swarm workers. Standalone agents retain the member-only lock. - Exported MCP
stopRunnow attempts to stopunknownworkers and requires successful adapter completion before persistingstopped.Runtime.stopadds an optional{ requireSuccessfulExit: true }argument, passed bystopRunfor running, unknown and starting Railway records with a saved sandbox id and by launch-persistence rollback; adapters must honor it without text-based absence inference. The Railway adapter always requires destroy exit 0, with or without the option, across launch-failure, signal, terminal-status and direct-stop cleanup;destroyRailwaySidecarrequires exit 0 for every sidecar it retires. Stderr warnings are harmless on success; non-zero, interrupted and timeout outcomes reject even when text says not found. Local stops retain their behavior. AgentEventadds therefillmember with public Router purchase evidence and warnings.- CLI Router purchase/refill JSON now matches MCP:
receipt.id,receipt.amountUsd,receipt.networkand optionalreceipt.transactionreplace the flatreceiptId,amountUsd,networkandtransactionfields. Human output includes the public receipt and transaction references. buyRouterBalancereturnsRouterPurchaseResultwith optionalPaymentWarningentries.routerPurchaseSummary, CLI purchase JSON and MCP purchase output allowamountUsd: nullandnetwork: "unknown"when charged metadata is absent.payRequestreturns a confirmed in-memory receipt with warnings when receipt persistence or post-settlement processing fails, instead of rejecting. Callers must retain the receipt and must not repeat the payment for these warnings.RouterClientErroraddsrefill_pending, an optional priorrefillpurchase (fourth constructor argument, including interrupted purchases awaiting confirmation), and a publictoJSON()summary.ChatResultadds optionalrefill: RouterPurchaseResult; CLI/MCP chat results and errors preserve public payment evidence and warnings.refreshRunRecordnow acquires the member lock, re-reads the stored record and returns its fresh state. Unknown and terminal records are never polled from stale snapshots. Missing records reject withRuntimeError("run_not_found"), changed member identity withruntime_unavailable, and lock contention withmember_busy. MCP exportswithMemberRunLock(home, account, operation)for the same lifecycle lock; no run-record schema or function argument changes in this round.destroyRailwaySidecarserializes cleanup on the recorded member and re-reads ownership/state before acting. Concurrent completed confirmation with no sidecar returnsdestroyed: truewithout another Railway call; conflicting/current metadata or contention returns a failed cleanup result. Unattributed legacy cleanup is serialized by run id and does not rewrite failed metadata without a member lock.- MCP runtime
RunStateaddsorphanedandforgotten;RunRecordandDetachedRunSummaryadd optionalforgottenAtandconfirmedBy: "cli". A forgotten record requires both confirmation fields.RuntimeHandleadds optionalrailwayScope: { projectId?, environmentId? }for original creation metadata when available. MCP read-only run summaries include these states/confirmation fields; no forget tool is exposed. SwarmErrorCodeaddsswarm_workers_activefor active/unresolved-worker dissolution refusals. CLI JSON and MCP return that shared domain code instead of an untyped error.
Fixed
- Failed Railway destroys retain evidence that blocks dissolution before any balance read or transfer, including when stderr says not found. A text-only not-found status returns
unknownand leaves the sidecar unchanged. Without a run record, useswarm stop --allfirst; a failed destroy marks the sidecarorphanedforforget-run --confirm-destroyed. Failed starting/running stops becomeunknownwith sanitized detail; when sidecar persistence succeeds, launch-failure and signal cleanup retain an identifiedorphanedsidecar that CLIforget-runcan clear without a reservation, and failed persistence rollback retains its sidecar. Terminal-result cleanup staysrunningand retries on refresh; a failed explicit stop then becomesunknown. Nonterminal status polls keep Railway starts unresolved, including when status requests fail. CLI and MCP stop errors and identified failed-launch diagnostics namevapi swarm forget-run <swarm> <runId> --confirm-destroyedafter verification in the original project/environment. CLIswarm stop --alland MCPswarm.stopretry unknown workers instead of permanently stranding a disappeared sandbox; only successful destruction or explicit CLI confirmation unblocks dissolution. CLI confirmation also accepts finished, failed or stopped Railway records with an identified orphaned sidecar; id-less sidecars remain refused. - Detached swarm reservations serialize with dissolution in swarm-then-member lock order. Launch releases the swarm lock and verifies its reservation before creating a worker, so a dissolve cannot miss a concurrent start.
- Ambiguous Railway creates retain their starting reservation and return
launch_ambiguouswith the stale-start confirmation command. After five minutes and owner verification,stop --confirm-worker-stoppedclears the id-less sidecar; failures before Railway receives a request still clear the reservation. - Swarm member results and delegation replays retain public Router refill receipts and warnings.
- Bundled agent runs print refill evidence to stderr and preserve public transaction hashes in JSON and result files while redacting secrets.
- Agent runs retain Router refill evidence in
RunAgentResult.refills, CLI stderr, JSON and result files, including purchases carried by failed chats. Stops preserverefill_pendingrecovery guidance. - SDK
client.router.buy()returnsRouterPurchaseResultso callers can read warnings. The main core entry exportsRouterPurchaseResultandRouterPurchaseWarningtypes. - Receipt appends sync payment evidence best effort; settled Router journals retire only after a separate strict sync of the ledger and its parent directory, including receipts saved by older clients. The file is opened without creating it, writable only on Windows; directory sync is skipped there. Fresh transfers strictly sync their signed authorization file and parent directory (except the directory on Windows) before calling the relay. If sync fails, no relay request is sent. A successful failed-row append releases the reservation and reports that no money moved. If that append also fails, the transfer returns
unknown, keeps its reservation and can be resumed. Wallet renames require the receipt rewrite to sync before replacement and sync its directory best effort afterward. - Recovered Router purchases appear once in receipt listings, JSON/CSV exports and stats, preserving original metadata through append-only settlement revisions.
- Logout bounds remote revocation and its token refresh requests and response bodies to ten seconds. Local cleanup uses the wallet credential lock even after that deadline. Refresh re-checks the link and stored token pair before publishing a rotation, accepting login metadata changes when the tokens still match.
- CLI Router purchases with unknown settlement now say that the authorization was sent, settlement is not confirmed and the purchase must not be repeated. Rejected settlements are also identified without a successful payment claim.
- CLI Router chat and buy errors preserve
refillevidence when a missing link message is normalized. Human errors print purchase warnings, including the settled-retirement command; JSON retains the warning codes and messages. - Settled Router purchases keep blocking another payment until their receipt is in the ledger and purchased credit is established by usage under a current link with the same owner (case-insensitive) and API base or a successful balance-key chat. Repeated failed chats and manual buys recover the earlier purchase without paying again.
- Router recovery appends missing settled receipts with sender, authorization nonce, token, amount and known transaction before retiring the journal. Receipt write or retirement sync failures retain the journal and
credit_pendingwarning and allow balance-key chat; repeated recovery never appends another succeeded row for the same purchase. - Router purchases with an unconfirmed settlement return an explicit warning and keep their signed journal for chain recovery, while allowing chat on usable balance credit.
- Settled Router purchases recover after relinking to the same owner and API base. A missing link or another owner or API base keeps the payment evidence and skips refills. Stake-key chat continues under a valid current link with usable credentials; without a link, chat returns
not_linkedwithpending_purchase_unlinked. Login and logout serialize link changes with purchases using the purchase lock before credential locks. - Linux:
vapi loginno longer fails with "The agent link could not be stored consistently" on keyrings wheresecret-tool clearexits 1 without a message when it matches nothing. An exit 1 without a message for an entry the lookup did not find now counts as nothing to remove; any other exit code, a failure with a reason, and a failure to remove an entry the lookup found are still reported. Reported in #41, first fixed by @Rizal9 in #31. - A refused agent link now names the HTTP status and the server's error code, for example
The vAPI agent link request failed (HTTP 429, rate_limited).Earlier versions printed only "The vAPI agent link request failed." for a rate limit, a refusal and a proxy error alike (#30, #42). A gateway or proxy error page without a JSON body is reported the same way and no longer as "response was invalid". - Pending Router purchases survive process restarts and are recovered before any refill decision, including manual purchases with automatic refill disabled. An unresolved purchase blocks another payment; credential-only chat retries do not unlock the payment account.
- Router reservations now distinguish unsigned
prepared, journaledsigned, confirmedsettled, and legacy/unsupportedunknownattempts. Recovery under a per-wallet purchase lock clears unsigned reservations. Signed EIP-3009 attempts query the token'sauthorizationState(from, nonce)on the configured network RPC: used nonces recover the original purchase; unused nonces clear only aftervalidBeforeplus a 30-second clock margin. Live authorizations returnrefill_pendingwith a retry time. RPC errors and unsupported networks fail closed with CLI recovery guidance. - Concurrent automatic Router refills re-read balance and the durable completion marker under the purchase reservation, so stale low-balance decisions cannot buy twice after a successful first purchase, even if the configured threshold exceeds the purchased tier.
- Accounts with pending Router purchases cannot be renamed or removed, even with forced removal. The check and mutation hold the purchase lock so an in-flight reservation cannot lose its guard; errors point to
vapi router clear-pending. - Confirmed Router purchases retain their receipts when audit, key retrieval/storage, balance lookup, receipt persistence or later response processing fails. Explicit warnings report these failures; unavailable balance is
null. - First automatic Router refills retain settled receipts through console, credential and chat failures. Payment-aware guidance explains pending key recovery; the next chat request fetches the missing balance key without a second purchase.
- CLI and MCP report the charged quote amount and network from available receipt evidence. Missing network metadata no longer throws after payment or silently guesses a network.
- x402 settlement evidence is captured before post-response timing reads; throwing timing clocks cannot discard settlement or interrupt response consumption.
- Confirmed x402 payments retain their receipt and report a warning when an injected timing clock throws during final receipt construction.
- x402 receipt metadata is snapshotted and validated before payment. Failures after confirmed settlement return the receipt and warnings instead of rejecting.
- Swarm dissolution performs one shared core check before any balance lookup, pending movement resumption or transfer. CLI and MCP refresh tracked runs before that check and refuse active or unresolved Railway runs and sidecars with the same stop guidance. The core check also fails closed without a runtime adapter.
SwarmCapitalDepsadds an optionalreconcileRunsport; local run records remain the authority for the final eligibility check. Existing capital locks and movement-journal formats are unchanged.- Concurrent Railway refreshes cannot turn a stored unknown run into finished through stale ordinary cleanup, or overwrite stopped/forgotten records and their confirmation metadata. Start and stop refresh through an internal helper while already holding the member lock.
- Orphan-sidecar cleanup and CLI confirmation share the member lock. Failed cleanup cannot recreate a stale orphan after
forget-runhas retired it and retained the confirmation. - A rejected transfer releases its spend reservation only after its failed receipt row is written. If that write fails, it returns
unknown, keeps the reservation and can be resumed. A relayed transfer whose receipt row cannot be written still returnssent(with the transaction when the relay reported one) orunknownwith the nonce instead of a filesystem error.--resumewith that nonce records the result once the receipt can be written. - Token refresh checks and stores rotated tokens under a credential lock shared with login and logout, so a refresh that finishes after logout stores nothing and cannot overwrite a newer login. The new lock adds no wait for a refresh's network request.
- A wallet named
constructorcan now be created on a machine that has none. Earlier versions reported it as an existing wallet, so creating it failed with "already exists" whilevapi wallet listshowed nothing. Reported and fixed by @goranai in #48 and #49. - Setting spend caps, a ceiling or provisioning limits for a wallet named
constructorthat does not exist now says "No wallet named constructor" instead of failing with a JavaScript error, and the ceiling sweep no longer claims a window for it. Reported by @goranai in #48. - Atomic JSON writes no longer fail on Windows: the parent directory flush that Windows rejects is skipped there. Other platforms still flush it.
- On Windows, a caller waiting for a file lock keeps waiting when the released lock it is removing is deleted by another caller at the same moment, instead of failing with a permission error.
- A failure while releasing a file lock no longer replaces the result of the operation that ran under it, so a saved receipt or a completed wallet rename is not reported as failed.
- A failed Railway launch that leaves a launch marker without a sandbox id, because the id could not be saved or the marker could not be removed, now keeps its starting reservation and returns
launch_ambiguous, sovapi swarm stop <swarm> <runId> --confirm-worker-stoppedcan clear the marker after the five-minute window. Identified sidecars still usevapi swarm stop <swarm> <runId>andvapi swarm forget-run <swarm> <runId> --confirm-destroyedafter verified destruction. - Railway launches treat a sandbox id in the
railway sandbox createoutput that matches the member key, the bundle or a credential exported with the member as unreadable. The launch returnslaunch_ambiguousand the value is not written to the sidecar, the run record or arailwaycommand line. Failure text fromrailwayis scrubbed before it is shortened, and an echoedVAPI_MEMBER_BUNDLEvalue is always removed.
Internal
- Core uses current path helpers and declared Tasks entry points, shares provenance deduplication in core, breaks the HD/keystore and Solana/x402 runtime import cycles, and refreshes the deprecated wallet option's removal notice without changing behavior.
- The CLI all-networks gas-error test injects deterministic balance RPC responses during Arc setup instead of contacting live RPCs.
Install: npm i -g vapi-network@0.15.0 · npm · Changes since v0.14.0