jaxon-agents 0.1.0 → 0.2.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.md +39 -31
- package/README.zh-CN.md +42 -34
- package/dist/BUILD_INFO.json +3 -3
- package/dist/PACKAGE_MANIFEST.json +31 -25
- package/dist/RELEASE_META.json +8 -2
- package/dist/api/mcp-tools.js +5 -4
- package/dist/connections/health.js +4 -1
- package/dist/console/activity-client.js +620 -0
- package/dist/console/activity-page.js +24 -0
- package/dist/console/activity-topics.js +640 -0
- package/dist/console/activity.js +379 -0
- package/dist/console/assets.js +207 -16
- package/dist/console/pages.js +38 -17
- package/dist/console/server.js +51 -5
- package/dist/console/station-pages.js +40 -6
- package/dist/daemon/client.js +1 -1
- package/dist/daemon/host.js +2 -0
- package/dist/environment/pi-launch-spec.js +1 -1
- package/dist/ops/catalog.js +1 -0
- package/dist/ops/core.js +89 -35
- package/dist/pi-host/history-reader.js +20 -0
- package/dist/pi-host/mcp-bridge.entry.js +22 -5
- package/dist/sessions/dashboard-usage.js +5 -3
- package/dist/sessions/supervisor.js +391 -31
- package/dist/stations/cues.js +59 -48
- package/dist/stations/interactions.js +75 -0
- package/dist/stations/member-instructions.js +25 -0
- package/dist/stations/station-member.entry.js +6 -6
- package/package.json +8 -2
- package/runtime/provenance.json +3 -3
- package/runtime/runtime-lock.json +2 -2
- package/runtime/runtime-package.json +1 -1
package/dist/console/assets.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ACTIVITY_JS } from "./activity-client.js";
|
|
1
2
|
export const JAXON_LOGO_URL = "/assets/jaxon-logo.svg";
|
|
2
3
|
export const STYLE_CSS = String.raw `
|
|
3
4
|
:root{color-scheme:dark;--bg:#0d1117;--panel:#151b23;--panel2:#1c2430;--text:#e6edf3;--muted:#9aa7b5;--line:#303a46;--accent:#6ca8ff;--green:#4ec98b;--red:#ff7b72;--yellow:#e3b341;font:15px/1.5 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text)}a{color:var(--accent);text-decoration:none}a:hover{text-decoration:underline}.topbar{position:sticky;top:0;z-index:5;display:flex;align-items:center;gap:2rem;padding:.8rem max(1rem,calc((100vw - 1440px)/2));background:#0d1117ee;border-bottom:1px solid var(--line);backdrop-filter:blur(10px)}.brand{font-weight:750;color:var(--text);white-space:nowrap}.topbar nav{display:flex;gap:1.2rem;flex-wrap:wrap}main{max-width:1440px;margin:0 auto;padding:1.5rem}main.login{max-width:720px;padding-top:12vh}footer{max-width:1440px;margin:2rem auto;padding:1rem;color:var(--muted);border-top:1px solid var(--line)}h1{font-size:1.8rem;line-height:1.2;margin:.2rem 0}h2{font-size:1.2rem;margin:.2rem 0 1rem}h3{font-size:1rem;margin:.3rem 0}p{margin:.5rem 0}.page-heading,.section-heading{display:flex;justify-content:space-between;align-items:center;gap:1rem}.page-heading{margin-bottom:1.2rem}.page-heading p,.muted,small{color:var(--muted)}section{margin:1.5rem 0}.card{background:var(--panel);border:1px solid var(--line);border-radius:10px;padding:1.1rem;margin:1rem 0}.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:1rem}.cards.three{grid-template-columns:repeat(auto-fit,minmax(300px,1fr))}.cards.two{grid-template-columns:repeat(auto-fit,minmax(360px,1fr))}.banner{padding:1rem;border:1px solid var(--yellow);border-radius:8px;background:#e3b34112}.banner.error,.error{border-color:var(--red)}.warning{color:#f0d79a}.badge{display:inline-block;padding:.18rem .5rem;border-radius:999px;background:#303a46;color:var(--text);font-size:.78rem;font-weight:650;white-space:nowrap}.badge.ready,.badge.active,.badge.succeeded,.badge.fulfilled,.badge.completed{background:#174d35;color:#8ff0bc}.badge.open,.badge.running,.badge.starting,.badge.testing,.badge.waiting_input{background:#204779;color:#acd0ff}.badge.expired,.badge.failed,.badge.test_failed,.badge.degraded,.badge.cancelled{background:#5b2528;color:#ffb3ad}.badge.idle,.badge.dismissed,.badge.dormant{background:#3c3420;color:#eed493}dl.details{display:grid;grid-template-columns:minmax(110px,max-content) 1fr;gap:.4rem 1rem}dl.details dt{color:var(--muted)}dl.details dd{margin:0;min-width:0;overflow-wrap:anywhere}code,pre,textarea,input,select{font-family:ui-monospace,SFMono-Regular,Consolas,monospace}code{overflow-wrap:anywhere}pre{white-space:pre-wrap;overflow-wrap:anywhere;background:#0b1016;border:1px solid var(--line);padding:.75rem;border-radius:6px;max-height:36rem;overflow:auto}form{margin:.65rem 0}label{display:block;margin:.6rem 0;color:var(--muted)}input,textarea,select{display:block;width:100%;margin-top:.25rem;background:#0b1016;border:1px solid #3a4654;border-radius:6px;color:var(--text);padding:.55rem .65rem}input[type=checkbox]{display:inline-block;width:auto;margin-right:.4rem}input[readonly]{opacity:.75}textarea{resize:vertical;min-height:5rem}button{border:1px solid #3478c9;background:#2764aa;color:white;border-radius:6px;padding:.5rem .8rem;cursor:pointer;font-weight:600}button:hover{filter:brightness(1.15)}button:disabled{opacity:.55;cursor:wait}button.secondary{background:#252f3b;border-color:#4a5868}button.danger{background:#702e32;border-color:#a7464b}.actions{display:flex;gap:.45rem;align-items:flex-start;flex-wrap:wrap}.actions form{margin:.2rem 0}.inline-form{display:flex;align-items:end;gap:.6rem;flex-wrap:wrap}.inline-form label{margin:0}.grid-form{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:.2rem 1rem}.grid-form button{align-self:end;justify-self:start}.filters{display:flex;align-items:end;gap:.8rem;flex-wrap:wrap;background:var(--panel);padding:.8rem;border-radius:8px}.filters label{min-width:160px;margin:0}.table-wrap{overflow-x:auto;border:1px solid var(--line);border-radius:8px}table{width:100%;border-collapse:collapse;background:var(--panel)}th,td{text-align:left;vertical-align:top;padding:.65rem;border-bottom:1px solid var(--line)}th{color:var(--muted);font-size:.82rem;background:var(--panel2)}tr:last-child td{border-bottom:0}.empty{color:var(--muted);font-style:italic}.stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:1rem}.stats div{background:var(--panel);border:1px solid var(--line);padding:1rem;border-radius:8px}.stats strong,.stats span{display:block}.stats strong{font-size:1.7rem}.stats span{color:var(--muted)}.danger-zone{border-color:#643237}.toast{position:fixed;right:1rem;bottom:1rem;z-index:10;max-width:480px;background:#243143;border:1px solid var(--accent);border-radius:8px;padding:.8rem 1rem;box-shadow:0 8px 30px #0008;white-space:pre-wrap}.toast.error{background:#482429;border-color:var(--red)}details{margin:.5rem 0}summary{cursor:pointer}summary h2{display:inline}.file pre{font-size:.82rem}.message{max-width:1100px;margin:1rem 0;padding:1rem;background:var(--panel);border:1px solid var(--line);border-radius:9px}.message.user{border-left:3px solid var(--accent)}.message.assistant{border-left:3px solid var(--green)}.message>header{display:flex;justify-content:space-between;gap:1rem}.message-text{background:transparent;border:0;padding:.2rem;max-height:none}.message img{display:block;max-width:min(100%,900px);max-height:700px;border-radius:6px}.message figcaption{color:var(--muted);font-size:.8rem}.terminal{background:#05080b;color:#b8f3cc;min-height:8rem;max-height:34rem;white-space:pre-wrap}.usage-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:1rem}.flow-events{padding-left:1.5rem}.flow-events li{margin:.8rem 0;padding-left:.3rem}.flow-events time{display:block;color:var(--muted);font-size:.8rem}.device-code{font-size:1.5rem;color:#ffe29a}.auth-link{font-size:1.1rem;font-weight:700}.secret-input{-webkit-text-security:disc}.flow-prompt{border-top:1px solid var(--line);padding-top:.7rem}@media(max-width:700px){main{padding:1rem}.topbar{align-items:flex-start;gap:.6rem;flex-direction:column}.topbar nav{gap:.8rem}.cards.two,.cards.three{grid-template-columns:1fr}dl.details{grid-template-columns:1fr}dl.details dd{margin-bottom:.5rem}.page-heading{align-items:flex-start}.table-wrap{font-size:.85rem}}
|
|
@@ -5,7 +6,7 @@ export const STYLE_CSS = String.raw `
|
|
|
5
6
|
:root {
|
|
6
7
|
--bg: #10161d; --panel: #18212b; --panel2: #202c38; --line: #303e4b;
|
|
7
8
|
--text: #ecf2f5; --muted: #a3b3c2; --accent: #99dccc; --conn-accent: var(--accent);
|
|
8
|
-
--conn-edge: var(--line); --rail-width: 13rem;
|
|
9
|
+
--conn-edge: var(--line); --rail-width: 13rem; --control-height: max(44px, 2.75rem);
|
|
9
10
|
font-family: Inter, "Segoe UI", system-ui, sans-serif;
|
|
10
11
|
}
|
|
11
12
|
body { min-height: 100vh; }
|
|
@@ -53,6 +54,18 @@ button { min-height: 36px; border-radius: 7px; font: inherit; font-weight: 600;
|
|
|
53
54
|
.form-advanced { padding: .75rem 0; margin: .45rem 0; border-block: 1px solid var(--line); }
|
|
54
55
|
.card label, .filters label { color: #c8d5df; font-size: .92rem; }
|
|
55
56
|
input, select, textarea { font-family: inherit; font-size: 1rem; padding: .6rem .75rem; border-radius: 7px; }
|
|
57
|
+
:is(select, input:not([type="hidden"], [type="checkbox"], [type="radio"], [type="file"], [type="range"], [type="color"], [type="submit"], [type="button"], [type="reset"], [type="image"])) {
|
|
58
|
+
block-size: var(--control-height);
|
|
59
|
+
min-inline-size: 0;
|
|
60
|
+
}
|
|
61
|
+
:is(select, input:not([type="hidden"], [type="checkbox"], [type="radio"], [type="file"], [type="range"], [type="color"], [type="submit"], [type="button"], [type="reset"], [type="image"])), .conn-panel textarea {
|
|
62
|
+
margin-top: .4rem; border-radius: 8px; border-color: #455260; padding: .67rem .8rem;
|
|
63
|
+
background: #0f161e; color: #eff5f7; line-height: 1.4; font-weight: 400;
|
|
64
|
+
}
|
|
65
|
+
select { appearance: auto; cursor: pointer; padding-inline-end: 1.75rem; }
|
|
66
|
+
select:disabled { cursor: default; }
|
|
67
|
+
:is(.grid-form, .model-fields) > label:has(> :is(input:not([type="checkbox"], [type="radio"], [type="file"]), select)) { align-self: end; min-width: 0; }
|
|
68
|
+
.inline-form > button { min-block-size: var(--control-height); }
|
|
56
69
|
textarea[data-json], textarea[data-json-required], .secret-input { font-family: ui-monospace, monospace; font-size: .9rem; }
|
|
57
70
|
.stats { gap: .85rem; margin-bottom: 1.8rem; }
|
|
58
71
|
.stats > :is(a,div) { display: flex; flex-direction: column; align-items: start; gap: .2rem; padding: 1rem 1.25rem; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
|
|
@@ -86,8 +99,7 @@ td a { font-weight: 550; }
|
|
|
86
99
|
.badge.effective, .badge.activeowner { background:#174d35; color:#8ff0bc; }
|
|
87
100
|
.station-pending { border-inline-start:3px solid #b49150; }
|
|
88
101
|
.station-pending .row-actions { flex-wrap:wrap; }
|
|
89
|
-
.station-add-member {
|
|
90
|
-
.station-add-member :is(select, button) { min-height:40px; }
|
|
102
|
+
.station-add-member { margin-block:1rem; }
|
|
91
103
|
.station-ask-jaxon { margin-top:1.1rem; border-color:#507f73; background:#233b3a; }
|
|
92
104
|
.station-ask-jaxon .actions { align-items:center; margin-top:.75rem; }
|
|
93
105
|
.station-board h3 { overflow-wrap:anywhere; }
|
|
@@ -108,10 +120,14 @@ section > .empty, main > .empty { padding: 1rem 1.25rem; background: var(--panel
|
|
|
108
120
|
display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.35fr) auto;
|
|
109
121
|
align-items: end; gap: .8rem; padding: 0;
|
|
110
122
|
}
|
|
123
|
+
.filters-four { grid-template-columns: repeat(4, minmax(0, 1fr)) auto; }
|
|
111
124
|
.filters > label { display: grid; gap: .4rem; min-width: 0; margin: 0; }
|
|
112
125
|
.filters > label > :is(input, select) { margin: 0; min-width: 0; }
|
|
113
126
|
.filter-actions { display: flex; align-items: center; gap: .45rem; }
|
|
114
127
|
.filter-actions :is(a, button) { display: inline-flex; align-items: center; justify-content: center; height: var(--control-height); padding-inline: .85rem; }
|
|
128
|
+
@container (max-width: 49rem) {
|
|
129
|
+
.filters-four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
130
|
+
}
|
|
115
131
|
@container (max-width: 42rem) {
|
|
116
132
|
.filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
117
133
|
}
|
|
@@ -145,6 +161,8 @@ section > .empty, main > .empty { padding: 1rem 1.25rem; background: var(--panel
|
|
|
145
161
|
.tool-summary { min-width: 0; color: var(--muted); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
146
162
|
.tool-status { color: var(--muted); font-size: .72rem; font-weight: 600; }
|
|
147
163
|
.tool-status.completed { color: #8ff0bc; }
|
|
164
|
+
.session-thinking .tool-output { color:#b4c3d0; }
|
|
165
|
+
.session-thinking-placeholder { display:flex; flex-wrap:wrap; gap:.35rem .75rem; padding:.55rem .65rem; color:var(--muted); }
|
|
148
166
|
.tool-status.failed { color: #ffb3ad; }
|
|
149
167
|
.tool-call > pre, .tool-detail { margin: 0 .55rem .55rem; }
|
|
150
168
|
.tool-output { max-height: 22rem; overflow: auto; font-size: .82rem; line-height: 1.5; }
|
|
@@ -266,11 +284,7 @@ section > .empty, main > .empty { padding: 1rem 1.25rem; background: var(--panel
|
|
|
266
284
|
.conn-kind input { width: auto; margin: 0; accent-color: var(--conn-accent); }
|
|
267
285
|
.conn-panel label small { color: #a9b7c5; font-weight: 400; }
|
|
268
286
|
.conn-panel input + small { display: block; margin-top: .3rem; }
|
|
269
|
-
|
|
270
|
-
select, input:where(:not([type]), [type="text"], [type="url"], [type="password"], [type="number"], [type="search"], [type="email"]) { height: var(--control-height); }
|
|
271
|
-
select, input:where(:not([type]), [type="text"], [type="url"], [type="password"], [type="number"], [type="search"], [type="email"]), .conn-panel textarea { min-height: var(--control-height); margin-top: .4rem; border-radius: 8px; border-color: #455260; padding: .67rem .8rem; background: #0f161e; color: #eff5f7; line-height: 1.4; font-family: inherit; font-size: 1rem; font-weight: 400; }
|
|
272
|
-
select { appearance: auto; cursor: pointer; padding-inline-end: 1.75rem; }
|
|
273
|
-
select:disabled { cursor: default; }
|
|
287
|
+
.conn-panel textarea { min-height: var(--control-height); }
|
|
274
288
|
.conn-panel :is(input, textarea)::placeholder { color: #8797a6; }
|
|
275
289
|
.conn-panel :is(input, textarea, select, summary, button):focus-visible { outline: 2px solid var(--conn-accent); outline-offset: 3px; }
|
|
276
290
|
.conn-panel button { min-height: 40px; border-radius: 8px; padding-inline: 1rem; }
|
|
@@ -362,6 +376,140 @@ select:disabled { cursor: default; }
|
|
|
362
376
|
#jaxon-question pre { max-height:9rem; }
|
|
363
377
|
body:has(.jaxon-dock) main { padding-bottom:6rem; }
|
|
364
378
|
body:has(#jaxon-launch:not([hidden])) .toast { bottom:4.9rem; }
|
|
379
|
+
|
|
380
|
+
.activity-panel {
|
|
381
|
+
position:relative; margin:0 0 1.5rem; padding:clamp(.9rem,2vw,1.5rem); border:1px solid #303e4b;
|
|
382
|
+
border-radius:17px; background:radial-gradient(ellipse at 0 0,#17232d,transparent 58%),#0d151d;
|
|
383
|
+
}
|
|
384
|
+
.activity-panel [hidden] { display:none !important; }
|
|
385
|
+
.activity-header,.activity-meta,.activity-tools { display:flex; align-items:center; justify-content:space-between; gap:.75rem; flex-wrap:wrap; }
|
|
386
|
+
.activity-header { align-items:end; }
|
|
387
|
+
.activity-heading { min-width:0; }
|
|
388
|
+
.activity-heading h2 { margin:.15rem 0 0; font-size:clamp(1.2rem,2vw,1.7rem); letter-spacing:-.025em; overflow-wrap:anywhere; }
|
|
389
|
+
.activity-heading h2 a { color:inherit; }
|
|
390
|
+
.activity-kicker { display:flex; gap:.45rem; align-items:center; color:#9ab3bc; font-size:.69rem; font-weight:650; letter-spacing:.15em; text-transform:uppercase; }
|
|
391
|
+
.activity-kicker span { width:.42rem; height:.42rem; background:#91e2cd; border-radius:1px; rotate:45deg; box-shadow:0 0 11px #72ccb18c; }
|
|
392
|
+
.activity-all { font-size:.81rem; margin-inline-end:.35rem; }
|
|
393
|
+
.activity-window { display:flex; padding:3px; gap:3px; border:1px solid #34434f; border-radius:10px; background:#0d151c; }
|
|
394
|
+
.activity-window button { min-height:29px; min-width:2.4rem; padding:.15rem .45rem; border:1px solid transparent; border-radius:7px; color:#a9bac8; background:transparent; font-size:.75rem; font-variant-numeric:tabular-nums; }
|
|
395
|
+
.activity-window button:hover { color:#e4ffff; background:#1b2934; }
|
|
396
|
+
.activity-window button[aria-pressed="true"] { border-color:#41605e; color:#c5fff0; background:#1d3437; }
|
|
397
|
+
.activity-meta { margin:.85rem 0 .48rem; min-height:1.1rem; font-size:.72rem; }
|
|
398
|
+
.activity-legend { display:flex; gap:.9rem; flex-wrap:wrap; color:#adbdcc; }
|
|
399
|
+
.activity-legend span { display:flex; align-items:center; gap:.35rem; }
|
|
400
|
+
.activity-legend span::before { content:""; display:block; width:17px; border-top:3px solid #ffc981; }
|
|
401
|
+
.activity-legend [data-link="report"]::before { border-color:#85e3ff; border-top-width:2px; }
|
|
402
|
+
.activity-legend [data-link="cue"]::before { border-color:#cbafff; border-top-style:dashed; border-top-width:2px; }
|
|
403
|
+
.activity-batch { color:#a6bdc9; }
|
|
404
|
+
.activity-offline .activity-batch { color:#f2c484; }
|
|
405
|
+
.activity-empty { margin:.65rem 0; padding:.6rem .8rem; border:1px solid #293845; border-radius:8px; color:#bdcbd5; font-size:.82rem; }
|
|
406
|
+
.activity-scene { position:relative; overflow:clip; border-radius:12px; container-type:inline-size; }
|
|
407
|
+
.activity-stage {
|
|
408
|
+
position:relative; isolation:isolate; border-radius:12px;
|
|
409
|
+
background:radial-gradient(circle,#6a97b137 1px,transparent 1.2px) 0 0/17px 17px,#0b131b;
|
|
410
|
+
box-shadow:inset 0 0 0 1px #2b3c4b;
|
|
411
|
+
}
|
|
412
|
+
.activity-outgoing { position:absolute; z-index:3; inset:0 0 auto; overflow:hidden; pointer-events:none; }
|
|
413
|
+
.activity-nodes {
|
|
414
|
+
position:relative; z-index:1; display:grid; align-items:start; grid-template-columns:minmax(0,1fr) 7.5rem minmax(0,1fr);
|
|
415
|
+
gap:1.45rem; padding:.65rem 1.35rem;
|
|
416
|
+
}
|
|
417
|
+
.activity-agent-lanes { display:contents; }
|
|
418
|
+
.activity-hub { grid-area:1 / 2; }
|
|
419
|
+
.activity-lane { display:flex; flex-direction:column; gap:.45rem; min-width:0; }
|
|
420
|
+
.activity-lane:first-child { grid-area:1 / 1; }
|
|
421
|
+
.activity-lane:last-child { grid-area:1 / 3; }
|
|
422
|
+
.activity-node {
|
|
423
|
+
--role:hsl(var(--role-hue) 75% 77%);
|
|
424
|
+
--card-opacity:.60;
|
|
425
|
+
position:relative; isolation:isolate; min-width:0; contain:layout;
|
|
426
|
+
padding:.32rem .44rem; border:1px solid #4a6576; border-radius:8px; background:#142331;
|
|
427
|
+
opacity:var(--card-opacity); transition:opacity 500ms ease;
|
|
428
|
+
}
|
|
429
|
+
.activity-node:not(.master):is(:hover,:focus-within) { --card-opacity:.92; }
|
|
430
|
+
.activity-node.master,.activity-node.active,.activity-node.active:is(:hover,:focus-within) { --card-opacity:1; }
|
|
431
|
+
.activity-node.master {
|
|
432
|
+
padding:.36rem .4rem; border-color:#ab874b; background:#23231f;
|
|
433
|
+
box-shadow:0 0 16px #ffc98125,inset 0 0 0 1px #ffc98115;
|
|
434
|
+
}
|
|
435
|
+
.activity-light { position:absolute; inset:-1px; z-index:-1; pointer-events:none; border-radius:inherit; opacity:var(--heat,0); transition:opacity 550ms linear;
|
|
436
|
+
border:1px solid color-mix(in srgb,var(--role) 58%,#354858);
|
|
437
|
+
background:linear-gradient(130deg,color-mix(in srgb,var(--role) 12%,transparent),transparent 72%);
|
|
438
|
+
box-shadow:0 0 17px color-mix(in srgb,var(--role) 14%,transparent);
|
|
439
|
+
}
|
|
440
|
+
.activity-node-head { display:flex; align-items:center; gap:.38rem; min-height:1.7rem; }
|
|
441
|
+
.activity-emblem { position:relative; isolation:isolate; display:grid; place-items:center; flex:0 0 1.6rem; height:1.6rem;
|
|
442
|
+
margin:0; border:1px solid color-mix(in srgb,var(--role) 55%,#334352); border-radius:50%;
|
|
443
|
+
background:#0d1721; color:var(--role); font:600 .82rem/1 ui-monospace,monospace;
|
|
444
|
+
}
|
|
445
|
+
.master .activity-emblem { color:#ecd493; border-color:#998451; background:#191f1e; font-size:1.14rem; }
|
|
446
|
+
.activity-emblem::before { content:""; position:absolute; z-index:-1; inset:-5px; border-radius:inherit;
|
|
447
|
+
background:var(--role); opacity:0; pointer-events:none;
|
|
448
|
+
}
|
|
449
|
+
.activity-node.active .activity-emblem::before { animation:activity-glow 3.4s ease-in-out infinite; }
|
|
450
|
+
.activity-identity { flex:1; min-width:0; }
|
|
451
|
+
.activity-name { margin:0; min-width:0; color:var(--role); font-size:.88rem; line-height:1.2; }
|
|
452
|
+
.activity-name > :is(a,span) { display:block; max-width:100%; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; color:inherit; }
|
|
453
|
+
.activity-name a:hover { text-underline-offset:3px; }
|
|
454
|
+
.activity-count { display:block; margin-top:1px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; color:#c0cfda; font-size:.65rem; line-height:1.12; font-variant-numeric:tabular-nums; }
|
|
455
|
+
.master .activity-count { white-space:normal; }
|
|
456
|
+
.activity-gear { display:grid; place-items:center; flex:0 0 1.5rem; height:1.5rem; border-radius:6px; color:#b6c8d6; font-size:.95rem; line-height:1; }
|
|
457
|
+
.activity-gear:hover,.activity-gear:focus-visible { color:#eafaff; background:#283c4b; text-decoration:none; }
|
|
458
|
+
.activity-sessions { max-height:4.32rem; overflow:auto; scrollbar-width:thin; scrollbar-color:#4a6070 #141e29; scrollbar-gutter:stable; }
|
|
459
|
+
.activity-session-stack { display:flex; flex-direction:column; gap:2px; }
|
|
460
|
+
.activity-session-stack:has(.activity-session,.activity-more:not([hidden])) { padding-top:.23rem; }
|
|
461
|
+
.activity-session { display:grid; grid-template-columns:auto auto auto minmax(0,1fr); align-items:center; column-gap:.22rem; flex:none;
|
|
462
|
+
min-height:1.25rem; padding:0 .35rem; overflow:hidden; border:1px solid #2b3d4e; border-radius:5px;
|
|
463
|
+
background:#172632; color:#ddebf4; font-size:.75rem; line-height:1.3;
|
|
464
|
+
}
|
|
465
|
+
.activity-session:is(:hover,:focus-visible) { color:#fff; border-color:var(--role); background:#243745; text-decoration:none; outline-offset:-1px; }
|
|
466
|
+
.activity-session.closed { color:#a7b7c4; background:#17212b; }
|
|
467
|
+
.activity-session.activity-fallback:not(:hover,:focus-visible) { color:#aebfcb; }
|
|
468
|
+
.activity-more { padding:.14rem .35rem; color:#bdd0de; font-size:.7rem; }
|
|
469
|
+
.cue-badge { display:inline-block; min-width:1.2em; padding:0 .28em; border:1px solid #8565b4; border-radius:5px; color:#ecd7ff; background:#34294c; font-size:.72rem; font-variant-numeric:tabular-nums; text-align:center; }
|
|
470
|
+
.activity-cue-count { grid-column:2; font-size:.62rem; }
|
|
471
|
+
.activity-cue-origin { grid-column:3; color:#ddbcff; font-weight:700; }
|
|
472
|
+
.activity-state-dot { grid-column:1; width:.43rem; height:.43rem; border-radius:50%; color:#8195a7; background:currentColor; }
|
|
473
|
+
.activity-state-dot[data-state="running"] { color:#8fe1b8; box-shadow:0 0 7px #8fe1b8a0; }
|
|
474
|
+
.activity-state-dot[data-state="waiting_input"] { color:#ffcc83; border-radius:1px; rotate:45deg; }
|
|
475
|
+
.activity-state-dot[data-state="queued"] { color:#8bbaff; box-shadow:inset 0 0 0 1px currentColor; background:transparent; }
|
|
476
|
+
.activity-state-dot[data-state="failed"] { color:#ff9594; border-radius:1px; }
|
|
477
|
+
.activity-state-dot[data-state="closed"] { color:#738797; }
|
|
478
|
+
.activity-topic-viewport { grid-column:4; display:block; min-width:0; overflow:hidden; white-space:nowrap; }
|
|
479
|
+
.activity-topic-viewport.overflowing { mask-image:linear-gradient(to right,#000 calc(100% - 6px),transparent); }
|
|
480
|
+
.activity-topic-track { display:block; width:max-content; }
|
|
481
|
+
.activity-tooltip { position:absolute; max-width:min(25rem,calc(100% - 20px)); z-index:4; padding:.48rem .65rem; border:1px solid #557182;
|
|
482
|
+
border-radius:8px; background:#1e303d; color:#eef8ff; box-shadow:0 10px 18px #0006; pointer-events:none; font-size:.76rem; overflow-wrap:anywhere;
|
|
483
|
+
}
|
|
484
|
+
.activity-edges { position:absolute; inset:0; z-index:0; width:100%; height:100%; overflow:hidden; pointer-events:none; }
|
|
485
|
+
.activity-edge {
|
|
486
|
+
fill:none; stroke-width:2.85; stroke-linecap:round; stroke:#ffc981;
|
|
487
|
+
stroke-opacity:calc(.23 + .77 * var(--heat,0)); transition:stroke-opacity 550ms linear;
|
|
488
|
+
}
|
|
489
|
+
.activity-edge.report { stroke:#85e3ff; stroke-width:2; }
|
|
490
|
+
.activity-edge.cue { stroke:#cbafff; stroke-width:2.35; stroke-dasharray:2 5; }
|
|
491
|
+
.activity-pulse { fill:#fff0d6; filter:drop-shadow(0 0 4px #ffc981); }
|
|
492
|
+
.activity-pulse.report { fill:#d9f8ff; filter:drop-shadow(0 0 4px #85e3ff); }
|
|
493
|
+
.activity-pulse.cue { fill:#f0e1ff; filter:drop-shadow(0 0 5px #cbafff); }
|
|
494
|
+
.activity-pulse.steer { fill:#ffe9c2; filter:drop-shadow(0 0 5px #ffad65); }
|
|
495
|
+
.activity-secondary > summary { color:var(--muted); }
|
|
496
|
+
@keyframes activity-glow { 0%,100% { opacity:.09; transform:scale(.9); } 46% { opacity:.22; transform:scale(1.06); } }
|
|
497
|
+
@container (max-width:41rem) {
|
|
498
|
+
.activity-nodes { grid-template-columns:6.8rem minmax(0,1fr); }
|
|
499
|
+
.activity-hub { grid-area:1 / 1; }
|
|
500
|
+
.activity-agent-lanes { grid-area:1 / 2; display:flex; flex-direction:column; gap:.45rem; }
|
|
501
|
+
.activity-lane:empty { display:none; }
|
|
502
|
+
}
|
|
503
|
+
@container (max-width:27rem) {
|
|
504
|
+
.activity-nodes { grid-template-columns:minmax(0,1fr); gap:.72rem; padding-left:1.6rem; }
|
|
505
|
+
.activity-agent-lanes { grid-area:2 / 1; }
|
|
506
|
+
.activity-node.master { max-width:8rem; }
|
|
507
|
+
}
|
|
508
|
+
@media(prefers-reduced-motion:reduce) {
|
|
509
|
+
.activity-panel *,.activity-panel *::before { animation:none !important; transition:none !important; }
|
|
510
|
+
.activity-topic-viewport.overflowing { mask-image:none; text-overflow:ellipsis; }
|
|
511
|
+
.activity-topic-viewport.overflowing .activity-topic-track { display:inline; }
|
|
512
|
+
}
|
|
365
513
|
`;
|
|
366
514
|
export const APP_JS = String.raw `
|
|
367
515
|
"use strict";
|
|
@@ -909,7 +1057,7 @@ function renderPending(pending, session, target) {
|
|
|
909
1057
|
function renderUsage(usage) {
|
|
910
1058
|
const target = document.getElementById("session-usage"); target.replaceChildren();
|
|
911
1059
|
const grid = el("div", {className: "usage-grid"});
|
|
912
|
-
for (const key of ["current_turn", "session_total", "task_total"]) grid.append(el("div", {}, [el("h3", {text: key.replaceAll("_", " ")}), el("pre", {text: JSON.stringify(usage?.[key] || {}, null, 2)})]));
|
|
1060
|
+
for (const key of ["current_turn", "session_total", "task_total", ...(usage?.by_origin?.cue ? ["by_origin"] : [])]) grid.append(el("div", {}, [el("h3", {text: key.replaceAll("_", " ")}), el("pre", {text: JSON.stringify(usage?.[key] || {}, null, 2)})]));
|
|
913
1061
|
target.append(grid);
|
|
914
1062
|
}
|
|
915
1063
|
if (document.body.dataset.page === "session") {
|
|
@@ -922,6 +1070,36 @@ if (document.body.dataset.page === "session") {
|
|
|
922
1070
|
const emptyHistory = document.getElementById("session-history-empty");
|
|
923
1071
|
const older = document.getElementById("session-older");
|
|
924
1072
|
const latest = document.getElementById("session-latest");
|
|
1073
|
+
const thinkingToggle = document.getElementById("session-thinking-toggle");
|
|
1074
|
+
const thinkingBlocks = area => [...area.querySelectorAll("details.session-thinking")];
|
|
1075
|
+
const thinkingKey = block => block.closest("[data-entry-id]").dataset.entryId + ":" + block.dataset.thinkingIndex;
|
|
1076
|
+
let thinkingDefault = false;
|
|
1077
|
+
const thinkingOverrides = new Map();
|
|
1078
|
+
function updateThinkingToggle() {
|
|
1079
|
+
const blocks = thinkingBlocks(history);
|
|
1080
|
+
thinkingToggle.hidden = !blocks.length;
|
|
1081
|
+
thinkingToggle.textContent = blocks.length && blocks.every(block => block.open)
|
|
1082
|
+
? thinkingToggle.dataset.collapse : thinkingToggle.dataset.expand;
|
|
1083
|
+
}
|
|
1084
|
+
function prepareThinking(area) {
|
|
1085
|
+
for (const block of thinkingBlocks(area)) block.open = thinkingOverrides.get(thinkingKey(block)) ?? thinkingDefault;
|
|
1086
|
+
return area;
|
|
1087
|
+
}
|
|
1088
|
+
history.addEventListener("toggle", event => {
|
|
1089
|
+
if (!event.target.matches("details.session-thinking")) return;
|
|
1090
|
+
thinkingOverrides.set(thinkingKey(event.target), event.target.open);
|
|
1091
|
+
updateThinkingToggle();
|
|
1092
|
+
}, true);
|
|
1093
|
+
thinkingToggle.onclick = () => {
|
|
1094
|
+
const blocks = thinkingBlocks(history);
|
|
1095
|
+
thinkingDefault = !blocks.every(block => block.open);
|
|
1096
|
+
thinkingOverrides.clear();
|
|
1097
|
+
for (const block of blocks) block.open = thinkingDefault;
|
|
1098
|
+
updateThinkingToggle();
|
|
1099
|
+
recordScrollPosition();
|
|
1100
|
+
};
|
|
1101
|
+
updateThinkingToggle();
|
|
1102
|
+
const cueTurn = conversation.dataset.cueTurn;
|
|
925
1103
|
let cursor = conversation.dataset.cursor;
|
|
926
1104
|
let before = conversation.dataset.before;
|
|
927
1105
|
let generation = 0;
|
|
@@ -966,7 +1144,7 @@ if (document.body.dataset.page === "session") {
|
|
|
966
1144
|
loadingOlder = true;
|
|
967
1145
|
updateOlderButton();
|
|
968
1146
|
try {
|
|
969
|
-
const response = await fetch(url + "/history?" + new URLSearchParams({before}));
|
|
1147
|
+
const response = await fetch(url + "/history?" + new URLSearchParams({before, ...(cueTurn ? {turn:cueTurn} : {})}));
|
|
970
1148
|
if (!response.ok) throw new Error("Could not load earlier messages (" + response.status + ")");
|
|
971
1149
|
const page = await response.json();
|
|
972
1150
|
if (version !== generation) return;
|
|
@@ -981,7 +1159,8 @@ if (document.body.dataset.page === "session") {
|
|
|
981
1159
|
// Measure after the fetch, so scrolling or live appends during the request are respected.
|
|
982
1160
|
const anchor = history.firstElementChild;
|
|
983
1161
|
const top = anchor ? relativeTop(anchor) : 0;
|
|
984
|
-
history.prepend(fragment(page.conversation));
|
|
1162
|
+
history.prepend(prepareThinking(fragment(page.conversation)));
|
|
1163
|
+
updateThinkingToggle();
|
|
985
1164
|
before = page.before;
|
|
986
1165
|
older.hidden = !before;
|
|
987
1166
|
if (anchor) scroll.scrollTop += relativeTop(anchor) - top;
|
|
@@ -996,7 +1175,14 @@ if (document.body.dataset.page === "session") {
|
|
|
996
1175
|
}
|
|
997
1176
|
|
|
998
1177
|
function replaceConversation(read, messages, followLatest) {
|
|
999
|
-
const
|
|
1178
|
+
const offsets = new Map();
|
|
1179
|
+
for (const block of thinkingBlocks(history)) {
|
|
1180
|
+
const key = thinkingKey(block);
|
|
1181
|
+
thinkingOverrides.set(key, block.open);
|
|
1182
|
+
const text = block.querySelector("pre");
|
|
1183
|
+
if (block.open && text.scrollTop) offsets.set(key, text.scrollTop);
|
|
1184
|
+
}
|
|
1185
|
+
const next = prepareThinking(fragment(messages));
|
|
1000
1186
|
let anchor, top;
|
|
1001
1187
|
if (!followLatest) {
|
|
1002
1188
|
const byId = new Map(Array.from(next.children, node => [node.dataset.entryId, node]));
|
|
@@ -1014,6 +1200,11 @@ if (document.body.dataset.page === "session") {
|
|
|
1014
1200
|
generation++;
|
|
1015
1201
|
before = read.history_before;
|
|
1016
1202
|
history.replaceChildren(next);
|
|
1203
|
+
for (const block of thinkingBlocks(history)) {
|
|
1204
|
+
const top = offsets.get(thinkingKey(block));
|
|
1205
|
+
if (top !== undefined) block.querySelector("pre").scrollTop = top;
|
|
1206
|
+
}
|
|
1207
|
+
updateThinkingToggle();
|
|
1017
1208
|
emptyHistory.hidden = Boolean(history.firstElementChild);
|
|
1018
1209
|
updateOlderButton();
|
|
1019
1210
|
if (anchor) {
|
|
@@ -1026,7 +1217,7 @@ if (document.body.dataset.page === "session") {
|
|
|
1026
1217
|
}
|
|
1027
1218
|
|
|
1028
1219
|
async function poll() {
|
|
1029
|
-
if (running) return;
|
|
1220
|
+
if (running || cueTurn) return;
|
|
1030
1221
|
running = true;
|
|
1031
1222
|
const requestedCursor = cursor;
|
|
1032
1223
|
const version = generation;
|
|
@@ -1041,7 +1232,8 @@ if (document.body.dataset.page === "session") {
|
|
|
1041
1232
|
cursor = read.cursor;
|
|
1042
1233
|
if (!requestedCursor || read.history_reset) replaceConversation(read, messages, followLatest);
|
|
1043
1234
|
else if (messages) {
|
|
1044
|
-
history.append(fragment(messages));
|
|
1235
|
+
history.append(prepareThinking(fragment(messages)));
|
|
1236
|
+
updateThinkingToggle();
|
|
1045
1237
|
emptyHistory.hidden = true;
|
|
1046
1238
|
if (followLatest) jumpToLatest();
|
|
1047
1239
|
else updateLatestButton();
|
|
@@ -1383,5 +1575,4 @@ function mountJaXonChat() {
|
|
|
1383
1575
|
document.addEventListener("console-operation", e => { if (e.detail.operation === "session_reply") void poll(); });
|
|
1384
1576
|
setInterval(poll, 2000);
|
|
1385
1577
|
}
|
|
1386
|
-
|
|
1387
|
-
`;
|
|
1578
|
+
` + ACTIVITY_JS + `\nmountStationActivity();\nmountJaXonChat();\n`;
|
package/dist/console/pages.js
CHANGED
|
@@ -3,6 +3,7 @@ import { builtinProviders } from "@earendil-works/pi-ai/providers/all";
|
|
|
3
3
|
import { JAXON_LOGO_URL } from "./assets.js";
|
|
4
4
|
import { attrJson, esc, formatTime, readinessOf } from "./util.js";
|
|
5
5
|
import { PAGE_SIZE } from "./pagination.js";
|
|
6
|
+
import { activityPanel } from "./activity-page.js";
|
|
6
7
|
const TOOLS = ["read", "write", "edit", "bash", "grep", "find", "ls"];
|
|
7
8
|
export function viewNav(label, items, active) {
|
|
8
9
|
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>`;
|
|
@@ -24,7 +25,7 @@ export function layout(title, body, page = "") {
|
|
|
24
25
|
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
|
25
26
|
<title>${esc(title)} · JaXon Agents</title>
|
|
26
27
|
<link rel="icon" type="image/svg+xml" href="${JAXON_LOGO_URL}">
|
|
27
|
-
<link rel="stylesheet" href="/assets/style.css?v=
|
|
28
|
+
<link rel="stylesheet" href="/assets/style.css?v=console-ui-1"><script src="/assets/app.js?v=console-ui-1" defer></script></head>
|
|
28
29
|
<body data-page="${esc(page)}"><a class="skip-link" href="#main">Skip to content</a>
|
|
29
30
|
<header class="rail"><a class="brand" href="/"><img class="brand-mark" src="${JAXON_LOGO_URL}" width="32" height="32" alt="">JaXon Agents</a>
|
|
30
31
|
<nav aria-label="Console">${links}</nav></header>
|
|
@@ -94,7 +95,7 @@ export function dashboardContent(data, pages) {
|
|
|
94
95
|
}
|
|
95
96
|
export function dashboardPage(data, pages) {
|
|
96
97
|
return layout("Dashboard", `<header class="page-heading"><h1>Overview</h1><span id="sse-state" class="muted">Connecting live updates…</span></header>
|
|
97
|
-
<div id="dashboard-content">${dashboardContent(data, pages)}</div>`, "dashboard");
|
|
98
|
+
${activityPanel("", true)}<div id="dashboard-content">${dashboardContent(data, pages)}</div>`, "dashboard");
|
|
98
99
|
}
|
|
99
100
|
const option = (value, label) => `<option value="${esc(value)}">${esc(label)}</option>`;
|
|
100
101
|
let apiOptions;
|
|
@@ -410,7 +411,7 @@ export function agentDetailPage(agent, connections, pages, view = "") {
|
|
|
410
411
|
content = `<section class="card"><h2>Instructions</h2>${agent.name === "JaXon" ? `<details class="form-advanced"><summary>System administration scope</summary><p>${esc(adminScope).replaceAll("\n\n", "</p><p>")}</p></details>` : ""}<form method="post" action="/api/op" data-op="agent_update" data-kind="agent-instructions" data-success="reload">${hidden("name", agent.name)}${hidden("expected_rev", rev)}<label>How should this agent work?<textarea name="instructions" rows="14">${esc(instructions)}</textarea></label>${submit("Publish instructions")}</form></section>`;
|
|
411
412
|
break;
|
|
412
413
|
case "revisions":
|
|
413
|
-
content = `<section class="card"><h2>Revision history & rollback</h2>${pages.list("revisions_page", "Revision history", revisions.slice().reverse(), rows => rows.length ? `<div class="table-wrap"><table><thead><tr><th>Revision</th><th>
|
|
414
|
+
content = `<section class="card" id="agent-revisions"><h2>Revision history & rollback</h2>${pages.list("revisions_page", "Revision history", revisions.slice().reverse(), rows => rows.length ? `<div class="table-wrap"><table class="resource-list"><thead><tr><th scope="col">Revision</th><th scope="col">Status</th><th scope="col" class="row-action-cell">Actions</th></tr></thead><tbody>${rows.map((r) => `<tr><td><code>${esc(r)}</code></td><td>${r === rev ? badge("Current") : "—"}</td><td class="row-action-cell"><div class="row-actions">${r === rev ? "—" : `<form method="post" action="/api/op" data-op="agent_update" data-success="reload" data-confirm="Publish a new revision copied from ${esc(r)}?">${hidden("name", agent.name)}${hidden("from_revision", r)}${hidden("expected_rev", rev)}${submit("Roll back", "secondary")}</form>`}</div></td></tr>`).join("")}</tbody></table></div>` : empty("No revision history returned."), "agent-revisions")}</section>
|
|
414
415
|
<details class="drawer" id="revision-files"${pages.request("files_page").number > 1 ? " open" : ""}><summary>Revision files · ${esc(rev)}</summary>${redactedFiles(agent.files ?? {}, pages)}</details>`;
|
|
415
416
|
break;
|
|
416
417
|
case "access":
|
|
@@ -458,7 +459,7 @@ export function sessionsPage(sessions, agents, pages, filters = {}, view = "", h
|
|
|
458
459
|
names.add(filters.agent);
|
|
459
460
|
const choices = [...names].map(name => ({ name, detail: installed.has(name) ? undefined : "Not installed" }));
|
|
460
461
|
const body = `<header class="page-heading"><h1>Sessions</h1><div class="actions"><a class="primary-link" href="?view=new">New session</a></div></header>
|
|
461
|
-
<details class="drawer filter-drawer"${Object.keys(filters).length ? " open" : ""}><summary>Filter sessions</summary><form class="filters" method="get">${agentSelect(choices, "filter", filters.agent)}<label>Status<select name="status"><option value="">All</option>${["starting", "running", "waiting_input", "stopping", "idle", "dormant", "failed", "closed"].map((s) => `<option ${filters.status === s ? "selected" : ""}>${s}</option>`).join("")}</select></label><label>Task ID<input name="task_id" value="${esc(filters.task_id)}"></label><label>Station<input name="station" value="${esc(filters.station)}"></label><div class="filter-actions">${submit("Filter", "secondary")}<a href="/sessions">Clear</a></div></form></details>
|
|
462
|
+
<details class="drawer filter-drawer"${Object.keys(filters).length ? " open" : ""}><summary>Filter sessions</summary><form class="filters filters-four" method="get">${agentSelect(choices, "filter", filters.agent)}<label>Status<select name="status"><option value="">All</option>${["starting", "running", "waiting_input", "stopping", "idle", "dormant", "failed", "closed"].map((s) => `<option ${filters.status === s ? "selected" : ""}>${s}</option>`).join("")}</select></label><label>Task ID<input name="task_id" value="${esc(filters.task_id)}"></label><label>Station<input name="station" value="${esc(filters.station)}"></label><div class="filter-actions">${submit("Filter", "secondary")}<a href="/sessions">Clear</a></div></form></details>
|
|
462
463
|
<div id="session-list">${pages.list("page", "Sessions", sessions, sessionRows, "session-list")}</div>`;
|
|
463
464
|
return layout("Sessions", body, "sessions");
|
|
464
465
|
}
|
|
@@ -482,7 +483,25 @@ function toolArgumentsSummary(args) {
|
|
|
482
483
|
return compactText(args.code);
|
|
483
484
|
return compactText(JSON.stringify(args));
|
|
484
485
|
}
|
|
485
|
-
|
|
486
|
+
const thinkingLabels = {
|
|
487
|
+
en: { title: "Thinking", redacted: "The provider encrypted this thinking; it cannot be displayed.", omitted: "Omitted", truncated: "Truncated", expand: "Expand all thinking", collapse: "Collapse all thinking" },
|
|
488
|
+
"zh-CN": { title: "思考过程", redacted: "思考内容已由提供方加密,无法显示。", omitted: "已省略", truncated: "已截断", expand: "展开全部思考", collapse: "折叠全部思考" },
|
|
489
|
+
};
|
|
490
|
+
function thinkingHtml(part, index, language) {
|
|
491
|
+
const labels = thinkingLabels[language];
|
|
492
|
+
const heading = `<span class="tool-heading"><strong>${labels.title}</strong></span>`;
|
|
493
|
+
const text = typeof part.text === "string" ? part.text : "";
|
|
494
|
+
const chars = part.chars ?? part.original_chars ?? [...text].length;
|
|
495
|
+
const count = language === "zh-CN" ? `${chars} 字` : `${chars} characters`;
|
|
496
|
+
if (part.redacted === true || part.omitted === true) {
|
|
497
|
+
const status = part.redacted === true ? labels.redacted : `${count} · ${labels.omitted}`;
|
|
498
|
+
return `<div class="tool-result session-thinking-placeholder" lang="${language}">${heading}<span class="tool-summary">${esc(status)}</span></div>`;
|
|
499
|
+
}
|
|
500
|
+
return `<details class="tool-result session-thinking" data-thinking-index="${index}" lang="${language}"><summary>${heading}<span class="tool-summary">${esc(count)}${part.truncated ? ` · ${labels.truncated}` : ""}</span></summary><div class="tool-detail"><pre class="tool-output">${esc(text)}</pre></div></details>`;
|
|
501
|
+
}
|
|
502
|
+
function historyPartHtml(sessionId, part, toolOutput, index, language) {
|
|
503
|
+
if (part?.type === "thinking")
|
|
504
|
+
return thinkingHtml(part, index, language);
|
|
486
505
|
if (part?.type === "text")
|
|
487
506
|
return `<pre class="${toolOutput ? "tool-output" : "message-text"}">${esc(part.text)}</pre>`;
|
|
488
507
|
if (part?.type === "image_ref" && part.artifact_path)
|
|
@@ -493,11 +512,11 @@ function historyPartHtml(sessionId, part, toolOutput = false) {
|
|
|
493
512
|
}
|
|
494
513
|
return `<details><summary>${esc(part?.type ?? "content")}</summary><pre>${esc(JSON.stringify(part, null, 2))}</pre></details>`;
|
|
495
514
|
}
|
|
496
|
-
function historyContentHtml(sessionId, content, toolOutput = false) {
|
|
515
|
+
function historyContentHtml(sessionId, content, language, toolOutput = false) {
|
|
497
516
|
if (typeof content === "string")
|
|
498
517
|
return `<pre class="${toolOutput ? "tool-output" : "message-text"}">${esc(content)}</pre>`;
|
|
499
518
|
if (Array.isArray(content))
|
|
500
|
-
return content.map(part => historyPartHtml(sessionId, part, toolOutput)).join("");
|
|
519
|
+
return content.map((part, index) => historyPartHtml(sessionId, part, toolOutput, index, language)).join("");
|
|
501
520
|
if (content !== undefined)
|
|
502
521
|
return `<pre class="${toolOutput ? "tool-output" : ""}">${esc(JSON.stringify(content, null, 2))}</pre>`;
|
|
503
522
|
return "";
|
|
@@ -509,19 +528,19 @@ function toolResultText(content) {
|
|
|
509
528
|
return content === undefined ? "" : JSON.stringify(content);
|
|
510
529
|
return content.filter(part => part?.type === "text").map(part => part.text).join("\n");
|
|
511
530
|
}
|
|
512
|
-
function toolResultHtml(sessionId, entry) {
|
|
531
|
+
function toolResultHtml(sessionId, entry, language) {
|
|
513
532
|
const failed = Boolean(entry.is_error);
|
|
514
533
|
const output = toolResultText(entry.content);
|
|
515
534
|
const summary = compactText(output) || (failed ? "Tool reported an error" : "Result available");
|
|
516
|
-
return `<details class="tool-result${failed ? " failed" : ""}"><summary><span class="tool-heading"><code>${esc(entry.tool_name || "tool")}</code><span class="tool-status ${failed ? "failed" : "completed"}">${failed ? "Failed" : "Completed"}</span></span><span class="tool-summary">${esc(summary)}</span></summary><div class="tool-detail">${historyContentHtml(sessionId, entry.content, true) || '<pre class="tool-output">(empty result)</pre>'}</div></details>`;
|
|
535
|
+
return `<details class="tool-result${failed ? " failed" : ""}"><summary><span class="tool-heading"><code>${esc(entry.tool_name || "tool")}</code><span class="tool-status ${failed ? "failed" : "completed"}">${failed ? "Failed" : "Completed"}</span></span><span class="tool-summary">${esc(summary)}</span></summary><div class="tool-detail">${historyContentHtml(sessionId, entry.content, language, true) || '<pre class="tool-output">(empty result)</pre>'}</div></details>`;
|
|
517
536
|
}
|
|
518
|
-
export function sessionHistoryContent(sessionId, history) {
|
|
537
|
+
export function sessionHistoryContent(sessionId, history, language) {
|
|
519
538
|
return history.map((entry) => {
|
|
520
539
|
const role = entry.role ?? entry.type ?? "event";
|
|
521
|
-
let body = role === "toolResult" ? toolResultHtml(sessionId, entry) : historyContentHtml(sessionId, entry.content);
|
|
540
|
+
let body = role === "toolResult" ? toolResultHtml(sessionId, entry, language) : historyContentHtml(sessionId, entry.content, language);
|
|
522
541
|
if (!body && entry.summary)
|
|
523
542
|
body = `<pre class="message-text">${esc(entry.summary)}</pre>`;
|
|
524
|
-
const speaker = role === "user" ? "You" : role === "assistant" ? "Agent" : role === "toolResult" ? "Tool result" : role;
|
|
543
|
+
const speaker = role === "user" ? entry.origin === "cue" ? "Cue" : "You" : role === "assistant" ? "Agent" : role === "toolResult" ? "Tool result" : role;
|
|
525
544
|
return `<article class="message" data-entry-id="${esc(entry.id)}" data-role="${esc(role)}"><header><strong>${esc(speaker)}</strong><small>${esc(entry.id ?? "")} · ${esc(formatTime(entry.timestamp))}</small></header>${body}</article>`;
|
|
526
545
|
}).join("");
|
|
527
546
|
}
|
|
@@ -536,17 +555,19 @@ export function pendingPromptHtml(pending, sessionId) {
|
|
|
536
555
|
return `<form method="post" action="/api/op" data-op="session_reply" data-kind="reply-text"><h3>${esc(pending.title ?? "Input required")}</h3>${base}<label>Response<textarea name="text" required></textarea></label>${submit("Send response")}</form>`;
|
|
537
556
|
}
|
|
538
557
|
function usageBlock(usage) {
|
|
539
|
-
return `<div class="usage-grid">${["current_turn", "session_total", "task_total"].map((key) => `<div><h3>${esc(key.replaceAll("_", " "))}</h3><pre>${esc(JSON.stringify(usage?.[key] ?? {}, null, 2))}</pre></div>`).join("")}</div>`;
|
|
558
|
+
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>`;
|
|
540
559
|
}
|
|
541
|
-
export function sessionDetailPage(sessionId, read, screen, isJaXon, membership) {
|
|
560
|
+
export function sessionDetailPage(sessionId, read, screen, isJaXon, membership, language, cueTurn) {
|
|
561
|
+
const labels = thinkingLabels[language];
|
|
542
562
|
const body = `<a class="back" href="/sessions">← Sessions</a>
|
|
563
|
+
${cueTurn ? `<p class="banner">Cue turn <code>${esc(cueTurn)}</code> · <a href="/sessions/${encodeURIComponent(sessionId)}">Return to live session</a></p>` : ""}
|
|
543
564
|
<header class="page-heading"><div><h1>Session</h1><p><code>${esc(sessionId)}</code></p>${membership ? `<div class="status-group">${badge(membership.seat ? "Seat" : "Independent")}</div>` : ""}</div><span id="session-status">${badge(read.status)}</span></header>
|
|
544
|
-
<section id="conversation" data-cursor="${esc(read.cursor)}" data-before="${esc(read.history_before)}">
|
|
545
|
-
<div class="section-heading"><h2 id="conversation-heading">Conversation</h2><button type="button" class="secondary" id="session-latest" hidden>Jump to latest</button></div>
|
|
565
|
+
<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="${language}" 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>
|
|
546
567
|
<div id="session-scroll" role="region" aria-labelledby="conversation-heading" tabindex="0">
|
|
547
568
|
<button type="button" class="secondary" id="session-older"${read.history_before ? "" : " hidden"}>Load earlier messages</button>
|
|
548
569
|
<p class="empty" id="session-history-empty"${read.history.length ? " hidden" : ""}>No messages yet.</p>
|
|
549
|
-
<div id="session-history">${sessionHistoryContent(sessionId, read.history)}</div>
|
|
570
|
+
<div id="session-history">${sessionHistoryContent(sessionId, read.history, language)}</div>
|
|
550
571
|
</div>
|
|
551
572
|
</section>
|
|
552
573
|
${isJaXon ? `<button type="button" data-ask-jaxon="${esc(sessionId)}">Open in Ask JaXon</button>` : `<section class="card" id="pending-prompt"${read.pending_request ? "" : " hidden"}><h2>Pending prompt</h2><div id="pending-body" data-signature="${esc(JSON.stringify(read.pending_request || null))}">${pendingPromptHtml(read.pending_request, sessionId)}</div></section>
|
package/dist/console/server.js
CHANGED
|
@@ -189,6 +189,49 @@ export class WebConsole {
|
|
|
189
189
|
send(response, 204);
|
|
190
190
|
return;
|
|
191
191
|
}
|
|
192
|
+
if (pathname === "/api/overview/activity") {
|
|
193
|
+
if (method !== "GET") {
|
|
194
|
+
sendJson(response, 405, { error: { code: "METHOD_NOT_ALLOWED" } });
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
const abort = new AbortController();
|
|
198
|
+
const closed = () => abort.abort();
|
|
199
|
+
response.once("close", closed);
|
|
200
|
+
try {
|
|
201
|
+
const result = await this.ops.activityGraph.overview(url.searchParams.get("window") ?? "10m", url.searchParams.get("since") ?? undefined, Number(url.searchParams.get("wait_ms") ?? 0), abort.signal);
|
|
202
|
+
sendJson(response, 200, sanitize(result));
|
|
203
|
+
}
|
|
204
|
+
catch (error) {
|
|
205
|
+
const data = errorData(error);
|
|
206
|
+
sendJson(response, data.code === "INVALID_WINDOW" ? 400 : 500, { error: data });
|
|
207
|
+
}
|
|
208
|
+
finally {
|
|
209
|
+
response.off("close", closed);
|
|
210
|
+
}
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
const activityMatch = pathname.match(/^\/api\/stations\/([^/]+)\/activity$/);
|
|
214
|
+
if (activityMatch) {
|
|
215
|
+
if (method !== "GET") {
|
|
216
|
+
sendJson(response, 405, { error: { code: "METHOD_NOT_ALLOWED" } });
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
const abort = new AbortController();
|
|
220
|
+
const closed = () => abort.abort();
|
|
221
|
+
response.once("close", closed);
|
|
222
|
+
try {
|
|
223
|
+
const snapshot = await this.ops.activityGraph.snapshot(decodeSegment(activityMatch[1]), url.searchParams.get("window") ?? "10m", url.searchParams.get("since") ?? undefined, Number(url.searchParams.get("wait_ms") ?? 0), abort.signal);
|
|
224
|
+
sendJson(response, 200, sanitize(snapshot));
|
|
225
|
+
}
|
|
226
|
+
catch (error) {
|
|
227
|
+
const data = errorData(error);
|
|
228
|
+
sendJson(response, data.code === "STATION_NOT_FOUND" ? 404 : data.code === "INVALID_WINDOW" ? 400 : 500, { error: data });
|
|
229
|
+
}
|
|
230
|
+
finally {
|
|
231
|
+
response.off("close", closed);
|
|
232
|
+
}
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
192
235
|
if (pathname === "/api/op") {
|
|
193
236
|
await this.handleOperation(request, response);
|
|
194
237
|
return;
|
|
@@ -314,29 +357,32 @@ export class WebConsole {
|
|
|
314
357
|
if (sessionMatch) {
|
|
315
358
|
const id = decodeSegment(sessionMatch[1]);
|
|
316
359
|
const view = sessionMatch[2];
|
|
360
|
+
const language = /^zh(?:[-,;]|$)/i.test(request.headers["accept-language"]?.trim() ?? "") ? "zh-CN" : "en";
|
|
361
|
+
const turn = view !== "live" ? url.searchParams.get("turn") : null;
|
|
362
|
+
const atLeaf = turn ? this.ops.consoleCueTurnLeaf(id, turn) ?? undefined : undefined;
|
|
317
363
|
if (view === "history") {
|
|
318
364
|
const before = url.searchParams.get("before");
|
|
319
365
|
if (!before) {
|
|
320
366
|
sendJson(response, 400, { error: { code: "INVALID_PARAMS", message: "A history anchor is required." } });
|
|
321
367
|
return;
|
|
322
368
|
}
|
|
323
|
-
const { history, history_before, history_reset } = sanitize(this.ops.consoleSessionHistoryBefore(id, before));
|
|
324
|
-
sendJson(response, 200, { conversation: sessionHistoryContent(id, history), before: history_before, reset: history_reset });
|
|
369
|
+
const { history, history_before, history_reset } = sanitize(this.ops.consoleSessionHistoryBefore(id, before, atLeaf));
|
|
370
|
+
sendJson(response, 200, { conversation: sessionHistoryContent(id, history, language), before: history_before, reset: history_reset });
|
|
325
371
|
return;
|
|
326
372
|
}
|
|
327
373
|
const after = view === "live" ? url.searchParams.get("after") ?? undefined : undefined;
|
|
328
374
|
const screenPromise = this.execute("session_screen", { session_id: id }).catch(() => ({ screen: "", alive: false }));
|
|
329
375
|
const [read, screen] = await Promise.all([
|
|
330
|
-
this.ops.consoleSessionRead(id, after).then(data => sanitize(data)), screenPromise,
|
|
376
|
+
this.ops.consoleSessionRead(id, after, atLeaf).then(data => sanitize(data)), screenPromise,
|
|
331
377
|
]);
|
|
332
378
|
if (view === "live") {
|
|
333
379
|
const { history, ...state } = read;
|
|
334
|
-
sendJson(response, 200, { read: state, screen, conversation: sessionHistoryContent(id, history) });
|
|
380
|
+
sendJson(response, 200, { read: state, screen, conversation: sessionHistoryContent(id, history, language) });
|
|
335
381
|
}
|
|
336
382
|
else {
|
|
337
383
|
const meta = this.ops.supervisor.sessions.get(id)?.meta;
|
|
338
384
|
const membership = meta?.station ? { seat: meta.station.seat ?? true } : undefined;
|
|
339
|
-
sendHtml(response, 200, sessionDetailPage(id, read, screen, meta?.agent === "JaXon", membership));
|
|
385
|
+
sendHtml(response, 200, sessionDetailPage(id, read, screen, meta?.agent === "JaXon", membership, language, atLeaf ? turn : undefined));
|
|
340
386
|
}
|
|
341
387
|
return;
|
|
342
388
|
}
|