apiblaze 0.20.18 → 0.20.20
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/dist/index.js +29 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1024,7 +1024,7 @@ var import_commander = require("commander");
|
|
|
1024
1024
|
var import_chalk53 = __toESM(require("chalk"));
|
|
1025
1025
|
|
|
1026
1026
|
// package.json
|
|
1027
|
-
var version = "0.20.
|
|
1027
|
+
var version = "0.20.20";
|
|
1028
1028
|
|
|
1029
1029
|
// src/index.ts
|
|
1030
1030
|
init_types();
|
|
@@ -2413,6 +2413,11 @@ function claudeOneShot(spec2, prompt) {
|
|
|
2413
2413
|
const r = run(argv[0], argv.slice(1), { inherit: true });
|
|
2414
2414
|
return { argv, status: r.status };
|
|
2415
2415
|
}
|
|
2416
|
+
function claudeInteractive(spec2, prompt) {
|
|
2417
|
+
const argv = ["claude", prompt, "--allowedTools", `mcp__${spec2.name}__*`];
|
|
2418
|
+
const r = run(argv[0], argv.slice(1), { interactive: true });
|
|
2419
|
+
return { argv, status: r.status };
|
|
2420
|
+
}
|
|
2416
2421
|
function codexConfigPath() {
|
|
2417
2422
|
return path4.join(process.env.CODEX_HOME || path4.join(os3.homedir(), ".codex"), "config.toml");
|
|
2418
2423
|
}
|
|
@@ -2492,6 +2497,11 @@ function codexOneShot(_spec, prompt) {
|
|
|
2492
2497
|
const r = run(argv[0], argv.slice(1), { inherit: true });
|
|
2493
2498
|
return { argv, status: r.status };
|
|
2494
2499
|
}
|
|
2500
|
+
function codexInteractive(_spec, prompt) {
|
|
2501
|
+
const argv = ["codex", prompt];
|
|
2502
|
+
const r = run(argv[0], argv.slice(1), { interactive: true });
|
|
2503
|
+
return { argv, status: r.status };
|
|
2504
|
+
}
|
|
2495
2505
|
var shellQuote = (s) => `"${s.replace(/(["\\$`])/g, "\\$1")}"`;
|
|
2496
2506
|
function renderCommand(argv) {
|
|
2497
2507
|
return argv.map((a, i) => i === 0 || /^[A-Za-z0-9_@%+=:,./-]+$/.test(a) ? a : shellQuote(a)).join(" ");
|
|
@@ -2561,14 +2571,16 @@ async function installAndDemo(cli, spec2, getQuestion, log = console.log) {
|
|
|
2561
2571
|
}
|
|
2562
2572
|
const question = await getQuestion();
|
|
2563
2573
|
if (question) {
|
|
2574
|
+
const handoff = !!process.stdin.isTTY;
|
|
2575
|
+
const ask = handoff ? cli.kind === "claude" ? claudeInteractive : codexInteractive : oneShot;
|
|
2564
2576
|
log(`
|
|
2565
|
-
${import_chalk12.default.dim(
|
|
2566
|
-
const shown = cli.kind === "claude" ? ["claude", "-p", question, "--allowedTools", `mcp__${spec2.name}__*`] : ["codex", "exec", question];
|
|
2577
|
+
${import_chalk12.default.dim(handoff ? `Opening ${cli.label} with your question \u2014 you'll stay in that session:` : `Your question, through ${cli.label}:`)}`);
|
|
2578
|
+
const shown = cli.kind === "claude" ? handoff ? ["claude", question, "--allowedTools", `mcp__${spec2.name}__*`] : ["claude", "-p", question, "--allowedTools", `mcp__${spec2.name}__*`] : handoff ? ["codex", question] : ["codex", "exec", question];
|
|
2567
2579
|
log(` ${import_chalk12.default.dim("$")} ${renderCommand(shown)}
|
|
2568
2580
|
`);
|
|
2569
|
-
const ans =
|
|
2581
|
+
const ans = ask(spec2, question);
|
|
2570
2582
|
if (ans.status !== 0) log(import_chalk12.default.yellow(`
|
|
2571
|
-
${cli.label} exited with ${ans.status ?? "no status"}
|
|
2583
|
+
${cli.label} exited with ${ans.status ?? "no status"} \u2014 the MCP stays installed.`));
|
|
2572
2584
|
}
|
|
2573
2585
|
log(`
|
|
2574
2586
|
${import_chalk12.default.bold(`Your ${cli.label} is now able to talk to the ${spec2.projectLabel} API.`)}`);
|
|
@@ -4048,22 +4060,27 @@ async function maybeInstallExternalCli(p, opts) {
|
|
|
4048
4060
|
refreshInstall(c.kind, buildInstallSpec(p));
|
|
4049
4061
|
}
|
|
4050
4062
|
}
|
|
4051
|
-
const
|
|
4052
|
-
if (
|
|
4063
|
+
const pending = clis.filter((c) => !offer[c.kind]);
|
|
4064
|
+
if (pending.length === 0) return false;
|
|
4053
4065
|
const { default: inquirer3 } = await import("inquirer");
|
|
4054
|
-
const names =
|
|
4055
|
-
const targetName =
|
|
4066
|
+
const names = clis.map((c) => c.label).join(" and ");
|
|
4067
|
+
const targetName = clis.length > 1 ? "one of them" : clis[0].label;
|
|
4056
4068
|
const { pick: pick2 } = await inquirer3.prompt([{
|
|
4057
4069
|
type: "list",
|
|
4058
4070
|
name: "pick",
|
|
4059
|
-
message: `I see ${names} ${
|
|
4071
|
+
message: `I see ${names} ${clis.length > 1 ? "are" : "is"} installed on this computer. Do you want to add the MCP for this proxy to ${targetName} so you can chat with your API from there directly, or chat here directly?`,
|
|
4060
4072
|
choices: [
|
|
4061
|
-
...
|
|
4073
|
+
...clis.map((c) => ({
|
|
4074
|
+
// An already-wired client stays selectable: picking it re-installs
|
|
4075
|
+
// (fresh key, moved host) and re-runs the check.
|
|
4076
|
+
name: offer[c.kind] === "installed" ? `${c.label} ${import_chalk13.default.dim("(already added \u2014 re-add)")}` : c.label,
|
|
4077
|
+
value: c
|
|
4078
|
+
})),
|
|
4062
4079
|
{ name: "Chat here directly", value: "here" }
|
|
4063
4080
|
]
|
|
4064
4081
|
}]);
|
|
4065
4082
|
if (pick2 === "here") {
|
|
4066
|
-
for (const c of
|
|
4083
|
+
for (const c of pending) rememberCliOffer(p, c.kind, "declined");
|
|
4067
4084
|
if (p.consumerAuth && p.teamId && p.tenant) {
|
|
4068
4085
|
try {
|
|
4069
4086
|
await ensureConsumerLogin(p.teamId, p.tenant, p.version);
|