@agi-cli/server 0.1.99 → 0.1.100
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agi-cli/server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.100",
|
|
4
4
|
"description": "HTTP API server for AGI CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"typecheck": "tsc --noEmit"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@agi-cli/sdk": "0.1.
|
|
33
|
-
"@agi-cli/database": "0.1.
|
|
32
|
+
"@agi-cli/sdk": "0.1.100",
|
|
33
|
+
"@agi-cli/database": "0.1.100",
|
|
34
34
|
"drizzle-orm": "^0.44.5",
|
|
35
35
|
"hono": "^4.9.9",
|
|
36
36
|
"zod": "^4.1.8"
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
isProviderAuthorized,
|
|
18
18
|
ensureProviderEnv,
|
|
19
19
|
isProviderId,
|
|
20
|
+
providerEnvVar,
|
|
20
21
|
type ProviderId,
|
|
21
22
|
} from '@agi-cli/sdk';
|
|
22
23
|
import { sessions } from '@agi-cli/database/schema';
|
|
@@ -126,6 +127,7 @@ async function processAskRequest(
|
|
|
126
127
|
google: { enabled: true },
|
|
127
128
|
openrouter: { enabled: true },
|
|
128
129
|
opencode: { enabled: true },
|
|
130
|
+
solforge: { enabled: true },
|
|
129
131
|
},
|
|
130
132
|
paths: {
|
|
131
133
|
dataDir: `${projectRoot}/.agi`,
|
|
@@ -137,11 +139,15 @@ async function processAskRequest(
|
|
|
137
139
|
|
|
138
140
|
if (request.credentials) {
|
|
139
141
|
for (const [provider, creds] of Object.entries(request.credentials)) {
|
|
140
|
-
const envKey =
|
|
142
|
+
const envKey =
|
|
143
|
+
providerEnvVar(provider as ProviderId) ??
|
|
144
|
+
`${provider.toUpperCase()}_API_KEY`;
|
|
141
145
|
process.env[envKey] = creds.apiKey;
|
|
142
146
|
}
|
|
143
147
|
} else if (request.config?.apiKey) {
|
|
144
|
-
const envKey =
|
|
148
|
+
const envKey =
|
|
149
|
+
providerEnvVar(injectedProvider) ??
|
|
150
|
+
`${injectedProvider.toUpperCase()}_API_KEY`;
|
|
145
151
|
process.env[envKey] = request.config.apiKey;
|
|
146
152
|
}
|
|
147
153
|
} else {
|
package/src/runtime/provider.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { AGIConfig, ProviderId } from '@agi-cli/sdk';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
catalog,
|
|
4
|
+
createSolforgeModel,
|
|
5
|
+
getAuth,
|
|
6
|
+
refreshToken,
|
|
7
|
+
setAuth,
|
|
8
|
+
} from '@agi-cli/sdk';
|
|
3
9
|
import { openai, createOpenAI } from '@ai-sdk/openai';
|
|
4
10
|
import { anthropic, createAnthropic } from '@ai-sdk/anthropic';
|
|
5
11
|
import { google } from '@ai-sdk/google';
|
|
@@ -159,6 +165,26 @@ export async function resolveModel(
|
|
|
159
165
|
return ocCompat(resolvedModelId);
|
|
160
166
|
return ocOpenAI(resolvedModelId);
|
|
161
167
|
}
|
|
168
|
+
if (provider === 'solforge') {
|
|
169
|
+
const privateKey = process.env.SOLFORGE_PRIVATE_KEY ?? '';
|
|
170
|
+
if (!privateKey) {
|
|
171
|
+
throw new Error(
|
|
172
|
+
'Solforge provider requires SOLFORGE_PRIVATE_KEY (base58 Solana secret).',
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
const baseURL = process.env.SOLFORGE_BASE_URL;
|
|
176
|
+
const rpcURL = process.env.SOLFORGE_SOLANA_RPC_URL;
|
|
177
|
+
const topupAmount = process.env.SOLFORGE_TOPUP_MICRO_USDC;
|
|
178
|
+
return createSolforgeModel(
|
|
179
|
+
model,
|
|
180
|
+
{ privateKey },
|
|
181
|
+
{
|
|
182
|
+
baseURL,
|
|
183
|
+
rpcURL,
|
|
184
|
+
topupAmountMicroUsdc: topupAmount,
|
|
185
|
+
},
|
|
186
|
+
);
|
|
187
|
+
}
|
|
162
188
|
throw new Error(`Unsupported provider: ${provider}`);
|
|
163
189
|
}
|
|
164
190
|
|