@openhands/agent-canvas 1.5.0 → 1.5.1
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 +1 -1
- package/README.windows.md +2 -2
- package/build/assets/{acp-providers-BQwoUBpe.js → acp-providers-DerAmTyY.js} +1 -1
- package/build/assets/{active-backend-context-BCXRv5pm.js → active-backend-context-B8rMv0X9.js} +1 -1
- package/build/assets/{add-backend-modal-BKHzq5no.js → add-backend-modal-CxC7BNEc.js} +1 -1
- package/build/assets/{agent-profiles-settings-CEp5CIz8.js → agent-profiles-settings-BJb8YXR1.js} +1 -1
- package/build/assets/{agent-server-compatibility-D6DSanlx.js → agent-server-compatibility-BWN-EIQn.js} +1 -1
- package/build/assets/{agent-server-conversation-service.api-cylugfDz.js → agent-server-conversation-service.api-DSPIkMwJ.js} +4 -4
- package/build/assets/{agent-settings-C-tann3x.js → agent-settings-CgCnqaAA.js} +1 -1
- package/build/assets/agent-settings-DDkSavD7.js +1 -0
- package/build/assets/{alert-banner-Dd4woGbm.js → alert-banner-Dh51WURQ.js} +1 -1
- package/build/assets/{api-key-entry-screen-Bll_CkuQ.js → api-key-entry-screen-iZc7n8AI.js} +1 -1
- package/build/assets/app-settings-B5zyipxJ.js +1 -0
- package/build/assets/{automation-detail-Z9dN2f5l.js → automation-detail-CZsu2CoM.js} +1 -1
- package/build/assets/{automation-export-D5uL0Tf8.js → automation-export-BwRX6H32.js} +1 -1
- package/build/assets/{automations-list-BMOWcqzZ.js → automations-list-lHAVzMoA.js} +1 -1
- package/build/assets/{back-nav-button-ZUDTMOTB.js → back-nav-button-DVknCcSP.js} +1 -1
- package/build/assets/backend-form-modal-RGcu909r.js +1 -0
- package/build/assets/{backend-synced-settings-badge-Db_REKVw.js → backend-synced-settings-badge-BSfN0AZA.js} +1 -1
- package/build/assets/{base-modal-Cb0C6m0Q.js → base-modal-CIF_785P.js} +1 -1
- package/build/assets/{brand-button-2Tp3aXk1.js → brand-button-B1izLAdR.js} +1 -1
- package/build/assets/{browser-QYLVr1kS.js → browser-DKaeq_sT.js} +2 -2
- package/build/assets/browser-store-BI6uklCG.js +1 -0
- package/build/assets/{browser-tab-BTTP1OE2.js → browser-tab-qb_ftCxW.js} +1 -1
- package/build/assets/{circle-plus-check-toggle-QQJKUnF6.js → circle-plus-check-toggle-DoFIjVE0.js} +1 -1
- package/build/assets/client-source-BZK8vRs2.js +1 -0
- package/build/assets/cloud-funnel-analytics-Zcv57hfT.js +1 -0
- package/build/assets/{color-themes-bVMmJJG6.js → color-themes-CHizm1xF.js} +1 -1
- package/build/assets/{combobox-caret-A5jMVHgE.js → combobox-caret-CxZpqoSR.js} +1 -1
- package/build/assets/{command-menu-BMVEme4H.js → command-menu-oTvKDU3Y.js} +1 -1
- package/build/assets/{command-store-jrWX_CcW.js → command-store-D8J5LMW1.js} +1 -1
- package/build/assets/{condenser-settings-CIa6eyB4.js → condenser-settings-BGlWn93P.js} +1 -1
- package/build/assets/{confirmation-modal-4n_944zq.js → confirmation-modal-DGBWM2Ls.js} +1 -1
- package/build/assets/{context-menu-list-item-DvfFic5I.js → context-menu-list-item-6psNyl7X.js} +1 -1
- package/build/assets/{conversation-D4o4dG2t.js → conversation-BoCYx8n2.js} +3 -3
- package/build/assets/conversation-DgHqMjnY.js +1 -0
- package/build/assets/conversation-panel-78Rxh_-I.js +1 -0
- package/build/assets/{conversation-service.api-0JG_fF9d.js → conversation-service.api-_f9GlIEi.js} +1 -1
- package/build/assets/conversation-state-store-B2Bp32XI.js +1 -0
- package/build/assets/{conversation-store-BCSpLuEf.js → conversation-store-LptbOvKa.js} +1 -1
- package/build/assets/{copy-to-clipboard-button-Dp4Q_hXi.js → copy-to-clipboard-button-CFzH_NOX.js} +1 -1
- package/build/assets/{device-verify-CM086oKs.js → device-verify-WBSjJBLH.js} +1 -1
- package/build/assets/{dropdown-classes-DZq0BQjb.js → dropdown-classes-D3wMJlXT.js} +1 -1
- package/build/assets/{ellipsis-button-TPJdyxnK.js → ellipsis-button-CbNnHlIq.js} +1 -1
- package/build/assets/{entry.client-DypYHsYm.js → entry.client-DNlPGxsu.js} +2 -2
- package/build/assets/{enum-filter-dropdown-CW_mBg0e.js → enum-filter-dropdown-JLYv1t8L.js} +1 -1
- package/build/assets/{environment-switch-overlay-6laJch-9.js → environment-switch-overlay-B1PFO8P8.js} +1 -1
- package/build/assets/{extensions-hub-BJFbFfKS.js → extensions-hub-CCbLA7IM.js} +1 -1
- package/build/assets/{extensions-navigation-DqSl7CJw.js → extensions-navigation-CPNjMNvR.js} +1 -1
- package/build/assets/{files-tab-store-tfCav6bB.js → files-tab-store-DJsPxYdg.js} +1 -1
- package/build/assets/{files-tab-c316dKAq.js → files-tab-y4K7EXBO.js} +1 -1
- package/build/assets/{git-provider-icon-DUb2pEos.js → git-provider-icon-ITvsH4Ko.js} +1 -1
- package/build/assets/{home-D7ds4Jyw.js → home-BwbeOWwU.js} +1 -1
- package/build/assets/home-DKPGQ5P3.js +1 -0
- package/build/assets/index-home-Bko2Itv5.js +1 -0
- package/build/assets/{install-server-modal-CvHvzZj3.js → install-server-modal-Qk1gwyI8.js} +1 -1
- package/build/assets/{launch-A47TK2Me.js → launch-CAGavYl-.js} +1 -1
- package/build/assets/lesson-plan-DMCPdtrf.js +4 -0
- package/build/assets/{llm-not-configured-banner-B7DR8SPs.js → llm-not-configured-banner-C1ktyb3C.js} +1 -1
- package/build/assets/llm-settings-BBsZFi9l.js +1 -0
- package/build/assets/{llm-settings-Cvi7q4ox.js → llm-settings-DFkJQr_w.js} +1 -1
- package/build/assets/{llm-subscription-service-Cz1yBBvE.js → llm-subscription-service-Casyzgn1.js} +1 -1
- package/build/assets/{manage-backends-modal-DAVhNUCe.js → manage-backends-modal-CKQ46rvw.js} +1 -1
- package/build/assets/manifest-03478bbf.js +1 -0
- package/build/assets/{map-provider-XSFHmdDs.js → map-provider-BbIb12oh.js} +1 -1
- package/build/assets/{markdown-renderer-B6cJJ_MN.js → markdown-renderer-B4V2OMFP.js} +1 -1
- package/build/assets/{mcp-BwssgMpg.js → mcp-BapoJsDc.js} +1 -1
- package/build/assets/{messages-D8MeG2ZQ.js → messages-CUBFMY5o.js} +1 -1
- package/build/assets/{model-selector-BxTbbKub.js → model-selector-DJrMrFAr.js} +1 -1
- package/build/assets/{navigation-link-imH6S7h2.js → navigation-link-D8hfwvxI.js} +1 -1
- package/build/assets/{onboarding-CyicadGt.js → onboarding-6NMkdNxV.js} +1 -1
- package/build/assets/onboarding-modal-Q4AnpIdg.js +1 -0
- package/build/assets/{organization-service.api-QknzKDh3.js → organization-service.api-vrRNwOma.js} +1 -1
- package/build/assets/{path-utils-BECGet7G.js → path-utils-PNfCKQDV.js} +1 -1
- package/build/assets/{planner-tab-DPKHmMAX.js → planner-tab-ByOw1he8.js} +1 -1
- package/build/assets/{plugins-management-service-DuTTxquo.js → plugins-management-service-B75jyC56.js} +1 -1
- package/build/assets/{profiles-service.api-D6jvZOWu.js → profiles-service.api-BQTklD5D.js} +1 -1
- package/build/assets/providers-DfTB2gPd.js +1 -0
- package/build/assets/{proxy-CuhhyjdX.js → proxy-B3tCGf0X.js} +1 -1
- package/build/assets/{recommended-automations-launcher-DA6DWS7V.js → recommended-automations-launcher-Bj7PuHY1.js} +1 -1
- package/build/assets/root-CDnuTToz.js +2 -0
- package/build/assets/root-layout-DfYVlcRG.js +2 -0
- package/build/assets/{runtime-waiting-state-DeD9G7yJ.js → runtime-waiting-state-CnyVhX4T.js} +1 -1
- package/build/assets/{schema-field-BOLdL_U7.js → schema-field-CUwk4wrQ.js} +1 -1
- package/build/assets/{sdk-section-page-ZIltERxf.js → sdk-section-page-DLLNrYjI.js} +1 -1
- package/build/assets/{sdk-settings-schema-Ba_Pa9uf.js → sdk-settings-schema-CLR01YIK.js} +1 -1
- package/build/assets/{secrets-service-50DElFny.js → secrets-service-CvyPWJhg.js} +1 -1
- package/build/assets/{secrets-settings-Digl7JLe.js → secrets-settings-CHy72A5C.js} +1 -1
- package/build/assets/settings-B9S8UVQr.js +1 -0
- package/build/assets/{settings-dropdown-input-BD5C9fBn.js → settings-dropdown-input-Dhx9ErGd.js} +1 -1
- package/build/assets/{settings-index-CODBijya.js → settings-index-BKDl2CQ-.js} +1 -1
- package/build/assets/{settings-input-CzNOq-Pj.js → settings-input-BsgQWS5R.js} +1 -1
- package/build/assets/{settings-list-classes-CuxH9ZoR.js → settings-list-classes-DSJJX99U.js} +1 -1
- package/build/assets/{settings-modal-BcSWpKI0.js → settings-modal-DeK11CyT.js} +1 -1
- package/build/assets/{settings-service.api-Bsu1PvYO.js → settings-service.api-DXk5TdeJ.js} +1 -1
- package/build/assets/{settings-switch-DqmHAfWJ.js → settings-switch-Bes8dIlV.js} +1 -1
- package/build/assets/{settings-utils-B1lBErvV.js → settings-utils-DzCVfiR3.js} +1 -1
- package/build/assets/{shared-conversation-CDskdmrb.js → shared-conversation-9atDzTR4.js} +1 -1
- package/build/assets/{sidebar-mobile-menu-toggle-DmCmZgq1.js → sidebar-mobile-menu-toggle-giMMZctn.js} +1 -1
- package/build/assets/{sidebar-nav-link-DMc8AIe7.js → sidebar-nav-link-CHqyFXwV.js} +1 -1
- package/build/assets/{sidebar-store-DXWSCFpa.js → sidebar-store-uiUXBU1N.js} +1 -1
- package/build/assets/{skill-card-pill-row-DOIWjiMF.js → skill-card-pill-row-BPYKQ3IN.js} +1 -1
- package/build/assets/{skills-plugins-DLgINYuY.js → skills-plugins-Tropusio.js} +1 -1
- package/build/assets/{skills-settings-DPiCWalR.js → skills-settings-BvzBBCWk.js} +1 -1
- package/build/assets/{task-list-tab-CuhcDycu.js → task-list-tab-DyfgG4MC.js} +1 -1
- package/build/assets/telemetry-C5JMEfqB.js +2 -0
- package/build/assets/{terminal-CVqF-tCD.js → terminal-DRXt2Lr4.js} +1 -1
- package/build/assets/{typography-CQn9wyEX.js → typography-CzfoD9DY.js} +1 -1
- package/build/assets/{use-acp-credential-form-LlfZO_DD.js → use-acp-credential-form-Bm8qXdlc.js} +1 -1
- package/build/assets/{use-activate-agent-profile-DpQjsXM0.js → use-activate-agent-profile-DlykqEfN.js} +1 -1
- package/build/assets/{use-active-agent-profile-Gw_uJujV.js → use-active-agent-profile-hI-x-UBa.js} +1 -1
- package/build/assets/{use-active-conversation-B0sttISF.js → use-active-conversation-2qeez40F.js} +1 -1
- package/build/assets/{use-agent-profiles-LHZEK0Gg.js → use-agent-profiles-0pr5bLS7.js} +1 -1
- package/build/assets/{use-agent-state-C5uA0bRj.js → use-agent-state-C6peDXUm.js} +1 -1
- package/build/assets/{use-backends-health-DKt1SmiU.js → use-backends-health-CLHPitJM.js} +1 -1
- package/build/assets/{use-can-manage-org-profiles-BAtqsbCi.js → use-can-manage-org-profiles-Ck_bsNbH.js} +1 -1
- package/build/assets/{use-cloud-current-user-id-C8m1oBy4.js → use-cloud-current-user-id-DUCSxNjY.js} +1 -1
- package/build/assets/use-config-B5r8erYt.js +1 -0
- package/build/assets/{use-create-conversation-CWQGNQ9J.js → use-create-conversation-r1JHfKO5.js} +1 -1
- package/build/assets/{use-create-secret-BIrsX3OB.js → use-create-secret-Cf2N11d2.js} +1 -1
- package/build/assets/{use-event-store-CsD17BKu.js → use-event-store-Bbaz51GR.js} +1 -1
- package/build/assets/{use-handle-plan-click-DEuO7Byo.js → use-handle-plan-click-CsAW3FlH.js} +1 -1
- package/build/assets/{use-launch-skill-in-chat-CdHOoQGM.js → use-launch-skill-in-chat-DJWEfVc5.js} +1 -1
- package/build/assets/{use-llm-profiles-DQpQxVOD.js → use-llm-profiles-Dr5__SlZ.js} +1 -1
- package/build/assets/{use-plugins-marketplace-Bkk07W_M.js → use-plugins-marketplace-BplU65ae.js} +1 -1
- package/build/assets/use-runtime-is-ready-vCFOcLFa.js +1 -0
- package/build/assets/{use-save-agent-profile-BxEsjnW0.js → use-save-agent-profile-RqUGqTv6.js} +1 -1
- package/build/assets/{use-save-settings-ioSUMqbE.js → use-save-settings-Chvzeu2s.js} +1 -1
- package/build/assets/{use-settings-DNJC4gqu.js → use-settings-CyxSlyTQ.js} +1 -1
- package/build/assets/{use-settings-nav-items-BUsrDbVR.js → use-settings-nav-items-zEkSO_Bf.js} +1 -1
- package/build/assets/{use-skills-BsmKm23M.js → use-skills-xrVoKYrF.js} +1 -1
- package/build/assets/{use-task-list-rs7Xbzl8.js → use-task-list-CfisapBW.js} +1 -1
- package/build/assets/use-tracking-D2Qg5Lpd.js +1 -0
- package/build/assets/{use-user-conversation-B337kUKB.js → use-user-conversation-CnE4zhOA.js} +1 -1
- package/build/assets/{vendor~browser-tab-Xn94EtUo.js → vendor~browser-tab-CsMb-pta.js} +1 -1
- package/build/assets/{vendor~browser-5Njjw1Cl.js → vendor~browser-wXQ-WZEC.js} +1 -1
- package/build/assets/{vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~dhilvkxv-BIieS_OD.js → vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~dhilvkxv-eGLBu60s.js} +2 -2
- package/build/assets/{vendor~files-tab-CiC3-lGh.js → vendor~files-tab-B-5fBohe.js} +1 -1
- package/build/assets/{vendor~index-home~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-DWteoTyr.js → vendor~index-home~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-BD7v71DM.js} +1 -1
- package/build/assets/{vendor~index-home~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-tlf6AnDe.js → vendor~index-home~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-BT05Osu4.js} +1 -1
- package/build/assets/{vendor~index-home~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-B8XNNEQZ.js → vendor~index-home~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-COhHANvV.js} +1 -1
- package/build/assets/{vendor~index-home~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-Dc5nKwLO.js → vendor~index-home~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-DgzWSMRc.js} +1 -1
- package/build/assets/{vendor~index-home~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-CnJRLn5s.js → vendor~index-home~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-DqZatR3B.js} +1 -1
- package/build/assets/{vendor~launch-28DK5Rsl.js → vendor~launch-_Km3J77E.js} +1 -1
- package/build/assets/{vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~g9hift2g-DmmpG9SI.js → vendor~module-D5a_AClf.js} +1 -1
- package/build/assets/{vendor~root-layout~conversation-panel~conversation~shared-conversation-lYNG9C1U.js → vendor~root-layout~conversation-panel~conversation~shared-conversation-BrguKXCn.js} +1 -1
- package/build/assets/{vendor~root-layout~index-home~home~conversation-panel~conversation-Zhq6xAxR.js → vendor~root-layout~index-home~home~conversation-panel~conversation-BTvhGHHG.js} +1 -1
- package/build/assets/{vendor~root-layout~index-home~home~conversation-panel~conversation~shared-conversation~aler~gfu7qdtz-B81b08bw.js → vendor~root-layout~index-home~home~conversation-panel~conversation~shared-conversation~aler~gfu7qdtz-BOKQkbc6.js} +1 -1
- package/build/assets/{vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~ftka0fnu-jpyLM1Nn.js → vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~ftka0fnu-cFNmfAE6.js} +1 -1
- package/build/assets/{verification-settings-HRgEM-_3.js → verification-settings-CfkrXoSa.js} +1 -1
- package/build/index.html +4 -4
- package/config/defaults.json +1 -1
- package/dist/api/cloud/conversation-service.api.cjs +1 -1
- package/dist/api/cloud/conversation-service.api.js +4 -4
- package/dist/api/option-service/option-service.api.cjs +1 -1
- package/dist/api/option-service/option-service.api.cjs.map +1 -1
- package/dist/api/option-service/option-service.api.js +0 -1
- package/dist/api/option-service/option-service.api.js.map +1 -1
- package/dist/api/option-service/option.types.d.ts +0 -1
- package/dist/components/features/backends/backend-form-modal.cjs +1 -1
- package/dist/components/features/backends/backend-form-modal.cjs.map +1 -1
- package/dist/components/features/backends/backend-form-modal.d.ts +1 -1
- package/dist/components/features/backends/backend-form-modal.js +137 -144
- package/dist/components/features/backends/backend-form-modal.js.map +1 -1
- package/dist/components/providers/agent-server-ui-providers.cjs +1 -1
- package/dist/components/providers/agent-server-ui-providers.cjs.map +1 -1
- package/dist/components/providers/agent-server-ui-providers.d.ts +4 -2
- package/dist/components/providers/agent-server-ui-providers.js +9 -2
- package/dist/components/providers/agent-server-ui-providers.js.map +1 -1
- package/dist/components/providers/index.cjs +1 -1
- package/dist/components/providers/index.d.ts +1 -2
- package/dist/components/providers/index.js +0 -1
- package/dist/components/providers/telemetry-provider.cjs +2 -0
- package/dist/components/providers/telemetry-provider.cjs.map +1 -0
- package/dist/components/providers/telemetry-provider.d.ts +6 -0
- package/dist/components/providers/telemetry-provider.js +64 -0
- package/dist/components/providers/telemetry-provider.js.map +1 -0
- package/dist/config/defaults.cjs +1 -1
- package/dist/config/defaults.cjs.map +1 -1
- package/dist/config/defaults.js +1 -1
- package/dist/config/defaults.js.map +1 -1
- package/dist/contexts/conversation-websocket-context.cjs +3 -3
- package/dist/contexts/conversation-websocket-context.cjs.map +1 -1
- package/dist/contexts/conversation-websocket-context.js +197 -204
- package/dist/contexts/conversation-websocket-context.js.map +1 -1
- package/dist/hooks/mutation/use-save-settings.cjs +1 -1
- package/dist/hooks/mutation/use-save-settings.cjs.map +1 -1
- package/dist/hooks/mutation/use-save-settings.d.ts +3 -1
- package/dist/hooks/mutation/use-save-settings.js +6 -5
- package/dist/hooks/mutation/use-save-settings.js.map +1 -1
- package/dist/hooks/use-telemetry.cjs +1 -1
- package/dist/hooks/use-telemetry.cjs.map +1 -1
- package/dist/hooks/use-telemetry.d.ts +3 -3
- package/dist/hooks/use-telemetry.js +16 -22
- package/dist/hooks/use-telemetry.js.map +1 -1
- package/dist/hooks/use-tracking.cjs +1 -1
- package/dist/hooks/use-tracking.cjs.map +1 -1
- package/dist/hooks/use-tracking.d.ts +3 -4
- package/dist/hooks/use-tracking.js +37 -37
- package/dist/hooks/use-tracking.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/lib/index.d.ts +2 -2
- package/dist/package.cjs +1 -1
- package/dist/package.cjs.map +1 -1
- package/dist/package.js +2 -2
- package/dist/package.js.map +1 -1
- package/dist/routes/app-settings.cjs +1 -1
- package/dist/routes/app-settings.cjs.map +1 -1
- package/dist/routes/app-settings.js +66 -68
- package/dist/routes/app-settings.js.map +1 -1
- package/dist/routes/llm-settings.cjs +1 -1
- package/dist/routes/llm-settings.cjs.map +1 -1
- package/dist/routes/llm-settings.js +4 -1
- package/dist/routes/llm-settings.js.map +1 -1
- package/dist/services/cloud-funnel-analytics.cjs +1 -1
- package/dist/services/cloud-funnel-analytics.cjs.map +1 -1
- package/dist/services/cloud-funnel-analytics.d.ts +3 -11
- package/dist/services/cloud-funnel-analytics.js +16 -30
- package/dist/services/cloud-funnel-analytics.js.map +1 -1
- package/dist/services/telemetry.cjs +1 -1
- package/dist/services/telemetry.cjs.map +1 -1
- package/dist/services/telemetry.d.ts +46 -9
- package/dist/services/telemetry.js +181 -72
- package/dist/services/telemetry.js.map +1 -1
- package/dist/themes/color-themes.cjs.map +1 -1
- package/dist/themes/color-themes.d.ts +3 -6
- package/dist/themes/color-themes.js.map +1 -1
- package/dist/utils/error-handler.cjs +1 -1
- package/dist/utils/error-handler.cjs.map +1 -1
- package/dist/utils/error-handler.d.ts +1 -4
- package/dist/utils/error-handler.js +6 -7
- package/dist/utils/error-handler.js.map +1 -1
- package/dist/utils/map-provider.cjs +1 -1
- package/dist/utils/map-provider.cjs.map +1 -1
- package/dist/utils/map-provider.d.ts +1 -0
- package/dist/utils/map-provider.js +2 -1
- package/dist/utils/map-provider.js.map +1 -1
- package/package.json +2 -2
- package/build/assets/agent-settings-DGUKNSnU.js +0 -1
- package/build/assets/app-settings-BpViWwpC.js +0 -1
- package/build/assets/backend-form-modal-DhBT8P4g.js +0 -1
- package/build/assets/browser-store-BGXOGo-R.js +0 -1
- package/build/assets/client-source-Biqarhgr.js +0 -1
- package/build/assets/cloud-funnel-analytics-D-27T5Ao.js +0 -1
- package/build/assets/conversation-CHnEXGRM.js +0 -1
- package/build/assets/conversation-panel-11FjLCId.js +0 -1
- package/build/assets/conversation-state-store-JiUQp02U.js +0 -1
- package/build/assets/handle-capture-consent-DDnXMC9Y.js +0 -1
- package/build/assets/home-BQ-DC06B.js +0 -1
- package/build/assets/index-home-BRFDWs_4.js +0 -1
- package/build/assets/lesson-plan-DSf95kQ2.js +0 -4
- package/build/assets/llm-settings-Ch4ZbW3c.js +0 -1
- package/build/assets/manifest-958c741a.js +0 -1
- package/build/assets/onboarding-modal-DQwihcTz.js +0 -1
- package/build/assets/option-service.api-DAkg_F7p.js +0 -1
- package/build/assets/package-Dk_VtWJ4.js +0 -1
- package/build/assets/providers-B8pxQK8x.js +0 -1
- package/build/assets/root-BhP6bTBB.js +0 -2
- package/build/assets/root-layout-oBaHHW4s.js +0 -2
- package/build/assets/settings-BfgLHsgd.js +0 -1
- package/build/assets/telemetry-DHiTRl5_.js +0 -2
- package/build/assets/use-config-CXy4vD0H.js +0 -1
- package/build/assets/use-runtime-is-ready-D4pkGT6E.js +0 -1
- package/build/assets/use-tracking-poxQHMwR.js +0 -1
- package/build/assets/vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~ljq5gbus-B2XD4bi2.js +0 -1
- package/dist/components/providers/posthog-wrapper.cjs +0 -2
- package/dist/components/providers/posthog-wrapper.cjs.map +0 -1
- package/dist/components/providers/posthog-wrapper.d.ts +0 -4
- package/dist/components/providers/posthog-wrapper.js +0 -49
- package/dist/components/providers/posthog-wrapper.js.map +0 -1
- package/dist/node_modules/posthog-js/react/dist/esm/index.cjs +0 -2
- package/dist/node_modules/posthog-js/react/dist/esm/index.cjs.map +0 -1
- package/dist/node_modules/posthog-js/react/dist/esm/index.js +0 -113
- package/dist/node_modules/posthog-js/react/dist/esm/index.js.map +0 -1
- package/dist/utils/handle-capture-consent.cjs +0 -2
- package/dist/utils/handle-capture-consent.cjs.map +0 -1
- package/dist/utils/handle-capture-consent.d.ts +0 -7
- package/dist/utils/handle-capture-consent.js +0 -8
- package/dist/utils/handle-capture-consent.js.map +0 -1
- /package/build/assets/{__vite-browser-external-DU-Cb_sT.js → __vite-browser-external-BQUj0sYu.js} +0 -0
- /package/build/assets/{agent-server-ui-style-scope-COnDHTm5.js → agent-server-ui-style-scope-qhnhZHBV.js} +0 -0
- /package/build/assets/{automation-BVEmGghX.js → automation-LZB0MjdV.js} +0 -0
- /package/build/assets/{canvas-ui-BhxjoA1f.js → canvas-ui-COgjltGz.js} +0 -0
- /package/build/assets/{checkmark-DhcMGwtO.js → checkmark-h7udgXMM.js} +0 -0
- /package/build/assets/{close-DO5Rq_CS.js → close-DLFb5kfv.js} +0 -0
- /package/build/assets/{code-tag-BvjtzUsr.js → code-tag-DYlAhEQY.js} +0 -0
- /package/build/assets/{conversation-local-storage-B31voBg7.js → conversation-local-storage-F6zVMM--.js} +0 -0
- /package/build/assets/{conversation-tab-empty-state-BUhKVwoi.js → conversation-tab-empty-state-CNUmIms2.js} +0 -0
- /package/build/assets/{copy-DLUw2us-.js → copy-BLmGeJcd.js} +0 -0
- /package/build/assets/{dist-Dj01FXbZ.js → dist-CodhvuAP.js} +0 -0
- /package/build/assets/{environment-switch-store-D9hB9PvY.js → environment-switch-store-DkjlKWzN.js} +0 -0
- /package/build/assets/{extension-module-card-classes-BlO4w702.js → extension-module-card-classes-9V3J9J_b.js} +0 -0
- /package/build/assets/{folder-ynxP2EIL.js → folder-Bk311brm.js} +0 -0
- /package/build/assets/{form-control-classes-CvUaw8_L.js → form-control-classes-CbdN5aO3.js} +0 -0
- /package/build/assets/{get-language-from-path-rWEQrOGU.js → get-language-from-path-DBqBsCWH.js} +0 -0
- /package/build/assets/{git-status-mapper-C3rfzUex.js → git-status-mapper-DnL9OC8_.js} +0 -0
- /package/build/assets/{iconBase-CuvxAQZ5.js → iconBase-Dz51Zn5x.js} +0 -0
- /package/build/assets/{link-external-BVDiJfZt.js → link-external-CaBmUEs_.js} +0 -0
- /package/build/assets/{llm-subscription-BkdHwtQe.js → llm-subscription-DtsX5Lhg.js} +0 -0
- /package/build/assets/{loading-spinner-Txxx1I1p.js → loading-spinner-BcdnT0mN.js} +0 -0
- /package/build/assets/{middleware-CWYDMVuG.js → middleware-DYHYNAnP.js} +0 -0
- /package/build/assets/{modal-backdrop-Dsmzgr5s.js → modal-backdrop-zVwfOJZr.js} +0 -0
- /package/build/assets/{modal-body-CDZdZ-eT.js → modal-body-Cc2zp0xb.js} +0 -0
- /package/build/assets/{modal-classes-B4oit_4c.js → modal-classes-3qT9Ap7Q.js} +0 -0
- /package/build/assets/{modal-close-button-DQElFMPo.js → modal-close-button-BcIBUdSq.js} +0 -0
- /package/build/assets/{navigation-context-SjzfpygH.js → navigation-context-DPs2G0X8.js} +0 -0
- /package/build/assets/{objectWithoutPropertiesLoose-CQwg6tC0.js → objectWithoutPropertiesLoose-BgYIAs2y.js} +0 -0
- /package/build/assets/{openhands-logo-C-gDp1wr.js → openhands-logo-bcNw5bkY.js} +0 -0
- /package/build/assets/{plan-components-CgPHWz3E.js → plan-components-BdZXPyZU.js} +0 -0
- /package/build/assets/{react-ao3tWj6K.js → react-DPDgL6du.js} +0 -0
- /package/build/assets/{search-pb4UKTfK.js → search-BgOCR7_c.js} +0 -0
- /package/build/assets/{segmented-toggle-C1-ZVyr5.js → segmented-toggle-kzwZkLaj.js} +0 -0
- /package/build/assets/{settings-gear-D_HVvE5L.js → settings-gear-MXCyZW0x.js} +0 -0
- /package/build/assets/{settings-like-page-layout-classes-DLrsPCaI.js → settings-like-page-layout-classes-Cdl6jOe5.js} +0 -0
- /package/build/assets/{settings-DksoDv5z.js → settings-mQUckT0g.js} +0 -0
- /package/build/assets/{settings-section-header-context-C2MUIG88.js → settings-section-header-context-COMOIaxV.js} +0 -0
- /package/build/assets/{sidebar-layout-Cn6eQaEI.js → sidebar-layout-Bm7pa3Vk.js} +0 -0
- /package/build/assets/{skills-CH4xgIh-.js → skills-EqzxYBvT.js} +0 -0
- /package/build/assets/{styled-tooltip-CvsjHuIf.js → styled-tooltip-B14i_Uac.js} +0 -0
- /package/build/assets/{switch-skeleton-BpSOvZ-n.js → switch-skeleton-DqQwalyu.js} +0 -0
- /package/build/assets/{terminal-Dokfkxn0.js → terminal-Cgf___rK.js} +0 -0
- /package/build/assets/{toggle-switch-CS0ClOy2.js → toggle-switch-DX_k418f.js} +0 -0
- /package/build/assets/{u-check-circle-DPWVO-9N.js → u-check-circle-BqoIxNz_.js} +0 -0
- /package/build/assets/{u-check-circle-half-BGNAAjOW.js → u-check-circle-half-MsShT8Ec.js} +0 -0
- /package/build/assets/{u-edit-BIskOoEG.js → u-edit-DL5LgKon.js} +0 -0
- /package/build/assets/{use-breakpoint-OjLm94cF.js → use-breakpoint-BP3lqLMx.js} +0 -0
- /package/build/assets/{use-click-outside-element-Jpt2WWd7.js → use-click-outside-element-D9BYdANT.js} +0 -0
- /package/build/assets/{use-is-authed-Dvbpiu3B.js → use-is-authed-BezEyfeh.js} +0 -0
- /package/build/assets/{use-onboarding-completion-DkRpDTsD.js → use-onboarding-completion-C_Swglzp.js} +0 -0
- /package/build/assets/{v4-DPgam_jW.js → v4-DbCkTSoU.js} +0 -0
- /package/build/assets/{vendor~browser-BvEKaLBz.js → vendor~browser-By2MVv_N.js} +0 -0
- /package/build/assets/{vendor~conversation-panel~conversation~alert-banner-CznX01nZ.js → vendor~conversation-panel~conversation~alert-banner-CxfzCmkN.js} +0 -0
- /package/build/assets/{vendor~index-home~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-BuL5kjfS.js → vendor~index-home~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-FghQ3Z1a.js} +0 -0
- /package/build/assets/{vendor~root-layout~index-home~home~conversation-panel~conversation~launch~skills-settings~a~j2jlu22h-DUYl8gbZ.js → vendor~root-layout~index-home~home~conversation-panel~conversation~launch~skills-settings~a~j2jlu22h-mC0v44WR.js} +0 -0
- /package/build/assets/{vendor~root-layout~index-home~home~mcp~automations-list~onboarding-modal-pIgQDxTc.js → vendor~root-layout~index-home~home~mcp~automations-list~onboarding-modal-C4-GDgiF.js} +0 -0
- /package/build/assets/{vendor~terminal-jAaNQWS9.js → vendor~terminal-CnKZILnC.js} +0 -0
- /package/build/assets/{x-mark-C5przfXl.js → x-mark-Batp6gXa.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry.js","names":[],"sources":["../../src/services/telemetry.ts"],"sourcesContent":["/**\n * Telemetry service for tracking library usage.\n *\n * This module handles anonymous telemetry for the @openhands/agent-canvas package\n * using the PostHog SDK for reliable event delivery with batching, retry logic,\n * and offline support.\n *\n * TRACKING PHILOSOPHY:\n * - Install event (canvas_install): Sent immediately on first use, regardless of consent.\n * This is anonymous and contains no PII - just basic browser info and a random ID.\n * - Session/custom events: Only sent after user grants consent via the consent modal.\n * - Users can opt out of all future tracking by declining consent.\n *\n * AD BLOCKER BYPASS:\n * By default, telemetry is routed through OpenHands' reverse proxy (z.openhands.dev)\n * to avoid being blocked by ad blockers. Library consumers can override this with:\n * - VITE_POSTHOG_HOST: Custom proxy URL or direct PostHog URL\n * - VITE_POSTHOG_UI_HOST: PostHog UI host (defaults to https://us.posthog.com)\n *\n * IMPORTANT: By default, telemetry is sent to the OpenHands PostHog project.\n * Library consumers can override this by setting VITE_POSTHOG_API_KEY.\n *\n * Users can disable all telemetry (including install tracking) via:\n * - Setting VITE_DO_NOT_TRACK=1 environment variable\n * - Browser's Do Not Track setting\n */\n\nimport type { PostHog } from \"posthog-js\";\nimport packageJson from \"../../package.json\";\n\nconst TELEMETRY_CONSENT_KEY = \"openhands-telemetry-consent\";\nconst TELEMETRY_FIRST_USE_KEY = \"openhands-telemetry-first-use\";\nconst TELEMETRY_SESSION_KEY = \"openhands-telemetry-session\";\nconst POSTHOG_INSTANCE_NAME = \"agent-canvas\";\n\n// PostHog project keys — one per deployment environment, hardcoded so they\n// are baked into the static bundle at build time and cannot drift at runtime.\n// Replace POSTHOG_STAGING_KEY with a dedicated project key once provisioned.\nconst POSTHOG_PROD_KEY = \"phc_BgzfxKdgsYMLFTmJqt424ZoyVHvKFfrwttLimzdYTKFK\";\nconst POSTHOG_STAGING_KEY = \"phc_kBtz5nKmxVRRQ7HtPwr2QX9eMC5j65zE86QKocVNwb4U\";\n\n// Always use the staging key unless VITE_APP_ENV is explicitly set to\n// \"production\" at bundle time (hardcoded in build:lib and production CI).\n// Library consumers can always override with VITE_POSTHOG_API_KEY.\nconst POSTHOG_API_KEY: string =\n (import.meta.env.VITE_POSTHOG_API_KEY as string | undefined) ||\n (import.meta.env.VITE_APP_ENV === \"production\"\n ? POSTHOG_PROD_KEY\n : POSTHOG_STAGING_KEY);\n\n// Default to OpenHands' reverse proxy to bypass ad blockers.\n// The proxy at z.openhands.dev routes to PostHog's US region.\n// Library consumers can override this with their own proxy or direct PostHog URL.\nconst POSTHOG_HOST =\n import.meta.env.VITE_POSTHOG_HOST || \"https://z.openhands.dev\";\n\n// UI host is needed for PostHog features like toolbar to work correctly\n// when using a reverse proxy. Defaults to US region.\nconst POSTHOG_UI_HOST =\n import.meta.env.VITE_POSTHOG_UI_HOST || \"https://us.posthog.com\";\n\nexport type TelemetryConsent = \"granted\" | \"denied\" | \"pending\";\n\nlet isInitialized = false;\nlet posthogInstance: PostHog | null = null;\n\n/**\n * Check if we're in a browser environment\n */\nfunction isBrowser(): boolean {\n return typeof window !== \"undefined\" && typeof localStorage !== \"undefined\";\n}\n\n/**\n * Lazily load PostHog to avoid SSR/Node.js issues.\n * PostHog is a browser-only library, so we dynamically import it only when needed.\n */\nasync function getPostHog(): Promise<PostHog | null> {\n if (!isBrowser()) {\n return null;\n }\n\n if (posthogInstance) {\n return posthogInstance;\n }\n\n try {\n const { default: posthog } = await import(\"posthog-js\");\n return posthog;\n } catch {\n // Failed to load PostHog - telemetry will be disabled\n return null;\n }\n}\n\n/**\n * Check if telemetry is disabled via environment variable or browser setting.\n * Works in both Node.js and browser (Vite) environments.\n */\nfunction isDoNotTrackEnabled(): boolean {\n // Check Vite environment variable (browser)\n if (\n typeof import.meta !== \"undefined\" &&\n import.meta.env?.VITE_DO_NOT_TRACK === \"1\"\n ) {\n return true;\n }\n\n // Check Node.js environment variable (SSR/testing)\n if (typeof process !== \"undefined\" && process.env?.DO_NOT_TRACK === \"1\") {\n return true;\n }\n\n // Check browser's navigator.doNotTrack standard\n if (\n typeof navigator !== \"undefined\" &&\n (navigator.doNotTrack === \"1\" ||\n // @ts-expect-error - Some browsers use window.doNotTrack\n (typeof window !== \"undefined\" && window.doNotTrack === \"1\"))\n ) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Initialize PostHog SDK.\n *\n * @param enableCapturing - If true, enable capturing immediately (for install tracking).\n * If false, start with capturing disabled (for consent-gated tracking).\n */\nasync function initializePostHog(\n enableCapturing = false,\n): Promise<PostHog | null> {\n if (isInitialized) {\n return posthogInstance;\n }\n\n const posthog = await getPostHog();\n if (!posthog) {\n return null;\n }\n\n // Canvas telemetry must not share PostHog's default singleton with host-app\n // analytics. A named instance gives it independent configuration, consent,\n // persistence, and delivery state.\n posthogInstance = posthog.init(\n POSTHOG_API_KEY,\n {\n api_host: POSTHOG_HOST,\n // UI host is required when using a reverse proxy so PostHog features work correctly\n ui_host: POSTHOG_UI_HOST,\n // Start with capturing disabled by default - we enable it explicitly when needed\n opt_out_capturing_by_default: !enableCapturing,\n // Don't auto-capture page views - we control when to track\n capture_pageview: false,\n // Don't auto-capture clicks etc.\n autocapture: false,\n // Use localStorage for persistence\n persistence: \"localStorage\",\n persistence_name: POSTHOG_INSTANCE_NAME,\n consent_persistence_name: `${POSTHOG_INSTANCE_NAME}-consent`,\n // Disable session recording\n disable_session_recording: true,\n // Set default properties for all events\n loaded: (ph) => {\n ph.register({\n package_name: packageJson.name,\n package_version: packageJson.version,\n });\n },\n },\n POSTHOG_INSTANCE_NAME,\n );\n\n isInitialized = true;\n return posthogInstance;\n}\n\n/**\n * Get user's telemetry consent preference\n */\nexport function getTelemetryConsent(): TelemetryConsent {\n if (!isBrowser()) {\n return \"pending\";\n }\n\n // Check environment variable for opt-out\n if (isDoNotTrackEnabled()) {\n return \"denied\";\n }\n\n try {\n const consent = localStorage.getItem(TELEMETRY_CONSENT_KEY);\n if (consent === \"granted\" || consent === \"denied\") {\n return consent;\n }\n } catch {\n // Ignore storage errors\n }\n\n return \"pending\";\n}\n\n/**\n * Set user's telemetry consent preference\n */\nexport async function setTelemetryConsent(\n consent: \"granted\" | \"denied\",\n): Promise<void> {\n if (!isBrowser()) {\n return;\n }\n\n try {\n localStorage.setItem(TELEMETRY_CONSENT_KEY, consent);\n\n // Initialize PostHog if not already done\n const posthog = await initializePostHog();\n if (!posthog) {\n return;\n }\n\n if (consent === \"granted\") {\n // Enable capturing\n posthog.opt_in_capturing();\n } else {\n // Disable capturing and clear any queued events\n posthog.opt_out_capturing();\n }\n } catch {\n // Ignore storage errors\n }\n}\n\n/**\n * Check if telemetry is enabled (user has granted consent)\n */\nexport function isTelemetryEnabled(): boolean {\n return getTelemetryConsent() === \"granted\";\n}\n\n/**\n * Check if first use event has already been sent\n */\nfunction hasFirstUseSent(): boolean {\n if (!isBrowser()) {\n return false;\n }\n\n try {\n return localStorage.getItem(TELEMETRY_FIRST_USE_KEY) === \"true\";\n } catch {\n return false;\n }\n}\n\n/**\n * Mark first use event as sent\n */\nfunction markFirstUseSent(): void {\n if (!isBrowser()) {\n return;\n }\n\n try {\n localStorage.setItem(TELEMETRY_FIRST_USE_KEY, \"true\");\n } catch {\n // Ignore storage errors\n }\n}\n\n/**\n * Track the initial install of the library.\n *\n * IMPORTANT: This is sent immediately on first use, regardless of consent status.\n * This allows us to track library adoption even if users haven't made a consent choice yet.\n *\n * The event is:\n * - Completely anonymous (no PII, just a random PostHog distinct_id)\n * - Sent only once per installation (tracked via localStorage, persists across sessions)\n * - Still respects DO_NOT_TRACK environment variable and browser setting\n *\n * Users who want complete privacy can:\n * - Set VITE_DO_NOT_TRACK=1 or browser's Do Not Track\n * - Later deny consent to prevent all future tracking\n */\nexport async function trackInstall(): Promise<void> {\n // Respect hard opt-out via environment variable or browser setting\n if (isDoNotTrackEnabled()) {\n return;\n }\n\n // Already sent install event (persisted in localStorage - survives app relaunches)\n if (hasFirstUseSent()) {\n return;\n }\n\n // Initialize PostHog with capturing enabled (for this one event)\n const posthog = await initializePostHog(true);\n if (!posthog) {\n return;\n }\n\n // Temporarily enable capturing if it was disabled\n const wasOptedOut = posthog.has_opted_out_capturing?.() ?? false;\n if (wasOptedOut) {\n posthog.opt_in_capturing();\n }\n\n // Capture the install event\n posthog.capture(\"canvas_install\", {\n platform: typeof navigator !== \"undefined\" ? navigator.platform : \"unknown\",\n user_agent:\n typeof navigator !== \"undefined\" ? navigator.userAgent : \"unknown\",\n referrer: typeof document !== \"undefined\" ? document.referrer : \"\",\n url_origin: typeof window !== \"undefined\" ? window.location.origin : \"\",\n embedded: typeof window !== \"undefined\" && window.self !== window.top,\n });\n\n // Mark as sent (stored in localStorage - persists across browser sessions)\n markFirstUseSent();\n\n // Restore opt-out state if user hasn't granted consent yet\n // This ensures we only send the install event, not subsequent events\n const currentConsent = getTelemetryConsent();\n if (currentConsent !== \"granted\") {\n posthog.opt_out_capturing();\n }\n}\n\n/**\n * Check if session start event has already been sent (this browser session)\n */\nfunction hasSessionSent(): boolean {\n if (!isBrowser()) {\n return false;\n }\n\n try {\n return sessionStorage.getItem(TELEMETRY_SESSION_KEY) === \"true\";\n } catch {\n return false;\n }\n}\n\n/**\n * Mark session start event as sent (uses sessionStorage so it resets on new tabs/sessions)\n */\nfunction markSessionSent(): void {\n if (!isBrowser()) {\n return;\n }\n\n try {\n sessionStorage.setItem(TELEMETRY_SESSION_KEY, \"true\");\n } catch {\n // Ignore storage errors\n }\n}\n\n/**\n * Track a session start event.\n * Called each time a new browser session starts (respects consent).\n * Uses sessionStorage for deduplication - only sends once per browser session.\n */\nexport async function trackSessionStart(): Promise<void> {\n if (!isTelemetryEnabled()) {\n return;\n }\n\n // Already sent session event this browser session\n if (hasSessionSent()) {\n return;\n }\n\n // Initialize PostHog if needed\n const posthog = await initializePostHog();\n if (!posthog) {\n return;\n }\n\n posthog.capture(\"canvas_new_session\", {\n is_first_use: !hasFirstUseSent(),\n });\n\n // Mark as sent for this session\n markSessionSent();\n}\n\n/**\n * Track a custom event (respects consent).\n */\nexport async function trackEvent(\n eventName: string,\n properties: Record<string, unknown> = {},\n): Promise<void> {\n if (!isTelemetryEnabled()) {\n return;\n }\n\n // Initialize PostHog if needed\n const posthog = await initializePostHog();\n if (!posthog) {\n return;\n }\n\n posthog.capture(eventName, properties);\n}\n\n/**\n * Clear all telemetry data (for privacy/GDPR requests)\n */\nexport async function clearTelemetryData(): Promise<void> {\n if (!isBrowser()) {\n return;\n }\n\n try {\n localStorage.removeItem(TELEMETRY_CONSENT_KEY);\n localStorage.removeItem(TELEMETRY_FIRST_USE_KEY);\n sessionStorage.removeItem(TELEMETRY_SESSION_KEY);\n\n // Reset PostHog if initialized\n if (isInitialized && posthogInstance) {\n posthogInstance.reset();\n }\n } catch {\n // Ignore storage errors\n }\n}\n\n/**\n * Get the PostHog instance for advanced usage (if needed).\n * Returns the instance if initialized, otherwise null.\n * Note: This is async because PostHog is lazily loaded.\n */\nexport async function getPostHogInstance(): Promise<PostHog | null> {\n if (!isInitialized) {\n return null;\n }\n return posthogInstance;\n}\n"],"mappings":";;AA8BA,IAAM,IAAwB,+BACxB,IAA0B,iCAC1B,IAAwB,+BACxB,IAAwB,gBAWxB,IAGA,oDAMA,IACiC,2BAIjC,IACoC,0BAItC,IAAgB,IAChB,IAAkC;AAKtC,SAAS,IAAqB;AAC5B,QAAO,OAAO,SAAW,OAAe,OAAO,eAAiB;;AAOlE,eAAe,IAAsC;AACnD,KAAI,CAAC,GAAW,CACd,QAAO;AAGT,KAAI,EACF,QAAO;AAGT,KAAI;EACF,IAAM,EAAE,SAAS,MAAY,MAAM,OAAO;AAC1C,SAAO;SACD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
|
+
{"version":3,"file":"telemetry.js","names":[],"sources":["../../src/services/telemetry.ts"],"sourcesContent":["/**\n * Telemetry service for tracking library usage.\n *\n * This module handles anonymous telemetry for the @openhands/agent-canvas package\n * using the PostHog SDK for reliable event delivery with batching, retry logic,\n * and offline support.\n *\n * TRACKING PHILOSOPHY:\n * - Install event (canvas_install): Sent immediately on first use, regardless of consent.\n * This is anonymous and contains no PII - just basic browser info and a random ID.\n * - Session/custom events: Only sent after user grants consent via the consent modal.\n * - Users can opt out of all future tracking by declining consent.\n *\n * AD BLOCKER BYPASS:\n * By default, telemetry is routed through OpenHands' reverse proxy (z.openhands.dev)\n * to avoid being blocked by ad blockers. Library consumers can override this with:\n * - VITE_POSTHOG_HOST: Custom proxy URL or direct PostHog URL\n * - VITE_POSTHOG_UI_HOST: PostHog UI host (defaults to https://us.posthog.com)\n *\n * IMPORTANT: By default, telemetry is sent to the OpenHands PostHog project.\n * Source builds can override this with VITE_POSTHOG_API_KEY. Precompiled\n * library consumers can pass the same settings to configureTelemetry().\n *\n * Users can disable all telemetry (including install tracking) via:\n * - Setting VITE_DO_NOT_TRACK=1 environment variable\n * - Browser's Do Not Track setting\n */\n\nimport type { BootstrapConfig, CaptureResult, PostHog } from \"posthog-js\";\nimport packageJson from \"../../package.json\";\nimport {\n AGENT_CANVAS_CLIENT_SOURCE,\n AGENT_CANVAS_CLIENT_VERSION,\n} from \"#/api/client-source\";\n\nconst TELEMETRY_CONSENT_KEY = \"openhands-telemetry-consent\";\nconst TELEMETRY_CONSENT_PENDING_CLOUD_SYNC_KEY =\n \"openhands-telemetry-consent-pending-cloud-sync\";\nconst TELEMETRY_CONSENT_CHANGE_EVENT = \"openhands-telemetry-consent-change\";\nconst TELEMETRY_FIRST_USE_KEY = \"openhands-telemetry-first-use\";\nconst TELEMETRY_SESSION_KEY = \"openhands-telemetry-session\";\nconst POSTHOG_INSTANCE_NAME = \"agent-canvas\";\n\n// Unconfigured source builds use staging. Production release workflows pass\n// VITE_POSTHOG_API_KEY explicitly for both the app and library artifacts.\nconst POSTHOG_STAGING_KEY = \"phc_kBtz5nKmxVRRQ7HtPwr2QX9eMC5j65zE86QKocVNwb4U\";\nconst DEFAULT_POSTHOG_API_KEY: string =\n (import.meta.env.VITE_POSTHOG_API_KEY as string | undefined) ||\n POSTHOG_STAGING_KEY;\n\n// Default to OpenHands' reverse proxy to bypass ad blockers.\n// The proxy at z.openhands.dev routes to PostHog's US region.\n// Library consumers can override this with their own proxy or direct PostHog URL.\nconst DEFAULT_POSTHOG_HOST =\n import.meta.env.VITE_POSTHOG_HOST || \"https://z.openhands.dev\";\n\n// UI host is needed for PostHog features like toolbar to work correctly\n// when using a reverse proxy. Defaults to US region.\nconst DEFAULT_POSTHOG_UI_HOST =\n import.meta.env.VITE_POSTHOG_UI_HOST || \"https://us.posthog.com\";\n\nexport interface TelemetryConfig {\n /** PostHog project key. Useful for precompiled library consumers. */\n apiKey?: string;\n /** Event ingestion host or reverse proxy. */\n apiHost?: string;\n /** PostHog UI host used by toolbar links and other UI features. */\n uiHost?: string;\n}\n\nexport type TelemetryConfiguration = TelemetryConfig | false;\n\nexport type TelemetryConsent = \"granted\" | \"denied\" | \"pending\";\nexport type ResolvedTelemetryConsent = Exclude<TelemetryConsent, \"pending\">;\n\nexport interface SetTelemetryConsentOptions {\n /** Do not persist a value mirrored from backend settings back to Cloud. */\n syncToCloud?: boolean;\n}\n\nlet posthogInstance: PostHog | null = null;\nlet initializationPromise: Promise<PostHog | null> | null = null;\nlet pendingBootstrap: BootstrapConfig | undefined;\nlet telemetryConfig: TelemetryConfig = {};\nlet telemetryDisabled = false;\n\ninterface TelemetryIdentity {\n distinctId: string;\n properties: Record<string, unknown>;\n}\n\n// undefined means that Cloud identity has not resolved yet; null means that it\n// resolved without a user. This distinction prevents startup from resetting a\n// persisted identity while the current account is still loading.\nlet desiredTelemetryIdentity: TelemetryIdentity | null | undefined;\nlet desiredIdentityRevision = 0;\nlet appliedIdentityRevision = -1;\n\nconst CANVAS_EVENT_PROPERTIES = Object.freeze({\n client_source: AGENT_CANVAS_CLIENT_SOURCE,\n client_version: AGENT_CANVAS_CLIENT_VERSION,\n package_name: packageJson.name,\n package_version: packageJson.version,\n});\n\nfunction addCanvasEventProperties(\n event: CaptureResult | null,\n): CaptureResult | null {\n if (!event) return null;\n\n return {\n ...event,\n properties: {\n ...event.properties,\n ...CANVAS_EVENT_PROPERTIES,\n },\n };\n}\n\nfunction restorePostHogConsent(posthog: PostHog): void {\n if (telemetryDisabled || getTelemetryConsent() !== \"granted\") {\n posthog.opt_out_capturing();\n } else {\n posthog.opt_in_capturing();\n }\n}\n\nfunction resetPostHogIdentity(posthog: PostHog, resetDeviceId = false): void {\n posthog.reset(resetDeviceId);\n appliedIdentityRevision = -1;\n // PostHog reset clears its own consent persistence, so immediately restore\n // the canonical Canvas decision kept in localStorage.\n restorePostHogConsent(posthog);\n}\n\nfunction applyDesiredTelemetryIdentity(posthog: PostHog): void {\n if (desiredTelemetryIdentity === undefined || !isTelemetryEnabled()) return;\n\n const desiredId = desiredTelemetryIdentity?.distinctId;\n const currentId = posthog.get_property(\"$user_id\");\n if (currentId != null && currentId !== desiredId) {\n resetPostHogIdentity(posthog);\n }\n\n if (desiredTelemetryIdentity === null) {\n appliedIdentityRevision = desiredIdentityRevision;\n return;\n }\n\n if (\n posthog.get_property(\"$user_id\") !== desiredTelemetryIdentity.distinctId ||\n appliedIdentityRevision !== desiredIdentityRevision\n ) {\n posthog.identify(\n desiredTelemetryIdentity.distinctId,\n desiredTelemetryIdentity.properties,\n );\n appliedIdentityRevision = desiredIdentityRevision;\n }\n}\n\nfunction propertiesEqual(\n left: Record<string, unknown>,\n right: Record<string, unknown>,\n): boolean {\n const keys = Object.keys(left);\n return (\n keys.length === Object.keys(right).length &&\n keys.every((key) => left[key] === right[key])\n );\n}\n\n/**\n * Configure the single Canvas telemetry client before its first use.\n * Passing false disables telemetry and install tracking for embedded hosts.\n */\nexport function configureTelemetry(config: TelemetryConfiguration): void {\n if (config === false) {\n if (telemetryDisabled) return;\n telemetryDisabled = true;\n posthogInstance?.opt_out_capturing();\n notifyTelemetryConsentListeners();\n return;\n }\n\n const wasDisabled = telemetryDisabled;\n telemetryDisabled = false;\n\n if (!posthogInstance && !initializationPromise) {\n const definedConfig = Object.fromEntries(\n Object.entries(config).filter(([, value]) => value !== undefined),\n ) as TelemetryConfig;\n telemetryConfig = { ...telemetryConfig, ...definedConfig };\n }\n\n if (wasDisabled) {\n if (posthogInstance) {\n restorePostHogConsent(posthogInstance);\n applyDesiredTelemetryIdentity(posthogInstance);\n }\n notifyTelemetryConsentListeners();\n }\n}\n\nfunction getResolvedTelemetryConfig(): Required<TelemetryConfig> | null {\n if (telemetryDisabled) return null;\n\n return {\n apiKey: telemetryConfig.apiKey || DEFAULT_POSTHOG_API_KEY,\n apiHost: telemetryConfig.apiHost || DEFAULT_POSTHOG_HOST,\n uiHost: telemetryConfig.uiHost || DEFAULT_POSTHOG_UI_HOST,\n };\n}\n\n/**\n * Check if we're in a browser environment\n */\nfunction isBrowser(): boolean {\n return typeof window !== \"undefined\" && typeof localStorage !== \"undefined\";\n}\n\n/**\n * Lazily load PostHog to avoid SSR/Node.js issues.\n * PostHog is a browser-only library, so we dynamically import it only when needed.\n */\nasync function getPostHog(): Promise<PostHog | null> {\n if (!isBrowser()) {\n return null;\n }\n\n if (posthogInstance) {\n return posthogInstance;\n }\n\n try {\n const { default: posthog } = await import(\"posthog-js\");\n return posthog;\n } catch {\n // Failed to load PostHog - telemetry will be disabled\n return null;\n }\n}\n\n/**\n * Check if telemetry is disabled via environment variable or browser setting.\n * Works in both Node.js and browser (Vite) environments.\n */\nfunction isDoNotTrackEnabled(): boolean {\n if (telemetryDisabled) {\n return true;\n }\n\n // Check Vite environment variable (browser)\n if (\n typeof import.meta !== \"undefined\" &&\n import.meta.env?.VITE_DO_NOT_TRACK === \"1\"\n ) {\n return true;\n }\n\n // Check Node.js environment variable (SSR/testing)\n if (typeof process !== \"undefined\" && process.env?.DO_NOT_TRACK === \"1\") {\n return true;\n }\n\n // Check browser's navigator.doNotTrack standard\n if (\n typeof navigator !== \"undefined\" &&\n (navigator.doNotTrack === \"1\" ||\n // @ts-expect-error - Some browsers use window.doNotTrack\n (typeof window !== \"undefined\" && window.doNotTrack === \"1\"))\n ) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Initialize PostHog SDK.\n *\n * @param enableCapturing - If true, enable capturing immediately (for install tracking).\n * If false, start with capturing disabled (for consent-gated tracking).\n */\nexport function configurePostHogBootstrap(\n bootstrap: BootstrapConfig | undefined,\n): void {\n if (!posthogInstance) {\n pendingBootstrap = bootstrap;\n }\n}\n\nexport async function initializePostHogClient(\n enableCapturing = false,\n): Promise<PostHog | null> {\n if (posthogInstance) {\n return posthogInstance;\n }\n\n if (initializationPromise) {\n return initializationPromise;\n }\n\n initializationPromise = (async () => {\n const config = getResolvedTelemetryConfig();\n if (!config) {\n return null;\n }\n\n const posthog = await getPostHog();\n if (!posthog) {\n return null;\n }\n\n // A named instance isolates Canvas configuration, consent, identity, and\n // persistence from a host application's default PostHog singleton.\n const initializedPostHog = posthog.init(\n config.apiKey,\n {\n api_host: config.apiHost,\n ui_host: config.uiHost,\n opt_out_capturing_by_default: !enableCapturing,\n capture_pageview: false,\n autocapture: false,\n persistence: \"localStorage\",\n persistence_name: POSTHOG_INSTANCE_NAME,\n consent_persistence_name: `${POSTHOG_INSTANCE_NAME}-consent`,\n person_profiles: \"identified_only\",\n disable_session_recording: true,\n bootstrap: pendingBootstrap,\n before_send: addCanvasEventProperties,\n },\n POSTHOG_INSTANCE_NAME,\n );\n if (!initializedPostHog) return null;\n\n posthogInstance = initializedPostHog;\n pendingBootstrap = undefined;\n\n if (telemetryDisabled) {\n posthogInstance.opt_out_capturing();\n } else if (getTelemetryConsent() === \"granted\") {\n posthogInstance.opt_in_capturing();\n applyDesiredTelemetryIdentity(posthogInstance);\n } else if (!enableCapturing) {\n posthogInstance.opt_out_capturing();\n }\n\n return posthogInstance;\n })();\n\n try {\n return await initializationPromise;\n } finally {\n if (!posthogInstance) {\n initializationPromise = null;\n }\n }\n}\n\n/**\n * Get user's telemetry consent preference\n */\nexport function getTelemetryConsent(): TelemetryConsent {\n if (!isBrowser()) {\n return \"pending\";\n }\n\n // Check environment variable for opt-out\n if (isDoNotTrackEnabled()) {\n return \"denied\";\n }\n\n try {\n const consent = localStorage.getItem(TELEMETRY_CONSENT_KEY);\n if (consent === \"granted\" || consent === \"denied\") {\n return consent;\n }\n } catch {\n // Ignore storage errors\n }\n\n return \"pending\";\n}\n\n/**\n * Return an explicit browser choice that still needs to survive a Cloud login.\n * It remains pending across local backends so their settings cannot consume a\n * decision that must still be applied after the user connects to Cloud.\n */\nexport function getPendingCloudTelemetryConsent(): ResolvedTelemetryConsent | null {\n if (!isBrowser()) return null;\n\n try {\n const consent = localStorage.getItem(\n TELEMETRY_CONSENT_PENDING_CLOUD_SYNC_KEY,\n );\n return consent === \"granted\" || consent === \"denied\" ? consent : null;\n } catch {\n return null;\n }\n}\n\nexport function subscribeTelemetryConsent(listener: () => void): () => void {\n if (!isBrowser()) return () => {};\n const handleStorage = (event: StorageEvent) => {\n if (\n event.key === TELEMETRY_CONSENT_KEY ||\n event.key === TELEMETRY_CONSENT_PENDING_CLOUD_SYNC_KEY\n ) {\n listener();\n }\n };\n window.addEventListener(TELEMETRY_CONSENT_CHANGE_EVENT, listener);\n window.addEventListener(\"storage\", handleStorage);\n\n return () => {\n window.removeEventListener(TELEMETRY_CONSENT_CHANGE_EVENT, listener);\n window.removeEventListener(\"storage\", handleStorage);\n };\n}\n\nfunction notifyTelemetryConsentListeners(): void {\n if (isBrowser())\n window.dispatchEvent(new Event(TELEMETRY_CONSENT_CHANGE_EVENT));\n}\n\nfunction markTelemetryConsentForCloudSync(\n consent: ResolvedTelemetryConsent,\n): void {\n if (!isBrowser()) return;\n\n try {\n localStorage.setItem(TELEMETRY_CONSENT_PENDING_CLOUD_SYNC_KEY, consent);\n } catch {\n // Ignore storage errors; the in-browser consent decision still applies.\n }\n}\n\nexport function clearPendingCloudTelemetryConsent(\n expected?: ResolvedTelemetryConsent,\n): void {\n if (!isBrowser()) return;\n\n try {\n if (\n expected !== undefined &&\n localStorage.getItem(TELEMETRY_CONSENT_PENDING_CLOUD_SYNC_KEY) !==\n expected\n ) {\n return;\n }\n localStorage.removeItem(TELEMETRY_CONSENT_PENDING_CLOUD_SYNC_KEY);\n notifyTelemetryConsentListeners();\n } catch {\n // Ignore storage errors.\n }\n}\n\n/**\n * Set user's telemetry consent preference\n */\nexport async function setTelemetryConsent(\n consent: ResolvedTelemetryConsent,\n { syncToCloud = true }: SetTelemetryConsentOptions = {},\n): Promise<void> {\n if (!isBrowser()) {\n return;\n }\n\n try {\n localStorage.setItem(TELEMETRY_CONSENT_KEY, consent);\n if (telemetryDisabled) return;\n\n // Reuse an initialized client synchronously so a same-flush identify()\n // cannot run before consent is applied. Only the cold path awaits import.\n const posthog = posthogInstance ?? (await initializePostHogClient());\n if (!posthog) {\n return;\n }\n\n if (consent === \"granted\") {\n posthog.opt_in_capturing();\n applyDesiredTelemetryIdentity(posthog);\n } else {\n if (posthog.get_property(\"$user_id\") != null) {\n resetPostHogIdentity(posthog);\n } else {\n posthog.opt_out_capturing();\n }\n }\n } catch {\n // Ignore storage errors\n } finally {\n // Notify UI/backend/identity reconcilers only after the browser capture state\n // reflects this decision. Otherwise a pre-login grant can trigger an\n // identify while PostHog is still opted out and lose funnel continuity.\n if (syncToCloud) {\n markTelemetryConsentForCloudSync(consent);\n }\n notifyTelemetryConsentListeners();\n }\n}\n\n/**\n * Declare the current Cloud identity. The telemetry service applies it only\n * after consent and owns all reset/account-switch semantics.\n */\nexport async function setTelemetryIdentity(\n distinctId: string | null,\n properties: Record<string, unknown> = {},\n): Promise<void> {\n const nextIdentity = distinctId === null ? null : { distinctId, properties };\n const unchanged =\n desiredTelemetryIdentity === nextIdentity ||\n (desiredTelemetryIdentity !== undefined &&\n desiredTelemetryIdentity !== null &&\n nextIdentity !== null &&\n desiredTelemetryIdentity.distinctId === nextIdentity.distinctId &&\n propertiesEqual(desiredTelemetryIdentity.properties, properties));\n if (unchanged) return;\n\n desiredTelemetryIdentity = nextIdentity;\n desiredIdentityRevision += 1;\n appliedIdentityRevision = -1;\n\n if (!isTelemetryEnabled()) return;\n const posthog = posthogInstance ?? (await initializePostHogClient());\n if (posthog && isTelemetryEnabled()) {\n // Read the desired identity after the await so a newer account always wins\n // if identity changes while the SDK is loading.\n applyDesiredTelemetryIdentity(posthog);\n }\n}\n\n/**\n * Check if telemetry is enabled (user has granted consent)\n */\nexport function isTelemetryEnabled(): boolean {\n return getTelemetryConsent() === \"granted\";\n}\n\n/**\n * Check if first use event has already been sent\n */\nfunction hasFirstUseSent(): boolean {\n if (!isBrowser()) {\n return false;\n }\n\n try {\n return localStorage.getItem(TELEMETRY_FIRST_USE_KEY) === \"true\";\n } catch {\n return false;\n }\n}\n\n/**\n * Mark first use event as sent\n */\nfunction markFirstUseSent(): void {\n if (!isBrowser()) {\n return;\n }\n\n try {\n localStorage.setItem(TELEMETRY_FIRST_USE_KEY, \"true\");\n } catch {\n // Ignore storage errors\n }\n}\n\n/**\n * Track the initial install of the library.\n *\n * IMPORTANT: This is sent immediately on first use, regardless of consent status.\n * This allows us to track library adoption even if users haven't made a consent choice yet.\n *\n * The event is:\n * - Completely anonymous (no PII, just a random PostHog distinct_id)\n * - Sent only once per installation (tracked via localStorage, persists across sessions)\n * - Still respects DO_NOT_TRACK environment variable and browser setting\n *\n * Users who want complete privacy can:\n * - Set VITE_DO_NOT_TRACK=1 or browser's Do Not Track\n * - Later deny consent to prevent all future tracking\n */\nexport async function trackInstall(): Promise<void> {\n // Respect hard opt-out via environment variable or browser setting\n if (isDoNotTrackEnabled()) {\n return;\n }\n\n // Already sent install event (persisted in localStorage - survives app relaunches)\n if (hasFirstUseSent()) {\n return;\n }\n\n // Initialize PostHog with capturing enabled (for this one event)\n const posthog = await initializePostHogClient(true);\n if (!posthog || isDoNotTrackEnabled()) {\n return;\n }\n\n // Temporarily enable capturing if it was disabled\n const wasOptedOut = posthog.has_opted_out_capturing?.() ?? false;\n if (wasOptedOut) {\n posthog.opt_in_capturing();\n }\n\n // Capture the install event\n posthog.capture(\"canvas_install\", {\n platform: typeof navigator !== \"undefined\" ? navigator.platform : \"unknown\",\n user_agent:\n typeof navigator !== \"undefined\" ? navigator.userAgent : \"unknown\",\n referrer: typeof document !== \"undefined\" ? document.referrer : \"\",\n url_origin: typeof window !== \"undefined\" ? window.location.origin : \"\",\n embedded: typeof window !== \"undefined\" && window.self !== window.top,\n });\n\n // Mark as sent (stored in localStorage - persists across browser sessions)\n markFirstUseSent();\n\n // Restore opt-out state if user hasn't granted consent yet\n // This ensures we only send the install event, not subsequent events\n const currentConsent = getTelemetryConsent();\n if (currentConsent !== \"granted\") {\n posthog.opt_out_capturing();\n }\n}\n\n/**\n * Check if session start event has already been sent (this browser session)\n */\nfunction hasSessionSent(): boolean {\n if (!isBrowser()) {\n return false;\n }\n\n try {\n return sessionStorage.getItem(TELEMETRY_SESSION_KEY) === \"true\";\n } catch {\n return false;\n }\n}\n\n/**\n * Mark session start event as sent (uses sessionStorage so it resets on new tabs/sessions)\n */\nfunction markSessionSent(): void {\n if (!isBrowser()) {\n return;\n }\n\n try {\n sessionStorage.setItem(TELEMETRY_SESSION_KEY, \"true\");\n } catch {\n // Ignore storage errors\n }\n}\n\n/** Return the shared client only when a consented capture is safe to emit. */\nasync function getPostHogForConsentedCapture(): Promise<PostHog | null> {\n if (!isTelemetryEnabled()) return null;\n\n const posthog = await initializePostHogClient();\n if (!posthog || !isTelemetryEnabled()) return null;\n\n // The browser preference is the canonical capture decision. PostHog may\n // still carry an older opt-out marker while backend consent is loading or\n // after a previous backend temporarily reported a stale value. Heal that\n // drift at the event boundary so capture() cannot silently discard an event\n // that the user has explicitly allowed.\n if (posthog.has_opted_out_capturing?.()) {\n posthog.opt_in_capturing();\n }\n\n applyDesiredTelemetryIdentity(posthog);\n\n return posthog;\n}\n\n/**\n * Track a session start event.\n * Called each time a new browser session starts (respects consent).\n * Uses sessionStorage for deduplication - only sends once per browser session.\n */\nexport async function trackSessionStart(): Promise<void> {\n // Already sent session event this browser session\n if (hasSessionSent()) {\n return;\n }\n\n const posthog = await getPostHogForConsentedCapture();\n if (!posthog) return;\n\n posthog.capture(\"canvas_new_session\", {\n is_first_use: !hasFirstUseSent(),\n });\n\n // Mark as sent for this session\n markSessionSent();\n}\n\n/**\n * Track a custom event (respects consent).\n */\nexport async function trackEvent(\n eventName: string,\n properties: Record<string, unknown> = {},\n): Promise<void> {\n const posthog = await getPostHogForConsentedCapture();\n if (!posthog) return;\n\n posthog.capture(eventName, properties);\n}\n\n/** Track an exception through the same consent-aware client as custom events. */\nexport async function trackException(\n error: unknown,\n properties: Record<string, unknown> = {},\n): Promise<void> {\n const posthog = await getPostHogForConsentedCapture();\n if (!posthog) return;\n\n posthog.captureException(error, properties);\n}\n\n/**\n * Clear all telemetry data (for privacy/GDPR requests)\n */\nexport async function clearTelemetryData(): Promise<void> {\n if (!isBrowser()) {\n return;\n }\n\n try {\n localStorage.removeItem(TELEMETRY_CONSENT_KEY);\n localStorage.removeItem(TELEMETRY_FIRST_USE_KEY);\n } catch {\n // Continue clearing the in-memory and SDK identity if storage is blocked.\n }\n clearPendingCloudTelemetryConsent();\n try {\n sessionStorage.removeItem(TELEMETRY_SESSION_KEY);\n } catch {\n // Continue clearing the in-memory and SDK identity if storage is blocked.\n }\n\n desiredTelemetryIdentity = null;\n desiredIdentityRevision += 1;\n appliedIdentityRevision = -1;\n\n try {\n if (posthogInstance) {\n resetPostHogIdentity(posthogInstance, true);\n }\n } catch {\n // A reset failure must not leave capture enabled after a privacy clear.\n try {\n posthogInstance?.opt_out_capturing();\n } catch {\n // Telemetry failures must not break the application.\n }\n }\n}\n"],"mappings":";;;AAmCA,IAAM,IAAwB,+BACxB,IACJ,kDACI,IAAiC,sCACjC,IAA0B,iCAC1B,IAAwB,+BACxB,IAAw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CAAC,GAAoB,GAAS,QAO1C,EAAQ,2BAA2B,IACrC,EAAQ,kBAAkB,EAG5B,EAA8B,EAAQ,EAE/B;;AAQT,eAAsB,IAAmC;AAEvD,KAAI,GAAgB,CAClB;CAGF,IAAM,IAAU,MAAM,GAA+B;AAChD,OAEL,EAAQ,QAAQ,sBAAsB,EACpC,cAAc,CAAC,GAAiB,EACjC,CAAC,EAGF,GAAiB;;AAMnB,eAAsB,EACpB,GACA,IAAsC,EAAE,EACzB;CACf,IAAM,IAAU,MAAM,GAA+B;AAChD,MAEL,EAAQ,QAAQ,GAAW,EAAW;;AAIxC,eAAsB,EACpB,GACA,IAAsC,EAAE,EACzB;CACf,IAAM,IAAU,MAAM,GAA+B;AAChD,MAEL,EAAQ,iBAAiB,GAAO,EAAW;;AAM7C,eAAsB,IAAoC;AACnD,QAAW,EAIhB;MAAI;AAEF,GADA,aAAa,WAAW,EAAsB,EAC9C,aAAa,WAAW,EAAwB;UAC1C;AAGR,KAAmC;AACnC,MAAI;AACF,kBAAe,WAAW,EAAsB;UAC1C;AAMR,EAFA,IAA2B,MAC3B,KAA2B,GAC3B,IAA0B;AAE1B,MAAI;AACF,GAAI,KACF,EAAqB,GAAiB,GAAK;UAEvC;AAEN,OAAI;AACF,OAAiB,mBAAmB;WAC9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-themes.cjs","names":[],"sources":["../../src/themes/color-themes.ts"],"sourcesContent":["export type ColorThemeKey =\n | \"openhands-deepsea\"\n | \"openhands-neutral\"\n | \"openhands-neo\";\n\nexport interface ColorThemeDefinition {\n label: string;\n /** Overrides for --cool-grey-* CSS custom properties (our semantic scale) */\n scale: Record<string, string>;\n /**\n * Overrides for --heroui-* CSS custom properties.\n * HeroUI stores colors as space-separated HSL channels (\"H S% L%\") so Tailwind\n * utilities like bg-default-200 resolve to hsl(var(--heroui-default-200)).\n * These vars are set by the heroui() plugin on :root, [data-theme=dark] at\n * build time, so they must be overridden at the same or lower specificity\n * from a later stylesheet to pick up theme changes at runtime.\n */\n heroui: Record<string, string>;\n /** Overrides for --oh-* semantic tokens such as brand / button colors. */\n tokens?: Record<string, string>;\n}\n\n// HSL channel strings for the neutral grey palette (H=0, S=0%, L=hex/255*100)\n// prettier-ignore\nconst NEUTRAL_HSL = {\n 50: \"0 0% 96.86%\", // #F7F7F7\n 100: \"0 0% 92.55%\", // #ECECEC\n 200: \"0 0% 86.27%\", // #DCDCDC\n 300: \"0 0% 74.51%\", // #BEBEBE\n 400: \"0 0% 59.22%\", // #979797\n 500: \"0 0% 45.1%\", // #737373\n 600: \"0 0% 33.73%\", // #565656\n 700: \"0 0% 25.1%\", // #404040\n 800: \"0 0% 19.22%\", // #313131\n 850: \"0 0% 15.69%\", // #282828\n 900: \"0 0% 12.55%\", // #202020\n 950: \"0 0% 9.41%\", // #181818\n 975: \"0 0% 6.27%\", // #101010\n};\n\nconst NEUTRAL_SCALE = {\n \"--cool-grey-50\": \"#F7F7F7\",\n \"--cool-grey-100\": \"#ECECEC\",\n \"--cool-grey-200\": \"#DCDCDC\",\n \"--cool-grey-300\": \"#BEBEBE\",\n \"--cool-grey-400\": \"#979797\",\n \"--cool-grey-500\": \"#737373\",\n \"--cool-grey-600\": \"#565656\",\n \"--cool-grey-700\": \"#404040\",\n \"--cool-grey-800\": \"#313131\",\n \"--cool-grey-900\": \"#282828\",\n \"--cool-grey-925\": \"#202020\",\n \"--cool-grey-950\": \"#181818\",\n \"--cool-grey-975\": \"#101010\",\n};\n\nconst NEUTRAL_HEROUI = {\n \"--heroui-background\": NEUTRAL_HSL[950],\n \"--heroui-background-foreground\": NEUTRAL_HSL[50],\n \"--heroui-foreground-50\": NEUTRAL_HSL[975],\n \"--heroui-foreground-100\": NEUTRAL_HSL[950],\n \"--heroui-foreground-200\": NEUTRAL_HSL[900],\n \"--heroui-foreground-300\": NEUTRAL_HSL[850],\n \"--heroui-foreground-400\": NEUTRAL_HSL[800],\n \"--heroui-foreground-500\": NEUTRAL_HSL[700],\n \"--heroui-foreground-600\": NEUTRAL_HSL[600],\n \"--heroui-foreground-700\": NEUTRAL_HSL[500],\n \"--heroui-foreground-800\": NEUTRAL_HSL[400],\n \"--heroui-foreground-900\": NEUTRAL_HSL[300],\n \"--heroui-foreground\": NEUTRAL_HSL[300],\n \"--heroui-content1\": NEUTRAL_HSL[900],\n \"--heroui-content1-foreground\": NEUTRAL_HSL[100],\n \"--heroui-content2\": NEUTRAL_HSL[850],\n \"--heroui-content2-foreground\": NEUTRAL_HSL[200],\n \"--heroui-content3\": NEUTRAL_HSL[800],\n \"--heroui-content3-foreground\": NEUTRAL_HSL[300],\n \"--heroui-content4\": NEUTRAL_HSL[700],\n \"--heroui-content4-foreground\": NEUTRAL_HSL[400],\n \"--heroui-default-50\": NEUTRAL_HSL[975],\n \"--heroui-default-100\": NEUTRAL_HSL[950],\n \"--heroui-default-200\": NEUTRAL_HSL[900],\n \"--heroui-default-300\": NEUTRAL_HSL[850],\n \"--heroui-default-400\": NEUTRAL_HSL[800],\n \"--heroui-default-500\": NEUTRAL_HSL[700],\n \"--heroui-default-600\": NEUTRAL_HSL[600],\n \"--heroui-default-700\": NEUTRAL_HSL[500],\n \"--heroui-default-800\": NEUTRAL_HSL[400],\n \"--heroui-default-900\": NEUTRAL_HSL[300],\n \"--heroui-default-foreground\": NEUTRAL_HSL[50],\n \"--heroui-default\": NEUTRAL_HSL[800],\n};\n\nimport { AGENT_SERVER_UI_THEMEABLE_BRAND_VARIABLES } from \"#/styles/agent-server-ui-style-scope\";\n\n/** CSS custom properties overridden by color themes (see applyColorTheme). */\nexport const COLOR_THEME_TOKEN_KEYS = AGENT_SERVER_UI_THEMEABLE_BRAND_VARIABLES;\n\n/** White primary/accent tokens — used by OpenHands-Neo for button surfaces. */\nconst NEO_WHITE_BUTTON_TOKENS: Record<\n (typeof COLOR_THEME_TOKEN_KEYS)[number],\n string\n> = {\n \"--oh-color-primary\": \"#ffffff\",\n \"--oh-accent\": \"#ffffff\",\n \"--oh-warning\": \"#ffffff\",\n};\n\nexport const COLOR_THEMES: Record<ColorThemeKey, ColorThemeDefinition> = {\n \"openhands-deepsea\": {\n label: \"OpenHands-DeepSea\",\n // Matches the values already set by index.css; included so switching back\n // from another theme restores the original palette explicitly.\n scale: {\n \"--cool-grey-50\": \"#F7F9FC\",\n \"--cool-grey-100\": \"#EEF2F7\",\n \"--cool-grey-200\": \"#DCE3EE\",\n \"--cool-grey-300\": \"#C3CDDC\",\n \"--cool-grey-400\": \"#A3B0C4\",\n \"--cool-grey-500\": \"#7E8A9E\",\n \"--cool-grey-600\": \"#626D82\",\n \"--cool-grey-700\": \"#4B5468\",\n \"--cool-grey-800\": \"#383F50\",\n \"--cool-grey-900\": \"#2C313F\",\n \"--cool-grey-925\": \"#21252F\",\n \"--cool-grey-950\": \"#0B0E14\",\n \"--cool-grey-975\": \"#05070A\",\n },\n // Values generated by heroui() from hero.ts — restore them explicitly when\n // switching back from another theme.\n heroui: {\n \"--heroui-background\": \"220 29.03% 6.08%\",\n \"--heroui-background-foreground\": \"216 45.45% 97.84%\",\n \"--heroui-foreground-50\": \"216 33.33% 2.94%\",\n \"--heroui-foreground-100\": \"220 29.03% 6.08%\",\n \"--heroui-foreground-200\": \"222.86 17.5% 15.69%\",\n \"--heroui-foreground-300\": \"224.21 17.76% 20.98%\",\n \"--heroui-foreground-400\": \"222.5 17.65% 26.67%\",\n \"--heroui-foreground-500\": \"221.38 16.2% 35.1%\",\n \"--heroui-foreground-600\": \"219.38 14.04% 44.71%\",\n \"--heroui-foreground-700\": \"217.5 14.16% 55.69%\",\n \"--heroui-foreground-800\": \"216.36 21.85% 70.39%\",\n \"--heroui-foreground-900\": \"216 26.32% 81.37%\",\n \"--heroui-foreground\": \"216 26.32% 81.37%\",\n \"--heroui-content1\": \"222.86 17.5% 15.69%\",\n \"--heroui-content1-foreground\": \"213.33 36% 95.1%\",\n \"--heroui-content2\": \"224.21 17.76% 20.98%\",\n \"--heroui-content2-foreground\": \"216.67 34.62% 89.8%\",\n \"--heroui-content3\": \"222.5 17.65% 26.67%\",\n \"--heroui-content3-foreground\": \"216 26.32% 81.37%\",\n \"--heroui-content4\": \"221.38 16.2% 35.1%\",\n \"--heroui-content4-foreground\": \"216.36 21.85% 70.39%\",\n \"--heroui-default-50\": \"216 33.33% 2.94%\",\n \"--heroui-default-100\": \"220 29.03% 6.08%\",\n \"--heroui-default-200\": \"222.86 17.5% 15.69%\",\n \"--heroui-default-300\": \"224.21 17.76% 20.98%\",\n \"--heroui-default-400\": \"222.5 17.65% 26.67%\",\n \"--heroui-default-500\": \"221.38 16.2% 35.1%\",\n \"--heroui-default-600\": \"219.38 14.04% 44.71%\",\n \"--heroui-default-700\": \"217.5 14.16% 55.69%\",\n \"--heroui-default-800\": \"216.36 21.85% 70.39%\",\n \"--heroui-default-900\": \"216 26.32% 81.37%\",\n \"--heroui-default-foreground\": \"216 45.45% 97.84%\",\n \"--heroui-default\": \"222.5 17.65% 26.67%\",\n },\n },\n\n \"openhands-neutral\": {\n label: \"OpenHands-Neutral\",\n scale: NEUTRAL_SCALE,\n // Each stop follows the same positional mapping as hero.ts:\n // heroui-default-100 ← cool-grey-950 position ← neutral-950 (#181818)\n // heroui-default-200 ← cool-grey-925 position ← neutral-900 (#202020)\n // ...etc.\n heroui: NEUTRAL_HEROUI,\n },\n\n \"openhands-neo\": {\n label: \"OpenHands-Neo\",\n scale: NEUTRAL_SCALE,\n heroui: NEUTRAL_HEROUI,\n tokens: NEO_WHITE_BUTTON_TOKENS,\n },\n};\n\nexport const DEFAULT_COLOR_THEME: ColorThemeKey = \"openhands-neutral\";\n\nexport const AVAILABLE_COLOR_THEMES = Object.entries(COLOR_THEMES).map(\n ([key, def]) => ({ key: key as ColorThemeKey, label: def.label }),\n);\n\nconst STORAGE_KEY = \"openhands-color-theme\";\n\n/** Read the persisted theme key from localStorage, falling back to the default. */\nexport function readPersistedColorTheme(): ColorThemeKey {\n if (typeof window === \"undefined\") return DEFAULT_COLOR_THEME;\n try {\n const stored = window.localStorage.getItem(STORAGE_KEY);\n if (stored && stored in COLOR_THEMES) return stored as ColorThemeKey;\n } catch {\n // ignore quota / privacy-mode failures\n }\n return DEFAULT_COLOR_THEME;\n}\n\n/** Persist the theme key to localStorage. */\nexport function persistColorTheme(key: ColorThemeKey): void {\n try {\n window.localStorage.setItem(STORAGE_KEY, key);\n } catch {\n // ignore\n }\n}\n\nconst THEME_STYLE_TAG_ID = \"oh-color-theme-override\";\n\n/**\n * Apply a theme by injecting (or replacing) a <style> tag that overrides\n * both our custom --cool-grey-* primitives and HeroUI's --heroui-* tokens.\n *\n * Why a <style> tag:\n * PostCSS transforms :root / body to [data-agent-server-ui], so --cool-grey-*\n * is set on EVERY element carrying that attribute. A body inline-style only\n * overrides body itself — inner matching elements keep the stylesheet value.\n *\n * Why heroui variables:\n * HeroUI stores colors as HSL channels in --heroui-* vars on [data-theme=dark].\n * They reference their own token system and are unaffected by --cool-grey-*\n * changes, so we override them from the same injected sheet.\n *\n * Why doubled selectors + re-append on every call:\n * \"Later sheet wins the tie\" cannot be relied on: in the built SPA\n * (ssr:false, prerendered shell) React 19 re-creates the <head> elements it\n * manages (<Meta/>/<Links/>) whenever the tree above the router remounts —\n * e.g. PostHogWrapper swapping in <PostHogProvider> once the analytics key\n * resolves, which only happens in builds with VITE_POSTHOG_CLIENT_KEY baked\n * (the published npm package / tagged Docker images). That re-inserts the\n * base stylesheet <link> AFTER this tag, which would let the base sheet's\n * unlayered [data-agent-server-ui] variable rules (0,1,0) win every tie.\n * Doubling the attribute selectors ([x][x], 0,2,0) beats them from any\n * position in <head>; re-appending on each apply keeps document order\n * favorable as well.\n */\nexport function applyColorTheme(key: ColorThemeKey): void {\n if (typeof document === \"undefined\") return;\n const { scale, heroui, tokens = {} } = COLOR_THEMES[key];\n\n const scaleDecls = Object.entries(scale)\n .map(([p, v]) => ` ${p}: ${v};`)\n .join(\"\\n\");\n\n const herouiDecls = Object.entries(heroui)\n .map(([p, v]) => ` ${p}: ${v};`)\n .join(\"\\n\");\n\n const tokenDecls = Object.entries(tokens)\n .map(([p, v]) => ` ${p}: ${v};`)\n .join(\"\\n\");\n\n // Target both selectors for heroui vars:\n // [data-agent-server-ui] — covers document.body (portal destination) so\n // portalled popover/listbox content inherits the overridden values.\n // [data-theme=dark] — covers the inner AgentServerUIRoot wrapper so\n // components scoped inside the dark theme wrapper also pick them up.\n // Both are doubled to out-specify the base sheet regardless of stylesheet\n // order (see the doc comment above).\n const css = [\n `[data-agent-server-ui][data-agent-server-ui] {\\n${scaleDecls}\\n${herouiDecls}\\n${tokenDecls}\\n}`,\n `[data-theme=dark][data-theme=dark] {\\n${herouiDecls}\\n}`,\n ].join(\"\\n\");\n\n let styleEl = document.getElementById(\n THEME_STYLE_TAG_ID,\n ) as HTMLStyleElement | null;\n if (!styleEl) {\n styleEl = document.createElement(\"style\");\n styleEl.id = THEME_STYLE_TAG_ID;\n }\n styleEl.textContent = css;\n // Re-append even when the tag already exists (appendChild relocates a\n // connected node) so the override also stays after any re-inserted <link>.\n document.head.appendChild(styleEl);\n\n syncColorThemeTokensOnScopeRoots(tokens);\n}\n\nfunction syncColorThemeTokensOnScopeRoots(\n tokens: Record<string, string>,\n): void {\n const roots = document.querySelectorAll(\"[data-agent-server-ui]\");\n for (const root of roots) {\n if (!(root instanceof HTMLElement)) continue;\n\n for (const key of COLOR_THEME_TOKEN_KEYS) {\n const value = tokens[key];\n if (value) {\n root.style.setProperty(key, value);\n } else {\n root.style.removeProperty(key);\n }\n }\n }\n}\n"],"mappings":"0GAwBA,IAAM,EAAc,CAClB,GAAK,cACL,IAAK,cACL,IAAK,cACL,IAAK,cACL,IAAK,cACL,IAAK,aACL,IAAK,cACL,IAAK,aACL,IAAK,cACL,IAAK,cACL,IAAK,cACL,IAAK,aACL,IAAK,aACN,CAEK,EAAgB,CACpB,iBAAkB,UAClB,kBAAmB,UACnB,kBAAmB,UACnB,kBAAmB,UACnB,kBAAmB,UACnB,kBAAmB,UACnB,kBAAmB,UAC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AAO,KAAK,EAAE,IAAI,EAAE,GAAG,CAChC,KAAK;EAAK,CAaP,EAAM,CACV,mDAAmD,EAAW,IAAI,EAAY,IAZ7D,OAAO,QAAQ,EAAO,CACtC,KAAK,CAAC,EAAG,KAAO,KAAK,EAAE,IAAI,EAAE,GAAG,CAChC,KAAK;EAU4E,CAAW,KAC7F,yCAAyC,EAAY,KACtD,CAAC,KAAK;EAAK,CAER,EAAU,SAAS,eACrB,EACD,CACI,IACH,EAAU,SAAS,cAAc,QAAQ,CACzC,EAAQ,GAAK,GAEf,EAAQ,YAAc,EAGtB,SAAS,KAAK,YAAY,EAAQ,CAElC,EAAiC,EAAO,CAG1C,SAAS,EACP,EACM,CACN,IAAM,EAAQ,SAAS,iBAAiB,yBAAyB,CACjE,IAAK,IAAM,KAAQ,EACX,gBAAgB,YAEtB,IAAK,IAAM,KAAO,EAAwB,CACxC,IAAM,EAAQ,EAAO,GACjB,EACF,EAAK,MAAM,YAAY,EAAK,EAAM,CAElC,EAAK,MAAM,eAAe,EAAI"}
|
|
1
|
+
{"version":3,"file":"color-themes.cjs","names":[],"sources":["../../src/themes/color-themes.ts"],"sourcesContent":["export type ColorThemeKey =\n | \"openhands-deepsea\"\n | \"openhands-neutral\"\n | \"openhands-neo\";\n\nexport interface ColorThemeDefinition {\n label: string;\n /** Overrides for --cool-grey-* CSS custom properties (our semantic scale) */\n scale: Record<string, string>;\n /**\n * Overrides for --heroui-* CSS custom properties.\n * HeroUI stores colors as space-separated HSL channels (\"H S% L%\") so Tailwind\n * utilities like bg-default-200 resolve to hsl(var(--heroui-default-200)).\n * These vars are set by the heroui() plugin on :root, [data-theme=dark] at\n * build time, so they must be overridden at the same or lower specificity\n * from a later stylesheet to pick up theme changes at runtime.\n */\n heroui: Record<string, string>;\n /** Overrides for --oh-* semantic tokens such as brand / button colors. */\n tokens?: Record<string, string>;\n}\n\n// HSL channel strings for the neutral grey palette (H=0, S=0%, L=hex/255*100)\n// prettier-ignore\nconst NEUTRAL_HSL = {\n 50: \"0 0% 96.86%\", // #F7F7F7\n 100: \"0 0% 92.55%\", // #ECECEC\n 200: \"0 0% 86.27%\", // #DCDCDC\n 300: \"0 0% 74.51%\", // #BEBEBE\n 400: \"0 0% 59.22%\", // #979797\n 500: \"0 0% 45.1%\", // #737373\n 600: \"0 0% 33.73%\", // #565656\n 700: \"0 0% 25.1%\", // #404040\n 800: \"0 0% 19.22%\", // #313131\n 850: \"0 0% 15.69%\", // #282828\n 900: \"0 0% 12.55%\", // #202020\n 950: \"0 0% 9.41%\", // #181818\n 975: \"0 0% 6.27%\", // #101010\n};\n\nconst NEUTRAL_SCALE = {\n \"--cool-grey-50\": \"#F7F7F7\",\n \"--cool-grey-100\": \"#ECECEC\",\n \"--cool-grey-200\": \"#DCDCDC\",\n \"--cool-grey-300\": \"#BEBEBE\",\n \"--cool-grey-400\": \"#979797\",\n \"--cool-grey-500\": \"#737373\",\n \"--cool-grey-600\": \"#565656\",\n \"--cool-grey-700\": \"#404040\",\n \"--cool-grey-800\": \"#313131\",\n \"--cool-grey-900\": \"#282828\",\n \"--cool-grey-925\": \"#202020\",\n \"--cool-grey-950\": \"#181818\",\n \"--cool-grey-975\": \"#101010\",\n};\n\nconst NEUTRAL_HEROUI = {\n \"--heroui-background\": NEUTRAL_HSL[950],\n \"--heroui-background-foreground\": NEUTRAL_HSL[50],\n \"--heroui-foreground-50\": NEUTRAL_HSL[975],\n \"--heroui-foreground-100\": NEUTRAL_HSL[950],\n \"--heroui-foreground-200\": NEUTRAL_HSL[900],\n \"--heroui-foreground-300\": NEUTRAL_HSL[850],\n \"--heroui-foreground-400\": NEUTRAL_HSL[800],\n \"--heroui-foreground-500\": NEUTRAL_HSL[700],\n \"--heroui-foreground-600\": NEUTRAL_HSL[600],\n \"--heroui-foreground-700\": NEUTRAL_HSL[500],\n \"--heroui-foreground-800\": NEUTRAL_HSL[400],\n \"--heroui-foreground-900\": NEUTRAL_HSL[300],\n \"--heroui-foreground\": NEUTRAL_HSL[300],\n \"--heroui-content1\": NEUTRAL_HSL[900],\n \"--heroui-content1-foreground\": NEUTRAL_HSL[100],\n \"--heroui-content2\": NEUTRAL_HSL[850],\n \"--heroui-content2-foreground\": NEUTRAL_HSL[200],\n \"--heroui-content3\": NEUTRAL_HSL[800],\n \"--heroui-content3-foreground\": NEUTRAL_HSL[300],\n \"--heroui-content4\": NEUTRAL_HSL[700],\n \"--heroui-content4-foreground\": NEUTRAL_HSL[400],\n \"--heroui-default-50\": NEUTRAL_HSL[975],\n \"--heroui-default-100\": NEUTRAL_HSL[950],\n \"--heroui-default-200\": NEUTRAL_HSL[900],\n \"--heroui-default-300\": NEUTRAL_HSL[850],\n \"--heroui-default-400\": NEUTRAL_HSL[800],\n \"--heroui-default-500\": NEUTRAL_HSL[700],\n \"--heroui-default-600\": NEUTRAL_HSL[600],\n \"--heroui-default-700\": NEUTRAL_HSL[500],\n \"--heroui-default-800\": NEUTRAL_HSL[400],\n \"--heroui-default-900\": NEUTRAL_HSL[300],\n \"--heroui-default-foreground\": NEUTRAL_HSL[50],\n \"--heroui-default\": NEUTRAL_HSL[800],\n};\n\nimport { AGENT_SERVER_UI_THEMEABLE_BRAND_VARIABLES } from \"#/styles/agent-server-ui-style-scope\";\n\n/** CSS custom properties overridden by color themes (see applyColorTheme). */\nexport const COLOR_THEME_TOKEN_KEYS = AGENT_SERVER_UI_THEMEABLE_BRAND_VARIABLES;\n\n/** White primary/accent tokens — used by OpenHands-Neo for button surfaces. */\nconst NEO_WHITE_BUTTON_TOKENS: Record<\n (typeof COLOR_THEME_TOKEN_KEYS)[number],\n string\n> = {\n \"--oh-color-primary\": \"#ffffff\",\n \"--oh-accent\": \"#ffffff\",\n \"--oh-warning\": \"#ffffff\",\n};\n\nexport const COLOR_THEMES: Record<ColorThemeKey, ColorThemeDefinition> = {\n \"openhands-deepsea\": {\n label: \"OpenHands-DeepSea\",\n // Matches the values already set by index.css; included so switching back\n // from another theme restores the original palette explicitly.\n scale: {\n \"--cool-grey-50\": \"#F7F9FC\",\n \"--cool-grey-100\": \"#EEF2F7\",\n \"--cool-grey-200\": \"#DCE3EE\",\n \"--cool-grey-300\": \"#C3CDDC\",\n \"--cool-grey-400\": \"#A3B0C4\",\n \"--cool-grey-500\": \"#7E8A9E\",\n \"--cool-grey-600\": \"#626D82\",\n \"--cool-grey-700\": \"#4B5468\",\n \"--cool-grey-800\": \"#383F50\",\n \"--cool-grey-900\": \"#2C313F\",\n \"--cool-grey-925\": \"#21252F\",\n \"--cool-grey-950\": \"#0B0E14\",\n \"--cool-grey-975\": \"#05070A\",\n },\n // Values generated by heroui() from hero.ts — restore them explicitly when\n // switching back from another theme.\n heroui: {\n \"--heroui-background\": \"220 29.03% 6.08%\",\n \"--heroui-background-foreground\": \"216 45.45% 97.84%\",\n \"--heroui-foreground-50\": \"216 33.33% 2.94%\",\n \"--heroui-foreground-100\": \"220 29.03% 6.08%\",\n \"--heroui-foreground-200\": \"222.86 17.5% 15.69%\",\n \"--heroui-foreground-300\": \"224.21 17.76% 20.98%\",\n \"--heroui-foreground-400\": \"222.5 17.65% 26.67%\",\n \"--heroui-foreground-500\": \"221.38 16.2% 35.1%\",\n \"--heroui-foreground-600\": \"219.38 14.04% 44.71%\",\n \"--heroui-foreground-700\": \"217.5 14.16% 55.69%\",\n \"--heroui-foreground-800\": \"216.36 21.85% 70.39%\",\n \"--heroui-foreground-900\": \"216 26.32% 81.37%\",\n \"--heroui-foreground\": \"216 26.32% 81.37%\",\n \"--heroui-content1\": \"222.86 17.5% 15.69%\",\n \"--heroui-content1-foreground\": \"213.33 36% 95.1%\",\n \"--heroui-content2\": \"224.21 17.76% 20.98%\",\n \"--heroui-content2-foreground\": \"216.67 34.62% 89.8%\",\n \"--heroui-content3\": \"222.5 17.65% 26.67%\",\n \"--heroui-content3-foreground\": \"216 26.32% 81.37%\",\n \"--heroui-content4\": \"221.38 16.2% 35.1%\",\n \"--heroui-content4-foreground\": \"216.36 21.85% 70.39%\",\n \"--heroui-default-50\": \"216 33.33% 2.94%\",\n \"--heroui-default-100\": \"220 29.03% 6.08%\",\n \"--heroui-default-200\": \"222.86 17.5% 15.69%\",\n \"--heroui-default-300\": \"224.21 17.76% 20.98%\",\n \"--heroui-default-400\": \"222.5 17.65% 26.67%\",\n \"--heroui-default-500\": \"221.38 16.2% 35.1%\",\n \"--heroui-default-600\": \"219.38 14.04% 44.71%\",\n \"--heroui-default-700\": \"217.5 14.16% 55.69%\",\n \"--heroui-default-800\": \"216.36 21.85% 70.39%\",\n \"--heroui-default-900\": \"216 26.32% 81.37%\",\n \"--heroui-default-foreground\": \"216 45.45% 97.84%\",\n \"--heroui-default\": \"222.5 17.65% 26.67%\",\n },\n },\n\n \"openhands-neutral\": {\n label: \"OpenHands-Neutral\",\n scale: NEUTRAL_SCALE,\n // Each stop follows the same positional mapping as hero.ts:\n // heroui-default-100 ← cool-grey-950 position ← neutral-950 (#181818)\n // heroui-default-200 ← cool-grey-925 position ← neutral-900 (#202020)\n // ...etc.\n heroui: NEUTRAL_HEROUI,\n },\n\n \"openhands-neo\": {\n label: \"OpenHands-Neo\",\n scale: NEUTRAL_SCALE,\n heroui: NEUTRAL_HEROUI,\n tokens: NEO_WHITE_BUTTON_TOKENS,\n },\n};\n\nexport const DEFAULT_COLOR_THEME: ColorThemeKey = \"openhands-neutral\";\n\nexport const AVAILABLE_COLOR_THEMES = Object.entries(COLOR_THEMES).map(\n ([key, def]) => ({ key: key as ColorThemeKey, label: def.label }),\n);\n\nconst STORAGE_KEY = \"openhands-color-theme\";\n\n/** Read the persisted theme key from localStorage, falling back to the default. */\nexport function readPersistedColorTheme(): ColorThemeKey {\n if (typeof window === \"undefined\") return DEFAULT_COLOR_THEME;\n try {\n const stored = window.localStorage.getItem(STORAGE_KEY);\n if (stored && stored in COLOR_THEMES) return stored as ColorThemeKey;\n } catch {\n // ignore quota / privacy-mode failures\n }\n return DEFAULT_COLOR_THEME;\n}\n\n/** Persist the theme key to localStorage. */\nexport function persistColorTheme(key: ColorThemeKey): void {\n try {\n window.localStorage.setItem(STORAGE_KEY, key);\n } catch {\n // ignore\n }\n}\n\nconst THEME_STYLE_TAG_ID = \"oh-color-theme-override\";\n\n/**\n * Apply a theme by injecting (or replacing) a <style> tag that overrides\n * both our custom --cool-grey-* primitives and HeroUI's --heroui-* tokens.\n *\n * Why a <style> tag:\n * PostCSS transforms :root / body to [data-agent-server-ui], so --cool-grey-*\n * is set on EVERY element carrying that attribute. A body inline-style only\n * overrides body itself — inner matching elements keep the stylesheet value.\n *\n * Why heroui variables:\n * HeroUI stores colors as HSL channels in --heroui-* vars on [data-theme=dark].\n * They reference their own token system and are unaffected by --cool-grey-*\n * changes, so we override them from the same injected sheet.\n *\n * Why doubled selectors + re-append on every call:\n * \"Later sheet wins the tie\" cannot be relied on: in the built SPA\n * (ssr:false, prerendered shell) React 19 re-creates the <head> elements it\n * manages (<Meta/>/<Links/>) whenever the tree above the router remounts.\n * That can re-insert the base stylesheet <link> AFTER this tag, allowing its\n * unlayered [data-agent-server-ui] variable rules (0,1,0) to win every tie.\n * Doubling the attribute selectors ([x][x], 0,2,0) beats them from any\n * position in <head>; re-appending on each apply keeps document order\n * favorable as well.\n */\nexport function applyColorTheme(key: ColorThemeKey): void {\n if (typeof document === \"undefined\") return;\n const { scale, heroui, tokens = {} } = COLOR_THEMES[key];\n\n const scaleDecls = Object.entries(scale)\n .map(([p, v]) => ` ${p}: ${v};`)\n .join(\"\\n\");\n\n const herouiDecls = Object.entries(heroui)\n .map(([p, v]) => ` ${p}: ${v};`)\n .join(\"\\n\");\n\n const tokenDecls = Object.entries(tokens)\n .map(([p, v]) => ` ${p}: ${v};`)\n .join(\"\\n\");\n\n // Target both selectors for heroui vars:\n // [data-agent-server-ui] — covers document.body (portal destination) so\n // portalled popover/listbox content inherits the overridden values.\n // [data-theme=dark] — covers the inner AgentServerUIRoot wrapper so\n // components scoped inside the dark theme wrapper also pick them up.\n // Both are doubled to out-specify the base sheet regardless of stylesheet\n // order (see the doc comment above).\n const css = [\n `[data-agent-server-ui][data-agent-server-ui] {\\n${scaleDecls}\\n${herouiDecls}\\n${tokenDecls}\\n}`,\n `[data-theme=dark][data-theme=dark] {\\n${herouiDecls}\\n}`,\n ].join(\"\\n\");\n\n let styleEl = document.getElementById(\n THEME_STYLE_TAG_ID,\n ) as HTMLStyleElement | null;\n if (!styleEl) {\n styleEl = document.createElement(\"style\");\n styleEl.id = THEME_STYLE_TAG_ID;\n }\n styleEl.textContent = css;\n // Re-append even when the tag already exists (appendChild relocates a\n // connected node) so the override also stays after any re-inserted <link>.\n document.head.appendChild(styleEl);\n\n syncColorThemeTokensOnScopeRoots(tokens);\n}\n\nfunction syncColorThemeTokensOnScopeRoots(\n tokens: Record<string, string>,\n): void {\n const roots = document.querySelectorAll(\"[data-agent-server-ui]\");\n for (const root of roots) {\n if (!(root instanceof HTMLElement)) continue;\n\n for (const key of COLOR_THEME_TOKEN_KEYS) {\n const value = tokens[key];\n if (value) {\n root.style.setProperty(key, value);\n } else {\n root.style.removeProperty(key);\n }\n }\n }\n}\n"],"mappings":"0GAwBA,IAAM,EAAc,CAClB,GAAK,cACL,IAAK,cACL,IAAK,cACL,IAAK,cACL,IAAK,cACL,IAAK,aACL,IAAK,cACL,IAAK,aACL,IAAK,cACL,IAAK,cACL,IAAK,cACL,IAAK,aACL,IAAK,aACN,CAEK,EAAgB,CACpB,iBAAkB,UAClB,kBAAmB,UACnB,kBAAmB,UACnB,kBAAmB,UACnB,kBAAmB,UACnB,kBAAmB,UACnB,kBAAmB,UACnB,kBAAmB,UACnB,kBAAmB,UACnB,kBAAmB,UACnB,kBAAmB,UACnB,kBAAmB,UACnB,kBAAmB,UACpB,CAEK,EAAiB,CACrB,sBAAuB,EAAY,KACnC,iCAAkC,EAAY,IAC9C,yBAA0B,EAAY,KACtC,0BAA2B,EAAY,KACvC,0BAA2B,EAAY,KACvC,0BAA2B,EAAY,KACvC,0BAA2B,EAAY,KACvC,0BAA2B,EAAY,KACvC,0BAA2B,EAAY,KACvC,0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U,SAAS,cAAc,QAAQ,CACzC,EAAQ,GAAK,GAEf,EAAQ,YAAc,EAGtB,SAAS,KAAK,YAAY,EAAQ,CAElC,EAAiC,EAAO,CAG1C,SAAS,EACP,EACM,CACN,IAAM,EAAQ,SAAS,iBAAiB,yBAAyB,CACjE,IAAK,IAAM,KAAQ,EACX,gBAAgB,YAEtB,IAAK,IAAM,KAAO,EAAwB,CACxC,IAAM,EAAQ,EAAO,GACjB,EACF,EAAK,MAAM,YAAY,EAAK,EAAM,CAElC,EAAK,MAAM,eAAe,EAAI"}
|
|
@@ -44,12 +44,9 @@ export declare function persistColorTheme(key: ColorThemeKey): void;
|
|
|
44
44
|
* Why doubled selectors + re-append on every call:
|
|
45
45
|
* "Later sheet wins the tie" cannot be relied on: in the built SPA
|
|
46
46
|
* (ssr:false, prerendered shell) React 19 re-creates the <head> elements it
|
|
47
|
-
* manages (<Meta/>/<Links/>) whenever the tree above the router remounts
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* (the published npm package / tagged Docker images). That re-inserts the
|
|
51
|
-
* base stylesheet <link> AFTER this tag, which would let the base sheet's
|
|
52
|
-
* unlayered [data-agent-server-ui] variable rules (0,1,0) win every tie.
|
|
47
|
+
* manages (<Meta/>/<Links/>) whenever the tree above the router remounts.
|
|
48
|
+
* That can re-insert the base stylesheet <link> AFTER this tag, allowing its
|
|
49
|
+
* unlayered [data-agent-server-ui] variable rules (0,1,0) to win every tie.
|
|
53
50
|
* Doubling the attribute selectors ([x][x], 0,2,0) beats them from any
|
|
54
51
|
* position in <head>; re-appending on each apply keeps document order
|
|
55
52
|
* favorable as well.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-themes.js","names":[],"sources":["../../src/themes/color-themes.ts"],"sourcesContent":["export type ColorThemeKey =\n | \"openhands-deepsea\"\n | \"openhands-neutral\"\n | \"openhands-neo\";\n\nexport interface ColorThemeDefinition {\n label: string;\n /** Overrides for --cool-grey-* CSS custom properties (our semantic scale) */\n scale: Record<string, string>;\n /**\n * Overrides for --heroui-* CSS custom properties.\n * HeroUI stores colors as space-separated HSL channels (\"H S% L%\") so Tailwind\n * utilities like bg-default-200 resolve to hsl(var(--heroui-default-200)).\n * These vars are set by the heroui() plugin on :root, [data-theme=dark] at\n * build time, so they must be overridden at the same or lower specificity\n * from a later stylesheet to pick up theme changes at runtime.\n */\n heroui: Record<string, string>;\n /** Overrides for --oh-* semantic tokens such as brand / button colors. */\n tokens?: Record<string, string>;\n}\n\n// HSL channel strings for the neutral grey palette (H=0, S=0%, L=hex/255*100)\n// prettier-ignore\nconst NEUTRAL_HSL = {\n 50: \"0 0% 96.86%\", // #F7F7F7\n 100: \"0 0% 92.55%\", // #ECECEC\n 200: \"0 0% 86.27%\", // #DCDCDC\n 300: \"0 0% 74.51%\", // #BEBEBE\n 400: \"0 0% 59.22%\", // #979797\n 500: \"0 0% 45.1%\", // #737373\n 600: \"0 0% 33.73%\", // #565656\n 700: \"0 0% 25.1%\", // #404040\n 800: \"0 0% 19.22%\", // #313131\n 850: \"0 0% 15.69%\", // #282828\n 900: \"0 0% 12.55%\", // #202020\n 950: \"0 0% 9.41%\", // #181818\n 975: \"0 0% 6.27%\", // #101010\n};\n\nconst NEUTRAL_SCALE = {\n \"--cool-grey-50\": \"#F7F7F7\",\n \"--cool-grey-100\": \"#ECECEC\",\n \"--cool-grey-200\": \"#DCDCDC\",\n \"--cool-grey-300\": \"#BEBEBE\",\n \"--cool-grey-400\": \"#979797\",\n \"--cool-grey-500\": \"#737373\",\n \"--cool-grey-600\": \"#565656\",\n \"--cool-grey-700\": \"#404040\",\n \"--cool-grey-800\": \"#313131\",\n \"--cool-grey-900\": \"#282828\",\n \"--cool-grey-925\": \"#202020\",\n \"--cool-grey-950\": \"#181818\",\n \"--cool-grey-975\": \"#101010\",\n};\n\nconst NEUTRAL_HEROUI = {\n \"--heroui-background\": NEUTRAL_HSL[950],\n \"--heroui-background-foreground\": NEUTRAL_HSL[50],\n \"--heroui-foreground-50\": NEUTRAL_HSL[975],\n \"--heroui-foreground-100\": NEUTRAL_HSL[950],\n \"--heroui-foreground-200\": NEUTRAL_HSL[900],\n \"--heroui-foreground-300\": NEUTRAL_HSL[850],\n \"--heroui-foreground-400\": NEUTRAL_HSL[800],\n \"--heroui-foreground-500\": NEUTRAL_HSL[700],\n \"--heroui-foreground-600\": NEUTRAL_HSL[600],\n \"--heroui-foreground-700\": NEUTRAL_HSL[500],\n \"--heroui-foreground-800\": NEUTRAL_HSL[400],\n \"--heroui-foreground-900\": NEUTRAL_HSL[300],\n \"--heroui-foreground\": NEUTRAL_HSL[300],\n \"--heroui-content1\": NEUTRAL_HSL[900],\n \"--heroui-content1-foreground\": NEUTRAL_HSL[100],\n \"--heroui-content2\": NEUTRAL_HSL[850],\n \"--heroui-content2-foreground\": NEUTRAL_HSL[200],\n \"--heroui-content3\": NEUTRAL_HSL[800],\n \"--heroui-content3-foreground\": NEUTRAL_HSL[300],\n \"--heroui-content4\": NEUTRAL_HSL[700],\n \"--heroui-content4-foreground\": NEUTRAL_HSL[400],\n \"--heroui-default-50\": NEUTRAL_HSL[975],\n \"--heroui-default-100\": NEUTRAL_HSL[950],\n \"--heroui-default-200\": NEUTRAL_HSL[900],\n \"--heroui-default-300\": NEUTRAL_HSL[850],\n \"--heroui-default-400\": NEUTRAL_HSL[800],\n \"--heroui-default-500\": NEUTRAL_HSL[700],\n \"--heroui-default-600\": NEUTRAL_HSL[600],\n \"--heroui-default-700\": NEUTRAL_HSL[500],\n \"--heroui-default-800\": NEUTRAL_HSL[400],\n \"--heroui-default-900\": NEUTRAL_HSL[300],\n \"--heroui-default-foreground\": NEUTRAL_HSL[50],\n \"--heroui-default\": NEUTRAL_HSL[800],\n};\n\nimport { AGENT_SERVER_UI_THEMEABLE_BRAND_VARIABLES } from \"#/styles/agent-server-ui-style-scope\";\n\n/** CSS custom properties overridden by color themes (see applyColorTheme). */\nexport const COLOR_THEME_TOKEN_KEYS = AGENT_SERVER_UI_THEMEABLE_BRAND_VARIABLES;\n\n/** White primary/accent tokens — used by OpenHands-Neo for button surfaces. */\nconst NEO_WHITE_BUTTON_TOKENS: Record<\n (typeof COLOR_THEME_TOKEN_KEYS)[number],\n string\n> = {\n \"--oh-color-primary\": \"#ffffff\",\n \"--oh-accent\": \"#ffffff\",\n \"--oh-warning\": \"#ffffff\",\n};\n\nexport const COLOR_THEMES: Record<ColorThemeKey, ColorThemeDefinition> = {\n \"openhands-deepsea\": {\n label: \"OpenHands-DeepSea\",\n // Matches the values already set by index.css; included so switching back\n // from another theme restores the original palette explicitly.\n scale: {\n \"--cool-grey-50\": \"#F7F9FC\",\n \"--cool-grey-100\": \"#EEF2F7\",\n \"--cool-grey-200\": \"#DCE3EE\",\n \"--cool-grey-300\": \"#C3CDDC\",\n \"--cool-grey-400\": \"#A3B0C4\",\n \"--cool-grey-500\": \"#7E8A9E\",\n \"--cool-grey-600\": \"#626D82\",\n \"--cool-grey-700\": \"#4B5468\",\n \"--cool-grey-800\": \"#383F50\",\n \"--cool-grey-900\": \"#2C313F\",\n \"--cool-grey-925\": \"#21252F\",\n \"--cool-grey-950\": \"#0B0E14\",\n \"--cool-grey-975\": \"#05070A\",\n },\n // Values generated by heroui() from hero.ts — restore them explicitly when\n // switching back from another theme.\n heroui: {\n \"--heroui-background\": \"220 29.03% 6.08%\",\n \"--heroui-background-foreground\": \"216 45.45% 97.84%\",\n \"--heroui-foreground-50\": \"216 33.33% 2.94%\",\n \"--heroui-foreground-100\": \"220 29.03% 6.08%\",\n \"--heroui-foreground-200\": \"222.86 17.5% 15.69%\",\n \"--heroui-foreground-300\": \"224.21 17.76% 20.98%\",\n \"--heroui-foreground-400\": \"222.5 17.65% 26.67%\",\n \"--heroui-foreground-500\": \"221.38 16.2% 35.1%\",\n \"--heroui-foreground-600\": \"219.38 14.04% 44.71%\",\n \"--heroui-foreground-700\": \"217.5 14.16% 55.69%\",\n \"--heroui-foreground-800\": \"216.36 21.85% 70.39%\",\n \"--heroui-foreground-900\": \"216 26.32% 81.37%\",\n \"--heroui-foreground\": \"216 26.32% 81.37%\",\n \"--heroui-content1\": \"222.86 17.5% 15.69%\",\n \"--heroui-content1-foreground\": \"213.33 36% 95.1%\",\n \"--heroui-content2\": \"224.21 17.76% 20.98%\",\n \"--heroui-content2-foreground\": \"216.67 34.62% 89.8%\",\n \"--heroui-content3\": \"222.5 17.65% 26.67%\",\n \"--heroui-content3-foreground\": \"216 26.32% 81.37%\",\n \"--heroui-content4\": \"221.38 16.2% 35.1%\",\n \"--heroui-content4-foreground\": \"216.36 21.85% 70.39%\",\n \"--heroui-default-50\": \"216 33.33% 2.94%\",\n \"--heroui-default-100\": \"220 29.03% 6.08%\",\n \"--heroui-default-200\": \"222.86 17.5% 15.69%\",\n \"--heroui-default-300\": \"224.21 17.76% 20.98%\",\n \"--heroui-default-400\": \"222.5 17.65% 26.67%\",\n \"--heroui-default-500\": \"221.38 16.2% 35.1%\",\n \"--heroui-default-600\": \"219.38 14.04% 44.71%\",\n \"--heroui-default-700\": \"217.5 14.16% 55.69%\",\n \"--heroui-default-800\": \"216.36 21.85% 70.39%\",\n \"--heroui-default-900\": \"216 26.32% 81.37%\",\n \"--heroui-default-foreground\": \"216 45.45% 97.84%\",\n \"--heroui-default\": \"222.5 17.65% 26.67%\",\n },\n },\n\n \"openhands-neutral\": {\n label: \"OpenHands-Neutral\",\n scale: NEUTRAL_SCALE,\n // Each stop follows the same positional mapping as hero.ts:\n // heroui-default-100 ← cool-grey-950 position ← neutral-950 (#181818)\n // heroui-default-200 ← cool-grey-925 position ← neutral-900 (#202020)\n // ...etc.\n heroui: NEUTRAL_HEROUI,\n },\n\n \"openhands-neo\": {\n label: \"OpenHands-Neo\",\n scale: NEUTRAL_SCALE,\n heroui: NEUTRAL_HEROUI,\n tokens: NEO_WHITE_BUTTON_TOKENS,\n },\n};\n\nexport const DEFAULT_COLOR_THEME: ColorThemeKey = \"openhands-neutral\";\n\nexport const AVAILABLE_COLOR_THEMES = Object.entries(COLOR_THEMES).map(\n ([key, def]) => ({ key: key as ColorThemeKey, label: def.label }),\n);\n\nconst STORAGE_KEY = \"openhands-color-theme\";\n\n/** Read the persisted theme key from localStorage, falling back to the default. */\nexport function readPersistedColorTheme(): ColorThemeKey {\n if (typeof window === \"undefined\") return DEFAULT_COLOR_THEME;\n try {\n const stored = window.localStorage.getItem(STORAGE_KEY);\n if (stored && stored in COLOR_THEMES) return stored as ColorThemeKey;\n } catch {\n // ignore quota / privacy-mode failures\n }\n return DEFAULT_COLOR_THEME;\n}\n\n/** Persist the theme key to localStorage. */\nexport function persistColorTheme(key: ColorThemeKey): void {\n try {\n window.localStorage.setItem(STORAGE_KEY, key);\n } catch {\n // ignore\n }\n}\n\nconst THEME_STYLE_TAG_ID = \"oh-color-theme-override\";\n\n/**\n * Apply a theme by injecting (or replacing) a <style> tag that overrides\n * both our custom --cool-grey-* primitives and HeroUI's --heroui-* tokens.\n *\n * Why a <style> tag:\n * PostCSS transforms :root / body to [data-agent-server-ui], so --cool-grey-*\n * is set on EVERY element carrying that attribute. A body inline-style only\n * overrides body itself — inner matching elements keep the stylesheet value.\n *\n * Why heroui variables:\n * HeroUI stores colors as HSL channels in --heroui-* vars on [data-theme=dark].\n * They reference their own token system and are unaffected by --cool-grey-*\n * changes, so we override them from the same injected sheet.\n *\n * Why doubled selectors + re-append on every call:\n * \"Later sheet wins the tie\" cannot be relied on: in the built SPA\n * (ssr:false, prerendered shell) React 19 re-creates the <head> elements it\n * manages (<Meta/>/<Links/>) whenever the tree above the router remounts —\n * e.g. PostHogWrapper swapping in <PostHogProvider> once the analytics key\n * resolves, which only happens in builds with VITE_POSTHOG_CLIENT_KEY baked\n * (the published npm package / tagged Docker images). That re-inserts the\n * base stylesheet <link> AFTER this tag, which would let the base sheet's\n * unlayered [data-agent-server-ui] variable rules (0,1,0) win every tie.\n * Doubling the attribute selectors ([x][x], 0,2,0) beats them from any\n * position in <head>; re-appending on each apply keeps document order\n * favorable as well.\n */\nexport function applyColorTheme(key: ColorThemeKey): void {\n if (typeof document === \"undefined\") return;\n const { scale, heroui, tokens = {} } = COLOR_THEMES[key];\n\n const scaleDecls = Object.entries(scale)\n .map(([p, v]) => ` ${p}: ${v};`)\n .join(\"\\n\");\n\n const herouiDecls = Object.entries(heroui)\n .map(([p, v]) => ` ${p}: ${v};`)\n .join(\"\\n\");\n\n const tokenDecls = Object.entries(tokens)\n .map(([p, v]) => ` ${p}: ${v};`)\n .join(\"\\n\");\n\n // Target both selectors for heroui vars:\n // [data-agent-server-ui] — covers document.body (portal destination) so\n // portalled popover/listbox content inherits the overridden values.\n // [data-theme=dark] — covers the inner AgentServerUIRoot wrapper so\n // components scoped inside the dark theme wrapper also pick them up.\n // Both are doubled to out-specify the base sheet regardless of stylesheet\n // order (see the doc comment above).\n const css = [\n `[data-agent-server-ui][data-agent-server-ui] {\\n${scaleDecls}\\n${herouiDecls}\\n${tokenDecls}\\n}`,\n `[data-theme=dark][data-theme=dark] {\\n${herouiDecls}\\n}`,\n ].join(\"\\n\");\n\n let styleEl = document.getElementById(\n THEME_STYLE_TAG_ID,\n ) as HTMLStyleElement | null;\n if (!styleEl) {\n styleEl = document.createElement(\"style\");\n styleEl.id = THEME_STYLE_TAG_ID;\n }\n styleEl.textContent = css;\n // Re-append even when the tag already exists (appendChild relocates a\n // connected node) so the override also stays after any re-inserted <link>.\n document.head.appendChild(styleEl);\n\n syncColorThemeTokensOnScopeRoots(tokens);\n}\n\nfunction syncColorThemeTokensOnScopeRoots(\n tokens: Record<string, string>,\n): void {\n const roots = document.querySelectorAll(\"[data-agent-server-ui]\");\n for (const root of roots) {\n if (!(root instanceof HTMLElement)) continue;\n\n for (const key of COLOR_THEME_TOKEN_KEYS) {\n const value = tokens[key];\n if (value) {\n root.style.setProperty(key, value);\n } else {\n root.style.removeProperty(key);\n }\n }\n }\n}\n"],"mappings":";;AAwBA,IAAM,IAAc;CAClB,IAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAA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O,QAAQ,EAAM,CACrC,KAAK,CAAC,GAAG,OAAO,KAAK,EAAE,IAAI,EAAE,GAAG,CAChC,KAAK,KAAK,EAEP,IAAc,OAAO,QAAQ,EAAO,CACvC,KAAK,CAAC,GAAG,OAAO,KAAK,EAAE,IAAI,EAAE,GAAG,CAChC,KAAK,KAAK,EAaP,IAAM,CACV,mDAAmD,EAAW,IAAI,EAAY,IAZ7D,OAAO,QAAQ,EAAO,CACtC,KAAK,CAAC,GAAG,OAAO,KAAK,EAAE,IAAI,EAAE,GAAG,CAChC,KAAK,KAU4E,CAAW,MAC7F,yCAAyC,EAAY,KACtD,CAAC,KAAK,KAAK,EAER,IAAU,SAAS,eACrB,EACD;AAUD,CATK,MACH,IAAU,SAAS,cAAc,QAAQ,EACzC,EAAQ,KAAK,IAEf,EAAQ,cAAc,GAGtB,SAAS,KAAK,YAAY,EAAQ,EAElC,EAAiC,EAAO;;AAG1C,SAAS,EACP,GACM;CACN,IAAM,IAAQ,SAAS,iBAAiB,yBAAyB;AACjE,MAAK,IAAM,KAAQ,EACX,kBAAgB,YAEtB,MAAK,IAAM,KAAO,GAAwB;EACxC,IAAM,IAAQ,EAAO;AACrB,EAAI,IACF,EAAK,MAAM,YAAY,GAAK,EAAM,GAElC,EAAK,MAAM,eAAe,EAAI"}
|
|
1
|
+
{"version":3,"file":"color-themes.js","names":[],"sources":["../../src/themes/color-themes.ts"],"sourcesContent":["export type ColorThemeKey =\n | \"openhands-deepsea\"\n | \"openhands-neutral\"\n | \"openhands-neo\";\n\nexport interface ColorThemeDefinition {\n label: string;\n /** Overrides for --cool-grey-* CSS custom properties (our semantic scale) */\n scale: Record<string, string>;\n /**\n * Overrides for --heroui-* CSS custom properties.\n * HeroUI stores colors as space-separated HSL channels (\"H S% L%\") so Tailwind\n * utilities like bg-default-200 resolve to hsl(var(--heroui-default-200)).\n * These vars are set by the heroui() plugin on :root, [data-theme=dark] at\n * build time, so they must be overridden at the same or lower specificity\n * from a later stylesheet to pick up theme changes at runtime.\n */\n heroui: Record<string, string>;\n /** Overrides for --oh-* semantic tokens such as brand / button colors. */\n tokens?: Record<string, string>;\n}\n\n// HSL channel strings for the neutral grey palette (H=0, S=0%, L=hex/255*100)\n// prettier-ignore\nconst NEUTRAL_HSL = {\n 50: \"0 0% 96.86%\", // #F7F7F7\n 100: \"0 0% 92.55%\", // #ECECEC\n 200: \"0 0% 86.27%\", // #DCDCDC\n 300: \"0 0% 74.51%\", // #BEBEBE\n 400: \"0 0% 59.22%\", // #979797\n 500: \"0 0% 45.1%\", // #737373\n 600: \"0 0% 33.73%\", // #565656\n 700: \"0 0% 25.1%\", // #404040\n 800: \"0 0% 19.22%\", // #313131\n 850: \"0 0% 15.69%\", // #282828\n 900: \"0 0% 12.55%\", // #202020\n 950: \"0 0% 9.41%\", // #181818\n 975: \"0 0% 6.27%\", // #101010\n};\n\nconst NEUTRAL_SCALE = {\n \"--cool-grey-50\": \"#F7F7F7\",\n \"--cool-grey-100\": \"#ECECEC\",\n \"--cool-grey-200\": \"#DCDCDC\",\n \"--cool-grey-300\": \"#BEBEBE\",\n \"--cool-grey-400\": \"#979797\",\n \"--cool-grey-500\": \"#737373\",\n \"--cool-grey-600\": \"#565656\",\n \"--cool-grey-700\": \"#404040\",\n \"--cool-grey-800\": \"#313131\",\n \"--cool-grey-900\": \"#282828\",\n \"--cool-grey-925\": \"#202020\",\n \"--cool-grey-950\": \"#181818\",\n \"--cool-grey-975\": \"#101010\",\n};\n\nconst NEUTRAL_HEROUI = {\n \"--heroui-background\": NEUTRAL_HSL[950],\n \"--heroui-background-foreground\": NEUTRAL_HSL[50],\n \"--heroui-foreground-50\": NEUTRAL_HSL[975],\n \"--heroui-foreground-100\": NEUTRAL_HSL[950],\n \"--heroui-foreground-200\": NEUTRAL_HSL[900],\n \"--heroui-foreground-300\": NEUTRAL_HSL[850],\n \"--heroui-foreground-400\": NEUTRAL_HSL[800],\n \"--heroui-foreground-500\": NEUTRAL_HSL[700],\n \"--heroui-foreground-600\": NEUTRAL_HSL[600],\n \"--heroui-foreground-700\": NEUTRAL_HSL[500],\n \"--heroui-foreground-800\": NEUTRAL_HSL[400],\n \"--heroui-foreground-900\": NEUTRAL_HSL[300],\n \"--heroui-foreground\": NEUTRAL_HSL[300],\n \"--heroui-content1\": NEUTRAL_HSL[900],\n \"--heroui-content1-foreground\": NEUTRAL_HSL[100],\n \"--heroui-content2\": NEUTRAL_HSL[850],\n \"--heroui-content2-foreground\": NEUTRAL_HSL[200],\n \"--heroui-content3\": NEUTRAL_HSL[800],\n \"--heroui-content3-foreground\": NEUTRAL_HSL[300],\n \"--heroui-content4\": NEUTRAL_HSL[700],\n \"--heroui-content4-foreground\": NEUTRAL_HSL[400],\n \"--heroui-default-50\": NEUTRAL_HSL[975],\n \"--heroui-default-100\": NEUTRAL_HSL[950],\n \"--heroui-default-200\": NEUTRAL_HSL[900],\n \"--heroui-default-300\": NEUTRAL_HSL[850],\n \"--heroui-default-400\": NEUTRAL_HSL[800],\n \"--heroui-default-500\": NEUTRAL_HSL[700],\n \"--heroui-default-600\": NEUTRAL_HSL[600],\n \"--heroui-default-700\": NEUTRAL_HSL[500],\n \"--heroui-default-800\": NEUTRAL_HSL[400],\n \"--heroui-default-900\": NEUTRAL_HSL[300],\n \"--heroui-default-foreground\": NEUTRAL_HSL[50],\n \"--heroui-default\": NEUTRAL_HSL[800],\n};\n\nimport { AGENT_SERVER_UI_THEMEABLE_BRAND_VARIABLES } from \"#/styles/agent-server-ui-style-scope\";\n\n/** CSS custom properties overridden by color themes (see applyColorTheme). */\nexport const COLOR_THEME_TOKEN_KEYS = AGENT_SERVER_UI_THEMEABLE_BRAND_VARIABLES;\n\n/** White primary/accent tokens — used by OpenHands-Neo for button surfaces. */\nconst NEO_WHITE_BUTTON_TOKENS: Record<\n (typeof COLOR_THEME_TOKEN_KEYS)[number],\n string\n> = {\n \"--oh-color-primary\": \"#ffffff\",\n \"--oh-accent\": \"#ffffff\",\n \"--oh-warning\": \"#ffffff\",\n};\n\nexport const COLOR_THEMES: Record<ColorThemeKey, ColorThemeDefinition> = {\n \"openhands-deepsea\": {\n label: \"OpenHands-DeepSea\",\n // Matches the values already set by index.css; included so switching back\n // from another theme restores the original palette explicitly.\n scale: {\n \"--cool-grey-50\": \"#F7F9FC\",\n \"--cool-grey-100\": \"#EEF2F7\",\n \"--cool-grey-200\": \"#DCE3EE\",\n \"--cool-grey-300\": \"#C3CDDC\",\n \"--cool-grey-400\": \"#A3B0C4\",\n \"--cool-grey-500\": \"#7E8A9E\",\n \"--cool-grey-600\": \"#626D82\",\n \"--cool-grey-700\": \"#4B5468\",\n \"--cool-grey-800\": \"#383F50\",\n \"--cool-grey-900\": \"#2C313F\",\n \"--cool-grey-925\": \"#21252F\",\n \"--cool-grey-950\": \"#0B0E14\",\n \"--cool-grey-975\": \"#05070A\",\n },\n // Values generated by heroui() from hero.ts — restore them explicitly when\n // switching back from another theme.\n heroui: {\n \"--heroui-background\": \"220 29.03% 6.08%\",\n \"--heroui-background-foreground\": \"216 45.45% 97.84%\",\n \"--heroui-foreground-50\": \"216 33.33% 2.94%\",\n \"--heroui-foreground-100\": \"220 29.03% 6.08%\",\n \"--heroui-foreground-200\": \"222.86 17.5% 15.69%\",\n \"--heroui-foreground-300\": \"224.21 17.76% 20.98%\",\n \"--heroui-foreground-400\": \"222.5 17.65% 26.67%\",\n \"--heroui-foreground-500\": \"221.38 16.2% 35.1%\",\n \"--heroui-foreground-600\": \"219.38 14.04% 44.71%\",\n \"--heroui-foreground-700\": \"217.5 14.16% 55.69%\",\n \"--heroui-foreground-800\": \"216.36 21.85% 70.39%\",\n \"--heroui-foreground-900\": \"216 26.32% 81.37%\",\n \"--heroui-foreground\": \"216 26.32% 81.37%\",\n \"--heroui-content1\": \"222.86 17.5% 15.69%\",\n \"--heroui-content1-foreground\": \"213.33 36% 95.1%\",\n \"--heroui-content2\": \"224.21 17.76% 20.98%\",\n \"--heroui-content2-foreground\": \"216.67 34.62% 89.8%\",\n \"--heroui-content3\": \"222.5 17.65% 26.67%\",\n \"--heroui-content3-foreground\": \"216 26.32% 81.37%\",\n \"--heroui-content4\": \"221.38 16.2% 35.1%\",\n \"--heroui-content4-foreground\": \"216.36 21.85% 70.39%\",\n \"--heroui-default-50\": \"216 33.33% 2.94%\",\n \"--heroui-default-100\": \"220 29.03% 6.08%\",\n \"--heroui-default-200\": \"222.86 17.5% 15.69%\",\n \"--heroui-default-300\": \"224.21 17.76% 20.98%\",\n \"--heroui-default-400\": \"222.5 17.65% 26.67%\",\n \"--heroui-default-500\": \"221.38 16.2% 35.1%\",\n \"--heroui-default-600\": \"219.38 14.04% 44.71%\",\n \"--heroui-default-700\": \"217.5 14.16% 55.69%\",\n \"--heroui-default-800\": \"216.36 21.85% 70.39%\",\n \"--heroui-default-900\": \"216 26.32% 81.37%\",\n \"--heroui-default-foreground\": \"216 45.45% 97.84%\",\n \"--heroui-default\": \"222.5 17.65% 26.67%\",\n },\n },\n\n \"openhands-neutral\": {\n label: \"OpenHands-Neutral\",\n scale: NEUTRAL_SCALE,\n // Each stop follows the same positional mapping as hero.ts:\n // heroui-default-100 ← cool-grey-950 position ← neutral-950 (#181818)\n // heroui-default-200 ← cool-grey-925 position ← neutral-900 (#202020)\n // ...etc.\n heroui: NEUTRAL_HEROUI,\n },\n\n \"openhands-neo\": {\n label: \"OpenHands-Neo\",\n scale: NEUTRAL_SCALE,\n heroui: NEUTRAL_HEROUI,\n tokens: NEO_WHITE_BUTTON_TOKENS,\n },\n};\n\nexport const DEFAULT_COLOR_THEME: ColorThemeKey = \"openhands-neutral\";\n\nexport const AVAILABLE_COLOR_THEMES = Object.entries(COLOR_THEMES).map(\n ([key, def]) => ({ key: key as ColorThemeKey, label: def.label }),\n);\n\nconst STORAGE_KEY = \"openhands-color-theme\";\n\n/** Read the persisted theme key from localStorage, falling back to the default. */\nexport function readPersistedColorTheme(): ColorThemeKey {\n if (typeof window === \"undefined\") return DEFAULT_COLOR_THEME;\n try {\n const stored = window.localStorage.getItem(STORAGE_KEY);\n if (stored && stored in COLOR_THEMES) return stored as ColorThemeKey;\n } catch {\n // ignore quota / privacy-mode failures\n }\n return DEFAULT_COLOR_THEME;\n}\n\n/** Persist the theme key to localStorage. */\nexport function persistColorTheme(key: ColorThemeKey): void {\n try {\n window.localStorage.setItem(STORAGE_KEY, key);\n } catch {\n // ignore\n }\n}\n\nconst THEME_STYLE_TAG_ID = \"oh-color-theme-override\";\n\n/**\n * Apply a theme by injecting (or replacing) a <style> tag that overrides\n * both our custom --cool-grey-* primitives and HeroUI's --heroui-* tokens.\n *\n * Why a <style> tag:\n * PostCSS transforms :root / body to [data-agent-server-ui], so --cool-grey-*\n * is set on EVERY element carrying that attribute. A body inline-style only\n * overrides body itself — inner matching elements keep the stylesheet value.\n *\n * Why heroui variables:\n * HeroUI stores colors as HSL channels in --heroui-* vars on [data-theme=dark].\n * They reference their own token system and are unaffected by --cool-grey-*\n * changes, so we override them from the same injected sheet.\n *\n * Why doubled selectors + re-append on every call:\n * \"Later sheet wins the tie\" cannot be relied on: in the built SPA\n * (ssr:false, prerendered shell) React 19 re-creates the <head> elements it\n * manages (<Meta/>/<Links/>) whenever the tree above the router remounts.\n * That can re-insert the base stylesheet <link> AFTER this tag, allowing its\n * unlayered [data-agent-server-ui] variable rules (0,1,0) to win every tie.\n * Doubling the attribute selectors ([x][x], 0,2,0) beats them from any\n * position in <head>; re-appending on each apply keeps document order\n * favorable as well.\n */\nexport function applyColorTheme(key: ColorThemeKey): void {\n if (typeof document === \"undefined\") return;\n const { scale, heroui, tokens = {} } = COLOR_THEMES[key];\n\n const scaleDecls = Object.entries(scale)\n .map(([p, v]) => ` ${p}: ${v};`)\n .join(\"\\n\");\n\n const herouiDecls = Object.entries(heroui)\n .map(([p, v]) => ` ${p}: ${v};`)\n .join(\"\\n\");\n\n const tokenDecls = Object.entries(tokens)\n .map(([p, v]) => ` ${p}: ${v};`)\n .join(\"\\n\");\n\n // Target both selectors for heroui vars:\n // [data-agent-server-ui] — covers document.body (portal destination) so\n // portalled popover/listbox content inherits the overridden values.\n // [data-theme=dark] — covers the inner AgentServerUIRoot wrapper so\n // components scoped inside the dark theme wrapper also pick them up.\n // Both are doubled to out-specify the base sheet regardless of stylesheet\n // order (see the doc comment above).\n const css = [\n `[data-agent-server-ui][data-agent-server-ui] {\\n${scaleDecls}\\n${herouiDecls}\\n${tokenDecls}\\n}`,\n `[data-theme=dark][data-theme=dark] {\\n${herouiDecls}\\n}`,\n ].join(\"\\n\");\n\n let styleEl = document.getElementById(\n THEME_STYLE_TAG_ID,\n ) as HTMLStyleElement | null;\n if (!styleEl) {\n styleEl = document.createElement(\"style\");\n styleEl.id = THEME_STYLE_TAG_ID;\n }\n styleEl.textContent = css;\n // Re-append even when the tag already exists (appendChild relocates a\n // connected node) so the override also stays after any re-inserted <link>.\n document.head.appendChild(styleEl);\n\n syncColorThemeTokensOnScopeRoots(tokens);\n}\n\nfunction syncColorThemeTokensOnScopeRoots(\n tokens: Record<string, string>,\n): void {\n const roots = document.querySelectorAll(\"[data-agent-server-ui]\");\n for (const root of roots) {\n if (!(root instanceof HTMLElement)) continue;\n\n for (const key of COLOR_THEME_TOKEN_KEYS) {\n const value = tokens[key];\n if (value) {\n root.style.setProperty(key, value);\n } else {\n root.style.removeProperty(key);\n }\n }\n }\n}\n"],"mappings":";;AAwBA,IAAM,IAAc;CAClB,IAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACN,EAEK,IAAgB;CACpB,kBAAkB;CAClB,mBAAmB;CACnB,mBAAmB;CACnB,mBAAmB;CACnB,mBAAmB;CACnB,mBAAmB;CACnB,mBAAmB;CACnB,mBAAmB;CACnB,mBAAmB;CACnB,mBAAmB;CACnB,mBAAmB;CACnB,mBAAmB;CACnB,mBAAmB;CACpB,EAEK,IAAiB;CACrB,uBAAuB,EAAY;CACnC,kCAA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CAChC,KAAK,KAU4E,CAAW,MAC7F,yCAAyC,EAAY,KACtD,CAAC,KAAK,KAAK,EAER,IAAU,SAAS,eACrB,EACD;AAUD,CATK,MACH,IAAU,SAAS,cAAc,QAAQ,EACzC,EAAQ,KAAK,IAEf,EAAQ,cAAc,GAGtB,SAAS,KAAK,YAAY,EAAQ,EAElC,EAAiC,EAAO;;AAG1C,SAAS,EACP,GACM;CACN,IAAM,IAAQ,SAAS,iBAAiB,yBAAyB;AACjE,MAAK,IAAM,KAAQ,EACX,kBAAgB,YAEtB,MAAK,IAAM,KAAO,GAAwB;EACxC,IAAM,IAAQ,EAAO;AACrB,EAAI,IACF,EAAK,MAAM,YAAY,GAAK,EAAM,GAElC,EAAK,MAAM,eAAe,EAAI"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
require(`../_virtual/_rolldown/runtime.cjs`);
|
|
1
|
+
require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../services/telemetry.cjs`);function t({message:t,source:n,metadata:r={}}){e.trackException(Error(t),{error_source:n||`unknown`,...r})}exports.trackError=t;
|
|
2
2
|
//# sourceMappingURL=error-handler.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-handler.cjs","names":[],"sources":["../../src/utils/error-handler.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"error-handler.cjs","names":[],"sources":["../../src/utils/error-handler.ts"],"sourcesContent":["import { trackException } from \"#/services/telemetry\";\n\ninterface ErrorDetails {\n message: string;\n source?: string;\n metadata?: Record<string, unknown>;\n}\n\nexport function trackError({ message, source, metadata = {} }: ErrorDetails) {\n const error = new Error(message);\n void trackException(error, {\n error_source: source || \"unknown\",\n ...metadata,\n });\n}\n"],"mappings":"0FAQA,SAAgB,EAAW,CAAE,UAAS,SAAQ,WAAW,EAAE,EAAkB,CAEtE,EAAA,eADa,MAAM,EACJ,CAAO,CACzB,aAAc,GAAU,UACxB,GAAG,EACJ,CAAC"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import type { PostHog } from "posthog-js";
|
|
2
1
|
interface ErrorDetails {
|
|
3
2
|
message: string;
|
|
4
3
|
source?: string;
|
|
5
4
|
metadata?: Record<string, unknown>;
|
|
6
|
-
msgId?: string;
|
|
7
|
-
posthog?: PostHog;
|
|
8
5
|
}
|
|
9
|
-
export declare function trackError({ message, source, metadata
|
|
6
|
+
export declare function trackError({ message, source, metadata }: ErrorDetails): void;
|
|
10
7
|
export {};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
+
import { trackException as e } from "../services/telemetry.js";
|
|
1
2
|
//#region src/utils/error-handler.ts
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
error_source: t || "unknown",
|
|
7
|
-
...n
|
|
3
|
+
function t({ message: t, source: n, metadata: r = {} }) {
|
|
4
|
+
e(Error(t), {
|
|
5
|
+
error_source: n || "unknown",
|
|
6
|
+
...r
|
|
8
7
|
});
|
|
9
8
|
}
|
|
10
9
|
//#endregion
|
|
11
|
-
export {
|
|
10
|
+
export { t as trackError };
|
|
12
11
|
|
|
13
12
|
//# sourceMappingURL=error-handler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-handler.js","names":[],"sources":["../../src/utils/error-handler.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"error-handler.js","names":[],"sources":["../../src/utils/error-handler.ts"],"sourcesContent":["import { trackException } from \"#/services/telemetry\";\n\ninterface ErrorDetails {\n message: string;\n source?: string;\n metadata?: Record<string, unknown>;\n}\n\nexport function trackError({ message, source, metadata = {} }: ErrorDetails) {\n const error = new Error(message);\n void trackException(error, {\n error_source: source || \"unknown\",\n ...metadata,\n });\n}\n"],"mappings":";;AAQA,SAAgB,EAAW,EAAE,YAAS,WAAQ,cAAW,EAAE,IAAkB;AAEtE,GADa,MAAM,EACJ,EAAO;EACzB,cAAc,KAAU;EACxB,GAAG;EACJ,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
require(`../_virtual/_rolldown/runtime.cjs`);var e={openai:`OpenAI`,azure:`Azure`,azure_ai:`Azure AI Studio`,vertex_ai:`VertexAI`,palm:`PaLM`,gemini:`Gemini`,anthropic:`Anthropic`,sagemaker:`AWS SageMaker`,bedrock:`AWS Bedrock`,mistral:`Mistral AI`,anyscale:`Anyscale`,databricks:`Databricks`,ollama:`Ollama`,perlexity:`Perplexity AI`,friendliai:`FriendliAI`,groq:`Groq`,fireworks_ai:`Fireworks AI`,cloudflare:`Cloudflare Workers AI`,deepinfra:`DeepInfra`,ai21:`AI21`,replicate:`Replicate`,voyage:`Voyage AI`,openrouter:`OpenRouter`,openhands:`OpenHands`,lemonade:`Lemonade`,clarifai:`Clarifai`},t=t=>Object.keys(e).includes(t)?e[t]:t,n=t=>{let n=Object.entries(e).find(([,e])=>e===t);return n?n[0]:t};exports.getProviderId=n,exports.mapProvider=t;
|
|
1
|
+
require(`../_virtual/_rolldown/runtime.cjs`);var e={openai:`OpenAI`,azure:`Azure`,azure_ai:`Azure AI Studio`,vertex_ai:`VertexAI`,palm:`PaLM`,gemini:`Gemini`,anthropic:`Anthropic`,sagemaker:`AWS SageMaker`,bedrock:`AWS Bedrock`,mistral:`Mistral AI`,anyscale:`Anyscale`,databricks:`Databricks`,ollama:`Ollama`,perlexity:`Perplexity AI`,friendliai:`FriendliAI`,groq:`Groq`,fireworks_ai:`Fireworks AI`,cloudflare:`Cloudflare Workers AI`,deepinfra:`DeepInfra`,ai21:`AI21`,replicate:`Replicate`,voyage:`Voyage AI`,openrouter:`OpenRouter`,openhands:`OpenHands`,lemonade:`Lemonade`,clarifai:`Clarifai`,moonshot:`Moonshot`},t=t=>Object.keys(e).includes(t)?e[t]:t,n=t=>{let n=Object.entries(e).find(([,e])=>e===t);return n?n[0]:t};exports.getProviderId=n,exports.mapProvider=t;
|
|
2
2
|
//# sourceMappingURL=map-provider.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-provider.cjs","names":[],"sources":["../../src/utils/map-provider.ts"],"sourcesContent":["// These are provider names, not user-facing text\nexport const MAP_PROVIDER = {\n openai: \"OpenAI\",\n azure: \"Azure\",\n azure_ai: \"Azure AI Studio\",\n vertex_ai: \"VertexAI\",\n palm: \"PaLM\",\n gemini: \"Gemini\",\n anthropic: \"Anthropic\",\n sagemaker: \"AWS SageMaker\",\n bedrock: \"AWS Bedrock\",\n mistral: \"Mistral AI\",\n anyscale: \"Anyscale\",\n databricks: \"Databricks\",\n ollama: \"Ollama\",\n perlexity: \"Perplexity AI\",\n friendliai: \"FriendliAI\",\n groq: \"Groq\",\n fireworks_ai: \"Fireworks AI\",\n cloudflare: \"Cloudflare Workers AI\",\n deepinfra: \"DeepInfra\",\n ai21: \"AI21\",\n replicate: \"Replicate\",\n voyage: \"Voyage AI\",\n openrouter: \"OpenRouter\",\n openhands: \"OpenHands\",\n lemonade: \"Lemonade\",\n clarifai: \"Clarifai\",\n};\n\nexport const mapProvider = (provider: string) =>\n Object.keys(MAP_PROVIDER).includes(provider)\n ? MAP_PROVIDER[provider as keyof typeof MAP_PROVIDER]\n : provider;\n\nexport const getProviderId = (displayName: string): string => {\n const entry = Object.entries(MAP_PROVIDER).find(\n ([, value]) => value === displayName,\n );\n return entry ? entry[0] : displayName;\n};\n"],"mappings":"6CACA,IAAa,EAAe,CAC1B,OAAQ,SACR,MAAO,QACP,SAAU,kBACV,UAAW,WACX,KAAM,OACN,OAAQ,SACR,UAAW,YACX,UAAW,gBACX,QAAS,cACT,QAAS,aACT,SAAU,WACV,WAAY,aACZ,OAAQ,SACR,UAAW,gBACX,WAAY,aACZ,KAAM,OACN,aAAc,eACd,WAAY,wBACZ,UAAW,YACX,KAAM,OACN,UAAW,YACX,OAAQ,YACR,WAAY,aACZ,UAAW,YACX,SAAU,WACV,SAAU,WACX,CAEY,EAAe,GAC1B,OAAO,KAAK,EAAa,CAAC,SAAS,EAAS,CACxC,EAAa,GACb,EAEO,EAAiB,GAAgC,CAC5D,IAAM,EAAQ,OAAO,QAAQ,EAAa,CAAC,MACxC,EAAG,KAAW,IAAU,EAC1B,CACD,OAAO,EAAQ,EAAM,GAAK"}
|
|
1
|
+
{"version":3,"file":"map-provider.cjs","names":[],"sources":["../../src/utils/map-provider.ts"],"sourcesContent":["// These are provider names, not user-facing text\nexport const MAP_PROVIDER = {\n openai: \"OpenAI\",\n azure: \"Azure\",\n azure_ai: \"Azure AI Studio\",\n vertex_ai: \"VertexAI\",\n palm: \"PaLM\",\n gemini: \"Gemini\",\n anthropic: \"Anthropic\",\n sagemaker: \"AWS SageMaker\",\n bedrock: \"AWS Bedrock\",\n mistral: \"Mistral AI\",\n anyscale: \"Anyscale\",\n databricks: \"Databricks\",\n ollama: \"Ollama\",\n perlexity: \"Perplexity AI\",\n friendliai: \"FriendliAI\",\n groq: \"Groq\",\n fireworks_ai: \"Fireworks AI\",\n cloudflare: \"Cloudflare Workers AI\",\n deepinfra: \"DeepInfra\",\n ai21: \"AI21\",\n replicate: \"Replicate\",\n voyage: \"Voyage AI\",\n openrouter: \"OpenRouter\",\n openhands: \"OpenHands\",\n lemonade: \"Lemonade\",\n clarifai: \"Clarifai\",\n moonshot: \"Moonshot\",\n};\n\nexport const mapProvider = (provider: string) =>\n Object.keys(MAP_PROVIDER).includes(provider)\n ? MAP_PROVIDER[provider as keyof typeof MAP_PROVIDER]\n : provider;\n\nexport const getProviderId = (displayName: string): string => {\n const entry = Object.entries(MAP_PROVIDER).find(\n ([, value]) => value === displayName,\n );\n return entry ? entry[0] : displayName;\n};\n"],"mappings":"6CACA,IAAa,EAAe,CAC1B,OAAQ,SACR,MAAO,QACP,SAAU,kBACV,UAAW,WACX,KAAM,OACN,OAAQ,SACR,UAAW,YACX,UAAW,gBACX,QAAS,cACT,QAAS,aACT,SAAU,WACV,WAAY,aACZ,OAAQ,SACR,UAAW,gBACX,WAAY,aACZ,KAAM,OACN,aAAc,eACd,WAAY,wBACZ,UAAW,YACX,KAAM,OACN,UAAW,YACX,OAAQ,YACR,WAAY,aACZ,UAAW,YACX,SAAU,WACV,SAAU,WACV,SAAU,WACX,CAEY,EAAe,GAC1B,OAAO,KAAK,EAAa,CAAC,SAAS,EAAS,CACxC,EAAa,GACb,EAEO,EAAiB,GAAgC,CAC5D,IAAM,EAAQ,OAAO,QAAQ,EAAa,CAAC,MACxC,EAAG,KAAW,IAAU,EAC1B,CACD,OAAO,EAAQ,EAAM,GAAK"}
|
|
@@ -25,6 +25,7 @@ export declare const MAP_PROVIDER: {
|
|
|
25
25
|
openhands: string;
|
|
26
26
|
lemonade: string;
|
|
27
27
|
clarifai: string;
|
|
28
|
+
moonshot: string;
|
|
28
29
|
};
|
|
29
30
|
export declare const mapProvider: (provider: string) => string;
|
|
30
31
|
export declare const getProviderId: (displayName: string) => string;
|
|
@@ -25,7 +25,8 @@ var e = {
|
|
|
25
25
|
openrouter: "OpenRouter",
|
|
26
26
|
openhands: "OpenHands",
|
|
27
27
|
lemonade: "Lemonade",
|
|
28
|
-
clarifai: "Clarifai"
|
|
28
|
+
clarifai: "Clarifai",
|
|
29
|
+
moonshot: "Moonshot"
|
|
29
30
|
}, t = (t) => Object.keys(e).includes(t) ? e[t] : t, n = (t) => {
|
|
30
31
|
let n = Object.entries(e).find(([, e]) => e === t);
|
|
31
32
|
return n ? n[0] : t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-provider.js","names":[],"sources":["../../src/utils/map-provider.ts"],"sourcesContent":["// These are provider names, not user-facing text\nexport const MAP_PROVIDER = {\n openai: \"OpenAI\",\n azure: \"Azure\",\n azure_ai: \"Azure AI Studio\",\n vertex_ai: \"VertexAI\",\n palm: \"PaLM\",\n gemini: \"Gemini\",\n anthropic: \"Anthropic\",\n sagemaker: \"AWS SageMaker\",\n bedrock: \"AWS Bedrock\",\n mistral: \"Mistral AI\",\n anyscale: \"Anyscale\",\n databricks: \"Databricks\",\n ollama: \"Ollama\",\n perlexity: \"Perplexity AI\",\n friendliai: \"FriendliAI\",\n groq: \"Groq\",\n fireworks_ai: \"Fireworks AI\",\n cloudflare: \"Cloudflare Workers AI\",\n deepinfra: \"DeepInfra\",\n ai21: \"AI21\",\n replicate: \"Replicate\",\n voyage: \"Voyage AI\",\n openrouter: \"OpenRouter\",\n openhands: \"OpenHands\",\n lemonade: \"Lemonade\",\n clarifai: \"Clarifai\",\n};\n\nexport const mapProvider = (provider: string) =>\n Object.keys(MAP_PROVIDER).includes(provider)\n ? MAP_PROVIDER[provider as keyof typeof MAP_PROVIDER]\n : provider;\n\nexport const getProviderId = (displayName: string): string => {\n const entry = Object.entries(MAP_PROVIDER).find(\n ([, value]) => value === displayName,\n );\n return entry ? entry[0] : displayName;\n};\n"],"mappings":";AACA,IAAa,IAAe;CAC1B,QAAQ;CACR,OAAO;CACP,UAAU;CACV,WAAW;CACX,MAAM;CACN,QAAQ;CACR,WAAW;CACX,WAAW;CACX,SAAS;CACT,SAAS;CACT,UAAU;CACV,YAAY;CACZ,QAAQ;CACR,WAAW;CACX,YAAY;CACZ,MAAM;CACN,cAAc;CACd,YAAY;CACZ,WAAW;CACX,MAAM;CACN,WAAW;CACX,QAAQ;CACR,YAAY;CACZ,WAAW;CACX,UAAU;CACV,UAAU;CACX,EAEY,KAAe,MAC1B,OAAO,KAAK,EAAa,CAAC,SAAS,EAAS,GACxC,EAAa,KACb,GAEO,KAAiB,MAAgC;CAC5D,IAAM,IAAQ,OAAO,QAAQ,EAAa,CAAC,MACxC,GAAG,OAAW,MAAU,EAC1B;AACD,QAAO,IAAQ,EAAM,KAAK"}
|
|
1
|
+
{"version":3,"file":"map-provider.js","names":[],"sources":["../../src/utils/map-provider.ts"],"sourcesContent":["// These are provider names, not user-facing text\nexport const MAP_PROVIDER = {\n openai: \"OpenAI\",\n azure: \"Azure\",\n azure_ai: \"Azure AI Studio\",\n vertex_ai: \"VertexAI\",\n palm: \"PaLM\",\n gemini: \"Gemini\",\n anthropic: \"Anthropic\",\n sagemaker: \"AWS SageMaker\",\n bedrock: \"AWS Bedrock\",\n mistral: \"Mistral AI\",\n anyscale: \"Anyscale\",\n databricks: \"Databricks\",\n ollama: \"Ollama\",\n perlexity: \"Perplexity AI\",\n friendliai: \"FriendliAI\",\n groq: \"Groq\",\n fireworks_ai: \"Fireworks AI\",\n cloudflare: \"Cloudflare Workers AI\",\n deepinfra: \"DeepInfra\",\n ai21: \"AI21\",\n replicate: \"Replicate\",\n voyage: \"Voyage AI\",\n openrouter: \"OpenRouter\",\n openhands: \"OpenHands\",\n lemonade: \"Lemonade\",\n clarifai: \"Clarifai\",\n moonshot: \"Moonshot\",\n};\n\nexport const mapProvider = (provider: string) =>\n Object.keys(MAP_PROVIDER).includes(provider)\n ? MAP_PROVIDER[provider as keyof typeof MAP_PROVIDER]\n : provider;\n\nexport const getProviderId = (displayName: string): string => {\n const entry = Object.entries(MAP_PROVIDER).find(\n ([, value]) => value === displayName,\n );\n return entry ? entry[0] : displayName;\n};\n"],"mappings":";AACA,IAAa,IAAe;CAC1B,QAAQ;CACR,OAAO;CACP,UAAU;CACV,WAAW;CACX,MAAM;CACN,QAAQ;CACR,WAAW;CACX,WAAW;CACX,SAAS;CACT,SAAS;CACT,UAAU;CACV,YAAY;CACZ,QAAQ;CACR,WAAW;CACX,YAAY;CACZ,MAAM;CACN,cAAc;CACd,YAAY;CACZ,WAAW;CACX,MAAM;CACN,WAAW;CACX,QAAQ;CACR,YAAY;CACZ,WAAW;CACX,UAAU;CACV,UAAU;CACV,UAAU;CACX,EAEY,KAAe,MAC1B,OAAO,KAAK,EAAa,CAAC,SAAS,EAAS,GACxC,EAAa,KACb,GAEO,KAAiB,MAAgC;CAC5D,IAAM,IAAQ,OAAO,QAAQ,EAAa,CAAC,MACxC,GAAG,OAAW,MAAU,EAC1B;AACD,QAAO,IAAQ,EAAM,KAAK"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openhands/agent-canvas",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "Agent Canvas UI for OpenHands - run AI coding agents with a visual interface",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"typecheck:staged": "react-router typegen && npx tsc --noEmit --skipLibCheck",
|
|
99
99
|
"check-translation-completeness": "node scripts/check-translation-completeness.cjs",
|
|
100
100
|
"build:app": "npm run make-i18n && react-router build",
|
|
101
|
-
"build:lib": "npm run make-i18n && react-router typegen && cross-env BUILD_LIB=true
|
|
101
|
+
"build:lib": "npm run make-i18n && react-router typegen && cross-env BUILD_LIB=true vite build && tsc -p tsconfig.lib.json",
|
|
102
102
|
"build:docker": "node scripts/docker-build.mjs",
|
|
103
103
|
"example:acp-docker:env": "node scripts/gen-acp-docker-env.mjs"
|
|
104
104
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t}from"./agent-settings-C-tann3x.js";export{e as default,t as handle};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{L as r}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~jkpzbynd-CkpBIhVe.js";import{t as i}from"./useTranslation-Cbf5AGg_.js";import{t as a}from"./declaration-BGsHjPEW.js";import{C as o,E as s,S as c,j as l}from"./active-backend-context-BCXRv5pm.js";import{n as u}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~ljq5gbus-B2XD4bi2.js";import{i as d}from"./telemetry-DHiTRl5_.js";import{t as f}from"./brand-button-2Tp3aXk1.js";import{i as p,n as m,r as h,t as g}from"./color-themes-bVMmJJG6.js";import{t as _}from"./settings-input-CzNOq-Pj.js";import{t as v}from"./settings-DksoDv5z.js";import{r as y}from"./use-settings-DNJC4gqu.js";import{t as b}from"./handle-capture-consent-DDnXMC9Y.js";import{t as x}from"./use-save-settings-ioSUMqbE.js";import{t as S}from"./settings-dropdown-input-BD5C9fBn.js";import{n as C,t as w}from"./switch-skeleton-BpSOvZ-n.js";import{t as T}from"./settings-switch-DqmHAfWJ.js";var E=e(t(),1),D=n();function O({defaultKey:e,onChange:t,name:n}){let{t:r}=i(`openhands`);return(0,D.jsx)(S,{testId:n,name:n,onInputChange:t,label:r(a.SETTINGS$LANGUAGE),items:l.map(e=>({key:e.value,label:e.label})),defaultSelectedKey:e,isClearable:!1,wrapperClassName:`w-full min-w-0`})}function k(){let{t:e}=i(`openhands`),t=E.useCallback(e=>{if(!e)return;let t=e;m(t),h(t)},[]);return(0,D.jsx)(S,{testId:`color-theme-input`,name:`color-theme-input`,label:e(a.SETTINGS$COLOR_THEME),items:g.map(e=>({key:e.key,label:e.label})),defaultSelectedKey:p(),onSelectionChange:t,isClearable:!1,wrapperClassName:`w-full min-w-0`})}function A(){return(0,D.jsxs)(`div`,{"data-testid":`app-settings-skeleton`,className:`px-11 py-9 flex flex-col gap-6`,children:[(0,D.jsx)(C,{}),(0,D.jsx)(w,{}),(0,D.jsx)(w,{})]})}function j(){let e=u(),{t}=i(`openhands`),{mutate:n,isPending:r}=x(),{data:p,isLoading:m}=y(),[h,g]=E.useState(!1),[S,C]=E.useState(!1),[w,j]=E.useState(!1),[M,N]=E.useState(!1),[P,F]=E.useState(!1),I=r=>{let i=r.get(`language-input`)?.toString(),u=l.find(({label:e})=>e===i)?.value||v.language,f=r.get(`enable-analytics-switch`)?.toString()===`on`;n({language:u,user_consents_to_analytics:f,enable_sound_notifications:r.get(`enable-sound-notifications-switch`)?.toString()===`on`,git_user_name:r.get(`git-user-name-input`)?.toString()||v.git_user_name,git_user_email:r.get(`git-user-email-input`)?.toString()||v.git_user_email},{onSuccess:()=>{b(e,f),d(f?`granted`:`denied`),o(t(a.SETTINGS$SAVED))},onError:e=>{c(s(e)||t(a.ERROR$GENERIC))},onSettled:()=>{g(!1),C(!1),j(!1),N(!1),F(!1)}})},L=e=>{let t=l.find(({label:t})=>t===e)?.label,n=l.find(({value:e})=>e===p?.language)?.label;g(t!==n)},R=e=>{C(e!==(p?.user_consents_to_analytics??!0))},z=e=>{j(e!==!!p?.enable_sound_notifications)},B=e=>{let t=p?.git_user_name;N(e!==t)},V=e=>{let t=p?.git_user_email;F(e!==t)},H=!h&&!S&&!w&&!M&&!P,U=!p||m||r;return(0,D.jsxs)(`form`,{"data-testid":`app-settings-screen`,action:I,className:`flex flex-col gap-6`,children:[U&&(0,D.jsx)(A,{}),!U&&(0,D.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,D.jsx)(O,{name:`language-input`,defaultKey:p.language,onChange:L}),(0,D.jsx)(k,{}),(0,D.jsx)(T,{testId:`enable-analytics-switch`,name:`enable-analytics-switch`,defaultIsToggled:p.user_consents_to_analytics??!0,onToggle:R,children:t(a.ANALYTICS$SEND_ANONYMOUS_DATA)}),(0,D.jsx)(T,{testId:`enable-sound-notifications-switch`,name:`enable-sound-notifications-switch`,defaultIsToggled:!!p.enable_sound_notifications,onToggle:z,children:t(a.SETTINGS$SOUND_NOTIFICATIONS)}),(0,D.jsxs)(`div`,{className:`border-t border-[var(--oh-border)] pt-6 mt-2`,children:[(0,D.jsx)(`h3`,{className:`text-lg font-medium mb-2`,children:t(a.SETTINGS$GIT_SETTINGS)}),(0,D.jsx)(`p`,{className:`mb-4 text-sm leading-5 text-tertiary-light`,children:t(a.SETTINGS$GIT_SETTINGS_DESCRIPTION)}),(0,D.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,D.jsx)(_,{testId:`git-user-name-input`,name:`git-user-name-input`,type:`text`,label:t(a.SETTINGS$GIT_USERNAME),defaultValue:p.git_user_name||``,onChange:B,placeholder:t(a.SETTINGS$GIT_USERNAME_PLACEHOLDER),className:`w-full min-w-0`}),(0,D.jsx)(_,{testId:`git-user-email-input`,name:`git-user-email-input`,type:`email`,label:t(a.SETTINGS$GIT_EMAIL),defaultValue:p.git_user_email||``,onChange:V,placeholder:t(a.SETTINGS$GIT_EMAIL_PLACEHOLDER),className:`w-full min-w-0`})]}),(0,D.jsx)(`div`,{className:`flex justify-start pt-4`,children:(0,D.jsxs)(f,{testId:`submit-button`,variant:`primary`,type:`submit`,isDisabled:r||H,children:[!r&&t(a.SETTINGS$SAVE_CHANGES),r&&t(a.SETTINGS$SAVING)]})})]})]})]})}var M=r(j);export{M as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,r as t}from"./rolldown-runtime-BFRubm34.js";import{Ct as n,bt as r}from"./vendor-styling-CI0PQ3ab.js";import{t as i}from"./useQuery-D5pEZbY0.js";import{t as a}from"./useTranslation-Cbf5AGg_.js";import{t as o}from"./declaration-BGsHjPEW.js";import{A as s,D as c,O as l,r as u}from"./active-backend-context-BCXRv5pm.js";import{t as d}from"./utils-DB9LsAzA.js";import{F as f,d as p,r as m,t as h}from"./agent-server-compatibility-D6DSanlx.js";import{n as g,r as _,y as v}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~dhilvkxv-BIieS_OD.js";import{a as y,i as b,n as x,r as S,t as C}from"./use-backends-health-DKt1SmiU.js";import{t as w}from"./modal-backdrop-Dsmzgr5s.js";import{n as T,r as E,t as D}from"./modal-body-CDZdZ-eT.js";import{n as O,r as k}from"./modal-classes-B4oit_4c.js";import{t as A}from"./brand-button-2Tp3aXk1.js";import{n as ee}from"./navigation-context-SjzfpygH.js";import{t as j}from"./modal-close-button-DQElFMPo.js";import{t as M}from"./settings-input-CzNOq-Pj.js";import{t as N}from"./segmented-toggle-C1-ZVyr5.js";import{t as P}from"./use-tracking-poxQHMwR.js";import{a as F,i as I,o as L,r as R,t as te}from"./cloud-funnel-analytics-D-27T5Ao.js";var z=e(n()),B=r(),ne=e=>(0,B.jsxs)(`svg`,{width:1365,height:1365,viewBox:`0 -24 148 148`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,B.jsx)(`path`,{d:`M71.7542 16.863V2.97414C71.7542 1.82355 72.6872 0.890503 73.8378 0.890503C74.9884 0.890503 75.9214 1.82355 75.9214 2.97414V16.863C75.9214 18.0136 74.9884 18.9466 73.8378 18.9466C72.6872 18.9466 71.7542 18.0136 71.7542 16.863Z`,fill:`white`}),(0,B.jsx)(`path`,{d:`M82.5272 18.9329L89.4716 6.90477C90.0469 5.90832 91.3215 5.5668 92.3179 6.1421C93.3144 6.7174 93.6559 7.99197 93.0806 8.98841L86.1362 21.0165C85.5609 22.0129 84.2863 22.3545 83.2899 21.7792C82.2934 21.2039 81.9519 19.9293 82.5272 18.9329Z`,fill:`white`}),(0,B.jsx)(`path`,{d:`M65.1481 18.9329L58.2037 6.90477C57.6284 5.90832 56.3538 5.5668 55.3574 6.1421C54.3609 6.7174 54.0194 7.99197 54.5947 8.98841L61.5391 21.0165C62.1144 22.0129 63.389 22.3545 64.3854 21.7792C65.3819 21.2039 65.7234 19.9293 65.1481 18.9329Z`,fill:`white`}),(0,B.jsx)(`path`,{d:`M140.606 62.0292C140.606 58.409 141.583 47.6748 141.89 44.1323C142.097 41.7374 141.809 40.4247 141.424 39.7542C141.141 39.2626 140.699 38.915 139.634 38.8436C138.865 38.7921 138.027 39.0114 137.401 39.5761C136.814 40.1052 136.159 41.1682 136.159 43.3176L136.155 43.4388L135.198 59.758C135.164 60.3451 134.883 60.8911 134.424 61.2599C133.966 61.6284 133.374 61.7859 132.793 61.6941L122.764 60.1068L111.948 58.6703C110.949 58.5376 110.188 57.7084 110.142 56.7016L109.561 44.1323C109.535 43.621 109.51 43.1141 109.484 42.6146C109.241 37.9294 109.022 33.7805 109.022 32.4282C109.022 28.3859 108.338 26.6806 107.74 25.9634C107.263 25.3915 106.577 25.1402 105.11 25.1402C104.583 25.1402 104.212 25.2481 103.933 25.4111C103.659 25.5714 103.346 25.8587 103.049 26.4208C102.41 27.6257 101.945 29.891 102.118 33.8479C102.342 38.9804 102.692 42.8146 103.035 46.2718C103.377 49.7231 103.718 52.8561 103.908 56.4971C104.204 62.1966 104.178 66.1256 103.945 68.7924C103.828 70.124 103.656 71.1996 103.423 72.0501C103.202 72.8558 102.871 73.6757 102.296 74.2887C101.6 75.0303 100.608 75.3844 99.577 75.136C98.7592 74.9389 98.1847 74.4215 97.8706 74.0916C97.2141 73.4017 96.7501 72.5106 96.568 72.0512C95.5097 69.3812 92.2352 63.1808 87.8023 59.6811C86.5089 58.6599 85.5666 58.3652 84.9736 58.3204C84.4148 58.2783 84.0094 58.4436 83.6909 58.6967C83.34 58.9756 83.0781 59.3811 82.9479 59.7643C82.9019 59.8999 82.8823 59.9968 82.8741 60.0584C84.0759 62.0865 88.8421 69.5222 91.0896 77.069C92.7648 82.6941 96.8038 88.4259 99.8194 90.8809C102.74 93.258 107.988 94.7313 113.9 95.0218C119.756 95.3095 125.788 94.4121 130.033 92.5092C138.233 88.8334 139.903 80.7382 140.651 77.2292C141.232 74.5057 141.243 71.5987 141.087 68.9009C141.01 67.5551 140.894 66.2969 140.793 65.1373C140.695 64.0105 140.606 62.9215 140.606 62.0292ZM120.986 27.0953C120.986 25.8314 120.648 24.7049 120.089 23.9514C119.583 23.27 118.84 22.7987 117.646 22.7984C116.668 22.7982 116.011 22.9187 115.546 23.1167C115.13 23.2943 114.781 23.5699 114.463 24.0831C113.73 25.2671 113.192 27.6455 113.189 32.384L113.721 43.9088C113.91 47.5661 114.106 51.4922 114.235 54.7707L120.986 55.6666V27.0953ZM125.153 56.2652L131.172 57.218L131.992 43.267V32.5083C131.992 31.031 131.39 30.1275 130.678 29.5489C129.884 28.9039 128.957 28.6731 128.519 28.6731C127.722 28.6731 126.899 28.797 126.306 29.2179C125.849 29.5421 125.153 30.3087 125.153 32.5083V56.2652ZM136.159 35.4278C137.406 34.8069 138.74 34.6083 139.912 34.6868C142.037 34.8292 143.91 35.718 145.037 37.6779C146.06 39.4592 146.273 41.8136 146.041 44.4927C145.72 48.1949 144.772 58.6457 144.772 62.0292C144.772 62.708 144.843 63.6116 144.944 64.7758C145.042 65.907 145.165 67.2389 145.247 68.6606C145.411 71.4987 145.422 74.8383 144.727 78.0987C144.002 81.4953 142.041 91.6918 131.738 96.3108C126.731 98.5551 120.002 99.4936 113.696 99.1838C107.445 98.8767 101.128 97.3189 97.1887 94.1122C93.4809 91.0937 88.9938 84.6307 87.0962 78.2589C84.9529 71.0619 80.3109 63.9646 79.1527 61.9533C78.4706 60.7689 78.684 59.3628 79.0019 58.4258C79.3607 57.3688 80.0554 56.2631 81.0993 55.4337C82.1758 54.5784 83.6043 54.0377 85.2876 54.1647C86.9369 54.2893 88.6462 55.0393 90.3834 56.4107C94.8541 59.9401 98.1342 65.5082 99.7424 68.9231C99.759 68.7664 99.779 68.6024 99.7941 68.4298C100.003 66.0435 100.039 62.3344 99.7467 56.7132C99.5635 53.1942 99.2356 50.1809 98.8888 46.6828C98.5425 43.1904 98.184 39.2713 97.955 34.0302C97.7722 29.8481 98.2012 26.6722 99.3672 24.471C99.9716 23.3302 100.79 22.4223 101.83 21.814C102.866 21.2087 103.995 20.974 105.11 20.974C106.759 20.974 108.813 21.2062 110.448 22.7678C110.593 22.4576 110.75 22.1652 110.921 21.8899C111.676 20.6698 112.681 19.8084 113.912 19.2835C115.095 18.7791 116.378 18.6309 117.646 18.6311C120.195 18.6315 122.164 19.7567 123.434 21.4683C124.256 22.576 124.75 23.8775 124.985 25.1982C126.338 24.5876 127.691 24.5068 128.519 24.5068C129.933 24.5068 131.784 25.0791 133.305 26.3154C134.908 27.6179 136.159 29.6733 136.159 32.5083V35.4278Z`,fill:`white`}),(0,B.jsx)(`path`,{d:`M7.15661 62.0292C7.15661 58.409 6.17994 47.6748 5.87291 44.1323C5.6654 41.7374 5.95357 40.4247 6.33875 39.7542C6.62116 39.2626 7.06336 38.915 8.12834 38.8436C8.89759 38.7921 9.73544 39.0114 10.3616 39.5761C10.9484 40.1052 11.6032 41.1682 11.6032 43.3176L11.6074 43.4388L12.5644 59.758C12.5988 60.3451 12.8798 60.8911 13.338 61.2599C13.7961 61.6284 14.3887 61.7859 14.9695 61.6941L24.9988 60.1068L35.8143 58.6703C36.8135 58.5376 37.5741 57.7084 37.6208 56.7016L38.2015 44.1323C38.2279 43.621 38.2525 43.1141 38.2784 42.6146C38.5218 37.9294 38.7401 33.7805 38.7401 32.4282C38.7401 28.3859 39.4246 26.6806 40.0227 25.9634C40.4996 25.3915 41.185 25.1402 42.6523 25.1402C43.1794 25.1402 43.5505 25.2481 43.8295 25.4111C44.1038 25.5714 44.416 25.8587 44.7138 26.4208C45.3521 27.6257 45.8173 29.891 45.6444 33.8479C45.4201 38.9804 45.0703 42.8146 44.7275 46.2718C44.3853 49.7231 44.0443 52.8561 43.8548 56.4971C43.5582 62.1966 43.5847 66.1256 43.8179 68.7924C43.9344 70.124 44.1069 71.1996 44.3396 72.0501C44.5601 72.8558 44.891 73.6757 45.4663 74.2887C46.1625 75.0303 47.1546 75.3844 48.1855 75.136C49.0033 74.9389 49.5778 74.4215 49.8918 74.0916C50.5484 73.4017 51.0123 72.5106 51.1945 72.0512C52.2527 69.3812 55.5272 63.1808 59.9601 59.6811C61.2536 58.6599 62.1958 58.3652 62.7889 58.3204C63.3476 58.2783 63.753 58.4436 64.0715 58.6967C64.4225 58.9756 64.6844 59.3811 64.8146 59.7643C64.8606 59.8999 64.8801 59.9968 64.8883 60.0584C63.6866 62.0865 58.9204 69.5222 56.6729 77.069C54.9977 82.6941 50.9586 88.4259 47.9431 90.8809C45.0229 93.258 39.7747 94.7313 33.8624 95.0218C28.0068 95.3095 21.9748 94.4121 17.7297 92.5092C9.52988 88.8334 7.85961 80.7382 7.11129 77.2292C6.53054 74.5057 6.5195 71.5987 6.67496 68.9009C6.75251 67.5551 6.86809 66.2969 6.96901 65.1373C7.06707 64.0105 7.1566 62.9215 7.15661 62.0292ZM26.7768 27.0953C26.7768 25.8314 27.1147 24.7049 27.6737 23.9514C28.1792 23.27 28.9221 22.7987 30.1167 22.7984C31.0942 22.7982 31.7518 22.9187 32.2162 23.1167C32.6326 23.2943 32.9817 23.5699 33.2996 24.0831C34.0328 25.2671 34.5705 27.6455 34.5738 32.384L34.0416 43.9088C33.8524 47.5661 33.6565 51.4922 33.5273 54.7707L26.7768 55.6666V27.0953ZM22.6095 56.2652L16.5904 57.218L15.7705 43.267V32.5083C15.7705 31.031 16.3726 30.1275 17.0847 29.5489C17.8785 28.9039 18.8058 28.6731 19.2432 28.6731C20.0404 28.6731 20.8634 28.797 21.4565 29.2179C21.9131 29.5421 22.6095 30.3087 22.6095 32.5083V56.2652ZM11.6032 35.4278C10.3568 34.8069 9.02265 34.6083 7.8501 34.6868C5.72541 34.8292 3.85197 35.718 2.72584 37.6779C1.70247 39.4592 1.48924 41.8136 1.72143 44.4927C2.0423 48.1949 2.99038 58.6457 2.99038 62.0292C2.99037 62.708 2.91991 63.6116 2.81859 64.7758C2.72014 65.907 2.59699 67.2389 2.51505 68.6606C2.3515 71.4987 2.34041 74.8383 3.0357 78.0987C3.76005 81.4953 5.72154 91.6918 16.0245 96.3108C21.0311 98.5551 27.7601 99.4936 34.0669 99.1838C40.3172 98.8767 46.6346 97.3189 50.5737 94.1122C54.2816 91.0937 58.7686 84.6307 60.6662 78.2589C62.8095 71.0619 67.4515 63.9646 68.6098 61.9533C69.2919 60.7689 69.0785 59.3628 68.7605 58.4258C68.4018 57.3688 67.707 56.2631 66.6632 55.4337C65.5867 54.5784 64.1582 54.0377 62.4748 54.1647C60.8256 54.2893 59.1162 55.0393 57.379 56.4107C52.9083 59.9401 49.6283 65.5082 48.02 68.9231C48.0034 68.7664 47.9835 68.6024 47.9684 68.4298C47.7597 66.0435 47.7232 62.3344 48.0158 56.7132C48.1989 53.1942 48.5269 50.1809 48.8737 46.6828C49.22 43.1904 49.5784 39.2713 49.8075 34.0302C49.9903 29.8481 49.5612 26.6722 48.3952 24.471C47.7909 23.3302 46.9729 22.4223 45.9321 21.814C44.8964 21.2087 43.7676 20.974 42.6523 20.974C41.0038 20.974 38.9497 21.2062 37.3141 22.7678C37.1698 22.4576 37.0124 22.1652 36.8419 21.8899C36.0863 20.6698 35.0817 19.8084 33.8508 19.2835C32.6679 18.7791 31.3849 18.6309 30.1167 18.6311C27.5677 18.6315 25.5986 19.7567 24.3285 21.4683C23.5066 22.576 23.0121 23.8775 22.7771 25.1982C21.4247 24.5876 20.0718 24.5068 19.2432 24.5068C17.8298 24.5068 15.9788 25.0791 14.4573 26.3154C12.8542 27.6179 11.6032 29.6733 11.6032 32.5083V35.4278Z`,fill:`white`})]}),V=e=>(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,B.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M15.3235 10.9352L11.5016 14.2111L7.67969 10.9352L8.6152 9.84375L11.5016 12.3178L14.388 9.84375L15.3235 10.9352Z`,fill:`currentColor`})});function H(e,t,n){let r=n?.lastError??null,i=t?.kind===`cloud`;return i&&!t?.apiKey?.trim()||b(r)?e(o.BACKEND$STATUS_DISCONNECTED_ADD_API_KEY):S(r)?e(o.BACKEND$STATUS_DISCONNECTED_CHECK_API_KEY):x(r)?e(o.BACKEND$LOGGED_OUT):n?.isConnected===!0?e(o.ONBOARDING$BACKEND_STATUS_CONNECTED):i&&n?.isConnected===!1&&(C(r)||s(r))?e(o.BACKEND$STATUS_DISCONNECTED_CHECK_CLOUD_ACCESS):n?.isConnected===!1&&l(r)?e(o.BACKEND$STATUS_DISCONNECTED_CHECK_TUNNEL):n?.isConnected===!1&&s(r)?e(o.BACKEND$STATUS_DISCONNECTED_CHECK_URL_OR_NETWORK):n?.isConnected===!1?e(o.ONBOARDING$BACKEND_STATUS_DISCONNECTED):e(o.ONBOARDING$BACKEND_STATUS_CHECKING)}function U({isConnected:e,className:t}){let n,r,i;return e===`unavailable`?(n=`bg-[var(--oh-text-tertiary)]`,r=`No Backend Available`,i=`unavailable`):e===!0?(n=`bg-[var(--oh-status-success)]`,r=`Connected`,i=`connected`):e===!1?(n=`bg-red-500`,r=`Disconnected`,i=`disconnected`):(n=`bg-[var(--oh-interactive-selected)]`,r=`Checking connection`,i=`checking`),(0,B.jsx)(`span`,{"data-testid":`backend-status-dot`,"data-status":i,"aria-label":r,title:r,role:`status`,className:d(`inline-block w-2 h-2 rounded-full shrink-0`,n,t)})}var W={status:`idle`,verificationUrl:null,userCode:null,apiKey:null,error:null,errorCode:null};function re(){let[e,t]=z.useState(W),n=z.useRef(null),r=z.useCallback((e,r)=>{n.current?.abort();let i=new AbortController;n.current=i,t({...W,status:`starting`}),(async()=>{let n;try{n=await L(e)}catch(e){if(i.signal.aborted)return;let n=e instanceof Error?e.message:`Failed to start device flow`,r=e instanceof g?e.code:void 0;t({...W,status:`error`,error:n,errorCode:r??null});return}if(!i.signal.aborted){R(e,r),t({...W,status:`awaiting_authorization`,verificationUrl:n.verification_uri_complete,userCode:n.user_code});try{let a=await F(e,n.device_code,{interval:n.interval,signal:i.signal});if(i.signal.aborted)return;I(e,r),t({...W,status:`success`,apiKey:a.access_token})}catch(e){if(i.signal.aborted)return;if(e instanceof g&&e.code===`cancelled`){t(W);return}let n=e instanceof Error?e.message:`Authorization failed`,r=e instanceof g?e.code:void 0;t({...W,status:`error`,error:n,errorCode:r??null})}}})()},[]),i=z.useCallback(()=>{n.current?.abort(),n.current=null,t(W)},[]),a=z.useCallback(()=>{n.current?.abort(),n.current=null,t(W)},[]);return z.useEffect(()=>()=>{n.current?.abort()},[]),{...e,start:r,cancel:i,reset:a}}function G(e){try{return new URL(e).protocol===`https:`}catch{return!1}}function K({host:e,onSuccess:t,testIdRoot:n,isDisabled:r=!1,idleButtonLabel:i,idleButtonContent:s,className:c,buttonClassName:l,buttonVariant:u=`primary`,statusDisplay:f=`inline`,analyticsSource:p}){let{t:m}=a(`openhands`),h=re(),g=z.useRef(null);z.useEffect(()=>()=>{g.current?.close()},[]),z.useEffect(()=>{if(h.status===`awaiting_authorization`&&h.verificationUrl&&g.current&&!g.current.closed){if(!G(h.verificationUrl)){console.error(`Invalid verification URL protocol`);return}try{g.current.location.href=h.verificationUrl}catch{g.current=window.open(h.verificationUrl,`_blank`,`noopener,noreferrer`)}}},[h.status,h.verificationUrl]),z.useEffect(()=>{if(h.status===`success`&&h.apiKey)try{t(h.apiKey)}finally{h.reset(),g.current?.close()}},[h.status,h.apiKey,h.reset,t]);let _=()=>{let t=e.trim().replace(/\/+$/,``),n=/^https?:\/\//i.test(t)?t:`https://${t}`;try{let e=new URL(n);if(e.username||e.password)throw Error(`Invalid URL format`)}catch{return}g.current=window.open(`about:blank`,`_blank`),g.current||console.warn(`Popup blocked - user will need to use manual link`),h.start(n,p)},v=()=>{h.cancel(),g.current?.close()},y=(0,B.jsx)(ie,{status:h.status,error:h.error,verificationUrl:h.verificationUrl,testIdRoot:n,onCancel:v,onRetry:_}),b=f===`modal`&&h.status!==`idle`,x=i??m(o.BACKEND$LOGIN_WITH_OPENHANDS);return(0,B.jsxs)(`div`,{"data-testid":`${n}-device-flow`,className:d(`flex flex-col gap-3`,c),children:[h.status===`idle`&&u===`unstyled`&&(0,B.jsx)(`button`,{type:`button`,onClick:_,"data-testid":`${n}-login-button`,className:l,disabled:r,"aria-label":s?x:void 0,children:s??x}),h.status===`idle`&&u!==`unstyled`&&(0,B.jsx)(A,{type:`button`,variant:u,onClick:_,testId:`${n}-login-button`,className:d(`w-full`,l),isDisabled:r,ariaLabel:s?x:void 0,children:s??x}),f===`inline`?y:null,b?(0,B.jsx)(w,{onClose:v,"aria-label":m(o.BACKEND$LOGIN_WITH_OPENHANDS),closeOnBackdropClick:!1,children:(0,B.jsx)(T,{testID:`${n}-auth-modal`,width:`sm`,className:`items-stretch border border-[var(--oh-border)]`,children:y})}):null]})}function ie({status:e,error:t,verificationUrl:n,testIdRoot:r,onCancel:i,onRetry:s}){let{t:c}=a(`openhands`);if(e===`idle`||e===`success`)return null;if(e===`starting`)return(0,B.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-base-tertiary p-3`,"data-testid":`${r}-auth-starting`,role:`status`,"aria-live":`polite`,children:[(0,B.jsx)(q,{}),(0,B.jsx)(`span`,{className:`text-sm text-[var(--oh-text-tertiary)]`,children:c(o.BACKEND$AUTH_STARTING)})]});if(e===`awaiting_authorization`){let e=n&&G(n)?n:null;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-lg bg-base-tertiary p-4`,"data-testid":`${r}-auth-awaiting`,role:`status`,"aria-live":`polite`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(q,{}),(0,B.jsx)(`span`,{className:`text-sm font-medium text-white`,children:c(o.BACKEND$AUTH_AWAITING)})]}),(0,B.jsx)(`p`,{className:`text-sm leading-5 text-[var(--oh-text-tertiary)]`,children:c(o.BACKEND$AUTH_BROWSER_OPENED)}),e?(0,B.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-md border border-[var(--oh-border)] bg-[var(--oh-surface)] p-3 text-xs text-[var(--oh-muted)]`,children:[(0,B.jsx)(`p`,{children:c(o.BACKEND$AUTH_OPEN_MANUALLY)}),(0,B.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`max-h-16 overflow-auto break-all text-blue-400 hover:underline`,children:e})]}):null,(0,B.jsx)(A,{type:`button`,variant:`secondary`,onClick:i,testId:`${r}-auth-cancel`,className:`w-full`,children:c(o.BACKEND$AUTH_CANCEL)})]})}return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg border border-red-700 bg-red-900/20 p-4`,"data-testid":`${r}-auth-error`,role:`alert`,children:[(0,B.jsx)(`p`,{className:`text-sm text-red-400`,children:t}),(0,B.jsx)(A,{type:`button`,variant:`secondary`,onClick:s,testId:`${r}-auth-retry`,className:`w-full`,children:c(o.BACKEND$AUTH_RETRY)})]})}function q(){return(0,B.jsx)(`svg`,{className:`animate-spin h-4 w-4 text-white`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z`})})}var ae=t({BackendConnectionOptions:()=>$,BackendForm:()=>Q,BackendFormModal:()=>_e});function oe(e){return _(e)?`cloud`:`local`}function se(e){let t=e.toLowerCase().replace(/^\[|\]$/g,``);return!!(t===`localhost`||t===`::1`||t===`::`||t===`0.0.0.0`||/^127\./.test(t)||/^::ffff:127\./i.test(t)||/^10\./.test(t)||/^192\.168\./.test(t)||/^172\.(1[6-9]|2\d|3[01])\./.test(t)||/^fe[89ab][0-9a-f]:/i.test(t)||/^f[cd][0-9a-f]{2}:/i.test(t)||t.endsWith(`.local`)||!t.includes(`.`)&&!t.includes(`:`))}function J(e){let t=e.trim().replace(/\/+$/,``);if(!t)return``;if(/^https?:\/\//i.test(t))return t;let n=t.match(/^\[([^\]]+)\]/);return`${se(n?n[1]:(t.match(/:/g)??[]).length>1?t:t.split(`:`)[0])?`http`:`https`}://${t}`}function Y(e){let t=e.trim();if(!t||/\s/.test(t))return!1;let n=J(t);if(!n)return!1;try{let e=new URL(n);return(e.protocol===`http:`||e.protocol===`https:`)&&e.hostname.length>0}catch{return!1}}var X=`https://app.all-hands.dev`;function ce(e,t){return e(o.BACKEND$CONNECTION_TEST_FAILED,{host:t,interpolation:{escapeValue:!1}})}function le(e){return c(e)}function ue(e,t){let n=le(t);return n?`${e}\n${n}`:e}async function Z(e){e.kind===`local`&&h(await new v(p({host:e.host,sessionApiKey:e.apiKey||null,timeout:5e3})).getServerInfo())}function de({backend:e,testIdRoot:t}){let{t:n}=a(`openhands`),r=y([e])[e.id],s=r?.isConnected??null,c=r?.disabled===!0,l=r?.consecutiveFailures??0,u=r?.lastError??null,{data:d}=i({queryKey:[`backend-version`,e.host,e.apiKey],queryFn:async()=>m(await new v(p({host:e.host,sessionApiKey:e.apiKey||null,timeout:5e3})).getServerInfo()),retry:!1,staleTime:6e4,enabled:e.kind===`local`&&!c}),f=H(n,e,r),h=e.kind===`cloud`?n(o.BACKEND$KIND_CLOUD):n(o.BACKEND$KIND_LOCAL);return(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsxs)(`div`,{"data-testid":`${t}-status`,className:`flex items-center gap-3 text-sm`,children:[(0,B.jsx)(U,{isConnected:s}),(0,B.jsx)(`span`,{className:`text-white`,"data-testid":`${t}-status-label`,children:f}),(0,B.jsx)(`span`,{className:`text-tertiary-alt`,children:`·`}),(0,B.jsx)(`span`,{className:`text-[var(--oh-text-tertiary)]`,children:h}),d?(0,B.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)]`,"data-testid":`${t}-version`,children:n(o.BACKEND$VERSION_LABEL,{version:d})}):null]}),c?(0,B.jsxs)(`div`,{"data-testid":`${t}-status-error`,className:`flex flex-col gap-1 rounded-md border border-red-500/40 bg-red-500/10 p-3 text-sm`,children:[(0,B.jsx)(`span`,{className:`font-semibold text-red-300`,children:n(o.BACKEND$HEALTH_FAILED_TITLE)}),(0,B.jsx)(`span`,{className:`text-xs text-[var(--oh-text-tertiary)]`,children:n(o.BACKEND$HEALTH_FAILED_DETAIL,{count:l})}),u?(0,B.jsx)(`span`,{"data-testid":`${t}-status-error-message`,className:`text-xs text-red-300 whitespace-pre-wrap break-words`,children:u}):null]}):null]})}function fe({initialName:e=``,initialHost:t=``,initialApiKey:n=``,onTestConnection:r,onSuccess:i,requireApiKey:o=!1,onSubmitOverride:s}){let{t:c}=a(`openhands`),[l,u]=z.useState(e),[d,f]=z.useState(t),[p,m]=z.useState(n),[h,g]=z.useState(null),[_,v]=z.useState(!1),[y,b]=z.useState(null),x=y??oe(d),S=o||x!==`local`,C=l.trim().length>0&&Y(d)&&(!S||p.trim().length>0);return{name:l,setName:u,host:d,setHost:f,apiKey:p,setApiKey:m,connectionError:h,setConnectionError:g,isSubmitting:_,kind:x,setKind:b,canSubmit:C,handleSubmit:z.useCallback(async e=>{if(e.preventDefault(),!C||_)return;let t={name:l.trim(),host:J(d),apiKey:p.trim(),kind:x};g(null),v(!0);try{s?await s(t):(await r(t),i())}catch(e){g(ue(ce(c,t.host),e))}finally{v(!1)}},[C,_,l,d,p,x,r,i,o,s,c])}}function Q({mode:e,backend:t,onSubmitted:n,renderActions:r,testIdRoot:i,hostReadOnly:s,requireApiKey:c,hideConfigurationFields:l=!1,onSubmitOverride:f}){let{t:p}=a(`openhands`),{addBackend:m,updateBackend:h}=u(),g=e===`edit`&&t?t.kind:null,{name:_,setName:v,host:y,setHost:b,apiKey:x,setApiKey:S,connectionError:C,setConnectionError:w,isSubmitting:T,kind:E,handleSubmit:D}=fe({initialName:t?.name??``,initialHost:t?.host??``,initialApiKey:t?.apiKey??``,onTestConnection:Z,onSuccess:async()=>{let r={name:_.trim(),host:J(y),apiKey:x.trim(),kind:g??E};e===`edit`&&t?h(t.id,r):m(r),n()},requireApiKey:c,onSubmitOverride:f}),[O,k]=z.useState(!1),[ee,j]=z.useState(!1),N=g??E,P=i??(e===`edit`?`edit-backend`:`add-backend`),F=c||N!==`local`,I=_.trim().length>0&&Y(y)&&(!F||x.trim().length>0),L=O&&!_.trim()?p(o.BACKEND$NAME_REQUIRED):void 0,R=ee?y.trim()?Y(y)?void 0:p(o.BACKEND$HOST_INVALID):p(o.BACKEND$HOST_REQUIRED):void 0;return(0,B.jsxs)(`form`,{"data-testid":`${P}-form`,onSubmit:async e=>{if(!I){k(!0),j(!0);return}await D(e)},className:`flex flex-col gap-4`,children:[(0,B.jsxs)(`div`,{"data-testid":`${P}-configuration-fields`,className:d(`flex flex-col gap-4`,l&&`hidden`),children:[(0,B.jsx)(M,{testId:`${P}-name`,name:`${P}-name`,type:`text`,label:p(o.BACKEND$NAME_LABEL),value:_,onChange:e=>{v(e),w(null)},onBlur:()=>k(!0),placeholder:`Production`,className:`w-full`,showRequiredTag:!0,error:L}),(0,B.jsx)(M,{testId:`${P}-host`,name:`${P}-host`,type:`text`,label:p(o.BACKEND$HOST_LABEL),value:y,onChange:s?void 0:e=>{b(e),w(null)},onBlur:()=>j(!0),placeholder:X,className:`w-full`,showRequiredTag:!0,error:R,isDisabled:s}),(0,B.jsx)(M,{testId:`${P}-api-key`,name:`${P}-api-key`,type:`password`,label:p(o.BACKEND$KEY_LABEL),value:x,onChange:e=>{S(e),w(null)},placeholder:``,className:`w-full`}),C?(0,B.jsx)(`div`,{role:`alert`,"data-testid":`${P}-error`,className:`rounded-md border border-red-500/40 bg-red-500/10 p-3 text-sm text-red-300 whitespace-pre-wrap break-words`,children:C}):null,e===`edit`&&t&&(0,B.jsx)(de,{backend:t,testIdRoot:P})]}),r?r({canSubmit:I&&!T,isSubmitting:T,testIdRoot:P}):(0,B.jsxs)(`div`,{className:`flex justify-end gap-2 mt-2 w-full`,children:[(0,B.jsx)(A,{type:`button`,variant:`secondary`,onClick:n,testId:`${P}-cancel`,children:p(o.BUTTON$CANCEL)}),(0,B.jsx)(A,{type:`submit`,variant:`primary`,isDisabled:!I||T,testId:`${P}-submit`,children:p(o.BACKEND$SAVE)})]})]})}function pe(){let{currentPath:e,navigate:t}=ee();return z.useCallback(()=>{/^\/automations\/[^/]+/.test(e)?t(`/automations`):/^\/conversations\/[^/]+/.test(e)&&t(`/conversations`)},[e,t])}function $({onConnected:e,testIdRoot:t=`add-backend`,initialManualBackend:n,requireManualApiKey:r=!1,manualSubmitLabel:i,manualSubmittingLabel:s,manualSubmitTestId:c,analyticsSource:l}){let{t:u}=a(`openhands`),d=f();return d?(0,B.jsx)(`div`,{"data-testid":`${t}-connection-options`,className:`flex justify-center`,children:(0,B.jsx)(`div`,{className:`w-full`,children:(0,B.jsx)(he,{onConnected:e,testIdRoot:t,lockedHost:d,analyticsSource:l})})}):(0,B.jsxs)(`div`,{"data-testid":`${t}-connection-options`,className:`flex flex-col gap-6 md:flex-row`,children:[(0,B.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,B.jsx)(me,{onConnected:e,testIdRoot:t,initialBackend:n,requireApiKey:r,submitLabel:i??u(o.BACKEND$CONNECT),submittingLabel:s??u(o.ONBOARDING$BACKEND_STATUS_CHECKING),submitTestId:c})}),(0,B.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,B.jsx)(he,{onConnected:e,testIdRoot:t,analyticsSource:l})})]})}function me({onConnected:e,testIdRoot:t,initialBackend:n,requireApiKey:r,submitLabel:i,submittingLabel:s,submitTestId:c}){let{t:l}=a(`openhands`),{name:u,setName:d,host:f,setHost:p,apiKey:m,setApiKey:h,connectionError:g,setConnectionError:_,isSubmitting:v,kind:y,setKind:b,canSubmit:x,handleSubmit:S}=fe({initialName:n?.name??``,initialHost:n?.host??``,initialApiKey:n?.apiKey??``,onTestConnection:Z,onSuccess:()=>{e({name:u.trim(),host:J(f),apiKey:m.trim(),kind:y},`manual`)},requireApiKey:r});return(0,B.jsxs)(`form`,{"data-testid":`${t}-form`,onSubmit:S,className:`flex flex-col gap-4 flex-1 min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,B.jsx)(M,{testId:`${t}-name`,name:`${t}-name`,type:`text`,label:l(o.BACKEND$NAME_LABEL),value:u,onChange:e=>{d(e),_(null)},placeholder:`e.g. My Server`,className:`w-full`}),(0,B.jsx)(`p`,{className:`text-xs text-[var(--oh-muted)]`,children:l(o.BACKEND$NAME_HELPER)})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,B.jsx)(M,{testId:`${t}-host`,name:`${t}-host`,type:`text`,label:l(o.BACKEND$HOST_LABEL),value:f,onChange:e=>{p(e),_(null)},placeholder:`http://localhost:8000`,className:`w-full`}),(0,B.jsx)(`p`,{className:`text-xs text-[var(--oh-muted)]`,"data-testid":`${t}-host-helper`,children:l(o.BACKEND$HOST_HELPER)})]}),(0,B.jsxs)(`div`,{className:`flex flex-col items-start gap-2.5`,children:[(0,B.jsx)(`span`,{className:`text-sm`,children:l(o.BACKEND$KIND_LABEL)}),(0,B.jsx)(N,{value:y,options:[{value:`local`,label:l(o.BACKEND$KIND_LOCAL)},{value:`cloud`,label:l(o.BACKEND$KIND_CLOUD)}],onChange:e=>b(e),ariaLabel:l(o.BACKEND$KIND_LABEL),testId:`${t}-kind`})]}),(0,B.jsx)(M,{testId:`${t}-api-key`,name:`${t}-api-key`,type:`password`,label:l(o.BACKEND$KEY_LABEL),value:m,onChange:e=>{h(e),_(null)},placeholder:`sk-••••••••••`,className:`w-full`}),g?(0,B.jsx)(`div`,{role:`alert`,"data-testid":`${t}-error`,className:`rounded-md border border-red-500/40 bg-red-500/10 p-3 text-sm text-red-300 whitespace-pre-wrap break-words`,children:g}):null,(0,B.jsx)(A,{type:`submit`,variant:`secondary`,isDisabled:!x||v,testId:c??`${t}-submit`,className:`w-full text-center`,children:v?s:i})]})}function he({onConnected:e,testIdRoot:t,lockedHost:n,analyticsSource:r}){let{t:i}=a(`openhands`),[s,c]=z.useState(!1),[l,u]=z.useState(``),f=n??(l.trim()||X);return(0,B.jsxs)(`div`,{className:`flex flex-1 min-w-0 flex-col items-center gap-3 pb-8`,children:[(0,B.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,B.jsx)(ne,{width:56,height:56,"aria-hidden":!0}),(0,B.jsx)(`h4`,{className:k,"data-testid":`${t}-cloud-title`,children:i(o.BACKEND$CLOUD_TITLE)})]}),(0,B.jsx)(`p`,{className:`text-center text-sm leading-relaxed text-[var(--oh-muted)]`,children:i(o.BACKEND$CLOUD_DESCRIPTION)}),(0,B.jsx)(K,{host:f,onSuccess:t=>{e({name:`OpenHands Cloud`,host:J(f),apiKey:t,kind:`cloud`},`cloud_login`)},testIdRoot:t,analyticsSource:r}),n?null:(0,B.jsxs)(`div`,{className:`w-full`,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>c(e=>!e),"aria-expanded":s,"data-testid":`${t}-advanced-toggle`,className:`flex w-full cursor-pointer items-center justify-center gap-1 text-center text-xs text-[var(--oh-muted)] transition-colors hover:text-content-2`,children:[(0,B.jsx)(`span`,{children:i(o.BACKEND$ADVANCED)}),(0,B.jsx)(V,{className:d(`h-4 w-4 shrink-0 text-muted transition-transform`,s&&`rotate-180`),"aria-hidden":!0})]}),(0,B.jsxs)(`div`,{className:d(`pt-2`,!s&&`pointer-events-none invisible`),"aria-hidden":!s,children:[(0,B.jsx)(M,{testId:`${t}-cloud-host`,name:`${t}-cloud-host`,type:`text`,label:i(o.BACKEND$HOST_LABEL),value:l,onChange:u,placeholder:X,className:`w-full`}),(0,B.jsx)(`p`,{className:`mt-1 text-xs text-[var(--oh-muted)]`,children:i(o.BACKEND$LOGIN_CLOUD_HINT)})]})]})]})}function ge({onClose:e,source:t}){let{addBackend:n}=u(),r=pe(),{trackBackendAdded:i}=P();return(0,B.jsx)($,{onConnected:z.useCallback((a,o)=>{n(a);let s=_(a.host);te({backendKind:a.kind,connectionMethod:o,host:a.host,hasApiKey:!!a.apiKey,source:t})||i({backendKind:a.kind,connectionMethod:o,isOpenhandsCloud:s,isCustomHost:!s,hasApiKey:!!a.apiKey,source:t}),r(),e()},[n,r,e,i,t]),analyticsSource:t})}function _e({mode:e,backend:t,onClose:n,source:r=`add_backend_modal`,hideCloseButton:i=!1}){let{t:s}=a(`openhands`);if(e===`add`)return(0,B.jsx)(w,{onClose:i?void 0:n,closeOnEscape:!1,closeOnBackdropClick:!i,"aria-label":s(o.BACKEND$ADD_TITLE),children:(0,B.jsxs)(`div`,{"data-testid":i?`onboarding-modal`:`add-backend-modal`,className:d(`relative rounded-xl border border-[var(--oh-border)] bg-base-secondary`,E(`xl`),D),children:[i?null:(0,B.jsx)(j,{onClose:n,testId:`add-backend-close`}),i?null:(0,B.jsx)(`div`,{className:`px-6 pt-6 pb-2 pr-12`,children:(0,B.jsx)(`h2`,{className:O,children:s(o.BACKEND$ADD_TITLE)})}),(0,B.jsx)(`div`,{className:d(`px-6 pb-6`,i?`pt-6`:`pt-2`),children:(0,B.jsx)(ge,{onClose:n,source:r})})]})});let c=`edit-backend`;return(0,B.jsx)(w,{onClose:n,closeOnEscape:!1,"aria-label":s(o.BACKEND$EDIT_TITLE),children:(0,B.jsxs)(`div`,{"data-testid":`${c}-modal`,className:d(`relative bg-base-secondary p-6 rounded-xl flex flex-col gap-4 border border-[var(--oh-border)]`,E(`md`)),children:[(0,B.jsx)(j,{onClose:n,testId:`${c}-close`}),(0,B.jsx)(`h2`,{className:d(`pr-6`,O),children:s(o.BACKEND$EDIT_TITLE)}),(0,B.jsx)(Q,{mode:`edit`,backend:t,onSubmitted:n,testIdRoot:c})]})})}export{K as a,V as c,ae as i,Q as n,U as o,_e as r,H as s,$ as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./react-ao3tWj6K.js";var t={url:``,screenshotSrc:``},n=e(e=>({...t,setUrl:t=>e({url:t}),setScreenshotSrc:t=>e({screenshotSrc:t}),reset:()=>e(t)}));export{n as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./package-Dk_VtWJ4.js";var t=`agent_canvas`,n=e.version,r={"X-OpenHands-Client":t,"X-OpenHands-Client-Version":n};export{t as n,n as r,r as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,i as t,r as n}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~dhilvkxv-BIieS_OD.js";import{a as r,r as i}from"./telemetry-DHiTRl5_.js";import{n as a,r as o,t as s}from"./client-source-Biqarhgr.js";function c(t){return e(t,{headers:s})}function l(e,n,r){return t(e,n,{...r,headers:s})}var u={client_source:a,client_version:o};function d(e,t){return i()?(r(e,{...t,...u}),!0):!1}function f(e){let t=n(e);return{is_openhands_cloud:t,is_custom_host:!t}}function p(e,t){return d(`cloud_device_authorization_started`,{...f(e),source:t})}function m(e,t){return d(`cloud_device_authorization_succeeded`,{...f(e),source:t})}function h({backendKind:e,connectionMethod:t,host:n,hasApiKey:r,source:i}){return d(`backend_added`,{backend_kind:e,connection_method:t,...f(n),has_api_key:r,source:i})}function g(e,t){return d(`cloud_conversation_ready`,{task_id:e,conversation_id:t})}export{l as a,m as i,g as n,c as o,p as r,h as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./conversation-D4o4dG2t.js";export{e as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./conversation-D4o4dG2t.js";export{e as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./react-ao3tWj6K.js";var t=e(e=>({execution_status:null,setExecutionStatus:t=>e({execution_status:t}),reset:()=>e({execution_status:null})}));export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=(e,t)=>{e&&(t&&!e.has_opted_in_capturing()&&e.opt_in_capturing(),!t&&!e.has_opted_out_capturing()&&e.opt_out_capturing())};export{e as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./home-D7ds4Jyw.js";export{e as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./home-D7ds4Jyw.js";export{e as default};
|