@justanarthur/modo-ui-ai 0.0.0-stage → 0.3.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 +21 -0
- package/LICENSE.fluid-functionalism +21 -0
- package/README.md +105 -2
- package/blocks/conversation/agent-prompt/examples.mdx +44 -0
- package/blocks/conversation/agent-prompt/index.tsx +114 -0
- package/blocks/conversation/composer/draft.css +25 -0
- package/blocks/conversation/composer/draft.tsx +589 -0
- package/blocks/conversation/composer/examples.mdx +164 -0
- package/blocks/conversation/composer/file-preview-tile.tsx +59 -0
- package/blocks/conversation/composer/file-thumbnail.tsx +146 -0
- package/blocks/conversation/composer/index.tsx +651 -0
- package/blocks/conversation/composer/queued-row.tsx +102 -0
- package/blocks/conversation/composer/shared.ts +38 -0
- package/blocks/conversation/composer/suggestion-row.tsx +64 -0
- package/blocks/conversation/composer/use-composer-files.ts +142 -0
- package/blocks/conversation/composer/use-history-nav.ts +60 -0
- package/blocks/conversation/composer/use-message-queue.ts +108 -0
- package/blocks/conversation/composer/use-region-height.ts +34 -0
- package/blocks/conversation/failure-states/examples.mdx +58 -0
- package/blocks/conversation/failure-states/index.tsx +274 -0
- package/blocks/conversation/transcript/examples.mdx +43 -0
- package/blocks/conversation/transcript/index.tsx +206 -0
- package/blocks/conversation/transcript-search/examples.mdx +50 -0
- package/blocks/conversation/transcript-search/index.tsx +469 -0
- package/blocks/dialogs/command-palette/examples.mdx +50 -0
- package/blocks/dialogs/command-palette/index.tsx +239 -0
- package/blocks/dialogs/hook-dialog/examples.mdx +44 -0
- package/blocks/dialogs/hook-dialog/index.tsx +286 -0
- package/blocks/dialogs/mcp-server-dialog/examples.mdx +57 -0
- package/blocks/dialogs/mcp-server-dialog/index.tsx +415 -0
- package/blocks/dialogs/shortcuts-sheet/examples.mdx +36 -0
- package/blocks/dialogs/shortcuts-sheet/index.tsx +186 -0
- package/blocks/panes/artifacts-pane/examples.mdx +23 -0
- package/blocks/panes/artifacts-pane/index.tsx +82 -0
- package/blocks/panes/changes-pane/examples.mdx +23 -0
- package/blocks/panes/changes-pane/index.tsx +248 -0
- package/blocks/panes/file-pane/examples.mdx +13 -0
- package/blocks/panes/file-pane/index.tsx +102 -0
- package/blocks/panes/pr-pane/examples.mdx +13 -0
- package/blocks/panes/pr-pane/index.tsx +191 -0
- package/blocks/panes/side-pane/examples.mdx +58 -0
- package/blocks/panes/side-pane/index.tsx +187 -0
- package/blocks/panes/tasks-pane/examples.mdx +23 -0
- package/blocks/panes/tasks-pane/index.tsx +127 -0
- package/blocks/panes/terminal-pane/examples.mdx +13 -0
- package/blocks/panes/terminal-pane/index.tsx +99 -0
- package/blocks/panes/usage-pane/examples.mdx +23 -0
- package/blocks/panes/usage-pane/index.tsx +78 -0
- package/blocks/profiles/profile-onboarding/examples.mdx +80 -0
- package/blocks/profiles/profile-onboarding/index.tsx +580 -0
- package/blocks/profiles/profile-switcher/examples.mdx +29 -0
- package/blocks/profiles/profile-switcher/index.tsx +212 -0
- package/blocks/profiles/profile-usage/examples.mdx +41 -0
- package/blocks/profiles/profile-usage/index.tsx +141 -0
- package/blocks/sessions/inbox/examples.mdx +35 -0
- package/blocks/sessions/inbox/index.tsx +372 -0
- package/blocks/sessions/session-board/examples.mdx +34 -0
- package/blocks/sessions/session-board/index.tsx +570 -0
- package/blocks/sessions/session-sidebar/examples.mdx +93 -0
- package/blocks/sessions/session-sidebar/index.tsx +497 -0
- package/blocks/settings/extensions/examples.mdx +10 -0
- package/blocks/settings/extensions/index.tsx +72 -0
- package/blocks/settings/hooks/examples.mdx +16 -0
- package/blocks/settings/hooks/index.tsx +127 -0
- package/blocks/settings/mcp-servers/examples.mdx +26 -0
- package/blocks/settings/mcp-servers/index.tsx +204 -0
- package/blocks/settings/memory/examples.mdx +22 -0
- package/blocks/settings/memory/index.tsx +113 -0
- package/blocks/settings/notifications/examples.mdx +8 -0
- package/blocks/settings/notifications/index.tsx +63 -0
- package/blocks/settings/permission-rules/examples.mdx +37 -0
- package/blocks/settings/permission-rules/index.tsx +317 -0
- package/blocks/settings/plugin-catalog/examples.mdx +52 -0
- package/blocks/settings/plugin-catalog/index.tsx +407 -0
- package/blocks/settings/plugins/examples.mdx +10 -0
- package/blocks/settings/plugins/index.tsx +72 -0
- package/blocks/settings/settings-window/examples.mdx +40 -0
- package/blocks/settings/settings-window/index.tsx +188 -0
- package/blocks/settings/worktrees/examples.mdx +17 -0
- package/blocks/settings/worktrees/index.tsx +145 -0
- package/components/conversation/agent-run/examples.mdx +38 -0
- package/components/conversation/agent-run/index.tsx +83 -0
- package/components/conversation/chapter-nav/examples.mdx +30 -0
- package/components/conversation/chapter-nav/index.tsx +123 -0
- package/components/conversation/message/examples.mdx +53 -0
- package/components/conversation/message/index.tsx +130 -0
- package/components/conversation/message/working.tsx +102 -0
- package/components/conversation/reasoning/examples.mdx +32 -0
- package/components/conversation/reasoning/index.tsx +55 -0
- package/components/conversation/recap/examples.mdx +21 -0
- package/components/conversation/recap/index.tsx +67 -0
- package/components/conversation/todo-list/examples.mdx +32 -0
- package/components/conversation/todo-list/index.tsx +106 -0
- package/components/conversation/tool-call/examples.mdx +48 -0
- package/components/conversation/tool-call/index.tsx +142 -0
- package/components/conversation/work-summary/examples.mdx +50 -0
- package/components/conversation/work-summary/index.tsx +87 -0
- package/components/prompts/permission-request/examples.mdx +32 -0
- package/components/prompts/permission-request/index.tsx +74 -0
- package/components/prompts/plan-approval/examples.mdx +37 -0
- package/components/prompts/plan-approval/index.tsx +76 -0
- package/components/prompts/prompt-card/examples.mdx +31 -0
- package/components/prompts/prompt-card/index.tsx +82 -0
- package/components/prompts/question-prompt/examples.mdx +46 -0
- package/components/prompts/question-prompt/index.tsx +118 -0
- package/dist/blocks/conversation/agent-prompt/index.d.ts +7 -0
- package/dist/blocks/conversation/agent-prompt/index.js +13 -0
- package/dist/blocks/conversation/composer/index.d.ts +4 -0
- package/dist/blocks/conversation/composer/index.js +16 -0
- package/dist/blocks/conversation/failure-states/index.d.ts +4 -0
- package/dist/blocks/conversation/failure-states/index.js +8 -0
- package/dist/blocks/conversation/transcript/index.d.ts +50 -0
- package/dist/blocks/conversation/transcript/index.js +17 -0
- package/dist/blocks/conversation/transcript-search/index.d.ts +4 -0
- package/dist/blocks/conversation/transcript-search/index.js +11 -0
- package/dist/blocks/dialogs/command-palette/index.d.ts +5 -0
- package/dist/blocks/dialogs/command-palette/index.js +20 -0
- package/dist/blocks/dialogs/hook-dialog/index.d.ts +3 -0
- package/dist/blocks/dialogs/hook-dialog/index.js +12 -0
- package/dist/blocks/dialogs/mcp-server-dialog/index.d.ts +5 -0
- package/dist/blocks/dialogs/mcp-server-dialog/index.js +12 -0
- package/dist/blocks/dialogs/shortcuts-sheet/index.d.ts +2 -0
- package/dist/blocks/dialogs/shortcuts-sheet/index.js +11 -0
- package/dist/blocks/panes/artifacts-pane/index.d.ts +3 -0
- package/dist/blocks/panes/artifacts-pane/index.js +9 -0
- package/dist/blocks/panes/changes-pane/index.d.ts +3 -0
- package/dist/blocks/panes/changes-pane/index.js +9 -0
- package/dist/blocks/panes/file-pane/index.d.ts +3 -0
- package/dist/blocks/panes/file-pane/index.js +9 -0
- package/dist/blocks/panes/pr-pane/index.d.ts +3 -0
- package/dist/blocks/panes/pr-pane/index.js +10 -0
- package/dist/blocks/panes/side-pane/index.d.ts +5 -0
- package/dist/blocks/panes/side-pane/index.js +21 -0
- package/dist/blocks/panes/tasks-pane/index.d.ts +3 -0
- package/dist/blocks/panes/tasks-pane/index.js +10 -0
- package/dist/blocks/panes/terminal-pane/index.d.ts +3 -0
- package/dist/blocks/panes/terminal-pane/index.js +9 -0
- package/dist/blocks/panes/usage-pane/index.d.ts +4 -0
- package/dist/blocks/panes/usage-pane/index.js +11 -0
- package/dist/blocks/profiles/profile-onboarding/index.d.ts +4 -0
- package/dist/blocks/profiles/profile-onboarding/index.js +11 -0
- package/dist/blocks/profiles/profile-switcher/index.d.ts +4 -0
- package/dist/blocks/profiles/profile-switcher/index.js +12 -0
- package/dist/blocks/profiles/profile-usage/index.d.ts +4 -0
- package/dist/blocks/profiles/profile-usage/index.js +10 -0
- package/dist/blocks/sessions/inbox/index.d.ts +2 -0
- package/dist/blocks/sessions/inbox/index.js +11 -0
- package/dist/blocks/sessions/session-board/index.d.ts +4 -0
- package/dist/blocks/sessions/session-board/index.js +27 -0
- package/dist/blocks/sessions/session-sidebar/index.d.ts +5 -0
- package/dist/blocks/sessions/session-sidebar/index.js +15 -0
- package/dist/blocks/settings/extensions/index.d.ts +2 -0
- package/dist/blocks/settings/extensions/index.js +9 -0
- package/dist/blocks/settings/hooks/index.d.ts +4 -0
- package/dist/blocks/settings/hooks/index.js +9 -0
- package/dist/blocks/settings/mcp-servers/index.d.ts +4 -0
- package/dist/blocks/settings/mcp-servers/index.js +9 -0
- package/dist/blocks/settings/memory/index.d.ts +4 -0
- package/dist/blocks/settings/memory/index.js +8 -0
- package/dist/blocks/settings/notifications/index.d.ts +2 -0
- package/dist/blocks/settings/notifications/index.js +8 -0
- package/dist/blocks/settings/permission-rules/index.d.ts +3 -0
- package/dist/blocks/settings/permission-rules/index.js +10 -0
- package/dist/blocks/settings/plugin-catalog/index.d.ts +2 -0
- package/dist/blocks/settings/plugin-catalog/index.js +11 -0
- package/dist/blocks/settings/plugins/index.d.ts +4 -0
- package/dist/blocks/settings/plugins/index.js +9 -0
- package/dist/blocks/settings/settings-window/index.d.ts +4 -0
- package/dist/blocks/settings/settings-window/index.js +8 -0
- package/dist/blocks/settings/worktrees/index.d.ts +4 -0
- package/dist/blocks/settings/worktrees/index.js +9 -0
- package/dist/components/conversation/agent-run/index.d.ts +3 -0
- package/dist/components/conversation/agent-run/index.js +10 -0
- package/dist/components/conversation/chapter-nav/index.d.ts +2 -0
- package/dist/components/conversation/chapter-nav/index.js +11 -0
- package/dist/components/conversation/message/index.d.ts +2 -0
- package/dist/components/conversation/message/index.js +15 -0
- package/dist/components/conversation/reasoning/index.d.ts +2 -0
- package/dist/components/conversation/reasoning/index.js +8 -0
- package/dist/components/conversation/recap/index.d.ts +2 -0
- package/dist/components/conversation/recap/index.js +9 -0
- package/dist/components/conversation/todo-list/index.d.ts +2 -0
- package/dist/components/conversation/todo-list/index.js +9 -0
- package/dist/components/conversation/tool-call/index.d.ts +3 -0
- package/dist/components/conversation/tool-call/index.js +13 -0
- package/dist/components/conversation/work-summary/index.d.ts +2 -0
- package/dist/components/conversation/work-summary/index.js +10 -0
- package/dist/components/prompts/permission-request/index.d.ts +2 -0
- package/dist/components/prompts/permission-request/index.js +9 -0
- package/dist/components/prompts/plan-approval/index.d.ts +2 -0
- package/dist/components/prompts/plan-approval/index.js +9 -0
- package/dist/components/prompts/prompt-card/index.d.ts +3 -0
- package/dist/components/prompts/prompt-card/index.js +8 -0
- package/dist/components/prompts/question-prompt/index.d.ts +2 -0
- package/dist/components/prompts/question-prompt/index.js +9 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +231 -0
- package/dist/lib/config-parts.d.ts +2 -0
- package/dist/lib/config-parts.js +16 -0
- package/dist/lib/icons.d.ts +2 -0
- package/dist/lib/icons.js +10 -0
- package/dist/lib/pace-bar.d.ts +11 -0
- package/dist/lib/pace-bar.js +6 -0
- package/dist/lib/pace.d.ts +4 -0
- package/dist/lib/pace.js +14 -0
- package/dist/lib/pane-parts.d.ts +25 -0
- package/dist/lib/pane-parts.js +11 -0
- package/dist/lib/row-trigger.d.ts +5 -0
- package/dist/lib/row-trigger.js +7 -0
- package/dist/lib/settings-parts.d.ts +70 -0
- package/dist/lib/settings-parts.js +24 -0
- package/dist/lib/side-pane-types.d.ts +2 -0
- package/dist/lib/side-pane-types.js +1 -0
- package/dist/lib/status-glyph.d.ts +8 -0
- package/dist/lib/status-glyph.js +12 -0
- package/dist/lib/types.d.ts +3 -0
- package/dist/lib/types.js +1 -0
- package/dist/shared/chunk-04a497rr.js +21 -0
- package/dist/shared/chunk-13yf0mza.d.ts +70 -0
- package/dist/shared/chunk-1hzrm8r5.d.ts +51 -0
- package/dist/shared/chunk-1qdwg7w5.d.ts +81 -0
- package/dist/shared/chunk-1yt061np.d.ts +64 -0
- package/dist/shared/chunk-218qabm5.js +250 -0
- package/dist/shared/chunk-2fk5aq60.js +313 -0
- package/dist/shared/chunk-3ps5h55t.d.ts +30 -0
- package/dist/shared/chunk-3yaftgh0.d.ts +28 -0
- package/dist/shared/chunk-4zvhpf2x.js +55 -0
- package/dist/shared/chunk-57hzzmjd.d.ts +67 -0
- package/dist/shared/chunk-58jh3mje.js +46 -0
- package/dist/shared/chunk-58qvny6a.d.ts +29 -0
- package/dist/shared/chunk-5fhkkn39.js +130 -0
- package/dist/shared/chunk-5hw0525a.d.ts +33 -0
- package/dist/shared/chunk-5meda998.js +238 -0
- package/dist/shared/chunk-5pqksw7z.js +91 -0
- package/dist/shared/chunk-6220dy5n.js +70 -0
- package/dist/shared/chunk-64bnh22t.d.ts +59 -0
- package/dist/shared/chunk-66sh633m.d.ts +60 -0
- package/dist/shared/chunk-6cmf27g3.d.ts +81 -0
- package/dist/shared/chunk-6kwk9vag.js +558 -0
- package/dist/shared/chunk-6rdwkymk.js +177 -0
- package/dist/shared/chunk-71j8qzvb.d.ts +57 -0
- package/dist/shared/chunk-74bvf3tw.d.ts +21 -0
- package/dist/shared/chunk-75zwypyr.d.ts +43 -0
- package/dist/shared/chunk-7mfer3tp.js +176 -0
- package/dist/shared/chunk-7rzjmcnh.d.ts +30 -0
- package/dist/shared/chunk-7zvb39cf.d.ts +26 -0
- package/dist/shared/chunk-8mecznyr.js +357 -0
- package/dist/shared/chunk-8pag6vmd.js +255 -0
- package/dist/shared/chunk-94grzz9f.js +187 -0
- package/dist/shared/chunk-9kw6m047.d.ts +32 -0
- package/dist/shared/chunk-at0jje23.d.ts +110 -0
- package/dist/shared/chunk-awd573h9.js +34 -0
- package/dist/shared/chunk-b171wjge.d.ts +25 -0
- package/dist/shared/chunk-b4dz15em.d.ts +36 -0
- package/dist/shared/chunk-b5ccp5de.js +35 -0
- package/dist/shared/chunk-bh2b5d1z.js +98 -0
- package/dist/shared/chunk-c36qvrwq.d.ts +30 -0
- package/dist/shared/chunk-c8wp058j.js +153 -0
- package/dist/shared/chunk-d2t72h4x.d.ts +35 -0
- package/dist/shared/chunk-dh3qy5fj.js +49 -0
- package/dist/shared/chunk-dxzrtvt9.d.ts +283 -0
- package/dist/shared/chunk-e46apgve.d.ts +40 -0
- package/dist/shared/chunk-ejtknc0w.js +21 -0
- package/dist/shared/chunk-eqajdxn8.js +82 -0
- package/dist/shared/chunk-fapc805j.js +130 -0
- package/dist/shared/chunk-fm1qyrae.d.ts +68 -0
- package/dist/shared/chunk-fqhcz6ss.d.ts +29 -0
- package/dist/shared/chunk-g88hweqh.d.ts +70 -0
- package/dist/shared/chunk-gb5ee5dw.d.ts +88 -0
- package/dist/shared/chunk-gewnsgza.js +61 -0
- package/dist/shared/chunk-hxjgey30.d.ts +36 -0
- package/dist/shared/chunk-jkkdq1mh.d.ts +213 -0
- package/dist/shared/chunk-jpq101w3.js +91 -0
- package/dist/shared/chunk-k3bv9k1v.d.ts +56 -0
- package/dist/shared/chunk-kreypnzp.d.ts +34 -0
- package/dist/shared/chunk-mnzw0bav.js +80 -0
- package/dist/shared/chunk-mrb3fp2f.d.ts +30 -0
- package/dist/shared/chunk-n1qq2wp9.js +6 -0
- package/dist/shared/chunk-n31qwnj2.js +1544 -0
- package/dist/shared/chunk-n4742y54.js +39 -0
- package/dist/shared/chunk-ndjvdkv7.d.ts +29 -0
- package/dist/shared/chunk-njf851p1.js +245 -0
- package/dist/shared/chunk-nk4578dr.js +73 -0
- package/dist/shared/chunk-nkbgg7bw.d.ts +24 -0
- package/dist/shared/chunk-nvh33x9x.js +488 -0
- package/dist/shared/chunk-paezqfg1.js +106 -0
- package/dist/shared/chunk-qemm9e3r.d.ts +21 -0
- package/dist/shared/chunk-qhxz1etk.js +96 -0
- package/dist/shared/chunk-qj5ev9ak.js +531 -0
- package/dist/shared/chunk-qnwggvjy.js +150 -0
- package/dist/shared/chunk-qt31n444.js +178 -0
- package/dist/shared/chunk-r5hz78pb.js +129 -0
- package/dist/shared/chunk-r6nb21kz.d.ts +102 -0
- package/dist/shared/chunk-rqrpvvz4.d.ts +107 -0
- package/dist/shared/chunk-s3r759ec.js +80 -0
- package/dist/shared/chunk-sdtjrw9w.d.ts +98 -0
- package/dist/shared/chunk-skg3m9m0.js +56 -0
- package/dist/shared/chunk-t21t9x7e.js +188 -0
- package/dist/shared/chunk-tc75ng2c.js +235 -0
- package/dist/shared/chunk-tkx1krwc.js +88 -0
- package/dist/shared/chunk-tprdqtb1.d.ts +30 -0
- package/dist/shared/chunk-tv9a1sek.js +137 -0
- package/dist/shared/chunk-tvbd27hg.d.ts +43 -0
- package/dist/shared/chunk-ty2ccknv.d.ts +54 -0
- package/dist/shared/chunk-v6yevw62.d.ts +28 -0
- package/dist/shared/chunk-v9q38p0x.js +258 -0
- package/dist/shared/chunk-vgh4f3sv.js +118 -0
- package/dist/shared/chunk-vjht1zn1.js +391 -0
- package/dist/shared/chunk-vsrkb0sp.d.ts +21 -0
- package/dist/shared/chunk-whsx7yp9.d.ts +37 -0
- package/dist/shared/chunk-wq9h37gy.js +86 -0
- package/dist/shared/chunk-x7az5x1y.d.ts +57 -0
- package/dist/shared/chunk-x9jf26yb.js +318 -0
- package/dist/shared/chunk-xbrrt07s.d.ts +23 -0
- package/dist/shared/chunk-xkchhs2z.js +129 -0
- package/dist/shared/chunk-xzfrskd7.js +202 -0
- package/dist/shared/chunk-y4cj4y54.js +423 -0
- package/dist/shared/chunk-y934at6m.js +7 -0
- package/dist/shared/chunk-zbpwhpjy.d.ts +75 -0
- package/dist/shared/chunk-zfhmbb7n.js +63 -0
- package/dist/shared/chunk-zk0t4vq5.js +71 -0
- package/dist/shared/chunk-znp9gna7.d.ts +23 -0
- package/dist/styles.css +467 -0
- package/index.ts +49 -0
- package/lib/config-parts.tsx +97 -0
- package/lib/icons.tsx +149 -0
- package/lib/pace-bar.tsx +24 -0
- package/lib/pace.ts +78 -0
- package/lib/pane-parts.tsx +76 -0
- package/lib/row-trigger.tsx +44 -0
- package/lib/settings-parts.tsx +232 -0
- package/lib/side-pane-types.ts +75 -0
- package/lib/status-glyph.tsx +25 -0
- package/lib/types.ts +204 -0
- package/mock/demo-reply.tsx +33 -0
- package/mock/demo-session.tsx +150 -0
- package/mock/mock-config.ts +173 -0
- package/mock/mock-extras.ts +288 -0
- package/mock/mock-panes.ts +190 -0
- package/mock/mock-settings.ts +92 -0
- package/mock/mock.ts +548 -0
- package/mock/screen-frame.tsx +49 -0
- package/package.json +114 -4
|
@@ -0,0 +1,651 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Local addition: the AI app's composer, in a ShellCard. The draft
|
|
3
|
+
* (./draft.tsx) is Fluid Functionalism's InputMessage (attachments, queue,
|
|
4
|
+
* history, suggestions, send and stop), ported in modo-ui and moved here, with
|
|
5
|
+
* two controls: one +
|
|
6
|
+
* palette (attach, @-files, commands, skills, plugins) and one run-settings
|
|
7
|
+
* popover (model, effort, permissions, fast mode, output style, context).
|
|
8
|
+
* The shell's row says where the session runs: the project (with worktree
|
|
9
|
+
* and setup) and the profile (with its usage). Every menu grows out of its
|
|
10
|
+
* button.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
'use client'
|
|
14
|
+
|
|
15
|
+
import { SurfaceProvider, useSurface } from '@justanarthur/modo-ui'
|
|
16
|
+
import ShellCard from '@justanarthur/modo-ui/blocks/shell-card'
|
|
17
|
+
import Button from '@justanarthur/modo-ui/components/actions/button'
|
|
18
|
+
import List, { LIST_POPOVER, LIST_SWITCH } from '@justanarthur/modo-ui/components/data-display/list'
|
|
19
|
+
import Meter from '@justanarthur/modo-ui/components/feedback/meter'
|
|
20
|
+
import ChoiceList from '@justanarthur/modo-ui/components/inputs/choice-list'
|
|
21
|
+
import Select from '@justanarthur/modo-ui/components/inputs/select'
|
|
22
|
+
import Slider from '@justanarthur/modo-ui/components/inputs/slider'
|
|
23
|
+
import Switch from '@justanarthur/modo-ui/components/inputs/switch'
|
|
24
|
+
import Dropdown from '@justanarthur/modo-ui/components/overlays/dropdown'
|
|
25
|
+
import Popover from '@justanarthur/modo-ui/components/overlays/popover'
|
|
26
|
+
import { SURFACE_BG } from '@justanarthur/modo-ui/lib/surface-classes'
|
|
27
|
+
import { useControllableState } from '@justanarthur/modo-ui/lib/use-controllable-state'
|
|
28
|
+
import { cn } from '@justanarthur/modo-ui/lib/utils'
|
|
29
|
+
import { SizeProvider } from '@justanarthur/modo-ui/primitives/systems/sizes'
|
|
30
|
+
import { useIcon } from '../../../lib/icons'
|
|
31
|
+
import { RowTrigger } from '../../../lib/row-trigger'
|
|
32
|
+
import type { Command, Model, PermissionMode, Profile, Project } from '../../../lib/types'
|
|
33
|
+
import ProfileSwitcher from '../../profiles/profile-switcher'
|
|
34
|
+
import {
|
|
35
|
+
ComposerDraft,
|
|
36
|
+
type ComposerDraftProps,
|
|
37
|
+
type DraftSlotContext,
|
|
38
|
+
type DraftStatus,
|
|
39
|
+
type QueuedMessage,
|
|
40
|
+
} from './draft'
|
|
41
|
+
|
|
42
|
+
/** One + button: attach, mention a file, run a command, skill or plugin — one searchable list. */
|
|
43
|
+
function AddPalette({ files, commands, onAttach }: { files: string[]; commands: Command[]; onAttach: () => void }) {
|
|
44
|
+
const Plus = useIcon('plus')
|
|
45
|
+
const Paperclip = useIcon('paperclip')
|
|
46
|
+
const File = useIcon('file-text')
|
|
47
|
+
const Command = useIcon('command')
|
|
48
|
+
const groups = [
|
|
49
|
+
{ label: 'Commands', kind: 'command' },
|
|
50
|
+
{ label: 'Skills', kind: 'skill' },
|
|
51
|
+
{ label: 'Plugins', kind: 'plugin' },
|
|
52
|
+
] as const
|
|
53
|
+
let index = 1
|
|
54
|
+
return (
|
|
55
|
+
<Dropdown.Menu>
|
|
56
|
+
<Dropdown.Trigger
|
|
57
|
+
render={
|
|
58
|
+
<Button variant="ghost" size="icon-compact" aria-label="Add files, mentions and commands">
|
|
59
|
+
<Plus />
|
|
60
|
+
</Button>
|
|
61
|
+
}
|
|
62
|
+
/>
|
|
63
|
+
<Dropdown.Content side="top" align="start" className="w-72">
|
|
64
|
+
<Dropdown.Search filter placeholder="Files, commands, skills" />
|
|
65
|
+
<Dropdown.Item index={0} icon={Paperclip} label="Attach files…" onSelect={onAttach} />
|
|
66
|
+
<Dropdown.Label>Mention a file</Dropdown.Label>
|
|
67
|
+
{files.map(path => (
|
|
68
|
+
<Dropdown.Item key={path} index={index++} icon={File} label={path} />
|
|
69
|
+
))}
|
|
70
|
+
{groups.map(group => (
|
|
71
|
+
<div key={group.kind} className="contents">
|
|
72
|
+
<Dropdown.Label>{group.label}</Dropdown.Label>
|
|
73
|
+
{commands
|
|
74
|
+
.filter(c => c.kind === group.kind)
|
|
75
|
+
.map(c => (
|
|
76
|
+
<Dropdown.Item key={c.name} index={index++} icon={Command} label={c.name} />
|
|
77
|
+
))}
|
|
78
|
+
</div>
|
|
79
|
+
))}
|
|
80
|
+
<Dropdown.Empty>Nothing found</Dropdown.Empty>
|
|
81
|
+
</Dropdown.Content>
|
|
82
|
+
</Dropdown.Menu>
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** `value` while `options` holds it, else `fallback`: a pick never outlives its list. */
|
|
87
|
+
function inList(value: string, options: string[], fallback = options[0] ?? '') {
|
|
88
|
+
return options.includes(value) ? value : fallback
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
interface ProjectPickerProps {
|
|
92
|
+
projects: Project[]
|
|
93
|
+
branches: string[]
|
|
94
|
+
branch?: string
|
|
95
|
+
locked: boolean
|
|
96
|
+
project: string
|
|
97
|
+
onProjectChange: (path: string) => void
|
|
98
|
+
worktree: boolean
|
|
99
|
+
onWorktreeChange: (worktree: boolean) => void
|
|
100
|
+
baseBranch: string
|
|
101
|
+
onBaseBranchChange: (branch: string) => void
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Where a session runs: the project, a worktree of its own and how it is set up. */
|
|
105
|
+
function ProjectPicker({
|
|
106
|
+
projects,
|
|
107
|
+
branches,
|
|
108
|
+
branch,
|
|
109
|
+
locked,
|
|
110
|
+
project,
|
|
111
|
+
onProjectChange,
|
|
112
|
+
worktree,
|
|
113
|
+
onWorktreeChange,
|
|
114
|
+
baseBranch,
|
|
115
|
+
onBaseBranchChange,
|
|
116
|
+
}: ProjectPickerProps) {
|
|
117
|
+
const label = projects.find(p => p.path === project)?.label ?? ''
|
|
118
|
+
const Folder = useIcon('folder')
|
|
119
|
+
const Branch = useIcon('git-branch')
|
|
120
|
+
return (
|
|
121
|
+
<Popover>
|
|
122
|
+
<Popover.Trigger
|
|
123
|
+
render={
|
|
124
|
+
<RowTrigger aria-label={`Project: ${label}${worktree ? ', new worktree' : ''}`}>
|
|
125
|
+
<Folder size={14} strokeWidth={1.5} className="shrink-0 text-muted-foreground" />
|
|
126
|
+
<span className="min-w-0 truncate">{label}</span>
|
|
127
|
+
{worktree && <Branch size={14} strokeWidth={1.5} className="shrink-0 text-muted-foreground" />}
|
|
128
|
+
</RowTrigger>
|
|
129
|
+
}
|
|
130
|
+
/>
|
|
131
|
+
<Popover.Content side="top" align="start" sideOffset={8} className={LIST_POPOVER}>
|
|
132
|
+
<SizeProvider size="default">
|
|
133
|
+
<List.Section title={locked ? 'This session runs in' : 'Project'}>
|
|
134
|
+
<ChoiceList
|
|
135
|
+
label="Project"
|
|
136
|
+
value={project}
|
|
137
|
+
onValueChange={onProjectChange}
|
|
138
|
+
options={projects.map(g => ({
|
|
139
|
+
value: g.path,
|
|
140
|
+
label: g.label,
|
|
141
|
+
disabled: locked && g.path !== project,
|
|
142
|
+
content: (
|
|
143
|
+
<span className="flex min-w-0 flex-1 items-baseline justify-between gap-2">
|
|
144
|
+
<span className="text-body text-foreground">{g.label}</span>
|
|
145
|
+
<span className="truncate font-mono text-caption text-muted-foreground">{g.path}</span>
|
|
146
|
+
</span>
|
|
147
|
+
),
|
|
148
|
+
}))}
|
|
149
|
+
/>
|
|
150
|
+
</List.Section>
|
|
151
|
+
<List.Section title="Checkout">
|
|
152
|
+
{branch && (
|
|
153
|
+
<List.Row label="Branch">
|
|
154
|
+
<span className="min-w-0 truncate font-mono text-caption text-muted-foreground">{branch}</span>
|
|
155
|
+
</List.Row>
|
|
156
|
+
)}
|
|
157
|
+
<List.Row label="New worktree">
|
|
158
|
+
<Switch
|
|
159
|
+
label="New worktree"
|
|
160
|
+
checked={worktree}
|
|
161
|
+
onCheckedChange={onWorktreeChange}
|
|
162
|
+
disabled={locked}
|
|
163
|
+
className={LIST_SWITCH}
|
|
164
|
+
/>
|
|
165
|
+
</List.Row>
|
|
166
|
+
<List.Row label="Run setup script">
|
|
167
|
+
<Switch label="Run setup script" defaultChecked disabled={locked} className={LIST_SWITCH} />
|
|
168
|
+
</List.Row>
|
|
169
|
+
<List.Row label="Base branch">
|
|
170
|
+
<Select value={baseBranch} onValueChange={onBaseBranchChange} disabled={locked}>
|
|
171
|
+
<Select.Trigger variant="borderless" className="min-w-0" />
|
|
172
|
+
<Select.Content>
|
|
173
|
+
{branches.map((b, i) => (
|
|
174
|
+
<Select.Item key={b} index={i} value={b}>
|
|
175
|
+
{b}
|
|
176
|
+
</Select.Item>
|
|
177
|
+
))}
|
|
178
|
+
</Select.Content>
|
|
179
|
+
</Select>
|
|
180
|
+
</List.Row>
|
|
181
|
+
</List.Section>
|
|
182
|
+
</SizeProvider>
|
|
183
|
+
</Popover.Content>
|
|
184
|
+
</Popover>
|
|
185
|
+
)
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
interface RunSettingsProps {
|
|
189
|
+
models: Model[]
|
|
190
|
+
efforts: string[]
|
|
191
|
+
permissionModes: PermissionMode[]
|
|
192
|
+
outputStyles: string[]
|
|
193
|
+
context: number
|
|
194
|
+
compacting: boolean
|
|
195
|
+
model: string
|
|
196
|
+
onModelChange: (model: string) => void
|
|
197
|
+
effort: string
|
|
198
|
+
onEffortChange: (effort: string) => void
|
|
199
|
+
mode: string
|
|
200
|
+
onModeChange: (mode: string) => void
|
|
201
|
+
fast: boolean
|
|
202
|
+
onFastChange: (fast: boolean) => void
|
|
203
|
+
style: string
|
|
204
|
+
onStyleChange: (style: string) => void
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/** How the agent runs, behind one trigger: "Opus 5.5 · High ◔". */
|
|
208
|
+
function RunSettings({
|
|
209
|
+
models,
|
|
210
|
+
efforts,
|
|
211
|
+
permissionModes,
|
|
212
|
+
outputStyles,
|
|
213
|
+
context,
|
|
214
|
+
compacting,
|
|
215
|
+
model,
|
|
216
|
+
onModelChange,
|
|
217
|
+
effort,
|
|
218
|
+
onEffortChange,
|
|
219
|
+
mode,
|
|
220
|
+
onModeChange,
|
|
221
|
+
fast,
|
|
222
|
+
onFastChange,
|
|
223
|
+
style,
|
|
224
|
+
onStyleChange,
|
|
225
|
+
}: RunSettingsProps) {
|
|
226
|
+
const activeMode = permissionModes.find(m => m.label === mode)
|
|
227
|
+
const ModeIcon = useIcon(activeMode?.icon ?? 'shield-check')
|
|
228
|
+
const Zap = useIcon('zap')
|
|
229
|
+
const percent = Math.round(context * 100)
|
|
230
|
+
|
|
231
|
+
return (
|
|
232
|
+
<Popover>
|
|
233
|
+
<Popover.Trigger
|
|
234
|
+
render={
|
|
235
|
+
<RowTrigger
|
|
236
|
+
className="max-w-full"
|
|
237
|
+
aria-label={`Run settings: ${model}, ${effort} effort, ${mode}, context ${percent}%`}
|
|
238
|
+
>
|
|
239
|
+
<ModeIcon size={14} strokeWidth={1.5} className="shrink-0 text-muted-foreground" />
|
|
240
|
+
{fast && <Zap size={14} strokeWidth={1.5} className="shrink-0 text-muted-foreground" />}
|
|
241
|
+
<span className="min-w-0 truncate">
|
|
242
|
+
{model} · {effort}
|
|
243
|
+
</span>
|
|
244
|
+
<Meter variant="ring" label="Context used" value={compacting ? 0.3 : context} warnAt={0.8} errorAt={0.95} />
|
|
245
|
+
</RowTrigger>
|
|
246
|
+
}
|
|
247
|
+
/>
|
|
248
|
+
<Popover.Content side="top" align="end" sideOffset={8} className={LIST_POPOVER}>
|
|
249
|
+
<SizeProvider size="default">
|
|
250
|
+
<List.Section title="Model">
|
|
251
|
+
<ChoiceList
|
|
252
|
+
label="Model"
|
|
253
|
+
value={model}
|
|
254
|
+
onValueChange={onModelChange}
|
|
255
|
+
options={models.map(m => ({
|
|
256
|
+
value: m.name,
|
|
257
|
+
label: m.name,
|
|
258
|
+
content: (
|
|
259
|
+
<span className="flex min-w-0 flex-1 items-baseline justify-between gap-2">
|
|
260
|
+
<span className="text-body text-foreground">{m.name}</span>
|
|
261
|
+
<span className="truncate text-caption text-muted-foreground">{m.note}</span>
|
|
262
|
+
</span>
|
|
263
|
+
),
|
|
264
|
+
}))}
|
|
265
|
+
/>
|
|
266
|
+
</List.Section>
|
|
267
|
+
<div className="px-[var(--space-2)]">
|
|
268
|
+
<Slider
|
|
269
|
+
size="default"
|
|
270
|
+
label="Effort"
|
|
271
|
+
min={0}
|
|
272
|
+
max={efforts.length - 1}
|
|
273
|
+
step={1}
|
|
274
|
+
value={Math.max(efforts.indexOf(effort), 0)}
|
|
275
|
+
onValueChange={v => onEffortChange(efforts[typeof v === 'number' ? v : v[0]] ?? effort)}
|
|
276
|
+
formatValue={v => efforts[v] ?? ''}
|
|
277
|
+
/>
|
|
278
|
+
</div>
|
|
279
|
+
<List.Section title="Behaviour">
|
|
280
|
+
<List.Row label="Permissions">
|
|
281
|
+
<Select value={mode} onValueChange={onModeChange}>
|
|
282
|
+
<Select.Trigger variant="borderless" icon={ModeIcon} className="min-w-0" title={activeMode?.note} />
|
|
283
|
+
<Select.Content>
|
|
284
|
+
{permissionModes.map((m, i) => (
|
|
285
|
+
<Select.Item key={m.label} index={i} value={m.label}>
|
|
286
|
+
{m.label}
|
|
287
|
+
</Select.Item>
|
|
288
|
+
))}
|
|
289
|
+
</Select.Content>
|
|
290
|
+
</Select>
|
|
291
|
+
</List.Row>
|
|
292
|
+
<List.Row label="Fast mode">
|
|
293
|
+
<Switch label="Fast mode" checked={fast} onCheckedChange={onFastChange} className={LIST_SWITCH} />
|
|
294
|
+
</List.Row>
|
|
295
|
+
<List.Row label="Output style">
|
|
296
|
+
<Select value={style} onValueChange={onStyleChange}>
|
|
297
|
+
<Select.Trigger variant="borderless" className="min-w-0" />
|
|
298
|
+
<Select.Content>
|
|
299
|
+
{outputStyles.map((o, i) => (
|
|
300
|
+
<Select.Item key={o} index={i} value={o}>
|
|
301
|
+
{o}
|
|
302
|
+
</Select.Item>
|
|
303
|
+
))}
|
|
304
|
+
</Select.Content>
|
|
305
|
+
</Select>
|
|
306
|
+
</List.Row>
|
|
307
|
+
</List.Section>
|
|
308
|
+
<List.Section title="Context" aside={compacting ? 'Compacting…' : `${percent}% of the window`}>
|
|
309
|
+
<List.Row label="Compacts at 95%">
|
|
310
|
+
<Meter
|
|
311
|
+
variant="line"
|
|
312
|
+
className="w-20"
|
|
313
|
+
label="Context used"
|
|
314
|
+
value={compacting ? 0.3 : context}
|
|
315
|
+
warnAt={0.8}
|
|
316
|
+
errorAt={0.95}
|
|
317
|
+
/>
|
|
318
|
+
<Button variant="ghost" size="compact" disabled={compacting || context < 0.2}>
|
|
319
|
+
Compact
|
|
320
|
+
</Button>
|
|
321
|
+
</List.Row>
|
|
322
|
+
</List.Section>
|
|
323
|
+
</SizeProvider>
|
|
324
|
+
</Popover.Content>
|
|
325
|
+
</Popover>
|
|
326
|
+
)
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* The draft paints a fixed surface 2; inside a lifted shell that reads as a
|
|
331
|
+
* hole. This lifts it one level above whatever holds it instead.
|
|
332
|
+
*/
|
|
333
|
+
function LiftedDraft(props: ComposerDraftProps) {
|
|
334
|
+
const level = Math.min(useSurface() + 1, 8)
|
|
335
|
+
return (
|
|
336
|
+
<SurfaceProvider value={level}>
|
|
337
|
+
<ComposerDraft {...props} className={cn(SURFACE_BG[level], props.className)} />
|
|
338
|
+
</SurfaceProvider>
|
|
339
|
+
)
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
interface ComposerProps {
|
|
343
|
+
/** The models the active profile offers, each with a note. */
|
|
344
|
+
models: Model[]
|
|
345
|
+
/** The effort steps, lowest first. */
|
|
346
|
+
efforts: string[]
|
|
347
|
+
/** The permission modes, each with its icon and note. */
|
|
348
|
+
permissionModes: PermissionMode[]
|
|
349
|
+
/** The output styles. */
|
|
350
|
+
outputStyles: string[]
|
|
351
|
+
/** The commands, skills and plugins the + palette runs. */
|
|
352
|
+
commands: Command[]
|
|
353
|
+
/** Files the + palette can mention. */
|
|
354
|
+
files: string[]
|
|
355
|
+
/** The project folders a session can run in. */
|
|
356
|
+
projects: Project[]
|
|
357
|
+
/** Branches a new worktree can start from. */
|
|
358
|
+
branches: string[]
|
|
359
|
+
/** The session's own branch, shown in the project menu. Omit before the session has one. */
|
|
360
|
+
branch?: string
|
|
361
|
+
/** The project the session runs in, by `Project.path`, controlled. Pair with `onProjectChange`. A path not in `projects` shows, and stands for, the first project. */
|
|
362
|
+
project?: string
|
|
363
|
+
/** The initial project, by `Project.path`, when uncontrolled. Defaults to the first project. */
|
|
364
|
+
defaultProject?: string
|
|
365
|
+
/** Called with the picked project's `path`. Only a new session (`target`) can pick one. */
|
|
366
|
+
onProjectChange?: (path: string) => void
|
|
367
|
+
/** Whether the session gets a new git worktree, controlled. Pair with `onWorktreeChange`. */
|
|
368
|
+
worktree?: boolean
|
|
369
|
+
/** Start with a new worktree when uncontrolled. Defaults to `true`. */
|
|
370
|
+
defaultWorktree?: boolean
|
|
371
|
+
/** Called when the new-worktree switch flips. Only a new session (`target`) can flip it. */
|
|
372
|
+
onWorktreeChange?: (worktree: boolean) => void
|
|
373
|
+
/** The branch a new worktree starts from, controlled. Pair with `onBaseBranchChange`. A branch not in `branches` stands for the first one. */
|
|
374
|
+
baseBranch?: string
|
|
375
|
+
/** The initial base branch when uncontrolled. Defaults to the first branch. */
|
|
376
|
+
defaultBaseBranch?: string
|
|
377
|
+
/** Called with the base branch picked. Only a new session (`target`) can pick one. */
|
|
378
|
+
onBaseBranchChange?: (branch: string) => void
|
|
379
|
+
/** The profiles a session can run under. */
|
|
380
|
+
profiles: Profile[]
|
|
381
|
+
/** The model, by name, controlled. Pair with `onModelChange`. A name not in `models` (say, after a switch to another provider) stands for the first model. */
|
|
382
|
+
model?: string
|
|
383
|
+
/** Initial model, by name, when uncontrolled. Defaults to the first model. */
|
|
384
|
+
defaultModel?: string
|
|
385
|
+
/** Called with the model's name when another one is picked. */
|
|
386
|
+
onModelChange?: (model: string) => void
|
|
387
|
+
/** The effort step, controlled. Pair with `onEffortChange`. A step not in `efforts` stands for the middle one. */
|
|
388
|
+
effort?: string
|
|
389
|
+
/** Initial effort when uncontrolled. Defaults to the middle step. */
|
|
390
|
+
defaultEffort?: string
|
|
391
|
+
/** Called with the effort step the slider lands on. */
|
|
392
|
+
onEffortChange?: (effort: string) => void
|
|
393
|
+
/** The permission mode, by label, controlled. Pair with `onPermissionModeChange`. A label not in `permissionModes` stands for the first mode. */
|
|
394
|
+
permissionMode?: string
|
|
395
|
+
/** Initial permission mode, by label, when uncontrolled. Defaults to the first mode. */
|
|
396
|
+
defaultPermissionMode?: string
|
|
397
|
+
/** Called with the permission mode's label when another one is picked. */
|
|
398
|
+
onPermissionModeChange?: (mode: string) => void
|
|
399
|
+
/** Whether fast mode is on, controlled. Pair with `onFastChange`. */
|
|
400
|
+
fast?: boolean
|
|
401
|
+
/** Start with fast mode on when uncontrolled. Defaults to `false`. */
|
|
402
|
+
defaultFast?: boolean
|
|
403
|
+
/** Called when the fast mode switch flips. */
|
|
404
|
+
onFastChange?: (fast: boolean) => void
|
|
405
|
+
/** The output style, controlled. Pair with `onOutputStyleChange`. A style not in `outputStyles` stands for the first one. */
|
|
406
|
+
outputStyle?: string
|
|
407
|
+
/** Initial output style when uncontrolled. Defaults to the first style. */
|
|
408
|
+
defaultOutputStyle?: string
|
|
409
|
+
/** Called with the output style picked. */
|
|
410
|
+
onOutputStyleChange?: (style: string) => void
|
|
411
|
+
/** Used share of the context window, 0–1. Defaults to `0.62`. */
|
|
412
|
+
context?: number
|
|
413
|
+
/** The conversation is being compacted: the context meter says so. Defaults to `false`. */
|
|
414
|
+
compacting?: boolean
|
|
415
|
+
/** Whether a reply is streaming. While it is, Enter queues the draft and the empty draft's button stops the reply; on the streaming→idle edge the head of the queue sends. Pair with `onStatusChange` / `onStop`, or set `defaultStatus`. */
|
|
416
|
+
status?: DraftStatus
|
|
417
|
+
/** The initial status when uncontrolled; Stop then flips it to `"idle"` itself. Defaults to `"idle"`. */
|
|
418
|
+
defaultStatus?: DraftStatus
|
|
419
|
+
/** Called with the status when the uncontrolled composer changes it (Stop). */
|
|
420
|
+
onStatusChange?: (status: DraftStatus) => void
|
|
421
|
+
/** Called when Stop is pressed. Halt the reply and set `status` to `"idle"`. */
|
|
422
|
+
onStop?: () => void
|
|
423
|
+
/** The draft's text, controlled. Pair with `onValueChange`. */
|
|
424
|
+
value?: string
|
|
425
|
+
/** The draft's initial text when uncontrolled. Defaults to `""`. */
|
|
426
|
+
defaultValue?: string
|
|
427
|
+
/** Called with the draft's text on every change. */
|
|
428
|
+
onValueChange?: (value: string) => void
|
|
429
|
+
/** The messages queued while a reply streams, controlled: `{ id, text, files }` each. Pair with `onQueueChange`. */
|
|
430
|
+
queue?: QueuedMessage[]
|
|
431
|
+
/** The initial queue when uncontrolled. Defaults to `[]`. */
|
|
432
|
+
defaultQueue?: QueuedMessage[]
|
|
433
|
+
/** Called when a message is queued, edited back, removed, reordered or sent from the queue. */
|
|
434
|
+
onQueueChange?: (queue: QueuedMessage[]) => void
|
|
435
|
+
/** Messages sent before, oldest first: ↑ on the draft's first line recalls them, ↓ on its last walks back to the draft. Defaults to `[]`. */
|
|
436
|
+
history?: string[]
|
|
437
|
+
/** Prompts listed under the draft while it is empty: ↓ / ↑ walk them without leaving the text, Enter or a click fills one in. */
|
|
438
|
+
suggestions?: string[]
|
|
439
|
+
/** A prompt shown as the placeholder with a Tab keycap: Tab fills it in. Wins over `placeholder`. */
|
|
440
|
+
placeholderSuggestion?: string
|
|
441
|
+
/** The file types the palette's Attach and a drop take, as an `accept` string. Defaults to `"image/png,image/jpeg,application/pdf"`. */
|
|
442
|
+
accept?: string
|
|
443
|
+
/** The most files a message takes; extra ones are dropped. */
|
|
444
|
+
maxFiles?: number
|
|
445
|
+
/** A new session: the project and profile can still be picked. Otherwise they show where this session runs. Defaults to `false`. */
|
|
446
|
+
target?: boolean
|
|
447
|
+
/** The profile the session runs under, by id, controlled. Pair with `onProfileChange`. An id not in `profiles` shows the first profile. */
|
|
448
|
+
profile?: string
|
|
449
|
+
/** The profile the session runs under, by id, when uncontrolled. Defaults to the first profile. */
|
|
450
|
+
defaultProfile?: string
|
|
451
|
+
/** Called with the profile picked, by id. */
|
|
452
|
+
onProfileChange?: (profile: string) => void
|
|
453
|
+
/** The draft's placeholder. Defaults to `'Ask, or type / for commands'`. */
|
|
454
|
+
placeholder?: string
|
|
455
|
+
/** Called with the trimmed text and the attached files when a message is sent, or sent from the queue. */
|
|
456
|
+
onSend?: (text: string, files: File[]) => void
|
|
457
|
+
/** Classes for the root. */
|
|
458
|
+
className?: string
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Where you write to the session, with every per-session control behind
|
|
463
|
+
* four triggers, held in a ShellCard.
|
|
464
|
+
*
|
|
465
|
+
* The draft grows with its text, then scrolls; Enter sends and Shift+Enter
|
|
466
|
+
* breaks the line. Files dropped anywhere on it, or attached from the +
|
|
467
|
+
* palette, preview as tiles above the text (images as themselves, PDFs by
|
|
468
|
+
* their first page with the optional `pdfjs-dist`, the rest as an icon).
|
|
469
|
+
* While a reply streams (`status`) the button queues what you type: queued
|
|
470
|
+
* messages stack above the draft, reorder by drag or Alt+↑/↓, come back into
|
|
471
|
+
* the draft on a double-click, and the first one sends when the reply ends;
|
|
472
|
+
* with the draft empty the button stops the reply. ↑ on the first line
|
|
473
|
+
* recalls sent messages (`history`); `suggestions` list prompts under an
|
|
474
|
+
* empty draft and `placeholderSuggestion` offers one behind a Tab keycap.
|
|
475
|
+
* The + opens one searchable palette: attach, mention a file, run a
|
|
476
|
+
* command, skill or plugin.
|
|
477
|
+
*
|
|
478
|
+
* The row under it, on the shell, holds the rest. On the left, where the
|
|
479
|
+
* session runs: the project, whose popover also holds the worktree, the
|
|
480
|
+
* setup script and the base branch, and the profile, with two thin lines for
|
|
481
|
+
* its session and weekly limits (see the profile switcher). On the right,
|
|
482
|
+
* how it runs: one trigger showing the permission mode, the model, the
|
|
483
|
+
* effort and a small context ring opens the model (with a note on each), a
|
|
484
|
+
* tall effort slider, the permission mode, fast mode, the output style and
|
|
485
|
+
* the context with a compact button. All three popovers share one layout: a
|
|
486
|
+
* caption per section, then rows with the label on the left and the control
|
|
487
|
+
* on the right.
|
|
488
|
+
*
|
|
489
|
+
* Every draft prop has its uncontrolled twin (`defaultValue`,
|
|
490
|
+
* `defaultQueue`, `defaultStatus`), so a composer runs with no state in the
|
|
491
|
+
* caller. So does every choice on the row: the project (by its `path`), the
|
|
492
|
+
* worktree switch, the base branch, the profile, the model, the effort, the
|
|
493
|
+
* permission mode, fast mode and the output style each take a controlled
|
|
494
|
+
* prop, a `default…` and an `on…Change`, so an app can pass them on to the
|
|
495
|
+
* agent (`--model`, `--effort`, `--permission-mode`). A choice its list no
|
|
496
|
+
* longer holds (a model after a switch to another provider, a project that
|
|
497
|
+
* was removed) stands for the list's first entry (the middle one for effort)
|
|
498
|
+
* instead of lingering.
|
|
499
|
+
*
|
|
500
|
+
* Statics:
|
|
501
|
+
* - `Composer.Draft` — the draft alone, without the shell and its menus:
|
|
502
|
+
* the props above plus `leftSlot` / `rightSlot` (content, or a render
|
|
503
|
+
* function given `{ openFilePicker, files }`), `files` / `defaultFiles` /
|
|
504
|
+
* `onFilesChange` (attachments are on once either is set), `minRows` /
|
|
505
|
+
* `maxRows`, `size`, `disabled`, `showQueue` and `textareaProps`.
|
|
506
|
+
*
|
|
507
|
+
* Also exported: `FileThumbnail`, the square preview of an attachment, for
|
|
508
|
+
* the files a sent message carried.
|
|
509
|
+
*
|
|
510
|
+
* @example {@include ./examples.mdx}
|
|
511
|
+
* @source https://github.com/mickadesign/fluid-functionalism/blob/b3587bdbd83fc66c2a6aae3817ffb856cb09260b/registry/default/input-message.tsx Fluid Functionalism
|
|
512
|
+
* @license MIT © 2026 Micka Touillaud
|
|
513
|
+
*/
|
|
514
|
+
const Composer = Object.assign(
|
|
515
|
+
function Composer({
|
|
516
|
+
models,
|
|
517
|
+
efforts,
|
|
518
|
+
permissionModes,
|
|
519
|
+
outputStyles,
|
|
520
|
+
commands,
|
|
521
|
+
files,
|
|
522
|
+
projects,
|
|
523
|
+
branches,
|
|
524
|
+
branch,
|
|
525
|
+
project: projectProp,
|
|
526
|
+
defaultProject,
|
|
527
|
+
onProjectChange,
|
|
528
|
+
worktree: worktreeProp,
|
|
529
|
+
defaultWorktree = true,
|
|
530
|
+
onWorktreeChange,
|
|
531
|
+
baseBranch: baseBranchProp,
|
|
532
|
+
defaultBaseBranch,
|
|
533
|
+
onBaseBranchChange,
|
|
534
|
+
profiles,
|
|
535
|
+
model: modelProp,
|
|
536
|
+
defaultModel,
|
|
537
|
+
onModelChange,
|
|
538
|
+
effort: effortProp,
|
|
539
|
+
defaultEffort,
|
|
540
|
+
onEffortChange,
|
|
541
|
+
permissionMode: permissionModeProp,
|
|
542
|
+
defaultPermissionMode,
|
|
543
|
+
onPermissionModeChange,
|
|
544
|
+
fast: fastProp,
|
|
545
|
+
defaultFast = false,
|
|
546
|
+
onFastChange,
|
|
547
|
+
outputStyle: outputStyleProp,
|
|
548
|
+
defaultOutputStyle,
|
|
549
|
+
onOutputStyleChange,
|
|
550
|
+
context = 0.62,
|
|
551
|
+
compacting = false,
|
|
552
|
+
defaultStatus = 'idle',
|
|
553
|
+
target = false,
|
|
554
|
+
profile,
|
|
555
|
+
defaultProfile,
|
|
556
|
+
onProfileChange,
|
|
557
|
+
placeholder = 'Ask, or type / for commands',
|
|
558
|
+
className,
|
|
559
|
+
...draft
|
|
560
|
+
}: ComposerProps) {
|
|
561
|
+
const projectPaths = projects.map(p => p.path)
|
|
562
|
+
const modelNames = models.map(m => m.name)
|
|
563
|
+
const modeLabels = permissionModes.map(m => m.label)
|
|
564
|
+
const middleEffort = efforts[Math.floor(efforts.length / 2)] ?? ''
|
|
565
|
+
const [project, setProject] = useControllableState(projectProp, defaultProject ?? '', onProjectChange)
|
|
566
|
+
const [worktree, setWorktree] = useControllableState(worktreeProp, defaultWorktree, onWorktreeChange)
|
|
567
|
+
const [baseBranch, setBaseBranch] = useControllableState(
|
|
568
|
+
baseBranchProp,
|
|
569
|
+
defaultBaseBranch ?? '',
|
|
570
|
+
onBaseBranchChange,
|
|
571
|
+
)
|
|
572
|
+
const [model, setModel] = useControllableState(modelProp, defaultModel ?? '', onModelChange)
|
|
573
|
+
const [effort, setEffort] = useControllableState(effortProp, defaultEffort ?? middleEffort, onEffortChange)
|
|
574
|
+
const [mode, setMode] = useControllableState(
|
|
575
|
+
permissionModeProp,
|
|
576
|
+
defaultPermissionMode ?? '',
|
|
577
|
+
onPermissionModeChange,
|
|
578
|
+
)
|
|
579
|
+
const [fast, setFast] = useControllableState(fastProp, defaultFast, onFastChange)
|
|
580
|
+
const [style, setStyle] = useControllableState(outputStyleProp, defaultOutputStyle ?? '', onOutputStyleChange)
|
|
581
|
+
|
|
582
|
+
return (
|
|
583
|
+
<ShellCard
|
|
584
|
+
variant="elevated"
|
|
585
|
+
className={cn('w-full', className)}
|
|
586
|
+
footer={
|
|
587
|
+
<SizeProvider size="compact">
|
|
588
|
+
<ShellCard.Footer className="justify-start gap-[var(--space-1)] pt-[var(--space-1)]">
|
|
589
|
+
<ProjectPicker
|
|
590
|
+
projects={projects}
|
|
591
|
+
branches={branches}
|
|
592
|
+
branch={branch}
|
|
593
|
+
locked={!target}
|
|
594
|
+
project={inList(project, projectPaths)}
|
|
595
|
+
onProjectChange={setProject}
|
|
596
|
+
worktree={worktree}
|
|
597
|
+
onWorktreeChange={setWorktree}
|
|
598
|
+
baseBranch={inList(baseBranch, branches)}
|
|
599
|
+
onBaseBranchChange={setBaseBranch}
|
|
600
|
+
/>
|
|
601
|
+
<ProfileSwitcher
|
|
602
|
+
profiles={profiles}
|
|
603
|
+
value={profile}
|
|
604
|
+
defaultValue={defaultProfile}
|
|
605
|
+
onValueChange={onProfileChange}
|
|
606
|
+
side="top"
|
|
607
|
+
/>
|
|
608
|
+
<div className="ml-auto min-w-0">
|
|
609
|
+
<RunSettings
|
|
610
|
+
models={models}
|
|
611
|
+
efforts={efforts}
|
|
612
|
+
permissionModes={permissionModes}
|
|
613
|
+
outputStyles={outputStyles}
|
|
614
|
+
context={context}
|
|
615
|
+
compacting={compacting}
|
|
616
|
+
model={inList(model, modelNames)}
|
|
617
|
+
onModelChange={setModel}
|
|
618
|
+
effort={inList(effort, efforts, middleEffort)}
|
|
619
|
+
onEffortChange={setEffort}
|
|
620
|
+
mode={inList(mode, modeLabels)}
|
|
621
|
+
onModeChange={setMode}
|
|
622
|
+
fast={fast}
|
|
623
|
+
onFastChange={setFast}
|
|
624
|
+
style={inList(style, outputStyles)}
|
|
625
|
+
onStyleChange={setStyle}
|
|
626
|
+
/>
|
|
627
|
+
</div>
|
|
628
|
+
</ShellCard.Footer>
|
|
629
|
+
</SizeProvider>
|
|
630
|
+
}
|
|
631
|
+
>
|
|
632
|
+
<LiftedDraft
|
|
633
|
+
{...draft}
|
|
634
|
+
placeholder={placeholder}
|
|
635
|
+
defaultStatus={defaultStatus}
|
|
636
|
+
defaultFiles={[]}
|
|
637
|
+
leftSlot={({ openFilePicker }) => (
|
|
638
|
+
<AddPalette files={files} commands={commands} onAttach={() => openFilePicker()} />
|
|
639
|
+
)}
|
|
640
|
+
/>
|
|
641
|
+
</ShellCard>
|
|
642
|
+
)
|
|
643
|
+
},
|
|
644
|
+
{ Draft: ComposerDraft },
|
|
645
|
+
)
|
|
646
|
+
|
|
647
|
+
export { FileThumbnail } from './file-thumbnail'
|
|
648
|
+
export type { ComposerDraftProps, ComposerProps, DraftSlotContext, DraftStatus, QueuedMessage }
|
|
649
|
+
export { Composer, ComposerDraft }
|
|
650
|
+
|
|
651
|
+
export default Composer
|