@aexhq/sdk 0.63.0 → 0.64.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 -11
- package/dist/index.d.ts +3 -9
- package/dist/index.js +4 -10
- package/package.json +2 -2
- package/dist/session.d.ts +0 -22
- package/dist/session.js +0 -42
package/README.md
CHANGED
|
@@ -1,24 +1,29 @@
|
|
|
1
1
|
# @aexhq/sdk
|
|
2
2
|
|
|
3
|
-
The hosted Aex client
|
|
4
|
-
|
|
3
|
+
The hosted Aex client uses the neutral Brain composition API with the `https://api.aex.dev` base
|
|
4
|
+
URL and an Aex API key.
|
|
5
5
|
|
|
6
6
|
```ts
|
|
7
7
|
import { Aex } from "@aexhq/sdk";
|
|
8
|
+
import { awsMicroVm } from "@aexhq/env-aws-microvm";
|
|
9
|
+
import { pi } from "@aexhq/loop-pi";
|
|
10
|
+
import { bash, read } from "@aexhq/tools";
|
|
8
11
|
|
|
9
12
|
const aex = new Aex({ apiKey: process.env.AEX_API_KEY! });
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
model: {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const workspace = awsMicroVm({ region: "eu-west-2" });
|
|
14
|
+
const session = await aex.createSession({
|
|
15
|
+
model: {
|
|
16
|
+
provider: "vercel-ai-gateway",
|
|
17
|
+
name: "openai/gpt-5-mini",
|
|
18
|
+
apiKey: process.env.VERCEL_AI_GATEWAY_API_KEY!,
|
|
19
|
+
},
|
|
20
|
+
agentLoop: pi(),
|
|
21
|
+
tools: [read().runIn(workspace), bash().runIn(workspace)],
|
|
16
22
|
});
|
|
17
23
|
|
|
18
24
|
await session.send("Inspect the workspace.");
|
|
19
25
|
for await (const event of session.events()) console.log(event);
|
|
20
26
|
```
|
|
21
27
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
code.
|
|
28
|
+
Aex supplies hosted authentication and policy. Agentloop admission, Tool placement, Environment
|
|
29
|
+
requirements, operation keys, and event cursors are handled by the shared Brain SDK.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Sessions } from "./session.js";
|
|
1
|
+
import { Brain, type BrainOptions } from "@aexhq/brain";
|
|
3
2
|
export { BrainError as AexError } from "@aexhq/brain";
|
|
4
|
-
export {
|
|
5
|
-
export type { RequestOptions } from "./session.js";
|
|
6
|
-
export type { AgentloopAdmission, CreateSessionRequest, EnvironmentRequirement, EventPage, SessionEvent, SessionList, ToolBinding, ToolDefinition, } from "@aexhq/brain";
|
|
3
|
+
export type { AgentLoop, BoundTool, CreateSessionOptions, Environment, EnvironmentLifecycle, OperationOptions, SessionEvent, SessionState, Tool, ToolBindingOptions, ToolDefinition, VercelAiGatewayModel, } from "@aexhq/brain";
|
|
7
4
|
export interface AexOptions {
|
|
8
5
|
apiKey: string;
|
|
9
6
|
baseUrl?: string;
|
|
10
7
|
fetch?: BrainOptions["fetch"];
|
|
11
8
|
timeoutMs?: number;
|
|
12
9
|
}
|
|
13
|
-
export declare class Aex {
|
|
14
|
-
readonly brain: BrainClient;
|
|
15
|
-
readonly sessions: Sessions;
|
|
10
|
+
export declare class Aex extends Brain {
|
|
16
11
|
constructor(options: AexOptions);
|
|
17
12
|
}
|
|
18
|
-
export { BrainError };
|
package/dist/index.js
CHANGED
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Sessions } from "./session.js";
|
|
1
|
+
import { Brain } from "@aexhq/brain";
|
|
3
2
|
export { BrainError as AexError } from "@aexhq/brain";
|
|
4
|
-
export { Session, Sessions } from "./session.js";
|
|
5
3
|
const DEFAULT_API_URL = "https://api.aex.dev";
|
|
6
|
-
export class Aex {
|
|
7
|
-
brain;
|
|
8
|
-
sessions;
|
|
4
|
+
export class Aex extends Brain {
|
|
9
5
|
constructor(options) {
|
|
10
6
|
if (options.apiKey.trim() === "")
|
|
11
7
|
throw new TypeError("Aex apiKey cannot be empty");
|
|
12
|
-
|
|
8
|
+
super({
|
|
13
9
|
baseUrl: options.baseUrl ?? DEFAULT_API_URL,
|
|
14
|
-
|
|
10
|
+
token: options.apiKey,
|
|
15
11
|
...(options.fetch === undefined ? {} : { fetch: options.fetch }),
|
|
16
12
|
...(options.timeoutMs === undefined ? {} : { timeoutMs: options.timeoutMs }),
|
|
17
13
|
});
|
|
18
|
-
this.sessions = new Sessions(this.brain);
|
|
19
14
|
}
|
|
20
15
|
}
|
|
21
|
-
export { BrainError };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aexhq/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.64.0",
|
|
4
4
|
"description": "TypeScript SDK for Aex sessions",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://aex.dev",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"test": "tsc -p tsconfig.json && node --test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@aexhq/brain": "0.
|
|
37
|
+
"@aexhq/brain": "0.7.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"typescript": "^5.9.2"
|
package/dist/session.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { BrainClient, SessionHandle, type CreateSessionRequest, type Session as SessionState, type SessionEvent } from "@aexhq/brain";
|
|
2
|
-
export interface RequestOptions {
|
|
3
|
-
idempotencyKey?: string;
|
|
4
|
-
}
|
|
5
|
-
export declare class Sessions {
|
|
6
|
-
private readonly brain;
|
|
7
|
-
constructor(brain: BrainClient);
|
|
8
|
-
create(request: CreateSessionRequest, options?: RequestOptions): Promise<Session>;
|
|
9
|
-
list(): Promise<Session[]>;
|
|
10
|
-
get(sessionId: string): Promise<Session>;
|
|
11
|
-
}
|
|
12
|
-
export declare class Session {
|
|
13
|
-
private readonly handle;
|
|
14
|
-
constructor(handle: SessionHandle);
|
|
15
|
-
get state(): SessionState;
|
|
16
|
-
get id(): string;
|
|
17
|
-
send(content: unknown, options?: RequestOptions): Promise<SessionState>;
|
|
18
|
-
events(after?: number): AsyncIterable<SessionEvent>;
|
|
19
|
-
cancel(options?: RequestOptions): Promise<void>;
|
|
20
|
-
end(options?: RequestOptions): Promise<SessionState>;
|
|
21
|
-
delete(options?: RequestOptions): Promise<void>;
|
|
22
|
-
}
|
package/dist/session.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export class Sessions {
|
|
2
|
-
brain;
|
|
3
|
-
constructor(brain) {
|
|
4
|
-
this.brain = brain;
|
|
5
|
-
}
|
|
6
|
-
async create(request, options = {}) {
|
|
7
|
-
return new Session(await this.brain.createSession(request, key(options)));
|
|
8
|
-
}
|
|
9
|
-
async list() {
|
|
10
|
-
const { sessions } = await this.brain.listSessions();
|
|
11
|
-
return Promise.all(sessions.map(async (state) => new Session(await this.brain.getSession(state.session_id))));
|
|
12
|
-
}
|
|
13
|
-
async get(sessionId) {
|
|
14
|
-
return new Session(await this.brain.getSession(sessionId));
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
export class Session {
|
|
18
|
-
handle;
|
|
19
|
-
constructor(handle) {
|
|
20
|
-
this.handle = handle;
|
|
21
|
-
}
|
|
22
|
-
get state() { return this.handle.state; }
|
|
23
|
-
get id() { return this.handle.id; }
|
|
24
|
-
async send(content, options = {}) {
|
|
25
|
-
return this.handle.send(content, key(options));
|
|
26
|
-
}
|
|
27
|
-
events(after = 0) {
|
|
28
|
-
return this.handle.events(after);
|
|
29
|
-
}
|
|
30
|
-
async cancel(options = {}) {
|
|
31
|
-
await this.handle.cancel(key(options));
|
|
32
|
-
}
|
|
33
|
-
async end(options = {}) {
|
|
34
|
-
return this.handle.end(key(options));
|
|
35
|
-
}
|
|
36
|
-
async delete(options = {}) {
|
|
37
|
-
await this.handle.delete(key(options));
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function key(options) {
|
|
41
|
-
return options.idempotencyKey ?? crypto.randomUUID();
|
|
42
|
-
}
|