jaxon-agents 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.agent.md +203 -168
- package/README.md +15 -6
- package/README.zh-CN.md +16 -7
- package/dist/BUILD_INFO.json +3 -3
- package/dist/PACKAGE_MANIFEST.json +56 -41
- package/dist/RELEASE_META.json +3 -3
- package/dist/agents/directory-store.js +66 -11
- package/dist/agents/jaxon-admin.entry.js +5 -3
- package/dist/agents/session-switch.js +6 -0
- package/dist/api/mcp-tools.js +75 -45
- package/dist/console/activity-client.js +84 -60
- package/dist/console/activity-topics.js +82 -24
- package/dist/console/activity.js +4 -4
- package/dist/console/assets.js +219 -257
- package/dist/console/chat-library.js +685 -0
- package/dist/console/console-info.js +30 -0
- package/dist/console/icons.js +14 -0
- package/dist/console/pages.js +71 -29
- package/dist/console/server.js +8 -4
- package/dist/console/station-pages.js +53 -29
- package/dist/daemon/host.js +14 -3
- package/dist/index.js +87 -8
- package/dist/launcher.js +17 -26
- package/dist/ops/catalog.js +18 -15
- package/dist/ops/core.js +85 -59
- package/dist/pi-host/mcp-bridge.entry.js +41 -10
- package/dist/platform/index.js +22 -0
- package/dist/platform/linux.js +64 -0
- package/dist/release/handoff.js +6 -8
- package/dist/release/store.js +3 -13
- package/dist/sessions/supervisor.js +61 -32
- package/dist/stations/activity.js +24 -28
- package/dist/stations/boards.js +10 -5
- package/dist/stations/cues.js +14 -2
- package/dist/stations/member-instructions.js +4 -6
- package/dist/stations/station-member.entry.js +28 -11
- package/examples/README.md +23 -8
- package/examples/agents/README.md +93 -35
- package/examples/agents/coder/README.md +37 -0
- package/examples/agents/custom-gateway/README.md +42 -0
- package/examples/agents/local-qwen/README.md +46 -0
- package/examples/agents/planner/README.md +39 -0
- package/examples/agents/reviewer/README.md +42 -0
- package/examples/mcp-clients/README.md +35 -16
- package/examples/stations/README.md +98 -21
- package/examples/stations/dev-loop/README.md +40 -0
- package/examples/stations/parallel-coders/README.md +40 -0
- package/examples/stations/parallel-coders/STATION.md +2 -2
- package/examples/stations/research-writer/README.md +39 -0
- package/examples/stations/research-writer/STATION.md +1 -1
- package/examples/workflows/01-dev-loop-e2e.md +27 -5
- package/examples/workflows/02-human-auth-and-roster-switch.md +25 -3
- package/examples/workflows/README.md +17 -0
- package/package.json +3 -3
- package/runtime/provenance.json +3 -3
- package/runtime/runtime-lock.json +2 -2
- package/runtime/runtime-package.json +1 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// The console address projection shared by the MCP resource `jaxon://console` and the
|
|
2
|
+
// `jaxon-agents console --json` CLI output (PLAN §20.2). It never contains credentials.
|
|
3
|
+
export const consolePages = {
|
|
4
|
+
overview: "/", stations: "/stations", station: "/stations/{station_id}", connections: "/connections",
|
|
5
|
+
};
|
|
6
|
+
export function consoleInfoFrom(status, fallbackUrl = "http://127.0.0.1:7391") {
|
|
7
|
+
const raw = typeof status?.console_url === "string" && status.console_url ? status.console_url : fallbackUrl;
|
|
8
|
+
const base = raw.replace(/\/+$/, "");
|
|
9
|
+
let parsed;
|
|
10
|
+
try {
|
|
11
|
+
parsed = new URL(base);
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
parsed = new URL("http://127.0.0.1:7391");
|
|
15
|
+
}
|
|
16
|
+
const port = Number.isInteger(status?.port) ? status.port : Number(parsed.port || 80);
|
|
17
|
+
const bind = typeof status?.bind === "string" && status.bind ? status.bind : (parsed.hostname || "127.0.0.1");
|
|
18
|
+
return {
|
|
19
|
+
console_url: base + "/",
|
|
20
|
+
port,
|
|
21
|
+
bind,
|
|
22
|
+
pages: consolePages,
|
|
23
|
+
mode: typeof status?.mode === "string" ? status.mode : "source",
|
|
24
|
+
version: String(status?.version ?? ""),
|
|
25
|
+
daemon_instance: typeof status?.daemon_instance === "string" ? status.daemon_instance : null,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export function consoleUrl(info, page) {
|
|
29
|
+
return info.console_url.replace(/\/$/, "") + page;
|
|
30
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const paths = {
|
|
2
|
+
spark: '<path fill="currentColor" stroke="none" d="M12 2c1.2 6.3 3.7 8.8 10 10-6.3 1.2-8.8 3.7-10 10C10.8 15.7 8.3 13.2 2 12c6.3-1.2 8.8-3.7 10-10Z"/>',
|
|
3
|
+
settings: '<circle cx="12" cy="12" r="3"/><path d="m10 3-.6 2.4-2 .9L5 5.6l-2 3.5 1.8 1.7v2.4L3 14.9l2 3.5 2.4-.7 2 .9.6 2.4h4l.6-2.4 2-.9 2.4.7 2-3.5-1.8-1.7v-2.4L21 9.1l-2-3.5-2.4.7-2-.9L14 3z"/>',
|
|
4
|
+
cue: '<path d="m13 2-8 11h6l-1 9 9-11h-6l1-9Z"/>',
|
|
5
|
+
plus: '<path d="M12 5v14M5 12h14"/>',
|
|
6
|
+
external: '<path d="M13 5h6v6m0-6-8 8m5 0v5H6V8h5"/>',
|
|
7
|
+
chat: '<path d="M20 11.5a7.5 7.5 0 0 1-7.5 7.5H4l1.7-3.8A7.5 7.5 0 1 1 20 11.5Z"/><path d="M9 11.5h7"/>',
|
|
8
|
+
minimize: '<path d="M6 12h12"/>',
|
|
9
|
+
restore: '<path d="m7 14.5 5-5 5 5"/>',
|
|
10
|
+
close: '<path d="m6 6 12 12M18 6 6 18"/>',
|
|
11
|
+
};
|
|
12
|
+
export function consoleIcon(name) {
|
|
13
|
+
return `<svg class="ui-icon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${paths[name]}</svg>`;
|
|
14
|
+
}
|
package/dist/console/pages.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { adminScope } from "../agents/admin-scope.js";
|
|
2
2
|
import { builtinProviders } from "@earendil-works/pi-ai/providers/all";
|
|
3
3
|
import { JAXON_LOGO_URL } from "./assets.js";
|
|
4
|
+
import { consoleIcon } from "./icons.js";
|
|
4
5
|
import { attrJson, esc, formatTime, readinessOf } from "./util.js";
|
|
5
6
|
import { PAGE_SIZE } from "./pagination.js";
|
|
6
7
|
import { activityPanel } from "./activity-page.js";
|
|
8
|
+
import { isSessionSwitch, sessionSwitchKey, sessionSwitchValues } from "../agents/session-switch.js";
|
|
7
9
|
const TOOLS = ["read", "write", "edit", "bash", "grep", "find", "ls"];
|
|
10
|
+
const CONSOLE_UI_VERSION = "station-ui-6";
|
|
11
|
+
const LOGO_SRC = `${JAXON_LOGO_URL}?v=${CONSOLE_UI_VERSION}`;
|
|
8
12
|
export function viewNav(label, items, active) {
|
|
9
13
|
return `<nav class="view-nav" aria-label="${esc(label)}">${items.map(([id, name]) => `<a href="?view=${encodeURIComponent(id)}"${id === active ? ' aria-current="page"' : ""}>${esc(name)}</a>`).join("")}</nav>`;
|
|
10
14
|
}
|
|
@@ -24,19 +28,15 @@ export function layout(title, body, page = "") {
|
|
|
24
28
|
return `<!doctype html>
|
|
25
29
|
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
|
26
30
|
<title>${esc(title)} · JaXon Agents</title>
|
|
27
|
-
<link rel="icon" type="image/svg+xml" href="${
|
|
28
|
-
<link rel="stylesheet" href="/assets/style.css?v
|
|
31
|
+
<link rel="icon" type="image/svg+xml" href="${LOGO_SRC}">
|
|
32
|
+
<link rel="stylesheet" href="/assets/style.css?v=${CONSOLE_UI_VERSION}"><script src="/assets/app.js?v=${CONSOLE_UI_VERSION}" defer></script><script src="/assets/jaxon-chat.js?v=${CONSOLE_UI_VERSION}" defer></script></head>
|
|
29
33
|
<body data-page="${esc(page)}"><a class="skip-link" href="#main">Skip to content</a>
|
|
30
|
-
<header class="rail"><a class="brand" href="/"><img class="brand-mark" src="${
|
|
34
|
+
<header class="rail"><a class="brand" href="/"><img class="brand-mark" src="${LOGO_SRC}" width="32" height="32" alt="">JaXon Agents</a>
|
|
31
35
|
<nav aria-label="Console">${links}</nav></header>
|
|
32
36
|
<div id="toast" class="toast" role="status" aria-live="polite" hidden></div>
|
|
33
37
|
<main id="main" tabindex="-1">${body}</main><aside class="jaxon-dock" aria-label="Ask JaXon">
|
|
34
|
-
<button id="jaxon-launch" type="button" aria-expanded="false" aria-controls="jaxon-panel"
|
|
35
|
-
<section id="jaxon-panel" role="dialog" aria-
|
|
36
|
-
<header class="jaxon-head"><div><h2 id="jaxon-title">Ask JaXon</h2><small id="jaxon-status" role="status">Console assistant</small></div><div class="jaxon-tools"><button class="secondary" id="jaxon-new" type="button">New chat</button><button class="secondary" id="jaxon-hide" type="button" aria-label="Minimize chat">−</button></div></header>
|
|
37
|
-
<div class="jaxon-scroll"><div id="jaxon-messages"></div><section id="jaxon-question" hidden><div></div></section></div>
|
|
38
|
-
<p id="jaxon-error" role="alert" hidden></p>
|
|
39
|
-
<form id="jaxon-chat"><textarea name="text" rows="2" aria-label="Message JaXon" placeholder="Ask about agents, connections or skills…" required></textarea><div class="jaxon-actions"><small class="key-hint">Enter to send · Shift/Ctrl + Enter for a new line</small><button type="button" class="secondary" id="jaxon-stop" hidden>Stop turn</button><button type="submit">Send</button></div></form>
|
|
38
|
+
<button id="jaxon-launch" type="button" aria-expanded="false" aria-controls="jaxon-panel">${consoleIcon("spark")} Ask JaXon</button>
|
|
39
|
+
<section id="jaxon-panel" class="jaxon-conversation" role="dialog" aria-label="Ask JaXon" hidden>
|
|
40
40
|
</section></aside></body></html>`;
|
|
41
41
|
}
|
|
42
42
|
export const badge = (value) => `<span class="badge ${esc(String(value ?? "unknown").toLowerCase().replace(/[^a-z0-9_-]/g, ""))}">${esc(value ?? "unknown")}</span>`;
|
|
@@ -63,20 +63,42 @@ function agentActions(agent) {
|
|
|
63
63
|
return `<td class="agent-action-cell"><div class="agent-row-actions">
|
|
64
64
|
<a class="quiet-link" href="/agents/${encodeURIComponent(agent.name)}?view=settings" aria-label="Edit ${name}">Edit</a>${removal}</div></td>`;
|
|
65
65
|
}
|
|
66
|
+
const sessionSwitchLabels = { strictly_eager: "Strictly eager", eager: "Eager", balanced: "Balanced", conservative: "Conservative" };
|
|
67
|
+
function sessionSwitchLabel(value) {
|
|
68
|
+
return isSessionSwitch(value) ? sessionSwitchLabels[value] : "—";
|
|
69
|
+
}
|
|
70
|
+
const sessionSwitchAdvice = {
|
|
71
|
+
strictly_eager: "Lowest tolerance for redundant context: start a new session for each task.",
|
|
72
|
+
eager: "Low tolerance: reuse a session within one scenario or version.",
|
|
73
|
+
balanced: "Medium tolerance: keep the same session and switch once redundant context from different versions becomes confusing.",
|
|
74
|
+
conservative: "Highest tolerance: keep the same session unless a switch is explicitly requested.",
|
|
75
|
+
};
|
|
76
|
+
export function sessionSwitchTag(value) {
|
|
77
|
+
if (!isSessionSwitch(value))
|
|
78
|
+
return "—";
|
|
79
|
+
return `<span class="resource-tag" title="${esc(sessionSwitchAdvice[value])}">${sessionSwitchLabel(value)}</span>`;
|
|
80
|
+
}
|
|
81
|
+
function sessionSwitchSelect(value) {
|
|
82
|
+
const current = isSessionSwitch(value) ? value : "";
|
|
83
|
+
return `<label>Context redundancy tolerance<select name="session_switch" data-original="${current}">
|
|
84
|
+
<option value=""${current === "" ? " selected" : ""}>Use default (Balanced)</option>
|
|
85
|
+
${sessionSwitchValues.map(choice => `<option value="${choice}"${choice === current ? " selected" : ""}>${sessionSwitchLabels[choice]}</option>`).join("")}
|
|
86
|
+
</select></label>`;
|
|
87
|
+
}
|
|
66
88
|
function agentCards(agents, showActions = false) {
|
|
67
89
|
if (!agents.length)
|
|
68
90
|
return empty("No agents have been created.");
|
|
69
|
-
return `<div class="table-wrap"><table class="resource-list"><thead><tr><th>Agent</th><th>Readiness</th><th>Revision</th>${showActions ? '<th class="agent-action-cell" scope="col">Actions</th>' : ""}</tr></thead>
|
|
91
|
+
return `<div class="table-wrap"><table class="resource-list"><thead><tr><th>Agent</th><th>Readiness</th><th>Revision</th><th scope="col">Session switch</th>${showActions ? '<th class="agent-action-cell" scope="col">Actions</th>' : ""}</tr></thead>
|
|
70
92
|
<tbody>${agents.map((agent) => `<tr>
|
|
71
93
|
<td><a href="/agents/${encodeURIComponent(agent.name)}">${esc(agent.name)}</a><small>${esc(agent.description)}</small></td>
|
|
72
94
|
<td>${badge(readinessOf(agent))}${agent.readiness?.reason ? `<small>${esc(agent.readiness.reason)}</small>` : ""}</td>
|
|
73
|
-
<td><code>${esc(agent.revision ?? "—")}</code></td>${showActions ? agentActions(agent) : ""}
|
|
95
|
+
<td><code>${esc(agent.revision ?? "—")}</code></td><td>${sessionSwitchTag(agent.session_switch)}</td>${showActions ? agentActions(agent) : ""}
|
|
74
96
|
</tr>`).join("")}</tbody></table></div>`;
|
|
75
97
|
}
|
|
76
98
|
function sessionRows(sessions) {
|
|
77
99
|
if (!sessions.length)
|
|
78
100
|
return empty("No matching sessions.");
|
|
79
|
-
return `<div class="table-wrap"><table class="resource-list"><thead><tr><th>Session</th><th>Agent</th><th>Task / workspace</th><th>Status</th><th>Updated</th></tr></thead><tbody>${sessions.map((s) => `<tr><td><a href="/sessions/${encodeURIComponent(s.session_id)}">${esc(s.session_id)}</a>${s.has_pending_request ? `<small>input required</small>` : ""}
|
|
101
|
+
return `<div class="table-wrap"><table class="resource-list"><thead><tr><th>Session</th><th>Agent</th><th>Task / workspace</th><th>Status</th><th>Updated</th></tr></thead><tbody>${sessions.map((s) => `<tr><td><a href="/sessions/${encodeURIComponent(s.session_id)}">${esc(s.session_id)}</a>${s.has_pending_request ? `<small>input required</small>` : ""}</td><td>${esc(s.agent)}</td><td>${esc(s.task_id ?? "—")}<small>${esc(s.workspace)}</small></td><td>${badge(s.status)}</td><td>${esc(formatTime(s.updated_at))}</td></tr>`).join("")}</tbody></table></div>`;
|
|
80
102
|
}
|
|
81
103
|
export function dashboardContent(data, pages) {
|
|
82
104
|
const active = data.sessions.filter((s) => !["closed", "dormant"].includes(s.status));
|
|
@@ -381,6 +403,22 @@ function clonePanel(agent, pages) {
|
|
|
381
403
|
${source ? `<section id="source-mcp"><h3>MCP servers</h3><small>Clones include configured headers and environment values. Saved OAuth credentials stay with the source agent.</small><div id="source-mcp-list">${regions["source-mcp-list"]}</div></section>
|
|
382
404
|
<section id="source-skills"><h3>Skills</h3><div id="source-skills-list">${regions["source-skills-list"]}</div></section>` : ""}</section>`;
|
|
383
405
|
}
|
|
406
|
+
function compactionFields(value) {
|
|
407
|
+
const enabled = value?.enabled;
|
|
408
|
+
return `<fieldset><legend>Context compaction</legend>
|
|
409
|
+
<label>Automatic compaction<select name="compaction_enabled">
|
|
410
|
+
<option value="">Pi default (on)</option>
|
|
411
|
+
<option value="true"${enabled === true ? " selected" : ""}>On</option>
|
|
412
|
+
<option value="false"${enabled === false ? " selected" : ""}>Off</option>
|
|
413
|
+
</select></label>
|
|
414
|
+
<div class="grid-form">
|
|
415
|
+
<label>Context reserve (tokens)<input type="number" name="compaction_reserve" min="0" max="${Number.MAX_SAFE_INTEGER}" step="1" placeholder="16384" value="${esc(value?.reserveTokens)}"></label>
|
|
416
|
+
<label>Recent history to keep (tokens)<input type="number" name="compaction_keep_recent" min="0" max="${Number.MAX_SAFE_INTEGER}" step="1" placeholder="20000" value="${esc(value?.keepRecentTokens)}"></label>
|
|
417
|
+
</div>
|
|
418
|
+
<p class="muted">Leave a token field blank to use Pi’s default. Pi starts automatic compaction when estimated context use exceeds the model’s context window minus the reserve. A configured per-model override takes precedence over these token fields.</p>
|
|
419
|
+
<p class="muted">Saving applies to new sessions. Existing sessions keep their preset snapshot.</p>
|
|
420
|
+
</fieldset>`;
|
|
421
|
+
}
|
|
384
422
|
export function agentDetailPage(agent, connections, pages, view = "") {
|
|
385
423
|
const settings = typeof agent.files?.["settings.json"] === "string" ? (() => { try {
|
|
386
424
|
return JSON.parse(agent.files["settings.json"]);
|
|
@@ -388,6 +426,7 @@ export function agentDetailPage(agent, connections, pages, view = "") {
|
|
|
388
426
|
catch {
|
|
389
427
|
return {};
|
|
390
428
|
} })() : (agent.files?.["settings.json"] ?? {});
|
|
429
|
+
const switchPolicy = agent.session_switch;
|
|
391
430
|
const instructions = agent.files?.["APPEND_SYSTEM.md"] ?? "";
|
|
392
431
|
const rev = agent.revision ?? "";
|
|
393
432
|
const readiness = agent.readiness ?? {};
|
|
@@ -402,9 +441,14 @@ export function agentDetailPage(agent, connections, pages, view = "") {
|
|
|
402
441
|
case "settings":
|
|
403
442
|
content = `<form class="card editor preset-editor" method="post" action="/api/op" data-op="agent_update" data-kind="agent-settings" data-settings="${attrJson(settings)}" data-success="reload">
|
|
404
443
|
${hidden("name", agent.name)}${hidden("expected_rev", rev)}
|
|
405
|
-
<
|
|
444
|
+
<div class="grid-form">
|
|
445
|
+
<label>What does this agent do?<input name="description" required value="${esc(agent.description)}"></label>
|
|
446
|
+
${agent.name === "JaXon" ? "" : sessionSwitchSelect(settings[sessionSwitchKey])}
|
|
447
|
+
</div>
|
|
448
|
+
${agent.name === "JaXon" ? "" : '<p class="muted">Advisory only. This policy never closes, rejects, or starts sessions automatically.</p>'}
|
|
406
449
|
<fieldset><legend>Model access</legend>${modelFields(connections, agent.connection, settings, agent.files?.["models.json"])}</fieldset>
|
|
407
450
|
${reasoningSelect(settings.defaultThinkingLevel)}${toolChoices(settings.defaultTools ?? TOOLS)}
|
|
451
|
+
${compactionFields(settings.compaction)}
|
|
408
452
|
<button type="submit">Save settings</button></form>`;
|
|
409
453
|
break;
|
|
410
454
|
case "instructions":
|
|
@@ -432,7 +476,7 @@ export function agentDetailPage(agent, connections, pages, view = "") {
|
|
|
432
476
|
<details class="drawer destructive"><summary>Delete preset</summary><section class="card danger-zone"><form method="post" action="/api/op" data-op="agent_delete" data-redirect="/agents" data-confirm="Permanently delete ${esc(agent.name)}? Existing sessions keep their frozen snapshots.">${hidden("name", agent.name)}${hidden("expected_rev", rev)}${submit("Delete agent", "danger")}</form></section></details>`;
|
|
433
477
|
break;
|
|
434
478
|
default:
|
|
435
|
-
content = `<section class="card"><h2>Agent details</h2><dl class="details"><dt>Provider</dt><dd>${esc(settings.defaultProvider ?? "—")}</dd><dt>Model</dt><dd>${esc(settings.defaultModel ?? "—")}</dd><dt>Preset ID</dt><dd><code>${esc(agent.preset_id)}</code></dd><dt>Revision</dt><dd><code>${esc(rev)}</code></dd><dt>Connection</dt><dd>${esc(connections.find((c) => c.connection_id === agent.connection)?.label ?? agent.connection ?? "None")} · <a href="?view=settings">Configure</a></dd><dt>Readiness</dt><dd>${badge(readinessOf(agent))} ${esc(readiness?.reason ?? agent.last_test?.error ?? "")}</dd><dt>Last test</dt><dd>${esc(formatTime(readiness?.tested_at ?? agent.last_test?.tested_at))}</dd></dl><form method="post" action="/api/op" data-op="agent_test" data-success="reload" class="inline-form">${hidden("name", agent.name)}<details class="compact"><summary>Test timeout</summary><label>Wait (ms)<input type="number" name="wait_ms" data-number value="30000" min="0"></label></details>${submit("Run readiness test")}</form></section>`;
|
|
479
|
+
content = `<section class="card"><h2>Agent details</h2><dl class="details"><dt>Provider</dt><dd>${esc(settings.defaultProvider ?? "—")}</dd><dt>Model</dt><dd>${esc(settings.defaultModel ?? "—")}</dd><dt>Preset ID</dt><dd><code>${esc(agent.preset_id)}</code></dd><dt>Revision</dt><dd><code>${esc(rev)}</code></dd>${isSessionSwitch(switchPolicy) ? `<dt>Context redundancy tolerance</dt><dd>${sessionSwitchLabel(switchPolicy)}<small class="muted"> · ${sessionSwitchAdvice[switchPolicy]}</small></dd>` : ""}<dt>Connection</dt><dd>${esc(connections.find((c) => c.connection_id === agent.connection)?.label ?? agent.connection ?? "None")} · <a href="?view=settings">Configure</a></dd><dt>Readiness</dt><dd>${badge(readinessOf(agent))} ${esc(readiness?.reason ?? agent.last_test?.error ?? "")}</dd><dt>Last test</dt><dd>${esc(formatTime(readiness?.tested_at ?? agent.last_test?.tested_at))}</dd></dl><form method="post" action="/api/op" data-op="agent_test" data-success="reload" class="inline-form">${hidden("name", agent.name)}<details class="compact"><summary>Test timeout</summary><label>Wait (ms)<input type="number" name="wait_ms" data-number value="30000" min="0"></label></details>${submit("Run readiness test")}</form></section>`;
|
|
436
480
|
}
|
|
437
481
|
const startUrl = `/sessions?view=new&agent=${encodeURIComponent(agent.name)}`;
|
|
438
482
|
const body = `<a class="back" href="/agents">← Agents</a>
|
|
@@ -483,21 +527,19 @@ function toolArgumentsSummary(args) {
|
|
|
483
527
|
return compactText(args.code);
|
|
484
528
|
return compactText(JSON.stringify(args));
|
|
485
529
|
}
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
};
|
|
530
|
+
// Console chrome is fixed English (no i18n): it never follows LC_ALL/LANG, topic_language or the browser.
|
|
531
|
+
const thinkingLabels = { title: "Thinking", expand: "Expand all", collapse: "Collapse all" };
|
|
532
|
+
function thinkingChars(chars) { return `${chars.toLocaleString("en-US")} ${chars === 1 ? "char" : "chars"}`; }
|
|
490
533
|
function thinkingHtml(part, index, language) {
|
|
491
|
-
const
|
|
492
|
-
const heading = `<span class="tool-heading"><strong>${labels.title}</strong></span>`;
|
|
534
|
+
const heading = `<span class="tool-heading"><strong>${thinkingLabels.title}</strong></span>`;
|
|
493
535
|
const text = typeof part.text === "string" ? part.text : "";
|
|
494
|
-
const chars = part.chars ?? part.original_chars ?? [...text].length;
|
|
495
|
-
const count =
|
|
536
|
+
const chars = Number(part.chars ?? part.original_chars ?? [...text].length);
|
|
537
|
+
const count = thinkingChars(Number.isFinite(chars) ? chars : 0);
|
|
496
538
|
if (part.redacted === true || part.omitted === true) {
|
|
497
|
-
const status = part.redacted === true ?
|
|
498
|
-
return `<div class="tool-result session-thinking-placeholder" lang="${language}">${heading}<span class="tool-summary">${esc(status)}</span></div>`;
|
|
539
|
+
const status = part.redacted === true ? "· redacted by provider" : `· omitted (${count})`;
|
|
540
|
+
return `<div class="tool-result session-thinking-placeholder" lang="${language}">${heading} <span class="tool-summary">${esc(status)}</span></div>`;
|
|
499
541
|
}
|
|
500
|
-
return `<details class="tool-result session-thinking" data-thinking-index="${index}" lang="${language}"><summary>${heading}<span class="tool-summary">${esc(count)}${part.truncated ?
|
|
542
|
+
return `<details class="tool-result session-thinking" data-thinking-index="${index}" lang="${language}"><summary>${heading} <span class="tool-summary">${esc(`· ${count}`)}${part.truncated ? " · truncated" : ""}</span></summary><div class="tool-detail"><pre class="tool-output">${esc(text)}</pre></div></details>`;
|
|
501
543
|
}
|
|
502
544
|
function historyPartHtml(sessionId, part, toolOutput, index, language) {
|
|
503
545
|
if (part?.type === "thinking")
|
|
@@ -557,13 +599,13 @@ export function pendingPromptHtml(pending, sessionId) {
|
|
|
557
599
|
function usageBlock(usage) {
|
|
558
600
|
return `<div class="usage-grid">${["current_turn", "session_total", "task_total", ...(usage?.by_origin?.cue ? ["by_origin"] : [])].map((key) => `<div><h3>${esc(key.replaceAll("_", " "))}</h3><pre>${esc(JSON.stringify(usage?.[key] ?? {}, null, 2))}</pre></div>`).join("")}</div>`;
|
|
559
601
|
}
|
|
560
|
-
export function sessionDetailPage(sessionId, read, screen, isJaXon,
|
|
561
|
-
const labels = thinkingLabels
|
|
602
|
+
export function sessionDetailPage(sessionId, read, screen, isJaXon, language, cueTurn) {
|
|
603
|
+
const labels = thinkingLabels;
|
|
562
604
|
const body = `<a class="back" href="/sessions">← Sessions</a>
|
|
563
605
|
${cueTurn ? `<p class="banner">Cue turn <code>${esc(cueTurn)}</code> · <a href="/sessions/${encodeURIComponent(sessionId)}">Return to live session</a></p>` : ""}
|
|
564
|
-
<header class="page-heading"><div><h1>Session</h1><p><code>${esc(sessionId)}</code></p
|
|
606
|
+
<header class="page-heading"><div><h1>Session</h1><p><code>${esc(sessionId)}</code></p></div><span id="session-status">${badge(read.status)}</span></header>
|
|
565
607
|
<section id="conversation" data-cursor="${esc(read.cursor)}" data-before="${esc(read.history_before)}"${cueTurn ? ` data-cue-turn="${esc(cueTurn)}"` : ""}>
|
|
566
|
-
<div class="section-heading"><h2 id="conversation-heading">Conversation</h2><div class="actions"><button type="button" class="secondary" id="session-thinking-toggle" aria-controls="session-history" lang="
|
|
608
|
+
<div class="section-heading"><h2 id="conversation-heading">Conversation</h2><div class="actions"><button type="button" class="secondary" id="session-thinking-toggle" aria-controls="session-history" lang="en" data-expand="${labels.expand}" data-collapse="${labels.collapse}" hidden>${labels.expand}</button><button type="button" class="secondary" id="session-latest" hidden>Jump to latest</button></div></div>
|
|
567
609
|
<div id="session-scroll" role="region" aria-labelledby="conversation-heading" tabindex="0">
|
|
568
610
|
<button type="button" class="secondary" id="session-older"${read.history_before ? "" : " hidden"}>Load earlier messages</button>
|
|
569
611
|
<p class="empty" id="session-history-empty"${read.history.length ? " hidden" : ""}>No messages yet.</p>
|
package/dist/console/server.js
CHANGED
|
@@ -4,6 +4,7 @@ import * as path from "node:path";
|
|
|
4
4
|
import * as http from "node:http";
|
|
5
5
|
import { errorData } from "../ops/errors.js";
|
|
6
6
|
import { APP_JS, JAXON_LOGO_URL, STYLE_CSS } from "./assets.js";
|
|
7
|
+
import { CHAT_JS } from "./chat-library.js";
|
|
7
8
|
import { agentDetailPage, agentResourceRegions, agentsPage, connectionsPage, dashboardContent, dashboardPage, flowLiveRegions, flowPage, layout, sessionDetailPage, sessionHistoryContent, sessionsPage, simplePage, } from "./pages.js";
|
|
8
9
|
import { usagePage } from "./usage-page.js";
|
|
9
10
|
import { parseUsageQuery } from "./usage-range.js";
|
|
@@ -181,6 +182,10 @@ export class WebConsole {
|
|
|
181
182
|
send(response, 200, APP_JS, { "Content-Type": "text/javascript; charset=utf-8", "Cache-Control": "private, max-age=60" });
|
|
182
183
|
return;
|
|
183
184
|
}
|
|
185
|
+
if (method === "GET" && pathname === "/assets/jaxon-chat.js") {
|
|
186
|
+
send(response, 200, CHAT_JS, { "Content-Type": "text/javascript; charset=utf-8", "Cache-Control": "private, max-age=60" });
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
184
189
|
if (method === "GET" && pathname === JAXON_LOGO_URL) {
|
|
185
190
|
send(response, 200, this.logo, { "Content-Type": "image/svg+xml; charset=utf-8", "Cache-Control": "private, max-age=60" });
|
|
186
191
|
return;
|
|
@@ -381,8 +386,7 @@ export class WebConsole {
|
|
|
381
386
|
}
|
|
382
387
|
else {
|
|
383
388
|
const meta = this.ops.supervisor.sessions.get(id)?.meta;
|
|
384
|
-
|
|
385
|
-
sendHtml(response, 200, sessionDetailPage(id, read, screen, meta?.agent === "JaXon", membership, language, atLeaf ? turn : undefined));
|
|
389
|
+
sendHtml(response, 200, sessionDetailPage(id, read, screen, meta?.agent === "JaXon", language, atLeaf ? turn : undefined));
|
|
386
390
|
}
|
|
387
391
|
return;
|
|
388
392
|
}
|
|
@@ -517,9 +521,9 @@ export class WebConsole {
|
|
|
517
521
|
void publish();
|
|
518
522
|
}
|
|
519
523
|
async stationCollections(station, view) {
|
|
520
|
-
const members = view === "members" ? (await this.execute("session_list", { station })).sessions.filter((m) => m.status !== "closed") : [];
|
|
524
|
+
const members = view === "members" || view === "overview" ? (await this.execute("session_list", { station })).sessions.filter((m) => m.status !== "closed") : [];
|
|
521
525
|
const boards = view === "boards" ? sanitize(this.ops.stationBoardSnapshot(station)) : [];
|
|
522
|
-
const presetNames = hasRosterControls(view) ? listPresets().map(({ name }) => name)
|
|
526
|
+
const presetNames = hasRosterControls(view) || view === "settings" ? listPresets().map(({ name }) => name)
|
|
523
527
|
.filter(name => name !== JAXON && name !== "master").sort((a, b) => a.localeCompare(b)) : [];
|
|
524
528
|
return { members, boards, presetNames };
|
|
525
529
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { badge, layout, viewNav } from "./pages.js";
|
|
1
|
+
import { badge, layout, sessionSwitchTag, viewNav } from "./pages.js";
|
|
2
2
|
import { esc, formatTime } from "./util.js";
|
|
3
3
|
import { activityPanel } from "./activity-page.js";
|
|
4
|
+
import { consoleIcon } from "./icons.js";
|
|
4
5
|
export const stationViews = [
|
|
5
6
|
["overview", "Overview"], ["members", "Members"], ["boards", "Boards"], ["revisions", "Revisions"], ["settings", "Settings"],
|
|
6
7
|
];
|
|
@@ -22,9 +23,15 @@ export const matchesStationStatus = (station, filter) => !filter || station.stat
|
|
|
22
23
|
(filter === "inactive" && (station.state === "cold" || station.state === "warm"));
|
|
23
24
|
const stateBadge = (state) => `<span class="badge ${state}">${stateLabels[state]}</span>`;
|
|
24
25
|
const stateBadges = ({ state, delivery_state }) => `${stateBadge(state)}${badge(deliveryLabels[delivery_state])}`;
|
|
25
|
-
function stationFields(description = "", agents = [], md = "") {
|
|
26
|
+
function stationFields(description = "", agents = [], md = "", presetNames = []) {
|
|
27
|
+
const names = [...new Set([...presetNames, ...agents])].sort((a, b) => a.localeCompare(b));
|
|
28
|
+
const chosen = agents.filter((name) => names.includes(name));
|
|
29
|
+
const summary = chosen.length ? `${chosen.length} selected: ${chosen.join(", ")}` : "No presets selected";
|
|
30
|
+
const picker = names.length ? `<fieldset class="preset-picker" data-preset-picker><legend>Member presets</legend>
|
|
31
|
+
<p class="muted" data-preset-summary>${esc(summary)}</p><div class="preset-options">${names.map((name) => `<label class="preset-option"><input type="checkbox" name="agents" value="${esc(name)}"${agents.includes(name) ? " checked" : ""}> <span>${esc(name)}</span></label>`).join("")}</div></fieldset>`
|
|
32
|
+
: `<label>Member presets <small>(comma separated)</small><input name="agents" required data-comma value="${esc(agents.join(", "))}" placeholder="coder, reviewer"></label>`;
|
|
26
33
|
return `<label>One-line description<input name="description" required value="${esc(description)}" placeholder="Coordinate implementation and review"></label>
|
|
27
|
-
|
|
34
|
+
${picker}
|
|
28
35
|
<label>Rules (STATION.md)<textarea name="station_md" rows="12" data-keep-empty>\n${esc(md)}</textarea></label>`;
|
|
29
36
|
}
|
|
30
37
|
export function stationsPage(stations, agentNames, filters, pages, creating) {
|
|
@@ -32,7 +39,7 @@ export function stationsPage(stations, agentNames, filters, pages, creating) {
|
|
|
32
39
|
return layout("New station", `<a class="back" href="/stations">← Stations</a><header class="page-heading"><h1>New station</h1></header>
|
|
33
40
|
<section class="card editor">${form("station_create", 'data-redirect="/stations/{station_id}" class="grid-form"')}
|
|
34
41
|
<label>Station name<input name="name" required pattern="(?:[A-Za-z0-9_]|-)+" placeholder="project-team"></label>
|
|
35
|
-
${stationFields()}<button type="submit">Create station</button></form></section>`, "stations");
|
|
42
|
+
${stationFields("", [], "", agentNames)}<button type="submit">Create station</button></form></section>`, "stations");
|
|
36
43
|
}
|
|
37
44
|
const options = (values, selected) => values.map(([value, label]) => `<option value="${esc(value)}"${value === selected ? " selected" : ""}>${esc(label)}</option>`).join("");
|
|
38
45
|
const names = [...new Set([...agentNames, ...(filters.agent ? [filters.agent] : [])])].sort((a, b) => a.localeCompare(b));
|
|
@@ -107,14 +114,14 @@ function pendingCueBadge(pending) {
|
|
|
107
114
|
const title = [`${pending.count} unread cues`, pending.senders.join(", "), wake].filter(Boolean).join(" · ");
|
|
108
115
|
return `<span class="cue-badge" title="${esc(title)}" aria-label="${esc(title)}">${pending.count}</span>${wake ? `<small>${esc(wake)}</small>` : ""}`;
|
|
109
116
|
}
|
|
110
|
-
function
|
|
117
|
+
function memberPresetsContent(station, members, pages) {
|
|
111
118
|
const roster = station.agents.map(a => a.name);
|
|
112
119
|
const joining = new Set(station.station_pending?.join);
|
|
113
120
|
const leaving = new Set(station.station_pending?.leave);
|
|
114
|
-
const presets = [...station.agents, ...[...leaving].map(name => ({
|
|
121
|
+
const presets = [...station.agents, ...[...leaving].map(name => ({
|
|
122
|
+
name, session_switch: members.find(member => member.agent === name)?.station.session_switch,
|
|
123
|
+
}))];
|
|
115
124
|
const lastMember = roster.length <= 1;
|
|
116
|
-
const orderedMembers = members.slice().sort((a, b) => a.agent.localeCompare(b.agent) ||
|
|
117
|
-
Number(b.station.seat) - Number(a.station.seat) || b.updated_at - a.updated_at || a.session_id.localeCompare(b.session_id));
|
|
118
125
|
return `<section id="member-presets"><div class="section-heading"><h2>Member presets</h2></div>
|
|
119
126
|
${lastMember ? `<p class="muted" id="minimum-roster">Keep at least one member preset in the latest roster.</p>` : ""}
|
|
120
127
|
${pages.list("presets_page", "Member presets", presets, rows => rows.length ? `<div class="table-wrap"><table class="resource-list">
|
|
@@ -125,28 +132,32 @@ function membersContent(station, members, pages) {
|
|
|
125
132
|
: `${form("station_update", 'data-confirm="Remove this preset from the Station roster?"')}${revisionTarget(station)}${agentsField(roster.filter(name => name !== a.name))}
|
|
126
133
|
<button class="secondary" type="submit" aria-label="Remove ${esc(a.name)}"${lastMember ? ' disabled aria-describedby="minimum-roster" title="Keep at least one member preset"' : ""}>Remove</button></form>`;
|
|
127
134
|
return `<tr><td>${a.readiness && a.readiness !== "missing" ? `<a href="${agentUrl(a.name)}">${esc(a.name)}</a>` : esc(a.name)}
|
|
128
|
-
${isLeaving ? badge("Leaving") : joining.has(a.name) ? badge("Joining") : ""}</td><td>${a.readiness ? badge(a.readiness) : "—"}</td>
|
|
135
|
+
${isLeaving ? badge("Leaving") : joining.has(a.name) ? badge("Joining") : ""}${a.session_switch ? ` ${sessionSwitchTag(a.session_switch)}` : ""}</td><td>${a.readiness ? badge(a.readiness) : "—"}</td>
|
|
129
136
|
<td class="row-action-cell"><div class="row-actions">${action}</div></td></tr>`;
|
|
130
|
-
}).join("")}</tbody></table></div>` : empty("No member presets."), "member-presets")}</section
|
|
131
|
-
|
|
137
|
+
}).join("")}</tbody></table></div>` : empty("No member presets."), "member-presets")}</section>`;
|
|
138
|
+
}
|
|
139
|
+
function memberSessionsContent(station, members, pages) {
|
|
140
|
+
const orderedMembers = members.slice().sort((a, b) => a.agent.localeCompare(b.agent) ||
|
|
141
|
+
b.updated_at - a.updated_at || a.session_id.localeCompare(b.session_id));
|
|
142
|
+
return `<section id="member-sessions"><div class="section-heading"><h2>Member sessions</h2><a href="/sessions?station=${encodeURIComponent(station.station_id)}">All sessions →</a></div>
|
|
132
143
|
${pages.list("members_page", "Member sessions", orderedMembers, rows => rows.length ? `<div class="table-wrap"><table class="resource-list"><thead><tr>
|
|
133
144
|
<th scope="col">Member session</th><th scope="col">Status</th><th scope="col">Updated</th><th scope="col">Turn progress</th></tr></thead>
|
|
134
|
-
<tbody>${rows.map(m => `<tr><td><a href="${sessionUrl(m.session_id)}">${
|
|
145
|
+
<tbody>${rows.map(m => `<tr><td><a href="${sessionUrl(m.session_id)}">${esc(m.agent)}</a><small><code>${esc(m.session_id)}</code></small></td><td><div class="status-group">${badge(m.status)}${m.in_roster === false ? badge("Outside effective roster") : ""}${m.turn_progress?.origin === "cue" ? badge("Woken by cue") : ""}${pendingCueBadge(m.pending_cues)}</div></td>
|
|
135
146
|
<td>${esc(formatTime(m.updated_at))}</td><td>${m.turn_progress ? `${esc(m.turn_progress.elapsed_ms)} ms · ${esc(m.turn_progress.tool_calls)} tool calls${m.turn_progress.last_tool ? `<small>Last tool: ${esc(m.turn_progress.last_tool)}</small>` : ""}` : "—"}</td></tr>`).join("")}</tbody></table></div>` : empty("No open member sessions."), "member-sessions")}</section>`;
|
|
136
147
|
}
|
|
137
148
|
function boardsContent(station, boards, pages) {
|
|
138
149
|
const id = field("station", station.station_id);
|
|
139
150
|
return pages.list("boards_page", "Boards", boards, rows => `<div data-board-list>${rows.length ? rows.map(b => {
|
|
140
151
|
const by = b.updated_by ? ` · ${b.updated_by.kind}${b.updated_by.kind === "member" ? ` (${b.updated_by.session_id})` : ""}` : "";
|
|
141
|
-
return `<
|
|
142
|
-
<
|
|
143
|
-
<
|
|
144
|
-
<p class="warning" data-board-stale hidden>Your draft is based on an older version.</p><pre data-board-content>\n${esc(b.content || "(empty)")}</pre>
|
|
152
|
+
return `<details class="card station-board" id="board-${esc(b.owner)}" data-board="${esc(b.owner)}" data-version="${b.version}">
|
|
153
|
+
<summary class="board-summary"><span class="section-heading" data-board-title><strong>${esc(b.owner)}</strong><span class="status-group">${b.active_sessions.length ? badge(`${b.active_sessions.length} active session${b.active_sessions.length === 1 ? "" : "s"}`) : ""}${b.in_roster ? "" : badge("Former member")}${badge(b.owner_active ? "Active owner" : "No active owner")}</span></span>
|
|
154
|
+
<span class="muted board-version" data-board-meta>Version ${b.version}${esc(by)}${b.updated_at ? ` · ${esc(formatTime(b.updated_at))}` : ""}</span></summary>
|
|
155
|
+
<div class="board-detail"><p class="warning" data-board-stale hidden>Your draft is based on an older version.</p><pre data-board-content>\n${esc(b.content || "(empty)")}</pre>
|
|
145
156
|
<details class="form-advanced"><summary>Edit board</summary>
|
|
146
157
|
${form("board_write", 'data-success="none"')}${id}${field("owner", b.owner)}<input type="hidden" name="expected_version" value="${b.version}" data-number>
|
|
147
158
|
<label>Content<textarea name="content" rows="5" data-keep-empty>\n${esc(b.content)}</textarea></label>
|
|
148
159
|
<div class="actions"><button type="submit">Save board</button><button type="button" class="secondary" data-board-load>Load latest into editor</button></div></form>
|
|
149
|
-
${form("board_clear", 'data-success="none" data-confirm="Clear this board?"')}${id}<input type="hidden" name="owners" value="${esc(JSON.stringify([b.owner]))}" data-json><button type="submit" class="secondary">Clear board</button></form></details></
|
|
160
|
+
${form("board_clear", 'data-success="none" data-confirm="Clear this board?"')}${id}<input type="hidden" name="owners" value="${esc(JSON.stringify([b.owner]))}" data-json><button type="submit" class="secondary">Clear board</button></form></details></div></details>`;
|
|
150
161
|
}).join("") : empty("No boards available.")}</div>`, "station-boards");
|
|
151
162
|
}
|
|
152
163
|
function revisionsContent(station, pages) {
|
|
@@ -156,11 +167,22 @@ function revisionsContent(station, pages) {
|
|
|
156
167
|
<tbody>${rows.map(r => `<tr><td><a href="${esc(pages.href({ revision: r }))}"><code>${esc(r)}</code></a></td><td><div class="status-group">${r === station.revision ? badge("Current") : ""}${r === station.active_revision ? badge("Effective") : ""}</div></td>
|
|
157
168
|
<td class="row-action-cell"><div class="row-actions">${r === station.revision ? "—" : `${form("station_update", 'data-confirm="Publish a rollback as a new revision?"')}${target}${field("from_revision", r)}<button class="secondary" type="submit">Roll back</button></form>`}</div></td></tr>`).join("")}</tbody></table></div>` : empty("No revision history."), "station-revisions")}</section>`;
|
|
158
169
|
}
|
|
170
|
+
function cueSkipLabel(reason) {
|
|
171
|
+
switch (reason) {
|
|
172
|
+
case "no_session": return "role has no session";
|
|
173
|
+
case "not_found":
|
|
174
|
+
case "session_closed": return "session not found";
|
|
175
|
+
case "not_in_roster": return "role outside roster";
|
|
176
|
+
default: return reason;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
159
179
|
function cueLogRow(cue) {
|
|
160
|
-
const
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
|
|
180
|
+
const undelivered = cue.delivery === "undelivered";
|
|
181
|
+
const to = undelivered ? esc(cue.to.target) : `<a href="${sessionUrl(cue.to.session_id)}">${esc(cue.to.target)}</a> <small><code>${esc(cue.to.session_id)}</code></small>`;
|
|
182
|
+
const outcome = undelivered
|
|
183
|
+
? `Undelivered (${esc(cueSkipLabel(cue.reason))})`
|
|
184
|
+
: cue.woken_turn_id ? `<a href="${sessionUrl(cue.to.session_id)}?turn=${encodeURIComponent(cue.woken_turn_id)}">Woken · ${esc(cue.woken_turn_id)}</a>`
|
|
185
|
+
: cue.delivered_at ? "Delivered on a turn" : cue.wake ? `Pending · ${esc(cueWakeLabels[cue.wake])}` : "Pending";
|
|
164
186
|
return `<tr><td>${esc(formatTime(cue.at))}</td><td>${esc(cue.from.agent)} <small><code>${esc(cue.from.session_id)}</code></small> → ${to}</td>
|
|
165
187
|
<td><a href="?view=boards#${esc(encodeURIComponent(`board-${cue.board.owner}`))}">${esc(cue.board.owner)} · v${esc(cue.board.version)}</a></td>
|
|
166
188
|
<td>${esc(cue.message ?? "—")}</td><td>${outcome}<small>Hop ${esc(cue.hop ?? 0)}</small></td></tr>`;
|
|
@@ -192,10 +214,11 @@ export function stationLiveRegions(station, members, boards, pages, view, preset
|
|
|
192
214
|
switch (view) {
|
|
193
215
|
case "overview":
|
|
194
216
|
regions["station-overview"] = overviewContent(station);
|
|
217
|
+
regions["station-member-sessions"] = memberSessionsContent(station, members, pages);
|
|
195
218
|
regions["cue-activity-content"] = cueActivityContent(station, pages);
|
|
196
219
|
break;
|
|
197
220
|
case "members":
|
|
198
|
-
regions["station-members"] =
|
|
221
|
+
regions["station-members"] = memberPresetsContent(station, members, pages);
|
|
199
222
|
break;
|
|
200
223
|
case "boards":
|
|
201
224
|
regions["station-board-content"] = boardsContent(station, boards, pages);
|
|
@@ -227,21 +250,22 @@ export function stationDetailPage(station, members, boards, pages, view, presetN
|
|
|
227
250
|
case "settings":
|
|
228
251
|
content = `<section class="card editor"><h2>Edit Station</h2><p class="muted">Based on revision <code>${esc(revision)}</code>.</p>
|
|
229
252
|
${lint.missing_sections.length ? `<p class="warning">Missing recommended sections: ${esc(lint.missing_sections.join(", "))}</p>` : ""}
|
|
230
|
-
${form("station_update", 'class="grid-form"')}${target}${stationFields(station.description, agents.map(a => a.name), station.station_md)}<button type="submit">Publish revision</button></form></section>
|
|
253
|
+
${form("station_update", 'class="grid-form"')}${target}${stationFields(station.description, agents.map(a => a.name), station.station_md, presetNames)}<button type="submit">Publish revision</button></form></section>
|
|
231
254
|
<details class="drawer destructive"><summary>Delete Station</summary><section class="card danger-zone"><p>Permanently delete this Station and its boards.</p>
|
|
232
255
|
${form("station_delete", 'data-redirect="/stations" data-confirm="Delete this Station and its boards?"')}${target}<button class="danger" type="submit">Delete Station</button></form></section></details>`;
|
|
233
256
|
break;
|
|
234
|
-
default: content = `<div id="station-
|
|
235
|
-
<
|
|
236
|
-
|
|
257
|
+
default: content = `<div id="station-member-sessions">${regions["station-member-sessions"]}</div>
|
|
258
|
+
<div id="station-overview">${regions["station-overview"]}</div>
|
|
259
|
+
<details class="drawer" id="cue-activity">
|
|
260
|
+
<summary>Cue activity</summary>
|
|
237
261
|
<p class="muted">Recent reminders, including ones that couldn’t be delivered or woke a member.</p>
|
|
238
262
|
<div id="cue-activity-content">${regions["cue-activity-content"]}</div>
|
|
239
|
-
</
|
|
263
|
+
</details>`;
|
|
240
264
|
}
|
|
241
265
|
return layout(name, `<a class="back" href="/stations">← Stations</a>
|
|
242
|
-
<div data-station-live="${esc(station_id)}"><header class="page-heading"><div><div class="title-row"><h1>${esc(name)}</h1><div class="status-group" id="station-state">${regions["station-state"]}</div></div>
|
|
266
|
+
<div data-station-live="${esc(station_id)}"><header class="page-heading station-heading"><div class="station-heading-copy"><div class="title-row"><h1>${esc(name)}</h1><div class="status-group" id="station-state">${regions["station-state"]}</div></div>
|
|
243
267
|
<p id="station-summary">${regions["station-summary"]}</p><small data-station-connection role="status">Connecting to live updates…</small></div>
|
|
244
|
-
<a class="primary-link" href="/sessions?view=new&station=${encodeURIComponent(station_id)}"
|
|
268
|
+
<a class="primary-link station-start" href="/sessions?view=new&station=${encodeURIComponent(station_id)}">${consoleIcon("plus")} Start member session</a></header>
|
|
245
269
|
${activityPanel(station_id)}${viewNav("Station sections", stationViews, view)}<div class="resource-content">${hasRosterControls(view) ? `<details class="drawer activity-secondary"><summary>Station operations & queued changes</summary>${queueCard(station, regions)}</details>` : ""}${content}</div></div>`, "station");
|
|
246
270
|
}
|
|
247
271
|
export function stationRevisionPage(station, pages) {
|
package/dist/daemon/host.js
CHANGED
|
@@ -2,6 +2,7 @@ import * as fs from "node:fs";
|
|
|
2
2
|
import * as net from "node:net";
|
|
3
3
|
import * as path from "node:path";
|
|
4
4
|
import { spawn } from "node:child_process";
|
|
5
|
+
import { randomUUID } from "node:crypto";
|
|
5
6
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
6
7
|
import { acquireLock, ensureJaXonPreset, migrateLegacyCredentials, } from "../agents/directory-store.js";
|
|
7
8
|
import { OperationsCore } from "../ops/core.js";
|
|
@@ -155,6 +156,8 @@ export async function main() {
|
|
|
155
156
|
let restartTimer = null;
|
|
156
157
|
let restartCheckScheduled = false;
|
|
157
158
|
const startedAt = Date.now();
|
|
159
|
+
// Identifies this running daemon process in `jaxon://console` (changes on restart).
|
|
160
|
+
const daemonInstance = randomUUID();
|
|
158
161
|
const checkDiskFingerprint = (checkMtime) => {
|
|
159
162
|
const current = computeFingerprint({ checkMtime });
|
|
160
163
|
if (!current)
|
|
@@ -249,8 +252,12 @@ export async function main() {
|
|
|
249
252
|
const result = header.identity === "agent" && request.op === "upgrade" ? await updater.command(request.params, header.offer?.node)
|
|
250
253
|
: header.identity === "member" ? await ops.executeMember(header, request.op, request.params ?? {})
|
|
251
254
|
: await ops.execute("agent", request.op, request.params ?? {}, header.identity === "jaxon" ? "jaxon" : "master");
|
|
255
|
+
// The human CLI guide needs one bit, not the connection list or a new public tool.
|
|
256
|
+
const guide = request.params?.include_connections_configured === true;
|
|
257
|
+
const payload = header.identity === "agent" && request.op === "service_status" && guide
|
|
258
|
+
? { ...result, connections_configured: ops.connections.list().length > 0 } : result;
|
|
252
259
|
if (!socket.destroyed)
|
|
253
|
-
socket.write(JSON.stringify({ id, result }) + "\n");
|
|
260
|
+
socket.write(JSON.stringify({ id, result: payload }) + "\n");
|
|
254
261
|
if (header.identity === "agent" && request.op !== "upgrade")
|
|
255
262
|
updater?.offer(header.offer);
|
|
256
263
|
}
|
|
@@ -281,8 +288,7 @@ export async function main() {
|
|
|
281
288
|
scheduleRestartCheck();
|
|
282
289
|
const connection = new AbortController();
|
|
283
290
|
const server = createMcpServer(ops, connection.signal);
|
|
284
|
-
//
|
|
285
|
-
server.server.oninitialized = () => server.server.sendToolListChanged().catch(() => { });
|
|
291
|
+
// oninitialized (including a relay replay) refreshes tools and resources; it is set by createMcpServer.
|
|
286
292
|
activeMcp.add(server);
|
|
287
293
|
socket.once("close", () => {
|
|
288
294
|
connection.abort();
|
|
@@ -351,8 +357,12 @@ export async function main() {
|
|
|
351
357
|
ops.serviceInfo = () => ({
|
|
352
358
|
version,
|
|
353
359
|
fingerprint,
|
|
360
|
+
mode,
|
|
354
361
|
outdated: updater?.outdated ?? outdated,
|
|
355
362
|
console_url: web.url,
|
|
363
|
+
port,
|
|
364
|
+
bind: "127.0.0.1",
|
|
365
|
+
daemon_instance: daemonInstance,
|
|
356
366
|
sessions: ops.supervisor.sessionCounts(),
|
|
357
367
|
runtime: updater?.status() ?? { mode, version },
|
|
358
368
|
});
|
|
@@ -367,6 +377,7 @@ export async function main() {
|
|
|
367
377
|
version,
|
|
368
378
|
fingerprint,
|
|
369
379
|
port,
|
|
380
|
+
daemon_instance: daemonInstance,
|
|
370
381
|
started_at: startedAt,
|
|
371
382
|
});
|
|
372
383
|
if (RELEASE) {
|