kojee-mcp 0.7.5-staging.13 → 0.7.5-staging.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.
@@ -296,7 +296,7 @@ async function startProxy(config) {
296
296
  console.error(`[kojee-mcp] Tandem memberships: ${tandemMembershipCount === -1 ? "unknown" : tandemMembershipCount}`);
297
297
  let server;
298
298
  const isHeadlessDaemon = !!process.env["KOJEE_HEADLESS"] || !!process.env["KOJEE_WEBHOOK_EXPECTED"];
299
- const { selectDelivery } = await import("./registry-KUVPZBB4.js");
299
+ const { selectDelivery } = await import("./registry-OEDV2EBZ.js");
300
300
  const delivery = selectDelivery(adapter.runtime, {
301
301
  supportsChannels: adapter.supportsChannels,
302
302
  headless: isHeadlessDaemon,
@@ -80,7 +80,18 @@ async function startEventStream(opts) {
80
80
  let stopped = false;
81
81
  const streamDispatcher = new Agent({
82
82
  bodyTimeout: UNDICI_DEFAULT_BODY_TIMEOUT_MS,
83
- headersTimeout: UNDICI_DEFAULT_BODY_TIMEOUT_MS
83
+ headersTimeout: UNDICI_DEFAULT_BODY_TIMEOUT_MS,
84
+ // FORCE HTTP/1.1 FOR THE SSE STREAM. undici 8.x defaults `allowH2: true`, so on a
85
+ // TLS connection ALPN negotiates HTTP/2 to the ALB. The ALB then RSTs the long-lived
86
+ // SSE stream with NGHTTP_INTERNAL_ERROR (H2 idle / per-stream lifetime limits), which
87
+ // undici surfaces as ERR_HTTP2_STREAM_ERROR — a mid-connection stream reset the
88
+ // reconnect loop can't recover from: it wedges (connected=false for 90s) → the
89
+ // liveness watchdog self-exits(1) → systemd restarts → a fresh session that may
90
+ // subscribe to a partial room-set. Observed fleet-wide (inst-clauron/henry/
91
+ // shakshuka-dev), 25 recorded flaps all with this signature. HTTP/1.1 keeps the SSE
92
+ // connection open indefinitely (nginx/ALB 3600s idle timeout + our heartbeats).
93
+ // Root-caused by Backend-Dev, 2026-08-04.
94
+ allowH2: false
84
95
  });
85
96
  const cursors = /* @__PURE__ */ new Map();
86
97
  let currentController = new AbortController();
@@ -189,10 +200,15 @@ async function connectAndConsume(opts, cursors, controller, isReconnect, state,
189
200
  await consumeSse(res.body, opts, controller, state, onCursor);
190
201
  return true;
191
202
  }
192
- async function openStream(opts, controller, sinceValue, dispatcher) {
203
+ function buildStreamUrl(brokerUrl, sinceValue, seatName) {
193
204
  const params = new URLSearchParams();
194
205
  if (sinceValue !== null) params.set("since", sinceValue);
195
- const url = `${opts.brokerUrl}/api/v2/tandems/stream${params.toString() ? "?" + params.toString() : ""}`;
206
+ if (seatName) params.set("seat_name", seatName);
207
+ const qs = params.toString();
208
+ return `${brokerUrl}/api/v2/tandems/stream${qs ? "?" + qs : ""}`;
209
+ }
210
+ async function openStream(opts, controller, sinceValue, dispatcher) {
211
+ const url = buildStreamUrl(opts.brokerUrl, sinceValue, opts.seatName);
196
212
  const proof = await createDPoPProof(
197
213
  opts.gateway.getPrivateKey(),
198
214
  opts.gateway.getKid(),
@@ -472,6 +488,7 @@ export {
472
488
  createBackoffController,
473
489
  LOG_HEARTBEAT_INTERVAL_MS,
474
490
  startEventStream,
491
+ buildStreamUrl,
475
492
  statusReason,
476
493
  serializeCursorMap,
477
494
  sanitizeDisplayname,
package/dist/cli.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-EIAUW6KO.js";
5
5
  import {
6
6
  startProxy
7
- } from "./chunk-FURFKXPF.js";
7
+ } from "./chunk-W2Y7JVH7.js";
8
8
  import "./chunk-CCVRXJJ2.js";
9
9
  import {
10
10
  pairedConfigPath
@@ -134,7 +134,7 @@ program.command("tail <path>").description("Stream a file's appends and follow (
134
134
  "--replay",
135
135
  "Replay the whole file from the start before following (default: follow from EOF, no replay)"
136
136
  ).action(async (filePath, opts) => {
137
- const { runTail } = await import("./tail-stream-LPOUQW2A.js");
137
+ const { runTail } = await import("./tail-stream-MODWTGVA.js");
138
138
  try {
139
139
  await runTail(filePath, { wakeOnly: opts.wakeOnly === true, replay: opts.replay === true });
140
140
  } catch (err) {
@@ -3,6 +3,7 @@ import {
3
3
  LOG_HEARTBEAT_INTERVAL_MS,
4
4
  UNARMED_FALLBACK_MS,
5
5
  UNDICI_DEFAULT_BODY_TIMEOUT_MS,
6
+ buildStreamUrl,
6
7
  createAdaptiveWatchdog,
7
8
  createBackoffController,
8
9
  normalizeBackendEvent,
@@ -11,7 +12,7 @@ import {
11
12
  startEventStream,
12
13
  statusReason,
13
14
  undiciFetch
14
- } from "./chunk-WNDYMWVI.js";
15
+ } from "./chunk-XXHYGH7G.js";
15
16
  import "./chunk-Z5LPNJQ6.js";
16
17
  import "./chunk-MIEI4PLB.js";
17
18
  export {
@@ -20,6 +21,7 @@ export {
20
21
  UNARMED_FALLBACK_MS,
21
22
  UNDICI_DEFAULT_BODY_TIMEOUT_MS,
22
23
  undiciFetch as _sseStreamFetch,
24
+ buildStreamUrl,
23
25
  createAdaptiveWatchdog,
24
26
  createBackoffController,
25
27
  normalizeBackendEvent,
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  listTandemIds,
3
3
  startProxy
4
- } from "./chunk-FURFKXPF.js";
4
+ } from "./chunk-W2Y7JVH7.js";
5
5
  import "./chunk-CCVRXJJ2.js";
6
6
  import "./chunk-TBVJOXIR.js";
7
7
  import "./chunk-Z5LPNJQ6.js";
package/dist/lib.d.ts CHANGED
@@ -262,6 +262,17 @@ interface EventStreamOptions {
262
262
  gateway: GatewayClient;
263
263
  adapter: HarnessAdapter;
264
264
  server: Server;
265
+ /**
266
+ * This connection's STABLE per-seat identity (SEAT-INVITE #226 per-seat
267
+ * routing). When set, the stream opens with `?seat_name=<value>` so the
268
+ * backend subscribes this seat's own `seat:{agent}:{seat_name}` channel and
269
+ * scopes the invite catch-up to it — so a per-seat invite wakes ONLY this
270
+ * seat, not every seat of a shared agent_id (the Clauron dev fleet all share
271
+ * one agent). It MUST be the exact `tandem_join` seat_name (e.g. "Backend-Dev",
272
+ * NOT the hyphen-form `KOJEE_INSTANCE`); the backend normalizes both sides
273
+ * identically. Unset ⇒ no `?seat_name=` (legacy agent-wide invite wake).
274
+ */
275
+ seatName?: string;
265
276
  queue?: EventQueue;
266
277
  eventLog?: EventLog;
267
278
  /**
package/dist/lib.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  normalizeBackendEvent,
3
3
  sanitizeDisplayname,
4
4
  startEventStream
5
- } from "./chunk-WNDYMWVI.js";
5
+ } from "./chunk-XXHYGH7G.js";
6
6
  import {
7
7
  resubscribeMemberships
8
8
  } from "./chunk-OT2GILXC.js";
@@ -125,7 +125,7 @@ function createClaudeCodeDelivery() {
125
125
  const { resubscribeMemberships } = await import("./resubscribe-G5OGDZJD.js");
126
126
  const { resolveWebhookConfig } = await import("./webhook-config-O4WMQ532.js");
127
127
  const { createWebhookSink } = await import("./webhook-sink-N6AUTFL3.js");
128
- const { startEventStream } = await import("./event-stream-L57IAFYG.js");
128
+ const { startEventStream } = await import("./event-stream-K6G7B2KY.js");
129
129
  const { createMcpServer } = await import("./server-VM3ZIGSZ.js");
130
130
  const { deriveDiscoveryKey } = await import("./ancestry-A2F5KQ6A.js");
131
131
  const { resolveSharedSessionId } = await import("./cc-session-id-NNCZCHZZ.js");
@@ -254,6 +254,9 @@ function createClaudeCodeDelivery() {
254
254
  gateway: ctx.gateway,
255
255
  adapter: ctx.adapter,
256
256
  server,
257
+ // SEAT-INVITE #226 per-seat routing: this seat's stable seat_name, set
258
+ // per-seat in the fleet systemd env. Unset ⇒ legacy agent-wide wake.
259
+ seatName: process.env["CLAURON_SEAT_NAME"] || void 0,
257
260
  // eventLog is passed so the stream's status/heartbeat lines land in the
258
261
  // status sibling (emitStatus / heartbeat use opts.eventLog.appendStatus).
259
262
  // The PER-EVENT fan-out (queue/eventLog/channel/webhook) is owned by
@@ -322,7 +325,7 @@ function createWebhookDelivery(name, pendingLedger) {
322
325
  const { resolveWebhookConfig } = await import("./webhook-config-O4WMQ532.js");
323
326
  const { createWebhookSink } = await import("./webhook-sink-N6AUTFL3.js");
324
327
  const { resubscribeMemberships } = await import("./resubscribe-G5OGDZJD.js");
325
- const { startEventStream } = await import("./event-stream-L57IAFYG.js");
328
+ const { startEventStream } = await import("./event-stream-K6G7B2KY.js");
326
329
  const { createMcpServer } = await import("./server-VM3ZIGSZ.js");
327
330
  sweepStaleEventLogs();
328
331
  eventLog = startEventLog({
@@ -372,6 +375,9 @@ function createWebhookDelivery(name, pendingLedger) {
372
375
  gateway: ctx.gateway,
373
376
  adapter: ctx.adapter,
374
377
  server,
378
+ // SEAT-INVITE #226 per-seat routing: this seat's stable seat_name, set
379
+ // per-seat in the fleet systemd env. Unset ⇒ legacy agent-wide wake.
380
+ seatName: process.env["CLAURON_SEAT_NAME"] || void 0,
375
381
  eventLog,
376
382
  delivery: this,
377
383
  onConnected: /* @__PURE__ */ (() => {
@@ -515,7 +521,7 @@ function createOpenclawDelivery(deps = {}) {
515
521
  async start(ctx) {
516
522
  const { startEventLog, sweepStaleEventLogs } = await import("./event-log-M22X3FAI.js");
517
523
  const { resubscribeMemberships } = await import("./resubscribe-G5OGDZJD.js");
518
- const { startEventStream } = await import("./event-stream-L57IAFYG.js");
524
+ const { startEventStream } = await import("./event-stream-K6G7B2KY.js");
519
525
  const { createMcpServer } = await import("./server-VM3ZIGSZ.js");
520
526
  sweepStaleEventLogs();
521
527
  eventLog = startEventLog({
@@ -542,6 +548,9 @@ function createOpenclawDelivery(deps = {}) {
542
548
  gateway: ctx.gateway,
543
549
  adapter: ctx.adapter,
544
550
  server,
551
+ // SEAT-INVITE #226 per-seat routing: this seat's stable seat_name, set
552
+ // per-seat in the fleet systemd env. Unset ⇒ legacy agent-wide wake.
553
+ seatName: process.env["CLAURON_SEAT_NAME"] || void 0,
545
554
  eventLog,
546
555
  delivery: this,
547
556
  onConnected: /* @__PURE__ */ (() => {
@@ -9,7 +9,7 @@ import {
9
9
  LOG_HEARTBEAT_INTERVAL_MS,
10
10
  UNARMED_FALLBACK_MS,
11
11
  createAdaptiveWatchdog
12
- } from "./chunk-WNDYMWVI.js";
12
+ } from "./chunk-XXHYGH7G.js";
13
13
  import "./chunk-Z5LPNJQ6.js";
14
14
  import "./chunk-MIEI4PLB.js";
15
15
  import "./chunk-U5HHHRXA.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kojee-mcp",
3
- "version": "0.7.5-staging.13",
3
+ "version": "0.7.5-staging.15",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "exports": {