@terminal3/t3n-sdk 4.42.0 → 4.43.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
@@ -1523,6 +1523,24 @@ declare function mergeGrants(existing: BoundGrant[], additions: BoundGrant[]): G
1523
1523
  * dedupe).
1524
1524
  */
1525
1525
  declare function mergeDiscoverDids(existing: string[], additions: string[]): string[];
1526
+ /**
1527
+ * One target for the batch remove-grants op
1528
+ * ({@link T3nClient.removeMemberDelegationGrants}). Mirrors the contract
1529
+ * `RemoveTarget` wire shape verbatim (snake_case): a `grantee` DID and, when
1530
+ * removing a single contract's grant, its `contract_id`.
1531
+ *
1532
+ * Omit `contract_id` to remove the WHOLE delegatee edge — every direct grant to
1533
+ * that grantee plus its discovery authority (the org-owned `roles` slot
1534
+ * survives). The removed ids are opaque: the contract validates nothing, so this
1535
+ * doubles as the cleanup path for a legacy-invalid grant a validating write
1536
+ * could no longer touch.
1537
+ */
1538
+ interface RemoveTarget {
1539
+ /** The delegatee (`did:t3n:<40-hex>`) whose grant(s) are being removed. */
1540
+ grantee: string;
1541
+ /** The single contract to drop; omit to remove the whole delegatee edge. */
1542
+ contract_id?: string;
1543
+ }
1526
1544
 
1527
1545
  /**
1528
1546
  * Agent-auth grants — the pre-collapse (camelCase) delegation surface, retained
@@ -3505,6 +3523,56 @@ declare class T3nClient {
3505
3523
  * @deprecated Use {@link T3nClient.memberDelegationUpdate}.
3506
3524
  */
3507
3525
  agentAuthUpdate(input: AgentAuthUpdateInput): Promise<void>;
3526
+ /**
3527
+ * Add a batch of grants to the caller's own delegation edges
3528
+ * (`tee:authorisations/contracts` → `member-delegation-add-grants`,
3529
+ * **SelfOnly**). A surgical, additive write: it dispatches the supplied list
3530
+ * as-is and does NOT read-merge — contrast {@link updateMemberDelegation},
3531
+ * which reads the whole document, merges one grant, and writes it back. A
3532
+ * batch of one is a point add; a longer list adds across several delegatees in
3533
+ * one atomic call.
3534
+ *
3535
+ * Each grant is upserted onto its `grantee`'s edge by `contract_id`, so the
3536
+ * delegatee's other contracts' grants survive untouched. Because this never
3537
+ * reads the stored document, a legacy-invalid grant elsewhere in the member's
3538
+ * delegation cannot block the add — but the contract validates every grant in
3539
+ * the submitted batch server-side (grammar, per-delegatee and per-document
3540
+ * caps, validity policy), so one malformed grant rejects the whole batch and
3541
+ * nothing is written.
3542
+ *
3543
+ * The {@link BoundGrant} rows are the flat snake_case wire shape, passed
3544
+ * through verbatim. Each carries the `grantee` DID it authorises and its own
3545
+ * `contract_id`.
3546
+ *
3547
+ * @param grants - the grants to add, each a {@link BoundGrant} naming its
3548
+ * delegatee `grantee` and target `contract_id`
3549
+ * @param options - optional `discoverDids` unioned onto every touched edge
3550
+ * (never replaced or cleared) — org DIDs for org-mode `listContracts`, the
3551
+ * caller's own DID for self mode
3552
+ * @throws {RpcError} if the contract rejects any grant in the batch
3553
+ * (validation failure, too many delegatees/grants).
3554
+ */
3555
+ addMemberDelegationGrants(grants: BoundGrant[], options?: {
3556
+ discoverDids?: string[];
3557
+ }): Promise<void>;
3558
+ /**
3559
+ * Remove a batch of grants from the caller's own delegation edges
3560
+ * (`tee:authorisations/contracts` → `member-delegation-remove-grants`,
3561
+ * **SelfOnly**). A surgical, subtractive write with no read-merge: it
3562
+ * dispatches the target list as-is. A batch of one is a point removal; a
3563
+ * longer list removes across several delegatees in one atomic call.
3564
+ *
3565
+ * The removed ids are opaque — the contract validates nothing — so this also
3566
+ * clears a legacy-invalid grant (a bad `contract_id`) that a validating write
3567
+ * could no longer touch. Each {@link RemoveTarget} names a `grantee`; supply a
3568
+ * `contract_id` to drop that single contract's grant, or omit it to remove the
3569
+ * whole delegatee edge (its direct grants and discovery authority; the
3570
+ * org-owned `roles` slot survives).
3571
+ *
3572
+ * @param targets - the `(grantee[, contract_id])` targets to remove
3573
+ * @throws {RpcError} if the contract refuses the removal.
3574
+ */
3575
+ removeMemberDelegationGrants(targets: RemoveTarget[]): Promise<void>;
3508
3576
  /**
3509
3577
  * Convenience helper: run the explicit OTP roundtrip and submit
3510
3578
  * the slim user-upsert in one call.
@@ -4118,6 +4186,44 @@ interface DeleteGrantsInput {
4118
4186
  orgDid: string;
4119
4187
  contractId: string;
4120
4188
  }
4189
+ /**
4190
+ * Add a batch of org→grantee grants via {@link OrgDataClient.addDelegationGrants}.
4191
+ *
4192
+ * Unlike {@link OrgDelegationSetInput} (a full per-contract replacement), each
4193
+ * grant here self-describes: it carries its own `grantee` and `contract_id`, so
4194
+ * one batch can add grants across several contracts and grantees in a single
4195
+ * atomic call — each touching only the edge it names. The contract validates
4196
+ * only each submitted grant body (never the stored record), so a legacy-invalid
4197
+ * sibling on a target grantee's edge cannot block the add. Org grants confer
4198
+ * only `functions` + `scopes`; the agent-edge qualifiers on {@link BoundGrant}
4199
+ * (`version_req` / `read_scopes` / `allowed_hosts` / `window`) must be left unset
4200
+ * — the contract rejects a grant that sets them.
4201
+ */
4202
+ interface OrgDelegationAddGrantsInput {
4203
+ orgDid: string;
4204
+ grants: BoundGrant[];
4205
+ }
4206
+ /**
4207
+ * One `(grantee, contract_id)` grant to drop via
4208
+ * {@link OrgDataClient.removeDelegationGrants}. Both fields are required — unlike
4209
+ * the member-delegation remove target, the org edge has no whole-delegatee
4210
+ * removal in this batch op. The id is opaque (nothing is validated), so a
4211
+ * legacy-invalid grant can be cleaned up.
4212
+ */
4213
+ interface OrgRemoveGrantTarget {
4214
+ grantee: string;
4215
+ contractId: string;
4216
+ }
4217
+ /**
4218
+ * Remove a batch of org→grantee grants via
4219
+ * {@link OrgDataClient.removeDelegationGrants}. Each target names a
4220
+ * `(grantee, contractId)` pair; the removals span several contracts and grantees
4221
+ * in one atomic call, touching only the edges they name.
4222
+ */
4223
+ interface OrgDelegationRemoveGrantsInput {
4224
+ orgDid: string;
4225
+ targets: OrgRemoveGrantTarget[];
4226
+ }
4121
4227
  /**
4122
4228
  * Grant or replace the outbound host allow-list an org-owned agent may use
4123
4229
  * while executing one of the org's contracts (org-admin only).
@@ -4443,6 +4549,22 @@ declare class OrgDataClient {
4443
4549
  * @deprecated Use {@link OrgDataClient.setDelegation}.
4444
4550
  */
4445
4551
  setGrants(input: SetGrantsInput): Promise<MutationResponse>;
4552
+ /**
4553
+ * Add a batch of org→grantee grants (org-admin only).
4554
+ *
4555
+ * A surgical, additive write, contrasting {@link setDelegation}'s full
4556
+ * per-contract replacement: each grant carries its own `grantee` and
4557
+ * `contract_id`, so one call adds grants across several contracts and grantees
4558
+ * at once, touching only the edges it names. The contract validates only each
4559
+ * submitted grant body (never the stored record) and persists through a
4560
+ * non-validating edge write, so a legacy-invalid sibling on a target grantee's
4561
+ * edge cannot block the add. The `(org, contract_id)` reverse index is updated
4562
+ * incrementally in the same transaction.
4563
+ *
4564
+ * The {@link BoundGrant} rows are the snake_case wire shape, passed through
4565
+ * verbatim (each already carries its `contract_id`).
4566
+ */
4567
+ addDelegationGrants(input: OrgDelegationAddGrantsInput): Promise<MutationResponse>;
4446
4568
  /**
4447
4569
  * Delete the grant entry for a contract entirely, via the legacy
4448
4570
  * `org-policy-delete-grants` function.
@@ -4450,6 +4572,15 @@ declare class OrgDataClient {
4450
4572
  * @deprecated Use {@link OrgDataClient.deleteDelegation}.
4451
4573
  */
4452
4574
  deleteGrants(input: DeleteGrantsInput): Promise<MutationResponse>;
4575
+ /**
4576
+ * Remove a batch of `(grantee, contract_id)` org grants (org-admin only).
4577
+ *
4578
+ * A surgical, subtractive write: the ids are opaque (nothing is validated, so a
4579
+ * legacy-invalid grant can be cleaned up) and each edge is persisted through a
4580
+ * non-validating write, so a sibling for another contract cannot block the
4581
+ * removal. The reverse index is updated in the same transaction.
4582
+ */
4583
+ removeDelegationGrants(input: OrgDelegationRemoveGrantsInput): Promise<MutationResponse>;
4453
4584
  /**
4454
4585
  * Grant or replace the outbound host allow-list an org-owned agent may use
4455
4586
  * while executing one of the org's contracts (org-admin only).
@@ -4691,12 +4822,16 @@ declare class SessionOrgDataClient {
4691
4822
  * @deprecated Use {@link SessionOrgDataClient.setDelegation}.
4692
4823
  */
4693
4824
  setGrants(input: SetGrantsInput): Promise<MutationResponse>;
4825
+ /** Mirrors {@link OrgDataClient.addDelegationGrants}. */
4826
+ addDelegationGrants(input: OrgDelegationAddGrantsInput): Promise<MutationResponse>;
4694
4827
  /**
4695
4828
  * Mirrors {@link OrgDataClient.deleteGrants}.
4696
4829
  *
4697
4830
  * @deprecated Use {@link SessionOrgDataClient.deleteDelegation}.
4698
4831
  */
4699
4832
  deleteGrants(input: DeleteGrantsInput): Promise<MutationResponse>;
4833
+ /** Mirrors {@link OrgDataClient.removeDelegationGrants}. */
4834
+ removeDelegationGrants(input: OrgDelegationRemoveGrantsInput): Promise<MutationResponse>;
4700
4835
  /**
4701
4836
  * Grant or replace the outbound host allow-list an org-owned agent may use
4702
4837
  * while executing one of the org's contracts (org-admin only).
@@ -5814,4 +5949,4 @@ declare function validateTail(tail: string): string;
5814
5949
  declare function canonicalTenantName(tenantDid: string, tail: string): string;
5815
5950
 
5816
5951
  export { AGENT_CARDS_SCOPE, AuthMethod, AuthenticationError, BASE_UNITS_PER_TOKEN, ContractResponseError, DEFAULT_ENVIRONMENT, DEFAULT_INDIVIDUAL_THRESHOLD_CENTS, DEFAULT_KYC_POLL_CADENCE, HandshakeError, HttpTransport, InvokeError, KycStatusTimeoutError, LogLevel, MockTransport, NODE_URLS, OrgDataClient, OtpRateLimitedError, RpcError, SessionExpiredError, SessionOrgDataClient, SessionStateError, SessionStatus, SessionUsageReportClient, T3nClient, T3nConfigError, 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, buildSecretWriteArgs, bytesToString, canonicalTenantName, clearKeyCache, clearManifestVersionFloor, compactDidFromBytes, createDefaultHandlers, createEmailOtpAuthInput, createEthAuthInput, createLogger, createMlKemPublicKeyHandler, createOidcAuthInput, createOrgDataClientFromSession, createRandomHandler, createUsageReportClientFromSession, createWorkloadAuthInput, decodeWasmErrorMessage, deriveAgentCardEntryId, discoverCheckDelegation, discoverDescribeContract, discoverDescribeFunction, discoverListContracts, discoverWhoami, eth_get_address, extractWasmError, fetchDkgAttestation, fetchMlKemPublicKey, fetchTrustedManifest, formatTokens, generateRandomString, generateUUID, getContractVersion, getEnvironment, getEnvironmentName, getGlobalLogLevel, getLogger, getNodeUrl, invoke, isAgentCardResponse, isAgentEgressGetResponse, isDataGetResponse, isDataListResponse, isListAgentsResponse, isListHumanMembersResponse, isMutationResponse, isObject, isOrgAdminStatus, isOrgContractDelegation, isOrgContractGrants, isOrgPolicyMeta, isOrgPolicyView, isOrgUsageReport, isOrgWriters, isRoleAssignmentsResponse, isRoleGetResponse, isSecretListResponse, isSecretRecord, isSecretView, isUnsafeTrustServer, loadConfig, loadWasmComponent, manifestToTrustAnchor, maskKeyMaterial, mergeAgentAuthEntries, mergeDiscoverDids, mergeGrants, metamask_get_address, metamask_sign, parseAgentAuthGet, parseAgentAuthPolicy, parseContractResponse, parseMemberDelegationDoc, redactSecrets, redactSecretsFromJson, requestToWire, setEnvironment, setGlobalLogLevel, setNodeUrl, stringToBytes, tenantDidHex, toAgentAuthUpdateWire, toBaseUnits, validateConfig, validateTail, verifyDkgAttestation, verifyManifestSignature, verifyTdxQuote };
5817
- export type { ActivityCallerType, ActivityEntry, ActivityOutcome, ActivityReport, AdmitForOrgOptions, AgentAuthEntry, AgentAuthMergeResult, AgentAuthPolicy, AgentAuthScriptGrant, AgentAuthUpdateInput, AgentCardRefInput, AgentCardResponse, AgentCardSetInput, AgentEgressEntry, AgentEgressGetResponse, AgentEgressRefInput, AgentSummary, AssignRolesInput, AuthInput, BalanceRow, BoundGrant, ChargeReason, ClientAuth, ClientHandshake, ConfigValidationResult, ContractDescriptorDocument, ContractDescriptorFacets, ContractExecuteInput, ContractKind, ContractLifecycleStatus, ContractListDetailedOptions, ContractListDetailedPage, ContractPublishInput, ContractRegisterResult, ContractResponseSchema, ContractSetDescriptorInput, CreatePolicyInput, DataGetInput, DataGetResponse, DataListInput, DataListResponse, DelegationGrantKind, DelegationGrantRef, DeleteDataInput, DeleteGrantsInput, DeleteScopeInput, DescribeContractParams, DescribeContractResult, DescribeFunctionParams, DescribeFunctionResult, DetailedContract, Did, Direction, DiscoverOptions, DkgAttestation, DkgVerifyResult, EmailOtpAuthInput, EmailOtpCredentials, Environment, EthAuthInput, ExecuteBusinessContractOptions, ExecuteOrgDataActionOptions, FetchTrustedManifestOptions, FunctionDescriptorEntry, GetActivityLogOptions, GetUsageOptions, GrantCheckParams, GrantCheckResult, GranteeInput, GrantsGetInput, GrantsMergeResult, GuestToHostHandler, GuestToHostHandlers, HandshakeResult, HumanMember, InvokeOptions, InvokeRequest, JsonRpcRequest, JsonRpcResponse, KycPollCadence, KycPollOptions, KycStatus, KycStatusKind, ListAgentsInput, ListAgentsResponse, ListContractsParams, ListContractsResult, ListContractsScope, ListHumanMembersInput, ListHumanMembersResponse, ListedContract, Logger, MapCreateInput, MapLifecycleStatus, MapResponse, MapUpdateInput, MapVisibility, MemberDelegationDoc, MemberRole, MutationResponse, OidcAuthInput, OidcCredentials, OrgAdminStatus, OrgContractDelegation, OrgContractGrants, OrgDataActionWire, OrgDataClientOptions, OrgDelegationDeleteInput, OrgDelegationGetInput, OrgDelegationSetInput, OrgPolicyMeta, OrgPolicyView, OrgRemoveMemberDelegationInput, OrgUsageReport, OrgUsageReportInput, OrgWriters, OtpChannel, OtpMergeSuggestion, OtpRequestInput, OtpRequestResult, OtpVerifyInput, OtpVerifyResult, PayrollRunRequest, PeerQuoteResult, PolicyGetInput, PurgeOrgInput, QuoteVerifyResult, ReaderSet, RemoveMemberGrantsInput, RoleAssignments, RoleAssignmentsResponse, RoleDefinition, RoleGetResponse, RoleGrant, RoleIdInput, SdkConfig, SecretKind, SecretListInput, SecretListResponse, SecretNameInput, SecretRecord, SecretSetValueInput, SecretView, SecretWriteInput, SessionCrypto, SessionId, SetAgentEgressInput, SetGrantsInput, SetRoleInput, SetWritersInput, SignedTrustManifest, StringEncoding, SubmitUserInputArgs, SubmitUserInputResult, T3nClientConfig, TenantAdmitProjection, TenantAdmitStatus, TenantBaseClient, TenantClientConfig, TenantContractExecuteInput, TenantContractPublishInput, TenantContractSetDescriptorInput, TenantExecutionSession, TenantMapCreateInput, TenantMapUpdatePatch, TenantMeResponse, TenantSdkEnvironment, TenantSelfAdmitResult, TenantStatus, TenantTargetOptions, TokenTxKind, Transport, TrustAnchor, TrustAnchorOrUnsafe, TrustAnchorSource, TrustManifestPayload, UnassignRolesInput, UnsafeTrustServer, UpdateMetaInput, UsageEntry, UsagePage, UsageReportSignature, UserGrant, UserInputProfile, UserUpsertErrorKind, Validity, WasmComponent, WasmNextResult, WhoamiResult, WireBlock, WorkloadAuthInput, WriteDataInput, WriterSet, WritersGetInput };
5952
+ export type { ActivityCallerType, ActivityEntry, ActivityOutcome, ActivityReport, AdmitForOrgOptions, AgentAuthEntry, AgentAuthMergeResult, AgentAuthPolicy, AgentAuthScriptGrant, AgentAuthUpdateInput, AgentCardRefInput, AgentCardResponse, AgentCardSetInput, AgentEgressEntry, AgentEgressGetResponse, AgentEgressRefInput, AgentSummary, AssignRolesInput, AuthInput, BalanceRow, BoundGrant, ChargeReason, ClientAuth, ClientHandshake, ConfigValidationResult, ContractDescriptorDocument, ContractDescriptorFacets, ContractExecuteInput, ContractKind, ContractLifecycleStatus, ContractListDetailedOptions, ContractListDetailedPage, ContractPublishInput, ContractRegisterResult, ContractResponseSchema, ContractSetDescriptorInput, CreatePolicyInput, DataGetInput, DataGetResponse, DataListInput, DataListResponse, DelegationGrantKind, DelegationGrantRef, DeleteDataInput, DeleteGrantsInput, DeleteScopeInput, DescribeContractParams, DescribeContractResult, DescribeFunctionParams, DescribeFunctionResult, DetailedContract, Did, Direction, DiscoverOptions, DkgAttestation, DkgVerifyResult, EmailOtpAuthInput, EmailOtpCredentials, Environment, EthAuthInput, ExecuteBusinessContractOptions, ExecuteOrgDataActionOptions, FetchTrustedManifestOptions, FunctionDescriptorEntry, GetActivityLogOptions, GetUsageOptions, GrantCheckParams, GrantCheckResult, GranteeInput, GrantsGetInput, GrantsMergeResult, GuestToHostHandler, GuestToHostHandlers, HandshakeResult, HumanMember, InvokeOptions, InvokeRequest, JsonRpcRequest, JsonRpcResponse, KycPollCadence, KycPollOptions, KycStatus, KycStatusKind, ListAgentsInput, ListAgentsResponse, ListContractsParams, ListContractsResult, ListContractsScope, ListHumanMembersInput, ListHumanMembersResponse, ListedContract, Logger, MapCreateInput, MapLifecycleStatus, MapResponse, MapUpdateInput, MapVisibility, MemberDelegationDoc, MemberRole, MutationResponse, OidcAuthInput, OidcCredentials, OrgAdminStatus, OrgContractDelegation, OrgContractGrants, OrgDataActionWire, OrgDataClientOptions, OrgDelegationAddGrantsInput, OrgDelegationDeleteInput, OrgDelegationGetInput, OrgDelegationRemoveGrantsInput, OrgDelegationSetInput, OrgPolicyMeta, OrgPolicyView, OrgRemoveGrantTarget, OrgRemoveMemberDelegationInput, OrgUsageReport, OrgUsageReportInput, OrgWriters, OtpChannel, OtpMergeSuggestion, OtpRequestInput, OtpRequestResult, OtpVerifyInput, OtpVerifyResult, PayrollRunRequest, PeerQuoteResult, PolicyGetInput, PurgeOrgInput, QuoteVerifyResult, ReaderSet, RemoveMemberGrantsInput, RemoveTarget, RoleAssignments, RoleAssignmentsResponse, RoleDefinition, RoleGetResponse, RoleGrant, RoleIdInput, SdkConfig, SecretKind, SecretListInput, SecretListResponse, SecretNameInput, SecretRecord, SecretSetValueInput, SecretView, SecretWriteInput, SessionCrypto, SessionId, SetAgentEgressInput, SetGrantsInput, SetRoleInput, SetWritersInput, SignedTrustManifest, StringEncoding, SubmitUserInputArgs, SubmitUserInputResult, T3nClientConfig, TenantAdmitProjection, TenantAdmitStatus, TenantBaseClient, TenantClientConfig, TenantContractExecuteInput, TenantContractPublishInput, TenantContractSetDescriptorInput, TenantExecutionSession, TenantMapCreateInput, TenantMapUpdatePatch, TenantMeResponse, TenantSdkEnvironment, TenantSelfAdmitResult, TenantStatus, TenantTargetOptions, TokenTxKind, Transport, TrustAnchor, TrustAnchorOrUnsafe, TrustAnchorSource, TrustManifestPayload, UnassignRolesInput, UnsafeTrustServer, UpdateMetaInput, UsageEntry, UsagePage, UsageReportSignature, UserGrant, UserInputProfile, UserUpsertErrorKind, Validity, WasmComponent, WasmNextResult, WhoamiResult, WireBlock, WorkloadAuthInput, WriteDataInput, WriterSet, WritersGetInput };