@alfe.ai/agent-api-client 0.2.3 → 0.4.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/README.md +16 -0
- package/dist/index.cjs +186 -1
- package/dist/index.d.cts +192 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +192 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +186 -1
- package/dist/index.js.map +1 -1
- package/package.json +10 -1
package/README.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# @alfe.ai/agent-api-client
|
|
2
|
+
|
|
3
|
+
Agent self-service API client — agents calling /agents/ endpoints
|
|
4
|
+
|
|
5
|
+
Part of [**Alfe**](https://alfe.ai) — the operating system for AI agents: build, deploy, and run agents with persistent memory, identity, integrations, and channels. See the [documentation](https://docs.alfe.ai) to get started.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @alfe.ai/agent-api-client
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Links
|
|
14
|
+
|
|
15
|
+
- 🌐 Website: <https://alfe.ai>
|
|
16
|
+
- 📚 Docs: <https://docs.alfe.ai>
|
package/dist/index.cjs
CHANGED
|
@@ -203,7 +203,7 @@ var AgentApiClient = class {
|
|
|
203
203
|
* @deprecated Returns a single primary credential blob (legacy "pick-the-
|
|
204
204
|
* default-connection" shape). Use `getGithubAccounts()` for the multi-
|
|
205
205
|
* account shape required by Pattern A — explicit selector args on every
|
|
206
|
-
* tool. Retained because the `@alfe.ai/
|
|
206
|
+
* tool. Retained because the `@alfe.ai/github-mcp` proxy is the
|
|
207
207
|
* only consumer that knows about Pattern A; legacy env-interpolation
|
|
208
208
|
* callers will keep hitting `/credentials` until they move to the proxy.
|
|
209
209
|
*/
|
|
@@ -447,6 +447,52 @@ var AgentApiClient = class {
|
|
|
447
447
|
return this.request("/agent/connect/myob/refresh", { method: "POST" });
|
|
448
448
|
}
|
|
449
449
|
/**
|
|
450
|
+
* @deprecated Returns a single primary credential blob. Use
|
|
451
|
+
* `getSalesforceAccounts()` for the multi-account shape required by
|
|
452
|
+
* Pattern A.
|
|
453
|
+
*/
|
|
454
|
+
async getSalesforceCredentials() {
|
|
455
|
+
const raw = await this.request("/agent/connect/salesforce/credentials");
|
|
456
|
+
return {
|
|
457
|
+
accessToken: raw.accessToken,
|
|
458
|
+
accessTokenExpiresAt: raw.accessTokenExpiresAt ?? "",
|
|
459
|
+
instanceUrl: raw.instanceUrl ?? "",
|
|
460
|
+
orgId: raw.orgId ?? ""
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Pattern A: multi-account credential fetch for Salesforce. Returns every
|
|
465
|
+
* agent-scoped Salesforce connection. One OAuth grant maps to one org, so
|
|
466
|
+
* `accounts[i].accountIdentifier` (and `orgId`) is the Salesforce org id —
|
|
467
|
+
* the selector every credential-touching tool requires.
|
|
468
|
+
*/
|
|
469
|
+
async getSalesforceAccounts() {
|
|
470
|
+
return { accounts: (await this.request("/agent/connect/salesforce/accounts")).accounts.map((a) => ({
|
|
471
|
+
connectionId: a.connectionId,
|
|
472
|
+
accountIdentifier: a.accountIdentifier,
|
|
473
|
+
displayName: a.displayName,
|
|
474
|
+
connectedAt: a.connectedAt,
|
|
475
|
+
accessToken: a.accessToken,
|
|
476
|
+
accessTokenExpiresAt: a.accessTokenExpiresAt ?? "",
|
|
477
|
+
instanceUrl: a.instanceUrl ?? "",
|
|
478
|
+
orgId: a.orgId ?? a.accountIdentifier
|
|
479
|
+
})) };
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Refresh the access token for a specific Salesforce org. Salesforce
|
|
483
|
+
* tokens aren't interchangeable across orgs, so the connection is targeted
|
|
484
|
+
* by `accountIdentifier` (the org id) — mirrors `refreshXeroAccountToken`.
|
|
485
|
+
*/
|
|
486
|
+
async refreshSalesforceAccountToken(orgId) {
|
|
487
|
+
const path = `/agent/connect/salesforce/accounts/${encodeURIComponent(orgId)}/refresh`;
|
|
488
|
+
const raw = await this.request(path, { method: "POST" });
|
|
489
|
+
return {
|
|
490
|
+
accessToken: raw.accessToken,
|
|
491
|
+
accessTokenExpiresAt: raw.accessTokenExpiresAt ?? "",
|
|
492
|
+
expiresAt: raw.expiresAt ?? ""
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
450
496
|
* Microsoft 365 (delegated OAuth) credential fetch — single-account shape.
|
|
451
497
|
*
|
|
452
498
|
* @deprecated Use `getMicrosoftAccounts()` and dispatch via the `email`
|
|
@@ -550,6 +596,47 @@ var AgentApiClient = class {
|
|
|
550
596
|
body: JSON.stringify(data)
|
|
551
597
|
});
|
|
552
598
|
}
|
|
599
|
+
/** Update the agent's own name and/or voice config. Returns the updated agent. */
|
|
600
|
+
async updateSelf(update) {
|
|
601
|
+
return this.request("/agent/self", {
|
|
602
|
+
method: "PATCH",
|
|
603
|
+
body: JSON.stringify(update)
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Generate the agent's own avatar from a text prompt. The image is generated,
|
|
608
|
+
* stored, and set on the agent server-side; returns the updated agent.
|
|
609
|
+
*/
|
|
610
|
+
async generateAvatar(args) {
|
|
611
|
+
return this.request("/agent/avatar/generate", {
|
|
612
|
+
method: "POST",
|
|
613
|
+
body: JSON.stringify(args)
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
/**
|
|
617
|
+
* Get a presigned PUT URL to upload a new avatar image. Upload the bytes to
|
|
618
|
+
* `uploadUrl`, then call `finalizeAvatar(s3Key)` to set it on the agent.
|
|
619
|
+
*/
|
|
620
|
+
async presignAvatar(args) {
|
|
621
|
+
return this.request("/agent/avatar/presign", {
|
|
622
|
+
method: "POST",
|
|
623
|
+
body: JSON.stringify(args)
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* Finalize an avatar upload — validates ownership + size, then sets the
|
|
628
|
+
* agent's `avatarUrl` server-side. Returns the updated agent.
|
|
629
|
+
*/
|
|
630
|
+
async finalizeAvatar(s3Key) {
|
|
631
|
+
return this.request("/agent/avatar", {
|
|
632
|
+
method: "POST",
|
|
633
|
+
body: JSON.stringify({ s3Key })
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
/** List the platform voice catalogue (ElevenLabs) so the agent can pick its own voice. */
|
|
637
|
+
async listVoices() {
|
|
638
|
+
return this.request("/agent/voices");
|
|
639
|
+
}
|
|
553
640
|
/**
|
|
554
641
|
* Mint a fresh AES-256 data key for a specific (secret, field) pair. The
|
|
555
642
|
* encryption context is rebuilt server-side from `auth.tenantId` + the body
|
|
@@ -945,6 +1032,104 @@ var AgentApiClient = class {
|
|
|
945
1032
|
body: JSON.stringify(entry)
|
|
946
1033
|
}).catch(() => {});
|
|
947
1034
|
}
|
|
1035
|
+
async requestBrowserTakeover(args) {
|
|
1036
|
+
return this.request("/agent/remote/takeover", {
|
|
1037
|
+
method: "POST",
|
|
1038
|
+
body: JSON.stringify(args)
|
|
1039
|
+
});
|
|
1040
|
+
}
|
|
1041
|
+
async getRemoteSession(sessionId) {
|
|
1042
|
+
return this.request(`/agent/remote/sessions/${encodeURIComponent(sessionId)}`);
|
|
1043
|
+
}
|
|
1044
|
+
async completeRemoteSession(sessionId) {
|
|
1045
|
+
return this.request(`/agent/remote/sessions/${encodeURIComponent(sessionId)}/complete`, {
|
|
1046
|
+
method: "POST",
|
|
1047
|
+
body: JSON.stringify({})
|
|
1048
|
+
});
|
|
1049
|
+
}
|
|
1050
|
+
/**
|
|
1051
|
+
* Issue a request that returns the raw `Response` (no JSON parsing, no
|
|
1052
|
+
* forced Content-Type). The caller sets `Content-Type`/`Accept` on `headers`
|
|
1053
|
+
* and reads the body itself (`arrayBuffer()` / `json()`).
|
|
1054
|
+
*
|
|
1055
|
+
* A single retry fires only on the same transient statuses `request()`
|
|
1056
|
+
* retries (authorizer-timeout 500 + LB 502/503/504) and transient network
|
|
1057
|
+
* errors — before the route handler runs — so re-issuing a POST does not
|
|
1058
|
+
* risk a duplicate side effect. Voice TTS/STT are effectively idempotent
|
|
1059
|
+
* (re-synthesize / re-transcribe) and meter server-side keyed on the
|
|
1060
|
+
* gateway requestId, so a retried transcription doesn't double-bill.
|
|
1061
|
+
*/
|
|
1062
|
+
async rawFetch(path, init) {
|
|
1063
|
+
const url = `${this.apiUrl}${path}`;
|
|
1064
|
+
init.headers.set("Authorization", `Bearer ${this.apiKey}`);
|
|
1065
|
+
let lastError;
|
|
1066
|
+
for (let attempt = 1; attempt <= 2; attempt++) try {
|
|
1067
|
+
const res = await fetch(url, {
|
|
1068
|
+
method: init.method,
|
|
1069
|
+
headers: init.headers,
|
|
1070
|
+
body: init.body,
|
|
1071
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
|
|
1072
|
+
});
|
|
1073
|
+
if (!res.ok) {
|
|
1074
|
+
await res.text();
|
|
1075
|
+
const error = /* @__PURE__ */ new Error(`Agent API request failed (${String(res.status)})`);
|
|
1076
|
+
if (attempt === 1 && RETRYABLE_STATUS.has(res.status)) {
|
|
1077
|
+
lastError = error;
|
|
1078
|
+
await sleep(RETRY_DELAY_MS);
|
|
1079
|
+
continue;
|
|
1080
|
+
}
|
|
1081
|
+
throw error;
|
|
1082
|
+
}
|
|
1083
|
+
return res;
|
|
1084
|
+
} catch (err) {
|
|
1085
|
+
if (attempt === 1 && isRetryableNetworkError(err)) {
|
|
1086
|
+
lastError = err;
|
|
1087
|
+
await sleep(RETRY_DELAY_MS);
|
|
1088
|
+
continue;
|
|
1089
|
+
}
|
|
1090
|
+
throw err;
|
|
1091
|
+
}
|
|
1092
|
+
throw lastError instanceof Error ? lastError : new Error(String(lastError));
|
|
1093
|
+
}
|
|
1094
|
+
/**
|
|
1095
|
+
* Text-to-speech. Returns raw PCM audio bytes plus their framing — the
|
|
1096
|
+
* voice service defaults to 24 kHz / mono / 16-bit. Wrap in a WAV container
|
|
1097
|
+
* to produce a playable file. Metered per character against the tenant
|
|
1098
|
+
* credit pool server-side; TTS completes regardless of metering outcome.
|
|
1099
|
+
*/
|
|
1100
|
+
async tts(args) {
|
|
1101
|
+
const headers = new Headers();
|
|
1102
|
+
headers.set("Content-Type", "application/json");
|
|
1103
|
+
headers.set("Accept", "audio/pcm");
|
|
1104
|
+
const res = await this.rawFetch("/voice/tts", {
|
|
1105
|
+
method: "POST",
|
|
1106
|
+
headers,
|
|
1107
|
+
body: JSON.stringify(args)
|
|
1108
|
+
});
|
|
1109
|
+
return {
|
|
1110
|
+
audio: Buffer.from(await res.arrayBuffer()),
|
|
1111
|
+
sampleRate: parseInt(res.headers.get("x-sample-rate") ?? "24000", 10),
|
|
1112
|
+
channels: parseInt(res.headers.get("x-channels") ?? "1", 10),
|
|
1113
|
+
bitDepth: parseInt(res.headers.get("x-bit-depth") ?? "16", 10)
|
|
1114
|
+
};
|
|
1115
|
+
}
|
|
1116
|
+
/**
|
|
1117
|
+
* Speech-to-text. Accepts raw linear16 (16-bit LE) mono PCM — NOT a WAV or
|
|
1118
|
+
* other container (the endpoint transcribes with a fixed linear16 encoding,
|
|
1119
|
+
* so a container header would be transcribed as noise). Strip any WAV header
|
|
1120
|
+
* and pass `sampleRate` from it before calling. Metered by transcribed
|
|
1121
|
+
* duration against the tenant credit pool server-side.
|
|
1122
|
+
*/
|
|
1123
|
+
async stt(args) {
|
|
1124
|
+
const headers = new Headers();
|
|
1125
|
+
headers.set("Content-Type", "application/octet-stream");
|
|
1126
|
+
headers.set("x-sample-rate", String(args.sampleRate));
|
|
1127
|
+
return (await (await this.rawFetch("/voice/stt", {
|
|
1128
|
+
method: "POST",
|
|
1129
|
+
headers,
|
|
1130
|
+
body: args.audio
|
|
1131
|
+
})).json()).data;
|
|
1132
|
+
}
|
|
948
1133
|
};
|
|
949
1134
|
//#endregion
|
|
950
1135
|
exports.AgentApiClient = AgentApiClient;
|
package/dist/index.d.cts
CHANGED
|
@@ -6,6 +6,15 @@ interface AgentApiClientConfig {
|
|
|
6
6
|
apiKey: string;
|
|
7
7
|
apiUrl: string;
|
|
8
8
|
}
|
|
9
|
+
interface RemoteSessionInfo {
|
|
10
|
+
sessionId: string;
|
|
11
|
+
agentId: string;
|
|
12
|
+
surface: "browser" | "terminal";
|
|
13
|
+
status: "agent_driving" | "awaiting_human" | "human_in_control" | "resuming" | "completed" | "expired" | "failed";
|
|
14
|
+
url?: string;
|
|
15
|
+
instructions?: string;
|
|
16
|
+
requestedAt?: string;
|
|
17
|
+
}
|
|
9
18
|
interface SyncAgentInfo {
|
|
10
19
|
agentId: string;
|
|
11
20
|
tenantId: string;
|
|
@@ -146,6 +155,79 @@ interface KnowledgeDoc {
|
|
|
146
155
|
createdAt: string;
|
|
147
156
|
updatedAt: string;
|
|
148
157
|
}
|
|
158
|
+
/** Voice settings — core agent config. Mirrors `VoiceConfig` in `@alfe/types`. */
|
|
159
|
+
interface AgentVoiceConfig {
|
|
160
|
+
/** ElevenLabs voice ID; platform default when unset. */
|
|
161
|
+
voiceId?: string;
|
|
162
|
+
ttsModel?: string;
|
|
163
|
+
enabled?: boolean;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* The agent's own public identity, as returned by `updateSelf`, `generateAvatar`,
|
|
167
|
+
* `presignAvatar`'s finalize (`finalizeAvatar`). This is the public agent
|
|
168
|
+
* projection; only the identity-relevant fields are typed here — the response
|
|
169
|
+
* carries the full public agent record.
|
|
170
|
+
*/
|
|
171
|
+
interface AgentSelf {
|
|
172
|
+
agentId: string;
|
|
173
|
+
tenantId: string;
|
|
174
|
+
name: string;
|
|
175
|
+
avatarUrl?: string;
|
|
176
|
+
voiceConfig?: AgentVoiceConfig;
|
|
177
|
+
status: string;
|
|
178
|
+
}
|
|
179
|
+
/** Result of `presignAvatar` — the agent PUTs bytes to `uploadUrl`, then finalizes with `s3Key`. */
|
|
180
|
+
interface AgentAvatarPresign {
|
|
181
|
+
/** Presigned PUT URL to upload the image bytes to. */
|
|
182
|
+
uploadUrl: string;
|
|
183
|
+
/** Object key — echoed back to `finalizeAvatar`. */
|
|
184
|
+
s3Key: string;
|
|
185
|
+
/** Stable public URL the avatar will be served from once finalized. */
|
|
186
|
+
publicUrl: string;
|
|
187
|
+
/** ISO expiry of the presigned PUT URL. */
|
|
188
|
+
expiresAt: string;
|
|
189
|
+
}
|
|
190
|
+
/** A voice in the platform catalogue (ElevenLabs), from `listVoices`. */
|
|
191
|
+
interface AgentVoice {
|
|
192
|
+
id: string;
|
|
193
|
+
name: string;
|
|
194
|
+
previewUrl: string;
|
|
195
|
+
description: string;
|
|
196
|
+
labels: Record<string, string>;
|
|
197
|
+
category: string;
|
|
198
|
+
}
|
|
199
|
+
/** The ElevenLabs models with a pricing row — the TTS endpoint rejects any other value. */
|
|
200
|
+
type VoiceTtsModel = "eleven_turbo_v2_5" | "eleven_multilingual_v2";
|
|
201
|
+
interface VoiceTtsArgs {
|
|
202
|
+
/** Text to synthesize (1–5000 chars — the endpoint enforces this). */
|
|
203
|
+
text: string;
|
|
204
|
+
/** ElevenLabs voice id; platform default when unset. */
|
|
205
|
+
voiceId?: string;
|
|
206
|
+
/** TTS model; `eleven_turbo_v2_5` (lower latency) when unset. */
|
|
207
|
+
model?: VoiceTtsModel;
|
|
208
|
+
}
|
|
209
|
+
/** Raw synthesized audio plus its PCM framing (from the response headers). */
|
|
210
|
+
interface VoiceTtsResult {
|
|
211
|
+
/** Raw little-endian PCM samples — no container. Wrap in WAV to make a playable file. */
|
|
212
|
+
audio: Buffer;
|
|
213
|
+
/** Samples per second (e.g. 24000). */
|
|
214
|
+
sampleRate: number;
|
|
215
|
+
/** Channel count (mono = 1). */
|
|
216
|
+
channels: number;
|
|
217
|
+
/** Bits per sample (e.g. 16). */
|
|
218
|
+
bitDepth: number;
|
|
219
|
+
}
|
|
220
|
+
interface VoiceSttArgs {
|
|
221
|
+
/** Raw linear16 (16-bit little-endian) mono PCM samples — no WAV/container header. */
|
|
222
|
+
audio: Uint8Array;
|
|
223
|
+
/** Sample rate of `audio` in Hz (8000–48000). */
|
|
224
|
+
sampleRate: number;
|
|
225
|
+
}
|
|
226
|
+
interface VoiceSttResult {
|
|
227
|
+
text: string;
|
|
228
|
+
/** Deepgram confidence in (0,1]. */
|
|
229
|
+
confidence: number;
|
|
230
|
+
}
|
|
149
231
|
declare class AgentApiClient {
|
|
150
232
|
private readonly apiKey;
|
|
151
233
|
private readonly apiUrl;
|
|
@@ -283,7 +365,7 @@ declare class AgentApiClient {
|
|
|
283
365
|
* @deprecated Returns a single primary credential blob (legacy "pick-the-
|
|
284
366
|
* default-connection" shape). Use `getGithubAccounts()` for the multi-
|
|
285
367
|
* account shape required by Pattern A — explicit selector args on every
|
|
286
|
-
* tool. Retained because the `@alfe.ai/
|
|
368
|
+
* tool. Retained because the `@alfe.ai/github-mcp` proxy is the
|
|
287
369
|
* only consumer that knows about Pattern A; legacy env-interpolation
|
|
288
370
|
* callers will keep hitting `/credentials` until they move to the proxy.
|
|
289
371
|
*/
|
|
@@ -512,6 +594,45 @@ declare class AgentApiClient {
|
|
|
512
594
|
accessToken: string;
|
|
513
595
|
expiresAt: string;
|
|
514
596
|
}>;
|
|
597
|
+
/**
|
|
598
|
+
* @deprecated Returns a single primary credential blob. Use
|
|
599
|
+
* `getSalesforceAccounts()` for the multi-account shape required by
|
|
600
|
+
* Pattern A.
|
|
601
|
+
*/
|
|
602
|
+
getSalesforceCredentials(): Promise<{
|
|
603
|
+
accessToken: string;
|
|
604
|
+
accessTokenExpiresAt: string;
|
|
605
|
+
instanceUrl: string;
|
|
606
|
+
orgId: string;
|
|
607
|
+
}>;
|
|
608
|
+
/**
|
|
609
|
+
* Pattern A: multi-account credential fetch for Salesforce. Returns every
|
|
610
|
+
* agent-scoped Salesforce connection. One OAuth grant maps to one org, so
|
|
611
|
+
* `accounts[i].accountIdentifier` (and `orgId`) is the Salesforce org id —
|
|
612
|
+
* the selector every credential-touching tool requires.
|
|
613
|
+
*/
|
|
614
|
+
getSalesforceAccounts(): Promise<{
|
|
615
|
+
accounts: {
|
|
616
|
+
connectionId: string;
|
|
617
|
+
accountIdentifier: string;
|
|
618
|
+
displayName: string | null;
|
|
619
|
+
connectedAt: string;
|
|
620
|
+
accessToken: string;
|
|
621
|
+
accessTokenExpiresAt: string;
|
|
622
|
+
instanceUrl: string;
|
|
623
|
+
orgId: string;
|
|
624
|
+
}[];
|
|
625
|
+
}>;
|
|
626
|
+
/**
|
|
627
|
+
* Refresh the access token for a specific Salesforce org. Salesforce
|
|
628
|
+
* tokens aren't interchangeable across orgs, so the connection is targeted
|
|
629
|
+
* by `accountIdentifier` (the org id) — mirrors `refreshXeroAccountToken`.
|
|
630
|
+
*/
|
|
631
|
+
refreshSalesforceAccountToken(orgId: string): Promise<{
|
|
632
|
+
accessToken: string;
|
|
633
|
+
accessTokenExpiresAt: string;
|
|
634
|
+
expiresAt: string;
|
|
635
|
+
}>;
|
|
515
636
|
/**
|
|
516
637
|
* Microsoft 365 (delegated OAuth) credential fetch — single-account shape.
|
|
517
638
|
*
|
|
@@ -630,6 +751,35 @@ declare class AgentApiClient {
|
|
|
630
751
|
}): Promise<{
|
|
631
752
|
recorded: boolean;
|
|
632
753
|
}>;
|
|
754
|
+
/** Update the agent's own name and/or voice config. Returns the updated agent. */
|
|
755
|
+
updateSelf(update: {
|
|
756
|
+
name?: string;
|
|
757
|
+
voiceConfig?: AgentVoiceConfig;
|
|
758
|
+
}): Promise<AgentSelf>;
|
|
759
|
+
/**
|
|
760
|
+
* Generate the agent's own avatar from a text prompt. The image is generated,
|
|
761
|
+
* stored, and set on the agent server-side; returns the updated agent.
|
|
762
|
+
*/
|
|
763
|
+
generateAvatar(args: {
|
|
764
|
+
prompt: string;
|
|
765
|
+
}): Promise<AgentSelf>;
|
|
766
|
+
/**
|
|
767
|
+
* Get a presigned PUT URL to upload a new avatar image. Upload the bytes to
|
|
768
|
+
* `uploadUrl`, then call `finalizeAvatar(s3Key)` to set it on the agent.
|
|
769
|
+
*/
|
|
770
|
+
presignAvatar(args: {
|
|
771
|
+
mimeType: string;
|
|
772
|
+
size: number;
|
|
773
|
+
}): Promise<AgentAvatarPresign>;
|
|
774
|
+
/**
|
|
775
|
+
* Finalize an avatar upload — validates ownership + size, then sets the
|
|
776
|
+
* agent's `avatarUrl` server-side. Returns the updated agent.
|
|
777
|
+
*/
|
|
778
|
+
finalizeAvatar(s3Key: string): Promise<AgentSelf>;
|
|
779
|
+
/** List the platform voice catalogue (ElevenLabs) so the agent can pick its own voice. */
|
|
780
|
+
listVoices(): Promise<{
|
|
781
|
+
voices: AgentVoice[];
|
|
782
|
+
}>;
|
|
633
783
|
/**
|
|
634
784
|
* Mint a fresh AES-256 data key for a specific (secret, field) pair. The
|
|
635
785
|
* encryption context is rebuilt server-side from `auth.tenantId` + the body
|
|
@@ -1124,8 +1274,48 @@ declare class AgentApiClient {
|
|
|
1124
1274
|
operation: string;
|
|
1125
1275
|
summary?: string;
|
|
1126
1276
|
}): Promise<void>;
|
|
1277
|
+
requestBrowserTakeover(args: {
|
|
1278
|
+
instructions: string;
|
|
1279
|
+
url?: string;
|
|
1280
|
+
conversationId?: string;
|
|
1281
|
+
}): Promise<{
|
|
1282
|
+
sessionId: string;
|
|
1283
|
+
status: string;
|
|
1284
|
+
}>;
|
|
1285
|
+
getRemoteSession(sessionId: string): Promise<RemoteSessionInfo>;
|
|
1286
|
+
completeRemoteSession(sessionId: string): Promise<{
|
|
1287
|
+
ok: boolean;
|
|
1288
|
+
}>;
|
|
1289
|
+
/**
|
|
1290
|
+
* Issue a request that returns the raw `Response` (no JSON parsing, no
|
|
1291
|
+
* forced Content-Type). The caller sets `Content-Type`/`Accept` on `headers`
|
|
1292
|
+
* and reads the body itself (`arrayBuffer()` / `json()`).
|
|
1293
|
+
*
|
|
1294
|
+
* A single retry fires only on the same transient statuses `request()`
|
|
1295
|
+
* retries (authorizer-timeout 500 + LB 502/503/504) and transient network
|
|
1296
|
+
* errors — before the route handler runs — so re-issuing a POST does not
|
|
1297
|
+
* risk a duplicate side effect. Voice TTS/STT are effectively idempotent
|
|
1298
|
+
* (re-synthesize / re-transcribe) and meter server-side keyed on the
|
|
1299
|
+
* gateway requestId, so a retried transcription doesn't double-bill.
|
|
1300
|
+
*/
|
|
1301
|
+
private rawFetch;
|
|
1302
|
+
/**
|
|
1303
|
+
* Text-to-speech. Returns raw PCM audio bytes plus their framing — the
|
|
1304
|
+
* voice service defaults to 24 kHz / mono / 16-bit. Wrap in a WAV container
|
|
1305
|
+
* to produce a playable file. Metered per character against the tenant
|
|
1306
|
+
* credit pool server-side; TTS completes regardless of metering outcome.
|
|
1307
|
+
*/
|
|
1308
|
+
tts(args: VoiceTtsArgs): Promise<VoiceTtsResult>;
|
|
1309
|
+
/**
|
|
1310
|
+
* Speech-to-text. Accepts raw linear16 (16-bit LE) mono PCM — NOT a WAV or
|
|
1311
|
+
* other container (the endpoint transcribes with a fixed linear16 encoding,
|
|
1312
|
+
* so a container header would be transcribed as noise). Strip any WAV header
|
|
1313
|
+
* and pass `sampleRate` from it before calling. Metered by transcribed
|
|
1314
|
+
* duration against the tenant credit pool server-side.
|
|
1315
|
+
*/
|
|
1316
|
+
stt(args: VoiceSttArgs): Promise<VoiceSttResult>;
|
|
1127
1317
|
}
|
|
1128
1318
|
//# sourceMappingURL=index.d.ts.map
|
|
1129
1319
|
//#endregion
|
|
1130
|
-
export { AgentApiClient, AgentApiClientConfig, type ChangelogAction, type ChangelogActor, type ChangelogEntry, type EncryptedEnvelopeV1, type Field, type FieldEnvelope, type FieldFormat, type FieldSensitivity, type FieldView, type GeneratedDataKey, type IntegrationConfigResult, type IntegrationConfigSchemaField, type IntegrationInstall, KnowledgeDoc, KnowledgeFact, KnowledgeProfile, KnowledgeProfileLink, KnowledgeScope, KnowledgeScopeType, KnowledgeSearchHit, KnowledgeSearchResult, type RegistryEntry, type ScopeInfo, type SecretAggregate, type SecretCategory, type SecretMetadata, type SecretScope, SharedFileEntry, SyncAgentInfo, SyncAgentStats, SyncConfirmedUpload, SyncFileEntry, SyncManifest, SyncManifestEntry, SyncPresignedUrl, SyncReconstructBundle, SyncReconstructFile, SyncSessionContent, SyncSessionEntry };
|
|
1320
|
+
export { AgentApiClient, AgentApiClientConfig, AgentAvatarPresign, AgentSelf, AgentVoice, AgentVoiceConfig, type ChangelogAction, type ChangelogActor, type ChangelogEntry, type EncryptedEnvelopeV1, type Field, type FieldEnvelope, type FieldFormat, type FieldSensitivity, type FieldView, type GeneratedDataKey, type IntegrationConfigResult, type IntegrationConfigSchemaField, type IntegrationInstall, KnowledgeDoc, KnowledgeFact, KnowledgeProfile, KnowledgeProfileLink, KnowledgeScope, KnowledgeScopeType, KnowledgeSearchHit, KnowledgeSearchResult, type RegistryEntry, RemoteSessionInfo, type ScopeInfo, type SecretAggregate, type SecretCategory, type SecretMetadata, type SecretScope, SharedFileEntry, SyncAgentInfo, SyncAgentStats, SyncConfirmedUpload, SyncFileEntry, SyncManifest, SyncManifestEntry, SyncPresignedUrl, SyncReconstructBundle, SyncReconstructFile, SyncSessionContent, SyncSessionEntry, VoiceSttArgs, VoiceSttResult, VoiceTtsArgs, VoiceTtsModel, VoiceTtsResult };
|
|
1131
1321
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;AAiGwB,UAlDP,oBAAA,CAkDO;QAAf,EAAA,MAAA;EAAM,MAAA,EAAA,MAAA;AAGf;AAMiB,UApDA,iBAAA,CAoDmB;EAQnB,SAAA,EAAA,MAAA;EAQA,OAAA,EAAA,MAAA;EASA,OAAA,EAAA,SAAc,GAAA,UAAA;EAQd,MAAA,EAAA,eAAa,GAAA,gBAAA,GAAA,kBAAA,GAAA,UAAA,GAAA,WAAA,GAAA,SAAA,GAAA,QAAA;EASb,GAAA,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