a2acalling 0.6.14 → 0.6.15
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 +1 -1
- package/scripts/postinstall.js +14 -11
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -23,9 +23,10 @@
|
|
|
23
23
|
// a) Run quickstart with piped stdio, capturing all its output.
|
|
24
24
|
// b) Save the output to a2a-onboarding.txt in the config dir (reliable
|
|
25
25
|
// fallback — agents can always read this file).
|
|
26
|
-
// c) Try /
|
|
27
|
-
//
|
|
28
|
-
//
|
|
26
|
+
// c) Try /proc/$PPID/fd/2 FIRST (Linux — writes directly to npm's
|
|
27
|
+
// stderr fd, which IS the caller's output stream. Agents capture
|
|
28
|
+
// via pipes, so this is the primary delivery path).
|
|
29
|
+
// d) Try /dev/tty (macOS/non-Linux — interactive terminals).
|
|
29
30
|
// e) Last resort: process.stderr.write (npm may still buffer this).
|
|
30
31
|
//
|
|
31
32
|
// 3. Never fail the install. If quickstart can't launch (e.g. missing node
|
|
@@ -83,21 +84,23 @@ try {
|
|
|
83
84
|
// to our own fds goes into npm's buffer. We need to bypass npm entirely.
|
|
84
85
|
|
|
85
86
|
function tryWrite(output) {
|
|
86
|
-
// Strategy 1: /
|
|
87
|
-
// npm
|
|
88
|
-
//
|
|
87
|
+
// Strategy 1: /proc/$PPID/fd/2 — Linux, write to npm's stderr directly.
|
|
88
|
+
// npm's stderr IS the caller's stderr (the agent's output stream).
|
|
89
|
+
// This bypasses npm's pipe buffer because we open the fd independently.
|
|
90
|
+
// This is tried FIRST because agents are the primary users — their output
|
|
91
|
+
// is captured via pipes, and /dev/tty would send output to a terminal
|
|
92
|
+
// device they can't read from.
|
|
89
93
|
try {
|
|
90
|
-
const fd = fs.openSync(
|
|
94
|
+
const fd = fs.openSync(`/proc/${process.ppid}/fd/2`, 'w');
|
|
91
95
|
fs.writeSync(fd, output);
|
|
92
96
|
fs.closeSync(fd);
|
|
93
97
|
return true;
|
|
94
98
|
} catch (_) {}
|
|
95
99
|
|
|
96
|
-
// Strategy 2: /
|
|
97
|
-
//
|
|
98
|
-
// This bypasses npm's pipe buffer because we open the fd independently.
|
|
100
|
+
// Strategy 2: /dev/tty — interactive terminals (macOS, non-Linux).
|
|
101
|
+
// Talks directly to the user's terminal, bypassing npm's pipe.
|
|
99
102
|
try {
|
|
100
|
-
const fd = fs.openSync(
|
|
103
|
+
const fd = fs.openSync('/dev/tty', 'w');
|
|
101
104
|
fs.writeSync(fd, output);
|
|
102
105
|
fs.closeSync(fd);
|
|
103
106
|
return true;
|