Repository navigation
Description
Port the prototype's portfolio: the Overview, Strategy and Runs pages. This covers the book, limits, the strategy and its bound grant, autopilot, rebalance preview and execution with the exact-plan outcome, the confidential sweep on the overview, and the run timeline. It's the largest feature (1,636 lines), so land it in the PRs suggested below.
Port
| Prototype file | Lines | PR |
|---|---|---|
treasury-desk.tsx, overview.tsx, book.tsx, treasury-limits.tsx, and features/workspace/attention.ts (85) |
450 + 85 | 1. Overview (/) |
strategy-workflow.tsx, strategy-editor.tsx, strategy-form.ts, strategy-presentation.ts, strategy-progress.ts |
370 | 2. Strategy: save, the bound grant, autopilot on and off |
automations.tsx, plan-outcome.tsx, live-run.tsx, and shared/send-block.ts, shared/outcome-error.tsx |
415 + 34 | 3. Rebalance preview and execute, the exact-plan outcome, the send block |
timeline-run.tsx, steward.tsx |
390 | 4. Runs (/follow/run) and the hidden /steward route |
queries.ts |
11 | With the first PR that needs each read |
Status (2026-11-04): PR 1 shipped in #18 and PR 2 in #19. PR 3, PR 4's "Run now" and /steward stay on hold (see the hold comment below). MultiAgency/platform#14 is answered: owner UIs move to /apps/v1, and the owner session gets no production host. On the app route, PR 3's rebalance and executePlan need the owner's treasury-execute opt-in, or the rebalance becomes a proposal instead (the decision to make). "Run now" (autopilot/tick) and /steward (steward/propose) wait on MultiAgency/platform#17, still open, which asks whether they reach app access. The hold's other reason, app access for DAO-owned agents, has its SDK side: 0.5.0 (platform 6ba0831). PR 4's read-only run timeline can go ahead.
send-block.ts and outcome-error.tsx land here because Strategy is the first page that blocks sends. Funding and activity reuse them.
Platform calls
- Reads:
strategy/get,autopilot/get,autopilot/evidence,autopilot/log,inbox/list,held. - Actions:
strategy/save,autopilot/enable,autopilot/stop,autopilot/tick,inbox/dismiss, plus the bound grant through the owner issue'sowner/prepare. - Streams:
rebalance,executePlan,sweep,steward/propose. - Capabilities:
treasury-observe-v1,treasury-strategy-v1,treasury-plans-v1,owner-treasury-v1(sweep), andagent-observe-v1(already there).
Decide executePlan and sweep from the legs they report, not from how the stream ends. The CLI's src/outcome.ts (settle) and its README table are the reference: rejected before any leg is refused; a leg sent and then rejected, or a leg that isn't SUCCESS, is partial; a status that isn't final is unknown.
Keep these spec queries
- treasury-migration:
buttonPreview,ExecuteandExecute swaps;dialogExecute the previewed rebalance on mainnet?;- text
/Minimum received/; headingFollow the outcome,buttonStop following this plan;- text
Following the exact plan named in this page’s address.andA read time shows when records were checked, not that an operation settled., and/^Operations last read: /; regionConfidential sweep,buttonShield;/nothing new was sent|Nothing was sent/,/outcome is unknown/i, and/Earlier money actions have no proven outcome, so nothing new was sent/(the server's refusal, shown);- the send block:
New sends are blocked by 1 unresolved operation.,New sends are blocked by 1 unresolved operation. Preview is still available.,Unresolved operations block new sends. Nothing was sent., andUnresolved operations block new sends. Nothing was sent. Follow their outcomes before another action.; - a
statusrole.
- workspace:
headingStrategyandAuthorize this saved strategy;buttonEdit strategy,Authorize in wallet,Save with autopilot off,Turn onandTurn off;- labels
USDC (%),wNEAR (%),ETH (%)andRun every (minutes); dialog.
- account-switch:
/30% wNEAR \/ 70% USDC/. Check whether this query reads the Treasury build's strategy summary.
Stack tests
- Strategy saved, the bound grant signed, autopilot on and off.
- A rebalance previewed and executed: the exact-plan outcome shows each leg's status.
- A sweep of a public balance (
fundPublic, then Shield). - An outage (
setUnavailablewithagent: "portfolio"). The machine route answersforbidden, but the owner session may answer differently: assert what this route answers, bykind. - A lost swap reply (
dropSwapResponse): unknown, then unresolved. Execute and Shield aren't offered and show the send block, and Preview stays available.
Depends on
#6 (owner actions).
Rules for every port
- Where: port into
web/src/features/<feature>/, adapting each file rather than rewriting it, so the money-path behaviour and the accessible names carry over. - Platform calls: only through
web/src/platform.ts. Add what this feature needs:- reads to
READSandreads(), and a case totest/platform.test.ts; - actions through
agent(name).act, streams throughagent(name).stream, and never through a query or a retry.
- reads to
contract.json: add the capabilities this feature's procedures need (platformsrc/contract/owner-capabilities.ts).- Dependencies:
@multiagency/sdk, at the versionweb/package.jsonpins, only for the platform. Nothing imported from the platform's or the prototype's source: a type the prototype took from@near-intents-agent-api/sdkor the platform'ssrc/comes from the SDK (OwnerOutput<…>,intentsAccount), or is written locally. If the SDK lacks something, say so in this issue rather than copying it. - Outcomes: decide every result by
kind, never by message text. Afterunknown, nothing is offered again; held and unresolved states are shown. - Accessible names: keep the names below, with the same role and meaning. Record any name you change, add or remove in
web/PLATFORM-SESSION.md, in the same PR. - Tests:
pnpm --filter @treasury/web testforplatform.ts.pnpm --filter @treasury/web test:stackfor the flows below. It's Playwright on a fresh stack (the platform at the commitscripts/stack.tspins) serving this build with--frontend, attached over CDP to the stack's signed-in owner page.- Wallet steps (signing) must run in that page itself; a tab opened from it has the session but not the test wallet. See
web/PLATFORM-SESSION.md, "Driving the build on the stack".
- The page's placeholder: remove this feature's "moves here from the Treasury prototype" placeholder from
web/src/app/router.tsx.
Part of the brief "Treasury app owner UI" (owner UI on the SDK, replacing the prototype's Treasury pages); builds on the web/ shell and the session and access work. Prototype: MultiAgency/treasury-prototype web/src at d999861.
Activity
jlwaugh commentedon Nov 3, 2026
PR 3 (rebalance preview and execute), PR 4's "Run now" and the hidden
/stewardroute are on hold until we know which route the owner UI runs on in production.Some of what this issue calls is served only by the owner session (
/a/<agent>/), with no equivalent on the app route (/apps/v1, theAPP_*lists in the SDK):rebalanceandexecutePlan: on the app route only with the owner'streasury-executeopt-in; by default an app proposes swaps (proposals/create) and the owner approves them, which changes how PR 3 executes.autopilot/tick(PR 4's "Run now",timeline-run.tsx) andsteward/propose(/steward): owner session only. So areinbox/listandinbox/dismiss, which the Overview uses.The app route can't reach DAO-owned agents yet (MultiAgency/platform#13), and the Treasury app has to serve both wallet-owned and DAO-owned Treasuries. So
web/stays on the owner session for now. Whether it keeps it in production is an open question for the platform, asked in MultiAgency/platform#14. Building them now risks rework ifweb/moves to the app route.Picked up again once the platform answers. Meanwhile, PR 2 (Strategy) and #10 go ahead: they work on either route. PR 4's read-only run timeline can go ahead too, without "Run now".
owner UI: rebalance and plan outcome, runs, attention inbox, steward,…
jlwaugh commentedon Nov 5, 2026
Status: the read-only portfolio is on
/apps/v1(#118): holdings, the policy's state, what needs attention, recent activity and the autopilot's runs, on the proposals page once the agent is connected.Still open here:
treasuryscope, but a separate decision. Revoking would then have to stop autopilot first, andwatchholds while autopilot is on.treasury-execute, which this app doesn't ask for. Rebalancing on/apps/v1is a proposal the owner approves.autopilot/tick: no app scope covers them yet (platform#17).jlwaugh commentedon Nov 5, 2026
Superseded by #128: the owner session gets no production host (platform#14), so the portfolio moves to the app server. Strategy editing is #132, rebalancing is a proposal ("Propose a rebalance", #123), and runs are in #136. The overview (#18) and strategy (#19) shipped here remain the reference until #138.