@plune-ai/cli 0.39.2 → 0.39.4

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.cjs CHANGED
@@ -1753,7 +1753,29 @@ var PRICE_TABLE = {
1753
1753
  // OpenRouter has hundreds of models and dynamic routing, so most still need a `pricing` entry
1754
1754
  // in plune.yaml (or report cost_usd=0). Verify against OpenRouter's current rates.
1755
1755
  "openai/gpt-4o": { input_per_1k_usd: 25e-4, output_per_1k_usd: 0.01 },
1756
- "openai/gpt-4o-mini": { input_per_1k_usd: 15e-5, output_per_1k_usd: 6e-4 }
1756
+ "openai/gpt-4o-mini": { input_per_1k_usd: 15e-5, output_per_1k_usd: 6e-4 },
1757
+ // Via OpenRouter, the models the agent scenarios workflow can be run on. Source:
1758
+ // https://openrouter.ai/api/v1/models (`pricing`, USD per token), read on 2026-11-18, kept here
1759
+ // per thousand. A real OpenRouter call reports its own cost, which wins over these; they price a
1760
+ // dry run and any call that reports none. Long prompts may cost more on some of them.
1761
+ // The cheap set:
1762
+ "deepseek/deepseek-v4-flash": { input_per_1k_usd: 9e-5, output_per_1k_usd: 18e-5 },
1763
+ "qwen/qwen3.7-flash": { input_per_1k_usd: 3e-5, output_per_1k_usd: 13e-5 },
1764
+ "google/gemini-2.5-flash-lite": { input_per_1k_usd: 1e-4, output_per_1k_usd: 4e-4 },
1765
+ "mistralai/mistral-small-3.2-24b-instruct": {
1766
+ input_per_1k_usd: 75e-6,
1767
+ output_per_1k_usd: 2e-4
1768
+ },
1769
+ "openai/gpt-oss-120b": { input_per_1k_usd: 15e-5, output_per_1k_usd: 6e-4 },
1770
+ "anthropic/claude-haiku-5.5": { input_per_1k_usd: 1e-4, output_per_1k_usd: 5e-4 },
1771
+ "z-ai/glm-5.3-flash": { input_per_1k_usd: 399e-7, output_per_1k_usd: 784e-7 },
1772
+ // The middle set:
1773
+ "moonshotai/kimi-k2.6": { input_per_1k_usd: 65e-5, output_per_1k_usd: 341e-5 },
1774
+ "minimax/minimax-m3": { input_per_1k_usd: 3e-4, output_per_1k_usd: 12e-4 },
1775
+ "qwen/qwen3.7-plus": { input_per_1k_usd: 32e-5, output_per_1k_usd: 128e-5 },
1776
+ "google/gemini-3.8-flash": { input_per_1k_usd: 825e-6, output_per_1k_usd: 4125e-6 },
1777
+ "deepseek/deepseek-v4-pro": { input_per_1k_usd: 9e-4, output_per_1k_usd: 15e-4 },
1778
+ "openai/gpt-6.1-terra": { input_per_1k_usd: 1e-3, output_per_1k_usd: 5e-3 }
1757
1779
  };
1758
1780
 
1759
1781
  // src/providers/cost.ts
@@ -5172,6 +5194,7 @@ function createClient(opts) {
5172
5194
  upload: (path11, bytes, contentType) => send("POST", path11, { body: bytes, type: contentType }, uploadRetries ?? DEFAULT_RETRIES),
5173
5195
  del: (path11) => send("DELETE", path11),
5174
5196
  get: (path11) => send("GET", path11),
5197
+ patch: (path11, body) => send("PATCH", path11, { body: JSON.stringify(body), type: "application/json" }),
5175
5198
  async put(url, headers, source) {
5176
5199
  const putRetries = uploadRetries ?? 3;
5177
5200
  let last = { ok: false, status: null, code: "network" };
@@ -5215,7 +5238,7 @@ var UPLOAD_RETRIES = { min: 0, max: 20, default: 6 };
5215
5238
  // src/reporter-core/session.ts
5216
5239
  init_cjs_shims();
5217
5240
  var import_node_crypto4 = require("crypto");
5218
- var import_node_fs7 = require("fs");
5241
+ var import_node_fs8 = require("fs");
5219
5242
  var import_node_path3 = require("path");
5220
5243
  var import_node_util2 = require("util");
5221
5244
  init_failure_detail();
@@ -5248,6 +5271,39 @@ var fs7 = __toESM(require("fs"), 1);
5248
5271
  var path8 = __toESM(require("path"), 1);
5249
5272
  var DEFAULT_FALLBACK_PATH = path8.join(".plune", "pending-results.jsonl");
5250
5273
 
5274
+ // src/reporter-core/code-snapshot.ts
5275
+ init_cjs_shims();
5276
+ var import_node_fs7 = require("fs");
5277
+ var BEFORE_REGEX = /* @__PURE__ */ new Set([..."(,=:[!&|?{};+-*%<>~^"]);
5278
+ var CREDENTIAL = "password|passphrase|passwd|pass|pwd|token|secret|api[-_]?key|private[-_]?key|credential|auth|session|cookie";
5279
+ var LITERAL = String.raw`(?<q>['"\x60])(?:\\.|(?!\k<q>)[^\\\n])*\k<q>`;
5280
+ var TYPING = "(?:fill|type|pressSequentially)";
5281
+ var PLACES = [
5282
+ // `password = '…'`, `apiKey: "…"`, `'x-api-key': '…'`
5283
+ new RegExp(
5284
+ String.raw`(?<lead>\b(?<role>[\w$-]*(?:${CREDENTIAL})[\w$-]*)['"]?\s*[:=]\s*)${LITERAL}`,
5285
+ "gi"
5286
+ ),
5287
+ // `setToken('…')`: the call is named for a credential
5288
+ new RegExp(String.raw`(?<lead>\b(?<role>[\w$]*(?:${CREDENTIAL})[\w$]*)\s*\(\s*)${LITERAL}`, "gi"),
5289
+ // `.fill('#password', '…')`, `.type('#pwd', '…')`: the field is named in the same call
5290
+ new RegExp(
5291
+ String.raw`(?<lead>\.${TYPING}\(\s*['"][^'"\n]*?(?<role>${CREDENTIAL})[^'"\n]*['"]\s*,\s*)${LITERAL}`,
5292
+ "gi"
5293
+ ),
5294
+ // `getByLabel('Password').fill('…')`, `getByRole('textbox', { name: 'Password' }).type('…')`: … or
5295
+ // anywhere in the call the typing is chained off
5296
+ new RegExp(
5297
+ String.raw`(?<lead>\([^()\n]*?(?<role>${CREDENTIAL})[^()\n]*\)\s*\.${TYPING}\(\s*)${LITERAL}`,
5298
+ "gi"
5299
+ ),
5300
+ // `{ name: 'session', value: '…' }`: a cookie (or any name/value pair) named for a credential
5301
+ new RegExp(
5302
+ String.raw`(?<lead>\bname\s*:\s*['"][^'"\n]*?(?<role>${CREDENTIAL})[^'"\n]*['"]\s*,\s*value\s*:\s*)${LITERAL}`,
5303
+ "gi"
5304
+ )
5305
+ ];
5306
+
5251
5307
  // src/reporter-core/session.ts
5252
5308
  var SCREENSHOT_TYPES = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp"]);
5253
5309
  var SCREENSHOT_BYTES = 2 * 1024 * 1024;
@@ -5391,7 +5447,7 @@ function fileSender(options) {
5391
5447
  if (job.body !== void 0) bytes = job.body;
5392
5448
  else {
5393
5449
  try {
5394
- bytes = await import_node_fs7.promises.readFile(job.path);
5450
+ bytes = await import_node_fs8.promises.readFile(job.path);
5395
5451
  } catch {
5396
5452
  return skip(kind, job.name, "missing");
5397
5453
  }
@@ -5446,7 +5502,7 @@ function fileSender(options) {
5446
5502
  else if (job.path === void 0) return void skip(kind, job.name, "missing");
5447
5503
  else {
5448
5504
  try {
5449
- size = (await import_node_fs7.promises.stat(job.path)).size;
5505
+ size = (await import_node_fs8.promises.stat(job.path)).size;
5450
5506
  } catch {
5451
5507
  return void skip(kind, job.name, "missing");
5452
5508
  }
@@ -5502,7 +5558,7 @@ function fileSender(options) {
5502
5558
  else if (job.path === void 0) return void skip(job.kind, job.name, "missing");
5503
5559
  else {
5504
5560
  try {
5505
- size = (await import_node_fs7.promises.stat(job.path)).size;
5561
+ size = (await import_node_fs8.promises.stat(job.path)).size;
5506
5562
  } catch {
5507
5563
  return void skip(job.kind, job.name, "missing");
5508
5564
  }
@@ -5676,7 +5732,7 @@ function fileSender(options) {
5676
5732
  }
5677
5733
  let data;
5678
5734
  try {
5679
- data = job.body ?? await import_node_fs7.promises.readFile(job.path);
5735
+ data = job.body ?? await import_node_fs8.promises.readFile(job.path);
5680
5736
  } catch {
5681
5737
  skip(kind, job.name, "missing");
5682
5738
  continue;
package/dist/index.js CHANGED
@@ -1715,7 +1715,29 @@ var PRICE_TABLE = {
1715
1715
  // OpenRouter has hundreds of models and dynamic routing, so most still need a `pricing` entry
1716
1716
  // in plune.yaml (or report cost_usd=0). Verify against OpenRouter's current rates.
1717
1717
  "openai/gpt-4o": { input_per_1k_usd: 25e-4, output_per_1k_usd: 0.01 },
1718
- "openai/gpt-4o-mini": { input_per_1k_usd: 15e-5, output_per_1k_usd: 6e-4 }
1718
+ "openai/gpt-4o-mini": { input_per_1k_usd: 15e-5, output_per_1k_usd: 6e-4 },
1719
+ // Via OpenRouter, the models the agent scenarios workflow can be run on. Source:
1720
+ // https://openrouter.ai/api/v1/models (`pricing`, USD per token), read on 2026-11-18, kept here
1721
+ // per thousand. A real OpenRouter call reports its own cost, which wins over these; they price a
1722
+ // dry run and any call that reports none. Long prompts may cost more on some of them.
1723
+ // The cheap set:
1724
+ "deepseek/deepseek-v4-flash": { input_per_1k_usd: 9e-5, output_per_1k_usd: 18e-5 },
1725
+ "qwen/qwen3.7-flash": { input_per_1k_usd: 3e-5, output_per_1k_usd: 13e-5 },
1726
+ "google/gemini-2.5-flash-lite": { input_per_1k_usd: 1e-4, output_per_1k_usd: 4e-4 },
1727
+ "mistralai/mistral-small-3.2-24b-instruct": {
1728
+ input_per_1k_usd: 75e-6,
1729
+ output_per_1k_usd: 2e-4
1730
+ },
1731
+ "openai/gpt-oss-120b": { input_per_1k_usd: 15e-5, output_per_1k_usd: 6e-4 },
1732
+ "anthropic/claude-haiku-5.5": { input_per_1k_usd: 1e-4, output_per_1k_usd: 5e-4 },
1733
+ "z-ai/glm-5.3-flash": { input_per_1k_usd: 399e-7, output_per_1k_usd: 784e-7 },
1734
+ // The middle set:
1735
+ "moonshotai/kimi-k2.6": { input_per_1k_usd: 65e-5, output_per_1k_usd: 341e-5 },
1736
+ "minimax/minimax-m3": { input_per_1k_usd: 3e-4, output_per_1k_usd: 12e-4 },
1737
+ "qwen/qwen3.7-plus": { input_per_1k_usd: 32e-5, output_per_1k_usd: 128e-5 },
1738
+ "google/gemini-3.8-flash": { input_per_1k_usd: 825e-6, output_per_1k_usd: 4125e-6 },
1739
+ "deepseek/deepseek-v4-pro": { input_per_1k_usd: 9e-4, output_per_1k_usd: 15e-4 },
1740
+ "openai/gpt-6.1-terra": { input_per_1k_usd: 1e-3, output_per_1k_usd: 5e-3 }
1719
1741
  };
1720
1742
 
1721
1743
  // src/providers/cost.ts
@@ -5134,6 +5156,7 @@ function createClient(opts) {
5134
5156
  upload: (path12, bytes, contentType) => send("POST", path12, { body: bytes, type: contentType }, uploadRetries ?? DEFAULT_RETRIES),
5135
5157
  del: (path12) => send("DELETE", path12),
5136
5158
  get: (path12) => send("GET", path12),
5159
+ patch: (path12, body) => send("PATCH", path12, { body: JSON.stringify(body), type: "application/json" }),
5137
5160
  async put(url, headers, source) {
5138
5161
  const putRetries = uploadRetries ?? 3;
5139
5162
  let last = { ok: false, status: null, code: "network" };
@@ -5210,6 +5233,39 @@ import * as fs7 from "fs";
5210
5233
  import * as path9 from "path";
5211
5234
  var DEFAULT_FALLBACK_PATH = path9.join(".plune", "pending-results.jsonl");
5212
5235
 
5236
+ // src/reporter-core/code-snapshot.ts
5237
+ init_esm_shims();
5238
+ import { readFileSync as readFileSync7 } from "fs";
5239
+ var BEFORE_REGEX = /* @__PURE__ */ new Set([..."(,=:[!&|?{};+-*%<>~^"]);
5240
+ var CREDENTIAL = "password|passphrase|passwd|pass|pwd|token|secret|api[-_]?key|private[-_]?key|credential|auth|session|cookie";
5241
+ var LITERAL = String.raw`(?<q>['"\x60])(?:\\.|(?!\k<q>)[^\\\n])*\k<q>`;
5242
+ var TYPING = "(?:fill|type|pressSequentially)";
5243
+ var PLACES = [
5244
+ // `password = '…'`, `apiKey: "…"`, `'x-api-key': '…'`
5245
+ new RegExp(
5246
+ String.raw`(?<lead>\b(?<role>[\w$-]*(?:${CREDENTIAL})[\w$-]*)['"]?\s*[:=]\s*)${LITERAL}`,
5247
+ "gi"
5248
+ ),
5249
+ // `setToken('…')`: the call is named for a credential
5250
+ new RegExp(String.raw`(?<lead>\b(?<role>[\w$]*(?:${CREDENTIAL})[\w$]*)\s*\(\s*)${LITERAL}`, "gi"),
5251
+ // `.fill('#password', '…')`, `.type('#pwd', '…')`: the field is named in the same call
5252
+ new RegExp(
5253
+ String.raw`(?<lead>\.${TYPING}\(\s*['"][^'"\n]*?(?<role>${CREDENTIAL})[^'"\n]*['"]\s*,\s*)${LITERAL}`,
5254
+ "gi"
5255
+ ),
5256
+ // `getByLabel('Password').fill('…')`, `getByRole('textbox', { name: 'Password' }).type('…')`: … or
5257
+ // anywhere in the call the typing is chained off
5258
+ new RegExp(
5259
+ String.raw`(?<lead>\([^()\n]*?(?<role>${CREDENTIAL})[^()\n]*\)\s*\.${TYPING}\(\s*)${LITERAL}`,
5260
+ "gi"
5261
+ ),
5262
+ // `{ name: 'session', value: '…' }`: a cookie (or any name/value pair) named for a credential
5263
+ new RegExp(
5264
+ String.raw`(?<lead>\bname\s*:\s*['"][^'"\n]*?(?<role>${CREDENTIAL})[^'"\n]*['"]\s*,\s*value\s*:\s*)${LITERAL}`,
5265
+ "gi"
5266
+ )
5267
+ ];
5268
+
5213
5269
  // src/reporter-core/session.ts
5214
5270
  var SCREENSHOT_TYPES = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp"]);
5215
5271
  var SCREENSHOT_BYTES = 2 * 1024 * 1024;
@@ -30,6 +30,7 @@ __export(mcp_tools_exports, {
30
30
  createPluneToolExecutor: () => createPluneToolExecutor,
31
31
  defaultVisibleTools: () => defaultVisibleTools,
32
32
  isPluneToolName: () => isPluneToolName,
33
+ offeredTo: () => offeredTo,
33
34
  pluneTool: () => pluneTool
34
35
  });
35
36
  module.exports = __toCommonJS(mcp_tools_exports);
@@ -569,8 +570,13 @@ function pluneTool(name) {
569
570
  function isPluneToolName(name) {
570
571
  return BY_NAME.has(name);
571
572
  }
573
+ function offeredTo(tool, scope) {
574
+ if (scope !== "read") return true;
575
+ if (tool.write) return false;
576
+ return tool.name !== "plune_discover_tools" || PLUNE_TOOLS.some((t) => t.visibility !== "core" && !t.write);
577
+ }
572
578
  function defaultVisibleTools(scope) {
573
- return PLUNE_TOOLS.filter((t) => t.visibility === "core" && !(scope === "read" && t.write)).map((t) => t.name);
579
+ return PLUNE_TOOLS.filter((t) => t.visibility === "core" && offeredTo(t, scope)).map((t) => t.name);
574
580
  }
575
581
 
576
582
  // src/mcp-tools/execute.ts
@@ -788,7 +794,9 @@ function createPluneToolExecutor(opts) {
788
794
  async plune_cases_search(i) {
789
795
  const query = withoutUndefined({
790
796
  ...i["filters"],
791
- limit: i["limit"] === void 0 ? void 0 : String(i["limit"]),
797
+ // A full case weighs ~160 estimated tokens, so the platform's own page of up to 200 filled a model's context
798
+ // in one answer; 20 a page, the rest a cursor away, unless the caller asks for more.
799
+ limit: String(i["limit"] ?? 20),
792
800
  cursor: i["cursor"],
793
801
  stability: "0"
794
802
  });
@@ -1031,5 +1039,6 @@ function createPluneToolExecutor(opts) {
1031
1039
  createPluneToolExecutor,
1032
1040
  defaultVisibleTools,
1033
1041
  isPluneToolName,
1042
+ offeredTo,
1034
1043
  pluneTool
1035
1044
  });
@@ -880,7 +880,12 @@ declare const PLUNE_TOOL_NAMES: readonly PluneToolName[];
880
880
  /** The definition of one tool; throws on a name the contract does not have. */
881
881
  declare function pluneTool(name: string): PluneToolDefinition;
882
882
  declare function isPluneToolName(name: string): name is PluneToolName;
883
- /** The tools a client is shown before it asks for more; without the writers for a `read` token. */
883
+ /**
884
+ * Whether a token of this scope is offered the tool at all. A `read` token gets no writer, and no discovery while every
885
+ * hidden tool writes: there it could only answer with a refusal, which a model reads as a way to write.
886
+ */
887
+ declare function offeredTo(tool: PluneToolDefinition, scope?: 'read' | 'write'): boolean;
888
+ /** The tools a client is shown before it asks for more; for a `read` token, only those it is offered. */
884
889
  declare function defaultVisibleTools(scope?: 'read' | 'write'): PluneToolName[];
885
890
 
886
891
  /**
@@ -953,4 +958,4 @@ declare class PluneNetworkError extends Error {
953
958
  /** Objects one call takes. */
954
959
  declare const BATCH_MAX = 100;
955
960
 
956
- export { BATCH_MAX, CONFIRM_TTL_MS, MAX_VISIBLE_TOOLS, PLUNE_TOOLS, PLUNE_TOOL_NAMES, PluneApiError, PluneNetworkError, type PluneToolDefinition, type PluneToolExecutor, type PluneToolExecutorOptions, type PluneToolName, type TokenScope, type ToolError, type ToolOutcome, type ToolVisibility, createPluneToolExecutor, defaultVisibleTools, isPluneToolName, pluneTool };
961
+ export { BATCH_MAX, CONFIRM_TTL_MS, MAX_VISIBLE_TOOLS, PLUNE_TOOLS, PLUNE_TOOL_NAMES, PluneApiError, PluneNetworkError, type PluneToolDefinition, type PluneToolExecutor, type PluneToolExecutorOptions, type PluneToolName, type TokenScope, type ToolError, type ToolOutcome, type ToolVisibility, createPluneToolExecutor, defaultVisibleTools, isPluneToolName, offeredTo, pluneTool };
@@ -880,7 +880,12 @@ declare const PLUNE_TOOL_NAMES: readonly PluneToolName[];
880
880
  /** The definition of one tool; throws on a name the contract does not have. */
881
881
  declare function pluneTool(name: string): PluneToolDefinition;
882
882
  declare function isPluneToolName(name: string): name is PluneToolName;
883
- /** The tools a client is shown before it asks for more; without the writers for a `read` token. */
883
+ /**
884
+ * Whether a token of this scope is offered the tool at all. A `read` token gets no writer, and no discovery while every
885
+ * hidden tool writes: there it could only answer with a refusal, which a model reads as a way to write.
886
+ */
887
+ declare function offeredTo(tool: PluneToolDefinition, scope?: 'read' | 'write'): boolean;
888
+ /** The tools a client is shown before it asks for more; for a `read` token, only those it is offered. */
884
889
  declare function defaultVisibleTools(scope?: 'read' | 'write'): PluneToolName[];
885
890
 
886
891
  /**
@@ -953,4 +958,4 @@ declare class PluneNetworkError extends Error {
953
958
  /** Objects one call takes. */
954
959
  declare const BATCH_MAX = 100;
955
960
 
956
- export { BATCH_MAX, CONFIRM_TTL_MS, MAX_VISIBLE_TOOLS, PLUNE_TOOLS, PLUNE_TOOL_NAMES, PluneApiError, PluneNetworkError, type PluneToolDefinition, type PluneToolExecutor, type PluneToolExecutorOptions, type PluneToolName, type TokenScope, type ToolError, type ToolOutcome, type ToolVisibility, createPluneToolExecutor, defaultVisibleTools, isPluneToolName, pluneTool };
961
+ export { BATCH_MAX, CONFIRM_TTL_MS, MAX_VISIBLE_TOOLS, PLUNE_TOOLS, PLUNE_TOOL_NAMES, PluneApiError, PluneNetworkError, type PluneToolDefinition, type PluneToolExecutor, type PluneToolExecutorOptions, type PluneToolName, type TokenScope, type ToolError, type ToolOutcome, type ToolVisibility, createPluneToolExecutor, defaultVisibleTools, isPluneToolName, offeredTo, pluneTool };
package/dist/mcp-tools.js CHANGED
@@ -533,8 +533,13 @@ function pluneTool(name) {
533
533
  function isPluneToolName(name) {
534
534
  return BY_NAME.has(name);
535
535
  }
536
+ function offeredTo(tool, scope) {
537
+ if (scope !== "read") return true;
538
+ if (tool.write) return false;
539
+ return tool.name !== "plune_discover_tools" || PLUNE_TOOLS.some((t) => t.visibility !== "core" && !t.write);
540
+ }
536
541
  function defaultVisibleTools(scope) {
537
- return PLUNE_TOOLS.filter((t) => t.visibility === "core" && !(scope === "read" && t.write)).map((t) => t.name);
542
+ return PLUNE_TOOLS.filter((t) => t.visibility === "core" && offeredTo(t, scope)).map((t) => t.name);
538
543
  }
539
544
 
540
545
  // src/mcp-tools/execute.ts
@@ -752,7 +757,9 @@ function createPluneToolExecutor(opts) {
752
757
  async plune_cases_search(i) {
753
758
  const query = withoutUndefined({
754
759
  ...i["filters"],
755
- limit: i["limit"] === void 0 ? void 0 : String(i["limit"]),
760
+ // A full case weighs ~160 estimated tokens, so the platform's own page of up to 200 filled a model's context
761
+ // in one answer; 20 a page, the rest a cursor away, unless the caller asks for more.
762
+ limit: String(i["limit"] ?? 20),
756
763
  cursor: i["cursor"],
757
764
  stability: "0"
758
765
  });
@@ -994,5 +1001,6 @@ export {
994
1001
  createPluneToolExecutor,
995
1002
  defaultVisibleTools,
996
1003
  isPluneToolName,
1004
+ offeredTo,
997
1005
  pluneTool
998
1006
  };