pi-commandcode-provider 0.6.1 → 0.6.2
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/CHANGELOG.md +10 -0
- package/CONTRIBUTING.md +11 -0
- package/index.ts +22 -10
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.6.2 - 2026-09-02
|
|
6
|
+
|
|
7
|
+
- Fix `omp plugin install` on Oh My Pi 18.x, which rejected 0.6.1 because its pi-ai lacks the `registerApiProvider` export; the compat registration now resolves at runtime and is skipped on hosts that register custom APIs themselves.
|
|
8
|
+
- Run the Oh My Pi compatibility suite against a real `omp` binary in CI as a required check, and assert there that the extension loads against OMP's bundled pi packages.
|
|
9
|
+
- Pin the CI memory benchmark and Oh My Pi jobs to Bun 1.4.0, Node 22.23.2, and pi 0.84.4.
|
|
10
|
+
|
|
11
|
+
### Contributors
|
|
12
|
+
|
|
13
|
+
- @AmeMizuki — reported the failing `omp plugin install` on Oh My Pi 18.1.2.
|
|
14
|
+
|
|
5
15
|
## 0.6.1 - 2026-09-01
|
|
6
16
|
|
|
7
17
|
- Expose selectable thinking levels (`minimal`, `low`, `medium`, `high`, `xhigh`) for `meta/muse-spark-1.1`, `meta/muse-spark-1.2`, and `meta/muse-spark-1.2-contributor` through a manual catalog override, so `/thinking` and `Shift+Tab` no longer stay locked on `off` for these reasoning models.
|
package/CONTRIBUTING.md
CHANGED
|
@@ -52,6 +52,17 @@ COMMANDCODE_E2E_PROVIDER_API_KEY_FILE=/path/to/provider-key npm run test:e2e:liv
|
|
|
52
52
|
|
|
53
53
|
Use `npm run test:e2e:live:all` with the Go and GOAT file variables to run both subscription transports sequentially. Store keys in a secret manager and export each one to a new mode-`0600` temporary file for the test; never add key files to the repository. Direct `*_API_KEY` variables are intended primarily for protected CI secrets.
|
|
54
54
|
|
|
55
|
+
### Oh My Pi compatibility
|
|
56
|
+
|
|
57
|
+
`tests/test-omp-compat.mjs` runs the extension inside a real `omp` binary against a mock Command Code API. It skips locally when `omp` is not on `PATH`; CI installs Oh My Pi and runs it as a required check with `OMP_COMPAT_REQUIRED=1`, so a change that only loads on pi fails CI instead of the next `omp plugin install`.
|
|
58
|
+
|
|
59
|
+
To run it locally, point `OMP_BIN` at an omp executable (Oh My Pi needs Bun ≥ 1.3.14):
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
npm install -g @oh-my-pi/pi-coding-agent
|
|
63
|
+
OMP_BIN="$(npm prefix -g)/bin/omp" node tests/test-omp-compat.mjs
|
|
64
|
+
```
|
|
65
|
+
|
|
55
66
|
Before opening a PR, run:
|
|
56
67
|
|
|
57
68
|
```sh
|
package/index.ts
CHANGED
|
@@ -6,11 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { AssistantMessageEventStream } from "@earendil-works/pi-ai"
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
streamSimple as streamNativeProvider,
|
|
12
|
-
type ApiStreamSimpleFunction,
|
|
13
|
-
} from "@earendil-works/pi-ai/compat"
|
|
9
|
+
import * as piAiCompat from "@earendil-works/pi-ai/compat"
|
|
10
|
+
import { streamSimple as streamNativeProvider } from "@earendil-works/pi-ai/compat"
|
|
14
11
|
import {
|
|
15
12
|
getAgentDir,
|
|
16
13
|
type ExtensionAPI,
|
|
@@ -45,6 +42,24 @@ import { createCommandCodeTransportRouter } from "./src/transport.ts"
|
|
|
45
42
|
const COMMAND_CODE_API = "commandcode-custom"
|
|
46
43
|
const COMPAT_SOURCE_ID = "pi-commandcode-provider"
|
|
47
44
|
|
|
45
|
+
type CompatStreamFunction = (
|
|
46
|
+
model: Parameters<typeof streamNativeProvider>[0],
|
|
47
|
+
context: Parameters<typeof streamNativeProvider>[1],
|
|
48
|
+
options?: Parameters<typeof streamNativeProvider>[2],
|
|
49
|
+
) => AssistantMessageEventStream
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* pi's compat entrypoint exposes `registerApiProvider`; Oh My Pi maps
|
|
53
|
+
* `@earendil-works/pi-ai/compat` onto its own pi-ai, which lacks that export
|
|
54
|
+
* and registers custom APIs itself inside `registerProvider`. Resolve the
|
|
55
|
+
* function at runtime so the extension loads on both hosts.
|
|
56
|
+
*/
|
|
57
|
+
function registerCompatApiProvider(stream: CompatStreamFunction): void {
|
|
58
|
+
const register = (piAiCompat as { registerApiProvider?: unknown }).registerApiProvider
|
|
59
|
+
if (typeof register !== "function") return
|
|
60
|
+
register({ api: COMMAND_CODE_API, stream, streamSimple: stream }, COMPAT_SOURCE_ID)
|
|
61
|
+
}
|
|
62
|
+
|
|
48
63
|
function commandCodeHeaders(): Record<string, string> | undefined {
|
|
49
64
|
if (process.env.CMD_ZDR === "1" || process.env.COMMANDCODE_ZDR === "1") {
|
|
50
65
|
return { "x-cmd-zdr": "1" }
|
|
@@ -135,16 +150,13 @@ export default async function (pi: ExtensionAPI) {
|
|
|
135
150
|
// custom api there so those calls reach the same transport. The registry
|
|
136
151
|
// resolves no credentials for extension providers, so fall back to the
|
|
137
152
|
// configured key when the caller passes none.
|
|
138
|
-
const compatStream:
|
|
153
|
+
const compatStream: CompatStreamFunction = (model, context, options) =>
|
|
139
154
|
transport.stream(
|
|
140
155
|
model,
|
|
141
156
|
context,
|
|
142
157
|
options?.apiKey ? options : { ...options, apiKey: getConfiguredApiKey() },
|
|
143
158
|
) as AssistantMessageEventStream
|
|
144
|
-
|
|
145
|
-
{ api: COMMAND_CODE_API, stream: compatStream, streamSimple: compatStream },
|
|
146
|
-
COMPAT_SOURCE_ID,
|
|
147
|
-
)
|
|
159
|
+
registerCompatApiProvider(compatStream)
|
|
148
160
|
|
|
149
161
|
pi.on("message_end", async (event, ctx) => {
|
|
150
162
|
if (event.message.role !== "assistant") return
|