@aexhq/sdk 0.68.0 → 0.69.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 CHANGED
@@ -1,35 +1,23 @@
1
- # @aexhq/sdk
1
+ # Aex SDK
2
2
 
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.
3
+ Install `@aexhq/sdk`. Create an API key at https://aex.dev/dashboard.
5
4
 
6
5
  ```ts
7
- import { Aex, brainEnv } from "@aexhq/sdk";
8
- import { awsMicroVm } from "@aexhq/env-aws-microvm";
9
- import { pi } from "@aexhq/agentloop-pi";
10
- import { bash, read } from "@aexhq/tools";
6
+ import { Aex, agentloop, brainEnv, component, hostEnv, tool } from "@aexhq/sdk";
11
7
 
12
8
  const aex = new Aex({ apiKey: process.env.AEX_API_KEY! });
13
- const workspace = awsMicroVm({ name: "sandbox", url: process.env.ENVIRONMENT_URL, token: process.env.ENVIRONMENT_TOKEN, region: "eu-west-2" });
14
- const session = await aex.sessions.create({
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({ env: brainEnv({ name: "brain" }) }),
21
- tools: [read({ env: workspace }), bash({ env: workspace })],
22
- });
23
-
24
- await session.send("Inspect the workspace.");
25
- for await (const event of session.events()) console.log(event);
9
+ console.log(await aex.account.get());
26
10
  ```
27
11
 
28
- Aex supplies hosted authentication and policy. Brain admission, Tool placement, Environment
29
- operations, operation keys, and event cursors are handled by the shared Brain SDK.
12
+ `Aex` extends the pinned Brain client. Its sessions, registration, Events, Components and
13
+ extension builders are Brain's implementations. Existing Brain extension packages work with
14
+ the same contracts. See https://aex.dev/docs for a complete session example.
15
+
16
+ Place uploaded Wasm Agentloops and Tools in `brainEnv` for hosted execution. `hostEnv`
17
+ executes application functions in your process. Native hosted Components receive no server
18
+ secrets, filesystem or network grants. Customer-selected HTTP Environments are not enabled
19
+ on the initial deployment. Supply your model key per session.
30
20
 
31
- This example requires a separately deployed AWS Environment driver. Supply its URL and bearer
32
- credential as `ENVIRONMENT_URL` and `ENVIRONMENT_TOKEN`; the SDK keeps the credential out of the
33
- Environment configuration and Tool implementation descriptors. See the
34
- [Environment package](https://github.com/aexhq/extensions/tree/main/packages/env-aws-microvm)
35
- for its supported runtime and deployment boundary.
21
+ `account.get()` and `account.usage()` accept a workload API key. `keys` management requires
22
+ an authenticated account session and is normally performed in the dashboard. API keys do
23
+ not grant authority to create more credentials. New key secrets are returned once.
@@ -0,0 +1,80 @@
1
+ /**
2
+ * This interface was referenced by `AexContracts`'s JSON-Schema
3
+ * via the `definition` "Billing".
4
+ */
5
+ export type Billing = "preview_customer_model_keys";
6
+ export interface AexContracts {
7
+ }
8
+ /**
9
+ * This interface was referenced by `AexContracts`'s JSON-Schema
10
+ * via the `definition` "Limits".
11
+ */
12
+ export interface Limits {
13
+ accounts: number;
14
+ active_turns_per_account: number;
15
+ artifact_bytes_per_account: number;
16
+ artifacts_per_account: number;
17
+ claims_per_account: number;
18
+ hosts_per_account: number;
19
+ keys_per_account: number;
20
+ minimum_free_disk_bytes: number;
21
+ request_bytes: number;
22
+ requests: number;
23
+ requests_per_account: number;
24
+ response_bytes: number;
25
+ retained_bytes_per_account: number;
26
+ retention_secs: number;
27
+ sessions_per_account: number;
28
+ streams_per_account: number;
29
+ turn_reserve_bytes: number;
30
+ upstream_timeout_secs: number;
31
+ usage_max_age_secs: number;
32
+ }
33
+ /**
34
+ * This interface was referenced by `AexContracts`'s JSON-Schema
35
+ * via the `definition` "Usage".
36
+ */
37
+ export interface Usage {
38
+ active_turns: number;
39
+ measured_at?: number | null;
40
+ retained_bytes: number;
41
+ sessions: number;
42
+ }
43
+ /**
44
+ * This interface was referenced by `AexContracts`'s JSON-Schema
45
+ * via the `definition` "Account".
46
+ */
47
+ export interface Account {
48
+ billing: Billing;
49
+ created: number;
50
+ email?: string | null;
51
+ id: string;
52
+ limits: Limits;
53
+ usage: Usage;
54
+ }
55
+ /**
56
+ * This interface was referenced by `AexContracts`'s JSON-Schema
57
+ * via the `definition` "ApiKey".
58
+ */
59
+ export interface ApiKey {
60
+ active: boolean;
61
+ created: number;
62
+ id: string;
63
+ name: string;
64
+ prefix: string;
65
+ }
66
+ /**
67
+ * This interface was referenced by `AexContracts`'s JSON-Schema
68
+ * via the `definition` "IssuedKey".
69
+ */
70
+ export interface IssuedKey {
71
+ key: ApiKey;
72
+ token: string;
73
+ }
74
+ /**
75
+ * This interface was referenced by `AexContracts`'s JSON-Schema
76
+ * via the `definition` "KeyInput".
77
+ */
78
+ export interface KeyInput {
79
+ name: string;
80
+ }
@@ -0,0 +1,2 @@
1
+ /* Generated from aex-server schemas. */
2
+ export {};
package/dist/index.d.ts CHANGED
@@ -1,13 +1,22 @@
1
+ export * from "@aexhq/brain";
2
+ export type * from "./generated.js";
1
3
  import { Brain, type BrainOptions } from "@aexhq/brain";
2
- export { BrainError as AexError } from "@aexhq/brain";
3
- export { agentloop, brainEnv, component, environment, hostEnv, tool } from "@aexhq/brain";
4
- export type { PlacedAgentloop, BrainEnvOptions, Component, CreateSessionOptions, CustomProviderModel, Environment, KnownProviderId, KnownProviderModel, ModelContentBlock, ModelMessage, ModelResponse, ModelSelection, ModelStopReason, ModelUsage, OperationOptions, Outcome, Schema, SchemaInput, SchemaOutput, SessionEvent, SessionState, SessionStreamEvent, SessionTool, PlacedTool, ToolDefinition, VercelAiGatewayModel, } from "@aexhq/brain";
5
- export interface AexOptions {
4
+ import type { Account, Usage, ApiKey, IssuedKey, KeyInput } from "./generated.js";
5
+ export type AexOptions = Omit<BrainOptions, "token" | "baseUrl"> & {
6
6
  apiKey: string;
7
7
  baseUrl?: string;
8
- fetch?: BrainOptions["fetch"];
9
- timeoutMs?: number;
10
- }
8
+ };
11
9
  export declare class Aex extends Brain {
12
- constructor(options: AexOptions);
10
+ constructor({ apiKey, ...options }: AexOptions);
11
+ readonly account: {
12
+ get: () => Promise<Account>;
13
+ usage: () => Promise<Usage>;
14
+ };
15
+ /** Key management requires an account session; workload API keys cannot create credentials. */
16
+ readonly keys: {
17
+ list: () => Promise<ApiKey[]>;
18
+ create: (input: KeyInput) => Promise<IssuedKey>;
19
+ update: (id: string, input: KeyInput) => Promise<ApiKey>;
20
+ delete: (id: string) => Promise<void>;
21
+ };
13
22
  }
package/dist/index.js CHANGED
@@ -1,16 +1,20 @@
1
+ export * from "@aexhq/brain";
1
2
  import { Brain } from "@aexhq/brain";
2
- export { BrainError as AexError } from "@aexhq/brain";
3
- export { agentloop, brainEnv, component, environment, hostEnv, tool } from "@aexhq/brain";
4
- const DEFAULT_API_URL = "https://api.aex.dev";
5
3
  export class Aex extends Brain {
6
- constructor(options) {
7
- if (options.apiKey.trim() === "")
8
- throw new TypeError("Aex apiKey cannot be empty");
9
- super({
10
- baseUrl: options.baseUrl ?? DEFAULT_API_URL,
11
- token: options.apiKey,
12
- ...(options.fetch === undefined ? {} : { fetch: options.fetch }),
13
- ...(options.timeoutMs === undefined ? {} : { timeoutMs: options.timeoutMs }),
14
- });
4
+ constructor({ apiKey, ...options }) {
5
+ if (!apiKey)
6
+ throw new TypeError("apiKey is required");
7
+ super({ baseUrl: "https://api.aex.dev", ...options, token: apiKey });
15
8
  }
9
+ account = {
10
+ get: () => this.request("GET", "/v1/account"),
11
+ usage: () => this.request("GET", "/v1/usage"),
12
+ };
13
+ /** Key management requires an account session; workload API keys cannot create credentials. */
14
+ keys = {
15
+ list: () => this.request("GET", "/v1/keys"),
16
+ create: (input) => this.request("POST", "/v1/keys", input),
17
+ update: (id, input) => this.request("PATCH", `/v1/keys/${encodeURIComponent(id)}`, input),
18
+ delete: (id) => this.request("DELETE", `/v1/keys/${encodeURIComponent(id)}`),
19
+ };
16
20
  }
package/package.json CHANGED
@@ -1,42 +1,20 @@
1
1
  {
2
2
  "name": "@aexhq/sdk",
3
- "version": "0.68.0",
4
- "description": "TypeScript SDK for Aex sessions",
5
- "license": "Apache-2.0",
6
- "homepage": "https://aex.dev",
7
- "repository": {
8
- "type": "git",
9
- "url": "git+https://github.com/aexhq/aex.git",
10
- "directory": "packages/sdk"
11
- },
3
+ "version": "0.69.0",
4
+ "description": "Aex accounts and hosted sessions using the Brain SDK",
5
+ "license": "MIT",
12
6
  "type": "module",
13
- "engines": {
14
- "node": ">=22.0.0"
15
- },
16
- "publishConfig": {
17
- "access": "public",
18
- "provenance": false,
19
- "tag": "next"
20
- },
21
- "exports": {
22
- ".": {
23
- "types": "./dist/index.d.ts",
24
- "import": "./dist/index.js"
25
- },
26
- "./package.json": "./package.json"
27
- },
28
- "files": [
29
- "dist",
30
- "README.md"
31
- ],
7
+ "sideEffects": false,
8
+ "engines": { "node": ">=22" },
9
+ "repository": { "type": "git", "url": "git+https://github.com/aexhq/aex.git", "directory": "packages/sdk" },
10
+ "exports": { ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" } },
11
+ "files": ["dist", "README.md"],
12
+ "publishConfig": { "access": "public", "tag": "next" },
13
+ "dependencies": { "@aexhq/brain": "0.19.0" },
32
14
  "scripts": {
15
+ "gen": "node ../../tools/sdk-contracts.mjs",
33
16
  "build": "tsc -p tsconfig.json",
34
- "test": "tsc -p tsconfig.json && node --test"
35
- },
36
- "dependencies": {
37
- "@aexhq/brain": "0.18.0"
38
- },
39
- "devDependencies": {
40
- "typescript": "5.9.3"
17
+ "test": "npm run build && node --test test/*.test.mjs",
18
+ "prepack": "npm run build"
41
19
  }
42
20
  }