@kl-c/matrixos 0.3.41 → 0.3.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +167 -1
- package/dist/cli-node/index.js +167 -1
- package/dist/features/dashboard/data-provider.d.ts +21 -1
- package/dist/features/dashboard/frontend/css/style.css +148 -1
- package/dist/features/dashboard/frontend/index.html +22 -0
- package/dist/features/dashboard/frontend/js/api.js +4 -0
- package/dist/features/dashboard/frontend/js/app.js +77 -2
- package/dist/features/dashboard/types.d.ts +9 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -2163,7 +2163,7 @@ var package_default;
|
|
|
2163
2163
|
var init_package = __esm(() => {
|
|
2164
2164
|
package_default = {
|
|
2165
2165
|
name: "@kl-c/matrixos",
|
|
2166
|
-
version: "0.3.
|
|
2166
|
+
version: "0.3.42",
|
|
2167
2167
|
description: "MaTrixOS \u2014 Agentic OS for OpenCode. Personalizable, communicating, self-improving, resilient.",
|
|
2168
2168
|
main: "./dist/index.js",
|
|
2169
2169
|
types: "dist/index.d.ts",
|
|
@@ -187049,6 +187049,23 @@ function ensureKanbanTable(db) {
|
|
|
187049
187049
|
} catch {
|
|
187050
187050
|
db.exec("ALTER TABLE matrixos_kanban ADD COLUMN output TEXT NOT NULL DEFAULT ''");
|
|
187051
187051
|
}
|
|
187052
|
+
try {
|
|
187053
|
+
db.query("SELECT goal_id FROM matrixos_kanban LIMIT 1").all();
|
|
187054
|
+
} catch {
|
|
187055
|
+
db.exec("ALTER TABLE matrixos_kanban ADD COLUMN goal_id TEXT NOT NULL DEFAULT ''");
|
|
187056
|
+
}
|
|
187057
|
+
}
|
|
187058
|
+
function ensureGoalsTable(db) {
|
|
187059
|
+
db.exec(`
|
|
187060
|
+
CREATE TABLE IF NOT EXISTS matrixos_goals (
|
|
187061
|
+
id TEXT PRIMARY KEY,
|
|
187062
|
+
title TEXT NOT NULL,
|
|
187063
|
+
description TEXT NOT NULL DEFAULT '',
|
|
187064
|
+
status TEXT NOT NULL DEFAULT 'active',
|
|
187065
|
+
created_at INTEGER NOT NULL,
|
|
187066
|
+
updated_at INTEGER NOT NULL
|
|
187067
|
+
)
|
|
187068
|
+
`);
|
|
187052
187069
|
}
|
|
187053
187070
|
function midnightMs() {
|
|
187054
187071
|
const d = new Date;
|
|
@@ -187452,6 +187469,125 @@ ${row.description ? `Description: ${row.description}
|
|
|
187452
187469
|
db.close();
|
|
187453
187470
|
}
|
|
187454
187471
|
},
|
|
187472
|
+
async getGoals() {
|
|
187473
|
+
const db = getDbWrite();
|
|
187474
|
+
if (!db)
|
|
187475
|
+
return [];
|
|
187476
|
+
try {
|
|
187477
|
+
ensureGoalsTable(db);
|
|
187478
|
+
const rows = db.query("SELECT id, title, description, status, created_at, updated_at FROM matrixos_goals ORDER BY updated_at DESC").all();
|
|
187479
|
+
const result = [];
|
|
187480
|
+
for (const row of rows) {
|
|
187481
|
+
const taskRows = db.query("SELECT COUNT(*) as count FROM matrixos_kanban WHERE goal_id = ?").get(row.id);
|
|
187482
|
+
result.push({
|
|
187483
|
+
id: row.id,
|
|
187484
|
+
title: row.title,
|
|
187485
|
+
description: row.description || "",
|
|
187486
|
+
status: row.status,
|
|
187487
|
+
taskCount: taskRows?.count ?? 0,
|
|
187488
|
+
createdAt: new Date(row.created_at).toISOString(),
|
|
187489
|
+
updatedAt: new Date(row.updated_at).toISOString()
|
|
187490
|
+
});
|
|
187491
|
+
}
|
|
187492
|
+
return result;
|
|
187493
|
+
} catch {
|
|
187494
|
+
return [];
|
|
187495
|
+
} finally {
|
|
187496
|
+
db.close();
|
|
187497
|
+
}
|
|
187498
|
+
},
|
|
187499
|
+
async createGoal(input) {
|
|
187500
|
+
const db = getDbWrite();
|
|
187501
|
+
if (!db)
|
|
187502
|
+
return { ok: false, error: "database unavailable" };
|
|
187503
|
+
try {
|
|
187504
|
+
ensureGoalsTable(db);
|
|
187505
|
+
const id = `goal_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
|
|
187506
|
+
const now = Date.now();
|
|
187507
|
+
db.query("INSERT INTO matrixos_goals (id, title, description, status, created_at, updated_at) VALUES (?, ?, ?, 'active', ?, ?)").run(id, input.title, input.description ?? "", now, now);
|
|
187508
|
+
return { ok: true, id };
|
|
187509
|
+
} catch (e) {
|
|
187510
|
+
return { ok: false, error: e instanceof Error ? e.message : String(e) };
|
|
187511
|
+
} finally {
|
|
187512
|
+
db.close();
|
|
187513
|
+
}
|
|
187514
|
+
},
|
|
187515
|
+
async decomposeGoal(id) {
|
|
187516
|
+
const db = getDbWrite();
|
|
187517
|
+
if (!db)
|
|
187518
|
+
return { ok: false, error: "database unavailable" };
|
|
187519
|
+
try {
|
|
187520
|
+
ensureGoalsTable(db);
|
|
187521
|
+
const row = db.query("SELECT title, description, status FROM matrixos_goals WHERE id = ?").get(id);
|
|
187522
|
+
if (!row)
|
|
187523
|
+
return { ok: false, error: "goal not found" };
|
|
187524
|
+
db.query("UPDATE matrixos_goals SET status = ?, updated_at = ? WHERE id = ?").run("decomposing", Date.now(), id);
|
|
187525
|
+
const brief = `Goal: ${row.title}
|
|
187526
|
+
${row.description ? `Description: ${row.description}
|
|
187527
|
+
` : ""}Decompose this goal into concrete Kanban tasks. Respond ONLY with a JSON array (no markdown, no prose) of objects: {"title": string, "description": string, "agent": string (one of morpheus/tank/oracle/link/ghost/the-analyst/the-keymaker/agent-smith/the-operator/neo/trinity/cypher/sentinel/mouse/dreamer/architect), "priority": "low"|"medium"|"high"|"urgent"}. Produce 2-6 tasks.`;
|
|
187528
|
+
const proc = Bun.spawn({
|
|
187529
|
+
cmd: ["matrixos", "run", "--agent", "morpheus", "--json", JSON.stringify(brief)],
|
|
187530
|
+
env: { ...process.env, PATH: `${process.env.PATH || ""}:/root/.bun/bin:/usr/bin` },
|
|
187531
|
+
stdout: "pipe",
|
|
187532
|
+
stderr: "pipe"
|
|
187533
|
+
});
|
|
187534
|
+
const result = await proc.exited;
|
|
187535
|
+
const decoder = new TextDecoder;
|
|
187536
|
+
const output = decoder.decode(await new Response(proc.stdout).arrayBuffer());
|
|
187537
|
+
const errOutput = decoder.decode(await new Response(proc.stderr).arrayBuffer());
|
|
187538
|
+
const combined = [output, errOutput].filter(Boolean).join(`
|
|
187539
|
+
`).slice(0, 4000);
|
|
187540
|
+
if (result !== 0) {
|
|
187541
|
+
db.query("UPDATE matrixos_goals SET status = ?, updated_at = ? WHERE id = ?").run("active", Date.now(), id);
|
|
187542
|
+
return { ok: false, error: "decomposition failed", output: combined, status: "active" };
|
|
187543
|
+
}
|
|
187544
|
+
const jsonMatch = combined.match(/\[[\s\S]*\]/);
|
|
187545
|
+
if (!jsonMatch) {
|
|
187546
|
+
db.query("UPDATE matrixos_goals SET status = ?, updated_at = ? WHERE id = ?").run("active", Date.now(), id);
|
|
187547
|
+
return { ok: false, error: "no task JSON in response", output: combined, status: "active" };
|
|
187548
|
+
}
|
|
187549
|
+
let tasks = [];
|
|
187550
|
+
try {
|
|
187551
|
+
tasks = JSON.parse(jsonMatch[0]);
|
|
187552
|
+
} catch {
|
|
187553
|
+
db.query("UPDATE matrixos_goals SET status = ?, updated_at = ? WHERE id = ?").run("active", Date.now(), id);
|
|
187554
|
+
return { ok: false, error: "invalid task JSON", output: combined, status: "active" };
|
|
187555
|
+
}
|
|
187556
|
+
let created = 0;
|
|
187557
|
+
for (const t2 of tasks) {
|
|
187558
|
+
if (!t2.title)
|
|
187559
|
+
continue;
|
|
187560
|
+
const tid = `kb_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
|
|
187561
|
+
const now = Date.now();
|
|
187562
|
+
db.query("INSERT INTO matrixos_kanban (id, title, description, agent, status, priority, goal_id, created_at, updated_at) VALUES (?, ?, ?, ?, 'pending', ?, ?, ?, ?)").run(tid, t2.title, t2.description ?? "", t2.agent ?? "Morpheus", t2.priority ?? "medium", id, now, now);
|
|
187563
|
+
created++;
|
|
187564
|
+
}
|
|
187565
|
+
db.query("UPDATE matrixos_goals SET status = ?, updated_at = ? WHERE id = ?").run("completed", Date.now(), id);
|
|
187566
|
+
return { ok: true, tasks: created, output: combined, status: "completed" };
|
|
187567
|
+
} catch (e) {
|
|
187568
|
+
try {
|
|
187569
|
+
db.query("UPDATE matrixos_goals SET status = ?, updated_at = ? WHERE id = ?").run("active", Date.now(), id);
|
|
187570
|
+
} catch {}
|
|
187571
|
+
return { ok: false, error: e instanceof Error ? e.message : String(e), status: "active" };
|
|
187572
|
+
} finally {
|
|
187573
|
+
db.close();
|
|
187574
|
+
}
|
|
187575
|
+
},
|
|
187576
|
+
async deleteGoal(id) {
|
|
187577
|
+
const db = getDbWrite();
|
|
187578
|
+
if (!db)
|
|
187579
|
+
return { ok: false, error: "database unavailable" };
|
|
187580
|
+
try {
|
|
187581
|
+
ensureGoalsTable(db);
|
|
187582
|
+
db.query("DELETE FROM matrixos_kanban WHERE goal_id = ?").run(id);
|
|
187583
|
+
db.query("DELETE FROM matrixos_goals WHERE id = ?").run(id);
|
|
187584
|
+
return { ok: true };
|
|
187585
|
+
} catch (e) {
|
|
187586
|
+
return { ok: false, error: e instanceof Error ? e.message : String(e) };
|
|
187587
|
+
} finally {
|
|
187588
|
+
db.close();
|
|
187589
|
+
}
|
|
187590
|
+
},
|
|
187455
187591
|
async getIncidents(limit = 50) {
|
|
187456
187592
|
const lines = readJsonl("anti-loop.jsonl");
|
|
187457
187593
|
if (lines.length === 0) {
|
|
@@ -187804,6 +187940,36 @@ function createDashboardServer(dataProvider, config5) {
|
|
|
187804
187940
|
const result = await dataProvider.executeKanbanTask(body.id);
|
|
187805
187941
|
return Response.json(result, { status: result.ok ? 200 : 500, headers: jsonHeaders });
|
|
187806
187942
|
}
|
|
187943
|
+
case "/api/goals": {
|
|
187944
|
+
if (req.method === "POST") {
|
|
187945
|
+
const body = await req.json();
|
|
187946
|
+
if (!body.title || !body.title.trim()) {
|
|
187947
|
+
return Response.json({ ok: false, error: "title required" }, { status: 400, headers: jsonHeaders });
|
|
187948
|
+
}
|
|
187949
|
+
const result = await dataProvider.createGoal(body);
|
|
187950
|
+
return Response.json(result, { status: result.ok ? 201 : 500, headers: jsonHeaders });
|
|
187951
|
+
}
|
|
187952
|
+
if (req.method === "DELETE") {
|
|
187953
|
+
const id = url3.searchParams.get("id");
|
|
187954
|
+
if (!id) {
|
|
187955
|
+
return Response.json({ ok: false, error: "id required" }, { status: 400, headers: jsonHeaders });
|
|
187956
|
+
}
|
|
187957
|
+
const result = await dataProvider.deleteGoal(id);
|
|
187958
|
+
return Response.json(result, { status: result.ok ? 200 : 500, headers: jsonHeaders });
|
|
187959
|
+
}
|
|
187960
|
+
return Response.json(await dataProvider.getGoals(), { headers: jsonHeaders });
|
|
187961
|
+
}
|
|
187962
|
+
case "/api/goals/decompose": {
|
|
187963
|
+
if (req.method !== "POST") {
|
|
187964
|
+
return new Response("Method Not Allowed", { status: 405, headers: corsHeaders });
|
|
187965
|
+
}
|
|
187966
|
+
const body = await req.json();
|
|
187967
|
+
if (!body.id) {
|
|
187968
|
+
return Response.json({ ok: false, error: "id required" }, { status: 400, headers: jsonHeaders });
|
|
187969
|
+
}
|
|
187970
|
+
const result = await dataProvider.decomposeGoal(body.id);
|
|
187971
|
+
return Response.json(result, { status: result.ok ? 200 : 500, headers: jsonHeaders });
|
|
187972
|
+
}
|
|
187807
187973
|
case "/api/incidents": {
|
|
187808
187974
|
const limit = parseInt(url3.searchParams.get("limit") ?? "50", 10);
|
|
187809
187975
|
return Response.json(await dataProvider.getIncidents(limit), { headers: jsonHeaders });
|
package/dist/cli-node/index.js
CHANGED
|
@@ -2163,7 +2163,7 @@ var package_default;
|
|
|
2163
2163
|
var init_package = __esm(() => {
|
|
2164
2164
|
package_default = {
|
|
2165
2165
|
name: "@kl-c/matrixos",
|
|
2166
|
-
version: "0.3.
|
|
2166
|
+
version: "0.3.42",
|
|
2167
2167
|
description: "MaTrixOS \u2014 Agentic OS for OpenCode. Personalizable, communicating, self-improving, resilient.",
|
|
2168
2168
|
main: "./dist/index.js",
|
|
2169
2169
|
types: "dist/index.d.ts",
|
|
@@ -187104,6 +187104,23 @@ function ensureKanbanTable(db) {
|
|
|
187104
187104
|
} catch {
|
|
187105
187105
|
db.exec("ALTER TABLE matrixos_kanban ADD COLUMN output TEXT NOT NULL DEFAULT ''");
|
|
187106
187106
|
}
|
|
187107
|
+
try {
|
|
187108
|
+
db.query("SELECT goal_id FROM matrixos_kanban LIMIT 1").all();
|
|
187109
|
+
} catch {
|
|
187110
|
+
db.exec("ALTER TABLE matrixos_kanban ADD COLUMN goal_id TEXT NOT NULL DEFAULT ''");
|
|
187111
|
+
}
|
|
187112
|
+
}
|
|
187113
|
+
function ensureGoalsTable(db) {
|
|
187114
|
+
db.exec(`
|
|
187115
|
+
CREATE TABLE IF NOT EXISTS matrixos_goals (
|
|
187116
|
+
id TEXT PRIMARY KEY,
|
|
187117
|
+
title TEXT NOT NULL,
|
|
187118
|
+
description TEXT NOT NULL DEFAULT '',
|
|
187119
|
+
status TEXT NOT NULL DEFAULT 'active',
|
|
187120
|
+
created_at INTEGER NOT NULL,
|
|
187121
|
+
updated_at INTEGER NOT NULL
|
|
187122
|
+
)
|
|
187123
|
+
`);
|
|
187107
187124
|
}
|
|
187108
187125
|
function midnightMs() {
|
|
187109
187126
|
const d = new Date;
|
|
@@ -187507,6 +187524,125 @@ ${row.description ? `Description: ${row.description}
|
|
|
187507
187524
|
db.close();
|
|
187508
187525
|
}
|
|
187509
187526
|
},
|
|
187527
|
+
async getGoals() {
|
|
187528
|
+
const db = getDbWrite();
|
|
187529
|
+
if (!db)
|
|
187530
|
+
return [];
|
|
187531
|
+
try {
|
|
187532
|
+
ensureGoalsTable(db);
|
|
187533
|
+
const rows = db.query("SELECT id, title, description, status, created_at, updated_at FROM matrixos_goals ORDER BY updated_at DESC").all();
|
|
187534
|
+
const result = [];
|
|
187535
|
+
for (const row of rows) {
|
|
187536
|
+
const taskRows = db.query("SELECT COUNT(*) as count FROM matrixos_kanban WHERE goal_id = ?").get(row.id);
|
|
187537
|
+
result.push({
|
|
187538
|
+
id: row.id,
|
|
187539
|
+
title: row.title,
|
|
187540
|
+
description: row.description || "",
|
|
187541
|
+
status: row.status,
|
|
187542
|
+
taskCount: taskRows?.count ?? 0,
|
|
187543
|
+
createdAt: new Date(row.created_at).toISOString(),
|
|
187544
|
+
updatedAt: new Date(row.updated_at).toISOString()
|
|
187545
|
+
});
|
|
187546
|
+
}
|
|
187547
|
+
return result;
|
|
187548
|
+
} catch {
|
|
187549
|
+
return [];
|
|
187550
|
+
} finally {
|
|
187551
|
+
db.close();
|
|
187552
|
+
}
|
|
187553
|
+
},
|
|
187554
|
+
async createGoal(input) {
|
|
187555
|
+
const db = getDbWrite();
|
|
187556
|
+
if (!db)
|
|
187557
|
+
return { ok: false, error: "database unavailable" };
|
|
187558
|
+
try {
|
|
187559
|
+
ensureGoalsTable(db);
|
|
187560
|
+
const id = `goal_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
|
|
187561
|
+
const now = Date.now();
|
|
187562
|
+
db.query("INSERT INTO matrixos_goals (id, title, description, status, created_at, updated_at) VALUES (?, ?, ?, 'active', ?, ?)").run(id, input.title, input.description ?? "", now, now);
|
|
187563
|
+
return { ok: true, id };
|
|
187564
|
+
} catch (e) {
|
|
187565
|
+
return { ok: false, error: e instanceof Error ? e.message : String(e) };
|
|
187566
|
+
} finally {
|
|
187567
|
+
db.close();
|
|
187568
|
+
}
|
|
187569
|
+
},
|
|
187570
|
+
async decomposeGoal(id) {
|
|
187571
|
+
const db = getDbWrite();
|
|
187572
|
+
if (!db)
|
|
187573
|
+
return { ok: false, error: "database unavailable" };
|
|
187574
|
+
try {
|
|
187575
|
+
ensureGoalsTable(db);
|
|
187576
|
+
const row = db.query("SELECT title, description, status FROM matrixos_goals WHERE id = ?").get(id);
|
|
187577
|
+
if (!row)
|
|
187578
|
+
return { ok: false, error: "goal not found" };
|
|
187579
|
+
db.query("UPDATE matrixos_goals SET status = ?, updated_at = ? WHERE id = ?").run("decomposing", Date.now(), id);
|
|
187580
|
+
const brief = `Goal: ${row.title}
|
|
187581
|
+
${row.description ? `Description: ${row.description}
|
|
187582
|
+
` : ""}Decompose this goal into concrete Kanban tasks. Respond ONLY with a JSON array (no markdown, no prose) of objects: {"title": string, "description": string, "agent": string (one of morpheus/tank/oracle/link/ghost/the-analyst/the-keymaker/agent-smith/the-operator/neo/trinity/cypher/sentinel/mouse/dreamer/architect), "priority": "low"|"medium"|"high"|"urgent"}. Produce 2-6 tasks.`;
|
|
187583
|
+
const proc = Bun.spawn({
|
|
187584
|
+
cmd: ["matrixos", "run", "--agent", "morpheus", "--json", JSON.stringify(brief)],
|
|
187585
|
+
env: { ...process.env, PATH: `${process.env.PATH || ""}:/root/.bun/bin:/usr/bin` },
|
|
187586
|
+
stdout: "pipe",
|
|
187587
|
+
stderr: "pipe"
|
|
187588
|
+
});
|
|
187589
|
+
const result = await proc.exited;
|
|
187590
|
+
const decoder = new TextDecoder;
|
|
187591
|
+
const output = decoder.decode(await new Response(proc.stdout).arrayBuffer());
|
|
187592
|
+
const errOutput = decoder.decode(await new Response(proc.stderr).arrayBuffer());
|
|
187593
|
+
const combined = [output, errOutput].filter(Boolean).join(`
|
|
187594
|
+
`).slice(0, 4000);
|
|
187595
|
+
if (result !== 0) {
|
|
187596
|
+
db.query("UPDATE matrixos_goals SET status = ?, updated_at = ? WHERE id = ?").run("active", Date.now(), id);
|
|
187597
|
+
return { ok: false, error: "decomposition failed", output: combined, status: "active" };
|
|
187598
|
+
}
|
|
187599
|
+
const jsonMatch = combined.match(/\[[\s\S]*\]/);
|
|
187600
|
+
if (!jsonMatch) {
|
|
187601
|
+
db.query("UPDATE matrixos_goals SET status = ?, updated_at = ? WHERE id = ?").run("active", Date.now(), id);
|
|
187602
|
+
return { ok: false, error: "no task JSON in response", output: combined, status: "active" };
|
|
187603
|
+
}
|
|
187604
|
+
let tasks = [];
|
|
187605
|
+
try {
|
|
187606
|
+
tasks = JSON.parse(jsonMatch[0]);
|
|
187607
|
+
} catch {
|
|
187608
|
+
db.query("UPDATE matrixos_goals SET status = ?, updated_at = ? WHERE id = ?").run("active", Date.now(), id);
|
|
187609
|
+
return { ok: false, error: "invalid task JSON", output: combined, status: "active" };
|
|
187610
|
+
}
|
|
187611
|
+
let created = 0;
|
|
187612
|
+
for (const t2 of tasks) {
|
|
187613
|
+
if (!t2.title)
|
|
187614
|
+
continue;
|
|
187615
|
+
const tid = `kb_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
|
|
187616
|
+
const now = Date.now();
|
|
187617
|
+
db.query("INSERT INTO matrixos_kanban (id, title, description, agent, status, priority, goal_id, created_at, updated_at) VALUES (?, ?, ?, ?, 'pending', ?, ?, ?, ?)").run(tid, t2.title, t2.description ?? "", t2.agent ?? "Morpheus", t2.priority ?? "medium", id, now, now);
|
|
187618
|
+
created++;
|
|
187619
|
+
}
|
|
187620
|
+
db.query("UPDATE matrixos_goals SET status = ?, updated_at = ? WHERE id = ?").run("completed", Date.now(), id);
|
|
187621
|
+
return { ok: true, tasks: created, output: combined, status: "completed" };
|
|
187622
|
+
} catch (e) {
|
|
187623
|
+
try {
|
|
187624
|
+
db.query("UPDATE matrixos_goals SET status = ?, updated_at = ? WHERE id = ?").run("active", Date.now(), id);
|
|
187625
|
+
} catch {}
|
|
187626
|
+
return { ok: false, error: e instanceof Error ? e.message : String(e), status: "active" };
|
|
187627
|
+
} finally {
|
|
187628
|
+
db.close();
|
|
187629
|
+
}
|
|
187630
|
+
},
|
|
187631
|
+
async deleteGoal(id) {
|
|
187632
|
+
const db = getDbWrite();
|
|
187633
|
+
if (!db)
|
|
187634
|
+
return { ok: false, error: "database unavailable" };
|
|
187635
|
+
try {
|
|
187636
|
+
ensureGoalsTable(db);
|
|
187637
|
+
db.query("DELETE FROM matrixos_kanban WHERE goal_id = ?").run(id);
|
|
187638
|
+
db.query("DELETE FROM matrixos_goals WHERE id = ?").run(id);
|
|
187639
|
+
return { ok: true };
|
|
187640
|
+
} catch (e) {
|
|
187641
|
+
return { ok: false, error: e instanceof Error ? e.message : String(e) };
|
|
187642
|
+
} finally {
|
|
187643
|
+
db.close();
|
|
187644
|
+
}
|
|
187645
|
+
},
|
|
187510
187646
|
async getIncidents(limit = 50) {
|
|
187511
187647
|
const lines = readJsonl("anti-loop.jsonl");
|
|
187512
187648
|
if (lines.length === 0) {
|
|
@@ -187859,6 +187995,36 @@ function createDashboardServer(dataProvider, config5) {
|
|
|
187859
187995
|
const result = await dataProvider.executeKanbanTask(body.id);
|
|
187860
187996
|
return Response.json(result, { status: result.ok ? 200 : 500, headers: jsonHeaders });
|
|
187861
187997
|
}
|
|
187998
|
+
case "/api/goals": {
|
|
187999
|
+
if (req.method === "POST") {
|
|
188000
|
+
const body = await req.json();
|
|
188001
|
+
if (!body.title || !body.title.trim()) {
|
|
188002
|
+
return Response.json({ ok: false, error: "title required" }, { status: 400, headers: jsonHeaders });
|
|
188003
|
+
}
|
|
188004
|
+
const result = await dataProvider.createGoal(body);
|
|
188005
|
+
return Response.json(result, { status: result.ok ? 201 : 500, headers: jsonHeaders });
|
|
188006
|
+
}
|
|
188007
|
+
if (req.method === "DELETE") {
|
|
188008
|
+
const id = url3.searchParams.get("id");
|
|
188009
|
+
if (!id) {
|
|
188010
|
+
return Response.json({ ok: false, error: "id required" }, { status: 400, headers: jsonHeaders });
|
|
188011
|
+
}
|
|
188012
|
+
const result = await dataProvider.deleteGoal(id);
|
|
188013
|
+
return Response.json(result, { status: result.ok ? 200 : 500, headers: jsonHeaders });
|
|
188014
|
+
}
|
|
188015
|
+
return Response.json(await dataProvider.getGoals(), { headers: jsonHeaders });
|
|
188016
|
+
}
|
|
188017
|
+
case "/api/goals/decompose": {
|
|
188018
|
+
if (req.method !== "POST") {
|
|
188019
|
+
return new Response("Method Not Allowed", { status: 405, headers: corsHeaders });
|
|
188020
|
+
}
|
|
188021
|
+
const body = await req.json();
|
|
188022
|
+
if (!body.id) {
|
|
188023
|
+
return Response.json({ ok: false, error: "id required" }, { status: 400, headers: jsonHeaders });
|
|
188024
|
+
}
|
|
188025
|
+
const result = await dataProvider.decomposeGoal(body.id);
|
|
188026
|
+
return Response.json(result, { status: result.ok ? 200 : 500, headers: jsonHeaders });
|
|
188027
|
+
}
|
|
187862
188028
|
case "/api/incidents": {
|
|
187863
188029
|
const limit = parseInt(url3.searchParams.get("limit") ?? "50", 10);
|
|
187864
188030
|
return Response.json(await dataProvider.getIncidents(limit), { headers: jsonHeaders });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentStatus, SessionSummary, CostSummary, KanbanBoard, IncidentEntry, HealthResponse, MetricsSnapshot } from "./types";
|
|
1
|
+
import type { AgentStatus, SessionSummary, CostSummary, KanbanBoard, Goal, IncidentEntry, HealthResponse, MetricsSnapshot } from "./types";
|
|
2
2
|
export interface DataProviderConfig {
|
|
3
3
|
matrixosHome: string;
|
|
4
4
|
}
|
|
@@ -44,6 +44,26 @@ export interface DataProvider {
|
|
|
44
44
|
ok: boolean;
|
|
45
45
|
error?: string;
|
|
46
46
|
}>;
|
|
47
|
+
getGoals(): Promise<Goal[]>;
|
|
48
|
+
createGoal(input: {
|
|
49
|
+
title: string;
|
|
50
|
+
description?: string;
|
|
51
|
+
}): Promise<{
|
|
52
|
+
ok: boolean;
|
|
53
|
+
id?: string;
|
|
54
|
+
error?: string;
|
|
55
|
+
}>;
|
|
56
|
+
decomposeGoal(id: string): Promise<{
|
|
57
|
+
ok: boolean;
|
|
58
|
+
error?: string;
|
|
59
|
+
tasks?: number;
|
|
60
|
+
output?: string;
|
|
61
|
+
status?: string;
|
|
62
|
+
}>;
|
|
63
|
+
deleteGoal(id: string): Promise<{
|
|
64
|
+
ok: boolean;
|
|
65
|
+
error?: string;
|
|
66
|
+
}>;
|
|
47
67
|
getIncidents(limit?: number): Promise<IncidentEntry[]>;
|
|
48
68
|
getMetrics(range?: string): Promise<MetricsSnapshot[]>;
|
|
49
69
|
getLogs(): LogEntry[];
|
|
@@ -252,6 +252,153 @@ body{font-family:var(--font-body);font-size:var(--text-base);color:var(--text-pr
|
|
|
252
252
|
.kanban-card-output{background:var(--bg-secondary);border:1px solid var(--border-default);border-radius:var(--radius-sm);padding:8px;margin-top:6px;font-size:var(--text-xs);color:var(--text-secondary);white-space:pre-wrap;max-height:200px;overflow:auto}
|
|
253
253
|
.modal-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:8px}
|
|
254
254
|
|
|
255
|
+
/* GOALS */
|
|
256
|
+
.goals-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(320px,1fr));gap:var(--space-3)}
|
|
257
|
+
.goal-card{background:var(--bg-card);border:1px solid var(--border-default);border-radius:var(--radius-xl);padding:var(--space-4);transition:all .15s;display:flex;flex-direction:column;gap:var(--space-3)}
|
|
258
|
+
.goal-card:hover{border-color:var(--bg-elevated)}
|
|
259
|
+
.goal-header{display:flex;justify-content:space-between;align-items:flex-start;gap:var(--space-3)}
|
|
260
|
+
.goal-title{font-size:var(--text-sm);font-weight:600;color:var(--text-primary)}
|
|
261
|
+
.goal-desc{font-size:var(--text-xs);color:var(--text-secondary);margin-top:var(--space-1);line-height:1.5;max-height:80px;overflow:hidden}
|
|
262
|
+
.goal-footer{display:flex;justify-content:space-between;align-items:center;margin-top:auto;font-size:var(--text-xs);color:var(--text-tertiary)}
|
|
263
|
+
.goal-actions{display:flex;gap:var(--space-2)}
|
|
264
|
+
|
|
265
|
+
/* GOALS */
|
|
266
|
+
.goals-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(320px,1fr));gap:var(--space-3)}
|
|
267
|
+
.goal-card{background:var(--bg-card);border:1px solid var(--border-default);border-radius:var(--radius-xl);padding:var(--space-4);display:flex;flex-direction:column;gap:var(--space-3);transition:all .15s}
|
|
268
|
+
.goal-card:hover{border-color:var(--bg-elevated)}
|
|
269
|
+
.goal-header{display:flex;justify-content:space-between;align-items:flex-start;gap:var(--space-3)}
|
|
270
|
+
.goal-title{font-size:var(--text-sm);font-weight:600;color:var(--text-primary)}
|
|
271
|
+
.goal-desc{font-size:var(--text-xs);color:var(--text-secondary);margin-top:var(--space-1);line-height:1.4}
|
|
272
|
+
.goal-footer{display:flex;justify-content:space-between;align-items:center;font-size:var(--text-xs);color:var(--text-tertiary);margin-top:auto}
|
|
273
|
+
.goal-actions{display:flex;gap:var(--space-2)}
|
|
274
|
+
|
|
275
|
+
/* GOALS */
|
|
276
|
+
.goals-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(360px,1fr));gap:var(--space-4)}
|
|
277
|
+
.goal-card{background:var(--bg-card);border:1px solid var(--border-default);border-radius:var(--radius-xl);padding:var(--space-4);display:flex;flex-direction:column;gap:var(--space-3);transition:all .15s}
|
|
278
|
+
.goal-card:hover{border-color:var(--bg-elevated)}
|
|
279
|
+
.goal-header{display:flex;justify-content:space-between;align-items:flex-start;gap:var(--space-3)}
|
|
280
|
+
.goal-title{font-size:var(--text-sm);font-weight:600;color:var(--text-primary)}
|
|
281
|
+
.goal-desc{font-size:var(--text-xs);color:var(--text-secondary);margin-top:var(--space-1);line-height:1.5}
|
|
282
|
+
.goal-footer{display:flex;justify-content:space-between;align-items:center;font-size:var(--text-xs);color:var(--text-tertiary)}
|
|
283
|
+
.goal-actions{display:flex;gap:var(--space-2)}
|
|
284
|
+
#tab-goals .form-row{display:flex;flex-direction:row;gap:var(--space-2);align-items:center;margin-bottom:var(--space-3)}
|
|
285
|
+
#tab-goals textarea.input{margin-top:var(--space-2)}
|
|
286
|
+
|
|
287
|
+
/* GOALS */
|
|
288
|
+
.goals-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(360px,1fr));gap:var(--space-3)}
|
|
289
|
+
.goal-card{background:var(--bg-card);border:1px solid var(--border-default);border-radius:var(--radius-xl);padding:var(--space-4);display:flex;flex-direction:column;gap:var(--space-3);transition:all .15s}
|
|
290
|
+
.goal-card:hover{border-color:var(--bg-elevated)}
|
|
291
|
+
.goal-header{display:flex;justify-content:space-between;align-items:flex-start;gap:var(--space-3)}
|
|
292
|
+
.goal-title{font-size:var(--text-sm);font-weight:600;color:var(--text-primary)}
|
|
293
|
+
.goal-desc{font-size:var(--text-xs);color:var(--text-secondary);margin-top:var(--space-1);line-height:1.5}
|
|
294
|
+
.goal-footer{display:flex;justify-content:space-between;align-items:center;margin-top:auto;font-size:var(--text-xs);color:var(--text-tertiary)}
|
|
295
|
+
.goal-actions{display:flex;gap:var(--space-2)}
|
|
296
|
+
|
|
297
|
+
/* GOALS */
|
|
298
|
+
.goals-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(360px,1fr));gap:var(--space-3)}
|
|
299
|
+
.goal-card{background:var(--bg-card);border:1px solid var(--border-default);border-radius:var(--radius-xl);padding:var(--space-4);display:flex;flex-direction:column;gap:var(--space-3);transition:all .15s}
|
|
300
|
+
.goal-card:hover{border-color:var(--bg-elevated)}
|
|
301
|
+
.goal-header{display:flex;justify-content:space-between;align-items:flex-start;gap:var(--space-3)}
|
|
302
|
+
.goal-title{font-size:var(--text-sm);font-weight:600;color:var(--text-primary)}
|
|
303
|
+
.goal-desc{font-size:var(--text-xs);color:var(--text-secondary);margin-top:var(--space-1);line-height:1.4}
|
|
304
|
+
.goal-footer{display:flex;justify-content:space-between;align-items:center;font-size:var(--text-xs);color:var(--text-tertiary)}
|
|
305
|
+
.goal-actions{display:flex;gap:var(--space-2)}
|
|
306
|
+
|
|
307
|
+
/* GOALS */
|
|
308
|
+
.goals-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(320px,1fr));gap:var(--space-3)}
|
|
309
|
+
.goal-card{background:var(--bg-card);border:1px solid var(--border-default);border-radius:var(--radius-xl);padding:var(--space-4);display:flex;flex-direction:column;gap:var(--space-3)}
|
|
310
|
+
.goal-card:hover{border-color:var(--bg-elevated)}
|
|
311
|
+
.goal-header{display:flex;justify-content:space-between;align-items:flex-start;gap:var(--space-3)}
|
|
312
|
+
.goal-title{font-size:var(--text-base);font-weight:600;color:var(--text-primary)}
|
|
313
|
+
.goal-desc{font-size:var(--text-xs);color:var(--text-secondary);margin-top:4px;line-height:1.5;max-height:80px;overflow:hidden}
|
|
314
|
+
.goal-footer{display:flex;justify-content:space-between;align-items:center;font-size:var(--text-xs);color:var(--text-tertiary);margin-top:auto}
|
|
315
|
+
.goal-actions{display:flex;gap:var(--space-2)}
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
@media(max-width:1024px){.kpi-grid,.grid-2{grid-template-columns:repeat(2,1fr)}.kanban-board{grid-template-columns:repeat(2,1fr)}.gauge-grid{grid-template-columns:repeat(2,1fr)}}
|
|
319
|
+
.goal-card{background:var(--bg-card);border:1px solid var(--border-default);border-radius:var(--radius-xl);padding:var(--space-4);transition:all .15s;display:flex;flex-direction:column;gap:var(--space-3)}
|
|
320
|
+
.goal-card:hover{border-color:var(--bg-elevated)}
|
|
321
|
+
.goal-header{display:flex;justify-content:space-between;align-items:flex-start;gap:var(--space-3)}
|
|
322
|
+
.goal-title{font-size:var(--text-sm);font-weight:600;color:var(--text-primary)}
|
|
323
|
+
.goal-desc{font-size:var(--text-xs);color:var(--text-secondary);margin-top:var(--space-1);line-height:1.4}
|
|
324
|
+
.goal-footer{display:flex;justify-content:space-between;align-items:center;margin-top:auto;font-size:var(--text-xs);color:var(--text-tertiary)}
|
|
325
|
+
.goal-actions{display:flex;gap:var(--space-2)}
|
|
326
|
+
|
|
327
|
+
@media(max-width:1024px){.kpi-grid,.grid-2{grid-template-columns:repeat(2,1fr)}.kanban-board{grid-template-columns:repeat(2,1fr)}.gauge-grid{grid-template-columns:repeat(2,1fr)}}
|
|
328
|
+
.goal-card{background:var(--bg-card);border:1px solid var(--border-default);border-radius:var(--radius-xl);padding:var(--space-4);transition:all .15s}
|
|
329
|
+
.goal-card:hover{border-color:var(--bg-elevated)}
|
|
330
|
+
.goal-header{display:flex;justify-content:space-between;align-items:flex-start;gap:var(--space-3);margin-bottom:var(--space-3)}
|
|
331
|
+
.goal-title{font-size:var(--text-sm);font-weight:600;color:var(--text-primary)}
|
|
332
|
+
.goal-desc{font-size:var(--text-xs);color:var(--text-secondary);margin-top:4px;line-height:1.4;max-height:80px;overflow:hidden}
|
|
333
|
+
.goal-footer{display:flex;justify-content:space-between;align-items:center;font-size:var(--text-xs);color:var(--text-tertiary)}
|
|
334
|
+
.goal-actions{display:flex;gap:var(--space-2)}
|
|
335
|
+
.goal-card{background:var(--bg-card);border:1px solid var(--border-default);border-radius:var(--radius-xl);padding:var(--space-4);display:flex;flex-direction:column;gap:var(--space-3);transition:all .15s}
|
|
336
|
+
.goal-card:hover{border-color:var(--bg-elevated)}
|
|
337
|
+
.goal-header{display:flex;justify-content:space-between;align-items:flex-start;gap:var(--space-3)}
|
|
338
|
+
.goal-title{font-size:var(--text-sm);font-weight:600;color:var(--text-primary);margin-bottom:var(--space-1)}
|
|
339
|
+
.goal-desc{font-size:var(--text-xs);color:var(--text-secondary);line-height:1.5;max-height:80px;overflow:hidden}
|
|
340
|
+
.goal-footer{display:flex;justify-content:space-between;align-items:center;font-size:var(--text-xs);color:var(--text-tertiary);margin-top:auto}
|
|
341
|
+
.goal-actions{display:flex;gap:var(--space-2)}
|
|
342
|
+
/* GOALS */
|
|
343
|
+
.goals-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(320px,1fr));gap:var(--space-3)}
|
|
344
|
+
.goal-card{background:var(--bg-card);border:1px solid var(--border-default);border-radius:var(--radius-xl);padding:var(--space-4);display:flex;flex-direction:column;gap:var(--space-3);transition:all .15s}
|
|
345
|
+
.goal-card:hover{border-color:var(--bg-elevated)}
|
|
346
|
+
.goal-header{display:flex;justify-content:space-between;align-items:flex-start;gap:var(--space-3)}
|
|
347
|
+
.goal-title{font-size:var(--text-sm);font-weight:600;color:var(--text-primary)}
|
|
348
|
+
.goal-desc{font-size:var(--text-xs);color:var(--text-secondary);margin-top:4px;line-height:1.4;max-height:80px;overflow:hidden}
|
|
349
|
+
.goal-footer{display:flex;justify-content:space-between;align-items:center;font-size:var(--text-xs);color:var(--text-tertiary)}
|
|
350
|
+
.goal-actions{display:flex;gap:var(--space-2)}
|
|
351
|
+
|
|
352
|
+
@media(max-width:1024px){.kpi-grid,.grid-2{grid-template-columns:repeat(2,1fr)}.kanban-board{grid-template-columns:repeat(2,1fr)}.gauge-grid{grid-template-columns:repeat(2,1fr)}.goals-grid{grid-template-columns:repeat(2,1fr)}}
|
|
353
|
+
.goals-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(340px,1fr));gap:var(--space-3)}
|
|
354
|
+
.goal-card{background:var(--bg-card);border:1px solid var(--border-default);border-radius:var(--radius-xl);padding:var(--space-4);display:flex;flex-direction:column;gap:var(--space-3);transition:all .15s}
|
|
355
|
+
.goal-card:hover{border-color:var(--bg-elevated)}
|
|
356
|
+
.goal-header{display:flex;justify-content:space-between;align-items:flex-start;gap:var(--space-3)}
|
|
357
|
+
.goal-title{font-size:var(--text-base);font-weight:600;color:var(--text-primary);margin-bottom:var(--space-1)}
|
|
358
|
+
.goal-desc{font-size:var(--text-xs);color:var(--text-secondary);line-height:1.5;max-height:80px;overflow:hidden}
|
|
359
|
+
.goal-footer{display:flex;justify-content:space-between;align-items:center;font-size:var(--text-xs);color:var(--text-tertiary)}
|
|
360
|
+
.goal-actions{display:flex;gap:var(--space-2)}
|
|
361
|
+
|
|
362
|
+
/* GOALS */
|
|
363
|
+
.goals-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(360px,1fr));gap:var(--space-3)}
|
|
364
|
+
.goal-card{background:var(--bg-card);border:1px solid var(--border-default);border-radius:var(--radius-xl);padding:var(--space-4);display:flex;flex-direction:column;gap:var(--space-3);transition:all .15s}
|
|
365
|
+
.goal-card:hover{border-color:var(--bg-elevated)}
|
|
366
|
+
.goal-header{display:flex;justify-content:space-between;align-items:flex-start;gap:var(--space-3)}
|
|
367
|
+
.goal-title{font-size:var(--text-base);font-weight:600;color:var(--text-primary)}
|
|
368
|
+
.goal-desc{font-size:var(--text-xs);color:var(--text-secondary);margin-top:var(--space-1);line-height:1.5;max-height:60px;overflow:hidden}
|
|
369
|
+
.goal-footer{display:flex;justify-content:space-between;align-items:center;margin-top:auto;font-size:var(--text-xs);color:var(--text-tertiary)}
|
|
370
|
+
.goal-actions{display:flex;gap:var(--space-2)}
|
|
371
|
+
|
|
372
|
+
/* GOALS */
|
|
373
|
+
.goals-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(320px,1fr));gap:var(--space-3)}
|
|
374
|
+
.goal-card{background:var(--bg-card);border:1px solid var(--border-default);border-radius:var(--radius-xl);padding:var(--space-4);transition:all .15s}
|
|
375
|
+
.goal-card:hover{border-color:var(--bg-elevated)}
|
|
376
|
+
.goal-header{display:flex;justify-content:space-between;align-items:flex-start;gap:var(--space-3);margin-bottom:var(--space-3)}
|
|
377
|
+
.goal-title{font-size:var(--text-sm);font-weight:600;color:var(--text-primary)}
|
|
378
|
+
.goal-desc{font-size:var(--text-xs);color:var(--text-secondary);margin-top:var(--space-1);line-height:1.5;max-height:80px;overflow:hidden}
|
|
379
|
+
.goal-footer{display:flex;justify-content:space-between;align-items:center;font-size:var(--text-xs);color:var(--text-tertiary)}
|
|
380
|
+
.goal-actions{display:flex;gap:var(--space-2)}
|
|
381
|
+
|
|
382
|
+
/* GOALS */
|
|
383
|
+
.goals-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(320px,1fr));gap:var(--space-3)}
|
|
384
|
+
.goal-card{background:var(--bg-card);border:1px solid var(--border-default);border-radius:var(--radius-xl);padding:var(--space-4);display:flex;flex-direction:column;gap:var(--space-3);transition:all .15s}
|
|
385
|
+
.goal-card:hover{border-color:var(--bg-elevated)}
|
|
386
|
+
.goal-header{display:flex;justify-content:space-between;align-items:flex-start;gap:var(--space-3)}
|
|
387
|
+
.goal-title{font-size:var(--text-sm);font-weight:600;color:var(--text-primary)}
|
|
388
|
+
.goal-desc{font-size:var(--text-xs);color:var(--text-secondary);margin-top:4px;line-height:1.5}
|
|
389
|
+
.goal-footer{display:flex;justify-content:space-between;align-items:center;font-size:var(--text-xs);color:var(--text-tertiary)}
|
|
390
|
+
.modal-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:8px}
|
|
391
|
+
|
|
392
|
+
/* GOALS */
|
|
393
|
+
.goals-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(320px,1fr));gap:var(--space-3)}
|
|
394
|
+
.goal-card{background:var(--bg-card);border:1px solid var(--border-default);border-radius:var(--radius-xl);padding:var(--space-4);display:flex;flex-direction:column;gap:var(--space-3);transition:all .15s}
|
|
395
|
+
.goal-card:hover{border-color:var(--bg-elevated)}
|
|
396
|
+
.goal-header{display:flex;justify-content:space-between;align-items:flex-start;gap:var(--space-3)}
|
|
397
|
+
.goal-title{font-size:var(--text-sm);font-weight:600;color:var(--text-primary)}
|
|
398
|
+
.goal-desc{font-size:var(--text-xs);color:var(--text-secondary);margin-top:var(--space-1);line-height:1.4;max-height:80px;overflow:hidden}
|
|
399
|
+
.goal-footer{display:flex;justify-content:space-between;align-items:center;font-size:var(--text-xs);color:var(--text-tertiary);margin-top:auto}
|
|
400
|
+
.goal-actions{display:flex;gap:var(--space-2)}
|
|
401
|
+
.goal-actions .btn{padding:var(--space-1) var(--space-3);font-size:var(--text-xs)}
|
|
255
402
|
|
|
256
403
|
@media(max-width:1024px){.kpi-grid,.grid-2{grid-template-columns:repeat(2,1fr)}.kanban-board{grid-template-columns:repeat(2,1fr)}.gauge-grid{grid-template-columns:repeat(2,1fr)}}
|
|
257
|
-
@media(max-width:768px){.kpi-grid,.grid-2{grid-template-columns:1fr}.kanban-board{grid-template-columns:1fr}.agent-grid{grid-template-columns:1fr}}
|
|
404
|
+
@media(max-width:768px){.kpi-grid,.grid-2{grid-template-columns:1fr}.kanban-board{grid-template-columns:1fr}.agent-grid{grid-template-columns:1fr}.goals-grid{grid-template-columns:1fr}}
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
<button class="header-tab" data-tab="health"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M1 7h3l2-4 2 8 2-4h3"/></svg>Health</button>
|
|
44
44
|
<button class="header-tab" data-tab="cost"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M7 1v12M4.5 3.5C4.5 3.5 5 3 7 3s3 .5 3 1.5-1 1.5-3 1.5-3 .5-3 1.5 1 1.5 3 1.5 3-.5 3-1.5"/></svg>Cost</button>
|
|
45
45
|
<button class="header-tab" data-tab="kanban"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><rect x="1" y="1" width="3.5" height="12" rx="0.75"/><rect x="5.5" y="1" width="3.5" height="8" rx="0.75"/><rect x="10" y="1" width="3.5" height="10" rx="0.75"/></svg>Kanban</button>
|
|
46
|
+
<button class="header-tab" data-tab="goals"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="7" cy="7" r="5.5"/><path d="M7 4v3l2 2"/></svg>Goals</button>
|
|
46
47
|
<button class="header-tab" data-tab="logs"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M2 4h10M2 7h10M2 10h7"/></svg>Logs</button>
|
|
47
48
|
<button class="header-tab" data-tab="memory"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><rect x="2" y="3" width="10" height="9" rx="1"/><path d="M2 6h10"/><circle cx="7" cy="9" r="1.5"/></svg>Memory</button>
|
|
48
49
|
<button class="header-tab" data-tab="skills"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="7" cy="5" r="3"/><path d="M3 12c0-2.5 2-4 4-4s4 1.5 4 4"/></svg>Skills</button>
|
|
@@ -109,10 +110,31 @@
|
|
|
109
110
|
<div id="tab-kanban" class="tab-panel">
|
|
110
111
|
<div class="page-header">
|
|
111
112
|
<div><h1 class="page-title">Kanban Board</h1><p class="page-subtitle">Task tracking across all agents</p></div>
|
|
113
|
+
<div class="page-actions"><button class="btn btn-secondary" id="newKanbanBtn"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M7 1v12M1 7h12"/></svg>New Task</button></div>
|
|
112
114
|
</div>
|
|
113
115
|
<div class="kanban-board" id="kanbanBoard"></div>
|
|
114
116
|
</div>
|
|
115
117
|
|
|
118
|
+
<div id="tab-goals" class="tab-panel">
|
|
119
|
+
<div class="page-header">
|
|
120
|
+
<div><h1 class="page-title">Goals</h1><p class="page-subtitle">Define objectives and decompose them into Kanban tasks</p></div>
|
|
121
|
+
</div>
|
|
122
|
+
<div class="card">
|
|
123
|
+
<div class="card-header"><span class="card-title">New Goal</span></div>
|
|
124
|
+
<div class="card-body">
|
|
125
|
+
<div class="form-row">
|
|
126
|
+
<input id="goalTitle" class="input" type="text" placeholder="Goal title" style="flex:1" />
|
|
127
|
+
<button class="btn btn-secondary" id="createGoalBtn"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M7 1v12M1 7h12"/></svg>Create</button>
|
|
128
|
+
</div>
|
|
129
|
+
<textarea id="goalDesc" class="input" rows="3" placeholder="Description (optional)"></textarea>
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
<div class="section">
|
|
133
|
+
<div class="section-header"><div><h2 class="section-title">Active Goals</h2><p class="section-subtitle">Click ▶ to decompose into Kanban tasks</p></div><button class="btn btn-ghost" id="refreshGoalsBtn">Refresh</button></div>
|
|
134
|
+
<div class="goals-grid" id="goalsGrid"></div>
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
|
|
116
138
|
<div id="tab-logs" class="tab-panel">
|
|
117
139
|
<div class="page-header">
|
|
118
140
|
<div><h1 class="page-title">Live Logs</h1><p class="page-subtitle">Real-time event stream from MaTrixOS agents and services</p></div>
|
|
@@ -9,6 +9,10 @@ const API={
|
|
|
9
9
|
kanbanUpdate:(body)=>fetchJSON('/kanban/task',{method:'PUT',headers:{'Content-Type':'application/json'},body:JSON.stringify(body)}),
|
|
10
10
|
kanbanDelete:(id)=>fetchJSON(`/kanban/task?id=${encodeURIComponent(id)}`,{method:'DELETE'}),
|
|
11
11
|
kanbanExecute:(id)=>fetchJSON('/kanban/execute',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({id})}),
|
|
12
|
+
goals:()=>fetchJSON('/goals'),
|
|
13
|
+
goalCreate:(body)=>fetchJSON('/goals',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(body)}),
|
|
14
|
+
goalDelete:(id)=>fetchJSON(`/goals?id=${encodeURIComponent(id)}`,{method:'DELETE'}),
|
|
15
|
+
goalDecompose:(id)=>fetchJSON('/goals/decompose',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({id})}),
|
|
12
16
|
metrics:()=>fetchJSON('/metrics'),
|
|
13
17
|
config:()=>fetchJSON('/config'),
|
|
14
18
|
memory:()=>fetchJSON('/memory'),
|
|
@@ -6,7 +6,7 @@ document.querySelectorAll('[data-tab]').forEach(el=>{
|
|
|
6
6
|
el.addEventListener('click',e=>{
|
|
7
7
|
e.preventDefault()
|
|
8
8
|
const tab=el.dataset.tab
|
|
9
|
-
if(!tab||!['architect','health','cost','kanban','agents','sessions','logs','config','memory','skills','schedule'].includes(tab))return
|
|
9
|
+
if(!tab||!['architect','health','cost','kanban','goals','agents','sessions','logs','config','memory','skills','schedule'].includes(tab))return
|
|
10
10
|
const realTab=tab==='agents'||tab==='sessions'?'architect':tab
|
|
11
11
|
document.querySelectorAll('.sidebar-item.active,.header-tab.active,.tab-panel.active').forEach(n=>n.classList.remove('active'))
|
|
12
12
|
document.querySelectorAll(`.sidebar-item[data-tab="${tab}"],.header-tab[data-tab="${realTab}"]`).forEach(n=>n.classList.add('active'))
|
|
@@ -16,7 +16,7 @@ document.querySelectorAll('[data-tab]').forEach(el=>{
|
|
|
16
16
|
})
|
|
17
17
|
|
|
18
18
|
// Tab loading dispatch
|
|
19
|
-
function loadTab(tab){const f={architect:loadArchitect,health:loadHealth,cost:loadCost,kanban:loadKanban,logs:loadLogs,config:loadConfig,memory:loadMemory,skills:loadSkills,schedule:loadSchedule}[tab];f&&f()}
|
|
19
|
+
function loadTab(tab){const f={architect:loadArchitect,health:loadHealth,cost:loadCost,kanban:loadKanban,goals:loadGoals,logs:loadLogs,config:loadConfig,memory:loadMemory,skills:loadSkills,schedule:loadSchedule}[tab];f&&f()}
|
|
20
20
|
|
|
21
21
|
// Skeleton helpers
|
|
22
22
|
function showSkeleton(container,type,count=4){
|
|
@@ -360,6 +360,75 @@ function toggleKanbanOutput(e,id){
|
|
|
360
360
|
e.target.textContent=show?'Masquer résultat':'Voir résultat'
|
|
361
361
|
}
|
|
362
362
|
|
|
363
|
+
// ===== GOALS =====
|
|
364
|
+
let goalsData=[]
|
|
365
|
+
async function loadGoals(){
|
|
366
|
+
const grid=document.getElementById('goalsGrid')
|
|
367
|
+
grid.innerHTML='<div style="padding:20px;color:var(--text-tertiary)">Loading...</div>'
|
|
368
|
+
try{
|
|
369
|
+
goalsData=await API.goals()
|
|
370
|
+
renderGoals()
|
|
371
|
+
}catch(e){grid.innerHTML=`<div class="error"><p>Failed to load goals: ${e.message}</p></div>`}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
function renderGoals(){
|
|
375
|
+
const grid=document.getElementById('goalsGrid')
|
|
376
|
+
if(!goalsData||!goalsData.length){showEmpty(grid,'No goals yet. Create one above.');return}
|
|
377
|
+
grid.innerHTML=goalsData.map(g=>{
|
|
378
|
+
const statusCls=g.status==='decomposing'?'warning':g.status==='completed'?'success':g.status==='archived'?'info':'info'
|
|
379
|
+
const btn=g.status==='decomposing'?`<button class="btn btn-ghost" disabled>Decomposing...</button>`:`<button class="btn btn-secondary" onclick="decomposeGoal('${g.id}')">▶ Decompose</button>`
|
|
380
|
+
return `<div class="goal-card">
|
|
381
|
+
<div class="goal-header">
|
|
382
|
+
<div>
|
|
383
|
+
<div class="goal-title">${escapeHtml(g.title)}</div>
|
|
384
|
+
${g.description?`<div class="goal-desc">${escapeHtml(g.description)}</div>`:''}
|
|
385
|
+
</div>
|
|
386
|
+
<span class="badge badge-${statusCls}">${g.status}</span>
|
|
387
|
+
</div>
|
|
388
|
+
<div class="goal-footer">
|
|
389
|
+
<span>${g.taskCount} task${g.taskCount===1?'':'s'}</span>
|
|
390
|
+
<div class="goal-actions">
|
|
391
|
+
${btn}
|
|
392
|
+
<button class="btn btn-ghost" onclick="deleteGoal('${g.id}')">Delete</button>
|
|
393
|
+
</div>
|
|
394
|
+
</div>
|
|
395
|
+
</div>`
|
|
396
|
+
}).join('')
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
async function createGoal(){
|
|
400
|
+
const title=document.getElementById('goalTitle').value.trim()
|
|
401
|
+
const description=document.getElementById('goalDesc').value.trim()
|
|
402
|
+
if(!title){alert('Title required');return}
|
|
403
|
+
const btn=document.getElementById('createGoalBtn')
|
|
404
|
+
btn.disabled=true
|
|
405
|
+
try{
|
|
406
|
+
await API.goalCreate({title,description})
|
|
407
|
+
document.getElementById('goalTitle').value=''
|
|
408
|
+
document.getElementById('goalDesc').value=''
|
|
409
|
+
await loadGoals()
|
|
410
|
+
}catch(e){alert('Erreur: '+e.message)}
|
|
411
|
+
finally{btn.disabled=false}
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
async function decomposeGoal(id){
|
|
415
|
+
const g=goalsData.find(x=>x.id===id)
|
|
416
|
+
if(!g||g.status==='decomposing')return
|
|
417
|
+
if(!confirm(`Décomposer "${g.title}" en tâches Kanban ?`))return
|
|
418
|
+
try{
|
|
419
|
+
await API.goalDecompose(id)
|
|
420
|
+
await Promise.all([loadGoals(),loadKanban()])
|
|
421
|
+
}catch(e){alert('Erreur: '+e.message)}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
async function deleteGoal(id){
|
|
425
|
+
if(!confirm('Delete this goal and its linked Kanban tasks?'))return
|
|
426
|
+
try{
|
|
427
|
+
await API.goalDelete(id)
|
|
428
|
+
await Promise.all([loadGoals(),loadKanban()])
|
|
429
|
+
}catch(e){alert('Erreur: '+e.message)}
|
|
430
|
+
}
|
|
431
|
+
|
|
363
432
|
// ===== LOGS =====
|
|
364
433
|
let logStream=null
|
|
365
434
|
async function loadLogs(){
|
|
@@ -583,6 +652,12 @@ document.getElementById('archRefresh').onclick=()=>loadArchitect()
|
|
|
583
652
|
document.getElementById('deployBtn').onclick=()=>alert('Deploy Agent — coming soon')
|
|
584
653
|
document.getElementById('diagBtn').onclick=()=>alert('Diagnostics — coming soon')
|
|
585
654
|
document.getElementById('notifBtn').onclick=()=>alert('3 notifications pending')
|
|
655
|
+
const createGoalBtn=document.getElementById('createGoalBtn')
|
|
656
|
+
if(createGoalBtn)createGoalBtn.onclick=createGoal
|
|
657
|
+
const refreshGoalsBtn=document.getElementById('refreshGoalsBtn')
|
|
658
|
+
if(refreshGoalsBtn)refreshGoalsBtn.onclick=loadGoals
|
|
659
|
+
const newKanbanBtn=document.getElementById('newKanbanBtn')
|
|
660
|
+
if(newKanbanBtn)newKanbanBtn.onclick=()=>openKanbanModal()
|
|
586
661
|
|
|
587
662
|
loadTab('architect')
|
|
588
663
|
setInterval(()=>{const t=document.querySelector('.header-tab.active');t&&loadTab(t.dataset.tab)},30000)
|
|
@@ -48,6 +48,15 @@ export interface KanbanTask {
|
|
|
48
48
|
createdAt: string;
|
|
49
49
|
updatedAt: string;
|
|
50
50
|
}
|
|
51
|
+
export interface Goal {
|
|
52
|
+
id: string;
|
|
53
|
+
title: string;
|
|
54
|
+
description?: string;
|
|
55
|
+
status: "active" | "decomposing" | "completed" | "archived";
|
|
56
|
+
taskCount: number;
|
|
57
|
+
createdAt: string;
|
|
58
|
+
updatedAt: string;
|
|
59
|
+
}
|
|
51
60
|
export interface KanbanBoard {
|
|
52
61
|
columns: Record<string, KanbanTask[]>;
|
|
53
62
|
}
|
package/dist/index.js
CHANGED
|
@@ -368086,7 +368086,7 @@ function getCachedVersion(options = {}) {
|
|
|
368086
368086
|
// package.json
|
|
368087
368087
|
var package_default = {
|
|
368088
368088
|
name: "@kl-c/matrixos",
|
|
368089
|
-
version: "0.3.
|
|
368089
|
+
version: "0.3.42",
|
|
368090
368090
|
description: "MaTrixOS \u2014 Agentic OS for OpenCode. Personalizable, communicating, self-improving, resilient.",
|
|
368091
368091
|
main: "./dist/index.js",
|
|
368092
368092
|
types: "dist/index.d.ts",
|
package/package.json
CHANGED