tide-commander 1.47.0 → 1.49.0

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 (57) hide show
  1. package/dist/assets/{BossLogsModal-BEZSJWBV.js → BossLogsModal-buht3LyW.js} +1 -1
  2. package/dist/assets/BossSpawnModal-D7M1JocE.js +1 -0
  3. package/dist/assets/{ControlsModal-BZKmtLz7.js → ControlsModal-C3-j1E6y.js} +1 -1
  4. package/dist/assets/{DockerLogsModal-DD8gRVu6.js → DockerLogsModal-CA2j24QX.js} +1 -1
  5. package/dist/assets/{EmbeddedEditor-DMcKiZ5q.js → EmbeddedEditor-CrLtAaIO.js} +1 -1
  6. package/dist/assets/GmailOAuthSetup-CG2BmCyg.js +303 -0
  7. package/dist/assets/GoogleOAuthSetup-DlaXAoyq.js +236 -0
  8. package/dist/assets/{IframeModal-DJn-dNqr.js → IframeModal-CvJ6LEIu.js} +1 -1
  9. package/dist/assets/IntegrationsPanel-iTByepHj.js +2 -0
  10. package/dist/assets/{LogViewerModal-BgIfdR-l.js → LogViewerModal-C75Yyse9.js} +1 -1
  11. package/dist/assets/{MonitoringModal-Dm8wbcHY.js → MonitoringModal-C3NapNrP.js} +1 -1
  12. package/dist/assets/{PM2LogsModal-CDULU4yk.js → PM2LogsModal-CaacRI13.js} +1 -1
  13. package/dist/assets/{RestoreArchivedAreaModal-DLuiZj6S.js → RestoreArchivedAreaModal-mwQqJ4qp.js} +1 -1
  14. package/dist/assets/{SaveSnapshotModal-CbfjHVJz.js → SaveSnapshotModal-Didvj3hf.js} +1 -1
  15. package/dist/assets/{Scene2DCanvas-Dw9o4Fk8.js → Scene2DCanvas-chSGLBlj.js} +1 -1
  16. package/dist/assets/{SceneManager-KAhHYpUf.js → SceneManager-G0H-cWU4.js} +1 -1
  17. package/dist/assets/{SkillsPanel-BYy3W8hd.js → SkillsPanel-nKzb0E59.js} +1 -1
  18. package/dist/assets/{SnapshotManager-LxlHIjaa.js → SnapshotManager-DoQRZCNb.js} +1 -1
  19. package/dist/assets/SpawnModal-CPTZGYNR.js +1 -0
  20. package/dist/assets/{SubordinateAssignmentModal-zuSTZAqj.js → SubordinateAssignmentModal-B2XP8wZU.js} +1 -1
  21. package/dist/assets/{SupervisorPanel-tTfMa-0x.js → SupervisorPanel-LlgMdGCQ.js} +1 -1
  22. package/dist/assets/{TriggerManagerPanel-BoHdbpqk.js → TriggerManagerPanel-DMiK0_y5.js} +1 -1
  23. package/dist/assets/{WorkflowEditorPanel-Cusd-51G.js → WorkflowEditorPanel-DPwmjV2f.js} +1 -1
  24. package/dist/assets/{index-BoFICHSl.js → index-BCuYxI5F.js} +2 -2
  25. package/dist/assets/{index-BPn1NjZ5.js → index-BIt0Cgpm.js} +1 -1
  26. package/dist/assets/{index-CeMGJMtZ.js → index-BM1s5vTS.js} +3 -3
  27. package/dist/assets/{index-ChZ1qMl3.js → index-CG-I_YeN.js} +1 -1
  28. package/dist/assets/{index-ifiZ65Cu.js → index-CxEHgPe3.js} +1 -1
  29. package/dist/assets/{index-C_3LXJYS.js → index-D33VRpYX.js} +1 -1
  30. package/dist/assets/{index-D3KwWKEv.js → index-DYwDeYnm.js} +1 -1
  31. package/dist/assets/{index-Cxx3kFoj.js → index-XXW1ctrV.js} +1 -1
  32. package/dist/assets/{main-BsOvZp5M.js → main-D-o_EGqJ.js} +35 -35
  33. package/dist/assets/{web-B5moyGVG.js → web-Blb26Kj7.js} +1 -1
  34. package/dist/assets/{web-BYzo_b4X.js → web-hHpxvpTK.js} +1 -1
  35. package/dist/index.html +1 -1
  36. package/dist/src/packages/server/codex/backend.js +5 -1
  37. package/dist/src/packages/server/data/builtin-skills/report-task-to-boss.js +1 -1
  38. package/dist/src/packages/server/data/event-queries.js +15 -0
  39. package/dist/src/packages/server/data/migrations/005_drive_actions.sql +19 -0
  40. package/dist/src/packages/server/index.js +1 -0
  41. package/dist/src/packages/server/integrations/gmail/index.js +8 -6
  42. package/dist/src/packages/server/integrations/google-drive/drive-client.js +605 -0
  43. package/dist/src/packages/server/integrations/google-drive/drive-config.js +127 -0
  44. package/dist/src/packages/server/integrations/google-drive/drive-routes.js +365 -0
  45. package/dist/src/packages/server/integrations/google-drive/drive-skill.js +248 -0
  46. package/dist/src/packages/server/integrations/google-drive/index.js +60 -0
  47. package/dist/src/packages/server/integrations/integration-registry.js +2 -0
  48. package/dist/src/packages/server/routes/agents.js +45 -17
  49. package/dist/src/packages/server/services/agent-service.js +7 -1
  50. package/dist/src/packages/server/services/llm-matcher-service.js +3 -1
  51. package/dist/src/packages/shared/agent-types.js +9 -1
  52. package/package.json +1 -1
  53. package/dist/assets/BossSpawnModal-BknVJp2f.js +0 -1
  54. package/dist/assets/GmailOAuthSetup-CO2LqLvU.js +0 -270
  55. package/dist/assets/GoogleOAuthSetup-OVzavssB.js +0 -203
  56. package/dist/assets/IntegrationsPanel-C0JSiDOw.js +0 -2
  57. package/dist/assets/SpawnModal-Ch7yKsdS.js +0 -1
@@ -1,270 +0,0 @@
1
- import{r as t,W as J,l as N,j as e}from"./main-BsOvZp5M.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function H({integration:o,onSave:f,onCancel:w}){const[s,y]=t.useState(o.values.authMethod||"oauth2"),[b,P]=t.useState(o.values.clientId||""),[j,T]=t.useState(""),[g,F]=t.useState(""),[v,q]=t.useState(o.values.impersonateEmail||""),[p,k]=t.useState(String(o.values.pollingIntervalMs??3e4)),[h,S]=t.useState(o.values.defaultApprovalKeywords||"approved,aprobado,autorizado,yes,ok"),[A,C]=t.useState(null),[r,z]=t.useState(null),[c,d]=t.useState(!1),[I,i]=t.useState(null),[E,O]=t.useState(!1),[m,u]=t.useState(o.status.connected?"connected":"credentials"),l=t.useRef(null),M=t.useRef(o.status.connected),x=t.useCallback(async()=>{try{const a=await J(N("/api/email/status"));if(a.ok){const n=await a.json();z(n),n.authenticated&&(u("connected"),l.current&&(clearInterval(l.current),l.current=null))}}catch(a){console.error("Failed to fetch Gmail status:",a)}},[]);t.useEffect(()=>{const a=o.status.connected,n=M.current;a&&!n&&m!=="connected"?u("connected"):!a&&n&&m==="connected"&&u("credentials"),M.current=a},[o.status.connected]),t.useEffect(()=>(x(),()=>{l.current&&clearInterval(l.current)}),[x]);const D=async()=>{if(!b.trim()){i("Client ID is required");return}d(!0),i(null);try{const a={authMethod:"oauth2",clientId:b.trim(),pollingIntervalMs:parseInt(p)||3e4,defaultApprovalKeywords:h};j.trim()&&(a.clientSecret=j.trim()),await f(a);const n=await J(N("/api/email/auth/url"));if(!n.ok){const L=await n.json().catch(()=>({}));throw new Error(L.error||`HTTP ${n.status}`)}const _=await n.json();if(!_.url)throw new Error("OAuth URL is empty");C(_.url),i(null),u("authorize"),l.current&&clearInterval(l.current),l.current=setInterval(x,3e3)}catch(a){const n=a instanceof Error?a.message:"Failed to get OAuth URL";i(n)}finally{d(!1)}},K=async()=>{if(!g.trim()){i("Service Account JSON is required");return}if(!v.trim()){i("Impersonate Email is required");return}try{const a=JSON.parse(g.trim());if(!a.client_email||!a.private_key){i("Service Account JSON must contain client_email and private_key");return}}catch{i("Invalid JSON in Service Account field");return}d(!0),i(null);try{await f({authMethod:"service_account",serviceAccountJson:g.trim(),impersonateEmail:v.trim(),pollingIntervalMs:parseInt(p)||3e4,defaultApprovalKeywords:h}),await new Promise(a=>setTimeout(a,1e3)),await x()}catch(a){const n=a instanceof Error?a.message:"Failed to save service account";i(n)}finally{d(!1)}},R=async()=>{O(!0),i(null);try{await f({pollingIntervalMs:parseInt(p)||3e4,defaultApprovalKeywords:h})}catch(a){i(a instanceof Error?a.message:"Failed to save settings")}finally{O(!1)}},U=async()=>{d(!0),i(null);try{await f({refreshToken:"",serviceAccountJson:"",impersonateEmail:""}),z(null),C(null),u("credentials"),await x()}catch(a){i(a instanceof Error?a.message:"Failed to disconnect")}finally{d(!1)}},G=!!o.values.serviceAccountJson;return e.jsxs("div",{className:"gmail-oauth-setup",children:[I&&e.jsx("div",{className:"gmail-oauth-error",children:I}),m==="credentials"&&e.jsxs("div",{className:"gmail-oauth-section",children:[e.jsxs("div",{className:"gmail-oauth-field",style:{marginBottom:24},children:[e.jsx("label",{className:"integration-field-label",children:"Authentication Method"}),e.jsxs("div",{className:"gmail-auth-method-selector",children:[e.jsxs("button",{type:"button",className:`gmail-auth-method-btn ${s==="oauth2"?"active":""}`,onClick:()=>{y("oauth2"),i(null)},children:[e.jsx("span",{className:"gmail-auth-method-icon",children:"🔑"}),e.jsx("span",{className:"gmail-auth-method-label",children:"OAuth 2.0"}),e.jsx("span",{className:"gmail-auth-method-desc",children:"Browser login flow"})]}),e.jsxs("button",{type:"button",className:`gmail-auth-method-btn ${s==="service_account"?"active":""}`,onClick:()=>{y("service_account"),i(null)},children:[e.jsx("span",{className:"gmail-auth-method-icon",children:"🤖"}),e.jsx("span",{className:"gmail-auth-method-label",children:"Service Account"}),e.jsx("span",{className:"gmail-auth-method-desc",children:"Domain-wide delegation"})]})]})]}),s==="oauth2"&&e.jsxs(e.Fragment,{children:[e.jsx("h4",{className:"gmail-oauth-section-title",children:"Google OAuth Credentials"}),e.jsxs("p",{className:"gmail-oauth-help",children:["Create OAuth2 credentials in the"," ",e.jsx("a",{href:"https://console.cloud.google.com/apis/credentials",target:"_blank",rel:"noopener noreferrer",className:"gmail-oauth-link",children:"Google Cloud Console"}),". Enable the Gmail API and (optionally) the Calendar API. Set the redirect URI to:"," ",e.jsx("code",{className:"gmail-oauth-code",children:N("/api/email/auth/callback")})]}),e.jsxs("div",{className:"gmail-oauth-field",children:[e.jsxs("label",{className:"integration-field-label",children:["OAuth Client ID ",e.jsx("span",{className:"integration-field-required",children:"*"})]}),e.jsx("input",{type:"text",className:"integration-field-input",value:b,placeholder:"xxxx.apps.googleusercontent.com",onChange:a=>P(a.target.value)})]}),e.jsxs("div",{className:"gmail-oauth-field",children:[e.jsxs("label",{className:"integration-field-label",children:["OAuth Client Secret ",e.jsx("span",{className:"integration-field-required",children:"*"})]}),e.jsx("input",{type:"password",className:"integration-field-input",value:j,placeholder:o.values.clientSecret?"(saved)":"Enter client secret",onChange:a=>T(a.target.value),autoComplete:"off"})]})]}),s==="service_account"&&e.jsxs(e.Fragment,{children:[e.jsx("h4",{className:"gmail-oauth-section-title",children:"Service Account Credentials"}),e.jsxs("p",{className:"gmail-oauth-help",children:["Use a Google service account with"," ",e.jsx("a",{href:"https://admin.google.com/ac/owl/domainwidedelegation",target:"_blank",rel:"noopener noreferrer",className:"gmail-oauth-link",children:"domain-wide delegation"})," ","enabled. The service account must be authorized for Gmail scopes in Google Workspace Admin."]}),e.jsxs("div",{className:"gmail-oauth-field",children:[e.jsxs("label",{className:"integration-field-label",children:["Service Account JSON ",e.jsx("span",{className:"integration-field-required",children:"*"})]}),e.jsx("textarea",{className:"integration-field-input integration-field-textarea",value:g,placeholder:G?"(saved — paste new JSON to replace)":"Paste the full service account JSON key file contents",onChange:a=>F(a.target.value),rows:6,spellCheck:!1}),e.jsx("span",{className:"integration-field-description",children:"The JSON key file downloaded from Google Cloud Console containing client_email and private_key."})]}),e.jsxs("div",{className:"gmail-oauth-field",children:[e.jsxs("label",{className:"integration-field-label",children:["Impersonate Email ",e.jsx("span",{className:"integration-field-required",children:"*"})]}),e.jsx("input",{type:"email",className:"integration-field-input",value:v,placeholder:"user@yourdomain.com",onChange:a=>q(a.target.value)}),e.jsx("span",{className:"integration-field-description",children:"The email address to impersonate via domain-wide delegation. Must be a user in your Google Workspace domain."})]})]}),e.jsxs("div",{className:"gmail-oauth-field",children:[e.jsx("label",{className:"integration-field-label",children:"Polling Interval (ms)"}),e.jsx("input",{type:"number",className:"integration-field-input",value:p,onChange:a=>k(a.target.value)}),e.jsx("span",{className:"integration-field-description",children:"How often to check for new emails. Default: 30000 (30s)."})]}),e.jsxs("div",{className:"gmail-oauth-field",children:[e.jsx("label",{className:"integration-field-label",children:"Approval Keywords"}),e.jsx("textarea",{className:"integration-field-input integration-field-textarea",value:h,onChange:a=>S(a.target.value),rows:2}),e.jsx("span",{className:"integration-field-description",children:"Comma-separated keywords that indicate email approval."})]}),e.jsxs("div",{className:"integration-form-actions",children:[e.jsx("button",{type:"button",className:"integration-btn cancel",onClick:w,children:"Cancel"}),s==="oauth2"?e.jsx("button",{type:"button",className:"integration-btn save",onClick:D,disabled:c||!b.trim(),children:c?"Saving...":"Save & Authorize"}):e.jsx("button",{type:"button",className:"integration-btn save",onClick:K,disabled:c||!v.trim()||!g.trim()&&!G,children:c?"Connecting...":"Save & Connect"})]})]}),m==="authorize"&&e.jsxs("div",{className:"gmail-oauth-section",children:[e.jsx("h4",{className:"gmail-oauth-section-title",children:"Authorize Gmail Access"}),e.jsx("p",{className:"gmail-oauth-help",children:"Click the link below to authorize Tide Commander to access your Gmail account. After granting access, you will be redirected back and the connection will be established automatically."}),A&&e.jsx("a",{href:A,target:"_blank",rel:"noopener noreferrer",className:"gmail-oauth-authorize-btn",children:"Authorize with Google"}),e.jsxs("div",{className:"gmail-oauth-waiting",children:[e.jsx("span",{className:"gmail-oauth-spinner"}),e.jsx("span",{children:"Waiting for authorization to complete..."})]}),e.jsx("div",{className:"integration-form-actions",children:e.jsx("button",{type:"button",className:"integration-btn cancel",onClick:()=>{l.current&&(clearInterval(l.current),l.current=null),u("credentials")},children:"Back"})})]}),m==="connected"&&e.jsxs("div",{className:"gmail-oauth-section",children:[e.jsx("h4",{className:"gmail-oauth-section-title",children:"Gmail Connected"}),e.jsxs("div",{className:"gmail-oauth-connected-info",children:[e.jsx("span",{className:"gmail-oauth-connected-badge",children:"Connected"}),(r==null?void 0:r.emailAddress)&&e.jsx("span",{className:"gmail-oauth-email",children:r.emailAddress}),e.jsx("span",{className:"gmail-oauth-auth-type",children:s==="service_account"?"Service Account":"OAuth 2.0"})]}),(r==null?void 0:r.pollingActive)&&e.jsxs("p",{className:"gmail-oauth-help",children:["Email polling is active.",r.lastPollAt&&e.jsxs(e.Fragment,{children:[" Last checked: ",new Date(r.lastPollAt).toLocaleTimeString()]})]}),e.jsxs("div",{className:"gmail-oauth-field",children:[e.jsx("label",{className:"integration-field-label",children:"Polling Interval (ms)"}),e.jsx("input",{type:"number",className:"integration-field-input",value:p,onChange:a=>k(a.target.value)})]}),e.jsxs("div",{className:"gmail-oauth-field",children:[e.jsx("label",{className:"integration-field-label",children:"Approval Keywords"}),e.jsx("textarea",{className:"integration-field-input integration-field-textarea",value:h,onChange:a=>S(a.target.value),rows:2})]}),e.jsxs("div",{className:"integration-form-actions",children:[e.jsx("button",{type:"button",className:"integration-btn cancel",onClick:w,children:"Close"}),e.jsx("button",{type:"button",className:"integration-btn",style:{backgroundColor:"#f38ba8",color:"#1e1e2e"},onClick:U,disabled:c,children:c?"Disconnecting...":"Disconnect"}),e.jsx("button",{type:"button",className:"integration-btn save",onClick:R,disabled:E,children:E?"Saving...":"Save Settings"})]})]}),e.jsx("style",{children:`
2
- .gmail-oauth-setup {
3
- padding: 0;
4
- }
5
- .gmail-oauth-error {
6
- background: linear-gradient(135deg, rgba(243, 139, 168, 0.2) 0%, rgba(243, 139, 168, 0.08) 100%);
7
- border-left: 3px solid #f38ba8;
8
- color: #f38ba8;
9
- padding: 12px 16px;
10
- border-radius: 8px;
11
- margin-bottom: 18px;
12
- font-size: 13px;
13
- font-weight: 500;
14
- }
15
- .gmail-oauth-section {
16
- background: linear-gradient(180deg, rgba(45, 49, 69, 0.4) 0%, rgba(30, 30, 46, 0.2) 100%);
17
- border: 1px solid rgba(137, 180, 250, 0.15);
18
- border-radius: 12px;
19
- padding: 28px;
20
- backdrop-filter: blur(10px);
21
- }
22
- .gmail-oauth-section-title {
23
- margin: 0 0 16px 0;
24
- color: #cdd6f4;
25
- font-size: 18px;
26
- font-weight: 700;
27
- letter-spacing: -0.5px;
28
- }
29
- .gmail-oauth-help {
30
- color: #a6adc8;
31
- font-size: 13px;
32
- line-height: 1.6;
33
- margin: 0 0 20px 0;
34
- font-weight: 400;
35
- }
36
- .gmail-oauth-link {
37
- color: #89b4fa;
38
- text-decoration: none;
39
- border-bottom: 1.5px solid rgba(137, 180, 250, 0.4);
40
- transition: all 0.2s ease;
41
- font-weight: 500;
42
- }
43
- .gmail-oauth-link:hover {
44
- color: #a8c5ff;
45
- border-bottom-color: #89b4fa;
46
- }
47
- .gmail-oauth-code {
48
- background: rgba(137, 180, 250, 0.15);
49
- color: #89b4fa;
50
- padding: 4px 10px;
51
- border-radius: 6px;
52
- font-size: 12px;
53
- word-break: break-all;
54
- font-weight: 500;
55
- font-family: 'Monaco', 'Menlo', monospace;
56
- }
57
- .gmail-oauth-field {
58
- margin-bottom: 18px;
59
- }
60
- .gmail-auth-method-selector {
61
- display: flex;
62
- gap: 12px;
63
- }
64
- .gmail-auth-method-btn {
65
- flex: 1;
66
- display: flex;
67
- flex-direction: column;
68
- align-items: center;
69
- gap: 6px;
70
- padding: 16px 12px;
71
- background: rgba(30, 30, 46, 0.6);
72
- border: 2px solid rgba(137, 180, 250, 0.15);
73
- border-radius: 10px;
74
- cursor: pointer;
75
- transition: all 0.2s ease;
76
- }
77
- .gmail-auth-method-btn:hover {
78
- border-color: rgba(137, 180, 250, 0.35);
79
- background: rgba(30, 30, 46, 0.8);
80
- }
81
- .gmail-auth-method-btn.active {
82
- border-color: #89b4fa;
83
- background: rgba(137, 180, 250, 0.1);
84
- box-shadow: 0 0 0 3px rgba(137, 180, 250, 0.1);
85
- }
86
- .gmail-auth-method-icon {
87
- font-size: 22px;
88
- }
89
- .gmail-auth-method-label {
90
- color: #cdd6f4;
91
- font-size: 14px;
92
- font-weight: 600;
93
- }
94
- .gmail-auth-method-desc {
95
- color: #7f849c;
96
- font-size: 11px;
97
- font-weight: 400;
98
- }
99
- .gmail-oauth-auth-type {
100
- color: #7f849c;
101
- font-size: 12px;
102
- font-weight: 500;
103
- margin-left: auto;
104
- background: rgba(137, 180, 250, 0.1);
105
- padding: 4px 10px;
106
- border-radius: 6px;
107
- }
108
- .integration-field-label {
109
- display: block;
110
- margin-bottom: 8px;
111
- color: #cdd6f4;
112
- font-size: 14px;
113
- font-weight: 600;
114
- letter-spacing: 0.3px;
115
- }
116
- .integration-field-required {
117
- color: #f38ba8;
118
- }
119
- .integration-field-input {
120
- width: 100%;
121
- background: rgba(30, 30, 46, 0.6);
122
- border: 1.5px solid rgba(137, 180, 250, 0.2);
123
- color: #cdd6f4;
124
- padding: 11px 14px;
125
- border-radius: 8px;
126
- font-size: 13px;
127
- transition: all 0.2s ease;
128
- font-weight: 500;
129
- }
130
- .integration-field-input:focus {
131
- outline: none;
132
- border-color: #89b4fa;
133
- background: rgba(30, 30, 46, 0.8);
134
- box-shadow: 0 0 0 3px rgba(137, 180, 250, 0.15);
135
- }
136
- .integration-field-input::placeholder {
137
- color: #6c7086;
138
- }
139
- .integration-field-textarea {
140
- resize: vertical;
141
- min-height: 80px;
142
- font-family: 'Monaco', 'Menlo', monospace;
143
- font-size: 12px;
144
- }
145
- .integration-field-description {
146
- display: block;
147
- margin-top: 7px;
148
- color: #7f849c;
149
- font-size: 12px;
150
- font-weight: 400;
151
- }
152
- .gmail-oauth-authorize-btn {
153
- display: inline-block;
154
- background: linear-gradient(135deg, #89b4fa 0%, #7aa3f0 100%);
155
- color: #1e1e2e;
156
- padding: 12px 32px;
157
- border-radius: 8px;
158
- text-decoration: none;
159
- font-weight: 700;
160
- font-size: 14px;
161
- margin-bottom: 20px;
162
- transition: all 0.25s ease;
163
- border: none;
164
- cursor: pointer;
165
- box-shadow: 0 4px 12px rgba(137, 180, 250, 0.25);
166
- letter-spacing: 0.3px;
167
- }
168
- .gmail-oauth-authorize-btn:hover {
169
- transform: translateY(-2px);
170
- box-shadow: 0 6px 16px rgba(137, 180, 250, 0.35);
171
- background: linear-gradient(135deg, #a8c5ff 0%, #8eb8ff 100%);
172
- }
173
- .gmail-oauth-authorize-btn:active {
174
- transform: translateY(0);
175
- }
176
- .gmail-oauth-waiting {
177
- display: flex;
178
- align-items: center;
179
- gap: 12px;
180
- color: #a6adc8;
181
- font-size: 13px;
182
- margin-bottom: 20px;
183
- background: rgba(137, 180, 250, 0.08);
184
- padding: 14px 16px;
185
- border-radius: 8px;
186
- border-left: 3px solid #89b4fa;
187
- font-weight: 500;
188
- }
189
- .gmail-oauth-spinner {
190
- display: inline-block;
191
- width: 16px;
192
- height: 16px;
193
- border: 2.5px solid rgba(137, 180, 250, 0.25);
194
- border-top-color: #89b4fa;
195
- border-radius: 50%;
196
- animation: gmail-spin 0.8s linear infinite;
197
- flex-shrink: 0;
198
- }
199
- @keyframes gmail-spin {
200
- to { transform: rotate(360deg); }
201
- }
202
- .gmail-oauth-connected-info {
203
- display: flex;
204
- align-items: center;
205
- gap: 14px;
206
- margin-bottom: 20px;
207
- background: rgba(166, 227, 161, 0.08);
208
- padding: 16px;
209
- border-radius: 10px;
210
- border-left: 3px solid #a6e3a1;
211
- }
212
- .gmail-oauth-connected-badge {
213
- background: linear-gradient(135deg, rgba(166, 227, 161, 0.3) 0%, rgba(166, 227, 161, 0.15) 100%);
214
- color: #a6e3a1;
215
- padding: 6px 14px;
216
- border-radius: 6px;
217
- font-size: 12px;
218
- font-weight: 700;
219
- letter-spacing: 0.4px;
220
- text-transform: uppercase;
221
- border: 1px solid rgba(166, 227, 161, 0.3);
222
- flex-shrink: 0;
223
- }
224
- .gmail-oauth-email {
225
- color: #cdd6f4;
226
- font-size: 14px;
227
- font-weight: 600;
228
- letter-spacing: 0.2px;
229
- }
230
- .integration-form-actions {
231
- display: flex;
232
- gap: 12px;
233
- justify-content: flex-end;
234
- margin-top: 24px;
235
- padding-top: 20px;
236
- border-top: 1px solid rgba(137, 180, 250, 0.1);
237
- }
238
- .integration-btn {
239
- padding: 10px 24px;
240
- border-radius: 8px;
241
- font-weight: 600;
242
- font-size: 13px;
243
- border: none;
244
- cursor: pointer;
245
- transition: all 0.2s ease;
246
- letter-spacing: 0.3px;
247
- }
248
- .integration-btn.save {
249
- background: linear-gradient(135deg, #89b4fa 0%, #7aa3f0 100%);
250
- color: #1e1e2e;
251
- box-shadow: 0 4px 12px rgba(137, 180, 250, 0.25);
252
- }
253
- .integration-btn.save:hover:not(:disabled) {
254
- transform: translateY(-2px);
255
- box-shadow: 0 6px 16px rgba(137, 180, 250, 0.35);
256
- }
257
- .integration-btn.cancel {
258
- background: rgba(137, 180, 250, 0.1);
259
- color: #89b4fa;
260
- border: 1.5px solid rgba(137, 180, 250, 0.2);
261
- }
262
- .integration-btn.cancel:hover:not(:disabled) {
263
- background: rgba(137, 180, 250, 0.15);
264
- border-color: #89b4fa;
265
- }
266
- .integration-btn:disabled {
267
- opacity: 0.5;
268
- cursor: not-allowed;
269
- }
270
- `})]})}export{H as GmailOAuthSetup};
@@ -1,203 +0,0 @@
1
- import{r as a,W as N,l as b,j as e}from"./main-BsOvZp5M.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function L({integration:r,onSave:x,onCancel:f}){const[i,v]=a.useState(r.values.GOOGLE_CLIENT_ID||""),[d,C]=a.useState(""),[m,y]=a.useState(null),[s,z]=a.useState(null),[j,k]=a.useState(!1),[w,c]=a.useState(null),[g,u]=a.useState(r.status.connected?"connected":"credentials"),t=a.useRef(null),p=a.useCallback(async()=>{try{const o=r.id==="gmail"?"/api/email/status":"/api/calendar/status",l=await N(b(o));if(l.ok){const n=await l.json();z(n),n.authenticated&&(u("connected"),t.current&&(clearInterval(t.current),t.current=null))}}catch(o){console.error("Failed to fetch Google auth status:",o)}},[r.id]);a.useEffect(()=>(p(),()=>{t.current&&clearInterval(t.current)}),[p]);const A=async()=>{if(!i.trim()){c("Client ID is required");return}k(!0),c(null);try{const o={GOOGLE_CLIENT_ID:i.trim()};d.trim()&&(o.GOOGLE_CLIENT_SECRET=d.trim()),console.log("Saving Google OAuth config...",o),await x(o),console.log("Config saved successfully"),console.log("Fetching OAuth URL...");const l=r.id==="gmail"?"/api/email/auth/url":"/api/calendar/auth/url",n=await N(b(l));if(console.log("OAuth URL response:",n.status),!n.ok){const E=await n.json().catch(()=>({}));throw new Error(E.error||`HTTP ${n.status}`)}const h=await n.json();if(console.log("Received OAuth URL:",h),!h.url)throw new Error("OAuth URL is empty");y(h.url),console.log("AuthUrl state updated"),c(null),u("authorize"),console.log("Step updated to authorize"),t.current&&clearInterval(t.current),t.current=setInterval(p,3e3),console.log("Started polling for auth completion")}catch(o){const l=o instanceof Error?o.message:"Failed to get OAuth URL";console.error("Error in handleSaveCredentials:",l,o),c(l)}finally{k(!1)}};return e.jsxs("div",{className:"google-oauth-setup",children:[w&&e.jsx("div",{className:"google-oauth-error",children:w}),g==="credentials"&&e.jsxs("div",{className:"google-oauth-section",children:[e.jsx("h4",{className:"google-oauth-section-title",children:"Google OAuth Credentials"}),e.jsxs("p",{className:"google-oauth-help",children:["Create OAuth2 credentials in the"," ",e.jsx("a",{href:"https://console.cloud.google.com/apis/credentials",target:"_blank",rel:"noopener noreferrer",className:"google-oauth-link",children:"Google Cloud Console"}),". Enable the Gmail and Calendar APIs. Set the redirect URI to:"," ",e.jsx("code",{className:"google-oauth-code",children:b(r.id==="gmail"?"/api/email/auth/callback":"/api/calendar/auth/callback")})]}),e.jsxs("div",{className:"google-oauth-field",children:[e.jsxs("label",{className:"integration-field-label",children:["OAuth Client ID ",e.jsx("span",{className:"integration-field-required",children:"*"})]}),e.jsx("input",{type:"text",className:"integration-field-input",value:i,placeholder:"xxxx.apps.googleusercontent.com",onChange:o=>v(o.target.value)})]}),e.jsxs("div",{className:"google-oauth-field",children:[e.jsxs("label",{className:"integration-field-label",children:["OAuth Client Secret ",e.jsx("span",{className:"integration-field-required",children:"*"})]}),e.jsx("input",{type:"password",className:"integration-field-input",value:d,placeholder:r.values.GOOGLE_CLIENT_SECRET?"(saved)":"Enter client secret",onChange:o=>C(o.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"integration-form-actions",children:[e.jsx("button",{type:"button",className:"integration-btn cancel",onClick:f,children:"Cancel"}),e.jsx("button",{type:"button",className:"integration-btn save",onClick:A,disabled:j||!i.trim(),children:j?"Saving...":"Save & Authorize"})]})]}),g==="authorize"&&e.jsxs("div",{className:"google-oauth-section",children:[e.jsx("h4",{className:"google-oauth-section-title",children:"Authorize Google Access"}),e.jsx("p",{className:"google-oauth-help",children:"Click the link below to authorize Tide Commander to access your Google account. After granting access, you will be redirected back and the connection will be established automatically."}),m&&e.jsx("a",{href:m,target:"_blank",rel:"noopener noreferrer",className:"google-oauth-authorize-btn",children:"Authorize with Google"}),e.jsxs("div",{className:"google-oauth-waiting",children:[e.jsx("span",{className:"google-oauth-spinner"}),e.jsx("span",{children:"Waiting for authorization to complete..."})]}),e.jsx("div",{className:"integration-form-actions",children:e.jsx("button",{type:"button",className:"integration-btn cancel",onClick:()=>{t.current&&(clearInterval(t.current),t.current=null),u("credentials")},children:"Back"})})]}),g==="connected"&&e.jsxs("div",{className:"google-oauth-section",children:[e.jsx("h4",{className:"google-oauth-section-title",children:"Google Connected"}),e.jsxs("div",{className:"google-oauth-connected-info",children:[e.jsx("span",{className:"google-oauth-connected-badge",children:"Connected"}),(s==null?void 0:s.emailAddress)&&e.jsx("span",{className:"google-oauth-email",children:s.emailAddress})]}),e.jsx("p",{className:"google-oauth-help",children:"Your Google account has been successfully connected."}),e.jsx("div",{className:"integration-form-actions",children:e.jsx("button",{type:"button",className:"integration-btn cancel",onClick:async()=>{await x({}),f()},children:"Close"})})]}),e.jsx("style",{children:`
2
- .google-oauth-setup {
3
- padding: 0;
4
- }
5
- .google-oauth-error {
6
- background: linear-gradient(135deg, rgba(243, 139, 168, 0.2) 0%, rgba(243, 139, 168, 0.08) 100%);
7
- border-left: 3px solid #f38ba8;
8
- color: #f38ba8;
9
- padding: 12px 16px;
10
- border-radius: 8px;
11
- margin-bottom: 18px;
12
- font-size: 13px;
13
- font-weight: 500;
14
- }
15
- .google-oauth-section {
16
- background: linear-gradient(180deg, rgba(45, 49, 69, 0.4) 0%, rgba(30, 30, 46, 0.2) 100%);
17
- border: 1px solid rgba(137, 180, 250, 0.15);
18
- border-radius: 12px;
19
- padding: 28px;
20
- backdrop-filter: blur(10px);
21
- }
22
- .google-oauth-section-title {
23
- margin: 0 0 16px 0;
24
- color: #cdd6f4;
25
- font-size: 18px;
26
- font-weight: 700;
27
- letter-spacing: -0.5px;
28
- }
29
- .google-oauth-help {
30
- color: #a6adc8;
31
- font-size: 13px;
32
- line-height: 1.6;
33
- margin: 0 0 20px 0;
34
- font-weight: 400;
35
- }
36
- .google-oauth-link {
37
- color: #89b4fa;
38
- text-decoration: none;
39
- border-bottom: 1.5px solid rgba(137, 180, 250, 0.4);
40
- transition: all 0.2s ease;
41
- font-weight: 500;
42
- }
43
- .google-oauth-link:hover {
44
- color: #a8c5ff;
45
- border-bottom-color: #89b4fa;
46
- }
47
- .google-oauth-code {
48
- background: rgba(137, 180, 250, 0.15);
49
- color: #89b4fa;
50
- padding: 4px 10px;
51
- border-radius: 6px;
52
- font-size: 12px;
53
- word-break: break-all;
54
- font-weight: 500;
55
- font-family: 'Monaco', 'Menlo', monospace;
56
- }
57
- .google-oauth-field {
58
- margin-bottom: 18px;
59
- }
60
- .integration-field-label {
61
- display: block;
62
- margin-bottom: 8px;
63
- color: #cdd6f4;
64
- font-size: 14px;
65
- font-weight: 600;
66
- letter-spacing: 0.3px;
67
- }
68
- .integration-field-required {
69
- color: #f38ba8;
70
- }
71
- .integration-field-input {
72
- width: 100%;
73
- background: rgba(30, 30, 46, 0.6);
74
- border: 1.5px solid rgba(137, 180, 250, 0.2);
75
- color: #cdd6f4;
76
- padding: 11px 14px;
77
- border-radius: 8px;
78
- font-size: 13px;
79
- transition: all 0.2s ease;
80
- font-weight: 500;
81
- }
82
- .integration-field-input:focus {
83
- outline: none;
84
- border-color: #89b4fa;
85
- background: rgba(30, 30, 46, 0.8);
86
- box-shadow: 0 0 0 3px rgba(137, 180, 250, 0.15);
87
- }
88
- .google-oauth-authorize-btn {
89
- display: inline-block;
90
- background: linear-gradient(135deg, #89b4fa 0%, #7aa3f0 100%);
91
- color: #1e1e2e;
92
- padding: 12px 32px;
93
- border-radius: 8px;
94
- text-decoration: none;
95
- font-weight: 700;
96
- font-size: 14px;
97
- margin-bottom: 20px;
98
- transition: all 0.25s ease;
99
- border: none;
100
- cursor: pointer;
101
- box-shadow: 0 4px 12px rgba(137, 180, 250, 0.25);
102
- letter-spacing: 0.3px;
103
- }
104
- .google-oauth-authorize-btn:hover {
105
- transform: translateY(-2px);
106
- box-shadow: 0 6px 16px rgba(137, 180, 250, 0.35);
107
- background: linear-gradient(135deg, #a8c5ff 0%, #8eb8ff 100%);
108
- }
109
- .google-oauth-waiting {
110
- display: flex;
111
- align-items: center;
112
- gap: 12px;
113
- color: #a6adc8;
114
- font-size: 13px;
115
- margin-bottom: 20px;
116
- background: rgba(137, 180, 250, 0.08);
117
- padding: 14px 16px;
118
- border-radius: 8px;
119
- border-left: 3px solid #89b4fa;
120
- font-weight: 500;
121
- }
122
- .google-oauth-spinner {
123
- display: inline-block;
124
- width: 16px;
125
- height: 16px;
126
- border: 2.5px solid rgba(137, 180, 250, 0.25);
127
- border-top-color: #89b4fa;
128
- border-radius: 50%;
129
- animation: google-spin 0.8s linear infinite;
130
- flex-shrink: 0;
131
- }
132
- @keyframes google-spin {
133
- to { transform: rotate(360deg); }
134
- }
135
- .google-oauth-connected-info {
136
- display: flex;
137
- align-items: center;
138
- gap: 14px;
139
- margin-bottom: 20px;
140
- background: rgba(166, 227, 161, 0.08);
141
- padding: 16px;
142
- border-radius: 10px;
143
- border-left: 3px solid #a6e3a1;
144
- }
145
- .google-oauth-connected-badge {
146
- background: linear-gradient(135deg, rgba(166, 227, 161, 0.3) 0%, rgba(166, 227, 161, 0.15) 100%);
147
- color: #a6e3a1;
148
- padding: 6px 14px;
149
- border-radius: 6px;
150
- font-size: 12px;
151
- font-weight: 700;
152
- letter-spacing: 0.4px;
153
- text-transform: uppercase;
154
- border: 1px solid rgba(166, 227, 161, 0.3);
155
- flex-shrink: 0;
156
- }
157
- .google-oauth-email {
158
- color: #cdd6f4;
159
- font-size: 14px;
160
- font-weight: 600;
161
- letter-spacing: 0.2px;
162
- }
163
- .integration-form-actions {
164
- display: flex;
165
- gap: 12px;
166
- justify-content: flex-end;
167
- margin-top: 24px;
168
- padding-top: 20px;
169
- border-top: 1px solid rgba(137, 180, 250, 0.1);
170
- }
171
- .integration-btn {
172
- padding: 10px 24px;
173
- border-radius: 8px;
174
- font-weight: 600;
175
- font-size: 13px;
176
- border: none;
177
- cursor: pointer;
178
- transition: all 0.2s ease;
179
- letter-spacing: 0.3px;
180
- }
181
- .integration-btn.save {
182
- background: linear-gradient(135deg, #89b4fa 0%, #7aa3f0 100%);
183
- color: #1e1e2e;
184
- box-shadow: 0 4px 12px rgba(137, 180, 250, 0.25);
185
- }
186
- .integration-btn.save:hover:not(:disabled) {
187
- transform: translateY(-2px);
188
- box-shadow: 0 6px 16px rgba(137, 180, 250, 0.35);
189
- }
190
- .integration-btn.cancel {
191
- background: rgba(137, 180, 250, 0.1);
192
- color: #89b4fa;
193
- border: 1.5px solid rgba(137, 180, 250, 0.2);
194
- }
195
- .integration-btn.cancel:hover:not(:disabled) {
196
- background: rgba(137, 180, 250, 0.15);
197
- border-color: #89b4fa;
198
- }
199
- .integration-btn:disabled {
200
- opacity: 0.5;
201
- cursor: not-allowed;
202
- }
203
- `})]})}export{L as GoogleOAuthSetup};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GmailOAuthSetup-CO2LqLvU.js","assets/main-BsOvZp5M.js","assets/modulepreload-polyfill-B5Qt9EMX.js","assets/vendor-react--Eh9ivFN.js","assets/vendor-three-Chj50gSY.js","assets/main-3GpIvzEr.css","assets/GoogleOAuthSetup-OVzavssB.js"])))=>i.map(i=>d[i]);
2
- import{r as c,W as I,l as w,j as e,z as B,aO as R}from"./main-BsOvZp5M.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const z={"gmail-oauth":c.lazy(()=>R(()=>import("./GmailOAuthSetup-CO2LqLvU.js"),__vite__mapDeps([0,1,2,3,4,5])).then(s=>({default:s.GmailOAuthSetup}))),"google-oauth":c.lazy(()=>R(()=>import("./GoogleOAuthSetup-OVzavssB.js"),__vite__mapDeps([6,1,2,3,4,5])).then(s=>({default:s.GoogleOAuthSetup})))},E={gmail:"✉️",slack:"💬",jira:"📋","google-calendar":"📅",docx:"📄"},N={gmail:"Send and receive emails through Gmail. Supports OAuth 2.0 authentication for secure access to your inbox.",slack:"Connect to Slack workspaces. Send messages, receive notifications, and integrate with channels.",jira:"Manage Jira issues and projects. Create tickets, track progress, and handle service desk requests.","google-calendar":"Access Google Calendar events. Create, update, and monitor calendar entries.",docx:"Generate and manipulate DOCX documents. Create reports, templates, and formatted documents."},A={gmail:["Google Cloud Console project","OAuth 2.0 credentials (Client ID & Secret)","Gmail API enabled"],slack:["Slack App with Bot Token and App-Level Token (Socket Mode)",'Enable Socket Mode in your app settings under "Socket Mode"','Enable Events in the "Event Subscriptions" section of your app config',"Subscribe to bot events: message.channels, message.groups, message.im","Required Bot Token scopes: channels:history, channels:read, chat:write, groups:history, groups:read, im:history, im:read, users:read"],jira:["Jira Cloud instance URL","API Token (from Atlassian account)","Account email address"],"google-calendar":["Google Cloud Console project","OAuth 2.0 credentials","Calendar API enabled"],docx:["No external credentials required","Templates directory (optional)"]},o={overlay:{position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4,backdropFilter:"blur(4px)",animation:"fadeIn 0.15s ease-out"},modal:{background:"var(--surface-0, #1e1e2e)",borderRadius:12,border:"1px solid var(--border, #313244)",width:"90vw",maxWidth:720,maxHeight:"85vh",display:"flex",flexDirection:"column",overflow:"hidden",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.5)",animation:"slideUp 0.2s ease-out"},header:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:"1px solid var(--border, #313244)",background:"var(--surface-1, #181825)"},headerTitle:{fontSize:16,fontWeight:600,color:"var(--text-primary, #cdd6f4)",display:"flex",alignItems:"center",gap:8},closeBtn:{background:"none",border:"none",color:"var(--text-secondary, #a6adc8)",fontSize:20,cursor:"pointer",padding:"4px 8px",borderRadius:6,lineHeight:1},tabs:{display:"flex",borderBottom:"1px solid var(--border, #313244)",background:"var(--surface-1, #181825)",overflowX:"auto",scrollbarWidth:"none"},tab:s=>({padding:"10px 16px",background:"none",border:"none",borderBottom:s?"2px solid var(--accent, #89b4fa)":"2px solid transparent",color:s?"var(--accent, #89b4fa)":"var(--text-secondary, #a6adc8)",fontSize:13,fontWeight:s?600:400,cursor:"pointer",display:"flex",alignItems:"center",gap:6,whiteSpace:"nowrap",transition:"color 0.15s, border-color 0.15s",flexShrink:0}),tabStatus:(s,u)=>({width:6,height:6,borderRadius:"50%",background:u?"#f38ba8":s?"#a6e3a1":"#fab387",flexShrink:0}),body:{flex:1,overflow:"auto",padding:20},integrationHeader:{display:"flex",alignItems:"flex-start",gap:12,marginBottom:16},iconCircle:{width:44,height:44,borderRadius:10,background:"var(--surface-1, #181825)",border:"1px solid var(--border, #313244)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:22,flexShrink:0},integrationMeta:{flex:1},integrationName:{fontSize:15,fontWeight:600,color:"var(--text-primary, #cdd6f4)",marginBottom:4,display:"flex",alignItems:"center",gap:8},description:{fontSize:13,color:"var(--text-secondary, #a6adc8)",lineHeight:1.5},statusBadge:(s,u)=>({display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",borderRadius:10,fontSize:11,fontWeight:600,background:u?"rgba(243, 139, 168, 0.15)":s?"rgba(166, 227, 161, 0.15)":"rgba(250, 179, 135, 0.15)",color:u?"#f38ba8":s?"#a6e3a1":"#fab387"}),section:{marginTop:16,padding:12,borderRadius:8,background:"var(--surface-1, #181825)",border:"1px solid var(--border, #313244)"},sectionTitle:{fontSize:12,fontWeight:600,color:"var(--text-secondary, #a6adc8)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:8},requirementList:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"column",gap:4},requirementItem:{fontSize:12,color:"var(--text-secondary, #a6adc8)",display:"flex",alignItems:"center",gap:6},formSection:{marginTop:16},formSectionTitle:{fontSize:12,fontWeight:600,color:"var(--text-secondary, #a6adc8)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:12}};function O({integration:s,onSave:u,onCancel:g}){const[p,T]=c.useState({...s.values}),[m,x]=c.useState({}),[h,C]=c.useState(!1),[y,b]=c.useState(!1);c.useEffect(()=>{T({...s.values}),x({}),b(!1)},[s.id]);const f=(t,l)=>{T(r=>({...r,[t]:l})),x(r=>{const i={...r};return delete i[t],i}),b(!1)},k=async t=>{t.preventDefault();const l={};for(const r of s.schema)if(r.required&&!p[r.key]&&p[r.key]!==0&&p[r.key]!==!1&&(l[r.key]=`${r.label} is required`),r.validate){const i=r.validate(p[r.key]);i&&(l[r.key]=i)}if(Object.keys(l).length>0){x(l);return}C(!0);try{await u(p),b(!0),setTimeout(()=>b(!1),3e3)}catch(r){x({_form:String(r)})}finally{C(!1)}},v=new Map;for(const t of s.schema){const l=t.group||"";v.has(l)||v.set(l,[]),v.get(l).push(t)}const n={display:"flex",flexDirection:"column",gap:4,marginBottom:12},a={fontSize:13,fontWeight:500,color:"var(--text-primary, #cdd6f4)"},d={padding:"8px 10px",borderRadius:6,border:"1px solid var(--border, #313244)",background:"var(--surface-0, #1e1e2e)",color:"var(--text-primary, #cdd6f4)",fontSize:13,outline:"none",width:"100%",boxSizing:"border-box"},S={fontSize:11,color:"var(--text-secondary, #a6adc8)"},j={fontSize:11,color:"#f38ba8"},_=t=>{var r;const l=p[t.key]??t.defaultValue??"";switch(t.type){case"boolean":return e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,color:"var(--text-primary, #cdd6f4)",cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!l,onChange:i=>f(t.key,i.target.checked)}),t.label]});case"select":return e.jsxs("select",{style:d,value:String(l),onChange:i=>f(t.key,i.target.value),children:[e.jsx("option",{value:"",children:t.placeholder||"Select..."}),(r=t.options)==null?void 0:r.map(i=>e.jsx("option",{value:i.value,children:i.label},i.value))]});case"textarea":return e.jsx("textarea",{style:{...d,resize:"vertical",minHeight:80},value:String(l),placeholder:t.placeholder,onChange:i=>f(t.key,i.target.value),rows:4});case"number":return e.jsx("input",{type:"number",style:d,value:l===""?"":Number(l),placeholder:t.placeholder,onChange:i=>f(t.key,i.target.value===""?"":Number(i.target.value))});case"password":return e.jsx("input",{type:"password",style:d,value:String(l),placeholder:t.placeholder,onChange:i=>f(t.key,i.target.value),autoComplete:"off"});default:return e.jsx("input",{type:t.type,style:d,value:String(l),placeholder:t.placeholder,onChange:i=>f(t.key,i.target.value)})}};return e.jsxs("form",{onSubmit:k,children:[m._form&&e.jsx("div",{style:{...j,marginBottom:12,padding:"8px 10px",borderRadius:6,background:"rgba(243, 139, 168, 0.1)"},children:m._form}),Array.from(v.entries()).map(([t,l])=>e.jsxs("div",{children:[t&&e.jsx("div",{style:{...o.sectionTitle,marginTop:16,marginBottom:8},children:t}),l.map(r=>e.jsxs("div",{style:n,children:[r.type!=="boolean"&&e.jsxs("label",{style:a,children:[r.label,r.required&&e.jsx("span",{style:{color:"#f38ba8",marginLeft:2},children:"*"})]}),_(r),r.description&&e.jsx("span",{style:S,children:r.description}),m[r.key]&&e.jsx("span",{style:j,children:m[r.key]})]},r.key))]},t||"_default")),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",marginTop:16,paddingTop:12,borderTop:"1px solid var(--border, #313244)"},children:[e.jsx("button",{type:"button",onClick:g,style:{padding:"8px 16px",borderRadius:6,border:"1px solid var(--border, #313244)",background:"none",color:"var(--text-secondary, #a6adc8)",fontSize:13,cursor:"pointer"},children:"Cancel"}),e.jsx("button",{type:"submit",disabled:h,style:{padding:"8px 16px",borderRadius:6,border:"none",background:y?"#a6e3a1":"var(--accent, #89b4fa)",color:"#1e1e2e",fontSize:13,fontWeight:600,cursor:h?"wait":"pointer",opacity:h?.7:1},children:h?"Saving...":y?"Saved":"Save Configuration"})]})]})}function L({isOpen:s,onClose:u,initialTab:g}){const[p,T]=c.useState([]),[m,x]=c.useState(g||null),[h,C]=c.useState(!0),[y,b]=c.useState(null),f=c.useRef(g||null),k=c.useCallback(async()=>{try{const a=await I(w("/api/integrations"));if(!a.ok)throw new Error(`HTTP ${a.status}`);const d=await a.json();T(d),b(null),x(S=>{const j=S||g||(d.length>0?d[0].id:null);return f.current=j,j})}catch(a){b(`Failed to load integrations: ${a}`)}finally{C(!1)}},[g]);c.useEffect(()=>{s&&(C(!0),k(),g&&x(g))},[s,g]);const v=c.useCallback(async(a,d)=>{const S=await I(w(`/api/integrations/${a}/config`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)});if(!S.ok){const j=await S.json().catch(()=>({}));throw new Error(j.error||`HTTP ${S.status}`)}await k()},[k]);if(!s)return null;const n=p.find(a=>a.id===m);return e.jsx("div",{style:o.overlay,onClick:u,children:e.jsxs("div",{style:o.modal,onClick:a=>a.stopPropagation(),children:[e.jsxs("div",{style:o.header,children:[e.jsxs("div",{style:o.headerTitle,children:[e.jsx("span",{children:"🔌"}),e.jsx("span",{children:"Integrations"})]}),e.jsx("button",{style:o.closeBtn,onClick:u,title:"Close",children:"×"})]}),h&&e.jsx("div",{style:{padding:40,textAlign:"center",color:"var(--text-secondary, #a6adc8)"},children:"Loading integrations..."}),y&&e.jsxs("div",{style:{padding:20,textAlign:"center"},children:[e.jsx("div",{style:{color:"#f38ba8",marginBottom:8},children:y}),e.jsx("button",{onClick:k,style:{padding:"6px 12px",borderRadius:6,border:"1px solid var(--border, #313244)",background:"none",color:"var(--text-primary, #cdd6f4)",cursor:"pointer",fontSize:13},children:"Retry"})]}),!h&&!y&&p.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:o.tabs,children:p.map(a=>e.jsxs("button",{style:o.tab(m===a.id),onClick:()=>x(a.id),children:[e.jsx("span",{children:E[a.id]||"🔌"}),e.jsx("span",{children:a.name}),e.jsx("span",{style:o.tabStatus(a.status.connected,!!a.status.error)})]},a.id))}),e.jsx("div",{style:o.body,children:n&&e.jsxs("div",{children:[e.jsxs("div",{style:o.integrationHeader,children:[e.jsx("div",{style:o.iconCircle,children:E[n.id]||"🔌"}),e.jsxs("div",{style:o.integrationMeta,children:[e.jsxs("div",{style:o.integrationName,children:[n.name,e.jsx("span",{style:o.statusBadge(n.status.connected,!!n.status.error),children:n.status.error?"✗ Error":n.status.connected?"✓ Connected":"⚠ Not Configured"})]}),e.jsx("div",{style:o.description,children:N[n.id]||n.description})]})]}),n.status.error&&e.jsxs("div",{style:{...o.section,borderColor:"rgba(243, 139, 168, 0.3)",background:"rgba(243, 139, 168, 0.05)"},children:[e.jsx("div",{style:{...o.sectionTitle,color:"#f38ba8"},children:"Error"}),e.jsx("div",{style:{fontSize:12,color:"#f38ba8"},children:n.status.error})]}),A[n.id]&&e.jsxs("div",{style:o.section,children:[e.jsx("div",{style:o.sectionTitle,children:"Requirements"}),e.jsx("ul",{style:o.requirementList,children:A[n.id].map((a,d)=>e.jsxs("li",{style:o.requirementItem,children:[e.jsx("span",{style:{color:"var(--accent, #89b4fa)"},children:"•"}),a]},d))})]}),e.jsxs("div",{style:o.formSection,children:[e.jsx("div",{style:o.formSectionTitle,children:"Configuration"}),n.customComponent&&z[n.customComponent]?e.jsx(c.Suspense,{fallback:e.jsx("div",{style:{color:"var(--text-secondary)",fontSize:13},children:"Loading..."}),children:B.createElement(z[n.customComponent],{key:n.id,integration:n,onSave:a=>v(n.id,a),onCancel:u})}):e.jsx(O,{integration:n,onSave:a=>v(n.id,a),onCancel:u})]})]})})]}),!h&&!y&&p.length===0&&e.jsx("div",{style:{padding:40,textAlign:"center",color:"var(--text-secondary, #a6adc8)"},children:"No integrations available."})]})})}export{L as IntegrationsPanel};
@@ -1 +0,0 @@
1
- import{u as Ve,I as Ze,M as Qe,N as es,O as ss,P as ns,r as t,U as as,S as ke,V as te,A as ye,l as le,W as ts,s as B,h as ls,j as s,X as os,C as Ae,Y as x,Z as is,_ as oe,$ as G,a0 as K,a1 as ie,a2 as cs}from"./main-BsOvZp5M.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function De(c,j){const S=j.filter(b=>!c.has(b));return S.length===0?`${j[Math.floor(Math.random()*j.length)]}-${Date.now()%1e3}`:S[Math.floor(Math.random()*S.length)]}function us({isOpen:c,onClose:j,onSpawnStart:S,onSpawnEnd:b,spawnPosition:Ee,spawnAreaId:v}){const{t:n}=Ve(["terminal","common"]),C=Ze(),$=Qe(),p=es(),ce=ss(),H=ce.length>0?ce:ns,[m,N]=t.useState(""),[M,P]=t.useState(()=>as(ke.LAST_CWD)),[i,Y]=t.useState("scout"),[re,D]=t.useState(!1),[Ie,T]=t.useState(!1),[de,J]=t.useState(!1),[pe,me]=t.useState(""),[k,X]=t.useState([]),[y,F]=t.useState(null),[Le,ue]=t.useState(!1),[E,he]=t.useState(""),[u,_e]=t.useState(""),[R,$e]=t.useState(!0),[U,Pe]=t.useState("bypass"),[o,V]=t.useState("claude"),[g,I]=t.useState({fullAuto:!0,sandbox:"workspace-write",approvalMode:"on-request",search:!1}),[we,Z]=t.useState(new Set),[Q,xe]=t.useState("opus"),[ee,fe]=t.useState("high"),[se,Te]=t.useState("gpt-5.3-codex"),[ne,Fe]=t.useState("minimax/MiniMax-M1-80k"),[je,Re]=t.useState(""),[A,Ue]=t.useState(""),z=t.useRef(null),ge=t.useRef(!1),L=t.useCallback(()=>{window.__spawnModalAreaContext=null},[]),h=t.useMemo(()=>$.filter(e=>e.enabled),[$]),ze=["full-notifications","streaming-exec","task-label","report-task-to-boss","agent-tracking"];t.useEffect(()=>{if(c&&!ge.current&&h.length>0){const a=h.filter(l=>ze.includes(l.slug)).map(l=>l.id);a.length>0&&Z(new Set(a))}ge.current=c},[c,h]);const ve=t.useMemo(()=>{if(!A.trim())return h;const e=A.toLowerCase();return h.filter(a=>a.name.toLowerCase().includes(e)||a.description.toLowerCase().includes(e)||a.slug.toLowerCase().includes(e))},[h,A]),qe=t.useCallback(e=>{Z(a=>{const l=new Set(a);return l.has(e)?l.delete(e):l.add(e),l})},[]);t.useMemo(()=>h.filter(e=>e.assignedAgentClasses.includes(i)),[h,i]);const We=t.useMemo(()=>{var a;const e=p.find(l=>l.id===i);return(a=e==null?void 0:e.defaultSkillIds)!=null&&a.length?$.filter(l=>e.defaultSkillIds.includes(l.id)):[]},[p,i,$]),Ne=t.useMemo(()=>{if(!E.trim())return k;const e=E.toLowerCase();return k.filter(a=>a.sessionId.toLowerCase().includes(e)||a.projectPath.toLowerCase().includes(e)||a.firstMessage&&a.firstMessage.toLowerCase().includes(e))},[k,E]),q=t.useMemo(()=>{if(!u.trim())return p;const e=u.toLowerCase();return p.filter(a=>a.name.toLowerCase().includes(e)||a.description.toLowerCase().includes(e)||a.id.toLowerCase().includes(e))},[p,u]),W=t.useMemo(()=>{if(!u.trim())return te;const e=u.toLowerCase();return te.filter(a=>{const l=ye[a.id];return a.name.toLowerCase().includes(e)||a.id.toLowerCase().includes(e)||l.description.toLowerCase().includes(e)})},[u]);t.useEffect(()=>{if(!c||!u.trim())return;const e=[...q.map(a=>a.id),...W.map(a=>a.id)];e.length===1&&e[0]!==i&&Y(e[0])},[c,u,q,W,i]);const r=t.useMemo(()=>p.find(e=>e.id===i),[p,i]),Oe=t.useMemo(()=>{if(r!=null&&r.model)return r.model},[r]),Be=t.useMemo(()=>{if(r!=null&&r.customModelPath)return le(`/api/custom-models/${r.id}`)},[r]),Ge=r==null?void 0:r.modelScale,Ke=t.useMemo(()=>r?"scout":i,[i,r]),O=t.useCallback(async e=>{ue(!0);try{const a=e?le(`/api/agents/claude-sessions?cwd=${encodeURIComponent(e)}`):le("/api/agents/claude-sessions"),d=await(await ts(a)).json();X(d.sessions||[])}catch(a){console.error("Failed to fetch sessions:",a),X([])}finally{ue(!1)}},[]);t.useEffect(()=>{c?O(M||void 0):(X([]),F(null),he(""))},[c,O]),t.useEffect(()=>{if(!c)return;const e=setTimeout(()=>{O(M||void 0),F(null)},300);return()=>clearTimeout(e)},[M,c,O]),t.useEffect(()=>{if(!c||!v)return;const e=B.getState().areas.get(v);if(e!=null&&e.directories&&e.directories.length>0){P(e.directories[0]);return}const a=Array.from(C.values()).filter(f=>{var _;return((_=B.getAreaForAgent(f.id))==null?void 0:_.id)===v&&f.cwd});if(a.length===0)return;const l=new Map;for(const f of a)l.set(f.cwd,(l.get(f.cwd)||0)+1);let d="",w=0;for(const[f,_]of l)_>w&&(d=f,w=_);d&&P(d)},[c,v,C]),t.useEffect(()=>{if(c){const e=new Set(Array.from(C.values()).map(w=>w.name)),a=De(e,H),l=p.find(w=>w.id===i),d=l?`${l.name} ${a}`:a;N(d),z.current&&(z.current.focus(),z.current.select())}},[c,C,H]),t.useEffect(()=>{if(!c)return;new Set(Array.from(C.values()).map(a=>a.name));const e=p.find(a=>a.id===i);if(e){const a=p.find(l=>m.startsWith(l.name+" "));if(a){const l=m.substring(a.name.length+1);N(`${e.name} ${l}`)}else N(`${e.name} ${m}`)}else{const a=p.find(l=>m.startsWith(l.name+" "));if(a){const l=m.substring(a.name.length+1);N(l)}}},[i]),t.useEffect(()=>{i==="boss"&&xe("opus")},[i]);const He=()=>{var d;console.log("[SpawnModal] handleSpawn called"),T(!1);const e=y&&((d=k.find(w=>w.sessionId===y))==null?void 0:d.projectPath)||M;if(console.log("[SpawnModal] Effective CWD:",e),console.log("[SpawnModal] Agent name:",m),console.log("[SpawnModal] Agent class:",i),console.log("[SpawnModal] Permission mode:",U),console.log("[SpawnModal] Provider:",o),console.log("[SpawnModal] Use Chrome:",R),console.log("[SpawnModal] Session ID:",y||"none"),!e.trim()){console.error("[SpawnModal] Empty CWD, showing error"),T(!0);return}if(!m.trim()){console.log("[SpawnModal] Empty name, regenerating");const w=new Set(Array.from(C.values()).map(f=>f.name));N(De(w,H));return}cs(ke.LAST_CWD,e),D(!0),S();const a=Array.from(we),l=je.trim()||void 0;console.log("[SpawnModal] Calling store.spawnAgent with:",{name:m.trim(),class:i,cwd:e.trim(),sessionId:y||void 0,useChrome:o==="claude"?R:!1,permissionMode:U,provider:o,codexConfig:o==="codex"?g:void 0,codexModel:o==="codex"?se:void 0,opencodeModel:o==="opencode"?ne:void 0,initialSkillIds:a,model:o==="claude"?Q:void 0,customInstructions:l?`${l.length} chars`:void 0,spawnAreaId:v||void 0}),window.__spawnModalAreaContext=v?{areaId:v}:null,B.spawnAgent(m.trim(),i,e.trim(),Ee||void 0,y||void 0,o==="claude"?R:!1,U,a,o,o==="codex"?g:void 0,o==="codex"?se:void 0,o==="claude"?Q:void 0,l,o==="claude"?ee:void 0,o==="opencode"?ne:void 0)},Se=()=>{console.log("[SpawnModal] Agent creation successful"),D(!1),N(""),Z(new Set),L(),b(),j()},be=()=>{console.error("[SpawnModal] Agent creation failed"),D(!1),T(!0),L(),b()},Ce=e=>{console.log("[SpawnModal] Directory not found:",e),D(!1),me(e),J(!0),b()},Me=()=>{J(!1),D(!0),S(),B.createDirectoryAndSpawn(pe,m.trim(),i)},ae=()=>{J(!1),me(""),L()};t.useEffect(()=>(window.__spawnModalSuccess=Se,window.__spawnModalError=be,window.__spawnModalDirNotFound=Ce,()=>{L(),delete window.__spawnModalSuccess,delete window.__spawnModalError,delete window.__spawnModalDirNotFound}),[m,i,Se,be,Ce,L]);const{handleMouseDown:Ye,handleClick:Je}=ls(j),Xe=e=>{e.key==="Escape"&&j()};return!c&&!de?null:de?s.jsx("div",{className:"modal-overlay visible",onClick:ae,onKeyDown:e=>{e.key==="Escape"&&ae(),e.key==="Enter"&&Me()},children:s.jsxs("div",{className:"modal confirm-modal",onClick:e=>e.stopPropagation(),children:[s.jsx("div",{className:"modal-header",children:n("terminal:spawn.directoryNotFound")}),s.jsxs("div",{className:"modal-body confirm-modal-body",children:[s.jsx("p",{children:n("terminal:spawn.directoryNotExist")}),s.jsx("code",{className:"confirm-modal-path",children:pe}),s.jsx("p",{children:n("terminal:spawn.wouldYouCreate")})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:ae,children:n("common:buttons.cancel")}),s.jsx("button",{className:"btn btn-primary",onClick:Me,autoFocus:!0,children:n("terminal:spawn.createDirectory")})]})]})}):s.jsx("div",{className:`modal-overlay ${c?"visible":""}`,onMouseDown:Ye,onClick:Je,onKeyDown:Xe,children:s.jsxs("div",{className:"modal spawn-modal",children:[s.jsx("div",{className:"modal-header",children:n("terminal:spawn.deployTitle")}),s.jsxs("div",{className:"modal-body spawn-modal-body",children:[s.jsxs("div",{className:"spawn-top-section",children:[s.jsx("div",{className:"spawn-preview-compact",children:s.jsx(os,{agentClass:Ke,modelFile:Oe,customModelUrl:Be,modelScale:Ge,width:100,height:120})}),s.jsxs("div",{className:"spawn-class-section",children:[s.jsx("div",{className:"spawn-class-label",children:n("terminal:spawn.agentClass")}),p.length+te.length>6&&s.jsx("input",{type:"text",className:"spawn-input class-search-input",placeholder:n("terminal:spawn.filterClasses"),value:u,onChange:e=>_e(e.target.value)}),s.jsxs("div",{className:"class-selector-inline",children:[q.map(e=>s.jsxs("button",{className:`class-chip ${i===e.id?"selected":""}`,onClick:()=>Y(e.id),title:e.description,children:[s.jsx(Ae,{classId:e.id,size:18,className:"class-chip-icon"}),s.jsx("span",{className:"class-chip-name",children:e.name})]},e.id)),W.map(e=>{const a=ye[e.id];return s.jsxs("button",{className:`class-chip ${i===e.id?"selected":""}`,onClick:()=>Y(e.id),title:a.description,children:[s.jsx(Ae,{classId:e.id,size:18,className:"class-chip-icon"}),s.jsx("span",{className:"class-chip-name",children:e.name})]},e.id)}),u&&q.length===0&&W.length===0&&s.jsx("div",{className:"class-search-empty",children:n("terminal:spawn.noClassesMatch",{query:u})})]})]})]}),s.jsxs("div",{className:"spawn-form-section",children:[s.jsxs("div",{className:"spawn-form-row",children:[s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.name")}),s.jsx("input",{ref:z,type:"text",className:"spawn-input",placeholder:n("terminal:spawn.agentNamePlaceholder"),value:m,onChange:e=>N(e.target.value)})]}),s.jsxs("div",{className:"spawn-field spawn-field-wide",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.workingDir"),s.jsx(x,{text:n("terminal:spawn.helpWorkingDir"),title:n("terminal:spawn.workingDir"),position:"top",size:"sm"})]}),s.jsx(is,{value:M,onChange:e=>{P(e),T(!1)},placeholder:n("terminal:spawn.workingDirPlaceholder"),className:`spawn-input ${Ie?"error":""}`,directoriesOnly:!0})]})]}),s.jsxs("div",{className:"spawn-form-row",children:[s.jsxs("div",{className:"spawn-field",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.selectRuntime"),s.jsx(x,{text:n("terminal:spawn.helpRuntime"),title:n("terminal:spawn.runtimeTitle"),position:"top",size:"sm"})]}),s.jsxs("div",{className:"spawn-select-row",children:[s.jsxs("button",{className:`spawn-select-btn ${o==="claude"?"selected":""}`,onClick:()=>V("claude"),title:n("terminal:spawn.useClaudeCli"),children:[s.jsx("img",{src:"/assets/claude.ico",alt:"Claude",className:"spawn-provider-icon"}),s.jsx("span",{children:"Claude"})]}),s.jsxs("button",{className:`spawn-select-btn ${o==="codex"?"selected":""}`,onClick:()=>V("codex"),title:n("terminal:spawn.useCodexCli"),children:[s.jsx("img",{src:"/assets/codex.ico",alt:"Codex",className:"spawn-provider-icon"}),s.jsx("span",{children:"Codex"})]}),s.jsxs("button",{className:`spawn-select-btn spawn-select-btn--opencode ${o==="opencode"?"selected":""}`,onClick:()=>V("opencode"),title:"Use OpenCode CLI (multi-provider)",children:[s.jsx("span",{children:"🟢"}),s.jsx("span",{children:"OpenCode"})]})]})]}),s.jsxs("div",{className:"spawn-field",children:[s.jsxs("label",{className:"spawn-label",children:[n("common:labels.permissions"),s.jsx(x,{text:n("terminal:spawn.helpPermission"),title:n("terminal:spawn.permissionMode"),position:"top",size:"sm"})]}),s.jsx("div",{className:"spawn-select-row",children:Object.keys(oe).map(e=>s.jsxs("button",{className:`spawn-select-btn ${U===e?"selected":""}`,onClick:()=>Pe(e),title:oe[e].description,children:[s.jsx("span",{children:e==="bypass"?"⚡":"🔐"}),s.jsx("span",{children:oe[e].label})]},e))})]})]}),s.jsxs("div",{className:"spawn-form-row",children:[s.jsxs("div",{className:"spawn-field",children:[s.jsxs("label",{className:"spawn-label",children:[n("common:labels.model"),s.jsx(x,{text:n("terminal:spawn.helpModel"),title:n("terminal:spawn.modelTitle"),position:"top",size:"sm"})]}),o==="claude"?s.jsx("div",{className:"spawn-select-row",children:Object.keys(G).map(e=>s.jsxs("button",{className:`spawn-select-btn ${Q===e?"selected":""}`,onClick:()=>xe(e),title:G[e].description,children:[s.jsx("span",{children:G[e].icon}),s.jsx("span",{children:G[e].label})]},e))}):o==="codex"?s.jsx("div",{className:"spawn-select-row spawn-select-row--codex-models",children:Object.keys(K).map(e=>s.jsxs("button",{className:`spawn-select-btn ${se===e?"selected":""}`,onClick:()=>Te(e),title:K[e].description,children:[s.jsx("span",{children:K[e].icon}),s.jsx("span",{children:K[e].label})]},e))}):o==="opencode"?s.jsx("input",{type:"text",className:"spawn-input",value:ne,onChange:e=>Fe(e.target.value),placeholder:"provider/model (e.g., minimax/MiniMax-M1-80k)"}):s.jsx("div",{className:"spawn-inline-hint",children:n("terminal:spawn.chooseCodexModel")})]}),o==="claude"&&s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:"Effort"}),s.jsxs("div",{className:"spawn-select-row spawn-select-row--effort",children:[s.jsx("button",{className:`spawn-select-btn spawn-select-btn--compact ${ee===void 0?"selected":""}`,onClick:()=>fe(void 0),title:"Use default effort level",children:s.jsx("span",{children:"Default"})}),Object.keys(ie).map(e=>s.jsx("button",{className:`spawn-select-btn spawn-select-btn--compact ${ee===e?"selected":""}`,onClick:()=>fe(e),title:ie[e].description,children:s.jsx("span",{children:ie[e].label})},e))]})]}),s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("terminal:spawn.browser")}),s.jsx("div",{className:"spawn-form-row spawn-options-row",children:s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:R,onChange:e=>$e(e.target.checked),disabled:o!=="claude"}),s.jsxs("span",{children:["🌐 ",n("terminal:spawn.chromeBrowser")]}),s.jsx(x,{text:n(o==="claude"?"terminal:spawn.helpChrome":"terminal:spawn.helpChromeDisabled"),title:n("terminal:spawn.chromeBrowser"),position:"top",size:"sm"})]})})]})]}),o==="codex"&&s.jsxs("div",{className:"codex-config-section",children:[s.jsx("div",{className:"codex-config-title",children:n("terminal:spawn.codex.configuration")}),s.jsxs("div",{className:"codex-config-options",children:[s.jsxs("div",{className:"codex-option-group",children:[s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:g.fullAuto!==!1,onChange:e=>I(a=>({...a,fullAuto:e.target.checked}))}),s.jsx("span",{children:n("terminal:spawn.codex.fullAuto")}),s.jsx(x,{text:n("terminal:spawn.helpFullAuto"),title:n("terminal:spawn.fullAutoTitle"),position:"top",size:"sm"})]}),s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:!!g.search,onChange:e=>I(a=>({...a,search:e.target.checked}))}),s.jsx("span",{children:n("terminal:spawn.codex.search")}),s.jsx(x,{text:n("terminal:spawn.helpSearch"),title:n("terminal:spawn.searchTitle"),position:"top",size:"sm"})]})]}),g.fullAuto===!1&&s.jsxs("div",{className:"codex-option-group",children:[s.jsx("div",{className:"codex-option-header",children:n("terminal:spawn.codex.restrictions")}),s.jsxs("select",{className:"spawn-input codex-select",value:g.sandbox||"workspace-write",onChange:e=>I(a=>({...a,sandbox:e.target.value})),children:[s.jsxs("option",{value:"read-only",children:["📖 ",n("terminal:spawn.codex.sandboxReadOnly")]}),s.jsxs("option",{value:"workspace-write",children:["✏️ ",n("terminal:spawn.codex.sandboxWorkspaceWrite")]}),s.jsxs("option",{value:"danger-full-access",children:["⚡ ",n("terminal:spawn.codex.sandboxDangerFullAccess")]})]}),s.jsxs("select",{className:"spawn-input codex-select",value:g.approvalMode||"on-request",onChange:e=>I(a=>({...a,approvalMode:e.target.value})),children:[s.jsxs("option",{value:"untrusted",children:["🔒 ",n("terminal:spawn.codex.approvalsUntrusted")]}),s.jsxs("option",{value:"on-failure",children:["⚠️ ",n("terminal:spawn.codex.approvalsOnFailure")]}),s.jsxs("option",{value:"on-request",children:["🤔 ",n("terminal:spawn.codex.approvalsOnRequest")]}),s.jsxs("option",{value:"never",children:["✅ ",n("terminal:spawn.codex.approvalsNever")]})]})]}),s.jsxs("div",{className:"codex-option-group",children:[s.jsx("div",{className:"codex-option-header",children:n("terminal:spawn.codex.profile")}),s.jsx("input",{type:"text",className:"spawn-input codex-profile-input",placeholder:n("terminal:spawn.codex.profilePlaceholder"),value:g.profile||"",onChange:e=>I(a=>({...a,profile:e.target.value||void 0}))})]})]})]}),h.length>0&&s.jsxs("div",{className:"spawn-skills-section",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.skills")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",n("common:labels.optional"),")"]}),s.jsx(x,{text:n("terminal:spawn.helpSkills"),title:n("terminal:spawn.skillsTitle"),position:"top",size:"sm"})]}),h.length>6&&s.jsx("input",{type:"text",className:"spawn-input skill-search-input",placeholder:n("terminal:spawn.filterSkills"),value:A,onChange:e=>Ue(e.target.value)}),s.jsxs("div",{className:"spawn-skills-inline",children:[ve.map(e=>{const a=we.has(e.id);return We.some(d=>d.id===e.id)?null:s.jsxs("button",{className:`spawn-skill-chip ${a?"selected":""}`,onClick:()=>qe(e.id),title:e.description,children:[a&&s.jsx("span",{className:"spawn-skill-check",children:"✓"}),s.jsx("span",{children:e.name}),e.builtin&&s.jsx("span",{className:"spawn-skill-builtin",children:"TC"})]},e.id)}),A&&ve.length===0&&s.jsx("div",{className:"skill-search-empty",children:n("terminal:spawn.noSkillsMatch",{query:A})})]})]}),s.jsxs("div",{className:"spawn-custom-instructions-section",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.customInstructions")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",n("common:labels.optional"),")"]}),s.jsx(x,{text:n("terminal:spawn.helpCustomInstructions"),title:n("terminal:spawn.customInstructions"),position:"top",size:"sm"})]}),s.jsx("textarea",{className:"spawn-input spawn-textarea",placeholder:n("terminal:spawn.customInstructionsPlaceholder"),value:je,onChange:e=>Re(e.target.value),rows:3})]}),s.jsxs("div",{className:"spawn-sessions-section",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.linkSession")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",n("common:labels.optional"),")"]}),s.jsx(x,{text:n("terminal:spawn.helpLinkSession"),title:n("terminal:spawn.linkSessionTitle"),position:"top",size:"sm"})]}),k.length>0&&s.jsx("input",{type:"text",className:"spawn-input session-search-input",placeholder:n("terminal:spawn.searchSessions"),value:E,onChange:e=>he(e.target.value)}),s.jsx("div",{className:"sessions-list",children:Le?s.jsx("div",{className:"sessions-loading",children:n("terminal:spawn.loadingSessions")}):k.length===0?s.jsx("div",{className:"sessions-empty",children:n("terminal:spawn.noSessions")}):Ne.length===0?s.jsx("div",{className:"sessions-empty",children:n("terminal:spawn.noSessionsMatch",{query:E})}):Ne.map(e=>{const a=y===e.sessionId,l=Date.now()-new Date(e.lastModified).getTime(),d=l<6e4?n("common:time.justNow"):l<36e5?n("common:time.minutesAgo",{count:Math.floor(l/6e4)}):l<864e5?n("common:time.hoursAgo",{count:Math.floor(l/36e5)}):n("common:time.daysAgo",{count:Math.floor(l/864e5)});return s.jsxs("div",{className:`session-item ${a?"selected":""}`,onClick:()=>{a?F(null):(F(e.sessionId),P(e.projectPath))},children:[s.jsxs("div",{className:"session-item-header",children:[s.jsx("span",{className:"session-item-path",children:e.projectPath}),s.jsx("span",{className:"session-item-age",children:d})]}),s.jsx("div",{className:"session-item-preview",children:e.firstMessage||n("terminal:spawn.messagesCount",{count:e.messageCount})})]},e.sessionId)})})]})]})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:j,children:n("common:buttons.cancel")}),s.jsx("button",{className:"btn btn-primary",onClick:He,disabled:re,children:n(re?"common:buttons.deploying":"common:buttons2.deploy")})]})]})})}export{us as SpawnModal};