claudeck 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +233 -0
  3. package/cli.js +2 -0
  4. package/config/agent-chains.json +16 -0
  5. package/config/agent-dags.json +16 -0
  6. package/config/agents.json +46 -0
  7. package/config/bot-prompt.json +3 -0
  8. package/config/folders.json +66 -0
  9. package/config/prompts.json +92 -0
  10. package/config/repos.json +86 -0
  11. package/config/telegram-config.json +17 -0
  12. package/config/workflows.json +90 -0
  13. package/db.js +1198 -0
  14. package/package.json +55 -0
  15. package/plugins/claude-editor/client.css +171 -0
  16. package/plugins/claude-editor/client.js +183 -0
  17. package/plugins/event-stream/client.css +207 -0
  18. package/plugins/event-stream/client.js +271 -0
  19. package/plugins/linear/client.css +345 -0
  20. package/plugins/linear/client.js +380 -0
  21. package/plugins/linear/config.json +5 -0
  22. package/plugins/linear/server.js +312 -0
  23. package/plugins/repos/client.css +549 -0
  24. package/plugins/repos/client.js +663 -0
  25. package/plugins/repos/server.js +232 -0
  26. package/plugins/sudoku/client.css +196 -0
  27. package/plugins/sudoku/client.js +329 -0
  28. package/plugins/tasks/client.css +414 -0
  29. package/plugins/tasks/client.js +394 -0
  30. package/plugins/tasks/server.js +116 -0
  31. package/plugins/tic-tac-toe/client.css +167 -0
  32. package/plugins/tic-tac-toe/client.js +241 -0
  33. package/public/css/core/components.css +232 -0
  34. package/public/css/core/layout.css +330 -0
  35. package/public/css/core/print.css +18 -0
  36. package/public/css/core/reset.css +36 -0
  37. package/public/css/core/responsive.css +378 -0
  38. package/public/css/core/theme.css +116 -0
  39. package/public/css/core/variables.css +93 -0
  40. package/public/css/features/agent-monitor.css +297 -0
  41. package/public/css/features/agent-sidebar.css +525 -0
  42. package/public/css/features/agents.css +996 -0
  43. package/public/css/features/analytics.css +181 -0
  44. package/public/css/features/background-sessions.css +321 -0
  45. package/public/css/features/cost-dashboard.css +168 -0
  46. package/public/css/features/home.css +313 -0
  47. package/public/css/features/retro-terminal.css +88 -0
  48. package/public/css/features/telegram.css +127 -0
  49. package/public/css/features/tour.css +148 -0
  50. package/public/css/features/voice-input.css +60 -0
  51. package/public/css/features/welcome.css +241 -0
  52. package/public/css/panels/assistant-bot.css +442 -0
  53. package/public/css/panels/dev-docs.css +292 -0
  54. package/public/css/panels/file-explorer.css +322 -0
  55. package/public/css/panels/git-panel.css +221 -0
  56. package/public/css/panels/mcp-manager.css +199 -0
  57. package/public/css/panels/tips-feed.css +353 -0
  58. package/public/css/ui/commands.css +273 -0
  59. package/public/css/ui/context-gauge.css +76 -0
  60. package/public/css/ui/file-picker.css +69 -0
  61. package/public/css/ui/image-attachments.css +106 -0
  62. package/public/css/ui/messages.css +884 -0
  63. package/public/css/ui/modals.css +122 -0
  64. package/public/css/ui/parallel.css +217 -0
  65. package/public/css/ui/permissions.css +110 -0
  66. package/public/css/ui/right-panel.css +481 -0
  67. package/public/css/ui/sessions.css +689 -0
  68. package/public/css/ui/status-bar.css +425 -0
  69. package/public/css/ui/toolbox.css +206 -0
  70. package/public/data/tips.json +218 -0
  71. package/public/icons/favicon.png +0 -0
  72. package/public/icons/icon-192.png +0 -0
  73. package/public/icons/icon-512.png +0 -0
  74. package/public/icons/whaly.png +0 -0
  75. package/public/index.html +1140 -0
  76. package/public/js/core/api.js +591 -0
  77. package/public/js/core/constants.js +3 -0
  78. package/public/js/core/dom.js +270 -0
  79. package/public/js/core/events.js +10 -0
  80. package/public/js/core/plugin-loader.js +153 -0
  81. package/public/js/core/store.js +39 -0
  82. package/public/js/core/utils.js +25 -0
  83. package/public/js/core/ws.js +64 -0
  84. package/public/js/features/agent-monitor.js +222 -0
  85. package/public/js/features/agents.js +1209 -0
  86. package/public/js/features/analytics.js +397 -0
  87. package/public/js/features/attachments.js +251 -0
  88. package/public/js/features/background-sessions.js +475 -0
  89. package/public/js/features/chat.js +589 -0
  90. package/public/js/features/cost-dashboard.js +152 -0
  91. package/public/js/features/dag-editor.js +399 -0
  92. package/public/js/features/easter-egg.js +46 -0
  93. package/public/js/features/home.js +270 -0
  94. package/public/js/features/projects.js +372 -0
  95. package/public/js/features/prompts.js +228 -0
  96. package/public/js/features/sessions.js +332 -0
  97. package/public/js/features/telegram.js +131 -0
  98. package/public/js/features/tour.js +210 -0
  99. package/public/js/features/voice-input.js +185 -0
  100. package/public/js/features/welcome.js +43 -0
  101. package/public/js/features/workflows.js +277 -0
  102. package/public/js/main.js +51 -0
  103. package/public/js/panels/assistant-bot.js +445 -0
  104. package/public/js/panels/dev-docs.js +380 -0
  105. package/public/js/panels/file-explorer.js +486 -0
  106. package/public/js/panels/git-panel.js +285 -0
  107. package/public/js/panels/mcp-manager.js +311 -0
  108. package/public/js/panels/tips-feed.js +303 -0
  109. package/public/js/ui/commands.js +114 -0
  110. package/public/js/ui/context-gauge.js +100 -0
  111. package/public/js/ui/diff.js +124 -0
  112. package/public/js/ui/disabled-tools.js +36 -0
  113. package/public/js/ui/export.js +74 -0
  114. package/public/js/ui/formatting.js +206 -0
  115. package/public/js/ui/header-dropdowns.js +72 -0
  116. package/public/js/ui/input-meta.js +71 -0
  117. package/public/js/ui/max-turns.js +21 -0
  118. package/public/js/ui/messages.js +387 -0
  119. package/public/js/ui/model-selector.js +20 -0
  120. package/public/js/ui/notifications.js +232 -0
  121. package/public/js/ui/parallel.js +176 -0
  122. package/public/js/ui/permissions.js +168 -0
  123. package/public/js/ui/right-panel.js +173 -0
  124. package/public/js/ui/shortcuts.js +143 -0
  125. package/public/js/ui/sidebar-toggle.js +29 -0
  126. package/public/js/ui/status-bar.js +172 -0
  127. package/public/js/ui/tab-sdk.js +623 -0
  128. package/public/js/ui/theme.js +38 -0
  129. package/public/manifest.json +13 -0
  130. package/public/offline.html +190 -0
  131. package/public/style.css +42 -0
  132. package/public/sw.js +91 -0
  133. package/server/agent-loop.js +385 -0
  134. package/server/dag-executor.js +265 -0
  135. package/server/orchestrator.js +514 -0
  136. package/server/paths.js +61 -0
  137. package/server/plugin-mount.js +56 -0
  138. package/server/push-sender.js +31 -0
  139. package/server/routes/agents.js +294 -0
  140. package/server/routes/bot.js +45 -0
  141. package/server/routes/exec.js +35 -0
  142. package/server/routes/files.js +218 -0
  143. package/server/routes/mcp.js +82 -0
  144. package/server/routes/messages.js +36 -0
  145. package/server/routes/notifications.js +37 -0
  146. package/server/routes/projects.js +207 -0
  147. package/server/routes/prompts.js +53 -0
  148. package/server/routes/sessions.js +103 -0
  149. package/server/routes/stats.js +143 -0
  150. package/server/routes/telegram.js +71 -0
  151. package/server/routes/tips.js +135 -0
  152. package/server/routes/workflows.js +81 -0
  153. package/server/summarizer.js +55 -0
  154. package/server/telegram-poller.js +205 -0
  155. package/server/telegram-sender.js +304 -0
  156. package/server/ws-handler.js +926 -0
  157. package/server.js +179 -0
@@ -0,0 +1,591 @@
1
+ // All fetch() calls consolidated into named functions
2
+
3
+ export async function fetchProjects() {
4
+ const res = await fetch("/api/projects");
5
+ return res.json();
6
+ }
7
+
8
+ export async function fetchSessions(projectPath) {
9
+ const url = projectPath
10
+ ? `/api/sessions?project_path=${encodeURIComponent(projectPath)}`
11
+ : "/api/sessions";
12
+ const res = await fetch(url);
13
+ return res.json();
14
+ }
15
+
16
+ export async function searchSessions(query, projectPath) {
17
+ let url = `/api/sessions/search?q=${encodeURIComponent(query)}`;
18
+ if (projectPath) url += `&project_path=${encodeURIComponent(projectPath)}`;
19
+ const res = await fetch(url);
20
+ return res.json();
21
+ }
22
+
23
+ export async function fetchActiveSessionIds() {
24
+ const res = await fetch("/api/sessions/active");
25
+ const data = await res.json();
26
+ return data.activeSessionIds || [];
27
+ }
28
+
29
+ export async function fetchMessages(sessionId) {
30
+ const res = await fetch(`/api/sessions/${encodeURIComponent(sessionId)}/messages`);
31
+ return res.json();
32
+ }
33
+
34
+ export async function fetchMessagesByChatId(sessionId, chatId) {
35
+ const res = await fetch(`/api/sessions/${encodeURIComponent(sessionId)}/messages/${encodeURIComponent(chatId)}`);
36
+ return res.json();
37
+ }
38
+
39
+ export async function fetchSingleMessages(sessionId) {
40
+ const res = await fetch(`/api/sessions/${encodeURIComponent(sessionId)}/messages-single`);
41
+ return res.json();
42
+ }
43
+
44
+ export async function fetchStats(projectPath) {
45
+ const url = projectPath
46
+ ? `/api/stats?project_path=${encodeURIComponent(projectPath)}`
47
+ : "/api/stats";
48
+ const res = await fetch(url);
49
+ return res.json();
50
+ }
51
+
52
+ export async function fetchHomeData() {
53
+ const res = await fetch("/api/stats/home");
54
+ return res.json();
55
+ }
56
+
57
+ export async function fetchDashboard(projectPath) {
58
+ const url = projectPath
59
+ ? `/api/stats/dashboard?project_path=${encodeURIComponent(projectPath)}`
60
+ : "/api/stats/dashboard";
61
+ const res = await fetch(url);
62
+ return res.json();
63
+ }
64
+
65
+ export async function fetchPrompts() {
66
+ const res = await fetch("/api/prompts");
67
+ return res.json();
68
+ }
69
+
70
+ export async function createPrompt(title, description, prompt) {
71
+ const res = await fetch("/api/prompts", {
72
+ method: "POST",
73
+ headers: { "Content-Type": "application/json" },
74
+ body: JSON.stringify({ title, description, prompt }),
75
+ });
76
+ if (!res.ok) throw new Error("Failed to save");
77
+ return res.json();
78
+ }
79
+
80
+ export async function deletePromptApi(idx) {
81
+ const res = await fetch(`/api/prompts/${idx}`, { method: "DELETE" });
82
+ if (!res.ok) throw new Error("Failed to delete");
83
+ return res.json();
84
+ }
85
+
86
+ export async function fetchWorkflows() {
87
+ const res = await fetch("/api/workflows");
88
+ return res.json();
89
+ }
90
+
91
+ export async function createWorkflow(workflow) {
92
+ const res = await fetch("/api/workflows", {
93
+ method: "POST",
94
+ headers: { "Content-Type": "application/json" },
95
+ body: JSON.stringify(workflow),
96
+ });
97
+ if (!res.ok) {
98
+ const err = await res.json();
99
+ throw new Error(err.error || "Failed to create workflow");
100
+ }
101
+ return res.json();
102
+ }
103
+
104
+ export async function updateWorkflow(id, workflow) {
105
+ const res = await fetch(`/api/workflows/${encodeURIComponent(id)}`, {
106
+ method: "PUT",
107
+ headers: { "Content-Type": "application/json" },
108
+ body: JSON.stringify(workflow),
109
+ });
110
+ if (!res.ok) {
111
+ const err = await res.json();
112
+ throw new Error(err.error || "Failed to update workflow");
113
+ }
114
+ return res.json();
115
+ }
116
+
117
+ export async function deleteWorkflowApi(id) {
118
+ const res = await fetch(`/api/workflows/${encodeURIComponent(id)}`, {
119
+ method: "DELETE",
120
+ });
121
+ if (!res.ok) {
122
+ const err = await res.json();
123
+ throw new Error(err.error || "Failed to delete workflow");
124
+ }
125
+ return res.json();
126
+ }
127
+
128
+ export async function fetchAgents() {
129
+ const res = await fetch("/api/agents");
130
+ return res.json();
131
+ }
132
+
133
+ export async function createAgent(agent) {
134
+ const res = await fetch("/api/agents", {
135
+ method: "POST",
136
+ headers: { "Content-Type": "application/json" },
137
+ body: JSON.stringify(agent),
138
+ });
139
+ if (!res.ok) {
140
+ const err = await res.json();
141
+ throw new Error(err.error || "Failed to create agent");
142
+ }
143
+ return res.json();
144
+ }
145
+
146
+ export async function updateAgent(id, agent) {
147
+ const res = await fetch(`/api/agents/${encodeURIComponent(id)}`, {
148
+ method: "PUT",
149
+ headers: { "Content-Type": "application/json" },
150
+ body: JSON.stringify(agent),
151
+ });
152
+ if (!res.ok) {
153
+ const err = await res.json();
154
+ throw new Error(err.error || "Failed to update agent");
155
+ }
156
+ return res.json();
157
+ }
158
+
159
+ export async function deleteAgentApi(id) {
160
+ const res = await fetch(`/api/agents/${encodeURIComponent(id)}`, {
161
+ method: "DELETE",
162
+ });
163
+ if (!res.ok) {
164
+ const err = await res.json();
165
+ throw new Error(err.error || "Failed to delete agent");
166
+ }
167
+ return res.json();
168
+ }
169
+
170
+ // Agent Chains
171
+ export async function fetchChains() {
172
+ const res = await fetch("/api/agents/chains");
173
+ return res.json();
174
+ }
175
+
176
+ export async function createChain(chain) {
177
+ const res = await fetch("/api/agents/chains", {
178
+ method: "POST",
179
+ headers: { "Content-Type": "application/json" },
180
+ body: JSON.stringify(chain),
181
+ });
182
+ if (!res.ok) {
183
+ const err = await res.json();
184
+ throw new Error(err.error || "Failed to create chain");
185
+ }
186
+ return res.json();
187
+ }
188
+
189
+ export async function updateChain(id, chain) {
190
+ const res = await fetch(`/api/agents/chains/${encodeURIComponent(id)}`, {
191
+ method: "PUT",
192
+ headers: { "Content-Type": "application/json" },
193
+ body: JSON.stringify(chain),
194
+ });
195
+ if (!res.ok) {
196
+ const err = await res.json();
197
+ throw new Error(err.error || "Failed to update chain");
198
+ }
199
+ return res.json();
200
+ }
201
+
202
+ export async function fetchAgentContext(runId) {
203
+ const res = await fetch(`/api/agents/context/${encodeURIComponent(runId)}`);
204
+ return res.json();
205
+ }
206
+
207
+ // Agent DAGs
208
+ export async function fetchDags() {
209
+ const res = await fetch("/api/agents/dags");
210
+ return res.json();
211
+ }
212
+
213
+ export async function createDag(dag) {
214
+ const res = await fetch("/api/agents/dags", {
215
+ method: "POST",
216
+ headers: { "Content-Type": "application/json" },
217
+ body: JSON.stringify(dag),
218
+ });
219
+ if (!res.ok) {
220
+ const err = await res.json();
221
+ throw new Error(err.error || "Failed to create DAG");
222
+ }
223
+ return res.json();
224
+ }
225
+
226
+ export async function updateDag(id, dag) {
227
+ const res = await fetch(`/api/agents/dags/${encodeURIComponent(id)}`, {
228
+ method: "PUT",
229
+ headers: { "Content-Type": "application/json" },
230
+ body: JSON.stringify(dag),
231
+ });
232
+ if (!res.ok) {
233
+ const err = await res.json();
234
+ throw new Error(err.error || "Failed to update DAG");
235
+ }
236
+ return res.json();
237
+ }
238
+
239
+ export async function deleteDagApi(id) {
240
+ const res = await fetch(`/api/agents/dags/${encodeURIComponent(id)}`, {
241
+ method: "DELETE",
242
+ });
243
+ if (!res.ok) {
244
+ const err = await res.json();
245
+ throw new Error(err.error || "Failed to delete DAG");
246
+ }
247
+ return res.json();
248
+ }
249
+
250
+ export async function deleteChainApi(id) {
251
+ const res = await fetch(`/api/agents/chains/${encodeURIComponent(id)}`, {
252
+ method: "DELETE",
253
+ });
254
+ if (!res.ok) {
255
+ const err = await res.json();
256
+ throw new Error(err.error || "Failed to delete chain");
257
+ }
258
+ return res.json();
259
+ }
260
+
261
+ export async function browseFolders(dir) {
262
+ const url = dir
263
+ ? `/api/projects/browse?dir=${encodeURIComponent(dir)}`
264
+ : "/api/projects/browse";
265
+ const res = await fetch(url);
266
+ if (!res.ok) {
267
+ const err = await res.json();
268
+ throw new Error(err.error);
269
+ }
270
+ return res.json();
271
+ }
272
+
273
+ export async function addProject(name, path) {
274
+ const res = await fetch("/api/projects", {
275
+ method: "POST",
276
+ headers: { "Content-Type": "application/json" },
277
+ body: JSON.stringify({ name, path }),
278
+ });
279
+ if (!res.ok) {
280
+ const err = await res.json();
281
+ throw new Error(err.error);
282
+ }
283
+ return res.json();
284
+ }
285
+
286
+ export async function fetchProjectCommands(path) {
287
+ const res = await fetch(`/api/projects/commands?path=${encodeURIComponent(path)}`);
288
+ return res.json();
289
+ }
290
+
291
+ export async function fetchFiles(path) {
292
+ const res = await fetch(`/api/files?path=${encodeURIComponent(path)}`);
293
+ return res.json();
294
+ }
295
+
296
+ export async function fetchFileContent(base, filePath) {
297
+ const res = await fetch(`/api/files/content?base=${encodeURIComponent(base)}&path=${encodeURIComponent(filePath)}`);
298
+ if (!res.ok) {
299
+ const err = await res.json();
300
+ throw new Error(err.error);
301
+ }
302
+ return res.json();
303
+ }
304
+
305
+ export async function writeFileContent(base, filePath, content) {
306
+ const res = await fetch("/api/files/content", {
307
+ method: "PUT",
308
+ headers: { "Content-Type": "application/json" },
309
+ body: JSON.stringify({ base, path: filePath, content }),
310
+ });
311
+ if (!res.ok) {
312
+ const err = await res.json();
313
+ throw new Error(err.error);
314
+ }
315
+ return res.json();
316
+ }
317
+
318
+ export async function fetchFileTree(base, dir = "") {
319
+ let url = `/api/files/tree?base=${encodeURIComponent(base)}`;
320
+ if (dir) url += `&dir=${encodeURIComponent(dir)}`;
321
+ const res = await fetch(url);
322
+ return res.json();
323
+ }
324
+
325
+ export async function searchFiles(base, query) {
326
+ const url = `/api/files/search?base=${encodeURIComponent(base)}&q=${encodeURIComponent(query)}`;
327
+ const res = await fetch(url);
328
+ return res.json();
329
+ }
330
+
331
+ export async function fetchMcpServers(projectPath) {
332
+ let url = "/api/mcp/servers";
333
+ if (projectPath) url += `?project=${encodeURIComponent(projectPath)}`;
334
+ const res = await fetch(url);
335
+ return res.json();
336
+ }
337
+
338
+ export async function saveMcpServer(name, config, projectPath) {
339
+ let url = `/api/mcp/servers/${encodeURIComponent(name)}`;
340
+ if (projectPath) url += `?project=${encodeURIComponent(projectPath)}`;
341
+ const res = await fetch(url, {
342
+ method: "PUT",
343
+ headers: { "Content-Type": "application/json" },
344
+ body: JSON.stringify(config),
345
+ });
346
+ if (!res.ok) throw new Error("Failed to save MCP server");
347
+ return res.json();
348
+ }
349
+
350
+ export async function deleteMcpServer(name, projectPath) {
351
+ let url = `/api/mcp/servers/${encodeURIComponent(name)}`;
352
+ if (projectPath) url += `?project=${encodeURIComponent(projectPath)}`;
353
+ const res = await fetch(url, { method: "DELETE" });
354
+ if (!res.ok) throw new Error("Failed to delete MCP server");
355
+ return res.json();
356
+ }
357
+
358
+ export async function fetchAnalytics(projectPath) {
359
+ const url = projectPath
360
+ ? `/api/stats/analytics?project_path=${encodeURIComponent(projectPath)}`
361
+ : "/api/stats/analytics";
362
+ const res = await fetch(url);
363
+ return res.json();
364
+ }
365
+
366
+ export async function fetchAccountInfo() {
367
+ const res = await fetch("/api/account");
368
+ return res.json();
369
+ }
370
+
371
+ export async function fetchAgentMetrics() {
372
+ const res = await fetch("/api/stats/agent-metrics");
373
+ return res.json();
374
+ }
375
+
376
+ export async function updateSessionTitle(sessionId, title) {
377
+ await fetch(`/api/sessions/${encodeURIComponent(sessionId)}/title`, {
378
+ method: "PUT",
379
+ headers: { "Content-Type": "application/json" },
380
+ body: JSON.stringify({ title }),
381
+ });
382
+ }
383
+
384
+ export async function deleteSessionApi(id) {
385
+ await fetch(`/api/sessions/${encodeURIComponent(id)}`, { method: "DELETE" });
386
+ }
387
+
388
+ export async function toggleSessionPin(sessionId) {
389
+ await fetch(`/api/sessions/${encodeURIComponent(sessionId)}/pin`, { method: "PUT" });
390
+ }
391
+
392
+ export async function generateSummary(sessionId) {
393
+ const res = await fetch(`/api/sessions/${encodeURIComponent(sessionId)}/summary`, { method: "POST" });
394
+ return res.json();
395
+ }
396
+
397
+ export async function saveSystemPromptApi(path, systemPrompt) {
398
+ await fetch("/api/projects/system-prompt", {
399
+ method: "PUT",
400
+ headers: { "Content-Type": "application/json" },
401
+ body: JSON.stringify({ path, systemPrompt }),
402
+ });
403
+ }
404
+
405
+ export async function execCommand(command, cwd) {
406
+ const res = await fetch("/api/exec", {
407
+ method: "POST",
408
+ headers: { "Content-Type": "application/json" },
409
+ body: JSON.stringify({ command, cwd }),
410
+ });
411
+ return res.json();
412
+ }
413
+
414
+ export async function fetchLinearIssues() {
415
+ const res = await fetch("/api/plugins/linear/issues");
416
+ return res.json();
417
+ }
418
+
419
+ export async function fetchLinearTeams() {
420
+ const res = await fetch("/api/plugins/linear/teams");
421
+ return res.json();
422
+ }
423
+
424
+ export async function fetchLinearTeamStates(teamId) {
425
+ const res = await fetch(`/api/plugins/linear/teams/${encodeURIComponent(teamId)}/states`);
426
+ return res.json();
427
+ }
428
+
429
+ export async function createLinearIssue({ title, description, teamId, stateId }) {
430
+ const res = await fetch("/api/plugins/linear/issues", {
431
+ method: "POST",
432
+ headers: { "Content-Type": "application/json" },
433
+ body: JSON.stringify({ title, description, teamId, stateId }),
434
+ });
435
+ if (!res.ok) throw new Error("Failed to create issue");
436
+ return res.json();
437
+ }
438
+
439
+ export async function fetchLinearConfig() {
440
+ const res = await fetch("/api/plugins/linear/config");
441
+ return res.json();
442
+ }
443
+
444
+ export async function saveLinearConfig(config) {
445
+ const res = await fetch("/api/plugins/linear/config", {
446
+ method: "PUT",
447
+ headers: { "Content-Type": "application/json" },
448
+ body: JSON.stringify(config),
449
+ });
450
+ return res.json();
451
+ }
452
+
453
+ export async function testLinearConnection() {
454
+ const res = await fetch("/api/plugins/linear/test", { method: "POST" });
455
+ return res.json();
456
+ }
457
+
458
+ // Tips
459
+ export async function fetchTips() {
460
+ const res = await fetch("/api/tips");
461
+ return res.json();
462
+ }
463
+
464
+ export async function fetchRssFeed(url) {
465
+ const res = await fetch(`/api/tips/rss?url=${encodeURIComponent(url)}`);
466
+ return res.json();
467
+ }
468
+
469
+ // Todos
470
+ const CT = { "Content-Type": "application/json" };
471
+
472
+ export async function fetchTodoCounts() {
473
+ const res = await fetch("/api/plugins/tasks/counts");
474
+ return res.json();
475
+ }
476
+
477
+ export async function fetchTodos(archived = false) {
478
+ const res = await fetch("/api/plugins/tasks" + (archived ? "?archived=1" : ""));
479
+ return res.json();
480
+ }
481
+
482
+ export async function archiveTodoApi(id, archived = true) {
483
+ const res = await fetch(`/api/plugins/tasks/${id}/archive`, { method: "PUT", headers: CT, body: JSON.stringify({ archived }) });
484
+ return res.json();
485
+ }
486
+
487
+ export async function createTodoApi(text) {
488
+ const res = await fetch("/api/plugins/tasks", { method: "POST", headers: CT, body: JSON.stringify({ text }) });
489
+ return res.json();
490
+ }
491
+
492
+ export async function updateTodoApi(id, data) {
493
+ const res = await fetch(`/api/plugins/tasks/${id}`, { method: "PUT", headers: CT, body: JSON.stringify(data) });
494
+ return res.json();
495
+ }
496
+
497
+ export async function deleteTodoApi(id) {
498
+ const res = await fetch(`/api/plugins/tasks/${id}`, { method: "DELETE" });
499
+ return res.json();
500
+ }
501
+
502
+ export async function bragTodoApi(id, summary) {
503
+ const res = await fetch(`/api/plugins/tasks/${id}/brag`, { method: "POST", headers: CT, body: JSON.stringify({ summary }) });
504
+ return res.json();
505
+ }
506
+
507
+ export async function fetchBrags() {
508
+ const res = await fetch("/api/plugins/tasks/brags");
509
+ return res.json();
510
+ }
511
+
512
+ export async function deleteBragApi(id) {
513
+ const res = await fetch(`/api/plugins/tasks/brags/${id}`, { method: "DELETE" });
514
+ return res.json();
515
+ }
516
+
517
+ // Repos
518
+ async function throwApiError(res) {
519
+ const text = await res.text();
520
+ try {
521
+ const err = JSON.parse(text);
522
+ throw new Error(err.error || `Request failed (${res.status})`);
523
+ } catch (e) {
524
+ if (e.message && !e.message.startsWith("Unexpected")) throw e;
525
+ throw new Error(`Request failed (${res.status})`);
526
+ }
527
+ }
528
+
529
+ export async function fetchRepos() {
530
+ const res = await fetch("/api/plugins/repos");
531
+ return res.json();
532
+ }
533
+
534
+ export async function addRepo(name, path, groupId, url) {
535
+ const body = { name, groupId };
536
+ if (path) body.path = path;
537
+ if (url) body.url = url;
538
+ const res = await fetch("/api/plugins/repos/repos", {
539
+ method: "POST",
540
+ headers: { "Content-Type": "application/json" },
541
+ body: JSON.stringify(body),
542
+ });
543
+ if (!res.ok) await throwApiError(res);
544
+ return res.json();
545
+ }
546
+
547
+ export async function updateRepo(id, updates) {
548
+ const res = await fetch(`/api/plugins/repos/repos/${encodeURIComponent(id)}`, {
549
+ method: "PUT",
550
+ headers: { "Content-Type": "application/json" },
551
+ body: JSON.stringify(updates),
552
+ });
553
+ if (!res.ok) await throwApiError(res);
554
+ return res.json();
555
+ }
556
+
557
+ export async function deleteRepo(id) {
558
+ const res = await fetch(`/api/plugins/repos/repos/${encodeURIComponent(id)}`, {
559
+ method: "DELETE",
560
+ });
561
+ if (!res.ok) await throwApiError(res);
562
+ return res.json();
563
+ }
564
+
565
+ export async function createRepoGroup(name, parentId) {
566
+ const res = await fetch("/api/plugins/repos/groups", {
567
+ method: "POST",
568
+ headers: { "Content-Type": "application/json" },
569
+ body: JSON.stringify({ name, parentId }),
570
+ });
571
+ if (!res.ok) await throwApiError(res);
572
+ return res.json();
573
+ }
574
+
575
+ export async function updateRepoGroup(id, updates) {
576
+ const res = await fetch(`/api/plugins/repos/groups/${encodeURIComponent(id)}`, {
577
+ method: "PUT",
578
+ headers: { "Content-Type": "application/json" },
579
+ body: JSON.stringify(updates),
580
+ });
581
+ if (!res.ok) await throwApiError(res);
582
+ return res.json();
583
+ }
584
+
585
+ export async function deleteRepoGroup(id) {
586
+ const res = await fetch(`/api/plugins/repos/groups/${encodeURIComponent(id)}`, {
587
+ method: "DELETE",
588
+ });
589
+ if (!res.ok) await throwApiError(res);
590
+ return res.json();
591
+ }
@@ -0,0 +1,3 @@
1
+ export const CHAT_IDS = ["chat-0", "chat-1", "chat-2", "chat-3"];
2
+ export const AUTOCOMPLETE_LIMIT = 20;
3
+ export const BOT_CHAT_ID = 'assistant-bot';