@plune-ai/cli 0.40.0 → 0.40.1
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/cli.cjs +10 -7
- package/dist/index.cjs +4 -2
- package/dist/index.js +4 -2
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -5663,7 +5663,9 @@ function notLocal(req, port2, bound = "127.0.0.1") {
|
|
|
5663
5663
|
const hosts = names.flatMap((name) => port2 === 80 ? [name, `${name}:80`] : [`${name}:${port2}`]);
|
|
5664
5664
|
const host = (req.headers.host ?? "").toLowerCase();
|
|
5665
5665
|
const { origin } = req.headers;
|
|
5666
|
-
|
|
5666
|
+
const site = req.headers["sec-fetch-site"];
|
|
5667
|
+
return !hosts.includes(host) || origin !== void 0 && !hosts.some((h) => origin.toLowerCase() === `http://${h}`) || // Fail closed: of the four values a browser sends, `cross-site` and `same-site` are another origin.
|
|
5668
|
+
site !== void 0 && !["same-origin", "none"].includes(String(site).toLowerCase());
|
|
5667
5669
|
}
|
|
5668
5670
|
function maskedHeaders(headers) {
|
|
5669
5671
|
const out = {};
|
|
@@ -6003,7 +6005,7 @@ var init_server = __esm({
|
|
|
6003
6005
|
SCOPE_NAME = /^(?!\.{1,2}$)[A-Za-z0-9._-]+$/;
|
|
6004
6006
|
DOT_SEGMENT = /^(\.|%2e){1,2}$/i;
|
|
6005
6007
|
MAX_BODY_BYTES = 16 * 1024 * 1024;
|
|
6006
|
-
NOT_LOCAL_MESSAGE = "This server answers only a request addressed to 127.0.0.1, localhost or [::1] with its own port, and none a
|
|
6008
|
+
NOT_LOCAL_MESSAGE = "This server answers only a request addressed to 127.0.0.1, localhost or [::1] with its own port, and none a browser marks as sent from another origin";
|
|
6007
6009
|
providerError = (type, code, message2) => ({
|
|
6008
6010
|
type: "error",
|
|
6009
6011
|
error: { type, code, message: message2 }
|
|
@@ -38752,7 +38754,7 @@ function stubLines(exchange3, known2) {
|
|
|
38752
38754
|
if (joined(rest.response).some((text7) => holds(lower(text7), forms)))
|
|
38753
38755
|
return { skip: "a credential is split over the pieces of the answer" };
|
|
38754
38756
|
}
|
|
38755
|
-
const body =
|
|
38757
|
+
const body = JSON.stringify(rest, null, 2).split("\n").slice(1).join("\n ");
|
|
38756
38758
|
const text6 = stubHead(exchange3.method, "once") + body;
|
|
38757
38759
|
const unsafe = { skip: "it cannot be written safely" };
|
|
38758
38760
|
try {
|
|
@@ -39271,7 +39273,7 @@ var init_record = __esm({
|
|
|
39271
39273
|
stubHead = (method, times) => ` {
|
|
39272
39274
|
"method": ${JSON.stringify(method)},
|
|
39273
39275
|
"times": "${times}",
|
|
39274
|
-
`;
|
|
39276
|
+
`;
|
|
39275
39277
|
NOT_FORWARDED = /* @__PURE__ */ new Set([
|
|
39276
39278
|
"connection",
|
|
39277
39279
|
"keep-alive",
|
|
@@ -39392,7 +39394,8 @@ Prompts and answers are stored as they are and may hold personal or confidential
|
|
|
39392
39394
|
await server2.close();
|
|
39393
39395
|
throw new MockUsageError(err.message);
|
|
39394
39396
|
}
|
|
39395
|
-
|
|
39397
|
+
const count6 = `${stubs.length} ${stubs.length === 1 ? "stub" : "stubs"}`;
|
|
39398
|
+
io.stdout(`Serving ${count6} at ${scope.url}, with no network. Ctrl+C stops.
|
|
39396
39399
|
`);
|
|
39397
39400
|
io.onReady?.(scope.url);
|
|
39398
39401
|
await stopped(io.signal);
|
|
@@ -40479,7 +40482,7 @@ ${missed.map((m) => ` - ${m}`).join("\n")}
|
|
|
40479
40482
|
);
|
|
40480
40483
|
program.command("mock").description(
|
|
40481
40484
|
"Serve a stub file from a local stub server (127.0.0.1 only, no network), or with --record write one from the answers of a real HTTP API"
|
|
40482
|
-
).argument("<file>", "The stub file: served as it is, or written with --record (inside the current folder only)").option("--record", "Forward each request to --target and write the answers into <file>", false).option("--target <origin>", "With --record: where requests go, an http: or https: origin with no path. Nothing in a request changes it").option("--force", "With --record: replace <file> if it is a stub file or empty", false).option("--scope <name>", "The first path segment of the base URL", "default").option(
|
|
40485
|
+
).argument("<file>", "The stub file: served as it is, or written with --record (a recording is written inside the current folder only)").option("--record", "Forward each request to --target and write the answers into <file>", false).option("--target <origin>", "With --record: where requests go, an http: or https: origin with no path. Nothing in a request changes it").option("--force", "With --record: replace <file> if it is a stub file or empty", false).option("--scope <name>", "The first path segment of the base URL", "default").option(
|
|
40483
40486
|
"--port <n>",
|
|
40484
40487
|
"The port on 127.0.0.1 (default: a free one, printed at the start)",
|
|
40485
40488
|
(v) => {
|
|
@@ -40489,7 +40492,7 @@ ${missed.map((m) => ` - ${m}`).join("\n")}
|
|
|
40489
40492
|
0
|
|
40490
40493
|
).addHelpText(
|
|
40491
40494
|
"after",
|
|
40492
|
-
"\nA recording holds the prompts and the answers as they were sent and received: they may hold personal or confidential text. It is never uploaded. Never written: request headers, the query string, and response headers other than content-type and retry-after. A field with a secret's name holds [masked] in place of its value: in the JSON body of a request whatever the value is, in the JSON of an answer only a string of 16 characters or more with no whitespace that is not letters only. A credential value is also replaced wherever it is found, if it came in a header, the query or a cookie and has 8 characters or more, or in a body field and has 16 or more with no whitespace. Not searched for: a value of letters only, and a value in a form other than plain, URL-encoded, JSON-escaped, base64 or hex; a value over 4096 characters is found by its first 4096. A credential in a path segment, or under an ordinary header, query or body-field name, is not known to the recorder. An answer that sends a searched value back in pieces is not recorded. A recording over 1 MiB is not read by `plune run`. Redirects are passed back, not followed. Not recorded, with a warning: a body over 8 MiB, a body that is not UTF-8 text, a compressed body, a redirect, a 304. A failed upstream is answered 502 and not recorded. Timing is not recorded. A replay matches the method, the path and the whole JSON body; the same request recorded several times is replayed in the order recorded. The server answers only a request addressed to 127.0.0.1, localhost or [::1] with its port, and none that a
|
|
40495
|
+
"\nA recording holds the prompts and the answers as they were sent and received: they may hold personal or confidential text. It is never uploaded. Never written: request headers, the query string, and response headers other than content-type and retry-after. A field with a secret's name holds [masked] in place of its value: in the JSON body of a request whatever the value is, in the JSON of an answer only a string of 16 characters or more with no whitespace that is not letters only. A credential value is also replaced wherever it is found, if it came in a header, the query or a cookie and has 8 characters or more, or in a body field and has 16 or more with no whitespace. Not searched for: a value of letters only, and a value in a form other than plain, URL-encoded, JSON-escaped, base64 or hex; a value over 4096 characters is found by its first 4096. A credential in a path segment, or under an ordinary header, query or body-field name, is not known to the recorder. An answer that sends a searched value back in pieces is not recorded. A recording over 1 MiB is not read by `plune run`. Redirects are passed back, not followed. Not recorded, with a warning: a body over 8 MiB, a body that is not UTF-8 text, a compressed body, a redirect, a 304. A failed upstream is answered 502 and not recorded. Timing is not recorded. A replay matches the method, the path and the whole JSON body; the same request recorded several times is replayed in the order recorded. The server answers only a request addressed to 127.0.0.1, localhost or [::1] with its port, and none that a browser marks as sent from another origin: one with an Origin that is not the server's, or with Sec-Fetch-Site cross-site or same-site. Such a request is not forwarded and not recorded; a page that makes a browser send one cannot read an answer. Ctrl+C stops; the exit code is 1 if exchanges could not be written to the file."
|
|
40493
40496
|
).action(
|
|
40494
40497
|
async (file, options, command) => {
|
|
40495
40498
|
const verbose = verboseOf(command);
|
package/dist/index.cjs
CHANGED
|
@@ -5852,9 +5852,11 @@ function notLocal(req, port, bound = "127.0.0.1") {
|
|
|
5852
5852
|
const hosts = names.flatMap((name) => port === 80 ? [name, `${name}:80`] : [`${name}:${port}`]);
|
|
5853
5853
|
const host = (req.headers.host ?? "").toLowerCase();
|
|
5854
5854
|
const { origin } = req.headers;
|
|
5855
|
-
|
|
5855
|
+
const site = req.headers["sec-fetch-site"];
|
|
5856
|
+
return !hosts.includes(host) || origin !== void 0 && !hosts.some((h) => origin.toLowerCase() === `http://${h}`) || // Fail closed: of the four values a browser sends, `cross-site` and `same-site` are another origin.
|
|
5857
|
+
site !== void 0 && !["same-origin", "none"].includes(String(site).toLowerCase());
|
|
5856
5858
|
}
|
|
5857
|
-
var NOT_LOCAL_MESSAGE = "This server answers only a request addressed to 127.0.0.1, localhost or [::1] with its own port, and none a
|
|
5859
|
+
var NOT_LOCAL_MESSAGE = "This server answers only a request addressed to 127.0.0.1, localhost or [::1] with its own port, and none a browser marks as sent from another origin";
|
|
5858
5860
|
function maskedHeaders(headers) {
|
|
5859
5861
|
const out = {};
|
|
5860
5862
|
for (const [name, value] of Object.entries(headers)) {
|
package/dist/index.js
CHANGED
|
@@ -5814,9 +5814,11 @@ function notLocal(req, port, bound = "127.0.0.1") {
|
|
|
5814
5814
|
const hosts = names.flatMap((name) => port === 80 ? [name, `${name}:80`] : [`${name}:${port}`]);
|
|
5815
5815
|
const host = (req.headers.host ?? "").toLowerCase();
|
|
5816
5816
|
const { origin } = req.headers;
|
|
5817
|
-
|
|
5817
|
+
const site = req.headers["sec-fetch-site"];
|
|
5818
|
+
return !hosts.includes(host) || origin !== void 0 && !hosts.some((h) => origin.toLowerCase() === `http://${h}`) || // Fail closed: of the four values a browser sends, `cross-site` and `same-site` are another origin.
|
|
5819
|
+
site !== void 0 && !["same-origin", "none"].includes(String(site).toLowerCase());
|
|
5818
5820
|
}
|
|
5819
|
-
var NOT_LOCAL_MESSAGE = "This server answers only a request addressed to 127.0.0.1, localhost or [::1] with its own port, and none a
|
|
5821
|
+
var NOT_LOCAL_MESSAGE = "This server answers only a request addressed to 127.0.0.1, localhost or [::1] with its own port, and none a browser marks as sent from another origin";
|
|
5820
5822
|
function maskedHeaders(headers) {
|
|
5821
5823
|
const out = {};
|
|
5822
5824
|
for (const [name, value] of Object.entries(headers)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plune-ai/cli",
|
|
3
|
-
"version": "0.40.
|
|
3
|
+
"version": "0.40.1",
|
|
4
4
|
"mcpName": "ai.plune/cli",
|
|
5
5
|
"description": "AI-powered assertion testing for LLM apps — write assertions, run them against any provider, get a pass/fail report (local, CI, or diff).",
|
|
6
6
|
"keywords": [
|