@agi-cli/server 0.1.150 → 0.1.151
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.151",
|
|
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.151",
|
|
33
|
+
"@agi-cli/database": "0.1.151",
|
|
34
34
|
"drizzle-orm": "^0.44.5",
|
|
35
35
|
"hono": "^4.9.9",
|
|
36
36
|
"zod": "^4.1.8"
|
package/src/routes/git/commit.ts
CHANGED
|
@@ -101,7 +101,7 @@ export function registerCommitRoutes(app: Hono) {
|
|
|
101
101
|
let provider = (config.defaults?.provider || 'anthropic') as ProviderId;
|
|
102
102
|
|
|
103
103
|
if (sessionId) {
|
|
104
|
-
const db = getDb();
|
|
104
|
+
const db = await getDb();
|
|
105
105
|
const [session] = await db
|
|
106
106
|
.select({ provider: sessions.provider })
|
|
107
107
|
.from(sessions)
|
|
@@ -40,7 +40,7 @@ export async function resolveModel(
|
|
|
40
40
|
return resolveOpencodeModel(model, cfg);
|
|
41
41
|
}
|
|
42
42
|
if (provider === 'setu') {
|
|
43
|
-
return resolveSetuModel(model, options?.sessionId, {
|
|
43
|
+
return await resolveSetuModel(model, options?.sessionId, {
|
|
44
44
|
messageId: options?.messageId,
|
|
45
45
|
topupApprovalMode: options?.topupApprovalMode,
|
|
46
46
|
});
|
|
@@ -2,6 +2,8 @@ import {
|
|
|
2
2
|
createSetuModel,
|
|
3
3
|
catalog,
|
|
4
4
|
type SetuPaymentCallbacks,
|
|
5
|
+
getAuth,
|
|
6
|
+
loadConfig,
|
|
5
7
|
} from '@agi-cli/sdk';
|
|
6
8
|
import { publish } from '../../events/bus.ts';
|
|
7
9
|
import {
|
|
@@ -21,12 +23,26 @@ export interface ResolveSetuModelOptions {
|
|
|
21
23
|
topupApprovalMode?: 'auto' | 'approval';
|
|
22
24
|
}
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
async function getSetuPrivateKey(): Promise<string> {
|
|
27
|
+
if (process.env.SETU_PRIVATE_KEY) {
|
|
28
|
+
return process.env.SETU_PRIVATE_KEY;
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
const cfg = await loadConfig(process.cwd());
|
|
32
|
+
const auth = await getAuth('setu', cfg.projectRoot);
|
|
33
|
+
if (auth?.type === 'wallet' && auth.secret) {
|
|
34
|
+
return auth.secret;
|
|
35
|
+
}
|
|
36
|
+
} catch {}
|
|
37
|
+
return '';
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export async function resolveSetuModel(
|
|
25
41
|
model: string,
|
|
26
42
|
sessionId?: string,
|
|
27
43
|
options: ResolveSetuModelOptions = {},
|
|
28
44
|
) {
|
|
29
|
-
const privateKey =
|
|
45
|
+
const privateKey = await getSetuPrivateKey();
|
|
30
46
|
if (!privateKey) {
|
|
31
47
|
throw new Error(
|
|
32
48
|
'Setu provider requires SETU_PRIVATE_KEY (base58 Solana secret).',
|