Skip to content

Owner UI: portfolio (overview, strategy, rebalance, plan outcome, runs) #7

Closed as not planned

Description

@jlwaugh

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's owner/prepare.
  • Streams: rebalance, executePlan, sweep, steward/propose.
  • Capabilities: treasury-observe-v1, treasury-strategy-v1, treasury-plans-v1, owner-treasury-v1 (sweep), and agent-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:
    • button Preview, Execute and Execute swaps;
    • dialog Execute the previewed rebalance on mainnet?;
    • text /Minimum received/;
    • heading Follow the outcome, button Stop following this plan;
    • text Following the exact plan named in this page’s address. and A read time shows when records were checked, not that an operation settled., and /^Operations last read: /;
    • region Confidential sweep, button Shield;
    • /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., and Unresolved operations block new sends. Nothing was sent. Follow their outcomes before another action.;
    • a status role.
  • workspace:
    • heading Strategy and Authorize this saved strategy;
    • button Edit strategy, Authorize in wallet, Save with autopilot off, Turn on and Turn off;
    • labels USDC (%), wNEAR (%), ETH (%) and Run 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 (setUnavailable with agent: "portfolio"). The machine route answers forbidden, but the owner session may answer differently: assert what this route answers, by kind.
  • 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 READS and reads(), and a case to test/platform.test.ts;
    • actions through agent(name).act, streams through agent(name).stream, and never through a query or a retry.
  • contract.json: add the capabilities this feature's procedures need (platform src/contract/owner-capabilities.ts).
  • Dependencies: @multiagency/sdk, at the version web/package.json pins, 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/sdk or the platform's src/ 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. After unknown, 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 test for platform.ts.
    • pnpm --filter @treasury/web test:stack for the flows below. It's Playwright on a fresh stack (the platform at the commit scripts/stack.ts pins) 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

  1. jlwaugh commented on Nov 3, 2026

    @jlwaugh
    ContributorAuthor

    PR 3 (rebalance preview and execute), PR 4's "Run now" and the hidden /steward route 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, the APP_* lists in the SDK):

    • rebalance and executePlan: on the app route only with the owner's treasury-execute opt-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) and steward/propose (/steward): owner session only. So are inbox/list and inbox/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 if web/ 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".

  2. jlwaugh commented on Nov 5, 2026

    @jlwaugh
    ContributorAuthor

    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:

    • Strategy save and autopilot on/off: in the app's treasury scope, but a separate decision. Revoking would then have to stop autopilot first, and watch holds while autopilot is on.
    • Rebalance, plan outcome and run checks: these need treasury-execute, which this app doesn't ask for. Rebalancing on /apps/v1 is a proposal the owner approves.
    • The steward, the attention inbox and autopilot/tick: no app scope covers them yet (platform#17).
  3. jlwaugh commented on Nov 5, 2026

    @jlwaugh
    ContributorAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions