@molecule/app-ide-react 1.0.0
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.
- package/LICENSE +115 -0
- package/dist/chatTimelineOrdering.d.ts +50 -0
- package/dist/chatTimelineOrdering.d.ts.map +1 -0
- package/dist/chatTimelineOrdering.js +46 -0
- package/dist/chatTimelineOrdering.js.map +1 -0
- package/dist/command-metadata.d.ts +78 -0
- package/dist/command-metadata.d.ts.map +1 -0
- package/dist/command-metadata.js +214 -0
- package/dist/command-metadata.js.map +1 -0
- package/dist/components/ActivityCard.d.ts +28 -0
- package/dist/components/ActivityCard.d.ts.map +1 -0
- package/dist/components/ActivityCard.js +62 -0
- package/dist/components/ActivityCard.js.map +1 -0
- package/dist/components/AutoCommitBadge.d.ts +58 -0
- package/dist/components/AutoCommitBadge.d.ts.map +1 -0
- package/dist/components/AutoCommitBadge.js +78 -0
- package/dist/components/AutoCommitBadge.js.map +1 -0
- package/dist/components/ChatPanel.d.ts +184 -0
- package/dist/components/ChatPanel.d.ts.map +1 -0
- package/dist/components/ChatPanel.js +6691 -0
- package/dist/components/ChatPanel.js.map +1 -0
- package/dist/components/CommandPalette.d.ts +18 -0
- package/dist/components/CommandPalette.d.ts.map +1 -0
- package/dist/components/CommandPalette.js +33 -0
- package/dist/components/CommandPalette.js.map +1 -0
- package/dist/components/DeviceFrameSelector.d.ts +60 -0
- package/dist/components/DeviceFrameSelector.d.ts.map +1 -0
- package/dist/components/DeviceFrameSelector.js +230 -0
- package/dist/components/DeviceFrameSelector.js.map +1 -0
- package/dist/components/EditorPanel.d.ts +17 -0
- package/dist/components/EditorPanel.d.ts.map +1 -0
- package/dist/components/EditorPanel.js +241 -0
- package/dist/components/EditorPanel.js.map +1 -0
- package/dist/components/FileExplorer.d.ts +64 -0
- package/dist/components/FileExplorer.d.ts.map +1 -0
- package/dist/components/FileExplorer.js +1111 -0
- package/dist/components/FileExplorer.js.map +1 -0
- package/dist/components/FileExplorerContextMenu.d.ts +37 -0
- package/dist/components/FileExplorerContextMenu.d.ts.map +1 -0
- package/dist/components/FileExplorerContextMenu.js +241 -0
- package/dist/components/FileExplorerContextMenu.js.map +1 -0
- package/dist/components/HelpCard.d.ts +34 -0
- package/dist/components/HelpCard.d.ts.map +1 -0
- package/dist/components/HelpCard.js +28 -0
- package/dist/components/HelpCard.js.map +1 -0
- package/dist/components/Icon.d.ts +50 -0
- package/dist/components/Icon.d.ts.map +1 -0
- package/dist/components/Icon.js +25 -0
- package/dist/components/Icon.js.map +1 -0
- package/dist/components/KeyboardShortcutsPanel.d.ts +19 -0
- package/dist/components/KeyboardShortcutsPanel.d.ts.map +1 -0
- package/dist/components/KeyboardShortcutsPanel.js +187 -0
- package/dist/components/KeyboardShortcutsPanel.js.map +1 -0
- package/dist/components/MarkdownContent.d.ts +52 -0
- package/dist/components/MarkdownContent.d.ts.map +1 -0
- package/dist/components/MarkdownContent.js +303 -0
- package/dist/components/MarkdownContent.js.map +1 -0
- package/dist/components/ModelsTable.d.ts +38 -0
- package/dist/components/ModelsTable.d.ts.map +1 -0
- package/dist/components/ModelsTable.js +96 -0
- package/dist/components/ModelsTable.js.map +1 -0
- package/dist/components/PreviewPanel.d.ts +66 -0
- package/dist/components/PreviewPanel.d.ts.map +1 -0
- package/dist/components/PreviewPanel.js +1752 -0
- package/dist/components/PreviewPanel.js.map +1 -0
- package/dist/components/QuickOpen.d.ts +20 -0
- package/dist/components/QuickOpen.d.ts.map +1 -0
- package/dist/components/QuickOpen.js +72 -0
- package/dist/components/QuickOpen.js.map +1 -0
- package/dist/components/QuickPicker.d.ts +21 -0
- package/dist/components/QuickPicker.d.ts.map +1 -0
- package/dist/components/QuickPicker.js +174 -0
- package/dist/components/QuickPicker.js.map +1 -0
- package/dist/components/RelevantSkillSuggestion.d.ts +41 -0
- package/dist/components/RelevantSkillSuggestion.d.ts.map +1 -0
- package/dist/components/RelevantSkillSuggestion.js +85 -0
- package/dist/components/RelevantSkillSuggestion.js.map +1 -0
- package/dist/components/ReportModal.d.ts +35 -0
- package/dist/components/ReportModal.d.ts.map +1 -0
- package/dist/components/ReportModal.js +112 -0
- package/dist/components/ReportModal.js.map +1 -0
- package/dist/components/ResizeHandle.d.ts +21 -0
- package/dist/components/ResizeHandle.d.ts.map +1 -0
- package/dist/components/ResizeHandle.js +109 -0
- package/dist/components/ResizeHandle.js.map +1 -0
- package/dist/components/ScriptsCard.d.ts +37 -0
- package/dist/components/ScriptsCard.d.ts.map +1 -0
- package/dist/components/ScriptsCard.js +177 -0
- package/dist/components/ScriptsCard.js.map +1 -0
- package/dist/components/SearchPanel.d.ts +18 -0
- package/dist/components/SearchPanel.d.ts.map +1 -0
- package/dist/components/SearchPanel.js +449 -0
- package/dist/components/SearchPanel.js.map +1 -0
- package/dist/components/SettingsCard.d.ts +49 -0
- package/dist/components/SettingsCard.d.ts.map +1 -0
- package/dist/components/SettingsCard.js +59 -0
- package/dist/components/SettingsCard.js.map +1 -0
- package/dist/components/ShareModal.d.ts +32 -0
- package/dist/components/ShareModal.d.ts.map +1 -0
- package/dist/components/ShareModal.js +126 -0
- package/dist/components/ShareModal.js.map +1 -0
- package/dist/components/SidebarTabs.d.ts +18 -0
- package/dist/components/SidebarTabs.d.ts.map +1 -0
- package/dist/components/SidebarTabs.js +20 -0
- package/dist/components/SidebarTabs.js.map +1 -0
- package/dist/components/SkillsCard.d.ts +86 -0
- package/dist/components/SkillsCard.d.ts.map +1 -0
- package/dist/components/SkillsCard.js +227 -0
- package/dist/components/SkillsCard.js.map +1 -0
- package/dist/components/StreamingIndicator.d.ts +50 -0
- package/dist/components/StreamingIndicator.d.ts.map +1 -0
- package/dist/components/StreamingIndicator.js +142 -0
- package/dist/components/StreamingIndicator.js.map +1 -0
- package/dist/components/TabBar.d.ts +37 -0
- package/dist/components/TabBar.d.ts.map +1 -0
- package/dist/components/TabBar.js +187 -0
- package/dist/components/TabBar.js.map +1 -0
- package/dist/components/TipCard.d.ts +22 -0
- package/dist/components/TipCard.d.ts.map +1 -0
- package/dist/components/TipCard.js +73 -0
- package/dist/components/TipCard.js.map +1 -0
- package/dist/components/ToolCallCard.d.ts +18 -0
- package/dist/components/ToolCallCard.d.ts.map +1 -0
- package/dist/components/ToolCallCard.js +716 -0
- package/dist/components/ToolCallCard.js.map +1 -0
- package/dist/components/UserAvatar.d.ts +45 -0
- package/dist/components/UserAvatar.d.ts.map +1 -0
- package/dist/components/UserAvatar.js +80 -0
- package/dist/components/UserAvatar.js.map +1 -0
- package/dist/components/WorkspaceLayout.d.ts +19 -0
- package/dist/components/WorkspaceLayout.d.ts.map +1 -0
- package/dist/components/WorkspaceLayout.js +56 -0
- package/dist/components/WorkspaceLayout.js.map +1 -0
- package/dist/components/activity-utilities.d.ts +107 -0
- package/dist/components/activity-utilities.d.ts.map +1 -0
- package/dist/components/activity-utilities.js +154 -0
- package/dist/components/activity-utilities.js.map +1 -0
- package/dist/components/chat-autocommit-utilities.d.ts +172 -0
- package/dist/components/chat-autocommit-utilities.d.ts.map +1 -0
- package/dist/components/chat-autocommit-utilities.js +185 -0
- package/dist/components/chat-autocommit-utilities.js.map +1 -0
- package/dist/components/chat-card-style.d.ts +64 -0
- package/dist/components/chat-card-style.d.ts.map +1 -0
- package/dist/components/chat-card-style.js +74 -0
- package/dist/components/chat-card-style.js.map +1 -0
- package/dist/components/chat-commands.d.ts +17 -0
- package/dist/components/chat-commands.d.ts.map +1 -0
- package/dist/components/chat-commands.js +17 -0
- package/dist/components/chat-commands.js.map +1 -0
- package/dist/components/chat-commit-utilities.d.ts +29 -0
- package/dist/components/chat-commit-utilities.d.ts.map +1 -0
- package/dist/components/chat-commit-utilities.js +31 -0
- package/dist/components/chat-commit-utilities.js.map +1 -0
- package/dist/components/chat-cost-utilities.d.ts +62 -0
- package/dist/components/chat-cost-utilities.d.ts.map +1 -0
- package/dist/components/chat-cost-utilities.js +66 -0
- package/dist/components/chat-cost-utilities.js.map +1 -0
- package/dist/components/chat-effort-utilities.d.ts +96 -0
- package/dist/components/chat-effort-utilities.d.ts.map +1 -0
- package/dist/components/chat-effort-utilities.js +97 -0
- package/dist/components/chat-effort-utilities.js.map +1 -0
- package/dist/components/chat-help-utilities.d.ts +89 -0
- package/dist/components/chat-help-utilities.d.ts.map +1 -0
- package/dist/components/chat-help-utilities.js +131 -0
- package/dist/components/chat-help-utilities.js.map +1 -0
- package/dist/components/chat-model-mode-utilities.d.ts +143 -0
- package/dist/components/chat-model-mode-utilities.d.ts.map +1 -0
- package/dist/components/chat-model-mode-utilities.js +191 -0
- package/dist/components/chat-model-mode-utilities.js.map +1 -0
- package/dist/components/chat-models-utilities.d.ts +98 -0
- package/dist/components/chat-models-utilities.d.ts.map +1 -0
- package/dist/components/chat-models-utilities.js +136 -0
- package/dist/components/chat-models-utilities.js.map +1 -0
- package/dist/components/chat-report-utilities.d.ts +149 -0
- package/dist/components/chat-report-utilities.d.ts.map +1 -0
- package/dist/components/chat-report-utilities.js +151 -0
- package/dist/components/chat-report-utilities.js.map +1 -0
- package/dist/components/chat-scripts-utilities.d.ts +140 -0
- package/dist/components/chat-scripts-utilities.d.ts.map +1 -0
- package/dist/components/chat-scripts-utilities.js +158 -0
- package/dist/components/chat-scripts-utilities.js.map +1 -0
- package/dist/components/chat-settings-utilities.d.ts +72 -0
- package/dist/components/chat-settings-utilities.d.ts.map +1 -0
- package/dist/components/chat-settings-utilities.js +56 -0
- package/dist/components/chat-settings-utilities.js.map +1 -0
- package/dist/components/chat-share-utilities.d.ts +104 -0
- package/dist/components/chat-share-utilities.d.ts.map +1 -0
- package/dist/components/chat-share-utilities.js +90 -0
- package/dist/components/chat-share-utilities.js.map +1 -0
- package/dist/components/chat-skills-utilities.d.ts +242 -0
- package/dist/components/chat-skills-utilities.d.ts.map +1 -0
- package/dist/components/chat-skills-utilities.js +433 -0
- package/dist/components/chat-skills-utilities.js.map +1 -0
- package/dist/components/chat-stream-utilities.d.ts +74 -0
- package/dist/components/chat-stream-utilities.d.ts.map +1 -0
- package/dist/components/chat-stream-utilities.js +103 -0
- package/dist/components/chat-stream-utilities.js.map +1 -0
- package/dist/components/chat-tips-utilities.d.ts +108 -0
- package/dist/components/chat-tips-utilities.d.ts.map +1 -0
- package/dist/components/chat-tips-utilities.js +137 -0
- package/dist/components/chat-tips-utilities.js.map +1 -0
- package/dist/components/device-cycle.d.ts +84 -0
- package/dist/components/device-cycle.d.ts.map +1 -0
- package/dist/components/device-cycle.js +77 -0
- package/dist/components/device-cycle.js.map +1 -0
- package/dist/components/index.d.ts +36 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +33 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/tool-call-utilities.d.ts +69 -0
- package/dist/components/tool-call-utilities.d.ts.map +1 -0
- package/dist/components/tool-call-utilities.js +368 -0
- package/dist/components/tool-call-utilities.js.map +1 -0
- package/dist/components/user-avatar-utilities.d.ts +41 -0
- package/dist/components/user-avatar-utilities.d.ts.map +1 -0
- package/dist/components/user-avatar-utilities.js +56 -0
- package/dist/components/user-avatar-utilities.js.map +1 -0
- package/dist/components/workspace-layout-utilities.d.ts +37 -0
- package/dist/components/workspace-layout-utilities.d.ts.map +1 -0
- package/dist/components/workspace-layout-utilities.js +58 -0
- package/dist/components/workspace-layout-utilities.js.map +1 -0
- package/dist/customEventCards.d.ts +117 -0
- package/dist/customEventCards.d.ts.map +1 -0
- package/dist/customEventCards.js +36 -0
- package/dist/customEventCards.js.map +1 -0
- package/dist/hooks/index.d.ts +8 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +8 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/useKeyboardShortcuts.d.ts +48 -0
- package/dist/hooks/useKeyboardShortcuts.d.ts.map +1 -0
- package/dist/hooks/useKeyboardShortcuts.js +112 -0
- package/dist/hooks/useKeyboardShortcuts.js.map +1 -0
- package/dist/hooks/useViewport.d.ts +42 -0
- package/dist/hooks/useViewport.d.ts.map +1 -0
- package/dist/hooks/useViewport.js +61 -0
- package/dist/hooks/useViewport.js.map +1 -0
- package/dist/index.d.ts +75 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +74 -0
- package/dist/index.js.map +1 -0
- package/dist/settings-metadata.d.ts +78 -0
- package/dist/settings-metadata.d.ts.map +1 -0
- package/dist/settings-metadata.js +131 -0
- package/dist/settings-metadata.js.map +1 -0
- package/dist/types.d.ts +751 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +25 -0
- package/dist/types.js.map +1 -0
- package/package.json +90 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure helpers backing the `/cost` command card.
|
|
3
|
+
*
|
|
4
|
+
* The card renders what `GET /projects/:id/chat-usage` returns for the current
|
|
5
|
+
* conversation. The one thing that is NOT obvious from the payload — and that
|
|
6
|
+
* made the card look broken next to a provider dashboard — is what
|
|
7
|
+
* `inputTokens` means:
|
|
8
|
+
*
|
|
9
|
+
* - Every AI bond normalizes usage into **disjoint** buckets: `inputTokens`
|
|
10
|
+
* (uncached prompt), `cacheReadInputTokens` (cache hits) and
|
|
11
|
+
* `cacheCreationInputTokens` (cache writes). On OpenAI-compatible APIs
|
|
12
|
+
* (DeepSeek, Alibaba, Moonshot) the wire format is the opposite — `prompt_tokens`
|
|
13
|
+
* is the TOTAL and `prompt_tokens_details.cached_tokens` is a subset of it — so
|
|
14
|
+
* those bonds subtract before reporting. Anthropic already reports them
|
|
15
|
+
* separately and nothing is subtracted.
|
|
16
|
+
* - A provider's usage dashboard reports **total tokens processed**, cache hits
|
|
17
|
+
* included. So `inputTokens` alone is not comparable to it, and in a long
|
|
18
|
+
* agentic turn (where each iteration replays the whole conversation against a
|
|
19
|
+
* warm cache) the cached share is the overwhelming majority of the volume.
|
|
20
|
+
*
|
|
21
|
+
* {@link totalPromptTokens} is therefore the figure to compare against a provider
|
|
22
|
+
* dashboard, and {@link formatTokenTotal} is the shared abbreviation used on the
|
|
23
|
+
* card. Both are deterministic and side-effect free so they can be unit tested
|
|
24
|
+
* without rendering or a real backend; the component supplies `t()`.
|
|
25
|
+
*
|
|
26
|
+
* @module
|
|
27
|
+
*/
|
|
28
|
+
/** The usage-shaped subset of `GET /projects/:id/chat-usage` the cost card reads. */
|
|
29
|
+
export interface ChatUsageTokens {
|
|
30
|
+
/** Uncached prompt tokens. NOT the provider's `prompt_tokens` — cache hits are excluded. */
|
|
31
|
+
inputTokens: number;
|
|
32
|
+
/** Generated tokens. */
|
|
33
|
+
outputTokens: number;
|
|
34
|
+
/** Prompt tokens served from the provider's cache. */
|
|
35
|
+
cacheReadInputTokens?: number;
|
|
36
|
+
/** Prompt tokens written into the provider's cache. */
|
|
37
|
+
cacheCreationInputTokens?: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Abbreviate a token count for display (`1.2M`, `340.5K`, `812`).
|
|
41
|
+
*
|
|
42
|
+
* @param n - The token count.
|
|
43
|
+
* @returns The abbreviated string.
|
|
44
|
+
*/
|
|
45
|
+
export declare function formatTokenTotal(n: number): string;
|
|
46
|
+
/**
|
|
47
|
+
* Total CACHED prompt tokens — reads plus writes.
|
|
48
|
+
*
|
|
49
|
+
* @param usage - The usage payload.
|
|
50
|
+
* @returns The combined cached-token count (0 when the provider reports none).
|
|
51
|
+
*/
|
|
52
|
+
export declare function cachedPromptTokens(usage: ChatUsageTokens): number;
|
|
53
|
+
/**
|
|
54
|
+
* Total prompt tokens the provider actually processed — uncached + cached. This
|
|
55
|
+
* is the figure that lines up with a provider usage dashboard; `inputTokens` on
|
|
56
|
+
* its own does not, because the bonds report the buckets disjointly.
|
|
57
|
+
*
|
|
58
|
+
* @param usage - The usage payload.
|
|
59
|
+
* @returns Uncached input plus every cached prompt token.
|
|
60
|
+
*/
|
|
61
|
+
export declare function totalPromptTokens(usage: ChatUsageTokens): number;
|
|
62
|
+
//# sourceMappingURL=chat-cost-utilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-cost-utilities.d.ts","sourceRoot":"","sources":["../../src/components/chat-cost-utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,qFAAqF;AACrF,MAAM,WAAW,eAAe;IAC9B,4FAA4F;IAC5F,WAAW,EAAE,MAAM,CAAA;IACnB,wBAAwB;IACxB,YAAY,EAAE,MAAM,CAAA;IACpB,sDAAsD;IACtD,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,uDAAuD;IACvD,wBAAwB,CAAC,EAAE,MAAM,CAAA;CAClC;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAKlD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAIjE;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAGhE"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure helpers backing the `/cost` command card.
|
|
3
|
+
*
|
|
4
|
+
* The card renders what `GET /projects/:id/chat-usage` returns for the current
|
|
5
|
+
* conversation. The one thing that is NOT obvious from the payload — and that
|
|
6
|
+
* made the card look broken next to a provider dashboard — is what
|
|
7
|
+
* `inputTokens` means:
|
|
8
|
+
*
|
|
9
|
+
* - Every AI bond normalizes usage into **disjoint** buckets: `inputTokens`
|
|
10
|
+
* (uncached prompt), `cacheReadInputTokens` (cache hits) and
|
|
11
|
+
* `cacheCreationInputTokens` (cache writes). On OpenAI-compatible APIs
|
|
12
|
+
* (DeepSeek, Alibaba, Moonshot) the wire format is the opposite — `prompt_tokens`
|
|
13
|
+
* is the TOTAL and `prompt_tokens_details.cached_tokens` is a subset of it — so
|
|
14
|
+
* those bonds subtract before reporting. Anthropic already reports them
|
|
15
|
+
* separately and nothing is subtracted.
|
|
16
|
+
* - A provider's usage dashboard reports **total tokens processed**, cache hits
|
|
17
|
+
* included. So `inputTokens` alone is not comparable to it, and in a long
|
|
18
|
+
* agentic turn (where each iteration replays the whole conversation against a
|
|
19
|
+
* warm cache) the cached share is the overwhelming majority of the volume.
|
|
20
|
+
*
|
|
21
|
+
* {@link totalPromptTokens} is therefore the figure to compare against a provider
|
|
22
|
+
* dashboard, and {@link formatTokenTotal} is the shared abbreviation used on the
|
|
23
|
+
* card. Both are deterministic and side-effect free so they can be unit tested
|
|
24
|
+
* without rendering or a real backend; the component supplies `t()`.
|
|
25
|
+
*
|
|
26
|
+
* @module
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* Abbreviate a token count for display (`1.2M`, `340.5K`, `812`).
|
|
30
|
+
*
|
|
31
|
+
* @param n - The token count.
|
|
32
|
+
* @returns The abbreviated string.
|
|
33
|
+
*/
|
|
34
|
+
export function formatTokenTotal(n) {
|
|
35
|
+
if (!Number.isFinite(n) || n <= 0)
|
|
36
|
+
return '0';
|
|
37
|
+
if (n >= 1_000_000)
|
|
38
|
+
return `${(n / 1_000_000).toFixed(1)}M`;
|
|
39
|
+
if (n >= 1_000)
|
|
40
|
+
return `${(n / 1_000).toFixed(1)}K`;
|
|
41
|
+
return String(Math.round(n));
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Total CACHED prompt tokens — reads plus writes.
|
|
45
|
+
*
|
|
46
|
+
* @param usage - The usage payload.
|
|
47
|
+
* @returns The combined cached-token count (0 when the provider reports none).
|
|
48
|
+
*/
|
|
49
|
+
export function cachedPromptTokens(usage) {
|
|
50
|
+
const read = usage.cacheReadInputTokens ?? 0;
|
|
51
|
+
const write = usage.cacheCreationInputTokens ?? 0;
|
|
52
|
+
return (Number.isFinite(read) ? read : 0) + (Number.isFinite(write) ? write : 0);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Total prompt tokens the provider actually processed — uncached + cached. This
|
|
56
|
+
* is the figure that lines up with a provider usage dashboard; `inputTokens` on
|
|
57
|
+
* its own does not, because the bonds report the buckets disjointly.
|
|
58
|
+
*
|
|
59
|
+
* @param usage - The usage payload.
|
|
60
|
+
* @returns Uncached input plus every cached prompt token.
|
|
61
|
+
*/
|
|
62
|
+
export function totalPromptTokens(usage) {
|
|
63
|
+
const input = Number.isFinite(usage.inputTokens) ? usage.inputTokens : 0;
|
|
64
|
+
return input + cachedPromptTokens(usage);
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=chat-cost-utilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-cost-utilities.js","sourceRoot":"","sources":["../../src/components/chat-cost-utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAcH;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,CAAS;IACxC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,GAAG,CAAA;IAC7C,IAAI,CAAC,IAAI,SAAS;QAAE,OAAO,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAA;IAC3D,IAAI,CAAC,IAAI,KAAK;QAAE,OAAO,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAA;IACnD,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;AAC9B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAsB;IACvD,MAAM,IAAI,GAAG,KAAK,CAAC,oBAAoB,IAAI,CAAC,CAAA;IAC5C,MAAM,KAAK,GAAG,KAAK,CAAC,wBAAwB,IAAI,CAAC,CAAA;IACjD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAClF,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAsB;IACtD,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAA;IACxE,OAAO,KAAK,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAA;AAC1C,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure helpers backing the `/effort` command and its status view.
|
|
3
|
+
*
|
|
4
|
+
* Effort is persisted PER MODE (`settings.effortByMode`, with the legacy single
|
|
5
|
+
* `settings.effortLevel` as fallback) as the model's OWN native value — there is
|
|
6
|
+
* no abstract scale. Users see and type the ACTIVE MODEL's own effort values
|
|
7
|
+
* (`xhigh` on Claude Opus 4.8, `medium` on Grok 4.3, `16K` thinking tokens on
|
|
8
|
+
* budget-configurable models …), which vary per model and therefore per mode:
|
|
9
|
+
* plan and execute run different models, so each mode carries its own value
|
|
10
|
+
* chosen from its own model's levels.
|
|
11
|
+
*
|
|
12
|
+
* Command shapes:
|
|
13
|
+
* - `/effort` or `/effort ?` — status for every mode.
|
|
14
|
+
* - `/effort <value>` — set the CURRENT mode's effort to a native value.
|
|
15
|
+
* - `/effort --plan <value>` / `/effort --execute <value>` — set a specific
|
|
16
|
+
* mode's effort (mirrors `/model --plan` / `--execute`).
|
|
17
|
+
*
|
|
18
|
+
* Deterministic and side-effect free — unit testable without rendering or a
|
|
19
|
+
* backend. User-facing prose lives in the component via `t()`.
|
|
20
|
+
*
|
|
21
|
+
* @module
|
|
22
|
+
*/
|
|
23
|
+
import type { AppModelDefinition, EffortLevel, EffortOption } from '@molecule/app-ai-models';
|
|
24
|
+
export type { EffortLevel, EffortOption };
|
|
25
|
+
export { defaultEffortForModel, effortOptionsForModel, nativeEffortName, } from '@molecule/app-ai-models';
|
|
26
|
+
/**
|
|
27
|
+
* Conversation modes that carry their own effort level. Kept as a plain string
|
|
28
|
+
* union locally (mirrors the chat mode type); future modes extend this without
|
|
29
|
+
* changing the settings shape — `effortByMode` is keyed by mode id.
|
|
30
|
+
*/
|
|
31
|
+
export type EffortMode = 'plan' | 'execute';
|
|
32
|
+
/**
|
|
33
|
+
* The parsed result of an `/effort` command:
|
|
34
|
+
*
|
|
35
|
+
* - `set` — apply the (still-unresolved) native value `arg`, optionally scoped
|
|
36
|
+
* to a specific `mode` via `--plan` / `--execute` (unscoped = current mode).
|
|
37
|
+
* Resolve `arg` against the target model's options with
|
|
38
|
+
* {@link resolveEffortArg} — parsing is purely syntactic because the valid
|
|
39
|
+
* values depend on which model the target mode runs.
|
|
40
|
+
* - `query` — show the status view (`/effort` or `/effort ?`).
|
|
41
|
+
* - `invalid` — unrecognized flags/arguments (the caller shows usage).
|
|
42
|
+
*/
|
|
43
|
+
export type EffortCommand = {
|
|
44
|
+
kind: 'set';
|
|
45
|
+
arg: string;
|
|
46
|
+
mode?: EffortMode;
|
|
47
|
+
} | {
|
|
48
|
+
kind: 'query';
|
|
49
|
+
mode?: EffortMode;
|
|
50
|
+
} | {
|
|
51
|
+
kind: 'invalid';
|
|
52
|
+
arg: string;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Parses an `/effort [--plan|--execute] [arg]` command. Purely syntactic — the
|
|
56
|
+
* caller resolves `arg` against the target mode's model via
|
|
57
|
+
* {@link resolveEffortArg}. Returns `null` when the input is not the command.
|
|
58
|
+
*
|
|
59
|
+
* @param input - The raw chat input.
|
|
60
|
+
* @returns The parsed {@link EffortCommand}, or `null`.
|
|
61
|
+
*/
|
|
62
|
+
export declare function parseEffortCommand(input: string): EffortCommand | null;
|
|
63
|
+
/**
|
|
64
|
+
* Resolve a user-typed effort value against a model's selectable options.
|
|
65
|
+
*
|
|
66
|
+
* Matches the model's own native values case-insensitively (`xhigh`, `16K`, …)
|
|
67
|
+
* and returns the canonical value to persist. Returns `null` when the input
|
|
68
|
+
* doesn't name one of the model's levels.
|
|
69
|
+
*
|
|
70
|
+
* @param arg - The raw value the user typed.
|
|
71
|
+
* @param options - The target model's options (see `effortOptionsForModel`).
|
|
72
|
+
* @returns The native value to persist, or `null` when nothing matches.
|
|
73
|
+
*/
|
|
74
|
+
export declare function resolveEffortArg(arg: string, options: readonly EffortOption[]): EffortLevel | null;
|
|
75
|
+
/**
|
|
76
|
+
* The catalog models that expose a *configurable* reasoning/thinking budget —
|
|
77
|
+
* i.e. those where the effort level maps onto a provider reasoning param. Models
|
|
78
|
+
* with no configurable budget still get the agent-loop budget applied by the
|
|
79
|
+
* backend, but these are the ones the `?` view highlights.
|
|
80
|
+
*
|
|
81
|
+
* @param models - The available models from the catalog.
|
|
82
|
+
* @returns The models supporting a configurable reasoning budget, in input order.
|
|
83
|
+
*/
|
|
84
|
+
export declare function modelsSupportingEffort(models: readonly AppModelDefinition[]): AppModelDefinition[];
|
|
85
|
+
/**
|
|
86
|
+
* The effort levels the `/effort` command offers and accepts for a *specific*
|
|
87
|
+
* model — the model's own native values, ascending (e.g.
|
|
88
|
+
* `['low', 'high', 'xhigh', 'max']`). Empty for a fixed-reasoning model
|
|
89
|
+
* (`grok-code-fast-1`, the DeepSeek executors) or an unknown model, which
|
|
90
|
+
* expose no effort choice.
|
|
91
|
+
*
|
|
92
|
+
* @param model - The active model to read levels from, or `undefined`.
|
|
93
|
+
* @returns The model's effort levels in ascending order (empty when it has none).
|
|
94
|
+
*/
|
|
95
|
+
export declare function effortLevelsForModel(model: AppModelDefinition | undefined): readonly string[];
|
|
96
|
+
//# sourceMappingURL=chat-effort-utilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-effort-utilities.d.ts","sourceRoot":"","sources":["../../src/components/chat-effort-utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAE5F,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,CAAA;AACzC,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,yBAAyB,CAAA;AAEhC;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,SAAS,CAAA;AAE3C;;;;;;;;;;GAUG;AACH,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,UAAU,CAAA;CAAE,GAC/C;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,UAAU,CAAA;CAAE,GACpC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAA;AAEpC;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAiBtE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,SAAS,YAAY,EAAE,GAC/B,WAAW,GAAG,IAAI,CAGpB;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,SAAS,kBAAkB,EAAE,GACpC,kBAAkB,EAAE,CAEtB;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,kBAAkB,GAAG,SAAS,GAAG,SAAS,MAAM,EAAE,CAE7F"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure helpers backing the `/effort` command and its status view.
|
|
3
|
+
*
|
|
4
|
+
* Effort is persisted PER MODE (`settings.effortByMode`, with the legacy single
|
|
5
|
+
* `settings.effortLevel` as fallback) as the model's OWN native value — there is
|
|
6
|
+
* no abstract scale. Users see and type the ACTIVE MODEL's own effort values
|
|
7
|
+
* (`xhigh` on Claude Opus 4.8, `medium` on Grok 4.3, `16K` thinking tokens on
|
|
8
|
+
* budget-configurable models …), which vary per model and therefore per mode:
|
|
9
|
+
* plan and execute run different models, so each mode carries its own value
|
|
10
|
+
* chosen from its own model's levels.
|
|
11
|
+
*
|
|
12
|
+
* Command shapes:
|
|
13
|
+
* - `/effort` or `/effort ?` — status for every mode.
|
|
14
|
+
* - `/effort <value>` — set the CURRENT mode's effort to a native value.
|
|
15
|
+
* - `/effort --plan <value>` / `/effort --execute <value>` — set a specific
|
|
16
|
+
* mode's effort (mirrors `/model --plan` / `--execute`).
|
|
17
|
+
*
|
|
18
|
+
* Deterministic and side-effect free — unit testable without rendering or a
|
|
19
|
+
* backend. User-facing prose lives in the component via `t()`.
|
|
20
|
+
*
|
|
21
|
+
* @module
|
|
22
|
+
*/
|
|
23
|
+
export { defaultEffortForModel, effortOptionsForModel, nativeEffortName, } from '@molecule/app-ai-models';
|
|
24
|
+
/**
|
|
25
|
+
* Parses an `/effort [--plan|--execute] [arg]` command. Purely syntactic — the
|
|
26
|
+
* caller resolves `arg` against the target mode's model via
|
|
27
|
+
* {@link resolveEffortArg}. Returns `null` when the input is not the command.
|
|
28
|
+
*
|
|
29
|
+
* @param input - The raw chat input.
|
|
30
|
+
* @returns The parsed {@link EffortCommand}, or `null`.
|
|
31
|
+
*/
|
|
32
|
+
export function parseEffortCommand(input) {
|
|
33
|
+
const match = input.trim().match(/^\/effort(?:\s+(.*))?$/i);
|
|
34
|
+
if (!match)
|
|
35
|
+
return null;
|
|
36
|
+
const tokens = (match[1] ?? '').trim().split(/\s+/).filter(Boolean);
|
|
37
|
+
let mode;
|
|
38
|
+
const rest = [];
|
|
39
|
+
for (const token of tokens) {
|
|
40
|
+
const lower = token.toLowerCase();
|
|
41
|
+
if (lower === '--plan')
|
|
42
|
+
mode = 'plan';
|
|
43
|
+
else if (lower === '--execute')
|
|
44
|
+
mode = 'execute';
|
|
45
|
+
else
|
|
46
|
+
rest.push(token);
|
|
47
|
+
}
|
|
48
|
+
if (rest.length === 0)
|
|
49
|
+
return { kind: 'query', mode };
|
|
50
|
+
if (rest.length > 1)
|
|
51
|
+
return { kind: 'invalid', arg: rest.join(' ') };
|
|
52
|
+
const arg = rest[0];
|
|
53
|
+
if (arg === '?')
|
|
54
|
+
return { kind: 'query', mode };
|
|
55
|
+
return { kind: 'set', arg, mode };
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Resolve a user-typed effort value against a model's selectable options.
|
|
59
|
+
*
|
|
60
|
+
* Matches the model's own native values case-insensitively (`xhigh`, `16K`, …)
|
|
61
|
+
* and returns the canonical value to persist. Returns `null` when the input
|
|
62
|
+
* doesn't name one of the model's levels.
|
|
63
|
+
*
|
|
64
|
+
* @param arg - The raw value the user typed.
|
|
65
|
+
* @param options - The target model's options (see `effortOptionsForModel`).
|
|
66
|
+
* @returns The native value to persist, or `null` when nothing matches.
|
|
67
|
+
*/
|
|
68
|
+
export function resolveEffortArg(arg, options) {
|
|
69
|
+
const lower = arg.toLowerCase();
|
|
70
|
+
return options.find((o) => o.value.toLowerCase() === lower)?.value ?? null;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The catalog models that expose a *configurable* reasoning/thinking budget —
|
|
74
|
+
* i.e. those where the effort level maps onto a provider reasoning param. Models
|
|
75
|
+
* with no configurable budget still get the agent-loop budget applied by the
|
|
76
|
+
* backend, but these are the ones the `?` view highlights.
|
|
77
|
+
*
|
|
78
|
+
* @param models - The available models from the catalog.
|
|
79
|
+
* @returns The models supporting a configurable reasoning budget, in input order.
|
|
80
|
+
*/
|
|
81
|
+
export function modelsSupportingEffort(models) {
|
|
82
|
+
return models.filter((m) => m.supportsThinking && m.thinkingConfigurable);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The effort levels the `/effort` command offers and accepts for a *specific*
|
|
86
|
+
* model — the model's own native values, ascending (e.g.
|
|
87
|
+
* `['low', 'high', 'xhigh', 'max']`). Empty for a fixed-reasoning model
|
|
88
|
+
* (`grok-code-fast-1`, the DeepSeek executors) or an unknown model, which
|
|
89
|
+
* expose no effort choice.
|
|
90
|
+
*
|
|
91
|
+
* @param model - The active model to read levels from, or `undefined`.
|
|
92
|
+
* @returns The model's effort levels in ascending order (empty when it has none).
|
|
93
|
+
*/
|
|
94
|
+
export function effortLevelsForModel(model) {
|
|
95
|
+
return model?.supportedEffortLevels ?? [];
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=chat-effort-utilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-effort-utilities.js","sourceRoot":"","sources":["../../src/components/chat-effort-utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAKH,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,yBAAyB,CAAA;AAyBhC;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC9C,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAA;IAC3D,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IACvB,MAAM,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IACnE,IAAI,IAA4B,CAAA;IAChC,MAAM,IAAI,GAAa,EAAE,CAAA;IACzB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,EAAE,CAAA;QACjC,IAAI,KAAK,KAAK,QAAQ;YAAE,IAAI,GAA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 -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `/help` content model + plain-text generation.
|
|
3
|
+
*
|
|
4
|
+
* The help content is a concise high-level guide built from the structured
|
|
5
|
+
* {@link HELP_MODES} / {@link HELP_TIPS} constants below — never a
|
|
6
|
+
* hand-maintained string — so the rich {@link module:./HelpCard | HelpCard} and
|
|
7
|
+
* this plain-text fallback can never drift (both read the SAME constants). It
|
|
8
|
+
* explains the three conversation modes (discovery / plan / execute) and lists
|
|
9
|
+
* efficiency tips. It deliberately does NOT relist the slash commands — typing
|
|
10
|
+
* `/` opens the command menu, which does that better.
|
|
11
|
+
*
|
|
12
|
+
* `buildHelpText` is the i18n plain-text fallback (used as the system card's
|
|
13
|
+
* copy/screen-reader text and in any non-React consumer); `HelpCard` renders the
|
|
14
|
+
* same model as a card matching the `/settings` / `/skills` cards.
|
|
15
|
+
*
|
|
16
|
+
* All prose is i18n-ready via `t(key, values, { defaultValue })`.
|
|
17
|
+
*
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
import type { IconName } from '@molecule/app-icons';
|
|
21
|
+
import { type AgentIdentity } from '@molecule/app-react';
|
|
22
|
+
/**
|
|
23
|
+
* The `/help` intro paragraph (i18n key + English default). Shared by the
|
|
24
|
+
* plain-text {@link buildHelpText} fallback and the rich `HelpCard`. May
|
|
25
|
+
* interpolate the `{{agentName}}` / `{{productName}}` tokens.
|
|
26
|
+
*/
|
|
27
|
+
export declare const HELP_INTRO: {
|
|
28
|
+
/** i18n key for the intro paragraph. */
|
|
29
|
+
readonly key: "ide.chat.help.intro";
|
|
30
|
+
/** English default for {@link HELP_INTRO.key}. */
|
|
31
|
+
readonly defaultValue: "{{agentName}} is {{productName}}'s AI coding agent. Describe what you want to build and it will scaffold, code, and iterate with you.";
|
|
32
|
+
};
|
|
33
|
+
/** A conversation mode shown in `/help`, with its icon-set glyph and i18n copy. */
|
|
34
|
+
export interface HelpMode {
|
|
35
|
+
/** Mode id (also the `data-mol-id` suffix in the card). */
|
|
36
|
+
id: 'discovery' | 'plan' | 'execute';
|
|
37
|
+
/**
|
|
38
|
+
* Icon-set glyph name rendered beside the mode in the rich `HelpCard`
|
|
39
|
+
* (ignored by the plain-text {@link buildHelpText} fallback).
|
|
40
|
+
*/
|
|
41
|
+
icon: IconName;
|
|
42
|
+
/** i18n key for the one-line mode description (may interpolate `{{agentName}}`). */
|
|
43
|
+
key: string;
|
|
44
|
+
/** English default for {@link HelpMode.key}. */
|
|
45
|
+
defaultValue: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The three conversation modes, in the order shown in `/help`. The single
|
|
49
|
+
* source of truth for both the plain-text fallback and the `HelpCard`.
|
|
50
|
+
*/
|
|
51
|
+
export declare const HELP_MODES: readonly HelpMode[];
|
|
52
|
+
/** An efficiency tip shown in `/help`. */
|
|
53
|
+
export interface HelpTip {
|
|
54
|
+
/** Tip id (also the `data-mol-id` suffix in the card). */
|
|
55
|
+
id: string;
|
|
56
|
+
/** i18n key for the tip (may interpolate `{{agentName}}`). */
|
|
57
|
+
key: string;
|
|
58
|
+
/**
|
|
59
|
+
* English default for {@link HelpTip.key}, INCLUDING the leading `•` bullet so
|
|
60
|
+
* it matches the values shipped in the companion locale bonds (and so the
|
|
61
|
+
* plain-text fallback stays byte-identical).
|
|
62
|
+
*/
|
|
63
|
+
defaultValue: string;
|
|
64
|
+
}
|
|
65
|
+
/** The efficiency tips, in the order shown in `/help`. */
|
|
66
|
+
export declare const HELP_TIPS: readonly HelpTip[];
|
|
67
|
+
/** The keyboard-shortcuts footer line shown at the end of `/help`. */
|
|
68
|
+
export declare const HELP_SHORTCUTS: {
|
|
69
|
+
/** i18n key for the shortcuts footer. */
|
|
70
|
+
readonly key: "ide.chat.help.shortcuts";
|
|
71
|
+
/** English default for {@link HELP_SHORTCUTS.key}. */
|
|
72
|
+
readonly defaultValue: "Press Cmd+/ (Ctrl+/ on Windows/Linux) to view all keyboard shortcuts.";
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Builds the `/help` body — a concise high-level guide covering the conversation
|
|
76
|
+
* modes and efficiency tips. It deliberately does NOT relist the slash commands;
|
|
77
|
+
* typing `/` opens the command menu, which does that better. Generated from the
|
|
78
|
+
* shared {@link HELP_MODES} / {@link HELP_TIPS} constants so it stays in sync
|
|
79
|
+
* automatically — and never drifts from the rich `HelpCard`, which renders the
|
|
80
|
+
* same model.
|
|
81
|
+
*
|
|
82
|
+
* @param identity - Agent/product display identity used to interpolate the
|
|
83
|
+
* `{{agentName}}` / `{{productName}}` tokens in the help copy (defaults to the
|
|
84
|
+
* neutral {@link DEFAULT_AGENT_IDENTITY} so the shared package never hardcodes
|
|
85
|
+
* a product name).
|
|
86
|
+
* @returns The fully-formatted, newline-delimited help text.
|
|
87
|
+
*/
|
|
88
|
+
export declare function buildHelpText(identity?: AgentIdentity): string;
|
|
89
|
+
//# sourceMappingURL=chat-help-utilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-help-utilities.d.ts","sourceRoot":"","sources":["../../src/components/chat-help-utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,KAAK,aAAa,EAA0B,MAAM,qBAAqB,CAAA;AAEhF;;;;GAIG;AACH,eAAO,MAAM,UAAU;IACrB,wCAAwC;;IAExC,kDAAkD;;CAG1C,CAAA;AAEV,mFAAmF;AACnF,MAAM,WAAW,QAAQ;IACvB,2DAA2D;IAC3D,EAAE,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,CAAA;IACpC;;;OAGG;IACH,IAAI,EAAE,QAAQ,CAAA;IACd,oFAAoF;IACpF,GAAG,EAAE,MAAM,CAAA;IACX,gDAAgD;IAChD,YAAY,EAAE,MAAM,CAAA;CACrB;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,SAAS,QAAQ,EAsBhC,CAAA;AAEV,0CAA0C;AAC1C,MAAM,WAAW,OAAO;IACtB,0DAA0D;IAC1D,EAAE,EAAE,MAAM,CAAA;IACV,8DAA8D;IAC9D,GAAG,EAAE,MAAM,CAAA;IACX;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,0DAA0D;AAC1D,eAAO,MAAM,SAAS,EAAE,SAAS,OAAO,EAgC9B,CAAA;AAEV,sEAAsE;AACtE,eAAO,MAAM,cAAc;IACzB,yCAAyC;;IAEzC,sDAAsD;;CAE9C,CAAA;AAEV;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,QAAQ,GAAE,aAAsC,GAAG,MAAM,CA2BtF"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `/help` content model + plain-text generation.
|
|
3
|
+
*
|
|
4
|
+
* The help content is a concise high-level guide built from the structured
|
|
5
|
+
* {@link HELP_MODES} / {@link HELP_TIPS} constants below — never a
|
|
6
|
+
* hand-maintained string — so the rich {@link module:./HelpCard | HelpCard} and
|
|
7
|
+
* this plain-text fallback can never drift (both read the SAME constants). It
|
|
8
|
+
* explains the three conversation modes (discovery / plan / execute) and lists
|
|
9
|
+
* efficiency tips. It deliberately does NOT relist the slash commands — typing
|
|
10
|
+
* `/` opens the command menu, which does that better.
|
|
11
|
+
*
|
|
12
|
+
* `buildHelpText` is the i18n plain-text fallback (used as the system card's
|
|
13
|
+
* copy/screen-reader text and in any non-React consumer); `HelpCard` renders the
|
|
14
|
+
* same model as a card matching the `/settings` / `/skills` cards.
|
|
15
|
+
*
|
|
16
|
+
* All prose is i18n-ready via `t(key, values, { defaultValue })`.
|
|
17
|
+
*
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
import { t } from '@molecule/app-i18n';
|
|
21
|
+
import { DEFAULT_AGENT_IDENTITY } from '@molecule/app-react';
|
|
22
|
+
/**
|
|
23
|
+
* The `/help` intro paragraph (i18n key + English default). Shared by the
|
|
24
|
+
* plain-text {@link buildHelpText} fallback and the rich `HelpCard`. May
|
|
25
|
+
* interpolate the `{{agentName}}` / `{{productName}}` tokens.
|
|
26
|
+
*/
|
|
27
|
+
export const HELP_INTRO = {
|
|
28
|
+
/** i18n key for the intro paragraph. */
|
|
29
|
+
key: 'ide.chat.help.intro',
|
|
30
|
+
/** English default for {@link HELP_INTRO.key}. */
|
|
31
|
+
defaultValue: "{{agentName}} is {{productName}}'s AI coding agent. Describe what you want to build and it will scaffold, code, and iterate with you.",
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* The three conversation modes, in the order shown in `/help`. The single
|
|
35
|
+
* source of truth for both the plain-text fallback and the `HelpCard`.
|
|
36
|
+
*/
|
|
37
|
+
export const HELP_MODES = [
|
|
38
|
+
{
|
|
39
|
+
id: 'discovery',
|
|
40
|
+
icon: 'question',
|
|
41
|
+
key: 'ide.chat.help.modeDiscovery',
|
|
42
|
+
defaultValue: 'Discovery — new conversations start here. {{agentName}} asks clarifying questions to nail down requirements before writing any code.',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: 'plan',
|
|
46
|
+
icon: 'search',
|
|
47
|
+
key: 'ide.chat.help.modePlan',
|
|
48
|
+
defaultValue: 'Plan — {{agentName}} researches the codebase and proposes a plan WITHOUT editing files. Toggle with /plan. Best for big or risky changes.',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: 'execute',
|
|
52
|
+
icon: 'pencil',
|
|
53
|
+
key: 'ide.chat.help.modeExecute',
|
|
54
|
+
defaultValue: 'Execute — the default working mode. {{agentName}} writes code, runs tools, and applies changes, then verifies them.',
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
/** The efficiency tips, in the order shown in `/help`. */
|
|
58
|
+
export const HELP_TIPS = [
|
|
59
|
+
{
|
|
60
|
+
id: 'mention',
|
|
61
|
+
key: 'ide.chat.help.tipMention',
|
|
62
|
+
defaultValue: '• Type @filename to attach a project file as context (or drag & drop any file).',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: 'slash',
|
|
66
|
+
key: 'ide.chat.help.tipSlash',
|
|
67
|
+
defaultValue: '• Type / to browse every command.',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
id: 'plan',
|
|
71
|
+
key: 'ide.chat.help.tipPlan',
|
|
72
|
+
defaultValue: '• Use /plan to have {{agentName}} research before making changes.',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: 'undo',
|
|
76
|
+
key: 'ide.chat.help.tipUndo',
|
|
77
|
+
defaultValue: "• Use /undo to revert the last AI turn's file changes if it goes off track.",
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: 'compact',
|
|
81
|
+
key: 'ide.chat.help.tipCompact',
|
|
82
|
+
defaultValue: '• Use /compact to compress context when the conversation gets long.',
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: 'specific',
|
|
86
|
+
key: 'ide.chat.help.tipSpecific',
|
|
87
|
+
defaultValue: '• Be specific — "Add a login page with email/password and Google OAuth" beats "add auth".',
|
|
88
|
+
},
|
|
89
|
+
];
|
|
90
|
+
/** The keyboard-shortcuts footer line shown at the end of `/help`. */
|
|
91
|
+
export const HELP_SHORTCUTS = {
|
|
92
|
+
/** i18n key for the shortcuts footer. */
|
|
93
|
+
key: 'ide.chat.help.shortcuts',
|
|
94
|
+
/** English default for {@link HELP_SHORTCUTS.key}. */
|
|
95
|
+
defaultValue: 'Press Cmd+/ (Ctrl+/ on Windows/Linux) to view all keyboard shortcuts.',
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Builds the `/help` body — a concise high-level guide covering the conversation
|
|
99
|
+
* modes and efficiency tips. It deliberately does NOT relist the slash commands;
|
|
100
|
+
* typing `/` opens the command menu, which does that better. Generated from the
|
|
101
|
+
* shared {@link HELP_MODES} / {@link HELP_TIPS} constants so it stays in sync
|
|
102
|
+
* automatically — and never drifts from the rich `HelpCard`, which renders the
|
|
103
|
+
* same model.
|
|
104
|
+
*
|
|
105
|
+
* @param identity - Agent/product display identity used to interpolate the
|
|
106
|
+
* `{{agentName}}` / `{{productName}}` tokens in the help copy (defaults to the
|
|
107
|
+
* neutral {@link DEFAULT_AGENT_IDENTITY} so the shared package never hardcodes
|
|
108
|
+
* a product name).
|
|
109
|
+
* @returns The fully-formatted, newline-delimited help text.
|
|
110
|
+
*/
|
|
111
|
+
export function buildHelpText(identity = DEFAULT_AGENT_IDENTITY) {
|
|
112
|
+
const { agentName, productName } = identity;
|
|
113
|
+
const values = { agentName, productName };
|
|
114
|
+
const lines = [];
|
|
115
|
+
// ── Getting started ──
|
|
116
|
+
lines.push(t('ide.chat.help.introHeading', undefined, { defaultValue: '── Getting Started ──' }), t(HELP_INTRO.key, values, { defaultValue: HELP_INTRO.defaultValue }), '');
|
|
117
|
+
// ── Modes ──
|
|
118
|
+
lines.push(t('ide.chat.help.modesHeading', undefined, { defaultValue: '── Modes ──' }));
|
|
119
|
+
for (const helpMode of HELP_MODES) {
|
|
120
|
+
lines.push(t(helpMode.key, values, { defaultValue: helpMode.defaultValue }));
|
|
121
|
+
}
|
|
122
|
+
lines.push('');
|
|
123
|
+
// ── Efficiency tips ──
|
|
124
|
+
lines.push(t('ide.chat.help.tipsHeading', undefined, { defaultValue: '── Tips ──' }));
|
|
125
|
+
for (const tip of HELP_TIPS) {
|
|
126
|
+
lines.push(t(tip.key, values, { defaultValue: tip.defaultValue }));
|
|
127
|
+
}
|
|
128
|
+
lines.push('', t(HELP_SHORTCUTS.key, undefined, { defaultValue: HELP_SHORTCUTS.defaultValue }));
|
|
129
|
+
return lines.join('\n');
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=chat-help-utilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-help-utilities.js","sourceRoot":"","sources":["../../src/components/chat-help-utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;G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