@oxagen/cli 2.1.4-371 → 2.1.4-374
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/oxagen.mjs +68 -26
- package/package.json +1 -1
package/oxagen.mjs
CHANGED
|
@@ -15267,7 +15267,7 @@ import { readFileSync as readFileSync10 } from "node:fs";
|
|
|
15267
15267
|
import { dirname as dirname7, resolve as resolve2 } from "node:path";
|
|
15268
15268
|
import { fileURLToPath } from "node:url";
|
|
15269
15269
|
function readVersion() {
|
|
15270
|
-
if (true) return "2.1.4-
|
|
15270
|
+
if (true) return "2.1.4-374";
|
|
15271
15271
|
try {
|
|
15272
15272
|
const here = dirname7(fileURLToPath(import.meta.url));
|
|
15273
15273
|
const pkg = JSON.parse(
|
|
@@ -48070,7 +48070,7 @@ var init_package = __esm({
|
|
|
48070
48070
|
"package.json"() {
|
|
48071
48071
|
package_default = {
|
|
48072
48072
|
name: "@oxagen/cli",
|
|
48073
|
-
version: "2.1.4-
|
|
48073
|
+
version: "2.1.4-374",
|
|
48074
48074
|
description: "Oxagen governance CLI \u2014 spend, lineage, grounding, credentials, and audit (agentic coding lives in the stella CLI)",
|
|
48075
48075
|
type: "module",
|
|
48076
48076
|
main: "./dist/index.js",
|
|
@@ -73228,8 +73228,11 @@ var init_upstream_tool = __esm({
|
|
|
73228
73228
|
in: external_exports.enum(["path", "query", "header", "cookie"]),
|
|
73229
73229
|
property: inputNameSchema.describe("The inputSchema property that carries the value."),
|
|
73230
73230
|
required: external_exports.boolean(),
|
|
73231
|
-
style: external_exports.enum(["simple", "label", "matrix", "form", "spaceDelimited", "pipeDelimited", "deepObject"]).optional().describe("OpenAPI's serialization style, when it differs from the default for `in`."),
|
|
73232
|
-
explode: external_exports.boolean().optional()
|
|
73231
|
+
style: external_exports.enum(["simple", "label", "matrix", "form", "spaceDelimited", "pipeDelimited", "deepObject", "cookie"]).optional().describe("OpenAPI's serialization style, when it differs from the default for `in`."),
|
|
73232
|
+
explode: external_exports.boolean().optional().describe("OpenAPI's explode. Import writes it on every cookie parameter, so the executor never guesses its default."),
|
|
73233
|
+
allow_reserved: external_exports.boolean().optional().describe(
|
|
73234
|
+
"A query parameter only: true sends reserved characters such as / and : in the value without percent-encoding (OpenAPI's allowReserved)."
|
|
73235
|
+
)
|
|
73233
73236
|
}).strict();
|
|
73234
73237
|
mediaTypeSchema = external_exports.string().regex(/^[a-z0-9!#$&^_.+-]+\/[a-z0-9!#$&^_.+-]+$/, "a media type is <type>/<subtype> in lowercase");
|
|
73235
73238
|
httpSpreadBodySchema = external_exports.object({
|
|
@@ -73256,8 +73259,11 @@ var init_upstream_tool = __esm({
|
|
|
73256
73259
|
kind: external_exports.literal("http"),
|
|
73257
73260
|
operation: external_exports.string().min(1).max(256).describe('The operationId, or "POST /refunds/{id}/cancel" when the operation has none.'),
|
|
73258
73261
|
method: httpMethodSchema,
|
|
73259
|
-
path: external_exports.string().regex(/^\/[^\s?#]*$/, "a path template starts with / and has no query or fragment").describe("The path template, relative to the environment's url."),
|
|
73260
|
-
|
|
73262
|
+
path: external_exports.string().regex(/^\/[^\s?#]*$/, "a path template starts with / and has no query or fragment").describe("The path template, relative to the environment's url, or to base_url when the operation has one."),
|
|
73263
|
+
base_url: httpUrlSchema.optional().describe(
|
|
73264
|
+
"The operation's own server, from the servers list on the operation or its path item, when that list differs from the document's. A call sends to it in every environment."
|
|
73265
|
+
),
|
|
73266
|
+
parameters: external_exports.array(httpParameterSchema).describe("Every parameter the operation declares. Compile drops one that the server's API key scheme supplies."),
|
|
73261
73267
|
body: httpBodySchema.optional(),
|
|
73262
73268
|
response: httpResponseSchema.optional().describe("Absent when no 2xx response has a JSON schema."),
|
|
73263
73269
|
security: external_exports.array(external_exports.record(external_exports.string().min(1), external_exports.array(external_exports.string()))).optional().describe("The operation's security requirements, as OpenAPI writes them. The gateway adds these.")
|
|
@@ -74249,7 +74255,9 @@ var securitySchema;
|
|
|
74249
74255
|
var init_operations = __esm({
|
|
74250
74256
|
"../../packages/mcp-studio/src/openapi/operations.ts"() {
|
|
74251
74257
|
"use strict";
|
|
74258
|
+
init_primitives();
|
|
74252
74259
|
init_upstream_tool();
|
|
74260
|
+
init_auth();
|
|
74253
74261
|
init_json2();
|
|
74254
74262
|
init_names2();
|
|
74255
74263
|
init_paging();
|
|
@@ -86653,7 +86661,15 @@ function idempotencyInputs(entry2, upstream) {
|
|
|
86653
86661
|
const lower = header2.toLowerCase();
|
|
86654
86662
|
return upstream.request.parameters.filter((parameter) => parameter.in === "header" && parameter.name.toLowerCase() === lower).map((parameter) => parameter.property);
|
|
86655
86663
|
}
|
|
86656
|
-
function
|
|
86664
|
+
function credentialParameters(auth, upstream) {
|
|
86665
|
+
const apply = auth?.apply;
|
|
86666
|
+
if (apply?.type !== "api_key" || apply.in === void 0 || apply.name === void 0 || upstream.request.kind !== "http") return [];
|
|
86667
|
+
const name = apply.in === "header" ? apply.name.toLowerCase() : apply.name;
|
|
86668
|
+
return upstream.request.parameters.filter(
|
|
86669
|
+
(parameter) => parameter.in === apply.in && (parameter.in === "header" ? parameter.name.toLowerCase() : parameter.name) === name
|
|
86670
|
+
);
|
|
86671
|
+
}
|
|
86672
|
+
function shapeInput(key, entry2, upstream, supplied, issues) {
|
|
86657
86673
|
const original = upstream.inputSchema;
|
|
86658
86674
|
const properties = propertiesOf(original);
|
|
86659
86675
|
const known = (name) => Object.hasOwn(properties, name);
|
|
@@ -86670,6 +86686,7 @@ function shapeInput(key, entry2, upstream, issues) {
|
|
|
86670
86686
|
}
|
|
86671
86687
|
}
|
|
86672
86688
|
for (const name of idempotencyInputs(entry2, upstream)) removed.add(name);
|
|
86689
|
+
for (const parameter of supplied) removed.add(parameter.property);
|
|
86673
86690
|
const defaults = Object.entries(entry2.defaults ?? {});
|
|
86674
86691
|
const rename3 = Object.entries(entry2.rename ?? {});
|
|
86675
86692
|
if (removed.size === 0 && defaults.length === 0 && rename3.length === 0) return original;
|
|
@@ -86780,14 +86797,17 @@ function selectionProblem(selection) {
|
|
|
86780
86797
|
if (!/[_A-Za-z]/.test(selection)) return "selection names no field.";
|
|
86781
86798
|
return void 0;
|
|
86782
86799
|
}
|
|
86783
|
-
function shapeRequest(key, entry2, upstream, issues) {
|
|
86800
|
+
function shapeRequest(key, entry2, upstream, supplied, issues) {
|
|
86784
86801
|
const request3 = upstream.request;
|
|
86802
|
+
if (request3.kind === "http" && supplied.length > 0) {
|
|
86803
|
+
return { ...request3, parameters: request3.parameters.filter((parameter) => !supplied.includes(parameter)) };
|
|
86804
|
+
}
|
|
86785
86805
|
if (entry2.selection === void 0 || request3.kind !== "graphql") return request3;
|
|
86786
86806
|
const problem = selectionProblem(entry2.selection);
|
|
86787
86807
|
if (problem !== void 0) issues.push({ tool: key, field: "selection", message: `${key}: ${problem}` });
|
|
86788
86808
|
return { ...request3, selection: entry2.selection };
|
|
86789
86809
|
}
|
|
86790
|
-
function compileTool(input, key, entry2, issues) {
|
|
86810
|
+
function compileTool(input, key, entry2, auth, issues) {
|
|
86791
86811
|
const { server, tools } = input;
|
|
86792
86812
|
if (server.exposure.mode === "search" && SEARCH_MODE_TOOLS.includes(key)) {
|
|
86793
86813
|
issues.push({
|
|
@@ -86806,9 +86826,10 @@ function compileTool(input, key, entry2, issues) {
|
|
|
86806
86826
|
}
|
|
86807
86827
|
const upstream = findUpstream(key, entry2, server.source.type, input.upstream, issues);
|
|
86808
86828
|
if (upstream === void 0) return void 0;
|
|
86829
|
+
const supplied = credentialParameters(auth, upstream);
|
|
86809
86830
|
const definition = {
|
|
86810
86831
|
name,
|
|
86811
|
-
inputSchema: shapeInput(key, entry2, upstream, issues),
|
|
86832
|
+
inputSchema: shapeInput(key, entry2, upstream, supplied, issues),
|
|
86812
86833
|
annotations: effectiveAnnotations(entry2)
|
|
86813
86834
|
};
|
|
86814
86835
|
if (upstream.title !== void 0) definition.title = upstream.title;
|
|
@@ -86861,7 +86882,7 @@ function compileTool(input, key, entry2, issues) {
|
|
|
86861
86882
|
data_classes: entry2.data_classes ?? []
|
|
86862
86883
|
},
|
|
86863
86884
|
shaping,
|
|
86864
|
-
request: shapeRequest(key, entry2, upstream, issues),
|
|
86885
|
+
request: shapeRequest(key, entry2, upstream, supplied, issues),
|
|
86865
86886
|
upstream
|
|
86866
86887
|
};
|
|
86867
86888
|
if (upstream.paging !== void 0) tool.paging = upstream.paging;
|
|
@@ -86990,13 +87011,15 @@ function resolveAuth(input, environments2, issues) {
|
|
|
86990
87011
|
function compile(input) {
|
|
86991
87012
|
const { server } = input;
|
|
86992
87013
|
const issues = [];
|
|
87014
|
+
const serverIssues = [];
|
|
87015
|
+
const environments2 = resolveEnvironments(server, serverIssues);
|
|
87016
|
+
const auth = resolveAuth(input, environments2, serverIssues);
|
|
86993
87017
|
const tools = {};
|
|
86994
87018
|
for (const [key, entry2] of Object.entries(input.tools.tools ?? {})) {
|
|
86995
|
-
const tool = compileTool(input, key, entry2, issues);
|
|
87019
|
+
const tool = compileTool(input, key, entry2, auth, issues);
|
|
86996
87020
|
if (tool !== void 0) tools[key] = tool;
|
|
86997
87021
|
}
|
|
86998
|
-
|
|
86999
|
-
const auth = resolveAuth(input, environments2, issues);
|
|
87022
|
+
issues.push(...serverIssues);
|
|
87000
87023
|
let descriptorSet;
|
|
87001
87024
|
if (server.source.type === "grpc") {
|
|
87002
87025
|
if (input.descriptor_set === void 0) {
|
|
@@ -88359,8 +88382,14 @@ function withQuery(path2, pairs) {
|
|
|
88359
88382
|
if (pairs.length === 0) return path2;
|
|
88360
88383
|
return `${path2}${path2.includes("?") ? "&" : "?"}${pairs.join("&")}`;
|
|
88361
88384
|
}
|
|
88362
|
-
function
|
|
88363
|
-
|
|
88385
|
+
function queryValue(value, allowReserved = false) {
|
|
88386
|
+
if (!allowReserved) return encodeURIComponent(value);
|
|
88387
|
+
return value.split(/(%[0-9A-Fa-f]{2})/).map(
|
|
88388
|
+
(part2, index) => index % 2 === 1 ? part2 : encodeURIComponent(part2).replace(/%(?:3A|2F|3F|40|24|2C|3B)/g, (code) => KEPT_RESERVED[code] ?? code)
|
|
88389
|
+
).join("");
|
|
88390
|
+
}
|
|
88391
|
+
function queryPair(name, value, allowReserved = false) {
|
|
88392
|
+
return `${encodeURIComponent(name)}=${queryValue(value, allowReserved)}`;
|
|
88364
88393
|
}
|
|
88365
88394
|
function httpTarget(endpoint, method, path2) {
|
|
88366
88395
|
const target2 = relayHttpTargetSchema.safeParse({
|
|
@@ -88489,7 +88518,7 @@ async function runHttp(spec) {
|
|
|
88489
88518
|
const exchanges = exchange === void 0 ? [] : [exchange];
|
|
88490
88519
|
return result2.ok ? { ok: true, value: result2.value, attempts: result2.attempts, exchanges } : { ok: false, error: result2.error, attempts: result2.attempts, exchanges };
|
|
88491
88520
|
}
|
|
88492
|
-
var RETRY_STATUSES, MAX_DETAIL;
|
|
88521
|
+
var KEPT_RESERVED, RETRY_STATUSES, MAX_DETAIL;
|
|
88493
88522
|
var init_http_call = __esm({
|
|
88494
88523
|
"../../packages/mcp-studio/src/execute/http-call.ts"() {
|
|
88495
88524
|
"use strict";
|
|
@@ -88499,6 +88528,15 @@ var init_http_call = __esm({
|
|
|
88499
88528
|
init_retry();
|
|
88500
88529
|
init_util3();
|
|
88501
88530
|
init_endpoint();
|
|
88531
|
+
KEPT_RESERVED = {
|
|
88532
|
+
"%3A": ":",
|
|
88533
|
+
"%2F": "/",
|
|
88534
|
+
"%3F": "?",
|
|
88535
|
+
"%40": "@",
|
|
88536
|
+
"%24": "$",
|
|
88537
|
+
"%2C": ",",
|
|
88538
|
+
"%3B": ";"
|
|
88539
|
+
};
|
|
88502
88540
|
RETRY_STATUSES = /* @__PURE__ */ new Set([429, 502, 503, 504]);
|
|
88503
88541
|
MAX_DETAIL = 1e3;
|
|
88504
88542
|
}
|
|
@@ -107504,7 +107542,8 @@ function headerText(parameter, value) {
|
|
|
107504
107542
|
}
|
|
107505
107543
|
function cookiePairs(parameter, value) {
|
|
107506
107544
|
const name = checkedName(parameter);
|
|
107507
|
-
const
|
|
107545
|
+
const style = parameter.style ?? "form";
|
|
107546
|
+
const explode = parameter.explode ?? (style === "form" || style === "cookie");
|
|
107508
107547
|
const shape = shapeOf(value, parameter.name);
|
|
107509
107548
|
const pairs = shape.kind === "scalar" ? [[name, shape.text]] : !explode ? [[name, shape.kind === "list" ? shape.items.join(",") : shape.entries.flat().join(",")]] : shape.kind === "list" ? shape.items.map((item) => [name, item]) : shape.entries;
|
|
107510
107549
|
for (const [cookie, text4] of pairs) {
|
|
@@ -107517,7 +107556,7 @@ function cookiePairs(parameter, value) {
|
|
|
107517
107556
|
}
|
|
107518
107557
|
return pairs;
|
|
107519
107558
|
}
|
|
107520
|
-
function entry(name, value, encoded
|
|
107559
|
+
function entry(name, value, encoded) {
|
|
107521
107560
|
return { name, value, encoded };
|
|
107522
107561
|
}
|
|
107523
107562
|
function queryEntries(parameter, value) {
|
|
@@ -107526,26 +107565,29 @@ function queryEntries(parameter, value) {
|
|
|
107526
107565
|
const shape = shapeOf(value, parameter.name);
|
|
107527
107566
|
const name = parameter.name;
|
|
107528
107567
|
const enc = encodeURIComponent;
|
|
107529
|
-
|
|
107568
|
+
const reserved = parameter.allow_reserved === true;
|
|
107569
|
+
const val = (text4) => queryValue(text4, reserved);
|
|
107570
|
+
const pair = (key, text4) => entry(key, text4, queryPair(key, text4, reserved));
|
|
107571
|
+
if (shape.kind === "scalar") return [pair(name, shape.text)];
|
|
107530
107572
|
switch (style) {
|
|
107531
107573
|
case "form":
|
|
107532
107574
|
case "spaceDelimited":
|
|
107533
107575
|
case "pipeDelimited": {
|
|
107534
107576
|
if (shape.kind === "object") {
|
|
107535
|
-
if (explode) return shape.entries.map(([k, v]) =>
|
|
107577
|
+
if (explode) return shape.entries.map(([k, v]) => pair(k, v));
|
|
107536
107578
|
const raw2 = shape.entries.flat().join(",");
|
|
107537
|
-
return [entry(name, raw2, `${enc(name)}=${shape.entries.flat().map(
|
|
107579
|
+
return [entry(name, raw2, `${enc(name)}=${shape.entries.flat().map(val).join(",")}`)];
|
|
107538
107580
|
}
|
|
107539
107581
|
if (shape.items.length === 0) return [];
|
|
107540
|
-
if (explode) return shape.items.map((item) =>
|
|
107582
|
+
if (explode) return shape.items.map((item) => pair(name, item));
|
|
107541
107583
|
const [raw, delimiter] = style === "form" ? [",", ","] : style === "spaceDelimited" ? [" ", "%20"] : ["|", "|"];
|
|
107542
|
-
return [entry(name, shape.items.join(raw), `${enc(name)}=${shape.items.map(
|
|
107584
|
+
return [entry(name, shape.items.join(raw), `${enc(name)}=${shape.items.map(val).join(delimiter)}`)];
|
|
107543
107585
|
}
|
|
107544
107586
|
case "deepObject": {
|
|
107545
107587
|
if (shape.kind !== "object") {
|
|
107546
107588
|
throw invalidArguments(`The query parameter ${name} uses the deepObject style, so it takes an object.`);
|
|
107547
107589
|
}
|
|
107548
|
-
return shape.entries.map(([k, v]) => entry(`${name}[${k}]`, v, `${enc(name)}[${enc(k)}]=${
|
|
107590
|
+
return shape.entries.map(([k, v]) => entry(`${name}[${k}]`, v, `${enc(name)}[${enc(k)}]=${val(v)}`));
|
|
107549
107591
|
}
|
|
107550
107592
|
default:
|
|
107551
107593
|
throw new BuildError("Invalid request", `The query parameter ${name} cannot use the ${style} style.`);
|
|
@@ -107630,7 +107672,7 @@ function interpret2(template) {
|
|
|
107630
107672
|
};
|
|
107631
107673
|
}
|
|
107632
107674
|
function buildHttpExchange(template, args, context, backoff_ms) {
|
|
107633
|
-
const endpoint = parseEndpoint(context.environment.url, "base");
|
|
107675
|
+
const endpoint = parseEndpoint(template.base_url ?? context.environment.url, "base");
|
|
107634
107676
|
const path2 = expandTemplate(template, args);
|
|
107635
107677
|
const idempotencyHeader = context.shaping.idempotency_header;
|
|
107636
107678
|
const key = context.idempotency_key;
|
package/package.json
CHANGED