kojee-mcp 0.5.11 → 0.5.13
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/README.md +24 -0
- package/dist/ancestry-ONFBQEP5.js +8 -0
- package/dist/{chunk-LDZXU3DW.js → chunk-2OLXXOT3.js} +1 -0
- package/dist/{codex-stop-hook-SWA53ECG.js → chunk-35XBRG3V.js} +4 -3
- package/dist/chunk-3H3TL34J.js +401 -0
- package/dist/{chunk-MKDMAAMN.js → chunk-74XFVX6Z.js} +16 -4
- package/dist/chunk-CM3EKMDD.js +116 -0
- package/dist/{chunk-DS26OORG.js → chunk-CO73VGWM.js} +41 -23
- package/dist/{chunk-HIZ4NDWN.js → chunk-DXJ6QLSJ.js} +22 -2
- package/dist/{chunk-HSR3GXCL.js → chunk-IMOEZ4NJ.js} +83 -6
- package/dist/{chunk-2MIISF2W.js → chunk-NR4Y54OL.js} +14 -1
- package/dist/chunk-XLKGPGZT.js +0 -0
- package/dist/chunk-XXFVWP6H.js +44 -0
- package/dist/cli.js +17 -15
- package/dist/codex-stop-hook-VY7DOMAG.js +16 -0
- package/dist/{doctor-XK335W7B.js → doctor-FVTALRQD.js} +110 -15
- package/dist/{event-log-B27VVEMK.js → event-log-VZD7NKYX.js} +1 -1
- package/dist/event-stream-XX5EZ6HN.js +19 -0
- package/dist/{gateway-client-93P1E0CZ.d.ts → gateway-client-C6yx1mfM.d.ts} +6 -1
- package/dist/{hook-server-37E2LUKJ.js → hook-server-T2Z444OV.js} +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -7
- package/dist/lib.d.ts +224 -3
- package/dist/lib.js +16 -11
- package/dist/{parent-watchdog-RZLHYP7T.js → parent-watchdog-TLU355FB.js} +1 -1
- package/dist/registry-TGALQP6M.js +348 -0
- package/dist/{send-cli-CN5EX7PO.js → send-cli-RH7D4JDP.js} +18 -10
- package/dist/server-LBVEDIXP.js +14 -0
- package/dist/{stop-hook-GEJF47SN.js → stop-hook-CUVDKXP7.js} +7 -6
- package/dist/{tail-stream-JNR4WFW3.js → tail-stream-5DAVRQYK.js} +4 -3
- package/dist/{user-prompt-submit-hook-DGRRFHOB.js → user-prompt-submit-hook-PMBUPKUV.js} +5 -5
- package/dist/{webhook-sink-NWGCUDGY.js → webhook-sink-N6AUTFL3.js} +1 -1
- package/package.json +1 -1
- package/dist/chunk-D42PZX2I.js +0 -784
- package/dist/{chunk-BJMASMKX.js → chunk-VHKPWUX7.js} +0 -0
- package/dist/{doctor-codex-SMROUYGV.js → doctor-codex-PA3WO6LR.js} +1 -1
- package/dist/{wizard-PLGHYCT3.js → wizard-L4MYRLJI.js} +11 -11
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import "./chunk-35XBRG3V.js";
|
|
2
|
+
import "./chunk-PHXO5P25.js";
|
|
3
|
+
import "./chunk-LSUB6QMP.js";
|
|
4
|
+
import {
|
|
5
|
+
claudeCodeAdapter
|
|
6
|
+
} from "./chunk-XXFVWP6H.js";
|
|
7
|
+
import "./chunk-CM3EKMDD.js";
|
|
8
|
+
import "./chunk-X672ZN7V.js";
|
|
9
|
+
import "./chunk-2OLXXOT3.js";
|
|
10
|
+
|
|
11
|
+
// src/delivery/lib/fanout.ts
|
|
12
|
+
async function deliverEvent(event, sinks) {
|
|
13
|
+
sinks.queue?.push(event);
|
|
14
|
+
if (sinks.eventLog) {
|
|
15
|
+
try {
|
|
16
|
+
await sinks.eventLog.append(event);
|
|
17
|
+
sinks.queue?.markMonitorDelivered(event.id);
|
|
18
|
+
} catch (err) {
|
|
19
|
+
console.error("[event-stream] event-log append failed:", err);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (sinks.formatChannelNotification && sinks.server) {
|
|
23
|
+
try {
|
|
24
|
+
const channel = sinks.formatChannelNotification(event);
|
|
25
|
+
await sinks.server.notification({
|
|
26
|
+
method: "notifications/claude/channel",
|
|
27
|
+
params: channel
|
|
28
|
+
});
|
|
29
|
+
sinks.queue?.markChannelDelivered(event.id);
|
|
30
|
+
} catch (err) {
|
|
31
|
+
console.error("[event-stream] channel notification failed:", err);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
sinks.webhookSink?.enqueue(event);
|
|
36
|
+
} catch (err) {
|
|
37
|
+
console.error("[event-stream] webhook enqueue failed:", err);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// src/delivery/lib/channel.ts
|
|
42
|
+
function formatChannelNotification(event) {
|
|
43
|
+
return claudeCodeAdapter.formatTandemEvent(event);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// src/delivery/claude-code.ts
|
|
47
|
+
function createClaudeCodeDelivery() {
|
|
48
|
+
let eventLog = null;
|
|
49
|
+
let webhookSink = null;
|
|
50
|
+
let queue = null;
|
|
51
|
+
let server = null;
|
|
52
|
+
let hookServer = null;
|
|
53
|
+
let cleanupDiscoveryFile = null;
|
|
54
|
+
let streamHandle = null;
|
|
55
|
+
return {
|
|
56
|
+
name: "claude-code",
|
|
57
|
+
async start(ctx) {
|
|
58
|
+
const { EventQueue } = await import("./event-queue-5YVJFR3E.js");
|
|
59
|
+
const { startHookServer } = await import("./hook-server-T2Z444OV.js");
|
|
60
|
+
const {
|
|
61
|
+
writeDiscoveryByKey,
|
|
62
|
+
cleanupDiscoveryByKey,
|
|
63
|
+
sweepStaleDiscovery
|
|
64
|
+
} = await import("./session-discovery-FNMJGFPM.js");
|
|
65
|
+
const { startEventLog, sweepStaleEventLogs } = await import("./event-log-VZD7NKYX.js");
|
|
66
|
+
const { resubscribeMemberships } = await import("./resubscribe-G5OGDZJD.js");
|
|
67
|
+
const { resolveWebhookConfig } = await import("./webhook-config-O4WMQ532.js");
|
|
68
|
+
const { createWebhookSink } = await import("./webhook-sink-N6AUTFL3.js");
|
|
69
|
+
const { startEventStream } = await import("./event-stream-XX5EZ6HN.js");
|
|
70
|
+
const { createMcpServer } = await import("./server-LBVEDIXP.js");
|
|
71
|
+
const { deriveDiscoveryKey } = await import("./ancestry-ONFBQEP5.js");
|
|
72
|
+
sweepStaleDiscovery();
|
|
73
|
+
sweepStaleEventLogs();
|
|
74
|
+
const projectDir = process.env["CLAUDE_PROJECT_DIR"];
|
|
75
|
+
const discoveryKey = deriveDiscoveryKey(projectDir, ctx.ccPid);
|
|
76
|
+
eventLog = startEventLog({
|
|
77
|
+
key: ctx.instanceKey,
|
|
78
|
+
...ctx.eventLogDir ? { dir: ctx.eventLogDir } : {}
|
|
79
|
+
});
|
|
80
|
+
const log = eventLog;
|
|
81
|
+
const webhookResolution = resolveWebhookConfig();
|
|
82
|
+
if (webhookResolution.error) {
|
|
83
|
+
console.error(`[kojee-mcp] webhook sink ERROR: ${webhookResolution.error}`);
|
|
84
|
+
void log.appendStatus(`status=webhook error="${webhookResolution.error}"`).catch(() => {
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
if (webhookResolution.warning) {
|
|
88
|
+
console.error(`[kojee-mcp] webhook sink WARNING: ${webhookResolution.warning}`);
|
|
89
|
+
void log.appendStatus(`status=webhook warning="${webhookResolution.warning}"`).catch(() => {
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
webhookSink = webhookResolution.enabled && webhookResolution.config ? createWebhookSink(webhookResolution.config, {
|
|
93
|
+
log: (line) => {
|
|
94
|
+
void log.appendStatus(`status=webhook ${line}`).catch(() => {
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}) : null;
|
|
98
|
+
if (webhookSink) {
|
|
99
|
+
console.error(`[kojee-mcp] webhook sink ENABLED (${webhookSink.configSummary()})`);
|
|
100
|
+
void log.appendStatus(`status=webhook enabled ${webhookSink.configSummary()}`).catch(() => {
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
server = createMcpServer(
|
|
104
|
+
ctx.registry,
|
|
105
|
+
ctx.adapter,
|
|
106
|
+
ctx.tandemMembershipCount,
|
|
107
|
+
eventLog.path,
|
|
108
|
+
ctx.toolCallHooks
|
|
109
|
+
);
|
|
110
|
+
const { issueControlToken, controlTokenPath } = await import("./control-token-4BUCTYQB.js");
|
|
111
|
+
let controlToken = null;
|
|
112
|
+
try {
|
|
113
|
+
controlToken = issueControlToken();
|
|
114
|
+
} catch (err) {
|
|
115
|
+
console.error(
|
|
116
|
+
"[kojee-mcp] control token write failed \u2014 POST /send disabled; GET /poll and /status left UNGATED (degrade open):",
|
|
117
|
+
err.message
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
queue = new EventQueue();
|
|
121
|
+
const localQueue = queue;
|
|
122
|
+
let liveStream = null;
|
|
123
|
+
hookServer = await startHookServer({
|
|
124
|
+
port: 0,
|
|
125
|
+
queue: localQueue,
|
|
126
|
+
adapter: ctx.adapter,
|
|
127
|
+
...controlToken !== null ? { controlToken, send: { gateway: ctx.gateway, authToken: controlToken } } : {},
|
|
128
|
+
getStreamState: () => liveStream ? liveStream.getState() : {
|
|
129
|
+
connected: false,
|
|
130
|
+
connectedSince: null,
|
|
131
|
+
lastEventAt: null,
|
|
132
|
+
lastHeartbeatAt: null,
|
|
133
|
+
cursors: {},
|
|
134
|
+
reconnectCount: 0,
|
|
135
|
+
staleAfterMs: null
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
writeDiscoveryByKey(discoveryKey, {
|
|
139
|
+
schema: 2,
|
|
140
|
+
discoveryKey,
|
|
141
|
+
ccPid: ctx.ccPid,
|
|
142
|
+
projectDir: projectDir ?? null,
|
|
143
|
+
proxyPid: process.pid,
|
|
144
|
+
pid: process.pid,
|
|
145
|
+
port: hookServer.port,
|
|
146
|
+
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
147
|
+
brokerUrl: ctx.config.url,
|
|
148
|
+
eventLogPath: eventLog.path,
|
|
149
|
+
...controlToken !== null ? { controlTokenPath: controlTokenPath() } : {},
|
|
150
|
+
authMode: ctx.config.authMode ?? "paired"
|
|
151
|
+
});
|
|
152
|
+
cleanupDiscoveryFile = () => cleanupDiscoveryByKey(discoveryKey);
|
|
153
|
+
const localCleanupDiscovery = cleanupDiscoveryFile;
|
|
154
|
+
const localHookServer = hookServer;
|
|
155
|
+
const exitCleanup = () => {
|
|
156
|
+
localCleanupDiscovery();
|
|
157
|
+
eventLog?.cleanup();
|
|
158
|
+
};
|
|
159
|
+
const teardown = [
|
|
160
|
+
() => {
|
|
161
|
+
void webhookSink?.stop();
|
|
162
|
+
},
|
|
163
|
+
() => localCleanupDiscovery(),
|
|
164
|
+
() => eventLog?.cleanup(),
|
|
165
|
+
() => localHookServer.stop()
|
|
166
|
+
];
|
|
167
|
+
streamHandle = await startEventStream({
|
|
168
|
+
brokerUrl: ctx.config.url,
|
|
169
|
+
token: ctx.config.token,
|
|
170
|
+
gateway: ctx.gateway,
|
|
171
|
+
adapter: ctx.adapter,
|
|
172
|
+
server,
|
|
173
|
+
// eventLog is passed so the stream's status/heartbeat lines land in the
|
|
174
|
+
// status sibling (emitStatus / heartbeat use opts.eventLog.appendStatus).
|
|
175
|
+
// The PER-EVENT fan-out (queue/eventLog/channel/webhook) is owned by
|
|
176
|
+
// `delivery.deliver` below, so queue/webhookSink are NOT re-wired here —
|
|
177
|
+
// the queue still feeds the hook-server /poll directly (startHookServer).
|
|
178
|
+
eventLog,
|
|
179
|
+
delivery: this,
|
|
180
|
+
onConnected: /* @__PURE__ */ (() => {
|
|
181
|
+
const debounceState = { lastRunAt: 0 };
|
|
182
|
+
return async () => {
|
|
183
|
+
await resubscribeMemberships({
|
|
184
|
+
gateway: ctx.gateway,
|
|
185
|
+
eventLog,
|
|
186
|
+
listTandems: async () => await ctx.listTandemIds() ?? [],
|
|
187
|
+
debounceState
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
})()
|
|
191
|
+
});
|
|
192
|
+
liveStream = streamHandle;
|
|
193
|
+
ctx.onStreamReady?.(streamHandle);
|
|
194
|
+
return { server, teardown, exitCleanup };
|
|
195
|
+
},
|
|
196
|
+
async deliver(event) {
|
|
197
|
+
await deliverEvent(event, {
|
|
198
|
+
...queue ? { queue } : {},
|
|
199
|
+
...eventLog ? { eventLog } : {},
|
|
200
|
+
...server ? { server } : {},
|
|
201
|
+
// Channel notification is gated by providing the formatter (claude-code
|
|
202
|
+
// supportsChannels=true). formatChannelNotification throws by contract
|
|
203
|
+
// for other runtimes, but this delivery is only ever built for
|
|
204
|
+
// claude-code, so it is always the channel-capable path.
|
|
205
|
+
formatChannelNotification,
|
|
206
|
+
...webhookSink ? { webhookSink } : {}
|
|
207
|
+
});
|
|
208
|
+
},
|
|
209
|
+
async stop() {
|
|
210
|
+
await webhookSink?.stop();
|
|
211
|
+
cleanupDiscoveryFile?.();
|
|
212
|
+
eventLog?.cleanup();
|
|
213
|
+
await hookServer?.stop();
|
|
214
|
+
},
|
|
215
|
+
health() {
|
|
216
|
+
const state = streamHandle?.getState();
|
|
217
|
+
return {
|
|
218
|
+
connected: state ? state.connected ?? null : null,
|
|
219
|
+
...state ? { detail: { stream: state } } : {}
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// src/delivery/hermes.ts
|
|
226
|
+
function createWebhookDelivery(name) {
|
|
227
|
+
let eventLog = null;
|
|
228
|
+
let webhookSink = null;
|
|
229
|
+
let streamHandle = null;
|
|
230
|
+
return {
|
|
231
|
+
name,
|
|
232
|
+
async start(ctx) {
|
|
233
|
+
const { startEventLog, sweepStaleEventLogs } = await import("./event-log-VZD7NKYX.js");
|
|
234
|
+
const { resolveWebhookConfig } = await import("./webhook-config-O4WMQ532.js");
|
|
235
|
+
const { createWebhookSink } = await import("./webhook-sink-N6AUTFL3.js");
|
|
236
|
+
const { resubscribeMemberships } = await import("./resubscribe-G5OGDZJD.js");
|
|
237
|
+
const { startEventStream } = await import("./event-stream-XX5EZ6HN.js");
|
|
238
|
+
const { createMcpServer } = await import("./server-LBVEDIXP.js");
|
|
239
|
+
sweepStaleEventLogs();
|
|
240
|
+
eventLog = startEventLog({
|
|
241
|
+
key: ctx.instanceKey,
|
|
242
|
+
...ctx.eventLogDir ? { dir: ctx.eventLogDir } : {}
|
|
243
|
+
});
|
|
244
|
+
const log = eventLog;
|
|
245
|
+
const webhookResolution = resolveWebhookConfig();
|
|
246
|
+
if (webhookResolution.error) {
|
|
247
|
+
console.error(`[kojee-mcp] webhook sink ERROR: ${webhookResolution.error}`);
|
|
248
|
+
void log.appendStatus(`status=webhook error="${webhookResolution.error}"`).catch(() => {
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
if (webhookResolution.warning) {
|
|
252
|
+
console.error(`[kojee-mcp] webhook sink WARNING: ${webhookResolution.warning}`);
|
|
253
|
+
void log.appendStatus(`status=webhook warning="${webhookResolution.warning}"`).catch(() => {
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
webhookSink = webhookResolution.enabled && webhookResolution.config ? createWebhookSink(webhookResolution.config, {
|
|
257
|
+
log: (line) => {
|
|
258
|
+
void log.appendStatus(`status=webhook ${line}`).catch(() => {
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}) : null;
|
|
262
|
+
if (webhookSink) {
|
|
263
|
+
console.error(`[kojee-mcp] webhook sink ENABLED (${webhookSink.configSummary()})`);
|
|
264
|
+
void log.appendStatus(`status=webhook enabled ${webhookSink.configSummary()}`).catch(() => {
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
const server = createMcpServer(
|
|
268
|
+
ctx.registry,
|
|
269
|
+
ctx.adapter,
|
|
270
|
+
ctx.tandemMembershipCount,
|
|
271
|
+
void 0,
|
|
272
|
+
ctx.toolCallHooks
|
|
273
|
+
);
|
|
274
|
+
const exitCleanup = () => eventLog?.cleanup();
|
|
275
|
+
const teardown = [
|
|
276
|
+
() => {
|
|
277
|
+
void webhookSink?.stop();
|
|
278
|
+
},
|
|
279
|
+
() => eventLog?.cleanup()
|
|
280
|
+
];
|
|
281
|
+
streamHandle = await startEventStream({
|
|
282
|
+
brokerUrl: ctx.config.url,
|
|
283
|
+
token: ctx.config.token,
|
|
284
|
+
gateway: ctx.gateway,
|
|
285
|
+
adapter: ctx.adapter,
|
|
286
|
+
server,
|
|
287
|
+
eventLog,
|
|
288
|
+
delivery: this,
|
|
289
|
+
onConnected: /* @__PURE__ */ (() => {
|
|
290
|
+
const debounceState = { lastRunAt: 0 };
|
|
291
|
+
return async () => {
|
|
292
|
+
await resubscribeMemberships({
|
|
293
|
+
gateway: ctx.gateway,
|
|
294
|
+
eventLog,
|
|
295
|
+
listTandems: async () => await ctx.listTandemIds() ?? [],
|
|
296
|
+
debounceState
|
|
297
|
+
});
|
|
298
|
+
};
|
|
299
|
+
})()
|
|
300
|
+
});
|
|
301
|
+
ctx.onStreamReady?.(streamHandle);
|
|
302
|
+
return { server, teardown, exitCleanup };
|
|
303
|
+
},
|
|
304
|
+
async deliver(event) {
|
|
305
|
+
await deliverEvent(event, {
|
|
306
|
+
...eventLog ? { eventLog } : {},
|
|
307
|
+
...webhookSink ? { webhookSink } : {}
|
|
308
|
+
});
|
|
309
|
+
},
|
|
310
|
+
async stop() {
|
|
311
|
+
await webhookSink?.stop();
|
|
312
|
+
eventLog?.cleanup();
|
|
313
|
+
},
|
|
314
|
+
health() {
|
|
315
|
+
const state = streamHandle?.getState();
|
|
316
|
+
return {
|
|
317
|
+
connected: state ? state.connected ?? null : null,
|
|
318
|
+
...state ? { detail: { stream: state } } : {}
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// src/delivery/codex.ts
|
|
325
|
+
function createCodexDelivery() {
|
|
326
|
+
return createWebhookDelivery("codex");
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// src/delivery/registry.ts
|
|
330
|
+
function needsWebhookEventStream(env = process.env) {
|
|
331
|
+
return (env["KOJEE_WEBHOOK_URL"] ?? "").trim().length > 0;
|
|
332
|
+
}
|
|
333
|
+
function selectDelivery(runtime, opts) {
|
|
334
|
+
if (opts.supportsChannels) {
|
|
335
|
+
return createClaudeCodeDelivery();
|
|
336
|
+
}
|
|
337
|
+
if (!needsWebhookEventStream(opts.env)) {
|
|
338
|
+
return null;
|
|
339
|
+
}
|
|
340
|
+
if (runtime === "codex") {
|
|
341
|
+
return createCodexDelivery();
|
|
342
|
+
}
|
|
343
|
+
return createWebhookDelivery(runtime);
|
|
344
|
+
}
|
|
345
|
+
export {
|
|
346
|
+
needsWebhookEventStream,
|
|
347
|
+
selectDelivery
|
|
348
|
+
};
|
|
@@ -1,25 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
executeJoin,
|
|
3
|
+
executeSend,
|
|
4
|
+
parseSendRequest,
|
|
5
|
+
sendFailure
|
|
6
|
+
} from "./chunk-DXJ6QLSJ.js";
|
|
1
7
|
import {
|
|
2
8
|
loadPairedConfig
|
|
3
9
|
} from "./chunk-YH27B6SW.js";
|
|
4
10
|
import {
|
|
5
|
-
GatewayClient
|
|
6
|
-
|
|
7
|
-
|
|
11
|
+
GatewayClient,
|
|
12
|
+
applyStableSessionId
|
|
13
|
+
} from "./chunk-IMOEZ4NJ.js";
|
|
14
|
+
import "./chunk-NR4Y54OL.js";
|
|
8
15
|
import {
|
|
9
16
|
loadKeystore
|
|
10
17
|
} from "./chunk-CH32ELFX.js";
|
|
11
18
|
import "./chunk-BLEGIR35.js";
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
parseSendRequest,
|
|
15
|
-
sendFailure
|
|
16
|
-
} from "./chunk-HIZ4NDWN.js";
|
|
17
|
-
import "./chunk-LDZXU3DW.js";
|
|
19
|
+
import "./chunk-2OLXXOT3.js";
|
|
20
|
+
import "./chunk-VHKPWUX7.js";
|
|
18
21
|
|
|
19
22
|
// src/tandem/send-cli.ts
|
|
20
23
|
import os from "os";
|
|
21
24
|
import path from "path";
|
|
22
|
-
async function createPairedGateway(kojeeDir) {
|
|
25
|
+
async function createPairedGateway(kojeeDir, stableDeps = {}) {
|
|
23
26
|
const configPath = path.join(kojeeDir, "config.json");
|
|
24
27
|
const paired = loadPairedConfig(configPath);
|
|
25
28
|
if (!paired) {
|
|
@@ -28,6 +31,7 @@ async function createPairedGateway(kojeeDir) {
|
|
|
28
31
|
`no paired config at ${configPath} \u2014 run \`kojee-mcp pair <code> --url <broker>\` first`
|
|
29
32
|
);
|
|
30
33
|
}
|
|
34
|
+
await applyStableSessionId(paired.token, stableDeps);
|
|
31
35
|
const brokerUrl = paired.broker_url.replace(/\/+$/, "");
|
|
32
36
|
const keystorePath = path.join(kojeeDir, "keypair.json");
|
|
33
37
|
const keystore = await loadKeystore(keystorePath, brokerUrl).catch(() => null);
|
|
@@ -65,6 +69,10 @@ async function runSendCli(args, deps = {}) {
|
|
|
65
69
|
if (!resolution.ok) {
|
|
66
70
|
return { exitCode: 1, envelope: resolution };
|
|
67
71
|
}
|
|
72
|
+
const joined = await executeJoin(resolution.gateway, parsed.request.tandem_id);
|
|
73
|
+
if (!joined.ok && (joined.error === "not_member" || joined.error === "gateway_auth")) {
|
|
74
|
+
return { exitCode: 1, envelope: joined };
|
|
75
|
+
}
|
|
68
76
|
const envelope = await executeSend(resolution.gateway, parsed.request);
|
|
69
77
|
return { exitCode: envelope.ok ? 0 : 1, envelope };
|
|
70
78
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildChannelInstructions,
|
|
3
|
+
createMcpServer,
|
|
4
|
+
executeToolCall,
|
|
5
|
+
startMcpServer
|
|
6
|
+
} from "./chunk-CM3EKMDD.js";
|
|
7
|
+
import "./chunk-X672ZN7V.js";
|
|
8
|
+
import "./chunk-2OLXXOT3.js";
|
|
9
|
+
export {
|
|
10
|
+
buildChannelInstructions,
|
|
11
|
+
createMcpServer,
|
|
12
|
+
executeToolCall,
|
|
13
|
+
startMcpServer
|
|
14
|
+
};
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import "./chunk-XLKGPGZT.js";
|
|
2
|
+
import {
|
|
3
|
+
controlTokenAuthHeaders
|
|
4
|
+
} from "./chunk-GI2CKKBL.js";
|
|
1
5
|
import {
|
|
2
6
|
formatChannelEvents
|
|
3
7
|
} from "./chunk-PHXO5P25.js";
|
|
@@ -7,21 +11,18 @@ import {
|
|
|
7
11
|
import {
|
|
8
12
|
monitorHeartbeatPath,
|
|
9
13
|
nudgeSentinelPath
|
|
10
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-CO73VGWM.js";
|
|
11
15
|
import {
|
|
12
16
|
readSessionDiscoveryByKey
|
|
13
17
|
} from "./chunk-DO42NPNR.js";
|
|
14
|
-
import
|
|
15
|
-
controlTokenAuthHeaders
|
|
16
|
-
} from "./chunk-GI2CKKBL.js";
|
|
18
|
+
import "./chunk-BLEGIR35.js";
|
|
17
19
|
import {
|
|
18
20
|
buildMonitorNudge
|
|
19
21
|
} from "./chunk-X672ZN7V.js";
|
|
20
22
|
import {
|
|
21
23
|
deriveDiscoveryKey,
|
|
22
24
|
findClaudeAncestorPid
|
|
23
|
-
} from "./chunk-
|
|
24
|
-
import "./chunk-BLEGIR35.js";
|
|
25
|
+
} from "./chunk-VHKPWUX7.js";
|
|
25
26
|
|
|
26
27
|
// src/hooks/stop-hook.ts
|
|
27
28
|
import fs from "fs";
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import "./chunk-XLKGPGZT.js";
|
|
1
2
|
import {
|
|
2
3
|
STATUS_LINE_PREFIX,
|
|
3
4
|
monitorHeartbeatPath,
|
|
4
5
|
statusLogPath
|
|
5
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-CO73VGWM.js";
|
|
6
7
|
import "./chunk-DO42NPNR.js";
|
|
7
8
|
import {
|
|
8
9
|
createAdaptiveWatchdog
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-74XFVX6Z.js";
|
|
11
|
+
import "./chunk-NR4Y54OL.js";
|
|
11
12
|
import "./chunk-BLEGIR35.js";
|
|
12
13
|
|
|
13
14
|
// src/tail-stream.ts
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
controlTokenAuthHeaders
|
|
3
|
+
} from "./chunk-GI2CKKBL.js";
|
|
1
4
|
import {
|
|
2
5
|
formatChannelEvents
|
|
3
6
|
} from "./chunk-PHXO5P25.js";
|
|
@@ -7,14 +10,11 @@ import {
|
|
|
7
10
|
import {
|
|
8
11
|
readSessionDiscoveryByKey
|
|
9
12
|
} from "./chunk-DO42NPNR.js";
|
|
10
|
-
import
|
|
11
|
-
controlTokenAuthHeaders
|
|
12
|
-
} from "./chunk-GI2CKKBL.js";
|
|
13
|
+
import "./chunk-BLEGIR35.js";
|
|
13
14
|
import {
|
|
14
15
|
deriveDiscoveryKey,
|
|
15
16
|
findClaudeAncestorPid
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-BLEGIR35.js";
|
|
17
|
+
} from "./chunk-VHKPWUX7.js";
|
|
18
18
|
|
|
19
19
|
// src/hooks/user-prompt-submit-hook.ts
|
|
20
20
|
async function runUserPromptSubmitHook() {
|