@heyanon-arp/sdk 0.0.36 → 0.0.37

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
@@ -502,6 +502,16 @@ var DiscoverySorts = {
502
502
  RECENT: "recent",
503
503
  CREATED: "created"
504
504
  };
505
+ var AGENT_BADGES = ["proven", "limited", "new", "flagged"];
506
+ var AgentBadges = {
507
+ PROVEN: "proven",
508
+ LIMITED: "limited",
509
+ NEW: "new",
510
+ FLAGGED: "flagged"
511
+ };
512
+ function isAgentBadge(v) {
513
+ return typeof v === "string" && AGENT_BADGES.includes(v);
514
+ }
505
515
 
506
516
  // src/types/inbox.ts
507
517
  var INBOX_BLOCK_SCOPES = ["account", "did"];
@@ -1212,6 +1222,7 @@ var CliAuthTokenErrorCodes = {
1212
1222
  REQUIRED: "AUTH_TOKEN_REQUIRED"
1213
1223
  };
1214
1224
 
1225
+ exports.AGENT_BADGES = AGENT_BADGES;
1215
1226
  exports.AGENT_NAME_REGEX = AGENT_NAME_REGEX;
1216
1227
  exports.AGENT_TAG_REGEX = AGENT_TAG_REGEX;
1217
1228
  exports.ASSET_DECIMALS_MAX = ASSET_DECIMALS_MAX;
@@ -1221,6 +1232,7 @@ exports.ASSET_SYMBOL_MIN_LEN = ASSET_SYMBOL_MIN_LEN;
1221
1232
  exports.ASSET_WHITELIST = ASSET_WHITELIST;
1222
1233
  exports.ASSOCIATED_TOKEN_PROGRAM_ID = ASSOCIATED_TOKEN_PROGRAM_ID;
1223
1234
  exports.ASSOCIATED_TOKEN_PROGRAM_ID_BASE58 = ASSOCIATED_TOKEN_PROGRAM_ID_BASE58;
1235
+ exports.AgentBadges = AgentBadges;
1224
1236
  exports.BODY_TYPES = BODY_TYPES;
1225
1237
  exports.BodyTypes = BodyTypes;
1226
1238
  exports.CAIP19_REGEX = CAIP19_REGEX;
@@ -1332,6 +1344,7 @@ exports.formatDid = formatDid;
1332
1344
  exports.generateKeyPair = generateKeyPair;
1333
1345
  exports.getPublicKey = getPublicKey2;
1334
1346
  exports.instructionDiscriminator = instructionDiscriminator;
1347
+ exports.isAgentBadge = isAgentBadge;
1335
1348
  exports.isAssetIdentifier = isAssetIdentifier;
1336
1349
  exports.isBodyType = isBodyType;
1337
1350
  exports.isCliLoginSessionWireState = isCliLoginSessionWireState;
package/dist/index.mjs CHANGED
@@ -477,6 +477,16 @@ var DiscoverySorts = {
477
477
  RECENT: "recent",
478
478
  CREATED: "created"
479
479
  };
480
+ var AGENT_BADGES = ["proven", "limited", "new", "flagged"];
481
+ var AgentBadges = {
482
+ PROVEN: "proven",
483
+ LIMITED: "limited",
484
+ NEW: "new",
485
+ FLAGGED: "flagged"
486
+ };
487
+ function isAgentBadge(v) {
488
+ return typeof v === "string" && AGENT_BADGES.includes(v);
489
+ }
480
490
 
481
491
  // src/types/inbox.ts
482
492
  var INBOX_BLOCK_SCOPES = ["account", "did"];
@@ -1187,4 +1197,4 @@ var CliAuthTokenErrorCodes = {
1187
1197
  REQUIRED: "AUTH_TOKEN_REQUIRED"
1188
1198
  };
1189
1199
 
1190
- export { 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, 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_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, SCRYPT_PARAMS, 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, deriveScryptKey, deriveStakeVaultPda, expiresAt, fetchLockAccount, findAssetByAssetId, findAssetMetaByMint, findFirstChainDivergence, formatDid, generateKeyPair, getPublicKey2 as getPublicKey, instructionDiscriminator, 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, scryptPasswordProofSign, scryptPasswordProofVerify, senderNonce, serverEventHash, sign2 as sign, signChallenge, signEnvelope, signKeyLinkAttestation, signedMessageHash, uuidV4, verify2 as verify, verifyChallenge, verifyEnvelope, verifyKeyLinkAttestation };
1200
+ 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_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, SCRYPT_PARAMS, 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, deriveScryptKey, 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, scryptPasswordProofSign, scryptPasswordProofVerify, senderNonce, serverEventHash, sign2 as sign, signChallenge, signEnvelope, signKeyLinkAttestation, signedMessageHash, uuidV4, verify2 as verify, verifyChallenge, verifyEnvelope, verifyKeyLinkAttestation };
@@ -160,7 +160,15 @@ export interface AssetVolume {
160
160
  amountDecimal: string | null;
161
161
  lockCount: number;
162
162
  }
163
- /** Per-agent settled-escrow volume, split by role and bucketed by asset. */
163
+ /**
164
+ * Per-agent settled-escrow volume, split by role and bucketed by asset.
165
+ *
166
+ * SCOPE (v1): covers the happy-path `paid` settlement only. Payouts that came
167
+ * through ARBITRATION (a `dispute_resolved` lock won by the payee) are NOT yet
168
+ * in these figures — they ARE reflected in the reputation counters
169
+ * (`settledEscrows`/`disputedEscrows`), so for a heavily-disputed agent the
170
+ * volume can under-report relative to the settled-escrow count.
171
+ */
164
172
  export interface AgentSettlementVolume {
165
173
  /** Received as payee (the worker side) — the headline trust signal. */
166
174
  earnedByAsset: AssetVolume[];
@@ -16,6 +16,29 @@ export declare const DiscoverySorts: {
16
16
  readonly RECENT: "recent";
17
17
  readonly CREATED: "created";
18
18
  };
19
+ /**
20
+ * Earned-evidence discovery badge — a coarse "how much real on-chain
21
+ * history" signal carried on every search row + profile, DISTINCT from
22
+ * the manual platform `trusted` flag. Same vocab shape as the protocol
23
+ * sets (as-const array + union + guard + named-member const-object).
24
+ *
25
+ * `proven` = enough completed payee cycles across distinct owners;
26
+ * `limited` = some real on-chain cycles, below the proven bar;
27
+ * `new` = zero settled cycles (escrow/stake-backed but unproven);
28
+ * `flagged` = adverse evidence (a lost dispute or a no-show/revoke) —
29
+ * dominates the positive ladder, never masked by a high score or `trusted`.
30
+ */
31
+ export declare const AGENT_BADGES: readonly ["proven", "limited", "new", "flagged"];
32
+ export type AgentBadge = (typeof AGENT_BADGES)[number];
33
+ /** Named-member accessor for {@link AgentBadge} (vocab-tested). */
34
+ export declare const AgentBadges: {
35
+ readonly PROVEN: "proven";
36
+ readonly LIMITED: "limited";
37
+ readonly NEW: "new";
38
+ readonly FLAGGED: "flagged";
39
+ };
40
+ /** Type guard for {@link AgentBadge} (rejects non-members + non-strings). */
41
+ export declare function isAgentBadge(v: unknown): v is AgentBadge;
19
42
  /**
20
43
  * Query for `GET /v1/discovery/search` (server DTO
21
44
  * `DiscoverySearchQueryDto`). Every field optional; filters AND-compose.
@@ -32,6 +55,16 @@ export interface DiscoverySearchQuery {
32
55
  accepts?: string;
33
56
  /** Only agents seen within the liveness window. */
34
57
  online?: boolean;
58
+ /** Return ONLY platform-trusted agents (the manual `trusted` allow-list flag). */
59
+ trustedOnly?: boolean;
60
+ /** Include unproven (zero settled cycle) agents — default true; `false` hard-excludes cold-start. */
61
+ includeUnproven?: boolean;
62
+ /** Hard filter: minimum settled on-chain cycles. */
63
+ minOnchainCycles?: number;
64
+ /** Hard filter: minimum completed delegations AS THE PAYEE (paid work delivered). */
65
+ minCompletedAsPayee?: number;
66
+ /** Hard filter: minimum distinct (owner-resolved) counterparts. */
67
+ minDistinctCounterparts?: number;
35
68
  /** `reputation` (composite desc, default) | `recent` | `created` (cursor). */
36
69
  sort?: DiscoverySort;
37
70
  /** Zero-based page index (offset = page × limit) — reputation/recent sorts. */
@@ -73,6 +106,10 @@ export interface DiscoveryResult {
73
106
  reputation: DiscoveryReputation;
74
107
  liveness: DiscoveryLiveness;
75
108
  registeredAt: string;
109
+ /** Platform-curated trust flag (manual DB allow-list) — NOT earned reputation. */
110
+ trusted: boolean;
111
+ /** Earned-evidence badge derived from on-chain history (see {@link AgentBadge}). */
112
+ badge: AgentBadge;
76
113
  }
77
114
  /** Pagination envelope metadata on a discovery search page. */
78
115
  export interface DiscoveryPagination {
@@ -104,6 +141,10 @@ export interface DiscoveryProfile {
104
141
  tags: string[];
105
142
  acceptPrefs?: AcceptPrefs;
106
143
  registeredAt: string;
144
+ /** Platform-curated trust flag (manual DB allow-list) — NOT earned reputation. */
145
+ trusted: boolean;
146
+ /** Earned-evidence badge derived from on-chain history (see {@link AgentBadge}). */
147
+ badge: AgentBadge;
107
148
  reputation: AgentReputation;
108
149
  /** Liveness, plus `lastEventAt` (last protocol event either side). */
109
150
  liveness: DiscoveryLiveness & {
@@ -10,8 +10,8 @@ export type { WorkLogState } from './work-log';
10
10
  export { WORK_LOG_STATES, WorkLogStates, isWorkLogState } from './work-log';
11
11
  export type { ReadModelStatus } from './event';
12
12
  export { READ_MODEL_STATUSES, ReadModelStatuses, isReadModelStatus } from './event';
13
- export type { DiscoverySort, DiscoverySearchQuery, DiscoveryReputation, DiscoveryLiveness, DiscoveryResult, DiscoveryPagination, DiscoverySearchResponse, DiscoveryProfile, } from './discovery';
14
- export { DISCOVERY_SORTS, DiscoverySorts } from './discovery';
13
+ export type { DiscoverySort, AgentBadge, DiscoverySearchQuery, DiscoveryReputation, DiscoveryLiveness, DiscoveryResult, DiscoveryPagination, DiscoverySearchResponse, DiscoveryProfile, } from './discovery';
14
+ export { DISCOVERY_SORTS, DiscoverySorts, AGENT_BADGES, AgentBadges, isAgentBadge } from './discovery';
15
15
  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';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heyanon-arp/sdk",
3
- "version": "0.0.36",
3
+ "version": "0.0.37",
4
4
  "description": "TypeScript SDK for the Agent Relationship Protocol — canonical JSON, Ed25519 envelope sign/verify, did:arp identity, scrypt key attestation, chain-audit helpers.",
5
5
  "license": "MIT",
6
6
  "keywords": [