@alfe.ai/agent-api-client 0.3.0 → 0.5.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 +172 -0
- package/dist/index.d.cts +172 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +172 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +172 -0
- 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
|
@@ -590,12 +590,86 @@ var AgentApiClient = class {
|
|
|
590
590
|
body: JSON.stringify({ files })
|
|
591
591
|
});
|
|
592
592
|
}
|
|
593
|
+
/**
|
|
594
|
+
* Generate an image from a text prompt and get back a STABLE, public URL
|
|
595
|
+
* (served from the agent-assets CDN — it does not expire). The image is
|
|
596
|
+
* generated + stored server-side; embed the returned `imageUrl` in a reply as
|
|
597
|
+
* markdown to show it to the user.
|
|
598
|
+
*
|
|
599
|
+
* Unlike most methods this reads the server's error body so a bad-request
|
|
600
|
+
* detail (e.g. an unsupported `size`) reaches the caller instead of an opaque
|
|
601
|
+
* "request failed (400)". Not retried — generation is expensive and
|
|
602
|
+
* non-idempotent.
|
|
603
|
+
*/
|
|
604
|
+
async generateImage(args) {
|
|
605
|
+
const headers = new Headers();
|
|
606
|
+
headers.set("Authorization", `Bearer ${this.apiKey}`);
|
|
607
|
+
headers.set("Content-Type", "application/json");
|
|
608
|
+
const res = await fetch(`${this.apiUrl}/agent/images/generate`, {
|
|
609
|
+
method: "POST",
|
|
610
|
+
headers,
|
|
611
|
+
body: JSON.stringify(args),
|
|
612
|
+
signal: AbortSignal.timeout(33e3)
|
|
613
|
+
});
|
|
614
|
+
if (!res.ok) {
|
|
615
|
+
const body = await res.text().catch(() => "");
|
|
616
|
+
let detail = "";
|
|
617
|
+
try {
|
|
618
|
+
const parsed = JSON.parse(body);
|
|
619
|
+
const msg = typeof parsed.message === "string" ? parsed.message : typeof parsed.error === "string" ? parsed.error : "";
|
|
620
|
+
if (msg) detail = `: ${msg}`;
|
|
621
|
+
} catch {}
|
|
622
|
+
throw new Error(`Image generation failed (${String(res.status)})${detail}`);
|
|
623
|
+
}
|
|
624
|
+
return (await res.json()).data;
|
|
625
|
+
}
|
|
593
626
|
async recordActivity(data) {
|
|
594
627
|
return this.request("/agent/activity", {
|
|
595
628
|
method: "POST",
|
|
596
629
|
body: JSON.stringify(data)
|
|
597
630
|
});
|
|
598
631
|
}
|
|
632
|
+
/** Update the agent's own name and/or voice config. Returns the updated agent. */
|
|
633
|
+
async updateSelf(update) {
|
|
634
|
+
return this.request("/agent/self", {
|
|
635
|
+
method: "PATCH",
|
|
636
|
+
body: JSON.stringify(update)
|
|
637
|
+
});
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Generate the agent's own avatar from a text prompt. The image is generated,
|
|
641
|
+
* stored, and set on the agent server-side; returns the updated agent.
|
|
642
|
+
*/
|
|
643
|
+
async generateAvatar(args) {
|
|
644
|
+
return this.request("/agent/avatar/generate", {
|
|
645
|
+
method: "POST",
|
|
646
|
+
body: JSON.stringify(args)
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
/**
|
|
650
|
+
* Get a presigned PUT URL to upload a new avatar image. Upload the bytes to
|
|
651
|
+
* `uploadUrl`, then call `finalizeAvatar(s3Key)` to set it on the agent.
|
|
652
|
+
*/
|
|
653
|
+
async presignAvatar(args) {
|
|
654
|
+
return this.request("/agent/avatar/presign", {
|
|
655
|
+
method: "POST",
|
|
656
|
+
body: JSON.stringify(args)
|
|
657
|
+
});
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* Finalize an avatar upload — validates ownership + size, then sets the
|
|
661
|
+
* agent's `avatarUrl` server-side. Returns the updated agent.
|
|
662
|
+
*/
|
|
663
|
+
async finalizeAvatar(s3Key) {
|
|
664
|
+
return this.request("/agent/avatar", {
|
|
665
|
+
method: "POST",
|
|
666
|
+
body: JSON.stringify({ s3Key })
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
/** List the platform voice catalogue (ElevenLabs) so the agent can pick its own voice. */
|
|
670
|
+
async listVoices() {
|
|
671
|
+
return this.request("/agent/voices");
|
|
672
|
+
}
|
|
599
673
|
/**
|
|
600
674
|
* Mint a fresh AES-256 data key for a specific (secret, field) pair. The
|
|
601
675
|
* encryption context is rebuilt server-side from `auth.tenantId` + the body
|
|
@@ -991,6 +1065,104 @@ var AgentApiClient = class {
|
|
|
991
1065
|
body: JSON.stringify(entry)
|
|
992
1066
|
}).catch(() => {});
|
|
993
1067
|
}
|
|
1068
|
+
async requestBrowserTakeover(args) {
|
|
1069
|
+
return this.request("/agent/remote/takeover", {
|
|
1070
|
+
method: "POST",
|
|
1071
|
+
body: JSON.stringify(args)
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
1074
|
+
async getRemoteSession(sessionId) {
|
|
1075
|
+
return this.request(`/agent/remote/sessions/${encodeURIComponent(sessionId)}`);
|
|
1076
|
+
}
|
|
1077
|
+
async completeRemoteSession(sessionId) {
|
|
1078
|
+
return this.request(`/agent/remote/sessions/${encodeURIComponent(sessionId)}/complete`, {
|
|
1079
|
+
method: "POST",
|
|
1080
|
+
body: JSON.stringify({})
|
|
1081
|
+
});
|
|
1082
|
+
}
|
|
1083
|
+
/**
|
|
1084
|
+
* Issue a request that returns the raw `Response` (no JSON parsing, no
|
|
1085
|
+
* forced Content-Type). The caller sets `Content-Type`/`Accept` on `headers`
|
|
1086
|
+
* and reads the body itself (`arrayBuffer()` / `json()`).
|
|
1087
|
+
*
|
|
1088
|
+
* A single retry fires only on the same transient statuses `request()`
|
|
1089
|
+
* retries (authorizer-timeout 500 + LB 502/503/504) and transient network
|
|
1090
|
+
* errors — before the route handler runs — so re-issuing a POST does not
|
|
1091
|
+
* risk a duplicate side effect. Voice TTS/STT are effectively idempotent
|
|
1092
|
+
* (re-synthesize / re-transcribe) and meter server-side keyed on the
|
|
1093
|
+
* gateway requestId, so a retried transcription doesn't double-bill.
|
|
1094
|
+
*/
|
|
1095
|
+
async rawFetch(path, init) {
|
|
1096
|
+
const url = `${this.apiUrl}${path}`;
|
|
1097
|
+
init.headers.set("Authorization", `Bearer ${this.apiKey}`);
|
|
1098
|
+
let lastError;
|
|
1099
|
+
for (let attempt = 1; attempt <= 2; attempt++) try {
|
|
1100
|
+
const res = await fetch(url, {
|
|
1101
|
+
method: init.method,
|
|
1102
|
+
headers: init.headers,
|
|
1103
|
+
body: init.body,
|
|
1104
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
|
|
1105
|
+
});
|
|
1106
|
+
if (!res.ok) {
|
|
1107
|
+
await res.text();
|
|
1108
|
+
const error = /* @__PURE__ */ new Error(`Agent API request failed (${String(res.status)})`);
|
|
1109
|
+
if (attempt === 1 && RETRYABLE_STATUS.has(res.status)) {
|
|
1110
|
+
lastError = error;
|
|
1111
|
+
await sleep(RETRY_DELAY_MS);
|
|
1112
|
+
continue;
|
|
1113
|
+
}
|
|
1114
|
+
throw error;
|
|
1115
|
+
}
|
|
1116
|
+
return res;
|
|
1117
|
+
} catch (err) {
|
|
1118
|
+
if (attempt === 1 && isRetryableNetworkError(err)) {
|
|
1119
|
+
lastError = err;
|
|
1120
|
+
await sleep(RETRY_DELAY_MS);
|
|
1121
|
+
continue;
|
|
1122
|
+
}
|
|
1123
|
+
throw err;
|
|
1124
|
+
}
|
|
1125
|
+
throw lastError instanceof Error ? lastError : new Error(String(lastError));
|
|
1126
|
+
}
|
|
1127
|
+
/**
|
|
1128
|
+
* Text-to-speech. Returns raw PCM audio bytes plus their framing — the
|
|
1129
|
+
* voice service defaults to 24 kHz / mono / 16-bit. Wrap in a WAV container
|
|
1130
|
+
* to produce a playable file. Metered per character against the tenant
|
|
1131
|
+
* credit pool server-side; TTS completes regardless of metering outcome.
|
|
1132
|
+
*/
|
|
1133
|
+
async tts(args) {
|
|
1134
|
+
const headers = new Headers();
|
|
1135
|
+
headers.set("Content-Type", "application/json");
|
|
1136
|
+
headers.set("Accept", "audio/pcm");
|
|
1137
|
+
const res = await this.rawFetch("/voice/tts", {
|
|
1138
|
+
method: "POST",
|
|
1139
|
+
headers,
|
|
1140
|
+
body: JSON.stringify(args)
|
|
1141
|
+
});
|
|
1142
|
+
return {
|
|
1143
|
+
audio: Buffer.from(await res.arrayBuffer()),
|
|
1144
|
+
sampleRate: parseInt(res.headers.get("x-sample-rate") ?? "24000", 10),
|
|
1145
|
+
channels: parseInt(res.headers.get("x-channels") ?? "1", 10),
|
|
1146
|
+
bitDepth: parseInt(res.headers.get("x-bit-depth") ?? "16", 10)
|
|
1147
|
+
};
|
|
1148
|
+
}
|
|
1149
|
+
/**
|
|
1150
|
+
* Speech-to-text. Accepts raw linear16 (16-bit LE) mono PCM — NOT a WAV or
|
|
1151
|
+
* other container (the endpoint transcribes with a fixed linear16 encoding,
|
|
1152
|
+
* so a container header would be transcribed as noise). Strip any WAV header
|
|
1153
|
+
* and pass `sampleRate` from it before calling. Metered by transcribed
|
|
1154
|
+
* duration against the tenant credit pool server-side.
|
|
1155
|
+
*/
|
|
1156
|
+
async stt(args) {
|
|
1157
|
+
const headers = new Headers();
|
|
1158
|
+
headers.set("Content-Type", "application/octet-stream");
|
|
1159
|
+
headers.set("x-sample-rate", String(args.sampleRate));
|
|
1160
|
+
return (await (await this.rawFetch("/voice/stt", {
|
|
1161
|
+
method: "POST",
|
|
1162
|
+
headers,
|
|
1163
|
+
body: args.audio
|
|
1164
|
+
})).json()).data;
|
|
1165
|
+
}
|
|
994
1166
|
};
|
|
995
1167
|
//#endregion
|
|
996
1168
|
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;
|
|
@@ -662,6 +744,26 @@ declare class AgentApiClient {
|
|
|
662
744
|
expiresAt: string;
|
|
663
745
|
}[];
|
|
664
746
|
}>;
|
|
747
|
+
/**
|
|
748
|
+
* Generate an image from a text prompt and get back a STABLE, public URL
|
|
749
|
+
* (served from the agent-assets CDN — it does not expire). The image is
|
|
750
|
+
* generated + stored server-side; embed the returned `imageUrl` in a reply as
|
|
751
|
+
* markdown to show it to the user.
|
|
752
|
+
*
|
|
753
|
+
* Unlike most methods this reads the server's error body so a bad-request
|
|
754
|
+
* detail (e.g. an unsupported `size`) reaches the caller instead of an opaque
|
|
755
|
+
* "request failed (400)". Not retried — generation is expensive and
|
|
756
|
+
* non-idempotent.
|
|
757
|
+
*/
|
|
758
|
+
generateImage(args: {
|
|
759
|
+
prompt: string;
|
|
760
|
+
model?: string;
|
|
761
|
+
size?: string;
|
|
762
|
+
quality?: string;
|
|
763
|
+
}): Promise<{
|
|
764
|
+
imageUrl: string;
|
|
765
|
+
model: string;
|
|
766
|
+
}>;
|
|
665
767
|
recordActivity(data: {
|
|
666
768
|
userId?: string;
|
|
667
769
|
channel: string;
|
|
@@ -669,6 +771,35 @@ declare class AgentApiClient {
|
|
|
669
771
|
}): Promise<{
|
|
670
772
|
recorded: boolean;
|
|
671
773
|
}>;
|
|
774
|
+
/** Update the agent's own name and/or voice config. Returns the updated agent. */
|
|
775
|
+
updateSelf(update: {
|
|
776
|
+
name?: string;
|
|
777
|
+
voiceConfig?: AgentVoiceConfig;
|
|
778
|
+
}): Promise<AgentSelf>;
|
|
779
|
+
/**
|
|
780
|
+
* Generate the agent's own avatar from a text prompt. The image is generated,
|
|
781
|
+
* stored, and set on the agent server-side; returns the updated agent.
|
|
782
|
+
*/
|
|
783
|
+
generateAvatar(args: {
|
|
784
|
+
prompt: string;
|
|
785
|
+
}): Promise<AgentSelf>;
|
|
786
|
+
/**
|
|
787
|
+
* Get a presigned PUT URL to upload a new avatar image. Upload the bytes to
|
|
788
|
+
* `uploadUrl`, then call `finalizeAvatar(s3Key)` to set it on the agent.
|
|
789
|
+
*/
|
|
790
|
+
presignAvatar(args: {
|
|
791
|
+
mimeType: string;
|
|
792
|
+
size: number;
|
|
793
|
+
}): Promise<AgentAvatarPresign>;
|
|
794
|
+
/**
|
|
795
|
+
* Finalize an avatar upload — validates ownership + size, then sets the
|
|
796
|
+
* agent's `avatarUrl` server-side. Returns the updated agent.
|
|
797
|
+
*/
|
|
798
|
+
finalizeAvatar(s3Key: string): Promise<AgentSelf>;
|
|
799
|
+
/** List the platform voice catalogue (ElevenLabs) so the agent can pick its own voice. */
|
|
800
|
+
listVoices(): Promise<{
|
|
801
|
+
voices: AgentVoice[];
|
|
802
|
+
}>;
|
|
672
803
|
/**
|
|
673
804
|
* Mint a fresh AES-256 data key for a specific (secret, field) pair. The
|
|
674
805
|
* encryption context is rebuilt server-side from `auth.tenantId` + the body
|
|
@@ -1163,8 +1294,48 @@ declare class AgentApiClient {
|
|
|
1163
1294
|
operation: string;
|
|
1164
1295
|
summary?: string;
|
|
1165
1296
|
}): Promise<void>;
|
|
1297
|
+
requestBrowserTakeover(args: {
|
|
1298
|
+
instructions: string;
|
|
1299
|
+
url?: string;
|
|
1300
|
+
conversationId?: string;
|
|
1301
|
+
}): Promise<{
|
|
1302
|
+
sessionId: string;
|
|
1303
|
+
status: string;
|
|
1304
|
+
}>;
|
|
1305
|
+
getRemoteSession(sessionId: string): Promise<RemoteSessionInfo>;
|
|
1306
|
+
completeRemoteSession(sessionId: string): Promise<{
|
|
1307
|
+
ok: boolean;
|
|
1308
|
+
}>;
|
|
1309
|
+
/**
|
|
1310
|
+
* Issue a request that returns the raw `Response` (no JSON parsing, no
|
|
1311
|
+
* forced Content-Type). The caller sets `Content-Type`/`Accept` on `headers`
|
|
1312
|
+
* and reads the body itself (`arrayBuffer()` / `json()`).
|
|
1313
|
+
*
|
|
1314
|
+
* A single retry fires only on the same transient statuses `request()`
|
|
1315
|
+
* retries (authorizer-timeout 500 + LB 502/503/504) and transient network
|
|
1316
|
+
* errors — before the route handler runs — so re-issuing a POST does not
|
|
1317
|
+
* risk a duplicate side effect. Voice TTS/STT are effectively idempotent
|
|
1318
|
+
* (re-synthesize / re-transcribe) and meter server-side keyed on the
|
|
1319
|
+
* gateway requestId, so a retried transcription doesn't double-bill.
|
|
1320
|
+
*/
|
|
1321
|
+
private rawFetch;
|
|
1322
|
+
/**
|
|
1323
|
+
* Text-to-speech. Returns raw PCM audio bytes plus their framing — the
|
|
1324
|
+
* voice service defaults to 24 kHz / mono / 16-bit. Wrap in a WAV container
|
|
1325
|
+
* to produce a playable file. Metered per character against the tenant
|
|
1326
|
+
* credit pool server-side; TTS completes regardless of metering outcome.
|
|
1327
|
+
*/
|
|
1328
|
+
tts(args: VoiceTtsArgs): Promise<VoiceTtsResult>;
|
|
1329
|
+
/**
|
|
1330
|
+
* Speech-to-text. Accepts raw linear16 (16-bit LE) mono PCM — NOT a WAV or
|
|
1331
|
+
* other container (the endpoint transcribes with a fixed linear16 encoding,
|
|
1332
|
+
* so a container header would be transcribed as noise). Strip any WAV header
|
|
1333
|
+
* and pass `sampleRate` from it before calling. Metered by transcribed
|
|
1334
|
+
* duration against the tenant credit pool server-side.
|
|
1335
|
+
*/
|
|
1336
|
+
stt(args: VoiceSttArgs): Promise<VoiceSttResult>;
|
|
1166
1337
|
}
|
|
1167
1338
|
//# sourceMappingURL=index.d.ts.map
|
|
1168
1339
|
//#endregion
|
|
1169
|
-
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 };
|
|
1340
|
+
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 };
|
|
1170
1341
|
//# 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,CAAA,EAAA,MAAA;EAQA,YAAA,CAAA,EAAA,MAAkB;EAMlB,WAAA,CAAA,EAAA,MAAe;AAehC;AAEiB,UA1GA,aAAA,CA0Gc;EAMd,OAAA,EAAA,MAAA;EAcA,QAAA,EAAA,MAAA;EAMA,WAAA,EAAA,MAAA;EAKA,QAAA,EAAA,MAAA;EAAgB,MAAA,EAAA,OAAA,GAAA,SAAA,GAAA,QAAA;WACpB,CAAA,EAAA,MAAA;WAIJ,CAAA,EAAA,MAAA;EAAoB,QAAA,CAAA,EAAA,MAAA;AAK7B;AAWiB,UAnJA,iBAAA,CAmJY;EAkDZ,IAAA,EAAA,MAAA;EAaA,IAAA,EAAA,MAAS;EAUT,QAAA,EAAA,MAAA;EAYA,IAAA,CAAA,EAAA,MAAU;EAoBf,YAAA,CAAA,EAAA,MAAa;EAER,UAAA,CAAA,EAAA,OAAY;AAU7B;AAWiB,UA1QA,YAAA,CA4QR;EAKQ,OAAA,EAAA,CAAA;EAMJ,OAAA,EA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ET,QAAQ;;;WAUH;;eAEI;;;MAGT,QAAQ;;;WAcH;;;;;MAKL;aAAmB;;;;;WAYd;;;MAGL;;sBAQsB,QAAQ;;;;;;;;;;YAmBlB;;;;;;;;;MASZ;;;;;;;;;;;;;;;;MAsBA;;;0CAS0C;;;;;;;;;;MAS1C;;;;;;;;;;MASA;;;;;;;;;;;;MAWA;;;;;;;;;;;MAWA;;;;;MASA;;;;;;;;;;MAUA;;;;;;;;;;;;;;;;;;MAkBA;;;;;;;;;;;;;;;;MAiBA;;;;;;;;;;;;;;;;;;MA2BD;;;;;;;;;;;MAeC;;;;;;;;;;MAqBA;;;;;;;;;;;;;;;;;;;;;;;;MAsBA;;;;;;;;;;;;MAsBA;;;;wDAYwD;;;;uCAWjB;;;;;;;;;;;oBAOnB;;;;;;;;kCAOc;;;iBAMjB;;;;;;;;;;;;;;;MAcjB;;;;;;2BAiB2B;;;;+BAII;;;;;;;;;;MAY/B;;;;MAUA;;;;;MAWA;;;;;;;;;gBA2BmC;;MACpC,QAAQ;;gBAaS;YAAkB;;;6BAMzB,sCAEV,QAAQ;;4BAQE;;;MAGV;WAAiB;;;;;;;;;6BAiBP,oDAGV,QAAQ;;6BASE,sDAGV;;;;2BASU;;;MAGV;WAAiB;;;;;;;;0BAgBP,wDAGV;;;;;;;;;;;2BAqBU;;;MAKV;;;iCAgCkC;;;;;;;;;;;MAcjC;;;;;MAqBA;;;;uCAOuC,QAAQ;4CAIH;;;;;;;;;;;;;;;;;;;;;;YA0EhC,eAAe,QAAQ;;;;;;;;YAyBvB,eAAe,QAAQ"}
|
package/dist/index.d.ts
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;
|
|
@@ -662,6 +744,26 @@ declare class AgentApiClient {
|
|
|
662
744
|
expiresAt: string;
|
|
663
745
|
}[];
|
|
664
746
|
}>;
|
|
747
|
+
/**
|
|
748
|
+
* Generate an image from a text prompt and get back a STABLE, public URL
|
|
749
|
+
* (served from the agent-assets CDN — it does not expire). The image is
|
|
750
|
+
* generated + stored server-side; embed the returned `imageUrl` in a reply as
|
|
751
|
+
* markdown to show it to the user.
|
|
752
|
+
*
|
|
753
|
+
* Unlike most methods this reads the server's error body so a bad-request
|
|
754
|
+
* detail (e.g. an unsupported `size`) reaches the caller instead of an opaque
|
|
755
|
+
* "request failed (400)". Not retried — generation is expensive and
|
|
756
|
+
* non-idempotent.
|
|
757
|
+
*/
|
|
758
|
+
generateImage(args: {
|
|
759
|
+
prompt: string;
|
|
760
|
+
model?: string;
|
|
761
|
+
size?: string;
|
|
762
|
+
quality?: string;
|
|
763
|
+
}): Promise<{
|
|
764
|
+
imageUrl: string;
|
|
765
|
+
model: string;
|
|
766
|
+
}>;
|
|
665
767
|
recordActivity(data: {
|
|
666
768
|
userId?: string;
|
|
667
769
|
channel: string;
|
|
@@ -669,6 +771,35 @@ declare class AgentApiClient {
|
|
|
669
771
|
}): Promise<{
|
|
670
772
|
recorded: boolean;
|
|
671
773
|
}>;
|
|
774
|
+
/** Update the agent's own name and/or voice config. Returns the updated agent. */
|
|
775
|
+
updateSelf(update: {
|
|
776
|
+
name?: string;
|
|
777
|
+
voiceConfig?: AgentVoiceConfig;
|
|
778
|
+
}): Promise<AgentSelf>;
|
|
779
|
+
/**
|
|
780
|
+
* Generate the agent's own avatar from a text prompt. The image is generated,
|
|
781
|
+
* stored, and set on the agent server-side; returns the updated agent.
|
|
782
|
+
*/
|
|
783
|
+
generateAvatar(args: {
|
|
784
|
+
prompt: string;
|
|
785
|
+
}): Promise<AgentSelf>;
|
|
786
|
+
/**
|
|
787
|
+
* Get a presigned PUT URL to upload a new avatar image. Upload the bytes to
|
|
788
|
+
* `uploadUrl`, then call `finalizeAvatar(s3Key)` to set it on the agent.
|
|
789
|
+
*/
|
|
790
|
+
presignAvatar(args: {
|
|
791
|
+
mimeType: string;
|
|
792
|
+
size: number;
|
|
793
|
+
}): Promise<AgentAvatarPresign>;
|
|
794
|
+
/**
|
|
795
|
+
* Finalize an avatar upload — validates ownership + size, then sets the
|
|
796
|
+
* agent's `avatarUrl` server-side. Returns the updated agent.
|
|
797
|
+
*/
|
|
798
|
+
finalizeAvatar(s3Key: string): Promise<AgentSelf>;
|
|
799
|
+
/** List the platform voice catalogue (ElevenLabs) so the agent can pick its own voice. */
|
|
800
|
+
listVoices(): Promise<{
|
|
801
|
+
voices: AgentVoice[];
|
|
802
|
+
}>;
|
|
672
803
|
/**
|
|
673
804
|
* Mint a fresh AES-256 data key for a specific (secret, field) pair. The
|
|
674
805
|
* encryption context is rebuilt server-side from `auth.tenantId` + the body
|
|
@@ -1163,8 +1294,48 @@ declare class AgentApiClient {
|
|
|
1163
1294
|
operation: string;
|
|
1164
1295
|
summary?: string;
|
|
1165
1296
|
}): Promise<void>;
|
|
1297
|
+
requestBrowserTakeover(args: {
|
|
1298
|
+
instructions: string;
|
|
1299
|
+
url?: string;
|
|
1300
|
+
conversationId?: string;
|
|
1301
|
+
}): Promise<{
|
|
1302
|
+
sessionId: string;
|
|
1303
|
+
status: string;
|
|
1304
|
+
}>;
|
|
1305
|
+
getRemoteSession(sessionId: string): Promise<RemoteSessionInfo>;
|
|
1306
|
+
completeRemoteSession(sessionId: string): Promise<{
|
|
1307
|
+
ok: boolean;
|
|
1308
|
+
}>;
|
|
1309
|
+
/**
|
|
1310
|
+
* Issue a request that returns the raw `Response` (no JSON parsing, no
|
|
1311
|
+
* forced Content-Type). The caller sets `Content-Type`/`Accept` on `headers`
|
|
1312
|
+
* and reads the body itself (`arrayBuffer()` / `json()`).
|
|
1313
|
+
*
|
|
1314
|
+
* A single retry fires only on the same transient statuses `request()`
|
|
1315
|
+
* retries (authorizer-timeout 500 + LB 502/503/504) and transient network
|
|
1316
|
+
* errors — before the route handler runs — so re-issuing a POST does not
|
|
1317
|
+
* risk a duplicate side effect. Voice TTS/STT are effectively idempotent
|
|
1318
|
+
* (re-synthesize / re-transcribe) and meter server-side keyed on the
|
|
1319
|
+
* gateway requestId, so a retried transcription doesn't double-bill.
|
|
1320
|
+
*/
|
|
1321
|
+
private rawFetch;
|
|
1322
|
+
/**
|
|
1323
|
+
* Text-to-speech. Returns raw PCM audio bytes plus their framing — the
|
|
1324
|
+
* voice service defaults to 24 kHz / mono / 16-bit. Wrap in a WAV container
|
|
1325
|
+
* to produce a playable file. Metered per character against the tenant
|
|
1326
|
+
* credit pool server-side; TTS completes regardless of metering outcome.
|
|
1327
|
+
*/
|
|
1328
|
+
tts(args: VoiceTtsArgs): Promise<VoiceTtsResult>;
|
|
1329
|
+
/**
|
|
1330
|
+
* Speech-to-text. Accepts raw linear16 (16-bit LE) mono PCM — NOT a WAV or
|
|
1331
|
+
* other container (the endpoint transcribes with a fixed linear16 encoding,
|
|
1332
|
+
* so a container header would be transcribed as noise). Strip any WAV header
|
|
1333
|
+
* and pass `sampleRate` from it before calling. Metered by transcribed
|
|
1334
|
+
* duration against the tenant credit pool server-side.
|
|
1335
|
+
*/
|
|
1336
|
+
stt(args: VoiceSttArgs): Promise<VoiceSttResult>;
|
|
1166
1337
|
}
|
|
1167
1338
|
//# sourceMappingURL=index.d.ts.map
|
|
1168
1339
|
//#endregion
|
|
1169
|
-
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 };
|
|
1340
|
+
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 };
|
|
1170
1341
|
//# sourceMappingURL=index.d.ts.map
|