@rubytech/taskmaster 1.11.0 → 1.11.2

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.
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Agent tool for checking usage and cost data.
3
+ *
4
+ * Wraps the `usage.status` and `usage.cost` gateway methods so the agent can
5
+ * report on token consumption and spend without the user opening the UI.
6
+ */
7
+ import { Type } from "@sinclair/typebox";
8
+ import { stringEnum } from "../schema/typebox.js";
9
+ import { jsonResult, readStringParam } from "./common.js";
10
+ import { callGatewayTool } from "./gateway.js";
11
+ const USAGE_ACTIONS = ["summary", "cost"];
12
+ const UsageReportSchema = Type.Object({
13
+ action: stringEnum(USAGE_ACTIONS, {
14
+ description: '"summary" returns token counts by model/provider. "cost" returns estimated spend by provider over a time period.',
15
+ }),
16
+ days: Type.Optional(Type.Number({
17
+ description: "Number of days to include in the cost report (default 30). Only used with the cost action.",
18
+ })),
19
+ });
20
+ export function createUsageReportTool() {
21
+ return {
22
+ label: "Usage Report",
23
+ name: "usage_report",
24
+ description: "Check token usage and cost data. " +
25
+ '"summary" shows token counts by model/provider. ' +
26
+ '"cost" shows estimated spend over a period (default 30 days). ' +
27
+ "Use the days parameter with cost to change the reporting window.",
28
+ parameters: UsageReportSchema,
29
+ execute: async (_toolCallId, args) => {
30
+ const params = args;
31
+ const action = readStringParam(params, "action", { required: true });
32
+ if (action === "summary") {
33
+ const result = await callGatewayTool("usage.status", {}, {});
34
+ return jsonResult(result);
35
+ }
36
+ if (action === "cost") {
37
+ const days = typeof params.days === "number" && Number.isFinite(params.days)
38
+ ? Math.max(1, Math.floor(params.days))
39
+ : 30;
40
+ const result = await callGatewayTool("usage.cost", {}, { days });
41
+ return jsonResult(result);
42
+ }
43
+ throw new Error(`Unknown action: ${action}`);
44
+ },
45
+ };
46
+ }
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.11.0",
3
- "commit": "24430be4b288d224c6be04aa31910f9cbb2adc1d",
4
- "builtAt": "2026-03-01T11:29:23.837Z"
2
+ "version": "1.11.2",
3
+ "commit": "b1a00a71a1f49bbac68e909e8c6ea2a0d3fd0e8c",
4
+ "builtAt": "2026-03-01T17:38:44.602Z"
5
5
  }