@xutest1/sdk 0.1.0 → 0.1.2
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 +19 -25
- package/{dist/server.js → server.js} +43 -2
- /package/{dist/client.d.ts → client.d.ts} +0 -0
- /package/{dist/client.js → client.js} +0 -0
- /package/{dist/gen → gen}/client/client.gen.d.ts +0 -0
- /package/{dist/gen → gen}/client/client.gen.js +0 -0
- /package/{dist/gen → gen}/client/index.d.ts +0 -0
- /package/{dist/gen → gen}/client/index.js +0 -0
- /package/{dist/gen → gen}/client/types.gen.d.ts +0 -0
- /package/{dist/gen → gen}/client/types.gen.js +0 -0
- /package/{dist/gen → gen}/client/utils.gen.d.ts +0 -0
- /package/{dist/gen → gen}/client/utils.gen.js +0 -0
- /package/{dist/gen → gen}/client.gen.d.ts +0 -0
- /package/{dist/gen → gen}/client.gen.js +0 -0
- /package/{dist/gen → gen}/core/auth.gen.d.ts +0 -0
- /package/{dist/gen → gen}/core/auth.gen.js +0 -0
- /package/{dist/gen → gen}/core/bodySerializer.gen.d.ts +0 -0
- /package/{dist/gen → gen}/core/bodySerializer.gen.js +0 -0
- /package/{dist/gen → gen}/core/params.gen.d.ts +0 -0
- /package/{dist/gen → gen}/core/params.gen.js +0 -0
- /package/{dist/gen → gen}/core/pathSerializer.gen.d.ts +0 -0
- /package/{dist/gen → gen}/core/pathSerializer.gen.js +0 -0
- /package/{dist/gen → gen}/core/serverSentEvents.gen.d.ts +0 -0
- /package/{dist/gen → gen}/core/serverSentEvents.gen.js +0 -0
- /package/{dist/gen → gen}/core/types.gen.d.ts +0 -0
- /package/{dist/gen → gen}/core/types.gen.js +0 -0
- /package/{dist/gen → gen}/core/utils.gen.d.ts +0 -0
- /package/{dist/gen → gen}/core/utils.gen.js +0 -0
- /package/{dist/gen → gen}/sdk.gen.d.ts +0 -0
- /package/{dist/gen → gen}/sdk.gen.js +0 -0
- /package/{dist/gen → gen}/types.gen.d.ts +0 -0
- /package/{dist/gen → gen}/types.gen.js +0 -0
- /package/{dist/index.d.ts → index.d.ts} +0 -0
- /package/{dist/index.js → index.js} +0 -0
- /package/{dist/server.d.ts → server.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,37 +1,31 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "https://json.schemastore.org/package.json",
|
|
3
2
|
"name": "@xutest1/sdk",
|
|
4
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
5
4
|
"description": "Type-safe SDK for A3Code AI coding agent",
|
|
6
5
|
"author": "A3Code",
|
|
7
6
|
"license": "MIT",
|
|
8
|
-
"keywords": ["a3code", "ai", "sdk", "coding", "agent"],
|
|
7
|
+
"keywords": ["a3code", "ai", "sdk", "coding", "agent", "vllm"],
|
|
9
8
|
"repository": {
|
|
10
9
|
"type": "git",
|
|
11
10
|
"url": "https://github.com/moonlghtriver5-svg/ae3coder"
|
|
12
11
|
},
|
|
13
12
|
"type": "module",
|
|
14
|
-
"scripts": {
|
|
15
|
-
"typecheck": "tsgo --noEmit",
|
|
16
|
-
"build": "./script/build.ts"
|
|
17
|
-
},
|
|
18
13
|
"exports": {
|
|
19
|
-
".":
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"@typescript/native-preview": "catalog:"
|
|
14
|
+
".": {
|
|
15
|
+
"import": "./index.js",
|
|
16
|
+
"types": "./index.d.ts"
|
|
17
|
+
},
|
|
18
|
+
"./client": {
|
|
19
|
+
"import": "./client.js",
|
|
20
|
+
"types": "./client.d.ts"
|
|
21
|
+
},
|
|
22
|
+
"./server": {
|
|
23
|
+
"import": "./server.js",
|
|
24
|
+
"types": "./server.d.ts"
|
|
25
|
+
}
|
|
32
26
|
},
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
}
|
|
27
|
+
"main": "./index.js",
|
|
28
|
+
"types": "./index.d.ts",
|
|
29
|
+
"files": ["*"],
|
|
30
|
+
"dependencies": {}
|
|
31
|
+
}
|
|
@@ -1,11 +1,51 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { platform, arch } from "node:os";
|
|
5
|
+
/**
|
|
6
|
+
* Find the ae3code binary - checks node_modules first, then falls back to PATH
|
|
7
|
+
*/
|
|
8
|
+
function findBinary() {
|
|
9
|
+
const os = platform();
|
|
10
|
+
const cpu = arch();
|
|
11
|
+
// Map Node.js platform/arch to package names
|
|
12
|
+
const platformMap = {
|
|
13
|
+
darwin: "darwin",
|
|
14
|
+
linux: "linux",
|
|
15
|
+
win32: "win32",
|
|
16
|
+
};
|
|
17
|
+
const archMap = {
|
|
18
|
+
arm64: "arm64",
|
|
19
|
+
x64: "x64",
|
|
20
|
+
};
|
|
21
|
+
const pkgPlatform = platformMap[os];
|
|
22
|
+
const pkgArch = archMap[cpu];
|
|
23
|
+
if (pkgPlatform && pkgArch) {
|
|
24
|
+
// Try to find in node_modules/@xutest1/{platform}-{arch}/bin/ae3code
|
|
25
|
+
const binaryName = os === "win32" ? "ae3code.exe" : "ae3code";
|
|
26
|
+
const possiblePaths = [
|
|
27
|
+
// Relative to cwd
|
|
28
|
+
join(process.cwd(), "node_modules", "@xutest1", `${pkgPlatform}-${pkgArch}`, "bin", binaryName),
|
|
29
|
+
// Relative to this file (for when SDK is in node_modules)
|
|
30
|
+
join(__dirname, "..", "..", `@xutest1`, `${pkgPlatform}-${pkgArch}`, "bin", binaryName),
|
|
31
|
+
];
|
|
32
|
+
for (const binPath of possiblePaths) {
|
|
33
|
+
if (existsSync(binPath)) {
|
|
34
|
+
return binPath;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// Fall back to PATH
|
|
39
|
+
return "ae3code";
|
|
40
|
+
}
|
|
2
41
|
export async function createOpencodeServer(options) {
|
|
3
42
|
options = Object.assign({
|
|
4
43
|
hostname: "127.0.0.1",
|
|
5
44
|
port: 4096,
|
|
6
45
|
timeout: 5000,
|
|
7
46
|
}, options ?? {});
|
|
8
|
-
const
|
|
47
|
+
const binaryPath = findBinary();
|
|
48
|
+
const proc = spawn(binaryPath, [`serve`, `--hostname=${options.hostname}`, `--port=${options.port}`], {
|
|
9
49
|
signal: options.signal,
|
|
10
50
|
env: {
|
|
11
51
|
...process.env,
|
|
@@ -75,7 +115,8 @@ export function createOpencodeTui(options) {
|
|
|
75
115
|
if (options?.agent) {
|
|
76
116
|
args.push(`--agent=${options.agent}`);
|
|
77
117
|
}
|
|
78
|
-
const
|
|
118
|
+
const binaryPath = findBinary();
|
|
119
|
+
const proc = spawn(binaryPath, args, {
|
|
79
120
|
signal: options?.signal,
|
|
80
121
|
stdio: "inherit",
|
|
81
122
|
env: {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|