@aexhq/agentloop-pi 0.0.0 → 1.2.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 +30 -0
- package/dist/index.mjs +5 -0
- package/dist/pi.brain.json +1 -0
- package/dist/source.mjs +14696 -0
- package/index.d.ts +14 -0
- package/package.json +34 -12
- package/src/compat.mjs +33 -0
- package/src/index.mjs +219 -0
- package/src/polyfill.mjs +14 -0
- package/index.js +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# @aexhq/agentloop-pi
|
|
2
|
+
|
|
3
|
+
A pi-style agent loop for Brain: a semantic port of the pi coding agent's loop,
|
|
4
|
+
pinned against [earendil-works/pi](https://github.com/earendil-works/pi) tag
|
|
5
|
+
`v0.84.4` (`@earendil-works/pi-agent-core@0.84.4`). The published pi loop is an
|
|
6
|
+
async driver that performs LLM and tool calls inside one invocation, so it
|
|
7
|
+
cannot run in Brain's deterministic WebAssembly sandbox; this package
|
|
8
|
+
reproduces its per-turn contract instead:
|
|
9
|
+
|
|
10
|
+
- tool calls are issued as one **parallel batch**, and results return in
|
|
11
|
+
assistant source order;
|
|
12
|
+
- a `length`-stopped response that carries tool calls **fails the whole batch
|
|
13
|
+
without executing it** and re-asks the model;
|
|
14
|
+
- **automatic compaction**: when the estimated context exceeds
|
|
15
|
+
`contextWindow - reserveTokens` (default 16384), history older than
|
|
16
|
+
~`keepRecentTokens` (default 20000) is summarized into pi's structured
|
|
17
|
+
context checkpoint (`## Goal` … `## Critical Context`) that replaces it.
|
|
18
|
+
|
|
19
|
+
pi's steering and follow-up queues and per-tool `executionMode` are host-app
|
|
20
|
+
seams with no Brain equivalent and are not ported.
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { pi } from "@aexhq/agentloop-pi";
|
|
24
|
+
|
|
25
|
+
const session = await brain.sessions.create({
|
|
26
|
+
agentloop: pi({ contextWindow: 200_000 }),
|
|
27
|
+
model,
|
|
28
|
+
tools: [read().useIn(workspace)],
|
|
29
|
+
});
|
|
30
|
+
```
|