@agi-cli/sdk 0.1.171 → 0.1.172
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 +1 -1
- package/src/auth/src/copilot-oauth.ts +1 -1
- package/src/browser.ts +1 -0
- package/src/core/src/tools/builtin/fs/tree.ts +7 -1
- package/src/core/src/tools/builtin/fs/tree.txt +4 -1
- package/src/providers/src/catalog-manual.ts +11 -0
- package/src/providers/src/setu-client.ts +10 -0
- package/src/providers/src/utils.ts +8 -24
package/package.json
CHANGED
package/src/browser.ts
CHANGED
|
@@ -58,7 +58,13 @@ async function walkTree(
|
|
|
58
58
|
files += sub.files;
|
|
59
59
|
} else {
|
|
60
60
|
files++;
|
|
61
|
-
|
|
61
|
+
let lineCount = '';
|
|
62
|
+
try {
|
|
63
|
+
const content = await fs.readFile(join(dir, entry.name), 'utf-8');
|
|
64
|
+
const count = content.split('\n').length;
|
|
65
|
+
lineCount = ` (${count} lines)`;
|
|
66
|
+
} catch {}
|
|
67
|
+
lines.push(`${prefix}${connector}${entry.name}${lineCount}`);
|
|
62
68
|
}
|
|
63
69
|
}
|
|
64
70
|
} catch {
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
- Render a
|
|
1
|
+
- Render a directory tree from a starting path with line counts for each file
|
|
2
2
|
- Accepts absolute, home, or project-relative paths
|
|
3
3
|
- Skips common build/cache folders (node_modules, dist, .git, etc.) by default
|
|
4
4
|
- Depth is capped to avoid excessive output (1–5)
|
|
5
|
+
- Each file shows its line count (e.g. "index.ts (42 lines)")
|
|
5
6
|
|
|
6
7
|
Usage tips:
|
|
7
8
|
- Use the LS tool for a flat listing of one directory
|
|
8
9
|
- Use the Glob and Grep tools for file pattern and content searches respectively
|
|
10
|
+
- Pay attention to line counts: files over 500 lines are large — prefer reading specific line ranges (startLine/endLine) or use Grep to find relevant sections instead of reading the entire file
|
|
11
|
+
- Files over 2000 lines can consume significant context — always use targeted reads or search tools for these
|
|
@@ -24,6 +24,11 @@ const isAllowedAnthropicModel = (id: string): boolean => {
|
|
|
24
24
|
return false;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
+
const isAllowedGoogleModel = (id: string): boolean => {
|
|
28
|
+
if (id.startsWith('gemini-3')) return true;
|
|
29
|
+
return false;
|
|
30
|
+
};
|
|
31
|
+
|
|
27
32
|
const SETU_SOURCES: Array<{
|
|
28
33
|
id: ProviderId;
|
|
29
34
|
npm: string;
|
|
@@ -44,6 +49,11 @@ const SETU_SOURCES: Array<{
|
|
|
44
49
|
npm: '@ai-sdk/openai-compatible',
|
|
45
50
|
family: 'moonshot',
|
|
46
51
|
},
|
|
52
|
+
{
|
|
53
|
+
id: 'google',
|
|
54
|
+
npm: '@ai-sdk/google',
|
|
55
|
+
family: 'google',
|
|
56
|
+
},
|
|
47
57
|
];
|
|
48
58
|
|
|
49
59
|
function cloneModel(model: ModelInfo): ModelInfo {
|
|
@@ -71,6 +81,7 @@ function buildSetuEntry(base: CatalogMap): ProviderCatalogEntry | null {
|
|
|
71
81
|
const sourceModels = allModels.filter((model) => {
|
|
72
82
|
if (id === 'openai') return isAllowedOpenAIModel(model.id);
|
|
73
83
|
if (id === 'anthropic') return isAllowedAnthropicModel(model.id);
|
|
84
|
+
if (id === 'google') return isAllowedGoogleModel(model.id);
|
|
74
85
|
return true;
|
|
75
86
|
});
|
|
76
87
|
return sourceModels.map((model) => {
|
|
@@ -8,6 +8,7 @@ import nacl from 'tweetnacl';
|
|
|
8
8
|
import { createOpenAI } from '@ai-sdk/openai';
|
|
9
9
|
import { createAnthropic } from '@ai-sdk/anthropic';
|
|
10
10
|
import { createOpenAICompatible } from '@ai-sdk/openai-compatible';
|
|
11
|
+
import { createGoogleGenerativeAI } from '@ai-sdk/google';
|
|
11
12
|
import { addAnthropicCacheControl } from './anthropic-caching.ts';
|
|
12
13
|
|
|
13
14
|
function simplifyPaymentError(errMsg: string): string {
|
|
@@ -307,6 +308,15 @@ export function createSetuModel(
|
|
|
307
308
|
return compatible(model);
|
|
308
309
|
}
|
|
309
310
|
|
|
311
|
+
if (providerNpm === '@ai-sdk/google') {
|
|
312
|
+
const google = createGoogleGenerativeAI({
|
|
313
|
+
baseURL,
|
|
314
|
+
apiKey: 'setu-wallet-auth',
|
|
315
|
+
fetch: customFetch,
|
|
316
|
+
});
|
|
317
|
+
return google(model);
|
|
318
|
+
}
|
|
319
|
+
|
|
310
320
|
// Default to OpenAI
|
|
311
321
|
const openai = createOpenAI({
|
|
312
322
|
baseURL,
|
|
@@ -25,30 +25,14 @@ export function hasModel(
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
const PREFERRED_FAST_MODELS: Partial<Record<ProviderId, string[]>> = {
|
|
28
|
-
openai: ['gpt-
|
|
29
|
-
anthropic: [
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
],
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
'gemini-2.0-flash',
|
|
37
|
-
'gemini-2.5-flash-lite',
|
|
38
|
-
],
|
|
39
|
-
openrouter: [
|
|
40
|
-
'anthropic/claude-3.5-haiku',
|
|
41
|
-
'openai/gpt-4o-mini',
|
|
42
|
-
'google/gemini-2.0-flash-001',
|
|
43
|
-
],
|
|
44
|
-
opencode: ['claude-3-5-haiku', 'gpt-5-nano', 'gemini-3-flash'],
|
|
45
|
-
setu: [
|
|
46
|
-
'claude-3-5-haiku-latest',
|
|
47
|
-
'claude-3-5-haiku-20241022',
|
|
48
|
-
'codex-mini-latest',
|
|
49
|
-
],
|
|
50
|
-
zai: ['glm-4.5-flash', 'glm-4.5-air'],
|
|
51
|
-
copilot: ['gpt-4o-mini', 'gpt-4.1-nano', 'gpt-4.1-mini'],
|
|
28
|
+
openai: ['gpt-4.1-mini'],
|
|
29
|
+
anthropic: ['claude-3-5-haiku-latest'],
|
|
30
|
+
google: ['gemini-2.0-flash-lite'],
|
|
31
|
+
openrouter: ['anthropic/claude-3.5-haiku'],
|
|
32
|
+
opencode: ['claude-3-5-haiku'],
|
|
33
|
+
setu: ['claude-3-5-haiku-latest'],
|
|
34
|
+
zai: ['glm-4.5-flash'],
|
|
35
|
+
copilot: ['gpt-4.1-mini'],
|
|
52
36
|
};
|
|
53
37
|
|
|
54
38
|
export function getFastModel(provider: ProviderId): string | undefined {
|