@agentproto/adapter-pi 0.2.4 → 0.3.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/PI.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: pi
3
3
  id: pi
4
- description: earendil-works/pi — MIT headless TypeScript coding agent. Driven over pi's persistent JSON-over-stdio RPC mode (`pi --mode rpc`) as a spawned child. Multi-provider (Anthropic/OpenAI/Google), streaming, live-duplex (steer/follow-up/abort mid-turn). No native ACP/MCP, but injected MCP servers are bridged into pi tools via a generated pi extension (see MCP-BRIDGE.md).
4
+ description: earendil-works/pi — MIT headless TypeScript coding agent. Driven over pi's persistent JSON-over-stdio RPC mode (`pi --mode rpc`) as a spawned child. Multi-provider (Anthropic/OpenAI/Google/Moonshot), streaming, live-duplex (steer/follow-up/abort mid-turn). No native ACP/MCP, but injected MCP servers are bridged into pi tools via a generated pi extension (see MCP-BRIDGE.md).
5
5
  version: 0.1.0
6
6
  bin: pi
7
7
  install:
@@ -18,7 +18,7 @@ version_check:
18
18
  auth:
19
19
  ref: ./SECRETS.md
20
20
  state:
21
- env: [ANTHROPIC_API_KEY, OPENAI_API_KEY, GOOGLE_GENERATIVE_AI_API_KEY]
21
+ env: [ANTHROPIC_API_KEY, OPENAI_API_KEY, GOOGLE_GENERATIVE_AI_API_KEY, MOONSHOT_API_KEY]
22
22
  sandbox: ./SANDBOX.md
23
23
  protocol: proprietary
24
24
  adapter: "@agentproto/adapter-pi"
@@ -69,9 +69,9 @@ and translates the stream. See [`PI-RPC.md`](./PI-RPC.md) for the wire profile.
69
69
 
70
70
  Default `anthropic/claude-sonnet-4-5`. `allowed` is a curated cross-provider
71
71
  menu (`anthropic/claude-sonnet-4-5`, `openai/gpt-5.1`,
72
- `google/gemini-2.5-flash`); the free-form `model` option accepts any pattern
73
- pi's `--model` understands (`provider/id`, verified against pi's
74
- `core/model-resolver.ts`). `env` maps provider → key env var.
72
+ `google/gemini-2.5-flash`, `moonshotai/kimi-k2.7-code`); the free-form `model`
73
+ option accepts any pattern pi's `--model` understands (`provider/id`, verified
74
+ against pi's `core/model-resolver.ts`). `env` maps provider → key env var.
75
75
 
76
76
  ## Options
77
77
 
package/README.md CHANGED
@@ -47,7 +47,7 @@ Unlike `@agentproto/adapter-mastracode-inprocess` (the in-process proprietary
47
47
  arm), **this arm spawns a real child** (`pi --mode rpc`) and translates pi's
48
48
  RPC event stream into the canonical `StreamEvent` taxonomy.
49
49
 
50
- - **Multi-provider** — Anthropic, OpenAI, Google (Gemini). One provider key
50
+ - **Multi-provider** — Anthropic, OpenAI, Google (Gemini), Moonshot AI. One provider key
51
51
  minimum. See [`SECRETS.md`](./SECRETS.md).
52
52
  - **Streaming** — text + thinking deltas, tool-call/result lifecycle.
53
53
  - **Live duplex** — pi's RPC mode supports `steer` / `follow_up` / `abort`
@@ -60,7 +60,7 @@ RPC event stream into the canonical `StreamEvent` taxonomy.
60
60
 
61
61
  | Option | Type | Notes |
62
62
  | -------- | ------ | ----- |
63
- | `model` | string | Passed to pi's `--model` (accepts `provider/id`, e.g. `anthropic/claude-sonnet-4-5`). |
63
+ | `model` | string | Passed to pi's `--model` (accepts `provider/id`, e.g. `anthropic/claude-sonnet-4-5`, `moonshotai/kimi-k2.7-code`). |
64
64
  | `effort` | enum | Thinking level, mapped 1:1 to pi's `set_thinking_level`: `off \| minimal \| low \| medium \| high \| xhigh`. |
65
65
 
66
66
  The pi binary is resolved from `definition.bin` (`pi`), overridable via the
package/SECRETS.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: pi-secrets
3
3
  id: pi-secrets
4
- description: Secret slots pi reads at boot. At minimum ONE model-provider key MUST be present — pi routes each turn to whichever provider the selected model belongs to (Anthropic / OpenAI / Google).
4
+ description: Secret slots pi reads at boot. At minimum ONE model-provider key MUST be present — pi routes each turn to whichever provider the selected model belongs to (Anthropic / OpenAI / Google / Moonshot).
5
5
  version: 0.1.0
6
6
  slots:
7
7
  - name: ANTHROPIC_API_KEY
@@ -16,19 +16,24 @@ slots:
16
16
  description: Google Generative AI (Gemini) key — enables `google/gemini-*` models.
17
17
  required: false
18
18
  sensitivity: high
19
+ - name: MOONSHOT_API_KEY
20
+ description: Moonshot AI API key — enables `moonshotai/kimi-*` models.
21
+ required: false
22
+ sensitivity: high
19
23
  constraints:
20
24
  - kind: at-least-one-of
21
25
  of:
22
26
  - ANTHROPIC_API_KEY
23
27
  - OPENAI_API_KEY
24
28
  - GOOGLE_GENERATIVE_AI_API_KEY
29
+ - MOONSHOT_API_KEY
25
30
  tags: [pi, secrets, model-providers]
26
31
  ---
27
32
 
28
33
  # Pi — secrets inventory
29
34
 
30
35
  Pi routes each turn to the provider that owns the selected model. The adapter
31
- declares the three provider key slots pi's supported providers read from the
36
+ declares the four provider key slots pi's supported providers read from the
32
37
  process environment:
33
38
 
34
39
  | Env var | Provider | Unlocks |
@@ -36,6 +41,7 @@ process environment:
36
41
  | `ANTHROPIC_API_KEY` | Anthropic | `anthropic/claude-*` (adapter default) |
37
42
  | `OPENAI_API_KEY` | OpenAI | `openai/gpt-*` |
38
43
  | `GOOGLE_GENERATIVE_AI_API_KEY` | Google | `google/gemini-*` |
44
+ | `MOONSHOT_API_KEY` | Moonshot AI | `moonshotai/kimi-*` |
39
45
 
40
46
  **At least one** must be present, and it must match the provider of the model
41
47
  you route to (`models.default` is `anthropic/claude-sonnet-4-5`, so
package/dist/index.mjs CHANGED
@@ -18764,7 +18764,7 @@ ${client._stderrTail?.() ?? ""}`
18764
18764
  var pi = defineAgentCli({
18765
18765
  name: "Pi",
18766
18766
  id: "pi",
18767
- description: "earendil-works/pi \u2014 MIT headless TypeScript coding agent. Driven over pi's persistent JSON-over-stdio RPC mode (`pi --mode rpc`) as a spawned child. Multi-provider (Anthropic/OpenAI/Google), streaming, live-duplex (steer/follow-up/abort mid-turn). No native ACP/MCP, but injected MCP servers are BRIDGED into pi tools via a generated pi extension (see MCP-BRIDGE.md); otherwise pi runs only its own built-in file/shell tools.",
18767
+ description: "earendil-works/pi \u2014 MIT headless TypeScript coding agent. Driven over pi's persistent JSON-over-stdio RPC mode (`pi --mode rpc`) as a spawned child. Multi-provider (Anthropic/OpenAI/Google/Moonshot), streaming, live-duplex (steer/follow-up/abort mid-turn). No native ACP/MCP, but injected MCP servers are BRIDGED into pi tools via a generated pi extension (see MCP-BRIDGE.md); otherwise pi runs only its own built-in file/shell tools.",
18768
18768
  version: "0.1.0",
18769
18769
  // Real binary. The proprietary arm never spawns it for you (that's
18770
18770
  // client.ts's job) but the AIP-45 schema requires the field, and client.ts
@@ -18784,7 +18784,7 @@ var pi = defineAgentCli({
18784
18784
  auth: {
18785
18785
  ref: "./SECRETS.md",
18786
18786
  state: {
18787
- env: ["ANTHROPIC_API_KEY", "OPENAI_API_KEY", "GOOGLE_GENERATIVE_AI_API_KEY"]
18787
+ env: ["ANTHROPIC_API_KEY", "OPENAI_API_KEY", "GOOGLE_GENERATIVE_AI_API_KEY", "MOONSHOT_API_KEY"]
18788
18788
  }
18789
18789
  },
18790
18790
  sandbox: "./SANDBOX.md",
@@ -18799,6 +18799,10 @@ var pi = defineAgentCli({
18799
18799
  turn_idle_timeout_ms: 3e5,
18800
18800
  context_carryover: true
18801
18801
  },
18802
+ // Pi routes on the model id's own `<provider>/<id>` prefix directly (see
18803
+ // models.allowed below), no adapter mode — so the route falls out of the
18804
+ // chosen model → derived-from-model.
18805
+ routeSelection: "derived-from-model",
18802
18806
  models: {
18803
18807
  // Pi's `--model <pattern>` accepts `provider/id` (verified against pi
18804
18808
  // 0.80.x cli/args.ts + core/model-resolver.ts). `provider` below is
@@ -18808,12 +18812,26 @@ var pi = defineAgentCli({
18808
18812
  allowed: [
18809
18813
  { id: "anthropic/claude-sonnet-4-5", provider: "anthropic" },
18810
18814
  { id: "openai/gpt-5.1", provider: "openai" },
18811
- { id: "google/gemini-2.5-flash", provider: "google" }
18815
+ { id: "google/gemini-2.5-flash", provider: "google" },
18816
+ // Model-id PREFIX stays `moonshotai/` — that's what pi's own `--model`
18817
+ // resolver expects (see the comment above). The `provider` field is a
18818
+ // BILLING endpoint, not a wire-format echo, and must be the CANONICAL
18819
+ // catalog slug `moonshot` (base.ts:48) — `moonshotai` is the upstream/
18820
+ // wire slug, already documented to drift from ours (base.ts:113-121).
18821
+ // Conflating the two is D3: it made the runtime's model→provider
18822
+ // eligibility projection compute an unrecognized "moonshotai" endpoint,
18823
+ // which doesn't match any real wallet, so a genuinely-eligible moonshot
18824
+ // profile was rejected.
18825
+ { id: "moonshotai/kimi-k2.7-code", provider: "moonshot" }
18812
18826
  ],
18813
18827
  env: {
18814
18828
  anthropic: "ANTHROPIC_API_KEY",
18815
18829
  openai: "OPENAI_API_KEY",
18816
- google: "GOOGLE_GENERATIVE_AI_API_KEY"
18830
+ google: "GOOGLE_GENERATIVE_AI_API_KEY",
18831
+ // Keyed by the canonical provider slug (matches `provider` above), not
18832
+ // the wire-format `moonshotai` prefix — see the comment on the
18833
+ // `allowed` entry.
18834
+ moonshot: "MOONSHOT_API_KEY"
18817
18835
  }
18818
18836
  },
18819
18837
  capabilities: {