@neilurk12/pi-pioneer 0.1.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 +40 -0
- package/dist/index.js +59 -0
- package/package.json +42 -0
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# pi-pioneer
|
|
2
|
+
|
|
3
|
+
Pioneer AI model provider extension for pi coding agent.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pi extension install @neilurk12/pi-pioneer
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Setup
|
|
12
|
+
|
|
13
|
+
Get an API key from Pioneer AI, then choose one of the following methods:
|
|
14
|
+
|
|
15
|
+
### Config file (recommended)
|
|
16
|
+
|
|
17
|
+
Create `~/.config/pi-pioneer/config.json`:
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"apiKey": "your-api-key"
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Environment variable
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
export PIONEER_API_KEY="your-api-key"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
If both are set, the environment variable takes precedence.
|
|
32
|
+
|
|
33
|
+
## Available Models
|
|
34
|
+
|
|
35
|
+
Models are fetched dynamically from the Pioneer AI API. Example models include:
|
|
36
|
+
- XiaomiMiMo/MiMo-V2.5-Pro
|
|
37
|
+
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
Select a Pioneer AI model in pi with `/model` command.
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import { readFileSync } from "fs";
|
|
3
|
+
import { homedir } from "os";
|
|
4
|
+
import { join } from "path";
|
|
5
|
+
var PROVIDER_NAME = "pioneer";
|
|
6
|
+
var BASE_URL = "https://api.pioneer.ai/v1";
|
|
7
|
+
var MODELS_ENDPOINT = `${BASE_URL}/models`;
|
|
8
|
+
async function fetchModels(apiKey) {
|
|
9
|
+
const res = await fetch(MODELS_ENDPOINT, {
|
|
10
|
+
headers: { Authorization: `Bearer ${apiKey}` }
|
|
11
|
+
});
|
|
12
|
+
if (!res.ok) throw new Error(`Failed to fetch models: ${res.status}`);
|
|
13
|
+
const data = await res.json();
|
|
14
|
+
return data.data ?? data;
|
|
15
|
+
}
|
|
16
|
+
function resolveApiKey() {
|
|
17
|
+
if (process.env.PIONEER_API_KEY) return process.env.PIONEER_API_KEY;
|
|
18
|
+
try {
|
|
19
|
+
const configPath = join(homedir(), ".config", "pi-pioneer", "config.json");
|
|
20
|
+
const config = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
21
|
+
return config.apiKey;
|
|
22
|
+
} catch {
|
|
23
|
+
return void 0;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
async function index_default(pi) {
|
|
27
|
+
const apiKey = resolveApiKey();
|
|
28
|
+
if (!apiKey) {
|
|
29
|
+
console.error(
|
|
30
|
+
'[pi-pioneer] No API key found. Set PIONEER_API_KEY or create ~/.config/pi-pioneer/config.json with { "apiKey": "..." }'
|
|
31
|
+
);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
let pioneerModels;
|
|
35
|
+
try {
|
|
36
|
+
pioneerModels = await fetchModels(apiKey);
|
|
37
|
+
} catch (err) {
|
|
38
|
+
console.error("[pi-pioneer] Failed to fetch models:", err);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
pi.registerProvider(PROVIDER_NAME, {
|
|
42
|
+
name: "Pioneer AI",
|
|
43
|
+
baseUrl: BASE_URL,
|
|
44
|
+
apiKey,
|
|
45
|
+
api: "openai-completions",
|
|
46
|
+
models: pioneerModels.map((m) => ({
|
|
47
|
+
id: m.id,
|
|
48
|
+
name: m.name ?? m.id,
|
|
49
|
+
reasoning: m.reasoning ?? true,
|
|
50
|
+
input: m.attachments ? ["text", "image"] : ["text"],
|
|
51
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
52
|
+
contextWindow: m.context_window ?? 128e3,
|
|
53
|
+
maxTokens: m.max_tokens ?? 8192
|
|
54
|
+
}))
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
index_default as default
|
|
59
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@neilurk12/pi-pioneer",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Pioneer AI model provider extension for pi coding agent",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"pi-package",
|
|
8
|
+
"pi-extension",
|
|
9
|
+
"provider",
|
|
10
|
+
"pioneer"
|
|
11
|
+
],
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/Neil-urk12/pi-dots.git"
|
|
15
|
+
},
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"README.md"
|
|
20
|
+
],
|
|
21
|
+
"main": "./dist/index.js",
|
|
22
|
+
"module": "./dist/index.js",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": "./dist/index.js"
|
|
25
|
+
},
|
|
26
|
+
"pi": {
|
|
27
|
+
"extensions": [
|
|
28
|
+
"./dist/index.js"
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsup",
|
|
33
|
+
"dev": "tsup --watch"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"@earendil-works/pi-coding-agent": "*"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"tsup": "^8.5.1",
|
|
40
|
+
"typescript": "^6.0.3"
|
|
41
|
+
}
|
|
42
|
+
}
|