oc-pilot 0.117.0 → 0.119.0

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/mcp.js CHANGED
@@ -1641,6 +1641,33 @@ const TOOLS = [
1641
1641
  },
1642
1642
  },
1643
1643
  },
1644
+ {
1645
+ name: "flight_stats",
1646
+ description: "Aggregate stats across flight sessions: total, active and ended sessions, events, commands, checkpoints, failed commands, duration and top commands.",
1647
+ annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
1648
+ inputSchema: {
1649
+ type: "object",
1650
+ additionalProperties: false,
1651
+ properties: {
1652
+ ...RESULT_PROPERTIES,
1653
+ },
1654
+ },
1655
+ },
1656
+ {
1657
+ name: "flight_prune",
1658
+ description: "Delete old ended flight sessions while keeping the active flight and the newest N sessions. Needs --allow-write.",
1659
+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false },
1660
+ inputSchema: {
1661
+ type: "object",
1662
+ additionalProperties: false,
1663
+ properties: {
1664
+ keep: { type: "integer", minimum: 0, description: "How many newest ended flights to keep; default 20" },
1665
+ older_than_days: { type: "integer", minimum: 0, description: "Only remove flights older than this many days" },
1666
+ dry_run: { type: "boolean", description: "Report what would be removed without deleting" },
1667
+ ...RESULT_PROPERTIES,
1668
+ },
1669
+ },
1670
+ },
1644
1671
  {
1645
1672
  name: "flight_export",
1646
1673
  description: "Export a redacted flight bundle with journal, checkpoint patches and a sha256 digest. Needs --allow-write when output is set.",
@@ -4461,6 +4488,21 @@ async function callFlightHtml(input, cwd) {
4461
4488
  args.push("--id", id);
4462
4489
  return toToolResult(await runCli(args, cwd));
4463
4490
  }
4491
+ async function callFlightStats(_input, cwd) {
4492
+ return toToolResult(await runCli(["flight", "stats", "--json"], cwd));
4493
+ }
4494
+ async function callFlightPrune(input, cwd) {
4495
+ const args = ["flight", "prune", "--json"];
4496
+ const keep = integerArg(input, "keep");
4497
+ if (keep !== undefined)
4498
+ args.push("--keep", String(keep));
4499
+ const olderThanDays = integerArg(input, "older_than_days");
4500
+ if (olderThanDays !== undefined)
4501
+ args.push("--older-than", String(olderThanDays));
4502
+ if (booleanArg(input, "dry_run"))
4503
+ args.push("--dry-run");
4504
+ return toToolResult(await runCli(args, cwd));
4505
+ }
4464
4506
  async function callFlightExport(input, cwd) {
4465
4507
  const args = ["flight", "export", "--json"];
4466
4508
  const id = stringArg(input, "id");
@@ -4863,7 +4905,7 @@ async function dispatchTool(name, input, cwd, readOnly) {
4863
4905
  throw new ToolInputError("scan_injection fix writes files and is disabled in read-only mode; start the MCP server with --allow-write");
4864
4906
  }
4865
4907
  if (name.startsWith("flight_") &&
4866
- ["flight_start", "flight_exec", "flight_checkpoint", "flight_end", "flight_replay", "flight_bisect", "flight_export"].includes(name)) {
4908
+ ["flight_start", "flight_exec", "flight_checkpoint", "flight_end", "flight_replay", "flight_bisect", "flight_prune", "flight_export"].includes(name)) {
4867
4909
  throw new ToolInputError("flight write actions are disabled in read-only mode; start the MCP server with --allow-write");
4868
4910
  }
4869
4911
  }
@@ -5018,6 +5060,10 @@ async function dispatchTool(name, input, cwd, readOnly) {
5018
5060
  return callFlightCompare(input, cwd);
5019
5061
  case "flight_html":
5020
5062
  return callFlightHtml(input, cwd);
5063
+ case "flight_stats":
5064
+ return callFlightStats(input, cwd);
5065
+ case "flight_prune":
5066
+ return callFlightPrune(input, cwd);
5021
5067
  case "flight_export":
5022
5068
  return callFlightExport(input, cwd);
5023
5069
  case "beacon":
@@ -5155,6 +5201,12 @@ function summarizeResult(value) {
5155
5201
  const to = value.to;
5156
5202
  return `oc-pilot: flight diff ${typeof from.label === "string" ? from.label : "?"}..${typeof to.label === "string" ? to.label : "?"}`;
5157
5203
  }
5204
+ if (Array.isArray(value.removed) && typeof value.kept === "number" && typeof value.dryRun === "boolean") {
5205
+ return `oc-pilot: flight prune removed ${String(value.removed.length)}, kept ${String(value.kept)}`;
5206
+ }
5207
+ if (typeof value.total === "number" && Array.isArray(value.topCommands)) {
5208
+ return `oc-pilot: flight stats ${String(value.total)} session(s), ${String(value.commands ?? 0)} command(s), ${String(value.failedCommands ?? 0)} failed`;
5209
+ }
5158
5210
  if (typeof value.id === "string" && typeof value.html === "string") {
5159
5211
  return `oc-pilot: flight html ${value.id} (${String(value.html.length)} chars)`;
5160
5212
  }