@terminal3/t3n-sdk 4.14.0 → 4.15.0
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/cli/index.js +1 -1
- package/dist/index.d.ts +123 -8
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2007,17 +2007,42 @@ declare class T3nClient {
|
|
|
2007
2007
|
* returned exactly once here and is never persisted or recoverable
|
|
2008
2008
|
* afterwards, so the caller must capture it immediately.
|
|
2009
2009
|
*
|
|
2010
|
+
* Atomic registration + card hosting: pass `options.agentUri` and the
|
|
2011
|
+
* SAME transaction also writes the agent-registry record (URI + the
|
|
2012
|
+
* org's publish-consent link, born together) and — unless
|
|
2013
|
+
* `options.defaultCard === false` — hosts a PRIVATE card for the new
|
|
2014
|
+
* agent in the org's `agent-cards` scope. The card body is
|
|
2015
|
+
* `options.card` when given (object or pre-serialised JSON string);
|
|
2016
|
+
* otherwise the CONTRACT builds and hosts its default (which can even
|
|
2017
|
+
* name the agent DID, minted inside the same transaction).
|
|
2018
|
+
*
|
|
2019
|
+
* The card is deliberately NOT published: an org-bound agent must not
|
|
2020
|
+
* become world-discoverable as a side effect of provisioning. Publish
|
|
2021
|
+
* explicitly with `agentCardPublish` (one call — the consent link
|
|
2022
|
+
* already exists from creation). All-or-nothing: any refusal creates
|
|
2023
|
+
* no agent, no record, no card.
|
|
2024
|
+
*
|
|
2010
2025
|
* @param organisationDid - the owning organisation's DID
|
|
2011
2026
|
* (`did:t3n:<40-hex>`); the caller must be one of its admins
|
|
2012
2027
|
* @param name - human-readable agent name (1..=128 bytes)
|
|
2013
|
-
* @
|
|
2028
|
+
* @param options - optional atomic registration + card hosting
|
|
2029
|
+
* @returns the new agent's DID and its one-time private key, plus
|
|
2030
|
+
* `agentUri` / `cardEntryId` (the hosted PRIVATE card's entry id)
|
|
2031
|
+
* when the atomic path ran
|
|
2014
2032
|
* @throws if the session is not authenticated, or if the contract
|
|
2015
|
-
* refuses (e.g. the caller is not an admin of `organisationDid`,
|
|
2016
|
-
* name is empty / too long
|
|
2017
|
-
|
|
2018
|
-
|
|
2033
|
+
* refuses (e.g. the caller is not an admin of `organisationDid`, the
|
|
2034
|
+
* name is empty / too long, or the card fails validation — in which
|
|
2035
|
+
* case NOTHING was created)
|
|
2036
|
+
*/
|
|
2037
|
+
createAgent(organisationDid: string, name: string, options?: {
|
|
2038
|
+
agentUri?: string;
|
|
2039
|
+
card?: object | string;
|
|
2040
|
+
defaultCard?: boolean;
|
|
2041
|
+
}): Promise<{
|
|
2019
2042
|
agentDid: Did;
|
|
2020
2043
|
privateKey: string;
|
|
2044
|
+
agentUri?: string;
|
|
2045
|
+
cardEntryId?: string;
|
|
2021
2046
|
}>;
|
|
2022
2047
|
/**
|
|
2023
2048
|
* Read the authenticated user's own agent-auth policy — the standing
|
|
@@ -2780,7 +2805,10 @@ declare function isOrgAdminStatus(value: unknown): value is OrgAdminStatus;
|
|
|
2780
2805
|
* Mirrors the org-data `MutationResponse` wire shape.
|
|
2781
2806
|
*/
|
|
2782
2807
|
interface MutationResponse {
|
|
2783
|
-
/**
|
|
2808
|
+
/**
|
|
2809
|
+
* `"created"`, `"updated"`, `"deleted"`, or — for the agent-card mutations —
|
|
2810
|
+
* `"published"` / `"unpublished"`.
|
|
2811
|
+
*/
|
|
2784
2812
|
status: string;
|
|
2785
2813
|
/** Hex-encoded entry ID; present on data write/delete operations. */
|
|
2786
2814
|
entry_id?: string;
|
|
@@ -2847,6 +2875,20 @@ interface DataGetResponse {
|
|
|
2847
2875
|
}
|
|
2848
2876
|
/** Shallow runtime guard for {@link DataGetResponse}. */
|
|
2849
2877
|
declare function isDataGetResponse(value: unknown): value is DataGetResponse;
|
|
2878
|
+
/**
|
|
2879
|
+
* Return shape of `agentCardGet` — composed client-side from the generic
|
|
2880
|
+
* `org-data-get` read of the card's entry (there is no card-specific read
|
|
2881
|
+
* operation on the contract). To check whether a public copy exists, probe
|
|
2882
|
+
* the anonymous `GET /api/agent-card/{did}` endpoint.
|
|
2883
|
+
*/
|
|
2884
|
+
interface AgentCardResponse {
|
|
2885
|
+
/** The agent whose card this is (`did:t3n:<40-hex>`). */
|
|
2886
|
+
agent_did: string;
|
|
2887
|
+
/** The stored card JSON body, verbatim. */
|
|
2888
|
+
card: string;
|
|
2889
|
+
}
|
|
2890
|
+
/** Shallow runtime guard for {@link AgentCardResponse}. */
|
|
2891
|
+
declare function isAgentCardResponse(value: unknown): value is AgentCardResponse;
|
|
2850
2892
|
/**
|
|
2851
2893
|
* Legacy direct-route org-data envelope shape retained for compatibility.
|
|
2852
2894
|
*
|
|
@@ -2883,6 +2925,21 @@ interface OrgDataActionWire {
|
|
|
2883
2925
|
* constructing one-shot signed HTTP envelopes per call.
|
|
2884
2926
|
*/
|
|
2885
2927
|
|
|
2928
|
+
/**
|
|
2929
|
+
* Org-data scope agent cards are stored under. The private card body is
|
|
2930
|
+
* ordinary org-data — written / read / deleted with the generic
|
|
2931
|
+
* `org-data-*` operations under this scope; only publication has dedicated
|
|
2932
|
+
* contract operations.
|
|
2933
|
+
*/
|
|
2934
|
+
declare const AGENT_CARDS_SCOPE = "agent-cards";
|
|
2935
|
+
/**
|
|
2936
|
+
* Derive the canonical org-data entry ID an agent card is stored under:
|
|
2937
|
+
* the first 16 bytes of `SHA-256(owner ‖ "agent-cards" ‖ agent ‖ u64_be(0))`
|
|
2938
|
+
* — byte-identical to the contract's `derive_entry_id(owner, "agent-cards",
|
|
2939
|
+
* agent, 0)`, so `agent-card-publish` finds the entry without a reverse
|
|
2940
|
+
* lookup. Returned as 32 lowercase hex chars (the wire `entry_id` format).
|
|
2941
|
+
*/
|
|
2942
|
+
declare function deriveAgentCardEntryId(ownerDid: string, agentDid: string): string;
|
|
2886
2943
|
interface CreatePolicyInput {
|
|
2887
2944
|
orgDid: string;
|
|
2888
2945
|
initialAdminDid: string;
|
|
@@ -2996,6 +3053,27 @@ interface DataGetInput {
|
|
|
2996
3053
|
/** Hex-encoded entry ID (32 hex chars). */
|
|
2997
3054
|
entryId: string;
|
|
2998
3055
|
}
|
|
3056
|
+
interface AgentCardSetInput {
|
|
3057
|
+
/**
|
|
3058
|
+
* The card owner (`did:t3n:<40-hex>`) — an org DID (written by its
|
|
3059
|
+
* `agent-cards` scope writers) or an individual/agent DID (a self-owned
|
|
3060
|
+
* data space: the owner itself writes, no org needed).
|
|
3061
|
+
*/
|
|
3062
|
+
ownerDid: string;
|
|
3063
|
+
/** The agent whose card this is (`did:t3n:<40-hex>`). */
|
|
3064
|
+
agentDid: string;
|
|
3065
|
+
/**
|
|
3066
|
+
* Full card JSON body. Validated locally (non-empty / ≤ 16 KiB / JSON) —
|
|
3067
|
+
* the same gate the contract applies at publish time.
|
|
3068
|
+
*/
|
|
3069
|
+
card: string;
|
|
3070
|
+
}
|
|
3071
|
+
/** Reference to a single agent's card by `(owner, agent)`. */
|
|
3072
|
+
interface AgentCardRefInput {
|
|
3073
|
+
/** The card owner — an org DID or an individual/agent DID. */
|
|
3074
|
+
ownerDid: string;
|
|
3075
|
+
agentDid: string;
|
|
3076
|
+
}
|
|
2999
3077
|
interface ExecuteOrgDataActionOptions {
|
|
3000
3078
|
/**
|
|
3001
3079
|
* Deprecated. The direct signed-envelope transport used this as the
|
|
@@ -3143,6 +3221,33 @@ declare class OrgDataClient {
|
|
|
3143
3221
|
dataList(input: DataListInput): Promise<DataListResponse>;
|
|
3144
3222
|
/** Retrieve a single data entry by entry ID (admin-only). */
|
|
3145
3223
|
dataGet(input: DataGetInput): Promise<DataGetResponse>;
|
|
3224
|
+
/**
|
|
3225
|
+
* Create or overwrite an agent's private card (org scope-writer, or the
|
|
3226
|
+
* owner itself for a self-owned space). Validates locally with the same
|
|
3227
|
+
* gate the contract applies at publish. The card stays private until
|
|
3228
|
+
* {@link agentCardPublish}.
|
|
3229
|
+
*/
|
|
3230
|
+
agentCardSet(input: AgentCardSetInput): Promise<MutationResponse>;
|
|
3231
|
+
/**
|
|
3232
|
+
* Delete an agent's private card. Does NOT unpublish — publication is
|
|
3233
|
+
* explicit state; call {@link agentCardUnpublish} to retract the public copy.
|
|
3234
|
+
*/
|
|
3235
|
+
agentCardDelete(input: AgentCardRefInput): Promise<MutationResponse>;
|
|
3236
|
+
/**
|
|
3237
|
+
* Publish an agent's card to the world-readable `public:agent_cards` map
|
|
3238
|
+
* (served at `GET /api/agent-card/{did}`). The contract validates the
|
|
3239
|
+
* stored bytes, then byte-copies them. Publishing under a third-party
|
|
3240
|
+
* agent DID requires the agent's registry record to name this owner
|
|
3241
|
+
* (consent link); implicit when the owner IS the agent.
|
|
3242
|
+
*/
|
|
3243
|
+
agentCardPublish(input: AgentCardRefInput): Promise<MutationResponse>;
|
|
3244
|
+
/** Remove an agent's card from `public:agent_cards`. */
|
|
3245
|
+
agentCardUnpublish(input: AgentCardRefInput): Promise<MutationResponse>;
|
|
3246
|
+
/**
|
|
3247
|
+
* Read an agent's private card (org: admin or delegation-credential holder
|
|
3248
|
+
* for the `agent-cards` scope; self-owned: the owner).
|
|
3249
|
+
*/
|
|
3250
|
+
agentCardGet(input: AgentCardRefInput): Promise<AgentCardResponse>;
|
|
3146
3251
|
}
|
|
3147
3252
|
/**
|
|
3148
3253
|
* Session-authenticated variant of {@link OrgDataClient}.
|
|
@@ -3215,6 +3320,16 @@ declare class SessionOrgDataClient {
|
|
|
3215
3320
|
dataList(input: DataListInput): Promise<DataListResponse>;
|
|
3216
3321
|
/** Mirrors {@link OrgDataClient.dataGet}. */
|
|
3217
3322
|
dataGet(input: DataGetInput): Promise<DataGetResponse>;
|
|
3323
|
+
/** Mirrors {@link OrgDataClient.agentCardSet}. */
|
|
3324
|
+
agentCardSet(input: AgentCardSetInput): Promise<MutationResponse>;
|
|
3325
|
+
/** Mirrors {@link OrgDataClient.agentCardDelete}. */
|
|
3326
|
+
agentCardDelete(input: AgentCardRefInput): Promise<MutationResponse>;
|
|
3327
|
+
/** Mirrors {@link OrgDataClient.agentCardPublish}. */
|
|
3328
|
+
agentCardPublish(input: AgentCardRefInput): Promise<MutationResponse>;
|
|
3329
|
+
/** Mirrors {@link OrgDataClient.agentCardUnpublish}. */
|
|
3330
|
+
agentCardUnpublish(input: AgentCardRefInput): Promise<MutationResponse>;
|
|
3331
|
+
/** Mirrors {@link OrgDataClient.agentCardGet}. */
|
|
3332
|
+
agentCardGet(input: AgentCardRefInput): Promise<AgentCardResponse>;
|
|
3218
3333
|
}
|
|
3219
3334
|
/**
|
|
3220
3335
|
* Construct a {@link SessionOrgDataClient} from a caller-owned
|
|
@@ -4028,5 +4143,5 @@ declare function tenantDidHex(tenantDid: string): string;
|
|
|
4028
4143
|
declare function validateTail(tail: string): string;
|
|
4029
4144
|
declare function canonicalTenantName(tenantDid: string, tail: string): string;
|
|
4030
4145
|
|
|
4031
|
-
export { AuthMethod, AuthenticationError, BASE_UNITS_PER_TOKEN, ContractResponseError, DEFAULT_ENVIRONMENT, DEFAULT_INDIVIDUAL_THRESHOLD_CENTS, DEFAULT_KYC_POLL_CADENCE, HandshakeError, HttpTransport, KycStatusTimeoutError, LogLevel, MockTransport, NODE_URLS, OrgDataClient, OtpRateLimitedError, RpcError, SessionExpiredError, SessionOrgDataClient, SessionStateError, SessionStatus, SessionUsageReportClient, T3nClient, T3nError, TERMINAL_KYC_STATUSES, TOKEN_DECIMALS, TenantClient, TenantContractsNamespace, TenantMapsNamespace, TenantNamespace, TenantSdkValidationError, TenantTokenNamespace, UnsupportedTenantSdkOperationError, UserUpsertError, WasmError, WireEncodingError, Z_PAYROLL_AUDIT_READ_FUNCTIONS, Z_PAYROLL_RUN_FUNCTIONS, _b64uEncode, assertShape, b64uDecodeStrict, b64uEncodeBytes, bytesToString, canonicalTenantName, clearKeyCache, compactDidFromBytes, createDefaultHandlers, createEmailOtpAuthInput, createEthAuthInput, createLogger, createMlKemPublicKeyHandler, createOidcAuthInput, createOrgDataClientFromSession, createRandomHandler, createUsageReportClientFromSession, createWorkloadAuthInput, decodeWasmErrorMessage, eth_get_address, extractWasmError, fetchDkgAttestation, fetchMlKemPublicKey, formatTokens, generateRandomString, generateUUID, getEnvironment, getEnvironmentName, getGlobalLogLevel, getLogger, getNodeUrl, getScriptVersion, isDataGetResponse, isDataListResponse, isMutationResponse, isObject, isOrgAdminStatus, isOrgContractGrants, isOrgPolicyMeta, isOrgPolicyView, isOrgUsageReport, isOrgWriters, isUnsafeTrustServer, loadConfig, loadWasmComponent, maskKeyMaterial, mergeAgentAuthEntries, mergeDiscoverDids, metamask_get_address, metamask_sign, parseAgentAuthGet, parseAgentAuthPolicy, parseContractResponse, redactSecrets, redactSecretsFromJson, requestToWire, setEnvironment, setGlobalLogLevel, setNodeUrl, stringToBytes, tenantDidHex, toAgentAuthUpdateWire, toBaseUnits, validateConfig, validateTail, verifyDkgAttestation, verifyTdxQuote };
|
|
4032
|
-
export type { AdmitForOrgOptions, AgentAuthEntry, AgentAuthMergeResult, AgentAuthPolicy, AgentAuthScriptGrant, AgentAuthUpdateInput, AuthInput, BalanceRow, ChargeReason, ClientAuth, ClientHandshake, ConfigValidationResult, ContractExecuteInput, ContractKind, ContractPublishInput, ContractRegisterResult, ContractResponseSchema, ContractSetDescriptorInput, CreatePolicyInput, DataGetInput, DataGetResponse, DataListInput, DataListResponse, DelegationGrantKind, DelegationGrantRef, DeleteDataInput, DeleteGrantsInput, DeleteScopeInput, Did, Direction, DkgAttestation, DkgVerifyResult, EmailOtpAuthInput, EmailOtpCredentials, Environment, EthAuthInput, ExecuteBusinessContractOptions, ExecuteOrgDataActionOptions, GetUsageOptions, GrantCheckParams, GrantCheckResult, GrantsGetInput, GuestToHostHandler, GuestToHostHandlers, HandshakeResult, JsonRpcRequest, JsonRpcResponse, KycPollCadence, KycPollOptions, KycStatus, KycStatusKind, ListContractsParams, ListContractsResult, ListContractsScope, ListedContract, Logger, MapCreateInput, MapLifecycleStatus, MapResponse, MapUpdateInput, MapVisibility, MutationResponse, OidcAuthInput, OidcCredentials, OrgAdminStatus, OrgContractGrants, OrgDataActionWire, OrgDataClientOptions, OrgPolicyMeta, OrgPolicyView, OrgUsageReport, OrgUsageReportInput, OrgWriters, OtpChannel, OtpMergeSuggestion, OtpRequestInput, OtpRequestResult, OtpVerifyInput, OtpVerifyResult, PayrollRunRequest, PeerQuoteResult, PolicyGetInput, QuoteVerifyResult, ReaderSet, SdkConfig, SessionCrypto, SessionId, SetGrantsInput, SetWritersInput, StringEncoding, SubmitUserInputArgs, SubmitUserInputResult, T3nClientConfig, TenantAdmitProjection, TenantAdmitStatus, TenantBaseClient, TenantClientConfig, TenantContractExecuteInput, TenantContractPublishInput, TenantContractSetDescriptorInput, TenantExecutionSession, TenantMapCreateInput, TenantMapUpdatePatch, TenantMeResponse, TenantSdkEnvironment, TenantSelfAdmitResult, TenantStatus, TenantTargetOptions, TokenTxKind, Transport, TrustAnchor, TrustAnchorOrUnsafe, UnsafeTrustServer, UpdateMetaInput, UsageEntry, UsagePage, UsageReportSignature, UserGrant, UserInputProfile, UserUpsertErrorKind, WasmComponent, WasmNextResult, WireBlock, WorkloadAuthInput, WriteDataInput, WriterSet, WritersGetInput };
|
|
4146
|
+
export { AGENT_CARDS_SCOPE, AuthMethod, AuthenticationError, BASE_UNITS_PER_TOKEN, ContractResponseError, DEFAULT_ENVIRONMENT, DEFAULT_INDIVIDUAL_THRESHOLD_CENTS, DEFAULT_KYC_POLL_CADENCE, HandshakeError, HttpTransport, KycStatusTimeoutError, LogLevel, MockTransport, NODE_URLS, OrgDataClient, OtpRateLimitedError, RpcError, SessionExpiredError, SessionOrgDataClient, SessionStateError, SessionStatus, SessionUsageReportClient, T3nClient, T3nError, TERMINAL_KYC_STATUSES, TOKEN_DECIMALS, TenantClient, TenantContractsNamespace, TenantMapsNamespace, TenantNamespace, TenantSdkValidationError, TenantTokenNamespace, UnsupportedTenantSdkOperationError, UserUpsertError, WasmError, WireEncodingError, Z_PAYROLL_AUDIT_READ_FUNCTIONS, Z_PAYROLL_RUN_FUNCTIONS, _b64uEncode, assertShape, b64uDecodeStrict, b64uEncodeBytes, bytesToString, canonicalTenantName, clearKeyCache, compactDidFromBytes, createDefaultHandlers, createEmailOtpAuthInput, createEthAuthInput, createLogger, createMlKemPublicKeyHandler, createOidcAuthInput, createOrgDataClientFromSession, createRandomHandler, createUsageReportClientFromSession, createWorkloadAuthInput, decodeWasmErrorMessage, deriveAgentCardEntryId, eth_get_address, extractWasmError, fetchDkgAttestation, fetchMlKemPublicKey, formatTokens, generateRandomString, generateUUID, getEnvironment, getEnvironmentName, getGlobalLogLevel, getLogger, getNodeUrl, getScriptVersion, isAgentCardResponse, isDataGetResponse, isDataListResponse, isMutationResponse, isObject, isOrgAdminStatus, isOrgContractGrants, isOrgPolicyMeta, isOrgPolicyView, isOrgUsageReport, isOrgWriters, isUnsafeTrustServer, loadConfig, loadWasmComponent, maskKeyMaterial, mergeAgentAuthEntries, mergeDiscoverDids, metamask_get_address, metamask_sign, parseAgentAuthGet, parseAgentAuthPolicy, parseContractResponse, redactSecrets, redactSecretsFromJson, requestToWire, setEnvironment, setGlobalLogLevel, setNodeUrl, stringToBytes, tenantDidHex, toAgentAuthUpdateWire, toBaseUnits, validateConfig, validateTail, verifyDkgAttestation, verifyTdxQuote };
|
|
4147
|
+
export type { AdmitForOrgOptions, AgentAuthEntry, AgentAuthMergeResult, AgentAuthPolicy, AgentAuthScriptGrant, AgentAuthUpdateInput, AgentCardRefInput, AgentCardResponse, AgentCardSetInput, AuthInput, BalanceRow, ChargeReason, ClientAuth, ClientHandshake, ConfigValidationResult, ContractExecuteInput, ContractKind, ContractPublishInput, ContractRegisterResult, ContractResponseSchema, ContractSetDescriptorInput, CreatePolicyInput, DataGetInput, DataGetResponse, DataListInput, DataListResponse, DelegationGrantKind, DelegationGrantRef, DeleteDataInput, DeleteGrantsInput, DeleteScopeInput, Did, Direction, DkgAttestation, DkgVerifyResult, EmailOtpAuthInput, EmailOtpCredentials, Environment, EthAuthInput, ExecuteBusinessContractOptions, ExecuteOrgDataActionOptions, GetUsageOptions, GrantCheckParams, GrantCheckResult, GrantsGetInput, GuestToHostHandler, GuestToHostHandlers, HandshakeResult, JsonRpcRequest, JsonRpcResponse, KycPollCadence, KycPollOptions, KycStatus, KycStatusKind, ListContractsParams, ListContractsResult, ListContractsScope, ListedContract, Logger, MapCreateInput, MapLifecycleStatus, MapResponse, MapUpdateInput, MapVisibility, MutationResponse, OidcAuthInput, OidcCredentials, OrgAdminStatus, OrgContractGrants, OrgDataActionWire, OrgDataClientOptions, OrgPolicyMeta, OrgPolicyView, OrgUsageReport, OrgUsageReportInput, OrgWriters, OtpChannel, OtpMergeSuggestion, OtpRequestInput, OtpRequestResult, OtpVerifyInput, OtpVerifyResult, PayrollRunRequest, PeerQuoteResult, PolicyGetInput, QuoteVerifyResult, ReaderSet, SdkConfig, SessionCrypto, SessionId, SetGrantsInput, SetWritersInput, StringEncoding, SubmitUserInputArgs, SubmitUserInputResult, T3nClientConfig, TenantAdmitProjection, TenantAdmitStatus, TenantBaseClient, TenantClientConfig, TenantContractExecuteInput, TenantContractPublishInput, TenantContractSetDescriptorInput, TenantExecutionSession, TenantMapCreateInput, TenantMapUpdatePatch, TenantMeResponse, TenantSdkEnvironment, TenantSelfAdmitResult, TenantStatus, TenantTargetOptions, TokenTxKind, Transport, TrustAnchor, TrustAnchorOrUnsafe, UnsafeTrustServer, UpdateMetaInput, UsageEntry, UsagePage, UsageReportSignature, UserGrant, UserInputProfile, UserUpsertErrorKind, WasmComponent, WasmNextResult, WireBlock, WorkloadAuthInput, WriteDataInput, WriterSet, WritersGetInput };
|