forbocai 0.3.10 → 0.3.12

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 (2) hide show
  1. package/package.json +1 -1
  2. package/postinstall.js +24 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "forbocai",
3
- "version": "0.3.10",
3
+ "version": "0.3.12",
4
4
  "description": "The Infrastructure Layer for Autonomous AI Characters",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
package/postinstall.js CHANGED
@@ -25,23 +25,34 @@ Run 'npx forbocai api status' to verify connection.
25
25
  Welcome to the Future of NPC Intelligence.
26
26
  `;
27
27
 
28
- // Try multiple output methods for cross-platform compatibility
29
- try {
30
- // Method 1: Direct TTY write (Unix) - bypasses npm buffering
31
- if (process.platform !== 'win32') {
32
- const tty = fs.openSync('/dev/tty', 'w');
33
- fs.writeSync(tty, msg);
34
- fs.closeSync(tty);
35
- } else {
36
- // Method 2: Windows - write to both streams so message shows even when npm floods stderr with deprecation warnings.
37
- const out = '\n' + msg;
28
+ function showBanner() {
29
+ const out = '\n' + msg;
30
+ try {
31
+ if (process.platform !== 'win32') {
32
+ const tty = fs.openSync('/dev/tty', 'w');
33
+ fs.writeSync(tty, out);
34
+ fs.closeSync(tty);
35
+ return;
36
+ }
37
+ // Windows: try writing to the real console so output isn't lost when npm pipes stdout/stderr
38
+ const winConsoles = ['CONOUT$', 'CON'];
39
+ for (const name of winConsoles) {
40
+ try {
41
+ const fd = fs.openSync(name, 'w');
42
+ fs.writeSync(fd, out);
43
+ fs.closeSync(fd);
44
+ return;
45
+ } catch (_) { /* try next */ }
46
+ }
47
+ // Fallback: stdout + stderr (may be piped/buffered by npm)
38
48
  process.stdout.write(out);
39
49
  process.stderr.write(out);
50
+ } catch (e) {
51
+ console.log(msg);
40
52
  }
41
- } catch (e) {
42
- // Method 3: Fallback - simple console.log (may be suppressed by npm)
43
- console.log(msg);
44
53
  }
45
54
 
55
+ showBanner();
56
+
46
57
  // DO NOT require the SDK here - it causes ESM/CJS compatibility issues
47
58
  // The SDK is loaded when the user imports it in their code