@agent-cards/sdk 0.23.27 → 0.24.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/CHANGELOG.md +66 -0
- package/PREFLIGHT.md +7 -1
- package/README.md +137 -99
- package/dist/aci.d.ts +52 -22
- package/dist/aci.js +79 -15
- package/dist/adyen-merchant-hosted.generated.d.ts +1 -1
- package/dist/adyen-merchant-hosted.generated.js +459 -21
- package/dist/agent-amount.generated.js +1 -1
- package/dist/agentcard.d.ts +4 -5
- package/dist/agentcard.js +4 -5
- package/dist/amadeus.d.ts +9 -3
- package/dist/amadeus.js +33 -4
- package/dist/api-module.d.ts +1 -7
- package/dist/api-module.js +3 -5
- package/dist/{voice-retry.js → api-retry.js} +1 -1
- package/dist/api-types.d.ts +53 -0
- package/dist/{voice-types.js → api-types.js} +7 -2
- package/dist/approvals.d.ts +166 -0
- package/dist/approvals.js +213 -0
- package/dist/buy.d.ts +20 -101
- package/dist/buy.js +19 -74
- package/dist/capabilities.generated.js +1 -1
- package/dist/card-fields.generated.js +1398 -106
- package/dist/cdp.d.ts +3 -13
- package/dist/cdp.js +231 -175
- package/dist/client.d.ts +104 -22
- package/dist/client.js +215 -40
- package/dist/creditguard.generated.d.ts +4 -4
- package/dist/datatrans.generated.js +22 -1
- package/dist/elavon-converge.generated.js +5 -3
- package/dist/hold.d.ts +8 -0
- package/dist/hold.js +43 -2
- package/dist/hosted-entry.js +2 -0
- package/dist/index.d.ts +9 -15
- package/dist/index.js +6 -10
- package/dist/juspay-gate.js +2 -2
- package/dist/juspay.generated.d.ts +2 -2
- package/dist/juspay.generated.js +174 -4
- package/dist/lifecycle.d.ts +9 -61
- package/dist/lifecycle.js +24 -10
- package/dist/merchant-card-endpoints.generated.d.ts +6 -1
- package/dist/merchant-card-endpoints.generated.js +344 -19
- package/dist/merchant-hosted.d.ts +8 -1
- package/dist/nike-order.d.ts +51 -0
- package/dist/nike-order.js +81 -0
- package/dist/oceanpayment.d.ts +38 -0
- package/dist/oceanpayment.js +70 -0
- package/dist/paddle-tokenex.generated.js +105 -10
- package/dist/payplug.d.ts +41 -0
- package/dist/payplug.js +71 -0
- package/dist/payrails.generated.js +27 -7
- package/dist/payrexx.generated.js +176 -2
- package/dist/pre-claim.d.ts +9 -0
- package/dist/pre-claim.js +86 -7
- package/dist/preflight-capabilities.generated.d.ts +0 -4
- package/dist/preflight-capabilities.generated.js +0 -5
- package/dist/preflight-catalog.json +46 -5
- package/dist/preflight-playwright.d.ts +2 -2
- package/dist/preflight-playwright.js +63 -14
- package/dist/preflight-schemas.json +4 -0
- package/dist/preflight.generated.d.ts +0 -4
- package/dist/preflight.generated.js +24 -1
- package/dist/prepared-processor.d.ts +18 -5
- package/dist/prepared-processor.js +48 -8
- package/dist/primer.generated.js +1418 -120
- package/dist/processout.generated.d.ts +61 -0
- package/dist/processout.generated.js +577 -0
- package/dist/requests.js +1 -1
- package/dist/shiji-sts.generated.js +105 -10
- package/dist/stripe-checkout.generated.js +1405 -234
- package/dist/substitutions.generated.js +460 -26
- package/dist/tap-payments.generated.js +105 -10
- package/dist/twoc2p.generated.js +105 -10
- package/dist/url-masks/bluesnap.d.ts +2 -0
- package/dist/url-masks/bluesnap.js +15 -0
- package/dist/url-masks/oceanpayment.d.ts +2 -0
- package/dist/url-masks/oceanpayment.js +13 -0
- package/dist/url-masks/payplug.d.ts +2 -0
- package/dist/url-masks/payplug.js +13 -0
- package/dist/url-masks/vtex_payments.d.ts +2 -0
- package/dist/url-masks/vtex_payments.js +12 -0
- package/dist/url-masks.generated.d.ts +1 -1
- package/dist/url-masks.generated.js +6 -2
- package/dist/verifone.generated.js +42 -2
- package/dist/vtex-payments.generated.d.ts +127 -0
- package/dist/vtex-payments.generated.js +544 -0
- package/dist/webhooks.d.ts +2 -2
- package/dist/webhooks.js +2 -2
- package/dist/wspay.generated.d.ts +1 -1
- package/dist/wspay.generated.js +175 -3
- package/examples/preflight/kernel-native/inventory.json +1 -1
- package/package.json +6 -8
- package/dist/languages.d.ts +0 -23
- package/dist/languages.js +0 -76
- package/dist/voice-pkce.d.ts +0 -49
- package/dist/voice-pkce.js +0 -147
- package/dist/voice-stream.generated.d.ts +0 -118
- package/dist/voice-stream.generated.js +0 -170
- package/dist/voice-types.d.ts +0 -735
- package/dist/voice.d.ts +0 -373
- package/dist/voice.js +0 -815
- package/readme.test.mjs +0 -53
- /package/dist/{voice-retry.d.ts → api-retry.d.ts} +0 -0
package/dist/voice.d.ts
DELETED
|
@@ -1,373 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The voice module of the SDK: `agentcard.voice.*`. One client, one pair of
|
|
3
|
-
* credentials, one token for the paused request and the voice approval. It
|
|
4
|
-
* connects a person to your product once (the connect link, its exchange, a
|
|
5
|
-
* returning person, a revocation), creates the purchase, asks for the key
|
|
6
|
-
* word, streams or receives the answer, and reads results.
|
|
7
|
-
*
|
|
8
|
-
* One base URL. Test and live are decided by the credentials, never by host.
|
|
9
|
-
* The phone half is its own package, `@agent-cards/voice`: it ships to phones
|
|
10
|
-
* and holds no secret.
|
|
11
|
-
*/
|
|
12
|
-
import type { PausedRequest } from './client.js';
|
|
13
|
-
import { ApiModule, type ApiTransport } from './api-module.js';
|
|
14
|
-
import { type StreamFormat, type StreamHandle, type ChannelKind } from './voice-stream.generated.js';
|
|
15
|
-
import { type PkceCrypto } from './voice-pkce.js';
|
|
16
|
-
import type { Language, LanguageInfo } from './languages.js';
|
|
17
|
-
import { type Action, type ActionState, type AppVoiceKeyDescription, type ApprovalPosture, type Authorization, type AuthorizationResult, type Cancelled, type CancelReason, type Connected, type ConnectInput, type ConnectResult, type CreateAuthorizationInput, type Done, type Exchanged, type ExchangeInput, type HardwareAttestation, type HostApprovalBundle, type Person, type Proposed, type RegisteredAppVoiceKey, type RevokedAppVoiceKey, type Revoked, type SessionState, type VaultSessionStep, type VoiceChallenge, type VoiceResetInput } from './voice-types.js';
|
|
18
|
-
export { stripePaymentIntentConfirm, type MintedIntent } from './requests.js';
|
|
19
|
-
/**
|
|
20
|
-
* The voice half of the client's options: named once, per business, when the
|
|
21
|
-
* product approves purchases by voice. A client built without it, or with no
|
|
22
|
-
* `approval`, approves on Agentcard's page (`'sheet'`).
|
|
23
|
-
*/
|
|
24
|
-
export interface VoiceOptions {
|
|
25
|
-
/**
|
|
26
|
-
* How this product approves purchases. One choice per business, not per
|
|
27
|
-
* purchase. `'sheet'` (the default): the person approves on Agentcard's page
|
|
28
|
-
* with a credential Agentcard verifies. `'in_app'`: hold-to-talk in your app,
|
|
29
|
-
* judged on the phone and by Agentcard, signed by a key in your app.
|
|
30
|
-
* Sandbox and live behave the same.
|
|
31
|
-
*/
|
|
32
|
-
approval?: ApprovalPosture;
|
|
33
|
-
/** Where the Vault sends the person back when a call names no `return_url` of its own. Exactly one of your registered links. */
|
|
34
|
-
returnUrl?: string;
|
|
35
|
-
/**
|
|
36
|
-
* The verifier's address for the streaming door when your server pushes the
|
|
37
|
-
* audio itself (`wss://…`). A call may name `stream_url` instead, and a
|
|
38
|
-
* challenge minted by an API that names `verifier_url` needs neither.
|
|
39
|
-
*/
|
|
40
|
-
verifierUrl?: string;
|
|
41
|
-
/** Deadline for the await calls; the poll spacing is the client's `pollIntervalMs`. Default 60 s. */
|
|
42
|
-
pollTimeoutMs?: number;
|
|
43
|
-
/** Test seam: the retry pauses. */
|
|
44
|
-
backoffMs?: readonly number[];
|
|
45
|
-
/**
|
|
46
|
-
* The pause between two polls. An app may pass one that also wakes when it
|
|
47
|
-
* returns to the foreground, so the answer does not wait for the next tick.
|
|
48
|
-
*/
|
|
49
|
-
wait?: (ms: number) => Promise<void>;
|
|
50
|
-
/**
|
|
51
|
-
* Where the grant's random bytes and SHA-256 come from when the runtime has
|
|
52
|
-
* no WebCrypto (a phone runtime running this module). Node, browsers and
|
|
53
|
-
* workers need nothing here.
|
|
54
|
-
*/
|
|
55
|
-
pkce?: PkceCrypto;
|
|
56
|
-
}
|
|
57
|
-
/** @deprecated The transport every module shares is `ApiTransport`; this name stays for one release. */
|
|
58
|
-
export type VoiceTransport = ApiTransport & {
|
|
59
|
-
options: VoiceOptions | undefined;
|
|
60
|
-
};
|
|
61
|
-
export declare const GRANT_REQUIRES_EXCHANGE_MESSAGE = "This session is an authorization grant: its result is not read by polling. Hand the return link to voice.completeConnect(url), or its code and state to voice.exchange({ code, state, session_id }).";
|
|
62
|
-
export declare function stepOf(v: unknown): VaultSessionStep | null;
|
|
63
|
-
export declare function reasonOf(v: unknown): string | null;
|
|
64
|
-
/** The business's words for withdrawing a purchase (`authorizations.cancel`); anything else is refused before any call. */
|
|
65
|
-
export declare const CANCEL_REASONS: readonly CancelReason[];
|
|
66
|
-
/**
|
|
67
|
-
* The origin a paused request pays from, when its `origin` header is one Agentcard admits as `checkout_origin`
|
|
68
|
-
* (an exact https origin, or http://localhost for a local run); null otherwise. The Stripe request builders
|
|
69
|
-
* set that header, so a create that names no `checkout_origin` still carries the app's.
|
|
70
|
-
*/
|
|
71
|
-
export declare function checkoutOriginOf(request: PausedRequest): string | null;
|
|
72
|
-
export declare const MISSING_APPROVAL_POSTURE_MESSAGE = "Name how your product approves purchases: voice: { approval: 'sheet' } (the person approves on Agentcard's page with a credential Agentcard verifies; the default when approval is left out) or voice: { approval: 'in_app' } (hold-to-talk in your app, judged on the phone and by Agentcard, signed by a key in your app).";
|
|
73
|
-
/** The default posture: the person approves on Agentcard's page. */
|
|
74
|
-
export declare const DEFAULT_APPROVAL_POSTURE: ApprovalPosture;
|
|
75
|
-
/**
|
|
76
|
-
* The posture as named, or `'sheet'` when none was: a client built without
|
|
77
|
-
* `voice`, or with `voice` and no `approval`, approves on Agentcard's page.
|
|
78
|
-
* Throws `missing_approval_posture` only for a posture that is neither.
|
|
79
|
-
*/
|
|
80
|
-
export declare function approvalPostureOf(options: VoiceOptions | undefined): ApprovalPosture;
|
|
81
|
-
export { streamAddress } from './voice-stream.generated.js';
|
|
82
|
-
/**
|
|
83
|
-
* The sandbox request: a first run's purchase, naming no processor. Under a
|
|
84
|
-
* sandbox client `voice.authorizations.create({ request: 'sandbox' })` sends
|
|
85
|
-
* this; the sandbox completes it without reaching any processor. A live
|
|
86
|
-
* client refuses it before any call (`sandbox_request_in_live`).
|
|
87
|
-
*/
|
|
88
|
-
export declare const SANDBOX_REQUEST: PausedRequest;
|
|
89
|
-
/** The sealed bundle for the host, from a typed challenge; refuses one the frame cannot sign for. */
|
|
90
|
-
export declare function bundleOf(ch: VoiceChallenge): HostApprovalBundle;
|
|
91
|
-
/** `agentcard.voice`: constructed by the client, never on its own. */
|
|
92
|
-
export declare class VoiceModule extends ApiModule {
|
|
93
|
-
private readonly options;
|
|
94
|
-
private readonly clientIsSandbox;
|
|
95
|
-
/** The approval posture the client was constructed with, one per business; `'sheet'` when the client named none. */
|
|
96
|
-
readonly approval: ApprovalPosture;
|
|
97
|
-
/** The grants this client minted, by session id: the verifier and the state, then the exchanged result. Memory only. */
|
|
98
|
-
private readonly grants;
|
|
99
|
-
/** Session id by minted `state`, so a return link finds its grant without naming the session. */
|
|
100
|
-
private readonly grantsByState;
|
|
101
|
-
constructor(t: ApiTransport, options: VoiceOptions | undefined, clientIsSandbox: () => boolean);
|
|
102
|
-
private posture;
|
|
103
|
-
/** Where the Vault sends the person back when a call names nothing, as the client was constructed. */
|
|
104
|
-
get returnUrl(): string | undefined;
|
|
105
|
-
/**
|
|
106
|
-
* The languages Agentcard speaks, as the API lists them (`{ tag, name }`),
|
|
107
|
-
* read once and kept for ten minutes. Every call that names a `lang` checks
|
|
108
|
-
* it against this list first and refuses one not on it with
|
|
109
|
-
* `unsupported_language` before anything is sent. `null` on an API that
|
|
110
|
-
* does not serve the list yet; tags then travel unchecked.
|
|
111
|
-
*/
|
|
112
|
-
languages(): Promise<LanguageInfo[] | null>;
|
|
113
|
-
private remember;
|
|
114
|
-
private forget;
|
|
115
|
-
/**
|
|
116
|
-
* Mints the connect link. The person signs in, stores a card if none, sets
|
|
117
|
-
* up their voice if the app requires it, and comes back. Open `url` in the
|
|
118
|
-
* in-app sheet. The link is an OAuth authorization grant: the client mints
|
|
119
|
-
* `state` and a PKCE challenge, keeps the verifier, and the return link
|
|
120
|
-
* comes back as `yourapp://connected?code=…&state=…`; hand it to
|
|
121
|
-
* `completeConnect(url)`, once, within 60 seconds. With no return link there
|
|
122
|
-
* is nothing to carry the code, so the mint polls (`grant: 'poll'`, then
|
|
123
|
-
* `awaitConnected`); `pkce: false` asks for that shape outright (deprecated).
|
|
124
|
-
* A grant asks for the terms it names in `authorization_details`, and for
|
|
125
|
-
* all three when it names none; the terms are enforced from then on. The
|
|
126
|
-
* result carries the client's approval posture as `approval`, for the app.
|
|
127
|
-
*/
|
|
128
|
-
connect(input?: ConnectInput): Promise<ConnectResult>;
|
|
129
|
-
/**
|
|
130
|
-
* The grant's exchange: the `code` from the return link, under this client's
|
|
131
|
-
* credentials, with the verifier the client kept for the session. Answers
|
|
132
|
-
* once, within 60 seconds of the link. A `state` that is not the one minted
|
|
133
|
-
* for the session is refused here, before any call (`state_mismatch`). When
|
|
134
|
-
* another instance minted the link, pass the `code_verifier` AND the
|
|
135
|
-
* `expected_state` that `connect` returned there: the link's `state` is
|
|
136
|
-
* compared with `expected_state` locally, and no exchange is made without
|
|
137
|
-
* that comparison. The API's refusals come through verbatim: `invalid_grant`,
|
|
138
|
-
* `not_linked` (the person is not done; try again), `code_expired`,
|
|
139
|
-
* `already_exchanged`, `revoked`. `completeConnect(url)` reads the link and
|
|
140
|
-
* calls this.
|
|
141
|
-
*/
|
|
142
|
-
exchange(input: ExchangeInput): Promise<Exchanged>;
|
|
143
|
-
/**
|
|
144
|
-
* The return link, as the sheet handed it back (`yourapp://connected?code=…&state=…`):
|
|
145
|
-
* finds the grant by its `state`, checks it, and exchanges the code. Throws
|
|
146
|
-
* `missing_code` when the link carries none (a session minted to poll, a
|
|
147
|
-
* reset or an action link: read those with `awaitConnected`).
|
|
148
|
-
*/
|
|
149
|
-
completeConnect(returnUrl: string, opts?: {
|
|
150
|
-
session_id?: string;
|
|
151
|
-
code_verifier?: string;
|
|
152
|
-
expected_state?: string;
|
|
153
|
-
}): Promise<Exchanged>;
|
|
154
|
-
/**
|
|
155
|
-
* Resolves once the session is linked: who, and what the app may use.
|
|
156
|
-
* For a grant this client minted it resolves when `exchange` (or
|
|
157
|
-
* `completeConnect`) has answered for that session, and reads nothing
|
|
158
|
-
* meanwhile; for a polling mint it polls the session. Throws
|
|
159
|
-
* `connect_timeout` at the deadline, and `grant_requires_exchange` when the
|
|
160
|
-
* API says the session is a grant this client does not hold the verifier for.
|
|
161
|
-
* For one read with no wait, `sessions.get(session_id)`.
|
|
162
|
-
*/
|
|
163
|
-
awaitConnected(sessionId: string, opts?: {
|
|
164
|
-
timeout_ms?: number;
|
|
165
|
-
}): Promise<Connected>;
|
|
166
|
-
readonly sessions: {
|
|
167
|
-
/**
|
|
168
|
-
* Where a link stands, in one read and with no wait: its status, how its result is collected (`grant`), and
|
|
169
|
-
* the diary (`last_step`, `reason`) that says why a link came back with nothing. On a linked grant the
|
|
170
|
-
* connected result stays behind the exchange (`exchange_required: true`, the person's fields null); a
|
|
171
|
-
* polling mint reads its result here as `awaitConnected` gives it. `slow_down` is waited out.
|
|
172
|
-
*/
|
|
173
|
-
get: (sessionId: string) => Promise<SessionState>;
|
|
174
|
-
};
|
|
175
|
-
/**
|
|
176
|
-
* Revokes the connection a session made: the token its exchange minted is
|
|
177
|
-
* revoked, and an unexchanged code refuses from then on. Idempotent.
|
|
178
|
-
*/
|
|
179
|
-
disconnect(sessionId: string): Promise<Revoked>;
|
|
180
|
-
readonly people: {
|
|
181
|
-
/**
|
|
182
|
-
* A returning person: what they already have with this business, without
|
|
183
|
-
* minting a link or sending them anywhere. Store `user_id` from the first
|
|
184
|
-
* exchange; on a later launch read here first, and `connect` only for what
|
|
185
|
-
* is missing (no card, or `voice: 'required'` and no voice for the bot's
|
|
186
|
-
* language). 404 `connection_not_found` when the person never connected
|
|
187
|
-
* through this client (or disconnected). The `user_id` in the answer is
|
|
188
|
-
* the effective one: a merged account answers with its survivor, worth
|
|
189
|
-
* storing from then on.
|
|
190
|
-
*/
|
|
191
|
-
get: (userId: string) => Promise<Person>;
|
|
192
|
-
};
|
|
193
|
-
readonly authorizations: {
|
|
194
|
-
/**
|
|
195
|
-
* Creates the purchase, paused for approval, for the person `user_id`
|
|
196
|
-
* names (the `user_id` the connect exchange returned; required, so a
|
|
197
|
-
* server serving many people never charges the wrong one).
|
|
198
|
-
* `execution_mode: 'autopilot'` means the person's rule took it and no
|
|
199
|
-
* voice step follows. The return link (the call's, else the client's
|
|
200
|
-
* `returnUrl`) goes in the create, so Agentcard stores it on the request
|
|
201
|
-
* and the approval page reads it from there; the `approval_url` returned
|
|
202
|
-
* is id-only. `request: 'sandbox'` is the first-run form: under a sandbox
|
|
203
|
-
* client (`sandbox: true`, an `sk_test_` credential, or a mode the token
|
|
204
|
-
* exchange named) it sends the sandbox request and names no processor; a
|
|
205
|
-
* live client refuses it before the create leaves (`sandbox_request_in_live`). Every
|
|
206
|
-
* create carries an idempotency key, so a retried call makes one purchase.
|
|
207
|
-
*/
|
|
208
|
-
create: (input: CreateAuthorizationInput) => Promise<Authorization>;
|
|
209
|
-
/**
|
|
210
|
-
* Names the card that pays, before the approval (decision 213): the person said "another card", or chose
|
|
211
|
-
* one from `cards`. `cardId` is one of the person's stored cards as `cards` lists them; a card that is not
|
|
212
|
-
* theirs is `card_not_found`. Refused once the purchase is decided (`already_finalized`) or while the card is
|
|
213
|
-
* with the processor (`replay_in_progress`). Answers the purchase as `get` reads it, `card` and `cards`
|
|
214
|
-
* included. Ask for the key word after this, so the line names the card that will pay.
|
|
215
|
-
*/
|
|
216
|
-
setCard: (authorizationId: string, cardId: string) => Promise<AuthorizationResult>;
|
|
217
|
-
/**
|
|
218
|
-
* One read of a purchase, with no wait: its status, what approved it, the
|
|
219
|
-
* request fields, the settlement once it finished, and what a paused
|
|
220
|
-
* page resumes with. The way to ask "is it decided yet?" from a handler
|
|
221
|
-
* that cannot wait; `awaitResult` is the way to wait. `slow_down` is
|
|
222
|
-
* waited out.
|
|
223
|
-
*/
|
|
224
|
-
get: (authorizationId: string) => Promise<AuthorizationResult>;
|
|
225
|
-
/**
|
|
226
|
-
* Withdraws a purchase that still awaits the person, in the business's own words: the person closed the
|
|
227
|
-
* sheet (`person_closed_sheet`), the person changed their mind (`person_changed_mind`), or a reason of the
|
|
228
|
-
* business's own (`business_cancelled`). The purchase reads `status: 'cancelled'` from then on, the reason
|
|
229
|
-
* is its `terminal_reason` on every read and on the `checkout_authorization.cancelled` webhook, and
|
|
230
|
-
* `awaitResult` reads `status: 'cancelled'` at once. Idempotent: a purchase already
|
|
231
|
-
* withdrawn answers what it became. One that the person already approved cannot be withdrawn
|
|
232
|
-
* (`409 already_finalized` once it finished, `409 outcome_unknown` while the card is with the processor).
|
|
233
|
-
*/
|
|
234
|
-
cancel: (authorizationId: string, opts: {
|
|
235
|
-
reason: CancelReason;
|
|
236
|
-
}) => Promise<Cancelled>;
|
|
237
|
-
};
|
|
238
|
-
readonly approvals: {
|
|
239
|
-
/**
|
|
240
|
-
* The purchase's approval page on the Vault. It offers whichever doors the
|
|
241
|
-
* device has (voice, Face ID, Touch ID, the master password), so it is the
|
|
242
|
-
* way in for a person who forgot the passphrase, a bot with no microphone,
|
|
243
|
-
* or an agent with no screen, and it is the person-held tier of an in-app
|
|
244
|
-
* approval (`approve` from the app half opens it in the sheet). The read
|
|
245
|
-
* names the return link (this call's, else the client's `returnUrl`),
|
|
246
|
-
* the exact registered link the Vault sends the person back to once
|
|
247
|
-
* approved, and Agentcard stores it on the request, so the sheet closes on
|
|
248
|
-
* its own; the link returned is id-only, the page reads the return from
|
|
249
|
-
* Agentcard. Open it (or send it), then `awaitResult`. Null once the
|
|
250
|
-
* purchase no longer awaits a person.
|
|
251
|
-
*/
|
|
252
|
-
approvalUrl: (authorizationId: string, opts?: {
|
|
253
|
-
return_url?: string;
|
|
254
|
-
}) => Promise<string | null>;
|
|
255
|
-
};
|
|
256
|
-
/**
|
|
257
|
-
* Asks for the one-time key word. Your bot says `say[lang]` when the
|
|
258
|
-
* person wears headphones, `say_private[lang]` when the phone plays through
|
|
259
|
-
* its speaker or the route is unknown (the line then points at the screen,
|
|
260
|
-
* where your app shows `word`). With `voice: 'braxter'` the response also
|
|
261
|
-
* carries `audio_url`, Agentcard's own voice saying the line, when the
|
|
262
|
-
* deployment has it; `delivery: 'screen'` asks for the private form of that
|
|
263
|
-
* audio. Every field is typed: `challenge` and `intent` are what the app's
|
|
264
|
-
* hosted frame signs over, `verifier_url` and `answer_token` where and with
|
|
265
|
-
* what the phone streams. `lang` defaults to `en` and is checked against
|
|
266
|
-
* `languages()` first. 409 `voice_not_enrolled` when the person has no
|
|
267
|
-
* voice key for apps.
|
|
268
|
-
*/
|
|
269
|
-
challenge(authorizationId: string, opts?: {
|
|
270
|
-
lang?: Language;
|
|
271
|
-
voice?: 'braxter';
|
|
272
|
-
delivery?: 'spoken' | 'screen';
|
|
273
|
-
}): Promise<VoiceChallenge>;
|
|
274
|
-
/**
|
|
275
|
-
* The key word for an in-app approval, as one sealed bundle: mints the
|
|
276
|
-
* challenge and hands back the object your app forwards to
|
|
277
|
-
* `VoiceHost.approve` unread. It carries the word and both lines, Agentcard's
|
|
278
|
-
* audio when asked for, the nonce and the intent the frame signs over, and
|
|
279
|
-
* the verifier's address with the answer token the phone streams with (both
|
|
280
|
-
* absent from an API older than them). Refuses with `challenge_incomplete`
|
|
281
|
-
* when the API minted no nonce or intent, since the frame cannot sign
|
|
282
|
-
* without them.
|
|
283
|
-
*/
|
|
284
|
-
challengeForHost(authorizationId: string, opts?: {
|
|
285
|
-
lang?: Language;
|
|
286
|
-
voice?: 'braxter';
|
|
287
|
-
delivery?: 'spoken' | 'screen';
|
|
288
|
-
}): Promise<HostApprovalBundle>;
|
|
289
|
-
readonly appKeys: {
|
|
290
|
-
/**
|
|
291
|
-
* Registers the app voice key your app's hosted frame minted (`VoiceHost.provision` relays its description),
|
|
292
|
-
* under this client's credentials, against the person connected to your app. Hand the `credential` back to
|
|
293
|
-
* the phone and nothing else. `user_id` is the person the connect exchange returned; required. 404
|
|
294
|
-
* `connection_not_found` when the person never connected through this client; 409 `credential_exists`
|
|
295
|
-
* when the credential id already names a different key. The same key again answers with a fresh credential.
|
|
296
|
-
* `hardware` (WP199), when the phone minted a hardware key for this app voice key, is its attestation as the
|
|
297
|
-
* phone handed it over: on the key itself (`key.hardware`, where `VoiceHost` 1.9.8 puts it, so a server that
|
|
298
|
-
* forwards the key as it came needs no change) or in `opts.hardware`, which wins when both are given. It is sent
|
|
299
|
-
* on as is, and the answer's `hardware_proven` and `hardware_level` say what Agentcard made of it.
|
|
300
|
-
*/
|
|
301
|
-
register: (key: AppVoiceKeyDescription, opts: {
|
|
302
|
-
user_id: string;
|
|
303
|
-
hardware?: HardwareAttestation;
|
|
304
|
-
}) => Promise<RegisteredAppVoiceKey>;
|
|
305
|
-
/** Revokes one app voice key of the person `user_id` names; the person's other keys, the card and the connection stay. Idempotent. */
|
|
306
|
-
revoke: (keyId: string, opts: {
|
|
307
|
-
user_id: string;
|
|
308
|
-
}) => Promise<RevokedAppVoiceKey>;
|
|
309
|
-
};
|
|
310
|
-
/**
|
|
311
|
-
* The streaming door from your server, the push direction: your pipeline
|
|
312
|
-
* already has the person's audio, so hand it to the verifier as it comes.
|
|
313
|
-
* `push` the bytes in `format`, `end` when the person is done (or let the
|
|
314
|
-
* verifier close the span itself), and read `hearing` and `verdict`. A
|
|
315
|
-
* finished recording is a short stream: see `streamBuffer`. The bearer is
|
|
316
|
-
* this client's token. The address is `stream_url` on the call, else the
|
|
317
|
-
* client's `voice.verifierUrl`, else the `verifier_url` the challenge
|
|
318
|
-
* itself carries. `lang` defaults to the challenge's language, else `en`.
|
|
319
|
-
*/
|
|
320
|
-
stream(challenge: VoiceChallenge | HostApprovalBundle, opts: {
|
|
321
|
-
format: StreamFormat;
|
|
322
|
-
lang?: Language;
|
|
323
|
-
authorization_id?: string;
|
|
324
|
-
stream_url?: string;
|
|
325
|
-
channel?: ChannelKind;
|
|
326
|
-
}): Promise<StreamHandle>;
|
|
327
|
-
/**
|
|
328
|
-
* "I forgot my passphrase." Mints a voice-only link that starts the
|
|
329
|
-
* person's voice key over: the Vault forgets the device key, revokes the
|
|
330
|
-
* enrolment, and runs set-up again. Open `url` in the sheet, then
|
|
331
|
-
* `awaitConnected(session_id)`; `voice` reads `['en']` once it is done.
|
|
332
|
-
*/
|
|
333
|
-
reset(input?: VoiceResetInput): Promise<ConnectResult>;
|
|
334
|
-
/**
|
|
335
|
-
* Polls the purchase until it leaves `awaiting_approval`; `{ status: 'timeout' }`
|
|
336
|
-
* at the deadline. The first read's `interval` (seconds) is the least this
|
|
337
|
-
* waits between reads, and a `slow_down` answer backs off to the interval
|
|
338
|
-
* it names and keeps polling. The result carries `request_id`,
|
|
339
|
-
* `terminal_reason`, `interaction_evidence`, `intent` and the other request
|
|
340
|
-
* fields beside `status`, and on a finished purchase the `settlement`
|
|
341
|
-
* answer the finishing webhook carries. For one read with no wait,
|
|
342
|
-
* `authorizations.get(id)`.
|
|
343
|
-
*/
|
|
344
|
-
awaitResult(authorizationId: string, opts?: {
|
|
345
|
-
timeout_ms?: number;
|
|
346
|
-
}): Promise<AuthorizationResult>;
|
|
347
|
-
readonly actions: {
|
|
348
|
-
/**
|
|
349
|
-
* Mints the link that carries one action. Open `url` in the sheet:
|
|
350
|
-
* Agentcard's voice reads the action back, the person confirms it with the
|
|
351
|
-
* secure passphrase and the key word, the Vault runs it and returns.
|
|
352
|
-
* Throws `action_unavailable` for a kind the Vault cannot carry out yet.
|
|
353
|
-
*/
|
|
354
|
-
propose: (action: Action, input?: {
|
|
355
|
-
return_url?: string;
|
|
356
|
-
lang?: Language;
|
|
357
|
-
}) => Promise<Proposed>;
|
|
358
|
-
/**
|
|
359
|
-
* One read of an action's link, with no wait: whether the action is done and confirmed, whether a rule
|
|
360
|
-
* covers the card now, the link's status, and the last step and reason its page recorded.
|
|
361
|
-
*/
|
|
362
|
-
get: (sessionId: string) => Promise<ActionState>;
|
|
363
|
-
/**
|
|
364
|
-
* Polls the action's session until it reads done, or the deadline; the last state comes back either
|
|
365
|
-
* way, with the last step the Vault's page reached and the last reason it recorded, so a bot that
|
|
366
|
-
* gets `done: false` can say why ("your voice didn't confirm it", "that browser holds no voice key").
|
|
367
|
-
* For one read with no wait, `actions.get(session_id)`.
|
|
368
|
-
*/
|
|
369
|
-
awaitDone: (sessionId: string, opts?: {
|
|
370
|
-
timeout_ms?: number;
|
|
371
|
-
}) => Promise<Done>;
|
|
372
|
-
};
|
|
373
|
-
}
|