@howaboua/opencode-usage-plugin 0.0.1 → 0.0.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.
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Hooks for proxy-limits functionality.
3
- * Manages silent responses after tool execution.
2
+ * Hooks for usage status display.
3
+ * Manages silent responses after command execution if needed.
4
4
  */
5
5
  export declare function markSilent(sessionID: string, messageID: string): void;
6
6
  export declare function proxyHooks(): {
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Hooks for proxy-limits functionality.
3
- * Manages silent responses after tool execution.
2
+ * Hooks for usage status display.
3
+ * Manages silent responses after command execution if needed.
4
4
  */
5
5
  const silence = new Map();
6
6
  export function markSilent(sessionID, messageID) {
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Plugin entry point for Usage Tracking.
3
- * Wires hooks and tools for live usage snapshots.
3
+ * Wires hooks for live usage snapshots.
4
4
  */
5
5
  import type { Plugin } from "@opencode-ai/plugin";
6
6
  export declare const UsagePlugin: Plugin;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAOjD,eAAO,MAAM,WAAW,EAAE,MA+CzB,CAAA;AAED,eAAe,WAAW,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAMjD,eAAO,MAAM,WAAW,EAAE,MA2CzB,CAAA;AAED,eAAe,WAAW,CAAA"}
package/dist/index.js CHANGED
@@ -1,10 +1,9 @@
1
1
  /**
2
2
  * Plugin entry point for Usage Tracking.
3
- * Wires hooks and tools for live usage snapshots.
3
+ * Wires hooks for live usage snapshots.
4
4
  */
5
- import { commandHooks, sessionHooks, proxyHooks, markSilent } from "./hooks";
5
+ import { commandHooks, sessionHooks, proxyHooks } from "./hooks";
6
6
  import { createUsageState } from "./state";
7
- import { usageTool, createProxyLimitsTool } from "./tools";
8
7
  import { loadAuths } from "./usage/fetch";
9
8
  import { loadProxyConfig } from "./providers/proxy/config";
10
9
  export const UsagePlugin = async ({ client }) => {
@@ -44,10 +43,6 @@ export const UsagePlugin = async ({ client }) => {
44
43
  "command.execute.before": commandHookHandlers["command.execute.before"],
45
44
  ...sessionHooks(state),
46
45
  ...proxyHookHandlers,
47
- tool: {
48
- "usage.get": usageTool(),
49
- "proxy-limits": createProxyLimitsTool(sendStatusMessage, markSilent),
50
- },
51
46
  };
52
47
  };
53
48
  export default UsagePlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@howaboua/opencode-usage-plugin",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "OpenCode plugin for tracking AI provider usage, rate limits, and quotas",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,3 +0,0 @@
1
- export { usageTool } from "./usage";
2
- export { createProxyLimitsTool } from "./proxy-limits";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA"}
@@ -1,2 +0,0 @@
1
- export { usageTool } from "./usage";
2
- export { createProxyLimitsTool } from "./proxy-limits";
@@ -1,16 +0,0 @@
1
- /**
2
- * Proxy limits tool for checking quota stats.
3
- */
4
- type SendStatusFn = (sessionID: string, text: string) => Promise<void>;
5
- type MarkSilentFn = (sessionID: string, messageID: string) => void;
6
- export declare function createProxyLimitsTool(sendStatus: SendStatusFn, markSilent: MarkSilentFn): {
7
- description: string;
8
- args: {
9
- refresh: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodBoolean>>;
10
- };
11
- execute(args: {
12
- refresh: boolean;
13
- }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
14
- };
15
- export {};
16
- //# sourceMappingURL=proxy-limits.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"proxy-limits.d.ts","sourceRoot":"","sources":["../../src/tools/proxy-limits.ts"],"names":[],"mappings":"AAAA;;GAEG;AAUH,KAAK,YAAY,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;AACtE,KAAK,YAAY,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAA;AAElE,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY;;;;;;;;EA+BvF"}
@@ -1,33 +0,0 @@
1
- /**
2
- * Proxy limits tool for checking quota stats.
3
- */
4
- import { tool } from "@opencode-ai/plugin";
5
- import { loadProxyConfig, fetchProxyLimits, formatProxyLimits } from "../providers/proxy";
6
- export function createProxyLimitsTool(sendStatus, markSilent) {
7
- return tool({
8
- description: "Check current usage limits from the antigravity proxy server. Displays results as an inline status message.",
9
- args: {
10
- refresh: tool.schema
11
- .boolean()
12
- .optional()
13
- .default(false)
14
- .describe("Force refresh the limits data (default: false)"),
15
- },
16
- async execute(_args, context) {
17
- markSilent(context.sessionID, context.messageID);
18
- try {
19
- const config = await loadProxyConfig();
20
- const data = await fetchProxyLimits(config);
21
- const message = formatProxyLimits(data);
22
- await sendStatus(context.sessionID, message);
23
- return "";
24
- }
25
- catch (error) {
26
- const message = error instanceof Error ? error.message : String(error);
27
- const errorMessage = `Proxy Limits Error\n\n${message}`;
28
- await sendStatus(context.sessionID, errorMessage);
29
- return "";
30
- }
31
- },
32
- });
33
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * Provides a simple tool wrapper for usage info.
3
- * Keeps tool definitions separate from hooks and rendering.
4
- */
5
- export declare const usageTool: () => {
6
- description: string;
7
- args: {};
8
- execute(args: Record<string, never>, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
9
- };
10
- //# sourceMappingURL=usage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../src/tools/usage.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,eAAO,MAAM,SAAS;;;;CAOlB,CAAA"}
@@ -1,12 +0,0 @@
1
- /**
2
- * Provides a simple tool wrapper for usage info.
3
- * Keeps tool definitions separate from hooks and rendering.
4
- */
5
- import { tool } from "@opencode-ai/plugin";
6
- export const usageTool = () => tool({
7
- description: "Get current rate limit snapshots for all providers",
8
- args: {},
9
- async execute() {
10
- return "Run /usage in the chat to see current limits.";
11
- },
12
- });