kojee-mcp 0.5.7 → 0.5.9
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 +189 -50
- package/dist/{chunk-64EOLZNI.js → chunk-65KRRDHP.js} +20 -5
- package/dist/chunk-CH32ELFX.js +68 -0
- package/dist/{chunk-2TUAFAIW.js → chunk-DS26OORG.js} +13 -2
- package/dist/{chunk-3XDJOHMZ.js → chunk-HSR3GXCL.js} +2 -67
- package/dist/{chunk-6SK6ITFE.js → chunk-JXMVZEQ7.js} +1 -1
- package/dist/{chunk-UEGQGXPY.js → chunk-MKDMAAMN.js} +13 -3
- package/dist/chunk-OGHDTFAX.js +50 -0
- package/dist/chunk-PHXO5P25.js +20 -0
- package/dist/{chunk-GATXJ6UT.js → chunk-SCDWPGH3.js} +6 -5
- package/dist/cli.js +87 -73
- package/dist/{doctor-QCQDFLEH.js → doctor-XK335W7B.js} +6 -6
- package/dist/{doctor-codex-NZ53ROQA.js → doctor-codex-SMROUYGV.js} +1 -1
- package/dist/{event-log-RSTM4PLL.js → event-log-B27VVEMK.js} +1 -1
- package/dist/index.js +6 -5
- package/dist/{install-WBIUVBZW.js → install-LJY2CHKG.js} +14 -3
- package/dist/keystore-XLEV3FL5.js +15 -0
- package/dist/lib.d.ts +2 -0
- package/dist/lib.js +12 -10
- package/dist/pair-P4ILCMT7.js +10 -0
- package/dist/{send-cli-C2F4WTBN.js → send-cli-CN5EX7PO.js} +6 -4
- package/dist/{stop-hook-46BJD55B.js → stop-hook-GEJF47SN.js} +8 -17
- package/dist/{tail-stream-VUZBYKXS.js → tail-stream-JNR4WFW3.js} +3 -3
- package/dist/{user-prompt-submit-hook-ZD2XKN7U.js → user-prompt-submit-hook-DGRRFHOB.js} +7 -16
- package/dist/{wizard-UOXQYJLP.js → wizard-PLGHYCT3.js} +94 -14
- package/package.json +1 -1
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildCodexMcpServerTable,
|
|
3
|
+
buildCodexStopHookBlock,
|
|
4
|
+
removeCodexConfig,
|
|
5
|
+
writeCodexConfig
|
|
6
|
+
} from "./chunk-65KRRDHP.js";
|
|
1
7
|
import {
|
|
2
8
|
WIZARD_RUNTIMES,
|
|
3
9
|
isWizardRuntime
|
|
@@ -7,12 +13,6 @@ import {
|
|
|
7
13
|
readRecordedRuntime,
|
|
8
14
|
recordRuntime
|
|
9
15
|
} from "./chunk-EW72ZNQL.js";
|
|
10
|
-
import {
|
|
11
|
-
buildCodexMcpServerTable,
|
|
12
|
-
buildCodexStopHookBlock,
|
|
13
|
-
removeCodexConfig,
|
|
14
|
-
writeCodexConfig
|
|
15
|
-
} from "./chunk-64EOLZNI.js";
|
|
16
16
|
import {
|
|
17
17
|
kojeeHomeDir
|
|
18
18
|
} from "./chunk-SQL56SEB.js";
|
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
import crypto from "crypto";
|
|
33
33
|
import fs from "fs";
|
|
34
34
|
import path from "path";
|
|
35
|
+
var DEFAULT_BROKER_URL = "https://rosie-staging.kojee.net";
|
|
35
36
|
function generateWebhookSecret() {
|
|
36
37
|
return crypto.randomBytes(32).toString("hex");
|
|
37
38
|
}
|
|
@@ -115,6 +116,49 @@ function writeRuntimeEnvFile(runtime, url, secret, signatureEnv = []) {
|
|
|
115
116
|
return envPath;
|
|
116
117
|
}
|
|
117
118
|
var CODEX_UNVERIFIED_NOTE = "NOTE: live Codex verification (hook fires, MCP server connects, bounded listen works) has not been run on this build \u2014 confirm in a real Codex session. This is the owner morning step.";
|
|
119
|
+
function runtimeUsesWebhook(runtime) {
|
|
120
|
+
return runtime === "codex" || runtime === "hermes" || runtime === "openclaw";
|
|
121
|
+
}
|
|
122
|
+
async function gatherGuidedInputs(runtime, opts) {
|
|
123
|
+
const preamble = [];
|
|
124
|
+
const next = { ...opts };
|
|
125
|
+
if (opts.promptUrl) {
|
|
126
|
+
const answered = (await opts.promptUrl(opts.url ?? DEFAULT_BROKER_URL)).trim();
|
|
127
|
+
next.url = (answered.length > 0 ? answered : opts.url ?? DEFAULT_BROKER_URL).replace(/\/+$/, "");
|
|
128
|
+
}
|
|
129
|
+
const brokerUrl = (next.url ?? DEFAULT_BROKER_URL).replace(/\/+$/, "");
|
|
130
|
+
if (opts.promptAuth) {
|
|
131
|
+
const mode = await opts.promptAuth();
|
|
132
|
+
if (mode === "token") {
|
|
133
|
+
const token = opts.promptToken ? (await opts.promptToken()).trim() : "";
|
|
134
|
+
if (!token) return { error: "No token entered. Re-run `kojee-mcp init` and paste a token, or choose pair mode." };
|
|
135
|
+
next.token = token;
|
|
136
|
+
next.url = brokerUrl;
|
|
137
|
+
preamble.push("Auth: token mode \u2014 the written MCP config will launch the proxy with --token/--url");
|
|
138
|
+
preamble.push(" (it enrolls its own per-token keystore on first boot).");
|
|
139
|
+
} else {
|
|
140
|
+
const code = opts.promptPairCode ? (await opts.promptPairCode()).trim() : "";
|
|
141
|
+
if (!code) return { error: "No pair code entered. Re-run `kojee-mcp init` and enter a pair code, or choose token mode." };
|
|
142
|
+
const pair = opts.runPair ?? (async (a) => {
|
|
143
|
+
const { runPair } = await import("./pair-P4ILCMT7.js");
|
|
144
|
+
const { pairedConfigPath } = await import("./paired-config-JTFLHMZ2.js");
|
|
145
|
+
const { defaultPairedKeystorePath } = await import("./keystore-XLEV3FL5.js");
|
|
146
|
+
return runPair({ code: a.code, url: a.url, keystorePath: defaultPairedKeystorePath(), configPath: pairedConfigPath() });
|
|
147
|
+
});
|
|
148
|
+
try {
|
|
149
|
+
const { message } = await pair({ code, url: brokerUrl });
|
|
150
|
+
preamble.push(`Auth: pair mode \u2014 ${message}`);
|
|
151
|
+
} catch (err) {
|
|
152
|
+
return { error: `Pairing failed: ${err.message}` };
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
if (runtimeUsesWebhook(runtime) && opts.promptWebhookUrl && opts.webhookUrl === void 0) {
|
|
157
|
+
const wh = (await opts.promptWebhookUrl()).trim();
|
|
158
|
+
if (wh.length > 0) next.webhookUrl = wh;
|
|
159
|
+
}
|
|
160
|
+
return { opts: next, preamble };
|
|
161
|
+
}
|
|
118
162
|
async function runWizard(opts) {
|
|
119
163
|
const resolved = await resolveRuntime(opts);
|
|
120
164
|
if ("error" in resolved) {
|
|
@@ -124,15 +168,44 @@ async function runWizard(opts) {
|
|
|
124
168
|
if (opts.uninstall) {
|
|
125
169
|
return runWizardUninstall(runtime, opts);
|
|
126
170
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
171
|
+
let effective = opts;
|
|
172
|
+
let preamble = [];
|
|
173
|
+
if (opts.interactive && (opts.promptUrl || opts.promptAuth || opts.promptWebhookUrl)) {
|
|
174
|
+
const gathered = await gatherGuidedInputs(runtime, opts);
|
|
175
|
+
if ("error" in gathered) {
|
|
176
|
+
return { runtime, output: gathered.error, exitCode: 2 };
|
|
177
|
+
}
|
|
178
|
+
effective = gathered.opts;
|
|
179
|
+
preamble = gathered.preamble;
|
|
180
|
+
}
|
|
181
|
+
const result = runtime === "claude-code" ? await configureClaudeCode(effective) : runtime === "codex" ? configureCodex(effective) : configureWebhookDaemon(runtime, effective);
|
|
182
|
+
if (preamble.length > 0 && result.exitCode === 0) {
|
|
183
|
+
return {
|
|
184
|
+
...result,
|
|
185
|
+
output: [...preamble, "", result.output, "", whatHappensNext(runtime, effective)].join("\n")
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
return result;
|
|
189
|
+
}
|
|
190
|
+
function whatHappensNext(runtime, opts) {
|
|
191
|
+
const lines = ["What happens next:"];
|
|
192
|
+
lines.push(" - Restart your runtime so it picks up the new kojee config.");
|
|
193
|
+
if (opts.token) {
|
|
194
|
+
lines.push(" - First boot enrolls this token's own keystore (~/.kojee/keypair-<hash>.json).");
|
|
195
|
+
} else {
|
|
196
|
+
lines.push(" - The proxy uses your paired credentials (~/.kojee/config.json + keypair.json).");
|
|
197
|
+
}
|
|
198
|
+
lines.push(" - Verify with: kojee-mcp doctor");
|
|
199
|
+
return lines.join("\n");
|
|
130
200
|
}
|
|
131
201
|
async function configureClaudeCode(opts) {
|
|
132
|
-
const { runInit } = await import("./install-
|
|
202
|
+
const { runInit } = await import("./install-LJY2CHKG.js");
|
|
133
203
|
const report = runInit({
|
|
134
204
|
...opts.configPath ? { configPath: opts.configPath } : {},
|
|
135
|
-
...opts.hooksPath ? { hooksPath: opts.hooksPath } : {}
|
|
205
|
+
...opts.hooksPath ? { hooksPath: opts.hooksPath } : {},
|
|
206
|
+
// Token mode threads --token/--url into the written args (per-token
|
|
207
|
+
// keystore). Paired mode leaves both unset ⇒ args stay `["kojee-mcp"]`.
|
|
208
|
+
...opts.token && opts.url ? { token: opts.token, url: opts.url } : {}
|
|
136
209
|
});
|
|
137
210
|
recordRuntime("claude-code");
|
|
138
211
|
return { runtime: "claude-code", output: formatClaudeInit(report), exitCode: 0 };
|
|
@@ -180,12 +253,14 @@ function configureCodex(opts) {
|
|
|
180
253
|
}
|
|
181
254
|
const url = wh.url || "https://YOUR-CODEX-WEBHOOK-RECEIVER.local/kojee";
|
|
182
255
|
const secret = wh.secret || generateWebhookSecret();
|
|
256
|
+
const tokenArgs = opts.token && opts.url ? { token: opts.token, url: opts.url } : {};
|
|
183
257
|
writeCodexConfig({
|
|
184
258
|
...opts.configPath ? { configPath: opts.configPath } : {},
|
|
185
259
|
...opts.hooksPath ? { hooksPath: opts.hooksPath } : {},
|
|
186
260
|
webhookUrl: url,
|
|
187
261
|
webhookSecret: secret,
|
|
188
|
-
...wh.signatureEnv.length > 0 ? { signatureEnv: wh.signatureEnv } : {}
|
|
262
|
+
...wh.signatureEnv.length > 0 ? { signatureEnv: wh.signatureEnv } : {},
|
|
263
|
+
...tokenArgs
|
|
189
264
|
});
|
|
190
265
|
recordRuntime("codex");
|
|
191
266
|
const lines = [];
|
|
@@ -196,7 +271,11 @@ function configureCodex(opts) {
|
|
|
196
271
|
lines.push(indent(buildCodexMcpServerTable({
|
|
197
272
|
webhookUrl: url,
|
|
198
273
|
webhookSecret: "<redacted>",
|
|
199
|
-
...wh.signatureEnv.length > 0 ? { signatureEnv: wh.signatureEnv } : {}
|
|
274
|
+
...wh.signatureEnv.length > 0 ? { signatureEnv: wh.signatureEnv } : {},
|
|
275
|
+
// Redact the gateway token in the human-readable printed copy (it ends up
|
|
276
|
+
// in result.output → cli.ts console.error). The WRITTEN config above keeps
|
|
277
|
+
// the real token; only this printed report is redacted, like webhookSecret.
|
|
278
|
+
...tokenArgs.token ? { token: "<redacted>", url: tokenArgs.url } : {}
|
|
200
279
|
})));
|
|
201
280
|
if (wh.warning) lines.push(`webhook WARNING: ${wh.warning}`);
|
|
202
281
|
lines.push("");
|
|
@@ -254,7 +333,7 @@ async function runWizardUninstall(runtime, opts) {
|
|
|
254
333
|
const effective = opts.runtime !== void 0 ? runtime : readRecordedRuntime() ?? runtime;
|
|
255
334
|
const lines = [`Uninstalling runtime: ${effective}`];
|
|
256
335
|
if (effective === "claude-code") {
|
|
257
|
-
const { runUninstall } = await import("./install-
|
|
336
|
+
const { runUninstall } = await import("./install-LJY2CHKG.js");
|
|
258
337
|
const report = runUninstall({
|
|
259
338
|
...opts.configPath ? { configPath: opts.configPath } : {},
|
|
260
339
|
...opts.hooksPath ? { hooksPath: opts.hooksPath } : {}
|
|
@@ -295,6 +374,7 @@ function indent(s) {
|
|
|
295
374
|
}
|
|
296
375
|
export {
|
|
297
376
|
CODEX_UNVERIFIED_NOTE,
|
|
377
|
+
DEFAULT_BROKER_URL,
|
|
298
378
|
generateWebhookSecret,
|
|
299
379
|
resolveRuntime,
|
|
300
380
|
resolveWizardWebhook,
|