@ottocode/server 0.1.212 → 0.1.213
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 +3 -3
- package/src/runtime/provider/setu.ts +13 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ottocode/server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.213",
|
|
4
4
|
"description": "HTTP API server for ottocode",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"typecheck": "tsc --noEmit"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@ottocode/sdk": "0.1.
|
|
53
|
-
"@ottocode/database": "0.1.
|
|
52
|
+
"@ottocode/sdk": "0.1.213",
|
|
53
|
+
"@ottocode/database": "0.1.213",
|
|
54
54
|
"drizzle-orm": "^0.44.5",
|
|
55
55
|
"hono": "^4.9.9",
|
|
56
56
|
"zod": "^4.1.8"
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
catalog,
|
|
2
|
+
createSetu,
|
|
4
3
|
type SetuPaymentCallbacks,
|
|
5
4
|
getAuth,
|
|
6
5
|
loadConfig,
|
|
7
6
|
} from '@ottocode/sdk';
|
|
7
|
+
import { devToolsMiddleware } from '@ai-sdk/devtools';
|
|
8
|
+
import { isDebugEnabled } from '../debug/index.ts';
|
|
8
9
|
import { publish } from '../../events/bus.ts';
|
|
9
10
|
import {
|
|
10
11
|
waitForTopupMethodSelection,
|
|
@@ -13,11 +14,6 @@ import {
|
|
|
13
14
|
|
|
14
15
|
const MIN_TOPUP_USD = 5;
|
|
15
16
|
|
|
16
|
-
function getProviderNpm(model: string): string | undefined {
|
|
17
|
-
const entry = catalog.setu?.models?.find((m) => m.id === model);
|
|
18
|
-
return entry?.provider?.npm;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
17
|
export interface ResolveSetuModelOptions {
|
|
22
18
|
messageId?: string;
|
|
23
19
|
topupApprovalMode?: 'auto' | 'approval';
|
|
@@ -122,18 +118,17 @@ export async function resolveSetuModel(
|
|
|
122
118
|
}
|
|
123
119
|
: {};
|
|
124
120
|
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
rpcURL,
|
|
133
|
-
callbacks,
|
|
134
|
-
providerNpm,
|
|
121
|
+
const setu = createSetu({
|
|
122
|
+
auth: { privateKey },
|
|
123
|
+
baseURL,
|
|
124
|
+
rpcURL,
|
|
125
|
+
callbacks,
|
|
126
|
+
middleware: isDebugEnabled() ? devToolsMiddleware() : undefined,
|
|
127
|
+
payment: {
|
|
135
128
|
topupApprovalMode,
|
|
136
129
|
autoPayThresholdUsd,
|
|
137
130
|
},
|
|
138
|
-
);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
return setu.model(model);
|
|
139
134
|
}
|