@automatalabs/pi-acp 0.2.0 → 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 +17 -0
- package/dist/config.d.ts +9 -3
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +32 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -21,6 +21,23 @@ await runner.run("Review this change", { model: "pi/openrouter/vendor/model-id"
|
|
|
21
21
|
|
|
22
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
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
|
+
|
|
24
41
|
## MCP and structured output
|
|
25
42
|
|
|
26
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.
|
package/dist/config.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import type { SessionConfigOption } from "@agentclientprotocol/sdk";
|
|
2
2
|
import type { AgentSession, ModelRuntime } from "@earendil-works/pi-coding-agent";
|
|
3
|
-
import type
|
|
4
|
-
export
|
|
5
|
-
|
|
3
|
+
import { type Api, type Model, type ModelThinkingLevel } from "@earendil-works/pi-ai";
|
|
4
|
+
export type ThinkingLevel = ModelThinkingLevel;
|
|
5
|
+
/** Additive ACP metadata understood by AgentPrism's generic config validator. */
|
|
6
|
+
export declare const CONFIG_OPTION_META_NAMESPACE = "@automatalabs/agentprism";
|
|
7
|
+
/**
|
|
8
|
+
* Pi's complete, ordered domain, derived once from pi's own model-aware helper.
|
|
9
|
+
* This is intentionally not a hardcoded mirror of pi's module-private ladder.
|
|
10
|
+
*/
|
|
11
|
+
export declare const RECOGNIZED_THINKING_LEVELS: readonly ModelThinkingLevel[];
|
|
6
12
|
export declare function thinkingLevelOption(session: AgentSession): SessionConfigOption;
|
|
7
13
|
export declare function modelOption(session: AgentSession, availableModels: readonly Model<Api>[]): SessionConfigOption;
|
|
8
14
|
export declare function applyConfig(session: AgentSession, modelRuntime: ModelRuntime, _availableModels: readonly Model<Api>[], configId: string, value: string | boolean): Promise<{
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAClF,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAClF,OAAO,EAGL,KAAK,GAAG,EACR,KAAK,KAAK,EACV,KAAK,kBAAkB,EACxB,MAAM,uBAAuB,CAAC;AAG/B,MAAM,MAAM,aAAa,GAAG,kBAAkB,CAAC;AAE/C,iFAAiF;AACjF,eAAO,MAAM,4BAA4B,6BAA6B,CAAC;AASvE;;;GAGG;AACH,eAAO,MAAM,0BAA0B,EAAE,SAAS,kBAAkB,EAEnE,CAAC;AAOF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,mBAAmB,CAe9E;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,SAAS,KAAK,CAAC,GAAG,CAAC,EAAE,GAAG,mBAAmB,CAS9G;AAED,wBAAsB,WAAW,CAC/B,OAAO,EAAE,YAAY,EACrB,YAAY,EAAE,YAAY,EAC1B,gBAAgB,EAAE,SAAS,KAAK,CAAC,GAAG,CAAC,EAAE,EACvC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GAAG,OAAO,GACtB,OAAO,CAAC;IAAE,aAAa,EAAE,mBAAmB,EAAE,CAAC;IAAC,eAAe,EAAE,SAAS,KAAK,CAAC,GAAG,CAAC,EAAE,CAAA;CAAE,CAAC,CAwC3F"}
|
package/dist/config.js
CHANGED
|
@@ -1,13 +1,36 @@
|
|
|
1
|
+
import { clampThinkingLevel, getSupportedThinkingLevels, } from "@earendil-works/pi-ai";
|
|
1
2
|
import { adapterError } from "./errors.js";
|
|
2
|
-
|
|
3
|
+
/** Additive ACP metadata understood by AgentPrism's generic config validator. */
|
|
4
|
+
export const CONFIG_OPTION_META_NAMESPACE = "@automatalabs/agentprism";
|
|
5
|
+
const SYNTHETIC_ALL_THINKING_MODEL = {
|
|
6
|
+
reasoning: {},
|
|
7
|
+
thinkingLevelMap: new Proxy({}, {
|
|
8
|
+
get: (_target, property) => typeof property === "string" ? property : undefined,
|
|
9
|
+
}),
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Pi's complete, ordered domain, derived once from pi's own model-aware helper.
|
|
13
|
+
* This is intentionally not a hardcoded mirror of pi's module-private ladder.
|
|
14
|
+
*/
|
|
15
|
+
export const RECOGNIZED_THINKING_LEVELS = Object.freeze(getSupportedThinkingLevels(SYNTHETIC_ALL_THINKING_MODEL));
|
|
16
|
+
function supportedThinkingLevels(model) {
|
|
17
|
+
// With no selected model, the pi-derived domain is the only safe best-effort catalog.
|
|
18
|
+
return model ? getSupportedThinkingLevels(model) : RECOGNIZED_THINKING_LEVELS;
|
|
19
|
+
}
|
|
3
20
|
export function thinkingLevelOption(session) {
|
|
21
|
+
const supported = supportedThinkingLevels(session.model);
|
|
4
22
|
return {
|
|
5
23
|
id: "thinkingLevel",
|
|
6
24
|
name: "Thinking level",
|
|
7
25
|
type: "select",
|
|
8
26
|
category: "thought_level",
|
|
9
27
|
currentValue: session.thinkingLevel,
|
|
10
|
-
options:
|
|
28
|
+
options: supported.map((value) => ({ value, name: value })),
|
|
29
|
+
_meta: {
|
|
30
|
+
[CONFIG_OPTION_META_NAMESPACE]: {
|
|
31
|
+
recognizedValues: RECOGNIZED_THINKING_LEVELS,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
11
34
|
};
|
|
12
35
|
}
|
|
13
36
|
export function modelOption(session, availableModels) {
|
|
@@ -27,11 +50,16 @@ export async function applyConfig(session, modelRuntime, _availableModels, confi
|
|
|
27
50
|
if (typeof value !== "string")
|
|
28
51
|
throw adapterError("invalid_config_type");
|
|
29
52
|
if (configId === "thinkingLevel") {
|
|
30
|
-
if (!
|
|
53
|
+
if (!RECOGNIZED_THINKING_LEVELS.includes(value)) {
|
|
31
54
|
throw adapterError("invalid_config_value");
|
|
32
55
|
}
|
|
56
|
+
const requested = value;
|
|
57
|
+
const supported = supportedThinkingLevels(session.model);
|
|
58
|
+
const effective = session.model && !supported.includes(requested)
|
|
59
|
+
? clampThinkingLevel(session.model, requested)
|
|
60
|
+
: requested;
|
|
33
61
|
const availableModels = [...await modelRuntime.getAvailable()];
|
|
34
|
-
session.setThinkingLevel(
|
|
62
|
+
session.setThinkingLevel(effective);
|
|
35
63
|
return {
|
|
36
64
|
configOptions: [thinkingLevelOption(session), modelOption(session, availableModels)],
|
|
37
65
|
availableModels,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automatalabs/pi-acp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22.19.0"
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@agentclientprotocol/sdk": "1.2.1",
|
|
34
|
+
"@earendil-works/pi-ai": "0.80.10",
|
|
34
35
|
"@earendil-works/pi-coding-agent": "0.80.10",
|
|
35
36
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
36
37
|
"typebox": "1.3.2"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
39
|
-
"@earendil-works/pi-agent-core": "0.80.10"
|
|
40
|
-
"@earendil-works/pi-ai": "0.80.10"
|
|
40
|
+
"@earendil-works/pi-agent-core": "0.80.10"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "tsc -b",
|