fifony 0.1.43 → 0.1.47

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.
Files changed (65) hide show
  1. package/app/dist/assets/{CommandPalette-M4VAMxCU.js → CommandPalette-CL8p78lG.js} +1 -1
  2. package/app/dist/assets/{KeyboardShortcutsHelp-DkvPUXQq.js → KeyboardShortcutsHelp-CqEFfGcE.js} +1 -1
  3. package/app/dist/assets/OnboardingWizard-BmI50ZUv.js +1 -0
  4. package/app/dist/assets/analytics.lazy-CXGjZabc.js +1 -0
  5. package/app/dist/assets/{api-CkVfYg_m.js → api-CEr_D4e5.js} +1 -1
  6. package/app/dist/assets/{createLucideIcon-Dfk_Hxud.js → createLucideIcon-luywpIq4.js} +1 -1
  7. package/app/dist/assets/index-CEaccpYh.js +96 -0
  8. package/app/dist/assets/index-CzzWGzux.css +1 -0
  9. package/app/dist/assets/vendor-uqBx3VSC.js +9 -0
  10. package/app/dist/index.html +12 -12
  11. package/app/dist/service-worker.js +15 -5
  12. package/dist/agent/pty-daemon.js +3 -2
  13. package/dist/agent/run-local.js +71 -52
  14. package/dist/{agent-RMQTTUEC.js → agent-DFSFG6DG.js} +18 -12
  15. package/dist/{analytics-broadcaster-O6YBP66L.js → analytics-broadcaster-O4AE3RUK.js} +21 -14
  16. package/dist/approve-plan.command-QGQZZXTQ.js +17 -0
  17. package/dist/{chunk-E2EWEYA4.js → chunk-2PRRKBG6.js} +20 -10
  18. package/dist/chunk-5AMWD66T.js +38 -0
  19. package/dist/{chunk-QQQLP3PL.js → chunk-7TXZYZR5.js} +9 -37
  20. package/dist/chunk-AAVROEQC.js +859 -0
  21. package/dist/{chunk-ESWHDHH6.js → chunk-AAZKYWOY.js} +4 -4
  22. package/dist/chunk-EBCSQFPR.js +682 -0
  23. package/dist/{chunk-BRSR26VK.js → chunk-FH7HUPZX.js} +2 -2
  24. package/dist/chunk-HOIOVUHI.js +35 -0
  25. package/dist/{chunk-AILXZ2TD.js → chunk-JRLWLZOD.js} +20 -13
  26. package/dist/{chunk-YRSH2CLW.js → chunk-K36BWMUV.js} +1741 -1216
  27. package/dist/chunk-N4KFNX2G.js +370 -0
  28. package/dist/chunk-PACI3T4I.js +125 -0
  29. package/dist/{chunk-FJNH3G2Z.js → chunk-PI7Y77R3.js} +38 -663
  30. package/dist/{chunk-DVU3CXWA.js → chunk-PXTIWKLQ.js} +2 -1
  31. package/dist/{chunk-SOBLO4YZ.js → chunk-QH6VCTET.js} +316 -127
  32. package/dist/{chunk-MVTGAKQK.js → chunk-QHISYRXJ.js} +2 -2
  33. package/dist/{chunk-42AMQAJG.js → chunk-VM5QAYP5.js} +2 -2
  34. package/dist/cli.js +17 -11
  35. package/dist/create-issue.command-VAKYRECC.js +24 -0
  36. package/dist/{fsm-issue-YGGF7SIL.js → fsm-issue-EHTSKMFN.js} +9 -8
  37. package/dist/fsm-service-7O4AJG2R.js +32 -0
  38. package/dist/{helpers-L7NYO5XS.js → helpers-ON2S7UEF.js} +2 -2
  39. package/dist/{issue-log-broadcaster-WZAHISYB.js → issue-log-broadcaster-FZGVEEIX.js} +20 -13
  40. package/dist/{issues-3QRR7KM6.js → issues-3YNNTB4U.js} +10 -7
  41. package/dist/{log-analyzer-K7MXQB4T.js → log-analyzer-EIX6R6PP.js} +82 -18
  42. package/dist/logger-IFLXTQPS.js +11 -0
  43. package/dist/mcp/server.js +2 -2
  44. package/dist/merge-workspace.command-T2NIGR4M.js +24 -0
  45. package/dist/{parallel-executor-6INE6NDO.js → parallel-executor-DWESCNX3.js} +20 -14
  46. package/dist/queue-workers-V57BYXAY.js +38 -0
  47. package/dist/replan-issue.command-2GQ3QXCR.js +17 -0
  48. package/dist/retry-issue.command-GJBUUYDJ.js +17 -0
  49. package/dist/scheduler-KYILMWLD.js +32 -0
  50. package/dist/{settings-ZAWDCFP2.js → settings-SOTIS6ZD.js} +32 -12
  51. package/dist/settings.resource-JMD3JQOS.js +30 -0
  52. package/dist/{store-M6NCKMZY.js → store-S3NAYZ3S.js} +18 -12
  53. package/dist/{web-push-AX5IIK3P.js → web-push-QCTLS7EJ.js} +3 -3
  54. package/dist/websocket-T2Y3BY4B.js +61 -0
  55. package/dist/{workspace-CJTWFWTJ.js → workspace-OS7GPMCN.js} +7 -6
  56. package/package.json +8 -5
  57. package/app/dist/assets/OnboardingWizard-B7V9hoCR.js +0 -1
  58. package/app/dist/assets/analytics.lazy-zVJdF880.js +0 -1
  59. package/app/dist/assets/index-BpiCi7Ew.css +0 -1
  60. package/app/dist/assets/index-D2INW0zc.js +0 -47
  61. package/app/dist/assets/vendor-BEoYbFV1.js +0 -9
  62. package/dist/queue-workers-XFZK3TT5.js +0 -32
  63. package/dist/replan-issue.command-4UCWYHGZ.js +0 -15
  64. package/dist/scheduler-ZP7GOZDW.js +0 -26
  65. package/dist/settings.resource-5CW456AZ.js +0 -24
@@ -5,8 +5,11 @@ import {
5
5
  SETTING_ID_ADAPTIVE_REVIEW_ROUTING,
6
6
  SETTING_ID_AGENT_COMMAND,
7
7
  SETTING_ID_AGENT_PROVIDER,
8
+ SETTING_ID_AUTO_APPROVE_TRIVIAL_PLANS,
9
+ SETTING_ID_AUTO_COMMIT_BEFORE_MERGE,
8
10
  SETTING_ID_AUTO_REPLAN_ON_STALL,
9
11
  SETTING_ID_AUTO_REPLAN_STALL_THRESHOLD,
12
+ SETTING_ID_AUTO_RESOLVE_CONFLICTS,
10
13
  SETTING_ID_AUTO_REVIEW_APPROVAL,
11
14
  SETTING_ID_COMMAND_TIMEOUT_MS,
12
15
  SETTING_ID_DEFAULT_EFFORT,
@@ -20,9 +23,13 @@ import {
20
23
  SETTING_ID_MAX_REVIEW_AUTO_RETRIES,
21
24
  SETTING_ID_MAX_TURNS,
22
25
  SETTING_ID_MERGE_MODE,
26
+ SETTING_ID_MESH_BUFFER_SIZE,
27
+ SETTING_ID_MESH_ENABLED,
28
+ SETTING_ID_MESH_PROXY_PORT,
23
29
  SETTING_ID_POLL_INTERVAL_MS,
24
30
  SETTING_ID_PR_BASE_BRANCH,
25
31
  SETTING_ID_RETRY_DELAY_MS,
32
+ SETTING_ID_SANDBOX_EXECUTION,
26
33
  SETTING_ID_SERVICE_ENV,
27
34
  SETTING_ID_STALE_IN_PROGRESS_TIMEOUT_MS,
28
35
  SETTING_ID_TEST_COMMAND,
@@ -40,17 +47,23 @@ import {
40
47
  persistWorkerConcurrencySetting,
41
48
  persistWorkflowConfig,
42
49
  syncRuntimeConfigSettings
43
- } from "./chunk-YRSH2CLW.js";
44
- import "./chunk-BRSR26VK.js";
45
- import "./chunk-QQQLP3PL.js";
46
- import "./chunk-AILXZ2TD.js";
47
- import "./chunk-SOBLO4YZ.js";
48
- import "./chunk-E2EWEYA4.js";
49
- import "./chunk-MVTGAKQK.js";
50
- import "./chunk-FJNH3G2Z.js";
51
- import "./chunk-DVU3CXWA.js";
52
- import "./chunk-ESWHDHH6.js";
53
- import "./chunk-42AMQAJG.js";
50
+ } from "./chunk-K36BWMUV.js";
51
+ import "./chunk-PACI3T4I.js";
52
+ import "./chunk-HOIOVUHI.js";
53
+ import "./chunk-FH7HUPZX.js";
54
+ import "./chunk-N4KFNX2G.js";
55
+ import "./chunk-AAVROEQC.js";
56
+ import "./chunk-5AMWD66T.js";
57
+ import "./chunk-7TXZYZR5.js";
58
+ import "./chunk-JRLWLZOD.js";
59
+ import "./chunk-QH6VCTET.js";
60
+ import "./chunk-2PRRKBG6.js";
61
+ import "./chunk-PI7Y77R3.js";
62
+ import "./chunk-QHISYRXJ.js";
63
+ import "./chunk-EBCSQFPR.js";
64
+ import "./chunk-AAZKYWOY.js";
65
+ import "./chunk-VM5QAYP5.js";
66
+ import "./chunk-PXTIWKLQ.js";
54
67
  import "./chunk-3NE23NYW.js";
55
68
  export {
56
69
  RUNTIME_CONFIG_SETTING_IDS,
@@ -59,8 +72,11 @@ export {
59
72
  SETTING_ID_ADAPTIVE_REVIEW_ROUTING,
60
73
  SETTING_ID_AGENT_COMMAND,
61
74
  SETTING_ID_AGENT_PROVIDER,
75
+ SETTING_ID_AUTO_APPROVE_TRIVIAL_PLANS,
76
+ SETTING_ID_AUTO_COMMIT_BEFORE_MERGE,
62
77
  SETTING_ID_AUTO_REPLAN_ON_STALL,
63
78
  SETTING_ID_AUTO_REPLAN_STALL_THRESHOLD,
79
+ SETTING_ID_AUTO_RESOLVE_CONFLICTS,
64
80
  SETTING_ID_AUTO_REVIEW_APPROVAL,
65
81
  SETTING_ID_COMMAND_TIMEOUT_MS,
66
82
  SETTING_ID_DEFAULT_EFFORT,
@@ -74,9 +90,13 @@ export {
74
90
  SETTING_ID_MAX_REVIEW_AUTO_RETRIES,
75
91
  SETTING_ID_MAX_TURNS,
76
92
  SETTING_ID_MERGE_MODE,
93
+ SETTING_ID_MESH_BUFFER_SIZE,
94
+ SETTING_ID_MESH_ENABLED,
95
+ SETTING_ID_MESH_PROXY_PORT,
77
96
  SETTING_ID_POLL_INTERVAL_MS,
78
97
  SETTING_ID_PR_BASE_BRANCH,
79
98
  SETTING_ID_RETRY_DELAY_MS,
99
+ SETTING_ID_SANDBOX_EXECUTION,
80
100
  SETTING_ID_SERVICE_ENV,
81
101
  SETTING_ID_STALE_IN_PROGRESS_TIMEOUT_MS,
82
102
  SETTING_ID_TEST_COMMAND,
@@ -95,4 +115,4 @@ export {
95
115
  persistWorkflowConfig,
96
116
  syncRuntimeConfigSettings
97
117
  };
98
- //# sourceMappingURL=settings-ZAWDCFP2.js.map
118
+ //# sourceMappingURL=settings-SOTIS6ZD.js.map
@@ -0,0 +1,30 @@
1
+ import {
2
+ getSetting,
3
+ listSettings,
4
+ settings_resource_default,
5
+ updateSetting
6
+ } from "./chunk-K36BWMUV.js";
7
+ import "./chunk-PACI3T4I.js";
8
+ import "./chunk-HOIOVUHI.js";
9
+ import "./chunk-FH7HUPZX.js";
10
+ import "./chunk-N4KFNX2G.js";
11
+ import "./chunk-AAVROEQC.js";
12
+ import "./chunk-5AMWD66T.js";
13
+ import "./chunk-7TXZYZR5.js";
14
+ import "./chunk-JRLWLZOD.js";
15
+ import "./chunk-QH6VCTET.js";
16
+ import "./chunk-2PRRKBG6.js";
17
+ import "./chunk-PI7Y77R3.js";
18
+ import "./chunk-QHISYRXJ.js";
19
+ import "./chunk-EBCSQFPR.js";
20
+ import "./chunk-AAZKYWOY.js";
21
+ import "./chunk-VM5QAYP5.js";
22
+ import "./chunk-PXTIWKLQ.js";
23
+ import "./chunk-3NE23NYW.js";
24
+ export {
25
+ settings_resource_default as default,
26
+ getSetting,
27
+ listSettings,
28
+ updateSetting
29
+ };
30
+ //# sourceMappingURL=settings.resource-JMD3JQOS.js.map
@@ -34,23 +34,29 @@ import {
34
34
  savePlanForIssue,
35
35
  setActiveApiPlugin,
36
36
  upsertPersistedVariable
37
- } from "./chunk-YRSH2CLW.js";
38
- import "./chunk-BRSR26VK.js";
39
- import "./chunk-QQQLP3PL.js";
40
- import "./chunk-AILXZ2TD.js";
41
- import "./chunk-SOBLO4YZ.js";
42
- import "./chunk-E2EWEYA4.js";
43
- import "./chunk-MVTGAKQK.js";
37
+ } from "./chunk-K36BWMUV.js";
38
+ import "./chunk-PACI3T4I.js";
39
+ import "./chunk-HOIOVUHI.js";
40
+ import "./chunk-FH7HUPZX.js";
41
+ import "./chunk-N4KFNX2G.js";
42
+ import "./chunk-AAVROEQC.js";
43
+ import "./chunk-5AMWD66T.js";
44
+ import "./chunk-7TXZYZR5.js";
45
+ import "./chunk-JRLWLZOD.js";
46
+ import "./chunk-QH6VCTET.js";
47
+ import "./chunk-2PRRKBG6.js";
44
48
  import {
45
49
  hasDirtyState,
46
50
  markEventDirty,
47
51
  markIssueDirty,
48
52
  markIssuePlanDirty,
49
53
  markMilestoneDirty
50
- } from "./chunk-FJNH3G2Z.js";
51
- import "./chunk-DVU3CXWA.js";
52
- import "./chunk-ESWHDHH6.js";
53
- import "./chunk-42AMQAJG.js";
54
+ } from "./chunk-PI7Y77R3.js";
55
+ import "./chunk-QHISYRXJ.js";
56
+ import "./chunk-EBCSQFPR.js";
57
+ import "./chunk-AAZKYWOY.js";
58
+ import "./chunk-VM5QAYP5.js";
59
+ import "./chunk-PXTIWKLQ.js";
54
60
  import "./chunk-3NE23NYW.js";
55
61
  export {
56
62
  closeStateStore,
@@ -94,4 +100,4 @@ export {
94
100
  setActiveApiPlugin,
95
101
  upsertPersistedVariable
96
102
  };
97
- //# sourceMappingURL=store-M6NCKMZY.js.map
103
+ //# sourceMappingURL=store-S3NAYZ3S.js.map
@@ -10,8 +10,8 @@ import {
10
10
  isWebPushReady,
11
11
  removeSubscription,
12
12
  sendPushToAll
13
- } from "./chunk-BRSR26VK.js";
14
- import "./chunk-DVU3CXWA.js";
13
+ } from "./chunk-FH7HUPZX.js";
14
+ import "./chunk-PXTIWKLQ.js";
15
15
  export {
16
16
  SETTING_ID_PUSH_CONTACT,
17
17
  SETTING_ID_PUSH_SUBSCRIPTIONS,
@@ -25,4 +25,4 @@ export {
25
25
  removeSubscription,
26
26
  sendPushToAll
27
27
  };
28
- //# sourceMappingURL=web-push-AX5IIK3P.js.map
28
+ //# sourceMappingURL=web-push-QCTLS7EJ.js.map
@@ -0,0 +1,61 @@
1
+ import {
2
+ analyticsRoomHasSubscribers,
3
+ broadcastIssueTransition,
4
+ broadcastSeq,
5
+ broadcastToWebSocketClients,
6
+ issueLogRoomSize,
7
+ lastBroadcastIssueSnapshot,
8
+ makeWebSocketConfig,
9
+ meshRoomHasSubscribers,
10
+ sendToAllClients,
11
+ sendToAnalyticsRoom,
12
+ sendToIssueLogRoom,
13
+ sendToMeshRoom,
14
+ sendToServiceLogRoom,
15
+ serviceLogRoomSize,
16
+ setAnalyticsOnSubscribeFn,
17
+ subscribeAnalyticsRoom,
18
+ subscribeIssueLogRoom,
19
+ subscribeMeshRoom,
20
+ subscribeServiceLogRoom,
21
+ unsubscribeAnalyticsRoom,
22
+ unsubscribeFromAllRooms,
23
+ unsubscribeIssueLogRoom,
24
+ unsubscribeMeshRoom,
25
+ unsubscribeServiceLogRoom,
26
+ wsClients
27
+ } from "./chunk-N4KFNX2G.js";
28
+ import "./chunk-AAVROEQC.js";
29
+ import "./chunk-QHISYRXJ.js";
30
+ import "./chunk-EBCSQFPR.js";
31
+ import "./chunk-VM5QAYP5.js";
32
+ import "./chunk-PXTIWKLQ.js";
33
+ import "./chunk-3NE23NYW.js";
34
+ export {
35
+ analyticsRoomHasSubscribers,
36
+ broadcastIssueTransition,
37
+ broadcastSeq,
38
+ broadcastToWebSocketClients,
39
+ issueLogRoomSize,
40
+ lastBroadcastIssueSnapshot,
41
+ makeWebSocketConfig,
42
+ meshRoomHasSubscribers,
43
+ sendToAllClients,
44
+ sendToAnalyticsRoom,
45
+ sendToIssueLogRoom,
46
+ sendToMeshRoom,
47
+ sendToServiceLogRoom,
48
+ serviceLogRoomSize,
49
+ setAnalyticsOnSubscribeFn,
50
+ subscribeAnalyticsRoom,
51
+ subscribeIssueLogRoom,
52
+ subscribeMeshRoom,
53
+ subscribeServiceLogRoom,
54
+ unsubscribeAnalyticsRoom,
55
+ unsubscribeFromAllRooms,
56
+ unsubscribeIssueLogRoom,
57
+ unsubscribeMeshRoom,
58
+ unsubscribeServiceLogRoom,
59
+ wsClients
60
+ };
61
+ //# sourceMappingURL=websocket-T2Y3BY4B.js.map
@@ -23,11 +23,12 @@ import {
23
23
  shouldSkipMergePath,
24
24
  syncIssueDiffStatsToStore,
25
25
  writeVersionedArtifacts
26
- } from "./chunk-SOBLO4YZ.js";
27
- import "./chunk-FJNH3G2Z.js";
28
- import "./chunk-DVU3CXWA.js";
29
- import "./chunk-ESWHDHH6.js";
30
- import "./chunk-42AMQAJG.js";
26
+ } from "./chunk-QH6VCTET.js";
27
+ import "./chunk-PI7Y77R3.js";
28
+ import "./chunk-EBCSQFPR.js";
29
+ import "./chunk-AAZKYWOY.js";
30
+ import "./chunk-VM5QAYP5.js";
31
+ import "./chunk-PXTIWKLQ.js";
31
32
  export {
32
33
  assertIssueHasGitWorktree,
33
34
  bootstrapSource,
@@ -54,4 +55,4 @@ export {
54
55
  syncIssueDiffStatsToStore,
55
56
  writeVersionedArtifacts
56
57
  };
57
- //# sourceMappingURL=workspace-CJTWFWTJ.js.map
58
+ //# sourceMappingURL=workspace-OS7GPMCN.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fifony",
3
- "version": "0.1.43",
3
+ "version": "0.1.47",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -44,7 +44,8 @@
44
44
  "node": ">=23"
45
45
  },
46
46
  "dependencies": {
47
- "@huggingface/transformers": "^3.8.1",
47
+ "@huggingface/transformers": "^4.0.0",
48
+ "@xyflow/react": "^12.10.2",
48
49
  "cli-args-parser": "^1.0.6",
49
50
  "node-cron": "^4.2.1",
50
51
  "node-pty": "1.2.0-beta.12",
@@ -52,16 +53,17 @@
52
53
  "pino-pretty": "^13.1.3",
53
54
  "raffel": "^1.0.19",
54
55
  "react-hotkeys-hook": "^5.2.4",
56
+ "react-markdown": "^10.1.0",
55
57
  "recker": "^1.0.86",
56
- "s3db.js": "21.3.20",
58
+ "s3db.js": "21.4.1",
57
59
  "web-push": "^3.6.7",
58
60
  "yaml": "^2.8.3"
59
61
  },
60
62
  "devDependencies": {
61
63
  "@tailwindcss/vite": "^4.2.2",
62
64
  "@tanstack/react-query": "^5.95.2",
63
- "@tanstack/react-router": "^1.168.7",
64
- "@tanstack/router-plugin": "^1.167.8",
65
+ "@tanstack/react-router": "^1.168.8",
66
+ "@tanstack/router-plugin": "^1.167.10",
65
67
  "@vitejs/plugin-react": "^6.0.1",
66
68
  "daisyui": "^5.5.19",
67
69
  "lucide-react": "^1.7.0",
@@ -83,6 +85,7 @@
83
85
  "build": "pnpm prompts:generate && tsup && vite build --config app/vite.config.js",
84
86
  "build:server": "pnpm prompts:generate && tsup",
85
87
  "build:ui": "vite build --config app/vite.config.js",
88
+ "pwa:check": "node --import tsx ./scripts/check-pwa.ts",
86
89
  "mcp": "pnpm prompts:generate && node ./bin/fifony.js mcp",
87
90
  "lint": "tsx ./scripts/lint.ts",
88
91
  "test": "node --import tsx/esm --test 'tests/**/*.test.ts'",
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{I as t,h as n,m as r}from"./vendor-BEoYbFV1.js";import{t as i}from"./api-CkVfYg_m.js";import{t as a}from"./createLucideIcon-Dfk_Hxud.js";import{B as o,C as s,E as c,F as l,H as u,I as d,L as f,M as p,N as m,P as h,Q as g,R as _,S as v,T as y,U as b,V as x,W as S,X as C,Y as w,Z as T,a as E,d as D,f as O,g as k,h as A,j,l as M,m as N,n as P,o as F,p as I,q as ee,r as te,u as ne,w as L,x as R,y as z}from"./index-D2INW0zc.js";var re=a(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),B=a(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),V=e(t(),1),H=n();function ie(){let e=(0,V.useRef)(null),t=(0,V.useRef)([]),n=(0,V.useRef)(null);return(0,V.useEffect)(()=>{let r=e.current;if(!r)return;let i=r.getContext(`2d`),a=[`♪`,`♫`,`♩`,`♬`],o=[`oklch(0.75 0.18 250)`,`oklch(0.80 0.16 200)`,`oklch(0.70 0.20 330)`,`oklch(0.85 0.14 85)`,`oklch(0.75 0.18 145)`,`oklch(0.80 0.12 280)`,`oklch(0.78 0.15 30)`],s=o.length,c=a.length,l=document.createElement(`canvas`);l.width=s*56,l.height=c*56;let u=l.getContext(`2d`);u.textAlign=`center`,u.textBaseline=`middle`,u.font=`48px serif`;let d=[];for(let e=0;e<c;e++){d[e]=[];for(let t=0;t<s;t++){let n=t*56+56/2,r=e*56+56/2;u.fillStyle=o[t],u.fillText(a[e],n,r),d[e][t]={x:t*56,y:e*56}}}let f=0,p=0,m=()=>{let e=window.devicePixelRatio||1;f=window.innerWidth,p=window.innerHeight,r.width=f*e,r.height=p*e,r.style.width=f+`px`,r.style.height=p+`px`,i.setTransform(e,0,0,e,0,0)};m();function h(){let e=f/2,t=p*.38,n=Math.random()*Math.PI*2,r=Math.random()*1.8+.4,i=Math.random()*20,a=Math.floor(Math.random()*c),o=Math.floor(Math.random()*s);return{x:e+Math.cos(n)*i,y:t+Math.sin(n)*i,vx:Math.cos(n)*r,vy:Math.sin(n)*r,gravity:.003+Math.random()*.005,scale:Math.random()*.4+.25,si:a,ci:o,rotation:Math.random()*Math.PI*2,rotationSpeed:(Math.random()-.5)*.04,life:0,maxLife:180+Math.random()*200,fadeIn:15}}let g=Math.min(Math.floor(f*p/6e3),120);t.current=[];for(let e=0;e<g;e++){let e=h(),n=Math.random()*e.maxLife*.8;e.x+=e.vx*n,e.y+=e.vy*n+.5*e.gravity*n*n,e.rotation+=e.rotationSpeed*n,e.life=n,t.current.push(e)}let _=Math.max(1,Math.floor(g/90)),v=0,y=()=>{if(i.clearRect(0,0,f,p),v++,v%2==0)for(let e=0;e<_;e++)t.current.push(h());let e=[];for(let n of t.current){if(n.life++,n.x+=n.vx,n.y+=n.vy,n.vy+=n.gravity,n.rotation+=n.rotationSpeed,n.vx*=.998,n.vy*=.998,n.life>n.maxLife||n.x<-60||n.x>f+60||n.y<-60||n.y>p+60)continue;e.push(n);let t=Math.min(1,n.life/n.fadeIn),r=n.maxLife*.6,a=t*(n.life>r?1-(n.life-r)/(n.maxLife-r):1)*.45;if(a<=.01)continue;let o=d[n.si][n.ci],s=56*n.scale,c=s/2;i.save(),i.translate(n.x,n.y),i.rotate(n.rotation),i.globalAlpha=a,i.drawImage(l,o.x,o.y,56,56,-c,-c,s,s),i.restore()}t.current=e,n.current=requestAnimationFrame(y)};return n.current=requestAnimationFrame(y),window.addEventListener(`resize`,m),()=>{cancelAnimationFrame(n.current),window.removeEventListener(`resize`,m)}},[]),(0,H.jsx)(`canvas`,{ref:e,className:`fixed inset-0 pointer-events-none`,style:{zIndex:0},"aria-hidden":`true`})}var ae=[`Welcome`,`Setup`,`Pipeline`,`Agents & Skills`,`Preferences`,`Launch`];function oe(){return ae}function se(){return ae.length}var U=[`Setup`,`Pipeline`,`Agents`,`Preferences`,`Launch`];function ce(){return U}var W=[{value:`low`,label:`Low`,icon:te,description:`Quick and light -- fast responses, less thorough`,color:`text-info`},{value:`medium`,label:`Medium`,icon:s,description:`Balanced -- good mix of speed and quality`,color:`text-success`},{value:`high`,label:`High`,icon:re,description:`Thorough -- deeper analysis, takes more time`,color:`text-warning`},{value:`extra-high`,label:`Extra High`,icon:c,description:`Maximum depth -- most thorough, slowest`,color:`text-error`}],G={codex:W,claude:W,gemini:W.filter(e=>e.value!==`extra-high`)};function K(e,t){return G[t?.[e]||`codex`]||W}var le=[{value:`auto`,label:`Auto`},{value:`light`,label:`Light`},{value:`dark`,label:`Dark`},{value:`black`,label:`Black`},{value:`cupcake`,label:`Cupcake`},{value:`night`,label:`Night`},{value:`sunset`,label:`Sunset`}],q=[{role:`planner`,label:`Planner`,description:`Scopes the issue, breaks it into steps, and decides the approach`,icon:re,color:`text-info`},{role:`executor`,label:`Executor`,description:`Implements the plan — writes code, edits files, runs commands`,icon:te,color:`text-primary`},{role:`reviewer`,label:`Reviewer`,description:`Validates the result — checks correctness, scope, and quality`,icon:ne,color:`text-secondary`}];async function J(e,t,n=`ui`){return i.post(`/settings/${encodeURIComponent(e)}`,{value:t,scope:n,source:`user`})}function Y(e,t=`medium`){return W.some(t=>t.value===e)?e:t}function ue(e){return!e||typeof e!=`object`||Array.isArray(e)?{planner:`medium`,executor:`medium`,reviewer:`medium`}:{planner:Y(e.planner??e.default,`medium`),executor:Y(e.executor??e.default,`medium`),reviewer:Y(e.reviewer??e.default,`medium`)}}function de(e,t,n={}){return{plan:{provider:e.planner||e.executor||``,model:n.plan||``,effort:t.planner||`medium`},execute:{provider:e.executor||``,model:n.execute||``,effort:t.executor||`medium`},review:{provider:e.reviewer||e.executor||``,model:n.review||``,effort:t.reviewer||`medium`}}}function X(e){return!!(e?.isGit&&e?.hasCommits)}function fe(e,t){return!!e&&X(t)}function pe({current:e}){let t=ce(),n=e-1;return(0,H.jsx)(`ul`,{className:`steps steps-horizontal w-full max-w-2xl text-xs`,children:t.map((e,t)=>{let r=t<n,i=t===n;return(0,H.jsx)(`li`,{"data-content":r?`✓`:t+1,className:`step ${r||i?`step-primary`:``}`,style:{transition:`color 0.3s ease`},children:e},e)})})}function me({direction:e,stepKey:t,center:n,children:r}){return(0,H.jsx)(`div`,{className:`${e===`forward`?`animate-slide-in-right`:`animate-slide-in-left`} w-full max-w-2xl mx-auto ${n?`my-auto`:``}`,children:r},t)}function he({step:e,stepCount:t,stepName:n,canProceed:r,launching:i,onBack:a,onNext:o,onLaunch:s}){return e===0?null:(0,H.jsxs)(`div`,{className:`relative z-10 p-4 pb-6 flex items-center max-w-2xl mx-auto w-full justify-between`,children:[(0,H.jsxs)(`button`,{className:`btn btn-ghost gap-1`,onClick:a,disabled:i,children:[(0,H.jsx)(l,{className:`size-4`}),` Back`]}),e<t-1?(0,H.jsxs)(`button`,{className:`btn btn-primary gap-1`,onClick:o,disabled:!r,children:[`Next `,(0,H.jsx)(h,{className:`size-4`})]}):(0,H.jsx)(`button`,{className:`btn btn-primary btn-lg gap-2 animate-pulse-soft`,onClick:s,disabled:i,children:i?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(k,{className:`size-5 animate-spin`}),` Launching...`]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(D,{className:`size-5`}),` Launch fifony`]})})]})}function ge({workspacePath:e,onGetStarted:t}){return(0,H.jsxs)(`div`,{className:`flex flex-col items-center text-center gap-6 stagger-children py-4`,children:[(0,H.jsx)(`img`,{src:g,alt:`fifony mascot`,className:`h-72 sm:h-96 object-contain animate-bounce-in select-none pointer-events-none`,style:{filter:`drop-shadow(0 12px 40px rgba(128, 0, 255, 0.3))`}}),(0,H.jsxs)(`h1`,{className:`text-4xl sm:text-5xl font-bold tracking-tight leading-none`,style:{fontFamily:`'Space Grotesk', system-ui, sans-serif`},children:[`Welcome to `,(0,H.jsx)(`span`,{className:`text-primary`,children:`fifony`})]}),(0,H.jsx)(`p`,{className:`text-base-content/60 text-lg max-w-md`,children:`Let's set up your AI orchestration project in just a few steps.`}),e&&(0,H.jsxs)(`div`,{className:`badge badge-lg badge-soft badge-primary gap-2`,children:[(0,H.jsx)(M,{className:`size-3.5`}),`Project target: `,e]}),(0,H.jsxs)(`button`,{className:`btn btn-primary btn-lg gap-2 mt-2`,onClick:t,children:[`Get Started `,(0,H.jsx)(h,{className:`size-5`})]})]})}var Z=new Set([`main`,`master`]);function _e(){let[e,t]=(0,V.useState)(null),[n,r]=(0,V.useState)(!1),[a,o]=(0,V.useState)(!1);return(0,V.useEffect)(()=>{i.get(`/gitignore/status`).then(t).catch(()=>t({exists:!1,hasFifony:!1}))},[]),e===null||e.hasFifony?null:a?(0,H.jsxs)(`div`,{className:`alert alert-success py-2.5 text-sm animate-fade-in`,children:[(0,H.jsx)(B,{className:`size-4 shrink-0`}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`code`,{children:`.fifony/`}),` adicionado ao `,(0,H.jsx)(`code`,{children:`.gitignore`})]})]}):(0,H.jsxs)(`div`,{className:`alert alert-warning py-2.5 text-sm`,children:[(0,H.jsx)(B,{className:`size-4 shrink-0`}),(0,H.jsxs)(`div`,{className:`flex-1`,children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`code`,{children:`.fifony/`}),` não está no `,(0,H.jsx)(`code`,{children:`.gitignore`})]}),(0,H.jsx)(`span`,{className:`text-base-content/50 block text-xs mt-0.5`,children:`O fifony guarda estado local lá — não deve ser commitado.`})]}),(0,H.jsx)(`button`,{className:`btn btn-xs btn-warning`,onClick:async()=>{r(!0);try{await i.post(`/gitignore/add`),o(!0)}catch{}finally{r(!1)}},disabled:n,children:n?(0,H.jsx)(k,{className:`size-3 animate-spin`}):`Adicionar`})]})}function ve({currentBranch:e,onBranchCreated:t,onGitStatusChange:n}){let[r,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(!1),[c,l]=(0,V.useState)(null),[u,d]=(0,V.useState)(e);(0,V.useEffect)(()=>{i.get(`/git/status`).then(e=>{a(e),e.branch&&d(e.branch)}).catch(()=>a({isGit:!1,branch:e||null,hasCommits:!1}))},[]),(0,V.useEffect)(()=>{n?.(r)},[r,n]);let[f,p]=(0,V.useState)(!1),[h,g]=(0,V.useState)(``),[_,y]=(0,V.useState)(!1),[b,x]=(0,V.useState)(null),[S,C]=(0,V.useState)(null),w=r===null||r.isGit,T=r?.hasCommits??!1,E=Z.has(u),D=h.trim(),O=/^[a-zA-Z0-9/_.-]+$/.test(D)&&D.length>0,j=D===u;function M(){p(!0),g(u||``),x(null),C(null)}async function N(){if(!(!O||j||_)){y(!0),x(null);try{let e=await i.post(`/git/switch`,{branchName:D});if(!e.ok)throw Error(e.error||`Failed to switch branch.`);d(D),C({branch:D,created:e.created}),p(!1),t?.(D)}catch(e){x(e instanceof Error?e.message:String(e))}finally{y(!1)}}}async function P(){s(!0),l(null);try{let e=await i.post(`/git/init`,{});if(!e.ok)throw Error(e.error||`Failed to initialize git.`);a({isGit:!!(e.isGit??!0),branch:e.branch||null,hasCommits:!!(e.hasCommits??!0)}),d(e.branch||u)}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(!1)}}return(0,H.jsxs)(`div`,{className:`bg-base-200 rounded-2xl p-5 flex flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(v,{className:`size-4 text-primary`}),(0,H.jsx)(`div`,{className:`text-sm font-semibold`,children:`Working branch`})]}),(0,H.jsx)(`p`,{className:`text-xs text-base-content/50 -mt-2`,children:`Agents create worktrees based on the current branch. We recommend not working directly on main.`}),r!==null&&!r.isGit&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,H.jsxs)(`div`,{className:`alert alert-warning py-3`,children:[(0,H.jsx)(R,{className:`size-4 shrink-0`}),(0,H.jsxs)(`div`,{className:`text-sm`,children:[(0,H.jsx)(`p`,{className:`font-semibold`,children:`Not a git repository`}),(0,H.jsx)(`p`,{className:`opacity-80 mt-0.5`,children:`fifony requires git and an initial commit to create agent worktrees. Initialize it here to continue.`})]})]}),c&&(0,H.jsxs)(`p`,{className:`text-xs text-error flex items-center gap-1`,children:[(0,H.jsx)(F,{className:`size-3`}),` `,c]}),(0,H.jsxs)(`button`,{className:`btn btn-primary gap-2 self-start`,onClick:P,disabled:o,children:[o?(0,H.jsx)(k,{className:`size-4 animate-spin`}):(0,H.jsx)(R,{className:`size-4`}),`Initialize git repository`]})]}),r!==null&&r.isGit&&!T&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,H.jsxs)(`div`,{className:`alert alert-warning py-3`,children:[(0,H.jsx)(R,{className:`size-4 shrink-0`}),(0,H.jsxs)(`div`,{className:`text-sm`,children:[(0,H.jsx)(`p`,{className:`font-semibold`,children:`Repository has no commits yet`}),(0,H.jsx)(`p`,{className:`opacity-80 mt-0.5`,children:`fifony needs one initial commit before it can create per-issue git worktrees. Create it here to continue.`})]})]}),c&&(0,H.jsxs)(`p`,{className:`text-xs text-error flex items-center gap-1`,children:[(0,H.jsx)(F,{className:`size-3`}),` `,c]}),(0,H.jsxs)(`button`,{className:`btn btn-primary gap-2 self-start`,onClick:P,disabled:o,children:[o?(0,H.jsx)(k,{className:`size-4 animate-spin`}):(0,H.jsx)(R,{className:`size-4`}),`Create initial commit`]})]}),r?.isGit&&r?.hasCommits&&r?.isClean===!1&&(0,H.jsxs)(`div`,{className:`alert alert-info py-3 text-sm`,children:[(0,H.jsx)(F,{className:`size-4 shrink-0`}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`font-semibold`,children:`Working tree has uncommitted changes`}),(0,H.jsxs)(`p`,{className:`opacity-80 mt-0.5`,children:[r.untrackedCount>0?`${r.untrackedCount} untracked file${r.untrackedCount>1?`s`:``} found. `:``,`Commit or stash your changes before merging issues — fifony requires a clean working tree to merge agent work.`]})]})]}),w&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[f?(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsxs)(`label`,{className:`input input-bordered flex items-center gap-2 flex-1`,children:[(0,H.jsx)(v,{className:`size-3.5 opacity-40`}),(0,H.jsx)(`input`,{type:`text`,className:`grow font-mono text-sm`,value:h,onChange:e=>{g(e.target.value),x(null)},onKeyDown:e=>{e.key===`Enter`&&N(),e.key===`Escape`&&(p(!1),x(null))},placeholder:`develop`,autoFocus:!0,disabled:_})]}),(0,H.jsx)(`button`,{className:`btn btn-primary`,onClick:N,disabled:!O||j||_,children:_?(0,H.jsx)(A,{className:`size-4 animate-spin`}):`Switch`}),(0,H.jsx)(`button`,{className:`btn btn-ghost`,onClick:()=>{p(!1),x(null)},disabled:_,children:`Cancel`})]}),b&&(0,H.jsxs)(`p`,{className:`text-xs text-error flex items-center gap-1`,children:[(0,H.jsx)(F,{className:`size-3`}),` `,b]}),(0,H.jsx)(`p`,{className:`text-xs opacity-40`,children:`Switches to the branch if it exists, or creates it from the current HEAD.`})]}):(0,H.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 rounded-box border border-base-300 bg-base-100 cursor-pointer hover:border-primary/40 transition-colors group`,onClick:M,role:`button`,tabIndex:0,onKeyDown:e=>e.key===`Enter`&&M(),children:[(0,H.jsx)(v,{className:`size-4 opacity-50 shrink-0`}),(0,H.jsx)(`span`,{className:`text-sm opacity-50`,children:`Current branch:`}),(0,H.jsx)(`span`,{className:`font-mono text-sm font-semibold`,children:u||(r===null?`…`:`—`)}),E&&(0,H.jsx)(`span`,{className:`badge badge-warning badge-sm ml-auto shrink-0`,children:`protected`}),!E&&(0,H.jsx)(I,{className:`size-3.5 opacity-0 group-hover:opacity-40 ml-auto shrink-0 transition-opacity`})]}),S&&(0,H.jsxs)(`div`,{className:`alert alert-success py-3 text-sm animate-fade-in`,children:[(0,H.jsx)(m,{className:`size-4 shrink-0`}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`font-semibold`,children:S.created?`Branch created`:`Switched to branch`}),(0,H.jsxs)(`p`,{className:`opacity-75 font-mono mt-0.5`,children:[`Now on `,(0,H.jsx)(`span`,{className:`text-success-content`,children:S.branch}),` — agents will use this as the base branch`]})]})]}),E&&!f&&(0,H.jsxs)(`div`,{className:`alert alert-warning py-3`,children:[(0,H.jsx)(F,{className:`size-4 shrink-0`}),(0,H.jsxs)(`div`,{className:`text-sm`,children:[(0,H.jsxs)(`p`,{className:`font-semibold`,children:[`Working directly on `,(0,H.jsx)(`span`,{className:`font-mono`,children:u})]}),(0,H.jsx)(`p`,{className:`opacity-80 mt-0.5`,children:`In teams with protected branches, local merges are rejected. Click the branch above to switch, or use Push PR mode.`})]})]}),(0,H.jsx)(_e,{})]})]})}function ye({mergeMode:e,setMergeMode:t,prBaseBranch:n,setPrBaseBranch:r,currentBranch:i}){return(0,H.jsxs)(`div`,{className:`bg-base-200 rounded-2xl p-5 flex flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(z,{className:`size-4 text-primary`}),(0,H.jsx)(`div`,{className:`text-sm font-semibold`,children:`Merge mode`})]}),(0,H.jsx)(`p`,{className:`text-xs text-base-content/50 -mt-2`,children:`Choose how completed issues are integrated: local git merge or push a PR to GitHub.`}),(0,H.jsxs)(`div`,{className:`flex gap-3`,children:[(0,H.jsxs)(`label`,{className:`flex-1 cursor-pointer rounded-xl border-2 p-3 text-center text-sm font-medium transition-colors ${e===`local`?`border-primary bg-primary/10`:`border-base-300 bg-base-100`}`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`mergeMode`,className:`hidden`,checked:e===`local`,onChange:()=>t(`local`)}),(0,H.jsx)(R,{className:`size-4 mx-auto mb-1 opacity-60`}),`Local merge`]}),(0,H.jsxs)(`label`,{className:`flex-1 cursor-pointer rounded-xl border-2 p-3 text-center text-sm font-medium transition-colors ${e===`push-pr`?`border-primary bg-primary/10`:`border-base-300 bg-base-100`}`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`mergeMode`,className:`hidden`,checked:e===`push-pr`,onChange:()=>t(`push-pr`)}),(0,H.jsx)(z,{className:`size-4 mx-auto mb-1 opacity-60`}),`Push PR`]})]}),e===`push-pr`&&(0,H.jsxs)(`label`,{className:`form-control w-full gap-2`,children:[(0,H.jsx)(`span`,{className:`label-text text-sm font-medium`,children:`PR base branch`}),(0,H.jsx)(`input`,{type:`text`,className:`input input-bordered w-full text-sm font-mono`,placeholder:i||`main`,value:n,onChange:e=>r(e.target.value)}),(0,H.jsx)(`p`,{className:`text-xs opacity-40`,children:`Branch that PRs will target. Defaults to the current branch.`})]})]})}function be({testCommand:e,setTestCommand:t}){return(0,H.jsxs)(`div`,{className:`bg-base-200 rounded-2xl p-5 flex flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(y,{className:`size-4 text-primary`}),(0,H.jsx)(`div`,{className:`text-sm font-semibold`,children:`Test command`})]}),(0,H.jsx)(`p`,{className:`text-xs text-base-content/50 -mt-2`,children:`Validation gate: this command runs before merge/done. Leave empty to skip.`}),(0,H.jsx)(`input`,{type:`text`,className:`input input-bordered w-full text-sm font-mono`,placeholder:`pnpm test`,value:e,onChange:e=>t(e.target.value)})]})}function xe({autoReviewApproval:e,setAutoReviewApproval:t}){return(0,H.jsxs)(`div`,{className:`bg-base-200 rounded-2xl p-5 flex flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(B,{className:`size-4 text-primary`}),(0,H.jsx)(`div`,{className:`text-sm font-semibold`,children:`Review completion`})]}),(0,H.jsx)(`p`,{className:`text-xs text-base-content/50 -mt-2`,children:`Control whether completed reviews move issues directly to Done or require manual confirmation.`}),(0,H.jsxs)(`label`,{className:`label cursor-pointer justify-start gap-3`,children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`toggle toggle-sm toggle-primary`,checked:e,onChange:e=>t(e.target.checked)}),(0,H.jsx)(`span`,{className:`label-text text-sm`,children:`Automatic review approval`})]}),(0,H.jsx)(`p`,{className:`text-xs text-base-content/50`,children:e?`Checked: issues move to Approved when the reviewer succeeds, or when no reviewer is configured.`:`Unchecked: issues stop in Pending Decision and require manual approval action.`})]})}function Se({projectName:e,setProjectName:t,detectedProjectName:n,projectSource:r,workspacePath:i,currentBranch:a,onGitStatusChange:o,onBranchCreated:s,mergeMode:c,setMergeMode:l,prBaseBranch:d,setPrBaseBranch:f,autoReviewApproval:p,setAutoReviewApproval:m,testCommand:h,setTestCommand:g}){let _=b(e),v=u(_||n),y=_?r===`saved`||r===`detected`?r:`manual`:n?`detected`:`missing`;return(0,H.jsxs)(`div`,{className:`flex flex-col gap-6 py-4`,children:[(0,H.jsxs)(`div`,{className:`text-center space-y-3`,children:[(0,H.jsx)(`div`,{className:`inline-flex size-14 items-center justify-center rounded-full bg-primary/10 text-primary mx-auto`,children:(0,H.jsx)(L,{className:`size-7`})}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`h2`,{className:`text-2xl font-bold tracking-tight`,children:`Set up your workspace`}),(0,H.jsx)(`p`,{className:`text-base-content/60 max-w-xl mx-auto text-sm`,children:`Name your project and configure the working branch`})]})]}),(0,H.jsxs)(`div`,{className:`bg-base-200 rounded-2xl p-5 flex flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-sm font-semibold`,children:`Project name`}),(0,H.jsx)(`div`,{className:`text-xs text-base-content/50`,children:`This becomes the default queue title for future runs.`})]}),y===`saved`&&(0,H.jsxs)(`span`,{className:`badge badge-primary badge-soft gap-1.5`,children:[(0,H.jsx)(M,{className:`size-3`}),`Saved configuration`]}),y===`detected`&&(0,H.jsxs)(`span`,{className:`badge badge-secondary badge-soft gap-1.5`,children:[(0,H.jsx)(M,{className:`size-3`}),`Detected automatically`]}),y===`manual`&&(0,H.jsxs)(`span`,{className:`badge badge-accent badge-soft gap-1.5`,children:[(0,H.jsx)(I,{className:`size-3`}),`Edited manually`]}),y===`missing`&&(0,H.jsxs)(`span`,{className:`badge badge-warning badge-soft gap-1.5`,children:[(0,H.jsx)(F,{className:`size-3`}),`Manual entry required`]})]}),(0,H.jsxs)(`label`,{className:`form-control w-full gap-2`,children:[(0,H.jsx)(`span`,{className:`label-text text-sm font-medium`,children:`Project`}),(0,H.jsx)(`input`,{type:`text`,className:`input input-bordered w-full text-base`,placeholder:n||`Enter your project name`,value:e,onChange:e=>t(e.target.value),onBlur:n=>{let r=b(n.target.value);r!==e&&t(r)}})]}),i&&(0,H.jsxs)(`div`,{className:`text-xs text-base-content/50 break-all`,children:[`Workspace: `,i]}),!n&&!_&&(0,H.jsxs)(`div`,{className:`alert alert-warning text-sm`,children:[(0,H.jsx)(F,{className:`size-4 shrink-0`}),(0,H.jsx)(`span`,{children:`We could not detect a project name from the current directory. Enter one to continue.`})]}),(0,H.jsxs)(`div`,{className:`rounded-xl border border-base-300/70 bg-base-100 px-4 py-3`,children:[(0,H.jsx)(`div`,{className:`text-xs uppercase tracking-[0.2em] text-base-content/40`,children:`Queue title preview`}),(0,H.jsx)(`div`,{className:`mt-1.5 text-base font-semibold tracking-tight break-words`,children:v})]})]}),(0,H.jsx)(ve,{currentBranch:a,onGitStatusChange:o,onBranchCreated:s}),(0,H.jsx)(ye,{mergeMode:c,setMergeMode:l,prBaseBranch:d,setPrBaseBranch:f,currentBranch:a}),(0,H.jsx)(xe,{autoReviewApproval:p,setAutoReviewApproval:m}),(0,H.jsx)(be,{testCommand:h,setTestCommand:g})]})}var Ce={planner:`plan`,executor:`execute`,reviewer:`review`};function Q({options:e,value:t,onChange:n}){return(0,H.jsx)(`div`,{className:`flex gap-1 flex-wrap`,children:e.map(e=>{let r=e.value===t,i=e.icon;return(0,H.jsxs)(`button`,{type:`button`,onClick:()=>n(e.value),className:`flex items-center gap-1 px-2.5 py-1 rounded-full text-[11px] font-medium border transition-all ${r?`${e.color} border-current bg-base-300`:`text-base-content/35 border-base-content/10 hover:border-base-content/30 hover:text-base-content/60`}`,children:[(0,H.jsx)(i,{className:`size-2.5`}),e.label]},e.value)})})}function we({providers:e,providersLoading:t,pipeline:n,setPipeline:r,efforts:i,setEfforts:a,models:o,setModels:s,modelsByProvider:c}){let l=Array.isArray(e)?e:[],u=l.filter(e=>e.available!==!1),d=n.planner&&n.planner===n.executor&&n.planner===n.reviewer,f=(0,V.useMemo)(()=>{let e=q.map(e=>new Set(K(e.role,n).map(e=>e.value)));if(e.length===0)return W;let t=[...e[0]].filter(t=>e.every(e=>e.has(t))),r=W.filter(e=>t.includes(e.value));return r.length>0?r:W},[n]),m=(0,V.useMemo)(()=>{let e=(i.planner===i.executor&&i.planner===i.reviewer?i.planner:null)||f[0]?.value||`high`;return f.some(t=>t.value===e)?e:`high`},[i,f]),h=e=>e?.id||e?.name||e,g=e=>(c?.[e]||[])[0]?.id||``,v=e=>{let t=h(e);if(!t)return;let n=g(t);r({planner:t,executor:t,reviewer:t}),s({plan:n,execute:n,review:n})};return(0,V.useEffect)(()=>{for(let e of[`planner`,`executor`,`reviewer`]){let t=K(e,n),r=i[e];r&&!t.some(e=>e.value===r)&&a(t=>({...t,[e]:`high`}))}},[n,i,a]),(0,H.jsxs)(`div`,{className:`flex flex-col gap-5 w-full max-w-lg`,children:[(0,H.jsxs)(`div`,{className:`text-center`,children:[(0,H.jsx)(D,{className:`size-9 text-primary mx-auto mb-2`}),(0,H.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Agent Pipeline`}),(0,H.jsx)(`p`,{className:`text-sm text-base-content/50 mt-1`,children:`Configure which CLI and reasoning depth runs each stage`})]}),t?(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-10`,children:[(0,H.jsx)(k,{className:`size-7 text-primary animate-spin`}),(0,H.jsx)(`p`,{className:`text-sm text-base-content/50`,children:`Detecting available CLIs…`})]}):u.length===0?(0,H.jsx)(`div`,{className:`alert alert-warning text-sm`,children:`No providers detected. Install claude, codex, or gemini CLI first.`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`bg-base-200 rounded-xl p-4 space-y-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold mb-2`,children:`Apply to all stages`}),(0,H.jsx)(`p`,{className:`text-xs text-base-content/50 mb-2`,children:`Use one CLI and one effort across Planner, Executor, and Reviewer.`}),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:u.map(e=>{let t=h(e);return(0,H.jsx)(`button`,{type:`button`,className:`btn btn-xs ${d&&n.planner===t?`btn-primary`:`btn-soft`}`,onClick:()=>v(e),children:t},t)})})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-[10px] text-base-content/40 mb-2`,children:`Effort (applies to all)`}),(0,H.jsx)(Q,{options:f,value:m,onChange:e=>{e&&f.some(t=>t.value===e)&&a({planner:e,executor:e,reviewer:e})}})]})]}),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2 justify-center`,children:l.map(e=>{let t=h(e),n=e.available!==!1;return(0,H.jsxs)(`span`,{className:`badge gap-1.5 badge-sm ${n?`badge-success`:`badge-ghost opacity-40`}`,children:[n?(0,H.jsx)(p,{className:`size-3`}):(0,H.jsx)(j,{className:`size-3`}),(0,H.jsx)(`span`,{className:`font-mono`,children:t}),e.path&&(0,H.jsx)(`span`,{className:`opacity-50 text-[9px] hidden sm:inline`,children:e.path})]},t)})}),(0,H.jsx)(`div`,{className:`flex flex-col`,children:q.map((e,t)=>{let l=e.icon,d=n[e.role]||u[0]?.id||u[0]?.name||``,f=Ce[e.role],p=o?.[f]||``,m=c?.[d]||[],h=K(e.role,n),g=i?.[e.role]||`high`;return(0,H.jsxs)(`div`,{children:[t>0&&(0,H.jsx)(`div`,{className:`flex justify-center py-1.5 text-base-content/20`,children:(0,H.jsx)(_,{className:`size-4`})}),(0,H.jsx)(`div`,{className:`bg-base-200 rounded-xl p-4`,children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`div`,{className:`size-8 rounded-lg flex items-center justify-center bg-base-300 shrink-0 ${e.color}`,children:(0,H.jsx)(l,{className:`size-4`})}),(0,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsx)(`span`,{className:`font-semibold text-sm`,children:e.label}),(0,H.jsx)(`p`,{className:`text-[11px] text-base-content/40 leading-tight mt-0.5 truncate`,children:e.description})]}),(0,H.jsx)(`select`,{className:`select select-sm select-bordered w-28 shrink-0`,value:d,onChange:t=>{let n=t.target.value;r(t=>({...t,[e.role]:n}));let i=c?.[n]?.[0]?.id||``;s(e=>({...e,[f]:i}))},children:u.map(e=>{let t=e.id||e.name||e;return(0,H.jsx)(`option`,{value:t,children:t},t)})})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`text-[10px] text-base-content/40 shrink-0 w-10`,children:`Effort`}),(0,H.jsx)(Q,{options:h,value:g,onChange:t=>a(n=>({...n,[e.role]:t}))})]}),m.length>0&&(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`text-[10px] text-base-content/40 shrink-0 w-10`,children:`Model`}),(0,H.jsx)(`select`,{className:`select select-xs select-bordered flex-1`,value:p,onChange:e=>s(t=>({...t,[f]:e.target.value})),children:m.map(e=>(0,H.jsx)(`option`,{value:e.id,children:e.label||e.id},e.id))})]})]})})]},e.role)})}),(0,H.jsx)(`p`,{className:`text-[11px] text-base-content/35 text-center`,children:`Pipeline runs top to bottom: plan → execute → review`})]})]})}function Te({selectedAgents:e,setSelectedAgents:t,existingAgents:n,autoSelectAgents:r=!0}){let[a,o]=(0,V.useState)([]),[s,c]=(0,V.useState)(!1),l=(0,V.useRef)(!1),[u,p]=(0,V.useState)([]),[m,h]=(0,V.useState)(!1),[g,_]=(0,V.useState)(``),[v,y]=(0,V.useState)(()=>new Set),[b,x]=(0,V.useState)({}),S=(0,V.useRef)(!1),[C,w]=(0,V.useState)(``),T=(0,V.useCallback)(()=>i.get(`/catalog/agents`).catch(()=>({agents:[]})).then(e=>{let t=e?.agents||[];return o(t),t}),[]);(0,V.useEffect)(()=>{l.current||(l.current=!0,c(!0),T().then(i=>{let a=new Set((n||[]).map(e=>e.name)),o=i.filter(e=>!a.has(e.name)).map(e=>e.name);r&&o.length>0&&e.length===0&&t(o)}).finally(()=>c(!1)))},[]);let E=(0,V.useCallback)(()=>(_(``),h(!0),i.get(`/reference-repositories`).then(e=>{p(e?.repositories||[])}).catch(e=>{let t=e?.message||`Failed to load reference repositories.`;t.toLowerCase().includes(`route not found`)?_(`Backend route not loaded. Start Fifony with --dev (or run pnpm build:server) and retry.`):_(t)}).finally(()=>h(!1))),[]);(0,V.useEffect)(()=>{S.current||(S.current=!0,E())},[E]);let D=(0,V.useMemo)(()=>new Set((n||[]).map(e=>e.name)),[n]),A=(0,V.useMemo)(()=>{let e=C.trim().toLowerCase();return e?a.filter(t=>[t?.name,t?.displayName,t?.description].filter(Boolean).join(` `).toLowerCase().includes(e)):a},[C,a]),j=(0,V.useCallback)(e=>{t(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[t]),M=(0,V.useCallback)(()=>{t(a.filter(e=>!D.has(e.name)).map(e=>e.name))},[a,D,t]),N=(0,V.useCallback)(()=>t([]),[t]),P=(0,V.useCallback)(async e=>{y(t=>new Set([...t,e])),x(t=>({...t,[e]:``}));try{let t=((await i.post(`/reference-repositories/sync`,{repository:e}))?.results||[]).find(t=>t.id===e);if(t?.action===`failed`){x(n=>({...n,[e]:t.message||`Sync failed.`}));return}await i.post(`/reference-repositories/import`,{repository:e,kind:`agents`,global:!1}),await Promise.all([E(),T()]),x(t=>({...t,[e]:`Synced & imported.`}))}catch(t){x(n=>({...n,[e]:t?.message||`Failed.`}))}finally{y(t=>{let n=new Set(t);return n.delete(e),n})}},[E,T]);return s?(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-12`,children:[(0,H.jsx)(k,{className:`size-8 text-primary animate-spin`}),(0,H.jsx)(`p`,{className:`text-sm text-base-content/50`,children:`Loading catalog...`})]}):(0,H.jsxs)(`div`,{className:`flex flex-col gap-6 stagger-children`,children:[(0,H.jsxs)(`div`,{className:`text-center`,children:[(0,H.jsx)(f,{className:`size-10 text-primary mx-auto mb-3`}),(0,H.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Agents`}),(0,H.jsx)(`p`,{className:`text-base-content/60 mt-1`,children:`Choose which agents to install`})]}),(0,H.jsx)(`div`,{className:`card bg-base-200`,children:(0,H.jsxs)(`div`,{className:`card-body gap-3 p-4`,children:[(0,H.jsx)(`h3`,{className:`font-semibold text-sm`,children:`Sources`}),g&&(0,H.jsx)(`div`,{className:`alert alert-warning text-xs`,children:g}),m?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-base-content/60`,children:[(0,H.jsx)(k,{className:`size-3 animate-spin`}),` Loading...`]}):(0,H.jsx)(`div`,{className:`grid grid-cols-2 xl:grid-cols-4 gap-2`,children:u.map(e=>{let t=v.has(e.id),n=e?.artifactCounts??null,r=e?.present&&e?.synced;return(0,H.jsxs)(`div`,{className:`rounded-lg border border-base-300/70 bg-base-100 p-2 flex flex-col gap-1.5`,children:[(0,H.jsx)(`div`,{className:`font-medium text-xs truncate`,children:e.name}),r&&n?(0,H.jsxs)(`div`,{className:`text-[11px] text-base-content/60`,children:[n.agents,` agents`]}):(0,H.jsx)(`span`,{className:`badge badge-xs badge-warning`,children:`Not synced`}),b[e.id]&&(0,H.jsx)(`p`,{className:`text-[11px] text-base-content/60 truncate`,children:b[e.id]}),(0,H.jsxs)(`button`,{className:`btn btn-xs btn-outline gap-1 mt-auto`,onClick:()=>P(e.id),disabled:t,children:[t?(0,H.jsx)(k,{className:`size-3 animate-spin`}):(0,H.jsx)(O,{className:`size-3`}),t?`Syncing…`:r?`Re-sync`:`Sync`]})]},e.id)})})]})}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsxs)(`h3`,{className:`font-semibold text-sm flex items-center gap-2`,children:[(0,H.jsx)(f,{className:`size-4 opacity-50`}),`Agents (`,a.length,`)`]}),(0,H.jsxs)(`div`,{className:`flex gap-1`,children:[(0,H.jsx)(`button`,{className:`btn btn-xs btn-ghost`,onClick:M,children:`Select All`}),(0,H.jsx)(`button`,{className:`btn btn-xs btn-ghost`,onClick:N,children:`None`})]})]}),(0,H.jsxs)(`label`,{className:`input input-bordered input-sm flex items-center gap-2`,children:[(0,H.jsx)(ne,{className:`size-4 opacity-60`}),(0,H.jsx)(`input`,{type:`text`,className:`grow`,placeholder:`Search agents...`,value:C,onChange:e=>w(e.target.value)})]}),A.length===0&&a.length>0&&(0,H.jsx)(`div`,{className:`text-sm text-base-content/60`,children:`No agents match your search.`}),(0,H.jsx)(`div`,{className:`space-y-1 pt-1`,children:A.map(t=>{let n=D.has(t.name),r=n||e.includes(t.name);return(0,H.jsx)(`button`,{className:`w-full rounded-md border border-transparent px-2 py-2 text-left transition-all ${n?`opacity-70 bg-base-100/40`:`hover:bg-base-100`} ${r&&!n?`ring-1 ring-primary ring-offset-1 ring-offset-base-200`:``}`,onClick:()=>!n&&j(t.name),disabled:n,children:(0,H.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,H.jsx)(`span`,{className:`mt-0.5 text-base`,children:t.emoji||`🤖`}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`font-medium text-sm truncate`,children:t.displayName||t.name}),t.source&&(0,H.jsx)(`span`,{className:`badge badge-xs badge-ghost shrink-0`,children:t.source}),n?(0,H.jsxs)(`span`,{className:`badge badge-xs badge-success gap-1 shrink-0`,children:[(0,H.jsx)(d,{className:`size-3`}),` Installed`]}):(0,H.jsx)(`input`,{type:`checkbox`,className:`checkbox checkbox-primary checkbox-sm self-start mt-0.5 shrink-0`,checked:r,readOnly:!0,tabIndex:-1})]}),t.description&&(0,H.jsx)(`p`,{className:`text-xs text-base-content/60 mt-1 truncate`,children:t.description})]})]})},t.name)})})]}),a.length===0&&(0,H.jsx)(`div`,{className:`alert alert-info text-sm`,children:`No agents found in the catalog. Sync a source above or add them later from the settings page.`})]})}var Ee={auto:{bg:null,label:`Auto`},light:{bg:`#ffffff`,accent:`#7c3aed`},dark:{bg:`#1d232a`,accent:`#661ae6`},black:{bg:`#000000`,accent:`#ffffff`},cupcake:{bg:`#faf7f5`,accent:`#ef9fbc`},night:{bg:`#0f172a`,accent:`#38bdf8`},sunset:{bg:`#1a1019`,accent:`#ff865b`}};function De({theme:e,selected:t,onClick:n}){let r=Ee[e.value];return(0,H.jsxs)(`button`,{onClick:n,title:e.label,className:`flex flex-col items-center gap-1.5 group focus:outline-none`,children:[(0,H.jsx)(`div`,{className:`w-10 h-10 rounded-xl border-2 transition-all overflow-hidden flex-shrink-0 ${t?`border-primary ring-2 ring-primary ring-offset-2 ring-offset-base-200 scale-110`:`border-base-300 group-hover:border-base-content/30 group-hover:scale-105`}`,style:r.bg?{background:r.bg}:void 0,children:r.bg?(0,H.jsxs)(`div`,{className:`w-full h-full flex flex-col`,children:[(0,H.jsx)(`div`,{className:`flex-1`,style:{background:r.bg}}),(0,H.jsx)(`div`,{className:`h-3 w-full`,style:{background:r.accent}})]}):(0,H.jsxs)(`div`,{className:`w-full h-full flex`,children:[(0,H.jsx)(`div`,{className:`flex-1 bg-white`}),(0,H.jsx)(`div`,{className:`flex-1 bg-neutral`})]})}),(0,H.jsx)(`span`,{className:`text-xs font-medium transition-colors ${t?`text-primary`:`text-base-content/50 group-hover:text-base-content/80`}`,children:e.label})]})}function Oe({concurrency:e,setConcurrency:t,selectedTheme:n,setSelectedTheme:r}){let i=Number.isFinite(e)?Math.max(1,Math.min(10,e)):1;return(0,H.jsxs)(`div`,{className:`flex flex-col gap-6 stagger-children`,children:[(0,H.jsxs)(`div`,{className:`text-center`,children:[(0,H.jsx)(E,{className:`size-10 text-primary mx-auto mb-3`}),(0,H.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Workers & Theme`}),(0,H.jsx)(`p`,{className:`text-base-content/60 mt-1 text-sm`,children:`Configure parallel workers and visual theme`})]}),(0,H.jsx)(`div`,{className:`card bg-base-200`,children:(0,H.jsxs)(`div`,{className:`card-body p-5 gap-3`,children:[(0,H.jsxs)(`h3`,{className:`font-semibold text-sm flex items-center gap-2`,children:[(0,H.jsx)(E,{className:`size-4 opacity-50`}),`Worker Concurrency`]}),(0,H.jsxs)(`p`,{className:`text-xs text-base-content/60`,children:[`How many agents can work in parallel (`,i,` worker`,i===1?``:`s`,`)`]}),(0,H.jsxs)(`div`,{className:`w-full max-w-xs`,children:[(0,H.jsx)(`input`,{type:`range`,min:1,max:10,step:1,value:i,onChange:e=>t(Math.round(Number(e.target.value))),"aria-label":`Number of parallel workers`,className:`range range-primary range-sm w-full`}),(0,H.jsx)(`div`,{className:`flex justify-between px-2.5 mt-2 text-xs`,children:Array.from({length:10},(e,t)=>(0,H.jsx)(`span`,{children:`|`},t))}),(0,H.jsx)(`div`,{className:`flex justify-between px-2.5 mt-2 text-xs`,children:Array.from({length:10},(e,t)=>(0,H.jsx)(`span`,{children:t+1},t))})]}),(0,H.jsxs)(`p`,{className:`text-xs text-base-content/50 bg-base-100 rounded-lg px-3 py-2 mt-1`,children:[(0,H.jsx)(`span`,{className:`font-medium text-base-content/70`,children:`Tip:`}),` 2–4 workers is recommended for most projects. More workers consume more API quota and may hit rate limits.`]})]})}),(0,H.jsx)(`div`,{className:`card bg-base-200`,children:(0,H.jsxs)(`div`,{className:`card-body p-5 gap-4`,children:[(0,H.jsxs)(`h3`,{className:`font-semibold text-sm flex items-center gap-2`,children:[(0,H.jsx)(N,{className:`size-4 opacity-50`}),`Theme`]}),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-5 justify-center py-1`,children:le.map(e=>(0,H.jsx)(De,{theme:e,selected:n===e.value,onClick:()=>r(e.value)},e.value))})]})})]})}function ke({config:e,launching:t}){return(0,H.jsxs)(`div`,{className:`flex flex-col items-center text-center gap-6 stagger-children py-4`,children:[(0,H.jsx)(`div`,{className:`animate-bounce-in`,children:(0,H.jsx)(D,{className:`size-16 sm:size-20 text-primary mx-auto`})}),(0,H.jsx)(`h2`,{className:`text-2xl sm:text-3xl font-bold`,children:`You're All Set!`}),(0,H.jsx)(`p`,{className:`text-base-content/60 max-w-md`,children:`Here's a summary of your configuration. Hit launch when you're ready.`}),(0,H.jsx)(`div`,{className:`card bg-base-200 w-full max-w-sm`,children:(0,H.jsxs)(`div`,{className:`card-body p-4 gap-2 text-sm text-left`,children:[(0,H.jsxs)(`div`,{className:`flex justify-between gap-4`,children:[(0,H.jsx)(`span`,{className:`text-base-content/60`,children:`Queue title`}),(0,H.jsx)(`span`,{className:`font-semibold text-right break-words`,children:e.queueTitle||`fifony`})]}),(0,H.jsx)(`div`,{className:`divider my-0`}),(0,H.jsxs)(`div`,{className:`flex justify-between`,children:[(0,H.jsx)(`span`,{className:`text-base-content/60`,children:`Pipeline`}),(0,H.jsxs)(`span`,{className:`font-semibold capitalize text-xs font-mono`,children:[e.pipeline?.planner||`?`,` → `,e.pipeline?.executor||`?`,` → `,e.pipeline?.reviewer||`?`]})]}),(0,H.jsx)(`div`,{className:`divider my-0`}),(0,H.jsxs)(`div`,{className:`flex justify-between`,children:[(0,H.jsx)(`span`,{className:`text-base-content/60`,children:`Domains`}),(0,H.jsx)(`span`,{className:`font-semibold`,children:e.domains?.length>0?e.domains.length+` selected`:`none`})]}),(0,H.jsx)(`div`,{className:`divider my-0`}),(0,H.jsxs)(`div`,{className:`flex justify-between`,children:[(0,H.jsx)(`span`,{className:`text-base-content/60`,children:`Agents`}),(0,H.jsxs)(`span`,{className:`font-semibold`,children:[e.agents?.length||0,` to install`]})]}),(0,H.jsx)(`div`,{className:`divider my-0`}),(0,H.jsxs)(`div`,{className:`flex justify-between`,children:[(0,H.jsx)(`span`,{className:`text-base-content/60`,children:`Skills`}),(0,H.jsxs)(`span`,{className:`font-semibold`,children:[e.skills?.length||0,` to install`]})]}),(0,H.jsx)(`div`,{className:`divider my-0`}),(0,H.jsxs)(`div`,{className:`flex justify-between`,children:[(0,H.jsx)(`span`,{className:`text-base-content/60`,children:`Plan`}),(0,H.jsx)(`span`,{className:`font-semibold capitalize`,children:e.efforts.planner})]}),(0,H.jsx)(`div`,{className:`divider my-0`}),(0,H.jsxs)(`div`,{className:`flex justify-between`,children:[(0,H.jsx)(`span`,{className:`text-base-content/60`,children:`Execute`}),(0,H.jsx)(`span`,{className:`font-semibold capitalize`,children:e.efforts.executor})]}),(0,H.jsx)(`div`,{className:`divider my-0`}),(0,H.jsxs)(`div`,{className:`flex justify-between`,children:[(0,H.jsx)(`span`,{className:`text-base-content/60`,children:`Review`}),(0,H.jsx)(`span`,{className:`font-semibold capitalize`,children:e.efforts.reviewer})]}),(0,H.jsx)(`div`,{className:`divider my-0`}),(0,H.jsxs)(`div`,{className:`flex justify-between`,children:[(0,H.jsx)(`span`,{className:`text-base-content/60`,children:`Workers`}),(0,H.jsx)(`span`,{className:`font-semibold`,children:e.concurrency})]}),(0,H.jsx)(`div`,{className:`divider my-0`}),(0,H.jsxs)(`div`,{className:`flex justify-between`,children:[(0,H.jsx)(`span`,{className:`text-base-content/60`,children:`Theme`}),(0,H.jsx)(`span`,{className:`font-semibold capitalize`,children:e.theme})]})]})}),t&&(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-base-content/50`,children:[(0,H.jsx)(k,{className:`size-4 animate-spin`}),`Saving configuration & installing agents...`]})]})}function Ae({onComplete:e}){let t=r(),n=ee(),a=C(n.data),[s,c]=(0,V.useState)(0),[l,d]=(0,V.useState)(`forward`),[f,p]=(0,V.useState)(!1),[m,h]=(0,V.useState)(null),g=(0,V.useRef)(!1),_=(0,V.useRef)(!1),[v,y]=(0,V.useState)({planner:``,executor:``,reviewer:``}),[E,D]=(0,V.useState)(()=>ue(null)),[O,k]=(0,V.useState)(3),[A,j]=(0,V.useState)(`auto`),[M,N]=(0,V.useState)(``),[F,I]=(0,V.useState)(`missing`),[te,ne]=(0,V.useState)(null),[L,R]=(0,V.useState)(null),[z,re]=(0,V.useState)([]),[B,ae]=(0,V.useState)([]),[U,ce]=(0,V.useState)(`local`),[W,G]=(0,V.useState)(``),[K,le]=(0,V.useState)(``),[q,Y]=(0,V.useState)(!0),X=se(),Z=oe()[s]||``,[_e,ve]=(0,V.useState)(null),[ye,be]=(0,V.useState)(!1),[xe,Ce]=(0,V.useState)({}),[Q,Ee]=(0,V.useState)({plan:``,execute:``,review:``}),[De,Ae]=(0,V.useState)(``),[je,Me]=(0,V.useState)(``);(0,V.useEffect)(()=>{i.get(`/state`).then(e=>{R(e||{}),Ae(e?.sourceRepoUrl||e?.config?.sourceRepo||``),Me(e?.config?.defaultBranch||``)}).catch(()=>{R({})})},[]),(0,V.useEffect)(()=>{if(g.current||n.isLoading)return;g.current=!0;let e=w(a,`runtime.pipeline`,null),t=w(a,`runtime.workflowConfig`,null),r=w(a,`runtime.defaultEffort`,null),i=w(a,`ui.theme`,`auto`),o=w(a,`runtime.workerConcurrency`,3);if(Array.isArray(e)&&e.length>0){let t=Object.fromEntries(e.map(e=>[e.role,e.provider]));y({planner:t.planner||``,executor:t.executor||``,reviewer:t.reviewer||``})}t&&typeof t==`object`&&Ee({plan:t.plan?.model||``,execute:t.execute?.model||``,review:t.review?.model||``}),D(ue(r)),typeof i==`string`&&i.trim()&&j(i);let s=Number.parseInt(String(o??2),10);Number.isFinite(s)&&k(Math.min(10,Math.max(1,s)));let c=w(a,`runtime.autoReviewApproval`,!0);typeof c==`boolean`&&Y(c);let l=w(a,`runtime.mergeMode`,`local`);(l===`local`||l===`push-pr`)&&ce(l);let u=w(a,`runtime.prBaseBranch`,``);typeof u==`string`&&G(u);let d=w(a,`runtime.testCommand`,``);typeof d==`string`&&le(d)},[a,n.isLoading]),(0,V.useEffect)(()=>{if(_.current||n.isLoading||L===null)return;_.current=!0;let e=x(a,L);N(e.projectName),I(e.source)},[L,a,n.isLoading]);let Ne=(0,V.useCallback)(e=>{N(e),I(`manual`)},[]),$=b(M),Pe=u($);(0,V.useEffect)(()=>{document.title=u($||L?.detectedProjectName||L?.projectName||``)},[$,L]),(0,V.useEffect)(()=>{s>=1&&_e===null&&(be(!0),Promise.all([i.get(`/providers`),i.get(`/config/workflow?details=1`).catch(()=>null)]).then(([e,t])=>{let n=Array.isArray(e)?e:e?.providers||[];ve(n);let r=t?.models||{};Ce(r);let i=n.filter(e=>e.available!==!1),a=i[0]?.id||i[0]?.name||``,o=i.find(e=>(e.id||e.name)===`claude`),s=a,c=o?`claude`:s,l={planner:c,executor:s,reviewer:c};y(e=>({planner:e.planner||l.planner,executor:e.executor||l.executor,reviewer:e.reviewer||l.reviewer})),Ee(e=>({plan:e.plan||r[c]?.[0]?.id||``,execute:e.execute||r[s]?.[0]?.id||``,review:e.review||r[c]?.[0]?.id||``}))}).catch(()=>{ve([])}).finally(()=>{be(!1)}))},[s,_e]),(0,V.useEffect)(()=>{let e=A===`auto`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:A;document.documentElement.setAttribute(`data-theme`,e)},[A]);let Fe=(0,V.useCallback)(e=>{if(e===`Setup`)$&&J(o,$,`system`).catch(()=>{}),J(`runtime.mergeMode`,U,`runtime`).catch(()=>{}),U===`push-pr`&&W.trim()&&J(`runtime.prBaseBranch`,W.trim(),`runtime`).catch(()=>{}),J(`runtime.autoReviewApproval`,q,`runtime`).catch(()=>{}),K.trim()&&J(`runtime.testCommand`,K.trim(),`runtime`).catch(()=>{});else if(e===`Pipeline`){let e=[{provider:v.planner,role:`planner`},{provider:v.executor,role:`executor`},{provider:v.reviewer,role:`reviewer`}];J(`runtime.agentProvider`,v.executor,`runtime`).catch(()=>{}),J(`runtime.pipeline`,e,`runtime`).catch(()=>{}),J(`runtime.defaultEffort`,E,`runtime`).catch(()=>{}),J(`runtime.workflowConfig`,de(v,E,Q),`runtime`).catch(()=>{})}else e===`Preferences`&&(J(`ui.theme`,A,`ui`).catch(()=>{}),i.post(`/config/concurrency`,{concurrency:O}).catch(()=>{}))},[v,E,Q,O,A,$,U,W,K,q]),Ie=(0,V.useCallback)(()=>{s<X-1&&(Fe(Z),d(`forward`),c(e=>e+1))},[s,X,Z,Fe]),Le=(0,V.useCallback)(()=>{s>0&&(d(`backward`),c(e=>e-1))},[s]),Re=(0,V.useCallback)(async()=>{if($){p(!0);try{let n=[J(o,$,`system`),J(`ui.theme`,A,`ui`),J(`ui.onboarding.completed`,!0,`ui`)],r=[{provider:v.planner,role:`planner`},{provider:v.executor,role:`executor`},{provider:v.reviewer,role:`reviewer`}];n.push(J(`runtime.agentProvider`,v.executor,`runtime`)),n.push(J(`runtime.pipeline`,r,`runtime`)),n.push(J(`runtime.defaultEffort`,E,`runtime`)),n.push(J(`runtime.workflowConfig`,de(v,E,Q),`runtime`)),n.push(i.post(`/config/concurrency`,{concurrency:O})),n.push(J(`runtime.mergeMode`,U,`runtime`)),n.push(J(`runtime.autoReviewApproval`,q,`runtime`)),U===`push-pr`&&W.trim()&&n.push(J(`runtime.prBaseBranch`,W.trim(),`runtime`)),K.trim()&&n.push(J(`runtime.testCommand`,K.trim(),`runtime`)),z.length>0&&n.push(i.post(`/install/agents`,{agents:z})),B.length>0&&n.push(i.post(`/install/skills`,{skills:B})),await Promise.allSettled(n),t.setQueryData(S,e=>T(e,{id:o,scope:`system`,value:$,source:`user`,updatedAt:new Date().toISOString()})),t.setQueryData(S,e=>T(e,{id:`ui.onboarding.completed`,scope:`ui`,value:!0,source:`user`,updatedAt:new Date().toISOString()})),h({x:window.innerWidth/2,y:window.innerHeight/3}),setTimeout(()=>{e?.(),t.invalidateQueries({queryKey:S})},1200)}catch{t.setQueryData(S,e=>T(e,{id:o,scope:`system`,value:$,source:`user`,updatedAt:new Date().toISOString()})),t.setQueryData(S,e=>T(e,{id:`ui.onboarding.completed`,scope:`ui`,value:!0,source:`user`,updatedAt:new Date().toISOString()})),await J(`ui.onboarding.completed`,!0,`ui`).catch(()=>{}),t.invalidateQueries({queryKey:S}),e?.()}}},[$,v,E,Q,O,A,z,B,U,W,K,q,t,e]),ze=Z===`Welcome`||Z===`Setup`&&fe($,te)||Z===`Pipeline`&&(v.executor||ye)||Z===`Agents & Skills`||Z===`Preferences`||Z===`Launch`,Be=[],Ve=[],He={projectName:$,queueTitle:Pe,pipeline:v,efforts:E,concurrency:O,theme:A,agents:z,skills:B};return(0,H.jsxs)(`div`,{className:`fixed inset-0 z-50 bg-base-100 flex flex-col overflow-hidden`,children:[s===0&&(0,H.jsx)(ie,{}),m&&(0,H.jsx)(P,{x:m.x,y:m.y,active:!0,onDone:()=>h(null)}),s>0&&(0,H.jsx)(`div`,{className:`relative z-10 pt-6 pb-2 px-4 flex justify-center`,children:(0,H.jsx)(pe,{current:s})}),(0,H.jsx)(`div`,{className:`relative z-10 flex-1 flex flex-col items-center justify-start px-4 py-6 overflow-y-auto`,children:(0,H.jsxs)(me,{direction:l,stepKey:s,center:Z===`Welcome`||Z===`Setup`||Z===`Pipeline`||Z===`Launch`,children:[Z===`Welcome`&&(0,H.jsx)(ge,{workspacePath:De,onGetStarted:Ie}),Z===`Setup`&&(0,H.jsx)(Se,{projectName:M,setProjectName:Ne,detectedProjectName:L?.detectedProjectName||``,projectSource:F,workspacePath:De,currentBranch:je,onGitStatusChange:ne,onBranchCreated:e=>{Me(e),W||G(e)},mergeMode:U,setMergeMode:ce,prBaseBranch:W,setPrBaseBranch:G,autoReviewApproval:q,setAutoReviewApproval:Y,testCommand:K,setTestCommand:le}),Z===`Pipeline`&&(0,H.jsx)(we,{providers:_e||[],providersLoading:ye,pipeline:v,setPipeline:y,efforts:E,setEfforts:D,models:Q,setModels:Ee,modelsByProvider:xe}),Z===`Agents & Skills`&&(0,H.jsx)(Te,{selectedAgents:z,setSelectedAgents:re,selectedSkills:B,setSelectedSkills:ae,existingAgents:Be,existingSkills:Ve}),Z===`Preferences`&&(0,H.jsx)(Oe,{concurrency:O,setConcurrency:k,selectedTheme:A,setSelectedTheme:j}),Z===`Launch`&&(0,H.jsx)(ke,{config:He,launching:f})]})}),(0,H.jsx)(he,{step:s,stepCount:X,stepName:Z,canProceed:ze,launching:f,onBack:Le,onNext:Ie,onLaunch:Re})]})}export{Ae as default};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{I as t,h as n,o as r}from"./vendor-BEoYbFV1.js";import{a as i}from"./api-CkVfYg_m.js";import{t as a}from"./createLucideIcon-Dfk_Hxud.js";import{A as o,G as s,J as c,K as l,O as u,_ as d,b as f,c as p,k as m,r as h,s as g,x as _,z as v}from"./index-D2INW0zc.js";var y=a(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),b=e(t(),1),x=n();function S(e){return!e||e===0?`0`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function C(e){return!e||e===0?`0`:e.toLocaleString()}function w({value:e,format:t=S,className:n=``}){let[r,i]=(0,b.useState)(()=>t(e)),a=(0,b.useRef)(e),o=(0,b.useRef)(null);return(0,b.useEffect)(()=>{let n=a.current||0,r=e||0;if(a.current=r,n===r){i(t(r));return}let s=performance.now(),c=e=>{let a=e-s,l=Math.min(a/600,1),u=1-(1-l)**3,d=n+(r-n)*u;i(t(Math.round(d))),l<1&&(o.current=requestAnimationFrame(c))};return cancelAnimationFrame(o.current),o.current=requestAnimationFrame(c),()=>cancelAnimationFrame(o.current)},[e,t]),(0,x.jsx)(`span`,{className:`${n} inline-block tabular-nums`,children:r})}var T=[{key:`planner`,label:`Plan`,color:`bg-info`,textColor:`text-info`},{key:`executor`,label:`Execute`,color:`bg-primary`,textColor:`text-primary`},{key:`reviewer`,label:`Review`,color:`bg-secondary`,textColor:`text-secondary`}];function E({byPhase:e}){if(!e)return null;let t=T.reduce((t,n)=>t+(e[n.key]?.totalTokens||0),0);return t===0?null:(0,x.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,x.jsx)(`div`,{className:`flex h-4 rounded-full overflow-hidden bg-base-300 w-full`,children:T.map(n=>{let r=e[n.key]?.totalTokens||0,i=r/t*100;return i===0?null:(0,x.jsx)(`div`,{className:`${n.color} opacity-80 transition-all duration-500`,style:{width:`${i}%`},title:`${n.label}: ${C(r)} (${Math.round(i)}%)`},n.key)})}),(0,x.jsx)(`div`,{className:`flex items-center gap-3 flex-wrap text-xs`,children:T.map(n=>{let r=e[n.key]?.totalTokens||0,i=t>0?Math.round(r/t*100):0;return r===0?null:(0,x.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,x.jsx)(`span`,{className:`inline-block size-2 rounded-full ${n.color} shrink-0`}),(0,x.jsx)(`span`,{className:`opacity-60`,children:n.label}),(0,x.jsx)(`span`,{className:`font-mono font-semibold`,children:S(r)}),(0,x.jsxs)(`span`,{className:`opacity-40`,children:[`(`,i,`%)`]})]},n.key)})})]})}function D({data:e,valueKey:t,barClass:n,label:r,height:i=64,showXAxis:a=!1,hoveredIdx:o,onHover:s,formatTooltip:c}){if(!e||e.length===0)return null;let l=new Date().toISOString().slice(0,10),u=Math.max(...e.map(e=>e[t]||0),1),d=e.length<=7?1:e.length<=14?2:e.length<=21?3:5,f=o==null?null:e[o],p=o==null?`center`:o<e.length/3?`left`:o>e.length*2/3?`right`:`center`;return(0,x.jsxs)(`div`,{className:`relative`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs opacity-50 mb-2`,children:[(0,x.jsx)(`span`,{className:`inline-block w-2.5 h-2.5 rounded-sm ${n}`}),r]}),f&&(0,x.jsx)(`div`,{className:`absolute top-5 z-10 pointer-events-none`,style:{left:p===`right`?void 0:`${(o+.5)/e.length*100}%`,right:p===`right`?`${(e.length-1-o)/e.length*100}%`:void 0,transform:p===`center`?`translateX(-50%) translateY(-100%)`:`translateY(-100%)`},children:(0,x.jsxs)(`div`,{className:`bg-base-300 border border-base-content/10 rounded-lg px-2.5 py-1.5 shadow-lg text-left whitespace-nowrap`,children:[(0,x.jsx)(`div`,{className:`text-[10px] font-semibold opacity-60 mb-0.5`,children:f.date===l?`Today`:new Date(f.date+`T00:00:00`).toLocaleDateString(void 0,{weekday:`short`,month:`short`,day:`numeric`})}),(0,x.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,x.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm ${n} shrink-0`}),(0,x.jsx)(`span`,{className:`font-mono font-semibold`,children:c?c(f[t]||0):(f[t]||0).toLocaleString()})]})]})}),(0,x.jsx)(`div`,{className:`flex gap-px`,style:{height:i},children:e.map((e,r)=>{let a=e[t]||0,c=a>0?Math.max(3,Math.round(a/u*i)):0,d=e.date===l,f=o===r;return(0,x.jsxs)(`div`,{className:`flex-1 relative cursor-default`,onMouseEnter:()=>s?.(r),onMouseLeave:()=>s?.(null),children:[c>0&&(0,x.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 rounded-t-[2px] ${n} transition-opacity duration-100 ${f?`opacity-80`:d?`opacity-90`:`opacity-35`}`,style:{height:c}}),f&&(0,x.jsx)(`div`,{className:`absolute inset-0 bg-base-content/5 rounded-sm`})]},e.date)})}),a&&(0,x.jsx)(`div`,{className:`flex gap-px mt-1.5`,children:e.map((e,t)=>{let n=e.date===l,r=o===t,i=n||t===0||t%d===0,a=e.date?new Date(e.date+`T00:00:00`).toLocaleDateString(void 0,{month:`numeric`,day:`numeric`}):``;return(0,x.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:i&&(0,x.jsx)(`span`,{className:`block text-center text-[9px] truncate transition-opacity duration-100 ${r?`opacity-80`:n?`opacity-60 font-semibold`:`opacity-30`}`,children:n?`today`:a})},e.date)})})]})}function O({daily:e}){let[t,n]=(0,b.useState)(null),r=e||[];return(0,x.jsxs)(`div`,{className:`space-y-4`,children:[(0,x.jsx)(D,{data:r,valueKey:`totalTokens`,barClass:`bg-primary`,label:`Tokens / day`,height:64,showXAxis:!1,hoveredIdx:t,onHover:n,formatTooltip:e=>e.toLocaleString()}),(0,x.jsx)(D,{data:r,valueKey:`events`,barClass:`bg-secondary`,label:`Events / day`,height:36,showXAxis:!0,hoveredIdx:t,onHover:n})]})}function k({byModel:e}){if(!e)return null;let t=Object.entries(e).map(([e,t])=>({model:e,inputTokens:t?.inputTokens||0,outputTokens:t?.outputTokens||0,totalTokens:t?.totalTokens||0})).sort((e,t)=>t.totalTokens-e.totalTokens);if(t.length===0)return null;let n=t.reduce((e,t)=>e+t.totalTokens,0);return(0,x.jsx)(`div`,{className:`overflow-x-auto`,children:(0,x.jsxs)(`table`,{className:`table table-sm`,children:[(0,x.jsx)(`thead`,{children:(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`th`,{children:`Model`}),(0,x.jsx)(`th`,{className:`text-right`,children:`Input`}),(0,x.jsx)(`th`,{className:`text-right`,children:`Output`}),(0,x.jsx)(`th`,{className:`text-right`,children:`Total`}),(0,x.jsx)(`th`,{className:`text-right`,children:`Share`})]})}),(0,x.jsx)(`tbody`,{children:t.map(e=>{let t=n>0?Math.round(e.totalTokens/n*100):0,r=e.model.includes(`claude`)?`bg-primary`:e.model.includes(`codex`)?`bg-secondary`:`bg-accent`;return(0,x.jsxs)(`tr`,{children:[(0,x.jsxs)(`td`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(`span`,{className:`inline-block w-2.5 h-2.5 rounded-full ${r} shrink-0`}),(0,x.jsx)(`span`,{className:`font-mono text-xs`,children:e.model})]}),(0,x.jsx)(`td`,{className:`text-right font-mono text-xs`,children:S(e.inputTokens)}),(0,x.jsx)(`td`,{className:`text-right font-mono text-xs`,children:S(e.outputTokens)}),(0,x.jsx)(`td`,{className:`text-right font-mono text-xs font-semibold`,children:S(e.totalTokens)}),(0,x.jsx)(`td`,{className:`text-right`,children:(0,x.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[(0,x.jsx)(`div`,{className:`w-12 h-1.5 bg-base-300 rounded-full overflow-hidden`,children:(0,x.jsx)(`div`,{className:`h-full ${r} rounded-full`,style:{width:`${t}%`}})}),(0,x.jsxs)(`span`,{className:`text-xs opacity-60 w-8 text-right`,children:[t,`%`]})]})})]},e.model)})})]})})}function A({topIssues:e,metric:t=`tokens`}){return!e||e.length===0?null:(0,x.jsx)(`div`,{className:`overflow-x-auto`,children:(0,x.jsxs)(`table`,{className:`table table-sm`,children:[(0,x.jsx)(`thead`,{children:(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`th`,{className:`w-20`,children:`Issue`}),(0,x.jsx)(`th`,{children:`Title`}),(0,x.jsx)(`th`,{className:`text-right`,children:t===`cost`?`Cost`:`Tokens`}),(0,x.jsx)(`th`,{className:`text-right hidden sm:table-cell`,children:t===`cost`?`Tokens`:`Cost`}),(0,x.jsx)(`th`,{className:`hidden sm:table-cell`,children:`Phase Split`})]})}),(0,x.jsx)(`tbody`,{children:e.slice(0,10).map(e=>{let n=e.byPhase,r=e.totalTokens||0;return(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`td`,{className:`font-mono text-xs font-semibold text-primary`,children:e.identifier}),(0,x.jsx)(`td`,{className:`max-w-[200px] truncate text-sm`,title:e.title,children:e.title||`-`}),(0,x.jsx)(`td`,{className:`text-right font-mono text-xs font-semibold`,children:t===`cost`?e.costUsd?`$${e.costUsd.toFixed(3)}`:(0,x.jsx)(`span`,{className:`opacity-30`,children:`—`}):S(r)}),(0,x.jsx)(`td`,{className:`text-right font-mono text-xs hidden sm:table-cell`,children:t===`cost`?S(r):e.costUsd?`$${e.costUsd.toFixed(3)}`:(0,x.jsx)(`span`,{className:`opacity-30`,children:`—`})}),(0,x.jsx)(`td`,{className:`hidden sm:table-cell`,children:n?(0,x.jsx)(`div`,{className:`flex h-1.5 rounded-full overflow-hidden bg-base-300 w-24`,children:T.map(e=>{let t=n[e.key]?.totalTokens||0,i=r>0?t/r*100:0;return i===0?null:(0,x.jsx)(`div`,{className:`${e.color} opacity-80`,style:{width:`${i}%`},title:`${e.label}: ${S(t)}`},e.key)})}):(0,x.jsx)(`span`,{className:`opacity-30 text-xs`,children:`-`})})]},e.id||e.identifier)})})]})})}function j({daily:e}){let t=e||[],[n,r]=(0,b.useState)(null),i=new Date().toISOString().slice(0,10),a=Math.max(...t.map(e=>e.linesAdded||0),1),o=Math.max(...t.map(e=>e.linesRemoved||0),1),s=t.length<=7?1:t.length<=14?2:t.length<=21?3:5,c=n==null?null:t[n],l=n==null?`center`:n<t.length/3?`left`:n>t.length*2/3?`right`:`center`;return(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-5 mb-3`,children:[(0,x.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs opacity-50`,children:[(0,x.jsx)(`span`,{className:`inline-block w-2.5 h-2.5 rounded-sm bg-success`}),`Lines added / day`]}),(0,x.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs opacity-50`,children:[(0,x.jsx)(`span`,{className:`inline-block w-2.5 h-2.5 rounded-sm bg-error`}),`Lines removed / day`]})]}),(0,x.jsxs)(`div`,{className:`relative`,children:[c&&(0,x.jsx)(`div`,{className:`absolute -top-1 z-10 pointer-events-none`,style:{left:l===`right`?void 0:`${(n+.5)/t.length*100}%`,right:l===`right`?`${(t.length-1-n)/t.length*100}%`:void 0,transform:l===`center`?`translateX(-50%) translateY(-100%)`:`translateY(-100%)`},children:(0,x.jsxs)(`div`,{className:`bg-base-300 border border-base-content/10 rounded-lg px-2.5 py-1.5 shadow-lg text-left whitespace-nowrap`,children:[(0,x.jsx)(`div`,{className:`text-[10px] font-semibold opacity-60 mb-1`,children:c.date===i?`Today`:new Date(c.date+`T00:00:00`).toLocaleDateString(void 0,{weekday:`short`,month:`short`,day:`numeric`})}),(0,x.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,x.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,x.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm bg-success shrink-0`}),(0,x.jsxs)(`span`,{className:`font-mono font-semibold`,children:[`+`,(c.linesAdded||0).toLocaleString()]}),(0,x.jsx)(`span`,{className:`opacity-50`,children:`added`})]}),(0,x.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,x.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm bg-error shrink-0`}),(0,x.jsxs)(`span`,{className:`font-mono font-semibold`,children:[`-`,(c.linesRemoved||0).toLocaleString()]}),(0,x.jsx)(`span`,{className:`opacity-50`,children:`removed`})]}),(c.filesChanged||0)>0&&(0,x.jsx)(`span`,{className:`flex items-center gap-1.5 text-xs`,children:(0,x.jsxs)(`span`,{className:`opacity-50`,children:[c.filesChanged,` file`,c.filesChanged===1?``:`s`]})})]})]})}),(0,x.jsx)(`div`,{className:`flex gap-px`,children:t.map((e,t)=>{let s=e.linesAdded||0,c=e.linesRemoved||0,l=s>0?Math.max(3,Math.round(s/a*64)):0,u=c>0?Math.max(3,Math.round(c/o*24)):0,d=e.date===i,f=n===t;return(0,x.jsxs)(`div`,{className:`flex-1 flex flex-col cursor-default`,onMouseEnter:()=>r(t),onMouseLeave:()=>r(null),children:[(0,x.jsxs)(`div`,{className:`relative`,style:{height:64},children:[l>0&&(0,x.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 rounded-t-[2px] bg-success transition-opacity duration-100 ${f?`opacity-80`:d?`opacity-90`:`opacity-35`}`,style:{height:l}}),f&&(0,x.jsx)(`div`,{className:`absolute inset-0 bg-base-content/5 rounded-sm`})]}),(0,x.jsx)(`div`,{className:`h-px transition-colors duration-100 ${f?`bg-base-content/20`:`bg-base-300`}`}),(0,x.jsxs)(`div`,{className:`relative`,style:{height:24},children:[u>0&&(0,x.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 rounded-t-[2px] bg-error transition-opacity duration-100 ${f?`opacity-80`:d?`opacity-90`:`opacity-35`}`,style:{height:u}}),f&&(0,x.jsx)(`div`,{className:`absolute inset-0 bg-base-content/5 rounded-sm`})]})]},e.date)})}),(0,x.jsx)(`div`,{className:`flex gap-px mt-1.5`,children:t.map((e,t)=>{let r=e.date===i,a=n===t,o=r||t===0||t%s===0,c=e.date?new Date(e.date+`T00:00:00`).toLocaleDateString(void 0,{month:`numeric`,day:`numeric`}):``;return(0,x.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:o&&(0,x.jsx)(`span`,{className:`block text-center text-[9px] truncate transition-opacity duration-100 ${a?`opacity-80`:r?`opacity-60 font-semibold`:`opacity-30`}`,children:r?`today`:c})},e.date)})})]})]})}function M(e){return e==null||!Number.isFinite(e)?`–`:e<1/24?`${Math.round(e*24*60)}m`:e<1?`${(e*24).toFixed(1)}h`:`${e.toFixed(1)}d`}function N(e){return e==null||!Number.isFinite(e)?`–`:e>=1e3?`${(e/1e3).toFixed(1)}K`:Math.round(e).toString()}function P(e){return e==null||!Number.isFinite(e)?`–`:`${Math.round(e*100)}%`}function F(e){return e==null||!Number.isFinite(e)?`–`:e.toFixed(1)}function I({icon:e,iconClass:t,title:n,avg:r,median:i,n:a,formatValue:o,unit:s}){return(0,x.jsxs)(`div`,{className:`stat bg-base-200 rounded-box`,children:[(0,x.jsx)(`div`,{className:`stat-figure ${t}`,children:(0,x.jsx)(e,{className:`size-6`})}),(0,x.jsx)(`div`,{className:`stat-title`,children:n}),(0,x.jsxs)(`div`,{className:`stat-value text-2xl ${t}`,children:[o(r),s&&(0,x.jsx)(`span`,{className:`text-base font-normal opacity-50 ml-1`,children:s})]}),(0,x.jsxs)(`div`,{className:`stat-desc`,children:[i==null?`–`:`median ${o(i)}`,a!=null&&(0,x.jsxs)(`span`,{className:`opacity-40`,children:[` · n=`,a]})]})]})}function L({icon:e,iconClass:t,title:n,value:r,desc:i}){return(0,x.jsxs)(`div`,{className:`stat bg-base-200 rounded-box`,children:[(0,x.jsx)(`div`,{className:`stat-figure ${t}`,children:(0,x.jsx)(e,{className:`size-5`})}),(0,x.jsx)(`div`,{className:`stat-title`,children:n}),(0,x.jsx)(`div`,{className:`stat-value text-2xl ${t}`,children:r}),(0,x.jsx)(`div`,{className:`stat-desc`,children:i})]})}function R({byHarnessMode:e}){let t=Object.entries(e||{}).map(([e,t])=>({mode:e,...t||{}})).filter(e=>(e.reviewedIssues||0)>0).sort((e,t)=>(t.reviewedIssues||0)-(e.reviewedIssues||0));return t.length===0?(0,x.jsx)(`div`,{className:`text-sm opacity-45`,children:`No reviewed issues yet.`}):(0,x.jsx)(`div`,{className:`overflow-x-auto`,children:(0,x.jsxs)(`table`,{className:`table table-sm`,children:[(0,x.jsx)(`thead`,{children:(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`th`,{children:`Harness`}),(0,x.jsx)(`th`,{className:`text-right`,children:`Reviewed`}),(0,x.jsx)(`th`,{className:`text-right`,children:`First Pass`}),(0,x.jsx)(`th`,{className:`text-right`,children:`Rework`}),(0,x.jsx)(`th`,{className:`text-right`,children:`Criteria Fail`})]})}),(0,x.jsx)(`tbody`,{children:t.map(e=>(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`td`,{className:`font-medium capitalize`,children:e.mode}),(0,x.jsx)(`td`,{className:`text-right font-mono`,children:e.reviewedIssues||0}),(0,x.jsx)(`td`,{className:`text-right font-mono`,children:P(e.firstPassReviewPassRate)}),(0,x.jsx)(`td`,{className:`text-right font-mono`,children:P(e.reviewReworkRate)}),(0,x.jsx)(`td`,{className:`text-right font-mono`,children:P(e.criteriaFailureRate)})]},e.mode))})]})})}function z({contractNegotiation:e}){let t=Object.entries(e?.byReviewProfile||{}).map(([e,t])=>({profile:e,...t||{}})).filter(e=>(e.negotiatedIssues||0)>0).sort((e,t)=>(t.negotiatedIssues||0)-(e.negotiatedIssues||0));return t.length===0?(0,x.jsx)(`div`,{className:`text-sm opacity-45`,children:`No contractual negotiation history yet.`}):(0,x.jsx)(`div`,{className:`overflow-x-auto`,children:(0,x.jsxs)(`table`,{className:`table table-sm`,children:[(0,x.jsx)(`thead`,{children:(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`th`,{children:`Profile`}),(0,x.jsx)(`th`,{className:`text-right`,children:`Negotiated`}),(0,x.jsx)(`th`,{className:`text-right`,children:`First Pass`}),(0,x.jsx)(`th`,{className:`text-right`,children:`Revisions`}),(0,x.jsx)(`th`,{className:`text-right`,children:`Blocking`}),(0,x.jsx)(`th`,{className:`text-right`,children:`Avg Rounds`})]})}),(0,x.jsx)(`tbody`,{children:t.map(e=>(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`td`,{className:`font-medium`,children:e.profile}),(0,x.jsx)(`td`,{className:`text-right font-mono`,children:e.negotiatedIssues||0}),(0,x.jsx)(`td`,{className:`text-right font-mono`,children:P(e.firstPassApprovalRate)}),(0,x.jsx)(`td`,{className:`text-right font-mono`,children:P(e.revisionRate)}),(0,x.jsx)(`td`,{className:`text-right font-mono`,children:P(e.blockingConcernRate)}),(0,x.jsx)(`td`,{className:`text-right font-mono`,children:F(e.avgRoundsPerIssue)})]},e.profile))})]})})}function B({checkpointPolicy:e}){let t=Object.entries(e||{}).map(([e,t])=>({policy:e,...t||{}})).filter(e=>(e.reviewedIssues||0)>0).sort((e,t)=>(t.reviewedIssues||0)-(e.reviewedIssues||0));return t.length===0?(0,x.jsx)(`div`,{className:`text-sm opacity-45`,children:`No contractual review history yet.`}):(0,x.jsx)(`div`,{className:`overflow-x-auto`,children:(0,x.jsxs)(`table`,{className:`table table-sm`,children:[(0,x.jsx)(`thead`,{children:(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`th`,{children:`Policy`}),(0,x.jsx)(`th`,{className:`text-right`,children:`Reviewed`}),(0,x.jsx)(`th`,{className:`text-right`,children:`Final Gate`}),(0,x.jsx)(`th`,{className:`text-right`,children:`First Pass`}),(0,x.jsx)(`th`,{className:`text-right`,children:`Rework`}),(0,x.jsx)(`th`,{className:`text-right`,children:`Catch`}),(0,x.jsx)(`th`,{className:`text-right`,children:`Avg CP Runs`})]})}),(0,x.jsx)(`tbody`,{children:t.map(e=>(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`td`,{className:`font-medium`,children:e.policy}),(0,x.jsx)(`td`,{className:`text-right font-mono`,children:e.reviewedIssues||0}),(0,x.jsx)(`td`,{className:`text-right font-mono`,children:P(e.gatePassRate)}),(0,x.jsx)(`td`,{className:`text-right font-mono`,children:P(e.firstPassReviewPassRate)}),(0,x.jsx)(`td`,{className:`text-right font-mono`,children:P(e.reviewReworkRate)}),(0,x.jsx)(`td`,{className:`text-right font-mono`,children:P(e.checkpointCatchRate)}),(0,x.jsx)(`td`,{className:`text-right font-mono`,children:F(e.avgCheckpointRunsPerIssue)})]},e.policy))})]})})}function V({memoryPipeline:e}){let t=Object.entries(e?.byLayer||{}).map(([e,t])=>({layer:e,...t||{}})).filter(e=>(e.hitCount||0)>0).sort((e,t)=>(t.hitCount||0)-(e.hitCount||0));return t.length===0?(0,x.jsx)(`div`,{className:`text-sm opacity-45`,children:`No context assembly reports yet.`}):(0,x.jsx)(`div`,{className:`overflow-x-auto`,children:(0,x.jsxs)(`table`,{className:`table table-sm`,children:[(0,x.jsx)(`thead`,{children:(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`th`,{children:`Layer`}),(0,x.jsx)(`th`,{className:`text-right`,children:`Hits`}),(0,x.jsx)(`th`,{className:`text-right`,children:`Selected`}),(0,x.jsx)(`th`,{className:`text-right`,children:`Discarded`})]})}),(0,x.jsx)(`tbody`,{children:t.map(e=>(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`td`,{className:`font-medium`,children:e.layer}),(0,x.jsx)(`td`,{className:`text-right font-mono`,children:e.hitCount||0}),(0,x.jsx)(`td`,{className:`text-right font-mono`,children:e.selectedHitCount||0}),(0,x.jsx)(`td`,{className:`text-right font-mono`,children:e.discardedHitCount||0})]},e.layer))})]})})}function H({memoryPipeline:e}){let t=Object.entries(e?.byStage||{}).map(([e,t])=>({stage:e,...t||{}})).filter(e=>(e.reports||0)>0).sort((e,t)=>(t.reports||0)-(e.reports||0)||(t.avgDurationMs||0)-(e.avgDurationMs||0));return t.length===0?(0,x.jsx)(`div`,{className:`text-sm opacity-45`,children:`No context pipeline stage telemetry yet.`}):(0,x.jsx)(`div`,{className:`overflow-x-auto`,children:(0,x.jsxs)(`table`,{className:`table table-sm`,children:[(0,x.jsx)(`thead`,{children:(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`th`,{children:`Stage`}),(0,x.jsx)(`th`,{className:`text-right`,children:`Runs`}),(0,x.jsx)(`th`,{className:`text-right`,children:`Completed`}),(0,x.jsx)(`th`,{className:`text-right`,children:`Avg ms`}),(0,x.jsx)(`th`,{className:`text-right`,children:`Avg Out`})]})}),(0,x.jsx)(`tbody`,{children:t.map(e=>(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`td`,{className:`font-medium`,children:e.stage}),(0,x.jsx)(`td`,{className:`text-right font-mono`,children:e.reports||0}),(0,x.jsx)(`td`,{className:`text-right font-mono`,children:P(e.completionRate)}),(0,x.jsx)(`td`,{className:`text-right font-mono`,children:F(e.avgDurationMs)}),(0,x.jsx)(`td`,{className:`text-right font-mono`,children:F(e.avgOutputCount)})]},e.stage))})]})})}var U=r(`/analytics`)({component:Z});function W({h:e=`h-28`}){return(0,x.jsx)(`div`,{className:`skeleton-card ${e} w-full rounded-box`})}function G(){let{data:e}=c(),{data:t}=s(),n=e?.overall?.totalTokens||0,r=e?.byPhase||null,a=i(e?.daily,32),o=new Date().toISOString().slice(0,10),l=a.find(e=>e.date===o),u=l?.totalTokens||0,f=a.reduce((e,t)=>e+(t.totalTokens||0),0),p=a.reduce((e,t)=>e+(t.events||0),0),g=l?.events||0,y=(()=>{let e=new Map((t?.lines||[]).filter(e=>e.date).map(e=>[e.date,e])),n=[];for(let t=31;t>=0;t--){let r=new Date;r.setDate(r.getDate()-t);let i=r.toISOString().slice(0,10);n.push(e.get(i)??{date:i,linesAdded:0,linesRemoved:0,filesChanged:0})}return n})(),b=y.reduce((e,t)=>e+(t.linesAdded||0),0),T=y.reduce((e,t)=>e+(t.linesRemoved||0),0);return e?(0,x.jsx)(`section`,{children:(0,x.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-7 gap-4`,children:[(0,x.jsxs)(`div`,{className:`stat bg-base-200 rounded-box`,children:[(0,x.jsx)(`div`,{className:`stat-figure text-primary`,children:(0,x.jsx)(h,{className:`size-6`})}),(0,x.jsx)(`div`,{className:`stat-title`,children:`Total Tokens`}),(0,x.jsx)(`div`,{className:`stat-value text-2xl`,children:(0,x.jsx)(w,{value:n})}),(0,x.jsx)(`div`,{className:`stat-desc font-mono`,children:C(n)})]}),(0,x.jsxs)(`div`,{className:`stat bg-base-200 rounded-box`,children:[(0,x.jsx)(`div`,{className:`stat-figure text-accent`,children:(0,x.jsx)(m,{className:`size-6`})}),(0,x.jsx)(`div`,{className:`stat-title`,children:`Tokens Today`}),(0,x.jsx)(`div`,{className:`stat-value text-2xl`,children:(0,x.jsx)(w,{value:u})}),(0,x.jsxs)(`div`,{className:`stat-desc`,children:[`30d: `,S(f)]})]}),(0,x.jsxs)(`div`,{className:`stat bg-base-200 rounded-box`,children:[(0,x.jsx)(`div`,{className:`stat-figure text-secondary`,children:(0,x.jsx)(v,{className:`size-6`})}),(0,x.jsx)(`div`,{className:`stat-title`,children:`Total Events`}),(0,x.jsx)(`div`,{className:`stat-value text-2xl`,children:(0,x.jsx)(w,{value:p,format:e=>String(e||0)})}),(0,x.jsxs)(`div`,{className:`stat-desc`,children:[`Today: `,g]})]}),(0,x.jsxs)(`div`,{className:`stat bg-base-200 rounded-box xl:col-span-2 overflow-hidden`,children:[(0,x.jsx)(`div`,{className:`stat-figure text-info`,children:(0,x.jsx)(d,{className:`size-6`})}),(0,x.jsx)(`div`,{className:`stat-title`,children:`Phase Split`}),(0,x.jsx)(`div`,{className:`stat-value text-2xl p-0`,children:r?(0,x.jsx)(E,{byPhase:r}):(0,x.jsx)(`span`,{className:`opacity-30`,children:`-`})})]}),(0,x.jsxs)(`div`,{className:`stat bg-base-200 rounded-box`,children:[(0,x.jsx)(`div`,{className:`stat-figure text-success`,children:(0,x.jsx)(_,{className:`size-6`})}),(0,x.jsx)(`div`,{className:`stat-title`,children:`Lines Added`}),(0,x.jsx)(`div`,{className:`stat-value text-2xl text-success`,children:(0,x.jsx)(w,{value:b,format:e=>e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e||0)})}),(0,x.jsx)(`div`,{className:`stat-desc`,children:`30d total`})]}),(0,x.jsxs)(`div`,{className:`stat bg-base-200 rounded-box`,children:[(0,x.jsx)(`div`,{className:`stat-figure text-error`,children:(0,x.jsx)(_,{className:`size-6`})}),(0,x.jsx)(`div`,{className:`stat-title`,children:`Lines Removed`}),(0,x.jsx)(`div`,{className:`stat-value text-2xl text-error`,children:(0,x.jsx)(w,{value:T,format:e=>e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e||0)})}),(0,x.jsx)(`div`,{className:`stat-desc`,children:`30d total`})]})]})}):(0,x.jsx)(W,{h:`h-32`})}function K(){let{data:e}=c(),{data:t}=s(),n=i(e?.daily,32),r=(()=>{let e=new Map((t?.lines||[]).filter(e=>e.date).map(e=>[e.date,e])),n=[];for(let t=31;t>=0;t--){let r=new Date;r.setDate(r.getDate()-t);let i=r.toISOString().slice(0,10);n.push(e.get(i)??{date:i,linesAdded:0,linesRemoved:0,filesChanged:0})}return n})();return e?(0,x.jsxs)(`section`,{className:`bg-base-200 rounded-box p-5`,children:[(0,x.jsx)(`div`,{className:`flex items-center justify-between mb-4`,children:(0,x.jsxs)(`h2`,{className:`text-sm font-semibold flex items-center gap-2`,children:[(0,x.jsx)(g,{className:`size-4 text-primary`}),`Daily Activity`]})}),(0,x.jsx)(O,{daily:n}),(0,x.jsx)(`div`,{className:`border-t border-base-300 my-5`}),(0,x.jsx)(j,{daily:r})]}):(0,x.jsx)(W,{h:`h-52`})}function q(){let{data:e}=l(),t=e?.ok?e:null;return e?(0,x.jsxs)(`section`,{className:`bg-base-200 rounded-box p-5`,children:[(0,x.jsxs)(`h2`,{className:`text-sm font-semibold flex items-center gap-2 mb-4`,children:[(0,x.jsx)(p,{className:`size-4 text-warning`}),`Engineering KPIs`,t?.sampleSize>0&&(0,x.jsxs)(`span`,{className:`text-xs font-normal opacity-40 ml-1`,children:[`based on `,t.sampleSize,` completed issue`,t.sampleSize===1?``:`s`]})]}),(0,x.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-4 gap-4`,children:[(0,x.jsx)(I,{icon:m,iconClass:`text-primary`,title:`Issue Cycle Time`,avg:t?.issueCycleTimeDays?.avg??null,median:t?.issueCycleTimeDays?.median??null,n:t?.issueCycleTimeDays?.n??null,formatValue:M}),(0,x.jsx)(I,{icon:f,iconClass:`text-secondary`,title:`PR Cycle Time`,avg:t?.prCycleTimeDays?.avg??null,median:t?.prCycleTimeDays?.median??null,n:t?.prCycleTimeDays?.n??null,formatValue:M}),(0,x.jsx)(I,{icon:p,iconClass:`text-warning`,title:`Review Turnaround`,avg:t?.reviewTurnaroundDays?.avg??null,median:t?.reviewTurnaroundDays?.median??null,n:t?.reviewTurnaroundDays?.n??null,formatValue:M}),(0,x.jsx)(I,{icon:_,iconClass:`text-info`,title:`PR Size`,avg:t?.prSizeLines?.avg??null,median:t?.prSizeLines?.median??null,n:t?.prSizeLines?.n??null,formatValue:N,unit:`lines`})]})]}):(0,x.jsx)(W,{h:`h-36`})}function J(){let{data:e}=l(),t=(e?.ok?e:null)?.qualityGate||null,n=t?.contractNegotiation||null,r=t?.checkpointPolicy||null,i=t?.memoryPipeline||null;return e?t?(0,x.jsxs)(`section`,{className:`bg-base-200 rounded-box p-5`,children:[(0,x.jsxs)(`h2`,{className:`text-sm font-semibold flex items-center gap-2 mb-4`,children:[(0,x.jsx)(o,{className:`size-4 text-success`}),`Harness Quality`]}),(0,x.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-8 gap-4`,children:[(0,x.jsx)(L,{icon:o,iconClass:`text-success`,title:`Review First Pass`,value:P(t.firstPassReviewPassRate),desc:`${t.completedReviewedIssues||0} completed reviewed issues`}),(0,x.jsx)(L,{icon:y,iconClass:`text-warning`,title:`Review Rework`,value:P(t.reviewReworkRate),desc:`${t.reviewedIssues||0} reviewed issues`}),(0,x.jsx)(L,{icon:d,iconClass:`text-info`,title:`Contract First Pass`,value:P(n?.firstPassApprovalRate),desc:`${n?.negotiatedIssues||0} negotiated issues`}),(0,x.jsx)(L,{icon:v,iconClass:`text-error`,title:`Blocking Concerns`,value:P(n?.blockingConcernRate),desc:n?.negotiatedIssues?`${F(n?.avgRoundsPerIssue)} avg rounds / issue`:`No negotiation history yet`}),(0,x.jsx)(L,{icon:d,iconClass:`text-info`,title:`Checkpoint Catch`,value:P(r?.checkpointed?.checkpointCatchRate),desc:r?.checkpointed?.reviewedIssues?`${r.checkpointed.reviewedIssues} checkpointed contractual issue${r.checkpointed.reviewedIssues===1?``:`s`}`:`No checkpointed contractual history yet`}),(0,x.jsx)(L,{icon:u,iconClass:`text-primary`,title:`Memory Coverage`,value:P(i?.memoryFlushCoverageRate),desc:i?.issuesWithMemoryFlushes?`${i.issuesWithMemoryFlushes} issue workspaces flushed`:`No workspace memory flushes yet`}),(0,x.jsx)(L,{icon:v,iconClass:`text-secondary`,title:`Context Coverage`,value:P(i?.contextReportCoverageRate),desc:i?.issuesWithContextReports?`${i.issuesWithContextReports} issue(s) emitted context reports`:`No context assembly reports yet`}),(0,x.jsx)(L,{icon:d,iconClass:`text-accent`,title:`Compaction Coverage`,value:P(i?.compactionCoverageRate),desc:i?.issuesWithCompaction?`${i.issuesWithCompaction} issue(s) compacted by budget`:`No budget compaction yet`})]}),(0,x.jsxs)(`div`,{className:`grid grid-cols-1 xl:grid-cols-3 gap-5 mt-5`,children:[(0,x.jsxs)(`div`,{className:`space-y-3`,children:[(0,x.jsx)(`div`,{className:`text-xs uppercase tracking-[0.18em] opacity-45`,children:`Review by harness mode`}),(0,x.jsx)(R,{byHarnessMode:t.byHarnessMode})]}),(0,x.jsxs)(`div`,{className:`space-y-3`,children:[(0,x.jsx)(`div`,{className:`text-xs uppercase tracking-[0.18em] opacity-45`,children:`Contract negotiation by review profile`}),(0,x.jsx)(z,{contractNegotiation:n})]}),(0,x.jsxs)(`div`,{className:`space-y-3`,children:[(0,x.jsx)(`div`,{className:`text-xs uppercase tracking-[0.18em] opacity-45`,children:`Checkpoint policy lift`}),(0,x.jsx)(B,{checkpointPolicy:r})]})]}),(0,x.jsxs)(`div`,{className:`grid grid-cols-1 xl:grid-cols-2 gap-5 mt-5`,children:[(0,x.jsxs)(`div`,{className:`space-y-3`,children:[(0,x.jsx)(`div`,{className:`text-xs uppercase tracking-[0.18em] opacity-45`,children:`Context layer hit mix`}),(0,x.jsx)(V,{memoryPipeline:i})]}),(0,x.jsxs)(`div`,{className:`space-y-3`,children:[(0,x.jsx)(`div`,{className:`text-xs uppercase tracking-[0.18em] opacity-45`,children:`Context pipeline stages`}),(0,x.jsx)(H,{memoryPipeline:i})]})]})]}):null:(0,x.jsx)(W,{h:`h-72`})}function Y(){let{data:e}=c(),t=e?.topIssues||[],n=[...t].filter(e=>typeof e.costUsd==`number`&&e.costUsd>0).sort((e,t)=>(t.costUsd||0)-(e.costUsd||0));return e?t.length===0?null:(0,x.jsxs)(`section`,{className:`bg-base-200 rounded-box p-5`,children:[(0,x.jsxs)(`h2`,{className:`text-sm font-semibold flex items-center gap-2 mb-4`,children:[(0,x.jsx)(h,{className:`size-4 text-accent`}),`Top Issues by Usage`]}),(0,x.jsxs)(`div`,{className:`grid gap-5 ${n.length>0?`xl:grid-cols-2`:``}`,children:[(0,x.jsxs)(`div`,{className:`space-y-3`,children:[(0,x.jsx)(`div`,{className:`text-xs uppercase tracking-[0.18em] opacity-45`,children:`By tokens`}),(0,x.jsx)(A,{topIssues:t,metric:`tokens`})]}),n.length>0&&(0,x.jsxs)(`div`,{className:`space-y-3`,children:[(0,x.jsx)(`div`,{className:`text-xs uppercase tracking-[0.18em] opacity-45`,children:`By cost`}),(0,x.jsx)(A,{topIssues:n,metric:`cost`})]})]})]}):(0,x.jsx)(W,{h:`h-40`})}function X(){let{data:e}=c(),t=e?.byModel||{};return e?Object.keys(t).length===0?null:(0,x.jsxs)(`section`,{className:`bg-base-200 rounded-box p-5`,children:[(0,x.jsxs)(`h2`,{className:`text-sm font-semibold flex items-center gap-2 mb-4`,children:[(0,x.jsx)(u,{className:`size-4 text-info`}),`Model Breakdown`]}),(0,x.jsx)(k,{byModel:t})]}):(0,x.jsx)(W,{h:`h-40`})}function Z(){return(0,x.jsx)(`div`,{className:`flex-1 flex flex-col min-h-0 px-4 pb-4 pt-3 overflow-y-auto`,children:(0,x.jsxs)(`div`,{className:`max-w-6xl w-full mx-auto space-y-6`,children:[(0,x.jsx)(G,{}),(0,x.jsx)(K,{}),(0,x.jsx)(q,{}),(0,x.jsx)(J,{}),(0,x.jsx)(Y,{}),(0,x.jsx)(X,{})]})})}export{U as Route};