sanoma 0.11.21 → 0.11.22
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 +2 -0
- package/app/README.md +2 -2
- package/app/dist/api.d.ts +16 -2
- package/app/dist/api.js +1 -1
- package/app/dist/client/assets/ArrowDown.es-BOfBLlTP.js +1 -0
- package/app/dist/client/assets/CaretDown.es-D12mWb2j.js +1 -0
- package/app/dist/client/assets/CatchBoundary-Cb__yx-s.js +1 -0
- package/app/dist/client/assets/Copy.es-CvUujKw7.js +1 -0
- package/app/dist/client/assets/DialogTitle-Dz3loDe5.js +1 -0
- package/app/dist/client/assets/FloppyDisk.es-CDyDob8p.js +1 -0
- package/app/dist/client/assets/Globe.es-C1pgZCGM.js +1 -0
- package/app/dist/client/assets/MagnifyingGlass.es-CZ3i6pz0.js +1 -0
- package/app/dist/client/assets/Play.es-DGJ1CGhp.js +1 -0
- package/app/dist/client/assets/Plug.es-BPhGL8MK.js +1 -0
- package/app/dist/client/assets/Plus.es-i3Vaa2WW.js +1 -0
- package/app/dist/client/assets/Separator-Cu9cQDBN.js +1 -0
- package/app/dist/client/assets/X.es-B7rq0E_-.js +1 -0
- package/app/dist/client/assets/_id-C4bMZ73g.js +1 -0
- package/app/dist/client/assets/_id-CUaJYD_3.js +1 -0
- package/app/dist/client/assets/_id-DRetx-BJ.js +1 -0
- package/app/dist/client/assets/_id-mm7bTIIl.js +2 -0
- package/app/dist/client/assets/_id-tN6nFEpD.js +1 -0
- package/app/dist/client/assets/_name-BOi2qVWk.js +1 -0
- package/app/dist/client/assets/_name-CBI1waPs.js +4 -0
- package/app/dist/client/assets/_name-CrsiaFT6.js +1 -0
- package/app/dist/client/assets/_name-TzQfjXo8.js +1 -0
- package/app/dist/client/assets/_vendor-C3TGvx4w.js +1 -0
- package/app/dist/client/assets/_vendor-sHwAlFSF.js +1 -0
- package/app/dist/client/assets/app-chrome-_ahvxx73.js +5 -0
- package/app/dist/client/assets/app-scope-Bht7PIkQ.js +1 -0
- package/app/dist/client/assets/approval-BFFM_yEl.js +1 -0
- package/app/dist/client/assets/apps-CpdXjc1j.js +1 -0
- package/app/dist/client/assets/button-D5kdANef.js +1 -0
- package/app/dist/client/assets/change-glance-CdkbSGxZ.js +1 -0
- package/app/dist/client/assets/changes-C_K2tazO.js +1 -0
- package/app/dist/client/assets/changes-DFcdyDL_.js +1 -0
- package/app/dist/client/assets/chat-Djbdaxw8.js +14 -0
- package/app/dist/client/assets/chat-button-DNusaP5n.js +1 -0
- package/app/dist/client/assets/chat-prompt-z0XJPDtH.js +1 -0
- package/app/dist/client/assets/{code-BVYaiQEr.js → code-CT4-YDKq.js} +2 -2
- package/app/dist/client/assets/common-DHOhx6Zn.js +3 -0
- package/app/dist/client/assets/composite-9cNA7N0P.js +1 -0
- package/app/dist/client/assets/connect-DHUdrwwW.js +1 -0
- package/app/dist/client/assets/connections-fGNKJl3J.js +5 -0
- package/app/dist/client/assets/connectors-CuS1paNm.js +1 -0
- package/app/dist/client/assets/credentials-Cb7Lnfxk.js +1 -0
- package/app/dist/client/assets/css-BGIxQoYs.js +1 -0
- package/app/dist/client/assets/css-DgaLhXQH.js +1 -0
- package/app/dist/client/assets/data-DZ-ufRXn.js +1 -0
- package/app/dist/client/assets/decidable-OFQBEcco.js +1 -0
- package/app/dist/client/assets/declaration-form-D2ZMEVC6.js +1 -0
- package/app/dist/client/assets/dialog-B5pmfCdJ.js +1 -0
- package/app/dist/client/assets/diff-woXpYk--.js +1 -0
- package/app/dist/client/assets/engine-CBuzy-Ik.js +1 -0
- package/app/dist/client/assets/existing-BaPrTDs8.js +1 -0
- package/app/dist/client/assets/fence-CMhOJv7H.js +157 -0
- package/app/dist/client/assets/github-dark-C-LZuMrd.js +1 -0
- package/app/dist/client/assets/github-light-EUqPIrTm.js +1 -0
- package/app/dist/client/assets/graph-B5TYhcqD.js +7 -0
- package/app/dist/client/assets/grid-diff-wo26YSgM.js +1 -0
- package/app/dist/client/assets/held-card-HrJ6QpRY.js +1 -0
- package/app/dist/client/assets/highlighted-body-JLMTFACH-CjeaSnZq.js +1 -0
- package/app/dist/client/assets/hosting-Beoi95m6.js +1 -0
- package/app/dist/client/assets/html-BHZv6uqE.js +1 -0
- package/app/dist/client/assets/import-8WDFPfe6.js +1 -0
- package/app/dist/client/assets/inbox-B9hsZPsC.js +1 -0
- package/app/dist/client/assets/inbox-DM2npRZI.js +1 -0
- package/app/dist/client/assets/index-CHKfukjt.js +10 -0
- package/app/dist/client/assets/item-B4QRpXse.js +1 -0
- package/app/dist/client/assets/javascript-BzbQS41l.js +1 -0
- package/app/dist/client/assets/javascript-CpIGwZ_Y.js +1 -0
- package/app/dist/client/assets/json-qhed-kSA.js +1 -0
- package/app/dist/client/assets/jsx-Bz0zcwM4.js +1 -0
- package/app/dist/client/assets/kit-n8CE0xEs.js +1 -0
- package/app/dist/client/assets/lazyRouteComponent-DezoGNoN.js +1 -0
- package/app/dist/client/assets/markdown-BYOwaDjH.js +1 -0
- package/app/dist/client/assets/markdown-DS_nKu0s.js +164 -0
- package/app/dist/client/assets/mermaid-WFAXDIZX-DQBKIf0O.js +1 -0
- package/app/dist/client/assets/motion-D6e1hqz4.js +1 -0
- package/app/dist/client/assets/people-BiiQfYJ8.js +1 -0
- package/app/dist/client/assets/permissions-BmKxEfBi.js +2 -0
- package/app/dist/client/assets/permissions-grid-B755bq5J.js +1 -0
- package/app/dist/client/assets/preload-helper-BLdHbfdN.js +1 -0
- package/app/dist/client/assets/python-gzcpVVnB.js +1 -0
- package/app/dist/client/assets/queries-DGlVu9wp.js +57 -0
- package/app/dist/client/assets/react-dom-D6fTz1bt.js +1 -0
- package/app/dist/client/assets/route-BSe5L2p4.js +1 -0
- package/app/dist/client/assets/route-Ds87ixtB.js +1 -0
- package/app/dist/client/assets/runs-table-DMiD4HeY.js +1 -0
- package/app/dist/client/assets/scenario-DrgmfuFx.js +1 -0
- package/app/dist/client/assets/scenario-graph-Blv2e1PV.js +1 -0
- package/app/dist/client/assets/separator-Bdtc7rou.js +1 -0
- package/app/dist/client/assets/{sheet-BYL9XU5s.js → sheet-BKUFUA1l.js} +1 -1
- package/app/dist/client/assets/shellscript-CLZ0U2zV.js +1 -0
- package/app/dist/client/assets/site-icon-1Mcc1UIb.js +1 -0
- package/app/dist/client/assets/sites.index-K4mrFsLr.js +1 -0
- package/app/dist/client/assets/spinner-XaRXIj9W.js +1 -0
- package/app/dist/client/assets/sql-CEbI0hMM.js +1 -0
- package/app/dist/client/assets/start-form-CJ6VmNPY.js +1 -0
- package/app/dist/client/assets/store-BT988jIX.js +1 -0
- package/app/dist/client/assets/style-CTcG_5y0.css +2 -0
- package/app/dist/client/assets/table-B81tv0LG.js +1 -0
- package/app/dist/client/assets/textarea-CRpYU-qx.js +1 -0
- package/app/dist/client/assets/tsx-udAQXfEw.js +1 -0
- package/app/dist/client/assets/typescript-bsJCZSQ-.js +1 -0
- package/app/dist/client/assets/{useLoaderData-BQd5yMlA.js → useLoaderData-BsksXf-p.js} +1 -1
- package/app/dist/client/assets/useOpenInteractionType-UhakpAXY.js +1 -0
- package/app/dist/client/assets/useRegisterFieldControl-DIkKUJkh.js +1 -0
- package/app/dist/client/assets/useValueChanged-DBqn456b.js +1 -0
- package/app/dist/client/assets/utils-BRvE9-Fo.js +1 -0
- package/app/dist/client/assets/who-are-you-DUoVqvfP.js +1 -0
- package/app/dist/client/assets/workflow-lQtyyxKx.js +1 -0
- package/app/dist/client/assets/workflow-view-hk_RU9WF.js +1 -0
- package/app/dist/client/assets/workflows-DFB7lzzN.js +1 -0
- package/app/dist/client/assets/yaml-rwi0_p6S.js +1 -0
- package/app/dist/index.d.ts +4 -4
- package/app/dist/lib/chat.d.ts +64 -19
- package/app/dist/lib/chat.js +54 -18
- package/app/dist/lib/chat.js.map +1 -1
- package/app/dist/server/assets/{_id-wuJIq2ZZ.js → _id--MWJXj9R.js} +2 -2
- package/app/dist/server/assets/{_id-ce1EGp7Y.js → _id-BEGe86NW.js} +2 -2
- package/app/dist/server/assets/{_id-BViXAagq.js → _id-CbO7Ok0w.js} +12 -10
- package/app/dist/server/assets/{_id-Dt9tTylX.js → _id-DwdpIYKk.js} +2 -2
- package/app/dist/server/assets/{_id-wB8khGTz.js → _id-fK_nPFHK.js} +6 -6
- package/app/dist/server/assets/{_name-D_-MhjNf.js → _name-BzD9TxVC.js} +17 -17
- package/app/dist/server/assets/{_name-BqFwnyf7.js → _name-ClgMsl5m.js} +2 -2
- package/app/dist/server/assets/{_name-BGagGBjX.js → _name-DdFVsjcj.js} +7 -7
- package/app/dist/server/assets/{_name-DntbHE-b.js → _name-Dyh4G9Oy.js} +10 -11
- package/app/dist/server/assets/{_tanstack-start-manifest_v-BljuBM-G.js → _tanstack-start-manifest_v-DUtnBg7y.js} +101 -91
- package/app/dist/server/assets/{_vendor-CNB03LWX.js → _vendor-DyeUY8kH.js} +8 -8
- package/app/dist/server/assets/{_vendor-CcEviOki.js → _vendor-W3KKSusM.js} +2 -2
- package/app/dist/server/assets/{actor-D6iA0pDg.js → actor-BlaOwG6A.js} +1 -1
- package/app/dist/server/assets/app-chrome-BJlxsc9y.js +2116 -0
- package/app/dist/server/assets/{app-scope-CXIgOFmi.js → app-scope-ASuhE3xI.js} +2 -2
- package/app/dist/server/assets/{apply-plan-ybBda6vQ.js → apply-plan-Djw1tNPD.js} +8 -7
- package/app/dist/server/assets/{approval-Su315ikC.js → approval-BjTnfr1U.js} +15 -13
- package/app/dist/server/assets/{apps-xwQAehch.js → apps-C28F9Y5C.js} +7 -7
- package/app/dist/server/assets/button-Xwx3rpQ0.js +43 -0
- package/app/dist/server/assets/change-glance-Bc4htVPy.js +54 -0
- package/app/dist/server/assets/{change-glance-CpArIbGS.js → changes-B5P8BJSf.js} +2 -54
- package/app/dist/server/assets/{changes-Bc_OiDBD.js → changes-tbeMKxjY.js} +8 -7
- package/app/dist/server/assets/{chat-DMN_hoKm.js → chat-BNMeLc9V.js} +108 -30
- package/app/dist/server/assets/{chat-button-LtA80MoR.js → chat-button-SluTWK8R.js} +2 -2
- package/app/dist/server/assets/{code-COyt8L-n.js → code-hVpCkmAZ.js} +1 -1
- package/app/dist/server/assets/{common-CWHLj7KV.js → common-DpZcJvCy.js} +26 -24
- package/app/dist/server/assets/{connect-BpPiu5s6.js → connect-Cljunav2.js} +11 -10
- package/app/dist/server/assets/{connections-DBgb1bvX.js → connections-Cfz5LMy5.js} +12 -11
- package/app/dist/server/assets/{connectors-5a5_SlHO.js → connectors-tt9BF9L1.js} +8 -8
- package/app/dist/server/assets/{credentials-ud_Y68hx.js → credentials-CYUFAVU8.js} +10 -9
- package/app/dist/server/assets/{data-aEdhwcqy.js → data-D91ZZ5St.js} +7 -7
- package/app/dist/server/assets/{declaration-form-Dfg1yNuY.js → declaration-form-BzISD6gw.js} +7 -6
- package/app/dist/server/assets/{dialog-BGjiw3Dx.js → dialog-T0bzlKzs.js} +2 -2
- package/app/dist/server/assets/{dropdown-menu-DAC3LWas.js → dropdown-menu-RGvPORm4.js} +1 -1
- package/app/dist/server/assets/{existing-B4d4NrC8.js → existing-BZym0xE2.js} +8 -7
- package/app/dist/server/assets/fence-Br7MPP41.js +130 -0
- package/app/dist/server/assets/{field-C0Xx_90s.js → field-DFpkT1id.js} +1 -1
- package/app/dist/server/assets/{functions-BvFYzabD.js → functions-sf07C1qn.js} +2 -2
- package/app/dist/server/assets/{graph-qYOdoz2s.js → graph-C1Cl7owl.js} +5 -5
- package/app/dist/server/assets/{grid-diff-jTvp-8wS.js → grid-diff-D5bQDKl2.js} +1 -1
- package/app/dist/server/assets/held-card-CDewk4rs.js +75 -0
- package/app/dist/server/assets/{hosting-bbn9UvDc.js → hosting-O-l2L0ec.js} +16 -14
- package/app/dist/server/assets/{import-DIwvzHb6.js → import-qvpEIYFx.js} +8 -8
- package/app/dist/server/assets/{inbox-D6R6sWBB.js → inbox-BcJxCIPm.js} +8 -8
- package/app/dist/server/assets/{inbox-Dj-5FleF.js → inbox-BvpSeC3M.js} +2 -2
- package/app/dist/server/assets/{input-D63gF3G2.js → input-CF-vX8Xp.js} +1 -1
- package/app/dist/server/assets/{item-BDSXoEr_.js → item-LBDNja5f.js} +1 -1
- package/app/dist/server/assets/{kit-D6EulwBe.js → kit-DlT_THim.js} +2 -2
- package/app/dist/server/assets/markdown-BExKjghi.js +116 -0
- package/app/dist/server/assets/{middleware-B8JRLyxx.js → middleware-B6RPW0fH.js} +1 -1
- package/app/dist/server/assets/{people-CkU_AxrV.js → people-C8VXQrKg.js} +13 -12
- package/app/dist/server/assets/{permissions-BfMcQqQb.js → permissions-COAiOoCB.js} +9 -8
- package/app/dist/server/assets/{permissions-grid-DWP9FAAS.js → permissions-grid-CcYUiqhD.js} +4 -4
- package/app/dist/server/assets/{button-f9Lc8qLl.js → queries-DJcZ4mzA.js} +3 -45
- package/app/dist/server/assets/{route-BTT7nMJq.js → route-DOqitvxL.js} +2 -2
- package/app/dist/server/assets/{route-CF_8jQYY.js → route-aa9MThMA.js} +2 -2
- package/app/dist/server/assets/{router-BvYtxrVN.js → router-Co6gRNI1.js} +80 -46
- package/app/dist/server/assets/{runs-table-BBudn12Y.js → runs-table-BtGm2KOO.js} +6 -6
- package/app/dist/server/assets/{scenario-BXGTSTiP.js → scenario-DidUafqw.js} +5 -5
- package/app/dist/server/assets/{separator-8MZ7vR3f.js → separator-Cf98V8ie.js} +1 -1
- package/app/dist/server/assets/{sheet-5Cyp-4UW.js → sheet-DTOG7OHQ.js} +2 -2
- package/app/dist/server/assets/{sites.index-1l0BtgVf.js → sites.index-4TK8c0QC.js} +4 -4
- package/app/dist/server/assets/{spinner-C1ZW08lp.js → spinner-016IPVi-.js} +1 -1
- package/app/dist/server/assets/{start-CSU4irVK.js → start-VfVsXenI.js} +2 -2
- package/app/dist/server/assets/{start-form-DI60UOrc.js → start-form-CUeEdeP7.js} +10 -9
- package/app/dist/server/assets/{table-DtPk_h_5.js → table-y-dGlLx6.js} +1 -1
- package/app/dist/server/assets/{textarea-f0Ip5ed1.js → textarea-B02joDnr.js} +1 -1
- package/app/dist/server/assets/utils-CHesvfjo.js +138 -0
- package/app/dist/server/assets/{who-are-you-ZGyMnpVi.js → who-are-you-DW5qmIzp.js} +8 -7
- package/app/dist/server/assets/{workflow-Z99QWO42.js → workflow-BRu7ljgU.js} +5 -5
- package/app/dist/server/assets/{workflow-view-C8X8U11S.js → workflow-view-yF48p1lu.js} +14 -13
- package/app/dist/server/assets/{workflows-C0kJoGf1.js → workflows-DL-TJFLt.js} +13 -14
- package/app/dist/server/chat.d.ts +6 -1
- package/app/dist/server/chat.js +39 -20
- package/app/dist/server/chat.js.map +1 -1
- package/app/dist/server/server.js +48 -48
- package/app/dist/steps/agent/acp.d.ts +3 -97
- package/app/dist/steps/agent/acp.js +19 -49
- package/app/dist/steps/agent/acp.js.map +1 -1
- package/app/dist/steps/agent/checkout.d.ts +18 -1
- package/app/dist/steps/agent/checkout.js +17 -0
- package/app/dist/steps/agent/checkout.js.map +1 -1
- package/app/dist/steps/agent/harness.d.ts +2 -4
- package/app/dist/steps/agent/harness.js +45 -61
- package/app/dist/steps/agent/harness.js.map +1 -1
- package/app/dist/steps/agent/prompt.d.ts +1 -1
- package/app/dist/steps/agent/prompt.js +35 -14
- package/app/dist/steps/agent/prompt.js.map +1 -1
- package/app/dist/steps/agent/transcript.d.ts +10 -1
- package/app/dist/steps/agent/transcript.js +75 -2
- package/app/dist/steps/agent/transcript.js.map +1 -1
- package/app/dist/steps/agent/turn.d.ts +4 -6
- package/app/dist/steps/agent/turn.js +14 -16
- package/app/dist/steps/agent/turn.js.map +1 -1
- package/app/dist/stylesheet.json +1 -1
- package/app/src/api.ts +1 -1
- package/app/src/components/app-chrome.tsx +28 -13
- package/app/src/components/common.tsx +1 -24
- package/app/src/components/logo.tsx +25 -0
- package/app/src/components/shell/chat-parts.tsx +185 -126
- package/app/src/components/shell/chat-prompt.ts +6 -2
- package/app/src/components/shell/chat.tsx +154 -220
- package/app/src/components/shell/composer.tsx +140 -0
- package/app/src/components/shell/connect-agent.tsx +157 -0
- package/app/src/components/shell/engine-mark.tsx +9 -0
- package/app/src/components/shell/fence.tsx +25 -0
- package/app/src/components/shell/held-card.tsx +58 -0
- package/app/src/components/shell/markdown.tsx +152 -0
- package/app/src/components/shell/nav-user.tsx +11 -1
- package/app/src/components/shell/prefs.ts +9 -1
- package/app/src/components/shell/thread.tsx +174 -0
- package/app/src/components/ui/bubble.tsx +117 -0
- package/app/src/components/ui/code-block.tsx +235 -0
- package/app/src/components/ui/input-group.tsx +136 -0
- package/app/src/components/ui/marker.tsx +67 -0
- package/app/src/components/ui/message-scroller.tsx +117 -0
- package/app/src/components/ui/message.tsx +74 -0
- package/app/src/components/ui/trace.tsx +133 -0
- package/app/src/hooks/use-highlighted-code.ts +72 -0
- package/app/src/index.ts +4 -4
- package/app/src/lib/chat.ts +110 -22
- package/app/src/lib/cn-tables.ts +23 -23
- package/app/src/lib/highlighter.tsx +114 -0
- package/app/src/routes/__root.tsx +7 -4
- package/app/src/routes/connectors/index.tsx +1 -1
- package/app/src/routes/hosting/index.tsx +6 -9
- package/app/src/server/chat.ts +41 -19
- package/app/src/steps/agent/acp.ts +10 -80
- package/app/src/steps/agent/checkout.ts +30 -0
- package/app/src/steps/agent/harness.ts +53 -78
- package/app/src/steps/agent/prompt.ts +42 -14
- package/app/src/steps/agent/transcript.ts +90 -3
- package/app/src/steps/agent/turn.ts +18 -16
- package/app/src/worker/app.ts +6 -5
- package/dist/cli.js +18 -6
- package/dist/cli.js.map +1 -1
- package/dist/serve.js +1 -1
- package/dist/serve.js.map +1 -1
- package/dist/worker-port.d.ts +16 -2
- package/dist/worker-port.js +44 -5
- package/dist/worker-port.js.map +1 -1
- package/package.json +7 -3
- package/testing/README.md +3 -3
- package/testing/dist/build.d.ts +3 -3
- package/testing/dist/build.js +4 -4
- package/testing/dist/build.js.map +1 -1
- package/testing/dist/host.d.ts +34 -21
- package/testing/dist/host.js +135 -75
- package/testing/dist/host.js.map +1 -1
- package/workflows/CLOUD-IDENTITY.md +15 -20
- package/workflows/README.md +9 -7
- package/workflows/dist/client.d.ts +5 -3
- package/workflows/dist/client.js +4 -3
- package/workflows/dist/client.js.map +1 -1
- package/workflows/dist/cloud-identity.d.ts +5 -2
- package/workflows/dist/cloud-identity.js +7 -4
- package/workflows/dist/cloud-identity.js.map +1 -1
- package/workflows/dist/config.d.ts +7 -1
- package/workflows/dist/config.js +24 -1
- package/workflows/dist/config.js.map +1 -1
- package/workflows/dist/db/company.d.ts +1 -1
- package/workflows/dist/db/company.js +1 -1
- package/workflows/dist/db/identity.d.ts +2 -2
- package/workflows/dist/db/identity.js +2 -2
- package/workflows/dist/db/identity.js.map +1 -1
- package/workflows/dist/deadlines.d.ts +7 -2
- package/workflows/dist/deadlines.js +14 -5
- package/workflows/dist/deadlines.js.map +1 -1
- package/workflows/dist/describe.js +15 -3
- package/workflows/dist/describe.js.map +1 -1
- package/workflows/dist/description.d.ts +37 -2
- package/workflows/dist/description.js +22 -1
- package/workflows/dist/description.js.map +1 -1
- package/workflows/dist/host.d.ts +7 -6
- package/workflows/dist/host.js +1 -1
- package/workflows/dist/host.js.map +1 -1
- package/workflows/dist/identity-provisioning.d.ts +2 -5
- package/workflows/dist/identity-provisioning.js +16 -20
- package/workflows/dist/identity-provisioning.js.map +1 -1
- package/workflows/dist/index.d.ts +3 -3
- package/workflows/dist/index.js +1 -1
- package/workflows/dist/index.js.map +1 -1
- package/workflows/dist/op.d.ts +92 -1
- package/workflows/dist/op.js +19 -6
- package/workflows/dist/op.js.map +1 -1
- package/workflows/dist/renewal.d.ts +1 -1
- package/workflows/dist/renewal.js +1 -1
- package/workflows/dist/runtime-ops.d.ts +3 -4
- package/workflows/dist/runtime-ops.js +4 -4
- package/workflows/dist/runtime-ops.js.map +1 -1
- package/workflows/dist/schedules.d.ts +1 -1
- package/workflows/dist/schedules.js +1 -1
- package/workflows/dist/supervisor.d.ts +21 -18
- package/workflows/dist/supervisor.js +20 -22
- package/workflows/dist/supervisor.js.map +1 -1
- package/workflows/dist/vendor-info.d.ts +12 -3
- package/workflows/dist/vendor-info.js +20 -4
- package/workflows/dist/vendor-info.js.map +1 -1
- package/workflows/dist/worker.d.ts +11 -1
- package/workflows/dist/worker.js +9 -3
- package/workflows/dist/worker.js.map +1 -1
- package/workflows/src/client.ts +9 -6
- package/workflows/src/cloud-identity.ts +7 -4
- package/workflows/src/config.ts +36 -1
- package/workflows/src/db/company.ts +1 -1
- package/workflows/src/db/identity.ts +2 -2
- package/workflows/src/deadlines.ts +18 -8
- package/workflows/src/describe.ts +16 -3
- package/workflows/src/description.ts +25 -1
- package/workflows/src/host.ts +7 -6
- package/workflows/src/identity-provisioning.ts +19 -30
- package/workflows/src/index.ts +7 -1
- package/workflows/src/op.ts +104 -10
- package/workflows/src/renewal.ts +1 -1
- package/workflows/src/runtime-ops.ts +5 -5
- package/workflows/src/schedules.ts +1 -1
- package/workflows/src/supervisor.ts +40 -38
- package/workflows/src/vendor-info.ts +20 -5
- package/workflows/src/worker.ts +22 -5
- package/app/dist/client/assets/ArrowUp.es-DOgvoS0P.js +0 -1
- package/app/dist/client/assets/Copy.es-B0D5SwiQ.js +0 -1
- package/app/dist/client/assets/DialogTitle-BgjYK22C.js +0 -1
- package/app/dist/client/assets/FloppyDisk.es-DnuNe_a8.js +0 -1
- package/app/dist/client/assets/Globe.es-B6x2e4-a.js +0 -1
- package/app/dist/client/assets/MagnifyingGlass.es-DoNoHEhT.js +0 -1
- package/app/dist/client/assets/Play.es-BwXalGBh.js +0 -1
- package/app/dist/client/assets/Plug.es-CaZsN5P-.js +0 -1
- package/app/dist/client/assets/Plus.es-w9VPpTJB.js +0 -1
- package/app/dist/client/assets/Separator-BAhKFgSd.js +0 -1
- package/app/dist/client/assets/X.es-DKMYClf-.js +0 -1
- package/app/dist/client/assets/_id-BSRAaWtO.js +0 -1
- package/app/dist/client/assets/_id-BjDP-cPH.js +0 -1
- package/app/dist/client/assets/_id-BudM76zX.js +0 -1
- package/app/dist/client/assets/_id-C37U5bBa.js +0 -1
- package/app/dist/client/assets/_id-lmg24JVh.js +0 -2
- package/app/dist/client/assets/_name-CylqFo_t.js +0 -1
- package/app/dist/client/assets/_name-D8Gl8iwy.js +0 -4
- package/app/dist/client/assets/_name-DdPCU8pt.js +0 -1
- package/app/dist/client/assets/_name-TteWQXe0.js +0 -1
- package/app/dist/client/assets/_vendor-BLxW83yk.js +0 -1
- package/app/dist/client/assets/_vendor-Bq3uZU4-.js +0 -1
- package/app/dist/client/assets/app-chrome-H8uZ4dHI.js +0 -16
- package/app/dist/client/assets/app-scope-BeUW_8Qh.js +0 -1
- package/app/dist/client/assets/approval-DpgmTc63.js +0 -1
- package/app/dist/client/assets/apps-CoWzNm8M.js +0 -1
- package/app/dist/client/assets/change-glance-DbYcBT7H.js +0 -1
- package/app/dist/client/assets/changes-DIJvP7wQ.js +0 -1
- package/app/dist/client/assets/chat-button-BgpOfYh1.js +0 -1
- package/app/dist/client/assets/chat-prompt-hiawXcK0.js +0 -1
- package/app/dist/client/assets/common-Dw2i6XKZ.js +0 -3
- package/app/dist/client/assets/composite-D9GNDzFj.js +0 -1
- package/app/dist/client/assets/connect-CIq2KJTz.js +0 -1
- package/app/dist/client/assets/connections-iqd2XbWQ.js +0 -5
- package/app/dist/client/assets/connectors-rI8_D1n1.js +0 -1
- package/app/dist/client/assets/credentials-26vu6Fv5.js +0 -1
- package/app/dist/client/assets/data-sDMlKaLV.js +0 -1
- package/app/dist/client/assets/decidable-zcYI7bY8.js +0 -1
- package/app/dist/client/assets/declaration-form-BtSVvxhq.js +0 -1
- package/app/dist/client/assets/dialog-DskpUgkl.js +0 -1
- package/app/dist/client/assets/existing-BD3VgJ_8.js +0 -1
- package/app/dist/client/assets/graph-Prxl3c55.js +0 -7
- package/app/dist/client/assets/grid-diff-SMsvea6t.js +0 -1
- package/app/dist/client/assets/hosting-BBHUppH-.js +0 -1
- package/app/dist/client/assets/import-B92fd4Tl.js +0 -1
- package/app/dist/client/assets/inbox-57oGZtxE.js +0 -1
- package/app/dist/client/assets/inbox-B2AMNtk5.js +0 -1
- package/app/dist/client/assets/index-Bn3XeKy8.js +0 -10
- package/app/dist/client/assets/kit-BsK6VZTQ.js +0 -1
- package/app/dist/client/assets/lazyRouteComponent-Uri98HNq.js +0 -1
- package/app/dist/client/assets/motion-C8lNeYvK.js +0 -1
- package/app/dist/client/assets/people-ISOMYCTu.js +0 -1
- package/app/dist/client/assets/permissions-Cenat84K.js +0 -2
- package/app/dist/client/assets/permissions-grid-B2GtGwzv.js +0 -1
- package/app/dist/client/assets/route-BP1XwaTB.js +0 -1
- package/app/dist/client/assets/route-KVU6QgwJ.js +0 -1
- package/app/dist/client/assets/runs-table-35lNzKLn.js +0 -1
- package/app/dist/client/assets/scenario-DSwsavxS.js +0 -1
- package/app/dist/client/assets/scenario-graph-CAzWOtqV.js +0 -1
- package/app/dist/client/assets/separator-BlwkzEY0.js +0 -1
- package/app/dist/client/assets/site-icon-DZvOfBvU.js +0 -1
- package/app/dist/client/assets/sites.index-CcNo6N8u.js +0 -1
- package/app/dist/client/assets/spinner-BGy6LWIW.js +0 -1
- package/app/dist/client/assets/start-form-Bgo9I63s.js +0 -1
- package/app/dist/client/assets/store-BGu0d2Ld.js +0 -57
- package/app/dist/client/assets/style-CCDLLPgG.css +0 -2
- package/app/dist/client/assets/table-DjbI5VTn.js +0 -1
- package/app/dist/client/assets/textarea-DXO0eUdp.js +0 -1
- package/app/dist/client/assets/useOpenInteractionType-Bin8RjM5.js +0 -1
- package/app/dist/client/assets/useRegisterFieldControl-CQPTOU7Z.js +0 -1
- package/app/dist/client/assets/useValueChanged-DMkuvFZG.js +0 -1
- package/app/dist/client/assets/utils-CMsCvwYQ.js +0 -1
- package/app/dist/client/assets/who-are-you-Bt1WI3Cz.js +0 -1
- package/app/dist/client/assets/workflow-BJpO61A-.js +0 -1
- package/app/dist/client/assets/workflow-view-DP-UlRiH.js +0 -1
- package/app/dist/client/assets/workflows-BLCBgxbx.js +0 -1
- package/app/dist/server/assets/app-chrome-BYS81Vnx.js +0 -1410
- package/app/dist/server/assets/native-select-DLa-He0n.js +0 -37
- package/app/dist/server/assets/utils-wksS9pYh.js +0 -138
|
@@ -0,0 +1,2116 @@
|
|
|
1
|
+
import { n as plural, t as cn } from "./utils-CHesvfjo.js";
|
|
2
|
+
import { B as TooltipProvider, D as EmptyMedia, E as EmptyHeader, N as CardFooter, O as EmptyTitle, P as CardHeader, T as EmptyDescription, f as Tip, g as toneBadge, j as CardContent, k as Card, m as ToneBadge, n as CardHeading, p as TipButton, s as Notice, t as ButtonLink, v as CHANGE_TONE, w as Empty, z as Badge } from "./kit-DlT_THim.js";
|
|
3
|
+
import "./middleware-B6RPW0fH.js";
|
|
4
|
+
import { i as useActorState, n as actorHeaders, r as useActor, t as ActorContext } from "./actor-BlaOwG6A.js";
|
|
5
|
+
import { A as configQuery, C as changeQuery, D as chatsQuery, E as chatQuery, T as chatModelQuery, bt as useOpenChange, g as actorQuery, n as CHATS_KEY, st as remoteQuery } from "./queries-DJcZ4mzA.js";
|
|
6
|
+
import { A as isBusy, C as boxless, D as enginesOf, E as enginesHere, F as textOf, I as unfinished, L as written, M as onModelConnector, N as pathOf, O as errorParts, P as suggestionsOf, S as MODEL_CONNECTOR, T as engineOf, j as isIntro, k as heldRunOf, w as chatTransport } from "./chat-BNMeLc9V.js";
|
|
7
|
+
import { t as Button } from "./button-Xwx3rpQ0.js";
|
|
8
|
+
import { a as SheetTitle, n as SheetContent, o as SheetTrigger, t as Sheet } from "./sheet-DTOG7OHQ.js";
|
|
9
|
+
import { J as useCrumbs, Y as Logo, it as CollapsibleTrigger, lt as siteOf, nt as Collapsible, ot as useSites, rt as CollapsibleContent } from "./common-DpZcJvCy.js";
|
|
10
|
+
import { t as SiteIcon } from "./site-icon-DJisMQUK.js";
|
|
11
|
+
import { a as DropdownMenuItem, c as DropdownMenuRadioItem, i as DropdownMenuGroup, l as DropdownMenuSeparator, o as DropdownMenuLabel, r as DropdownMenuContent, s as DropdownMenuRadioGroup, t as DropdownMenu, u as DropdownMenuTrigger } from "./dropdown-menu-RGvPORm4.js";
|
|
12
|
+
import { n as useChatPrompt, t as ChatPromptContext } from "./chat-prompt-BYwbMxR6.js";
|
|
13
|
+
import { t as Spinner } from "./spinner-016IPVi-.js";
|
|
14
|
+
import { a as ItemGroup, i as ItemDescription, n as ItemActions, o as ItemMedia, r as ItemContent, s as ItemTitle, t as Item } from "./item-LBDNja5f.js";
|
|
15
|
+
import { t as Input } from "./input-CF-vX8Xp.js";
|
|
16
|
+
import { t as Textarea } from "./textarea-B02joDnr.js";
|
|
17
|
+
import { o as phaseLabel } from "./changes-B5P8BJSf.js";
|
|
18
|
+
import { F as CHAT_COOKIE, I as ENGINE_COOKIE, L as rememberPref, M as DensityProvider, N as useDensity, P as BESIDE_PAGE, R as __exportAll, j as icon_small_default } from "./router-Co6gRNI1.js";
|
|
19
|
+
import * as React from "react";
|
|
20
|
+
import { Fragment, Suspense, lazy, memo, useEffect, useEffectEvent, useId, useMemo, useRef, useState } from "react";
|
|
21
|
+
import { CatchBoundary, ClientOnly, Link, Outlet, trimPathRight, useLoaderData, useMatches, useRouterState } from "@tanstack/react-router";
|
|
22
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
23
|
+
import { useQuery, useQueryClient, useSuspenseQuery } from "@tanstack/react-query";
|
|
24
|
+
import { generateId, getToolName, isToolUIPart } from "ai";
|
|
25
|
+
import { useTheme } from "next-themes";
|
|
26
|
+
import { Toaster, toast } from "sonner";
|
|
27
|
+
import { CheckCircleIcon } from "@phosphor-icons/react/dist/csr/CheckCircle";
|
|
28
|
+
import { InfoIcon } from "@phosphor-icons/react/dist/csr/Info";
|
|
29
|
+
import { WarningIcon } from "@phosphor-icons/react/dist/csr/Warning";
|
|
30
|
+
import { WarningOctagonIcon } from "@phosphor-icons/react/dist/csr/WarningOctagon";
|
|
31
|
+
import { CircleNotchIcon } from "@phosphor-icons/react/dist/csr/CircleNotch";
|
|
32
|
+
import { isEnded } from "sanoma/workflows/shared";
|
|
33
|
+
import { CloudIcon } from "@phosphor-icons/react/dist/csr/Cloud";
|
|
34
|
+
import { GitPullRequestIcon } from "@phosphor-icons/react/dist/csr/GitPullRequest";
|
|
35
|
+
import { KeyIcon } from "@phosphor-icons/react/dist/csr/Key";
|
|
36
|
+
import { PlugIcon } from "@phosphor-icons/react/dist/csr/Plug";
|
|
37
|
+
import { SparkleIcon } from "@phosphor-icons/react/dist/csr/Sparkle";
|
|
38
|
+
import { SquaresFourIcon } from "@phosphor-icons/react/dist/csr/SquaresFour";
|
|
39
|
+
import { TableIcon } from "@phosphor-icons/react/dist/csr/Table";
|
|
40
|
+
import { TrayIcon } from "@phosphor-icons/react/dist/csr/Tray";
|
|
41
|
+
import { TreeStructureIcon } from "@phosphor-icons/react/dist/csr/TreeStructure";
|
|
42
|
+
import { UsersIcon } from "@phosphor-icons/react/dist/csr/Users";
|
|
43
|
+
import { ListIcon } from "@phosphor-icons/react/dist/csr/List";
|
|
44
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
45
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
46
|
+
import { cva } from "class-variance-authority";
|
|
47
|
+
import { XIcon } from "@phosphor-icons/react/dist/csr/X";
|
|
48
|
+
import { SignOutIcon } from "@phosphor-icons/react/dist/csr/SignOut";
|
|
49
|
+
import { ArrowsOutSimpleIcon } from "@phosphor-icons/react/dist/csr/ArrowsOutSimple";
|
|
50
|
+
import { ArrowsInSimpleIcon } from "@phosphor-icons/react/dist/csr/ArrowsInSimple";
|
|
51
|
+
import { BuildingsIcon } from "@phosphor-icons/react/dist/csr/Buildings";
|
|
52
|
+
import { DesktopIcon } from "@phosphor-icons/react/dist/csr/Desktop";
|
|
53
|
+
import { MoonIcon } from "@phosphor-icons/react/dist/csr/Moon";
|
|
54
|
+
import { PlusIcon } from "@phosphor-icons/react/dist/csr/Plus";
|
|
55
|
+
import { SunIcon } from "@phosphor-icons/react/dist/csr/Sun";
|
|
56
|
+
import { UserIcon } from "@phosphor-icons/react/dist/csr/User";
|
|
57
|
+
import { UserCircleGearIcon } from "@phosphor-icons/react/dist/csr/UserCircleGear";
|
|
58
|
+
import { Avatar } from "@base-ui/react/avatar";
|
|
59
|
+
import { CaretRightIcon } from "@phosphor-icons/react/dist/csr/CaretRight";
|
|
60
|
+
import { CheckIcon } from "@phosphor-icons/react/dist/csr/Check";
|
|
61
|
+
import { useChat } from "@ai-sdk/react";
|
|
62
|
+
import { ChatCircleIcon } from "@phosphor-icons/react/dist/csr/ChatCircle";
|
|
63
|
+
import { ArrowUpIcon } from "@phosphor-icons/react/dist/csr/ArrowUp";
|
|
64
|
+
import { CaretDownIcon } from "@phosphor-icons/react/dist/csr/CaretDown";
|
|
65
|
+
import { MessageScroller } from "@shadcn/react/message-scroller";
|
|
66
|
+
import { ArrowDownIcon } from "@phosphor-icons/react/dist/csr/ArrowDown";
|
|
67
|
+
import { CopyIcon } from "@phosphor-icons/react/dist/csr/Copy";
|
|
68
|
+
import { GitBranchIcon } from "@phosphor-icons/react/dist/csr/GitBranch";
|
|
69
|
+
// src/components/ui/sonner.tsx
|
|
70
|
+
var Toaster$1 = ({ ...props }) => {
|
|
71
|
+
const { theme = "system" } = useTheme();
|
|
72
|
+
return /* @__PURE__ */ jsx(Toaster, {
|
|
73
|
+
theme,
|
|
74
|
+
className: "toaster group",
|
|
75
|
+
icons: {
|
|
76
|
+
success: /* @__PURE__ */ jsx(CheckCircleIcon, {
|
|
77
|
+
"aria-hidden": "true",
|
|
78
|
+
className: "size-4"
|
|
79
|
+
}),
|
|
80
|
+
info: /* @__PURE__ */ jsx(InfoIcon, {
|
|
81
|
+
"aria-hidden": "true",
|
|
82
|
+
className: "size-4"
|
|
83
|
+
}),
|
|
84
|
+
warning: /* @__PURE__ */ jsx(WarningIcon, {
|
|
85
|
+
"aria-hidden": "true",
|
|
86
|
+
className: "size-4"
|
|
87
|
+
}),
|
|
88
|
+
error: /* @__PURE__ */ jsx(WarningOctagonIcon, {
|
|
89
|
+
"aria-hidden": "true",
|
|
90
|
+
className: "size-4"
|
|
91
|
+
}),
|
|
92
|
+
loading: /* @__PURE__ */ jsx(CircleNotchIcon, {
|
|
93
|
+
"aria-hidden": "true",
|
|
94
|
+
className: "size-4 animate-spin"
|
|
95
|
+
})
|
|
96
|
+
},
|
|
97
|
+
style: {
|
|
98
|
+
"--normal-bg": "var(--popover)",
|
|
99
|
+
"--normal-text": "var(--popover-foreground)",
|
|
100
|
+
"--normal-border": "var(--border)",
|
|
101
|
+
"--border-radius": "var(--radius)"
|
|
102
|
+
},
|
|
103
|
+
toastOptions: { classNames: { toast: "cn-toast" } },
|
|
104
|
+
...props
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
// src/lib/desktop.ts
|
|
108
|
+
/** The desktop shell's API, when the app runs in its window; never on the server. */
|
|
109
|
+
var desktopShell = () => typeof window === "undefined" ? void 0 : window.sanomaDesktop;
|
|
110
|
+
/**
|
|
111
|
+
* The companies open in the desktop shell's window, kept current; undefined outside the shell
|
|
112
|
+
* (and on the server, and until the shell has answered).
|
|
113
|
+
*/
|
|
114
|
+
function useDesktopCompanies() {
|
|
115
|
+
const [companies, setCompanies] = useState();
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
const desktop = desktopShell();
|
|
118
|
+
if (!desktop) return;
|
|
119
|
+
let live = true;
|
|
120
|
+
const off = desktop.onCompanies(setCompanies);
|
|
121
|
+
desktop.companies().then((listed) => live && setCompanies(listed), () => {});
|
|
122
|
+
return () => {
|
|
123
|
+
live = false;
|
|
124
|
+
off();
|
|
125
|
+
};
|
|
126
|
+
}, []);
|
|
127
|
+
return companies;
|
|
128
|
+
}
|
|
129
|
+
// src/components/ui/avatar.tsx
|
|
130
|
+
function Avatar$1({ className, size = "default", ...props }) {
|
|
131
|
+
return /* @__PURE__ */ jsx(Avatar.Root, {
|
|
132
|
+
"data-slot": "avatar",
|
|
133
|
+
"data-size": size,
|
|
134
|
+
className: cn("group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten", className),
|
|
135
|
+
...props
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
function AvatarFallback({ className, ...props }) {
|
|
139
|
+
return /* @__PURE__ */ jsx(Avatar.Fallback, {
|
|
140
|
+
"data-slot": "avatar-fallback",
|
|
141
|
+
className: cn("flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs", className),
|
|
142
|
+
...props
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
// src/components/shell/nav-user.tsx
|
|
146
|
+
/**
|
|
147
|
+
* Who you are, the theme and the density, at the foot of the bar: your initials, your name, your
|
|
148
|
+
* groups (and whom you act for, as an agent) and where the name comes from read out to assistive
|
|
149
|
+
* tech and shown atop the menu, with Sign out when the login has one. In the desktop shell's
|
|
150
|
+
* window, the companies open there too (`useDesktopCompanies`), this one checked: another switches
|
|
151
|
+
* the window to it, and Add company… shows the shell's start screen. Agent… opens the chat on the
|
|
152
|
+
* agents to connect, to change which one a new chat opens on. The menu renders only once
|
|
153
|
+
* opened, in the browser, so the stored theme never reaches the server's markup.
|
|
154
|
+
*/
|
|
155
|
+
function NavUser() {
|
|
156
|
+
const { actor, groups, onBehalfOf, fromServer, error, signOut, setActor } = useActor();
|
|
157
|
+
const { theme, setTheme } = useTheme();
|
|
158
|
+
const { compact, setCompact } = useDensity();
|
|
159
|
+
const companies = useDesktopCompanies();
|
|
160
|
+
const chat = useChatPrompt();
|
|
161
|
+
const shownCompany = companies?.find((company) => company.shown)?.id ?? "";
|
|
162
|
+
const setDensity = (value) => setCompact(value === "compact");
|
|
163
|
+
const status = error ?? (actor ? fromServer ? "Signed in by the deployment" : "Name kept in this browser" : void 0);
|
|
164
|
+
const name = actor ?? (fromServer ? "Not signed in" : "Who are you?");
|
|
165
|
+
const member = actor ? [groups.length ? groups.join(", ") : "no groups", ...onBehalfOf === void 0 ? [] : [`for ${onBehalfOf}`]].join(" · ") : void 0;
|
|
166
|
+
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsxs(DropdownMenuTrigger, {
|
|
167
|
+
className: "flex size-9 items-center justify-center rounded-lg outline-hidden transition-colors hover:bg-secondary/60 focus-visible:ring-2 focus-visible:ring-sidebar-ring data-popup-open:bg-secondary",
|
|
168
|
+
children: [/* @__PURE__ */ jsx(Avatar$1, {
|
|
169
|
+
className: "size-8 rounded-lg",
|
|
170
|
+
children: /* @__PURE__ */ jsx(AvatarFallback, {
|
|
171
|
+
className: "rounded-lg",
|
|
172
|
+
children: actor ? actor.slice(0, 2).toUpperCase() : /* @__PURE__ */ jsx(UserIcon, {
|
|
173
|
+
"aria-hidden": "true",
|
|
174
|
+
className: "size-6"
|
|
175
|
+
})
|
|
176
|
+
})
|
|
177
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
178
|
+
className: "sr-only",
|
|
179
|
+
children: [
|
|
180
|
+
(actor !== void 0 || fromServer) && /* @__PURE__ */ jsx("span", { children: name }),
|
|
181
|
+
member && /* @__PURE__ */ jsx("span", { children: `, ${member}` }),
|
|
182
|
+
status && /* @__PURE__ */ jsx("span", { children: status })
|
|
183
|
+
]
|
|
184
|
+
})]
|
|
185
|
+
}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
|
|
186
|
+
className: "min-w-56",
|
|
187
|
+
side: "right",
|
|
188
|
+
align: "end",
|
|
189
|
+
sideOffset: 4,
|
|
190
|
+
children: [
|
|
191
|
+
/* @__PURE__ */ jsx(DropdownMenuGroup, { children: /* @__PURE__ */ jsxs(DropdownMenuLabel, {
|
|
192
|
+
className: "flex flex-col gap-0.5",
|
|
193
|
+
children: [
|
|
194
|
+
/* @__PURE__ */ jsx("span", {
|
|
195
|
+
className: "text-sm text-foreground",
|
|
196
|
+
children: name
|
|
197
|
+
}),
|
|
198
|
+
member && /* @__PURE__ */ jsx("span", {
|
|
199
|
+
className: "font-normal text-foreground",
|
|
200
|
+
children: member
|
|
201
|
+
}),
|
|
202
|
+
status && /* @__PURE__ */ jsx("span", {
|
|
203
|
+
className: cn("font-normal", error && "text-destructive"),
|
|
204
|
+
children: status
|
|
205
|
+
})
|
|
206
|
+
]
|
|
207
|
+
}) }),
|
|
208
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
209
|
+
companies && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
210
|
+
/* @__PURE__ */ jsx(Choices, {
|
|
211
|
+
label: "Companies",
|
|
212
|
+
value: shownCompany,
|
|
213
|
+
onValueChange: (id) => id !== shownCompany && void desktopShell()?.switch(id),
|
|
214
|
+
choices: companies.map((company) => ({
|
|
215
|
+
value: company.id,
|
|
216
|
+
icon: BuildingsIcon,
|
|
217
|
+
label: company.name
|
|
218
|
+
}))
|
|
219
|
+
}),
|
|
220
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
221
|
+
onClick: () => void desktopShell()?.addCompany(),
|
|
222
|
+
children: [/* @__PURE__ */ jsx(PlusIcon, { "aria-hidden": "true" }), "Add company…"]
|
|
223
|
+
}),
|
|
224
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, {})
|
|
225
|
+
] }),
|
|
226
|
+
!fromServer && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
227
|
+
onClick: () => setActor(null),
|
|
228
|
+
children: [/* @__PURE__ */ jsx(UserCircleGearIcon, { "aria-hidden": "true" }), "Change name"]
|
|
229
|
+
}), /* @__PURE__ */ jsx(DropdownMenuSeparator, {})] }),
|
|
230
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
231
|
+
className: "max-md:hidden",
|
|
232
|
+
onClick: () => chat.chooseAgent(),
|
|
233
|
+
children: [/* @__PURE__ */ jsx(SparkleIcon, { "aria-hidden": "true" }), "Agent…"]
|
|
234
|
+
}),
|
|
235
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, { className: "max-md:hidden" }),
|
|
236
|
+
signOut && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
237
|
+
onClick: () => void signOutAt(signOut),
|
|
238
|
+
children: [/* @__PURE__ */ jsx(SignOutIcon, { "aria-hidden": "true" }), "Sign out"]
|
|
239
|
+
}), /* @__PURE__ */ jsx(DropdownMenuSeparator, {})] }),
|
|
240
|
+
/* @__PURE__ */ jsx(Choices, {
|
|
241
|
+
label: "Theme",
|
|
242
|
+
value: theme ?? "system",
|
|
243
|
+
onValueChange: setTheme,
|
|
244
|
+
choices: THEMES
|
|
245
|
+
}),
|
|
246
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
247
|
+
/* @__PURE__ */ jsx(Choices, {
|
|
248
|
+
label: "Density",
|
|
249
|
+
value: compact ? "compact" : "comfortable",
|
|
250
|
+
onValueChange: setDensity,
|
|
251
|
+
choices: DENSITIES
|
|
252
|
+
})
|
|
253
|
+
]
|
|
254
|
+
})] });
|
|
255
|
+
}
|
|
256
|
+
/** Ends the session, then reloads the app, which shows the login's sign-in page. */
|
|
257
|
+
async function signOutAt(url) {
|
|
258
|
+
if ((await fetch(url, { method: "POST" }).catch(() => void 0))?.ok) window.location.assign("/");
|
|
259
|
+
else toast.error("Could not sign out");
|
|
260
|
+
}
|
|
261
|
+
var THEMES = [
|
|
262
|
+
{
|
|
263
|
+
value: "light",
|
|
264
|
+
icon: SunIcon,
|
|
265
|
+
label: "Light"
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
value: "dark",
|
|
269
|
+
icon: MoonIcon,
|
|
270
|
+
label: "Dark"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
value: "system",
|
|
274
|
+
icon: DesktopIcon,
|
|
275
|
+
label: "System"
|
|
276
|
+
}
|
|
277
|
+
];
|
|
278
|
+
var DENSITIES = [{
|
|
279
|
+
value: "comfortable",
|
|
280
|
+
icon: ArrowsOutSimpleIcon,
|
|
281
|
+
label: "Comfortable"
|
|
282
|
+
}, {
|
|
283
|
+
value: "compact",
|
|
284
|
+
icon: ArrowsInSimpleIcon,
|
|
285
|
+
label: "Compact"
|
|
286
|
+
}];
|
|
287
|
+
/**
|
|
288
|
+
* One labelled radio group of the menu. The label sits inside its group, which Base UI requires
|
|
289
|
+
* and which names the group; a choice closes the menu (`closeOnClick`; Base UI keeps it open).
|
|
290
|
+
*/
|
|
291
|
+
function Choices({ label, value, onValueChange, choices }) {
|
|
292
|
+
return /* @__PURE__ */ jsxs(DropdownMenuRadioGroup, {
|
|
293
|
+
value,
|
|
294
|
+
onValueChange,
|
|
295
|
+
children: [/* @__PURE__ */ jsx(DropdownMenuLabel, { children: label }), choices.map((choice) => /* @__PURE__ */ jsxs(DropdownMenuRadioItem, {
|
|
296
|
+
closeOnClick: true,
|
|
297
|
+
value: choice.value,
|
|
298
|
+
children: [/* @__PURE__ */ jsx(choice.icon, { "aria-hidden": "true" }), choice.label]
|
|
299
|
+
}, choice.value))]
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
// src/components/shell/bar.tsx
|
|
303
|
+
/** What happens, across the company's apps: Sanoma's own pages. */
|
|
304
|
+
var WORK = [
|
|
305
|
+
{
|
|
306
|
+
to: "/inbox",
|
|
307
|
+
label: "Inbox",
|
|
308
|
+
icon: TrayIcon
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
to: "/changes",
|
|
312
|
+
label: "Changes",
|
|
313
|
+
icon: GitPullRequestIcon,
|
|
314
|
+
when: "changes"
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
to: "/workflows",
|
|
318
|
+
label: "Workflows",
|
|
319
|
+
icon: TreeStructureIcon
|
|
320
|
+
}
|
|
321
|
+
];
|
|
322
|
+
/**
|
|
323
|
+
* How the company is set up, by purpose. Data's page leads to the Sites page too, and is lit
|
|
324
|
+
* there; Hosting is where it runs, and going live while it runs nowhere yet.
|
|
325
|
+
*/
|
|
326
|
+
var SETUP = [
|
|
327
|
+
{
|
|
328
|
+
to: "/data",
|
|
329
|
+
label: "Data",
|
|
330
|
+
icon: TableIcon,
|
|
331
|
+
when: "data",
|
|
332
|
+
also: "/sites"
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
to: "/people",
|
|
336
|
+
label: "People",
|
|
337
|
+
icon: UsersIcon
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
to: "/hosting",
|
|
341
|
+
label: "Hosting",
|
|
342
|
+
icon: CloudIcon
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
to: "/connectors",
|
|
346
|
+
label: "Connectors",
|
|
347
|
+
icon: PlugIcon
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
to: "/apps",
|
|
351
|
+
label: "Apps",
|
|
352
|
+
icon: SquaresFourIcon
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
to: "/permissions",
|
|
356
|
+
label: "Permissions",
|
|
357
|
+
icon: KeyIcon,
|
|
358
|
+
when: "policy"
|
|
359
|
+
}
|
|
360
|
+
];
|
|
361
|
+
/** What the bar reads from the config: whether it has collections and a policy, and which sites are public. */
|
|
362
|
+
var selectBar = (config) => ({
|
|
363
|
+
data: config.collections.length > 0,
|
|
364
|
+
policy: config.policy.defined,
|
|
365
|
+
public: new Set(config.sites.filter((site) => site.public).map((site) => site.name))
|
|
366
|
+
});
|
|
367
|
+
/** A site's tile: to its first page (its home, when it has one), lit on any of its pages. */
|
|
368
|
+
var siteTile = ({ title, icon, pages }, isPublic, lit) => ({
|
|
369
|
+
to: pages[0].to,
|
|
370
|
+
label: title,
|
|
371
|
+
icon: /* @__PURE__ */ jsx(SiteIcon, {
|
|
372
|
+
icon,
|
|
373
|
+
public: isPublic
|
|
374
|
+
}),
|
|
375
|
+
lit
|
|
376
|
+
});
|
|
377
|
+
/**
|
|
378
|
+
* The bar's groups, split by a short rule: Inbox and Workflows; the company's sites, a group for
|
|
379
|
+
* the root's and then one for each app's, by the app's name (a site with no page it can link to
|
|
380
|
+
* left out); then Setup. Changes shows when the repository has a remote (a change is reviewed
|
|
381
|
+
* there); Data with collections, or with sites, its page leading to theirs; Permissions with a
|
|
382
|
+
* policy.
|
|
383
|
+
*/
|
|
384
|
+
function useGroups() {
|
|
385
|
+
const { data: has } = useSuspenseQuery({
|
|
386
|
+
...configQuery(),
|
|
387
|
+
select: selectBar
|
|
388
|
+
});
|
|
389
|
+
const { data: remote } = useSuspenseQuery(remoteQuery());
|
|
390
|
+
const sites = useSites();
|
|
391
|
+
const shown = {
|
|
392
|
+
changes: remote,
|
|
393
|
+
data: has.data || sites.length > 0,
|
|
394
|
+
policy: has.policy
|
|
395
|
+
};
|
|
396
|
+
const path = useRouterState({ select: ({ location }) => trimPathRight(location.pathname) });
|
|
397
|
+
const section = ({ to, label, icon: Icon, also }) => ({
|
|
398
|
+
to,
|
|
399
|
+
label,
|
|
400
|
+
icon: /* @__PURE__ */ jsx(Icon, { "aria-hidden": "true" }),
|
|
401
|
+
lit: also === path
|
|
402
|
+
});
|
|
403
|
+
const byApp = Map.groupBy(sites.filter((site) => site.pages.length > 0), (site) => site.app ?? "");
|
|
404
|
+
return [
|
|
405
|
+
WORK.filter((item) => !item.when || shown[item.when]).map(section),
|
|
406
|
+
...[...byApp.keys()].toSorted().map((app) => byApp.get(app).map((site) => siteTile(site, has.public.has(site.name), siteOf(path) === site.name))),
|
|
407
|
+
SETUP.filter((item) => !item.when || shown[item.when]).map(section)
|
|
408
|
+
];
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* An item of the bar: its icon in a tile, its label under it; the tile filled while it is current
|
|
412
|
+
* (`data-active`: a section's page or one under it, Chat while its column is open).
|
|
413
|
+
*/
|
|
414
|
+
var ITEM = "group/item relative flex w-full flex-col items-center gap-1 rounded-lg text-center text-bar wrap-break-word text-sidebar-foreground outline-hidden focus-visible:ring-2 focus-visible:ring-sidebar-ring data-active:font-medium";
|
|
415
|
+
var TILE = "flex size-9 items-center justify-center rounded-lg transition-colors group-hover/item:bg-secondary/60 group-data-active/item:bg-secondary [&_svg]:size-5";
|
|
416
|
+
/** A section's link lit while its page, or one under it, shows (Link sets `aria-current` too). */
|
|
417
|
+
var ACTIVE = { "data-active": true };
|
|
418
|
+
/**
|
|
419
|
+
* The bar, on the `sidebar` surface: Chat, which folds and unfolds the chat column (`chat`; left
|
|
420
|
+
* out in the phone's sheet, which has no column), the groups (`useGroups`), and at its foot what
|
|
421
|
+
* the open window is (`PlaceBadge`) above the user menu.
|
|
422
|
+
*/
|
|
423
|
+
function Bar({ chat, className }) {
|
|
424
|
+
const groups = useGroups();
|
|
425
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
426
|
+
className: cn("flex w-(--bar-width) shrink-0 flex-col items-center gap-1.5 bg-sidebar px-1 py-2.5 text-sidebar-foreground", className),
|
|
427
|
+
children: [
|
|
428
|
+
chat && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("button", {
|
|
429
|
+
type: "button",
|
|
430
|
+
"aria-expanded": chat.open,
|
|
431
|
+
"aria-controls": chat.open ? "chat" : void 0,
|
|
432
|
+
"data-active": chat.open || void 0,
|
|
433
|
+
onClick: chat.toggle,
|
|
434
|
+
className: ITEM,
|
|
435
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
436
|
+
className: TILE,
|
|
437
|
+
children: /* @__PURE__ */ jsx(SparkleIcon, { "aria-hidden": "true" })
|
|
438
|
+
}), "Chat"]
|
|
439
|
+
}), /* @__PURE__ */ jsx(Rule, {})] }),
|
|
440
|
+
/* @__PURE__ */ jsx("nav", {
|
|
441
|
+
"aria-label": "Sections",
|
|
442
|
+
className: "flex w-full flex-col items-center gap-1.5",
|
|
443
|
+
children: groups.map((group, i) => /* @__PURE__ */ jsxs(Fragment, { children: [i > 0 && /* @__PURE__ */ jsx(Rule, {}), /* @__PURE__ */ jsx("ul", {
|
|
444
|
+
className: "flex w-full flex-col gap-1.5",
|
|
445
|
+
children: group.map(({ to, label, icon, lit }) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(Link, {
|
|
446
|
+
to,
|
|
447
|
+
activeProps: ACTIVE,
|
|
448
|
+
"data-active": lit || void 0,
|
|
449
|
+
className: ITEM,
|
|
450
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
451
|
+
className: cn(TILE, "relative"),
|
|
452
|
+
children: [icon, to === "/inbox" && /* @__PURE__ */ jsx(InboxCount, {})]
|
|
453
|
+
}), label]
|
|
454
|
+
}) }, to))
|
|
455
|
+
})] }, group[0].to))
|
|
456
|
+
}),
|
|
457
|
+
/* @__PURE__ */ jsxs("div", {
|
|
458
|
+
className: "mt-auto flex flex-col items-center gap-2",
|
|
459
|
+
children: [/* @__PURE__ */ jsx(PlaceBadge, {}), /* @__PURE__ */ jsx(NavUser, {})]
|
|
460
|
+
})
|
|
461
|
+
]
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
/** The short rule between the bar's groups. */
|
|
465
|
+
function Rule() {
|
|
466
|
+
return /* @__PURE__ */ jsx("div", {
|
|
467
|
+
"aria-hidden": "true",
|
|
468
|
+
className: "my-1 h-px w-9 shrink-0 bg-border"
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
/** What the badge reads from the config: where this instance is. */
|
|
472
|
+
var selectPlace = ({ place, databaseHost }) => ({
|
|
473
|
+
place,
|
|
474
|
+
databaseHost
|
|
475
|
+
});
|
|
476
|
+
/** Each place's badge: its words and its tone. */
|
|
477
|
+
var PLACES = {
|
|
478
|
+
"this-computer": {
|
|
479
|
+
label: "This computer",
|
|
480
|
+
tone: "idle"
|
|
481
|
+
},
|
|
482
|
+
live: {
|
|
483
|
+
label: "Live",
|
|
484
|
+
tone: "ok"
|
|
485
|
+
}
|
|
486
|
+
};
|
|
487
|
+
/**
|
|
488
|
+
* What the open window is, from what this instance connects to (`placeOf`): This computer or
|
|
489
|
+
* Live, its tip the database's host and nothing more (the default socket's is none, an unreadable URL's unknown).
|
|
490
|
+
*/
|
|
491
|
+
function PlaceBadge() {
|
|
492
|
+
const { data } = useSuspenseQuery({
|
|
493
|
+
...configQuery(),
|
|
494
|
+
select: selectPlace
|
|
495
|
+
});
|
|
496
|
+
const { label, tone } = PLACES[data.place];
|
|
497
|
+
return /* @__PURE__ */ jsx(Tip, {
|
|
498
|
+
tip: data.databaseHost === void 0 ? "Database host unknown" : `Database on ${data.databaseHost || "a local socket"}`,
|
|
499
|
+
children: /* @__PURE__ */ jsx(Badge, {
|
|
500
|
+
tabIndex: 0,
|
|
501
|
+
className: cn(toneBadge({ tone }), "h-auto max-w-full rounded-md text-center text-bar whitespace-normal"),
|
|
502
|
+
children: label
|
|
503
|
+
})
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* How many approvals wait, on Inbox's tile. The Inbox page's query (its costliest read), polled
|
|
508
|
+
* every 30 s for the badge. Each watcher polls at its own interval, so while the Inbox page shows,
|
|
509
|
+
* its 5 s poll keeps the badge fresh too; and a decision refreshes it at once. After hydration
|
|
510
|
+
* only: the root loader starts this query without waiting for it, so the server may render before
|
|
511
|
+
* it answers and the browser after.
|
|
512
|
+
*/
|
|
513
|
+
function InboxCount() {
|
|
514
|
+
return /* @__PURE__ */ jsx(ClientOnly, {});
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* On a phone, in the bar's place: a row atop the page with a menu button, which opens the bar in a
|
|
518
|
+
* sheet from the left, closed again as you follow a link in it or tap beside it.
|
|
519
|
+
*/
|
|
520
|
+
function PhoneBar() {
|
|
521
|
+
const [open, setOpen] = useState(false);
|
|
522
|
+
return /* @__PURE__ */ jsx("div", {
|
|
523
|
+
className: "flex h-12 items-center border-b px-2 md:hidden",
|
|
524
|
+
children: /* @__PURE__ */ jsxs(Sheet, {
|
|
525
|
+
open,
|
|
526
|
+
onOpenChange: setOpen,
|
|
527
|
+
children: [/* @__PURE__ */ jsx(SheetTrigger, {
|
|
528
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
529
|
+
variant: "ghost",
|
|
530
|
+
size: "icon",
|
|
531
|
+
"aria-label": "Menu"
|
|
532
|
+
}),
|
|
533
|
+
children: /* @__PURE__ */ jsx(ListIcon, { "aria-hidden": "true" })
|
|
534
|
+
}), /* @__PURE__ */ jsxs(SheetContent, {
|
|
535
|
+
side: "left",
|
|
536
|
+
showCloseButton: false,
|
|
537
|
+
className: "gap-0 bg-sidebar data-[side=left]:w-auto",
|
|
538
|
+
onClick: (event) => {
|
|
539
|
+
if (event.target.closest("a")) setOpen(false);
|
|
540
|
+
},
|
|
541
|
+
children: [/* @__PURE__ */ jsx(SheetTitle, {
|
|
542
|
+
className: "sr-only",
|
|
543
|
+
children: "Sections"
|
|
544
|
+
}), /* @__PURE__ */ jsx(Bar, { className: "h-full" })]
|
|
545
|
+
})]
|
|
546
|
+
})
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
// src/components/ui/input-group.tsx
|
|
550
|
+
function InputGroup({ className, ...props }) {
|
|
551
|
+
return /* @__PURE__ */ jsx("div", {
|
|
552
|
+
"data-slot": "input-group",
|
|
553
|
+
role: "group",
|
|
554
|
+
className: cn("group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors 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]:disabled]:bg-input/50 has-[[data-slot=input-group-control]:disabled]:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 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-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 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 bg-card text-card-foreground dark:has-[[data-slot=input-group-control]:disabled]:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 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", className),
|
|
555
|
+
...props
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
var inputGroupAddonVariants = cva("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4", {
|
|
559
|
+
variants: { align: {
|
|
560
|
+
"inline-start": "order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]",
|
|
561
|
+
"inline-end": "order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]",
|
|
562
|
+
"block-start": "order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2",
|
|
563
|
+
"block-end": "order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"
|
|
564
|
+
} },
|
|
565
|
+
defaultVariants: { align: "inline-start" }
|
|
566
|
+
});
|
|
567
|
+
function InputGroupAddon({ className, align = "inline-start", ...props }) {
|
|
568
|
+
return /* @__PURE__ */ jsx("div", {
|
|
569
|
+
role: "group",
|
|
570
|
+
"data-slot": "input-group-addon",
|
|
571
|
+
"data-align": align,
|
|
572
|
+
className: cn(inputGroupAddonVariants({ align }), className),
|
|
573
|
+
onClick: (e) => {
|
|
574
|
+
if (e.target.closest("button")) return;
|
|
575
|
+
e.currentTarget.parentElement?.querySelector("input, textarea")?.focus();
|
|
576
|
+
},
|
|
577
|
+
...props
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
var inputGroupButtonVariants = cva("flex items-center gap-2 text-sm shadow-none", {
|
|
581
|
+
variants: { size: {
|
|
582
|
+
xs: "h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",
|
|
583
|
+
sm: "",
|
|
584
|
+
"icon-xs": "size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0",
|
|
585
|
+
"icon-sm": "size-8 p-0 has-[>svg]:p-0"
|
|
586
|
+
} },
|
|
587
|
+
defaultVariants: { size: "xs" }
|
|
588
|
+
});
|
|
589
|
+
function InputGroupButton({ className, type = "button", variant = "ghost", size = "xs", ...props }) {
|
|
590
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
591
|
+
type,
|
|
592
|
+
"data-size": size,
|
|
593
|
+
variant,
|
|
594
|
+
className: cn(inputGroupButtonVariants({ size }), className),
|
|
595
|
+
...props
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
function InputGroupTextarea({ className, ...props }) {
|
|
599
|
+
return /* @__PURE__ */ jsx(Textarea, {
|
|
600
|
+
"data-slot": "input-group-control",
|
|
601
|
+
className: cn("flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent", className),
|
|
602
|
+
...props
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
// src/components/shell/engine-mark.tsx
|
|
606
|
+
/** An engine's mark, beside its label: its agent's, from its connector, or Sanoma's for our loop. */
|
|
607
|
+
function EngineMark({ engine }) {
|
|
608
|
+
const mark = engine.agent === "loop" ? { src: icon_small_default } : engine.mark;
|
|
609
|
+
return mark ? /* @__PURE__ */ jsx(Logo, {
|
|
610
|
+
...mark,
|
|
611
|
+
alt: ""
|
|
612
|
+
}) : null;
|
|
613
|
+
}
|
|
614
|
+
// src/components/shell/composer.tsx
|
|
615
|
+
/** Focuses a text box with its caret after its text: where a prompt's words go on. */
|
|
616
|
+
var focusAtEnd = (box) => {
|
|
617
|
+
if (!box) return;
|
|
618
|
+
box.focus();
|
|
619
|
+
box.setSelectionRange(box.value.length, box.value.length);
|
|
620
|
+
};
|
|
621
|
+
/** An engine as the composer's choice. */
|
|
622
|
+
var engineOption = (engine) => /* @__PURE__ */ jsxs(DropdownMenuRadioItem, {
|
|
623
|
+
closeOnClick: true,
|
|
624
|
+
value: engine.name,
|
|
625
|
+
children: [/* @__PURE__ */ jsx(EngineMark, { engine }), engine.label]
|
|
626
|
+
}, engine.name);
|
|
627
|
+
/**
|
|
628
|
+
* The composer: the page you are on as a chip (`page`), the message (starting as `draft`, focused at its end, when a
|
|
629
|
+
* page opened the chat with it), the engine a new chat opens on (`engine`, only then, of its
|
|
630
|
+
* `options`: ours on the company's key, then a person's own plans in a group of their own), Send
|
|
631
|
+
* (Enter; Shift+Enter for a new line), and while there is a `note` (where to connect a model), the
|
|
632
|
+
* note, Send off.
|
|
633
|
+
*/
|
|
634
|
+
function Composer({ page, busy, onSend, draft, engine, note }) {
|
|
635
|
+
const [text, setText] = useState(draft ?? "");
|
|
636
|
+
const noteId = useId();
|
|
637
|
+
const chosen = engine?.options.find((option) => option.name === engine.value);
|
|
638
|
+
const own = engine?.options.filter((option) => option.plan === "own") ?? [];
|
|
639
|
+
const submit = (e) => {
|
|
640
|
+
e?.preventDefault();
|
|
641
|
+
if (busy || note || !text.trim()) return;
|
|
642
|
+
onSend(text.trim());
|
|
643
|
+
setText("");
|
|
644
|
+
};
|
|
645
|
+
return /* @__PURE__ */ jsx("form", {
|
|
646
|
+
onSubmit: submit,
|
|
647
|
+
children: /* @__PURE__ */ jsxs(InputGroup, {
|
|
648
|
+
className: "rounded-xl",
|
|
649
|
+
children: [
|
|
650
|
+
page && /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
651
|
+
align: "block-start",
|
|
652
|
+
className: "pt-3",
|
|
653
|
+
children: /* @__PURE__ */ jsx(Badge, {
|
|
654
|
+
variant: "outline",
|
|
655
|
+
className: "max-w-full",
|
|
656
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
657
|
+
className: "truncate",
|
|
658
|
+
children: page
|
|
659
|
+
})
|
|
660
|
+
})
|
|
661
|
+
}),
|
|
662
|
+
/* @__PURE__ */ jsx(InputGroupTextarea, {
|
|
663
|
+
rows: 2,
|
|
664
|
+
ref: draft ? focusAtEnd : void 0,
|
|
665
|
+
value: text,
|
|
666
|
+
onChange: (e) => setText(e.target.value),
|
|
667
|
+
onKeyDown: (e) => {
|
|
668
|
+
if (e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing) submit(e);
|
|
669
|
+
},
|
|
670
|
+
"aria-label": "Message the agent",
|
|
671
|
+
placeholder: "Ask anything…",
|
|
672
|
+
className: "min-h-0 px-3"
|
|
673
|
+
}),
|
|
674
|
+
note && /* @__PURE__ */ jsx("div", {
|
|
675
|
+
id: noteId,
|
|
676
|
+
className: "w-full px-3",
|
|
677
|
+
children: note
|
|
678
|
+
}),
|
|
679
|
+
/* @__PURE__ */ jsxs(InputGroupAddon, {
|
|
680
|
+
align: "block-end",
|
|
681
|
+
className: "px-3 pb-3",
|
|
682
|
+
children: [engine && /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsxs(DropdownMenuTrigger, {
|
|
683
|
+
render: /* @__PURE__ */ jsx(InputGroupButton, {
|
|
684
|
+
size: "sm",
|
|
685
|
+
"aria-label": `Engine: ${chosen?.label ?? engine.value}`,
|
|
686
|
+
className: "-ml-2 text-xs"
|
|
687
|
+
}),
|
|
688
|
+
children: [
|
|
689
|
+
chosen && /* @__PURE__ */ jsx(EngineMark, { engine: chosen }),
|
|
690
|
+
chosen?.label ?? engine.value,
|
|
691
|
+
/* @__PURE__ */ jsx(CaretDownIcon, {
|
|
692
|
+
"aria-hidden": "true",
|
|
693
|
+
"data-icon": "inline-end"
|
|
694
|
+
})
|
|
695
|
+
]
|
|
696
|
+
}), /* @__PURE__ */ jsx(DropdownMenuContent, {
|
|
697
|
+
align: "start",
|
|
698
|
+
className: "min-w-56",
|
|
699
|
+
children: /* @__PURE__ */ jsxs(DropdownMenuRadioGroup, {
|
|
700
|
+
value: engine.value,
|
|
701
|
+
onValueChange: engine.set,
|
|
702
|
+
children: [/* @__PURE__ */ jsx(DropdownMenuGroup, { children: engine.options.filter((option) => option.plan === "onKey").map(engineOption) }), own.length > 0 && /* @__PURE__ */ jsxs(DropdownMenuGroup, { children: [/* @__PURE__ */ jsx(DropdownMenuLabel, { children: "Your own plan" }), own.map(engineOption)] })]
|
|
703
|
+
})
|
|
704
|
+
})] }), /* @__PURE__ */ jsx(InputGroupButton, {
|
|
705
|
+
type: "submit",
|
|
706
|
+
size: "icon-sm",
|
|
707
|
+
variant: "secondary",
|
|
708
|
+
className: "ml-auto",
|
|
709
|
+
disabled: busy || !!note || !text.trim(),
|
|
710
|
+
"aria-label": "Send",
|
|
711
|
+
"aria-describedby": note ? noteId : void 0,
|
|
712
|
+
children: busy ? /* @__PURE__ */ jsx(Spinner, {}) : /* @__PURE__ */ jsx(ArrowUpIcon, { "aria-hidden": "true" })
|
|
713
|
+
})]
|
|
714
|
+
})
|
|
715
|
+
]
|
|
716
|
+
})
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
// src/components/shell/connect-agent.tsx
|
|
720
|
+
/** The agents with a card of their own: the rest of a person's own are under More agents. */
|
|
721
|
+
var CLAUDE = "claude-code";
|
|
722
|
+
var CODEX = "codex";
|
|
723
|
+
/**
|
|
724
|
+
* The cards, each with its agent's mark: Your Claude plan (its sign-in starts at once; on a live
|
|
725
|
+
* instance that declares no box, what to declare instead, `DECLARE_BOX`), Your ChatGPT plan
|
|
726
|
+
* through Codex (on a live instance, where OpenAI's plan sign-in does not reach, an OpenAI API key,
|
|
727
|
+
* which is not offered yet), an API key on the model's connector page (`vendor`'s, else the
|
|
728
|
+
* Anthropic connector to add), and More agents, the rest the chat can open on here
|
|
729
|
+
* (`enginesHere`). An agent has its card only when a connector of the company gives it on a
|
|
730
|
+
* person's own plan (`ConfigDescription.agents`): a turn on any other fails. `onChoose` gets the
|
|
731
|
+
* engine chosen: the chat opens on it and keeps it for the person's new chats.
|
|
732
|
+
*/
|
|
733
|
+
function ConnectAgent({ vendor, onChoose }) {
|
|
734
|
+
const { data: config } = useQuery(configQuery());
|
|
735
|
+
const live = config?.place === "live";
|
|
736
|
+
const noBox = config !== void 0 && boxless(config);
|
|
737
|
+
const own = config ? enginesHere(config).filter((engine) => engine.plan === "own") : [];
|
|
738
|
+
const claude = (noBox ? enginesOf(config.agents) : own).find((e) => e.plan === "own" && e.agent === CLAUDE);
|
|
739
|
+
const codex = own.find((engine) => engine.agent === CODEX);
|
|
740
|
+
const more = own.filter((engine) => engine !== claude && engine !== codex);
|
|
741
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
742
|
+
className: "flex flex-col gap-3",
|
|
743
|
+
children: [
|
|
744
|
+
/* @__PURE__ */ jsxs("div", {
|
|
745
|
+
className: "flex flex-col gap-1.5",
|
|
746
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
747
|
+
className: "font-display text-2xl",
|
|
748
|
+
children: "Connect your agent"
|
|
749
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
750
|
+
className: "text-muted-foreground",
|
|
751
|
+
children: "The agent makes every change: you ask in plain words, it drafts the change and checks it, and you save it. It runs on a plan you already pay for, or an API key."
|
|
752
|
+
})]
|
|
753
|
+
}),
|
|
754
|
+
/* @__PURE__ */ jsxs(ItemGroup, {
|
|
755
|
+
className: "gap-2",
|
|
756
|
+
children: [
|
|
757
|
+
claude && /* @__PURE__ */ jsxs(Item, {
|
|
758
|
+
variant: "outline",
|
|
759
|
+
className: "border-primary bg-card",
|
|
760
|
+
children: [
|
|
761
|
+
/* @__PURE__ */ jsx(ItemMedia, { children: /* @__PURE__ */ jsx(EngineMark, { engine: claude }) }),
|
|
762
|
+
/* @__PURE__ */ jsxs(ItemContent, { children: [/* @__PURE__ */ jsxs(ItemTitle, { children: ["Your Claude plan ", /* @__PURE__ */ jsx(Badge, {
|
|
763
|
+
variant: "secondary",
|
|
764
|
+
children: "Recommended"
|
|
765
|
+
})] }), /* @__PURE__ */ jsx(ItemDescription, { children: noBox ? `Coding agents work in a box of their own on a live instance, and this company declares none: declare one in resources/sanoma/infra.ts (\`export const box = agent37.instance({})\`, with the agent37 connector in sanoma.config.ts) and set AGENT37_API_KEY.` : "Pro or Max. Sign in once in your browser; nothing extra to pay." })] }),
|
|
766
|
+
!noBox && /* @__PURE__ */ jsx(Button, {
|
|
767
|
+
className: "w-full",
|
|
768
|
+
onClick: () => onChoose(claude.name),
|
|
769
|
+
children: "Sign in with Claude"
|
|
770
|
+
})
|
|
771
|
+
]
|
|
772
|
+
}),
|
|
773
|
+
!codex ? null : live ? /* @__PURE__ */ jsxs(Item, {
|
|
774
|
+
variant: "outline",
|
|
775
|
+
className: "bg-card",
|
|
776
|
+
children: [/* @__PURE__ */ jsx(ItemMedia, { children: /* @__PURE__ */ jsx(EngineMark, { engine: codex }) }), /* @__PURE__ */ jsxs(ItemContent, { children: [/* @__PURE__ */ jsx(ItemTitle, { children: "An OpenAI API key" }), /* @__PURE__ */ jsx(ItemDescription, { children: "For Codex: not offered here yet. Your ChatGPT plan signs in on your computer." })] })]
|
|
777
|
+
}) : /* @__PURE__ */ jsxs(Item, {
|
|
778
|
+
variant: "outline",
|
|
779
|
+
className: "bg-card",
|
|
780
|
+
children: [
|
|
781
|
+
/* @__PURE__ */ jsx(ItemMedia, { children: /* @__PURE__ */ jsx(EngineMark, { engine: codex }) }),
|
|
782
|
+
/* @__PURE__ */ jsxs(ItemContent, { children: [/* @__PURE__ */ jsx(ItemTitle, { children: "Your ChatGPT plan" }), /* @__PURE__ */ jsx(ItemDescription, { children: "Plus or Pro, through Codex" })] }),
|
|
783
|
+
/* @__PURE__ */ jsx(ItemActions, { children: /* @__PURE__ */ jsx(Button, {
|
|
784
|
+
variant: "outline",
|
|
785
|
+
size: "sm",
|
|
786
|
+
onClick: () => onChoose(codex.name),
|
|
787
|
+
children: "Sign in"
|
|
788
|
+
}) })
|
|
789
|
+
]
|
|
790
|
+
}),
|
|
791
|
+
/* @__PURE__ */ jsxs(Item, {
|
|
792
|
+
variant: "outline",
|
|
793
|
+
className: "bg-card",
|
|
794
|
+
children: [/* @__PURE__ */ jsxs(ItemContent, { children: [/* @__PURE__ */ jsx(ItemTitle, { children: "An API key" }), /* @__PURE__ */ jsx(ItemDescription, { children: "Anthropic, billed for what you use" })] }), /* @__PURE__ */ jsx(ItemActions, { children: /* @__PURE__ */ jsx(ButtonLink, {
|
|
795
|
+
variant: "outline",
|
|
796
|
+
size: "sm",
|
|
797
|
+
children: vendor ? /* @__PURE__ */ jsx(Link, {
|
|
798
|
+
to: "/connectors/$vendor",
|
|
799
|
+
params: { vendor },
|
|
800
|
+
onClick: () => onChoose("loop"),
|
|
801
|
+
children: "Add key"
|
|
802
|
+
}) : /* @__PURE__ */ jsx(Link, {
|
|
803
|
+
to: "/connectors",
|
|
804
|
+
search: { add: MODEL_CONNECTOR },
|
|
805
|
+
onClick: () => onChoose("loop"),
|
|
806
|
+
children: "Add key"
|
|
807
|
+
})
|
|
808
|
+
}) })]
|
|
809
|
+
})
|
|
810
|
+
]
|
|
811
|
+
}),
|
|
812
|
+
/* @__PURE__ */ jsxs(Collapsible, {
|
|
813
|
+
className: "flex flex-col gap-2",
|
|
814
|
+
children: [/* @__PURE__ */ jsxs("p", {
|
|
815
|
+
className: "text-xs text-muted-foreground",
|
|
816
|
+
children: [more.length > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
817
|
+
"Other agents (",
|
|
818
|
+
more.map((engine) => engine.title).join(", "),
|
|
819
|
+
") are under",
|
|
820
|
+
" ",
|
|
821
|
+
/* @__PURE__ */ jsx(CollapsibleTrigger, {
|
|
822
|
+
className: "underline underline-offset-4",
|
|
823
|
+
children: "More agents"
|
|
824
|
+
}),
|
|
825
|
+
".",
|
|
826
|
+
" "
|
|
827
|
+
] }), "Change it any time under Agent… in your menu."]
|
|
828
|
+
}), /* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx(ItemGroup, {
|
|
829
|
+
className: "gap-2",
|
|
830
|
+
children: more.map((engine) => /* @__PURE__ */ jsxs(Item, {
|
|
831
|
+
variant: "outline",
|
|
832
|
+
size: "xs",
|
|
833
|
+
className: "bg-card",
|
|
834
|
+
children: [
|
|
835
|
+
/* @__PURE__ */ jsx(ItemMedia, { children: /* @__PURE__ */ jsx(EngineMark, { engine }) }),
|
|
836
|
+
/* @__PURE__ */ jsx(ItemContent, { children: /* @__PURE__ */ jsx(ItemTitle, { children: engine.title }) }),
|
|
837
|
+
/* @__PURE__ */ jsx(ItemActions, { children: /* @__PURE__ */ jsx(Button, {
|
|
838
|
+
variant: "outline",
|
|
839
|
+
size: "sm",
|
|
840
|
+
onClick: () => onChoose(engine.name),
|
|
841
|
+
children: "Sign in"
|
|
842
|
+
}) })
|
|
843
|
+
]
|
|
844
|
+
}, engine.name))
|
|
845
|
+
}) })]
|
|
846
|
+
})
|
|
847
|
+
]
|
|
848
|
+
});
|
|
849
|
+
}
|
|
850
|
+
// src/components/ui/bubble.tsx
|
|
851
|
+
var bubbleVariants = cva("group/bubble relative flex w-fit max-w-[80%] min-w-0 flex-col gap-1 group-data-[align=end]/message:self-end data-[align=end]:self-end data-[variant=ghost]:max-w-full", {
|
|
852
|
+
variants: { variant: {
|
|
853
|
+
default: "*:data-[slot=bubble-content]:bg-primary *:data-[slot=bubble-content]:text-primary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-primary/80",
|
|
854
|
+
secondary: "*:data-[slot=bubble-content]:bg-secondary *:data-[slot=bubble-content]:text-secondary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]",
|
|
855
|
+
muted: "*:data-[slot=bubble-content]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--muted),var(--foreground)_5%)]",
|
|
856
|
+
tinted: "*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.93_calc(c*0.4)_h)] *:data-[slot=bubble-content]:text-foreground dark:*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.3_calc(c*0.4)_h)] [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.88_calc(c*0.5)_h)] dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.35_calc(c*0.5)_h)]",
|
|
857
|
+
outline: "*:data-[slot=bubble-content]:border-border *:data-[slot=bubble-content]:bg-card [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-input/30",
|
|
858
|
+
ghost: "border-none *:data-[slot=bubble-content]:rounded-none *:data-[slot=bubble-content]:bg-transparent *:data-[slot=bubble-content]:p-0 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted/50",
|
|
859
|
+
destructive: "*:data-[slot=bubble-content]:bg-destructive/10 *:data-[slot=bubble-content]:text-destructive dark:*:data-[slot=bubble-content]:bg-destructive/20 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/20 dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/30"
|
|
860
|
+
} },
|
|
861
|
+
defaultVariants: { variant: "default" }
|
|
862
|
+
});
|
|
863
|
+
function Bubble({ variant = "default", align = "start", className, ...props }) {
|
|
864
|
+
return /* @__PURE__ */ jsx("div", {
|
|
865
|
+
"data-slot": "bubble",
|
|
866
|
+
"data-variant": variant,
|
|
867
|
+
"data-align": align,
|
|
868
|
+
className: cn(bubbleVariants({ variant }), className),
|
|
869
|
+
...props
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
function BubbleContent({ className, render, ...props }) {
|
|
873
|
+
return useRender({
|
|
874
|
+
defaultTagName: "div",
|
|
875
|
+
props: mergeProps({ className: cn("w-fit max-w-full min-w-0 overflow-hidden rounded-xl border border-transparent px-3 py-2 text-sm leading-relaxed wrap-break-word group-data-[align=end]/bubble:self-end [button]:text-left [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-3 [button,a]:focus-visible:ring-ring/50", className) }, props),
|
|
876
|
+
render,
|
|
877
|
+
state: { slot: "bubble-content" }
|
|
878
|
+
});
|
|
879
|
+
}
|
|
880
|
+
cva("absolute z-10 flex w-fit shrink-0 items-center justify-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-sm ring-3 ring-card has-[button]:p-0", {
|
|
881
|
+
variants: {
|
|
882
|
+
side: {
|
|
883
|
+
top: "top-0 -translate-y-3/4",
|
|
884
|
+
bottom: "bottom-0 translate-y-3/4"
|
|
885
|
+
},
|
|
886
|
+
align: {
|
|
887
|
+
start: "left-3",
|
|
888
|
+
end: "right-3"
|
|
889
|
+
}
|
|
890
|
+
},
|
|
891
|
+
defaultVariants: {
|
|
892
|
+
side: "bottom",
|
|
893
|
+
align: "end"
|
|
894
|
+
}
|
|
895
|
+
});
|
|
896
|
+
// src/components/ui/marker.tsx
|
|
897
|
+
var markerVariants = cva("group/marker relative flex min-h-4 w-full items-center gap-2 text-left text-sm text-muted-foreground [&_svg:not([class*='size-'])]:size-4 [a]:underline [a]:underline-offset-3 [a]:hover:text-foreground", { variants: { variant: {
|
|
898
|
+
default: "",
|
|
899
|
+
separator: "before:mr-1 before:h-px before:min-w-0 before:flex-1 before:bg-border after:ml-1 after:h-px after:min-w-0 after:flex-1 after:bg-border",
|
|
900
|
+
border: "border-b border-border pb-2"
|
|
901
|
+
} } });
|
|
902
|
+
function Marker({ className, variant = "default", render, ...props }) {
|
|
903
|
+
return useRender({
|
|
904
|
+
defaultTagName: "div",
|
|
905
|
+
props: mergeProps({ className: cn(markerVariants({
|
|
906
|
+
variant,
|
|
907
|
+
className
|
|
908
|
+
})) }, props),
|
|
909
|
+
render,
|
|
910
|
+
state: {
|
|
911
|
+
slot: "marker",
|
|
912
|
+
variant
|
|
913
|
+
}
|
|
914
|
+
});
|
|
915
|
+
}
|
|
916
|
+
function MarkerContent({ className, ...props }) {
|
|
917
|
+
return /* @__PURE__ */ jsx("span", {
|
|
918
|
+
"data-slot": "marker-content",
|
|
919
|
+
className: cn("min-w-0 wrap-break-word group-data-[variant=separator]/marker:flex-none group-data-[variant=separator]/marker:text-center *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground", className),
|
|
920
|
+
...props
|
|
921
|
+
});
|
|
922
|
+
}
|
|
923
|
+
// src/components/ui/message.tsx
|
|
924
|
+
function Message({ className, align = "start", ...props }) {
|
|
925
|
+
return /* @__PURE__ */ jsx("div", {
|
|
926
|
+
"data-slot": "message",
|
|
927
|
+
"data-align": align,
|
|
928
|
+
className: cn("group/message relative flex w-full min-w-0 gap-2 text-sm data-[align=end]:flex-row-reverse", className),
|
|
929
|
+
...props
|
|
930
|
+
});
|
|
931
|
+
}
|
|
932
|
+
function MessageContent({ className, ...props }) {
|
|
933
|
+
return /* @__PURE__ */ jsx("div", {
|
|
934
|
+
"data-slot": "message-content",
|
|
935
|
+
className: cn("flex w-full min-w-0 flex-col gap-2.5 wrap-break-word group-data-[align=end]/message:*:data-slot:self-end", className),
|
|
936
|
+
...props
|
|
937
|
+
});
|
|
938
|
+
}
|
|
939
|
+
function MessageFooter({ className, ...props }) {
|
|
940
|
+
return /* @__PURE__ */ jsx("div", {
|
|
941
|
+
"data-slot": "message-footer",
|
|
942
|
+
className: cn("flex max-w-full min-w-0 items-center px-3 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0 group-data-[align=end]/message:justify-end", className),
|
|
943
|
+
...props
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
// src/components/ui/message-scroller.tsx
|
|
947
|
+
function MessageScrollerProvider(props) {
|
|
948
|
+
return /* @__PURE__ */ jsx(MessageScroller.Provider, { ...props });
|
|
949
|
+
}
|
|
950
|
+
function MessageScroller$1({ className, ...props }) {
|
|
951
|
+
return /* @__PURE__ */ jsx(MessageScroller.Root, {
|
|
952
|
+
"data-slot": "message-scroller",
|
|
953
|
+
className: cn("group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden", className),
|
|
954
|
+
...props
|
|
955
|
+
});
|
|
956
|
+
}
|
|
957
|
+
function MessageScrollerViewport({ className, ...props }) {
|
|
958
|
+
return /* @__PURE__ */ jsx(MessageScroller.Viewport, {
|
|
959
|
+
"data-slot": "message-scroller-viewport",
|
|
960
|
+
className: cn("size-full min-h-0 min-w-0 scroll-fade-b scrollbar-thin scrollbar-gutter-stable overflow-y-auto overscroll-contain contain-content data-autoscrolling:scrollbar-thumb-transparent data-autoscrolling:scrollbar-track-transparent data-pending-scroll:invisible", className),
|
|
961
|
+
...props
|
|
962
|
+
});
|
|
963
|
+
}
|
|
964
|
+
function MessageScrollerContent({ className, ...props }) {
|
|
965
|
+
return /* @__PURE__ */ jsx(MessageScroller.Content, {
|
|
966
|
+
"data-slot": "message-scroller-content",
|
|
967
|
+
className: cn("flex h-max min-h-full flex-col gap-6", className),
|
|
968
|
+
...props
|
|
969
|
+
});
|
|
970
|
+
}
|
|
971
|
+
function MessageScrollerItem({ className, scrollAnchor = false, ...props }) {
|
|
972
|
+
return /* @__PURE__ */ jsx(MessageScroller.Item, {
|
|
973
|
+
"data-slot": "message-scroller-item",
|
|
974
|
+
scrollAnchor,
|
|
975
|
+
className: cn("min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]", className),
|
|
976
|
+
...props
|
|
977
|
+
});
|
|
978
|
+
}
|
|
979
|
+
function MessageScrollerButton({ direction = "end", className, children, render, variant = "secondary", size = "icon-sm", ...props }) {
|
|
980
|
+
return /* @__PURE__ */ jsx(MessageScroller.Button, {
|
|
981
|
+
"data-slot": "message-scroller-button",
|
|
982
|
+
"data-direction": direction,
|
|
983
|
+
"data-variant": variant,
|
|
984
|
+
"data-size": size,
|
|
985
|
+
direction,
|
|
986
|
+
className: cn("absolute inset-s-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-200 hover:bg-muted hover:text-foreground data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180", className),
|
|
987
|
+
render: render ?? /* @__PURE__ */ jsx(Button, {
|
|
988
|
+
variant,
|
|
989
|
+
size
|
|
990
|
+
}),
|
|
991
|
+
...props,
|
|
992
|
+
children: children ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ArrowDownIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
993
|
+
className: "sr-only",
|
|
994
|
+
children: direction === "end" ? "Scroll to end" : "Scroll to start"
|
|
995
|
+
})] })
|
|
996
|
+
});
|
|
997
|
+
}
|
|
998
|
+
// src/components/ui/trace.tsx
|
|
999
|
+
function Trace({ className, ...props }) {
|
|
1000
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1001
|
+
"data-slot": "trace",
|
|
1002
|
+
className: cn("flex w-full min-w-0 flex-col gap-2 *:has-[>[data-slot=trace-line]]:flex *:has-[>[data-slot=trace-line]]:w-fit *:has-[>[data-slot=trace-line]]:max-w-full *:has-[>[data-slot=trace-line]]:min-w-0 *:has-[>[data-slot=trace-line]]:rounded-md *:has-[>[data-slot=trace-line]]:text-left *:has-[>[data-slot=trace-line]]:outline-none *:has-[>[data-slot=trace-line]]:focus-visible:ring-3 *:has-[>[data-slot=trace-line]]:focus-visible:ring-ring/50", className),
|
|
1003
|
+
...props
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
1006
|
+
function TraceLine({ className, status, ...props }) {
|
|
1007
|
+
return /* @__PURE__ */ jsx("span", {
|
|
1008
|
+
"data-slot": "trace-line",
|
|
1009
|
+
"data-status": status,
|
|
1010
|
+
className: cn("flex w-fit max-w-full min-w-0 items-center gap-2 text-sm text-muted-foreground transition-colors in-[a,button]:cursor-pointer in-[a:hover,button:hover]:text-foreground data-[status=error]:text-destructive data-[status=error]:in-[a:hover,button:hover]:text-destructive data-[status=pending]:opacity-60 data-[status=running]:*:data-[slot=trace-title]:shimmer", className),
|
|
1011
|
+
...props
|
|
1012
|
+
});
|
|
1013
|
+
}
|
|
1014
|
+
function TraceIcon({ className, ...props }) {
|
|
1015
|
+
return /* @__PURE__ */ jsx("span", {
|
|
1016
|
+
"data-slot": "trace-icon",
|
|
1017
|
+
"aria-hidden": "true",
|
|
1018
|
+
className: cn("flex size-4 shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [[data-slot=trace-title]~&]:-ml-1", className),
|
|
1019
|
+
...props
|
|
1020
|
+
});
|
|
1021
|
+
}
|
|
1022
|
+
function TraceTitle({ className, ...props }) {
|
|
1023
|
+
return /* @__PURE__ */ jsx("span", {
|
|
1024
|
+
"data-slot": "trace-title",
|
|
1025
|
+
className: cn("min-w-0 truncate motion-reduce:shimmer-none", className),
|
|
1026
|
+
...props
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1029
|
+
function TraceCollapsible({ className, ...props }) {
|
|
1030
|
+
return /* @__PURE__ */ jsx(Collapsible, {
|
|
1031
|
+
"data-slot": "trace-collapsible",
|
|
1032
|
+
className: cn("flex w-full min-w-0 flex-col", className),
|
|
1033
|
+
...props
|
|
1034
|
+
});
|
|
1035
|
+
}
|
|
1036
|
+
function TraceCollapsibleTrigger({ className, children, ...props }) {
|
|
1037
|
+
return /* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
1038
|
+
"data-slot": "trace-collapsible-trigger",
|
|
1039
|
+
className: cn("group/trace-collapsible-trigger flex w-fit max-w-full min-w-0 cursor-pointer items-center gap-1 rounded-md text-left text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 has-[[data-status=error]]:text-destructive", className),
|
|
1040
|
+
...props,
|
|
1041
|
+
children: [children, /* @__PURE__ */ jsx(TraceIcon, {
|
|
1042
|
+
className: "transition-transform group-aria-expanded/trace-collapsible-trigger:rotate-90",
|
|
1043
|
+
children: /* @__PURE__ */ jsx(CaretRightIcon, {})
|
|
1044
|
+
})]
|
|
1045
|
+
});
|
|
1046
|
+
}
|
|
1047
|
+
function TraceCollapsibleContent({ className, children, ...props }) {
|
|
1048
|
+
return /* @__PURE__ */ jsx(CollapsibleContent, {
|
|
1049
|
+
"data-slot": "trace-collapsible-content",
|
|
1050
|
+
className: "h-(--collapsible-panel-height) min-w-0 overflow-hidden transition-[height] duration-200 data-ending-style:h-0 data-starting-style:h-0",
|
|
1051
|
+
...props,
|
|
1052
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1053
|
+
"data-slot": "trace-collapsible-content-inner",
|
|
1054
|
+
className: cn("mt-2 mb-1 ml-[calc(--spacing(2)-1px)] min-w-0 border-l pr-1 pl-4 leading-relaxed wrap-break-word text-muted-foreground", className),
|
|
1055
|
+
children
|
|
1056
|
+
})
|
|
1057
|
+
});
|
|
1058
|
+
}
|
|
1059
|
+
// src/components/ui/code-block.tsx
|
|
1060
|
+
var codeBlockVariants = cva("group/code-block relative flex w-full min-w-0 flex-col overflow-hidden rounded-lg text-sm has-[>[data-slot=code-block-content]:focus-visible]:ring-3 has-[>[data-slot=code-block-content]:focus-visible]:ring-ring/50 data-[size=sm]:text-xs", {
|
|
1061
|
+
variants: { variant: {
|
|
1062
|
+
default: "border border-input text-foreground has-[>[data-slot=code-block-content]:focus-visible]:border-ring dark:bg-input/30",
|
|
1063
|
+
destructive: "border border-destructive/30 text-destructive dark:border-destructive/40"
|
|
1064
|
+
} },
|
|
1065
|
+
defaultVariants: { variant: "default" }
|
|
1066
|
+
});
|
|
1067
|
+
function CodeBlock({ className, variant = "default", size = "default", ...props }) {
|
|
1068
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1069
|
+
"data-slot": "code-block",
|
|
1070
|
+
"data-variant": variant,
|
|
1071
|
+
"data-size": size,
|
|
1072
|
+
className: cn(codeBlockVariants({ variant }), className),
|
|
1073
|
+
...props
|
|
1074
|
+
});
|
|
1075
|
+
}
|
|
1076
|
+
function CodeBlockActions({ className, ...props }) {
|
|
1077
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1078
|
+
"data-slot": "code-block-actions",
|
|
1079
|
+
className: cn("-my-1 ms-auto -me-1.5 flex shrink-0 items-center gap-1 [[data-slot=code-block]>&]:absolute [[data-slot=code-block]>&]:end-2 [[data-slot=code-block]>&]:top-2 [[data-slot=code-block]>&]:z-10 [[data-slot=code-block]>&]:m-0 [[data-slot=code-block]>&]:opacity-0 [[data-slot=code-block]>&]:transition-opacity [[data-slot=code-block]>&]:group-focus-within/code-block:opacity-100 [[data-slot=code-block]>&]:group-hover/code-block:opacity-100 group-data-[size=sm]/code-block:[[data-slot=code-block]>&]:end-1.5 group-data-[size=sm]/code-block:[[data-slot=code-block]>&]:top-1.5 [[data-slot=code-block]>&]:pointer-coarse:opacity-100 [[data-slot=code-block]>&]:*:[button]:bg-background [[data-slot=code-block]>&]:*:[button]:ring-1 [[data-slot=code-block]>&]:*:[button]:ring-foreground/10", className),
|
|
1080
|
+
...props
|
|
1081
|
+
});
|
|
1082
|
+
}
|
|
1083
|
+
function CodeBlockCopyButton({ value, variant = "ghost", size = "icon-xs", className, onClick, ...props }) {
|
|
1084
|
+
const [copied, setCopied] = React.useState(false);
|
|
1085
|
+
React.useEffect(() => {
|
|
1086
|
+
if (!copied) return;
|
|
1087
|
+
const timeout = setTimeout(() => setCopied(false), 2e3);
|
|
1088
|
+
return () => clearTimeout(timeout);
|
|
1089
|
+
}, [copied]);
|
|
1090
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Button, {
|
|
1091
|
+
"data-slot": "code-block-copy-button",
|
|
1092
|
+
"data-copied": copied || void 0,
|
|
1093
|
+
variant,
|
|
1094
|
+
size,
|
|
1095
|
+
"aria-label": copied ? "Copied" : "Copy",
|
|
1096
|
+
className: cn(className),
|
|
1097
|
+
onClick: (event) => {
|
|
1098
|
+
onClick?.(event);
|
|
1099
|
+
navigator.clipboard.writeText(value).then(() => setCopied(true)).catch(() => {});
|
|
1100
|
+
},
|
|
1101
|
+
...props,
|
|
1102
|
+
children: copied ? /* @__PURE__ */ jsx(CheckIcon, {}) : /* @__PURE__ */ jsx(CopyIcon, {})
|
|
1103
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1104
|
+
"aria-live": "polite",
|
|
1105
|
+
className: "sr-only",
|
|
1106
|
+
children: copied ? "Copied" : ""
|
|
1107
|
+
})] });
|
|
1108
|
+
}
|
|
1109
|
+
function CodeBlockContent({ className, children, style, wrap = false, lineNumbers = false, startLine = 1, ...props }) {
|
|
1110
|
+
return /* @__PURE__ */ jsx("pre", {
|
|
1111
|
+
"data-slot": "code-block-content",
|
|
1112
|
+
"data-wrap": wrap || void 0,
|
|
1113
|
+
"data-numbered": lineNumbers || void 0,
|
|
1114
|
+
dir: "ltr",
|
|
1115
|
+
tabIndex: 0,
|
|
1116
|
+
style: {
|
|
1117
|
+
counterReset: `line ${startLine - 1}`,
|
|
1118
|
+
...style
|
|
1119
|
+
},
|
|
1120
|
+
className: cn("min-h-0 min-w-0 scroll-fade-x scrollbar-thin overflow-auto px-3 py-3 text-start font-mono leading-relaxed outline-none group-has-data-[slot=code-block-footer]/code-block:pb-2 group-has-data-[slot=code-block-header]/code-block:pt-2 group-data-[size=sm]/code-block:px-2.5 group-data-[size=sm]/code-block:py-2.5 group-data-[size=sm]/code-block:group-has-data-[slot=code-block-header]/code-block:pt-1.5 data-wrap:scroll-fade-y data-wrap:wrap-break-word data-wrap:whitespace-pre-wrap", className),
|
|
1121
|
+
...props,
|
|
1122
|
+
children: /* @__PURE__ */ jsx("code", {
|
|
1123
|
+
"data-slot": "code-block-code",
|
|
1124
|
+
className: "grid min-h-lh min-w-max content-start in-data-numbered:grid-cols-[auto_1fr] in-data-wrap:min-w-0",
|
|
1125
|
+
children: lineNumbers && typeof children === "string" ? children.replace(/\n$/, "").split("\n").map((line, index) => /* @__PURE__ */ jsx(CodeBlockLine, { children: line }, index)) : children
|
|
1126
|
+
})
|
|
1127
|
+
});
|
|
1128
|
+
}
|
|
1129
|
+
var codeBlockLineVariants = cva("relative -mx-3 block min-h-lh px-3 group-data-[size=sm]/code-block:-mx-2.5 group-data-[size=sm]/code-block:px-2.5 before:min-w-6 before:text-end before:text-muted-foreground after:absolute after:start-1 after:top-0 after:text-muted-foreground after:select-none in-data-numbered:col-span-2 in-data-numbered:grid in-data-numbered:grid-cols-subgrid in-data-numbered:gap-x-3 in-data-numbered:[counter-increment:line] in-data-numbered:before:content-[counter(line)] in-data-numbered:before:select-none in-data-numbered:supports-[content:counter(line)_/_'']:before:content-[counter(line)_/_'']", {
|
|
1130
|
+
variants: { variant: {
|
|
1131
|
+
default: "",
|
|
1132
|
+
added: "bg-muted after:content-['+']",
|
|
1133
|
+
removed: "bg-destructive/10 after:text-destructive after:content-['−']",
|
|
1134
|
+
highlighted: "bg-muted"
|
|
1135
|
+
} },
|
|
1136
|
+
defaultVariants: { variant: "default" }
|
|
1137
|
+
});
|
|
1138
|
+
function CodeBlockLine({ className, variant = "default", children, ...props }) {
|
|
1139
|
+
const empty = children === void 0 || children === null || children === "" || Array.isArray(children) && children.length === 0;
|
|
1140
|
+
return /* @__PURE__ */ jsx("span", {
|
|
1141
|
+
"data-slot": "code-block-line",
|
|
1142
|
+
"data-variant": variant,
|
|
1143
|
+
className: cn(codeBlockLineVariants({ variant }), className),
|
|
1144
|
+
...props,
|
|
1145
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
1146
|
+
"data-slot": "code-block-line-content",
|
|
1147
|
+
className: "min-w-0",
|
|
1148
|
+
children: empty ? "\n" : children
|
|
1149
|
+
})
|
|
1150
|
+
});
|
|
1151
|
+
}
|
|
1152
|
+
// src/components/shell/draft-card.tsx
|
|
1153
|
+
/**
|
|
1154
|
+
* The draft's card: its branch, what it changes (git's summary), its checks, and how it goes
|
|
1155
|
+
* live: with a remote, sent for review as a change (`Review`); without one, merging its branch by
|
|
1156
|
+
* hand, the live instance running the old code until it restarts.
|
|
1157
|
+
*/
|
|
1158
|
+
function DraftCardView({ draft }) {
|
|
1159
|
+
const { checks } = draft;
|
|
1160
|
+
const { data: remote } = useSuspenseQuery(remoteQuery());
|
|
1161
|
+
return /* @__PURE__ */ jsxs(Card, {
|
|
1162
|
+
size: "sm",
|
|
1163
|
+
role: "region",
|
|
1164
|
+
"aria-label": "Draft",
|
|
1165
|
+
children: [
|
|
1166
|
+
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardHeading, { children: /* @__PURE__ */ jsxs("span", {
|
|
1167
|
+
className: "flex items-center gap-1.5",
|
|
1168
|
+
children: [/* @__PURE__ */ jsx(GitBranchIcon, {
|
|
1169
|
+
"aria-hidden": "true",
|
|
1170
|
+
className: "shrink-0"
|
|
1171
|
+
}), /* @__PURE__ */ jsx("code", {
|
|
1172
|
+
className: "truncate",
|
|
1173
|
+
children: draft.branch
|
|
1174
|
+
})]
|
|
1175
|
+
}) }) }),
|
|
1176
|
+
/* @__PURE__ */ jsxs(CardContent, {
|
|
1177
|
+
className: "flex flex-col gap-2",
|
|
1178
|
+
children: [draft.summary ? /* @__PURE__ */ jsx("pre", {
|
|
1179
|
+
className: "overflow-x-auto font-mono text-xs whitespace-pre",
|
|
1180
|
+
children: draft.summary
|
|
1181
|
+
}) : /* @__PURE__ */ jsx("p", {
|
|
1182
|
+
className: "text-muted-foreground",
|
|
1183
|
+
children: "No change committed yet."
|
|
1184
|
+
}), checks === void 0 ? /* @__PURE__ */ jsx("p", {
|
|
1185
|
+
className: "text-muted-foreground",
|
|
1186
|
+
children: "Not checked since the last edit."
|
|
1187
|
+
}) : checks.ok ? /* @__PURE__ */ jsxs("p", {
|
|
1188
|
+
className: "flex items-center gap-1.5",
|
|
1189
|
+
children: [
|
|
1190
|
+
/* @__PURE__ */ jsx(CheckIcon, { "aria-hidden": "true" }),
|
|
1191
|
+
" Checks pass",
|
|
1192
|
+
checks.warnings.length > 0 && `, with ${plural(checks.warnings.length, "warning")}`
|
|
1193
|
+
]
|
|
1194
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
1195
|
+
className: "flex flex-col gap-1",
|
|
1196
|
+
children: [/* @__PURE__ */ jsxs("p", {
|
|
1197
|
+
className: "flex items-center gap-1.5 text-destructive",
|
|
1198
|
+
children: [
|
|
1199
|
+
/* @__PURE__ */ jsx(XIcon, { "aria-hidden": "true" }),
|
|
1200
|
+
" Checks fail: ",
|
|
1201
|
+
plural(checks.problems.length, "problem")
|
|
1202
|
+
]
|
|
1203
|
+
}), /* @__PURE__ */ jsx("ul", {
|
|
1204
|
+
className: "list-disc pl-5 font-mono text-xs break-words",
|
|
1205
|
+
children: checks.problems.map((problem, i) => /* @__PURE__ */ jsx("li", { children: problem }, i))
|
|
1206
|
+
})]
|
|
1207
|
+
})]
|
|
1208
|
+
}),
|
|
1209
|
+
/* @__PURE__ */ jsx(CardFooter, {
|
|
1210
|
+
className: "border-t text-xs text-muted-foreground",
|
|
1211
|
+
children: remote && draft.draft !== void 0 ? /* @__PURE__ */ jsx(Review, {
|
|
1212
|
+
draft,
|
|
1213
|
+
id: draft.draft
|
|
1214
|
+
}) : "Merge the branch to apply it. The live instance keeps running the old code until it restarts."
|
|
1215
|
+
})
|
|
1216
|
+
]
|
|
1217
|
+
});
|
|
1218
|
+
}
|
|
1219
|
+
/**
|
|
1220
|
+
* Where the draft goes from here, on a repository with a remote: its change's phase and Open the
|
|
1221
|
+
* review once it has one, and Send for review while it has none open and none published (disabled,
|
|
1222
|
+
* saying why, until something is committed and the checks since the last edit pass).
|
|
1223
|
+
*/
|
|
1224
|
+
function Review({ draft, id }) {
|
|
1225
|
+
const { data: change, error } = useQuery(changeQuery(id));
|
|
1226
|
+
const send = useOpenChange();
|
|
1227
|
+
if (error) return /* @__PURE__ */ jsxs(Fragment$1, { children: ["Could not read its change: ", error.message] });
|
|
1228
|
+
if (change === void 0) return null;
|
|
1229
|
+
const why = draft.files.length === 0 ? "Nothing is committed on the draft yet." : draft.checks === void 0 ? "Run the checks first: ask the agent to check the draft." : draft.checks.ok ? void 0 : "The checks fail: fix what they find first.";
|
|
1230
|
+
const button = /* @__PURE__ */ jsx(Button, {
|
|
1231
|
+
size: "xs",
|
|
1232
|
+
disabled: why !== void 0 || send.isPending,
|
|
1233
|
+
focusableWhenDisabled: true,
|
|
1234
|
+
className: "data-disabled:opacity-50",
|
|
1235
|
+
onClick: () => send.mutate(id),
|
|
1236
|
+
children: "Send for review"
|
|
1237
|
+
});
|
|
1238
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1239
|
+
className: "flex flex-wrap items-center gap-2",
|
|
1240
|
+
children: [change && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ToneBadge, {
|
|
1241
|
+
dot: true,
|
|
1242
|
+
tone: CHANGE_TONE[change.state.phase],
|
|
1243
|
+
children: phaseLabel(change.state)
|
|
1244
|
+
}), /* @__PURE__ */ jsx(ButtonLink, {
|
|
1245
|
+
variant: "outline",
|
|
1246
|
+
size: "xs",
|
|
1247
|
+
children: /* @__PURE__ */ jsx(Link, {
|
|
1248
|
+
to: "/changes/$id",
|
|
1249
|
+
params: { id },
|
|
1250
|
+
children: "Open the review"
|
|
1251
|
+
})
|
|
1252
|
+
})] }), (!change || isEnded(change.status) && change.state.phase !== "merged") && (why === void 0 ? button : /* @__PURE__ */ jsx(Tip, {
|
|
1253
|
+
tip: why,
|
|
1254
|
+
children: button
|
|
1255
|
+
}))]
|
|
1256
|
+
});
|
|
1257
|
+
}
|
|
1258
|
+
// src/components/shell/chat-parts.tsx
|
|
1259
|
+
/** Off the chrome's chunk, which every page loads: until it comes, a reply's text as it is. */
|
|
1260
|
+
var Markdown = lazy(() => import("./markdown-BExKjghi.js"));
|
|
1261
|
+
var HeldCard = lazy(() => import("./held-card-CDewk4rs.js"));
|
|
1262
|
+
/**
|
|
1263
|
+
* The agent's reply in the chat `chat`: its parts in order (thinking and steps side by side
|
|
1264
|
+
* grouped into one trace), a sign-in's card, its draft's card last, and Copy.
|
|
1265
|
+
*/
|
|
1266
|
+
function Reply({ message, live, chat }) {
|
|
1267
|
+
const blocks = [];
|
|
1268
|
+
let draft;
|
|
1269
|
+
let signIn;
|
|
1270
|
+
for (const part of message.parts) if (part.type === "data-draft") draft = part.data;
|
|
1271
|
+
else if (part.type === "data-signIn") signIn = part.data;
|
|
1272
|
+
else if (part.type === "step-start") continue;
|
|
1273
|
+
else if (part.type === "reasoning" || isToolUIPart(part) && heldRunOf(part.output) === void 0) {
|
|
1274
|
+
const last = blocks.at(-1);
|
|
1275
|
+
if (last && "trace" in last) last.trace.push(part);
|
|
1276
|
+
else blocks.push({ trace: [part] });
|
|
1277
|
+
} else blocks.push({ part });
|
|
1278
|
+
const text = textOf(message);
|
|
1279
|
+
return /* @__PURE__ */ jsx(Message, { children: /* @__PURE__ */ jsxs(MessageContent, {
|
|
1280
|
+
className: "gap-3",
|
|
1281
|
+
children: [
|
|
1282
|
+
blocks.map((block, i) => "trace" in block ? /* @__PURE__ */ jsx(ReplyTrace, {
|
|
1283
|
+
parts: block.trace,
|
|
1284
|
+
live
|
|
1285
|
+
}, i) : /* @__PURE__ */ jsx(ReplyPart, {
|
|
1286
|
+
part: block.part,
|
|
1287
|
+
live
|
|
1288
|
+
}, i)),
|
|
1289
|
+
signIn && /* @__PURE__ */ jsx(SignInCardView, {
|
|
1290
|
+
card: signIn,
|
|
1291
|
+
chat,
|
|
1292
|
+
live
|
|
1293
|
+
}),
|
|
1294
|
+
draft && /* @__PURE__ */ jsx(DraftCardView, { draft }),
|
|
1295
|
+
text && !live && /* @__PURE__ */ jsx(MessageFooter, {
|
|
1296
|
+
className: "-ml-1.5 px-0",
|
|
1297
|
+
children: /* @__PURE__ */ jsx(TipButton, {
|
|
1298
|
+
tip: "Copy",
|
|
1299
|
+
size: "icon-xs",
|
|
1300
|
+
onClick: () => void navigator.clipboard.writeText(text).then(() => toast.success("Copied"), () => toast.error("Could not copy")),
|
|
1301
|
+
children: /* @__PURE__ */ jsx(CopyIcon, { "aria-hidden": "true" })
|
|
1302
|
+
})
|
|
1303
|
+
})
|
|
1304
|
+
]
|
|
1305
|
+
}) });
|
|
1306
|
+
}
|
|
1307
|
+
function ReplyPart({ part, live }) {
|
|
1308
|
+
if (part.type === "text") {
|
|
1309
|
+
const plain = /* @__PURE__ */ jsx("p", {
|
|
1310
|
+
className: "text-reply whitespace-pre-wrap",
|
|
1311
|
+
children: part.text
|
|
1312
|
+
});
|
|
1313
|
+
return /* @__PURE__ */ jsx(CatchBoundary, {
|
|
1314
|
+
getResetKey: () => "markdown",
|
|
1315
|
+
errorComponent: () => plain,
|
|
1316
|
+
children: /* @__PURE__ */ jsx(Suspense, {
|
|
1317
|
+
fallback: plain,
|
|
1318
|
+
children: /* @__PURE__ */ jsx(Markdown, {
|
|
1319
|
+
text: part.text,
|
|
1320
|
+
live: live && part.state === "streaming"
|
|
1321
|
+
})
|
|
1322
|
+
})
|
|
1323
|
+
});
|
|
1324
|
+
}
|
|
1325
|
+
if (isToolUIPart(part)) {
|
|
1326
|
+
const runId = heldRunOf(part.output);
|
|
1327
|
+
if (runId !== void 0) return /* @__PURE__ */ jsx(CatchBoundary, {
|
|
1328
|
+
getResetKey: () => runId,
|
|
1329
|
+
errorComponent: HeldCardMissing,
|
|
1330
|
+
children: /* @__PURE__ */ jsx(Suspense, {
|
|
1331
|
+
fallback: /* @__PURE__ */ jsx(Spinner, {}),
|
|
1332
|
+
children: /* @__PURE__ */ jsx(HeldCard, { runId })
|
|
1333
|
+
})
|
|
1334
|
+
});
|
|
1335
|
+
}
|
|
1336
|
+
return null;
|
|
1337
|
+
}
|
|
1338
|
+
function HeldCardMissing() {
|
|
1339
|
+
return /* @__PURE__ */ jsx(Notice, {
|
|
1340
|
+
variant: "destructive",
|
|
1341
|
+
children: "This approval did not load. Reload the page to see it."
|
|
1342
|
+
});
|
|
1343
|
+
}
|
|
1344
|
+
/** The agent's thinking and steps as a quiet trace, a line each. */
|
|
1345
|
+
function ReplyTrace({ parts, live }) {
|
|
1346
|
+
return /* @__PURE__ */ jsx(Trace, {
|
|
1347
|
+
role: "group",
|
|
1348
|
+
"aria-label": "Steps",
|
|
1349
|
+
className: "gap-1",
|
|
1350
|
+
children: parts.map((part, i) => part.type === "reasoning" ? /* @__PURE__ */ jsx(Reasoning, {
|
|
1351
|
+
part,
|
|
1352
|
+
live
|
|
1353
|
+
}, `reasoning-${i}`) : /* @__PURE__ */ jsx(Step, {
|
|
1354
|
+
step: part,
|
|
1355
|
+
live
|
|
1356
|
+
}, `step-${part.toolCallId}`))
|
|
1357
|
+
});
|
|
1358
|
+
}
|
|
1359
|
+
/**
|
|
1360
|
+
* Thinking, open while it streams and folded once it is done, unless the person chose otherwise.
|
|
1361
|
+
* Thinking with no text (a model that keeps it to itself) shows only while it is under way.
|
|
1362
|
+
*/
|
|
1363
|
+
function Reasoning({ part, live }) {
|
|
1364
|
+
const running = live && part.state === "streaming";
|
|
1365
|
+
const [open, setOpen] = useState();
|
|
1366
|
+
const title = /* @__PURE__ */ jsxs(TraceLine, {
|
|
1367
|
+
status: running ? "running" : void 0,
|
|
1368
|
+
className: "text-xs",
|
|
1369
|
+
children: [/* @__PURE__ */ jsx(TraceIcon, { children: /* @__PURE__ */ jsx(SparkleIcon, { "aria-hidden": "true" }) }), /* @__PURE__ */ jsx(TraceTitle, { children: running ? "Thinking" : "Thought" })]
|
|
1370
|
+
});
|
|
1371
|
+
if (!part.text) return running ? title : null;
|
|
1372
|
+
return /* @__PURE__ */ jsxs(TraceCollapsible, {
|
|
1373
|
+
open: open ?? running,
|
|
1374
|
+
onOpenChange: setOpen,
|
|
1375
|
+
children: [/* @__PURE__ */ jsx(TraceCollapsibleTrigger, { children: title }), /* @__PURE__ */ jsx(TraceCollapsibleContent, {
|
|
1376
|
+
className: "text-xs whitespace-pre-wrap",
|
|
1377
|
+
children: part.text
|
|
1378
|
+
})]
|
|
1379
|
+
});
|
|
1380
|
+
}
|
|
1381
|
+
/** A step: done, under way or stopped as a line, and failed or refused with why, open beneath it. */
|
|
1382
|
+
function Step({ step, live }) {
|
|
1383
|
+
const label = stepLabel(step);
|
|
1384
|
+
const { word, status, icon, why } = stepState(step, live);
|
|
1385
|
+
const line = /* @__PURE__ */ jsxs(TraceLine, {
|
|
1386
|
+
status,
|
|
1387
|
+
className: "text-xs",
|
|
1388
|
+
children: [/* @__PURE__ */ jsx(TraceIcon, { children: icon }), /* @__PURE__ */ jsxs(TraceTitle, {
|
|
1389
|
+
title: label,
|
|
1390
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
1391
|
+
className: "sr-only",
|
|
1392
|
+
children: [word, ": "]
|
|
1393
|
+
}), label]
|
|
1394
|
+
})]
|
|
1395
|
+
});
|
|
1396
|
+
if (!why) return line;
|
|
1397
|
+
return /* @__PURE__ */ jsxs(TraceCollapsible, {
|
|
1398
|
+
defaultOpen: true,
|
|
1399
|
+
children: [/* @__PURE__ */ jsx(TraceCollapsibleTrigger, { children: line }), /* @__PURE__ */ jsx(TraceCollapsibleContent, {
|
|
1400
|
+
className: "text-xs",
|
|
1401
|
+
children: status === "error" ? /* @__PURE__ */ jsx(CodeBlock, {
|
|
1402
|
+
size: "sm",
|
|
1403
|
+
variant: "destructive",
|
|
1404
|
+
children: /* @__PURE__ */ jsx(CodeBlockContent, {
|
|
1405
|
+
wrap: true,
|
|
1406
|
+
className: "max-h-64",
|
|
1407
|
+
children: why
|
|
1408
|
+
})
|
|
1409
|
+
}) : why
|
|
1410
|
+
})]
|
|
1411
|
+
});
|
|
1412
|
+
}
|
|
1413
|
+
/**
|
|
1414
|
+
* A step's state: in a word for a screen reader (the trace's icons are hidden from one), its line's
|
|
1415
|
+
* status, its icon, and why when it failed or was refused (a coding agent's step its checkout rule
|
|
1416
|
+
* answered no, `HarnessAgent`'s built-in tool).
|
|
1417
|
+
*/
|
|
1418
|
+
function stepState(step, live) {
|
|
1419
|
+
const stopped = /* @__PURE__ */ jsx(XIcon, { "aria-hidden": "true" });
|
|
1420
|
+
if (step.state === "output-error") return {
|
|
1421
|
+
word: "Failed",
|
|
1422
|
+
status: "error",
|
|
1423
|
+
icon: stopped,
|
|
1424
|
+
why: step.errorText
|
|
1425
|
+
};
|
|
1426
|
+
if (step.approval?.approved === false) return {
|
|
1427
|
+
word: "Refused",
|
|
1428
|
+
icon: stopped,
|
|
1429
|
+
why: step.approval.reason
|
|
1430
|
+
};
|
|
1431
|
+
if (step.state === "output-available" && !step.preliminary) return {
|
|
1432
|
+
word: "Done",
|
|
1433
|
+
icon: /* @__PURE__ */ jsx(CheckIcon, { "aria-hidden": "true" })
|
|
1434
|
+
};
|
|
1435
|
+
if (!live) return {
|
|
1436
|
+
word: "Stopped",
|
|
1437
|
+
icon: stopped
|
|
1438
|
+
};
|
|
1439
|
+
return {
|
|
1440
|
+
word: "Under way",
|
|
1441
|
+
status: "running",
|
|
1442
|
+
icon: /* @__PURE__ */ jsx(Spinner, { "aria-hidden": "true" })
|
|
1443
|
+
};
|
|
1444
|
+
}
|
|
1445
|
+
/** A step in words: what the tool did, from its input; a coding agent's by its tool's name and the file it names. */
|
|
1446
|
+
function stepLabel(step) {
|
|
1447
|
+
const input = step.input ?? {};
|
|
1448
|
+
const path = typeof input.path === "string" ? input.path : "";
|
|
1449
|
+
switch (getToolName(step)) {
|
|
1450
|
+
case "read_file": return `Read ${path}`;
|
|
1451
|
+
case "list_files": return `Listed ${path === "." || !path ? "the files" : path}`;
|
|
1452
|
+
case "grep": return `Searched for ${String(input.pattern ?? "")}`;
|
|
1453
|
+
case "write_file": return `Wrote ${path}`;
|
|
1454
|
+
case "edit_file": return `Edited ${path}`;
|
|
1455
|
+
case "run_checks": {
|
|
1456
|
+
const result = step.state === "output-available" ? step.output : void 0;
|
|
1457
|
+
return result === void 0 ? "Ran the checks" : result.ok ? "Ran the checks: they pass" : "Ran the checks: they fail";
|
|
1458
|
+
}
|
|
1459
|
+
case "take_app":
|
|
1460
|
+
case "update_app": {
|
|
1461
|
+
const taken = getToolName(step) === "take_app";
|
|
1462
|
+
const what = taken ? `Took the app from ${String(input.url ?? "")}` : `Updated apps/${String(input.folder ?? "")}`;
|
|
1463
|
+
const result = step.state === "output-available" ? step.output : void 0;
|
|
1464
|
+
if (!taken && result?.merged === 0) return `apps/${String(input.folder ?? "")} is up to date`;
|
|
1465
|
+
const conflicts = result?.conflicts?.length ?? 0;
|
|
1466
|
+
return conflicts ? `${what}: ${conflicts} ${conflicts === 1 ? "conflict" : "conflicts"} to resolve` : what;
|
|
1467
|
+
}
|
|
1468
|
+
case "lookup": return `Looked up ${String(input.op ?? "")}`;
|
|
1469
|
+
default: {
|
|
1470
|
+
if (step.title) return step.title;
|
|
1471
|
+
const file = pathOf(input);
|
|
1472
|
+
return file === void 0 ? getToolName(step) : `${getToolName(step)} ${file}`;
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
/** `url` when it is an https link that parses (the vendor wrote it), else undefined. */
|
|
1477
|
+
function httpsLink(url) {
|
|
1478
|
+
try {
|
|
1479
|
+
const link = new URL(url ?? "");
|
|
1480
|
+
return link.protocol === "https:" ? link : void 0;
|
|
1481
|
+
} catch {
|
|
1482
|
+
return;
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
/**
|
|
1486
|
+
* A person's own agent's sign-in: the vendor's link and what it printed (its code among it), a
|
|
1487
|
+
* field for a code the vendor asks to have pasted back (written to its sign-in, `POST
|
|
1488
|
+
* /api/sign-in`), or the command to run once on this computer; then whether it finished. The
|
|
1489
|
+
* sign-in is the person's: the app opens no link and enters no code.
|
|
1490
|
+
*/
|
|
1491
|
+
function SignInCardView({ card, chat, live }) {
|
|
1492
|
+
const { agent, state } = card;
|
|
1493
|
+
const [code, setCode] = useState("");
|
|
1494
|
+
const [sent, setSent] = useState();
|
|
1495
|
+
const paste = async (e) => {
|
|
1496
|
+
e.preventDefault();
|
|
1497
|
+
if (!code.trim()) return;
|
|
1498
|
+
const response = await fetch("/api/sign-in", {
|
|
1499
|
+
method: "POST",
|
|
1500
|
+
headers: {
|
|
1501
|
+
"content-type": "application/json",
|
|
1502
|
+
...actorHeaders()
|
|
1503
|
+
},
|
|
1504
|
+
body: JSON.stringify({
|
|
1505
|
+
chat,
|
|
1506
|
+
code
|
|
1507
|
+
})
|
|
1508
|
+
}).catch(() => void 0);
|
|
1509
|
+
setCode("");
|
|
1510
|
+
setSent(response?.ok ? `Sent to ${agent}'s sign-in.` : `${agent}'s sign-in is not waiting for a code any more.`);
|
|
1511
|
+
};
|
|
1512
|
+
const link = httpsLink(card.url);
|
|
1513
|
+
return /* @__PURE__ */ jsxs(Card, {
|
|
1514
|
+
size: "sm",
|
|
1515
|
+
role: "region",
|
|
1516
|
+
"aria-label": `Sign in to ${agent}`,
|
|
1517
|
+
children: [/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsxs(CardHeading, { children: ["Sign in to ", agent] }) }), /* @__PURE__ */ jsx(CardContent, {
|
|
1518
|
+
className: "flex flex-col gap-2",
|
|
1519
|
+
children: state === "waiting" && !live ? /* @__PURE__ */ jsx("p", {
|
|
1520
|
+
className: "text-muted-foreground",
|
|
1521
|
+
children: "The sign-in stopped before it finished. Send your message again to start over."
|
|
1522
|
+
}) : state === "waiting" ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1523
|
+
/* @__PURE__ */ jsxs("p", {
|
|
1524
|
+
className: "text-muted-foreground",
|
|
1525
|
+
children: [
|
|
1526
|
+
"This sign-in is yours, on your own ",
|
|
1527
|
+
agent,
|
|
1528
|
+
" plan. Sanoma opens no link, enters no code and reads nothing",
|
|
1529
|
+
" ",
|
|
1530
|
+
agent,
|
|
1531
|
+
" gives back. The chat waits until you finish."
|
|
1532
|
+
]
|
|
1533
|
+
}),
|
|
1534
|
+
card.text ? /* @__PURE__ */ jsx("pre", {
|
|
1535
|
+
className: "overflow-x-auto font-mono text-xs whitespace-pre-wrap",
|
|
1536
|
+
children: card.text
|
|
1537
|
+
}) : /* @__PURE__ */ jsxs("p", {
|
|
1538
|
+
className: "flex items-center gap-2 text-muted-foreground",
|
|
1539
|
+
children: [
|
|
1540
|
+
/* @__PURE__ */ jsx(Spinner, {}),
|
|
1541
|
+
" Starting ",
|
|
1542
|
+
agent,
|
|
1543
|
+
"'s sign-in…"
|
|
1544
|
+
]
|
|
1545
|
+
}),
|
|
1546
|
+
link && /* @__PURE__ */ jsxs("a", {
|
|
1547
|
+
href: link.href,
|
|
1548
|
+
target: "_blank",
|
|
1549
|
+
rel: "noopener noreferrer",
|
|
1550
|
+
className: "underline underline-offset-4",
|
|
1551
|
+
children: [
|
|
1552
|
+
"Open ",
|
|
1553
|
+
link.host,
|
|
1554
|
+
" to sign in"
|
|
1555
|
+
]
|
|
1556
|
+
}),
|
|
1557
|
+
card.asks && /* @__PURE__ */ jsxs("form", {
|
|
1558
|
+
onSubmit: (e) => void paste(e),
|
|
1559
|
+
className: "flex gap-2",
|
|
1560
|
+
children: [/* @__PURE__ */ jsx(Input, {
|
|
1561
|
+
value: code,
|
|
1562
|
+
onChange: (e) => setCode(e.target.value),
|
|
1563
|
+
"aria-label": `The code ${agent} gave you`,
|
|
1564
|
+
placeholder: "Paste the code here",
|
|
1565
|
+
autoComplete: "off"
|
|
1566
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
1567
|
+
type: "submit",
|
|
1568
|
+
size: "sm",
|
|
1569
|
+
variant: "secondary",
|
|
1570
|
+
disabled: !code.trim(),
|
|
1571
|
+
children: "Send"
|
|
1572
|
+
})]
|
|
1573
|
+
}),
|
|
1574
|
+
sent && /* @__PURE__ */ jsx("p", {
|
|
1575
|
+
className: "text-muted-foreground",
|
|
1576
|
+
children: sent
|
|
1577
|
+
})
|
|
1578
|
+
] }) : state === "once" ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1579
|
+
/* @__PURE__ */ jsxs("p", { children: [agent, " signs in only in a terminal of its own. Run this once on this computer, then send your message again:"] }),
|
|
1580
|
+
/* @__PURE__ */ jsx("pre", {
|
|
1581
|
+
className: "overflow-x-auto font-mono text-xs whitespace-pre-wrap",
|
|
1582
|
+
children: card.command
|
|
1583
|
+
}),
|
|
1584
|
+
card.after && /* @__PURE__ */ jsxs("p", { children: [
|
|
1585
|
+
"Then type ",
|
|
1586
|
+
/* @__PURE__ */ jsx("code", { children: card.after }),
|
|
1587
|
+
" in it and sign in."
|
|
1588
|
+
] })
|
|
1589
|
+
] }) : state === "done" ? /* @__PURE__ */ jsxs("p", {
|
|
1590
|
+
className: "flex items-center gap-1.5",
|
|
1591
|
+
children: [
|
|
1592
|
+
/* @__PURE__ */ jsx(CheckIcon, { "aria-hidden": "true" }),
|
|
1593
|
+
" Signed in to ",
|
|
1594
|
+
agent,
|
|
1595
|
+
". Send your message again."
|
|
1596
|
+
]
|
|
1597
|
+
}) : /* @__PURE__ */ jsxs("p", {
|
|
1598
|
+
className: "text-destructive",
|
|
1599
|
+
children: [
|
|
1600
|
+
"The sign-in did not finish: ",
|
|
1601
|
+
card.text,
|
|
1602
|
+
". Send your message again to start over."
|
|
1603
|
+
]
|
|
1604
|
+
})
|
|
1605
|
+
})]
|
|
1606
|
+
});
|
|
1607
|
+
}
|
|
1608
|
+
/** A reply's suggested asks (`suggestionsOf`), each a button that sends it (`onAsk`). */
|
|
1609
|
+
function Suggested({ asks, onAsk }) {
|
|
1610
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
1611
|
+
"aria-label": "Suggested asks",
|
|
1612
|
+
className: "flex flex-col gap-2",
|
|
1613
|
+
children: asks.map((ask) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Button, {
|
|
1614
|
+
variant: "outline",
|
|
1615
|
+
className: "h-auto w-full justify-start py-2 text-left whitespace-normal",
|
|
1616
|
+
onClick: () => onAsk(ask),
|
|
1617
|
+
children: ask
|
|
1618
|
+
}) }, ask))
|
|
1619
|
+
});
|
|
1620
|
+
}
|
|
1621
|
+
// src/components/shell/thread.tsx
|
|
1622
|
+
/**
|
|
1623
|
+
* The thread (AI Elements' Chat): an empty chat's `start` (else what to ask), then each turn an
|
|
1624
|
+
* item of the scroller (not the agent's cue to speak first, `isIntro`), the person's the anchor, so
|
|
1625
|
+
* a new question settles near the top with the reply streaming below it; then the last reply's
|
|
1626
|
+
* suggested asks, what waits on the turn, its error, and Continue (when `canContinue`) after one
|
|
1627
|
+
* that stopped short. A suggested ask and Continue are sent with `onSend`.
|
|
1628
|
+
*/
|
|
1629
|
+
function Thread({ chat, messages, status, error, start, onSend, canContinue }) {
|
|
1630
|
+
const busy = isBusy(status);
|
|
1631
|
+
const last = messages.at(-1);
|
|
1632
|
+
const asks = !busy && last?.role === "assistant" ? suggestionsOf(last) : [];
|
|
1633
|
+
return /* @__PURE__ */ jsx(MessageScrollerProvider, {
|
|
1634
|
+
autoScroll: true,
|
|
1635
|
+
defaultScrollPosition: "last-anchor",
|
|
1636
|
+
children: /* @__PURE__ */ jsxs(MessageScroller$1, {
|
|
1637
|
+
className: "h-auto min-h-0 flex-1",
|
|
1638
|
+
children: [/* @__PURE__ */ jsx(MessageScrollerViewport, {
|
|
1639
|
+
"aria-label": "Conversation",
|
|
1640
|
+
children: /* @__PURE__ */ jsxs(MessageScrollerContent, {
|
|
1641
|
+
className: "gap-4 p-4",
|
|
1642
|
+
children: [
|
|
1643
|
+
messages.length === 0 && /* @__PURE__ */ jsx(MessageScrollerItem, {
|
|
1644
|
+
className: "flex flex-1 flex-col",
|
|
1645
|
+
children: start ?? /* @__PURE__ */ jsx(EmptyChat, {})
|
|
1646
|
+
}),
|
|
1647
|
+
messages.map((message, i) => isIntro(message) ? null : /* @__PURE__ */ jsx(Turn, {
|
|
1648
|
+
message,
|
|
1649
|
+
live: busy && i === messages.length - 1,
|
|
1650
|
+
chat
|
|
1651
|
+
}, message.id)),
|
|
1652
|
+
asks.length > 0 && /* @__PURE__ */ jsx(MessageScrollerItem, { children: /* @__PURE__ */ jsx(Suggested, {
|
|
1653
|
+
asks,
|
|
1654
|
+
onAsk: onSend
|
|
1655
|
+
}) }),
|
|
1656
|
+
status === "submitted" && /* @__PURE__ */ jsx(MessageScrollerItem, { children: /* @__PURE__ */ jsx(Trace, { children: /* @__PURE__ */ jsx(TraceLine, {
|
|
1657
|
+
status: "running",
|
|
1658
|
+
className: "text-xs",
|
|
1659
|
+
children: /* @__PURE__ */ jsx(TraceTitle, { children: "Waiting for the agent" })
|
|
1660
|
+
}) }) }),
|
|
1661
|
+
error && /* @__PURE__ */ jsx(MessageScrollerItem, { children: /* @__PURE__ */ jsx(TurnError, { message: error.message }) }),
|
|
1662
|
+
!busy && !error && canContinue && stoppedShort(last) && /* @__PURE__ */ jsx(MessageScrollerItem, { children: /* @__PURE__ */ jsxs(Marker, { children: [/* @__PURE__ */ jsx(MarkerContent, { children: "The last turn stopped before it finished." }), /* @__PURE__ */ jsx(Button, {
|
|
1663
|
+
variant: "secondary",
|
|
1664
|
+
size: "sm",
|
|
1665
|
+
onClick: () => onSend("continue"),
|
|
1666
|
+
children: "Continue"
|
|
1667
|
+
})] }) })
|
|
1668
|
+
]
|
|
1669
|
+
})
|
|
1670
|
+
}), /* @__PURE__ */ jsx(MessageScrollerButton, {})]
|
|
1671
|
+
})
|
|
1672
|
+
});
|
|
1673
|
+
}
|
|
1674
|
+
/**
|
|
1675
|
+
* A turn, an item of the scroller: the person's in a bubble, and the anchor; else the agent's reply.
|
|
1676
|
+
* Memoized: a streamed chunk redraws only the turn it belongs to.
|
|
1677
|
+
*/
|
|
1678
|
+
var Turn = memo(function Turn({ message, live, chat }) {
|
|
1679
|
+
return /* @__PURE__ */ jsx(MessageScrollerItem, {
|
|
1680
|
+
messageId: message.id,
|
|
1681
|
+
scrollAnchor: message.role === "user",
|
|
1682
|
+
children: message.role === "user" ? /* @__PURE__ */ jsx(Message, {
|
|
1683
|
+
align: "end",
|
|
1684
|
+
children: /* @__PURE__ */ jsx(MessageContent, { children: /* @__PURE__ */ jsx(Bubble, {
|
|
1685
|
+
align: "end",
|
|
1686
|
+
variant: "outline",
|
|
1687
|
+
children: /* @__PURE__ */ jsx(BubbleContent, {
|
|
1688
|
+
className: "whitespace-pre-wrap",
|
|
1689
|
+
children: textOf(message, "\n")
|
|
1690
|
+
})
|
|
1691
|
+
}) })
|
|
1692
|
+
}) : /* @__PURE__ */ jsx(Reply, {
|
|
1693
|
+
message,
|
|
1694
|
+
live,
|
|
1695
|
+
chat
|
|
1696
|
+
})
|
|
1697
|
+
});
|
|
1698
|
+
});
|
|
1699
|
+
/** A turn that stopped before it finished (a restart, say): no reply to the last message, or a step or text still under way. */
|
|
1700
|
+
function stoppedShort(last) {
|
|
1701
|
+
if (!last) return false;
|
|
1702
|
+
return last.role === "user" || last.parts.some(unfinished);
|
|
1703
|
+
}
|
|
1704
|
+
/** A turn's error as text: the server's own message when it sent one, and the connector page where a missing key is set. */
|
|
1705
|
+
function TurnError({ message }) {
|
|
1706
|
+
let said = message;
|
|
1707
|
+
try {
|
|
1708
|
+
said = JSON.parse(message).error ?? message;
|
|
1709
|
+
} catch {}
|
|
1710
|
+
const { text, vendor } = errorParts(said);
|
|
1711
|
+
return /* @__PURE__ */ jsxs(Notice, {
|
|
1712
|
+
variant: "destructive",
|
|
1713
|
+
children: [text, vendor && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1714
|
+
" ",
|
|
1715
|
+
/* @__PURE__ */ jsx(ConnectorPageLink, {
|
|
1716
|
+
vendor,
|
|
1717
|
+
children: "Set it on its connector page"
|
|
1718
|
+
}),
|
|
1719
|
+
"."
|
|
1720
|
+
] })]
|
|
1721
|
+
});
|
|
1722
|
+
}
|
|
1723
|
+
/** A link to a connector's page, where its credentials are set. */
|
|
1724
|
+
var ConnectorPageLink = ({ vendor, children }) => /* @__PURE__ */ jsx(Link, {
|
|
1725
|
+
to: "/connectors/$vendor",
|
|
1726
|
+
params: { vendor },
|
|
1727
|
+
className: "underline underline-offset-4",
|
|
1728
|
+
children
|
|
1729
|
+
});
|
|
1730
|
+
function EmptyChat() {
|
|
1731
|
+
return /* @__PURE__ */ jsx(Empty, {
|
|
1732
|
+
className: "p-6",
|
|
1733
|
+
children: /* @__PURE__ */ jsxs(EmptyHeader, { children: [
|
|
1734
|
+
/* @__PURE__ */ jsx(EmptyMedia, {
|
|
1735
|
+
variant: "icon",
|
|
1736
|
+
children: /* @__PURE__ */ jsx(SparkleIcon, { "aria-hidden": "true" })
|
|
1737
|
+
}),
|
|
1738
|
+
/* @__PURE__ */ jsx(EmptyTitle, {
|
|
1739
|
+
className: "font-display text-2xl font-normal",
|
|
1740
|
+
children: "What should change?"
|
|
1741
|
+
}),
|
|
1742
|
+
/* @__PURE__ */ jsx(EmptyDescription, { children: "Ask the agent: it drafts the change on a branch of its own and checks it. You merge it." })
|
|
1743
|
+
] })
|
|
1744
|
+
});
|
|
1745
|
+
}
|
|
1746
|
+
// src/components/shell/chat.tsx
|
|
1747
|
+
/**
|
|
1748
|
+
* The chat column (`#chat`, which the bar's Chat controls): your latest chat (or the one you
|
|
1749
|
+
* pick, or a new one, or the new one a page's `prompt` opens with its text in the composer), and
|
|
1750
|
+
* at its foot the composer. In the page's flow from `lg` up; between `md` and `lg`, over the page
|
|
1751
|
+
* beside the bar (not while `besidePageOnly`, until Chat opens it there); not on a phone. A new
|
|
1752
|
+
* chat opens on `engine`, the person's choice.
|
|
1753
|
+
*/
|
|
1754
|
+
function ChatColumn({ besidePageOnly = false, prompt, engine }) {
|
|
1755
|
+
const { actor } = useActor();
|
|
1756
|
+
const { data: chats = [], isSuccess } = useQuery({
|
|
1757
|
+
...chatsQuery(),
|
|
1758
|
+
enabled: !!actor
|
|
1759
|
+
});
|
|
1760
|
+
const [picked, setPicked] = useState(prompt?.id);
|
|
1761
|
+
const [fresh] = useState(generateId);
|
|
1762
|
+
const id = picked ?? chats[0]?.id ?? fresh;
|
|
1763
|
+
const chat = chats.find((c) => c.id === id);
|
|
1764
|
+
const { data: engines = [] } = useQuery({
|
|
1765
|
+
...configQuery(),
|
|
1766
|
+
select: (config) => enginesOf(config.agents)
|
|
1767
|
+
});
|
|
1768
|
+
const optionOf = (name) => engines.find((e) => e.name === name);
|
|
1769
|
+
const opened = chat && optionOf(chat.engine);
|
|
1770
|
+
return /* @__PURE__ */ jsxs("aside", {
|
|
1771
|
+
id: "chat",
|
|
1772
|
+
"aria-label": "Chat",
|
|
1773
|
+
className: cn("hidden h-svh w-(--chat-width) shrink-0 flex-col border-r bg-sidebar text-sidebar-foreground md:fixed md:inset-y-0 md:left-(--bar-width) md:z-20 md:shadow-lg lg:sticky lg:top-0 lg:flex lg:self-start lg:shadow-none", !besidePageOnly && "md:flex"),
|
|
1774
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
1775
|
+
className: "flex items-center justify-between gap-2 px-3 pt-3",
|
|
1776
|
+
children: [
|
|
1777
|
+
/* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsxs(DropdownMenuTrigger, {
|
|
1778
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
1779
|
+
variant: "ghost",
|
|
1780
|
+
size: "sm",
|
|
1781
|
+
className: "min-w-0",
|
|
1782
|
+
disabled: !chats.length
|
|
1783
|
+
}),
|
|
1784
|
+
children: [/* @__PURE__ */ jsx(ChatCircleIcon, {
|
|
1785
|
+
"aria-hidden": "true",
|
|
1786
|
+
"data-icon": "inline-start"
|
|
1787
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1788
|
+
className: "truncate",
|
|
1789
|
+
children: chat?.title ?? "New chat"
|
|
1790
|
+
})]
|
|
1791
|
+
}), /* @__PURE__ */ jsx(DropdownMenuContent, {
|
|
1792
|
+
align: "start",
|
|
1793
|
+
className: "min-w-64",
|
|
1794
|
+
children: /* @__PURE__ */ jsxs(DropdownMenuGroup, { children: [/* @__PURE__ */ jsx(DropdownMenuLabel, { children: "Your chats" }), chats.map((c) => {
|
|
1795
|
+
const on = optionOf(c.engine);
|
|
1796
|
+
return /* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
1797
|
+
onClick: () => setPicked(c.id),
|
|
1798
|
+
children: [on && /* @__PURE__ */ jsx(EngineMark, { engine: on }), /* @__PURE__ */ jsx("span", {
|
|
1799
|
+
className: "truncate",
|
|
1800
|
+
children: c.title
|
|
1801
|
+
})]
|
|
1802
|
+
}, c.id);
|
|
1803
|
+
})] })
|
|
1804
|
+
})] }),
|
|
1805
|
+
chat && /* @__PURE__ */ jsxs("span", {
|
|
1806
|
+
className: "flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground",
|
|
1807
|
+
title: "The engine answering this chat",
|
|
1808
|
+
children: [opened && /* @__PURE__ */ jsx(EngineMark, { engine: opened }), opened?.label ?? chat.engine]
|
|
1809
|
+
}),
|
|
1810
|
+
/* @__PURE__ */ jsxs(Button, {
|
|
1811
|
+
variant: "ghost",
|
|
1812
|
+
size: "sm",
|
|
1813
|
+
className: "shrink-0",
|
|
1814
|
+
onClick: () => setPicked(generateId()),
|
|
1815
|
+
children: [/* @__PURE__ */ jsx(PlusIcon, {
|
|
1816
|
+
"aria-hidden": "true",
|
|
1817
|
+
"data-icon": "inline-start"
|
|
1818
|
+
}), "New chat"]
|
|
1819
|
+
})
|
|
1820
|
+
]
|
|
1821
|
+
}), /* @__PURE__ */ jsx(ChatPane, {
|
|
1822
|
+
id,
|
|
1823
|
+
known: chat !== void 0,
|
|
1824
|
+
opening: id === prompt?.id ? prompt : void 0,
|
|
1825
|
+
first: isSuccess && !chats.length,
|
|
1826
|
+
engine,
|
|
1827
|
+
onSend: () => setPicked(id)
|
|
1828
|
+
}, id)]
|
|
1829
|
+
});
|
|
1830
|
+
}
|
|
1831
|
+
/**
|
|
1832
|
+
* A chat: its transcript as stored when it is one you have had (as it was when opened, so the
|
|
1833
|
+
* first message of a new one does not read it back), then the conversation over it; a new one
|
|
1834
|
+
* opens with the prompt that opened it (`opening`).
|
|
1835
|
+
*/
|
|
1836
|
+
function ChatPane({ id, known, ...opened }) {
|
|
1837
|
+
const [stored] = useState(known);
|
|
1838
|
+
const { data, error } = useQuery({
|
|
1839
|
+
...chatQuery(id),
|
|
1840
|
+
enabled: stored
|
|
1841
|
+
});
|
|
1842
|
+
if (!stored) return /* @__PURE__ */ jsx(Conversation, {
|
|
1843
|
+
id,
|
|
1844
|
+
initial: [],
|
|
1845
|
+
...opened
|
|
1846
|
+
});
|
|
1847
|
+
if (error) return /* @__PURE__ */ jsxs("p", {
|
|
1848
|
+
className: "p-4 text-destructive",
|
|
1849
|
+
children: ["Could not read the chat: ", error.message]
|
|
1850
|
+
});
|
|
1851
|
+
if (data === void 0) return /* @__PURE__ */ jsx("div", {
|
|
1852
|
+
className: "flex flex-1 items-center justify-center",
|
|
1853
|
+
children: /* @__PURE__ */ jsx(Spinner, {})
|
|
1854
|
+
});
|
|
1855
|
+
return /* @__PURE__ */ jsx(Conversation, {
|
|
1856
|
+
id,
|
|
1857
|
+
initial: data?.messages ?? [],
|
|
1858
|
+
openedOn: data?.chat.engine,
|
|
1859
|
+
engine: opened.engine,
|
|
1860
|
+
onSend: opened.onSend
|
|
1861
|
+
});
|
|
1862
|
+
}
|
|
1863
|
+
/**
|
|
1864
|
+
* The conversation on `useChat`: its `Thread`, and the composer (holding the opening prompt's
|
|
1865
|
+
* text), which says "Connect a model" (and Continue is not offered) while the chat's engine (its
|
|
1866
|
+
* own, `openedOn`, else the one chosen for a new chat) needs the model connector and it has no
|
|
1867
|
+
* key. A new chat's thread starts with the agents to connect while so (or when Agent… opened it);
|
|
1868
|
+
* and the agent speaks first in the person's first chat once its engine is connected, when a card
|
|
1869
|
+
* chose a plan of their own, and once the sign-in it asked for in a chat they have not written in
|
|
1870
|
+
* is done.
|
|
1871
|
+
*/
|
|
1872
|
+
function Conversation({ id, initial, opening, first = false, openedOn, engine: choice, onSend }) {
|
|
1873
|
+
const queryClient = useQueryClient();
|
|
1874
|
+
const transport = useMemo(() => chatTransport("/api/chat", actorHeaders), []);
|
|
1875
|
+
const { messages, sendMessage, status, error } = useChat({
|
|
1876
|
+
id,
|
|
1877
|
+
messages: initial,
|
|
1878
|
+
transport,
|
|
1879
|
+
throttle: 50,
|
|
1880
|
+
onFinish: () => void queryClient.invalidateQueries({
|
|
1881
|
+
queryKey: CHATS_KEY,
|
|
1882
|
+
exact: true
|
|
1883
|
+
}),
|
|
1884
|
+
onError: () => void queryClient.invalidateQueries({ queryKey: chatModelQuery().queryKey })
|
|
1885
|
+
});
|
|
1886
|
+
const busy = isBusy(status);
|
|
1887
|
+
const page = useCrumbs().at(-1)?.label;
|
|
1888
|
+
const { data: options = [] } = useQuery({
|
|
1889
|
+
...configQuery(),
|
|
1890
|
+
select: enginesHere
|
|
1891
|
+
});
|
|
1892
|
+
const [chosen, setChosen] = useState();
|
|
1893
|
+
const engine = openedOn ?? chosen ?? (options.some((option) => option.name === choice.value) ? choice.value : "loop");
|
|
1894
|
+
const choose = (name) => {
|
|
1895
|
+
setChosen(name);
|
|
1896
|
+
choice.set(name);
|
|
1897
|
+
};
|
|
1898
|
+
const fresh = messages.length === 0;
|
|
1899
|
+
const { data: model } = useQuery(chatModelQuery());
|
|
1900
|
+
const noModel = model?.ready === false && onModelConnector(engine);
|
|
1901
|
+
const send = (text) => {
|
|
1902
|
+
onSend();
|
|
1903
|
+
sendMessage({ text }, { body: { engine } });
|
|
1904
|
+
};
|
|
1905
|
+
/** The agent speaks first, on `on`: the message is its cue, which the server writes and the chat never shows. */
|
|
1906
|
+
const speak = (on) => {
|
|
1907
|
+
onSend();
|
|
1908
|
+
sendMessage({
|
|
1909
|
+
text: "",
|
|
1910
|
+
metadata: { intro: true }
|
|
1911
|
+
}, { body: {
|
|
1912
|
+
engine: on,
|
|
1913
|
+
start: true
|
|
1914
|
+
} });
|
|
1915
|
+
};
|
|
1916
|
+
const cards = fresh && !busy && !openedOn && (noModel || opening?.choose === true);
|
|
1917
|
+
const last = messages.at(-1);
|
|
1918
|
+
const lastId = last?.id ?? "";
|
|
1919
|
+
const signedIn = !written(messages) && last?.parts.some((part) => part.type === "data-signIn" && part.data.state === "done");
|
|
1920
|
+
const greet = first && fresh && !openedOn && !opening && model !== void 0 && !cards;
|
|
1921
|
+
const cue = !busy && !error && (greet || signedIn);
|
|
1922
|
+
const acted = useRef(void 0);
|
|
1923
|
+
const act = useEffectEvent(() => {
|
|
1924
|
+
if (greet && !document.getElementById("chat")?.checkVisibility()) return;
|
|
1925
|
+
acted.current = lastId;
|
|
1926
|
+
speak(engine);
|
|
1927
|
+
});
|
|
1928
|
+
useEffect(() => {
|
|
1929
|
+
if (cue && acted.current !== lastId) act();
|
|
1930
|
+
}, [cue, lastId]);
|
|
1931
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Thread, {
|
|
1932
|
+
chat: id,
|
|
1933
|
+
messages,
|
|
1934
|
+
status,
|
|
1935
|
+
error,
|
|
1936
|
+
start: cards ? /* @__PURE__ */ jsx(ConnectAgent, {
|
|
1937
|
+
vendor: model?.vendor,
|
|
1938
|
+
onChoose: (name) => {
|
|
1939
|
+
choose(name);
|
|
1940
|
+
if (engineOf(name).plan !== "own") return;
|
|
1941
|
+
acted.current = lastId;
|
|
1942
|
+
speak(name);
|
|
1943
|
+
}
|
|
1944
|
+
}) : void 0,
|
|
1945
|
+
onSend: send,
|
|
1946
|
+
canContinue: !noModel
|
|
1947
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
1948
|
+
className: "p-3",
|
|
1949
|
+
children: /* @__PURE__ */ jsx(Composer, {
|
|
1950
|
+
page,
|
|
1951
|
+
busy,
|
|
1952
|
+
onSend: send,
|
|
1953
|
+
draft: opening?.text,
|
|
1954
|
+
engine: fresh && !openedOn ? {
|
|
1955
|
+
value: engine,
|
|
1956
|
+
set: choose,
|
|
1957
|
+
options
|
|
1958
|
+
} : void 0,
|
|
1959
|
+
note: noModel ? cards ? /* @__PURE__ */ jsx("p", {
|
|
1960
|
+
className: "text-muted-foreground",
|
|
1961
|
+
children: "Connect your agent above to start."
|
|
1962
|
+
}) : /* @__PURE__ */ jsx(ConnectModel, { vendor: model?.vendor }) : void 0
|
|
1963
|
+
})
|
|
1964
|
+
})] });
|
|
1965
|
+
}
|
|
1966
|
+
/** The composer's note while the chat has no model: where to set its connector's key, or to add one (its sheet on the Connectors page). */
|
|
1967
|
+
function ConnectModel({ vendor }) {
|
|
1968
|
+
const { data: title } = useQuery({
|
|
1969
|
+
...configQuery(),
|
|
1970
|
+
select: (config) => vendor && config.vendors[vendor]?.title
|
|
1971
|
+
});
|
|
1972
|
+
return /* @__PURE__ */ jsxs("p", {
|
|
1973
|
+
className: "text-muted-foreground",
|
|
1974
|
+
children: [
|
|
1975
|
+
"Connect a model to start:",
|
|
1976
|
+
" ",
|
|
1977
|
+
vendor ? /* @__PURE__ */ jsxs(ConnectorPageLink, {
|
|
1978
|
+
vendor,
|
|
1979
|
+
children: [
|
|
1980
|
+
"set its key on the ",
|
|
1981
|
+
title ?? vendor,
|
|
1982
|
+
" connector page"
|
|
1983
|
+
]
|
|
1984
|
+
}) : /* @__PURE__ */ jsx(Link, {
|
|
1985
|
+
to: "/connectors",
|
|
1986
|
+
search: { add: MODEL_CONNECTOR },
|
|
1987
|
+
className: "underline underline-offset-4",
|
|
1988
|
+
children: "add the Anthropic connector"
|
|
1989
|
+
}),
|
|
1990
|
+
"."
|
|
1991
|
+
]
|
|
1992
|
+
});
|
|
1993
|
+
}
|
|
1994
|
+
// src/components/app-chrome.tsx
|
|
1995
|
+
var app_chrome_exports = /* @__PURE__ */ __exportAll({ default: () => Root });
|
|
1996
|
+
/** Asked once per browser, so loaded only when no name is stored. */
|
|
1997
|
+
var WhoAreYou = lazy(() => import("./who-are-you-DW5qmIzp.js"));
|
|
1998
|
+
/**
|
|
1999
|
+
* The chrome: the bar, the chat column beside it (while open), then the page on the paper, and
|
|
2000
|
+
* the dialogs. A page opens the chat with a prompt through `useChatPrompt`, which the chrome
|
|
2001
|
+
* provides. The bar and the column stay as the page scrolls; on a phone the bar is a sheet
|
|
2002
|
+
* behind a menu button, and there is no column.
|
|
2003
|
+
*/
|
|
2004
|
+
function Root() {
|
|
2005
|
+
const { data: server } = useSuspenseQuery(actorQuery());
|
|
2006
|
+
const actor = useActorState(server);
|
|
2007
|
+
const queryClient = useQueryClient();
|
|
2008
|
+
const said = server.actor?.id ?? null;
|
|
2009
|
+
useEffect(() => {
|
|
2010
|
+
if (!actor.fromServer && actor.actor && actor.actor !== said) queryClient.invalidateQueries({ queryKey: actorQuery().queryKey });
|
|
2011
|
+
}, [
|
|
2012
|
+
actor.fromServer,
|
|
2013
|
+
actor.actor,
|
|
2014
|
+
said,
|
|
2015
|
+
queryClient
|
|
2016
|
+
]);
|
|
2017
|
+
const chatPref = useLoaderData({
|
|
2018
|
+
from: "__root__",
|
|
2019
|
+
select: (data) => data?.chat
|
|
2020
|
+
});
|
|
2021
|
+
const compact = useLoaderData({
|
|
2022
|
+
from: "__root__",
|
|
2023
|
+
select: (data) => data?.compact ?? false
|
|
2024
|
+
});
|
|
2025
|
+
const enginePref = useLoaderData({
|
|
2026
|
+
from: "__root__",
|
|
2027
|
+
select: (data) => data?.engine
|
|
2028
|
+
});
|
|
2029
|
+
const [engine, setEngine] = useState(enginePref);
|
|
2030
|
+
const chooseEngine = (name) => {
|
|
2031
|
+
rememberPref(ENGINE_COOKIE, name);
|
|
2032
|
+
setEngine(name);
|
|
2033
|
+
};
|
|
2034
|
+
const [chat, setChat] = useState(chatPref !== "closed");
|
|
2035
|
+
const [unset, setUnset] = useState(chatPref === void 0);
|
|
2036
|
+
useEffect(() => {
|
|
2037
|
+
if (!unset) return;
|
|
2038
|
+
const beside = matchMedia(BESIDE_PAGE);
|
|
2039
|
+
const follow = () => setChat(beside.matches);
|
|
2040
|
+
follow();
|
|
2041
|
+
beside.addEventListener("change", follow);
|
|
2042
|
+
return () => beside.removeEventListener("change", follow);
|
|
2043
|
+
}, [unset]);
|
|
2044
|
+
const [prompt, setPrompt] = useState();
|
|
2045
|
+
const toggleChat = () => {
|
|
2046
|
+
rememberPref(CHAT_COOKIE, chat ? "closed" : "open");
|
|
2047
|
+
if (chat) setPrompt(void 0);
|
|
2048
|
+
setChat(!chat);
|
|
2049
|
+
setUnset(false);
|
|
2050
|
+
};
|
|
2051
|
+
const chatPrompt = useMemo(() => {
|
|
2052
|
+
const openOn = (opening) => {
|
|
2053
|
+
rememberPref(CHAT_COOKIE, "open");
|
|
2054
|
+
setChat(true);
|
|
2055
|
+
setUnset(false);
|
|
2056
|
+
setPrompt({
|
|
2057
|
+
id: generateId(),
|
|
2058
|
+
...opening
|
|
2059
|
+
});
|
|
2060
|
+
};
|
|
2061
|
+
return {
|
|
2062
|
+
open: (text) => openOn({ text }),
|
|
2063
|
+
chooseAgent: () => openOn({
|
|
2064
|
+
text: "",
|
|
2065
|
+
choose: true
|
|
2066
|
+
})
|
|
2067
|
+
};
|
|
2068
|
+
}, []);
|
|
2069
|
+
const wide = useMatches({ select: (matches) => matches.some((match) => match.staticData.wide) });
|
|
2070
|
+
return /* @__PURE__ */ jsx(ActorContext, {
|
|
2071
|
+
value: actor,
|
|
2072
|
+
children: /* @__PURE__ */ jsx(ChatPromptContext, {
|
|
2073
|
+
value: chatPrompt,
|
|
2074
|
+
children: /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(DensityProvider, {
|
|
2075
|
+
defaultCompact: compact,
|
|
2076
|
+
children: [
|
|
2077
|
+
/* @__PURE__ */ jsxs("div", {
|
|
2078
|
+
className: "flex min-h-svh",
|
|
2079
|
+
children: [
|
|
2080
|
+
/* @__PURE__ */ jsx(Bar, {
|
|
2081
|
+
chat: {
|
|
2082
|
+
open: chat,
|
|
2083
|
+
toggle: toggleChat
|
|
2084
|
+
},
|
|
2085
|
+
className: "sticky top-0 hidden h-svh self-start md:flex"
|
|
2086
|
+
}),
|
|
2087
|
+
chat && /* @__PURE__ */ jsx(ChatColumn, {
|
|
2088
|
+
besidePageOnly: unset,
|
|
2089
|
+
prompt,
|
|
2090
|
+
engine: {
|
|
2091
|
+
value: engine,
|
|
2092
|
+
set: chooseEngine
|
|
2093
|
+
}
|
|
2094
|
+
}, prompt?.id),
|
|
2095
|
+
/* @__PURE__ */ jsxs("main", {
|
|
2096
|
+
"data-slot": "page",
|
|
2097
|
+
className: "flex min-w-0 flex-1 flex-col",
|
|
2098
|
+
children: [/* @__PURE__ */ jsx(PhoneBar, {}), /* @__PURE__ */ jsx("div", {
|
|
2099
|
+
"data-wide": wide || void 0,
|
|
2100
|
+
className: "mx-auto flex w-full max-w-6xl flex-col gap-(--gap-region) p-4 data-wide:max-w-none sm:px-6",
|
|
2101
|
+
children: /* @__PURE__ */ jsx(Outlet, {})
|
|
2102
|
+
})]
|
|
2103
|
+
})
|
|
2104
|
+
]
|
|
2105
|
+
}),
|
|
2106
|
+
!actor.fromServer && actor.actor === null && /* @__PURE__ */ jsx(Suspense, {
|
|
2107
|
+
fallback: null,
|
|
2108
|
+
children: /* @__PURE__ */ jsx(WhoAreYou, {})
|
|
2109
|
+
}),
|
|
2110
|
+
/* @__PURE__ */ jsx(Toaster$1, {})
|
|
2111
|
+
]
|
|
2112
|
+
}) })
|
|
2113
|
+
})
|
|
2114
|
+
});
|
|
2115
|
+
}
|
|
2116
|
+
export { CodeBlockCopyButton as a, AvatarFallback as c, Root as default, CodeBlockContent as i, CodeBlock as n, CodeBlockLine as o, CodeBlockActions as r, Avatar$1 as s, app_chrome_exports as t };
|