@rzx/ohs 1.0.4 → 1.0.6

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.
@@ -1009,6 +1009,15 @@ class OpenHarnessClient {
1009
1009
  const response = await this.request(this.path("/context/status", query), { signal });
1010
1010
  return response.report;
1011
1011
  }
1012
+ async getContextUsage(options) {
1013
+ const { signal, refresh, previousContextWindow, ...rest } = options;
1014
+ const query = {
1015
+ ...rest,
1016
+ ...refresh !== undefined ? { refresh: refresh ? "true" : "false" } : {},
1017
+ ...previousContextWindow !== undefined ? { previousContextWindow: String(previousContextWindow) } : {}
1018
+ };
1019
+ return await this.request(this.path("/context/usage", query), { signal });
1020
+ }
1012
1021
  async compactSession(sessionId, options = {}) {
1013
1022
  return await this.request(`/sessions/${encodeURIComponent(sessionId)}/compact`, { method: "POST", signal: options.signal });
1014
1023
  }
@@ -2477,8 +2486,18 @@ No entries found.`;
2477
2486
  await readPresentation(`context:${cwd}:status`, "Context", async () => await client.getContextStatus({ cwd }));
2478
2487
  return "handled";
2479
2488
  }
2489
+ if (action === "usage") {
2490
+ await readPresentation(`context:${cwd}:usage:${sessionId ?? "none"}`, "Context", async () => {
2491
+ const result = await client.getContextUsage({
2492
+ cwd,
2493
+ ...sessionId ? { sessionId } : {}
2494
+ });
2495
+ return result.report;
2496
+ });
2497
+ return "handled";
2498
+ }
2480
2499
  if (action !== "preview") {
2481
- emit("Usage: /context [status]");
2500
+ emit("Usage: /context [preview|status|usage]");
2482
2501
  return "handled";
2483
2502
  }
2484
2503
  await readPresentation(`context:${cwd}`, "Context", async () => await client.getContextPreview({ cwd }));
@@ -8037,4 +8056,4 @@ try {
8037
8056
  process.exit(1);
8038
8057
  }
8039
8058
 
8040
- //# debugId=BAFB208A6EB2D30564756E2164756E21
8059
+ //# debugId=5DBCBBC40135AE2E64756E2164756E21