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,277 @@
1
+ // Workflows
2
+ import { $ } from '../core/dom.js';
3
+ import { getState, setState } from '../core/store.js';
4
+ import { escapeHtml, scrollToBottom } from '../core/utils.js';
5
+ import * as api from '../core/api.js';
6
+ import { commandRegistry, registerCommand } from '../ui/commands.js';
7
+ import { getPane, panes } from '../ui/parallel.js';
8
+ import { showThinking, addStatus } from '../ui/messages.js';
9
+ import { getPermissionMode } from '../ui/permissions.js';
10
+ import { getSelectedModel } from '../ui/model-selector.js';
11
+
12
+ export async function loadWorkflows() {
13
+ try {
14
+ const workflows = await api.fetchWorkflows();
15
+ setState("workflows", workflows);
16
+ renderWorkflowSidebar();
17
+ registerWorkflowCommands();
18
+ } catch (err) {
19
+ console.error("Failed to load workflows:", err);
20
+ }
21
+ }
22
+
23
+ // ══════════════════════════════════════════════════════════
24
+ // Workflow cards in Agent Sidebar
25
+ // ══════════════════════════════════════════════════════════
26
+
27
+ const editSvg = '<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></svg>';
28
+
29
+ function getWorkflowIcon() {
30
+ return '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="22 12 18 12 15 21 9 3 6 12 2 12"/></svg>';
31
+ }
32
+
33
+ export function renderWorkflowSidebar() {
34
+ const workflows = getState("workflows") || [];
35
+ // Remove existing workflow section if present
36
+ const existing = $.agentPanel?.querySelectorAll(".wf-sidebar-section");
37
+ if (existing) existing.forEach(el => el.remove());
38
+
39
+ if (!$.agentPanel) return;
40
+
41
+ const header = document.createElement("div");
42
+ header.className = "agent-section-header wf-sidebar-section";
43
+ header.textContent = "Workflows";
44
+ $.agentPanel.appendChild(header);
45
+
46
+ for (const wf of workflows) {
47
+ const stepLabels = (wf.steps || []).map(s => s.label).filter(Boolean);
48
+ const card = document.createElement("div");
49
+ card.className = "toolbox-card agent-card wf-card wf-sidebar-section";
50
+ card.innerHTML = `
51
+ <div class="agent-card-actions">
52
+ <button class="agent-card-edit" data-wf-id="${escapeHtml(wf.id)}" title="Edit workflow">${editSvg}</button>
53
+ <button class="agent-card-delete" data-wf-id="${escapeHtml(wf.id)}" title="Delete workflow">&times;</button>
54
+ </div>
55
+ <div class="toolbox-card-title">
56
+ <span class="agent-icon">${getWorkflowIcon()}</span>
57
+ ${escapeHtml(wf.title)}
58
+ </div>
59
+ <div class="toolbox-card-desc">${escapeHtml(wf.description || stepLabels.join(" → "))}</div>
60
+ ${stepLabels.length ? `<div class="chain-steps-preview">${stepLabels.map(l => `<span class="chain-step-tag">${escapeHtml(l)}</span>`).join('<span class="chain-arrow">→</span>')}</div>` : ""}
61
+ `;
62
+ card.addEventListener("click", (e) => {
63
+ if (e.target.closest(".agent-card-edit") || e.target.closest(".agent-card-delete")) return;
64
+ $.agentSidebar?.classList.add("hidden");
65
+ $.agentBtn.classList.remove("active");
66
+ startWorkflow(wf, getPane(null));
67
+ });
68
+ card.querySelector(".agent-card-edit").addEventListener("click", (e) => {
69
+ e.stopPropagation();
70
+ openWorkflowModal(wf);
71
+ });
72
+ card.querySelector(".agent-card-delete").addEventListener("click", (e) => {
73
+ e.stopPropagation();
74
+ deleteWorkflow(wf.id, wf.title);
75
+ });
76
+ $.agentPanel.appendChild(card);
77
+ }
78
+
79
+ const addCard = document.createElement("div");
80
+ addCard.className = "toolbox-card-add wf-sidebar-section";
81
+ addCard.innerHTML = `+ New Workflow`;
82
+ addCard.addEventListener("click", () => openWorkflowModal());
83
+ $.agentPanel.appendChild(addCard);
84
+ }
85
+
86
+ // ══════════════════════════════════════════════════════════
87
+ // Workflow CRUD Modal
88
+ // ══════════════════════════════════════════════════════════
89
+
90
+ function addStepRow(label = "", prompt = "") {
91
+ const row = document.createElement("div");
92
+ row.className = "wf-step-row";
93
+ const num = $.wfStepsList.children.length + 1;
94
+ row.innerHTML = `
95
+ <div class="wf-step-number">${num}</div>
96
+ <div class="wf-step-fields">
97
+ <input type="text" placeholder="Step label (e.g. Analyze)" value="${escapeHtml(label)}">
98
+ <textarea placeholder="Prompt for this step..." rows="2">${escapeHtml(prompt)}</textarea>
99
+ </div>
100
+ <button type="button" class="wf-step-remove" title="Remove step">&times;</button>
101
+ `;
102
+ row.querySelector(".wf-step-remove").addEventListener("click", () => {
103
+ row.remove();
104
+ renumberSteps();
105
+ });
106
+ $.wfStepsList.appendChild(row);
107
+ }
108
+
109
+ function renumberSteps() {
110
+ const rows = $.wfStepsList.querySelectorAll(".wf-step-row");
111
+ rows.forEach((row, i) => {
112
+ row.querySelector(".wf-step-number").textContent = i + 1;
113
+ });
114
+ }
115
+
116
+ function getStepsFromForm() {
117
+ const rows = $.wfStepsList.querySelectorAll(".wf-step-row");
118
+ const steps = [];
119
+ rows.forEach(row => {
120
+ const label = row.querySelector("input").value.trim();
121
+ const prompt = row.querySelector("textarea").value.trim();
122
+ if (label || prompt) {
123
+ steps.push({ label: label || `Step ${steps.length + 1}`, prompt });
124
+ }
125
+ });
126
+ return steps;
127
+ }
128
+
129
+ function openWorkflowModal(wf) {
130
+ $.wfForm.reset();
131
+ $.wfStepsList.innerHTML = "";
132
+
133
+ if (wf) {
134
+ $.wfModalTitle.textContent = "Edit Workflow";
135
+ $.wfFormTitle.value = wf.title;
136
+ $.wfFormDesc.value = wf.description || "";
137
+ $.wfFormEditId.value = wf.id;
138
+ for (const step of wf.steps || []) {
139
+ addStepRow(step.label, step.prompt);
140
+ }
141
+ } else {
142
+ $.wfModalTitle.textContent = "New Workflow";
143
+ $.wfFormEditId.value = "";
144
+ addStepRow();
145
+ addStepRow();
146
+ }
147
+ $.wfModal.classList.remove("hidden");
148
+ $.wfFormTitle.focus();
149
+ }
150
+
151
+ function closeWorkflowModal() {
152
+ $.wfModal.classList.add("hidden");
153
+ }
154
+
155
+ $.wfAddStepBtn.addEventListener("click", () => addStepRow());
156
+
157
+ $.wfForm.addEventListener("submit", async (e) => {
158
+ e.preventDefault();
159
+ const editId = $.wfFormEditId.value;
160
+ const steps = getStepsFromForm();
161
+ if (steps.length === 0) {
162
+ alert("Add at least one step with a prompt.");
163
+ return;
164
+ }
165
+ const data = {
166
+ title: $.wfFormTitle.value.trim(),
167
+ description: $.wfFormDesc.value.trim(),
168
+ steps,
169
+ };
170
+ if (!data.title) return;
171
+ try {
172
+ if (editId) {
173
+ await api.updateWorkflow(editId, data);
174
+ } else {
175
+ await api.createWorkflow(data);
176
+ }
177
+ closeWorkflowModal();
178
+ await loadWorkflows();
179
+ } catch (err) {
180
+ console.error("Failed to save workflow:", err);
181
+ alert(err.message);
182
+ }
183
+ });
184
+
185
+ $.wfModalClose.addEventListener("click", closeWorkflowModal);
186
+ $.wfModalCancel.addEventListener("click", closeWorkflowModal);
187
+ $.wfModal.addEventListener("click", (e) => {
188
+ if (e.target === $.wfModal) closeWorkflowModal();
189
+ });
190
+
191
+ async function deleteWorkflow(id, title) {
192
+ if (!confirm(`Delete workflow "${title}"?`)) return;
193
+ try {
194
+ await api.deleteWorkflowApi(id);
195
+ await loadWorkflows();
196
+ } catch (err) {
197
+ console.error("Failed to delete workflow:", err);
198
+ }
199
+ }
200
+
201
+ // ══════════════════════════════════════════════════════════
202
+ // Commands
203
+ // ══════════════════════════════════════════════════════════
204
+
205
+ export function registerWorkflowCommands() {
206
+ for (const [name, cmd] of Object.entries(commandRegistry)) {
207
+ if (cmd.category === "workflow") delete commandRegistry[name];
208
+ }
209
+ const workflows = getState("workflows");
210
+ for (const wf of workflows) {
211
+ registerCommand(wf.id, {
212
+ category: "workflow",
213
+ description: wf.description,
214
+ execute(args, pane) {
215
+ startWorkflow(wf, pane);
216
+ },
217
+ });
218
+ }
219
+ }
220
+
221
+ // ══════════════════════════════════════════════════════════
222
+ // Run Workflow
223
+ // ══════════════════════════════════════════════════════════
224
+
225
+ export function startWorkflow(workflow, pane) {
226
+ pane = pane || getPane(null);
227
+ const cwd = $.projectSelect.value;
228
+ if (!cwd) {
229
+ addStatus("Select a project first", true, pane);
230
+ return;
231
+ }
232
+
233
+ const div = document.createElement("div");
234
+ div.className = "msg";
235
+ const header = document.createElement("div");
236
+ header.className = "workflow-header";
237
+ header.innerHTML = `
238
+ <div class="workflow-title">${escapeHtml(workflow.title)}</div>
239
+ <div class="workflow-progress" id="workflow-progress">
240
+ ${workflow.steps.map((s, i) => `
241
+ <div class="workflow-step" data-step="${i}">
242
+ <span class="workflow-step-dot pending"></span>
243
+ <span class="workflow-step-label">${escapeHtml(s.label)}</span>
244
+ </div>
245
+ `).join("")}
246
+ </div>
247
+ `;
248
+ div.appendChild(header);
249
+ pane.messagesDiv.appendChild(div);
250
+ scrollToBottom(pane);
251
+
252
+ pane.isStreaming = true;
253
+ if (!getState("parallelMode")) {
254
+ $.sendBtn.classList.add("hidden");
255
+ $.stopBtn.classList.remove("hidden");
256
+ }
257
+
258
+ const selectedOption = $.projectSelect.options[$.projectSelect.selectedIndex];
259
+ const projectName = selectedOption?.textContent || "Session";
260
+ const ws = getState("ws");
261
+
262
+ const model = getSelectedModel();
263
+ const wfPayload = {
264
+ type: "workflow",
265
+ workflow,
266
+ cwd,
267
+ sessionId: getState("sessionId"),
268
+ projectName,
269
+ permissionMode: getPermissionMode(),
270
+ };
271
+ if (model) wfPayload.model = model;
272
+ ws.send(JSON.stringify(wfPayload));
273
+
274
+ showThinking(`Running workflow: ${workflow.title}...`, pane);
275
+ }
276
+
277
+ // Workflow button removed — merged into agent-btn which opens the sidebar
@@ -0,0 +1,51 @@
1
+ // Entry point — imports all modules and runs boot sequence
2
+ import './core/store.js';
3
+ import './core/dom.js';
4
+ import './core/constants.js';
5
+ import './core/events.js';
6
+ import './core/utils.js';
7
+ import './ui/formatting.js';
8
+ import './ui/diff.js';
9
+ import './ui/export.js';
10
+ import './ui/theme.js';
11
+ import './core/api.js';
12
+ import './core/ws.js';
13
+ import './ui/commands.js';
14
+ import './ui/messages.js';
15
+ import './ui/parallel.js';
16
+ import './ui/notifications.js';
17
+ import './features/background-sessions.js';
18
+ import './features/sessions.js';
19
+ import './features/projects.js';
20
+ import './features/attachments.js';
21
+ import './features/prompts.js';
22
+ import './features/workflows.js';
23
+ import './features/agents.js';
24
+ import './ui/status-bar.js';
25
+ import './features/cost-dashboard.js';
26
+ import './features/analytics.js';
27
+ import './features/telegram.js';
28
+ import './ui/permissions.js';
29
+ import './ui/model-selector.js';
30
+ import './ui/max-turns.js';
31
+ import './ui/input-meta.js';
32
+ import './ui/right-panel.js';
33
+ import './ui/header-dropdowns.js';
34
+ import './ui/context-gauge.js';
35
+ import './ui/shortcuts.js';
36
+ import './ui/sidebar-toggle.js';
37
+ import './features/voice-input.js';
38
+ import './features/easter-egg.js';
39
+ import './features/welcome.js';
40
+ import './features/home.js';
41
+ import './features/chat.js';
42
+ import './panels/file-explorer.js';
43
+ import './panels/git-panel.js';
44
+ import './panels/mcp-manager.js';
45
+ import './panels/tips-feed.js';
46
+ import './panels/assistant-bot.js';
47
+ import './panels/dev-docs.js';
48
+
49
+ // Auto-discover and load tab-sdk plugins from /js/plugins/
50
+ import { loadPlugins } from './core/plugin-loader.js';
51
+ loadPlugins();