Skip to content

feat(server): Account v3 wire fields + AccountStore.upsert/list/syncGovernance receive ResolveContext #456

@bokelley

Description

@bokelley

Parent: #452

Two paired changes that together unlock principal-keyed account governance.

(a) Account v3 wire fields

Extend the SDK's Account shape to carry:

  • setup (pending_approval lifecycle): {url?, message, expires_at?}
  • governance_agents
  • account_scope: operator | brand | operator_brand | agent
  • payment_terms
  • credit_limit
  • rate_card

to_wire_account() projection strips billing_entity.bank (write-only on emit).

Already partially present; finish.

(b) AccountStore.upsert(ctx) / list(ctx) / sync_governance(ctx)

Pass ResolveContext (auth_info, tool_name, agent) to upsert and list per JS account-store-upsert-list-ctx.md.

Promote sync_governance to typed AccountStore.sync_governance(entries, ctx) with framework-side credential write-only-strip on emit (per JS account-store-sync-governance.md). Specifically: governance_agents[i].authentication.credentials is stripped on the way out.

Why this matters

Security-relevant: enables principal-keyed gates for BILLING_NOT_PERMITTED_FOR_AGENT per #449's spec. Pre-this, no way to scope accounts.list per-principal — implementations either over-disclose or reject.

It's also the dependency #5 (create_tenant_store) needs to bake a per-entry tenant gate into the framework.

JS source

.changeset/account-store-upsert-list-ctx.md and .changeset/account-store-sync-governance.md (6.7).

Acceptance criteria

  • Account shape extensions with Pydantic models for setup, governance_agents, account_scope, payment_terms, credit_limit, rate_card.
  • to_wire_account() strips billing_entity.bank.
  • AccountStore.upsert, AccountStore.list, AccountStore.sync_governance all receive ResolveContext as a typed parameter.
  • Credential-strip on sync_governance emit covered by tests.
  • Tests for each new wire field round-tripping through validation.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions