@molecule/app-ide-panel-logic 1.3.0 → 1.4.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/README.md +277 -1
- package/dist/chatTimelineOrdering.d.ts +175 -1
- package/dist/chatTimelineOrdering.d.ts.map +1 -1
- package/dist/chatTimelineOrdering.js +192 -1
- package/dist/chatTimelineOrdering.js.map +1 -1
- package/dist/components/chat-autocommit-utilities.d.ts.map +1 -1
- package/dist/components/chat-autocommit-utilities.js +3 -2
- package/dist/components/chat-autocommit-utilities.js.map +1 -1
- package/dist/components/chat-card-event-utilities.d.ts +320 -0
- package/dist/components/chat-card-event-utilities.d.ts.map +1 -0
- package/dist/components/chat-card-event-utilities.js +198 -0
- package/dist/components/chat-card-event-utilities.js.map +1 -0
- package/dist/components/chat-composer-utilities.d.ts +472 -0
- package/dist/components/chat-composer-utilities.d.ts.map +1 -0
- package/dist/components/chat-composer-utilities.js +519 -0
- package/dist/components/chat-composer-utilities.js.map +1 -0
- package/dist/components/chat-dictation-controller.d.ts +376 -0
- package/dist/components/chat-dictation-controller.d.ts.map +1 -0
- package/dist/components/chat-dictation-controller.js +559 -0
- package/dist/components/chat-dictation-controller.js.map +1 -0
- package/dist/components/chat-effort-utilities.d.ts +24 -0
- package/dist/components/chat-effort-utilities.d.ts.map +1 -1
- package/dist/components/chat-effort-utilities.js +41 -0
- package/dist/components/chat-effort-utilities.js.map +1 -1
- package/dist/components/chat-format-utilities.d.ts +71 -0
- package/dist/components/chat-format-utilities.d.ts.map +1 -0
- package/dist/components/chat-format-utilities.js +192 -0
- package/dist/components/chat-format-utilities.js.map +1 -0
- package/dist/components/chat-models-utilities.d.ts +168 -0
- package/dist/components/chat-models-utilities.d.ts.map +1 -1
- package/dist/components/chat-models-utilities.js +253 -0
- package/dist/components/chat-models-utilities.js.map +1 -1
- package/dist/components/chat-settings-utilities.d.ts +153 -1
- package/dist/components/chat-settings-utilities.d.ts.map +1 -1
- package/dist/components/chat-settings-utilities.js +204 -1
- package/dist/components/chat-settings-utilities.js.map +1 -1
- package/dist/components/chat-stream-utilities.d.ts +165 -1
- package/dist/components/chat-stream-utilities.d.ts.map +1 -1
- package/dist/components/chat-stream-utilities.js +155 -1
- package/dist/components/chat-stream-utilities.js.map +1 -1
- package/dist/components/chat-tests-controller.d.ts +249 -0
- package/dist/components/chat-tests-controller.d.ts.map +1 -0
- package/dist/components/chat-tests-controller.js +504 -0
- package/dist/components/chat-tests-controller.js.map +1 -0
- package/dist/components/chat-timeline-utilities.d.ts +90 -0
- package/dist/components/chat-timeline-utilities.d.ts.map +1 -0
- package/dist/components/chat-timeline-utilities.js +71 -0
- package/dist/components/chat-timeline-utilities.js.map +1 -0
- package/dist/components/chat-ui-constants.d.ts +98 -0
- package/dist/components/chat-ui-constants.d.ts.map +1 -0
- package/dist/components/chat-ui-constants.js +146 -0
- package/dist/components/chat-ui-constants.js.map +1 -0
- package/dist/components/chat-undo-utilities.d.ts +47 -0
- package/dist/components/chat-undo-utilities.d.ts.map +1 -0
- package/dist/components/chat-undo-utilities.js +73 -0
- package/dist/components/chat-undo-utilities.js.map +1 -0
- package/dist/components/context-usage-utilities.d.ts +25 -3
- package/dist/components/context-usage-utilities.d.ts.map +1 -1
- package/dist/components/context-usage-utilities.js +42 -2
- package/dist/components/context-usage-utilities.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/panels.d.ts +6 -0
- package/dist/panels.d.ts.map +1 -1
- package/dist/panels.js +6 -0
- package/dist/panels.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-composer-utilities.d.ts","sourceRoot":"","sources":["../../src/components/chat-composer-utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;A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E;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,CAAA;CAAE;AACtC,yCAAyC;GACvC;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE;AACzC,0EAA0E;GACxE;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,CAAA;CAAE;AACzC,oEAAoE;GAClE;IAAE,IAAI,EAAE,wBAAwB,CAAA;CAAE;AACpC,oCAAoC;GAClC;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE;AACrC,0CAA0C;GACxC;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAA;AAEtB,wDAAwD;AACxD,MAAM,WAAW,iBAAiB;IAChC,qFAAqF;IACrF,cAAc,EAAE,OAAO,CAAA;IACvB,qCAAqC;IACrC,MAAM,EAAE,iBAAiB,CAAA;CAC1B;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,gBAAgB,EACvB,KAAK,EAAE,gBAAgB,GACtB,iBAAiB,CA6HnB"}
|
|
@@ -0,0 +1,519 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-neutral helpers of the IDE chat composer: the slash-command menu
|
|
3
|
+
* filter, the read-only viewer gate, the keyboard index wrap, the @-mention
|
|
4
|
+
* ranking and the `<file …>` block a mention inserts, the two persistence keys
|
|
5
|
+
* (unsent draft, active conversation), the `/explain` and `/lint` prompt
|
|
6
|
+
* builders with the limit-refusal parse the submit path reads, the pure
|
|
7
|
+
* classifier that fixes the order of `handleSubmit`'s checks, and the pure
|
|
8
|
+
* reducer behind the composer textarea's keydown handler (popup navigation,
|
|
9
|
+
* picks, Escape and the IME guard). Shared verbatim by every framework's chat
|
|
10
|
+
* panel, so the menu, the viewer rules, the mention picker, the typed commands
|
|
11
|
+
* and the keyboard behave the same in each.
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
import { COMMANDS, matchesSideChannelCommand } from '../command-metadata.js';
|
|
16
|
+
import { parseAutoCommitCommand } from './chat-autocommit-utilities.js';
|
|
17
|
+
import { parseEffortCommand } from './chat-effort-utilities.js';
|
|
18
|
+
import { isModeModelLocked, parseModelModeCommand } from './chat-model-mode-utilities.js';
|
|
19
|
+
import { parseReportCommand } from './chat-report-utilities.js';
|
|
20
|
+
import { parseRunCommand, parseScriptsCommand } from './chat-scripts-utilities.js';
|
|
21
|
+
import { SOUND_EVENTS } from './chat-settings-utilities.js';
|
|
22
|
+
import { parseShareCommand } from './chat-share-utilities.js';
|
|
23
|
+
import { parseTimestampsCommand } from './chat-timestamps-utilities.js';
|
|
24
|
+
import { parseTestsBarArg } from './tests-bar-utilities.js';
|
|
25
|
+
import { parseTestCommand } from './tests-card-utilities.js';
|
|
26
|
+
/**
|
|
27
|
+
* The `sessionStorage` key the composer persists an unsent draft under, per
|
|
28
|
+
* project.
|
|
29
|
+
* @param projectId - The project the chat panel belongs to.
|
|
30
|
+
* @returns The draft storage key (`mol-chat-draft:<projectId>`).
|
|
31
|
+
*/
|
|
32
|
+
export function chatDraftStorageKey(projectId) {
|
|
33
|
+
return `mol-chat-draft:${projectId}`;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The `localStorage` key the outer panel remembers the active conversation
|
|
37
|
+
* under, per project.
|
|
38
|
+
* @param projectId - The project the chat panel belongs to.
|
|
39
|
+
* @returns The conversation storage key (`mol-chat-conv:<projectId>`).
|
|
40
|
+
*/
|
|
41
|
+
export function chatConversationStorageKey(projectId) {
|
|
42
|
+
return `mol-chat-conv:${projectId}`;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Whether a read-only project VIEWER may run `command` — true only for a
|
|
46
|
+
* command flagged {@link CommandDef.viewerSafe} (a read, a view-only surface or
|
|
47
|
+
* a per-user preference). Everything else is default-DENIED: an unflagged or
|
|
48
|
+
* missing command is unavailable to viewers. Host side-channel commands are
|
|
49
|
+
* gated separately by `matchesSideChannelCommand`, which the callers OR in
|
|
50
|
+
* where a viewer may also message the team.
|
|
51
|
+
* @param command - The command definition, or `undefined` when the text named
|
|
52
|
+
* no registered command.
|
|
53
|
+
* @returns `true` when the command is viewer-safe, `false` otherwise.
|
|
54
|
+
*/
|
|
55
|
+
export function viewerCommandAllowed(command) {
|
|
56
|
+
return command?.viewerSafe === true;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The commands an open command menu lists: every command for a `showAll` menu
|
|
60
|
+
* (the slash-button toggle over existing text) or the ones whose label starts
|
|
61
|
+
* with the typed text; viewers see only the commands they can run (viewer-safe
|
|
62
|
+
* reads plus the team side channel); `/share` is listed only when the host
|
|
63
|
+
* allows sharing.
|
|
64
|
+
* @param commands - The command registry unioned with any host-provided commands.
|
|
65
|
+
* @param menu - The open command menu, or `null` when it is closed.
|
|
66
|
+
* @param canEdit - Whether the member may edit the project (`false` for a
|
|
67
|
+
* read-only viewer; `undefined` counts as an editor).
|
|
68
|
+
* @param shareAllowed - Whether the host allows managing share links.
|
|
69
|
+
* @returns The commands the menu shows, in registry order (`[]` when closed).
|
|
70
|
+
*/
|
|
71
|
+
export function filterCommandMenu(commands, menu, canEdit, shareAllowed) {
|
|
72
|
+
if (!menu)
|
|
73
|
+
return [];
|
|
74
|
+
return commands.filter((c) =>
|
|
75
|
+
// A showAll menu (slash-button toggle over existing text) lists every
|
|
76
|
+
// command; a typed menu filters by the composer's text.
|
|
77
|
+
(menu.showAll === true || c.label.startsWith(menu.text)) &&
|
|
78
|
+
// Viewers see only commands they can actually run (viewer-safe reads +
|
|
79
|
+
// the /teamsay side channel) — no dead entries in the menu.
|
|
80
|
+
(canEdit !== false || viewerCommandAllowed(c) || c.sideChannel === true) &&
|
|
81
|
+
// /share is gated separately: hosts commonly mint at admin+, so an
|
|
82
|
+
// editor without the capability gets no dead menu entry either.
|
|
83
|
+
(c.id !== 'share' || shareAllowed));
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Wrap-around index: Down from -1 → 0, Up from -1 → last, wraps at both ends.
|
|
87
|
+
* @param cur - The current index (-1 means no selection).
|
|
88
|
+
* @param delta - The direction to move (+1 down, -1 up).
|
|
89
|
+
* @param len - The total number of items.
|
|
90
|
+
* @returns The new wrapped index.
|
|
91
|
+
*/
|
|
92
|
+
export function wrapIdx(cur, delta, len) {
|
|
93
|
+
if (cur === -1)
|
|
94
|
+
return delta > 0 ? 0 : len - 1;
|
|
95
|
+
return (((cur + delta) % len) + len) % len;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Normalize an active-file/tab path to the relative form entry names use (no
|
|
99
|
+
* leading `/`, no `/workspace/` prefix).
|
|
100
|
+
* @param p - The absolute or workspace-relative path.
|
|
101
|
+
* @returns The path relative to the workspace root.
|
|
102
|
+
*/
|
|
103
|
+
function normalizeTabPath(p) {
|
|
104
|
+
return p.startsWith('/workspace/')
|
|
105
|
+
? p.slice('/workspace/'.length)
|
|
106
|
+
: p.startsWith('/')
|
|
107
|
+
? p.slice(1)
|
|
108
|
+
: p;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Rank the @-mention picker's entries by the composer query: entries whose name
|
|
112
|
+
* contains the query (case-insensitive), with the active file first, then open
|
|
113
|
+
* tabs, then prefix matches, then the rest alphabetically — capped at the first
|
|
114
|
+
* fifteen rows.
|
|
115
|
+
* @param entries - The picker's file entries.
|
|
116
|
+
* @param query - The text typed after the `@`.
|
|
117
|
+
* @param activeFile - The editor's active file, if any (`null` when none).
|
|
118
|
+
* @param openTabs - The editor's open tab paths, if any.
|
|
119
|
+
* @returns The ranked, capped entries to show.
|
|
120
|
+
*/
|
|
121
|
+
export function rankFileMentionEntries(entries, query, activeFile, openTabs) {
|
|
122
|
+
const q = query.toLowerCase();
|
|
123
|
+
// Normalize active file and open tabs to match entry names (relative paths without leading /)
|
|
124
|
+
const activeNorm = activeFile ? normalizeTabPath(activeFile) : null;
|
|
125
|
+
const openTabSet = new Set((openTabs ?? []).map(normalizeTabPath));
|
|
126
|
+
// Filter by query
|
|
127
|
+
const matches = q ? entries.filter((e) => e.name.toLowerCase().includes(q)) : entries;
|
|
128
|
+
// Rank: active file first, then open tabs, then rest (by match position)
|
|
129
|
+
const scored = matches.map((e) => {
|
|
130
|
+
const name = e.name;
|
|
131
|
+
const nameLower = name.toLowerCase();
|
|
132
|
+
let score = 0;
|
|
133
|
+
if (activeNorm && name === activeNorm)
|
|
134
|
+
score = 3;
|
|
135
|
+
else if (openTabSet.has(name))
|
|
136
|
+
score = 2;
|
|
137
|
+
// Boost prefix matches (query matches start of filename)
|
|
138
|
+
else if (q && nameLower.split('/').pop()?.startsWith(q))
|
|
139
|
+
score = 1;
|
|
140
|
+
return { entry: e, score };
|
|
141
|
+
});
|
|
142
|
+
scored.sort((a, b) => {
|
|
143
|
+
if (a.score !== b.score)
|
|
144
|
+
return b.score - a.score;
|
|
145
|
+
return a.entry.name.localeCompare(b.entry.name);
|
|
146
|
+
});
|
|
147
|
+
return scored.map((s) => s.entry).slice(0, 15);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Build the `<file …>` block a chosen @-mention inserts into the outgoing
|
|
151
|
+
* message: the file's content in a language-tagged fence, or a placeholder when
|
|
152
|
+
* the sandbox could not read it. The caller joins it to any text already in the
|
|
153
|
+
* message with a blank line.
|
|
154
|
+
* @param displayPath - The path to annotate the block with (no leading `/`).
|
|
155
|
+
* @param extension - The file's extension, used as the fence language tag.
|
|
156
|
+
* @param content - The file's text, or `null` when it could not be read.
|
|
157
|
+
* @returns The message block.
|
|
158
|
+
*/
|
|
159
|
+
export function buildFileMentionBlock(displayPath, extension, content) {
|
|
160
|
+
if (content === null) {
|
|
161
|
+
return `<file path="${displayPath}">[Could not read file]</file>`;
|
|
162
|
+
}
|
|
163
|
+
return `<file path="${displayPath}">\n\`\`\`${extension}\n${content}\n\`\`\`\n</file>`;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* The prompt a `/explain` submit sends: the named target, or a default that
|
|
167
|
+
* asks about what the user just shared.
|
|
168
|
+
* @param target - The text after `/explain`, when any.
|
|
169
|
+
* @param hasAttachments - Whether @-mentioned files ride along with the send.
|
|
170
|
+
* @returns The message text to send.
|
|
171
|
+
*/
|
|
172
|
+
export function buildExplainPrompt(target, hasAttachments) {
|
|
173
|
+
if (target)
|
|
174
|
+
return `Explain this in detail: ${target}`;
|
|
175
|
+
return hasAttachments
|
|
176
|
+
? 'Explain the attached file(s) in detail. Be thorough but concise.'
|
|
177
|
+
: 'Explain the code I just shared or the most recently discussed code. Be thorough but concise.';
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* The prompt a `/lint` submit sends: lint the named path with `npm run lint --
|
|
181
|
+
* <args>`, or the whole project.
|
|
182
|
+
* @param args - The text after `/lint`, when any.
|
|
183
|
+
* @returns The message text to send.
|
|
184
|
+
*/
|
|
185
|
+
export function buildLintPrompt(args) {
|
|
186
|
+
return args
|
|
187
|
+
? `Run the linter on ${args} and fix any issues found: npm run lint -- ${args}`
|
|
188
|
+
: 'Run the project linter (npm run lint) and fix any issues found. Show what you fixed.';
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Parse a failed request's usage-limit refusal out of its response body. The
|
|
192
|
+
* backend describes a refusal as `{ error, limitType, requiresSignup?,
|
|
193
|
+
* billingAction?, upgradeTier? }`; anything else (a network failure, a plain
|
|
194
|
+
* message error) is not a limit refusal.
|
|
195
|
+
* @param error - The caught error value.
|
|
196
|
+
* @returns The refusal, or `null` when the error carries none.
|
|
197
|
+
*/
|
|
198
|
+
export function limitRefusalFromError(error) {
|
|
199
|
+
const data = error?.response?.data;
|
|
200
|
+
if (typeof data?.limitType !== 'string')
|
|
201
|
+
return null;
|
|
202
|
+
return {
|
|
203
|
+
error: data.error,
|
|
204
|
+
limitType: data.limitType,
|
|
205
|
+
requiresSignup: data.requiresSignup,
|
|
206
|
+
billingAction: data.billingAction,
|
|
207
|
+
upgradeTier: data.upgradeTier,
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Classify a composer submit into the one path it takes, fixing the order of
|
|
212
|
+
* `handleSubmit`'s checks: transcript-only and empty submits, the team-message
|
|
213
|
+
* gate, the read-only viewer gate, every locally-handled slash command, the
|
|
214
|
+
* side-channel send, and finally a plain message. Deterministic and
|
|
215
|
+
* side-effect free — the caller performs every side effect (`setInputValue`,
|
|
216
|
+
* `addSystemCard`, `sendMessage`, …) for the returned route — so the check
|
|
217
|
+
* order is identical in every framework's chat panel.
|
|
218
|
+
* @param input - The composer's raw text.
|
|
219
|
+
* @param state - The props and derived values the checks read.
|
|
220
|
+
* @returns The {@link ComposerSubmitRoute} the submit takes.
|
|
221
|
+
*/
|
|
222
|
+
export function routeComposerSubmit(input, state) {
|
|
223
|
+
if (state.transcriptOnly)
|
|
224
|
+
return { kind: 'ignored' };
|
|
225
|
+
const trimmed = input.trim();
|
|
226
|
+
if (!trimmed && state.attachedCount === 0)
|
|
227
|
+
return { kind: 'ignored' };
|
|
228
|
+
// A team side-channel message is unavailable here when the workspace forbids
|
|
229
|
+
// team messaging. The gate reads the registry plus the host's commands, not
|
|
230
|
+
// the member-filtered menu list.
|
|
231
|
+
const teamCommands = state.extraCommands?.length
|
|
232
|
+
? [...COMMANDS, ...state.extraCommands]
|
|
233
|
+
: COMMANDS;
|
|
234
|
+
if (state.canSendTeamMessages === false && matchesSideChannelCommand(teamCommands, trimmed)) {
|
|
235
|
+
return { kind: 'team-blocked' };
|
|
236
|
+
}
|
|
237
|
+
// Read-only VIEWER guard. A viewer cannot run the assistant (the server 403s
|
|
238
|
+
// the chat route) or any project-mutating command, so block a plain message
|
|
239
|
+
// or a write-command here with a read-only note instead of a silent 403 —
|
|
240
|
+
// but let team side-channel messages (/teamsay) and viewerSafe commands
|
|
241
|
+
// through so viewers can still talk to the team and read. (Menu-dispatched
|
|
242
|
+
// commands are gated in executeCommand; this covers composer typing.)
|
|
243
|
+
if (!state.canEdit) {
|
|
244
|
+
const token = trimmed.match(/^\/(\S+)/)?.[1]?.toLowerCase();
|
|
245
|
+
const def = token
|
|
246
|
+
? state.allCommands.find((c) => c.id.toLowerCase() === token || c.aliases?.includes(token))
|
|
247
|
+
: undefined;
|
|
248
|
+
const allowed = matchesSideChannelCommand(state.allCommands, trimmed) || viewerCommandAllowed(def);
|
|
249
|
+
if (!allowed)
|
|
250
|
+
return { kind: 'viewer-blocked' };
|
|
251
|
+
}
|
|
252
|
+
// Handle /autofix toggle locally
|
|
253
|
+
if (/^\/autofix$/i.test(trimmed))
|
|
254
|
+
return { kind: 'autofix' };
|
|
255
|
+
// Handle /autoapprove toggle locally
|
|
256
|
+
if (/^\/autoapprove$/i.test(trimmed))
|
|
257
|
+
return { kind: 'autoapprove' };
|
|
258
|
+
// Handle /sounds command locally
|
|
259
|
+
if (/^\/sounds$/i.test(trimmed))
|
|
260
|
+
return { kind: 'sounds' };
|
|
261
|
+
// `/test on | off | toggle` sets whether the TESTS STRIP is shown — a
|
|
262
|
+
// per-device display preference, the same shape as /timestamps. Bare
|
|
263
|
+
// `/test` is left alone: it opens the tests browser, which is a different
|
|
264
|
+
// thing and is what the command menu offers.
|
|
265
|
+
const testsBarMatch = /^\/test(?:s)?\s+(.+)$/i.exec(trimmed);
|
|
266
|
+
if (testsBarMatch) {
|
|
267
|
+
const next = parseTestsBarArg(testsBarMatch[1] ?? '', state.readTestsBarVisible());
|
|
268
|
+
if (next !== null)
|
|
269
|
+
return { kind: 'tests-bar', visible: next };
|
|
270
|
+
}
|
|
271
|
+
// Handle /timestamps [on | off] locally — a per-device display preference.
|
|
272
|
+
const timestampsCommand = parseTimestampsCommand(trimmed);
|
|
273
|
+
if (timestampsCommand)
|
|
274
|
+
return { kind: 'timestamps', command: timestampsCommand };
|
|
275
|
+
// Handle /settings command locally
|
|
276
|
+
if (/^\/settings$/i.test(trimmed))
|
|
277
|
+
return { kind: 'settings' };
|
|
278
|
+
// Handle /skills [query] command locally — opens the skills browser overlay,
|
|
279
|
+
// seeded with the query (if any) so it opens pre-filtered.
|
|
280
|
+
const skillsMatch = trimmed.match(/^\/skills(?:\s+(.*))?$/i);
|
|
281
|
+
if (skillsMatch)
|
|
282
|
+
return { kind: 'skills', query: skillsMatch[1]?.trim() ?? '' };
|
|
283
|
+
// Handle /scripts [query] command locally — opens the scripts browser overlay,
|
|
284
|
+
// seeded with the query (if any) so it opens pre-filtered.
|
|
285
|
+
const scriptsMatch = parseScriptsCommand(trimmed);
|
|
286
|
+
if (scriptsMatch)
|
|
287
|
+
return { kind: 'scripts', query: scriptsMatch.query };
|
|
288
|
+
// Handle /test [query | all] locally — opens the tests browser overlay,
|
|
289
|
+
// seeded with the query (if any); `all` runs everything straight away.
|
|
290
|
+
const testMatch = parseTestCommand(trimmed);
|
|
291
|
+
if (testMatch)
|
|
292
|
+
return { kind: 'tests', query: testMatch.query, runAll: testMatch.runAll };
|
|
293
|
+
// Handle /run <name> command locally — resolves + runs a saved script.
|
|
294
|
+
const runMatch = parseRunCommand(trimmed);
|
|
295
|
+
if (runMatch)
|
|
296
|
+
return { kind: 'run-script', name: runMatch.name, params: runMatch.params };
|
|
297
|
+
// Handle /report [title] and /bug [title] commands locally — opens the
|
|
298
|
+
// bug-report modal, seeding the title from any trailing text.
|
|
299
|
+
const reportMatch = parseReportCommand(trimmed);
|
|
300
|
+
if (reportMatch)
|
|
301
|
+
return { kind: 'report', title: reportMatch.title };
|
|
302
|
+
// Handle /share [role] locally — opens the share-link modal at the requested
|
|
303
|
+
// role (default viewer). An unrecognized role shows usage instead. Below the
|
|
304
|
+
// host's share capability (e.g. an editor where minting is admin+), say so
|
|
305
|
+
// plainly instead of opening a modal whose every request 403s.
|
|
306
|
+
const shareMatch = parseShareCommand(trimmed);
|
|
307
|
+
if (shareMatch)
|
|
308
|
+
return { kind: 'share', command: shareMatch };
|
|
309
|
+
// Handle /autocommit <seconds> locally — arms/cancels the countdown that
|
|
310
|
+
// auto-fires the existing /commit path N seconds after the last file change.
|
|
311
|
+
const autoCommitMatch = parseAutoCommitCommand(trimmed);
|
|
312
|
+
if (autoCommitMatch)
|
|
313
|
+
return { kind: 'autocommit', seconds: autoCommitMatch.seconds };
|
|
314
|
+
// Handle /model --plan / --execute / --commit / --compact locally — opens
|
|
315
|
+
// the picker scoped to that mode so a selection persists to planModel /
|
|
316
|
+
// executeModel / commitModel / compactModel. Must run BEFORE the generic
|
|
317
|
+
// /model handler so the flag isn't treated as a model name.
|
|
318
|
+
const modelModeMatch = parseModelModeCommand(trimmed);
|
|
319
|
+
if (modelModeMatch)
|
|
320
|
+
return { kind: 'model-mode', mode: modelModeMatch.mode };
|
|
321
|
+
// Handle /mic (alias /dictate) locally — opens the dictation engine picker
|
|
322
|
+
if (/^\/(mic|dictate)$/i.test(trimmed))
|
|
323
|
+
return { kind: 'mic' };
|
|
324
|
+
// Handle /model <name> command locally
|
|
325
|
+
const modelCmdMatch = trimmed.match(/^\/model(?:\s+(.+))?$/i);
|
|
326
|
+
if (modelCmdMatch)
|
|
327
|
+
return { kind: 'model', query: modelCmdMatch[1]?.trim() };
|
|
328
|
+
// Handle /effort locally — effort is PER-MODE (settings.effortByMode; the
|
|
329
|
+
// legacy single effortLevel is the fallback) and is shown/typed in the
|
|
330
|
+
// target mode's MODEL-NATIVE values (e.g. xhigh on Claude, 16K thinking
|
|
331
|
+
// tokens on budget-scaled models) — never the internal S/M/L/XL letters.
|
|
332
|
+
// The backend applies it to the provider reasoning param (and the
|
|
333
|
+
// agent-loop budget) at chat-call time.
|
|
334
|
+
const effortCmd = parseEffortCommand(trimmed);
|
|
335
|
+
if (effortCmd)
|
|
336
|
+
return { kind: 'effort', command: effortCmd };
|
|
337
|
+
// Handle /maxloops <N> command locally — server enforces tier cap
|
|
338
|
+
const maxLoopsMatch = trimmed.match(/^\/maxloops\s+(\d+)$/i);
|
|
339
|
+
if (maxLoopsMatch)
|
|
340
|
+
return { kind: 'max-loops', loops: Math.max(1, Number(maxLoopsMatch[1])) };
|
|
341
|
+
// Handle /explain [target] — inject prompt for AI to explain code
|
|
342
|
+
// NOTE: does NOT return early when files are attached — falls through to
|
|
343
|
+
// attachment processing below so that @-attached files are included in the
|
|
344
|
+
// message sent to the AI.
|
|
345
|
+
const explainMatch = trimmed.match(/^\/explain(?:\s+(.*))?$/i);
|
|
346
|
+
if (explainMatch && state.attachedCount === 0) {
|
|
347
|
+
const target = explainMatch[1]?.trim();
|
|
348
|
+
return { kind: 'explain', prompt: buildExplainPrompt(target, false) };
|
|
349
|
+
}
|
|
350
|
+
// Handle /lint [args] — inject prompt for AI to run linter
|
|
351
|
+
const lintMatch = trimmed.match(/^\/lint(?:\s+(.*))?$/i);
|
|
352
|
+
if (lintMatch)
|
|
353
|
+
return { kind: 'lint', prompt: buildLintPrompt(lintMatch[1]?.trim()) };
|
|
354
|
+
// A host side-channel command (CommandDef.sideChannel, matched by id or alias — e.g.
|
|
355
|
+
// molecule.dev's /teamsay + /t): send the raw text to the host's server intercept but
|
|
356
|
+
// suppress the optimistic user bubble. The server emits the canonical `message` stream
|
|
357
|
+
// event (persisted + broadcast to every member), which IS the visible message — so the
|
|
358
|
+
// transcript never shows the literal "/command" text, and never shows it twice.
|
|
359
|
+
if (matchesSideChannelCommand(state.allCommands, trimmed)) {
|
|
360
|
+
return { kind: 'side-channel', message: trimmed };
|
|
361
|
+
}
|
|
362
|
+
// Rewrite /explain with attachments into a proper prompt (attachments
|
|
363
|
+
// processed by the caller).
|
|
364
|
+
const message = explainMatch ? buildExplainPrompt(explainMatch[1]?.trim(), true) : trimmed;
|
|
365
|
+
return { kind: 'send', message };
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Decide what the composer's keydown handler does for one key: the IME guard,
|
|
369
|
+
* Escape's close order (sounds, mic, effort, model, overlay, file, command,
|
|
370
|
+
* abort), the open picker's arrow/Enter/Tab navigation, and the bare Enter that
|
|
371
|
+
* submits. Pure and side-effect free — the caller performs every effect — so
|
|
372
|
+
* the key behavior is identical in every framework's chat panel.
|
|
373
|
+
* @param event - The keydown event's fields.
|
|
374
|
+
* @param state - The open popups and the panel values the decisions read.
|
|
375
|
+
* @returns The {@link ComposerKeyAction} to apply.
|
|
376
|
+
*/
|
|
377
|
+
export function composerKeyAction(event, state) {
|
|
378
|
+
// A key that is part of an IME composition (Enter accepting a Japanese, Chinese
|
|
379
|
+
// or Korean candidate) must reach the input method, not send the message.
|
|
380
|
+
if (event.isComposing || event.keyCode === 229)
|
|
381
|
+
return ignoreKey();
|
|
382
|
+
if (event.key === 'Escape') {
|
|
383
|
+
// Close the topmost popup only, so one Escape never dismisses two surfaces.
|
|
384
|
+
if (state.soundsPicker)
|
|
385
|
+
return act(false, { kind: 'close-sounds' });
|
|
386
|
+
if (state.micOpen)
|
|
387
|
+
return act(false, { kind: 'close-mic' });
|
|
388
|
+
if (state.effortPicker)
|
|
389
|
+
return act(false, { kind: 'close-effort' });
|
|
390
|
+
if (state.modelPicker)
|
|
391
|
+
return act(false, { kind: 'close-model' });
|
|
392
|
+
if (state.overlayOpen)
|
|
393
|
+
return act(false, { kind: 'close-overlay' });
|
|
394
|
+
if (state.filePicker)
|
|
395
|
+
return act(false, { kind: 'close-file' });
|
|
396
|
+
if (state.commandMenu)
|
|
397
|
+
return act(false, { kind: 'close-command' });
|
|
398
|
+
if (state.abortable) {
|
|
399
|
+
// Same path as the Stop button: kill the stream AND drop the pending
|
|
400
|
+
// automatic follow-ups (deferred auto-fix, verification countdown).
|
|
401
|
+
return act(false, { kind: 'abort' });
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
// Sounds picker: "All" row at index 0, then one row per event.
|
|
405
|
+
if (state.soundsPicker) {
|
|
406
|
+
if (event.key === 'ArrowDown')
|
|
407
|
+
return act(true, { kind: 'sounds-move', delta: 1 });
|
|
408
|
+
if (event.key === 'ArrowUp')
|
|
409
|
+
return act(true, { kind: 'sounds-move', delta: -1 });
|
|
410
|
+
if (event.key === 'Enter' || event.key === 'Tab') {
|
|
411
|
+
const idx = state.soundsPicker.selectedIdx >= 0 ? state.soundsPicker.selectedIdx : 0;
|
|
412
|
+
const target = idx === 0 ? 'all' : SOUND_EVENTS[idx - 1];
|
|
413
|
+
return act(true, { kind: 'sounds-pick', event: target });
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
// Effort picker: one row per (typed-filter-matching) level of the selected
|
|
417
|
+
// mode's model. A fixed-reasoning model or an unmatched filter lists
|
|
418
|
+
// nothing — arrows/Enter fall through (Escape closes; Enter submits the
|
|
419
|
+
// typed text, so an unknown level still gets the "isn't available" card).
|
|
420
|
+
if (state.effortPicker && state.effortPickerVisible.length > 0) {
|
|
421
|
+
if (event.key === 'ArrowDown')
|
|
422
|
+
return act(true, { kind: 'effort-move', delta: 1 });
|
|
423
|
+
if (event.key === 'ArrowUp')
|
|
424
|
+
return act(true, { kind: 'effort-move', delta: -1 });
|
|
425
|
+
if (event.key === 'Enter' || event.key === 'Tab') {
|
|
426
|
+
// Highlighted row wins; otherwise an exactly-typed level beats the
|
|
427
|
+
// first substring match ("/effort high" must never apply xhigh's
|
|
428
|
+
// neighbor), then default to the first visible row (mirrors /model).
|
|
429
|
+
let option = state.effortPickerVisible[state.effortPicker.selectedIdx];
|
|
430
|
+
if (!option) {
|
|
431
|
+
const typed = parseEffortCommand(state.input);
|
|
432
|
+
const q = typed?.kind === 'set' ? typed.arg.toLowerCase() : '';
|
|
433
|
+
option =
|
|
434
|
+
(q ? state.effortPickerVisible.find((o) => o.value.toLowerCase() === q) : undefined) ??
|
|
435
|
+
state.effortPickerVisible[0];
|
|
436
|
+
}
|
|
437
|
+
return act(true, option
|
|
438
|
+
? { kind: 'effort-pick', mode: state.effortPicker.mode, level: option.value }
|
|
439
|
+
: { kind: 'none' });
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
// The optional "manage your own models" row sits after the model rows and
|
|
443
|
+
// participates in arrow/Enter navigation as the last index.
|
|
444
|
+
const modelRowCount = state.visibleModels.length + (state.hasManageCustomModels ? 1 : 0);
|
|
445
|
+
if (state.modelPicker && modelRowCount > 0) {
|
|
446
|
+
if (event.key === 'ArrowDown')
|
|
447
|
+
return act(true, { kind: 'model-move', delta: 1 });
|
|
448
|
+
if (event.key === 'ArrowUp')
|
|
449
|
+
return act(true, { kind: 'model-move', delta: -1 });
|
|
450
|
+
if (event.key === 'Enter' || event.key === 'Tab') {
|
|
451
|
+
const picker = state.modelPicker;
|
|
452
|
+
const idx = picker.selectedIdx >= 0 ? picker.selectedIdx : 0;
|
|
453
|
+
if (state.hasManageCustomModels && idx === state.visibleModels.length) {
|
|
454
|
+
const manageMode = picker.mode === 'plan' || picker.mode === 'execute' ? picker.mode : state.liveMode;
|
|
455
|
+
return act(true, { kind: 'model-manage', mode: manageMode });
|
|
456
|
+
}
|
|
457
|
+
const model = state.visibleModels[idx];
|
|
458
|
+
if (!model)
|
|
459
|
+
return act(true, { kind: 'none' });
|
|
460
|
+
// Honor the free-tier clamp for the active mode; ignore Enter on a
|
|
461
|
+
// locked model (the click path shows the upgrade card). Custom
|
|
462
|
+
// (bring-your-own AI) models are never locked — the user pays their
|
|
463
|
+
// own provider directly.
|
|
464
|
+
const locked = picker.mode
|
|
465
|
+
? isModeModelLocked(model.id, picker.mode, state.isFreeTier, state.models, state.serverModelDefaults)
|
|
466
|
+
: state.isFreeTier && model.id !== state.freeTierModelId && model.provider !== 'custom';
|
|
467
|
+
return act(true, { kind: 'model-pick', model, mode: picker.mode, locked });
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
if (state.filePicker) {
|
|
471
|
+
if (event.key === 'ArrowDown')
|
|
472
|
+
return act(true, { kind: 'file-move', delta: 1 });
|
|
473
|
+
if (event.key === 'ArrowUp')
|
|
474
|
+
return act(true, { kind: 'file-move', delta: -1 });
|
|
475
|
+
if (event.key === 'Enter' || event.key === 'Tab') {
|
|
476
|
+
const entry = state.filteredEntries[state.filePicker.selectedIdx];
|
|
477
|
+
return act(true, entry ? { kind: 'file-pick', entry } : { kind: 'none' });
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
if (state.commandMenu && state.filteredCmds.length > 0) {
|
|
481
|
+
if (event.key === 'ArrowDown')
|
|
482
|
+
return act(true, { kind: 'command-move', delta: 1 });
|
|
483
|
+
if (event.key === 'ArrowUp')
|
|
484
|
+
return act(true, { kind: 'command-move', delta: -1 });
|
|
485
|
+
if (event.key === 'Enter' || event.key === 'Tab') {
|
|
486
|
+
// A showAll menu (opened by the slash BUTTON over existing text) only
|
|
487
|
+
// executes an explicitly highlighted command — a bare Enter closes it
|
|
488
|
+
// and falls through to submit the composer text as typed (Shift+Enter
|
|
489
|
+
// only closes it: the submit below requires no Shift).
|
|
490
|
+
if (state.commandMenu.showAll && state.commandMenu.selectedIdx < 0 && event.key === 'Enter') {
|
|
491
|
+
return event.shiftKey
|
|
492
|
+
? act(false, { kind: 'close-command' })
|
|
493
|
+
: act(true, { kind: 'command-dismiss-submit' });
|
|
494
|
+
}
|
|
495
|
+
const cmd = state.filteredCmds[state.commandMenu.selectedIdx >= 0 ? state.commandMenu.selectedIdx : 0];
|
|
496
|
+
return act(true, cmd ? { kind: 'command-run', id: cmd.id } : { kind: 'none' });
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
if (event.key === 'Enter' && !event.shiftKey)
|
|
500
|
+
return act(true, { kind: 'submit' });
|
|
501
|
+
return ignoreKey();
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* The action for a key that does nothing at all.
|
|
505
|
+
* @returns The ignore action.
|
|
506
|
+
*/
|
|
507
|
+
function ignoreKey() {
|
|
508
|
+
return { preventDefault: false, effect: { kind: 'none' } };
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* The action for a handled key: suppress the browser default and apply `effect`.
|
|
512
|
+
* @param preventDefault - Whether the handler calls `event.preventDefault()`.
|
|
513
|
+
* @param effect - The effect the handler applies.
|
|
514
|
+
* @returns The action.
|
|
515
|
+
*/
|
|
516
|
+
function act(preventDefault, effect) {
|
|
517
|
+
return { preventDefault, effect };
|
|
518
|
+
}
|
|
519
|
+
//# sourceMappingURL=chat-composer-utilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-composer-utilities.js","sourceRoot":"","sources":["../../src/components/chat-composer-utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,OAAO,EAAE,QAAQ,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAA;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAA;AAcvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAE/D,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAA;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAElF,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAE7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAE5D;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,SAAiB;IACnD,OAAO,kBAAkB,SAAS,EAAE,CAAA;AACtC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CAAC,SAAiB;IAC1D,OAAO,iBAAiB,SAAS,EAAE,CAAA;AACrC,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAA+B;IAClE,OAAO,OAAO,EAAE,U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