@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,274 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Local addition: the AI app's error and degraded states in one block — the
|
|
3
|
+
* claude process crashed, the connection is coming back, a profile hit its
|
|
4
|
+
* limit, the machine is offline, a sign-in expired. Each is a banner over
|
|
5
|
+
* the transcript or a full empty state, with the one action that gets the
|
|
6
|
+
* session going again.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
'use client'
|
|
10
|
+
|
|
11
|
+
import { SurfaceProvider, useSurface } from '@justanarthur/modo-ui'
|
|
12
|
+
import Button from '@justanarthur/modo-ui/components/actions/button'
|
|
13
|
+
import LogView from '@justanarthur/modo-ui/components/data-display/log-view'
|
|
14
|
+
import Meter from '@justanarthur/modo-ui/components/feedback/meter'
|
|
15
|
+
import { Spinner } from '@justanarthur/modo-ui/components/feedback/progress'
|
|
16
|
+
import { useShape } from '@justanarthur/modo-ui/lib/shape-context'
|
|
17
|
+
import { SURFACE_BG } from '@justanarthur/modo-ui/lib/surface-classes'
|
|
18
|
+
import { cn } from '@justanarthur/modo-ui/lib/utils'
|
|
19
|
+
import { type ReactNode, useState } from 'react'
|
|
20
|
+
import { type IconName, useIcon } from '../../../lib/icons'
|
|
21
|
+
import type { Profile } from '../../../lib/types'
|
|
22
|
+
|
|
23
|
+
export type FailureKind = 'cli-crashed' | 'reconnecting' | 'rate-limited' | 'offline' | 'auth-expired'
|
|
24
|
+
|
|
25
|
+
const ICON: Record<Exclude<FailureKind, 'reconnecting'>, { icon: IconName; tone: string }> = {
|
|
26
|
+
'cli-crashed': { icon: 'circle-x', tone: 'text-status-error' },
|
|
27
|
+
'rate-limited': { icon: 'gauge', tone: 'text-status-warning' },
|
|
28
|
+
offline: { icon: 'cloud', tone: 'text-muted-foreground' },
|
|
29
|
+
'auth-expired': { icon: 'key', tone: 'text-status-warning' },
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface FailureStateProps {
|
|
33
|
+
/** Which state: the claude process exited, the connection is being retried, a limit was hit, no network, or the sign-in expired. */
|
|
34
|
+
kind: FailureKind
|
|
35
|
+
/** A strip over the transcript, or the whole pane's empty state. Defaults to `'banner'`. */
|
|
36
|
+
variant?: 'banner' | 'page'
|
|
37
|
+
/** The profile it concerns: the one rate-limited or signed out. */
|
|
38
|
+
profile?: Profile
|
|
39
|
+
/** For `cli-crashed`: the last lines claude printed to stderr. */
|
|
40
|
+
stderr?: string[]
|
|
41
|
+
/** For `cli-crashed`: the exit code, or the signal it died of. */
|
|
42
|
+
exitCode?: number | string
|
|
43
|
+
/** For `reconnecting`: this attempt, counted from 1. Defaults to `1`. */
|
|
44
|
+
attempt?: number
|
|
45
|
+
/** For `reconnecting`: how many attempts before it gives up. Defaults to `5`. */
|
|
46
|
+
maxAttempts?: number
|
|
47
|
+
/** For `reconnecting`: the time to the next attempt, as it reads ("4s"). */
|
|
48
|
+
retryIn?: string
|
|
49
|
+
/** For `rate-limited`: when the limit resets, as it reads ("in 1h 12m", "at 14:05"). */
|
|
50
|
+
resetsIn?: string
|
|
51
|
+
/** For `rate-limited`: the profiles with room to move the session to, the roomiest first. */
|
|
52
|
+
alternatives?: Profile[]
|
|
53
|
+
/** Called when Restart is pressed (`cli-crashed`). */
|
|
54
|
+
onRestart?: () => void
|
|
55
|
+
/** Called when Retry now is pressed (`reconnecting`, `offline`). */
|
|
56
|
+
onRetry?: () => void
|
|
57
|
+
/** Called with a profile id when the session moves to it (`rate-limited`). */
|
|
58
|
+
onSwitchProfile?: (profileId: string) => void
|
|
59
|
+
/** Called when Sign in again is pressed (`auth-expired`). */
|
|
60
|
+
onLogin?: () => void
|
|
61
|
+
/** Called when a banner's ✕ is pressed; without it, the banner has none. */
|
|
62
|
+
onDismiss?: () => void
|
|
63
|
+
/** Classes for the root. */
|
|
64
|
+
className?: string
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* What the app shows when a session can't go on: the claude process
|
|
69
|
+
* crashed, the connection dropped, a profile hit its limit, the machine is
|
|
70
|
+
* offline, or a sign-in expired.
|
|
71
|
+
*
|
|
72
|
+
* Each state says what happened, in which profile, and the one thing that
|
|
73
|
+
* gets the session going again. A crash keeps the last of claude's stderr
|
|
74
|
+
* in a log, with Restart (the transcript is kept). Reconnecting counts its
|
|
75
|
+
* attempts and the time to the next one. A rate limit names the profile,
|
|
76
|
+
* when it resets and the profiles with room, so the session can move there
|
|
77
|
+
* in one press. Offline waits for the network; an expired sign-in runs
|
|
78
|
+
* `claude login` again. As a `banner` it sits over the transcript, which
|
|
79
|
+
* stays readable under it; as a `page` it fills the pane where the
|
|
80
|
+
* transcript would be.
|
|
81
|
+
*
|
|
82
|
+
* @example {@include ./examples.mdx}
|
|
83
|
+
*/
|
|
84
|
+
export default function FailureState({
|
|
85
|
+
kind,
|
|
86
|
+
variant = 'banner',
|
|
87
|
+
profile,
|
|
88
|
+
stderr = [],
|
|
89
|
+
exitCode,
|
|
90
|
+
attempt = 1,
|
|
91
|
+
maxAttempts = 5,
|
|
92
|
+
retryIn,
|
|
93
|
+
resetsIn,
|
|
94
|
+
alternatives = [],
|
|
95
|
+
onRestart,
|
|
96
|
+
onRetry,
|
|
97
|
+
onSwitchProfile,
|
|
98
|
+
onLogin,
|
|
99
|
+
onDismiss,
|
|
100
|
+
className,
|
|
101
|
+
}: FailureStateProps) {
|
|
102
|
+
const [showLog, setShowLog] = useState(variant === 'page')
|
|
103
|
+
const shape = useShape()
|
|
104
|
+
const level = Math.min(useSurface() + 1, 8)
|
|
105
|
+
const X = useIcon('x')
|
|
106
|
+
const Retry = useIcon('rotate-ccw')
|
|
107
|
+
const Terminal = useIcon('terminal')
|
|
108
|
+
const Key = useIcon('key')
|
|
109
|
+
const page = variant === 'page'
|
|
110
|
+
const name = profile?.name ?? 'this profile'
|
|
111
|
+
|
|
112
|
+
const copy: Record<FailureKind, { title: string; detail: ReactNode }> = {
|
|
113
|
+
'cli-crashed': {
|
|
114
|
+
title: 'claude stopped',
|
|
115
|
+
detail: `The process exited${exitCode === undefined ? '' : ` (${exitCode})`}. The transcript is kept; Restart picks the session up where it was.`,
|
|
116
|
+
},
|
|
117
|
+
reconnecting: {
|
|
118
|
+
title: 'Reconnecting…',
|
|
119
|
+
detail: `Attempt ${attempt} of ${maxAttempts}${retryIn ? ` · next in ${retryIn}` : ''}. Replies resume once it is back.`,
|
|
120
|
+
},
|
|
121
|
+
'rate-limited': {
|
|
122
|
+
title: `${name} hit its limit`,
|
|
123
|
+
detail: `${resetsIn ? `It resets ${resetsIn}.` : 'It resets soon.'}${alternatives.length > 0 ? ' Move the session to a profile with room, or wait.' : ''}`,
|
|
124
|
+
},
|
|
125
|
+
offline: {
|
|
126
|
+
title: 'You are offline',
|
|
127
|
+
detail: 'Sessions pause until the network is back; nothing you typed is lost.',
|
|
128
|
+
},
|
|
129
|
+
'auth-expired': {
|
|
130
|
+
title: `${name} is signed out`,
|
|
131
|
+
detail: `The sign-in for ${profile?.configDir ?? 'its config dir'} expired. Sign in again to keep going.`,
|
|
132
|
+
},
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const icon =
|
|
136
|
+
kind === 'reconnecting' ? (
|
|
137
|
+
<Spinner className={page ? 'size-5' : 'size-4'} />
|
|
138
|
+
) : (
|
|
139
|
+
<Glyph icon={ICON[kind].icon} className={ICON[kind].tone} size={page ? 20 : 16} />
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
const actions = (
|
|
143
|
+
<>
|
|
144
|
+
{kind === 'cli-crashed' && !page && stderr.length > 0 && (
|
|
145
|
+
<Button
|
|
146
|
+
variant="ghost"
|
|
147
|
+
size="compact"
|
|
148
|
+
leadingIcon={Terminal}
|
|
149
|
+
active={showLog}
|
|
150
|
+
onClick={() => setShowLog(!showLog)}
|
|
151
|
+
>
|
|
152
|
+
Output
|
|
153
|
+
</Button>
|
|
154
|
+
)}
|
|
155
|
+
{kind === 'cli-crashed' && (
|
|
156
|
+
<Button variant={page ? 'primary' : 'secondary'} size="compact" leadingIcon={Retry} onClick={onRestart}>
|
|
157
|
+
Restart
|
|
158
|
+
</Button>
|
|
159
|
+
)}
|
|
160
|
+
{(kind === 'reconnecting' || kind === 'offline') && (
|
|
161
|
+
<Button variant="secondary" size="compact" onClick={onRetry}>
|
|
162
|
+
Retry now
|
|
163
|
+
</Button>
|
|
164
|
+
)}
|
|
165
|
+
{kind === 'rate-limited' &&
|
|
166
|
+
alternatives.slice(0, page ? 3 : 1).map((alt, i) => (
|
|
167
|
+
<Button
|
|
168
|
+
key={alt.id}
|
|
169
|
+
variant={i === 0 ? 'secondary' : 'ghost'}
|
|
170
|
+
size="compact"
|
|
171
|
+
onClick={() => onSwitchProfile?.(alt.id)}
|
|
172
|
+
>
|
|
173
|
+
Continue in {alt.name}
|
|
174
|
+
</Button>
|
|
175
|
+
))}
|
|
176
|
+
{kind === 'auth-expired' && (
|
|
177
|
+
<Button variant={page ? 'primary' : 'secondary'} size="compact" leadingIcon={Key} onClick={onLogin}>
|
|
178
|
+
Sign in again
|
|
179
|
+
</Button>
|
|
180
|
+
)}
|
|
181
|
+
</>
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
const progress = kind === 'reconnecting' && (
|
|
185
|
+
<Meter
|
|
186
|
+
variant="line"
|
|
187
|
+
label="Reconnect attempts"
|
|
188
|
+
value={attempt}
|
|
189
|
+
max={maxAttempts}
|
|
190
|
+
className={page ? 'w-48' : 'w-16'}
|
|
191
|
+
/>
|
|
192
|
+
)
|
|
193
|
+
const log = kind === 'cli-crashed' && showLog && stderr.length > 0 && (
|
|
194
|
+
<LogView label="claude stderr" lines={stderr} prompt="" maxHeight={page ? 220 : 140} wrap className="w-full" />
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
if (page)
|
|
198
|
+
return (
|
|
199
|
+
<div
|
|
200
|
+
role={kind === 'reconnecting' ? 'status' : 'alert'}
|
|
201
|
+
className={cn(
|
|
202
|
+
'flex h-full w-full flex-col items-center justify-center gap-[var(--space-4)] p-[var(--space-6)]',
|
|
203
|
+
className,
|
|
204
|
+
)}
|
|
205
|
+
>
|
|
206
|
+
<div className="flex max-w-md flex-col items-center gap-[var(--space-2)] text-center">
|
|
207
|
+
{icon}
|
|
208
|
+
<h2 className="m-0 text-title text-foreground">{copy[kind].title}</h2>
|
|
209
|
+
<p className="m-0 text-body text-muted-foreground">{copy[kind].detail}</p>
|
|
210
|
+
{kind === 'rate-limited' && profile && <LimitMeters profile={profile} />}
|
|
211
|
+
{progress}
|
|
212
|
+
</div>
|
|
213
|
+
{log && <div className="flex w-full max-w-xl">{log}</div>}
|
|
214
|
+
<div className="flex flex-wrap items-center justify-center gap-[var(--space-2)]">{actions}</div>
|
|
215
|
+
</div>
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
return (
|
|
219
|
+
<SurfaceProvider value={level}>
|
|
220
|
+
<div
|
|
221
|
+
role={kind === 'reconnecting' ? 'status' : 'alert'}
|
|
222
|
+
className={cn(
|
|
223
|
+
'flex flex-col gap-[var(--space-2)] border border-border p-[var(--space-2)] pl-[var(--space-3)]',
|
|
224
|
+
SURFACE_BG[level],
|
|
225
|
+
shape.container,
|
|
226
|
+
className,
|
|
227
|
+
)}
|
|
228
|
+
>
|
|
229
|
+
<div className="flex items-center gap-[var(--space-3)]">
|
|
230
|
+
<span className="flex shrink-0">{icon}</span>
|
|
231
|
+
<div className="flex min-w-0 flex-1 flex-col">
|
|
232
|
+
<span className="truncate text-body weight-medium text-foreground">{copy[kind].title}</span>
|
|
233
|
+
<span className="truncate text-caption text-muted-foreground">{copy[kind].detail}</span>
|
|
234
|
+
</div>
|
|
235
|
+
{progress}
|
|
236
|
+
<div className="flex shrink-0 items-center gap-[var(--space-1)]">
|
|
237
|
+
{actions}
|
|
238
|
+
{onDismiss && (
|
|
239
|
+
<Button variant="ghost" size="icon-compact" aria-label="Dismiss" onClick={onDismiss}>
|
|
240
|
+
<X />
|
|
241
|
+
</Button>
|
|
242
|
+
)}
|
|
243
|
+
</div>
|
|
244
|
+
</div>
|
|
245
|
+
{log}
|
|
246
|
+
</div>
|
|
247
|
+
</SurfaceProvider>
|
|
248
|
+
)
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function Glyph({ icon, className, size }: { icon: IconName; className: string; size: number }) {
|
|
252
|
+
const Icon = useIcon(icon)
|
|
253
|
+
return <Icon size={size} strokeWidth={1.5} className={className} />
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function LimitMeters({ profile }: { profile: Profile }) {
|
|
257
|
+
return (
|
|
258
|
+
<div className="flex w-64 flex-col gap-[var(--space-1)] pt-[var(--space-2)]">
|
|
259
|
+
{profile.limits.map(limit => (
|
|
260
|
+
<div key={limit.label} className="flex items-center gap-[var(--space-2)] text-caption">
|
|
261
|
+
<span className="w-32 shrink-0 truncate text-left text-muted-foreground">{limit.label}</span>
|
|
262
|
+
<Meter variant="line" label={limit.label} value={limit.value} className="flex-1" />
|
|
263
|
+
<span className="w-10 shrink-0 text-right tabular-nums text-muted-foreground">
|
|
264
|
+
{Math.round(limit.value * 100)}%
|
|
265
|
+
</span>
|
|
266
|
+
</div>
|
|
267
|
+
))}
|
|
268
|
+
</div>
|
|
269
|
+
)
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export type { FailureStateProps }
|
|
273
|
+
|
|
274
|
+
export { FailureState }
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import Transcript from './index'
|
|
2
|
+
import { DEMO_CHAPTERS, DEMO_TASKS, DemoBuilding, DemoSession } from '../../../mock/demo-session'
|
|
3
|
+
|
|
4
|
+
# Session
|
|
5
|
+
|
|
6
|
+
A whole session: chapters, your turns with attachments and @-mentions, folded work with reasoning, tool runs, an Explore run and a background agent, the live turn at the bottom. Open the chapter list in the corner to jump.
|
|
7
|
+
|
|
8
|
+
<div className="flex h-[720px] w-full overflow-hidden rounded-xl border border-border bg-background">
|
|
9
|
+
<Transcript chapters={DEMO_CHAPTERS} footer={<Transcript.TaskList items={DEMO_TASKS} />}>
|
|
10
|
+
<DemoSession />
|
|
11
|
+
</Transcript>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
# Show work
|
|
15
|
+
|
|
16
|
+
Every turn's work starts unfolded; the eye in the corner folds it all again.
|
|
17
|
+
|
|
18
|
+
<div className="flex h-[560px] w-full overflow-hidden rounded-xl border border-border bg-background">
|
|
19
|
+
<Transcript defaultShowWork>
|
|
20
|
+
<DemoBuilding />
|
|
21
|
+
</Transcript>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
# Closing a turn
|
|
25
|
+
|
|
26
|
+
The footer stays under the column: the pinned task list folded to one row, then the wrap-up box with its question.
|
|
27
|
+
|
|
28
|
+
<div className="flex h-[560px] w-full overflow-hidden rounded-xl border border-border bg-background">
|
|
29
|
+
<Transcript
|
|
30
|
+
footer={
|
|
31
|
+
<>
|
|
32
|
+
<Transcript.TaskList items={DEMO_TASKS} defaultOpen={false} />
|
|
33
|
+
<Transcript.NextStep
|
|
34
|
+
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."
|
|
35
|
+
ask="Commit the AI app on its branch?"
|
|
36
|
+
actions={['Commit', 'Not yet']}
|
|
37
|
+
/>
|
|
38
|
+
</>
|
|
39
|
+
}
|
|
40
|
+
>
|
|
41
|
+
<DemoBuilding />
|
|
42
|
+
</Transcript>
|
|
43
|
+
</div>
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Local addition: the AI app's transcript. A scrolling reading column for
|
|
3
|
+
* one session, with the show-work toggle and the chapter list floating in its
|
|
4
|
+
* corner; it follows a growing session while you read at its end. The parts
|
|
5
|
+
* are the generic AI components (Message, Reasoning,
|
|
6
|
+
* ToolCall, AgentRun, WorkSummary, ChapterNav, TodoList, Recap), aliased as
|
|
7
|
+
* statics.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
'use client'
|
|
11
|
+
|
|
12
|
+
import Button from '@justanarthur/modo-ui/components/actions/button'
|
|
13
|
+
import Markdown from '@justanarthur/modo-ui/components/data-display/markdown'
|
|
14
|
+
import { cn } from '@justanarthur/modo-ui/lib/utils'
|
|
15
|
+
import ScrollArea from '@justanarthur/modo-ui/primitives/layout/scroll-area'
|
|
16
|
+
import { type ReactNode, useEffect, useLayoutEffect, useRef, useState } from 'react'
|
|
17
|
+
import AgentRun from '../../../components/conversation/agent-run'
|
|
18
|
+
import ChapterNav, { type ChapterNavItem } from '../../../components/conversation/chapter-nav'
|
|
19
|
+
import Message, { type MessageProps } from '../../../components/conversation/message'
|
|
20
|
+
import Reasoning from '../../../components/conversation/reasoning'
|
|
21
|
+
import Recap from '../../../components/conversation/recap'
|
|
22
|
+
import TodoList, { type TodoItem } from '../../../components/conversation/todo-list'
|
|
23
|
+
import ToolCall from '../../../components/conversation/tool-call'
|
|
24
|
+
import WorkSummary from '../../../components/conversation/work-summary'
|
|
25
|
+
import { useIcon } from '../../../lib/icons'
|
|
26
|
+
|
|
27
|
+
type TurnProps = Omit<MessageProps, 'role'>
|
|
28
|
+
|
|
29
|
+
// No static's key names a binding of this file: the declaration bundler renames
|
|
30
|
+
// a clashing binding to Name2, and a key spelled like it goes along (`Transcript.Working2`).
|
|
31
|
+
function UserTurn(props: TurnProps) {
|
|
32
|
+
// biome-ignore lint/a11y/useValidAriaRole: Message's `role` is who speaks, not an ARIA role
|
|
33
|
+
return <Message role="user" {...props} />
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** The agent's turn. A string is markdown, rendered as it streams in; JSX (work, tool runs, prose) renders as is. */
|
|
37
|
+
function AssistantTurn({ children, streaming, ...props }: TurnProps) {
|
|
38
|
+
if (typeof children === 'string')
|
|
39
|
+
return (
|
|
40
|
+
<div className="flex flex-col gap-3">
|
|
41
|
+
<Markdown streaming={streaming}>{children}</Markdown>
|
|
42
|
+
{streaming && <Message.Working />}
|
|
43
|
+
</div>
|
|
44
|
+
)
|
|
45
|
+
return (
|
|
46
|
+
// biome-ignore lint/a11y/useValidAriaRole: Message's `role` is who speaks, not an ARIA role
|
|
47
|
+
<Message role="assistant" streaming={streaming} {...props}>
|
|
48
|
+
{children}
|
|
49
|
+
</Message>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
interface TranscriptProps {
|
|
54
|
+
/** The turns: `Transcript.User`, `Transcript.Assistant` and the parts below. */
|
|
55
|
+
children: ReactNode
|
|
56
|
+
/** The session's chapters, for the chapter list in the corner. Omit for no list. */
|
|
57
|
+
chapters?: ChapterNavItem[]
|
|
58
|
+
/** Start with every turn's work unfolded. Defaults to `false`. */
|
|
59
|
+
defaultShowWork?: boolean
|
|
60
|
+
/** Pinned under the column, outside the scroll: a TodoList, a prompt, a Recap. */
|
|
61
|
+
footer?: ReactNode
|
|
62
|
+
/** Classes for the root. */
|
|
63
|
+
className?: string
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* One session's conversation: what you asked, what the agent said and did,
|
|
68
|
+
* and where the turn left off.
|
|
69
|
+
*
|
|
70
|
+
* The turns sit in one reading column and are the AI components: your
|
|
71
|
+
* messages and the agent's replies are Messages; what the agent did on the
|
|
72
|
+
* way (Reasoning, ToolCalls, AgentRuns) folds into one WorkSummary per
|
|
73
|
+
* turn, so the output reads clean. Press a row to open it, or the eye in the
|
|
74
|
+
* corner to show every turn's work at once. Chapters break the column with a
|
|
75
|
+
* titled hairline, and the ChapterNav in the corner jumps between them; in a
|
|
76
|
+
* narrow column both controls take a row of their own above it. The
|
|
77
|
+
* `footer` stays put under the column: that is where the TodoList, a pending
|
|
78
|
+
* prompt and the Recap live. The session opens scrolled to its latest turn
|
|
79
|
+
* and follows it: while you read at the end, a turn that arrives or a reply
|
|
80
|
+
* that streams keeps it in view; scroll up and it lets go, with a button to
|
|
81
|
+
* jump back to the latest.
|
|
82
|
+
*
|
|
83
|
+
* Statics (aliases of the components, named for the session):
|
|
84
|
+
* - `Transcript.User` / `Transcript.Assistant` — a Message with its `role` set.
|
|
85
|
+
* - `Transcript.Work` — WorkSummary.
|
|
86
|
+
* - `Transcript.Thinking` — Reasoning.
|
|
87
|
+
* - `Transcript.Tools` / `Transcript.Tool` — ToolCall.Group / ToolCall.
|
|
88
|
+
* - `Transcript.Agent` — AgentRun.
|
|
89
|
+
* - `Transcript.Chapter` — ChapterNav.Break.
|
|
90
|
+
* - `Transcript.Mention` / `Transcript.Attachment` / `Transcript.Working` — Message.Mention / Message.Attachment / Message.Working.
|
|
91
|
+
* - `Transcript.TaskList` — TodoList.
|
|
92
|
+
* - `Transcript.NextStep` — Recap.
|
|
93
|
+
*
|
|
94
|
+
* @example {@include ./examples.mdx}
|
|
95
|
+
*/
|
|
96
|
+
const Transcript = Object.assign(
|
|
97
|
+
function Transcript({ children, chapters, defaultShowWork = false, footer, className }: TranscriptProps) {
|
|
98
|
+
const [showWork, setShowWork] = useState(defaultShowWork)
|
|
99
|
+
const [following, setFollowing] = useState(true)
|
|
100
|
+
const Eye = useIcon('eye')
|
|
101
|
+
const Down = useIcon('arrow-down')
|
|
102
|
+
const column = useRef<HTMLDivElement | null>(null)
|
|
103
|
+
const viewport = useRef<HTMLElement | null>(null)
|
|
104
|
+
const atEnd = useRef(true)
|
|
105
|
+
|
|
106
|
+
// Scrolls only the transcript's own viewport: scrollIntoView would move every scrolling ancestor too.
|
|
107
|
+
const toEnd = () => {
|
|
108
|
+
const el = viewport.current
|
|
109
|
+
if (el) el.scrollTop = el.scrollHeight
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// A session opens on its latest turn.
|
|
113
|
+
useLayoutEffect(() => {
|
|
114
|
+
viewport.current = column.current?.closest<HTMLElement>('[data-slot="scroll-area-viewport"]') ?? null
|
|
115
|
+
toEnd()
|
|
116
|
+
}, [])
|
|
117
|
+
|
|
118
|
+
// Content that grows under a reader at the end fires no scroll event, so `atEnd` still holds.
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
const el = viewport.current
|
|
121
|
+
const content = column.current
|
|
122
|
+
if (!el || !content) return
|
|
123
|
+
const onScroll = () => {
|
|
124
|
+
const end = el.scrollHeight - el.scrollTop - el.clientHeight < 8
|
|
125
|
+
if (end === atEnd.current) return
|
|
126
|
+
atEnd.current = end
|
|
127
|
+
setFollowing(end)
|
|
128
|
+
}
|
|
129
|
+
const observer = new ResizeObserver(() => {
|
|
130
|
+
if (atEnd.current) toEnd()
|
|
131
|
+
})
|
|
132
|
+
el.addEventListener('scroll', onScroll, { passive: true })
|
|
133
|
+
observer.observe(content)
|
|
134
|
+
return () => {
|
|
135
|
+
el.removeEventListener('scroll', onScroll)
|
|
136
|
+
observer.disconnect()
|
|
137
|
+
}
|
|
138
|
+
}, [])
|
|
139
|
+
|
|
140
|
+
return (
|
|
141
|
+
<div className={cn('@container relative flex min-h-0 flex-1 flex-col', className)}>
|
|
142
|
+
{/* A narrow column has no margin to float them in: there they take a row of their own above it. */}
|
|
143
|
+
<div className="flex shrink-0 items-center justify-end gap-0.5 px-3 pt-1 @3xl:absolute @3xl:right-3 @3xl:top-2 @3xl:z-20 @3xl:p-0">
|
|
144
|
+
<Button
|
|
145
|
+
variant="ghost"
|
|
146
|
+
size="icon-compact"
|
|
147
|
+
aria-label={showWork ? 'Hide work' : 'Show work'}
|
|
148
|
+
aria-pressed={showWork}
|
|
149
|
+
active={showWork}
|
|
150
|
+
onClick={() => setShowWork(!showWork)}
|
|
151
|
+
>
|
|
152
|
+
<Eye />
|
|
153
|
+
</Button>
|
|
154
|
+
{chapters && chapters.length > 0 && <ChapterNav chapters={chapters} />}
|
|
155
|
+
</div>
|
|
156
|
+
<ScrollArea className="min-h-0 flex-1" viewportClassName="scroll-fade">
|
|
157
|
+
<WorkSummary.Provider open={showWork}>
|
|
158
|
+
<div ref={column} className="mx-auto flex w-full max-w-3xl flex-col gap-5 px-6 py-6 [contain:inline-size]">
|
|
159
|
+
{children}
|
|
160
|
+
</div>
|
|
161
|
+
</WorkSummary.Provider>
|
|
162
|
+
</ScrollArea>
|
|
163
|
+
{!following && (
|
|
164
|
+
<div className="pointer-events-none relative z-20 mx-auto flex w-full max-w-3xl justify-center px-6">
|
|
165
|
+
<Button
|
|
166
|
+
variant="secondary"
|
|
167
|
+
size="compact"
|
|
168
|
+
className="pointer-events-auto absolute bottom-2"
|
|
169
|
+
onClick={toEnd}
|
|
170
|
+
>
|
|
171
|
+
<Down />
|
|
172
|
+
Latest
|
|
173
|
+
</Button>
|
|
174
|
+
</div>
|
|
175
|
+
)}
|
|
176
|
+
{footer && <div className="mx-auto flex w-full max-w-3xl flex-col gap-3 px-6 pb-3">{footer}</div>}
|
|
177
|
+
</div>
|
|
178
|
+
)
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
User: UserTurn,
|
|
182
|
+
Assistant: AssistantTurn,
|
|
183
|
+
Work: WorkSummary,
|
|
184
|
+
Thinking: Reasoning,
|
|
185
|
+
Tools: ToolCall.Group,
|
|
186
|
+
Tool: ToolCall,
|
|
187
|
+
Agent: AgentRun,
|
|
188
|
+
Chapter: ChapterNav.Break,
|
|
189
|
+
Mention: Message.Mention,
|
|
190
|
+
Attachment: Message.Attachment,
|
|
191
|
+
Working: Message.Working,
|
|
192
|
+
TaskList: TodoList,
|
|
193
|
+
NextStep: Recap,
|
|
194
|
+
},
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
/** A chapter in the corner list: ChapterNavItem, named for the session. */
|
|
198
|
+
type TocChapter = ChapterNavItem
|
|
199
|
+
/** A row of the pinned task list: TodoItem, named for the session. */
|
|
200
|
+
type TaskItem = TodoItem
|
|
201
|
+
|
|
202
|
+
export type { TaskItem, TocChapter, TranscriptProps }
|
|
203
|
+
|
|
204
|
+
export default Transcript
|
|
205
|
+
|
|
206
|
+
export { Transcript }
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import TranscriptSearch from './index'
|
|
2
|
+
import Button from '@justanarthur/modo-ui/components/actions/button'
|
|
3
|
+
import { PROFILES, PROJECTS } from '../../../mock/mock'
|
|
4
|
+
import { TRANSCRIPTS } from '../../../mock/mock-extras'
|
|
5
|
+
|
|
6
|
+
# Search
|
|
7
|
+
|
|
8
|
+
Press the button: the search grows out of it with the field focused. Try "zoom" or "retry"; the arrow keys move through the hits and Enter opens one.
|
|
9
|
+
|
|
10
|
+
<TranscriptSearch
|
|
11
|
+
trigger={<Button variant="secondary">Search transcripts</Button>}
|
|
12
|
+
sessions={TRANSCRIPTS}
|
|
13
|
+
projects={PROJECTS}
|
|
14
|
+
profiles={PROFILES}
|
|
15
|
+
/>
|
|
16
|
+
|
|
17
|
+
# Hits by session
|
|
18
|
+
|
|
19
|
+
Each matching line with one line of context on each side, grouped under its session.
|
|
20
|
+
|
|
21
|
+
<div className="flex h-[520px] w-full max-w-[880px] flex-col rounded-xl border border-border bg-background p-4">
|
|
22
|
+
<TranscriptSearch.Panel className="flex-1" sessions={TRANSCRIPTS} projects={PROJECTS} profiles={PROFILES} defaultQuery="zoom" />
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
# Filtered
|
|
26
|
+
|
|
27
|
+
One project, the past week: older and other sessions drop out.
|
|
28
|
+
|
|
29
|
+
<div className="flex h-[400px] w-full max-w-[880px] flex-col rounded-xl border border-border bg-background p-4">
|
|
30
|
+
<TranscriptSearch.Panel
|
|
31
|
+
className="flex-1"
|
|
32
|
+
sessions={TRANSCRIPTS}
|
|
33
|
+
projects={PROJECTS}
|
|
34
|
+
profiles={PROFILES}
|
|
35
|
+
defaultQuery="retr"
|
|
36
|
+
defaultProject="~/Projects/jobiflow/api"
|
|
37
|
+
defaultRange="week"
|
|
38
|
+
/>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
# Light and dark
|
|
42
|
+
|
|
43
|
+
<div className="grid w-full gap-3 @3xl:grid-cols-2">
|
|
44
|
+
<div className="light flex h-[420px] flex-col rounded-xl border border-border bg-background p-4 text-foreground">
|
|
45
|
+
<TranscriptSearch.Panel className="flex-1" sessions={TRANSCRIPTS} projects={PROJECTS} profiles={PROFILES} defaultQuery="meter" />
|
|
46
|
+
</div>
|
|
47
|
+
<div className="dark flex h-[420px] flex-col rounded-xl border border-border bg-background p-4 text-foreground">
|
|
48
|
+
<TranscriptSearch.Panel className="flex-1" sessions={TRANSCRIPTS} projects={PROJECTS} profiles={PROFILES} defaultQuery="meter" />
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|