opencode-aiway-auth 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/LICENSE +21 -0
- package/README.md +58 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/limits.d.ts +12 -0
- package/dist/limits.d.ts.map +1 -0
- package/dist/limits.js +25 -0
- package/dist/limits.js.map +1 -0
- package/dist/plugin.d.ts +3 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +303 -0
- package/dist/plugin.js.map +1 -0
- package/package.json +55 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 best-linux-code
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# opencode-aiway-auth
|
|
2
|
+
|
|
3
|
+
OpenCode plugin for AI Way (New API) — authentication and model discovery.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add to your OpenCode config (`~/.config/opencode/opencode.json`):
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"plugin": [
|
|
12
|
+
"/path/to/opencode-aiway-auth"
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Or install from the plugin directory:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
cd /path/to/opencode-aiway-auth
|
|
21
|
+
npm install
|
|
22
|
+
npm run build
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Setup
|
|
26
|
+
|
|
27
|
+
1. Start OpenCode
|
|
28
|
+
2. Select **AI Way API Key** as auth provider
|
|
29
|
+
3. Enter your AI Way server URL (default: `http://192.168.77.88`)
|
|
30
|
+
4. Enter your API key
|
|
31
|
+
|
|
32
|
+
The plugin will:
|
|
33
|
+
|
|
34
|
+
- Validate connectivity via `GET /v1/models`
|
|
35
|
+
- Discover all available models and their capabilities
|
|
36
|
+
- Register them as an OpenCode provider (`aiway`)
|
|
37
|
+
- Persist config to `~/.config/opencode/opencode.json`
|
|
38
|
+
|
|
39
|
+
## Models
|
|
40
|
+
|
|
41
|
+
Models are discovered dynamically from the AI Way server. The plugin maps:
|
|
42
|
+
|
|
43
|
+
- **Capabilities**: effort levels, thinking mode, input modalities (text, image, pdf, video)
|
|
44
|
+
- **Variants**: one per effort level (low, medium, high, max, xhigh) + thinking-disabled
|
|
45
|
+
- **Limits**: context window and max output tokens from a built-in table
|
|
46
|
+
|
|
47
|
+
## Logging
|
|
48
|
+
|
|
49
|
+
Logs are written to `/tmp/opencode-aiway-auth.log`. API keys are never logged.
|
|
50
|
+
|
|
51
|
+
## Development
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npm install
|
|
55
|
+
npm run build # Compile TypeScript
|
|
56
|
+
npm run typecheck # Type-check only
|
|
57
|
+
npm run integration # Run integration tests against AI Way
|
|
58
|
+
```
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA"}
|
package/dist/limits.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in token limits for known AI Way models.
|
|
3
|
+
* AI Way /v1/models does not return context_window or max_output_tokens,
|
|
4
|
+
* so we supply them here.
|
|
5
|
+
*/
|
|
6
|
+
interface ModelLimits {
|
|
7
|
+
context: number;
|
|
8
|
+
output: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function getLimits(id: string): ModelLimits;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=limits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../src/limits.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,UAAU,WAAW;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;CACf;AAoBD,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,CAEjD"}
|
package/dist/limits.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in token limits for known AI Way models.
|
|
3
|
+
* AI Way /v1/models does not return context_window or max_output_tokens,
|
|
4
|
+
* so we supply them here.
|
|
5
|
+
*/
|
|
6
|
+
const KNOWN_LIMITS = {
|
|
7
|
+
"claude-opus-4-6": { context: 200000, output: 32000 },
|
|
8
|
+
"claude-sonnet-4-6": { context: 200000, output: 16384 },
|
|
9
|
+
"claude-haiku-4-5": { context: 200000, output: 16384 },
|
|
10
|
+
"gpt-5.4": { context: 128000, output: 16384 },
|
|
11
|
+
"gpt-5.4-mini": { context: 128000, output: 16384 },
|
|
12
|
+
"gpt-5.3-codex": { context: 128000, output: 16384 },
|
|
13
|
+
"gemini-3.1-pro-preview": { context: 1000000, output: 65536 },
|
|
14
|
+
"kimi-k2.5": { context: 128000, output: 16384 },
|
|
15
|
+
"glm-5.1": { context: 128000, output: 4096 },
|
|
16
|
+
"grok-code-fast-1": { context: 128000, output: 4096 },
|
|
17
|
+
"mimo-v2-pro": { context: 128000, output: 4096 },
|
|
18
|
+
"minimax-m2.7": { context: 128000, output: 4096 },
|
|
19
|
+
"qwen3.6-plus": { context: 128000, output: 4096 },
|
|
20
|
+
};
|
|
21
|
+
const DEFAULT_LIMITS = { context: 128000, output: 4096 };
|
|
22
|
+
export function getLimits(id) {
|
|
23
|
+
return KNOWN_LIMITS[id] ?? DEFAULT_LIMITS;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=limits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limits.js","sourceRoot":"","sources":["../src/limits.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,MAAM,YAAY,GAAgC;IAChD,iBAAiB,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE;IACrD,mBAAmB,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE;IACvD,kBAAkB,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,M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|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import * as os from "node:os";
|
|
4
|
+
import { getLimits } from "./limits.js";
|
|
5
|
+
// ── Constants ──
|
|
6
|
+
const PROVIDER_ID = "aiway";
|
|
7
|
+
const PROVIDER_NAME = "AI Way";
|
|
8
|
+
const DEFAULT_BASE_URL = "http://192.168.77.88";
|
|
9
|
+
const LOG_FILE = "/tmp/opencode-aiway-auth.log";
|
|
10
|
+
const logStream = fs.createWriteStream(LOG_FILE, { flags: "a" });
|
|
11
|
+
function log(msg) {
|
|
12
|
+
logStream.write(`[${new Date().toISOString()}] [aiway] ${msg}\n`);
|
|
13
|
+
}
|
|
14
|
+
// ── Config Helpers ──
|
|
15
|
+
function configDir() {
|
|
16
|
+
const xdg = process.env.XDG_CONFIG_HOME || path.join(os.homedir(), ".config");
|
|
17
|
+
return path.join(xdg, "opencode");
|
|
18
|
+
}
|
|
19
|
+
function configPath() {
|
|
20
|
+
return path.join(configDir(), "opencode.json");
|
|
21
|
+
}
|
|
22
|
+
function readConfig() {
|
|
23
|
+
try {
|
|
24
|
+
if (!fs.existsSync(configPath()))
|
|
25
|
+
return {};
|
|
26
|
+
return JSON.parse(fs.readFileSync(configPath(), "utf-8"));
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return {};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function writeConfig(cfg) {
|
|
33
|
+
const dir = configDir();
|
|
34
|
+
const target = configPath();
|
|
35
|
+
const tmp = path.join(dir, `opencode.json.tmp-${process.pid}-${Date.now().toString(36)}`);
|
|
36
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
37
|
+
try {
|
|
38
|
+
fs.writeFileSync(tmp, JSON.stringify(cfg, null, 2), "utf-8");
|
|
39
|
+
fs.renameSync(tmp, target);
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
try {
|
|
43
|
+
fs.unlinkSync(tmp);
|
|
44
|
+
}
|
|
45
|
+
catch { }
|
|
46
|
+
throw err;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
// ── API ──
|
|
50
|
+
async function fetchModels(base, key) {
|
|
51
|
+
const res = await fetch(`${base}/v1/models`, {
|
|
52
|
+
headers: {
|
|
53
|
+
Authorization: `Bearer ${key}`,
|
|
54
|
+
Accept: "application/json",
|
|
55
|
+
},
|
|
56
|
+
signal: AbortSignal.timeout(10000),
|
|
57
|
+
});
|
|
58
|
+
if (!res.ok)
|
|
59
|
+
throw new Error(`GET /v1/models failed: HTTP ${res.status}`);
|
|
60
|
+
const body = (await res.json());
|
|
61
|
+
return Array.isArray(body.data) ? body.data : [];
|
|
62
|
+
}
|
|
63
|
+
// ── Model Mapping ──
|
|
64
|
+
function hasModality(caps, mod) {
|
|
65
|
+
return caps?.input_modalities?.includes(mod) ?? false;
|
|
66
|
+
}
|
|
67
|
+
function supportsReasoning(caps) {
|
|
68
|
+
if (!caps)
|
|
69
|
+
return false;
|
|
70
|
+
if (caps.effort_levels && caps.effort_levels.length > 0)
|
|
71
|
+
return true;
|
|
72
|
+
return caps.default_thinking_type !== undefined && caps.default_thinking_type !== "none";
|
|
73
|
+
}
|
|
74
|
+
function buildVariants(caps) {
|
|
75
|
+
if (!caps)
|
|
76
|
+
return undefined;
|
|
77
|
+
const variants = {};
|
|
78
|
+
if (caps.effort_levels) {
|
|
79
|
+
for (const level of caps.effort_levels) {
|
|
80
|
+
variants[level] = { reasoning_effort: level };
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (caps.default_thinking_type === "adaptive" || caps.default_thinking_type === "enabled") {
|
|
84
|
+
variants["thinking-disabled"] = { thinking: { type: "disabled" } };
|
|
85
|
+
}
|
|
86
|
+
return Object.keys(variants).length > 0 ? variants : undefined;
|
|
87
|
+
}
|
|
88
|
+
function mapModel(m, base) {
|
|
89
|
+
const caps = m.capabilities;
|
|
90
|
+
const limits = getLimits(m.id);
|
|
91
|
+
const image = hasModality(caps, "image");
|
|
92
|
+
const pdf = hasModality(caps, "pdf");
|
|
93
|
+
const video = hasModality(caps, "video");
|
|
94
|
+
const attachment = image || pdf || video;
|
|
95
|
+
const reasoning = supportsReasoning(caps);
|
|
96
|
+
const variants = buildVariants(caps);
|
|
97
|
+
return {
|
|
98
|
+
id: m.id,
|
|
99
|
+
providerID: PROVIDER_ID,
|
|
100
|
+
name: m.id,
|
|
101
|
+
attachment,
|
|
102
|
+
modalities: {
|
|
103
|
+
input: caps?.input_modalities ?? ["text"],
|
|
104
|
+
output: caps?.output_modalities ?? ["text"],
|
|
105
|
+
},
|
|
106
|
+
api: {
|
|
107
|
+
id: m.id,
|
|
108
|
+
url: `${base}/v1`,
|
|
109
|
+
npm: "@ai-sdk/openai-compatible",
|
|
110
|
+
},
|
|
111
|
+
status: "active",
|
|
112
|
+
reasoning,
|
|
113
|
+
capabilities: {
|
|
114
|
+
temperature: true,
|
|
115
|
+
reasoning,
|
|
116
|
+
attachment,
|
|
117
|
+
toolcall: true,
|
|
118
|
+
input: {
|
|
119
|
+
text: true,
|
|
120
|
+
audio: false,
|
|
121
|
+
image,
|
|
122
|
+
video,
|
|
123
|
+
pdf,
|
|
124
|
+
},
|
|
125
|
+
output: {
|
|
126
|
+
text: true,
|
|
127
|
+
audio: false,
|
|
128
|
+
image: false,
|
|
129
|
+
video: false,
|
|
130
|
+
pdf: false,
|
|
131
|
+
},
|
|
132
|
+
interleaved: false,
|
|
133
|
+
},
|
|
134
|
+
cost: { input: 0, output: 0 },
|
|
135
|
+
limit: {
|
|
136
|
+
context: limits.context,
|
|
137
|
+
output: limits.output,
|
|
138
|
+
},
|
|
139
|
+
headers: {},
|
|
140
|
+
options: {},
|
|
141
|
+
variants: variants ?? {},
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
// ── Provider Patching ──
|
|
145
|
+
function patchProvider(provider, models, base) {
|
|
146
|
+
const target = provider ?? {};
|
|
147
|
+
const existing = (target.models ?? {});
|
|
148
|
+
for (const m of models) {
|
|
149
|
+
existing[m.id] = mapModel(m, base);
|
|
150
|
+
}
|
|
151
|
+
target.models = existing;
|
|
152
|
+
}
|
|
153
|
+
function writeProviderConfig(models, base) {
|
|
154
|
+
const cfg = readConfig();
|
|
155
|
+
const providers = cfg.provider ?? {};
|
|
156
|
+
const current = providers[PROVIDER_ID] ?? {};
|
|
157
|
+
const modelsRecord = { ...(current.models ?? {}) };
|
|
158
|
+
for (const m of models) {
|
|
159
|
+
modelsRecord[m.id] = mapModel(m, base);
|
|
160
|
+
}
|
|
161
|
+
providers[PROVIDER_ID] = {
|
|
162
|
+
...current,
|
|
163
|
+
id: PROVIDER_ID,
|
|
164
|
+
name: PROVIDER_NAME,
|
|
165
|
+
api: `${base}/v1`,
|
|
166
|
+
npm: "@ai-sdk/openai-compatible",
|
|
167
|
+
env: [],
|
|
168
|
+
models: modelsRecord,
|
|
169
|
+
};
|
|
170
|
+
cfg.provider = providers;
|
|
171
|
+
writeConfig(cfg);
|
|
172
|
+
log(`Wrote provider config: ${Object.keys(modelsRecord).length} models`);
|
|
173
|
+
}
|
|
174
|
+
function removeProviderConfig() {
|
|
175
|
+
const cfg = readConfig();
|
|
176
|
+
const providers = cfg.provider;
|
|
177
|
+
if (!providers?.[PROVIDER_ID])
|
|
178
|
+
return;
|
|
179
|
+
delete providers[PROVIDER_ID];
|
|
180
|
+
if (Object.keys(providers).length === 0)
|
|
181
|
+
delete cfg.provider;
|
|
182
|
+
writeConfig(cfg);
|
|
183
|
+
log("Removed provider config");
|
|
184
|
+
}
|
|
185
|
+
// ── Plugin Export ──
|
|
186
|
+
export const AiWayAuthPlugin = async () => {
|
|
187
|
+
log("Plugin initializing");
|
|
188
|
+
// Cleanup stale config when no auth
|
|
189
|
+
try {
|
|
190
|
+
const authPath = path.join(process.env.XDG_DATA_HOME || path.join(os.homedir(), ".local", "share"), "opencode", "auth.json");
|
|
191
|
+
let hasAuth = false;
|
|
192
|
+
try {
|
|
193
|
+
const data = JSON.parse(fs.readFileSync(authPath, "utf-8"));
|
|
194
|
+
const entry = data[PROVIDER_ID];
|
|
195
|
+
hasAuth = entry?.type === "api" && typeof entry?.key === "string" && entry.key !== "";
|
|
196
|
+
}
|
|
197
|
+
catch { }
|
|
198
|
+
if (!hasAuth)
|
|
199
|
+
removeProviderConfig();
|
|
200
|
+
}
|
|
201
|
+
catch (e) {
|
|
202
|
+
log(`Config cleanup error: ${e instanceof Error ? e.message : String(e)}`);
|
|
203
|
+
}
|
|
204
|
+
return {
|
|
205
|
+
auth: {
|
|
206
|
+
provider: PROVIDER_ID,
|
|
207
|
+
async loader(_getAuth, provider) {
|
|
208
|
+
const prov = typeof provider === "object" && provider !== null
|
|
209
|
+
? provider
|
|
210
|
+
: undefined;
|
|
211
|
+
const base = typeof prov?.api === "string" && prov.api.trim()
|
|
212
|
+
? prov.api.replace(/\/v1\/?$/, "").trim()
|
|
213
|
+
: DEFAULT_BASE_URL;
|
|
214
|
+
const auth = typeof _getAuth === "function" ? await _getAuth() : undefined;
|
|
215
|
+
const key = typeof auth?.key === "string" ? auth.key : "";
|
|
216
|
+
if (!key) {
|
|
217
|
+
log("No API key available");
|
|
218
|
+
return {};
|
|
219
|
+
}
|
|
220
|
+
log(`Loader: base=${base}`);
|
|
221
|
+
let models = [];
|
|
222
|
+
try {
|
|
223
|
+
models = await fetchModels(base, key);
|
|
224
|
+
log(`Fetched ${models.length} models`);
|
|
225
|
+
}
|
|
226
|
+
catch (e) {
|
|
227
|
+
log(`fetchModels failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
228
|
+
}
|
|
229
|
+
if (models.length > 0 && prov) {
|
|
230
|
+
patchProvider(prov, models, base);
|
|
231
|
+
}
|
|
232
|
+
try {
|
|
233
|
+
writeProviderConfig(models, base);
|
|
234
|
+
}
|
|
235
|
+
catch (e) {
|
|
236
|
+
log(`writeProviderConfig failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
237
|
+
}
|
|
238
|
+
for (const m of models) {
|
|
239
|
+
const caps = m.capabilities;
|
|
240
|
+
const efforts = caps?.effort_levels;
|
|
241
|
+
log(` ${m.id}: thinking=${caps?.default_thinking_type ?? "unknown"}${efforts ? `, effort=[${efforts}]` : ""}, input=[${caps?.input_modalities?.join(",") ?? "text"}]`);
|
|
242
|
+
}
|
|
243
|
+
return {
|
|
244
|
+
baseURL: `${base}/v1`,
|
|
245
|
+
apiKey: key,
|
|
246
|
+
};
|
|
247
|
+
},
|
|
248
|
+
methods: [
|
|
249
|
+
{
|
|
250
|
+
type: "api",
|
|
251
|
+
label: "AI Way API Key",
|
|
252
|
+
prompts: [
|
|
253
|
+
{
|
|
254
|
+
type: "text",
|
|
255
|
+
key: "base_url",
|
|
256
|
+
message: "AI Way server URL",
|
|
257
|
+
placeholder: DEFAULT_BASE_URL,
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
type: "text",
|
|
261
|
+
key: "api_key",
|
|
262
|
+
message: "AI Way API key",
|
|
263
|
+
placeholder: "sk-...",
|
|
264
|
+
},
|
|
265
|
+
],
|
|
266
|
+
async authorize(inputs) {
|
|
267
|
+
const base = inputs?.base_url?.trim() || DEFAULT_BASE_URL;
|
|
268
|
+
const key = inputs?.api_key?.trim() || "";
|
|
269
|
+
if (!key) {
|
|
270
|
+
log("[login] No API key provided");
|
|
271
|
+
return { type: "failed" };
|
|
272
|
+
}
|
|
273
|
+
log(`[login] Connecting to ${base}`);
|
|
274
|
+
try {
|
|
275
|
+
const models = await fetchModels(base, key);
|
|
276
|
+
log(`[login] Success: ${models.length} models`);
|
|
277
|
+
try {
|
|
278
|
+
writeProviderConfig(models, base);
|
|
279
|
+
}
|
|
280
|
+
catch (e) {
|
|
281
|
+
log(`[login] writeProviderConfig failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
282
|
+
}
|
|
283
|
+
return { type: "success", key };
|
|
284
|
+
}
|
|
285
|
+
catch (e) {
|
|
286
|
+
log(`[login] Failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
287
|
+
return { type: "failed" };
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
},
|
|
291
|
+
],
|
|
292
|
+
},
|
|
293
|
+
"chat.params": async (input, output) => {
|
|
294
|
+
if (input.provider.id !== PROVIDER_ID)
|
|
295
|
+
return;
|
|
296
|
+
const effort = typeof output.options.reasoning_effort === "string"
|
|
297
|
+
? output.options.reasoning_effort
|
|
298
|
+
: "default";
|
|
299
|
+
log(`[request] model=${input.model.id} effort=${effort}`);
|
|
300
|
+
},
|
|
301
|
+
};
|
|
302
|
+
};
|
|
303
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,kBAAkB;AAElB,MAAM,WAAW,GAAG,OAAO,CAAA;AAC3B,MAAM,aAAa,GAAG,QAAQ,CAAA;AAC9B,MAAM,gBAAgB,GAAG,sBAAsB,CAAA;AAC/C,MAAM,QAAQ,GAAG,8BAA8B,CAAA;AAE/C,MAAM,SAAS,GAAG,EAAE,CAAC,iBAAiB,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;AAEhE,SAAS,GAAG,CAAC,GAAW;IACtB,SAAS,CAAC,KAAK,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,aAAa,GAAG,IAAI,CAAC,CAAA;AACnE,CAAC;AA0BD,uBAAuB;AAEvB,SAAS,SAAS;IAChB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,CAAA;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KAAK,QAAQ;gBAChE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,gBAAgB;gBACjC,CAAC,CAAC,SAAS,CAAA;YAEb,GAAG,CAAC,mBAAmB,KAAK,CAAC,KAAK,CAAC,EAAE,WAAW,MAAM,EAAE,CAAC,CAAA;QAC3D,CAAC;KACF,CAAA;AACH,CAAC,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "opencode-aiway-auth",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "OpenCode plugin for AI Way (New API) authentication and model discovery",
|
|
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
|
+
"LICENSE"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc",
|
|
21
|
+
"typecheck": "tsc --noEmit",
|
|
22
|
+
"prepublishOnly": "tsc",
|
|
23
|
+
"integration": "npx tsx test/integration.ts"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"opencode",
|
|
27
|
+
"plugin",
|
|
28
|
+
"aiway",
|
|
29
|
+
"ai-way",
|
|
30
|
+
"new-api",
|
|
31
|
+
"llm",
|
|
32
|
+
"auth"
|
|
33
|
+
],
|
|
34
|
+
"author": "best-linux-code",
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "git+https://github.com/best-linux-code/opencode-aiway-auth.git"
|
|
39
|
+
},
|
|
40
|
+
"bugs": {
|
|
41
|
+
"url": "https://github.com/best-linux-code/opencode-aiway-auth/issues"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/best-linux-code/opencode-aiway-auth#readme",
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@opencode-ai/plugin": "^0.15.30"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/node": "^22.0.0",
|
|
49
|
+
"tsx": "^4.19.0",
|
|
50
|
+
"typescript": "^5.7.0"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"@opencode-ai/plugin": ">=0.4.0"
|
|
54
|
+
}
|
|
55
|
+
}
|