@aexhq/sdk 0.57.4 → 0.57.5

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/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ import type { WebSocketFactory } from "@aexhq/brain";
4
4
  export { AbortError, AexError, OutputRefusalError, OutputSchemaError, OutputValidationError, SessionError, } from "./errors.js";
5
5
  export type { AexErrorOptions, OutputValidationIssue } from "./errors.js";
6
6
  export { Session, Sessions, } from "./session.js";
7
- export type { CreateSessionOptions, ListSessionsOptions, ModelSummary, ModelOptions, OutputOptions, RequestOptions, SessionInput, SessionList, SessionSummary, } from "./session.js";
7
+ export type { AgentloopBundle, CreateSessionOptions, ListSessionsOptions, ModelSummary, ModelOptions, OutputOptions, RequestOptions, SessionInput, SessionList, SessionSummary, } from "./session.js";
8
8
  export { SandboxFiles, SessionChild, SessionChildren, SessionSandbox, SessionStorage, } from "./resources.js";
9
9
  export type { BinarySource, ChildSummary, IdempotentOperationOptions, OperationOptions, PageOptions, SandboxFile, SandboxFileOptions, SandboxFilePage, SandboxFilePageOptions, SandboxStatus, StorageObject, StoragePage, StreamingUploadSource, UploadSource, } from "./resources.js";
10
10
  export type { EventOptions } from "./transport.js";
@@ -155,3 +155,4 @@ export declare class SessionChildren {
155
155
  }>;
156
156
  get(childId: string): SessionChild;
157
157
  }
158
+ export declare function encodeBase64(bytes: Uint8Array): string;
package/dist/resources.js CHANGED
@@ -413,7 +413,7 @@ async function collectDeclared(source, signal) {
413
413
  }
414
414
  return result;
415
415
  }
416
- function encodeBase64(bytes) {
416
+ export function encodeBase64(bytes) {
417
417
  let binary = "";
418
418
  for (let offset = 0; offset < bytes.byteLength; offset += 32_768) {
419
419
  binary += String.fromCharCode(...bytes.subarray(offset, offset + 32_768));
package/dist/session.d.ts CHANGED
@@ -17,10 +17,29 @@ export interface ModelOptions {
17
17
  temperature?: number;
18
18
  reasoningEffort?: "low" | "medium" | "high";
19
19
  }
20
+ /**
21
+ * A built agentloop implementation, as exported by a loop package or produced by
22
+ * `buildLoopBundle` from `@aexhq/agentloop`. Assignment is by import, never by name:
23
+ * the sealed identity is the content digest plus the pinned toolchain.
24
+ */
25
+ export interface AgentloopBundle {
26
+ /** The complete deterministic ESM source bundle — the exact bytes sealed and uploaded. */
27
+ source: string;
28
+ /** SHA-256 hex of the UTF-8 source bytes. */
29
+ sha256: string;
30
+ /** The pinned loop-toolchain identity the bundle was built for. */
31
+ toolchain: string;
32
+ }
20
33
  export interface CreateSessionOptions {
21
34
  model: ModelOptions;
22
35
  /** Omitted or empty grants no tools. A non-empty list is the exact grant. */
23
36
  tools?: readonly Tool[];
37
+ /**
38
+ * The agentloop driving this session's turns, assigned by importing its implementation.
39
+ * Sealed at create for the life of the session; children inherit it. Omission seals the
40
+ * official aex loop.
41
+ */
42
+ agentloop?: AgentloopBundle;
24
43
  systemPrompt?: string;
25
44
  /** Write-only values for environment names declared by managed Tools. */
26
45
  secrets?: Record<string, string>;
package/dist/session.js CHANGED
@@ -3,7 +3,7 @@ import * as z from "zod";
3
3
  import { AbortError, OutputRefusalError, OutputSchemaError, OutputValidationError, SessionError, abortError, errorFromApi, } from "./errors.js";
4
4
  import { canonicalize, jcsSha256, randomIdempotencyKey } from "./json.js";
5
5
  import { compileTools } from "./tools.js";
6
- import { SessionChildren, SessionSandbox, SessionStorage } from "./resources.js";
6
+ import { encodeBase64, SessionChildren, SessionSandbox, SessionStorage } from "./resources.js";
7
7
  export class Sessions {
8
8
  #transport;
9
9
  #webSocketFactory;
@@ -54,6 +54,15 @@ export class Sessions {
54
54
  items: compiledTools.items,
55
55
  },
56
56
  ...(compiledTools.bundles.length === 0 ? {} : { tool_bundles: compiledTools.bundles }),
57
+ ...(options.agentloop === undefined
58
+ ? {}
59
+ : {
60
+ agentloop: {
61
+ source_bundle_sha256: options.agentloop.sha256,
62
+ toolchain: options.agentloop.toolchain,
63
+ bundle_base64: encodeBase64(new TextEncoder().encode(options.agentloop.source)),
64
+ },
65
+ }),
57
66
  ...(options.secrets === undefined ? {} : { secrets: options.secrets }),
58
67
  ...(options.systemPrompt === undefined ? {} : { system_prompt: options.systemPrompt }),
59
68
  ...(options.metadata === undefined ? {} : { metadata: options.metadata }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aexhq/sdk",
3
- "version": "0.57.4",
3
+ "version": "0.57.5",
4
4
  "description": "TypeScript SDK for Aex sessions",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://aex.dev",
@@ -34,7 +34,7 @@
34
34
  "test": "tsc -p tsconfig.json && node --test"
35
35
  },
36
36
  "dependencies": {
37
- "@aexhq/brain": "0.2.0"
37
+ "@aexhq/brain": "0.3.0"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "zod": "4.4.3"