@plune-ai/cli 0.39.13 → 0.39.15

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 CHANGED
@@ -1134,10 +1134,25 @@ var jsonSchemaAssertionSchema = z.object({
1134
1134
  schema: z.record(z.string(), z.unknown()),
1135
1135
  extract: z.enum(["auto", "strict"]).optional()
1136
1136
  });
1137
+ var jevJudgeSchema = z.strictObject({
1138
+ type: z.literal("jev"),
1139
+ model: z.string().min(1),
1140
+ timeout: providerTimeoutSchema.optional()
1141
+ });
1142
+ var partialProviderSchema = providerConfigSchema.partial();
1143
+ var llmJudgeProviderField = z.any().transform((value, ctx) => {
1144
+ const jev = typeof value === "object" && value !== null && value.type === "jev";
1145
+ const r = (jev ? jevJudgeSchema : partialProviderSchema).safeParse(value);
1146
+ if (r.success) return r.data;
1147
+ for (const issue of r.error.issues) ctx.addIssue({ code: "custom", message: issue.message, path: issue.path });
1148
+ return z.NEVER;
1149
+ });
1137
1150
  var llmJudgeAssertionSchema = z.object({
1138
1151
  type: z.literal("llm-judge"),
1139
1152
  criteria: z.string().min(1),
1140
- provider: providerConfigSchema.partial().optional(),
1153
+ // `type: jev` is a judge of another kind (a decision model) with fields of its own; anything else is the eval's
1154
+ // provider with these fields over it.
1155
+ provider: llmJudgeProviderField.optional(),
1141
1156
  // The judge's score floor, not the eval's share of passing runs (that one is `evalRepeatsShape`).
1142
1157
  pass_threshold: z.number().min(0, "pass_threshold (llm-judge: minimum judge score) must be between 0 and 1").max(1, "pass_threshold (llm-judge: minimum judge score) must be between 0 and 1").optional()
1143
1158
  });
@@ -1719,6 +1734,8 @@ var PRICE_TABLE = {
1719
1734
  "claude-fable-5-1": { input_per_1k_usd: 0.01, output_per_1k_usd: 0.05 },
1720
1735
  "claude-opus-5-5": { input_per_1k_usd: 4e-3, output_per_1k_usd: 0.02 },
1721
1736
  "claude-sonnet-5-5": { input_per_1k_usd: 2e-3, output_per_1k_usd: 0.01 },
1737
+ // Read on 2026-11-24 from https://openrouter.ai/api/v1/models, which passes Anthropic's list price through.
1738
+ "claude-haiku-5-5": { input_per_1k_usd: 1e-4, output_per_1k_usd: 5e-4 },
1722
1739
  "claude-haiku-4-5": { input_per_1k_usd: 1e-3, output_per_1k_usd: 5e-3 },
1723
1740
  // The dated id of the same model; a config may name either.
1724
1741
  "claude-haiku-4-5-20251001": { input_per_1k_usd: 1e-3, output_per_1k_usd: 5e-3 },
@@ -2750,6 +2767,18 @@ var llmJudge = {
2750
2767
  }
2751
2768
  const criteria = interpolate(ctx.params.criteria, ctx);
2752
2769
  const threshold = ctx.params.pass_threshold ?? DEFAULT_PASS_THRESHOLD;
2770
+ if (ctx.judge.decide !== void 0) {
2771
+ const p = await ctx.judge.decide({
2772
+ criteria,
2773
+ output: ctx.output,
2774
+ ...ctx.input !== void 0 ? { input: ctx.input } : {}
2775
+ });
2776
+ return {
2777
+ passed: p >= threshold,
2778
+ score: p,
2779
+ reason: `probability ${p.toFixed(3)} that the answer meets the criteria vs threshold ${threshold}; this judge gives no reason`
2780
+ };
2781
+ }
2753
2782
  const { score, reason } = parseScored(
2754
2783
  await askJson(ctx.judge, prompt(criteria, ctx.output, ctx.input))
2755
2784
  );
@@ -4094,9 +4123,23 @@ async function assess(p, output, input, transcript) {
4094
4123
  let assertionError;
4095
4124
  for (const assertion of p.assertions) {
4096
4125
  const own2 = assertion.type === "llm-judge" ? assertion.provider : void 0;
4097
- const judgeCfg = own2 === void 0 ? p.providerConfig : { ...p.providerConfig, ...own2 };
4126
+ const jev = own2?.type === "jev" ? own2 : void 0;
4127
+ const judgeCfg = own2 === void 0 || own2.type === "jev" ? p.providerConfig : { ...p.providerConfig, ...own2 };
4098
4128
  let judgedBy;
4099
4129
  const judge = () => {
4130
+ if (jev !== void 0) {
4131
+ if (p.jevJudge === void 0) throw new Error("this run cannot build the jev judge of an llm-judge check");
4132
+ const inner2 = p.jevJudge(jev, (usd) => {
4133
+ judgeCost += usd;
4134
+ });
4135
+ return {
4136
+ ask: (q) => inner2.ask(q),
4137
+ decide: (q) => {
4138
+ judgedBy = `jev/${jev.model}`;
4139
+ return inner2.decide(q);
4140
+ }
4141
+ };
4142
+ }
4100
4143
  let provider = p.provider;
4101
4144
  if (own2 !== void 0) {
4102
4145
  if (p.resolveJudge === void 0)
@@ -4457,6 +4500,7 @@ async function runOrchestration(config, options, deps) {
4457
4500
  providerConfig,
4458
4501
  provider,
4459
4502
  resolveJudge,
4503
+ ...deps.jevJudge !== void 0 ? { jevJudge: deps.jevJudge } : {},
4460
4504
  embedder: deps.embedder,
4461
4505
  cache: deps.cache,
4462
4506
  now: deps.now,
@@ -4558,6 +4602,89 @@ function typeName(value) {
4558
4602
  return value === null ? "null" : Array.isArray(value) ? "array" : typeof value;
4559
4603
  }
4560
4604
 
4605
+ // src/judge/jev.ts
4606
+ init_esm_shims();
4607
+ var JEV_BASE_URL = "https://api.typesafe.ai";
4608
+ var JEV_KEY_ENV = "TYPESAFE_API_KEY";
4609
+ var JEV_MAX_STATE_CHARS = 16e3;
4610
+ var JEV_USD_PER_1M_INPUT_TOKENS = 0.042;
4611
+ var DEFAULT_TIMEOUT_MS = 3e4;
4612
+ var INSTRUCTIONS = "Does the answer meet the criterion?";
4613
+ var YES = "the answer meets the criterion";
4614
+ var NO = "the answer does not meet the criterion";
4615
+ function jevState(q) {
4616
+ const request = q.input === void 0 ? "" : `Request:
4617
+ ${q.input}
4618
+
4619
+ `;
4620
+ return `${request}Answer:
4621
+ ${q.output}
4622
+
4623
+ Criterion:
4624
+ ${q.criteria}`;
4625
+ }
4626
+ function probability(json) {
4627
+ const answer = json?.answers?.q;
4628
+ const p = answer?.type === "noul" ? answer.noul : void 0;
4629
+ if (typeof p !== "number" || !Number.isFinite(p) || p < 0 || p > 1)
4630
+ throw new ProviderError("JEV_ANSWER", "jev returned no probability for the question asked");
4631
+ return p;
4632
+ }
4633
+ function makeJevJudge(cfg, deps) {
4634
+ return {
4635
+ ask: () => Promise.reject(new Error("a jev judge answers a yes-or-no question only: it cannot judge this kind of check")),
4636
+ async decide(q) {
4637
+ const key = deps.env[JEV_KEY_ENV];
4638
+ if (key === void 0 || key === "")
4639
+ throw new AuthError(`${JEV_KEY_ENV} is not set: the jev judge of an llm-judge check needs it`, JEV_KEY_ENV);
4640
+ const state = jevState(q);
4641
+ if (state.length > JEV_MAX_STATE_CHARS)
4642
+ throw new ProviderError(
4643
+ "JEV_INPUT_TOO_LONG",
4644
+ `the request, answer and criterion are ${state.length} characters together; a jev judge takes ${JEV_MAX_STATE_CHARS}. Nothing was sent`
4645
+ );
4646
+ const body = JSON.stringify({
4647
+ state,
4648
+ model: cfg.model,
4649
+ questions: { q: { type: "noul", instructions: INSTRUCTIONS, criteria: { true: YES, false: NO } } }
4650
+ });
4651
+ const send = async () => {
4652
+ try {
4653
+ return await deps.fetchFn(`${JEV_BASE_URL}/v1/systemone`, {
4654
+ method: "POST",
4655
+ headers: { "content-type": "application/json", authorization: `Bearer ${key}` },
4656
+ body,
4657
+ redirect: "error",
4658
+ signal: AbortSignal.timeout(cfg.timeout ?? DEFAULT_TIMEOUT_MS)
4659
+ });
4660
+ } catch (err) {
4661
+ throw new ProviderError("JEV_UNREACHABLE", `jev did not answer: ${err instanceof Error ? err.message : String(err)}`);
4662
+ }
4663
+ };
4664
+ let res = await send();
4665
+ if (res.status === 429 || res.status >= 500) res = await send();
4666
+ if (res.status === 401 || res.status === 403)
4667
+ throw new AuthError(`jev refused the key in ${JEV_KEY_ENV} (HTTP ${res.status})`, JEV_KEY_ENV);
4668
+ if (!res.ok) throw new ProviderError("JEV_HTTP", `jev answered HTTP ${res.status}`);
4669
+ const json = await res.json();
4670
+ const p = probability(json);
4671
+ const tokens = json.usage?.input_tokens;
4672
+ const billed = typeof tokens === "number" && tokens >= 0 ? tokens : Math.ceil(state.length / 3);
4673
+ deps.onCost(billed / 1e6 * JEV_USD_PER_1M_INPUT_TOKENS);
4674
+ return p;
4675
+ }
4676
+ };
4677
+ }
4678
+ var warned = false;
4679
+ function warnJevExperimental(write = (l) => process.stderr.write(l)) {
4680
+ if (warned) return;
4681
+ warned = true;
4682
+ write(
4683
+ `warning: the jev judge is experimental. It gives a probability and no reason, sends the request, answer and criterion to ${new URL(JEV_BASE_URL).host}, and was measured on answers with a clear right or wrong only. See docs/guide/assertions.md#an-experimental-judge-jev
4684
+ `
4685
+ );
4686
+ }
4687
+
4561
4688
  // src/cli/commands/run.ts
4562
4689
  var NOOP_CACHE = { get: () => void 0, set: () => {
4563
4690
  }, delete: () => {
@@ -4653,7 +4780,14 @@ function buildRealDeps(config, baseDir, dryRun) {
4653
4780
  now: Date.now,
4654
4781
  loadDataset,
4655
4782
  baseDir,
4656
- connectMcp: makeMcpConnect(config, baseDir, process.env)
4783
+ connectMcp: makeMcpConnect(config, baseDir, process.env),
4784
+ // A dry run stops before any check, so it never builds this judge. Mock mode sends nothing: no jev judge there.
4785
+ ...isMockMode(process.env) ? {} : {
4786
+ jevJudge: (cfg, onCost) => {
4787
+ warnJevExperimental();
4788
+ return makeJevJudge(cfg, { env: process.env, fetchFn: fetch, onCost });
4789
+ }
4790
+ }
4657
4791
  };
4658
4792
  }
4659
4793
  function persist(result, baseDir) {
package/dist/mcp-http.cjs CHANGED
@@ -730,13 +730,13 @@ function pluneTool(name) {
730
730
  function isPluneToolName(name) {
731
731
  return BY_NAME.has(name);
732
732
  }
733
- function offeredTo(tool, scope) {
734
- if (scope !== "read") return true;
735
- if (tool.write) return false;
736
- return tool.name !== "plune_discover_tools" || PLUNE_TOOLS.some((t) => t.visibility !== "core" && !t.write);
733
+ function offeredTo(tool, scope, disabled = []) {
734
+ const refused = (t) => disabled.includes(t.name) || scope === "read" && t.write;
735
+ if (refused(tool)) return false;
736
+ return tool.name !== "plune_discover_tools" || PLUNE_TOOLS.some((t) => t.visibility !== "core" && !refused(t));
737
737
  }
738
- function defaultVisibleTools(scope) {
739
- return PLUNE_TOOLS.filter((t) => t.visibility === "core" && offeredTo(t, scope)).map((t) => t.name);
738
+ function defaultVisibleTools(scope, disabled = []) {
739
+ return PLUNE_TOOLS.filter((t) => t.visibility === "core" && offeredTo(t, scope, disabled)).map((t) => t.name);
740
740
  }
741
741
 
742
742
  // src/mcp-tools/execute.ts
@@ -824,6 +824,7 @@ var CONFIRM_TTL_MS = 5 * 60 * 1e3;
824
824
  var READ_ONLY_REFUSAL = "read-only token";
825
825
  var NO_PROJECT = "projectId is needed: the server was started without a project (--project or PLUNE_PROJECT). plune_project_context lists the projects.";
826
826
  var readScopeMessage = (what) => `This token has the read scope, so ${what}. Use a token with the write scope (Plune \u2192 Account \u2192 API tokens) and restart the server.`;
827
+ var switchedOffMessage = (name) => `\`${name}\` is switched off for this connection. Ask the person who connected Plune to switch it on.`;
827
828
  var fail = (code, message, extra = {}) => ({
828
829
  ok: false,
829
830
  error: { code, message, ...extra }
@@ -880,11 +881,12 @@ function createPluneToolExecutor(opts) {
880
881
  const now = opts.now ?? Date.now;
881
882
  const request = createPluneApi({ ...opts, sessionId });
882
883
  let scope = opts.scope;
884
+ const disabled = opts.disabledTools ?? [];
883
885
  const revealed = /* @__PURE__ */ new Set();
884
886
  const confirms = /* @__PURE__ */ new Map();
885
887
  const visibleTools = () => {
886
- const core = defaultVisibleTools(scope);
887
- const extra = [...revealed].filter((n) => !(scope === "read" && pluneTool(n).write) && !core.includes(n));
888
+ const core = defaultVisibleTools(scope, disabled);
889
+ const extra = [...revealed].filter((n) => !disabled.includes(n) && !(scope === "read" && pluneTool(n).write) && !core.includes(n));
888
890
  return [...core, ...extra];
889
891
  };
890
892
  async function call(req) {
@@ -1084,13 +1086,15 @@ function createPluneToolExecutor(opts) {
1084
1086
  const names = i["names"] ?? [];
1085
1087
  const unknown = names.filter((n) => !isPluneToolName(n));
1086
1088
  if (unknown.length > 0) return fail("invalid_input", `No such tool: ${unknown.join(", ")}. Call this tool without names to see what there is.`);
1089
+ const off = names.filter((n) => disabled.includes(n));
1090
+ if (off.length > 0) return fail("tool_disabled", off.map(switchedOffMessage).join(" "));
1087
1091
  const refused = names.filter((n) => scope === "read" && pluneTool(n).write);
1088
1092
  if (refused.length > 0) return fail("read_only_token", readScopeMessage(`${refused.join(", ")} cannot be switched on`));
1089
1093
  const fixed = opts.fixedToolList === true;
1090
1094
  if (!fixed) for (const n of names) revealed.add(n);
1091
1095
  const words = (i["query"] ?? "").toLowerCase().split(/\s+/).filter(Boolean);
1092
1096
  const visible = visibleTools();
1093
- const available = PLUNE_TOOLS.filter((t) => !visible.includes(t.name) && !(scope === "read" && t.write)).filter((t) => words.every((w) => `${t.name} ${t.title} ${t.description}`.toLowerCase().includes(w))).map((t) => ({
1097
+ const available = PLUNE_TOOLS.filter((t) => !visible.includes(t.name) && !disabled.includes(t.name) && !(scope === "read" && t.write)).filter((t) => words.every((w) => `${t.name} ${t.title} ${t.description}`.toLowerCase().includes(w))).map((t) => ({
1094
1098
  name: t.name,
1095
1099
  title: t.title,
1096
1100
  description: t.description,
@@ -1174,6 +1178,7 @@ function createPluneToolExecutor(opts) {
1174
1178
  async execute(name, input) {
1175
1179
  const handler = isPluneToolName(name) ? handlers[name] : void 0;
1176
1180
  if (handler === void 0) return fail("unknown_tool", `No such tool: ${name}.`);
1181
+ if (disabled.includes(name)) return fail("tool_disabled", switchedOffMessage(name));
1177
1182
  const tool = pluneTool(name);
1178
1183
  const parsed = tool.input.safeParse(input ?? {});
1179
1184
  if (!parsed.success) return fail("invalid_input", `The input does not fit: ${zodMessage(parsed.error)}`);
@@ -1243,12 +1248,16 @@ function createPluneMcpServer(opts, era, traits = {}) {
1243
1248
  else if (!visible.has(name) && tool.enabled) tool.disable();
1244
1249
  }
1245
1250
  };
1246
- let refusesWriters = false;
1251
+ const disabled = opts.disabledTools ?? [];
1252
+ let refusesByName = false;
1247
1253
  for (const tool of PLUNE_TOOLS) {
1248
- if (!offeredTo(tool, opts.scope)) {
1249
- if (tool.write) {
1254
+ if (!offeredTo(tool, opts.scope, disabled)) {
1255
+ if (disabled.includes(tool.name)) {
1256
+ server.registerTool(tool.name, { description: tool.description }, async () => toResult(await executor.execute(tool.name, {})));
1257
+ refusesByName = true;
1258
+ } else if (tool.write) {
1250
1259
  server.registerTool(tool.name, { description: tool.description }, () => toResult(readOnlyRefusal(tool.name)));
1251
- refusesWriters = true;
1260
+ refusesByName = true;
1252
1261
  }
1253
1262
  continue;
1254
1263
  }
@@ -1270,11 +1279,11 @@ function createPluneMcpServer(opts, era, traits = {}) {
1270
1279
  registered.set(tool.name, handle);
1271
1280
  }
1272
1281
  if (fixed) {
1273
- const tools = PLUNE_TOOLS.filter((t) => defaultVisibleTools(opts.scope).includes(t.name)).map(listed);
1282
+ const tools = PLUNE_TOOLS.filter((t) => defaultVisibleTools(opts.scope, disabled).includes(t.name)).map(listed);
1274
1283
  server.server.setRequestHandler("tools/list", () => ({ tools }));
1275
1284
  } else {
1276
1285
  sync();
1277
- if (refusesWriters)
1286
+ if (refusesByName)
1278
1287
  server.server.setRequestHandler("tools/list", () => ({
1279
1288
  tools: PLUNE_TOOLS.filter((t) => registered.get(t.name)?.enabled === true).map(listed)
1280
1289
  }));
@@ -1,4 +1,4 @@
1
- import { d as PluneToolExecutorOptions } from './execute-CR3Ixbxj.cjs';
1
+ import { d as PluneToolExecutorOptions } from './execute-DLNnhkEM.cjs';
2
2
  import 'zod';
3
3
 
4
4
  /**
@@ -11,7 +11,8 @@ import 'zod';
11
11
  * served by the SDK's stateless fallback, a 2026-07-28 one natively.
12
12
  *
13
13
  * The handler verifies nothing about the caller. The host does, and names the caller with every request: the API
14
- * address, the token (or its own `fetchImpl`) and the scope. Origin and Host checks belong in front of it too.
14
+ * address, the token (or its own `fetchImpl`), the scope and the tools switched off (`disabledTools`). Origin and Host
15
+ * checks belong in front of it too.
15
16
  */
16
17
  interface PluneMcpHttpOptions {
17
18
  /** The server version announced to clients. */
@@ -1,4 +1,4 @@
1
- import { d as PluneToolExecutorOptions } from './execute-CR3Ixbxj.js';
1
+ import { d as PluneToolExecutorOptions } from './execute-DLNnhkEM.js';
2
2
  import 'zod';
3
3
 
4
4
  /**
@@ -11,7 +11,8 @@ import 'zod';
11
11
  * served by the SDK's stateless fallback, a 2026-07-28 one natively.
12
12
  *
13
13
  * The handler verifies nothing about the caller. The host does, and names the caller with every request: the API
14
- * address, the token (or its own `fetchImpl`) and the scope. Origin and Host checks belong in front of it too.
14
+ * address, the token (or its own `fetchImpl`), the scope and the tools switched off (`disabledTools`). Origin and Host
15
+ * checks belong in front of it too.
15
16
  */
16
17
  interface PluneMcpHttpOptions {
17
18
  /** The server version announced to clients. */
package/dist/mcp-http.js CHANGED
@@ -706,13 +706,13 @@ function pluneTool(name) {
706
706
  function isPluneToolName(name) {
707
707
  return BY_NAME.has(name);
708
708
  }
709
- function offeredTo(tool, scope) {
710
- if (scope !== "read") return true;
711
- if (tool.write) return false;
712
- return tool.name !== "plune_discover_tools" || PLUNE_TOOLS.some((t) => t.visibility !== "core" && !t.write);
709
+ function offeredTo(tool, scope, disabled = []) {
710
+ const refused = (t) => disabled.includes(t.name) || scope === "read" && t.write;
711
+ if (refused(tool)) return false;
712
+ return tool.name !== "plune_discover_tools" || PLUNE_TOOLS.some((t) => t.visibility !== "core" && !refused(t));
713
713
  }
714
- function defaultVisibleTools(scope) {
715
- return PLUNE_TOOLS.filter((t) => t.visibility === "core" && offeredTo(t, scope)).map((t) => t.name);
714
+ function defaultVisibleTools(scope, disabled = []) {
715
+ return PLUNE_TOOLS.filter((t) => t.visibility === "core" && offeredTo(t, scope, disabled)).map((t) => t.name);
716
716
  }
717
717
 
718
718
  // src/mcp-tools/execute.ts
@@ -800,6 +800,7 @@ var CONFIRM_TTL_MS = 5 * 60 * 1e3;
800
800
  var READ_ONLY_REFUSAL = "read-only token";
801
801
  var NO_PROJECT = "projectId is needed: the server was started without a project (--project or PLUNE_PROJECT). plune_project_context lists the projects.";
802
802
  var readScopeMessage = (what) => `This token has the read scope, so ${what}. Use a token with the write scope (Plune \u2192 Account \u2192 API tokens) and restart the server.`;
803
+ var switchedOffMessage = (name) => `\`${name}\` is switched off for this connection. Ask the person who connected Plune to switch it on.`;
803
804
  var fail = (code, message, extra = {}) => ({
804
805
  ok: false,
805
806
  error: { code, message, ...extra }
@@ -856,11 +857,12 @@ function createPluneToolExecutor(opts) {
856
857
  const now = opts.now ?? Date.now;
857
858
  const request = createPluneApi({ ...opts, sessionId });
858
859
  let scope = opts.scope;
860
+ const disabled = opts.disabledTools ?? [];
859
861
  const revealed = /* @__PURE__ */ new Set();
860
862
  const confirms = /* @__PURE__ */ new Map();
861
863
  const visibleTools = () => {
862
- const core = defaultVisibleTools(scope);
863
- const extra = [...revealed].filter((n) => !(scope === "read" && pluneTool(n).write) && !core.includes(n));
864
+ const core = defaultVisibleTools(scope, disabled);
865
+ const extra = [...revealed].filter((n) => !disabled.includes(n) && !(scope === "read" && pluneTool(n).write) && !core.includes(n));
864
866
  return [...core, ...extra];
865
867
  };
866
868
  async function call(req) {
@@ -1060,13 +1062,15 @@ function createPluneToolExecutor(opts) {
1060
1062
  const names = i["names"] ?? [];
1061
1063
  const unknown = names.filter((n) => !isPluneToolName(n));
1062
1064
  if (unknown.length > 0) return fail("invalid_input", `No such tool: ${unknown.join(", ")}. Call this tool without names to see what there is.`);
1065
+ const off = names.filter((n) => disabled.includes(n));
1066
+ if (off.length > 0) return fail("tool_disabled", off.map(switchedOffMessage).join(" "));
1063
1067
  const refused = names.filter((n) => scope === "read" && pluneTool(n).write);
1064
1068
  if (refused.length > 0) return fail("read_only_token", readScopeMessage(`${refused.join(", ")} cannot be switched on`));
1065
1069
  const fixed = opts.fixedToolList === true;
1066
1070
  if (!fixed) for (const n of names) revealed.add(n);
1067
1071
  const words = (i["query"] ?? "").toLowerCase().split(/\s+/).filter(Boolean);
1068
1072
  const visible = visibleTools();
1069
- const available = PLUNE_TOOLS.filter((t) => !visible.includes(t.name) && !(scope === "read" && t.write)).filter((t) => words.every((w) => `${t.name} ${t.title} ${t.description}`.toLowerCase().includes(w))).map((t) => ({
1073
+ const available = PLUNE_TOOLS.filter((t) => !visible.includes(t.name) && !disabled.includes(t.name) && !(scope === "read" && t.write)).filter((t) => words.every((w) => `${t.name} ${t.title} ${t.description}`.toLowerCase().includes(w))).map((t) => ({
1070
1074
  name: t.name,
1071
1075
  title: t.title,
1072
1076
  description: t.description,
@@ -1150,6 +1154,7 @@ function createPluneToolExecutor(opts) {
1150
1154
  async execute(name, input) {
1151
1155
  const handler = isPluneToolName(name) ? handlers[name] : void 0;
1152
1156
  if (handler === void 0) return fail("unknown_tool", `No such tool: ${name}.`);
1157
+ if (disabled.includes(name)) return fail("tool_disabled", switchedOffMessage(name));
1153
1158
  const tool = pluneTool(name);
1154
1159
  const parsed = tool.input.safeParse(input ?? {});
1155
1160
  if (!parsed.success) return fail("invalid_input", `The input does not fit: ${zodMessage(parsed.error)}`);
@@ -1219,12 +1224,16 @@ function createPluneMcpServer(opts, era, traits = {}) {
1219
1224
  else if (!visible.has(name) && tool.enabled) tool.disable();
1220
1225
  }
1221
1226
  };
1222
- let refusesWriters = false;
1227
+ const disabled = opts.disabledTools ?? [];
1228
+ let refusesByName = false;
1223
1229
  for (const tool of PLUNE_TOOLS) {
1224
- if (!offeredTo(tool, opts.scope)) {
1225
- if (tool.write) {
1230
+ if (!offeredTo(tool, opts.scope, disabled)) {
1231
+ if (disabled.includes(tool.name)) {
1232
+ server.registerTool(tool.name, { description: tool.description }, async () => toResult(await executor.execute(tool.name, {})));
1233
+ refusesByName = true;
1234
+ } else if (tool.write) {
1226
1235
  server.registerTool(tool.name, { description: tool.description }, () => toResult(readOnlyRefusal(tool.name)));
1227
- refusesWriters = true;
1236
+ refusesByName = true;
1228
1237
  }
1229
1238
  continue;
1230
1239
  }
@@ -1246,11 +1255,11 @@ function createPluneMcpServer(opts, era, traits = {}) {
1246
1255
  registered.set(tool.name, handle);
1247
1256
  }
1248
1257
  if (fixed) {
1249
- const tools = PLUNE_TOOLS.filter((t) => defaultVisibleTools(opts.scope).includes(t.name)).map(listed);
1258
+ const tools = PLUNE_TOOLS.filter((t) => defaultVisibleTools(opts.scope, disabled).includes(t.name)).map(listed);
1250
1259
  server.server.setRequestHandler("tools/list", () => ({ tools }));
1251
1260
  } else {
1252
1261
  sync();
1253
- if (refusesWriters)
1262
+ if (refusesByName)
1254
1263
  server.server.setRequestHandler("tools/list", () => ({
1255
1264
  tools: PLUNE_TOOLS.filter((t) => registered.get(t.name)?.enabled === true).map(listed)
1256
1265
  }));
@@ -732,13 +732,13 @@ function pluneTool(name) {
732
732
  function isPluneToolName(name) {
733
733
  return BY_NAME.has(name);
734
734
  }
735
- function offeredTo(tool, scope) {
736
- if (scope !== "read") return true;
737
- if (tool.write) return false;
738
- return tool.name !== "plune_discover_tools" || PLUNE_TOOLS.some((t) => t.visibility !== "core" && !t.write);
735
+ function offeredTo(tool, scope, disabled = []) {
736
+ const refused = (t) => disabled.includes(t.name) || scope === "read" && t.write;
737
+ if (refused(tool)) return false;
738
+ return tool.name !== "plune_discover_tools" || PLUNE_TOOLS.some((t) => t.visibility !== "core" && !refused(t));
739
739
  }
740
- function defaultVisibleTools(scope) {
741
- return PLUNE_TOOLS.filter((t) => t.visibility === "core" && offeredTo(t, scope)).map((t) => t.name);
740
+ function defaultVisibleTools(scope, disabled = []) {
741
+ return PLUNE_TOOLS.filter((t) => t.visibility === "core" && offeredTo(t, scope, disabled)).map((t) => t.name);
742
742
  }
743
743
 
744
744
  // src/mcp-tools/execute.ts
@@ -826,6 +826,7 @@ var CONFIRM_TTL_MS = 5 * 60 * 1e3;
826
826
  var READ_ONLY_REFUSAL = "read-only token";
827
827
  var NO_PROJECT = "projectId is needed: the server was started without a project (--project or PLUNE_PROJECT). plune_project_context lists the projects.";
828
828
  var readScopeMessage = (what) => `This token has the read scope, so ${what}. Use a token with the write scope (Plune \u2192 Account \u2192 API tokens) and restart the server.`;
829
+ var switchedOffMessage = (name) => `\`${name}\` is switched off for this connection. Ask the person who connected Plune to switch it on.`;
829
830
  var fail = (code, message, extra = {}) => ({
830
831
  ok: false,
831
832
  error: { code, message, ...extra }
@@ -882,11 +883,12 @@ function createPluneToolExecutor(opts) {
882
883
  const now = opts.now ?? Date.now;
883
884
  const request = createPluneApi({ ...opts, sessionId });
884
885
  let scope = opts.scope;
886
+ const disabled = opts.disabledTools ?? [];
885
887
  const revealed = /* @__PURE__ */ new Set();
886
888
  const confirms = /* @__PURE__ */ new Map();
887
889
  const visibleTools = () => {
888
- const core = defaultVisibleTools(scope);
889
- const extra = [...revealed].filter((n) => !(scope === "read" && pluneTool(n).write) && !core.includes(n));
890
+ const core = defaultVisibleTools(scope, disabled);
891
+ const extra = [...revealed].filter((n) => !disabled.includes(n) && !(scope === "read" && pluneTool(n).write) && !core.includes(n));
890
892
  return [...core, ...extra];
891
893
  };
892
894
  async function call(req) {
@@ -1086,13 +1088,15 @@ function createPluneToolExecutor(opts) {
1086
1088
  const names = i["names"] ?? [];
1087
1089
  const unknown = names.filter((n) => !isPluneToolName(n));
1088
1090
  if (unknown.length > 0) return fail("invalid_input", `No such tool: ${unknown.join(", ")}. Call this tool without names to see what there is.`);
1091
+ const off = names.filter((n) => disabled.includes(n));
1092
+ if (off.length > 0) return fail("tool_disabled", off.map(switchedOffMessage).join(" "));
1089
1093
  const refused = names.filter((n) => scope === "read" && pluneTool(n).write);
1090
1094
  if (refused.length > 0) return fail("read_only_token", readScopeMessage(`${refused.join(", ")} cannot be switched on`));
1091
1095
  const fixed = opts.fixedToolList === true;
1092
1096
  if (!fixed) for (const n of names) revealed.add(n);
1093
1097
  const words = (i["query"] ?? "").toLowerCase().split(/\s+/).filter(Boolean);
1094
1098
  const visible = visibleTools();
1095
- const available = PLUNE_TOOLS.filter((t) => !visible.includes(t.name) && !(scope === "read" && t.write)).filter((t) => words.every((w) => `${t.name} ${t.title} ${t.description}`.toLowerCase().includes(w))).map((t) => ({
1099
+ const available = PLUNE_TOOLS.filter((t) => !visible.includes(t.name) && !disabled.includes(t.name) && !(scope === "read" && t.write)).filter((t) => words.every((w) => `${t.name} ${t.title} ${t.description}`.toLowerCase().includes(w))).map((t) => ({
1096
1100
  name: t.name,
1097
1101
  title: t.title,
1098
1102
  description: t.description,
@@ -1176,6 +1180,7 @@ function createPluneToolExecutor(opts) {
1176
1180
  async execute(name, input) {
1177
1181
  const handler = isPluneToolName(name) ? handlers[name] : void 0;
1178
1182
  if (handler === void 0) return fail("unknown_tool", `No such tool: ${name}.`);
1183
+ if (disabled.includes(name)) return fail("tool_disabled", switchedOffMessage(name));
1179
1184
  const tool = pluneTool(name);
1180
1185
  const parsed = tool.input.safeParse(input ?? {});
1181
1186
  if (!parsed.success) return fail("invalid_input", `The input does not fit: ${zodMessage(parsed.error)}`);
@@ -1,4 +1,4 @@
1
- export { C as CONFIRM_TTL_MS, M as MAX_VISIBLE_TOOLS, P as PLUNE_TOOLS, a as PLUNE_TOOL_NAMES, b as PluneToolDefinition, c as PluneToolExecutor, d as PluneToolExecutorOptions, e as PluneToolName, T as TokenScope, f as ToolError, g as ToolOutcome, h as ToolVisibility, i as createPluneToolExecutor, j as defaultVisibleTools, k as isPluneToolName, o as offeredTo, p as pluneTool } from './execute-CR3Ixbxj.cjs';
1
+ export { C as CONFIRM_TTL_MS, M as MAX_VISIBLE_TOOLS, P as PLUNE_TOOLS, a as PLUNE_TOOL_NAMES, b as PluneToolDefinition, c as PluneToolExecutor, d as PluneToolExecutorOptions, e as PluneToolName, T as TokenScope, f as ToolError, g as ToolOutcome, h as ToolVisibility, i as createPluneToolExecutor, j as defaultVisibleTools, k as isPluneToolName, o as offeredTo, p as pluneTool } from './execute-DLNnhkEM.cjs';
2
2
  import 'zod';
3
3
 
4
4
  /** The platform answered, with a status outside 2xx. */
@@ -1,4 +1,4 @@
1
- export { C as CONFIRM_TTL_MS, M as MAX_VISIBLE_TOOLS, P as PLUNE_TOOLS, a as PLUNE_TOOL_NAMES, b as PluneToolDefinition, c as PluneToolExecutor, d as PluneToolExecutorOptions, e as PluneToolName, T as TokenScope, f as ToolError, g as ToolOutcome, h as ToolVisibility, i as createPluneToolExecutor, j as defaultVisibleTools, k as isPluneToolName, o as offeredTo, p as pluneTool } from './execute-CR3Ixbxj.js';
1
+ export { C as CONFIRM_TTL_MS, M as MAX_VISIBLE_TOOLS, P as PLUNE_TOOLS, a as PLUNE_TOOL_NAMES, b as PluneToolDefinition, c as PluneToolExecutor, d as PluneToolExecutorOptions, e as PluneToolName, T as TokenScope, f as ToolError, g as ToolOutcome, h as ToolVisibility, i as createPluneToolExecutor, j as defaultVisibleTools, k as isPluneToolName, o as offeredTo, p as pluneTool } from './execute-DLNnhkEM.js';
2
2
  import 'zod';
3
3
 
4
4
  /** The platform answered, with a status outside 2xx. */
package/dist/mcp-tools.js CHANGED
@@ -695,13 +695,13 @@ function pluneTool(name) {
695
695
  function isPluneToolName(name) {
696
696
  return BY_NAME.has(name);
697
697
  }
698
- function offeredTo(tool, scope) {
699
- if (scope !== "read") return true;
700
- if (tool.write) return false;
701
- return tool.name !== "plune_discover_tools" || PLUNE_TOOLS.some((t) => t.visibility !== "core" && !t.write);
698
+ function offeredTo(tool, scope, disabled = []) {
699
+ const refused = (t) => disabled.includes(t.name) || scope === "read" && t.write;
700
+ if (refused(tool)) return false;
701
+ return tool.name !== "plune_discover_tools" || PLUNE_TOOLS.some((t) => t.visibility !== "core" && !refused(t));
702
702
  }
703
- function defaultVisibleTools(scope) {
704
- return PLUNE_TOOLS.filter((t) => t.visibility === "core" && offeredTo(t, scope)).map((t) => t.name);
703
+ function defaultVisibleTools(scope, disabled = []) {
704
+ return PLUNE_TOOLS.filter((t) => t.visibility === "core" && offeredTo(t, scope, disabled)).map((t) => t.name);
705
705
  }
706
706
 
707
707
  // src/mcp-tools/execute.ts
@@ -789,6 +789,7 @@ var CONFIRM_TTL_MS = 5 * 60 * 1e3;
789
789
  var READ_ONLY_REFUSAL = "read-only token";
790
790
  var NO_PROJECT = "projectId is needed: the server was started without a project (--project or PLUNE_PROJECT). plune_project_context lists the projects.";
791
791
  var readScopeMessage = (what) => `This token has the read scope, so ${what}. Use a token with the write scope (Plune \u2192 Account \u2192 API tokens) and restart the server.`;
792
+ var switchedOffMessage = (name) => `\`${name}\` is switched off for this connection. Ask the person who connected Plune to switch it on.`;
792
793
  var fail = (code, message, extra = {}) => ({
793
794
  ok: false,
794
795
  error: { code, message, ...extra }
@@ -845,11 +846,12 @@ function createPluneToolExecutor(opts) {
845
846
  const now = opts.now ?? Date.now;
846
847
  const request = createPluneApi({ ...opts, sessionId });
847
848
  let scope = opts.scope;
849
+ const disabled = opts.disabledTools ?? [];
848
850
  const revealed = /* @__PURE__ */ new Set();
849
851
  const confirms = /* @__PURE__ */ new Map();
850
852
  const visibleTools = () => {
851
- const core = defaultVisibleTools(scope);
852
- const extra = [...revealed].filter((n) => !(scope === "read" && pluneTool(n).write) && !core.includes(n));
853
+ const core = defaultVisibleTools(scope, disabled);
854
+ const extra = [...revealed].filter((n) => !disabled.includes(n) && !(scope === "read" && pluneTool(n).write) && !core.includes(n));
853
855
  return [...core, ...extra];
854
856
  };
855
857
  async function call(req) {
@@ -1049,13 +1051,15 @@ function createPluneToolExecutor(opts) {
1049
1051
  const names = i["names"] ?? [];
1050
1052
  const unknown = names.filter((n) => !isPluneToolName(n));
1051
1053
  if (unknown.length > 0) return fail("invalid_input", `No such tool: ${unknown.join(", ")}. Call this tool without names to see what there is.`);
1054
+ const off = names.filter((n) => disabled.includes(n));
1055
+ if (off.length > 0) return fail("tool_disabled", off.map(switchedOffMessage).join(" "));
1052
1056
  const refused = names.filter((n) => scope === "read" && pluneTool(n).write);
1053
1057
  if (refused.length > 0) return fail("read_only_token", readScopeMessage(`${refused.join(", ")} cannot be switched on`));
1054
1058
  const fixed = opts.fixedToolList === true;
1055
1059
  if (!fixed) for (const n of names) revealed.add(n);
1056
1060
  const words = (i["query"] ?? "").toLowerCase().split(/\s+/).filter(Boolean);
1057
1061
  const visible = visibleTools();
1058
- const available = PLUNE_TOOLS.filter((t) => !visible.includes(t.name) && !(scope === "read" && t.write)).filter((t) => words.every((w) => `${t.name} ${t.title} ${t.description}`.toLowerCase().includes(w))).map((t) => ({
1062
+ const available = PLUNE_TOOLS.filter((t) => !visible.includes(t.name) && !disabled.includes(t.name) && !(scope === "read" && t.write)).filter((t) => words.every((w) => `${t.name} ${t.title} ${t.description}`.toLowerCase().includes(w))).map((t) => ({
1059
1063
  name: t.name,
1060
1064
  title: t.title,
1061
1065
  description: t.description,
@@ -1139,6 +1143,7 @@ function createPluneToolExecutor(opts) {
1139
1143
  async execute(name, input) {
1140
1144
  const handler = isPluneToolName(name) ? handlers[name] : void 0;
1141
1145
  if (handler === void 0) return fail("unknown_tool", `No such tool: ${name}.`);
1146
+ if (disabled.includes(name)) return fail("tool_disabled", switchedOffMessage(name));
1142
1147
  const tool = pluneTool(name);
1143
1148
  const parsed = tool.input.safeParse(input ?? {});
1144
1149
  if (!parsed.success) return fail("invalid_input", `The input does not fit: ${zodMessage(parsed.error)}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plune-ai/cli",
3
- "version": "0.39.13",
3
+ "version": "0.39.15",
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": [