vibe-forge 0.4.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/clear-attention.md +63 -63
- package/.claude/commands/compact-context.md +52 -0
- package/.claude/commands/configure-vcs.md +102 -102
- package/.claude/commands/forge.md +218 -171
- package/.claude/commands/need-help.md +77 -77
- package/.claude/commands/update-status.md +64 -64
- package/.claude/commands/worker-loop.md +106 -106
- package/.claude/hooks/worker-loop.js +217 -187
- package/.claude/scripts/setup-worker-loop.sh +45 -45
- package/.claude/settings.json +89 -0
- package/LICENSE +21 -21
- package/README.md +253 -232
- package/agents/aegis/personality.md +303 -269
- package/agents/anvil/personality.md +278 -240
- package/agents/architect/personality.md +260 -234
- package/agents/crucible/personality.md +362 -309
- package/agents/crucible-x/personality.md +210 -0
- package/agents/ember/personality.md +293 -265
- package/agents/flux/personality.md +248 -0
- package/agents/furnace/personality.md +342 -291
- package/agents/herald/personality.md +249 -247
- package/agents/loki/personality.md +108 -0
- package/agents/oracle/personality.md +284 -0
- package/agents/pixel/personality.md +140 -0
- package/agents/planning-hub/personality.md +473 -251
- package/agents/scribe/personality.md +253 -251
- package/agents/slag/personality.md +268 -0
- package/agents/temper/personality.md +270 -0
- package/bin/cli.js +372 -325
- package/bin/dashboard/api/agents.js +333 -0
- package/bin/dashboard/api/dispatch.js +507 -0
- package/bin/dashboard/api/tasks.js +416 -0
- package/bin/dashboard/public/assets/index-BpHfsx1r.js +2 -0
- package/bin/dashboard/public/assets/index-QODv4Zn9.css +1 -0
- package/bin/dashboard/public/index.html +14 -0
- package/bin/dashboard/server.js +645 -0
- package/bin/forge-daemon.sh +477 -851
- package/bin/forge-setup.sh +661 -645
- package/bin/forge-spawn.sh +164 -164
- package/bin/forge.cmd +83 -83
- package/bin/forge.sh +566 -387
- package/bin/lib/agents.sh +177 -177
- package/bin/lib/check-aliases.js +50 -0
- package/bin/lib/colors.sh +44 -44
- package/bin/lib/config.sh +347 -313
- package/bin/lib/constants.sh +241 -206
- package/bin/lib/daemon/budgets.sh +107 -0
- package/bin/lib/daemon/dependencies.sh +146 -0
- package/bin/lib/daemon/display.sh +128 -0
- package/bin/lib/daemon/notifications.sh +273 -0
- package/bin/lib/daemon/routing.sh +93 -0
- package/bin/lib/daemon/state.sh +163 -0
- package/bin/lib/daemon/sync.sh +103 -0
- package/bin/lib/database.sh +357 -305
- package/bin/lib/frontmatter.js +106 -0
- package/bin/lib/heimdall-setup.js +113 -0
- package/bin/lib/heimdall.js +265 -0
- package/bin/lib/json.sh +264 -258
- package/bin/lib/terminal.js +452 -446
- package/bin/lib/util.sh +126 -126
- package/bin/lib/vcs.js +349 -349
- package/config/agent-manifest.yaml +237 -243
- package/config/agents.json +207 -132
- package/config/task-template.md +159 -87
- package/config/task-types.yaml +111 -106
- package/config/templates/handoff-template.md +40 -0
- package/context/agent-overrides/README.md +41 -0
- package/context/architecture.md +42 -0
- package/context/modern-conventions.md +129 -129
- package/context/project-context-template.md +122 -122
- package/docs/agents.md +473 -409
- package/docs/architecture.md +194 -162
- package/docs/commands.md +451 -388
- package/docs/security.md +195 -144
- package/package.json +77 -50
- package/.claude/settings.local.json +0 -33
- package/agents/forge-master/capabilities.md +0 -144
- package/agents/forge-master/context-template.md +0 -128
- package/agents/forge-master/personality.md +0 -138
- package/agents/sentinel/personality.md +0 -194
- package/context/forge-state.yaml +0 -19
- package/docs/TODO.md +0 -150
- package/docs/getting-started.md +0 -243
- package/docs/npm-publishing.md +0 -95
- package/docs/workflows/README.md +0 -32
- package/docs/workflows/azure-devops.md +0 -108
- package/docs/workflows/bitbucket.md +0 -104
- package/docs/workflows/git-only.md +0 -130
- package/docs/workflows/gitea.md +0 -168
- package/docs/workflows/github.md +0 -103
- package/docs/workflows/gitlab.md +0 -105
- package/docs/workflows.md +0 -454
- package/tasks/completed/ARCH-001-duplicate-agent-config.md +0 -121
- package/tasks/completed/ARCH-002-mixed-bash-node-implementation.md +0 -88
- package/tasks/completed/ARCH-003-worker-loop-hook-duplication.md +0 -77
- package/tasks/completed/ARCH-009-test-organization.md +0 -78
- package/tasks/completed/ARCH-011-jq-vs-nodejs-json.md +0 -94
- package/tasks/completed/ARCH-012-tmp-files-in-root.md +0 -71
- package/tasks/completed/ARCH-013-exit-code-constants.md +0 -65
- package/tasks/completed/ARCH-014-sed-incompatibility.md +0 -96
- package/tasks/completed/ARCH-015-docs-todo-tracking.md +0 -83
- package/tasks/completed/CLEAN-001.md +0 -38
- package/tasks/completed/CLEAN-003.md +0 -47
- package/tasks/completed/CLEAN-004.md +0 -56
- package/tasks/completed/CLEAN-005.md +0 -75
- package/tasks/completed/CLEAN-006.md +0 -47
- package/tasks/completed/CLEAN-007.md +0 -34
- package/tasks/completed/CLEAN-008.md +0 -49
- package/tasks/completed/CLEAN-012.md +0 -58
- package/tasks/completed/CLEAN-013.md +0 -45
- package/tasks/completed/SEC-001-sql-injection-fix.md +0 -58
- package/tasks/completed/SEC-002-notification-injection-fix.md +0 -45
- package/tasks/completed/SEC-003-eval-injection-fix.md +0 -54
- package/tasks/completed/SEC-004-pid-race-condition-fix.md +0 -49
- package/tasks/completed/SEC-005-worker-loop-path-fix.md +0 -51
- package/tasks/completed/SEC-006-eval-agent-names.md +0 -55
- package/tasks/completed/SEC-007-spawn-escaping.md +0 -67
- package/tasks/pending/ARCH-004-git-bash-detection-duplication.md +0 -72
- package/tasks/pending/ARCH-005-missing-src-directory.md +0 -95
- package/tasks/pending/ARCH-006-task-template-location.md +0 -64
- package/tasks/pending/ARCH-007-daemon-monolith.md +0 -91
- package/tasks/pending/ARCH-008-forge-master-vs-hub.md +0 -81
- package/tasks/pending/ARCH-010-missing-index-files.md +0 -84
- package/tasks/pending/CLEAN-002.md +0 -29
- package/tasks/pending/CLEAN-009.md +0 -31
- package/tasks/pending/CLEAN-010.md +0 -30
- package/tasks/pending/CLEAN-011.md +0 -30
- package/tasks/pending/CLEAN-014.md +0 -32
- package/tasks/review/task-001.md +0 -78
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tasks API - List and manage tasks from tasks/ directory
|
|
3
|
+
*
|
|
4
|
+
* Endpoints:
|
|
5
|
+
* GET /api/tasks - List all tasks grouped by status
|
|
6
|
+
* GET /api/tasks/:id - Get single task details
|
|
7
|
+
* POST /api/tasks - Create new task
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const fs = require('fs');
|
|
11
|
+
const path = require('path');
|
|
12
|
+
|
|
13
|
+
// Task directory structure
|
|
14
|
+
const TASK_DIRS = ['pending', 'in-progress', 'review', 'completed'];
|
|
15
|
+
|
|
16
|
+
// =============================================================================
|
|
17
|
+
// Task List Cache
|
|
18
|
+
// =============================================================================
|
|
19
|
+
// Avoids a full filesystem scan on every GET /api/tasks request.
|
|
20
|
+
// Invalidation strategy: track each task directory's mtime. When any directory
|
|
21
|
+
// mtime changes (file added, removed, or renamed), the cache is invalidated
|
|
22
|
+
// and rebuilt on the next request. This is O(TASK_DIRS) stat calls vs. O(N)
|
|
23
|
+
// file reads per request, and is the same pattern used by the daemon's
|
|
24
|
+
// sync_agent_status_to_db (mtime filtering before DB upsert).
|
|
25
|
+
|
|
26
|
+
/** @type {Object|null} Cached listTasks result */
|
|
27
|
+
let _taskCache = null;
|
|
28
|
+
|
|
29
|
+
/** @type {Object.<string, number|null>} Last-seen mtime per task dir */
|
|
30
|
+
let _taskCacheMtimes = {};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Returns true if all task directory mtimes match the recorded values.
|
|
34
|
+
* A null entry means the directory was absent when last recorded.
|
|
35
|
+
* @param {string} tasksDir - Absolute path to tasks/ root
|
|
36
|
+
* @returns {boolean}
|
|
37
|
+
*/
|
|
38
|
+
function isTaskCacheValid(tasksDir) {
|
|
39
|
+
if (!_taskCache) return false;
|
|
40
|
+
for (const dir of TASK_DIRS) {
|
|
41
|
+
const dirPath = path.join(tasksDir, dir);
|
|
42
|
+
try {
|
|
43
|
+
const currentMtime = fs.statSync(dirPath).mtimeMs;
|
|
44
|
+
if (currentMtime !== _taskCacheMtimes[dir]) return false;
|
|
45
|
+
} catch (_err) {
|
|
46
|
+
// Directory does not exist — invalid if we previously recorded it
|
|
47
|
+
if (_taskCacheMtimes[dir] !== null) return false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Snapshots the current mtime of each task directory.
|
|
55
|
+
* Called after a successful scan to anchor the cache.
|
|
56
|
+
* @param {string} tasksDir - Absolute path to tasks/ root
|
|
57
|
+
*/
|
|
58
|
+
function recordTaskCacheMtimes(tasksDir) {
|
|
59
|
+
for (const dir of TASK_DIRS) {
|
|
60
|
+
const dirPath = path.join(tasksDir, dir);
|
|
61
|
+
try {
|
|
62
|
+
_taskCacheMtimes[dir] = fs.statSync(dirPath).mtimeMs;
|
|
63
|
+
} catch (_err) {
|
|
64
|
+
_taskCacheMtimes[dir] = null;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Manually invalidate the task cache (e.g. after createTask).
|
|
71
|
+
* The next listTasks call will trigger a full rescan.
|
|
72
|
+
*/
|
|
73
|
+
function invalidateTaskCache() {
|
|
74
|
+
_taskCache = null;
|
|
75
|
+
_taskCacheMtimes = {};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Parse YAML-like frontmatter from task file
|
|
80
|
+
* @param {string} content - File content
|
|
81
|
+
* @returns {Object} Parsed frontmatter and body
|
|
82
|
+
*/
|
|
83
|
+
function parseFrontmatter(content) {
|
|
84
|
+
const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
|
|
85
|
+
|
|
86
|
+
if (!frontmatterMatch) {
|
|
87
|
+
return { metadata: {}, body: content };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const frontmatter = frontmatterMatch[1];
|
|
91
|
+
const body = frontmatterMatch[2];
|
|
92
|
+
|
|
93
|
+
// Parse YAML-like frontmatter (simple key: value format)
|
|
94
|
+
const metadata = {};
|
|
95
|
+
const lines = frontmatter.split('\n');
|
|
96
|
+
|
|
97
|
+
for (const line of lines) {
|
|
98
|
+
const match = line.match(/^([a-z_-]+):\s*(.*)$/i);
|
|
99
|
+
if (match) {
|
|
100
|
+
let value = match[2].trim();
|
|
101
|
+
// Remove quotes if present
|
|
102
|
+
if ((value.startsWith('"') && value.endsWith('"')) ||
|
|
103
|
+
(value.startsWith("'") && value.endsWith("'"))) {
|
|
104
|
+
value = value.slice(1, -1);
|
|
105
|
+
}
|
|
106
|
+
// Handle null
|
|
107
|
+
if (value === 'null') {
|
|
108
|
+
value = null;
|
|
109
|
+
}
|
|
110
|
+
metadata[match[1]] = value;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return { metadata, body };
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Read a single task file
|
|
119
|
+
* @param {string} filePath - Path to task file
|
|
120
|
+
* @returns {Object|null} Task object or null if invalid
|
|
121
|
+
*/
|
|
122
|
+
function readTaskFile(filePath) {
|
|
123
|
+
try {
|
|
124
|
+
const content = fs.readFileSync(filePath, 'utf8');
|
|
125
|
+
const { metadata, body } = parseFrontmatter(content);
|
|
126
|
+
|
|
127
|
+
// Extract title from body if not in metadata
|
|
128
|
+
if (!metadata.title) {
|
|
129
|
+
const titleMatch = body.match(/^#\s+(.+)$/m);
|
|
130
|
+
if (titleMatch) {
|
|
131
|
+
metadata.title = titleMatch[1];
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Get file stats for timestamps
|
|
136
|
+
const stats = fs.statSync(filePath);
|
|
137
|
+
|
|
138
|
+
return {
|
|
139
|
+
id: metadata.id || path.basename(filePath, '.md'),
|
|
140
|
+
title: metadata.title || path.basename(filePath, '.md'),
|
|
141
|
+
type: metadata.type || 'task',
|
|
142
|
+
priority: metadata.priority || 'medium',
|
|
143
|
+
status: metadata.status || 'unknown',
|
|
144
|
+
assignedTo: metadata.assigned_to || null,
|
|
145
|
+
createdAt: metadata.created_at || stats.birthtime.toISOString(),
|
|
146
|
+
createdBy: metadata.created_by || 'unknown',
|
|
147
|
+
parent: metadata.parent || null,
|
|
148
|
+
file: path.basename(filePath),
|
|
149
|
+
filePath: filePath,
|
|
150
|
+
modifiedAt: stats.mtime.toISOString()
|
|
151
|
+
};
|
|
152
|
+
} catch (err) {
|
|
153
|
+
console.error(`[Tasks] Error reading ${filePath}: ${err.message}`);
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Get task details including full body
|
|
160
|
+
* @param {string} filePath - Path to task file
|
|
161
|
+
* @returns {Object|null} Full task object or null
|
|
162
|
+
*/
|
|
163
|
+
function readTaskFull(filePath) {
|
|
164
|
+
try {
|
|
165
|
+
const content = fs.readFileSync(filePath, 'utf8');
|
|
166
|
+
const { metadata, body } = parseFrontmatter(content);
|
|
167
|
+
const stats = fs.statSync(filePath);
|
|
168
|
+
|
|
169
|
+
return {
|
|
170
|
+
id: metadata.id || path.basename(filePath, '.md'),
|
|
171
|
+
title: metadata.title || path.basename(filePath, '.md'),
|
|
172
|
+
type: metadata.type || 'task',
|
|
173
|
+
priority: metadata.priority || 'medium',
|
|
174
|
+
status: metadata.status || 'unknown',
|
|
175
|
+
assignedTo: metadata.assigned_to || null,
|
|
176
|
+
createdAt: metadata.created_at || stats.birthtime.toISOString(),
|
|
177
|
+
createdBy: metadata.created_by || 'unknown',
|
|
178
|
+
parent: metadata.parent || null,
|
|
179
|
+
file: path.basename(filePath),
|
|
180
|
+
filePath: filePath,
|
|
181
|
+
modifiedAt: stats.mtime.toISOString(),
|
|
182
|
+
body: body.trim(),
|
|
183
|
+
raw: content
|
|
184
|
+
};
|
|
185
|
+
} catch (err) {
|
|
186
|
+
console.error(`[Tasks] Error reading full ${filePath}: ${err.message}`);
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* List all tasks grouped by status.
|
|
193
|
+
* Results are cached and only rescanned when a task directory's mtime changes
|
|
194
|
+
* (i.e. a file was added, removed, or renamed). Individual file edits that
|
|
195
|
+
* don't change the directory mtime will not invalidate the list cache — use
|
|
196
|
+
* GET /api/tasks/:id for live file content.
|
|
197
|
+
*
|
|
198
|
+
* @param {string} projectRoot - Project root directory
|
|
199
|
+
* @returns {Object} Tasks grouped by status
|
|
200
|
+
*/
|
|
201
|
+
async function listTasks(projectRoot) {
|
|
202
|
+
const tasksDir = path.join(projectRoot, 'tasks');
|
|
203
|
+
|
|
204
|
+
// Return cached result when no directory has changed
|
|
205
|
+
if (isTaskCacheValid(tasksDir)) {
|
|
206
|
+
return _taskCache;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const result = {
|
|
210
|
+
pending: [],
|
|
211
|
+
'in-progress': [],
|
|
212
|
+
review: [],
|
|
213
|
+
completed: [],
|
|
214
|
+
summary: {
|
|
215
|
+
total: 0,
|
|
216
|
+
pending: 0,
|
|
217
|
+
inProgress: 0,
|
|
218
|
+
review: 0,
|
|
219
|
+
completed: 0
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
for (const dir of TASK_DIRS) {
|
|
224
|
+
const dirPath = path.join(tasksDir, dir);
|
|
225
|
+
|
|
226
|
+
if (!fs.existsSync(dirPath)) {
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
const files = fs.readdirSync(dirPath).filter(f => f.endsWith('.md'));
|
|
231
|
+
|
|
232
|
+
for (const file of files) {
|
|
233
|
+
const filePath = path.join(dirPath, file);
|
|
234
|
+
const task = readTaskFile(filePath);
|
|
235
|
+
|
|
236
|
+
if (task) {
|
|
237
|
+
result[dir].push(task);
|
|
238
|
+
result.summary.total++;
|
|
239
|
+
|
|
240
|
+
switch (dir) {
|
|
241
|
+
case 'pending':
|
|
242
|
+
result.summary.pending++;
|
|
243
|
+
break;
|
|
244
|
+
case 'in-progress':
|
|
245
|
+
result.summary.inProgress++;
|
|
246
|
+
break;
|
|
247
|
+
case 'review':
|
|
248
|
+
result.summary.review++;
|
|
249
|
+
break;
|
|
250
|
+
case 'completed':
|
|
251
|
+
result.summary.completed++;
|
|
252
|
+
break;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// Sort by priority (critical > high > medium > low)
|
|
258
|
+
const priorityOrder = { critical: 0, high: 1, medium: 2, low: 3 };
|
|
259
|
+
result[dir].sort((a, b) => {
|
|
260
|
+
const pa = priorityOrder[a.priority] ?? 2;
|
|
261
|
+
const pb = priorityOrder[b.priority] ?? 2;
|
|
262
|
+
return pa - pb;
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// Store result and anchor mtimes for next validation
|
|
267
|
+
recordTaskCacheMtimes(tasksDir);
|
|
268
|
+
_taskCache = result;
|
|
269
|
+
|
|
270
|
+
return result;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Get a single task by ID
|
|
275
|
+
* @param {string} projectRoot - Project root directory
|
|
276
|
+
* @param {string} taskId - Task ID to find
|
|
277
|
+
* @returns {Object|null} Task object or null
|
|
278
|
+
*/
|
|
279
|
+
async function getTask(projectRoot, taskId) {
|
|
280
|
+
const tasksDir = path.join(projectRoot, 'tasks');
|
|
281
|
+
|
|
282
|
+
// Sanitize task ID to prevent path traversal
|
|
283
|
+
const safeId = taskId.replace(/[^a-zA-Z0-9_-]/g, '');
|
|
284
|
+
|
|
285
|
+
for (const dir of TASK_DIRS) {
|
|
286
|
+
const dirPath = path.join(tasksDir, dir);
|
|
287
|
+
|
|
288
|
+
if (!fs.existsSync(dirPath)) {
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
const files = fs.readdirSync(dirPath).filter(f => f.endsWith('.md'));
|
|
293
|
+
|
|
294
|
+
for (const file of files) {
|
|
295
|
+
// Check if filename starts with task ID
|
|
296
|
+
if (file.startsWith(safeId) || file === `${safeId}.md`) {
|
|
297
|
+
const filePath = path.join(dirPath, file);
|
|
298
|
+
return readTaskFull(filePath);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// Also check file content for matching ID
|
|
302
|
+
const task = readTaskFile(path.join(dirPath, file));
|
|
303
|
+
if (task && task.id === safeId) {
|
|
304
|
+
return readTaskFull(path.join(dirPath, file));
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
return null;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Create a new task file
|
|
314
|
+
* @param {string} projectRoot - Project root directory
|
|
315
|
+
* @param {Object} taskData - Task data
|
|
316
|
+
* @returns {Object} Created task
|
|
317
|
+
*/
|
|
318
|
+
async function createTask(projectRoot, taskData) {
|
|
319
|
+
const tasksDir = path.join(projectRoot, 'tasks', 'pending');
|
|
320
|
+
|
|
321
|
+
// Validate required fields
|
|
322
|
+
if (!taskData.title) {
|
|
323
|
+
throw new Error('Task title is required');
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// Generate task ID if not provided
|
|
327
|
+
const id = taskData.id || generateTaskId(taskData.type || 'TASK');
|
|
328
|
+
|
|
329
|
+
// Sanitize ID
|
|
330
|
+
const safeId = id.replace(/[^a-zA-Z0-9_-]/g, '');
|
|
331
|
+
|
|
332
|
+
// Generate filename
|
|
333
|
+
const slug = taskData.title
|
|
334
|
+
.toLowerCase()
|
|
335
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
336
|
+
.replace(/^-|-$/g, '')
|
|
337
|
+
.substring(0, 50);
|
|
338
|
+
|
|
339
|
+
const filename = `${safeId}-${slug}.md`;
|
|
340
|
+
const filePath = path.join(tasksDir, filename);
|
|
341
|
+
|
|
342
|
+
// Check if file already exists
|
|
343
|
+
if (fs.existsSync(filePath)) {
|
|
344
|
+
throw new Error(`Task file already exists: ${filename}`);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// Build task content
|
|
348
|
+
const now = new Date().toISOString();
|
|
349
|
+
const content = `---
|
|
350
|
+
id: ${safeId}
|
|
351
|
+
title: "${taskData.title.replace(/"/g, '\\"')}"
|
|
352
|
+
type: ${taskData.type || 'task'}
|
|
353
|
+
priority: ${taskData.priority || 'medium'}
|
|
354
|
+
status: pending
|
|
355
|
+
created_at: ${now}
|
|
356
|
+
created_by: ${taskData.createdBy || 'dashboard'}
|
|
357
|
+
assigned_to: ${taskData.assignedTo || 'null'}
|
|
358
|
+
---
|
|
359
|
+
|
|
360
|
+
# ${taskData.title}
|
|
361
|
+
|
|
362
|
+
## Summary
|
|
363
|
+
|
|
364
|
+
${taskData.summary || taskData.description || 'No description provided.'}
|
|
365
|
+
|
|
366
|
+
## Context
|
|
367
|
+
|
|
368
|
+
${taskData.context || 'Created via dashboard dispatch.'}
|
|
369
|
+
|
|
370
|
+
## Acceptance Criteria
|
|
371
|
+
|
|
372
|
+
- [ ] Task completed successfully
|
|
373
|
+
`;
|
|
374
|
+
|
|
375
|
+
// Ensure directory exists
|
|
376
|
+
if (!fs.existsSync(tasksDir)) {
|
|
377
|
+
fs.mkdirSync(tasksDir, { recursive: true });
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// Write file
|
|
381
|
+
fs.writeFileSync(filePath, content, 'utf8');
|
|
382
|
+
|
|
383
|
+
console.log(`[Tasks] Created: ${filename}`);
|
|
384
|
+
|
|
385
|
+
// Invalidate list cache — the pending directory mtime will have changed,
|
|
386
|
+
// but proactively clearing is cheaper than letting the next request do
|
|
387
|
+
// a stat comparison that would miss in-process writes on some OS/FS combos.
|
|
388
|
+
invalidateTaskCache();
|
|
389
|
+
|
|
390
|
+
// Return created task
|
|
391
|
+
return readTaskFile(filePath);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Generate a unique task ID
|
|
396
|
+
* @param {string} prefix - ID prefix (e.g., 'TASK', 'AUTO')
|
|
397
|
+
* @returns {string} Generated ID
|
|
398
|
+
*/
|
|
399
|
+
function generateTaskId(prefix = 'TASK') {
|
|
400
|
+
const timestamp = Date.now().toString(36).toUpperCase();
|
|
401
|
+
const random = Math.random().toString(36).substring(2, 5).toUpperCase();
|
|
402
|
+
return `${prefix}-${timestamp}-${random}`;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
module.exports = {
|
|
406
|
+
listTasks,
|
|
407
|
+
getTask,
|
|
408
|
+
createTask,
|
|
409
|
+
readTaskFile,
|
|
410
|
+
readTaskFull,
|
|
411
|
+
parseFrontmatter,
|
|
412
|
+
invalidateTaskCache,
|
|
413
|
+
// Exported for testing only:
|
|
414
|
+
isTaskCacheValid,
|
|
415
|
+
recordTaskCacheMtimes
|
|
416
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var ha=Object.defineProperty;var br=e=>{throw TypeError(e)};var _a=(e,t,n)=>t in e?ha(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Re=(e,t,n)=>_a(e,typeof t!="symbol"?t+"":t,n),fs=(e,t,n)=>t.has(e)||br("Cannot "+n);var p=(e,t,n)=>(fs(e,t,"read from private field"),n?n.call(e):t.get(e)),H=(e,t,n)=>t.has(e)?br("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),U=(e,t,n,s)=>(fs(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n),ie=(e,t,n)=>(fs(e,t,"access private method"),n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function n(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(r){if(r.ep)return;r.ep=!0;const i=n(r);fetch(r.href,i)}})();const ga="5";var Fr;typeof window<"u"&&((Fr=window.__svelte??(window.__svelte={})).v??(Fr.v=new Set)).add(ga);let fn=!1,ba=!1;function ma(){fn=!0}ma();const ya=1,wa=2,Pr=4,ka=8,Ea=16,xa=2,Ta=4,Sa=8,Aa=1,$a=2,ae=Symbol(),Ia="http://www.w3.org/1999/xhtml",gs=!1;var Rr=Array.isArray,Ca=Array.prototype.indexOf,ss=Array.from,Br=Object.defineProperty,Gt=Object.getOwnPropertyDescriptor,Ur=Object.getOwnPropertyDescriptors,Da=Object.prototype,Ma=Array.prototype,Hs=Object.getPrototypeOf,mr=Object.isExtensible;const dt=()=>{};function Na(e){return e()}function Gn(e){for(var t=0;t<e.length;t++)e[t]()}function jr(){var e,t,n=new Promise((s,r)=>{e=s,t=r});return{promise:n,resolve:e,reject:t}}const ue=2,Kn=4,Tn=8,Hr=1<<24,st=16,rt=32,Ft=64,Vs=128,Ne=512,le=1024,_e=2048,Xe=4096,$e=8192,tt=16384,qs=32768,nn=65536,yr=1<<17,Vr=1<<18,dn=1<<19,qr=1<<20,Qe=1<<25,Nt=32768,bs=1<<21,Gs=1<<22,vt=1<<23,$t=Symbol("$state"),La=Symbol("legacy props"),Oa=Symbol(""),jt=new class extends Error{constructor(){super(...arguments);Re(this,"name","StaleReactionError");Re(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};function Gr(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Fa(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Pa(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Ra(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Ba(e){throw new Error("https://svelte.dev/e/effect_orphan")}function Ua(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function ja(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Ha(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Va(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function qa(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}function Ga(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function Kr(e){return e===this.v}function Yr(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function Wr(e){return!Yr(e,this.v)}let Z=null;function sn(e){Z=e}function fe(e,t=!1,n){Z={p:Z,i:!1,c:null,e:null,s:e,x:null,l:fn&&!t?{s:null,u:null,$:[]}:null}}function de(e){var t=Z,n=t.e;if(n!==null){t.e=null;for(var s of n)vi(s)}return t.i=!0,Z=t.p,{}}function Sn(){return!fn||Z!==null&&Z.l===null}let Ht=[];function Ka(){var e=Ht;Ht=[],Gn(e)}function An(e){if(Ht.length===0){var t=Ht;queueMicrotask(()=>{t===Ht&&Ka()})}Ht.push(e)}function zr(e){var t=G;if(t===null)return R.f|=vt,e;if(t.f&qs)rn(e,t);else{if(!(t.f&Vs))throw e;t.b.error(e)}}function rn(e,t){for(;t!==null;){if(t.f&Vs)try{t.b.error(e);return}catch(n){e=n}t=t.parent}throw e}const Ya=-7169;function ne(e,t){e.f=e.f&Ya|t}function Ks(e){e.f&Ne||e.deps===null?ne(e,le):ne(e,Xe)}function Xr(e){if(e!==null)for(const t of e)!(t.f&ue)||!(t.f&Nt)||(t.f^=Nt,Xr(t.deps))}function Jr(e,t,n){e.f&_e?t.add(e):e.f&Xe&&n.add(e),Xr(e.deps),ne(e,le)}const Nn=new Set;let X=null,oe=null,qe=[],Ys=null,ms=!1;var Xt,Jt,kt,Et,kn,Zt,Qt,Fe,ys,ws,Zr,Qr;const es=class es{constructor(){H(this,Fe);Re(this,"committed",!1);Re(this,"current",new Map);Re(this,"previous",new Map);H(this,Xt,new Set);H(this,Jt,new Set);H(this,kt,0);H(this,Et,0);H(this,kn,null);H(this,Zt,new Set);H(this,Qt,new Set);Re(this,"skipped_effects",new Set);Re(this,"is_fork",!1)}is_deferred(){return this.is_fork||p(this,Et)>0}process(t){var r;qe=[],this.apply();var n=[],s=[];for(const i of t)ie(this,Fe,ys).call(this,i,n,s);this.is_fork||ie(this,Fe,Zr).call(this),this.is_deferred()?(ie(this,Fe,ws).call(this,s),ie(this,Fe,ws).call(this,n)):(X=null,wr(s),wr(n),(r=p(this,kn))==null||r.resolve()),oe=null}capture(t,n){n!==ae&&!this.previous.has(t)&&this.previous.set(t,n),t.f&vt||(this.current.set(t,t.v),oe==null||oe.set(t,t.v))}activate(){X=this,this.apply()}deactivate(){X===this&&(X=null,oe=null)}flush(){if(this.activate(),qe.length>0){if(Wa(),X!==null&&X!==this)return}else p(this,kt)===0&&this.process([]);this.deactivate()}discard(){for(const t of p(this,Jt))t(this);p(this,Jt).clear()}increment(t){U(this,kt,p(this,kt)+1),t&&U(this,Et,p(this,Et)+1)}decrement(t){U(this,kt,p(this,kt)-1),t&&U(this,Et,p(this,Et)-1),this.revive()}revive(){for(const t of p(this,Zt))p(this,Qt).delete(t),ne(t,_e),nt(t);for(const t of p(this,Qt))ne(t,Xe),nt(t);this.flush()}oncommit(t){p(this,Xt).add(t)}ondiscard(t){p(this,Jt).add(t)}settled(){return(p(this,kn)??U(this,kn,jr())).promise}static ensure(){if(X===null){const t=X=new es;Nn.add(X),es.enqueue(()=>{X===t&&t.flush()})}return X}static enqueue(t){An(t)}apply(){}};Xt=new WeakMap,Jt=new WeakMap,kt=new WeakMap,Et=new WeakMap,kn=new WeakMap,Zt=new WeakMap,Qt=new WeakMap,Fe=new WeakSet,ys=function(t,n,s){t.f^=le;for(var r=t.first,i=null;r!==null;){var o=r.f,l=(o&(rt|Ft))!==0,a=l&&(o&le)!==0,c=a||(o&$e)!==0||this.skipped_effects.has(r);if(!c&&r.fn!==null){l?r.f^=le:i!==null&&o&(Kn|Tn|Hr)?i.b.defer_effect(r):o&Kn?n.push(r):vn(r)&&(o&st&&p(this,Zt).add(r),ln(r));var u=r.first;if(u!==null){r=u;continue}}var g=r.parent;for(r=r.next;r===null&&g!==null;)g===i&&(i=null),r=g.next,g=g.parent}},ws=function(t){for(var n=0;n<t.length;n+=1)Jr(t[n],p(this,Zt),p(this,Qt))},Zr=function(){if(p(this,Et)===0){for(const t of p(this,Xt))t();p(this,Xt).clear()}p(this,kt)===0&&ie(this,Fe,Qr).call(this)},Qr=function(){var r;if(Nn.size>1){this.previous.clear();var t=oe,n=!0;for(const i of Nn){if(i===this){n=!1;continue}const o=[];for(const[a,c]of this.current){if(i.current.has(a))if(n&&c!==i.current.get(a))i.current.set(a,c);else continue;o.push(a)}if(o.length===0)continue;const l=[...i.current.keys()].filter(a=>!this.current.has(a));if(l.length>0){var s=qe;qe=[];const a=new Set,c=new Map;for(const u of o)ei(u,l,a,c);if(qe.length>0){X=i,i.apply();for(const u of qe)ie(r=i,Fe,ys).call(r,u,[],[]);i.deactivate()}qe=s}}X=null,oe=t}this.committed=!0,Nn.delete(this)};let et=es;function Wa(){var e=Ct;ms=!0;var t=null;try{var n=0;for(Wn(!0);qe.length>0;){var s=et.ensure();if(n++>1e3){var r,i;za()}s.process(qe),pt.clear()}}finally{ms=!1,Wn(e),Ys=null}}function za(){try{Ua()}catch(e){rn(e,Ys)}}let Be=null;function wr(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var s=e[n++];if(!(s.f&(tt|$e))&&vn(s)&&(Be=new Set,ln(s),s.deps===null&&s.first===null&&s.nodes===null&&(s.teardown===null&&s.ac===null?_i(s):s.fn=null),(Be==null?void 0:Be.size)>0)){pt.clear();for(const r of Be){if(r.f&(tt|$e))continue;const i=[r];let o=r.parent;for(;o!==null;)Be.has(o)&&(Be.delete(o),i.push(o)),o=o.parent;for(let l=i.length-1;l>=0;l--){const a=i[l];a.f&(tt|$e)||ln(a)}}Be.clear()}}Be=null}}function ei(e,t,n,s){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(const r of e.reactions){const i=r.f;i&ue?ei(r,t,n,s):i&(Gs|st)&&!(i&_e)&&ti(r,t,s)&&(ne(r,_e),nt(r))}}function ti(e,t,n){const s=n.get(e);if(s!==void 0)return s;if(e.deps!==null)for(const r of e.deps){if(t.includes(r))return!0;if(r.f&ue&&ti(r,t,n))return n.set(r,!0),!0}return n.set(e,!1),!1}function nt(e){for(var t=Ys=e;t.parent!==null;){t=t.parent;var n=t.f;if(ms&&t===G&&n&st&&!(n&Vr))return;if(n&(Ft|rt)){if(!(n&le))return;t.f^=le}}qe.push(t)}function Xa(e){let t=0,n=Lt(0),s;return()=>{Js()&&(d(n),rs(()=>(t===0&&(s=N(()=>e(()=>gn(n)))),t+=1,()=>{An(()=>{t-=1,t===0&&(s==null||s(),s=void 0,gn(n))})})))}}var Ja=nn|dn|Vs;function Za(e,t,n){new Qa(e,t,n)}var Ce,js,Ge,xt,Ke,De,me,Ye,Ze,ct,Tt,ut,St,en,tn,ft,ts,re,eo,to,ks,Fn,Pn,Es;class Qa{constructor(t,n,s){H(this,re);Re(this,"parent");Re(this,"is_pending",!1);H(this,Ce);H(this,js,null);H(this,Ge);H(this,xt);H(this,Ke);H(this,De,null);H(this,me,null);H(this,Ye,null);H(this,Ze,null);H(this,ct,null);H(this,Tt,0);H(this,ut,0);H(this,St,!1);H(this,en,new Set);H(this,tn,new Set);H(this,ft,null);H(this,ts,Xa(()=>(U(this,ft,Lt(p(this,Tt))),()=>{U(this,ft,null)})));U(this,Ce,t),U(this,Ge,n),U(this,xt,s),this.parent=G.b,this.is_pending=!!p(this,Ge).pending,U(this,Ke,Zs(()=>{G.b=this;{var r=ie(this,re,ks).call(this);try{U(this,De,Me(()=>s(r)))}catch(i){this.error(i)}p(this,ut)>0?ie(this,re,Pn).call(this):this.is_pending=!1}return()=>{var i;(i=p(this,ct))==null||i.remove()}},Ja))}defer_effect(t){Jr(t,p(this,en),p(this,tn))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!p(this,Ge).pending}update_pending_count(t){ie(this,re,Es).call(this,t),U(this,Tt,p(this,Tt)+t),p(this,ft)&&an(p(this,ft),p(this,Tt))}get_effect_pending(){return p(this,ts).call(this),d(p(this,ft))}error(t){var n=p(this,Ge).onerror;let s=p(this,Ge).failed;if(p(this,St)||!n&&!s)throw t;p(this,De)&&(Ee(p(this,De)),U(this,De,null)),p(this,me)&&(Ee(p(this,me)),U(this,me,null)),p(this,Ye)&&(Ee(p(this,Ye)),U(this,Ye,null));var r=!1,i=!1;const o=()=>{if(r){Ga();return}r=!0,i&&qa(),et.ensure(),U(this,Tt,0),p(this,Ye)!==null&&It(p(this,Ye),()=>{U(this,Ye,null)}),this.is_pending=this.has_pending_snippet(),U(this,De,ie(this,re,Fn).call(this,()=>(U(this,St,!1),Me(()=>p(this,xt).call(this,p(this,Ce)))))),p(this,ut)>0?ie(this,re,Pn).call(this):this.is_pending=!1};var l=R;try{we(null),i=!0,n==null||n(t,o),i=!1}catch(a){rn(a,p(this,Ke)&&p(this,Ke).parent)}finally{we(l)}s&&An(()=>{U(this,Ye,ie(this,re,Fn).call(this,()=>{et.ensure(),U(this,St,!0);try{return Me(()=>{s(p(this,Ce),()=>t,()=>o)})}catch(a){return rn(a,p(this,Ke).parent),null}finally{U(this,St,!1)}}))})}}Ce=new WeakMap,js=new WeakMap,Ge=new WeakMap,xt=new WeakMap,Ke=new WeakMap,De=new WeakMap,me=new WeakMap,Ye=new WeakMap,Ze=new WeakMap,ct=new WeakMap,Tt=new WeakMap,ut=new WeakMap,St=new WeakMap,en=new WeakMap,tn=new WeakMap,ft=new WeakMap,ts=new WeakMap,re=new WeakSet,eo=function(){try{U(this,De,Me(()=>p(this,xt).call(this,p(this,Ce))))}catch(t){this.error(t)}},to=function(){const t=p(this,Ge).pending;t&&(U(this,me,Me(()=>t(p(this,Ce)))),et.enqueue(()=>{var n=ie(this,re,ks).call(this);U(this,De,ie(this,re,Fn).call(this,()=>(et.ensure(),Me(()=>p(this,xt).call(this,n))))),p(this,ut)>0?ie(this,re,Pn).call(this):(It(p(this,me),()=>{U(this,me,null)}),this.is_pending=!1)}))},ks=function(){var t=p(this,Ce);return this.is_pending&&(U(this,ct,ht()),p(this,Ce).before(p(this,ct)),t=p(this,ct)),t},Fn=function(t){var n=G,s=R,r=Z;ze(p(this,Ke)),we(p(this,Ke)),sn(p(this,Ke).ctx);try{return t()}catch(i){return zr(i),null}finally{ze(n),we(s),sn(r)}},Pn=function(){const t=p(this,Ge).pending;p(this,De)!==null&&(U(this,Ze,document.createDocumentFragment()),p(this,Ze).append(p(this,ct)),mi(p(this,De),p(this,Ze))),p(this,me)===null&&U(this,me,Me(()=>t(p(this,Ce))))},Es=function(t){var n;if(!this.has_pending_snippet()){this.parent&&ie(n=this.parent,re,Es).call(n,t);return}if(U(this,ut,p(this,ut)+t),p(this,ut)===0){this.is_pending=!1;for(const s of p(this,en))ne(s,_e),nt(s);for(const s of p(this,tn))ne(s,Xe),nt(s);p(this,en).clear(),p(this,tn).clear(),p(this,me)&&It(p(this,me),()=>{U(this,me,null)}),p(this,Ze)&&(p(this,Ce).before(p(this,Ze)),U(this,Ze,null))}};function no(e,t,n,s){const r=Sn()?Ws:zs;if(n.length===0&&e.length===0){s(t.map(r));return}var i=X,o=G,l=so();function a(){Promise.all(n.map(c=>ro(c))).then(c=>{l();try{s([...t.map(r),...c])}catch(u){o.f&tt||rn(u,o)}i==null||i.deactivate(),Yn()}).catch(c=>{rn(c,o)})}e.length>0?Promise.all(e).then(()=>{l();try{return a()}finally{i==null||i.deactivate(),Yn()}}):a()}function so(){var e=G,t=R,n=Z,s=X;return function(i=!0){ze(e),we(t),sn(n),i&&(s==null||s.activate())}}function Yn(){ze(null),we(null),sn(null)}function Ws(e){var t=ue|_e,n=R!==null&&R.f&ue?R:null;return G!==null&&(G.f|=dn),{ctx:Z,deps:null,effects:null,equals:Kr,f:t,fn:e,reactions:null,rv:0,v:ae,wv:0,parent:n??G,ac:null}}function ro(e,t,n){let s=G;s===null&&Fa();var r=s.b,i=void 0,o=Lt(ae),l=!R,a=new Map;return po(()=>{var v;var c=jr();i=c.promise;try{Promise.resolve(e()).then(c.resolve,c.reject).then(()=>{u===X&&u.committed&&u.deactivate(),Yn()})}catch(y){c.reject(y),Yn()}var u=X;if(l){var g=r.is_rendered();r.update_pending_count(1),u.increment(g),(v=a.get(u))==null||v.reject(jt),a.delete(u),a.set(u,c)}const f=(y,T=void 0)=>{if(u.activate(),T)T!==jt&&(o.f|=vt,an(o,T));else{o.f&vt&&(o.f^=vt),an(o,y);for(const[_,k]of a){if(a.delete(_),_===u)break;k.reject(jt)}}l&&(r.update_pending_count(-1),u.decrement(g))};c.promise.then(f,y=>f(null,y||"unknown"))}),di(()=>{for(const c of a.values())c.reject(jt)}),new Promise(c=>{function u(g){function f(){g===i?c(o):u(i)}g.then(f,f)}u(i)})}function zs(e){const t=Ws(e);return t.equals=Wr,t}function ni(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)Ee(t[n])}}function io(e){for(var t=e.parent;t!==null;){if(!(t.f&ue))return t.f&tt?null:t;t=t.parent}return null}function Xs(e){var t,n=G;ze(io(e));try{e.f&=~Nt,ni(e),t=Ei(e)}finally{ze(n)}return t}function si(e){var t=Xs(e);if(!e.equals(t)&&(e.wv=wi(),(!(X!=null&&X.is_fork)||e.deps===null)&&(e.v=t,e.deps===null))){ne(e,le);return}gt||(oe!==null?(Js()||X!=null&&X.is_fork)&&oe.set(e,t):Ks(e))}let xs=new Set;const pt=new Map;let ri=!1;function Lt(e,t){var n={f:0,v:e,reactions:null,equals:Kr,rv:0,wv:0};return n}function at(e,t){const n=Lt(e);return go(n),n}function z(e,t=!1,n=!0){var r;const s=Lt(e);return t||(s.equals=Wr),fn&&n&&Z!==null&&Z.l!==null&&((r=Z.l).s??(r.s=[])).push(s),s}function B(e,t,n=!1){R!==null&&(!He||R.f&yr)&&Sn()&&R.f&(ue|st|Gs|yr)&&!(he!=null&&he.includes(e))&&Va();let s=n?Vt(t):t;return an(e,s)}function an(e,t){if(!e.equals(t)){var n=e.v;gt?pt.set(e,t):pt.set(e,n),e.v=t;var s=et.ensure();if(s.capture(e,n),e.f&ue){const r=e;e.f&_e&&Xs(r),Ks(r)}e.wv=wi(),ii(e,_e),Sn()&&G!==null&&G.f&le&&!(G.f&(rt|Ft))&&(Ie===null?bo([e]):Ie.push(e)),!s.is_fork&&xs.size>0&&!ri&&ao()}return t}function ao(){ri=!1;var e=Ct;Wn(!0);const t=Array.from(xs);try{for(const n of t)n.f&le&&ne(n,Xe),vn(n)&&ln(n)}finally{Wn(e)}xs.clear()}function gn(e){B(e,e.v+1)}function ii(e,t){var n=e.reactions;if(n!==null)for(var s=Sn(),r=n.length,i=0;i<r;i++){var o=n[i],l=o.f;if(!(!s&&o===G)){var a=(l&_e)===0;if(a&&ne(o,t),l&ue){var c=o;oe==null||oe.delete(c),l&Nt||(l&Ne&&(o.f|=Nt),ii(c,Xe))}else a&&(l&st&&Be!==null&&Be.add(o),nt(o))}}}function Vt(e){if(typeof e!="object"||e===null||$t in e)return e;const t=Hs(e);if(t!==Da&&t!==Ma)return e;var n=new Map,s=Rr(e),r=at(0),i=Dt,o=l=>{if(Dt===i)return l();var a=R,c=Dt;we(null),xr(i);var u=l();return we(a),xr(c),u};return s&&n.set("length",at(e.length)),new Proxy(e,{defineProperty(l,a,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&ja();var u=n.get(a);return u===void 0?u=o(()=>{var g=at(c.value);return n.set(a,g),g}):B(u,c.value,!0),!0},deleteProperty(l,a){var c=n.get(a);if(c===void 0){if(a in l){const u=o(()=>at(ae));n.set(a,u),gn(r)}}else B(c,ae),gn(r);return!0},get(l,a,c){var v;if(a===$t)return e;var u=n.get(a),g=a in l;if(u===void 0&&(!g||(v=Gt(l,a))!=null&&v.writable)&&(u=o(()=>{var y=Vt(g?l[a]:ae),T=at(y);return T}),n.set(a,u)),u!==void 0){var f=d(u);return f===ae?void 0:f}return Reflect.get(l,a,c)},getOwnPropertyDescriptor(l,a){var c=Reflect.getOwnPropertyDescriptor(l,a);if(c&&"value"in c){var u=n.get(a);u&&(c.value=d(u))}else if(c===void 0){var g=n.get(a),f=g==null?void 0:g.v;if(g!==void 0&&f!==ae)return{enumerable:!0,configurable:!0,value:f,writable:!0}}return c},has(l,a){var f;if(a===$t)return!0;var c=n.get(a),u=c!==void 0&&c.v!==ae||Reflect.has(l,a);if(c!==void 0||G!==null&&(!u||(f=Gt(l,a))!=null&&f.writable)){c===void 0&&(c=o(()=>{var v=u?Vt(l[a]):ae,y=at(v);return y}),n.set(a,c));var g=d(c);if(g===ae)return!1}return u},set(l,a,c,u){var S;var g=n.get(a),f=a in l;if(s&&a==="length")for(var v=c;v<g.v;v+=1){var y=n.get(v+"");y!==void 0?B(y,ae):v in l&&(y=o(()=>at(ae)),n.set(v+"",y))}if(g===void 0)(!f||(S=Gt(l,a))!=null&&S.writable)&&(g=o(()=>at(void 0)),B(g,Vt(c)),n.set(a,g));else{f=g.v!==ae;var T=o(()=>Vt(c));B(g,T)}var _=Reflect.getOwnPropertyDescriptor(l,a);if(_!=null&&_.set&&_.set.call(u,c),!f){if(s&&typeof a=="string"){var k=n.get("length"),I=Number(a);Number.isInteger(I)&&I>=k.v&&B(k,I+1)}gn(r)}return!0},ownKeys(l){d(r);var a=Reflect.ownKeys(l).filter(g=>{var f=n.get(g);return f===void 0||f.v!==ae});for(var[c,u]of n)u.v!==ae&&!(c in l)&&a.push(c);return a},setPrototypeOf(){Ha()}})}var kr,ai,oi,li;function oo(){if(kr===void 0){kr=window,ai=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;oi=Gt(t,"firstChild").get,li=Gt(t,"nextSibling").get,mr(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),mr(n)&&(n.__t=void 0)}}function ht(e=""){return document.createTextNode(e)}function on(e){return oi.call(e)}function $n(e){return li.call(e)}function h(e,t){return on(e)}function ce(e,t=!1){{var n=on(e);return n instanceof Comment&&n.data===""?$n(n):n}}function w(e,t=1,n=!1){let s=e;for(;t--;)s=$n(s);return s}function lo(e){e.textContent=""}function ci(){return!1}function ui(e){var t=R,n=G;we(null),ze(null);try{return e()}finally{we(t),ze(n)}}function fi(e){G===null&&(R===null&&Ba(),Ra()),gt&&Pa()}function co(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function Je(e,t,n){var s=G;s!==null&&s.f&$e&&(e|=$e);var r={ctx:Z,deps:null,nodes:null,f:e|_e|Ne,first:null,fn:t,last:null,next:null,parent:s,b:s&&s.b,prev:null,teardown:null,wv:0,ac:null};if(n)try{ln(r),r.f|=qs}catch(l){throw Ee(r),l}else t!==null&&nt(r);var i=r;if(n&&i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&!(i.f&dn)&&(i=i.first,e&st&&e&nn&&i!==null&&(i.f|=nn)),i!==null&&(i.parent=s,s!==null&&co(i,s),R!==null&&R.f&ue&&!(e&Ft))){var o=R;(o.effects??(o.effects=[])).push(i)}return r}function Js(){return R!==null&&!He}function di(e){const t=Je(Tn,null,!1);return ne(t,le),t.teardown=e,t}function Ts(e){fi();var t=G.f,n=!R&&(t&rt)!==0&&(t&qs)===0;if(n){var s=Z;(s.e??(s.e=[])).push(e)}else return vi(e)}function vi(e){return Je(Kn|qr,e,!1)}function uo(e){return fi(),Je(Tn|qr,e,!0)}function fo(e){et.ensure();const t=Je(Ft|dn,e,!0);return(n={})=>new Promise(s=>{n.outro?It(t,()=>{Ee(t),s(void 0)}):(Ee(t),s(void 0))})}function vo(e){return Je(Kn,e,!1)}function ee(e,t){var n=Z,s={effect:null,ran:!1,deps:e};n.l.$.push(s),s.effect=rs(()=>{e(),!s.ran&&(s.ran=!0,N(t))})}function Pt(){var e=Z;rs(()=>{for(var t of e.l.$){t.deps();var n=t.effect;n.f&le&&n.deps!==null&&ne(n,Xe),vn(n)&&ln(n),t.ran=!1}})}function po(e){return Je(Gs|dn,e,!0)}function rs(e,t=0){return Je(Tn|t,e,!0)}function J(e,t=[],n=[],s=[]){no(s,t,n,r=>{Je(Tn,()=>e(...r.map(d)),!0)})}function Zs(e,t=0){var n=Je(st|t,e,!0);return n}function Me(e){return Je(rt|dn,e,!0)}function pi(e){var t=e.teardown;if(t!==null){const n=gt,s=R;Er(!0),we(null);try{t.call(null)}finally{Er(n),we(s)}}}function hi(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){const r=n.ac;r!==null&&ui(()=>{r.abort(jt)});var s=n.next;n.f&Ft?n.parent=null:Ee(n,t),n=s}}function ho(e){for(var t=e.first;t!==null;){var n=t.next;t.f&rt||Ee(t),t=n}}function Ee(e,t=!0){var n=!1;(t||e.f&Vr)&&e.nodes!==null&&e.nodes.end!==null&&(_o(e.nodes.start,e.nodes.end),n=!0),hi(e,t&&!n),zn(e,0),ne(e,tt);var s=e.nodes&&e.nodes.t;if(s!==null)for(const i of s)i.stop();pi(e);var r=e.parent;r!==null&&r.first!==null&&_i(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=null}function _o(e,t){for(;e!==null;){var n=e===t?null:$n(e);e.remove(),e=n}}function _i(e){var t=e.parent,n=e.prev,s=e.next;n!==null&&(n.next=s),s!==null&&(s.prev=n),t!==null&&(t.first===e&&(t.first=s),t.last===e&&(t.last=n))}function It(e,t,n=!0){var s=[];gi(e,s,!0);var r=()=>{n&&Ee(e),t&&t()},i=s.length;if(i>0){var o=()=>--i||r();for(var l of s)l.out(o)}else r()}function gi(e,t,n){if(!(e.f&$e)){e.f^=$e;var s=e.nodes&&e.nodes.t;if(s!==null)for(const l of s)(l.is_global||n)&&t.push(l);for(var r=e.first;r!==null;){var i=r.next,o=(r.f&nn)!==0||(r.f&rt)!==0&&(e.f&st)!==0;gi(r,t,o?n:!1),r=i}}}function Qs(e){bi(e,!0)}function bi(e,t){if(e.f&$e){e.f^=$e,e.f&le||(ne(e,_e),nt(e));for(var n=e.first;n!==null;){var s=n.next,r=(n.f&nn)!==0||(n.f&rt)!==0;bi(n,r?t:!1),n=s}var i=e.nodes&&e.nodes.t;if(i!==null)for(const o of i)(o.is_global||t)&&o.in()}}function mi(e,t){if(e.nodes)for(var n=e.nodes.start,s=e.nodes.end;n!==null;){var r=n===s?null:$n(n);t.append(n),n=r}}let Ct=!1;function Wn(e){Ct=e}let gt=!1;function Er(e){gt=e}let R=null,He=!1;function we(e){R=e}let G=null;function ze(e){G=e}let he=null;function go(e){R!==null&&(he===null?he=[e]:he.push(e))}let pe=null,Se=0,Ie=null;function bo(e){Ie=e}let yi=1,yn=0,Dt=yn;function xr(e){Dt=e}function wi(){return++yi}function vn(e){var t=e.f;if(t&_e)return!0;if(t&ue&&(e.f&=~Nt),t&Xe){for(var n=e.deps,s=n.length,r=0;r<s;r++){var i=n[r];if(vn(i)&&si(i),i.wv>e.wv)return!0}t&Ne&&oe===null&&ne(e,le)}return!1}function ki(e,t,n=!0){var s=e.reactions;if(s!==null&&!(he!=null&&he.includes(e)))for(var r=0;r<s.length;r++){var i=s[r];i.f&ue?ki(i,t,!1):t===i&&(n?ne(i,_e):i.f&le&&ne(i,Xe),nt(i))}}function Ei(e){var y;var t=pe,n=Se,s=Ie,r=R,i=he,o=Z,l=He,a=Dt,c=e.f;pe=null,Se=0,Ie=null,R=c&(rt|Ft)?null:e,he=null,sn(e.ctx),He=!1,Dt=++yn,e.ac!==null&&(ui(()=>{e.ac.abort(jt)}),e.ac=null);try{e.f|=bs;var u=e.fn,g=u(),f=e.deps;if(pe!==null){var v;if(zn(e,Se),f!==null&&Se>0)for(f.length=Se+pe.length,v=0;v<pe.length;v++)f[Se+v]=pe[v];else e.deps=f=pe;if(Js()&&e.f&Ne)for(v=Se;v<f.length;v++)((y=f[v]).reactions??(y.reactions=[])).push(e)}else f!==null&&Se<f.length&&(zn(e,Se),f.length=Se);if(Sn()&&Ie!==null&&!He&&f!==null&&!(e.f&(ue|Xe|_e)))for(v=0;v<Ie.length;v++)ki(Ie[v],e);return r!==null&&r!==e&&(yn++,Ie!==null&&(s===null?s=Ie:s.push(...Ie))),e.f&vt&&(e.f^=vt),g}catch(T){return zr(T)}finally{e.f^=bs,pe=t,Se=n,Ie=s,R=r,he=i,sn(o),He=l,Dt=a}}function mo(e,t){let n=t.reactions;if(n!==null){var s=Ca.call(n,e);if(s!==-1){var r=n.length-1;r===0?n=t.reactions=null:(n[s]=n[r],n.pop())}}if(n===null&&t.f&ue&&(pe===null||!pe.includes(t))){var i=t;i.f&Ne&&(i.f^=Ne,i.f&=~Nt),Ks(i),ni(i),zn(i,0)}}function zn(e,t){var n=e.deps;if(n!==null)for(var s=t;s<n.length;s++)mo(e,n[s])}function ln(e){var t=e.f;if(!(t&tt)){ne(e,le);var n=G,s=Ct;G=e,Ct=!0;try{t&(st|Hr)?ho(e):hi(e),pi(e);var r=Ei(e);e.teardown=typeof r=="function"?r:null,e.wv=yi;var i;gs&&ba&&e.f&_e&&e.deps}finally{Ct=s,G=n}}}function d(e){var t=e.f,n=(t&ue)!==0;if(R!==null&&!He){var s=G!==null&&(G.f&tt)!==0;if(!s&&!(he!=null&&he.includes(e))){var r=R.deps;if(R.f&bs)e.rv<yn&&(e.rv=yn,pe===null&&r!==null&&r[Se]===e?Se++:pe===null?pe=[e]:pe.includes(e)||pe.push(e));else{(R.deps??(R.deps=[])).push(e);var i=e.reactions;i===null?e.reactions=[R]:i.includes(R)||i.push(R)}}}if(gt&&pt.has(e))return pt.get(e);if(n){var o=e;if(gt){var l=o.v;return(!(o.f&le)&&o.reactions!==null||Ti(o))&&(l=Xs(o)),pt.set(o,l),l}var a=(o.f&Ne)===0&&!He&&R!==null&&(Ct||(R.f&Ne)!==0),c=o.deps===null;vn(o)&&(a&&(o.f|=Ne),si(o)),a&&!c&&xi(o)}if(oe!=null&&oe.has(e))return oe.get(e);if(e.f&vt)throw e.v;return e.v}function xi(e){if(e.deps!==null){e.f|=Ne;for(const t of e.deps)(t.reactions??(t.reactions=[])).push(e),t.f&ue&&!(t.f&Ne)&&xi(t)}}function Ti(e){if(e.v===ae)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(pt.has(t)||t.f&ue&&Ti(t))return!0;return!1}function N(e){var t=He;try{return He=!0,e()}finally{He=t}}function F(e){if(!(typeof e!="object"||!e||e instanceof EventTarget)){if($t in e)Ss(e);else if(!Array.isArray(e))for(let t in e){const n=e[t];typeof n=="object"&&n&&$t in n&&Ss(n)}}}function Ss(e,t=new Set){if(typeof e=="object"&&e!==null&&!(e instanceof EventTarget)&&!t.has(e)){t.add(e),e instanceof Date&&e.getTime();for(let s in e)try{Ss(e[s],t)}catch{}const n=Hs(e);if(n!==Object.prototype&&n!==Array.prototype&&n!==Map.prototype&&n!==Set.prototype&&n!==Date.prototype){const s=Ur(n);for(let r in s){const i=s[r].get;if(i)try{i.call(e)}catch{}}}}}const Si=new Set,As=new Set;function xe(e){for(var t=0;t<e.length;t++)Si.add(e[t]);for(var n of As)n(e)}let Tr=null;function Ln(e){var _;var t=this,n=t.ownerDocument,s=e.type,r=((_=e.composedPath)==null?void 0:_.call(e))||[],i=r[0]||e.target;Tr=e;var o=0,l=Tr===e&&e.__root;if(l){var a=r.indexOf(l);if(a!==-1&&(t===document||t===window)){e.__root=t;return}var c=r.indexOf(t);if(c===-1)return;a<=c&&(o=a)}if(i=r[o]||e.target,i!==t){Br(e,"currentTarget",{configurable:!0,get(){return i||n}});var u=R,g=G;we(null),ze(null);try{for(var f,v=[];i!==null;){var y=i.assignedSlot||i.parentNode||i.host||null;try{var T=i["__"+s];T!=null&&(!i.disabled||e.target===i)&&T.call(i,e)}catch(k){f?v.push(k):f=k}if(e.cancelBubble||y===t||y===null)break;i=y}if(f){for(let k of v)queueMicrotask(()=>{throw k});throw f}}finally{e.__root=t,delete e.currentTarget,we(u),ze(g)}}}function Ai(e){var t=document.createElement("template");return t.innerHTML=e.replaceAll("<!>","<!---->"),t.content}function Xn(e,t){var n=G;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function D(e,t){var n=(t&Aa)!==0,s=(t&$a)!==0,r,i=!e.startsWith("<!>");return()=>{r===void 0&&(r=Ai(i?e:"<!>"+e),n||(r=on(r)));var o=s||ai?document.importNode(r,!0):r.cloneNode(!0);if(n){var l=on(o),a=o.lastChild;Xn(l,a)}else Xn(o,o);return o}}function yo(e,t,n="svg"){var s=!e.startsWith("<!>"),r=`<${n}>${s?e:"<!>"+e}</${n}>`,i;return()=>{if(!i){var o=Ai(r),l=on(o);i=on(l)}var a=i.cloneNode(!0);return Xn(a,a),a}}function pn(e,t){return yo(e,t,"svg")}function Le(){var e=document.createDocumentFragment(),t=document.createComment(""),n=ht();return e.append(t,n),Xn(t,n),e}function A(e,t){e!==null&&e.before(t)}const wo=["touchstart","touchmove"];function ko(e){return wo.includes(e)}function O(e,t){var n=t==null?"":typeof t=="object"?t+"":t;n!==(e.__t??(e.__t=e.nodeValue))&&(e.__t=n,e.nodeValue=n+"")}function Eo(e,t){return xo(e,t)}const Rt=new Map;function xo(e,{target:t,anchor:n,props:s={},events:r,context:i,intro:o=!0}){oo();var l=new Set,a=g=>{for(var f=0;f<g.length;f++){var v=g[f];if(!l.has(v)){l.add(v);var y=ko(v);t.addEventListener(v,Ln,{passive:y});var T=Rt.get(v);T===void 0?(document.addEventListener(v,Ln,{passive:y}),Rt.set(v,1)):Rt.set(v,T+1)}}};a(ss(Si)),As.add(a);var c=void 0,u=fo(()=>{var g=n??t.appendChild(ht());return Za(g,{pending:()=>{}},f=>{if(i){fe({});var v=Z;v.c=i}r&&(s.$$events=r),c=e(f,s)||{},i&&de()}),()=>{var y;for(var f of l){t.removeEventListener(f,Ln);var v=Rt.get(f);--v===0?(document.removeEventListener(f,Ln),Rt.delete(f)):Rt.set(f,v)}As.delete(a),g!==n&&((y=g.parentNode)==null||y.removeChild(g))}});return To.set(c,u),c}let To=new WeakMap;var Ue,We,Ae,At,En,xn,ns;class So{constructor(t,n=!0){Re(this,"anchor");H(this,Ue,new Map);H(this,We,new Map);H(this,Ae,new Map);H(this,At,new Set);H(this,En,!0);H(this,xn,()=>{var t=X;if(p(this,Ue).has(t)){var n=p(this,Ue).get(t),s=p(this,We).get(n);if(s)Qs(s),p(this,At).delete(n);else{var r=p(this,Ae).get(n);r&&(p(this,We).set(n,r.effect),p(this,Ae).delete(n),r.fragment.lastChild.remove(),this.anchor.before(r.fragment),s=r.effect)}for(const[i,o]of p(this,Ue)){if(p(this,Ue).delete(i),i===t)break;const l=p(this,Ae).get(o);l&&(Ee(l.effect),p(this,Ae).delete(o))}for(const[i,o]of p(this,We)){if(i===n||p(this,At).has(i))continue;const l=()=>{if(Array.from(p(this,Ue).values()).includes(i)){var c=document.createDocumentFragment();mi(o,c),c.append(ht()),p(this,Ae).set(i,{effect:o,fragment:c})}else Ee(o);p(this,At).delete(i),p(this,We).delete(i)};p(this,En)||!s?(p(this,At).add(i),It(o,l,!1)):l()}}});H(this,ns,t=>{p(this,Ue).delete(t);const n=Array.from(p(this,Ue).values());for(const[s,r]of p(this,Ae))n.includes(s)||(Ee(r.effect),p(this,Ae).delete(s))});this.anchor=t,U(this,En,n)}ensure(t,n){var s=X,r=ci();if(n&&!p(this,We).has(t)&&!p(this,Ae).has(t))if(r){var i=document.createDocumentFragment(),o=ht();i.append(o),p(this,Ae).set(t,{effect:Me(()=>n(o)),fragment:i})}else p(this,We).set(t,Me(()=>n(this.anchor)));if(p(this,Ue).set(s,t),r){for(const[l,a]of p(this,We))l===t?s.skipped_effects.delete(a):s.skipped_effects.add(a);for(const[l,a]of p(this,Ae))l===t?s.skipped_effects.delete(a.effect):s.skipped_effects.add(a.effect);s.oncommit(p(this,xn)),s.ondiscard(p(this,ns))}else p(this,xn).call(this)}}Ue=new WeakMap,We=new WeakMap,Ae=new WeakMap,At=new WeakMap,En=new WeakMap,xn=new WeakMap,ns=new WeakMap;function er(e){Z===null&&Gr(),fn&&Z.l!==null?Ao(Z).m.push(e):Ts(()=>{const t=N(e);if(typeof t=="function")return t})}function tr(e){Z===null&&Gr(),er(()=>()=>N(e))}function Ao(e){var t=e.l;return t.u??(t.u={a:[],b:[],m:[]})}function V(e,t,n=!1){var s=new So(e),r=n?nn:0;function i(o,l){s.ensure(o,l)}Zs(()=>{var o=!1;t((l,a=!0)=>{o=!0,i(a,l)}),o||i(!1,null)},r)}function is(e,t){return t}function $o(e,t,n){for(var s=[],r=t.length,i,o=t.length,l=0;l<r;l++){let g=t[l];It(g,()=>{if(i){if(i.pending.delete(g),i.done.add(g),i.pending.size===0){var f=e.outrogroups;$s(ss(i.done)),f.delete(i),f.size===0&&(e.outrogroups=null)}}else o-=1},!1)}if(o===0){var a=s.length===0&&n!==null;if(a){var c=n,u=c.parentNode;lo(u),u.append(c),e.items.clear()}$s(t,!a)}else i={pending:new Set(t),done:new Set},(e.outrogroups??(e.outrogroups=new Set)).add(i)}function $s(e,t=!0){for(var n=0;n<e.length;n++)Ee(e[n],t)}var Sr;function Oe(e,t,n,s,r,i=null){var o=e,l=new Map,a=(t&Pr)!==0;if(a){var c=e;o=c.appendChild(ht())}var u=null,g=zs(()=>{var k=n();return Rr(k)?k:k==null?[]:ss(k)}),f,v=!0;function y(){_.fallback=u,Io(_,f,o,t,s),u!==null&&(f.length===0?u.f&Qe?(u.f^=Qe,hn(u,null,o)):Qs(u):It(u,()=>{u=null}))}var T=Zs(()=>{f=d(g);for(var k=f.length,I=new Set,S=X,E=ci(),x=0;x<k;x+=1){var b=f[x],m=s(b,x),$=v?null:l.get(m);$?($.v&&an($.v,b),$.i&&an($.i,x),E&&S.skipped_effects.delete($.e)):($=Co(l,v?o:Sr??(Sr=ht()),b,m,x,r,t,n),v||($.e.f|=Qe),l.set(m,$)),I.add(m)}if(k===0&&i&&!u&&(v?u=Me(()=>i(o)):(u=Me(()=>i(Sr??(Sr=ht()))),u.f|=Qe)),!v)if(E){for(const[M,C]of l)I.has(M)||S.skipped_effects.add(C.e);S.oncommit(y),S.ondiscard(()=>{})}else y();d(g)}),_={effect:T,items:l,outrogroups:null,fallback:u};v=!1}function Io(e,t,n,s,r){var C,L,P,K,j,Y,Q,se,ge;var i=(s&ka)!==0,o=t.length,l=e.items,a=e.effect.first,c,u=null,g,f=[],v=[],y,T,_,k;if(i)for(k=0;k<o;k+=1)y=t[k],T=r(y,k),_=l.get(T).e,_.f&Qe||((L=(C=_.nodes)==null?void 0:C.a)==null||L.measure(),(g??(g=new Set)).add(_));for(k=0;k<o;k+=1){if(y=t[k],T=r(y,k),_=l.get(T).e,e.outrogroups!==null)for(const Te of e.outrogroups)Te.pending.delete(_),Te.done.delete(_);if(_.f&Qe)if(_.f^=Qe,_===a)hn(_,null,n);else{var I=u?u.next:a;_===e.effect.last&&(e.effect.last=_.prev),_.prev&&(_.prev.next=_.next),_.next&&(_.next.prev=_.prev),ot(e,u,_),ot(e,_,I),hn(_,I,n),u=_,f=[],v=[],a=u.next;continue}if(_.f&$e&&(Qs(_),i&&((K=(P=_.nodes)==null?void 0:P.a)==null||K.unfix(),(g??(g=new Set)).delete(_))),_!==a){if(c!==void 0&&c.has(_)){if(f.length<v.length){var S=v[0],E;u=S.prev;var x=f[0],b=f[f.length-1];for(E=0;E<f.length;E+=1)hn(f[E],S,n);for(E=0;E<v.length;E+=1)c.delete(v[E]);ot(e,x.prev,b.next),ot(e,u,x),ot(e,b,S),a=S,u=b,k-=1,f=[],v=[]}else c.delete(_),hn(_,a,n),ot(e,_.prev,_.next),ot(e,_,u===null?e.effect.first:u.next),ot(e,u,_),u=_;continue}for(f=[],v=[];a!==null&&a!==_;)(c??(c=new Set)).add(a),v.push(a),a=a.next;if(a===null)continue}_.f&Qe||f.push(_),u=_,a=_.next}if(e.outrogroups!==null){for(const Te of e.outrogroups)Te.pending.size===0&&($s(ss(Te.done)),(j=e.outrogroups)==null||j.delete(Te));e.outrogroups.size===0&&(e.outrogroups=null)}if(a!==null||c!==void 0){var m=[];if(c!==void 0)for(_ of c)_.f&$e||m.push(_);for(;a!==null;)!(a.f&$e)&&a!==e.fallback&&m.push(a),a=a.next;var $=m.length;if($>0){var M=s&Pr&&o===0?n:null;if(i){for(k=0;k<$;k+=1)(Q=(Y=m[k].nodes)==null?void 0:Y.a)==null||Q.measure();for(k=0;k<$;k+=1)(ge=(se=m[k].nodes)==null?void 0:se.a)==null||ge.fix()}$o(e,m,M)}}i&&An(()=>{var Te,Dn;if(g!==void 0)for(_ of g)(Dn=(Te=_.nodes)==null?void 0:Te.a)==null||Dn.apply()})}function Co(e,t,n,s,r,i,o,l){var a=o&ya?o&Ea?Lt(n):z(n,!1,!1):null,c=o&wa?Lt(r):null;return{v:a,i:c,e:Me(()=>(i(t,a??n,c??r,l),()=>{e.delete(s)}))}}function hn(e,t,n){if(e.nodes)for(var s=e.nodes.start,r=e.nodes.end,i=t&&!(t.f&Qe)?t.nodes.start:n;s!==null;){var o=$n(s);if(i.before(s),s===r)return;s=o}}function ot(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}const Ar=[...`
|
|
2
|
+
\r\f \v\uFEFF`];function Do(e,t,n){var s=e==null?"":""+e;if(t&&(s=s?s+" "+t:t),n){for(var r in n)if(n[r])s=s?s+" "+r:r;else if(s.length)for(var i=r.length,o=0;(o=s.indexOf(r,o))>=0;){var l=o+i;(o===0||Ar.includes(s[o-1]))&&(l===s.length||Ar.includes(s[l]))?s=(o===0?"":s.substring(0,o))+s.substring(l+1):o=l}}return s===""?null:s}function Mo(e,t){return e==null?null:String(e)}function te(e,t,n,s,r,i){var o=e.__className;if(o!==n||o===void 0){var l=Do(n,s,i);l==null?e.removeAttribute("class"):e.className=l,e.__className=n}else if(i&&r!==i)for(var a in i){var c=!!i[a];(r==null||c!==!!r[a])&&e.classList.toggle(a,c)}return i}function No(e,t,n,s){var r=e.__style;if(r!==t){var i=Mo(t);i==null?e.removeAttribute("style"):e.style.cssText=i,e.__style=t}return s}const Lo=Symbol("is custom element"),Oo=Symbol("is html");function ke(e,t,n,s){var r=Fo(e);r[t]!==(r[t]=n)&&(t==="loading"&&(e[Oa]=n),n==null?e.removeAttribute(t):typeof n!="string"&&Po(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function Fo(e){return e.__attributes??(e.__attributes={[Lo]:e.nodeName.includes("-"),[Oo]:e.namespaceURI===Ia})}var $r=new Map;function Po(e){var t=e.getAttribute("is")||e.nodeName,n=$r.get(t);if(n)return n;$r.set(t,n=[]);for(var s,r=e,i=Element.prototype;i!==r;){s=Ur(r);for(var o in s)s[o].set&&n.push(o);r=Hs(r)}return n}function Ir(e,t){return e===t||(e==null?void 0:e[$t])===t}function $i(e={},t,n,s){return vo(()=>{var r,i;return rs(()=>{r=i,i=[],N(()=>{e!==n(...i)&&(t(e,...i),r&&Ir(n(...r),e)&&t(null,...r))})}),()=>{An(()=>{i&&Ir(n(...i),e)&&t(null,...i)})}}),e}function ve(e=!1){const t=Z,n=t.l.u;if(!n)return;let s=()=>F(t.s);if(e){let r=0,i={};const o=Ws(()=>{let l=!1;const a=t.s;for(const c in a)a[c]!==i[c]&&(i[c]=a[c],l=!0);return l&&r++,r});s=()=>d(o)}n.b.length&&uo(()=>{Cr(t,s),Gn(n.b)}),Ts(()=>{const r=N(()=>n.m.map(Na));return()=>{for(const i of r)typeof i=="function"&&i()}}),n.a.length&&Ts(()=>{Cr(t,s),Gn(n.a)})}function Cr(e,t){if(e.l.s)for(const n of e.l.s)d(n);t()}function nr(e,t,n){if(e==null)return t(void 0),n&&n(void 0),dt;const s=N(()=>e.subscribe(t,n));return s.unsubscribe?()=>s.unsubscribe():s}const Bt=[];function Ro(e,t){return{subscribe:q(e,t).subscribe}}function q(e,t=dt){let n=null;const s=new Set;function r(l){if(Yr(e,l)&&(e=l,n)){const a=!Bt.length;for(const c of s)c[1](),Bt.push(c,e);if(a){for(let c=0;c<Bt.length;c+=2)Bt[c][0](Bt[c+1]);Bt.length=0}}}function i(l){r(l(e))}function o(l,a=dt){const c=[l,a];return s.add(c),s.size===1&&(n=t(r,i)||dt),l(e),()=>{s.delete(c),s.size===0&&n&&(n(),n=null)}}return{set:r,update:i,subscribe:o}}function sr(e,t,n){const s=!Array.isArray(e),r=s?[e]:e;if(!r.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const i=t.length<2;return Ro(n,(o,l)=>{let a=!1;const c=[];let u=0,g=dt;const f=()=>{if(u)return;g();const y=t(s?c[0]:c,o,l);i?o(y):g=typeof y=="function"?y:dt},v=r.map((y,T)=>nr(y,_=>{c[T]=_,u&=~(1<<T),a&&f()},()=>{u|=1<<T}));return a=!0,f(),function(){Gn(v),g(),a=!1}})}function je(e){let t;return nr(e,n=>t=n)(),t}let On=!1,Is=Symbol();function W(e,t,n){const s=n[t]??(n[t]={store:null,source:z(void 0),unsubscribe:dt});if(s.store!==e&&!(Is in n))if(s.unsubscribe(),s.store=e??null,e==null)s.source.v=void 0,s.unsubscribe=dt;else{var r=!0;s.unsubscribe=nr(e,i=>{r?s.source.v=i:B(s.source,i)}),r=!1}return e&&Is in n?je(e):d(s.source)}function Pe(){const e={};function t(){di(()=>{for(var n in e)e[n].unsubscribe();Br(e,Is,{enumerable:!1,value:!0})})}return[e,t]}function Bo(e){var t=On;try{return On=!1,[e(),On]}finally{On=t}}function as(e,t,n,s){var I;var r=!fn||(n&xa)!==0,i=(n&Sa)!==0,o=s,l=!0,a=()=>(l&&(l=!1,o=s),o),c;{var u=$t in e||La in e;c=((I=Gt(e,t))==null?void 0:I.set)??(u&&t in e?S=>e[t]=S:void 0)}var g,f=!1;[g,f]=Bo(()=>e[t]);var v;if(r?v=()=>{var S=e[t];return S===void 0?a():(l=!0,S)}:v=()=>{var S=e[t];return S!==void 0&&(o=void 0),S===void 0?o:S},r&&!(n&Ta))return v;if(c){var y=e.$$legacy;return function(S,E){return arguments.length>0?((!r||!E||y||f)&&c(E?v():S),S):v()}}var T=!1,_=zs(()=>(T=!1,v()));d(_);var k=G;return function(S,E){if(arguments.length>0){const x=E?d(_):r&&i?Vt(S):S;return B(_,x),T=!0,o!==void 0&&(o=x),S}return gt&&T||k.f&tt?_.v:d(_)}}const Ii="vibe-forge-theme";function Ci(){return typeof localStorage<"u"&&localStorage.getItem(Ii)||"dark"}const Di=q(Ci());function Uo(){const e=Ci();document.documentElement.setAttribute("data-theme",e),Di.set(e)}function Rn(){Di.update(e=>{const t=e==="dark"?"light":"dark";return document.documentElement.setAttribute("data-theme",t),typeof localStorage<"u"&&localStorage.setItem(Ii,t),t})}const Jn=q([]),Bn=q(!0),Cs=q(null),rr=q("pending"),ir=q(null),Mi=q(new Date().toISOString()),jo=sr([Jn,rr,Mi],([e,t,n])=>e.filter(s=>{const r=(s.status||"").toLowerCase().replace(/[_\s]/g,"-");if(t==="pending")return r==="pending"||!r;if(t==="in-progress")return r==="in-progress"||r==="working";if(t==="review")return r==="review"||r==="in-review"||r==="needs-review";if(t==="done"){if(!(r==="done"||r==="completed"))return!1;const i=s.completed_at||s.modifiedAt||s.created_at;return!n||!i||i>=n}return!0})),Ho=sr([Jn,Mi],([e,t])=>{const n={pending:0,"in-progress":0,review:0,done:0};return e.forEach(s=>{const r=(s.status||"").toLowerCase().replace(/[_\s]/g,"-");if(r==="pending"||!r)n.pending++;else if(r==="in-progress"||r==="working")n["in-progress"]++;else if(r==="review"||r==="in-review"||r==="needs-review")n.review++;else if(r==="done"||r==="completed"){const i=s.completed_at||s.modifiedAt||s.created_at;(!t||!i||i>=t)&&n.done++}}),n});function Vo(e){rr.set(e)}function Ds(e){ir.update(t=>t===e?null:e)}function qo(){ir.set(null)}const Ni=q([]),Un=q(!0),Ms=q(null),Go={"planning-hub":{name:"Planning Hub",short:"Hub",icon:"H",color:"hub"},hub:{name:"Planning Hub",short:"Hub",icon:"H",color:"hub"},anvil:{name:"Anvil",short:"Anvil",icon:"A",color:"anvil"},furnace:{name:"Furnace",short:"Furnace",icon:"F",color:"furnace"},crucible:{name:"Crucible",short:"Crucible",icon:"C",color:"crucible"},scribe:{name:"Scribe",short:"Scribe",icon:"S",color:"scribe"},temper:{name:"Temper",short:"Temper",icon:"T",color:"temper"},ember:{name:"Ember",short:"Ember",icon:"E",color:"ember"},architect:{name:"Architect",short:"Arch",icon:"Ar",color:"architect"},aegis:{name:"Aegis",short:"Aegis",icon:"Ae",color:"aegis"},pixel:{name:"Pixel",short:"Pixel",icon:"P",color:"pixel"},oracle:{name:"Oracle",short:"Oracle",icon:"O",color:"oracle"},loki:{name:"Loki",short:"Loki",icon:"L",color:"loki"}};function Kt(e){return e?Go[e.toLowerCase()]||{name:e,short:e.charAt(0).toUpperCase(),icon:e.charAt(0).toUpperCase(),color:""}:null}const os=q([]),jn=q(!0),Ns=q(null),Li=q(!1),ls=q(null),Hn=q(!1),bn=q(null),Dr={doc:{label:"DOC",icon:"D",agent:"scribe",priority:"medium"},test:{label:"TEST",icon:"T",agent:"crucible",priority:"high"},sec:{label:"SEC",icon:"S",agent:"aegis",priority:"critical"},cov:{label:"COV",icon:"C",agent:"crucible",priority:"medium"},todo:{label:"TODO",icon:"TD",agent:null,priority:"low"},review:{label:"REVIEW",icon:"R",agent:"sentinel",priority:"high"}};function Ls(e){return Dr[e]||Dr.todo}function Mr(){const e=Date.now().toString(36),t=Math.random().toString(36).slice(2,6);return`AUTO-${e}-${t}`}function Oi(e){ls.set(e),bn.set(null)}function Ve(){ls.set(null),Hn.set(!1),bn.set(null)}function ds(){Li.update(e=>!e)}function Ko(e){os.update(t=>t.filter(n=>n.id!==e))}const Fi=q([]),Os=q(!1),Nr=q(null),In=q([]),Yo=sr(In,e=>{const t=new Date().toDateString(),n=new Date(Date.now()-864e5).toDateString(),s={today:[],yesterday:[],older:[]};return e.forEach(r=>{const i=new Date(r.timestamp||r.created_at).toDateString();i===t?s.today.push(r):i===n?s.yesterday.push(r):s.older.push(r)}),s});function vs(e){const t={id:`notif-${Date.now()}`,timestamp:new Date().toISOString(),...e};In.update(n=>[t,...n].slice(0,50))}function Lr(e){In.update(t=>t.filter(n=>n.id!==e))}function ps(){In.set([])}const Pi=window.location.origin;let Zn=null;async function Wo(){try{const e=await fetch(`${Pi}/api/token`);e.ok&&(Zn=(await e.json()).token)}catch{console.warn("Could not fetch session token")}}async function Cn(e,t={}){const n={"Content-Type":"application/json",...t.headers};Zn&&(n["X-Forge-Token"]=Zn);const s=await fetch(`${Pi}${e}`,{headers:n,...t});if(!s.ok){const r=new Error(`HTTP ${s.status}`);r.status=s.status;try{r.data=await s.json()}catch{r.data=null}throw r}return s.json()}function zo(){return Zn}async function Xo(){return Cn("/api/tasks")}async function Jo(){return Cn("/api/agents")}async function Zo(){try{return await Cn("/api/issues")}catch{return{issues:[{id:"issue-1",category:"doc",title:"Stale Docs: README.md",target:"README.md",details:"Last updated 45 days ago",meta:"Threshold: 30 days | Severity: Medium",agent:"scribe",priority:"medium"},{id:"issue-2",category:"test",title:"Failing Test: auth.test.js",target:"auth.test.js",details:"2 tests failing: testLogin, testLogout",meta:"First failed: yesterday 3:45 PM",agent:"crucible",priority:"high"},{id:"issue-3",category:"sec",title:"Security: lodash vulnerability",target:"package.json",details:"CVE-2021-23337 (high severity)",meta:"Affects: lodash < 4.17.21",agent:"aegis",priority:"critical"},{id:"issue-4",category:"cov",title:"Low Coverage: utils.js",target:"src/utils.js",details:"34% coverage (threshold: 80%)",meta:"Missing: 12 uncovered functions",agent:"crucible",priority:"medium"}]}}}async function Qo(e=50){return Cn(`/api/activity?limit=${e}`)}async function el(e){return Cn("/api/dispatch",{method:"POST",body:JSON.stringify({type:e.category,target:e.target,agent:e.agent,context:{title:e.title,details:e.details,priority:e.priority}})})}const Ri="vibe-forge-voice-enabled",Bi="vibe-forge-voice-overridden";function Ui(){return typeof localStorage>"u"?!1:localStorage.getItem(Bi)==="true"?localStorage.getItem(Ri)==="true":null}const cn=q(Ui()??!1),Qn=q(!1);cn.subscribe(e=>{typeof localStorage<"u"&&localStorage.setItem(Ri,String(e))});typeof window<"u"&&Ui()===null&&fetch("/api/config").then(e=>e.ok?e.json():null).catch(()=>null).then(e=>{(e==null?void 0:e.dashboard_voice)===!0&&cn.set(!0)});const ji={"planning-hub":{gender:"male",pitch:.8,rate:.88},"planning-hub":{gender:"male",pitch:.8,rate:.88},oracle:{gender:"female",pitch:1,rate:.92},architect:{gender:"male",pitch:.85,rate:.85},aegis:{gender:"female",pitch:1.1,rate:1.15},pixel:{gender:"female",pitch:1.18,rate:1.05},ember:{gender:"male",pitch:.92,rate:1.02},anvil:{gender:"male",pitch:1,rate:1.05},furnace:{gender:"male",pitch:.88,rate:1},crucible:{gender:"female",pitch:1.02,rate:.98},temper:{gender:"male",pitch:.95,rate:.9},scribe:{gender:"female",pitch:1.05,rate:.88},herald:{gender:"male",pitch:1,rate:1.12},loki:{gender:"male",pitch:1.12,rate:1.08},"crucible-x":{gender:"male",pitch:.78,rate:1.1},system:{gender:"female",pitch:1,rate:1}},tl={gender:"male",pitch:1,rate:1};let mt=[],yt=[],Hi=!1;const nl=/female|zira|samantha|victoria|fiona|kate|moira|veena|tessa|karen|susan|linda|heather|allison|ava|nicky|sandy|shelley/i,sl=/\bmale\b|david|mark|alex|daniel|james|richard|george|thomas|reed|fred|ralph|bruce|lee/i;function Fs(){if(!("speechSynthesis"in window))return;const e=window.speechSynthesis.getVoices();if(e.length===0)return;const t=e.filter(s=>s.lang.startsWith("en")),n=t.length>0?t:e;yt=n.filter(s=>nl.test(s.name)),mt=n.filter(s=>sl.test(s.name)),yt.length===0&&mt.length===0?(mt=n.filter((s,r)=>r%2===0),yt=n.filter((s,r)=>r%2===1)):(yt.length===0&&(yt=mt),mt.length===0&&(mt=yt)),Hi=!0}function rl(e,t){const n=t==="female"?yt:mt;if(n.length===0)return null;let s=0;for(const r of e)s=s*31+r.charCodeAt(0)&4294967295;return n[Math.abs(s)%n.length]}let wt=null;async function il(){if(wt!==null)return wt;try{const e=await fetch("/api/tts?text=ok&agent=system");wt=e.ok,e.ok&&e.blob().catch(()=>{})}catch{wt=!1}return wt}let Mt=[],Vn=!1,qt=null;function Ps(){if(Vn||Mt.length===0)return;const e=Mt.shift();Vn=!0,Qn.set(!0);const t=()=>{Vn=!1,qt=null,Qn.set(Mt.length>0),Ps()};e.audio?(qt=e.audio,e.audio.onended=t,e.audio.onerror=t,e.audio.play().catch(t)):(e.utt.onend=t,e.utt.onerror=t,window.speechSynthesis.speak(e.utt))}function Vi(){Mt=[],qt&&(qt.pause(),qt.src="",qt=null),"speechSynthesis"in window&&window.speechSynthesis.cancel(),Vn=!1,Qn.set(!1)}async function lt(e,t="system",n=!1){if(!je(cn)||!e||!e.trim()||(n&&Vi(),Mt.length>=4))return;const s=t.toLowerCase();if(await il().catch(()=>!1))try{const a=new URLSearchParams({text:e.trim(),agent:s}),c=await fetch(`/api/tts?${a}`);if(c.ok){const u=await c.blob(),g=new Audio(URL.createObjectURL(u));Mt.push({audio:g}),Ps();return}wt=!1}catch{wt=!1}if(!("speechSynthesis"in window))return;Hi||Fs();const i=ji[s]||tl,o=rl(s,i.gender),l=new SpeechSynthesisUtterance(e);l.pitch=i.pitch,l.rate=i.rate,l.volume=1,o&&(l.voice=o),Mt.push({utt:l}),Ps()}function al(){Vi()}function ol(){cn.update(e=>{e&&al();const t=!e;return typeof localStorage<"u"&&localStorage.setItem(Bi,"true"),t})}const ll=Object.keys(ji);function cl(e){if(e!=null&&e.agent)return e.agent.toLowerCase();const t=`${(e==null?void 0:e.title)||""} ${(e==null?void 0:e.message)||""}`.toLowerCase();for(const n of ll)if(t.includes(n))return n;return"system"}typeof window<"u"&&"speechSynthesis"in window&&(window.speechSynthesis.getVoices().length>0?Fs():window.speechSynthesis.addEventListener("voiceschanged",Fs,{once:!0}));const bt={RECONNECT_DELAY:3e3,RECONNECT_MAX_DELAY:3e4,MIN_LOADING_TIME:300},Yt=q(!1),qi=q(null),ar=q(!1);let ye=null,Wt=0,_t=null;function ul(){const e=window.location.protocol==="https:"?"wss":"ws",t=zo(),n=t?`?token=${t}`:"";return`${e}://${window.location.host}/ws${n}`}function or(){ye&&ye.readyState===WebSocket.OPEN||(ye=new WebSocket(ul()),ye.onopen=()=>{Yt.set(!0),Wt=0,ar.set(!1),zt()},ye.onmessage=e=>{try{const t=JSON.parse(e.data);dl(t)}catch(t){console.error("Failed to parse WebSocket message:",t)}},ye.onclose=()=>{Yt.set(!1),fl()},ye.onerror=e=>{console.error("WebSocket error:",e),Yt.set(!1)})}function fl(){_t&&clearTimeout(_t);const e=Math.min(bt.RECONNECT_DELAY*Math.pow(2,Wt),bt.RECONNECT_MAX_DELAY);Wt++,Wt>3&&ar.set(!0),_t=setTimeout(or,e)}function dl(e){var t,n;switch(e.event||e.type){case"task-created":case"task-updated":case"task-status-changed":Ot(),e.task&&(vs({type:"info",title:"Task Updated",message:`${e.task.id}: ${e.task.title||"Status changed"}`}),lt(`Task updated. ${e.task.title||e.task.id}`,"planning-hub"));break;case"agent-status-changed":cs(),Ki(),e.agent&&e.status&<(`${e.agent} is now ${e.status}.`,e.agent);break;case"issue-detected":wn(),vs({type:"warning",title:"New Issue Detected",message:((t=e.issue)==null?void 0:t.title)||"Check the Issues panel"}),lt(`Issue detected. ${((n=e.issue)==null?void 0:n.title)||"Check the issues panel."}`,"aegis");break;case"dispatch-success":Ot(),wn(),lt("Task dispatched.","planning-hub");break;case"notification":{const s=e.notification;vs(s);const r=cl(s);lt((s==null?void 0:s.message)||(s==null?void 0:s.title)||"",r);break}case"heartbeat":Gi();break}}function Gi(){qi.set(new Date().toISOString())}function hs(){Wt=0,_t&&clearTimeout(_t),or()}async function Ot(){const e=Date.now();Bn.set(!0),Cs.set(null);try{const t=await Xo(),n=Date.now()-e;if(n<bt.MIN_LOADING_TIME&&await new Promise(s=>setTimeout(s,bt.MIN_LOADING_TIME-n)),t&&(t.pending||t["in-progress"]||t.review||t.completed)){const s=[...(t.pending||[]).map(r=>({...r,status:r.status==="unknown"?"pending":r.status})),...(t["in-progress"]||[]).map(r=>({...r,status:r.status==="unknown"?"in-progress":r.status})),...(t.review||[]).map(r=>({...r,status:r.status==="unknown"?"review":r.status})),...(t.completed||[]).map(r=>({...r,status:r.status==="unknown"?"completed":r.status}))];Jn.set(s)}else Jn.set(t.tasks||t||[]);Bn.set(!1)}catch(t){console.error("Failed to fetch tasks:",t),Cs.set(t.message),Bn.set(!1)}}async function cs(){const e=Date.now();Un.set(!0),Ms.set(null);try{const t=await Jo(),n=Date.now()-e;n<bt.MIN_LOADING_TIME&&await new Promise(s=>setTimeout(s,bt.MIN_LOADING_TIME-n)),Ni.set(t.agents||t||[]),Un.set(!1)}catch(t){console.error("Failed to fetch agents:",t),Ms.set(t.message),Un.set(!1)}}async function wn(){const e=Date.now();jn.set(!0),Ns.set(null);try{const t=await Zo(),n=Date.now()-e;n<bt.MIN_LOADING_TIME&&await new Promise(s=>setTimeout(s,bt.MIN_LOADING_TIME-n)),os.set(t.issues||t||[]),jn.set(!1)}catch(t){console.error("Failed to fetch issues:",t),Ns.set(t.message),jn.set(!1)}}async function Ki(){Os.set(!0),Nr.set(null);try{const e=await Qo(50);Fi.set(e.events||[])}catch(e){console.error("Failed to fetch activity:",e),Nr.set(e.message)}Os.set(!1)}async function zt(){await Promise.all([Ot(),cs(),wn(),Ki()]),Gi()}let mn=null;function vl(){mn||(mn=setInterval(()=>{je(Yt)?Ot():zt()},1e4))}function pl(){mn&&(clearInterval(mn),mn=null)}function hl(){_t&&(clearTimeout(_t),_t=null),pl(),ye&&(ye.onclose=null,ye.onerror=null,ye.onmessage=null,ye.onopen=null,ye.close(),ye=null),Yt.set(!1),Wt=0}const _n=q(null),Rs=q(-1),Yi=q("tasks"),us=q(!1);function _l(e){_n.set(e),Rs.set(-1)}function Wi(e){Yi.set(e)}function qn(){us.set(!0)}function Ut(){us.set(!1)}var gl=pn('<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"></polygon><path d="M15.54 8.46a5 5 0 0 1 0 7.07"></path><path d="M19.07 4.93a10 10 0 0 1 0 14.14"></path></svg>'),bl=pn('<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"></polygon><line x1="23" y1="9" x2="17" y2="15"></line><line x1="17" y1="9" x2="23" y2="15"></line></svg>'),ml=D('<header class="header" role="banner"><div class="header-left"><button class="logo-btn" aria-label="Refresh dashboard"><span class="logo-icon" aria-hidden="true">⚒</span> <span class="logo-text">VIBE FORGE DASHBOARD</span></button></div> <div class="header-right"><button id="voice-toggle"><!></button> <button id="theme-toggle" class="header-btn" aria-label="Toggle dark/light mode" title="Toggle theme (t)"><svg class="icon sun-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="5"></circle><line x1="12" y1="1" x2="12" y2="3"></line><line x1="12" y1="21" x2="12" y2="23"></line><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line><line x1="1" y1="12" x2="3" y2="12"></line><line x1="21" y1="12" x2="23" y2="12"></line><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line></svg> <svg class="icon moon-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path></svg></button></div></header>');function yl(e,t){fe(t,!1);const n=()=>W(cn,"$voiceEnabled",r),s=()=>W(Qn,"$voiceSpeaking",r),[r,i]=Pe();let o=!1;function l(){je(cn)&&!o&&(o=!0,lt("Forge team online. Ready.","planning-hub"))}er(()=>{const S=()=>{l(),document.removeEventListener("click",S,{capture:!0})};return document.addEventListener("click",S,{capture:!0}),()=>document.removeEventListener("click",S,{capture:!0})});function a(){ol(),n()&&!o&&(o=!0,setTimeout(()=>lt("Forge team online. Ready.","planning-hub"),50))}ve();var c=ml(),u=h(c),g=h(u);g.__click=function(...S){zt==null||zt.apply(this,S)};var f=w(u,2),v=h(f);let y;v.__click=a;var T=h(v);{var _=S=>{var E=gl();A(S,E)},k=S=>{var E=bl();A(S,E)};V(T,S=>{n()?S(_):S(k,!1)})}var I=w(v,2);I.__click=function(...S){Rn==null||Rn.apply(this,S)},J(()=>{y=te(v,1,"header-btn",null,y,{active:n(),speaking:s()}),ke(v,"aria-label",n()?"Disable agent voices":"Enable agent voices"),ke(v,"title",n()?"Agent voices on (click to mute)":"Enable agent voices")}),A(e,c),de(),i()}xe(["click"]);function un(e){if(!e)return"--";const t=new Date(e),s=new Date-t,r=Math.floor(s/1e3),i=Math.floor(r/60),o=Math.floor(i/60),l=Math.floor(o/24);return r<60?"just now":i<60?`${i} min ago`:o<24?`${o}h ago`:l===1?"Yesterday":l<7?`${l} days ago`:t.toLocaleDateString()}function Or(e,t=30){return!e||e.length<=t?e:e.slice(0,t)+"..."}function zi(e){return e?String(e).replace(/[^a-zA-Z0-9-_]/g,""):""}function Bs(e){return e?e.charAt(0).toUpperCase()+e.slice(1):""}var wl=D('<div class="connection-banner" role="alert" aria-live="assertive"><span class="banner-icon">!</span> <span class="banner-text">Connection Lost - Dashboard cannot reach the forge server. Check if the daemon is running.</span> <button class="banner-retry">Retry</button></div>'),kl=D('<!> <footer class="footer" role="contentinfo"><div class="footer-left"><span class="connection-status"><span aria-hidden="true"></span> <span> </span></span> <span class="separator">|</span> <span> </span></div> <div class="footer-right"><span>Vibe Forge v0.1.0</span> <button class="keyboard-help-btn" aria-label="Keyboard shortcuts (?)">?</button></div></footer>',1);function El(e,t){fe(t,!1);const n=()=>W(Yt,"$wsConnected",i),s=()=>W(qi,"$lastUpdated",i),r=()=>W(ar,"$showConnectionBanner",i),[i,o]=Pe(),l=z(),a=z();ee(()=>n(),()=>{B(l,n()?"Connected":"Disconnected")}),ee(()=>(s(),un),()=>{B(a,s()?un(s()):"--")}),Pt(),ve();var c=kl(),u=ce(c);{var g=m=>{var $=wl(),M=w(h($),4);M.__click=function(...C){hs==null||hs.apply(this,C)},A(m,$)};V(u,m=>{r()&&m(g)})}var f=w(u,2),v=h(f),y=h(v),T=h(y);let _;var k=w(T,2),I=h(k),S=w(y,4),E=h(S),x=w(v,2),b=w(h(x),2);b.__click=function(...m){qn==null||qn.apply(this,m)},J(()=>{_=te(T,1,"status-dot",null,_,{connected:n(),disconnected:!n()}),O(I,d(l)),O(E,`Last updated: ${d(a)??""}`)}),A(e,c),de(),o()}xe(["click"]);const xl=5e3,lr=q([]);function Xi({type:e="info",title:t,message:n,actions:s=[],duration:r=xl}){const i=`toast-${Date.now()}`,o={id:i,type:e,title:t,message:n,actions:s};return lr.update(l=>[...l,o]),r>0&&setTimeout(()=>{Us(i)},r),i}function Us(e){lr.update(t=>t.filter(n=>n.id!==e))}var Tl=D('<span class="task-agent"><span> </span></span>'),Sl=D('<div tabindex="0" role="button"><div class="task-card-header"><span></span> <span class="task-id"> </span></div> <div class="task-title"> </div> <div class="task-meta"><!> <span class="task-time"> </span></div> <div class="task-expanded-content"><div class="task-description"> </div> <div class="task-actions"><button class="btn btn-secondary task-view-btn">View File</button></div></div></div>');function Al(e,t){fe(t,!1);const n=()=>W(ir,"$selectedTaskId",s),[s,r]=Pe(),i=z(),o=z(),l=z();let a=as(t,"task",8);function c(){Ds(a().id)}function u(j){(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),Ds(a().id))}function g(j){j.stopPropagation(),Xi({type:"info",title:"View Task",message:`Open tasks/pending/${a().id}.md in your editor`})}ee(()=>F(a()),()=>{B(i,zi((a().priority||"medium").toLowerCase()))}),ee(()=>F(a()),()=>{B(o,Kt(a().assigned_to||a().assignee))}),ee(()=>(n(),F(a())),()=>{B(l,n()===a().id)}),Pt(),ve();var f=Sl();let v;f.__click=c,f.__keydown=u;var y=h(f),T=h(y),_=w(T,2),k=h(_),I=w(y,2),S=h(I),E=w(I,2),x=h(E);{var b=j=>{var Y=Tl(),Q=h(Y),se=h(Q);J(ge=>{te(Q,1,`agent-badge ${d(o),N(()=>d(o).color)??""}`),O(se,`@${ge??""}`)},[()=>(d(o),N(()=>d(o).short.toLowerCase()))]),A(j,Y)};V(x,j=>{d(o)&&j(b)})}var m=w(x,2),$=h(m),M=w(E,2),C=h(M),L=h(C),P=w(C,2),K=h(P);K.__click=g,J((j,Y)=>{v=te(f,1,"card task-card",null,v,{expanded:d(l)}),ke(f,"data-task-id",(F(a()),N(()=>a().id))),ke(f,"aria-expanded",d(l)),te(T,1,`priority-dot ${d(i)??""}`),ke(T,"title",`${F(a()),N(()=>a().priority||"medium")??""} priority`),O(k,(F(a()),N(()=>a().id))),ke(I,"title",(F(a()),N(()=>a().title))),O(S,j),O($,Y),O(L,(F(a()),N(()=>a().description||"No description provided.")))},[()=>(F(Or),F(a()),N(()=>Or(a().title,40))),()=>(F(un),F(a()),N(()=>un(a().updated_at||a().created_at)))]),A(e,f),de(),r()}xe(["click","keydown"]);var $l=D('<button role="tab"> <span class="filter-count"> </span></button>'),Il=D('<div class="loading-state"><div class="skeleton-card"></div> <div class="skeleton-card"></div> <div class="skeleton-card"></div></div>'),Cl=D('<div class="error-state"><div class="error-icon" aria-hidden="true">!</div> <p class="error-title">Failed to load tasks</p> <p class="error-message"> </p> <button class="btn btn-secondary">Retry</button></div>'),Dl=D('<div class="empty-state"><div class="empty-icon" aria-hidden="true">✓</div> <p class="empty-title">All caught up!</p> <p class="empty-subtitle">No pending tasks</p></div>'),Ml=D('<div id="tasks-list" class="panel-content tasks-list" role="tabpanel" aria-busy="false"></div>'),Nl=D('<section id="tasks-panel" class="panel tasks-panel" aria-labelledby="tasks-heading" tabindex="-1"><div class="panel-header"><h2 id="tasks-heading" class="panel-title">TASKS</h2> <button aria-label="Refresh tasks"><svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M23 4v6h-6M1 20v-6h6"></path><path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"></path></svg></button></div> <div class="tasks-filters" role="tablist" aria-label="Task status filters"></div> <!></section>');function Ll(e,t){fe(t,!1);const n=()=>W(rr,"$currentTaskFilter",l),s=()=>W(Ho,"$taskCounts",l),r=()=>W(Bn,"$tasksLoading",l),i=()=>W(Cs,"$tasksError",l),o=()=>W(jo,"$filteredTasks",l),[l,a]=Pe();let c=z(!1);async function u(){B(c,!0),await Ot(),B(c,!1)}function g(x){Vo(x)}const f=[{id:"pending",label:"Pending",countKey:"pending"},{id:"in-progress",label:"Progress",countKey:"in-progress"},{id:"review",label:"Review",countKey:"review"},{id:"done",label:"Done",countKey:"done"}];ve();var v=Nl(),y=h(v),T=w(h(y),2);let _;T.__click=u;var k=w(y,2);Oe(k,5,()=>f,is,(x,b)=>{var m=$l();let $;m.__click=()=>g(d(b).id);var M=h(m),C=w(M),L=h(C);J(()=>{$=te(m,1,"filter-tab",null,$,{active:n()===d(b).id}),ke(m,"aria-selected",n()===d(b).id),ke(m,"data-filter",d(b).id),O(M,`${d(b).label??""} `),O(L,s()[d(b).countKey])}),A(x,m)});var I=w(k,2);{var S=x=>{var b=Il();A(x,b)},E=x=>{var b=Le(),m=ce(b);{var $=C=>{var L=Cl(),P=w(h(L),4),K=h(P),j=w(P,2);j.__click=u,J(()=>O(K,i())),A(C,L)},M=C=>{var L=Le(),P=ce(L);{var K=Y=>{var Q=Dl();A(Y,Q)},j=Y=>{var Q=Ml();Oe(Q,5,o,se=>se.id,(se,ge)=>{Al(se,{get task(){return d(ge)}})}),A(Y,Q)};V(P,Y=>{o().length===0?Y(K):Y(j,!1)},!0)}A(C,L)};V(m,C=>{i()?C($):C(M,!1)},!0)}A(x,b)};V(I,x=>{r()?x(S):x(E,!1)})}J(()=>_=te(T,1,"panel-refresh",null,_,{loading:d(c)})),A(e,v),de(),a()}xe(["click"]);var Ol=D('<div class="agent-task"> </div>'),Fl=D('<div class="agent-progress"><div class="agent-progress-bar"></div></div>'),Pl=D('<div class="card agent-card" tabindex="0" role="button"><div> </div> <div class="agent-info"><div class="agent-name"> </div> <div class="agent-status"><span></span> <span> </span></div> <!> <!></div></div>');function Rl(e,t){fe(t,!1);const n=z(),s=z(),r=z();let i=as(t,"agent",8);const o={"planning-hub":"Planning Hub online. The forge council is assembled — what needs building today?",oracle:"Oracle here. Before we build anything, let's make sure we're solving the right problem.",architect:"Architect online. Systems designed, patterns ready — what are we building?",aegis:"Aegis is here. What needs securing?",pixel:"Pixel reporting in. Let's make something people actually enjoy using.",ember:"Ember online. Infrastructure's ready — what needs shipping?",anvil:"Anvil here. Give me a component and I'll build it.",furnace:"Furnace is online. Backend's fired up — what are we building?",crucible:"Crucible here. I'll find the bugs before your users do. What are we testing?",temper:"Temper here. Send the PR when it's ready — I'll review it.",scribe:"Scribe online. What needs documenting?",herald:"Herald here. Ready to cut a release — what are we shipping?","planning-hub":"Planning Hub online. All systems go — what's on the anvil?",loki:"Loki here. So... are you sure you're solving the right problem?"};function l(){const b=(i().agent||i().name||i().id||"").toLowerCase(),m=o[b]||`${i().displayName||b} online.`;lt(m,b,!0)}ee(()=>F(i()),()=>{B(n,Kt(i().agent||i().name||i().id))}),ee(()=>F(i()),()=>{B(s,(i().status||"offline").toLowerCase())}),ee(()=>d(s),()=>{B(r,Bs(d(s)))}),Pt(),ve();var a=Pl();a.__click=l,a.__keydown=b=>(b.key==="Enter"||b.key===" ")&&l();var c=h(a),u=h(c),g=w(c,2),f=h(g),v=h(f),y=w(f,2),T=h(y),_=w(T,2),k=h(_),I=w(y,2);{var S=b=>{var m=Ol(),$=h(m);J(()=>O($,(F(i()),N(()=>i().task)))),A(b,m)};V(I,b=>{F(i()),N(()=>i().task)&&b(S)})}var E=w(I,2);{var x=b=>{var m=Fl(),$=h(m);J(()=>No($,`width: ${F(i()),N(()=>i().progress)??""}%`)),A(b,m)};V(E,b=>{F(i()),N(()=>i().progress!==void 0)&&b(x)})}J(()=>{ke(a,"aria-label",`Hear ${F(i()),N(()=>i().displayName||i().agent)??""} greeting`),te(c,1,`agent-avatar ${d(n),N(()=>{var b;return((b=d(n))==null?void 0:b.color)||""})??""}`),O(u,(F(i()),d(n),N(()=>{var b;return i().icon||((b=d(n))==null?void 0:b.icon)||"?"}))),O(v,(F(i()),d(n),N(()=>{var b;return i().displayName||((b=d(n))==null?void 0:b.name)||i().name||i().id||"Unknown"}))),te(T,1,`status-indicator ${d(s)??""}`),O(k,d(r))}),A(e,a),de()}xe(["click","keydown"]);var Bl=D('<div class="loading-state"><div class="skeleton-card"></div> <div class="skeleton-card"></div> <div class="skeleton-card"></div></div>'),Ul=D('<div class="error-state"><div class="error-icon" aria-hidden="true">!</div> <p class="error-title">Failed to load agents</p> <p class="error-message"> </p> <button class="btn btn-secondary">Retry</button></div>'),jl=D('<div class="empty-state"><div class="empty-icon" aria-hidden="true">☽</div> <p class="empty-title">All agents idle</p> <p class="empty-subtitle">Ready when you are</p></div>'),Hl=D('<div id="agents-list" class="panel-content agents-list" aria-busy="false"></div>'),Vl=D('<section id="agents-panel" class="panel agents-panel" aria-labelledby="agents-heading" tabindex="-1"><div class="panel-header"><h2 id="agents-heading" class="panel-title">AGENTS</h2> <button aria-label="Refresh agents"><svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M23 4v6h-6M1 20v-6h6"></path><path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"></path></svg></button></div> <!></section>');function ql(e,t){fe(t,!1);const n=()=>W(Un,"$agentsLoading",i),s=()=>W(Ms,"$agentsError",i),r=()=>W(Ni,"$agents",i),[i,o]=Pe();let l=z(!1);async function a(){B(l,!0),await cs(),B(l,!1)}ve();var c=Vl(),u=h(c),g=w(h(u),2);let f;g.__click=a;var v=w(u,2);{var y=_=>{var k=Bl();A(_,k)},T=_=>{var k=Le(),I=ce(k);{var S=x=>{var b=Ul(),m=w(h(b),4),$=h(m),M=w(m,2);M.__click=a,J(()=>O($,s())),A(x,b)},E=x=>{var b=Le(),m=ce(b);{var $=C=>{var L=jl();A(C,L)},M=C=>{var L=Hl();Oe(L,5,r,P=>P.id||P.name,(P,K)=>{Rl(P,{get agent(){return d(K)}})}),A(C,L)};V(m,C=>{r().length===0?C($):C(M,!1)},!0)}A(x,b)};V(I,x=>{s()?x(S):x(E,!1)},!0)}A(_,k)};V(v,_=>{n()?_(y):_(T,!1)})}J(()=>f=te(g,1,"panel-refresh",null,f,{loading:d(l)})),A(e,c),de(),o()}xe(["click"]);var Gl=D('<div class="notification-desc"> </div>'),Kl=D('<button class="btn btn-secondary"> </button>'),Yl=D('<div class="notification-actions"></div>'),Wl=D('<div class="card notification-card" tabindex="0"><div> </div> <div class="notification-content"><div class="notification-title"> </div> <!> <div class="notification-time"> </div> <!></div> <button class="notification-dismiss" aria-label="Dismiss notification">×</button></div>');function _s(e,t){fe(t,!1);const n=z(),s=z(),r=z();let i=as(t,"notification",8);const o={success:"✓",info:"i",warning:"!",attention:"🔔",error:"✗"};function l(b){b.stopPropagation(),Lr(i().id)}function a(b,m,$){b.stopPropagation(),console.log("Notification action:",m,i().id),Lr(i().id)}ee(()=>F(i()),()=>{B(n,i().type||"info")}),ee(()=>d(n),()=>{B(s,zi(d(n)))}),ee(()=>d(n),()=>{B(r,o[d(n)]||"i")}),Pt(),ve();var c=Wl(),u=h(c),g=h(u),f=w(u,2),v=h(f),y=h(v),T=w(v,2);{var _=b=>{var m=Gl(),$=h(m);J(()=>O($,(F(i()),N(()=>i().message)))),A(b,m)};V(T,b=>{F(i()),N(()=>i().message)&&b(_)})}var k=w(T,2),I=h(k),S=w(k,2);{var E=b=>{var m=Yl();Oe(m,5,()=>(F(i()),N(()=>i().actions)),is,($,M,C)=>{var L=Kl();L.__click=K=>a(K,d(M).action);var P=h(L);J(()=>O(P,(d(M),N(()=>d(M).label)))),A($,L)}),A(b,m)};V(S,b=>{F(i()),N(()=>i().actions&&i().actions.length>0)&&b(E)})}var x=w(f,2);x.__click=l,J(b=>{ke(c,"data-notification-id",(F(i()),N(()=>i().id))),te(u,1,`notification-icon ${d(s)??""}`),O(g,d(r)),O(y,(F(i()),N(()=>i().title))),O(I,b)},[()=>(F(un),F(i()),N(()=>un(i().timestamp||i().created_at)))]),A(e,c),de()}xe(["click"]);var zl=D('<div class="empty-state"><div class="empty-icon" aria-hidden="true">🔔</div> <p class="empty-title">Quiet day!</p> <p class="empty-subtitle">No notifications</p></div>'),Xl=D('<div class="notification-group-header">Today</div> <!>',1),Jl=D('<div class="notification-group-header">Yesterday</div> <!>',1),Zl=D('<div class="notification-group-header">Earlier</div> <!>',1),Ql=D('<div id="notifications-list" class="panel-content notifications-list" role="log" aria-live="polite" aria-busy="false"><!> <!> <!></div>'),ec=D('<section id="notifications-panel" class="panel notifications-panel" aria-labelledby="notifications-heading" tabindex="-1"><div class="panel-header"><h2 id="notifications-heading" class="panel-title">NOTIFICATIONS</h2> <button class="panel-clear" aria-label="Clear all notifications">Clear</button></div> <!></section>');function tc(e,t){fe(t,!1);const n=()=>W(In,"$notifications",r),s=()=>W(Yo,"$groupedNotifications",r),[r,i]=Pe();ve();var o=ec(),l=h(o),a=w(h(l),2);a.__click=function(...f){ps==null||ps.apply(this,f)};var c=w(l,2);{var u=f=>{var v=zl();A(f,v)},g=f=>{var v=Ql(),y=h(v);{var T=E=>{var x=Xl(),b=w(ce(x),2);Oe(b,1,()=>s().today,m=>m.id,(m,$)=>{_s(m,{get notification(){return d($)}})}),A(E,x)};V(y,E=>{s().today.length>0&&E(T)})}var _=w(y,2);{var k=E=>{var x=Jl(),b=w(ce(x),2);Oe(b,1,()=>s().yesterday,m=>m.id,(m,$)=>{_s(m,{get notification(){return d($)}})}),A(E,x)};V(_,E=>{s().yesterday.length>0&&E(k)})}var I=w(_,2);{var S=E=>{var x=Zl(),b=w(ce(x),2);Oe(b,1,()=>s().older,m=>m.id,(m,$)=>{_s(m,{get notification(){return d($)}})}),A(E,x)};V(I,E=>{s().older.length>0&&E(S)})}A(f,v)};V(c,f=>{n().length===0?f(u):f(g,!1)})}A(e,o),de(),i()}xe(["click"]);var nc=D('<div class="card issue-card" tabindex="0"><div> </div> <div class="issue-content"><div class="issue-header"><span> </span> <span class="issue-title"> </span></div> <div class="issue-details"> </div> <div class="issue-meta"> </div></div> <div class="issue-dispatch"><button class="btn btn-dispatch"><span class="btn-text"> </span> <span class="btn-arrow">»</span></button></div></div>');function sc(e,t){fe(t,!1);const n=z(),s=z();let r=as(t,"issue",8);function i(m){m.stopPropagation(),Oi(r())}ee(()=>F(r()),()=>{B(n,Ls(r().category))}),ee(()=>F(r()),()=>{B(s,Kt(r().agent))}),Pt(),ve();var o=nc(),l=h(o),a=h(l),c=w(l,2),u=h(c),g=h(u),f=h(g),v=w(g,2),y=h(v),T=w(u,2),_=h(T),k=w(T,2),I=h(k),S=w(c,2),E=h(S);E.__click=i;var x=h(E),b=h(x);J(()=>{ke(o,"data-issue-id",(F(r()),N(()=>r().id))),te(l,1,`issue-category ${F(r()),N(()=>r().category)??""}`),O(a,(d(n),N(()=>d(n).icon))),te(g,1,`issue-badge ${F(r()),N(()=>r().category)??""}`),O(f,(d(n),N(()=>d(n).label))),O(y,(F(r()),N(()=>r().title))),O(_,(F(r()),N(()=>r().details))),O(I,(F(r()),N(()=>r().meta))),O(b,`Dispatch ${d(s),N(()=>d(s)?d(s).short:"Agent")??""}`)}),A(e,o),de()}xe(["click"]);var rc=D('<div class="loading-state"><div class="skeleton-issue"></div> <div class="skeleton-issue"></div></div>'),ic=D('<div class="error-state"><div class="error-icon" aria-hidden="true">!</div> <p class="error-title">Failed to load issues</p> <p class="error-message"> </p> <button class="btn btn-secondary">Retry</button></div>'),ac=D('<div class="empty-state celebration"><div class="empty-icon" aria-hidden="true">🎉</div> <p class="empty-title">Everything looks great!</p> <p class="empty-subtitle">No stale docs, failing tests, or security issues</p></div>'),oc=D('<div id="issues-list" class="panel-content issues-list" aria-busy="false"></div>'),lc=D('<section id="issues-panel" aria-labelledby="issues-heading" tabindex="-1"><div class="panel-header"><h2 id="issues-heading" class="panel-title">ISSUES <span class="panel-subtitle">(Actionable)</span></h2> <div class="panel-actions"><button aria-label="Refresh issues"><svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M23 4v6h-6M1 20v-6h6"></path><path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"></path></svg></button> <button class="panel-collapse" aria-label="Collapse issues panel"><svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="18 15 12 9 6 15"></polyline></svg></button></div></div> <!></section>');function cc(e,t){fe(t,!1);const n=()=>W(Li,"$issuesCollapsed",o),s=()=>W(jn,"$issuesLoading",o),r=()=>W(Ns,"$issuesError",o),i=()=>W(os,"$issues",o),[o,l]=Pe();let a=z(!1);async function c(){B(a,!0),await wn(),B(a,!1)}ve();var u=lc();let g;var f=h(u),v=w(h(f),2),y=h(v);let T;y.__click=c;var _=w(y,2);_.__click=function(...E){ds==null||ds.apply(this,E)};var k=w(f,2);{var I=E=>{var x=rc();A(E,x)},S=E=>{var x=Le(),b=ce(x);{var m=M=>{var C=ic(),L=w(h(C),4),P=h(L),K=w(L,2);K.__click=c,J(()=>O(P,r())),A(M,C)},$=M=>{var C=Le(),L=ce(C);{var P=j=>{var Y=ac();A(j,Y)},K=j=>{var Y=oc();Oe(Y,5,i,Q=>Q.id,(Q,se)=>{sc(Q,{get issue(){return d(se)}})}),A(j,Y)};V(L,j=>{i().length===0?j(P):j(K,!1)},!0)}A(M,C)};V(b,M=>{r()?M(m):M($,!1)},!0)}A(E,x)};V(k,E=>{s()?E(I):E(S,!1)})}J(()=>{g=te(u,1,"panel issues-panel",null,g,{collapsed:n()}),T=te(y,1,"panel-refresh",null,T,{loading:d(a)})}),A(e,u),de(),l()}xe(["click"]);var uc=D('<div class="empty-state"><p class="empty-subtitle">Loading...</p></div>'),fc=D('<div class="empty-state"><div class="empty-icon" aria-hidden="true">📊</div> <p class="empty-title">No activity yet</p> <p class="empty-subtitle">Events appear when agents change status</p></div>'),dc=D('<span class="activity-task svelte-93r9wd"> </span>'),vc=D('<div class="activity-event svelte-93r9wd"><span class="activity-icon svelte-93r9wd" aria-hidden="true"> </span> <span class="activity-agent svelte-93r9wd"> </span> <span class="activity-status svelte-93r9wd"> </span> <!> <span class="activity-time svelte-93r9wd"> </span></div>'),pc=D('<div class="panel-content activity-list svelte-93r9wd" role="log" aria-live="polite"></div>'),hc=D('<section id="activity-panel" class="panel activity-panel svelte-93r9wd" aria-labelledby="activity-heading" tabindex="-1"><div class="panel-header"><h2 id="activity-heading" class="panel-title">ACTIVITY</h2></div> <!></section>');function _c(e,t){fe(t,!1);const n=()=>W(Os,"$activityLoading",r),s=()=>W(Fi,"$activityEvents",r),[r,i]=Pe(),o={working:"🔨",idle:"💤",blocked:"🚫",testing:"🧪",reviewing:"👁️",waiting:"⏳",review:"📋",merged:"✅"};function l(v){return o[v]||"📌"}function a(v){if(!v)return"";const y=new Date(v),_=new Date-y,k=Math.floor(_/6e4);if(k<1)return"just now";if(k<60)return`${k}m ago`;const I=Math.floor(k/60);return I<24?`${I}h ago`:y.toLocaleDateString()}ve();var c=hc(),u=w(h(c),2);{var g=v=>{var y=uc();A(v,y)},f=v=>{var y=Le(),T=ce(y);{var _=I=>{var S=fc();A(I,S)},k=I=>{var S=pc();Oe(S,5,s,E=>E.id,(E,x)=>{var b=vc(),m=h(b),$=h(m),M=w(m,2),C=h(M),L=w(M,2),P=h(L),K=w(L,2);{var j=se=>{var ge=dc(),Te=h(ge);J(()=>O(Te,d(x).task)),A(se,ge)};V(K,se=>{d(x).task&&se(j)})}var Y=w(K,2),Q=h(Y);J((se,ge)=>{O($,se),O(C,d(x).agent),O(P,d(x).status),O(Q,ge)},[()=>l(d(x).status),()=>a(d(x).recorded_at)]),A(E,b)}),A(I,S)};V(T,I=>{s().length===0?I(_):I(k,!1)},!0)}A(v,y)};V(u,v=>{n()?v(g):v(f,!1)})}A(e,c),de(),i()}var gc=D('<div class="modal-error"><span class="error-icon">!</span> <span class="error-text"> </span></div>'),bc=D('<div class="modal" role="dialog" aria-labelledby="dispatch-modal-title" aria-modal="true"><div class="modal-backdrop"></div> <div class="modal-content"><div class="modal-header"><h3 id="dispatch-modal-title" class="modal-title">Dispatch Task to <span> </span></h3> <button class="modal-close" aria-label="Close modal">×</button></div> <div class="modal-body"><div class="dispatch-info"><div class="info-row"><span class="info-label">Issue:</span> <span class="info-value"> </span></div> <div class="info-row"><span class="info-label">Target:</span> <span class="info-value"> </span></div> <div class="info-row"><span class="info-label">Reason:</span> <span class="info-value"> </span></div></div> <div class="dispatch-preview"><p class="preview-label">This will create a new task:</p> <div class="task-preview"><div class="preview-id"> </div> <div class="preview-title"> </div> <div class="preview-meta"><span>Assigned to: <strong> </strong></span> <span>Priority: <strong> </strong></span></div></div></div></div> <div class="modal-footer"><button class="btn btn-secondary">Cancel</button> <button><span>Confirm Dispatch</span> <span></span></button></div> <!></div></div>');function mc(e,t){fe(t,!1);const n=()=>W(ls,"$pendingDispatch",i),s=()=>W(Hn,"$dispatchLoading",i),r=()=>W(bn,"$dispatchError",i),[i,o]=Pe(),l=z(),a=z(),c=z(),u=z(),g=z();let f=z(),v=z(null);async function y(){var E;if(d(l)){Hn.set(!0),bn.set(null);try{const x=await el(d(l)),b=d(l).id,m=d(l).agent;Ve(),Ko(b),Xi({type:"success",title:"Task dispatched!",message:`${x.taskId||"Task"} assigned to ${((E=Kt(m))==null?void 0:E.name)||"agent"}`}),Ot()}catch(x){Hn.set(!1),bn.set("Failed to dispatch task. Please try again."),console.error("Dispatch error:",x)}}}function T(){Ve()}function _(E){if(E.key==="Escape"&&Ve(),E.key==="Tab"&&d(f)){const x=d(f).querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(x.length===0){E.preventDefault();return}const b=x[0],m=x[x.length-1];E.shiftKey?document.activeElement===b&&(E.preventDefault(),m.focus()):document.activeElement===m&&(E.preventDefault(),b.focus())}}tr(()=>{d(v)&&d(v).focus()}),ee(()=>n(),()=>{B(l,n())}),ee(()=>(d(l),Kt),()=>{B(a,d(l)?Kt(d(l).agent):null)}),ee(()=>(d(l),Ls),()=>{B(c,d(l)?Ls(d(l).category):null)}),ee(()=>(d(l),Mr),()=>{B(u,d(l)?Mr():"")}),ee(()=>d(l),()=>{B(g,d(l)?`Fix: ${d(l).title}`:"")}),ee(()=>(d(l),d(f)),()=>{d(l)&&d(f)&&(B(v,document.activeElement),setTimeout(()=>{var x;const E=(x=d(f))==null?void 0:x.querySelector(".btn-secondary");E==null||E.focus()},100))}),Pt(),ve();var k=Le(),I=ce(k);{var S=E=>{var x=bc();x.__keydown=_;var b=h(x);b.__click=T;var m=w(b,2),$=h(m),M=h($),C=w(h(M)),L=h(C),P=w(M,2);P.__click=function(...be){Ve==null||Ve.apply(this,be)};var K=w($,2),j=h(K),Y=h(j),Q=w(h(Y),2),se=h(Q),ge=w(Y,2),Te=w(h(ge),2),Dn=h(Te),Ji=w(ge,2),Zi=w(h(Ji),2),Qi=h(Zi),ea=w(j,2),ta=w(h(ea),2),cr=h(ta),na=h(cr),ur=w(cr,2),sa=h(ur),ra=w(ur,2),fr=h(ra),ia=w(h(fr)),aa=h(ia),oa=w(fr,2),la=w(h(oa)),ca=h(la),dr=w(K,2),vr=h(dr);vr.__click=function(...be){Ve==null||Ve.apply(this,be)};var Mn=w(vr,2);let pr;Mn.__click=y;var hr=h(Mn);let _r;var ua=w(hr,2);let gr;var fa=w(dr,2);{var da=be=>{var it=gc(),va=w(h(it),2),pa=h(va);J(()=>O(pa,r())),A(be,it)};V(fa,be=>{r()&&be(da)})}$i(x,be=>B(f,be),()=>d(f)),J(be=>{O(L,(d(a),N(()=>{var it;return((it=d(a))==null?void 0:it.name)||"Agent"}))),O(se,(d(l),N(()=>d(l).title))),O(Dn,(d(l),N(()=>d(l).target))),O(Qi,(d(l),N(()=>d(l).details))),O(na,d(u)),O(sa,d(g)),O(aa,(d(a),N(()=>{var it;return((it=d(a))==null?void 0:it.name)||"Agent"}))),O(ca,be),pr=te(Mn,1,"btn btn-primary",null,pr,{loading:s()}),Mn.disabled=s(),_r=te(hr,1,"btn-text svelte-p4t6ev",null,_r,{hidden:s()}),gr=te(ua,1,"btn-spinner svelte-p4t6ev",null,gr,{hidden:!s()})},[()=>(F(Bs),d(c),N(()=>{var be;return Bs(((be=d(c))==null?void 0:be.priority)||"medium")}))]),A(E,x)};V(I,E=>{d(l)&&E(S)})}A(e,k),de(),o()}xe(["keydown","click"]);var yc=D('<div class="modal" role="dialog" aria-labelledby="keyboard-modal-title" aria-modal="true"><div class="modal-backdrop"></div> <div class="modal-content keyboard-help"><div class="modal-header"><h3 id="keyboard-modal-title" class="modal-title">Keyboard Shortcuts</h3> <button class="modal-close" aria-label="Close modal">×</button></div> <div class="modal-body"><div class="shortcut-section"><h4>Navigation</h4> <div class="shortcut-list"><div class="shortcut"><kbd>1</kbd> <kbd>2</kbd> <kbd>3</kbd> <kbd>4</kbd> <span>Focus panels (Tasks, Agents, Notifications, Issues)</span></div> <div class="shortcut"><kbd>j</kbd> / <kbd>k</kbd> <span>Move down / up in list</span></div> <div class="shortcut"><kbd>Enter</kbd> <span>Expand / select item</span></div> <div class="shortcut"><kbd>Escape</kbd> <span>Close / deselect</span></div></div></div> <div class="shortcut-section"><h4>Actions</h4> <div class="shortcut-list"><div class="shortcut"><kbd>d</kbd> <span>Dispatch (on issue)</span></div> <div class="shortcut"><kbd>r</kbd> <span>Refresh current panel</span></div> <div class="shortcut"><kbd>t</kbd> <span>Toggle theme</span></div></div></div> <div class="shortcut-section"><h4>General</h4> <div class="shortcut-list"><div class="shortcut"><kbd>?</kbd> <span>Show this help</span></div> <div class="shortcut"><kbd>Tab</kbd> <span>Next element</span></div> <div class="shortcut"><kbd>Shift</kbd>+<kbd>Tab</kbd> <span>Previous element</span></div></div></div></div></div></div>');function wc(e,t){fe(t,!1);const n=()=>W(us,"$showKeyboardHelp",s),[s,r]=Pe();let i=z(),o=z(null);function l(){Ut()}function a(f){if(f.key==="Escape"&&Ut(),f.key==="Tab"&&d(i)){const v=d(i).querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(v.length===0){f.preventDefault();return}const y=v[0],T=v[v.length-1];f.shiftKey?document.activeElement===y&&(f.preventDefault(),T.focus()):document.activeElement===T&&(f.preventDefault(),y.focus())}}tr(()=>{d(o)&&d(o).focus()}),ee(()=>(n(),d(i)),()=>{n()&&d(i)&&(B(o,document.activeElement),setTimeout(()=>{var v;const f=(v=d(i))==null?void 0:v.querySelector(".modal-close");f==null||f.focus()},100))}),Pt(),ve();var c=Le(),u=ce(c);{var g=f=>{var v=yc();v.__keydown=a;var y=h(v);y.__click=l;var T=w(y,2),_=h(T),k=w(h(_),2);k.__click=function(...I){Ut==null||Ut.apply(this,I)},$i(v,I=>B(i,I),()=>d(i)),A(f,v)};V(u,f=>{n()&&f(g)})}A(e,c),de(),r()}xe(["keydown","click"]);var kc=D('<div class="toast-message"> </div>'),Ec=D('<button class="toast-action"> </button>'),xc=D('<div class="toast-actions"></div>'),Tc=D('<div><div class="toast-icon"> </div> <div class="toast-content"><div class="toast-title"> </div> <!> <!></div> <button class="toast-close" aria-label="Dismiss">×</button></div>'),Sc=D('<div id="toast-container" class="toast-container" role="status" aria-live="polite" aria-atomic="true"></div>');function Ac(e,t){fe(t,!1);const n=()=>W(lr,"$toasts",s),[s,r]=Pe(),i={success:"✓",error:"✗",info:"i",warning:"!"};function o(c,u,g){u.action&&u.action(),Us(c.id)}function l(c){Us(c)}ve();var a=Sc();Oe(a,5,n,c=>c.id,(c,u)=>{var g=Tc(),f=h(g),v=h(f),y=w(f,2),T=h(y),_=h(T),k=w(T,2);{var I=b=>{var m=kc(),$=h(m);J(()=>O($,d(u).message)),A(b,m)};V(k,b=>{d(u).message&&b(I)})}var S=w(k,2);{var E=b=>{var m=xc();Oe(m,5,()=>d(u).actions,is,($,M,C)=>{var L=Ec();L.__click=()=>o(d(u),d(M));var P=h(L);J(()=>O(P,d(M).label)),A($,L)}),A(b,m)};V(S,b=>{d(u).actions&&d(u).actions.length>0&&b(E)})}var x=w(y,2);x.__click=()=>l(d(u).id),J(()=>{te(g,1,`toast ${d(u).type??""}`),ke(g,"id",d(u).id),O(v,i[d(u).type]||"i"),O(_,d(u).title)}),A(c,g)}),A(e,a),de(),r()}xe(["click"]);var $c=pn('<svg class="tab-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 11l3 3L22 4"></path><path d="M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"></path></svg>'),Ic=pn('<svg class="tab-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="8" r="5"></circle><path d="M20 21a8 8 0 0 0-16 0"></path></svg>'),Cc=pn('<svg class="tab-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"></path><path d="M13.73 21a2 2 0 0 1-3.46 0"></path></svg>'),Dc=pn('<svg class="tab-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line></svg>'),Mc=D('<button role="tab"><!> <span> </span></button>'),Nc=D('<nav class="mobile-tabs" role="tablist" aria-label="Panel navigation"></nav>');function Lc(e,t){fe(t,!1);const n=()=>W(Yi,"$mobileActivePanel",s),[s,r]=Pe(),i=[{id:"tasks",label:"Tasks",icon:"M9 11l3 3L22 4M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"},{id:"agents",label:"Agents",icon:"M12 8a5 5 0 1 0 0-10 5 5 0 0 0 0 10zM20 21a8 8 0 0 0-16 0"},{id:"notifications",label:"Notif",icon:"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9M13.73 21a2 2 0 0 1-3.46 0"},{id:"issues",label:"Issues",icon:"M12 12a10 10 0 1 0 0-20 10 10 0 0 0 0 20zM12 8v4M12 16h.01"}];function o(a){Wi(a)}ve();var l=Nc();Oe(l,5,()=>i,is,(a,c)=>{var u=Mc();let g;u.__click=()=>o(d(c).id);var f=h(u);{var v=k=>{var I=$c();A(k,I)},y=k=>{var I=Le(),S=ce(I);{var E=b=>{var m=Ic();A(b,m)},x=b=>{var m=Le(),$=ce(m);{var M=L=>{var P=Cc();A(L,P)},C=L=>{var P=Le(),K=ce(P);{var j=Y=>{var Q=Dc();A(Y,Q)};V(K,Y=>{d(c).id==="issues"&&Y(j)},!0)}A(L,P)};V($,L=>{d(c).id==="notifications"?L(M):L(C,!1)},!0)}A(b,m)};V(S,b=>{d(c).id==="agents"?b(E):b(x,!1)},!0)}A(k,I)};V(f,k=>{d(c).id==="tasks"?k(v):k(y,!1)})}var T=w(f,2),_=h(T);J(()=>{g=te(u,1,"mobile-tab",null,g,{active:n()===d(c).id}),ke(u,"aria-selected",n()===d(c).id),ke(u,"data-panel",d(c).id),O(_,d(c).label)}),A(a,u)}),A(e,l),de(),r()}xe(["click"]);var Oc=D('<a href="#main-content" class="skip-link">Skip to main content</a> <a href="#tasks-panel" class="skip-link">Skip to tasks</a> <a href="#issues-panel" class="skip-link">Skip to issues</a> <!> <main id="main-content" class="main" role="main"><div class="panels-top"><!> <!> <!></div> <div class="panels-bottom"><!> <!></div></main> <!> <!> <!> <!> <!>',1);function Fc(e,t){fe(t,!1),er(()=>{Uo(),or(),vl(),document.addEventListener("keydown",n)}),tr(()=>{hl(),document.removeEventListener("keydown",n)});function n(m){if(m.target.matches("input, textarea, select"))return;const $=je(ls)!==null,M=je(us),C=$||M;if(m.key==="Escape"){if($){Ve();return}if(M){Ut();return}qo();return}if(!C)switch(m.key){case"1":s("tasks");break;case"2":s("agents");break;case"3":s("notifications");break;case"4":s("issues");break;case"j":case"ArrowDown":r("down"),m.preventDefault();break;case"k":case"ArrowUp":r("up"),m.preventDefault();break;case"Enter":i();break;case"d":o();break;case"r":l();break;case"t":Rn();break;case"?":qn(),m.preventDefault();break}}function s(m){_l(m),Rs.set(-1);const $=document.getElementById(`${m}-panel`);$==null||$.focus(),window.innerWidth<768&&Wi(m)}function r(m){var L,P;const $=je(_n);if(!$){s("tasks");return}const M=document.getElementById(`${$}-panel`),C=M==null?void 0:M.querySelectorAll(".card");!C||C.length===0||(m==="down"?currentFocusedItemIndex=Math.min(currentFocusedItemIndex+1,C.length-1):currentFocusedItemIndex=Math.max(currentFocusedItemIndex-1,0),Rs.set(currentFocusedItemIndex),C.forEach((K,j)=>{K.classList.toggle("selected",j===currentFocusedItemIndex)}),(L=C[currentFocusedItemIndex])==null||L.scrollIntoView({block:"nearest"}),(P=C[currentFocusedItemIndex])==null||P.focus())}function i(){const m=je(_n);if(m==="tasks"&¤tFocusedItemIndex>=0){const M=document.querySelectorAll("#tasks-list .task-card")[currentFocusedItemIndex];if(M){const C=M.dataset.taskId;Ds(C)}}else m==="issues"&¤tFocusedItemIndex>=0&&o()}function o(){if(je(_n)!=="issues")return;const M=document.querySelectorAll("#issues-list .issue-card")[currentFocusedItemIndex];if(M){const C=M.dataset.issueId,P=je(os).find(K=>K.id===C);P&&Oi(P)}}function l(){switch(je(_n)){case"tasks":Ot();break;case"agents":cs();break;case"issues":wn();break;default:zt()}}ve();var a=Oc(),c=w(ce(a),6);yl(c,{});var u=w(c,2),g=h(u),f=h(g);Ll(f,{});var v=w(f,2);ql(v,{});var y=w(v,2);tc(y,{});var T=w(g,2),_=h(T);cc(_,{});var k=w(_,2);_c(k,{});var I=w(u,2);El(I,{});var S=w(I,2);mc(S,{});var E=w(S,2);wc(E,{});var x=w(E,2);Ac(x,{});var b=w(x,2);Lc(b,{}),A(e,a),de()}Wo().then(()=>{Eo(Fc,{target:document.getElementById("app")})});
|