@heyanon-arp/sdk 0.0.39 → 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 CHANGED
@@ -413,6 +413,7 @@ var DELEGATION_STATES = [
413
413
  "dispute_resolved"
414
414
  ];
415
415
  var DELEGATION_ACTIVE_STATES = ["offered", "accepted", "pending_lock_finalization", "locked"];
416
+ var DELEGATION_INFLIGHT_STATES = [...DELEGATION_ACTIVE_STATES, "disputing"];
416
417
  function isDelegationState(v) {
417
418
  return typeof v === "string" && DELEGATION_STATES.includes(v);
418
419
  }
@@ -1219,6 +1220,7 @@ exports.DECIMAL_AMOUNT_REGEX = DECIMAL_AMOUNT_REGEX;
1219
1220
  exports.DECLINE_REASONS = DECLINE_REASONS;
1220
1221
  exports.DELEGATION_ACTIONS = DELEGATION_ACTIONS;
1221
1222
  exports.DELEGATION_ACTIVE_STATES = DELEGATION_ACTIVE_STATES;
1223
+ exports.DELEGATION_INFLIGHT_STATES = DELEGATION_INFLIGHT_STATES;
1222
1224
  exports.DELEGATION_OFFER_REJECTION_CODES = DELEGATION_OFFER_REJECTION_CODES;
1223
1225
  exports.DELEGATION_STATES = DELEGATION_STATES;
1224
1226
  exports.DEVNET_MINTS = DEVNET_MINTS;
package/dist/index.mjs CHANGED
@@ -388,6 +388,7 @@ var DELEGATION_STATES = [
388
388
  "dispute_resolved"
389
389
  ];
390
390
  var DELEGATION_ACTIVE_STATES = ["offered", "accepted", "pending_lock_finalization", "locked"];
391
+ var DELEGATION_INFLIGHT_STATES = [...DELEGATION_ACTIVE_STATES, "disputing"];
391
392
  function isDelegationState(v) {
392
393
  return typeof v === "string" && DELEGATION_STATES.includes(v);
393
394
  }
@@ -1168,4 +1169,4 @@ var CliAuthTokenErrorCodes = {
1168
1169
  REQUIRED: "AUTH_TOKEN_REQUIRED"
1169
1170
  };
1170
1171
 
1171
- 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 };
@@ -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
- * Non-terminal "the cycle is still live" subset — offered through
17
- * locked. Used for worker capacity counting and the CLI's active-cycle
18
- * view. Declared `satisfies readonly DelegationState[]` so it can never
19
- * name a state that isn't in `DELEGATION_STATES`.
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
@@ -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,6 +1,6 @@
1
1
  {
2
2
  "name": "@heyanon-arp/sdk",
3
- "version": "0.0.39",
3
+ "version": "0.0.40",
4
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": [