@aexhq/sdk 0.72.0 → 0.74.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
@@ -10,11 +10,24 @@ console.log(await aex.account.get());
10
10
  ```
11
11
 
12
12
  `Aex` extends the pinned Brain client. Its sessions, registration, Events, Components and
13
- extension builders are Brain's implementations. SDK 0.72 uses Brain SDK 0.21 and official
14
- extension packages 5.x. Rebuild custom Wasm Components against Brain 0.20's WIT; older
15
- Components and session configurations are not migrated automatically. See https://aex.dev/docs
13
+ extension builders are Brain's implementations. SDK 0.74 uses Brain SDK 0.23 and Pi/Codex/Tools
14
+ 6.0. Images and PDFs use HTTPS URLs; Aex owns attachment publication and expiry. Deploy the matching
15
+ runtime and extensions together. Retained sessions require a compatibility check before upgrading.
16
+ See https://aex.dev/docs
16
17
  for a complete session example.
17
18
 
19
+ Host Tools return ordinary successful output or a Brain `Outcome` directly. Structured errors retain
20
+ code, message, retryable and details. The top-level statuses `ok`, `error`, `timeout`, `cancelled`
21
+ and `unknown` declare outcomes; malformed envelopes fail validation, and only successful values
22
+ pass through the output schema. Tool deadlines produce `timeout`, explicit cancellation produces
23
+ `cancelled`, and missing reliable results after dispatch produce `unknown`. All are failed Tool
24
+ results. Timeout and cancellation do not promise rollback. See
25
+ [the full return contract](https://aex.dev/brain/docs/guides/write-a-tool#return-values-and-outcomes).
26
+
27
+ `@aexhq/tools-mcp` runs selected MCP Tools in your application host, preserving structured failures
28
+ and original JSON Schema constraints. The official Docker and browser HTTP Environments target
29
+ standalone Brain and require operator deployment. See [official extensions](https://github.com/aexhq/extensions).
30
+
18
31
  Place uploaded Wasm Agentloops and Tools in `brainEnv` for hosted execution. `hostEnv`
19
32
  executes application functions in your process. Native hosted Components receive no server
20
33
  secrets, filesystem or network grants. Customer-selected HTTP Environments are not enabled
@@ -61,3 +74,5 @@ await account.account.logout();
61
74
  `Aex.exchangeLogin({code, code_verifier, redirect_uri})` expose the shared HTTP login
62
75
  contract for clients. The `@aexhq/cli` package handles opening the browser, PKCE,
63
76
  loopback callback and local credential storage.
77
+
78
+ Image and PDF uploads use the [attachment API](../../docs/attachments.md). `models(provider?)` exposes only the configured hosted model choices, with models.dev metadata when known.
@@ -1,3 +1,4 @@
1
+ import type { Media } from "@aexhq/brain";
1
2
  /**
2
3
  * This interface was referenced by `AexContracts`'s JSON-Schema
3
4
  * via the `definition` "Billing".
@@ -5,6 +6,15 @@
5
6
  export type Billing = "preview_customer_model_keys";
6
7
  export interface AexContracts {
7
8
  }
9
+ /**
10
+ * This interface was referenced by `AexContracts`'s JSON-Schema
11
+ * via the `definition` "Attachment".
12
+ */
13
+ export interface Attachment {
14
+ expires_at: number;
15
+ id: string;
16
+ media: Media;
17
+ }
8
18
  /**
9
19
  * This interface was referenced by `AexContracts`'s JSON-Schema
10
20
  * via the `definition` "Limits".
@@ -36,6 +46,8 @@ export interface Limits {
36
46
  */
37
47
  export interface Usage {
38
48
  active_turns: number;
49
+ attachment_bytes: number;
50
+ attachments: number;
39
51
  measured_at?: number | null;
40
52
  retained_bytes: number;
41
53
  sessions: number;
package/dist/generated.js CHANGED
@@ -1,2 +1 @@
1
- /* Generated from aex-server schemas. */
2
1
  export {};
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export * from "@aexhq/brain";
2
2
  export type * from "./generated.js";
3
3
  import { Brain, type BrainOptions } from "@aexhq/brain";
4
- import type { Account, Usage, ApiKey, IssuedKey, KeyInput, LoginGrantInput, LoginGrant, LoginExchange, AccountSession } from "./generated.js";
4
+ import type { Attachment, Account, Usage, ApiKey, IssuedKey, KeyInput, LoginGrantInput, LoginGrant, LoginExchange, AccountSession } from "./generated.js";
5
5
  export type AexConnection = Omit<BrainOptions, "token" | "baseUrl"> & {
6
6
  baseUrl?: string;
7
7
  };
@@ -15,6 +15,15 @@ export type AexOptions = AexConnection & ({
15
15
  export declare class Aex extends Brain {
16
16
  constructor({ apiKey, accountToken, ...options }: AexOptions);
17
17
  static exchangeLogin(input: LoginExchange, options?: AexConnection): Promise<AccountSession>;
18
+ readonly attachments: {
19
+ upload: (sessionId: string, bytes: Uint8Array, options: {
20
+ contentType: string;
21
+ expiresAt?: number;
22
+ idempotencyKey: string;
23
+ signal?: AbortSignal;
24
+ }) => Promise<Attachment>;
25
+ delete: (sessionId: string, id: string) => Promise<void>;
26
+ };
18
27
  readonly account: {
19
28
  get: () => Promise<Account>;
20
29
  usage: () => Promise<Usage>;
package/dist/index.js CHANGED
@@ -9,6 +9,14 @@ export class Aex extends Brain {
9
9
  static exchangeLogin(input, options = {}) {
10
10
  return new Brain({ baseUrl: "https://api.aex.dev", ...options }).request("POST", "/v1/auth/exchange", input);
11
11
  }
12
+ attachments = {
13
+ upload: (sessionId, bytes, options) => {
14
+ if (options.expiresAt !== undefined && (!Number.isSafeInteger(options.expiresAt) || options.expiresAt <= 0))
15
+ throw new TypeError("expiresAt must be positive Unix seconds");
16
+ return this.request("POST", `/v1/sessions/${encodeURIComponent(sessionId)}/attachments`, bytes, options.idempotencyKey, options.contentType, options.signal, options.expiresAt === undefined ? undefined : { "x-aex-expires-at": String(options.expiresAt) });
17
+ },
18
+ delete: (sessionId, id) => this.request("DELETE", `/v1/sessions/${encodeURIComponent(sessionId)}/attachments/${encodeURIComponent(id)}`),
19
+ };
12
20
  account = {
13
21
  get: () => this.request("GET", "/v1/account"),
14
22
  usage: () => this.request("GET", "/v1/usage"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aexhq/sdk",
3
- "version": "0.72.0",
3
+ "version": "0.74.0",
4
4
  "description": "Aex accounts and hosted sessions using the Brain SDK",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -28,7 +28,7 @@
28
28
  "tag": "next"
29
29
  },
30
30
  "dependencies": {
31
- "@aexhq/brain": "0.21.0"
31
+ "@aexhq/brain": "0.23.0"
32
32
  },
33
33
  "scripts": {
34
34
  "gen": "node ../../tools/sdk-contracts.mjs",