@terminal3/t3n-sdk 3.13.0 → 3.14.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
@@ -725,6 +725,29 @@ declare class UserUpsertError extends T3nError {
725
725
  */
726
726
  static fromWire(raw: string): UserUpsertError | null;
727
727
  }
728
+ /** One contract-scoped grant for an agent. Wire form is snake_case
729
+ * (`script_name` / `version_req` / `allowed_hosts`); `agentAuthUpdate`
730
+ * performs the conversion. */
731
+ interface AgentScriptGrant {
732
+ scriptName: string;
733
+ /** SemVer requirement (e.g. `"^1.0.0"`). Omit / null = any version. */
734
+ versionReq?: string | null;
735
+ /** Allowed function names. Omit / null = all functions. */
736
+ functions?: string[] | null;
737
+ /** Allowed outbound HTTP hosts. Omit = none. */
738
+ allowedHosts?: string[];
739
+ }
740
+ /** Per-agent authorisation grant binding an agent DID to its script grants. */
741
+ interface AgentGrantInput {
742
+ agentDid: string;
743
+ scripts: AgentScriptGrant[];
744
+ }
745
+ /** Input to {@link T3nClient.agentAuthUpdate}. The document IS the new state:
746
+ * an empty `agents` list revokes all agent access. Mirrors the contract
747
+ * `AgentAuthPolicy`. */
748
+ interface AgentAuthUpdateInput {
749
+ agents: AgentGrantInput[];
750
+ }
728
751
 
729
752
  /**
730
753
  * Org-data wire types mirroring the org-data contract wire shapes.
@@ -1970,6 +1993,20 @@ declare class T3nClient {
1970
1993
  * @throws {RpcError} for non-typed transport / decode failures.
1971
1994
  */
1972
1995
  submitUserInput(input: SubmitUserInputArgs): Promise<SubmitUserInputResult>;
1996
+ /**
1997
+ * Replace this user's agent-authorisation policy (`tee:user/contracts` →
1998
+ * `agent-auth-update`). The supplied document IS the new state: an empty
1999
+ * `agents` array revokes all agent access.
2000
+ *
2001
+ * Typed wrapper over the raw contract call: callers pass
2002
+ * camelCase input; the SDK emits the canonical snake_case wire
2003
+ * (`agent_did` / `script_name` / `version_req` / `allowed_hosts`), so it no
2004
+ * longer relies on the contract's compatibility aliases.
2005
+ *
2006
+ * @throws {RpcError} if the contract rejects the policy (validation failure,
2007
+ * too many agents/grants).
2008
+ */
2009
+ agentAuthUpdate(input: AgentAuthUpdateInput): Promise<void>;
1973
2010
  /**
1974
2011
  * Convenience helper: run the explicit OTP roundtrip and submit
1975
2012
  * the slim user-upsert in one call.
@@ -3493,6 +3530,15 @@ declare class TenantClient {
3493
3530
  readonly contracts: TenantContractsNamespace;
3494
3531
  readonly token: TenantTokenNamespace;
3495
3532
  constructor(config: TenantClientConfig);
3533
+ /**
3534
+ * Validate up front that every config field an operation needs is present,
3535
+ * throwing ONE error naming all missing fields instead of
3536
+ * discovering them one runtime error at a time. All `TenantClientConfig`
3537
+ * fields are optional by design (a control-plane-only client legitimately
3538
+ * omits some), so validation is per-operation against that op's true
3539
+ * dependency set — never an eager constructor check.
3540
+ */
3541
+ requireConfig(op: string, fields: Array<keyof TenantClientConfig>): void;
3496
3542
  /**
3497
3543
  * Admit an org-owned tenant via the cluster-admin `tenant.admit-for-org`
3498
3544
  * action.
@@ -3536,4 +3582,4 @@ declare function validateTail(tail: string): string;
3536
3582
  declare function canonicalTenantName(tenantDid: string, tail: string): string;
3537
3583
 
3538
3584
  export { AGENT_PUBKEY_LEN, AuthMethod, AuthenticationError, BASE_UNITS_PER_TOKEN, ContractResponseError, DEFAULT_INDIVIDUAL_THRESHOLD_CENTS, DEFAULT_KYC_POLL_CADENCE, DELEGATION_CREDENTIAL_DOMAIN, DELEGATION_INVOCATION_DOMAIN, DelegationCustodialClient, ETH_SIG_LEN, HandshakeError, HttpTransport, KycStatusTimeoutError, LogLevel, MAX_FUNCTIONS_PER_CREDENTIAL, MockTransport, NODE_URLS, NONCE_LEN, OrgDataClient, OtpRateLimitedError, REQUEST_HASH_LEN, RpcError, SessionExpiredError, SessionOrgDataClient, SessionStateError, SessionStatus, T3nClient, T3nError, TERMINAL_KYC_STATUSES, TOKEN_DECIMALS, TenantClient, TenantContractsNamespace, TenantMapsNamespace, TenantNamespace, TenantSdkValidationError, TenantTokenNamespace, UnsupportedTenantSdkOperationError, UserUpsertError, VC_ID_LEN, WasmError, Z_PAYROLL_AUDIT_READ_FUNCTIONS, Z_PAYROLL_RUN_FUNCTIONS, _b64uEncode, assertShape, b64uDecodeStrict, b64uEncodeBytes, buildDelegationCredential, buildInvocationPreimage, buildPayrollDirectInvocation, buildPayrollInvocation, bytesToString, canonicalTenantName, canonicaliseCredential, canonicaliseRequest, clearKeyCache, compactDidFromBytes, createDefaultHandlers, createEmailOtpAuthInput, createEthAuthInput, createLogger, createMlKemPublicKeyHandler, createOidcAuthInput, createOrgDataClientFromSession, createRandomHandler, decodeWasmErrorMessage, eip191Digest, ethRecoverEip191, eth_get_address, extractWasmError, fetchDkgAttestation, fetchMlKemPublicKey, formatTokens, generateRandomString, generateUUID, getEnvironment, getEnvironmentName, getGlobalLogLevel, getLogger, getNodeUrl, getScriptVersion, isDataGetResponse, isDataListResponse, isMutationResponse, isObject, isOrgContractGrants, isOrgPolicyMeta, isOrgPolicyView, isOrgWriters, loadConfig, loadWasmComponent, maskKeyMaterial, metamask_get_address, metamask_sign, parseContractResponse, redactSecrets, redactSecretsFromJson, requestHash, revokeDelegation, setEnvironment, setGlobalLogLevel, setNodeUrl, signAgentInvocation, signCredential, stringToBytes, tenantDidHex, toBaseUnits, validateConfig, validateCredentialBody, validateTail, verifyDkgAttestation, verifyTdxQuote };
3539
- export type { AdmitForOrgOptions, AuthInput, BalanceRow, BuildDelegationCredentialOpts, BuildPayrollDirectInvocationOpts, BuildPayrollInvocationOpts, ChargeReason, ClientAuth, ClientHandshake, ConfigValidationResult, ContractExecuteInput, ContractPublishInput, ContractRegisterResult, ContractResponseSchema, CreatePolicyInput, DataGetInput, DataGetResponse, DataListInput, DataListResponse, DelegationCredential, DelegationCustodialClientOpts, DelegationEnvelope, DeleteDataInput, DeleteGrantsInput, DeleteScopeInput, Did, Direction, DkgAttestation, DkgVerifyResult, EmailOtpAuthInput, EmailOtpCredentials, Environment, EthAuthInput, ExecuteBusinessContractOptions, ExecuteOrgDataActionOptions, GetUsageOptions, GrantsGetInput, GuestToHostHandler, GuestToHostHandlers, HandshakeResult, JsonRpcRequest, JsonRpcResponse, KycPollCadence, KycPollOptions, KycStatus, KycStatusKind, Logger, MapCreateInput, MapResponse, MapUpdateInput, MapVisibility, MutationResponse, OidcAuthInput, OidcCredentials, OrgContractGrants, OrgDataActionWire, OrgDataClientOptions, OrgPolicyMeta, OrgPolicyView, OrgWriters, OtpChannel, OtpMergeSuggestion, OtpRequestInput, OtpRequestResult, OtpVerifyInput, OtpVerifyResult, PayrollInvocation, PayrollInvocationDelegated, PayrollInvocationDirect, PayrollRunRequest, PeerQuoteResult, PolicyGetInput, QuoteVerifyResult, ReaderSet, RevokeDelegationOpts, RevokeDelegationResult, SdkConfig, SessionCrypto, SessionId, SetGrantsInput, SetWritersInput, SignCustodialResult, SignDelegationResponse, SubmitUserInputArgs, SubmitUserInputResult, T3nClientConfig, TenantAdmitProjection, TenantAdmitStatus, TenantBaseClient, TenantClientConfig, TenantContractExecuteInput, TenantContractPublishInput, TenantExecutionSession, TenantMapCreateInput, TenantMapUpdatePatch, TenantMeResponse, TenantSdkEnvironment, TenantSelfAdmitResult, TenantStatus, TenantTargetOptions, TokenTxKind, Transport, UpdateMetaInput, UsageEntry, UsagePage, UserGrant, UserInputProfile, UserUpsertErrorKind, WasmComponent, WasmNextResult, WriteDataInput, WriterSet, WritersGetInput };
3585
+ export type { AdmitForOrgOptions, AgentAuthUpdateInput, AgentGrantInput, AgentScriptGrant, AuthInput, BalanceRow, BuildDelegationCredentialOpts, BuildPayrollDirectInvocationOpts, BuildPayrollInvocationOpts, ChargeReason, ClientAuth, ClientHandshake, ConfigValidationResult, ContractExecuteInput, ContractPublishInput, ContractRegisterResult, ContractResponseSchema, CreatePolicyInput, DataGetInput, DataGetResponse, DataListInput, DataListResponse, DelegationCredential, DelegationCustodialClientOpts, DelegationEnvelope, DeleteDataInput, DeleteGrantsInput, DeleteScopeInput, Did, Direction, DkgAttestation, DkgVerifyResult, EmailOtpAuthInput, EmailOtpCredentials, Environment, EthAuthInput, ExecuteBusinessContractOptions, ExecuteOrgDataActionOptions, GetUsageOptions, GrantsGetInput, GuestToHostHandler, GuestToHostHandlers, HandshakeResult, JsonRpcRequest, JsonRpcResponse, KycPollCadence, KycPollOptions, KycStatus, KycStatusKind, Logger, MapCreateInput, MapResponse, MapUpdateInput, MapVisibility, MutationResponse, OidcAuthInput, OidcCredentials, OrgContractGrants, OrgDataActionWire, OrgDataClientOptions, OrgPolicyMeta, OrgPolicyView, OrgWriters, OtpChannel, OtpMergeSuggestion, OtpRequestInput, OtpRequestResult, OtpVerifyInput, OtpVerifyResult, PayrollInvocation, PayrollInvocationDelegated, PayrollInvocationDirect, PayrollRunRequest, PeerQuoteResult, PolicyGetInput, QuoteVerifyResult, ReaderSet, RevokeDelegationOpts, RevokeDelegationResult, SdkConfig, SessionCrypto, SessionId, SetGrantsInput, SetWritersInput, SignCustodialResult, SignDelegationResponse, SubmitUserInputArgs, SubmitUserInputResult, T3nClientConfig, TenantAdmitProjection, TenantAdmitStatus, TenantBaseClient, TenantClientConfig, TenantContractExecuteInput, TenantContractPublishInput, TenantExecutionSession, TenantMapCreateInput, TenantMapUpdatePatch, TenantMeResponse, TenantSdkEnvironment, TenantSelfAdmitResult, TenantStatus, TenantTargetOptions, TokenTxKind, Transport, UpdateMetaInput, UsageEntry, UsagePage, UserGrant, UserInputProfile, UserUpsertErrorKind, WasmComponent, WasmNextResult, WriteDataInput, WriterSet, WritersGetInput };