@aexhq/sdk 0.76.0 → 0.78.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
@@ -6,8 +6,8 @@ require an account credential. Configure `maxCostMicroUsd` on a prepaid workload
6
6
  per-operation ceiling. Attachment uploads also accept `downloadBudgetBytes` and an optional
7
7
  operation-specific `maxCostMicroUsd`. See [billing](../../docs/billing.md) for units and recovery.
8
8
 
9
- `session.submit()` returns the committed turn-start receipt immediately. Hosted Tools keep running
10
- after client close; host Tools require their process online. Follow Events from the receipt and read
9
+ `session.submit()` returns the saved turn's event sequence immediately. Hosted Tools keep running
10
+ after client close; host Tools require their process online. Follow Events from that sequence and read
11
11
  the transcript when the turn terminates. Put structured correction policy in the hosted Agentloop
12
12
  when submitting from a short-lived Server Action.
13
13
 
@@ -21,8 +21,8 @@ console.log(await aex.account.get());
21
21
  ```
22
22
 
23
23
  `Aex` extends the pinned Brain client. Its sessions, registration, Events, Components and
24
- extension builders are Brain's implementations. SDK 0.76 uses Brain SDK 0.25 and Pi/Codex
25
- 6.2. Images and PDFs use HTTPS URLs; Aex owns attachment publication and expiry. Deploy the matching
24
+ extension builders are Brain's implementations. SDK 0.78 uses Brain SDK 0.28 and Pi/Codex
25
+ 7.0. Images and PDFs use HTTPS URLs; Aex owns attachment publication and expiry. Deploy the matching
26
26
  runtime and extensions together. Retained sessions require a compatibility check before upgrading.
27
27
  See https://aex.dev/docs
28
28
  for a complete session example.
@@ -39,7 +39,16 @@ and transforms before the handler. Ordinary objects strip extra properties and s
39
39
  reject them. Pi dispatches in parallel; coordinate shared resources in their owning Tool or
40
40
  Environment. The official loops explain unanswered calls after interruption without replaying them.
41
41
 
42
- Host Tools return ordinary successful output or a Brain `Outcome` directly. Structured errors retain
42
+ Tool return and completion are separate. `return ctx.finish(value)` emits an optional result
43
+ and finishes an ordinary Tool. Returning a value alone emits it and releases the synchronous
44
+ caller; the Tool remains open for `ctx.emitResult(value)` and `ctx.finish()` afterward.
45
+ Background observations wake the Agentloop, which chooses whether to call the model and what
46
+ to put in its transcript. Results and finish always enter the journal. Keep the host client
47
+ connected until all its Tools finish. Interrupt cancels unfinished Tools even while idle.
48
+ A forgotten finish stays open until the original deadline, cancellation or Environment loss;
49
+ without a deadline it can remain open indefinitely.
50
+
51
+ Host Tools accept ordinary successful output or a Brain `Outcome` directly. Structured errors retain
43
52
  code, message, retryable and details. The top-level statuses `ok`, `error`, `timeout`, `cancelled`
44
53
  and `unknown` declare outcomes; malformed envelopes fail validation, and only successful values
45
54
  pass through the output schema. Tool deadlines produce `timeout`, explicit cancellation produces
@@ -54,8 +63,8 @@ standalone Brain and require operator deployment. See [official extensions](http
54
63
  Place uploaded Wasm Agentloops and Tools in `brainEnv` for hosted execution. `hostEnv`
55
64
  executes application functions in your process. Native hosted Components receive no server
56
65
  secrets, filesystem or network grants. `await aex.environments.list()` lists your account's
57
- published profiles. `await aex.environments.modal({name, profile, lifetimeMs})` selects one for
58
- your Tools; [managed execution](../../docs/environments.md) reserves credits when creating the session.
66
+ published configurations. Import `modal` from `@aexhq/env-modal` and pass the catalog URL and
67
+ granted profile name; [managed execution](../../docs/environments.md) reserves credits at creation.
59
68
  Customer-selected HTTP endpoints are denied. Hosted `brainEnv` configuration must be empty; resource access
60
69
  is configured by each Environment, not declared through extension `needs`. Prepare dependencies
61
70
  for `hostEnv` Tools in your application before registering them. Supply your model key per session.
@@ -259,17 +259,8 @@ export interface Refund {
259
259
  * via the `definition` "EnvironmentProfile".
260
260
  */
261
261
  export interface EnvironmentProfile {
262
- commands: {
263
- [k: string]: string[];
264
- };
265
- cpu: number;
266
- image: string;
267
262
  maxLifetimeMs: number;
268
- maxOutputBytes: number;
269
- memoryMiB: number;
270
- outboundDomains: string[];
271
- region: string;
272
- workdir: string;
263
+ [k: string]: unknown;
273
264
  }
274
265
  /**
275
266
  * This interface was referenced by `AexContracts`'s JSON-Schema
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export * from "@aexhq/brain";
2
2
  export type * from "./generated.js";
3
- import { Brain, type BrainOptions, type Environment } from "@aexhq/brain";
4
- import type { EnvironmentCatalog, EnvironmentSelection } from "./generated.js";
3
+ import { Brain, type BrainOptions } from "@aexhq/brain";
4
+ import type { EnvironmentCatalog } from "./generated.js";
5
5
  import type { Attachment, Account, Usage, ApiKey, IssuedKey, KeyInput, LoginGrantInput, LoginGrant, LoginExchange, AccountSession, Wallet, BillingSettings, LedgerPage, Topup, TopupInput, Refund, RefundInput, SyncPayment } from "./generated.js";
6
6
  export type AexConnection = Omit<BrainOptions, "token" | "baseUrl"> & {
7
7
  baseUrl?: string;
@@ -50,10 +50,6 @@ export declare class Aex extends Brain {
50
50
  };
51
51
  readonly environments: {
52
52
  list: () => Promise<EnvironmentCatalog>;
53
- /** Select a published profile. Compute is reserved at session creation and allocated on its first Tool invocation. */
54
- modal: ({ name, profile, lifetimeMs }: EnvironmentSelection & {
55
- name: string;
56
- }) => Promise<Environment>;
57
53
  };
58
54
  /** Key management requires an account session; workload API keys cannot create credentials. */
59
55
  readonly keys: {
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from "@aexhq/brain";
2
- import { Brain, environment } from "@aexhq/brain";
2
+ import { Brain } from "@aexhq/brain";
3
3
  function nonnegativeInteger(value, name) {
4
4
  if (!Number.isSafeInteger(value) || value < 0)
5
5
  throw new TypeError(`${name} must be a nonnegative safe integer`);
@@ -65,15 +65,6 @@ export class Aex extends Brain {
65
65
  };
66
66
  environments = {
67
67
  list: () => this.request("GET", "/v1/environments"),
68
- /** Select a published profile. Compute is reserved at session creation and allocated on its first Tool invocation. */
69
- modal: async ({ name, profile, lifetimeMs }) => {
70
- nonnegativeInteger(lifetimeMs, "lifetimeMs");
71
- const catalog = await this.environments.list();
72
- const selected = catalog.profiles[profile];
73
- if (!selected || lifetimeMs < 1000 || lifetimeMs > selected.maxLifetimeMs)
74
- throw new TypeError("profile or lifetime is not available in this account's catalog");
75
- return environment({ url: () => catalog.driver_url, configure: () => ({ profile, lifetimeMs }) })({ name });
76
- },
77
68
  };
78
69
  /** Key management requires an account session; workload API keys cannot create credentials. */
79
70
  keys = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aexhq/sdk",
3
- "version": "0.76.0",
3
+ "version": "0.78.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.25.1"
31
+ "@aexhq/brain": "0.28.0"
32
32
  },
33
33
  "scripts": {
34
34
  "gen": "node ../../tools/sdk-contracts.mjs",