apiblaze 0.17.14 → 0.17.16
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 +8 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -699,7 +699,7 @@ var import_commander = require("commander");
|
|
|
699
699
|
var import_chalk38 = __toESM(require("chalk"));
|
|
700
700
|
|
|
701
701
|
// package.json
|
|
702
|
-
var version = "0.17.
|
|
702
|
+
var version = "0.17.16";
|
|
703
703
|
|
|
704
704
|
// src/index.ts
|
|
705
705
|
init_types();
|
|
@@ -5226,13 +5226,15 @@ var CLIENT_ROUND_CAP = 12;
|
|
|
5226
5226
|
function chatUrl(p) {
|
|
5227
5227
|
return `https://${p.mcpHost}/${p.version}/${p.environment}/runtime-chat`;
|
|
5228
5228
|
}
|
|
5229
|
-
function renderToolEvents(events) {
|
|
5229
|
+
function renderToolEvents(events, dpKey) {
|
|
5230
5230
|
for (const e of events ?? []) {
|
|
5231
5231
|
const ok = typeof e.status === "number" ? e.status < 400 : String(e.status).toLowerCase() === "ok";
|
|
5232
5232
|
const mark = ok ? import_chalk33.default.green("\u2713") : import_chalk33.default.red("\u2717");
|
|
5233
5233
|
console.log(` ${mark} ${import_chalk33.default.cyan(e.name)} ${import_chalk33.default.dim(`(${e.status}, ${e.ms}ms)`)}`);
|
|
5234
5234
|
if (isVerbose() && e.method && e.url) {
|
|
5235
|
-
|
|
5235
|
+
const auth = dpKey ? ` \\
|
|
5236
|
+
-H 'X-API-Key: ${maskSecret(dpKey)}'` : "";
|
|
5237
|
+
console.log(import_chalk33.default.dim(` curl -sS -X ${e.method} '${e.url}'${auth}`));
|
|
5236
5238
|
}
|
|
5237
5239
|
}
|
|
5238
5240
|
}
|
|
@@ -5262,15 +5264,6 @@ function printAssistant(delta) {
|
|
|
5262
5264
|
}
|
|
5263
5265
|
}
|
|
5264
5266
|
}
|
|
5265
|
-
function verboseTrace(p, hasByo) {
|
|
5266
|
-
if (!isVerbose()) return;
|
|
5267
|
-
console.log(import_chalk33.default.dim("\n" + "\u2500".repeat(64)));
|
|
5268
|
-
console.log(import_chalk33.default.bold("--verbose: this turn POSTed to the data-plane MCP host"));
|
|
5269
|
-
console.log(import_chalk33.default.green(` curl -sS -X POST ${chatUrl(p)} \\`));
|
|
5270
|
-
console.log(import_chalk33.default.green(` -H "X-API-Key: ${maskSecret(p.dpKey)}" \\`));
|
|
5271
|
-
console.log(import_chalk33.default.green(" -H 'Content-Type: application/json' \\"));
|
|
5272
|
-
console.log(import_chalk33.default.green(` -d '{"turn_id":"\u2026","messages":[\u2026],"environment":"${p.environment}"${hasByo ? ',"llm_api_key":"***","llm_provider":"\u2026"' : ""}}'`));
|
|
5273
|
-
}
|
|
5274
5267
|
async function replTurn(p, messages, userText) {
|
|
5275
5268
|
messages.push({ role: "user", content: userText });
|
|
5276
5269
|
const llm2 = loadLlmConfig();
|
|
@@ -5319,7 +5312,7 @@ async function replTurn(p, messages, userText) {
|
|
|
5319
5312
|
return;
|
|
5320
5313
|
}
|
|
5321
5314
|
if (Array.isArray(data.delta)) {
|
|
5322
|
-
renderToolEvents(data.tool_events);
|
|
5315
|
+
renderToolEvents(data.tool_events, p.dpKey);
|
|
5323
5316
|
for (const m of data.delta) messages.push(m);
|
|
5324
5317
|
printAssistant(data.delta);
|
|
5325
5318
|
}
|
|
@@ -5327,7 +5320,6 @@ async function replTurn(p, messages, userText) {
|
|
|
5327
5320
|
if (bl) console.log(bl);
|
|
5328
5321
|
const warn = freeBudgetWarning(data.billing, p.anon);
|
|
5329
5322
|
if (warn) console.log(warn);
|
|
5330
|
-
verboseTrace(p, !!llm2);
|
|
5331
5323
|
if (!data.continue) return;
|
|
5332
5324
|
}
|
|
5333
5325
|
console.log(import_chalk33.default.dim(" (stopped after several tool rounds \u2014 ask again to continue)"));
|
|
@@ -5628,6 +5620,7 @@ async function runRepl(p, initialMessages) {
|
|
|
5628
5620
|
console.log(import_chalk33.default.dim("\nBye."));
|
|
5629
5621
|
}
|
|
5630
5622
|
async function runApichat(opts) {
|
|
5623
|
+
setVerbose(opts.verbose !== false);
|
|
5631
5624
|
console.log(import_chalk33.default.bold("\napichat \u2014 turn any API into a chat\n"));
|
|
5632
5625
|
if (!opts.openapispec && !opts.target) {
|
|
5633
5626
|
if (!process.stdin.isTTY) {
|
|
@@ -6436,7 +6429,7 @@ var agent = program.command("agent").description("Chat with an assistant that bu
|
|
|
6436
6429
|
agent.command("authz").description("Chat to design and turn on access rules for an API").argument("<project>", "Project name or id").argument("[apiVersion]", "API version (defaults to the project's)").action(action((project, apiVersion) => runAuthz(project, apiVersion)));
|
|
6437
6430
|
agent.command("openapi").description("Chat to build your API spec from real traffic").argument("<project>", "Project name or id").argument("[apiVersion]", "API version (defaults to the project's)").action(action((project, apiVersion) => runOpenapi(project, apiVersion)));
|
|
6438
6431
|
agent.command("mcp").description("Chat to build an MCP server for an API").argument("<project>", "Project name or id").argument("[apiVersion]", "API version (defaults to the project's)").option("--environment <env>", "Environment to publish (default: prod)").action(action((project, apiVersion, opts) => runMcp(project, apiVersion, opts)));
|
|
6439
|
-
program.command("apichat").description("Turn any API into a chat: point at an OpenAPI spec and start asking questions (no login needed)").option("--openapispec <file|url>", "OpenAPI/Swagger spec to build from (JSON or YAML; file path or URL)").option("--target <url>", "Upstream base URL (overrides servers[0].url; enables spec discovery when --openapispec is omitted)").option("--name <name>", "Proxy name (defaults to the target host)").option("--apiversion <version>", "API version to create (e.g. 1.0.0)").option("--environment <env>", "Environment to chat against (default: prod anonymous / dev logged-in)").option("--target-auth-env <ENV_VAR>", "Read the upstream credential from this env var (CI-safe; required when there is no TTY and the API needs auth)").option("--force", "Proceed even if the API uses oauth2/openIdConnect target auth (you configure target auth yourself later)").option("-y, --yes", "Skip confirmation prompts").action(action((opts) => runApichat(opts)));
|
|
6432
|
+
program.command("apichat").description("Turn any API into a chat: point at an OpenAPI spec and start asking questions (no login needed)").option("--openapispec <file|url>", "OpenAPI/Swagger spec to build from (JSON or YAML; file path or URL)").option("--target <url>", "Upstream base URL (overrides servers[0].url; enables spec discovery when --openapispec is omitted)").option("--name <name>", "Proxy name (defaults to the target host)").option("--apiversion <version>", "API version to create (e.g. 1.0.0)").option("--environment <env>", "Environment to chat against (default: prod anonymous / dev logged-in)").option("--target-auth-env <ENV_VAR>", "Read the upstream credential from this env var (CI-safe; required when there is no TTY and the API needs auth)").option("--force", "Proceed even if the API uses oauth2/openIdConnect target auth (you configure target auth yourself later)").option("-y, --yes", "Skip confirmation prompts").option("--no-verbose", "Hide the per-turn proxy curl trace (shown by default for apichat)").action(action((opts) => runApichat(opts)));
|
|
6440
6433
|
var llm = program.command("llm").description("Manage a local LLM provider key for chat (optional \u2014 lifts model quality, bills your key)");
|
|
6441
6434
|
llm.command("set-key").description("Store an LLM provider key locally (OpenRouter/Anthropic/DeepSeek/OpenAI)").argument("[key]", "The API key (omit to enter it hidden at a prompt)").option("--model <id>", "Model id to use with this key (e.g. anthropic/claude-haiku-4.5)").action(action((key, opts) => runLlmSetKey(key, opts)));
|
|
6442
6435
|
llm.command("show").description("Show the locally stored LLM key (masked)").action(action(() => runLlmShow()));
|