@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.
Files changed (35) hide show
  1. package/package.json +19 -25
  2. package/{dist/server.js → server.js} +43 -2
  3. /package/{dist/client.d.ts → client.d.ts} +0 -0
  4. /package/{dist/client.js → client.js} +0 -0
  5. /package/{dist/gen → gen}/client/client.gen.d.ts +0 -0
  6. /package/{dist/gen → gen}/client/client.gen.js +0 -0
  7. /package/{dist/gen → gen}/client/index.d.ts +0 -0
  8. /package/{dist/gen → gen}/client/index.js +0 -0
  9. /package/{dist/gen → gen}/client/types.gen.d.ts +0 -0
  10. /package/{dist/gen → gen}/client/types.gen.js +0 -0
  11. /package/{dist/gen → gen}/client/utils.gen.d.ts +0 -0
  12. /package/{dist/gen → gen}/client/utils.gen.js +0 -0
  13. /package/{dist/gen → gen}/client.gen.d.ts +0 -0
  14. /package/{dist/gen → gen}/client.gen.js +0 -0
  15. /package/{dist/gen → gen}/core/auth.gen.d.ts +0 -0
  16. /package/{dist/gen → gen}/core/auth.gen.js +0 -0
  17. /package/{dist/gen → gen}/core/bodySerializer.gen.d.ts +0 -0
  18. /package/{dist/gen → gen}/core/bodySerializer.gen.js +0 -0
  19. /package/{dist/gen → gen}/core/params.gen.d.ts +0 -0
  20. /package/{dist/gen → gen}/core/params.gen.js +0 -0
  21. /package/{dist/gen → gen}/core/pathSerializer.gen.d.ts +0 -0
  22. /package/{dist/gen → gen}/core/pathSerializer.gen.js +0 -0
  23. /package/{dist/gen → gen}/core/serverSentEvents.gen.d.ts +0 -0
  24. /package/{dist/gen → gen}/core/serverSentEvents.gen.js +0 -0
  25. /package/{dist/gen → gen}/core/types.gen.d.ts +0 -0
  26. /package/{dist/gen → gen}/core/types.gen.js +0 -0
  27. /package/{dist/gen → gen}/core/utils.gen.d.ts +0 -0
  28. /package/{dist/gen → gen}/core/utils.gen.js +0 -0
  29. /package/{dist/gen → gen}/sdk.gen.d.ts +0 -0
  30. /package/{dist/gen → gen}/sdk.gen.js +0 -0
  31. /package/{dist/gen → gen}/types.gen.d.ts +0 -0
  32. /package/{dist/gen → gen}/types.gen.js +0 -0
  33. /package/{dist/index.d.ts → index.d.ts} +0 -0
  34. /package/{dist/index.js → index.js} +0 -0
  35. /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.0",
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
- ".": "./src/index.ts",
20
- "./client": "./src/client.ts",
21
- "./server": "./src/server.ts"
22
- },
23
- "files": [
24
- "dist"
25
- ],
26
- "devDependencies": {
27
- "@hey-api/openapi-ts": "0.81.0",
28
- "@tsconfig/node22": "catalog:",
29
- "@types/node": "catalog:",
30
- "typescript": "catalog:",
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
- "dependencies": {},
34
- "publishConfig": {
35
- "directory": "dist"
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 proc = spawn(`ae3code`, [`serve`, `--hostname=${options.hostname}`, `--port=${options.port}`], {
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 proc = spawn(`ae3code`, args, {
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