@agenticprimitives/treasury-service-agent 0.0.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +70 -0
  3. package/dist/benchmarks/benchmark.d.ts +28 -0
  4. package/dist/benchmarks/benchmark.d.ts.map +1 -0
  5. package/dist/benchmarks/benchmark.js +26 -0
  6. package/dist/benchmarks/benchmark.js.map +1 -0
  7. package/dist/benchmarks/suite.d.ts +11 -0
  8. package/dist/benchmarks/suite.d.ts.map +1 -0
  9. package/dist/benchmarks/suite.js +166 -0
  10. package/dist/benchmarks/suite.js.map +1 -0
  11. package/dist/capabilities.d.ts +68 -0
  12. package/dist/capabilities.d.ts.map +1 -0
  13. package/dist/capabilities.js +68 -0
  14. package/dist/capabilities.js.map +1 -0
  15. package/dist/catalog-defi.d.ts +29 -0
  16. package/dist/catalog-defi.d.ts.map +1 -0
  17. package/dist/catalog-defi.js +79 -0
  18. package/dist/catalog-defi.js.map +1 -0
  19. package/dist/catalog.d.ts +86 -0
  20. package/dist/catalog.d.ts.map +1 -0
  21. package/dist/catalog.js +199 -0
  22. package/dist/catalog.js.map +1 -0
  23. package/dist/dispatch/delegation-authority.d.ts +58 -0
  24. package/dist/dispatch/delegation-authority.d.ts.map +1 -0
  25. package/dist/dispatch/delegation-authority.js +62 -0
  26. package/dist/dispatch/delegation-authority.js.map +1 -0
  27. package/dist/grant.d.ts +34 -0
  28. package/dist/grant.d.ts.map +1 -0
  29. package/dist/grant.js +40 -0
  30. package/dist/grant.js.map +1 -0
  31. package/dist/index.d.ts +45 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +37 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/intents/intent-types.d.ts +65 -0
  36. package/dist/intents/intent-types.d.ts.map +1 -0
  37. package/dist/intents/intent-types.js +44 -0
  38. package/dist/intents/intent-types.js.map +1 -0
  39. package/dist/intents/resolved-treasury-order.d.ts +38 -0
  40. package/dist/intents/resolved-treasury-order.d.ts.map +1 -0
  41. package/dist/intents/resolved-treasury-order.js +2 -0
  42. package/dist/intents/resolved-treasury-order.js.map +1 -0
  43. package/dist/intents/treasury-intent-resolver.d.ts +30 -0
  44. package/dist/intents/treasury-intent-resolver.d.ts.map +1 -0
  45. package/dist/intents/treasury-intent-resolver.js +113 -0
  46. package/dist/intents/treasury-intent-resolver.js.map +1 -0
  47. package/dist/payments/order-to-mandate.d.ts +31 -0
  48. package/dist/payments/order-to-mandate.d.ts.map +1 -0
  49. package/dist/payments/order-to-mandate.js +46 -0
  50. package/dist/payments/order-to-mandate.js.map +1 -0
  51. package/dist/plans.d.ts +27 -0
  52. package/dist/plans.d.ts.map +1 -0
  53. package/dist/plans.js +47 -0
  54. package/dist/plans.js.map +1 -0
  55. package/dist/plugins/defi-plugin.d.ts +54 -0
  56. package/dist/plugins/defi-plugin.d.ts.map +1 -0
  57. package/dist/plugins/defi-plugin.js +30 -0
  58. package/dist/plugins/defi-plugin.js.map +1 -0
  59. package/dist/profiles.d.ts +92 -0
  60. package/dist/profiles.d.ts.map +1 -0
  61. package/dist/profiles.js +60 -0
  62. package/dist/profiles.js.map +1 -0
  63. package/dist/receipt.d.ts +16 -0
  64. package/dist/receipt.d.ts.map +1 -0
  65. package/dist/receipt.js +16 -0
  66. package/dist/receipt.js.map +1 -0
  67. package/dist/risk/risk-policy.d.ts +44 -0
  68. package/dist/risk/risk-policy.d.ts.map +1 -0
  69. package/dist/risk/risk-policy.js +50 -0
  70. package/dist/risk/risk-policy.js.map +1 -0
  71. package/dist/schemas.d.ts +68 -0
  72. package/dist/schemas.d.ts.map +1 -0
  73. package/dist/schemas.js +24 -0
  74. package/dist/schemas.js.map +1 -0
  75. package/dist/solvers/broker.d.ts +24 -0
  76. package/dist/solvers/broker.d.ts.map +1 -0
  77. package/dist/solvers/broker.js +43 -0
  78. package/dist/solvers/broker.js.map +1 -0
  79. package/dist/solvers/digest.d.ts +5 -0
  80. package/dist/solvers/digest.d.ts.map +1 -0
  81. package/dist/solvers/digest.js +27 -0
  82. package/dist/solvers/digest.js.map +1 -0
  83. package/dist/solvers/plan-validation.d.ts +40 -0
  84. package/dist/solvers/plan-validation.d.ts.map +1 -0
  85. package/dist/solvers/plan-validation.js +66 -0
  86. package/dist/solvers/plan-validation.js.map +1 -0
  87. package/dist/solvers/quote-ranking.d.ts +47 -0
  88. package/dist/solvers/quote-ranking.d.ts.map +1 -0
  89. package/dist/solvers/quote-ranking.js +48 -0
  90. package/dist/solvers/quote-ranking.js.map +1 -0
  91. package/dist/solvers/solver-port.d.ts +104 -0
  92. package/dist/solvers/solver-port.d.ts.map +1 -0
  93. package/dist/solvers/solver-port.js +2 -0
  94. package/dist/solvers/solver-port.js.map +1 -0
  95. package/dist/strategy/strategy-controller.d.ts +36 -0
  96. package/dist/strategy/strategy-controller.d.ts.map +1 -0
  97. package/dist/strategy/strategy-controller.js +66 -0
  98. package/dist/strategy/strategy-controller.js.map +1 -0
  99. package/dist/strategy/strategy-definition.d.ts +55 -0
  100. package/dist/strategy/strategy-definition.d.ts.map +1 -0
  101. package/dist/strategy/strategy-definition.js +39 -0
  102. package/dist/strategy/strategy-definition.js.map +1 -0
  103. package/dist/strategy/triggers.d.ts +27 -0
  104. package/dist/strategy/triggers.d.ts.map +1 -0
  105. package/dist/strategy/triggers.js +22 -0
  106. package/dist/strategy/triggers.js.map +1 -0
  107. package/package.json +54 -0
package/dist/plans.js ADDED
@@ -0,0 +1,47 @@
1
+ // Plan templates (spec 283). Every treasury skill compiles into one of these shapes so the gating order is
2
+ // uniform and auditable. The authority gates (`.authorize`/`.guard`) call the host-injected
3
+ // entitlement/delegation/policy evaluators; `.step` calls a registered provider (or the built-in
4
+ // `ledger.reserve`/`ledger.finalize`). No arbitrary execution — a skill is exactly its plan.
5
+ import { primitivePlan, ref } from '@agenticprimitives/service-agent';
6
+ import { TREASURY_CAPABILITIES } from './capabilities.js';
7
+ /** Public read: a single provider step, output passthrough. No authority gates (public data). */
8
+ export function readPlan(id, capability, args) {
9
+ return primitivePlan(id).step('result', capability, args).output({ result: ref('result') });
10
+ }
11
+ /** Authenticated read: caller-entitlement gate, then the read. (Reading a managed account's state.) */
12
+ export function authedReadPlan(id, capability, args, action, resource) {
13
+ return primitivePlan(id)
14
+ .authorize('entitled', 'entitlement', action, { resource, input: args })
15
+ .step('result', capability, args)
16
+ .output({ result: ref('result') });
17
+ }
18
+ /** Signing: full gating (entitlement ∩ delegation ∩ policy), then a provider signature. No ledger. */
19
+ export function signPlan(id, args, action, resource) {
20
+ return primitivePlan(id)
21
+ .authorize('entitled', 'entitlement', action, { resource, input: args })
22
+ .authorize('delegated', 'delegation', action, { resource, input: args })
23
+ .guard('policy', action, { resource, input: args })
24
+ .step('signed', TREASURY_CAPABILITIES.sign, args)
25
+ .output({ result: ref('signed') });
26
+ }
27
+ /** Value-moving skill: full gating → ledger.reserve → provider execute → ledger.finalize → output. */
28
+ export function spendPlan(opts) {
29
+ return primitivePlan(opts.id)
30
+ .authorize('entitled', 'entitlement', opts.action, { resource: opts.resource, input: opts.stepArgs })
31
+ .authorize('delegated', 'delegation', opts.action, { resource: opts.resource, input: opts.stepArgs })
32
+ .guard('policy', opts.action, { resource: opts.resource, input: opts.stepArgs })
33
+ .step('reserve', 'ledger.reserve', opts.ledger)
34
+ .step('exec', opts.capability, opts.stepArgs)
35
+ .step('final', 'ledger.finalize', { reservationId: ref('reserve', 'reservationId'), settlement: ref('exec') })
36
+ .output({ result: ref('exec'), journal: ref('final', 'journalId') });
37
+ }
38
+ /** Admin/manage skill (delegation mint/revoke, entitlement issue/consume): full gating, no ledger. */
39
+ export function adminPlan(id, capability, args, action, resource) {
40
+ return primitivePlan(id)
41
+ .authorize('entitled', 'entitlement', action, { resource, input: args })
42
+ .authorize('delegated', 'delegation', action, { resource, input: args })
43
+ .guard('policy', action, { resource, input: args })
44
+ .step('result', capability, args)
45
+ .output({ result: ref('result') });
46
+ }
47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G,CAAC,OAAO,EAAE,WAAW,CAAC,EAAE,CAAC,CAAC;AACzE,CAAC;AAED,sGAAsG;AACtG,MAAM,UAAU,SAAS,CAAC,EAAU,EAAE,UAAkB,EAAE,IAA6B,EAAE,MAAc,EAAE,QAA4B;IACnI,OAAO,aAAa,CAAC,EAAE,CAAC;SACrB,SAAS,CAAC,UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;SACvE,SAAS,CAAC,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;SACvE,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;SAClD,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,IAAI,CAAC;SAChC,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AACvC,CAAC"}
@@ -0,0 +1,54 @@
1
+ import type { PlanKind, Primitive } from '@agenticprimitives/service-agent';
2
+ /** A provider is a service-agent `Primitive`. */
3
+ export type PrimitiveProvider = Primitive;
4
+ export interface DeFiPluginManifest {
5
+ pluginId: string;
6
+ version: string;
7
+ /** Capability ids this plugin's providers advertise (the authoritative allowlist). */
8
+ capabilities: string[];
9
+ chainNamespaces: string[];
10
+ networks: string[];
11
+ planKinds: PlanKind[];
12
+ supportsQuote: boolean;
13
+ supportsSimulation: boolean;
14
+ supportsCancellation: boolean;
15
+ supportsRecovery: boolean;
16
+ /** Identifier of the audit scope this plugin was reviewed under. */
17
+ auditBoundary: string;
18
+ }
19
+ /** A plugin's self-report that a capability is live right now (feeds ActiveSkillAssertion health). */
20
+ export interface PrimitiveCapabilityAssertion {
21
+ capability: string;
22
+ healthy: boolean;
23
+ reason?: string;
24
+ }
25
+ export interface AssertionContext {
26
+ nowSeconds: number;
27
+ }
28
+ export interface PluginHealth {
29
+ healthy: boolean;
30
+ reasons?: string[];
31
+ }
32
+ export interface DeFiPrimitivePlugin {
33
+ manifest(): DeFiPluginManifest;
34
+ assertions(ctx: AssertionContext): Promise<PrimitiveCapabilityAssertion[]>;
35
+ providers(): PrimitiveProvider[];
36
+ health(): Promise<PluginHealth>;
37
+ }
38
+ export declare class PluginManifestError extends Error {
39
+ }
40
+ /** Structural manifest validation (fail-closed). */
41
+ export declare function validatePluginManifest(m: DeFiPluginManifest): void;
42
+ /** The narrowed sink a plugin install is allowed to touch — provider registration ONLY (least privilege). */
43
+ export interface ProviderSink {
44
+ register(provider: PrimitiveProvider): void;
45
+ }
46
+ export interface InstalledPlugin {
47
+ pluginId: string;
48
+ capabilities: string[];
49
+ providerIds: string[];
50
+ }
51
+ /** Install a plugin's providers into a registration sink under least privilege. Fail-closed: a provider
52
+ * advertising a capability the manifest didn't declare is rejected (no capability smuggling). */
53
+ export declare function installPlugin(sink: ProviderSink, plugin: DeFiPrimitivePlugin): InstalledPlugin;
54
+ //# sourceMappingURL=defi-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defi-plugin.d.ts","sourceRoot":"","sources":["../../src/plugins/defi-plugin.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE5E,iDAAiD;AACjD,MAAM,MAAM,iBAAiB,GAAG,SAAS,CAAC;AAE1C,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,sFAAsF;IACtF,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;IACvB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,oEAAoE;IACpE,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,sGAAsG;AACtG,MAAM,WAAW,4BAA4B;IAAG,UAAU,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE;AACvG,MAAM,WAAW,gBAAgB;IAAG,UAAU,EAAE,MAAM,CAAA;CAAE;AACxD,MAAM,WAAW,YAAY;IAAG,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE;AAEtE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,IAAI,kBAAkB,CAAC;IAC/B,UAAU,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,4BAA4B,EAAE,CAAC,CAAC;IAC3E,SAAS,IAAI,iBAAiB,EAAE,CAAC;IACjC,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC;CACjC;AAED,qBAAa,mBAAoB,SAAQ,KAAK;CAAG;AAEjD,oDAAoD;AACpD,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAIlE;AAED,6GAA6G;AAC7G,MAAM,WAAW,YAAY;IAAG,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAA;CAAE;AAE7E,MAAM,WAAW,eAAe;IAAG,QAAQ,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,EAAE,CAAA;CAAE;AAEpG;kGACkG;AAClG,wBAAgB,aAAa,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,mBAAmB,GAAG,eAAe,CAe9F"}
@@ -0,0 +1,30 @@
1
+ export class PluginManifestError extends Error {
2
+ }
3
+ /** Structural manifest validation (fail-closed). */
4
+ export function validatePluginManifest(m) {
5
+ if (!m.pluginId || !m.version)
6
+ throw new PluginManifestError('plugin manifest needs pluginId + version');
7
+ if (!m.capabilities?.length)
8
+ throw new PluginManifestError(`plugin ${m.pluginId} declares no capabilities`);
9
+ if (!m.auditBoundary)
10
+ throw new PluginManifestError(`plugin ${m.pluginId} needs an auditBoundary`);
11
+ }
12
+ /** Install a plugin's providers into a registration sink under least privilege. Fail-closed: a provider
13
+ * advertising a capability the manifest didn't declare is rejected (no capability smuggling). */
14
+ export function installPlugin(sink, plugin) {
15
+ const m = plugin.manifest();
16
+ validatePluginManifest(m);
17
+ const declared = new Set(m.capabilities);
18
+ const providerIds = [];
19
+ for (const provider of plugin.providers()) {
20
+ for (const cap of provider.capabilities) {
21
+ if (!declared.has(cap.id)) {
22
+ throw new PluginManifestError(`plugin ${m.pluginId} provider ${provider.primitiveId} advertises undeclared capability ${cap.id}`);
23
+ }
24
+ }
25
+ sink.register(provider);
26
+ providerIds.push(provider.primitiveId);
27
+ }
28
+ return { pluginId: m.pluginId, capabilities: m.capabilities, providerIds };
29
+ }
30
+ //# sourceMappingURL=defi-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defi-plugin.js","sourceRoot":"","sources":["../../src/plugins/defi-plugin.ts"],"names":[],"mappings":"AAwCA,MAAM,OAAO,mBAAoB,SAAQ,KAAK;CAAG;AAEjD,oDAAoD;AACpD,MAAM,UAAU,sBAAsB,CAAC,CAAqB;IAC1D,IAAI,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC,OAAO;QAAE,MAAM,IAAI,mBAAmB,CAAC,0CAA0C,CAAC,CAAC;IACzG,IAAI,CAAC,CAAC,CAAC,YAAY,EAAE,MAAM;QAAE,MAAM,IAAI,mBAAmB,CAAC,UAAU,CAAC,CAAC,QAAQ,2BAA2B,CAAC,CAAC;IAC5G,IAAI,CAAC,CAAC,CAAC,aAAa;QAAE,MAAM,IAAI,mBAAmB,CAAC,UAAU,CAAC,CAAC,QAAQ,yBAAyB,CAAC,CAAC;AACrG,CAAC;AAOD;kGACkG;AAClG,MAAM,UAAU,aAAa,CAAC,IAAkB,EAAE,MAA2B;IAC3E,MAAM,CAAC,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC5B,sBAAsB,CAAC,CAAC,CAAC,CAAC;IAC1B,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;IACzC,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,SAAS,EAAE,EAAE,CAAC;QAC1C,KAAK,MAAM,GAAG,IAAI,QAAQ,CAAC,YAAY,EAAE,CAAC;YACxC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;gBAC1B,MAAM,IAAI,mBAAmB,CAAC,UAAU,CAAC,CAAC,QAAQ,aAAa,QAAQ,CAAC,WAAW,qCAAqC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;YACpI,CAAC;QACH,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACxB,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAC,YAAY,EAAE,WAAW,EAAE,CAAC;AAC7E,CAAC"}
@@ -0,0 +1,92 @@
1
+ /** Read-only: everything that observes, nothing that moves value or signs. */
2
+ export declare const readonlyProfile: {
3
+ id: string;
4
+ definitions: import("@agenticprimitives/service-agent").AnySkillDefinition[];
5
+ skillIds: string[];
6
+ };
7
+ /** Payments: read-only + native/token transfers (the real x402/transfer path). */
8
+ export declare const paymentsProfile: {
9
+ id: string;
10
+ definitions: import("@agenticprimitives/service-agent").AnySkillDefinition[];
11
+ skillIds: string[];
12
+ };
13
+ /** Markets: payments + swap/perp/prediction trade execution. */
14
+ export declare const marketsProfile: {
15
+ id: string;
16
+ definitions: import("@agenticprimitives/service-agent").AnySkillDefinition[];
17
+ skillIds: string[];
18
+ };
19
+ /** Administration: signing, raw-tx send, delegation + entitlement management (all `private`). */
20
+ export declare const administrationProfile: {
21
+ id: string;
22
+ definitions: import("@agenticprimitives/service-agent").AnySkillDefinition[];
23
+ skillIds: string[];
24
+ };
25
+ /** Portfolio: read the book + rebalance toward targets. */
26
+ export declare const portfolioProfile: {
27
+ id: string;
28
+ definitions: import("@agenticprimitives/service-agent").AnySkillDefinition[];
29
+ skillIds: string[];
30
+ };
31
+ /** Yield: lending + staking + liquidity + vaults (supply-side DeFi). */
32
+ export declare const yieldProfile: {
33
+ id: string;
34
+ definitions: import("@agenticprimitives/service-agent").AnySkillDefinition[];
35
+ skillIds: string[];
36
+ };
37
+ /** Cross-chain: bridge quote / execute / status / recover. */
38
+ export declare const crossChainProfile: {
39
+ id: string;
40
+ definitions: import("@agenticprimitives/service-agent").AnySkillDefinition[];
41
+ skillIds: string[];
42
+ };
43
+ /** Full: the entire catalog (wallet baseline + DeFi families). */
44
+ export declare const fullProfile: {
45
+ id: string;
46
+ definitions: import("@agenticprimitives/service-agent").AnySkillDefinition[];
47
+ skillIds: string[];
48
+ };
49
+ export declare const TREASURY_PROFILES: {
50
+ readonly readonly: {
51
+ id: string;
52
+ definitions: import("@agenticprimitives/service-agent").AnySkillDefinition[];
53
+ skillIds: string[];
54
+ };
55
+ readonly payments: {
56
+ id: string;
57
+ definitions: import("@agenticprimitives/service-agent").AnySkillDefinition[];
58
+ skillIds: string[];
59
+ };
60
+ readonly markets: {
61
+ id: string;
62
+ definitions: import("@agenticprimitives/service-agent").AnySkillDefinition[];
63
+ skillIds: string[];
64
+ };
65
+ readonly administration: {
66
+ id: string;
67
+ definitions: import("@agenticprimitives/service-agent").AnySkillDefinition[];
68
+ skillIds: string[];
69
+ };
70
+ readonly portfolio: {
71
+ id: string;
72
+ definitions: import("@agenticprimitives/service-agent").AnySkillDefinition[];
73
+ skillIds: string[];
74
+ };
75
+ readonly yield: {
76
+ id: string;
77
+ definitions: import("@agenticprimitives/service-agent").AnySkillDefinition[];
78
+ skillIds: string[];
79
+ };
80
+ readonly crossChain: {
81
+ id: string;
82
+ definitions: import("@agenticprimitives/service-agent").AnySkillDefinition[];
83
+ skillIds: string[];
84
+ };
85
+ readonly full: {
86
+ id: string;
87
+ definitions: import("@agenticprimitives/service-agent").AnySkillDefinition[];
88
+ skillIds: string[];
89
+ };
90
+ };
91
+ export type TreasuryProfileId = keyof typeof TREASURY_PROFILES;
92
+ //# sourceMappingURL=profiles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../src/profiles.ts"],"names":[],"mappings":"AA8BA,8EAA8E;AAC9E,eAAO,MAAM,eAAe;;;;CAM1B,CAAC;AAEH,kFAAkF;AAClF,eAAO,MAAM,eAAe;;;;CAG1B,CAAC;AAEH,gEAAgE;AAChE,eAAO,MAAM,cAAc;;;;CAGzB,CAAC;AAEH,iGAAiG;AACjG,eAAO,MAAM,qBAAqB;;;;CAIhC,CAAC;AAEH,2DAA2D;AAC3D,eAAO,MAAM,gBAAgB;;;;CAE3B,CAAC;AAEH,wEAAwE;AACxE,eAAO,MAAM,YAAY;;;;CAKvB,CAAC;AAEH,8DAA8D;AAC9D,eAAO,MAAM,iBAAiB;;;;CAE5B,CAAC;AAEH,kEAAkE;AAClE,eAAO,MAAM,WAAW;;;;CAA2E,CAAC;AAEpG,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CASpB,CAAC;AACX,MAAM,MAAM,iBAAiB,GAAG,MAAM,OAAO,iBAAiB,CAAC"}
@@ -0,0 +1,60 @@
1
+ // Treasury profiles (spec 283): named bundles of catalog skills a deployment can assert as a set. A host
2
+ // defines a profile, then asserts only the skills whose required provider capabilities are present — so a
3
+ // `full` profile on a host with just the payments providers degrades to the payments skills (the rest land
4
+ // in the assertion report's `unavailable`). Profiles are inclusion sets, not authority — entitlement and
5
+ // delegation are still decided per call.
6
+ import { defineProfile } from '@agenticprimitives/service-agent';
7
+ import { ALL_TREASURY_SKILLS, accountActivity, accountBalance, accountList, delegationGrant, delegationRevoke, entitlementCheck, entitlementConsume, entitlementIssue, marketDataOhlcv, marketDataPrice, networkList, networkStatus, perpClose, perpOpen, perpPositions, predictionBet, predictionMarkets, serviceInfo, signMessage, signTypedData, swapExecute, swapQuote, transferNative, transferToken, txSend, txSimulate, } from './catalog.js';
8
+ import { DEFI_SKILLS, bridgeExecute, bridgeQuote, bridgeStatus, lendingBorrow, lendingPosition, lendingRepay, lendingSupply, lendingWithdraw, liquidityAdd, liquidityCollectFees, liquidityPosition, liquidityRemove, portfolioExposure, portfolioRebalance, portfolioSnapshot, portfolioValue, stakingClaim, stakingPosition, stakingStake, stakingUnstake, vaultDeposit, vaultMigrate, vaultPosition, vaultWithdraw, } from './catalog-defi.js';
9
+ /** Read-only: everything that observes, nothing that moves value or signs. */
10
+ export const readonlyProfile = defineProfile('treasury.readonly', [
11
+ serviceInfo, networkList, networkStatus,
12
+ accountList, accountBalance, accountActivity,
13
+ marketDataPrice, marketDataOhlcv,
14
+ swapQuote, perpPositions, predictionMarkets, entitlementCheck,
15
+ txSimulate,
16
+ ]);
17
+ /** Payments: read-only + native/token transfers (the real x402/transfer path). */
18
+ export const paymentsProfile = defineProfile('treasury.payments', [
19
+ ...readonlyProfile.definitions,
20
+ transferNative, transferToken,
21
+ ]);
22
+ /** Markets: payments + swap/perp/prediction trade execution. */
23
+ export const marketsProfile = defineProfile('treasury.markets', [
24
+ ...paymentsProfile.definitions,
25
+ swapExecute, perpOpen, perpClose, predictionBet,
26
+ ]);
27
+ /** Administration: signing, raw-tx send, delegation + entitlement management (all `private`). */
28
+ export const administrationProfile = defineProfile('treasury.administration', [
29
+ signMessage, signTypedData, txSend,
30
+ delegationGrant, delegationRevoke,
31
+ entitlementIssue, entitlementConsume,
32
+ ]);
33
+ /** Portfolio: read the book + rebalance toward targets. */
34
+ export const portfolioProfile = defineProfile('treasury.portfolio', [
35
+ portfolioSnapshot, portfolioValue, portfolioExposure, portfolioRebalance,
36
+ ]);
37
+ /** Yield: lending + staking + liquidity + vaults (supply-side DeFi). */
38
+ export const yieldProfile = defineProfile('treasury.yield', [
39
+ lendingPosition, lendingSupply, lendingRepay, lendingWithdraw, lendingBorrow,
40
+ stakingPosition, stakingStake, stakingUnstake, stakingClaim,
41
+ liquidityPosition, liquidityAdd, liquidityRemove, liquidityCollectFees,
42
+ vaultPosition, vaultDeposit, vaultWithdraw, vaultMigrate,
43
+ ]);
44
+ /** Cross-chain: bridge quote / execute / status / recover. */
45
+ export const crossChainProfile = defineProfile('treasury.cross-chain', [
46
+ bridgeQuote, bridgeStatus, bridgeExecute,
47
+ ]);
48
+ /** Full: the entire catalog (wallet baseline + DeFi families). */
49
+ export const fullProfile = defineProfile('treasury.full', [...ALL_TREASURY_SKILLS, ...DEFI_SKILLS]);
50
+ export const TREASURY_PROFILES = {
51
+ readonly: readonlyProfile,
52
+ payments: paymentsProfile,
53
+ markets: marketsProfile,
54
+ administration: administrationProfile,
55
+ portfolio: portfolioProfile,
56
+ yield: yieldProfile,
57
+ crossChain: crossChainProfile,
58
+ full: fullProfile,
59
+ };
60
+ //# sourceMappingURL=profiles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profiles.js","sourceRoot":"","sources":["../src/profiles.ts"],"names":[],"mappings":"AAAA,yGAAyG;AACzG,0GAA0G;AAC1G,2GAA2G;AAC3G,yGAAyG;AACzG,yCAAyC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EACL,mBAAmB,EACnB,eAAe,EAAE,cAAc,EAAE,WAAW,EAC5C,eAAe,EAAE,gBAAgB,EACjC,gBAAgB,EAAE,kBAAkB,EAAE,gBAAgB,EACtD,eAAe,EAAE,eAAe,EAChC,WAAW,EAAE,aAAa,EAC1B,SAAS,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AE,MAAM;IAClC,eAAe,EAAE,gBAAgB;IACjC,gBAAgB,EAAE,kBAAkB;CACrC,CAAC,CAAC;AAEH,2DAA2D;AAC3D,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAAC,oBAAoB,EAAE;IAClE,iBAAiB,EAAE,cAAc,EAAE,iBAAiB,EAAE,kBAAkB;CACzE,CAAC,CAAC;AAEH,wEAAwE;AACxE,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAC,gBAAgB,EAAE;IAC1D,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,eAAe,EAAE,aAAa;IAC5E,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY;IAC3D,iBAAiB,EAAE,YAAY,EAAE,eAAe,EAAE,oBAAoB;IACtE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY;CACzD,CAAC,CAAC;AAEH,8DAA8D;AAC9D,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAC,sBAAsB,EAAE;IACrE,WAAW,EAAE,YAAY,EAAE,aAAa;CACzC,CAAC,CAAC;AAEH,kEAAkE;AAClE,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC,eAAe,EAAE,CAAC,GAAG,mBAAmB,EAAE,GAAG,WAAW,CAAC,CAAC,CAAC;AAEpG,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,QAAQ,EAAE,eAAe;IACzB,QAAQ,EAAE,eAAe;IACzB,OAAO,EAAE,cAAc;IACvB,cAAc,EAAE,qBAAqB;IACrC,SAAS,EAAE,gBAAgB;IAC3B,KAAK,EAAE,YAAY;IACnB,UAAU,EAAE,iBAAiB;IAC7B,IAAI,EAAE,WAAW;CACT,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { ExecutionReceipt } from '@agenticprimitives/service-agent';
2
+ export interface TreasurySummary {
3
+ receiptId: string;
4
+ agent: string;
5
+ skill: string;
6
+ status: ExecutionReceipt['status'];
7
+ /** Did every authority gate allow? (false on any deny or if a gate is missing.) */
8
+ authorized: boolean;
9
+ /** Provider capability bindings exercised (e.g. "fake-transfer:transfer.execute"). */
10
+ providers: string[];
11
+ /** A canonical audit event name: treasury.<skill-tail>.<outcome>. */
12
+ auditEvent: string;
13
+ reason?: string;
14
+ }
15
+ export declare function summarizeTreasuryReceipt(receipt: ExecutionReceipt): TreasurySummary;
16
+ //# sourceMappingURL=receipt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"receipt.d.ts","sourceRoot":"","sources":["../src/receipt.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEzE,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACnC,mFAAmF;IACnF,UAAU,EAAE,OAAO,CAAC;IACpB,sFAAsF;IACtF,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,qEAAqE;IACrE,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,gBAAgB,GAAG,eAAe,CAcnF"}
@@ -0,0 +1,16 @@
1
+ export function summarizeTreasuryReceipt(receipt) {
2
+ const authorized = receipt.authority.length === 0 ? true : receipt.authority.every((a) => a.allow);
3
+ const tail = receipt.skill.id.replace(/^treasury\./, '');
4
+ const outcome = receipt.status === 'completed' ? 'completed' : 'failed';
5
+ return {
6
+ receiptId: receipt.receiptId,
7
+ agent: receipt.agentId,
8
+ skill: receipt.skill.id,
9
+ status: receipt.status,
10
+ authorized,
11
+ providers: receipt.execution.primitiveBindings,
12
+ auditEvent: `treasury.${tail}.${outcome}`,
13
+ reason: receipt.reason,
14
+ };
15
+ }
16
+ //# sourceMappingURL=receipt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"receipt.js","sourceRoot":"","sources":["../src/receipt.ts"],"names":[],"mappings":"AAmBA,MAAM,UAAU,wBAAwB,CAAC,OAAyB;IAChE,MAAM,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACnG,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;IACzD,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;IACxE,OAAO;QACL,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,KAAK,EAAE,OAAO,CAAC,OAAO;QACtB,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE;QACvB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,UAAU;QACV,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,iBAAiB;QAC9C,UAAU,EAAE,YAAY,IAAI,IAAI,OAAO,EAAE;QACzC,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,44 @@
1
+ export interface RiskPolicy {
2
+ /** Per-protocol exposure ceiling, basis points of total value. */
3
+ maxProtocolExposureBps?: number;
4
+ /** Aggregate exposure ceiling, bps. */
5
+ maxTotalExposureBps?: number;
6
+ /** Max allowed leverage (e.g. 3 = 3x). */
7
+ maxLeverage?: number;
8
+ /** Minimum idle reserve (decimal string, smallest unit). */
9
+ minLiquidityReserve?: string;
10
+ /** Max acceptable oracle age (seconds). */
11
+ maxOracleStalenessSeconds?: number;
12
+ /** Minimum buffer above a liquidation threshold, bps. */
13
+ minLiquidationBufferBps?: number;
14
+ }
15
+ export interface ExposureState {
16
+ totalValue: string;
17
+ perProtocolBps: Record<string, number>;
18
+ totalExposureBps: number;
19
+ leverage: number;
20
+ liquidityReserve: string;
21
+ oracleAgeSeconds: number;
22
+ liquidationBufferBps: number;
23
+ }
24
+ export interface RiskBreach {
25
+ code: string;
26
+ detail: string;
27
+ }
28
+ export interface RiskVerdict {
29
+ allowed: boolean;
30
+ breaches: RiskBreach[];
31
+ }
32
+ /** Evaluate an exposure snapshot against a policy. allowed === (no breaches). Fail-closed: a policy field
33
+ * the snapshot can't satisfy is a breach, not a pass. */
34
+ export declare function evaluateRisk(state: ExposureState, policy: RiskPolicy): RiskVerdict;
35
+ /** Build an ExposureState from per-protocol exposure values + scalars (helper for hosts/tests). */
36
+ export declare function aggregateExposure(args: {
37
+ totalValue: string;
38
+ perProtocol: Record<string, number>;
39
+ leverage?: number;
40
+ liquidityReserve?: string;
41
+ oracleAgeSeconds?: number;
42
+ liquidationBufferBps?: number;
43
+ }): ExposureState;
44
+ //# sourceMappingURL=risk-policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"risk-policy.d.ts","sourceRoot":"","sources":["../../src/risk/risk-policy.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,UAAU;IACzB,kEAAkE;IAClE,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,uCAAuC;IACvC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4DAA4D;IAC5D,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,2CAA2C;IAC3C,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,yDAAyD;IACzD,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,UAAU;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE;AAC5D,MAAM,WAAW,WAAW;IAAG,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,UAAU,EAAE,CAAA;CAAE;AAEzE;0DAC0D;AAC1D,wBAAgB,YAAY,CAAC,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,GAAG,WAAW,CA4BlF;AAED,mGAAmG;AACnG,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,GAAG,aAAa,CAWhB"}
@@ -0,0 +1,50 @@
1
+ // Risk engine (spec 284 PR-F). Deterministic, fail-closed evaluation of an exposure snapshot against a
2
+ // risk policy — the substrate the strategy controller and ActiveSkillAssertion health checks consume.
3
+ // Pure: no chain reads (the host feeds an ExposureState), no ambient time/randomness.
4
+ /** Evaluate an exposure snapshot against a policy. allowed === (no breaches). Fail-closed: a policy field
5
+ * the snapshot can't satisfy is a breach, not a pass. */
6
+ export function evaluateRisk(state, policy) {
7
+ const breaches = [];
8
+ // NEW-TSA-5: a non-finite (NaN / Infinity) snapshot value makes a `>` / `<` comparison silently false, so a
9
+ // reserve / leverage / exposure breach would pass unnoticed (fall-open). Fail-closed: when a policy field is
10
+ // set and the snapshot value it checks is non-finite, that IS a breach — we can't prove compliance.
11
+ const nf = (n) => !Number.isFinite(n);
12
+ if (policy.maxProtocolExposureBps !== undefined) {
13
+ for (const [protocol, bps] of Object.entries(state.perProtocolBps)) {
14
+ if (nf(bps) || bps > policy.maxProtocolExposureBps)
15
+ breaches.push({ code: 'protocol-exposure-exceeded', detail: `${protocol}: ${bps}bps > ${policy.maxProtocolExposureBps}bps` });
16
+ }
17
+ }
18
+ if (policy.maxTotalExposureBps !== undefined && (nf(state.totalExposureBps) || state.totalExposureBps > policy.maxTotalExposureBps)) {
19
+ breaches.push({ code: 'total-exposure-exceeded', detail: `${state.totalExposureBps}bps > ${policy.maxTotalExposureBps}bps` });
20
+ }
21
+ if (policy.maxLeverage !== undefined && (nf(state.leverage) || state.leverage > policy.maxLeverage)) {
22
+ breaches.push({ code: 'leverage-exceeded', detail: `${state.leverage} > ${policy.maxLeverage}` });
23
+ }
24
+ if (policy.minLiquidityReserve !== undefined) {
25
+ const reserve = Number(state.liquidityReserve);
26
+ if (nf(reserve) || reserve < Number(policy.minLiquidityReserve))
27
+ breaches.push({ code: 'liquidity-reserve-below-min', detail: `${state.liquidityReserve} < ${policy.minLiquidityReserve}` });
28
+ }
29
+ if (policy.maxOracleStalenessSeconds !== undefined && (nf(state.oracleAgeSeconds) || state.oracleAgeSeconds > policy.maxOracleStalenessSeconds)) {
30
+ breaches.push({ code: 'oracle-stale', detail: `${state.oracleAgeSeconds}s > ${policy.maxOracleStalenessSeconds}s` });
31
+ }
32
+ if (policy.minLiquidationBufferBps !== undefined && (nf(state.liquidationBufferBps) || state.liquidationBufferBps < policy.minLiquidationBufferBps)) {
33
+ breaches.push({ code: 'liquidation-buffer-too-thin', detail: `${state.liquidationBufferBps}bps < ${policy.minLiquidationBufferBps}bps` });
34
+ }
35
+ return { allowed: breaches.length === 0, breaches };
36
+ }
37
+ /** Build an ExposureState from per-protocol exposure values + scalars (helper for hosts/tests). */
38
+ export function aggregateExposure(args) {
39
+ const totalExposureBps = Object.values(args.perProtocol).reduce((a, b) => a + b, 0);
40
+ return {
41
+ totalValue: args.totalValue,
42
+ perProtocolBps: args.perProtocol,
43
+ totalExposureBps,
44
+ leverage: args.leverage ?? 1,
45
+ liquidityReserve: args.liquidityReserve ?? '0',
46
+ oracleAgeSeconds: args.oracleAgeSeconds ?? 0,
47
+ liquidationBufferBps: args.liquidationBufferBps ?? 10_000,
48
+ };
49
+ }
50
+ //# sourceMappingURL=risk-policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"risk-policy.js","sourceRoot":"","sources":["../../src/risk/risk-policy.ts"],"names":[],"mappings":"AAAA,uGAAuG;AACvG,sGAAsG;AACtG,sFAAsF;AA8BtF;0DAC0D;AAC1D,MAAM,UAAU,YAAY,CAAC,KAAoB,EAAE,MAAkB;IACnE,MAAM,QAAQ,GAAiB,EAAE,CAAC;IAClC,4GAA4G;IAC5G,6GAA6G;IAC7G,oGAAoG;IACpG,MAAM,EAAE,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC9C,IAAI,MAAM,CAAC,sBAAsB,KAAK,SAAS,EAAE,CAAC;QAChD,KAAK,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE,CAAC;YACnE,IAAI,EAAE,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,MAAM,CAAC,sBAAsB;gBAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,4BAA4B,EAAE,MAAM,EAAE,GAAG,QAAQ,KAAK,GAAG,SAAS,MAAM,CAAC,sBAAsB,KAAK,EAAE,CAAC,CAAC;QACpL,CAAC;IACH,CAAC;IACD,IAAI,MAAM,CAAC,mBAAmB,KAAK,SAAS,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,IAAI,KAAK,CAAC,gBAAgB,GAAG,MAAM,CAA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AAI,MAAM,CAAC,uBAAuB,KAAK,SAAS,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,oBAAoB,CAAC,IAAI,KAAK,CAAC,oBAAoB,GAAG,MAAM,CAAC,uBAAuB,CAAC,EAAE,CAAC;QACpJ,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,6BAA6B,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,oBAAoB,SAAS,MAAM,CAAC,uBAAuB,KAAK,EAAE,CAAC,CAAC;IAC5I,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;AACtD,CAAC;AAED,mGAAmG;AACnG,MAAM,UAAU,iBAAiB,CAAC,IAOjC;IACC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IACpF,OAAO;QACL,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,cAAc,EAAE,IAAI,CAAC,WAAW;QAChC,gBAAgB;QAChB,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,CAAC;QAC5B,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,IAAI,GAAG;QAC9C,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,IAAI,CAAC;QAC5C,oBAAoB,EAAE,IAAI,CAAC,oBAAoB,IAAI,MAAM;KAC1D,CAAC;AACJ,CAAC"}
@@ -0,0 +1,68 @@
1
+ import type { Schema } from '@agenticprimitives/service-agent';
2
+ import type { AssetType } from './capabilities.js';
3
+ /** A CAIP-2-ish network id, e.g. "eip155:84532". Opaque to the catalog. */
4
+ export type NetworkId = string;
5
+ /** An account the treasury can act on — the SA address (canonical id) or a provider-scoped account id. */
6
+ export type AccountRef = string;
7
+ export interface AssetRef {
8
+ type: AssetType;
9
+ /** Token contract address for erc20; omitted/"native" for the native asset. */
10
+ address?: string;
11
+ /** Optional human symbol for display only — never authoritative. */
12
+ symbol?: string;
13
+ }
14
+ export interface AssetAmount {
15
+ asset: AssetRef;
16
+ /** Decimal string, smallest unit. */
17
+ amount: string;
18
+ }
19
+ export interface AccountQuery {
20
+ account: AccountRef;
21
+ network?: NetworkId;
22
+ }
23
+ export interface BalanceResult {
24
+ account: AccountRef;
25
+ balances: AssetAmount[];
26
+ }
27
+ export interface TransferInput {
28
+ account: AccountRef;
29
+ network: NetworkId;
30
+ to: string;
31
+ asset: AssetRef;
32
+ amount: string;
33
+ memo?: string;
34
+ }
35
+ export interface TransferResult {
36
+ txHash: string;
37
+ to: string;
38
+ amount: string;
39
+ }
40
+ export interface SignInput {
41
+ account: AccountRef;
42
+ payload: string;
43
+ kind: 'message' | 'typed-data';
44
+ }
45
+ export interface SignResult {
46
+ signature: string;
47
+ }
48
+ export interface SwapQuoteInput {
49
+ network: NetworkId;
50
+ sell: AssetRef;
51
+ buy: AssetRef;
52
+ amount: string;
53
+ }
54
+ export interface SwapExecuteInput extends SwapQuoteInput {
55
+ account: AccountRef;
56
+ maxSlippageBps?: number;
57
+ }
58
+ export interface RawTxInput {
59
+ account: AccountRef;
60
+ network: NetworkId;
61
+ to: string;
62
+ value?: string;
63
+ data?: string;
64
+ }
65
+ /** Minimal structural validator. Checks presence of required keys + that each is a non-empty string when
66
+ * declared `string`. Returns the value typed as T (no coercion). Throws on the first missing/empty field. */
67
+ export declare function objectSchema<T>(name: string, required: Record<string, 'string' | 'number' | 'object'>): Schema<T>;
68
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEn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AAM,EAAE,MAAM,CAAA;CAAE;AACrG,MAAM,WAAW,gBAAiB,SAAQ,cAAc;IAAG,OAAO,EAAE,UAAU,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE;AAEzG,MAAM,WAAW,UAAU;IAAG,OAAO,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,SAAS,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE;AAElH;8GAC8G;AAC9G,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAejH"}
@@ -0,0 +1,24 @@
1
+ /** Minimal structural validator. Checks presence of required keys + that each is a non-empty string when
2
+ * declared `string`. Returns the value typed as T (no coercion). Throws on the first missing/empty field. */
3
+ export function objectSchema(name, required) {
4
+ return {
5
+ parse(value) {
6
+ if (!value || typeof value !== 'object')
7
+ throw new Error(`[treasury] ${name}: expected an object`);
8
+ const v = value;
9
+ for (const [key, kind] of Object.entries(required)) {
10
+ const got = v[key];
11
+ if (got === undefined || got === null)
12
+ throw new Error(`[treasury] ${name}: missing "${key}"`);
13
+ if (kind === 'string' && (typeof got !== 'string' || got.length === 0))
14
+ throw new Error(`[treasury] ${name}: "${key}" must be a non-empty string`);
15
+ if (kind === 'number' && typeof got !== 'number')
16
+ throw new Error(`[treasury] ${name}: "${key}" must be a number`);
17
+ if (kind === 'object' && typeof got !== 'object')
18
+ throw new Error(`[treasury] ${name}: "${key}" must be an object`);
19
+ }
20
+ return value;
21
+ },
22
+ };
23
+ }
24
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AA8CA;8GAC8G;AAC9G,MAAM,UAAU,YAAY,CAAI,IAAY,EAAE,QAAwD;IACpG,OAAO;QACL,KAAK,CAAC,KAAc;YAClB,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;gBAAE,MAAM,IAAI,KAAK,CAAC,cAAc,IAAI,sBAAsB,CAAC,CAAC;YACnG,MAAM,CAAC,GAAG,KAAgC,CAAC;YAC3C,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACnD,MAAM,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;gBACnB,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI;oBAAE,MAAM,IAAI,KAAK,CAAC,cAAc,IAAI,cAAc,GAAG,GAAG,CAAC,CAAC;gBAC/F,IAAI,IAAI,KAAK,QAAQ,IAAI,CAAC,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,CAAC;oBAAE,MAAM,IAAI,KAAK,CAAC,cAAc,IAAI,MAAM,GAAG,8BAA8B,CAAC,CAAC;gBACnJ,IAAI,IAAI,KAAK,QAAQ,IAAI,OAAO,GAAG,KAAK,QAAQ;oBAAE,MAAM,IAAI,KAAK,CAAC,cAAc,IAAI,MAAM,GAAG,oBAAoB,CAAC,CAAC;gBACnH,IAAI,IAAI,KAAK,QAAQ,IAAI,OAAO,GAAG,KAAK,QAAQ;oBAAE,MAAM,IAAI,KAAK,CAAC,cAAc,IAAI,MAAM,GAAG,qBAAqB,CAAC,CAAC;YACtH,CAAC;YACD,OAAO,KAAU,CAAC;QACpB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type { ResolvedTreasuryOrder } from '../intents/resolved-treasury-order.js';
2
+ import type { SolverContext, TreasuryPlanQuote, TreasurySolver } from './solver-port.js';
3
+ import { type RankWeights, type RankedQuote, type SelectionReceipt } from './quote-ranking.js';
4
+ export interface SolveOptions {
5
+ weights?: RankWeights;
6
+ /** When true (default), each quote is validated and invalid ones are excluded from ranking. */
7
+ validate?: boolean;
8
+ }
9
+ export interface SolveResult {
10
+ quotes: TreasuryPlanQuote[];
11
+ rejected: {
12
+ quoteId: string;
13
+ solverId: string;
14
+ violations: string[];
15
+ }[];
16
+ ranked: RankedQuote[];
17
+ selection: SelectionReceipt;
18
+ }
19
+ export declare class SolverBroker {
20
+ private solvers;
21
+ register(solver: TreasurySolver): this;
22
+ solve(order: ResolvedTreasuryOrder, ctx: SolverContext, opts?: SolveOptions): Promise<SolveResult>;
23
+ }
24
+ //# sourceMappingURL=broker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"broker.d.ts","sourceRoot":"","sources":["../../src/solvers/broker.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AACnF,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACzF,OAAO,EAA2D,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGxJ,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,+FAA+F;IAC/F,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,iBAAiB,EAAE,CAAC;IAC5B,QAAQ,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,EAAE,CAAA;KAAE,EAAE,CAAC;IACxE,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,SAAS,EAAE,gBAAgB,CAAC;CAC7B;AAED,qBAAa,YAAY;IACvB,OAAO,CAAC,OAAO,CAAwB;IAEvC,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI;IAKhC,KAAK,CAAC,KAAK,EAAE,qBAAqB,EAAE,GAAG,EAAE,aAAa,EAAE,IAAI,GAAE,YAAiB,GAAG,OAAO,CAAC,WAAW,CAAC;CA+B7G"}