@meowlynxsea/koi 0.2.17 → 0.2.18

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": "@meowlynxsea/koi",
3
- "version": "0.2.17",
3
+ "version": "0.2.18",
4
4
  "description": "A coding agent built on Pi SDK with TUI + Bun runtime",
5
5
  "module": "src/main.tsx",
6
6
  "type": "module",
@@ -2,7 +2,7 @@
2
2
  * Post-install script to fix @opentui/core platform-specific modules.
3
3
  */
4
4
 
5
- import { existsSync, writeFileSync, readFileSync, mkdirSync, cpSync } from "fs";
5
+ import { existsSync, writeFileSync, readFileSync, mkdirSync, cpSync, readdirSync } from "fs";
6
6
  import { join, dirname } from "path";
7
7
  import { fileURLToPath } from "url";
8
8
 
@@ -122,10 +122,37 @@ console.log("\nPostinstall complete.");
122
122
  const mainJsPath = join(rootDir, "dist", "main.js");
123
123
  if (existsSync(mainJsPath)) {
124
124
  let content = readFileSync(mainJsPath, "utf-8");
125
+ let modified = false;
126
+
125
127
  // Replace: import(`@opentui/core-${platform}-${arch}/index.js`)
126
128
  // With: import(`./node_modules/@opentui/core-${platform}-${arch}/index.js`)
127
129
  if (content.includes("`@opentui/core-")) {
128
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) {
129
156
  writeFileSync(mainJsPath, content);
130
157
  console.log("Fixed dynamic imports in main.js for Windows compatibility");
131
158
  }