@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.
Files changed (69) hide show
  1. package/README.md +277 -1
  2. package/dist/chatTimelineOrdering.d.ts +175 -1
  3. package/dist/chatTimelineOrdering.d.ts.map +1 -1
  4. package/dist/chatTimelineOrdering.js +192 -1
  5. package/dist/chatTimelineOrdering.js.map +1 -1
  6. package/dist/components/chat-autocommit-utilities.d.ts.map +1 -1
  7. package/dist/components/chat-autocommit-utilities.js +3 -2
  8. package/dist/components/chat-autocommit-utilities.js.map +1 -1
  9. package/dist/components/chat-card-event-utilities.d.ts +320 -0
  10. package/dist/components/chat-card-event-utilities.d.ts.map +1 -0
  11. package/dist/components/chat-card-event-utilities.js +198 -0
  12. package/dist/components/chat-card-event-utilities.js.map +1 -0
  13. package/dist/components/chat-composer-utilities.d.ts +472 -0
  14. package/dist/components/chat-composer-utilities.d.ts.map +1 -0
  15. package/dist/components/chat-composer-utilities.js +519 -0
  16. package/dist/components/chat-composer-utilities.js.map +1 -0
  17. package/dist/components/chat-dictation-controller.d.ts +376 -0
  18. package/dist/components/chat-dictation-controller.d.ts.map +1 -0
  19. package/dist/components/chat-dictation-controller.js +559 -0
  20. package/dist/components/chat-dictation-controller.js.map +1 -0
  21. package/dist/components/chat-effort-utilities.d.ts +24 -0
  22. package/dist/components/chat-effort-utilities.d.ts.map +1 -1
  23. package/dist/components/chat-effort-utilities.js +41 -0
  24. package/dist/components/chat-effort-utilities.js.map +1 -1
  25. package/dist/components/chat-format-utilities.d.ts +71 -0
  26. package/dist/components/chat-format-utilities.d.ts.map +1 -0
  27. package/dist/components/chat-format-utilities.js +192 -0
  28. package/dist/components/chat-format-utilities.js.map +1 -0
  29. package/dist/components/chat-models-utilities.d.ts +168 -0
  30. package/dist/components/chat-models-utilities.d.ts.map +1 -1
  31. package/dist/components/chat-models-utilities.js +253 -0
  32. package/dist/components/chat-models-utilities.js.map +1 -1
  33. package/dist/components/chat-settings-utilities.d.ts +153 -1
  34. package/dist/components/chat-settings-utilities.d.ts.map +1 -1
  35. package/dist/components/chat-settings-utilities.js +204 -1
  36. package/dist/components/chat-settings-utilities.js.map +1 -1
  37. package/dist/components/chat-stream-utilities.d.ts +165 -1
  38. package/dist/components/chat-stream-utilities.d.ts.map +1 -1
  39. package/dist/components/chat-stream-utilities.js +155 -1
  40. package/dist/components/chat-stream-utilities.js.map +1 -1
  41. package/dist/components/chat-tests-controller.d.ts +249 -0
  42. package/dist/components/chat-tests-controller.d.ts.map +1 -0
  43. package/dist/components/chat-tests-controller.js +504 -0
  44. package/dist/components/chat-tests-controller.js.map +1 -0
  45. package/dist/components/chat-timeline-utilities.d.ts +90 -0
  46. package/dist/components/chat-timeline-utilities.d.ts.map +1 -0
  47. package/dist/components/chat-timeline-utilities.js +71 -0
  48. package/dist/components/chat-timeline-utilities.js.map +1 -0
  49. package/dist/components/chat-ui-constants.d.ts +98 -0
  50. package/dist/components/chat-ui-constants.d.ts.map +1 -0
  51. package/dist/components/chat-ui-constants.js +146 -0
  52. package/dist/components/chat-ui-constants.js.map +1 -0
  53. package/dist/components/chat-undo-utilities.d.ts +47 -0
  54. package/dist/components/chat-undo-utilities.d.ts.map +1 -0
  55. package/dist/components/chat-undo-utilities.js +73 -0
  56. package/dist/components/chat-undo-utilities.js.map +1 -0
  57. package/dist/components/context-usage-utilities.d.ts +25 -3
  58. package/dist/components/context-usage-utilities.d.ts.map +1 -1
  59. package/dist/components/context-usage-utilities.js +42 -2
  60. package/dist/components/context-usage-utilities.js.map +1 -1
  61. package/dist/index.d.ts +2 -0
  62. package/dist/index.d.ts.map +1 -1
  63. package/dist/index.js +2 -0
  64. package/dist/index.js.map +1 -1
  65. package/dist/panels.d.ts +6 -0
  66. package/dist/panels.d.ts.map +1 -1
  67. package/dist/panels.js +6 -0
  68. package/dist/panels.js.map +1 -1
  69. package/package.json +3 -3
@@ -0,0 +1,198 @@
1
+ /**
2
+ * The chat "system card" vocabulary and the one construction of a system card
3
+ * from a recorded `CardEvent`.
4
+ *
5
+ * The React panel carries these notices inline in its chat timeline — the
6
+ * model/mode/setting/skills/custom system cards, the dismissable tips, the
7
+ * captured activity cards, commit cards, attached files and the composer's
8
+ * command/mode/effort/file pickers. Every framework's panel shows the same
9
+ * cards, so the types and the `CardEvent` → {@link SystemCard} mapping live
10
+ * here, framework-neutral. A view supplies its own `t()`, model catalog,
11
+ * region choices, custom-card factory and logger through
12
+ * {@link CardEventToSystemCardDeps}; nothing in this module reads React state,
13
+ * refs, props or hooks.
14
+ *
15
+ * @module
16
+ */
17
+ import { effectiveModelRegion } from './chat-models-utilities.js';
18
+ /**
19
+ * Build a renderable {@link SystemCard} from a card-message's raw {@link CardEvent}. This is the ONE
20
+ * construction, used IDENTICALLY for a live `card` event (now a card-message in the transcript)
21
+ * and for a card-message loaded on refresh — so the rendered card is the same in both, with
22
+ * no separate store and no client-side "should I show this" decision. App-specific copy /
23
+ * actions stay client-side (the server records only the raw data); returns null for an
24
+ * unrenderable card (a custom event with no registered factory, or a non-execute mode) so
25
+ * the timeline simply omits it.
26
+ *
27
+ * @param cardEvent - The raw recorded card payload.
28
+ * @param id - The card-message's id, carried onto the built card.
29
+ * @param timestamp - The card-message's timestamp, carried onto the built card.
30
+ * @param deps - The caller's translate function, model catalog, region choices, custom-card factory resolver and logger.
31
+ * @returns The system card to render, or null when the event has nothing to show.
32
+ */
33
+ export function cardEventToSystemCard(cardEvent, id, timestamp, deps) {
34
+ const { t, models, modelRegions, getFactory, logger } = deps;
35
+ // Suffix a card's copy with the member who made the change, when the
36
+ // server attributed one — so a teammate watching knows WHO flipped the
37
+ // model/effort/mode, live and on reload.
38
+ const withBy = (text) => {
39
+ const by = cardEvent.by;
40
+ return by
41
+ ? t('ide.chat.cardBy', { text, name: by }, { defaultValue: '{{text}} — {{name}}' })
42
+ : text;
43
+ };
44
+ switch (cardEvent.kind) {
45
+ case 'model': {
46
+ const label = cardEvent.label || cardEvent.model;
47
+ // Append the model's effective processing-region code — catalog
48
+ // models only. A custom/BYO endpoint has no meaningful region: its
49
+ // catalog `regions` defaults to ['us'] as a placeholder, not a real
50
+ // re-host choice, so never surface a region for it.
51
+ const def = models.find((m) => m.id === cardEvent.model);
52
+ const regionCode = def && def.provider !== 'custom'
53
+ ? effectiveModelRegion(def, modelRegions[def.id]).toUpperCase()
54
+ : null;
55
+ return {
56
+ id,
57
+ text: withBy(regionCode
58
+ ? t('ide.chat.modelInUseRegion', { model: label, region: regionCode }, { defaultValue: 'Now using {{model}} ({{region}})' })
59
+ : t('ide.chat.modelInUse', { model: label }, { defaultValue: 'Now using {{model}}' })),
60
+ timestamp,
61
+ };
62
+ }
63
+ case 'mode':
64
+ // The plan→build handoff ("🔨 Building your app") and the plan-mode
65
+ // announcement a new conversation is seeded with ("📝 Plan mode") —
66
+ // the server records mode cards only for those two.
67
+ if (cardEvent.mode === 'plan') {
68
+ return {
69
+ id,
70
+ text: withBy(t('ide.chat.phasePlanning', undefined, { defaultValue: '📝 Plan mode' })),
71
+ timestamp,
72
+ };
73
+ }
74
+ if (cardEvent.mode !== 'execute')
75
+ return null;
76
+ return {
77
+ id,
78
+ text: withBy(t('ide.chat.phaseBuilding', undefined, { defaultValue: '🔨 Building your app' })),
79
+ timestamp,
80
+ };
81
+ case 'setting': {
82
+ // A Synthase-altering setting changed (effort / fast mode / max loops /
83
+ // region / auto-fix / auto-approve) — announced to every member, live
84
+ // and on reload. Copy reuses the same localized strings as the local
85
+ // confirmation cards, so the shared card reads identically.
86
+ let text = null;
87
+ if (cardEvent.setting === 'effort') {
88
+ const level = String(cardEvent.value ?? 'default');
89
+ const cardMode = cardEvent.mode ?? '';
90
+ text = cardEvent.label
91
+ ? t('ide.chat.effort.setMode', { mode: cardMode, level, model: cardEvent.label }, { defaultValue: 'Reasoning effort for {{mode}} set to {{level}} ({{model}}).' })
92
+ : t('ide.chat.setting.effort', { mode: cardMode, level }, { defaultValue: 'Reasoning effort for {{mode}} set to {{level}}.' });
93
+ }
94
+ else if (cardEvent.setting === 'fastMode') {
95
+ text = cardEvent.value
96
+ ? t('ide.chat.fastModeOn', undefined, {
97
+ defaultValue: 'Fast mode on — faster responses at a higher rate',
98
+ })
99
+ : t('ide.chat.fastModeOff', undefined, { defaultValue: 'Fast mode off' });
100
+ }
101
+ else if (cardEvent.setting === 'maxToolLoops') {
102
+ text = t('ide.chat.maxLoopsSet', { n: Number(cardEvent.value ?? 0) }, { defaultValue: 'Max tool iterations set to {{n}}' });
103
+ }
104
+ else if (cardEvent.setting === 'region') {
105
+ text = t('ide.chat.modelInUseRegion', { model: cardEvent.label ?? '', region: String(cardEvent.value ?? '').toUpperCase() }, { defaultValue: 'Now using {{model}} ({{region}})' });
106
+ }
107
+ else if (cardEvent.setting === 'autoFix') {
108
+ text = cardEvent.value
109
+ ? t('ide.chat.autoFixEnabled', undefined, { defaultValue: 'Auto-fix enabled.' })
110
+ : t('ide.chat.autoFixDisabled', undefined, { defaultValue: 'Auto-fix disabled.' });
111
+ }
112
+ else if (cardEvent.setting === 'autoApprove') {
113
+ text = cardEvent.value
114
+ ? t('ide.chat.autoApproveEnabled', undefined, {
115
+ defaultValue: 'Auto-approve on — destructive commands run without asking. The exfiltration guard still asks. Turn off with /autoapprove.',
116
+ })
117
+ : t('ide.chat.autoApproveDisabled', undefined, {
118
+ defaultValue: 'Auto-approve off — destructive commands ask before running.',
119
+ });
120
+ }
121
+ if (!text)
122
+ return null;
123
+ return { id, text: withBy(text), timestamp };
124
+ }
125
+ case 'skills':
126
+ return {
127
+ id,
128
+ variant: 'skillsLoaded',
129
+ text: t('ide.chat.skills.loadedCount', { count: cardEvent.count }, { defaultValue: '🧠 Loaded {{count}} skills' }),
130
+ timestamp,
131
+ };
132
+ case 'custom': {
133
+ // App-registered renderer (registerCustomEventCard) builds the copy/actions/tone
134
+ // from the raw data — keeping app-specific text out of this shared package.
135
+ //
136
+ // This runs in a memo ABOVE the timeline's per-item boundaries, so a factory
137
+ // that throws would take the whole panel down rather than one card — and the
138
+ // factory is host code reading model-authored `data`, exactly the combination
139
+ // that caused the 2026-08-14 outage. One unrenderable card must cost one card.
140
+ let card;
141
+ try {
142
+ card = getFactory(cardEvent.name)?.(cardEvent.data);
143
+ }
144
+ catch (error) {
145
+ logger.error('Custom chat card factory threw — dropping the card', {
146
+ error,
147
+ name: cardEvent.name,
148
+ });
149
+ return null;
150
+ }
151
+ if (!card)
152
+ return null;
153
+ return {
154
+ id,
155
+ text: card.text,
156
+ ...(card.action ? { action: card.action } : {}),
157
+ ...(card.emphasized ? { emphasized: card.emphasized } : {}),
158
+ ...(card.tone ? { tone: card.tone } : {}),
159
+ ...(card.icon ? { icon: card.icon } : {}),
160
+ ...(card.content ? { content: card.content } : {}),
161
+ ...(card.coversLimitType ? { coversLimitType: card.coversLimitType } : {}),
162
+ ...(card.critical ? { critical: true } : {}),
163
+ timestamp,
164
+ };
165
+ }
166
+ default:
167
+ return null;
168
+ }
169
+ }
170
+ // ---------------------------------------------------------------------------
171
+ // One translated sentence around an inline segment
172
+ // ---------------------------------------------------------------------------
173
+ /**
174
+ * The stand-in a translated sentence is rendered with, to find where its slot lands. A
175
+ * private-use character: no translation or name carries it.
176
+ */
177
+ export const CARD_SEGMENT_SLOT = '';
178
+ /**
179
+ * A card body that puts one inline segment (a clickable code name, a link) where a
180
+ * translated sentence's placeholder sits: `Loaded {{name}} skill` gives
181
+ * `['Loaded ', segment, ' skill']`. The sentence stays ONE translation, so each language
182
+ * places the name where its grammar wants it; two fragment keys around the name
183
+ * ("Loaded " + " skill") forced English word order on every language.
184
+ *
185
+ * @param render - Renders the sentence with the given text as the placeholder's value
186
+ * (the caller's `t()` call).
187
+ * @param segment - The segment that takes the placeholder's place.
188
+ * @returns The segments in order, without empty strings, or `null` when the rendered
189
+ * sentence does not carry the placeholder exactly once (render the plain text then).
190
+ */
191
+ export function cardSegmentsAround(render, segment) {
192
+ const parts = render(CARD_SEGMENT_SLOT).split(CARD_SEGMENT_SLOT);
193
+ if (parts.length !== 2)
194
+ return null;
195
+ const [before, after] = parts;
196
+ return [...(before ? [before] : []), segment, ...(after ? [after] : [])];
197
+ }
198
+ //# sourceMappingURL=chat-card-event-utilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-card-event-utilities.js","sourceRoot":"","sources":["../../src/components/chat-card-event-utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAgBH,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAgSjE;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,qBAAqB,CACnC,SAAoB,EACpB,EAAU,EACV,SAAiB,EACjB,IAA+B;IAE/B,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IAC5D,qEAAqE;IACrE,uEAAuE;IACvE,yCAAyC;IACzC,MAAM,MAAM,GAAG,CAAC,IAAY,EAAU,EAAE;QACtC,MAAM,EAAE,GAAI,SAA6B,CAAC,EAAE,CAAA;QAC5C,OAAO,EAAE;YACP,CAAC,CAAC,CAAC,CAAC,iBAAiB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,YAAY,EAAE,qBAAqB,EAAE,CAAC;YACnF,CAAC,CAAC,IAAI,CAAA;IACV,CAAC,CAAA;IACD,QAAQ,SAAS,CAAC,IAAI,EAAE,CAAC;QACvB,KAAK,OAAO,CAAC,CAAC,CAAC;YACb,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,IAAI,SAAS,CAAC,KAAK,CAAA;YAChD,gEAAgE;YAChE,mEAAmE;YACnE,oEAAoE;YACpE,oDAAoD;YACpD,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,SAAS,CAAC,KAAK,CAAC,CAAA;YACxD,MAAM,UAAU,G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AAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC5C,SAAS;aACV,CAAA;QACH,CAAC;QACD;YACE,OAAO,IAAI,CAAA;IACf,CAAC;AACH,CAAC;AAED,8EAA8E;AAC9E,mDAAmD;AACnD,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAA;AAEpC;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAAgC,EAChC,OAA6B;IAE7B,MAAM,KAAK,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAA;IAChE,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IACnC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,KAAK,CAAA;IAC7B,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AAC1E,CAAC"}
@@ -0,0 +1,472 @@
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 type { AppModelDefinition } from '@molecule/app-ai-models';
16
+ import type { CommandDef } from '../command-metadata.js';
17
+ import type { CommandMenu, EffortPicker, FileEntry, FilePicker, ModelPicker } from './chat-card-event-utilities.js';
18
+ import type { EffortCommand, EffortLevel, EffortMode, EffortOption } from './chat-effort-utilities.js';
19
+ import type { ModelMode, ServerModeDefaults } from './chat-model-mode-utilities.js';
20
+ import type { SoundEventType } from './chat-settings-utilities.js';
21
+ import type { ShareCommand } from './chat-share-utilities.js';
22
+ import type { TimestampsCommand } from './chat-timestamps-utilities.js';
23
+ /**
24
+ * The `sessionStorage` key the composer persists an unsent draft under, per
25
+ * project.
26
+ * @param projectId - The project the chat panel belongs to.
27
+ * @returns The draft storage key (`mol-chat-draft:<projectId>`).
28
+ */
29
+ export declare function chatDraftStorageKey(projectId: string): string;
30
+ /**
31
+ * The `localStorage` key the outer panel remembers the active conversation
32
+ * under, per project.
33
+ * @param projectId - The project the chat panel belongs to.
34
+ * @returns The conversation storage key (`mol-chat-conv:<projectId>`).
35
+ */
36
+ export declare function chatConversationStorageKey(projectId: string): string;
37
+ /**
38
+ * Whether a read-only project VIEWER may run `command` — true only for a
39
+ * command flagged {@link CommandDef.viewerSafe} (a read, a view-only surface or
40
+ * a per-user preference). Everything else is default-DENIED: an unflagged or
41
+ * missing command is unavailable to viewers. Host side-channel commands are
42
+ * gated separately by `matchesSideChannelCommand`, which the callers OR in
43
+ * where a viewer may also message the team.
44
+ * @param command - The command definition, or `undefined` when the text named
45
+ * no registered command.
46
+ * @returns `true` when the command is viewer-safe, `false` otherwise.
47
+ */
48
+ export declare function viewerCommandAllowed(command: CommandDef | undefined): boolean;
49
+ /**
50
+ * The commands an open command menu lists: every command for a `showAll` menu
51
+ * (the slash-button toggle over existing text) or the ones whose label starts
52
+ * with the typed text; viewers see only the commands they can run (viewer-safe
53
+ * reads plus the team side channel); `/share` is listed only when the host
54
+ * allows sharing.
55
+ * @param commands - The command registry unioned with any host-provided commands.
56
+ * @param menu - The open command menu, or `null` when it is closed.
57
+ * @param canEdit - Whether the member may edit the project (`false` for a
58
+ * read-only viewer; `undefined` counts as an editor).
59
+ * @param shareAllowed - Whether the host allows managing share links.
60
+ * @returns The commands the menu shows, in registry order (`[]` when closed).
61
+ */
62
+ export declare function filterCommandMenu(commands: readonly CommandDef[], menu: CommandMenu | null, canEdit: boolean | undefined, shareAllowed: boolean): CommandDef[];
63
+ /**
64
+ * Wrap-around index: Down from -1 → 0, Up from -1 → last, wraps at both ends.
65
+ * @param cur - The current index (-1 means no selection).
66
+ * @param delta - The direction to move (+1 down, -1 up).
67
+ * @param len - The total number of items.
68
+ * @returns The new wrapped index.
69
+ */
70
+ export declare function wrapIdx(cur: number, delta: number, len: number): number;
71
+ /**
72
+ * Rank the @-mention picker's entries by the composer query: entries whose name
73
+ * contains the query (case-insensitive), with the active file first, then open
74
+ * tabs, then prefix matches, then the rest alphabetically — capped at the first
75
+ * fifteen rows.
76
+ * @param entries - The picker's file entries.
77
+ * @param query - The text typed after the `@`.
78
+ * @param activeFile - The editor's active file, if any (`null` when none).
79
+ * @param openTabs - The editor's open tab paths, if any.
80
+ * @returns The ranked, capped entries to show.
81
+ */
82
+ export declare function rankFileMentionEntries(entries: readonly FileEntry[], query: string, activeFile: string | null | undefined, openTabs: readonly string[] | undefined): FileEntry[];
83
+ /**
84
+ * Build the `<file …>` block a chosen @-mention inserts into the outgoing
85
+ * message: the file's content in a language-tagged fence, or a placeholder when
86
+ * the sandbox could not read it. The caller joins it to any text already in the
87
+ * message with a blank line.
88
+ * @param displayPath - The path to annotate the block with (no leading `/`).
89
+ * @param extension - The file's extension, used as the fence language tag.
90
+ * @param content - The file's text, or `null` when it could not be read.
91
+ * @returns The message block.
92
+ */
93
+ export declare function buildFileMentionBlock(displayPath: string, extension: string, content: string | null): string;
94
+ /**
95
+ * The prompt a `/explain` submit sends: the named target, or a default that
96
+ * asks about what the user just shared.
97
+ * @param target - The text after `/explain`, when any.
98
+ * @param hasAttachments - Whether @-mentioned files ride along with the send.
99
+ * @returns The message text to send.
100
+ */
101
+ export declare function buildExplainPrompt(target: string | undefined, hasAttachments: boolean): string;
102
+ /**
103
+ * The prompt a `/lint` submit sends: lint the named path with `npm run lint --
104
+ * <args>`, or the whole project.
105
+ * @param args - The text after `/lint`, when any.
106
+ * @returns The message text to send.
107
+ */
108
+ export declare function buildLintPrompt(args: string | undefined): string;
109
+ /** The backend's description of a usage-limit refusal, as a failed request carries it. */
110
+ export interface LimitRefusal {
111
+ /** The backend's human-readable refusal message, when it sent one. */
112
+ error?: string;
113
+ /** Which limit fired (`max_tool_loops`, `daily`, …). */
114
+ limitType: string;
115
+ /** True when the refusal is really "sign up" (e.g. an anonymous visitor). */
116
+ requiresSignup?: boolean;
117
+ /** The remedy the backend resolved (e.g. a billing action). */
118
+ billingAction?: string;
119
+ /** The higher plan that lifts the limit, or `null` when none does. */
120
+ upgradeTier?: string | null;
121
+ }
122
+ /**
123
+ * Parse a failed request's usage-limit refusal out of its response body. The
124
+ * backend describes a refusal as `{ error, limitType, requiresSignup?,
125
+ * billingAction?, upgradeTier? }`; anything else (a network failure, a plain
126
+ * message error) is not a limit refusal.
127
+ * @param error - The caught error value.
128
+ * @returns The refusal, or `null` when the error carries none.
129
+ */
130
+ export declare function limitRefusalFromError(error: unknown): LimitRefusal | null;
131
+ /** What `handleSubmit` knows before it decides which path a submit takes. */
132
+ export interface ComposerSubmitState {
133
+ /** True when the member may only read the transcript (no edit, no team chat). */
134
+ transcriptOnly: boolean;
135
+ /** How many files are attached in the composer right now. */
136
+ attachedCount: number;
137
+ /** Whether the member may edit the project (`undefined` takes the viewer path). */
138
+ canEdit: boolean | undefined;
139
+ /** Whether team side-channel messages are allowed in this workspace. */
140
+ canSendTeamMessages: boolean;
141
+ /** The command registry unioned with host commands, as the menu sees it. */
142
+ allCommands: readonly CommandDef[];
143
+ /** The host's extra commands (the team-message gate reads them with the registry). */
144
+ extraCommands: readonly CommandDef[] | undefined;
145
+ /**
146
+ * Reads whether the tests status bar is currently visible — the `/test
147
+ * on|off` base. Called only when the submit is the tests-bar command, so a
148
+ * plain submit never touches the preference storage.
149
+ */
150
+ readTestsBarVisible: () => boolean;
151
+ }
152
+ /** The path a composer submit takes, as `routeComposerSubmit` classifies it. */
153
+ export type ComposerSubmitRoute =
154
+ /** The submit is ignored: a transcript-only member, or nothing to send. */
155
+ {
156
+ kind: 'ignored';
157
+ }
158
+ /** A team side-channel message while team messaging is unavailable. */
159
+ | {
160
+ kind: 'team-blocked';
161
+ }
162
+ /** A read-only viewer tried to run the assistant or a mutating command. */
163
+ | {
164
+ kind: 'viewer-blocked';
165
+ }
166
+ /** `/autofix` — toggles auto-fix through the command dispatcher. */
167
+ | {
168
+ kind: 'autofix';
169
+ }
170
+ /** `/autoapprove` — toggles auto-approve through the command dispatcher. */
171
+ | {
172
+ kind: 'autoapprove';
173
+ }
174
+ /** `/sounds` — opens the sounds picker. */
175
+ | {
176
+ kind: 'sounds';
177
+ }
178
+ /** `/test on|off|toggle` — sets the tests bar visibility. */
179
+ | {
180
+ kind: 'tests-bar';
181
+ visible: boolean;
182
+ }
183
+ /** `/timestamps` — a per-device timestamp display preference. */
184
+ | {
185
+ kind: 'timestamps';
186
+ command: TimestampsCommand;
187
+ }
188
+ /** `/settings` — opens the settings view through the command dispatcher. */
189
+ | {
190
+ kind: 'settings';
191
+ }
192
+ /** `/skills [query]` — opens the skills overlay, seeded with the query. */
193
+ | {
194
+ kind: 'skills';
195
+ query: string;
196
+ }
197
+ /** `/scripts [query]` — opens the scripts overlay, seeded with the query. */
198
+ | {
199
+ kind: 'scripts';
200
+ query: string;
201
+ }
202
+ /** `/test [query | all]` — opens the tests browser, or runs everything. */
203
+ | {
204
+ kind: 'tests';
205
+ query: string;
206
+ runAll: boolean;
207
+ }
208
+ /** `/run <name>` — runs a saved script (an empty name means usage). */
209
+ | {
210
+ kind: 'run-script';
211
+ name: string;
212
+ params: Record<string, string>;
213
+ }
214
+ /** `/report [title]` and `/bug [title]` — opens the bug-report modal. */
215
+ | {
216
+ kind: 'report';
217
+ title: string;
218
+ }
219
+ /** `/share [role]` — opens the share-link modal at the requested role. */
220
+ | {
221
+ kind: 'share';
222
+ command: ShareCommand;
223
+ }
224
+ /** `/autocommit <seconds>` — arms or cancels the auto-commit countdown. */
225
+ | {
226
+ kind: 'autocommit';
227
+ seconds: number | null;
228
+ }
229
+ /** `/model --plan|--execute|--commit|--compact` — opens the scoped picker. */
230
+ | {
231
+ kind: 'model-mode';
232
+ mode: ModelMode;
233
+ }
234
+ /** `/mic` and `/dictate` — opens the dictation engine picker. */
235
+ | {
236
+ kind: 'mic';
237
+ }
238
+ /** `/model [name]` — opens the picker, or resolves and selects a model. */
239
+ | {
240
+ kind: 'model';
241
+ query: string | undefined;
242
+ }
243
+ /** `/effort …` — opens the level picker, shows status, or sets a level. */
244
+ | {
245
+ kind: 'effort';
246
+ command: EffortCommand;
247
+ }
248
+ /** `/maxloops <N>` — persists the max tool iterations setting. */
249
+ | {
250
+ kind: 'max-loops';
251
+ loops: number;
252
+ }
253
+ /** `/explain` with no attachments — sends the built explain prompt. */
254
+ | {
255
+ kind: 'explain';
256
+ prompt: string;
257
+ }
258
+ /** `/lint` — sends the built lint prompt. */
259
+ | {
260
+ kind: 'lint';
261
+ prompt: string;
262
+ }
263
+ /** A host side-channel command — sends the raw text without a user bubble. */
264
+ | {
265
+ kind: 'side-channel';
266
+ message: string;
267
+ }
268
+ /** A plain message (an `/explain` with attachments is rewritten into one). */
269
+ | {
270
+ kind: 'send';
271
+ message: string;
272
+ };
273
+ /**
274
+ * Classify a composer submit into the one path it takes, fixing the order of
275
+ * `handleSubmit`'s checks: transcript-only and empty submits, the team-message
276
+ * gate, the read-only viewer gate, every locally-handled slash command, the
277
+ * side-channel send, and finally a plain message. Deterministic and
278
+ * side-effect free — the caller performs every side effect (`setInputValue`,
279
+ * `addSystemCard`, `sendMessage`, …) for the returned route — so the check
280
+ * order is identical in every framework's chat panel.
281
+ * @param input - The composer's raw text.
282
+ * @param state - The props and derived values the checks read.
283
+ * @returns The {@link ComposerSubmitRoute} the submit takes.
284
+ */
285
+ export declare function routeComposerSubmit(input: string, state: ComposerSubmitState): ComposerSubmitRoute;
286
+ /**
287
+ * One keydown event's fields, as the composer's native keydown handler reads
288
+ * them — a structural subset of the DOM `KeyboardEvent`, so a test can pass a
289
+ * plain object.
290
+ */
291
+ export interface ComposerKeyEvent {
292
+ /** The named key (`'Enter'`, `'Escape'`, `'ArrowDown'`, …). */
293
+ key: string;
294
+ /** True when Shift is held — Shift+Enter inserts a newline instead of submitting. */
295
+ shiftKey: boolean;
296
+ /** True while an IME composition is in progress. */
297
+ isComposing?: boolean;
298
+ /** The legacy key code — `229` marks an IME composition on some engines. */
299
+ keyCode?: number;
300
+ }
301
+ /**
302
+ * Everything the composer's keydown reducer reads: the open popups with the
303
+ * row lists they navigate, and the panel values the Enter branches decide with.
304
+ */
305
+ export interface ComposerKeyState {
306
+ /** The composer textarea's current text (the effort Enter fallback parses it). */
307
+ input: string;
308
+ /** The open sounds picker, or `null`. */
309
+ soundsPicker: {
310
+ selectedIdx: number;
311
+ } | null;
312
+ /** Whether the dictation-engine picker is open. */
313
+ micOpen: boolean;
314
+ /** The open effort picker, or `null`. */
315
+ effortPicker: EffortPicker | null;
316
+ /** The effort picker's rows after the typed filter, in display order. */
317
+ effortPickerVisible: readonly EffortOption[];
318
+ /** The open model picker, or `null`. */
319
+ modelPicker: ModelPicker | null;
320
+ /** The model rows the picker lists, in display order. */
321
+ visibleModels: readonly AppModelDefinition[];
322
+ /** Whether the host offers the model picker's "manage your own models" row. */
323
+ hasManageCustomModels: boolean;
324
+ /** The live conversation mode (`'plan'` or `'execute'`). */
325
+ liveMode: EffortMode;
326
+ /** Whether a panel overlay (`/skills`, `/scripts`, `/settings`, `/tests`) is open. */
327
+ overlayOpen: boolean;
328
+ /** The open `@`-file picker, or `null`. */
329
+ filePicker: FilePicker | null;
330
+ /** The file picker's entries after the query filter, in display order. */
331
+ filteredEntries: readonly FileEntry[];
332
+ /** The open slash-command menu, or `null`. */
333
+ commandMenu: CommandMenu | null;
334
+ /** The command menu's entries after its filter, in display order. */
335
+ filteredCmds: readonly CommandDef[];
336
+ /** Whether a reply is streaming right now (Escape aborts it). */
337
+ abortable: boolean;
338
+ /** Whether the member is on the free tier (the model Enter lock reads it). */
339
+ isFreeTier: boolean;
340
+ /** The free-tier model's id, or `''` when the catalog did not name one. */
341
+ freeTierModelId: string;
342
+ /** The project's model catalog, custom (bring-your-own AI) models included. */
343
+ models: readonly AppModelDefinition[];
344
+ /** The server's per-mode default models, when it sent them. */
345
+ serverModelDefaults: ServerModeDefaults;
346
+ }
347
+ /**
348
+ * The effect the composer's keydown handler performs for one key. The reducer
349
+ * returns it and the caller applies it, so the reducer itself touches no state.
350
+ */
351
+ export type ComposerKeyEffect =
352
+ /** Nothing to do (a pick with no row, or a locked model). */
353
+ {
354
+ kind: 'none';
355
+ }
356
+ /** Escape: close the sounds picker. */
357
+ | {
358
+ kind: 'close-sounds';
359
+ }
360
+ /** Escape: close the dictation-engine picker. */
361
+ | {
362
+ kind: 'close-mic';
363
+ }
364
+ /** Escape: close the effort picker. */
365
+ | {
366
+ kind: 'close-effort';
367
+ }
368
+ /** Escape: close the model picker. */
369
+ | {
370
+ kind: 'close-model';
371
+ }
372
+ /** Escape: close the panel overlay. */
373
+ | {
374
+ kind: 'close-overlay';
375
+ }
376
+ /** Escape: close the `@`-file picker. */
377
+ | {
378
+ kind: 'close-file';
379
+ }
380
+ /** Escape: close the slash-command menu. */
381
+ | {
382
+ kind: 'close-command';
383
+ }
384
+ /** Escape: abort the streaming reply (same path as the Stop button). */
385
+ | {
386
+ kind: 'abort';
387
+ }
388
+ /** Move the sounds picker's highlight by one row (the caller wraps it). */
389
+ | {
390
+ kind: 'sounds-move';
391
+ delta: 1 | -1;
392
+ }
393
+ /** Apply the sounds picker's highlighted mode to one event (or all of them). */
394
+ | {
395
+ kind: 'sounds-pick';
396
+ event: SoundEventType | 'all';
397
+ }
398
+ /** Move the effort picker's highlight by one row (the caller wraps it). */
399
+ | {
400
+ kind: 'effort-move';
401
+ delta: 1 | -1;
402
+ }
403
+ /** Set the effort level for the picker's mode. */
404
+ | {
405
+ kind: 'effort-pick';
406
+ mode: EffortMode;
407
+ level: EffortLevel;
408
+ }
409
+ /** Move the model picker's highlight by one row (the caller wraps it). */
410
+ | {
411
+ kind: 'model-move';
412
+ delta: 1 | -1;
413
+ }
414
+ /** Open the host's custom-model manager for the picker's mode. */
415
+ | {
416
+ kind: 'model-manage';
417
+ mode: EffortMode;
418
+ }
419
+ /** Select the model row; `locked` means the free-tier clamp refuses it. */
420
+ | {
421
+ kind: 'model-pick';
422
+ model: AppModelDefinition;
423
+ mode?: ModelMode;
424
+ locked: boolean;
425
+ }
426
+ /** Move the `@`-file picker's highlight by one row (the caller wraps it). */
427
+ | {
428
+ kind: 'file-move';
429
+ delta: 1 | -1;
430
+ }
431
+ /** Attach the highlighted file entry. */
432
+ | {
433
+ kind: 'file-pick';
434
+ entry: FileEntry;
435
+ }
436
+ /** Move the command menu's highlight by one row (the caller wraps it). */
437
+ | {
438
+ kind: 'command-move';
439
+ delta: 1 | -1;
440
+ }
441
+ /** Close the command menu and submit the composer text as typed. */
442
+ | {
443
+ kind: 'command-dismiss-submit';
444
+ }
445
+ /** Run the command with this id. */
446
+ | {
447
+ kind: 'command-run';
448
+ id: string;
449
+ }
450
+ /** Submit the composer (a bare Enter). */
451
+ | {
452
+ kind: 'submit';
453
+ };
454
+ /** What `composerKeyAction` decides for one keydown. */
455
+ export interface ComposerKeyAction {
456
+ /** Whether the handler calls `event.preventDefault()` before applying the effect. */
457
+ preventDefault: boolean;
458
+ /** The effect the caller applies. */
459
+ effect: ComposerKeyEffect;
460
+ }
461
+ /**
462
+ * Decide what the composer's keydown handler does for one key: the IME guard,
463
+ * Escape's close order (sounds, mic, effort, model, overlay, file, command,
464
+ * abort), the open picker's arrow/Enter/Tab navigation, and the bare Enter that
465
+ * submits. Pure and side-effect free — the caller performs every effect — so
466
+ * the key behavior is identical in every framework's chat panel.
467
+ * @param event - The keydown event's fields.
468
+ * @param state - The open popups and the panel values the decisions read.
469
+ * @returns The {@link ComposerKeyAction} to apply.
470
+ */
471
+ export declare function composerKeyAction(event: ComposerKeyEvent, state: ComposerKeyState): ComposerKeyAction;
472
+ //# sourceMappingURL=chat-composer-utilities.d.ts.map