pi-coralbricks-provider 1.0.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/models.json ADDED
@@ -0,0 +1,133 @@
1
+ [
2
+ {
3
+ "id": "glm-5.2-fp4",
4
+ "name": "GLM 5.2 FP4",
5
+ "reasoning": true,
6
+ "input": [
7
+ "text"
8
+ ],
9
+ "cost": {
10
+ "input": 1.12,
11
+ "output": 4.4,
12
+ "cacheRead": 0,
13
+ "cacheWrite": 0
14
+ },
15
+ "contextWindow": 1048576,
16
+ "maxTokens": 131072,
17
+ "thinkingLevelMap": {
18
+ "off": "none",
19
+ "minimal": null,
20
+ "low": null,
21
+ "medium": null,
22
+ "high": "high",
23
+ "xhigh": null,
24
+ "max": "max"
25
+ },
26
+ "compat": {
27
+ "supportsStore": false,
28
+ "supportsDeveloperRole": false,
29
+ "supportsReasoningEffort": true,
30
+ "maxTokensField": "max_tokens",
31
+ "thinkingFormat": "zai"
32
+ }
33
+ },
34
+ {
35
+ "id": "glm-5.3-fp4",
36
+ "name": "GLM 5.3 FP4",
37
+ "reasoning": true,
38
+ "input": [
39
+ "text"
40
+ ],
41
+ "cost": {
42
+ "input": 1.12,
43
+ "output": 4.4,
44
+ "cacheRead": 0,
45
+ "cacheWrite": 0
46
+ },
47
+ "contextWindow": 1048576,
48
+ "maxTokens": 131072,
49
+ "thinkingLevelMap": {
50
+ "off": "none",
51
+ "minimal": null,
52
+ "low": "low",
53
+ "medium": null,
54
+ "high": "high",
55
+ "xhigh": null,
56
+ "max": "max"
57
+ },
58
+ "compat": {
59
+ "supportsStore": false,
60
+ "supportsDeveloperRole": false,
61
+ "supportsReasoningEffort": true,
62
+ "maxTokensField": "max_tokens",
63
+ "thinkingFormat": "zai"
64
+ }
65
+ },
66
+ {
67
+ "id": "gpt-oss-120b",
68
+ "name": "GPT-OSS 120B",
69
+ "reasoning": true,
70
+ "input": [
71
+ "text"
72
+ ],
73
+ "cost": {
74
+ "input": 0.12,
75
+ "output": 0.6,
76
+ "cacheRead": 0,
77
+ "cacheWrite": 0
78
+ },
79
+ "contextWindow": 131072,
80
+ "maxTokens": 40960,
81
+ "thinkingLevelMap": {
82
+ "off": null,
83
+ "minimal": null,
84
+ "low": "low",
85
+ "medium": "medium",
86
+ "high": "high",
87
+ "xhigh": null,
88
+ "max": null
89
+ },
90
+ "compat": {
91
+ "supportsStore": false,
92
+ "supportsDeveloperRole": false,
93
+ "supportsReasoningEffort": true,
94
+ "maxTokensField": "max_tokens",
95
+ "thinkingFormat": "openai"
96
+ }
97
+ },
98
+ {
99
+ "id": "kimi-k3",
100
+ "name": "Kimi K3",
101
+ "reasoning": true,
102
+ "input": [
103
+ "text",
104
+ "image"
105
+ ],
106
+ "cost": {
107
+ "input": 3,
108
+ "output": 15,
109
+ "cacheRead": 0,
110
+ "cacheWrite": 0
111
+ },
112
+ "contextWindow": 1048576,
113
+ "maxTokens": 131072,
114
+ "thinkingLevelMap": {
115
+ "off": null,
116
+ "minimal": null,
117
+ "low": "low",
118
+ "medium": null,
119
+ "high": "high",
120
+ "xhigh": null,
121
+ "max": "max"
122
+ },
123
+ "compat": {
124
+ "supportsStore": false,
125
+ "supportsDeveloperRole": false,
126
+ "supportsReasoningEffort": true,
127
+ "maxTokensField": "max_tokens",
128
+ "supportsStrictMode": false,
129
+ "thinkingFormat": "openai",
130
+ "requiresReasoningContentOnAssistantMessages": true
131
+ }
132
+ }
133
+ ]
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "pi-coralbricks-provider",
3
+ "version": "1.0.0",
4
+ "description": "CoralBricks provider extension for pi - Access GLM 5.2/5.3, Kimi K3, and GPT-OSS 120B through the Coral Inference API",
5
+ "author": "monotykamary",
6
+ "homepage": "https://github.com/monotykamary/pi-coralbricks-provider#readme",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/monotykamary/pi-coralbricks-provider.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/monotykamary/pi-coralbricks-provider/issues"
13
+ },
14
+ "type": "module",
15
+ "main": "index.ts",
16
+ "scripts": {
17
+ "clean": "echo 'nothing to clean'",
18
+ "build": "echo 'nothing to build'",
19
+ "check": "tsc --noEmit && vitest run",
20
+ "test": "vitest run",
21
+ "update-models": "node scripts/update-models.js"
22
+ },
23
+ "keywords": [
24
+ "pi",
25
+ "extension",
26
+ "provider",
27
+ "coralbricks",
28
+ "coral",
29
+ "ai",
30
+ "llm",
31
+ "glm",
32
+ "kimi",
33
+ "gpt-oss"
34
+ ],
35
+ "license": "MIT",
36
+ "files": [
37
+ "index.ts",
38
+ "models.json",
39
+ "deprecated-models.json",
40
+ "custom-models.json",
41
+ "patch.json",
42
+ "scripts/update-models.js",
43
+ "scripts/probe-stream-fix.ts",
44
+ "README.md",
45
+ "LICENSE"
46
+ ],
47
+ "devDependencies": {
48
+ "@earendil-works/pi-ai": "0.84.4",
49
+ "@earendil-works/pi-coding-agent": "0.84.4",
50
+ "@types/node": "^22.20.0",
51
+ "typescript": "6.0.3",
52
+ "vitest": "4.1.7"
53
+ },
54
+ "pi": {
55
+ "extensions": [
56
+ "./index.ts"
57
+ ]
58
+ }
59
+ }
package/patch.json ADDED
@@ -0,0 +1 @@
1
+ {}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Live probe: stream gpt-oss-120b through streamCoral (the extension's
3
+ * streamSimple path) and verify the tool-call index bug is repaired — the
4
+ * accumulated message must contain exactly one complete tool call.
5
+ */
6
+ import { streamCoral } from "../index.ts";
7
+ import modelsData from "../models.json" with { type: "json" };
8
+
9
+ const apiKey = process.env.CORALBRICKS_API_KEY;
10
+ if (!apiKey) throw new Error("CORALBRICKS_API_KEY not set");
11
+
12
+ const modelId = process.argv[2] ?? "gpt-oss-120b";
13
+ const model = {
14
+ ...(modelsData as any[]).find((m) => m.id === modelId)!,
15
+ provider: "coralbricks",
16
+ baseUrl: "https://inference.coralbricks.ai/v1",
17
+ api: "openai-completions",
18
+ };
19
+
20
+ const context = {
21
+ systemPrompt: "You are a helpful assistant.",
22
+ messages: [
23
+ { role: "user", content: [{ type: "text", text: "What is the weather in Paris? Use the tool." }] },
24
+ ],
25
+ tools: [
26
+ {
27
+ name: "get_weather",
28
+ description: "Get current weather for a location",
29
+ parameters: {
30
+ type: "object",
31
+ properties: { location: { type: "string", description: "City name" } },
32
+ required: ["location"],
33
+ } as any,
34
+ },
35
+ ],
36
+ };
37
+
38
+ const events = streamCoral(model, context, { apiKey, reasoning: "high" } as any);
39
+ let finalMessage: any = null;
40
+ for await (const event of events) {
41
+ if (event.type === "done") finalMessage = event.message;
42
+ if (event.type === "error") finalMessage = event.error;
43
+ }
44
+
45
+ if (!finalMessage) throw new Error("no final message");
46
+ if (finalMessage.stopReason === "error") {
47
+ throw new Error("stream error: " + finalMessage.errorMessage);
48
+ }
49
+
50
+ const calls = (finalMessage.content ?? []).filter((c: any) => c.type === "toolCall");
51
+ console.log("stopReason:", finalMessage.stopReason);
52
+ console.log("toolCalls:", calls.length);
53
+ for (const call of calls) {
54
+ console.log(" -", call.name, JSON.stringify(call.arguments));
55
+ }
56
+
57
+ if (calls.length !== 1) throw new Error(`expected exactly 1 tool call, got ${calls.length}`);
58
+ const args = typeof calls[0].arguments === "string" ? JSON.parse(calls[0].arguments) : calls[0].arguments;
59
+ if (!args.location || !/paris/i.test(String(args.location))) {
60
+ throw new Error("arguments malformed: " + JSON.stringify(calls[0].arguments));
61
+ }
62
+ console.log("PASS: streamCoral produced exactly one complete tool call");