@terminal3/t3n-sdk 3.13.0 → 3.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/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.
@@ -3293,15 +3330,23 @@ interface TenantSelfAdmitResult {
3293
3330
  granted_credits: number | null;
3294
3331
  }
3295
3332
  type MapVisibility = string;
3296
- type WriterSet = "all" | "All" | {
3333
+ /**
3334
+ * Who may write a map. Canonical wire shape on both input and response is
3335
+ * `"all" | { only: number[] }` (the contract enum is
3336
+ * `#[serde(rename_all = "snake_case")]` with no aliases, so PascalCase forms
3337
+ * like `"All"` / `{ Only }` are rejected on input).
3338
+ */
3339
+ type WriterSet = "all" | {
3297
3340
  only: number[];
3298
- } | {
3299
- Only: number[];
3300
3341
  };
3301
- type ReaderSet = "all" | "All" | {
3342
+ /**
3343
+ * Who may read a map. Canonical wire shape on both input and response is
3344
+ * `"all" | { only: number[] }` (the contract enum is
3345
+ * `#[serde(rename_all = "snake_case")]` with no aliases, so PascalCase forms
3346
+ * like `"All"` / `{ Only }` are rejected on input).
3347
+ */
3348
+ type ReaderSet = "all" | {
3302
3349
  only: number[];
3303
- } | {
3304
- Only: number[];
3305
3350
  };
3306
3351
  interface MapCreateInput {
3307
3352
  tail: string;
@@ -3493,6 +3538,15 @@ declare class TenantClient {
3493
3538
  readonly contracts: TenantContractsNamespace;
3494
3539
  readonly token: TenantTokenNamespace;
3495
3540
  constructor(config: TenantClientConfig);
3541
+ /**
3542
+ * Validate up front that every config field an operation needs is present,
3543
+ * throwing ONE error naming all missing fields instead of
3544
+ * discovering them one runtime error at a time. All `TenantClientConfig`
3545
+ * fields are optional by design (a control-plane-only client legitimately
3546
+ * omits some), so validation is per-operation against that op's true
3547
+ * dependency set — never an eager constructor check.
3548
+ */
3549
+ requireConfig(op: string, fields: Array<keyof TenantClientConfig>): void;
3496
3550
  /**
3497
3551
  * Admit an org-owned tenant via the cluster-admin `tenant.admit-for-org`
3498
3552
  * action.
@@ -3536,4 +3590,4 @@ declare function validateTail(tail: string): string;
3536
3590
  declare function canonicalTenantName(tenantDid: string, tail: string): string;
3537
3591
 
3538
3592
  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 };
3593
+ 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 };