@terminal3/t3n-sdk 5.23.1 → 5.25.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
@@ -2500,6 +2500,13 @@ interface ActivityEntry {
2500
2500
  * validated one.
2501
2501
  */
2502
2502
  roles?: string[];
2503
+ /**
2504
+ * Labels the contract chose for this call — the `custom` object it returned
2505
+ * in its response, which the node removes from the response and stores on
2506
+ * the entry. Flat string → string, capped node-side. Omitted when the
2507
+ * contract returned none, and always on `denied` / `error`.
2508
+ */
2509
+ custom?: Record<string, string>;
2503
2510
  }
2504
2511
  /**
2505
2512
  * One page of the organisation's activity report — **newest first**, i.e.
@@ -2576,6 +2583,17 @@ interface GetActivityLogOptions {
2576
2583
  * substring, compared case-insensitively. Must not be empty.
2577
2584
  */
2578
2585
  function?: string;
2586
+ /**
2587
+ * Keep only calls whose {@link ActivityEntry.custom} labels carry every one
2588
+ * of these pairs, compared exactly. A call without labels never matches.
2589
+ * Must name at least one key; keys and values must not be empty.
2590
+ */
2591
+ custom?: Record<string, string>;
2592
+ /**
2593
+ * `true` keeps only calls carrying at least one `custom` label, `false` only
2594
+ * those carrying none.
2595
+ */
2596
+ has_custom?: boolean;
2579
2597
  }
2580
2598
  /**
2581
2599
  * Params for a CSV export of the activity log (`exportActivityLog`).
@@ -2610,7 +2628,8 @@ interface ActivityExportFile {
2610
2628
  /**
2611
2629
  * The CSV text, header row first. Columns are fixed: `seq_no`, `timestamp_ms`,
2612
2630
  * `caller_type`, `actor`, `on_behalf_of`, `org`, `contract`, `function`,
2613
- * `outcome`. For a browser download, wrap it in a `Blob` and click
2631
+ * `outcome`, `custom` (the entry's labels as one JSON object, empty when
2632
+ * none). For a browser download, wrap it in a `Blob` and click
2614
2633
  * an `<a download>` — the response is sealed, so there is no URL to navigate.
2615
2634
  */
2616
2635
  csv: string;
@@ -2822,6 +2841,28 @@ interface DescribeFunctionResult {
2822
2841
  * All cryptographic complexity is handled in WASM components.
2823
2842
  */
2824
2843
 
2844
+ /** Input to {@link T3nClient.createDelegatedAgent}. */
2845
+ interface CreateDelegatedAgentParams {
2846
+ /**
2847
+ * Label of the node's configured OIDC provider (`Configs[provider:oidc]`)
2848
+ * the token is verified against. Its configured `client_id` is the audience,
2849
+ * so it must be the harness's client.
2850
+ */
2851
+ provider: string;
2852
+ /** The caller's own ID token, issued by `provider` to the harness's client. */
2853
+ harnessIdToken: string;
2854
+ /** OAuth client the agent will authenticate as: the `azp` its tokens carry. */
2855
+ clientId: string;
2856
+ /** Display name, e.g. "Maria's Claude Agent". */
2857
+ name: string;
2858
+ }
2859
+ /** A delegated per-user agent, as `create-delegated-agent` reports it. */
2860
+ interface DelegatedAgent {
2861
+ agentDid: Did;
2862
+ ownerDid: Did;
2863
+ /** The name as stored, which the contract may have truncated. */
2864
+ name: string;
2865
+ }
2825
2866
  declare class T3nClient {
2826
2867
  private readonly config;
2827
2868
  private readonly transport;
@@ -3291,6 +3332,36 @@ declare class T3nClient {
3291
3332
  publicCardDeleted: boolean;
3292
3333
  privateCardDeleted: boolean;
3293
3334
  }>;
3335
+ /**
3336
+ * Create the caller's own delegated agent for an AI harness (AI-261).
3337
+ *
3338
+ * Dispatches `create-delegated-agent` on `tee:organisation/contracts`. The
3339
+ * contract verifies `harnessIdToken` in-enclave against `provider`, requires
3340
+ * its identity to belong to the session's DID, and keys the agent on
3341
+ * `(iss, user_id, clientId)`. So the session must be the person's own human
3342
+ * DID, signed in through an OIDC provider, not an agent's or a stray key's.
3343
+ *
3344
+ * Not idempotent: a second call for the same identity and `clientId` is
3345
+ * refused, and {@link revokeDelegatedAgent} is the only way to retire one.
3346
+ *
3347
+ * @throws {RpcError} when the contract refuses (token verification, a token
3348
+ * belonging to another DID, an existing agent, the per-owner cap)
3349
+ * @throws {ContractResponseError} when the response does not name the agent
3350
+ */
3351
+ createDelegatedAgent(params: CreateDelegatedAgentParams): Promise<DelegatedAgent>;
3352
+ /**
3353
+ * Stop one of the caller's own delegated agents authenticating.
3354
+ *
3355
+ * Dispatches `revoke-delegated-agent` on `tee:organisation/contracts`.
3356
+ * Revocation marks the agent's record; its DID and registry record remain.
3357
+ * Idempotent.
3358
+ *
3359
+ * @throws {RpcError} when the caller owns no delegated agent with that DID
3360
+ * @throws {ContractResponseError} when the response does not name the agent
3361
+ */
3362
+ revokeDelegatedAgent(agentDid: string): Promise<{
3363
+ agentDid: Did;
3364
+ }>;
3294
3365
  /**
3295
3366
  * Provision a fresh org-owned agent.
3296
3367
  *
@@ -3427,6 +3498,8 @@ declare class T3nClient {
3427
3498
  * `did:t3n:<40 hex>` or bare 40 hex.
3428
3499
  */
3429
3500
  private static didToWire;
3501
+ /** Read a DID field (`did:t3n:<40 hex>` or bare hex) from a contract response. */
3502
+ private static didFromResponse;
3430
3503
  /**
3431
3504
  * Resolve the deployed version of `contractId`, refusing before any dispatch
3432
3505
  * when it is older than the caller needs, with a message naming the version the
@@ -6551,4 +6624,4 @@ declare function validateTail(tail: string): string;
6551
6624
  declare function canonicalTenantName(tenantDid: string, tail: string): string;
6552
6625
 
6553
6626
  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, detectQuoteVendor, discoverCheckDelegation, discoverDescribeContract, discoverDescribeFunction, discoverListContracts, discoverWhoami, eth_get_address, extractWasmError, fanOutGrant, fetchDkgAttestation, fetchMlKemPublicKey, fetchSevSnpCollateral, fetchTrustedManifest, formatTokens, generateRandomString, generateUUID, getContractVersion, getEnvironment, getEnvironmentName, getGlobalLogLevel, getLogger, getNodeUrl, invoke, isAgentCardResponse, isAgentEgressGetResponse, isContractAgentCountsResponse, isDataGetResponse, isDataListResponse, isListAgentsResponse, isListHumanMembersResponse, isMutationResponse, isObject, isOrgAdminStatus, isOrgContractDelegation, isOrgPolicyMeta, isOrgPolicyView, isOrgUsageReport, isOrgWriters, isRoleAssignmentsResponse, isRoleGetResponse, isSecretListResponse, isSecretRecord, isSecretView, isUnsafeTrustServer, loadConfig, loadWasmComponent, manifestToTrustAnchor, maskKeyMaterial, mergeDiscoverDids, mergeGrants, metamask_get_address, metamask_sign, parseContractResponse, parseMemberDelegationDoc, readOnlyScopes, redactSecrets, redactSecretsFromJson, requestToWire, resolveTrustAnchor, setEnvironment, setGlobalLogLevel, setNodeUrl, sevSnpVcekUrl, stringToBytes, tenantDidHex, toBaseUnits, validateConfig, validateTail, verifyDkgAttestation, verifyManifestSignature, verifySevSnpReport, verifyTdxQuote };
6554
- export type { ActivityCallerType, ActivityEntry, ActivityExportFile, ActivityExportStatus, ActivityOutcome, ActivityReport, AdminActionAuth, AdmitForOrgOptions, AgentCardRefInput, AgentCardResponse, AgentCardSetInput, AgentEgressEntry, AgentEgressGetResponse, AgentEgressRefInput, AgentSummary, AssignRolesInput, AuthInput, BalanceRow, BoundGrant, ChargeReason, ClientAuth, ClientHandshake, ComputePayrollRequest, ConfigValidationResult, ContractAgentCountsInput, ContractAgentCountsResponse, ContractDescriptorDocument, ContractDescriptorFacets, ContractExecuteInput, ContractKind, ContractLifecycleStatus, ContractListDetailedOptions, ContractListDetailedPage, ContractPublishInput, ContractRegisterResult, ContractResponseSchema, ContractSetDescriptorInput, ContractUnsetDescriptorInput, ContractUnsetDescriptorResult, CreatePolicyInput, DataGetInput, DataGetResponse, DataListInput, DataListResponse, DelegationGrantKind, DelegationGrantRef, DeleteDataInput, DeleteScopeInput, DescribeContractParams, DescribeContractResult, DescribeFunctionParams, DescribeFunctionResult, DetailedContract, Did, DidKind, Direction, DiscoverOptions, DkgAttestation, DkgVerifyResult, DrainContractAgentCountsInput, EmailOtpAuthInput, EmailOtpCredentials, Environment, EthAuthInput, ExecuteBusinessContractOptions, ExecuteOrgDataActionOptions, ExportActivityLogOptions, FetchTrustedManifestOptions, FunctionDescriptorEntry, GetActivityLogOptions, GetUsageOptions, GrantCheckParams, GrantCheckResult, GranteeInput, 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, 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, RemoveTarget, RoleAssignments, RoleAssignmentsResponse, RoleDefinition, RoleGetResponse, RoleGrant, RoleIdInput, ScopeAccessVerb, SdkConfig, SecretKind, SecretListInput, SecretListResponse, SecretNameInput, SecretRecord, SecretSetValueInput, SecretView, SecretWriteInput, SessionCrypto, SessionId, SetAgentEgressInput, SetDefaultQuotasOptions, SetRoleInput, SetWritersInput, SevSnpCollateral, SevSnpVerifyResult, SignedTrustManifest, StringEncoding, SubmitUserInputArgs, SubmitUserInputResult, T3nClientConfig, TenantAdmitProjection, TenantAdmitStatus, TenantBaseClient, TenantClientConfig, TenantContractExecuteInput, TenantContractPublishInput, TenantContractSetDescriptorInput, TenantContractUnsetDescriptorInput, TenantExecutionSession, TenantMapCreateInput, TenantMapUpdatePatch, TenantMeResponse, TenantSdkEnvironment, TenantSelfAdmitResult, TenantStatus, TenantTargetOptions, TokenTxKind, Transport, TrustAnchor, TrustAnchorOrUnsafe, TrustAnchorSource, TrustManifestPayload, UnassignRolesInput, UnsafeTrustServer, UpdateMetaInput, UpdateQuotasOptions, UsageEntry, UsagePage, UsageReportSignature, UserInputProfile, UserUpsertErrorKind, Validity, VcekUrlResult, WasmComponent, WasmNextResult, WhoamiResult, WireBlock, WireScope, WorkloadAuthInput, WriteDataInput, WriterSet, WritersGetInput };
6627
+ export type { ActivityCallerType, ActivityEntry, ActivityExportFile, ActivityExportStatus, ActivityOutcome, ActivityReport, AdminActionAuth, AdmitForOrgOptions, AgentCardRefInput, AgentCardResponse, AgentCardSetInput, AgentEgressEntry, AgentEgressGetResponse, AgentEgressRefInput, AgentSummary, AssignRolesInput, AuthInput, BalanceRow, BoundGrant, ChargeReason, ClientAuth, ClientHandshake, ComputePayrollRequest, ConfigValidationResult, ContractAgentCountsInput, ContractAgentCountsResponse, ContractDescriptorDocument, ContractDescriptorFacets, ContractExecuteInput, ContractKind, ContractLifecycleStatus, ContractListDetailedOptions, ContractListDetailedPage, ContractPublishInput, ContractRegisterResult, ContractResponseSchema, ContractSetDescriptorInput, ContractUnsetDescriptorInput, ContractUnsetDescriptorResult, CreateDelegatedAgentParams, CreatePolicyInput, DataGetInput, DataGetResponse, DataListInput, DataListResponse, DelegatedAgent, DelegationGrantKind, DelegationGrantRef, DeleteDataInput, DeleteScopeInput, DescribeContractParams, DescribeContractResult, DescribeFunctionParams, DescribeFunctionResult, DetailedContract, Did, DidKind, Direction, DiscoverOptions, DkgAttestation, DkgVerifyResult, DrainContractAgentCountsInput, EmailOtpAuthInput, EmailOtpCredentials, Environment, EthAuthInput, ExecuteBusinessContractOptions, ExecuteOrgDataActionOptions, ExportActivityLogOptions, FetchTrustedManifestOptions, FunctionDescriptorEntry, GetActivityLogOptions, GetUsageOptions, GrantCheckParams, GrantCheckResult, GranteeInput, 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, 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, RemoveTarget, RoleAssignments, RoleAssignmentsResponse, RoleDefinition, RoleGetResponse, RoleGrant, RoleIdInput, ScopeAccessVerb, SdkConfig, SecretKind, SecretListInput, SecretListResponse, SecretNameInput, SecretRecord, SecretSetValueInput, SecretView, SecretWriteInput, SessionCrypto, SessionId, SetAgentEgressInput, SetDefaultQuotasOptions, SetRoleInput, SetWritersInput, SevSnpCollateral, SevSnpVerifyResult, SignedTrustManifest, StringEncoding, SubmitUserInputArgs, SubmitUserInputResult, T3nClientConfig, TenantAdmitProjection, TenantAdmitStatus, TenantBaseClient, TenantClientConfig, TenantContractExecuteInput, TenantContractPublishInput, TenantContractSetDescriptorInput, TenantContractUnsetDescriptorInput, TenantExecutionSession, TenantMapCreateInput, TenantMapUpdatePatch, TenantMeResponse, TenantSdkEnvironment, TenantSelfAdmitResult, TenantStatus, TenantTargetOptions, TokenTxKind, Transport, TrustAnchor, TrustAnchorOrUnsafe, TrustAnchorSource, TrustManifestPayload, UnassignRolesInput, UnsafeTrustServer, UpdateMetaInput, UpdateQuotasOptions, UsageEntry, UsagePage, UsageReportSignature, UserInputProfile, UserUpsertErrorKind, Validity, VcekUrlResult, WasmComponent, WasmNextResult, WhoamiResult, WireBlock, WireScope, WorkloadAuthInput, WriteDataInput, WriterSet, WritersGetInput };