@xutest1/sdk 0.0.4 → 0.0.6

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.
@@ -37,6 +37,7 @@ export const createClient = (config = {}) => {
37
37
  return { opts, url };
38
38
  };
39
39
  const request = async (options) => {
40
+ // @ts-expect-error
40
41
  const { opts, url } = await beforeRequest(options);
41
42
  const requestInit = {
42
43
  redirect: "follow",
package/dist/server.d.ts CHANGED
@@ -14,6 +14,7 @@ export type TuiOptions = {
14
14
  agent?: string;
15
15
  signal?: AbortSignal;
16
16
  config?: Config;
17
+ cwd?: string;
17
18
  };
18
19
  export declare function createOpencodeServer(options?: ServerOptions): Promise<{
19
20
  url: string;
package/dist/server.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import { spawn } from "node:child_process";
2
2
  import { existsSync } from "node:fs";
3
- import { join, dirname } from "node:path";
3
+ import { dirname, join } from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
- // Find the ae3code binary from optionalDependencies
6
5
  function findBinary() {
7
6
  const platform = process.platform;
8
7
  const arch = process.arch;
@@ -20,29 +19,23 @@ function findBinary() {
20
19
  return 'ae3code';
21
20
  }
22
21
  const binaryName = platform === 'win32' ? 'ae3code.exe' : 'ae3code';
23
- // Try to find in node_modules relative to this file
24
22
  const __dirname = dirname(fileURLToPath(import.meta.url));
25
23
  const possiblePaths = [
26
- // When installed as dependency: node_modules/@xutest1/sdk/dist -> node_modules/@xutest1/darwin-arm64/bin
27
24
  join(__dirname, '..', '..', pkgName, 'bin', binaryName),
28
- // Alternative path
29
25
  join(__dirname, '..', '..', '..', pkgName, 'bin', binaryName),
30
- // From cwd
31
26
  join(process.cwd(), 'node_modules', pkgName, 'bin', binaryName),
32
27
  ];
33
28
  for (const p of possiblePaths) {
34
- if (existsSync(p)) {
29
+ if (existsSync(p))
35
30
  return p;
36
- }
37
31
  }
38
- // Fallback to PATH
39
32
  return 'ae3code';
40
33
  }
41
34
  export async function createOpencodeServer(options) {
42
35
  options = Object.assign({
43
36
  hostname: "127.0.0.1",
44
37
  port: 4096,
45
- timeout: 5000,
38
+ timeout: 10000,
46
39
  }, options ?? {});
47
40
  const binaryPath = findBinary();
48
41
  const cwd = options.cwd || process.cwd();
@@ -118,9 +111,11 @@ export function createOpencodeTui(options) {
118
111
  args.push(`--agent=${options.agent}`);
119
112
  }
120
113
  const binaryPath = findBinary();
114
+ const cwd = options?.cwd || process.cwd();
121
115
  const proc = spawn(binaryPath, args, {
122
116
  signal: options?.signal,
123
117
  stdio: "inherit",
118
+ cwd,
124
119
  env: {
125
120
  ...process.env,
126
121
  AE3CODE_CONFIG_CONTENT: JSON.stringify(options?.config ?? {}),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xutest1/sdk",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "A3Code SDK - Build AI agents with agentic coding capabilities",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -11,21 +11,30 @@
11
11
  "types": "./dist/index.d.ts"
12
12
  }
13
13
  },
14
- "files": ["dist"],
14
+ "files": [
15
+ "dist"
16
+ ],
15
17
  "scripts": {
16
18
  "build": "tsc"
17
19
  },
18
20
  "devDependencies": {
19
- "@types/node": "^20.0.0",
21
+ "@types/node": "^20.19.30",
20
22
  "typescript": "^5.0.0"
21
23
  },
22
24
  "optionalDependencies": {
23
- "@xutest1/darwin-arm64": "0.0.3",
24
- "@xutest1/darwin-x64": "0.0.3",
25
- "@xutest1/linux-x64": "0.0.3",
25
+ "@xutest1/darwin-arm64": "0.0.6",
26
+ "@xutest1/darwin-x64": "0.0.6",
26
27
  "@xutest1/linux-arm64": "0.0.3",
28
+ "@xutest1/linux-x64": "0.0.3",
27
29
  "@xutest1/win32-x64": "0.0.3"
28
30
  },
29
- "keywords": ["a3code", "ai", "agent", "coding", "sdk", "vllm"],
31
+ "keywords": [
32
+ "a3code",
33
+ "ai",
34
+ "agent",
35
+ "coding",
36
+ "sdk",
37
+ "vllm"
38
+ ],
30
39
  "license": "MIT"
31
40
  }