kushi-agents 5.8.2 → 5.8.3

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": "kushi-agents",
3
- "version": "5.8.2",
3
+ "version": "5.8.3",
4
4
  "description": "Install Kushi — multi-source project evidence agent with Comprehensive Structured Capture (CSC) into weekly-only files across Email, Teams, OneNote, Loop, SharePoint, Meetings, CRM, ADO. Meetings retain a sibling verbatim/ audit folder. WorkIQ-only for M365 sources (Graph / m365_* FORBIDDEN as fallbacks; user-paste is first-class). Host-agnostic.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -59,7 +59,11 @@ export async function ask(prompt, { bin, timeoutMs = 120_000, env = process.env,
59
59
  err.code = 'WORKIQ_NOT_FOUND';
60
60
  throw err;
61
61
  }
62
- const { stdout, stderr, exitCode } = await runProcess(exe, ['ask', '-q', prompt], { timeoutMs, env, onHeartbeat, heartbeatMs });
62
+ // Pass prompt via stdin instead of `-q "<prompt>"` argument. Multi-line prompts
63
+ // with embedded quotes get mangled by cmd.exe's argument parser even with
64
+ // windowsVerbatimArguments, causing workiq to receive corrupted input and
65
+ // hang indefinitely. stdin is a clean byte channel.
66
+ const { stdout, stderr, exitCode } = await runProcess(exe, ['ask'], { timeoutMs, env, onHeartbeat, heartbeatMs, stdin: prompt });
63
67
  if (exitCode !== 0) {
64
68
  const err = new Error(`workiq exited ${exitCode}: ${stderr.slice(0, 1000)}`);
65
69
  err.code = 'WORKIQ_EXIT_NONZERO';
@@ -117,7 +121,7 @@ function parseKvLines(s) {
117
121
 
118
122
  async function pathExists(p) { try { await fs.access(p); return true; } catch { return false; } }
119
123
 
120
- function runProcess(exe, args, { timeoutMs, env, onHeartbeat = null, heartbeatMs = 10_000 }) {
124
+ function runProcess(exe, args, { timeoutMs, env, onHeartbeat = null, heartbeatMs = 10_000, stdin = null }) {
121
125
  return new Promise((resolve, reject) => {
122
126
  // Node 20.12+ refuses to spawn .cmd/.bat on Windows without shell:true
123
127
  // (CVE-2024-27980). Detect and route through cmd.exe explicitly with
@@ -133,6 +137,10 @@ function runProcess(exe, args, { timeoutMs, env, onHeartbeat = null, heartbeatMs
133
137
  spawnOpts.windowsVerbatimArguments = true;
134
138
  }
135
139
  const child = spawn(spawnExe, spawnArgs, spawnOpts);
140
+ if (stdin != null) {
141
+ try { child.stdin.write(stdin); child.stdin.end(); }
142
+ catch (e) { /* if stdin already closed, child error handler will catch */ }
143
+ }
136
144
  let stdout = '';
137
145
  let stderr = '';
138
146
  let stdoutBytes = 0;