@heyanon-arp/sdk 0.0.8 → 0.0.9
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.
- package/dist/types/agent.d.ts +64 -0
- package/dist/types/body.d.ts +9 -1
- package/dist/types/index.d.ts +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { PricingModel } from './body';
|
|
2
|
+
/**
|
|
3
|
+
* Agent accept-preferences ("PricingPolicy") — the worker-side "what I
|
|
4
|
+
* accept" constraints a registered agent publishes on its profile.
|
|
5
|
+
*
|
|
6
|
+
* These are REST agent-profile surface types (camelCase, like the
|
|
7
|
+
* `GET /v1/agents/:did` response), NOT envelope wire types (snake_case)
|
|
8
|
+
* — the agent profile API already speaks camelCase (`identityPublicKey`,
|
|
9
|
+
* `registeredAt`), so prefs follow suit.
|
|
10
|
+
*
|
|
11
|
+
* Semantics (server-enforced at `delegation offer` time):
|
|
12
|
+
* - Prefs are OPTIONAL. Absent prefs (or an absent/empty list inside
|
|
13
|
+
* them) means "no constraint" — fully backward-compatible.
|
|
14
|
+
* - The server validates an incoming offer's inline terms against the
|
|
15
|
+
* RECIPIENT's prefs and rejects mismatches with
|
|
16
|
+
* `DELEGATION_PRICING_MISMATCH` (409) before the delegation row is
|
|
17
|
+
* created. Deny-only: the server never auto-accepts on the agent's
|
|
18
|
+
* behalf.
|
|
19
|
+
* - Writes go through the signed `PATCH /v1/agents/:did` profile
|
|
20
|
+
* update and REPLACE the whole object (send `null` to clear) —
|
|
21
|
+
* same replace semantics as `tags`.
|
|
22
|
+
*/
|
|
23
|
+
export interface AcceptPrefs {
|
|
24
|
+
/**
|
|
25
|
+
* Accepted pricing models. Empty/absent ⇒ any model. Subset of the
|
|
26
|
+
* closed `PricingModel` set.
|
|
27
|
+
*/
|
|
28
|
+
pricingModels?: PricingModel[];
|
|
29
|
+
/**
|
|
30
|
+
* Accepted currencies with optional per-currency amount bounds.
|
|
31
|
+
* Empty/absent ⇒ any currency, no amount bound. An offer whose
|
|
32
|
+
* `currency.asset_id` matches no entry is rejected.
|
|
33
|
+
*/
|
|
34
|
+
currencies?: AcceptCurrency[];
|
|
35
|
+
/**
|
|
36
|
+
* Capacity cap: max delegations this agent will hold in ACTIVE
|
|
37
|
+
* states (offered / accepted / pending_lock_finalization / locked)
|
|
38
|
+
* at once. An offer that would exceed it is rejected with
|
|
39
|
+
* `DELEGATION_CAPACITY_EXCEEDED` — a TRANSIENT condition (retry
|
|
40
|
+
* later / pick another worker), unlike a pricing mismatch.
|
|
41
|
+
* `0` = closed for new offers (the "busy flag"). Absent ⇒ unlimited.
|
|
42
|
+
*/
|
|
43
|
+
maxActiveDelegations?: number;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* One accepted currency + optional amount bounds. Bounds are
|
|
47
|
+
* per-currency because a raw min/max is meaningless across assets
|
|
48
|
+
* (1 USDC ≠ 1 SOL; differing decimals).
|
|
49
|
+
*/
|
|
50
|
+
export interface AcceptCurrency {
|
|
51
|
+
/** CAIP-19 asset id — compared against the offer's `currency.asset_id`. */
|
|
52
|
+
assetId: string;
|
|
53
|
+
/**
|
|
54
|
+
* Inclusive lower bound on the offer `amount`, as a human-readable
|
|
55
|
+
* decimal string in THIS currency's units (scaled by the offer
|
|
56
|
+
* currency's `decimals` for comparison). Must be > 0 when set.
|
|
57
|
+
*/
|
|
58
|
+
minAmount?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Inclusive upper bound on the offer `amount` (same units as
|
|
61
|
+
* `minAmount`). Must be ≥ `minAmount` when both are set.
|
|
62
|
+
*/
|
|
63
|
+
maxAmount?: string;
|
|
64
|
+
}
|
package/dist/types/body.d.ts
CHANGED
|
@@ -41,6 +41,14 @@ export interface AssetIdentifier {
|
|
|
41
41
|
/** Optional UI hint — `USDC`, `SOL`. Never used for protocol logic. */
|
|
42
42
|
symbol?: string;
|
|
43
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Closed set of delegation pricing models. `flat` = the locked amount
|
|
46
|
+
* is the agreed total; `usage_based` = the locked amount is a ceiling
|
|
47
|
+
* and the final payout is computed from reported usage at receipt time.
|
|
48
|
+
* Referenced both by `DelegationContent.pricing_model` (the offer's
|
|
49
|
+
* inline term) and by agent accept-prefs (`AcceptPrefs.pricingModels`).
|
|
50
|
+
*/
|
|
51
|
+
export type PricingModel = 'flat' | 'usage_based';
|
|
44
52
|
/**
|
|
45
53
|
* Closed enum of machine-readable decline reasons used across the
|
|
46
54
|
* two decline sites in V1:
|
|
@@ -121,7 +129,7 @@ export interface DelegationContent {
|
|
|
121
129
|
amount?: string;
|
|
122
130
|
currency?: AssetIdentifier;
|
|
123
131
|
scope_summary?: string;
|
|
124
|
-
pricing_model?:
|
|
132
|
+
pricing_model?: PricingModel;
|
|
125
133
|
/** Machine-readable reason — REQUIRED when `action === 'decline'`. See `DeclineReason`. */
|
|
126
134
|
reason?: DeclineReason;
|
|
127
135
|
/** Optional free-text elaboration (e.g. "delegation offer missing required brief.goal field"). */
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export type { Sha256Hex, Ed25519Sig, Did, ProtectedBlock, Body, Attachments, CoSignature, SettlementSignatures, SettlementParty, EscrowLockAttachment, Envelope, PersistedEvent, } from './envelope';
|
|
2
|
-
export type { HandshakeBody, HandshakeContent, HandshakeResponseBody, HandshakeResponseContent, DelegationBody, DelegationContent, WorkRequestBody, WorkRequestContent, WorkResponseBody, WorkResponseContent, ReceiptBody, ReceiptContent, DisputeBody, DisputeContent, SettlementSignatureBody, SettlementSignatureContent, AnyBody, ReceiptCosignPayload, DisputeResponseCosignPayload, CosignPayload, DeclineReason, AssetIdentifier, } from './body';
|
|
2
|
+
export type { HandshakeBody, HandshakeContent, HandshakeResponseBody, HandshakeResponseContent, DelegationBody, DelegationContent, WorkRequestBody, WorkRequestContent, WorkResponseBody, WorkResponseContent, ReceiptBody, ReceiptContent, DisputeBody, DisputeContent, SettlementSignatureBody, SettlementSignatureContent, AnyBody, ReceiptCosignPayload, DisputeResponseCosignPayload, CosignPayload, DeclineReason, AssetIdentifier, PricingModel, } from './body';
|
|
3
3
|
export { DECLINE_REASONS, isDeclineReason } from './body';
|
|
4
|
+
export type { AcceptPrefs, AcceptCurrency } from './agent';
|
|
4
5
|
export type { OwnerSigningMethod, KeyLinkPayload, ScryptPasswordAttestation } from './identity';
|
|
5
6
|
export { SCRYPT_PARAMS } from './identity';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heyanon-arp/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "TypeScript SDK for the Agent Relationship Protocol — canonical JSON, Ed25519 envelope sign/verify, did:arp identity, receipt co-signatures, scrypt key attestation, chain-audit helpers.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|