@aexhq/sdk 0.73.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,9 +10,10 @@ 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.73 uses Brain SDK 0.22 and Pi/Codex/Tools
14
- 5.1. Brain 0.22 retains the existing Wasm interface. Components and session configurations are
15
- 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
 
18
19
  Host Tools return ordinary successful output or a Brain `Outcome` directly. Structured errors retain
@@ -73,3 +74,5 @@ await account.account.logout();
73
74
  `Aex.exchangeLogin({code, code_verifier, redirect_uri})` expose the shared HTTP login
74
75
  contract for clients. The `@aexhq/cli` package handles opening the browser, PKCE,
75
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.73.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.22.0"
31
+ "@aexhq/brain": "0.23.0"
32
32
  },
33
33
  "scripts": {
34
34
  "gen": "node ../../tools/sdk-contracts.mjs",