@lovelybunch/api 1.0.77-alpha.4 → 1.0.78-alpha.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.
- package/dist/middleware/auth.js +5 -39
- package/dist/routes/api/v1/auth-settings/route.js +57 -0
- package/dist/routes/api/v1/jobs/[id]/route.d.ts +8 -8
- package/dist/routes/api/v1/jobs/route.d.ts +8 -8
- package/dist/routes/api/v1/mail/route.d.ts +3 -3
- package/dist/server-with-static.js +0 -19
- package/dist/server.js +0 -17
- package/package.json +4 -4
- package/static/assets/{ActivityPage-NWY9n_Vz.js → ActivityPage-DiwGC2nD.js} +1 -1
- package/static/assets/{AgentsContextEditPage-CegcDIbc.js → AgentsContextEditPage-Xh10BIpD.js} +1 -1
- package/static/assets/{AgentsContextPage-tv1aSHZt.js → AgentsContextPage-DYLVgjBy.js} +1 -1
- package/static/assets/{ApiKeysSettingsPage-DBLY6U4j.js → ApiKeysSettingsPage-21Rz7etb.js} +1 -1
- package/static/assets/{AuthSettingsPage-CrQ12eym.js → AuthSettingsPage-CuDQH02c.js} +1 -1
- package/static/assets/{CallbackPage-CG7uYftC.js → CallbackPage-Fok1FSep.js} +1 -1
- package/static/assets/{CoconutCallbackPage-5SdoMUzX.js → CoconutCallbackPage-CJCSsq2v.js} +1 -1
- package/static/assets/{CodePage-BSpmMVCY.js → CodePage-CzEzWmjy.js} +1 -1
- package/static/assets/{CollapsibleSection-CIsOS9cT.js → CollapsibleSection-CAtdqP8-.js} +1 -1
- package/static/assets/{DashboardPage-H6Do6mdY.js → DashboardPage-i5uE_kdH.js} +1 -1
- package/static/assets/{GitPage-BUjmwsaT.js → GitPage-Do-L6D0R.js} +1 -1
- package/static/assets/{GitSettingsPage-D4pHZQc1.js → GitSettingsPage-GZ5wAGvy.js} +1 -1
- package/static/assets/{IdentityPage-eGF1AqJq.js → IdentityPage-BJe8PLkl.js} +1 -1
- package/static/assets/{ImplementationStepsEditor-B2rhUkN7.js → ImplementationStepsEditor-C5ERpOXx.js} +1 -1
- package/static/assets/{IntegrationsSettingsPage-BtuhWJYd.js → IntegrationsSettingsPage-Bw9hlc_l.js} +1 -1
- package/static/assets/{JobDetailPage-DELop2el.js → JobDetailPage-DvPv3vVS.js} +1 -1
- package/static/assets/{KnowledgeDetailPage-tar2oGxi.js → KnowledgeDetailPage-BPhauuYL.js} +1 -1
- package/static/assets/{KnowledgeEditPage-B2Kar8q4.js → KnowledgeEditPage-CQUswyeH.js} +1 -1
- package/static/assets/{KnowledgePage-DLc2exrV.js → KnowledgePage-KTCjoesA.js} +1 -1
- package/static/assets/{LoginPage-DOmSsPXw.js → LoginPage-BYAGsbfR.js} +1 -1
- package/static/assets/{MailInboxPage-TygzTth5.js → MailInboxPage-DSTys1-R.js} +1 -1
- package/static/assets/{MailProcessingModal-DNrjOWM6.js → MailProcessingModal-Ctknm_wU.js} +1 -1
- package/static/assets/{MailReadPage-kzVyjGT2.js → MailReadPage-AOANr3XI.js} +1 -1
- package/static/assets/{MailSentPage-B_8poTdm.js → MailSentPage-BnSYoKkQ.js} +1 -1
- package/static/assets/{McpSettingsPage-8OZzZoOw.js → McpSettingsPage-CY3iobWJ.js} +1 -1
- package/static/assets/{MemoryEditPage-hbJZOd-h.js → MemoryEditPage-Bh_d-iqV.js} +1 -1
- package/static/assets/{MemoryPage-mPp-CSud.js → MemoryPage-CMPTTwSH.js} +1 -1
- package/static/assets/{NewKnowledgePage-EFr9n04L.js → NewKnowledgePage-B00wknYX.js} +1 -1
- package/static/assets/{NewSkillPage-CMh7-arC.js → NewSkillPage-hNhVRNjh.js} +1 -1
- package/static/assets/{NewTaskPage-CQ5OgF1b.js → NewTaskPage-Dq75MGuc.js} +1 -1
- package/static/assets/{NotFoundPage-C5dV-iS-.js → NotFoundPage-CR1-vMeX.js} +1 -1
- package/static/assets/{NotificationsSettingsPage-dPjU5Q1h.js → NotificationsSettingsPage-5aeTZq8-.js} +1 -1
- package/static/assets/{PromptsSettingsPage-BvZsTJJa.js → PromptsSettingsPage-Brs1vikj.js} +1 -1
- package/static/assets/{ResourceDetailPage-BOQcC7HN.js → ResourceDetailPage-3r3KPdJy.js} +1 -1
- package/static/assets/{ResourcesPage-D78kDCDA.js → ResourcesPage-CFtSgZva.js} +1 -1
- package/static/assets/{RoleEditPage-B9kTm8KI.js → RoleEditPage-DmSqJEHZ.js} +1 -1
- package/static/assets/{RolePage-B2vEFgJt.js → RolePage-Dm523gez.js} +1 -1
- package/static/assets/{RulesSettingsPage-DkpLo1qw.js → RulesSettingsPage-DewqNsAk.js} +1 -1
- package/static/assets/{RunDetailPage-cKilo4we.js → RunDetailPage-BDUVebTX.js} +1 -1
- package/static/assets/{SchedulePage-Bs_zBMCY.js → SchedulePage-DFnoNF-X.js} +1 -1
- package/static/assets/{SkillDetailPage-Ltd1vGyY.js → SkillDetailPage-DnCPbpIZ.js} +1 -1
- package/static/assets/{SkillEditPage-WvDnQbsn.js → SkillEditPage-Inn-YsZP.js} +1 -1
- package/static/assets/{SkillsPage-2bSn7LSx.js → SkillsPage-CD-eiUnZ.js} +1 -1
- package/static/assets/{SkillsSettingsPage-B9JwEAuy.js → SkillsSettingsPage-C1bs2gVd.js} +1 -1
- package/static/assets/{SourceInput-BDIqXfxi.js → SourceInput-CIyYOUd-.js} +1 -1
- package/static/assets/{TagInput-CL7jQrpP.js → TagInput-fSSAsdov.js} +1 -1
- package/static/assets/{TaskDetailPage-CtG04fHi.js → TaskDetailPage-B2AeYerz.js} +1 -1
- package/static/assets/{TaskEditPage-CzqOFJag.js → TaskEditPage-B9dA1Nr4.js} +1 -1
- package/static/assets/{TasksPage-horVpdZI.js → TasksPage-DJBVDNw1.js} +1 -1
- package/static/assets/{TeamEditPage-CL6ZR7WT.js → TeamEditPage-BGHM7C8n.js} +1 -1
- package/static/assets/{TeamPage-CZ8AhAtV.js → TeamPage-CGxpXKc4.js} +1 -1
- package/static/assets/{TerminalPage-DdsR4df6.js → TerminalPage-z5NbYWjF.js} +1 -1
- package/static/assets/{TerminalSessionPage-BtNLOnes.js → TerminalSessionPage-eDZDlEeb.js} +1 -1
- package/static/assets/{UserPreferencesPage-BFuA9TaZ.js → UserPreferencesPage-uTC5S4Ig.js} +1 -1
- package/static/assets/{UserSettingsPage-B4iBDHTu.js → UserSettingsPage-D6uxgoz5.js} +1 -1
- package/static/assets/{UtilitiesPage-lIgfa-TS.js → UtilitiesPage-BwoS0vin.js} +1 -1
- package/static/assets/{alert-BblaPWI4.js → alert-CKLRmrya.js} +1 -1
- package/static/assets/{arrow-down-5wVLzm2P.js → arrow-down-B7v_FmC2.js} +1 -1
- package/static/assets/{arrow-left-B2qdn6F8.js → arrow-left-CrE2UamQ.js} +1 -1
- package/static/assets/{arrow-up-BUq8ttsr.js → arrow-up-DkJyEUv_.js} +1 -1
- package/static/assets/{arrow-up-down-Wx3HNLji.js → arrow-up-down-CyKWLTed.js} +1 -1
- package/static/assets/{badge-CnihwoO_.js → badge-CEhr50DH.js} +1 -1
- package/static/assets/{browser-modal-BpmwARpG.js → browser-modal-BaiHyGXz.js} +1 -1
- package/static/assets/{card-ClTppZkC.js → card-CEBVsJGA.js} +1 -1
- package/static/assets/{chevron-left-B6cdF33u.js → chevron-left-Dwnb59xB.js} +1 -1
- package/static/assets/{chevron-up-DmV7RyoW.js → chevron-up-CLuT-8K8.js} +1 -1
- package/static/assets/{chevrons-up-CaytjQin.js → chevrons-up-DiHFV5Rg.js} +1 -1
- package/static/assets/{circle-alert-DLogptcc.js → circle-alert-DbwPGG3s.js} +1 -1
- package/static/assets/{circle-check-WnW2gKuY.js → circle-check-DoS8t4b0.js} +1 -1
- package/static/assets/{circle-check-big-_7cw_xX7.js → circle-check-big-DW9BPHOx.js} +1 -1
- package/static/assets/{circle-play-DAjst76T.js → circle-play-B5pWyVQu.js} +1 -1
- package/static/assets/{circle-x-Cy-GEE0N.js → circle-x-D0FfNqWc.js} +1 -1
- package/static/assets/{clipboard-BjRIfdtw.js → clipboard-DesoxJnQ.js} +1 -1
- package/static/assets/{clock-BqpT33TV.js → clock-KMBAqOpw.js} +1 -1
- package/static/assets/{code-BlCNWFR0.js → code-Jj7V1OI-.js} +1 -1
- package/static/assets/{download-gMGjJye8.js → download-bCNOpuix.js} +1 -1
- package/static/assets/{external-link-B62Uv2FB.js → external-link-BbvQVJFO.js} +1 -1
- package/static/assets/{eye-SF5oVtaC.js → eye-B3bkY8eg.js} +1 -1
- package/static/assets/{folder-git-2-DjFQ-1Nl.js → folder-git-2-DK4rLsn4.js} +1 -1
- package/static/assets/{globe-CawEz_y2.js → globe-bTMV8w2D.js} +1 -1
- package/static/assets/{index-CmhgE-Ve.js → index--BGsGBNQ.js} +1 -1
- package/static/assets/{index-CBMKhVK-.js → index-4_sGNb1Z.js} +1 -1
- package/static/assets/{index-CVk4I1l9.js → index-BQ6iW0x3.js} +1 -1
- package/static/assets/{index-IG1FNNtX.js → index-BbgmwHwE.js} +1 -1
- package/static/assets/{index-DhYqfZIE.js → index-BcFOHKDW.js} +1 -1
- package/static/assets/{index-CutWk1Pr.js → index-BnXRNrU8.js} +1 -1
- package/static/assets/{index-D6b2LruY.js → index-Bys9M37r.js} +1 -1
- package/static/assets/{index-CJjOSL3x.js → index-C0uIENKu.js} +3 -3
- package/static/assets/{index-BOKRJR9W.js → index-CZiSycvj.js} +1 -1
- package/static/assets/{index-CWkvL12t.js → index-CpjimEBF.js} +1 -1
- package/static/assets/{index-BLYnta2A.js → index-D5ZLXUjG.js} +1 -1
- package/static/assets/{index-BgXpiZXS.js → index-D82OGwJi.js} +1 -1
- package/static/assets/{index-BsyUW5MN.js → index-DHFK1JbA.js} +1 -1
- package/static/assets/{index-HbxEbyW3.js → index-DUahdX7L.js} +1 -1
- package/static/assets/{index-DiHN7yBx.js → index-DVczQIDE.js} +1 -1
- package/static/assets/{index-FFag0sNb.js → index-DtuMv8f8.js} +1 -1
- package/static/assets/{index-BhC1oAgs.js → index-X-V7B-bx.js} +1 -1
- package/static/assets/{index-C77IIPc5.js → index-fkGtFh-U.js} +1 -1
- package/static/assets/{index-DRejVr_E.js → index-gnXQirFQ.js} +1 -1
- package/static/assets/{info-On5lSg5-.js → info-CMb2giNJ.js} +1 -1
- package/static/assets/{label-ENwgDlxz.js → label-DXN216Ba.js} +1 -1
- package/static/assets/{markdown-editor-ClbNJOVl.js → markdown-editor-MQ7X6BHT.js} +3 -3
- package/static/assets/{message-square-DBowh0DJ.js → message-square-f1hNpr6b.js} +1 -1
- package/static/assets/{paperclip-Fv26pkZS.js → paperclip-BiwY4VlV.js} +1 -1
- package/static/assets/{pause-C35xce-o.js → pause-EbBEDWDr.js} +1 -1
- package/static/assets/{play-dMLqfItH.js → play-BHqUO04d.js} +1 -1
- package/static/assets/{radio-group-BPgf2DjV.js → radio-group-CzhYpC89.js} +1 -1
- package/static/assets/{refresh-cw-4aDPS4Ma.js → refresh-cw-BPr-EVyC.js} +1 -1
- package/static/assets/{search-BKZ_bHPJ.js → search-BBw4K5iK.js} +1 -1
- package/static/assets/{select-Cft45rTz.js → select-BLUGdloJ.js} +1 -1
- package/static/assets/{server-RIrco6rM.js → server-2mf5MwhW.js} +1 -1
- package/static/assets/{switch-N26zinJT.js → switch-DwGQE3tG.js} +1 -1
- package/static/assets/{tabs-94xo_fGd.js → tabs-33myWTAS.js} +1 -1
- package/static/assets/{tag-D1KdHBUM.js → tag-C-PW20qp.js} +1 -1
- package/static/assets/{terminal-preview-BpviO4IZ.js → terminal-preview-BHb0aOSR.js} +1 -1
- package/static/assets/{triangle-alert-O41QYHqC.js → triangle-alert-CNER-68k.js} +1 -1
- package/static/assets/{use-terminal-C8IG41zB.js → use-terminal-GvBteSXs.js} +1 -1
- package/static/assets/{video-Dh8WwEAk.js → video-3hk0v1CB.js} +1 -1
- package/static/index.html +1 -1
package/dist/middleware/auth.js
CHANGED
|
@@ -2,9 +2,7 @@ import { getCookie } from 'hono/cookie';
|
|
|
2
2
|
import { getConnInfo } from '@hono/node-server/conninfo';
|
|
3
3
|
import { getAuthManager } from '../lib/auth/auth-manager.js';
|
|
4
4
|
import { getOAuthRuntimeConfig } from '../config/oauth.js';
|
|
5
|
-
import { getM2MRuntimeConfig } from '../config/m2m.js';
|
|
6
5
|
import { verifyClerkToken } from '../lib/auth/clerk-verifier.js';
|
|
7
|
-
import { verifyCoconutM2MToken } from '../lib/auth/clerk-m2m-verifier.js';
|
|
8
6
|
const LOOPBACK_ADDRESSES = new Set(['127.0.0.1', '::1', '::ffff:127.0.0.1']);
|
|
9
7
|
/**
|
|
10
8
|
* Check if a request is a direct localhost connection (not proxied).
|
|
@@ -116,11 +114,7 @@ export async function authMiddleware(c, next) {
|
|
|
116
114
|
return c.json({ error: 'Unauthorized', message: 'No authentication token provided' }, 401);
|
|
117
115
|
}
|
|
118
116
|
// Verify token: try local HS256 session JWT first (fast, no network),
|
|
119
|
-
// then Clerk JWKS verification
|
|
120
|
-
// this coconut's client_id), then Clerk M2M verification for control-
|
|
121
|
-
// plane tokens (coconut_id claim = this coconut's id). Each check is
|
|
122
|
-
// strictly scoped — a user OIDC token will never satisfy the M2M rule
|
|
123
|
-
// and vice versa — so the chain can't accidentally conflate them.
|
|
117
|
+
// then fall back to Clerk JWKS verification when --oauth is enabled.
|
|
124
118
|
let session = await authManager.verifyToken(token);
|
|
125
119
|
let authType = 'session';
|
|
126
120
|
if (!session) {
|
|
@@ -148,25 +142,6 @@ export async function authMiddleware(c, next) {
|
|
|
148
142
|
}
|
|
149
143
|
}
|
|
150
144
|
}
|
|
151
|
-
// M2M control-plane tokens: verified like OIDC tokens but gated on the
|
|
152
|
-
// custom `coconut_id` claim instead of audience. On success we DON'T mint
|
|
153
|
-
// an AuthSession — M2M callers aren't users and shouldn't appear in
|
|
154
|
-
// session-shaped contexts. Instead we set authType='m2m' and let
|
|
155
|
-
// requireAdmin recognize this as a trusted non-session authenticator
|
|
156
|
-
// (same pattern as API keys and direct-localhost).
|
|
157
|
-
if (!session) {
|
|
158
|
-
const m2m = getM2MRuntimeConfig();
|
|
159
|
-
if (m2m.enabled && m2m.coconutId) {
|
|
160
|
-
const result = await verifyCoconutM2MToken(token, {
|
|
161
|
-
expectedCoconutId: m2m.coconutId,
|
|
162
|
-
});
|
|
163
|
-
if (result) {
|
|
164
|
-
c.set('authType', 'm2m');
|
|
165
|
-
c.set('m2mClaims', result.payload);
|
|
166
|
-
return next();
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
145
|
if (!session) {
|
|
171
146
|
return c.json({ error: 'Unauthorized', message: 'Invalid or expired token' }, 401);
|
|
172
147
|
}
|
|
@@ -220,12 +195,6 @@ export function requireAuth(c) {
|
|
|
220
195
|
if (authType === 'localhost') {
|
|
221
196
|
return null;
|
|
222
197
|
}
|
|
223
|
-
// Control-plane M2M tokens were verified at the middleware layer (signature
|
|
224
|
-
// + coconut_id claim). No session was minted because M2M callers aren't
|
|
225
|
-
// users, but auth is satisfied — same null-return pattern as API keys.
|
|
226
|
-
if (authType === 'm2m') {
|
|
227
|
-
return null;
|
|
228
|
-
}
|
|
229
198
|
throw new Error('Authentication required');
|
|
230
199
|
}
|
|
231
200
|
/**
|
|
@@ -238,14 +207,11 @@ export function requireAdmin(c) {
|
|
|
238
207
|
if (authEnabled === false) {
|
|
239
208
|
return null;
|
|
240
209
|
}
|
|
241
|
-
// Trusted non-session authenticators (direct localhost connection, valid
|
|
242
|
-
//
|
|
243
|
-
//
|
|
244
|
-
// without a session.role check. For M2M specifically, the `coconut_id`
|
|
245
|
-
// claim match is itself proof that the control plane intended this
|
|
246
|
-
// specific coconut — an equivalent gate to admin membership.
|
|
210
|
+
// Trusted non-session authenticators (direct localhost connection, valid API
|
|
211
|
+
// key) are authoritative: they've already passed auth at the middleware
|
|
212
|
+
// layer, so admin-gated routes accept them without a session.role check.
|
|
247
213
|
const authType = c.get('authType');
|
|
248
|
-
if (authType === 'localhost' || authType === 'apikey'
|
|
214
|
+
if (authType === 'localhost' || authType === 'apikey') {
|
|
249
215
|
return null;
|
|
250
216
|
}
|
|
251
217
|
const session = requireAuth(c);
|
|
@@ -293,6 +293,63 @@ authSettings.put('/oauth/coconut', async (c) => {
|
|
|
293
293
|
return c.json({ success: false, error: error.message || 'Failed to update Coconut OAuth' }, error.message === 'Admin access required' ? 403 : 500);
|
|
294
294
|
}
|
|
295
295
|
});
|
|
296
|
+
/**
|
|
297
|
+
* PUT /api/v1/auth-settings/control-plane
|
|
298
|
+
* Admin-only: set or clear control plane secrets persisted in auth.json.
|
|
299
|
+
*
|
|
300
|
+
* Request body:
|
|
301
|
+
* { callbackToken: string }
|
|
302
|
+
*
|
|
303
|
+
* Rules:
|
|
304
|
+
* - `callbackToken` is required and must be a string.
|
|
305
|
+
* - Non-empty values are trimmed and persisted.
|
|
306
|
+
* - Empty-string values clear the persisted token.
|
|
307
|
+
*
|
|
308
|
+
* Response intentionally never returns the raw token; it only reports whether
|
|
309
|
+
* a callback token is configured after the update.
|
|
310
|
+
*/
|
|
311
|
+
authSettings.put('/control-plane', async (c) => {
|
|
312
|
+
try {
|
|
313
|
+
requireAdmin(c);
|
|
314
|
+
const authManager = getAuthManager();
|
|
315
|
+
const config = await authManager.loadAuthConfig();
|
|
316
|
+
const body = await c.req
|
|
317
|
+
.json()
|
|
318
|
+
.catch(() => ({}));
|
|
319
|
+
if (typeof body.callbackToken !== 'string') {
|
|
320
|
+
return c.json({ success: false, error: '`callbackToken` (string) is required' }, 400);
|
|
321
|
+
}
|
|
322
|
+
const callbackToken = body.callbackToken.trim();
|
|
323
|
+
if (!config.controlPlane) {
|
|
324
|
+
config.controlPlane = {};
|
|
325
|
+
}
|
|
326
|
+
if (callbackToken) {
|
|
327
|
+
config.controlPlane.callbackToken = callbackToken;
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
delete config.controlPlane.callbackToken;
|
|
331
|
+
if (Object.keys(config.controlPlane).length === 0) {
|
|
332
|
+
delete config.controlPlane;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
await authManager.saveAuthConfig(config);
|
|
336
|
+
return c.json({
|
|
337
|
+
success: true,
|
|
338
|
+
data: {
|
|
339
|
+
controlPlane: {
|
|
340
|
+
hasCallbackToken: !!config.controlPlane?.callbackToken,
|
|
341
|
+
},
|
|
342
|
+
},
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
catch (error) {
|
|
346
|
+
console.error('Update control plane settings error:', error);
|
|
347
|
+
return c.json({
|
|
348
|
+
success: false,
|
|
349
|
+
error: error.message || 'Failed to update control plane settings',
|
|
350
|
+
}, error.message === 'Admin access required' ? 403 : 500);
|
|
351
|
+
}
|
|
352
|
+
});
|
|
296
353
|
/**
|
|
297
354
|
* PUT /api/v1/auth-settings/oauth/:provider
|
|
298
355
|
* Configure a third-party OAuth provider (admin only). Coconut OAuth has its
|
|
@@ -9,9 +9,6 @@ export declare function GET(c: Context): Promise<(Response & import("hono").Type
|
|
|
9
9
|
}, 404, "json">) | (Response & import("hono").TypedResponse<{
|
|
10
10
|
success: true;
|
|
11
11
|
data: {
|
|
12
|
-
id: string;
|
|
13
|
-
name: string;
|
|
14
|
-
status: ScheduledJobStatus;
|
|
15
12
|
schedule: {
|
|
16
13
|
type: "cron";
|
|
17
14
|
expression: string;
|
|
@@ -25,8 +22,11 @@ export declare function GET(c: Context): Promise<(Response & import("hono").Type
|
|
|
25
22
|
anchorHour?: number;
|
|
26
23
|
};
|
|
27
24
|
description?: string;
|
|
25
|
+
id: string;
|
|
26
|
+
name: string;
|
|
28
27
|
prompt: string;
|
|
29
28
|
model: string;
|
|
29
|
+
status: ScheduledJobStatus;
|
|
30
30
|
metadata: {
|
|
31
31
|
createdAt: string;
|
|
32
32
|
updatedAt: string;
|
|
@@ -40,12 +40,12 @@ export declare function GET(c: Context): Promise<(Response & import("hono").Type
|
|
|
40
40
|
mcpServers?: string[];
|
|
41
41
|
runs: {
|
|
42
42
|
id: string;
|
|
43
|
-
error?: string;
|
|
44
43
|
status: import("@lovelybunch/types").ScheduledJobRunStatus;
|
|
45
44
|
jobId: string;
|
|
46
45
|
trigger: import("@lovelybunch/types").ScheduledJobTrigger;
|
|
47
46
|
startedAt: string;
|
|
48
47
|
finishedAt?: string;
|
|
48
|
+
error?: string;
|
|
49
49
|
}[];
|
|
50
50
|
};
|
|
51
51
|
}, import("hono/utils/http-status").ContentfulStatusCode, "json">) | (Response & import("hono").TypedResponse<{
|
|
@@ -70,9 +70,6 @@ export declare function PATCH(c: Context): Promise<(Response & import("hono").Ty
|
|
|
70
70
|
}, 400, "json">) | (Response & import("hono").TypedResponse<{
|
|
71
71
|
success: true;
|
|
72
72
|
data: {
|
|
73
|
-
id: string;
|
|
74
|
-
name: string;
|
|
75
|
-
status: ScheduledJobStatus;
|
|
76
73
|
schedule: {
|
|
77
74
|
type: "cron";
|
|
78
75
|
expression: string;
|
|
@@ -86,8 +83,11 @@ export declare function PATCH(c: Context): Promise<(Response & import("hono").Ty
|
|
|
86
83
|
anchorHour?: number;
|
|
87
84
|
};
|
|
88
85
|
description?: string;
|
|
86
|
+
id: string;
|
|
87
|
+
name: string;
|
|
89
88
|
prompt: string;
|
|
90
89
|
model: string;
|
|
90
|
+
status: ScheduledJobStatus;
|
|
91
91
|
metadata: {
|
|
92
92
|
createdAt: string;
|
|
93
93
|
updatedAt: string;
|
|
@@ -101,12 +101,12 @@ export declare function PATCH(c: Context): Promise<(Response & import("hono").Ty
|
|
|
101
101
|
mcpServers?: string[];
|
|
102
102
|
runs: {
|
|
103
103
|
id: string;
|
|
104
|
-
error?: string;
|
|
105
104
|
status: import("@lovelybunch/types").ScheduledJobRunStatus;
|
|
106
105
|
jobId: string;
|
|
107
106
|
trigger: import("@lovelybunch/types").ScheduledJobTrigger;
|
|
108
107
|
startedAt: string;
|
|
109
108
|
finishedAt?: string;
|
|
109
|
+
error?: string;
|
|
110
110
|
}[];
|
|
111
111
|
};
|
|
112
112
|
}, import("hono/utils/http-status").ContentfulStatusCode, "json">) | (Response & import("hono").TypedResponse<{
|
|
@@ -11,9 +11,6 @@ export declare function withLightweightRuns<T extends {
|
|
|
11
11
|
export declare function GET(c: Context): Promise<(Response & import("hono").TypedResponse<{
|
|
12
12
|
success: true;
|
|
13
13
|
data: {
|
|
14
|
-
id: string;
|
|
15
|
-
name: string;
|
|
16
|
-
status: ScheduledJobStatus;
|
|
17
14
|
schedule: {
|
|
18
15
|
type: "cron";
|
|
19
16
|
expression: string;
|
|
@@ -27,8 +24,11 @@ export declare function GET(c: Context): Promise<(Response & import("hono").Type
|
|
|
27
24
|
anchorHour?: number;
|
|
28
25
|
};
|
|
29
26
|
description?: string;
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
30
29
|
prompt: string;
|
|
31
30
|
model: string;
|
|
31
|
+
status: ScheduledJobStatus;
|
|
32
32
|
metadata: {
|
|
33
33
|
createdAt: string;
|
|
34
34
|
updatedAt: string;
|
|
@@ -42,12 +42,12 @@ export declare function GET(c: Context): Promise<(Response & import("hono").Type
|
|
|
42
42
|
mcpServers?: string[];
|
|
43
43
|
runs: {
|
|
44
44
|
id: string;
|
|
45
|
-
error?: string;
|
|
46
45
|
status: import("@lovelybunch/types").ScheduledJobRunStatus;
|
|
47
46
|
jobId: string;
|
|
48
47
|
trigger: import("@lovelybunch/types").ScheduledJobTrigger;
|
|
49
48
|
startedAt: string;
|
|
50
49
|
finishedAt?: string;
|
|
50
|
+
error?: string;
|
|
51
51
|
}[];
|
|
52
52
|
}[];
|
|
53
53
|
}, import("hono/utils/http-status").ContentfulStatusCode, "json">) | (Response & import("hono").TypedResponse<{
|
|
@@ -66,9 +66,6 @@ export declare function POST(c: Context): Promise<(Response & import("hono").Typ
|
|
|
66
66
|
}, 400, "json">) | (Response & import("hono").TypedResponse<{
|
|
67
67
|
success: true;
|
|
68
68
|
data: {
|
|
69
|
-
id: string;
|
|
70
|
-
name: string;
|
|
71
|
-
status: ScheduledJobStatus;
|
|
72
69
|
schedule: {
|
|
73
70
|
type: "cron";
|
|
74
71
|
expression: string;
|
|
@@ -82,8 +79,11 @@ export declare function POST(c: Context): Promise<(Response & import("hono").Typ
|
|
|
82
79
|
anchorHour?: number;
|
|
83
80
|
};
|
|
84
81
|
description?: string;
|
|
82
|
+
id: string;
|
|
83
|
+
name: string;
|
|
85
84
|
prompt: string;
|
|
86
85
|
model: string;
|
|
86
|
+
status: ScheduledJobStatus;
|
|
87
87
|
metadata: {
|
|
88
88
|
createdAt: string;
|
|
89
89
|
updatedAt: string;
|
|
@@ -97,12 +97,12 @@ export declare function POST(c: Context): Promise<(Response & import("hono").Typ
|
|
|
97
97
|
mcpServers?: string[];
|
|
98
98
|
runs: {
|
|
99
99
|
id: string;
|
|
100
|
-
error?: string;
|
|
101
100
|
status: import("@lovelybunch/types").ScheduledJobRunStatus;
|
|
102
101
|
jobId: string;
|
|
103
102
|
trigger: import("@lovelybunch/types").ScheduledJobTrigger;
|
|
104
103
|
startedAt: string;
|
|
105
104
|
finishedAt?: string;
|
|
105
|
+
error?: string;
|
|
106
106
|
}[];
|
|
107
107
|
};
|
|
108
108
|
}, 201, "json">) | (Response & import("hono").TypedResponse<{
|
|
@@ -116,7 +116,7 @@ export declare function setMailStatusHandler(c: Context): Promise<(Response & im
|
|
|
116
116
|
}, import("hono/utils/http-status").ContentfulStatusCode, "json">) | (Response & import("hono").TypedResponse<{
|
|
117
117
|
success: false;
|
|
118
118
|
error: any;
|
|
119
|
-
},
|
|
119
|
+
}, 500 | 404, "json">)>;
|
|
120
120
|
/**
|
|
121
121
|
* POST /api/v1/mail/:id/reply
|
|
122
122
|
* Reply to an email
|
|
@@ -154,7 +154,7 @@ export declare function replyMailHandler(c: Context): Promise<(Response & import
|
|
|
154
154
|
}, import("hono/utils/http-status").ContentfulStatusCode, "json">) | (Response & import("hono").TypedResponse<{
|
|
155
155
|
success: false;
|
|
156
156
|
error: any;
|
|
157
|
-
},
|
|
157
|
+
}, 500 | 404, "json">)>;
|
|
158
158
|
/**
|
|
159
159
|
* POST /api/v1/mail/send
|
|
160
160
|
* Send an email (coming soon)
|
|
@@ -217,7 +217,7 @@ export declare function setMailActionHandler(c: Context): Promise<(Response & im
|
|
|
217
217
|
}, import("hono/utils/http-status").ContentfulStatusCode, "json">) | (Response & import("hono").TypedResponse<{
|
|
218
218
|
success: false;
|
|
219
219
|
error: any;
|
|
220
|
-
},
|
|
220
|
+
}, 500 | 404, "json">)>;
|
|
221
221
|
/**
|
|
222
222
|
* GET /api/v1/mail/:id/processing
|
|
223
223
|
* Get processing status and log tail for an email
|
|
@@ -13,8 +13,6 @@ import { fileURLToPath } from 'url';
|
|
|
13
13
|
import { getLogger } from '@lovelybunch/core/logging';
|
|
14
14
|
import { getLogsDir } from '@lovelybunch/core';
|
|
15
15
|
import { oauthRuntimeFromAuthConfig, setOAuthRuntimeConfig } from './config/oauth.js';
|
|
16
|
-
import { setM2MRuntimeConfig } from './config/m2m.js';
|
|
17
|
-
import { resolveCoconutId } from './lib/coconut-context.js';
|
|
18
16
|
import { getAuthManager } from './lib/auth/auth-manager.js';
|
|
19
17
|
const __filename = fileURLToPath(import.meta.url);
|
|
20
18
|
const __dirname = path.dirname(__filename);
|
|
@@ -325,23 +323,6 @@ export async function startServer(options = {}) {
|
|
|
325
323
|
catch {
|
|
326
324
|
setOAuthRuntimeConfig({ enabled: false });
|
|
327
325
|
}
|
|
328
|
-
// Populate the M2M runtime cache from resolveCoconutId() (env → .nut/config.json).
|
|
329
|
-
// Enables control-plane Bearer auth only when this coconut has a resolvable
|
|
330
|
-
// ID; unprovisioned / standalone coconuts get enabled: false and fall through
|
|
331
|
-
// to existing auth paths unchanged.
|
|
332
|
-
try {
|
|
333
|
-
const coconutId = await resolveCoconutId();
|
|
334
|
-
if (coconutId) {
|
|
335
|
-
setM2MRuntimeConfig({ enabled: true, coconutId });
|
|
336
|
-
vlog(`[m2m] Control-plane Bearer auth enabled for coconut ${coconutId}`);
|
|
337
|
-
}
|
|
338
|
-
else {
|
|
339
|
-
setM2MRuntimeConfig({ enabled: false });
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
catch {
|
|
343
|
-
setM2MRuntimeConfig({ enabled: false });
|
|
344
|
-
}
|
|
345
326
|
vlog(`Starting server on ${host}:${port}...`);
|
|
346
327
|
const server = serve({
|
|
347
328
|
fetch: app.fetch,
|
package/dist/server.js
CHANGED
|
@@ -12,8 +12,6 @@ import fs from 'fs';
|
|
|
12
12
|
import { getLogger } from '@lovelybunch/core/logging';
|
|
13
13
|
import { getLogsDir } from '@lovelybunch/core';
|
|
14
14
|
import { oauthRuntimeFromAuthConfig, setOAuthRuntimeConfig } from './config/oauth.js';
|
|
15
|
-
import { setM2MRuntimeConfig } from './config/m2m.js';
|
|
16
|
-
import { resolveCoconutId } from './lib/coconut-context.js';
|
|
17
15
|
import { getAuthManager } from './lib/auth/auth-manager.js';
|
|
18
16
|
const __filename = fileURLToPath(import.meta.url);
|
|
19
17
|
const __dirname = path.dirname(__filename);
|
|
@@ -248,21 +246,6 @@ try {
|
|
|
248
246
|
catch {
|
|
249
247
|
setOAuthRuntimeConfig({ enabled: false });
|
|
250
248
|
}
|
|
251
|
-
// Populate the M2M runtime cache for control-plane Bearer auth. See
|
|
252
|
-
// server-with-static.ts for the full rationale.
|
|
253
|
-
try {
|
|
254
|
-
const coconutId = await resolveCoconutId();
|
|
255
|
-
if (coconutId) {
|
|
256
|
-
setM2MRuntimeConfig({ enabled: true, coconutId });
|
|
257
|
-
console.log(`[m2m] Control-plane Bearer auth enabled for coconut ${coconutId}`);
|
|
258
|
-
}
|
|
259
|
-
else {
|
|
260
|
-
setM2MRuntimeConfig({ enabled: false });
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
catch {
|
|
264
|
-
setM2MRuntimeConfig({ enabled: false });
|
|
265
|
-
}
|
|
266
249
|
// Start server
|
|
267
250
|
const port = process.env.PORT ? parseInt(process.env.PORT) : 3001;
|
|
268
251
|
console.log(`Starting server on port ${port}...`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lovelybunch/api",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.78-alpha.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/server-with-static.js",
|
|
6
6
|
"exports": {
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"sharp": "^0.33.5",
|
|
41
41
|
"ws": "^8.18.0",
|
|
42
42
|
"zod": "^3.23.0",
|
|
43
|
-
"@lovelybunch/core": "1.0.
|
|
44
|
-
"@lovelybunch/types": "1.0.
|
|
45
|
-
"@lovelybunch/mcp": "1.0.
|
|
43
|
+
"@lovelybunch/core": "1.0.78-alpha.0",
|
|
44
|
+
"@lovelybunch/types": "1.0.78-alpha.0",
|
|
45
|
+
"@lovelybunch/mcp": "1.0.78-alpha.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/adm-zip": "^0.5.7",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,A as p,j as e,v,bN as y,B as N,n as w,C as b}from"./index-
|
|
1
|
+
import{r as a,A as p,j as e,v,bN as y,B as N,n as w,C as b}from"./index-C0uIENKu.js";import{C as c,a as d,b as k,c as C}from"./card-CEBVsJGA.js";import{B as m}from"./badge-CEhr50DH.js";import{R as E}from"./refresh-cw-BPr-EVyC.js";const A=5e3;function $(){const[n,o]=a.useState([]),[i,x]=a.useState(!0),[h,u]=a.useState(new Set),l=a.useCallback(async()=>{x(!0);try{const s=await fetch(`${p}/api/v1/events?limit=${A}`);if(!s.ok)throw new Error("Failed to load events");const t=await s.json();o(Array.isArray(t.items)?[...t.items].reverse():[])}catch(s){console.error("Failed to load events:",s),o([])}finally{x(!1)}},[]),g=a.useCallback(s=>{u(t=>{const r=new Set(t);return r.has(s)?r.delete(s):r.add(s),r})},[]);a.useEffect(()=>{l()},[l]);const f=s=>{if(!s)return"Unknown time";try{return new Date(s).toLocaleString()}catch{return s}},j=s=>{switch(s?.toLowerCase()){case"error":return"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200";case"warn":case"warning":return"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200";case"info":return"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200";case"debug":return"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200";default:return"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200"}};return i?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Activity"}),e.jsx("p",{className:"text-muted-foreground",children:"View system activity and events"})]}),e.jsx(c,{children:e.jsx(d,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(v,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading events..."})]})})})]}):n.length===0?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Activity"}),e.jsx("p",{className:"text-muted-foreground",children:"View system activity and events"})]}),e.jsx(c,{children:e.jsx(d,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx(y,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No Events Found"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Activity events will appear here as they occur."})]})})})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Activity"}),e.jsxs("p",{className:"text-muted-foreground",children:["View system activity and events (",n.length," events)"]})]}),e.jsxs(N,{variant:"outline",size:"sm",onClick:()=>void l(),disabled:i,children:[e.jsx(E,{className:`h-4 w-4 mr-2 ${i?"animate-spin":""}`}),"Refresh"]})]}),e.jsx("div",{className:"space-y-3",children:n.map(s=>{const t=h.has(s.seq);return e.jsxs(c,{className:"transition-colors",children:[e.jsx(k,{className:"py-3 cursor-pointer hover:bg-muted/30",onClick:()=>g(s.seq),children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex items-start gap-2 flex-1 min-w-0",children:[t?e.jsx(w,{className:"h-4 w-4 mt-0.5 text-muted-foreground shrink-0"}):e.jsx(b,{className:"h-4 w-4 mt-0.5 text-muted-foreground shrink-0"}),e.jsxs("div",{className:"space-y-1 flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs(C,{className:"text-sm font-medium",children:["#",s.seq]}),s.kind&&e.jsx(m,{variant:"outline",className:"text-xs",children:s.kind}),s.level&&e.jsx(m,{className:`text-xs ${j(s.level)}`,children:s.level})]}),s.message&&e.jsx("p",{className:`text-sm text-muted-foreground ${t?"":"truncate"}`,children:s.message})]})]}),e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:f(s.ts)})]})}),t&&e.jsx(d,{className:"pt-0 pb-4",children:e.jsx("pre",{className:"text-xs bg-muted p-3 rounded-md overflow-x-auto",children:JSON.stringify(s,null,2)})})]},s.seq)})})]})}export{$ as default};
|
package/static/assets/{AgentsContextEditPage-CegcDIbc.js → AgentsContextEditPage-Xh10BIpD.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{u as p,a as j,r as n,A as l,j as e,B as h,L as v,a5 as N}from"./index-
|
|
1
|
+
import{u as p,a as j,r as n,A as l,j as e,B as h,L as v,a5 as N}from"./index-C0uIENKu.js";import{C as m,a as x,b as C,c as S}from"./card-CEBVsJGA.js";import{M as w}from"./markdown-editor-MQ7X6BHT.js";import{A as y}from"./arrow-left-CrE2UamQ.js";import{C as A}from"./circle-check-big-DW9BPHOx.js";import"./index-4_sGNb1Z.js";function F(){const f=p(),{toast:t}=j(),[a,i]=n.useState(""),[g,r]=n.useState(!0),[o,c]=n.useState(!1);n.useEffect(()=>{fetch(`${l}/api/v1/context/agents`).then(s=>s.json()).then(s=>{s.success&&i(s.document.content.trim()),r(!1)}).catch(s=>{console.error("Failed to load context:",s),t({title:"Error",description:"Failed to load agents definition",variant:"destructive"}),r(!1)})},[t]);const u=async()=>{c(!0);try{const d=await(await fetch(`${l}/api/v1/context/agents`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:a,metadata:{}})})).json();if(d.success)t({title:"Success",description:"Agents definition saved successfully",action:e.jsx(A,{className:"h-4 w-4"})}),f("/context/agents");else throw new Error(d.error||"Failed to save")}catch(s){console.error("Save error:",s),t({title:"Error",description:"Failed to save agents definition",variant:"destructive"})}finally{c(!1)}};return g?e.jsx("div",{className:"space-y-6",children:e.jsx(m,{children:e.jsx(x,{className:"pt-6",children:e.jsx("div",{className:"text-center",children:e.jsx("p",{children:"Loading..."})})})})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Edit Agents Definition"}),e.jsx("p",{className:"text-muted-foreground text-sm hidden sm:block",children:"Define agents, their capabilities, and configurations"})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(h,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(v,{to:"/context/agents",className:"text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(y,{className:"w-4 h-4"})})}),e.jsxs(h,{onClick:u,disabled:o,size:"sm",children:[e.jsx(N,{className:"w-4 h-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:o?"Saving...":"Save"})]})]})]}),e.jsxs(m,{children:[e.jsx(C,{children:e.jsx(S,{children:"Agents Documentation"})}),e.jsx(x,{children:e.jsx(w,{value:a,onChange:s=>i(s||""),placeholder:`Write your agents definition in markdown...
|
|
2
2
|
|
|
3
3
|
## Agent Definitions
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as g,r as t,A as N,j as e,v,az as C,B as a,L as d,a2 as l,M as w,ay as y,au as E}from"./index-
|
|
1
|
+
import{a as g,r as t,A as N,j as e,v,az as C,B as a,L as d,a2 as l,M as w,ay as y,au as E}from"./index-C0uIENKu.js";import{C as i,a as c,b}from"./card-CEBVsJGA.js";import{c as A}from"./clipboard-B9ndUJKl.js";function D(){const{toast:r}=g(),[o,m]=t.useState(null),[x,h]=t.useState(!0),[u,n]=t.useState(!1);t.useEffect(()=>{fetch(`${N}/api/v1/context/agents`).then(s=>{if(s.ok)return s.json();throw new Error("Not found")}).then(s=>{s.success?(m(s.document),n(!0)):n(!1)}).catch(()=>{n(!1)}).finally(()=>{h(!1)})},[]);const p=async()=>{const s=".nut/context/agents.md";try{await A(s),r({title:"Copied!",description:`Path ${s} copied to clipboard`})}catch(f){console.error("Failed to copy path:",f),r({title:"Error",description:"Failed to copy path to clipboard",variant:"destructive"})}},j=()=>{const s=new CustomEvent("discuss-in-chat",{detail:{type:"context",id:"agents-md",filename:"agents.md",name:"agents.md",path:".nut/context/agents.md"}});window.dispatchEvent(s)};return x?e.jsx("div",{className:"space-y-6",children:e.jsx(i,{children:e.jsx(c,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(v,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading agents definition..."})]})})})}):!u||!o?e.jsx("div",{className:"space-y-6",children:e.jsx(i,{children:e.jsx(c,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx(C,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No Agents Definition Found"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Agents definition will appear here once created."}),e.jsx(a,{className:"mt-4",asChild:!0,children:e.jsxs(d,{to:"/context/agents/edit",children:[e.jsx(l,{className:"h-4 w-4 mr-2"}),"Create Agents Definition"]})})]})})})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Agents"}),e.jsx("p",{className:"text-muted-foreground",children:"Agent definitions and configurations"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(a,{variant:"outline",size:"sm",onClick:j,children:[e.jsx(w,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Discuss"})]}),e.jsxs(a,{variant:"outline",size:"sm",onClick:p,children:[e.jsx(y,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Copy Path"})]}),e.jsx(a,{size:"sm",asChild:!0,children:e.jsxs(d,{to:"/context/agents/edit",children:[e.jsx(l,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit"})]})})]})]}),e.jsxs(i,{children:[e.jsx(b,{className:"pb-0"}),e.jsx(c,{children:e.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:e.jsx(E,{children:o.content||"No content available"})})})]})]})}export{D as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as R,r as t,E as y,j as e,B as a,P as X,bH as Y,Q as J,D as j,b as g,d as v,f,g as A,I as F,a1 as N,ai as Q,w as i}from"./index-
|
|
1
|
+
import{t as R,r as t,E as y,j as e,B as a,P as X,bH as Y,Q as J,D as j,b as g,d as v,f,g as A,I as F,a1 as N,ai as Q,w as i}from"./index-C0uIENKu.js";import{C as W,b as G,c as V,d as Z,a as _}from"./card-CEBVsJGA.js";import{L as w}from"./label-DXN216Ba.js";import{B as ee}from"./badge-CEhr50DH.js";import{A as I,a as C}from"./alert-CKLRmrya.js";import{I as L}from"./info-CMb2giNJ.js";import{C as se}from"./circle-alert-DbwPGG3s.js";function oe(){const{authEnabled:n}=R(),[P,k]=t.useState([]),[b,K]=t.useState(!0),[O,l]=t.useState(!1),[M,d]=t.useState(!1),[x,D]=t.useState(""),[h,E]=t.useState("never"),[c,S]=t.useState(null),[m,o]=t.useState(null);t.useEffect(()=>{p()},[]);const p=async()=>{K(!0);try{const s=await y("/api/v1/api-keys");s.success&&k(s.data?.apiKeys||[])}catch(s){console.error("Failed to load API keys:",s),k([])}finally{K(!1)}},U=async()=>{if(!x.trim()){i({title:"Error",description:"Please provide a name for the API key",variant:"destructive"});return}try{const s={name:x,scopes:["*"]};h!=="never"&&(s.expiresIn=h);const r=await y("/api/v1/api-keys",{method:"POST",body:JSON.stringify(s)});r.success&&(S(r.data),l(!1),d(!0),D(""),E("never"),await p(),i({title:"API Key Created",description:"Make sure to copy your API key now. You won't be able to see it again!"}))}catch(s){console.error("Failed to create API key:",s),i({title:"Error",description:"Failed to create API key",variant:"destructive"})}},B=async s=>{try{(await y(`/api/v1/api-keys/${s}`,{method:"DELETE"})).success&&(await p(),o(null),i({title:"API Key Deleted",description:"The API key has been permanently deleted"}))}catch(r){console.error("Failed to delete API key:",r),i({title:"Error",description:"Failed to delete API key",variant:"destructive"})}},H=async s=>{try{await navigator.clipboard.writeText(s),i({title:"Copied",description:"API key copied to clipboard"})}catch{i({title:"Error",description:"Failed to copy to clipboard",variant:"destructive"})}},u=s=>new Date(s).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),$=s=>s?new Date(s)<new Date:!1,q=typeof window<"u"?window.location.origin:"http://localhost:3000",z=c?`curl -H "X-API-Key: ${c.key}" \\
|
|
2
2
|
+ ${q}/api/v1/tasks`:"",T=n?null:e.jsxs(I,{children:[e.jsx(L,{className:"h-4 w-4"}),e.jsxs(C,{children:["Authentication is currently disabled. API keys will only be required once you enable authentication in the ",e.jsx("a",{href:"/settings/authentication",className:"underline",children:"Authentication settings"}),"."]})]});return!n&&b?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"API Keys"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage API keys for programmatic access"})]}),T]}):b?e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"API Keys"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."})]})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"API Keys"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage API keys for programmatic access to your Coconut instance"})]}),T,n&&e.jsxs(I,{children:[e.jsx(L,{className:"h-4 w-4"}),e.jsxs(C,{children:["API keys provide programmatic access to your Coconut instance. Use them in CI/CD pipelines or automation scripts by including the key in the ",e.jsx("code",{className:"bg-muted px-1 py-0.5 rounded",children:"X-API-Key"})," header."]})]}),e.jsxs(W,{children:[e.jsx(G,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(V,{children:"Active API Keys"}),e.jsx(Z,{children:"API keys you've created for programmatic access"})]}),e.jsxs(a,{onClick:()=>l(!0),disabled:!n,children:[e.jsx(X,{className:"mr-2 h-4 w-4"}),"Create API Key"]})]})}),e.jsx(_,{children:P.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(Y,{className:"h-12 w-12 mx-auto mb-4 opacity-20"}),e.jsx("p",{children:"No API keys yet"}),e.jsx("p",{className:"text-sm",children:"Create an API key to get started with programmatic access"})]}):e.jsx("div",{className:"space-y-4",children:P.map(s=>e.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("p",{className:"font-medium",children:s.name}),$(s.expiresAt)&&e.jsx(ee,{variant:"destructive",children:"Expired"})]}),e.jsx("p",{className:"text-sm text-muted-foreground font-mono",children:s.keyPreview}),e.jsxs("div",{className:"flex items-center gap-4 mt-2 text-xs text-muted-foreground",children:[e.jsxs("span",{children:["Created: ",u(s.createdAt)]}),s.expiresAt&&e.jsxs("span",{children:["Expires: ",u(s.expiresAt)]}),s.lastUsedAt&&e.jsxs("span",{children:["Last used: ",u(s.lastUsedAt)]})]})]}),e.jsx(a,{variant:"ghost",size:"icon",onClick:()=>o(s.id),children:e.jsx(J,{className:"h-4 w-4 text-destructive"})})]},s.id))})})]}),e.jsx(j,{open:O,onOpenChange:l,children:e.jsxs(g,{children:[e.jsxs(v,{children:[e.jsx(f,{children:"Create API Key"}),e.jsx(A,{children:"Create a new API key for programmatic access. The key will only be shown once."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{htmlFor:"keyName",children:"Name"}),e.jsx(F,{id:"keyName",placeholder:"CI/CD Pipeline",value:x,onChange:s=>D(s.target.value)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"A descriptive name to identify this API key"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{htmlFor:"keyExpiry",children:"Expiration"}),e.jsxs("select",{id:"keyExpiry",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:h,onChange:s=>E(s.target.value),children:[e.jsx("option",{value:"never",children:"Never"}),e.jsx("option",{value:"30d",children:"30 days"}),e.jsx("option",{value:"90d",children:"90 days"}),e.jsx("option",{value:"1y",children:"1 year"})]})]})]}),e.jsxs(N,{children:[e.jsx(a,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(a,{onClick:U,disabled:!n,children:"Create API Key"})]})]})}),e.jsx(j,{open:M,onOpenChange:d,children:e.jsxs(g,{className:"sm:max-w-[600px]",children:[e.jsxs(v,{children:[e.jsx(f,{children:"API Key Created"}),e.jsx(A,{children:"Make sure to copy your API key now. You won't be able to see it again!"})]}),e.jsxs(I,{variant:"destructive",className:"my-4",children:[e.jsx(se,{className:"h-4 w-4"}),e.jsx(C,{children:"This is the only time you will see this key. Store it securely."})]}),c&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{children:"API Key"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(F,{readOnly:!0,value:c.key,className:"font-mono text-sm"}),e.jsx(a,{variant:"outline",size:"icon",onClick:()=>H(c.key),children:e.jsx(Q,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[e.jsx("p",{className:"mb-2",children:"Usage example:"}),e.jsx("pre",{className:"bg-muted p-3 rounded-md whitespace-pre-wrap break-words",children:e.jsx("code",{className:"font-mono text-xs",children:z})})]})]}),e.jsx(N,{children:e.jsx(a,{onClick:()=>{d(!1),S(null)},children:"I've Saved My Key"})})]})}),e.jsx(j,{open:!!m,onOpenChange:s=>!s&&o(null),children:e.jsxs(g,{children:[e.jsxs(v,{children:[e.jsx(f,{children:"Delete API Key"}),e.jsx(A,{children:"Are you sure you want to delete this API key? This action cannot be undone and any scripts using this key will stop working."})]}),e.jsxs(N,{children:[e.jsx(a,{variant:"outline",onClick:()=>o(null),children:"Cancel"}),e.jsx(a,{variant:"destructive",onClick:()=>m&&B(m),children:"Delete API Key"})]})]})})]})}export{oe as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as te,t as me,r as n,E as l,j as e,bB as _,i as H,D as q,a0 as z,B as d,b as B,d as Y,f as K,g as Q,I as x,a1 as G,J as ge,N as je,Q as pe,R as ve,U as fe,V as we,W as ye,Y as Ce,_ as Ne,$ as Se,w as r}from"./index-
|
|
1
|
+
import{c as te,t as me,r as n,E as l,j as e,bB as _,i as H,D as q,a0 as z,B as d,b as B,d as Y,f as K,g as Q,I as x,a1 as G,J as ge,N as je,Q as pe,R as ve,U as fe,V as we,W as ye,Y as Ce,_ as Ne,$ as Se,w as r}from"./index-C0uIENKu.js";import{C as m,b as g,c as j,d as p,a as v}from"./card-CEBVsJGA.js";import{L as c}from"./label-DXN216Ba.js";import{S as X,a as Z,b as ee,c as se,d as a}from"./select-BLUGdloJ.js";import{S as N}from"./switch-DwGQE3tG.js";import{B as F}from"./badge-CEhr50DH.js";import{C as be}from"./circle-alert-DbwPGG3s.js";import"./index-4_sGNb1Z.js";import"./chevron-up-CLuT-8K8.js";/**
|
|
2
2
|
* @license lucide-react v0.542.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as m,j as e,v as x,A as f}from"./index-
|
|
1
|
+
import{r as m,j as e,v as x,A as f}from"./index-C0uIENKu.js";import{C as w}from"./circle-check-DoS8t4b0.js";import{C as b}from"./circle-x-D0FfNqWc.js";const r="coconut/github-auth-state";function j(s){try{window.opener&&window.opener.postMessage({type:"github-auth",...s},window.location.origin)}catch{}}const y=()=>{const[s,d]=m.useState("pending"),[h,p]=m.useState("Authorizing GitHub…");return m.useEffect(()=>{const a=new URLSearchParams(window.location.search),u=a.get("error"),l=a.get("token"),n=a.get("expires_at")||a.get("expiresAt"),c=a.get("state"),o=t=>{j(t),d(t.success?"success":"error"),p(t.message),setTimeout(()=>{try{window.close()}catch{}},1200)};if(u){localStorage.removeItem(r),o({success:!1,message:decodeURIComponent(u)});return}if(!l||!n||!c){localStorage.removeItem(r),o({success:!1,message:"Missing authorization parameters. Please try again."});return}const g=localStorage.getItem(r);if(!g||g!==c){localStorage.removeItem(r),o({success:!1,message:"Authorization state mismatch. Please start again."});return}(async()=>{try{const t=await fetch(`${f}/api/v1/git/providers/github/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:l,expiresAt:n,state:c})}),i=await t.json();if(!t.ok||!i.success)throw new Error(i?.error?.message||"Failed to store GitHub token");localStorage.removeItem(r),o({success:!0,message:"GitHub connected successfully!",expiresAt:i.data?.expiresAt||n})}catch(t){localStorage.removeItem(r),o({success:!1,message:t?.message||"Failed to store GitHub token. Please try again."})}})()},[]),e.jsx("div",{className:"flex h-screen items-center justify-center bg-background px-6",children:e.jsxs("div",{className:"max-w-sm rounded-lg border bg-card p-6 text-center shadow-sm",children:[e.jsxs("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted",children:[s==="pending"&&e.jsx(x,{className:"h-6 w-6 animate-spin text-muted-foreground"}),s==="success"&&e.jsx(w,{className:"h-6 w-6 text-green-600"}),s==="error"&&e.jsx(b,{className:"h-6 w-6 text-red-600"})]}),e.jsx("h1",{className:"text-lg font-semibold",children:"GitHub Authorization"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:h}),s!=="pending"&&e.jsx("p",{className:"mt-4 text-xs text-muted-foreground",children:"You can close this window and return to Coconut."})]})})};export{y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as E,x as S,t as j,r as i,j as e,v,y as p,z as y,E as C,O as k,w as N}from"./index-
|
|
1
|
+
import{u as E,x as S,t as j,r as i,j as e,v,y as p,z as y,E as C,O as k,w as N}from"./index-C0uIENKu.js";function I(){const c=E(),[a]=S(),{oauth:t,refreshUser:u,isLoading:l}=j(),[w,r]=i.useState("working"),[b,s]=i.useState(null),d=i.useRef(!1);return i.useEffect(()=>{if(d.current||l)return;d.current=!0,(async()=>{const g=a.get("code"),h=a.get("error");if(h){r("error"),s(a.get("error_description")||h);return}if(!g){r("error"),s("Missing authorization code in callback URL");return}if(!t.enabled||!t.clientId||!t.issuer){r("error"),s("OAuth is not enabled on this coconut");return}let o=null;try{o=sessionStorage.getItem(p)}catch{o=null}if(!o){r("error"),s("Missing PKCE verifier - please start sign-in again");return}try{const n=await y({issuer:t.issuer,clientId:t.clientId,code:g,verifier:o});if(!n.id_token)throw new Error('Clerk did not return an id_token (is the "openid" scope registered for this client?)');const m=await C("/api/v1/auth/oauth/exchange",{method:"POST",body:JSON.stringify({idToken:n.id_token})});if(!m.success)throw new Error(m.error||"Server rejected OAuth token");try{sessionStorage.removeItem(p)}catch{}await u();let f="/";try{const x=sessionStorage.getItem(k);x&&(sessionStorage.removeItem(k),f=x)}catch{}N({title:"Welcome back",description:"Signed in with Coconut"}),c(f,{replace:!0})}catch(n){console.error("OAuth callback failed:",n),r("error"),s(n?.message||"OAuth callback failed")}})()},[l,c,t,u,a]),e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-background to-muted p-4",children:e.jsx("div",{className:"max-w-sm text-center space-y-4",children:w==="working"?e.jsxs(e.Fragment,{children:[e.jsx(v,{className:"h-8 w-8 animate-spin text-muted-foreground mx-auto"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Finishing sign-in with Coconut..."})]}):e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"text-lg font-semibold",children:"Sign-in failed"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:b||"Something went wrong completing OAuth sign-in."}),e.jsx("button",{type:"button",className:"text-sm underline",onClick:()=>c("/login",{replace:!0}),children:"Back to login"})]})})})}export{I as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{u as ce,a as de,r as i,j as e,B as r,T as oe,n as M,X as me,F as xe,a2 as he,D as ue,b as fe,d as pe,f as je,k as ge,a8 as B,a9 as R,aa as H,ab as L,ac as O,ad as G,o as ve,A as T}from"./index-CJjOSL3x.js";import{C as g,b as Ne,a as _,c as ye}from"./card-ClTppZkC.js";import{B as U}from"./badge-CnihwoO_.js";import{u as we}from"./use-terminal-C8IG41zB.js";import{T as Se}from"./terminal-preview-BpviO4IZ.js";import{S as Ce,a as be,b as ke,c as Ae,d as w}from"./select-Cft45rTz.js";import{b as De,e as Me,d as Te,c as Ie,a as $e}from"./pipeline-builders-DrEjlsbH.js";import{R as Ee}from"./refresh-cw-4aDPS4Ma.js";import{C as Pe,a as ze}from"./chevrons-up-CaytjQin.js";import{P as Fe}from"./play-dMLqfItH.js";import{C as Be}from"./code-BlCNWFR0.js";import{C as Re}from"./chevron-up-DmV7RyoW.js";import{S as He}from"./server-RIrco6rM.js";import"./xterm-DTxiCjtJ.js";import"./index-CBMKhVK-.js";const Le=c=>c?Array.isArray(c)?c.filter(x=>typeof x=="string").map(x=>x.trim()).filter(Boolean):typeof c=="string"?c.split(",").map(x=>x.trim()).filter(Boolean):[]:[];function ts(){const c=ce(),{sessions:x,loading:b,error:I,refreshSessions:S,createSession:V,destroySession:K}=we(),{toast:v}=de(),[$,W]=i.useState([]),[q,X]=i.useState(!0),[j,k]=i.useState(()=>({})),[A,N]=i.useState(!1),[f,J]=i.useState("claude"),[E,Q]=i.useState(""),[D,P]=i.useState(!1),[h,Y]=i.useState([]),[p,y]=i.useState([]),[Z,ee]=i.useState({}),[u,se]=i.useState([]),[o,C]=i.useState([]),te=s=>{const t=Date.now(),a=new Date(s).getTime(),n=Math.max(0,Math.floor((t-a)/1e3));if(n<60)return`${n}s ago`;const d=Math.floor(n/60);if(d<60)return`${d}m ago`;const l=Math.floor(d/60);return l<24?`${l}h ago`:`${Math.floor(l/24)}d ago`};i.useEffect(()=>{(async()=>{try{const t=await fetch(`${T}/api/v1/tasks`);if(t.ok){const a=await t.json(),n=a.data||a;W(Array.isArray(n)?n:[])}}catch(t){console.error("Error loading tasks:",t)}finally{X(!1)}})()},[]),i.useEffect(()=>{S()},[S]),i.useEffect(()=>{if(!A)return;(async()=>{try{const t=await fetch(`${T}/api/v1/mcp`);if(t.ok){const a=await t.json();a?.success&&Array.isArray(a.servers)&&(Y(a.servers),y(n=>n.filter(d=>a.servers.includes(d))),a.mcpServers&&typeof a.mcpServers=="object"&&ee(a.mcpServers))}}catch(t){console.error("Failed to load MCP servers",t)}try{const t=await fetch(`${T}/api/v1/skills`);if(t.ok){const a=await t.json(),d=(Array.isArray(a?.documents)?a.documents:[]).map(l=>({id:l.id,name:l?.metadata?.name||l.id,mcpServers:Le(l?.metadata?.metadata?.mcpServers)}));se(d),C(l=>l.filter(F=>d.some(le=>le.id===F)))}}catch(t){console.error("Failed to load skills",t)}})()},[A]),i.useEffect(()=>{o.length!==0&&y(s=>{const t=new Set(s),a=h.length>0?new Set(h):void 0;return o.forEach(n=>{const d=u.find(l=>l.id===n);d&&d.mcpServers.forEach(l=>{(!a||a.has(l))&&t.add(l)})}),Array.from(t)})},[o,u,h]);const m=i.useMemo(()=>x.filter(s=>s.taskId?.startsWith("cp-")||s.taskId?.startsWith("ag-")).sort((s,t)=>new Date(t.lastActivity).getTime()-new Date(s.lastActivity).getTime()),[x]);i.useEffect(()=>{k(s=>{const t={...s};return m.forEach(a=>{a.id in t||(t[a.id]=!0)}),t})},[m]);const z=i.useMemo(()=>$.filter(s=>s.status==="draft"||s.status==="ready").sort((s,t)=>new Date(t.metadata.createdAt).getTime()-new Date(s.metadata.createdAt).getTime()).slice(0,3),[$]),ae=()=>{const s=m.every(a=>j[a.id]),t={};m.forEach(a=>{t[a.id]=!s}),k(t)},ie=m.length>0&&m.every(s=>j[s.id]),ne=async s=>{await K(s)?(v({title:"Session closed",description:s}),setTimeout(()=>S(),100)):v({title:"Failed to close session",description:s,variant:"destructive"})},re=async()=>{P(!0);try{const s=`session-${Date.now()}`,t={taskId:s,contextType:"change-task",cliAgent:f,mcpServersMap:Z,selectedMcpServers:p,skills:u,selectedSkillIds:o,automationEnabled:!1,customInstruction:E.trim(),includeDefaultInstructions:!1};let a="";f==="claude"?a=De(t):f==="gemini"?a=Me(t):f==="codex"?a=Te(t):f==="droid"?a=Ie(t):f==="kiro"&&(a=$e(t)),await V(s,a)?(v({title:"Coding session started",description:`Session ${s} created`}),N(!1),c(`/terminal/${s}`)):v({title:"Failed to start session",description:"Could not create terminal session",variant:"destructive"})}catch(s){console.error("Error starting coding session:",s),v({title:"Error",description:"Failed to start coding session",variant:"destructive"})}finally{P(!1)}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Agents"}),e.jsx("p",{className:"text-muted-foreground hidden sm:block",children:"Manage agents and their active sessions"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(r,{variant:"outline",size:"sm",onClick:()=>S(),disabled:b,children:[e.jsx(Ee,{className:`h-4 w-4 sm:mr-2 ${b?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline",children:"Refresh"})]}),m.length>0&&e.jsx(r,{variant:"outline",size:"sm",onClick:ae,children:ie?e.jsxs(e.Fragment,{children:[e.jsx(Pe,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Hide All"})]}):e.jsxs(e.Fragment,{children:[e.jsx(ze,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Show All"})]})}),e.jsxs(r,{size:"sm",onClick:()=>N(!0),children:[e.jsx(Fe,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Interactive Session"})]})]})]}),I&&e.jsx("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg",children:e.jsx("div",{className:"text-red-600",children:I})}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Sessions"}),b?e.jsx("div",{className:"space-y-2",children:[...Array(2)].map((s,t)=>e.jsx(g,{className:"p-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-4 w-4 rounded bg-muted animate-pulse"}),e.jsxs("div",{children:[e.jsx("div",{className:"h-4 w-40 bg-muted rounded animate-pulse mb-2"}),e.jsx("div",{className:"h-3 w-24 bg-muted rounded animate-pulse"})]})]}),e.jsx("div",{className:"h-6 w-20 bg-muted rounded animate-pulse"})]})},t))}):m.length===0?e.jsx(g,{className:"p-8",children:e.jsxs("div",{className:"flex flex-col items-center justify-center text-center space-y-3",children:[e.jsx(Be,{className:"h-12 w-12 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-lg mb-2",children:"No active sessions"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Get started by launching an"," ",e.jsx("button",{onClick:()=>N(!0),className:"text-primary hover:underline font-medium",children:"Interactive Session"})," ","or working on a"," ",e.jsx("button",{onClick:()=>c("/tasks"),className:"text-primary hover:underline font-medium",children:"New Task"})]})]})]})}):e.jsx("div",{className:"space-y-2",children:m.slice(0,10).map(s=>e.jsxs(g,{className:"p-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(oe,{className:"h-4 w-4 shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-medium text-sm",children:s.taskId}),e.jsxs("div",{className:"text-xs text-gray-500",children:["Session ",s.id.split("-").slice(-1)[0].substring(0,8)," • Last activity ",te(s.lastActivity)]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("div",{className:`flex items-center gap-1 ${s.connected?"text-green-600":"text-gray-400"}`,title:s.connected?"Connected":"Disconnected",children:e.jsx("div",{className:`w-2 h-2 rounded-full ${s.connected?"bg-green-500":"bg-gray-400"}`})}),e.jsx(r,{size:"sm",variant:"outline",onClick:()=>{k(t=>({...t,[s.id]:!t[s.id]}))},"aria-label":j[s.id]?"Hide preview":"Show preview",title:j[s.id]?"Hide preview":"Show preview",children:j[s.id]?e.jsx(Re,{className:"h-4 w-4"}):e.jsx(M,{className:"h-4 w-4"})}),e.jsx(r,{size:"sm",variant:"outline",onClick:()=>c(`/terminal/${s.taskId}`),children:"Open"}),e.jsx(r,{size:"icon",variant:"destructive",onClick:()=>ne(s.id),title:"Close session","aria-label":"Close session",children:e.jsx(me,{className:"h-4 w-4"})})]})]}),j[s.id]&&e.jsx("div",{className:"mt-2 w-full p-2 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>c(`/terminal/${s.taskId}`),title:"Click to open full terminal session",children:e.jsx(Se,{sessionId:s.id,heightPx:160,maxScrollback:200})})]},s.id))})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"New Tasks"}),q?e.jsx("div",{className:"space-y-3",children:[...Array(3)].map((s,t)=>e.jsx(g,{children:e.jsx(Ne,{className:"py-3",children:e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 bg-muted rounded w-2/3 animate-pulse"}),e.jsx("div",{className:"h-3 bg-muted rounded w-1/3 animate-pulse"})]}),e.jsx("div",{className:"h-5 bg-muted rounded w-16 animate-pulse"})]})})},t))}):z.length===0?e.jsx(g,{children:e.jsx(_,{className:"flex items-center justify-center py-6",children:e.jsx("div",{className:"text-center text-sm text-gray-500",children:"No draft or approved tasks found"})})}):e.jsx("div",{className:"space-y-2",children:z.map(s=>e.jsx(g,{className:"hover:shadow-md transition-all cursor-pointer hover:border-primary/50",onClick:()=>c(`/terminal/${s.id}`),children:e.jsx(_,{className:"py-4",children:e.jsx("div",{className:"flex justify-between items-start gap-4",children:e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(ye,{className:"text-base leading-tight",children:s.title||s.intent}),e.jsxs("div",{className:"flex gap-1 ml-3 flex-shrink-0",children:[s.priority&&e.jsx(U,{variant:s.priority==="high"||s.priority==="critical"?"destructive":s.priority==="medium"?"secondary":"outline",className:"text-xs",children:s.priority}),e.jsx(U,{variant:"default",className:"text-xs",children:s.status})]})]}),s.content&&e.jsxs("div",{className:"text-sm text-muted-foreground leading-relaxed",children:[s.content.split(`
|
|
1
|
+
import{u as ce,a as de,r as i,j as e,B as r,T as oe,n as M,X as me,F as xe,a2 as he,D as ue,b as fe,d as pe,f as je,k as ge,a8 as B,a9 as R,aa as H,ab as L,ac as O,ad as G,o as ve,A as T}from"./index-C0uIENKu.js";import{C as g,b as Ne,a as _,c as ye}from"./card-CEBVsJGA.js";import{B as U}from"./badge-CEhr50DH.js";import{u as we}from"./use-terminal-GvBteSXs.js";import{T as Se}from"./terminal-preview-BHb0aOSR.js";import{S as Ce,a as be,b as ke,c as Ae,d as w}from"./select-BLUGdloJ.js";import{b as De,e as Me,d as Te,c as Ie,a as $e}from"./pipeline-builders-DrEjlsbH.js";import{R as Ee}from"./refresh-cw-BPr-EVyC.js";import{C as Pe,a as ze}from"./chevrons-up-DiHFV5Rg.js";import{P as Fe}from"./play-BHqUO04d.js";import{C as Be}from"./code-Jj7V1OI-.js";import{C as Re}from"./chevron-up-CLuT-8K8.js";import{S as He}from"./server-2mf5MwhW.js";import"./xterm-DTxiCjtJ.js";import"./index-4_sGNb1Z.js";const Le=c=>c?Array.isArray(c)?c.filter(x=>typeof x=="string").map(x=>x.trim()).filter(Boolean):typeof c=="string"?c.split(",").map(x=>x.trim()).filter(Boolean):[]:[];function ts(){const c=ce(),{sessions:x,loading:b,error:I,refreshSessions:S,createSession:V,destroySession:K}=we(),{toast:v}=de(),[$,W]=i.useState([]),[q,X]=i.useState(!0),[j,k]=i.useState(()=>({})),[A,N]=i.useState(!1),[f,J]=i.useState("claude"),[E,Q]=i.useState(""),[D,P]=i.useState(!1),[h,Y]=i.useState([]),[p,y]=i.useState([]),[Z,ee]=i.useState({}),[u,se]=i.useState([]),[o,C]=i.useState([]),te=s=>{const t=Date.now(),a=new Date(s).getTime(),n=Math.max(0,Math.floor((t-a)/1e3));if(n<60)return`${n}s ago`;const d=Math.floor(n/60);if(d<60)return`${d}m ago`;const l=Math.floor(d/60);return l<24?`${l}h ago`:`${Math.floor(l/24)}d ago`};i.useEffect(()=>{(async()=>{try{const t=await fetch(`${T}/api/v1/tasks`);if(t.ok){const a=await t.json(),n=a.data||a;W(Array.isArray(n)?n:[])}}catch(t){console.error("Error loading tasks:",t)}finally{X(!1)}})()},[]),i.useEffect(()=>{S()},[S]),i.useEffect(()=>{if(!A)return;(async()=>{try{const t=await fetch(`${T}/api/v1/mcp`);if(t.ok){const a=await t.json();a?.success&&Array.isArray(a.servers)&&(Y(a.servers),y(n=>n.filter(d=>a.servers.includes(d))),a.mcpServers&&typeof a.mcpServers=="object"&&ee(a.mcpServers))}}catch(t){console.error("Failed to load MCP servers",t)}try{const t=await fetch(`${T}/api/v1/skills`);if(t.ok){const a=await t.json(),d=(Array.isArray(a?.documents)?a.documents:[]).map(l=>({id:l.id,name:l?.metadata?.name||l.id,mcpServers:Le(l?.metadata?.metadata?.mcpServers)}));se(d),C(l=>l.filter(F=>d.some(le=>le.id===F)))}}catch(t){console.error("Failed to load skills",t)}})()},[A]),i.useEffect(()=>{o.length!==0&&y(s=>{const t=new Set(s),a=h.length>0?new Set(h):void 0;return o.forEach(n=>{const d=u.find(l=>l.id===n);d&&d.mcpServers.forEach(l=>{(!a||a.has(l))&&t.add(l)})}),Array.from(t)})},[o,u,h]);const m=i.useMemo(()=>x.filter(s=>s.taskId?.startsWith("cp-")||s.taskId?.startsWith("ag-")).sort((s,t)=>new Date(t.lastActivity).getTime()-new Date(s.lastActivity).getTime()),[x]);i.useEffect(()=>{k(s=>{const t={...s};return m.forEach(a=>{a.id in t||(t[a.id]=!0)}),t})},[m]);const z=i.useMemo(()=>$.filter(s=>s.status==="draft"||s.status==="ready").sort((s,t)=>new Date(t.metadata.createdAt).getTime()-new Date(s.metadata.createdAt).getTime()).slice(0,3),[$]),ae=()=>{const s=m.every(a=>j[a.id]),t={};m.forEach(a=>{t[a.id]=!s}),k(t)},ie=m.length>0&&m.every(s=>j[s.id]),ne=async s=>{await K(s)?(v({title:"Session closed",description:s}),setTimeout(()=>S(),100)):v({title:"Failed to close session",description:s,variant:"destructive"})},re=async()=>{P(!0);try{const s=`session-${Date.now()}`,t={taskId:s,contextType:"change-task",cliAgent:f,mcpServersMap:Z,selectedMcpServers:p,skills:u,selectedSkillIds:o,automationEnabled:!1,customInstruction:E.trim(),includeDefaultInstructions:!1};let a="";f==="claude"?a=De(t):f==="gemini"?a=Me(t):f==="codex"?a=Te(t):f==="droid"?a=Ie(t):f==="kiro"&&(a=$e(t)),await V(s,a)?(v({title:"Coding session started",description:`Session ${s} created`}),N(!1),c(`/terminal/${s}`)):v({title:"Failed to start session",description:"Could not create terminal session",variant:"destructive"})}catch(s){console.error("Error starting coding session:",s),v({title:"Error",description:"Failed to start coding session",variant:"destructive"})}finally{P(!1)}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Agents"}),e.jsx("p",{className:"text-muted-foreground hidden sm:block",children:"Manage agents and their active sessions"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(r,{variant:"outline",size:"sm",onClick:()=>S(),disabled:b,children:[e.jsx(Ee,{className:`h-4 w-4 sm:mr-2 ${b?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline",children:"Refresh"})]}),m.length>0&&e.jsx(r,{variant:"outline",size:"sm",onClick:ae,children:ie?e.jsxs(e.Fragment,{children:[e.jsx(Pe,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Hide All"})]}):e.jsxs(e.Fragment,{children:[e.jsx(ze,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Show All"})]})}),e.jsxs(r,{size:"sm",onClick:()=>N(!0),children:[e.jsx(Fe,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Interactive Session"})]})]})]}),I&&e.jsx("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg",children:e.jsx("div",{className:"text-red-600",children:I})}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Sessions"}),b?e.jsx("div",{className:"space-y-2",children:[...Array(2)].map((s,t)=>e.jsx(g,{className:"p-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-4 w-4 rounded bg-muted animate-pulse"}),e.jsxs("div",{children:[e.jsx("div",{className:"h-4 w-40 bg-muted rounded animate-pulse mb-2"}),e.jsx("div",{className:"h-3 w-24 bg-muted rounded animate-pulse"})]})]}),e.jsx("div",{className:"h-6 w-20 bg-muted rounded animate-pulse"})]})},t))}):m.length===0?e.jsx(g,{className:"p-8",children:e.jsxs("div",{className:"flex flex-col items-center justify-center text-center space-y-3",children:[e.jsx(Be,{className:"h-12 w-12 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-lg mb-2",children:"No active sessions"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Get started by launching an"," ",e.jsx("button",{onClick:()=>N(!0),className:"text-primary hover:underline font-medium",children:"Interactive Session"})," ","or working on a"," ",e.jsx("button",{onClick:()=>c("/tasks"),className:"text-primary hover:underline font-medium",children:"New Task"})]})]})]})}):e.jsx("div",{className:"space-y-2",children:m.slice(0,10).map(s=>e.jsxs(g,{className:"p-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(oe,{className:"h-4 w-4 shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-medium text-sm",children:s.taskId}),e.jsxs("div",{className:"text-xs text-gray-500",children:["Session ",s.id.split("-").slice(-1)[0].substring(0,8)," • Last activity ",te(s.lastActivity)]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("div",{className:`flex items-center gap-1 ${s.connected?"text-green-600":"text-gray-400"}`,title:s.connected?"Connected":"Disconnected",children:e.jsx("div",{className:`w-2 h-2 rounded-full ${s.connected?"bg-green-500":"bg-gray-400"}`})}),e.jsx(r,{size:"sm",variant:"outline",onClick:()=>{k(t=>({...t,[s.id]:!t[s.id]}))},"aria-label":j[s.id]?"Hide preview":"Show preview",title:j[s.id]?"Hide preview":"Show preview",children:j[s.id]?e.jsx(Re,{className:"h-4 w-4"}):e.jsx(M,{className:"h-4 w-4"})}),e.jsx(r,{size:"sm",variant:"outline",onClick:()=>c(`/terminal/${s.taskId}`),children:"Open"}),e.jsx(r,{size:"icon",variant:"destructive",onClick:()=>ne(s.id),title:"Close session","aria-label":"Close session",children:e.jsx(me,{className:"h-4 w-4"})})]})]}),j[s.id]&&e.jsx("div",{className:"mt-2 w-full p-2 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>c(`/terminal/${s.taskId}`),title:"Click to open full terminal session",children:e.jsx(Se,{sessionId:s.id,heightPx:160,maxScrollback:200})})]},s.id))})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"New Tasks"}),q?e.jsx("div",{className:"space-y-3",children:[...Array(3)].map((s,t)=>e.jsx(g,{children:e.jsx(Ne,{className:"py-3",children:e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 bg-muted rounded w-2/3 animate-pulse"}),e.jsx("div",{className:"h-3 bg-muted rounded w-1/3 animate-pulse"})]}),e.jsx("div",{className:"h-5 bg-muted rounded w-16 animate-pulse"})]})})},t))}):z.length===0?e.jsx(g,{children:e.jsx(_,{className:"flex items-center justify-center py-6",children:e.jsx("div",{className:"text-center text-sm text-gray-500",children:"No draft or approved tasks found"})})}):e.jsx("div",{className:"space-y-2",children:z.map(s=>e.jsx(g,{className:"hover:shadow-md transition-all cursor-pointer hover:border-primary/50",onClick:()=>c(`/terminal/${s.id}`),children:e.jsx(_,{className:"py-4",children:e.jsx("div",{className:"flex justify-between items-start gap-4",children:e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(ye,{className:"text-base leading-tight",children:s.title||s.intent}),e.jsxs("div",{className:"flex gap-1 ml-3 flex-shrink-0",children:[s.priority&&e.jsx(U,{variant:s.priority==="high"||s.priority==="critical"?"destructive":s.priority==="medium"?"secondary":"outline",className:"text-xs",children:s.priority}),e.jsx(U,{variant:"default",className:"text-xs",children:s.status})]})]}),s.content&&e.jsxs("div",{className:"text-sm text-muted-foreground leading-relaxed",children:[s.content.split(`
|
|
2
2
|
`).slice(0,2).join(" ").substring(0,150),s.content.length>150?"...":""]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{className:"text-xs text-muted-foreground",children:[s.id," • by ",s.author.name," • ",new Date(s.metadata.createdAt).toLocaleDateString()]}),e.jsxs("div",{className:"flex gap-2",onClick:t=>t.stopPropagation(),children:[e.jsxs(r,{variant:"ghost",size:"sm",onClick:()=>c(`/tasks/${s.id}`),className:"h-7 px-2 text-xs",children:[e.jsx(xe,{className:"h-3 w-3 mr-1"})," View"]}),e.jsxs(r,{variant:"ghost",size:"sm",onClick:()=>c(`/tasks/${s.id}/edit`),className:"h-7 px-2 text-xs",children:[e.jsx(he,{className:"h-3 w-3 mr-1"})," Edit"]})]})]})]})})})},s.id))})]}),e.jsx(ue,{open:A,onOpenChange:N,children:e.jsxs(fe,{className:"max-w-lg",children:[e.jsxs(pe,{children:[e.jsx(je,{children:"Start Agent"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Start an interactive session"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Agent"}),e.jsxs(Ce,{value:f,onValueChange:s=>J(s),children:[e.jsx(be,{className:"w-full",children:e.jsx(ke,{placeholder:"Select coding agent"})}),e.jsxs(Ae,{children:[e.jsx(w,{value:"claude",children:"Claude Code"}),e.jsx(w,{value:"gemini",children:"Google Gemini"}),e.jsx(w,{value:"codex",children:"OpenAI Codex"}),e.jsx(w,{value:"droid",children:"Factory Droid"}),e.jsx(w,{value:"kiro",children:"Kiro"})]})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(ge,{className:"h-4 w-4"}),"Skills"]}),e.jsxs("div",{className:"text-xs text-gray-500",children:[o.length," of ",u.length," selected"]})]}),e.jsxs(B,{children:[e.jsx(R,{asChild:!0,children:e.jsxs(r,{variant:"outline",className:"w-full justify-between",children:[o.length===0?"Select skills...":o.length===u.length?"All skills selected":`${o.length} skill${o.length!==1?"s":""} selected`,e.jsx(M,{className:"h-4 w-4 opacity-50"})]})}),e.jsxs(H,{className:"w-full min-w-[--radix-dropdown-menu-trigger-width]",children:[e.jsxs(L,{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Available Skills"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(r,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:s=>{s.preventDefault(),C(u.map(t=>t.id))},children:"All"}),e.jsx(r,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:s=>{s.preventDefault(),C([])},children:"None"})]})]}),e.jsx(O,{}),u.length===0?e.jsx("div",{className:"px-2 py-1.5 text-sm text-gray-500",children:"No skills found"}):u.map(s=>e.jsx(G,{checked:o.includes(s.id),onCheckedChange:t=>{C(a=>t?a.includes(s.id)?a:[...a,s.id]:a.filter(n=>n!==s.id))},children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{children:s.name}),s.mcpServers.length>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["MCP servers: ",s.mcpServers.join(", ")]}),s.mcpServers.length===0&&e.jsx("span",{className:"text-xs text-muted-foreground",children:"Inherits available MCP servers"})]})},s.id))]})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(He,{className:"h-4 w-4"}),"MCP Servers"]}),e.jsxs("div",{className:"text-xs text-gray-500",children:[p.length," of ",h.length," selected"]})]}),e.jsxs(B,{children:[e.jsx(R,{asChild:!0,children:e.jsxs(r,{variant:"outline",className:"w-full justify-between",children:[p.length===0?"Select MCP servers...":p.length===h.length?"All servers selected":`${p.length} server${p.length!==1?"s":""} selected`,e.jsx(M,{className:"h-4 w-4 opacity-50"})]})}),e.jsxs(H,{className:"w-full min-w-[--radix-dropdown-menu-trigger-width]",children:[e.jsxs(L,{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Available Servers"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(r,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:s=>{s.preventDefault(),y(h)},children:"All"}),e.jsx(r,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:s=>{s.preventDefault(),y([])},children:"None"})]})]}),e.jsx(O,{}),h.length===0?e.jsx("div",{className:"px-2 py-1.5 text-sm text-gray-500",children:"No MCP servers found"}):h.map(s=>e.jsx(G,{checked:p.includes(s),onCheckedChange:t=>{y(a=>t?a.includes(s)?a:[...a,s]:a.filter(n=>n!==s))},children:s},s))]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Additional Instructions (optional)"}),e.jsx(ve,{value:E,onChange:s=>Q(s.target.value),placeholder:"Add any custom instructions for the coding agent...",rows:4,className:"resize-none"})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(r,{variant:"outline",onClick:()=>N(!1),disabled:D,children:"Cancel"}),e.jsx(r,{onClick:re,disabled:D,children:D?"Starting...":"Start Session"})]})]})]})})]})}export{ts as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as x,j as e,e as a,n as m}from"./index-
|
|
1
|
+
import{r as x,j as e,e as a,n as m}from"./index-C0uIENKu.js";function u({title:n,description:t,icon:r,defaultOpen:o=!1,children:i,className:l}){const[s,d]=x.useState(o);return e.jsxs("div",{className:a("rounded-lg border bg-card text-card-foreground",l),children:[e.jsxs("button",{type:"button",onClick:()=>d(c=>!c),className:"flex w-full items-center justify-between gap-4 px-4 py-3 text-left","aria-expanded":s,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[r,e.jsxs("div",{children:[e.jsx("p",{className:"font-medium leading-tight",children:n}),t&&e.jsx("p",{className:"text-sm text-muted-foreground leading-snug",children:t})]})]}),e.jsx(m,{className:a("h-4 w-4 shrink-0 transition-transform duration-200",s?"rotate-180":"rotate-0")})]}),s&&e.jsx("div",{className:"border-t px-4 py-4",children:i})]})}export{u as C};
|