magpie-pi 0.1.2 → 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/README.md +17 -2
- package/README.zh-CN.md +17 -2
- package/bin/magpie-pi +0 -0
- package/bin/magpie-pi-darwin-amd64 +0 -0
- package/bin/magpie-pi-darwin-arm64 +0 -0
- package/bin/magpie-pi-linux-amd64 +0 -0
- package/bin/magpie-pi-linux-arm64 +0 -0
- package/bin/magpie-pi-windows-amd64.exe +0 -0
- package/bin/magpie-pi-windows-arm64.exe +0 -0
- package/extension/bun.mjs +143 -0
- package/extension/embed.d.ts +46 -0
- package/extension/embed.mjs +47 -0
- package/extension/index.ts +10 -86
- package/extension/plugins.mjs +10 -6
- package/extension/providers.mjs +108 -0
- package/package.json +18 -4
package/README.md
CHANGED
|
@@ -8,14 +8,14 @@ Derived from [yetone/magpie](https://github.com/yetone/magpie), with its OpenCod
|
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
11
|
-
Requires **Pi 1.6.0
|
|
11
|
+
Requires **Pi 1.6.0**.
|
|
12
12
|
|
|
13
13
|
```sh
|
|
14
14
|
pi install npm:magpie-pi
|
|
15
15
|
pi
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
The
|
|
18
|
+
The package includes a prebuilt supervisor. The first plugin installation or startup downloads Bun once (~25–40 MB) and stores it under `bun/` in the state directory.
|
|
19
19
|
|
|
20
20
|
## Usage
|
|
21
21
|
|
|
@@ -37,6 +37,21 @@ Configuration is created automatically in `~/.local/share/magpie-pi`; manual JSO
|
|
|
37
37
|
- `MAGPIE_PI_BUN`: override the Bun executable.
|
|
38
38
|
- `/logout`: disables the provider without deleting plugin credentials; use `/login` to enable it again.
|
|
39
39
|
|
|
40
|
+
## Embedding
|
|
41
|
+
|
|
42
|
+
Hosts that run Pi through its SDK with one shared model runtime for many sessions (for example a GUI backend) should not load the extension per session. Use the embedding API instead: it starts the plugin host once and returns Pi provider definitions to register in the host's own runtime.
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
import {startMagpie, PluginManager} from "magpie-pi/embed";
|
|
46
|
+
|
|
47
|
+
const magpie = await startMagpie(); // {providers, errors, close}
|
|
48
|
+
for (const provider of magpie.providers) modelRuntime.registerProvider(provider.id, provider);
|
|
49
|
+
// After installing or removing plugins with PluginManager, close() and start again to apply them.
|
|
50
|
+
await magpie.close();
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Configuration and plugin problems are returned in `errors` instead of being thrown. `startMagpie()` sets `MAGPIE_PI_EMBEDDED=1`, so the Pi extension stays inactive in that process even if a user also installed it as a Pi package. Login uses Pi's `AuthInteraction` protocol, so the host's own login UI drives plugin sign-in.
|
|
54
|
+
|
|
40
55
|
## License
|
|
41
56
|
|
|
42
57
|
The project's own license is currently `UNLICENSED`. The extracted host retains its upstream MIT license in [vendor/LICENSE](vendor/LICENSE).
|
package/README.zh-CN.md
CHANGED
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
|
|
9
9
|
## 安装
|
|
10
10
|
|
|
11
|
-
需要 **Pi 1.6.0
|
|
11
|
+
需要 **Pi 1.6.0**。
|
|
12
12
|
|
|
13
13
|
```sh
|
|
14
14
|
pi install npm:magpie-pi
|
|
15
15
|
pi
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
包内已包含预编译宿主程序。首次安装或启动插件时会自动下载 Bun(一次性下载约 25–40 MB),保存在状态目录的 `bun/` 下。
|
|
19
19
|
|
|
20
20
|
## 使用
|
|
21
21
|
|
|
@@ -37,6 +37,21 @@ npm 包包含预编译宿主程序,**无需安装 Go,也无需执行构建
|
|
|
37
37
|
- `MAGPIE_PI_BUN`:指定 Bun 可执行文件。
|
|
38
38
|
- `/logout`:停用服务但不删除插件凭据;再次使用时执行 `/login`。
|
|
39
39
|
|
|
40
|
+
## 嵌入使用
|
|
41
|
+
|
|
42
|
+
通过 SDK 运行 Pi、并且多个会话共用一个模型运行时的宿主程序(例如 GUI 后端),不应在每个会话里加载扩展,而应使用嵌入 API:它只启动一次插件宿主,返回 Pi provider 定义,由宿主注册到自己的运行时中。
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
import {startMagpie, PluginManager} from "magpie-pi/embed";
|
|
46
|
+
|
|
47
|
+
const magpie = await startMagpie(); // {providers, errors, close}
|
|
48
|
+
for (const provider of magpie.providers) modelRuntime.registerProvider(provider.id, provider);
|
|
49
|
+
// 用 PluginManager 安装或卸载插件后,close() 再重新启动即可生效。
|
|
50
|
+
await magpie.close();
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
配置和插件问题通过 `errors` 返回,不会抛出异常。`startMagpie()` 会设置 `MAGPIE_PI_EMBEDDED=1`,因此即使用户同时把它装成了 Pi 包,扩展在该进程里也不会生效。登录走 Pi 的 `AuthInteraction` 协议,因此由宿主自己的登录界面驱动插件登录。
|
|
54
|
+
|
|
40
55
|
## 许可证
|
|
41
56
|
|
|
42
57
|
项目自身暂标为 `UNLICENSED`。抽取的宿主保留 [vendor/LICENSE](vendor/LICENSE) 中的上游 MIT 许可证。
|
package/bin/magpie-pi
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import {createHash, randomUUID} from "node:crypto";
|
|
2
|
+
import {chmod, lstat, mkdir, readdir, rename, rm, writeFile} from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import * as zlib from "node:zlib";
|
|
5
|
+
|
|
6
|
+
export const BUN_VERSION = "1.4.2";
|
|
7
|
+
const sumsByZip = Object.freeze({
|
|
8
|
+
"bun-darwin-aarch64.zip": "90987a3a16d7db556d886ac3d551e7b6d3edf0a1cf43acaed622e8676be1d12f",
|
|
9
|
+
"bun-darwin-x64.zip": "80520d7e17526308c9185d261679ac6d27798d3803a0e9f7ff9121ab8affb012",
|
|
10
|
+
"bun-linux-aarch64.zip": "54328bbc2d9c8e0c9f892c544d66c57a83b84139e34909e5ee81758f1ac8fda7",
|
|
11
|
+
"bun-linux-x64-baseline.zip": "c678040f14fe0440eb839d37cbd0ce4c051a32da72806ac97de6a6aab6bf728f",
|
|
12
|
+
"bun-linux-aarch64-musl.zip": "71760b6c8ea30623b81a4907cb815d48e2ea266f2e73e751534a44a0607950df",
|
|
13
|
+
"bun-linux-x64-musl-baseline.zip": "76e1db84e98f22f78de0a87e309bfbbf297732847f9720db36750646c85c8c18",
|
|
14
|
+
"bun-windows-x64-baseline.zip": "78c221c2376f79731ccf4e4af0b3bb46d81fefa3296c5abee09ad8a1b21e68c6",
|
|
15
|
+
"bun-windows-aarch64.zip": "a7a16b876a305fd1029c66dbd27007b4f6112ae896532f675878731a21e50cfd",
|
|
16
|
+
});
|
|
17
|
+
const pending = new Map();
|
|
18
|
+
const sizeLimit = 200 * 1024 * 1024;
|
|
19
|
+
const executable = process.platform === "win32" ? "bun.exe" : "bun";
|
|
20
|
+
|
|
21
|
+
export function bunTarget({platform, arch, musl}) {
|
|
22
|
+
if (!["darwin", "linux", "win32"].includes(platform) || !["x64", "arm64"].includes(arch))
|
|
23
|
+
throw Error(`Bun has no build for ${platform}/${arch}`);
|
|
24
|
+
const cpu = arch === "arm64" ? "aarch64" : arch;
|
|
25
|
+
if (platform === "darwin") return "bun-darwin-" + cpu;
|
|
26
|
+
return "bun-" + (platform === "win32" ? "windows" : "linux") + "-" + cpu
|
|
27
|
+
+ (platform === "linux" && musl ? "-musl" : "") + (arch === "x64" ? "-baseline" : "");
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function managedBunPath(state) {
|
|
31
|
+
return path.join(state, "bun", BUN_VERSION, executable);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async function regularFile(file) {
|
|
35
|
+
try { return (await lstat(file)).isFile(); }
|
|
36
|
+
catch (err) { if (err.code === "ENOENT") return false; throw err; }
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function download(url, fetcher) {
|
|
40
|
+
const res = await fetcher(url, {signal: AbortSignal.timeout(600000)});
|
|
41
|
+
if (!res.ok || Number(res.headers.get("content-length")) > sizeLimit) {
|
|
42
|
+
await res.body?.cancel();
|
|
43
|
+
throw Error(res.ok ? "download exceeds 200 MiB" : "HTTP " + res.status);
|
|
44
|
+
}
|
|
45
|
+
const chunks = [];
|
|
46
|
+
let bytes = 0;
|
|
47
|
+
for await (const chunk of res.body) {
|
|
48
|
+
bytes += chunk.length;
|
|
49
|
+
if (bytes > sizeLimit) throw Error("download exceeds 200 MiB");
|
|
50
|
+
chunks.push(chunk);
|
|
51
|
+
}
|
|
52
|
+
return Buffer.concat(chunks, bytes);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function zip32(value) {
|
|
56
|
+
if (value === 0xffffffff) throw Error("ZIP64 is unsupported");
|
|
57
|
+
return value;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function extract(zip) {
|
|
61
|
+
let end = zip.length - 22;
|
|
62
|
+
const limit = Math.max(0, zip.length - 65557);
|
|
63
|
+
while (end >= limit && (zip.readUInt32LE(end) !== 0x06054b50 ||
|
|
64
|
+
end + 22 + zip.readUInt16LE(end + 20) !== zip.length)) end--;
|
|
65
|
+
if (end < limit) throw Error("missing ZIP end record");
|
|
66
|
+
const count = zip.readUInt16LE(end + 10);
|
|
67
|
+
if (count === 0xffff) throw Error("ZIP64 is unsupported");
|
|
68
|
+
const size = zip32(zip.readUInt32LE(end + 12));
|
|
69
|
+
let entry = zip32(zip.readUInt32LE(end + 16));
|
|
70
|
+
if (entry + size !== end) throw Error("invalid ZIP directory size");
|
|
71
|
+
let result;
|
|
72
|
+
for (let i = 0; i < count; i++) {
|
|
73
|
+
if (entry + 46 > end || zip.readUInt32LE(entry) !== 0x02014b50) throw Error("invalid ZIP directory entry");
|
|
74
|
+
const compressed = zip32(zip.readUInt32LE(entry + 20));
|
|
75
|
+
const length = zip32(zip.readUInt32LE(entry + 24));
|
|
76
|
+
const local = zip32(zip.readUInt32LE(entry + 42));
|
|
77
|
+
const nameLength = zip.readUInt16LE(entry + 28);
|
|
78
|
+
const name = zip.toString("utf8", entry + 46, entry + 46 + nameLength);
|
|
79
|
+
const next = entry + 46 + nameLength + zip.readUInt16LE(entry + 30) + zip.readUInt16LE(entry + 32);
|
|
80
|
+
if (next > end) throw Error("truncated ZIP directory");
|
|
81
|
+
if (name.split("/").pop() === executable && !(zip.readUInt32LE(entry + 38) & 0x10)) {
|
|
82
|
+
if (result) throw Error("duplicate Bun executable");
|
|
83
|
+
if (zip.readUInt32LE(local) !== 0x04034b50) throw Error("invalid ZIP local header");
|
|
84
|
+
zip32(zip.readUInt32LE(local + 18));
|
|
85
|
+
zip32(zip.readUInt32LE(local + 22));
|
|
86
|
+
const start = local + 30 + zip.readUInt16LE(local + 26) + zip.readUInt16LE(local + 28);
|
|
87
|
+
if (start + compressed > end - size) throw Error("truncated ZIP data");
|
|
88
|
+
const data = zip.subarray(start, start + compressed);
|
|
89
|
+
switch (zip.readUInt16LE(entry + 10)) {
|
|
90
|
+
case 0: result = data; break;
|
|
91
|
+
case 8: result = zlib.inflateRawSync(data, {maxOutputLength: Math.max(1, length)}); break;
|
|
92
|
+
default: throw Error("unsupported ZIP compression");
|
|
93
|
+
}
|
|
94
|
+
if (result.length !== length || (zlib.crc32 && zlib.crc32(result) !== zip.readUInt32LE(entry + 16)))
|
|
95
|
+
throw Error("invalid Bun entry size or CRC-32");
|
|
96
|
+
}
|
|
97
|
+
entry = next;
|
|
98
|
+
}
|
|
99
|
+
if (!result || entry !== end) throw Error("invalid Bun archive");
|
|
100
|
+
return result;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
async function install(exe, target, base, sums, fetcher) {
|
|
104
|
+
const archive = target + ".zip";
|
|
105
|
+
const zip = await download(`${base}/bun-v${BUN_VERSION}/${archive}`, fetcher);
|
|
106
|
+
if (createHash("sha256").update(zip).digest("hex") !== sums[archive]) throw Error("SHA-256 checksum mismatch");
|
|
107
|
+
const binary = extract(zip);
|
|
108
|
+
const dir = path.dirname(exe);
|
|
109
|
+
const root = path.dirname(dir);
|
|
110
|
+
for (const directory of [root, dir]) {
|
|
111
|
+
await mkdir(directory, {recursive: true, mode: 0o700});
|
|
112
|
+
if (!(await lstat(directory)).isDirectory()) throw Error("invalid Bun directory");
|
|
113
|
+
}
|
|
114
|
+
const part = exe + "." + process.pid + "." + randomUUID() + ".part";
|
|
115
|
+
try {
|
|
116
|
+
await writeFile(part, binary, {mode: 0o755, flag: "wx"});
|
|
117
|
+
await chmod(part, 0o755);
|
|
118
|
+
try { await rename(part, exe); }
|
|
119
|
+
catch (err) { if (!await regularFile(exe)) throw err; }
|
|
120
|
+
} finally { await rm(part, {force: true}); }
|
|
121
|
+
for (const other of await readdir(root, {withFileTypes: true}).catch(() => [])) {
|
|
122
|
+
if (other.isDirectory() && /^\d+\.\d+\.\d+$/.test(other.name) && other.name !== BUN_VERSION)
|
|
123
|
+
await rm(path.join(root, other.name), {recursive: true, force: true}).catch(() => {});
|
|
124
|
+
}
|
|
125
|
+
return exe;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export async function ensureBun(state, {fetcher = fetch, override = process.env.MAGPIE_PI_BUN,
|
|
129
|
+
base = "https://github.com/oven-sh/bun/releases/download", target, sums = sumsByZip} = {}) {
|
|
130
|
+
if (override) return override;
|
|
131
|
+
const exe = managedBunPath(state);
|
|
132
|
+
try {
|
|
133
|
+
if (await regularFile(exe)) return exe;
|
|
134
|
+
target ??= bunTarget({platform: process.platform, arch: process.arch,
|
|
135
|
+
musl: process.platform === "linux" && !process.report?.getReport?.()?.header?.glibcVersionRuntime});
|
|
136
|
+
if (!pending.has(exe)) {
|
|
137
|
+
pending.set(exe, install(exe, target, base, sums, fetcher).finally(() => pending.delete(exe)));
|
|
138
|
+
}
|
|
139
|
+
return await pending.get(exe);
|
|
140
|
+
} catch (err) {
|
|
141
|
+
throw Error(`magpie-pi: could not get Bun ${BUN_VERSION} (${target ?? process.platform + "/" + process.arch}): ${err.message ?? err}. Set MAGPIE_PI_BUN to a Bun executable to use one you have.`);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** A Pi provider definition, as accepted by `ModelRuntime.registerProvider(id, config)`. */
|
|
2
|
+
export interface MagpieProvider {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface MagpieHost {
|
|
9
|
+
/** State directory in use (MAGPIE_PI_STATE or ~/.local/share/magpie-pi). */
|
|
10
|
+
state: string;
|
|
11
|
+
configPath: string;
|
|
12
|
+
providers: MagpieProvider[];
|
|
13
|
+
/** Configuration or plugin-host problems; `providers` is empty when there are any. */
|
|
14
|
+
errors: string[];
|
|
15
|
+
/** Stop the plugin host. Safe to call more than once. */
|
|
16
|
+
close(): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Also sets MAGPIE_PI_EMBEDDED=1: the Pi extension stays inactive in this process. */
|
|
20
|
+
export function startMagpie(options?: { state?: string; bun?: string }): Promise<MagpieHost>;
|
|
21
|
+
|
|
22
|
+
export function defaultState(): string;
|
|
23
|
+
|
|
24
|
+
export interface MagpiePluginEntry {
|
|
25
|
+
spec?: string;
|
|
26
|
+
target?: string;
|
|
27
|
+
magpieManaged?: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface MagpieSearchResult {
|
|
31
|
+
name: string;
|
|
32
|
+
version: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export class PluginManager {
|
|
37
|
+
constructor(state: string, options?: { bun?: string; fetcher?: typeof fetch; runner?: unknown });
|
|
38
|
+
cleanup(): Promise<void>;
|
|
39
|
+
search(query: string): Promise<MagpieSearchResult[]>;
|
|
40
|
+
list(): Promise<MagpiePluginEntry[]>;
|
|
41
|
+
/** `confirm` must resolve true for the change to happen; returns a status message. */
|
|
42
|
+
mutate(action: "install" | "remove", input: string, confirm: (name: string) => Promise<boolean>): Promise<string>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Validate a community package name with an optional exact version (aliases: cursor, workbuddy). */
|
|
46
|
+
export function parse(input: string): { name: string; version?: string };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Embedding API for hosts that run Pi through its SDK with one shared model runtime across
|
|
2
|
+
// sessions (for example a GUI backend). The Pi extension starts one plugin host per Pi process
|
|
3
|
+
// and registers providers per session; an embedder instead starts the host once, registers the
|
|
4
|
+
// returned providers in its own runtime, and restarts the host to apply plugin changes.
|
|
5
|
+
//
|
|
6
|
+
// import {startMagpie, PluginManager} from "magpie-pi/embed";
|
|
7
|
+
// const magpie = await startMagpie();
|
|
8
|
+
// for (const provider of magpie.providers) modelRuntime.registerProvider(provider.id, provider);
|
|
9
|
+
// ...
|
|
10
|
+
// await magpie.close();
|
|
11
|
+
import {PluginManager} from "./plugins.mjs";
|
|
12
|
+
import {createProviders,defaultState,loadConfig,startBridge} from "./providers.mjs";
|
|
13
|
+
|
|
14
|
+
export {PluginManager,parse} from "./plugins.mjs";
|
|
15
|
+
export {defaultState} from "./providers.mjs";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Start magpie: mark the process as embedding (MAGPIE_PI_EMBEDDED=1, which keeps the Pi extension
|
|
19
|
+
* inactive in it), clean up deferred plugin deletions, read the config, start the plugin host and build
|
|
20
|
+
* Pi provider definitions. Never throws for configuration or plugin problems: they are returned in
|
|
21
|
+
* `errors` (with no providers) so the embedder keeps working; `close()` is always safe to call.
|
|
22
|
+
*
|
|
23
|
+
* @param {{state?: string, bun?: string}} [options] The bun option overrides the downloaded Bun executable.
|
|
24
|
+
* @returns {Promise<{state: string, configPath: string, providers: any[], errors: string[], close: () => Promise<void>}>}
|
|
25
|
+
*/
|
|
26
|
+
export async function startMagpie(options={}){
|
|
27
|
+
// The Pi extension, if also installed (any source), stays inactive in this process.
|
|
28
|
+
process.env.MAGPIE_PI_EMBEDDED="1";
|
|
29
|
+
const state=options.state||defaultState();
|
|
30
|
+
const none=async()=>{};
|
|
31
|
+
await new PluginManager(state).cleanup();
|
|
32
|
+
let loaded;
|
|
33
|
+
try {loaded=await loadConfig(state);}
|
|
34
|
+
catch(e){return {state,configPath:"",providers:[],errors:[String(e)],close:none};}
|
|
35
|
+
const {config,configPath}=loaded;
|
|
36
|
+
if(config.plugins.length===0)return {state,configPath,providers:[],errors:[],close:none};
|
|
37
|
+
let bridge;
|
|
38
|
+
try {bridge=await startBridge(state,options.bun);}
|
|
39
|
+
catch(e){return {state,configPath,providers:[],errors:[String(e)],close:none};}
|
|
40
|
+
const close=()=>bridge.close().then(()=>undefined);
|
|
41
|
+
try {
|
|
42
|
+
return {state,configPath,providers:await createProviders(bridge,config,state),errors:[],close};
|
|
43
|
+
}catch(e){
|
|
44
|
+
await close();
|
|
45
|
+
return {state,configPath,providers:[],errors:[String(e)],close:none};
|
|
46
|
+
}
|
|
47
|
+
}
|
package/extension/index.ts
CHANGED
|
@@ -1,105 +1,29 @@
|
|
|
1
|
-
import {readFile,mkdir,writeFile} from "node:fs/promises";
|
|
2
|
-
import {fileURLToPath} from "node:url";
|
|
3
1
|
import path from "node:path";
|
|
4
|
-
import os from "node:os";
|
|
5
2
|
import type {ExtensionAPI} from "@earendil-works/pi-coding-agent";
|
|
6
|
-
// The Pi extension loader exposes the compat entry, not the per-API subpaths.
|
|
7
|
-
import {openAICompletionsApi,anthropicMessagesApi} from "@earendil-works/pi-ai/compat";
|
|
8
|
-
import {Bridge} from "./bridge.mjs";
|
|
9
|
-
import {supervisorPath} from "./platform.mjs";
|
|
10
3
|
import {registerPlugins,PluginManager} from "./plugins.mjs";
|
|
4
|
+
import {createProviders,defaultState,loadConfig,packageRoot,startBridge} from "./providers.mjs";
|
|
11
5
|
|
|
12
6
|
export default async function(pi:ExtensionAPI){
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
// A host in this process already runs magpie through the embedding API (embed.mjs): stay inactive
|
|
8
|
+
// so providers are not registered twice and no second plugin host starts.
|
|
9
|
+
if(process.env.MAGPIE_PI_EMBEDDED==="1")return;
|
|
10
|
+
const state=defaultState();
|
|
15
11
|
registerPlugins(pi,state);
|
|
16
12
|
await new PluginManager(state).cleanup();
|
|
17
|
-
const configPath=
|
|
18
|
-
let source:string;
|
|
19
|
-
try {source=await readFile(configPath,"utf8");}
|
|
20
|
-
catch(error){
|
|
21
|
-
if((error as NodeJS.ErrnoException).code!=="ENOENT")throw error;
|
|
22
|
-
await mkdir(state,{recursive:true,mode:0o700});
|
|
23
|
-
try {await writeFile(configPath,JSON.stringify({plugins:[],accounts:{},opencode:{}},null,2)+"\n",{flag:"wx",mode:0o600});}
|
|
24
|
-
catch(error){if((error as NodeJS.ErrnoException).code!=="EEXIST")throw error;}
|
|
25
|
-
source=await readFile(configPath,"utf8");
|
|
26
|
-
}
|
|
27
|
-
const config=JSON.parse(source);
|
|
28
|
-
if(!config||!Array.isArray(config.plugins))throw new Error(`magpie-pi: ${configPath} must contain a plugins array`);
|
|
13
|
+
const {config,configPath}=await loadConfig(state);
|
|
29
14
|
if(config.plugins.length===0){
|
|
30
15
|
pi.on("session_start",async(_event,ctx)=>{
|
|
31
|
-
if(ctx.hasUI)ctx.ui.notify(`No magpie-pi providers configured. Use /magpie-plugins to search and install plugins, or edit ${configPath}; restart Pi after configuration. See ${path.join(
|
|
16
|
+
if(ctx.hasUI)ctx.ui.notify(`No magpie-pi providers configured. Use /magpie-plugins to search and install plugins, or edit ${configPath}; restart Pi after configuration. See ${path.join(packageRoot,"README.md")}`,"info");
|
|
32
17
|
});
|
|
33
18
|
return;
|
|
34
19
|
}
|
|
35
|
-
let
|
|
36
|
-
try {
|
|
20
|
+
let bridge:Awaited<ReturnType<typeof startBridge>>;
|
|
21
|
+
try {bridge=await startBridge(state);}catch(e){
|
|
37
22
|
pi.on("session_start",async(_event,ctx)=>{if(ctx.hasUI)ctx.ui.notify(String(e),"error")});
|
|
38
23
|
return;
|
|
39
24
|
}
|
|
40
|
-
const bridge=new Bridge(executable,path.join(root,"vendor","host.js"),state,process.env.MAGPIE_PI_BUN);
|
|
41
25
|
pi.on("session_shutdown",async()=>{await bridge.close();});
|
|
42
26
|
try {
|
|
43
|
-
|
|
44
|
-
for(const p of initialized.plugins)if(p.error)throw new Error(p.error);
|
|
45
|
-
const rows=await bridge.call("providers");
|
|
46
|
-
const completions=openAICompletionsApi();
|
|
47
|
-
const anthropic=anthropicMessagesApi();
|
|
48
|
-
for(const initial of rows){
|
|
49
|
-
let row=initial;
|
|
50
|
-
const id="magpie-"+row.id;
|
|
51
|
-
const models=()=>row.models.filter((m:any)=>["@ai-sdk/openai-compatible","@ai-sdk/anthropic"].includes(m.npm)).map((m:any)=>({
|
|
52
|
-
type:"chat",id:m.id,name:m.name||m.id,provider:id,
|
|
53
|
-
api:m.npm==="@ai-sdk/anthropic"?"anthropic-messages":"openai-completions",
|
|
54
|
-
baseUrl:m.url||row.api,reasoning:m.reasoning,input:m.image?["text","image"]:["text"],
|
|
55
|
-
cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:m.context||128000,maxTokens:m.output||8192
|
|
56
|
-
}));
|
|
57
|
-
const stream=(simple:boolean)=>(model:any,context:any,options:any={})=>{
|
|
58
|
-
const m=row.models.find((m:any)=>m.id===model.id);
|
|
59
|
-
const api=model.api==="anthropic-messages"?anthropic:completions;
|
|
60
|
-
return api[simple?"streamSimple":"stream"]({...model,id:m.apiId||model.id},context,{...options,apiKey:"plugin-owned",fetch:bridge.fetch(row.id,config.accounts?.[row.id],m.npm,m.id)});
|
|
61
|
-
};
|
|
62
|
-
pi.registerProvider({
|
|
63
|
-
id,name:row.name||row.id,
|
|
64
|
-
auth:{apiKey:{name:"Plugin-managed account",
|
|
65
|
-
resolve:async({credential})=>credential?.key==="plugin-owned"&&row.signedIn?{auth:{apiKey:"plugin-owned"}}:undefined,
|
|
66
|
-
login:async interaction=>{
|
|
67
|
-
const method=Number(await interaction.prompt({type:"select",message:"Sign-in method",options:row.methods.map((m:any,i:number)=>({id:String(i),label:m.label}))}));
|
|
68
|
-
const m=row.methods[method];let result;
|
|
69
|
-
const inputs:Record<string,string>={};
|
|
70
|
-
while(true){
|
|
71
|
-
const {prompt}=await bridge.call("prompt",{provider:row.id,method,inputs},interaction.signal);
|
|
72
|
-
if(!prompt)break;
|
|
73
|
-
const value=await interaction.prompt(prompt.type==="select"?{
|
|
74
|
-
type:"select",message:prompt.message,options:prompt.options.map((o:any)=>({id:o.value,label:o.label,description:o.hint}))
|
|
75
|
-
}:{type:"secret",message:prompt.message,placeholder:prompt.placeholder});
|
|
76
|
-
const {error}=await bridge.call("validate",{provider:row.id,method,key:prompt.key,value},interaction.signal);
|
|
77
|
-
if(error){interaction.notify({type:"info",message:error});continue;}
|
|
78
|
-
inputs[prompt.key]=value;
|
|
79
|
-
}
|
|
80
|
-
if(m.type==="api"){
|
|
81
|
-
const key=m.keyless||m.keyAsked?"":await interaction.prompt({type:"secret",message:"API key"});
|
|
82
|
-
result=await bridge.call("apiKey",{provider:row.id,method,key,inputs},interaction.signal);
|
|
83
|
-
}else{
|
|
84
|
-
const a=await bridge.call("authorize",{provider:row.id,method,inputs},interaction.signal);
|
|
85
|
-
if(!a.ok)throw new Error(a.error||"Sign-in failed");
|
|
86
|
-
if(a.url)interaction.notify({type:"auth_url",url:a.url,instructions:a.instructions});
|
|
87
|
-
const code=a.method==="code"?await interaction.prompt({type:"manual_code",message:a.instructions||"Authorization code"}):undefined;
|
|
88
|
-
result=await bridge.call("callback",{session:a.session,code},interaction.signal);
|
|
89
|
-
}
|
|
90
|
-
if(!result.ok)throw new Error(result.error||"Sign-in failed");
|
|
91
|
-
row=(await bridge.call("providers")).find((r:any)=>r.id===row.id);
|
|
92
|
-
return {type:"api_key",key:"plugin-owned"};
|
|
93
|
-
}}},
|
|
94
|
-
getModels:models,
|
|
95
|
-
refreshModels:async context=>{
|
|
96
|
-
if(!context.allowNetwork)return;
|
|
97
|
-
const next=(await bridge.call("providers",{},context.signal)).find((r:any)=>r.id===row.id);
|
|
98
|
-
if(!next||next.fellBack)throw new Error(next?.listError||"Model discovery failed");
|
|
99
|
-
await context.publish({update:()=>{row=next}});
|
|
100
|
-
},
|
|
101
|
-
stream:stream(false),streamSimple:stream(true)
|
|
102
|
-
});
|
|
103
|
-
}
|
|
27
|
+
for(const provider of await createProviders(bridge,config,state))pi.registerProvider(provider as any);
|
|
104
28
|
}catch(e){await bridge.close();pi.on("session_start",async(_event,ctx)=>{if(ctx.hasUI)ctx.ui.notify(String(e)+"; use /magpie-plugins to fix the configuration","error")});}
|
|
105
29
|
}
|
package/extension/plugins.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import {readFile,writeFile,mkdir,rename,rm,mkdtemp,lstat,realpath} from "node:fs
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import {execFile} from "node:child_process";
|
|
4
4
|
import {promisify} from "node:util";
|
|
5
|
+
import {ensureBun} from "./bun.mjs";
|
|
5
6
|
const scope="@magpie-community/opencode-";
|
|
6
7
|
const withdrawn=scope+"antigravity-auth";
|
|
7
8
|
export function parse(input){
|
|
@@ -12,8 +13,8 @@ export function parse(input){
|
|
|
12
13
|
return {name:m[1],version:m[2]};
|
|
13
14
|
}
|
|
14
15
|
export class PluginManager{
|
|
15
|
-
constructor(state,{fetcher=fetch,runner=promisify(execFile)}={}){
|
|
16
|
-
this.state=state;this.file=path.join(state,"config.json");this.fetcher=fetcher;this.runner=runner;
|
|
16
|
+
constructor(state,{bun,fetcher=fetch,runner=promisify(execFile)}={}){
|
|
17
|
+
this.bun=bun;this.state=state;this.file=path.join(state,"config.json");this.fetcher=fetcher;this.runner=runner;
|
|
17
18
|
}
|
|
18
19
|
// Queue entries are identifiers, never filesystem paths. Only our marked stages qualify.
|
|
19
20
|
stageEntry(p){
|
|
@@ -30,7 +31,9 @@ export class PluginManager{
|
|
|
30
31
|
const lock=path.join(this.state,"plugins.lock");
|
|
31
32
|
try{await mkdir(lock,{mode:0o700})}catch(e){if(e.code==="ENOENT"||e.code==="EEXIST")return;throw e}
|
|
32
33
|
try{
|
|
33
|
-
|
|
34
|
+
let before;
|
|
35
|
+
try{before=await readFile(this.file,"utf8")}catch(e){if(e.code==="ENOENT")return;throw e}
|
|
36
|
+
const c=JSON.parse(before);
|
|
34
37
|
if(!Array.isArray(c.pendingPluginDeletes)||!Array.isArray(c.plugins))return;
|
|
35
38
|
const root=path.join(path.resolve(this.state),"managed-plugins");
|
|
36
39
|
const remaining=[];
|
|
@@ -94,9 +97,10 @@ export class PluginManager{
|
|
|
94
97
|
const root=path.join(this.state,"managed-plugins");
|
|
95
98
|
await mkdir(root,{recursive:true,mode:0o700});
|
|
96
99
|
if((await lstat(root)).isSymbolicLink()||await realpath(root)!==path.join(await realpath(this.state),"managed-plugins"))throw Error("managed-plugins must not be a symlink");
|
|
100
|
+
const bun=this.bun ?? await ensureBun(this.state,{fetcher:this.fetcher});
|
|
97
101
|
stage=await mkdtemp(path.join(root,"pkg-"));
|
|
98
102
|
await writeFile(path.join(stage,"package.json"),'{"private":true}',{mode:0o600});
|
|
99
|
-
await this.runner(
|
|
103
|
+
await this.runner(bun,["add","--exact","--ignore-scripts","--linker=hoisted","--no-progress","--registry=https://registry.npmjs.org",name+"@"+resolved],{cwd:stage,timeout:120000,maxBuffer:1024*1024,windowsHide:true});
|
|
100
104
|
const target=path.join(stage,"node_modules",name);
|
|
101
105
|
const installed=JSON.parse(await readFile(path.join(target,"package.json"),"utf8"));
|
|
102
106
|
if(installed.name!==name||installed.version!==resolved)throw Error("Installed package metadata does not match");
|
|
@@ -116,7 +120,7 @@ export class PluginManager{
|
|
|
116
120
|
const help="/magpie-plugins search QUERY | install PACKAGE[@EXACT_VERSION] | list | remove PACKAGE. Aliases: cursor/workbuddy. Searches community auth packages only; compatibility is not guaranteed.";
|
|
117
121
|
async function change(manager,ctx,action,input){
|
|
118
122
|
return manager.mutate(action,input,async()=>{
|
|
119
|
-
const ok=await ctx.ui.confirm(action+" "+input,"Third-party plugins run with your user permissions. Disabling
|
|
123
|
+
const ok=await ctx.ui.confirm(action+" "+input,"Third-party plugins run with your user permissions. Disabling install scripts does not sandbox runtime code. Removal preserves credentials; old managed directories are deleted on next startup (including versions replaced by updates). Continue?");
|
|
120
124
|
if(ok)ctx.ui.notify((action==="install"?"Installing":"Removing")+"…","info");
|
|
121
125
|
return ok;
|
|
122
126
|
});
|
|
@@ -170,7 +174,7 @@ export function registerPlugins(pi,state,dependencies={}){
|
|
|
170
174
|
else if(action==="list")result=JSON.stringify(await manager.list(),null,2);
|
|
171
175
|
else if(["install","remove"].includes(action)){
|
|
172
176
|
if(!ctx.hasUI)throw Error("Changes refused: explicit confirmation in an interactive UI is required");
|
|
173
|
-
result=await manager.mutate(action,input,name=>ctx.ui.confirm(action+" "+name,"Third-party plugins run with your user permissions. Disabling
|
|
177
|
+
result=await manager.mutate(action,input,name=>ctx.ui.confirm(action+" "+name,"Third-party plugins run with your user permissions. Disabling install scripts does not sandbox runtime code. Removal preserves credentials; old managed directories are deleted on next startup (including versions replaced by updates). Continue?"));
|
|
174
178
|
}else result="/magpie-plugins search QUERY | install PACKAGE[@EXACT_VERSION] | list | remove PACKAGE. Aliases: cursor/workbuddy. Searches community auth packages only; compatibility is not guaranteed.";
|
|
175
179
|
ctx.ui.notify(result,"info");
|
|
176
180
|
}catch(e){ctx.ui.notify(String(e),"error")}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// Shared by the Pi extension (index.ts) and the embedding API (embed.mjs): state/config handling,
|
|
2
|
+
// host startup and Pi provider definitions. Behavior must stay identical for both entry points.
|
|
3
|
+
import {readFile,mkdir,writeFile} from "node:fs/promises";
|
|
4
|
+
import {fileURLToPath} from "node:url";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import os from "node:os";
|
|
7
|
+
// The Pi extension loader exposes the compat entry, not the per-API subpaths.
|
|
8
|
+
import {openAICompletionsApi,anthropicMessagesApi} from "@earendil-works/pi-ai/compat";
|
|
9
|
+
import {Bridge} from "./bridge.mjs";
|
|
10
|
+
import {ensureBun} from "./bun.mjs";
|
|
11
|
+
import {supervisorPath} from "./platform.mjs";
|
|
12
|
+
|
|
13
|
+
export const packageRoot=fileURLToPath(new URL("..",import.meta.url));
|
|
14
|
+
|
|
15
|
+
export function defaultState(){
|
|
16
|
+
return process.env.MAGPIE_PI_STATE || path.join(os.homedir(),".local","share","magpie-pi");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Read config.json, creating a private empty one on first use. */
|
|
20
|
+
export async function loadConfig(state){
|
|
21
|
+
const configPath=path.join(state,"config.json");
|
|
22
|
+
let source;
|
|
23
|
+
try {source=await readFile(configPath,"utf8");}
|
|
24
|
+
catch(error){
|
|
25
|
+
if(error.code!=="ENOENT")throw error;
|
|
26
|
+
await mkdir(state,{recursive:true,mode:0o700});
|
|
27
|
+
try {await writeFile(configPath,JSON.stringify({plugins:[],accounts:{},opencode:{}},null,2)+"\n",{flag:"wx",mode:0o600});}
|
|
28
|
+
catch(error){if(error.code!=="EEXIST")throw error;}
|
|
29
|
+
source=await readFile(configPath,"utf8");
|
|
30
|
+
}
|
|
31
|
+
const config=JSON.parse(source);
|
|
32
|
+
if(!config||!Array.isArray(config.plugins))throw new Error(`magpie-pi: ${configPath} must contain a plugins array`);
|
|
33
|
+
return {config,configPath};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Start the plugin host for a non-empty config. Throws if the supervisor is unavailable. */
|
|
37
|
+
export async function startBridge(state,bun=undefined){
|
|
38
|
+
bun ??= await ensureBun(state);
|
|
39
|
+
return new Bridge(supervisorPath(packageRoot),path.join(packageRoot,"vendor","host.js"),state,bun);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Initialize the configured plugins and return Pi provider definitions (`registerProvider` input).
|
|
44
|
+
* Throws on plugin initialization errors; the caller closes the bridge.
|
|
45
|
+
*/
|
|
46
|
+
export async function createProviders(bridge,config,state){
|
|
47
|
+
const initialized=await bridge.call("init",{plugins:config.plugins,config:config.opencode || {},authPath:path.join(state,"plugin-auth.json"),directory:state});
|
|
48
|
+
for(const p of initialized.plugins)if(p.error)throw new Error(p.error);
|
|
49
|
+
const rows=await bridge.call("providers");
|
|
50
|
+
const completions=openAICompletionsApi();
|
|
51
|
+
const anthropic=anthropicMessagesApi();
|
|
52
|
+
return rows.map(initial=>{
|
|
53
|
+
let row=initial;
|
|
54
|
+
const id="magpie-"+row.id;
|
|
55
|
+
const models=()=>row.models.filter(m=>["@ai-sdk/openai-compatible","@ai-sdk/anthropic"].includes(m.npm)).map(m=>({
|
|
56
|
+
type:"chat",id:m.id,name:m.name||m.id,provider:id,
|
|
57
|
+
api:m.npm==="@ai-sdk/anthropic"?"anthropic-messages":"openai-completions",
|
|
58
|
+
baseUrl:m.url||row.api,reasoning:m.reasoning,input:m.image?["text","image"]:["text"],
|
|
59
|
+
cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:m.context||128000,maxTokens:m.output||8192
|
|
60
|
+
}));
|
|
61
|
+
const stream=simple=>(model,context,options={})=>{
|
|
62
|
+
const m=row.models.find(m=>m.id===model.id);
|
|
63
|
+
const api=model.api==="anthropic-messages"?anthropic:completions;
|
|
64
|
+
return api[simple?"streamSimple":"stream"]({...model,id:m.apiId||model.id},context,{...options,apiKey:"plugin-owned",fetch:bridge.fetch(row.id,config.accounts?.[row.id],m.npm,m.id)});
|
|
65
|
+
};
|
|
66
|
+
return {
|
|
67
|
+
id,name:row.name||row.id,
|
|
68
|
+
auth:{apiKey:{name:"Plugin-managed account",
|
|
69
|
+
resolve:async({credential})=>credential?.key==="plugin-owned"&&row.signedIn?{auth:{apiKey:"plugin-owned"}}:undefined,
|
|
70
|
+
login:async interaction=>{
|
|
71
|
+
const method=Number(await interaction.prompt({type:"select",message:"Sign-in method",options:row.methods.map((m,i)=>({id:String(i),label:m.label}))}));
|
|
72
|
+
const m=row.methods[method];let result;
|
|
73
|
+
const inputs={};
|
|
74
|
+
while(true){
|
|
75
|
+
const {prompt}=await bridge.call("prompt",{provider:row.id,method,inputs},interaction.signal);
|
|
76
|
+
if(!prompt)break;
|
|
77
|
+
const value=await interaction.prompt(prompt.type==="select"?{
|
|
78
|
+
type:"select",message:prompt.message,options:prompt.options.map(o=>({id:o.value,label:o.label,description:o.hint}))
|
|
79
|
+
}:{type:"secret",message:prompt.message,placeholder:prompt.placeholder});
|
|
80
|
+
const {error}=await bridge.call("validate",{provider:row.id,method,key:prompt.key,value},interaction.signal);
|
|
81
|
+
if(error){interaction.notify({type:"info",message:error});continue;}
|
|
82
|
+
inputs[prompt.key]=value;
|
|
83
|
+
}
|
|
84
|
+
if(m.type==="api"){
|
|
85
|
+
const key=m.keyless||m.keyAsked?"":await interaction.prompt({type:"secret",message:"API key"});
|
|
86
|
+
result=await bridge.call("apiKey",{provider:row.id,method,key,inputs},interaction.signal);
|
|
87
|
+
}else{
|
|
88
|
+
const a=await bridge.call("authorize",{provider:row.id,method,inputs},interaction.signal);
|
|
89
|
+
if(!a.ok)throw new Error(a.error||"Sign-in failed");
|
|
90
|
+
if(a.url)interaction.notify({type:"auth_url",url:a.url,instructions:a.instructions});
|
|
91
|
+
const code=a.method==="code"?await interaction.prompt({type:"manual_code",message:a.instructions||"Authorization code"}):undefined;
|
|
92
|
+
result=await bridge.call("callback",{session:a.session,code},interaction.signal);
|
|
93
|
+
}
|
|
94
|
+
if(!result.ok)throw new Error(result.error||"Sign-in failed");
|
|
95
|
+
row=(await bridge.call("providers")).find(r=>r.id===row.id);
|
|
96
|
+
return {type:"api_key",key:"plugin-owned"};
|
|
97
|
+
}}},
|
|
98
|
+
getModels:models,
|
|
99
|
+
refreshModels:async context=>{
|
|
100
|
+
if(!context.allowNetwork)return;
|
|
101
|
+
const next=(await bridge.call("providers",{},context.signal)).find(r=>r.id===row.id);
|
|
102
|
+
if(!next||next.fellBack)throw new Error(next?.listError||"Model discovery failed");
|
|
103
|
+
await context.publish({update:()=>{row=next}});
|
|
104
|
+
},
|
|
105
|
+
stream:stream(false),streamSimple:stream(true)
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "magpie-pi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Magpie community plugin integration for Pi",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"keywords": [
|
|
@@ -16,19 +16,33 @@
|
|
|
16
16
|
],
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
19
|
-
"url": "https://github.com/arklee/magpie-pi.git"
|
|
19
|
+
"url": "https://github.com/arklee/magpie-pi.git",
|
|
20
|
+
"directory": "packages/magpie-pi"
|
|
20
21
|
},
|
|
21
22
|
"type": "module",
|
|
23
|
+
"exports": {
|
|
24
|
+
"./embed": {
|
|
25
|
+
"types": "./extension/embed.d.ts",
|
|
26
|
+
"default": "./extension/embed.mjs"
|
|
27
|
+
},
|
|
28
|
+
"./extension/*": "./extension/*",
|
|
29
|
+
"./package.json": "./package.json"
|
|
30
|
+
},
|
|
22
31
|
"pi": {
|
|
23
32
|
"extensions": [
|
|
24
33
|
"./extension/index.ts"
|
|
25
34
|
]
|
|
26
35
|
},
|
|
27
36
|
"peerDependencies": {
|
|
28
|
-
"@earendil-works/pi-ai": "1.6.0",
|
|
29
|
-
"@earendil-works/pi-coding-agent": "1.6.0"
|
|
37
|
+
"@earendil-works/pi-ai": "~1.6.0",
|
|
38
|
+
"@earendil-works/pi-coding-agent": "~1.6.0"
|
|
30
39
|
},
|
|
31
40
|
"scripts": {
|
|
41
|
+
"build": "node scripts/build.mjs",
|
|
42
|
+
"build:all": "node scripts/build.mjs --all",
|
|
43
|
+
"verify:extraction": "node scripts/extraction.mjs",
|
|
44
|
+
"test:provider": "bun test tests/provider.test.ts",
|
|
45
|
+
"check": "npm run verify:extraction && npm run build && npm test && npm run test:provider && npm run typecheck && go vet ./... && go test ./...",
|
|
32
46
|
"test": "node --test tests/*.test.mjs",
|
|
33
47
|
"typecheck": "npm exec --yes --package typescript@7.0.2 -- tsc --noEmit --allowJs --skipLibCheck --module nodenext --moduleResolution nodenext --target es2022 extension/index.ts"
|
|
34
48
|
}
|