pi-clawbay 0.0.1
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 +138 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +290 -0
- package/dist/index.js.map +1 -0
- package/package.json +62 -0
package/README.md
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# TheClawBay Provider for Pi Coding Agent
|
|
2
|
+
|
|
3
|
+
A provider extension for [pi coding agent](https://github.com/badlogic/pi-mono) that enables access to GPT-5, Codex, and Claude models through [TheClawBay](https://theclawbay.com) API.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **GPT-5 & Codex Models** - Access via OpenAI-compatible Responses API
|
|
8
|
+
- **Claude Models** - Access via Anthropic-compatible Messages API
|
|
9
|
+
- **High Usage Headroom** - More capacity than standard subscriptions
|
|
10
|
+
- **Simple Setup** - Single API key for all models
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
### Option 1: Load extension directly
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pi -e /path/to/pi-clawbay
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Option 2: Install as dependency
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
cd your-project
|
|
24
|
+
npm install /path/to/pi-clawbay
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Then add to your `.pi/agent/AGENTS.md` or load via extension config.
|
|
28
|
+
|
|
29
|
+
## Configuration
|
|
30
|
+
|
|
31
|
+
### Environment Variable
|
|
32
|
+
|
|
33
|
+
Set your TheClawBay API key:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
export THECLAWBAY_API_KEY=your-api-key-here
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Get your API key from [TheClawBay Dashboard](https://theclawbay.com).
|
|
40
|
+
|
|
41
|
+
### Available Models
|
|
42
|
+
|
|
43
|
+
#### GPT/Codex Models (`theclawbay/*`)
|
|
44
|
+
|
|
45
|
+
| Model ID | Name | Description |
|
|
46
|
+
|----------|------|-------------|
|
|
47
|
+
| `gpt-5.4` | GPT-5.4 | Frontier coding model with widest headroom |
|
|
48
|
+
| `gpt-5.3-codex` | GPT-5.3 Codex | Strong daily-driver for heavier work |
|
|
49
|
+
| `gpt-5.2-codex` | GPT-5.2 Codex | Stable compatibility for older flows |
|
|
50
|
+
| `gpt-5.2` | GPT-5.2 | Balanced non-Codex option |
|
|
51
|
+
| `gpt-5.1-codex-max` | GPT-5.1 Codex Max | Higher-throughput for longer sessions |
|
|
52
|
+
| `gpt-5.1-codex-mini` | GPT-5.1 Codex Mini | Lower-cost for quick iterations |
|
|
53
|
+
|
|
54
|
+
#### Claude Models (`theclawbay-claude/*`)
|
|
55
|
+
|
|
56
|
+
| Model ID | Name | Description |
|
|
57
|
+
|----------|------|-------------|
|
|
58
|
+
| `claude-opus-4-6` | Claude Opus 4.6 | Most capable for complex tasks |
|
|
59
|
+
| `claude-sonnet-4-6` | Claude Sonnet 4.6 | Near-Opus at lower cost |
|
|
60
|
+
|
|
61
|
+
## Usage
|
|
62
|
+
|
|
63
|
+
### Select a Model
|
|
64
|
+
|
|
65
|
+
Use `/model` command in pi:
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
/model theclawbay/gpt-5.4
|
|
69
|
+
/model theclawbay-claude/claude-sonnet-4-6
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Programmatic Usage
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
76
|
+
|
|
77
|
+
export default function (pi: ExtensionAPI) {
|
|
78
|
+
// After loading this extension, models are available:
|
|
79
|
+
// - theclawbay/gpt-5.4
|
|
80
|
+
// - theclawbay/gpt-5.3-codex
|
|
81
|
+
// - theclawbay-claude/claude-opus-4-6
|
|
82
|
+
// - theclawbay-claude/claude-sonnet-4-6
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## API Reference
|
|
87
|
+
|
|
88
|
+
### Endpoints
|
|
89
|
+
|
|
90
|
+
| Provider | Base URL | API Type |
|
|
91
|
+
|----------|----------|----------|
|
|
92
|
+
| `theclawbay` | `https://api.theclawbay.com/v1` | OpenAI Responses |
|
|
93
|
+
| `theclawbay-claude` | `https://api.theclawbay.com/anthropic` | Anthropic Messages |
|
|
94
|
+
|
|
95
|
+
### Authentication
|
|
96
|
+
|
|
97
|
+
All requests use Bearer token authentication:
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
Authorization: Bearer THECLAWBAY_API_KEY
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Quota Checking
|
|
104
|
+
|
|
105
|
+
Check your current usage:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
curl "https://theclawbay.com/api/codex-auth/v1/quota" \
|
|
109
|
+
-H "Authorization: Bearer $THECLAWBAY_API_KEY"
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Error Handling
|
|
113
|
+
|
|
114
|
+
Common error codes:
|
|
115
|
+
|
|
116
|
+
| Code | Description |
|
|
117
|
+
|------|-------------|
|
|
118
|
+
| `weekly_cost_limit_reached` | Weekly spend cap hit |
|
|
119
|
+
| `5h_cost_limit_reached` | 5-hour spend cap hit |
|
|
120
|
+
| `invalid_api_key` | Key missing or malformed |
|
|
121
|
+
| `model_not_found` | Requested model unavailable |
|
|
122
|
+
|
|
123
|
+
## Building
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
npm install
|
|
127
|
+
npm run build
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Resources
|
|
131
|
+
|
|
132
|
+
- [TheClawBay Docs](https://theclawbay.com/docs)
|
|
133
|
+
- [TheClawBay Dashboard](https://theclawbay.com)
|
|
134
|
+
- [Pi Custom Provider Docs](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/docs/custom-provider.md)
|
|
135
|
+
|
|
136
|
+
## License
|
|
137
|
+
|
|
138
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TheClawBay Provider Extension for Pi Coding Agent
|
|
3
|
+
*
|
|
4
|
+
* Provides access to GPT-5, Codex, and Claude models through TheClawBay API.
|
|
5
|
+
* Uses two provider endpoints:
|
|
6
|
+
* - `theclawbay`: OpenAI-compatible endpoint for GPT/Codex models
|
|
7
|
+
* - `theclawbay-claude`: Anthropic-compatible endpoint for Claude models
|
|
8
|
+
*
|
|
9
|
+
* Features:
|
|
10
|
+
* - Shows quota usage in status line (only when using TheClawBay models)
|
|
11
|
+
* - /quota command to check detailed usage
|
|
12
|
+
*
|
|
13
|
+
* Usage:
|
|
14
|
+
* pi -e ./pi-clawbay
|
|
15
|
+
* # Then set THECLAWBAY_API_KEY=... or use /model to select a model
|
|
16
|
+
*
|
|
17
|
+
* Get your API key at: https://theclawbay.com
|
|
18
|
+
*/
|
|
19
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
20
|
+
/**
|
|
21
|
+
* Register TheClawBay providers with pi coding agent
|
|
22
|
+
*/
|
|
23
|
+
export default function (pi: ExtensionAPI): void;
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAyMlE;;GAEG;AACH,MAAM,CAAC,OAAO,WAAW,EAAE,EAAE,YAAY,QAqGxC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TheClawBay Provider Extension for Pi Coding Agent
|
|
3
|
+
*
|
|
4
|
+
* Provides access to GPT-5, Codex, and Claude models through TheClawBay API.
|
|
5
|
+
* Uses two provider endpoints:
|
|
6
|
+
* - `theclawbay`: OpenAI-compatible endpoint for GPT/Codex models
|
|
7
|
+
* - `theclawbay-claude`: Anthropic-compatible endpoint for Claude models
|
|
8
|
+
*
|
|
9
|
+
* Features:
|
|
10
|
+
* - Shows quota usage in status line (only when using TheClawBay models)
|
|
11
|
+
* - /quota command to check detailed usage
|
|
12
|
+
*
|
|
13
|
+
* Usage:
|
|
14
|
+
* pi -e ./pi-clawbay
|
|
15
|
+
* # Then set THECLAWBAY_API_KEY=... or use /model to select a model
|
|
16
|
+
*
|
|
17
|
+
* Get your API key at: https://theclawbay.com
|
|
18
|
+
*/
|
|
19
|
+
const THECLAWBAY_OPENAI_BASE_URL = "https://api.theclawbay.com/v1";
|
|
20
|
+
const THECLAWBAY_ANTHROPIC_BASE_URL = "https://api.theclawbay.com/anthropic";
|
|
21
|
+
const THECLAWBAY_QUOTA_URL = "https://theclawbay.com/api/codex-auth/v1/quota";
|
|
22
|
+
const THECLAWBAY_PROVIDERS = ["theclawbay", "theclawbay-claude"];
|
|
23
|
+
/**
|
|
24
|
+
* GPT and Codex models available through TheClawBay OpenAI-compatible endpoint
|
|
25
|
+
*/
|
|
26
|
+
const OPENAI_MODELS = [
|
|
27
|
+
{
|
|
28
|
+
id: "gpt-5.4",
|
|
29
|
+
name: "GPT-5.4",
|
|
30
|
+
description: "Frontier coding model with the widest headroom",
|
|
31
|
+
reasoning: true,
|
|
32
|
+
input: ["text", "image"],
|
|
33
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
34
|
+
contextWindow: 128000,
|
|
35
|
+
maxTokens: 16384,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: "gpt-5.3-codex",
|
|
39
|
+
name: "GPT-5.3 Codex",
|
|
40
|
+
description: "Strong daily-driver Codex model for heavier work",
|
|
41
|
+
reasoning: true,
|
|
42
|
+
input: ["text", "image"],
|
|
43
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
44
|
+
contextWindow: 128000,
|
|
45
|
+
maxTokens: 16384,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: "gpt-5.2-codex",
|
|
49
|
+
name: "GPT-5.2 Codex",
|
|
50
|
+
description: "Stable compatibility option for older Codex flows",
|
|
51
|
+
reasoning: true,
|
|
52
|
+
input: ["text", "image"],
|
|
53
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
54
|
+
contextWindow: 128000,
|
|
55
|
+
maxTokens: 16384,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: "gpt-5.2",
|
|
59
|
+
name: "GPT-5.2",
|
|
60
|
+
description: "Balanced GPT-5 path when you want a non-Codex option",
|
|
61
|
+
reasoning: true,
|
|
62
|
+
input: ["text", "image"],
|
|
63
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
64
|
+
contextWindow: 128000,
|
|
65
|
+
maxTokens: 16384,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: "gpt-5.1-codex-max",
|
|
69
|
+
name: "GPT-5.1 Codex Max",
|
|
70
|
+
description: "Higher-throughput option for longer coding sessions",
|
|
71
|
+
reasoning: true,
|
|
72
|
+
input: ["text", "image"],
|
|
73
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
74
|
+
contextWindow: 128000,
|
|
75
|
+
maxTokens: 16384,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
id: "gpt-5.1-codex-mini",
|
|
79
|
+
name: "GPT-5.1 Codex Mini",
|
|
80
|
+
description: "Lower-cost Codex path for quick iterations",
|
|
81
|
+
reasoning: true,
|
|
82
|
+
input: ["text", "image"],
|
|
83
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
84
|
+
contextWindow: 128000,
|
|
85
|
+
maxTokens: 16384,
|
|
86
|
+
},
|
|
87
|
+
];
|
|
88
|
+
/**
|
|
89
|
+
* Claude models available through TheClawBay Anthropic-compatible endpoint
|
|
90
|
+
*/
|
|
91
|
+
const ANTHROPIC_MODELS = [
|
|
92
|
+
{
|
|
93
|
+
id: "claude-opus-4-6",
|
|
94
|
+
name: "Claude Opus 4.6",
|
|
95
|
+
description: "Anthropic's most capable model for complex tasks",
|
|
96
|
+
reasoning: true,
|
|
97
|
+
input: ["text", "image"],
|
|
98
|
+
cost: { input: 5.0, output: 25.0, cacheRead: 0.5, cacheWrite: 6.25 },
|
|
99
|
+
contextWindow: 200000,
|
|
100
|
+
maxTokens: 32000,
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
id: "claude-sonnet-4-6",
|
|
104
|
+
name: "Claude Sonnet 4.6",
|
|
105
|
+
description: "Near-Opus intelligence at a fraction of the cost",
|
|
106
|
+
reasoning: true,
|
|
107
|
+
input: ["text", "image"],
|
|
108
|
+
cost: { input: 3.0, output: 15.0, cacheRead: 0.3, cacheWrite: 3.75 },
|
|
109
|
+
contextWindow: 200000,
|
|
110
|
+
maxTokens: 16384,
|
|
111
|
+
},
|
|
112
|
+
];
|
|
113
|
+
/**
|
|
114
|
+
* Fetch quota information from TheClawBay API
|
|
115
|
+
*/
|
|
116
|
+
async function fetchQuota(apiKey) {
|
|
117
|
+
try {
|
|
118
|
+
const response = await fetch(THECLAWBAY_QUOTA_URL, {
|
|
119
|
+
headers: {
|
|
120
|
+
Authorization: `Bearer ${apiKey}`,
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
if (!response.ok) {
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
return (await response.json());
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function getQuotaWindows(quota) {
|
|
133
|
+
return {
|
|
134
|
+
fiveHour: quota.usage?.fiveHour,
|
|
135
|
+
weekly: quota.usage?.weekly,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Format percentage with color based on usage level
|
|
140
|
+
*/
|
|
141
|
+
function formatPercent(percent) {
|
|
142
|
+
const digits = percent >= 10 ? 0 : percent >= 1 ? 1 : percent >= 0.1 ? 2 : 3;
|
|
143
|
+
if (percent >= 90) {
|
|
144
|
+
return { text: `${percent.toFixed(digits)}%`, color: "error" };
|
|
145
|
+
}
|
|
146
|
+
if (percent >= 70) {
|
|
147
|
+
return { text: `${percent.toFixed(digits)}%`, color: "warning" };
|
|
148
|
+
}
|
|
149
|
+
return { text: `${percent.toFixed(digits)}%`, color: "dim" };
|
|
150
|
+
}
|
|
151
|
+
function formatDuration(seconds) {
|
|
152
|
+
if (seconds === undefined) {
|
|
153
|
+
return "unknown";
|
|
154
|
+
}
|
|
155
|
+
const totalSeconds = Math.max(0, Math.floor(seconds));
|
|
156
|
+
const hours = Math.floor(totalSeconds / 3600);
|
|
157
|
+
const minutes = Math.floor((totalSeconds % 3600) / 60);
|
|
158
|
+
const secs = totalSeconds % 60;
|
|
159
|
+
if (hours > 0) {
|
|
160
|
+
return `${hours}h ${minutes}m`;
|
|
161
|
+
}
|
|
162
|
+
if (minutes > 0) {
|
|
163
|
+
return `${minutes}m ${secs}s`;
|
|
164
|
+
}
|
|
165
|
+
return `${secs}s`;
|
|
166
|
+
}
|
|
167
|
+
function formatQuotaDetails(label, window) {
|
|
168
|
+
if (!window) {
|
|
169
|
+
return `${label}: N/A`;
|
|
170
|
+
}
|
|
171
|
+
const percent = formatPercent(window.percentUsed).text;
|
|
172
|
+
const costUsed = window.estimatedCostUsdUsed;
|
|
173
|
+
const costLimit = window.costUsdLimit;
|
|
174
|
+
const hasUsd = typeof costUsed === "number" && typeof costLimit === "number";
|
|
175
|
+
const usage = hasUsd
|
|
176
|
+
? `${percent} ($${costUsed.toFixed(2)}/$${costLimit.toFixed(2)})`
|
|
177
|
+
: percent;
|
|
178
|
+
return `${label}: ${usage} • ${window.requestCount ?? 0} req • resets ${formatDuration(window.secondsUntilReset)}`;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Register TheClawBay providers with pi coding agent
|
|
182
|
+
*/
|
|
183
|
+
export default function (pi) {
|
|
184
|
+
const apiKey = process.env.THECLAWBAY_API_KEY;
|
|
185
|
+
if (!apiKey) {
|
|
186
|
+
console.warn("\x1b[33m⚠️ TheClawBay API key not set.\x1b[0m\n" +
|
|
187
|
+
" Set THECLAWBAY_API_KEY environment variable:\n" +
|
|
188
|
+
" export THECLAWBAY_API_KEY=your-key-here\n" +
|
|
189
|
+
" Get your key at: https://theclawbay.com\n");
|
|
190
|
+
}
|
|
191
|
+
pi.registerProvider("theclawbay", {
|
|
192
|
+
baseUrl: THECLAWBAY_OPENAI_BASE_URL,
|
|
193
|
+
apiKey: "THECLAWBAY_API_KEY",
|
|
194
|
+
api: "openai-responses",
|
|
195
|
+
authHeader: true,
|
|
196
|
+
models: OPENAI_MODELS.map((m) => ({
|
|
197
|
+
id: m.id,
|
|
198
|
+
name: m.name,
|
|
199
|
+
reasoning: m.reasoning,
|
|
200
|
+
input: [...m.input],
|
|
201
|
+
cost: m.cost,
|
|
202
|
+
contextWindow: m.contextWindow,
|
|
203
|
+
maxTokens: m.maxTokens,
|
|
204
|
+
})),
|
|
205
|
+
});
|
|
206
|
+
pi.registerProvider("theclawbay-claude", {
|
|
207
|
+
baseUrl: THECLAWBAY_ANTHROPIC_BASE_URL,
|
|
208
|
+
apiKey: "THECLAWBAY_API_KEY",
|
|
209
|
+
api: "anthropic-messages",
|
|
210
|
+
authHeader: true,
|
|
211
|
+
models: ANTHROPIC_MODELS.map((m) => ({
|
|
212
|
+
id: m.id,
|
|
213
|
+
name: m.name,
|
|
214
|
+
reasoning: m.reasoning,
|
|
215
|
+
input: [...m.input],
|
|
216
|
+
cost: m.cost,
|
|
217
|
+
contextWindow: m.contextWindow,
|
|
218
|
+
maxTokens: m.maxTokens,
|
|
219
|
+
})),
|
|
220
|
+
});
|
|
221
|
+
if (!apiKey) {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
let usingTheClawBay = false;
|
|
225
|
+
pi.on("model_select", async (event, ctx) => {
|
|
226
|
+
usingTheClawBay = THECLAWBAY_PROVIDERS.includes(event.model.provider);
|
|
227
|
+
if (!usingTheClawBay) {
|
|
228
|
+
ctx.ui.setStatus("theclawbay-quota", undefined);
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
const quota = await fetchQuota(apiKey);
|
|
232
|
+
if (quota) {
|
|
233
|
+
updateQuotaStatus(ctx, quota, true);
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
pi.on("turn_end", async (_event, ctx) => {
|
|
237
|
+
if (!usingTheClawBay) {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
const quota = await fetchQuota(apiKey);
|
|
241
|
+
if (quota) {
|
|
242
|
+
updateQuotaStatus(ctx, quota, true);
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
const showQuota = async (ctx) => {
|
|
246
|
+
const quota = await fetchQuota(apiKey);
|
|
247
|
+
if (!quota) {
|
|
248
|
+
ctx.ui.notify("Failed to fetch quota from TheClawBay", "error");
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
updateQuotaStatus(ctx, quota, true);
|
|
252
|
+
const { fiveHour, weekly } = getQuotaWindows(quota);
|
|
253
|
+
ctx.ui.notify(`${formatQuotaDetails("5h", fiveHour)} | ${formatQuotaDetails("Week", weekly)}`, "info");
|
|
254
|
+
};
|
|
255
|
+
pi.registerCommand("quota", {
|
|
256
|
+
description: "Check TheClawBay quota usage",
|
|
257
|
+
handler: async (_args, ctx) => {
|
|
258
|
+
await showQuota(ctx);
|
|
259
|
+
},
|
|
260
|
+
});
|
|
261
|
+
pi.registerCommand("quotas", {
|
|
262
|
+
description: "Check TheClawBay quota usage",
|
|
263
|
+
handler: async (_args, ctx) => {
|
|
264
|
+
await showQuota(ctx);
|
|
265
|
+
},
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Update quota status in the status line
|
|
270
|
+
*/
|
|
271
|
+
function updateQuotaStatus(ctx, quota, force = false) {
|
|
272
|
+
const theme = ctx.ui.theme;
|
|
273
|
+
const { fiveHour, weekly } = getQuotaWindows(quota);
|
|
274
|
+
const parts = [];
|
|
275
|
+
if (fiveHour) {
|
|
276
|
+
const five = formatPercent(fiveHour.percentUsed);
|
|
277
|
+
parts.push(theme.fg(five.color, `5h:${five.text}`));
|
|
278
|
+
}
|
|
279
|
+
if (weekly) {
|
|
280
|
+
const week = formatPercent(weekly.percentUsed);
|
|
281
|
+
parts.push(theme.fg(week.color, `w:${week.text}`));
|
|
282
|
+
}
|
|
283
|
+
if (parts.length > 0) {
|
|
284
|
+
ctx.ui.setStatus("theclawbay-quota", parts.join(" "));
|
|
285
|
+
}
|
|
286
|
+
else if (force) {
|
|
287
|
+
ctx.ui.setStatus("theclawbay-quota", theme.fg("dim", "Quota: N/A"));
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,MAAM,0BAA0B,GAAG,+BAA+B,CAAC;AACnE,MAAM,6BAA6B,GAAG,sCAAsC,CAAC;AAC7E,MAAM,oBAAoB,GAAG,gDAAgD,CAAC;AAE9E,MAAM,oBAAoB,GAAG,CAAC,YAAY,EAAE,mBAAmB,CAAC,CAAC;AAEjE;;GAEG;AACH,MAAM,aAAa,GAAG;IACrB;QACC,EAAE,EAAE,SAAS;QACb,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,gDAAgD;QAC7D,SAAS,EAAE,IAAI;QACf,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,CAAU;QACjC,IAAI,EAAE,EAAE,KAAK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AAE,MAAM,EAAE,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;IACpD,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,IAAI,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,GAAG,aAAa,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACjD,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACrD,CAAC;IAED,IAAI,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,GAAG,aAAa,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAC/C,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,kBAAkB,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACvD,CAAC;SAAM,IAAI,KAAK,EAAE,CAAC;QAClB,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC;IACrE,CAAC;AACF,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pi-clawbay",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "TheClawBay provider extension for Pi Coding Agent - access GPT-5, Codex, and Claude models",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"clean": "rm -rf dist",
|
|
20
|
+
"build": "npm run clean && tsc",
|
|
21
|
+
"check": "tsc --noEmit",
|
|
22
|
+
"prepublishOnly": "npm run build"
|
|
23
|
+
},
|
|
24
|
+
"pi": {
|
|
25
|
+
"extensions": [
|
|
26
|
+
"dist/index.js"
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
"keywords": [
|
|
30
|
+
"pi",
|
|
31
|
+
"pi-coding-agent",
|
|
32
|
+
"theclawbay",
|
|
33
|
+
"gpt-5",
|
|
34
|
+
"codex",
|
|
35
|
+
"claude",
|
|
36
|
+
"ai",
|
|
37
|
+
"llm",
|
|
38
|
+
"provider"
|
|
39
|
+
],
|
|
40
|
+
"author": "Chris Lopez",
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "git+https://github.com/chrislopez24/pi-clawbay.git"
|
|
45
|
+
},
|
|
46
|
+
"bugs": {
|
|
47
|
+
"url": "https://github.com/chrislopez24/pi-clawbay/issues"
|
|
48
|
+
},
|
|
49
|
+
"homepage": "https://github.com/chrislopez24/pi-clawbay#readme",
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@types/node": "^22.0.0",
|
|
52
|
+
"typescript": "^5.0.0"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"@mariozechner/pi-coding-agent": ">=0.64.0"
|
|
56
|
+
},
|
|
57
|
+
"peerDependenciesMeta": {
|
|
58
|
+
"@mariozechner/pi-coding-agent": {
|
|
59
|
+
"optional": true
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|