@agi-cli/sdk 0.1.138 → 0.1.140
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/core/src/index.ts +1 -1
- package/src/core/src/tools/builtin/bash.ts +1 -1
- package/src/core/src/tools/builtin/edit.ts +1 -1
- package/src/core/src/tools/builtin/finish.ts +1 -1
- package/src/core/src/tools/builtin/fs/cd.ts +1 -1
- package/src/core/src/tools/builtin/fs/ls.ts +1 -1
- package/src/core/src/tools/builtin/fs/pwd.ts +1 -1
- package/src/core/src/tools/builtin/fs/read.ts +1 -1
- package/src/core/src/tools/builtin/fs/tree.ts +1 -1
- package/src/core/src/tools/builtin/fs/write.ts +1 -1
- package/src/core/src/tools/builtin/git.ts +2 -2
- package/src/core/src/tools/builtin/glob.ts +1 -1
- package/src/core/src/tools/builtin/grep.ts +1 -1
- package/src/core/src/tools/builtin/patch.ts +1 -1
- package/src/core/src/tools/builtin/progress.ts +1 -1
- package/src/core/src/tools/builtin/ripgrep.ts +1 -1
- package/src/core/src/tools/builtin/terminal.ts +1 -1
- package/src/core/src/tools/builtin/todos.ts +1 -1
- package/src/core/src/tools/builtin/websearch.ts +1 -1
- package/src/core/src/tools/loader.ts +1 -1
- package/src/index.ts +5 -1
- package/src/prompts/src/providers.ts +17 -14
- package/src/providers/src/catalog.ts +268 -268
- package/src/providers/src/index.ts +4 -0
- package/src/providers/src/openai-oauth-client.ts +5 -1
- package/src/providers/src/opencode-client.ts +2 -18
- package/src/providers/src/openrouter-client.ts +3 -2
- package/src/providers/src/utils.ts +42 -2
- package/src/skills/tool.ts +1 -1
- package/src/types/src/provider.ts +1 -1
package/package.json
CHANGED
package/src/core/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { tool, type Tool } from 'ai';
|
|
2
|
-
import { z } from 'zod';
|
|
2
|
+
import { z } from 'zod/v3';
|
|
3
3
|
import { spawn } from 'node:child_process';
|
|
4
4
|
import DESCRIPTION from './bash.txt' with { type: 'text' };
|
|
5
5
|
import { createToolError, type ToolResponse } from '../error.ts';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { tool, type Tool } from 'ai';
|
|
2
|
-
import { z } from 'zod';
|
|
2
|
+
import { z } from 'zod/v3';
|
|
3
3
|
import { readFile } from 'node:fs/promises';
|
|
4
4
|
import { expandTilde, isAbsoluteLike, resolveSafePath } from './util.ts';
|
|
5
5
|
import DESCRIPTION from './read.txt' with { type: 'text' };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { tool, type Tool } from 'ai';
|
|
2
|
-
import { z } from 'zod';
|
|
2
|
+
import { z } from 'zod/v3';
|
|
3
3
|
import { exec } from 'node:child_process';
|
|
4
4
|
import { promisify } from 'node:util';
|
|
5
5
|
import GIT_STATUS_DESCRIPTION from './git.status.txt' with { type: 'text' };
|
|
@@ -37,7 +37,7 @@ export function buildGitTools(
|
|
|
37
37
|
|
|
38
38
|
const git_status = tool({
|
|
39
39
|
description: GIT_STATUS_DESCRIPTION,
|
|
40
|
-
inputSchema: z.object({})
|
|
40
|
+
inputSchema: z.object({}),
|
|
41
41
|
async execute(): Promise<
|
|
42
42
|
ToolResponse<{ staged: number; unstaged: number; raw: string[] }>
|
|
43
43
|
> {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { tool, type Tool } from 'ai';
|
|
2
|
-
import { z } from 'zod';
|
|
2
|
+
import { z } from 'zod/v3';
|
|
3
3
|
import DESCRIPTION from './patch.txt' with { type: 'text' };
|
|
4
4
|
import { createToolError, type ToolResponse } from '../error.ts';
|
|
5
5
|
import { applyPatchOperations } from './patch/apply.ts';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { tool, type Tool } from 'ai';
|
|
2
|
-
import { z } from 'zod';
|
|
2
|
+
import { z } from 'zod/v3';
|
|
3
3
|
import DESCRIPTION from './terminal.txt' with { type: 'text' };
|
|
4
4
|
import { createToolError } from '../error.ts';
|
|
5
5
|
import type { TerminalManager } from '../../terminals/index.ts';
|
package/src/index.ts
CHANGED
|
@@ -44,7 +44,11 @@ export {
|
|
|
44
44
|
getFastModelForAuth,
|
|
45
45
|
getModelNpmBinding,
|
|
46
46
|
isAnthropicBasedModel,
|
|
47
|
+
getUnderlyingProviderKey,
|
|
48
|
+
getModelInfo,
|
|
49
|
+
modelSupportsReasoning,
|
|
47
50
|
} from './providers/src/index.ts';
|
|
51
|
+
export type { UnderlyingProviderKey } from './providers/src/index.ts';
|
|
48
52
|
export {
|
|
49
53
|
isProviderAuthorized,
|
|
50
54
|
ensureProviderEnv,
|
|
@@ -165,7 +169,7 @@ export {
|
|
|
165
169
|
streamObject,
|
|
166
170
|
tool,
|
|
167
171
|
} from './core/src/index.ts';
|
|
168
|
-
export type {
|
|
172
|
+
export type { ModelMessage, Tool } from './core/src/index.ts';
|
|
169
173
|
// Re-export from AI SDK
|
|
170
174
|
export type { ToolCallPart } from 'ai';
|
|
171
175
|
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
// Loads src/prompts/providers/<provider>.txt and returns its contents (trimmed).
|
|
3
3
|
|
|
4
4
|
import { debugLog } from './debug.ts';
|
|
5
|
+
import { getModelNpmBinding, isProviderId } from '../../providers/src/utils.ts';
|
|
6
|
+
import type { ProviderId } from '../../types/src/index.ts';
|
|
5
7
|
// Embed default provider prompts into the binary via text imports
|
|
6
8
|
// Only user-defined overrides should be read from disk.
|
|
7
9
|
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
|
|
@@ -22,18 +24,14 @@ function sanitizeModelId(modelId: string): string {
|
|
|
22
24
|
.replace(/[/]+/g, '__');
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
function inferFamilyFromModel(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
// if (m.includes('mistral')) return 'mistral';
|
|
34
|
-
// if (m.includes('deepseek')) return 'deepseek';
|
|
35
|
-
// if (m.includes('qwen')) return 'qwen';
|
|
36
|
-
// if (m.includes('moonshot') || m.includes('kimi')) return 'moonshot';
|
|
27
|
+
function inferFamilyFromModel(
|
|
28
|
+
provider: ProviderId,
|
|
29
|
+
modelId: string,
|
|
30
|
+
): string | undefined {
|
|
31
|
+
const npm = getModelNpmBinding(provider, modelId);
|
|
32
|
+
if (npm === '@ai-sdk/anthropic') return 'anthropic';
|
|
33
|
+
if (npm === '@ai-sdk/openai') return 'openai';
|
|
34
|
+
if (npm === '@ai-sdk/google') return 'google';
|
|
37
35
|
return undefined;
|
|
38
36
|
}
|
|
39
37
|
|
|
@@ -66,10 +64,15 @@ export async function providerBasePrompt(
|
|
|
66
64
|
|
|
67
65
|
// 2) Provider-family fallback for openrouter/opencode/solforge using embedded defaults
|
|
68
66
|
if (
|
|
69
|
-
(id
|
|
67
|
+
isProviderId(id) &&
|
|
68
|
+
(id === 'openrouter' ||
|
|
69
|
+
id === 'opencode' ||
|
|
70
|
+
id === 'solforge' ||
|
|
71
|
+
id === 'zai' ||
|
|
72
|
+
id === 'zai-coding') &&
|
|
70
73
|
modelId
|
|
71
74
|
) {
|
|
72
|
-
const family = inferFamilyFromModel(modelId);
|
|
75
|
+
const family = inferFamilyFromModel(id, modelId);
|
|
73
76
|
if (family) {
|
|
74
77
|
const embedded = (
|
|
75
78
|
family === 'openai'
|