@crewx/sdk 0.8.3-rc.1 → 0.8.3-rc.3
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/dist/esm/index.js +46 -35
- package/dist/index.d.ts +4 -1
- package/dist/index.js +46 -35
- package/dist/provider/adapter.types.d.ts +19 -0
- package/dist/provider/adapters/claude.d.ts +2 -0
- package/dist/provider/adapters/codex.d.ts +2 -0
- package/dist/provider/adapters/copilot.d.ts +2 -0
- package/dist/provider/adapters/gemini.d.ts +2 -0
- package/dist/provider/adapters/index.d.ts +7 -0
- package/dist/provider/adapters/opencode.d.ts +2 -0
- package/dist/provider/bridge.d.ts +2 -1
- package/package.json +16 -14
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ProviderQueryOptions, ProviderUsage } from './bridge.js';
|
|
2
|
+
export interface CliProviderAdapter {
|
|
3
|
+
readonly command: string;
|
|
4
|
+
buildArgs(message: string, options: ProviderQueryOptions, isExecute: boolean): {
|
|
5
|
+
args: string[];
|
|
6
|
+
stdinMessage?: string;
|
|
7
|
+
};
|
|
8
|
+
extractText(stdout: string): string;
|
|
9
|
+
extractFailure?(line: string): Error | null;
|
|
10
|
+
interpretExit?(code: number, stderr: string): Error | null;
|
|
11
|
+
parseResultMeta?(stdout: string): {
|
|
12
|
+
usage?: ProviderUsage | null;
|
|
13
|
+
model?: string | null;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export declare class RateLimitError extends Error {
|
|
17
|
+
readonly name = "RateLimitError";
|
|
18
|
+
constructor(message: string);
|
|
19
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CliProviderAdapter } from '../adapter.types.js';
|
|
2
|
+
export { claudeAdapter } from './claude.js';
|
|
3
|
+
export { geminiAdapter } from './gemini.js';
|
|
4
|
+
export { copilotAdapter } from './copilot.js';
|
|
5
|
+
export { codexAdapter } from './codex.js';
|
|
6
|
+
export { opencodeAdapter } from './opencode.js';
|
|
7
|
+
export declare const BUILTIN_ADAPTERS: Record<string, CliProviderAdapter>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { CliProviderAdapter } from './adapter.types.js';
|
|
1
2
|
export declare function parseStreamJsonOutput(raw: string): string;
|
|
2
3
|
export declare function parseResultEventUsage(raw: string): ProviderUsage | null;
|
|
3
4
|
export declare class ProviderError extends Error {
|
|
@@ -20,7 +21,7 @@ export interface RunCliProcessOptions {
|
|
|
20
21
|
onUsage?: (usage: ProviderUsage) => void;
|
|
21
22
|
onModel?: (model: string) => void;
|
|
22
23
|
}
|
|
23
|
-
export declare function runCliProcess(command: string, args: string[], providerStr: string, _providerId: string, options?: RunCliProcessOptions, stdinMessage?: string): Promise<{
|
|
24
|
+
export declare function runCliProcess(command: string, args: string[], providerStr: string, _providerId: string, options?: RunCliProcessOptions, stdinMessage?: string, adapter?: CliProviderAdapter): Promise<{
|
|
24
25
|
stdout: string;
|
|
25
26
|
parsed: string;
|
|
26
27
|
}>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crewx/sdk",
|
|
3
|
-
"version": "0.8.3-rc.
|
|
3
|
+
"version": "0.8.3-rc.3",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20.19.0"
|
|
@@ -68,6 +68,20 @@
|
|
|
68
68
|
"src/schemas/**/*.json",
|
|
69
69
|
"README.md"
|
|
70
70
|
],
|
|
71
|
+
"scripts": {
|
|
72
|
+
"build:cjs": "npx tsup --config tsup.cjs.js",
|
|
73
|
+
"build:esm": "npx tsup --config tsup.esm.js",
|
|
74
|
+
"build:browser": "npx tsup --config tsup.browser.js",
|
|
75
|
+
"build:dts": "tsc -p tsconfig.dts.json",
|
|
76
|
+
"build": "pnpm run build:cjs && pnpm run build:esm && pnpm run build:browser && pnpm run build:dts && node scripts/copy-migrations.mjs",
|
|
77
|
+
"db:generate": "cd ../.. && drizzle-kit generate --config drizzle.config.ts && node packages/sdk/scripts/post-generate.mjs",
|
|
78
|
+
"db:check": "cd ../.. && drizzle-kit check --config drizzle.config.ts",
|
|
79
|
+
"prepare": "pnpm run build",
|
|
80
|
+
"prepack": "node scripts/check-sdk-templates.mjs",
|
|
81
|
+
"test": "vitest run --config ./vitest.config.ts",
|
|
82
|
+
"test:watch": "vitest --config ./vitest.config.ts",
|
|
83
|
+
"lint": "echo 'SDK lint pending' && exit 0"
|
|
84
|
+
},
|
|
71
85
|
"dependencies": {
|
|
72
86
|
"@modelcontextprotocol/sdk": "^1.27.0",
|
|
73
87
|
"ai": "^4.0.0",
|
|
@@ -94,17 +108,5 @@
|
|
|
94
108
|
"tsup": "^8.5.1",
|
|
95
109
|
"typescript": "^5.4.0",
|
|
96
110
|
"vitest": "^3.1.1"
|
|
97
|
-
},
|
|
98
|
-
"scripts": {
|
|
99
|
-
"build:cjs": "npx tsup --config tsup.cjs.js",
|
|
100
|
-
"build:esm": "npx tsup --config tsup.esm.js",
|
|
101
|
-
"build:browser": "npx tsup --config tsup.browser.js",
|
|
102
|
-
"build:dts": "tsc -p tsconfig.dts.json",
|
|
103
|
-
"build": "pnpm run build:cjs && pnpm run build:esm && pnpm run build:browser && pnpm run build:dts && node scripts/copy-migrations.mjs",
|
|
104
|
-
"db:generate": "cd ../.. && drizzle-kit generate --config drizzle.config.ts && node packages/sdk/scripts/post-generate.mjs",
|
|
105
|
-
"db:check": "cd ../.. && drizzle-kit check --config drizzle.config.ts",
|
|
106
|
-
"test": "vitest run --config ./vitest.config.ts",
|
|
107
|
-
"test:watch": "vitest --config ./vitest.config.ts",
|
|
108
|
-
"lint": "echo 'SDK lint pending' && exit 0"
|
|
109
111
|
}
|
|
110
|
-
}
|
|
112
|
+
}
|