@aexhq/sdk 0.88.1 → 0.89.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
@@ -8,7 +8,7 @@ tools, send messages, and read saved conversations without operating a Brain ser
8
8
  Create a key in the [dashboard](https://aex.dev/dashboard). With Node.js 22 or newer, install:
9
9
 
10
10
  ```sh
11
- npm install @aexhq/sdk@0.88.1 @aexhq/agentloop-pi@9.0.1 zod@4.4.3
11
+ npm install @aexhq/sdk@0.89.0 @aexhq/agentloop-pi@11.0.0 zod@4.4.3
12
12
  ```
13
13
 
14
14
  Set `AEX_API_KEY` and `OPENAI_API_KEY` in your server environment. Save as `order.mjs` and
@@ -51,12 +51,12 @@ explains setup and where other tools run.
51
51
 
52
52
  ## Sessions and tools
53
53
 
54
- The SDK uses Brain's session API and extension helpers. You can import `tool`, `agentloop`,
54
+ The SDK uses Brain's session API and extension helpers. You can import `tool`,
55
55
  `brainEnv`, `hostEnv`, `component`, `program` and `environment` from `@aexhq/sdk`.
56
56
 
57
57
  - [Sessions](https://aex.dev/brain/docs/concepts/sessions): send, submit, stream, reconnect and stop.
58
58
  - [Tools](https://aex.dev/brain/docs/guides/write-a-tool): application functions and packaged tools.
59
- - [Custom Agentloops](https://aex.dev/brain/docs/reference/agentloop-contract): one scoped `ctx`, KV state and automatic completion on successful return. Rebuild custom loops with Brain SDK 0.39.0 and use matching Pi/Codex 9.0.1 for new sessions.
59
+ - [Agentloops](https://aex.dev/brain/docs/reference/agentloop-contract): operators register installed runtimes at startup. Hosted sessions select a runtime offered by Aex; custom executables require your own Brain deployment.
60
60
  - [Structured output](#structured-output): validated JSON answers.
61
61
  - [Managed environments](https://github.com/aexhq/aex/blob/main/docs/environments.md): hosted tools and workspaces.
62
62
  - [Attachments](https://github.com/aexhq/aex/blob/main/docs/attachments.md): upload images and PDFs.
@@ -113,17 +113,19 @@ The initial turn uses the supplied `idempotencyKey`; corrections use distinct de
113
113
  Re-entry reuses completed turns when prompts and validation feedback are identical. This
114
114
  is not an atomic server operation; nondeterministic validation can conflict on replay.
115
115
 
116
- For work submitted by a short-lived caller, configure the official Agentloop with
117
- `output: { schema: z.toJSONSchema(answerType), maxCorrections: 2 }` and use `submit()`.
118
- That separate extension policy validates inside the hosted turn and prohibits Tools during
119
- correction. It supports JSON Schema, not arbitrary local Zod refinements or transforms.
116
+ Typed answers require a caller that stays connected through `send()`. A short-lived caller
117
+ can use `submit()`, read the completed transcript later and validate it in application code.
118
+ The installed Agentloops do not run Aex's validation or correction policy.
120
119
 
121
120
  ### Migrating from Brain SDK typed sends
122
121
 
123
122
  Brain SDK 0.34 removes typed sends and the corresponding types and errors. Aex SDK 0.84
124
123
  owns them. Existing Aex `send(..., { output })` calls keep the same syntax and behavior.
125
124
  Import `StructuredSendOptions` and `StructuredOutputError` from `@aexhq/sdk`.
126
- Use Pi 9.0.1, Codex 9.0.1 and extension packages pinned to Brain 0.39.0 with this SDK.
125
+ Use Pi 11.0.0, Codex 11.0.0 or OpenCode 1.0.0 with this SDK and Brain 0.41.0.
126
+ Agentloops are registered at server startup. Replace `prepare(pi())` or a placed Agentloop
127
+ with `pi()`. Session creation accepts a registered name and settings; Agentloop uploads and
128
+ `admitAgentloop()` are no longer supported. Hosted Tools still support `prepare()`.
127
129
  Mixing exact Brain dependency versions creates different TypeScript extension brands.
128
130
 
129
131
  An existing standalone Brain handle can use Aex's policy without changing servers:
@@ -136,8 +138,8 @@ const session = new AexSessionHandle(await brain.sessions.get(sessionId));
136
138
  `Aex` and `AexSessionHandle` use composition, so they are not instances of the upstream
137
139
  `Brain` and `SessionHandle` classes. Use `AexSessionHandle` for explicit product-handle
138
140
  annotations. Neutral Brain classes and extension helpers are still re-exported with their
139
- original identities; `withToken()` still returns a raw Brain client. Stored sessions,
140
- server contracts, native model formats and Tool schemas are unchanged.
141
+ original identities; `withToken()` still returns a raw Brain client. Upgrading an older server
142
+ requires a planned migration: Brain 0.41 uses a new session contract and `brain-data/3` storage.
141
143
 
142
144
  ## Account and usage
143
145
 
@@ -170,6 +172,7 @@ without receiving an account credential.
170
172
 
171
173
  Choose [clientBrowser](https://aex.dev/docs/client-browser) for the user's connected tab, or [Application](https://aex.dev/docs/application) for a deployed backend. Both use `aex.sessions.create()` and ordinary Tool declarations.
172
174
 
173
- The SDK prepares hosted code during session setup. To do that earlier and reuse it across
174
- sessions, call `const loop = await aex.prepare(pi())` during startup, then use `agentloop: loop`.
175
- See [Environment preparation](https://github.com/aexhq/aex/blob/main/docs/environments.md#prepare-hosted-code).
175
+ Aex runs Pi, Codex and OpenCode on the server. Their factories select an installed runtime
176
+ and pass session settings; they do not upload or start executables. Use `pi()`, `codex()` or
177
+ `opencode()` from the corresponding `@aexhq/agentloop-*` package.
178
+ See [Environment preparation](https://github.com/aexhq/aex/blob/main/docs/environments.md#prepare-hosted-code) for hosted Tools.
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ export { AexSessionHandle } from "./session.js";
4
4
  export { StructuredOutputError } from "./structured-output.js";
5
5
  export type { StructuredSendOptions } from "./structured-output.js";
6
6
  import { application } from "@aexhq/env-http";
7
- import { Brain, type PlacedAgentloop, type PlacedTool, type BrainOptions, type CreateSessionOptions, type OperationOptions, type ModelSelection } from "@aexhq/brain";
7
+ import { Brain, type PlacedTool, type BrainOptions, type CreateSessionOptions, type OperationOptions, type ModelSelection } from "@aexhq/brain";
8
8
  import { AexSessionHandle } from "./session.js";
9
9
  import type { ClientAccess, EnvironmentCatalog, TokenUsage } from "./generated.js";
10
10
  import type { Attachment, Account, Usage, ApiKey, IssuedKey, KeyInput, LoginGrantInput, LoginGrant, LoginExchange, AccountSession, Wallet, BillingSettings, LedgerPage, Topup, TopupInput, Refund, RefundInput, SyncPayment } from "./generated.js";
@@ -49,11 +49,9 @@ export declare class Aex {
49
49
  models(...args: Parameters<Brain["models"]>): ReturnType<Brain["models"]>;
50
50
  stream(...args: Parameters<Brain["stream"]>): ReturnType<Brain["stream"]>;
51
51
  streamPath(...args: Parameters<Brain["streamPath"]>): ReturnType<Brain["streamPath"]>;
52
- prepare<T extends PlacedAgentloop | PlacedTool>(extension: T): Promise<T>;
52
+ prepare<T extends PlacedTool>(extension: T): Promise<T>;
53
53
  prepareEnvironment(...args: Parameters<Brain["prepareEnvironment"]>): ReturnType<Brain["prepareEnvironment"]>;
54
54
  admitProgram(...args: Parameters<Brain["admitProgram"]>): ReturnType<Brain["admitProgram"]>;
55
- admit(...args: Parameters<Brain["admit"]>): ReturnType<Brain["admit"]>;
56
- admitAgentloop(...args: Parameters<Brain["admitAgentloop"]>): ReturnType<Brain["admitAgentloop"]>;
57
55
  admitTool(...args: Parameters<Brain["admitTool"]>): ReturnType<Brain["admitTool"]>;
58
56
  register(): ReturnType<Brain["register"]>;
59
57
  credentials(): ReturnType<Brain["credentials"]>;
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ export { AexSessionHandle } from "./session.js";
3
3
  export { StructuredOutputError } from "./structured-output.js";
4
4
  import { application } from "@aexhq/env-http";
5
5
  import { composeApplication } from "./application.js";
6
- import { Brain, inspectAgentloop, inspectTool, inspectEnvironment } from "@aexhq/brain";
6
+ import { Brain, inspectTool, inspectEnvironment } from "@aexhq/brain";
7
7
  import { AexSessionHandle } from "./session.js";
8
8
  function nonnegativeInteger(value, name) {
9
9
  if (!Number.isSafeInteger(value) || value < 0)
@@ -45,14 +45,12 @@ export class Aex {
45
45
  }
46
46
  async preparedComposition(options) {
47
47
  const composition = this.composition(options);
48
- const agentloop = inspectEnvironment(inspectAgentloop(composition.agentloop).environment).driver.driver === "brain"
49
- ? await this.client.prepare(composition.agentloop) : composition.agentloop;
50
48
  const tools = [];
51
49
  for (const tool of composition.tools ?? []) {
52
50
  tools.push(inspectEnvironment(inspectTool(tool).environment).driver.driver === "brain"
53
51
  ? await this.client.prepare(tool) : tool);
54
52
  }
55
- return { ...composition, agentloop, tools };
53
+ return { ...composition, tools };
56
54
  }
57
55
  get baseUrl() { return this.client.baseUrl; }
58
56
  sessions = Object.freeze({
@@ -69,8 +67,6 @@ export class Aex {
69
67
  prepare(extension) { return this.client.prepare(extension); }
70
68
  prepareEnvironment(...args) { return this.client.prepareEnvironment(...args); }
71
69
  admitProgram(...args) { return this.client.admitProgram(...args); }
72
- admit(...args) { return this.client.admit(...args); }
73
- admitAgentloop(...args) { return this.client.admitAgentloop(...args); }
74
70
  admitTool(...args) { return this.client.admitTool(...args); }
75
71
  register() { return this.client.register(); }
76
72
  credentials() { return this.client.credentials(); }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aexhq/sdk",
3
- "version": "0.88.1",
3
+ "version": "0.89.0",
4
4
  "description": "Aex accounts and hosted sessions using the Brain SDK",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -28,9 +28,9 @@
28
28
  "tag": "next"
29
29
  },
30
30
  "dependencies": {
31
- "@aexhq/brain": "0.39.0",
31
+ "@aexhq/brain": "0.41.0",
32
32
  "zod": "4.4.3",
33
- "@aexhq/env-http": "0.3.4"
33
+ "@aexhq/env-http": "0.3.6"
34
34
  },
35
35
  "scripts": {
36
36
  "gen": "node ../../tools/sdk-contracts.mjs",