chutes-plugin 0.1.7 → 0.1.8

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.
Files changed (71) hide show
  1. package/dist/cli/doctor.d.ts +2 -0
  2. package/dist/cli/doctor.d.ts.map +1 -0
  3. package/dist/cli/doctor.js +63 -0
  4. package/dist/cli/doctor.js.map +1 -0
  5. package/dist/cli/index.d.ts +2 -0
  6. package/dist/cli/index.d.ts.map +1 -0
  7. package/dist/cli/index.js +21 -288
  8. package/dist/cli/index.js.map +1 -0
  9. package/dist/cli/install.d.ts +2 -0
  10. package/dist/cli/install.d.ts.map +1 -0
  11. package/dist/cli/install.js +33 -0
  12. package/dist/cli/install.js.map +1 -0
  13. package/dist/cli/list.d.ts +2 -0
  14. package/dist/cli/list.d.ts.map +1 -0
  15. package/dist/cli/list.js +36 -0
  16. package/dist/cli/list.js.map +1 -0
  17. package/dist/cli/refresh.d.ts +2 -0
  18. package/dist/cli/refresh.d.ts.map +1 -0
  19. package/dist/cli/refresh.js +27 -0
  20. package/dist/cli/refresh.js.map +1 -0
  21. package/dist/cli/status.d.ts +2 -0
  22. package/dist/cli/status.d.ts.map +1 -0
  23. package/dist/cli/status.js +38 -0
  24. package/dist/cli/status.js.map +1 -0
  25. package/dist/config/auth.d.ts +12 -0
  26. package/dist/config/auth.d.ts.map +1 -0
  27. package/dist/config/auth.js +24 -0
  28. package/dist/config/auth.js.map +1 -0
  29. package/dist/config/index.d.ts +4 -0
  30. package/dist/config/index.d.ts.map +1 -0
  31. package/dist/config/index.js +3 -0
  32. package/dist/config/index.js.map +1 -0
  33. package/dist/config/schema.d.ts +18 -0
  34. package/dist/config/schema.d.ts.map +1 -0
  35. package/dist/config/schema.js +61 -0
  36. package/dist/config/schema.js.map +1 -0
  37. package/dist/index.d.ts +4 -15
  38. package/dist/index.d.ts.map +1 -0
  39. package/dist/index.js +120 -12933
  40. package/dist/index.js.map +1 -0
  41. package/dist/models/cache.d.ts +20 -0
  42. package/dist/models/cache.d.ts.map +1 -0
  43. package/dist/models/cache.js +56 -0
  44. package/dist/models/cache.js.map +1 -0
  45. package/dist/models/fetcher.d.ts +38 -0
  46. package/dist/models/fetcher.d.ts.map +1 -0
  47. package/dist/models/fetcher.js +139 -0
  48. package/dist/models/fetcher.js.map +1 -0
  49. package/dist/models/index.d.ts +6 -0
  50. package/dist/models/index.d.ts.map +1 -0
  51. package/dist/models/index.js +5 -0
  52. package/dist/models/index.js.map +1 -0
  53. package/dist/models/registry.d.ts +25 -0
  54. package/dist/models/registry.d.ts.map +1 -0
  55. package/dist/models/registry.js +91 -0
  56. package/dist/models/registry.js.map +1 -0
  57. package/dist/models/types.d.ts +70 -0
  58. package/dist/models/types.d.ts.map +1 -0
  59. package/dist/models/types.js +19 -0
  60. package/dist/models/types.js.map +1 -0
  61. package/dist/tools/index.d.ts +26 -0
  62. package/dist/tools/index.d.ts.map +1 -0
  63. package/dist/tools/index.js +117 -0
  64. package/dist/tools/index.js.map +1 -0
  65. package/package.json +9 -9
  66. package/src/cli/doctor.ts +0 -80
  67. package/src/cli/index.ts +0 -58
  68. package/src/cli/install.ts +0 -37
  69. package/src/cli/list.ts +0 -50
  70. package/src/cli/refresh.ts +0 -31
  71. package/src/cli/status.ts +0 -42
@@ -0,0 +1,2 @@
1
+ export declare function doctor(): Promise<void>;
2
+ //# sourceMappingURL=doctor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/cli/doctor.ts"],"names":[],"mappings":"AAGA,wBAAsB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CA4E5C"}
@@ -0,0 +1,63 @@
1
+ import * as fs from 'node:fs';
2
+ import * as path from 'node:path';
3
+ export async function doctor() {
4
+ console.log('🐍 chutes-plugin doctor\n');
5
+ console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n');
6
+ let checks = 0;
7
+ let passed = 0;
8
+ function check(name, result, message) {
9
+ checks++;
10
+ if (result) {
11
+ passed++;
12
+ console.log(`✅ ${name}`);
13
+ }
14
+ else {
15
+ console.log(`❌ ${name}`);
16
+ console.log(` ${message}`);
17
+ }
18
+ }
19
+ const projectDir = process.cwd();
20
+ const pluginFile = path.join(projectDir, '.opencode', 'plugin', 'chutes-plugin.js');
21
+ const hasPlugin = fs.existsSync(pluginFile);
22
+ console.log('Installation Checks:\n');
23
+ check('Plugin installed', hasPlugin, hasPlugin ? `Location: ${pluginFile}` : 'Run: bunx chutes-plugin install');
24
+ console.log('\nAPI Checks:\n');
25
+ const homeDir = process.env.HOME || process.env.USERPROFILE;
26
+ const authPath = homeDir ? path.join(homeDir, '.local', 'share', 'opencode', 'auth.json') : null;
27
+ let hasAuth = false;
28
+ if (authPath && fs.existsSync(authPath)) {
29
+ try {
30
+ const content = fs.readFileSync(authPath, 'utf-8');
31
+ const auth = JSON.parse(content);
32
+ hasAuth = !!(auth.chutes || auth.CHUTES_API_TOKEN || auth.chutes_api_token);
33
+ }
34
+ catch {
35
+ hasAuth = false;
36
+ }
37
+ }
38
+ check('API token connected', hasAuth, 'Run: opencode, then type: /connect chutes');
39
+ console.log('\nNetwork Checks:\n');
40
+ try {
41
+ const response = await fetch('https://llm.chutes.ai/v1/models', {
42
+ method: 'GET',
43
+ headers: { 'Content-Type': 'application/json' },
44
+ });
45
+ check('Can reach Chutes API', response.ok, `HTTP ${response.status}: ${response.statusText}`);
46
+ if (response.ok) {
47
+ const data = (await response.json());
48
+ console.log(` Found ${data.data?.length || 0} models available\n`);
49
+ }
50
+ }
51
+ catch (error) {
52
+ check('Can reach Chutes API', false, `Connection failed: ${error instanceof Error ? error.message : String(error)}`);
53
+ }
54
+ console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n');
55
+ console.log(`Results: ${passed}/${checks} checks passed\n`);
56
+ if (passed === checks) {
57
+ console.log("🎉 Everything looks good! You're ready to use chutes-plugin.\n");
58
+ }
59
+ else {
60
+ console.log('⚠️ Some checks failed. Please address the issues above.\n');
61
+ }
62
+ }
63
+ //# sourceMappingURL=doctor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/cli/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,MAAM,CAAC,KAAK,UAAU,MAAM;IAC1B,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;IACzC,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;IAExD,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,IAAI,MAAM,GAAG,CAAC,CAAC;IAEf,SAAS,KAAK,CAAC,IAAY,EAAE,MAAe,EAAE,OAAe;QAC3D,MAAM,EAAE,CAAC;QACT,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,EAAE,CAAC;YACT,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;QAC3B,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;YACzB,OAAO,CAAC,GAAG,CAAC,MAAM,OAAO,EAAE,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;IAED,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IACjC,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,kBAAkB,CAAC,CAAC;IACpF,MAAM,SAAS,GAAG,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IAE5C,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IACtC,KAAK,CACH,kBAAkB,EAClB,SAAS,EACT,SAAS,CAAC,CAAC,CAAC,aAAa,UAAU,EAAE,CAAC,CAAC,CAAC,iCAAiC,CAC1E,CAAC;IAEF,OAAO,CAA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ChB,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAoC,CAAC;YACxE,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC,qBAAqB,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,KAAK,CACH,sBAAsB,EACtB,KAAK,EACL,sBAAsB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAC/E,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;IACxD,OAAO,CAAC,GAAG,CAAC,YAAY,MAAM,IAAI,MAAM,kBAAkB,CAAC,CAAC;IAE5D,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,OAAO,CAAC,GAAG,CAAC,gEAAgE,CAAC,CAAC;IAChF,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,4DAA4D,CAAC,CAAC;IAC5E,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}
package/dist/cli/index.js CHANGED
@@ -1,276 +1,8 @@
1
- // @bun
2
- var __defProp = Object.defineProperty;
3
- var __export = (target, all) => {
4
- for (var name in all)
5
- __defProp(target, name, {
6
- get: all[name],
7
- enumerable: true,
8
- configurable: true,
9
- set: (newValue) => all[name] = () => newValue
10
- });
11
- };
12
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
13
-
14
- // src/cli/install.ts
15
- var exports_install = {};
16
- __export(exports_install, {
17
- install: () => install
18
- });
19
- import * as fs from "fs";
20
- import * as path from "path";
21
- async function install() {
22
- console.log(`\uD83D\uDC0D chutes-plugin installer
23
- `);
24
- console.log(`\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
25
- `);
26
- const projectDir = process.cwd();
27
- const pluginDir = path.join(projectDir, ".opencode", "plugin");
28
- const pluginFile = path.join(pluginDir, "chutes-plugin.js");
29
- console.log(`Installing chutes-plugin to project...
30
- `);
31
- console.log(`Copying plugin to .opencode/plugin/
32
- `);
33
- fs.mkdirSync(pluginDir, { recursive: true });
34
- const distFile = path.join(__dirname, "..", "..", "dist", "index.js");
35
- if (fs.existsSync(distFile)) {
36
- fs.copyFileSync(distFile, pluginFile);
37
- } else {
38
- console.error('\u274C Error: dist/index.js not found. Run "bun run build" first.');
39
- process.exit(1);
40
- }
41
- console.log("\u2705 Successfully installed!");
42
- console.log(` Location: ${pluginFile}`);
43
- console.log(`
44
- \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
45
- `);
46
- console.log("Next steps:");
47
- console.log("1. Restart OpenCode if it's running");
48
- console.log("2. Run: opencode");
49
- console.log("3. Connect your token: /connect chutes");
50
- console.log("4. Select a Chutes model from the dropdown");
51
- console.log(`
52
- Available tools:`);
53
- console.log(" - chutes_list_models");
54
- console.log(" - chutes_refresh_models");
55
- console.log(" - chutes_status");
56
- }
57
- var __dirname = "/home/mark182/code/chutes-plugin/src/cli";
58
- var init_install = () => {};
59
-
60
- // src/cli/status.ts
61
- var exports_status = {};
62
- __export(exports_status, {
63
- status: () => status
64
- });
65
- import * as fs2 from "fs";
66
- import * as path2 from "path";
67
- async function status() {
68
- console.log(`\uD83D\uDC0D chutes-plugin status
69
- `);
70
- console.log(`\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
71
- `);
72
- const projectDir = process.cwd();
73
- const pluginFile = path2.join(projectDir, ".opencode", "plugin", "chutes-plugin.js");
74
- const hasPlugin = fs2.existsSync(pluginFile);
75
- console.log(`Plugin installed: ${hasPlugin ? "\u2705 Yes" : "\u274C No"}`);
76
- if (hasPlugin) {
77
- console.log(`Location: ${pluginFile}`);
78
- } else {
79
- console.log(`
80
- To install:`);
81
- console.log(` bunx chutes-plugin install
82
- `);
83
- }
84
- const homeDir = process.env.HOME || process.env.USERPROFILE;
85
- const authPath = homeDir ? path2.join(homeDir, ".local", "share", "opencode", "auth.json") : null;
86
- let hasAuth = false;
87
- if (authPath && fs2.existsSync(authPath)) {
88
- try {
89
- const content = fs2.readFileSync(authPath, "utf-8");
90
- const auth = JSON.parse(content);
91
- hasAuth = !!(auth.chutes || auth.CHUTES_API_TOKEN || auth.chutes_api_token);
92
- } catch {
93
- hasAuth = false;
94
- }
95
- }
96
- console.log(`API Token: ${hasAuth ? "\u2705 Connected" : "\u26A0\uFE0F Not connected"}`);
97
- if (!hasAuth) {
98
- console.log(`
99
- To connect your token:`);
100
- console.log(" 1. Run: opencode");
101
- console.log(` 2. Type: /connect chutes
102
- `);
103
- }
104
- console.log("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501");
105
- }
106
- var init_status = () => {};
107
-
108
- // src/cli/list.ts
109
- var exports_list = {};
110
- __export(exports_list, {
111
- list: () => list
112
- });
113
- async function list() {
114
- console.log(`\uD83D\uDC0D chutes-plugin models
115
- `);
116
- console.log(`\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
117
- `);
118
- console.log(`Fetching models from Chutes API...
119
- `);
120
- try {
121
- const response = await fetch("https://llm.chutes.ai/v1/models", {
122
- method: "GET",
123
- headers: {
124
- "Content-Type": "application/json"
125
- }
126
- });
127
- if (!response.ok) {
128
- console.log(`\u274C Error fetching models: ${response.status} ${response.statusText}`);
129
- process.exit(1);
130
- }
131
- const data = await response.json();
132
- const models = data.data || [];
133
- console.log(`Found ${models.length} models:
134
- `);
135
- for (const model of models) {
136
- console.log(`\u2022 ${model.id}`);
137
- console.log(` Owner: ${model.owned_by}`);
138
- console.log(` Pricing: $${model.pricing.prompt.toFixed(2)}/M input, $${model.pricing.completion.toFixed(2)}/M output
139
- `);
140
- }
141
- console.log(`\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
142
- `);
143
- console.log("Tip: To use these models:");
144
- console.log("1. Install the plugin: bunx chutes-plugin install");
145
- console.log("2. Start OpenCode: opencode");
146
- console.log("3. Connect token: /connect chutes");
147
- console.log(`4. Select a Chutes model from the dropdown
148
- `);
149
- } catch (error) {
150
- console.log(`\u274C Error fetching models: ${error instanceof Error ? error.message : String(error)}`);
151
- process.exit(1);
152
- }
153
- }
154
-
155
- // src/cli/refresh.ts
156
- var exports_refresh = {};
157
- __export(exports_refresh, {
158
- refresh: () => refresh
159
- });
160
- async function refresh() {
161
- console.log(`\uD83D\uDC0D chutes-plugin refresh
162
- `);
163
- console.log(`\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
164
- `);
165
- console.log(`Refreshing model cache...
166
- `);
167
- try {
168
- const response = await fetch("https://llm.chutes.ai/v1/models", {
169
- method: "GET",
170
- headers: {
171
- "Content-Type": "application/json"
172
- }
173
- });
174
- if (!response.ok) {
175
- console.log(`\u274C Error refreshing models: ${response.status} ${response.statusText}`);
176
- process.exit(1);
177
- }
178
- const data = await response.json();
179
- const models = data.data || [];
180
- console.log(`\u2705 Successfully refreshed ${models.length} models
181
- `);
182
- console.log("Note: The cache will be automatically refreshed when OpenCode restarts.");
183
- console.log(`Models are cached in-memory for 1 hour during each OpenCode session.
184
- `);
185
- } catch (error) {
186
- console.log(`\u274C Error refreshing models: ${error instanceof Error ? error.message : String(error)}`);
187
- process.exit(1);
188
- }
189
- }
190
-
191
- // src/cli/doctor.ts
192
- var exports_doctor = {};
193
- __export(exports_doctor, {
194
- doctor: () => doctor
195
- });
196
- import * as fs3 from "fs";
197
- import * as path3 from "path";
198
- async function doctor() {
199
- console.log(`\uD83D\uDC0D chutes-plugin doctor
200
- `);
201
- console.log(`\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
202
- `);
203
- let checks = 0;
204
- let passed = 0;
205
- function check(name, result, message) {
206
- checks++;
207
- if (result) {
208
- passed++;
209
- console.log(`\u2705 ${name}`);
210
- } else {
211
- console.log(`\u274C ${name}`);
212
- console.log(` ${message}`);
213
- }
214
- }
215
- const projectDir = process.cwd();
216
- const pluginFile = path3.join(projectDir, ".opencode", "plugin", "chutes-plugin.js");
217
- const hasPlugin = fs3.existsSync(pluginFile);
218
- console.log(`Installation Checks:
219
- `);
220
- check("Plugin installed", hasPlugin, hasPlugin ? `Location: ${pluginFile}` : "Run: bunx chutes-plugin install");
221
- console.log(`
222
- API Checks:
223
- `);
224
- const homeDir = process.env.HOME || process.env.USERPROFILE;
225
- const authPath = homeDir ? path3.join(homeDir, ".local", "share", "opencode", "auth.json") : null;
226
- let hasAuth = false;
227
- if (authPath && fs3.existsSync(authPath)) {
228
- try {
229
- const content = fs3.readFileSync(authPath, "utf-8");
230
- const auth = JSON.parse(content);
231
- hasAuth = !!(auth.chutes || auth.CHUTES_API_TOKEN || auth.chutes_api_token);
232
- } catch {
233
- hasAuth = false;
234
- }
235
- }
236
- check("API token connected", hasAuth, "Run: opencode, then type: /connect chutes");
237
- console.log(`
238
- Network Checks:
239
- `);
240
- try {
241
- const response = await fetch("https://llm.chutes.ai/v1/models", {
242
- method: "GET",
243
- headers: { "Content-Type": "application/json" }
244
- });
245
- check("Can reach Chutes API", response.ok, `HTTP ${response.status}: ${response.statusText}`);
246
- if (response.ok) {
247
- const data = await response.json();
248
- console.log(` Found ${data.data?.length || 0} models available
249
- `);
250
- }
251
- } catch (error) {
252
- check("Can reach Chutes API", false, `Connection failed: ${error instanceof Error ? error.message : String(error)}`);
253
- }
254
- console.log(`\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
255
- `);
256
- console.log(`Results: ${passed}/${checks} checks passed
257
- `);
258
- if (passed === checks) {
259
- console.log(`\uD83C\uDF89 Everything looks good! You're ready to use chutes-plugin.
260
- `);
261
- } else {
262
- console.log(`\u26A0\uFE0F Some checks failed. Please address the issues above.
263
- `);
264
- }
265
- }
266
- var init_doctor = () => {};
267
-
268
- // src/cli/index.ts
269
- import cac from "cac";
270
- var cli = cac("chutes-plugin");
271
- cli.version("0.1.0");
1
+ import cac from 'cac';
2
+ const cli = cac('chutes-plugin');
3
+ cli.version('0.1.0');
272
4
  cli.usage(`
273
- \uD83D\uDC0D chutes-plugin
5
+ 🐍 chutes-plugin
274
6
 
275
7
  A plugin for OpenCode that provides access to 58+ state-of-the-art AI models through the Chutes API.
276
8
 
@@ -291,27 +23,28 @@ Examples:
291
23
  $ chutes-plugin refresh
292
24
  $ chutes-plugin doctor
293
25
  `);
294
- cli.command("install", "Install the plugin to the current project").action(async () => {
295
- const { install: install2 } = await Promise.resolve().then(() => (init_install(), exports_install));
296
- await install2();
26
+ cli.command('install', 'Install the plugin to the current project').action(async () => {
27
+ const { install } = await import('./install.js');
28
+ await install();
297
29
  });
298
- cli.command("status", "Check plugin status and configuration").action(async () => {
299
- const { status: status2 } = await Promise.resolve().then(() => (init_status(), exports_status));
300
- await status2();
30
+ cli.command('status', 'Check plugin status and configuration').action(async () => {
31
+ const { status } = await import('./status.js');
32
+ await status();
301
33
  });
302
- cli.command("list", "List available models from the Chutes API").action(async () => {
303
- const { list: list2 } = await Promise.resolve().then(() => exports_list);
304
- await list2();
34
+ cli.command('list', 'List available models from the Chutes API').action(async () => {
35
+ const { list } = await import('./list.js');
36
+ await list();
305
37
  });
306
- cli.command("refresh", "Force refresh the model cache").action(async () => {
307
- const { refresh: refresh2 } = await Promise.resolve().then(() => exports_refresh);
308
- await refresh2();
38
+ cli.command('refresh', 'Force refresh the model cache').action(async () => {
39
+ const { refresh } = await import('./refresh.js');
40
+ await refresh();
309
41
  });
310
- cli.command("doctor", "Verify that everything is configured correctly").action(async () => {
311
- const { doctor: doctor2 } = await Promise.resolve().then(() => (init_doctor(), exports_doctor));
312
- await doctor2();
42
+ cli.command('doctor', 'Verify that everything is configured correctly').action(async () => {
43
+ const { doctor } = await import('./doctor.js');
44
+ await doctor();
313
45
  });
314
46
  cli.parse();
315
47
  if (process.argv.length === 2) {
316
- cli.outputHelp();
48
+ cli.outputHelp();
317
49
  }
50
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,MAAM,GAAG,GAAG,GAAG,CAAC,eAAe,CAAC,CAAC;AAEjC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AACrB,GAAG,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;CAqBT,CAAC,CAAC;AAEH,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,2CAA2C,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE;IACpF,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,CAAC;IACjD,MAAM,OAAO,EAAE,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,uCAAuC,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE;IAC/E,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;IAC/C,MAAM,MAAM,EAAE,CAAC;AACjB,CAAC,CAAC,CAAC;AAEH,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,2CAA2C,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE;IACjF,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,CAAC;IAC3C,MAAM,IAAI,EAAE,CAAC;AACf,CAAC,CAAC,CAAC;AAEH,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,+BAA+B,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE;IACxE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,CAAC;IACjD,MAAM,OAAO,EAAE,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,gDAAgD,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE;IACxF,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;IAC/C,MAAM,MAAM,EAAE,CAAC;AACjB,CAAC,CAAC,CAAC;AAEH,GAAG,CAAC,KAAK,EAAE,CAAC;AAEZ,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;IAC9B,GAAG,CAAC,UAAU,EAAE,CAAC;AACnB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function install(): Promise<void>;
2
+ //# sourceMappingURL=install.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/cli/install.ts"],"names":[],"mappings":"AAGA,wBAAsB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAiC7C"}
@@ -0,0 +1,33 @@
1
+ import * as fs from 'node:fs';
2
+ import * as path from 'node:path';
3
+ export async function install() {
4
+ console.log('🐍 chutes-plugin installer\n');
5
+ console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n');
6
+ const projectDir = process.cwd();
7
+ const pluginDir = path.join(projectDir, '.opencode', 'plugin');
8
+ const pluginFile = path.join(pluginDir, 'chutes-plugin.js');
9
+ console.log('Installing chutes-plugin to project...\n');
10
+ console.log('Copying plugin to .opencode/plugin/\n');
11
+ fs.mkdirSync(pluginDir, { recursive: true });
12
+ const distFile = path.join(__dirname, '..', '..', 'dist', 'index.js');
13
+ if (fs.existsSync(distFile)) {
14
+ fs.copyFileSync(distFile, pluginFile);
15
+ }
16
+ else {
17
+ console.error('❌ Error: dist/index.js not found. Run "bun run build" first.');
18
+ process.exit(1);
19
+ }
20
+ console.log('✅ Successfully installed!');
21
+ console.log(` Location: ${pluginFile}`);
22
+ console.log('\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n');
23
+ console.log('Next steps:');
24
+ console.log("1. Restart OpenCode if it's running");
25
+ console.log('2. Run: opencode');
26
+ console.log('3. Connect your token: /connect chutes');
27
+ console.log('4. Select a Chutes model from the dropdown');
28
+ console.log('\nAvailable tools:');
29
+ console.log(' - chutes_list_models');
30
+ console.log(' - chutes_refresh_models');
31
+ console.log(' - chutes_status');
32
+ }
33
+ //# sourceMappingURL=install.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/cli/install.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,MAAM,CAAC,KAAK,UAAU,OAAO;IAC3B,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;IAC5C,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;IAExD,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IACjC,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;IAC/D,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;IAE5D,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;IACxD,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;IAErD,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAE7C,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;IACtE,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACxC,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,KAAK,CAAC,8DAA8D,CAAC,CAAC;QAC9E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;IACzC,OAAO,CAAC,GAAG,CAAC,gBAAgB,UAAU,EAAE,CAAC,CAAC;IAC1C,OAAO,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAC;IAC1D,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAC3B,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;IACnD,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAChC,OAAO,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAC;IACtD,OAAO,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAC;IAC1D,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAClC,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;IACvC,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;IAC1C,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;AACpC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function list(): Promise<void>;
2
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/cli/list.ts"],"names":[],"mappings":"AAAA,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAiD1C"}
@@ -0,0 +1,36 @@
1
+ export async function list() {
2
+ console.log('🐍 chutes-plugin models\n');
3
+ console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n');
4
+ console.log('Fetching models from Chutes API...\n');
5
+ try {
6
+ const response = await fetch('https://llm.chutes.ai/v1/models', {
7
+ method: 'GET',
8
+ headers: {
9
+ 'Content-Type': 'application/json',
10
+ },
11
+ });
12
+ if (!response.ok) {
13
+ console.log(`❌ Error fetching models: ${response.status} ${response.statusText}`);
14
+ process.exit(1);
15
+ }
16
+ const data = (await response.json());
17
+ const models = data.data || [];
18
+ console.log(`Found ${models.length} models:\n`);
19
+ for (const model of models) {
20
+ console.log(`• ${model.id}`);
21
+ console.log(` Owner: ${model.owned_by}`);
22
+ console.log(` Pricing: $${model.pricing.prompt.toFixed(2)}/M input, $${model.pricing.completion.toFixed(2)}/M output\n`);
23
+ }
24
+ console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n');
25
+ console.log('Tip: To use these models:');
26
+ console.log('1. Install the plugin: bunx chutes-plugin install');
27
+ console.log('2. Start OpenCode: opencode');
28
+ console.log('3. Connect token: /connect chutes');
29
+ console.log('4. Select a Chutes model from the dropdown\n');
30
+ }
31
+ catch (error) {
32
+ console.log(`❌ Error fetching models: ${error instanceof Error ? error.message : String(error)}`);
33
+ process.exit(1);
34
+ }
35
+ }
36
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/cli/list.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,KAAK,UAAU,IAAI;IACxB,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;IACzC,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;IACxD,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;IAEpD,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,iCAAiC,EAAE;YAC9D,MAAM,EAAE,KAAK;YACb,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;SACF,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,OAAO,CAAC,GAAG,CAA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OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function refresh(): Promise<void>;
2
+ //# sourceMappingURL=refresh.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refresh.d.ts","sourceRoot":"","sources":["../../src/cli/refresh.ts"],"names":[],"mappings":"AAAA,wBAAsB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CA8B7C"}
@@ -0,0 +1,27 @@
1
+ export async function refresh() {
2
+ console.log('🐍 chutes-plugin refresh\n');
3
+ console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n');
4
+ console.log('Refreshing model cache...\n');
5
+ try {
6
+ const response = await fetch('https://llm.chutes.ai/v1/models', {
7
+ method: 'GET',
8
+ headers: {
9
+ 'Content-Type': 'application/json',
10
+ },
11
+ });
12
+ if (!response.ok) {
13
+ console.log(`❌ Error refreshing models: ${response.status} ${response.statusText}`);
14
+ process.exit(1);
15
+ }
16
+ const data = (await response.json());
17
+ const models = data.data || [];
18
+ console.log(`✅ Successfully refreshed ${models.length} models\n`);
19
+ console.log('Note: The cache will be automatically refreshed when OpenCode restarts.');
20
+ console.log('Models are cached in-memory for 1 hour during each OpenCode session.\n');
21
+ }
22
+ catch (error) {
23
+ console.log(`❌ Error refreshing models: ${error instanceof Error ? error.message : String(error)}`);
24
+ process.exit(1);
25
+ }
26
+ }
27
+ //# sourceMappingURL=refresh.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refresh.js","sourceRoot":"","sources":["../../src/cli/refresh.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,KAAK,UAAU,OAAO;IAC3B,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;IAC1C,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;IACxD,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;IAE3C,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,iCAAiC,EAAE;YAC9D,MAAM,EAAE,KAAK;YACb,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;SACF,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,OAAO,CAAC,GAAG,CAAC,8BAA8B,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;YACpF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAoC,CAAC;QACxE,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;QAE/B,OAAO,CAAC,GAAG,CAAC,4BAA4B,MAAM,CAAC,MAAM,WAAW,CAAC,CAAC;QAClE,OAAO,CAAC,GAAG,CAAC,yEAAyE,CAAC,CAAC;QACvF,OAAO,CAAC,GAAG,CAAC,wEAAwE,CAAC,CAAC;IACxF,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CACT,8BAA8B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACvF,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function status(): Promise<void>;
2
+ //# sourceMappingURL=status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/cli/status.ts"],"names":[],"mappings":"AAGA,wBAAsB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAsC5C"}
@@ -0,0 +1,38 @@
1
+ import * as fs from 'node:fs';
2
+ import * as path from 'node:path';
3
+ export async function status() {
4
+ console.log('🐍 chutes-plugin status\n');
5
+ console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n');
6
+ const projectDir = process.cwd();
7
+ const pluginFile = path.join(projectDir, '.opencode', 'plugin', 'chutes-plugin.js');
8
+ const hasPlugin = fs.existsSync(pluginFile);
9
+ console.log(`Plugin installed: ${hasPlugin ? '✅ Yes' : '❌ No'}`);
10
+ if (hasPlugin) {
11
+ console.log(`Location: ${pluginFile}`);
12
+ }
13
+ else {
14
+ console.log('\nTo install:');
15
+ console.log(' bunx chutes-plugin install\n');
16
+ }
17
+ const homeDir = process.env.HOME || process.env.USERPROFILE;
18
+ const authPath = homeDir ? path.join(homeDir, '.local', 'share', 'opencode', 'auth.json') : null;
19
+ let hasAuth = false;
20
+ if (authPath && fs.existsSync(authPath)) {
21
+ try {
22
+ const content = fs.readFileSync(authPath, 'utf-8');
23
+ const auth = JSON.parse(content);
24
+ hasAuth = !!(auth.chutes || auth.CHUTES_API_TOKEN || auth.chutes_api_token);
25
+ }
26
+ catch {
27
+ hasAuth = false;
28
+ }
29
+ }
30
+ console.log(`API Token: ${hasAuth ? '✅ Connected' : '⚠️ Not connected'}`);
31
+ if (!hasAuth) {
32
+ console.log('\nTo connect your token:');
33
+ console.log(' 1. Run: opencode');
34
+ console.log(' 2. Type: /connect chutes\n');
35
+ }
36
+ console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
37
+ }
38
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/cli/status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,MAAM,CAAC,KAAK,UAAU,MAAM;IAC1B,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;IACzC,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;IAExD,MAAM,U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C;YACP,OAAO,GAAG,KAAK,CAAC;QAClB,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,cAAc,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,mBAAmB,EAAE,CAAC,CAAC;IAC3E,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;QACxC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QAClC,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAC;AACxD,CAAC"}
@@ -0,0 +1,12 @@
1
+ export interface OpenCodeAuthEntry {
2
+ type: 'api';
3
+ key: string;
4
+ }
5
+ export interface OpenCodeAuthJson {
6
+ chutes?: OpenCodeAuthEntry;
7
+ openrouter?: OpenCodeAuthEntry;
8
+ [key: string]: OpenCodeAuthEntry | undefined;
9
+ }
10
+ export declare function readOpenCodeAuth(): OpenCodeAuthJson | null;
11
+ export declare function getChutesApiKeyFromAuth(): string | null;
12
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/config/auth.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,KAAK,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAAC;CAC9C;AAQD,wBAAgB,gBAAgB,IAAI,gBAAgB,GAAG,IAAI,CAa1D;AAED,wBAAgB,uBAAuB,IAAI,MAAM,GAAG,IAAI,CAQvD"}
@@ -0,0 +1,24 @@
1
+ import * as fs from 'node:fs';
2
+ import * as path from 'node:path';
3
+ const AUTH_FILE_PATH = path.join(process.env.XDG_DATA_HOME || path.join(process.env.HOME || '~', '.local', 'share'), 'opencode', 'auth.json');
4
+ export function readOpenCodeAuth() {
5
+ try {
6
+ if (!fs.existsSync(AUTH_FILE_PATH)) {
7
+ return null;
8
+ }
9
+ const content = fs.readFileSync(AUTH_FILE_PATH, 'utf-8');
10
+ const auth = JSON.parse(content);
11
+ return auth;
12
+ }
13
+ catch {
14
+ return null;
15
+ }
16
+ }
17
+ export function getChutesApiKeyFromAuth() {
18
+ const auth = readOpenCodeAuth();
19
+ if (!auth?.chutes?.key) {
20
+ return null;
21
+ }
22
+ return auth.chutes.key;
23
+ }
24
+ //# sourceMappingURL=auth.js.map