@terminal3/t3n-sdk 5.25.0 → 5.27.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/cli/index.js +1 -1
- package/dist/index.d.ts +268 -57
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1122,6 +1122,140 @@ declare class ContractResponseError extends T3nError {
|
|
|
1122
1122
|
*/
|
|
1123
1123
|
declare function parseContractResponse<T = unknown>(raw: string, schema?: ContractResponseSchema<T>): T;
|
|
1124
1124
|
|
|
1125
|
+
/**
|
|
1126
|
+
* Delegated agents and the T3N OAuth connections that act as them. Wire types
|
|
1127
|
+
* and strict decoders for the `tee:organisation` functions the `T3nClient`
|
|
1128
|
+
* wrappers dispatch.
|
|
1129
|
+
*/
|
|
1130
|
+
|
|
1131
|
+
/**
|
|
1132
|
+
* Create a harness agent: one the customer's IdP authenticates. The contract
|
|
1133
|
+
* verifies `harnessIdToken` against `provider` and keys the agent on
|
|
1134
|
+
* `(iss, user_id, clientId)`.
|
|
1135
|
+
*/
|
|
1136
|
+
interface CreateHarnessAgentParams {
|
|
1137
|
+
/**
|
|
1138
|
+
* Label of the node's configured OIDC provider (`Configs[provider:oidc]`)
|
|
1139
|
+
* the token is verified against. Its configured `client_id` is the audience,
|
|
1140
|
+
* so it must be the harness's client.
|
|
1141
|
+
*/
|
|
1142
|
+
provider: string;
|
|
1143
|
+
/** The caller's own ID token, issued by `provider` to the harness's client. */
|
|
1144
|
+
harnessIdToken: string;
|
|
1145
|
+
/** OAuth client the agent will authenticate as: the `azp` its tokens carry. */
|
|
1146
|
+
clientId: string;
|
|
1147
|
+
/** Display name, e.g. "Maria's Claude Agent". */
|
|
1148
|
+
name: string;
|
|
1149
|
+
}
|
|
1150
|
+
/**
|
|
1151
|
+
* Create a T3N agent: one a person picks for an MCP connection through the
|
|
1152
|
+
* T3N authorization server. The caller's session is the proof of identity, so
|
|
1153
|
+
* there is no token, and the session must be a person acting for themselves.
|
|
1154
|
+
*/
|
|
1155
|
+
interface CreateT3nAgentParams {
|
|
1156
|
+
/** Label of the node's T3N provider row, the one whose keys the enclave holds. */
|
|
1157
|
+
provider: string;
|
|
1158
|
+
name: string;
|
|
1159
|
+
harnessIdToken?: never;
|
|
1160
|
+
clientId?: never;
|
|
1161
|
+
}
|
|
1162
|
+
/** Input to `T3nClient.createDelegatedAgent`. The provider row picks the arm. */
|
|
1163
|
+
type CreateDelegatedAgentParams = CreateHarnessAgentParams | CreateT3nAgentParams;
|
|
1164
|
+
/** A delegated per-user agent, as `create-delegated-agent` reports it. */
|
|
1165
|
+
interface DelegatedAgent {
|
|
1166
|
+
agentDid: Did;
|
|
1167
|
+
ownerDid: Did;
|
|
1168
|
+
/** The name as stored, which the contract may have truncated. */
|
|
1169
|
+
name: string;
|
|
1170
|
+
}
|
|
1171
|
+
/**
|
|
1172
|
+
* `t3n` agents are pickable for an MCP connection; `harness` agents belong to
|
|
1173
|
+
* a customer IdP's client and are not.
|
|
1174
|
+
*/
|
|
1175
|
+
type DelegatedAgentKind = "t3n" | "harness";
|
|
1176
|
+
/** One of the caller's delegated agents, from `list-delegated-agents`. */
|
|
1177
|
+
interface ListedDelegatedAgent {
|
|
1178
|
+
agentDid: Did;
|
|
1179
|
+
name: string;
|
|
1180
|
+
createdSecs: number;
|
|
1181
|
+
revokedAtSecs?: number;
|
|
1182
|
+
kind: DelegatedAgentKind;
|
|
1183
|
+
/** The harness's OAuth client, for a `harness` agent only. */
|
|
1184
|
+
harnessClientId?: string;
|
|
1185
|
+
}
|
|
1186
|
+
/** Input to `T3nClient.describeOAuthClient`: the OAuth request's own fields. */
|
|
1187
|
+
interface DescribeOAuthClientParams {
|
|
1188
|
+
clientId: string;
|
|
1189
|
+
redirectUri: string;
|
|
1190
|
+
}
|
|
1191
|
+
/** How the client is identified: a fetched metadata document, a DCR id, or an operator row. */
|
|
1192
|
+
type OAuthClientKind = "cimd" | "dcr" | "registered";
|
|
1193
|
+
/** RFC 8252 class of the redirect URI, which sets the consent wording. */
|
|
1194
|
+
type OAuthRedirectClass = "loopback" | "private_scheme" | "https";
|
|
1195
|
+
/** What the consent page shows about a client, from `oauth-describe-client`. */
|
|
1196
|
+
interface OAuthClientDescription {
|
|
1197
|
+
clientId: string;
|
|
1198
|
+
kind: OAuthClientKind;
|
|
1199
|
+
/**
|
|
1200
|
+
* The `client_id` host for CIMD, the redirect origin or scheme for DCR, the
|
|
1201
|
+
* operator's display name for a registered client.
|
|
1202
|
+
*/
|
|
1203
|
+
identity: string;
|
|
1204
|
+
/** Self-asserted by the client, so shown quoted and never trusted. */
|
|
1205
|
+
clientName?: string;
|
|
1206
|
+
redirectClass: OAuthRedirectClass;
|
|
1207
|
+
redirectDisplay: string;
|
|
1208
|
+
/**
|
|
1209
|
+
* The authorization server's issuer, byte-exact: the RFC 9207 `iss` to put on
|
|
1210
|
+
* every redirect back to the client, Deny and error redirects included.
|
|
1211
|
+
*/
|
|
1212
|
+
iss: string;
|
|
1213
|
+
/** Present only when the operator's `verified_clients` matches. Display only. */
|
|
1214
|
+
verified?: {
|
|
1215
|
+
displayName: string;
|
|
1216
|
+
};
|
|
1217
|
+
}
|
|
1218
|
+
/** Input to `T3nClient.authoriseOAuthConnection`. */
|
|
1219
|
+
interface AuthoriseOAuthConnectionParams {
|
|
1220
|
+
/** One of the caller's own, unrevoked T3N agents. */
|
|
1221
|
+
agentDid: string;
|
|
1222
|
+
clientId: string;
|
|
1223
|
+
redirectUri: string;
|
|
1224
|
+
/** Required unless the operator registered the client with `pkce: "if_sent"`. */
|
|
1225
|
+
codeChallenge?: string;
|
|
1226
|
+
/** Must be `S256` when a challenge is sent. */
|
|
1227
|
+
codeChallengeMethod?: string;
|
|
1228
|
+
/** Omitted means the one MCP resource this authorization server serves. */
|
|
1229
|
+
resource?: string;
|
|
1230
|
+
/** Space-separated; unknown scopes and `offline_access` are dropped, not refused. */
|
|
1231
|
+
scope?: string;
|
|
1232
|
+
}
|
|
1233
|
+
/**
|
|
1234
|
+
* The one-time code to hand back to the client. The caller redirects to
|
|
1235
|
+
* `redirectUri` with `code`, the client's `state` and `iss`.
|
|
1236
|
+
*/
|
|
1237
|
+
interface OAuthAuthorisation {
|
|
1238
|
+
code: string;
|
|
1239
|
+
redirectUri: string;
|
|
1240
|
+
/** The authorization server's issuer, sent as the RFC 9207 `iss` parameter. */
|
|
1241
|
+
iss: string;
|
|
1242
|
+
}
|
|
1243
|
+
/** `expired` is a pending or active connection that time has ended, not yet swept. */
|
|
1244
|
+
type OAuthConnectionState = "pending" | "active" | "expired" | "revoked";
|
|
1245
|
+
/** One of the caller's OAuth connections, from `list-oauth-connections`. */
|
|
1246
|
+
interface OAuthConnection {
|
|
1247
|
+
connectionId: string;
|
|
1248
|
+
agentDid: Did;
|
|
1249
|
+
agentName: string;
|
|
1250
|
+
clientId: string;
|
|
1251
|
+
/** The same identity the consent page showed for the client. */
|
|
1252
|
+
clientDisplayHost: string;
|
|
1253
|
+
createdSecs: number;
|
|
1254
|
+
refreshedSecs?: number;
|
|
1255
|
+
state: OAuthConnectionState;
|
|
1256
|
+
revokedAtSecs?: number;
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1125
1259
|
/**
|
|
1126
1260
|
* Org-data wire types mirroring the org-data contract wire shapes.
|
|
1127
1261
|
*
|
|
@@ -2399,8 +2533,20 @@ interface AuditBatch {
|
|
|
2399
2533
|
* commit? `false` means the call rolled back or trapped, so an event's
|
|
2400
2534
|
* `outcome: "success"` in this batch is the contract's *claim*, not a
|
|
2401
2535
|
* committed fact — filter on this when you need only durable events.
|
|
2536
|
+
* This holds for approval events too (`details.event_type` is
|
|
2537
|
+
* `action.escalated`, `action.reviewed` or `action.executed`): a
|
|
2538
|
+
* rolled-back approver batch can list `action.reviewed` as `success` next
|
|
2539
|
+
* to a failed `action.executed`, so always check `committed`. Events in a
|
|
2540
|
+
* batch share one timestamp and are ordered by their position in `events`.
|
|
2402
2541
|
*/
|
|
2403
2542
|
committed: boolean;
|
|
2543
|
+
/**
|
|
2544
|
+
* Present when the platform, not a client, started this dispatch, for
|
|
2545
|
+
* example `"hitl-resume:<run id>"` for a call resumed after a human
|
|
2546
|
+
* approval. Absent for a client call. The id after the prefix may itself
|
|
2547
|
+
* contain colons, so do not split on them.
|
|
2548
|
+
*/
|
|
2549
|
+
origin?: string;
|
|
2404
2550
|
events: AuditEvent[];
|
|
2405
2551
|
}
|
|
2406
2552
|
/**
|
|
@@ -2500,6 +2646,14 @@ interface ActivityEntry {
|
|
|
2500
2646
|
* validated one.
|
|
2501
2647
|
*/
|
|
2502
2648
|
roles?: string[];
|
|
2649
|
+
/**
|
|
2650
|
+
* Present when the node, not the caller, started the call, for example
|
|
2651
|
+
* `"hitl-resume:<run id>"` for the call the node ran as the requester
|
|
2652
|
+
* once an approval was granted. Stamped by the node, never by a contract.
|
|
2653
|
+
* Absent when the caller started the call. The id after the prefix may
|
|
2654
|
+
* itself contain colons, so do not split on them.
|
|
2655
|
+
*/
|
|
2656
|
+
origin?: string;
|
|
2503
2657
|
/**
|
|
2504
2658
|
* Labels the contract chose for this call — the `custom` object it returned
|
|
2505
2659
|
* in its response, which the node removes from the response and stores on
|
|
@@ -2841,28 +2995,6 @@ interface DescribeFunctionResult {
|
|
|
2841
2995
|
* All cryptographic complexity is handled in WASM components.
|
|
2842
2996
|
*/
|
|
2843
2997
|
|
|
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
|
-
}
|
|
2866
2998
|
declare class T3nClient {
|
|
2867
2999
|
private readonly config;
|
|
2868
3000
|
private readonly transport;
|
|
@@ -3333,24 +3465,44 @@ declare class T3nClient {
|
|
|
3333
3465
|
privateCardDeleted: boolean;
|
|
3334
3466
|
}>;
|
|
3335
3467
|
/**
|
|
3336
|
-
* Create the caller's own delegated agent
|
|
3468
|
+
* Create the caller's own delegated agent.
|
|
3337
3469
|
*
|
|
3338
3470
|
* Dispatches `create-delegated-agent` on `tee:organisation/contracts`. The
|
|
3339
|
-
*
|
|
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.
|
|
3471
|
+
* provider row that `params.provider` names picks the arm:
|
|
3343
3472
|
*
|
|
3344
|
-
*
|
|
3345
|
-
*
|
|
3473
|
+
* - **Harness agent** (`harnessIdToken` and `clientId` set): the contract
|
|
3474
|
+
* verifies the token in-enclave against `provider`, requires its identity
|
|
3475
|
+
* to belong to the session's DID, and keys the agent on
|
|
3476
|
+
* `(iss, user_id, clientId)`.
|
|
3477
|
+
* - **T3N agent** (neither set, `provider` names the T3N row): the session is
|
|
3478
|
+
* the proof of identity, and the person can pick the agent for an MCP
|
|
3479
|
+
* connection.
|
|
3480
|
+
*
|
|
3481
|
+
* Either way the session must be the person's own human DID, acting for
|
|
3482
|
+
* themselves. The contract refuses the harness fields on the T3N row, and
|
|
3483
|
+
* their absence on a harness row.
|
|
3346
3484
|
*
|
|
3347
3485
|
* @throws {RpcError} when the contract refuses (token verification, a token
|
|
3348
|
-
* belonging to another DID,
|
|
3486
|
+
* belonging to another DID, a caller that is not a person, the per-owner cap)
|
|
3349
3487
|
* @throws {ContractResponseError} when the response does not name the agent
|
|
3488
|
+
* @throws {Error} before dispatch when only one of `harnessIdToken` and
|
|
3489
|
+
* `clientId` is set
|
|
3350
3490
|
*/
|
|
3351
3491
|
createDelegatedAgent(params: CreateDelegatedAgentParams): Promise<DelegatedAgent>;
|
|
3352
3492
|
/**
|
|
3353
|
-
*
|
|
3493
|
+
* The caller's own delegated agents, T3N and harness, revoked ones included.
|
|
3494
|
+
*
|
|
3495
|
+
* Dispatches `list-delegated-agents` on `tee:organisation/contracts`. Self
|
|
3496
|
+
* only: an agent acting for its owner is refused. A harness agent's IdP user
|
|
3497
|
+
* id is never returned.
|
|
3498
|
+
*
|
|
3499
|
+
* @throws {RpcError} when the contract refuses
|
|
3500
|
+
* @throws {ContractResponseError} when the response does not match its shape
|
|
3501
|
+
*/
|
|
3502
|
+
listDelegatedAgents(): Promise<ListedDelegatedAgent[]>;
|
|
3503
|
+
/**
|
|
3504
|
+
* Stop one of the caller's own delegated agents authenticating, T3N or
|
|
3505
|
+
* harness. A T3N agent's OAuth connections are refused from their next call.
|
|
3354
3506
|
*
|
|
3355
3507
|
* Dispatches `revoke-delegated-agent` on `tee:organisation/contracts`.
|
|
3356
3508
|
* Revocation marks the agent's record; its DID and registry record remain.
|
|
@@ -3362,6 +3514,58 @@ declare class T3nClient {
|
|
|
3362
3514
|
revokeDelegatedAgent(agentDid: string): Promise<{
|
|
3363
3515
|
agentDid: Did;
|
|
3364
3516
|
}>;
|
|
3517
|
+
/**
|
|
3518
|
+
* What the consent page shows about an OAuth client, before any
|
|
3519
|
+
* authorisation. Read only.
|
|
3520
|
+
*
|
|
3521
|
+
* Dispatches `oauth-describe-client` on `tee:organisation/contracts`. The
|
|
3522
|
+
* enclave fetches a CIMD client's metadata document itself and checks
|
|
3523
|
+
* `redirectUri` against the client's registration and the operator's
|
|
3524
|
+
* policy. On a refusal the page shows the error and does not redirect.
|
|
3525
|
+
*
|
|
3526
|
+
* @throws {RpcError} on an invalid client or redirect URI, carrying the
|
|
3527
|
+
* contract's typed code (`invalid_client_id`, `redirect_uri_not_registered`, …)
|
|
3528
|
+
* @throws {ContractResponseError} when the response does not match its shape
|
|
3529
|
+
*/
|
|
3530
|
+
describeOAuthClient(params: DescribeOAuthClientParams): Promise<OAuthClientDescription>;
|
|
3531
|
+
/**
|
|
3532
|
+
* Let an OAuth client act as one of the caller's own T3N agents, and get the
|
|
3533
|
+
* one-time code to send back to it.
|
|
3534
|
+
*
|
|
3535
|
+
* Dispatches `oauth-authorise` on `tee:organisation/contracts`. The session
|
|
3536
|
+
* must be a person acting for themselves. The code is bound to the client,
|
|
3537
|
+
* the redirect URI, the resource and the PKCE challenge; the client redeems
|
|
3538
|
+
* it at the node's token endpoint.
|
|
3539
|
+
*
|
|
3540
|
+
* @throws {RpcError} when the contract refuses (client or redirect checks,
|
|
3541
|
+
* PKCE, resource, an agent the caller does not own or has revoked, the
|
|
3542
|
+
* per-person connection cap)
|
|
3543
|
+
* @throws {ContractResponseError} when the response does not match its shape
|
|
3544
|
+
*/
|
|
3545
|
+
authoriseOAuthConnection(params: AuthoriseOAuthConnectionParams): Promise<OAuthAuthorisation>;
|
|
3546
|
+
/**
|
|
3547
|
+
* The caller's own OAuth connections, including revoked and expired ones
|
|
3548
|
+
* not yet swept. Self only.
|
|
3549
|
+
*
|
|
3550
|
+
* Dispatches `list-oauth-connections` on `tee:organisation/contracts`.
|
|
3551
|
+
*
|
|
3552
|
+
* @throws {RpcError} when the contract refuses
|
|
3553
|
+
* @throws {ContractResponseError} when the response does not match its shape
|
|
3554
|
+
*/
|
|
3555
|
+
listOAuthConnections(): Promise<OAuthConnection[]>;
|
|
3556
|
+
/**
|
|
3557
|
+
* Revoke one of the caller's own OAuth connections. Its refresh token stops
|
|
3558
|
+
* working at once; an access token already issued runs to its expiry. The
|
|
3559
|
+
* agent is untouched. Idempotent.
|
|
3560
|
+
*
|
|
3561
|
+
* Dispatches `revoke-oauth-connection` on `tee:organisation/contracts`.
|
|
3562
|
+
*
|
|
3563
|
+
* @throws {RpcError} when the caller owns no connection with that id
|
|
3564
|
+
* @throws {ContractResponseError} when the response does not name the connection
|
|
3565
|
+
*/
|
|
3566
|
+
revokeOAuthConnection(connectionId: string): Promise<{
|
|
3567
|
+
connectionId: string;
|
|
3568
|
+
}>;
|
|
3365
3569
|
/**
|
|
3366
3570
|
* Provision a fresh org-owned agent.
|
|
3367
3571
|
*
|
|
@@ -3498,8 +3702,6 @@ declare class T3nClient {
|
|
|
3498
3702
|
* `did:t3n:<40 hex>` or bare 40 hex.
|
|
3499
3703
|
*/
|
|
3500
3704
|
private static didToWire;
|
|
3501
|
-
/** Read a DID field (`did:t3n:<40 hex>` or bare hex) from a contract response. */
|
|
3502
|
-
private static didFromResponse;
|
|
3503
3705
|
/**
|
|
3504
3706
|
* Resolve the deployed version of `contractId`, refusing before any dispatch
|
|
3505
3707
|
* when it is older than the caller needs, with a message naming the version the
|
|
@@ -4314,11 +4516,13 @@ declare function createRandomHandler(): GuestToHostHandler;
|
|
|
4314
4516
|
declare function createDefaultHandlers(baseUrl: string, trustAnchor: TrustAnchorOrUnsafe): GuestToHostHandlers;
|
|
4315
4517
|
|
|
4316
4518
|
/**
|
|
4317
|
-
* Stateless
|
|
4519
|
+
* Stateless agent auth: an API key or an OAuth bearer.
|
|
4318
4520
|
*
|
|
4319
4521
|
* `invoke` posts once to `POST /api/invoke` — an HTTPS-only
|
|
4320
|
-
* endpoint (see the HTTPS-guard note below) that authenticates an
|
|
4321
|
-
*
|
|
4522
|
+
* endpoint (see the HTTPS-guard note below) that authenticates an agent by
|
|
4523
|
+
* one {@link StatelessCredential}: an org agent's opaque API key
|
|
4524
|
+
* (`X-T3N-Api-Key: t3n_key_<...>`) or a delegated agent's OAuth access token
|
|
4525
|
+
* (`Authorization: Bearer <token>`), and executes a
|
|
4322
4526
|
* `z:` contract as that agent in the SAME request. Unlike
|
|
4323
4527
|
* {@link T3nClient.execute}, there is **no** ML-KEM handshake, **no**
|
|
4324
4528
|
* `Session-Id`, and **no** session state: the node derives the acting agent
|
|
@@ -4390,26 +4594,38 @@ interface InvokeRequest {
|
|
|
4390
4594
|
pii_did?: string;
|
|
4391
4595
|
input?: unknown;
|
|
4392
4596
|
}
|
|
4597
|
+
/**
|
|
4598
|
+
* The credential `/api/invoke` and `/api/discover` resolve, exactly one of:
|
|
4599
|
+
*
|
|
4600
|
+
* - `apiKey`: an org agent's opaque API key (`t3n_key_<...>`), sent as
|
|
4601
|
+
* `X-T3N-Api-Key`;
|
|
4602
|
+
* - `bearer`: a delegated agent's OAuth access token, sent as
|
|
4603
|
+
* `Authorization: Bearer <token>`.
|
|
4604
|
+
*
|
|
4605
|
+
* The node resolves either on the same routes (its `stateless_credential`
|
|
4606
|
+
* action tries the bearer first). Relayed verbatim, never logged and never
|
|
4607
|
+
* interpolated into any error this module throws.
|
|
4608
|
+
*/
|
|
4609
|
+
type StatelessCredential = {
|
|
4610
|
+
apiKey: string;
|
|
4611
|
+
bearer?: never;
|
|
4612
|
+
} | {
|
|
4613
|
+
bearer: string;
|
|
4614
|
+
apiKey?: never;
|
|
4615
|
+
};
|
|
4393
4616
|
/** Options for {@link invoke}. */
|
|
4394
|
-
|
|
4617
|
+
type InvokeOptions = StatelessCredential & {
|
|
4395
4618
|
/**
|
|
4396
4619
|
* RPC base URL of the T3n node, e.g. `https://node.example.com`. Must be
|
|
4397
4620
|
* `https:` unless the host is a local-dev loopback (`localhost` /
|
|
4398
4621
|
* `127.0.0.1` / `[::1]`) — see the module doc comment's HTTPS-guard note.
|
|
4399
4622
|
*/
|
|
4400
4623
|
baseUrl: string;
|
|
4401
|
-
/**
|
|
4402
|
-
* The agent's opaque API key (`t3n_key_<...>`), relayed verbatim in the
|
|
4403
|
-
* `X-T3N-Api-Key` header. Never logged and never interpolated into any
|
|
4404
|
-
* error this module throws — see the module doc comment and
|
|
4405
|
-
* {@link InvokeError}.
|
|
4406
|
-
*/
|
|
4407
|
-
apiKey: string;
|
|
4408
4624
|
/** The wire request to execute, built to the {@link InvokeRequest} shape. */
|
|
4409
4625
|
request: InvokeRequest;
|
|
4410
4626
|
/** Fetch timeout in ms. Defaults to 30s, matching {@link HttpTransport}. */
|
|
4411
4627
|
timeoutMs?: number;
|
|
4412
|
-
}
|
|
4628
|
+
};
|
|
4413
4629
|
/**
|
|
4414
4630
|
* Thrown when `POST /api/invoke` fails at the transport or HTTP
|
|
4415
4631
|
* layer (network failure, timeout, non-2xx status). Contract-level errors
|
|
@@ -4429,8 +4645,9 @@ declare class InvokeError extends T3nError {
|
|
|
4429
4645
|
constructor(message: string, status?: number | undefined);
|
|
4430
4646
|
}
|
|
4431
4647
|
/**
|
|
4432
|
-
* Execute a `z:` contract as an
|
|
4433
|
-
*
|
|
4648
|
+
* Execute a `z:` contract as an agent, authenticating with an API key or an
|
|
4649
|
+
* OAuth bearer ({@link StatelessCredential}) — one request, no handshake, no
|
|
4650
|
+
* session.
|
|
4434
4651
|
*
|
|
4435
4652
|
* @param opts - baseUrl, apiKey, and the wire request to execute
|
|
4436
4653
|
* @param schema - optional validator applied to the decoded result (e.g. a
|
|
@@ -4448,24 +4665,18 @@ declare function invoke<T = unknown>(opts: InvokeOptions, schema?: ContractRespo
|
|
|
4448
4665
|
* half of {@link InvokeOptions} (no `request`; the operation params are the
|
|
4449
4666
|
* second argument of each read). Same HTTPS + secret-hygiene rules as `invoke`.
|
|
4450
4667
|
*/
|
|
4451
|
-
|
|
4668
|
+
type DiscoverOptions = StatelessCredential & {
|
|
4452
4669
|
/**
|
|
4453
4670
|
* RPC base URL of the T3n node, e.g. `https://node.example.com`. Must be
|
|
4454
4671
|
* `https:` unless the host is a local-dev loopback — see
|
|
4455
4672
|
* {@link InvokeOptions.baseUrl}.
|
|
4456
4673
|
*/
|
|
4457
4674
|
baseUrl: string;
|
|
4458
|
-
/**
|
|
4459
|
-
* The agent's opaque API key (`t3n_key_<...>`), relayed verbatim in the
|
|
4460
|
-
* `X-T3N-Api-Key` header. Never logged and never interpolated into any
|
|
4461
|
-
* error this module throws.
|
|
4462
|
-
*/
|
|
4463
|
-
apiKey: string;
|
|
4464
4675
|
/** Fetch timeout in ms. Defaults to 30s, matching {@link invoke}. */
|
|
4465
4676
|
timeoutMs?: number;
|
|
4466
|
-
}
|
|
4677
|
+
};
|
|
4467
4678
|
/**
|
|
4468
|
-
* `whoami` — resolve the DID the relayed
|
|
4679
|
+
* `whoami` — resolve the DID the relayed credential maps to. The node never
|
|
4469
4680
|
* trusts a caller-supplied DID; this is the relay's sole DID source.
|
|
4470
4681
|
*
|
|
4471
4682
|
* @throws {InvokeError} if `baseUrl` is insecure, on a network failure/timeout,
|
|
@@ -6624,4 +6835,4 @@ declare function validateTail(tail: string): string;
|
|
|
6624
6835
|
declare function canonicalTenantName(tenantDid: string, tail: string): string;
|
|
6625
6836
|
|
|
6626
6837
|
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 };
|
|
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 };
|
|
6838
|
+
export type { ActivityCallerType, ActivityEntry, ActivityExportFile, ActivityExportStatus, ActivityOutcome, ActivityReport, AdminActionAuth, AdmitForOrgOptions, AgentCardRefInput, AgentCardResponse, AgentCardSetInput, AgentEgressEntry, AgentEgressGetResponse, AgentEgressRefInput, AgentSummary, AssignRolesInput, AuthInput, AuthoriseOAuthConnectionParams, BalanceRow, BoundGrant, ChargeReason, ClientAuth, ClientHandshake, ComputePayrollRequest, ConfigValidationResult, ContractAgentCountsInput, ContractAgentCountsResponse, ContractDescriptorDocument, ContractDescriptorFacets, ContractExecuteInput, ContractKind, ContractLifecycleStatus, ContractListDetailedOptions, ContractListDetailedPage, ContractPublishInput, ContractRegisterResult, ContractResponseSchema, ContractSetDescriptorInput, ContractUnsetDescriptorInput, ContractUnsetDescriptorResult, CreateDelegatedAgentParams, CreateHarnessAgentParams, CreatePolicyInput, CreateT3nAgentParams, DataGetInput, DataGetResponse, DataListInput, DataListResponse, DelegatedAgent, DelegatedAgentKind, DelegationGrantKind, DelegationGrantRef, DeleteDataInput, DeleteScopeInput, DescribeContractParams, DescribeContractResult, DescribeFunctionParams, DescribeFunctionResult, DescribeOAuthClientParams, 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, ListedDelegatedAgent, Logger, MapCreateInput, MapLifecycleStatus, MapResponse, MapUpdateInput, MapVisibility, MemberDelegationDoc, MemberRole, MutationResponse, OAuthAuthorisation, OAuthClientDescription, OAuthClientKind, OAuthConnection, OAuthConnectionState, OAuthRedirectClass, 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, StatelessCredential, 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 };
|