mindwire 0.1.14 → 0.1.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/dist/index.js CHANGED
@@ -380,8 +380,9 @@ var Run = class _Run {
380
380
  await this.http.request("POST", `/runs/${encodeURIComponent(this.id)}/cancel`);
381
381
  }
382
382
  /**
383
- * Answer a mid-turn interaction the turn is waiting on — a permission approval, or an
384
- * AskUserQuestion / ExitPlanMode reply. Requires the agent's `respond` capability.
383
+ * Answer a pending permission, question or plan. Message-mode questions remain answerable
384
+ * after completion; the daemon steers or resumes the conversation. Read the chat's latest
385
+ * run after replying to a completed run. Requires the agent's `respond` capability.
385
386
  */
386
387
  async respond(input = {}) {
387
388
  await this.http.request("POST", `/runs/${encodeURIComponent(this.id)}/respond`, { body: input });
@@ -641,7 +642,7 @@ var SurfacesApi = class {
641
642
  };
642
643
 
643
644
  // src/version.ts
644
- var SDK_VERSION = "0.1.14" ;
645
+ var SDK_VERSION = "0.1.15" ;
645
646
 
646
647
  // src/daemon-binary.ts
647
648
  function supported(platform, arch) {
@@ -1621,11 +1622,21 @@ async function deploy(host, cfg, emit2, token, directory) {
1621
1622
  `mv -f ${BIN_NEW} ${BIN}`,
1622
1623
  `chmod +x ${BIN}`,
1623
1624
  // Detach so the daemon survives this exec's shell exiting. ADDR=":<port>" binds 0.0.0.0.
1624
- `"\${mw_detach[@]}" nohup env ADDR=":${cfg.port}" AGENT_TYPE=${shellQuote(cfg.agent)} AGENT_CWD=${shellQuote(cfg.agentCwd)} STATE_PATH=${STATE} DAEMON_TOKEN="$mw_token" ${BIN} > ${LOG} 2>&1 < /dev/null 9>&- &`,
1625
+ // Ignore HUP directly: macOS nohup can fail after setsid in a headless workspace.
1626
+ `"\${mw_detach[@]}" /bin/sh -c 'trap "" HUP; exec "$@"' mindwire-service env ADDR=":${cfg.port}" AGENT_TYPE=${shellQuote(cfg.agent)} AGENT_CWD=${shellQuote(cfg.agentCwd)} STATE_PATH=${STATE} DAEMON_TOKEN="$mw_token" ${BIN} > ${LOG} 2>&1 < /dev/null 9>&- &`,
1625
1627
  // Health-poll from inside the VM (loopback) and emit a marker — exit codes are unreliable here.
1626
- `for ((mw_attempt=0; mw_attempt<60; mw_attempt++)); do curl -fsS --max-time 2 -H "Authorization: Bearer $mw_token" http://127.0.0.1:${cfg.port}/healthz >/dev/null 2>&1 && { echo MINDWIRE_READY; exit 0; }; sleep 0.25; done`,
1627
- "echo MINDWIRE_FAIL",
1628
- `tail -n 40 ${LOG} 2>/dev/null || true`
1628
+ 'mw_pid=$!; mw_exit=""; mw_deadline=$((SECONDS + 30))',
1629
+ `while (( SECONDS < mw_deadline )); do curl -fsS --connect-timeout 2 --max-time 3 -H "Authorization: Bearer $mw_token" http://127.0.0.1:${cfg.port}/healthz >/dev/null 2>&1 && { echo MINDWIRE_READY; exit 0; };`,
1630
+ ' if [ -z "$mw_exit" ] && ! kill -0 "$mw_pid" 2>/dev/null; then',
1631
+ ' mw_exit=0; wait "$mw_pid" || mw_exit=$?; [ "$mw_exit" = 0 ] || break',
1632
+ " fi",
1633
+ " sleep 0.25",
1634
+ "done",
1635
+ `mw_tail=$(tail -n 40 ${LOG} 2>/dev/null || true)`,
1636
+ 'if [ -n "$mw_exit" ] && [ "$mw_exit" != 0 ]; then mw_reason="Mindwire exited during startup (status $mw_exit).";',
1637
+ 'else mw_reason="The Mindwire service did not become ready."; fi',
1638
+ '[ -z "$mw_tail" ] || mw_reason="$mw_reason $mw_tail"',
1639
+ 'printf "MINDWIRE_FAIL %s\\n" "$mw_reason"'
1629
1640
  ].join("\n");
1630
1641
  emit2({ phase: "launch", message: "launching daemon" });
1631
1642
  const res = await host.exec(["bash", "-lc", script], { timeoutSeconds: 420 });