@kolisachint/hoocode-agent 0.5.29 → 0.5.30

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.
@@ -22,6 +22,7 @@ import { FooterDataProvider } from "../../core/footer-data-provider.js";
22
22
  import { formatDurationSecs } from "../../core/format-duration.js";
23
23
  import { formatTokens } from "../../core/format-tokens.js";
24
24
  import { KeybindingsManager } from "../../core/keybindings.js";
25
+ import { measurePromptSurface, measureToolSchemaTokens } from "../../core/light.js";
25
26
  import { formatMissingSessionCwdPrompt, MissingSessionCwdError } from "../../core/session-cwd.js";
26
27
  import { SessionManager } from "../../core/session-manager.js";
27
28
  import { BUILTIN_SLASH_COMMANDS } from "../../core/slash-commands.js";
@@ -2705,7 +2706,16 @@ export class InteractiveMode {
2705
2706
  // Union so tools disabled at startup (absent from the live registry) still
2706
2707
  // appear and can be re-enabled for the next session.
2707
2708
  const toolToggleNames = [...new Set([...builtinToolNames, ...disabledToolNames])].sort();
2708
- const toolToggles = toolToggleNames.map((name) => ({ name, enabled: !disabledToolNames.has(name) }));
2709
+ // Price every tool the pane lists, including the ones that are off: what
2710
+ // the row needs to show is what turning it back on will cost per turn. A
2711
+ // tool disabled before launch has no schema in this session, so it has no
2712
+ // price to show either.
2713
+ const schemaTokens = new Map(this.session.getAllTools().map((tool) => [tool.name, measureToolSchemaTokens(tool)]));
2714
+ const toolToggles = toolToggleNames.map((name) => ({
2715
+ name,
2716
+ enabled: !disabledToolNames.has(name),
2717
+ tokens: schemaTokens.get(name),
2718
+ }));
2709
2719
  const toolGroups = [
2710
2720
  {
2711
2721
  id: "web",
@@ -2742,6 +2752,7 @@ export class InteractiveMode {
2742
2752
  autoResizeImages: this.settingsManager.getImageAutoResize(),
2743
2753
  blockImages: this.settingsManager.getBlockImages(),
2744
2754
  enableSkillCommands: this.settingsManager.getEnableSkillCommands(),
2755
+ light: this.settingsManager.getLight(),
2745
2756
  pluginInstallScope: this.settingsManager.getPluginInstallScope(),
2746
2757
  enablePluginTools: this.settingsManager.getEnablePluginTools(),
2747
2758
  // Rows write the user settings file, so a key the project file also
@@ -2776,6 +2787,10 @@ export class InteractiveMode {
2776
2787
  webtoolsTimeoutSecs: this.settingsManager.getWebtoolsTimeoutSecs(),
2777
2788
  // The effective window, so a project settings.json narrowing it for
2778
2789
  // this repo shows up here rather than the user-scope value alone.
2790
+ // Re-measured on every change so the pane can price what a toggle did:
2791
+ // the session rebuilds its system prompt as tools come and go, and
2792
+ // this reads that live state rather than a snapshot.
2793
+ measureTokenSurface: () => measurePromptSurface(this.session),
2779
2794
  learn: (() => {
2780
2795
  const learn = this.settingsManager.getLearnSettings();
2781
2796
  return {
@@ -2879,6 +2894,11 @@ export class InteractiveMode {
2879
2894
  this.settingsManager.setEnableSkillCommands(enabled);
2880
2895
  this.setupAutocompleteProvider();
2881
2896
  },
2897
+ onLightChange: (enabled) => {
2898
+ // Picks the tool set and the system prompt at startup, so it binds
2899
+ // on the next session rather than this one.
2900
+ this.settingsManager.setLight(enabled);
2901
+ },
2882
2902
  onPluginInstallScopeChange: (scope) => {
2883
2903
  // Read per install by InstallPlugin, so it applies immediately with
2884
2904
  // nothing to reload.