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