@alwith/module-chat 0.5.0 → 0.5.2
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 +23 -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-15nwm04a.js +2 -0
- package/dist/chunk-16y5rmm5.js +2 -0
- package/dist/chunk-1d4c9j8w.js +2 -0
- package/dist/chunk-20zcgxa5.js +4 -0
- package/dist/{chunk-kaeqvcew.js → chunk-2epnn4sq.js} +1 -1
- package/dist/chunk-2f19pcpn.js +2 -0
- package/dist/chunk-3vt71emt.js +2 -0
- package/dist/{chunk-1yy2jsnh.js → chunk-42zr8zpv.js} +2 -2
- package/dist/{chunk-k7s0drzk.js → chunk-4svwa5p8.js} +3 -3
- package/dist/chunk-4tkxmh52.js +2 -0
- package/dist/chunk-5grywgpq.js +4 -0
- package/dist/chunk-5h13saah.js +2 -0
- package/dist/chunk-5j3wnans.js +2 -0
- package/dist/{chunk-yw4e2tcz.js → chunk-6p5hgnpq.js} +1 -1
- package/dist/{chunk-kget6qfz.js → chunk-6qa5dt1k.js} +1 -1
- package/dist/{chunk-341yykkp.js → chunk-6qn5srgg.js} +1 -1
- package/dist/{chunk-1cy1j8gj.js → chunk-6vky4fcv.js} +2 -2
- package/dist/{chunk-p9wpghey.js → chunk-7kcdf82d.js} +2 -2
- package/dist/{chunk-1hy64ewz.js → chunk-7q7c0mds.js} +1 -1
- package/dist/{chunk-wjejhpgw.js → chunk-801v0awm.js} +1 -1
- package/dist/{chunk-evcrrxfp.js → chunk-8e7xf2tb.js} +1 -1
- package/dist/chunk-8k7wzkna.js +2 -0
- package/dist/chunk-8vvn71rf.js +2 -0
- package/dist/{chunk-0e1pdbec.js → chunk-9ab18v07.js} +2 -2
- package/dist/{chunk-ph7bk34y.js → chunk-9dsa5vm7.js} +2 -2
- package/dist/chunk-9pdj44jr.js +2 -0
- package/dist/{chunk-m5pbe513.js → chunk-9s1cgt7s.js} +1 -1
- package/dist/chunk-aqj0v5a9.js +7 -0
- package/dist/chunk-azmqtycn.js +2 -0
- package/dist/{chunk-3eg720sa.js → chunk-b5mkvr4d.js} +2 -2
- package/dist/chunk-bfe7xk9m.js +3 -0
- package/dist/{chunk-k1pd257q.js → chunk-bkbemt8g.js} +2 -2
- package/dist/{chunk-d0ptk8x8.js → chunk-c4621n0b.js} +1 -1
- package/dist/chunk-cw9tg2sz.js +1 -0
- package/dist/{chunk-25na55ve.js → chunk-d675nr2b.js} +2 -2
- package/dist/{chunk-y2xbq7rb.js → chunk-d8gwsw6j.js} +3 -3
- package/dist/{chunk-1twg3evk.js → chunk-dgp9q950.js} +1 -1
- package/dist/chunk-dm31xvh3.js +2 -0
- package/dist/chunk-dr6z453e.js +2 -0
- package/dist/{chunk-4gayxp21.js → chunk-ea7zsd2s.js} +2 -2
- package/dist/chunk-fgsd4fsd.js +2 -0
- package/dist/chunk-fvnb8ds4.js +2 -0
- package/dist/{chunk-qj8r5xvx.js → chunk-h0dq9ztv.js} +2 -2
- package/dist/{chunk-66headm4.js → chunk-h38yw8y3.js} +1 -1
- package/dist/{chunk-hnt4tt1n.js → chunk-h6df4xfd.js} +2 -2
- package/dist/chunk-h87xp1gv.js +2 -0
- package/dist/{chunk-bwzjm3g8.js → chunk-hx6wfscz.js} +1 -1
- package/dist/chunk-j2mcvb68.js +7 -0
- package/dist/chunk-jeyvacx6.js +5 -0
- package/dist/chunk-jh8jske0.js +2 -0
- package/dist/chunk-jn2pj92h.js +2 -0
- package/dist/{chunk-r5d37dc0.js → chunk-jrrvpnf3.js} +1 -1
- package/dist/chunk-jsb0zged.js +2 -0
- package/dist/chunk-k2y4cpra.js +2 -0
- package/dist/{chunk-zt7a6b1m.js → chunk-k7zzrns3.js} +1 -1
- package/dist/chunk-m2myfd89.js +2 -0
- package/dist/chunk-m2wxz0sj.js +2 -0
- package/dist/chunk-nxarfyj2.js +2 -0
- package/dist/chunk-p1pd1twf.js +2 -0
- package/dist/chunk-p6558tbk.js +2 -0
- package/dist/{chunk-e9zndx26.js → chunk-phe3an96.js} +2 -2
- package/dist/{chunk-ftka421d.js → chunk-q7e2bdav.js} +2 -2
- package/dist/chunk-qh5fhcrh.js +3 -0
- package/dist/chunk-sky795ex.js +1 -0
- package/dist/chunk-t3vgbc9s.js +2 -0
- package/dist/{chunk-90rwhxdf.js → chunk-t5nstx0k.js} +2 -2
- package/dist/chunk-trgq8rq1.js +2 -0
- package/dist/{chunk-bf5fh35b.js → chunk-v0zn87k5.js} +2 -2
- package/dist/chunk-v72t4sf9.js +2 -0
- package/dist/chunk-vhat5rbz.js +2 -0
- package/dist/chunk-vw2hv2sq.js +2 -0
- package/dist/{chunk-3496tgga.js → chunk-w3yddw6n.js} +2 -2
- package/dist/chunk-x9pramem.js +2 -0
- package/dist/{chunk-arge74eh.js → chunk-xjen1yt6.js} +2 -2
- package/dist/{chunk-g20b01rn.js → chunk-ypvjzkfb.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.d.ts +5 -5
- 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/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 +2 -2
- 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 +3 -3
- package/dist/composer/prompt-input.js +1 -1
- 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 +312 -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-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/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/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/label.js +1 -1
- package/dist/ui/radio-group.js +1 -1
- package/dist/ui/separator.js +1 -1
- package/dist/ui/switch.js +1 -1
- package/dist/ui/textarea.js +1 -1
- package/dist/ui/tooltip.js +1 -1
- package/package.json +32 -4
- package/dist/chunk-2q9rzxbj.js +0 -2
- package/dist/chunk-36h9z1mt.js +0 -1
- package/dist/chunk-7tj0a2na.js +0 -2
- package/dist/chunk-8z8va1ws.js +0 -2
- package/dist/chunk-91nk8n6w.js +0 -2
- package/dist/chunk-c4cqqqqh.js +0 -2
- package/dist/chunk-cp20nzhv.js +0 -2
- package/dist/chunk-gfj69sqc.js +0 -2
- package/dist/chunk-mbrd76nh.js +0 -2
- package/dist/chunk-pc1yzf1x.js +0 -1
- package/dist/chunk-pqgtv07g.js +0 -2
- package/dist/chunk-reqrpvyy.js +0 -2
- package/dist/chunk-rgy601b7.js +0 -2
- package/dist/chunk-svmc952q.js +0 -7
- package/dist/chunk-tzdd96d0.js +0 -2
- package/dist/chunk-yvj5y06y.js +0 -2
package/README.md
CHANGED
|
@@ -18,24 +18,37 @@ 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`.
|
|
39
52
|
|
|
40
53
|
`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
54
|
|
package/dist/activity-host.d.ts
CHANGED
package/dist/activity-host.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{en,n,i}from"./chunk-azmqtycn.js";export{en as ActivityHostProvider,i as ActivityMarkdown,n as useActivityHost};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Ye}from"../chunk-6qn5srgg.js";import{e}from"../chunk-801v0awm.js";import{P}from"../chunk-jrrvpnf3.js";import{u}from"../chunk-7q7c0mds.js";import{o}from"../chunk-hx6wfscz.js";import{v,c}from"../chunk-k7zzrns3.js";import{s}from"../chunk-c4621n0b.js";import{Oe,se,w,W}from"../chunk-dr6z453e.js";import{autoUpdate as K}from"@floating-ui/dom";import{cn as _}from"cn";import{useCallback as I,useEffect as z,useLayoutEffect as D,useMemo as j,useRef as X,useState as L}from"react";import{createPortal as J}from"react-dom";import{jsx as n,jsxs as p}from"react/jsx-runtime";var f="__other__";function me({current:l,total:q,anchorRef:E,t:x,onAccept:B,onDecline:H}){let S=j(()=>l?Oe(l.requestedSchema):[],[l]),[T,k]=L({}),Q=X(null);z(()=>{if(l?.elicitationId===void 0)return;let t={};for(let{key:d,property:r}of S)if(!w(r)){let g=W(r)[0];if(g)t[d]={selected:g.value}}k(t)},[l?.elicitationId,S]),z(()=>{if(l?.elicitationId!==void 0&&Q.current&&document.activeElement?.tagName!=="INPUT"&&document.activeElement?.tagName!=="TEXTAREA")Q.current.focus()},[l?.elicitationId]);let[C,M]=L(null),[R,G]=L(null),U=I(()=>{let t=E.current;if(!t)return;let d=t.getBoundingClientRect();if(d.width===0){let r=Math.min(640,window.innerWidth*0.9);M({left:(window.innerWidth-r)/2,width:r,bottom:24});return}M({left:d.left,width:d.width,bottom:window.innerHeight-d.bottom+20})},[E]);D(()=>{if(!l)return;let t=0,d=()=>{if(E.current){U();return}t=requestAnimationFrame(d)};return d(),()=>cancelAnimationFrame(t)},[l,U,E]),D(()=>{let t=E.current;if(!l||!t||!R)return;return K(t,R,U,{animationFrame:!0})},[l,R,E,U]);let F=j(()=>{if(!l)return!1;for(let{key:t,property:d}of S){let r=T[t];if(!r)return!1;if(w(d)){if(!r.selectedSet||r.selectedSet.size===0)return!1;if(r.selectedSet.has(f)&&!r.otherText?.trim())return!1}else{if(!r.selected)return!1;if(r.selected===f&&!r.otherText?.trim())return!1}}return!0},[l,S,T]),V=I(async()=>{if(!l)return;if(!F)return;let t={},d={};for(let{key:r,property:g}of S){let m=T[r];if(!m)continue;let b;if(w(g))t[r]=[...m.selectedSet??[]].map((h)=>h===f?(m.otherText??"").trim():h).filter(Boolean);else{let h=m.selected??"";if(t[r]=h===f?(m.otherText??"").trim():h,h!==f)b=W(g).find((i)=>i.value===h)?.preview}let N=m.notes?.trim();if(b||N)d[r]={...b&&{preview:b},...N&&{notes:N}}}await B(l.elicitationId,t,d)},[l,S,T,F,B]),O=I(async()=>{if(l)await H(l.elicitationId)},[l,H]);if(!l||!C)return null;return J(p("div",{"data-overlay":"ask-user-question",tabIndex:0,onKeyDown:(t)=>{if(t.key==="Escape")t.preventDefault(),O()},className:"bg-card border-border fixed z-50 flex flex-col overflow-hidden rounded-lg border shadow-lg outline-none",style:{left:C.left,width:C.width,bottom:C.bottom,maxHeight:"70vh"},ref:(t)=>{Q.current=t,G(t)},children:[p("div",{className:"border-border flex shrink-0 items-center justify-between gap-2 border-b px-3 py-2",children:[n("div",{className:"text-foreground text-sm font-medium",children:x("askUserQuestion.title")}),q>1&&n("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${q}`})]}),n("div",{className:"min-h-0 flex-1 overflow-y-auto",children:n("div",{className:"space-y-4 px-3 py-3",children:S.map(({key:t,property:d},r)=>{let g=T[t],m=g?.selected,b=g?.selectedSet??new Set,N=W(d),h=w(d);return p("div",{className:"space-y-2",children:[p("div",{className:"flex items-center gap-2",children:[n(Ye,{variant:"secondary",className:"font-mono text-[10px] tracking-wide uppercase",children:se(d).title??t}),n("div",{className:"text-foreground text-sm font-medium",children:se(d).description})]}),h?p("div",{className:"space-y-1.5 ps-1",children:[N.map((i)=>p("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[n(P,{checked:b.has(i.value),onCheckedChange:(a)=>{k((y)=>{let A=new Set(y[t]?.selectedSet??new Set);if(a)A.add(i.value);else A.delete(i.value);return{...y,[t]:{...y[t],selectedSet:A}}})}}),p("div",{className:"min-w-0 flex-1",children:[n("div",{className:"text-foreground text-sm",children:i.label}),i.description&&n("div",{className:"text-muted-foreground text-xs",children:i.description})]})]},i.value)),p("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[n(P,{checked:b.has(f),onCheckedChange:(i)=>{k((a)=>{let y=new Set(a[t]?.selectedSet??new Set);if(i)y.add(f);else y.delete(f);return{...a,[t]:{...a[t],selectedSet:y}}})}}),n("div",{className:"text-foreground min-w-0 flex-1 text-sm",children:x("askUserQuestion.other")})]}),b.has(f)&&n("div",{className:"ps-7",children:n(u,{placeholder:x("askUserQuestion.otherPlaceholder"),value:g?.otherText??"",onChange:(i)=>k((a)=>({...a,[t]:{...a[t],otherText:i.target.value}}))})})]}):p(v,{value:m??"",onValueChange:(i)=>k((a)=>({...a,[t]:{...a[t],selected:i}})),className:"space-y-1.5 ps-1",children:[N.map((i)=>{let a=`${r}:${i.value}`;return p("div",{className:_("hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",m===i.value&&"bg-muted/60"),children:[n(c,{value:i.value,id:a}),p(o,{htmlFor:a,className:"min-w-0 flex-1 cursor-pointer",children:[n("div",{className:"text-foreground text-sm font-normal",children:i.label}),i.description&&n("div",{className:"text-muted-foreground text-xs font-normal",children:i.description})]})]},i.value)}),p("div",{className:_("hover:bg-muted/40 flex items-center gap-2 rounded-sm px-1.5 py-1",m===f&&"bg-muted/60"),children:[n(c,{value:f,id:`${r}:other`,className:"mt-0.5"}),n(o,{htmlFor:`${r}:other`,className:"text-foreground min-w-0 flex-1 cursor-pointer text-sm font-normal",children:x("askUserQuestion.other")})]}),m===f&&n("div",{className:"ps-7",children:n(u,{placeholder:x("askUserQuestion.otherPlaceholder"),value:g?.otherText??"",onChange:(i)=>k((a)=>({...a,[t]:{...a[t],otherText:i.target.value}}))})})]}),!h&&m&&m!==f&&(()=>{let i=N.find((a)=>a.value===m)?.preview;if(!i)return null;return n("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:i})})(),N.some((i)=>i.preview)&&n(s,{placeholder:x("askUserQuestion.notesPlaceholder"),value:g?.notes??"",onChange:(i)=>k((a)=>({...a,[t]:{...a[t],notes:i.target.value}})),rows:1,className:"min-h-0 resize-none text-xs"})]},t)})})}),p("div",{className:"border-border bg-card flex shrink-0 items-center justify-end gap-2 border-t px-3 py-2",children:[n(e,{variant:"ghost",size:"sm",onClick:()=>void O(),children:x("askUserQuestion.cancel")}),n(e,{size:"sm",disabled:!F,onClick:()=>void V(),children:x("askUserQuestion.submit")})]})]}),document.body)}export{me as ChoiceElicitationForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Oe,se,w,W}from"../chunk-dr6z453e.js";export{Oe as elicitationFields,se as elicitationLabels,W as elicitationOptions,w as isMultiSelect};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{on,ze,Fn,Dn}from"../chunk-5h13saah.js";export{on as PERMISSION_KIND_GROUP_ORDER,Fn as isAllowKind,Dn as isAlwaysKind,ze as sortPermissionOptions};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ze}from"../chunk-5h13saah.js";import{autoUpdate as L}from"@floating-ui/dom";import{cn as I}from"cn";import{CheckCheckIcon as M,CheckIcon as h,ShieldXIcon as V,XIcon as F}from"lucide-react";import{useCallback as H,useEffect as N,useId as T,useLayoutEffect as _,useRef as S,useState as f}from"react";import{createPortal as z}from"react-dom";import{jsx as i,jsxs as u}from"react/jsx-runtime";var U={allow_once:{icon:h},allow_always:{icon:M},reject_once:{icon:F},reject_always:{icon:V}};function Y({requestId:p,options:D,title:E,children:P,total:w=1,alwaysLabel:j="always",autoFocus:y="always",anchorRef:n,onRespond:r}){let b=T(),[a,g]=f(0),[s,v]=f(null),[l,A]=f(null),x=S(null),c=ze(D);N(()=>{g(0)},[p]),N(()=>{let e=document.activeElement;if(y==="always"||e===null||e===document.body)x.current?.focus()},[p,l,y]);let d=H(()=>{let e=n?.current;if(!e)return;let t=e.getBoundingClientRect();if(t.width===0){let o=Math.min(640,window.innerWidth*0.9);v({left:(window.innerWidth-o)/2,width:o,bottom:24});return}v({left:t.left,width:t.width,bottom:window.innerHeight-t.bottom+20})},[n]);if(_(()=>{if(!n)return;let e=0,t=()=>{if(n.current)d();else e=requestAnimationFrame(t)};return t(),()=>cancelAnimationFrame(e)},[p,n,d]),_(()=>{let e=n?.current;if(!e||!l)return;return L(e,l,d,{animationFrame:!0})},[n,l,d]),n&&!s)return null;let k=u("div",{ref:A,"data-overlay":"permission-request",className:I("bg-card border-border overflow-hidden rounded-lg border",n&&"fixed z-50"),style:n&&s?{left:s.left,width:s.width,bottom:s.bottom}:void 0,children:[u("div",{className:"border-border border-b px-3 py-2",children:[u("div",{className:"flex items-center justify-between gap-2",children:[i("div",{id:b,className:"text-foreground text-sm font-medium",children:E}),w>1&&i("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${w}`})]}),P]}),i("div",{role:"listbox","aria-labelledby":b,tabIndex:0,ref:x,onKeyDown:(e)=>{let t=c.length;if(t===0&&e.key!=="Escape")return;if(e.key==="ArrowDown"||e.key==="ArrowUp")e.preventDefault(),g((o)=>e.key==="ArrowDown"?(o+1)%t:(o-1+t)%t);else if(e.key==="Enter")e.preventDefault(),r(c[a].optionId);else if(e.key==="Escape")e.preventDefault(),r(null);else if(/^[1-9]$/.test(e.key)&&Number(e.key)<=t)e.preventDefault(),r(c[Number(e.key)-1].optionId)},className:"outline-none",children:c.map((e,t)=>{let o=e.kind??"allow_once",C=U[o]?.icon??h,K=o==="allow_always"||o==="reject_always",O=o==="reject_once"||o==="reject_always";return u("div",{role:"option",tabIndex:-1,"aria-selected":t===a,title:e.description,onClick:()=>void r(e.optionId),onKeyDown:(m)=>{if(m.key==="Enter"||m.key===" ")m.preventDefault(),m.stopPropagation(),r(e.optionId)},className:I("flex cursor-pointer items-center gap-2 px-3 py-1.5 text-sm select-none",t===a?"bg-ring text-accent-foreground":"text-foreground",O&&t!==a&&"text-muted-foreground"),children:[i("span",{className:"min-w-3 text-xs opacity-70",children:t+1}),i(C,{className:"size-3.5 shrink-0 opacity-80"}),i("span",{className:"min-w-0 flex-1 truncate",children:e.name}),K&&i("span",{className:"bg-muted text-muted-foreground rounded px-1.5 py-0.5 text-[10px] tracking-wide uppercase",children:j})]},e.optionId)})})]});return n?z(k,document.body):k}export{Y as PermissionView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e}from"../chunk-
|
|
1
|
+
import{e}from"../chunk-801v0awm.js";import{P}from"../chunk-jrrvpnf3.js";import{L,A,tt,nt,_,rt}from"../chunk-6p5hgnpq.js";import{o}from"../chunk-hx6wfscz.js";import"../chunk-h38yw8y3.js";import{ne,re,Fe,De,Be,G}from"../chunk-sky795ex.js";import{u}from"../chunk-7q7c0mds.js";import{v,c}from"../chunk-k7zzrns3.js";import{R}from"../chunk-9s1cgt7s.js";import{s}from"../chunk-c4621n0b.js";import{isArrayProperty as w,isBooleanProperty as D,isNumberProperty as S,isStringProperty as C}from"@alwith/api";import{useEffect as E,useMemo as N,useState as V}from"react";import{jsx as a,jsxs as p}from"react/jsx-runtime";function q(r){if(!C(r))return null;if(r.oneOf&&r.oneOf.length>0)return r.oneOf.map((t)=>({value:t.const,label:t.title??t.const,...t.description?{description:t.description}:{}}));if(r.enum&&r.enum.length>0)return r.enum.map((t)=>({value:t,label:t}));return null}function I(r){let t=r,n=t._meta?.alwith?.options;if(Array.isArray(n)&&Array.isArray(t.enum))return n.map((i)=>({value:i.const,label:i.title,...i.description?{description:i.description}:{}}));if(Array.isArray(t.enum))return t.enum.map((i)=>({value:String(i),label:String(i)}));if(Array.isArray(t.oneOf))return t.oneOf.map((i)=>({value:i.const,label:i.title,...i.description?{description:i.description}:{}}));return null}function B(r){let t=new Set(r.required??[]);return Object.entries(r.properties??{}).map(([n,i])=>({key:n,property:i,title:i.title??n,description:i.description??null,required:t.has(n),options:q(i),multiOptions:w(i)?I(i.items):null}))}function k(r){let t={};for(let n of r){let i=n.property.default;if(i!==void 0&&i!==null)t[n.key]=i;else if(n.options)t[n.key]=n.options[0].value;else if(D(n.property))t[n.key]=!1;else if(w(n.property))t[n.key]=[]}return t}function K(r,t){if(r.multiOptions)return Array.isArray(t)&&t.length>0;if(!r.required)return!0;return t!==void 0&&t!==""&&!(Array.isArray(t)&&t.length===0)}function O({id:r,label:t,description:n,control:i}){return p("div",{className:"hover:bg-muted/40 flex items-center gap-2 rounded-sm px-1.5 py-1",children:[i,p(o,{htmlFor:r,className:"min-w-0 flex-1 cursor-pointer font-normal",children:[a("div",{className:"text-foreground text-sm",children:t}),n&&a("div",{className:"text-muted-foreground text-xs",children:n})]})]})}function T({id:r,field:t,value:n,onChange:i}){if(t.multiOptions){let l=new Set(Array.isArray(n)?n:[]);return p(ne,{children:[a(re,{variant:"label",children:t.title}),t.description&&a(G,{children:t.description}),a("div",{className:"flex flex-col gap-1",children:t.multiOptions.map((d)=>{let f=`${r}:${d.value}`;return a(O,{id:f,...d,control:a(P,{id:f,checked:l.has(d.value),onCheckedChange:(y)=>{let g=new Set(l);if(y)g.add(d.value);else g.delete(d.value);i([...g])}})},d.value)})})]})}if(t.options)return p(ne,{children:[a(re,{variant:"label",children:t.title}),t.description&&a(G,{children:t.description}),a(v,{value:typeof n==="string"?n:"",onValueChange:(l)=>i(String(l)),className:"flex flex-col gap-1",children:t.options.map((l)=>{let d=`${r}:${l.value}`;return a(O,{id:d,...l,control:a(c,{value:l.value,id:d})},l.value)})})]});return p(De,{children:[a(Be,{htmlFor:r,children:t.title}),D(t.property)?a(R,{id:r,checked:n===!0,onCheckedChange:(l)=>i(l)}):S(t.property)?a(u,{id:r,type:"number",required:t.required,value:typeof n==="number"?n:"",onChange:(l)=>i(l.target.value===""?void 0:Number(l.target.value))}):a(s,{id:r,rows:2,required:t.required,value:typeof n==="string"?n:"",onChange:(l)=>i(l.target.value)}),t.description&&a(G,{children:t.description})]})}function ee({requestId:r,schema:t,message:n,total:i,t:l,onRespond:d}){let f=N(()=>B(t),[t]),[y,g]=V(()=>k(f));E(()=>g(k(f)),[r,f]);let b=f.every((m)=>K(m,y[m.key])),x=()=>{if(!b)return;let m={};for(let[h,F]of Object.entries(y))if(F!==void 0)m[h]=F;d({action:"accept",content:m})};return a(L,{open:!0,onOpenChange:(m)=>!m&&d({action:"cancel"}),children:p(A,{className:"flex max-h-[80vh] flex-col gap-4 sm:max-w-lg",onKeyDown:(m)=>{if(m.key==="Enter"&&(m.metaKey||m.ctrlKey))m.preventDefault(),x()},children:[p(tt,{children:[p("div",{className:"flex items-center justify-between gap-2 pe-8",children:[a(_,{children:t.title??l("approval.needed")}),i>1&&a("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${i}`})]}),a(rt,{children:n})]}),a("div",{className:"min-h-0 flex-1 overflow-y-auto",children:a(Fe,{children:f.map((m)=>a(T,{id:`${r}:${m.key}`,field:m,value:y[m.key],onChange:(h)=>g((F)=>({...F,[m.key]:h}))},m.key))})}),p(nt,{children:[a(e,{variant:"ghost",onClick:()=>d({action:"decline"}),children:l("actions.decline")}),a(e,{disabled:!b,onClick:x,children:l("actions.submit")})]})]})})}export{ee as SchemaElicitationForm,B as elicitationFields,k as initialValues,K as isAnswered};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e}from"../chunk-
|
|
1
|
+
import{e}from"../chunk-801v0awm.js";import{Ue,Ve,qe,Ke,Ge,We}from"../chunk-6qa5dt1k.js";import{ExternalLinkIcon as d}from"lucide-react";import{jsx as a,jsxs as n}from"react/jsx-runtime";function C({message:r,url:t,t:i,onOpen:l,onRespond:o}){return n(Ue,{size:"sm",children:[n(Ve,{children:[a(Ke,{children:i("approval.needed")}),a(qe,{children:r})]}),a(Ge,{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(We,{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")})]})]})}export{C as UrlElicitationCard};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function Rt(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 Lt(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{Rt,Lt};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{s}from"./chunk-c4621n0b.js";import{cn as n}from"cn";import{jsx as o}from"react/jsx-runtime";function ce({className:r,...e}){return o(s,{"data-slot":"input-group-control",className:n("flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent",r),...e})}
|
|
2
|
+
export{ce};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{nativeTurnId as a}from"@nyssance/codex-acp-v2/client";function xt(o,i){let u=new Set,s=(e)=>{let t=e.items.map(a).find((r)=>r!==null),n=e.items.every((r)=>r.replayed);if(t===void 0||u.has(t))return{turnKey:e.key,turn:e,deferUntilReady:n};return u.add(t),{turnKey:`history:${t}`,aliases:[e.key],turn:e,deferUntilReady:n}};if(!i?.complete)return o.map(s);let d=new Map;for(let e of o){let t=e.items.map(a).find((r)=>r!==null);if(t===void 0)continue;let n=d.get(t)??[];n.push(e),d.set(t,n)}let l=new Set(i.turns.map((e)=>e.turnId)),y=new Set(i.loadedTurnIds);return[...i.turns.flatMap((e)=>{let t=d.get(e.turnId);if(t)return t.map(s);return y.has(e.turnId)?[]:[{turnKey:`history:${e.turnId}`,nativeTurnId:e.turnId,estimatedHeightPx:320,placeholder:!0}]}),...o.filter((e)=>!e.items.some((t)=>l.has(a(t)??""))).map(s)]}
|
|
2
|
+
export{xt};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{kt}from"./chunk-w3yddw6n.js";import{t}from"./chunk-vw2hv2sq.js";import{Rt,Lt}from"./chunk-15nwm04a.js";import{p}from"./chunk-fgsd4fsd.js";import{h}from"./chunk-fvnb8ds4.js";import{isEmbeddedResource as g,isImage as d,isResourceLink as f,isText as x}from"@alwith/api";import{memo as q}from"react";import{jsx as r,jsxs as y}from"react/jsx-runtime";var wt=q(function({item:s,messageTime:c}){let l=t(),o=Lt(s._meta),m=o?o.map((e)=>e.question===void 0?e.text:`${e.question}
|
|
2
|
+
${e.text}`).join(`
|
|
3
|
+
`):h(s),a=s.content.filter(d),i=s.content.filter((e)=>f(e)||g(e)),u=o??s.content.filter(x).map((e)=>{let n=Rt(e._meta);return n?{question:n.question,text:n.answer}:{text:e.text}});if(m.length===0&&a.length===0&&i.length===0)return null;return y("div",{className:"group/codex-user flex min-w-0 flex-col items-end gap-2","data-content-search-unit-key":s.id,children:[i.length>0&&r("div",{className:"codex-user-mentions",children:i.map((e,n)=>r(p,{block:e},`${s.id}:${n}`))}),r(kt,{host:l,message:s,text:m,textParts:u.some((e)=>("question"in e))?u:void 0,images:a,mentions:[],messageTime:c})]})});
|
|
4
|
+
export{wt};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Menu as n}from"@base-ui/react/menu";import{cn as i}from"cn";import{CheckIcon as
|
|
1
|
+
import{Menu as n}from"@base-ui/react/menu";import{cn as i}from"cn";import{CheckIcon as c,ChevronRightIcon as p}from"lucide-react";import{jsx as t,jsxs as u}from"react/jsx-runtime";function k({...e}){return t(n.Root,{"data-slot":"dropdown-menu",...e})}function $n({...e}){return t(n.Portal,{"data-slot":"dropdown-menu-portal",...e})}function C({...e}){return t(n.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function x({align:e="start",alignOffset:o=0,side:a="bottom",sideOffset:r=4,className:d,...s}){return t(n.Portal,{children:t(n.Positioner,{className:"isolate z-50 outline-none",align:e,alignOffset:o,side:a,sideOffset:r,children:t(n.Popup,{"data-slot":"dropdown-menu-content",className:i("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 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md p-1 shadow-md ring-1 duration-100 outline-none data-closed:overflow-hidden",d),...s})})})}function T({...e}){return t(n.Group,{"data-slot":"dropdown-menu-group",...e})}function j({className:e,inset:o,...a}){return t(n.GroupLabel,{"data-slot":"dropdown-menu-label","data-inset":o,className:i("text-muted-foreground px-2 py-1.5 text-xs font-medium data-inset:pl-8",e),...a})}function I({className:e,inset:o,variant:a="default",...r}){return t(n.Item,{"data-slot":"dropdown-menu-item","data-inset":o,"data-variant":a,className:i("group/dropdown-menu-item focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:*:[svg]:text-destructive relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r})}function H({...e}){return t(n.SubmenuRoot,{"data-slot":"dropdown-menu-sub",...e})}function F({className:e,inset:o,children:a,...r}){return u(n.SubmenuTrigger,{"data-slot":"dropdown-menu-sub-trigger","data-inset":o,className:i("focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-popup-open:bg-accent data-popup-open:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[a,t(p,{className:"ml-auto"})]})}function D({align:e="start",alignOffset:o=-3,side:a="right",sideOffset:r=0,className:d,...s}){return t(x,{"data-slot":"dropdown-menu-sub-content",className:i("bg-popover text-popover-foreground ring-foreground/10 data-[side=bottom]:slide-in-from-top-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 w-auto min-w-[96px] rounded-md p-1 shadow-lg ring-1 duration-100",d),align:e,alignOffset:o,side:a,sideOffset:r,...s})}function ue({className:e,children:o,checked:a,inset:r,...d}){return u(n.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item","data-inset":r,className:i("focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),checked:a,...d,children:[t("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-checkbox-item-indicator",children:t(n.CheckboxItemIndicator,{children:t(c,{})})}),o]})}function ot({...e}){return t(n.RadioGroup,{"data-slot":"dropdown-menu-radio-group",...e})}function it({className:e,children:o,inset:a,...r}){return u(n.RadioItem,{"data-slot":"dropdown-menu-radio-item","data-inset":a,className:i("focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[t("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-radio-item-indicator",children:t(n.RadioItemIndicator,{children:t(c,{})})}),o]})}function l({className:e,...o}){return t(n.Separator,{"data-slot":"dropdown-menu-separator",className:i("bg-border -mx-1 my-1 h-px",e),...o})}function Un({className:e,...o}){return t("span",{"data-slot":"dropdown-menu-shortcut",className:i("text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground ml-auto text-xs tracking-widest",e),...o})}export{k,$n,C,x,T,j,I,H,F,D,ue,ot,it,l,Un};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{CacheStorage as I,Soundfont as M}from"smplr";var T=4,y=21,l=88,s=[39,41,43,44,46,48,50],p=0.035,b=0.16,S=88,E=50,h="acoustic_grand_piano",O="MusyngKite",w="FluidR3_GM",f=[0,2,4,5,7,9,11],U=2,C=5,m=globalThis;if(m.__alwithTimelineUserMessageNavigationAudio?.version!==T)m.__alwithTimelineUserMessageNavigationAudio={version:T,context:null,storage:I("alwith-timeline-navigation-instruments"),players:new Map,nextNoteTime:0,unlockConsumerCount:0};var r=m.__alwithTimelineUserMessageNavigationAudio;function d(){return r.context??=new AudioContext,r.context}function c(){let e=d();if(e.state==="running"){r.nextNoteTime=e.currentTime;return}e.resume().then(()=>{r.nextNoteTime=e.currentTime},(n)=>{if(n instanceof DOMException&&n.name==="NotAllowedError")return;console.error("Failed to unlock timeline navigation audio",n)})}function k(e){let n=d();return M(n,{instrument:e,kit:e===h?O:w,storage:r.storage,volume:E})}function g(e){let n=r.players.get(e);if(n!==void 0)return n;let t=k(e),i={player:t,ready:t.ready};return r.players.set(e,i),i}function Ft(e){g(e).ready.catch((n)=>{console.error(`Failed to load navigation instrument "${e}"`,n)})}function Xn(){c()}function Dt(){if(r.unlockConsumerCount===0)window.addEventListener("pointerdown",c,{capture:!0}),window.addEventListener("keydown",c,{capture:!0});return r.unlockConsumerCount++,()=>{if(r.unlockConsumerCount--,r.unlockConsumerCount===0)window.removeEventListener("pointerdown",c,{capture:!0}),window.removeEventListener("keydown",c,{capture:!0})}}function Bt(e,n,t,i,o){if(o==="none")return;let a=Math.sign(n-e),u=Math.abs(n-e),x=Array.from({length:u},(L,A)=>{let N=e+a*(A+1),v=t[N];return ln(N,t.length,v.inputTokens,v.outputTokens,o)});_(i,x)}function Yn(e,n,t,i,o,a){if(a==="none")return;_(o,[ln(e,n,t,i,a)])}function ln(e,n,t,i,o){if(o==="none")throw Error("navigationMidiNote: 声音已关闭,不该求音符");if(o==="auto")return yn(t,i);return dn(e,n)}function yn(e,n){let t=Math.imul(e,5)+Math.imul(n,3)>>>0,i=(Math.imul(e,11)^Math.imul(n,13))>>>0,o=t%f.length;return 12*(U+i%C+1)+f[o]}function dn(e,n){return y+wn(e,n)}function Zn(e,n){return D(dn(e,n))}function wn(e,n){if(n<=l)return kn(n)[n-e-1];return Math.round((n-e-1)/(n-1)*(l-1))}function kn(e){if(e<=s.length)return s.slice(0,e);let n=new Set(s),t=s[0]-1,i=s.at(-1)+1;while(n.size<e&&(t>=0||i<l)){if(t>=0&&n.size<e)n.add(t--);if(i<l&&n.size<e)n.add(i++)}for(let o=0;n.size<e&&o<l;o++)n.add(o);return[...n].toSorted((o,a)=>o-a)}function D(e){return 440*2**((e-69)/12)}function _(e,n){let t=d();if(t.state!=="running")return;let{player:i,ready:o}=g(e);o.then(()=>{let a=Math.max(t.currentTime,r.nextNoteTime);for(let u=0;u<n.length;u++)i.start({note:n[u],time:a+u*p,duration:b,velocity:S});r.nextNoteTime=a+n.length*p}).catch((a)=>{console.error(`Failed to play navigation instrument "${e}"`,a)})}function Jn(){return r.context?.state}function er(e){return g(e).ready}
|
|
2
|
+
export{Ft,Xn,Dt,Bt,Yn,ln,yn,dn,Zn,wn,kn,Jn,er};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a,Ie,Yt,Pe,Zt,Ne,Jt}from"./chunk-5grywgpq.js";import{t,b,Se,g}from"./chunk-vw2hv2sq.js";import{isText as N}from"@alwith/api";import{createStore as M}from"@alwith/api/client";import{nativeTurnId as x}from"@nyssance/codex-acp-v2/client";import{jsx as f,jsxs as T}from"react/jsx-runtime";var Q=M({entries:{}});function m(n,s){Q.setState((e)=>({entries:{...e.entries,[n]:s}}))}function h(n,s){let e=x(s),r=n.items.findLast((o)=>x(o)!==null),p=n.items.some((o)=>o.kind==="user"&&x(o)===e&&n.turnEndedAt[o.id]!==void 0);return!s.replayed&&e!==null&&r!==void 0&&n.state!=="idle"&&!p&&x(r)===e}function C(n,s){for(let e of n.items){if(e.kind!=="user"||e.echo==="pending")continue;for(let r of[...Ne(e._meta),...e.content.filter(N).flatMap((p)=>Ne(p._meta))])if(r.questionItemId===s)return r.answer}return}function R({sessionId:n,item:s,question:e,index:r}){let p=b(),{t:o}=t(),w=Ie(s.id,r),c=JSON.stringify([n,w]),l=Se(Q,(i)=>i.entries[c]),u=g((i)=>i.sessions[n]),A=g((i)=>i.connection==="ready"),d=l?.draft??Yt(e),v=u===void 0?l?.accepted:C(u,w)??l?.accepted,q=u!==void 0&&h(u,s),D=A&&u?.attached&&!u.restoring&&!u.readOnly,y=v!==void 0?"answered":l?.skipped?"skipped":l?.pending?"submitting":!q?"closed":!D?"unavailable":"pending",E=async()=>{if(Q.getState().entries[c]?.pending||y!=="pending")return;let i=p.state.sessions[n];if(i===void 0||!h(i,s)||!i.attached||i.readOnly||i.restoring)return;let S=Pe(e,d);if(!S.trim())return;let k={questionItemId:w,question:e.title,answer:S};m(c,{draft:d,pending:!0});try{await p.prompt(n,[{type:"text",text:Zt(k),_meta:{codex:{questionReply:k}}}]),m(c,{draft:d,accepted:S})}catch(I){m(c,{draft:d,error:I instanceof Error?I.message:String(I)})}};if(y==="closed")return T("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:o("asyncQuestion.closed")})]});return f(Jt,{question:e,draft:d,status:y,answer:v,error:y==="pending"?l?.error:void 0,t:o,onChange:(i)=>m(c,{draft:i}),onSkip:()=>m(c,{draft:d,skipped:!0}),onSubmit:()=>{E()}})}function vt({sessionId:n,item:s}){return f("div",{className:"flex min-w-0 flex-col gap-3","data-async-questions":s.id,children:a(s._meta).map((e,r)=>f(R,{sessionId:n,item:s,question:e,index:r},Ie(s.id,r)))})}
|
|
2
|
+
export{vt};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{ot,it}from"./chunk-2epnn4sq.js";import{cn as l}from"cn";import{jsx as t,jsxs as a}from"react/jsx-runtime";function r({value:i,onValueChange:n,options:o,itemClassName:d}){return t(ot,{value:i,onValueChange:(e)=>n(String(e)),children:o.map((e)=>a(it,{value:e.value,disabled:e.disabled,title:e.title,closeOnClick:!0,className:l("gap-2",e.description?"items-start":"items-center",d),children:[e.icon,e.description?a("div",{className:"min-w-0 flex-1",children:[t("div",{className:"text-xs font-medium",children:e.label}),t("div",{className:"text-muted-foreground text-[11px] font-normal",children:e.description})]}):t("span",{className:"min-w-0 flex-1 truncate text-start",children:e.label})]},e.value))})}
|
|
2
|
+
export{r};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`).length}function
|
|
3
|
-
export{
|
|
1
|
+
import{n}from"./chunk-azmqtycn.js";import{ChevronDownIcon as v,ChevronUpIcon as b,FileDiffIcon as C}from"lucide-react";import{useState as m}from"react";import{jsx as d,jsxs as o}from"react/jsx-runtime";function x(e){if(e===null||e.length===0)return 0;return e.split(`
|
|
2
|
+
`).length}function xn(e){let l=new Map;for(let u of e)for(let a of u.content){if(a.type!=="diff")continue;let f=a,r=f._meta?.alwith?.hunks??[],h=r.reduce((i,s)=>i+x(s.newText),0),c=r.reduce((i,s)=>i+x(s.oldText),0);for(let i of f.changes){let s=l.get(i.path);if(s)s.additions+=h,s.deletions+=c;else l.set(i.path,{path:i.path,additions:h,deletions:c})}}return[...l.values()]}function yt({blocks:e}){return d(ve,{files:xn(e)})}function ve({files:e,onOpen:l,renderPath:u}){let{t:a,openLink:f}=n(),[r,h]=m(!0),[c,i]=m(!1);if(e.length===0)return null;let s=e.reduce((t,p)=>t+p.additions,0),g=e.reduce((t,p)=>t+p.deletions,0);return o("section",{className:"codex-edited-files-card",children:[o("div",{className:"codex-edited-files-header",children:[d("div",{className:"codex-edited-files-icon","aria-hidden":"true",children:d(C,{})}),o("div",{className:"codex-edited-files-summary",children:[d("strong",{children:a("stream.codex.editedFilesCount",{count:e.length})}),d("button",{type:"button","data-codex-disclosure":"",onClick:()=>{h((t)=>!t),i(!1)},"aria-expanded":r,children:a(r?"stream.codex.hideChanges":"stream.codex.viewChanges")})]}),o("div",{className:"codex-edited-files-total",title:a("stream.codex.changedLines"),children:[o("span",{className:"codex-diff-additions",children:["+",s]}),o("span",{className:"codex-diff-deletions",children:["-",g]})]})]}),r&&o("div",{className:"codex-edited-files-list",children:[(c?e:e.slice(0,3)).map((t)=>o("div",{className:"codex-edited-file-row",children:[d("button",{type:"button",className:"codex-edited-file-path",title:t.path,onClick:()=>l===void 0?f(t.path):l(t),children:u===void 0?t.path:u(t)}),o("span",{className:"codex-edited-file-counts",children:[o("span",{className:"codex-diff-additions",children:["+",t.additions]}),o("span",{className:"codex-diff-deletions",children:["-",t.deletions]})]})]},t.path)),e.length>3&&o("button",{type:"button",className:"codex-edited-files-more","aria-expanded":c,onClick:()=>i((t)=>!t),children:[a(c?"stream.codex.showFewerFiles":"stream.codex.showMoreFiles",{count:e.length-3}),c?d(b,{size:16,"aria-hidden":"true"}):d(v,{size:16,"aria-hidden":"true"})]})]})]})}
|
|
3
|
+
export{xn,yt,ve};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i}from"./chunk-azmqtycn.js";import{f}from"./chunk-v0zn87k5.js";import{isPlanItems as n,isPlanMarkdown as r}from"@alwith/api";import{jsx as e}from"react/jsx-runtime";function Et({plan:t}){if(r(t))return e("div",{className:"codex-reasoning-details",children:e(i,{text:t.content,streaming:!1})});if(!n(t))return null;return e(f,{entries:t.entries})}
|
|
2
|
+
export{Et};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{e}from"./chunk-801v0awm.js";import{o}from"./chunk-hx6wfscz.js";import{v,c}from"./chunk-k7zzrns3.js";import{s}from"./chunk-c4621n0b.js";import{useId as h}from"react";import{jsx as l,jsxs as g,Fragment as A}from"react/jsx-runtime";function p(n){return n!==null&&typeof n==="object"&&!Array.isArray(n)}function a(n){if(!p(n)||!p(n.codex))return[];let i=n.codex,r=i.questions;if(i.delivery!=="async"||!Array.isArray(r))return[];if(!r.every((t)=>p(t)&&typeof t.title==="string"&&t.title.trim().length>0&&(t.options===null||Array.isArray(t.options)&&t.options.every((d)=>typeof d==="string"))))return[];return r}function Ie(n,i){return JSON.stringify(["request_user_input_async",n,i])}function Yt(n){return{selected:n.options?.length?0:null,text:""}}function Pe(n,i){return i.selected===null?i.text:n.options?.[i.selected]??""}function Zt(n){return`<send_user_message_question_reply>
|
|
2
|
+
${JSON.stringify([n])}
|
|
3
|
+
</send_user_message_question_reply>`}function Ne(n){if(!p(n)||!p(n.codex))return[];let i=n.codex;return(Array.isArray(i.questionReplyParts)?i.questionReplyParts.map((t)=>p(t)?{...t,answer:t.text}:t):[i.questionReply]).filter((t)=>p(t)&&typeof t.questionItemId==="string"&&typeof t.question==="string"&&typeof t.answer==="string").map(({questionItemId:t,question:d,answer:m})=>({questionItemId:t,question:d,answer:m}))}function Jt({question:n,draft:i,status:r,answer:t,error:d,onChange:m,onSubmit:w,onSkip:Q,t:u}){let f=h(),x=r==="pending",k=r==="answered"||r==="skipped";return g("section",{"aria-labelledby":`${f}-title`,className:"border-border bg-card text-card-foreground flex min-w-0 flex-col gap-3 rounded-xl border p-4",children:[l("h3",{id:`${f}-title`,className:"text-sm font-medium whitespace-pre-wrap",children:n.title}),k?l("p",{className:"text-sm whitespace-pre-wrap",children:r==="answered"?t:u("asyncQuestion.skipped")}):g(A,{children:[(n.options?.length??0)>0&&g(v,{"aria-labelledby":`${f}-title`,disabled:!x,value:i.selected===null?"other":String(i.selected),onValueChange:(y)=>m({...i,selected:y==="other"?null:Number(y)}),children:[n.options?.map((y,b)=>g(o,{className:"flex items-start gap-2 text-sm",children:[l(c,{value:String(b)}),l("span",{className:"whitespace-pre-wrap",children:y})]},b)),g(o,{className:"flex items-center gap-2 text-sm",children:[l(c,{value:"other"}),u("asyncQuestion.other")]})]}),l(s,{"aria-label":u("asyncQuestion.answer"),placeholder:u("asyncQuestion.answer"),value:i.text,readOnly:!x,onChange:(y)=>m({selected:null,text:y.target.value})}),d&&l("p",{role:"alert",className:"text-destructive text-sm",children:d}),g("div",{className:"flex flex-wrap items-center gap-2",children:[l(e,{size:"sm",disabled:!x||Pe(n,i).trim().length===0,onClick:w,children:u(r==="submitting"?"asyncQuestion.submitting":"asyncQuestion.submit")}),l(e,{size:"sm",variant:"ghost",disabled:!x,onClick:Q,children:u("asyncQuestion.skip")}),(r==="closed"||r==="unavailable")&&l("span",{role:"status",className:"text-muted-foreground text-xs",children:u(`asyncQuestion.${r}`)})]})]})]})}
|
|
4
|
+
export{a,Ie,Yt,Pe,Zt,Ne,Jt};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var on={allow_once:0,allow_always:1,reject_once:2,reject_always:3};function ze(e){return[...e].toSorted((o,n)=>(on[o.kind]??99)-(on[n.kind]??99))}function Fn(e){return e==="allow_once"||e==="allow_always"}function Dn(e){return e==="allow_always"||e==="reject_always"}
|
|
2
|
+
export{on,ze,Fn,Dn};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{codexMessageError as u,codexTurnError as a}from"@nyssance/codex-acp-v2/client";var c=[10,30,120,300];function Tt(e){let n=0;for(let r=e.length-1;r>=0;r--){let o=e[r],t=o.errors.at(-1),l=t===void 0?null:u(t);if(l===null||a(l).category!=="overloaded")break;if(n++,o.user!==null)break}return c[n-1]??null}
|
|
2
|
+
export{Tt};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e}from"./chunk-
|
|
1
|
+
import{e}from"./chunk-801v0awm.js";import{Dialog as i}from"@base-ui/react/dialog";import{cn as r}from"cn";import{XIcon as d}from"lucide-react";import{jsx as a,jsxs as l}from"react/jsx-runtime";function L({...o}){return a(i.Root,{"data-slot":"dialog",...o})}function zn({...o}){return a(i.Trigger,{"data-slot":"dialog-trigger",...o})}function pn({...o}){return a(i.Portal,{"data-slot":"dialog-portal",...o})}function et({...o}){return a(i.Close,{"data-slot":"dialog-close",...o})}function gn({className:o,...t}){return a(i.Backdrop,{"data-slot":"dialog-overlay",className:r("data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0 fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs",o),...t})}function A({className:o,children:t,showCloseButton:n=!0,...s}){return l(pn,{children:[a(gn,{}),l(i.Popup,{"data-slot":"dialog-content",className:r("bg-popover text-popover-foreground ring-foreground/10 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 fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl p-6 text-sm ring-1 duration-100 outline-none sm:max-w-md",o),...s,children:[t,n&&l(i.Close,{"data-slot":"dialog-close",render:a(e,{variant:"ghost",className:"absolute top-4 right-4",size:"icon-sm"}),children:[a(d,{}),a("span",{className:"sr-only",children:"Close"})]})]})]})}function tt({className:o,...t}){return a("div",{"data-slot":"dialog-header",className:r("flex flex-col gap-2",o),...t})}function nt({className:o,showCloseButton:t=!1,children:n,...s}){return l("div",{"data-slot":"dialog-footer",className:r("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",o),...s,children:[n,t&&a(i.Close,{render:a(e,{variant:"outline"}),children:"Close"})]})}function _({className:o,...t}){return a(i.Title,{"data-slot":"dialog-title",className:r("font-heading leading-none font-medium",o),...t})}function rt({className:o,...t}){return a(i.Description,{"data-slot":"dialog-description",className:r("text-muted-foreground *:[a]:hover:text-foreground text-sm *:[a]:underline *:[a]:underline-offset-3",o),...t})}export{L,zn,pn,et,gn,A,tt,nt,_,rt};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cn as r}from"cn";import{jsx as d}from"react/jsx-runtime";function
|
|
1
|
+
import{cn as r}from"cn";import{jsx as d}from"react/jsx-runtime";function Ue({className:a,size:t="default",...o}){return d("div",{"data-slot":"card","data-size":t,className:r("group/card bg-card text-card-foreground ring-foreground/10 flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl py-(--card-spacing) text-sm shadow-xs ring-1 [--card-spacing:--spacing(6)] has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(4)] *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",a),...o})}function Ve({className:a,...t}){return d("div",{"data-slot":"card-header",className:r("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)",a),...t})}function qe({className:a,...t}){return d("div",{"data-slot":"card-title",className:r("font-heading text-base leading-normal font-medium group-data-[size=sm]/card:text-sm",a),...t})}function Ke({className:a,...t}){return d("div",{"data-slot":"card-description",className:r("text-muted-foreground text-sm",a),...t})}function On({className:a,...t}){return d("div",{"data-slot":"card-action",className:r("col-start-2 row-span-2 row-start-1 self-start justify-self-end",a),...t})}function Ge({className:a,...t}){return d("div",{"data-slot":"card-content",className:r("flex flex-col gap-3 px-(--card-spacing)",a),...t})}function We({className:a,...t}){return d("div",{"data-slot":"card-footer",className:r("flex items-center rounded-b-xl px-(--card-spacing) [.border-t]:pt-(--card-spacing)",a),...t})}export{Ue,Ve,qe,Ke,On,Ge,We};
|
|
@@ -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 mn=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 Ye({className:r,variant:e="default",render:t,...i}){return n({defaultTagName:"span",props:a({className:d(mn({variant:e}),r)},i),render:t,state:{slot:"badge",variant:e}})}export{mn,Ye};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function Re(t,e){if(e===0)return null;let r=e-1;while(r>=0){let n=t[r];if(n===" "||n==="\t"||n===`
|
|
2
2
|
`)return null;if(n==="@"||n==="/"){let i=r===0?"":t[r-1],s=r===0||i===`
|
|
3
3
|
`;if(n==="/"?s&&!/[/\\]/.test(t.slice(r+1,e)):s||i===" "||i==="\t")return{kind:n==="/"?"slash":"at",start:r,end:e,query:t.slice(r+1,e)}}r-=1}return null}
|
|
4
|
-
export{
|
|
4
|
+
export{Re};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function
|
|
2
|
-
export{
|
|
1
|
+
function be(r){if(!r.trimStart().toLowerCase().startsWith("gpt"))return r;let a=/^gpt-\d/iu.test(r.trimStart())?" ":"-";return r.split(/(\s+)/).map((i)=>i.trim().length===0?i:i.split("-").map((t,o)=>{if(t.toLowerCase()==="gpt")return"GPT";if(t.toLowerCase()==="oai")return"OAI";return o>0&&t.length>0?`${t[0]?.toUpperCase()}${t.slice(1)}`:t}).join(a).replace(/^GPT (?=\d)/u,"GPT-")).join("")}
|
|
2
|
+
export{be};
|
|
@@ -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 u({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{u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Button as n}from"@base-ui/react/button";import{cva as d}from"class-variance-authority";import{cn as o}from"cn";import{jsx as s}from"react/jsx-runtime";var
|
|
1
|
+
import{Button as n}from"@base-ui/react/button";import{cva as d}from"class-variance-authority";import{cn as o}from"cn";import{jsx as s}from"react/jsx-runtime";var Tn=d("group/button 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 inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:ring-3 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:ring-3 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50 shadow-xs",secondary:"bg-secondary text-secondary-foreground aria-expanded:bg-secondary aria-expanded:text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",lg:"h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-9","icon-xs":"size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function e({className:r,variant:t="default",size:i="default",...a}){return s(n,{"data-slot":"button",className:o(Tn({variant:t,size:i,className:r})),...a})}export{Tn,e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e}from"./chunk-
|
|
1
|
+
import{e}from"./chunk-801v0awm.js";import{cva as i}from"class-variance-authority";import{cn as r}from"cn";import{jsx as o}from"react/jsx-runtime";function $e({className:a,...t}){return o("div",{"data-slot":"input-group",role:"group",className:r("group/input-group border-input has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20 dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 relative flex h-9 w-full min-w-0 items-center rounded-md border shadow-xs transition-[color,box-shadow] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-3 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",a),...t})}var p=i("text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-2 has-[>button]:-ml-1 has-[>kbd]:ml-[-0.15rem]","inline-end":"order-last pr-2 has-[>button]:-mr-1 has-[>kbd]:mr-[-0.15rem]","block-start":"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2","block-end":"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"}},defaultVariants:{align:"inline-start"}});function le({className:a,align:t="inline-start",...s}){return o("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:r(p({align:t}),a),onClick:(n)=>{if(n.target.closest("button"))return;n.currentTarget.parentElement?.querySelector("input")?.focus()},...s})}var l=i("flex items-center gap-2 text-sm shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",sm:"","icon-xs":"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function de({className:a,type:t="button",variant:s="ghost",size:n="xs",...u}){return o(e,{type:t,"data-size":n,variant:s,className:r(l({size:n}),a),...u})}function Bn({className:a,...t}){return o("span",{className:r("text-muted-foreground flex items-center gap-2 text-sm [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",a),...t})}export{$e,le,de,Bn};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{e}from"./chunk-801v0awm.js";import{t}from"./chunk-vw2hv2sq.js";import{codexTurnError as T}from"@nyssance/codex-acp-v2/client";import{AlertCircleIcon as R}from"lucide-react";import{useEffect as C,useRef as u,useState as s}from"react";import{jsx as o,jsxs as m}from"react/jsx-runtime";function ye({children:l}){return m("div",{className:"codex-error-message",role:"alert",children:[o(R,{"aria-hidden":"true"}),o("div",{className:"min-w-0 flex-1",children:l})]})}function we({error:l,retry:r}){let{t:f}=t(),p=T(l),[c]=s(()=>r?.delaySeconds==null?null:Date.now()+r.delaySeconds*1000),[v,y]=s(r?.delaySeconds??null),[N,w]=s(!1),[g,x]=s(null),a=u(!1),E=u(!1),S=u(r?.run);S.current=r?.run;let b=u((h)=>{let i=S.current;if(a.current||i===void 0)return;a.current=!0,w(!0),x(null),i(h).catch((n)=>{E.current=!0,a.current=!1,y(null),w(!1),x(n instanceof Error?n.message:String(n))})}),d=r!==void 0&&p.retryable;return C(()=>{if(!d||c===null)return;let i=setInterval(()=>{if(E.current||a.current)return;let n=Math.max(0,Math.ceil((c-Date.now())/1000));if(y(n),n===0)b.current("automatic")},1000);return()=>clearInterval(i)},[c,d]),m(ye,{children:[m("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[o("div",{className:"min-w-0 flex-1 whitespace-pre-wrap",children:p.message}),d&&o(e,{variant:"outline",size:"sm",disabled:N,onClick:()=>b.current("manual"),children:v===null?f("timeline.retry"):f("timeline.retryCountdown",{seconds:v})})]}),g!==null&&o("div",{className:"text-muted-foreground mt-2 text-sm",children:g})]})}
|
|
2
|
+
export{ye,we};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useCallback as f,useEffect as U,useRef as s,useState as X}from"react";var S=24,q=160,z=45,j=()=>{};function At(e,Y,u=j){let r=s("following"),[A,b]=X(!0),D=s(Y);D.current=Y;let a=s(null),y=s(0),P=s(0),k=s(0),p=s(0),m=s(0),h=s(0),_=s(!1),g=s(null),o=f(()=>{if(a.current!==null)cancelAnimationFrame(a.current);a.current=null},[]),v=f(()=>{u(),o(),h.current++,g.current=null,m.current=0,r.current="reading",b(!1)},[o,u]),T=f(()=>{if(e===null||r.current!=="following"||a.current!==null)return;if(e.scrollTop>=Math.max(0,e.scrollHeight-e.clientHeight))return;y.current=performance.now(),P.current=e.scrollTop,k.current=0;let l=(c)=>{if(a.current=null,r.current!=="following")return;let i=Math.max(0,e.scrollHeight-e.clientHeight),w=i-e.scrollTop;if(w<=0)return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches||w<=1)e.scrollTop=i;else{let E=Math.max(0,c-y.current),H=e.scrollTop===P.current?k.current:0,L=e.scrollTop+H+(w-H)*(1-Math.exp(-E/z));e.scrollTop=L,P.current=e.scrollTop,k.current=L-e.scrollTop,a.current=requestAnimationFrame(l)}y.current=c,p.current=e.scrollTop};a.current=requestAnimationFrame(l)},[e]),d=f(()=>{u(),h.current++,g.current=null,m.current=0,r.current="following",b(!0),T()},[u,T]),B=f((l)=>{u(),o();let c=++h.current;return r.current="locating",_.current=l,g.current=null,m.current=0,b(l),{isCurrent:()=>h.current===c,finish:(i)=>{if(h.current!==c||e===null)return;e.scrollTo({top:i,behavior:"instant"}),p.current=e.scrollTop,r.current=l?"following":"reading"}}},[o,u,e]),x=f(()=>{if(h.current++,r.current==="locating")r.current=_.current?"following":"reading"},[]),G=f((l=null)=>{if(e===null)return;let c=g.current;if(c!==null&&e.scrollHeight!==c){if(g.current=null,e.scrollHeight<c&&e.scrollHeight-e.clientHeight-e.scrollTop<=S)d()}if(r.current==="following"&&l!==null)o(),e.scrollTo({top:l,behavior:"instant"}),p.current=e.scrollTop;else T()},[o,e,T,d]);return U(()=>{if(e===null)return;p.current=e.scrollTop,r.current=e.scrollHeight-e.clientHeight-e.scrollTop<=S?"following":"reading",b(r.current==="following");let l=!1,c=!1,i=null,w=e.closest('[data-slot="scroll-area"]'),F=w??e,E=(n)=>{if(g.current=null,(n<0||r.current==="locating")&&e.scrollHeight>e.clientHeight)v();else u();if(m.current=n,r.current==="reading"&&n>0&&e.scrollHeight-e.clientHeight-e.scrollTop<=1)d()},H=()=>{let n=e.scrollTop>p.current;p.current=e.scrollTop;let t=n&&m.current>0;if(m.current=0,l){c=n;return}if(r.current!=="reading"||!t)return;let M=D.current?q:S;if(e.scrollHeight-e.clientHeight-e.scrollTop<=M)d()},L=(n)=>{if(n.ctrlKey||n.deltaY===0)return;let t=n.target instanceof Element?n.target:null;while(t!==null&&t!==e){if(t.scrollHeight>t.clientHeight&&/auto|scroll/.test(getComputedStyle(t).overflowY)){if(n.deltaY<0?t.scrollTop>0:t.scrollTop+t.clientHeight<t.scrollHeight)return}t=t.parentElement}E(Math.sign(n.deltaY))},C=(n)=>{i=n.touches[0].clientY},O=(n)=>{let t=n.touches[0].clientY;if(i!==null&&t!==i)E(Math.sign(i-t));i=t},I=(n)=>{if(n.defaultPrevented||!(n.target instanceof Element))return;if(n.target.closest("input, textarea, select, button, a, [contenteditable='true']"))return;if(["ArrowUp","PageUp","Home"].includes(n.key)||n.key===" "&&n.shiftKey)E(-1);else if(["ArrowDown","PageDown","End"," "].includes(n.key))E(1)},N=(n)=>{let t=n.target instanceof Element?n.target.closest('[data-slot="scroll-area-scrollbar"][data-orientation="vertical"]'):null,M=t!==null&&t.closest('[data-slot="scroll-area"]')===w;if(l=(n.target===e||M)&&n.button===0&&e.scrollHeight>e.clientHeight,c=!1,l)v()},R=()=>{let n=D.current?q:S;if(l&&c&&e.scrollHeight-e.clientHeight-e.scrollTop<=n)d();l=!1},K=()=>{l=!1},W=(n)=>{if(!(n.target instanceof Element)||n.target.closest("[data-codex-disclosure]")===null)return;v(),g.current=e.scrollHeight};return e.addEventListener("scroll",H,{passive:!0}),e.addEventListener("wheel",L,{passive:!0}),e.addEventListener("touchstart",C,{passive:!0}),e.addEventListener("touchmove",O,{passive:!0}),e.addEventListener("keydown",I),F.addEventListener("pointerdown",N,{capture:!0}),window.addEventListener("pointerup",R),window.addEventListener("pointercancel",K),e.addEventListener("click",W,{capture:!0}),()=>{o(),x(),e.removeEventListener("scroll",H),e.removeEventListener("wheel",L),e.removeEventListener("touchstart",C),e.removeEventListener("touchmove",O),e.removeEventListener("keydown",I),F.removeEventListener("pointerdown",N,{capture:!0}),window.removeEventListener("pointerup",R),window.removeEventListener("pointercancel",K),e.removeEventListener("click",W,{capture:!0})}},[e,o,x,u,d,v]),{isFollowing:A,scrollToBottom:d,stopFollowing:v,schedulePin:T,contentResized:G,beginLocate:B,cancelLocation:x}}
|
|
2
|
+
export{At};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
async function
|
|
2
|
-
export{
|
|
1
|
+
async function dt(g,u){try{let a=await(await fetch(g)).blob(),s=u??a.type??"";if(!s.startsWith("image/"))return new Promise((e)=>{let t=new FileReader;t.onloadend=()=>e(t.result),t.onerror=()=>e(null),t.readAsDataURL(a)});let w=s.includes("svg"),n,r,o;if(w){let e=new Image,t=URL.createObjectURL(a);e.src=t;try{await new Promise((h,f)=>{e.onload=()=>h(),e.onerror=()=>f(Error("svg load failed"))})}finally{URL.revokeObjectURL(t)}r=e.naturalWidth||1024,o=e.naturalHeight||1024,n=e}else{let e=await createImageBitmap(a);r=e.width,o=e.height,n=e}let i=Math.min(1,2000/Math.max(r,o)),c=Math.round(r*i),l=Math.round(o*i),d=new OffscreenCanvas(c,l),m=d.getContext("2d");if(!m)throw Error("image-encode: OffscreenCanvas 2d context 不可用");if(m.drawImage(n,0,0,c,l),n instanceof ImageBitmap)n.close();let b=await d.convertToBlob({type:"image/webp",quality:0.85});return new Promise((e)=>{let t=new FileReader;t.onloadend=()=>e(t.result),t.onerror=()=>e(null),t.readAsDataURL(b)})}catch{return null}}
|
|
2
|
+
export{dt};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{PreviewCard as e}from"@base-ui/react/preview-card";import{jsx as o,jsxs as d}from"react/jsx-runtime";function
|
|
2
|
-
export{
|
|
1
|
+
import{PreviewCard as e}from"@base-ui/react/preview-card";import{jsx as o,jsxs as d}from"react/jsx-runtime";function $t({open:r,onOpenChange:a,trigger:i,children:t,...n}){return d(e.Root,{open:r,onOpenChange:a,children:[o(e.Trigger,{render:i,delay:700,closeDelay:100}),o(e.Portal,{children:o(e.Positioner,{...n,className:"isolate z-50",children:o(e.Popup,{"data-slot":"codex-hover-card",className:"m-0 outline-hidden",children:t})})})]})}
|
|
2
|
+
export{$t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{te}from"./chunk-jh8jske0.js";function K(d,f){if(!f)return[];let h=[],s="",n=[],a=()=>{let t=0,e=0;for(let{start:r,end:o}of te(s,f)){while(t<n.length&&n[t].end<=r)t++;e=Math.max(e,t);while(e<n.length&&n[e].end<o)e++;let l=n[t],c=n[e];if(!l||!c)throw Error("Search text offset has no DOM node");let i=document.createRange();i.setStart(l.node,r-l.start),i.setEnd(c.node,o-c.start),h.push(i)}s="",n=[]},u=new Set(["ADDRESS","ARTICLE","ASIDE","BLOCKQUOTE","DIV","DL","DT","DD","FIGCAPTION","FIGURE","FOOTER","FORM","H1","H2","H3","H4","H5","H6","HEADER","HR","LI","MAIN","NAV","OL","P","PRE","SECTION","TABLE","TD","TH","TR","UL"]),E=(t)=>{if(t.nodeType===Node.TEXT_NODE){let r=t.parentElement;if(!r||r.offsetParent===null&&r.tagName!=="BODY")return;let o=t.nodeValue??"";n.push({node:t,start:s.length,end:s.length+o.length}),s+=o;return}if(!(t instanceof Element))return;if(t.matches("script, style, [hidden], [aria-hidden='true']")){a();return}if(t.tagName==="BR"){a();return}let e=u.has(t.tagName);if(e)a();for(let r of t.childNodes)E(r);if(e)a()};return E(d),a(),h}
|
|
2
|
+
export{K};
|
|
@@ -1 +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
|
|
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 R({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{R};
|