@lovelybunch/api 1.0.75 → 1.0.76-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/storage/file-storage.d.ts +1 -0
- package/dist/lib/storage/file-storage.js +9 -1
- package/dist/routes/api/v1/mail/route.d.ts +3 -3
- package/dist/routes/api/v1/slack/route.d.ts +6 -6
- package/dist/routes/api/v1/tasks/[id]/route.d.ts +2 -2
- package/dist/routes/api/v1/tasks/[id]/steps/[stepId]/route.d.ts +60 -0
- package/dist/routes/api/v1/tasks/[id]/steps/[stepId]/route.js +81 -0
- package/dist/routes/api/v1/tasks/index.js +2 -0
- package/dist/routes/api/v1/tasks/route.d.ts +2 -2
- package/package.json +4 -4
- package/static/assets/{ActivityPage-k4I7Q53O.js → ActivityPage-DxajSxG1.js} +1 -1
- package/static/assets/{ApiKeysSettingsPage-B1YvVdmg.js → ApiKeysSettingsPage-DiBqSUMz.js} +1 -1
- package/static/assets/{ArchitectureEditPage-CpowsIx2.js → ArchitectureEditPage-iflIJaCh.js} +1 -1
- package/static/assets/{ArchitecturePage-DYxC_aMR.js → ArchitecturePage-oB3FtdZ7.js} +1 -1
- package/static/assets/{AuthSettingsPage-DtSo78Y_.js → AuthSettingsPage-BY7x-6wd.js} +1 -1
- package/static/assets/{CallbackPage-bROCGapx.js → CallbackPage-CYcV3OHa.js} +1 -1
- package/static/assets/{CodePage-CPCj64rX.js → CodePage-DxJYFhiT.js} +1 -1
- package/static/assets/{CollapsibleSection-M5cXbl92.js → CollapsibleSection-BLZv27JC.js} +1 -1
- package/static/assets/{DashboardPage-B9BZZfw6.js → DashboardPage-BdsK2Vor.js} +1 -1
- package/static/assets/{GitPage-BiDtdSK1.js → GitPage-CKIIMGjF.js} +1 -1
- package/static/assets/{GitSettingsPage-THm6wDjs.js → GitSettingsPage-sI4uzGzt.js} +1 -1
- package/static/assets/{IdentityPage-BC16skg6.js → IdentityPage-vzzaKU2-.js} +1 -1
- package/static/assets/ImplementationStepsEditor-BMHTxNEX.js +6 -0
- package/static/assets/{IntegrationsSettingsPage-CC_VKIQa.js → IntegrationsSettingsPage-BzuUrHO1.js} +1 -1
- package/static/assets/{JobDetailPage-z1QQYvmU.js → JobDetailPage-C-IKmhAF.js} +1 -1
- package/static/assets/{KnowledgeDetailPage-DzHXBS7Q.js → KnowledgeDetailPage-C1RHtPzz.js} +1 -1
- package/static/assets/{KnowledgeEditPage-BwGnUH_m.js → KnowledgeEditPage-D3gIqqKn.js} +1 -1
- package/static/assets/{KnowledgePage-CGIVMS02.js → KnowledgePage-DJphs1Kg.js} +1 -1
- package/static/assets/{LoginPage-VQ3lcfLV.js → LoginPage-DVaToPHL.js} +1 -1
- package/static/assets/{MailInboxPage-DiZKqwdU.js → MailInboxPage-I-MbS647.js} +1 -1
- package/static/assets/{MailProcessingModal-DIeSQBoR.js → MailProcessingModal-DXtDHWM_.js} +1 -1
- package/static/assets/{MailReadPage-C8AACmZQ.js → MailReadPage-DUN8EQjl.js} +1 -1
- package/static/assets/{MailSentPage-C_5yFly_.js → MailSentPage-DsGgBGBQ.js} +1 -1
- package/static/assets/{McpSettingsPage-i9YHcu1s.js → McpSettingsPage-d66ZIwm7.js} +1 -1
- package/static/assets/{NewKnowledgePage-BnVY7WUD.js → NewKnowledgePage-WbN6BikQ.js} +1 -1
- package/static/assets/{NewSkillPage-DwniHD6D.js → NewSkillPage-DesCsYgS.js} +1 -1
- package/static/assets/NewTaskPage-CrmiPuuw.js +91 -0
- package/static/assets/{NotFoundPage-BbSZX_4L.js → NotFoundPage-BcTtqwNP.js} +1 -1
- package/static/assets/{NotificationsSettingsPage-C8kjcift.js → NotificationsSettingsPage-BeJw7gY7.js} +1 -1
- package/static/assets/{ProjectEditPage-DUUlIEqI.js → ProjectEditPage-DiHz-pYk.js} +1 -1
- package/static/assets/{ProjectPage-Unz9PQpA.js → ProjectPage-CKaHBZlw.js} +1 -1
- package/static/assets/{PromptsSettingsPage-DVpIuRKI.js → PromptsSettingsPage-B_Opt_KA.js} +1 -1
- package/static/assets/{ResourceDetailPage-DqHZ2KYD.js → ResourceDetailPage-BSeDQxri.js} +1 -1
- package/static/assets/{ResourcesPage-BP5tuAi-.js → ResourcesPage-YmerqN0J.js} +1 -1
- package/static/assets/{RoleEditPage-BgKu8S0-.js → RoleEditPage-Bm7HG4sg.js} +1 -1
- package/static/assets/{RolePage-Fed52Ov5.js → RolePage-DoN5_uka.js} +1 -1
- package/static/assets/{RulesSettingsPage-BQ2O0u66.js → RulesSettingsPage-yQELBKgb.js} +1 -1
- package/static/assets/{SchedulePage-jkxjuzBx.js → SchedulePage-nmchdGUK.js} +1 -1
- package/static/assets/{SkillDetailPage-k3Q2-NFd.js → SkillDetailPage-BFjBVPS8.js} +1 -1
- package/static/assets/{SkillEditPage-urF4snjo.js → SkillEditPage-CjpscD5K.js} +1 -1
- package/static/assets/{SkillsPage-DlWDhEjR.js → SkillsPage-Dr_uyKVB.js} +1 -1
- package/static/assets/{SkillsSettingsPage-BViFgckG.js → SkillsSettingsPage-BknrbJBC.js} +1 -1
- package/static/assets/{SourceInput-CAFKTHw-.js → SourceInput-LclyzQLW.js} +1 -1
- package/static/assets/{TagInput-C6lI-ePr.js → TagInput-BZ6JyIo1.js} +1 -1
- package/static/assets/{TaskDetailPage-DpbRHnW_.js → TaskDetailPage-D97oWW98.js} +1 -1
- package/static/assets/{TaskEditPage-DssRbW0h.js → TaskEditPage-BTfzRYwM.js} +1 -1
- package/static/assets/{TasksPage-CD_eo0Bj.js → TasksPage-COvedmQz.js} +1 -1
- package/static/assets/{TerminalPage-BG_wlccr.js → TerminalPage-DhbOmISZ.js} +1 -1
- package/static/assets/{TerminalSessionPage-CsK-LznK.js → TerminalSessionPage-D2rZb8Ej.js} +1 -1
- package/static/assets/{UserPreferencesPage-CWUq3efu.js → UserPreferencesPage-CgtsVqvs.js} +1 -1
- package/static/assets/{UserSettingsPage-CduI_MGS.js → UserSettingsPage-AXLWqe0G.js} +1 -1
- package/static/assets/{UtilitiesPage-BAxokhLh.js → UtilitiesPage-CxQkYrza.js} +1 -1
- package/static/assets/{alert-BXsc6_qu.js → alert-BUrHsk9_.js} +1 -1
- package/static/assets/{arrow-down-DmW_3gE8.js → arrow-down-J9YP8VW9.js} +1 -1
- package/static/assets/{arrow-left-1S-835kP.js → arrow-left-RAzvFXpe.js} +1 -1
- package/static/assets/{arrow-up-BYism_o1.js → arrow-up-CjXXRPYC.js} +1 -1
- package/static/assets/{arrow-up-down-Dw3J0a4i.js → arrow-up-down-BRoDh-fK.js} +1 -1
- package/static/assets/{badge-BUEY53dV.js → badge-CA-A_JCd.js} +1 -1
- package/static/assets/{browser-modal-DCNdI4NT.js → browser-modal-DVtwh2h7.js} +1 -1
- package/static/assets/{card-BcPlIAH5.js → card-DdrUHBUG.js} +1 -1
- package/static/assets/{chevron-left-FMmNe7yP.js → chevron-left-C4bGr2Al.js} +1 -1
- package/static/assets/{chevron-up-CqM3won3.js → chevron-up-CPpQ_jgb.js} +1 -1
- package/static/assets/{chevrons-up-DTvCkIHc.js → chevrons-up-C8oR0iOR.js} +1 -1
- package/static/assets/{circle-alert-dseM-Ib7.js → circle-alert-B3zeVGHG.js} +1 -1
- package/static/assets/{circle-check-eyo6pBP1.js → circle-check-OfRBf8tJ.js} +1 -1
- package/static/assets/{circle-check-big-jKg34xC-.js → circle-check-big-CeVxJ4hA.js} +1 -1
- package/static/assets/{circle-play-BrY_lNiH.js → circle-play-C_Chmziu.js} +1 -1
- package/static/assets/{circle-x-uqmzEce1.js → circle-x-CtfEmATn.js} +1 -1
- package/static/assets/{clipboard-tzPFoieb.js → clipboard-Z_0Z5-r1.js} +1 -1
- package/static/assets/{clock-Bjc06QBM.js → clock-B43LjbrK.js} +1 -1
- package/static/assets/{code-DrYqPukx.js → code-D77i0toJ.js} +1 -1
- package/static/assets/{download-Bg__QCLT.js → download-C8rLaNF6.js} +1 -1
- package/static/assets/{external-link-CNDy2UUo.js → external-link-D6UvIQYD.js} +1 -1
- package/static/assets/{eye-DLFBnC8t.js → eye-C3fWwYx-.js} +1 -1
- package/static/assets/{folder-git-2-DUqd0WRi.js → folder-git-2-Crtn4eyJ.js} +1 -1
- package/static/assets/{index-DFcWlnzl.js → index-SWBrq2bx.js} +3 -3
- package/static/assets/{info-D6jxZC5X.js → info-BZi8bEGv.js} +1 -1
- package/static/assets/{label-DBuh-ke5.js → label-C8Wxd6GE.js} +1 -1
- package/static/assets/{markdown-editor-B4YNQFT2.js → markdown-editor-DAk7M9Ju.js} +1 -1
- package/static/assets/{message-square-B5RWz_ff.js → message-square-BpqFAvyq.js} +1 -1
- package/static/assets/{paperclip-4A_3MaPx.js → paperclip-Dk7jEYtI.js} +1 -1
- package/static/assets/{pause-BzhKXHtR.js → pause-CX3StCWt.js} +1 -1
- package/static/assets/{play-CHIf-Rcz.js → play-CRPN1vUy.js} +1 -1
- package/static/assets/{radio-group-C1ct-VsJ.js → radio-group-DFIfCEpZ.js} +1 -1
- package/static/assets/{refresh-cw-B3OwrDUf.js → refresh-cw-DGBXSYy5.js} +1 -1
- package/static/assets/{search-Cq1ksEdp.js → search-C9jI6Lg7.js} +1 -1
- package/static/assets/{select-44mcS2_G.js → select-DgNHsbaX.js} +1 -1
- package/static/assets/status-utils-PwF3DXLL.js +1 -0
- package/static/assets/{switch-CIwjYvCt.js → switch-C2zPfM3G.js} +1 -1
- package/static/assets/{tabs-DTV6Su-h.js → tabs-B7fjkp5h.js} +1 -1
- package/static/assets/{tag-p6yeowCW.js → tag-BOwlwHfi.js} +1 -1
- package/static/assets/{terminal-preview-DN38x9Jm.js → terminal-preview-BvBQu5Sd.js} +1 -1
- package/static/assets/{use-terminal-BXJqOeJe.js → use-terminal-xv9qDaX1.js} +1 -1
- package/static/assets/{video-BH5ChaoS.js → video-CW0zFsfp.js} +1 -1
- package/static/index.html +1 -1
- package/static/assets/ImplementationStepsEditor-HliLQav5.js +0 -6
- package/static/assets/NewTaskPage-F5UX2WMc.js +0 -90
- package/static/assets/status-utils-CDkPeVfP.js +0 -1
|
@@ -25,6 +25,7 @@ export declare class FileStorageAdapter implements StorageAdapter {
|
|
|
25
25
|
deleteTask(id: string): Promise<void>;
|
|
26
26
|
listTasks(filter?: TaskFilter): Promise<Task[]>;
|
|
27
27
|
searchTasks(query: string): Promise<Task[]>;
|
|
28
|
+
private normalizeStepStatus;
|
|
28
29
|
private frontmatterToTask;
|
|
29
30
|
private getDefaultContent;
|
|
30
31
|
}
|
|
@@ -224,6 +224,14 @@ export class FileStorageAdapter {
|
|
|
224
224
|
});
|
|
225
225
|
return fuse.search(query).map(result => result.item);
|
|
226
226
|
}
|
|
227
|
+
normalizeStepStatus(status) {
|
|
228
|
+
const legacyMap = {
|
|
229
|
+
'in-progress': 'active',
|
|
230
|
+
'completed': 'done',
|
|
231
|
+
};
|
|
232
|
+
const raw = status || 'pending';
|
|
233
|
+
return (legacyMap[raw] || raw);
|
|
234
|
+
}
|
|
227
235
|
frontmatterToTask(data, content) {
|
|
228
236
|
// Handle both old format (plan.steps) and new format (top-level steps)
|
|
229
237
|
const steps = data.steps || data.plan?.steps || [];
|
|
@@ -252,7 +260,7 @@ export class FileStorageAdapter {
|
|
|
252
260
|
planSteps: steps.map((step) => ({
|
|
253
261
|
id: step.id || `step-${Date.now()}`,
|
|
254
262
|
description: step.description || step.title || 'Unnamed step',
|
|
255
|
-
status: step.status
|
|
263
|
+
status: this.normalizeStepStatus(step.status),
|
|
256
264
|
command: step.command,
|
|
257
265
|
expectedOutcome: step.expectedOutcome,
|
|
258
266
|
output: step.output,
|
|
@@ -116,7 +116,7 @@ export declare function setMailStatusHandler(c: Context): Promise<(Response & im
|
|
|
116
116
|
}, import("hono/utils/http-status").ContentfulStatusCode, "json">) | (Response & import("hono").TypedResponse<{
|
|
117
117
|
success: false;
|
|
118
118
|
error: any;
|
|
119
|
-
},
|
|
119
|
+
}, 500 | 404, "json">)>;
|
|
120
120
|
/**
|
|
121
121
|
* POST /api/v1/mail/:id/reply
|
|
122
122
|
* Reply to an email
|
|
@@ -154,7 +154,7 @@ export declare function replyMailHandler(c: Context): Promise<(Response & import
|
|
|
154
154
|
}, import("hono/utils/http-status").ContentfulStatusCode, "json">) | (Response & import("hono").TypedResponse<{
|
|
155
155
|
success: false;
|
|
156
156
|
error: any;
|
|
157
|
-
},
|
|
157
|
+
}, 500 | 404, "json">)>;
|
|
158
158
|
/**
|
|
159
159
|
* POST /api/v1/mail/send
|
|
160
160
|
* Send an email (coming soon)
|
|
@@ -217,7 +217,7 @@ export declare function setMailActionHandler(c: Context): Promise<(Response & im
|
|
|
217
217
|
}, import("hono/utils/http-status").ContentfulStatusCode, "json">) | (Response & import("hono").TypedResponse<{
|
|
218
218
|
success: false;
|
|
219
219
|
error: any;
|
|
220
|
-
},
|
|
220
|
+
}, 500 | 404, "json">)>;
|
|
221
221
|
/**
|
|
222
222
|
* GET /api/v1/mail/:id/processing
|
|
223
223
|
* Get processing status and log tail for an email
|
|
@@ -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
|
};
|
|
@@ -24,7 +24,7 @@ export declare function GET(c: Context): Promise<(Response & import("hono").Type
|
|
|
24
24
|
description: string;
|
|
25
25
|
command?: string;
|
|
26
26
|
expectedOutcome?: string;
|
|
27
|
-
status: "pending" | "
|
|
27
|
+
status: "pending" | "active" | "done" | "failed" | "skipped";
|
|
28
28
|
output?: string;
|
|
29
29
|
error?: string;
|
|
30
30
|
executedAt?: string;
|
|
@@ -71,7 +71,7 @@ export declare function PATCH(c: Context): Promise<(Response & import("hono").Ty
|
|
|
71
71
|
description: string;
|
|
72
72
|
command?: string;
|
|
73
73
|
expectedOutcome?: string;
|
|
74
|
-
status: "pending" | "
|
|
74
|
+
status: "pending" | "active" | "done" | "failed" | "skipped";
|
|
75
75
|
output?: string;
|
|
76
76
|
error?: string;
|
|
77
77
|
executedAt?: string;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Context } from 'hono';
|
|
2
|
+
export declare function PATCH(c: Context): Promise<(Response & import("hono").TypedResponse<{
|
|
3
|
+
success: false;
|
|
4
|
+
error: {
|
|
5
|
+
code: string;
|
|
6
|
+
message: string;
|
|
7
|
+
};
|
|
8
|
+
}, 404, "json">) | (Response & import("hono").TypedResponse<{
|
|
9
|
+
success: false;
|
|
10
|
+
error: {
|
|
11
|
+
code: string;
|
|
12
|
+
message: string;
|
|
13
|
+
};
|
|
14
|
+
}, 400, "json">) | (Response & import("hono").TypedResponse<{
|
|
15
|
+
success: true;
|
|
16
|
+
data: {
|
|
17
|
+
id: string;
|
|
18
|
+
title: string;
|
|
19
|
+
intent?: string;
|
|
20
|
+
content?: string;
|
|
21
|
+
author: {
|
|
22
|
+
type: import("@lovelybunch/core").AuthorType;
|
|
23
|
+
id: string;
|
|
24
|
+
name: string;
|
|
25
|
+
email?: string;
|
|
26
|
+
};
|
|
27
|
+
productSpecRef?: string;
|
|
28
|
+
planSteps: {
|
|
29
|
+
id: string;
|
|
30
|
+
description: string;
|
|
31
|
+
command?: string;
|
|
32
|
+
expectedOutcome?: string;
|
|
33
|
+
status: "pending" | "active" | "done" | "failed" | "skipped";
|
|
34
|
+
output?: string;
|
|
35
|
+
error?: string;
|
|
36
|
+
executedAt?: string;
|
|
37
|
+
}[];
|
|
38
|
+
status: import("@lovelybunch/core").TaskStatus;
|
|
39
|
+
comments?: {
|
|
40
|
+
id: string;
|
|
41
|
+
author: string;
|
|
42
|
+
content: string;
|
|
43
|
+
createdAt: string;
|
|
44
|
+
}[];
|
|
45
|
+
metadata: {
|
|
46
|
+
createdAt: string;
|
|
47
|
+
updatedAt: string;
|
|
48
|
+
reviewers: string[];
|
|
49
|
+
tags?: string[];
|
|
50
|
+
priority?: "low" | "medium" | "high" | "critical";
|
|
51
|
+
readiness?: number;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
}, import("hono/utils/http-status").ContentfulStatusCode, "json">) | (Response & import("hono").TypedResponse<{
|
|
55
|
+
success: false;
|
|
56
|
+
error: {
|
|
57
|
+
code: string;
|
|
58
|
+
message: any;
|
|
59
|
+
};
|
|
60
|
+
}, 500, "json">)>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { FileStorageAdapter } from '../../../../../../../lib/storage/file-storage.js';
|
|
2
|
+
import { getLogger } from '@lovelybunch/core/logging';
|
|
3
|
+
const storage = new FileStorageAdapter();
|
|
4
|
+
export async function PATCH(c) {
|
|
5
|
+
try {
|
|
6
|
+
const id = c.req.param('id');
|
|
7
|
+
const stepId = c.req.param('stepId');
|
|
8
|
+
const updates = await c.req.json();
|
|
9
|
+
const task = await storage.getTask(id);
|
|
10
|
+
if (!task) {
|
|
11
|
+
return c.json({
|
|
12
|
+
success: false,
|
|
13
|
+
error: {
|
|
14
|
+
code: 'TASK_NOT_FOUND',
|
|
15
|
+
message: `Task with id ${id} not found`
|
|
16
|
+
}
|
|
17
|
+
}, 404);
|
|
18
|
+
}
|
|
19
|
+
const stepIndex = (task.planSteps || []).findIndex((s) => s.id === stepId);
|
|
20
|
+
if (stepIndex === -1) {
|
|
21
|
+
return c.json({
|
|
22
|
+
success: false,
|
|
23
|
+
error: {
|
|
24
|
+
code: 'STEP_NOT_FOUND',
|
|
25
|
+
message: `Step ${stepId} not found on task ${id}`
|
|
26
|
+
}
|
|
27
|
+
}, 404);
|
|
28
|
+
}
|
|
29
|
+
const validStatuses = ['pending', 'active', 'done', 'failed', 'skipped'];
|
|
30
|
+
if (updates.status && !validStatuses.includes(updates.status)) {
|
|
31
|
+
return c.json({
|
|
32
|
+
success: false,
|
|
33
|
+
error: {
|
|
34
|
+
code: 'INVALID_STATUS',
|
|
35
|
+
message: `Invalid step status: ${updates.status}. Valid: ${validStatuses.join(', ')}`
|
|
36
|
+
}
|
|
37
|
+
}, 400);
|
|
38
|
+
}
|
|
39
|
+
const existingStep = task.planSteps[stepIndex];
|
|
40
|
+
const updatedStep = {
|
|
41
|
+
...existingStep,
|
|
42
|
+
...Object.fromEntries(Object.entries(updates).filter(([, v]) => v !== undefined)),
|
|
43
|
+
};
|
|
44
|
+
if (updates.status && ['done', 'failed'].includes(updates.status) && !updatedStep.executedAt) {
|
|
45
|
+
updatedStep.executedAt = new Date();
|
|
46
|
+
}
|
|
47
|
+
const updatedSteps = [...task.planSteps];
|
|
48
|
+
updatedSteps[stepIndex] = updatedStep;
|
|
49
|
+
await storage.updateTask(id, { planSteps: updatedSteps });
|
|
50
|
+
const updatedTask = await storage.getTask(id);
|
|
51
|
+
const logger = getLogger();
|
|
52
|
+
logger.log({
|
|
53
|
+
kind: 'task.update',
|
|
54
|
+
actor: task.author?.type === 'agent'
|
|
55
|
+
? `agent:${task.author.name}`
|
|
56
|
+
: `human:${task.author?.email || 'unknown'}`,
|
|
57
|
+
subject: `task:${id}`,
|
|
58
|
+
tags: ['task', 'step'],
|
|
59
|
+
payload: {
|
|
60
|
+
id,
|
|
61
|
+
action: 'update_plan_step',
|
|
62
|
+
stepId,
|
|
63
|
+
changes: Object.keys(updates),
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
return c.json({
|
|
67
|
+
success: true,
|
|
68
|
+
data: updatedTask
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
console.error('Error updating step:', error);
|
|
73
|
+
return c.json({
|
|
74
|
+
success: false,
|
|
75
|
+
error: {
|
|
76
|
+
code: 'UPDATE_STEP_ERROR',
|
|
77
|
+
message: error.message
|
|
78
|
+
}
|
|
79
|
+
}, 500);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Hono } from 'hono';
|
|
2
2
|
import { GET, POST } from './route.js';
|
|
3
3
|
import { GET as getTask, PATCH as patchTask, DELETE as deleteTask } from './[id]/route.js';
|
|
4
|
+
import { PATCH as patchStep } from './[id]/steps/[stepId]/route.js';
|
|
4
5
|
const tasks = new Hono();
|
|
5
6
|
tasks.get('/', GET);
|
|
6
7
|
tasks.post('/', POST);
|
|
7
8
|
tasks.get('/:id', getTask);
|
|
8
9
|
tasks.patch('/:id', patchTask);
|
|
9
10
|
tasks.delete('/:id', deleteTask);
|
|
11
|
+
tasks.patch('/:id/steps/:stepId', patchStep);
|
|
10
12
|
export default tasks;
|
|
@@ -19,7 +19,7 @@ export declare function GET(c: Context): Promise<(Response & import("hono").Type
|
|
|
19
19
|
description: string;
|
|
20
20
|
command?: string;
|
|
21
21
|
expectedOutcome?: string;
|
|
22
|
-
status: "pending" | "
|
|
22
|
+
status: "pending" | "active" | "done" | "failed" | "skipped";
|
|
23
23
|
output?: string;
|
|
24
24
|
error?: string;
|
|
25
25
|
executedAt?: string;
|
|
@@ -66,7 +66,7 @@ export declare function POST(c: Context): Promise<(Response & import("hono").Typ
|
|
|
66
66
|
description: string;
|
|
67
67
|
command?: string;
|
|
68
68
|
expectedOutcome?: string;
|
|
69
|
-
status: "pending" | "
|
|
69
|
+
status: "pending" | "active" | "done" | "failed" | "skipped";
|
|
70
70
|
output?: string;
|
|
71
71
|
error?: string;
|
|
72
72
|
executedAt?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lovelybunch/api",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.76-alpha.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/server-with-static.js",
|
|
6
6
|
"exports": {
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"@ai-sdk/anthropic": "^3.0.41",
|
|
38
38
|
"@hono/node-server": "^1.13.7",
|
|
39
39
|
"@hono/node-ws": "^1.0.6",
|
|
40
|
-
"@lovelybunch/core": "^1.0.
|
|
41
|
-
"@lovelybunch/mcp": "^1.0.
|
|
42
|
-
"@lovelybunch/types": "^1.0.
|
|
40
|
+
"@lovelybunch/core": "^1.0.76-alpha.0",
|
|
41
|
+
"@lovelybunch/mcp": "^1.0.76-alpha.0",
|
|
42
|
+
"@lovelybunch/types": "^1.0.76-alpha.0",
|
|
43
43
|
"adm-zip": "^0.5.16",
|
|
44
44
|
"ai": "^6.0.79",
|
|
45
45
|
"arctic": "^1.9.2",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,A as p,j as e,t as y,bu as v,B as N,n as w,C as b}from"./index-
|
|
1
|
+
import{r as a,A as p,j as e,t as y,bu as v,B as N,n as w,C as b}from"./index-SWBrq2bx.js";import{C as c,a as d,b as k,c as C}from"./card-DdrUHBUG.js";import{B as m}from"./badge-CA-A_JCd.js";import{R as E}from"./refresh-cw-DGBXSYy5.js";const A=5e3;function $(){const[n,o]=a.useState([]),[i,x]=a.useState(!0),[u,h]=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=>{h(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(y,{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(v,{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=u.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,2 +1,2 @@
|
|
|
1
|
-
import{s as R,r as t,b0 as y,j as e,B as a,P as W,b1 as X,E as Y,D as j,b as g,d as v,f,g as A,I as F,W as N,af as J,v as i}from"./index-
|
|
1
|
+
import{s as R,r as t,b0 as y,j as e,B as a,P as W,b1 as X,E as Y,D as j,b as g,d as v,f,g as A,I as F,W as N,af as J,v as i}from"./index-SWBrq2bx.js";import{C as G,b as Q,c as V,d as Z,a as _}from"./card-DdrUHBUG.js";import{L as w}from"./label-C8Wxd6GE.js";import{B as ee}from"./badge-CA-A_JCd.js";import{A as I,a as C}from"./alert-BUrHsk9_.js";import{I as L}from"./info-BZi8bEGv.js";import{C as se}from"./circle-alert-B3zeVGHG.js";function oe(){const{authEnabled:n}=R(),[P,k]=t.useState([]),[b,K]=t.useState(!0),[O,l]=t.useState(!1),[M,d]=t.useState(!1),[x,D]=t.useState(""),[h,E]=t.useState("never"),[c,S]=t.useState(null),[m,o]=t.useState(null);t.useEffect(()=>{p()},[]);const p=async()=>{K(!0);try{const s=await y("/api/v1/api-keys");s.success&&k(s.data?.apiKeys||[])}catch(s){console.error("Failed to load API keys:",s),k([])}finally{K(!1)}},U=async()=>{if(!x.trim()){i({title:"Error",description:"Please provide a name for the API key",variant:"destructive"});return}try{const s={name:x,scopes:["*"]};h!=="never"&&(s.expiresIn=h);const r=await y("/api/v1/api-keys",{method:"POST",body:JSON.stringify(s)});r.success&&(S(r.data),l(!1),d(!0),D(""),E("never"),await p(),i({title:"API Key Created",description:"Make sure to copy your API key now. You won't be able to see it again!"}))}catch(s){console.error("Failed to create API key:",s),i({title:"Error",description:"Failed to create API key",variant:"destructive"})}},B=async s=>{try{(await y(`/api/v1/api-keys/${s}`,{method:"DELETE"})).success&&(await p(),o(null),i({title:"API Key Deleted",description:"The API key has been permanently deleted"}))}catch(r){console.error("Failed to delete API key:",r),i({title:"Error",description:"Failed to delete API key",variant:"destructive"})}},H=async s=>{try{await navigator.clipboard.writeText(s),i({title:"Copied",description:"API key copied to clipboard"})}catch{i({title:"Error",description:"Failed to copy to clipboard",variant:"destructive"})}},u=s=>new Date(s).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),$=s=>s?new Date(s)<new Date:!1,q=typeof window<"u"?window.location.origin:"http://localhost:3000",z=c?`curl -H "X-API-Key: ${c.key}" \\
|
|
2
2
|
+ ${q}/api/v1/tasks`:"",T=n?null:e.jsxs(I,{children:[e.jsx(L,{className:"h-4 w-4"}),e.jsxs(C,{children:["Authentication is currently disabled. API keys will only be required once you enable authentication in the ",e.jsx("a",{href:"/settings/authentication",className:"underline",children:"Authentication settings"}),"."]})]});return!n&&b?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"API Keys"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage API keys for programmatic access"})]}),T]}):b?e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"API Keys"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."})]})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"API Keys"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage API keys for programmatic access to your Coconut instance"})]}),T,n&&e.jsxs(I,{children:[e.jsx(L,{className:"h-4 w-4"}),e.jsxs(C,{children:["API keys provide programmatic access to your Coconut instance. Use them in CI/CD pipelines or automation scripts by including the key in the ",e.jsx("code",{className:"bg-muted px-1 py-0.5 rounded",children:"X-API-Key"})," header."]})]}),e.jsxs(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(W,{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}),$(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(Y,{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(J,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[e.jsx("p",{className:"mb-2",children:"Usage example:"}),e.jsx("pre",{className:"bg-muted p-3 rounded-md whitespace-pre-wrap break-words",children:e.jsx("code",{className:"font-mono text-xs",children:z})})]})]}),e.jsx(N,{children:e.jsx(a,{onClick:()=>{d(!1),S(null)},children:"I've Saved My Key"})})]})}),e.jsx(j,{open:!!m,onOpenChange:s=>!s&&o(null),children:e.jsxs(g,{children:[e.jsxs(v,{children:[e.jsx(f,{children:"Delete API Key"}),e.jsx(A,{children:"Are you sure you want to delete this API key? This action cannot be undone and any scripts using this key will stop working."})]}),e.jsxs(N,{children:[e.jsx(a,{variant:"outline",onClick:()=>o(null),children:"Cancel"}),e.jsx(a,{variant:"destructive",onClick:()=>m&&B(m),children:"Delete API Key"})]})]})})]})}export{oe as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{u as D,a as M,r as l,A as b,j as e,B as S,L as I,a0 as _,I as d,o as B}from"./index-
|
|
1
|
+
import{u as D,a as M,r as l,A as b,j as e,B as S,L as I,a0 as _,I as d,o as B}from"./index-SWBrq2bx.js";import{C as u,a as p,b as j,c as v}from"./card-DdrUHBUG.js";import{L as o}from"./label-C8Wxd6GE.js";import{M as P}from"./markdown-editor-DAk7M9Ju.js";import{A as R}from"./arrow-left-RAzvFXpe.js";import{C as $}from"./circle-check-big-CeVxJ4hA.js";function Q(){const F=D(),{toast:h}=M(),[n,x]=l.useState({stack:{runtime:"",framework:"",language:"",database:"",deployment:"",repository:""},commands:{}}),[y,f]=l.useState(""),[E,k]=l.useState(""),[L,N]=l.useState(!0),[C,w]=l.useState(!1);l.useEffect(()=>{fetch(`${b}/api/v1/context/architecture`).then(t=>t.json()).then(t=>{if(t.success){const a=t.document,m={stack:{runtime:a.metadata.stack?.runtime||"",framework:a.metadata.stack?.framework||"",language:a.metadata.stack?.language||"",database:a.metadata.stack?.database||"",deployment:a.metadata.stack?.deployment||"",repository:a.metadata.stack?.repository||""},commands:a.metadata.commands||{}};x(m);const s=Object.entries(m.commands).map(([r,c])=>`${r}: ${c}`).join(`
|
|
2
2
|
`);k(s),f(a.content.trim())}N(!1)}).catch(t=>{console.error("Failed to load context:",t),h({title:"Error",description:"Failed to load architecture documentation",variant:"destructive"}),N(!1)})},[h]);const A=async()=>{w(!0);try{const a=await(await fetch(`${b}/api/v1/context/architecture`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:y,metadata:{stack:n.stack,commands:n.commands}})})).json();if(a.success)h({title:"Success",description:"Architecture documentation saved successfully",action:e.jsx($,{className:"h-4 w-4"})}),F("/context/architecture");else throw new Error(a.error||"Failed to save context")}catch(t){console.error("Save error:",t),h({title:"Error",description:"Failed to save architecture documentation",variant:"destructive"})}finally{w(!1)}},i=(t,a)=>{x(m=>{const s={...m},r=t.split(".");let c=s;for(let g=0;g<r.length-1;g++)c=c[r[g]];return c[r[r.length-1]]=a,s})},T=t=>{k(t);const a={};t.split(`
|
|
3
3
|
`).filter(s=>s.trim()).forEach(s=>{const[r,...c]=s.split(":");r&&c.length>0&&(a[r.trim()]=c.join(":").trim())}),x(s=>({...s,commands:a}))};return L?e.jsx("div",{className:"space-y-6",children:e.jsx(u,{children:e.jsx(p,{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 Architecture"}),e.jsx("p",{className:"text-muted-foreground text-sm hidden sm:block",children:"Edit technical architecture and supporting metadata"})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(S,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(I,{to:"/context/architecture",className:"text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(R,{className:"w-4 h-4"})})}),e.jsxs(S,{onClick:A,disabled:C,size:"sm",children:[e.jsx(_,{className:"w-4 h-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:C?"Saving...":"Save"})]})]})]}),e.jsxs(u,{children:[e.jsx(j,{children:e.jsx(v,{children:"Technology Stack"})}),e.jsxs(p,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"runtime",children:"Runtime"}),e.jsx(d,{id:"runtime",value:n.stack.runtime,onChange:t=>i("stack.runtime",t.target.value),placeholder:"node|python|go|etc"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"framework",children:"Framework"}),e.jsx(d,{id:"framework",value:n.stack.framework,onChange:t=>i("stack.framework",t.target.value),placeholder:"express|fastify|django|gin|etc"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"language",children:"Language"}),e.jsx(d,{id:"language",value:n.stack.language,onChange:t=>i("stack.language",t.target.value),placeholder:"typescript|javascript|python|go|etc"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"database",children:"Database"}),e.jsx(d,{id:"database",value:n.stack.database,onChange:t=>i("stack.database",t.target.value),placeholder:"postgresql|mysql|mongodb|sqlite|etc"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"deployment",children:"Deployment"}),e.jsx(d,{id:"deployment",value:n.stack.deployment,onChange:t=>i("stack.deployment",t.target.value),placeholder:"docker|kubernetes|vercel|aws|etc"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"repository",children:"Repository"}),e.jsx(d,{id:"repository",value:n.stack.repository,onChange:t=>i("stack.repository",t.target.value),placeholder:"https://github.com/yourorg/yourproject"})]})]})]})]}),e.jsxs(u,{children:[e.jsx(j,{children:e.jsx(v,{children:"Quick Commands"})}),e.jsx(p,{className:"space-y-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"commands",children:"Commands (format: command_name: command_to_run)"}),e.jsx(B,{id:"commands",value:E,onChange:t=>T(t.target.value),placeholder:`install: npm install
|
|
4
4
|
dev: npm run dev
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as g,r as n,A as v,j as e,t as y,F as k,B as l,M as b,au as w,L as C,Y as E,ar as A}from"./index-
|
|
1
|
+
import{a as g,r as n,A as v,j as e,t as y,F as k,B as l,M as b,au as w,L as C,Y as E,ar as A}from"./index-SWBrq2bx.js";import{C as a,a as c,b as o,c as m}from"./card-DdrUHBUG.js";import{c as D}from"./clipboard-B9ndUJKl.js";function S(){const{toast:h}=g(),[r,x]=n.useState(null),[u,p]=n.useState(!0),[j,i]=n.useState(!1);n.useEffect(()=>{fetch(`${v}/api/v1/context/architecture`).then(t=>{if(t.ok)return t.json();throw new Error("Not found")}).then(t=>{t.success?(x(t.document),i(!0)):i(!1)}).catch(()=>{i(!1)}).finally(()=>{p(!1)})},[]);const N=async()=>{const t=".nut/context/architecture.md";try{await D(t),h({title:"Copied!",description:`Path ${t} copied to clipboard`})}catch(d){console.error("Failed to copy path:",d),h({title:"Error",description:"Failed to copy path to clipboard",variant:"destructive"})}},f=()=>{const t=new CustomEvent("discuss-in-chat",{detail:{type:"context",id:"architecture-md",filename:"architecture.md",name:"architecture.md",path:".nut/context/architecture.md"}});window.dispatchEvent(t)};if(u)return e.jsx("div",{className:"space-y-6",children:e.jsx(a,{children:e.jsx(c,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(y,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading architecture documentation..."})]})})})});if(!j||!r)return e.jsx("div",{className:"space-y-6",children:e.jsx(a,{children:e.jsx(c,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx(k,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No Architecture Documentation Found"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Architecture documentation will appear here once created."})]})})})});const s=r.metadata;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:"Technical Architecture"}),e.jsx("p",{className:"text-muted-foreground",children:"System design, components, and technical patterns"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(l,{variant:"outline",size:"sm",onClick:f,children:[e.jsx(b,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Discuss"})]}),e.jsxs(l,{variant:"outline",size:"sm",onClick:N,children:[e.jsx(w,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Copy Path"})]}),e.jsx(l,{size:"sm",asChild:!0,children:e.jsxs(C,{to:"/context/architecture/edit",children:[e.jsx(E,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit"})]})})]})]}),s&&e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs(a,{children:[e.jsx(o,{className:"pb-3",children:e.jsx(m,{className:"text-lg font-semibold",children:"Technology Stack"})}),e.jsx(c,{className:"space-y-3",children:s.stack&&e.jsxs("div",{className:"space-y-1 text-sm",children:[s.stack.runtime&&e.jsxs("div",{children:["Runtime: ",s.stack.runtime]}),s.stack.framework&&e.jsxs("div",{children:["Framework: ",s.stack.framework]}),s.stack.language&&e.jsxs("div",{children:["Language: ",s.stack.language]}),s.stack.database&&e.jsxs("div",{children:["Database: ",s.stack.database]}),s.stack.deployment&&e.jsxs("div",{children:["Deployment: ",s.stack.deployment]}),s.stack.repository&&e.jsxs("div",{children:["Repository:"," ",e.jsx("a",{href:s.stack.repository,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:s.stack.repository})]})]})})]}),e.jsxs(a,{children:[e.jsx(o,{className:"pb-3",children:e.jsx(m,{className:"text-lg font-semibold",children:"Quick Commands"})}),e.jsx(c,{className:"space-y-3",children:s.commands&&e.jsxs("div",{className:"space-y-1",children:[Object.entries(s.commands).slice(0,5).map(([t,d])=>e.jsxs("div",{className:"text-sm",children:[e.jsxs("span",{className:"font-medium capitalize",children:[t,": "]}),e.jsx("code",{className:"bg-muted px-2 py-1 rounded text-xs",children:d})]},t)),Object.entries(s.commands).length>5&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:["+ ",Object.entries(s.commands).length-5," more commands"]})]})})]})]}),e.jsxs(a,{children:[e.jsx(o,{children:e.jsx(m,{className:"text-lg font-semibold",children:"Architecture Documentation"})}),e.jsx(c,{children:e.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:e.jsx(A,{children:r.content||"No content available"})})})]})]})}export{S as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as Y,s as le,r as n,b0 as c,j as e,a$ as O,i as ce,D as I,V as $,B as l,b as M,d as V,f as H,g as J,I as j,W as z,y as oe,z as de,E as he,H as ue,J as xe,N as me,O as ge,Q as je,R as pe,U as ve,v as r}from"./index-
|
|
1
|
+
import{c as Y,s as le,r as n,b0 as c,j as e,a$ as O,i as ce,D as I,V as $,B as l,b as M,d as V,f as H,g as J,I as j,W as z,y as oe,z as de,E as he,H as ue,J as xe,N as me,O as ge,Q as je,R as pe,U as ve,v as r}from"./index-SWBrq2bx.js";import{C as p,b as v,c as w,d as f,a as y}from"./card-DdrUHBUG.js";import{L as o}from"./label-C8Wxd6GE.js";import{S as _,a as W,b as q,c as B,d as a}from"./select-DgNHsbaX.js";import{S as U}from"./switch-C2zPfM3G.js";import{B as k}from"./badge-CA-A_JCd.js";import{C as we}from"./circle-alert-B3zeVGHG.js";import"./chevron-up-CPpQ_jgb.js";/**
|
|
2
2
|
* @license lucide-react v0.542.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as m,j as e,t as x,A as f}from"./index-
|
|
1
|
+
import{r as m,j as e,t as x,A as f}from"./index-SWBrq2bx.js";import{C as w}from"./circle-check-OfRBf8tJ.js";import{C as b}from"./circle-x-CtfEmATn.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 v=()=>{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{v as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{u as ce,a as de,r as i,j as e,B as r,T as oe,n as M,X as me,F as xe,Y as he,D as ue,b as fe,d as pe,f as je,k as ge,a2 as B,a3 as R,a4 as H,a5 as L,a6 as O,aa as G,a9 as ve,o as Ne,A as T}from"./index-DFcWlnzl.js";import{C as g,b as ye,a as _,c as we}from"./card-BcPlIAH5.js";import{B as U}from"./badge-BUEY53dV.js";import{u as Se}from"./use-terminal-BXJqOeJe.js";import{T as Ce}from"./terminal-preview-DN38x9Jm.js";import{S as be,a as ke,b as Ae,c as De,d as w}from"./select-44mcS2_G.js";import{b as Me,e as Te,d as Ie,c as $e,a as Ee}from"./kiro-CX1mOsRO.js";import{R as Pe}from"./refresh-cw-B3OwrDUf.js";import{C as ze,a as Fe}from"./chevrons-up-DTvCkIHc.js";import{P as Be}from"./play-CHIf-Rcz.js";import{C as Re}from"./code-DrYqPukx.js";import{C as He}from"./chevron-up-CqM3won3.js";import"./xterm-DTxiCjtJ.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 es(){const c=ce(),{sessions:x,loading:b,error:I,refreshSessions:S,createSession:V,destroySession:K}=Se(),{toast:v}=de(),[$,W]=i.useState([]),[q,X]=i.useState(!0),[j,k]=i.useState(()=>({})),[A,N]=i.useState(!1),[f,Y]=i.useState("claude"),[E,J]=i.useState(""),[D,P]=i.useState(!1),[h,Q]=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)&&(Q(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=Me(t):f==="gemini"?a=Te(t):f==="codex"?a=Ie(t):f==="droid"?a=$e(t):f==="kiro"&&(a=Ee(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(Pe,{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(ze,{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(Fe,{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(Be,{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(Re,{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(He,{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(Ce,{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(ye,{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(we,{className:"text-base leading-tight",children:s.title||s.intent}),e.jsxs("div",{className:"flex gap-1 ml-3 flex-shrink-0",children:[s.priority&&e.jsx(U,{variant:s.priority==="high"||s.priority==="critical"?"destructive":s.priority==="medium"?"secondary":"outline",className:"text-xs",children:s.priority}),e.jsx(U,{variant:"default",className:"text-xs",children:s.status})]})]}),s.content&&e.jsxs("div",{className:"text-sm text-muted-foreground leading-relaxed",children:[s.content.split(`
|
|
1
|
+
import{u as ce,a as de,r as i,j as e,B as r,T as oe,n as M,X as me,F as xe,Y as he,D as ue,b as fe,d as pe,f as je,k as ge,a2 as B,a3 as R,a4 as H,a5 as L,a6 as O,aa as G,a9 as ve,o as Ne,A as T}from"./index-SWBrq2bx.js";import{C as g,b as ye,a as _,c as we}from"./card-DdrUHBUG.js";import{B as U}from"./badge-CA-A_JCd.js";import{u as Se}from"./use-terminal-xv9qDaX1.js";import{T as Ce}from"./terminal-preview-BvBQu5Sd.js";import{S as be,a as ke,b as Ae,c as De,d as w}from"./select-DgNHsbaX.js";import{b as Me,e as Te,d as Ie,c as $e,a as Ee}from"./kiro-CX1mOsRO.js";import{R as Pe}from"./refresh-cw-DGBXSYy5.js";import{C as ze,a as Fe}from"./chevrons-up-C8oR0iOR.js";import{P as Be}from"./play-CRPN1vUy.js";import{C as Re}from"./code-D77i0toJ.js";import{C as He}from"./chevron-up-CPpQ_jgb.js";import"./xterm-DTxiCjtJ.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 es(){const c=ce(),{sessions:x,loading:b,error:I,refreshSessions:S,createSession:V,destroySession:K}=Se(),{toast:v}=de(),[$,W]=i.useState([]),[q,X]=i.useState(!0),[j,k]=i.useState(()=>({})),[A,N]=i.useState(!1),[f,Y]=i.useState("claude"),[E,J]=i.useState(""),[D,P]=i.useState(!1),[h,Q]=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)&&(Q(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=Me(t):f==="gemini"?a=Te(t):f==="codex"?a=Ie(t):f==="droid"?a=$e(t):f==="kiro"&&(a=Ee(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(Pe,{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(ze,{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(Fe,{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(Be,{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(Re,{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(He,{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(Ce,{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(ye,{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(we,{className:"text-base leading-tight",children:s.title||s.intent}),e.jsxs("div",{className:"flex gap-1 ml-3 flex-shrink-0",children:[s.priority&&e.jsx(U,{variant:s.priority==="high"||s.priority==="critical"?"destructive":s.priority==="medium"?"secondary":"outline",className:"text-xs",children:s.priority}),e.jsx(U,{variant:"default",className:"text-xs",children:s.status})]})]}),s.content&&e.jsxs("div",{className:"text-sm text-muted-foreground leading-relaxed",children:[s.content.split(`
|
|
2
2
|
`).slice(0,2).join(" ").substring(0,150),s.content.length>150?"...":""]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{className:"text-xs text-muted-foreground",children:[s.id," • by ",s.author.name," • ",new Date(s.metadata.createdAt).toLocaleDateString()]}),e.jsxs("div",{className:"flex gap-2",onClick:t=>t.stopPropagation(),children:[e.jsxs(r,{variant:"ghost",size:"sm",onClick:()=>c(`/tasks/${s.id}`),className:"h-7 px-2 text-xs",children:[e.jsx(xe,{className:"h-3 w-3 mr-1"})," View"]}),e.jsxs(r,{variant:"ghost",size:"sm",onClick:()=>c(`/tasks/${s.id}/edit`),className:"h-7 px-2 text-xs",children:[e.jsx(he,{className:"h-3 w-3 mr-1"})," Edit"]})]})]})]})})})},s.id))})]}),e.jsx(ue,{open:A,onOpenChange:N,children:e.jsxs(fe,{className:"max-w-lg",children:[e.jsxs(pe,{children:[e.jsx(je,{children:"Start Agent"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Start an interactive session"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Agent"}),e.jsxs(be,{value:f,onValueChange:s=>Y(s),children:[e.jsx(ke,{className:"w-full",children:e.jsx(Ae,{placeholder:"Select coding agent"})}),e.jsxs(De,{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(ve,{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(Ne,{value:E,onChange:s=>J(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{es as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as x,j as e,e as a,n as m}from"./index-
|
|
1
|
+
import{r as x,j as e,e as a,n as m}from"./index-SWBrq2bx.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 y,u as Re,a as Le,r as l,j as e,D as De,b as _e,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 qe,G as Ie,F as Pe,k as ue,Z as ze,l as We,m as Fe,T as ce,n as Ve,o as Be,L as N,P as Ee,M as $e,K as A,p as g,A as Ke}from"./index-
|
|
1
|
+
import{c as y,u as Re,a as Le,r as l,j as e,D as De,b as _e,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 qe,G as Ie,F as Pe,k as ue,Z as ze,l as We,m as Fe,T as ce,n as Ve,o as Be,L as N,P as Ee,M as $e,K as A,p as g,A as Ke}from"./index-SWBrq2bx.js";import{C as x,a as u,b as R,c as L,d as ie}from"./card-DdrUHBUG.js";import{B as Ge}from"./badge-CA-A_JCd.js";import{g as He}from"./status-utils-PwF3DXLL.js";import{L as Oe}from"./label-C8Wxd6GE.js";import{S as oe,a as de,b as me,c as he,d as E}from"./select-DgNHsbaX.js";import{u as Ye}from"./use-terminal-xv9qDaX1.js";import{T as Qe}from"./terminal-preview-BvBQu5Sd.js";import{C as Ue}from"./circle-check-OfRBf8tJ.js";import{C as Ze}from"./chevron-left-C4bGr2Al.js";import{S as Je}from"./search-C9jI6Lg7.js";import{C as Xe}from"./code-D77i0toJ.js";import{F as es}from"./folder-git-2-Crtn4eyJ.js";import{E as ss}from"./external-link-D6UvIQYD.js";import{P as ts}from"./play-CRPN1vUy.js";import{C as as}from"./clock-B43LjbrK.js";import{C as ns}from"./circle-check-big-CeVxJ4hA.js";import"./chevron-up-CPpQ_jgb.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.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as le,A as l,br as ws,r as n,a as vs,ad as ys,j as e,L as ee,l as Fe,B as o,G as D,ab as Ns,X as Cs,I as k,n as Me,E as Be,D as se,b as te,d as ae,f as re,g as ne,b1 as ks,W as Oe}from"./index-
|
|
1
|
+
import{c as le,A as l,br as ws,r as n,a as vs,ad as ys,j as e,L as ee,l as Fe,B as o,G as D,ab as Ns,X as Cs,I as k,n as Me,E as Be,D as se,b as te,d as ae,f as re,g as ne,b1 as ks,W as Oe}from"./index-SWBrq2bx.js";import{C as ie}from"./card-DdrUHBUG.js";import{L as Re}from"./label-C8Wxd6GE.js";import{T as Ss,a as Ps,b as Ge,c as We}from"./tabs-B7fjkp5h.js";import{C as Ts}from"./circle-check-OfRBf8tJ.js";import{C as As}from"./circle-x-CtfEmATn.js";import{A as Ds}from"./arrow-down-J9YP8VW9.js";import{A as Es}from"./arrow-up-CjXXRPYC.js";import{R as ze}from"./refresh-cw-DGBXSYy5.js";import{C as ce}from"./circle-alert-B3zeVGHG.js";import{C as Ue}from"./chevron-up-CPpQ_jgb.js";import{F as oe}from"./folder-git-2-Crtn4eyJ.js";/**
|
|
2
2
|
* @license lucide-react v0.542.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as Te,r,a as He,A as u,j as e,a$ as he,B as o,E as Fe,t as De,b1 as ze,I as U,D as W,b as B,d as q,f as J,g as K,W as Y}from"./index-
|
|
1
|
+
import{c as Te,r,a as He,A as u,j as e,a$ as he,B as o,E as Fe,t as De,b1 as ze,I as U,D as W,b as B,d as q,f as J,g as K,W as Y}from"./index-SWBrq2bx.js";import{C as xe,b as pe,c as ge,d as fe,a as be}from"./card-DdrUHBUG.js";import{L as f}from"./label-C8Wxd6GE.js";import{R as Me,a as je}from"./radio-group-DFIfCEpZ.js";import{R as A}from"./refresh-cw-DGBXSYy5.js";import{E as ve}from"./external-link-D6UvIQYD.js";import{C as Oe}from"./circle-check-OfRBf8tJ.js";import{C as Ie}from"./circle-x-CtfEmATn.js";/**
|
|
2
2
|
* @license lucide-react v0.542.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as ge,a as ve,r as u,j as e,t as se,B as x,a0 as fe,$ as Ne,aZ as Te,i as Ce,Z as be,a_ as Se,I as c,o as O,ab as ae,P as E,a$ as ne,E as we,A as ie}from"./index-
|
|
1
|
+
import{c as ge,a as ve,r as u,j as e,t as se,B as x,a0 as fe,$ as Ne,aZ as Te,i as Ce,Z as be,a_ as Se,I as c,o as O,ab as ae,P as E,a$ as ne,E as we,A as ie}from"./index-SWBrq2bx.js";import{C as y,b as j,c as g,d as v,a as f,e as Ae}from"./card-DdrUHBUG.js";import{L as o}from"./label-C8Wxd6GE.js";import{B as re}from"./badge-CA-A_JCd.js";import{S as ke,a as Ie,b as Oe,c as Fe,d as Pe}from"./select-DgNHsbaX.js";import{A as Ee,a as Me}from"./alert-BUrHsk9_.js";import{T as De,a as Le,b,c as S}from"./tabs-B7fjkp5h.js";import{E as _e}from"./eye-C3fWwYx-.js";import{C as Ue,a as Re}from"./clipboard-Z_0Z5-r1.js";import"./chevron-up-CPpQ_jgb.js";/**
|
|
2
2
|
* @license lucide-react v0.542.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{c as u,j as e,e as p,B as c,E as x,I as j,P as v}from"./index-SWBrq2bx.js";import{L as r}from"./label-C8Wxd6GE.js";import{S,a as y,b,c as f,d as k}from"./select-DgNHsbaX.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 g=[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]],E=u("list-checks",g),N=[{value:"pending",label:"Pending"},{value:"active",label:"Active"},{value:"done",label:"Done"},{value:"failed",label:"Blocked / Failed"},{value:"skipped",label:"Skipped"}],I=()=>typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`step-${Date.now()}-${Math.floor(Math.random()*1e3)}`;function L({steps:l,onChange:i,disabled:n,className:o}){const d=(a,s)=>{i(l.map(t=>t.id===a?{...t,...s}:t))},h=a=>{i(l.filter(s=>s.id!==a))},m=()=>{i([...l,{id:I(),description:"",status:"pending"}])};return e.jsxs("div",{className:p("space-y-4",o),children:[l.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"Break the work down into actionable steps."}),l.map((a,s)=>e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("p",{className:"text-sm font-semibold",children:["Step ",s+1]}),e.jsx(c,{type:"button",variant:"ghost",size:"icon",onClick:()=>h(a.id),disabled:n,"aria-label":`Remove step ${s+1}`,children:e.jsx(x,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:`${a.id}-description`,children:"Description"}),e.jsx(j,{id:`${a.id}-description`,value:a.description,onChange:t=>d(a.id,{description:t.target.value}),placeholder:"What needs to be done?",disabled:n})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:`${a.id}-status`,children:"Status"}),e.jsxs(S,{value:a.status,onValueChange:t=>d(a.id,{status:t}),disabled:n,children:[e.jsx(y,{id:`${a.id}-status`,children:e.jsx(b,{placeholder:"Select status"})}),e.jsx(f,{children:N.map(t=>e.jsx(k,{value:t.value,children:t.label},t.value))})]})]})]},a.id)),e.jsxs(c,{type:"button",variant:"outline",onClick:m,disabled:n,children:[e.jsx(v,{className:"mr-2 h-4 w-4"}),"Add Step"]})]})}export{L as I,E as L};
|