@alwith/module-chat 0.5.1 → 0.5.3
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/README.md +52 -10
- package/dist/activity-host.d.ts +1 -0
- package/dist/activity-host.js +1 -1
- package/dist/approval/choice-elicitation-form.js +1 -1
- package/dist/approval/choice-schema.js +1 -1
- package/dist/approval/permission-options.js +1 -1
- package/dist/approval/permission-view.js +1 -1
- package/dist/approval/schema-elicitation-form.js +1 -1
- package/dist/approval/url-elicitation-card.js +1 -1
- package/dist/chunk-0j15twx6.js +2 -0
- package/dist/chunk-0n82kdek.js +2 -0
- package/dist/chunk-0pa5t12s.js +2 -0
- package/dist/chunk-0vvn08gg.js +2 -0
- package/dist/chunk-14a9wet3.js +2 -0
- package/dist/chunk-1dp50khb.js +2 -0
- package/dist/{chunk-wmsdg5fb.js → chunk-1hy64ewz.js} +1 -1
- package/dist/chunk-1wc83vxg.js +2 -0
- package/dist/chunk-20bww40d.js +2 -0
- package/dist/chunk-20gtemb9.js +2 -0
- package/dist/chunk-20re64ta.js +2 -0
- package/dist/{chunk-ahcmeqvb.js → chunk-23wzpgbs.js} +2 -2
- package/dist/{chunk-jaf9msp7.js → chunk-2b185a0a.js} +2 -2
- package/dist/chunk-2snmjnz9.js +2 -0
- package/dist/chunk-2sy8cs84.js +2 -0
- package/dist/chunk-30g0y24x.js +2 -0
- package/dist/chunk-33mgpcnd.js +2 -0
- package/dist/chunk-3jcxkpvs.js +2 -0
- package/dist/chunk-3m06tqqk.js +2 -0
- package/dist/{chunk-2v9kbth7.js → chunk-3nmqebb6.js} +3 -3
- package/dist/chunk-4d8q9bpy.js +2 -0
- package/dist/chunk-4dcagj01.js +1 -0
- package/dist/chunk-4mnf89r3.js +1 -0
- package/dist/{chunk-6q8b8aww.js → chunk-51qsyrd6.js} +1 -1
- package/dist/chunk-543v9eke.js +2 -0
- package/dist/chunk-61vxy6yd.js +1 -0
- package/dist/chunk-67txww0x.js +2 -0
- package/dist/chunk-691gxr2e.js +2 -0
- package/dist/chunk-6fht8rx9.js +2 -0
- package/dist/chunk-6ndz2pf9.js +2 -0
- package/dist/chunk-7gaper2w.js +2 -0
- package/dist/chunk-802bgza1.js +2 -0
- package/dist/chunk-86kkb0z4.js +2 -0
- package/dist/chunk-87t0qtkr.js +7 -0
- package/dist/{chunk-38skakaz.js → chunk-8kjsqjy6.js} +1 -1
- package/dist/chunk-8mvg9a32.js +2 -0
- package/dist/chunk-8r010kvn.js +1 -0
- package/dist/chunk-9bjywaze.js +1 -0
- package/dist/chunk-9hqz5fbc.js +2 -0
- package/dist/chunk-9v2gk9ex.js +2 -0
- package/dist/chunk-9x4et210.js +2 -0
- package/dist/{chunk-vk39871j.js → chunk-a7mr12yc.js} +1 -1
- package/dist/chunk-aaqk0jrt.js +2 -0
- package/dist/{chunk-rgy601b7.js → chunk-acrrwrzy.js} +2 -2
- package/dist/chunk-asxwsg2p.js +2 -0
- package/dist/chunk-awrzpp7x.js +2 -0
- package/dist/chunk-aygzz2yg.js +2 -0
- package/dist/chunk-b5g1j1zv.js +2 -0
- package/dist/chunk-bycbj1aq.js +2 -0
- package/dist/chunk-cgxcxfh1.js +3 -0
- package/dist/chunk-cj5pkg2y.js +4 -0
- package/dist/chunk-ckp6661s.js +2 -0
- package/dist/chunk-cr294svm.js +1 -0
- package/dist/chunk-ctedwb0a.js +3 -0
- package/dist/chunk-cw68hvkc.js +1 -0
- package/dist/chunk-czahfwp7.js +2 -0
- package/dist/chunk-d25r0vq3.js +2 -0
- package/dist/chunk-d4yhdesy.js +2 -0
- package/dist/{chunk-2sgxwycp.js → chunk-d6nxypzc.js} +1 -1
- package/dist/{chunk-3z0y9amd.js → chunk-dfengqjx.js} +2 -2
- package/dist/chunk-dnn8064m.js +2 -0
- package/dist/chunk-dqw30cz4.js +2 -0
- package/dist/chunk-dzydvx7r.js +4 -0
- package/dist/{chunk-fmxt5ysw.js → chunk-e3mkvx24.js} +1 -1
- package/dist/chunk-e43pfcrt.js +2 -0
- package/dist/{chunk-bwzjm3g8.js → chunk-ek06eyp4.js} +1 -1
- package/dist/chunk-eyre28p1.js +2 -0
- package/dist/chunk-fqj76wq8.js +2 -0
- package/dist/chunk-h4sw0pez.js +2 -0
- package/dist/chunk-h80g3eme.js +2 -0
- package/dist/{chunk-dp4g5y18.js → chunk-hesyytcd.js} +2 -2
- package/dist/chunk-hmtgx7fw.js +2 -0
- package/dist/chunk-hr9d9zpb.js +2 -0
- package/dist/chunk-hwwhxb3x.js +1 -0
- package/dist/chunk-j4teycge.js +2 -0
- package/dist/{chunk-1vxrdkew.js → chunk-jdv29apq.js} +2 -2
- package/dist/chunk-jf5651fz.js +2 -0
- package/dist/chunk-jmx0awnf.js +2 -0
- package/dist/{chunk-tcqf45rf.js → chunk-jnfp7j32.js} +2 -2
- package/dist/{chunk-9f42d428.js → chunk-k50475tn.js} +1 -1
- package/dist/{chunk-6ynartgd.js → chunk-kbvkr5mr.js} +2 -2
- package/dist/chunk-maepz12p.js +3 -0
- package/dist/chunk-maj7m5s7.js +4 -0
- package/dist/chunk-mgakm5yv.js +2 -0
- package/dist/chunk-mk10tgjk.js +2 -0
- package/dist/{chunk-g13txkf0.js → chunk-mmdpwbef.js} +2 -2
- package/dist/chunk-n3raktzz.js +2 -0
- package/dist/{chunk-d0ptk8x8.js → chunk-ncekagm6.js} +1 -1
- package/dist/chunk-npjw8dm5.js +2 -0
- package/dist/chunk-p0cc67an.js +2 -0
- package/dist/{chunk-r125b0z5.js → chunk-pb6xtb3n.js} +2 -2
- package/dist/chunk-pcngn73n.js +2 -0
- package/dist/chunk-ptt7q7za.js +3 -0
- package/dist/chunk-px7xxz3v.js +2 -0
- package/dist/{chunk-gnthx1zg.js → chunk-qbdqh38y.js} +1 -1
- package/dist/chunk-qf3a35g4.js +2 -0
- package/dist/chunk-qpz97p1m.js +1 -0
- package/dist/chunk-r41p7378.js +2 -0
- package/dist/chunk-r6e2abj6.js +2 -0
- package/dist/{chunk-h96s3j1e.js → chunk-rkqe8p8n.js} +2 -2
- package/dist/chunk-rqbbb37p.js +2 -0
- package/dist/chunk-rzajhyrq.js +2 -0
- package/dist/chunk-sc746nr6.js +2 -0
- package/dist/chunk-sgbde4dv.js +2 -0
- package/dist/{chunk-3abwky4a.js → chunk-st90r31c.js} +1 -1
- package/dist/{chunk-8md0gr7j.js → chunk-t2ceq16d.js} +2 -2
- package/dist/chunk-t9vvcy09.js +3 -0
- package/dist/chunk-tgb70x2n.js +2 -0
- package/dist/chunk-tj44vjyv.js +2 -0
- package/dist/chunk-tptnjbrd.js +2 -0
- package/dist/chunk-tre0r8qm.js +2 -0
- package/dist/chunk-vxnjsga5.js +2 -0
- package/dist/chunk-vyzzs0nc.js +7 -0
- package/dist/chunk-w0y1svj7.js +3 -0
- package/dist/chunk-w2tmm1va.js +2 -0
- package/dist/chunk-w92s8704.js +5 -0
- package/dist/chunk-w99ah6qt.js +3 -0
- package/dist/chunk-wf4tq3fn.js +1 -0
- package/dist/chunk-wqwqx3hc.js +2 -0
- package/dist/chunk-wtk721nx.js +2 -0
- package/dist/chunk-x3b4dpac.js +2 -0
- package/dist/chunk-x71x2atx.js +2 -0
- package/dist/chunk-xem94nq0.js +4 -0
- package/dist/chunk-yx02h2ja.js +2 -0
- package/dist/chunk-z8fdvq3v.js +2 -0
- package/dist/{chunk-nfd274y3.js → chunk-zcrct67v.js} +1 -1
- package/dist/chunk-zjg9n6zj.js +2 -0
- package/dist/chunk-zwvyfjj8.js +2 -0
- package/dist/chunk-zy6338m6.js +2 -0
- package/dist/{chunk-en6qem8e.js → chunk-zzwnpk4q.js} +2 -2
- package/dist/codex/activity-group.js +1 -1
- package/dist/codex/assistant-message.js +1 -2
- package/dist/codex/async-question-card.js +1 -3
- package/dist/codex/disclosure-state.js +1 -1
- package/dist/codex/edited-files-card.js +1 -1
- package/dist/codex/image-view-activity.js +1 -1
- package/dist/codex/markdown-renderer.js +1 -6
- package/dist/codex/navigation-audio.js +1 -1
- package/dist/codex/navigation-preview.js +1 -1
- package/dist/codex/navigation-rail.js +1 -1
- package/dist/codex/patch-view.js +1 -2
- package/dist/codex/plan.js +1 -1
- package/dist/codex/styles.css +176 -0
- package/dist/codex/timeline-virtualizer.js +1 -1
- package/dist/codex/user-message.js +1 -1
- package/dist/codex/virtualized-turn-list.js +1 -1
- package/dist/composer/completion-filter.js +1 -1
- package/dist/composer/completion-menu.js +1 -3
- package/dist/composer/completion-trigger.js +1 -1
- package/dist/composer/effort-slider.js +1 -1
- package/dist/composer/menu-radio.js +1 -1
- package/dist/composer/model-select.js +1 -1
- package/dist/composer/permission-mode-select.js +1 -1
- package/dist/composer/prompt-input-attachments.js +1 -1
- package/dist/composer/prompt-input-clipboard.js +1 -1
- package/dist/composer/prompt-input-context.js +1 -1
- package/dist/composer/prompt-input-textarea.js +1 -3
- package/dist/composer/prompt-input.js +1 -1
- package/dist/conversation/action-card.d.ts +20 -0
- package/dist/conversation/action-card.js +1 -0
- package/dist/conversation/composer/composer.d.ts +21 -0
- package/dist/conversation/composer/composer.js +1 -0
- package/dist/conversation/composer/config-options.d.ts +6 -0
- package/dist/conversation/composer/config-options.js +1 -0
- package/dist/conversation/composer/context.d.ts +32 -0
- package/dist/conversation/composer/context.js +1 -0
- package/dist/conversation/composer/drafts.d.ts +15 -0
- package/dist/conversation/composer/drafts.js +1 -0
- package/dist/conversation/composer/file-items.d.ts +3 -0
- package/dist/conversation/composer/file-items.js +1 -0
- package/dist/conversation/composer/long-text.d.ts +14 -0
- package/dist/conversation/composer/long-text.js +1 -0
- package/dist/conversation/composer/mention-chips.d.ts +4 -0
- package/dist/conversation/composer/mention-chips.js +1 -0
- package/dist/conversation/composer/mention-uri.d.ts +7 -0
- package/dist/conversation/composer/mention-uri.js +1 -0
- package/dist/conversation/composer/model-menu.d.ts +26 -0
- package/dist/conversation/composer/model-menu.js +1 -0
- package/dist/conversation/composer/pasted-text-attachment.d.ts +5 -0
- package/dist/conversation/composer/pasted-text-attachment.js +1 -0
- package/dist/conversation/composer/permission-mode-menu.d.ts +8 -0
- package/dist/conversation/composer/permission-mode-menu.js +1 -0
- package/dist/conversation/composer/prediction.d.ts +6 -0
- package/dist/conversation/composer/prediction.js +1 -0
- package/dist/conversation/composer/slash-command-button.d.ts +8 -0
- package/dist/conversation/composer/slash-command-button.js +1 -0
- package/dist/conversation/composer/submit-button.d.ts +7 -0
- package/dist/conversation/composer/submit-button.js +1 -0
- package/dist/conversation/composer/usage-meter.d.ts +7 -0
- package/dist/conversation/composer/usage-meter.js +1 -0
- package/dist/conversation/context.d.ts +14 -0
- package/dist/conversation/context.js +1 -0
- package/dist/conversation/conversation-body.d.ts +7 -0
- package/dist/conversation/conversation-body.js +1 -0
- package/dist/conversation/conversation-view.d.ts +17 -0
- package/dist/conversation/conversation-view.js +1 -0
- package/dist/conversation/conversation.d.ts +18 -0
- package/dist/conversation/conversation.js +1 -0
- package/dist/conversation/diff-modal.d.ts +7 -0
- package/dist/conversation/diff-modal.js +1 -0
- package/dist/conversation/session-actions.d.ts +3 -0
- package/dist/conversation/session-actions.js +1 -0
- package/dist/conversation/types.d.ts +21 -0
- package/dist/conversation/types.js +0 -0
- package/dist/image-lightbox.js +1 -1
- package/dist/image-preview-dialog.js +1 -1
- package/dist/lib/code-highlighter.js +1 -1
- package/dist/lib/fuzzy.js +1 -1
- package/dist/lib/group-blocks.js +1 -1
- package/dist/lib/image-encode.js +1 -1
- package/dist/lib/limits.js +1 -1
- package/dist/lib/markdown-parser.js +1 -1
- package/dist/lib/markdown-rules.js +1 -1
- package/dist/lib/model-name.js +1 -1
- package/dist/lib/pointer-centered-zoom.js +1 -1
- package/dist/lib/prepare-prompt-files.js +1 -1
- package/dist/lib/stream-style.js +1 -1
- package/dist/lib/streaming-markdown.js +1 -1
- package/dist/locales.d.ts +1432 -0
- package/dist/locales.js +1 -1
- package/dist/search/chat-search.js +1 -1
- package/dist/search/dom-matches.js +1 -1
- package/dist/search/find-bar.js +1 -1
- package/dist/search/literal-matches.js +1 -1
- package/dist/session-list/archived-sessions.d.ts +7 -0
- package/dist/session-list/archived-sessions.js +1 -0
- package/dist/session-list/highlight.d.ts +2 -0
- package/dist/session-list/highlight.js +1 -0
- package/dist/session-list/host.d.ts +43 -0
- package/dist/session-list/host.js +1 -0
- package/dist/session-list/hover-info-card.d.ts +21 -0
- package/dist/session-list/hover-info-card.js +1 -0
- package/dist/session-list/locales.d.ts +247 -0
- package/dist/session-list/locales.js +1 -0
- package/dist/session-list/navigation.d.ts +50 -0
- package/dist/session-list/navigation.js +1 -0
- package/dist/session-list/overflow-marquee.d.ts +2 -0
- package/dist/session-list/overflow-marquee.js +1 -0
- package/dist/session-list/row-stop-button.d.ts +4 -0
- package/dist/session-list/row-stop-button.js +1 -0
- package/dist/session-list/session-groups.d.ts +5 -0
- package/dist/session-list/session-groups.js +1 -0
- package/dist/session-list/session-info-card.d.ts +10 -0
- package/dist/session-list/session-info-card.js +1 -0
- package/dist/session-list/session-list.css +95 -0
- package/dist/session-list/session-list.d.ts +37 -0
- package/dist/session-list/session-list.js +1 -0
- package/dist/session-list/session-row.d.ts +10 -0
- package/dist/session-list/session-row.js +1 -0
- package/dist/session-list/session-state-dot.d.ts +10 -0
- package/dist/session-list/session-state-dot.js +1 -0
- package/dist/session-list/sidebar-overlay.d.ts +2 -0
- package/dist/session-list/sidebar-overlay.js +1 -0
- package/dist/session-list/trailing-swap.d.ts +11 -0
- package/dist/session-list/trailing-swap.js +1 -0
- package/dist/session-list/use-activity-preview.d.ts +2 -0
- package/dist/session-list/use-activity-preview.js +1 -0
- package/dist/session-list/use-project-sessions.d.ts +16 -0
- package/dist/session-list/use-project-sessions.js +1 -0
- package/dist/session-list/virtual-session-rows.d.ts +9 -0
- package/dist/session-list/virtual-session-rows.js +1 -0
- package/dist/session-timeline/activity-group.d.ts +7 -0
- package/dist/session-timeline/activity-group.js +1 -0
- package/dist/session-timeline/activity-projection.d.ts +3 -0
- package/dist/session-timeline/activity-projection.js +1 -0
- package/dist/session-timeline/assistant-content.d.ts +7 -0
- package/dist/session-timeline/assistant-content.js +1 -0
- package/dist/session-timeline/assistant-turn.d.ts +28 -0
- package/dist/session-timeline/assistant-turn.js +1 -0
- package/dist/session-timeline/async-questions.d.ts +5 -0
- package/dist/session-timeline/async-questions.js +1 -0
- package/dist/session-timeline/edited-files-card.d.ts +18 -0
- package/dist/session-timeline/edited-files-card.js +1 -0
- package/dist/session-timeline/history-timeline.d.ts +12 -0
- package/dist/session-timeline/history-timeline.js +1 -0
- package/dist/session-timeline/host.d.ts +14 -0
- package/dist/session-timeline/host.js +1 -0
- package/dist/session-timeline/navigation-rail.d.ts +10 -0
- package/dist/session-timeline/navigation-rail.js +1 -0
- package/dist/session-timeline/plan.d.ts +4 -0
- package/dist/session-timeline/plan.js +1 -0
- package/dist/session-timeline/question-reply.d.ts +8 -0
- package/dist/session-timeline/question-reply.js +1 -0
- package/dist/session-timeline/resource-content.d.ts +7 -0
- package/dist/session-timeline/resource-content.js +1 -0
- package/dist/session-timeline/session-timeline.d.ts +40 -0
- package/dist/session-timeline/session-timeline.js +1 -0
- package/dist/session-timeline/timeline-registry.d.ts +12 -0
- package/dist/session-timeline/timeline-registry.js +1 -0
- package/dist/session-timeline/turn-error.d.ts +14 -0
- package/dist/session-timeline/turn-error.js +1 -0
- package/dist/session-timeline/turn-retry.d.ts +2 -0
- package/dist/session-timeline/turn-retry.js +1 -0
- package/dist/session-timeline/turn-time.d.ts +5 -0
- package/dist/session-timeline/turn-time.js +1 -0
- package/dist/session-timeline/turns.d.ts +51 -0
- package/dist/session-timeline/turns.js +1 -0
- package/dist/session-timeline/types.d.ts +31 -0
- package/dist/session-timeline/types.js +0 -0
- package/dist/session-timeline/use-timeline-scroll.d.ts +12 -0
- package/dist/session-timeline/use-timeline-scroll.js +1 -0
- package/dist/session-timeline/user-message.d.ts +8 -0
- package/dist/session-timeline/user-message.js +1 -0
- package/dist/ui/alert.d.ts +10 -0
- package/dist/ui/alert.js +1 -0
- package/dist/ui/badge.js +1 -1
- package/dist/ui/button.js +1 -1
- package/dist/ui/card.js +1 -1
- package/dist/ui/checkbox.js +1 -1
- package/dist/ui/dialog.js +1 -1
- package/dist/ui/dropdown-menu.js +1 -1
- package/dist/ui/empty.d.ts +11 -0
- package/dist/ui/empty.js +1 -0
- package/dist/ui/field.js +1 -1
- package/dist/ui/hover-card.js +1 -1
- package/dist/ui/input-group-textarea.js +1 -1
- package/dist/ui/input-group.js +1 -1
- package/dist/ui/input.js +1 -1
- package/dist/ui/kbd.d.ts +3 -0
- package/dist/ui/kbd.js +1 -0
- package/dist/ui/label.js +1 -1
- package/dist/ui/radio-group.js +1 -1
- package/dist/ui/select.d.ts +15 -0
- package/dist/ui/select.js +1 -0
- package/dist/ui/separator.js +1 -1
- package/dist/ui/skeleton.d.ts +2 -0
- package/dist/ui/skeleton.js +1 -0
- package/dist/ui/spinner.d.ts +2 -0
- package/dist/ui/spinner.js +1 -0
- package/dist/ui/switch.js +1 -1
- package/dist/ui/textarea.js +1 -1
- package/dist/ui/tooltip.js +1 -1
- package/package.json +47 -6
- package/dist/chunk-35j3t609.js +0 -2
- package/dist/chunk-3t2c4zky.js +0 -2
- package/dist/chunk-6mhdcz0h.js +0 -2
- package/dist/chunk-6pmsbx1j.js +0 -2
- package/dist/chunk-7ar540cc.js +0 -2
- package/dist/chunk-7ex6r8ja.js +0 -3
- package/dist/chunk-7xdvwjxh.js +0 -2
- package/dist/chunk-98g6kwj5.js +0 -2
- package/dist/chunk-bbw2zg1a.js +0 -2
- package/dist/chunk-c4ps9628.js +0 -2
- package/dist/chunk-c8dr4btd.js +0 -2
- package/dist/chunk-d4e74rv1.js +0 -2
- package/dist/chunk-dj8v2w6n.js +0 -1
- package/dist/chunk-fk1z4bmr.js +0 -2
- package/dist/chunk-fk5nvz2s.js +0 -2
- package/dist/chunk-j3my6gn8.js +0 -1
- package/dist/chunk-k0mayxgs.js +0 -2
- package/dist/chunk-k4w61adv.js +0 -2
- package/dist/chunk-kk9q6wtq.js +0 -2
- package/dist/chunk-p141s624.js +0 -2
- package/dist/chunk-s2n85pks.js +0 -1
- package/dist/chunk-sdv6vdhr.js +0 -7
- package/dist/chunk-sptvg9xh.js +0 -2
- package/dist/chunk-wnq8g0kp.js +0 -1
package/README.md
CHANGED
|
@@ -18,24 +18,66 @@ component does not own a conversation store or create permission requests.
|
|
|
18
18
|
| Composer, attachments, completion and selectors | Controlled draft, available commands/files/models/options, submission and error handling |
|
|
19
19
|
| Approval and elicitation interaction | Original request identity, protocol response, replay and product-specific actions |
|
|
20
20
|
| Virtual list, search UI and turn navigation | Session identity, viewport, source matches, reveal callback and navigation preferences |
|
|
21
|
+
| Session timeline: turn grouping, history placeholders, retry, follow and anchor scrolling | Client, host capabilities, product slots and the scrolling element |
|
|
21
22
|
|
|
22
23
|
Application navigation, settings, login pages, update UI and general-purpose product controls are not part of this package. Runtime owns execution; `@alwith/api` owns protocol folding. Applications must not reconstruct run state from the chat presentation.
|
|
23
24
|
|
|
24
|
-
Import @alwith/module-chat/markdown.css for Markdown styling and include the package source in Tailwind's @source scan.
|
|
25
|
+
Import @alwith/module-chat/markdown.css for Markdown styling and include the package source in Tailwind's @source scan. With Vite, exclude the package from dependency pre-bundling, because Markdown runs in Web Workers created with `new URL(…, import.meta.url)`, and pre-bundle the CommonJS shims its Base UI components import:
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
optimizeDeps: {
|
|
29
|
+
exclude: ["@alwith/module-chat"],
|
|
30
|
+
include: ["use-sync-external-store/shim", "use-sync-external-store/shim/with-selector"]
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Local linked development requires React deduplication in the app bundler; React is a peer, never bundled into chat. Bun component tests alias linked React to the real consumer React exports without installing a global DOM.
|
|
25
35
|
|
|
26
36
|
Run bun install at the workspace root, then bun check --no-script --cwd packages/chat and bun run test:chat. Consumer DOM tests live in both apps and cover the shared implementations through their real app adapters.
|
|
27
37
|
|
|
28
38
|
ACP session folding stays in @alwith/api. This package owns chat presentation and interaction, not Agent processes or a second session database.
|
|
29
39
|
|
|
30
|
-
`
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
`session-timeline` exports `SessionTimeline`, the whole conversation stream of one session: turns
|
|
41
|
+
grouped from the `@alwith/api` session, Codex activity, plans, edited files, async questions,
|
|
42
|
+
capacity retry, sparse native history and the navigation rail, in the virtual list, following the
|
|
43
|
+
stream until the user scrolls away. The application passes the session, a client (the
|
|
44
|
+
`@nyssance/codex-acp-v2/client` `CodexClient`, or anything with its store and history and retry
|
|
45
|
+
requests) and a `SessionTimelineHost`: the `ActivityHost` plus theme, and optionally file saving,
|
|
46
|
+
diff opening, file icons, tool relabelling and error reporting. Product content goes into slots:
|
|
47
|
+
`leading`, `afterTurn`, `answerActions`, `turnFooter`, `renderUserMessage` and `insert`. `navigation`
|
|
48
|
+
turns the rail on with the application's audio; `anchorNewTurn` anchors a new prompt at the top
|
|
49
|
+
instead of following the bottom; `Viewport` replaces the scrolling element. Key the component by
|
|
50
|
+
session. This entry needs `@nyssance/codex-acp-v2` installed; it is an optional peer for the rest. `turns` exports the grouping for search sources and diagnostics, and `timeline-registry`
|
|
51
|
+
lets search reveal a turn in the mounted timeline. `resource-content` renders a file, link or image the way the timeline does, for an application's `Markdown` inside it; outside the timeline, wrap it in `TimelineProvider`. The update scheduler moved to `@alwith/api/client`.
|
|
52
|
+
|
|
53
|
+
`conversation` exports `ConversationView`, one session's whole chat surface: the timeline, the
|
|
54
|
+
restoring, detached, stopped and read-only states, inline permission and URL requests, the form
|
|
55
|
+
dialog, the diff dialog and the `Composer`. The application passes the session, a
|
|
56
|
+
`ConversationClient` (`CodexClient` satisfies it) and a `ConversationHost`: the timeline host plus
|
|
57
|
+
optional long-paste files (`writeTextAttachment`) and titles for its own tools (`permissionTitle`,
|
|
58
|
+
`toolTitle`). Product content goes into slots: `header`, `overlay` (search, previews), `timeline`
|
|
59
|
+
(the `SessionTimeline` slots), `composer` and `children` (application dialogs). Errors go to
|
|
60
|
+
`host.reportError`; a `ReportedError` carries a `description` under its message. Key the view by
|
|
61
|
+
session.
|
|
62
|
+
|
|
63
|
+
The `Composer` keeps a draft per session (text, images, mentions) for the life of the page and
|
|
64
|
+
exposes it through `drafts`, `exportDraft`, `importDraft` and `setComposerDraft` for other windows
|
|
65
|
+
and extensions. Its footer has slash commands, `PermissionModeMenu`, `UsageMeter`, `ModelMenu` and
|
|
66
|
+
send, steer and stop. Hosts add tools before the send button through `actions` and adapters inside
|
|
67
|
+
the form through `children`; both read the composer through `useComposer()` (session, readiness,
|
|
68
|
+
the draft port, the interrupt hook for dictation and the receipt observer for hands-free turns).
|
|
69
|
+
`modelMenu` supplies the catalog policy (group order, decorations, short labels, a header action);
|
|
70
|
+
`modelSelector` replaces the menu, such as before a draft session exists. `ModelMenu` and
|
|
71
|
+
`PermissionModeMenu` write through `client.setConfig` unless the host passes `onConfigChange`, and
|
|
72
|
+
`ActionCard` answers through `client.respond` unless it passes `onRespond`. Outside a
|
|
73
|
+
`ConversationView`, wrap these in `ConversationProvider`.
|
|
74
|
+
|
|
75
|
+
`session-list` exports the sidebar's session list: project groups with five rows each and
|
|
76
|
+
"Show all", loading rows and retry, `SessionRow` with rename, fork or restore, archive, delete and
|
|
77
|
+
stop, the `SessionInfoCard` hover card, `ArchivedSessions` and the hooks behind them
|
|
78
|
+
(`useActivityPreview`, `useProjectSessions`). `SessionListProvider` takes the host and client and
|
|
79
|
+
owns the delete confirmation; slots add the application's row actions and group headers. Import
|
|
80
|
+
`@alwith/module-chat/session-list.css` once.
|
|
39
81
|
|
|
40
82
|
`search` provides Desktop's complete find bar, DOM matching, highlights and navigation. The host supplies its viewport, labels and native-menu subscription; virtualized callers also supply source matches and an async turn-reveal callback. Key the component by session identity to discard the previous search on a session switch. Highlight ownership is per mounted search, and cancelled navigation cannot repaint after close. Source projection stays with the application's message model; the search component never reads a private store.
|
|
41
83
|
|
package/dist/activity-host.d.ts
CHANGED
package/dist/activity-host.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{nr,a,h}from"./chunk-1wc83vxg.js";export{nr as ActivityHostProvider,h as ActivityMarkdown,a as useActivityHost};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Re}from"../chunk-51qsyrd6.js";import{e}from"../chunk-a7mr12yc.js";import{ge}from"../chunk-9bjywaze.js";import{l}from"../chunk-1hy64ewz.js";import{f}from"../chunk-ek06eyp4.js";import{V,M}from"../chunk-zcrct67v.js";import{k}from"../chunk-ncekagm6.js";import{Fn,Et,ie,ct}from"../chunk-0vvn08gg.js";import{autoUpdate as j}from"@floating-ui/dom";import{cn as B}from"cn";import{useCallback as Q,useEffect as H,useLayoutEffect as O,useMemo as _,useRef as G,useState as R}from"react";import{createPortal as W}from"react-dom";import{jsx as i,jsxs as m}from"react/jsx-runtime";var c="__other__";function le({current:r,total:F,anchorRef:N,t:p,onAccept:A,onDecline:I}){let x=_(()=>r?Fn(r.requestedSchema):[],[r]),[S,b]=R({}),T=G(null);H(()=>{if(r?.elicitationId===void 0)return;let t={};for(let{key:a,property:o}of x)if(!ie(o)){let u=ct(o)[0];if(u)t[a]={selected:u.value}}b(t)},[r?.elicitationId,x]),H(()=>{if(r?.elicitationId!==void 0&&T.current&&document.activeElement?.tagName!=="INPUT"&&document.activeElement?.tagName!=="TEXTAREA")T.current.focus()},[r?.elicitationId]);let[y,L]=R(null),[C,z]=R(null),E=Q(()=>{let t=N.current;if(!t)return;let a=t.getBoundingClientRect();if(a.width===0){let o=Math.min(640,window.innerWidth*0.9);L({left:(window.innerWidth-o)/2,width:o,bottom:24});return}L({left:a.left,width:a.width,bottom:window.innerHeight-a.bottom+20})},[N]);O(()=>{if(!r)return;let t=0,a=()=>{if(N.current){E();return}t=requestAnimationFrame(a)};return a(),()=>cancelAnimationFrame(t)},[r,E,N]),O(()=>{let t=N.current;if(!r||!t||!C)return;return j(t,C,E,{animationFrame:!0})},[r,C,N,E]);let U=_(()=>{if(!r)return!1;for(let{key:t,property:a}of x){let o=S[t];if(!o)return!1;if(ie(a)){if(!o.selectedSet||o.selectedSet.size===0)return!1;if(o.selectedSet.has(c)&&!o.otherText?.trim())return!1}else{if(!o.selected)return!1;if(o.selected===c&&!o.otherText?.trim())return!1}}return!0},[r,x,S]),D=Q(async()=>{if(!r)return;if(!U)return;let t={},a={};for(let{key:o,property:u}of x){let d=S[o];if(!d)continue;let g;if(ie(u))t[o]=[...d.selectedSet??[]].map((v)=>v===c?(d.otherText??"").trim():v).filter(Boolean);else{let v=d.selected??"";if(t[o]=v===c?(d.otherText??"").trim():v,v!==c)g=ct(u).find((s)=>s.value===v)?.preview}let h=d.notes?.trim();if(g||h)a[o]={...g&&{preview:g},...h&&{notes:h}}}await A(r.elicitationId,t,a)},[r,x,S,U,A]),q=Q(async()=>{if(r)await I(r.elicitationId)},[r,I]);if(!r||!y)return null;return W(m("div",{"data-overlay":"ask-user-question",tabIndex:0,onKeyDown:(t)=>{if(t.key==="Escape")t.preventDefault(),q()},className:"bg-card border-border fixed z-50 flex flex-col overflow-hidden rounded-lg border shadow-lg outline-none",style:{left:y.left,width:y.width,bottom:y.bottom,maxHeight:"70vh"},ref:(t)=>{T.current=t,z(t)},children:[m("div",{className:"border-border flex shrink-0 items-center justify-between gap-2 border-b px-3 py-2",children:[i("div",{className:"text-foreground text-sm font-medium",children:p("askUserQuestion.title")}),F>1&&i("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${F}`})]}),i("div",{className:"min-h-0 flex-1 overflow-y-auto",children:i("div",{className:"space-y-4 px-3 py-3",children:x.map(({key:t,property:a},o)=>{let u=S[t],d=u?.selected,g=u?.selectedSet??new Set,h=ct(a),v=ie(a);return m("div",{className:"space-y-2",children:[m("div",{className:"flex items-center gap-2",children:[i(Re,{variant:"secondary",className:"font-mono text-[10px] tracking-wide uppercase",children:Et(a).title??t}),i("div",{className:"text-foreground text-sm font-medium",children:Et(a).description})]}),v?m("div",{className:"space-y-1.5 ps-1",children:[h.map((s)=>m("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[i(ge,{checked:g.has(s.value),onCheckedChange:(n)=>{b((w)=>{let P=new Set(w[t]?.selectedSet??new Set);if(n)P.add(s.value);else P.delete(s.value);return{...w,[t]:{...w[t],selectedSet:P}}})}}),m("div",{className:"min-w-0 flex-1",children:[i("div",{className:"text-foreground text-sm",children:s.label}),s.description&&i("div",{className:"text-muted-foreground text-xs",children:s.description})]})]},s.value)),m("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[i(ge,{checked:g.has(c),onCheckedChange:(s)=>{b((n)=>{let w=new Set(n[t]?.selectedSet??new Set);if(s)w.add(c);else w.delete(c);return{...n,[t]:{...n[t],selectedSet:w}}})}}),i("div",{className:"text-foreground min-w-0 flex-1 text-sm",children:p("askUserQuestion.other")})]}),g.has(c)&&i("div",{className:"ps-7",children:i(l,{placeholder:p("askUserQuestion.otherPlaceholder"),value:u?.otherText??"",onChange:(s)=>b((n)=>({...n,[t]:{...n[t],otherText:s.target.value}}))})})]}):m(V,{value:d??"",onValueChange:(s)=>b((n)=>({...n,[t]:{...n[t],selected:s}})),className:"space-y-1.5 ps-1",children:[h.map((s)=>{let n=`${o}:${s.value}`;return m("div",{className:B("hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",d===s.value&&"bg-muted/60"),children:[i(M,{value:s.value,id:n}),m(f,{htmlFor:n,className:"min-w-0 flex-1 cursor-pointer",children:[i("div",{className:"text-foreground text-sm font-normal",children:s.label}),s.description&&i("div",{className:"text-muted-foreground text-xs font-normal",children:s.description})]})]},s.value)}),m("div",{className:B("hover:bg-muted/40 flex items-center gap-2 rounded-sm px-1.5 py-1",d===c&&"bg-muted/60"),children:[i(M,{value:c,id:`${o}:other`,className:"mt-0.5"}),i(f,{htmlFor:`${o}:other`,className:"text-foreground min-w-0 flex-1 cursor-pointer text-sm font-normal",children:p("askUserQuestion.other")})]}),d===c&&i("div",{className:"ps-7",children:i(l,{placeholder:p("askUserQuestion.otherPlaceholder"),value:u?.otherText??"",onChange:(s)=>b((n)=>({...n,[t]:{...n[t],otherText:s.target.value}}))})})]}),!v&&d&&d!==c&&(()=>{let s=h.find((n)=>n.value===d)?.preview;if(!s)return null;return i("pre",{className:"bg-muted/50 text-muted-foreground ms-1 mt-1 overflow-auto rounded-sm px-2 py-1.5 font-mono text-[11px] whitespace-pre-wrap",children:s})})(),h.some((s)=>s.preview)&&i(k,{placeholder:p("askUserQuestion.notesPlaceholder"),value:u?.notes??"",onChange:(s)=>b((n)=>({...n,[t]:{...n[t],notes:s.target.value}})),rows:1,className:"min-h-0 resize-none text-xs"})]},t)})})}),m("div",{className:"border-border bg-card flex shrink-0 items-center justify-end gap-2 border-t px-3 py-2",children:[i(e,{variant:"ghost",size:"sm",onClick:()=>void q(),children:p("askUserQuestion.cancel")}),i(e,{size:"sm",disabled:!U,onClick:()=>void D(),children:p("askUserQuestion.submit")})]})]}),document.body)}export{le as ChoiceElicitationForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Fn,Et,ie,ct}from"../chunk-0vvn08gg.js";export{Fn as elicitationFields,Et as elicitationLabels,ct as elicitationOptions,ie as isMultiSelect};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{mr,Bn,Kr,Qr}from"../chunk-30g0y24x.js";export{mr as PERMISSION_KIND_GROUP_ORDER,Kr as isAllowKind,Qr as isAlwaysKind,Bn as sortPermissionOptions};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Ln}from"../chunk-tre0r8qm.js";import"../chunk-30g0y24x.js";export{Ln as PermissionView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{kr,ur,Tr,Dn}from"../chunk-sgbde4dv.js";import"../chunk-st90r31c.js";import"../chunk-4mnf89r3.js";import"../chunk-9bjywaze.js";import"../chunk-qbdqh38y.js";import"../chunk-1hy64ewz.js";import"../chunk-cw68hvkc.js";import"../chunk-ek06eyp4.js";import"../chunk-zcrct67v.js";import"../chunk-ncekagm6.js";import"../chunk-a7mr12yc.js";export{Dn as SchemaElicitationForm,kr as elicitationFields,ur as initialValues,Tr as isAnswered};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{_n}from"../chunk-86kkb0z4.js";import"../chunk-d6nxypzc.js";import"../chunk-a7mr12yc.js";export{_n as UrlElicitationCard};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Ce}from"./chunk-j4teycge.js";import{D,Pn}from"./chunk-p0cc67an.js";import{t}from"./chunk-yx02h2ja.js";import{On}from"./chunk-cr294svm.js";import{ne,oe,re}from"./chunk-k50475tn.js";import{cn as d}from"cn";import{SquareIcon as b}from"lucide-react";import{jsx as o,jsxs as n,Fragment as h}from"react/jsx-runtime";var f=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform);function yn({active:a,sending:r,ready:p,hasMentions:m=!1,onStop:c}){let{t:e}=t(),s=Ce(),u=m||s.textInput.value.trim().length>0||s.attachments.files.length>0,l=!p||r||!u,i=a?e("composer.steer"):e("composer.send");return n(h,{children:[a&&o(D,{"aria-label":e("composer.stop"),title:e("composer.stop"),className:"border-border size-7 rounded-full border",onClick:c,children:o(b,{className:"size-3 fill-current"})}),o("div",{className:d(l&&"cursor-not-allowed"),children:n(ne,{children:[o(oe,{render:o(Pn,{"aria-label":i,disabled:l,"aria-busy":r,status:r?"submitted":"ready"})}),n(re,{role:"tooltip",children:[o("span",{className:"min-w-0",children:i}),o(On,{className:"shrink-0",children:f?"↩":"Enter"})]})]})})]})}
|
|
2
|
+
export{yn};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var i=new Map,a=new Map,f=new Map;function Mn(t,r){if(a.has(t))throw Error("An attachment writer is already registered for this session");return a.set(t,r),()=>{if(a.get(t)===r)a.delete(t)}}function T(t,r){let n=i.get(t);if(!n)return;let e=r(n.attachments);i.set(t,{...n,attachments:e}),a.get(t)?.(e)}function Ze(t,r){f.set(t,r),r.finally(()=>{if(f.get(t)===r)f.delete(t)})}async function lr(t){for(;;){let e=i.get(t)?.attachments.flatMap((c)=>{let m=f.get(c.id);return m?[m]:[]})??[];if(!e.length)break;await Promise.all(e)}let r=i.get(t);if(!r)return null;let n=await Promise.all(r.attachments.map(async(e)=>{if(!e.url.startsWith("blob:"))return e;let c=await fetch(e.url);if(!c.ok)throw Error("Cannot read draft image");let m=await c.blob(),l=await new Promise((g,p)=>{let o=new FileReader;o.onload=()=>g(o.result),o.onerror=()=>p(o.error),o.readAsDataURL(m)});return{...e,url:l}}));return{text:r.text,mentions:[...r.mentions],attachments:n,modelId:r.modelId}}function cr(t,r){if(r===null)i.delete(t);else i.set(t,r)}var s=new Map;function Je(t,r){if(s.has(t))throw Error("A composer is already registered for this session");return s.set(t,r),()=>{if(s.get(t)===r)s.delete(t)}}function dr(t,r){if(typeof r!=="string"||!r.trim())throw Error("The draft is empty");let n=s.get(t);if(!n)throw Error("The session's composer is not open; open the session first");let e=i.get(t);if(e&&(e.text.length||e.attachments.length||e.mentions.length))throw Error("The composer already has a draft; send or clear it first");n(r),i.set(t,{text:r,attachments:[],mentions:[],modelId:e?.modelId??null})}
|
|
2
|
+
export{i,Mn,T,Ze,lr,cr,Je,dr};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function Fn(t){return Object.entries(t.properties??{}).map(([n,e])=>({key:n,property:e}))}function Et(t){let{title:n,description:e}=t;return{title:n??void 0,description:e??void 0}}function ie(t){return t.type==="array"}function ct(t){return(ie(t)?t.items?.oneOf??[]:t.oneOf??[]).map((e)=>{let i=e,r=i.const??i.title??"";return{value:r,label:i.title??r,...i.description?{description:i.description}:{},...i._meta?.alwith?.preview?{preview:i._meta.alwith.preview}:{}}})}
|
|
2
|
+
export{Fn,Et,ie,ct};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{o}from"./chunk-yx02h2ja.js";import{e}from"./chunk-a7mr12yc.js";import{uo}from"./chunk-e43pfcrt.js";import{ae,se,le,ce}from"./chunk-qpz97p1m.js";import{n,y}from"./chunk-vxnjsga5.js";import{Loader2Icon as u}from"lucide-react";import{jsx as i,jsxs as m}from"react/jsx-runtime";function qe({session:t,timeline:l}){let{host:s,client:a}=n(),{t:r}=s,c=o((f)=>f.historyPages[t.id]?.cursor!=null),d=()=>y(s,a.open(t.id,t.cwd)),p=i(uo,{...l,session:t,client:a,host:s});if(t.restoring)return t.items.length===0?m("div",{className:"text-muted-foreground flex flex-1 items-center justify-center gap-2 text-sm",children:[i(u,{className:"size-4 animate-spin","aria-hidden":"true"}),r("conversation.restoring")]}):p;if(!t.attached&&t.items.length===0)return m(ae,{className:"flex-1",children:[m(se,{children:[i(le,{children:r("conversation.reopen")}),i(ce,{children:r("conversation.detached")})]}),i(e,{onClick:d,children:r("conversation.reopen")})]});if(t.items.length===0&&t.state==="idle"&&!c)return i(ae,{className:"flex-1",children:m(se,{children:[i(le,{className:"text-[28px] font-normal",children:r("conversation.welcomeTitle")}),i(ce,{className:"truncate font-mono",children:t.cwd})]})});return p}
|
|
2
|
+
export{qe};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var Q="quick-chats";function E(e){let t=n(e);if(/^[a-z]:\//i.test(t)||t.startsWith("//"))return/^[a-z]:\/users\/[^/]+\/documents\/(codex(?:\/.*)?|alwith)$/.test(t);return/^\/Users\/[^/]+\/Documents\/(Codex(?:\/.*)?|ALwith)$/.test(e.replace(/\/+$/,""))}function n(e){return e.replaceAll("\\","/").replace(/^\/\/\?\/UNC\//i,"//").replace(/^\/\/\?\//,"").replace(/\/+$/,"").toLowerCase()}function he(e){let t=new Map([["quick-chats",[]]]);for(let r of[...e].toSorted((s,o)=>(o.updatedAt??"").localeCompare(s.updatedAt??""))){let s=E(r.cwd)?"quick-chats":r.cwd,o=t.get(s);if(o)o.push(r);else t.set(s,[r])}return[...t]}function B(e){let t=e.replaceAll("\\","/").replace(/\/+$/,"").split("/").pop();return t?t:e}
|
|
2
|
+
export{Q,E,he,B};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Input as t}from"@base-ui/react/input";import{cn as n}from"cn";import{jsx as o}from"react/jsx-runtime";function
|
|
1
|
+
import{Input as t}from"@base-ui/react/input";import{cn as n}from"cn";import{jsx as o}from"react/jsx-runtime";function l({className:i,type:e,...r}){return o(t,{type:e,"data-slot":"input",className:n("border-input file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 h-9 w-full min-w-0 rounded-md border bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:ring-3 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3 md:text-sm",i),...r})}export{l};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createContext as i,useContext as r}from"react";import{jsx as n}from"react/jsx-runtime";var e=i(null);function nr({host:t,children:o}){return n(e.Provider,{value:t,children:o})}function a(){let t=r(e);if(t===null)throw Error("Activity host is missing");return t}function h(t){let{Markdown:o}=a();return n(o,{...t})}
|
|
2
|
+
export{nr,a,h};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{C,rn,Jo,an,er,sn,tr}from"./chunk-cj5pkg2y.js";import{t,J,be,o}from"./chunk-yx02h2ja.js";import{isText as D}from"@alwith/api";import{createStore as E}from"@alwith/api/client";import{nativeTurnId as y}from"@nyssance/codex-acp-v2/client";import{jsx as f,jsxs as R}from"react/jsx-runtime";var I=E({entries:{}});function m(n,s){I.setState((e)=>({entries:{...e.entries,[n]:s}}))}function v(n,s){let e=y(s),r=n.items.findLast((a)=>y(a)!==null),p=n.items.some((a)=>a.kind==="user"&&y(a)===e&&n.turnEndedAt[a.id]!==void 0);return!s.replayed&&e!==null&&r!==void 0&&n.state!=="idle"&&!p&&y(r)===e}function N(n,s){for(let e of n.items){if(e.kind!=="user"||e.echo==="pending")continue;for(let r of[...sn(e._meta),...e.content.filter(D).flatMap((p)=>sn(p._meta))])if(r.questionItemId===s)return r.answer}return}function M({sessionId:n,item:s,question:e,index:r}){let p=J(),{t:a}=t(),x=rn(s.id,r),c=JSON.stringify([n,x]),l=be(I,(i)=>i.entries[c]),u=o((i)=>i.sessions[n]),k=o((i)=>i.connection==="ready"),d=l?.draft??Jo(e),Q=u===void 0?l?.accepted:N(u,x)??l?.accepted,h=u!==void 0&&v(u,s),A=k&&u?.attached&&!u.restoring&&!u.readOnly,g=Q!==void 0?"answered":l?.skipped?"skipped":l?.pending?"submitting":!h?"closed":!A?"unavailable":"pending",q=async()=>{if(I.getState().entries[c]?.pending||g!=="pending")return;let i=p.state.sessions[n];if(i===void 0||!v(i,s)||!i.attached||i.readOnly||i.restoring)return;let w=an(e,d);if(!w.trim())return;let b={questionItemId:x,question:e.title,answer:w};m(c,{draft:d,pending:!0});try{await p.prompt(n,[{type:"text",text:er(b),_meta:{codex:{questionReply:b}}}]),m(c,{draft:d,accepted:w})}catch(S){m(c,{draft:d,error:S instanceof Error?S.message:String(S)})}};if(g==="closed")return R("section",{className:"text-muted-foreground flex min-w-0 flex-col gap-1 text-sm","aria-label":e.title,children:[f("p",{className:"whitespace-pre-wrap",children:e.title}),d.text.trim()&&f("p",{className:"whitespace-pre-wrap",children:d.text}),f("span",{role:"status",className:"text-xs",children:a("asyncQuestion.closed")})]});return f(tr,{question:e,draft:d,status:g,answer:Q,error:g==="pending"?l?.error:void 0,t:a,onChange:(i)=>m(c,{draft:i}),onSkip:()=>m(c,{draft:d,skipped:!0}),onSubmit:()=>{q()}})}function yo({sessionId:n,item:s}){return f("div",{className:"flex min-w-0 flex-col gap-3","data-async-questions":s.id,children:C(s._meta).map((e,r)=>f(M,{sessionId:n,item:s,question:e,index:r},rn(s.id,r)))})}
|
|
2
|
+
export{yo};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Be}from"./chunk-vyzzs0nc.js";import{Eo}from"./chunk-2sy8cs84.js";import{t}from"./chunk-yx02h2ja.js";import{L}from"./chunk-h80g3eme.js";import{isContentEntry as p,isEmbeddedResource as a,isResourceLink as f}from"@alwith/api";import{memo as g,useMemo as k}from"react";import{jsx as s,jsxs as u,Fragment as R}from"react/jsx-runtime";function y({item:n}){if(n.name==="view_image"&&n.status==="completed")return null;let r=n.content.filter(p).filter((e)=>a(e.content)||f(e.content));if(r.length===0)return null;return u("fieldset",{className:"mt-1 min-w-0",children:[s("legend",{className:"text-muted-foreground text-xs",children:n.title??n.name}),r.map((e,l)=>s(L,{block:e.content},`${n.id}:${l}`))]})}var So=g(function({sessionId:r,items:e,terminals:l,streamingThoughtId:m}){let i=t().toolBlock,d=k(()=>e.map((o)=>{let c={...Eo(o,l,o.kind==="thought"&&o.id===m),id:JSON.stringify([r,o.id])};return c.type==="tool_use"&&o.kind==="tool"&&i!==void 0?i(c,o):c}),[r,e,l,m,i]);return u(R,{children:[s(Be,{blocks:d}),e.map((o)=>o.kind==="tool"&&s(y,{item:o},o.id))]})});
|
|
2
|
+
export{So};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a}from"./chunk-1wc83vxg.js";import{N}from"./chunk-acrrwrzy.js";import{isContentEntry as k,isImage as b,isResourceLink as w}from"@alwith/api";import{ChevronRightIcon as C,ImageIcon as S,LoaderCircleIcon as A,RefreshCwIcon as R}from"lucide-react";import{useEffect as B,useState as h}from"react";import{jsx as n,jsxs as y}from"react/jsx-runtime";function ye(e){return e.type==="tool_use"&&e.name==="view_image"&&e.status==="completed"}function T(e){let r=[];for(let[c,l]of e.content.entries()){if(!k(l))continue;let o=l.content;if(b(o))r.push({key:`${e.id}:${c}`,src:`data:${o.mimeType};base64,${o.data}`,alt:e.title??""});if(w(o))r.push({key:`${e.id}:${c}`,path:o.uri,alt:o.name})}if(r.length)return r;let i=e.rawInput;if(i!==null&&typeof i==="object"&&"path"in i&&typeof i.path==="string")return[{key:e.id,path:i.path,alt:i.path.split(/[\\/]/).at(-1)??i.path}];throw Error(`Image view ${e.id} has no image source`)}function E({images:e}){let{loadImage:r,openImageGallery:i,openImage:c,t:l}=a(),[o,g]=h({}),[v,x]=h(0),f=JSON.stringify(e);B(()=>{let t=!0,u=JSON.parse(f);g({});for(let s of u)(s.src!==void 0?Promise.resolve(s.src):s.path!==void 0&&r?r(s.path):Promise.reject(Error("Image loading is unavailable"))).then((d)=>{if(t)g((p)=>({...p,[s.key]:{src:d}}))},()=>{if(t)g((d)=>({...d,[s.key]:{error:!0}}))});return()=>{t=!1}},[f,r,v]);let I=e.flatMap((t)=>{let u=o[t.key];return u&&"src"in u?[{src:u.src,alt:t.alt}]:[]});return n("div",{className:"codex-image-thumbnails",children:e.map((t,u)=>{let s=o[t.key];if(!s)return n("div",{className:"codex-image-thumbnail",role:"status","aria-label":l("stream.codex.imageLoading"),children:n(A,{className:"motion-safe:animate-spin","aria-hidden":"true"})},t.key);if("error"in s)return n("button",{type:"button",className:"codex-image-thumbnail",title:t.alt,"aria-label":l("stream.codex.imageFailed"),onClick:()=>x((m)=>m+1),children:n(R,{"aria-hidden":"true"})},t.key);return n("button",{type:"button",className:"codex-image-thumbnail",title:t.alt,onClick:()=>{let m=e.slice(0,u).filter((d)=>{let p=o[d.key];return p&&"src"in p}).length;if(i)i(I,m);else c?.(s.src)},children:n("img",{src:s.src,alt:t.alt,draggable:!1})},t.key)})})}function Mo({blocks:e}){let{t:r}=a(),i=e.flatMap(T),[c,l]=N(`image-view:${e[0].id}`,!1);return y("div",{className:"codex-activity-item",children:[y("button",{type:"button",className:"codex-activity-header","data-codex-disclosure":"","aria-expanded":c,onClick:()=>l((o)=>!o),children:[y("span",{className:"codex-activity-label",children:[n(S,{className:"codex-activity-icon","aria-hidden":"true"}),n("span",{className:"codex-activity-leading",children:r("stream.codex.viewedImages",{count:i.length})})]}),n(C,{className:c?"codex-image-chevron codex-image-chevron-open":"codex-image-chevron","aria-hidden":"true"})]}),c&&n(E,{images:i})]})}
|
|
2
|
+
export{ye,Mo};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Marked as p}from"marked";import k from"marked-linkify-it";var h=/<(task-notification|system-reminder|antml:[\w-]+)\b[^>]*>/,m=/^<(task-notification|system-reminder|antml:[\w-]+)\b[^>]*>[\s\S]*?(?:<\/\1\s*>|$)/,d=/^(?:\$\$([\s\S]+?)\$\$|\\\[([\s\S]+?)\\\])/,x={extensions:[{name:"math",level:"block",tokenizer(n){let t=d.exec(n);if(t===null)return;return{type:"math",raw:t[0],text:(t[1]??t[2]).trim(),display:!0}}},{name:"math",level:"inline",start(n){return n.search(/\$|\\[([]/)},tokenizer(n){let t=d.exec(n);if(t!==null)return{type:"math",raw:t[0],text:(t[1]??t[2]).trim(),display:!0};let r=/^\\\(([^\n]+?)\\\)/.exec(n);if(r!==null)return{type:"math",raw:r[0],text:r[1].trim(),display:!1};let i=/^\$(?!\$)((?:\\[^\n]|[^\\$\n])+?)\$(?![\d$])/.exec(n);if(i===null||/^\s|\s$/.test(i[1]))return;return{type:"math",raw:i[0],text:i[1],display:!1}}}]};function
|
|
2
|
-
export{
|
|
1
|
+
import{Marked as p}from"marked";import k from"marked-linkify-it";var h=/<(task-notification|system-reminder|antml:[\w-]+)\b[^>]*>/,m=/^<(task-notification|system-reminder|antml:[\w-]+)\b[^>]*>[\s\S]*?(?:<\/\1\s*>|$)/,d=/^(?:\$\$([\s\S]+?)\$\$|\\\[([\s\S]+?)\\\])/,x={extensions:[{name:"math",level:"block",tokenizer(n){let t=d.exec(n);if(t===null)return;return{type:"math",raw:t[0],text:(t[1]??t[2]).trim(),display:!0}}},{name:"math",level:"inline",start(n){return n.search(/\$|\\[([]/)},tokenizer(n){let t=d.exec(n);if(t!==null)return{type:"math",raw:t[0],text:(t[1]??t[2]).trim(),display:!0};let r=/^\\\(([^\n]+?)\\\)/.exec(n);if(r!==null)return{type:"math",raw:r[0],text:r[1].trim(),display:!1};let i=/^\$(?!\$)((?:\\[^\n]|[^\\$\n])+?)\$(?![\d$])/.exec(n);if(i===null||/^\s|\s$/.test(i[1]))return;return{type:"math",raw:i[0],text:i[1],display:!1}}}]};function Go(){let n=new p({gfm:!0}),t=k(),r=t.extensions[0],i=r.tokenizer;r.tokenizer=function(o,a){let e=i.call(this,o,a);if(e===void 0)return;if(e.raw.startsWith("<"))return e;let l=/^(?:[a-z][a-z\d+.-]*:\/\/|www\.)[^/?#]+[/?#]/i.exec(e.raw);if(l===null)return e;let c=l[0].length-1,u=e.raw.slice(c).search(/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u);if(u===-1)return e;let s=e.raw.slice(0,c+u),f=e.href.slice(0,e.href.length-(e.raw.length-s.length));return{...e,raw:s,href:f,text:s,tokens:[{type:"text",raw:s,text:s}]}},n.use(x,t);for(let o of["block","inline"])n.use({extensions:[{name:"internalMessage",level:o,...o==="inline"?{start(a){return h.exec(a)?.index}}:{},tokenizer(a){let e=m.exec(a);if(e===null)return;return{type:"internalMessage",raw:e[0]}},renderer(){return""}}]});return n}function tn(n){let t=n.replaceAll(/[\p{Cc}\s]/gu,"");return!/^(?:data|javascript|vbscript):/i.test(t)}
|
|
2
|
+
export{Go,tn};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{Po}from"./chunk-zzwnpk4q.js";import{CheckIcon as N,ChevronDownIcon as E,CopyIcon as w,FileIcon as k}from"lucide-react";import{useEffect as H,useLayoutEffect as I,useRef as T,useState as b}from"react";import{jsx as e,jsxs as g,Fragment as y}from"react/jsx-runtime";var A=20,L='a[href], area[href], button, input, select, textarea, summary, audio[controls], video[controls], iframe, [contenteditable]:not([contenteditable="false"]), [tabindex]:not([tabindex="-1"])';function h(n,o,s){if(n.toggleAttribute("inert",!o),!o){n.setAttribute("aria-hidden","true");return}if(s===null)n.removeAttribute("aria-hidden");else n.setAttribute("aria-hidden",s)}function R(n,o){let s=n.getBoundingClientRect(),i=o.getBoundingClientRect();return s.top>=i.top&&s.right<=i.right&&s.bottom<=i.bottom&&s.left>=i.left}function M({text:n,host:o}){let{t:s,Markdown:i}=o,c=T(null),[l,p]=b(!1),[d,f]=b(!1);return I(()=>{let r=c.current;if(!r)throw Error("Codex user message content is missing");let t=()=>{if(r.scrollHeight===0){p(!1);return}let x=Number.parseFloat(getComputedStyle(r).lineHeight);if(!Number.isFinite(x))throw Error("Codex user message line height is invalid");p(r.scrollHeight>A*x+1)};t();let u=new ResizeObserver(t);return u.observe(r),()=>u.disconnect()},[]),H(()=>{if(!l||d)return;let r=c.current;if(!r)throw Error("Codex user message content is missing");let t=new Map,u=typeof IntersectionObserver>"u"?null:new IntersectionObserver((a)=>{for(let m of a){let v=m.target;if(!t.has(v))continue;h(v,m.isIntersecting&&m.intersectionRatio>=1,t.get(v))}},{root:r,rootMargin:"0px",threshold:1}),x=()=>{for(let a of t.keys()){if(r.contains(a))continue;u?.unobserve(a),t.delete(a)}for(let a of r.querySelectorAll(L)){if(t.has(a)||a.hasAttribute("inert"))continue;let m=a.getAttribute("aria-hidden");t.set(a,m),h(a,u===null&&R(a,r),m),u?.observe(a)}};x();let C=new MutationObserver(x);return C.observe(r,{childList:!0,subtree:!0}),()=>{u?.disconnect(),C.disconnect();for(let[a,m]of t)h(a,!0,m)}},[l,d]),g("div",{className:"codex-user-message-content",children:[e("div",{ref:c,className:l&&!d?"codex-user-message-text codex-user-message-text-collapsed":"codex-user-message-text",children:e(i,{text:n,streaming:!1})}),l&&!d&&e("span",{className:"codex-user-message-ellipsis","aria-hidden":"true",children:"…"}),l&&g("button",{type:"button","aria-expanded":d,className:"codex-user-message-collapse-trigger",onClick:()=>{f((r)=>!r)},children:[e("span",{children:d?s("stream.codex.showLess"):s("stream.codex.showMore")}),e(E,{className:d?"codex-user-message-collapse-chevron codex-user-message-collapse-chevron-expanded":"codex-user-message-collapse-chevron","aria-hidden":"true"})]})]})}function Yt({text:n,label:o}){let[s,i]=b(!1);return e("button",{type:"button",className:"codex-message-action","aria-label":o,title:o,onClick:()=>{navigator.clipboard.writeText(n),i(!0),setTimeout(()=>i(!1),2000)},children:s?e(N,{className:"codex-message-action-confirmed"}):e(w,{})})}function S({image:n,openImage:o}){let[s,i]=b(!1),c=`data:${n.mimeType};base64,${n.data}`;return g(y,{children:[e("button",{type:"button",className:"codex-user-image",onClick:()=>o===void 0?i(!0):o(c),children:e("img",{src:c,alt:""})}),s&&e(Po,{src:c,alt:"",onClose:()=>i(!1)})]})}function To({message:n,text:o,textParts:s,mentions:i,images:c,messageTime:l,host:p,bubbleStyle:d}){let{t:f,openImage:r}=p;return e("div",{"data-content-search-unit-key":n.id,"data-message-id":n.id,className:"timeline-break codex-user-message scroll-mt-4",children:g("div",{className:"group/codex-user codex-user-message-group",children:[i.length>0&&e("div",{className:"codex-user-mentions",children:i.map((t)=>g("span",{className:"codex-user-mention",title:t.title,children:[e(k,{"aria-hidden":"true"}),e("span",{className:"codex-user-mention-label",children:t.label})]},t.key))}),c.length>0&&e("div",{className:"codex-user-images",children:c.map((t)=>e(S,{image:t,openImage:r},`${t.mimeType}:${t.data}`))}),o.length>0&&e(y,{children:e("div",{"data-user-message-bubble":!0,tabIndex:0,className:"codex-user-bubble",style:d,children:s?s.map((t,u)=>e("div",{className:"codex-user-text-part",children:t.question===void 0?e(M,{text:t.text,host:p}):g(y,{children:[e("div",{className:"codex-user-question-summary",title:t.question,children:t.question}),e("div",{className:"codex-user-question-answer",children:t.text})]})},u)):e(M,{text:o,host:p})})}),g("div",{className:"codex-user-actions",children:[e(Yt,{text:o,label:f("actions.copy")}),l&&e("span",{className:"codex-user-time",title:l.full,children:l.short})]})]})})}
|
|
2
|
+
export{Yt,To};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{s,r}from"./chunk-33mgpcnd.js";import{E}from"./chunk-1dp50khb.js";import{useEffect as f,useMemo as p}from"react";function pr(c){let e=s(),i=c===null?null:e.projectPath(c),u=r((t)=>t.sessionList),l=r((t)=>t.connection),n=r((t)=>t.sessionListLoaded),o=r((t)=>t.sessionListError),a=()=>e.listSessions({reset:!0}).catch(()=>{return});return f(()=>{if(l==="ready"&&!n&&o===null)e.listSessions().catch(()=>{return})},[e,l,n,o]),{result:p(()=>{if(n)return{status:"ready",sessionRows:u.filter((t)=>i===null?E(t.cwd):e.projectPath(t.cwd)===i).toSorted((t,d)=>(d.updatedAt??"").localeCompare(t.updatedAt??""))};if(o!==null)return{status:"failed",error:o};return{status:"loading"}},[e,u,n,o,i]),retry:a}}
|
|
2
|
+
export{pr};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{terminalOf as u,textOf as g}from"@alwith/api";function Eo(n,o,r){if(n.kind!=="tool"){let t=g(n.content),c=/^\s*\*\*([^\n]*?)\*\*\s*$/.exec(t);return{type:"thinking",id:n.id,thinking:c?c[1]:t,isComplete:!r}}if(n.name==="subagent"){let t=s(n.rawInput,n.id);return{type:"subagent",id:n.id,name:p(t.agentPath,n.id),threadId:f(t.agentThreadId,"agentThreadId",n.id),activity:y(t.activity,n.id),model:l(t.model,"model",n.id),reasoningEffort:l(t.reasoningEffort,"reasoningEffort",n.id),status:n.status??"pending",blocks:[]}}if(n.name==="collab"){let t=s(s(s(n._meta,n.id).codex,n.id).collaboration,n.id);if(typeof t.tool!=="string"||!Array.isArray(t.agents))throw Error(`Collaboration call ${n.id} lacks codex-acp-v2 agent metadata`);return{type:"collab",id:n.id,tool:t.tool,status:n.status??"pending",prompt:l(s(n.rawInput,n.id).prompt,"prompt",n.id),agents:t.agents}}let i=typeof n.rawInput==="object"&&n.rawInput!==null&&!Array.isArray(n.rawInput)?{...n.rawInput}:{},e=u(n,o);if(Array.isArray(i.command))i.command=i.command.map(String).join(" ");if(n.toolKind==="execute"&&typeof i.command!=="string"){let t=e?.command??n.title;if(t!==null)i.command=t}let a=n.rawOutput;if(typeof a==="object"&&a!==null&&"output"in a&&typeof a.output==="string")a=a.output;if(e!==null&&e.output.length>0)a=e.output;let d=e?.exitStatus?.exitCode;return{type:"tool_use",id:n.id,name:n.name??"",title:n.title??n.name??"",kind:n.toolKind??"other",status:n.status??"pending",content:n.content,locations:n.locations,rawInput:i,rawOutput:a,...typeof d==="number"?{exitCode:d}:{}}}function s(n,o){if(typeof n!=="object"||n===null||Array.isArray(n))throw Error(`Tool call ${o} is missing an object codex-acp-v2 always sends`);return n}function l(n,o,r){if(n===null||typeof n==="string")return n;throw Error(`Tool call ${r} has a non-string ${o}`)}function p(n,o){let r=typeof n==="string"?n.split("/").findLast(Boolean):void 0;if(r===void 0)throw Error(`Subagent ${o} has no agent path`);return r}function f(n,o,r){if(typeof n==="string")return n;throw Error(`Tool call ${r} has no ${o}`)}function y(n,o){if(n==="started"||n==="interacted"||n==="interrupted"||n==="completed")return n;throw Error(`Subagent ${o} has an unknown activity ${String(n)}`)}
|
|
2
|
+
export{Eo};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var mr={allow_once:0,allow_always:1,reject_once:2,reject_always:3};function Bn(e){return[...e].toSorted((o,n)=>(mr[o.kind]??99)-(mr[n.kind]??99))}function Kr(e){return e==="allow_once"||e==="allow_always"}function Qr(e){return e==="allow_always"||e==="reject_always"}
|
|
2
|
+
export{mr,Bn,Kr,Qr};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{e}from"./chunk-a7mr12yc.js";import{d,u,b,z,m,w}from"./chunk-cw68hvkc.js";import{X}from"./chunk-3m06tqqk.js";import{createContext as C,useContext as v,useState as L,useSyncExternalStore as h}from"react";import{jsx as i,jsxs as p}from"react/jsx-runtime";var f=C(null),x=C(null),D=C(null);function hr({host:t,client:o,children:n}){let[l,a]=L(null);X(l!==null);let{t:c}=t;return i(f,{value:t,children:i(x,{value:o,children:p(D,{value:a,children:[n,i(d,{open:l!==null,onOpenChange:(y)=>!y&&a(null),children:p(u,{children:[p(b,{children:[i(m,{children:c("sessionList.deleteTitle")}),i(w,{children:c("sessionList.deleteDescription")})]}),p(z,{children:[i(e,{variant:"outline",onClick:()=>a(null),children:c("sessionList.cancel")}),i(e,{onClick:()=>{if(l)S(t,o.delete(l.sessionId));a(null)},children:c("sessionList.delete")})]})]})})]})})})}function g(){let t=v(f);if(t===null)throw Error("Session list host is missing");return t}function s(){let t=v(x);if(t===null)throw Error("Session list client is missing");return t}function bt(){let t=v(D);if(t===null)throw Error("Session list provider is missing");return t}function r(t){let o=s();return h((n)=>o.store.subscribe(n),()=>t(o.store.getState()),()=>t(o.store.getState()))}function S(t,o){return o.then(()=>{},(n)=>{if(t.reportError)t.reportError(n);else console.error(n)})}
|
|
2
|
+
export{hr,g,s,bt,r,S};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var gi=280;function po({entries:i,gapPx:t,measuredHeightsByKey:o,leadingInsetPx:e=0}){let n=[],r=[],d=new Map,s=[],u=e;for(let[x,a]of i.entries()){d.set(a.turnKey,x);for(let h of a.aliases??[])d.set(h,x);s.push(a.turnKey),r.push(u);let f=a.aliases?.map((h)=>o[h]).find((h)=>h!==void 0),m=o[a.turnKey]??f??a.estimatedHeightPx??280;if(n.push(m),u+=m,x<i.length-1)u+=t}return{bottomOffsetsPx:r.map((x,a)=>{let f=n[a];if(f===void 0)throw Error(`Codex turn height is missing at index ${a}`);return u-x-f}),heightsPx:n,topOffsetsPx:r,totalHeightPx:u,turnIndexByKey:d,turnKeys:s}}function xe({distanceFromBottomPx:i,layout:t,overscanCount:o,viewportHeightPx:e}){if(t.turnKeys.length===0)return{startIndex:0,endIndex:0};let n=Math.min(Math.max(0,i),t.totalHeightPx),r=Math.min(n+Math.max(0,e),t.totalHeightPx),d=g(t.bottomOffsetsPx,r),s=l(t.bottomOffsetsPx,t.heightsPx,n);return{startIndex:Math.max(0,d-o),endIndex:Math.min(t.turnKeys.length,Math.max(s,d+1)+o)}}function jt({anchorKey:i,layout:t,previousRange:o}){let e=t.turnIndexByKey.get(i);if(e===void 0)return null;return{startIndex:e,endIndex:Math.min(t.turnKeys.length,e+o.endIndex-o.startIndex)}}function go({anchorKey:i,distanceFromBottomPx:t,nextLayout:o,previousLayout:e}){let n=e.turnIndexByKey.get(i),r=o.turnIndexByKey.get(i);if(n===void 0||r===void 0)return null;let d=e.bottomOffsetsPx[n],s=e.heightsPx[n],u=o.bottomOffsetsPx[r],x=o.heightsPx[r];if(d===void 0||s===void 0||u===void 0||x===void 0)throw Error(`Codex turn geometry is missing: ${i}`);return Math.max(0,t+u+x-d-s)}function fo({layout:i,turnKey:t,viewportHeightPx:o}){let e=i.turnIndexByKey.get(t);if(e===void 0)return null;let n=i.bottomOffsetsPx[e],r=i.heightsPx[e];if(n===void 0||r===void 0)throw Error(`Codex turn geometry is missing: ${t}`);return Math.max(0,n-o/2+r/2)}function ho({align:i,layout:t,targetHeightPx:o,targetOffsetPx:e,turnKey:n,viewportHeightPx:r}){let d=t.turnIndexByKey.get(n);if(d===void 0)return null;let s=t.bottomOffsetsPx[d],u=t.heightsPx[d];if(s===void 0||u===void 0)throw Error(`Codex turn geometry is missing: ${n}`);let x=s+u-e;return i==="top"?Math.max(0,x-r+10):Math.max(0,x-o/2-r/2)}function g(i,t){let o=0,e=i.length;while(o<e){let n=Math.floor((o+e)/2),r=i[n];if(r===void 0)throw Error(`Codex bottom offset is missing at index ${n}`);if(r<t)e=n;else o=n+1}return o}function l(i,t,o){let e=0,n=i.length;while(e<n){let r=Math.floor((e+n)/2),d=i[r],s=t[r];if(d===void 0||s===void 0)throw Error(`Codex turn geometry is missing at index ${r}`);if(d+s<=o)n=r;else e=r+1}return e}
|
|
2
|
+
export{gi,po,xe,jt,go,fo,ho};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)[0]??e("pattern")??e("url")??e("query")??e("description");return{category:o,...s===void 0?{}:{target:s},...n===void 0?{}:{filePath:n}}}function
|
|
3
|
-
export{
|
|
1
|
+
var hi=["full","compact","codexUI"];function Ro(t){return t==="compact"||t==="codexUI"}var Dr=["read","edit","delete","move","search","execute","think","fetch","switch_mode","other"];function c(t){let o=t.split(/[/\\]/).at(-1)??"";return o===""?t:o}function A(t){let o=Dr.includes(t.kind)?t.kind:"other",i=t.rawInput,e=(a)=>{let r=i[a];return typeof r==="string"&&r.length>0?r:void 0},n=t.locations?.[0]?.path??e("file_path")??e("notebook_path"),s=n!==void 0?c(n):e("command")?.split(`
|
|
2
|
+
`)[0]??e("pattern")??e("url")??e("query")??e("description");return{category:o,...s===void 0?{}:{target:s},...n===void 0?{}:{filePath:n}}}function vi(t,o){if(o)return"dot-permission";switch(t){case"completed":return"dot-success";case"failed":return"dot-error";case"in_progress":return"dot-in-progress";case"pending":return"dot-pending";case"interrupted":return"dot-interrupted";default:return console.warn("[acp] unknown tool call status:",t),"dot-pending"}}
|
|
3
|
+
export{hi,Ro,Dr,A,vi};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{o}from"./chunk-yx02h2ja.js";import{O,$t,F}from"./chunk-4dcagj01.js";import{e}from"./chunk-a7mr12yc.js";import{ae,se,le,ce}from"./chunk-qpz97p1m.js";import{st,n,y}from"./chunk-vxnjsga5.js";import{Ve}from"./chunk-czahfwp7.js";import{qe}from"./chunk-14a9wet3.js";import{ot,rt}from"./chunk-t9vvcy09.js";import{it}from"./chunk-d25r0vq3.js";import{LockIcon as N,UnplugIcon as A}from"lucide-react";import{useMemo as E}from"react";import{jsx as r,jsxs as a}from"react/jsx-runtime";function ir({host:t,client:l,...c}){let m=E(()=>t.openDiff?t:{...t,openDiff:ot},[t]);return a(st,{host:m,client:l,children:[r(R,{...c}),!t.openDiff&&r(rt,{})]})}function R({session:t,header:l,overlay:c,timeline:m,composer:x,welcome:C,children:u,rootRef:w}){let{host:s,client:h}=n(),{t:i}=s,d=o((p)=>p.connection==="ready"),f=o((p)=>p.historyPages[t.id]?.error),v=()=>y(s,h.open(t.id,t.cwd)),D=t.items.length===0&&t.attached&&!t.restoring&&t.state==="idle";return a("div",{"data-chat-drop-zone":!0,ref:w,className:"flex h-full min-h-0 flex-col",children:[l,a("div",{className:"relative flex min-h-0 flex-1 flex-col","data-chat-content":!0,children:[c,d&&!t.attached&&!t.restoring&&!t.readOnly&&r("div",{className:"mx-auto my-3 w-full max-w-4xl px-4",children:a(O,{children:[r(A,{}),r($t,{children:i("conversation.stopped")}),r(F,{children:r(e,{size:"sm",variant:"outline",onClick:v,children:i("conversation.reconnect")})})]})}),t.readOnly&&r("div",{className:"mx-auto my-3 w-full max-w-4xl px-4",children:a(O,{children:[r(N,{}),r($t,{children:i("conversation.readOnlyTitle")}),a(F,{className:"flex flex-wrap items-center gap-2",children:[i("conversation.readOnlyDescription"),f&&r("p",{role:"alert",className:"text-destructive w-full break-words",children:f}),r(e,{size:"sm",variant:"outline",onClick:v,disabled:!d||t.restoring,children:i(t.restoring?"conversation.restoring":"conversation.readOnlyRetry")})]})]})}),D?C??r(ae,{className:"flex-1",children:a(se,{children:[r(le,{className:"text-[28px] font-normal",children:i("conversation.welcomeTitle")}),r(ce,{children:i("conversation.welcomeDescription")})]})}):r(qe,{session:t,timeline:m}),r(it,{sessionId:t.id}),x??r(Ve,{session:t})]}),u]})}
|
|
2
|
+
export{ir};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{cva as s}from"class-variance-authority";import{cn as a}from"cn";import{jsx as r}from"react/jsx-runtime";var n=s("group/alert relative grid w-full gap-0.5 rounded-lg border px-4 py-3 text-start text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pe-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current"}},defaultVariants:{variant:"default"}});function O({className:t,variant:e,...o}){return r("div",{"data-slot":"alert",role:"alert",className:a(n({variant:e}),t),...o})}function $t({className:t,...e}){return r("div",{"data-slot":"alert-title",className:a("font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground",t),...e})}function F({className:t,...e}){return r("div",{"data-slot":"alert-description",className:a("text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",t),...e})}function ai({className:t,...e}){return r("div",{"data-slot":"alert-action",className:a("absolute top-2.5 end-3",t),...e})}export{O,$t,F,ai};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Switch as a}from"@base-ui/react/switch";import{cn as d}from"cn";import{jsx as e}from"react/jsx-runtime";function Ee({className:i,size:t="default",...r}){return e(a.Root,{"data-slot":"switch","data-size":t,className:d("peer group/switch focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 relative inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 aria-invalid:ring-3 data-disabled:cursor-not-allowed data-disabled:opacity-50 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px]",i),...r,children:e(a.Thumb,{"data-slot":"switch-thumb",className:"bg-background dark:data-checked:bg-primary-foreground dark:data-unchecked:bg-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0"})})}export{Ee};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mergeProps as a}from"@base-ui/react/merge-props";import{useRender as n}from"@base-ui/react/use-render";import{cva as o}from"class-variance-authority";import{cn as d}from"cn";var
|
|
1
|
+
import{mergeProps as a}from"@base-ui/react/merge-props";import{useRender as n}from"@base-ui/react/use-render";import{cva as o}from"class-variance-authority";import{cn as d}from"cn";var Pr=o("group/badge focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:ring-[3px] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function Re({className:r,variant:e="default",render:t,...i}){return n({defaultTagName:"span",props:a({className:d(Pr({variant:e}),r)},i),render:t,state:{slot:"badge",variant:e}})}export{Pr,Re};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function Lo(t){if(!t||typeof t!=="object"||!("codex"in t))return null;let o=t.codex;if(!o||typeof o!=="object"||!("questionReply"in o))return null;let n=o.questionReply;if(!n||typeof n!=="object"||!("question"in n)||!("answer"in n))return null;return typeof n.question==="string"&&typeof n.answer==="string"?{question:n.question,answer:n.answer}:null}function Do(t){if(!t||typeof t!=="object"||!("codex"in t))return null;let o=t.codex;if(!o||typeof o!=="object"||!("questionReplyParts"in o))return null;let n=o.questionReplyParts;if(!Array.isArray(n)||n.length===0)return null;let i=n;if(!i.every((e)=>!!e&&typeof e==="object"&&("text"in e)&&typeof e.text==="string"&&(!("question"in e)||e.question===void 0||typeof e.question==="string")))return null;return i.map((e)=>({text:e.text,...e.question===void 0?{}:{question:e.question}}))}
|
|
2
|
+
export{Lo,Do};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{cn as a}from"cn";import{Loader2Icon as r}from"lucide-react";import{jsx as e}from"react/jsx-runtime";function ve({className:o,...n}){return e(r,{"data-slot":"spinner",role:"status","aria-label":"Loading",className:a("size-4 animate-spin",o),...n})}export{ve};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{o}from"./chunk-yx02h2ja.js";import{n}from"./chunk-vxnjsga5.js";import{codexExtensionCapabilities as T,codexTurnId as _,composerPrediction as q}from"@nyssance/codex-acp-v2/client";import{useEffect as x,useRef as v,useState as P}from"react";function Ye(e,p,u,f){let{client:g}=n(),b=o((i)=>T(i.agent).composerPredictions),y=e.items.findLast((i)=>i.kind==="user"),r=_(y?._meta),t=JSON.stringify([e.id,r,e.configOptions]),l=v(null),d=v(!1);x(()=>(d.current=!0,()=>{d.current=!1}),[]);let a=JSON.stringify([e.id,r]),[c,C]=P(null),[k,I]=P(null),m=f&&b&&p&&e.state==="idle"&&e.lastStopReason==="end_turn"&&!y?.replayed&&r!==null;x(()=>{if(!m||u||c===t||l.current?.source===a||r===null)return;l.current={key:t,source:a},g.requestPrediction(e.id,r).catch((i)=>{if(d.current&&l.current?.key===t)I({key:t,message:i instanceof Error?i.message:String(i)})})},[g,m,u,c,t,a,e.id,r]);let s=q(e._meta),S=m&&!u&&c!==t&&l.current?.key===t&&s?.sourceTurnId===r,E=S&&s.result.type==="completed"?s.result.text:null,O=f&&p&&e.state==="idle"&&!u&&c!==t?k?.key===t?k.message:S&&s.result.type==="failed"?"Prediction failed":null:null;return{text:E,error:O,invalidate:()=>C(t)}}
|
|
2
|
+
export{Ye};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Uo}from"./chunk-87t0qtkr.js";import{Fo,Bo,zo}from"./chunk-bycbj1aq.js";import{$o}from"./chunk-6ndz2pf9.js";import{t}from"./chunk-yx02h2ja.js";import{q}from"./chunk-dqw30cz4.js";import{textOf as f}from"@alwith/api";import{nativeTurnId as I}from"@nyssance/codex-acp-v2/client";import{useMemo as N}from"react";import{jsx as r,jsxs as v,Fragment as y}from"react/jsx-runtime";function _r(i,n){return{installUnlock:n==="none"?()=>()=>{}:Bo,preload:()=>{if(n!=="none")Fo(i)},playSequence:(a,d,l)=>zo(a,d,l,i,n)}}function Ho(i,n={},a){let d=[];for(let e of i){if(e.user===null)continue;let o="";for(let m of e.final){let p=f(m.content).trim();if(p.length===0)continue;o=p}let u=n[e.user.id],s=e.items.map(I).find((m)=>m!==null);d.push({id:e.user.id,turnKey:e.key,label:q(e.user),response:o,inputTokens:u?.inputTokens??0,outputTokens:u?.outputTokens??0,...s===void 0?{}:{nativeTurnId:s}})}if(!a?.complete)return d;let l=new Map;for(let e of d){if(e.nativeTurnId===void 0)continue;let o=l.get(e.nativeTurnId)??[];o.push(e),l.set(e.nativeTurnId,o)}let c=new Set(a.turns.map((e)=>e.turnId)),g=new Set(a.loadedTurnIds);return[...a.turns.flatMap((e)=>{let o=l.get(e.turnId);if(o)return o;if(g.has(e.turnId))return[];let u=a.previews[e.turnId];return((u?.messages.length)?u.messages:[{id:"",label:"",response:""}]).map((s,m)=>({id:`history:${e.turnId}:${m===0?"0":s.id}`,messageId:s.id||void 0,turnKey:`history:${e.turnId}`,nativeTurnId:e.turnId,isLoaded:!1,previewState:u?.state??"loading",label:s.label,response:s.response,inputTokens:0,outputTokens:0}))}),...d.filter((e)=>e.nativeTurnId===void 0||!c.has(e.nativeTurnId))]}function T({item:i}){let n=t(),a=N(()=>({theme:n.theme,copyLabel:n.t("actions.copy"),openLink:()=>{},preview:!0}),[n]);if(i.previewState==="loading")return v("div",{role:"status",className:"animate-pulse space-y-2 py-1","aria-label":n.t("timeline.navigationLoading"),children:[r("div",{className:"bg-muted h-3 w-3/5 rounded"}),r("div",{className:"bg-muted h-3 rounded"}),r("div",{className:"bg-muted h-3 w-4/5 rounded"})]});return v(y,{children:[r("div",{className:"min-w-0 truncate font-medium",children:i.previewState==="unavailable"?n.t("timeline.navigationUnavailable"):i.label||n.t("timeline.navigationEmpty")}),i.response&&r("div",{className:"text-muted-foreground pointer-events-none mt-1 line-clamp-3 [&_img]:hidden [&_pre]:max-h-20 [&_table]:table-fixed","data-navigation-response":!0,children:r(Uo,{text:i.response,host:a})})]})}function Oo(i){return r($o,{...i,renderPreview:(n)=>r(T,{item:n})})}
|
|
2
|
+
export{_r,Ho,Oo};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i,T,Ze}from"./chunk-0n82kdek.js";var Nn=5000;function ee(t){return"pastedText"in t}function Cr(t){return`file://${encodeURI(t).replaceAll("#","%23").replaceAll("?","%3F")}`}function Te(t,e,o){let n=(r,s)=>{for(let[a,x]of i){if(!x.attachments.some((p)=>p.id===e.id))continue;T(a,(p)=>p.map((d)=>d.id===e.id?{...e,url:s===void 0?"":Cr(s),pastedText:{text:e.pastedText.text,status:r}}:d))}};if(!i.get(t)?.attachments.some((r)=>r.id===e.id))return;n("pending"),Ze(e.id,o("pasted-text.txt",e.pastedText.text).then((r)=>n("ready",r)).catch(()=>n("error")))}function Xe(t,e,o,n){if(t.defaultPrevented||t.currentTarget.disabled)return;if([...t.clipboardData.items].some((a)=>a.kind==="file"&&a.type.startsWith("image/")))return;let r=t.clipboardData.getData("text/plain");if(r.length<Nn)return;t.preventDefault(),t.stopPropagation();let s={id:crypto.randomUUID(),type:"file",mediaType:"text/plain",filename:o,url:"",pastedText:{text:r,status:"pending"}};T(e,(a)=>[...a,s]),Te(e,s,n)}
|
|
2
|
+
export{Nn,ee,Cr,Te,Xe};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{qo}from"./chunk-pb6xtb3n.js";import{useCallback as Te,useEffect as P,useLayoutEffect as xe,useMemo as Q,useRef as I,useState as E}from"react";import"@alwith/module-chat/navigation-rail.css";import{jsx as T,jsxs as Ne,Fragment as Me}from"react/jsx-runtime";var ye=4,me=10;function we(h,x){let v=new Map(x.flatMap((c)=>c.itemIds.map((w)=>[w,c.key]))),p=Array(h.length),C;for(let c=h.length-1;c>=0;c--)C=v.get(h[c])??C,p[c]=C;let O=Math.max(-1,...x.map((c)=>c.key))+1,B=new Set,n=[];for(let[c,w]of h.entries()){let S=v.get(w),m=n.at(-1);if(!m||S!==void 0&&S!==m.key||S===void 0&&m.itemIds.length>=64&&p[c]!==m.key){let y=S!==void 0&&!B.has(S)?S:O++;m={key:y,startIndex:c,itemIds:[]},n.push(m),B.add(y)}m.itemIds.push(w)}return n}function ge(h,x){if(h.size!==x.size)return!1;for(let v of h)if(!x.has(v))return!1;return!0}function $o({audio:h,beforeReveal:x,ensureItemMounted:v,items:p,onPreviewItem:C,renderPreview:O,onRevealError:B,scrollRoot:n,targetTopMarginPx:c=16}){let[w,S]=E(()=>{let e=p.at(-1);return new Set(e===void 0?[]:[e.id])}),[m,y]=E(null),[W,A]=E(null),[X,U]=E(!1),[_,fe]=E(()=>new Set),[pe,ve]=E(!0),[be,j]=E(null),{installUnlock:Z,preload:ee,playSequence:te}=h,K=I(null),M=I(null),R=I(!1),H=I(null),L=I(0),N=I(null),G=I(new Set),V=Q(()=>p.map((e)=>e.id).join("\x00"),[p]),F=I(p);F.current=p;let ne=I(_),ie=I(w),re=I({itemIdsKey:V,scrollRoot:n});if(re.current.scrollRoot!==n)L.current+=1,re.current={itemIdsKey:V,scrollRoot:n};let g=Q(()=>v===void 0?p.filter((e)=>_.has(e.id)):p,[v,p,_]),se=Q(()=>g.map((e)=>({inputTokens:e.inputTokens,outputTokens:e.outputTokens})),[g]),z=I({ids:"",groups:[]}),ae=g.map((e)=>e.id).join("\x00");if(z.current.ids!==ae)z.current={ids:ae,groups:we(g.map((e)=>e.id),z.current.groups)};P(()=>Z(),[Z]),P(()=>()=>{if(L.current+=1,N.current!==null)clearTimeout(N.current)},[]),P(()=>{y(null),U(!1),A(null),M.current=null,R.current=!1,H.current=null,j(null),G.current.clear()},[n]),P(()=>{ee()},[ee]),P(()=>{if(n===null)return;let e=new Set,t=new Map,i=new Set(F.current.map((o)=>o.id)),r=()=>{let o=new Set(t.values()),d=F.current.filter((f)=>o.has(f.id)).map((f)=>f.id),u=d.findIndex((f)=>e.has(f));if(u===-1)return;let b=u;for(let f=u+1;f<d.length;f++)if(e.has(d[f]))b=f;let k=new Set(d.slice(u,b+1));if(ge(ie.current,k))return;ie.current=k,S(k)},s=new IntersectionObserver((o)=>{for(let d of o){let u=t.get(d.target);if(d.isIntersecting)e.add(u);else e.delete(u)}r()},{root:n,rootMargin:`-${c}px 0px 0px 0px`}),a=()=>{let o=new Set,d=new Set;for(let u of n.querySelectorAll("[data-content-search-unit-key]")){let b=u.dataset.contentSearchUnitKey;if(b===void 0||!i.has(b)||o.has(b))continue;o.add(b);let k=u.closest("[data-turn-key]"),f=k===null||d.has(k)?u:k;if(d.add(f),t.has(f))continue;t.set(f,b),s.observe(f)}for(let u of t.keys()){if(d.has(u))continue;s.unobserve(u),e.delete(t.get(u)),t.delete(u)}if(r(),ge(ne.current,o))return;ne.current=o,fe(o)};a();let l=new MutationObserver((o)=>{if(o.some((u)=>[...u.addedNodes,...u.removedNodes].some((b)=>b instanceof Element&&(b.matches("[data-turn-key], [data-content-search-unit-key]")||b.querySelector("[data-turn-key], [data-content-search-unit-key]")!==null))))a()});return l.observe(n,{childList:!0,subtree:!0}),()=>{l.disconnect(),s.disconnect()}},[V,n,c]);let J=g.find((e)=>w.has(e.id))?.id??g.at(-1)?.id;xe(()=>{let e=K.current;if(e===null||M.current!==null||J===void 0)return;let t=e.querySelector(`[data-timeline-user-message-navigation-item-id="${CSS.escape(J)}"]`);if(t===null)return;let i=e.getBoundingClientRect(),r=t.getBoundingClientRect();if(r.top<i.top)e.scrollTop+=r.top-i.top;else if(r.bottom>i.bottom)e.scrollTop+=r.bottom-i.bottom+1},[J,V]),P(()=>{let e=n?.querySelector("[data-timeline-user-message-navigation-content]");if(!n||!e)return;let t=()=>{let r=n.getBoundingClientRect(),s=e.getBoundingClientRect();if(r.width===0||s.width===0)return;let a=n.offsetWidth>0?r.width/n.offsetWidth:1;ve((s.left-r.left)/a>=48)},i=new ResizeObserver(t);return i.observe(n),i.observe(e),t(),()=>i.disconnect()},[n]);let Ie=Te(async(e,t="smooth")=>{if(n===null)throw Error("Thread user-message navigation scroll root is missing");let i=L.current+1;L.current=i,x();let r=()=>n.querySelector(`[data-content-search-unit-key="${CSS.escape(e.id)}"]`),s=r(),a=s!==null&&n.clientHeight>0&&s.closest("[data-turn-key]")!==null&&Math.abs(s.getBoundingClientRect().top-n.getBoundingClientRect().top)>n.clientHeight*2;if((s===null||a)&&v!==void 0){if(t==="instant"&&e.isLoaded===!1)return;s=await v(e,()=>L.current===i)??r(),t="instant"}if(L.current!==i)return;if(s===null)return;let l=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;s.scrollIntoView({behavior:l?"instant":t,block:"start"}),s.querySelector("[data-user-message-bubble], [data-composer-attachment-pill]")?.animate?.([{backgroundColor:"color-mix(in srgb, var(--foreground) 14%, transparent)"},{backgroundColor:"color-mix(in srgb, var(--foreground) 14%, transparent)",offset:0.35},{backgroundColor:"transparent"}],{duration:l?0:1000,easing:"cubic-bezier(0.23, 1, 0.32, 1)"})},[x,v,n]);if(g.length<ye||!pe)return null;let Y=()=>{if(N.current!==null)clearTimeout(N.current);N.current=null},oe=(e,t=!1)=>{if(Y(),C===void 0||e.isLoaded!==!1||G.current.has(e.turnKey))return;let i=()=>{N.current=null,G.current.add(e.turnKey),C(e).catch(()=>G.current.delete(e.turnKey))};if(t)i();else N.current=setTimeout(i,150)},q=m===null?null:g.find((e)=>e.id===m.item.id)??g.find((e)=>e.nativeTurnId!==void 0&&e.nativeTurnId===m.item.nativeTurnId)??m.item,ue=(e,t="smooth")=>{Ie(e,t).catch((i)=>{if(B)B(i);else throw i})},le=g.findIndex((e)=>e.id===(W??be)),de=K.current,he=m===null||!de?.contains(m.button)?0:Se(de,m.button),ce=(e)=>{let t=e?.closest("[data-timeline-user-message-navigation-item-id]"),i=K.current;if(t===void 0||t===null||!i.contains(t))return null;let r=t.dataset.timelineUserMessageNavigationItemId,s=g.findIndex((a)=>a.id===r);return{button:t,item:g[s],index:s}},D=(e)=>{let t=M.current;if(t?.pointerId!==e.pointerId)return;if(M.current=null,A(null),t.captureTarget.hasPointerCapture(e.pointerId))t.captureTarget.releasePointerCapture(e.pointerId)};return T("nav",{"aria-label":"User messages",className:"timeline-user-message-navigation absolute start-4 top-1/2 z-20 -translate-y-1/2",children:T(qo,{open:X,onOpenChange:U,side:"inline-end",sideOffset:0,align:"center",alignOffset:he,trigger:T("div",{ref:K,"data-timeline-user-message-navigation-rail-list":!0,"data-scrubbing":W===null?void 0:"",className:"timeline-user-message-navigation-rail-list",onPointerEnter:()=>{H.current=null},onPointerDown:(e)=>{if(e.button!==0)return;Y();let t=ce(e.target instanceof Element?e.target:null);if(t===null)return;R.current=!1,M.current={pointerId:e.pointerId,itemId:t.item.id,itemIndex:t.index,captureTarget:t.button},t.button.setPointerCapture(e.pointerId),A(t.item.id),y(t),U(!0)},onPointerMove:(e)=>{let t=M.current;if(t===null){let l=ce(e.target instanceof Element?e.target:null);if(l!==null){j(l.item.id);let o=H.current;if(o!==null&&o!==l.index)te(o,l.index,se);H.current=l.index,y((d)=>d?.item.id===l.item.id?d:l),oe(l.item)}return}if(t.pointerId!==e.pointerId)return;if((e.buttons&1)===0){D(e);return}let i=e.currentTarget.getBoundingClientRect(),r=Math.max(0,Math.min(g.length-1,Math.floor((e.clientY-i.top+e.currentTarget.scrollTop)/me))),a={button:e.currentTarget.querySelectorAll("[data-timeline-user-message-navigation-item-id]")[r],item:g[r],index:r};if(a.item.id===t.itemId)return;te(t.itemIndex,a.index,se),H.current=a.index,M.current={...t,itemId:a.item.id,itemIndex:a.index},R.current=!0,A(a.item.id),y(a),ue(a.item,"instant")},onPointerUp:D,onPointerCancel:D,onLostPointerCapture:D,onPointerLeave:()=>{if(Y(),j(null),H.current=null,M.current===null&&!X)y(null)},children:T("div",{className:"flex flex-col",children:z.current.groups.map((e)=>T("div",{className:"flex w-9 shrink-0 flex-col [content-visibility:auto]",style:{height:e.itemIds.length*me},children:g.slice(e.startIndex,e.startIndex+e.itemIds.length).map((t,i)=>{let r=e.startIndex+i,s=Math.abs(r-le),a=le===-1||s>3?void 0:[1,0.7,0.4,0.2][s];return T("button",{type:"button","data-timeline-user-message-navigation-item-id":t.id,"data-scrub-target":W===t.id?"":void 0,"aria-current":w.has(t.id)?"true":void 0,"aria-label":`Jump to user message ${r+1}`,className:"timeline-user-message-navigation-row",onClick:(l)=>{if(R.current){R.current=!1;return}let o={button:l.currentTarget,item:t,index:r};y(o),U(!0),ue(t)},onFocus:(l)=>{oe(t,!0),y({button:l.currentTarget,item:t,index:r}),U(!0)},children:T("span",{className:"flex h-0.5 w-[30px] items-center",children:T("span",{className:"timeline-user-message-navigation-marker",style:a===void 0?void 0:{"--marker-progress":a}})})},t.id)})},e.key))})}),children:q!==null&&T("div",{className:"bg-popover/95 text-popover-foreground ring-border w-80 max-w-[calc(100vw-1rem)] overflow-hidden rounded-xl p-2 text-sm leading-5 shadow-xl ring-[0.5px] backdrop-blur-sm",children:O?O(q):Ne(Me,{children:[T("div",{className:"min-w-0 truncate font-medium",children:q.label}),q.response.length>0&&T("div",{className:"text-muted-foreground mt-1 line-clamp-3",children:q.response})]})})})})}function Se(h,x){let v=h.getBoundingClientRect(),p=x.getBoundingClientRect();return p.top+p.height/2-(v.top+v.height/2)}
|
|
2
|
+
export{$o};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Ping as l}from"ldrs/react";import"ldrs/react/Ping.css";import{cn as i}from"cn";import{jsx as e,jsxs as u}from"react/jsx-runtime";var to={requires_action:"bg-red-500",running:"bg-yellow-500",done:"bg-blue-500",idle:"bg-green-500"},no={requires_action:"text-red-500",running:"text-yellow-500",done:"text-blue-500",idle:"text-green-500"};function xt({state:n,className:t,pulse:s=!0,title:r}){if(n===void 0)return null;let o=to[n];if(n==="running"&&s)return u("span",{title:r,className:i("relative inline-flex size-1.5 shrink-0 items-center justify-center",no.running,t),children:[e("span",{className:"absolute inset-0 flex items-center justify-center",children:e(l,{size:"26",speed:"2",color:"currentColor"})}),e("span",{className:"relative size-1.5 rounded-full bg-current"})]});return e("span",{title:r,className:i("size-2 shrink-0 rounded-full",o,t)})}
|
|
2
|
+
export{to,no,xt};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{s,r}from"./chunk-33mgpcnd.js";import{latestAssistantReply as v}from"@nyssance/codex-acp-v2/client";import{useEffect as S,useState as g}from"react";function gr(e,o){let a=s(),c=r((t)=>t.connection),i=r((t)=>Boolean(t.sessions[e]?.attached)&&!t.sessions[e]?.restoring),u=r((t)=>v(t.sessions[e]?.items)),f=r((t)=>Boolean(t.runStates[e]?.reusableDraft)),[p,y]=g();return S(()=>{if(c!=="ready"||f||i)return;let t=!1,l,n=0,m=async()=>{try{let d=await a.activityReply(e);if(n=0,!t)y(d??void 0)}catch{n++}finally{if(!t&&(o==="running"||n>0&&n<3))l=setTimeout(()=>void m(),5000)}};return m(),()=>{t=!0,clearTimeout(l)}},[a,e,c,f,i,o]),i?u:p??u}
|
|
2
|
+
export{gr};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{e}from"./chunk-a7mr12yc.js";import{zn,Un,$n,qn,Vn,Gn}from"./chunk-d6nxypzc.js";import{ExternalLinkIcon as d}from"lucide-react";import{jsx as a,jsxs as n}from"react/jsx-runtime";function _n({message:r,url:t,t:i,onOpen:l,onRespond:o}){return n(zn,{size:"sm",children:[n(Un,{children:[a(qn,{children:i("approval.needed")}),a($n,{children:r})]}),a(Vn,{children:n("div",{className:"flex flex-col gap-3",children:[n(e,{variant:"outline",size:"sm",className:"w-fit",onClick:()=>void l(t),children:[a(d,{"data-icon":"inline-start"}),i("approval.openLink")]}),a("p",{className:"text-muted-foreground text-sm",children:i("approval.waitingForLink")})]})}),n(Gn,{className:"flex flex-wrap gap-2",children:[a(e,{variant:"outline",size:"sm",onClick:()=>o("decline"),children:i("actions.decline")}),a(e,{variant:"ghost",size:"sm",onClick:()=>o("cancel"),children:i("actions.cancel")})]})]})}
|
|
2
|
+
export{_n};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{Vo}from"./chunk-hesyytcd.js";import{nn,Wo}from"./chunk-awrzpp7x.js";import{tn}from"./chunk-23wzpgbs.js";import{decodeHTMLAttribute as v,decodeHTMLStrict as I}from"entities";import oe from"katex";import{CheckIcon as z,ChevronLeftIcon as ae,ChevronRightIcon as se,CopyIcon as ie,DownloadIcon as ce,FileIcon as de,LinkIcon as le,MailIcon as ue,XIcon as me}from"lucide-react";import"katex/dist/katex.min.css";import{createContext as ge,createElement as U,memo as B,startTransition as fe,useContext as he,useEffect as p,useLayoutEffect as D,useMemo as X,useRef as k,useState as h}from"react";import{jsx as a,jsxs as g,Fragment as te}from"react/jsx-runtime";var G=ge(null);function C(){let e=he(G);if(e===null)throw Error("Markdown host is missing");return e}var pe=80,A=/\[([^\]\n]+)\]\(([^)\n]+)$/,ke=/(^|\n)[^\S\n]*!\[[^\]\n]*(?:\](?:\([^\n]*)?)?\s*$/,we=/\uE200[^\uE201]*$/,be=4,xe=new Set("7zipx.accdb.asarpack.asciidoc.backup.backupdb.bundle.ccproj.cdrdao.code-workspace.config.debugin.deploy.design.docbook.dockerfile.dockerignore.editorconfig.eslintignore.gitattributes.gitignore.gitignore.gitkeep.gradle.graphqls.ignore.ipynb.keychain.keynote.licensee.lockfile.lockfile.markdown.markup.matlab.mkdocs.models.module.msstyle.notebook.npmignore.output.packageinfo.parquet.pickle.plistx.policy.postcssrc.prettierignore.projectfile.python.readme.review.robots.schema.search.series.settingsjson.shader.sqlite.sqlite3.storyboard.styles.system.target.terraform.update.vertex.webapp.webdoc.webpackrc.widget.workspace.xcodeproj.yarnlock".split("."));function y(e,n){let t=0;for(let r=n-1;r>=0&&e[r]==="\\";r-=1)t+=1;return t%2===1}function J(e,n,t){if(t.length!==1)return!1;return e[n-1]===t||e[n+1]===t}function Te(e,n){let t=0;for(let r=0;r<=e.length-n.length;){if(e.startsWith(n,r)&&!y(e,r)&&!J(e,r,n)){t+=1,r+=n.length;continue}r+=1}return t}function ve(e,n){for(let t=e.length-n.length;t>=0;t-=1)if(e.startsWith(n,t)&&!y(e,t)&&!J(e,t,n))return t;return-1}function Ce(e,n){let t=0;for(let r=0;r<=e.length-n.length;){if(e.startsWith(n,r)&&!y(e,r)){t+=1,r+=n.length;continue}r+=1}return t}function ye(e){return Ce(e,"```")%2===1}function V(e){let n=0;for(let t=0;t<e.length;){if(e.startsWith("```",t)){for(t+=3;t<e.length&&!e.startsWith("```",t);)t+=1;if(t<e.length)t+=3;continue}if(e[t]==="`"&&!y(e,t))n+=1;t+=1}return n%2===1}function Ne(e){return e.endsWith(`
|
|
2
|
+
`)?`${e}\`\`\``:`${e}
|
|
3
|
+
\`\`\``}function H(e,n){if(!e.includes(n)||Te(e,n)%2===0)return e;let t=ve(e,n);if(t<0)return e;let r=e.slice(t+n.length);if(r.length===0||/^\s/.test(r)||r.includes(`
|
|
4
|
+
`)||V(r))return e;return`${e}${n}`}function Me(e){return e.startsWith("/")&&!e.startsWith("//")||/^[A-Za-z]:[\\/]/.test(e)||/^\\\\[^\\]+\\[^\\]+/.test(e)||/^\/\/[^/]+\/[^/]+/.test(e)}function Z(e){let n=e.replaceAll("`","").trim(),t=n.match(/^(.*?):(\d+)(?::(\d+))?(?:[-–](\d+)(?::(\d+))?)?$/);if(t!==null){let[,o,s,i,c,d]=t;if(o===void 0||s===void 0)throw Error("Codex file location is incomplete");return{path:o,line:Number.parseInt(s,10),column:i===void 0?void 0:Number.parseInt(i,10),endLine:c===void 0?void 0:Number.parseInt(c,10),endColumn:d===void 0?void 0:Number.parseInt(d,10)}}let r=n.match(/^(.*?)#L(\d+)(?:C(\d+))?(?:-L(\d+)(?:C(\d+))?)?$/);if(r!==null){let[,o,s,i,c,d]=r;if(o===void 0||s===void 0)throw Error("Codex hash file location is incomplete");return{path:o,line:Number.parseInt(s,10),column:i===void 0?void 0:Number.parseInt(i,10),endLine:c===void 0?void 0:Number.parseInt(c,10),endColumn:d===void 0?void 0:Number.parseInt(d,10)}}return{path:n}}function Le(e){let{path:n,line:t,column:r,endLine:o,endColumn:s}=Z(e);if(/^[a-z][a-z0-9+.-]*:\/\//i.test(n)||/^www\./i.test(n)||/^(mailto|tel):/i.test(n))return!1;if(t!==void 0||r!==void 0||o!==void 0||s!==void 0)return!0;if(!/(?:^|[\\/])[^\\/]+\.(?!\d+$)[^\\/.]+$/i.test(n))return!1;let i=/[\\/]/.test(n),c=n.split(/[\\/]/).at(-1);if(c===void 0)throw Error("Codex streaming link target has no file name");let d=c.split(".").at(-1);if(d===void 0||d.length===0)return!1;if(!i&&/[a-z]/.test(d)&&/[A-Z]/.test(d.slice(1)))return!1;if(!i){let u=d.toLowerCase();if(u.length>be&&!xe.has(u))return!1}return!0}function Ee(e){let{path:n}=Z(e);if(Me(n))return!0;try{return new URL(n).protocol==="file:"}catch{return!1}}function Ie(e){let n=e.match(A);if(n===null)return e;let t=n[2];if(t===void 0)throw Error("Codex streaming link target is missing");return Le(t)||Ee(t)?e.replace(A,"$1"):`${e})`}function $e(e){let n=e.replace(we,"");if(n.length===0||n.includes("`")&&V(n))return{isCodeFenceOpen:!1,markdown:n};if(n.includes("```")&&ye(n))return{isCodeFenceOpen:!0,markdown:Ne(n)};if(n.includes(")n=Ie(n);return n=H(n,"**"),n=H(n,"*"),{isCodeFenceOpen:!1,markdown:n}}function Re(e){return e?.type==="paragraph"&&"tokens"in e&&Array.isArray(e.tokens)}function _(e){return Re(e)&&e.tokens.length===1&&e.tokens[0]?.type==="image"}function Y(e){for(let n=0;n<e.length;n+=1){let t=e[n];if(t===void 0)throw Error(`Codex Markdown token is missing at index ${n}`);if("tokens"in t&&Array.isArray(t.tokens))Y(t.tokens);if(!_(t))continue;let r=[...t.tokens],o=n+1,s=o;for(;;){while(e[o]?.type==="space")o+=1;let i=e[o];if(!_(i))break;r.push(...i.tokens),o+=1,s=o}if(s===n+1)continue;t.tokens=r,t.text=r.map((i)=>i.raw).join(`
|
|
5
|
+
`),t.raw=e.slice(n,s).map((i)=>i.raw).join(""),e.splice(n+1,s-n-1)}}function O(e){return{type:"text",raw:e,text:e}}function Pe(e){return{type:"paragraph",raw:e.raw,text:e.text,tokens:e.tokens??[e]}}function E(e){for(let n of e){if(n.type==="list")for(let t of n.items){let r=t.tokens[0];if(r?.type==="heading"){let o=r,s=o.raw.trimEnd(),i=s.match(/^#{1,6}\s+/)?.[0];if(i!==void 0)t.tokens[0]={type:"paragraph",raw:o.raw,text:s,tokens:o.tokens===void 0?[O(s)]:[O(i),...o.tokens]}}if(t.loose)t.tokens=t.tokens.map((o)=>o.type==="text"?Pe(o):o);E(t.tokens)}if("tokens"in n&&Array.isArray(n.tokens))E(n.tokens)}}function Se(e,n,t){e.preventDefault(),e.stopPropagation(),t.openLink(n)}function Fe(e){try{let n=new URL(e);return n.protocol!=="http:"&&n.protocol!=="https:"?null:`${n.origin}/favicon.ico`}catch{return null}}function Ae(e){let n=Fe(e);return n===null?[]:[n,`https://www.google.com/s2/favicons?domain=${new URL(e).origin}&sz=32`]}function He({href:e}){let n=X(()=>Ae(e),[e]),[t,r]=h(),o=n.length===0&&!/^[a-z][a-z0-9+.-]*:/i.test(e),s=e.toLowerCase().startsWith("mailto:")?ue:o?de:le;return g("span",{className:"codex-markdown-favicon",children:[t===void 0?a("span",{className:"codex-markdown-favicon-fallback",children:a(s,{"aria-hidden":!0})}):null,n.map((i)=>a("img",{alt:"",className:t===i?"codex-markdown-favicon-image-loaded":void 0,decoding:"async",draggable:!1,referrerPolicy:"no-referrer",src:i,onLoad:()=>r((c)=>c!==void 0&&n.includes(c)?c:i)},i))]})}function _e({children:e,href:n,title:t}){let r=C();if(r.preview)return a("span",{children:e});return a("a",{className:"codex-markdown-link","data-inline-mention-interactive":"",href:n,title:t,onClick:(o)=>Se(o,n,r),children:g("span",{className:"codex-markdown-link-mention","data-layout":"inline-flow","data-interactive":"","data-underline-on-hover":"",children:[a("span",{className:"codex-markdown-link-icon-container","data-markdown-copy":"exclude",children:a(He,{href:n})}),a("span",{className:"codex-markdown-link-label",children:e})]})})}function Oe({code:e,language:n}){let{theme:t,copyLabel:r}=C(),o=k(null),[s,i]=h(null),[c,d]=h(null),[u,w]=h(!1);if(p(()=>{let f=Vo(i,d);return o.current=f,()=>{f.dispose(),o.current=null}},[]),p(()=>{let f=o.current;if(f===null)throw Error("Code highlighter is not mounted");f.update(e,n)},[e,n]),c!==null)throw c;let x=s!==null&&s.code===e&&s.language===n?s.html:null;return g("div",{className:"codex-markdown-code-block","data-markdown-copy":"code-block","data-markdown-copy-text":e,"data-theme":t==="dark"?"dark":"light",children:[g("div",{className:"codex-markdown-code-header","data-markdown-copy":"exclude",children:[a("div",{className:"codex-markdown-code-title",children:n}),a("div",{className:"codex-markdown-code-actions",children:a("button",{type:"button",className:"codex-markdown-code-copy",title:r,onClick:()=>{navigator.clipboard.writeText(e),w(!0),window.setTimeout(()=>w(!1),2000)},children:u?a(z,{}):a(ie,{})})})]}),a("div",{className:"codex-markdown-code-container",dir:"ltr",children:a("code",{className:"codex-markdown-code-content hljs",...x===null?{children:e}:{dangerouslySetInnerHTML:{__html:x}}})})]})}function je({code:e,language:n}){return C().preview?a("span",{children:e}):a(We,{code:e,language:n})}function We({code:e,language:n}){let t=k(null),[r,o]=h(!1);if(p(()=>{if(r)return;let s=t.current;if(s===null)throw Error("Codex code block placeholder is not mounted");if(typeof IntersectionObserver>"u"){let c=window.setTimeout(()=>o(!0),0);return()=>window.clearTimeout(c)}let i=new IntersectionObserver((c)=>{if(!c.some((d)=>d.isIntersecting))return;o(!0),i.disconnect()},{rootMargin:"600px 0px"});return i.observe(s),()=>i.disconnect()},[r]),r)return a(Oe,{code:e,language:n});return a("div",{ref:t,className:"codex-markdown-code-block",children:a("pre",{className:"codex-markdown-code-placeholder",children:a("code",{children:e})})})}function qe(e){let n=[...document.body.querySelectorAll('[data-markdown-image-preview-trigger="true"]')],t=n.map((o)=>{let s=o.querySelector("img");if(s===null)throw Error("Codex image preview trigger has no image");return{src:s.currentSrc||s.src,alt:s.alt}}),r=n.indexOf(e);if(r===-1)throw Error("Codex image preview trigger is outside the document");return{images:t,index:r}}function Ke({preview:e,setPreview:n}){let t=e.images[e.index];if(t===void 0)throw Error(`Codex image preview index is out of range: ${e.index}`);return g("div",{className:"codex-markdown-image-preview",children:[a("img",{src:t.src,alt:t.alt}),g("div",{className:"codex-markdown-image-preview-actions",children:[a("button",{type:"button","aria-label":"Previous image",disabled:e.index===0,onClick:()=>n({...e,index:e.index-1}),children:a(ae,{})}),a("a",{href:t.src,download:!0,"aria-label":"Download image",children:a(ce,{})}),a("button",{type:"button","aria-label":"Next image",disabled:e.index===e.images.length-1,onClick:()=>n({...e,index:e.index+1}),children:a(se,{})}),a("button",{type:"button","aria-label":"Close image preview",onClick:()=>n(void 0),children:a(me,{})})]})]})}function ze(e){return C().preview?a(te,{children:e.alt}):a(Ue,{...e})}function Ue({src:e,alt:n,title:t,allowWide:r}){let o=k(null),[s,i]=h();p(()=>{let d=o.current;if(d===null)throw Error("Codex image preview dialog is not mounted");if(s===void 0){if(d.open)d.close();return}if(!d.open)d.showModal()},[s]);let c=n.length===0?"Open image preview":n;return g(te,{children:[a("button",{type:"button",className:`codex-markdown-image-trigger${r?"codex-markdown-image-trigger-wide":""}`,"aria-label":c,"data-markdown-image-preview-trigger":"true",onClick:(d)=>i(qe(d.currentTarget)),children:a("img",{className:`codex-markdown-image${r?"codex-markdown-image-wide":""}`,src:e,alt:n,title:t,loading:"lazy"})}),a("dialog",{ref:o,className:"codex-markdown-image-dialog","aria-label":c,onClose:()=>i(void 0),children:s===void 0?null:a(Ke,{preview:s,setPreview:i})})]})}function Be({value:e,display:n}){let t=k(null);return D(()=>{if(t.current===null)throw Error("Codex math root is not mounted");oe.render(e,t.current,{displayMode:n,throwOnError:!1})},[n,e]),a("span",{ref:t,className:n?"codex-markdown-math-block":"codex-markdown-inline-math"})}var De=150,T=null;function j(e,n){let t=T;if(t===null)return e;let r=t.cursor,o=r+e.length;t.cursor=o;let s=[],i=r;for(let c of t.runs){if(c.end<=r)continue;if(c.start>=o)break;let d=Math.max(r,c.start),u=Math.min(o,c.end);if(i<d)s.push(e.slice(i-r,d-r));s.push(a("span",{className:"codex-markdown-fade",children:e.slice(d-r,u-r)},`${n}:${t.generation}:${c.start}`)),i=u}if(i<o)s.push(e.slice(i-r));return s}function Q(e){let n=5381;for(let t=0;t<e.length;t+=1)n=(n*33+e.charCodeAt(t))%4294967296;return n.toString(36)}function W(e){let n=e.trim();if(n.length===0)return"";let t=n.split(`
|
|
6
|
+
`,1)[0];if(t===void 0)throw Error("Codex Markdown token has no first line");return(t.match(/\S+/)?.[0]??t).slice(0,pe)}function Xe(e){switch(e.type){case"code":return e.raw.trimStart().match(/^(```|~~~)/)?.[1]??"";case"link":return e.href;case"image":{let n=e;return`${n.href}:${W(n.text)}`}case"html":case"space":case"br":case"hr":case"def":return e.raw;case"math":return W(e.text);default:return""}}function ee(e){return`${e.type==="math"?`math-${e.display?"block":"inline"}`:e.type}-${Q(Xe(e))}`}function m(e,n){let t=new Map;return e.map((r)=>{let o=ee(r),s=t.get(o)??0;return t.set(o,s+1),ne(r,`${n}-${o}-${s}`)})}function Ge(e,n){let t=e.task?e.tokens.filter((r)=>r.type!=="checkbox"):e.tokens;return g("li",{className:`codex-markdown-list-item${e.task?"codex-markdown-task-list-item":""}`,children:[e.task?g("div",{className:"codex-markdown-task-checkbox",children:[a("input",{type:"checkbox",className:"codex-markdown-checkbox",checked:e.checked,"data-state":e.checked?"checked":"unchecked",readOnly:!0,disabled:!0}),e.checked?a(z,{}):null]}):null,m(t,n)]},n)}function Je(e,n){let r=`codex-markdown-list ${e.items.some((s)=>s.task)?"codex-markdown-task-list":e.ordered?"codex-markdown-ordered-list":"codex-markdown-unordered-list"}`,o=m(e.items,n);return e.ordered?a("ol",{className:r,start:e.start===""?void 0:e.start,children:o},n):a("ul",{className:r,children:o},n)}function q(e,n,t){let r=t?"th":"td",o=/^\d+$/.test(e.text);return U(r,{key:n,className:`${t?"codex-markdown-table-header":"codex-markdown-table-cell"}${o?" codex-markdown-numeric-table-cell":""}`,align:e.align??void 0},...m(e.tokens,n))}function Ve(e,n){let t=new Map;return a("div",{className:"codex-markdown-table-container","data-markdown-table":!0,tabIndex:-1,children:a("div",{className:"codex-markdown-table-scroller",children:a("div",{className:"codex-markdown-table-wrapper",children:g("table",{className:"codex-markdown-table",children:[a("thead",{children:a("tr",{className:"codex-markdown-table-row",children:e.header.map((r,o)=>q(r,`${n}-header-${o}`,!0))})}),a("tbody",{className:"codex-markdown-table-body",children:e.rows.map((r)=>{let o=Q(r.map((c)=>c.text).join("\x00")),s=t.get(o)??0;t.set(o,s+1);let i=`${n}-row-${o}-${s}`;return a("tr",{className:"codex-markdown-table-row",children:r.map((c,d)=>q(c,`${i}-cell-${d}`,!1))},i)})})]})})})},n)}function K(e,n,t){let r=v(e.href);if(!tn(r))return null;return a(ze,{src:r,alt:I(e.text),title:e.title==null?void 0:v(e.title),allowWide:t},n)}function ne(e,n){switch(e.type){case"space":case"def":case"internalMessage":return null;case"hr":return a("hr",{className:"codex-markdown-horizontal-rule"},n);case"heading":{let t=e,o={1:"h1",2:"h2",3:"h3",4:"h4",5:"h5",6:"h6"}[t.depth];if(o===void 0)throw Error(`Unsupported Codex Markdown heading depth: ${t.depth}`);return U(o,{key:n,className:`codex-markdown-heading codex-markdown-heading-${t.depth}`},...m(t.tokens,n))}case"paragraph":{let t=e,r=t.tokens.filter((i)=>i.type!=="space"&&i.type!=="br"),o=r.length>0&&r.every((i)=>i.type==="image"),s=o&&r.length>1;return a("p",{className:`codex-markdown-paragraph${o?"codex-markdown-media-paragraph codex-markdown-media-wide-block":""}${s?"codex-markdown-media-grid-paragraph":""}`,"data-markdown-image-grid":s?"true":void 0,"data-wide-markdown-block":o?"true":void 0,"data-wide-markdown-block-kind":o?"image":void 0,children:o?r.map((i,c)=>K(i,`${n}-image-${c}`,!0)):m(t.tokens,n)},n)}case"text":{let t=e;return t.tokens===void 0?j(I(t.text),n):m(t.tokens,n)}case"escape":return j(e.text,n);case"strong":return a("strong",{className:"codex-markdown-strong",children:m(e.tokens,n)},n);case"em":return a("em",{children:m(e.tokens,n)},n);case"del":return a("del",{children:m(e.tokens,n)},n);case"codespan":return a("span",{className:"codex-markdown-inline-code",dir:"ltr","data-markdown-copy":"inline-code",children:e.text},n);case"br":return a("br",{},n);case"link":{let t=e,r=m(t.tokens,n),o=v(t.href);return tn(o)?a(_e,{href:o,title:t.title==null?void 0:v(t.title),children:r},n):a("span",{children:r},n)}case"image":return K(e,n,!1);case"code":{let t=e;return a(je,{code:t.text,language:t.lang},n)}case"blockquote":return a("blockquote",{className:"codex-markdown-blockquote",children:m(e.tokens,n)},n);case"list":return Je(e,n);case"list_item":return Ge(e,n);case"table":return Ve(e,n);case"html":{let t=e;return/^<br\s*\/?>$/i.test(t.raw.trim())?a("br",{},n):t.raw}case"math":{let t=e;return a(Be,{value:t.text,display:t.display},n)}default:throw Error(`Unsupported Codex Markdown token: ${JSON.stringify(e)}`)}}function b(e){switch(e.type){case"text":{let n=e;return n.tokens===void 0?I(n.text):n.tokens.map(b).join("")}case"escape":return e.text;case"paragraph":case"heading":case"strong":case"em":case"del":case"link":case"blockquote":case"list_item":return e.tokens.map(b).join("");case"list":return e.items.map(b).join("");case"table":{let n=e;return[n.header,...n.rows].map((t)=>t.map((r)=>r.tokens.map(b).join("")).join("")).join("")}default:return""}}function Ze({token:e,tokenKey:n,offset:t,runs:r,generation:o}){let s=T;try{return T={cursor:t,runs:r,generation:o},ne(e,n)}finally{T=s}}var Ye=B(function({result:n}){let{text:t,isStreaming:r}=n,o=X(()=>{let l=n.tokens;if(n.source.includes("!["))Y(l);E(l);let R=new Map,P=0;return l.map((M)=>{let L=ee(M),S=R.get(L)??0;R.set(L,S+1);let F=b(M),re={token:M,tokenKey:`root-${L}-${S}`,offset:P,visibleText:F};return P+=F.length,re})},[n]),s=o.map((l)=>l.visibleText).join(""),i=k({text:"",visibleText:"",runs:[],generation:0}),c=i.current,d=t.startsWith(c.text)||s.startsWith(c.visibleText),u=d?c.visibleText.length:0,w=performance.now(),x=r&&d?c.runs.filter((l)=>w-l.firstSeenAtMs<De):[],N=c.generation+(d?0:1),f={text:t,visibleText:s,runs:x.filter((l)=>l.start<s.length).map((l)=>({...l,end:Math.min(l.end,s.length)})),generation:N};if(r&&s.length>u)f.runs.push({start:u,end:s.length,firstSeenAtMs:w});return D(()=>{i.current=f}),a("div",{dir:"auto",className:"codex-markdown-content codex-markdown-root","data-streaming":r?"true":void 0,children:o.map((l)=>a(Ze,{token:l.token,tokenKey:l.tokenKey,offset:l.offset,runs:f.runs,generation:N},l.tokenKey))})}),Qe=B(function({text:n,isStreaming:t}){let r=k(null),[o,s]=h(()=>nn(n,t)),[i,c]=h(null);if(p(()=>{let d=Wo((u)=>{fe(()=>s(u))},c);return r.current=d,()=>{d.dispose(),r.current=null}},[]),p(()=>{let d=r.current;if(d===null)throw Error("Markdown parser is not mounted");let u=t?$e(n).markdown:n;d.update({source:u,text:n,isStreaming:t})},[t,n]),i!==null)throw i;return o===null?a("div",{"data-markdown-pending":!0}):a(Ye,{result:o})});function Uo({text:e,streaming:n,host:t}){let r=n===!0,[o,s]=h(e);return p(()=>{if(o===e)return;if(!r){s(e);return}let i=requestAnimationFrame(()=>s(e));return()=>cancelAnimationFrame(i)},[o,r,e]),a(G.Provider,{value:t,children:a(Qe,{text:r?o:e,isStreaming:r})})}
|
|
7
|
+
export{Uo};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{PreviewCard as i}from"@base-ui/react/preview-card";import{cn as s}from"cn";import{jsx as r}from"react/jsx-runtime";function
|
|
1
|
+
import{PreviewCard as i}from"@base-ui/react/preview-card";import{cn as s}from"cn";import{jsx as r}from"react/jsx-runtime";function Se({...e}){return r(i.Root,{"data-slot":"hover-card",...e})}function Ne({...e}){return r(i.Trigger,{"data-slot":"hover-card-trigger",...e})}function Me({className:e,side:o="bottom",sideOffset:t=4,align:a="center",alignOffset:d=4,...n}){return r(i.Portal,{"data-slot":"hover-card-portal",children:r(i.Positioner,{align:a,alignOffset:d,side:o,sideOffset:t,className:"isolate z-50",children:r(i.Popup,{"data-slot":"hover-card-content",className:s("bg-popover text-popover-foreground ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 z-50 w-64 origin-(--transform-origin) rounded-lg p-4 text-sm shadow-md ring-1 outline-hidden duration-100",e),...n})})})}export{Se,Ne,Me};
|