@insitue/claude-plugin 0.4.4 → 0.4.5

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.
@@ -77,11 +77,7 @@ Either path is fine; pick whichever your runtime has.
77
77
  question while you're between calls, answer it first (since
78
78
  the chat is responsive), then resume the loop with
79
79
  `next_pick`.
80
- 4. If a pick comes back with `target` starting with
81
- `[insitue]` (e.g. "companion disconnected"), tell the user
82
- what happened in one sentence and call `next_pick` again —
83
- the bridge auto-reconnects.
84
- 5. **End the session properly.** When the user says "stop",
80
+ 4. **End the session properly.** When the user says "stop",
85
81
  "done", "quit", "thanks", "exit", "disconnect", "stop
86
82
  insitue", or anything else that clearly ends the InSitue
87
83
  session, do BOTH of these:
@@ -238,22 +238,18 @@ var PickBuffer = class {
238
238
  recent(limit) {
239
239
  return this.picks.slice(-limit);
240
240
  }
241
- /** WS reconnectsdrop pending waiters with a sentinel so claude
242
- * sees the disruption instead of hanging forever. */
243
- rejectAll(reason) {
241
+ /** WS droppedrelease pending waiters silently. They resolve to
242
+ * `null` (same shape as a natural timeout), so the agent's
243
+ * next_pick loop just calls again and the auto-reconnect 2s
244
+ * timer heals the bridge invisibly. We previously synthesized a
245
+ * fake "reconnect" pick here; that surfaced HMR / plugin-reload
246
+ * blips to the user as if they were real picks and trained the
247
+ * agent to stop looping. The stderr trace at the close call site
248
+ * is the operator-visible signal; the agent stays quiet. */
249
+ dropWaiters() {
244
250
  for (const w of this.waiters) {
245
251
  clearTimeout(w.timer);
246
- w.resolve({
247
- id: "reconnect",
248
- at: (/* @__PURE__ */ new Date()).toISOString(),
249
- source: null,
250
- confidence: "n/a",
251
- target: `[insitue] ${reason}`,
252
- selector: null,
253
- userNote: null,
254
- url: null,
255
- componentStack: []
256
- });
252
+ w.resolve(null);
257
253
  }
258
254
  this.waiters.length = 0;
259
255
  }
@@ -418,8 +414,11 @@ function connectToCompanion(s) {
418
414
  });
419
415
  ws.on("close", () => {
420
416
  if (activeWs === ws) activeWs = null;
421
- buffer.rejectAll("companion disconnected \u2014 restart `claude` to reconnect");
417
+ buffer.dropWaiters();
422
418
  if (disconnecting) return;
419
+ process.stderr.write(
420
+ "[insitue-mcp] companion link dropped \u2014 reconnecting in 2s\n"
421
+ );
423
422
  reconnectTimer = setTimeout(() => connectToCompanion(s), 2e3);
424
423
  });
425
424
  ws.on("error", () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@insitue/claude-plugin",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
4
4
  "description": "Drive Claude (Code AND Desktop) from the InSitue browser overlay — pick an element in your app, claude reads the file and proposes the edit.",
5
5
  "license": "MIT",
6
6
  "type": "module",