@terminal3/t3n-sdk 4.42.0 → 4.43.1

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
@@ -2861,7 +2879,9 @@ declare class T3nClient {
2861
2879
  * filters with every page; changing them mid-walk changes what the cursor
2862
2880
  * means. Because a filter narrows what comes back rather than what the node
2863
2881
  * scans, short and empty pages are the normal case — page until `next_seq` is
2864
- * `null`.
2882
+ * `null`. An empty or whitespace-only string filter is treated as unset and
2883
+ * never sent: a cleared search box means "no filter", and the node rejects an
2884
+ * empty needle rather than matching everything.
2865
2885
  *
2866
2886
  * ```ts
2867
2887
  * // Everything one agent did, or had done in its name, that was refused.
@@ -3505,6 +3525,56 @@ declare class T3nClient {
3505
3525
  * @deprecated Use {@link T3nClient.memberDelegationUpdate}.
3506
3526
  */
3507
3527
  agentAuthUpdate(input: AgentAuthUpdateInput): Promise<void>;
3528
+ /**
3529
+ * Add a batch of grants to the caller's own delegation edges
3530
+ * (`tee:authorisations/contracts` → `member-delegation-add-grants`,
3531
+ * **SelfOnly**). A surgical, additive write: it dispatches the supplied list
3532
+ * as-is and does NOT read-merge — contrast {@link updateMemberDelegation},
3533
+ * which reads the whole document, merges one grant, and writes it back. A
3534
+ * batch of one is a point add; a longer list adds across several delegatees in
3535
+ * one atomic call.
3536
+ *
3537
+ * Each grant is upserted onto its `grantee`'s edge by `contract_id`, so the
3538
+ * delegatee's other contracts' grants survive untouched. Because this never
3539
+ * reads the stored document, a legacy-invalid grant elsewhere in the member's
3540
+ * delegation cannot block the add — but the contract validates every grant in
3541
+ * the submitted batch server-side (grammar, per-delegatee and per-document
3542
+ * caps, validity policy), so one malformed grant rejects the whole batch and
3543
+ * nothing is written.
3544
+ *
3545
+ * The {@link BoundGrant} rows are the flat snake_case wire shape, passed
3546
+ * through verbatim. Each carries the `grantee` DID it authorises and its own
3547
+ * `contract_id`.
3548
+ *
3549
+ * @param grants - the grants to add, each a {@link BoundGrant} naming its
3550
+ * delegatee `grantee` and target `contract_id`
3551
+ * @param options - optional `discoverDids` unioned onto every touched edge
3552
+ * (never replaced or cleared) — org DIDs for org-mode `listContracts`, the
3553
+ * caller's own DID for self mode
3554
+ * @throws {RpcError} if the contract rejects any grant in the batch
3555
+ * (validation failure, too many delegatees/grants).
3556
+ */
3557
+ addMemberDelegationGrants(grants: BoundGrant[], options?: {
3558
+ discoverDids?: string[];
3559
+ }): Promise<void>;
3560
+ /**
3561
+ * Remove a batch of grants from the caller's own delegation edges
3562
+ * (`tee:authorisations/contracts` → `member-delegation-remove-grants`,
3563
+ * **SelfOnly**). A surgical, subtractive write with no read-merge: it
3564
+ * dispatches the target list as-is. A batch of one is a point removal; a
3565
+ * longer list removes across several delegatees in one atomic call.
3566
+ *
3567
+ * The removed ids are opaque — the contract validates nothing — so this also
3568
+ * clears a legacy-invalid grant (a bad `contract_id`) that a validating write
3569
+ * could no longer touch. Each {@link RemoveTarget} names a `grantee`; supply a
3570
+ * `contract_id` to drop that single contract's grant, or omit it to remove the
3571
+ * whole delegatee edge (its direct grants and discovery authority; the
3572
+ * org-owned `roles` slot survives).
3573
+ *
3574
+ * @param targets - the `(grantee[, contract_id])` targets to remove
3575
+ * @throws {RpcError} if the contract refuses the removal.
3576
+ */
3577
+ removeMemberDelegationGrants(targets: RemoveTarget[]): Promise<void>;
3508
3578
  /**
3509
3579
  * Convenience helper: run the explicit OTP roundtrip and submit
3510
3580
  * the slim user-upsert in one call.
@@ -4118,6 +4188,44 @@ interface DeleteGrantsInput {
4118
4188
  orgDid: string;
4119
4189
  contractId: string;
4120
4190
  }
4191
+ /**
4192
+ * Add a batch of org→grantee grants via {@link OrgDataClient.addDelegationGrants}.
4193
+ *
4194
+ * Unlike {@link OrgDelegationSetInput} (a full per-contract replacement), each
4195
+ * grant here self-describes: it carries its own `grantee` and `contract_id`, so
4196
+ * one batch can add grants across several contracts and grantees in a single
4197
+ * atomic call — each touching only the edge it names. The contract validates
4198
+ * only each submitted grant body (never the stored record), so a legacy-invalid
4199
+ * sibling on a target grantee's edge cannot block the add. Org grants confer
4200
+ * only `functions` + `scopes`; the agent-edge qualifiers on {@link BoundGrant}
4201
+ * (`version_req` / `read_scopes` / `allowed_hosts` / `window`) must be left unset
4202
+ * — the contract rejects a grant that sets them.
4203
+ */
4204
+ interface OrgDelegationAddGrantsInput {
4205
+ orgDid: string;
4206
+ grants: BoundGrant[];
4207
+ }
4208
+ /**
4209
+ * One `(grantee, contract_id)` grant to drop via
4210
+ * {@link OrgDataClient.removeDelegationGrants}. Both fields are required — unlike
4211
+ * the member-delegation remove target, the org edge has no whole-delegatee
4212
+ * removal in this batch op. The id is opaque (nothing is validated), so a
4213
+ * legacy-invalid grant can be cleaned up.
4214
+ */
4215
+ interface OrgRemoveGrantTarget {
4216
+ grantee: string;
4217
+ contractId: string;
4218
+ }
4219
+ /**
4220
+ * Remove a batch of org→grantee grants via
4221
+ * {@link OrgDataClient.removeDelegationGrants}. Each target names a
4222
+ * `(grantee, contractId)` pair; the removals span several contracts and grantees
4223
+ * in one atomic call, touching only the edges they name.
4224
+ */
4225
+ interface OrgDelegationRemoveGrantsInput {
4226
+ orgDid: string;
4227
+ targets: OrgRemoveGrantTarget[];
4228
+ }
4121
4229
  /**
4122
4230
  * Grant or replace the outbound host allow-list an org-owned agent may use
4123
4231
  * while executing one of the org's contracts (org-admin only).
@@ -4443,6 +4551,22 @@ declare class OrgDataClient {
4443
4551
  * @deprecated Use {@link OrgDataClient.setDelegation}.
4444
4552
  */
4445
4553
  setGrants(input: SetGrantsInput): Promise<MutationResponse>;
4554
+ /**
4555
+ * Add a batch of org→grantee grants (org-admin only).
4556
+ *
4557
+ * A surgical, additive write, contrasting {@link setDelegation}'s full
4558
+ * per-contract replacement: each grant carries its own `grantee` and
4559
+ * `contract_id`, so one call adds grants across several contracts and grantees
4560
+ * at once, touching only the edges it names. The contract validates only each
4561
+ * submitted grant body (never the stored record) and persists through a
4562
+ * non-validating edge write, so a legacy-invalid sibling on a target grantee's
4563
+ * edge cannot block the add. The `(org, contract_id)` reverse index is updated
4564
+ * incrementally in the same transaction.
4565
+ *
4566
+ * The {@link BoundGrant} rows are the snake_case wire shape, passed through
4567
+ * verbatim (each already carries its `contract_id`).
4568
+ */
4569
+ addDelegationGrants(input: OrgDelegationAddGrantsInput): Promise<MutationResponse>;
4446
4570
  /**
4447
4571
  * Delete the grant entry for a contract entirely, via the legacy
4448
4572
  * `org-policy-delete-grants` function.
@@ -4450,6 +4574,15 @@ declare class OrgDataClient {
4450
4574
  * @deprecated Use {@link OrgDataClient.deleteDelegation}.
4451
4575
  */
4452
4576
  deleteGrants(input: DeleteGrantsInput): Promise<MutationResponse>;
4577
+ /**
4578
+ * Remove a batch of `(grantee, contract_id)` org grants (org-admin only).
4579
+ *
4580
+ * A surgical, subtractive write: the ids are opaque (nothing is validated, so a
4581
+ * legacy-invalid grant can be cleaned up) and each edge is persisted through a
4582
+ * non-validating write, so a sibling for another contract cannot block the
4583
+ * removal. The reverse index is updated in the same transaction.
4584
+ */
4585
+ removeDelegationGrants(input: OrgDelegationRemoveGrantsInput): Promise<MutationResponse>;
4453
4586
  /**
4454
4587
  * Grant or replace the outbound host allow-list an org-owned agent may use
4455
4588
  * while executing one of the org's contracts (org-admin only).
@@ -4691,12 +4824,16 @@ declare class SessionOrgDataClient {
4691
4824
  * @deprecated Use {@link SessionOrgDataClient.setDelegation}.
4692
4825
  */
4693
4826
  setGrants(input: SetGrantsInput): Promise<MutationResponse>;
4827
+ /** Mirrors {@link OrgDataClient.addDelegationGrants}. */
4828
+ addDelegationGrants(input: OrgDelegationAddGrantsInput): Promise<MutationResponse>;
4694
4829
  /**
4695
4830
  * Mirrors {@link OrgDataClient.deleteGrants}.
4696
4831
  *
4697
4832
  * @deprecated Use {@link SessionOrgDataClient.deleteDelegation}.
4698
4833
  */
4699
4834
  deleteGrants(input: DeleteGrantsInput): Promise<MutationResponse>;
4835
+ /** Mirrors {@link OrgDataClient.removeDelegationGrants}. */
4836
+ removeDelegationGrants(input: OrgDelegationRemoveGrantsInput): Promise<MutationResponse>;
4700
4837
  /**
4701
4838
  * Grant or replace the outbound host allow-list an org-owned agent may use
4702
4839
  * while executing one of the org's contracts (org-admin only).
@@ -5814,4 +5951,4 @@ declare function validateTail(tail: string): string;
5814
5951
  declare function canonicalTenantName(tenantDid: string, tail: string): string;
5815
5952
 
5816
5953
  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 };
5954
+ 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 };