agent-exchange 0.0.1 → 0.0.2
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/index.mjs +9 -2
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -90,9 +90,12 @@ async function handleInboundCall(msg) {
|
|
|
90
90
|
|
|
91
91
|
function runClaude(prompt) {
|
|
92
92
|
return new Promise((resolve, reject) => {
|
|
93
|
-
const
|
|
93
|
+
const claudePath = process.env.CLAUDE_PATH || "claude";
|
|
94
|
+
log(`Spawning: ${claudePath} -p "${prompt.substring(0, 80)}..."`);
|
|
95
|
+
const proc = spawn(claudePath, ["-p", prompt, "--output-format", "json"], {
|
|
94
96
|
stdio: ["pipe", "pipe", "pipe"],
|
|
95
97
|
timeout: 300000,
|
|
98
|
+
shell: true,
|
|
96
99
|
});
|
|
97
100
|
|
|
98
101
|
let stdout = "";
|
|
@@ -101,6 +104,7 @@ function runClaude(prompt) {
|
|
|
101
104
|
proc.stderr.on("data", (d) => stderr += d);
|
|
102
105
|
|
|
103
106
|
proc.on("close", (code) => {
|
|
107
|
+
log(`claude exited with code ${code}`);
|
|
104
108
|
if (code !== 0) {
|
|
105
109
|
reject(new Error(stderr || `claude exited with code ${code}`));
|
|
106
110
|
return;
|
|
@@ -113,7 +117,10 @@ function runClaude(prompt) {
|
|
|
113
117
|
}
|
|
114
118
|
});
|
|
115
119
|
|
|
116
|
-
proc.on("error", (err) =>
|
|
120
|
+
proc.on("error", (err) => {
|
|
121
|
+
log(`spawn error: ${err.message}`);
|
|
122
|
+
reject(err);
|
|
123
|
+
});
|
|
117
124
|
});
|
|
118
125
|
}
|
|
119
126
|
|