@terminal3/t3n-sdk 4.10.1 → 4.12.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/index.d.ts CHANGED
@@ -939,8 +939,9 @@ declare function parseContractResponse<T = unknown>(raw: string, schema?: Contra
939
939
  * `AGENT_AUTH_MAP` is keyed by the *user* DID — one policy document per
940
940
  * user, global across orgs, with at most one entry per agent DID. Reads
941
941
  * (`agent-auth-get`) and writes (`agent-auth-update`) on
942
- * `tee:user/contracts` are **SelfOnly**: only the user, authenticated as
943
- * themselves, may read or write their own grants. This is the user-approval
942
+ * `tee:authorisations/contracts` (the policy's owning contract) are
943
+ * **SelfOnly**: only the user, authenticated as themselves, may read or
944
+ * write their own grants. This is the user-approval
944
945
  * proof the per-call delegation credential's `user_sig` used to carry.
945
946
  *
946
947
  * The write shape gained `scopes` + a validity window: the
@@ -1974,8 +1975,9 @@ declare class T3nClient {
1974
1975
  /**
1975
1976
  * Read the authenticated user's own agent-auth policy — the standing
1976
1977
  * grants delegated to agents. Dispatches `agent-auth-get` on
1977
- * `tee:user/contracts`, which is **SelfOnly**, so this always returns the
1978
- * caller's own `AGENT_AUTH_MAP[self]` document.
1978
+ * `tee:authorisations/contracts` (the policy's owning contract), which is
1979
+ * **SelfOnly**, so this always returns the caller's own
1980
+ * `AGENT_AUTH_MAP[self]` document.
1979
1981
  *
1980
1982
  * @returns the full policy document (normalised to the camelCase write
1981
1983
  * shape): the per-agent `agents` entries plus the document-level
@@ -2044,6 +2046,14 @@ declare class T3nClient {
2044
2046
  * implicit.
2045
2047
  */
2046
2048
  private executeUserContract;
2049
+ /**
2050
+ * Same glue as {@link executeUserContract}, parameterised over the
2051
+ * target system contract — the agent-auth wrappers dispatch on
2052
+ * `tee:authorisations/contracts` (the authorisation policy's owning
2053
+ * contract) while the rest of the user-contract surface stays on
2054
+ * `tee:user/contracts`.
2055
+ */
2056
+ private executeSystemContract;
2047
2057
  /**
2048
2058
  * Return the authenticated user's Ethereum address from their
2049
2059
  * T3N-hosted per-user wallet, as a 0x-prefixed lowercase hex string.
@@ -2701,6 +2711,20 @@ interface OrgPolicyView {
2701
2711
  }
2702
2712
  /** Shallow runtime guard for {@link OrgPolicyView}. */
2703
2713
  declare function isOrgPolicyView(value: unknown): value is OrgPolicyView;
2714
+ /**
2715
+ * Caller-scoped admin status returned by `org-am-i-admin`.
2716
+ *
2717
+ * Reports only whether the **calling** session's DID is in the org's admin
2718
+ * list — never the roster itself (contrast {@link OrgPolicyMeta}, returned by
2719
+ * the admin-gated `org-policy-get`). Readable by any authenticated session.
2720
+ * Mirrors the org-data `AmIAdminResponse` wire shape.
2721
+ */
2722
+ interface OrgAdminStatus {
2723
+ /** Whether the calling session is an admin of the queried org. */
2724
+ is_admin: boolean;
2725
+ }
2726
+ /** Shallow runtime guard for {@link OrgAdminStatus}. */
2727
+ declare function isOrgAdminStatus(value: unknown): value is OrgAdminStatus;
2704
2728
  /**
2705
2729
  * Standard response returned by all policy write and data mutation operations.
2706
2730
  *
@@ -3046,6 +3070,17 @@ declare class OrgDataClient {
3046
3070
  * without needing admin access.
3047
3071
  */
3048
3072
  policyView(input: PolicyGetInput): Promise<OrgPolicyView>;
3073
+ /**
3074
+ * Whether the calling session is an admin of the given org.
3075
+ *
3076
+ * Composes with {@link T3nClient.myOrgs} to classify the caller's role per
3077
+ * org: `myOrgs()` lists the orgs the caller belongs to; this reports
3078
+ * admin-vs-plain-member for one of them. Unlike {@link policyGet} it is not
3079
+ * admin-gated — it discloses only the caller's own standing (a single bool),
3080
+ * never the admin roster — so a plain member gets `false` rather than a
3081
+ * `NotOrgAdmin` error. Returns `false` when the org has no policy.
3082
+ */
3083
+ amIAdmin(input: PolicyGetInput): Promise<boolean>;
3049
3084
  /** Read the writer list for a scope (admin-only). */
3050
3085
  writersGet(input: WritersGetInput): Promise<OrgWriters>;
3051
3086
  /** Read the grant list for a contract (admin-only). */
@@ -3121,6 +3156,8 @@ declare class SessionOrgDataClient {
3121
3156
  policyGet(input: PolicyGetInput): Promise<OrgPolicyMeta>;
3122
3157
  /** Mirrors {@link OrgDataClient.policyView}. */
3123
3158
  policyView(input: PolicyGetInput): Promise<OrgPolicyView>;
3159
+ /** Mirrors {@link OrgDataClient.amIAdmin}. */
3160
+ amIAdmin(input: PolicyGetInput): Promise<boolean>;
3124
3161
  /** Mirrors {@link OrgDataClient.writersGet}. */
3125
3162
  writersGet(input: WritersGetInput): Promise<OrgWriters>;
3126
3163
  /** Mirrors {@link OrgDataClient.grantsGet}. */
@@ -3942,5 +3979,5 @@ declare function tenantDidHex(tenantDid: string): string;
3942
3979
  declare function validateTail(tail: string): string;
3943
3980
  declare function canonicalTenantName(tenantDid: string, tail: string): string;
3944
3981
 
3945
- 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, 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 };
3946
- 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, 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 };
3982
+ 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 };
3983
+ 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 };