@aui.io/aui-client 3.0.0 → 3.1.1
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 +17 -4
- package/dist/cjs/ApolloClientWrapper.js +11 -1
- package/dist/cjs/Client.d.ts +0 -3
- package/dist/cjs/Client.js +4 -9
- package/dist/cjs/api/resources/index.d.ts +0 -1
- package/dist/cjs/api/resources/index.js +1 -2
- package/dist/cjs/api/types/ErrorEnvelope.d.ts +3 -3
- package/dist/cjs/api/types/EventEnvelope.d.ts +2 -2
- package/dist/cjs/api/types/Message.d.ts +1 -1
- package/dist/cjs/api/types/MessageEnvelope.d.ts +1 -1
- package/dist/cjs/api/types/StreamEvent.d.ts +17 -0
- package/dist/cjs/api/types/SubmitMessageRequest.d.ts +1 -5
- package/dist/cjs/api/types/Trace.d.ts +1 -1
- package/dist/cjs/api/types/index.d.ts +1 -3
- package/dist/cjs/api/types/index.js +1 -3
- package/dist/cjs/environments.d.ts +0 -2
- package/dist/cjs/environments.js +0 -1
- package/dist/cjs/exports.d.ts +1 -0
- package/dist/cjs/exports.js +5 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/ApolloClientWrapper.mjs +11 -1
- package/dist/esm/Client.d.mts +0 -3
- package/dist/esm/Client.mjs +2 -7
- package/dist/esm/api/resources/index.d.mts +0 -1
- package/dist/esm/api/resources/index.mjs +0 -1
- package/dist/esm/api/types/ErrorEnvelope.d.mts +3 -3
- package/dist/esm/api/types/EventEnvelope.d.mts +2 -2
- package/dist/esm/api/types/Message.d.mts +1 -1
- package/dist/esm/api/types/MessageEnvelope.d.mts +1 -1
- package/dist/esm/api/types/StreamEvent.d.mts +17 -0
- package/dist/esm/api/types/SubmitMessageRequest.d.mts +1 -5
- package/dist/esm/api/types/Trace.d.mts +1 -1
- package/dist/esm/api/types/index.d.mts +1 -3
- package/dist/esm/api/types/index.mjs +1 -3
- package/dist/esm/environments.d.mts +0 -2
- package/dist/esm/environments.mjs +0 -1
- package/dist/esm/exports.d.mts +1 -0
- package/dist/esm/exports.mjs +3 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/dist/cjs/api/resources/simulatorSession/client/Client.d.ts +0 -19
- package/dist/cjs/api/resources/simulatorSession/client/Client.js +0 -71
- package/dist/cjs/api/resources/simulatorSession/client/Socket.d.ts +0 -49
- package/dist/cjs/api/resources/simulatorSession/client/Socket.js +0 -150
- package/dist/cjs/api/resources/simulatorSession/client/index.d.ts +0 -1
- package/dist/cjs/api/resources/simulatorSession/client/index.js +0 -2
- package/dist/cjs/api/resources/simulatorSession/index.d.ts +0 -1
- package/dist/cjs/api/resources/simulatorSession/index.js +0 -17
- package/dist/cjs/api/types/GatewayHeaders.d.ts +0 -13
- package/dist/cjs/api/types/IaEvent.d.ts +0 -17
- package/dist/cjs/api/types/IaEvent.js +0 -3
- package/dist/cjs/api/types/SimulatorCommand.d.ts +0 -21
- package/dist/cjs/api/types/SimulatorCommand.js +0 -12
- package/dist/esm/api/resources/simulatorSession/client/Client.d.mts +0 -19
- package/dist/esm/api/resources/simulatorSession/client/Client.mjs +0 -34
- package/dist/esm/api/resources/simulatorSession/client/Socket.d.mts +0 -49
- package/dist/esm/api/resources/simulatorSession/client/Socket.mjs +0 -113
- package/dist/esm/api/resources/simulatorSession/client/index.d.mts +0 -1
- package/dist/esm/api/resources/simulatorSession/client/index.mjs +0 -1
- package/dist/esm/api/resources/simulatorSession/index.d.mts +0 -1
- package/dist/esm/api/resources/simulatorSession/index.mjs +0 -1
- package/dist/esm/api/types/GatewayHeaders.d.mts +0 -13
- package/dist/esm/api/types/IaEvent.d.mts +0 -17
- package/dist/esm/api/types/IaEvent.mjs +0 -2
- package/dist/esm/api/types/SimulatorCommand.d.mts +0 -21
- package/dist/esm/api/types/SimulatorCommand.mjs +0 -9
- /package/dist/cjs/api/types/{GatewayHeaders.js → StreamEvent.js} +0 -0
- /package/dist/esm/api/types/{GatewayHeaders.mjs → StreamEvent.mjs} +0 -0
package/README.md
CHANGED
|
@@ -80,7 +80,6 @@ import { ApolloEnvironment } from '@aui.io/aui-client';
|
|
|
80
80
|
ApolloEnvironment.Gcp = {
|
|
81
81
|
base: 'https://api-v3.aui.io/apollo-api-v2', // REST
|
|
82
82
|
production: 'wss://api-v3.aui.io/apollo-api-v2', // WebSocket
|
|
83
|
-
local: 'ws://localhost:8000', // WebSocket (local)
|
|
84
83
|
};
|
|
85
84
|
```
|
|
86
85
|
|
|
@@ -145,8 +144,9 @@ socket.on('message', (msg) => {
|
|
|
145
144
|
socket.on('error', (err) => console.error('WS error:', err));
|
|
146
145
|
socket.on('close', (event) => console.log('Closed:', event.code));
|
|
147
146
|
|
|
148
|
-
// Send a turn
|
|
147
|
+
// Send a turn (type is required on the WS submit frame)
|
|
149
148
|
socket.sendSubmitMessage({
|
|
149
|
+
type: 'message',
|
|
150
150
|
agent_id: agentId,
|
|
151
151
|
user_id: 'end-user-123',
|
|
152
152
|
text: 'Hello over WebSocket',
|
|
@@ -156,6 +156,14 @@ socket.sendSubmitMessage({
|
|
|
156
156
|
socket.close();
|
|
157
157
|
```
|
|
158
158
|
|
|
159
|
+
> **Notes**
|
|
160
|
+
> - `socket.on(event, handler)` registers a **single** handler per event — calling it
|
|
161
|
+
> again for the same event replaces the previous handler rather than adding one.
|
|
162
|
+
> - The socket type is exported as `SessionSocket` (`import { SessionSocket } from '@aui.io/aui-client'`).
|
|
163
|
+
> - Request timeouts are **per call** via `timeoutInSeconds` on a request's options; there
|
|
164
|
+
> is no client-wide default timeout. Pass it on slow calls, e.g.
|
|
165
|
+
> `client.threads.listThreads({ filters: {} }, { timeoutInSeconds: 120 })`.
|
|
166
|
+
|
|
159
167
|
## Key Context Helpers
|
|
160
168
|
|
|
161
169
|
After the first request (or an explicit `getContext()`), scope resolved from the key is available:
|
|
@@ -172,13 +180,17 @@ client.organizationId;
|
|
|
172
180
|
|
|
173
181
|
## Error Handling
|
|
174
182
|
|
|
183
|
+
`ApolloError` (the base API error) and `ApolloTimeoutError` are exported at the top
|
|
184
|
+
level. The per-status errors (e.g. `UnprocessableEntityError`) live under the `Apollo`
|
|
185
|
+
namespace.
|
|
186
|
+
|
|
175
187
|
```typescript
|
|
176
|
-
import { ApolloError,
|
|
188
|
+
import { ApolloError, Apollo } from '@aui.io/aui-client';
|
|
177
189
|
|
|
178
190
|
try {
|
|
179
191
|
await client.agents.getAgent('missing-id');
|
|
180
192
|
} catch (error) {
|
|
181
|
-
if (error instanceof UnprocessableEntityError) {
|
|
193
|
+
if (error instanceof Apollo.UnprocessableEntityError) {
|
|
182
194
|
console.error('Validation failed:', error.body);
|
|
183
195
|
} else if (error instanceof ApolloError) {
|
|
184
196
|
console.error('API error:', error.statusCode, error.body);
|
|
@@ -196,6 +208,7 @@ The SDK ships full type definitions. Models are namespaced under `Apollo`:
|
|
|
196
208
|
import { ApolloClient, Apollo } from '@aui.io/aui-client';
|
|
197
209
|
|
|
198
210
|
const req: Apollo.SubmitMessageRequest = {
|
|
211
|
+
type: 'message',
|
|
199
212
|
agent_id: 'agent-123',
|
|
200
213
|
user_id: 'end-user-123',
|
|
201
214
|
text: 'Typed request',
|
|
@@ -58,6 +58,16 @@ const SESSION_WS_PATH = "/messaging/v1/session";
|
|
|
58
58
|
// The v2 messaging server negotiates this subprotocol on the WS upgrade; the
|
|
59
59
|
// connection is rejected without it. Fern emits protocols: [], so we set it here.
|
|
60
60
|
const WS_SUBPROTOCOL = "aui-websocket";
|
|
61
|
+
// Fern injects SDK-telemetry headers (X-Fern-*) on every request. The API doesn't need
|
|
62
|
+
// them, and in the browser each custom header triggers a CORS preflight that fails unless
|
|
63
|
+
// the gateway allow-lists it. Passing null strips them (mergeHeaders deletes null values).
|
|
64
|
+
const STRIPPED_SDK_HEADERS = {
|
|
65
|
+
"X-Fern-Language": null,
|
|
66
|
+
"X-Fern-SDK-Name": null,
|
|
67
|
+
"X-Fern-SDK-Version": null,
|
|
68
|
+
"X-Fern-Runtime": null,
|
|
69
|
+
"X-Fern-Runtime-Version": null,
|
|
70
|
+
};
|
|
61
71
|
// Publishable-key exchange + token caching. Kept as a standalone object so the header
|
|
62
72
|
// suppliers can close over it — a subclass may not touch `this` before super() runs.
|
|
63
73
|
class Auth {
|
|
@@ -144,7 +154,7 @@ class ApolloClient extends Client_js_1.ApolloClient {
|
|
|
144
154
|
const auth = new Auth(env.base, options.publishableKey, options.organizationApiKey);
|
|
145
155
|
super({
|
|
146
156
|
environment: env,
|
|
147
|
-
headers: Object.assign({}, (auth.hasCredential ? { Authorization: () => __awaiter(this, void 0, void 0, function* () { return `Bearer ${yield auth.getToken()}`; }) } : {})),
|
|
157
|
+
headers: Object.assign(Object.assign({}, STRIPPED_SDK_HEADERS), (auth.hasCredential ? { Authorization: () => __awaiter(this, void 0, void 0, function* () { return `Bearer ${yield auth.getToken()}`; }) } : {})),
|
|
148
158
|
});
|
|
149
159
|
this._tokenAuth = auth;
|
|
150
160
|
this._env = env;
|
package/dist/cjs/Client.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { Channels } from "./api/resources/channels/client/Client.js";
|
|
|
5
5
|
import { Messaging } from "./api/resources/messaging/client/Client.js";
|
|
6
6
|
import { Projects } from "./api/resources/projects/client/Client.js";
|
|
7
7
|
import { Session } from "./api/resources/session/client/Client.js";
|
|
8
|
-
import { SimulatorSession } from "./api/resources/simulatorSession/client/Client.js";
|
|
9
8
|
import { Threads } from "./api/resources/threads/client/Client.js";
|
|
10
9
|
import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js";
|
|
11
10
|
import * as core from "./core/index.js";
|
|
@@ -25,7 +24,6 @@ export declare class ApolloClient {
|
|
|
25
24
|
protected _channels: Channels | undefined;
|
|
26
25
|
protected _auth: Auth | undefined;
|
|
27
26
|
protected _session: Session | undefined;
|
|
28
|
-
protected _simulatorSession: SimulatorSession | undefined;
|
|
29
27
|
constructor(_options?: ApolloClient.Options);
|
|
30
28
|
get agents(): Agents;
|
|
31
29
|
get agentVersions(): AgentVersions;
|
|
@@ -35,7 +33,6 @@ export declare class ApolloClient {
|
|
|
35
33
|
get channels(): Channels;
|
|
36
34
|
get auth(): Auth;
|
|
37
35
|
get session(): Session;
|
|
38
|
-
get simulatorSession(): SimulatorSession;
|
|
39
36
|
/**
|
|
40
37
|
* @param {ApolloClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
41
38
|
*
|
package/dist/cjs/Client.js
CHANGED
|
@@ -51,8 +51,7 @@ const Client_js_4 = require("./api/resources/channels/client/Client.js");
|
|
|
51
51
|
const Client_js_5 = require("./api/resources/messaging/client/Client.js");
|
|
52
52
|
const Client_js_6 = require("./api/resources/projects/client/Client.js");
|
|
53
53
|
const Client_js_7 = require("./api/resources/session/client/Client.js");
|
|
54
|
-
const Client_js_8 = require("./api/resources/
|
|
55
|
-
const Client_js_9 = require("./api/resources/threads/client/Client.js");
|
|
54
|
+
const Client_js_8 = require("./api/resources/threads/client/Client.js");
|
|
56
55
|
const headers_js_1 = require("./core/headers.js");
|
|
57
56
|
const core = __importStar(require("./core/index.js"));
|
|
58
57
|
const environments = __importStar(require("./environments.js"));
|
|
@@ -62,8 +61,8 @@ class ApolloClient {
|
|
|
62
61
|
this._options = Object.assign(Object.assign({}, _options), { logging: core.logging.createLogger(_options === null || _options === void 0 ? void 0 : _options.logging), headers: (0, headers_js_1.mergeHeaders)({
|
|
63
62
|
"X-Fern-Language": "JavaScript",
|
|
64
63
|
"X-Fern-SDK-Name": "@aui.io/aui-client",
|
|
65
|
-
"X-Fern-SDK-Version": "3.
|
|
66
|
-
"User-Agent": "@aui.io/aui-client/3.
|
|
64
|
+
"X-Fern-SDK-Version": "3.1.1",
|
|
65
|
+
"User-Agent": "@aui.io/aui-client/3.1.1",
|
|
67
66
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
68
67
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
69
68
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -82,7 +81,7 @@ class ApolloClient {
|
|
|
82
81
|
}
|
|
83
82
|
get threads() {
|
|
84
83
|
var _a;
|
|
85
|
-
return ((_a = this._threads) !== null && _a !== void 0 ? _a : (this._threads = new
|
|
84
|
+
return ((_a = this._threads) !== null && _a !== void 0 ? _a : (this._threads = new Client_js_8.Threads(this._options)));
|
|
86
85
|
}
|
|
87
86
|
get messaging() {
|
|
88
87
|
var _a;
|
|
@@ -100,10 +99,6 @@ class ApolloClient {
|
|
|
100
99
|
var _a;
|
|
101
100
|
return ((_a = this._session) !== null && _a !== void 0 ? _a : (this._session = new Client_js_7.Session(this._options)));
|
|
102
101
|
}
|
|
103
|
-
get simulatorSession() {
|
|
104
|
-
var _a;
|
|
105
|
-
return ((_a = this._simulatorSession) !== null && _a !== void 0 ? _a : (this._simulatorSession = new Client_js_8.SimulatorSession(this._options)));
|
|
106
|
-
}
|
|
107
102
|
/**
|
|
108
103
|
* @param {ApolloClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
109
104
|
*
|
|
@@ -14,7 +14,6 @@ export * from "./projects/client/requests/index.js";
|
|
|
14
14
|
export * as projects from "./projects/index.js";
|
|
15
15
|
export * from "./projects/types/index.js";
|
|
16
16
|
export * as session from "./session/index.js";
|
|
17
|
-
export * as simulatorSession from "./simulatorSession/index.js";
|
|
18
17
|
export * from "./threads/client/requests/index.js";
|
|
19
18
|
export * as threads from "./threads/index.js";
|
|
20
19
|
export * from "./threads/types/index.js";
|
|
@@ -36,7 +36,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
};
|
|
37
37
|
})();
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.threads = exports.
|
|
39
|
+
exports.threads = exports.session = exports.projects = exports.messaging = exports.channels = exports.auth = exports.agentVersions = exports.agents = void 0;
|
|
40
40
|
__exportStar(require("./agents/client/requests/index.js"), exports);
|
|
41
41
|
exports.agents = __importStar(require("./agents/index.js"));
|
|
42
42
|
__exportStar(require("./agents/types/index.js"), exports);
|
|
@@ -53,7 +53,6 @@ __exportStar(require("./projects/client/requests/index.js"), exports);
|
|
|
53
53
|
exports.projects = __importStar(require("./projects/index.js"));
|
|
54
54
|
__exportStar(require("./projects/types/index.js"), exports);
|
|
55
55
|
exports.session = __importStar(require("./session/index.js"));
|
|
56
|
-
exports.simulatorSession = __importStar(require("./simulatorSession/index.js"));
|
|
57
56
|
__exportStar(require("./threads/client/requests/index.js"), exports);
|
|
58
57
|
exports.threads = __importStar(require("./threads/index.js"));
|
|
59
58
|
__exportStar(require("./threads/types/index.js"), exports);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* type=error — either a
|
|
2
|
+
* type=error — either a session-level error (seq -1) or an error raised while processing the turn.
|
|
3
3
|
*/
|
|
4
4
|
export interface ErrorEnvelope {
|
|
5
5
|
type?: "error";
|
|
@@ -10,13 +10,13 @@ export interface ErrorEnvelope {
|
|
|
10
10
|
export declare namespace ErrorEnvelope {
|
|
11
11
|
type Data =
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Session-level error (invalid frame, insufficient balance, connection loss). */
|
|
14
14
|
{
|
|
15
15
|
error: string;
|
|
16
16
|
code?: number | undefined;
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* Error raised while processing the turn. */
|
|
20
20
|
| {
|
|
21
21
|
message?: string | undefined;
|
|
22
22
|
status_code?: number | undefined;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type * as Apollo from "../index.js";
|
|
2
2
|
/**
|
|
3
|
-
* type=event — a
|
|
3
|
+
* type=event — a streaming event emitted while the agent works.
|
|
4
4
|
*/
|
|
5
5
|
export interface EventEnvelope {
|
|
6
6
|
type?: "event";
|
|
7
|
-
data?: Apollo.
|
|
7
|
+
data?: Apollo.StreamEvent;
|
|
8
8
|
/** Monotonic sequence for gap detection / replay. Locally-generated errors use -1. */
|
|
9
9
|
seq: number;
|
|
10
10
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as Apollo from "../index.js";
|
|
2
2
|
/**
|
|
3
|
-
* type=message — the
|
|
3
|
+
* type=message — the completed agent reply (Message + optional trace_info).
|
|
4
4
|
*/
|
|
5
5
|
export interface MessageEnvelope {
|
|
6
6
|
type?: "message";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Streaming event. Which event types are delivered depends on the `events` query parameter chosen when opening the session.
|
|
3
|
+
*/
|
|
4
|
+
export interface StreamEvent {
|
|
5
|
+
channel?: StreamEvent.Channel;
|
|
6
|
+
scope?: Record<string, unknown>;
|
|
7
|
+
/** Event-specific payload. Token deltas carry `data.text`. */
|
|
8
|
+
data?: unknown;
|
|
9
|
+
/** Accepts any additional properties */
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}
|
|
12
|
+
export declare namespace StreamEvent {
|
|
13
|
+
interface Channel {
|
|
14
|
+
/** Default stream: thread-message-text-content-updated (token delta), thread-message-text-content-completed (stream end). ?events=all|verbose adds the full workflow/lifecycle set. */
|
|
15
|
+
event_name?: string;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -10,12 +10,8 @@ export interface SubmitMessageRequest {
|
|
|
10
10
|
/** Signed image URL for vision input. */
|
|
11
11
|
image_url?: string;
|
|
12
12
|
context?: SubmitMessageRequest.Context;
|
|
13
|
-
/** Arbitrary variables
|
|
13
|
+
/** Arbitrary runtime variables for the turn. */
|
|
14
14
|
agent_variables?: Record<string, unknown>;
|
|
15
|
-
/** Per-turn agent override (version pin / inline settings). See the REST agent override model. */
|
|
16
|
-
agent?: Record<string, unknown>;
|
|
17
|
-
/** Optional agent-settings bundle forwarded to IA under external_context.agent_settings_bundle. */
|
|
18
|
-
agent_settings_bundle?: Record<string, unknown>;
|
|
19
15
|
}
|
|
20
16
|
export declare namespace SubmitMessageRequest {
|
|
21
17
|
interface Context {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as Apollo from "../index.js";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Reasoning trace for the interaction, embedded only when include_trace=true. Same shape as the REST `Trace` model (GET /messaging/v1/threads/{threadId}/trace); summarized here.
|
|
4
4
|
*/
|
|
5
5
|
export interface Trace {
|
|
6
6
|
input?: Apollo.TraceInput;
|
|
@@ -23,9 +23,7 @@ export * from "./ExternalPageLinks.js";
|
|
|
23
23
|
export * from "./ExternalPageMeta.js";
|
|
24
24
|
export * from "./ExternalPageProject.js";
|
|
25
25
|
export * from "./ExternalPageThreadListItem.js";
|
|
26
|
-
export * from "./GatewayHeaders.js";
|
|
27
26
|
export * from "./HttpValidationError.js";
|
|
28
|
-
export * from "./IaEvent.js";
|
|
29
27
|
export * from "./InitiateThreadResponse.js";
|
|
30
28
|
export * from "./Message.js";
|
|
31
29
|
export * from "./MessageCard.js";
|
|
@@ -36,7 +34,7 @@ export * from "./Project.js";
|
|
|
36
34
|
export * from "./ResumeRequest.js";
|
|
37
35
|
export * from "./SendMessageRequest.js";
|
|
38
36
|
export * from "./SendMessageResponse.js";
|
|
39
|
-
export * from "./
|
|
37
|
+
export * from "./StreamEvent.js";
|
|
40
38
|
export * from "./SubmitMessageRequest.js";
|
|
41
39
|
export * from "./Thread.js";
|
|
42
40
|
export * from "./ThreadEnvelope.js";
|
|
@@ -39,9 +39,7 @@ __exportStar(require("./ExternalPageLinks.js"), exports);
|
|
|
39
39
|
__exportStar(require("./ExternalPageMeta.js"), exports);
|
|
40
40
|
__exportStar(require("./ExternalPageProject.js"), exports);
|
|
41
41
|
__exportStar(require("./ExternalPageThreadListItem.js"), exports);
|
|
42
|
-
__exportStar(require("./GatewayHeaders.js"), exports);
|
|
43
42
|
__exportStar(require("./HttpValidationError.js"), exports);
|
|
44
|
-
__exportStar(require("./IaEvent.js"), exports);
|
|
45
43
|
__exportStar(require("./InitiateThreadResponse.js"), exports);
|
|
46
44
|
__exportStar(require("./Message.js"), exports);
|
|
47
45
|
__exportStar(require("./MessageCard.js"), exports);
|
|
@@ -52,7 +50,7 @@ __exportStar(require("./Project.js"), exports);
|
|
|
52
50
|
__exportStar(require("./ResumeRequest.js"), exports);
|
|
53
51
|
__exportStar(require("./SendMessageRequest.js"), exports);
|
|
54
52
|
__exportStar(require("./SendMessageResponse.js"), exports);
|
|
55
|
-
__exportStar(require("./
|
|
53
|
+
__exportStar(require("./StreamEvent.js"), exports);
|
|
56
54
|
__exportStar(require("./SubmitMessageRequest.js"), exports);
|
|
57
55
|
__exportStar(require("./Thread.js"), exports);
|
|
58
56
|
__exportStar(require("./ThreadEnvelope.js"), exports);
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
export interface ApolloEnvironmentUrls {
|
|
2
2
|
base: string;
|
|
3
3
|
production: string;
|
|
4
|
-
local: string;
|
|
5
4
|
}
|
|
6
5
|
export declare const ApolloEnvironment: {
|
|
7
6
|
readonly Gcp: {
|
|
8
7
|
readonly base: "https://api-v3.aui.io/apollo-api-v2";
|
|
9
8
|
readonly production: "wss://api-v3.aui.io/apollo-api-v2";
|
|
10
|
-
readonly local: "ws://localhost:8000";
|
|
11
9
|
};
|
|
12
10
|
};
|
|
13
11
|
export type ApolloEnvironment = typeof ApolloEnvironment.Gcp;
|
package/dist/cjs/environments.js
CHANGED
package/dist/cjs/exports.d.ts
CHANGED
package/dist/cjs/exports.js
CHANGED
|
@@ -21,4 +21,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
21
21
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
22
22
|
};
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.SessionSocket = void 0;
|
|
24
25
|
__exportStar(require("./core/exports.js"), exports);
|
|
26
|
+
// The generated session resource doesn't re-export its socket class, so consumers
|
|
27
|
+
// couldn't name the type returned by `client.connect()`. Surface it at the package root.
|
|
28
|
+
var Socket_js_1 = require("./api/resources/session/client/Socket.js");
|
|
29
|
+
Object.defineProperty(exports, "SessionSocket", { enumerable: true, get: function () { return Socket_js_1.SessionSocket; } });
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "3.
|
|
1
|
+
export declare const SDK_VERSION = "3.1.1";
|
package/dist/cjs/version.js
CHANGED
|
@@ -22,6 +22,16 @@ const SESSION_WS_PATH = "/messaging/v1/session";
|
|
|
22
22
|
// The v2 messaging server negotiates this subprotocol on the WS upgrade; the
|
|
23
23
|
// connection is rejected without it. Fern emits protocols: [], so we set it here.
|
|
24
24
|
const WS_SUBPROTOCOL = "aui-websocket";
|
|
25
|
+
// Fern injects SDK-telemetry headers (X-Fern-*) on every request. The API doesn't need
|
|
26
|
+
// them, and in the browser each custom header triggers a CORS preflight that fails unless
|
|
27
|
+
// the gateway allow-lists it. Passing null strips them (mergeHeaders deletes null values).
|
|
28
|
+
const STRIPPED_SDK_HEADERS = {
|
|
29
|
+
"X-Fern-Language": null,
|
|
30
|
+
"X-Fern-SDK-Name": null,
|
|
31
|
+
"X-Fern-SDK-Version": null,
|
|
32
|
+
"X-Fern-Runtime": null,
|
|
33
|
+
"X-Fern-Runtime-Version": null,
|
|
34
|
+
};
|
|
25
35
|
// Publishable-key exchange + token caching. Kept as a standalone object so the header
|
|
26
36
|
// suppliers can close over it — a subclass may not touch `this` before super() runs.
|
|
27
37
|
class Auth {
|
|
@@ -108,7 +118,7 @@ export class ApolloClient extends _GeneratedClient {
|
|
|
108
118
|
const auth = new Auth(env.base, options.publishableKey, options.organizationApiKey);
|
|
109
119
|
super({
|
|
110
120
|
environment: env,
|
|
111
|
-
headers: Object.assign({}, (auth.hasCredential ? { Authorization: () => __awaiter(this, void 0, void 0, function* () { return `Bearer ${yield auth.getToken()}`; }) } : {})),
|
|
121
|
+
headers: Object.assign(Object.assign({}, STRIPPED_SDK_HEADERS), (auth.hasCredential ? { Authorization: () => __awaiter(this, void 0, void 0, function* () { return `Bearer ${yield auth.getToken()}`; }) } : {})),
|
|
112
122
|
});
|
|
113
123
|
this._tokenAuth = auth;
|
|
114
124
|
this._env = env;
|
package/dist/esm/Client.d.mts
CHANGED
|
@@ -5,7 +5,6 @@ import { Channels } from "./api/resources/channels/client/Client.mjs";
|
|
|
5
5
|
import { Messaging } from "./api/resources/messaging/client/Client.mjs";
|
|
6
6
|
import { Projects } from "./api/resources/projects/client/Client.mjs";
|
|
7
7
|
import { Session } from "./api/resources/session/client/Client.mjs";
|
|
8
|
-
import { SimulatorSession } from "./api/resources/simulatorSession/client/Client.mjs";
|
|
9
8
|
import { Threads } from "./api/resources/threads/client/Client.mjs";
|
|
10
9
|
import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.mjs";
|
|
11
10
|
import * as core from "./core/index.mjs";
|
|
@@ -25,7 +24,6 @@ export declare class ApolloClient {
|
|
|
25
24
|
protected _channels: Channels | undefined;
|
|
26
25
|
protected _auth: Auth | undefined;
|
|
27
26
|
protected _session: Session | undefined;
|
|
28
|
-
protected _simulatorSession: SimulatorSession | undefined;
|
|
29
27
|
constructor(_options?: ApolloClient.Options);
|
|
30
28
|
get agents(): Agents;
|
|
31
29
|
get agentVersions(): AgentVersions;
|
|
@@ -35,7 +33,6 @@ export declare class ApolloClient {
|
|
|
35
33
|
get channels(): Channels;
|
|
36
34
|
get auth(): Auth;
|
|
37
35
|
get session(): Session;
|
|
38
|
-
get simulatorSession(): SimulatorSession;
|
|
39
36
|
/**
|
|
40
37
|
* @param {ApolloClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
41
38
|
*
|
package/dist/esm/Client.mjs
CHANGED
|
@@ -15,7 +15,6 @@ import { Channels } from "./api/resources/channels/client/Client.mjs";
|
|
|
15
15
|
import { Messaging } from "./api/resources/messaging/client/Client.mjs";
|
|
16
16
|
import { Projects } from "./api/resources/projects/client/Client.mjs";
|
|
17
17
|
import { Session } from "./api/resources/session/client/Client.mjs";
|
|
18
|
-
import { SimulatorSession } from "./api/resources/simulatorSession/client/Client.mjs";
|
|
19
18
|
import { Threads } from "./api/resources/threads/client/Client.mjs";
|
|
20
19
|
import { mergeHeaders } from "./core/headers.mjs";
|
|
21
20
|
import * as core from "./core/index.mjs";
|
|
@@ -26,8 +25,8 @@ export class ApolloClient {
|
|
|
26
25
|
this._options = Object.assign(Object.assign({}, _options), { logging: core.logging.createLogger(_options === null || _options === void 0 ? void 0 : _options.logging), headers: mergeHeaders({
|
|
27
26
|
"X-Fern-Language": "JavaScript",
|
|
28
27
|
"X-Fern-SDK-Name": "@aui.io/aui-client",
|
|
29
|
-
"X-Fern-SDK-Version": "3.
|
|
30
|
-
"User-Agent": "@aui.io/aui-client/3.
|
|
28
|
+
"X-Fern-SDK-Version": "3.1.1",
|
|
29
|
+
"User-Agent": "@aui.io/aui-client/3.1.1",
|
|
31
30
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
32
31
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
33
32
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -64,10 +63,6 @@ export class ApolloClient {
|
|
|
64
63
|
var _a;
|
|
65
64
|
return ((_a = this._session) !== null && _a !== void 0 ? _a : (this._session = new Session(this._options)));
|
|
66
65
|
}
|
|
67
|
-
get simulatorSession() {
|
|
68
|
-
var _a;
|
|
69
|
-
return ((_a = this._simulatorSession) !== null && _a !== void 0 ? _a : (this._simulatorSession = new SimulatorSession(this._options)));
|
|
70
|
-
}
|
|
71
66
|
/**
|
|
72
67
|
* @param {ApolloClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
73
68
|
*
|
|
@@ -14,7 +14,6 @@ export * from "./projects/client/requests/index.mjs";
|
|
|
14
14
|
export * as projects from "./projects/index.mjs";
|
|
15
15
|
export * from "./projects/types/index.mjs";
|
|
16
16
|
export * as session from "./session/index.mjs";
|
|
17
|
-
export * as simulatorSession from "./simulatorSession/index.mjs";
|
|
18
17
|
export * from "./threads/client/requests/index.mjs";
|
|
19
18
|
export * as threads from "./threads/index.mjs";
|
|
20
19
|
export * from "./threads/types/index.mjs";
|
|
@@ -14,7 +14,6 @@ export * from "./projects/client/requests/index.mjs";
|
|
|
14
14
|
export * as projects from "./projects/index.mjs";
|
|
15
15
|
export * from "./projects/types/index.mjs";
|
|
16
16
|
export * as session from "./session/index.mjs";
|
|
17
|
-
export * as simulatorSession from "./simulatorSession/index.mjs";
|
|
18
17
|
export * from "./threads/client/requests/index.mjs";
|
|
19
18
|
export * as threads from "./threads/index.mjs";
|
|
20
19
|
export * from "./threads/types/index.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* type=error — either a
|
|
2
|
+
* type=error — either a session-level error (seq -1) or an error raised while processing the turn.
|
|
3
3
|
*/
|
|
4
4
|
export interface ErrorEnvelope {
|
|
5
5
|
type?: "error";
|
|
@@ -10,13 +10,13 @@ export interface ErrorEnvelope {
|
|
|
10
10
|
export declare namespace ErrorEnvelope {
|
|
11
11
|
type Data =
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Session-level error (invalid frame, insufficient balance, connection loss). */
|
|
14
14
|
{
|
|
15
15
|
error: string;
|
|
16
16
|
code?: number | undefined;
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* Error raised while processing the turn. */
|
|
20
20
|
| {
|
|
21
21
|
message?: string | undefined;
|
|
22
22
|
status_code?: number | undefined;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type * as Apollo from "../index.mjs";
|
|
2
2
|
/**
|
|
3
|
-
* type=event — a
|
|
3
|
+
* type=event — a streaming event emitted while the agent works.
|
|
4
4
|
*/
|
|
5
5
|
export interface EventEnvelope {
|
|
6
6
|
type?: "event";
|
|
7
|
-
data?: Apollo.
|
|
7
|
+
data?: Apollo.StreamEvent;
|
|
8
8
|
/** Monotonic sequence for gap detection / replay. Locally-generated errors use -1. */
|
|
9
9
|
seq: number;
|
|
10
10
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as Apollo from "../index.mjs";
|
|
2
2
|
/**
|
|
3
|
-
* type=message — the
|
|
3
|
+
* type=message — the completed agent reply (Message + optional trace_info).
|
|
4
4
|
*/
|
|
5
5
|
export interface MessageEnvelope {
|
|
6
6
|
type?: "message";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Streaming event. Which event types are delivered depends on the `events` query parameter chosen when opening the session.
|
|
3
|
+
*/
|
|
4
|
+
export interface StreamEvent {
|
|
5
|
+
channel?: StreamEvent.Channel;
|
|
6
|
+
scope?: Record<string, unknown>;
|
|
7
|
+
/** Event-specific payload. Token deltas carry `data.text`. */
|
|
8
|
+
data?: unknown;
|
|
9
|
+
/** Accepts any additional properties */
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}
|
|
12
|
+
export declare namespace StreamEvent {
|
|
13
|
+
interface Channel {
|
|
14
|
+
/** Default stream: thread-message-text-content-updated (token delta), thread-message-text-content-completed (stream end). ?events=all|verbose adds the full workflow/lifecycle set. */
|
|
15
|
+
event_name?: string;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -10,12 +10,8 @@ export interface SubmitMessageRequest {
|
|
|
10
10
|
/** Signed image URL for vision input. */
|
|
11
11
|
image_url?: string;
|
|
12
12
|
context?: SubmitMessageRequest.Context;
|
|
13
|
-
/** Arbitrary variables
|
|
13
|
+
/** Arbitrary runtime variables for the turn. */
|
|
14
14
|
agent_variables?: Record<string, unknown>;
|
|
15
|
-
/** Per-turn agent override (version pin / inline settings). See the REST agent override model. */
|
|
16
|
-
agent?: Record<string, unknown>;
|
|
17
|
-
/** Optional agent-settings bundle forwarded to IA under external_context.agent_settings_bundle. */
|
|
18
|
-
agent_settings_bundle?: Record<string, unknown>;
|
|
19
15
|
}
|
|
20
16
|
export declare namespace SubmitMessageRequest {
|
|
21
17
|
interface Context {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as Apollo from "../index.mjs";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Reasoning trace for the interaction, embedded only when include_trace=true. Same shape as the REST `Trace` model (GET /messaging/v1/threads/{threadId}/trace); summarized here.
|
|
4
4
|
*/
|
|
5
5
|
export interface Trace {
|
|
6
6
|
input?: Apollo.TraceInput;
|
|
@@ -23,9 +23,7 @@ export * from "./ExternalPageLinks.mjs";
|
|
|
23
23
|
export * from "./ExternalPageMeta.mjs";
|
|
24
24
|
export * from "./ExternalPageProject.mjs";
|
|
25
25
|
export * from "./ExternalPageThreadListItem.mjs";
|
|
26
|
-
export * from "./GatewayHeaders.mjs";
|
|
27
26
|
export * from "./HttpValidationError.mjs";
|
|
28
|
-
export * from "./IaEvent.mjs";
|
|
29
27
|
export * from "./InitiateThreadResponse.mjs";
|
|
30
28
|
export * from "./Message.mjs";
|
|
31
29
|
export * from "./MessageCard.mjs";
|
|
@@ -36,7 +34,7 @@ export * from "./Project.mjs";
|
|
|
36
34
|
export * from "./ResumeRequest.mjs";
|
|
37
35
|
export * from "./SendMessageRequest.mjs";
|
|
38
36
|
export * from "./SendMessageResponse.mjs";
|
|
39
|
-
export * from "./
|
|
37
|
+
export * from "./StreamEvent.mjs";
|
|
40
38
|
export * from "./SubmitMessageRequest.mjs";
|
|
41
39
|
export * from "./Thread.mjs";
|
|
42
40
|
export * from "./ThreadEnvelope.mjs";
|
|
@@ -23,9 +23,7 @@ export * from "./ExternalPageLinks.mjs";
|
|
|
23
23
|
export * from "./ExternalPageMeta.mjs";
|
|
24
24
|
export * from "./ExternalPageProject.mjs";
|
|
25
25
|
export * from "./ExternalPageThreadListItem.mjs";
|
|
26
|
-
export * from "./GatewayHeaders.mjs";
|
|
27
26
|
export * from "./HttpValidationError.mjs";
|
|
28
|
-
export * from "./IaEvent.mjs";
|
|
29
27
|
export * from "./InitiateThreadResponse.mjs";
|
|
30
28
|
export * from "./Message.mjs";
|
|
31
29
|
export * from "./MessageCard.mjs";
|
|
@@ -36,7 +34,7 @@ export * from "./Project.mjs";
|
|
|
36
34
|
export * from "./ResumeRequest.mjs";
|
|
37
35
|
export * from "./SendMessageRequest.mjs";
|
|
38
36
|
export * from "./SendMessageResponse.mjs";
|
|
39
|
-
export * from "./
|
|
37
|
+
export * from "./StreamEvent.mjs";
|
|
40
38
|
export * from "./SubmitMessageRequest.mjs";
|
|
41
39
|
export * from "./Thread.mjs";
|
|
42
40
|
export * from "./ThreadEnvelope.mjs";
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
export interface ApolloEnvironmentUrls {
|
|
2
2
|
base: string;
|
|
3
3
|
production: string;
|
|
4
|
-
local: string;
|
|
5
4
|
}
|
|
6
5
|
export declare const ApolloEnvironment: {
|
|
7
6
|
readonly Gcp: {
|
|
8
7
|
readonly base: "https://api-v3.aui.io/apollo-api-v2";
|
|
9
8
|
readonly production: "wss://api-v3.aui.io/apollo-api-v2";
|
|
10
|
-
readonly local: "ws://localhost:8000";
|
|
11
9
|
};
|
|
12
10
|
};
|
|
13
11
|
export type ApolloEnvironment = typeof ApolloEnvironment.Gcp;
|