@automatalabs/pi-acp 0.1.3 → 0.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
@@ -19,7 +19,28 @@ await runner.run("Review this change", { model: "pi" });
19
19
  await runner.run("Review this change", { model: "pi/openrouter/vendor/model-id" });
20
20
  ```
21
21
 
22
- The runner strips exactly the first `pi/` segment and sends the remaining `provider/model-id` verbatim through ACP's reserved `model` config channel. An unknown model rejects with JSON-RPC `-32602` and `data.errorKind = "invalid_model"`. Hosts driving pi-acp directly can negotiate its native schema channel from `agentCapabilities._meta["@automatalabs/pi-acp"].outputSchema` and send the bare `_meta.outputSchema` key.
22
+ The runner strips exactly the first `pi/` segment and sends the remaining `provider/model-id` verbatim through ACP's reserved `model` config channel. Pi-acp advertises a configured `model` select populated from the completed credential- and provider-filter-aware Pi catalog; set requests refresh and require membership in that same catalog. An unknown model rejects with JSON-RPC `-32602` and `data.errorKind = "invalid_model"`.
23
+
24
+ ### Thinking levels
25
+
26
+ Pi-acp's `thinkingLevel` select is model-aware. Its visible choices are Pi's
27
+ `getSupportedThinkingLevels()` result for the selected model, in Pi's order: a model capped at
28
+ `high` does not advertise `xhigh` or `max`, and a non-reasoning model advertises only `off`. Before
29
+ a model is selected, the option uses Pi's complete recognized domain as an unknown-model
30
+ best-effort fallback. That domain is derived once from Pi's helper with a synthetic model that
31
+ supports every level; pi-acp does not maintain a parallel hardcoded vocabulary.
32
+
33
+ The option carries the additive ACP metadata
34
+ `_meta["@automatalabs/agentprism"].recognizedValues`. The visible choices remain the supported
35
+ subset, while this metadata contains Pi's complete ordered domain so clients can distinguish an
36
+ unsupported recognized value from garbage. A supported set request is applied unchanged. A
37
+ recognized but unsupported request is clamped with Pi's `clampThinkingLevel()` and the response
38
+ echoes the effective level. An unrecognized value fails loudly with JSON-RPC `-32602` and
39
+ `data.errorKind = "invalid_config_value"`; it is never handed to Pi's lowest-level fallback.
40
+
41
+ ## MCP and structured output
42
+
43
+ Pi-acp serves stdio, Streamable HTTP, and legacy SSE MCP servers and consumes stable tools, resources, prompts, completion, logging, pagination, progress, and dynamic tool registration. It also provides MCP client sampling, the workspace root, and form/URL elicitation. Client-hosted `acp` transport remains runner-owned. For `agent({ schema })`, Pi receives the runner's client-hosted HTTP `StructuredOutput` tool through this standard MCP path and retains the common prompt-embedded schema plus validated last-text fallback.
23
44
 
24
45
  ## Authentication
25
46
 
@@ -38,11 +59,11 @@ Authentication requests are no-op acknowledgements because the environment or pi
38
59
 
39
60
  ## Reserved tool namespaces
40
61
 
41
- pi-acp owns the `mcp__` prefix for bridged MCP tools and the exact `__acp_structured_output` tool. pi extensions must not register names in the `mcp__` or `__acp_` namespaces.
62
+ pi-acp owns the `mcp__` prefix for injected MCP tools. Pi extensions must not register names in that namespace.
42
63
 
43
64
  ## Version 1 limitations
44
65
 
45
- Only stdio MCP servers are supported. Load replay is the active linear branch and excludes branch topology and compaction summaries. `additionalDirectories` is accepted but ignored because pi is not root-confined. Audio is degraded to a text note. Mid-turn steering and terminal-login authentication are not exposed.
66
+ Load replay is the active linear branch and excludes branch topology and compaction summaries. `additionalDirectories` is accepted but ignored because pi is not root-confined. ACP prompt audio is degraded to a text note. Mid-turn steering and terminal-login authentication are not exposed.
46
67
 
47
68
  ## Development
48
69
 
package/dist/agent.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { AgentNotificationContext, AgentRequestContext, AuthenticateRequest, CloseSessionRequest, ForkSessionRequest, InitializeRequest, ListSessionsRequest, LoadSessionRequest, NewSessionRequest, PromptRequest, ResumeSessionRequest, SetSessionConfigOptionRequest } from "@agentclientprotocol/sdk";
2
2
  import type { PiAcpDeps } from "./deps.js";
3
- export declare const PKG_VERSION: string;
3
+ export { PKG_VERSION } from "./version.js";
4
4
  export declare class PiAcpAgent {
5
5
  private readonly deps;
6
6
  private readonly live;
@@ -8,7 +8,11 @@ export declare class PiAcpAgent {
8
8
  private readonly openingControllers;
9
9
  private readonly openingTasks;
10
10
  private readonly tombstones;
11
+ private readonly cleanupRecords;
12
+ private readonly mcpOwnerToken;
11
13
  private disposed;
14
+ private disposePromise;
15
+ private disposeSucceeded;
12
16
  constructor(deps: PiAcpDeps);
13
17
  initialize(_context: AgentRequestContext<InitializeRequest>): {
14
18
  protocolVersion: number;
@@ -22,18 +26,16 @@ export declare class PiAcpAgent {
22
26
  promptCapabilities: {
23
27
  image: boolean;
24
28
  };
25
- mcpCapabilities: {};
29
+ mcpCapabilities: {
30
+ http: boolean;
31
+ sse: boolean;
32
+ };
26
33
  sessionCapabilities: {
27
34
  resume: {};
28
35
  fork: {};
29
36
  list: {};
30
37
  close: {};
31
38
  };
32
- _meta: {
33
- "@automatalabs/pi-acp": {
34
- outputSchema: boolean;
35
- };
36
- };
37
39
  };
38
40
  authMethods: import("@agentclientprotocol/sdk").AuthMethod[];
39
41
  };
@@ -43,6 +45,7 @@ export declare class PiAcpAgent {
43
45
  private beginOpening;
44
46
  private track;
45
47
  private gate;
48
+ private connectMcp;
46
49
  private construct;
47
50
  private openingError;
48
51
  newSession(context: AgentRequestContext<NewSessionRequest>): Promise<{
@@ -83,5 +86,6 @@ export declare class PiAcpAgent {
83
86
  }>): void;
84
87
  private terminateWedged;
85
88
  dispose(): Promise<void>;
89
+ private disposeGeneration;
86
90
  }
87
91
  //# sourceMappingURL=agent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAEA,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;AAGlC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAU3C,eAAO,MAAM,WAAW,QAEvB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