@xopcai/xopc 0.0.172 → 0.0.174
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-C3Y-bESI.js → activity-store-CyEDJeIt.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CPyev9P7.js → agent-avatar-dicebear-DF7Bol6I.js} +1 -1
- package/dist/gateway/static/root/assets/agents-BVxEFPQ5.js +2 -0
- package/dist/gateway/static/root/assets/{api-B7qEr_Rw.js → api-DYunqroX.js} +1 -1
- package/dist/gateway/static/root/assets/api-DwyUxpgY.js +1 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-Br_9-7fs.js → app-management-settings-panel-B4xJyvDu.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-uyLcRPai.js → appearance-settings-B2PQxRiu.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-BtIgd82S.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-B19REnR5.js → archive-plugin-DWhBmmjD.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-DLWCC4Yi.js → attachment-load-BOpZfa_I.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-ky5S5lly.js → automation-suggestion-card-Byu3I7Rs.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-CG_SCH5b.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-CtPEzLlo.js → binary-plugins-6AG1qatz.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CQVR4Xij.js → block-editor-CJhrn98_.js} +5 -5
- package/dist/gateway/static/root/assets/browser-settings-page-CfLqPWZC.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-CimCGbhq.js → browser-workflow-inputs-CBVb4mt9.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-DewuCw3p.js → browser-workflows-page-Cq4XUKbu.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DCJmm6cR.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-B5RTs-Az.js → capability-presets-api-hbW4NAKO.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-CnkAYvWI.js +1 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-Czu0YzIZ.js → channel-recipient-api-CzMjHb17.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-DtqqFpDn.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-C-5yHbc0.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-Di3gnR_D.js → connector-logo-B9Au6gMZ.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-CaHfs8YF.js +2 -0
- package/dist/gateway/static/root/assets/copy-VueTIC2x.js +1 -0
- package/dist/gateway/static/root/assets/desktop-pet-CvFMKYdb.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-settings-C3L6AI8_.js → desktop-pet-settings-CNff5TFb.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-Dvq4iG6P.js → directory-picker-path-field-Bf956uo-.js} +1 -1
- package/dist/gateway/static/root/assets/dreaming-settings-CHM8FE1g.js +3 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-BecQjU0J.js → extension-debug-page-ZqM_0eUs.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BeVkPSm-.js → extension-page-D4hvXOMM.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DMoo2mKx.js → extension-settings-page-GsqxaJjA.js} +1 -1
- package/dist/gateway/static/root/assets/focus-detail-page-CE6uwrl1.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-api-Bthb3_6v.js → gateway-config-api-B4THmgnS.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-Bh8nPvJQ.js → gateway-settings-CPv-MxGE.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-D3USVm9D.js → gateway-startup-retry-MP3K71pP.js} +1 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-DAeb82xP.js +1 -0
- package/dist/gateway/static/root/assets/goal-detail-page-CwLSp01r.js +4 -0
- package/dist/gateway/static/root/assets/{goals-config-api-C_2QWBtb.js → goals-config-api-DCcDuIjG.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-DvJQ6_4M.js +2 -0
- package/dist/gateway/static/root/assets/{goals-settings-DhL643tc.js → goals-settings-o9QMXvNq.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-COVFwp7C.js → heartbeat-settings-DixwpXnH.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-BNQlnwpU.js → image-generation-api-BOGH9FGi.js} +1 -1
- package/dist/gateway/static/root/assets/index-CfXiRNN5.css +1 -0
- package/dist/gateway/static/root/assets/index-eyttVNS_.js +212 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DfdJRJVy.js → keyboard-shortcuts-settings-D4o4ZPF6.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CPcfqn_A.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-BvCPOgoi.js → local-apps-page-GzMmpO7G.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-BP0vD37A.js → locale-store-CAuhEGCn.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-DXABWCZp.js +7 -0
- package/dist/gateway/static/root/assets/{markdown-split-YO1rDk9m.js → markdown-split-CIX8D1pv.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CU_RRf-q.js → media-plugins-Bp3eIA45.js} +1 -1
- package/dist/gateway/static/root/assets/messages-BiBdO1-O.js +3 -0
- package/dist/gateway/static/root/assets/{notes-page-CeFiOK3S.js → notes-page-RVFiYAoO.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-DgJzZRX3.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-tiHmRJUA.js → page-tabs-BGAYH3Ef.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-CU6XgaCz.js → preview-open-alternatives-BM6pDkHp.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-Dn4_qor4.js → product-open-page-BiMetEmn.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-DF7F70Vg.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-Cw3jyi5s.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-ChAJsaNY.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-edDUIbXo.js → save-bar-controls-BdjV8MK5.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-DqJO_5Yb.js → schedule-field-ChlqXU46.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-CMh0jzy5.js → schema-form-DDKf5ZSH.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-BxZIxt7z.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DcDLS0xV.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-Bb0Bc3nJ.js → settings-form-section-CPG0KGVs.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-DQhADvz1.js → settings-loading-skeleton-DRSDHucM.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-b0M5HukN.js → settings-page-CeB7_xD0.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-hvjtIjvh.js → settings-page-layout-BENrkwd0.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-4Xa9NA7v.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-rbeaOpTg.js → share-preview-page-DIzczJkG.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-BpN0o5Cf.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-DvF2UAaL.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-CGKXpNfy.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-BHo_hgnL.js → system-settings-panel-Dp4d5Q1B.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-C3KnnjcU.js → theme-store-CbGc1laW.js} +1 -1
- package/dist/gateway/static/root/assets/{time-picker-D-G-uwVJ.js → time-picker-BhgCeDuO.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-DtRnG-YI.js → typed-models-lib-DwPk3OPL.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-CWWItX2g.js → use-channel-catalog-CXrEu2dw.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-Dy_fKAK_.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-BTnltQHZ.js → voice-api-key-field-DFoA79LB.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-page-BWkjb1NK.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-DLBNFse5.js +1 -0
- package/dist/gateway/static/root/assets/work-page-Bn5RXMIE.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-D7vKChFZ.js → workflow-run-setup-panel-BuniGPO0.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-_vFhRrAl.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 +3 -1
- package/dist/src/agent/agent-manager.js +4 -3
- package/dist/src/agent/capabilities/definitions.d.ts +2 -1
- package/dist/src/agent/capabilities/definitions.js +3 -1
- package/dist/src/agent/prompt/sections/tooling.js +4 -0
- package/dist/src/agent/service.d.ts +2 -1
- package/dist/src/agent/service.js +26 -0
- package/dist/src/agent/skills/hub-pull.js +1 -1
- package/dist/src/agent/skills/index.js +1 -1
- package/dist/src/agent/skills/install-target.js +1 -1
- package/dist/src/agent/skills/marketplace/adapters/clawhub/adapter.d.ts +64 -0
- package/dist/src/agent/skills/marketplace/adapters/clawhub/adapter.js +27 -18
- package/dist/src/agent/skills/marketplace/adapters/store/adapter.js +1 -1
- package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.js +1 -1
- package/dist/src/agent/skills/marketplace/search.d.ts +46 -0
- package/dist/src/agent/skills/marketplace/search.js +193 -0
- package/dist/src/agent/skills/skill-tool-gating.js +2 -1
- package/dist/src/agent/tools/delegate-tool.js +2 -0
- package/dist/src/agent/tools/factory.d.ts +4 -2
- package/dist/src/agent/tools/factory.js +11 -5
- package/dist/src/agent/tools/index.d.ts +2 -1
- package/dist/src/agent/tools/index.js +2 -1
- package/dist/src/agent/tools/skill-install-tool.d.ts +17 -0
- package/dist/src/agent/tools/skill-install-tool.js +76 -8
- package/dist/src/agent/tools/skills-marketplace-search-tool.d.ts +17 -0
- package/dist/src/agent/tools/skills-marketplace-search-tool.js +77 -0
- package/dist/src/browser/providers/cloakbrowser.js +1 -1
- package/dist/src/capabilities/store-connector.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/extensions/api.js +1 -1
- package/dist/src/extensions/install.js +1 -1
- package/dist/src/focuses/candidate-repository.d.ts +15 -0
- package/dist/src/focuses/candidate-repository.js +91 -0
- package/dist/src/focuses/index.d.ts +7 -0
- package/dist/src/focuses/index.js +7 -0
- package/dist/src/focuses/insight-repository.d.ts +22 -0
- package/dist/src/focuses/insight-repository.js +77 -0
- package/dist/src/focuses/prompts.d.ts +2 -0
- package/dist/src/focuses/prompts.js +18 -0
- package/dist/src/focuses/reconciler.d.ts +5 -0
- package/dist/src/focuses/reconciler.js +26 -0
- package/dist/src/focuses/repository.d.ts +61 -0
- package/dist/src/focuses/repository.js +214 -0
- package/dist/src/focuses/run-processor.d.ts +18 -0
- package/dist/src/focuses/run-processor.js +162 -0
- package/dist/src/focuses/service.d.ts +42 -0
- package/dist/src/focuses/service.js +241 -0
- package/dist/src/focuses/types.d.ts +89 -0
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/agent-builtin-tools.js +2 -0
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/hono/routes/commands-skills.js +2 -2
- package/dist/src/gateway/hono/routes/focuses.d.ts +3 -0
- package/dist/src/gateway/hono/routes/focuses.js +319 -0
- package/dist/src/gateway/hono/routes/home.js +15 -17
- package/dist/src/gateway/hono/routes/index.js +2 -0
- package/dist/src/gateway/hono/routes/projects.js +2 -103
- package/dist/src/gateway/hono/routes/work-discovery.js +0 -239
- package/dist/src/gateway/service/marketplace-service.js +1 -1
- package/dist/src/gateway/service.d.ts +1 -1
- package/dist/src/gateway/service.js +15 -11
- package/dist/src/storage/sqlite/migrations/066_first_class_focuses.sql +126 -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/schema.js +1 -1
- package/dist/src/work-discovery/index.d.ts +0 -2
- package/dist/src/work-discovery/index.js +1 -3
- package/dist/src/work-discovery/service.d.ts +0 -30
- package/dist/src/work-discovery/service.js +1 -35
- package/dist/src/work-discovery/thread-service.d.ts +5 -0
- package/dist/src/work-discovery/thread-service.js +36 -88
- package/package.json +1 -1
- package/skills/tools/find-skills/SKILL.md +18 -428
- package/dist/gateway/static/root/assets/agents-Bf_kK2Ay.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-DXFCP5-1.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-D8pT1o2O.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-Bav_skKN.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BHaYYo9E.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-BgchTh81.js +0 -1
- package/dist/gateway/static/root/assets/channels-settings-BP0e62wt.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-DBWKfeGe.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-CC5kh0de.js +0 -2
- package/dist/gateway/static/root/assets/desktop-pet-D-ZUNHhn.js +0 -1
- package/dist/gateway/static/root/assets/dreaming-settings-D9i54kWO.js +0 -3
- package/dist/gateway/static/root/assets/goal-create-dialog-Dp0AyDHI.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-CNt7nrdS.js +0 -4
- package/dist/gateway/static/root/assets/goals-page-Bm_NZFiZ.js +0 -2
- package/dist/gateway/static/root/assets/index-C_XSKOH6.css +0 -1
- package/dist/gateway/static/root/assets/index-DUasAutC.js +0 -212
- package/dist/gateway/static/root/assets/local-app-workbench-page-DZwkD1co.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-dNL0Y1dA.js +0 -7
- package/dist/gateway/static/root/assets/messages-BWtP5TFz.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-B8MKxpZb.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-CWBuuX-S.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-BJSsLsXH.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-DXJDb8vB.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-DeHpWgxM.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-Cf-TEYUd.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BFyfed_g.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-CYnH9sTt.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Cr8_m-jS.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-Chtc1xDO.js +0 -2
- package/dist/gateway/static/root/assets/user-context-page-D7qMR26X.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-CpqFZze9.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-t4dXpGC0.js +0 -1
- package/dist/gateway/static/root/assets/work-page-BXwDKiMZ.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-Bos9HyqT.js +0 -11
- package/dist/src/proactive/calendar-signals.d.ts +0 -4
- package/dist/src/proactive/calendar-signals.js +0 -120
- package/dist/src/proactive/focus-service.d.ts +0 -62
- package/dist/src/proactive/focus-service.js +0 -173
- package/dist/src/proactive/index.d.ts +0 -7
- package/dist/src/proactive/index.js +0 -7
- package/dist/src/proactive/insight-repository.d.ts +0 -21
- package/dist/src/proactive/insight-repository.js +0 -109
- package/dist/src/proactive/run-processor.d.ts +0 -19
- package/dist/src/proactive/run-processor.js +0 -146
- package/dist/src/proactive/trial-expiry-reconciler.d.ts +0 -5
- package/dist/src/proactive/trial-expiry-reconciler.js +0 -30
- package/dist/src/proactive/types.d.ts +0 -66
- package/dist/src/proactive/value-score.d.ts +0 -13
- package/dist/src/proactive/value-score.js +0 -30
- package/dist/src/proactive/watch-repository.d.ts +0 -28
- package/dist/src/proactive/watch-repository.js +0 -129
- package/dist/src/work-discovery/governance.d.ts +0 -25
- package/dist/src/work-discovery/governance.js +0 -96
- package/dist/src/work-discovery/thread-repository.d.ts +0 -34
- package/dist/src/work-discovery/thread-repository.js +0 -112
- /package/dist/src/{proactive → focuses}/types.js +0 -0
|
@@ -1,4 +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{d as i,f as a,l as o,t as s}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as c}from"./cn-JdwAhgNB.js";import{t as l}from"./messages-BWtP5TFz.js";import{n as u,r as d,s as f}from"./locale-store-BP0vD37A.js";import{$s as p,A as m,Bu as h,C as g,Dc as _,Eo as v,F as y,Fl as b,Hl as x,Hu as S,Jl as C,Lu as w,Ou as T,Pc as E,Pl as D,Ps as O,R as k,Ul as A,Xs as j,Ys as ee,_ as M,_t as N,_u as te,du as P,ec as F,fl as ne,gu as I,hu as re,io as L,iu as R,k as z,ls as B,ss as ie,uu as ae,vt as oe,xc as V,y as se,yu as ce}from"./index-DUasAutC.js";import{t as le}from"./automation-suggestion-card-ky5S5lly.js";var ue=n(),H=e(t(),1),U=r();function de(e){return e.split(`
|
|
2
|
-
`).map(e=>e.trim()).filter(Boolean)}function fe(){let e=(0,ue.c)(7),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(L,{className:`h-5 w-20 rounded-full`}),(0,U.jsx)(L,{className:`h-4 w-28`}),(0,U.jsx)(L,{className:`h-4 w-24`})]}),n=(0,U.jsx)(L,{className:`mt-4 h-4 w-full max-w-3xl`}),r=(0,U.jsx)(L,{className:`mt-2 h-4 w-2/3 max-w-2xl`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,U.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[t,n,r,(0,U.jsxs)(`div`,{className:`mt-4 grid gap-3 md:grid-cols-3`,children:[(0,U.jsx)(L,{className:`h-16 rounded-md`}),(0,U.jsx)(L,{className:`h-16 rounded-md`}),(0,U.jsx)(L,{className:`h-16 rounded-md`})]})]}),e[3]=i):i=e[3];let a;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,U.jsx)(L,{className:`h-4 w-32`}),e[4]=a):a=e[4];let o;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,U.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[a,(0,U.jsx)(`div`,{className:`mt-4 grid gap-3`,children:Array.from({length:5}).map(W)})]}),e[5]=o):o=e[5];let s;return e[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,U.jsxs)(`div`,{className:`grid gap-4`,"aria-hidden":`true`,children:[i,(0,U.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[o,(0,U.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[(0,U.jsx)(L,{className:`h-4 w-28`}),(0,U.jsx)(L,{className:`mt-4 h-24 rounded-md`}),(0,U.jsx)(L,{className:`mt-3 h-24 rounded-md`})]})]})]}),e[6]=s):s=e[6],s}function W(e,t){return(0,U.jsx)(L,{className:`h-14 rounded-md`},t)}var G=`min-w-0 rounded-md border border-edge bg-surface-muted px-3 py-2 text-sm text-fg placeholder:text-fg-muted focus-visible:border-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`,pe=[`message`,`link`,`file`,`diff`,`command`,`test`,`artifact`];function me(e){return e===`command`||e===`test`?p:e===`diff`?R:e===`file`||e===`artifact`?x:e===`link`?C:V}function he(e){return e.data&&typeof e.data==`object`&&!Array.isArray(e.data)?e.data:{}}function ge(e,t){let n=e[t];return typeof n==`string`&&n.trim()?n:void 0}function K(e,t){let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0}function _e(e){let t=(0,ue.c)(57),{item:n,language:r,t:i}=e,a;t[0]===n.kind?a=t[1]:(a=me(n.kind),t[0]=n.kind,t[1]=a);let o=a,s,c,l,u,d,f,p,m,h;if(t[2]!==o||t[3]!==n||t[4]!==r||t[5]!==i){let e=he(n),a=ge(e,`command`),g=K(e,`exitCode`),_=ge(e,`path`)||n.uri,v=K(e,`outputBytes`);s=e.fuzzyMatchUsed===!0,f=`rounded-md bg-surface-muted/40 px-2.5 py-2`;let y;t[15]===o?y=t[16]:(y=(0,U.jsx)(o,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),t[15]=o,t[16]=y);let b;t[17]===n.title?b=t[18]:(b=(0,U.jsx)(`p`,{className:`break-words font-medium text-fg`,children:n.title}),t[17]=n.title,t[18]=b);let x=_?(0,U.jsx)(`p`,{className:`mt-1 break-all text-xs text-fg-muted`,children:_}):null,S;t[19]!==b||t[20]!==x?(S=(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[b,x]}),t[19]=b,t[20]=x,t[21]=S):S=t[21];let C;t[22]!==y||t[23]!==S?(C=(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-2`,children:[y,S]}),t[22]=y,t[23]=S,t[24]=C):C=t[24];let w;t[25]!==n.kind||t[26]!==i?(w=Oe(n.kind,i),t[25]=n.kind,t[26]=i,t[27]=w):w=t[27];let T;t[28]===w?T=t[29]:(T=(0,U.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:w}),t[28]=w,t[29]=T),t[30]!==C||t[31]!==T?(p=(0,U.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[C,T]}),t[30]=C,t[31]=T,t[32]=p):p=t[32],m=a?(0,U.jsx)(`pre`,{className:`mt-2 overflow-x-auto rounded-md bg-surface-panel px-2 py-1.5 text-xs text-fg`,children:(0,U.jsx)(`code`,{children:a})}):null,t[33]!==n.kind||t[34]!==n.summary?(h=n.summary?n.kind===`diff`?(0,U.jsx)(`pre`,{className:`mt-2 max-h-56 overflow-auto whitespace-pre-wrap rounded-md bg-surface-panel px-2 py-1.5 text-xs text-fg-muted`,children:(0,U.jsx)(`code`,{children:n.summary})}):(0,U.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap break-words text-xs text-fg-muted`,children:n.summary}):null,t[33]=n.kind,t[34]=n.summary,t[35]=h):h=t[35],c=`mt-2 flex flex-wrap items-center gap-2 text-xs text-fg-muted`;let E;t[36]!==n.createdAt||t[37]!==r||t[38]!==i?(E=xe(n.createdAt,r,i),t[36]=n.createdAt,t[37]=r,t[38]=i,t[39]=E):E=t[39],t[40]===E?l=t[41]:(l=(0,U.jsx)(`time`,{children:E}),t[40]=E,t[41]=l),u=g==null?null:(0,U.jsx)(`span`,{children:q(i.exitCode,{code:g})}),d=v==null?null:(0,U.jsx)(`span`,{children:q(i.outputBytes,{bytes:v})}),t[2]=o,t[3]=n,t[4]=r,t[5]=i,t[6]=s,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p,t[13]=m,t[14]=h}else s=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11],p=t[12],m=t[13],h=t[14];let g;t[42]!==s||t[43]!==i?(g=s?(0,U.jsx)(`span`,{children:i.fuzzyMatch}):null,t[42]=s,t[43]=i,t[44]=g):g=t[44];let _;t[45]!==g||t[46]!==c||t[47]!==l||t[48]!==u||t[49]!==d?(_=(0,U.jsxs)(`div`,{className:c,children:[l,u,d,g]}),t[45]=g,t[46]=c,t[47]=l,t[48]=u,t[49]=d,t[50]=_):_=t[50];let v;return t[51]!==_||t[52]!==f||t[53]!==p||t[54]!==m||t[55]!==h?(v=(0,U.jsxs)(`li`,{className:f,children:[p,m,h,_]}),t[51]=_,t[52]=f,t[53]=p,t[54]=m,t[55]=h,t[56]=v):v=t[56],v}function ve(e){return e===`active`?`border-accent/40 bg-accent-soft text-accent-fg`:e===`done`?`border-edge bg-surface-muted text-fg-muted`:e===`blocked`||e===`needs_input`?`border-amber-500/40 bg-amber-500/10 text-amber-700 dark:text-amber-300`:`border-edge bg-surface-panel text-fg-muted`}function ye(e){return e===`succeeded`?`border-emerald-500/40 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`||e===`timeout`?`border-destructive/40 bg-destructive/10 text-destructive`:e===`cancelled`?`border-amber-500/40 bg-amber-500/10 text-amber-700 dark:text-amber-300`:`border-accent/40 bg-accent-soft text-accent-fg`}function be(e){return e===`workflow_run`?D:e===`goal_run`?T:e===`queue`?re:e===`evidence`?x:S}function q(e,t){return Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{{${t}}}`,String(n)),e)}function J(e){return e===`zh`?`zh-CN`:`en-US`}function xe(e,t,n){return e?oe(e,J(t)):n.notSet}function Se(e,t,n){return e?N(e,J(t)):n.noDeadline}function Ce(e,t){return e===`blocked`||e===`needs_input`?t.primaryActions.resolveBlocker:e===`paused`?t.primaryActions.resume:e===`done`?t.primaryActions.completed:e===`archived`?t.primaryActions.archived:t.primaryActions.continue}function we(e){return e===`completed`?`✓`:e===`impossible`?`!`:`○`}function Te(e){return e===`all`||e===`queue`||e===`goal_run`||e===`workflow_run`||e===`event`||e===`evidence`}function Ee(e,t){return e?t.statuses[e]??e:``}function De(e,t){return t.priorities[e]??e}function Oe(e,t){return t.evidenceKinds[e]??e}function ke(e){return!e||e.currentValue==null?!1:e.direction===`increase`?e.currentValue>=e.targetValue:e.currentValue<=e.targetValue}function Ae(e){if(!e.trim())return;let t=Number(e);return Number.isFinite(t)?t:void 0}function je(e,t,n){let r=e.evidenceRequirements.some(e=>e.status!==`approved`),i=!!(e.contract?.outcomeMetric&&!ke(e.contract.outcomeMetric));if(e.status===`done`&&(r||i||t?.verdict===`continue`))return{title:n.progressPanel.executionFinishedTitle,body:n.progressPanel.executionFinishedFallback,tone:`attention`,needsReview:!0};if(e.status===`blocked`)return{title:n.progressPanel.blockedTitle,body:e.blockedReason||n.progressPanel.blockedFallback,tone:`attention`,needsReview:!1};if(e.status===`needs_input`){let t=e.blockedReason?.startsWith(`Completion review required`);return{title:t?n.progressPanel.executionFinishedTitle:n.progressPanel.needsInputTitle,body:t?n.progressPanel.executionFinishedFallback:e.blockedReason||e.nextAction||n.progressPanel.needsInputFallback,tone:`attention`,needsReview:!!t}}return e.status===`paused`?{title:n.progressPanel.pausedTitle,body:e.blockedReason||n.progressPanel.pausedFallback,tone:`normal`,needsReview:!1}:e.status===`done`?{title:n.progressPanel.doneTitle,body:n.progressPanel.doneFallback,tone:`done`,needsReview:!1}:e.status===`archived`?{title:n.progressPanel.archivedTitle,body:n.progressPanel.archivedFallback,tone:`normal`,needsReview:!1}:{title:n.progressPanel.activeTitle,body:e.nextAction||n.noNextAction,tone:`normal`,needsReview:!1}}function Me(e,t){return t<=0?0:Math.min(100,Math.max(0,Math.round(e/t*100)))}function Ne(e){let t=(0,ue.c)(210),{goal:n,latestRun:r,done:i,total:a,evidence:o,language:s,t:l,busy:u,primaryActionDisabled:d,onContinue:f,onOpenChat:p,onPause:m,onConfigureOutcome:h,onReviewEvidence:g}=e,_;t[0]!==n||t[1]!==r||t[2]!==l?(_=je(n,r,l),t[0]=n,t[1]=r,t[2]=l,t[3]=_):_=t[3];let v=_,y,x,S,w,T,E,D,k,A,j,M,N,P,ne;if(t[4]!==i||t[5]!==o||t[6]!==n.contract?.outcomeMetric||t[7]!==n.deadlineAt||t[8]!==n.evidenceRequirements||t[9]!==n.priority||t[10]!==n.status||t[11]!==s||t[12]!==r||t[13]!==g||t[14]!==v.body||t[15]!==v.needsReview||t[16]!==v.title||t[17]!==v.tone||t[18]!==l||t[19]!==a){let e=n.evidenceRequirements.filter(Ie).length,u=n.evidenceRequirements.length,d,f,p,m,h;if(t[34]!==i||t[35]!==n.contract?.outcomeMetric||t[36]!==n.deadlineAt||t[37]!==n.evidenceRequirements||t[38]!==n.priority||t[39]!==n.status||t[40]!==s||t[41]!==r||t[42]!==v.body||t[43]!==v.needsReview||t[44]!==v.title||t[45]!==v.tone||t[46]!==l||t[47]!==a){x=n.evidenceRequirements.filter(Fe).slice(0,2);let e;t[58]!==i||t[59]!==a?(e=Me(i,a),t[58]=i,t[59]=a,t[60]=e):e=t[60],d=e,y=n.contract?.outcomeMetric,S=ke(y);let o=v.tone===`attention`?ee:v.tone===`done`?te:re;E=`rounded-lg border border-edge-subtle bg-surface-base p-4 shadow-surface`,w=`grid gap-5`,f=`min-w-0`;let u;t[61]!==n.status||t[62]!==v.needsReview?(u=c(`rounded-full border px-2 py-0.5 text-xs`,ve(v.needsReview?`needs_input`:n.status)),t[61]=n.status,t[62]=v.needsReview,t[63]=u):u=t[63];let g;t[64]!==n.status||t[65]!==v.needsReview||t[66]!==l?(g=v.needsReview?l.progressPanel.reviewPendingLabel:Ee(n.status,l),t[64]=n.status,t[65]=v.needsReview,t[66]=l,t[67]=g):g=t[67];let _;t[68]!==u||t[69]!==g?(_=(0,U.jsx)(`span`,{className:u,children:g}),t[68]=u,t[69]=g,t[70]=_):_=t[70];let b;t[71]!==n.priority||t[72]!==l?(b=q(l.prioritySummary,{priority:De(n.priority,l)}),t[71]=n.priority,t[72]=l,t[73]=b):b=t[73];let C;t[74]===b?C=t[75]:(C=(0,U.jsx)(`span`,{className:`text-xs text-fg-muted`,children:b}),t[74]=b,t[75]=C);let T;t[76]!==n.deadlineAt||t[77]!==s||t[78]!==l?(T=n.deadlineAt?Se(n.deadlineAt,s,l):l.noDeadline,t[76]=n.deadlineAt,t[77]=s,t[78]=l,t[79]=T):T=t[79];let D;t[80]===T?D=t[81]:(D=(0,U.jsx)(`span`,{className:`text-xs text-fg-muted`,children:T}),t[80]=T,t[81]=D),t[82]!==_||t[83]!==C||t[84]!==D?(p=(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[_,C,D]}),t[82]=_,t[83]=C,t[84]=D,t[85]=p):p=t[85];let O=v.tone===`attention`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:v.tone===`done`?`bg-success-soft text-success`:`bg-accent-soft text-accent-fg`,k;t[86]===O?k=t[87]:(k=c(`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg`,O),t[86]=O,t[87]=k);let A;t[88]===o?A=t[89]:(A=(0,U.jsx)(o,{className:`size-5`,"aria-hidden":!0}),t[88]=o,t[89]=A);let j;t[90]!==k||t[91]!==A?(j=(0,U.jsx)(`div`,{className:k,children:A}),t[90]=k,t[91]=A,t[92]=j):j=t[92];let M;t[93]===v.title?M=t[94]:(M=(0,U.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:v.title}),t[93]=v.title,t[94]=M);let N;t[95]===v.body?N=t[96]:(N=(0,U.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words text-sm text-fg-muted`,children:v.body}),t[95]=v.body,t[96]=N);let P;t[97]!==s||t[98]!==r||t[99]!==l?(P=r?.reason?(0,U.jsx)(`p`,{className:`mt-2 line-clamp-2 break-words text-xs text-fg-subtle`,children:q(l.progressPanel.lastCheck,{time:xe(r.finishedAt??r.startedAt,s,l),reason:r.reason})}):null,t[97]=s,t[98]=r,t[99]=l,t[100]=P):P=t[100];let F;t[101]!==M||t[102]!==N||t[103]!==P?(F=(0,U.jsxs)(`div`,{className:`min-w-0`,children:[M,N,P]}),t[101]=M,t[102]=N,t[103]=P,t[104]=F):F=t[104],t[105]!==j||t[106]!==F?(m=(0,U.jsxs)(`div`,{className:`mt-3 flex items-start gap-3`,children:[j,F]}),t[105]=j,t[106]=F,t[107]=m):m=t[107],h=x.length?(0,U.jsxs)(`div`,{className:`mt-4 rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2`,children:[(0,U.jsx)(`p`,{className:`text-xs font-medium text-amber-800 dark:text-amber-200`,children:l.progressPanel.evidenceNeeded}),(0,U.jsx)(`ul`,{className:`mt-1 grid gap-1 text-xs text-amber-800 dark:text-amber-200`,children:x.map(Pe)})]}):null,t[34]=i,t[35]=n.contract?.outcomeMetric,t[36]=n.deadlineAt,t[37]=n.evidenceRequirements,t[38]=n.priority,t[39]=n.status,t[40]=s,t[41]=r,t[42]=v.body,t[43]=v.needsReview,t[44]=v.title,t[45]=v.tone,t[46]=l,t[47]=a,t[48]=d,t[49]=y,t[50]=x,t[51]=S,t[52]=w,t[53]=E,t[54]=f,t[55]=p,t[56]=m,t[57]=h}else d=t[48],y=t[49],x=t[50],S=t[51],w=t[52],E=t[53],f=t[54],p=t[55],m=t[56],h=t[57];t[108]!==f||t[109]!==p||t[110]!==m||t[111]!==h?(T=(0,U.jsxs)(`div`,{className:f,children:[p,m,h]}),t[108]=f,t[109]=p,t[110]=m,t[111]=h,t[112]=T):T=t[112],P=`grid gap-3 md:grid-cols-3`;let _;t[113]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,U.jsx)(b,{className:`size-4`,"aria-hidden":!0}),t[113]=_):_=t[113];let C;t[114]===l.progressPanel.execution?C=t[115]:(C=(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[_,l.progressPanel.execution]}),t[114]=l.progressPanel.execution,t[115]=C);let O;t[116]!==i||t[117]!==l.checklistProgress||t[118]!==l.notSet||t[119]!==a?(O=a?q(l.checklistProgress,{done:i,total:a}):l.notSet,t[116]=i,t[117]=l.checklistProgress,t[118]=l.notSet,t[119]=a,t[120]=O):O=t[120];let F;t[121]===O?F=t[122]:(F=(0,U.jsx)(`p`,{className:`mt-2 text-lg font-semibold tabular-nums text-fg`,children:O}),t[121]=O,t[122]=F);let I=`${d}%`,L;t[123]===I?L=t[124]:(L=(0,U.jsx)(`div`,{className:`mt-2 h-1.5 overflow-hidden rounded-full bg-surface-hover`,children:(0,U.jsx)(`div`,{className:`h-full rounded-full bg-accent`,style:{width:I}})}),t[123]=I,t[124]=L),t[125]!==C||t[126]!==F||t[127]!==L?(ne=(0,U.jsxs)(`div`,{className:`rounded-lg border border-edge-subtle bg-surface-panel/70 p-3`,children:[C,F,L]}),t[125]=C,t[126]=F,t[127]=L,t[128]=ne):ne=t[128],A=`button`,j=`rounded-lg border border-edge-subtle bg-surface-panel/70 p-3 text-left transition-colors hover:bg-surface-hover`,M=g;let R;t[129]===l.progressPanel.evidence?R=t[130]:(R=(0,U.jsx)(`span`,{children:l.progressPanel.evidence}),t[129]=l.progressPanel.evidence,t[130]=R);let z;t[131]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,U.jsx)(ce,{className:`size-4`,"aria-hidden":!0}),t[131]=z):z=t[131],t[132]===R?N=t[133]:(N=(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-xs font-medium text-fg-muted`,children:[R,z]}),t[132]=R,t[133]=N),D=`mt-2 text-lg font-semibold tabular-nums text-fg`,k=u?q(l.evidenceRequirementProgress,{approved:e,total:u}):q(l.progressPanel.evidenceCount,{count:o.length}),t[4]=i,t[5]=o,t[6]=n.contract?.outcomeMetric,t[7]=n.deadlineAt,t[8]=n.evidenceRequirements,t[9]=n.priority,t[10]=n.status,t[11]=s,t[12]=r,t[13]=g,t[14]=v.body,t[15]=v.needsReview,t[16]=v.title,t[17]=v.tone,t[18]=l,t[19]=a,t[20]=y,t[21]=x,t[22]=S,t[23]=w,t[24]=T,t[25]=E,t[26]=D,t[27]=k,t[28]=A,t[29]=j,t[30]=M,t[31]=N,t[32]=P,t[33]=ne}else y=t[20],x=t[21],S=t[22],w=t[23],T=t[24],E=t[25],D=t[26],k=t[27],A=t[28],j=t[29],M=t[30],N=t[31],P=t[32],ne=t[33];let L;t[134]!==D||t[135]!==k?(L=(0,U.jsx)(`p`,{className:D,children:k}),t[134]=D,t[135]=k,t[136]=L):L=t[136];let R=x.length?l.progressPanel.reviewNeeded:l.progressPanel.reviewComplete,z;t[137]===R?z=t[138]:(z=(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:R}),t[137]=R,t[138]=z);let B;t[139]!==L||t[140]!==z||t[141]!==A||t[142]!==j||t[143]!==M||t[144]!==N?(B=(0,U.jsxs)(`button`,{type:A,className:j,onClick:M,children:[N,L,z]}),t[139]=L,t[140]=z,t[141]=A,t[142]=j,t[143]=M,t[144]=N,t[145]=B):B=t[145];let ie=y&&S?`border-success/30 bg-success-soft/40`:`border-edge-subtle bg-surface-panel/70`,ae;t[146]===ie?ae=t[147]:(ae=c(`rounded-lg border p-3 text-left transition-colors hover:bg-surface-hover`,ie),t[146]=ie,t[147]=ae);let oe;t[148]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,U.jsx)(F,{className:`size-4`,"aria-hidden":!0}),t[148]=oe):oe=t[148];let V;t[149]===l.progressPanel.outcome?V=t[150]:(V=(0,U.jsxs)(`span`,{className:`flex items-center gap-2`,children:[oe,l.progressPanel.outcome]}),t[149]=l.progressPanel.outcome,t[150]=V);let se;t[151]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,U.jsx)(ce,{className:`size-4`,"aria-hidden":!0}),t[151]=se):se=t[151];let le;t[152]===V?le=t[153]:(le=(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-xs font-medium text-fg-muted`,children:[V,se]}),t[152]=V,t[153]=le);let H;t[154]!==y||t[155]!==l.progressPanel.currentMissing||t[156]!==l.progressPanel.outcomeNotSet||t[157]!==l.progressPanel.outcomeSummary?(H=y?q(l.progressPanel.outcomeSummary,{baseline:y.baselineValue,current:y.currentValue??l.progressPanel.currentMissing,target:y.targetValue,unit:y.unit?` ${y.unit}`:``}):l.progressPanel.outcomeNotSet,t[154]=y,t[155]=l.progressPanel.currentMissing,t[156]=l.progressPanel.outcomeNotSet,t[157]=l.progressPanel.outcomeSummary,t[158]=H):H=t[158];let de;t[159]===H?de=t[160]:(de=(0,U.jsx)(`p`,{className:`mt-2 truncate text-lg font-semibold tabular-nums text-fg`,children:H}),t[159]=H,t[160]=de);let fe=y?y.name:l.progressPanel.outcomeNotSetHint,W;t[161]===fe?W=t[162]:(W=(0,U.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:fe}),t[161]=fe,t[162]=W);let G;t[163]!==h||t[164]!==ae||t[165]!==le||t[166]!==de||t[167]!==W?(G=(0,U.jsxs)(`button`,{type:`button`,className:ae,onClick:h,children:[le,de,W]}),t[163]=h,t[164]=ae,t[165]=le,t[166]=de,t[167]=W,t[168]=G):G=t[168];let pe;t[169]!==B||t[170]!==G||t[171]!==P||t[172]!==ne?(pe=(0,U.jsxs)(`div`,{className:P,children:[ne,B,G]}),t[169]=B,t[170]=G,t[171]=P,t[172]=ne,t[173]=pe):pe=t[173];let me;t[174]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,U.jsx)(re,{className:`size-4`,"aria-hidden":!0}),t[174]=me):me=t[174];let he;t[175]!==n.nextAction||t[176]!==n.status||t[177]!==v.needsReview||t[178]!==l?(he=v.needsReview&&n.nextAction?l.progressPanel.continueExecution:Ce(n.status,l),t[175]=n.nextAction,t[176]=n.status,t[177]=v.needsReview,t[178]=l,t[179]=he):he=t[179];let ge;t[180]!==f||t[181]!==d||t[182]!==he?(ge=(0,U.jsxs)(O,{type:`button`,variant:`primary`,className:`h-9 flex-1 rounded-lg`,disabled:d,onClick:f,children:[me,he]}),t[180]=f,t[181]=d,t[182]=he,t[183]=ge):ge=t[183];let K;t[184]!==x.length||t[185]!==g||t[186]!==l.progressPanel.reviewEvidenceAction?(K=x.length?(0,U.jsx)(O,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg`,onClick:g,children:l.progressPanel.reviewEvidenceAction}):null,t[184]=x.length,t[185]=g,t[186]=l.progressPanel.reviewEvidenceAction,t[187]=K):K=t[187];let _e;t[188]!==n.activeSessionKey||t[189]!==p||t[190]!==l.chat?(_e=n.activeSessionKey?(0,U.jsx)(O,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-2.5`,"aria-label":l.chat,onClick:p,children:(0,U.jsx)(C,{className:`size-4`,"aria-hidden":!0})}):null,t[188]=n.activeSessionKey,t[189]=p,t[190]=l.chat,t[191]=_e):_e=t[191];let ye=u!=null||n.status!==`active`,be;t[192]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,U.jsx)(I,{className:`size-4`,"aria-hidden":!0}),t[192]=be):be=t[192];let J;t[193]!==m||t[194]!==l.pause||t[195]!==ye?(J=(0,U.jsx)(O,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg px-2.5`,"aria-label":l.pause,disabled:ye,onClick:m,children:be}),t[193]=m,t[194]=l.pause,t[195]=ye,t[196]=J):J=t[196];let we;t[197]!==ge||t[198]!==K||t[199]!==_e||t[200]!==J?(we=(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-t border-edge-subtle pt-4`,children:[ge,K,_e,J]}),t[197]=ge,t[198]=K,t[199]=_e,t[200]=J,t[201]=we):we=t[201];let Te;t[202]!==w||t[203]!==T||t[204]!==pe||t[205]!==we?(Te=(0,U.jsxs)(`div`,{className:w,children:[T,pe,we]}),t[202]=w,t[203]=T,t[204]=pe,t[205]=we,t[206]=Te):Te=t[206];let Oe;return t[207]!==E||t[208]!==Te?(Oe=(0,U.jsx)(`section`,{className:E,children:Te}),t[207]=E,t[208]=Te,t[209]=Oe):Oe=t[209],Oe}function Pe(e){return(0,U.jsxs)(`li`,{className:`break-words`,children:[`- `,e.text]},e.id)}function Fe(e){return e.status!==`approved`}function Ie(e){return e.status===`approved`}function Le(e){let t=e?.trim();return!t||!t.startsWith(`/projects/`)||t.startsWith(`//`)||t.includes(`://`)?`/goals`:t}async function Re(e){return(await f(d(`/api/goals/${encodeURIComponent(e)}`))).goal}async function ze(e){return(await f(d(`/api/goals/${encodeURIComponent(e)}/runs?limit=100`))).runs}async function Be(e){return(await f(d(`/api/goals/${encodeURIComponent(e)}/evidence?limit=100`))).evidence}async function Ve(e){return(await f(d(`/api/goals/${encodeURIComponent(e)}/activity?limit=120`))).activities}async function He(e){return(await f(d(`/api/goals/${encodeURIComponent(e)}/workflow-suggestions`))).suggestions}function Ue(){let{goalId:e=``}=i(),t=o(),n=u(e=>e.language),r=l(n).goalDetailPage,p=l(n).automations.suggestions,b=v(e=>e.setPageHeader),x=v(e=>e.clearPageHeader),[T,ee]=a(),[N,I]=(0,H.useState)(null),[R,oe]=(0,H.useState)([]),[V,ue]=(0,H.useState)([]),[W,me]=(0,H.useState)([]),[K,ve]=(0,H.useState)([]),[J,Ce]=(0,H.useState)([]),[De,Me]=(0,H.useState)([]),[Pe,Fe]=(0,H.useState)(``),[Ie,Ue]=(0,H.useState)(`message`),[We,Ge]=(0,H.useState)(``),[Ke,qe]=(0,H.useState)(``),[Je,Ye]=(0,H.useState)(``),[Xe,Ze]=(0,H.useState)(``),[Qe,$e]=(0,H.useState)(``),[et,tt]=(0,H.useState)(``),[nt,rt]=(0,H.useState)(`normal`),[it,at]=(0,H.useState)(``),[ot,st]=(0,H.useState)(`10`),[ct,lt]=(0,H.useState)(``),[ut,dt]=(0,H.useState)(``),[ft,pt]=(0,H.useState)(``),[mt,ht]=(0,H.useState)(``),[gt,_t]=(0,H.useState)(``),[vt,yt]=(0,H.useState)(``),[bt,xt]=(0,H.useState)(``),[St,Ct]=(0,H.useState)(``),[wt,Tt]=(0,H.useState)(``),[Et,Dt]=(0,H.useState)(``),[Ot,kt]=(0,H.useState)(``),[At,jt]=(0,H.useState)(``),[Mt,Nt]=(0,H.useState)(``),[Pt,Ft]=(0,H.useState)(``),[It,Lt]=(0,H.useState)(``),[Rt,zt]=(0,H.useState)(!0),[Y,X]=(0,H.useState)(null),[Bt,Z]=(0,H.useState)(null),Vt=(0,H.useMemo)(()=>Le(T.get(`returnTo`)),[T]),Ht=(0,H.useCallback)(async()=>{if(e){zt(!0),Z(null);try{let[t,n,r]=await Promise.all([Re(e),ze(e),Be(e)]);I(t),oe(n);let[i,a]=await Promise.all([z(e,50),Ve(e)]);me(i),Me(a),ve(await He(e)),Ce(r)}catch(e){Z(e instanceof Error?e.message:r.errors.load)}finally{zt(!1)}}},[e,r.errors.load]);(0,H.useEffect)(()=>{Ht()},[Ht]),(0,H.useEffect)(()=>{let e=!1;return m().then(t=>{e||(ue(t),Ft(e=>e||t[0]?.id||``))}).catch(t=>{e||Z(t instanceof Error?t.message:r.errors.loadWorkflows)}),()=>{e=!0}},[r.errors.loadWorkflows]),(0,H.useEffect)(()=>{if(!N)return;$e(N.title),tt(N.description??``),rt(N.priority),at(N.deadlineAt?new Date(N.deadlineAt).toISOString().slice(0,10):``),st(String(N.maxTurns)),lt(N.judgeModelRef??``),dt(N.nextAction??``),pt(N.blockedReason??``),ht(N.contract?.objective??N.title),_t(N.contract?.scopeBoundary??``),yt(N.checklist.map(e=>e.text).join(`
|
|
3
|
-
`)),xt(N.contract?.evidencePlan.join(`
|
|
4
|
-
`)??``);let e=N.contract?.outcomeMetric;Ct(e?.name??``),Tt(e?String(e.baselineValue):``),Dt(e?String(e.targetValue):``),kt(e?.currentValue==null?``:String(e.currentValue)),jt(e?.unit??``),Nt(e?.sourceUrl??``),Ze(e=>N.evidenceRequirements.some(t=>t.id===e)?e:N.evidenceRequirements[0]?.id??``),Lt(e=>e||N.nextAction||N.title)},[N?.id,N?.updatedAt]);let Ut=async()=>{if(N){X(`continue`);try{N.status===`done`&&await f(d(`/api/goals/${encodeURIComponent(N.id)}/reopen`),{method:`POST`,body:JSON.stringify({})});let e=await f(d(`/api/goals/${encodeURIComponent(N.id)}/continue`),{method:`POST`,body:JSON.stringify({})});if(e.sessionKey){t(`/chat/${encodeURIComponent(e.sessionKey)}`);return}await Ht()}catch(e){Z(e instanceof Error?e.message:r.errors.continue)}finally{X(null)}}},Wt=async e=>{if(e.preventDefault(),!N)return;let t=Qe.trim();if(t){X(`details:save`),Z(null);try{let e=Number.parseInt(ot,10);I((await f(d(`/api/goals/${encodeURIComponent(N.id)}`),{method:`PATCH`,body:JSON.stringify({title:t,description:et.trim()||void 0,priority:nt,deadlineAt:it?new Date(`${it}T23:59:59`).getTime():void 0,maxTurns:Number.isFinite(e)?e:N.maxTurns,judgeModelRef:ct.trim()||void 0,nextAction:ut.trim()||void 0,blockedReason:ft.trim()||void 0})})).goal),await Q(N.id)}catch(e){Z(e instanceof Error?e.message:r.errors.save)}finally{X(null)}}},Gt=async e=>{if(e.preventDefault(),!N)return;let t=mt.trim();if(t){X(`contract:save`),Z(null);try{I((await f(d(`/api/goals/${encodeURIComponent(N.id)}/contract`),{method:`PUT`,body:JSON.stringify({objective:t,scopeBoundary:gt.trim()||void 0,criteria:de(vt),evidencePlan:de(bt)})})).goal),await Q(N.id)}catch(e){Z(e instanceof Error?e.message:r.errors.save)}finally{X(null)}}},Kt=async e=>{if(e.preventDefault(),!N)return;let t=Ae(wt),n=Ae(Et),i=Ae(Ot);if(!(!St.trim()||t==null||n==null)){X(`outcome:save`),Z(null);try{I((await f(d(`/api/goals/${encodeURIComponent(N.id)}/contract`),{method:`PUT`,body:JSON.stringify({objective:N.contract?.objective??N.title,scopeBoundary:N.contract?.scopeBoundary,criteria:N.checklist.map(e=>e.text),evidencePlan:N.contract?.evidencePlan??[],outcomeMetric:{name:St.trim(),baselineValue:t,targetValue:n,currentValue:i,unit:At.trim()||void 0,sourceUrl:Mt.trim()||void 0,measuredAt:i==null?void 0:Date.now()}})})).goal),await Q(N.id)}catch(e){Z(e instanceof Error?e.message:r.errors.save)}finally{X(null)}}},qt=async()=>{if(N){X(`outcome:clear`),Z(null);try{I((await f(d(`/api/goals/${encodeURIComponent(N.id)}/contract`),{method:`PUT`,body:JSON.stringify({objective:N.contract?.objective??N.title,scopeBoundary:N.contract?.scopeBoundary,criteria:N.checklist.map(e=>e.text),evidencePlan:N.contract?.evidencePlan??[],outcomeMetric:null})})).goal),await Q(N.id)}catch(e){Z(e instanceof Error?e.message:r.errors.save)}finally{X(null)}}},Jt=async e=>{if(N){X(e);try{await f(d(`/api/goals/${encodeURIComponent(N.id)}/${e}`),{method:`POST`,body:JSON.stringify({})}),await Ht()}catch(e){Z(e instanceof Error?e.message:r.errors.action)}finally{X(null)}}},Yt=async()=>{if(!(!N||!Pt)){X(`workflow:run`),Z(null);try{let e=await k({goalId:N.id,definitionId:Pt,goal:It.trim()||N.nextAction||N.title});await Ht(),t(`/chat/${encodeURIComponent(e.sessionKey)}`)}catch(e){Z(e instanceof Error?e.message:r.errors.startWorkflow)}finally{X(null)}}},Q=async e=>{try{Me(await Ve(e))}catch{}},Xt=async e=>{try{let[t,n,r]=await Promise.all([z(e,50),Ve(e),He(e)]);me(t),Me(n),ve(r)}catch{}},Zt=async e=>{if(N){X(`workflow:${e.id}:cancel`),Z(null);try{await g(e.id,{ownerAgentId:N.agentId}),await Xt(N.id)}catch(e){Z(e instanceof Error?e.message:r.errors.cancelWorkflow)}finally{X(null)}}},Qt=async e=>{if(N){X(`workflow:${e.id}:retry`),Z(null);try{let n=await y(e.id,{ownerAgentId:N.agentId});await Xt(N.id),t(`/chat/${encodeURIComponent(n.sessionKey)}`)}catch(e){Z(e instanceof Error?e.message:r.errors.retryWorkflow)}finally{X(null)}}},$t=async e=>{if(e.preventDefault(),!N)return;let t=Pe.trim();if(t){X(`checklist:add`),Z(null);try{I((await f(d(`/api/goals/${encodeURIComponent(N.id)}/checklist`),{method:`POST`,body:JSON.stringify({text:t})})).goal),Fe(``),await Q(N.id)}catch(e){Z(e instanceof Error?e.message:r.errors.addChecklist)}finally{X(null)}}},en=async(e,t)=>{if(N){X(`checklist:${e}:${t}`),Z(null);try{I((await f(d(`/api/goals/${encodeURIComponent(N.id)}/checklist/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify({status:t})})).goal),await Q(N.id)}catch(e){Z(e instanceof Error?e.message:r.errors.updateChecklist)}finally{X(null)}}},tn=async e=>{if(N){X(`checklist:${e}:delete`),Z(null);try{I((await f(d(`/api/goals/${encodeURIComponent(N.id)}/checklist/${encodeURIComponent(e)}`),{method:`DELETE`})).goal),await Q(N.id)}catch(e){Z(e instanceof Error?e.message:r.errors.deleteChecklist)}finally{X(null)}}},nn=async e=>{if(e.preventDefault(),!N)return;let t=We.trim();if(t){X(`evidence:add`),Z(null);try{let e=await f(d(`/api/goals/${encodeURIComponent(N.id)}/evidence`),{method:`POST`,body:JSON.stringify({kind:Ie,title:t,summary:Ke.trim()||void 0,uri:Je.trim()||void 0,requirementId:Xe||void 0})});Ce(t=>[e.evidence,...t]),I(await Re(N.id)),Ge(``),qe(``),Ye(``),await Q(N.id)}catch(e){Z(e instanceof Error?e.message:r.errors.addEvidence)}finally{X(null)}}},rn=async e=>{if(N){X(`requirement:${e}:review`),Z(null);try{await f(d(`/api/goals/${encodeURIComponent(N.id)}/evidence-requirements/${encodeURIComponent(e)}/review`),{method:`POST`,body:JSON.stringify({modelRef:N.judgeModelRef})}),I(await Re(N.id)),await Q(N.id)}catch(e){Z(e instanceof Error?e.message:r.errors.addEvidence)}finally{X(null)}}},an=async e=>{if(N){X(`requirement:${e}:approve`),Z(null);try{await f(d(`/api/goals/${encodeURIComponent(N.id)}/evidence-requirements/${encodeURIComponent(e)}/approve`),{method:`POST`,body:JSON.stringify({})}),I(await Re(N.id)),await Q(N.id)}catch(e){Z(e instanceof Error?e.message:r.errors.addEvidence)}finally{X(null)}}},on=async e=>{if(!N||!e.summary)return;Z(null);let t=l(n).automations,r=await f(d(`/api/goals/${encodeURIComponent(N.id)}/evidence`),{method:`POST`,body:JSON.stringify({kind:`message`,title:se(t.feedback.insightEvidenceTitle,{name:e.automationName}),summary:e.summary,data:{source:`automation`,automationRunId:e.id,automationId:e.automationId,automationName:e.automationName,sessionKey:e.sessionKey,workflowRunId:e.workflowRunId}})});Ce(e=>[r.evidence,...e]),await Q(N.id)},sn=N?.checklist.filter(e=>e.status===`completed`||e.status===`impossible`).length??0,cn=N?.checklist.length??0,ln=(0,H.useMemo)(()=>{let e=new Set;for(let t of J){let n=ge(he(t),`automationRunId`);n&&e.add(n)}return e},[J]),un=(0,H.useMemo)(()=>{let e=new Set;return J.filter(t=>{if(t.title.trim().toLowerCase().startsWith(`missing evidence:`))return!1;let n=`${t.kind}\u0000${t.title.trim()}\u0000${t.summary?.trim()??``}`;return e.has(n)?!1:(e.add(n),!0)})},[J]),dn=W.filter(e=>e.status===`failed`||e.status===`timeout`||e.status===`cancelled`),$=R[0],fn=Te(T.get(`timeline`))?T.get(`timeline`):`all`,pn=fn===`all`?De:De.filter(e=>e.kind===fn),mn=W.filter(e=>e.status===`queued`||e.status===`running`),hn=N?je(N,$,r):null,gn=N?.status===`done`&&!hn?.needsReview,_n=Y!=null||N?.status===`archived`||gn,vn=(0,H.useMemo)(()=>N?(0,U.jsxs)(U.Fragment,{children:[N.activeSessionKey?(0,U.jsxs)(O,{type:`button`,variant:`secondary`,className:`h-9 gap-2 rounded-lg px-2.5 md:px-3`,"aria-label":r.chat,onClick:()=>t(`/chat/${encodeURIComponent(N.activeSessionKey)}`),children:[(0,U.jsx)(C,{className:`size-4`,"aria-hidden":!0}),(0,U.jsx)(`span`,{className:`hidden md:inline`,children:r.chat})]}):null,(0,U.jsxs)(O,{type:`button`,variant:`ghost`,className:`h-9 gap-2 rounded-lg px-2.5 md:px-3`,"aria-label":r.archive,disabled:Y!=null||N.status===`archived`,onClick:()=>{window.confirm(r.archiveConfirm)&&Jt(`archive`)},children:[(0,U.jsx)(h,{className:`size-4`,"aria-hidden":!0}),(0,U.jsx)(`span`,{className:`hidden md:inline`,children:r.archive})]})]}):null,[Y,N,t,r]);(0,H.useLayoutEffect)(()=>(b({startExtra:(0,U.jsx)(s,{to:Vt,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":r.back,children:(0,U.jsx)(w,{className:`size-4`,"aria-hidden":!0})}),main:(0,U.jsxs)(`div`,{className:`min-w-0`,children:[Rt?(0,U.jsx)(L,{className:`h-5 w-48 max-w-full`}):(0,U.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:N?.title??r.notFound}),N?(0,U.jsxs)(`p`,{className:`truncate text-xs text-fg-muted`,children:[hn?.title??Ee(N.status,r),` · `,q(r.agent,{agentId:N.agentId})]}):null]}),end:vn}),()=>x()),[Vt,x,N,vn,Rt,b,hn?.title,r]);let yn=e=>{let t=new URLSearchParams(T);e===`all`?t.delete(`timeline`):t.set(`timeline`,e),ee(t,{replace:!0})};return(0,U.jsx)(`main`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto bg-surface-panel`,children:(0,U.jsxs)(`div`,{className:`flex w-full flex-1 flex-col gap-4 px-3 py-5 sm:px-5 xl:px-6`,children:[Bt?(0,U.jsx)(`p`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:Bt}):null,!Rt&&!N?(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.notFound}):null,Rt?(0,U.jsx)(fe,{}):N?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Ne,{goal:N,latestRun:$,done:sn,total:cn,evidence:J,language:n,t:r,busy:Y,primaryActionDisabled:_n,onContinue:()=>void Ut(),onOpenChat:()=>N.activeSessionKey&&t(`/chat/${encodeURIComponent(N.activeSessionKey)}`),onPause:()=>void Jt(`pause`),onConfigureOutcome:()=>document.getElementById(`goal-outcome-metric`)?.scrollIntoView({behavior:`smooth`,block:`center`}),onReviewEvidence:()=>document.getElementById(`goal-verification`)?.scrollIntoView({behavior:`smooth`,block:`start`})}),(0,U.jsxs)(`section`,{id:`goal-outcome-metric`,className:`rounded-lg border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,U.jsx)(F,{className:`size-4 text-accent`,"aria-hidden":!0}),r.outcomeMetric.title]}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.outcomeMetric.hint})]}),N.contract?.outcomeMetric?(0,U.jsx)(`span`,{className:c(`rounded-full border px-2 py-0.5 text-xs font-medium`,ke(N.contract.outcomeMetric)?`border-success/30 bg-success-soft text-success`:`border-amber-500/30 bg-amber-500/10 text-amber-800 dark:text-amber-200`),children:ke(N.contract.outcomeMetric)?r.outcomeMetric.achieved:r.outcomeMetric.notAchieved}):null]}),(0,U.jsxs)(`form`,{className:`mt-4 grid gap-3`,onSubmit:Kt,children:[(0,U.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-[minmax(12rem,1.4fr)_repeat(3,minmax(7rem,0.7fr))]`,children:[(0,U.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-muted`,children:[r.outcomeMetric.name,(0,U.jsx)(`input`,{value:St,onChange:e=>Ct(e.target.value),className:G,placeholder:r.outcomeMetric.namePlaceholder})]}),(0,U.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-muted`,children:[r.outcomeMetric.baseline,(0,U.jsx)(`input`,{value:wt,onChange:e=>Tt(e.target.value),className:G,type:`number`,step:`any`,inputMode:`decimal`})]}),(0,U.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-muted`,children:[r.outcomeMetric.current,(0,U.jsx)(`input`,{value:Ot,onChange:e=>kt(e.target.value),className:G,type:`number`,step:`any`,inputMode:`decimal`})]}),(0,U.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-muted`,children:[r.outcomeMetric.target,(0,U.jsx)(`input`,{value:Et,onChange:e=>Dt(e.target.value),className:G,type:`number`,step:`any`,inputMode:`decimal`})]})]}),(0,U.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-[10rem_minmax(0,1fr)_auto] md:items-end`,children:[(0,U.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-muted`,children:[r.outcomeMetric.unit,(0,U.jsx)(`input`,{value:At,onChange:e=>jt(e.target.value),className:G,placeholder:r.outcomeMetric.unitPlaceholder})]}),(0,U.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-muted`,children:[r.outcomeMetric.source,(0,U.jsx)(`input`,{value:Mt,onChange:e=>Nt(e.target.value),className:G,placeholder:r.outcomeMetric.sourcePlaceholder})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[N.contract?.outcomeMetric?(0,U.jsx)(O,{type:`button`,variant:`ghost`,className:`h-9`,disabled:Y!=null,onClick:()=>void qt(),children:r.outcomeMetric.clear}):null,(0,U.jsx)(O,{type:`submit`,variant:`secondary`,className:`h-9`,disabled:Y!=null||!St.trim()||Ae(wt)==null||Ae(Et)==null,children:r.outcomeMetric.save})]})]})]})]}),(0,U.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[(0,U.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:r.goalBrief}),N.description?(0,U.jsx)(`p`,{className:`mt-3 whitespace-pre-wrap break-words text-sm text-fg-muted`,children:N.description}):null,N.contract?(0,U.jsxs)(`div`,{className:`mt-3 rounded-md border border-edge-subtle bg-surface-muted/40 p-3`,children:[(0,U.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:r.goalContract}),(0,U.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:N.contract.objective}),N.contract.scopeBoundary?(0,U.jsxs)(`div`,{className:`mt-3`,children:[(0,U.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:r.scopeBoundary}),(0,U.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words text-sm text-fg-muted`,children:N.contract.scopeBoundary})]}):null,N.contract.evidencePlan.length?(0,U.jsxs)(`div`,{className:`mt-3`,children:[(0,U.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:r.completionEvidence}),(0,U.jsx)(`ul`,{className:`mt-1 grid gap-1 text-sm text-fg-muted`,children:N.contract.evidencePlan.map(e=>(0,U.jsxs)(`li`,{children:[`• `,e]},e))})]}):null,(0,U.jsxs)(`details`,{className:`mt-3 rounded-md bg-surface-base/70 px-3 py-2`,children:[(0,U.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:r.editContract}),(0,U.jsxs)(`form`,{className:`mt-3 grid gap-3`,onSubmit:Gt,children:[(0,U.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-muted`,children:[r.contractObjective,(0,U.jsx)(`textarea`,{value:mt,onChange:e=>ht(e.target.value),name:`contractObjective`,autoComplete:`off`,className:c(G,`resize-y`),rows:2,placeholder:r.contractObjectivePlaceholder})]}),(0,U.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-muted`,children:[r.scopeBoundary,(0,U.jsx)(`textarea`,{value:gt,onChange:e=>_t(e.target.value),name:`contractScopeBoundary`,autoComplete:`off`,className:c(G,`resize-y`),rows:2,placeholder:r.scopeBoundaryPlaceholder})]}),(0,U.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-muted`,children:[r.acceptanceCriteria,(0,U.jsx)(`textarea`,{value:vt,onChange:e=>yt(e.target.value),name:`contractCriteria`,autoComplete:`off`,className:c(G,`resize-y`),rows:3,placeholder:r.contractLinesHint})]}),(0,U.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-muted`,children:[r.completionEvidence,(0,U.jsx)(`textarea`,{value:bt,onChange:e=>xt(e.target.value),name:`contractEvidencePlan`,autoComplete:`off`,className:c(G,`resize-y`),rows:3,placeholder:r.contractLinesHint})]}),(0,U.jsx)(O,{type:`submit`,variant:`secondary`,className:`h-9 w-fit`,disabled:Y!=null||!mt.trim(),children:r.saveContract})]})]})]}):null]}),(0,U.jsxs)(`section`,{className:`grid gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,U.jsxs)(`div`,{className:`grid min-w-0 gap-4`,children:[(0,U.jsxs)(`section`,{id:`goal-verification`,className:`rounded-lg border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,U.jsx)(ne,{className:`size-4 text-accent`,"aria-hidden":!0}),r.acceptance]}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.acceptanceHint})]}),(0,U.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[sn,`/`,cn]})]}),$?(0,U.jsxs)(`div`,{className:`mt-3 rounded-md bg-surface-muted/40 px-3 py-2`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 text-xs text-fg-muted`,children:[(0,U.jsx)(`span`,{children:q(r.latestJudgement,{status:Ee($.verdict??$.status,r)})}),(0,U.jsx)(`time`,{children:xe($.finishedAt??$.startedAt,n,r)})]}),$.reason?(0,U.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:$.reason}):null,$.nextAction?(0,U.jsx)(`p`,{className:`mt-1 break-words text-xs text-fg-muted`,children:q(r.latestNext,{next:$.nextAction})}):null]}):null,(0,U.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,U.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,U.jsx)(ne,{className:`size-4 text-accent`,"aria-hidden":!0}),r.checklist]}),(0,U.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[sn,`/`,cn]})]}),(0,U.jsxs)(`form`,{className:`mb-3 flex flex-col gap-2 sm:flex-row`,onSubmit:$t,children:[(0,U.jsx)(`input`,{value:Pe,onChange:e=>Fe(e.target.value),name:`checklistText`,"aria-label":r.addAcceptancePlaceholder,autoComplete:`off`,placeholder:r.addAcceptancePlaceholder,className:c(G,`flex-1`)}),(0,U.jsxs)(O,{type:`submit`,variant:`secondary`,className:`h-9 gap-2`,disabled:Y!=null||!Pe.trim(),children:[(0,U.jsx)(E,{className:`size-4`,"aria-hidden":!0}),r.add]})]}),N.checklist.length?(0,U.jsx)(`ul`,{className:`space-y-2 text-sm`,children:N.checklist.map(e=>(0,U.jsx)(`li`,{className:`rounded-md bg-surface-muted/40 px-2.5 py-2`,children:(0,U.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2`,children:[(0,U.jsx)(`span`,{className:`mt-1 w-5 shrink-0 text-center text-fg-muted`,children:we(e.status)}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`p`,{className:`break-words text-fg`,children:e.text}),e.evidenceSummary?(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.evidenceSummary}):null]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[(0,U.jsx)(O,{type:`button`,variant:`ghost`,className:`size-8 p-0`,title:r.markPending,"aria-label":r.markPending,disabled:Y!=null||e.status===`pending`,onClick:()=>void en(e.id,`pending`),children:(0,U.jsx)(ae,{className:`size-4`,"aria-hidden":!0})}),(0,U.jsx)(O,{type:`button`,variant:`ghost`,className:`size-8 p-0`,title:r.markCompleted,"aria-label":r.markCompleted,disabled:Y!=null||e.status===`completed`,onClick:()=>void en(e.id,`completed`),children:(0,U.jsx)(te,{className:`size-4`,"aria-hidden":!0})}),(0,U.jsx)(O,{type:`button`,variant:`ghost`,className:`size-8 p-0`,title:r.markImpossible,"aria-label":r.markImpossible,disabled:Y!=null||e.status===`impossible`,onClick:()=>void en(e.id,`impossible`),children:(0,U.jsx)(P,{className:`size-4`,"aria-hidden":!0})}),(0,U.jsx)(O,{type:`button`,variant:`ghost`,className:`size-8 p-0 text-destructive hover:text-destructive`,title:r.deleteChecklistItem,"aria-label":r.deleteChecklistItem,disabled:Y!=null,onClick:()=>void tn(e.id),children:(0,U.jsx)(j,{className:`size-4`,"aria-hidden":!0})})]})]})},e.id))}):(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.noChecklist}),(0,U.jsxs)(`div`,{className:`mt-4 border-t border-edge pt-4`,children:[(0,U.jsxs)(`h3`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,U.jsx)(A,{className:`size-4 text-accent`,"aria-hidden":!0}),r.evidence]}),N.evidenceRequirements.length?(0,U.jsxs)(`div`,{className:`mb-4 grid gap-2 rounded-md border border-edge-subtle bg-surface-muted/40 p-3`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,U.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:r.evidenceRequirements}),(0,U.jsx)(`span`,{className:`text-xs text-fg-muted`,children:q(r.evidenceRequirementProgress,{approved:N.evidenceRequirements.filter(e=>e.status===`approved`).length,total:N.evidenceRequirements.length})})]}),N.evidenceRequirements.map(e=>(0,U.jsx)(`div`,{className:`rounded-md bg-surface-base px-2.5 py-2`,children:(0,U.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`p`,{className:`break-words text-sm text-fg`,children:e.text}),(0,U.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[q(r.linkedEvidenceCount,{count:e.evidenceIds.length}),` · `,r.evidenceRequirementStatuses[e.status]]}),e.reviewReason?(0,U.jsx)(`p`,{className:`mt-1 break-words text-xs text-fg-muted`,children:e.reviewReason}):null]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-1.5`,children:[(0,U.jsx)(O,{type:`button`,variant:`ghost`,className:`h-7 text-xs`,disabled:Y!=null||e.evidenceIds.length===0,onClick:()=>void rn(e.id),children:r.reviewEvidence}),(0,U.jsx)(O,{type:`button`,variant:`secondary`,className:`h-7 text-xs`,disabled:Y!=null||e.evidenceIds.length===0||e.status===`approved`,onClick:()=>void an(e.id),children:r.approveEvidence})]})]})},e.id))]}):null,(0,U.jsxs)(`form`,{className:`mb-3 grid gap-2`,onSubmit:nn,children:[(0,U.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[9rem_minmax(0,1fr)]`,children:[(0,U.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-muted`,children:[r.kind,(0,U.jsx)(ie,{value:Ie,onChange:e=>Ue(e.target.value),className:G,name:`evidenceKind`,children:pe.map(e=>(0,U.jsx)(B,{value:e,children:Oe(e,r)},e))})]}),(0,U.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-muted`,children:[r.title,(0,U.jsx)(`input`,{value:We,onChange:e=>Ge(e.target.value),name:`evidenceTitle`,autoComplete:`off`,placeholder:r.evidenceTitlePlaceholder,className:G})]})]}),N.evidenceRequirements.length?(0,U.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-muted`,children:[r.provesRequirement,(0,U.jsx)(ie,{value:Xe,onChange:e=>Ze(e.target.value),name:`evidenceRequirement`,className:G,children:N.evidenceRequirements.map(e=>(0,U.jsx)(B,{value:e.id,children:e.text},e.id))})]}):null,(0,U.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-muted`,children:[r.uriOrPath,(0,U.jsx)(`input`,{value:Je,onChange:e=>Ye(e.target.value),name:`evidenceUri`,autoComplete:`off`,placeholder:r.uriOrPathPlaceholder,className:G})]}),(0,U.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-muted`,children:[r.summary,(0,U.jsx)(`textarea`,{value:Ke,onChange:e=>qe(e.target.value),name:`evidenceSummary`,autoComplete:`off`,placeholder:r.summaryPlaceholder,rows:3,className:c(G,`resize-y`)})]}),(0,U.jsxs)(O,{type:`submit`,variant:`secondary`,className:`h-9 w-fit gap-2`,disabled:Y!=null||!We.trim(),children:[(0,U.jsx)(E,{className:`size-4`,"aria-hidden":!0}),r.addEvidence]})]}),un.length?(0,U.jsx)(`ul`,{className:`space-y-2 text-sm`,children:un.slice(0,6).map(e=>(0,U.jsx)(_e,{item:e,language:n,t:r},e.id))}):(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.noEvidence})]})]}),(0,U.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,U.jsx)(S,{className:`size-4 text-accent`,"aria-hidden":!0}),r.timeline]}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.timelineHint})]}),(0,U.jsxs)(O,{type:`button`,variant:`ghost`,className:`h-8 gap-1.5`,onClick:()=>void Ht(),children:[(0,U.jsx)(_,{className:`size-3.5`,"aria-hidden":!0}),r.refresh]})]}),R.length?(0,U.jsx)(`ol`,{className:`mt-4 grid gap-2`,children:R.slice(0,6).map((e,t)=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`details`,{open:t===0&&e.verdict!==`done`,className:`group rounded-lg border border-edge-subtle bg-surface-muted/40 px-3 py-2`,children:[(0,U.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 marker:hidden`,children:[(0,U.jsxs)(`span`,{className:`min-w-0`,children:[(0,U.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:q(r.executionProgress.runTitle,{number:R.length-t})}),(0,U.jsx)(`time`,{className:`mt-0.5 block text-xs text-fg-muted`,children:xe(e.finishedAt??e.startedAt,n,r)})]}),(0,U.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2 text-xs text-fg-muted`,children:[Ee(e.verdict??e.status,r),(0,U.jsx)(ce,{className:`size-4 transition-transform group-open:rotate-90`,"aria-hidden":!0})]})]}),(0,U.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3`,children:[e.reason?(0,U.jsx)(`p`,{className:`text-sm text-fg`,children:e.reason}):null,e.assistantPreview?(0,U.jsx)(`p`,{className:`mt-2 line-clamp-5 whitespace-pre-wrap text-xs text-fg-muted`,children:e.assistantPreview}):null,e.nextAction?(0,U.jsxs)(`div`,{className:`mt-3 rounded-md bg-surface-base px-3 py-2`,children:[(0,U.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:r.nextAction}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:e.nextAction})]}):null]})]})},e.id))}):(0,U.jsx)(`p`,{className:`mt-4 text-sm text-fg-muted`,children:r.executionProgress.noRuns}),(0,U.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-3`,children:[(0,U.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:q(r.executionProgress.systemActivity,{count:De.length})}),(0,U.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[`all`,`goal_run`,`workflow_run`,`evidence`,`queue`,`event`].map(e=>(0,U.jsx)(`button`,{type:`button`,className:c(`rounded-md border px-2.5 py-1 text-xs font-medium`,fn===e?`border-accent bg-accent-soft text-accent-fg`:`border-edge bg-surface-panel text-fg-muted hover:bg-surface-hover hover:text-fg`),onClick:()=>yn(e),children:r.timelineFilters[e]},e))}),pn.length?(0,U.jsx)(`ul`,{className:`mt-3 space-y-2 text-sm`,children:pn.map(e=>(0,U.jsx)(`li`,{className:`rounded-md bg-surface-muted/50 px-2.5 py-2`,children:(0,U.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-2`,children:[(0,U.jsx)(be(e.kind),{className:`mt-0.5 size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[(0,U.jsx)(`span`,{children:r.timelineFilters[e.kind]}),e.status?(0,U.jsx)(`span`,{children:Ee(e.status,r)}):null]}),(0,U.jsx)(`p`,{className:`mt-1 break-words font-medium text-fg`,children:e.title}),e.summary?(0,U.jsx)(`p`,{className:`mt-1 line-clamp-3 break-words text-xs text-fg-muted`,children:e.summary}):null]})]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1 text-xs text-fg-muted`,children:[(0,U.jsx)(`time`,{children:xe(e.createdAt,n,r)}),e.link?.type===`chat`?(0,U.jsxs)(O,{type:`button`,variant:`ghost`,className:`h-7 gap-1.5`,onClick:()=>t(`/chat/${encodeURIComponent(e.link.value)}`),children:[(0,U.jsx)(C,{className:`size-3.5`,"aria-hidden":!0}),r.chat]}):null,e.link?.type===`workflow_run`?(0,U.jsxs)(O,{type:`button`,variant:`ghost`,className:`h-7 gap-1.5`,onClick:()=>t(`/workflows?run=${encodeURIComponent(e.link.value)}`),children:[(0,U.jsx)(C,{className:`size-3.5`,"aria-hidden":!0}),r.run]}):null]})]})},e.id))}):(0,U.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:r.noTimeline})]})]})]}),(0,U.jsxs)(`aside`,{className:`grid h-fit gap-4`,children:[(0,U.jsxs)(`section`,{className:`rounded-lg border border-accent/25 bg-accent-soft/30 p-4`,children:[(0,U.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:r.actionRail.nextTitle}),(0,U.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap break-words text-sm font-medium text-fg`,children:gn?r.progressPanel.doneFallback:N.nextAction||r.noNextAction}),(0,U.jsxs)(O,{type:`button`,variant:`primary`,className:`mt-3 h-9 w-full gap-2`,disabled:Y!=null||N.status===`archived`,onClick:()=>{if(gn){window.confirm(r.archiveConfirm)&&Jt(`archive`);return}Ut()},children:[gn?(0,U.jsx)(h,{className:`size-4`,"aria-hidden":!0}):(0,U.jsx)(re,{className:`size-4`,"aria-hidden":!0}),gn?r.archive:r.actionRail.continueAction]})]}),N.evidenceRequirements.some(e=>e.status!==`approved`)||N.contract?.outcomeMetric&&!ke(N.contract.outcomeMetric)||$?.verdict===`continue`?(0,U.jsxs)(`section`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 p-4`,children:[(0,U.jsx)(`h2`,{className:`text-sm font-semibold text-amber-900 dark:text-amber-100`,children:r.actionRail.needsYou}),(0,U.jsxs)(`ul`,{className:`mt-3 grid gap-2 text-sm text-amber-900 dark:text-amber-100`,children:[N.contract?.outcomeMetric&&!ke(N.contract.outcomeMetric)?(0,U.jsxs)(`li`,{children:[`• `,r.outcomeMetric.notAchieved]}):null,N.evidenceRequirements.some(e=>e.status!==`approved`)?(0,U.jsxs)(`li`,{children:[`• `,q(r.actionRail.reviewEvidenceCount,{count:N.evidenceRequirements.filter(e=>e.status!==`approved`).length})]}):null,$?.verdict===`continue`?(0,U.jsxs)(`li`,{children:[`• `,r.actionRail.latestCheckContinue]}):null]}),(0,U.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[N.contract?.outcomeMetric&&!ke(N.contract.outcomeMetric)?(0,U.jsx)(O,{type:`button`,variant:`secondary`,className:`h-8`,onClick:()=>document.getElementById(`goal-outcome-metric`)?.scrollIntoView({behavior:`smooth`,block:`center`}),children:r.actionRail.setOutcome}):null,N.evidenceRequirements.some(e=>e.status!==`approved`)?(0,U.jsx)(O,{type:`button`,variant:`secondary`,className:`h-8`,onClick:()=>document.getElementById(`goal-verification`)?.scrollIntoView({behavior:`smooth`,block:`start`}),children:r.actionRail.reviewEvidence}):null]})]}):null,(0,U.jsxs)(`details`,{className:`rounded-lg border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[(0,U.jsx)(`summary`,{className:`cursor-pointer text-sm font-semibold text-fg`,children:r.actionRail.automation}),(0,U.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,U.jsx)(M,{eventType:`goal.status_changed`,source:`goals`,payloadKey:`goalId`,payloadValue:N.id,onSaveInsight:on,isInsightSaved:e=>ln.has(e.id)}),(0,U.jsx)(M,{eventType:`goal.created`,source:`goals`,payloadKey:`goalId`,payloadValue:N.id,onSaveInsight:on,isInsightSaved:e=>ln.has(e.id)}),N.status===`blocked`||N.blockedReason?(0,U.jsx)(le,{title:p.goalBlockedTitle,description:p.goalBlockedDescription,prompt:q(p.goalBlockedPrompt,{title:N.title}),coverage:{eventType:`goal.status_changed`,source:`goals`,eventPayload:{goalId:N.id,status:`blocked`}}}):null]})]}),(0,U.jsxs)(`details`,{className:`rounded-lg border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[(0,U.jsx)(`summary`,{className:`cursor-pointer text-sm font-semibold text-fg`,children:r.goalSettings}),(0,U.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-sm`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsx)(`dt`,{className:`text-fg-muted`,children:r.deadline}),(0,U.jsx)(`dd`,{className:`text-right text-fg`,children:Se(N.deadlineAt,n,r)})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsx)(`dt`,{className:`text-fg-muted`,children:r.judgeModel}),(0,U.jsx)(`dd`,{className:`min-w-0 truncate text-right text-fg`,children:N.judgeModelRef||r.default})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsx)(`dt`,{className:`text-fg-muted`,children:r.created}),(0,U.jsx)(`dd`,{className:`text-right text-fg`,children:Se(N.createdAt,n,r)})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsx)(`dt`,{className:`text-fg-muted`,children:r.updated}),(0,U.jsx)(`dd`,{className:`text-right text-fg`,children:xe(N.updatedAt,n,r)})]})]}),(0,U.jsxs)(`details`,{className:`mt-4 rounded-md bg-surface-muted/40 px-3 py-2`,children:[(0,U.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:r.editDetails}),(0,U.jsxs)(`form`,{className:`mt-3 grid gap-3`,onSubmit:Wt,children:[(0,U.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-muted`,children:[r.title,(0,U.jsx)(`input`,{value:Qe,onChange:e=>$e(e.target.value),name:`goalTitle`,autoComplete:`off`,className:G,placeholder:`${r.title}…`})]}),(0,U.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-muted`,children:[r.description,(0,U.jsx)(`textarea`,{value:et,onChange:e=>tt(e.target.value),name:`goalDescription`,autoComplete:`off`,className:c(G,`resize-y`),rows:3,placeholder:`${r.description}…`})]}),(0,U.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-3 xl:grid-cols-1`,children:[(0,U.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-muted`,children:[r.priority,(0,U.jsxs)(ie,{value:nt,onChange:e=>rt(e.target.value),name:`goalPriority`,className:G,children:[(0,U.jsx)(B,{value:`low`,children:r.priorities.low}),(0,U.jsx)(B,{value:`normal`,children:r.priorities.normal}),(0,U.jsx)(B,{value:`high`,children:r.priorities.high})]})]}),(0,U.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-muted`,children:[r.deadline,(0,U.jsx)(`input`,{value:it,onChange:e=>at(e.target.value),name:`goalDeadline`,className:G,type:`date`})]}),(0,U.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-muted`,children:[r.maxTurns,(0,U.jsx)(`input`,{value:ot,onChange:e=>st(e.target.value),name:`goalMaxTurns`,className:G,type:`number`,min:1,max:500,inputMode:`numeric`,placeholder:`${r.maxTurns}…`})]})]}),(0,U.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-muted`,children:[r.judgeModel,(0,U.jsx)(`input`,{value:ct,onChange:e=>lt(e.target.value),name:`goalJudgeModel`,autoComplete:`off`,className:G,placeholder:`${r.judgeModel}…`})]}),(0,U.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-muted`,children:[r.nextAction,(0,U.jsx)(`textarea`,{value:ut,onChange:e=>dt(e.target.value),name:`goalNextAction`,autoComplete:`off`,className:c(G,`resize-y`),rows:2,placeholder:`${r.nextAction}…`})]}),(0,U.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-muted`,children:[r.blockedReason,(0,U.jsx)(`textarea`,{value:ft,onChange:e=>pt(e.target.value),name:`goalBlockedReason`,autoComplete:`off`,className:c(G,`resize-y`),rows:2,placeholder:`${r.blockedReason}…`})]}),(0,U.jsx)(O,{type:`submit`,variant:`secondary`,className:`h-9 w-fit`,disabled:Y!=null||!Qe.trim(),children:r.saveDetails})]})]})]}),(0,U.jsxs)(`details`,{className:`rounded-lg border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[(0,U.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 text-sm font-semibold text-fg marker:hidden`,children:[(0,U.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(D,{className:`size-4 text-accent`,"aria-hidden":!0}),r.workflow]}),mn.length?(0,U.jsx)(`span`,{className:`rounded-full border border-accent/40 bg-accent-soft px-2 py-0.5 text-xs text-accent-fg`,children:q(r.activeCount,{count:mn.length})}):null]}),(0,U.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:r.workflowHint}),K.length?(0,U.jsx)(`div`,{className:`mt-3 grid gap-2`,children:K.slice(0,2).map(e=>(0,U.jsxs)(`button`,{type:`button`,className:c(`min-w-0 rounded-md bg-surface-muted/40 px-2.5 py-2 text-left hover:bg-accent-soft/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,Pt===e.definitionId&&`bg-accent-soft/60 ring-1 ring-accent/30`),onClick:()=>{Ft(e.definitionId),Lt(N.nextAction||N.title)},children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,U.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e.score})]}),(0,U.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:e.description})]},e.definitionId))}):null,(0,U.jsxs)(`div`,{className:`mt-3 grid gap-2`,children:[(0,U.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-muted`,children:[r.definition,(0,U.jsxs)(ie,{value:Pt,onChange:e=>Ft(e.target.value),className:G,name:`workflowDefinition`,disabled:V.length===0,children:[V.length===0?(0,U.jsx)(B,{value:``,children:r.noWorkflows}):null,V.map(e=>(0,U.jsx)(B,{value:e.id,children:e.title||e.name},e.id))]})]}),(0,U.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-muted`,children:[r.workflowGoal,(0,U.jsx)(`input`,{value:It,onChange:e=>Lt(e.target.value),name:`workflowGoal`,autoComplete:`off`,className:G,placeholder:`${r.workflowGoal}…`})]}),(0,U.jsxs)(O,{type:`button`,variant:`secondary`,className:`h-9 w-fit gap-2`,disabled:Y!=null||!Pt||N.status===`done`||N.status===`archived`,onClick:()=>void Yt(),children:[(0,U.jsx)(re,{className:`size-4`,"aria-hidden":!0}),r.runWorkflow]})]}),W.length?(0,U.jsxs)(`div`,{className:`mt-4 border-t border-edge pt-3`,children:[(0,U.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,U.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.recentWorkflowRuns}),(0,U.jsx)(`button`,{type:`button`,className:`text-xs text-fg-muted hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>yn(`workflow_run`),children:r.viewTimeline})]}),(0,U.jsx)(`ul`,{className:`grid gap-2`,children:W.slice(0,3).map(e=>{let i=e.metadata?.sessionKey,a=e.status===`queued`||e.status===`running`,o=e.status===`failed`||e.status===`timeout`||e.status===`cancelled`;return(0,U.jsxs)(`li`,{className:`rounded-md bg-surface-muted/40 px-2.5 py-2 text-sm`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 text-xs text-fg-muted`,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:e.definitionId}),(0,U.jsx)(`span`,{className:c(`shrink-0 rounded-full border px-2 py-0.5`,ye(e.status)),children:Ee(e.status,r)})]}),(0,U.jsx)(`p`,{className:`mt-1 truncate text-fg`,children:e.title}),(0,U.jsx)(`time`,{className:`mt-1 block text-xs text-fg-muted`,children:xe(e.completedAtMs??e.startedAtMs??e.createdAtMs,n,r)}),(0,U.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[i?(0,U.jsxs)(O,{type:`button`,variant:`ghost`,className:`h-8 gap-1.5`,onClick:()=>t(`/chat/${encodeURIComponent(i)}`),children:[(0,U.jsx)(C,{className:`size-3.5`,"aria-hidden":!0}),r.chat]}):null,a?(0,U.jsxs)(O,{type:`button`,variant:`ghost`,className:`h-8 gap-1.5 text-destructive hover:text-destructive`,disabled:Y!=null,onClick:()=>void Zt(e),children:[(0,U.jsx)(P,{className:`size-3.5`,"aria-hidden":!0}),r.cancel]}):null,o?(0,U.jsxs)(O,{type:`button`,variant:`ghost`,className:`h-8 gap-1.5`,disabled:Y!=null,onClick:()=>void Qt(e),children:[(0,U.jsx)(_,{className:`size-3.5`,"aria-hidden":!0}),r.retry]}):null]})]},e.id)})})]}):null,dn.length?(0,U.jsxs)(`div`,{className:`mt-4 rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,U.jsx)(`p`,{className:`text-sm font-medium text-amber-800 dark:text-amber-200`,children:r.recoveryNeeded}),(0,U.jsx)(`span`,{className:`text-xs text-amber-700 dark:text-amber-300`,children:q(r.failedCount,{count:dn.length})})]}),(0,U.jsx)(`ul`,{className:`mt-2 grid gap-2`,children:dn.slice(0,3).map(e=>(0,U.jsxs)(`li`,{className:`grid gap-2 text-sm`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`p`,{className:`truncate text-fg`,children:e.title}),(0,U.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[e.definitionId,` · `,Ee(e.status,r)]})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[(0,U.jsxs)(O,{type:`button`,variant:`ghost`,className:`h-8 gap-1.5`,onClick:()=>t(`/workflows?run=${encodeURIComponent(e.id)}`),children:[(0,U.jsx)(C,{className:`size-3.5`,"aria-hidden":!0}),r.run]}),(0,U.jsxs)(O,{type:`button`,variant:`secondary`,className:`h-8 gap-1.5`,disabled:Y!=null,onClick:()=>void Qt(e),children:[(0,U.jsx)(_,{className:`size-3.5`,"aria-hidden":!0}),r.retry]})]})]},e.id))})]}):null]})]})]})]}):null]})})}export{Ue as GoalDetailPage};
|
|
@@ -1,2 +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-BMhrPKJC.js";import{t as o}from"./circle-alert-BEjgurr2.js";import{t as s}from"./cn-JdwAhgNB.js";import{t as c}from"./messages-BWtP5TFz.js";import{n as l,r as u,s as d}from"./locale-store-BP0vD37A.js";import{Bu as f,Cl as p,Dl as m,Eo as h,Gr as g,Jl as _,Jo as v,Ko as y,Ls as b,Os as x,Pc as S,Ps as C,Qn as w,Tc as T,Vu as E,Wo as D,Xo as O,Yo as k,_u as A,bc as j,fl as M,gu as N,hu as P,io as F,ls as I,oa as L,qo as R,ss as z,su as B,to as V,vt as ee,yt as H}from"./index-DUasAutC.js";import{t as te}from"./page-tabs-tiHmRJUA.js";import{t as ne}from"./goals-config-api-C_2QWBtb.js";import{n as re,t as ie}from"./goal-create-dialog-Dp0AyDHI.js";var U=e(t(),1),ae=n(),W=[`active`,`paused`,`blocked`,`needs_input`,`done`,`archived`],oe=[`attention`,`running`,`ready`,`later`];function se(e){let t=e.checklist.length;return{done:e.checklist.filter(e=>e.status===`completed`||e.status===`impossible`).length,total:t}}function ce(e){return e.nextRunAt??e.finishedAt??e.startedAt??e.enqueuedAt}function le(e){let t=new Map;for(let n of e){let e=t.get(n.goalId);(!e||ce(n)>ce(e))&&t.set(n.goalId,n)}return t}function G(e){return e===`running`||e===`queued`||e===`retry_waiting`}function ue(e,t){return e.status===`done`||e.status===`archived`?null:e.status===`blocked`||e.status===`needs_input`||t?.status===`failed`?`attention`:t&&G(t.status)?`running`:e.status===`active`?`ready`:e.status===`paused`?`later`:null}function K(e){return e===`high`?3:e===`normal`?2:1}function de(e,t,n){let r=n.get(e.id),i=n.get(t.id),a=r&&G(r.status)?1:0,o=i&&G(i.status)?1:0;if(a!==o)return o-a;let s=K(t.priority)-K(e.priority);if(s!==0)return s;let c=e.deadlineAt??1/0,l=t.deadlineAt??1/0;return c===l?t.updatedAt-e.updatedAt:c-l}function fe(e,t){let n=t.trim().toLowerCase();return n?[e.title,e.description,e.nextAction,e.blockedReason,e.latestRun?.reason,e.agentId,...e.checklist.map(e=>e.text)].filter(Boolean).join(`
|
|
2
|
-
`).toLowerCase().includes(n):!0}function pe(e,t){let n={attention:0,running:0,ready:0,later:0,history:0};for(let r of e){if(r.status===`done`||r.status===`archived`){n.history+=1;continue}let e=ue(r,t.get(r.id));e&&(n[e]+=1)}return n}var q=r();function J(e,t){return Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{{${t}}}`,String(n)),e)}function me(e,t){return ee(e,t)}function he(e,t){let n=Math.round((e-Date.now())/1e3),r=Math.abs(n);return r<60?H(n,`second`,t):r<3600?H(Math.round(n/60),`minute`,t):r<86400?H(Math.round(n/3600),`hour`,t):r<2592e3?H(Math.round(n/86400),`day`,t):me(e,t)}function ge(e,t){return t.statuses[e]??e}function Y(e,t,n){return e.status===`blocked`?{label:n.workbench.status.blocked,tone:`attention`}:e.status===`needs_input`?{label:n.workbench.status.needsInput,tone:`attention`}:t?.status===`failed`?{label:n.workbench.status.executionFailed,tone:`attention`}:t?.status===`running`?{label:n.workbench.status.running,tone:`running`}:t?.status===`queued`?{label:n.workbench.status.queued,tone:`running`}:t?.status===`retry_waiting`?{label:n.workbench.status.retryWaiting,tone:`running`}:e.status===`active`?{label:n.workbench.status.ready,tone:`ready`}:e.status===`paused`?{label:n.workbench.status.paused,tone:`neutral`}:e.status===`done`?{label:n.workbench.status.done,tone:`done`}:{label:n.workbench.status.archived,tone:`neutral`}}function X(e){return e===`attention`?`bg-warning-soft text-amber-800 dark:text-amber-200`:e===`running`?`bg-accent-soft text-accent-fg`:e===`ready`?`bg-surface-active text-fg`:e===`done`?`bg-success-soft text-emerald-800 dark:text-emerald-200`:`bg-surface-hover text-fg-muted`}function _e(e,t){return e.status===`done`?`review`:e.status===`archived`?`unarchive`:e.status===`blocked`||e.status===`needs_input`?`details`:t?.status===`running`||t?.status===`queued`||t?.status===`retry_waiting`?`execution`:`continue`}function Z(e,t){return e===`details`?t.workbench.actions.handle:e===`review`?t.workbench.actions.review:e===`execution`?t.workbench.actions.viewExecution:e===`continue`?t.workbench.actions.continueExecution:t.actions[e]}function Q(e){return e===`details`?o:e===`review`?M:e===`execution`?B:e===`pause`?N:e===`archive`?f:e===`unarchive`?E:e===`reopen`?T:e===`complete`?A:P}function ve(e,t,n){return e.status===`needs_input`?e.blockedReason||e.nextAction||n.workbench.row.inputNeeded:e.status===`blocked`?e.blockedReason||n.workbench.row.reviewBlocker:t?.status===`failed`?t.error||n.workbench.row.executionFailed:t&&G(t.status)?e.nextAction||t.userTurn?.text||n.workbench.row.executionInProgress:e.status===`paused`?e.blockedReason&&e.blockedReason!==`user-paused`?e.blockedReason:n.workbench.row.pausedByUser:e.status===`done`?n.workbench.row.completedReview:e.status===`archived`?n.workbench.row.archived:e.nextAction||n.noNextAction}function ye(e,t,n){if(!e||G(e.status))return null;let r=he(ce(e),t);return e.status===`succeeded`?J(n.workbench.row.lastSucceeded,{time:r}):e.status===`failed`?J(n.workbench.row.lastFailed,{time:r}):J(n.workbench.row.lastFinished,{time:r})}function $(e){return e===`completed`?`✓`:e===`impossible`?`!`:`○`}function be(e){return e===`archive`?`unarchive`:e===`unarchive`?`archive`:e===`complete`?`reopen`:`complete`}async function xe(){return(await d(u(`/api/goals?${new URLSearchParams({status:W.join(`,`),limit:`500`}).toString()}`))).goals}async function Se(){return(await d(u(`/api/goals/queue`))).queue??[]}async function Ce(e){return(await d(u(`/api/goals`),{method:`POST`,body:JSON.stringify({...e,source:`api`})})).goal}async function we(e,t){let n=await d(u(`/api/goals/contract/draft`),{method:`POST`,body:JSON.stringify({title:e.title,context:e.description,criteria:e.checklist,judgeModelRef:e.judgeModelRef||void 0,uiLocale:t})});return{objective:n.contract.objective??e.objective,scopeBoundary:n.contract.scopeBoundary??e.scopeBoundary,evidencePlan:n.contract.evidencePlan??e.evidencePlan,checklist:n.contract.criteria??e.checklist}}async function Te(e,t){await d(u(`/api/goals/${encodeURIComponent(e)}/${t}`),{method:`POST`,body:JSON.stringify({})})}async function Ee(e){return(await d(u(`/api/goals/${encodeURIComponent(e)}/continue`),{method:`POST`,body:JSON.stringify({})})).sessionKey}function De(e){let t=(0,ae.c)(51),{goal:n,queueItem:r,intent:i,t:o,busy:c,onAction:l}=e,u;t[0]===i?u=t[1]:(u=Q(i),t[0]=i,t[1]=u);let d=u,f=c===`${n.id}:${i}`,p=i===`continue`?`primary`:`secondary`;if(i===`details`||i===`review`){let e=`/goals/${encodeURIComponent(n.id)}`,r;t[2]===d?r=t[3]:(r=(0,q.jsx)(d,{className:`size-4`,"aria-hidden":!0}),t[2]=d,t[3]=r);let s;t[4]!==i||t[5]!==o?(s=Z(i,o),t[4]=i,t[5]=o,t[6]=s):s=t[6];let c;t[7]!==e||t[8]!==r||t[9]!==s?(c=(0,q.jsxs)(a,{to:e,children:[r,s]}),t[7]=e,t[8]=r,t[9]=s,t[10]=c):c=t[10];let l;return t[11]!==c||t[12]!==p?(l=(0,q.jsx)(C,{asChild:!0,type:`button`,variant:p,className:`h-11 rounded-lg px-3.5`,children:c}),t[11]=c,t[12]=p,t[13]=l):l=t[13],l}if(i===`execution`){if(r?.sessionKey){let e=`/chat/${encodeURIComponent(r.sessionKey)}`,n;t[14]===d?n=t[15]:(n=(0,q.jsx)(d,{className:`size-4`,"aria-hidden":!0}),t[14]=d,t[15]=n);let s;t[16]!==i||t[17]!==o?(s=Z(i,o),t[16]=i,t[17]=o,t[18]=s):s=t[18];let c;return t[19]!==e||t[20]!==n||t[21]!==s?(c=(0,q.jsx)(C,{asChild:!0,type:`button`,variant:`secondary`,className:`h-11 rounded-lg px-3.5`,children:(0,q.jsxs)(a,{to:e,children:[n,s]})}),t[19]=e,t[20]=n,t[21]=s,t[22]=c):c=t[22],c}let e=`/goals/${encodeURIComponent(n.id)}`,s;t[23]===d?s=t[24]:(s=(0,q.jsx)(d,{className:`size-4`,"aria-hidden":!0}),t[23]=d,t[24]=s);let c;t[25]!==i||t[26]!==o?(c=Z(i,o),t[25]=i,t[26]=o,t[27]=c):c=t[27];let l;return t[28]!==e||t[29]!==s||t[30]!==c?(l=(0,q.jsx)(C,{asChild:!0,type:`button`,variant:`secondary`,className:`h-11 rounded-lg px-3.5`,children:(0,q.jsxs)(a,{to:e,children:[s,c]})}),t[28]=e,t[29]=s,t[30]=c,t[31]=l):l=t[31],l}let m;t[32]!==n.id||t[33]!==i||t[34]!==l?(m=()=>l(n.id,i),t[32]=n.id,t[33]=i,t[34]=l,t[35]=m):m=t[35];let h=f&&`animate-pulse`,g;t[36]===h?g=t[37]:(g=s(`size-4`,h),t[36]=h,t[37]=g);let _;t[38]!==d||t[39]!==g?(_=(0,q.jsx)(d,{className:g,"aria-hidden":!0}),t[38]=d,t[39]=g,t[40]=_):_=t[40];let v;t[41]!==i||t[42]!==f||t[43]!==o?(v=f?o.workbench.actions.working:Z(i,o),t[41]=i,t[42]=f,t[43]=o,t[44]=v):v=t[44];let y;return t[45]!==f||t[46]!==m||t[47]!==_||t[48]!==v||t[49]!==p?(y=(0,q.jsxs)(C,{type:`button`,variant:p,className:`h-11 rounded-lg px-3.5`,disabled:f,onClick:m,children:[_,v]}),t[45]=f,t[46]=m,t[47]=_,t[48]=v,t[49]=p,t[50]=y):y=t[50],y}function Oe(e){let t=(0,ae.c)(126),{goal:n,queueItem:r,t:i,language:a,busy:o,actionError:c,onOpen:l,onAction:u}=e,d,f,p,m,h,g,v,y,b,S,w,T,E,D,O;if(t[0]!==n||t[1]!==a||t[2]!==l||t[3]!==r||t[4]!==i){let e=Y(n,r,i),o;t[20]!==n||t[21]!==r?(o=_e(n,r),t[20]=n,t[21]=r,t[22]=o):o=t[22],d=o;let c=se(n),u;t[23]!==n.latestRun?.finishedAt||t[24]!==n.updatedAt||t[25]!==r?(u=r&&G(r.status)?ce(r):n.latestRun?.finishedAt??n.updatedAt,t[23]=n.latestRun?.finishedAt,t[24]=n.updatedAt,t[25]=r,t[26]=u):u=t[26];let _=u,C;t[27]!==a||t[28]!==r||t[29]!==i?(C=ye(r,a,i),t[27]=a,t[28]=r,t[29]=i,t[30]=C):C=t[30],f=C,v=`group border-b border-edge-subtle py-4 last:border-b-0 sm:py-5`,g=`flex flex-col gap-4 lg:flex-row lg:items-center`,w=`button`,t[31]===Symbol.for(`react.memo_cache_sentinel`)?(T=s(`min-w-0 flex-1 rounded-lg text-left`,x.focusRingPanel),t[31]=T):T=t[31],E=`${i.openDetails}: ${n.title}`,t[32]!==n||t[33]!==l?(D=()=>l(n),t[32]=n,t[33]=l,t[34]=D):D=t[34];let k=s(`rounded-full px-2.5 py-1 text-xs font-semibold`,X(e.tone)),A;t[35]!==e||t[36]!==k?(A=(0,q.jsx)(`span`,{className:k,children:e.label}),t[35]=e,t[36]=k,t[37]=A):A=t[37];let j;t[38]!==n.priority||t[39]!==i.workbench?(j=n.priority===`high`?(0,q.jsx)(`span`,{className:`text-xs font-semibold text-fg`,children:i.workbench.row.highPriority}):null,t[38]=n.priority,t[39]=i.workbench,t[40]=j):j=t[40];let M;t[41]===n.agentId?M=t[42]:(M=(0,q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n.agentId}),t[41]=n.agentId,t[42]=M),t[43]!==A||t[44]!==j||t[45]!==M?(O=(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[A,j,M]}),t[43]=A,t[44]=j,t[45]=M,t[46]=O):O=t[46],t[47]===n.title?m=t[48]:(m=(0,q.jsx)(`h3`,{className:`mt-2.5 text-base font-semibold leading-6 text-fg`,children:n.title}),t[47]=n.title,t[48]=m);let N=e.tone===`attention`?`text-amber-800 dark:text-amber-200`:`text-fg-muted`,P;t[49]===N?P=t[50]:(P=s(`mt-1 max-w-[70ch] text-sm leading-6`,N),t[49]=N,t[50]=P);let F;t[51]!==n||t[52]!==r||t[53]!==i?(F=ve(n,r,i),t[51]=n,t[52]=r,t[53]=i,t[54]=F):F=t[54],t[55]!==P||t[56]!==F?(h=(0,q.jsx)(`p`,{className:P,children:F}),t[55]=P,t[56]=F,t[57]=h):h=t[57],p=`mt-2.5 flex flex-wrap items-center gap-x-2.5 gap-y-1 text-xs text-fg-subtle`;let I;t[58]!==a||t[59]!==_?(I=me(_,a),t[58]=a,t[59]=_,t[60]=I):I=t[60];let L;t[61]!==a||t[62]!==_?(L=he(_,a),t[61]=a,t[62]=_,t[63]=L):L=t[63],t[64]!==I||t[65]!==L?(y=(0,q.jsx)(`span`,{title:I,children:L}),t[64]=I,t[65]=L,t[66]=y):y=t[66];let R;t[67]!==n.maxTurns||t[68]!==n.turnsUsed||t[69]!==i.turns?(R=J(i.turns,{used:n.turnsUsed,max:n.maxTurns}),t[67]=n.maxTurns,t[68]=n.turnsUsed,t[69]=i.turns,t[70]=R):R=t[70],t[71]===R?b=t[72]:(b=(0,q.jsx)(`span`,{children:R}),t[71]=R,t[72]=b),S=c.total?(0,q.jsx)(`span`,{children:J(i.checklistProgress,{done:c.done,total:c.total})}):null,t[0]=n,t[1]=a,t[2]=l,t[3]=r,t[4]=i,t[5]=d,t[6]=f,t[7]=p,t[8]=m,t[9]=h,t[10]=g,t[11]=v,t[12]=y,t[13]=b,t[14]=S,t[15]=w,t[16]=T,t[17]=E,t[18]=D,t[19]=O}else d=t[5],f=t[6],p=t[7],m=t[8],h=t[9],g=t[10],v=t[11],y=t[12],b=t[13],S=t[14],w=t[15],T=t[16],E=t[17],D=t[18],O=t[19];let k;t[73]!==n.deadlineAt||t[74]!==a||t[75]!==i.deadlineSummary?(k=n.deadlineAt?(0,q.jsx)(`span`,{children:J(i.deadlineSummary,{deadline:me(n.deadlineAt,a)})}):null,t[73]=n.deadlineAt,t[74]=a,t[75]=i.deadlineSummary,t[76]=k):k=t[76];let A;t[77]===f?A=t[78]:(A=f?(0,q.jsx)(`span`,{children:f}):null,t[77]=f,t[78]=A);let j;t[79]!==r||t[80]!==i.attempt?(j=r&&G(r.status)?(0,q.jsx)(`span`,{children:J(i.attempt,{attempts:r.attempts,max:r.maxRetries+1})}):null,t[79]=r,t[80]=i.attempt,t[81]=j):j=t[81];let M;t[82]!==p||t[83]!==k||t[84]!==A||t[85]!==j||t[86]!==y||t[87]!==b||t[88]!==S?(M=(0,q.jsxs)(`div`,{className:p,children:[y,b,S,k,A,j]}),t[82]=p,t[83]=k,t[84]=A,t[85]=j,t[86]=y,t[87]=b,t[88]=S,t[89]=M):M=t[89];let N;t[90]!==m||t[91]!==h||t[92]!==M||t[93]!==w||t[94]!==T||t[95]!==E||t[96]!==D||t[97]!==O?(N=(0,q.jsxs)(`button`,{type:w,className:T,"aria-label":E,onClick:D,children:[O,m,h,M]}),t[90]=m,t[91]=h,t[92]=M,t[93]=w,t[94]=T,t[95]=E,t[96]=D,t[97]=O,t[98]=N):N=t[98];let P;t[99]!==o||t[100]!==n||t[101]!==d||t[102]!==u||t[103]!==r||t[104]!==i?(P=(0,q.jsx)(De,{goal:n,queueItem:r,intent:d,t:i,busy:o,onAction:u}),t[99]=o,t[100]=n,t[101]=d,t[102]=u,t[103]=r,t[104]=i,t[105]=P):P=t[105];let F;t[106]!==n||t[107]!==l?(F=()=>l(n),t[106]=n,t[107]=l,t[108]=F):F=t[108];let I;t[109]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,q.jsx)(_,{className:`size-4`,"aria-hidden":!0}),t[109]=I):I=t[109];let L;t[110]!==i.openDetails||t[111]!==F?(L=(0,q.jsx)(C,{type:`button`,variant:`ghost`,className:`size-11 shrink-0 rounded-lg p-0`,"aria-label":i.openDetails,onClick:F,children:I}),t[110]=i.openDetails,t[111]=F,t[112]=L):L=t[112];let R;t[113]!==P||t[114]!==L?(R=(0,q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 lg:justify-end`,children:[P,L]}),t[113]=P,t[114]=L,t[115]=R):R=t[115];let z;t[116]!==g||t[117]!==N||t[118]!==R?(z=(0,q.jsxs)(`div`,{className:g,children:[N,R]}),t[116]=g,t[117]=N,t[118]=R,t[119]=z):z=t[119];let B;t[120]===c?B=t[121]:(B=c?(0,q.jsx)(`p`,{className:`mt-3 rounded-lg bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:c}):null,t[120]=c,t[121]=B);let V;return t[122]!==v||t[123]!==z||t[124]!==B?(V=(0,q.jsxs)(`article`,{className:v,children:[z,B]}),t[122]=v,t[123]=z,t[124]=B,t[125]=V):V=t[125],V}function ke(){let e=(0,ae.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,q.jsx)(`div`,{"aria-hidden":`true`,children:Array.from({length:3}).map(Ae)}),e[0]=t):t=e[0],t}function Ae(e,t){return(0,q.jsx)(`div`,{className:`border-b border-edge-subtle py-5 last:border-b-0`,children:(0,q.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-center`,children:[(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(F,{className:`h-6 w-24 rounded-full`}),(0,q.jsx)(F,{className:`h-4 w-16`})]}),(0,q.jsx)(F,{className:`mt-3 h-5 w-2/3`}),(0,q.jsx)(F,{className:`mt-2 h-4 w-full max-w-2xl`}),(0,q.jsx)(F,{className:`mt-3 h-3 w-72 max-w-full`})]}),(0,q.jsx)(F,{className:`h-11 w-32 rounded-lg`})]})},t)}function je(e){let t=(0,ae.c)(36),{title:n,description:r,goals:i,queueByGoal:a,t:o,language:s,busy:c,actionError:l,onOpen:u,onAction:d}=e,f=`goal-section-${n}`,p=`goal-section-${n}`,m;t[0]!==p||t[1]!==n?(m=(0,q.jsx)(`h2`,{id:p,className:`text-base font-semibold text-fg`,children:n}),t[0]=p,t[1]=n,t[2]=m):m=t[2];let h;t[3]===r?h=t[4]:(h=(0,q.jsx)(`p`,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:r}),t[3]=r,t[4]=h);let g;t[5]!==m||t[6]!==h?(g=(0,q.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),t[5]=m,t[6]=h,t[7]=g):g=t[7];let _;t[8]===i.length?_=t[9]:(_=(0,q.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2.5 py-1 text-xs font-semibold tabular-nums text-fg-muted`,children:i.length}),t[8]=i.length,t[9]=_);let v;t[10]!==g||t[11]!==_?(v=(0,q.jsxs)(`header`,{className:`flex items-start justify-between gap-4 pb-1`,children:[g,_]}),t[10]=g,t[11]=_,t[12]=v):v=t[12];let y;if(t[13]!==l||t[14]!==c||t[15]!==i||t[16]!==s||t[17]!==d||t[18]!==u||t[19]!==a||t[20]!==o){let e;t[22]!==l||t[23]!==c||t[24]!==s||t[25]!==d||t[26]!==u||t[27]!==a||t[28]!==o?(e=e=>(0,q.jsx)(Oe,{goal:e,queueItem:a.get(e.id),t:o,language:s,busy:c,actionError:l?.goalId===e.id?l.message:void 0,onOpen:u,onAction:d},e.id),t[22]=l,t[23]=c,t[24]=s,t[25]=d,t[26]=u,t[27]=a,t[28]=o,t[29]=e):e=t[29],y=i.map(e),t[13]=l,t[14]=c,t[15]=i,t[16]=s,t[17]=d,t[18]=u,t[19]=a,t[20]=o,t[21]=y}else y=t[21];let b;t[30]===y?b=t[31]:(b=(0,q.jsx)(`div`,{className:`mt-2`,children:y}),t[30]=y,t[31]=b);let x;return t[32]!==f||t[33]!==v||t[34]!==b?(x=(0,q.jsxs)(`section`,{"aria-labelledby":f,children:[v,b]}),t[32]=f,t[33]=v,t[34]=b,t[35]=x):x=t[35],x}function Me(e){let t=(0,ae.c)(140),{goal:n,queueItem:r,t:i,language:o,busy:c,onClose:l,onAction:u}=e;if(!n)return null;let d,p,m,h,g,x,S,w,T,E,A,j,P,F,I,L,z;if(t[0]!==n||t[1]!==l||t[2]!==r||t[3]!==i){let e=se(n);g=Y(n,r,i);let a;t[21]!==n||t[22]!==r?(a=_e(n,r),t[21]=n,t[22]=r,t[23]=a):a=t[23],h=a,m=D,w=!0,t[24]===l?T=t[25]:(T=e=>!e&&l(),t[24]=l,t[25]=T),p=k,t[26]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,q.jsx)(v,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),t[26]=S):S=t[26],d=y,L=`fixed left-1/2 top-1/2 z-66 flex h-[min(90vh,48rem)] w-[min(100%-2rem,56rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`;let o;t[27]===n.title?o=t[28]:(o=(0,q.jsx)(O,{className:`text-base font-semibold leading-6 text-fg`,children:n.title}),t[27]=n.title,t[28]=o);let c;t[29]!==n||t[30]!==r||t[31]!==i?(c=ve(n,r,i),t[29]=n,t[30]=r,t[31]=i,t[32]=c):c=t[32];let u;t[33]===c?u=t[34]:(u=(0,q.jsx)(R,{className:`mt-1 text-sm text-fg-muted`,children:c}),t[33]=c,t[34]=u);let f;t[35]!==o||t[36]!==u?(f=(0,q.jsxs)(`div`,{className:`min-w-0`,children:[o,u]}),t[35]=o,t[36]=u,t[37]=f):f=t[37];let _;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,q.jsx)(b,{className:`size-5`,"aria-hidden":!0}),t[38]=_):_=t[38];let M;t[39]!==l||t[40]!==i.closeDetails?(M=(0,q.jsx)(C,{type:`button`,variant:`ghost`,className:`size-11 shrink-0 rounded-lg p-0`,"aria-label":i.closeDetails,onClick:l,children:_}),t[39]=l,t[40]=i.closeDetails,t[41]=M):M=t[41],t[42]!==f||t[43]!==M?(z=(0,q.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[f,M]}),t[42]=f,t[43]=M,t[44]=z):z=t[44],I=`min-h-0 flex-1 overflow-y-auto p-5`,F=`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,A=`flex flex-wrap items-center gap-2`;let N=s(`rounded-full px-2.5 py-1 text-xs font-semibold`,X(g.tone));t[45]!==g.label||t[46]!==N?(j=(0,q.jsx)(`span`,{className:N,children:g.label}),t[45]=g.label,t[46]=N,t[47]=j):j=t[47],t[48]===n.agentId?P=t[49]:(P=(0,q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:n.agentId}),t[48]=n.agentId,t[49]=P),x=`text-xs text-fg-muted`,E=J(i.checklistProgress,{done:e.done,total:e.total}),t[0]=n,t[1]=l,t[2]=r,t[3]=i,t[4]=d,t[5]=p,t[6]=m,t[7]=h,t[8]=g,t[9]=x,t[10]=S,t[11]=w,t[12]=T,t[13]=E,t[14]=A,t[15]=j,t[16]=P,t[17]=F,t[18]=I,t[19]=L,t[20]=z}else d=t[4],p=t[5],m=t[6],h=t[7],g=t[8],x=t[9],S=t[10],w=t[11],T=t[12],E=t[13],A=t[14],j=t[15],P=t[16],F=t[17],I=t[18],L=t[19],z=t[20];let B;t[50]!==x||t[51]!==E?(B=(0,q.jsx)(`span`,{className:x,children:E}),t[50]=x,t[51]=E,t[52]=B):B=t[52];let V;t[53]!==B||t[54]!==A||t[55]!==j||t[56]!==P?(V=(0,q.jsxs)(`div`,{className:A,children:[j,P,B]}),t[53]=B,t[54]=A,t[55]=j,t[56]=P,t[57]=V):V=t[57];let ee;t[58]!==c||t[59]!==n||t[60]!==h||t[61]!==u||t[62]!==r||t[63]!==i?(ee=(0,q.jsx)(De,{goal:n,queueItem:r,intent:h,t:i,busy:c,onAction:u}),t[58]=c,t[59]=n,t[60]=h,t[61]=u,t[62]=r,t[63]=i,t[64]=ee):ee=t[64];let H;t[65]!==V||t[66]!==ee||t[67]!==F?(H=(0,q.jsxs)(`div`,{className:F,children:[V,ee]}),t[65]=V,t[66]=ee,t[67]=F,t[68]=H):H=t[68];let te;t[69]===n.description?te=t[70]:(te=n.description?(0,q.jsx)(`p`,{className:`mt-6 max-w-[70ch] whitespace-pre-wrap break-words text-sm leading-6 text-fg-muted`,children:n.description}):null,t[69]=n.description,t[70]=te);let ne=n.blockedReason?i.currentBlocker:i.nextAction,re;t[71]===ne?re=t[72]:(re=(0,q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:ne}),t[71]=ne,t[72]=re);let ie=g.tone===`attention`?`text-amber-800 dark:text-amber-200`:`text-fg-muted`,U;t[73]===ie?U=t[74]:(U=s(`mt-2 text-sm leading-6`,ie),t[73]=ie,t[74]=U);let W;t[75]!==n||t[76]!==r||t[77]!==i?(W=ve(n,r,i),t[75]=n,t[76]=r,t[77]=i,t[78]=W):W=t[78];let oe;t[79]!==U||t[80]!==W?(oe=(0,q.jsx)(`p`,{className:U,children:W}),t[79]=U,t[80]=W,t[81]=oe):oe=t[81];let le;t[82]!==re||t[83]!==oe?(le=(0,q.jsxs)(`section`,{className:`mt-7 border-t border-edge-subtle pt-5`,children:[re,oe]}),t[82]=re,t[83]=oe,t[84]=le):le=t[84];let G;t[85]!==o||t[86]!==r||t[87]!==i?(G=r?(0,q.jsxs)(`section`,{className:`mt-6 border-t border-edge-subtle pt-5`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.workbench.row.latestExecution}),(0,q.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:ge(r.status,i)})]}),(0,q.jsxs)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:[J(i.attempt,{attempts:r.attempts,max:r.maxRetries+1}),` · `,me(ce(r),o)]}),r.error?(0,q.jsx)(`p`,{className:`mt-2 text-sm text-danger`,children:r.error}):null]}):null,t[85]=o,t[86]=r,t[87]=i,t[88]=G):G=t[88];let ue;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,q.jsx)(M,{className:`size-4 text-accent`,"aria-hidden":!0}),t[89]=ue):ue=t[89];let K;t[90]===i.checklist?K=t[91]:(K=(0,q.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[ue,i.checklist]}),t[90]=i.checklist,t[91]=K);let de;t[92]!==n.checklist||t[93]!==i.noChecklist?(de=n.checklist.length?(0,q.jsx)(`ul`,{className:`mt-3 grid gap-2 text-sm leading-6 text-fg-muted`,children:n.checklist.map(Ne)}):(0,q.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:i.noChecklist}),t[92]=n.checklist,t[93]=i.noChecklist,t[94]=de):de=t[94];let fe;t[95]!==K||t[96]!==de?(fe=(0,q.jsxs)(`section`,{className:`mt-6 border-t border-edge-subtle pt-5`,children:[K,de]}),t[95]=K,t[96]=de,t[97]=fe):fe=t[97];let pe;t[98]!==H||t[99]!==te||t[100]!==le||t[101]!==G||t[102]!==fe||t[103]!==I?(pe=(0,q.jsxs)(`div`,{className:I,children:[H,te,le,G,fe]}),t[98]=H,t[99]=te,t[100]=le,t[101]=G,t[102]=fe,t[103]=I,t[104]=pe):pe=t[104];let he;t[105]!==n.id||t[106]!==n.status||t[107]!==u||t[108]!==i.actions?(he=n.status===`active`?(0,q.jsxs)(C,{type:`button`,variant:`ghost`,className:`h-11 rounded-lg`,onClick:()=>u(n.id,`pause`),children:[(0,q.jsx)(N,{className:`size-4`,"aria-hidden":!0}),i.actions.pause]}):null,t[105]=n.id,t[106]=n.status,t[107]=u,t[108]=i.actions,t[109]=he):he=t[109];let Z;t[110]!==n.id||t[111]!==n.status||t[112]!==u||t[113]!==i.actions?(Z=n.status===`archived`?null:(0,q.jsxs)(C,{type:`button`,variant:`ghost`,className:`h-11 rounded-lg`,onClick:()=>u(n.id,`archive`),children:[(0,q.jsx)(f,{className:`size-4`,"aria-hidden":!0}),i.actions.archive]}),t[110]=n.id,t[111]=n.status,t[112]=u,t[113]=i.actions,t[114]=Z):Z=t[114];let Q;t[115]!==he||t[116]!==Z?(Q=(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[he,Z]}),t[115]=he,t[116]=Z,t[117]=Q):Q=t[117];let ye=`/goals/${encodeURIComponent(n.id)}`,$;t[118]===Symbol.for(`react.memo_cache_sentinel`)?($=(0,q.jsx)(_,{className:`size-4`,"aria-hidden":!0}),t[118]=$):$=t[118];let be;t[119]!==i.fullDetails||t[120]!==ye?(be=(0,q.jsx)(C,{asChild:!0,type:`button`,variant:`secondary`,className:`h-11 rounded-lg`,children:(0,q.jsxs)(a,{to:ye,children:[$,i.fullDetails]})}),t[119]=i.fullDetails,t[120]=ye,t[121]=be):be=t[121];let xe;t[122]!==Q||t[123]!==be?(xe=(0,q.jsxs)(`footer`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2 border-t border-edge px-5 py-3`,children:[Q,be]}),t[122]=Q,t[123]=be,t[124]=xe):xe=t[124];let Se;t[125]!==d||t[126]!==pe||t[127]!==xe||t[128]!==L||t[129]!==z?(Se=(0,q.jsxs)(d,{className:L,children:[z,pe,xe]}),t[125]=d,t[126]=pe,t[127]=xe,t[128]=L,t[129]=z,t[130]=Se):Se=t[130];let Ce;t[131]!==p||t[132]!==S||t[133]!==Se?(Ce=(0,q.jsxs)(p,{children:[S,Se]}),t[131]=p,t[132]=S,t[133]=Se,t[134]=Ce):Ce=t[134];let we;return t[135]!==m||t[136]!==w||t[137]!==T||t[138]!==Ce?(we=(0,q.jsx)(m,{open:w,onOpenChange:T,children:Ce}),t[135]=m,t[136]=w,t[137]=T,t[138]=Ce,t[139]=we):we=t[139],we}function Ne(e){return(0,q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,q.jsx)(`span`,{className:`w-5 shrink-0 text-center`,children:$(e.status)}),(0,q.jsx)(`span`,{className:`break-words`,children:e.text})]},e.id)}function Pe(){let e=i(),t=l(e=>e.language),n=c(t).goalsPage,r=h(e=>e.setPageHeader),a=h(e=>e.clearPageHeader),[o,s]=(0,U.useState)([]),[u,d]=(0,U.useState)([]),[f,_]=(0,U.useState)(``),[v,y]=(0,U.useState)(`workbench`),[x,T]=(0,U.useState)(``),[E,D]=(0,U.useState)(``),[O,k]=(0,U.useState)(``),[N,P]=(0,U.useState)(!0),[F,R]=(0,U.useState)(null),[B,ee]=(0,U.useState)(null),[H,ae]=(0,U.useState)(null),[W,se]=(0,U.useState)(null),[ce,G]=(0,U.useState)(!1),[K,me]=(0,U.useState)(null),[he,ge]=(0,U.useState)({defaultAgentId:``,agents:[],models:[],checklistDecomposePolicy:`empty_only`}),Y=(0,U.useCallback)(async()=>{P(!0),R(null);try{let[e,t]=await Promise.all([xe(),Se()]);s(e),d(t)}catch(e){R(e instanceof Error?e.message:n.errors.load)}finally{P(!1)}},[n.errors.load]);(0,U.useEffect)(()=>{Y()},[Y]),(0,U.useEffect)(()=>{let e=!1;async function t(){let[t,n,r]=await Promise.allSettled([g(),w(),V()]);e||ge(e=>{let i=t.status===`fulfilled`?t.value.defaultId:e.defaultAgentId,a=t.status===`fulfilled`?t.value.agents:e.agents;return{defaultAgentId:i,agents:a.length?a:[{id:i||`main`,workspace:``,profileDir:``,typedModels:{defaultRole:`deep`,preset:[],effective:[]},extends:[],isDefault:!0,skills:{preset:[]},tools:{presetDenied:[],entryDisable:[],effectiveDisable:[]}}],models:n.status===`fulfilled`?n.value:e.models,checklistDecomposePolicy:r.status===`fulfilled`?ne(r.value.payload?.config).checklistDecomposePolicy:e.checklistDecomposePolicy}})}return t(),()=>{e=!0}},[]),(0,U.useEffect)(()=>{let e=()=>{Y()};return window.addEventListener(`goal-queue-updated`,e),window.addEventListener(`goal-status-updated`,e),()=>{window.removeEventListener(`goal-queue-updated`,e),window.removeEventListener(`goal-status-updated`,e)}},[Y]),(0,U.useEffect)(()=>{if(!W)return;let e=window.setTimeout(()=>se(null),8e3);return()=>window.clearTimeout(e)},[W]);let X=(0,U.useMemo)(()=>le(u),[u]),Z=(0,U.useMemo)(()=>o.filter(e=>fe(e,f)),[o,f]),Q=(0,U.useMemo)(()=>pe(o,X),[o,X]),ve=(0,U.useMemo)(()=>o.find(e=>e.id===K)??null,[o,K]),ye=(0,U.useMemo)(()=>[...new Set(o.map(e=>e.agentId))].sort(),[o]),$=(0,U.useMemo)(()=>{let e=new Map(oe.map(e=>[e,[]]));for(let t of Z){let n=ue(t,X.get(t.id));n&&e.get(n)?.push(t)}for(let t of oe)e.get(t)?.sort((e,t)=>de(e,t,X));return e},[X,Z]),Ae=(0,U.useMemo)(()=>Z.filter(e=>e.status!==`done`&&e.status!==`archived`).filter(e=>!x||e.agentId===x).filter(e=>!E||e.status===E).filter(e=>!O||e.priority===O).sort((e,t)=>de(e,t,X)),[x,O,X,Z,E]),Ne=(0,U.useMemo)(()=>Z.filter(e=>e.status===`done`||e.status===`archived`).sort((e,t)=>t.updatedAt-e.updatedAt),[Z]),Pe=$.get(`attention`)?.[0]??$.get(`running`)?.[0]??$.get(`ready`)?.[0]??null,Fe=Q.attention>0?{title:Q.attention===1?n.workbench.hero.attentionOne:J(n.workbench.hero.attentionMany,{count:Q.attention}),description:n.workbench.hero.attentionDescription}:Q.running>0?{title:Q.running===1?n.workbench.hero.runningOne:J(n.workbench.hero.runningMany,{count:Q.running}),description:n.workbench.hero.runningDescription}:Q.ready>0?{title:Q.ready===1?n.workbench.hero.readyOne:J(n.workbench.hero.readyMany,{count:Q.ready}),description:n.workbench.hero.readyDescription}:{title:n.workbench.hero.calm,description:Q.later>0?J(n.workbench.hero.calmDescriptionWithPaused,{paused:Q.later}):n.workbench.hero.calmDescription},Ie=(0,U.useCallback)(async(t,r,i)=>{let a=o.find(e=>e.id===t);ae(`${t}:${r}`),ee(null);try{if(r===`continue`){let n=await Ee(t);if(n){e(`/chat/${encodeURIComponent(n)}`);return}}else await Te(t,r),!i?.skipUndo&&a&&(r===`archive`||r===`unarchive`||r===`complete`||r===`reopen`)&&se({goalId:t,action:r,title:a.title});await Y()}catch(e){ee({goalId:t,message:e instanceof Error?e.message:n.errors.action})}finally{ae(null)}},[o,e,Y,n.errors.action]),Le=(0,U.useCallback)(async e=>{let t=Number.parseInt(e.maxTurns,10),r=e.deadline?new Date(e.deadline).getTime():void 0;ae(`create`),R(null);try{let n=await Ce({title:e.title.trim(),contextMessage:{text:e.description.trim(),attachments:e.attachments.length?e.attachments:void 0},priority:e.priority,deadlineAt:Number.isFinite(r)?r:void 0,maxTurns:Number.isFinite(t)?t:void 0,agentId:e.agentId.trim()||void 0,judgeModelRef:e.judgeModelRef.trim()||void 0,contract:{objective:e.objective.trim()||e.title.trim(),scopeBoundary:e.scopeBoundary.trim()||void 0,evidencePlan:re(e.evidencePlan),criteria:re(e.checklist)}});await Y(),me(n.id)}catch(e){throw R(e instanceof Error?e.message:n.errors.create),e}finally{ae(null)}},[Y,n.errors.create]),Re=(0,U.useMemo)(()=>(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`label`,{className:`relative min-w-0`,children:[(0,q.jsx)(j,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,q.jsx)(`input`,{value:f,onChange:e=>_(e.target.value),"aria-label":n.searchPlaceholder,autoComplete:`off`,placeholder:n.searchPlaceholder,className:`h-10 w-36 rounded-lg border border-edge bg-surface-muted py-2 pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted focus-visible:border-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent sm:w-56 lg:w-72`})]}),(0,q.jsx)(L,{className:`size-10 shrink-0 p-0`,loading:N,label:n.refresh,onClick:Y}),(0,q.jsxs)(C,{type:`button`,variant:`primary`,className:`h-10 rounded-lg`,disabled:H===`create`,onClick:()=>G(!0),children:[(0,q.jsx)(S,{className:`size-4`,"aria-hidden":!0}),n.create]})]}),[H,N,f,Y,n.create,n.refresh,n.searchPlaceholder]);(0,U.useLayoutEffect)(()=>(r({startExtra:null,main:(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),(0,q.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:n.workbench.pageDescription})]}),end:Re}),()=>a()),[a,Re,r,n.title,n.workbench.pageDescription]);let ze=[{id:`workbench`,label:n.workbench.tabs.workbench,icon:p,count:Q.attention+Q.running+Q.ready},{id:`all`,label:n.workbench.tabs.all,icon:M,count:o.length-Q.history},{id:`history`,label:n.workbench.tabs.history,icon:m,count:Q.history}],Be=n.workbench.sections;return(0,q.jsxs)(`main`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-surface-panel`,children:[(0,q.jsxs)(`div`,{className:`flex min-h-0 w-full flex-1 flex-col px-3 py-5 sm:px-5 xl:px-6`,children:[(0,q.jsx)(`section`,{className:`rounded-xl border border-edge bg-surface-base px-4 py-5 sm:px-6 sm:py-6`,"aria-labelledby":`goals-now-title`,children:(0,q.jsxs)(`div`,{className:`flex flex-col gap-5 lg:flex-row lg:items-center lg:justify-between`,children:[(0,q.jsxs)(`div`,{className:`min-w-0 max-w-2xl`,children:[(0,q.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:n.workbench.hero.eyebrow}),(0,q.jsx)(`h2`,{id:`goals-now-title`,className:`mt-1.5 text-xl font-semibold tracking-tight text-fg sm:text-2xl`,children:Fe.title}),(0,q.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:Fe.description})]}),Pe?(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 border-t border-edge-subtle pt-4 lg:max-w-md lg:border-l lg:border-t-0 lg:pl-6 lg:pt-0`,children:[(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:n.workbench.hero.nextFocus}),(0,q.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm font-semibold leading-5 text-fg`,children:Pe.title})]}),(0,q.jsx)(De,{goal:Pe,queueItem:X.get(Pe.id),intent:_e(Pe,X.get(Pe.id)),t:n,busy:H,onAction:(e,t)=>void Ie(e,t)})]}):null]})}),(0,q.jsx)(`div`,{className:`mt-5 border-b border-edge-subtle`,children:(0,q.jsx)(te,{items:ze,activeTab:v,onChange:y,ariaLabel:n.workbench.tabs.label,tabIdPrefix:`goals-tab`,panelIdPrefix:`goals-panel`,className:`pb-2`,selectedClassName:`bg-surface-active text-fg`})}),F?(0,q.jsxs)(`div`,{className:`mt-4 flex flex-col gap-3 rounded-lg bg-danger-soft px-4 py-3 text-sm text-danger sm:flex-row sm:items-center sm:justify-between`,role:`alert`,children:[(0,q.jsx)(`span`,{children:F}),(0,q.jsx)(C,{type:`button`,variant:`secondary`,className:`h-10 rounded-lg`,onClick:()=>void Y(),children:n.workbench.actions.retryLoad})]}):null,(0,q.jsxs)(`section`,{id:`goals-panel-${v}`,role:`tabpanel`,"aria-labelledby":`goals-tab-${v}`,className:`min-h-0 flex-1 overflow-y-auto pb-12 pt-5`,children:[N&&o.length===0?(0,q.jsx)(ke,{}):null,!N&&v===`workbench`?(0,q.jsxs)(`div`,{className:`grid gap-9`,children:[[`attention`,`running`,`ready`].map(e=>{let r=$.get(e)??[];return r.length===0?null:(0,q.jsx)(je,{...Be[e],goals:r,queueByGoal:X,t:n,language:t,busy:H,actionError:B,onOpen:e=>me(e.id),onAction:(e,t)=>void Ie(e,t)},e)}),($.get(`attention`)?.length??0)+($.get(`running`)?.length??0)+($.get(`ready`)?.length??0)===0?(0,q.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-base px-5 py-8 text-center`,children:[(0,q.jsx)(A,{className:`mx-auto size-6 text-success`,"aria-hidden":!0}),(0,q.jsx)(`h2`,{className:`mt-3 text-base font-semibold text-fg`,children:n.workbench.empty.healthyTitle}),(0,q.jsx)(`p`,{className:`mx-auto mt-2 max-w-xl text-sm leading-6 text-fg-muted`,children:Q.later>0?J(n.workbench.empty.healthyDescriptionWithPaused,{paused:Q.later}):n.workbench.empty.healthyDescription})]}):null,($.get(`later`)?.length??0)>0?(0,q.jsxs)(`details`,{className:`group border-t border-edge-subtle pt-5`,children:[(0,q.jsxs)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center justify-between gap-3 rounded-lg px-1 text-sm font-semibold text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,q.jsx)(`span`,{children:Be.later.title}),(0,q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1 text-xs tabular-nums text-fg-muted`,children:$.get(`later`)?.length})]}),(0,q.jsx)(`p`,{className:`mt-1 px-1 text-sm text-fg-muted`,children:Be.later.description}),(0,q.jsx)(`div`,{className:`mt-2`,children:($.get(`later`)??[]).map(e=>(0,q.jsx)(Oe,{goal:e,queueItem:X.get(e.id),t:n,language:t,busy:H,actionError:B?.goalId===e.id?B.message:void 0,onOpen:e=>me(e.id),onAction:(e,t)=>void Ie(e,t)},e.id))})]}):null]}):null,!N&&v===`all`?(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2 border-b border-edge-subtle pb-4`,children:[(0,q.jsxs)(z,{value:x,onChange:e=>T(e.target.value),className:`w-full sm:w-44`,"aria-label":n.workbench.filters.agent,children:[(0,q.jsx)(I,{value:``,children:n.workbench.filters.allAgents}),ye.map(e=>(0,q.jsx)(I,{value:e,children:e},e))]}),(0,q.jsxs)(z,{value:E,onChange:e=>D(e.target.value),className:`w-full sm:w-44`,"aria-label":n.workbench.filters.status,children:[(0,q.jsx)(I,{value:``,children:n.workbench.filters.allStatuses}),[`active`,`paused`,`blocked`,`needs_input`].map(e=>(0,q.jsx)(I,{value:e,children:n.statuses[e]},e))]}),(0,q.jsxs)(z,{value:O,onChange:e=>k(e.target.value),className:`w-full sm:w-44`,"aria-label":n.workbench.filters.priority,children:[(0,q.jsx)(I,{value:``,children:n.workbench.filters.allPriorities}),[`high`,`normal`,`low`].map(e=>(0,q.jsx)(I,{value:e,children:n.priorities[e]},e))]}),x||E||O?(0,q.jsx)(C,{type:`button`,variant:`ghost`,className:`h-10 rounded-lg`,onClick:()=>{T(``),D(``),k(``)},children:n.workbench.filters.clear}):null]}),Ae.length?Ae.map(e=>(0,q.jsx)(Oe,{goal:e,queueItem:X.get(e.id),t:n,language:t,busy:H,actionError:B?.goalId===e.id?B.message:void 0,onOpen:e=>me(e.id),onAction:(e,t)=>void Ie(e,t)},e.id)):(0,q.jsxs)(`div`,{className:`py-14 text-center`,children:[(0,q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.workbench.empty.noOpenTitle}),(0,q.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:n.workbench.empty.noOpenDescription})]})]}):null,!N&&v===`history`?(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`header`,{className:`border-b border-edge-subtle pb-4`,children:[(0,q.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.workbench.history.title}),(0,q.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.workbench.history.description})]}),Ne.length?Ne.map(e=>(0,q.jsx)(Oe,{goal:e,queueItem:X.get(e.id),t:n,language:t,busy:H,actionError:B?.goalId===e.id?B.message:void 0,onOpen:e=>me(e.id),onAction:(e,t)=>void Ie(e,t)},e.id)):(0,q.jsxs)(`div`,{className:`py-14 text-center`,children:[(0,q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.workbench.empty.noHistoryTitle}),(0,q.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:n.workbench.empty.noHistoryDescription})]})]}):null]})]}),W?(0,q.jsxs)(`div`,{className:`fixed bottom-5 right-5 z-50 flex max-w-[calc(100%-2rem)] items-center gap-3 rounded-xl border border-edge bg-surface-panel px-4 py-3 shadow-popover`,role:`status`,"aria-live":`polite`,children:[(0,q.jsx)(`p`,{className:`min-w-0 text-sm text-fg`,children:J(n.workbench.undo.message,{title:W.title})}),(0,q.jsx)(C,{type:`button`,variant:`ghost`,className:`h-10 shrink-0 rounded-lg text-accent-fg`,onClick:()=>{let e=W;se(null),Ie(e.goalId,be(e.action),{skipUndo:!0})},children:n.workbench.undo.action}),(0,q.jsx)(C,{type:`button`,variant:`ghost`,className:`size-10 shrink-0 rounded-lg p-0`,"aria-label":n.workbench.undo.dismiss,onClick:()=>se(null),children:(0,q.jsx)(b,{className:`size-4`,"aria-hidden":!0})})]}):null,(0,q.jsx)(ie,{open:ce,t:n,chat:c(t).chat,busy:H===`create`,options:he,onClose:()=>G(!1),onCreate:Le,onDraftContract:e=>we(e,t)}),(0,q.jsx)(Me,{goal:ve,queueItem:ve?X.get(ve.id):void 0,t:n,language:t,busy:H,onClose:()=>me(null),onAction:(e,t)=>void Ie(e,t)})]})}export{Pe as GoalsPage};
|