@testchimp/cli 0.1.49 → 0.1.50

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.
@@ -584,7 +584,7 @@ function startOpencodeSseRelay(attachUrl, callbacks) {
584
584
  if (stopped || ac.signal.aborted)
585
585
  return;
586
586
  if (!connected && attempt === 0) {
587
- console.error("ChimpHands OpenCode SSE unavailable falling back to completed-only --format json events (will keep retrying SSE)");
587
+ console.error("ChimpHands OpenCode SSE not connected yet using completed-only --format json until SSE connects (retrying)");
588
588
  }
589
589
  attempt += 1;
590
590
  const backoff = Math.min(30_000, 2_000 * attempt);
@@ -1090,10 +1090,20 @@ export async function runChimphands(opts) {
1090
1090
  const poster = new AgentEventPoster(backend, apiKey, sessionId);
1091
1091
  poster.uiAttached = !!(boot.uiAttached ?? boot.ui_attached);
1092
1092
  let stopLiveSse = null;
1093
+ /** Do not open localhost OpenCode /event until serve has been (re)started with config. */
1094
+ let opencodeHttpReady = !attachUrl;
1095
+ let pendingUiAttached = !!(boot.uiAttached ?? boot.ui_attached);
1093
1096
  const syncLiveSse = (attached) => {
1094
1097
  poster.uiAttached = attached;
1098
+ pendingUiAttached = attached;
1095
1099
  if (!attachUrl)
1096
1100
  return;
1101
+ if (!opencodeHttpReady) {
1102
+ if (attached) {
1103
+ console.error("ChimpHands UI attached — deferring OpenCode SSE until serve is ready");
1104
+ }
1105
+ return;
1106
+ }
1097
1107
  if (attached && !stopLiveSse) {
1098
1108
  console.error("ChimpHands UI attached — starting OpenCode SSE fanout");
1099
1109
  stopLiveSse = startOpencodeSseRelay(attachUrl, {
@@ -1167,7 +1177,10 @@ export async function runChimphands(opts) {
1167
1177
  console.error(`ChimpHands OpenCode attach: ${attachUrl}`);
1168
1178
  // Serve must load opencode.json (provider + default_agent). Workflow often starts
1169
1179
  // serve before this file exists; restart so attach mode can omit --agent safely.
1180
+ // Heartbeat may have already reported ui_attached — wait until after restart to open SSE.
1170
1181
  await restartLocalOpencodeServer(attachUrl);
1182
+ opencodeHttpReady = true;
1183
+ syncLiveSse(pendingUiAttached);
1171
1184
  }
1172
1185
  let opencodeSessionId = bootStr(boot, "opencode_session_id", "opencodeSessionId") || undefined;
1173
1186
  const conversationSummary = bootStr(boot, "conversation_summary", "conversationSummary");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testchimp/cli",
3
- "version": "0.1.49",
3
+ "version": "0.1.50",
4
4
  "description": "TestChimp CLI and MCP server — coverage, plans, EaaS, TrueCoverage, API operations (calls /api/mcp/*)",
5
5
  "type": "module",
6
6
  "main": "dist/bin/testchimp.js",