@ottocode/sdk 0.1.268 → 0.1.269

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ottocode/sdk",
3
- "version": "0.1.268",
3
+ "version": "0.1.269",
4
4
  "description": "AI agent SDK for building intelligent assistants - tree-shakable and comprehensive",
5
5
  "author": "nitishxyz",
6
6
  "license": "MIT",
@@ -27,11 +27,35 @@ function tryUseExistingPath(path?: string | null): string | null {
27
27
  return null;
28
28
  }
29
29
 
30
+ async function extractEmbeddedLibrary(
31
+ filename: string,
32
+ ): Promise<string | null> {
33
+ const platformLibs =
34
+ RUST_PTY_LIBS[process.platform as keyof typeof RUST_PTY_LIBS];
35
+ const embeddedPath =
36
+ platformLibs?.[process.arch === 'arm64' ? 'arm64' : 'x64'];
37
+
38
+ if (!embeddedPath) return null;
39
+
40
+ const targetDir = join(getGlobalConfigDir(), 'runtime', 'bun-pty');
41
+ mkdirSync(targetDir, { recursive: true });
42
+ const targetPath = join(targetDir, filename);
43
+ const source = Bun.file(embeddedPath);
44
+ await Bun.write(targetPath, source);
45
+ process.env.BUN_PTY_LIB = targetPath;
46
+ return targetPath;
47
+ }
48
+
30
49
  export async function ensureBunPtyLibrary(): Promise<string | null> {
50
+ const filename = resolveLibraryFilename();
51
+ if (process.env.OTTO_PREFER_BUNDLED_PTY === '1') {
52
+ const embedded = await extractEmbeddedLibrary(filename);
53
+ if (embedded) return embedded;
54
+ }
55
+
31
56
  const already = tryUseExistingPath(process.env.BUN_PTY_LIB);
32
57
  if (already) return already;
33
58
 
34
- const filename = resolveLibraryFilename();
35
59
  const candidates: string[] = [];
36
60
 
37
61
  candidates.push(
@@ -51,20 +75,5 @@ export async function ensureBunPtyLibrary(): Promise<string | null> {
51
75
  if (path) return path;
52
76
  }
53
77
 
54
- const platformLibs =
55
- RUST_PTY_LIBS[process.platform as keyof typeof RUST_PTY_LIBS];
56
- const embeddedPath =
57
- platformLibs?.[process.arch === 'arm64' ? 'arm64' : 'x64'];
58
-
59
- if (embeddedPath) {
60
- const targetDir = join(getGlobalConfigDir(), 'runtime', 'bun-pty');
61
- mkdirSync(targetDir, { recursive: true });
62
- const targetPath = join(targetDir, filename);
63
- const source = Bun.file(embeddedPath);
64
- await Bun.write(targetPath, source);
65
- process.env.BUN_PTY_LIB = targetPath;
66
- return targetPath;
67
- }
68
-
69
- return null;
78
+ return extractEmbeddedLibrary(filename);
70
79
  }
@@ -133,7 +133,12 @@ export function buildTerminalTool(
133
133
 
134
134
  if (runInShell) {
135
135
  command = shellPath;
136
- args = process.platform === 'win32' ? [] : ['-i'];
136
+ args =
137
+ process.platform === 'win32'
138
+ ? []
139
+ : process.platform === 'darwin'
140
+ ? ['-il']
141
+ : ['-i'];
137
142
  const providedCommand = params.command;
138
143
  const providedArgs = params.args ?? [];
139
144