@agenticprimitives/treasury-service-agent

中文文档
0.0.0-alpha.33发布于 2026/10/26MITTypeScriptES Module近 30 天下载 4029

Intent-native DeFi Treasury Agent (spec 284): a domain composition over service-agent — skill catalog + profiles + treasury authority-scope/receipt helpers, evolving toward intent resolution, solver brokering, and DAG execution. Catalog = definitions + pl

原始使用文档
文档目录4 节
  1. What's inside
  2. Gating
  3. Example
  4. What lives elsewhere

@agenticprimitives/treasury-service-agent

Status: experimental (spec 284 PR-A — relocated from packages/treasury).

The intent-native DeFi Treasury Agent: an intent compiler + DeFi skill fabric + solver broker + settlement coordinator (see spec 284). A domain composition over @agenticprimitives/service-agent, not a generic packages/* primitive.

PR-A ships the catalog/profiles baseline — the wallet-operation surface as vendor-neutral skill definitions, plans, and profiles (this is the payments profile of the larger agent). Intent resolution, solver brokering, DAG execution, autonomous strategies, and risk land in later phases. Catalog = definitions + plans only — no provider implementations. Concrete providers (EVM transfer/sign, swap/perp/prediction venues, market data, RPC) live in external repos (ADR-0037) and register into the host; the demo apps ship fakes.

What's inside

  • TREASURY_CAPABILITIES — the logical capability vocabulary skills require (account.read, transfer.execute, signing.sign, swap.execute, …).
  • Catalog — ~26 skills across service / network / account / market-data / signing / transaction / transfer / swap / perp / prediction / delegation / entitlement. Each declares an effect (read|sign|spend|trade|admin), a default exposure, required capabilities, and a compile() → plan.
  • Profiles — readonly, payments, markets, administration, full.
  • TreasuryAuthorityScope + treasuryScopeToCaveatTerms — the neutral input to the connect-treasury ceremony; the ceremony maps the abstract caveat terms onto real delegation caveats.
  • summarizeTreasuryReceipt — projects the generic ExecutionReceipt into a treasury audit summary.

Gating

skill kindexposuregates
service / network / market-datapublicnone
account / quote / positions / simulate / entitlement.checkauthenticatedentitlement
transfer / swap.execute / perp / prediction.betauthenticatedentitlement ∩ delegation ∩ policy (+ ledger reserve/finalize)
signing / transaction.send / delegation.* / entitlement.issue/consumeprivateentitlement ∩ delegation ∩ policy

Gates are fail-closed and monotonic — the first denial throws and nothing further runs. Asserting a skill proves the host can run it; per-call authority is still decided fresh at invoke.

Example

import { ServiceAgent, createPrimitiveRegistry } from '@agenticprimitives/service-agent';
import { paymentsProfile, ASSET_TYPE } from '@agenticprimitives/treasury';

const registry = createPrimitiveRegistry();
registry.register(myTransferProvider);  // advertises 'transfer.execute' (external / fake)
// …register account/network/market-data providers…

const agent = new ServiceAgent({
  descriptor: { id: treasurySaAddress, name: 'Treasury', version: '1.0.0' },
  primitives: registry,
  entitlements, delegations, policies, ledger,   // injected: tool-policy / delegation / entitlements / ledger
});
agent.defineProfile(paymentsProfile);
await agent.assert();   // asserts the skills whose providers are present

const receipt = await agent.invoke({
  skillId: 'treasury.transfer.native',
  input: { account: treasurySaAddress, network: 'eip155:84532', to, asset: { type: ASSET_TYPE.native }, amount: '100' },
  idempotencyKey: 'transfer-0001',
});

What lives elsewhere

  • The framework (registry, plan runner, ServiceAgent, assertion) → @agenticprimitives/service-agent.
  • Providers → external repos (ADR-0037); fakes → the demo apps (PR3) + this package's tests.
  • The connect-treasury ceremony + a treasury UI → demo-sso-next / demo-web-payment (PR4).

版本与发布记录

@agenticprimitives/treasury-service-agent 共发布 29 个版本,首次发布于 2026/07/14;过去 12 个月发布了 29 个版本。

版本发布日期距今
0.0.0-alpha.33latest2026/10/2612 天前
0.0.0-alpha.322026/10/2612 天前
0.0.0-alpha.312026/10/1721 天前
0.0.0-alpha.302026/10/1722 天前
0.0.0-alpha.292026/10/1622 天前
0.0.0-alpha.282026/10/1622 天前

关于 @agenticprimitives/treasury-service-agent 的常见问题

@agenticprimitives/treasury-service-agent 是什么?

Intent-native DeFi Treasury Agent (spec 284): a domain composition over service-agent — skill catalog + profiles + treasury authority-scope/receipt helpers, evolving toward intent resolution, solver brokering, and DAG execution. Catalog = definitions + pl

如何安装 @agenticprimitives/treasury-service-agent?

在项目目录运行 npm install @agenticprimitives/treasury-service-agent,或使用 pnpm add / yarn add / bun add。

@agenticprimitives/treasury-service-agent 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@agenticprimitives/treasury-service-agent 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@agenticprimitives/treasury-service-agent 可以商用吗?

@agenticprimitives/treasury-service-agent 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@agenticprimitives/treasury-service-agent 的下载量有多少?

根据 npm 官方下载统计,@agenticprimitives/treasury-service-agent 在 2026/10/05 – 2026/11/03 这 30 天内被下载 4,029 次,日均约 134 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@agenticprimitives/treasury-service-agent 还在维护吗?

最新版本 0.0.0-alpha.33 发布于 2026/10/26(12 天前);至今共发布 29 个版本,其中过去 12 个月发布了 29 个;首次发布于 2026/07/14。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。