@xopcai/xopc 0.0.161 → 0.0.162
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/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-o7GRljfD.js → activity-store-hpcNv9MZ.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-9R3szLMc.js → agent-avatar-dicebear-Zf9UQEmQ.js} +1 -1
- package/dist/gateway/static/root/assets/agents-DfVkZlHc.js +2 -0
- package/dist/gateway/static/root/assets/{api-jSTqFMq9.js → api-Dnatri09.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-D81cyE76.js → app-management-settings-panel-BBTR9wJP.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-Ct6bZQCV.js → appearance-settings-C2zpLCHD.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-BMtAa4Ra.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-CfD7AZKn.js → archive-plugin-9eR_ODY1.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CP_Gaxt3.js → attachment-load-DPuWYUeX.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-BGKM_NDZ.js → automation-suggestion-card-Dw49OJRl.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-BiSAMYTr.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-IPr2EVnS.js → binary-plugins-BdkJpDFm.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-B6aHEGA6.js → block-editor-CAi7SXYU.js} +47 -47
- package/dist/gateway/static/root/assets/browser-settings-page-DHmaEJS2.js +8 -0
- package/dist/gateway/static/root/assets/browser-workflow-inputs-Dx6wkGz1.js +1 -0
- package/dist/gateway/static/root/assets/browser-workflows-page-Skertc-A.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-B5wSgf4f.js +2 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-CCX9-LjU.js → capability-presets-api-CNFl7dM3.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-DyvFZwBj.js +2 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-MmLMLDWf.js → channel-recipient-api-DYQyGDw4.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-BBKEqDZn.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-Drk110ve.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-BbjzIs87.js → connector-logo-Bng6kxYF.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-HpgaUDQ1.js +2 -0
- package/dist/gateway/static/root/assets/desktop-pet-Bpf6oegd.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DQLqGLc0.js → desktop-pet-settings-BVUyefSd.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-ClsiXhmz.js → directory-picker-path-field-DjSZAPz_.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-CjMPPdzg.js → dreaming-settings-CAZk2AM4.js} +3 -3
- package/dist/gateway/static/root/assets/{extension-debug-page-57eizjhB.js → extension-debug-page-C2F6vTTd.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CsbSb3u1.js → extension-page-AnIt4bn4.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DKA9-lyP.js → extension-settings-page-CLSc6682.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-DIPJuzBZ.js → gateway-config-api-DLFyZv33.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-CDLqAQY7.js → gateway-settings-DnQAA-qq.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DrfSJtvT.js → gateway-startup-retry-DbzLyJ3R.js} +1 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-DrnKFC6M.js +1 -0
- package/dist/gateway/static/root/assets/goal-detail-page-Cw1hpJkZ.js +4 -0
- package/dist/gateway/static/root/assets/{goals-config-api-lGC10UkU.js → goals-config-api-REmr3QCr.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-BDGkTVma.js +2 -0
- package/dist/gateway/static/root/assets/{goals-settings-BWq0pdrA.js → goals-settings-Dz0F3uRO.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-D4o8BJVv.js → heartbeat-settings-CQFY5gYs.js} +1 -1
- package/dist/gateway/static/root/assets/index-C8JkTS6d.js +199 -0
- package/dist/gateway/static/root/assets/index-hmrG55qg.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-6T2QYehS.js → keyboard-shortcuts-settings-BnOQXU5k.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-Bdef1b7F.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-DCjg2K9f.js → local-apps-page-KsOtWOyM.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-Dar-xqQr.js → locale-store-0lpYdNDr.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-CyYCBqym.js → logs-page-CwLPgrWh.js} +3 -3
- package/dist/gateway/static/root/assets/{markdown-split-rt1XO43g.js → markdown-split-D5GRg10r.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Bwo8CJuh.js → media-plugins-C1ryULGs.js} +1 -1
- package/dist/gateway/static/root/assets/messages-BwQ3WssU.js +5 -0
- package/dist/gateway/static/root/assets/{notes-page-Dp-pkX7d.js → notes-page-CIeZ1_DT.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-Cf06q19x.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-CzZ4iKOb.js → page-tabs-Caj1-E_X.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-3E_Qa-58.js → preview-open-alternatives-DKwEce-9.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-B2T48Sbt.js → product-open-page-B90ZskkN.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-SHTurM4t.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-BcC2qUAw.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-6vGefBHv.js +1 -0
- package/dist/gateway/static/root/assets/save-bar-controls-BDYt53uQ.js +1 -0
- package/dist/gateway/static/root/assets/{schedule-field-TkqUL3wm.js → schedule-field-Bcdni4Pj.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-DC-iU5IG.js → schema-form-D7oCARF7.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-C5014a53.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-CDY3ZI1K.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-Dpqth3oA.js → settings-collapsible-section-6eNF8Jey.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-CNqF6IwY.js → settings-form-section-CARTHCxH.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-DkvwitK_.js → settings-loading-skeleton-DEwYqESe.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-B6vVdHeQ.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-layout-DWvNgISx.js → settings-page-layout-D3srt5Bi.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-z-rF0Hdg.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-DGpSPW-n.js → share-preview-page-Ck9SxiXw.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-CHZFXE_d.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-B7p2QNXt.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-ncw3tX9P.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-8TxxSbUw.js → system-settings-panel-DLBUQSk2.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-B5FzMWOx.js → theme-store-C1oaqeD2.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-DEGtSA5h.js → typed-models-lib-Divbg_C4.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-BDU6FneG.js → use-channel-catalog-CP9a_rAf.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-iYfeSLKI.js +1 -0
- package/dist/gateway/static/root/assets/voice-api-key-field-CrwkicvT.js +1 -0
- package/dist/gateway/static/root/assets/work-discovery-page-BQWxyPg8.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-50ZzGay5.js +1 -0
- package/dist/gateway/static/root/assets/work-page-DPqEahx7.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Cwi8Pz7n.js → workflow-run-setup-panel-DbDPYQwB.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-C3eIC5HZ.js +11 -0
- package/dist/gateway/static/root/index.html +7 -7
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.d.ts +1 -0
- package/dist/src/agent/agent-manager.js +1 -0
- package/dist/src/agent/client-error-format.js +3 -3
- package/dist/src/agent/outcomes/task-evaluation.d.ts +20 -0
- package/dist/src/agent/outcomes/task-evaluation.js +48 -0
- package/dist/src/agent/outcomes/task-verifier.d.ts +29 -0
- package/dist/src/agent/outcomes/task-verifier.js +71 -0
- package/dist/src/agent/prompt/memory/index.js +1 -1
- package/dist/src/agent/prompt/service-prompt-builder.js +32 -1
- package/dist/src/agent/service.js +1 -0
- package/dist/src/agent/service.types.d.ts +1 -0
- package/dist/src/agent/tools/browser/tool/browser-use-tool.d.ts +1 -7
- package/dist/src/agent/tools/browser/tool/browser-use-tool.js +2 -73
- package/dist/src/agent/tools/browser/tool/schemas.d.ts +1 -13
- package/dist/src/agent/tools/browser/tool/schemas.js +1 -9
- package/dist/src/agent/tools/browser-recipe-tool.d.ts +12 -0
- package/dist/src/agent/tools/browser-recipe-tool.js +113 -0
- package/dist/src/agent/tools/factory.d.ts +2 -0
- package/dist/src/agent/tools/factory.js +2 -0
- package/dist/src/agent/tools/index.d.ts +1 -0
- package/dist/src/agent/tools/index.js +2 -1
- package/dist/src/automations/domain/types.d.ts +13 -0
- package/dist/src/automations/domain/validation.d.ts +44 -24
- package/dist/src/automations/domain/validation.js +27 -18
- package/dist/src/automations/draft/automation-draft-validator.d.ts +6 -1
- package/dist/src/automations/draft/automation-draft-validator.js +1 -0
- package/dist/src/automations/service/action-executor.d.ts +1 -0
- package/dist/src/automations/service/action-executor.js +22 -0
- package/dist/src/browser/index.d.ts +0 -1
- package/dist/src/browser/index.js +1 -2
- package/dist/src/browser/pipeline/runner.d.ts +9 -2
- package/dist/src/browser/pipeline/runner.js +151 -105
- package/dist/src/browser/pipeline/schema.d.ts +21 -15
- package/dist/src/browser/pipeline/schema.js +93 -99
- package/dist/src/browser/recipes/index.d.ts +3 -0
- package/dist/src/browser/recipes/index.js +3 -0
- package/dist/src/browser/recipes/repository.d.ts +13 -0
- package/dist/src/browser/recipes/repository.js +81 -0
- package/dist/src/browser/recipes/runtime-service.d.ts +6 -0
- package/dist/src/browser/recipes/runtime-service.js +30 -0
- package/dist/src/browser/recipes/service.d.ts +36 -0
- package/dist/src/browser/recipes/service.js +186 -0
- package/dist/src/browser/recipes/types.d.ts +36 -0
- package/dist/src/browser/recipes/types.js +1 -0
- package/dist/src/cli/commands/browser-cli-helpers.js +6 -12
- package/dist/src/cli/commands/browser.js +4 -3
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/schema.d.ts +3 -3
- package/dist/src/config/schema.js +21 -21
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +1 -1
- package/dist/src/gateway/hono/routes/browser-workflows.d.ts +3 -0
- package/dist/src/gateway/hono/routes/browser-workflows.js +78 -0
- package/dist/src/gateway/hono/routes/home.js +1 -0
- package/dist/src/gateway/hono/routes/index.js +4 -0
- package/dist/src/gateway/hono/routes/interaction-state.d.ts +3 -0
- package/dist/src/gateway/hono/routes/interaction-state.js +45 -0
- package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
- package/dist/src/gateway/hono/routes/memory.js +33 -4
- package/dist/src/gateway/hono/routes/task-outcomes.d.ts +3 -0
- package/dist/src/gateway/hono/routes/task-outcomes.js +109 -0
- package/dist/src/gateway/hono/routes/you.d.ts +10 -2
- package/dist/src/gateway/hono/routes/you.js +184 -28
- package/dist/src/gateway/service/run-gateway-agent.js +84 -0
- package/dist/src/gateway/service.d.ts +3 -0
- package/dist/src/gateway/service.js +14 -0
- package/dist/src/proactive/insight-repository.d.ts +2 -0
- package/dist/src/proactive/insight-repository.js +5 -2
- package/dist/src/proactive/run-processor.js +22 -1
- package/dist/src/proactive/types.d.ts +2 -0
- package/dist/src/proactive/value-score.d.ts +13 -0
- package/dist/src/proactive/value-score.js +30 -0
- package/dist/src/share/share-types.js +5 -5
- package/dist/src/share/site-share-types.d.ts +1 -1
- package/dist/src/share/site-share-types.js +5 -5
- package/dist/src/storage/sqlite/index.d.ts +3 -0
- package/dist/src/storage/sqlite/index.js +4 -1
- package/dist/src/storage/sqlite/interaction-state-repository.d.ts +17 -0
- package/dist/src/storage/sqlite/interaction-state-repository.js +60 -0
- package/dist/src/storage/sqlite/memory-records-repository.js +1 -1
- package/dist/src/storage/sqlite/migrations/053_browser_recipes.sql +45 -0
- package/dist/src/storage/sqlite/migrations/054_task_outcomes.sql +24 -0
- package/dist/src/storage/sqlite/migrations/055_relationship_settings.sql +14 -0
- package/dist/src/storage/sqlite/migrations/056_task_verification.sql +6 -0
- package/dist/src/storage/sqlite/migrations/057_interaction_states.sql +11 -0
- package/dist/src/storage/sqlite/migrations/058_proactive_value.sql +3 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/relationship-settings-repository.d.ts +17 -0
- package/dist/src/storage/sqlite/relationship-settings-repository.js +64 -0
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/schema.sql +46 -0
- package/dist/src/storage/sqlite/task-outcome-repository.d.ts +90 -0
- package/dist/src/storage/sqlite/task-outcome-repository.js +138 -0
- package/dist/src/user-context/interaction-state.d.ts +13 -0
- package/dist/src/user-context/interaction-state.js +69 -0
- package/dist/src/user-context/memory-use-audit.d.ts +10 -0
- package/dist/src/user-context/memory-use-audit.js +25 -0
- package/dist/src/user-context/personal-playbook.d.ts +11 -0
- package/dist/src/user-context/personal-playbook.js +41 -0
- package/dist/src/user-context/projection.d.ts +4 -0
- package/dist/src/user-context/projection.js +5 -1
- package/dist/src/user-context/relationship-continuity.d.ts +14 -0
- package/dist/src/user-context/relationship-continuity.js +51 -0
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/action-boundary-settings-panel-BIVBUiNT.js +0 -1
- package/dist/gateway/static/root/assets/agents-_qbUaYbs.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-0sPqD0FK.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-BxWBuBsE.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-C499b9AH.js +0 -8
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-Dva9SiPK.js +0 -2
- package/dist/gateway/static/root/assets/channels-settings-DNAU7u9o.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-CIOH7tgn.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-TwiBp8vY.js +0 -2
- package/dist/gateway/static/root/assets/desktop-pet-CYH5ZSXy.js +0 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-Q3B0E-0s.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-C5VAK04G.js +0 -4
- package/dist/gateway/static/root/assets/goals-page-BJb-5IYw.js +0 -2
- package/dist/gateway/static/root/assets/index-CkUHH170.css +0 -1
- package/dist/gateway/static/root/assets/index-vq_cJZJC.js +0 -199
- package/dist/gateway/static/root/assets/local-app-workbench-page-euH17Kvb.js +0 -2
- package/dist/gateway/static/root/assets/messages-CxySDn9d.js +0 -5
- package/dist/gateway/static/root/assets/models-hub-panel-DObxxjc9.js +0 -2
- package/dist/gateway/static/root/assets/notes-workbench-CCb4RXcZ.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-BvEcriRC.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-B_e79MRJ.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-DGcqnYfR.js +0 -1
- package/dist/gateway/static/root/assets/save-bar-controls-CkeKasGm.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-DQZhrDJ8.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BkdeN99Y.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-qPG7I2zd.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-lwRAh9aw.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BGj9IVUr.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-B2UBAs5U.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-DdjzFZ8I.js +0 -2
- package/dist/gateway/static/root/assets/user-context-page-BTTZpAGV.js +0 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-DuDQd-WU.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-BUVkVCsW.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-DeEPPu4n.js +0 -1
- package/dist/gateway/static/root/assets/work-page-DQNUyTUq.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-BIy4wrzO.js +0 -11
- package/dist/src/browser/pipeline/source.d.ts +0 -9
- package/dist/src/browser/pipeline/source.js +0 -77
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{d as r,l as i}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./messages-CxySDn9d.js";import{n as ee}from"./locale-store-Dar-xqQr.js";import{At as te,Co as ne,Cs as re,Do as ie,Fo as s,Io as ae,Kc as c,Lo as l,Mo as oe,No as se,Oo as u,Pl as ce,Po as le,Pt as ue,So as de,Ss as d,Tl as f,To as fe,Ts as p,Xa as m,au as pe,jo as me,kl as he,ko as ge,nc as h,ql as _e,su as ve,wo as ye,xl as be,xo as g}from"./index-vq_cJZJC.js";var _=e(t(),1),v=new Set([`completed`,`failed`,`canceled`]);function y(){return new Promise(e=>window.setTimeout(e,1200))}async function xe(e,t){let n=[],r=t.wait??y;for(let i=0;i<e.length&&!t.shouldStop?.();i+=1){let a=e[i];if(a)try{await t.grantDirectory(a.rootPath);let o=await t.startRun(a.rootPath);for(t.onRun(o,i,e.length);!v.has(o.status)&&!t.shouldStop?.();)await r(),o=await t.fetchRun(o.id),t.onRun(o,i,e.length);if(n.push(o),o.status===`canceled`||t.shouldStop?.())break}catch(e){if(t.onError?.(e,a,i),t.shouldStop?.())break}}return n}var b=n(),Se=[`folder_structure`,`recent_progress`,`next_steps`];function x(e){return e instanceof Error?e.message:String(e)}function S(){let e=ee(e=>e.language),t=o(e).onboarding.workDiscovery,n=o(e).chat.workingDirectory,v=i(),[y]=r(),S=y.get(`new`)===`1`,[C,w]=(0,_.useState)(`loading`),[T,E]=(0,_.useState)(null),[D,O]=(0,_.useState)(null),[k,A]=(0,_.useState)(!1),[j,M]=(0,_.useState)(null),[Ce,N]=(0,_.useState)(!1),[P,F]=(0,_.useState)(``),[I,L]=(0,_.useState)(!1),[R,z]=(0,_.useState)(()=>new Set),[B,we]=(0,_.useState)(!1),[V,Te]=(0,_.useState)([]),[H,Ee]=(0,_.useState)(()=>new Set),[De,U]=(0,_.useState)([]),[Oe,ke]=(0,_.useState)(!1),[W,G]=(0,_.useState)({current:0,total:0}),K=(0,_.useRef)(!1),q=(0,_.useCallback)(e=>{g.getState().updateDirectoryRun(e),O(e),e.status===`completed`?(z(new Set(e.result?.profileCandidates?.filter(e=>e.status===`pending`).map(e=>e.id)??[])),w(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`)):e.status===`failed`||e.status===`canceled`?w(`error`):w(`running`)},[]),Ae=async()=>{A(!0),M(null);try{let e=await ye();if(!e.length){M(t.noCandidates);return}Te(e),Ee(new Set([e[0].rootPath])),w(`candidates`)}catch(e){M(x(e))}finally{A(!1)}},je=e=>{Ee(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Me=(0,_.useCallback)((e,t,n)=>{g.getState().updateDirectoryRun(e),O(e),G({current:t+1,total:n}),U(n=>{let r=[...n];return r[t]=e,r}),w(`running`)},[]),Ne=(0,_.useCallback)(e=>{U(t=>t.map(t=>t?.id===e.id?e:t))},[]),Pe=async()=>{let e=V.filter(e=>H.has(e.rootPath));if(!e.length)return;A(!0),M(null),U([]),G({current:1,total:e.length}),ke(!0),K.current=!1;let n=!1;try{let r=await xe(e,{grantDirectory:ge,startRun:le,fetchRun:u,shouldStop:()=>K.current,onRun:(e,t,r)=>{Me(e,t,r),n||(n=!0,g.getState().scanPersonalContext(e.id))},onError:(n,r,i)=>{G({current:i+1,total:e.length}),M(t.folderAnalysisFailed.replace(`{{folder}}`,r.displayName).replace(`{{error}}`,x(n)))}});if(K.current)return;let i=r.find(e=>e.status===`completed`)??r.at(-1);i?q(i):w(`candidates`)}catch(e){M(x(e)),w(`candidates`)}finally{ke(!1),A(!1)}},J=ue({onPicked:(0,_.useCallback)(async e=>{A(!0),M(null);try{E(await me(e)),w(`consent`)}catch(e){M(x(e)),w(`intro`)}finally{A(!1)}},[])});(0,_.useEffect)(()=>{let e=!1;return ie().then(async({enabled:t,state:n})=>{if(!e){if(!t){v(`/chat`,{replace:!0});return}if(!S&&n.activeRunId)try{let t=await u(n.activeRunId);e||q(t);return}catch{}e||w(`intro`)}}).catch(t=>{e||(M(x(t)),w(`intro`))}),()=>{e=!0}},[q,v,S]),(0,_.useEffect)(()=>{if(!D||C!==`running`||Oe)return;let e=!1,t=async()=>{try{let t=await u(D.id);e||q(t)}catch{}},n=window.setInterval(()=>void t(),1200),r=e=>{let n=e.detail;(!n?.runId||n.runId===D.id)&&t()};for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.addEventListener(e,r);return()=>{e=!0,window.clearInterval(n);for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.removeEventListener(e,r)}},[q,Oe,C,D]);let Fe=async()=>{A(!0);try{await fe()}finally{v(`/chat`,{replace:!0})}},Ie=async()=>{if(T){A(!0),M(null),U([]),G({current:0,total:0});try{await ge(T.canonicalRootPath);let e=await le(T.canonicalRootPath);q(e),g.getState().scanPersonalContext(e.id)}catch(e){M(x(e)),w(`consent`)}finally{A(!1)}}},Y=(e,t)=>{let n=t?`?draft=${encodeURIComponent(t)}`:``;v(`/chat/${encodeURIComponent(e)}${n}`)},Le=e=>{O(e),we(!1),N(!1),L(!1),z(new Set(e.result?.profileCandidates?.filter(e=>e.status===`pending`).map(e=>e.id)??[])),e.status===`completed`?w(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`):e.status===`failed`||e.status===`canceled`?w(`error`):w(`running`)},Re=async()=>{D&&(K.current=!0,q(await ne(D.id)))},X=async(t,n)=>{if(!D)return;await se(D.id,t.id).catch(()=>{});let r=n?`${e===`zh`?`先帮我评估这个方向,不要修改文件:`:`First assess this direction without changing files:`}\n\n${t.actionPrompt}`:t.actionPrompt;Y(D.sessionKey,r)},ze=async()=>{if(D){A(!0),M(null);try{let e=D.result?.profileCandidates??[],t=e.length>0?await ae(D.id,e.map(e=>({id:e.id,status:R.has(e.id)?`accepted`:`rejected`}))):D;await Promise.all((t.result?.workThreads??[]).filter(e=>e.userStatus===`unreviewed`).map(e=>l(e.id,{decision:`confirmed`})));let n=await s(t.id,`confirmed`);O(n),Ne(n),w(`recommendation`)}catch(e){M(x(e))}finally{A(!1)}}},Z=async e=>{if(!(!D||!P.trim())){A(!0),M(null);try{let t=D.result?.workThreads?.find(e=>e.horizon===`current`)??D.result?.workThreads?.[0];t&&await l(t.id,{decision:`corrected`,correctedSummary:P.trim()});let n=await s(D.id,e,P.trim());O(n),Y(n.sessionKey,P.trim())}catch(e){M(x(e)),A(!1)}}},Be=async()=>{if(D){A(!0);try{Y((await s(D.id,`dismissed`)).sessionKey)}catch(e){M(x(e)),A(!1)}}},Ve=async()=>{let e=D?.result?.workThreads?.find(e=>e.horizon===`current`)??D?.result?.workThreads?.[0];if(e){A(!0),M(null);try{await de(e.id),we(!0)}catch(e){M(x(e))}finally{A(!1)}}},Q=D?.result?.suggestions.find(e=>e.id===D.result?.primarySuggestionId)??D?.result?.suggestions[0],He=D?.result?.suggestions.filter(e=>e.id!==Q?.id)??[],Ue=e=>e===`command`?t.riskCommand:e===`file_write`?t.riskFileWrite:t.riskAnalysis,We=De.filter(e=>e?.status===`completed`),$=We.length>1?(0,b.jsxs)(`div`,{className:`mt-6 rounded-xl border border-edge bg-surface-panel p-2`,children:[(0,b.jsx)(`p`,{className:`px-2 pb-2 text-xs font-medium text-fg-muted`,children:t.analysisResults}),(0,b.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:We.map(e=>{let t=V.find(t=>t.rootPath===e.rootPath)?.displayName??e.rootPath.split(/[\\/]/).filter(Boolean).at(-1)??e.rootPath;return(0,b.jsx)(`button`,{type:`button`,className:`rounded-lg px-3 py-2 text-sm font-medium transition ${e.id===D?.id?`bg-accent text-white`:`bg-surface-muted text-fg hover:bg-surface-hover`}`,onClick:()=>Le(e),children:t},e.id)})})]}):null;return(0,b.jsxs)(`div`,{className:`flex min-h-full flex-1 flex-col bg-surface-base`,children:[(0,b.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[40rem] flex-1 flex-col px-5 py-10 sm:px-8 sm:py-16`,children:[(0,b.jsx)(`div`,{className:`mb-10 flex items-center justify-center`,children:(0,b.jsx)(re,{className:`size-11`})}),C===`loading`?(0,b.jsxs)(`div`,{className:`space-y-5`,"aria-busy":!0,children:[(0,b.jsx)(m,{className:`mx-auto h-8 w-64`}),(0,b.jsx)(m,{className:`mx-auto h-4 w-full max-w-lg`}),(0,b.jsx)(m,{className:`mx-auto size-4/5 max-w-md`}),(0,b.jsx)(m,{className:`mt-8 h-12 w-full rounded-xl`})]}):null,C===`intro`?(0,b.jsxs)(`section`,{className:`flex flex-1 flex-col text-center`,"aria-labelledby":`work-discovery-title`,children:[(0,b.jsxs)(`div`,{className:`mx-auto max-w-[36rem]`,children:[(0,b.jsx)(`h1`,{id:`work-discovery-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:t.title}),(0,b.jsx)(`p`,{className:`mx-auto mt-3 max-w-[34rem] text-[0.95rem] leading-7 text-fg-muted`,children:t.subtitle})]}),(0,b.jsxs)(`div`,{className:`mx-auto mt-9 w-full max-w-md`,children:[(0,b.jsxs)(d,{type:`button`,className:`h-12 w-full gap-2 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void Ae(),disabled:k||J.picking,children:[k?(0,b.jsx)(c,{className:`size-4 animate-spin`}):(0,b.jsx)(h,{className:`size-4`}),t.quickScan]}),(0,b.jsxs)(d,{type:`button`,variant:`secondary`,className:`mt-3 h-11 w-full gap-2`,onClick:J.pick,disabled:k||J.picking,children:[J.picking?(0,b.jsx)(c,{className:`size-4 animate-spin`}):(0,b.jsx)(f,{className:`size-4`}),t.chooseFolderManually]}),(0,b.jsxs)(`div`,{className:`mt-4 flex items-start justify-center gap-2 text-xs leading-5 text-fg-muted`,children:[(0,b.jsx)(h,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,b.jsx)(`span`,{children:t.quickScanNote})]}),j?(0,b.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:j}):null]}),(0,b.jsx)(`button`,{type:`button`,className:`mx-auto mt-auto pt-10 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void Fe(),disabled:k,children:t.skip})]}):null,C===`candidates`?(0,b.jsxs)(`section`,{"aria-labelledby":`work-discovery-candidates-title`,children:[(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`h1`,{id:`work-discovery-candidates-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:t.candidatesTitle}),(0,b.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:t.candidatesSubtitle})]}),(0,b.jsx)(`div`,{className:`mt-7 space-y-2`,children:V.map((e,n)=>{let r=H.has(e.rootPath);return(0,b.jsxs)(`button`,{type:`button`,"aria-pressed":r,className:`flex w-full items-start gap-3 rounded-xl border p-4 text-left transition ${r?`border-accent bg-accent-soft/45`:`border-edge bg-surface-panel hover:border-edge-strong`}`,onClick:()=>je(e.rootPath),children:[(0,b.jsx)(`span`,{className:`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-md border ${r?`border-accent bg-accent text-white`:`border-edge bg-surface-base text-transparent`}`,children:(0,b.jsx)(a,{className:`size-3.5`})}),(0,b.jsx)(f,{className:`mt-0.5 size-5 shrink-0 text-accent-fg`}),(0,b.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,b.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),n===0?(0,b.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[0.7rem] font-medium text-accent-fg`,children:t.recommendedCandidate}):null]}),(0,b.jsx)(`span`,{className:`mt-1 block truncate font-mono text-xs text-fg-muted`,children:e.rootPath}),(0,b.jsxs)(`span`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,b.jsx)(`span`,{children:e.projectKind===`coding`?t.codingProject:e.projectKind===`general`?t.generalProject:t.unknownProject}),e.branch?(0,b.jsx)(`span`,{children:t.branchValue.replace(`{{branch}}`,e.branch)}):null,e.changedFileCount>0?(0,b.jsx)(`span`,{children:t.changedFiles.replace(`{{count}}`,String(e.changedFileCount))}):null]})]})]},e.id)})}),(0,b.jsxs)(`div`,{className:`mt-5 flex items-start gap-2 rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3 text-xs leading-5 text-fg-muted`,children:[(0,b.jsx)(h,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,b.jsx)(`span`,{children:t.multiFolderPrivacyNote})]}),j?(0,b.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:j}):null,(0,b.jsxs)(`div`,{className:`mt-7 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,b.jsxs)(d,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:k||H.size===0,onClick:()=>void Pe(),children:[k?(0,b.jsx)(c,{className:`mr-2 size-4 animate-spin`}):null,t.analyzeSelected.replace(`{{count}}`,String(H.size))]}),(0,b.jsx)(d,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:k,onClick:J.pick,children:t.chooseFolderManually})]}),(0,b.jsx)(`button`,{type:`button`,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>w(`intro`),children:t.back})]}):null,C===`consent`&&T?(0,b.jsxs)(`section`,{"aria-labelledby":`work-discovery-consent-title`,children:[(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`h1`,{id:`work-discovery-consent-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:t.selectedTitle}),(0,b.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:t.selectedSubtitle})]}),(0,b.jsxs)(`div`,{className:`mt-8 overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge-subtle px-4 py-3.5`,children:[(0,b.jsx)(f,{className:`size-5 shrink-0 text-accent-fg`}),(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:T.displayName}),(0,b.jsx)(`p`,{className:`truncate font-mono text-xs text-fg-muted`,children:T.canonicalRootPath})]}),(0,b.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:T.projectKind===`coding`?t.codingProject:T.projectKind===`general`?t.generalProject:t.unknownProject})]}),(0,b.jsxs)(`div`,{className:`grid gap-3 border-b border-edge-subtle bg-surface-base/60 p-4 sm:grid-cols-2`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:t.localFingerprint}),(0,b.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:T.fingerprint.branch?t.branchValue.replace(`{{branch}}`,T.fingerprint.branch):t.noGitBranch})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:t.recentActivity}),(0,b.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:t.changedFiles.replace(`{{count}}`,String(T.fingerprint.changedFileCount))})]}),T.fingerprint.recentAreas.length>0?(0,b.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:t.recentAreas}),(0,b.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:T.fingerprint.recentAreas.map(e=>(0,b.jsx)(`code`,{className:`rounded-md bg-surface-muted px-2 py-1 text-xs text-fg`,children:e},e))})]}):null]}),(0,b.jsxs)(`div`,{className:`divide-y divide-edge-subtle px-4`,children:[(0,b.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,b.jsx)(he,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.willRead}),(0,b.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.willReadValue})]})]}),(0,b.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,b.jsx)(p,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.willIgnore}),(0,b.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.willIgnoreValue})]})]}),(0,b.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,b.jsx)(h,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,b.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:T.remoteModel?t.providerDisclosure.replace(`{{provider}}`,T.provider):t.localDisclosure})]})]})]}),j?(0,b.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:j}):null,(0,b.jsxs)(`div`,{className:`mt-7 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,b.jsxs)(d,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:k,onClick:()=>void Ie(),children:[k?(0,b.jsx)(c,{className:`mr-2 size-4 animate-spin`}):null,t.startAnalysis]}),(0,b.jsx)(d,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:k,onClick:J.pick,children:t.changeFolder})]}),(0,b.jsx)(`button`,{type:`button`,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void Fe(),children:t.skip})]}):null,C===`running`&&D?(0,b.jsxs)(`section`,{"aria-labelledby":`work-discovery-running-title`,"aria-live":`polite`,children:[(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`h1`,{id:`work-discovery-running-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:t.analyzingTitle}),(0,b.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:t.analyzingSubtitle}),W.total>1?(0,b.jsx)(`p`,{className:`mt-2 text-sm font-medium text-accent-fg`,children:t.analyzingFolderProgress.replace(`{{current}}`,String(W.current)).replace(`{{total}}`,String(W.total))}):null]}),(0,b.jsx)(`div`,{className:`mt-9 rounded-xl border border-edge bg-surface-panel px-5 py-2`,children:Se.map((e,n)=>{let r=Math.max(0,Se.indexOf(D.stage??`folder_structure`)),i=n<r,o=n===r;return(0,b.jsxs)(`div`,{className:`flex items-center gap-4 border-b border-edge-subtle py-4 last:border-b-0`,children:[(0,b.jsx)(`span`,{className:`flex size-7 items-center justify-center rounded-full ${i?`bg-accent text-white`:o?`bg-accent-soft text-accent-fg`:`bg-surface-muted text-fg-subtle`}`,children:i?(0,b.jsx)(a,{className:`size-4`}):o?(0,b.jsx)(c,{className:`size-4 animate-spin motion-reduce:animate-none`}):(0,b.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`})}),(0,b.jsx)(`span`,{className:o||i?`text-sm font-medium text-fg`:`text-sm text-fg-muted`,children:t.stages[e]})]},e)})}),(0,b.jsx)(`p`,{className:`mt-4 truncate text-center font-mono text-xs text-fg-muted`,children:D.rootPath}),(0,b.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3`,children:[(0,b.jsx)(d,{type:`button`,variant:`secondary`,className:`h-11 w-full`,onClick:()=>v(`/chat`),children:t.continueInBackground}),(0,b.jsx)(`button`,{type:`button`,className:`mx-auto text-sm text-fg-muted hover:text-danger hover:underline`,onClick:()=>void Re(),children:t.cancelAnalysis})]})]}):null,C===`recognition`&&D?.result?(0,b.jsxs)(`section`,{"aria-labelledby":`work-discovery-recognition-title`,children:[(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:t.recognitionEyebrow}),(0,b.jsx)(`h1`,{id:`work-discovery-recognition-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:D.result.lowConfidence?t.lowConfidenceTitle:t.recognitionTitle})]}),$,(0,b.jsxs)(`div`,{className:`mt-7 rounded-2xl border border-accent/25 bg-gradient-to-br from-accent-soft/45 via-surface-panel to-surface-panel p-5 sm:p-6`,children:[(0,b.jsx)(`p`,{className:`text-base font-medium leading-7 text-fg`,children:D.result.projectSummary}),(0,b.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:D.result.currentState}),!D.result.lowConfidence&&Q?.evidence.length?(0,b.jsx)(`ul`,{className:`mt-5 space-y-2 border-t border-edge-subtle pt-4`,children:Q.evidence.slice(0,3).map((e,t)=>(0,b.jsxs)(`li`,{className:`flex gap-2 text-xs leading-5 text-fg-muted`,children:[(0,b.jsx)(be,{className:`mt-0.5 size-3.5 shrink-0 text-accent-fg`}),(0,b.jsxs)(`span`,{children:[e.path?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`code`,{className:`font-mono text-fg`,children:e.path}),`: `]}):null,e.observation]})]},`${Q.id}-recognition-${t}`))}):null]}),D.result.workThreads?.length?(0,b.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.workThreadsTitle}),(0,b.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.workThreadsSubtitle}),(0,b.jsx)(`div`,{className:`mt-3 divide-y divide-edge-subtle`,children:D.result.workThreads.map(e=>(0,b.jsxs)(`div`,{className:`py-3 first:pt-0 last:pb-0`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[0.7rem] font-medium text-accent-fg`,children:e.horizon===`current`?t.workThreadCurrent:e.horizon===`ongoing`?t.workThreadOngoing:t.workThreadLongTerm}),(0,b.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.title})]}),(0,b.jsx)(`p`,{className:`mt-1.5 text-xs leading-5 text-fg-muted`,children:e.summary})]},e.id))})]}):null,D.result.profileCandidates?.length?(0,b.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.profileCandidatesTitle}),(0,b.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.profileCandidatesSubtitle}),(0,b.jsx)(`div`,{className:`mt-3 space-y-2`,children:D.result.profileCandidates.map(e=>(0,b.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg px-2 py-2 hover:bg-surface-muted`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 rounded border-edge accent-accent`,checked:R.has(e.id),onChange:()=>z(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n})}),(0,b.jsx)(`span`,{className:`text-sm leading-5 text-fg`,children:e.statement})]},e.id))})]}):null,D.result.lowConfidence?(0,b.jsxs)(`div`,{className:`mt-5`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium leading-6 text-fg`,children:D.result.contextQuestion}),(0,b.jsx)(`textarea`,{value:P,onChange:e=>F(e.target.value),placeholder:t.correctionPlaceholder,className:`mt-3 min-h-24 w-full resize-y rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/15`}),(0,b.jsx)(d,{className:`mt-3 w-full bg-accent text-white hover:bg-accent-hover`,disabled:k||!P.trim(),onClick:()=>void Z(`different_goal`),children:t.continueWithCorrection})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`mt-6 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,b.jsxs)(d,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:k,onClick:()=>void ze(),children:[k?(0,b.jsx)(c,{className:`size-4 animate-spin`}):(0,b.jsx)(a,{className:`size-4`}),t.confirmUnderstanding]}),(0,b.jsx)(d,{variant:`secondary`,className:`h-11 flex-1`,disabled:k,onClick:()=>N(e=>!e),children:t.notQuiteRight})]}),Ce?(0,b.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,b.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`work-discovery-correction`,children:t.correctionLabel}),(0,b.jsx)(`textarea`,{id:`work-discovery-correction`,value:P,onChange:e=>F(e.target.value),placeholder:t.correctionPlaceholder,className:`mt-2 min-h-24 w-full resize-y rounded-lg border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/15`}),(0,b.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[(0,b.jsx)(d,{variant:`ghost`,disabled:k||!P.trim(),onClick:()=>void Z(`different_goal`),children:t.differentGoal}),(0,b.jsx)(d,{variant:`primary`,disabled:k||!P.trim(),onClick:()=>void Z(`corrected`),children:t.useCorrection})]})]}):null]}),j?(0,b.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:j}):null,(0,b.jsx)(`button`,{type:`button`,disabled:k,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline disabled:opacity-60`,onClick:()=>void Be(),children:t.openConversation})]}):null,C===`recommendation`&&D?.result&&Q?(0,b.jsxs)(`section`,{"aria-labelledby":`work-discovery-recommendation-title`,children:[(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:t.understandingConfirmed}),(0,b.jsx)(`h1`,{id:`work-discovery-recommendation-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:t.primaryRecommendationTitle})]}),$,(0,b.jsx)(`article`,{className:`mt-7 rounded-2xl border border-accent/30 bg-surface-panel p-5 sm:p-6`,children:(0,b.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,b.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,b.jsx)(pe,{className:`size-5`})}),(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:Q.title}),(0,b.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:Q.rationale}),(0,b.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2 text-xs`,children:[(0,b.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-surface-muted px-2.5 py-1 text-fg-muted`,children:[(0,b.jsx)(_e,{className:`size-3.5`}),t.estimatedMinutes.replace(`{{count}}`,String(Q.estimatedMinutes))]}),(0,b.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2.5 py-1 text-fg-muted`,children:Ue(Q.risk)})]}),(0,b.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-base px-4 py-3`,children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:t.expectedOutcome}),(0,b.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg`,children:Q.expectedOutcome})]}),(0,b.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[(0,b.jsx)(d,{className:`h-10 bg-accent px-4 text-white hover:bg-accent-hover`,onClick:()=>void X(Q,!1),children:t.startRecommendedAction}),(0,b.jsx)(d,{className:`h-10 px-4`,variant:`secondary`,onClick:()=>void X(Q,!0),children:t.explainFirst})]})]})]})}),D.result.workThreads?.length?(0,b.jsx)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:(0,b.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,b.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:B?(0,b.jsx)(a,{className:`size-4`}):(0,b.jsx)(ce,{className:`size-4`})}),(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:B?t.focusTrialActive:t.focusTrialTitle}),(0,b.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:B?t.focusTrialActiveDescription:t.focusTrialDescription}),B?null:(0,b.jsxs)(d,{className:`mt-3 h-9`,variant:`secondary`,disabled:k,onClick:()=>void Ve(),children:[k?(0,b.jsx)(c,{className:`size-4 animate-spin`}):(0,b.jsx)(ce,{className:`size-4`}),t.activateFocusTrial]})]})]})}):null,He.length>0?(0,b.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,b.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between py-2 text-sm font-medium text-fg-muted hover:text-fg`,onClick:()=>L(e=>!e),children:[t.otherDirections,(0,b.jsx)(ve,{className:`size-4 transition-transform ${I?`rotate-180`:``}`})]}),I?(0,b.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle rounded-xl border border-edge bg-surface-panel px-4`,children:He.map(e=>(0,b.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 py-4 text-left`,onClick:()=>void X(e,!0),children:[(0,b.jsx)(pe,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`}),(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title}),(0,b.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:e.expectedOutcome})]})]},e.id))}):null]}):null,(0,b.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center justify-center gap-x-5 gap-y-3`,children:[(0,b.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>Y(D.sessionKey),children:t.doSomethingElse}),(0,b.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>{N(!0),w(`recognition`)},children:t.correctUnderstanding})]})]}):null,C===`error`&&D?(0,b.jsxs)(`section`,{className:`text-center`,"aria-labelledby":`work-discovery-error-title`,children:[(0,b.jsx)(`div`,{className:`mx-auto flex size-11 items-center justify-center rounded-xl bg-danger-soft text-danger`,children:(0,b.jsx)(p,{className:`size-5`})}),(0,b.jsx)(`h1`,{id:`work-discovery-error-title`,className:`mt-5 text-2xl font-semibold tracking-tight text-fg`,children:t.errorTitle}),(0,b.jsx)(`p`,{className:`mx-auto mt-3 max-w-lg text-sm leading-6 text-fg-muted`,children:D.errorMessage}),(0,b.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3 sm:flex-row-reverse`,children:[(0,b.jsx)(d,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void oe(D.id).then(q),children:t.retry}),(0,b.jsx)(d,{variant:`secondary`,className:`h-11 flex-1`,onClick:()=>{O(null),E(null),w(`intro`)},children:t.chooseDifferent})]}),(0,b.jsx)(`button`,{type:`button`,className:`mt-6 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>Y(D.sessionKey),children:t.openConversation})]}):null]}),J.hasNativePicker?null:(0,b.jsx)(te,{open:J.modalOpen,onOpenChange:J.setModalOpen,initialAbsolutePath:T?.canonicalRootPath,onConfirm:J.confirmPick,wd:n})]})}export{S as WorkDiscoveryPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,t as a,u as o}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as s}from"./cn-JdwAhgNB.js";import{t as c}from"./messages-CxySDn9d.js";import{n as ee}from"./locale-store-Dar-xqQr.js";import{$o as l,Fl as te,Hs as u,Oa as ne,Rl as re,Rs as ie,Sc as d,Ss as f,Su as p,Vc as m,a as ae,bo as h,et as g,f as oe,hc as _,jc as se,kl as v,l as ce,m as le,mc as ue,o as de,p as fe,ru as y,s as b,ts as x,u as S,uu as C,xl as pe,yt as me}from"./index-vq_cJZJC.js";var w=n(),T=e(t(),1),E=r();function he(e){return e===`done`||e===`in_review`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`blocked`||e===`needs_input`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`in_progress`?`bg-accent-soft text-accent-fg`:e===`backlog`||e===`todo`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:`bg-surface-muted text-fg-subtle`}function D(e){return e?g(new Date(e)):``}function ge(e){return!Number.isFinite(e)||e<=0?`0 B`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(+(e<10*1024))} KB`:`${(e/(1024*1024)).toFixed(+(e<10*1024*1024))} MB`}function _e(e){return e.kind===`chat`?`/chat/${encodeURIComponent(e.targetId)}`:e.kind===`goal`?`/goals/${encodeURIComponent(e.targetId)}`:e.kind===`workflow_run`?`/workflows?run=${encodeURIComponent(e.targetId)}`:e.kind===`automation`?`/automations?automationId=${encodeURIComponent(e.targetId)}`:e.kind===`note`?`/notes/${encodeURIComponent(e.targetId)}`:`#`}function O(e){let t=(0,w.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,E.jsx)(`dt`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a=r||`-`,o;t[2]===a?o=t[3]:(o=(0,E.jsx)(`dd`,{className:`min-w-0 break-words text-sm text-fg`,children:a}),t[2]=a,t[3]=o);let s;return t[4]!==i||t[5]!==o?(s=(0,E.jsxs)(`div`,{className:`grid gap-1`,children:[i,o]}),t[4]=i,t[5]=o,t[6]=s):s=t[6],s}function ve(e){let t=(0,w.c)(9),{events:n,t:r}=e;if(!n.length){let e;return t[0]===r.detail.noActivity?e=t[1]:(e=(0,E.jsx)(`div`,{className:`rounded-lg bg-surface-panel px-4 py-8 text-center text-sm text-fg-muted shadow-surface`,children:r.detail.noActivity}),t[0]=r.detail.noActivity,t[1]=e),e}let i;if(t[2]!==n||t[3]!==r){let e;t[5]===r?e=t[6]:(e=e=>(0,E.jsx)(`article`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:(0,E.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,E.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:r.eventTypes[e.type]??e.type}),(0,E.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,children:D(e.createdAt)})]})},e.id),t[5]=r,t[6]=e),i=n.map(e),t[2]=n,t[3]=r,t[4]=i}else i=t[4];let a;return t[7]===i?a=t[8]:(a=(0,E.jsx)(`div`,{className:`grid gap-3`,children:i}),t[7]=i,t[8]=a),a}function k(e){return new Set(e.toLowerCase().split(/[^a-z0-9\u4e00-\u9fff]+/).filter(e=>e.length>=2))}function A(e,t,n){let r=t?.projectKind,i=[e.title,e.description,e.nextAction,e.blockedReason,e.status,e.priority,t?.name,t?.description,r].filter(Boolean).join(` `),a=[n.title,n.description,n.metadata.whenToUse,...n.metadata.tags??[]].filter(Boolean).join(` `),o=k(i),s=0;for(let e of k(a))o.has(e)&&(s+=3);let c=a.toLowerCase();return(e.status===`blocked`||e.status===`needs_input`)&&/debug|diagnos|review|audit|fix|检查|排查|修复/.test(c)&&(s+=8),e.status===`in_review`&&/review|audit|check|验收|评审|检查/.test(c)&&(s+=6),e.attachments?.length&&/analy|extract|summar|review|整理|分析|总结/.test(c)&&(s+=5),r===`coding`&&/code|repo|test|pr|review|代码|仓库|测试/.test(c)&&(s+=5),s}function ye(e,t,n){return[...n].sort((n,r)=>A(e,t,r)-A(e,t,n)||n.title.localeCompare(r.title))}function j(){let{workItemId:e=``}=o(),t=i(),n=c(ee(e=>e.language)).projectDetailPage.workItems,[r,g]=(0,T.useState)(null),[w,k]=(0,T.useState)(null),[j,M]=(0,T.useState)([]),[N,be]=(0,T.useState)([]),[P,F]=(0,T.useState)(``),[I,L]=(0,T.useState)(``),[R,z]=(0,T.useState)(!0),[B,V]=(0,T.useState)(!1),[H,U]=(0,T.useState)(null),W=(0,T.useRef)(null),G=h(e=>e.setPageHeader),K=h(e=>e.clearPageHeader),q=(0,T.useMemo)(()=>r?`/projects/${encodeURIComponent(r.projectId)}/work-items`:`/projects`,[r]),J=(0,T.useCallback)(async()=>{if(e){z(!0),U(null);try{let[t,n]=await Promise.all([ce(e),S(e).catch(()=>({events:[]}))]);g(t.item),L(t.item.nextAction||t.item.title),M(n.events);let[r,i]=await Promise.all([ne(t.item.projectId).catch(()=>null),me().catch(()=>[])]),a=ye(t.item,r,i);k(r),be(a),F(e=>e||a[0]?.id||``)}catch(e){U(e instanceof Error?e.message:String(e))}finally{z(!1)}}},[e]);(0,T.useEffect)(()=>{J()},[J]);let Y=(0,T.useCallback)(async()=>{if(r){V(!0),U(null);try{let e=await oe(r.id);g(e.item),t(`/chat/${encodeURIComponent(e.session.key)}`)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,t]),X=(0,T.useCallback)(async()=>{if(r){V(!0),U(null);try{let e=await ae(r.id);g(e.item),t(`/goals/${encodeURIComponent(e.goal.id)}`)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,t]),Z=(0,T.useCallback)(async e=>{M((await S(e).catch(()=>({events:[]}))).events)},[]),xe=(0,T.useCallback)(async()=>{if(!(!r||!P)){V(!0),U(null);try{let e=await fe(r.id,{definitionId:P,goal:I.trim()||r.nextAction||r.title});g(e.item),await Z(e.item.id),t(`/workflows?run=${encodeURIComponent(e.runId)}`)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,t,Z,P,I]),Se=(0,T.useCallback)(async e=>{if(!(!r||!e.length)){V(!0),U(null);try{let t=await le(r.id,e);g(t.item),await Z(t.item.id)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,Z]),Ce=(0,T.useCallback)(async e=>{if(r){V(!0),U(null);try{let t=await de(r.id,e.id);g(t.item),await Z(t.item.id)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,Z]),we=(0,T.useCallback)(async e=>{if(r){U(null);try{await b(r.id,e)}catch(e){U(e instanceof Error?e.message:String(e))}}},[r]),Q=(0,T.useMemo)(()=>r?N.filter(e=>A(r,w,e)>0).slice(0,3):[],[r,w,N]),$=(0,T.useMemo)(()=>(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(f,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:()=>void J(),children:[(0,E.jsx)(_,{className:`size-3.5`,"aria-hidden":!0}),(0,E.jsx)(`span`,{className:`hidden sm:inline`,children:n.refreshShort})]}),r?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(f,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:Y,children:[(0,E.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),(0,E.jsx)(`span`,{className:`hidden md:inline`,children:n.detail.startChat})]}),(0,E.jsxs)(f,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:X,children:[(0,E.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}),(0,E.jsx)(`span`,{className:`hidden md:inline`,children:n.detail.createGoal})]})]}):null]}),[B,X,Y,r,J,n.detail.createGoal,n.detail.startChat,n.refreshShort]);return(0,T.useLayoutEffect)(()=>(G({startExtra:(0,E.jsx)(a,{to:q,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":w?.name?n.detail.backToProject.replace(`{{name}}`,w.name):n.detail.backToProjects,children:(0,E.jsx)(p,{className:`size-4`,"aria-hidden":!0})}),main:(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,E.jsx)(C,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,E.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:r?.title??(R?n.detail.loading:n.detail.notFound)})]}),r?(0,E.jsxs)(`p`,{className:`truncate text-xs text-fg-muted`,children:[n.statuses[r.status],` · `,n.priorities[r.priority],` · `,w?.name||r.projectId,` · `,n.updated,`: `,D(r.updatedAt)]}):null]}),end:$}),()=>K()),[K,$,r,R,w?.name,q,G,n,w]),R?(0,E.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-6 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,E.jsx)(`div`,{className:`h-8 w-40 animate-pulse rounded-md bg-surface-hover`}),(0,E.jsx)(`div`,{className:`mt-5 h-44 animate-pulse rounded-xl bg-surface-hover`})]}):H||!r?(0,E.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-6 sm:px-5 xl:px-6`,children:[(0,E.jsxs)(a,{to:`/projects`,className:`inline-flex items-center gap-1 text-sm font-medium text-accent hover:text-accent-fg`,children:[(0,E.jsx)(p,{className:`size-4`,"aria-hidden":!0}),n.detail.backToProjects]}),(0,E.jsx)(`div`,{className:`mt-5 rounded-lg border border-danger/30 bg-danger-soft px-4 py-3 text-sm text-danger`,children:H||n.detail.notFound})]}):(0,E.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-5 sm:px-5 xl:px-6`,children:[(0,E.jsxs)(`section`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface sm:px-5`,children:[(0,E.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,E.jsx)(C,{className:`size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,E.jsx)(`h1`,{className:`min-w-0 break-words text-lg font-semibold leading-7 text-fg`,children:r.title})]}),(0,E.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs`,children:[(0,E.jsx)(`span`,{className:s(`rounded-full px-2 py-0.5 font-medium`,he(r.status)),children:n.statuses[r.status]}),(0,E.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-fg-muted`,children:n.priorities[r.priority]}),r.archivedAt?(0,E.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-fg-muted`,children:n.detail.archived}):null]})]}),(0,E.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[(0,E.jsxs)(f,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:Y,children:[(0,E.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),n.detail.startChat]}),(0,E.jsxs)(f,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:X,children:[(0,E.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}),n.detail.createGoal]})]})]}),(0,E.jsxs)(`dl`,{className:`mt-5 grid gap-4 border-t border-edge pt-4 sm:grid-cols-2`,children:[(0,E.jsx)(O,{label:n.create.descriptionLabel,value:r.description||n.detail.noDescription}),(0,E.jsx)(O,{label:n.nextAction,value:r.nextAction||n.noNextAction}),(0,E.jsx)(O,{label:n.blockedReason,value:r.blockedReason||n.detail.noBlockedReason}),(0,E.jsx)(O,{label:n.updated,value:D(r.updatedAt)})]})]}),(0,E.jsxs)(`div`,{className:`mt-4 grid min-h-0 gap-4 lg:grid-cols-[minmax(0,1fr)_18rem]`,children:[(0,E.jsxs)(`section`,{className:`min-w-0`,children:[(0,E.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,E.jsx)(v,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,E.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.activity})]}),(0,E.jsx)(ve,{events:j,t:n})]}),(0,E.jsxs)(`aside`,{className:`grid content-start gap-4`,children:[(0,E.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,E.jsx)(`div`,{className:`flex items-center justify-between gap-3`,children:(0,E.jsxs)(`h2`,{className:`inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,E.jsx)(pe,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,E.jsx)(`span`,{className:`truncate`,children:n.detail.workflowTitle})]})}),(0,E.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.detail.workflowHint}),(0,E.jsxs)(`div`,{className:`mt-3 grid gap-2`,children:[(0,E.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-subtle`,children:[n.detail.workflowTemplate,(0,E.jsxs)(l,{className:`h-9 rounded-md border border-edge bg-surface-base px-2 text-sm font-normal text-fg outline-none focus:border-accent`,value:P,disabled:B||N.length===0,onChange:e=>F(e.target.value),children:[N.length===0?(0,E.jsx)(x,{value:``,children:n.detail.noWorkflowTemplates}):null,N.map(e=>(0,E.jsx)(x,{value:e.id,children:e.title},e.id))]})]}),Q.length?(0,E.jsxs)(`div`,{className:`grid gap-1`,children:[(0,E.jsx)(`div`,{className:`text-xs font-medium text-fg-subtle`,children:n.detail.recommendedWorkflows}),(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:Q.map(e=>(0,E.jsx)(`button`,{type:`button`,className:s(`min-w-0 rounded-md border px-2 py-1 text-left text-xs transition-colors`,P===e.id?`border-accent bg-accent-soft text-accent-fg`:`border-edge bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg`),disabled:B,onClick:()=>F(e.id),children:(0,E.jsx)(`span`,{className:`block max-w-48 truncate`,children:e.title})},e.id))})]}):null,(0,E.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-subtle`,children:[n.detail.workflowGoal,(0,E.jsx)(`textarea`,{className:`min-h-20 resize-y rounded-md border border-edge bg-surface-base p-2 text-sm font-normal text-fg outline-none focus:border-accent`,value:I,disabled:B,onChange:e=>L(e.target.value)})]}),(0,E.jsxs)(f,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3 text-xs`,disabled:B||!P,onClick:xe,children:[(0,E.jsx)(ue,{className:`size-3.5`,"aria-hidden":!0}),n.detail.startWorkflow]}),N.length?null:(0,E.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.detail.noWorkflowTemplates})]})]}),(0,E.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,E.jsxs)(`h2`,{className:`inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,E.jsx)(se,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,E.jsx)(`span`,{className:`truncate`,children:n.attachments.title})]}),(0,E.jsxs)(f,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:()=>W.current?.click(),children:[(0,E.jsx)(d,{className:`size-3.5`,"aria-hidden":!0}),n.attachments.add]}),(0,E.jsx)(`input`,{ref:W,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{Se(Array.from(e.target.files??[])),e.currentTarget.value=``}})]}),(0,E.jsx)(`div`,{className:`mt-3 grid gap-2`,children:r.attachments?.length?r.attachments.map(e=>(0,E.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-edge bg-surface-base p-2 text-sm`,children:[(0,E.jsx)(v,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,E.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,E.jsx)(`div`,{className:`truncate font-medium text-fg`,children:e.fileName}),(0,E.jsxs)(`div`,{className:`truncate text-xs text-fg-subtle`,children:[e.mimeType,` · `,ge(e.size)]})]}),(0,E.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,title:n.attachments.download,"aria-label":n.attachments.download,disabled:B,onClick:()=>void we(e),children:(0,E.jsx)(re,{className:`size-3.5`,"aria-hidden":!0})}),(0,E.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-danger`,title:n.attachments.remove,"aria-label":n.attachments.remove,disabled:B,onClick:()=>void Ce(e),children:(0,E.jsx)(ie,{className:`size-3.5`,"aria-hidden":!0})})]},e.id)):(0,E.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.attachments.empty})})]}),(0,E.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,E.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.links}),(0,E.jsx)(`div`,{className:`mt-3 grid gap-1 text-sm`,children:r.links?.length?r.links.map(e=>(0,E.jsxs)(a,{to:_e(e),className:`flex min-w-0 items-center justify-between gap-3 rounded-md px-2 py-1.5 hover:bg-surface-hover`,children:[(0,E.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.title||e.targetId}),(0,E.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[n.linkKinds[e.kind],(0,E.jsx)(te,{className:`size-3.5`,"aria-hidden":!0})]})]},e.id)):(0,E.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.detail.noLinks})})]}),(0,E.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,E.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.project}),(0,E.jsxs)(a,{to:q,className:`mt-2 inline-flex min-w-0 items-center gap-2 text-sm font-medium text-accent hover:text-accent-fg`,children:[(0,E.jsx)(y,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,E.jsx)(`span`,{className:`min-w-0 truncate`,children:w?.name||r.projectId})]})]})]})]})]})}export{j as WorkItemDetailPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,t as a}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./circle-alert-BEjgurr2.js";import{t as c}from"./cn-JdwAhgNB.js";import{t as l}from"./messages-CxySDn9d.js";import{n as u,o as d,r as f,s as p}from"./locale-store-Dar-xqQr.js";import{n as m}from"./activity-store-o7GRljfD.js";import{Ao as h,Bo as g,Du as _,Ea as v,El as y,Eo as b,Ho as x,Kc as S,Ls as C,Pa as w,Pl as T,Qs as E,R as D,Ro as O,Rs as k,Sc as A,So as j,Ss as M,Ts as ee,Uc as N,Uo as te,Vo as ne,Wo as re,Xa as P,au as F,bo as ie,cc as ae,cu as oe,et as I,ll as L,ql as se,ru as ce,xu as le,zo as ue}from"./index-vq_cJZJC.js";var R=e(t(),1),z=n();function B(e){try{return decodeURIComponent(e).trim()||null}catch{return null}}function V(e){if(!e)return null;let t=e.split(/[?#]/,1)[0],n=/^\/goals\/([^/]+)\/?$/.exec(t);if(n){let e=B(n[1]);return e?{kind:`goal`,id:e}:null}let r=/^\/chat\/([^/]+)\/?$/.exec(t);if(r){let e=B(r[1]);return!e||e===`new`?null:{kind:`session`,id:e}}return null}async function H(e,t){let n=e.kind===`goal`?`/api/goals/${encodeURIComponent(e.id)}`:`/api/sessions/${encodeURIComponent(e.id)}?limit=1`;try{return(await d(f(n),{signal:t})).status===404?`missing`:`available`}catch(e){if(t?.aborted)throw e;return`available`}}var U=r(),W=3,de={info:{Icon:L,className:`text-accent-fg bg-accent-soft`},success:{Icon:ce,className:`text-success bg-success-soft`},warning:{Icon:C,className:`text-warning bg-warning-soft`},error:{Icon:s,className:`text-danger bg-danger-soft`}};function G(e,t){let n=Math.max(0,Math.round((Date.now()-e)/1e3));if(n<60)return t===`zh`?`刚刚`:`Just now`;let r=Math.round(n/60);if(r<60)return t===`zh`?`${r} 分钟前`:`${r}m ago`;let i=Math.round(r/60);if(i<24)return t===`zh`?`${i} 小时前`:`${i}h ago`;let a=Math.round(i/24);return t===`zh`?`${a} 天前`:`${a}d ago`}function K(e){let t=(0,z.c)(55),{item:n,targetAvailability:r}=e,i=u(J),o;t[0]===i?o=t[1]:(o=l(i),t[0]=i,t[1]=o);let s=o.projectsPage.workHome,d=m(q),{Icon:f,className:p}=de[n.tone],h;t[2]===p?h=t[3]:(h=c(`mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-lg`,p),t[2]=p,t[3]=h);let g;t[4]!==f||t[5]!==n.status?(g=n.status===`running`?(0,U.jsx)(S,{className:`size-3.5 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,U.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),t[4]=f,t[5]=n.status,t[6]=g):g=t[6];let _;t[7]!==h||t[8]!==g?(_=(0,U.jsx)(`div`,{className:h,children:g}),t[7]=h,t[8]=g,t[9]=_):_=t[9];let v;t[10]===n.title?v=t[11]:(v=(0,U.jsx)(`h3`,{className:`min-w-0 flex-1 text-sm font-medium leading-5 text-fg`,children:n.title}),t[10]=n.title,t[11]=v);let y;t[12]!==s.activityUnread||t[13]!==n.read?(y=n.read?null:(0,U.jsx)(`span`,{className:`mt-1.5 size-1.5 shrink-0 rounded-full bg-accent`,"aria-label":s.activityUnread}),t[12]=s.activityUnread,t[13]=n.read,t[14]=y):y=t[14];let b;t[15]!==v||t[16]!==y?(b=(0,U.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[v,y]}),t[15]=v,t[16]=y,t[17]=b):b=t[17];let x;t[18]===n.message?x=t[19]:(x=n.message?(0,U.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.message}):null,t[18]=n.message,t[19]=x);let C;t[20]===n.source?C=t[21]:(C=n.source?(0,U.jsx)(`span`,{className:`max-w-48 truncate`,children:n.source}):null,t[20]=n.source,t[21]=C);let w;t[22]!==n.updatedAt||t[23]!==i?(w=G(n.updatedAt,i),t[22]=n.updatedAt,t[23]=i,t[24]=w):w=t[24];let T;t[25]===w?T=t[26]:(T=(0,U.jsx)(`span`,{children:w}),t[25]=w,t[26]=T);let E;t[27]===n.occurrences?E=t[28]:(E=n.occurrences>1?(0,U.jsxs)(`span`,{children:[`×`,n.occurrences]}):null,t[27]=n.occurrences,t[28]=E);let D;t[29]!==s.activityCheckingRelated||t[30]!==s.activityRelatedMissing||t[31]!==s.activityViewRelated||t[32]!==n.href||t[33]!==r?(D=n.href&&r===`available`?(0,U.jsxs)(a,{to:n.href,className:`inline-flex items-center gap-0.5 font-medium text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[s.activityViewRelated,(0,U.jsx)(F,{className:`size-3`,"aria-hidden":!0})]}):n.href&&r===`checking`?(0,U.jsx)(P,{className:`h-3 w-20 rounded`,"aria-label":s.activityCheckingRelated}):n.href&&r===`missing`?(0,U.jsx)(`span`,{className:`font-medium text-fg-subtle`,role:`status`,children:s.activityRelatedMissing}):null,t[29]=s.activityCheckingRelated,t[30]=s.activityRelatedMissing,t[31]=s.activityViewRelated,t[32]=n.href,t[33]=r,t[34]=D):D=t[34];let O;t[35]!==T||t[36]!==E||t[37]!==D||t[38]!==C?(O=(0,U.jsxs)(`div`,{className:`mt-1.5 flex min-w-0 flex-wrap items-center gap-x-2 text-[11px] text-fg-subtle`,children:[C,T,E,D]}),t[35]=T,t[36]=E,t[37]=D,t[38]=C,t[39]=O):O=t[39];let k;t[40]!==O||t[41]!==b||t[42]!==x?(k=(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[b,x,O]}),t[40]=O,t[41]=b,t[42]=x,t[43]=k):k=t[43];let A;t[44]!==n.id||t[45]!==d?(A=()=>d(n.id),t[44]=n.id,t[45]=d,t[46]=A):A=t[46];let j;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,U.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),t[47]=j):j=t[47];let M;t[48]!==s.activityRemove||t[49]!==A?(M=(0,U.jsx)(`button`,{type:`button`,className:`rounded-md p-1 text-fg-subtle opacity-0 transition-opacity hover:bg-surface-hover hover:text-fg group-hover:opacity-100 focus:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":s.activityRemove,onClick:A,children:j}),t[48]=s.activityRemove,t[49]=A,t[50]=M):M=t[50];let N;return t[51]!==k||t[52]!==M||t[53]!==_?(N=(0,U.jsxs)(`article`,{className:`group flex items-start gap-3 border-t border-edge-subtle px-1 py-3 first:border-t-0`,children:[_,k,M]}),t[51]=k,t[52]=M,t[53]=_,t[54]=N):N=t[54],N}function q(e){return e.remove}function J(e){return e.language}function fe(){let e=(0,z.c)(12),t=l(u(ve)).projectsPage.workHome,n=m(_e),r=m(ge),i=m(he),[a,s]=(0,R.useState)(!1),c;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={},e[0]=c):c=e[0];let[d,f]=(0,R.useState)(c),p;e[1]===n?p=e[2]:(p=n.filter(me),e[1]=n,e[2]=p);let h=p.length,g;e[3]===n?g=e[4]:(g=n.filter(pe),e[3]=n,e[4]=g);let v=g.length,y;e[5]!==a||e[6]!==n?(y=a?n:n.slice(0,W),e[5]=a,e[6]=n,e[7]=y):y=e[7];let b=y,x,C;e[8]===n?(x=e[9],C=e[10]):(x=()=>{let e=new AbortController,t=new Map(n.flatMap($));return f(Object.fromEntries([...t.keys()].map(Q))),Promise.all([...t].map(async t=>{let[n,r]=t,i=await H(r,e.signal);e.signal.aborted||f(e=>({...e,[n]:i}))})).catch(Z),()=>e.abort()},C=[n],e[8]=n,e[9]=x,e[10]=C),(0,R.useEffect)(x,C);let w;return e[11]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,U.jsx)(_,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),e[11]=w):w=e[11],(0,U.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-4 shadow-surface`,"aria-labelledby":`workbench-activity-title`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[w,(0,U.jsx)(`h2`,{id:`workbench-activity-title`,className:`text-sm font-semibold text-fg`,children:t.activityTitle}),h>0?(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:[(0,U.jsx)(S,{className:`size-3 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}),h,` `,t.running]}):v>0?(0,U.jsxs)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[v,` `,t.activityNew]}):null]}),n.length>0?(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.activityHint}):null]}),a&&n.length>0?(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[v>0?(0,U.jsxs)(M,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:r,children:[(0,U.jsx)(o,{className:`size-3.5`,"aria-hidden":!0}),t.activityMarkRead]}):null,n.some(X)?(0,U.jsxs)(M,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-fg-muted`,onClick:i,children:[(0,U.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),t.activityClearFinished]}):null]}):null]}),n.length>0?(0,U.jsxs)(`div`,{className:`mt-3 px-1`,children:[b.map(e=>(0,U.jsx)(K,{item:e,targetAvailability:e.href&&V(e.href)?d[e.href]??`checking`:`available`},e.id)),n.length>W?(0,U.jsx)(`div`,{className:`border-t border-edge-subtle py-2 text-center`,children:(0,U.jsx)(M,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>s(Y),children:a?t.activityShowLess:t.activityShowAll.replace(`{{count}}`,String(n.length))})}):null]}):(0,U.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 text-sm text-fg-muted`,children:[(0,U.jsx)(se,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),(0,U.jsx)(`p`,{children:t.activityEmpty})]})]})}function Y(e){return!e}function X(e){return e.status===`done`}function Z(){}function Q(e){return[e,`checking`]}function $(e){let t=V(e.href);return e.href&&t?[[e.href,t]]:[]}function pe(e){return!e.read}function me(e){return e.status===`running`}function he(e){return e.clearFinished}function ge(e){return e.markAllRead}function _e(e){return e.items}function ve(e){return e.language}function ye(e){return p(f(`/api/home${e?`?locale=${encodeURIComponent(e)}`:``}`))}function be(e,t){return p(f(`/api/proactive/insights/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify({status:t})})}function xe(e){return p(f(`/api/proactive/insights/${encodeURIComponent(e)}/approve`),{method:`POST`})}function Se(e,t){return p(f(`/api/focuses/${encodeURIComponent(e)}/calendar/${encodeURIComponent(t)}/prepare`),{method:`POST`})}function Ce(e,t){return p(f(`/api/home/decisions/respond`),{method:`POST`,body:JSON.stringify({...e,decision:t})})}function we(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function Te(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:I(n)}function Ee(){let e=(0,z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,U.jsxs)(`div`,{className:`space-y-5`,"aria-busy":!0,children:[(0,U.jsx)(P,{className:`h-20 rounded-2xl`}),(0,U.jsx)(P,{className:`h-72 rounded-2xl`}),(0,U.jsx)(P,{className:`h-44 rounded-2xl`})]}),e[0]=t):t=e[0],t}function De(e){let t=(0,z.c)(19),{item:n,statusLabel:r}=e,i=`/work-items/${encodeURIComponent(n.id)}`,o;t[0]===n.title?o=t[1]:(o=(0,U.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.title}),t[0]=n.title,t[1]=o);let s;t[2]===n.projectName?s=t[3]:(s=(0,U.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.projectName}),t[2]=n.projectName,t[3]=s);let c;t[4]!==o||t[5]!==s?(c=(0,U.jsxs)(`div`,{className:`min-w-0`,children:[o,s]}),t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;t[7]===r?l=t[8]:(l=(0,U.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:r}),t[7]=r,t[8]=l);let u;t[9]!==c||t[10]!==l?(u=(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[c,l]}),t[9]=c,t[10]=l,t[11]=u):u=t[11];let d;t[12]!==n.blockedReason||t[13]!==n.nextAction?(d=n.blockedReason||n.nextAction?(0,U.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.blockedReason||n.nextAction}):null,t[12]=n.blockedReason,t[13]=n.nextAction,t[14]=d):d=t[14];let f;return t[15]!==i||t[16]!==u||t[17]!==d?(f=(0,U.jsxs)(a,{to:i,className:`group block rounded-lg px-1 py-2.5 transition-colors hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[u,d]}),t[15]=i,t[16]=u,t[17]=d,t[18]=f):f=t[18],f}function Oe(e){let t=(0,z.c)(27),{item:n,kindLabel:r,reasonLabel:i,approveLabel:o,denyLabel:s,busy:c,onRespond:l}=e,u;t[0]===n.title?u=t[1]:(u=(0,U.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.title}),t[0]=n.title,t[1]=u);let d=n.projectName||r,f;t[2]===d?f=t[3]:(f=(0,U.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:d}),t[2]=d,t[3]=f);let p;t[4]!==u||t[5]!==f?(p=(0,U.jsxs)(`div`,{className:`min-w-0`,children:[u,f]}),t[4]=u,t[5]=f,t[6]=p):p=t[6];let m;t[7]===i?m=t[8]:(m=(0,U.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-panel/80 px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:i}),t[7]=i,t[8]=m);let h;t[9]!==p||t[10]!==m?(h=(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[p,m]}),t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]===n.detail?g=t[13]:(g=n.detail?(0,U.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.detail}):null,t[12]=n.detail,t[13]=g);let _;t[14]!==n.href||t[15]!==h||t[16]!==g?(_=(0,U.jsxs)(a,{to:n.href,className:`group block focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[h,g]}),t[14]=n.href,t[15]=h,t[16]=g,t[17]=_):_=t[17];let v;t[18]!==o||t[19]!==c||t[20]!==s||t[21]!==n.response||t[22]!==l?(v=n.response?(0,U.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2 border-t border-warning/20 pt-3`,children:[(0,U.jsx)(M,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:c,onClick:()=>l(`deny`),children:s}),(0,U.jsx)(M,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:c,onClick:()=>l(`approve`),children:o})]}):null,t[18]=o,t[19]=c,t[20]=s,t[21]=n.response,t[22]=l,t[23]=v):v=t[23];let y;return t[24]!==_||t[25]!==v?(y=(0,U.jsxs)(`article`,{className:`rounded-xl border border-warning/35 bg-warning-soft/25 p-3.5 transition-colors hover:bg-warning-soft/40`,children:[_,v]}),t[24]=_,t[25]=v,t[26]=y):y=t[26],y}function ke(e){let t=(0,z.c)(19),{project:n,openLabel:r,noDescription:i}=e,o=`/projects/${encodeURIComponent(n.id)}`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,U.jsx)(y,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[0]=s):s=t[0];let c;t[1]===n.name?c=t[2]:(c=(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[s,(0,U.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.name})]}),t[1]=n.name,t[2]=c);let l;t[3]===r?l=t[4]:(l=(0,U.jsx)(le,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-label":r}),t[3]=r,t[4]=l);let u;t[5]!==c||t[6]!==l?(u=(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[c,l]}),t[5]=c,t[6]=l,t[7]=u):u=t[7];let d=n.description||n.brief||i,f;t[8]===d?f=t[9]:(f=(0,U.jsx)(`p`,{className:`mt-3 line-clamp-2 text-xs leading-5 text-fg-muted`,children:d}),t[8]=d,t[9]=f);let p=n.lastActiveAt??n.updatedAt,m;t[10]===p?m=t[11]:(m=Te(p,``),t[10]=p,t[11]=m);let h;t[12]===m?h=t[13]:(h=(0,U.jsx)(`p`,{className:`mt-auto pt-3 text-[11px] text-fg-subtle`,children:m}),t[12]=m,t[13]=h);let g;return t[14]!==o||t[15]!==h||t[16]!==u||t[17]!==f?(g=(0,U.jsxs)(a,{to:o,className:`group flex min-h-32 flex-col rounded-xl border border-edge-subtle bg-surface-panel p-4 transition-colors hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[u,f,h]}),t[14]=o,t[15]=h,t[16]=u,t[17]=f,t[18]=g):g=t[18],g}function Ae(){let e=u(e=>e.language),t=l(e),n=t.projectsPage,r=i(),o=ie(e=>e.setPageHeader),c=ie(e=>e.clearPageHeader),[d,f]=(0,R.useState)(null),[p,m]=(0,R.useState)([]),[_,y]=(0,R.useState)([]),[S,C]=(0,R.useState)(!0),[k,P]=(0,R.useState)(null),[F,I]=(0,R.useState)(null),[L,ce]=(0,R.useState)(``),[le,z]=(0,R.useState)(!1),[B,V]=(0,R.useState)(``),[H,W]=(0,R.useState)(!1),[de,G]=(0,R.useState)(null),[K,q]=(0,R.useState)(null),[J,Y]=(0,R.useState)(null),X=(0,R.useCallback)(async()=>{C(!0),P(null);try{let[t,n,r]=await Promise.all([ye(e),w({limit:100,sortBy:`updatedAt`,sortOrder:`desc`}),b()]);f(t),m(n.items),y(r)}catch(e){P(e instanceof Error?e.message:String(e))}finally{C(!1)}},[e]);(0,R.useEffect)(()=>{X()},[X]);let Z=(0,R.useMemo)(()=>{let e=L.trim().toLocaleLowerCase(),t=p.filter(e=>e.status!==`archived`);return e?t.filter(t=>[t.name,t.description,t.brief].filter(Boolean).some(t=>t.toLocaleLowerCase().includes(e))):t.slice(0,6)},[p,L]),Q=(0,R.useMemo)(()=>d?.decisions??[],[d]),$=(0,R.useMemo)(()=>d?.work.current.filter(e=>e.status!==`needs_input`&&e.status!==`in_review`&&e.status!==`blocked`).slice(0,10)??[],[d]),pe=(0,R.useCallback)(async t=>{t.preventDefault();let n=B.trim();if(!(!n||H)){W(!0),I(null);try{let t=await v({outcome:n,uiLocale:e});V(``),z(!1),r(`/projects/${encodeURIComponent(t.project.id)}`)}catch(e){I(e instanceof Error?e.message:String(e))}finally{W(!1)}}},[H,e,r,B]),me=(0,R.useMemo)(()=>(0,U.jsxs)(M,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>z(!0),children:[(0,U.jsx)(A,{className:`size-4`,"aria-hidden":!0}),n.workHome.newWork]}),[n.workHome.newWork]),he=(0,R.useCallback)(async(e,t)=>{if(e.response){G(e.id),P(null);try{await Ce(e.response,t),await X()}catch(e){P(e instanceof Error?e.message:String(e))}finally{G(null)}}},[X]),ge=(0,R.useCallback)(async(e,t)=>{q(e.id),P(null);try{let n=e.watches.find(e=>e.kind===t&&e.status===`active`);n?await h(e.id,n.id):await j(e.id,t),y(await b())}catch(e){P(e instanceof Error?e.message:String(e))}finally{q(null)}},[]),_e=(0,R.useCallback)(async(e,t)=>{Y(e),P(null);try{t===`approved`?await xe(e):await be(e,`dismissed`),f(t=>t&&{...t,proactiveInsights:t.proactiveInsights.filter(t=>t.id!==e)})}catch(e){P(e instanceof Error?e.message:String(e))}finally{Y(null)}},[]),ve=(0,R.useCallback)(async(e,t)=>{q(e),P(null);try{await Se(e,t),y(await b())}catch(e){P(e instanceof Error?e.message:String(e))}finally{q(null)}},[]);return(0,R.useLayoutEffect)(()=>(o({startExtra:null,main:(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),(0,U.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:n.workHome.subtitle})]}),end:me}),()=>c()),[c,me,o,n.title,n.workHome.subtitle]),(0,U.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[1200px] flex-1 flex-col gap-7 px-4 py-7 sm:px-6 lg:px-8 lg:py-9`,children:[(0,U.jsx)(O,{open:le,onOpenChange:e=>{!e&&H||(z(e),e||I(null))},children:(0,U.jsxs)(te,{children:[(0,U.jsx)(x,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,U.jsxs)(g,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(31rem,calc(100dvh-1.5rem))] w-[min(36rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,U.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(re,{className:`text-base font-semibold text-fg`,children:n.workHome.delegateTitle}),(0,U.jsx)(ne,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:n.workHome.delegateDescription})]}),(0,U.jsx)(ue,{asChild:!0,children:(0,U.jsx)(M,{type:`button`,variant:`ghost`,className:`-mr-2 -mt-1 size-8 shrink-0 rounded-lg p-0`,title:n.cancel,"aria-label":n.cancel,disabled:H,children:(0,U.jsx)(ee,{className:`size-4`,"aria-hidden":!0})})})]}),(0,U.jsxs)(`form`,{onSubmit:pe,className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-4`,children:[(0,U.jsx)(`label`,{htmlFor:`new-work-outcome`,className:`mb-2 shrink-0 text-sm font-medium text-fg`,children:n.workHome.outcomeLabel}),(0,U.jsx)(`textarea`,{id:`new-work-outcome`,className:`min-h-32 w-full flex-1 resize-none rounded-xl border border-edge bg-surface-base p-3 text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,value:B,onChange:e=>V(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},placeholder:n.workHome.outcomePlaceholder,maxLength:12e3,disabled:H,autoFocus:!0}),(0,U.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,U.jsx)(`span`,{children:n.workHome.submitShortcut}),(0,U.jsxs)(`span`,{className:`tabular-nums`,children:[B.length.toLocaleString(),` / `,12e3.toLocaleString()]})]}),F?(0,U.jsx)(`p`,{className:`mt-3 rounded-lg bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:F}):null]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-3 border-t border-edge px-5 py-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,U.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:n.workHome.autoSetupHint}),(0,U.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2`,children:[(0,U.jsx)(ue,{asChild:!0,children:(0,U.jsx)(M,{type:`button`,variant:`ghost`,disabled:H,children:n.cancel})}),(0,U.jsxs)(M,{type:`submit`,variant:`primary`,className:`min-w-32`,disabled:H||!B.trim(),children:[(0,U.jsx)(E,{className:`size-4`,"aria-hidden":!0}),H?n.workHome.delegating:n.workHome.delegate]})]})]})]})]})]})}),k?(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,children:[(0,U.jsx)(`span`,{children:k}),(0,U.jsx)(M,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void X(),children:n.workHome.retry})]}):null,S?(0,U.jsx)(Ee,{}):d?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`section`,{className:`border-b border-edge-subtle pb-5`,children:[(0,U.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:n.workHome.briefingTitle}),(0,U.jsx)(`h2`,{className:`mt-1 text-xl font-semibold tracking-tight text-fg`,children:d.decisions.length>0?we(n.workHome.todaySummary,{attention:d.decisions.length,moving:d.briefing.progress.movingCount}):we(n.workHome.todaySummaryClear,{moving:d.briefing.progress.movingCount})}),d.briefing.summary?(0,U.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm leading-6 text-fg-muted`,children:d.briefing.summary}):null]}),d.proactiveInsights.length>0?(0,U.jsxs)(`section`,{className:`rounded-2xl border border-accent/20 bg-accent-soft/20 p-5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(E,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,U.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.workHome.insightsTitle})]}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.workHome.insightsHint}),(0,U.jsx)(`div`,{className:`mt-4 space-y-3`,children:d.proactiveInsights.map(e=>(0,U.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,children:[(0,U.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,U.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:e.summary}),(0,U.jsxs)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:[(0,U.jsxs)(`span`,{className:`font-medium text-fg`,children:[n.workHome.whyItMatters,`: `]}),e.whyItMatters]}),(0,U.jsxs)(`p`,{className:`mt-2 rounded-lg bg-surface-base px-3 py-2 text-xs leading-5 text-fg-muted`,children:[(0,U.jsxs)(`span`,{className:`font-medium text-fg`,children:[n.workHome.suggestedNext,`: `]}),e.nextAction]}),(0,U.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:e.evidence.map((e,t)=>(0,U.jsxs)(`span`,{className:`rounded-full border border-edge-subtle px-2 py-1 text-[11px] text-fg-subtle`,children:[e.label,e.source?` · ${e.source}`:``]},`${e.label}-${t}`))}),(0,U.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2 border-t border-edge-subtle pt-3`,children:[(0,U.jsx)(M,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:J===e.id,onClick:()=>void _e(e.id,`dismissed`),children:n.workHome.dismissInsight}),(0,U.jsx)(M,{type:`button`,variant:`primary`,className:`h-8 px-2 text-xs`,disabled:J===e.id,onClick:()=>void _e(e.id,`approved`),children:n.workHome.investigateInsight})]})]},e.id))})]}):null,d.calendarSignals.length>0?(0,U.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(oe,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,U.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.workHome.relatedCalendarTitle})]}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.workHome.relatedCalendarHint}),(0,U.jsx)(`div`,{className:`mt-4 divide-y divide-edge-subtle`,children:d.calendarSignals.map(e=>(0,U.jsxs)(`article`,{className:`flex flex-col gap-3 py-3 first:pt-0 last:pb-0 sm:flex-row sm:items-center sm:justify-between`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.title}),(0,U.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[e.focusTitle,` · `,Te(e.startsAt,``)]})]}),(0,U.jsx)(M,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 px-2 text-xs`,disabled:K===e.focusId,onClick:()=>void ve(e.focusId,e.id),children:K===e.focusId?n.workHome.focusWatchUpdating:n.workHome.prepareForEvent})]},e.id))})]}):null,_.length>0?(0,U.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(T,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,U.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.workHome.focusesTitle})]}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.workHome.focusesHint}),(0,U.jsx)(`div`,{className:`mt-4 grid gap-3 md:grid-cols-2`,children:_.slice(0,6).map(e=>{let t=e.watches.some(e=>e.kind===`progress`&&e.status===`active`),r=e.watches.some(e=>e.kind===`intelligence`&&e.status===`active`),i=t||r;return(0,U.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.title}),(0,U.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.summary})]}),(0,U.jsx)(`span`,{className:`mt-0.5 size-2 shrink-0 rounded-full ${i?`bg-success`:`bg-fg-subtle/40`}`,"aria-hidden":!0})]}),e.blockedReason||e.nextAction?(0,U.jsx)(`p`,{className:`mt-3 line-clamp-2 border-t border-edge-subtle pt-3 text-xs leading-5 text-fg-muted`,children:e.blockedReason||e.nextAction}):null,(0,U.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-2`,children:[(0,U.jsx)(`span`,{className:`text-[11px] text-fg-subtle`,children:i?n.workHome.focusWatchActive:n.workHome.focusWatchInactive}),(0,U.jsxs)(`div`,{className:`flex gap-1`,children:[(0,U.jsx)(M,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:K===e.id,onClick:()=>void ge(e,`progress`),children:K===e.id?n.workHome.focusWatchUpdating:t?n.workHome.pauseProgressWatch:n.workHome.startFocusWatch}),(0,U.jsx)(M,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:K===e.id,onClick:()=>void ge(e,`intelligence`),children:K===e.id?n.workHome.focusWatchUpdating:r?n.workHome.pauseNewsWatch:n.workHome.startNewsWatch})]})]})]},e.id)})})]}):null,d.work.current.length===0&&d.workflowRuns.active.length===0&&d.decisions.length===0&&d.upcomingAutomations.length===0&&_.length===0?(0,U.jsxs)(`section`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center`,children:[(0,U.jsx)(N,{className:`mx-auto size-6 text-accent`,"aria-hidden":!0}),(0,U.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:n.workHome.emptyTitle}),(0,U.jsx)(`p`,{className:`mx-auto mt-1 max-w-lg text-sm leading-6 text-fg-muted`,children:n.workHome.emptyBody}),(0,U.jsxs)(`div`,{className:`mt-4 flex justify-center gap-2`,children:[(0,U.jsx)(M,{type:`button`,variant:`primary`,onClick:()=>r(`/chat/new`),children:n.workHome.startChat}),(0,U.jsx)(M,{type:`button`,variant:`secondary`,onClick:()=>z(!0),children:n.workHome.startLongWork})]})]}):null,(0,U.jsxs)(`div`,{className:`grid items-start gap-6 xl:grid-cols-[minmax(0,2fr)_minmax(18rem,1fr)]`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 space-y-6`,children:[Q.length>0?(0,U.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(s,{className:`size-4 text-warning`,"aria-hidden":!0}),(0,U.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.workHome.needsYou})]}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.workHome.needsYouHint}),(0,U.jsx)(`div`,{className:`mt-4 space-y-2`,children:Q.map(e=>(0,U.jsx)(Oe,{item:e,kindLabel:n.workHome.decisionKinds[e.kind],reasonLabel:n.workHome.decisionReasons[e.reason],approveLabel:n.workHome.approve,denyLabel:n.workHome.deny,busy:de===e.id,onRespond:t=>void he(e,t)},e.id))})]}):(0,U.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,U.jsx)(`span`,{className:`flex size-5 items-center justify-center rounded-full bg-success-soft text-xs text-success`,"aria-hidden":!0,children:`✓`}),n.workHome.nothingNeedsYou]}),(0,U.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(se,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),(0,U.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.workHome.continueTitle})]}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.workHome.continueHint}),(0,U.jsxs)(`div`,{className:`mt-4 divide-y divide-edge-subtle px-1`,children:[d.workflowRuns.active.map(e=>(0,U.jsxs)(a,{to:D(e.id),className:`flex items-center justify-between gap-3 rounded-lg px-2 py-3 text-sm hover:bg-surface-hover/55`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-accent`,"aria-hidden":!0}),(0,U.jsx)(`span`,{className:`truncate font-medium text-fg`,children:e.title})]}),(0,U.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.workHome.running})]},e.id)),$.map(e=>(0,U.jsx)(`div`,{className:`py-1`,children:(0,U.jsx)(De,{item:e,statusLabel:t.projectDetailPage.workItems.statuses[e.status]})},e.id)),d.workflowRuns.active.length===0&&$.length===0?(0,U.jsx)(`p`,{className:`py-6 text-center text-sm text-fg-muted`,children:n.workHome.noCurrentWork}):null]})]})]}),(0,U.jsxs)(`aside`,{className:`min-w-0 space-y-4`,"aria-label":n.workHome.nowTitle,children:[(0,U.jsxs)(`div`,{className:`px-1`,children:[(0,U.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.workHome.nowTitle}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.workHome.nowHint})]}),d.upcomingAutomations.length>0?(0,U.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-4 shadow-surface`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(oe,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),(0,U.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.workHome.scheduled})]}),(0,U.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle`,children:d.upcomingAutomations.slice(0,3).map(e=>(0,U.jsxs)(a,{to:`/automations`,className:`flex items-center justify-between gap-3 rounded-lg px-1 py-3 text-sm hover:bg-surface-hover/55`,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.name||e.action}),(0,U.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,children:Te(e.nextRunAt,n.never)})]},e.id))})]}):null,(0,U.jsx)(fe,{}),d.briefing.wins.length>0?(0,U.jsxs)(a,{to:d.briefing.wins[0].href,className:`flex items-center justify-between gap-3 rounded-xl px-2 py-2 text-sm text-fg-muted hover:bg-surface-hover/55 hover:text-fg`,children:[(0,U.jsx)(`span`,{children:we(n.workHome.completedSummary,{count:d.briefing.wins.length})}),(0,U.jsxs)(`span`,{className:`shrink-0 text-xs font-medium text-accent`,children:[n.workHome.viewLatestResult,` →`]})]}):null]})]})]}):null,(0,U.jsxs)(`section`,{className:`border-t border-edge-subtle pt-7`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.workHome.spacesTitle}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.workHome.spacesHint})]}),(0,U.jsx)(a,{to:`/projects`,className:`text-xs font-medium text-accent hover:underline`,children:n.management.viewAll})]}),p.filter(e=>e.status!==`archived`).length>6?(0,U.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,U.jsxs)(`label`,{className:`relative block min-w-0`,children:[(0,U.jsx)(ae,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,U.jsx)(`input`,{className:`h-9 w-52 rounded-lg border border-edge bg-surface-panel pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:L,onChange:e=>ce(e.target.value),placeholder:n.searchPlaceholder,"aria-label":n.searchPlaceholder})]})}):null,(0,U.jsx)(`div`,{className:`mt-4 grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:Z.map(e=>(0,U.jsx)(ke,{project:e,openLabel:n.workHome.openSpace,noDescription:n.noDescription},e.id))}),!S&&Z.length===0?(0,U.jsx)(`p`,{className:`py-8 text-center text-sm text-fg-muted`,children:n.workHome.noSpaces}):null]})]})}export{Ae as WorkPage};
|