@heyanon-arp/sdk 0.0.38 → 0.0.40
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/index.js +9 -1
- package/dist/index.mjs +9 -2
- package/dist/types/agent.d.ts +2 -2
- package/dist/types/delegation.d.ts +19 -4
- package/dist/types/index.d.ts +2 -2
- package/dist/types/read-model.d.ts +13 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -217,7 +217,13 @@ function verifyKeyLinkAttestation(attestation) {
|
|
|
217
217
|
return false;
|
|
218
218
|
}
|
|
219
219
|
if (identityPubkey.length !== 32) return false;
|
|
220
|
-
|
|
220
|
+
let signingBytes;
|
|
221
|
+
try {
|
|
222
|
+
signingBytes = canonicalBytes(payload);
|
|
223
|
+
} catch {
|
|
224
|
+
return false;
|
|
225
|
+
}
|
|
226
|
+
return verify2(sigBytes, signingBytes, identityPubkey);
|
|
221
227
|
}
|
|
222
228
|
function signedMessageHash(envelope) {
|
|
223
229
|
const input = envelope.attachments === void 0 ? { protected: envelope.protected, body: envelope.body } : { protected: envelope.protected, body: envelope.body, attachments: envelope.attachments };
|
|
@@ -407,6 +413,7 @@ var DELEGATION_STATES = [
|
|
|
407
413
|
"dispute_resolved"
|
|
408
414
|
];
|
|
409
415
|
var DELEGATION_ACTIVE_STATES = ["offered", "accepted", "pending_lock_finalization", "locked"];
|
|
416
|
+
var DELEGATION_INFLIGHT_STATES = [...DELEGATION_ACTIVE_STATES, "disputing"];
|
|
410
417
|
function isDelegationState(v) {
|
|
411
418
|
return typeof v === "string" && DELEGATION_STATES.includes(v);
|
|
412
419
|
}
|
|
@@ -1213,6 +1220,7 @@ exports.DECIMAL_AMOUNT_REGEX = DECIMAL_AMOUNT_REGEX;
|
|
|
1213
1220
|
exports.DECLINE_REASONS = DECLINE_REASONS;
|
|
1214
1221
|
exports.DELEGATION_ACTIONS = DELEGATION_ACTIONS;
|
|
1215
1222
|
exports.DELEGATION_ACTIVE_STATES = DELEGATION_ACTIVE_STATES;
|
|
1223
|
+
exports.DELEGATION_INFLIGHT_STATES = DELEGATION_INFLIGHT_STATES;
|
|
1216
1224
|
exports.DELEGATION_OFFER_REJECTION_CODES = DELEGATION_OFFER_REJECTION_CODES;
|
|
1217
1225
|
exports.DELEGATION_STATES = DELEGATION_STATES;
|
|
1218
1226
|
exports.DEVNET_MINTS = DEVNET_MINTS;
|
package/dist/index.mjs
CHANGED
|
@@ -192,7 +192,13 @@ function verifyKeyLinkAttestation(attestation) {
|
|
|
192
192
|
return false;
|
|
193
193
|
}
|
|
194
194
|
if (identityPubkey.length !== 32) return false;
|
|
195
|
-
|
|
195
|
+
let signingBytes;
|
|
196
|
+
try {
|
|
197
|
+
signingBytes = canonicalBytes(payload);
|
|
198
|
+
} catch {
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
return verify2(sigBytes, signingBytes, identityPubkey);
|
|
196
202
|
}
|
|
197
203
|
function signedMessageHash(envelope) {
|
|
198
204
|
const input = envelope.attachments === void 0 ? { protected: envelope.protected, body: envelope.body } : { protected: envelope.protected, body: envelope.body, attachments: envelope.attachments };
|
|
@@ -382,6 +388,7 @@ var DELEGATION_STATES = [
|
|
|
382
388
|
"dispute_resolved"
|
|
383
389
|
];
|
|
384
390
|
var DELEGATION_ACTIVE_STATES = ["offered", "accepted", "pending_lock_finalization", "locked"];
|
|
391
|
+
var DELEGATION_INFLIGHT_STATES = [...DELEGATION_ACTIVE_STATES, "disputing"];
|
|
385
392
|
function isDelegationState(v) {
|
|
386
393
|
return typeof v === "string" && DELEGATION_STATES.includes(v);
|
|
387
394
|
}
|
|
@@ -1162,4 +1169,4 @@ var CliAuthTokenErrorCodes = {
|
|
|
1162
1169
|
REQUIRED: "AUTH_TOKEN_REQUIRED"
|
|
1163
1170
|
};
|
|
1164
1171
|
|
|
1165
|
-
export { AGENT_BADGES, AGENT_NAME_REGEX, AGENT_TAG_REGEX, ASSET_DECIMALS_MAX, ASSET_DECIMALS_MIN, ASSET_SYMBOL_MAX_LEN, ASSET_SYMBOL_MIN_LEN, ASSET_WHITELIST, ASSOCIATED_TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID_BASE58, AgentBadges, BODY_TYPES, BodyTypes, CAIP19_REGEX, CLI_AUTH_TOKEN_ERROR_CODES, CLI_LOGIN_SESSION_STATES, CLI_LOGIN_SESSION_STORED_STATES, CREATE_LOCK_DISCRIMINATOR, CREATE_LOCK_NATIVE_DISCRIMINATOR, CURRENT_PROTOCOL_VERSION, CliAuthTokenErrorCodes, CliLoginSessionStates, DECIMAL_AMOUNT_REGEX, DECLINE_REASONS, DELEGATION_ACTIONS, DELEGATION_ACTIVE_STATES, DELEGATION_OFFER_REJECTION_CODES, DELEGATION_STATES, DEVNET_MINTS, DID_ARP_REGEX, DISCOVERY_SORTS, DelegationActions, DelegationOfferRejectionCodes, DelegationStates, DiscoverySorts, ED25519_SIG_PREFIX2 as ED25519_SIG_PREFIX, ESCROW_PDA_SEEDS, ESCROW_PROGRAM_ID_BASE58, ESCROW_RELEASE_METHODS, EscrowReleaseMethods, HANDSHAKE_DECISIONS, HandshakeDecisions, INBOX_BLOCK_SCOPES, InboxBlockScopes, LIVE_RELATIONSHIP_STATE_NAMES, LOCK_ACCOUNT_DISCRIMINATOR, LOCK_ACCOUNT_SIZE, LOCK_STATE_NAMES, LOCK_TERMINAL_STATES, LockStates, LockTerminalStates, MAINNET_MINTS, MAX_CLOCK_SKEW_SECONDS, MAX_ENVELOPE_TTL_SECONDS, NATIVE_SOL_MINT, NATIVE_SOL_MINT_BASE58, NO_ARG_LIFECYCLE_INSTRUCTIONS, OWNER_SIGNING_METHODS, POST_COMMIT_ERROR_CODES, POST_COMMIT_ERROR_CODE_PREFIXES, PROTOCOL_VERSIONS, Purpose, READ_MODEL_STATUSES, RECEIPT_VERDICTS, RELATIONSHIP_STATE_NAMES, RESERVED_NAMES, ReadModelStatuses, ReceiptVerdicts, RelationshipStates, SHA256_HEX_RE, SLIP44_SOLANA, SOLANA_CLUSTER_IDS, SPL_TOKEN_PROGRAM_ID, SPL_TOKEN_PROGRAM_ID_BASE58, SYSTEM_PROGRAM_ID_BASE58, TOKEN_2022_PROGRAM_ID_BASE58, WELL_KNOWN_ASSETS, WELL_KNOWN_ASSET_KEYS, WORK_LOG_STATES, WorkLogStates, base58btcDecode, base58btcEncode, buildAcceptLockIx, buildCancelLockIx, buildClaimExpiredWorkIx, buildClaimWorkPaymentIx, buildCloseDisputeIx, buildCreateLockIx, buildCreateLockIxData, buildLifecycleIxData, buildOpenDisputeIx, buildResolveDisputeIx, buildResolveDisputeIxData, buildSubmitWorkIx, bytes16ToDelegationId, canonicalBytes, canonicalJson, canonicalSha256Hex, decodeLockAccount, delegationIdToBytes16, deriveAta, deriveCollateralConfigPda, deriveConfigPda, deriveDelegationConditionHash, deriveDisputeResolutionPda, deriveEscrowPda, deriveEventAuthorityPda, deriveLockId, deriveLockPda, deriveOperatorAuthPda, deriveStakeVaultPda, expiresAt, fetchLockAccount, findAssetByAssetId, findAssetMetaByMint, findFirstChainDivergence, formatDid, generateKeyPair, getPublicKey2 as getPublicKey, instructionDiscriminator, isAgentBadge, isAssetIdentifier, isBodyType, isCliLoginSessionWireState, isDecimalAmountString, isDeclineReason, isDelegationAction, isDelegationState, isEscrowReleaseMethod, isHandshakeDecision, isPostCommitErrorCode, isReadModelStatus, isReceiptVerdict, isRelationshipState, isReservedName, isSha256Hex, isValidAgentName, isValidDid, isWhitelistedAssetId, isWorkLogState, normalizeName, parseCaip19SolanaAssetId, parseDid, pollUntil, resolveAsset, rfc3339, senderNonce, serverEventHash, sign2 as sign, signChallenge, signEnvelope, signKeyLinkAttestation, signedMessageHash, uuidV4, verify2 as verify, verifyChallenge, verifyEnvelope, verifyKeyLinkAttestation };
|
|
1172
|
+
export { AGENT_BADGES, AGENT_NAME_REGEX, AGENT_TAG_REGEX, ASSET_DECIMALS_MAX, ASSET_DECIMALS_MIN, ASSET_SYMBOL_MAX_LEN, ASSET_SYMBOL_MIN_LEN, ASSET_WHITELIST, ASSOCIATED_TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID_BASE58, AgentBadges, BODY_TYPES, BodyTypes, CAIP19_REGEX, CLI_AUTH_TOKEN_ERROR_CODES, CLI_LOGIN_SESSION_STATES, CLI_LOGIN_SESSION_STORED_STATES, CREATE_LOCK_DISCRIMINATOR, CREATE_LOCK_NATIVE_DISCRIMINATOR, CURRENT_PROTOCOL_VERSION, CliAuthTokenErrorCodes, CliLoginSessionStates, DECIMAL_AMOUNT_REGEX, DECLINE_REASONS, DELEGATION_ACTIONS, DELEGATION_ACTIVE_STATES, DELEGATION_INFLIGHT_STATES, DELEGATION_OFFER_REJECTION_CODES, DELEGATION_STATES, DEVNET_MINTS, DID_ARP_REGEX, DISCOVERY_SORTS, DelegationActions, DelegationOfferRejectionCodes, DelegationStates, DiscoverySorts, ED25519_SIG_PREFIX2 as ED25519_SIG_PREFIX, ESCROW_PDA_SEEDS, ESCROW_PROGRAM_ID_BASE58, ESCROW_RELEASE_METHODS, EscrowReleaseMethods, HANDSHAKE_DECISIONS, HandshakeDecisions, INBOX_BLOCK_SCOPES, InboxBlockScopes, LIVE_RELATIONSHIP_STATE_NAMES, LOCK_ACCOUNT_DISCRIMINATOR, LOCK_ACCOUNT_SIZE, LOCK_STATE_NAMES, LOCK_TERMINAL_STATES, LockStates, LockTerminalStates, MAINNET_MINTS, MAX_CLOCK_SKEW_SECONDS, MAX_ENVELOPE_TTL_SECONDS, NATIVE_SOL_MINT, NATIVE_SOL_MINT_BASE58, NO_ARG_LIFECYCLE_INSTRUCTIONS, OWNER_SIGNING_METHODS, POST_COMMIT_ERROR_CODES, POST_COMMIT_ERROR_CODE_PREFIXES, PROTOCOL_VERSIONS, Purpose, READ_MODEL_STATUSES, RECEIPT_VERDICTS, RELATIONSHIP_STATE_NAMES, RESERVED_NAMES, ReadModelStatuses, ReceiptVerdicts, RelationshipStates, SHA256_HEX_RE, SLIP44_SOLANA, SOLANA_CLUSTER_IDS, SPL_TOKEN_PROGRAM_ID, SPL_TOKEN_PROGRAM_ID_BASE58, SYSTEM_PROGRAM_ID_BASE58, TOKEN_2022_PROGRAM_ID_BASE58, WELL_KNOWN_ASSETS, WELL_KNOWN_ASSET_KEYS, WORK_LOG_STATES, WorkLogStates, base58btcDecode, base58btcEncode, buildAcceptLockIx, buildCancelLockIx, buildClaimExpiredWorkIx, buildClaimWorkPaymentIx, buildCloseDisputeIx, buildCreateLockIx, buildCreateLockIxData, buildLifecycleIxData, buildOpenDisputeIx, buildResolveDisputeIx, buildResolveDisputeIxData, buildSubmitWorkIx, bytes16ToDelegationId, canonicalBytes, canonicalJson, canonicalSha256Hex, decodeLockAccount, delegationIdToBytes16, deriveAta, deriveCollateralConfigPda, deriveConfigPda, deriveDelegationConditionHash, deriveDisputeResolutionPda, deriveEscrowPda, deriveEventAuthorityPda, deriveLockId, deriveLockPda, deriveOperatorAuthPda, deriveStakeVaultPda, expiresAt, fetchLockAccount, findAssetByAssetId, findAssetMetaByMint, findFirstChainDivergence, formatDid, generateKeyPair, getPublicKey2 as getPublicKey, instructionDiscriminator, isAgentBadge, isAssetIdentifier, isBodyType, isCliLoginSessionWireState, isDecimalAmountString, isDeclineReason, isDelegationAction, isDelegationState, isEscrowReleaseMethod, isHandshakeDecision, isPostCommitErrorCode, isReadModelStatus, isReceiptVerdict, isRelationshipState, isReservedName, isSha256Hex, isValidAgentName, isValidDid, isWhitelistedAssetId, isWorkLogState, normalizeName, parseCaip19SolanaAssetId, parseDid, pollUntil, resolveAsset, rfc3339, senderNonce, serverEventHash, sign2 as sign, signChallenge, signEnvelope, signKeyLinkAttestation, signedMessageHash, uuidV4, verify2 as verify, verifyChallenge, verifyEnvelope, verifyKeyLinkAttestation };
|
package/dist/types/agent.d.ts
CHANGED
|
@@ -68,8 +68,8 @@ export interface AgentRegisteredResponse {
|
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
70
|
* Public view of an ARP agent — signed reads (`GET /v1/agents/:did`)
|
|
71
|
-
* and the profile `PATCH` response. Owner-only material (raw
|
|
72
|
-
* encrypted secrets) never appears here.
|
|
71
|
+
* and the profile `PATCH` response. Owner-only material (raw key
|
|
72
|
+
* material, encrypted secrets) never appears here.
|
|
73
73
|
*/
|
|
74
74
|
export interface AgentPublic {
|
|
75
75
|
did: string;
|
|
@@ -13,12 +13,27 @@
|
|
|
13
13
|
export declare const DELEGATION_STATES: readonly ["offered", "accepted", "pending_lock_finalization", "locked", "disputing", "completed", "declined", "canceled", "failed", "refunded", "dispute_resolved"];
|
|
14
14
|
export type DelegationState = (typeof DELEGATION_STATES)[number];
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
16
|
+
* Happy-path "forward-progress" live subset — offered through locked.
|
|
17
|
+
* Used by the CLI's active-cycle view (`pickLatestLive` in `status`) to
|
|
18
|
+
* pick the delegation a relationship is currently advancing. Does NOT
|
|
19
|
+
* include `disputing` (a dispute is in-flight but off the happy path) —
|
|
20
|
+
* for "is this still occupying a slot / not yet terminal" use
|
|
21
|
+
* {@link DELEGATION_INFLIGHT_STATES}. Declared `satisfies readonly
|
|
22
|
+
* DelegationState[]` so it can never name a state outside
|
|
23
|
+
* `DELEGATION_STATES`.
|
|
20
24
|
*/
|
|
21
25
|
export declare const DELEGATION_ACTIVE_STATES: readonly ["offered", "accepted", "pending_lock_finalization", "locked"];
|
|
26
|
+
/**
|
|
27
|
+
* In-flight (non-terminal) subset — every state that is NOT a terminal
|
|
28
|
+
* outcome (completed / declined / canceled / failed / refunded /
|
|
29
|
+
* dispute_resolved). It is {@link DELEGATION_ACTIVE_STATES} plus
|
|
30
|
+
* `disputing`, derived from it so the two can never drift. This is the
|
|
31
|
+
* canonical "occupies a worker capacity slot" set: it backs the
|
|
32
|
+
* `maxActiveDelegations` capacity gate AND the worker active-tasks read
|
|
33
|
+
* (`GET /v1/agents/:did/active-delegations`), so a disputing delegation
|
|
34
|
+
* still counts against capacity and still shows up as a live task.
|
|
35
|
+
*/
|
|
36
|
+
export declare const DELEGATION_INFLIGHT_STATES: readonly ["offered", "accepted", "pending_lock_finalization", "locked", "disputing"];
|
|
22
37
|
export declare function isDelegationState(v: unknown): v is DelegationState;
|
|
23
38
|
/**
|
|
24
39
|
* Named-member accessor for the delegation FSM — lets consumers write
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { SHA256_HEX_RE, isSha256Hex, ED25519_SIG_PREFIX, PROTOCOL_VERSIONS, CURR
|
|
|
3
3
|
export type { HandshakeBody, HandshakeContent, HandshakeResponseBody, HandshakeResponseContent, HandshakeDecision, DelegationBody, DelegationContent, DelegationAction, WorkRequestBody, WorkRequestContent, WorkResponseBody, WorkResponseContent, ReceiptBody, ReceiptContent, ReceiptVerdict, AnyBody, BodyType, DeclineReason, AssetIdentifier, } from './body';
|
|
4
4
|
export { DECLINE_REASONS, isDeclineReason, HANDSHAKE_DECISIONS, HandshakeDecisions, isHandshakeDecision, DELEGATION_ACTIONS, DelegationActions, isDelegationAction, RECEIPT_VERDICTS, ReceiptVerdicts, isReceiptVerdict, BODY_TYPES, BodyTypes, isBodyType, } from './body';
|
|
5
5
|
export type { DelegationState } from './delegation';
|
|
6
|
-
export { DELEGATION_STATES, DELEGATION_ACTIVE_STATES, DelegationStates, isDelegationState } from './delegation';
|
|
6
|
+
export { DELEGATION_STATES, DELEGATION_ACTIVE_STATES, DELEGATION_INFLIGHT_STATES, DelegationStates, isDelegationState } from './delegation';
|
|
7
7
|
export type { RelationshipState } from './relationship';
|
|
8
8
|
export { RELATIONSHIP_STATE_NAMES, LIVE_RELATIONSHIP_STATE_NAMES, RelationshipStates, isRelationshipState } from './relationship';
|
|
9
9
|
export type { WorkLogState } from './work-log';
|
|
@@ -16,7 +16,7 @@ export type { InboxBlockScope, InboxBlock, BlockInboxBody } from './inbox';
|
|
|
16
16
|
export { INBOX_BLOCK_SCOPES, InboxBlockScopes } from './inbox';
|
|
17
17
|
export type { CliSessionCreated, CliTokenIssued, CliWhoami, MyAgentSummary, CliLoginSessionStoredState, CliLoginSessionWireState, } from './cli-auth';
|
|
18
18
|
export { CLI_LOGIN_SESSION_STORED_STATES, CLI_LOGIN_SESSION_STATES, CliLoginSessionStates, isCliLoginSessionWireState } from './cli-auth';
|
|
19
|
-
export type { AssetIdentifierWire, DelegationPublic, DisputeResolutionPublic, ReceiptPublic, RelationshipPublic, WorkLogPublic, EventPublic, IngestResult, SenderSequenceResponse, InboxUnblockResult, ListRelationshipsQuery, ListInboxQuery, ListEventsQuery, ListDelegationsQuery, ListWorkLogsQuery, ListReceiptsQuery, } from './read-model';
|
|
19
|
+
export type { AssetIdentifierWire, DelegationPublic, DisputeResolutionPublic, ReceiptPublic, RelationshipPublic, WorkLogPublic, EventPublic, IngestResult, SenderSequenceResponse, InboxUnblockResult, ListRelationshipsQuery, ListInboxQuery, ListEventsQuery, ListDelegationsQuery, ListActiveDelegationsQuery, ListWorkLogsQuery, ListReceiptsQuery, } from './read-model';
|
|
20
20
|
export type { AcceptPrefs, AcceptCurrency, AgentRegisteredResponse, AgentPublic, UpdateAgentBody, RegisterAgentRequest, ChallengeResponse, ReputationScores, ReputationCounters, AgentReputation, AssetVolume, AgentSettlementVolume, AgentStatsRates, AgentStats, } from './agent';
|
|
21
21
|
export { AGENT_TAG_REGEX, AGENT_NAME_REGEX, RESERVED_NAMES, isReservedName, isValidAgentName, normalizeName } from './agent';
|
|
22
22
|
export type { OwnerSigningMethod, KeyLinkPayload, Ed25519KeyLinkAttestation } from './identity';
|
|
@@ -202,6 +202,19 @@ export interface ListDelegationsQuery {
|
|
|
202
202
|
after?: string;
|
|
203
203
|
limit?: number;
|
|
204
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* Query for `GET /v1/agents/:did/active-delegations` — the signer's own
|
|
207
|
+
* in-flight delegations as recipient (worker tasks). The result set is
|
|
208
|
+
* always scoped to {@link DELEGATION_INFLIGHT_STATES}; `state` narrows it
|
|
209
|
+
* to ONE in-flight state and is rejected if it names a terminal one.
|
|
210
|
+
*/
|
|
211
|
+
export interface ListActiveDelegationsQuery {
|
|
212
|
+
/** Narrow to one in-flight state (must be a member of DELEGATION_INFLIGHT_STATES). */
|
|
213
|
+
state?: DelegationState;
|
|
214
|
+
/** Opaque per-row cursor — the previous page's last `id`. */
|
|
215
|
+
after?: string;
|
|
216
|
+
limit?: number;
|
|
217
|
+
}
|
|
205
218
|
/** Query for `GET /v1/relationships/:id/work`. */
|
|
206
219
|
export interface ListWorkLogsQuery {
|
|
207
220
|
state?: WorkLogState;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heyanon-arp/sdk",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "TypeScript SDK for the Agent Relationship Protocol — canonical JSON, Ed25519 envelope sign/verify, did:arp identity,
|
|
3
|
+
"version": "0.0.40",
|
|
4
|
+
"description": "TypeScript SDK for the Agent Relationship Protocol — canonical JSON, Ed25519 envelope sign/verify, did:arp identity, Ed25519 owner key-link attestation, chain-audit helpers.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"arp",
|