@lovelybunch/api 1.0.77-alpha.0 → 1.0.77-alpha.1

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 (154) hide show
  1. package/dist/config/oauth.d.ts +33 -0
  2. package/dist/config/oauth.js +43 -0
  3. package/dist/lib/auth/auth-manager.d.ts +21 -1
  4. package/dist/lib/auth/auth-manager.js +57 -3
  5. package/dist/lib/auth/clerk-verifier.d.ts +22 -0
  6. package/dist/lib/auth/clerk-verifier.js +30 -0
  7. package/dist/middleware/auth.js +40 -3
  8. package/dist/routes/api/v1/auth/route.js +90 -0
  9. package/dist/routes/api/v1/auth-settings/route.js +83 -2
  10. package/dist/routes/api/v1/jobs/[id]/route.d.ts +20 -20
  11. package/dist/routes/api/v1/jobs/route.d.ts +20 -20
  12. package/dist/routes/api/v1/slack/route.d.ts +6 -6
  13. package/dist/server-with-static.js +13 -0
  14. package/dist/server.js +11 -0
  15. package/package.json +5 -4
  16. package/static/assets/{ActivityPage-rASRHKYj.js → ActivityPage-DqSj7XDx.js} +1 -1
  17. package/static/assets/{AgentsContextEditPage-CMWD-7mS.js → AgentsContextEditPage-C5afMo09.js} +1 -1
  18. package/static/assets/AgentsContextPage-IrZGdiYt.js +1 -0
  19. package/static/assets/{ApiKeysSettingsPage-DxtuyXwn.js → ApiKeysSettingsPage-CFBTIYNp.js} +2 -2
  20. package/static/assets/AuthSettingsPage-LU7DFMG6.js +11 -0
  21. package/static/assets/{CallbackPage-CjlTVuif.js → CallbackPage-Beg0ZLv4.js} +1 -1
  22. package/static/assets/CoconutCallbackPage-BuBYbeY-.js +1 -0
  23. package/static/assets/CodePage-C9auBWu3.js +2 -0
  24. package/static/assets/{CollapsibleSection-LrQJlSxD.js → CollapsibleSection-C3uaXDrK.js} +1 -1
  25. package/static/assets/{DashboardPage-DnyFyDO0.js → DashboardPage-DK2uEtcQ.js} +1 -1
  26. package/static/assets/{GitPage-o37iQMYQ.js → GitPage-BgfZ5rXn.js} +2 -2
  27. package/static/assets/{GitSettingsPage-O0fe5kxm.js → GitSettingsPage-DIhaZgDD.js} +2 -2
  28. package/static/assets/{IdentityPage-KWjruliO.js → IdentityPage-6_IEyGmH.js} +2 -2
  29. package/static/assets/{ImplementationStepsEditor-h_Mxu1tF.js → ImplementationStepsEditor-BXjs77nI.js} +1 -1
  30. package/static/assets/IntegrationsSettingsPage-Cu-C86-i.js +1 -0
  31. package/static/assets/JobDetailPage-BWd0sz7w.js +1 -0
  32. package/static/assets/KnowledgeDetailPage-Cx0NiVN5.js +1 -0
  33. package/static/assets/{KnowledgeEditPage-DrdvEGuR.js → KnowledgeEditPage-Dtp9Ceyp.js} +1 -1
  34. package/static/assets/{KnowledgePage-CK5rtZcv.js → KnowledgePage-DRavibOT.js} +2 -2
  35. package/static/assets/LoginPage-Bn-55dqi.js +1 -0
  36. package/static/assets/{MailInboxPage-CewILL7o.js → MailInboxPage-B-mzoocZ.js} +1 -1
  37. package/static/assets/MailProcessingModal-B5HFIwxh.js +1 -0
  38. package/static/assets/{MailReadPage--LnQ743i.js → MailReadPage-DVVICNmn.js} +1 -1
  39. package/static/assets/{MailSentPage-BqO4iBq6.js → MailSentPage-BmqXLEIF.js} +1 -1
  40. package/static/assets/McpSettingsPage-D6hW-2uy.js +1 -0
  41. package/static/assets/{MemoryEditPage-BLfdKEDu.js → MemoryEditPage-Cw2oWAW2.js} +1 -1
  42. package/static/assets/MemoryPage-BKNQlp0x.js +1 -0
  43. package/static/assets/{NewKnowledgePage-SrBhXpH6.js → NewKnowledgePage-zWnjfGF1.js} +1 -1
  44. package/static/assets/{NewSkillPage-vt-0rIkv.js → NewSkillPage-eqK5nwnk.js} +1 -1
  45. package/static/assets/{NewTaskPage-CBUpwIFP.js → NewTaskPage-BcOmFrza.js} +2 -2
  46. package/static/assets/{NotFoundPage-CWF5qOC0.js → NotFoundPage-CKcBMXOQ.js} +1 -1
  47. package/static/assets/{NotificationsSettingsPage-3ZvMrqiq.js → NotificationsSettingsPage-DETz35D7.js} +1 -1
  48. package/static/assets/PromptsSettingsPage-8--L7lw4.js +1 -0
  49. package/static/assets/{ResourceDetailPage-CE4iDbv7.js → ResourceDetailPage-BH-A0yn7.js} +1 -1
  50. package/static/assets/{ResourcesPage-4_5NA4RF.js → ResourcesPage-CfdKptfd.js} +1 -1
  51. package/static/assets/{RoleEditPage-4sSELIRX.js → RoleEditPage-DfqF4tLW.js} +1 -1
  52. package/static/assets/RolePage-CCwufp_f.js +1 -0
  53. package/static/assets/{RulesSettingsPage-DnyGaden.js → RulesSettingsPage-dzUPGors.js} +4 -4
  54. package/static/assets/{RunDetailPage-D2ajvKfh.js → RunDetailPage-B9I5nrOb.js} +1 -1
  55. package/static/assets/SchedulePage-7Ufvzd34.js +4 -0
  56. package/static/assets/SkillDetailPage-DCjWVhUE.js +1 -0
  57. package/static/assets/{SkillEditPage-DeI8uu3S.js → SkillEditPage-BA-ebFGI.js} +1 -1
  58. package/static/assets/{SkillsPage-Bb_dEdun.js → SkillsPage-QqNzKzhn.js} +2 -2
  59. package/static/assets/{SkillsSettingsPage-CMWf2O9y.js → SkillsSettingsPage-DPXiPnWO.js} +1 -1
  60. package/static/assets/{SourceInput-CtyUOXOG.js → SourceInput-0S84iX2C.js} +1 -1
  61. package/static/assets/{TagInput-C0NyMxlY.js → TagInput-C_2MLj_1.js} +1 -1
  62. package/static/assets/{TaskDetailPage-6DDI0juh.js → TaskDetailPage-6E7isObV.js} +2 -2
  63. package/static/assets/{TaskEditPage-Btc1NXtR.js → TaskEditPage-Bd1DFoK3.js} +1 -1
  64. package/static/assets/{TasksPage-C9TYvqRz.js → TasksPage-CeWPVVwj.js} +1 -1
  65. package/static/assets/{TeamEditPage-CLvNy6Ss.js → TeamEditPage-CgYsqeq9.js} +1 -1
  66. package/static/assets/TeamPage-CEojyLvc.js +1 -0
  67. package/static/assets/{TerminalPage-DNDHEYJZ.js → TerminalPage-D-LJMND7.js} +1 -1
  68. package/static/assets/{TerminalSessionPage-nNCw_oDE.js → TerminalSessionPage-BGHgOQhV.js} +2 -2
  69. package/static/assets/{UserPreferencesPage-jc1SA79x.js → UserPreferencesPage-D5nGgztl.js} +1 -1
  70. package/static/assets/{UserSettingsPage-pr6n15Pz.js → UserSettingsPage-Dv6fSWWx.js} +1 -1
  71. package/static/assets/UtilitiesPage-hCM0KDs8.js +1 -0
  72. package/static/assets/{alert-BtkLXQ3p.js → alert-DxBTp_In.js} +1 -1
  73. package/static/assets/{arrow-down-DnNLmXEs.js → arrow-down-Be4lZFzF.js} +1 -1
  74. package/static/assets/{arrow-left-B9NBHEkS.js → arrow-left-DzGSl0dC.js} +1 -1
  75. package/static/assets/{arrow-up-eMUJY7J9.js → arrow-up-6HVzdiIw.js} +1 -1
  76. package/static/assets/{arrow-up-down-DIuMvAne.js → arrow-up-down-C9lUuyDO.js} +1 -1
  77. package/static/assets/{badge-BbfU_aPt.js → badge-DyF_7_dv.js} +1 -1
  78. package/static/assets/{browser-modal-J9l3o5os.js → browser-modal-DKHn0FAC.js} +2 -2
  79. package/static/assets/{card-CL5bB4cs.js → card-DW9yx9FC.js} +1 -1
  80. package/static/assets/{chevron-left-B-7K6MNx.js → chevron-left-CJjrbO2y.js} +1 -1
  81. package/static/assets/{chevron-up-BwTmMEW2.js → chevron-up-BrSqNhfU.js} +1 -1
  82. package/static/assets/{chevrons-up-jI6nxhrz.js → chevrons-up-wQrNHZqU.js} +1 -1
  83. package/static/assets/{circle-alert-vJFSz39V.js → circle-alert-ByPjREVD.js} +1 -1
  84. package/static/assets/{circle-check-D2LVHMl-.js → circle-check-D7peX4CI.js} +1 -1
  85. package/static/assets/{circle-check-big-BwQ_q1N7.js → circle-check-big--yqXPZzU.js} +1 -1
  86. package/static/assets/{circle-play-CLKDBkrK.js → circle-play-C2th8mzN.js} +1 -1
  87. package/static/assets/{circle-x-CuUVLiI-.js → circle-x-Oj6Gai3s.js} +1 -1
  88. package/static/assets/{clipboard-BHOFelnW.js → clipboard-qigxJPlJ.js} +1 -1
  89. package/static/assets/{clock-D-X3KCw6.js → clock-JhtahL2B.js} +1 -1
  90. package/static/assets/{code-DqYaanki.js → code-DcBDG3ah.js} +1 -1
  91. package/static/assets/{download-DeEju9jg.js → download-BBjLPrfj.js} +1 -1
  92. package/static/assets/{external-link-CrRz0sU-.js → external-link-DDneC3kx.js} +1 -1
  93. package/static/assets/{eye-Cx9ZGkg5.js → eye-Bl23BbY6.js} +1 -1
  94. package/static/assets/{folder-git-2-Cizv1NA6.js → folder-git-2-BBe22u2y.js} +1 -1
  95. package/static/assets/{globe-lpD9Jv31.js → globe-C3j3aWiD.js} +1 -1
  96. package/static/assets/{index-ByTA2ZiD.js → index-0zkOcODK.js} +105 -105
  97. package/static/assets/{index-CMaK0hpv.js → index-B-9XKFgb.js} +1 -1
  98. package/static/assets/{index-ihWq-CVE.js → index-CWt3zgDI.js} +1 -1
  99. package/static/assets/{index-CkT4WgqR.js → index-Cbo5QxHl.js} +1 -1
  100. package/static/assets/{index-BknCCMZK.js → index-D2rSjJPF.js} +1 -1
  101. package/static/assets/{index-Dc9Njo8L.js → index-DFfxOZw8.js} +1 -1
  102. package/static/assets/{index-BVrOTqTm.js → index-DUwRskPW.js} +1 -1
  103. package/static/assets/{index-BvZJRqTz.js → index-DaAZbWZV.js} +1 -1
  104. package/static/assets/{index-DgAcL75U.js → index-DdDCTC_d.js} +1 -1
  105. package/static/assets/{index-BCYTbJRb.js → index-DdSybLsG.js} +1 -1
  106. package/static/assets/{index-BPdWQ0rI.js → index-DgFdrtDt.js} +1 -1
  107. package/static/assets/{index-BL-5Bhtg.js → index-DkobSVA-.js} +1 -1
  108. package/static/assets/{index-D12O6wM3.js → index-DuWsaYa4.js} +1 -1
  109. package/static/assets/{index-DK1gGyTZ.js → index-DukcrMyC.js} +1 -1
  110. package/static/assets/{index-Dnj5cWsp.js → index-I6ZfnFaA.js} +1 -1
  111. package/static/assets/{index-Hy3cH93B.js → index-QZn_aaqg.js} +1 -1
  112. package/static/assets/{index-Djzp98Vj.js → index-UM1qitEs.js} +1 -1
  113. package/static/assets/{index-DIt703WU.js → index-r07pPAcM.js} +1 -1
  114. package/static/assets/{index-CuLP7P_G.js → index-xBQb0rMo.js} +1 -1
  115. package/static/assets/{info-DxhTCbw1.js → info-DWORrO-s.js} +1 -1
  116. package/static/assets/{label-Dp0-28_O.js → label-DyhnItJm.js} +1 -1
  117. package/static/assets/{markdown-editor-DUmrf1eN.js → markdown-editor-C8LFQE7K.js} +38 -38
  118. package/static/assets/{message-square-BPOApeM3.js → message-square-CiISW36v.js} +1 -1
  119. package/static/assets/{paperclip-Bfjc1WLZ.js → paperclip-DRufaOtA.js} +1 -1
  120. package/static/assets/{pause-Bfz-QQZp.js → pause-GqIUdKFa.js} +1 -1
  121. package/static/assets/{play-fOwEoIcu.js → play-CkuTY54l.js} +1 -1
  122. package/static/assets/{radio-group-B8RB7N01.js → radio-group-ClpV676y.js} +1 -1
  123. package/static/assets/{refresh-cw-Cj_5MZiJ.js → refresh-cw-CYBx0C_n.js} +1 -1
  124. package/static/assets/{search-BgbqRUnf.js → search-DxiQuWo1.js} +1 -1
  125. package/static/assets/{select-CfwLZl55.js → select-D_L7OXwN.js} +1 -1
  126. package/static/assets/{server-u9FLHclt.js → server-CgjJESGe.js} +1 -1
  127. package/static/assets/{switch-CX_Inx_p.js → switch-DXojpqQ8.js} +1 -1
  128. package/static/assets/{tabs-Bj0YyeRI.js → tabs-zdz4RlY5.js} +1 -1
  129. package/static/assets/{tag-rYG4CdRx.js → tag-CeaYtqPJ.js} +1 -1
  130. package/static/assets/{terminal-preview-BNm5-Umi.js → terminal-preview-CspSfoko.js} +1 -1
  131. package/static/assets/{triangle-alert-C0ovMJwZ.js → triangle-alert-DTdlIh6V.js} +1 -1
  132. package/static/assets/{use-terminal-D1UnvAVs.js → use-terminal-DkVoTttR.js} +1 -1
  133. package/static/assets/{video-CuyRES-H.js → video-5zJ0jcFw.js} +1 -1
  134. package/static/index.html +1 -1
  135. package/dist/routes/api/v1/context/architecture/route.d.ts +0 -3
  136. package/dist/routes/api/v1/context/architecture/route.js +0 -245
  137. package/dist/routes/api/v1/context/project/route.d.ts +0 -3
  138. package/dist/routes/api/v1/context/project/route.js +0 -200
  139. package/static/assets/AgentsContextPage-VfMmxxr6.js +0 -1
  140. package/static/assets/AuthSettingsPage-CWTpS6BA.js +0 -11
  141. package/static/assets/CodePage-DwjtGxQi.js +0 -2
  142. package/static/assets/IntegrationsSettingsPage-DeFQd6af.js +0 -1
  143. package/static/assets/JobDetailPage-HOLpF7Sx.js +0 -1
  144. package/static/assets/KnowledgeDetailPage-C5egPQ54.js +0 -1
  145. package/static/assets/LoginPage-DajEouCN.js +0 -1
  146. package/static/assets/MailProcessingModal-B1ZLXyYl.js +0 -1
  147. package/static/assets/McpSettingsPage-BZ6GJOtk.js +0 -1
  148. package/static/assets/MemoryPage-BV0RlvUS.js +0 -1
  149. package/static/assets/PromptsSettingsPage-pHKoiUPI.js +0 -1
  150. package/static/assets/RolePage-Ds17xn4X.js +0 -1
  151. package/static/assets/SchedulePage-oEGct1B1.js +0 -4
  152. package/static/assets/SkillDetailPage-mSypV_JK.js +0 -1
  153. package/static/assets/TeamPage-DSWax4fa.js +0 -1
  154. package/static/assets/UtilitiesPage-CjLb989o.js +0 -1
@@ -11,6 +11,9 @@ 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;
14
17
  schedule: {
15
18
  type: "cron";
16
19
  expression: string;
@@ -23,9 +26,9 @@ export declare function GET(c: Context): Promise<(Response & import("hono").Type
23
26
  timezone?: string;
24
27
  anchorHour?: number;
25
28
  };
26
- status: ScheduledJobStatus;
27
- id: string;
28
- name: string;
29
+ description?: string;
30
+ prompt: string;
31
+ model: string;
29
32
  metadata: {
30
33
  createdAt: string;
31
34
  updatedAt: string;
@@ -33,19 +36,16 @@ export declare function GET(c: Context): Promise<(Response & import("hono").Type
33
36
  nextRunAt?: string;
34
37
  };
35
38
  tags?: string[];
36
- description?: string;
37
- model: string;
38
- prompt: string;
39
- mcpServers?: string[];
40
39
  contextPaths?: string[];
41
40
  agentId?: string;
42
41
  agentIds?: string[];
42
+ mcpServers?: string[];
43
43
  runs: {
44
+ id: string;
45
+ error?: string;
46
+ status: import("@lovelybunch/types").ScheduledJobRunStatus;
44
47
  jobId: string;
45
48
  trigger: import("@lovelybunch/types").ScheduledJobTrigger;
46
- status: import("@lovelybunch/types").ScheduledJobRunStatus;
47
- error?: string;
48
- id: string;
49
49
  startedAt: string;
50
50
  finishedAt?: string;
51
51
  }[];
@@ -66,6 +66,9 @@ 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;
69
72
  schedule: {
70
73
  type: "cron";
71
74
  expression: string;
@@ -78,9 +81,9 @@ export declare function POST(c: Context): Promise<(Response & import("hono").Typ
78
81
  timezone?: string;
79
82
  anchorHour?: number;
80
83
  };
81
- status: ScheduledJobStatus;
82
- id: string;
83
- name: string;
84
+ description?: string;
85
+ prompt: string;
86
+ model: string;
84
87
  metadata: {
85
88
  createdAt: string;
86
89
  updatedAt: string;
@@ -88,19 +91,16 @@ export declare function POST(c: Context): Promise<(Response & import("hono").Typ
88
91
  nextRunAt?: string;
89
92
  };
90
93
  tags?: string[];
91
- description?: string;
92
- model: string;
93
- prompt: string;
94
- mcpServers?: string[];
95
94
  contextPaths?: string[];
96
95
  agentId?: string;
97
96
  agentIds?: string[];
97
+ mcpServers?: string[];
98
98
  runs: {
99
+ id: string;
100
+ error?: string;
101
+ status: import("@lovelybunch/types").ScheduledJobRunStatus;
99
102
  jobId: string;
100
103
  trigger: import("@lovelybunch/types").ScheduledJobTrigger;
101
- status: import("@lovelybunch/types").ScheduledJobRunStatus;
102
- error?: string;
103
- id: string;
104
104
  startedAt: string;
105
105
  finishedAt?: string;
106
106
  }[];
@@ -7,9 +7,6 @@ export declare function getConfig(c: Context): Promise<(Response & import("hono"
7
7
  success: true;
8
8
  data: {
9
9
  enabled: boolean;
10
- channelId: string;
11
- channelName: string;
12
- siteUrl: string;
13
10
  notifications: {
14
11
  proposals: {
15
12
  created: boolean;
@@ -24,6 +21,9 @@ export declare function getConfig(c: Context): Promise<(Response & import("hono"
24
21
  merge: boolean;
25
22
  };
26
23
  };
24
+ channelId: string;
25
+ channelName: string;
26
+ siteUrl: string;
27
27
  hasBotToken: boolean;
28
28
  hasSigningSecret: boolean;
29
29
  };
@@ -39,9 +39,6 @@ export declare function updateConfig(c: Context): Promise<(Response & import("ho
39
39
  success: true;
40
40
  data: {
41
41
  enabled: boolean;
42
- channelId: string;
43
- channelName: string;
44
- siteUrl: string;
45
42
  notifications: {
46
43
  proposals: {
47
44
  created: boolean;
@@ -56,6 +53,9 @@ export declare function updateConfig(c: Context): Promise<(Response & import("ho
56
53
  merge: boolean;
57
54
  };
58
55
  };
56
+ channelId: string;
57
+ channelName: string;
58
+ siteUrl: string;
59
59
  hasBotToken: boolean;
60
60
  hasSigningSecret: boolean;
61
61
  };
@@ -12,6 +12,8 @@ import { getGlobalJobScheduler } from './lib/jobs/global-job-scheduler.js';
12
12
  import { fileURLToPath } from 'url';
13
13
  import { getLogger } from '@lovelybunch/core/logging';
14
14
  import { getLogsDir } from '@lovelybunch/core';
15
+ import { oauthRuntimeFromAuthConfig, setOAuthRuntimeConfig } from './config/oauth.js';
16
+ import { getAuthManager } from './lib/auth/auth-manager.js';
15
17
  const __filename = fileURLToPath(import.meta.url);
16
18
  const __dirname = path.dirname(__filename);
17
19
  // Load environment variables from .env file in project root
@@ -310,6 +312,17 @@ else {
310
312
  export async function startServer(options = {}) {
311
313
  const port = options.port || (process.env.PORT ? parseInt(process.env.PORT) : 3000);
312
314
  const host = options.host || '0.0.0.0';
315
+ // Populate the OAuth runtime cache from auth.json. `providers.oauth.coconut`
316
+ // is the single source of truth: presence + `enabled: true` + `clientId`
317
+ // activates the Clerk Bearer path. Absent/disabled/missing-clientId all
318
+ // disable OAuth silently (no error — a coconut without OAuth is valid).
319
+ try {
320
+ const authConfig = await getAuthManager().loadAuthConfig();
321
+ setOAuthRuntimeConfig(oauthRuntimeFromAuthConfig(authConfig));
322
+ }
323
+ catch {
324
+ setOAuthRuntimeConfig({ enabled: false });
325
+ }
313
326
  vlog(`Starting server on ${host}:${port}...`);
314
327
  const server = serve({
315
328
  fetch: app.fetch,
package/dist/server.js CHANGED
@@ -11,6 +11,8 @@ import { fileURLToPath } from 'url';
11
11
  import fs from 'fs';
12
12
  import { getLogger } from '@lovelybunch/core/logging';
13
13
  import { getLogsDir } from '@lovelybunch/core';
14
+ import { oauthRuntimeFromAuthConfig, setOAuthRuntimeConfig } from './config/oauth.js';
15
+ import { getAuthManager } from './lib/auth/auth-manager.js';
14
16
  const __filename = fileURLToPath(import.meta.url);
15
17
  const __dirname = path.dirname(__filename);
16
18
  // Load environment variables from .env file in project root
@@ -235,6 +237,15 @@ app.get(PUBLIC_AGENT_CARD_PATH, authMiddleware, async (c) => {
235
237
  app.get('/health', (c) => {
236
238
  return c.json({ status: 'ok', timestamp: new Date().toISOString() });
237
239
  });
240
+ // Populate the OAuth runtime cache from auth.json. See server-with-static.ts
241
+ // for the full rationale.
242
+ try {
243
+ const authConfig = await getAuthManager().loadAuthConfig();
244
+ setOAuthRuntimeConfig(oauthRuntimeFromAuthConfig(authConfig));
245
+ }
246
+ catch {
247
+ setOAuthRuntimeConfig({ enabled: false });
248
+ }
238
249
  // Start server
239
250
  const port = process.env.PORT ? parseInt(process.env.PORT) : 3001;
240
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.77-alpha.0",
3
+ "version": "1.0.77-alpha.1",
4
4
  "type": "module",
5
5
  "main": "dist/server-with-static.js",
6
6
  "exports": {
@@ -33,15 +33,16 @@
33
33
  "fuse.js": "^7.0.0",
34
34
  "gray-matter": "^4.0.3",
35
35
  "hono": "^4.12.9",
36
+ "jose": "^6.2.2",
36
37
  "jsonwebtoken": "^9.0.2",
37
38
  "node-pty": "^1.0.0",
38
39
  "replicate": "^0.34.1",
39
40
  "sharp": "^0.33.5",
40
41
  "ws": "^8.18.0",
41
42
  "zod": "^3.23.0",
42
- "@lovelybunch/core": "1.0.77-alpha.0",
43
- "@lovelybunch/types": "1.0.77-alpha.0",
44
- "@lovelybunch/mcp": "1.0.77-alpha.0"
43
+ "@lovelybunch/mcp": "1.0.77-alpha.1",
44
+ "@lovelybunch/types": "1.0.77-alpha.1",
45
+ "@lovelybunch/core": "1.0.77-alpha.1"
45
46
  },
46
47
  "devDependencies": {
47
48
  "@types/adm-zip": "^0.5.7",
@@ -1 +1 @@
1
- import{r as a,A as p,j as e,v,bK as y,B as N,n as w,C as b}from"./index-ByTA2ZiD.js";import{C as c,a as d,b as k,c as C}from"./card-CL5bB4cs.js";import{B as m}from"./badge-BbfU_aPt.js";import{R as E}from"./refresh-cw-Cj_5MZiJ.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};
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-0zkOcODK.js";import{C as c,a as d,b as k,c as C}from"./card-DW9yx9FC.js";import{B as m}from"./badge-DyF_7_dv.js";import{R as E}from"./refresh-cw-CYBx0C_n.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};
@@ -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,a1 as N}from"./index-ByTA2ZiD.js";import{C as m,a as x,b as C,c as S}from"./card-CL5bB4cs.js";import{M as w}from"./markdown-editor-DUmrf1eN.js";import{A as y}from"./arrow-left-B9NBHEkS.js";import{C as A}from"./circle-check-big-BwQ_q1N7.js";import"./index-CuLP7P_G.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...
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-0zkOcODK.js";import{C as m,a as x,b as C,c as S}from"./card-DW9yx9FC.js";import{M as w}from"./markdown-editor-C8LFQE7K.js";import{A as y}from"./arrow-left-DzGSl0dC.js";import{C as A}from"./circle-check-big--yqXPZzU.js";import"./index-xBQb0rMo.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
 
@@ -0,0 +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-0zkOcODK.js";import{C as i,a as c,b}from"./card-DW9yx9FC.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 z,r as t,bD as y,j as e,B as a,P as R,bE as X,H as J,D as j,b as g,d as v,f,g as A,I as F,Y as N,ae as W,w as i}from"./index-ByTA2ZiD.js";import{C as G,b as Q,c as V,d as Z,a as _}from"./card-CL5bB4cs.js";import{L as w}from"./label-Dp0-28_O.js";import{B as ee}from"./badge-BbfU_aPt.js";import{A as I,a as C}from"./alert-BtkLXQ3p.js";import{I as L}from"./info-DxhTCbw1.js";import{C as se}from"./circle-alert-vJFSz39V.js";function oe(){const{authEnabled:n}=z(),[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"}),Y=s=>s?new Date(s)<new Date:!1,$=typeof window<"u"?window.location.origin:"http://localhost:3000",q=c?`curl -H "X-API-Key: ${c.key}" \\
2
- + ${$}/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(G,{children:[e.jsx(Q,{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(R,{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(X,{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}),Y(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(W,{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:q})})]})]}),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
+ 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-0zkOcODK.js";import{C as W,b as G,c as V,d as Z,a as _}from"./card-DW9yx9FC.js";import{L as w}from"./label-DyhnItJm.js";import{B as ee}from"./badge-DyF_7_dv.js";import{A as I,a as C}from"./alert-DxBTp_In.js";import{I as L}from"./info-DWORrO-s.js";import{C as se}from"./circle-alert-ByPjREVD.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
+ + ${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};
@@ -0,0 +1,11 @@
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-0zkOcODK.js";import{C as m,b as g,c as j,d as p,a as v}from"./card-DW9yx9FC.js";import{L as c}from"./label-DyhnItJm.js";import{S as X,a as Z,b as ee,c as se,d as a}from"./select-D_L7OXwN.js";import{S as N}from"./switch-DXojpqQ8.js";import{B as F}from"./badge-DyF_7_dv.js";import{C as be}from"./circle-alert-ByPjREVD.js";import"./index-xBQb0rMo.js";import"./chevron-up-BrSqNhfU.js";/**
2
+ * @license lucide-react v0.542.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const Ae=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],Ee=te("key-round",Ae);/**
7
+ * @license lucide-react v0.542.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const Ue=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],ke=te("user-plus",Ue);function Je(){const{user:S,authEnabled:ie,checkAuthStatus:P}=me(),[t,h]=n.useState(null),[re,I]=n.useState(!0),[R,T]=n.useState(!1),[O,b]=n.useState(""),[A,L]=n.useState(!1),[ne,E]=n.useState(!1),[U,$]=n.useState(""),[k,J]=n.useState(""),[M,V]=n.useState("viewer"),[D,f]=n.useState(null),[w,y]=n.useState(""),ae=!ie||S?.role==="admin";n.useEffect(()=>{C()},[]);const C=async()=>{try{I(!0);const s=await l("/api/v1/auth-settings");s.success?(h(s.data),b(s.data?.providers?.oauth?.coconut?.clientId??"")):h(null)}catch(s){console.error("Failed to load auth settings:",s),h(null)}finally{I(!1)}},W=async s=>{const i=O.trim();if(s&&!i){r({title:"Client ID required",description:"Enter the Coconut OAuth client ID before enabling. Run `nut init --oauth-client-id <id>` if you don't have one yet.",variant:"destructive"});return}try{L(!0);const o=await l("/api/v1/auth-settings/oauth/coconut",{method:"PUT",body:JSON.stringify({enabled:s,clientId:i||void 0})});if(!o.success)throw new Error(o.error||"Failed to update Coconut OAuth");h(u=>u&&{...u,providers:{...u.providers,oauth:{...u.providers.oauth,coconut:o.data.coconut}}}),b(o.data.coconut?.clientId??""),await P(),r({title:"Success",description:`Coconut OAuth ${s?"enabled":"disabled"}`})}catch(o){r({title:"Error",description:o.message||"Failed to update Coconut OAuth",variant:"destructive"})}finally{L(!1)}},oe=async()=>{if(!t)return;const s=!t.enabled;try{const i=await l("/api/v1/auth-settings",{method:"PUT",body:JSON.stringify({enabled:s})});if(i.success)h({...t,enabled:s}),await P(),r({title:"Success",description:`Authentication ${s?"enabled":"disabled"}`});else throw new Error(i.error||"Failed to toggle auth")}catch(i){r({title:"Error",description:i.message||"Failed to toggle authentication",variant:"destructive"})}},ce=async()=>{if(!t)return;const s=!t.allowRegistration;try{const i=await l("/api/v1/auth-settings",{method:"PUT",body:JSON.stringify({allowRegistration:s})});if(i.success)h({...t,allowRegistration:s}),r({title:"Success",description:`Self-registration ${s?"enabled":"disabled"}`});else throw new Error(i.error||"Failed to update setting")}catch(i){r({title:"Error",description:i.message||"Failed to update setting",variant:"destructive"})}},le=async()=>{if(!U||!k){r({title:"Error",description:"Please provide email and name",variant:"destructive"});return}try{const s=await l("/api/v1/auth-settings/users",{method:"POST",body:JSON.stringify({email:U,name:k,role:M})});if(s.success)await C(),E(!1),$(""),J(""),V("viewer"),r({title:"Success",description:"User added to whitelist"});else throw new Error(s.error||"Failed to add user")}catch(s){r({title:"Error",description:s.message||"Failed to add user",variant:"destructive"})}},de=async s=>{try{const i=await l(`/api/v1/auth-settings/users/${s}`,{method:"DELETE"});if(i.success)await C(),r({title:"Success",description:"User removed from whitelist"});else throw new Error(i.error||"Failed to remove user")}catch(i){r({title:"Error",description:i.message||"Failed to remove user",variant:"destructive"})}},he=async(s,i)=>{try{const o=await l(`/api/v1/auth-settings/users/${s}`,{method:"PUT",body:JSON.stringify({role:i})});if(o.success)await C(),r({title:"Success",description:"User role updated"});else throw new Error(o.error||"Failed to update role")}catch(o){r({title:"Error",description:o.message||"Failed to update role",variant:"destructive"})}},ue=async()=>{if(!(!D||!w)){if(w.length<8){r({title:"Error",description:"Password must be at least 8 characters",variant:"destructive"});return}try{const s=await l(`/api/v1/auth-settings/users/${D}/reset-password`,{method:"POST",body:JSON.stringify({newPassword:w})});if(s.success)f(null),y(""),r({title:"Success",description:"Password reset successfully"});else throw new Error(s.error||"Failed to reset password")}catch(s){r({title:"Error",description:s.message||"Failed to reset password",variant:"destructive"})}}},xe=async()=>{if(t)try{T(!0);const s=await l("/api/v1/auth-settings",{method:"PUT",body:JSON.stringify({session:t.session})});if(s.success)r({title:"Success",description:"Session settings updated"});else throw new Error(s.error||"Failed to update settings")}catch(s){r({title:"Error",description:s.message||"Failed to update settings",variant:"destructive"})}finally{T(!1)}};return re?e.jsx("div",{children:"Loading..."}):t?ae?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"Authentication"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage authentication settings and user access."})]}),e.jsx(_,{}),e.jsxs(m,{children:[e.jsxs(g,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"h-5 w-5"}),e.jsx(j,{children:"Authentication Status"})]}),e.jsx(p,{children:"Control whether authentication is required to access Coconut."})]}),e.jsxs(v,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(c,{htmlFor:"auth-enabled",children:"Require Authentication"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"When enabled, users must log in to access Coconut"})]}),e.jsx(N,{id:"auth-enabled",checked:t.enabled,onCheckedChange:oe})]}),t.enabled&&e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[e.jsxs("div",{children:[e.jsx(c,{htmlFor:"allow-registration",children:"Allow Self-Registration"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Whitelisted users can create their own accounts"})]}),e.jsx(N,{id:"allow-registration",checked:t.allowRegistration,onCheckedChange:ce})]})]})]}),e.jsxs(m,{children:[e.jsx(g,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(j,{children:"Whitelisted Users"}),e.jsx(p,{children:"Manage users who can access this Coconut instance."})]}),e.jsxs(q,{open:ne,onOpenChange:E,children:[e.jsx(z,{asChild:!0,children:e.jsxs(d,{size:"sm",children:[e.jsx(ke,{className:"h-4 w-4 mr-2"}),"Add User"]})}),e.jsxs(B,{children:[e.jsxs(Y,{children:[e.jsx(K,{children:"Add User to Whitelist"}),e.jsx(Q,{children:"Add a user's email to allow them to register and access Coconut."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{children:[e.jsx(c,{htmlFor:"new-email",children:"Email"}),e.jsx(x,{id:"new-email",type:"email",value:U,onChange:s=>$(s.target.value),placeholder:"user@example.com"})]}),e.jsxs("div",{children:[e.jsx(c,{htmlFor:"new-name",children:"Name"}),e.jsx(x,{id:"new-name",value:k,onChange:s=>J(s.target.value),placeholder:"User Name"})]}),e.jsxs("div",{children:[e.jsx(c,{htmlFor:"new-role",children:"Role"}),e.jsxs(X,{value:M,onValueChange:s=>V(s),children:[e.jsx(Z,{children:e.jsx(ee,{})}),e.jsxs(se,{children:[e.jsx(a,{value:"viewer",children:"Viewer"}),e.jsx(a,{value:"engineer",children:"Engineer"}),e.jsx(a,{value:"designer",children:"Designer"}),e.jsx(a,{value:"product_manager",children:"Product Manager"}),e.jsx(a,{value:"manager",children:"Manager"}),e.jsx(a,{value:"admin",children:"Admin"})]})]})]})]}),e.jsxs(G,{children:[e.jsx(d,{variant:"outline",onClick:()=>E(!1),children:"Cancel"}),e.jsx(d,{onClick:le,children:"Add User"})]})]})]})]})}),e.jsx(v,{children:e.jsx("div",{className:"space-y-4",children:t.providers.local.users.map(s=>e.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[e.jsxs("div",{className:"space-y-1 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"font-medium",children:s.name}),s.registered?e.jsx(F,{variant:"default",className:"text-xs",children:"Registered"}):e.jsx(F,{variant:"secondary",className:"text-xs",children:"Pending"}),s.id===S?.id&&e.jsx(F,{variant:"outline",className:"text-xs",children:"You"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.email}),s.lastLoginAt&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Last login: ",new Date(s.lastLoginAt).toLocaleString()]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(X,{value:s.role,onValueChange:i=>he(s.id,i),children:[e.jsx(Z,{className:"w-40",children:e.jsx(ee,{})}),e.jsxs(se,{children:[e.jsx(a,{value:"viewer",children:"Viewer"}),e.jsx(a,{value:"engineer",children:"Engineer"}),e.jsx(a,{value:"designer",children:"Designer"}),e.jsx(a,{value:"product_manager",children:"Product Manager"}),e.jsx(a,{value:"manager",children:"Manager"}),e.jsx(a,{value:"admin",children:"Admin"})]})]}),e.jsxs(q,{open:D===s.id,onOpenChange:i=>{i||(f(null),y(""))},children:[e.jsx(z,{asChild:!0,children:e.jsx(d,{size:"sm",variant:"outline",onClick:()=>f(s.id),children:e.jsx(Ee,{className:"h-4 w-4"})})}),e.jsxs(B,{children:[e.jsxs(Y,{children:[e.jsx(K,{children:"Reset Password"}),e.jsxs(Q,{children:["Set a new password for ",s.name]})]}),e.jsx("div",{className:"space-y-4 py-4",children:e.jsxs("div",{children:[e.jsx(c,{htmlFor:"reset-password",children:"New Password"}),e.jsx(x,{id:"reset-password",type:"password",value:w,onChange:i=>y(i.target.value),placeholder:"At least 8 characters",minLength:8})]})}),e.jsxs(G,{children:[e.jsx(d,{variant:"outline",onClick:()=>{f(null),y("")},children:"Cancel"}),e.jsx(d,{onClick:ue,children:"Reset Password"})]})]})]}),s.id!==S?.id&&e.jsxs(ge,{children:[e.jsx(je,{asChild:!0,children:e.jsx(d,{size:"sm",variant:"destructive",children:e.jsx(pe,{className:"h-4 w-4"})})}),e.jsxs(ve,{children:[e.jsxs(fe,{children:[e.jsx(we,{children:"Remove User"}),e.jsxs(ye,{children:["Are you sure you want to remove ",s.name," from the whitelist? They will no longer be able to access Coconut."]})]}),e.jsxs(Ce,{children:[e.jsx(Ne,{children:"Cancel"}),e.jsx(Se,{onClick:()=>de(s.id),children:"Remove"})]})]})]})]})]},s.id))})})]}),e.jsxs(m,{children:[e.jsxs(g,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"h-5 w-5"}),e.jsx(j,{children:"Coconut OAuth"})]}),e.jsx(p,{children:'Allow users to sign in with their Coconut control-plane account. Presence of a client ID and the toggle below together determine whether "Continue with Coconut" is offered on the login page.'})]}),e.jsxs(v,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(c,{htmlFor:"coconut-client-id",children:"Client ID"}),e.jsx(x,{id:"coconut-client-id",value:O,onChange:s=>b(s.target.value),placeholder:"Issued by the Coconut control plane"}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["Stored in ",e.jsx("code",{children:"auth.json"}),". Also settable at provisioning time via ",e.jsx("code",{children:"nut init --oauth-client-id <id>"}),"."]})]}),t.providers.oauth.coconut?.issuer&&e.jsxs("div",{className:"rounded-md bg-muted p-3 text-xs font-mono text-muted-foreground space-y-1",children:[e.jsxs("div",{children:["Issuer: ",t.providers.oauth.coconut.issuer]}),t.providers.oauth.coconut.jwksUrl&&e.jsxs("div",{children:["JWKS: ",t.providers.oauth.coconut.jwksUrl]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[e.jsxs("div",{children:[e.jsx(c,{htmlFor:"coconut-oauth-enabled",children:"Enable Coconut OAuth"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:'When enabled, users see a "Continue with Coconut" button on the login page. Takes effect immediately.'})]}),e.jsx(N,{id:"coconut-oauth-enabled",checked:t.providers.oauth.coconut?.enabled??!1,disabled:A,onCheckedChange:s=>W(s)})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(d,{variant:"outline",disabled:A,onClick:()=>W(t.providers.oauth.coconut?.enabled??!1),children:A?"Saving...":"Save Client ID"})})]})]}),e.jsxs(m,{children:[e.jsxs(g,{children:[e.jsx(j,{children:"Session Settings"}),e.jsx(p,{children:"Configure session behavior and security."})]}),e.jsxs(v,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(c,{htmlFor:"session-expiry",children:"Session Expiry"}),e.jsx(x,{id:"session-expiry",value:t.session.expiresIn,onChange:s=>h({...t,session:{...t.session,expiresIn:s.target.value}}),placeholder:"7d"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Format: 30s, 15m, 24h, 7d"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(c,{htmlFor:"secure-cookies",children:"Secure Cookies (HTTPS only)"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Enable in production with HTTPS"})]}),e.jsx(N,{id:"secure-cookies",checked:t.session.secure||!1,onCheckedChange:s=>h({...t,session:{...t.session,secure:s}})})]})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(d,{onClick:xe,disabled:R,children:R?"Saving...":"Save Session Settings"})})]}):e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"Authentication"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"You don't have permission to manage authentication settings."})]})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"Authentication"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Secure your Coconut instance with authentication."})]}),e.jsx(_,{}),e.jsxs(m,{children:[e.jsxs(g,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(be,{className:"h-5 w-5 text-muted-foreground"}),e.jsx(j,{children:"Authentication Not Configured"})]}),e.jsx(p,{children:"Authentication has not been initialized. Use the CLI to set up authentication."})]}),e.jsxs(v,{children:[e.jsx("div",{className:"bg-muted p-4 rounded-md",children:e.jsxs("code",{className:"text-sm",children:["$ nut auth init",e.jsx("br",{}),"$ nut auth toggle"]})}),e.jsx("p",{className:"text-sm text-muted-foreground mt-4",children:"This will create an admin user and enable authentication for your Coconut instance."})]})]})]})}export{Je as default};
@@ -1 +1 @@
1
- import{r as m,j as e,v as x,A as f}from"./index-ByTA2ZiD.js";import{C as w}from"./circle-check-D2LVHMl-.js";import{C as b}from"./circle-x-CuUVLiI-.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
+ import{r as m,j as e,v as x,A as f}from"./index-0zkOcODK.js";import{C as w}from"./circle-check-D7peX4CI.js";import{C as b}from"./circle-x-Oj6Gai3s.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};
@@ -0,0 +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-0zkOcODK.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.access_token)throw new Error("Clerk did not return an access_token");const m=await C("/api/v1/auth/oauth/exchange",{method:"POST",body:JSON.stringify({accessToken:n.access_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};
@@ -0,0 +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-0zkOcODK.js";import{C as g,b as Ne,a as _,c as ye}from"./card-DW9yx9FC.js";import{B as U}from"./badge-DyF_7_dv.js";import{u as we}from"./use-terminal-DkVoTttR.js";import{T as Se}from"./terminal-preview-CspSfoko.js";import{S as Ce,a as be,b as ke,c as Ae,d as w}from"./select-D_L7OXwN.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-CYBx0C_n.js";import{C as Pe,a as ze}from"./chevrons-up-wQrNHZqU.js";import{P as Fe}from"./play-CkuTY54l.js";import{C as Be}from"./code-DcBDG3ah.js";import{C as Re}from"./chevron-up-BrSqNhfU.js";import{S as He}from"./server-CgjJESGe.js";import"./xterm-DTxiCjtJ.js";import"./index-xBQb0rMo.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
+ `).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-ByTA2ZiD.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};
1
+ import{r as x,j as e,e as a,n as m}from"./index-0zkOcODK.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};
@@ -1,4 +1,4 @@
1
- import{c as b,u as Re,a as Le,r as l,j as e,D as De,b as Ie,d as te,e as f,f as ae,g as ne,S as re,B as d,C as le,I as B,h as G,i as Pe,G as _e,F as qe,k as ue,Z as We,l as ze,m as Fe,T as ce,n as Ve,o as Be,L as v,P as Ee,M as Ke,K as A,p as g,q as $e,A as Ge}from"./index-ByTA2ZiD.js";import{C as h,a as u,b as R,c as L,d as ie}from"./card-CL5bB4cs.js";import{B as He}from"./badge-BbfU_aPt.js";import{g as Oe}from"./status-utils-PwF3DXLL.js";import{L as Ye}from"./label-Dp0-28_O.js";import{S as oe,a as de,b as me,c as xe,d as E}from"./select-CfwLZl55.js";import{u as Qe}from"./use-terminal-D1UnvAVs.js";import{T as Ue}from"./terminal-preview-BNm5-Umi.js";import{C as Ze}from"./circle-check-D2LVHMl-.js";import{C as Je}from"./chevron-left-B-7K6MNx.js";import{S as Xe}from"./search-BgbqRUnf.js";import{G as es}from"./globe-lpD9Jv31.js";import{C as ss}from"./code-DqYaanki.js";import{F as ts}from"./folder-git-2-Cizv1NA6.js";import{E as as}from"./external-link-CrRz0sU-.js";import{P as ns}from"./play-fOwEoIcu.js";import{C as rs}from"./clock-D-X3KCw6.js";import{C as ls}from"./circle-check-big-BwQ_q1N7.js";import"./index-CuLP7P_G.js";import"./chevron-up-BwTmMEW2.js";import"./xterm-DTxiCjtJ.js";/**
1
+ import{c as b,u as Re,a as Le,r as l,j as e,D as De,b as Ie,d as te,e as f,f as ae,g as ne,S as re,B as d,C as le,I as B,h as G,i as Pe,G as _e,F as qe,k as ue,Z as We,l as ze,m as Fe,T as ce,n as Ve,o as Be,L as v,P as Ee,M as Ke,K as A,p as g,q as $e,A as Ge}from"./index-0zkOcODK.js";import{C as h,a as u,b as R,c as L,d as ie}from"./card-DW9yx9FC.js";import{B as He}from"./badge-DyF_7_dv.js";import{g as Oe}from"./status-utils-PwF3DXLL.js";import{L as Ye}from"./label-DyhnItJm.js";import{S as oe,a as de,b as me,c as xe,d as E}from"./select-D_L7OXwN.js";import{u as Qe}from"./use-terminal-DkVoTttR.js";import{T as Ue}from"./terminal-preview-CspSfoko.js";import{C as Ze}from"./circle-check-D7peX4CI.js";import{C as Je}from"./chevron-left-CJjrbO2y.js";import{S as Xe}from"./search-DxiQuWo1.js";import{G as es}from"./globe-C3j3aWiD.js";import{C as ss}from"./code-DcBDG3ah.js";import{F as ts}from"./folder-git-2-BBe22u2y.js";import{E as as}from"./external-link-DDneC3kx.js";import{P as ns}from"./play-CkuTY54l.js";import{C as rs}from"./clock-JhtahL2B.js";import{C as ls}from"./circle-check-big--yqXPZzU.js";import"./index-xBQb0rMo.js";import"./chevron-up-BrSqNhfU.js";import"./xterm-DTxiCjtJ.js";/**
2
2
  * @license lucide-react v0.542.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.