kojee-mcp 0.7.5-staging.2 → 0.7.5-staging.21
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 +27 -6
- package/dist/{cc-session-id-RURNIHHC.js → cc-session-id-5HHQJ7VC.js} +3 -1
- package/dist/{chunk-ZSHCHOPL.js → chunk-676WQSWZ.js} +163 -7
- package/dist/{chunk-FJUAMJHU.js → chunk-6NPMVZD7.js} +38 -3
- package/dist/{chunk-247WFMCJ.js → chunk-AGZ7ZGLY.js} +30 -3
- package/dist/chunk-AXBJQJKA.js +65 -0
- package/dist/{chunk-TCWIXG5C.js → chunk-CCVRXJJ2.js} +1 -1
- package/dist/{chunk-WBXU27BF.js → chunk-FNMKP34Y.js} +1 -1
- package/dist/chunk-GEGUWQYT.js +90 -0
- package/dist/{chunk-NE2F5CKS.js → chunk-LKGKDZSO.js} +9 -5
- package/dist/{chunk-XPIW4N55.js → chunk-N2YAZRAD.js} +178 -43
- package/dist/{chunk-LSUB6QMP.js → chunk-NIIBVKLP.js} +3 -0
- package/dist/chunk-P64UR3SE.js +86 -0
- package/dist/{chunk-A4IOKD4Z.js → chunk-QYZP6QT2.js} +2 -4
- package/dist/{chunk-KNEJTD6G.js → chunk-SZLNNMIZ.js} +6 -2
- package/dist/{chunk-CUOJHP2S.js → chunk-UGEBGCYU.js} +48 -12
- package/dist/{chunk-6XWTUDWW.js → chunk-WDWVBPXA.js} +7 -5
- package/dist/{chunk-TNZITJAB.js → chunk-WVQU3QQ7.js} +14 -4
- package/dist/cli.js +42 -23
- package/dist/{codex-prompt-submit-hook-J5PZEJSK.js → codex-prompt-submit-hook-UQJI6A54.js} +2 -2
- package/dist/{codex-stop-hook-32W4BIOM.js → codex-stop-hook-GTGRQNVV.js} +2 -2
- package/dist/{connect-handler-NZINEMG3.js → connect-handler-GTFXNZUC.js} +68 -9
- package/dist/{doctor-WUU5BVPT.js → doctor-54S7JGOE.js} +64 -5
- package/dist/{doctor-codex-PJFWIABF.js → doctor-codex-6H4OOS6O.js} +84 -10
- package/dist/doctor-hermes-KMHM27Y3.js +597 -0
- package/dist/{doctor-openclaw-LL6NSPLC.js → doctor-openclaw-B5KADVHD.js} +5 -1
- package/dist/{event-log-2NBJEIEP.js → event-log-M22X3FAI.js} +1 -1
- package/dist/{event-stream-ATKYXDBV.js → event-stream-5ZEL7FXN.js} +5 -1
- package/dist/flap-log-D4KG7RK4.js +23 -0
- package/dist/{gateway-client-CbM2OC_w.d.ts → gateway-client-CLmQghON.d.ts} +11 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -7
- package/dist/{install-JQNDGAAQ.js → install-GJVZEWLI.js} +8 -7
- package/dist/lib.d.ts +30 -1
- package/dist/lib.js +3 -3
- package/dist/plugins/hermes/adapter.py +7 -2
- package/dist/{registry-XJ67EO22.js → registry-MCJAVXJW.js} +36 -24
- package/dist/{send-cli-45RLGYIC.js → send-cli-WTY7H3BR.js} +2 -2
- package/dist/{server-DU3LFS32.js → server-VM3ZIGSZ.js} +2 -3
- package/dist/session-start-hook-VL3KYDTT.js +25 -0
- package/dist/{setup-handler-44ASXYMS.js → setup-handler-GNAIWAYU.js} +7 -7
- package/dist/{stop-hook-N6TX4YQT.js → stop-hook-BLPYRE7T.js} +5 -5
- package/dist/stream-watchdog-K2AWNCQW.js +64 -0
- package/dist/{tail-stream-G4WGTXDS.js → tail-stream-PQXEY3TI.js} +120 -9
- package/dist/{user-prompt-submit-hook-DTXXFDSD.js → user-prompt-submit-hook-YQXGE3JU.js} +3 -3
- package/package.json +3 -2
- package/dist/chunk-5DHIUN73.js +0 -25
- package/dist/chunk-TMCNB4JH.js +0 -33
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
+
CODEX_TRUST_FIX_STEPS,
|
|
2
3
|
defaultCodexConfigPath,
|
|
3
4
|
defaultCodexHooksPath,
|
|
4
5
|
isPlaceholderWebhookUrl
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-TMCNB4JH.js";
|
|
6
|
+
} from "./chunk-WDWVBPXA.js";
|
|
7
7
|
import "./chunk-D6JKFJ6A.js";
|
|
8
|
+
import {
|
|
9
|
+
classifyHookCommand,
|
|
10
|
+
isKojeeHookCommand
|
|
11
|
+
} from "./chunk-AXBJQJKA.js";
|
|
8
12
|
import {
|
|
9
13
|
CODEX_STATUS_STALE_MS,
|
|
10
14
|
readAllCodexStatusRaw,
|
|
@@ -16,14 +20,13 @@ import {
|
|
|
16
20
|
} from "./chunk-V5VZPYMZ.js";
|
|
17
21
|
import "./chunk-U5HHHRXA.js";
|
|
18
22
|
import {
|
|
23
|
+
CODEX_LISTEN_CAP_MS,
|
|
19
24
|
VERSION
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import {
|
|
22
|
-
CODEX_LISTEN_CAP_MS
|
|
23
|
-
} from "./chunk-FJUAMJHU.js";
|
|
25
|
+
} from "./chunk-6NPMVZD7.js";
|
|
24
26
|
|
|
25
27
|
// src/doctor-codex.ts
|
|
26
28
|
import fs from "fs";
|
|
29
|
+
import path from "path";
|
|
27
30
|
|
|
28
31
|
// src/hooks/codex-trust-hash.ts
|
|
29
32
|
import crypto from "crypto";
|
|
@@ -129,15 +132,33 @@ function extractPairedConfigPath(toml) {
|
|
|
129
132
|
const m = toml.match(/args\s*=\s*\[[^\]]*"--paired-config"\s*,\s*"([^"]+)"/);
|
|
130
133
|
return m ? m[1].replace(/\\\\/g, "\\") : null;
|
|
131
134
|
}
|
|
132
|
-
function defaultReadFile(
|
|
135
|
+
function defaultReadFile(filePath) {
|
|
133
136
|
return () => {
|
|
134
137
|
try {
|
|
135
|
-
return fs.readFileSync(
|
|
138
|
+
return fs.readFileSync(filePath, "utf8");
|
|
136
139
|
} catch {
|
|
137
140
|
return null;
|
|
138
141
|
}
|
|
139
142
|
};
|
|
140
143
|
}
|
|
144
|
+
function defaultDiscoverProjectCodexConfigs(cwd = process.cwd()) {
|
|
145
|
+
const globalToml = path.resolve(defaultCodexConfigPath());
|
|
146
|
+
const found = [];
|
|
147
|
+
let dir = cwd;
|
|
148
|
+
for (let hops = 0; hops < 64; hops++) {
|
|
149
|
+
const candidate = path.join(dir, ".codex", "config.toml");
|
|
150
|
+
if (path.resolve(candidate) !== globalToml) {
|
|
151
|
+
try {
|
|
152
|
+
found.push({ path: candidate, toml: fs.readFileSync(candidate, "utf8") });
|
|
153
|
+
} catch {
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
const parent = path.dirname(dir);
|
|
157
|
+
if (parent === dir) break;
|
|
158
|
+
dir = parent;
|
|
159
|
+
}
|
|
160
|
+
return found;
|
|
161
|
+
}
|
|
141
162
|
function collectCodexDoctorReport(deps = {}) {
|
|
142
163
|
const readConfigToml = deps.readConfigToml ?? defaultReadFile(defaultCodexConfigPath());
|
|
143
164
|
const readHooksJson = deps.readHooksJson ?? defaultReadFile(defaultCodexHooksPath());
|
|
@@ -152,6 +173,25 @@ function collectCodexDoctorReport(deps = {}) {
|
|
|
152
173
|
ok: configOk,
|
|
153
174
|
detail: configOk ? 'present with env.KOJEE_RUNTIME="codex" (Tier-1 contract)' : `MISSING [mcp_servers.kojee] or env.KOJEE_RUNTIME="codex" \u2014 ${WIZARD_RERUN}`
|
|
154
175
|
});
|
|
176
|
+
const projectConfigs = deps.discoverProjectCodexConfigs?.() ?? defaultDiscoverProjectCodexConfigs();
|
|
177
|
+
const shadowing = projectConfigs.filter(
|
|
178
|
+
(c) => c.toml.includes("[mcp_servers.kojee]") || /\[hooks\.state/.test(c.toml) || /hook --type=codex-/.test(c.toml)
|
|
179
|
+
);
|
|
180
|
+
if (shadowing.length > 0) {
|
|
181
|
+
const pins = shadowing.map((s) => /kojee-mcp@([^\s"']+)/.exec(s.toml)?.[1]).filter((v) => !!v);
|
|
182
|
+
const pinNote = pins.length ? ` (pins kojee-mcp@${[...new Set(pins)].join(", ")})` : "";
|
|
183
|
+
checks.push({
|
|
184
|
+
name: "Codex config shadowing",
|
|
185
|
+
ok: "warn",
|
|
186
|
+
detail: `project-local ${shadowing.map((s) => s.path).join(", ")} defines Kojee/hook config${pinNote} that OVERLAYS the global ~/.codex/config.toml \u2014 Codex may run it instead of the reconnected global entry (split-brain), and this doctor's other checks read only the global file so they may not reflect what Codex actually runs. Reconcile or move the project file(s) aside (e.g. rename to config.toml.bak) so the global reconnect takes effect.`
|
|
187
|
+
});
|
|
188
|
+
} else {
|
|
189
|
+
checks.push({
|
|
190
|
+
name: "Codex config shadowing",
|
|
191
|
+
ok: true,
|
|
192
|
+
detail: "no project-local .codex/config.toml overlaying the global"
|
|
193
|
+
});
|
|
194
|
+
}
|
|
155
195
|
const hooksRaw = readHooksJson() ?? "{}";
|
|
156
196
|
let hooksJson = {};
|
|
157
197
|
try {
|
|
@@ -175,6 +215,39 @@ function collectCodexDoctorReport(deps = {}) {
|
|
|
175
215
|
ok: upsPresent ? true : "warn",
|
|
176
216
|
detail: upsPresent ? "present (pending-wake catch-up at the next prompt)" : `MISSING \u2014 a silently-dropped Stop block is never re-surfaced. ${WIZARD_RERUN}`
|
|
177
217
|
});
|
|
218
|
+
const codexHookCommands = [];
|
|
219
|
+
for (const event of ["Stop", "UserPromptSubmit"]) {
|
|
220
|
+
for (const e of hooksJson.hooks?.[event] ?? []) {
|
|
221
|
+
for (const h of e.hooks ?? []) {
|
|
222
|
+
if (typeof h.command === "string" && isKojeeHookCommand(h.command)) codexHookCommands.push(h.command);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
if (codexHookCommands.length > 0) {
|
|
227
|
+
const states = codexHookCommands.map((c) => classifyHookCommand(c));
|
|
228
|
+
const repin = "fix: `npm i -g kojee-mcp` then re-run connect for codex (re-pins in place, no re-pair)";
|
|
229
|
+
if (states.includes("pinned-broken")) {
|
|
230
|
+
checks.push({
|
|
231
|
+
name: "hook pin (hooks.json)",
|
|
232
|
+
ok: false,
|
|
233
|
+
detail: `pinned cli.js is GONE \u2014 hooks fail with exit 127 RIGHT NOW; ${repin}`
|
|
234
|
+
});
|
|
235
|
+
} else if (states.includes("pinned-ephemeral")) {
|
|
236
|
+
checks.push({
|
|
237
|
+
name: "hook pin (hooks.json)",
|
|
238
|
+
ok: false,
|
|
239
|
+
detail: `pinned INTO the npx cache (~/.npm/_npx/\u2026) \u2014 cache GC will silently kill the hooks (exit 127 every turn); ${repin}`
|
|
240
|
+
});
|
|
241
|
+
} else if (states.includes("npx")) {
|
|
242
|
+
checks.push({
|
|
243
|
+
name: "hook pin (hooks.json)",
|
|
244
|
+
ok: "warn",
|
|
245
|
+
detail: `unpinned (npx -y) \u2014 pays npx resolution every turn and can stall on a registry fetch; ${repin}`
|
|
246
|
+
});
|
|
247
|
+
} else {
|
|
248
|
+
checks.push({ name: "hook pin (hooks.json)", ok: true, detail: "pinned to a durable binary" });
|
|
249
|
+
}
|
|
250
|
+
}
|
|
178
251
|
const featureHooks = parseCodexFeatureHooks(toml);
|
|
179
252
|
if (featureHooks !== true) {
|
|
180
253
|
checks.push({
|
|
@@ -212,13 +285,13 @@ function collectCodexDoctorReport(deps = {}) {
|
|
|
212
285
|
checks.push({
|
|
213
286
|
name: `hook trust (${event})`,
|
|
214
287
|
ok: "warn",
|
|
215
|
-
detail: `${label} is UNTRUSTED \u2014 no [hooks.state]."${key}" trusted_hash. Codex will NOT run it (wakes silently stop)
|
|
288
|
+
detail: `${label} is UNTRUSTED \u2014 no [hooks.state]."${key}" trusted_hash. Codex will NOT run it (wakes silently stop) \u2014 ${CODEX_TRUST_FIX_STEPS}.`
|
|
216
289
|
});
|
|
217
290
|
} else {
|
|
218
291
|
checks.push({
|
|
219
292
|
name: `hook trust (${event})`,
|
|
220
293
|
ok: "warn",
|
|
221
|
-
detail: `${label} trust is STALE \u2014 trusted_hash no longer matches the current hooks.json entry (a rewrite invalidated it). Codex will NOT run it
|
|
294
|
+
detail: `${label} trust is STALE \u2014 trusted_hash no longer matches the current hooks.json entry (a rewrite invalidated it). Codex will NOT run it \u2014 ${CODEX_TRUST_FIX_STEPS}.`
|
|
222
295
|
});
|
|
223
296
|
}
|
|
224
297
|
}
|
|
@@ -365,6 +438,7 @@ function formatCodexDoctorReport(report) {
|
|
|
365
438
|
}
|
|
366
439
|
export {
|
|
367
440
|
collectCodexDoctorReport,
|
|
441
|
+
defaultDiscoverProjectCodexConfigs,
|
|
368
442
|
formatCodexDoctorReport,
|
|
369
443
|
parseCodexEnvFromToml
|
|
370
444
|
};
|