@heyanon-arp/sdk 0.0.23 → 0.0.24
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 +17 -0
- package/dist/index.mjs +14 -1
- package/dist/types/agent.d.ts +23 -0
- package/dist/types/cli-auth.d.ts +28 -4
- package/dist/types/discovery.d.ts +24 -0
- package/dist/types/inbox.d.ts +13 -0
- package/dist/types/index.d.ts +5 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -563,6 +563,19 @@ var InboxBlockScopes = {
|
|
|
563
563
|
DID: "did"
|
|
564
564
|
};
|
|
565
565
|
|
|
566
|
+
// src/types/cli-auth.ts
|
|
567
|
+
var CLI_LOGIN_SESSION_STORED_STATES = ["pending", "confirmed", "consumed"];
|
|
568
|
+
var CLI_LOGIN_SESSION_STATES = ["pending", "confirmed", "consumed", "expired"];
|
|
569
|
+
function isCliLoginSessionWireState(v) {
|
|
570
|
+
return typeof v === "string" && CLI_LOGIN_SESSION_STATES.includes(v);
|
|
571
|
+
}
|
|
572
|
+
var CliLoginSessionStates = {
|
|
573
|
+
PENDING: "pending",
|
|
574
|
+
CONFIRMED: "confirmed",
|
|
575
|
+
CONSUMED: "consumed",
|
|
576
|
+
EXPIRED: "expired"
|
|
577
|
+
};
|
|
578
|
+
|
|
566
579
|
// src/assets.ts
|
|
567
580
|
var SOLANA_CLUSTER_IDS = {
|
|
568
581
|
"solana-mainnet": "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
|
|
@@ -943,9 +956,12 @@ exports.ASSOCIATED_TOKEN_PROGRAM_ID_BASE58 = ASSOCIATED_TOKEN_PROGRAM_ID_BASE58;
|
|
|
943
956
|
exports.BODY_TYPES = BODY_TYPES;
|
|
944
957
|
exports.BodyTypes = BodyTypes;
|
|
945
958
|
exports.CAIP19_REGEX = CAIP19_REGEX;
|
|
959
|
+
exports.CLI_LOGIN_SESSION_STATES = CLI_LOGIN_SESSION_STATES;
|
|
960
|
+
exports.CLI_LOGIN_SESSION_STORED_STATES = CLI_LOGIN_SESSION_STORED_STATES;
|
|
946
961
|
exports.CREATE_LOCK_DISCRIMINATOR = CREATE_LOCK_DISCRIMINATOR;
|
|
947
962
|
exports.CREATE_LOCK_NATIVE_DISCRIMINATOR = CREATE_LOCK_NATIVE_DISCRIMINATOR;
|
|
948
963
|
exports.CURRENT_PROTOCOL_VERSION = CURRENT_PROTOCOL_VERSION;
|
|
964
|
+
exports.CliLoginSessionStates = CliLoginSessionStates;
|
|
949
965
|
exports.DECIMAL_AMOUNT_REGEX = DECIMAL_AMOUNT_REGEX;
|
|
950
966
|
exports.DECLINE_REASONS = DECLINE_REASONS;
|
|
951
967
|
exports.DELEGATION_ACTIONS = DELEGATION_ACTIONS;
|
|
@@ -1026,6 +1042,7 @@ exports.getPublicKey = getPublicKey2;
|
|
|
1026
1042
|
exports.instructionDiscriminator = instructionDiscriminator;
|
|
1027
1043
|
exports.isAssetIdentifier = isAssetIdentifier;
|
|
1028
1044
|
exports.isBodyType = isBodyType;
|
|
1045
|
+
exports.isCliLoginSessionWireState = isCliLoginSessionWireState;
|
|
1029
1046
|
exports.isDecimalAmountString = isDecimalAmountString;
|
|
1030
1047
|
exports.isDeclineReason = isDeclineReason;
|
|
1031
1048
|
exports.isDelegationAction = isDelegationAction;
|
package/dist/index.mjs
CHANGED
|
@@ -538,6 +538,19 @@ var InboxBlockScopes = {
|
|
|
538
538
|
DID: "did"
|
|
539
539
|
};
|
|
540
540
|
|
|
541
|
+
// src/types/cli-auth.ts
|
|
542
|
+
var CLI_LOGIN_SESSION_STORED_STATES = ["pending", "confirmed", "consumed"];
|
|
543
|
+
var CLI_LOGIN_SESSION_STATES = ["pending", "confirmed", "consumed", "expired"];
|
|
544
|
+
function isCliLoginSessionWireState(v) {
|
|
545
|
+
return typeof v === "string" && CLI_LOGIN_SESSION_STATES.includes(v);
|
|
546
|
+
}
|
|
547
|
+
var CliLoginSessionStates = {
|
|
548
|
+
PENDING: "pending",
|
|
549
|
+
CONFIRMED: "confirmed",
|
|
550
|
+
CONSUMED: "consumed",
|
|
551
|
+
EXPIRED: "expired"
|
|
552
|
+
};
|
|
553
|
+
|
|
541
554
|
// src/assets.ts
|
|
542
555
|
var SOLANA_CLUSTER_IDS = {
|
|
543
556
|
"solana-mainnet": "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
|
|
@@ -909,4 +922,4 @@ function isPostCommitErrorCode(code) {
|
|
|
909
922
|
return POST_COMMIT_SET.has(code) || POST_COMMIT_ERROR_CODE_PREFIXES.some((p) => code.startsWith(p));
|
|
910
923
|
}
|
|
911
924
|
|
|
912
|
-
export { ASSET_DECIMALS_MAX, ASSET_DECIMALS_MIN, ASSET_SYMBOL_MAX_LEN, ASSET_SYMBOL_MIN_LEN, ASSET_WHITELIST, ASSOCIATED_TOKEN_PROGRAM_ID_BASE58, BODY_TYPES, BodyTypes, CAIP19_REGEX, CREATE_LOCK_DISCRIMINATOR, CREATE_LOCK_NATIVE_DISCRIMINATOR, CURRENT_PROTOCOL_VERSION, DECIMAL_AMOUNT_REGEX, DECLINE_REASONS, DELEGATION_ACTIONS, DELEGATION_ACTIVE_STATES, DELEGATION_STATES, DEVNET_MINTS, DISCOVERY_SORTS, DelegationActions, 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_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, ReadModelStatuses, ReceiptVerdicts, RelationshipStates, SCRYPT_PARAMS, SHA256_HEX_RE, SLIP44_SOLANA, SOLANA_CLUSTER_IDS, 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, buildCreateLockIxData, buildLifecycleIxData, buildResolveDisputeIxData, bytes16ToDelegationId, canonicalBytes, canonicalJson, canonicalSha256Hex, computeCreateLockDiscriminator, computeLockAccountDiscriminator, decodeLockAccount, delegationIdToBytes16, deriveDelegationConditionHash, deriveLockId, deriveScryptKey, detectTokenProgramFromOwner, detectTokenProgramFromOwnerBytes, expiresAt, findAssetByAssetId, findFirstChainDivergence, formatDid, generateKeyPair, getPublicKey2 as getPublicKey, instructionDiscriminator, isAssetIdentifier, isBodyType, isDecimalAmountString, isDeclineReason, isDelegationAction, isDelegationState, isDiscoverySort, isEscrowReleaseMethod, isHandshakeDecision, isInboxBlockScope, isPostCommitErrorCode, isReadModelStatus, isReceiptVerdict, isRelationshipState, isSha256Hex, isValidDid, isWhitelistedAssetId, isWorkLogState, listWhitelistedAssets, parseCaip19SolanaAssetId, parseDid, pollUntil, resolveAsset, rfc3339, scryptPasswordProofSign, scryptPasswordProofVerify, senderNonce, serverEventHash, sign2 as sign, signChallenge, signEnvelope, signKeyLinkAttestation, signedMessageHash, uuidV4, verify2 as verify, verifyChallenge, verifyEnvelope, verifyKeyLinkAttestation };
|
|
925
|
+
export { ASSET_DECIMALS_MAX, ASSET_DECIMALS_MIN, ASSET_SYMBOL_MAX_LEN, ASSET_SYMBOL_MIN_LEN, ASSET_WHITELIST, ASSOCIATED_TOKEN_PROGRAM_ID_BASE58, BODY_TYPES, BodyTypes, CAIP19_REGEX, CLI_LOGIN_SESSION_STATES, CLI_LOGIN_SESSION_STORED_STATES, CREATE_LOCK_DISCRIMINATOR, CREATE_LOCK_NATIVE_DISCRIMINATOR, CURRENT_PROTOCOL_VERSION, CliLoginSessionStates, DECIMAL_AMOUNT_REGEX, DECLINE_REASONS, DELEGATION_ACTIONS, DELEGATION_ACTIVE_STATES, DELEGATION_STATES, DEVNET_MINTS, DISCOVERY_SORTS, DelegationActions, 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_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, ReadModelStatuses, ReceiptVerdicts, RelationshipStates, SCRYPT_PARAMS, SHA256_HEX_RE, SLIP44_SOLANA, SOLANA_CLUSTER_IDS, 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, buildCreateLockIxData, buildLifecycleIxData, buildResolveDisputeIxData, bytes16ToDelegationId, canonicalBytes, canonicalJson, canonicalSha256Hex, computeCreateLockDiscriminator, computeLockAccountDiscriminator, decodeLockAccount, delegationIdToBytes16, deriveDelegationConditionHash, deriveLockId, deriveScryptKey, detectTokenProgramFromOwner, detectTokenProgramFromOwnerBytes, expiresAt, findAssetByAssetId, findFirstChainDivergence, formatDid, generateKeyPair, getPublicKey2 as getPublicKey, instructionDiscriminator, isAssetIdentifier, isBodyType, isCliLoginSessionWireState, isDecimalAmountString, isDeclineReason, isDelegationAction, isDelegationState, isDiscoverySort, isEscrowReleaseMethod, isHandshakeDecision, isInboxBlockScope, isPostCommitErrorCode, isReadModelStatus, isReceiptVerdict, isRelationshipState, isSha256Hex, isValidDid, isWhitelistedAssetId, isWorkLogState, listWhitelistedAssets, parseCaip19SolanaAssetId, parseDid, pollUntil, resolveAsset, rfc3339, scryptPasswordProofSign, scryptPasswordProofVerify, senderNonce, serverEventHash, sign2 as sign, signChallenge, signEnvelope, signKeyLinkAttestation, signedMessageHash, uuidV4, verify2 as verify, verifyChallenge, verifyEnvelope, verifyKeyLinkAttestation };
|
package/dist/types/agent.d.ts
CHANGED
|
@@ -136,3 +136,26 @@ export interface AgentReputation {
|
|
|
136
136
|
computed: boolean;
|
|
137
137
|
lastComputedAt?: string | null;
|
|
138
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* Request body for `POST /v1/agents` (registration). The server DTO is
|
|
141
|
+
* `RegisterAgentDto`; `ownerAttestation` mirrors the SDK
|
|
142
|
+
* `ScryptPasswordAttestation<KeyLinkPayload>` wire shape but stays a
|
|
143
|
+
* generic object here — its inner fields are verified by canonical-JSON
|
|
144
|
+
* + HMAC at the server, not structurally.
|
|
145
|
+
*/
|
|
146
|
+
export interface RegisterAgentRequest {
|
|
147
|
+
challengeId: string;
|
|
148
|
+
identityPublicKey: string;
|
|
149
|
+
settlementPublicKey: string;
|
|
150
|
+
ownerAttestation: {
|
|
151
|
+
payload: Record<string, unknown>;
|
|
152
|
+
sig: string;
|
|
153
|
+
scrypt_salt_id: string;
|
|
154
|
+
};
|
|
155
|
+
scryptKeyB64: string;
|
|
156
|
+
scryptSaltB64: string;
|
|
157
|
+
name?: string;
|
|
158
|
+
description?: string;
|
|
159
|
+
/** Capability tags — lowercase alphanumeric + dash/underscore, max 20. */
|
|
160
|
+
tags?: string[];
|
|
161
|
+
}
|
package/dist/types/cli-auth.d.ts
CHANGED
|
@@ -4,12 +4,36 @@
|
|
|
4
4
|
* CLI's response types — both are plain framework-agnostic interfaces
|
|
5
5
|
* (the server declares them in a service, not a NestJS DTO class), so
|
|
6
6
|
* this is a pure lift-and-share with no decorator coupling.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* `heyarp login` session lifecycle. TWO tiers because the wire vocab is
|
|
10
|
+
* a strict superset of what's persisted:
|
|
11
|
+
*
|
|
12
|
+
* - {@link CLI_LOGIN_SESSION_STORED_STATES} — what the server's Mongo
|
|
13
|
+
* row actually holds (`@Prop enum`): `pending` → `confirmed` →
|
|
14
|
+
* `consumed`.
|
|
15
|
+
* - {@link CLI_LOGIN_SESSION_STATES} — what the `GET …/sessions/:id`
|
|
16
|
+
* endpoint can RETURN. Adds `expired`, which the service COMPUTES on
|
|
17
|
+
* read for a `pending` row past its TTL (and the CLI also derives
|
|
18
|
+
* from a 404). `expired` is never stored.
|
|
7
19
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
20
|
+
* Same `as const` array + union + guard + const-object shape as the
|
|
21
|
+
* protocol vocabularies; the server sources its `@Prop enum` from the
|
|
22
|
+
* stored array and types the read endpoint with the full wire union,
|
|
23
|
+
* and the CLI types its wire response from the full union.
|
|
12
24
|
*/
|
|
25
|
+
export declare const CLI_LOGIN_SESSION_STORED_STATES: readonly ["pending", "confirmed", "consumed"];
|
|
26
|
+
export type CliLoginSessionStoredState = (typeof CLI_LOGIN_SESSION_STORED_STATES)[number];
|
|
27
|
+
export declare const CLI_LOGIN_SESSION_STATES: readonly ["pending", "confirmed", "consumed", "expired"];
|
|
28
|
+
export type CliLoginSessionWireState = (typeof CLI_LOGIN_SESSION_STATES)[number];
|
|
29
|
+
export declare function isCliLoginSessionWireState(v: unknown): v is CliLoginSessionWireState;
|
|
30
|
+
/** Named-member accessor for {@link CliLoginSessionWireState} (vocab-tested). */
|
|
31
|
+
export declare const CliLoginSessionStates: {
|
|
32
|
+
readonly PENDING: "pending";
|
|
33
|
+
readonly CONFIRMED: "confirmed";
|
|
34
|
+
readonly CONSUMED: "consumed";
|
|
35
|
+
readonly EXPIRED: "expired";
|
|
36
|
+
};
|
|
13
37
|
/** `POST /v1/auth/cli/sessions` → a new login session. */
|
|
14
38
|
export interface CliSessionCreated {
|
|
15
39
|
sessionId: string;
|
|
@@ -17,6 +17,30 @@ export declare const DiscoverySorts: {
|
|
|
17
17
|
readonly RECENT: "recent";
|
|
18
18
|
readonly CREATED: "created";
|
|
19
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* Query for `GET /v1/discovery/search` (server DTO
|
|
22
|
+
* `DiscoverySearchQueryDto`). Every field optional; filters AND-compose.
|
|
23
|
+
* Reputation is a SOFT sort, never a gate.
|
|
24
|
+
*/
|
|
25
|
+
export interface DiscoverySearchQuery {
|
|
26
|
+
/** Full-text over name + description. */
|
|
27
|
+
q?: string;
|
|
28
|
+
/** Capability tags — AND-require all. */
|
|
29
|
+
tag?: string[];
|
|
30
|
+
/** Creator wallet (base58) — you must already know it; never echoed back. */
|
|
31
|
+
accountId?: string;
|
|
32
|
+
/** CAIP-19 payment asset; matches explicit listers AND accept-anything agents. */
|
|
33
|
+
accepts?: string;
|
|
34
|
+
/** Only agents seen within the liveness window. */
|
|
35
|
+
online?: boolean;
|
|
36
|
+
/** `reputation` (composite desc, default) | `recent` | `created` (cursor). */
|
|
37
|
+
sort?: DiscoverySort;
|
|
38
|
+
/** Zero-based page index (offset = page × limit) — reputation/recent sorts. */
|
|
39
|
+
page?: number;
|
|
40
|
+
/** Cursor for `sort=created`: the previous page's last row id. */
|
|
41
|
+
after?: string;
|
|
42
|
+
limit?: number;
|
|
43
|
+
}
|
|
20
44
|
/** Reputation digest carried inline on each discovery row (the soft-sort key). */
|
|
21
45
|
export interface DiscoveryReputation {
|
|
22
46
|
composite: number;
|
package/dist/types/inbox.d.ts
CHANGED
|
@@ -31,3 +31,16 @@ export interface InboxBlock {
|
|
|
31
31
|
/** When the block was set (ISO 8601). */
|
|
32
32
|
blockedAt: string;
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Body for `POST /v1/inbox/blocks` (server DTO `CreateInboxBlockDto`).
|
|
36
|
+
* You always NAME a DID; by default the server resolves its owner and
|
|
37
|
+
* blocks every sibling agent (account scope). The target account id is
|
|
38
|
+
* never returned.
|
|
39
|
+
*/
|
|
40
|
+
export interface BlockInboxBody {
|
|
41
|
+
did: string;
|
|
42
|
+
/** Block only this exact DID instead of the whole owner account. */
|
|
43
|
+
didOnly?: boolean;
|
|
44
|
+
/** Optional private note (max 512 chars). Visible only to you. */
|
|
45
|
+
reason?: string;
|
|
46
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -10,12 +10,13 @@ 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, DiscoveryReputation, DiscoveryLiveness, DiscoveryResult, DiscoveryPagination, DiscoverySearchResponse, DiscoveryProfile, } from './discovery';
|
|
13
|
+
export type { DiscoverySort, DiscoverySearchQuery, DiscoveryReputation, DiscoveryLiveness, DiscoveryResult, DiscoveryPagination, DiscoverySearchResponse, DiscoveryProfile, } from './discovery';
|
|
14
14
|
export { DISCOVERY_SORTS, DiscoverySorts, isDiscoverySort } from './discovery';
|
|
15
|
-
export type { InboxBlockScope, InboxBlock } from './inbox';
|
|
15
|
+
export type { InboxBlockScope, InboxBlock, BlockInboxBody } from './inbox';
|
|
16
16
|
export { INBOX_BLOCK_SCOPES, InboxBlockScopes, isInboxBlockScope } from './inbox';
|
|
17
|
-
export type { CliSessionCreated, CliTokenIssued, CliWhoami, MyAgentSummary } from './cli-auth';
|
|
17
|
+
export type { CliSessionCreated, CliTokenIssued, CliWhoami, MyAgentSummary, CliLoginSessionStoredState, CliLoginSessionWireState, } from './cli-auth';
|
|
18
|
+
export { CLI_LOGIN_SESSION_STORED_STATES, CLI_LOGIN_SESSION_STATES, CliLoginSessionStates, isCliLoginSessionWireState } from './cli-auth';
|
|
18
19
|
export type { AssetIdentifierWire, DelegationPublic, ReceiptPublic, RelationshipPublic, WorkLogPublic, EventPublic, IngestResult } from './read-model';
|
|
19
|
-
export type { AcceptPrefs, AcceptCurrency, AgentRegisteredResponse, AgentPublic, UpdateAgentBody, ReputationScores, ReputationCounters, AgentReputation, } from './agent';
|
|
20
|
+
export type { AcceptPrefs, AcceptCurrency, AgentRegisteredResponse, AgentPublic, UpdateAgentBody, RegisterAgentRequest, ReputationScores, ReputationCounters, AgentReputation, } from './agent';
|
|
20
21
|
export type { OwnerSigningMethod, KeyLinkPayload, ScryptPasswordAttestation } from './identity';
|
|
21
22
|
export { SCRYPT_PARAMS, OWNER_SIGNING_METHODS } 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.24",
|
|
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": [
|