@ottocode/server 0.1.211 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ottocode/server",
3
- "version": "0.1.211",
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.211",
53
- "@ottocode/database": "0.1.211",
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"
@@ -10,14 +10,7 @@ import { resolveBinary } from '@ottocode/sdk/tools/bin-manager';
10
10
 
11
11
  const execAsync = promisify(exec);
12
12
 
13
- const EXCLUDED_FILES = new Set([
14
- '.DS_Store',
15
- 'bun.lockb',
16
- '.env',
17
- '.env.local',
18
- '.env.production',
19
- '.env.development',
20
- ]);
13
+ const EXCLUDED_FILES = new Set(['.DS_Store', 'bun.lockb']);
21
14
 
22
15
  const EXCLUDED_DIRS = new Set([
23
16
  'node_modules',
@@ -35,6 +28,13 @@ const EXCLUDED_DIRS = new Set([
35
28
  '.cache',
36
29
  '__pycache__',
37
30
  '.tsbuildinfo',
31
+ 'target',
32
+ '.cargo',
33
+ '.rustup',
34
+ 'vendor',
35
+ '.gradle',
36
+ '.idea',
37
+ '.vscode',
38
38
  ]);
39
39
 
40
40
  function shouldExcludeFile(name: string): boolean {
@@ -53,10 +53,13 @@ async function listFilesWithRg(
53
53
  const rgBin = await resolveBinary('rg');
54
54
 
55
55
  return new Promise((resolve) => {
56
- const args = ['--files', '--hidden', '--glob', '!.git/', '--sort', 'path'];
56
+ const args = ['--files', '--hidden', '--glob', '!.*/', '--sort', 'path'];
57
57
  if (includeIgnored) {
58
58
  args.push('--no-ignore');
59
59
  }
60
+ for (const dir of EXCLUDED_DIRS) {
61
+ args.push('--glob', `!**/${dir}/`);
62
+ }
60
63
 
61
64
  const proc = spawn(rgBin, args, { cwd: projectRoot });
62
65
  let stdout = '';
@@ -269,7 +272,7 @@ export function registerFilesRoutes(app: Hono) {
269
272
  try {
270
273
  const projectRoot = c.req.query('project') || process.cwd();
271
274
  const maxDepth = Number.parseInt(c.req.query('maxDepth') || '10', 10);
272
- const limit = Number.parseInt(c.req.query('limit') || '1000', 10);
275
+ const limit = Number.parseInt(c.req.query('limit') || '10000', 10);
273
276
 
274
277
  let result = await listFilesWithRg(projectRoot, limit, true);
275
278
 
@@ -336,11 +339,9 @@ export function registerFilesRoutes(app: Hono) {
336
339
  }> = [];
337
340
 
338
341
  for (const entry of entries) {
339
- if (entry.name.startsWith('.') && entry.name !== '.otto') continue;
340
342
  const relPath = relative(projectRoot, join(targetDir, entry.name));
341
343
 
342
344
  if (entry.isDirectory()) {
343
- if (shouldExcludeDir(entry.name)) continue;
344
345
  const ignored = matchesGitignorePattern(relPath, gitignorePatterns);
345
346
  items.push({
346
347
  name: entry.name,
@@ -1,10 +1,11 @@
1
1
  import {
2
- createSetuModel,
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 providerNpm = getProviderNpm(model);
126
-
127
- return createSetuModel(
128
- model,
129
- { privateKey },
130
- {
131
- baseURL,
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
  }