@agimon-ai/doompi-ui 0.0.1-alpha.58 → 0.0.1-alpha.64

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.
Files changed (107) hide show
  1. package/dist/adapters/pi/extension.d.cts +1 -2
  2. package/dist/adapters/pi/extension.d.cts.map +1 -1
  3. package/dist/adapters/pi/extension.d.mts +1 -2
  4. package/dist/adapters/pi/extension.d.mts.map +1 -1
  5. package/dist/adapters/pi/extensionName.d.cts +4 -5
  6. package/dist/adapters/pi/extensionName.d.cts.map +1 -1
  7. package/dist/adapters/pi/extensionName.d.mts +4 -5
  8. package/dist/adapters/pi/extensionName.d.mts.map +1 -1
  9. package/dist/adapters/telemetry/logSinkTelemetry.d.cts +6 -7
  10. package/dist/adapters/telemetry/logSinkTelemetry.d.cts.map +1 -1
  11. package/dist/adapters/telemetry/logSinkTelemetry.d.mts +6 -7
  12. package/dist/adapters/telemetry/logSinkTelemetry.d.mts.map +1 -1
  13. package/dist/services/leader/leaderRegistry.d.cts +6 -7
  14. package/dist/services/leader/leaderRegistry.d.cts.map +1 -1
  15. package/dist/services/leader/leaderRegistry.d.mts +6 -7
  16. package/dist/services/leader/leaderRegistry.d.mts.map +1 -1
  17. package/dist/services/state/uiState.d.cts +5 -6
  18. package/dist/services/state/uiState.d.cts.map +1 -1
  19. package/dist/services/state/uiState.d.mts +5 -6
  20. package/dist/services/state/uiState.d.mts.map +1 -1
  21. package/dist/services/tools/toolCost.d.cts +4 -5
  22. package/dist/services/tools/toolCost.d.cts.map +1 -1
  23. package/dist/services/tools/toolCost.d.mts +4 -5
  24. package/dist/services/tools/toolCost.d.mts.map +1 -1
  25. package/dist/services/tools/toolInventory.d.cts +7 -8
  26. package/dist/services/tools/toolInventory.d.cts.map +1 -1
  27. package/dist/services/tools/toolInventory.d.mts +7 -8
  28. package/dist/services/tools/toolInventory.d.mts.map +1 -1
  29. package/dist/tui/builtinToolRender.cjs +1 -1
  30. package/dist/tui/builtinToolRender.cjs.map +1 -1
  31. package/dist/tui/builtinToolRender.mjs +1 -1
  32. package/dist/tui/builtinToolRender.mjs.map +1 -1
  33. package/dist/tui/codeGutter.d.cts +2 -3
  34. package/dist/tui/codeGutter.d.cts.map +1 -1
  35. package/dist/tui/codeGutter.d.mts +2 -3
  36. package/dist/tui/codeGutter.d.mts.map +1 -1
  37. package/dist/tui/configOverlay.cjs +0 -0
  38. package/dist/tui/configOverlay.cjs.map +1 -1
  39. package/dist/tui/configOverlay.d.cts +3 -4
  40. package/dist/tui/configOverlay.d.cts.map +1 -1
  41. package/dist/tui/configOverlay.d.mts +3 -4
  42. package/dist/tui/configOverlay.d.mts.map +1 -1
  43. package/dist/tui/configOverlay.mjs +0 -0
  44. package/dist/tui/configOverlay.mjs.map +1 -1
  45. package/dist/tui/diffRender.d.cts +1 -2
  46. package/dist/tui/diffRender.d.cts.map +1 -1
  47. package/dist/tui/diffRender.d.mts +1 -2
  48. package/dist/tui/diffRender.d.mts.map +1 -1
  49. package/dist/tui/doomEditor.d.cts +2 -3
  50. package/dist/tui/doomEditor.d.cts.map +1 -1
  51. package/dist/tui/doomEditor.d.mts +2 -3
  52. package/dist/tui/doomEditor.d.mts.map +1 -1
  53. package/dist/tui/doomFooter.d.cts +2 -3
  54. package/dist/tui/doomFooter.d.cts.map +1 -1
  55. package/dist/tui/doomFooter.d.mts +2 -3
  56. package/dist/tui/doomFooter.d.mts.map +1 -1
  57. package/dist/tui/doomHeader.d.cts +1 -2
  58. package/dist/tui/doomHeader.d.cts.map +1 -1
  59. package/dist/tui/doomHeader.d.mts +1 -2
  60. package/dist/tui/doomHeader.d.mts.map +1 -1
  61. package/dist/tui/doomOverlay.d.cts +6 -7
  62. package/dist/tui/doomOverlay.d.cts.map +1 -1
  63. package/dist/tui/doomOverlay.d.mts +6 -7
  64. package/dist/tui/doomOverlay.d.mts.map +1 -1
  65. package/dist/tui/hashlineRendering.cjs +1 -1
  66. package/dist/tui/hashlineRendering.cjs.map +1 -1
  67. package/dist/tui/hashlineRendering.d.cts +5 -6
  68. package/dist/tui/hashlineRendering.d.cts.map +1 -1
  69. package/dist/tui/hashlineRendering.d.mts +5 -6
  70. package/dist/tui/hashlineRendering.d.mts.map +1 -1
  71. package/dist/tui/hashlineRendering.mjs +1 -1
  72. package/dist/tui/hashlineRendering.mjs.map +1 -1
  73. package/dist/tui/leaderHints.d.cts +2 -3
  74. package/dist/tui/leaderHints.d.cts.map +1 -1
  75. package/dist/tui/leaderHints.d.mts +2 -3
  76. package/dist/tui/leaderHints.d.mts.map +1 -1
  77. package/dist/tui/matrixPicker.d.cts +5 -6
  78. package/dist/tui/matrixPicker.d.cts.map +1 -1
  79. package/dist/tui/matrixPicker.d.mts +5 -6
  80. package/dist/tui/matrixPicker.d.mts.map +1 -1
  81. package/dist/tui/rendering.d.cts +7 -8
  82. package/dist/tui/rendering.d.cts.map +1 -1
  83. package/dist/tui/rendering.d.mts +7 -8
  84. package/dist/tui/rendering.d.mts.map +1 -1
  85. package/dist/tui/theme.d.cts +5 -6
  86. package/dist/tui/theme.d.cts.map +1 -1
  87. package/dist/tui/theme.d.mts +5 -6
  88. package/dist/tui/theme.d.mts.map +1 -1
  89. package/dist/tui/toolChrome.d.cts +8 -9
  90. package/dist/tui/toolChrome.d.cts.map +1 -1
  91. package/dist/tui/toolChrome.d.mts +8 -9
  92. package/dist/tui/toolChrome.d.mts.map +1 -1
  93. package/dist/tui/toolsOverlay.d.cts +2 -3
  94. package/dist/tui/toolsOverlay.d.cts.map +1 -1
  95. package/dist/tui/toolsOverlay.d.mts +2 -3
  96. package/dist/tui/toolsOverlay.d.mts.map +1 -1
  97. package/dist/types/harnessMetadata.d.cts +2 -3
  98. package/dist/types/harnessMetadata.d.cts.map +1 -1
  99. package/dist/types/harnessMetadata.d.mts +2 -3
  100. package/dist/types/harnessMetadata.d.mts.map +1 -1
  101. package/package.json +15 -15
  102. package/src/web/{FindToolMessage.tsx → components/FindToolMessage.tsx} +1 -1
  103. package/src/web/{ListingBody.tsx → components/ListingBody.tsx} +1 -1
  104. package/src/web/{LsToolMessage.tsx → components/LsToolMessage.tsx} +1 -1
  105. package/src/web/{WriteToolMessage.tsx → components/WriteToolMessage.tsx} +1 -1
  106. package/src/web/index.ts +3 -3
  107. /package/src/web/{builtinToolView.ts → lib/builtinToolView.ts} +0 -0
@@ -2,7 +2,6 @@ import { UiTelemetry } from "../telemetry/logSinkTelemetry.cjs";
2
2
  import { ExtensionAPI } from "@earendil-works/pi-coding-agent";
3
3
  //#region src/adapters/pi/extension.d.ts
4
4
  /** The package's standard Pi factory, mounted under the session Cordis host. */
5
- declare function doomPiUiExtension(pi: ExtensionAPI, telemetry?: UiTelemetry): Promise<void>;
5
+ export declare function doomPiUiExtension(pi: ExtensionAPI, telemetry?: UiTelemetry): Promise<void>;
6
6
  //#endregion
7
- export { doomPiUiExtension };
8
7
  //# sourceMappingURL=extension.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"extension.d.cts","names":[],"sources":["../../../src/adapters/pi/extension.ts"],"mappings":";;;;iBA2RsB,kBAAkB,IAAI,cAAc,YAAW,cAAoC"}
1
+ {"version":3,"file":"extension.d.cts","names":[],"sources":["../../../src/adapters/pi/extension.ts"],"mappings":";;;;wBA2RsB,kBAAkB,IAAI,cAAc,YAAW,cAAoC"}
@@ -2,7 +2,6 @@ import { UiTelemetry } from "../telemetry/logSinkTelemetry.mjs";
2
2
  import { ExtensionAPI } from "@earendil-works/pi-coding-agent";
3
3
  //#region src/adapters/pi/extension.d.ts
4
4
  /** The package's standard Pi factory, mounted under the session Cordis host. */
5
- declare function doomPiUiExtension(pi: ExtensionAPI, telemetry?: UiTelemetry): Promise<void>;
5
+ export declare function doomPiUiExtension(pi: ExtensionAPI, telemetry?: UiTelemetry): Promise<void>;
6
6
  //#endregion
7
- export { doomPiUiExtension };
8
7
  //# sourceMappingURL=extension.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"extension.d.mts","names":[],"sources":["../../../src/adapters/pi/extension.ts"],"mappings":";;;;iBA2RsB,kBAAkB,IAAI,cAAc,YAAW,cAAoC"}
1
+ {"version":3,"file":"extension.d.mts","names":[],"sources":["../../../src/adapters/pi/extension.ts"],"mappings":";;;;wBA2RsB,kBAAkB,IAAI,cAAc,YAAW,cAAoC"}
@@ -7,10 +7,10 @@ import { ExtensionAPI } from "@earendil-works/pi-coding-agent";
7
7
  * The compiler still knows each original entry path, so it calls factories through
8
8
  * this boundary and preserves that identity before the information is lost.
9
9
  */
10
- declare function withExtensionSource(pi: ExtensionAPI, entryPath: string): ExtensionAPI;
10
+ export declare function withExtensionSource(pi: ExtensionAPI, entryPath: string): ExtensionAPI;
11
11
  /** Original extension entry that registered a tool inside a composed bundle. */
12
- declare function extensionToolSource(pi: ExtensionAPI, toolName: string): string | undefined;
13
- declare function extensionName(entryPath: string): string;
12
+ export declare function extensionToolSource(pi: ExtensionAPI, toolName: string): string | undefined;
13
+ export declare function extensionName(entryPath: string): string;
14
14
  /**
15
15
  * The package name exactly as a manifest spells it, scope and all.
16
16
  *
@@ -20,7 +20,6 @@ declare function extensionName(entryPath: string): string;
20
20
  * admitted it needs the unshortened name. Attribution and display are different
21
21
  * jobs, so they get different functions rather than one lossy one.
22
22
  */
23
- declare function extensionPackageName(entryPath: string): string | undefined;
23
+ export declare function extensionPackageName(entryPath: string): string | undefined;
24
24
  //#endregion
25
- export { extensionName, extensionPackageName, extensionToolSource, withExtensionSource };
26
25
  //# sourceMappingURL=extensionName.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"extensionName.d.cts","names":[],"sources":["../../../src/adapters/pi/extensionName.ts"],"mappings":";;;;;;;;;iBAqDgB,oBAAoB,IAAI,cAAc,oBAAoB;;iBAa1D,oBAAoB,IAAI,cAAc;iBAmBtC,cAAc;;;;;;;;;;iBAmBd,qBAAqB"}
1
+ {"version":3,"file":"extensionName.d.cts","names":[],"sources":["../../../src/adapters/pi/extensionName.ts"],"mappings":";;;;;;;;;wBAqDgB,oBAAoB,IAAI,cAAc,oBAAoB;;wBAa1D,oBAAoB,IAAI,cAAc;wBAmBtC,cAAc;;;;;;;;;;wBAmBd,qBAAqB"}
@@ -7,10 +7,10 @@ import { ExtensionAPI } from "@earendil-works/pi-coding-agent";
7
7
  * The compiler still knows each original entry path, so it calls factories through
8
8
  * this boundary and preserves that identity before the information is lost.
9
9
  */
10
- declare function withExtensionSource(pi: ExtensionAPI, entryPath: string): ExtensionAPI;
10
+ export declare function withExtensionSource(pi: ExtensionAPI, entryPath: string): ExtensionAPI;
11
11
  /** Original extension entry that registered a tool inside a composed bundle. */
12
- declare function extensionToolSource(pi: ExtensionAPI, toolName: string): string | undefined;
13
- declare function extensionName(entryPath: string): string;
12
+ export declare function extensionToolSource(pi: ExtensionAPI, toolName: string): string | undefined;
13
+ export declare function extensionName(entryPath: string): string;
14
14
  /**
15
15
  * The package name exactly as a manifest spells it, scope and all.
16
16
  *
@@ -20,7 +20,6 @@ declare function extensionName(entryPath: string): string;
20
20
  * admitted it needs the unshortened name. Attribution and display are different
21
21
  * jobs, so they get different functions rather than one lossy one.
22
22
  */
23
- declare function extensionPackageName(entryPath: string): string | undefined;
23
+ export declare function extensionPackageName(entryPath: string): string | undefined;
24
24
  //#endregion
25
- export { extensionName, extensionPackageName, extensionToolSource, withExtensionSource };
26
25
  //# sourceMappingURL=extensionName.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"extensionName.d.mts","names":[],"sources":["../../../src/adapters/pi/extensionName.ts"],"mappings":";;;;;;;;;iBAqDgB,oBAAoB,IAAI,cAAc,oBAAoB;;iBAa1D,oBAAoB,IAAI,cAAc;iBAmBtC,cAAc;;;;;;;;;;iBAmBd,qBAAqB"}
1
+ {"version":3,"file":"extensionName.d.mts","names":[],"sources":["../../../src/adapters/pi/extensionName.ts"],"mappings":";;;;;;;;;wBAqDgB,oBAAoB,IAAI,cAAc,oBAAoB;;wBAa1D,oBAAoB,IAAI,cAAc;wBAmBtC,cAAc;;;;;;;;;;wBAmBd,qBAAqB"}
@@ -1,29 +1,28 @@
1
1
  import { DoomTelemetryOptions } from "@agimon-ai/doompi-telemetry";
2
2
  //#region src/adapters/telemetry/logSinkTelemetry.d.ts
3
- declare const UI_EVENT: {
3
+ export declare const UI_EVENT: {
4
4
  readonly leaderContributionRejected: 'doom_pi_ui.leader_contribution_rejected';
5
5
  readonly leaderCommandUnavailable: 'doom_pi_ui.leader_command_unavailable';
6
6
  readonly leaderActionUnavailable: 'doom_pi_ui.leader_action_unavailable';
7
7
  readonly themeApplyFailed: 'doom_pi_ui.theme_apply_failed';
8
8
  readonly shellInstalled: 'doom_pi_ui.shell_installed';
9
9
  };
10
- type UiEventName = (typeof UI_EVENT)[keyof typeof UI_EVENT];
11
- type UiEventAttributes = Record<string, string | number | boolean>;
12
- interface UiTelemetryOptions {
10
+ export type UiEventName = (typeof UI_EVENT)[keyof typeof UI_EVENT];
11
+ export type UiEventAttributes = Record<string, string | number | boolean>;
12
+ export interface UiTelemetryOptions {
13
13
  cwd?: string;
14
14
  workspaceRoot?: string;
15
15
  env?: NodeJS.ProcessEnv;
16
16
  telemetryFactory?: NonNullable<DoomTelemetryOptions['telemetryFactory']>;
17
17
  warn?: (message: string) => void;
18
18
  }
19
- interface UiTelemetry {
19
+ export interface UiTelemetry {
20
20
  recordError(event: UiEventName, error: unknown, attributes?: UiEventAttributes): Promise<void>;
21
21
  recordWarning(event: UiEventName, error: unknown, attributes?: UiEventAttributes): Promise<void>;
22
22
  recordEvent(event: UiEventName, attributes?: UiEventAttributes): Promise<void>;
23
23
  flush(): Promise<void>;
24
24
  shutdown(): Promise<void>;
25
25
  }
26
- declare function createUiTelemetry(options?: UiTelemetryOptions): UiTelemetry;
26
+ export declare function createUiTelemetry(options?: UiTelemetryOptions): UiTelemetry;
27
27
  //#endregion
28
- export { UI_EVENT, UiEventAttributes, UiEventName, UiTelemetry, UiTelemetryOptions, createUiTelemetry };
29
28
  //# sourceMappingURL=logSinkTelemetry.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logSinkTelemetry.d.cts","names":[],"sources":["../../../src/adapters/telemetry/logSinkTelemetry.ts"],"mappings":";;cAKa;WACX;WACA;WACA;WACA;WACA;;KAGU,sBAAsB,uBAAuB;KAC7C,oBAAoB;UAEf;EACf;EACA;EACA,MAAM,OAAO;EACb,mBAAmB,YAAY;EAC/B,QAAQ;;UAGO;EACf,YAAY,OAAO,aAAa,gBAAgB,aAAa,oBAAoB;EACjF,cAAc,OAAO,aAAa,gBAAgB,aAAa,oBAAoB;EACnF,YAAY,OAAO,aAAa,aAAa,oBAAoB;EACjE,SAAS;EACT,YAAY;;iBAGE,kBAAkB,UAAS,qBAA0B"}
1
+ {"version":3,"file":"logSinkTelemetry.d.cts","names":[],"sources":["../../../src/adapters/telemetry/logSinkTelemetry.ts"],"mappings":";;qBAKa;WACX;WACA;WACA;WACA;WACA;;YAGU,sBAAsB,uBAAuB;YAC7C,oBAAoB;iBAEf;EACf;EACA;EACA,MAAM,OAAO;EACb,mBAAmB,YAAY;EAC/B,QAAQ;;iBAGO;EACf,YAAY,OAAO,aAAa,gBAAgB,aAAa,oBAAoB;EACjF,cAAc,OAAO,aAAa,gBAAgB,aAAa,oBAAoB;EACnF,YAAY,OAAO,aAAa,aAAa,oBAAoB;EACjE,SAAS;EACT,YAAY;;wBAGE,kBAAkB,UAAS,qBAA0B"}
@@ -1,29 +1,28 @@
1
1
  import { DoomTelemetryOptions } from "@agimon-ai/doompi-telemetry";
2
2
  //#region src/adapters/telemetry/logSinkTelemetry.d.ts
3
- declare const UI_EVENT: {
3
+ export declare const UI_EVENT: {
4
4
  readonly leaderContributionRejected: 'doom_pi_ui.leader_contribution_rejected';
5
5
  readonly leaderCommandUnavailable: 'doom_pi_ui.leader_command_unavailable';
6
6
  readonly leaderActionUnavailable: 'doom_pi_ui.leader_action_unavailable';
7
7
  readonly themeApplyFailed: 'doom_pi_ui.theme_apply_failed';
8
8
  readonly shellInstalled: 'doom_pi_ui.shell_installed';
9
9
  };
10
- type UiEventName = (typeof UI_EVENT)[keyof typeof UI_EVENT];
11
- type UiEventAttributes = Record<string, string | number | boolean>;
12
- interface UiTelemetryOptions {
10
+ export type UiEventName = (typeof UI_EVENT)[keyof typeof UI_EVENT];
11
+ export type UiEventAttributes = Record<string, string | number | boolean>;
12
+ export interface UiTelemetryOptions {
13
13
  cwd?: string;
14
14
  workspaceRoot?: string;
15
15
  env?: NodeJS.ProcessEnv;
16
16
  telemetryFactory?: NonNullable<DoomTelemetryOptions['telemetryFactory']>;
17
17
  warn?: (message: string) => void;
18
18
  }
19
- interface UiTelemetry {
19
+ export interface UiTelemetry {
20
20
  recordError(event: UiEventName, error: unknown, attributes?: UiEventAttributes): Promise<void>;
21
21
  recordWarning(event: UiEventName, error: unknown, attributes?: UiEventAttributes): Promise<void>;
22
22
  recordEvent(event: UiEventName, attributes?: UiEventAttributes): Promise<void>;
23
23
  flush(): Promise<void>;
24
24
  shutdown(): Promise<void>;
25
25
  }
26
- declare function createUiTelemetry(options?: UiTelemetryOptions): UiTelemetry;
26
+ export declare function createUiTelemetry(options?: UiTelemetryOptions): UiTelemetry;
27
27
  //#endregion
28
- export { UI_EVENT, UiEventAttributes, UiEventName, UiTelemetry, UiTelemetryOptions, createUiTelemetry };
29
28
  //# sourceMappingURL=logSinkTelemetry.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logSinkTelemetry.d.mts","names":[],"sources":["../../../src/adapters/telemetry/logSinkTelemetry.ts"],"mappings":";;cAKa;WACX;WACA;WACA;WACA;WACA;;KAGU,sBAAsB,uBAAuB;KAC7C,oBAAoB;UAEf;EACf;EACA;EACA,MAAM,OAAO;EACb,mBAAmB,YAAY;EAC/B,QAAQ;;UAGO;EACf,YAAY,OAAO,aAAa,gBAAgB,aAAa,oBAAoB;EACjF,cAAc,OAAO,aAAa,gBAAgB,aAAa,oBAAoB;EACnF,YAAY,OAAO,aAAa,aAAa,oBAAoB;EACjE,SAAS;EACT,YAAY;;iBAGE,kBAAkB,UAAS,qBAA0B"}
1
+ {"version":3,"file":"logSinkTelemetry.d.mts","names":[],"sources":["../../../src/adapters/telemetry/logSinkTelemetry.ts"],"mappings":";;qBAKa;WACX;WACA;WACA;WACA;WACA;;YAGU,sBAAsB,uBAAuB;YAC7C,oBAAoB;iBAEf;EACf;EACA;EACA,MAAM,OAAO;EACb,mBAAmB,YAAY;EAC/B,QAAQ;;iBAGO;EACf,YAAY,OAAO,aAAa,gBAAgB,aAAa,oBAAoB;EACjF,cAAc,OAAO,aAAa,gBAAgB,aAAa,oBAAoB;EACnF,YAAY,OAAO,aAAa,aAAa,oBAAoB;EACjE,SAAS;EACT,YAAY;;wBAGE,kBAAkB,UAAS,qBAA0B"}
@@ -14,8 +14,8 @@ interface ExtensionLeaderAction {
14
14
  source: string;
15
15
  action: LeaderAction;
16
16
  }
17
- type DoomLeaderAction = AppLeaderAction | CommandLeaderAction | ExtensionLeaderAction;
18
- interface DoomLeaderResolvedOption {
17
+ export type DoomLeaderAction = AppLeaderAction | CommandLeaderAction | ExtensionLeaderAction;
18
+ export interface DoomLeaderResolvedOption {
19
19
  key: string;
20
20
  label: string;
21
21
  detail?: string;
@@ -23,20 +23,20 @@ interface DoomLeaderResolvedOption {
23
23
  hasChildren: boolean;
24
24
  action?: DoomLeaderAction;
25
25
  }
26
- interface DoomLeaderGroup {
26
+ export interface DoomLeaderGroup {
27
27
  label: string;
28
28
  options: readonly DoomLeaderResolvedOption[];
29
29
  }
30
- interface DoomLeaderDiagnostic {
30
+ export interface DoomLeaderDiagnostic {
31
31
  source: string;
32
32
  bindingId?: string;
33
33
  message: string;
34
34
  }
35
- interface DoomLeaderRegistrationResult {
35
+ export interface DoomLeaderRegistrationResult {
36
36
  accepted: boolean;
37
37
  diagnostics: readonly DoomLeaderDiagnostic[];
38
38
  }
39
- declare class DoomLeaderRegistry {
39
+ export declare class DoomLeaderRegistry {
40
40
  private root;
41
41
  private readonly contributions;
42
42
  private readonly listeners;
@@ -55,5 +55,4 @@ declare class DoomLeaderRegistry {
55
55
  private rebuild;
56
56
  }
57
57
  //#endregion
58
- export { DoomLeaderAction, DoomLeaderDiagnostic, DoomLeaderGroup, DoomLeaderRegistrationResult, DoomLeaderRegistry, DoomLeaderResolvedOption };
59
58
  //# sourceMappingURL=leaderRegistry.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"leaderRegistry.d.cts","names":[],"sources":["../../../src/services/leader/leaderRegistry.ts"],"mappings":";;KAAK;UAoBK;EACR;EACA,QAAQ;;UAGA;EACR;EACA,SAAS;;UAGD;EACR;EACA;EACA,QAAQ;;KAGE,mBAAmB,kBAAkB,sBAAsB;UAEtD;EACf;EACA;EACA;EACA,OAAO;EACP;EACA,SAAS;;UAGM;EACf;EACA,kBAAkB;;UAGH;EACf;EACA;EACA;;UAGe;EACf;EACA,sBAAsB;;cA4fX;UACH;mBACS;mBACA;UACT;UACA;EAER;EAIA,SAAS,iBAAiB;;EAQ1B,iBAAiB,iBAAiB;UAI1B;;EAeR,SAAS;EAKT,SAAS,0BAA0B;EA2BnC,kBAAkB;EAIlB,UAAU;UAKF"}
1
+ {"version":3,"file":"leaderRegistry.d.cts","names":[],"sources":["../../../src/services/leader/leaderRegistry.ts"],"mappings":";;KAAK;UAoBK;EACR;EACA,QAAQ;;UAGA;EACR;EACA,SAAS;;UAGD;EACR;EACA;EACA,QAAQ;;YAGE,mBAAmB,kBAAkB,sBAAsB;iBAEtD;EACf;EACA;EACA;EACA,OAAO;EACP;EACA,SAAS;;iBAGM;EACf;EACA,kBAAkB;;iBAGH;EACf;EACA;EACA;;iBAGe;EACf;EACA,sBAAsB;;qBA4fX;UACH;mBACS;mBACA;UACT;UACA;EAER;EAIA,SAAS,iBAAiB;;EAQ1B,iBAAiB,iBAAiB;UAI1B;;EAeR,SAAS;EAKT,SAAS,0BAA0B;EA2BnC,kBAAkB;EAIlB,UAAU;UAKF"}
@@ -14,8 +14,8 @@ interface ExtensionLeaderAction {
14
14
  source: string;
15
15
  action: LeaderAction;
16
16
  }
17
- type DoomLeaderAction = AppLeaderAction | CommandLeaderAction | ExtensionLeaderAction;
18
- interface DoomLeaderResolvedOption {
17
+ export type DoomLeaderAction = AppLeaderAction | CommandLeaderAction | ExtensionLeaderAction;
18
+ export interface DoomLeaderResolvedOption {
19
19
  key: string;
20
20
  label: string;
21
21
  detail?: string;
@@ -23,20 +23,20 @@ interface DoomLeaderResolvedOption {
23
23
  hasChildren: boolean;
24
24
  action?: DoomLeaderAction;
25
25
  }
26
- interface DoomLeaderGroup {
26
+ export interface DoomLeaderGroup {
27
27
  label: string;
28
28
  options: readonly DoomLeaderResolvedOption[];
29
29
  }
30
- interface DoomLeaderDiagnostic {
30
+ export interface DoomLeaderDiagnostic {
31
31
  source: string;
32
32
  bindingId?: string;
33
33
  message: string;
34
34
  }
35
- interface DoomLeaderRegistrationResult {
35
+ export interface DoomLeaderRegistrationResult {
36
36
  accepted: boolean;
37
37
  diagnostics: readonly DoomLeaderDiagnostic[];
38
38
  }
39
- declare class DoomLeaderRegistry {
39
+ export declare class DoomLeaderRegistry {
40
40
  private root;
41
41
  private readonly contributions;
42
42
  private readonly listeners;
@@ -55,5 +55,4 @@ declare class DoomLeaderRegistry {
55
55
  private rebuild;
56
56
  }
57
57
  //#endregion
58
- export { DoomLeaderAction, DoomLeaderDiagnostic, DoomLeaderGroup, DoomLeaderRegistrationResult, DoomLeaderRegistry, DoomLeaderResolvedOption };
59
58
  //# sourceMappingURL=leaderRegistry.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"leaderRegistry.d.mts","names":[],"sources":["../../../src/services/leader/leaderRegistry.ts"],"mappings":";;KAAK;UAoBK;EACR;EACA,QAAQ;;UAGA;EACR;EACA,SAAS;;UAGD;EACR;EACA;EACA,QAAQ;;KAGE,mBAAmB,kBAAkB,sBAAsB;UAEtD;EACf;EACA;EACA;EACA,OAAO;EACP;EACA,SAAS;;UAGM;EACf;EACA,kBAAkB;;UAGH;EACf;EACA;EACA;;UAGe;EACf;EACA,sBAAsB;;cA4fX;UACH;mBACS;mBACA;UACT;UACA;EAER;EAIA,SAAS,iBAAiB;;EAQ1B,iBAAiB,iBAAiB;UAI1B;;EAeR,SAAS;EAKT,SAAS,0BAA0B;EA2BnC,kBAAkB;EAIlB,UAAU;UAKF"}
1
+ {"version":3,"file":"leaderRegistry.d.mts","names":[],"sources":["../../../src/services/leader/leaderRegistry.ts"],"mappings":";;KAAK;UAoBK;EACR;EACA,QAAQ;;UAGA;EACR;EACA,SAAS;;UAGD;EACR;EACA;EACA,QAAQ;;YAGE,mBAAmB,kBAAkB,sBAAsB;iBAEtD;EACf;EACA;EACA;EACA,OAAO;EACP;EACA,SAAS;;iBAGM;EACf;EACA,kBAAkB;;iBAGH;EACf;EACA;EACA;;iBAGe;EACf;EACA,sBAAsB;;qBA4fX;UACH;mBACS;mBACA;UACT;UACA;EAER;EAIA,SAAS,iBAAiB;;EAQ1B,iBAAiB,iBAAiB;UAI1B;;EAeR,SAAS;EAKT,SAAS,0BAA0B;EA2BnC,kBAAkB;EAIlB,UAAU;UAKF"}
@@ -1,20 +1,20 @@
1
1
  import { LeaderTone } from "@agimon-ai/doompi-extension-contracts/leader";
2
2
  import { MinorModeRecord, ModeTextColor } from "@agimon-ai/doompi-extension-contracts/mode";
3
3
  //#region src/services/state/uiState.d.ts
4
- interface LeaderOption {
4
+ export interface LeaderOption {
5
5
  key: string;
6
6
  label: string;
7
7
  detail?: string;
8
8
  tone?: LeaderTone;
9
9
  }
10
- interface LeaderSnapshot {
10
+ export interface LeaderSnapshot {
11
11
  active: boolean;
12
12
  prefix: string[];
13
13
  label: string;
14
14
  options: LeaderOption[];
15
15
  rootOptions?: LeaderOption[];
16
16
  }
17
- interface UiMinorModeStatus {
17
+ export interface UiMinorModeStatus {
18
18
  source: string;
19
19
  id: string;
20
20
  label: string;
@@ -23,8 +23,8 @@ interface UiMinorModeStatus {
23
23
  order: number;
24
24
  }
25
25
  type StateListener = (snapshot: LeaderSnapshot) => void;
26
- declare function projectMinorModeRecords(records: readonly MinorModeRecord[]): UiMinorModeStatus[];
27
- declare class DoomUiState {
26
+ export declare function projectMinorModeRecords(records: readonly MinorModeRecord[]): UiMinorModeStatus[];
27
+ export declare class DoomUiState {
28
28
  private snapshot;
29
29
  private modes;
30
30
  private readonly listeners;
@@ -36,5 +36,4 @@ declare class DoomUiState {
36
36
  subscribe(listener: StateListener): () => void;
37
37
  }
38
38
  //#endregion
39
- export { DoomUiState, LeaderOption, LeaderSnapshot, UiMinorModeStatus, projectMinorModeRecords };
40
39
  //# sourceMappingURL=uiState.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"uiState.d.cts","names":[],"sources":["../../../src/services/state/uiState.ts"],"mappings":";;;UAGiB;EACf;EACA;EACA;EACA,OAAO;;UAGQ;EACf;EACA;EACA;EACA,SAAS;EACT,cAAc;;UAGC;EACf;EACA;EACA;EACA;EACA,QAAQ;EACR;;KAGG,iBAAiB,UAAU;iBAmBhB,wBAAwB,kBAAkB,oBAAoB;cAiBjE;UACH;UACA;mBACS;EAEjB,eAAe;EAIf,qBAAqB;EAIrB,SAAS,gBAAgB;EAKzB,UAAU,UAAU;EAKpB;EAKA,UAAU,UAAU"}
1
+ {"version":3,"file":"uiState.d.cts","names":[],"sources":["../../../src/services/state/uiState.ts"],"mappings":";;;iBAGiB;EACf;EACA;EACA;EACA,OAAO;;iBAGQ;EACf;EACA;EACA;EACA,SAAS;EACT,cAAc;;iBAGC;EACf;EACA;EACA;EACA;EACA,QAAQ;EACR;;KAGG,iBAAiB,UAAU;wBAmBhB,wBAAwB,kBAAkB,oBAAoB;qBAiBjE;UACH;UACA;mBACS;EAEjB,eAAe;EAIf,qBAAqB;EAIrB,SAAS,gBAAgB;EAKzB,UAAU,UAAU;EAKpB;EAKA,UAAU,UAAU"}
@@ -1,20 +1,20 @@
1
1
  import { MinorModeRecord, ModeTextColor } from "@agimon-ai/doompi-extension-contracts/mode";
2
2
  import { LeaderTone } from "@agimon-ai/doompi-extension-contracts/leader";
3
3
  //#region src/services/state/uiState.d.ts
4
- interface LeaderOption {
4
+ export interface LeaderOption {
5
5
  key: string;
6
6
  label: string;
7
7
  detail?: string;
8
8
  tone?: LeaderTone;
9
9
  }
10
- interface LeaderSnapshot {
10
+ export interface LeaderSnapshot {
11
11
  active: boolean;
12
12
  prefix: string[];
13
13
  label: string;
14
14
  options: LeaderOption[];
15
15
  rootOptions?: LeaderOption[];
16
16
  }
17
- interface UiMinorModeStatus {
17
+ export interface UiMinorModeStatus {
18
18
  source: string;
19
19
  id: string;
20
20
  label: string;
@@ -23,8 +23,8 @@ interface UiMinorModeStatus {
23
23
  order: number;
24
24
  }
25
25
  type StateListener = (snapshot: LeaderSnapshot) => void;
26
- declare function projectMinorModeRecords(records: readonly MinorModeRecord[]): UiMinorModeStatus[];
27
- declare class DoomUiState {
26
+ export declare function projectMinorModeRecords(records: readonly MinorModeRecord[]): UiMinorModeStatus[];
27
+ export declare class DoomUiState {
28
28
  private snapshot;
29
29
  private modes;
30
30
  private readonly listeners;
@@ -36,5 +36,4 @@ declare class DoomUiState {
36
36
  subscribe(listener: StateListener): () => void;
37
37
  }
38
38
  //#endregion
39
- export { DoomUiState, LeaderOption, LeaderSnapshot, UiMinorModeStatus, projectMinorModeRecords };
40
39
  //# sourceMappingURL=uiState.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"uiState.d.mts","names":[],"sources":["../../../src/services/state/uiState.ts"],"mappings":";;;UAGiB;EACf;EACA;EACA;EACA,OAAO;;UAGQ;EACf;EACA;EACA;EACA,SAAS;EACT,cAAc;;UAGC;EACf;EACA;EACA;EACA;EACA,QAAQ;EACR;;KAGG,iBAAiB,UAAU;iBAmBhB,wBAAwB,kBAAkB,oBAAoB;cAiBjE;UACH;UACA;mBACS;EAEjB,eAAe;EAIf,qBAAqB;EAIrB,SAAS,gBAAgB;EAKzB,UAAU,UAAU;EAKpB;EAKA,UAAU,UAAU"}
1
+ {"version":3,"file":"uiState.d.mts","names":[],"sources":["../../../src/services/state/uiState.ts"],"mappings":";;;iBAGiB;EACf;EACA;EACA;EACA,OAAO;;iBAGQ;EACf;EACA;EACA;EACA,SAAS;EACT,cAAc;;iBAGC;EACf;EACA;EACA;EACA;EACA,QAAQ;EACR;;KAGG,iBAAiB,UAAU;wBAmBhB,wBAAwB,kBAAkB,oBAAoB;qBAiBjE;UACH;UACA;mBACS;EAEjB,eAAe;EAIf,qBAAqB;EAIrB,SAAS,gBAAgB;EAKzB,UAAU,UAAU;EAKpB;EAKA,UAAU,UAAU"}
@@ -14,15 +14,15 @@ import { ToolEntry, ToolSource } from "./toolInventory.cjs";
14
14
  * pricing already takes a `countTokens`. This module stays free of any opinion
15
15
  * about which vocabulary the caller's model actually uses.
16
16
  */
17
- interface ToolCost {
17
+ export interface ToolCost {
18
18
  /** The tool-list payload: name, description, and parameter schema. */
19
19
  schemaTokens: number;
20
20
  /** The system-prompt payload: snippet and guideline bullets. */
21
21
  promptTokens: number;
22
22
  totalTokens: number;
23
23
  }
24
- type CountTokens = (text: string) => number;
25
- declare function tokensForTool(entry: ToolEntry, countTokens: CountTokens): ToolCost;
24
+ export type CountTokens = (text: string) => number;
25
+ export declare function tokensForTool(entry: ToolEntry, countTokens: CountTokens): ToolCost;
26
26
  /**
27
27
  * Every tool in a source, and what the source costs in total.
28
28
  *
@@ -30,10 +30,9 @@ declare function tokensForTool(entry: ToolEntry, countTokens: CountTokens): Tool
30
30
  * the figure is to show what the composition costs. Whether the model may call
31
31
  * it is a separate question from whether it is being paid for.
32
32
  */
33
- declare function tokensForSource(source: ToolSource, countTokens: CountTokens): {
33
+ export declare function tokensForSource(source: ToolSource, countTokens: CountTokens): {
34
34
  tools: ReadonlyMap<string, ToolCost>;
35
35
  totalTokens: number;
36
36
  };
37
37
  //#endregion
38
- export { CountTokens, ToolCost, tokensForSource, tokensForTool };
39
38
  //# sourceMappingURL=toolCost.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toolCost.d.cts","names":[],"sources":["../../../src/services/tools/toolCost.ts"],"mappings":";;;;;;;;;;;;;;;;UAgBiB;;EAEf;;EAEA;EACA;;KAGU,eAAe;iBAeX,cAAc,OAAO,WAAW,aAAa,cAAc;;;;;;;;iBAc3D,gBACd,QAAQ,YACR,aAAa;EACV,OAAO,oBAAoB;EAAW"}
1
+ {"version":3,"file":"toolCost.d.cts","names":[],"sources":["../../../src/services/tools/toolCost.ts"],"mappings":";;;;;;;;;;;;;;;;iBAgBiB;;EAEf;;EAEA;EACA;;YAGU,eAAe;wBAeX,cAAc,OAAO,WAAW,aAAa,cAAc;;;;;;;;wBAc3D,gBACd,QAAQ,YACR,aAAa;EACV,OAAO,oBAAoB;EAAW"}
@@ -14,15 +14,15 @@ import { ToolEntry, ToolSource } from "./toolInventory.mjs";
14
14
  * pricing already takes a `countTokens`. This module stays free of any opinion
15
15
  * about which vocabulary the caller's model actually uses.
16
16
  */
17
- interface ToolCost {
17
+ export interface ToolCost {
18
18
  /** The tool-list payload: name, description, and parameter schema. */
19
19
  schemaTokens: number;
20
20
  /** The system-prompt payload: snippet and guideline bullets. */
21
21
  promptTokens: number;
22
22
  totalTokens: number;
23
23
  }
24
- type CountTokens = (text: string) => number;
25
- declare function tokensForTool(entry: ToolEntry, countTokens: CountTokens): ToolCost;
24
+ export type CountTokens = (text: string) => number;
25
+ export declare function tokensForTool(entry: ToolEntry, countTokens: CountTokens): ToolCost;
26
26
  /**
27
27
  * Every tool in a source, and what the source costs in total.
28
28
  *
@@ -30,10 +30,9 @@ declare function tokensForTool(entry: ToolEntry, countTokens: CountTokens): Tool
30
30
  * the figure is to show what the composition costs. Whether the model may call
31
31
  * it is a separate question from whether it is being paid for.
32
32
  */
33
- declare function tokensForSource(source: ToolSource, countTokens: CountTokens): {
33
+ export declare function tokensForSource(source: ToolSource, countTokens: CountTokens): {
34
34
  tools: ReadonlyMap<string, ToolCost>;
35
35
  totalTokens: number;
36
36
  };
37
37
  //#endregion
38
- export { CountTokens, ToolCost, tokensForSource, tokensForTool };
39
38
  //# sourceMappingURL=toolCost.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toolCost.d.mts","names":[],"sources":["../../../src/services/tools/toolCost.ts"],"mappings":";;;;;;;;;;;;;;;;UAgBiB;;EAEf;;EAEA;EACA;;KAGU,eAAe;iBAeX,cAAc,OAAO,WAAW,aAAa,cAAc;;;;;;;;iBAc3D,gBACd,QAAQ,YACR,aAAa;EACV,OAAO,oBAAoB;EAAW"}
1
+ {"version":3,"file":"toolCost.d.mts","names":[],"sources":["../../../src/services/tools/toolCost.ts"],"mappings":";;;;;;;;;;;;;;;;iBAgBiB;;EAEf;;EAEA;EACA;;YAGU,eAAe;wBAeX,cAAc,OAAO,WAAW,aAAa,cAAc;;;;;;;;wBAc3D,gBACd,QAAQ,YACR,aAAa;EACV,OAAO,oBAAoB;EAAW"}
@@ -1,7 +1,7 @@
1
1
  import { McpServerSnapshot } from "@agimon-ai/doompi-extension-contracts/mcp-status";
2
2
  //#region src/services/tools/toolInventory.d.ts
3
- type ToolSourceKind = 'core' | 'mcp' | 'extension';
4
- interface ToolEntry {
3
+ export type ToolSourceKind = 'core' | 'mcp' | 'extension';
4
+ export interface ToolEntry {
5
5
  name: string;
6
6
  description?: string;
7
7
  parameters?: unknown;
@@ -10,7 +10,7 @@ interface ToolEntry {
10
10
  promptGuidelines?: readonly string[];
11
11
  active: boolean;
12
12
  }
13
- interface ToolSource {
13
+ export interface ToolSource {
14
14
  key: string;
15
15
  label: string;
16
16
  kind: ToolSourceKind;
@@ -29,8 +29,8 @@ interface ToolSource {
29
29
  tools: readonly ToolEntry[];
30
30
  }
31
31
  /** One server row of the MCP status snapshot. */
32
- type McpServerStatus = McpServerSnapshot;
33
- interface ToolInfo {
32
+ export type McpServerStatus = McpServerSnapshot;
33
+ export interface ToolInfo {
34
34
  name: string;
35
35
  description?: string;
36
36
  parameters?: unknown;
@@ -41,7 +41,7 @@ interface ToolInfo {
41
41
  source?: string;
42
42
  };
43
43
  }
44
- interface ToolInventoryInput {
44
+ export interface ToolInventoryInput {
45
45
  tools: readonly ToolInfo[];
46
46
  activeTools: readonly string[];
47
47
  /** Absent when the MCP adapter is not loaded or has not published yet. */
@@ -58,7 +58,6 @@ interface ToolInventoryInput {
58
58
  * Every MCP tool is registered by one extension, so `sourceInfo` cannot separate
59
59
  * servers; the status snapshot supplies the tool-to-server mapping instead.
60
60
  */
61
- declare function buildToolSources(input: ToolInventoryInput): readonly ToolSource[];
61
+ export declare function buildToolSources(input: ToolInventoryInput): readonly ToolSource[];
62
62
  //#endregion
63
- export { McpServerStatus, ToolEntry, ToolInfo, ToolInventoryInput, ToolSource, ToolSourceKind, buildToolSources };
64
63
  //# sourceMappingURL=toolInventory.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toolInventory.d.cts","names":[],"sources":["../../../src/services/tools/toolInventory.ts"],"mappings":";;KAEY;UAEK;EACf;EACA;EACA;;EAEA;EACA;EACA;;UAGe;EACf;EACA;EACA,MAAM;;EAEN;;EAEA;;;;;;;;EAQA;EACA,gBAAgB;;;KAIN,kBAAkB;UAEb;EACf;EACA;EACA;EACA;EACA;EACA;IAAc;IAAc;;;UAGb;EACf,gBAAgB;EAChB;;EAEA,sBAAsB;EACtB,wBAAwB;;EAExB,+BAA+B;EAC/B,8BAA8B;;;;;;;;;iBAmEhB,iBAAiB,OAAO,8BAA8B"}
1
+ {"version":3,"file":"toolInventory.d.cts","names":[],"sources":["../../../src/services/tools/toolInventory.ts"],"mappings":";;YAEY;iBAEK;EACf;EACA;EACA;;EAEA;EACA;EACA;;iBAGe;EACf;EACA;EACA,MAAM;;EAEN;;EAEA;;;;;;;;EAQA;EACA,gBAAgB;;;YAIN,kBAAkB;iBAEb;EACf;EACA;EACA;EACA;EACA;EACA;IAAc;IAAc;;;iBAGb;EACf,gBAAgB;EAChB;;EAEA,sBAAsB;EACtB,wBAAwB;;EAExB,+BAA+B;EAC/B,8BAA8B;;;;;;;;;wBAmEhB,iBAAiB,OAAO,8BAA8B"}
@@ -1,7 +1,7 @@
1
1
  import { McpServerSnapshot } from "@agimon-ai/doompi-extension-contracts/mcp-status";
2
2
  //#region src/services/tools/toolInventory.d.ts
3
- type ToolSourceKind = 'core' | 'mcp' | 'extension';
4
- interface ToolEntry {
3
+ export type ToolSourceKind = 'core' | 'mcp' | 'extension';
4
+ export interface ToolEntry {
5
5
  name: string;
6
6
  description?: string;
7
7
  parameters?: unknown;
@@ -10,7 +10,7 @@ interface ToolEntry {
10
10
  promptGuidelines?: readonly string[];
11
11
  active: boolean;
12
12
  }
13
- interface ToolSource {
13
+ export interface ToolSource {
14
14
  key: string;
15
15
  label: string;
16
16
  kind: ToolSourceKind;
@@ -29,8 +29,8 @@ interface ToolSource {
29
29
  tools: readonly ToolEntry[];
30
30
  }
31
31
  /** One server row of the MCP status snapshot. */
32
- type McpServerStatus = McpServerSnapshot;
33
- interface ToolInfo {
32
+ export type McpServerStatus = McpServerSnapshot;
33
+ export interface ToolInfo {
34
34
  name: string;
35
35
  description?: string;
36
36
  parameters?: unknown;
@@ -41,7 +41,7 @@ interface ToolInfo {
41
41
  source?: string;
42
42
  };
43
43
  }
44
- interface ToolInventoryInput {
44
+ export interface ToolInventoryInput {
45
45
  tools: readonly ToolInfo[];
46
46
  activeTools: readonly string[];
47
47
  /** Absent when the MCP adapter is not loaded or has not published yet. */
@@ -58,7 +58,6 @@ interface ToolInventoryInput {
58
58
  * Every MCP tool is registered by one extension, so `sourceInfo` cannot separate
59
59
  * servers; the status snapshot supplies the tool-to-server mapping instead.
60
60
  */
61
- declare function buildToolSources(input: ToolInventoryInput): readonly ToolSource[];
61
+ export declare function buildToolSources(input: ToolInventoryInput): readonly ToolSource[];
62
62
  //#endregion
63
- export { McpServerStatus, ToolEntry, ToolInfo, ToolInventoryInput, ToolSource, ToolSourceKind, buildToolSources };
64
63
  //# sourceMappingURL=toolInventory.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toolInventory.d.mts","names":[],"sources":["../../../src/services/tools/toolInventory.ts"],"mappings":";;KAEY;UAEK;EACf;EACA;EACA;;EAEA;EACA;EACA;;UAGe;EACf;EACA;EACA,MAAM;;EAEN;;EAEA;;;;;;;;EAQA;EACA,gBAAgB;;;KAIN,kBAAkB;UAEb;EACf;EACA;EACA;EACA;EACA;EACA;IAAc;IAAc;;;UAGb;EACf,gBAAgB;EAChB;;EAEA,sBAAsB;EACtB,wBAAwB;;EAExB,+BAA+B;EAC/B,8BAA8B;;;;;;;;;iBAmEhB,iBAAiB,OAAO,8BAA8B"}
1
+ {"version":3,"file":"toolInventory.d.mts","names":[],"sources":["../../../src/services/tools/toolInventory.ts"],"mappings":";;YAEY;iBAEK;EACf;EACA;EACA;;EAEA;EACA;EACA;;iBAGe;EACf;EACA;EACA,MAAM;;EAEN;;EAEA;;;;;;;;EAQA;EACA,gBAAgB;;;YAIN,kBAAkB;iBAEb;EACf;EACA;EACA;EACA;EACA;EACA;IAAc;IAAc;;;iBAGb;EACf,gBAAgB;EAChB;;EAEA,sBAAsB;EACtB,wBAAwB;;EAExB,+BAA+B;EAC/B,8BAA8B;;;;;;;;;wBAmEhB,iBAAiB,OAAO,8BAA8B"}
@@ -1,4 +1,4 @@
1
- const e=require("./codeGutter.cjs"),t=require("./diffRender.cjs"),n=require("./toolChrome.cjs");let r=require("@earendil-works/pi-tui"),i=require("@earendil-works/pi-coding-agent");var a=class{text;constructor(e){this.text=e}render(e){return e<=0||this.text.length===0?[]:(0,r.wrapTextWithAnsi)(this.text,e)}invalidate(){}};function o(e){return n.previousDoomToolResult(e)}function s(e,t,r){return n.frameDoomToolResult(e,t,r)}function c(e,t,r,i){let a=n.renderToolHeading(e,t,i);return r.length>0&&(a+=` ${i.fg(`muted`,`· ${r.join(` · `)}`)}`),new n.DoomToolCall(a)}function l(e,t){return e===void 0?void 0:`${e} ${t}`}function u(e){return e.filter(e=>e!==void 0&&e.length>0)}function d(e,t){return c(`read`,e.path,u([e.offset===void 0?void 0:`from ${e.offset}`,l(e.limit,`lines`)]),t)}function f(e,t){let n=e.edits.length;return c(`edit`,e.path,[`${n} edit${n===1?``:`s`}`],t)}function p(e){let t=e.at(-1);if(!(t===void 0||!t.startsWith(`[`)||!t.endsWith(`]`))){for(e.pop();e.at(-1)===``;)e.pop();return t}}function m(e){return(e.content??[]).filter(e=>e.type===`text`).map(e=>e.text??``).join(`
1
+ const e=require("./codeGutter.cjs"),t=require("./diffRender.cjs"),n=require("./toolChrome.cjs");let r=require("@earendil-works/pi-tui"),i=require("@earendil-works/pi-coding-agent");var a=class{text;constructor(e){this.text=e}render(e){return e<=0||this.text.length===0?[]:(0,r.wrapTextWithAnsi)(this.text,e)}invalidate(){}};function o(e){return n.previousDoomToolResult(e)}function s(e,t,r){return n.frameDoomToolResult(e,t,r)}function c(e,t,r,i){let a=n.renderToolHeading(e,t,i);return r.length>0&&(a+=` ${i.fg(`muted`,`· ${r.join(` · `)}`)}`),new n.DoomToolCall(a)}function l(e,t){return e===void 0?void 0:`${e} ${t}`}function u(e){return e.filter(e=>e!==void 0&&e.length>0)}function d(e,t){return c(`read`,e.path,u([e.offset===void 0?void 0:`from ${e.offset}`,l(e.limit,`lines`)]),t)}function f(e,t){let n=e.edits.length;return c(`edit`,e.path,[`${n} edit${n===1?``:`s`}`],t)}function p(e){let t=e.at(-1);if(t!==void 0&&t.startsWith(`[`)&&t.endsWith(`]`)){for(e.pop();e.at(-1)===``;)e.pop();return t}}function m(e){return(e.content??[]).filter(e=>e.type===`text`).map(e=>e.text??``).join(`
2
2
  `).replaceAll(` `,` `).replaceAll(`\r
3
3
  `,`
4
4
  `)}function h(e,n,r,o,s=i.highlightCode,c=i.getLanguageFromPath){if(r.isError)return new a(o.fg(`error`,m(n)));let l=n.details?.diff;return l===void 0||l.length===0?new a(``):t.renderDoomDiff(l,o,c(e.path),s)}function g(t,r,a={},o=i.highlightCode,s=i.getLanguageFromPath){let c=n.renderToolHeading(`write`,t.path,r),l=r.fg(`muted`,`· ${t.content.length.toLocaleString(`en-US`)} chars`);if(t.content.length===0)return new n.DoomToolCall(`${c} ${l}`);let u=t.content.replaceAll(` `,` `).replaceAll(`\r
@@ -1 +1 @@
1
- {"version":3,"file":"builtinToolRender.cjs","names":["wrapTextWithAnsi","previousDoomToolResult","frameDoomToolResult","renderToolHeading","DoomToolCall","highlightCode","getLanguageFromPath","renderDoomDiff","gutterWidth","renderLineNumber"],"sources":["../../src/tui/builtinToolRender.ts"],"sourcesContent":["import {\n type EditToolDetails,\n type EditToolInput,\n type FindToolInput,\n type GrepToolInput,\n getLanguageFromPath,\n highlightCode,\n type LsToolInput,\n type ReadToolInput,\n type Theme,\n type WriteToolInput,\n} from '@earendil-works/pi-coding-agent';\nimport { type Component, wrapTextWithAnsi } from '@earendil-works/pi-tui';\nimport { gutterWidth, renderLineNumber } from './codeGutter.ts';\nimport { renderDoomDiff } from './diffRender.ts';\nimport { DoomToolCall, frameDoomToolResult, previousDoomToolResult, renderToolHeading } from './toolChrome.ts';\n\nconst COLLAPSED_FILE_LINES = 10;\n\ntype Highlighter = (code: string, language?: string) => string[];\ntype LanguageResolver = (path: string) => string | undefined;\n\nexport interface ToolPreviewOptions {\n expanded?: boolean;\n isError?: boolean;\n}\n\nexport interface WritePreviewOptions extends ToolPreviewOptions {\n argsStreaming?: boolean;\n}\n\nexport interface TextToolResult {\n content?: ReadonlyArray<{ type: string; text?: string }>;\n}\n\nexport interface EditToolResult extends TextToolResult {\n details?: EditToolDetails;\n}\n\n/** Self-owned result shell shared by Pi's native file and search tools. */\nclass BuiltinToolContent implements Component {\n constructor(private readonly text: string) {}\n\n render(width: number): string[] {\n if (width <= 0 || this.text.length === 0) return [];\n return wrapTextWithAnsi(this.text, width);\n }\n\n invalidate(): void {\n // Content is immutable and reflows from the current width on every render.\n }\n}\n\n/** Recover the native renderer's component from the shell returned on its previous pass. */\nexport function previousBuiltinResult(component: Component | undefined): Component | undefined {\n return previousDoomToolResult(component);\n}\n\n/** Reuse the shell while allowing Pi's native renderer to reuse its own inner component. */\nexport function frameBuiltinResult(content: Component, theme: Theme, previous: Component | undefined): Component {\n return frameDoomToolResult(content, theme, previous);\n}\n\nfunction renderCall(label: string, primary: string, details: readonly string[], theme: Theme): Component {\n let text = renderToolHeading(label, primary, theme);\n if (details.length > 0) text += ` ${theme.fg('muted', `· ${details.join(' · ')}`)}`;\n return new DoomToolCall(text);\n}\n\nfunction optionalCount(value: number | undefined, unit: string): string | undefined {\n return value === undefined ? undefined : `${value} ${unit}`;\n}\n\nfunction compactDetails(values: ReadonlyArray<string | undefined>): string[] {\n return values.filter((value): value is string => value !== undefined && value.length > 0);\n}\n\nexport function renderReadCall(args: ReadToolInput, theme: Theme): Component {\n return renderCall(\n 'read',\n args.path,\n compactDetails([args.offset === undefined ? undefined : `from ${args.offset}`, optionalCount(args.limit, 'lines')]),\n theme,\n );\n}\n\nexport function renderEditCall(args: EditToolInput, theme: Theme): Component {\n const count = args.edits.length;\n return renderCall('edit', args.path, [`${count} edit${count === 1 ? '' : 's'}`], theme);\n}\n\n/**\n * Read appends a bracketed pagination note after a blank line. Detach it so the\n * gutter numbers file content only, and mutate the caller's line list to match.\n */\nfunction takeTrailingNote(lines: string[]): string | undefined {\n const last = lines.at(-1);\n if (last === undefined || !last.startsWith('[') || !last.endsWith(']')) return undefined;\n\n lines.pop();\n while (lines.at(-1) === '') lines.pop();\n return last;\n}\n\nfunction textContent(result: TextToolResult): string {\n return (result.content ?? [])\n .filter((block) => block.type === 'text')\n .map((block) => block.text ?? '')\n .join('\\n')\n .replaceAll('\\t', ' ')\n .replaceAll('\\r\\n', '\\n');\n}\n\nexport function renderEditResult(\n args: EditToolInput,\n result: EditToolResult,\n options: ToolPreviewOptions,\n theme: Theme,\n highlight: Highlighter = highlightCode,\n resolveLanguage: LanguageResolver = getLanguageFromPath,\n): Component {\n if (options.isError) return new BuiltinToolContent(theme.fg('error', textContent(result)));\n\n const diff = result.details?.diff;\n // A successful edit whose details never arrived has nothing worth a frame.\n if (diff === undefined || diff.length === 0) return new BuiltinToolContent('');\n return renderDoomDiff(diff, theme, resolveLanguage(args.path), highlight);\n}\n\nexport function renderWriteCall(\n args: WriteToolInput,\n theme: Theme,\n options: WritePreviewOptions = {},\n highlight: Highlighter = highlightCode,\n resolveLanguage: LanguageResolver = getLanguageFromPath,\n): Component {\n const heading = renderToolHeading('write', args.path, theme);\n const details = theme.fg('muted', `· ${args.content.length.toLocaleString('en-US')} chars`);\n if (args.content.length === 0) return new DoomToolCall(`${heading} ${details}`);\n\n const normalizedLines = args.content.replaceAll('\\t', ' ').replaceAll('\\r\\n', '\\n').split('\\n');\n while (normalizedLines.at(-1) === '') normalizedLines.pop();\n const showLiveTail = options.argsStreaming === true && options.expanded !== true;\n const visibleLines = options.expanded\n ? normalizedLines\n : showLiveTail\n ? normalizedLines.slice(-COLLAPSED_FILE_LINES)\n : normalizedLines.slice(0, COLLAPSED_FILE_LINES);\n const language = resolveLanguage(args.path);\n const highlighted = language\n ? highlight(visibleLines.join('\\n'), language)\n : visibleLines.map((line) => theme.fg('toolOutput', line));\n const hiddenLineCount = normalizedLines.length - visibleLines.length;\n // A live tail shows the file's end, so numbering starts where the tail does.\n const firstVisibleLineNumber = showLiveTail ? hiddenLineCount + 1 : 1;\n const numberWidth = gutterWidth(firstVisibleLineNumber + visibleLines.length - 1);\n const preview = highlighted.map(\n (line, index) => `${renderLineNumber(firstVisibleLineNumber + index, numberWidth, theme)} ${line}`,\n );\n const previewLines = showLiveTail\n ? [\n ...(hiddenLineCount > 0 ? [theme.fg('muted', `… ${hiddenLineCount} earlier lines · live tail`)] : []),\n ...preview,\n ]\n : [\n ...preview,\n ...(hiddenLineCount > 0 ? [theme.fg('muted', `… ${hiddenLineCount} more lines · ctrl+o expand`)] : []),\n ];\n return new DoomToolCall([`${heading} ${details}`, '', ...previewLines].join('\\n'));\n}\n\nexport function renderReadResult(\n args: ReadToolInput,\n result: TextToolResult,\n options: ToolPreviewOptions,\n theme: Theme,\n highlight: Highlighter = highlightCode,\n resolveLanguage: LanguageResolver = getLanguageFromPath,\n): Component {\n const normalizedLines = textContent(result).split('\\n');\n while (normalizedLines.at(-1) === '') normalizedLines.pop();\n if (options.isError) {\n return new BuiltinToolContent(normalizedLines.map((line) => theme.fg('error', line)).join('\\n'));\n }\n\n const note = takeTrailingNote(normalizedLines);\n const visibleLines = options.expanded ? normalizedLines : normalizedLines.slice(0, COLLAPSED_FILE_LINES);\n const language = resolveLanguage(args.path);\n const highlighted = language\n ? highlight(visibleLines.join('\\n'), language)\n : visibleLines.map((line) => theme.fg('toolOutput', line));\n // Read starts at `offset`, so the gutter has to agree with the file, not the excerpt.\n const firstLineNumber = args.offset ?? 1;\n const numberWidth = gutterWidth(firstLineNumber + visibleLines.length - 1);\n const preview = highlighted.map(\n (line, index) => `${renderLineNumber(firstLineNumber + index, numberWidth, theme)} ${line}`,\n );\n const remaining = normalizedLines.length - visibleLines.length;\n if (remaining > 0) preview.push(theme.fg('muted', `… ${remaining} more lines · ctrl+o expand`));\n if (note !== undefined) preview.push(theme.fg('muted', note));\n return new BuiltinToolContent(preview.join('\\n'));\n}\n\nexport function renderGrepCall(args: GrepToolInput, theme: Theme): Component {\n return renderCall(\n 'grep',\n args.pattern,\n compactDetails([\n args.path ?? '.',\n args.glob,\n args.ignoreCase === true ? 'ignore case' : undefined,\n optionalCount(args.limit, 'matches'),\n ]),\n theme,\n );\n}\n\nexport function renderFindCall(args: FindToolInput, theme: Theme): Component {\n return renderCall(\n 'find',\n args.pattern,\n compactDetails([args.path ?? '.', optionalCount(args.limit, 'results')]),\n theme,\n );\n}\n\nexport function renderLsCall(args: LsToolInput, theme: Theme): Component {\n return renderCall('ls', args.path ?? '.', compactDetails([optionalCount(args.limit, 'entries')]), theme);\n}\n"],"mappings":"qLAwCA,IAAM,EAAN,KAA8C,CACf,KAA7B,YAAY,EAA+B,CAAd,KAAA,KAAA,CAAe,CAE5C,OAAO,EAAyB,CAE9B,OADI,GAAS,GAAK,KAAK,KAAK,SAAW,EAAU,CAAC,GAClD,EAAOA,EAAAA,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M,GAAG,aAAc,CAAI,CAAC,EAErD,EAAkB,EAAK,QAAU,EACjC,EAAcE,EAAAA,YAAY,EAAkB,EAAa,OAAS,CAAC,EACnE,EAAU,EAAY,KACzB,EAAM,IAAU,GAAGC,EAAAA,iBAAiB,EAAkB,EAAO,EAAa,CAAK,EAAE,GAAG,GACvF,EACM,EAAY,EAAgB,OAAS,EAAa,OAGxD,OAFI,EAAY,GAAG,EAAQ,KAAK,EAAM,GAAG,QAAS,KAAK,EAAU,4BAA4B,CAAC,EAC1F,IAAS,IAAA,IAAW,EAAQ,KAAK,EAAM,GAAG,QAAS,CAAI,CAAC,EACrD,IAAI,EAAmB,EAAQ,KAAK;CAAI,CAAC,CAClD,CAEA,SAAgB,EAAe,EAAqB,EAAyB,CAC3E,OAAO,EACL,OACA,EAAK,QACL,EAAe,CACb,EAAK,MAAQ,IACb,EAAK,KACL,EAAK,aAAe,GAAO,cAAgB,IAAA,GAC3C,EAAc,EAAK,MAAO,SAAS,CACrC,CAAC,EACD,CACF,CACF,CAEA,SAAgB,EAAe,EAAqB,EAAyB,CAC3E,OAAO,EACL,OACA,EAAK,QACL,EAAe,CAAC,EAAK,MAAQ,IAAK,EAAc,EAAK,MAAO,SAAS,CAAC,CAAC,EACvE,CACF,CACF,CAEA,SAAgB,EAAa,EAAmB,EAAyB,CACvE,OAAO,EAAW,KAAM,EAAK,MAAQ,IAAK,EAAe,CAAC,EAAc,EAAK,MAAO,SAAS,CAAC,CAAC,EAAG,CAAK,CACzG"}
1
+ {"version":3,"file":"builtinToolRender.cjs","names":["wrapTextWithAnsi","previousDoomToolResult","frameDoomToolResult","renderToolHeading","DoomToolCall","highlightCode","getLanguageFromPath","renderDoomDiff","gutterWidth","renderLineNumber"],"sources":["../../src/tui/builtinToolRender.ts"],"sourcesContent":["import {\n type EditToolDetails,\n type EditToolInput,\n type FindToolInput,\n type GrepToolInput,\n getLanguageFromPath,\n highlightCode,\n type LsToolInput,\n type ReadToolInput,\n type Theme,\n type WriteToolInput,\n} from '@earendil-works/pi-coding-agent';\nimport { type Component, wrapTextWithAnsi } from '@earendil-works/pi-tui';\nimport { gutterWidth, renderLineNumber } from './codeGutter.ts';\nimport { renderDoomDiff } from './diffRender.ts';\nimport { DoomToolCall, frameDoomToolResult, previousDoomToolResult, renderToolHeading } from './toolChrome.ts';\n\nconst COLLAPSED_FILE_LINES = 10;\n\ntype Highlighter = (code: string, language?: string) => string[];\ntype LanguageResolver = (path: string) => string | undefined;\n\nexport interface ToolPreviewOptions {\n expanded?: boolean;\n isError?: boolean;\n}\n\nexport interface WritePreviewOptions extends ToolPreviewOptions {\n argsStreaming?: boolean;\n}\n\nexport interface TextToolResult {\n content?: ReadonlyArray<{ type: string; text?: string }>;\n}\n\nexport interface EditToolResult extends TextToolResult {\n details?: EditToolDetails;\n}\n\n/** Self-owned result shell shared by Pi's native file and search tools. */\nclass BuiltinToolContent implements Component {\n constructor(private readonly text: string) {}\n\n render(width: number): string[] {\n if (width <= 0 || this.text.length === 0) return [];\n return wrapTextWithAnsi(this.text, width);\n }\n\n invalidate(): void {\n // Content is immutable and reflows from the current width on every render.\n }\n}\n\n/** Recover the native renderer's component from the shell returned on its previous pass. */\nexport function previousBuiltinResult(component: Component | undefined): Component | undefined {\n return previousDoomToolResult(component);\n}\n\n/** Reuse the shell while allowing Pi's native renderer to reuse its own inner component. */\nexport function frameBuiltinResult(content: Component, theme: Theme, previous: Component | undefined): Component {\n return frameDoomToolResult(content, theme, previous);\n}\n\nfunction renderCall(label: string, primary: string, details: readonly string[], theme: Theme): Component {\n let text = renderToolHeading(label, primary, theme);\n if (details.length > 0) text += ` ${theme.fg('muted', `· ${details.join(' · ')}`)}`;\n return new DoomToolCall(text);\n}\n\nfunction optionalCount(value: number | undefined, unit: string): string | undefined {\n return value === undefined ? undefined : `${value} ${unit}`;\n}\n\nfunction compactDetails(values: ReadonlyArray<string | undefined>): string[] {\n return values.filter((value): value is string => value !== undefined && value.length > 0);\n}\n\nexport function renderReadCall(args: ReadToolInput, theme: Theme): Component {\n return renderCall(\n 'read',\n args.path,\n compactDetails([args.offset === undefined ? undefined : `from ${args.offset}`, optionalCount(args.limit, 'lines')]),\n theme,\n );\n}\n\nexport function renderEditCall(args: EditToolInput, theme: Theme): Component {\n const count = args.edits.length;\n return renderCall('edit', args.path, [`${count} edit${count === 1 ? '' : 's'}`], theme);\n}\n\n/**\n * Read appends a bracketed pagination note after a blank line. Detach it so the\n * gutter numbers file content only, and mutate the caller's line list to match.\n */\nfunction takeTrailingNote(lines: string[]): string | undefined {\n const last = lines.at(-1);\n if (last === undefined || !last.startsWith('[') || !last.endsWith(']')) return undefined;\n\n lines.pop();\n while (lines.at(-1) === '') lines.pop();\n return last;\n}\n\nfunction textContent(result: TextToolResult): string {\n return (result.content ?? [])\n .filter((block) => block.type === 'text')\n .map((block) => block.text ?? '')\n .join('\\n')\n .replaceAll('\\t', ' ')\n .replaceAll('\\r\\n', '\\n');\n}\n\nexport function renderEditResult(\n args: EditToolInput,\n result: EditToolResult,\n options: ToolPreviewOptions,\n theme: Theme,\n highlight: Highlighter = highlightCode,\n resolveLanguage: LanguageResolver = getLanguageFromPath,\n): Component {\n if (options.isError) return new BuiltinToolContent(theme.fg('error', textContent(result)));\n\n const diff = result.details?.diff;\n // A successful edit whose details never arrived has nothing worth a frame.\n if (diff === undefined || diff.length === 0) return new BuiltinToolContent('');\n return renderDoomDiff(diff, theme, resolveLanguage(args.path), highlight);\n}\n\nexport function renderWriteCall(\n args: WriteToolInput,\n theme: Theme,\n options: WritePreviewOptions = {},\n highlight: Highlighter = highlightCode,\n resolveLanguage: LanguageResolver = getLanguageFromPath,\n): Component {\n const heading = renderToolHeading('write', args.path, theme);\n const details = theme.fg('muted', `· ${args.content.length.toLocaleString('en-US')} chars`);\n if (args.content.length === 0) return new DoomToolCall(`${heading} ${details}`);\n\n const normalizedLines = args.content.replaceAll('\\t', ' ').replaceAll('\\r\\n', '\\n').split('\\n');\n while (normalizedLines.at(-1) === '') normalizedLines.pop();\n const showLiveTail = options.argsStreaming === true && options.expanded !== true;\n const visibleLines = options.expanded\n ? normalizedLines\n : showLiveTail\n ? normalizedLines.slice(-COLLAPSED_FILE_LINES)\n : normalizedLines.slice(0, COLLAPSED_FILE_LINES);\n const language = resolveLanguage(args.path);\n const highlighted = language\n ? highlight(visibleLines.join('\\n'), language)\n : visibleLines.map((line) => theme.fg('toolOutput', line));\n const hiddenLineCount = normalizedLines.length - visibleLines.length;\n // A live tail shows the file's end, so numbering starts where the tail does.\n const firstVisibleLineNumber = showLiveTail ? hiddenLineCount + 1 : 1;\n const numberWidth = gutterWidth(firstVisibleLineNumber + visibleLines.length - 1);\n const preview = highlighted.map(\n (line, index) => `${renderLineNumber(firstVisibleLineNumber + index, numberWidth, theme)} ${line}`,\n );\n const previewLines = showLiveTail\n ? [\n ...(hiddenLineCount > 0 ? [theme.fg('muted', `… ${hiddenLineCount} earlier lines · live tail`)] : []),\n ...preview,\n ]\n : [\n ...preview,\n ...(hiddenLineCount > 0 ? [theme.fg('muted', `… ${hiddenLineCount} more lines · ctrl+o expand`)] : []),\n ];\n return new DoomToolCall([`${heading} ${details}`, '', ...previewLines].join('\\n'));\n}\n\nexport function renderReadResult(\n args: ReadToolInput,\n result: TextToolResult,\n options: ToolPreviewOptions,\n theme: Theme,\n highlight: Highlighter = highlightCode,\n resolveLanguage: LanguageResolver = getLanguageFromPath,\n): Component {\n const normalizedLines = textContent(result).split('\\n');\n while (normalizedLines.at(-1) === '') normalizedLines.pop();\n if (options.isError) {\n return new BuiltinToolContent(normalizedLines.map((line) => theme.fg('error', line)).join('\\n'));\n }\n\n const note = takeTrailingNote(normalizedLines);\n const visibleLines = options.expanded ? normalizedLines : normalizedLines.slice(0, COLLAPSED_FILE_LINES);\n const language = resolveLanguage(args.path);\n const highlighted = language\n ? highlight(visibleLines.join('\\n'), language)\n : visibleLines.map((line) => theme.fg('toolOutput', line));\n // Read starts at `offset`, so the gutter has to agree with the file, not the excerpt.\n const firstLineNumber = args.offset ?? 1;\n const numberWidth = gutterWidth(firstLineNumber + visibleLines.length - 1);\n const preview = highlighted.map(\n (line, index) => `${renderLineNumber(firstLineNumber + index, numberWidth, theme)} ${line}`,\n );\n const remaining = normalizedLines.length - visibleLines.length;\n if (remaining > 0) preview.push(theme.fg('muted', `… ${remaining} more lines · ctrl+o expand`));\n if (note !== undefined) preview.push(theme.fg('muted', note));\n return new BuiltinToolContent(preview.join('\\n'));\n}\n\nexport function renderGrepCall(args: GrepToolInput, theme: Theme): Component {\n return renderCall(\n 'grep',\n args.pattern,\n compactDetails([\n args.path ?? '.',\n args.glob,\n args.ignoreCase === true ? 'ignore case' : undefined,\n optionalCount(args.limit, 'matches'),\n ]),\n theme,\n );\n}\n\nexport function renderFindCall(args: FindToolInput, theme: Theme): Component {\n return renderCall(\n 'find',\n args.pattern,\n compactDetails([args.path ?? '.', optionalCount(args.limit, 'results')]),\n theme,\n );\n}\n\nexport function renderLsCall(args: LsToolInput, theme: Theme): Component {\n return renderCall('ls', args.path ?? '.', compactDetails([optionalCount(args.limit, 'entries')]), theme);\n}\n"],"mappings":"qLAwCA,IAAM,EAAN,KAA8C,CACf,KAA7B,YAAY,EAA+B,CAAd,KAAA,KAAA,CAAe,CAE5C,OAAO,EAAyB,CAE9B,OADI,GAAS,GAAK,KAAK,KAAK,SAAW,EAAU,CAAC,GAClD,EAAOA,EAAAA,iBAAAA,CAAiB,KAAK,KAAM,CAAK,CAC1C,CAEA,YAAmB,CAEnB,CACF,EAGA,SAAgB,EAAsB,EAAyD,CAC7F,OAAOC,EAAAA,uBAAuB,CAAS,CACzC,CAGA,SAAgB,EAAmB,EAAoB,EAAc,EAA4C,CAC/G,OAAOC,EAAAA,oBAAoB,EAAS,EAAO,CAAQ,CACrD,CAEA,SAAS,EAAW,EAAe,EAAiB,EAA4B,EAAyB,CACvG,IAAI,EAAOC,EAAAA,kBAAkB,EAAO,EAAS,CAAK,EAElD,OADI,EAAQ,OAAS,IAAG,GAAQ,IAAI,EAAM,G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