@lovelybunch/api 1.0.76-alpha.7 → 1.0.76-alpha.8

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 (145) hide show
  1. package/dist/lib/mcp-client.d.ts +39 -0
  2. package/dist/lib/mcp-client.js +131 -0
  3. package/dist/lib/terminal/terminal-manager.js +31 -0
  4. package/dist/routes/api/v1/ai/tools.d.ts +17 -0
  5. package/dist/routes/api/v1/ai/tools.js +931 -0
  6. package/dist/routes/api/v1/context/knowledge/[filename]/index.d.ts +1 -0
  7. package/dist/routes/api/v1/context/knowledge/[filename]/index.js +1 -0
  8. package/dist/routes/api/v1/context/knowledge/[filename]/route.d.ts +3 -0
  9. package/dist/routes/api/v1/context/knowledge/[filename]/route.js +254 -0
  10. package/dist/routes/api/v1/context/knowledge/index.d.ts +1 -0
  11. package/dist/routes/api/v1/context/knowledge/index.js +1 -0
  12. package/dist/routes/api/v1/context/knowledge/route.d.ts +3 -0
  13. package/dist/routes/api/v1/context/knowledge/route.js +176 -0
  14. package/dist/routes/api/v1/proposals/[id]/route.d.ts +337 -0
  15. package/dist/routes/api/v1/proposals/[id]/route.js +165 -0
  16. package/dist/routes/api/v1/proposals/index.d.ts +3 -0
  17. package/dist/routes/api/v1/proposals/index.js +10 -0
  18. package/dist/routes/api/v1/proposals/route.d.ts +315 -0
  19. package/dist/routes/api/v1/proposals/route.js +129 -0
  20. package/dist/routes/api/v1/terminal/[proposalId]/create/index.d.ts +3 -0
  21. package/dist/routes/api/v1/terminal/[proposalId]/create/index.js +5 -0
  22. package/dist/routes/api/v1/terminal/[proposalId]/create/route.d.ts +10 -0
  23. package/dist/routes/api/v1/terminal/[proposalId]/create/route.js +27 -0
  24. package/dist/routes/api/v1/terminal/[proposalId]/destroy/index.d.ts +3 -0
  25. package/dist/routes/api/v1/terminal/[proposalId]/destroy/index.js +5 -0
  26. package/dist/routes/api/v1/terminal/[proposalId]/destroy/route.d.ts +10 -0
  27. package/dist/routes/api/v1/terminal/[proposalId]/destroy/route.js +21 -0
  28. package/dist/routes/api/v1/terminal/[proposalId]/resize/index.d.ts +3 -0
  29. package/dist/routes/api/v1/terminal/[proposalId]/resize/index.js +5 -0
  30. package/dist/routes/api/v1/terminal/[proposalId]/resize/route.d.ts +10 -0
  31. package/dist/routes/api/v1/terminal/[proposalId]/resize/route.js +21 -0
  32. package/dist/routes/api/v1/terminal/code/route.js +9 -16
  33. package/package.json +4 -4
  34. package/static/assets/{ActivityPage-Dmuu0c1r.js → ActivityPage-uL-Qknui.js} +1 -1
  35. package/static/assets/{ApiKeysSettingsPage-BtpcHzBO.js → ApiKeysSettingsPage-BhaH6ZYP.js} +1 -1
  36. package/static/assets/{ArchitectureEditPage-CRK7l_pP.js → ArchitectureEditPage-BWKyKi3T.js} +1 -1
  37. package/static/assets/{ArchitecturePage-Bb3Mr04V.js → ArchitecturePage-Dtm0OAac.js} +1 -1
  38. package/static/assets/{AuthSettingsPage-BmcnjO0-.js → AuthSettingsPage-D0MQlHyh.js} +1 -1
  39. package/static/assets/{CallbackPage-hQdlfqNL.js → CallbackPage-Bz4m3_W8.js} +1 -1
  40. package/static/assets/{CodePage-BlGRZW1v.js → CodePage-BuO2K_xx.js} +1 -1
  41. package/static/assets/{CollapsibleSection-dXTDG5xK.js → CollapsibleSection-CxX11hr-.js} +1 -1
  42. package/static/assets/{DashboardPage-SNgPwXuZ.js → DashboardPage-B3HR1UM7.js} +1 -1
  43. package/static/assets/{GitPage-CmRS64Yi.js → GitPage-Dm36PRw_.js} +1 -1
  44. package/static/assets/{GitSettingsPage-2sLN6YTn.js → GitSettingsPage-CRWcjgVI.js} +1 -1
  45. package/static/assets/{IdentityPage-Ce9aNd67.js → IdentityPage-YCkmdyzR.js} +1 -1
  46. package/static/assets/{ImplementationStepsEditor-BCw5WEo-.js → ImplementationStepsEditor-u3dPxmKW.js} +1 -1
  47. package/static/assets/{IntegrationsSettingsPage-CNhL2RAP.js → IntegrationsSettingsPage-Z8xCUmX9.js} +1 -1
  48. package/static/assets/{JobDetailPage-B1QoqEIg.js → JobDetailPage-B8Za82RA.js} +1 -1
  49. package/static/assets/{KnowledgeDetailPage-D6E4oPnB.js → KnowledgeDetailPage-CR9c4_WD.js} +1 -1
  50. package/static/assets/{KnowledgeEditPage-Cx0I6UOP.js → KnowledgeEditPage-DhrF6UPg.js} +1 -1
  51. package/static/assets/{KnowledgePage-CtwNzWrO.js → KnowledgePage-_gZhpTe3.js} +1 -1
  52. package/static/assets/{LoginPage-wCy6_Zm7.js → LoginPage-Cc1Ac2j4.js} +1 -1
  53. package/static/assets/{MailInboxPage-PlwJvbyZ.js → MailInboxPage-B_h1Kz4D.js} +1 -1
  54. package/static/assets/{MailProcessingModal-D7Ql9vO7.js → MailProcessingModal-D_qEwqmL.js} +1 -1
  55. package/static/assets/{MailReadPage-BIs7cMX8.js → MailReadPage-_q-xk_cX.js} +1 -1
  56. package/static/assets/{MailSentPage-Bb0xtmoP.js → MailSentPage-Dj63oQ5D.js} +1 -1
  57. package/static/assets/{McpSettingsPage-CgxAuTpL.js → McpSettingsPage-DYZ0QNbp.js} +1 -1
  58. package/static/assets/{NewKnowledgePage-ByxAeT6H.js → NewKnowledgePage-BEVMYnKG.js} +1 -1
  59. package/static/assets/{NewSkillPage-OYWMDDx4.js → NewSkillPage-BEn18f2A.js} +1 -1
  60. package/static/assets/{NewTaskPage-BtQDlqV4.js → NewTaskPage-CSlncpI5.js} +1 -1
  61. package/static/assets/{NotFoundPage-C6Y7qVDZ.js → NotFoundPage-C4x0lGai.js} +1 -1
  62. package/static/assets/{NotificationsSettingsPage-D7Ov-sWC.js → NotificationsSettingsPage-C9YnfRlj.js} +1 -1
  63. package/static/assets/{ProjectEditPage-DathnxH1.js → ProjectEditPage-X0-4mEAS.js} +1 -1
  64. package/static/assets/{ProjectPage-Cqhn6x5U.js → ProjectPage-D8OX1GKt.js} +1 -1
  65. package/static/assets/{PromptsSettingsPage-YUM57KBW.js → PromptsSettingsPage-Chc4da1S.js} +1 -1
  66. package/static/assets/{ResourceDetailPage-DHjIUpZA.js → ResourceDetailPage-DDYKQxpM.js} +1 -1
  67. package/static/assets/{ResourcesPage-D6JnktN5.js → ResourcesPage-BmOpgt3L.js} +1 -1
  68. package/static/assets/{RoleEditPage-BkcUVWeb.js → RoleEditPage-Ccfu1tn1.js} +1 -1
  69. package/static/assets/{RolePage-BvbK5LV5.js → RolePage-CcdEUjSm.js} +1 -1
  70. package/static/assets/{RulesSettingsPage-0FLxp6EA.js → RulesSettingsPage-Cz1g_eAj.js} +1 -1
  71. package/static/assets/{SchedulePage-DedzsT29.js → SchedulePage-CGxZHEL-.js} +1 -1
  72. package/static/assets/{SkillDetailPage-tQFvdVX0.js → SkillDetailPage-sJg-L8A8.js} +1 -1
  73. package/static/assets/{SkillEditPage-DqNB953S.js → SkillEditPage-BksV7GmD.js} +1 -1
  74. package/static/assets/{SkillsPage-BjQJQ5dJ.js → SkillsPage-CwarkJmZ.js} +1 -1
  75. package/static/assets/{SkillsSettingsPage-CVXd-umU.js → SkillsSettingsPage-DTnBlBdE.js} +1 -1
  76. package/static/assets/{SourceInput-8t5lHb_p.js → SourceInput-CWazIr6v.js} +1 -1
  77. package/static/assets/{TagInput-BSvCOVlX.js → TagInput-Bgyxb_JU.js} +1 -1
  78. package/static/assets/{TaskDetailPage-mr6xlhU3.js → TaskDetailPage-DlmG1kZR.js} +1 -1
  79. package/static/assets/{TaskEditPage-BPFpzGZd.js → TaskEditPage-BnpNeed_.js} +1 -1
  80. package/static/assets/{TasksPage-DHhsW-6_.js → TasksPage-CXeTMpgy.js} +1 -1
  81. package/static/assets/{TerminalPage-BoULMlvX.js → TerminalPage-BLcPt381.js} +1 -1
  82. package/static/assets/{TerminalSessionPage-BUFKA_ff.js → TerminalSessionPage-CeAd8IAy.js} +1 -1
  83. package/static/assets/{UserPreferencesPage-CG8d6Etn.js → UserPreferencesPage-BNwEqlRW.js} +1 -1
  84. package/static/assets/{UserSettingsPage-xPNj059t.js → UserSettingsPage-BRafqkiD.js} +1 -1
  85. package/static/assets/{UtilitiesPage-1-65_2Xp.js → UtilitiesPage-BPX_Unxu.js} +1 -1
  86. package/static/assets/{alert-EL2xlTrX.js → alert-Ci2-OWZ_.js} +1 -1
  87. package/static/assets/{arrow-down-C4aI3BzN.js → arrow-down-C6Flf0DF.js} +1 -1
  88. package/static/assets/{arrow-left-D1gRXqBK.js → arrow-left-7TCkaJlN.js} +1 -1
  89. package/static/assets/{arrow-up-DAYHG9Lx.js → arrow-up-DeQAxOPq.js} +1 -1
  90. package/static/assets/{arrow-up-down-CHPybwd-.js → arrow-up-down-tqbfiBy6.js} +1 -1
  91. package/static/assets/{badge-WU4FRCeV.js → badge-D4vHU_w_.js} +1 -1
  92. package/static/assets/{browser-modal-B41s3tKa.js → browser-modal-BiaqhKHm.js} +1 -1
  93. package/static/assets/{card-BHJKBprp.js → card-xkODbJy-.js} +1 -1
  94. package/static/assets/{chevron-left-BJKLaytG.js → chevron-left-CvpfJBPQ.js} +1 -1
  95. package/static/assets/{chevron-up-BkAwyb-e.js → chevron-up-BB-6OS4z.js} +1 -1
  96. package/static/assets/{chevrons-up-DLVKnDAn.js → chevrons-up-CLKrQHMU.js} +1 -1
  97. package/static/assets/{circle-alert-Z70KQUGE.js → circle-alert-lnP0-w3N.js} +1 -1
  98. package/static/assets/{circle-check-BADr-KOf.js → circle-check-BPkEav83.js} +1 -1
  99. package/static/assets/{circle-check-big-D34PB5x-.js → circle-check-big-Dbo-OmWQ.js} +1 -1
  100. package/static/assets/{circle-play-BfLMQvSH.js → circle-play-BbtBIeo3.js} +1 -1
  101. package/static/assets/{circle-x-Bn4fyYbB.js → circle-x-BBwi8e5G.js} +1 -1
  102. package/static/assets/{clipboard-DFI4a7LI.js → clipboard-Ce816tAO.js} +1 -1
  103. package/static/assets/{clock-BwcvObAc.js → clock-BIeoO5Mt.js} +1 -1
  104. package/static/assets/{code-DXA16K3p.js → code-DTW3giBe.js} +1 -1
  105. package/static/assets/{download-Cb08Pn1l.js → download-BgKxfry9.js} +1 -1
  106. package/static/assets/{external-link-BbPHlMU6.js → external-link--RjKXREe.js} +1 -1
  107. package/static/assets/{eye-DKuTxsEz.js → eye--K-OgK7L.js} +1 -1
  108. package/static/assets/{folder-git-2-CLjnVj8p.js → folder-git-2-Bgv7r0zC.js} +1 -1
  109. package/static/assets/{index-MT7xy-5k.js → index-4RuWYO4M.js} +1 -1
  110. package/static/assets/{index-97wNbZjB.js → index-BD9UBXsr.js} +1 -1
  111. package/static/assets/{index-DauoTeMC.js → index-BQYB8kWb.js} +1 -1
  112. package/static/assets/{index-DDaqus6Y.js → index-BbrX1XcC.js} +1 -1
  113. package/static/assets/{index-KMYFtqs_.js → index-BkEdELOI.js} +1 -1
  114. package/static/assets/{index-Cp2t41gG.js → index-BteQHbZ1.js} +1 -1
  115. package/static/assets/{index-CHImvyA8.js → index-CW9pK_cZ.js} +1 -1
  116. package/static/assets/{index-DNQq4O0F.js → index-Cd5hBt4x.js} +1 -1
  117. package/static/assets/{index-9hNdrzuJ.js → index-Ch4GVR8L.js} +1 -1
  118. package/static/assets/{index-BBUGa7c5.js → index-D9xZafJb.js} +1 -1
  119. package/static/assets/{index-DO6rNgzu.js → index-DF_KNbKf.js} +1 -1
  120. package/static/assets/{index-DysiQsZ5.js → index-Db5-BoCU.js} +1 -1
  121. package/static/assets/{index-B-VC5GM7.js → index-Di7xMYoG.js} +1 -1
  122. package/static/assets/{index-DE9Jes-V.js → index-Do92mBFr.js} +1 -1
  123. package/static/assets/{index-DxQLy6Gv.js → index-Dt_WtbUU.js} +1 -1
  124. package/static/assets/{index-BShpFXJb.js → index-LMsLdXw_.js} +1 -1
  125. package/static/assets/{index-C5Azpb6Z.js → index-PyVlsLW8.js} +3 -3
  126. package/static/assets/{index-Bd8VZDeR.js → index-R44k73Ca.js} +1 -1
  127. package/static/assets/{index-BjpC9OGL.js → index-iIFwHD3L.js} +1 -1
  128. package/static/assets/{info-CwUnqjYK.js → info-DgZN3xWF.js} +1 -1
  129. package/static/assets/{label-Dk87UyXm.js → label-DvPENm3h.js} +1 -1
  130. package/static/assets/{markdown-editor-D0KOANlZ.js → markdown-editor-DpZxV-fa.js} +3 -3
  131. package/static/assets/{message-square-qlP-j05_.js → message-square-CoaQYehb.js} +1 -1
  132. package/static/assets/{paperclip-C7-B8_IK.js → paperclip-ChugoOAp.js} +1 -1
  133. package/static/assets/{pause-DE1VFlNp.js → pause-m9YcgxdE.js} +1 -1
  134. package/static/assets/{play-D8sJDiBu.js → play-DtFz_MLh.js} +1 -1
  135. package/static/assets/{radio-group-C8YR94gC.js → radio-group-C5Te9bVb.js} +1 -1
  136. package/static/assets/{refresh-cw-CIEDgKUC.js → refresh-cw-B1bWW9Rg.js} +1 -1
  137. package/static/assets/{search-BGxb6jwl.js → search-CPOHeeUa.js} +1 -1
  138. package/static/assets/{select-CpKkFDbr.js → select-B1v2u6hQ.js} +1 -1
  139. package/static/assets/{switch-BZ6eSoPj.js → switch-Bf1Cq3P6.js} +1 -1
  140. package/static/assets/{tabs-HysYyLO3.js → tabs-DAbCZiFC.js} +1 -1
  141. package/static/assets/{tag-D2TG8w6l.js → tag-Cz4z82t0.js} +1 -1
  142. package/static/assets/{terminal-preview-Cgpwpsv9.js → terminal-preview-DTUohQ5b.js} +1 -1
  143. package/static/assets/{use-terminal-Bf1hClFd.js → use-terminal-CFbQv1ie.js} +1 -1
  144. package/static/assets/{video-D0tTpDVb.js → video-B6ZJ-Epb.js} +1 -1
  145. package/static/index.html +1 -1
@@ -0,0 +1,337 @@
1
+ import { Context } from 'hono';
2
+ export declare function GET(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: true;
10
+ data: {
11
+ id: string;
12
+ intent: string;
13
+ content?: string;
14
+ author: {
15
+ type: import("@lovelybunch/types").AuthorType;
16
+ id: string;
17
+ name: string;
18
+ email?: string;
19
+ };
20
+ productSpecRef?: string;
21
+ planSteps: {
22
+ id: string;
23
+ description: string;
24
+ command?: string;
25
+ expectedOutcome?: string;
26
+ status: "pending" | "in-progress" | "completed" | "failed";
27
+ output?: string;
28
+ error?: string;
29
+ executedAt?: string;
30
+ }[];
31
+ evidence: {
32
+ type: "test" | "benchmark" | "screenshot" | "log" | "other";
33
+ description: string;
34
+ data: any;
35
+ timestamp: string;
36
+ }[];
37
+ policies: {
38
+ id: string;
39
+ name: string;
40
+ description: string;
41
+ status: "pending" | "passed" | "failed" | "skipped";
42
+ message?: string;
43
+ checkedAt?: string;
44
+ }[];
45
+ featureFlags: {
46
+ id: string;
47
+ version: string;
48
+ name: string;
49
+ description: string;
50
+ type: import("@lovelybunch/types").FeatureFlagType;
51
+ defaultValue: any;
52
+ scopes: string[];
53
+ targets: {
54
+ audience: string;
55
+ value: any;
56
+ percentage?: number;
57
+ }[];
58
+ killSwitch: boolean;
59
+ dependencies: string[];
60
+ createdAt: string;
61
+ updatedAt: string;
62
+ }[];
63
+ experiments: {
64
+ id: string;
65
+ name: string;
66
+ hypothesis: string;
67
+ variants: {
68
+ id: string;
69
+ name: string;
70
+ description: string;
71
+ allocation: number;
72
+ config: {
73
+ [x: string]: any;
74
+ };
75
+ }[];
76
+ allocation: {
77
+ method: "random" | "deterministic" | "weighted";
78
+ seed?: string;
79
+ totalAllocation: number;
80
+ };
81
+ successMetrics: string[];
82
+ guardrailMetrics: {
83
+ name: string;
84
+ threshold: number;
85
+ comparison: "greater" | "less" | "equal";
86
+ action: "alert" | "pause" | "stop";
87
+ }[];
88
+ stopRules: {
89
+ metric: string;
90
+ condition: string;
91
+ action: "stop" | "pause";
92
+ }[];
93
+ analysisConfig: {
94
+ confidenceLevel: number;
95
+ minimumSampleSize: number;
96
+ testType: "two-tailed" | "one-tailed";
97
+ };
98
+ status: import("@lovelybunch/types").ExperimentStatus;
99
+ startedAt?: string;
100
+ endedAt?: string;
101
+ }[];
102
+ telemetryContracts: {
103
+ eventName: string;
104
+ version: string;
105
+ schema: {
106
+ [x: string]: any;
107
+ };
108
+ piiFields: {
109
+ field: string;
110
+ classification: "none" | "quasi" | "sensitive" | "highly-sensitive";
111
+ handling: "clear" | "hash" | "encrypt" | "remove";
112
+ }[];
113
+ samplingRate: number;
114
+ retentionPolicy: {
115
+ duration: number;
116
+ archiveAfter?: number;
117
+ deleteAfter: number;
118
+ };
119
+ approvals: {
120
+ approver: string;
121
+ approvedAt: string;
122
+ comment?: string;
123
+ }[];
124
+ }[];
125
+ releasePlan: {
126
+ strategy: "immediate" | "gradual" | "scheduled" | "gated";
127
+ stages?: {
128
+ name: string;
129
+ percentage: number;
130
+ duration?: number;
131
+ criteria?: string[];
132
+ }[];
133
+ schedule?: string;
134
+ rollbackPlan?: string;
135
+ };
136
+ status: import("@lovelybunch/types").CPStatus;
137
+ metadata: {
138
+ createdAt: string;
139
+ updatedAt: string;
140
+ reviewers: string[];
141
+ aiInteractions: {
142
+ id: string;
143
+ timestamp: string;
144
+ model: string;
145
+ prompt: string;
146
+ response: string;
147
+ tokens: {
148
+ prompt: number;
149
+ completion: number;
150
+ total: number;
151
+ };
152
+ cost?: number;
153
+ }[];
154
+ tags?: string[];
155
+ priority?: "low" | "medium" | "high" | "critical";
156
+ };
157
+ };
158
+ }, import("hono/utils/http-status").ContentfulStatusCode, "json">) | (Response & import("hono").TypedResponse<{
159
+ success: false;
160
+ error: {
161
+ code: string;
162
+ message: any;
163
+ };
164
+ }, 500, "json">)>;
165
+ export declare function PATCH(c: Context): Promise<(Response & import("hono").TypedResponse<{
166
+ success: true;
167
+ data: {
168
+ id: string;
169
+ intent: string;
170
+ content?: string;
171
+ author: {
172
+ type: import("@lovelybunch/types").AuthorType;
173
+ id: string;
174
+ name: string;
175
+ email?: string;
176
+ };
177
+ productSpecRef?: string;
178
+ planSteps: {
179
+ id: string;
180
+ description: string;
181
+ command?: string;
182
+ expectedOutcome?: string;
183
+ status: "pending" | "in-progress" | "completed" | "failed";
184
+ output?: string;
185
+ error?: string;
186
+ executedAt?: string;
187
+ }[];
188
+ evidence: {
189
+ type: "test" | "benchmark" | "screenshot" | "log" | "other";
190
+ description: string;
191
+ data: any;
192
+ timestamp: string;
193
+ }[];
194
+ policies: {
195
+ id: string;
196
+ name: string;
197
+ description: string;
198
+ status: "pending" | "passed" | "failed" | "skipped";
199
+ message?: string;
200
+ checkedAt?: string;
201
+ }[];
202
+ featureFlags: {
203
+ id: string;
204
+ version: string;
205
+ name: string;
206
+ description: string;
207
+ type: import("@lovelybunch/types").FeatureFlagType;
208
+ defaultValue: any;
209
+ scopes: string[];
210
+ targets: {
211
+ audience: string;
212
+ value: any;
213
+ percentage?: number;
214
+ }[];
215
+ killSwitch: boolean;
216
+ dependencies: string[];
217
+ createdAt: string;
218
+ updatedAt: string;
219
+ }[];
220
+ experiments: {
221
+ id: string;
222
+ name: string;
223
+ hypothesis: string;
224
+ variants: {
225
+ id: string;
226
+ name: string;
227
+ description: string;
228
+ allocation: number;
229
+ config: {
230
+ [x: string]: any;
231
+ };
232
+ }[];
233
+ allocation: {
234
+ method: "random" | "deterministic" | "weighted";
235
+ seed?: string;
236
+ totalAllocation: number;
237
+ };
238
+ successMetrics: string[];
239
+ guardrailMetrics: {
240
+ name: string;
241
+ threshold: number;
242
+ comparison: "greater" | "less" | "equal";
243
+ action: "alert" | "pause" | "stop";
244
+ }[];
245
+ stopRules: {
246
+ metric: string;
247
+ condition: string;
248
+ action: "stop" | "pause";
249
+ }[];
250
+ analysisConfig: {
251
+ confidenceLevel: number;
252
+ minimumSampleSize: number;
253
+ testType: "two-tailed" | "one-tailed";
254
+ };
255
+ status: import("@lovelybunch/types").ExperimentStatus;
256
+ startedAt?: string;
257
+ endedAt?: string;
258
+ }[];
259
+ telemetryContracts: {
260
+ eventName: string;
261
+ version: string;
262
+ schema: {
263
+ [x: string]: any;
264
+ };
265
+ piiFields: {
266
+ field: string;
267
+ classification: "none" | "quasi" | "sensitive" | "highly-sensitive";
268
+ handling: "clear" | "hash" | "encrypt" | "remove";
269
+ }[];
270
+ samplingRate: number;
271
+ retentionPolicy: {
272
+ duration: number;
273
+ archiveAfter?: number;
274
+ deleteAfter: number;
275
+ };
276
+ approvals: {
277
+ approver: string;
278
+ approvedAt: string;
279
+ comment?: string;
280
+ }[];
281
+ }[];
282
+ releasePlan: {
283
+ strategy: "immediate" | "gradual" | "scheduled" | "gated";
284
+ stages?: {
285
+ name: string;
286
+ percentage: number;
287
+ duration?: number;
288
+ criteria?: string[];
289
+ }[];
290
+ schedule?: string;
291
+ rollbackPlan?: string;
292
+ };
293
+ status: import("@lovelybunch/types").CPStatus;
294
+ metadata: {
295
+ createdAt: string;
296
+ updatedAt: string;
297
+ reviewers: string[];
298
+ aiInteractions: {
299
+ id: string;
300
+ timestamp: string;
301
+ model: string;
302
+ prompt: string;
303
+ response: string;
304
+ tokens: {
305
+ prompt: number;
306
+ completion: number;
307
+ total: number;
308
+ };
309
+ cost?: number;
310
+ }[];
311
+ tags?: string[];
312
+ priority?: "low" | "medium" | "high" | "critical";
313
+ };
314
+ };
315
+ }, import("hono/utils/http-status").ContentfulStatusCode, "json">) | (Response & import("hono").TypedResponse<{
316
+ success: false;
317
+ error: {
318
+ code: string;
319
+ message: any;
320
+ };
321
+ }, 404, "json">) | (Response & import("hono").TypedResponse<{
322
+ success: false;
323
+ error: {
324
+ code: string;
325
+ message: any;
326
+ };
327
+ }, 500, "json">)>;
328
+ export declare function DELETE(c: Context): Promise<(Response & import("hono").TypedResponse<{
329
+ success: true;
330
+ message: string;
331
+ }, import("hono/utils/http-status").ContentfulStatusCode, "json">) | (Response & import("hono").TypedResponse<{
332
+ success: false;
333
+ error: {
334
+ code: string;
335
+ message: any;
336
+ };
337
+ }, 500, "json">)>;
@@ -0,0 +1,165 @@
1
+ import { FileStorageAdapter } from '../../../../../lib/storage/file-storage.js';
2
+ import { getLogger } from '@lovelybunch/core/logging';
3
+ import { getSlackService } from '../../../../../lib/slack/slack-service.js';
4
+ const storage = new FileStorageAdapter();
5
+ // Logger is lazily initialized inside handlers to use server config
6
+ export async function GET(c) {
7
+ try {
8
+ const id = c.req.param('id');
9
+ const proposal = await storage.getCP(id);
10
+ if (!proposal) {
11
+ return c.json({
12
+ success: false,
13
+ error: {
14
+ code: 'PROPOSAL_NOT_FOUND',
15
+ message: `Proposal with id ${id} not found`
16
+ }
17
+ }, 404);
18
+ }
19
+ return c.json({
20
+ success: true,
21
+ data: proposal
22
+ });
23
+ }
24
+ catch (error) {
25
+ console.error('Error getting proposal:', error);
26
+ return c.json({
27
+ success: false,
28
+ error: {
29
+ code: 'GET_PROPOSAL_ERROR',
30
+ message: error.message
31
+ }
32
+ }, 500);
33
+ }
34
+ }
35
+ export async function PATCH(c) {
36
+ try {
37
+ const id = c.req.param('id');
38
+ const updates = await c.req.json();
39
+ // Get existing proposal to merge updates properly
40
+ const existing = await storage.getCP(id);
41
+ if (!existing) {
42
+ return c.json({
43
+ success: false,
44
+ error: {
45
+ code: 'PROPOSAL_NOT_FOUND',
46
+ message: `Proposal with id ${id} not found`
47
+ }
48
+ }, 404);
49
+ }
50
+ // Handle special fields like comments
51
+ let finalUpdates = { ...updates };
52
+ if (updates.comments) {
53
+ finalUpdates = { ...finalUpdates, comments: updates.comments };
54
+ }
55
+ await storage.updateCP(id, finalUpdates);
56
+ // Fetch the updated proposal
57
+ const updatedProposal = await storage.getCP(id);
58
+ // Determine what changed
59
+ const changedFields = Object.keys(updates);
60
+ const oldStatus = existing.status;
61
+ const newStatus = updatedProposal?.status || existing.status;
62
+ // Log proposal.update event
63
+ const logger = getLogger();
64
+ logger.log({
65
+ kind: 'proposal.update',
66
+ actor: updatedProposal?.author.type === 'agent'
67
+ ? `agent:${updatedProposal.author.name}`
68
+ : `human:${updatedProposal?.author.email || 'unknown'}`,
69
+ subject: `proposal:${id}`,
70
+ tags: ['proposal'],
71
+ payload: {
72
+ id,
73
+ changes: changedFields,
74
+ oldStatus,
75
+ newStatus
76
+ }
77
+ });
78
+ // If status changed, also log a status.change event
79
+ if (oldStatus !== newStatus) {
80
+ logger.log({
81
+ kind: 'proposal.status.change',
82
+ actor: updatedProposal?.author.type === 'agent'
83
+ ? `agent:${updatedProposal.author.name}`
84
+ : `human:${updatedProposal?.author.email || 'unknown'}`,
85
+ subject: `proposal:${id}`,
86
+ tags: ['proposal', 'status'],
87
+ payload: {
88
+ id,
89
+ from: oldStatus,
90
+ to: newStatus,
91
+ reason: null
92
+ }
93
+ });
94
+ // Send Slack notification for status change (non-blocking)
95
+ getSlackService().sendNotification({
96
+ type: 'proposal.statusChange',
97
+ proposalId: id,
98
+ intent: updatedProposal?.intent || existing.intent,
99
+ status: newStatus,
100
+ previousStatus: oldStatus,
101
+ }).catch(err => console.warn('[proposals] Slack notification failed:', err));
102
+ }
103
+ return c.json({
104
+ success: true,
105
+ data: updatedProposal
106
+ });
107
+ }
108
+ catch (error) {
109
+ console.error('Error updating proposal:', error);
110
+ if (error.message.includes('not found')) {
111
+ return c.json({
112
+ success: false,
113
+ error: {
114
+ code: 'PROPOSAL_NOT_FOUND',
115
+ message: error.message
116
+ }
117
+ }, 404);
118
+ }
119
+ return c.json({
120
+ success: false,
121
+ error: {
122
+ code: 'UPDATE_PROPOSAL_ERROR',
123
+ message: error.message
124
+ }
125
+ }, 500);
126
+ }
127
+ }
128
+ export async function DELETE(c) {
129
+ try {
130
+ const id = c.req.param('id');
131
+ // Get proposal info before deleting
132
+ const proposal = await storage.getCP(id);
133
+ await storage.deleteCP(id);
134
+ // Log the deletion event
135
+ if (proposal) {
136
+ const logger = getLogger();
137
+ logger.log({
138
+ kind: 'proposal.delete',
139
+ actor: proposal.author.type === 'agent'
140
+ ? `agent:${proposal.author.name}`
141
+ : `human:${proposal.author.email || 'unknown'}`,
142
+ subject: `proposal:${id}`,
143
+ tags: ['proposal'],
144
+ payload: {
145
+ id,
146
+ intent: proposal.intent
147
+ }
148
+ });
149
+ }
150
+ return c.json({
151
+ success: true,
152
+ message: `Proposal ${id} deleted successfully`
153
+ });
154
+ }
155
+ catch (error) {
156
+ console.error('Error deleting proposal:', error);
157
+ return c.json({
158
+ success: false,
159
+ error: {
160
+ code: 'DELETE_PROPOSAL_ERROR',
161
+ message: error.message
162
+ }
163
+ }, 500);
164
+ }
165
+ }
@@ -0,0 +1,3 @@
1
+ import { Hono } from 'hono';
2
+ declare const proposals: Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
3
+ export default proposals;
@@ -0,0 +1,10 @@
1
+ import { Hono } from 'hono';
2
+ import { GET, POST } from './route.js';
3
+ import { GET as getProposal, PATCH as patchProposal, DELETE as deleteProposal } from './[id]/route.js';
4
+ const proposals = new Hono();
5
+ proposals.get('/', GET);
6
+ proposals.post('/', POST);
7
+ proposals.get('/:id', getProposal);
8
+ proposals.patch('/:id', patchProposal);
9
+ proposals.delete('/:id', deleteProposal);
10
+ export default proposals;