@aexhq/sdk 0.59.2 → 0.62.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.
@@ -69,7 +69,9 @@ export declare class SandboxFiles {
69
69
  export declare class SessionSandbox {
70
70
  #private;
71
71
  readonly files: SandboxFiles;
72
- constructor(transport: Transport, sessionId: string);
72
+ constructor(transport: Transport, sessionId: string, environment: string);
73
+ /** The declared Environment name this sandbox addresses. */
74
+ get environment(): string;
73
75
  status(options?: OperationOptions): Promise<SandboxStatus>;
74
76
  create(options?: OperationOptions): Promise<SandboxStatus>;
75
77
  }
package/dist/resources.js CHANGED
@@ -88,10 +88,14 @@ export class SandboxFiles {
88
88
  export class SessionSandbox {
89
89
  #inner;
90
90
  files;
91
- constructor(transport, sessionId) {
92
- this.#inner = new BrainSandbox(transport, sessionId);
91
+ constructor(transport, sessionId, environment) {
92
+ this.#inner = new BrainSandbox(transport, sessionId, environment);
93
93
  this.files = new SandboxFiles(this.#inner.files, transport);
94
94
  }
95
+ /** The declared Environment name this sandbox addresses. */
96
+ get environment() {
97
+ return this.#inner.environment;
98
+ }
95
99
  async status(options = {}) {
96
100
  return sandboxStatus(await this.#inner.status(request(options)));
97
101
  }
package/dist/session.d.ts CHANGED
@@ -93,10 +93,15 @@ export declare class Sessions {
93
93
  }
94
94
  export declare class Session implements SessionSummary {
95
95
  #private;
96
- readonly sandbox: SessionSandbox;
97
96
  readonly storage: SessionStorage;
98
97
  readonly children: SessionChildren;
99
98
  constructor(transport: Transport, data: SessionData);
99
+ /** The Environment names this session sealed. Only these can be addressed. */
100
+ get environments(): readonly string[];
101
+ /** One sealed Environment addressed by the name the session declared it under. */
102
+ environment(name: string): SessionSandbox;
103
+ /** The session's default sandbox: the one Environment it declared. */
104
+ get sandbox(): SessionSandbox;
100
105
  get id(): string;
101
106
  get state(): SessionState;
102
107
  get turnState(): SessionData["turn_state"];
package/dist/session.js CHANGED
@@ -104,6 +104,7 @@ export class Sessions {
104
104
  config: binding.config,
105
105
  grants: binding.grants,
106
106
  ...(needsEnvironment ? { environment: environmentName } : {}),
107
+ ...(binding.bundle_digest === undefined ? {} : { bundle_digest: binding.bundle_digest }),
107
108
  },
108
109
  };
109
110
  });
@@ -138,6 +139,9 @@ export class Sessions {
138
139
  },
139
140
  component_artifacts: prepared.artifacts,
140
141
  tools: { items: toolItems },
142
+ ...(prepared.toolArtifactLayers.length === 0
143
+ ? {}
144
+ : { tool_artifact_layers: prepared.toolArtifactLayers }),
141
145
  ...(environmentComponents.length === 0 ? {} : { environments: environmentConfig }),
142
146
  ...(options.secrets === undefined ? {} : { secrets: options.secrets }),
143
147
  ...(options.metadata === undefined ? {} : { metadata: options.metadata }),
@@ -329,16 +333,33 @@ function waitWithSignal(promise, signal) {
329
333
  export class Session {
330
334
  #transport;
331
335
  #data;
332
- sandbox;
333
336
  storage;
334
337
  children;
335
338
  constructor(transport, data) {
336
339
  this.#transport = transport;
337
340
  this.#data = data;
338
- this.sandbox = new SessionSandbox(transport, data.id);
339
341
  this.storage = new SessionStorage(transport, data.id);
340
342
  this.children = new SessionChildren(transport, data.id);
341
343
  }
344
+ /** The Environment names this session sealed. Only these can be addressed. */
345
+ get environments() {
346
+ return this.#data.environments;
347
+ }
348
+ /** One sealed Environment addressed by the name the session declared it under. */
349
+ environment(name) {
350
+ if (!this.#data.environments.includes(name)) {
351
+ throw new TypeError(`Session ${this.#data.id} did not declare Environment ${JSON.stringify(name)}`);
352
+ }
353
+ return new SessionSandbox(this.#transport, this.#data.id, name);
354
+ }
355
+ /** The session's default sandbox: the one Environment it declared. */
356
+ get sandbox() {
357
+ const [only, ...rest] = this.#data.environments;
358
+ if (only === undefined || rest.length > 0) {
359
+ throw new TypeError(`Session ${this.#data.id} has no default sandbox because it declared ${this.#data.environments.length} Environments; use session.environment(name)`);
360
+ }
361
+ return this.environment(only);
362
+ }
342
363
  get id() {
343
364
  return this.#data.id;
344
365
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aexhq/sdk",
3
- "version": "0.59.2",
3
+ "version": "0.62.0",
4
4
  "description": "TypeScript SDK for Aex sessions",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://aex.dev",
@@ -34,8 +34,8 @@
34
34
  "test": "tsc -p tsconfig.json && node --test"
35
35
  },
36
36
  "dependencies": {
37
- "@aexhq/brain": "0.3.3",
38
- "@aexhq/env-app": "0.2.0"
37
+ "@aexhq/brain": "0.5.0",
38
+ "@aexhq/env-app": "0.3.1"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "zod": "4.4.3"