@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,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure helpers backing the `/autocommit <seconds>` command and its countdown
|
|
3
|
+
* badge.
|
|
4
|
+
*
|
|
5
|
+
* `/autocommit <n>` arms a client-side, debounce-style countdown: every file
|
|
6
|
+
* change restarts an `n`-second timer, and when the timer reaches zero the chat
|
|
7
|
+
* fires the *existing* `/commit` path (no new backend). After a commit the timer
|
|
8
|
+
* disarms (pauses) until the next file change, so a clean tree is never
|
|
9
|
+
* committed in a loop. `/autocommit 0` cancels it entirely.
|
|
10
|
+
*
|
|
11
|
+
* Auto-commit is ON BY DEFAULT: a project that has never persisted
|
|
12
|
+
* `autoCommitSeconds` resolves to {@link DEFAULT_AUTO_COMMIT_SECONDS} (see
|
|
13
|
+
* {@link resolveAutoCommitSeconds}); only an explicit `0` keeps it off.
|
|
14
|
+
*
|
|
15
|
+
* The cadence is a PERSISTED project setting (`project.settings.autoCommitSeconds`),
|
|
16
|
+
* not a per-session toggle: the component debounce-PATCHes it whenever the user
|
|
17
|
+
* changes it and, on load, dispatches `hydrate` to restore it in the paused
|
|
18
|
+
* state — so it survives a reload/reconnect (it re-arms on the next file change).
|
|
19
|
+
*
|
|
20
|
+
* The countdown is modelled as a pure reducer here so the
|
|
21
|
+
* arm/hydrate/reset/tick/fire state machine can be unit tested without React,
|
|
22
|
+
* timers, or a backend. The component owns only the side effects: the GET that
|
|
23
|
+
* hydrates the persisted cadence, the debounced PATCH that persists changes, a
|
|
24
|
+
* 1s interval dispatching `tick`, a file-change effect dispatching `reset`, and
|
|
25
|
+
* a `fire`-when-due effect that runs `/commit` then dispatches `fired`. The
|
|
26
|
+
* component also owns the HOLD: while the agent is still working (a turn is
|
|
27
|
+
* streaming locally or remotely, or an auto-fix follow-up is pending) it
|
|
28
|
+
* suspends the tick interval and the fire effect, so a commit only ever happens
|
|
29
|
+
* once the agent and the user are actually finished — never mid-turn. Any
|
|
30
|
+
* user-facing prose lives in the component via `t()`, never here.
|
|
31
|
+
*
|
|
32
|
+
* @module
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* The countdown's state.
|
|
36
|
+
*
|
|
37
|
+
* `intervalSeconds` is the configured cadence (`0` = disabled). `remaining` is
|
|
38
|
+
* the live count: a positive number while counting down, `0` at the instant a
|
|
39
|
+
* commit is due, and `null` while disabled or paused (after a commit, awaiting
|
|
40
|
+
* the next file change to re-arm).
|
|
41
|
+
*/
|
|
42
|
+
export interface AutoCommitState {
|
|
43
|
+
/** Configured countdown length in seconds; `0` when auto-commit is off. */
|
|
44
|
+
intervalSeconds: number;
|
|
45
|
+
/** Seconds left until the next auto-commit; `null` when disabled or paused. */
|
|
46
|
+
remaining: number | null;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Actions the countdown reducer accepts.
|
|
50
|
+
*
|
|
51
|
+
* - `set` — apply a `/autocommit <seconds>` command (`seconds <= 0` disables);
|
|
52
|
+
* arms AND starts a fresh countdown (an explicit, just-now user choice).
|
|
53
|
+
* - `hydrate` — restore a cadence persisted on the project (e.g. on reload),
|
|
54
|
+
* enabled but PAUSED (`seconds <= 0` disables). Unlike `set`, it does NOT
|
|
55
|
+
* start counting down — the countdown only re-arms on the next file change —
|
|
56
|
+
* so reopening a project never auto-commits a tree the user hasn't touched.
|
|
57
|
+
* - `reset` — a file changed; restart the full countdown (no-op when disabled).
|
|
58
|
+
* - `tick` — one second elapsed; decrement toward zero (no-op when paused).
|
|
59
|
+
* - `fired` — a commit was just dispatched; pause until the next file change.
|
|
60
|
+
*/
|
|
61
|
+
export type AutoCommitAction = {
|
|
62
|
+
type: 'set';
|
|
63
|
+
seconds: number;
|
|
64
|
+
} | {
|
|
65
|
+
type: 'hydrate';
|
|
66
|
+
seconds: number;
|
|
67
|
+
} | {
|
|
68
|
+
type: 'reset';
|
|
69
|
+
} | {
|
|
70
|
+
type: 'tick';
|
|
71
|
+
} | {
|
|
72
|
+
type: 'fired';
|
|
73
|
+
};
|
|
74
|
+
/** The disabled (off) countdown state — the reducer's initial value. */
|
|
75
|
+
export declare const AUTO_COMMIT_DISABLED: AutoCommitState;
|
|
76
|
+
/**
|
|
77
|
+
* The default auto-commit cadence in seconds — auto-commit is ON by default.
|
|
78
|
+
* Projects that have never persisted `autoCommitSeconds` hydrate to this
|
|
79
|
+
* cadence (paused, arming on the first file change); only an explicit `0`
|
|
80
|
+
* (the user cancelled) keeps auto-commit off.
|
|
81
|
+
*
|
|
82
|
+
* The value is the TOTAL debounce after the last file change (once the agent's
|
|
83
|
+
* turn has finished): a short quiet period, then the final
|
|
84
|
+
* {@link AUTO_COMMIT_COUNTDOWN_VISIBLE_SECONDS} seconds render as a live
|
|
85
|
+
* countdown on the commit button. 5s = 2s quiet + 3s visible countdown.
|
|
86
|
+
*/
|
|
87
|
+
export declare const DEFAULT_AUTO_COMMIT_SECONDS = 5;
|
|
88
|
+
/**
|
|
89
|
+
* How many final seconds of the countdown are DISPLAYED as a live countdown.
|
|
90
|
+
* Until the countdown drops to this threshold, the commit-bar button stays a
|
|
91
|
+
* plain green "Commit" (a bare "12s" pill told users nothing); the countdown
|
|
92
|
+
* label only takes over for these last seconds, right before the auto-commit
|
|
93
|
+
* fires. Cadences at or below the threshold show the countdown the whole time.
|
|
94
|
+
*/
|
|
95
|
+
export declare const AUTO_COMMIT_COUNTDOWN_VISIBLE_SECONDS = 3;
|
|
96
|
+
/**
|
|
97
|
+
* Whether the countdown is in its visible window — armed and within the final
|
|
98
|
+
* {@link AUTO_COMMIT_COUNTDOWN_VISIBLE_SECONDS} seconds — i.e. the commit
|
|
99
|
+
* button should render the live "Auto-commit in Ns" label instead of "Commit".
|
|
100
|
+
*
|
|
101
|
+
* @param state - The countdown state.
|
|
102
|
+
* @returns `true` when armed with at most the visible-window seconds left.
|
|
103
|
+
*/
|
|
104
|
+
export declare function isAutoCommitCountdownVisible(state: AutoCommitState): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Resolves the persisted `project.settings.autoCommitSeconds` value to the
|
|
107
|
+
* effective cadence. A finite number is an explicit user choice: positive
|
|
108
|
+
* values floor to whole seconds, non-positive values mean "the user turned
|
|
109
|
+
* auto-commit off" (`0`). Anything else — missing, never configured, or
|
|
110
|
+
* invalid — falls back to {@link DEFAULT_AUTO_COMMIT_SECONDS}, because
|
|
111
|
+
* auto-commit is on by default.
|
|
112
|
+
*
|
|
113
|
+
* @param saved - The raw persisted setting value.
|
|
114
|
+
* @returns The effective cadence in whole seconds (`0` = off).
|
|
115
|
+
*/
|
|
116
|
+
export declare function resolveAutoCommitSeconds(saved: unknown): number;
|
|
117
|
+
/**
|
|
118
|
+
* Pure reducer for the auto-commit countdown. Deterministic and side-effect
|
|
119
|
+
* free: the component performs the actual commit when {@link isAutoCommitDue}
|
|
120
|
+
* becomes true, then dispatches `fired`.
|
|
121
|
+
*
|
|
122
|
+
* @param state - The current countdown state.
|
|
123
|
+
* @param action - The action to apply.
|
|
124
|
+
* @returns The next countdown state.
|
|
125
|
+
*/
|
|
126
|
+
export declare function autoCommitReducer(state: AutoCommitState, action: AutoCommitAction): AutoCommitState;
|
|
127
|
+
/**
|
|
128
|
+
* Whether auto-commit is enabled (a positive cadence is configured), regardless
|
|
129
|
+
* of whether it is currently counting down or paused.
|
|
130
|
+
*
|
|
131
|
+
* @param state - The countdown state.
|
|
132
|
+
* @returns `true` when `intervalSeconds > 0`.
|
|
133
|
+
*/
|
|
134
|
+
export declare function isAutoCommitEnabled(state: AutoCommitState): boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Whether the countdown is actively armed (counting down), i.e. a 1s tick
|
|
137
|
+
* interval should be running. False when disabled or paused after a commit.
|
|
138
|
+
*
|
|
139
|
+
* @param state - The countdown state.
|
|
140
|
+
* @returns `true` when `remaining` is a number.
|
|
141
|
+
*/
|
|
142
|
+
export declare function isAutoCommitArmed(state: AutoCommitState): boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Whether a commit is due this instant (the countdown has reached zero). The
|
|
145
|
+
* component reacts to this by running `/commit` and dispatching `fired`.
|
|
146
|
+
*
|
|
147
|
+
* @param state - The countdown state.
|
|
148
|
+
* @returns `true` when `remaining === 0`.
|
|
149
|
+
*/
|
|
150
|
+
export declare function isAutoCommitDue(state: AutoCommitState): boolean;
|
|
151
|
+
/**
|
|
152
|
+
* Parses an `/autocommit [seconds]` command.
|
|
153
|
+
*
|
|
154
|
+
* Returns `{ seconds: null }` when `/autocommit` is typed with no argument (the
|
|
155
|
+
* caller shows usage/current state), `{ seconds: n }` for a non-negative integer
|
|
156
|
+
* argument (`0` cancels), or `null` when the input is not the command.
|
|
157
|
+
*
|
|
158
|
+
* @param input - The raw chat input.
|
|
159
|
+
* @returns The parsed command, or `null` when it is not `/autocommit`.
|
|
160
|
+
*/
|
|
161
|
+
export declare function parseAutoCommitCommand(input: string): {
|
|
162
|
+
seconds: number | null;
|
|
163
|
+
} | null;
|
|
164
|
+
/**
|
|
165
|
+
* Formats the countdown's remaining seconds for the compact badge (e.g. `"12s"`).
|
|
166
|
+
* Returns `''` when there is nothing to show (disabled or paused).
|
|
167
|
+
*
|
|
168
|
+
* @param state - The countdown state.
|
|
169
|
+
* @returns The badge label, or `''`.
|
|
170
|
+
*/
|
|
171
|
+
export declare function formatAutoCommitBadge(state: AutoCommitState): string;
|
|
172
|
+
//# sourceMappingURL=chat-autocommit-utilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-autocommit-utilities.d.ts","sourceRoot":"","sources":["../../src/components/chat-autocommit-utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B,2EAA2E;IAC3E,eAAe,EAAE,MAAM,CAAA;IACvB,+EAA+E;IAC/E,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,gBAAgB,GACxB;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAChC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACpC;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAA;AAErB,wEAAwE;AACxE,eAAO,MAAM,oBAAoB,EAAE,eAAyD,CAAA;AAE5F;;;;;;;;;;GAUG;AACH,eAAO,MAAM,2BAA2B,IAAI,CAAA;AAE5C;;;;;;GAMG;AACH,eAAO,MAAM,qCAAqC,IAAI,CAAA;AAEtD;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAE5E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAK/D;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,eAAe,EACtB,MAAM,EAAE,gBAAgB,GACvB,eAAe,CA0BjB;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAEnE;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAEjE;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAE/D;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG,IAAI,CAKvF;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAGpE"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure helpers backing the `/autocommit <seconds>` command and its countdown
|
|
3
|
+
* badge.
|
|
4
|
+
*
|
|
5
|
+
* `/autocommit <n>` arms a client-side, debounce-style countdown: every file
|
|
6
|
+
* change restarts an `n`-second timer, and when the timer reaches zero the chat
|
|
7
|
+
* fires the *existing* `/commit` path (no new backend). After a commit the timer
|
|
8
|
+
* disarms (pauses) until the next file change, so a clean tree is never
|
|
9
|
+
* committed in a loop. `/autocommit 0` cancels it entirely.
|
|
10
|
+
*
|
|
11
|
+
* Auto-commit is ON BY DEFAULT: a project that has never persisted
|
|
12
|
+
* `autoCommitSeconds` resolves to {@link DEFAULT_AUTO_COMMIT_SECONDS} (see
|
|
13
|
+
* {@link resolveAutoCommitSeconds}); only an explicit `0` keeps it off.
|
|
14
|
+
*
|
|
15
|
+
* The cadence is a PERSISTED project setting (`project.settings.autoCommitSeconds`),
|
|
16
|
+
* not a per-session toggle: the component debounce-PATCHes it whenever the user
|
|
17
|
+
* changes it and, on load, dispatches `hydrate` to restore it in the paused
|
|
18
|
+
* state — so it survives a reload/reconnect (it re-arms on the next file change).
|
|
19
|
+
*
|
|
20
|
+
* The countdown is modelled as a pure reducer here so the
|
|
21
|
+
* arm/hydrate/reset/tick/fire state machine can be unit tested without React,
|
|
22
|
+
* timers, or a backend. The component owns only the side effects: the GET that
|
|
23
|
+
* hydrates the persisted cadence, the debounced PATCH that persists changes, a
|
|
24
|
+
* 1s interval dispatching `tick`, a file-change effect dispatching `reset`, and
|
|
25
|
+
* a `fire`-when-due effect that runs `/commit` then dispatches `fired`. The
|
|
26
|
+
* component also owns the HOLD: while the agent is still working (a turn is
|
|
27
|
+
* streaming locally or remotely, or an auto-fix follow-up is pending) it
|
|
28
|
+
* suspends the tick interval and the fire effect, so a commit only ever happens
|
|
29
|
+
* once the agent and the user are actually finished — never mid-turn. Any
|
|
30
|
+
* user-facing prose lives in the component via `t()`, never here.
|
|
31
|
+
*
|
|
32
|
+
* @module
|
|
33
|
+
*/
|
|
34
|
+
/** The disabled (off) countdown state — the reducer's initial value. */
|
|
35
|
+
export const AUTO_COMMIT_DISABLED = { intervalSeconds: 0, remaining: null };
|
|
36
|
+
/**
|
|
37
|
+
* The default auto-commit cadence in seconds — auto-commit is ON by default.
|
|
38
|
+
* Projects that have never persisted `autoCommitSeconds` hydrate to this
|
|
39
|
+
* cadence (paused, arming on the first file change); only an explicit `0`
|
|
40
|
+
* (the user cancelled) keeps auto-commit off.
|
|
41
|
+
*
|
|
42
|
+
* The value is the TOTAL debounce after the last file change (once the agent's
|
|
43
|
+
* turn has finished): a short quiet period, then the final
|
|
44
|
+
* {@link AUTO_COMMIT_COUNTDOWN_VISIBLE_SECONDS} seconds render as a live
|
|
45
|
+
* countdown on the commit button. 5s = 2s quiet + 3s visible countdown.
|
|
46
|
+
*/
|
|
47
|
+
export const DEFAULT_AUTO_COMMIT_SECONDS = 5;
|
|
48
|
+
/**
|
|
49
|
+
* How many final seconds of the countdown are DISPLAYED as a live countdown.
|
|
50
|
+
* Until the countdown drops to this threshold, the commit-bar button stays a
|
|
51
|
+
* plain green "Commit" (a bare "12s" pill told users nothing); the countdown
|
|
52
|
+
* label only takes over for these last seconds, right before the auto-commit
|
|
53
|
+
* fires. Cadences at or below the threshold show the countdown the whole time.
|
|
54
|
+
*/
|
|
55
|
+
export const AUTO_COMMIT_COUNTDOWN_VISIBLE_SECONDS = 3;
|
|
56
|
+
/**
|
|
57
|
+
* Whether the countdown is in its visible window — armed and within the final
|
|
58
|
+
* {@link AUTO_COMMIT_COUNTDOWN_VISIBLE_SECONDS} seconds — i.e. the commit
|
|
59
|
+
* button should render the live "Auto-commit in Ns" label instead of "Commit".
|
|
60
|
+
*
|
|
61
|
+
* @param state - The countdown state.
|
|
62
|
+
* @returns `true` when armed with at most the visible-window seconds left.
|
|
63
|
+
*/
|
|
64
|
+
export function isAutoCommitCountdownVisible(state) {
|
|
65
|
+
return state.remaining !== null && state.remaining <= AUTO_COMMIT_COUNTDOWN_VISIBLE_SECONDS;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Resolves the persisted `project.settings.autoCommitSeconds` value to the
|
|
69
|
+
* effective cadence. A finite number is an explicit user choice: positive
|
|
70
|
+
* values floor to whole seconds, non-positive values mean "the user turned
|
|
71
|
+
* auto-commit off" (`0`). Anything else — missing, never configured, or
|
|
72
|
+
* invalid — falls back to {@link DEFAULT_AUTO_COMMIT_SECONDS}, because
|
|
73
|
+
* auto-commit is on by default.
|
|
74
|
+
*
|
|
75
|
+
* @param saved - The raw persisted setting value.
|
|
76
|
+
* @returns The effective cadence in whole seconds (`0` = off).
|
|
77
|
+
*/
|
|
78
|
+
export function resolveAutoCommitSeconds(saved) {
|
|
79
|
+
if (typeof saved === 'number' && Number.isFinite(saved)) {
|
|
80
|
+
return Math.max(0, Math.floor(saved));
|
|
81
|
+
}
|
|
82
|
+
return DEFAULT_AUTO_COMMIT_SECONDS;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Pure reducer for the auto-commit countdown. Deterministic and side-effect
|
|
86
|
+
* free: the component performs the actual commit when {@link isAutoCommitDue}
|
|
87
|
+
* becomes true, then dispatches `fired`.
|
|
88
|
+
*
|
|
89
|
+
* @param state - The current countdown state.
|
|
90
|
+
* @param action - The action to apply.
|
|
91
|
+
* @returns The next countdown state.
|
|
92
|
+
*/
|
|
93
|
+
export function autoCommitReducer(state, action) {
|
|
94
|
+
switch (action.type) {
|
|
95
|
+
case 'set':
|
|
96
|
+
// <= 0 cancels; a positive cadence arms and starts the first countdown.
|
|
97
|
+
if (action.seconds <= 0)
|
|
98
|
+
return AUTO_COMMIT_DISABLED;
|
|
99
|
+
return { intervalSeconds: action.seconds, remaining: action.seconds };
|
|
100
|
+
case 'hydrate':
|
|
101
|
+
// Restore a persisted cadence in the paused state: enabled (so the badge
|
|
102
|
+
// shows "on") but NOT counting down — it re-arms via `reset` on the next
|
|
103
|
+
// file change. <= 0 means auto-commit was off on the project.
|
|
104
|
+
if (action.seconds <= 0)
|
|
105
|
+
return AUTO_COMMIT_DISABLED;
|
|
106
|
+
return { intervalSeconds: action.seconds, remaining: null };
|
|
107
|
+
case 'reset':
|
|
108
|
+
// A file changed: re-arm the full countdown — but only when enabled.
|
|
109
|
+
if (state.intervalSeconds <= 0)
|
|
110
|
+
return state;
|
|
111
|
+
return { intervalSeconds: state.intervalSeconds, remaining: state.intervalSeconds };
|
|
112
|
+
case 'tick':
|
|
113
|
+
// Disabled or paused (remaining === null) ignores ticks.
|
|
114
|
+
if (state.remaining === null)
|
|
115
|
+
return state;
|
|
116
|
+
return { intervalSeconds: state.intervalSeconds, remaining: Math.max(0, state.remaining - 1) };
|
|
117
|
+
case 'fired':
|
|
118
|
+
// Commit dispatched: pause (don't re-fire on a clean tree) until the next
|
|
119
|
+
// file change re-arms via `reset`. Keep the configured cadence.
|
|
120
|
+
if (state.intervalSeconds <= 0)
|
|
121
|
+
return state;
|
|
122
|
+
return { intervalSeconds: state.intervalSeconds, remaining: null };
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Whether auto-commit is enabled (a positive cadence is configured), regardless
|
|
127
|
+
* of whether it is currently counting down or paused.
|
|
128
|
+
*
|
|
129
|
+
* @param state - The countdown state.
|
|
130
|
+
* @returns `true` when `intervalSeconds > 0`.
|
|
131
|
+
*/
|
|
132
|
+
export function isAutoCommitEnabled(state) {
|
|
133
|
+
return state.intervalSeconds > 0;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Whether the countdown is actively armed (counting down), i.e. a 1s tick
|
|
137
|
+
* interval should be running. False when disabled or paused after a commit.
|
|
138
|
+
*
|
|
139
|
+
* @param state - The countdown state.
|
|
140
|
+
* @returns `true` when `remaining` is a number.
|
|
141
|
+
*/
|
|
142
|
+
export function isAutoCommitArmed(state) {
|
|
143
|
+
return state.remaining !== null;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Whether a commit is due this instant (the countdown has reached zero). The
|
|
147
|
+
* component reacts to this by running `/commit` and dispatching `fired`.
|
|
148
|
+
*
|
|
149
|
+
* @param state - The countdown state.
|
|
150
|
+
* @returns `true` when `remaining === 0`.
|
|
151
|
+
*/
|
|
152
|
+
export function isAutoCommitDue(state) {
|
|
153
|
+
return state.remaining === 0;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Parses an `/autocommit [seconds]` command.
|
|
157
|
+
*
|
|
158
|
+
* Returns `{ seconds: null }` when `/autocommit` is typed with no argument (the
|
|
159
|
+
* caller shows usage/current state), `{ seconds: n }` for a non-negative integer
|
|
160
|
+
* argument (`0` cancels), or `null` when the input is not the command.
|
|
161
|
+
*
|
|
162
|
+
* @param input - The raw chat input.
|
|
163
|
+
* @returns The parsed command, or `null` when it is not `/autocommit`.
|
|
164
|
+
*/
|
|
165
|
+
export function parseAutoCommitCommand(input) {
|
|
166
|
+
const match = input.trim().match(/^\/autocommit(?:\s+(\d+))?$/i);
|
|
167
|
+
if (!match)
|
|
168
|
+
return null;
|
|
169
|
+
if (match[1] === undefined)
|
|
170
|
+
return { seconds: null };
|
|
171
|
+
return { seconds: Number(match[1]) };
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Formats the countdown's remaining seconds for the compact badge (e.g. `"12s"`).
|
|
175
|
+
* Returns `''` when there is nothing to show (disabled or paused).
|
|
176
|
+
*
|
|
177
|
+
* @param state - The countdown state.
|
|
178
|
+
* @returns The badge label, or `''`.
|
|
179
|
+
*/
|
|
180
|
+
export function formatAutoCommitBadge(state) {
|
|
181
|
+
if (state.remaining === null)
|
|
182
|
+
return '';
|
|
183
|
+
return `${state.remaining}s`;
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=chat-autocommit-utilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-autocommit-utilities.js","sourceRoot":"","sources":["../../src/components/chat-autocommit-utilities.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared visual treatment for the boxed "info" cards in the Synthase chat
|
|
3
|
+
* timeline (the notice / tip / upgrade card, the activity card, and the `/help`,
|
|
4
|
+
* `/settings`, `/skills`, `/scripts` slash-command cards).
|
|
5
|
+
*
|
|
6
|
+
* These cards used to drift — some sat on a flat gray `surfaceSecondary` surface,
|
|
7
|
+
* others on a tinted background; icon sizes, paddings and radii differed; and the
|
|
8
|
+
* notice card carried a 3px left accent bar while the rest had a plain 1px frame.
|
|
9
|
+
* This module is the single source of truth that makes them one consistent family:
|
|
10
|
+
*
|
|
11
|
+
* - a subtle color-mix **tint** (never a flat gray surface),
|
|
12
|
+
* - a full **1px border on ALL sides** — never a thicker left accent bar,
|
|
13
|
+
* - one padding, one radius, one leading-icon size.
|
|
14
|
+
*
|
|
15
|
+
* A single `accent` colour drives both the border and the background via
|
|
16
|
+
* `color-mix` (works with a CSS var OR a hex), so a semantic card passes its tone
|
|
17
|
+
* colour (success green, upgrade gold, …) and a neutral info card passes the
|
|
18
|
+
* default (the theme's primary). The tint stays subtle and recolors with the
|
|
19
|
+
* active theme/brand instead of clashing with it.
|
|
20
|
+
*
|
|
21
|
+
* Do NOT layer a `borderLeft` / left-accent override on top of {@link chatCardStyle}
|
|
22
|
+
* — the whole point is a uniform 1px frame. Callers own only layout
|
|
23
|
+
* (`display`/`gap`/`alignItems`) and the bottom-margin timeline rhythm.
|
|
24
|
+
*
|
|
25
|
+
* @module
|
|
26
|
+
*/
|
|
27
|
+
import type { CSSProperties } from 'react';
|
|
28
|
+
/**
|
|
29
|
+
* Neutral accent for non-semantic info cards: the theme's primary colour, so a
|
|
30
|
+
* card that has no status meaning is still subtly *tinted* (never a flat gray
|
|
31
|
+
* surface) and recolors with the brand.
|
|
32
|
+
*/
|
|
33
|
+
export declare const CHAT_CARD_NEUTRAL_ACCENT = "var(--mol-color-primary, #6366f1)";
|
|
34
|
+
/** Uniform leading-icon size (px) for every chat-timeline info card. */
|
|
35
|
+
export declare const CHAT_CARD_ICON_SIZE = 18;
|
|
36
|
+
/**
|
|
37
|
+
* Build the tinted border colour for a chat info card from its accent.
|
|
38
|
+
*
|
|
39
|
+
* @param accent - Accent source colour (CSS var or hex). Defaults to the theme primary.
|
|
40
|
+
* @param pct - Opacity of the accent in the mix (percent). Defaults to the resting 40.
|
|
41
|
+
* @returns A `color-mix` border colour.
|
|
42
|
+
*/
|
|
43
|
+
export declare function chatCardBorder(accent?: string, pct?: number): string;
|
|
44
|
+
/**
|
|
45
|
+
* Build the tinted background colour for a chat info card from its accent.
|
|
46
|
+
*
|
|
47
|
+
* @param accent - Accent source colour (CSS var or hex). Defaults to the theme primary.
|
|
48
|
+
* @param pct - Opacity of the accent in the mix (percent). Defaults to the resting 10.
|
|
49
|
+
* @returns A `color-mix` background colour.
|
|
50
|
+
*/
|
|
51
|
+
export declare function chatCardBg(accent?: string, pct?: number): string;
|
|
52
|
+
/**
|
|
53
|
+
* The single container chrome shared by every boxed info card in the chat
|
|
54
|
+
* timeline: subtle tint, full 1px border on all sides, one padding, one radius.
|
|
55
|
+
*
|
|
56
|
+
* Spread it first, then add layout (`display`/`gap`/`alignItems`) and the
|
|
57
|
+
* bottom-margin rhythm at the call site — e.g.
|
|
58
|
+
* `style={{ display: 'flex', gap: 10, marginBottom: TIMELINE_ITEM_GAP, ...chatCardStyle(accent) }}`.
|
|
59
|
+
*
|
|
60
|
+
* @param accent - Tint/border source colour. Defaults to the theme primary (neutral cards).
|
|
61
|
+
* @returns The container `style` chrome (border, background, padding, radius).
|
|
62
|
+
*/
|
|
63
|
+
export declare function chatCardStyle(accent?: string): CSSProperties;
|
|
64
|
+
//# sourceMappingURL=chat-card-style.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-card-style.d.ts","sourceRoot":"","sources":["../../src/components/chat-card-style.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAE1C;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,sCAAsC,CAAA;AAE3E,wEAAwE;AACxE,eAAO,MAAM,mBAAmB,KAAK,CAAA;AAErC;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,MAAM,GAAE,MAAiC,EAAE,GAAG,SAAK,GAAG,MAAM,CAE1F;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,MAAM,GAAE,MAAiC,EAAE,GAAG,SAAK,GAAG,MAAM,CAEtF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,MAAM,GAAE,MAAiC,GAAG,aAAa,CAOtF"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared visual treatment for the boxed "info" cards in the Synthase chat
|
|
3
|
+
* timeline (the notice / tip / upgrade card, the activity card, and the `/help`,
|
|
4
|
+
* `/settings`, `/skills`, `/scripts` slash-command cards).
|
|
5
|
+
*
|
|
6
|
+
* These cards used to drift — some sat on a flat gray `surfaceSecondary` surface,
|
|
7
|
+
* others on a tinted background; icon sizes, paddings and radii differed; and the
|
|
8
|
+
* notice card carried a 3px left accent bar while the rest had a plain 1px frame.
|
|
9
|
+
* This module is the single source of truth that makes them one consistent family:
|
|
10
|
+
*
|
|
11
|
+
* - a subtle color-mix **tint** (never a flat gray surface),
|
|
12
|
+
* - a full **1px border on ALL sides** — never a thicker left accent bar,
|
|
13
|
+
* - one padding, one radius, one leading-icon size.
|
|
14
|
+
*
|
|
15
|
+
* A single `accent` colour drives both the border and the background via
|
|
16
|
+
* `color-mix` (works with a CSS var OR a hex), so a semantic card passes its tone
|
|
17
|
+
* colour (success green, upgrade gold, …) and a neutral info card passes the
|
|
18
|
+
* default (the theme's primary). The tint stays subtle and recolors with the
|
|
19
|
+
* active theme/brand instead of clashing with it.
|
|
20
|
+
*
|
|
21
|
+
* Do NOT layer a `borderLeft` / left-accent override on top of {@link chatCardStyle}
|
|
22
|
+
* — the whole point is a uniform 1px frame. Callers own only layout
|
|
23
|
+
* (`display`/`gap`/`alignItems`) and the bottom-margin timeline rhythm.
|
|
24
|
+
*
|
|
25
|
+
* @module
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* Neutral accent for non-semantic info cards: the theme's primary colour, so a
|
|
29
|
+
* card that has no status meaning is still subtly *tinted* (never a flat gray
|
|
30
|
+
* surface) and recolors with the brand.
|
|
31
|
+
*/
|
|
32
|
+
export const CHAT_CARD_NEUTRAL_ACCENT = 'var(--mol-color-primary, #6366f1)';
|
|
33
|
+
/** Uniform leading-icon size (px) for every chat-timeline info card. */
|
|
34
|
+
export const CHAT_CARD_ICON_SIZE = 18;
|
|
35
|
+
/**
|
|
36
|
+
* Build the tinted border colour for a chat info card from its accent.
|
|
37
|
+
*
|
|
38
|
+
* @param accent - Accent source colour (CSS var or hex). Defaults to the theme primary.
|
|
39
|
+
* @param pct - Opacity of the accent in the mix (percent). Defaults to the resting 40.
|
|
40
|
+
* @returns A `color-mix` border colour.
|
|
41
|
+
*/
|
|
42
|
+
export function chatCardBorder(accent = CHAT_CARD_NEUTRAL_ACCENT, pct = 40) {
|
|
43
|
+
return `color-mix(in srgb, ${accent} ${pct}%, transparent)`;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Build the tinted background colour for a chat info card from its accent.
|
|
47
|
+
*
|
|
48
|
+
* @param accent - Accent source colour (CSS var or hex). Defaults to the theme primary.
|
|
49
|
+
* @param pct - Opacity of the accent in the mix (percent). Defaults to the resting 10.
|
|
50
|
+
* @returns A `color-mix` background colour.
|
|
51
|
+
*/
|
|
52
|
+
export function chatCardBg(accent = CHAT_CARD_NEUTRAL_ACCENT, pct = 10) {
|
|
53
|
+
return `color-mix(in srgb, ${accent} ${pct}%, transparent)`;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The single container chrome shared by every boxed info card in the chat
|
|
57
|
+
* timeline: subtle tint, full 1px border on all sides, one padding, one radius.
|
|
58
|
+
*
|
|
59
|
+
* Spread it first, then add layout (`display`/`gap`/`alignItems`) and the
|
|
60
|
+
* bottom-margin rhythm at the call site — e.g.
|
|
61
|
+
* `style={{ display: 'flex', gap: 10, marginBottom: TIMELINE_ITEM_GAP, ...chatCardStyle(accent) }}`.
|
|
62
|
+
*
|
|
63
|
+
* @param accent - Tint/border source colour. Defaults to the theme primary (neutral cards).
|
|
64
|
+
* @returns The container `style` chrome (border, background, padding, radius).
|
|
65
|
+
*/
|
|
66
|
+
export function chatCardStyle(accent = CHAT_CARD_NEUTRAL_ACCENT) {
|
|
67
|
+
return {
|
|
68
|
+
padding: '10px 12px',
|
|
69
|
+
borderRadius: 8,
|
|
70
|
+
border: `1px solid ${chatCardBorder(accent)}`,
|
|
71
|
+
background: chatCardBg(accent),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=chat-card-style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-card-style.js","sourceRoot":"","sources":["../../src/components/chat-card-style.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,mCAAmC,CAAA;AAE3E,wEAAwE;AACxE,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAA;AAErC;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,SAAiB,wBAAwB,EAAE,GAAG,GAAG,EAAE;IAChF,OAAO,sBAAsB,MAAM,IAAI,GAAG,iBAAiB,CAAA;AAC7D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,SAAiB,wBAAwB,EAAE,GAAG,GAAG,EAAE;IAC5E,OAAO,sBAAsB,MAAM,IAAI,GAAG,iBAAiB,CAAA;AAC7D,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,aAAa,CAAC,SAAiB,wBAAwB;IACrE,OAAO;QACL,OAAO,EAAE,WAAW;QACpB,YAAY,EAAE,CAAC;QACf,MAAM,EAAE,aAAa,cAAc,CAAC,MAAM,CAAC,EAAE;QAC7C,UAAU,EAAE,UAAU,CAAC,MAAM,CAAC;KAC/B,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slash-command registry for the chat panel.
|
|
3
|
+
*
|
|
4
|
+
* The command definitions themselves now live in the React-free
|
|
5
|
+
* {@link module:../command-metadata | command-metadata} module at the package
|
|
6
|
+
* root, so the **single source of truth** can be imported on either side of the
|
|
7
|
+
* api/app boundary — the IDE chat surfaces read it here, and the molecule.dev
|
|
8
|
+
* API system prompt reads the very same array through the package's
|
|
9
|
+
* `./command-metadata` subpath export. This file re-exports that module so the
|
|
10
|
+
* chat components keep their local `./chat-commands.js` import path; it adds no
|
|
11
|
+
* data of its own (extending the list here instead of in `command-metadata.ts`
|
|
12
|
+
* would re-introduce exactly the duplication SYN15 was about).
|
|
13
|
+
*
|
|
14
|
+
* @module
|
|
15
|
+
*/
|
|
16
|
+
export * from '../command-metadata.js';
|
|
17
|
+
//# sourceMappingURL=chat-commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-commands.d.ts","sourceRoot":"","sources":["../../src/components/chat-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,wBAAwB,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slash-command registry for the chat panel.
|
|
3
|
+
*
|
|
4
|
+
* The command definitions themselves now live in the React-free
|
|
5
|
+
* {@link module:../command-metadata | command-metadata} module at the package
|
|
6
|
+
* root, so the **single source of truth** can be imported on either side of the
|
|
7
|
+
* api/app boundary — the IDE chat surfaces read it here, and the molecule.dev
|
|
8
|
+
* API system prompt reads the very same array through the package's
|
|
9
|
+
* `./command-metadata` subpath export. This file re-exports that module so the
|
|
10
|
+
* chat components keep their local `./chat-commands.js` import path; it adds no
|
|
11
|
+
* data of its own (extending the list here instead of in `command-metadata.ts`
|
|
12
|
+
* would re-introduce exactly the duplication SYN15 was about).
|
|
13
|
+
*
|
|
14
|
+
* @module
|
|
15
|
+
*/
|
|
16
|
+
export * from '../command-metadata.js';
|
|
17
|
+
//# sourceMappingURL=chat-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-commands.js","sourceRoot":"","sources":["../../src/components/chat-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,wBAAwB,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers for rendering commit messages in the chat timeline.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Strips a trailing `Co-authored-by:` attribution trailer (and the blank line
|
|
8
|
+
* that separates it from the message body, per git trailer convention) from a
|
|
9
|
+
* commit message **for display only**.
|
|
10
|
+
*
|
|
11
|
+
* The agent co-authors every commit it makes (e.g. molecule.dev appends
|
|
12
|
+
* `Co-authored-by: Synthase <synthase@molecule.dev>` after a blank line so the
|
|
13
|
+
* commit is truthfully attributed). That trailer belongs in the real git commit
|
|
14
|
+
* object — it must NOT leak into the user-facing commit displays (the commit-bar
|
|
15
|
+
* status line and the expanded commit-card label), where it is noise the user
|
|
16
|
+
* never wrote. Both surfaces show the message returned by the commit endpoint,
|
|
17
|
+
* which is the full message including the trailer, so they call this first.
|
|
18
|
+
*
|
|
19
|
+
* Cuts from the blank line preceding the first `Co-authored-by:` line through the
|
|
20
|
+
* end of the string, so any number of stacked co-author trailers (and any body
|
|
21
|
+
* paragraphs above the blank line) are handled. Case-insensitive so both the
|
|
22
|
+
* `Co-authored-by:` and `Co-Authored-By:` spellings are stripped. Messages with
|
|
23
|
+
* no such trailer are returned unchanged.
|
|
24
|
+
*
|
|
25
|
+
* @param message - The full commit message, possibly including a co-author trailer.
|
|
26
|
+
* @returns The commit message with any trailing co-author trailer removed.
|
|
27
|
+
*/
|
|
28
|
+
export declare function stripCommitCoauthorTrailer(message: string): string;
|
|
29
|
+
//# sourceMappingURL=chat-commit-utilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-commit-utilities.d.ts","sourceRoot":"","sources":["../../src/components/chat-commit-utilities.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAElE"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers for rendering commit messages in the chat timeline.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Strips a trailing `Co-authored-by:` attribution trailer (and the blank line
|
|
8
|
+
* that separates it from the message body, per git trailer convention) from a
|
|
9
|
+
* commit message **for display only**.
|
|
10
|
+
*
|
|
11
|
+
* The agent co-authors every commit it makes (e.g. molecule.dev appends
|
|
12
|
+
* `Co-authored-by: Synthase <synthase@molecule.dev>` after a blank line so the
|
|
13
|
+
* commit is truthfully attributed). That trailer belongs in the real git commit
|
|
14
|
+
* object — it must NOT leak into the user-facing commit displays (the commit-bar
|
|
15
|
+
* status line and the expanded commit-card label), where it is noise the user
|
|
16
|
+
* never wrote. Both surfaces show the message returned by the commit endpoint,
|
|
17
|
+
* which is the full message including the trailer, so they call this first.
|
|
18
|
+
*
|
|
19
|
+
* Cuts from the blank line preceding the first `Co-authored-by:` line through the
|
|
20
|
+
* end of the string, so any number of stacked co-author trailers (and any body
|
|
21
|
+
* paragraphs above the blank line) are handled. Case-insensitive so both the
|
|
22
|
+
* `Co-authored-by:` and `Co-Authored-By:` spellings are stripped. Messages with
|
|
23
|
+
* no such trailer are returned unchanged.
|
|
24
|
+
*
|
|
25
|
+
* @param message - The full commit message, possibly including a co-author trailer.
|
|
26
|
+
* @returns The commit message with any trailing co-author trailer removed.
|
|
27
|
+
*/
|
|
28
|
+
export function stripCommitCoauthorTrailer(message) {
|
|
29
|
+
return message.replace(/\s*\nCo-authored-by:[\s\S]*$/i, '');
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=chat-commit-utilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-commit-utilities.js","sourceRoot":"","sources":["../../src/components/chat-commit-utilities.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,0BAA0B,CAAC,OAAe;IACxD,OAAO,OAAO,CAAC,OAAO,CAAC,+BAA+B,EAAE,EAAE,CAAC,CAAA;AAC7D,CAAC"}
|