@runfusion/fusion 0.73.0-beta.3 → 0.73.0-beta.5
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/dist/bin.js +4516 -1896
- package/dist/child-process-worker.js +2647 -936
- package/dist/client/.vite/manifest.json +266 -266
- package/dist/client/assets/{AgentDetailView-lJqxsPOR.js → AgentDetailView-BksUqG3-.js} +4 -4
- package/dist/client/assets/AgentDetailView-CoeSgMXS.css +1 -0
- package/dist/client/assets/AgentPermissionPolicyEditor-CXib-igK.css +1 -0
- package/dist/client/assets/{AgentPermissionPolicyEditor-De4wK_UT.js → AgentPermissionPolicyEditor-uXItB9Br.js} +1 -1
- package/dist/client/assets/AgentsView-m8J2hu5I.js +24 -0
- package/dist/client/assets/{ChatView-BeQXaz7_.js → ChatView-DsAg47W3.js} +3 -3
- package/dist/client/assets/{CommandCenter-BJZCaPLj.js → CommandCenter-DHt4n__j.js} +1 -1
- package/dist/client/assets/{DevServerView-DQgwQXKx.js → DevServerView-D7miVumP.js} +1 -1
- package/dist/client/assets/{DirectoryPicker-B2UVwp6F.js → DirectoryPicker-C0jXctyL.js} +1 -1
- package/dist/client/assets/{DocumentsView-DOeYrhvg.js → DocumentsView-CghLIkD9.js} +1 -1
- package/dist/client/assets/{EvalsView-LwepJ9Ud.js → EvalsView-MIoF_8pc.js} +1 -1
- package/dist/client/assets/{ExperimentalAgentOnboardingModal-DVNSzflw.js → ExperimentalAgentOnboardingModal-Dz4H4H2a.js} +1 -1
- package/dist/client/assets/{GoalsView-__LpXw4S.js → GoalsView-yPwwGY-D.js} +1 -1
- package/dist/client/assets/{InsightsView-Dv388uaO.js → InsightsView-DP4X2uEa.js} +1 -1
- package/dist/client/assets/{MemoryView-ChCbEfZT.js → MemoryView-m3ceUV-6.js} +1 -1
- package/dist/client/assets/{PiExtensionsManager-DehAjrqN.js → PiExtensionsManager-KuBkruy9.js} +1 -1
- package/dist/client/assets/PluginManager-CaQ-dg5n.js +1 -0
- package/dist/client/assets/{PullRequestView-BvmajsBq.js → PullRequestView-BPIlRW8u.js} +1 -1
- package/dist/client/assets/{ReportModal-DM9B_h_w.js → ReportModal-DanKtCSD.js} +5 -5
- package/dist/client/assets/{ResearchView-BzXSgUhp.js → ResearchView-Ch6GjDZD.js} +2 -2
- package/dist/client/assets/{SecretsView-COBqEdJj.js → SecretsView-DkxXeLAr.js} +1 -1
- package/dist/client/assets/{SessionTerminal-BUw_FTlh.js → SessionTerminal-BxxAyQqQ.js} +1 -1
- package/dist/client/assets/SettingsModal-C2rdGmkE.js +21 -0
- package/dist/client/assets/SettingsModal-CMLHZBhX.css +1 -0
- package/dist/client/assets/{SettingsModal-CsLaIrqt.js → SettingsModal-Cflm-bXE.js} +1 -1
- package/dist/client/assets/{SettingsTextareaRow-Bv3aZ9aU.js → SettingsTextareaRow-DPet7lKz.js} +1 -1
- package/dist/client/assets/{SetupWizardModal-C-yMHTlW.js → SetupWizardModal-Bf0WCI07.js} +2 -2
- package/dist/client/assets/{SkillsView-kSHgkBar.js → SkillsView-BDSG7mTv.js} +1 -1
- package/dist/client/assets/{TodoView-DYoicJNY.js → TodoView-5nnuGetx.js} +1 -1
- package/dist/client/assets/{WorkflowNodeEditor-BtWrziOX.css → WorkflowNodeEditor-BNgkFJ_P.css} +1 -1
- package/dist/client/assets/WorkflowNodeEditor-BwCbQtIT.js +8 -0
- package/dist/client/assets/{agent-import-generation-D6P8OUuV.js → agent-import-generation-DtGkjYSm.js} +1 -1
- package/dist/client/assets/app-B1lWYECC.js +13 -0
- package/dist/client/assets/{app-DegRNirF.js → app-B5SToHBH.js} +3 -3
- package/dist/client/assets/app-C4OYRIp7.js +13 -0
- package/dist/client/assets/app-Da8ENc4F.js +13 -0
- package/dist/client/assets/app-DlxXzx0y.js +13 -0
- package/dist/client/assets/app-yfHAC4cX.js +13 -0
- package/dist/client/assets/{architectureDiagram-3BPJPVTR-DLqKCckA.js → architectureDiagram-3BPJPVTR-D1K8DpAy.js} +1 -1
- package/dist/client/assets/{blockDiagram-GPEHLZMM-DRz6F8wZ.js → blockDiagram-GPEHLZMM-CX1y35p9.js} +1 -1
- package/dist/client/assets/{c4Diagram-AAUBKEIU-CJ9glQAp.js → c4Diagram-AAUBKEIU-BcbbCnmZ.js} +1 -1
- package/dist/client/assets/channel-DU48uM5V.js +1 -0
- package/dist/client/assets/{chunk-2J33WTMH-CjIBb3ln.js → chunk-2J33WTMH-Wp3zyvV2.js} +1 -1
- package/dist/client/assets/{chunk-4BX2VUAB-DrcoEr1E.js → chunk-4BX2VUAB-BuVwTDYq.js} +1 -1
- package/dist/client/assets/{chunk-55IACEB6-DU-WcuA9.js → chunk-55IACEB6-CzvhQEXs.js} +1 -1
- package/dist/client/assets/{chunk-727SXJPM-C5Lklr3l.js → chunk-727SXJPM-D-MIVOud.js} +1 -1
- package/dist/client/assets/{chunk-AQP2D5EJ-DlyTTghY.js → chunk-AQP2D5EJ-DbuidBn6.js} +1 -1
- package/dist/client/assets/{chunk-FMBD7UC4-D3C65m5Y.js → chunk-FMBD7UC4-uWKtFzDS.js} +1 -1
- package/dist/client/assets/{chunk-ND2GUHAM-BZY-4WZF.js → chunk-ND2GUHAM-CeSIlejj.js} +1 -1
- package/dist/client/assets/{chunk-QZHKN3VN-CKUtTYy5.js → chunk-QZHKN3VN-BePmVND-.js} +1 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-BunN9MnY.js +1 -0
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-BunN9MnY.js +1 -0
- package/dist/client/assets/{cose-bilkent-S5V4N54A-DbpsF4N5.js → cose-bilkent-S5V4N54A-De9Bj_SA.js} +1 -1
- package/dist/client/assets/{dagre-BM42HDAG-BwIo4me1.js → dagre-BM42HDAG-C5CmCySG.js} +1 -1
- package/dist/client/assets/{dashboard-view-C94UCci5.js → dashboard-view-CaUSpwyV.js} +1 -1
- package/dist/client/assets/{dashboard-view-BvAsW6UZ.js → dashboard-view-DsfVW3-8.js} +1 -1
- package/dist/client/assets/{dashboard-view-BMQm7Lt_.js → dashboard-view-j5rWyrQJ.js} +1 -1
- package/dist/client/assets/{diagram-2AECGRRQ-C-d8XY1c.js → diagram-2AECGRRQ-DaZNoDA8.js} +1 -1
- package/dist/client/assets/{diagram-5GNKFQAL-ByRrlL9w.js → diagram-5GNKFQAL-BLSbdVaK.js} +1 -1
- package/dist/client/assets/{diagram-KO2AKTUF-BK7jb_J-.js → diagram-KO2AKTUF-BSzU_Az3.js} +1 -1
- package/dist/client/assets/{diagram-LMA3HP47-u2o4bYk6.js → diagram-LMA3HP47-RsRkbaSM.js} +1 -1
- package/dist/client/assets/{diagram-OG6HWLK6-Dakk1V3D.js → diagram-OG6HWLK6-ChiWoR2j.js} +1 -1
- package/dist/client/assets/{erDiagram-TEJ5UH35-Yp33v-Cf.js → erDiagram-TEJ5UH35-tJJ6w1wS.js} +1 -1
- package/dist/client/assets/{flowDiagram-I6XJVG4X-C4-dR2TA.js → flowDiagram-I6XJVG4X-BswRtnqd.js} +1 -1
- package/dist/client/assets/{folder-open-C9qq38qV.js → folder-open-DzTYX9Fp.js} +1 -1
- package/dist/client/assets/{ganttDiagram-6RSMTGT7-C0CTCkFN.js → ganttDiagram-6RSMTGT7-QrrkFyh_.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-PVQCEYII-DK0Dd5mm.js → gitGraphDiagram-PVQCEYII-4kdeySLk.js} +1 -1
- package/dist/client/assets/index-C77ORgtm.css +1 -0
- package/dist/client/assets/index-DReijQe4.js +2661 -0
- package/dist/client/assets/{infoDiagram-5YYISTIA-u5MwFb7j.js → infoDiagram-5YYISTIA-B8jwktA0.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-C7R6TziI.js → ishikawaDiagram-YF4QCWOH-uZUucrZK.js} +1 -1
- package/dist/client/assets/{journeyDiagram-JHISSGLW-Dom8W5Ab.js → journeyDiagram-JHISSGLW-CtT0-QvG.js} +1 -1
- package/dist/client/assets/{kanban-definition-UN3LZRKU-_47C02t3.js → kanban-definition-UN3LZRKU-BHEP6Q_z.js} +1 -1
- package/dist/client/assets/{mermaid.core-Cd3LKosp.js → mermaid.core-CyUOdPCI.js} +4 -4
- package/dist/client/assets/{mindmap-definition-RKZ34NQL-D-qVOEin.js → mindmap-definition-RKZ34NQL-BnKIdn6I.js} +1 -1
- package/dist/client/assets/{pieDiagram-4H26LBE5-B0TXvVbM.js → pieDiagram-4H26LBE5-CLlvgGA1.js} +1 -1
- package/dist/client/assets/{puzzle-BBYTjDQK.js → puzzle-Dz37Zb-E.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-W4KKPZXB-KcFvcZPm.js → quadrantDiagram-W4KKPZXB-D9JMXqPE.js} +1 -1
- package/dist/client/assets/{requirementDiagram-4Y6WPE33-DEObokVc.js → requirementDiagram-4Y6WPE33-DlA5s0oV.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-5OEKKPKP-BGYnEp22.js → sankeyDiagram-5OEKKPKP-jZ9qX2PX.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-3UESZ5HK-BcYgyJRU.js → sequenceDiagram-3UESZ5HK-PtwRRZmQ.js} +1 -1
- package/dist/client/assets/{shield-alert-CZg8yaFA.js → shield-alert-BjiTG99h.js} +1 -1
- package/dist/client/assets/{standing-instructions-template-BsTtbEqp.js → standing-instructions-template-DJCF_18R.js} +1 -1
- package/dist/client/assets/standing-instructions-template-Ddi_4TIk.css +1 -0
- package/dist/client/assets/{stateDiagram-AJRCARHV-CfZQIqmX.js → stateDiagram-AJRCARHV-CUxFPOtf.js} +1 -1
- package/dist/client/assets/{stateDiagram-v2-BHNVJYJU-nBEPRSH7.js → stateDiagram-v2-BHNVJYJU-BZquUTBi.js} +1 -1
- package/dist/client/assets/{timeline-definition-PNZ67QCA-DySyabS_.js → timeline-definition-PNZ67QCA-HZQcinlS.js} +1 -1
- package/dist/client/assets/{upload-DMd3zMLx.js → upload-C3LesDmE.js} +1 -1
- package/dist/client/assets/{users-9Pyvnn8K.js → users-DGiK8Vco.js} +1 -1
- package/dist/client/assets/{vennDiagram-CIIHVFJN-DPomfxp_.js → vennDiagram-CIIHVFJN-DRSTmg6N.js} +1 -1
- package/dist/client/assets/{wardley-L42UT6IY-BPfzngS8.js → wardley-L42UT6IY-DXS5Hs7x.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-YWT4CUSO-Yp4nidAP.js → wardleyDiagram-YWT4CUSO-CBPGDv2m.js} +1 -1
- package/dist/client/assets/{xychartDiagram-2RQKCTM6-REgng603.js → xychartDiagram-2RQKCTM6-Bflc25BH.js} +1 -1
- package/dist/client/index.html +4 -2
- package/dist/client/version.json +1 -1
- package/dist/extension.js +3910 -1266
- package/dist/migrations/0000_initial.sql +4 -0
- package/dist/migrations/0033_fn-8505_wedge_notification.sql +5 -0
- package/dist/migrations/0034_milestone_assertion_provenance.sql +30 -0
- package/dist/migrations/0035_fn_8543_mission_lineage_stop.sql +31 -0
- package/dist/plugin-sdk/index.js +17 -0
- package/dist/plugins/.fusion-ce-agents/.fusion-ce-upstream-provenance.json +7 -0
- package/dist/plugins/.fusion-ce-agents/ce-adversarial-document-reviewer.md +115 -0
- package/dist/plugins/.fusion-ce-agents/ce-adversarial-reviewer.md +111 -0
- package/dist/plugins/.fusion-ce-agents/ce-agent-native-planning-strategist.md +71 -0
- package/dist/plugins/.fusion-ce-agents/ce-agent-native-reviewer.md +181 -0
- package/dist/plugins/.fusion-ce-agents/ce-ankane-readme-writer.md +50 -0
- package/dist/plugins/.fusion-ce-agents/ce-api-contract-reviewer.md +52 -0
- package/dist/plugins/.fusion-ce-agents/ce-architecture-strategist.md +53 -0
- package/dist/plugins/.fusion-ce-agents/ce-best-practices-researcher.md +122 -0
- package/dist/plugins/.fusion-ce-agents/ce-code-simplicity-reviewer.md +87 -0
- package/dist/plugins/.fusion-ce-agents/ce-coherence-reviewer.md +73 -0
- package/dist/plugins/.fusion-ce-agents/ce-correctness-reviewer.md +52 -0
- package/dist/plugins/.fusion-ce-agents/ce-data-integrity-guardian.md +75 -0
- package/dist/plugins/.fusion-ce-agents/ce-data-migration-reviewer.md +119 -0
- package/dist/plugins/.fusion-ce-agents/ce-deployment-verification-agent.md +164 -0
- package/dist/plugins/.fusion-ce-agents/ce-design-implementation-reviewer.md +94 -0
- package/dist/plugins/.fusion-ce-agents/ce-design-iterator.md +197 -0
- package/dist/plugins/.fusion-ce-agents/ce-design-lens-reviewer.md +56 -0
- package/dist/plugins/.fusion-ce-agents/ce-feasibility-reviewer.md +65 -0
- package/dist/plugins/.fusion-ce-agents/ce-figma-design-sync.md +172 -0
- package/dist/plugins/.fusion-ce-agents/ce-framework-docs-researcher.md +100 -0
- package/dist/plugins/.fusion-ce-agents/ce-git-history-analyzer.md +47 -0
- package/dist/plugins/.fusion-ce-agents/ce-issue-intelligence-analyst.md +207 -0
- package/dist/plugins/.fusion-ce-agents/ce-julik-frontend-races-reviewer.md +52 -0
- package/dist/plugins/.fusion-ce-agents/ce-learnings-researcher.md +254 -0
- package/dist/plugins/.fusion-ce-agents/ce-maintainability-reviewer.md +77 -0
- package/dist/plugins/.fusion-ce-agents/ce-pattern-recognition-specialist.md +62 -0
- package/dist/plugins/.fusion-ce-agents/ce-performance-oracle.md +115 -0
- package/dist/plugins/.fusion-ce-agents/ce-performance-reviewer.md +54 -0
- package/dist/plugins/.fusion-ce-agents/ce-pr-comment-resolver.md +63 -0
- package/dist/plugins/.fusion-ce-agents/ce-previous-comments-reviewer.md +68 -0
- package/dist/plugins/.fusion-ce-agents/ce-product-lens-reviewer.md +92 -0
- package/dist/plugins/.fusion-ce-agents/ce-project-standards-reviewer.md +84 -0
- package/dist/plugins/.fusion-ce-agents/ce-reliability-reviewer.md +52 -0
- package/dist/plugins/.fusion-ce-agents/ce-repo-research-analyst.md +263 -0
- package/dist/plugins/.fusion-ce-agents/ce-scope-guardian-reviewer.md +79 -0
- package/dist/plugins/.fusion-ce-agents/ce-security-lens-reviewer.md +48 -0
- package/dist/plugins/.fusion-ce-agents/ce-security-reviewer.md +54 -0
- package/dist/plugins/.fusion-ce-agents/ce-security-sentinel.md +98 -0
- package/dist/plugins/.fusion-ce-agents/ce-session-historian.md +89 -0
- package/dist/plugins/.fusion-ce-agents/ce-slack-researcher.md +133 -0
- package/dist/plugins/.fusion-ce-agents/ce-spec-flow-analyzer.md +87 -0
- package/dist/plugins/.fusion-ce-agents/ce-swift-ios-reviewer.md +107 -0
- package/dist/plugins/.fusion-ce-agents/ce-testing-reviewer.md +52 -0
- package/dist/plugins/.fusion-ce-agents/ce-web-researcher.md +127 -0
- package/dist/plugins/.fusion-ce-skills/.fusion-ce-upstream-provenance.json +7 -0
- package/dist/plugins/.fusion-ce-skills/ce-brainstorm/SKILL.md +318 -0
- package/dist/plugins/.fusion-ce-skills/ce-brainstorm/references/agents/slack-researcher.md +127 -0
- package/dist/plugins/.fusion-ce-skills/ce-brainstorm/references/brainstorm-sections.md +354 -0
- package/dist/plugins/.fusion-ce-skills/ce-brainstorm/references/handoff.md +172 -0
- package/dist/plugins/.fusion-ce-skills/ce-brainstorm/references/html-rendering.md +662 -0
- package/dist/plugins/.fusion-ce-skills/ce-brainstorm/references/markdown-rendering.md +236 -0
- package/dist/plugins/.fusion-ce-skills/ce-brainstorm/references/synthesis-summary.md +271 -0
- package/dist/plugins/.fusion-ce-skills/ce-brainstorm/references/universal-brainstorming.md +71 -0
- package/dist/plugins/.fusion-ce-skills/ce-brainstorm/references/visual-probes.md +128 -0
- package/dist/plugins/.fusion-ce-skills/ce-brainstorm/scripts/visual-probe-server.js +419 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/SKILL.md +821 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/action-class-rubric.md +26 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/bulk-preview.md +112 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/cross-model-review.md +63 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/diff-scope.md +41 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/findings-schema.json +137 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/persona-catalog.md +63 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/personas/adversarial-reviewer.md +102 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/personas/agent-native-reviewer.md +173 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/personas/api-contract-reviewer.md +43 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/personas/correctness-reviewer.md +43 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/personas/data-migration-reviewer.md +111 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/personas/deployment-verification-agent.md +157 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/personas/julik-frontend-races-reviewer.md +44 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/personas/learnings-researcher.md +247 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/personas/maintainability-reviewer.md +68 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/personas/performance-reviewer.md +45 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/personas/previous-comments-reviewer.md +59 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/personas/project-standards-reviewer.md +75 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/personas/reliability-reviewer.md +43 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/personas/security-reviewer.md +45 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/personas/swift-ios-reviewer.md +99 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/personas/testing-reviewer.md +43 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/review-output-template.md +170 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/subagent-template.md +199 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/tracker-defer.md +149 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/validator-template.md +89 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/walkthrough.md +249 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/scripts/cross-model-adversarial-review.sh +218 -0
- package/dist/plugins/.fusion-ce-skills/ce-commit/SKILL.md +105 -0
- package/dist/plugins/.fusion-ce-skills/ce-commit-push-pr/SKILL.md +134 -0
- package/dist/plugins/.fusion-ce-skills/ce-commit-push-pr/references/branch-creation.md +55 -0
- package/dist/plugins/.fusion-ce-skills/ce-commit-push-pr/references/pr-description-writing.md +115 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/SKILL.md +712 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/assets/resolution-template.md +94 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/references/agents/best-practices-researcher.md +115 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/references/agents/data-integrity-guardian.md +68 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/references/agents/framework-docs-researcher.md +93 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/references/agents/pattern-recognition-specialist.md +55 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/references/agents/performance-oracle.md +108 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/references/agents/security-sentinel.md +91 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/references/agents/session-historian.md +83 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/references/concepts-vocabulary.md +78 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/references/schema.yaml +231 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/references/yaml-schema.md +118 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/scripts/session-history/discover-sessions.sh +130 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/scripts/session-history/extract-errors.py +254 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/scripts/session-history/extract-metadata.py +456 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/scripts/session-history/extract-skeleton.py +570 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/scripts/validate-frontmatter.py +137 -0
- package/dist/plugins/.fusion-ce-skills/ce-debug/SKILL.md +257 -0
- package/dist/plugins/.fusion-ce-skills/ce-debug/references/anti-patterns.md +91 -0
- package/dist/plugins/.fusion-ce-skills/ce-debug/references/defense-in-depth.md +35 -0
- package/dist/plugins/.fusion-ce-skills/ce-debug/references/investigation-techniques.md +374 -0
- package/dist/plugins/.fusion-ce-skills/ce-doc-review/SKILL.md +70 -0
- package/dist/plugins/.fusion-ce-skills/ce-ideate/SKILL.md +401 -0
- package/dist/plugins/.fusion-ce-skills/ce-ideate/references/agents/issue-intelligence-analyst.md +200 -0
- package/dist/plugins/.fusion-ce-skills/ce-ideate/references/agents/learnings-researcher.md +247 -0
- package/dist/plugins/.fusion-ce-skills/ce-ideate/references/agents/slack-researcher.md +127 -0
- package/dist/plugins/.fusion-ce-skills/ce-ideate/references/agents/web-researcher.md +121 -0
- package/dist/plugins/.fusion-ce-skills/ce-ideate/references/divergent-ideation.md +89 -0
- package/dist/plugins/.fusion-ce-skills/ce-ideate/references/html-rendering.md +662 -0
- package/dist/plugins/.fusion-ce-skills/ce-ideate/references/ideation-sections.md +191 -0
- package/dist/plugins/.fusion-ce-skills/ce-ideate/references/markdown-rendering.md +236 -0
- package/dist/plugins/.fusion-ce-skills/ce-ideate/references/post-ideation-workflow.md +166 -0
- package/dist/plugins/.fusion-ce-skills/ce-ideate/references/universal-ideation.md +107 -0
- package/dist/plugins/.fusion-ce-skills/ce-ideate/references/web-research-cache.md +55 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/SKILL.md +858 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/agents/agent-native-planning-strategist.md +62 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/agents/architecture-strategist.md +46 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/agents/best-practices-researcher.md +114 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/agents/data-integrity-guardian.md +68 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/agents/data-migration-reviewer.md +103 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/agents/deployment-verification-agent.md +157 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/agents/framework-docs-researcher.md +93 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/agents/git-history-analyzer.md +40 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/agents/learnings-researcher.md +247 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/agents/pattern-recognition-specialist.md +55 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/agents/performance-oracle.md +108 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/agents/repo-research-analyst.md +256 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/agents/security-sentinel.md +91 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/agents/slack-researcher.md +127 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/agents/spec-flow-analyzer.md +80 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/agents/web-researcher.md +121 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/approach-altitude.md +55 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/deepening-workflow.md +259 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/html-rendering.md +668 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/markdown-rendering.md +236 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/plan-handoff.md +126 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/plan-sections.md +405 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/synthesis-summary.md +396 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/universal-planning.md +168 -0
- package/dist/plugins/.fusion-ce-skills/ce-resolve-pr-feedback/SKILL.md +53 -0
- package/dist/plugins/.fusion-ce-skills/ce-resolve-pr-feedback/references/agents/pr-comment-resolver.md +56 -0
- package/dist/plugins/.fusion-ce-skills/ce-resolve-pr-feedback/references/evaluation-rubric.md +106 -0
- package/dist/plugins/.fusion-ce-skills/ce-resolve-pr-feedback/references/full-mode.md +283 -0
- package/dist/plugins/.fusion-ce-skills/ce-resolve-pr-feedback/references/targeted-mode.md +45 -0
- package/dist/plugins/.fusion-ce-skills/ce-resolve-pr-feedback/scripts/get-pr-comments +159 -0
- package/dist/plugins/.fusion-ce-skills/ce-resolve-pr-feedback/scripts/get-thread-for-comment +76 -0
- package/dist/plugins/.fusion-ce-skills/ce-resolve-pr-feedback/scripts/reply-to-pr-thread +33 -0
- package/dist/plugins/.fusion-ce-skills/ce-resolve-pr-feedback/scripts/resolve-pr-thread +23 -0
- package/dist/plugins/.fusion-ce-skills/ce-strategy/SKILL.md +97 -0
- package/dist/plugins/.fusion-ce-skills/ce-strategy/references/interview.md +143 -0
- package/dist/plugins/.fusion-ce-skills/ce-strategy/references/strategy-template.md +89 -0
- package/dist/plugins/.fusion-ce-skills/ce-work/SKILL.md +429 -0
- package/dist/plugins/.fusion-ce-skills/ce-work/references/agents/figma-design-sync.md +165 -0
- package/dist/plugins/.fusion-ce-skills/ce-work/references/execution-engines.md +85 -0
- package/dist/plugins/.fusion-ce-skills/ce-work/references/non-code-execution.md +23 -0
- package/dist/plugins/.fusion-ce-skills/ce-work/references/review-findings-followup.md +104 -0
- package/dist/plugins/.fusion-ce-skills/ce-work/references/shipping-workflow.md +133 -0
- package/dist/plugins/.fusion-ce-skills/ce-work/references/tracker-defer.md +149 -0
- package/dist/plugins/fusion-plugin-compound-engineering/.bundled.reload-3.js +11266 -0
- package/dist/plugins/fusion-plugin-compound-engineering/.bundled.reload-4.js +11266 -0
- package/dist/plugins/fusion-plugin-dependency-graph/.bundled.reload-1.js +8206 -0
- package/dist/plugins/fusion-plugin-grok-runtime/.bundled.reload-2.js +26623 -0
- package/package.json +1 -1
- package/skill/fusion/references/extension-tools.md +1 -1
- package/skill/fusion/references/fusion-capabilities.md +1 -1
- package/dist/client/assets/AgentDetailView-C4vItBCo.css +0 -1
- package/dist/client/assets/AgentPermissionPolicyEditor-TpdlOWZW.css +0 -1
- package/dist/client/assets/AgentsView-CwizRdcA.js +0 -24
- package/dist/client/assets/PluginManager-DBhJ1i27.js +0 -1
- package/dist/client/assets/SettingsModal-BDgH9XID.js +0 -21
- package/dist/client/assets/SettingsModal-BXDnzDkJ.css +0 -1
- package/dist/client/assets/WorkflowNodeEditor-DLno6bSJ.js +0 -8
- package/dist/client/assets/app-B-IdUeIu.js +0 -13
- package/dist/client/assets/app-BsIXfnu-.js +0 -13
- package/dist/client/assets/app-C8muVNUU.js +0 -13
- package/dist/client/assets/app-D9ktpVhR.js +0 -13
- package/dist/client/assets/app-nBTNvNKK.js +0 -13
- package/dist/client/assets/channel-Dj4nOgJO.js +0 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-DnkFo5Qy.js +0 -1
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-DnkFo5Qy.js +0 -1
- package/dist/client/assets/index-6FBJPKkr.css +0 -1
- package/dist/client/assets/index-BqLVwYoA.js +0 -2661
- package/dist/client/assets/standing-instructions-template-bQJ4X1gH.css +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as c,j as e}from"./vendor-react-SZ_qB27O.js";import{ao as
|
|
2
|
-
`);let s=2166136261;for(let b=0;b<m.length;b+=1)s^=m.charCodeAt(b),s=Math.imul(s,16777619);return`finding-${(s>>>0).toString(16).padStart(8,"0")}`}const Oe=300,Ve=4e3,$e=["queued","running","cancelling","retry_waiting"];function le(a,n){if(a instanceof Pe){const i=a;return{message:a.message,status:a.status,code:i.researchCode??"INTERNAL_ERROR",setupHint:i.setupHint,retryable:i.retryable}}return a instanceof Error?{message:a.message,code:"INTERNAL_ERROR"}:{message:n,code:"INTERNAL_ERROR"}}function Ge(a){if(!a)return{cancelable:!1,retryable:!1,isTransitioning:!1,blockingReason:"No run selected"};const n=$e.includes(a.status),i=a.status==="queued"||a.status==="running",m=a.lifecycle?.retryable,s=a.status==="failed"||a.status==="timed_out",b=!!(s&&m);let R;return!i&&n?R="Run is already transitioning":!i&&a.status==="completed"?R="Completed runs cannot be cancelled":!i&&a.status==="cancelled"?R="Run is already cancelled":!i&&a.status==="retry_exhausted"?R="Retry attempts exhausted":!i&&a.status==="failed"?R="Failed runs cannot be cancelled":!i&&a.status==="timed_out"&&(R="Timed out runs cannot be cancelled"),!b&&s&&m===!1&&(R=a.lifecycle?.errorCode==="RETRY_EXHAUSTED"?"Retry attempts exhausted":"Run is not retryable"),{cancelable:i,retryable:b,isTransitioning:n,blockingReason:R}}function Be(a){const n=a?.projectId,i=n??"",m=`${he.RESEARCH_RUNS_PREFIX}${i}`,s=`${he.RESEARCH_SELECTED_ID_PREFIX}${i}`,b=W(m,{maxAgeMs:ue}),R=W(s,{maxAgeMs:me}),r=c.useRef(Array.isArray(b)&&b.length>0),[M,I]=c.useState(()=>Array.isArray(b)?b:[]),[h,N]=c.useState(R??null),[C,_]=c.useState(null),[U,D]=c.useState({available:!0}),[H,A]=c.useState(!(Array.isArray(b)&&b.length>0)),[$,O]=c.useState(null),[G,j]=c.useState(null),[w,T]=c.useState(""),S=c.useRef(0),d=c.useRef(0),P=c.useRef(n);c.useEffect(()=>{P.current!==n&&(P.current=n,d.current++);const l=W(m,{maxAgeMs:ue}),o=W(s,{maxAgeMs:me}),v=Array.isArray(l)&&l.length>0;I(Array.isArray(l)?l:[]),N(o??null),_(null),A(!v),r.current=v},[n,m,s]);const k=c.useCallback(async(l=w)=>{const o=++S.current,v=n;r.current||A(!0),O(null),j(null);try{const y=await Se({q:l||void 0,limit:100},v);if(o!==S.current||v!==n)return;I(y.runs),ce(m,y.runs,{maxBytes:5e5}),r.current=!0,D(y.availability),h&&!y.runs.some(g=>g.id===h)&&(N(null),ce(s,null,{maxBytes:5e5}),_(null))}catch(y){if(o!==S.current||v!==n)return;const g=le(y,"Failed to load research runs");O(g.message),j(g)}finally{o===S.current&&A(!1)}},[n,m,w,s,h]),f=c.useCallback(async l=>{const o=await _e(l,n);return _(o.run),D(o.availability),o.run},[n]);c.useEffect(()=>{r.current||A(!0);const l=window.setTimeout(()=>{k(w)},Oe);return()=>window.clearTimeout(l)},[k,w]),c.useEffect(()=>{if(!h){_(null);return}f(h)},[f,h]),c.useEffect(()=>{const l=d.current,o=()=>d.current!==l,v=n?`?projectId=${encodeURIComponent(n)}`:"";let y=!0;const g=()=>{!y||o()||(k(),h&&f(h))},F=`/api/events${v}`,E=je(F,{events:{"research:run:created":g,"research:run:updated":g,"research:run:completed":g,"research:run:failed":g,"research:run:cancelled":g},onReconnect:()=>{Y({view:"useResearch",trigger:"sse-reconnect",projectId:n,replayAttempted:!1,sseChannel:F}),g()}});Y({view:"useResearch",trigger:"sse-open",projectId:n,replayAttempted:!1,sseChannel:F});const V=window.setInterval(g,Ve);return()=>{y=!1,E(),window.clearInterval(V)}},[n,k,h,f]);const z=c.useCallback(l=>{N(l),ce(s,l,{maxBytes:5e5})},[s]);return{runs:M,selectedRun:C,selectedRunId:h,setSelectedRunId:z,availability:U,loading:H,error:$,searchQuery:w,setSearchQuery:T,refresh:k,createRun:l=>Te(l,n),cancelRun:async l=>{try{j(null);const o=await Ae(l,n);return h===l&&_(o.run),await k(),o}catch(o){const v=le(o,"Failed to cancel run");throw j(v),v}},retryRun:async l=>{try{j(null);const o=await Ce(l,n);return h===l&&_(o.run),await k(),o}catch(o){const v=le(o,"Failed to retry run");throw j(v),v}},exportRun:(l,o)=>Ee(l,o,n),createTaskFromRun:(l,o,v,y,g,F)=>ke(l,{title:o,findingId:v,description:y,priority:g,attachExport:F},n),attachRunToTask:(l,o,v,y)=>Ne(l,{taskId:o,findingId:v,attachExport:y},n),promoteFinding:(l,o)=>we(l,o,n),uiError:G,runActionState:Ge(C),statusCounts:M.reduce((l,o)=>(l[o.status]+=1,l),{queued:0,running:0,cancelling:0,retry_waiting:0,completed:0,failed:0,cancelled:0,timed_out:0,retry_exhausted:0})}}function Ke({open:a,mode:n,run:i,finding:m,projectId:s,onClose:b,onConfirm:R}){const{t:r}=ve("app");Le(a);const[M,I]=c.useState(!1),[h,N]=c.useState(""),[C,_]=c.useState(""),[U,D]=c.useState("normal"),[H,A]=c.useState(""),[$,O]=c.useState([]),[G,j]=c.useState(!1),[w,T]=c.useState(!1),S=c.useMemo(()=>{const d=(m.content??"").split(/(?<=[.!?])\s+/)[0]??"";return`${m.heading||r("research.defaultFindingHeading","Research finding")} — ${d}`.trim()},[m.content,m.heading,r]);return c.useEffect(()=>{a&&(I(!1),N(`Research: ${m.heading||i.title}`),_(S),D("normal"),A(""),n==="enrich"&&(j(!0),Ie(50,0,s).then(d=>O(d.filter(P=>P.column!=="archived"))).finally(()=>j(!1))))},[a,n,s,m.heading,S,i.title]),a?e.jsx("div",{className:"modal-overlay open",role:"presentation",onClick:b,children:e.jsxs("div",{className:"modal modal-lg research-task-action-modal",role:"dialog","aria-modal":"true",onClick:d=>d.stopPropagation(),children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:n==="create"?r("research.createTaskTitle","Create task from finding"):r("research.enrichTaskTitle","Enrich existing task")}),e.jsx("button",{className:"modal-close",type:"button","aria-label":r("actions.close","Close"),onClick:b,children:"×"})]}),e.jsxs("div",{className:"research-task-action-modal__body",children:[e.jsxs("div",{className:"card research-task-action-modal__preview",children:[e.jsxs("p",{children:[e.jsxs("strong",{children:[r("research.runLabel","Run:")," "]})," ",i.id]}),e.jsxs("p",{children:[e.jsxs("strong",{children:[r("research.findingLabel","Finding:")," "]})," ",m.id,m.heading?` — ${m.heading}`:""]}),e.jsx("p",{children:S||r("research.noPreview","No preview available.")})]}),n==="create"?e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"research-task-action-modal__field",children:[r("research.titleLabel","Title"),e.jsx("input",{className:"input",value:h,onChange:d=>N(d.target.value)})]}),e.jsxs("label",{className:"research-task-action-modal__field",children:[r("research.descriptionLabel","Description"),e.jsx("textarea",{className:"input research-task-action-modal__textarea",value:C,onChange:d=>_(d.target.value)})]}),e.jsxs("label",{className:"research-task-action-modal__field",children:[r("research.priorityLabel","Priority"),e.jsxs("select",{className:"select",value:U,onChange:d=>D(d.target.value),children:[e.jsx("option",{value:"low",children:r("research.priorityLow","Low")}),e.jsx("option",{value:"normal",children:r("research.priorityNormal","Normal")}),e.jsx("option",{value:"high",children:r("research.priorityHigh","High")}),e.jsx("option",{value:"urgent",children:r("research.priorityUrgent","Urgent")})]})]})]}):e.jsxs("label",{className:"research-task-action-modal__field",children:[r("research.targetTaskLabel","Target task"),e.jsx("input",{className:"input",list:"research-task-action-task-list",value:H,placeholder:G?r("research.loadingTasks","Loading tasks…"):r("research.enterTaskId","Enter task ID"),onChange:d=>A(d.target.value)}),e.jsx("datalist",{id:"research-task-action-task-list",children:$.map(d=>e.jsx("option",{value:d.id,children:d.title},d.id))})]}),e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:M,onChange:d=>I(d.target.checked)}),e.jsx("span",{children:r("research.attachExport","Attach markdown export artifact")})]})]}),e.jsxs("div",{className:"modal-actions",children:[e.jsx("button",{className:"btn",type:"button",onClick:b,children:r("actions.cancel","Cancel")}),e.jsx("button",{className:"btn btn-primary",type:"button",disabled:w||n==="enrich"&&!H,onClick:()=>{T(!0),R({taskId:n==="enrich"?H:void 0,title:n==="create"?h.trim():void 0,description:n==="create"?C.trim():void 0,priority:n==="create"?U:void 0,attachExport:M}).finally(()=>T(!1))},children:n==="create"?r("research.createTaskButton","Create Task"):r("research.enrichTaskButton","Enrich Task")})]})]})}):null}const ze=["web-search","page-fetch","github","local-docs","llm-synthesis"],Qe={"web-search":"webSearch","page-fetch":"pageFetch",github:"github","local-docs":"localDocs","llm-synthesis":"llmSynthesis"};function We(a){return{"web-search":a("research.providerWebSearch","Web Search"),"page-fetch":a("research.providerPageFetch","Page Fetch"),github:a("research.providerGitHub","GitHub"),"local-docs":a("research.providerLocalDocs","Local Docs"),"llm-synthesis":a("research.providerLlmSynthesis","LLM Synthesis")}}let oe=!1;function ts({projectId:a,addToast:n,onOpenSettings:i,readinessVersion:m=0}){const{t:s}=ve("app"),b=We(s);c.useEffect(()=>(Y({view:"ResearchView",trigger:oe?"route-active":"remount",projectId:a,replayAttempted:!1}),oe=!1,()=>{oe=!0,Y({view:"ResearchView",trigger:"route-inactive",projectId:a,replayAttempted:!1})}),[a]);const{runs:R,selectedRun:r,selectedRunId:M,setSelectedRunId:I,availability:h,loading:N,error:C,searchQuery:_,setSearchQuery:U,createRun:D,cancelRun:H,retryRun:A,exportRun:$,createTaskFromRun:O,attachRunToTask:G,promoteFinding:j,statusCounts:w,refresh:T,uiError:S,runActionState:d}=Be({projectId:a}),[P,k]=c.useState(""),[f,z]=c.useState(()=>ie(void 0)),[l,o]=c.useState([]),[v,y]=c.useState(!1),[g,F]=c.useState([]),[E,V]=c.useState(null),[q,Q]=c.useState(null),[J,fe]=c.useState(""),Z=h.supportedProviders??ze,ee=f.searchProvider,se=t=>t==="web-search"?!0:f.enabledSources[Qe[t]];c.useEffect(()=>{const t=Z.filter(u=>se(u));F(u=>{const p=u.filter(x=>t.includes(x));return p.length>0?p:t})},[f.enabledSources,Z]),c.useEffect(()=>{let t=!1;return Promise.all([Fe(a),Me().catch(()=>({providers:[]}))]).then(([u,p])=>{t||(z(ie(u)),o(p.providers.filter(x=>x.type==="api_key").map(x=>({id:x.id,authenticated:x.authenticated}))))}).catch(()=>{t||z(ie(void 0))}),()=>{t=!0}},[a,m]);const xe=c.useMemo(()=>r?r.status:s("research.noRunSelected","No run selected"),[r,s]),ye=c.useMemo(()=>r?r.status==="queued"||r.status==="retry_waiting"?"status-dot status-dot--pending":r.status==="running"?"status-dot status-dot--connecting":r.status==="completed"?"status-dot status-dot--online":r.status==="failed"||r.status==="cancelled"?"status-dot status-dot--error":"status-dot":"status-dot",[r]),re=h.supportedExportFormats??["markdown","json","html"],te=c.useMemo(()=>new Map(l.map(t=>[t.id,t.authenticated])),[l]),ae=c.useMemo(()=>{const t=new Set;return f.enabledSources.webSearch&&ee&&t.add(ee),f.enabledSources.llmSynthesis&&f.synthesisProvider&&t.add(f.synthesisProvider),[...t].filter(u=>te.has(u))},[f.enabledSources.llmSynthesis,f.enabledSources.webSearch,f.synthesisProvider,ee,te]).find(t=>te.get(t)!==!0),B=c.useMemo(()=>h.available?f.enabled?ae?{reason:s("research.missingApiKey","Missing API key for {{provider}}.",{provider:ae}),details:s("research.addCredentialsHint","Add provider credentials in Authentication settings."),settingsSection:"authentication"}:null:{reason:s("research.disabled","Research is disabled for this project."),details:s("research.enableResearchHint","Enable project research settings to create runs."),settingsSection:"research-project"}:{reason:h.reason??s("research.unavailable","Research is unavailable for this project."),details:h.setupInstructions,settingsSection:"research-project"},[h.available,h.reason,h.setupInstructions,f.enabled,ae,s]),K=async(t,u,p)=>{V(t);try{await u(),n?.(p,"success"),await T()}catch(x){n?.(x instanceof Error?x.message:s("research.actionFailed","Action failed"),"error")}finally{V(null)}},ne=async t=>{if(r){V(`export-${t}`);try{const u=await $(r.id,t),p=new Blob([u.content],{type:"text/plain;charset=utf-8"}),x=URL.createObjectURL(p),L=document.createElement("a");L.href=x,L.download=u.filename,document.body.appendChild(L),L.click(),L.remove(),URL.revokeObjectURL(x),n?.(s("research.exportedFile","Exported {{filename}}",{filename:u.filename}),"success")}catch(u){n?.(u instanceof Error?u.message:s("research.exportFailed","Export failed"),"error")}finally{V(null)}}},ge=async()=>{if(P.trim()){y(!0);try{const t=g.filter(p=>se(p));if(t.length===0){y(!1),n?.(s("research.noSourcesAvailable","No enabled research sources are available for this project."),"error");return}const u=await D({query:P.trim(),providers:t});I(u.run.id),k(""),n?.(s("research.runCreated","Research run created"),"success"),await T()}catch(t){n?.(t instanceof Error?t.message:s("research.createRunFailed","Failed to create run"),"error")}finally{y(!1)}}};return e.jsxs("section",{className:"research-view","aria-label":s("research.viewLabel","Research view"),children:[e.jsx(De,{icon:pe,title:s("research.title","Research"),actions:e.jsx("button",{className:"btn",type:"button",onClick:()=>void T(),children:s("actions.refresh","Refresh")})}),e.jsx("p",{className:"research-view__subtitle",children:s("research.subtitle","Cited search and synthesis runs: gather sources, fetch content, and synthesize findings.")}),B?e.jsxs("div",{className:"research-view__state research-view__state--error card","data-testid":"research-state-unavailable",children:[e.jsx("p",{children:B.reason}),B.details&&e.jsx("p",{children:B.details}),e.jsx("p",{children:s("research.currentDefaults","Current defaults: provider {{provider}}, max sources {{maxSources}}",{provider:f.searchProvider??s("research.notSet","(not set)"),maxSources:f.limits.maxSourcesPerRun})}),e.jsxs("div",{className:"research-view__actions",children:[e.jsx("button",{className:"btn",type:"button",onClick:()=>void T(),children:s("actions.refresh","Refresh")}),e.jsx("button",{className:"btn btn-primary",type:"button",onClick:()=>i?.(B.settingsSection),children:s("actions.openSettings","Open Settings")})]})]}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:"research-view__layout",children:[e.jsx("aside",{className:"research-view__sidebar card",children:e.jsxs("div",{className:"research-view__sidebar-content",children:[e.jsxs("div",{className:"research-view__form",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"research-query",children:s("research.queryLabel","Query")}),e.jsx("textarea",{id:"research-query",className:"input research-view__textarea",value:P,onChange:t=>k(t.target.value)})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:s("research.providersLabel","Providers")}),e.jsx("div",{className:"research-view__providers",children:Z.map(t=>{const u=se(t),p=t==="web-search";return e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:p||g.includes(t),disabled:p||!u,onChange:()=>{p||!u||F(x=>x.includes(t)?x.filter(L=>L!==t):[...x,t])}}),e.jsxs("span",{children:[b[t]??t,p?e.jsx("span",{className:"research-view__provider-lock",children:s("research.alwaysOn","Always on")}):null]})]},t)})})]}),e.jsxs("button",{className:"btn btn-primary",type:"button",disabled:!P.trim()||v,onClick:()=>void ge(),children:[v?e.jsx(He,{className:"animate-spin",size:14}):null,s("research.createRun","Create Run")]})]}),e.jsxs("div",{className:"research-view__history-header form-group",children:[e.jsx("label",{htmlFor:"research-run-search",children:s("actions.search","Search")}),e.jsxs("div",{className:"research-view__history-search-row",children:[e.jsx(pe,{size:14}),e.jsx("input",{id:"research-run-search",className:"input",placeholder:s("research.searchRunsPlaceholder","Search runs"),value:_,onChange:t=>U(t.target.value)})]})]}),e.jsx("div",{className:"research-view__history","data-testid":"research-state-running",children:R.map(t=>e.jsxs("button",{type:"button",className:`research-view__history-item card${M===t.id?" research-view__history-item--active":""}`,onClick:()=>I(t.id),children:[e.jsx("span",{className:"card-id",children:t.id}),e.jsx("span",{children:t.title})]},t.id))})]})}),e.jsxs("div",{className:"research-view__reader card",children:[N&&e.jsx("p",{"data-testid":"research-state-loading",children:e.jsx(qe,{label:s("research.loadingRuns","Loading research runs…")})}),!N&&C&&e.jsx("p",{"data-testid":"research-state-error",children:C}),!N&&!C&&R.length===0&&e.jsx("p",{"data-testid":"research-state-empty",children:s("research.noRunsYet","No research runs yet")}),e.jsxs("div",{className:"research-view__reader-content",children:[r&&e.jsxs("div",{className:"research-view__run-detail",children:[e.jsxs("div",{className:"research-view__status-row",children:[e.jsx("span",{className:ye}),e.jsx("strong",{children:xe})]}),e.jsx("h3",{className:"research-view__run-title",children:r.title}),e.jsx("p",{className:"research-view__run-query",children:r.query}),e.jsx("p",{className:"research-view__run-summary","data-testid":"research-state-results",children:r.results?.summary??s("research.noSummaryYet","No summary yet.")}),e.jsxs("div",{className:"research-view__actions",children:[e.jsx("button",{className:"btn",type:"button",title:d.cancelable?void 0:d.blockingReason,disabled:E==="cancel"||E==="retry"||!d.cancelable,onClick:()=>void K("cancel",()=>H(r.id),s("research.runCancelled","Run cancelled")),children:s("actions.cancel","Cancel")}),e.jsx("button",{className:"btn",type:"button",title:d.retryable?void 0:d.blockingReason,disabled:E==="cancel"||E==="retry"||!d.retryable,onClick:()=>void K("retry",()=>A(r.id),s("research.runRetried","Run retried")),children:s("actions.retry","Retry")}),re.includes("markdown")&&e.jsx("button",{className:"btn",type:"button",disabled:E==="export-markdown",onClick:()=>void ne("markdown"),children:s("research.exportMd","Export MD")}),re.includes("json")&&e.jsx("button",{className:"btn",type:"button",disabled:E==="export-json",onClick:()=>void ne("json"),children:s("research.exportJson","Export JSON")}),re.includes("html")&&e.jsx("button",{className:"btn",type:"button",disabled:E==="export-html",onClick:()=>void ne("html"),children:s("research.exportHtml","Export HTML")})]}),r.error&&e.jsx("p",{className:"research-view__error",children:r.error}),S&&e.jsxs("div",{className:"form-error",role:"alert",children:[e.jsx("p",{children:S.message}),S.setupHint&&e.jsx("p",{children:S.setupHint}),S.code==="MISSING_CREDENTIALS"&&e.jsx("button",{className:"btn btn-sm",type:"button",onClick:()=>i?.("authentication"),children:s("research.openAuthSettings","Open Authentication Settings")}),S.code==="FEATURE_DISABLED"&&e.jsx("button",{className:"btn btn-sm",type:"button",onClick:()=>i?.("research-project"),children:s("research.openResearchSettings","Open Research Settings")})]}),d.blockingReason&&e.jsx("p",{className:"research-view__run-query",children:d.blockingReason}),Array.isArray(r.results?.findings)&&r.results.findings.length>0&&e.jsx("div",{className:"research-view__findings",children:r.results.findings.map(t=>{const u=be(t);return e.jsxs("article",{className:"research-view__finding card",children:[e.jsx("h4",{children:t.heading}),e.jsx("p",{children:t.content}),e.jsxs("div",{className:"research-view__actions research-view__finding-actions",children:[e.jsx("button",{className:"btn btn-primary btn-sm",type:"button",onClick:()=>Q({mode:"create",findingId:u}),children:s("research.createTask","Create Task")}),e.jsx("button",{className:"btn btn-sm",type:"button",onClick:()=>Q({mode:"enrich",findingId:u}),children:s("research.enrichTask","Enrich Task")}),e.jsx("input",{className:"input","aria-label":s("research.destinationSlice","Destination slice ID"),value:J,onChange:p=>fe(p.target.value),placeholder:s("research.destinationSlice","Destination slice ID")}),e.jsx("button",{className:"btn btn-sm",type:"button",disabled:r.status!=="completed"||!J.trim()||E===`promote-${u}`,onClick:()=>void K(`promote-${u}`,()=>j(r.id,{findingId:u,sliceId:J.trim()}),s("research.findingPromoted","Finding promoted to roadmap")),children:s("research.promoteFinding","Promote to roadmap")})]})]},u)})}),Array.isArray(r.results?.citations)&&r.results.citations.length>0&&e.jsx("ul",{className:"research-view__citations",children:r.results.citations.map(t=>e.jsx("li",{children:e.jsx("a",{href:t,target:"_blank",rel:"noreferrer",children:t})},t))}),r.events.length>0&&e.jsxs("details",{children:[e.jsx("summary",{children:s("research.runHistory","Run history")}),e.jsx("ul",{className:"research-view__events",children:r.events.map(t=>e.jsx("li",{children:t.message},t.id))})]})]}),!r&&R.length>0&&e.jsx("p",{children:s("research.selectRunToViewDetails","Select a run to view details.")}),e.jsxs("div",{className:"research-view__stats",children:[e.jsxs("div",{className:"research-view__stat-card",children:[e.jsx("div",{className:"research-view__stat-label",children:s("research.statRunning","Running")}),e.jsx("div",{className:"research-view__stat-value",children:w.running})]}),e.jsxs("div",{className:"research-view__stat-card",children:[e.jsx("div",{className:"research-view__stat-label",children:s("research.statCompleted","Completed")}),e.jsx("div",{className:"research-view__stat-value",children:w.completed})]}),e.jsxs("div",{className:"research-view__stat-card",children:[e.jsx("div",{className:"research-view__stat-label",children:s("research.statFailed","Failed")}),e.jsx("div",{className:"research-view__stat-value",children:w.failed})]})]})]})]})]})}),r&&q&&(()=>{const t=r.results?.findings?.findIndex(p=>be(p)===q.findingId)??-1,u=t>=0?r.results.findings[t]:null;return u?e.jsx(Ke,{open:!0,mode:q.mode,run:r,finding:{id:q.findingId,heading:u.heading,content:u.content},projectId:a,onClose:()=>Q(null),onConfirm:async({taskId:p,title:x,description:L,priority:Re,attachExport:de})=>{q.mode==="create"?await K("create-task",()=>O(r.id,x,q.findingId,L,Re,de),s("research.taskCreatedFromResearch","Task created from research")):p&&await K("attach-task",()=>G(r.id,p,q.findingId,de),s("research.taskEnrichedFromResearch","Task enriched from research")),Q(null)}}):null})()]})}export{ts as ResearchView};
|
|
1
|
+
import{r as c,j as e}from"./vendor-react-SZ_qB27O.js";import{ao as Q,ap as ue,aq as he,bx as me,cL as Se,au as ce,cM as _e,bc as je,cN as Y,cO as we,cP as Ne,cQ as ke,cR as Ee,cS as Ce,cT as Ae,cU as Te,bB as Pe,cV as Le,cW as Ie,aV as Fe,af as Me,V as De,aH as pe,L as He,aI as qe}from"./index-DReijQe4.js";import{u as ve}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-codemirror-jBKmHyH0.js";import"./vendor-reactflow-9C3XTE7_.js";import"./vendor-xterm-BNq00GSj.js";const Ue="builtin",X={pageFetch:!0,github:!1,localDocs:!0,llmSynthesis:!0};function ie(a){const n=a?.researchGlobalDefaults,i=a?.researchSettings;return{enabled:i?.enabled??a?.researchEnabled??a?.researchGlobalEnabled??!0,searchProvider:i?.searchProvider??n?.searchProvider??a?.researchGlobalWebSearchProvider??Ue,synthesisProvider:i?.synthesisProvider??n?.synthesisProvider,synthesisModelId:i?.synthesisModelId??n?.synthesisModelId,enabledSources:{webSearch:!0,pageFetch:i?.enabledSources?.pageFetch??n?.enabledSources?.pageFetch??X.pageFetch,github:i?.enabledSources?.github??n?.enabledSources?.github??X.github,localDocs:i?.enabledSources?.localDocs??n?.enabledSources?.localDocs??X.localDocs,llmSynthesis:i?.enabledSources?.llmSynthesis??n?.enabledSources?.llmSynthesis??X.llmSynthesis},limits:{maxConcurrentRuns:i?.limits?.maxConcurrentRuns??a?.researchMaxConcurrentRuns??a?.researchGlobalMaxConcurrentRuns??3,maxSourcesPerRun:i?.limits?.maxSourcesPerRun??n?.maxSourcesPerRun??a?.researchMaxSourcesPerRun??a?.researchGlobalMaxSourcesPerRun??20,maxDurationMs:i?.limits?.maxDurationMs??a?.researchDefaultTimeout??a?.researchGlobalDefaultTimeout??3e5,requestTimeoutMs:i?.limits?.requestTimeoutMs??a?.researchGlobalFetchTimeoutMs??3e4},defaultExportFormat:n?.defaultExportFormat??"markdown"}}function be(a){const n=typeof a.id=="string"?a.id.trim():"";if(n)return n;const i=b=>b.trim().replace(/\s+/g," ").toLowerCase(),m=[i(a.heading??""),i(a.content??""),...[...a.sources??[]].map(i).filter(Boolean).sort()].join(`
|
|
2
|
+
`);let s=2166136261;for(let b=0;b<m.length;b+=1)s^=m.charCodeAt(b),s=Math.imul(s,16777619);return`finding-${(s>>>0).toString(16).padStart(8,"0")}`}const Oe=300,Ve=4e3,$e=["queued","running","cancelling","retry_waiting"];function le(a,n){if(a instanceof Pe){const i=a;return{message:a.message,status:a.status,code:i.researchCode??"INTERNAL_ERROR",setupHint:i.setupHint,retryable:i.retryable}}return a instanceof Error?{message:a.message,code:"INTERNAL_ERROR"}:{message:n,code:"INTERNAL_ERROR"}}function Ge(a){if(!a)return{cancelable:!1,retryable:!1,isTransitioning:!1,blockingReason:"No run selected"};const n=$e.includes(a.status),i=a.status==="queued"||a.status==="running",m=a.lifecycle?.retryable,s=a.status==="failed"||a.status==="timed_out",b=!!(s&&m);let R;return!i&&n?R="Run is already transitioning":!i&&a.status==="completed"?R="Completed runs cannot be cancelled":!i&&a.status==="cancelled"?R="Run is already cancelled":!i&&a.status==="retry_exhausted"?R="Retry attempts exhausted":!i&&a.status==="failed"?R="Failed runs cannot be cancelled":!i&&a.status==="timed_out"&&(R="Timed out runs cannot be cancelled"),!b&&s&&m===!1&&(R=a.lifecycle?.errorCode==="RETRY_EXHAUSTED"?"Retry attempts exhausted":"Run is not retryable"),{cancelable:i,retryable:b,isTransitioning:n,blockingReason:R}}function Be(a){const n=a?.projectId,i=n??"",m=`${he.RESEARCH_RUNS_PREFIX}${i}`,s=`${he.RESEARCH_SELECTED_ID_PREFIX}${i}`,b=Q(m,{maxAgeMs:ue}),R=Q(s,{maxAgeMs:me}),r=c.useRef(Array.isArray(b)&&b.length>0),[M,I]=c.useState(()=>Array.isArray(b)?b:[]),[h,N]=c.useState(R??null),[C,_]=c.useState(null),[U,D]=c.useState({available:!0}),[H,A]=c.useState(!(Array.isArray(b)&&b.length>0)),[$,O]=c.useState(null),[G,j]=c.useState(null),[w,T]=c.useState(""),S=c.useRef(0),d=c.useRef(0),P=c.useRef(n);c.useEffect(()=>{P.current!==n&&(P.current=n,d.current++);const l=Q(m,{maxAgeMs:ue}),o=Q(s,{maxAgeMs:me}),v=Array.isArray(l)&&l.length>0;I(Array.isArray(l)?l:[]),N(o??null),_(null),A(!v),r.current=v},[n,m,s]);const k=c.useCallback(async(l=w)=>{const o=++S.current,v=n;r.current||A(!0),O(null),j(null);try{const y=await Se({q:l||void 0,limit:100},v);if(o!==S.current||v!==n)return;I(y.runs),ce(m,y.runs,{maxBytes:5e5}),r.current=!0,D(y.availability),h&&!y.runs.some(g=>g.id===h)&&(N(null),ce(s,null,{maxBytes:5e5}),_(null))}catch(y){if(o!==S.current||v!==n)return;const g=le(y,"Failed to load research runs");O(g.message),j(g)}finally{o===S.current&&A(!1)}},[n,m,w,s,h]),f=c.useCallback(async l=>{const o=await _e(l,n);return _(o.run),D(o.availability),o.run},[n]);c.useEffect(()=>{r.current||A(!0);const l=window.setTimeout(()=>{k(w)},Oe);return()=>window.clearTimeout(l)},[k,w]),c.useEffect(()=>{if(!h){_(null);return}f(h)},[f,h]),c.useEffect(()=>{const l=d.current,o=()=>d.current!==l,v=n?`?projectId=${encodeURIComponent(n)}`:"";let y=!0;const g=()=>{!y||o()||(k(),h&&f(h))},F=`/api/events${v}`,E=je(F,{events:{"research:run:created":g,"research:run:updated":g,"research:run:completed":g,"research:run:failed":g,"research:run:cancelled":g},onReconnect:()=>{Y({view:"useResearch",trigger:"sse-reconnect",projectId:n,replayAttempted:!1,sseChannel:F}),g()}});Y({view:"useResearch",trigger:"sse-open",projectId:n,replayAttempted:!1,sseChannel:F});const V=window.setInterval(g,Ve);return()=>{y=!1,E(),window.clearInterval(V)}},[n,k,h,f]);const z=c.useCallback(l=>{N(l),ce(s,l,{maxBytes:5e5})},[s]);return{runs:M,selectedRun:C,selectedRunId:h,setSelectedRunId:z,availability:U,loading:H,error:$,searchQuery:w,setSearchQuery:T,refresh:k,createRun:l=>Te(l,n),cancelRun:async l=>{try{j(null);const o=await Ae(l,n);return h===l&&_(o.run),await k(),o}catch(o){const v=le(o,"Failed to cancel run");throw j(v),v}},retryRun:async l=>{try{j(null);const o=await Ce(l,n);return h===l&&_(o.run),await k(),o}catch(o){const v=le(o,"Failed to retry run");throw j(v),v}},exportRun:(l,o)=>Ee(l,o,n),createTaskFromRun:(l,o,v,y,g,F)=>ke(l,{title:o,findingId:v,description:y,priority:g,attachExport:F},n),attachRunToTask:(l,o,v,y)=>Ne(l,{taskId:o,findingId:v,attachExport:y},n),promoteFinding:(l,o)=>we(l,o,n),uiError:G,runActionState:Ge(C),statusCounts:M.reduce((l,o)=>(l[o.status]+=1,l),{queued:0,running:0,cancelling:0,retry_waiting:0,completed:0,failed:0,cancelled:0,timed_out:0,retry_exhausted:0})}}function We({open:a,mode:n,run:i,finding:m,projectId:s,onClose:b,onConfirm:R}){const{t:r}=ve("app");Le(a);const[M,I]=c.useState(!1),[h,N]=c.useState(""),[C,_]=c.useState(""),[U,D]=c.useState("normal"),[H,A]=c.useState(""),[$,O]=c.useState([]),[G,j]=c.useState(!1),[w,T]=c.useState(!1),S=c.useMemo(()=>{const d=(m.content??"").split(/(?<=[.!?])\s+/)[0]??"";return`${m.heading||r("research.defaultFindingHeading","Research finding")} — ${d}`.trim()},[m.content,m.heading,r]);return c.useEffect(()=>{a&&(I(!1),N(`Research: ${m.heading||i.title}`),_(S),D("normal"),A(""),n==="enrich"&&(j(!0),Ie(50,0,s).then(d=>O(d.filter(P=>P.column!=="archived"))).finally(()=>j(!1))))},[a,n,s,m.heading,S,i.title]),a?e.jsx("div",{className:"modal-overlay open",role:"presentation",onClick:b,children:e.jsxs("div",{className:"modal modal-lg research-task-action-modal",role:"dialog","aria-modal":"true",onClick:d=>d.stopPropagation(),children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:n==="create"?r("research.createTaskTitle","Create task from finding"):r("research.enrichTaskTitle","Enrich existing task")}),e.jsx("button",{className:"modal-close",type:"button","aria-label":r("actions.close","Close"),onClick:b,children:"×"})]}),e.jsxs("div",{className:"research-task-action-modal__body",children:[e.jsxs("div",{className:"card research-task-action-modal__preview",children:[e.jsxs("p",{children:[e.jsxs("strong",{children:[r("research.runLabel","Run:")," "]})," ",i.id]}),e.jsxs("p",{children:[e.jsxs("strong",{children:[r("research.findingLabel","Finding:")," "]})," ",m.id,m.heading?` — ${m.heading}`:""]}),e.jsx("p",{children:S||r("research.noPreview","No preview available.")})]}),n==="create"?e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"research-task-action-modal__field",children:[r("research.titleLabel","Title"),e.jsx("input",{className:"input",value:h,onChange:d=>N(d.target.value)})]}),e.jsxs("label",{className:"research-task-action-modal__field",children:[r("research.descriptionLabel","Description"),e.jsx("textarea",{className:"input research-task-action-modal__textarea",value:C,onChange:d=>_(d.target.value)})]}),e.jsxs("label",{className:"research-task-action-modal__field",children:[r("research.priorityLabel","Priority"),e.jsxs("select",{className:"select",value:U,onChange:d=>D(d.target.value),children:[e.jsx("option",{value:"low",children:r("research.priorityLow","Low")}),e.jsx("option",{value:"normal",children:r("research.priorityNormal","Normal")}),e.jsx("option",{value:"high",children:r("research.priorityHigh","High")}),e.jsx("option",{value:"urgent",children:r("research.priorityUrgent","Urgent")})]})]})]}):e.jsxs("label",{className:"research-task-action-modal__field",children:[r("research.targetTaskLabel","Target task"),e.jsx("input",{className:"input",list:"research-task-action-task-list",value:H,placeholder:G?r("research.loadingTasks","Loading tasks…"):r("research.enterTaskId","Enter task ID"),onChange:d=>A(d.target.value)}),e.jsx("datalist",{id:"research-task-action-task-list",children:$.map(d=>e.jsx("option",{value:d.id,children:d.title},d.id))})]}),e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:M,onChange:d=>I(d.target.checked)}),e.jsx("span",{children:r("research.attachExport","Attach markdown export artifact")})]})]}),e.jsxs("div",{className:"modal-actions",children:[e.jsx("button",{className:"btn",type:"button",onClick:b,children:r("actions.cancel","Cancel")}),e.jsx("button",{className:"btn btn-primary",type:"button",disabled:w||n==="enrich"&&!H,onClick:()=>{T(!0),R({taskId:n==="enrich"?H:void 0,title:n==="create"?h.trim():void 0,description:n==="create"?C.trim():void 0,priority:n==="create"?U:void 0,attachExport:M}).finally(()=>T(!1))},children:n==="create"?r("research.createTaskButton","Create Task"):r("research.enrichTaskButton","Enrich Task")})]})]})}):null}const ze=["web-search","page-fetch","github","local-docs","llm-synthesis"],Ke={"web-search":"webSearch","page-fetch":"pageFetch",github:"github","local-docs":"localDocs","llm-synthesis":"llmSynthesis"};function Qe(a){return{"web-search":a("research.providerWebSearch","Web Search"),"page-fetch":a("research.providerPageFetch","Page Fetch"),github:a("research.providerGitHub","GitHub"),"local-docs":a("research.providerLocalDocs","Local Docs"),"llm-synthesis":a("research.providerLlmSynthesis","LLM Synthesis")}}let oe=!1;function ts({projectId:a,addToast:n,onOpenSettings:i,readinessVersion:m=0}){const{t:s}=ve("app"),b=Qe(s);c.useEffect(()=>(Y({view:"ResearchView",trigger:oe?"route-active":"remount",projectId:a,replayAttempted:!1}),oe=!1,()=>{oe=!0,Y({view:"ResearchView",trigger:"route-inactive",projectId:a,replayAttempted:!1})}),[a]);const{runs:R,selectedRun:r,selectedRunId:M,setSelectedRunId:I,availability:h,loading:N,error:C,searchQuery:_,setSearchQuery:U,createRun:D,cancelRun:H,retryRun:A,exportRun:$,createTaskFromRun:O,attachRunToTask:G,promoteFinding:j,statusCounts:w,refresh:T,uiError:S,runActionState:d}=Be({projectId:a}),[P,k]=c.useState(""),[f,z]=c.useState(()=>ie(void 0)),[l,o]=c.useState([]),[v,y]=c.useState(!1),[g,F]=c.useState([]),[E,V]=c.useState(null),[q,K]=c.useState(null),[J,fe]=c.useState(""),Z=h.supportedProviders??ze,ee=f.searchProvider,se=t=>t==="web-search"?!0:f.enabledSources[Ke[t]];c.useEffect(()=>{const t=Z.filter(u=>se(u));F(u=>{const p=u.filter(x=>t.includes(x));return p.length>0?p:t})},[f.enabledSources,Z]),c.useEffect(()=>{let t=!1;return Promise.all([Fe(a),Me().catch(()=>({providers:[]}))]).then(([u,p])=>{t||(z(ie(u)),o(p.providers.filter(x=>x.type==="api_key").map(x=>({id:x.id,authenticated:x.authenticated}))))}).catch(()=>{t||z(ie(void 0))}),()=>{t=!0}},[a,m]);const xe=c.useMemo(()=>r?r.status:s("research.noRunSelected","No run selected"),[r,s]),ye=c.useMemo(()=>r?r.status==="queued"||r.status==="retry_waiting"?"status-dot status-dot--pending":r.status==="running"?"status-dot status-dot--connecting":r.status==="completed"?"status-dot status-dot--online":r.status==="failed"||r.status==="cancelled"?"status-dot status-dot--error":"status-dot":"status-dot",[r]),re=h.supportedExportFormats??["markdown","json","html"],te=c.useMemo(()=>new Map(l.map(t=>[t.id,t.authenticated])),[l]),ae=c.useMemo(()=>{const t=new Set;return f.enabledSources.webSearch&&ee&&t.add(ee),f.enabledSources.llmSynthesis&&f.synthesisProvider&&t.add(f.synthesisProvider),[...t].filter(u=>te.has(u))},[f.enabledSources.llmSynthesis,f.enabledSources.webSearch,f.synthesisProvider,ee,te]).find(t=>te.get(t)!==!0),B=c.useMemo(()=>h.available?f.enabled?ae?{reason:s("research.missingApiKey","Missing API key for {{provider}}.",{provider:ae}),details:s("research.addCredentialsHint","Add provider credentials in Authentication settings."),settingsSection:"authentication"}:null:{reason:s("research.disabled","Research is disabled for this project."),details:s("research.enableResearchHint","Enable project research settings to create runs."),settingsSection:"research-project"}:{reason:h.reason??s("research.unavailable","Research is unavailable for this project."),details:h.setupInstructions,settingsSection:"research-project"},[h.available,h.reason,h.setupInstructions,f.enabled,ae,s]),W=async(t,u,p)=>{V(t);try{await u(),n?.(p,"success"),await T()}catch(x){n?.(x instanceof Error?x.message:s("research.actionFailed","Action failed"),"error")}finally{V(null)}},ne=async t=>{if(r){V(`export-${t}`);try{const u=await $(r.id,t),p=new Blob([u.content],{type:"text/plain;charset=utf-8"}),x=URL.createObjectURL(p),L=document.createElement("a");L.href=x,L.download=u.filename,document.body.appendChild(L),L.click(),L.remove(),URL.revokeObjectURL(x),n?.(s("research.exportedFile","Exported {{filename}}",{filename:u.filename}),"success")}catch(u){n?.(u instanceof Error?u.message:s("research.exportFailed","Export failed"),"error")}finally{V(null)}}},ge=async()=>{if(P.trim()){y(!0);try{const t=g.filter(p=>se(p));if(t.length===0){y(!1),n?.(s("research.noSourcesAvailable","No enabled research sources are available for this project."),"error");return}const u=await D({query:P.trim(),providers:t});I(u.run.id),k(""),n?.(s("research.runCreated","Research run created"),"success"),await T()}catch(t){n?.(t instanceof Error?t.message:s("research.createRunFailed","Failed to create run"),"error")}finally{y(!1)}}};return e.jsxs("section",{className:"research-view","aria-label":s("research.viewLabel","Research view"),children:[e.jsx(De,{icon:pe,title:s("research.title","Research"),actions:e.jsx("button",{className:"btn",type:"button",onClick:()=>void T(),children:s("actions.refresh","Refresh")})}),e.jsx("p",{className:"research-view__subtitle",children:s("research.subtitle","Cited search and synthesis runs: gather sources, fetch content, and synthesize findings.")}),B?e.jsxs("div",{className:"research-view__state research-view__state--error card","data-testid":"research-state-unavailable",children:[e.jsx("p",{children:B.reason}),B.details&&e.jsx("p",{children:B.details}),e.jsx("p",{children:s("research.currentDefaults","Current defaults: provider {{provider}}, max sources {{maxSources}}",{provider:f.searchProvider??s("research.notSet","(not set)"),maxSources:f.limits.maxSourcesPerRun})}),e.jsxs("div",{className:"research-view__actions",children:[e.jsx("button",{className:"btn",type:"button",onClick:()=>void T(),children:s("actions.refresh","Refresh")}),e.jsx("button",{className:"btn btn-primary",type:"button",onClick:()=>i?.(B.settingsSection),children:s("actions.openSettings","Open Settings")})]})]}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:"research-view__layout",children:[e.jsx("aside",{className:"research-view__sidebar card",children:e.jsxs("div",{className:"research-view__sidebar-content",children:[e.jsxs("div",{className:"research-view__form",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"research-query",children:s("research.queryLabel","Query")}),e.jsx("textarea",{id:"research-query",className:"input research-view__textarea",value:P,onChange:t=>k(t.target.value)})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:s("research.providersLabel","Providers")}),e.jsx("div",{className:"research-view__providers",children:Z.map(t=>{const u=se(t),p=t==="web-search";return e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:p||g.includes(t),disabled:p||!u,onChange:()=>{p||!u||F(x=>x.includes(t)?x.filter(L=>L!==t):[...x,t])}}),e.jsxs("span",{children:[b[t]??t,p?e.jsx("span",{className:"research-view__provider-lock",children:s("research.alwaysOn","Always on")}):null]})]},t)})})]}),e.jsxs("button",{className:"btn btn-primary",type:"button",disabled:!P.trim()||v,onClick:()=>void ge(),children:[v?e.jsx(He,{className:"animate-spin",size:14}):null,s("research.createRun","Create Run")]})]}),e.jsxs("div",{className:"research-view__history-header form-group",children:[e.jsx("label",{htmlFor:"research-run-search",children:s("actions.search","Search")}),e.jsxs("div",{className:"research-view__history-search-row",children:[e.jsx(pe,{size:14}),e.jsx("input",{id:"research-run-search",className:"input",placeholder:s("research.searchRunsPlaceholder","Search runs"),value:_,onChange:t=>U(t.target.value)})]})]}),e.jsx("div",{className:"research-view__history","data-testid":"research-state-running",children:R.map(t=>e.jsxs("button",{type:"button",className:`research-view__history-item card${M===t.id?" research-view__history-item--active":""}`,onClick:()=>I(t.id),children:[e.jsx("span",{className:"card-id",children:t.id}),e.jsx("span",{children:t.title})]},t.id))})]})}),e.jsxs("div",{className:"research-view__reader card",children:[N&&e.jsx("p",{"data-testid":"research-state-loading",children:e.jsx(qe,{label:s("research.loadingRuns","Loading research runs…")})}),!N&&C&&e.jsx("p",{"data-testid":"research-state-error",children:C}),!N&&!C&&R.length===0&&e.jsx("p",{"data-testid":"research-state-empty",children:s("research.noRunsYet","No research runs yet")}),e.jsxs("div",{className:"research-view__reader-content",children:[r&&e.jsxs("div",{className:"research-view__run-detail",children:[e.jsxs("div",{className:"research-view__status-row",children:[e.jsx("span",{className:ye}),e.jsx("strong",{children:xe})]}),e.jsx("h3",{className:"research-view__run-title",children:r.title}),e.jsx("p",{className:"research-view__run-query",children:r.query}),e.jsx("p",{className:"research-view__run-summary","data-testid":"research-state-results",children:r.results?.summary??s("research.noSummaryYet","No summary yet.")}),e.jsxs("div",{className:"research-view__actions",children:[e.jsx("button",{className:"btn",type:"button",title:d.cancelable?void 0:d.blockingReason,disabled:E==="cancel"||E==="retry"||!d.cancelable,onClick:()=>void W("cancel",()=>H(r.id),s("research.runCancelled","Run cancelled")),children:s("actions.cancel","Cancel")}),e.jsx("button",{className:"btn",type:"button",title:d.retryable?void 0:d.blockingReason,disabled:E==="cancel"||E==="retry"||!d.retryable,onClick:()=>void W("retry",()=>A(r.id),s("research.runRetried","Run retried")),children:s("actions.retry","Retry")}),re.includes("markdown")&&e.jsx("button",{className:"btn",type:"button",disabled:E==="export-markdown",onClick:()=>void ne("markdown"),children:s("research.exportMd","Export MD")}),re.includes("json")&&e.jsx("button",{className:"btn",type:"button",disabled:E==="export-json",onClick:()=>void ne("json"),children:s("research.exportJson","Export JSON")}),re.includes("html")&&e.jsx("button",{className:"btn",type:"button",disabled:E==="export-html",onClick:()=>void ne("html"),children:s("research.exportHtml","Export HTML")})]}),r.error&&e.jsx("p",{className:"research-view__error",children:r.error}),S&&e.jsxs("div",{className:"form-error",role:"alert",children:[e.jsx("p",{children:S.message}),S.setupHint&&e.jsx("p",{children:S.setupHint}),S.code==="MISSING_CREDENTIALS"&&e.jsx("button",{className:"btn btn-sm",type:"button",onClick:()=>i?.("authentication"),children:s("research.openAuthSettings","Open Authentication Settings")}),S.code==="FEATURE_DISABLED"&&e.jsx("button",{className:"btn btn-sm",type:"button",onClick:()=>i?.("research-project"),children:s("research.openResearchSettings","Open Research Settings")})]}),d.blockingReason&&e.jsx("p",{className:"research-view__run-query",children:d.blockingReason}),Array.isArray(r.results?.findings)&&r.results.findings.length>0&&e.jsx("div",{className:"research-view__findings",children:r.results.findings.map(t=>{const u=be(t);return e.jsxs("article",{className:"research-view__finding card",children:[e.jsx("h4",{children:t.heading}),e.jsx("p",{children:t.content}),e.jsxs("div",{className:"research-view__actions research-view__finding-actions",children:[e.jsx("button",{className:"btn btn-primary btn-sm",type:"button",onClick:()=>K({mode:"create",findingId:u}),children:s("research.createTask","Create Task")}),e.jsx("button",{className:"btn btn-sm",type:"button",onClick:()=>K({mode:"enrich",findingId:u}),children:s("research.enrichTask","Enrich Task")}),e.jsx("input",{className:"input","aria-label":s("research.destinationSlice","Destination slice ID"),value:J,onChange:p=>fe(p.target.value),placeholder:s("research.destinationSlice","Destination slice ID")}),e.jsx("button",{className:"btn btn-sm",type:"button",disabled:r.status!=="completed"||!J.trim()||E===`promote-${u}`,onClick:()=>void W(`promote-${u}`,()=>j(r.id,{findingId:u,sliceId:J.trim()}),s("research.findingPromoted","Finding promoted to roadmap")),children:s("research.promoteFinding","Promote to roadmap")})]})]},u)})}),Array.isArray(r.results?.citations)&&r.results.citations.length>0&&e.jsx("ul",{className:"research-view__citations",children:r.results.citations.map(t=>e.jsx("li",{children:e.jsx("a",{href:t,target:"_blank",rel:"noreferrer",children:t})},t))}),r.events.length>0&&e.jsxs("details",{children:[e.jsx("summary",{children:s("research.runHistory","Run history")}),e.jsx("ul",{className:"research-view__events",children:r.events.map(t=>e.jsx("li",{children:t.message},t.id))})]})]}),!r&&R.length>0&&e.jsx("p",{children:s("research.selectRunToViewDetails","Select a run to view details.")}),e.jsxs("div",{className:"research-view__stats",children:[e.jsxs("div",{className:"research-view__stat-card",children:[e.jsx("div",{className:"research-view__stat-label",children:s("research.statRunning","Running")}),e.jsx("div",{className:"research-view__stat-value",children:w.running})]}),e.jsxs("div",{className:"research-view__stat-card",children:[e.jsx("div",{className:"research-view__stat-label",children:s("research.statCompleted","Completed")}),e.jsx("div",{className:"research-view__stat-value",children:w.completed})]}),e.jsxs("div",{className:"research-view__stat-card",children:[e.jsx("div",{className:"research-view__stat-label",children:s("research.statFailed","Failed")}),e.jsx("div",{className:"research-view__stat-value",children:w.failed})]})]})]})]})]})}),r&&q&&(()=>{const t=r.results?.findings?.findIndex(p=>be(p)===q.findingId)??-1,u=t>=0?r.results.findings[t]:null;return u?e.jsx(We,{open:!0,mode:q.mode,run:r,finding:{id:q.findingId,heading:u.heading,content:u.content},projectId:a,onClose:()=>K(null),onConfirm:async({taskId:p,title:x,description:L,priority:Re,attachExport:de})=>{q.mode==="create"?await W("create-task",()=>O(r.id,x,q.findingId,L,Re,de),s("research.taskCreatedFromResearch","Task created from research")):p&&await W("attach-task",()=>G(r.id,p,q.findingId,de),s("research.taskEnrichedFromResearch","Task enriched from research")),K(null)}}):null})()]})}export{ts as ResearchView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,j as e}from"./vendor-react-SZ_qB27O.js";import{V as he,o as me,R as J,P as ye,E as Y,p as z,q as xe,u as ve,v as be,x as je,C as fe,g as Se,y as ge}from"./index-BqLVwYoA.js";import{u as Ne}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-codemirror-jBKmHyH0.js";import"./vendor-reactflow-9C3XTE7_.js";import"./vendor-xterm-BNq00GSj.js";const Ce="__sync_passphrase__",L={key:"",value:"",description:"",scope:"project",accessPolicy:"prompt",envExportable:!1,envExportKey:""},n={className:"secrets-action-icon","aria-hidden":!0,style:{width:"1em",height:"1em"}},Pe={...n,className:"secrets-action-icon spin"},Me=({addToast:i})=>{const{t:a}=Ne("app"),[R,G]=c.useState([]),[T,M]=c.useState(!0),[A,D]=c.useState(null),[K,b]=c.useState(null),[p,O]=c.useState(null),[U,x]=c.useState(!1),[Q,g]=c.useState(null),[t,l]=c.useState(L),[N,C]=c.useState(!1),[V,j]=c.useState({}),[W,F]=c.useState(null),[u,X]=c.useState(!1),[Z,_]=c.useState(!1),[f,B]=c.useState(""),[P,$]=c.useState(""),[ee,H]=c.useState(!1),[E,se]=c.useState(!1),h=c.useRef(new Map),w=c.useRef(new Map),o=c.useCallback(async(s,r)=>{const d=await fetch(s,{...r,headers:{"Content-Type":"application/json",...r?.headers??{}}});if(!d.ok){const m=await d.json().catch(()=>({error:"Request failed"}));throw new Error(String(m?.error??"Request failed"))}if(d.status!==204)return d.json()},[]),v=c.useCallback(async()=>{M(!0),D(null);try{const s=await o("/api/secrets");G(s.secrets)}catch(s){D(s instanceof Error?s.message:String(s))}finally{M(!1)}},[o]),S=c.useCallback(async()=>{try{const s=await o("/api/secrets/sync-passphrase");X(!!s.configured)}catch(s){i?.(a("secrets.errorLoadSyncStatus","Failed to load sync passphrase status: {{error}}",{error:s instanceof Error?s.message:String(s)}),"error")}},[i,o]);c.useEffect(()=>(v(),S(),()=>{h.current.forEach(s=>clearTimeout(s)),w.current.forEach(s=>clearTimeout(s))}),[v,S]);const k=()=>{_(!1),B(""),$("")},ae=async s=>{await o("/api/secrets/sync-passphrase",{method:"PUT",body:JSON.stringify({passphrase:s})})},re=async()=>{H(!0);try{await ae(f),i?.(u?a("secrets.syncPassphraseRotated","Sync passphrase rotated"):a("secrets.syncPassphraseSet","Sync passphrase set"),"success"),k(),await S()}catch(s){i?.(a("secrets.errorSaveSyncPassphrase","Failed to save sync passphrase: {{error}}",{error:s instanceof Error?s.message:String(s)}),"error")}finally{H(!1)}},te=async()=>{if(window.confirm(a("secrets.confirmClearSyncPassphrase","Clear the cross-node sync passphrase? Existing sync pairs will stop working until you set a new passphrase.")))try{await o("/api/secrets/sync-passphrase",{method:"DELETE"}),i?.(a("secrets.syncPassphraseCleared","Sync passphrase cleared"),"success"),await S()}catch(r){i?.(a("secrets.errorClearSyncPassphrase","Failed to clear sync passphrase: {{error}}",{error:r instanceof Error?r.message:String(r)}),"error")}},ce=()=>{O(null),l(L),x(!0),C(!1),b(null)},le=s=>{O(s),l({key:s.key,value:"",description:s.description??"",scope:s.scope,accessPolicy:s.accessPolicy,envExportable:s.envExportable,envExportKey:s.envExportKey??""}),x(!0),C(!1),b(null)},ne=async()=>{b(null);try{if(p){const s={key:t.key,description:t.description||null,accessPolicy:t.accessPolicy,envExportable:t.envExportable,envExportKey:t.envExportable&&t.envExportKey||null};t.value&&(s.value=t.value),await o(`/api/secrets/${p.scope}/${p.id}`,{method:"PATCH",body:JSON.stringify(s)})}else await o("/api/secrets",{method:"POST",body:JSON.stringify({scope:t.scope,key:t.key,value:t.value,description:t.description||null,accessPolicy:t.accessPolicy,envExportable:t.envExportable,envExportKey:t.envExportable&&t.envExportKey||null})});x(!1),l(L),await v()}catch(s){b(s instanceof Error?s.message:String(s))}},oe=s=>{const r=h.current.get(s.id);r&&(clearTimeout(r),h.current.delete(s.id)),j(d=>({...d,[s.id]:null}))},ie=async s=>{const r=await o(`/api/secrets/${s.scope}/${s.id}/reveal`,{method:"POST"});j(y=>({...y,[s.id]:r.value})),i?.(a("secrets.revealed","Revealed"),"success");const d=setTimeout(()=>{j(y=>({...y,[s.id]:null})),h.current.delete(s.id)},3e4),m=h.current.get(s.id);m&&clearTimeout(m),h.current.set(s.id,d)},de=async s=>{const r=V[s.id];if(!r)return;if(!await ge(r)){i?.(a("secrets.copyFailed","Failed to copy secret"),"error");return}F(s.id),i?.(a("secrets.copied","Copied"),"success");const m=setTimeout(()=>{F(null),j(ue=>({...ue,[s.id]:null}))},1500),y=w.current.get(s.id);y&&clearTimeout(y),w.current.set(s.id,m)},pe=async s=>{await o(`/api/secrets/${s.scope}/${s.id}`,{method:"DELETE"}),g(null),await v()},I=c.useMemo(()=>[...R].filter(s=>!(s.scope==="global"&&s.key===Ce)).sort((s,r)=>s.key.localeCompare(r.key)),[R]),q=f.length>0&&f===P;return e.jsxs("section",{className:"secrets-view",children:[e.jsx(he,{icon:me,title:a("secrets.title","Secrets"),actions:e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"btn btn-sm",onClick:()=>void v(),children:[e.jsx(J,{...n})," ",a("secrets.refresh","Refresh")]}),e.jsxs("button",{className:"btn btn-primary btn-sm",onClick:ce,children:[e.jsx(ye,{...n})," ",a("secrets.addSecret","Add Secret")]})]})}),A?e.jsx("div",{className:"form-error",children:A}):null,T?e.jsxs("div",{className:"secrets-loading",children:[e.jsx(J,{...Pe})," ",a("secrets.loading","Loading…")]}):null,!T&&I.length===0?e.jsx("div",{className:"secrets-empty",children:a("secrets.empty","No secrets found.")}):null,e.jsx("div",{className:"secrets-list",children:I.map(s=>{const r=V[s.id];return e.jsxs("article",{className:"card secrets-row",children:[e.jsxs("div",{className:"secrets-row-main",children:[e.jsx("div",{className:"secrets-row-key",children:s.key}),e.jsxs("div",{className:"secrets-row-meta",children:[e.jsx("span",{className:"secrets-chip",children:s.scope}),e.jsx("span",{className:"secrets-chip",children:s.accessPolicy}),s.envExportable?e.jsx("span",{className:"secrets-chip",children:a("secrets.envExportableChip","env exportable")}):null]}),r?e.jsx("pre",{className:"secrets-revealed",children:r}):null]}),e.jsxs("div",{className:"secrets-row-side",children:[e.jsx("span",{className:"secrets-row-read",children:s.lastReadAt?new Date(s.lastReadAt).toLocaleString():a("secrets.neverRead","Never read")}),e.jsxs("div",{className:"secrets-row-actions",children:[e.jsx("button",{type:"button",className:"btn btn-icon secrets-visibility-toggle",onClick:()=>{if(r){oe(s);return}ie(s)},"aria-label":r?a("secrets.hideAriaLabel","Hide"):a("secrets.revealAriaLabel","Reveal"),children:r?e.jsx(Y,{...n}):e.jsx(z,{...n})}),e.jsx("button",{className:"btn btn-icon",onClick:()=>void de(s),"aria-label":a("secrets.copyAriaLabel","Copy"),disabled:!r,children:W===s.id?e.jsx(xe,{...n}):e.jsx(ve,{...n})}),e.jsx("button",{className:"btn btn-icon",onClick:()=>le(s),"aria-label":a("secrets.editAriaLabel","Edit"),children:e.jsx(be,{...n})}),e.jsx("button",{className:"btn btn-icon btn-danger",onClick:()=>g(s.id),"aria-label":a("secrets.deleteAriaLabel","Delete"),children:e.jsx(je,{...n})})]}),Q===s.id?e.jsxs("div",{className:"secrets-confirm",children:[e.jsx("button",{className:"btn btn-sm btn-danger",onClick:()=>void pe(s),children:a("secrets.confirmDelete","Confirm")}),e.jsx("button",{className:"btn btn-sm",onClick:()=>g(null),children:a("secrets.cancelDelete","Cancel")})]}):null]})]},s.id)})}),e.jsxs("article",{className:"card secrets-sync-card secrets-sync-disclosure",children:[e.jsxs("button",{type:"button",className:"secrets-sync-disclosure-toggle","data-testid":"secrets-passphrase-disclosure","aria-expanded":E,"aria-controls":"secrets-sync-disclosure-panel",onClick:()=>se(s=>!s),children:[E?e.jsx(fe,{size:16,"aria-hidden":"true"}):e.jsx(Se,{size:16,"aria-hidden":"true"}),e.jsx("span",{children:a("secrets.syncPassphraseTitle","Cross-Node Sync Passphrase")})]}),E?e.jsxs("div",{id:"secrets-sync-disclosure-panel",className:"secrets-sync-disclosure-panel",children:[e.jsxs("div",{className:"secrets-sync-header",children:[e.jsxs("p",{className:"secrets-sync-status",children:[e.jsx("span",{className:`status-dot ${u?"status-dot--online":"status-dot--pending"}`,"aria-hidden":"true"})," ",u?a("secrets.syncConfigured","Configured"):a("secrets.syncNotConfigured","Not configured")]}),e.jsxs("div",{className:"secrets-sync-actions",children:[e.jsx("button",{className:"btn",onClick:()=>_(!0),children:u?a("secrets.rotateSyncPassphrase","Rotate"):a("secrets.setPassphrase","Set passphrase")}),u?e.jsx("button",{className:"btn btn-danger",onClick:()=>void te(),children:a("secrets.clearSyncPassphrase","Clear")}):null]})]}),e.jsx("p",{className:"secrets-sync-copy",children:a("secrets.syncPassphraseDescription","Shared passphrase used to wrap cross-node secret bundles. Both nodes in a sync pair must share the same value. Stored locally only; never transmitted.")})]}):null]}),Z?e.jsx("div",{className:"modal-overlay open",role:"presentation",children:e.jsxs("div",{className:"modal",role:"dialog","aria-modal":"true","aria-label":u?a("secrets.rotateSyncPassphraseModalTitle","Rotate sync passphrase"):a("secrets.setSyncPassphraseModalTitle","Set sync passphrase"),children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:u?a("secrets.rotateSyncPassphraseModalTitle","Rotate sync passphrase"):a("secrets.setSyncPassphraseModalTitle","Set sync passphrase")}),e.jsx("button",{className:"modal-close",onClick:k,"aria-label":a("secrets.closeAriaLabel","Close"),children:"×"})]}),e.jsxs("div",{className:"secrets-modal-body",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.passphraseLabel","Passphrase")}),e.jsx("input",{"aria-label":a("secrets.passphraseLabel","Passphrase"),className:"input",type:"password",autoComplete:"new-password",value:f,onChange:s=>B(s.target.value)})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.confirmPassphraseLabel","Confirm passphrase")}),e.jsx("input",{"aria-label":a("secrets.confirmPassphraseLabel","Confirm passphrase"),className:"input",type:"password",autoComplete:"new-password",value:P,onChange:s=>$(s.target.value)})]}),!q&&P.length>0?e.jsx("div",{className:"form-error",children:a("secrets.passphraseMustMatch","Passphrases must match.")}):null]}),e.jsx("div",{className:"modal-actions",children:e.jsxs("div",{className:"modal-actions-right",children:[e.jsx("button",{className:"btn",onClick:k,children:a("secrets.cancelBtn","Cancel")}),e.jsx("button",{className:"btn btn-primary",onClick:()=>void re(),disabled:!q||ee,children:u?a("secrets.rotateSyncPassphrase","Rotate"):a("secrets.setPassphrase","Set passphrase")})]})})]})}):null,U?e.jsx("div",{className:"modal-overlay open",role:"presentation",children:e.jsxs("div",{className:"modal",role:"dialog","aria-modal":"true","aria-label":p?a("secrets.editSecretModalTitle","Edit secret"):a("secrets.addSecretModalTitle","Add secret"),children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:p?a("secrets.editSecretModalTitle","Edit secret"):a("secrets.addSecretModalTitle","Add secret")}),e.jsx("button",{className:"modal-close",onClick:()=>x(!1),"aria-label":a("secrets.closeAriaLabel","Close"),children:"×"})]}),e.jsxs("div",{className:"secrets-modal-body",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.keyLabel","Key")}),e.jsx("input",{className:"input",value:t.key,onChange:s=>l(r=>({...r,key:s.target.value}))})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.valueLabel","Value")}),e.jsxs("div",{className:"secrets-value-row",children:[e.jsx("input",{className:"input",type:N?"text":"password",autoComplete:"off",spellCheck:!1,value:t.value,onChange:s=>l(r=>({...r,value:s.target.value}))}),e.jsx("button",{type:"button",className:"btn btn-icon secrets-visibility-toggle",onClick:()=>C(s=>!s),"aria-label":N?a("secrets.hideValueAriaLabel","Hide value"):a("secrets.showValueAriaLabel","Show value"),children:N?e.jsx(Y,{...n}):e.jsx(z,{...n})})]})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.descriptionLabel","Description")}),e.jsx("textarea",{className:"input",value:t.description,onChange:s=>l(r=>({...r,description:s.target.value}))})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.scopeLabel","Scope")}),e.jsxs("div",{className:"secrets-radio-row",children:[e.jsxs("label",{children:[e.jsx("input",{type:"radio",checked:t.scope==="project",onChange:()=>l(s=>({...s,scope:"project"})),disabled:!!p})," ",a("secrets.scopeProject","Project")]}),e.jsxs("label",{children:[e.jsx("input",{type:"radio",checked:t.scope==="global",onChange:()=>l(s=>({...s,scope:"global"})),disabled:!!p})," ",a("secrets.scopeGlobal","Global")]})]})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.accessPolicyLabel","Access policy")}),e.jsxs("select",{className:"select",value:t.accessPolicy,onChange:s=>l(r=>({...r,accessPolicy:s.target.value})),children:[e.jsx("option",{value:"auto",children:a("secrets.accessPolicyAuto","auto")}),e.jsx("option",{value:"prompt",children:a("secrets.accessPolicyPrompt","prompt")}),e.jsx("option",{value:"deny",children:a("secrets.accessPolicyDeny","deny")})]})]}),e.jsx("div",{className:"form-group",children:e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:t.envExportable,onChange:s=>l(r=>({...r,envExportable:s.target.checked}))})," ",a("secrets.exportToEnvLabel","Export to env")]})}),t.envExportable?e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.envKeyLabel","Env key")}),e.jsx("input",{className:"input",value:t.envExportKey,onChange:s=>l(r=>({...r,envExportKey:s.target.value}))})]}):null,K?e.jsx("div",{className:"form-error",children:K}):null]}),e.jsx("div",{className:"modal-actions",children:e.jsxs("div",{className:"modal-actions-right",children:[e.jsx("button",{className:"btn",onClick:()=>x(!1),children:a("secrets.cancelBtn","Cancel")}),e.jsx("button",{className:"btn btn-primary",onClick:()=>void ne(),children:p?a("secrets.saveBtn","Save"):a("secrets.createBtn","Create")})]})})]})}):null]})};export{Me as SecretsView};
|
|
1
|
+
import{r as c,j as e}from"./vendor-react-SZ_qB27O.js";import{V as he,o as me,R as J,P as ye,E as Y,p as z,q as xe,u as ve,v as be,x as je,C as fe,g as Se,y as ge}from"./index-DReijQe4.js";import{u as Ne}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-codemirror-jBKmHyH0.js";import"./vendor-reactflow-9C3XTE7_.js";import"./vendor-xterm-BNq00GSj.js";const Ce="__sync_passphrase__",L={key:"",value:"",description:"",scope:"project",accessPolicy:"prompt",envExportable:!1,envExportKey:""},n={className:"secrets-action-icon","aria-hidden":!0,style:{width:"1em",height:"1em"}},Pe={...n,className:"secrets-action-icon spin"},Me=({addToast:i})=>{const{t:a}=Ne("app"),[R,G]=c.useState([]),[T,M]=c.useState(!0),[A,D]=c.useState(null),[K,b]=c.useState(null),[p,O]=c.useState(null),[U,x]=c.useState(!1),[Q,g]=c.useState(null),[t,l]=c.useState(L),[N,C]=c.useState(!1),[V,j]=c.useState({}),[W,F]=c.useState(null),[u,X]=c.useState(!1),[Z,_]=c.useState(!1),[f,B]=c.useState(""),[P,$]=c.useState(""),[ee,H]=c.useState(!1),[E,se]=c.useState(!1),h=c.useRef(new Map),w=c.useRef(new Map),o=c.useCallback(async(s,r)=>{const d=await fetch(s,{...r,headers:{"Content-Type":"application/json",...r?.headers??{}}});if(!d.ok){const m=await d.json().catch(()=>({error:"Request failed"}));throw new Error(String(m?.error??"Request failed"))}if(d.status!==204)return d.json()},[]),v=c.useCallback(async()=>{M(!0),D(null);try{const s=await o("/api/secrets");G(s.secrets)}catch(s){D(s instanceof Error?s.message:String(s))}finally{M(!1)}},[o]),S=c.useCallback(async()=>{try{const s=await o("/api/secrets/sync-passphrase");X(!!s.configured)}catch(s){i?.(a("secrets.errorLoadSyncStatus","Failed to load sync passphrase status: {{error}}",{error:s instanceof Error?s.message:String(s)}),"error")}},[i,o]);c.useEffect(()=>(v(),S(),()=>{h.current.forEach(s=>clearTimeout(s)),w.current.forEach(s=>clearTimeout(s))}),[v,S]);const k=()=>{_(!1),B(""),$("")},ae=async s=>{await o("/api/secrets/sync-passphrase",{method:"PUT",body:JSON.stringify({passphrase:s})})},re=async()=>{H(!0);try{await ae(f),i?.(u?a("secrets.syncPassphraseRotated","Sync passphrase rotated"):a("secrets.syncPassphraseSet","Sync passphrase set"),"success"),k(),await S()}catch(s){i?.(a("secrets.errorSaveSyncPassphrase","Failed to save sync passphrase: {{error}}",{error:s instanceof Error?s.message:String(s)}),"error")}finally{H(!1)}},te=async()=>{if(window.confirm(a("secrets.confirmClearSyncPassphrase","Clear the cross-node sync passphrase? Existing sync pairs will stop working until you set a new passphrase.")))try{await o("/api/secrets/sync-passphrase",{method:"DELETE"}),i?.(a("secrets.syncPassphraseCleared","Sync passphrase cleared"),"success"),await S()}catch(r){i?.(a("secrets.errorClearSyncPassphrase","Failed to clear sync passphrase: {{error}}",{error:r instanceof Error?r.message:String(r)}),"error")}},ce=()=>{O(null),l(L),x(!0),C(!1),b(null)},le=s=>{O(s),l({key:s.key,value:"",description:s.description??"",scope:s.scope,accessPolicy:s.accessPolicy,envExportable:s.envExportable,envExportKey:s.envExportKey??""}),x(!0),C(!1),b(null)},ne=async()=>{b(null);try{if(p){const s={key:t.key,description:t.description||null,accessPolicy:t.accessPolicy,envExportable:t.envExportable,envExportKey:t.envExportable&&t.envExportKey||null};t.value&&(s.value=t.value),await o(`/api/secrets/${p.scope}/${p.id}`,{method:"PATCH",body:JSON.stringify(s)})}else await o("/api/secrets",{method:"POST",body:JSON.stringify({scope:t.scope,key:t.key,value:t.value,description:t.description||null,accessPolicy:t.accessPolicy,envExportable:t.envExportable,envExportKey:t.envExportable&&t.envExportKey||null})});x(!1),l(L),await v()}catch(s){b(s instanceof Error?s.message:String(s))}},oe=s=>{const r=h.current.get(s.id);r&&(clearTimeout(r),h.current.delete(s.id)),j(d=>({...d,[s.id]:null}))},ie=async s=>{const r=await o(`/api/secrets/${s.scope}/${s.id}/reveal`,{method:"POST"});j(y=>({...y,[s.id]:r.value})),i?.(a("secrets.revealed","Revealed"),"success");const d=setTimeout(()=>{j(y=>({...y,[s.id]:null})),h.current.delete(s.id)},3e4),m=h.current.get(s.id);m&&clearTimeout(m),h.current.set(s.id,d)},de=async s=>{const r=V[s.id];if(!r)return;if(!await ge(r)){i?.(a("secrets.copyFailed","Failed to copy secret"),"error");return}F(s.id),i?.(a("secrets.copied","Copied"),"success");const m=setTimeout(()=>{F(null),j(ue=>({...ue,[s.id]:null}))},1500),y=w.current.get(s.id);y&&clearTimeout(y),w.current.set(s.id,m)},pe=async s=>{await o(`/api/secrets/${s.scope}/${s.id}`,{method:"DELETE"}),g(null),await v()},I=c.useMemo(()=>[...R].filter(s=>!(s.scope==="global"&&s.key===Ce)).sort((s,r)=>s.key.localeCompare(r.key)),[R]),q=f.length>0&&f===P;return e.jsxs("section",{className:"secrets-view",children:[e.jsx(he,{icon:me,title:a("secrets.title","Secrets"),actions:e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"btn btn-sm",onClick:()=>void v(),children:[e.jsx(J,{...n})," ",a("secrets.refresh","Refresh")]}),e.jsxs("button",{className:"btn btn-primary btn-sm",onClick:ce,children:[e.jsx(ye,{...n})," ",a("secrets.addSecret","Add Secret")]})]})}),A?e.jsx("div",{className:"form-error",children:A}):null,T?e.jsxs("div",{className:"secrets-loading",children:[e.jsx(J,{...Pe})," ",a("secrets.loading","Loading…")]}):null,!T&&I.length===0?e.jsx("div",{className:"secrets-empty",children:a("secrets.empty","No secrets found.")}):null,e.jsx("div",{className:"secrets-list",children:I.map(s=>{const r=V[s.id];return e.jsxs("article",{className:"card secrets-row",children:[e.jsxs("div",{className:"secrets-row-main",children:[e.jsx("div",{className:"secrets-row-key",children:s.key}),e.jsxs("div",{className:"secrets-row-meta",children:[e.jsx("span",{className:"secrets-chip",children:s.scope}),e.jsx("span",{className:"secrets-chip",children:s.accessPolicy}),s.envExportable?e.jsx("span",{className:"secrets-chip",children:a("secrets.envExportableChip","env exportable")}):null]}),r?e.jsx("pre",{className:"secrets-revealed",children:r}):null]}),e.jsxs("div",{className:"secrets-row-side",children:[e.jsx("span",{className:"secrets-row-read",children:s.lastReadAt?new Date(s.lastReadAt).toLocaleString():a("secrets.neverRead","Never read")}),e.jsxs("div",{className:"secrets-row-actions",children:[e.jsx("button",{type:"button",className:"btn btn-icon secrets-visibility-toggle",onClick:()=>{if(r){oe(s);return}ie(s)},"aria-label":r?a("secrets.hideAriaLabel","Hide"):a("secrets.revealAriaLabel","Reveal"),children:r?e.jsx(Y,{...n}):e.jsx(z,{...n})}),e.jsx("button",{className:"btn btn-icon",onClick:()=>void de(s),"aria-label":a("secrets.copyAriaLabel","Copy"),disabled:!r,children:W===s.id?e.jsx(xe,{...n}):e.jsx(ve,{...n})}),e.jsx("button",{className:"btn btn-icon",onClick:()=>le(s),"aria-label":a("secrets.editAriaLabel","Edit"),children:e.jsx(be,{...n})}),e.jsx("button",{className:"btn btn-icon btn-danger",onClick:()=>g(s.id),"aria-label":a("secrets.deleteAriaLabel","Delete"),children:e.jsx(je,{...n})})]}),Q===s.id?e.jsxs("div",{className:"secrets-confirm",children:[e.jsx("button",{className:"btn btn-sm btn-danger",onClick:()=>void pe(s),children:a("secrets.confirmDelete","Confirm")}),e.jsx("button",{className:"btn btn-sm",onClick:()=>g(null),children:a("secrets.cancelDelete","Cancel")})]}):null]})]},s.id)})}),e.jsxs("article",{className:"card secrets-sync-card secrets-sync-disclosure",children:[e.jsxs("button",{type:"button",className:"secrets-sync-disclosure-toggle","data-testid":"secrets-passphrase-disclosure","aria-expanded":E,"aria-controls":"secrets-sync-disclosure-panel",onClick:()=>se(s=>!s),children:[E?e.jsx(fe,{size:16,"aria-hidden":"true"}):e.jsx(Se,{size:16,"aria-hidden":"true"}),e.jsx("span",{children:a("secrets.syncPassphraseTitle","Cross-Node Sync Passphrase")})]}),E?e.jsxs("div",{id:"secrets-sync-disclosure-panel",className:"secrets-sync-disclosure-panel",children:[e.jsxs("div",{className:"secrets-sync-header",children:[e.jsxs("p",{className:"secrets-sync-status",children:[e.jsx("span",{className:`status-dot ${u?"status-dot--online":"status-dot--pending"}`,"aria-hidden":"true"})," ",u?a("secrets.syncConfigured","Configured"):a("secrets.syncNotConfigured","Not configured")]}),e.jsxs("div",{className:"secrets-sync-actions",children:[e.jsx("button",{className:"btn",onClick:()=>_(!0),children:u?a("secrets.rotateSyncPassphrase","Rotate"):a("secrets.setPassphrase","Set passphrase")}),u?e.jsx("button",{className:"btn btn-danger",onClick:()=>void te(),children:a("secrets.clearSyncPassphrase","Clear")}):null]})]}),e.jsx("p",{className:"secrets-sync-copy",children:a("secrets.syncPassphraseDescription","Shared passphrase used to wrap cross-node secret bundles. Both nodes in a sync pair must share the same value. Stored locally only; never transmitted.")})]}):null]}),Z?e.jsx("div",{className:"modal-overlay open",role:"presentation",children:e.jsxs("div",{className:"modal",role:"dialog","aria-modal":"true","aria-label":u?a("secrets.rotateSyncPassphraseModalTitle","Rotate sync passphrase"):a("secrets.setSyncPassphraseModalTitle","Set sync passphrase"),children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:u?a("secrets.rotateSyncPassphraseModalTitle","Rotate sync passphrase"):a("secrets.setSyncPassphraseModalTitle","Set sync passphrase")}),e.jsx("button",{className:"modal-close",onClick:k,"aria-label":a("secrets.closeAriaLabel","Close"),children:"×"})]}),e.jsxs("div",{className:"secrets-modal-body",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.passphraseLabel","Passphrase")}),e.jsx("input",{"aria-label":a("secrets.passphraseLabel","Passphrase"),className:"input",type:"password",autoComplete:"new-password",value:f,onChange:s=>B(s.target.value)})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.confirmPassphraseLabel","Confirm passphrase")}),e.jsx("input",{"aria-label":a("secrets.confirmPassphraseLabel","Confirm passphrase"),className:"input",type:"password",autoComplete:"new-password",value:P,onChange:s=>$(s.target.value)})]}),!q&&P.length>0?e.jsx("div",{className:"form-error",children:a("secrets.passphraseMustMatch","Passphrases must match.")}):null]}),e.jsx("div",{className:"modal-actions",children:e.jsxs("div",{className:"modal-actions-right",children:[e.jsx("button",{className:"btn",onClick:k,children:a("secrets.cancelBtn","Cancel")}),e.jsx("button",{className:"btn btn-primary",onClick:()=>void re(),disabled:!q||ee,children:u?a("secrets.rotateSyncPassphrase","Rotate"):a("secrets.setPassphrase","Set passphrase")})]})})]})}):null,U?e.jsx("div",{className:"modal-overlay open",role:"presentation",children:e.jsxs("div",{className:"modal",role:"dialog","aria-modal":"true","aria-label":p?a("secrets.editSecretModalTitle","Edit secret"):a("secrets.addSecretModalTitle","Add secret"),children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:p?a("secrets.editSecretModalTitle","Edit secret"):a("secrets.addSecretModalTitle","Add secret")}),e.jsx("button",{className:"modal-close",onClick:()=>x(!1),"aria-label":a("secrets.closeAriaLabel","Close"),children:"×"})]}),e.jsxs("div",{className:"secrets-modal-body",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.keyLabel","Key")}),e.jsx("input",{className:"input",value:t.key,onChange:s=>l(r=>({...r,key:s.target.value}))})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.valueLabel","Value")}),e.jsxs("div",{className:"secrets-value-row",children:[e.jsx("input",{className:"input",type:N?"text":"password",autoComplete:"off",spellCheck:!1,value:t.value,onChange:s=>l(r=>({...r,value:s.target.value}))}),e.jsx("button",{type:"button",className:"btn btn-icon secrets-visibility-toggle",onClick:()=>C(s=>!s),"aria-label":N?a("secrets.hideValueAriaLabel","Hide value"):a("secrets.showValueAriaLabel","Show value"),children:N?e.jsx(Y,{...n}):e.jsx(z,{...n})})]})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.descriptionLabel","Description")}),e.jsx("textarea",{className:"input",value:t.description,onChange:s=>l(r=>({...r,description:s.target.value}))})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.scopeLabel","Scope")}),e.jsxs("div",{className:"secrets-radio-row",children:[e.jsxs("label",{children:[e.jsx("input",{type:"radio",checked:t.scope==="project",onChange:()=>l(s=>({...s,scope:"project"})),disabled:!!p})," ",a("secrets.scopeProject","Project")]}),e.jsxs("label",{children:[e.jsx("input",{type:"radio",checked:t.scope==="global",onChange:()=>l(s=>({...s,scope:"global"})),disabled:!!p})," ",a("secrets.scopeGlobal","Global")]})]})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.accessPolicyLabel","Access policy")}),e.jsxs("select",{className:"select",value:t.accessPolicy,onChange:s=>l(r=>({...r,accessPolicy:s.target.value})),children:[e.jsx("option",{value:"auto",children:a("secrets.accessPolicyAuto","auto")}),e.jsx("option",{value:"prompt",children:a("secrets.accessPolicyPrompt","prompt")}),e.jsx("option",{value:"deny",children:a("secrets.accessPolicyDeny","deny")})]})]}),e.jsx("div",{className:"form-group",children:e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:t.envExportable,onChange:s=>l(r=>({...r,envExportable:s.target.checked}))})," ",a("secrets.exportToEnvLabel","Export to env")]})}),t.envExportable?e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.envKeyLabel","Env key")}),e.jsx("input",{className:"input",value:t.envExportKey,onChange:s=>l(r=>({...r,envExportKey:s.target.value}))})]}):null,K?e.jsx("div",{className:"form-error",children:K}):null]}),e.jsx("div",{className:"modal-actions",children:e.jsxs("div",{className:"modal-actions-right",children:[e.jsx("button",{className:"btn",onClick:()=>x(!1),children:a("secrets.cancelBtn","Cancel")}),e.jsx("button",{className:"btn btn-primary",onClick:()=>void ne(),children:p?a("secrets.saveBtn","Save"):a("secrets.createBtn","Create")})]})})]})}):null]})};export{Me as SecretsView};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-xterm-BNq00GSj.js","assets/vendor-react-SZ_qB27O.js","assets/vendor-xterm-LZoznX6r.css","assets/addon-fit-C1WQXRvu.js","assets/addon-unicode11-BVmNDUBM.js","assets/addon-webgl-uLc0RKcC.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{J as ge,K as A,N as le,O as V,Q as ce,U as B,W as xe,Y as Ne,p as Re,_ as Pe,$ as J,a0 as je,a1 as Me,a as De,a2 as I,a3 as Le,a4 as Oe}from"./index-BqLVwYoA.js";import{r as i,j as t}from"./vendor-react-SZ_qB27O.js";import"./vendor-xterm-BNq00GSj.js";import{u as Ae}from"./vendor-i18n-GF3RlKbq.js";import{S as ze}from"./shield-alert-CZg8yaFA.js";import"./vendor-codemirror-jBKmHyH0.js";import"./vendor-reactflow-9C3XTE7_.js";const Fe=32*1024,Be=100,Ie="\x1B",Ke=" ",We="",$e="\x1B[A",Ue="\x1B[B",Qe="\x1B[C",Ve="\x1B[D",K={ctrl:"Ctrl",escape:"Esc",tab:"Tab",ctrlC:"^C"};function de(u){if(u.length!==1)return null;const o=u.toUpperCase().charCodeAt(0);return o>=64&&o<=95?String.fromCharCode(o&31):null}function Je(){const[u,f]=i.useState(()=>J());return i.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const o=window.matchMedia(je),a=window.visualViewport,y=()=>f(J());return y(),typeof a?.addEventListener=="function"&&a.addEventListener("resize",y),typeof o.addEventListener=="function"?(o.addEventListener("change",y),()=>{o.removeEventListener("change",y),typeof a?.removeEventListener=="function"&&a.removeEventListener("resize",y)}):(o.addListener(y),()=>{o.removeListener(y),typeof a?.removeEventListener=="function"&&a.removeEventListener("resize",y)})},[]),u}function Ye(u,f){if(typeof window>"u")return"";const a=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/cli-sessions/ws?sessionId=${encodeURIComponent(u)}&ticket=${encodeURIComponent(f)}`;return Oe(a)}function He(){return/Mac|iPhone|iPad|iPod/i.test(navigator.platform)}function Ge(u){if(typeof window<"u"&&typeof window.atob=="function"){const f=window.atob(u),o=new Uint8Array(f.length);for(let a=0;a<f.length;a++)o[a]=f.charCodeAt(a);return new TextDecoder("utf-8").decode(o)}return Buffer.from(u,"base64").toString("utf8")}function at({sessionId:u,readOnly:f=!1,posture:o,mode:a="live",projectId:y,onConfirmAdvance:E,showConfirmAdvance:W=!1,onOpenAdapterSettings:Y}){const{t:r}=Ae("app"),C=i.useRef(null),T=i.useRef(null),j=i.useRef(null),S=i.useRef(null),[H,G]=i.useState(!1),[ue,$]=i.useState(!1),[q,Z]=i.useState(!1),g=Je(),{keyboardOpen:z,keyboardOverlap:me}=ge({enabled:g}),fe=i.useRef(null),[_,X]=i.useState(""),[x,M]=i.useState(!1),[pe,ye]=i.useState(()=>A().customShortcuts),[ee,te]=i.useState(null),ne=f||ee===!0,D=!f&&ee===!1&&a==="live",b=i.useCallback(e=>{if(!e||!D)return;const n=S.current;n?.readyState===WebSocket.OPEN&&n.send(JSON.stringify({type:"input",data:e}))},[D]),N=i.useCallback(e=>{if(x){const n=de(e);if(M(!1),n){b(n);return}}b(e)},[x,b]),l=i.useCallback(e=>{e.preventDefault()},[]),be=i.useCallback(e=>{e?.preventDefault?.(),_&&b(_),b("\r"),X("")},[_,b]),he=i.useCallback(e=>{if(x&&e.length>_.length){const n=e.slice(_.length,_.length+1),d=de(n);if(M(!1),d){b(d);return}}X(e)},[x,_,b]);i.useEffect(()=>{W&&$(!1)},[W,u]);const L=i.useCallback((e,n)=>{const d=S.current;d?.readyState===WebSocket.OPEN&&d.send(JSON.stringify({type:"resize",cols:e,rows:n}))},[]),ie=i.useCallback(()=>{const e=T.current;if(!e)return;const n=A(),d=le(n.fontFamily);e.options.fontFamily=d,C.current?.style.setProperty("--terminal-glyph-font-family",V(n.fontFamily)),e.options.fontSize=n.fontSize,e.options.cursorStyle=n.cursorStyle,e.options.cursorBlink=n.cursorBlink&&D;try{j.current?.fit?.(),L(e.cols,e.rows)}catch{}ce(n.fontSize,d).then(R=>{if(!(!R||T.current!==e||e.options.fontSize!==n.fontSize||e.options.fontFamily!==d)){B(e,d),e.options.fontSize=n.fontSize;try{j.current?.fit?.(),L(e.cols,e.rows),B(e,d),e.refresh(0,Math.max(0,e.rows-1))}catch{}}},()=>{})},[D,L]);i.useEffect(()=>{if(typeof window>"u")return;const e=n=>{n.key===Me&&(ie(),ye(A().customShortcuts))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[ie]),i.useEffect(()=>{if(!u||typeof window>"u")return;let e=!1,n=null,d=null,R=0;te(null);const U=L,ke=p=>{if(R+=p,R<Fe)return;const h=S.current;h?.readyState===WebSocket.OPEN&&h.send(JSON.stringify({type:"ack",bytes:R})),R=0};return(async()=>{let p;try{p=await De(`/cli-sessions/${encodeURIComponent(u)}/attach-ticket`,{method:"POST",body:JSON.stringify(y?{projectId:y}:{})})}catch{return}if(e)return;te(p.readOnly);const h=!f&&!p.readOnly&&a==="live",[{Terminal:ve},{FitAddon:Ee},{Unicode11Addon:Ce}]=await Promise.all([I(()=>import("./vendor-xterm-BNq00GSj.js").then(c=>c.x),__vite__mapDeps([0,1,2])),I(()=>import("./addon-fit-C1WQXRvu.js").then(c=>c.a),__vite__mapDeps([3,1])),I(()=>import("./addon-unicode11-BVmNDUBM.js").then(c=>c.a),__vite__mapDeps([4,1]))]);if(e||!C.current)return;const w=A(),O=le(w.fontFamily);C.current.style.setProperty("--terminal-glyph-font-family",V(w.fontFamily));const s=new ve({convertEol:!1,cursorBlink:w.cursorBlink&&h,cursorStyle:w.cursorStyle,disableStdin:!h,scrollback:1e4,fontFamily:O,fontSize:w.fontSize}),P=new Ee;s.loadAddon(P);const Te=new Ce;if(s.loadAddon(Te),s.unicode.activeVersion="11",Le(()=>{s.open(C.current)}),T.current=s,j.current=P,w.renderer==="auto"&&!J())try{const{WebglAddon:c}=await I(async()=>{const{WebglAddon:m}=await import("./addon-webgl-uLc0RKcC.js").then(k=>k.a);return{WebglAddon:m}},__vite__mapDeps([5,1]));if(!e){const m=new c;m.onContextLoss(()=>{try{m.dispose()}catch{}}),s.loadAddon(m)}}catch{}try{P.fit()}catch{}(async()=>{if(!(!await ce(w.fontSize,O)||e||T.current!==s||j.current!==P||s.options.fontSize!==w.fontSize||s.options.fontFamily!==O))try{B(s,O),s.options.fontSize=w.fontSize,P.fit(),U(s.cols,s.rows),B(s,O),s.refresh(0,Math.max(0,s.rows-1))}catch{}})(),h&&(s.onData(c=>{const m=S.current;m?.readyState===WebSocket.OPEN&&m.send(JSON.stringify({type:"input",data:c}))}),s.attachCustomKeyEventHandler(c=>{if(c.type!=="keydown"||!(He()?c.metaKey:c.ctrlKey)||c.altKey||c.shiftKey)return!0;const k=c.key.toLowerCase();if(k==="c"){const v=s.hasSelection()?s.getSelection():"";return v?(navigator.clipboard?.writeText(v).catch(()=>{}),!1):!0}if(k==="v"){const v=navigator.clipboard?.readText;return v&&v.call(navigator.clipboard).then(ae=>{if(!ae)return;const re=S.current;re?.readyState===WebSocket.OPEN&&re.send(JSON.stringify({type:"input",data:ae}))}).catch(()=>{}),!1}return!0})),n=new ResizeObserver(()=>{d&&clearTimeout(d),d=setTimeout(()=>{try{P.fit(),U(s.cols,s.rows)}catch{}},Be)}),n.observe(C.current);const Q=new WebSocket(Ye(u,p.ticket));S.current=Q,Q.onopen=()=>{U(s.cols,s.rows)},Q.onmessage=c=>{let m;try{m=JSON.parse(typeof c.data=="string"?c.data:"")}catch{return}switch(m.type){case"scrollback":case"data":{if(typeof m.data!="string")return;const k=Ge(m.data),v=k.length;s.write(k,()=>ke(v));break}}}})(),()=>{e=!0,d&&clearTimeout(d),n&&n.disconnect();const p=S.current;if(p){p.onopen=null,p.onmessage=null,p.onclose=null,p.onerror=null;try{p.close()}catch{}S.current=null}const h=T.current;if(h){try{h.dispose()}catch{}T.current=null}j.current=null}},[u,f,a,y,L]);const se=i.useMemo(()=>a==="idle"?r("cliTerminal.replayIdle","Session idle"):a==="ended"?r("cliTerminal.replayEnded","Session ended"):null,[a,r]),we=i.useCallback(async()=>{if(E){Z(!0);try{await E("advance"),$(!0)}finally{Z(!1)}}},[E]),Se=i.useCallback(async()=>{E&&await E("not-yet"),$(!0)},[E]),F=!!o?.elevated,oe=o?.elevatedFlags?.join(", "),_e={"--terminal-glyph-font-family":V(A().fontFamily)};return t.jsxs("div",{className:`cli-session-terminal${g?" cli-session-terminal--mobile":""}${g&&z?" cli-session-terminal--keyboard-open":""}`,"data-mode":a,"data-read-only":ne,"data-mobile":g,"data-keyboard-open":g&&z,children:[t.jsxs("header",{className:"cli-session-terminal__header",children:[o&&t.jsxs("div",{className:"cli-session-terminal__posture-wrap",children:[t.jsxs("button",{type:"button",className:`cli-posture-chip${F?" cli-posture-chip--elevated":""}`,"data-elevated":F,"aria-expanded":H,onClick:()=>G(e=>!e),children:[F?t.jsx(ze,{size:13,"aria-hidden":"true"}):t.jsx(xe,{size:13,"aria-hidden":"true"}),t.jsx("span",{className:"cli-posture-chip__name",children:o.adapterName}),o.mode&&t.jsx("span",{className:"cli-posture-chip__mode",children:o.mode}),F&&oe&&t.jsx("span",{className:"cli-posture-chip__flag",children:oe})]}),H&&t.jsxs("div",{className:"cli-posture-tooltip",role:"tooltip",children:[t.jsx("p",{className:"cli-posture-tooltip__title",children:r("cliTerminal.postureResolved","Resolved posture")}),t.jsxs("ul",{className:"cli-posture-tooltip__list",children:[(o.resolved??[]).map((e,n)=>t.jsx("li",{children:e},n)),(o.resolved??[]).length===0&&t.jsx("li",{children:o.mode??r("cliTerminal.postureBaseline","Baseline")})]}),Y&&t.jsxs("button",{type:"button",className:"cli-posture-tooltip__settings",onClick:()=>{G(!1),Y()},children:[t.jsx(Ne,{size:12,"aria-hidden":"true"}),r("cliTerminal.adapterSettings","Adapter settings")]})]})]}),ne&&t.jsxs("span",{className:"cli-session-terminal__readonly-badge",children:[t.jsx(Re,{size:12,"aria-hidden":"true"}),r("cliTerminal.readOnly","Read-only")]}),se&&t.jsx("span",{className:"cli-session-terminal__replay-badge","data-replay-mode":a,children:se})]}),t.jsx("div",{className:"cli-session-terminal__viewport",ref:C,"data-testid":"cli-terminal-viewport",style:_e}),W&&!ue&&t.jsxs("div",{className:"cli-session-terminal__advance-strip",role:"region",children:[t.jsx("span",{className:"cli-session-terminal__advance-copy",children:r("cliTerminal.advancePrompt","This session looks idle — advance to review?")}),t.jsxs("div",{className:"cli-session-terminal__advance-actions",children:[t.jsx("button",{type:"button",className:"cli-session-terminal__advance-btn",disabled:q,onClick:we,children:r("cliTerminal.advance","Advance")}),t.jsx("button",{type:"button",className:"cli-session-terminal__advance-btn cli-session-terminal__advance-btn--secondary",disabled:q,onClick:Se,children:r("cliTerminal.notYet","Not yet")})]})]}),g&&D&&t.jsxs("div",{className:`cli-session-terminal__mobile-bar${z?" cli-session-terminal__mobile-bar--keyboard-open":""}`,"data-testid":"cli-terminal-mobile-bar",style:z?{bottom:`${me}px`}:void 0,children:[t.jsxs("div",{className:"cli-session-terminal__key-row","data-testid":"cli-terminal-key-bar",children:[t.jsx("button",{type:"button",className:`cli-terminal-key cli-terminal-key--ctrl${x?" cli-terminal-key--active":""}`,"data-testid":"cli-key-ctrl","aria-label":r("cliTerminal.mobileKeyCtrl","Sticky Ctrl modifier"),"aria-pressed":x,onPointerDown:l,onMouseDown:l,onClick:()=>M(e=>!e),children:K.ctrl}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-esc","aria-label":r("cliTerminal.mobileKeyEsc","Send Escape"),onPointerDown:l,onMouseDown:l,onClick:()=>N(Ie),children:K.escape}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-tab","aria-label":r("cliTerminal.mobileKeyTab","Send Tab"),onPointerDown:l,onMouseDown:l,onClick:()=>N(Ke),children:K.tab}),t.jsx("button",{type:"button",className:"cli-terminal-key cli-terminal-key--ctrlc","data-testid":"cli-key-ctrl-c","aria-label":r("cliTerminal.mobileKeyCtrlC","Send Ctrl-C"),onPointerDown:l,onMouseDown:l,onClick:()=>{M(!1),b(We)},children:K.ctrlC}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-up","aria-label":r("cliTerminal.mobileKeyArrowUp","Cursor up"),onPointerDown:l,onMouseDown:l,onClick:()=>N($e),children:"↑"}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-down","aria-label":r("cliTerminal.mobileKeyArrowDown","Cursor down"),onPointerDown:l,onMouseDown:l,onClick:()=>N(Ue),children:"↓"}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-left","aria-label":r("cliTerminal.mobileKeyArrowLeft","Cursor left"),onPointerDown:l,onMouseDown:l,onClick:()=>N(Ve),children:"←"}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-right","aria-label":r("cliTerminal.mobileKeyArrowRight","Cursor right"),onPointerDown:l,onMouseDown:l,onClick:()=>N(Qe),children:"→"}),pe.map(e=>t.jsx("button",{type:"button",className:"cli-terminal-key cli-terminal-key--custom","data-testid":`cli-terminal-custom-shortcut-${e.id}`,title:e.label,"aria-label":e.label,onPointerDown:l,onMouseDown:l,onClick:()=>{M(!1),b(Pe(e.value))},children:e.label},e.id))]}),t.jsxs("form",{className:"cli-session-terminal__input-row",onSubmit:be,children:[t.jsx("input",{ref:fe,type:"text",className:"cli-session-terminal__mobile-input","data-testid":"cli-terminal-mobile-input",value:_,placeholder:r("cliTerminal.mobileInputPlaceholder","Type to send to the session…"),autoCapitalize:"off",autoCorrect:"off",autoComplete:"off",spellCheck:!1,onChange:e=>he(e.target.value)}),t.jsx("button",{type:"submit",className:"cli-session-terminal__mobile-send","data-testid":"cli-terminal-mobile-send","aria-label":r("cliTerminal.mobileSend","Send"),onPointerDown:l,onMouseDown:l,children:r("cliTerminal.mobileSend","Send")})]})]})]})}export{at as SessionTerminal};
|
|
2
|
+
import{J as ge,K as A,N as le,O as V,Q as ce,U as B,W as xe,Y as Ne,p as Re,_ as Pe,$ as J,a0 as je,a1 as Me,a as De,a2 as I,a3 as Le,a4 as Oe}from"./index-DReijQe4.js";import{r as i,j as t}from"./vendor-react-SZ_qB27O.js";import"./vendor-xterm-BNq00GSj.js";import{u as Ae}from"./vendor-i18n-GF3RlKbq.js";import{S as ze}from"./shield-alert-BjiTG99h.js";import"./vendor-codemirror-jBKmHyH0.js";import"./vendor-reactflow-9C3XTE7_.js";const Fe=32*1024,Be=100,Ie="\x1B",Ke=" ",We="",$e="\x1B[A",Ue="\x1B[B",Qe="\x1B[C",Ve="\x1B[D",K={ctrl:"Ctrl",escape:"Esc",tab:"Tab",ctrlC:"^C"};function de(u){if(u.length!==1)return null;const o=u.toUpperCase().charCodeAt(0);return o>=64&&o<=95?String.fromCharCode(o&31):null}function Je(){const[u,f]=i.useState(()=>J());return i.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const o=window.matchMedia(je),a=window.visualViewport,y=()=>f(J());return y(),typeof a?.addEventListener=="function"&&a.addEventListener("resize",y),typeof o.addEventListener=="function"?(o.addEventListener("change",y),()=>{o.removeEventListener("change",y),typeof a?.removeEventListener=="function"&&a.removeEventListener("resize",y)}):(o.addListener(y),()=>{o.removeListener(y),typeof a?.removeEventListener=="function"&&a.removeEventListener("resize",y)})},[]),u}function Ye(u,f){if(typeof window>"u")return"";const a=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/cli-sessions/ws?sessionId=${encodeURIComponent(u)}&ticket=${encodeURIComponent(f)}`;return Oe(a)}function He(){return/Mac|iPhone|iPad|iPod/i.test(navigator.platform)}function Ge(u){if(typeof window<"u"&&typeof window.atob=="function"){const f=window.atob(u),o=new Uint8Array(f.length);for(let a=0;a<f.length;a++)o[a]=f.charCodeAt(a);return new TextDecoder("utf-8").decode(o)}return Buffer.from(u,"base64").toString("utf8")}function at({sessionId:u,readOnly:f=!1,posture:o,mode:a="live",projectId:y,onConfirmAdvance:E,showConfirmAdvance:W=!1,onOpenAdapterSettings:Y}){const{t:r}=Ae("app"),C=i.useRef(null),T=i.useRef(null),j=i.useRef(null),S=i.useRef(null),[H,G]=i.useState(!1),[ue,$]=i.useState(!1),[q,Z]=i.useState(!1),g=Je(),{keyboardOpen:z,keyboardOverlap:me}=ge({enabled:g}),fe=i.useRef(null),[_,X]=i.useState(""),[x,M]=i.useState(!1),[pe,ye]=i.useState(()=>A().customShortcuts),[ee,te]=i.useState(null),ne=f||ee===!0,D=!f&&ee===!1&&a==="live",b=i.useCallback(e=>{if(!e||!D)return;const n=S.current;n?.readyState===WebSocket.OPEN&&n.send(JSON.stringify({type:"input",data:e}))},[D]),N=i.useCallback(e=>{if(x){const n=de(e);if(M(!1),n){b(n);return}}b(e)},[x,b]),l=i.useCallback(e=>{e.preventDefault()},[]),be=i.useCallback(e=>{e?.preventDefault?.(),_&&b(_),b("\r"),X("")},[_,b]),he=i.useCallback(e=>{if(x&&e.length>_.length){const n=e.slice(_.length,_.length+1),d=de(n);if(M(!1),d){b(d);return}}X(e)},[x,_,b]);i.useEffect(()=>{W&&$(!1)},[W,u]);const L=i.useCallback((e,n)=>{const d=S.current;d?.readyState===WebSocket.OPEN&&d.send(JSON.stringify({type:"resize",cols:e,rows:n}))},[]),ie=i.useCallback(()=>{const e=T.current;if(!e)return;const n=A(),d=le(n.fontFamily);e.options.fontFamily=d,C.current?.style.setProperty("--terminal-glyph-font-family",V(n.fontFamily)),e.options.fontSize=n.fontSize,e.options.cursorStyle=n.cursorStyle,e.options.cursorBlink=n.cursorBlink&&D;try{j.current?.fit?.(),L(e.cols,e.rows)}catch{}ce(n.fontSize,d).then(R=>{if(!(!R||T.current!==e||e.options.fontSize!==n.fontSize||e.options.fontFamily!==d)){B(e,d),e.options.fontSize=n.fontSize;try{j.current?.fit?.(),L(e.cols,e.rows),B(e,d),e.refresh(0,Math.max(0,e.rows-1))}catch{}}},()=>{})},[D,L]);i.useEffect(()=>{if(typeof window>"u")return;const e=n=>{n.key===Me&&(ie(),ye(A().customShortcuts))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[ie]),i.useEffect(()=>{if(!u||typeof window>"u")return;let e=!1,n=null,d=null,R=0;te(null);const U=L,ke=p=>{if(R+=p,R<Fe)return;const h=S.current;h?.readyState===WebSocket.OPEN&&h.send(JSON.stringify({type:"ack",bytes:R})),R=0};return(async()=>{let p;try{p=await De(`/cli-sessions/${encodeURIComponent(u)}/attach-ticket`,{method:"POST",body:JSON.stringify(y?{projectId:y}:{})})}catch{return}if(e)return;te(p.readOnly);const h=!f&&!p.readOnly&&a==="live",[{Terminal:ve},{FitAddon:Ee},{Unicode11Addon:Ce}]=await Promise.all([I(()=>import("./vendor-xterm-BNq00GSj.js").then(c=>c.x),__vite__mapDeps([0,1,2])),I(()=>import("./addon-fit-C1WQXRvu.js").then(c=>c.a),__vite__mapDeps([3,1])),I(()=>import("./addon-unicode11-BVmNDUBM.js").then(c=>c.a),__vite__mapDeps([4,1]))]);if(e||!C.current)return;const w=A(),O=le(w.fontFamily);C.current.style.setProperty("--terminal-glyph-font-family",V(w.fontFamily));const s=new ve({convertEol:!1,cursorBlink:w.cursorBlink&&h,cursorStyle:w.cursorStyle,disableStdin:!h,scrollback:1e4,fontFamily:O,fontSize:w.fontSize}),P=new Ee;s.loadAddon(P);const Te=new Ce;if(s.loadAddon(Te),s.unicode.activeVersion="11",Le(()=>{s.open(C.current)}),T.current=s,j.current=P,w.renderer==="auto"&&!J())try{const{WebglAddon:c}=await I(async()=>{const{WebglAddon:m}=await import("./addon-webgl-uLc0RKcC.js").then(k=>k.a);return{WebglAddon:m}},__vite__mapDeps([5,1]));if(!e){const m=new c;m.onContextLoss(()=>{try{m.dispose()}catch{}}),s.loadAddon(m)}}catch{}try{P.fit()}catch{}(async()=>{if(!(!await ce(w.fontSize,O)||e||T.current!==s||j.current!==P||s.options.fontSize!==w.fontSize||s.options.fontFamily!==O))try{B(s,O),s.options.fontSize=w.fontSize,P.fit(),U(s.cols,s.rows),B(s,O),s.refresh(0,Math.max(0,s.rows-1))}catch{}})(),h&&(s.onData(c=>{const m=S.current;m?.readyState===WebSocket.OPEN&&m.send(JSON.stringify({type:"input",data:c}))}),s.attachCustomKeyEventHandler(c=>{if(c.type!=="keydown"||!(He()?c.metaKey:c.ctrlKey)||c.altKey||c.shiftKey)return!0;const k=c.key.toLowerCase();if(k==="c"){const v=s.hasSelection()?s.getSelection():"";return v?(navigator.clipboard?.writeText(v).catch(()=>{}),!1):!0}if(k==="v"){const v=navigator.clipboard?.readText;return v&&v.call(navigator.clipboard).then(ae=>{if(!ae)return;const re=S.current;re?.readyState===WebSocket.OPEN&&re.send(JSON.stringify({type:"input",data:ae}))}).catch(()=>{}),!1}return!0})),n=new ResizeObserver(()=>{d&&clearTimeout(d),d=setTimeout(()=>{try{P.fit(),U(s.cols,s.rows)}catch{}},Be)}),n.observe(C.current);const Q=new WebSocket(Ye(u,p.ticket));S.current=Q,Q.onopen=()=>{U(s.cols,s.rows)},Q.onmessage=c=>{let m;try{m=JSON.parse(typeof c.data=="string"?c.data:"")}catch{return}switch(m.type){case"scrollback":case"data":{if(typeof m.data!="string")return;const k=Ge(m.data),v=k.length;s.write(k,()=>ke(v));break}}}})(),()=>{e=!0,d&&clearTimeout(d),n&&n.disconnect();const p=S.current;if(p){p.onopen=null,p.onmessage=null,p.onclose=null,p.onerror=null;try{p.close()}catch{}S.current=null}const h=T.current;if(h){try{h.dispose()}catch{}T.current=null}j.current=null}},[u,f,a,y,L]);const se=i.useMemo(()=>a==="idle"?r("cliTerminal.replayIdle","Session idle"):a==="ended"?r("cliTerminal.replayEnded","Session ended"):null,[a,r]),we=i.useCallback(async()=>{if(E){Z(!0);try{await E("advance"),$(!0)}finally{Z(!1)}}},[E]),Se=i.useCallback(async()=>{E&&await E("not-yet"),$(!0)},[E]),F=!!o?.elevated,oe=o?.elevatedFlags?.join(", "),_e={"--terminal-glyph-font-family":V(A().fontFamily)};return t.jsxs("div",{className:`cli-session-terminal${g?" cli-session-terminal--mobile":""}${g&&z?" cli-session-terminal--keyboard-open":""}`,"data-mode":a,"data-read-only":ne,"data-mobile":g,"data-keyboard-open":g&&z,children:[t.jsxs("header",{className:"cli-session-terminal__header",children:[o&&t.jsxs("div",{className:"cli-session-terminal__posture-wrap",children:[t.jsxs("button",{type:"button",className:`cli-posture-chip${F?" cli-posture-chip--elevated":""}`,"data-elevated":F,"aria-expanded":H,onClick:()=>G(e=>!e),children:[F?t.jsx(ze,{size:13,"aria-hidden":"true"}):t.jsx(xe,{size:13,"aria-hidden":"true"}),t.jsx("span",{className:"cli-posture-chip__name",children:o.adapterName}),o.mode&&t.jsx("span",{className:"cli-posture-chip__mode",children:o.mode}),F&&oe&&t.jsx("span",{className:"cli-posture-chip__flag",children:oe})]}),H&&t.jsxs("div",{className:"cli-posture-tooltip",role:"tooltip",children:[t.jsx("p",{className:"cli-posture-tooltip__title",children:r("cliTerminal.postureResolved","Resolved posture")}),t.jsxs("ul",{className:"cli-posture-tooltip__list",children:[(o.resolved??[]).map((e,n)=>t.jsx("li",{children:e},n)),(o.resolved??[]).length===0&&t.jsx("li",{children:o.mode??r("cliTerminal.postureBaseline","Baseline")})]}),Y&&t.jsxs("button",{type:"button",className:"cli-posture-tooltip__settings",onClick:()=>{G(!1),Y()},children:[t.jsx(Ne,{size:12,"aria-hidden":"true"}),r("cliTerminal.adapterSettings","Adapter settings")]})]})]}),ne&&t.jsxs("span",{className:"cli-session-terminal__readonly-badge",children:[t.jsx(Re,{size:12,"aria-hidden":"true"}),r("cliTerminal.readOnly","Read-only")]}),se&&t.jsx("span",{className:"cli-session-terminal__replay-badge","data-replay-mode":a,children:se})]}),t.jsx("div",{className:"cli-session-terminal__viewport",ref:C,"data-testid":"cli-terminal-viewport",style:_e}),W&&!ue&&t.jsxs("div",{className:"cli-session-terminal__advance-strip",role:"region",children:[t.jsx("span",{className:"cli-session-terminal__advance-copy",children:r("cliTerminal.advancePrompt","This session looks idle — advance to review?")}),t.jsxs("div",{className:"cli-session-terminal__advance-actions",children:[t.jsx("button",{type:"button",className:"cli-session-terminal__advance-btn",disabled:q,onClick:we,children:r("cliTerminal.advance","Advance")}),t.jsx("button",{type:"button",className:"cli-session-terminal__advance-btn cli-session-terminal__advance-btn--secondary",disabled:q,onClick:Se,children:r("cliTerminal.notYet","Not yet")})]})]}),g&&D&&t.jsxs("div",{className:`cli-session-terminal__mobile-bar${z?" cli-session-terminal__mobile-bar--keyboard-open":""}`,"data-testid":"cli-terminal-mobile-bar",style:z?{bottom:`${me}px`}:void 0,children:[t.jsxs("div",{className:"cli-session-terminal__key-row","data-testid":"cli-terminal-key-bar",children:[t.jsx("button",{type:"button",className:`cli-terminal-key cli-terminal-key--ctrl${x?" cli-terminal-key--active":""}`,"data-testid":"cli-key-ctrl","aria-label":r("cliTerminal.mobileKeyCtrl","Sticky Ctrl modifier"),"aria-pressed":x,onPointerDown:l,onMouseDown:l,onClick:()=>M(e=>!e),children:K.ctrl}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-esc","aria-label":r("cliTerminal.mobileKeyEsc","Send Escape"),onPointerDown:l,onMouseDown:l,onClick:()=>N(Ie),children:K.escape}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-tab","aria-label":r("cliTerminal.mobileKeyTab","Send Tab"),onPointerDown:l,onMouseDown:l,onClick:()=>N(Ke),children:K.tab}),t.jsx("button",{type:"button",className:"cli-terminal-key cli-terminal-key--ctrlc","data-testid":"cli-key-ctrl-c","aria-label":r("cliTerminal.mobileKeyCtrlC","Send Ctrl-C"),onPointerDown:l,onMouseDown:l,onClick:()=>{M(!1),b(We)},children:K.ctrlC}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-up","aria-label":r("cliTerminal.mobileKeyArrowUp","Cursor up"),onPointerDown:l,onMouseDown:l,onClick:()=>N($e),children:"↑"}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-down","aria-label":r("cliTerminal.mobileKeyArrowDown","Cursor down"),onPointerDown:l,onMouseDown:l,onClick:()=>N(Ue),children:"↓"}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-left","aria-label":r("cliTerminal.mobileKeyArrowLeft","Cursor left"),onPointerDown:l,onMouseDown:l,onClick:()=>N(Ve),children:"←"}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-right","aria-label":r("cliTerminal.mobileKeyArrowRight","Cursor right"),onPointerDown:l,onMouseDown:l,onClick:()=>N(Qe),children:"→"}),pe.map(e=>t.jsx("button",{type:"button",className:"cli-terminal-key cli-terminal-key--custom","data-testid":`cli-terminal-custom-shortcut-${e.id}`,title:e.label,"aria-label":e.label,onPointerDown:l,onMouseDown:l,onClick:()=>{M(!1),b(Pe(e.value))},children:e.label},e.id))]}),t.jsxs("form",{className:"cli-session-terminal__input-row",onSubmit:be,children:[t.jsx("input",{ref:fe,type:"text",className:"cli-session-terminal__mobile-input","data-testid":"cli-terminal-mobile-input",value:_,placeholder:r("cliTerminal.mobileInputPlaceholder","Type to send to the session…"),autoCapitalize:"off",autoCorrect:"off",autoComplete:"off",spellCheck:!1,onChange:e=>he(e.target.value)}),t.jsx("button",{type:"submit",className:"cli-session-terminal__mobile-send","data-testid":"cli-terminal-mobile-send","aria-label":r("cliTerminal.mobileSend","Send"),onPointerDown:l,onMouseDown:l,children:r("cliTerminal.mobileSend","Send")})]})]})]})}export{at as SessionTerminal};
|