@aexhq/agentloop-pi 7.1.1 → 7.2.1

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
@@ -67,7 +67,7 @@ siblings. For hosted applications, publish bytes with Aex's attachment API and r
67
67
  Compaction explicitly resets the response format and installs a summary only after `end_turn`;
68
68
  a truncated, refused, or unknown summary leaves the original saved context intact.
69
69
 
70
- Version 7.0 targets Brain SDK 0.30 and `brain:agentloop@0.2.0`. The Tool return/completion
70
+ Version 7.0 targets Brain SDK 0.32 and `brain:agentloop@0.2.0`. The Tool return/completion
71
71
  contract is breaking. Existing sessions retain their immutable loop implementation; the
72
72
  server upgrade preflight refuses unclosed sessions from the previous contract. Keep matching
73
73
  server/artifacts for recovery. An upgrade does not migrate or delete session data.
Binary file
package/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
- import type { PlacedAgentloop, Environment } from "@aexhq/brain";
1
+ import type { PlacedAgentloop, Environment, EnvironmentGrant } from "@aexhq/brain";
2
2
 
3
3
  export interface PiOptions {
4
4
  readonly env: Environment;
5
+ readonly environments?: readonly EnvironmentGrant[];
5
6
  readonly environmentSelection?: "hidden" | "model";
6
7
  readonly placements?: Readonly<Record<string, string>>;
7
8
  /** Model context window in tokens the compaction budget is measured against. Default 200000. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aexhq/agentloop-pi",
3
- "version": "7.1.1",
3
+ "version": "7.2.1",
4
4
  "description": "Pi-style parallel-Tool Brain extension",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -40,7 +40,7 @@
40
40
  "prepack": "npm run build"
41
41
  },
42
42
  "dependencies": {
43
- "@aexhq/brain": "0.31.0",
43
+ "@aexhq/brain": "0.33.0",
44
44
  "ajv": "8.20.0",
45
45
  "ajv-formats": "3.0.1",
46
46
  "zod": "4.4.3"
package/src/component.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as host from "brain:agentloop/host@0.2.0";
2
+ import { EnvironmentServices } from "@aexhq/brain/environments";
2
3
 
3
4
  import { runPi } from "./logic.mjs";
4
5
 
@@ -35,6 +36,7 @@ export async function turn(input) {
35
36
  delete: (key) => hosted(() => host.kvDelete(key)),
36
37
  },
37
38
  acknowledge: (through) => hosted(() => host.acknowledge(BigInt(through))),
39
+ environments: new EnvironmentServices(request => Promise.resolve(JSON.parse(hosted(() => host.environments(JSON.stringify(request)))))),
38
40
  events: (after) => JSON.parse(hosted(() => host.events(BigInt(after)))),
39
41
  model: (request) => JSON.parse(hosted(() => host.model(JSON.stringify(request)))),
40
42
  dispatch: (calls) => JSON.parse(hosted(() => host.dispatch(JSON.stringify(calls)))),
package/src/logic.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { toolPlacement } from "../../../shared/tool-placement.mjs";
1
+ import { toolPlacement, refreshTools } from "../../../shared/tool-placement.mjs";
2
2
  import { observeEvents } from "../../../shared/loop-events.mjs";
3
3
  import { toolResult } from "../../../shared/tool-output.mjs";
4
4
  import { structuredOutput } from "../../../shared/structured-output.mjs";
@@ -64,7 +64,6 @@ export async function runPi(input, context) {
64
64
  compaction: true,
65
65
  ...input.configuration,
66
66
  };
67
- const placement = toolPlacement(input.tools, options);
68
67
  const output = structuredOutput(options.output);
69
68
  const transcript = cloneJson(input.transcript);
70
69
  let observed = await observeEvents(context, transcript, input.kv?.["brain.last_activation"] ?? 0);
@@ -109,6 +108,7 @@ export async function runPi(input, context) {
109
108
  await context.acknowledge(observed.through);
110
109
  if (input.input == null && !observed.actionable) return {};
111
110
  for (;;) {
111
+ const placement = toolPlacement(await refreshTools(input.tools, context), options);
112
112
  if (shouldCompact()) {
113
113
  await compact();
114
114
  await context.setTranscript(transcript);