@automatalabs/pi-acp 0.2.5 → 0.2.7
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 +6 -0
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +5 -3
- package/dist/deps.d.ts +16 -0
- package/dist/deps.d.ts.map +1 -1
- package/dist/deps.js +2 -1
- package/dist/pi-shutdown.d.ts +5 -0
- package/dist/pi-shutdown.d.ts.map +1 -0
- package/dist/pi-shutdown.js +39 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,6 +10,12 @@ Run the server with `npx @automatalabs/pi-acp` or an installed `pi-acp` binary.
|
|
|
10
10
|
|
|
11
11
|
The package entry exports the value APIs `runAcp(options?)`, `PiAcpAgent`, and `resolveDeps`, plus the TypeScript-only `PiAcpDeps` type. Importing it starts no server, opens no stdio connection, and does not mutate `console` or stdio. Call and await `runAcp()` explicitly to connect; pass a partial `PiAcpDeps` and/or an ACP stream for embedding and tests.
|
|
12
12
|
|
|
13
|
+
### Pi configuration and teardown
|
|
14
|
+
|
|
15
|
+
Sessions load the operator's real pi configuration — settings, extensions, and pi's own MCP servers — from `PiAcpDeps.agentDir`, which defaults to pi's `getAgentDir()` (`$PI_CODING_AGENT_DIR`, else `~/.pi/agent`). Override it to point pi at an isolated directory; embedders and tests that stub `createAgentSession` should, because the resource loader reads this path and starts the extensions it finds *before* the session factory is called.
|
|
16
|
+
|
|
17
|
+
Closing a session emits pi's `session_shutdown` event to those extensions before disposing the session, matching `AgentSessionRuntime.dispose()`. That event is pi's only extension-cleanup contract, so an extension that spawned a process releases it there. This matters more here than for out-of-process ACP backends: pi runs **in-process**, so anything it leaves behind is a live handle on the host's event loop rather than something the OS reaps with a child process tree.
|
|
18
|
+
|
|
13
19
|
## AgentPrism built-in backend
|
|
14
20
|
|
|
15
21
|
`@automatalabs/acp-agents` ships pi-acp as the built-in `pi` backend. Route a call with the backend-only id to keep pi's configured default model, or include pi's exact `provider/model-id` after the routing prefix:
|
package/dist/agent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAElB,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACpB,6BAA6B,EAC9B,MAAM,0BAA0B,CAAC;AAWlC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAElB,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACpB,6BAA6B,EAC9B,MAAM,0BAA0B,CAAC;AAWlC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAW3C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AA0H3C,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAY;IACjC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAgC;IACrD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA8B;IACtD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA8B;IACjE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA+B;IAC5D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAqB;IAChD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAmC;IAClE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAM;IACpC,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 import { DefaultResourceLoader, SettingsManager, createBashToolDefinition, getAg
|
|
|
5
5
|
import { AUTH_METHODS, authenticateMethod } from "./auth.js";
|
|
6
6
|
import { adapterError, isChildCleanupError, isRequestError, unexpectedError } from "./errors.js";
|
|
7
7
|
import { bridgeMcpServers, } from "./mcp-bridge.js";
|
|
8
|
+
import { shutdownPiSession } from "./pi-shutdown.js";
|
|
8
9
|
import { PiSession } from "./session.js";
|
|
9
10
|
import { ChildProcessRegistrySlot, createTrackedBashOperations } from "./child-process-registry.js";
|
|
10
11
|
import { PKG_VERSION } from "./version.js";
|
|
@@ -33,7 +34,7 @@ class FailedOpenCleanup {
|
|
|
33
34
|
console.error("pi-acp failed-open refresh drain error:", error);
|
|
34
35
|
});
|
|
35
36
|
const results = await Promise.allSettled([
|
|
36
|
-
|
|
37
|
+
shutdownPiSession(this.pi),
|
|
37
38
|
bridgeClose,
|
|
38
39
|
]);
|
|
39
40
|
for (const result of results) {
|
|
@@ -245,7 +246,8 @@ export class PiAcpAgent {
|
|
|
245
246
|
lifecycle = prepared.lifecycle;
|
|
246
247
|
bindingState = prepared.state;
|
|
247
248
|
this.gate(opening);
|
|
248
|
-
const
|
|
249
|
+
const agentDir = this.deps.agentDir ?? getAgentDir();
|
|
250
|
+
const settingsManager = SettingsManager.create(cwd, agentDir);
|
|
249
251
|
const instructionFactory = bridge.instructionsExtension;
|
|
250
252
|
const controlExtension = {
|
|
251
253
|
name: "agentprism-pi-acp-control",
|
|
@@ -262,7 +264,7 @@ export class PiAcpAgent {
|
|
|
262
264
|
};
|
|
263
265
|
const resourceLoader = new DefaultResourceLoader({
|
|
264
266
|
cwd,
|
|
265
|
-
agentDir
|
|
267
|
+
agentDir,
|
|
266
268
|
settingsManager,
|
|
267
269
|
extensionFactories: [bridge.inlineExtension, controlExtension],
|
|
268
270
|
extensionsOverride: (base) => {
|
package/dist/deps.d.ts
CHANGED
|
@@ -11,6 +11,22 @@ export interface PiAcpDeps {
|
|
|
11
11
|
listAll(sessionDir?: string): Promise<SessionInfo[]>;
|
|
12
12
|
};
|
|
13
13
|
modelRuntime: ModelRuntime;
|
|
14
|
+
/**
|
|
15
|
+
* Pi's agent directory — the source of the user's settings, extensions, and MCP servers.
|
|
16
|
+
*
|
|
17
|
+
* Defaults to pi's own `getAgentDir()` (`$PI_CODING_AGENT_DIR`, else `~/.pi/agent`), so running
|
|
18
|
+
* the server picks up the operator's real pi configuration exactly as before. It is injectable
|
|
19
|
+
* because `newSession()` reads it BEFORE `createAgentSession`: the settings manager and the
|
|
20
|
+
* resource loader are built from it and the loader then loads (and starts) the user's
|
|
21
|
+
* extensions. A caller that stubs `createAgentSession` alone therefore still gets the ambient
|
|
22
|
+
* configuration and everything it spawns, with no session runtime left to shut any of it down.
|
|
23
|
+
* Tests point this at an isolated directory; production leaves it unset.
|
|
24
|
+
*
|
|
25
|
+
* Optional so the frozen `new PiAcpAgent(deps)` contract (pi-acp spec §4.1) stays source
|
|
26
|
+
* compatible: a hand-built deps object that omits it keeps the previous ambient behaviour.
|
|
27
|
+
* `resolveDeps` always populates it.
|
|
28
|
+
*/
|
|
29
|
+
agentDir?: string;
|
|
14
30
|
sessionDir?: string;
|
|
15
31
|
connectMcpClient(server: McpServer, signal: AbortSignal, binding?: McpSessionBinding): Promise<McpClientHandle>;
|
|
16
32
|
sleep(ms: number, signal: AbortSignal): Promise<void>;
|
package/dist/deps.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deps.d.ts","sourceRoot":"","sources":["../src/deps.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,cAAc,
|
|
1
|
+
{"version":3,"file":"deps.d.ts","sourceRoot":"","sources":["../src/deps.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,cAAc,EAGd,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,WAAW,EACjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,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MAAM,CAAC;CACtB;AAED,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBxE;AAED,wBAAsB,WAAW,CAAC,OAAO,GAAE,OAAO,CAAC,SAAS,CAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAwBtF"}
|
package/dist/deps.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ModelRuntime, SessionManager, createAgentSession, } from "@earendil-works/pi-coding-agent";
|
|
1
|
+
import { ModelRuntime, SessionManager, createAgentSession, getAgentDir, } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { DEFAULT_REQUEST_TIMEOUT_MSEC } from "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
3
3
|
import { connectDefaultMcpClient, } from "./mcp-bridge.js";
|
|
4
4
|
export function realSleep(ms, signal) {
|
|
@@ -29,6 +29,7 @@ export async function resolveDeps(partial = {}) {
|
|
|
29
29
|
createAgentSession: partial.createAgentSession ?? createAgentSession,
|
|
30
30
|
sessions,
|
|
31
31
|
modelRuntime,
|
|
32
|
+
agentDir: partial.agentDir ?? getAgentDir(),
|
|
32
33
|
sessionDir: partial.sessionDir,
|
|
33
34
|
sleep,
|
|
34
35
|
graceMs: partial.graceMs ?? 5_000,
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AgentSession } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
export declare function emitPiSessionShutdown(session: AgentSession): Promise<boolean>;
|
|
3
|
+
/** `session_shutdown` then `dispose()` — pi's full teardown, in pi's order. */
|
|
4
|
+
export declare function shutdownPiSession(session: AgentSession): Promise<void>;
|
|
5
|
+
//# sourceMappingURL=pi-shutdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pi-shutdown.d.ts","sourceRoot":"","sources":["../src/pi-shutdown.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAuBpE,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAUnF;AAED,+EAA+E;AAC/E,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAG5E"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Shut pi down the way pi shuts itself down.
|
|
2
|
+
//
|
|
3
|
+
// `AgentSession.dispose()` aborts in-flight work and marks the extension context stale — it does
|
|
4
|
+
// NOT tell extensions the session is over. Pi's own hosts never call it bare: the interactive mode
|
|
5
|
+
// exits through `AgentSessionRuntime.dispose()`, which is exactly
|
|
6
|
+
//
|
|
7
|
+
// await emitSessionShutdownEvent(session.extensionRunner, { type: "session_shutdown", reason: "quit" });
|
|
8
|
+
// session.dispose();
|
|
9
|
+
//
|
|
10
|
+
// The `session_shutdown` event is where extensions release what they own — including any process
|
|
11
|
+
// an extension spawned (pi's own MCP servers among them). Calling `dispose()` without it leaves
|
|
12
|
+
// those children running. Because pi-acp embeds pi IN-PROCESS, an unreaped grandchild is our
|
|
13
|
+
// grandchild: its ChildProcess handle keeps our event loop alive and the process cannot exit. The
|
|
14
|
+
// other ACP backends never see this — they run out-of-process, so the OS reaps their tree.
|
|
15
|
+
//
|
|
16
|
+
// The SDK's `emitSessionShutdownEvent` helper is not exported from the package entry, so this
|
|
17
|
+
// reproduces its two-line body against public API (`session.extensionRunner`, `hasHandlers`,
|
|
18
|
+
// `emit`) rather than reaching into internals.
|
|
19
|
+
//
|
|
20
|
+
// NEVER throws: this runs on the disposal path, where a misbehaving extension handler must not be
|
|
21
|
+
// able to strand cleanup. A handler that hangs is bounded by the caller's disposal deadline.
|
|
22
|
+
export async function emitPiSessionShutdown(session) {
|
|
23
|
+
try {
|
|
24
|
+
const runner = session.extensionRunner;
|
|
25
|
+
if (!runner?.hasHandlers("session_shutdown"))
|
|
26
|
+
return false;
|
|
27
|
+
await runner.emit({ type: "session_shutdown", reason: "quit" });
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
console.error("pi-acp session_shutdown emit error:", error);
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/** `session_shutdown` then `dispose()` — pi's full teardown, in pi's order. */
|
|
36
|
+
export async function shutdownPiSession(session) {
|
|
37
|
+
await emitPiSessionShutdown(session);
|
|
38
|
+
session.dispose();
|
|
39
|
+
}
|
package/dist/session.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAClG,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAClG,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAc3C,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EA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,CAAC,IAAI,CAAC;IAKjD,IAAI,iBAAiB,IAAI,MAAM,CAAiD;IAEhF,IAAI,oBAAoB,IAAI,OAAO,CAElC;IAEK,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAgCvC,MAAM,IAAI,IAAI;CAOf"}
|
package/dist/session.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { methods, } from "@agentclientprotocol/sdk";
|
|
2
2
|
import { adapterError, classifyPreflight, isRequestError, unexpectedError } from "./errors.js";
|
|
3
3
|
import { applyConfig, modelOption, thinkingLevelOption } from "./config.js";
|
|
4
|
+
import { shutdownPiSession } from "./pi-shutdown.js";
|
|
4
5
|
import { convertPromptContent } from "./prompt-content.js";
|
|
5
6
|
import { replayEntry } from "./replay.js";
|
|
6
7
|
import { stopReasonFor } from "./stop-reason.js";
|
|
@@ -547,7 +548,7 @@ export class PiSession {
|
|
|
547
548
|
console.error("pi-acp MCP refresh drain error:", error);
|
|
548
549
|
});
|
|
549
550
|
const results = await Promise.allSettled([
|
|
550
|
-
|
|
551
|
+
shutdownPiSession(this.pi),
|
|
551
552
|
this.bridgeClosePromise ?? Promise.resolve(),
|
|
552
553
|
]);
|
|
553
554
|
if (results[0]?.status === "rejected") {
|