@meowlynxsea/koi 0.2.18 → 0.2.20

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 (53) hide show
  1. package/dist/main.js +3 -5
  2. package/native/onnx/napi-v3/darwin/arm64/libonnxruntime.1.21.0.dylib +0 -0
  3. package/native/onnx/napi-v3/darwin/arm64/onnxruntime_binding.node +0 -0
  4. package/package.json +3 -2
  5. package/scripts/postbuild.ts +131 -13
  6. package/scripts/postinstall.ts +22 -146
  7. package/dist/node_modules/@opentui/core-darwin-arm64/LICENSE +0 -21
  8. package/dist/node_modules/@opentui/core-darwin-arm64/README.md +0 -3
  9. package/dist/node_modules/@opentui/core-darwin-arm64/index.js +0 -2
  10. package/dist/node_modules/@opentui/core-darwin-arm64/index.ts +0 -3
  11. package/dist/node_modules/@opentui/core-darwin-arm64/package.json +0 -24
  12. package/dist/node_modules/@opentui/core-darwin-x64/LICENSE +0 -21
  13. package/dist/node_modules/@opentui/core-darwin-x64/README.md +0 -3
  14. package/dist/node_modules/@opentui/core-darwin-x64/index.bun.js +0 -3
  15. package/dist/node_modules/@opentui/core-darwin-x64/index.d.ts +0 -2
  16. package/dist/node_modules/@opentui/core-darwin-x64/index.js +0 -3
  17. package/dist/node_modules/@opentui/core-darwin-x64/libopentui.dylib +0 -0
  18. package/dist/node_modules/@opentui/core-darwin-x64/package.json +0 -32
  19. package/dist/node_modules/@opentui/core-linux-arm64/LICENSE +0 -21
  20. package/dist/node_modules/@opentui/core-linux-arm64/README.md +0 -3
  21. package/dist/node_modules/@opentui/core-linux-arm64/index.bun.js +0 -3
  22. package/dist/node_modules/@opentui/core-linux-arm64/index.d.ts +0 -2
  23. package/dist/node_modules/@opentui/core-linux-arm64/index.js +0 -3
  24. package/dist/node_modules/@opentui/core-linux-arm64/libopentui.so +0 -0
  25. package/dist/node_modules/@opentui/core-linux-arm64/package.json +0 -32
  26. package/dist/node_modules/@opentui/core-linux-x64/LICENSE +0 -21
  27. package/dist/node_modules/@opentui/core-linux-x64/README.md +0 -3
  28. package/dist/node_modules/@opentui/core-linux-x64/index.bun.js +0 -3
  29. package/dist/node_modules/@opentui/core-linux-x64/index.d.ts +0 -2
  30. package/dist/node_modules/@opentui/core-linux-x64/index.js +0 -3
  31. package/dist/node_modules/@opentui/core-linux-x64/libopentui.so +0 -0
  32. package/dist/node_modules/@opentui/core-linux-x64/package.json +0 -32
  33. package/dist/node_modules/@opentui/core-win32-arm64/LICENSE +0 -21
  34. package/dist/node_modules/@opentui/core-win32-arm64/README.md +0 -3
  35. package/dist/node_modules/@opentui/core-win32-arm64/index.bun.js +0 -3
  36. package/dist/node_modules/@opentui/core-win32-arm64/index.d.ts +0 -2
  37. package/dist/node_modules/@opentui/core-win32-arm64/index.js +0 -3
  38. package/dist/node_modules/@opentui/core-win32-arm64/opentui.dll +0 -0
  39. package/dist/node_modules/@opentui/core-win32-arm64/package.json +0 -32
  40. package/dist/node_modules/@opentui/core-win32-x64/LICENSE +0 -21
  41. package/dist/node_modules/@opentui/core-win32-x64/README.md +0 -3
  42. package/dist/node_modules/@opentui/core-win32-x64/index.bun.js +0 -3
  43. package/dist/node_modules/@opentui/core-win32-x64/index.d.ts +0 -2
  44. package/dist/node_modules/@opentui/core-win32-x64/index.js +0 -3
  45. package/dist/node_modules/@opentui/core-win32-x64/opentui.dll +0 -0
  46. package/dist/node_modules/@opentui/core-win32-x64/package.json +0 -32
  47. package/dist/node_modules/core-darwin-arm64/LICENSE +0 -21
  48. package/dist/node_modules/core-darwin-arm64/README.md +0 -3
  49. package/dist/node_modules/core-darwin-arm64/index.js +0 -2
  50. package/dist/node_modules/core-darwin-arm64/index.ts +0 -3
  51. package/dist/node_modules/core-darwin-arm64/package.json +0 -24
  52. /package/dist/{node_modules/@opentui/core-darwin-arm64 → opentui-native}/libopentui.dylib +0 -0
  53. /package/{dist/node_modules/core-darwin-arm64 → native/opentui}/libopentui.dylib +0 -0
package/dist/main.js CHANGED
@@ -346682,7 +346682,7 @@ var require_binding = __commonJS((exports) => {
346682
346682
  Object.defineProperty(exports, "__esModule", { value: true });
346683
346683
  exports.initOrt = exports.binding = undefined;
346684
346684
  var onnxruntime_common_1 = require_cjs();
346685
- exports.binding = __require(`./onnx-bin/napi-v3/${process.platform}/${process.arch}/onnxruntime_binding.node`);
346685
+ exports.binding = __require(path.join(process.cwd(), "native/onnx/napi-v3/darwin/arm64", "onnxruntime_binding.node"));
346686
346686
  var ortInitialized = false;
346687
346687
  var initOrt = () => {
346688
346688
  if (!ortInitialized) {
@@ -418762,11 +418762,9 @@ var ReserveInfoStruct = defineStruct([
418762
418762
  len: value2.len
418763
418763
  })
418764
418764
  });
418765
- var module = await import(`@opentui/core-${process.platform}-${process.arch}/index.js`);
418765
+ var module = { default: "./native/opentui/libopentui.dylib" };
418766
418766
  var targetLibPath = module.default;
418767
- if (isBunfsPath(targetLibPath)) {
418768
- targetLibPath = targetLibPath.replace("../", "");
418769
- }
418767
+ // Native library path is already resolved
418770
418768
  if (!existsSync2(targetLibPath)) {
418771
418769
  throw new Error(`opentui is not supported on the current platform: ${process.platform}-${process.arch}`);
418772
418770
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meowlynxsea/koi",
3
- "version": "0.2.18",
3
+ "version": "0.2.20",
4
4
  "description": "A coding agent built on Pi SDK with TUI + Bun runtime",
5
5
  "module": "src/main.tsx",
6
6
  "type": "module",
@@ -13,6 +13,7 @@
13
13
  "dist",
14
14
  "bin",
15
15
  "scripts",
16
+ "native",
16
17
  "src/main.tsx",
17
18
  "src/cce",
18
19
  "!src/cce/web/frontend/node_modules",
@@ -34,7 +35,7 @@
34
35
  "scripts": {
35
36
  "dev": "bun run src/main.tsx",
36
37
  "postinstall": "bun run scripts/postinstall.ts",
37
- "build": "bun build src/main.tsx --outdir dist --target bun && cp node_modules/@opentui/core/parser.worker.js dist/ && cp -r node_modules/@opentui/core/assets dist/opentui-assets && mkdir -p dist/cce-frontend && cp -r src/cce/web/frontend/dist/* dist/cce-frontend/ && mkdir -p dist/onnx-bin/napi-v3/darwin/arm64 && cp node_modules/onnxruntime-node/bin/napi-v3/darwin/arm64/* dist/onnx-bin/napi-v3/darwin/arm64/ && cp src/cce/core/schema.sql dist/ && mkdir -p dist/node_modules && cp -r node_modules/@opentui/core-darwin-arm64 dist/node_modules/ && cp -r node_modules/@opentui/core-darwin-x64 dist/node_modules/ 2>/dev/null || true && cp -r node_modules/@opentui/core-linux-arm64 dist/node_modules/ 2>/dev/null || true && cp -r node_modules/@opentui/core-linux-x64 dist/node_modules/ 2>/dev/null || true && cp -r node_modules/@opentui/core-win32-arm64 dist/node_modules/ 2>/dev/null || true && cp -r node_modules/@opentui/core-win32-x64 dist/node_modules/ 2>/dev/null || true && bun run scripts/postbuild.ts",
38
+ "build": "bun build src/main.tsx --outdir dist --target bun && cp node_modules/@opentui/core/parser.worker.js dist/ && cp -r node_modules/@opentui/core/assets dist/opentui-assets && mkdir -p dist/cce-frontend && cp -r src/cce/web/frontend/dist/* dist/cce-frontend/ && cp src/cce/core/schema.sql dist/ && bun run scripts/postbuild.ts",
38
39
  "check": "tsc --noEmit",
39
40
  "lint": "eslint src/",
40
41
  "lint:fix": "eslint src/ --fix"
@@ -1,16 +1,27 @@
1
1
  /**
2
2
  * Post-build script to fix native module paths in the bundle.
3
3
  *
4
- * Some native modules (like onnxruntime-node) use relative paths that are
5
- * valid in node_modules but not when bundled. This script patches those paths.
4
+ * This replaces the dynamic import pattern used by @opentui/core:
5
+ * await import(`@opentui/core-${process.platform}-${process.arch}/index.js`)
6
+ *
7
+ * With a static path to the current platform's native library, copied to dist.
6
8
  */
7
9
 
8
- import { existsSync, readFileSync, writeFileSync } from "fs";
9
- import { join, dirname } from "path";
10
+ import {
11
+ existsSync,
12
+ readFileSync,
13
+ writeFileSync,
14
+ mkdirSync,
15
+ cpSync,
16
+ readdirSync,
17
+ rmSync,
18
+ } from "fs";
19
+ import { join, dirname, basename } from "path";
10
20
  import { fileURLToPath } from "url";
11
21
 
12
22
  const __dirname = dirname(fileURLToPath(import.meta.url));
13
- const distDir = join(__dirname, "..", "dist");
23
+ const rootDir = join(__dirname, "..");
24
+ const distDir = join(rootDir, "dist");
14
25
  const mainJsPath = join(distDir, "main.js");
15
26
 
16
27
  if (!existsSync(mainJsPath)) {
@@ -18,16 +29,123 @@ if (!existsSync(mainJsPath)) {
18
29
  process.exit(0);
19
30
  }
20
31
 
32
+ const platform = process.platform === "win32" ? "win32" : process.platform;
33
+ const arch = process.arch;
34
+ const platformModule = `@opentui/core-${platform}-${arch}`;
35
+
36
+ // Find the platform module in node_modules
37
+ const nodeModulesDir = join(rootDir, "node_modules");
38
+ const platformModulePath = join(nodeModulesDir, platformModule);
39
+
40
+ if (!existsSync(platformModulePath)) {
41
+ console.error(`[postbuild] Platform module not found: ${platformModule}`);
42
+ console.error(`[postbuild] Expected at: ${platformModulePath}`);
43
+ process.exit(1);
44
+ }
45
+
21
46
  let content = readFileSync(mainJsPath, "utf-8");
22
47
 
23
- // Fix onnxruntime-node path: ../bin/... -> ./bin/...
24
- // The original code uses "../bin/napi-v3/..." which is relative to
25
- // node_modules/onnxruntime-node/dist/, but when bundled, the path needs
26
- // to be relative to dist/main.js
48
+ // Detect the native library file extension
49
+ let nativeLibExt: string;
50
+ switch (platform) {
51
+ case "darwin":
52
+ nativeLibExt = ".dylib";
53
+ break;
54
+ case "win32":
55
+ nativeLibExt = ".dll";
56
+ break;
57
+ default:
58
+ nativeLibExt = ".so";
59
+ }
60
+ const nativeLibName = `libopentui${nativeLibExt}`;
61
+ const nativeLibPath = join(platformModulePath, nativeLibName);
62
+
63
+ if (!existsSync(nativeLibPath)) {
64
+ console.error(`[postbuild] Native library not found: ${nativeLibPath}`);
65
+ process.exit(1);
66
+ }
67
+
68
+ // Create native/opentui directory in project root (not dist, so paths work at runtime)
69
+ // When running `bun run dist/main.js`, cwd is project root, so relative paths work
70
+ const opentuiNativeDir = join(rootDir, "native", "opentui");
71
+ if (!existsSync(opentuiNativeDir)) {
72
+ mkdirSync(opentuiNativeDir, { recursive: true });
73
+ }
74
+
75
+ // Copy the native library
76
+ const destNativeLib = join(opentuiNativeDir, nativeLibName);
77
+ cpSync(nativeLibPath, destNativeLib);
78
+ console.log(`[postbuild] Copied ${nativeLibName} to native/opentui/`);
79
+
80
+ // Replace the dynamic import with a static path
81
+ // The dynamic import pattern:
82
+ // var module = await import(`@opentui/core-${process.platform}-${process.arch}/index.js`);
83
+ //
84
+ // We replace it with:
85
+ // var module = { default: "./native/opentui/libopentui.dylib" };
86
+ // // OR better: directly inline the native library path resolution
87
+
88
+ const dynamicImportPattern = /var module = await import\(`@opentui\/core-\$\{process\.platform\}-\$\{process\.arch\}\/index\.js`\);?/g;
89
+
90
+ // The platform module's index.js does:
91
+ // const module = await import("./libopentui.dylib", { with: { type: "file" } });
92
+ // export default module.default;
93
+ //
94
+ // We can inline this directly with the correct path
95
+ const staticImport = `var module = { default: "./native/opentui/${nativeLibName}" };`;
96
+
97
+ if (content.includes("@opentui/core-")) {
98
+ const matches = content.match(dynamicImportPattern);
99
+ if (matches) {
100
+ content = content.replace(dynamicImportPattern, staticImport);
101
+ console.log(`[postbuild] Replaced ${matches.length} dynamic import(s) with static path`);
102
+ }
103
+ }
104
+
105
+ // Also fix any relative path issues with the native library
106
+ // The original code might check for bunfs paths
107
+ if (content.includes("isBunfsPath")) {
108
+ // The isBunfsPath check is no longer needed since we use relative path
109
+ content = content.replace(
110
+ /if \(isBunfsPath\(targetLibPath\)\) \{[\s\S]*?targetLibPath = targetLibPath\.replace\("\.\.\/", ""\);[\s\S]*?\}/,
111
+ "// Native library path is already resolved"
112
+ );
113
+ }
114
+
115
+ // Fix onnxruntime-node path: use process.cwd() to build dynamic path
27
116
  if (content.includes("../bin/napi-v3/")) {
28
- content = content.replace(/\.\.\/bin\/napi-v3\//g, "./onnx-bin/napi-v3/");
29
- writeFileSync(mainJsPath, content);
30
- console.log("Fixed onnxruntime-node native module path in bundle");
117
+ // Replace the template literal with a dynamic path using process.cwd()
118
+ const onnxRelPath = join("native", "onnx", "napi-v3", platform, arch).replace(/\\/g, "/");
119
+ content = content.replace(
120
+ /`\.\.\/bin\/napi-v3\/\$\{process\.platform\}\/\$\{process\.arch\}\/([^`]+)`/g,
121
+ `path.join(process.cwd(), "${onnxRelPath}", "$1")`
122
+ );
123
+ console.log("[postbuild] Fixed onnxruntime-node native module path");
124
+
125
+ // Copy onnxruntime-node native library for current platform
126
+ const onnxSrcDir = join(nodeModulesDir, "onnxruntime-node", "bin", "napi-v3", platform, arch);
127
+ const onnxDestDir = join(rootDir, "native", "onnx", "napi-v3", platform, arch);
128
+
129
+ if (existsSync(onnxSrcDir)) {
130
+ const files = readdirSync(onnxSrcDir);
131
+ mkdirSync(onnxDestDir, { recursive: true });
132
+ for (const file of files) {
133
+ const src = join(onnxSrcDir, file);
134
+ const dest = join(onnxDestDir, file);
135
+ cpSync(src, dest);
136
+ }
137
+ console.log(`[postbuild] Copied onnxruntime native modules to native/onnx/`);
138
+ } else {
139
+ console.warn(`[postbuild] Warning: onnxruntime-node source not found at ${onnxSrcDir}`);
140
+ }
141
+ }
142
+
143
+ // Clean up dist/node_modules (if it was created by previous build)
144
+ const distNodeModules = join(distDir, "node_modules");
145
+ if (existsSync(distNodeModules)) {
146
+ rmSync(distNodeModules, { recursive: true, force: true });
147
+ console.log("[postbuild] Removed dist/node_modules (no longer needed)");
31
148
  }
32
149
 
33
- console.log("Postbuild complete.");
150
+ writeFileSync(mainJsPath, content);
151
+ console.log("[postbuild] Complete.");
@@ -1,159 +1,35 @@
1
1
  /**
2
- * Post-install script to fix @opentui/core platform-specific modules.
2
+ * Post-install script for koi.
3
+ *
4
+ * This script runs after `bun install` to ensure the platform-specific
5
+ * native modules for @opentui/core are properly installed.
6
+ *
7
+ * The actual native library resolution and bundling is handled
8
+ * in scripts/postbuild.ts during the build process.
3
9
  */
4
10
 
5
- import { existsSync, writeFileSync, readFileSync, mkdirSync, cpSync, readdirSync } from "fs";
11
+ import { existsSync } from "fs";
6
12
  import { join, dirname } from "path";
7
13
  import { fileURLToPath } from "url";
8
14
 
9
15
  const __dirname = dirname(fileURLToPath(import.meta.url));
10
16
  const rootDir = join(__dirname, "..");
17
+ const nodeModulesDir = join(rootDir, "node_modules");
11
18
 
12
- console.log(`[DEBUG] __dirname: ${__dirname}`);
13
- console.log(`[DEBUG] rootDir: ${rootDir}`);
14
- console.log(`[DEBUG] process.cwd(): ${process.cwd()}`);
15
- console.log(`[DEBUG] process.platform: ${process.platform}`);
16
- console.log(`[DEBUG] process.arch: ${process.arch}`);
19
+ const platform = process.platform === "win32" ? "win32" : process.platform;
20
+ const arch = process.arch;
21
+ const platformModule = `@opentui/core-${platform}-${arch}`;
22
+ const platformModulePath = join(nodeModulesDir, platformModule);
17
23
 
18
- // Platform-specific modules that need .js shims and installation
19
- const platformModules = [
20
- "@opentui/core-darwin-arm64",
21
- "@opentui/core-darwin-x64",
22
- "@opentui/core-linux-arm64",
23
- "@opentui/core-linux-x64",
24
- "@opentui/core-win32-arm64",
25
- "@opentui/core-win32-x64",
26
- ];
24
+ console.log(`[postinstall] Detected platform: ${platform}-${arch}`);
27
25
 
28
- const indexJsContent = `const module = await import("./libopentui.dylib", { with: { type: "file" } });
29
- export default module.default;
30
- `;
31
-
32
- const indexJsWinContent = `const module = await import("./opentui.dll", { with: { type: "file" } });
33
- export default module.default;
34
- `;
35
-
36
- // Find the actual node_modules path
37
- // In global install, koi is at: C:\Users\Acro\node_modules\@meowlynxsea\koi
38
- // Platform modules are at: C:\Users\Acro\node_modules\@opentui\core-win32-x64
39
- // rootDir is: C:\Users\Acro\node_modules\@meowlynxsea\koi
40
- // dirname(rootDir) is: C:\Users\Acro\node_modules\@meowlynxsea (WRONG)
41
- // We need to go up two levels to get: C:\Users\Acro\node_modules
42
- const parentDir = dirname(dirname(rootDir));
43
- console.log(`[DEBUG] parentDir (dirname(dirname(rootDir))): ${parentDir}`);
44
-
45
- // Check if parentDir has the expected structure
46
- const parentNodeModulesCheck = join(parentDir, "@opentui");
47
- console.log(`[DEBUG] Checking if ${parentNodeModulesCheck} exists: ${existsSync(parentNodeModulesCheck)}`);
48
-
49
- for (const moduleName of platformModules) {
50
- const modulePath = join(parentDir, moduleName);
51
-
52
- console.log(`\n[DEBUG] === Processing ${moduleName} ===`);
53
- console.log(`[DEBUG] modulePath: ${modulePath}`);
54
- console.log(`[DEBUG] existsSync(modulePath): ${existsSync(modulePath)}`);
55
-
56
- if (!existsSync(modulePath)) {
57
- console.log(`[DEBUG] Skipping ${moduleName} - not found`);
58
- continue;
59
- }
60
-
61
- const indexJsPath = join(modulePath, "index.js");
62
- const packageJsonPath = join(modulePath, "package.json");
63
-
64
- // Create index.js if it doesn't exist
65
- if (!existsSync(indexJsPath)) {
66
- const content = moduleName.includes("win32")
67
- ? indexJsWinContent
68
- : indexJsContent;
69
- writeFileSync(indexJsPath, content);
70
- console.log(`Created ${moduleName}/index.js`);
71
- }
72
-
73
- // Update package.json main field to point to .js
74
- if (existsSync(packageJsonPath)) {
75
- const pkg = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
76
- if (pkg.main === "index.ts") {
77
- pkg.main = "index.js";
78
- pkg.module = "index.js";
79
- writeFileSync(packageJsonPath, JSON.stringify(pkg, null, 2) + "\n");
80
- console.log(`Updated ${moduleName}/package.json`);
81
- }
82
- }
83
-
84
- // Copy platform module to dist/node_modules for proper module resolution
85
- const distNodeModules = join(rootDir, "dist", "node_modules", moduleName);
86
- console.log(`[DEBUG] distNodeModules: ${distNodeModules}`);
87
-
88
- if (!existsSync(distNodeModules)) {
89
- const distDir = join(rootDir, "dist", "node_modules");
90
- console.log(`[DEBUG] Creating ${distDir}`);
91
- mkdirSync(distDir, { recursive: true });
92
-
93
- console.log(`[DEBUG] Copying ${modulePath} -> ${distNodeModules}`);
94
- cpSync(modulePath, distNodeModules, { recursive: true });
95
- console.log(`Copied ${moduleName} to dist/node_modules/`);
96
- } else {
97
- console.log(`[DEBUG] ${distNodeModules} already exists, skipping copy`);
98
- }
26
+ // Check if the platform module exists
27
+ if (!existsSync(platformModulePath)) {
28
+ console.warn(`[postinstall] Warning: ${platformModule} not found.`);
29
+ console.warn(`[postinstall] This native module may need to be installed separately.`);
30
+ console.warn(`[postinstall] Try running: bun add ${platformModule}`);
31
+ process.exit(0);
99
32
  }
100
33
 
101
- // Fix @opentui/core's dynamic import to use .js instead of .ts
102
- const opentuiCorePath = join(parentDir, "@opentui", "core");
103
- const indexHmk8xzt3Path = join(opentuiCorePath, "index-hmk8xzt3.js");
104
-
105
- console.log(`\n[DEBUG] Checking for opentui core fix:`);
106
- console.log(`[DEBUG] opentuiCorePath: ${opentuiCorePath}`);
107
- console.log(`[DEBUG] indexHmk8xzt3Path: ${indexHmk8xzt3Path}`);
108
- console.log(`[DEBUG] existsSync(indexHmk8xzt3Path): ${existsSync(indexHmk8xzt3Path)}`);
109
-
110
- if (existsSync(indexHmk8xzt3Path)) {
111
- let content = readFileSync(indexHmk8xzt3Path, "utf-8");
112
- if (content.includes("/index.ts")) {
113
- content = content.replace(/\/index\.ts/g, "/index.js");
114
- writeFileSync(indexHmk8xzt3Path, content);
115
- console.log("Fixed @opentui/core/index-hmk8xzt3.js dynamic import");
116
- }
117
- }
118
-
119
- console.log("\nPostinstall complete.");
120
-
121
- // Fix main.js: replace scoped package imports with relative paths for Windows compatibility
122
- const mainJsPath = join(rootDir, "dist", "main.js");
123
- if (existsSync(mainJsPath)) {
124
- let content = readFileSync(mainJsPath, "utf-8");
125
- let modified = false;
126
-
127
- // Replace: import(`@opentui/core-${platform}-${arch}/index.js`)
128
- // With: import(`./node_modules/@opentui/core-${platform}-${arch}/index.js`)
129
- if (content.includes("`@opentui/core-")) {
130
- content = content.replace(/`@opentui\/core-/g, "`./node_modules/@opentui/core-");
131
- modified = true;
132
- }
133
-
134
- // Copy onnxruntime native modules for the current platform
135
- // Source: parentDir/onnxruntime-node/bin/napi-v3/{os}/{arch}/*
136
- // Dest: rootDir/dist/onnx-bin/napi-v3/{os}/{arch}/*
137
- const onnxSrcDir = join(parentDir, "onnxruntime-node", "bin", "napi-v3", process.platform, process.arch);
138
- const onnxDestDir = join(rootDir, "dist", "onnx-bin", "napi-v3", process.platform, process.arch);
139
-
140
- if (existsSync(onnxSrcDir)) {
141
- const files = readdirSync(onnxSrcDir);
142
- for (const file of files) {
143
- const src = join(onnxSrcDir, file);
144
- const dest = join(onnxDestDir, file);
145
- if (!existsSync(dest)) {
146
- mkdirSync(onnxDestDir, { recursive: true });
147
- cpSync(src, dest);
148
- console.log(`Copied onnxruntime: ${file}`);
149
- }
150
- }
151
- } else {
152
- console.log(`[DEBUG] onnxruntime source not found: ${onnxSrcDir}`);
153
- }
154
-
155
- if (modified) {
156
- writeFileSync(mainJsPath, content);
157
- console.log("Fixed dynamic imports in main.js for Windows compatibility");
158
- }
159
- }
34
+ console.log(`[postinstall] ${platformModule} is ready.`);
35
+ console.log("[postinstall] Build the project with 'bun run build' to include native modules.");
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 opentui
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,3 +0,0 @@
1
- ## @opentui/core-darwin-arm64
2
-
3
- > Prebuilt darwin-arm64 binaries for `@opentui/core`.
@@ -1,2 +0,0 @@
1
- const module = await import("./libopentui.dylib", { with: { type: "file" } });
2
- export default module.default;
@@ -1,3 +0,0 @@
1
- const module = await import("./libopentui.dylib", { with: { type: "file" } })
2
- const path = module.default
3
- export default path;
@@ -1,24 +0,0 @@
1
- {
2
- "name": "@opentui/core-darwin-arm64",
3
- "version": "0.2.3",
4
- "description": "Prebuilt darwin-arm64 binaries for @opentui/core",
5
- "main": "index.js",
6
- "types": "index.ts",
7
- "license": "MIT",
8
- "repository": {
9
- "type": "git",
10
- "url": "https://github.com/anomalyco/opentui",
11
- "directory": "packages/core"
12
- },
13
- "keywords": [
14
- "prebuild",
15
- "prebuilt"
16
- ],
17
- "os": [
18
- "darwin"
19
- ],
20
- "cpu": [
21
- "arm64"
22
- ],
23
- "module": "index.js"
24
- }
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 opentui
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,3 +0,0 @@
1
- ## @opentui/core-darwin-x64
2
-
3
- > Prebuilt darwin-x64 binaries for `@opentui/core`.
@@ -1,3 +0,0 @@
1
- const module = await import("./libopentui.dylib", { with: { type: "file" } })
2
-
3
- export default module.default
@@ -1,2 +0,0 @@
1
- declare const path: string
2
- export default path
@@ -1,3 +0,0 @@
1
- import { fileURLToPath } from "node:url"
2
-
3
- export default fileURLToPath(new URL("./libopentui.dylib", import.meta.url))
@@ -1,32 +0,0 @@
1
- {
2
- "name": "@opentui/core-darwin-x64",
3
- "version": "0.2.7",
4
- "description": "Prebuilt darwin-x64 binaries for @opentui/core",
5
- "type": "module",
6
- "main": "index.js",
7
- "module": "index.js",
8
- "types": "index.d.ts",
9
- "license": "MIT",
10
- "repository": {
11
- "type": "git",
12
- "url": "https://github.com/anomalyco/opentui",
13
- "directory": "packages/core"
14
- },
15
- "keywords": [
16
- "prebuild",
17
- "prebuilt"
18
- ],
19
- "exports": {
20
- ".": {
21
- "bun": "./index.bun.js",
22
- "import": "./index.js",
23
- "types": "./index.d.ts"
24
- }
25
- },
26
- "os": [
27
- "darwin"
28
- ],
29
- "cpu": [
30
- "x64"
31
- ]
32
- }
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 opentui
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,3 +0,0 @@
1
- ## @opentui/core-linux-arm64
2
-
3
- > Prebuilt linux-arm64 binaries for `@opentui/core`.
@@ -1,3 +0,0 @@
1
- const module = await import("./libopentui.so", { with: { type: "file" } })
2
-
3
- export default module.default
@@ -1,2 +0,0 @@
1
- declare const path: string
2
- export default path
@@ -1,3 +0,0 @@
1
- import { fileURLToPath } from "node:url"
2
-
3
- export default fileURLToPath(new URL("./libopentui.so", import.meta.url))
@@ -1,32 +0,0 @@
1
- {
2
- "name": "@opentui/core-linux-arm64",
3
- "version": "0.2.7",
4
- "description": "Prebuilt linux-arm64 binaries for @opentui/core",
5
- "type": "module",
6
- "main": "index.js",
7
- "module": "index.js",
8
- "types": "index.d.ts",
9
- "license": "MIT",
10
- "repository": {
11
- "type": "git",
12
- "url": "https://github.com/anomalyco/opentui",
13
- "directory": "packages/core"
14
- },
15
- "keywords": [
16
- "prebuild",
17
- "prebuilt"
18
- ],
19
- "exports": {
20
- ".": {
21
- "bun": "./index.bun.js",
22
- "import": "./index.js",
23
- "types": "./index.d.ts"
24
- }
25
- },
26
- "os": [
27
- "linux"
28
- ],
29
- "cpu": [
30
- "arm64"
31
- ]
32
- }
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 opentui
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,3 +0,0 @@
1
- ## @opentui/core-linux-x64
2
-
3
- > Prebuilt linux-x64 binaries for `@opentui/core`.
@@ -1,3 +0,0 @@
1
- const module = await import("./libopentui.so", { with: { type: "file" } })
2
-
3
- export default module.default
@@ -1,2 +0,0 @@
1
- declare const path: string
2
- export default path
@@ -1,3 +0,0 @@
1
- import { fileURLToPath } from "node:url"
2
-
3
- export default fileURLToPath(new URL("./libopentui.so", import.meta.url))
@@ -1,32 +0,0 @@
1
- {
2
- "name": "@opentui/core-linux-x64",
3
- "version": "0.2.7",
4
- "description": "Prebuilt linux-x64 binaries for @opentui/core",
5
- "type": "module",
6
- "main": "index.js",
7
- "module": "index.js",
8
- "types": "index.d.ts",
9
- "license": "MIT",
10
- "repository": {
11
- "type": "git",
12
- "url": "https://github.com/anomalyco/opentui",
13
- "directory": "packages/core"
14
- },
15
- "keywords": [
16
- "prebuild",
17
- "prebuilt"
18
- ],
19
- "exports": {
20
- ".": {
21
- "bun": "./index.bun.js",
22
- "import": "./index.js",
23
- "types": "./index.d.ts"
24
- }
25
- },
26
- "os": [
27
- "linux"
28
- ],
29
- "cpu": [
30
- "x64"
31
- ]
32
- }
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 opentui
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,3 +0,0 @@
1
- ## @opentui/core-win32-arm64
2
-
3
- > Prebuilt win32-arm64 binaries for `@opentui/core`.
@@ -1,3 +0,0 @@
1
- const module = await import("./opentui.dll", { with: { type: "file" } })
2
-
3
- export default module.default
@@ -1,2 +0,0 @@
1
- declare const path: string
2
- export default path
@@ -1,3 +0,0 @@
1
- import { fileURLToPath } from "node:url"
2
-
3
- export default fileURLToPath(new URL("./opentui.dll", import.meta.url))
@@ -1,32 +0,0 @@
1
- {
2
- "name": "@opentui/core-win32-arm64",
3
- "version": "0.2.7",
4
- "description": "Prebuilt win32-arm64 binaries for @opentui/core",
5
- "type": "module",
6
- "main": "index.js",
7
- "module": "index.js",
8
- "types": "index.d.ts",
9
- "license": "MIT",
10
- "repository": {
11
- "type": "git",
12
- "url": "https://github.com/anomalyco/opentui",
13
- "directory": "packages/core"
14
- },
15
- "keywords": [
16
- "prebuild",
17
- "prebuilt"
18
- ],
19
- "exports": {
20
- ".": {
21
- "bun": "./index.bun.js",
22
- "import": "./index.js",
23
- "types": "./index.d.ts"
24
- }
25
- },
26
- "os": [
27
- "win32"
28
- ],
29
- "cpu": [
30
- "arm64"
31
- ]
32
- }
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 opentui
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,3 +0,0 @@
1
- ## @opentui/core-win32-x64
2
-
3
- > Prebuilt win32-x64 binaries for `@opentui/core`.
@@ -1,3 +0,0 @@
1
- const module = await import("./opentui.dll", { with: { type: "file" } })
2
-
3
- export default module.default
@@ -1,2 +0,0 @@
1
- declare const path: string
2
- export default path
@@ -1,3 +0,0 @@
1
- import { fileURLToPath } from "node:url"
2
-
3
- export default fileURLToPath(new URL("./opentui.dll", import.meta.url))
@@ -1,32 +0,0 @@
1
- {
2
- "name": "@opentui/core-win32-x64",
3
- "version": "0.2.7",
4
- "description": "Prebuilt win32-x64 binaries for @opentui/core",
5
- "type": "module",
6
- "main": "index.js",
7
- "module": "index.js",
8
- "types": "index.d.ts",
9
- "license": "MIT",
10
- "repository": {
11
- "type": "git",
12
- "url": "https://github.com/anomalyco/opentui",
13
- "directory": "packages/core"
14
- },
15
- "keywords": [
16
- "prebuild",
17
- "prebuilt"
18
- ],
19
- "exports": {
20
- ".": {
21
- "bun": "./index.bun.js",
22
- "import": "./index.js",
23
- "types": "./index.d.ts"
24
- }
25
- },
26
- "os": [
27
- "win32"
28
- ],
29
- "cpu": [
30
- "x64"
31
- ]
32
- }
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 opentui
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,3 +0,0 @@
1
- ## @opentui/core-darwin-arm64
2
-
3
- > Prebuilt darwin-arm64 binaries for `@opentui/core`.
@@ -1,2 +0,0 @@
1
- const module = await import("./libopentui.dylib", { with: { type: "file" } });
2
- export default module.default;
@@ -1,3 +0,0 @@
1
- const module = await import("./libopentui.dylib", { with: { type: "file" } })
2
- const path = module.default
3
- export default path;
@@ -1,24 +0,0 @@
1
- {
2
- "name": "@opentui/core-darwin-arm64",
3
- "version": "0.2.3",
4
- "description": "Prebuilt darwin-arm64 binaries for @opentui/core",
5
- "main": "index.js",
6
- "types": "index.ts",
7
- "license": "MIT",
8
- "repository": {
9
- "type": "git",
10
- "url": "https://github.com/anomalyco/opentui",
11
- "directory": "packages/core"
12
- },
13
- "keywords": [
14
- "prebuild",
15
- "prebuilt"
16
- ],
17
- "os": [
18
- "darwin"
19
- ],
20
- "cpu": [
21
- "arm64"
22
- ],
23
- "module": "index.js"
24
- }