@justanarthur/modo-ui-ai 0.0.0-stage → 0.2.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 +114 -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 +517 -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 +204 -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 +33 -0
- package/blocks/dialogs/command-palette/index.tsx +232 -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 +13 -0
- package/blocks/panes/usage-pane/index.tsx +75 -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 +18 -0
- package/blocks/profiles/profile-switcher/index.tsx +197 -0
- package/blocks/profiles/profile-usage/examples.mdx +21 -0
- package/blocks/profiles/profile-usage/index.tsx +127 -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 +43 -0
- package/blocks/sessions/session-sidebar/index.tsx +442 -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 +30 -0
- package/components/conversation/agent-run/index.tsx +82 -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 +128 -0
- package/components/conversation/message/working.tsx +102 -0
- package/components/conversation/reasoning/examples.mdx +22 -0
- package/components/conversation/reasoning/index.tsx +54 -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 +15 -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 +11 -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 +26 -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 +12 -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-1aq2xzv5.js +558 -0
- package/dist/shared/chunk-1f96cz69.js +45 -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-4248zvmh.js +177 -0
- package/dist/shared/chunk-45rqgey6.d.ts +25 -0
- package/dist/shared/chunk-4n0v64qx.js +179 -0
- package/dist/shared/chunk-4zvhpf2x.js +55 -0
- package/dist/shared/chunk-57hzzmjd.d.ts +67 -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-5k6xwqfj.d.ts +68 -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-6g4970a6.d.ts +20 -0
- package/dist/shared/chunk-75zwypyr.d.ts +43 -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-8xg5gwwy.js +38 -0
- package/dist/shared/chunk-9kw6m047.d.ts +32 -0
- package/dist/shared/chunk-a4s440b6.js +79 -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-bh2b5d1z.js +98 -0
- package/dist/shared/chunk-bzs6amnv.js +187 -0
- package/dist/shared/chunk-c36qvrwq.d.ts +30 -0
- package/dist/shared/chunk-c8wp058j.js +153 -0
- package/dist/shared/chunk-cd4f87as.d.ts +28 -0
- package/dist/shared/chunk-cmwby8f9.js +467 -0
- package/dist/shared/chunk-d2t72h4x.d.ts +35 -0
- package/dist/shared/chunk-dh3qy5fj.js +49 -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-fbn0h7cr.js +123 -0
- package/dist/shared/chunk-fqhcz6ss.d.ts +29 -0
- package/dist/shared/chunk-g28hweee.d.ts +35 -0
- package/dist/shared/chunk-g88hweqh.d.ts +70 -0
- package/dist/shared/chunk-gewnsgza.js +61 -0
- package/dist/shared/chunk-gkyk663q.d.ts +53 -0
- package/dist/shared/chunk-hd4gtj5z.d.ts +23 -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-k5zegxje.d.ts +81 -0
- package/dist/shared/chunk-kreypnzp.d.ts +34 -0
- package/dist/shared/chunk-kw9npka5.js +224 -0
- package/dist/shared/chunk-mrb3fp2f.d.ts +30 -0
- package/dist/shared/chunk-n1qq2wp9.js +6 -0
- package/dist/shared/chunk-n4742y54.js +39 -0
- package/dist/shared/chunk-ndjvdkv7.d.ts +29 -0
- package/dist/shared/chunk-nk4578dr.js +73 -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-r5hz78pb.js +129 -0
- package/dist/shared/chunk-r6nb21kz.d.ts +102 -0
- package/dist/shared/chunk-rjfwje37.d.ts +234 -0
- package/dist/shared/chunk-rqrpvvz4.d.ts +107 -0
- package/dist/shared/chunk-rzajcn44.d.ts +49 -0
- package/dist/shared/chunk-s3r759ec.js +80 -0
- package/dist/shared/chunk-sdtjrw9w.d.ts +98 -0
- package/dist/shared/chunk-sfqvyzcs.d.ts +68 -0
- package/dist/shared/chunk-skg3m9m0.js +56 -0
- package/dist/shared/chunk-szkvrqg1.d.ts +54 -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-v6yevw62.d.ts +28 -0
- package/dist/shared/chunk-v9q38p0x.js +258 -0
- package/dist/shared/chunk-vd59gzzd.js +86 -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-w5z8qnf8.js +175 -0
- package/dist/shared/chunk-wgvzavx1.js +1488 -0
- package/dist/shared/chunk-whsx7yp9.d.ts +37 -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 +74 -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,128 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Local addition (not part of Fluid Functionalism): one turn of a chat with an
|
|
3
|
+
* AI. The user's turn is a bubble on the right with its attachments and
|
|
4
|
+
* @-mentions; the assistant's is rendered markdown on the page (Markdown.Prose from modo-ui),
|
|
5
|
+
* with the working dots while it streams (Fluid Functionalism's
|
|
6
|
+
* ThinkingIndicator, in ./working.tsx). Generalised from the AI app's transcript.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
'use client'
|
|
10
|
+
|
|
11
|
+
import { MarkdownProse } from '@justanarthur/modo-ui/components/data-display/markdown'
|
|
12
|
+
import { useShape } from '@justanarthur/modo-ui/lib/shape-context'
|
|
13
|
+
import { cn } from '@justanarthur/modo-ui/lib/utils'
|
|
14
|
+
import type { ReactNode } from 'react'
|
|
15
|
+
import { useIcon } from '../../../lib/icons'
|
|
16
|
+
import { Working, type WorkingProps } from './working'
|
|
17
|
+
|
|
18
|
+
type MessageRole = 'user' | 'assistant'
|
|
19
|
+
|
|
20
|
+
type AttachmentKind = 'file' | 'image' | 'pasted'
|
|
21
|
+
|
|
22
|
+
interface MentionProps {
|
|
23
|
+
/** The file or folder path. */
|
|
24
|
+
path: string
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** An @-mention of a file inside a message. */
|
|
28
|
+
function Mention({ path }: MentionProps) {
|
|
29
|
+
const At = useIcon('at-sign')
|
|
30
|
+
return (
|
|
31
|
+
<span className="inline-flex translate-y-px items-center gap-0.5 rounded-glyph bg-active px-1 align-baseline font-mono text-caption text-foreground">
|
|
32
|
+
<At size={11} strokeWidth={2} className="shrink-0 text-muted-foreground" />
|
|
33
|
+
{path}
|
|
34
|
+
</span>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface AttachmentProps {
|
|
39
|
+
/** The file name. */
|
|
40
|
+
name: string
|
|
41
|
+
/** A short line under it: size, page count, line count. */
|
|
42
|
+
detail?: string
|
|
43
|
+
/** `pasted` is text pasted into the composer, folded to a chip. Defaults to `'file'`. */
|
|
44
|
+
kind?: AttachmentKind
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** A file, image or pasted text that came with a message. */
|
|
48
|
+
function Attachment({ name, detail, kind = 'file' }: AttachmentProps) {
|
|
49
|
+
const shape = useShape()
|
|
50
|
+
const Icon = useIcon(kind === 'pasted' ? 'clipboard' : kind === 'image' ? 'image' : 'file-text')
|
|
51
|
+
return (
|
|
52
|
+
<span className={cn('inline-flex h-11 max-w-56 items-center gap-2 border border-border px-2.5', shape.item)}>
|
|
53
|
+
<Icon size={16} strokeWidth={1.5} className="shrink-0 text-muted-foreground" />
|
|
54
|
+
<span className="flex min-w-0 flex-col">
|
|
55
|
+
<span className="truncate text-caption text-foreground">{name}</span>
|
|
56
|
+
{detail && <span className="truncate text-caption text-muted-foreground">{detail}</span>}
|
|
57
|
+
</span>
|
|
58
|
+
</span>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
interface MessageProps {
|
|
63
|
+
/** Who speaks: `user` is a bubble on the right, `assistant` is text on the page. */
|
|
64
|
+
role: MessageRole
|
|
65
|
+
/** The message: text with `Message.Mention`s for a user, rendered markdown for the assistant. */
|
|
66
|
+
children: ReactNode
|
|
67
|
+
/** A user's attachments and pasted text (`Message.Attachment`s), shown above the bubble. */
|
|
68
|
+
attachments?: ReactNode
|
|
69
|
+
/** The assistant's reply is still arriving: the working dots follow its last block. Defaults to `false`. */
|
|
70
|
+
streaming?: boolean
|
|
71
|
+
/** Classes for the root. */
|
|
72
|
+
className?: string
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* One turn of a conversation with an AI: what you asked, or what it answered.
|
|
77
|
+
*
|
|
78
|
+
* Your turn is a bubble on the right, on the muted fill, with its
|
|
79
|
+
* attachments (files, images, pasted text folded to a chip) above it and
|
|
80
|
+
* @-mentions inline. The assistant's turn has no bubble: it is rendered
|
|
81
|
+
* markdown on the page, in Markdown.Prose's type and rhythm, so a long answer reads
|
|
82
|
+
* like a document. While the reply streams, the working dots follow its
|
|
83
|
+
* last block.
|
|
84
|
+
*
|
|
85
|
+
* Statics:
|
|
86
|
+
* - `Message.Mention` — an @-file chip inline in the text: `path`.
|
|
87
|
+
* - `Message.Attachment` — a file, image or pasted-text chip: `name`, `detail`, `kind`.
|
|
88
|
+
* - `Message.Working` — the in-flight dots on their own: three dots that melt
|
|
89
|
+
* into one blob and split again beside a word that cycles (Thinking,
|
|
90
|
+
* Planning, …) in the width of the longest, and an optional `label`. One
|
|
91
|
+
* static "Thinking…" is announced; reduced motion holds the dots apart and
|
|
92
|
+
* the word still.
|
|
93
|
+
*
|
|
94
|
+
* @example {@include ./examples.mdx}
|
|
95
|
+
*/
|
|
96
|
+
const Message = Object.assign(
|
|
97
|
+
function Message({ role, children, attachments, streaming = false, className }: MessageProps) {
|
|
98
|
+
const shape = useShape()
|
|
99
|
+
|
|
100
|
+
if (role === 'assistant')
|
|
101
|
+
return (
|
|
102
|
+
<MarkdownProse className={className}>
|
|
103
|
+
{children}
|
|
104
|
+
{streaming && <Working />}
|
|
105
|
+
</MarkdownProse>
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<div className={cn('flex flex-col items-end gap-2 pl-[12%]', className)}>
|
|
110
|
+
{attachments && <div className="flex flex-wrap justify-end gap-2">{attachments}</div>}
|
|
111
|
+
<div
|
|
112
|
+
className={cn(
|
|
113
|
+
'min-w-0 bg-muted px-[var(--space-3)] py-[var(--space-2)] text-body text-foreground',
|
|
114
|
+
shape.container,
|
|
115
|
+
)}
|
|
116
|
+
>
|
|
117
|
+
{children}
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
)
|
|
121
|
+
},
|
|
122
|
+
{ Mention: Mention, Attachment: Attachment, Working: Working },
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
export type { AttachmentKind, AttachmentProps, MentionProps, MessageProps, MessageRole, WorkingProps }
|
|
126
|
+
export { Attachment, Mention, Message, Working }
|
|
127
|
+
|
|
128
|
+
export default Message
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Ported from Fluid Functionalism — github.com/mickadesign/fluid-functionalism
|
|
3
|
+
* `registry/default/thinking-indicator.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b
|
|
4
|
+
* MIT License © 2026 Micka Touillaud (notice: LICENSE.fluid-functionalism). Local changes: see ui/PORTING.md
|
|
5
|
+
* (ThinkingIndicator, folded into Message.Working).
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use client'
|
|
9
|
+
|
|
10
|
+
import { GooFilter, useReduceMotion } from '@justanarthur/modo-ui'
|
|
11
|
+
import { spring } from '@justanarthur/modo-ui/lib/springs'
|
|
12
|
+
import { GOO_BLUR_RATIO } from '@justanarthur/modo-ui/lib/use-morph'
|
|
13
|
+
import { AnimatePresence, motion } from 'motion/react'
|
|
14
|
+
import { useEffect, useId, useState } from 'react'
|
|
15
|
+
|
|
16
|
+
const WORDS = ['Thinking', 'Moonwalking', 'Planning', 'Refining']
|
|
17
|
+
const LONGEST = WORDS.reduce((a, b) => (a.length >= b.length ? a : b))
|
|
18
|
+
|
|
19
|
+
// `GAP` (between dot centers) is wide enough that split dots let go of each other through the goo.
|
|
20
|
+
const RADIUS = 2.5
|
|
21
|
+
const GAP = 9
|
|
22
|
+
|
|
23
|
+
// The merged blob holds the three dots' area, so it swells as they melt in.
|
|
24
|
+
const MERGED = Math.sqrt(3)
|
|
25
|
+
|
|
26
|
+
const SWAP_EASE = [0.4, 0, 0.2, 1] as const
|
|
27
|
+
|
|
28
|
+
/** Three dots that melt into one blob and split again, through the shared goo filter. */
|
|
29
|
+
function GooDots({ still }: { still: boolean }) {
|
|
30
|
+
const gooId = `working-goo-${useId().replace(/:/g, '')}`
|
|
31
|
+
// Eased, not sprung: a spring at this size settles too fast to see a neck form.
|
|
32
|
+
const loop = { duration: spring.slow.duration * 8, ease: 'easeInOut' as const, repeat: Infinity }
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<span aria-hidden className="relative h-[18px] w-[23px] shrink-0">
|
|
36
|
+
<GooFilter id={gooId} blur={RADIUS * GOO_BLUR_RATIO} />
|
|
37
|
+
<span className="absolute inset-0 flex items-center justify-center" style={{ filter: `url(#${gooId})` }}>
|
|
38
|
+
{[-1, 0, 1].map(side => (
|
|
39
|
+
<motion.span
|
|
40
|
+
key={side}
|
|
41
|
+
className="absolute size-[5px] rounded-full bg-muted-foreground"
|
|
42
|
+
animate={still ? { x: side * GAP } : side ? { x: [side * GAP, 0, side * GAP] } : { scale: [1, MERGED, 1] }}
|
|
43
|
+
transition={still ? { duration: 0 } : loop}
|
|
44
|
+
/>
|
|
45
|
+
))}
|
|
46
|
+
</span>
|
|
47
|
+
</span>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** The word beside the dots, swapped every four seconds in the width of the longest. */
|
|
52
|
+
function CyclingWord({ still }: { still: boolean }) {
|
|
53
|
+
const [index, setIndex] = useState(0)
|
|
54
|
+
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (still) return
|
|
57
|
+
const interval = setInterval(() => setIndex(i => (i + 1) % WORDS.length), 4000)
|
|
58
|
+
return () => clearInterval(interval)
|
|
59
|
+
}, [still])
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<span aria-hidden className="inline-grid overflow-hidden text-body-compact weight-medium text-muted-foreground">
|
|
63
|
+
<span className="invisible col-start-1 row-start-1">{LONGEST}</span>
|
|
64
|
+
{still ? (
|
|
65
|
+
<span className="col-start-1 row-start-1">{WORDS[0]}</span>
|
|
66
|
+
) : (
|
|
67
|
+
<AnimatePresence mode="popLayout" initial={false}>
|
|
68
|
+
<motion.span
|
|
69
|
+
key={WORDS[index]}
|
|
70
|
+
className="col-start-1 row-start-1"
|
|
71
|
+
initial={{ y: '80%', opacity: 0 }}
|
|
72
|
+
animate={{ y: 0, opacity: 1, transition: { duration: spring.slow.duration, ease: SWAP_EASE } }}
|
|
73
|
+
exit={{ y: '-80%', opacity: 0, transition: { duration: spring.slow.exit.duration, ease: SWAP_EASE } }}
|
|
74
|
+
>
|
|
75
|
+
{WORDS[index]}
|
|
76
|
+
</motion.span>
|
|
77
|
+
</AnimatePresence>
|
|
78
|
+
)}
|
|
79
|
+
</span>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
interface WorkingProps {
|
|
84
|
+
/** A short line beside the dots: what it is doing. */
|
|
85
|
+
label?: string
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** The in-flight dots, for a reply that hasn't started or a turn still running. */
|
|
89
|
+
function Working({ label }: WorkingProps) {
|
|
90
|
+
const still = useReduceMotion()
|
|
91
|
+
return (
|
|
92
|
+
<div role="status" className="flex items-center gap-2">
|
|
93
|
+
<span className="sr-only">Thinking…</span>
|
|
94
|
+
<GooDots still={still} />
|
|
95
|
+
<CyclingWord still={still} />
|
|
96
|
+
{label && <span className="text-caption text-muted-foreground">{label}</span>}
|
|
97
|
+
</div>
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export type { WorkingProps }
|
|
102
|
+
export { Working }
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import Reasoning from './index'
|
|
2
|
+
|
|
3
|
+
# Folded
|
|
4
|
+
|
|
5
|
+
Press the row to read the reasoning.
|
|
6
|
+
|
|
7
|
+
<div className="w-full max-w-2xl">
|
|
8
|
+
<Reasoning duration="8s">
|
|
9
|
+
<p className="m-0">Pages render as example cards, so each screen is a page item with a framed example per state.</p>
|
|
10
|
+
<p className="m-0">Blocks carry the reusable parts; the pages only assemble them.</p>
|
|
11
|
+
</Reasoning>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
# Open
|
|
15
|
+
|
|
16
|
+
Starts unfolded.
|
|
17
|
+
|
|
18
|
+
<div className="w-full max-w-2xl">
|
|
19
|
+
<Reasoning duration="2s" defaultOpen>
|
|
20
|
+
<p className="m-0">The hover fill already reaches into the margin, so the label stays flush with the text.</p>
|
|
21
|
+
</Reasoning>
|
|
22
|
+
</div>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Local addition (not part of Fluid Functionalism): a model's reasoning,
|
|
3
|
+
* folded to one "Thought for 8s" row on an Accordion. Generalised from the AI
|
|
4
|
+
* app's transcript.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use client'
|
|
8
|
+
|
|
9
|
+
import Accordion from '@justanarthur/modo-ui/components/containers/accordion'
|
|
10
|
+
import type { ReactNode } from 'react'
|
|
11
|
+
|
|
12
|
+
interface ReasoningProps {
|
|
13
|
+
/** How long it thought, shown in the row: `"12s"`. */
|
|
14
|
+
duration: string
|
|
15
|
+
/** The reasoning text, folded until opened. */
|
|
16
|
+
children: ReactNode
|
|
17
|
+
/** Start unfolded. Defaults to `false`. */
|
|
18
|
+
defaultOpen?: boolean
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The reasoning behind a reply, folded to one row: "Thought for 12s".
|
|
23
|
+
*
|
|
24
|
+
* Press the row and the reasoning morphs out of it (see Accordion), set in
|
|
25
|
+
* the muted color behind a hairline so it reads as an aside, not the answer.
|
|
26
|
+
* The row sits flush with the text around it: its hover fill reaches into
|
|
27
|
+
* the margin instead of indenting the label.
|
|
28
|
+
*
|
|
29
|
+
* @example {@include ./examples.mdx}
|
|
30
|
+
*/
|
|
31
|
+
function Reasoning({ duration, children, defaultOpen = false }: ReasoningProps) {
|
|
32
|
+
return (
|
|
33
|
+
<Accordion
|
|
34
|
+
type="single"
|
|
35
|
+
collapsible
|
|
36
|
+
defaultValue={defaultOpen ? 'reasoning' : undefined}
|
|
37
|
+
className="-mx-3 w-auto max-w-none"
|
|
38
|
+
>
|
|
39
|
+
<Accordion.Item value="reasoning">
|
|
40
|
+
<Accordion.Trigger>Thought for {duration}</Accordion.Trigger>
|
|
41
|
+
<Accordion.Content>
|
|
42
|
+
<div className="flex flex-col gap-2 border-l border-border pl-[var(--space-3)] text-body text-muted-foreground">
|
|
43
|
+
{children}
|
|
44
|
+
</div>
|
|
45
|
+
</Accordion.Content>
|
|
46
|
+
</Accordion.Item>
|
|
47
|
+
</Accordion>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export type { ReasoningProps }
|
|
52
|
+
export { Reasoning }
|
|
53
|
+
|
|
54
|
+
export default Reasoning
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import Recap from './index'
|
|
2
|
+
|
|
3
|
+
# With a decision
|
|
4
|
+
|
|
5
|
+
The question and its answers follow the recap, the recommendation first.
|
|
6
|
+
|
|
7
|
+
<div className="w-full max-w-2xl">
|
|
8
|
+
<Recap
|
|
9
|
+
recap="The five pages and six blocks are in and pass lint and the typecheck. Nothing is committed yet, and the narrow window is checked only in the docs frame."
|
|
10
|
+
ask="Commit on the branch?"
|
|
11
|
+
actions={['Commit', 'Not yet']}
|
|
12
|
+
/>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
# Recap only
|
|
16
|
+
|
|
17
|
+
Nothing waits on you, so there is no question.
|
|
18
|
+
|
|
19
|
+
<div className="w-full max-w-2xl">
|
|
20
|
+
<Recap recap="The parser keeps @values again and the test suite passes. The fix is committed on main." />
|
|
21
|
+
</div>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Local addition (not part of Fluid Functionalism): the box an AI closes its
|
|
3
|
+
* work with — a short recap and, when you have a decision to make, one
|
|
4
|
+
* question with its answers. Generalised from the AI app's transcript.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use client'
|
|
8
|
+
|
|
9
|
+
import Button from '@justanarthur/modo-ui/components/actions/button'
|
|
10
|
+
import { useShape } from '@justanarthur/modo-ui/lib/shape-context'
|
|
11
|
+
import { cn } from '@justanarthur/modo-ui/lib/utils'
|
|
12
|
+
import { useIcon } from '../../../lib/icons'
|
|
13
|
+
|
|
14
|
+
interface RecapProps {
|
|
15
|
+
/** Two or three sentences: what is now true, what is not done or not verified. */
|
|
16
|
+
recap: string
|
|
17
|
+
/** The one decision left to you, if any. */
|
|
18
|
+
ask?: string
|
|
19
|
+
/** One or two answers to `ask`; the first is the recommendation. Defaults to `[]`. */
|
|
20
|
+
actions?: string[]
|
|
21
|
+
/** Called with the picked answer. */
|
|
22
|
+
onAction?: (label: string) => void
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Where a piece of work landed: what changed, what is left, and the one
|
|
27
|
+
* decision that waits on you.
|
|
28
|
+
*
|
|
29
|
+
* The recap reads in the muted color on the muted fill. With an `ask`, the
|
|
30
|
+
* question follows in medium weight with up to two answers beside it, the
|
|
31
|
+
* recommendation first as the primary button. Without one it is the recap
|
|
32
|
+
* alone: nothing waits on you.
|
|
33
|
+
*
|
|
34
|
+
* @example {@include ./examples.mdx}
|
|
35
|
+
*/
|
|
36
|
+
function Recap({ recap, ask, actions = [], onAction }: RecapProps) {
|
|
37
|
+
const shape = useShape()
|
|
38
|
+
const Flag = useIcon('corner-down-right')
|
|
39
|
+
return (
|
|
40
|
+
<section aria-label="Recap" className={cn('flex flex-col gap-3 bg-muted p-[var(--space-3)]', shape.container)}>
|
|
41
|
+
<p className="m-0 text-body text-muted-foreground">{recap}</p>
|
|
42
|
+
{ask && (
|
|
43
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
44
|
+
<Flag size={16} strokeWidth={1.5} className="shrink-0 text-muted-foreground" />
|
|
45
|
+
<span className="min-w-0 flex-1 text-body weight-medium text-foreground">{ask}</span>
|
|
46
|
+
<div className="flex shrink-0 gap-2">
|
|
47
|
+
{actions.slice(0, 2).map((label, i) => (
|
|
48
|
+
<Button
|
|
49
|
+
key={label}
|
|
50
|
+
size="compact"
|
|
51
|
+
variant={i === 0 ? 'primary' : 'tertiary'}
|
|
52
|
+
onClick={() => onAction?.(label)}
|
|
53
|
+
>
|
|
54
|
+
{label}
|
|
55
|
+
</Button>
|
|
56
|
+
))}
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
)}
|
|
60
|
+
</section>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type { RecapProps }
|
|
65
|
+
export { Recap }
|
|
66
|
+
|
|
67
|
+
export default Recap
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import TodoList from './index'
|
|
2
|
+
|
|
3
|
+
# Plan
|
|
4
|
+
|
|
5
|
+
Done steps take a check, the step in progress turns, the rest wait on a ring.
|
|
6
|
+
|
|
7
|
+
<div className="w-full max-w-2xl">
|
|
8
|
+
<TodoList
|
|
9
|
+
items={[
|
|
10
|
+
{ content: 'Read the design rules and the craft page', status: 'completed' },
|
|
11
|
+
{ content: 'Add Meter and Diff components', status: 'completed' },
|
|
12
|
+
{ content: 'Assemble the pages', status: 'in_progress' },
|
|
13
|
+
{ content: 'Lint, typecheck, check both themes', status: 'pending' },
|
|
14
|
+
]}
|
|
15
|
+
/>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
# Folded
|
|
19
|
+
|
|
20
|
+
Folded to one row, the header names the step in progress.
|
|
21
|
+
|
|
22
|
+
<div className="w-full max-w-2xl">
|
|
23
|
+
<TodoList
|
|
24
|
+
defaultOpen={false}
|
|
25
|
+
title="Plan"
|
|
26
|
+
items={[
|
|
27
|
+
{ content: 'Draft the migration', status: 'completed' },
|
|
28
|
+
{ content: 'Run it on staging', status: 'in_progress' },
|
|
29
|
+
{ content: 'Run it on production', status: 'pending' },
|
|
30
|
+
]}
|
|
31
|
+
/>
|
|
32
|
+
</div>
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Local addition (not part of Fluid Functionalism): an AI's plan for the task
|
|
3
|
+
* at hand, pinned under the conversation, with the step in progress turning.
|
|
4
|
+
* Folds to one row. Generalised from the AI app's transcript.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use client'
|
|
8
|
+
|
|
9
|
+
import Button from '@justanarthur/modo-ui/components/actions/button'
|
|
10
|
+
import { Spinner } from '@justanarthur/modo-ui/components/feedback/progress'
|
|
11
|
+
import { useShape } from '@justanarthur/modo-ui/lib/shape-context'
|
|
12
|
+
import { cn } from '@justanarthur/modo-ui/lib/utils'
|
|
13
|
+
import { useState } from 'react'
|
|
14
|
+
import { useIcon } from '../../../lib/icons'
|
|
15
|
+
|
|
16
|
+
type TodoStatus = 'pending' | 'in_progress' | 'completed'
|
|
17
|
+
|
|
18
|
+
interface TodoItem {
|
|
19
|
+
/** The step, in a few words. */
|
|
20
|
+
content: string
|
|
21
|
+
/** Where it stands. */
|
|
22
|
+
status: TodoStatus
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface TodoListProps {
|
|
26
|
+
/** The plan, in order. */
|
|
27
|
+
items: TodoItem[]
|
|
28
|
+
/** The header's label. Defaults to `'Tasks'`. */
|
|
29
|
+
title?: string
|
|
30
|
+
/** Start with every step showing; folded, the header names the step in progress. Defaults to `true`. */
|
|
31
|
+
defaultOpen?: boolean
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* An AI's plan, pinned where you can see it: every step, done, in progress
|
|
36
|
+
* or still to come.
|
|
37
|
+
*
|
|
38
|
+
* Done steps take a check and the muted color, the step in progress the
|
|
39
|
+
* Spinner and medium weight, the steps to come an empty ring. The header
|
|
40
|
+
* counts the done steps; its chevron folds the list to that one row, which
|
|
41
|
+
* then names the step in progress.
|
|
42
|
+
*
|
|
43
|
+
* @example {@include ./examples.mdx}
|
|
44
|
+
*/
|
|
45
|
+
function TodoList({ items, title = 'Tasks', defaultOpen = true }: TodoListProps) {
|
|
46
|
+
const shape = useShape()
|
|
47
|
+
const [open, setOpen] = useState(defaultOpen)
|
|
48
|
+
const Check = useIcon('check')
|
|
49
|
+
const Chevron = useIcon('chevron-up')
|
|
50
|
+
const done = items.filter(i => i.status === 'completed').length
|
|
51
|
+
const current = items.find(i => i.status === 'in_progress')
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<section
|
|
55
|
+
aria-label={title}
|
|
56
|
+
className={cn('flex flex-col gap-1 border border-border p-[var(--space-3)]', shape.container)}
|
|
57
|
+
>
|
|
58
|
+
<div className="flex min-w-0 items-center gap-2 text-caption">
|
|
59
|
+
<span className="shrink-0 weight-medium text-foreground">{title}</span>
|
|
60
|
+
{!open && current && <span className="min-w-0 truncate text-muted-foreground">{current.content}</span>}
|
|
61
|
+
<span className="ml-auto shrink-0 tabular-nums text-muted-foreground">
|
|
62
|
+
{done} of {items.length}
|
|
63
|
+
</span>
|
|
64
|
+
<Button
|
|
65
|
+
variant="ghost"
|
|
66
|
+
size="icon-compact"
|
|
67
|
+
aria-label={open ? 'Fold the list' : 'Show every step'}
|
|
68
|
+
aria-expanded={open}
|
|
69
|
+
className="-mr-1.5 size-6"
|
|
70
|
+
onClick={() => setOpen(!open)}
|
|
71
|
+
>
|
|
72
|
+
<Chevron className={cn('transition-transform duration-fast', !open && 'rotate-180')} />
|
|
73
|
+
</Button>
|
|
74
|
+
</div>
|
|
75
|
+
<ol className={cn('m-0 flex flex-col p-0', !open && 'hidden')}>
|
|
76
|
+
{items.map(item => (
|
|
77
|
+
<li key={item.content} className="flex min-h-6 items-center gap-2 text-body">
|
|
78
|
+
<span className="flex size-4 shrink-0 items-center justify-center">
|
|
79
|
+
{item.status === 'in_progress' ? (
|
|
80
|
+
<Spinner className="size-3.5" />
|
|
81
|
+
) : item.status === 'completed' ? (
|
|
82
|
+
<Check size={14} strokeWidth={2} className="text-muted-foreground" />
|
|
83
|
+
) : (
|
|
84
|
+
<span className="size-2.5 rounded-full border border-muted-foreground" />
|
|
85
|
+
)}
|
|
86
|
+
</span>
|
|
87
|
+
<span
|
|
88
|
+
className={cn(
|
|
89
|
+
'min-w-0 truncate',
|
|
90
|
+
item.status === 'in_progress' ? 'weight-medium text-foreground' : 'text-muted-foreground',
|
|
91
|
+
item.status === 'pending' && 'text-foreground',
|
|
92
|
+
)}
|
|
93
|
+
>
|
|
94
|
+
{item.content}
|
|
95
|
+
</span>
|
|
96
|
+
</li>
|
|
97
|
+
))}
|
|
98
|
+
</ol>
|
|
99
|
+
</section>
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export type { TodoItem, TodoListProps, TodoStatus }
|
|
104
|
+
export { TodoList }
|
|
105
|
+
|
|
106
|
+
export default TodoList
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import ToolCall from './index'
|
|
2
|
+
import Diff from '@justanarthur/modo-ui/components/data-display/diff'
|
|
3
|
+
import Code from '@justanarthur/modo-ui/primitives/content/code'
|
|
4
|
+
|
|
5
|
+
# Run of calls
|
|
6
|
+
|
|
7
|
+
One hover highlight runs down the run; each call with output opens in place. An Edit shows its diff, a shell call its output.
|
|
8
|
+
|
|
9
|
+
<div className="w-full max-w-2xl">
|
|
10
|
+
<ToolCall.Group defaultValue={['edit']}>
|
|
11
|
+
<ToolCall index={0} value="read" tool="Read" summary="ui/components/data-display/badge/index.tsx" meta="214 lines" />
|
|
12
|
+
<ToolCall index={1} value="edit" tool="Edit" summary="ui/components/data-display/badge/index.tsx" meta="+1 −1">
|
|
13
|
+
<Diff lineNumbers={false} patch={`@@ -56,3 +56,3 @@
|
|
14
|
+
-const badgeVariants = cva('inline-flex items-center', {
|
|
15
|
+
+const badgeVariants = cva('inline-flex items-center weight-medium', {
|
|
16
|
+
variants: {`} />
|
|
17
|
+
</ToolCall>
|
|
18
|
+
<ToolCall index={2} value="lint" tool="Bash" summary="bun run lint" meta="exit 0">
|
|
19
|
+
<Code language="sh">{'Checked 412 files in 180ms. No fixes applied.'}</Code>
|
|
20
|
+
</ToolCall>
|
|
21
|
+
</ToolCall.Group>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
# States
|
|
25
|
+
|
|
26
|
+
Running turns the Spinner, waiting shows the warning dot, a failed or denied call its mark.
|
|
27
|
+
|
|
28
|
+
<div className="w-full max-w-2xl">
|
|
29
|
+
<ToolCall.Group>
|
|
30
|
+
<ToolCall index={0} value="test" tool="Bash" summary="bun run test" status="error" meta="exit 1">
|
|
31
|
+
<Code language="sh">{'✗ parser › keeps @values\n Expected: "a, b"\n Received: undefined'}</Code>
|
|
32
|
+
</ToolCall>
|
|
33
|
+
<ToolCall index={1} value="write" tool="Write" summary="ui/components/data-display/badge/badge.test.ts" status="waiting" />
|
|
34
|
+
<ToolCall index={2} value="grep" tool="Grep" summary={'"@values" lib/src'} status="running" />
|
|
35
|
+
<ToolCall index={3} value="push" tool="Bash" summary="git push --force" status="denied" />
|
|
36
|
+
</ToolCall.Group>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
# Any tool
|
|
40
|
+
|
|
41
|
+
A name it doesn't know takes the `icon` you pass, else the wrench.
|
|
42
|
+
|
|
43
|
+
<div className="w-full max-w-2xl">
|
|
44
|
+
<ToolCall.Group>
|
|
45
|
+
<ToolCall index={0} value="calendar" tool="calendar.list_events" icon="calendar" summary="this week" meta="12 events" />
|
|
46
|
+
<ToolCall index={1} value="deploy" tool="deploy" summary="preview" meta="38s" />
|
|
47
|
+
</ToolCall.Group>
|
|
48
|
+
</div>
|