@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,142 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Local addition (not part of Fluid Functionalism): an AI's tool calls. A run
|
|
3
|
+
* of calls is one Accordion group, so one fluid hover highlight runs down it
|
|
4
|
+
* and each call's output morphs out of its row. Generalised from the AI app's
|
|
5
|
+
* transcript.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use client'
|
|
9
|
+
|
|
10
|
+
import Accordion from '@justanarthur/modo-ui/components/containers/accordion'
|
|
11
|
+
import { Spinner } from '@justanarthur/modo-ui/components/feedback/progress'
|
|
12
|
+
import { statusGlyph } from '@justanarthur/modo-ui/components/feedback/status-dot'
|
|
13
|
+
import type { ReactNode } from 'react'
|
|
14
|
+
import { type IconName, useIcon } from '../../../lib/icons'
|
|
15
|
+
|
|
16
|
+
type ToolCallStatus = 'running' | 'waiting' | 'done' | 'error' | 'denied'
|
|
17
|
+
|
|
18
|
+
// Common tool names, matched case-blind; anything else takes `icon` or the wrench.
|
|
19
|
+
const TOOL_ICON: Partial<Record<string, IconName>> = {
|
|
20
|
+
bash: 'terminal',
|
|
21
|
+
shell: 'terminal',
|
|
22
|
+
terminal: 'terminal',
|
|
23
|
+
read: 'file-text',
|
|
24
|
+
edit: 'pen-line',
|
|
25
|
+
write: 'file-plus',
|
|
26
|
+
grep: 'search',
|
|
27
|
+
search: 'search',
|
|
28
|
+
glob: 'folder-open',
|
|
29
|
+
fetch: 'globe',
|
|
30
|
+
webfetch: 'globe',
|
|
31
|
+
websearch: 'globe',
|
|
32
|
+
agent: 'bot',
|
|
33
|
+
mcp: 'plug',
|
|
34
|
+
todowrite: 'list-checks',
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const Waiting = statusGlyph('waiting')
|
|
38
|
+
|
|
39
|
+
interface ToolStatusMarkProps {
|
|
40
|
+
/** Where the call stands; `done` shows nothing. */
|
|
41
|
+
status: ToolCallStatus
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** A call's state at the end of its row: the Spinner, the waiting dot, or the failed and denied marks. */
|
|
45
|
+
function ToolStatusMark({ status }: ToolStatusMarkProps) {
|
|
46
|
+
const Failed = useIcon('circle-x')
|
|
47
|
+
const Denied = useIcon('ban')
|
|
48
|
+
if (status === 'running') return <Spinner className="size-3.5" />
|
|
49
|
+
if (status === 'waiting') return <Waiting size={14} />
|
|
50
|
+
if (status === 'error')
|
|
51
|
+
return <Failed size={14} strokeWidth={1.5} aria-label="Failed" className="shrink-0 text-status-error" />
|
|
52
|
+
if (status === 'denied')
|
|
53
|
+
return <Denied size={14} strokeWidth={1.5} aria-label="Denied" className="shrink-0 text-muted-foreground" />
|
|
54
|
+
return null
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
interface ToolCallGroupProps {
|
|
58
|
+
/** The calls, `ToolCall`s each with its `index`. */
|
|
59
|
+
children: ReactNode
|
|
60
|
+
/** Calls open at first, by `value`. */
|
|
61
|
+
defaultValue?: string[]
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** A run of tool calls: one hover highlight down the run, each call folds open in place. */
|
|
65
|
+
function ToolCallGroup({ children, defaultValue }: ToolCallGroupProps) {
|
|
66
|
+
return (
|
|
67
|
+
<Accordion.Group type="multiple" defaultValue={defaultValue} size="compact" className="-mx-2.5 w-auto max-w-none">
|
|
68
|
+
{children}
|
|
69
|
+
</Accordion.Group>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
interface ToolCallProps {
|
|
74
|
+
/** The tool's name, shown in the row; a common one (Bash, Read, Edit, Grep, Fetch…) picks its glyph. */
|
|
75
|
+
tool: string
|
|
76
|
+
/** Its main argument: a command, a path, a pattern. */
|
|
77
|
+
summary: string
|
|
78
|
+
/** Its key, unique in the run. */
|
|
79
|
+
value: string
|
|
80
|
+
/** Its place in the run, from 0, for the shared hover. */
|
|
81
|
+
index: number
|
|
82
|
+
/** The glyph, for a tool the name doesn't match. Defaults to the name's glyph, else `'wrench'`. */
|
|
83
|
+
icon?: IconName
|
|
84
|
+
/** Where it stands. Defaults to `'done'`. */
|
|
85
|
+
status?: ToolCallStatus
|
|
86
|
+
/** A short result on the right: `+12 −3`, `42 lines`, `exit 1`. */
|
|
87
|
+
meta?: ReactNode
|
|
88
|
+
/** The output, folded until opened: a Diff, Code, terminal text. */
|
|
89
|
+
children?: ReactNode
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* One tool call an AI made: its glyph, name and argument in one row, the
|
|
94
|
+
* output folded inside.
|
|
95
|
+
*
|
|
96
|
+
* Calls come in runs: a `ToolCall.Group` shares one fluid hover highlight
|
|
97
|
+
* down the run, and each call with output opens in place, its output (a
|
|
98
|
+
* Diff, a Code block, terminal text) morphing out of the row. A call without
|
|
99
|
+
* output doesn't open. The end of the row carries a short result (`+3 −1`,
|
|
100
|
+
* `exit 1`) and the call's state: the Spinner while it runs, the warning dot
|
|
101
|
+
* while it waits on you, a mark when it failed or was denied, nothing once
|
|
102
|
+
* it's done. The run is a compact region, and its rows reach into the margin
|
|
103
|
+
* so the labels stay flush with the text around them.
|
|
104
|
+
*
|
|
105
|
+
* Statics:
|
|
106
|
+
* - `ToolCall.Group` — a run of calls: `defaultValue` opens some.
|
|
107
|
+
*
|
|
108
|
+
* @example {@include ./examples.mdx}
|
|
109
|
+
*/
|
|
110
|
+
const ToolCall = Object.assign(
|
|
111
|
+
function ToolCall({ tool, summary, value, index, icon, status = 'done', meta, children }: ToolCallProps) {
|
|
112
|
+
const Icon = useIcon(icon ?? TOOL_ICON[tool.toLowerCase()] ?? 'wrench')
|
|
113
|
+
return (
|
|
114
|
+
<Accordion.Item value={value} index={index} disabled={!children}>
|
|
115
|
+
<Accordion.Trigger className="[&>span:first-child]:min-w-0">
|
|
116
|
+
<span className="flex min-w-0 items-center gap-2">
|
|
117
|
+
<Icon size={14} strokeWidth={1.5} className="shrink-0" />
|
|
118
|
+
<span className="shrink-0">{tool}</span>
|
|
119
|
+
<span className="min-w-0 truncate font-mono text-caption-compact weight-normal text-muted-foreground">
|
|
120
|
+
{summary}
|
|
121
|
+
</span>
|
|
122
|
+
{meta && (
|
|
123
|
+
<span className="ml-auto shrink-0 text-caption-compact weight-normal text-muted-foreground">{meta}</span>
|
|
124
|
+
)}
|
|
125
|
+
<ToolStatusMark status={status} />
|
|
126
|
+
</span>
|
|
127
|
+
</Accordion.Trigger>
|
|
128
|
+
{children && (
|
|
129
|
+
<Accordion.Content>
|
|
130
|
+
<div className="pb-2">{children}</div>
|
|
131
|
+
</Accordion.Content>
|
|
132
|
+
)}
|
|
133
|
+
</Accordion.Item>
|
|
134
|
+
)
|
|
135
|
+
},
|
|
136
|
+
{ Group: ToolCallGroup },
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
export type { ToolCallGroupProps, ToolCallProps, ToolCallStatus, ToolStatusMarkProps }
|
|
140
|
+
export { ToolCall, ToolCallGroup, ToolStatusMark }
|
|
141
|
+
|
|
142
|
+
export default ToolCall
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import WorkSummary from './index'
|
|
2
|
+
import Reasoning from '../reasoning'
|
|
3
|
+
import ToolCall from '../tool-call'
|
|
4
|
+
|
|
5
|
+
# Folded work
|
|
6
|
+
|
|
7
|
+
Press the row: the reasoning and the calls are inside.
|
|
8
|
+
|
|
9
|
+
<div className="w-full max-w-2xl">
|
|
10
|
+
<WorkSummary summary="Worked for 52s" detail="Thought 8s · 2 reads">
|
|
11
|
+
<Reasoning duration="8s">
|
|
12
|
+
<p className="m-0">The rules live in DESIGN.md; the craft page shows them as pairs.</p>
|
|
13
|
+
</Reasoning>
|
|
14
|
+
<ToolCall.Group>
|
|
15
|
+
<ToolCall index={0} value="design" tool="Read" summary="ui/DESIGN.md" meta="543 lines" />
|
|
16
|
+
<ToolCall index={1} value="agents" tool="Read" summary="ui/AGENTS.md" meta="81 lines" />
|
|
17
|
+
</ToolCall.Group>
|
|
18
|
+
</WorkSummary>
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
# Running
|
|
22
|
+
|
|
23
|
+
While the turn runs, the Spinner turns in the row.
|
|
24
|
+
|
|
25
|
+
<div className="w-full max-w-2xl">
|
|
26
|
+
<WorkSummary summary="Working…" detail="bun run check" running>
|
|
27
|
+
<ToolCall.Group>
|
|
28
|
+
<ToolCall index={0} value="check" tool="Bash" summary="bun run check" status="running" />
|
|
29
|
+
</ToolCall.Group>
|
|
30
|
+
</WorkSummary>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
# Show all
|
|
34
|
+
|
|
35
|
+
A provider set `open` unfolds every turn's work at once.
|
|
36
|
+
|
|
37
|
+
<div className="flex w-full max-w-2xl flex-col gap-2">
|
|
38
|
+
<WorkSummary.Provider open>
|
|
39
|
+
<WorkSummary summary="Worked for 12s" detail="1 search">
|
|
40
|
+
<ToolCall.Group>
|
|
41
|
+
<ToolCall index={0} value="grep" tool="Grep" summary={'"useMorph" ui/'} meta="14 files" />
|
|
42
|
+
</ToolCall.Group>
|
|
43
|
+
</WorkSummary>
|
|
44
|
+
<WorkSummary summary="Worked for 4s" detail="1 edit">
|
|
45
|
+
<ToolCall.Group>
|
|
46
|
+
<ToolCall index={0} value="edit" tool="Edit" summary="ui/components/data-display/badge/index.tsx" meta="+1 −1" />
|
|
47
|
+
</ToolCall.Group>
|
|
48
|
+
</WorkSummary>
|
|
49
|
+
</WorkSummary.Provider>
|
|
50
|
+
</div>
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Local addition (not part of Fluid Functionalism): an AI turn's work folded
|
|
3
|
+
* to one row ("Worked for 52s · 4 tool calls") on an Accordion, with a
|
|
4
|
+
* provider that opens every fold at once. Generalised from the AI app's
|
|
5
|
+
* transcript.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use client'
|
|
9
|
+
|
|
10
|
+
import Accordion from '@justanarthur/modo-ui/components/containers/accordion'
|
|
11
|
+
import { Spinner } from '@justanarthur/modo-ui/components/feedback/progress'
|
|
12
|
+
import { createContext, type ReactNode, useContext } from 'react'
|
|
13
|
+
|
|
14
|
+
const ShowWorkContext = createContext(false)
|
|
15
|
+
|
|
16
|
+
interface WorkSummaryProviderProps {
|
|
17
|
+
/** Unfold every `WorkSummary` inside; switching it re-folds or re-opens them all. */
|
|
18
|
+
open: boolean
|
|
19
|
+
/** The conversation. */
|
|
20
|
+
children: ReactNode
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Opens or folds every WorkSummary inside at once: a "show work" toggle. */
|
|
24
|
+
function WorkSummaryProvider({ open, children }: WorkSummaryProviderProps) {
|
|
25
|
+
return <ShowWorkContext.Provider value={open}>{children}</ShowWorkContext.Provider>
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface WorkSummaryProps {
|
|
29
|
+
/** How long the turn worked: `"Worked for 52s"`, `"Working…"`. */
|
|
30
|
+
summary: string
|
|
31
|
+
/** What it did, in a few words: `"4 tool calls · 1 agent"`. */
|
|
32
|
+
detail?: string
|
|
33
|
+
/** Still working: the Spinner turns in the row. Defaults to `false`. */
|
|
34
|
+
running?: boolean
|
|
35
|
+
/** The reasoning, tool calls and agent runs. */
|
|
36
|
+
children: ReactNode
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* What an AI did on the way to a reply, folded to one row: "Worked for 52s ·
|
|
41
|
+
* 4 tool calls".
|
|
42
|
+
*
|
|
43
|
+
* The reasoning, tool calls and agent runs of a turn go inside, so the
|
|
44
|
+
* conversation reads as what was asked and what came out. Press the row and
|
|
45
|
+
* the work morphs out of it behind a hairline; while the turn runs, the
|
|
46
|
+
* Spinner turns in the row. Wrap the conversation in a `WorkSummary.Provider`
|
|
47
|
+
* to open or fold every turn's work at once, a "show work" toggle.
|
|
48
|
+
*
|
|
49
|
+
* Statics:
|
|
50
|
+
* - `WorkSummary.Provider` — opens every fold inside: `open`.
|
|
51
|
+
*
|
|
52
|
+
* @example {@include ./examples.mdx}
|
|
53
|
+
*/
|
|
54
|
+
const WorkSummary = Object.assign(
|
|
55
|
+
function WorkSummary({ summary, detail, running = false, children }: WorkSummaryProps) {
|
|
56
|
+
const showWork = useContext(ShowWorkContext)
|
|
57
|
+
return (
|
|
58
|
+
<Accordion
|
|
59
|
+
key={String(showWork)}
|
|
60
|
+
type="single"
|
|
61
|
+
collapsible
|
|
62
|
+
defaultValue={showWork ? 'work' : undefined}
|
|
63
|
+
size="compact"
|
|
64
|
+
className="-mx-2.5 w-auto max-w-none"
|
|
65
|
+
>
|
|
66
|
+
<Accordion.Item value="work">
|
|
67
|
+
<Accordion.Trigger className="[&>span:first-child]:min-w-0">
|
|
68
|
+
<span className="flex min-w-0 items-center gap-2">
|
|
69
|
+
{running && <Spinner className="size-3.5" />}
|
|
70
|
+
<span className="shrink-0">{summary}</span>
|
|
71
|
+
{detail && <span className="min-w-0 truncate weight-normal text-muted-foreground">{detail}</span>}
|
|
72
|
+
</span>
|
|
73
|
+
</Accordion.Trigger>
|
|
74
|
+
<Accordion.Content>
|
|
75
|
+
<div className="flex flex-col gap-2 border-l border-border pb-1 pl-[var(--space-3)]">{children}</div>
|
|
76
|
+
</Accordion.Content>
|
|
77
|
+
</Accordion.Item>
|
|
78
|
+
</Accordion>
|
|
79
|
+
)
|
|
80
|
+
},
|
|
81
|
+
{ Provider: WorkSummaryProvider },
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
export type { WorkSummaryProps, WorkSummaryProviderProps }
|
|
85
|
+
export { WorkSummary, WorkSummaryProvider }
|
|
86
|
+
|
|
87
|
+
export default WorkSummary
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import PermissionRequest from './index'
|
|
2
|
+
import Diff from '@justanarthur/modo-ui/components/data-display/diff'
|
|
3
|
+
|
|
4
|
+
# Command
|
|
5
|
+
|
|
6
|
+
A tool wants to run. The command reads first; Always allow names the rule it would add.
|
|
7
|
+
|
|
8
|
+
<div className="w-full max-w-2xl">
|
|
9
|
+
<PermissionRequest tool="Bash" command="rm -rf .worktrees/old-toast && git worktree prune" rule="git worktree *" />
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
# With a diff
|
|
13
|
+
|
|
14
|
+
An edit asks with the change it would make, as a `detail` under the path.
|
|
15
|
+
|
|
16
|
+
<div className="w-full max-w-2xl">
|
|
17
|
+
<PermissionRequest
|
|
18
|
+
tool="Edit"
|
|
19
|
+
command="ui/uno.config.ts"
|
|
20
|
+
detail={<Diff lineNumbers={false} patch={`@@ -25,1 +25,1 @@
|
|
21
|
+
-const sources = resolve(root, '{lib,primitives,components,blocks}/**/*.{ts,tsx,mdx}')
|
|
22
|
+
+const sources = resolve(root, '{lib,primitives,components,blocks,pages}/**/*.{ts,tsx,mdx}')`} />}
|
|
23
|
+
/>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
# Custom hint
|
|
27
|
+
|
|
28
|
+
`hint` says who asks and which keys answer.
|
|
29
|
+
|
|
30
|
+
<div className="w-full max-w-2xl">
|
|
31
|
+
<PermissionRequest tool="WebFetch" command="https://registry.npmjs.org/@base-ui/react" hint="Asked by the sandbox · Esc denies" />
|
|
32
|
+
</div>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Local addition (not part of Fluid Functionalism): an agent's tool asks to
|
|
3
|
+
* run — the command first, then allow once, always allow a rule, or deny.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use client'
|
|
7
|
+
|
|
8
|
+
import Button from '@justanarthur/modo-ui/components/actions/button'
|
|
9
|
+
import Code from '@justanarthur/modo-ui/primitives/content/code'
|
|
10
|
+
import type { ReactNode } from 'react'
|
|
11
|
+
import PromptCard from '../prompt-card'
|
|
12
|
+
|
|
13
|
+
type PermissionAnswer = 'once' | 'always' | 'deny'
|
|
14
|
+
|
|
15
|
+
interface PermissionRequestProps {
|
|
16
|
+
/** The tool asking: `Bash`, `Edit`, an MCP tool. */
|
|
17
|
+
tool: string
|
|
18
|
+
/** What it would run: the command, the path. */
|
|
19
|
+
command: string
|
|
20
|
+
/** More of what it would do, under the command: a Diff for an edit. */
|
|
21
|
+
detail?: ReactNode
|
|
22
|
+
/** The rule "Always allow" would add, after its label. */
|
|
23
|
+
rule?: string
|
|
24
|
+
/** A muted hint on the bottom row: who asks, the keys. Defaults to `'Esc denies'`. */
|
|
25
|
+
hint?: ReactNode
|
|
26
|
+
/** Called with the answer. */
|
|
27
|
+
onAnswer?: (answer: PermissionAnswer) => void
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* A tool asks for permission to run.
|
|
32
|
+
*
|
|
33
|
+
* The card names the tool and shows what it would run as a code block, with
|
|
34
|
+
* an optional detail under it (a Diff for an edit). The answers sit on the
|
|
35
|
+
* bottom row, the safest first: deny, always allow the `rule`, or allow once.
|
|
36
|
+
*
|
|
37
|
+
* @example {@include ./examples.mdx}
|
|
38
|
+
*/
|
|
39
|
+
export default function PermissionRequest({
|
|
40
|
+
tool,
|
|
41
|
+
command,
|
|
42
|
+
detail,
|
|
43
|
+
rule,
|
|
44
|
+
hint = 'Esc denies',
|
|
45
|
+
onAnswer,
|
|
46
|
+
}: PermissionRequestProps) {
|
|
47
|
+
return (
|
|
48
|
+
<PromptCard
|
|
49
|
+
icon="shield-check"
|
|
50
|
+
title={`Allow ${tool} to run this?`}
|
|
51
|
+
tag={tool}
|
|
52
|
+
hint={hint}
|
|
53
|
+
actions={
|
|
54
|
+
<>
|
|
55
|
+
<Button size="compact" variant="ghost" onClick={() => onAnswer?.('deny')}>
|
|
56
|
+
Deny
|
|
57
|
+
</Button>
|
|
58
|
+
<Button size="compact" variant="tertiary" onClick={() => onAnswer?.('always')}>
|
|
59
|
+
Always allow{rule ? ` ${rule}` : ''}
|
|
60
|
+
</Button>
|
|
61
|
+
<Button size="compact" onClick={() => onAnswer?.('once')}>
|
|
62
|
+
Allow once
|
|
63
|
+
</Button>
|
|
64
|
+
</>
|
|
65
|
+
}
|
|
66
|
+
>
|
|
67
|
+
<Code language="sh">{command}</Code>
|
|
68
|
+
{detail}
|
|
69
|
+
</PromptCard>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export type { PermissionAnswer, PermissionRequestProps }
|
|
74
|
+
export { PermissionRequest }
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import PlanApproval from './index'
|
|
2
|
+
|
|
3
|
+
# Plan
|
|
4
|
+
|
|
5
|
+
Approve with edits accepted, approve and review each edit, or keep planning with feedback.
|
|
6
|
+
|
|
7
|
+
<div className="w-full max-w-2xl">
|
|
8
|
+
<PlanApproval>
|
|
9
|
+
<h3 className="m-0">AI app screens</h3>
|
|
10
|
+
<ol className="m-0">
|
|
11
|
+
<li>Add <code>Meter</code> and <code>Diff</code> to the components.</li>
|
|
12
|
+
<li>Build six blocks under <code>blocks/AI</code>.</li>
|
|
13
|
+
<li>Assemble five pages under <code>pages/AI</code>.</li>
|
|
14
|
+
<li>Lint, typecheck, check light, dark and a narrow window.</li>
|
|
15
|
+
</ol>
|
|
16
|
+
</PlanApproval>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
# Long plan
|
|
20
|
+
|
|
21
|
+
A plan taller than the frame scrolls inside it, fading at the edges.
|
|
22
|
+
|
|
23
|
+
<div className="w-full max-w-2xl">
|
|
24
|
+
<PlanApproval title="Approve the migration plan?" tag="Review">
|
|
25
|
+
<h3 className="m-0">Move auth to sessions</h3>
|
|
26
|
+
<p className="m-0">Tokens stay valid until they expire; new sign-ins get a session cookie.</p>
|
|
27
|
+
<ol className="m-0">
|
|
28
|
+
<li>Add a <code>sessions</code> table with an expiry index.</li>
|
|
29
|
+
<li>Issue the cookie on sign-in, behind a flag.</li>
|
|
30
|
+
<li>Read either credential in the middleware.</li>
|
|
31
|
+
<li>Backfill sessions for active tokens.</li>
|
|
32
|
+
<li>Turn the flag on for staff, then everyone.</li>
|
|
33
|
+
<li>Drop token issuance after the longest expiry.</li>
|
|
34
|
+
<li>Remove the token path and the flag.</li>
|
|
35
|
+
</ol>
|
|
36
|
+
</PlanApproval>
|
|
37
|
+
</div>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Local addition (not part of Fluid Functionalism): an agent's plan, waiting
|
|
3
|
+
* for approval — the plan as prose, a feedback field and three decisions.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use client'
|
|
7
|
+
|
|
8
|
+
import Button from '@justanarthur/modo-ui/components/actions/button'
|
|
9
|
+
import { MarkdownProse } from '@justanarthur/modo-ui/components/data-display/markdown'
|
|
10
|
+
import Textarea from '@justanarthur/modo-ui/components/inputs/textarea'
|
|
11
|
+
import ScrollArea from '@justanarthur/modo-ui/primitives/layout/scroll-area'
|
|
12
|
+
import { type ReactNode, useState } from 'react'
|
|
13
|
+
import PromptCard from '../prompt-card'
|
|
14
|
+
|
|
15
|
+
type PlanDecision = 'auto' | 'review' | 'keep-planning'
|
|
16
|
+
|
|
17
|
+
interface PlanApprovalProps {
|
|
18
|
+
/** The plan, as rendered markdown. */
|
|
19
|
+
children: ReactNode
|
|
20
|
+
/** What is asked, in one line. Defaults to `'Ready to code? Here is the plan.'`. */
|
|
21
|
+
title?: ReactNode
|
|
22
|
+
/** A chip after the title. Defaults to `'Plan mode'`. */
|
|
23
|
+
tag?: string
|
|
24
|
+
/** The feedback field's placeholder. Defaults to `'Tell the agent what to change'`. */
|
|
25
|
+
placeholder?: string
|
|
26
|
+
/** Called with the decision and any feedback. */
|
|
27
|
+
onDecide?: (decision: PlanDecision, feedback: string) => void
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* A plan the agent wrote, waiting for your go-ahead.
|
|
32
|
+
*
|
|
33
|
+
* The plan reads as Prose in a scrolling frame that fades at its edges,
|
|
34
|
+
* with a feedback field under it. The decisions sit on the bottom row:
|
|
35
|
+
* keep planning with the feedback, approve and review each edit, or approve
|
|
36
|
+
* with edits accepted.
|
|
37
|
+
*
|
|
38
|
+
* @example {@include ./examples.mdx}
|
|
39
|
+
*/
|
|
40
|
+
export default function PlanApproval({
|
|
41
|
+
children,
|
|
42
|
+
title = 'Ready to code? Here is the plan.',
|
|
43
|
+
tag = 'Plan mode',
|
|
44
|
+
placeholder = 'Tell the agent what to change',
|
|
45
|
+
onDecide,
|
|
46
|
+
}: PlanApprovalProps) {
|
|
47
|
+
const [feedback, setFeedback] = useState('')
|
|
48
|
+
return (
|
|
49
|
+
<PromptCard
|
|
50
|
+
icon="list-checks"
|
|
51
|
+
title={title}
|
|
52
|
+
tag={tag}
|
|
53
|
+
actions={
|
|
54
|
+
<>
|
|
55
|
+
<Button size="compact" variant="ghost" onClick={() => onDecide?.('keep-planning', feedback)}>
|
|
56
|
+
Keep planning
|
|
57
|
+
</Button>
|
|
58
|
+
<Button size="compact" variant="tertiary" onClick={() => onDecide?.('review', feedback)}>
|
|
59
|
+
Approve, ask before edits
|
|
60
|
+
</Button>
|
|
61
|
+
<Button size="compact" onClick={() => onDecide?.('auto', feedback)}>
|
|
62
|
+
Approve, accept edits
|
|
63
|
+
</Button>
|
|
64
|
+
</>
|
|
65
|
+
}
|
|
66
|
+
>
|
|
67
|
+
<ScrollArea className="max-h-72 rounded-xl border border-border" viewportClassName="scroll-fade">
|
|
68
|
+
<MarkdownProse className="p-[var(--space-3)]">{children}</MarkdownProse>
|
|
69
|
+
</ScrollArea>
|
|
70
|
+
<Textarea minRows={1} maxRows={4} value={feedback} onValueChange={setFeedback} placeholder={placeholder} />
|
|
71
|
+
</PromptCard>
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export type { PlanApprovalProps, PlanDecision }
|
|
76
|
+
export { PlanApproval }
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import PromptCard from './index'
|
|
2
|
+
import Button from '@justanarthur/modo-ui/components/actions/button'
|
|
3
|
+
|
|
4
|
+
# Prompt
|
|
5
|
+
|
|
6
|
+
A glyph, the question and a chip, a line of body, then the hint and the answers.
|
|
7
|
+
|
|
8
|
+
<div className="w-full max-w-2xl">
|
|
9
|
+
<PromptCard
|
|
10
|
+
icon="message-circle"
|
|
11
|
+
title="Run the migration on the shared database?"
|
|
12
|
+
tag="Database"
|
|
13
|
+
hint="Esc cancels"
|
|
14
|
+
actions={
|
|
15
|
+
<>
|
|
16
|
+
<Button size="compact" variant="ghost">Cancel</Button>
|
|
17
|
+
<Button size="compact">Run it</Button>
|
|
18
|
+
</>
|
|
19
|
+
}
|
|
20
|
+
>
|
|
21
|
+
<p className="m-0 text-body text-muted-foreground">It adds two columns and backfills them; other sessions see the change at once.</p>
|
|
22
|
+
</PromptCard>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
# Title only
|
|
26
|
+
|
|
27
|
+
Without a body, hint or actions the card is one line: a notice the agent leaves while it waits.
|
|
28
|
+
|
|
29
|
+
<div className="w-full max-w-2xl">
|
|
30
|
+
<PromptCard icon="clock" title="Waiting for the build to finish" />
|
|
31
|
+
</div>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Local addition (not part of Fluid Functionalism): the lifted frame an
|
|
3
|
+
* agent's prompts share — two surface levels up with a popup's shadow, a
|
|
4
|
+
* glyph and one line of what is asked, the body, then hint and answers.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use client'
|
|
8
|
+
|
|
9
|
+
import Badge from '@justanarthur/modo-ui/components/data-display/badge'
|
|
10
|
+
import { useShape } from '@justanarthur/modo-ui/lib/shape-context'
|
|
11
|
+
import { cn } from '@justanarthur/modo-ui/lib/utils'
|
|
12
|
+
import Elevated from '@justanarthur/modo-ui/primitives/systems/surface'
|
|
13
|
+
import type { ReactNode } from 'react'
|
|
14
|
+
import { type IconName, useIcon } from '../../../lib/icons'
|
|
15
|
+
|
|
16
|
+
interface PromptCardProps {
|
|
17
|
+
/** What is asked, in one line. */
|
|
18
|
+
title: ReactNode
|
|
19
|
+
/** A glyph from the icon set for the kind of prompt. Defaults to `'circle-alert'`. */
|
|
20
|
+
icon?: IconName
|
|
21
|
+
/** A chip after the title: the tool, the question's topic. */
|
|
22
|
+
tag?: string
|
|
23
|
+
/** The prompt's body: what will run, the options, the plan. */
|
|
24
|
+
children?: ReactNode
|
|
25
|
+
/** The answers, on the bottom row, the recommended one last. */
|
|
26
|
+
actions?: ReactNode
|
|
27
|
+
/** A muted hint on the bottom row's left: keys, scope. */
|
|
28
|
+
hint?: ReactNode
|
|
29
|
+
/** Classes for the frame. */
|
|
30
|
+
className?: string
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A card for anything an agent stops to ask you mid-turn.
|
|
35
|
+
*
|
|
36
|
+
* The frame lifts two surface levels off whatever it sits on, with a
|
|
37
|
+
* popup's shadow, so a waiting prompt reads as the thing to answer next: a
|
|
38
|
+
* glyph and one line saying what is asked, an optional chip, the body, then
|
|
39
|
+
* a muted hint and the answers on the bottom row. Permission request,
|
|
40
|
+
* Question prompt and Plan approval are built on it.
|
|
41
|
+
*
|
|
42
|
+
* @example {@include ./examples.mdx}
|
|
43
|
+
*/
|
|
44
|
+
export default function PromptCard({
|
|
45
|
+
title,
|
|
46
|
+
icon = 'circle-alert',
|
|
47
|
+
tag,
|
|
48
|
+
children,
|
|
49
|
+
actions,
|
|
50
|
+
hint,
|
|
51
|
+
className,
|
|
52
|
+
}: PromptCardProps) {
|
|
53
|
+
const shape = useShape()
|
|
54
|
+
const Icon = useIcon(icon)
|
|
55
|
+
return (
|
|
56
|
+
<Elevated
|
|
57
|
+
offset={2}
|
|
58
|
+
shadowLevel={3}
|
|
59
|
+
className={cn('flex flex-col gap-3 p-[var(--space-3)]', shape.container, className)}
|
|
60
|
+
>
|
|
61
|
+
<div className="flex min-w-0 items-center gap-2">
|
|
62
|
+
<Icon size={16} strokeWidth={1.5} className="shrink-0 text-muted-foreground" />
|
|
63
|
+
<span className="min-w-0 text-body weight-medium text-foreground">{title}</span>
|
|
64
|
+
{tag && (
|
|
65
|
+
<Badge size="compact" color="gray" className="shrink-0">
|
|
66
|
+
{tag}
|
|
67
|
+
</Badge>
|
|
68
|
+
)}
|
|
69
|
+
</div>
|
|
70
|
+
{children}
|
|
71
|
+
{(actions || hint) && (
|
|
72
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
73
|
+
{hint && <span className="min-w-0 flex-1 text-caption text-muted-foreground">{hint}</span>}
|
|
74
|
+
<div className="ml-auto flex flex-wrap justify-end gap-2">{actions}</div>
|
|
75
|
+
</div>
|
|
76
|
+
)}
|
|
77
|
+
</Elevated>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export type { PromptCardProps }
|
|
82
|
+
export { PromptCard }
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import QuestionPrompt from './index'
|
|
2
|
+
|
|
3
|
+
# One answer
|
|
4
|
+
|
|
5
|
+
The pick's background melts between options, the arrow keys move it, and "Other" takes free text.
|
|
6
|
+
|
|
7
|
+
<div className="w-full max-w-2xl">
|
|
8
|
+
<QuestionPrompt
|
|
9
|
+
tag="Layout"
|
|
10
|
+
question="Where should the side panes open?"
|
|
11
|
+
options={[
|
|
12
|
+
{ label: 'Right of the transcript (Recommended)', description: 'One pane at a time, tabs on top' },
|
|
13
|
+
{ label: 'Below the transcript', description: 'Like an IDE panel; more room for wide diffs' },
|
|
14
|
+
{ label: 'In a separate window', description: 'For a second screen' },
|
|
15
|
+
]}
|
|
16
|
+
/>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
# Several answers
|
|
20
|
+
|
|
21
|
+
`multiSelect`: neighbouring picks melt into one run.
|
|
22
|
+
|
|
23
|
+
<div className="w-full max-w-2xl">
|
|
24
|
+
<QuestionPrompt
|
|
25
|
+
tag="Settings"
|
|
26
|
+
multiSelect
|
|
27
|
+
question="Which settings pages should the first build include?"
|
|
28
|
+
options={[{ label: 'MCP servers' }, { label: 'Hooks' }, { label: 'Skills and plugins' }, { label: 'Memory' }]}
|
|
29
|
+
/>
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
# With previews
|
|
33
|
+
|
|
34
|
+
Options with a `preview` show the picked one beside the list; on a narrow card the preview drops below.
|
|
35
|
+
|
|
36
|
+
<div className="w-full max-w-2xl">
|
|
37
|
+
<QuestionPrompt
|
|
38
|
+
tag="Sidebar"
|
|
39
|
+
question="How should a running session show in the sidebar?"
|
|
40
|
+
options={[
|
|
41
|
+
{ label: 'Turning arc', description: 'Leading glyph', preview: '◜ Design the AI app now\n• Canvas page and pages tier 3m\n○ TSDoc parser drops @values 1h' },
|
|
42
|
+
{ label: 'Badge', description: 'Trailing chip', preview: ' Design the AI app Running\n Canvas page and pages tier Waiting\n TSDoc parser drops @values' },
|
|
43
|
+
{ label: 'Row tint', description: 'Whole row', preview: '▒ Design the AI app ▒▒▒▒▒▒▒▒\n Canvas page and pages tier\n TSDoc parser drops @values' },
|
|
44
|
+
]}
|
|
45
|
+
/>
|
|
46
|
+
</div>
|