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
package/dist/console/assets.js
CHANGED
|
@@ -17,7 +17,8 @@ body { min-height: 100vh; }
|
|
|
17
17
|
background: #121b24; border-right: 1px solid var(--line); padding: 1.8rem 1rem; overflow-y: auto;
|
|
18
18
|
}
|
|
19
19
|
.rail .brand { display: flex; align-items: center; gap: .65rem; padding: 0 .45rem; letter-spacing: -.025em; }
|
|
20
|
-
.brand-mark { flex:
|
|
20
|
+
.brand-mark { display:block; flex:none; inline-size:32px; block-size:32px; }
|
|
21
|
+
.ui-icon { display:inline-block; flex:none; vertical-align:middle; }
|
|
21
22
|
.rail nav { display: grid; gap: .3rem; margin-top: 2.65rem; }
|
|
22
23
|
.rail nav a { border-radius: 7px; padding: .64rem .9rem; font-size: .94rem; font-weight: 550; color: var(--muted); }
|
|
23
24
|
.rail nav a:hover { background: #202c37; color: var(--text); text-decoration: none; }
|
|
@@ -93,6 +94,11 @@ td a { font-weight: 550; }
|
|
|
93
94
|
.status-group, .tag-list { display:flex; flex-wrap:wrap; gap:.35rem; align-items:center; }
|
|
94
95
|
.resource-tag { display:inline-block; overflow-wrap:anywhere; max-width:100%; padding:.13rem .5rem; border-radius:6px; border:1px solid var(--line); background:var(--panel2); color:#cbd9e0; font-size:.79rem; }
|
|
95
96
|
.station-list th:nth-child(4) { min-width:9rem; }
|
|
97
|
+
.station-heading { align-items:flex-start; flex-wrap:wrap; gap:.8rem 1.2rem; }
|
|
98
|
+
.station-heading-copy { flex:1 1 31rem; min-inline-size:0; max-inline-size:100%; overflow-wrap:anywhere; }
|
|
99
|
+
.station-heading .station-start { flex:none; gap:.4rem; max-inline-size:100%; white-space:normal; text-align:center; }
|
|
100
|
+
[data-station-live] > .resource-content { max-width:none; }
|
|
101
|
+
@media (max-width:600px) { .station-heading-copy { flex-basis:auto; } }
|
|
96
102
|
.badge.queued, .badge.joining, .badge.leaving, .badge.outsideeffectiveroster, .badge.formermember { background:#493b21; color:#f5d68c; }
|
|
97
103
|
.badge.warm { background:#204779; color:#acd0ff; }
|
|
98
104
|
.badge.missing { background:#5b2528; color:#ffb3ad; }
|
|
@@ -340,16 +346,7 @@ section > .empty, main > .empty { padding: 1rem 1.25rem; background: var(--panel
|
|
|
340
346
|
.jaxon-dock { position:fixed; bottom:max(1rem,env(safe-area-inset-bottom)); right:max(1rem,env(safe-area-inset-right)); z-index:8; }
|
|
341
347
|
#jaxon-launch { display:flex; align-items:center; gap:.5rem; border-radius:2rem; padding:.75rem 1.15rem; box-shadow:0 4px 18px #0005; }
|
|
342
348
|
.jaxon-dock [hidden] { display:none !important; }
|
|
343
|
-
|
|
344
|
-
.jaxon-head,.jaxon-tools,.jaxon-actions { display:flex; align-items:center; gap:.5rem; }
|
|
345
|
-
.jaxon-head { justify-content:space-between; padding:1rem; border-bottom:1px solid var(--line); }
|
|
346
|
-
.jaxon-head h2 { margin:0; font-size:1.12rem; }.jaxon-head small { color:var(--muted); }
|
|
347
|
-
.jaxon-tools button { font-size:.8rem; padding:.3rem .65rem; }
|
|
348
|
-
.jaxon-scroll { flex:1; overflow:auto; overscroll-behavior:contain; padding:1rem; min-height:0; }
|
|
349
|
-
.jaxon-bubble { margin:0 1.4rem .8rem 0; padding:.7rem .85rem; border:1px solid var(--line); border-radius:.8rem .8rem .8rem .2rem; background:#1d2933; white-space:pre-wrap; overflow-wrap:anywhere; line-height:1.5; }
|
|
350
|
-
.jaxon-bubble.user { margin:0 0 .8rem 1.4rem; background:#20362f; border-color:#355749; border-radius:.8rem .8rem .2rem .8rem; }
|
|
351
|
-
.jaxon-bubble.assistant { white-space:normal; }
|
|
352
|
-
.jaxon-bubble > strong { display:block; color:var(--accent); font-size:.75rem; margin-bottom:.25rem; }
|
|
349
|
+
|
|
353
350
|
.jaxon-markdown > :first-child { margin-top:0; }
|
|
354
351
|
.jaxon-markdown > :last-child { margin-bottom:0; }
|
|
355
352
|
.jaxon-markdown p { margin:.55rem 0; }
|
|
@@ -360,26 +357,14 @@ section > .empty, main > .empty { padding: 1rem 1.25rem; background: var(--panel
|
|
|
360
357
|
.jaxon-markdown code { font-size:.88em; }
|
|
361
358
|
.jaxon-markdown table { display:block; max-width:100%; overflow-x:auto; margin:.55rem 0; font-size:.82rem; }
|
|
362
359
|
.jaxon-markdown th, .jaxon-markdown td { padding:.35rem .5rem; }
|
|
363
|
-
.jaxon-
|
|
364
|
-
.jaxon-
|
|
365
|
-
.jaxon-tool .tool-heading { margin-bottom:.2rem; }
|
|
366
|
-
.jaxon-tool .tool-summary { display:block; padding-left:1.1rem; }
|
|
367
|
-
.jaxon-tool .tool-detail, .jaxon-tool > pre { margin:0 .55rem .55rem; }
|
|
368
|
-
.jaxon-tool .tool-output { max-height:14rem; font-size:.78rem; }
|
|
369
|
-
.jaxon-tool .tool-arguments-label { margin:.35rem 0; color:var(--muted); font-size:.75rem; }
|
|
370
|
-
#jaxon-chat { border-top:1px solid var(--line); padding:.8rem; margin:0; }
|
|
371
|
-
#jaxon-chat textarea { width:100%; min-height:3.6rem; max-height:8rem; margin:0; resize:vertical; font:inherit; }
|
|
372
|
-
.jaxon-actions { justify-content:flex-end; flex-wrap:wrap; margin-top:.4rem; }.jaxon-actions button { padding:.35rem .85rem; }
|
|
373
|
-
.jaxon-actions .key-hint { margin-right:auto; }
|
|
374
|
-
#jaxon-error { margin:.4rem .85rem; color:#ffb6ae; max-height:5rem; overflow:auto; }
|
|
375
|
-
#jaxon-question { padding:.7rem; border:1px solid var(--accent); border-radius:.6rem; }
|
|
376
|
-
#jaxon-question pre { max-height:9rem; }
|
|
360
|
+
.jaxon-chat-question { flex:none; margin:.55rem 0 0; padding:.65rem; border:1px solid var(--accent); border-radius:.6rem; }
|
|
361
|
+
.jaxon-chat-question pre { max-height:9rem; }
|
|
377
362
|
body:has(.jaxon-dock) main { padding-bottom:6rem; }
|
|
378
363
|
body:has(#jaxon-launch:not([hidden])) .toast { bottom:4.9rem; }
|
|
379
364
|
|
|
380
365
|
.activity-panel {
|
|
381
|
-
position:relative; margin:0 0 1.5rem; padding:clamp(.9rem,2vw,1.5rem); border:1px solid #
|
|
382
|
-
border-radius:
|
|
366
|
+
position:relative; margin:0 0 1.5rem; padding:clamp(.9rem,2vw,1.5rem); border:1px solid #2b3946;
|
|
367
|
+
border-radius:16px; background:radial-gradient(ellipse at 0 0,#17232d,transparent 62%),#0f171f;
|
|
383
368
|
}
|
|
384
369
|
.activity-panel [hidden] { display:none !important; }
|
|
385
370
|
.activity-header,.activity-meta,.activity-tools { display:flex; align-items:center; justify-content:space-between; gap:.75rem; flex-wrap:wrap; }
|
|
@@ -406,31 +391,32 @@ body:has(#jaxon-launch:not([hidden])) .toast { bottom:4.9rem; }
|
|
|
406
391
|
.activity-scene { position:relative; overflow:clip; border-radius:12px; container-type:inline-size; }
|
|
407
392
|
.activity-stage {
|
|
408
393
|
position:relative; isolation:isolate; border-radius:12px;
|
|
409
|
-
background:radial-gradient(circle,#
|
|
394
|
+
background:radial-gradient(circle,#6a97b128 .8px,transparent 1.15px) 0 0/18px 18px,#0c131a;
|
|
410
395
|
box-shadow:inset 0 0 0 1px #2b3c4b;
|
|
411
396
|
}
|
|
412
397
|
.activity-outgoing { position:absolute; z-index:3; inset:0 0 auto; overflow:hidden; pointer-events:none; }
|
|
413
398
|
.activity-nodes {
|
|
414
|
-
position:relative; z-index:1; display:grid; align-items:start;
|
|
415
|
-
|
|
399
|
+
position:relative; z-index:1; display:grid; align-items:start;
|
|
400
|
+
grid-template-columns:minmax(0,1fr) clamp(7.5rem,17cqi,9rem) minmax(0,1fr);
|
|
401
|
+
gap:clamp(1rem,2.7cqi,1.8rem); padding:.85rem clamp(1.55rem,3.3cqi,2.2rem);
|
|
416
402
|
}
|
|
417
403
|
.activity-agent-lanes { display:contents; }
|
|
418
404
|
.activity-hub { grid-area:1 / 2; }
|
|
419
|
-
.activity-lane { display:flex; flex-direction:column; gap:.
|
|
405
|
+
.activity-lane { display:flex; flex-direction:column; gap:.55rem; min-width:0; }
|
|
420
406
|
.activity-lane:first-child { grid-area:1 / 1; }
|
|
421
407
|
.activity-lane:last-child { grid-area:1 / 3; }
|
|
422
408
|
.activity-node {
|
|
423
409
|
--role:hsl(var(--role-hue) 75% 77%);
|
|
424
|
-
--card-opacity:.
|
|
410
|
+
--card-opacity:.83;
|
|
425
411
|
position:relative; isolation:isolate; min-width:0; contain:layout;
|
|
426
|
-
padding:.
|
|
412
|
+
padding:.43rem .5rem; border:1px solid color-mix(in srgb,var(--role) 25%,#2a3b49);
|
|
413
|
+
border-radius:10px; background:#14202a;
|
|
427
414
|
opacity:var(--card-opacity); transition:opacity 500ms ease;
|
|
428
415
|
}
|
|
429
|
-
.activity-node:
|
|
430
|
-
.activity-node.master,.activity-node.active,.activity-node.active:is(:hover,:focus-within) { --card-opacity:1; }
|
|
416
|
+
.activity-node:is(.master,.active,:hover,:focus-within) { --card-opacity:1; }
|
|
431
417
|
.activity-node.master {
|
|
432
|
-
|
|
433
|
-
box-shadow:0 0
|
|
418
|
+
border-color:#8f7448; background:#211f1a;
|
|
419
|
+
box-shadow:0 0 14px #ffc98116;
|
|
434
420
|
}
|
|
435
421
|
.activity-light { position:absolute; inset:-1px; z-index:-1; pointer-events:none; border-radius:inherit; opacity:var(--heat,0); transition:opacity 550ms linear;
|
|
436
422
|
border:1px solid color-mix(in srgb,var(--role) 58%,#354858);
|
|
@@ -442,7 +428,7 @@ body:has(#jaxon-launch:not([hidden])) .toast { bottom:4.9rem; }
|
|
|
442
428
|
margin:0; border:1px solid color-mix(in srgb,var(--role) 55%,#334352); border-radius:50%;
|
|
443
429
|
background:#0d1721; color:var(--role); font:600 .82rem/1 ui-monospace,monospace;
|
|
444
430
|
}
|
|
445
|
-
.master .activity-emblem { color:#ecd493; border-color:#998451; background:#191f1e;
|
|
431
|
+
.master .activity-emblem { color:#ecd493; border-color:#998451; background:#191f1e; }
|
|
446
432
|
.activity-emblem::before { content:""; position:absolute; z-index:-1; inset:-5px; border-radius:inherit;
|
|
447
433
|
background:var(--role); opacity:0; pointer-events:none;
|
|
448
434
|
}
|
|
@@ -450,32 +436,37 @@ body:has(#jaxon-launch:not([hidden])) .toast { bottom:4.9rem; }
|
|
|
450
436
|
.activity-identity { flex:1; min-width:0; }
|
|
451
437
|
.activity-name { margin:0; min-width:0; color:var(--role); font-size:.88rem; line-height:1.2; }
|
|
452
438
|
.activity-name > :is(a,span) { display:block; max-width:100%; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; color:inherit; }
|
|
453
|
-
.activity-name
|
|
439
|
+
.activity-name-chat { width:fit-content; text-decoration:underline; text-decoration-color:color-mix(in srgb,currentColor 55%,transparent); text-underline-offset:3px; }
|
|
440
|
+
.activity-name-chat:is(:hover,:focus-visible) { text-decoration-color:currentColor; }
|
|
454
441
|
.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
442
|
.master .activity-count { white-space:normal; }
|
|
456
|
-
.activity-gear { display:grid; place-items:center; flex:0 0 1.
|
|
457
|
-
.activity-gear
|
|
458
|
-
.activity-
|
|
459
|
-
.activity-
|
|
460
|
-
.activity-session-stack:
|
|
461
|
-
.activity-session
|
|
462
|
-
|
|
463
|
-
|
|
443
|
+
.activity-gear { display:grid; place-items:center; flex:0 0 1.55rem; height:1.55rem; border-radius:6px; color:#aebfcd; }
|
|
444
|
+
.activity-gear .ui-icon { width:.9rem; height:.9rem; }
|
|
445
|
+
.activity-gear:hover,.activity-gear:focus-visible { color:#eafaff; background:#263846; }
|
|
446
|
+
.activity-sessions { max-height:5.6rem; overflow:auto; scrollbar-width:thin; scrollbar-color:#4a6070 transparent; scrollbar-gutter:stable; }
|
|
447
|
+
.activity-session-stack { display:flex; flex-direction:column; gap:.2rem; }
|
|
448
|
+
.activity-session-stack:has(.activity-session,.activity-more:not([hidden])) { padding-top:.35rem; }
|
|
449
|
+
.activity-session {
|
|
450
|
+
display:flex; align-items:center; gap:.3rem; flex:none;
|
|
451
|
+
min-width:0; min-height:1.55rem; padding:.1rem .4rem; overflow:hidden;
|
|
452
|
+
border-block-start:1px solid #304250;
|
|
453
|
+
color:#e2edf4; font-size:.76rem; font-weight:500; line-height:1.3; text-align:start;
|
|
464
454
|
}
|
|
465
|
-
.activity-session
|
|
466
|
-
.activity-session.
|
|
467
|
-
.activity-session
|
|
455
|
+
.activity-session.closed { color:#acbcc9; }
|
|
456
|
+
.activity-session.activity-fallback:not(:hover,:focus-visible) { color:#bdcbd5; }
|
|
457
|
+
.activity-session:is(:hover,:focus-visible) { color:#fff; background:#203341; text-decoration:none; outline-offset:-2px; }
|
|
468
458
|
.activity-more { padding:.14rem .35rem; color:#bdd0de; font-size:.7rem; }
|
|
469
459
|
.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 {
|
|
471
|
-
.activity-cue-origin {
|
|
472
|
-
.activity-
|
|
460
|
+
.activity-cue-count { flex:none; font-size:.62rem; }
|
|
461
|
+
.activity-cue-origin { flex:none; color:#ddbcff; }
|
|
462
|
+
.activity-cue-origin .ui-icon { display:block; width:.73rem; height:.73rem; }
|
|
463
|
+
.activity-state-dot { flex:none; width:.43rem; height:.43rem; border-radius:50%; color:#8195a7; background:currentColor; }
|
|
473
464
|
.activity-state-dot[data-state="running"] { color:#8fe1b8; box-shadow:0 0 7px #8fe1b8a0; }
|
|
474
465
|
.activity-state-dot[data-state="waiting_input"] { color:#ffcc83; border-radius:1px; rotate:45deg; }
|
|
475
466
|
.activity-state-dot[data-state="queued"] { color:#8bbaff; box-shadow:inset 0 0 0 1px currentColor; background:transparent; }
|
|
476
467
|
.activity-state-dot[data-state="failed"] { color:#ff9594; border-radius:1px; }
|
|
477
468
|
.activity-state-dot[data-state="closed"] { color:#738797; }
|
|
478
|
-
.activity-topic-viewport {
|
|
469
|
+
.activity-topic-viewport { flex:1; min-width:0; overflow:hidden; white-space:nowrap; }
|
|
479
470
|
.activity-topic-viewport.overflowing { mask-image:linear-gradient(to right,#000 calc(100% - 6px),transparent); }
|
|
480
471
|
.activity-topic-track { display:block; width:max-content; }
|
|
481
472
|
.activity-tooltip { position:absolute; max-width:min(25rem,calc(100% - 20px)); z-index:4; padding:.48rem .65rem; border:1px solid #557182;
|
|
@@ -493,11 +484,11 @@ body:has(#jaxon-launch:not([hidden])) .toast { bottom:4.9rem; }
|
|
|
493
484
|
.activity-pulse.cue { fill:#f0e1ff; filter:drop-shadow(0 0 5px #cbafff); }
|
|
494
485
|
.activity-pulse.steer { fill:#ffe9c2; filter:drop-shadow(0 0 5px #ffad65); }
|
|
495
486
|
.activity-secondary > summary { color:var(--muted); }
|
|
496
|
-
@keyframes activity-glow { 0%,100% { opacity:.
|
|
487
|
+
@keyframes activity-glow { 0%,100% { opacity:.06; transform:scale(.96); } 50% { opacity:.16; transform:scale(1.03); } }
|
|
497
488
|
@container (max-width:41rem) {
|
|
498
489
|
.activity-nodes { grid-template-columns:6.8rem minmax(0,1fr); }
|
|
499
490
|
.activity-hub { grid-area:1 / 1; }
|
|
500
|
-
.activity-agent-lanes { grid-area:1 / 2; display:flex; flex-direction:column; gap:.
|
|
491
|
+
.activity-agent-lanes { grid-area:1 / 2; display:flex; flex-direction:column; gap:.55rem; }
|
|
501
492
|
.activity-lane:empty { display:none; }
|
|
502
493
|
}
|
|
503
494
|
@container (max-width:27rem) {
|
|
@@ -510,6 +501,110 @@ body:has(#jaxon-launch:not([hidden])) .toast { bottom:4.9rem; }
|
|
|
510
501
|
.activity-topic-viewport.overflowing { mask-image:none; text-overflow:ellipsis; }
|
|
511
502
|
.activity-topic-viewport.overflowing .activity-topic-track { display:inline; }
|
|
512
503
|
}
|
|
504
|
+
.jaxon-chat-root { position:fixed; inset:0; z-index:900; pointer-events:none; }
|
|
505
|
+
.jaxon-conversation {
|
|
506
|
+
--chat-shell:#18242e; --chat-deck:#101921; --chat-line:#2e404c; --chat-muted:#a5b9c8;
|
|
507
|
+
display:flex; flex-direction:column; margin:0; pointer-events:auto; container-type:inline-size;
|
|
508
|
+
overflow:hidden; overscroll-behavior:none;
|
|
509
|
+
background:var(--chat-deck); border:1px solid #415762; border-radius:15px; box-shadow:0 16px 48px #0009,0 2px 8px #0005;
|
|
510
|
+
}
|
|
511
|
+
.jaxon-chat-window {
|
|
512
|
+
position:fixed; resize:both;
|
|
513
|
+
min-width:min(18rem,calc(100% - 1rem)); min-height:min(16rem,calc(100% - 1rem));
|
|
514
|
+
max-width:calc(100% - 1rem); max-height:calc(100dvh - 1rem);
|
|
515
|
+
}
|
|
516
|
+
#jaxon-panel { width:min(456px,calc(100vw - 2rem)); height:min(568px,calc(100dvh - 2rem)); }
|
|
517
|
+
.jaxon-conversation [hidden] { display:none !important; }
|
|
518
|
+
.jaxon-conversation:focus-within { border-color:#56746f; }
|
|
519
|
+
.jaxon-chat-head { display:flex; flex:none; align-items:center; gap:.6rem; padding:.65rem .75rem;
|
|
520
|
+
background:linear-gradient(110deg,#1b2d37,var(--chat-shell) 65%); border-bottom:1px solid var(--chat-line); }
|
|
521
|
+
.jaxon-chat-head, .jaxon-chat-head * { -webkit-user-select:none; user-select:none; }
|
|
522
|
+
.jaxon-chat-window .jaxon-chat-head { cursor:grab; }
|
|
523
|
+
.jaxon-chat-window .jaxon-chat-head:active { cursor:grabbing; }
|
|
524
|
+
.jaxon-chat-emblem { display:grid; place-items:center; flex:none; width:2rem; height:2rem; border-radius:9px;
|
|
525
|
+
color:#b3e4d6; background:#213d3c; border:1px solid #426864; }
|
|
526
|
+
.jaxon-chat-emblem .ui-icon { width:1.1rem; height:1.1rem; }
|
|
527
|
+
.jaxon-chat-identity { display:grid; flex:1; gap:.12rem; min-width:0; line-height:1.25; }
|
|
528
|
+
.jaxon-chat-identity strong { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; font-size:.94rem; font-weight:650; }
|
|
529
|
+
.jaxon-chat-meta { display:flex; flex-wrap:wrap; align-items:baseline; column-gap:.4rem; color:var(--chat-muted); }
|
|
530
|
+
.jaxon-chat-meta small { color:inherit; font-size:.7rem; }
|
|
531
|
+
.jaxon-chat-meta small::before { content:"·"; margin-inline-end:.4rem; }
|
|
532
|
+
.jaxon-chat-status { display:inline-flex; align-items:center; gap:.3rem; font-size:.72rem; font-weight:600; }
|
|
533
|
+
.jaxon-chat-status::before { content:""; width:.38rem; height:.38rem; border-radius:50%; background:currentColor; }
|
|
534
|
+
.jaxon-chat-status:is([data-status="running"],[data-status="starting"],[data-status="stopping"]) { color:#a4e3c9; }
|
|
535
|
+
.jaxon-chat-status[data-status="waiting_input"] { color:#eac98c; }
|
|
536
|
+
.jaxon-chat-status[data-status="failed"] { color:#ffb3ad; }
|
|
537
|
+
.jaxon-chat-tools { display:flex; flex:none; align-items:center; gap:.16rem; }
|
|
538
|
+
.jaxon-chat-open { display:inline-flex; align-items:center; gap:.25rem; min-height:1.9rem; margin-inline-end:.18rem; padding:0 .35rem;
|
|
539
|
+
border-radius:6px; font-size:.73rem; font-weight:600; white-space:nowrap; color:#b5dbd2; }
|
|
540
|
+
.jaxon-chat-open .ui-icon { width:.8rem; height:.8rem; }
|
|
541
|
+
button.jaxon-chat-icon { flex:none; display:grid; place-items:center; width:1.9rem; min-height:1.9rem; padding:0;
|
|
542
|
+
border-radius:6px; color:#b9c9d4; background:transparent; border-color:transparent; }
|
|
543
|
+
.jaxon-chat-open:hover,button.jaxon-chat-icon:hover { background:#273943; color:var(--text); text-decoration:none; }
|
|
544
|
+
button.jaxon-chat-close:hover { background:#482e36; color:#ffd4cc; }
|
|
545
|
+
.jaxon-chat-scroll { display:flex; flex:1 1 auto; flex-direction:column; overflow:auto; overscroll-behavior:contain;
|
|
546
|
+
min-height:0; padding:.75rem; scrollbar-gutter:stable; scrollbar-width:thin; scrollbar-color:#4b6270 transparent; overflow-anchor:none; }
|
|
547
|
+
.jaxon-chat-scroll:focus-visible { outline:2px solid var(--accent); outline-offset:-3px; }
|
|
548
|
+
.jaxon-chat-empty { margin:auto; padding:.9rem; color:var(--chat-muted); text-align:center; font-size:.87rem; }
|
|
549
|
+
.jaxon-chat-history { display:flex; flex:none; flex-direction:column; gap:.55rem; margin-top:auto; min-width:0; }
|
|
550
|
+
.jaxon-chat-history:empty { display:none; }
|
|
551
|
+
.jaxon-chat-history .message { align-self:start; max-width:94%; margin:0; padding:.55rem .7rem; overflow-wrap:anywhere;
|
|
552
|
+
font-size:.86rem; line-height:1.55; border:1px solid var(--chat-line); border-radius:11px 11px 11px 4px; background:#182630; }
|
|
553
|
+
.jaxon-chat-history .message[data-role="user"] { align-self:end; border-color:#365b56; border-radius:11px 11px 4px 11px; background:#203a38; }
|
|
554
|
+
.jaxon-chat-history .message:not([data-role="user"],[data-role="assistant"]) { width:100%; max-width:100%; border-radius:8px; background:#141f28; }
|
|
555
|
+
.jaxon-chat-history .message > header { display:flex; flex-wrap:wrap; align-items:baseline; gap:.1rem .55rem; margin-bottom:.28rem; }
|
|
556
|
+
.jaxon-chat-history .message > header strong { font-size:.72rem; color:#d5e5e8; }
|
|
557
|
+
.jaxon-chat-history .message > header small { font-size:.67rem; color:var(--chat-muted); }
|
|
558
|
+
.jaxon-chat-history .message-text { margin:0; padding:0; font:inherit; max-height:none; }
|
|
559
|
+
.jaxon-chat-history :is(pre, .tool-output) { scrollbar-width:thin; }
|
|
560
|
+
.jaxon-chat-history figure { margin:.4rem 0; }
|
|
561
|
+
.jaxon-chat-history img { max-width:100%; object-fit:contain; }
|
|
562
|
+
button.jaxon-chat-older { flex:none; align-self:center; margin:0 0 .65rem; min-height:1.9rem; padding:.22rem .6rem;
|
|
563
|
+
border-radius:999px; border-color:var(--chat-line); background:var(--chat-shell); font-size:.73rem; color:var(--chat-muted); }
|
|
564
|
+
.jaxon-chat-footer { flex:none; margin:0; padding:.65rem .75rem .7rem; background:var(--chat-shell); border:0; border-top:1px solid var(--chat-line); }
|
|
565
|
+
.jaxon-chat-queue,.jaxon-chat-error { margin:0 0 .5rem; padding:.3rem .5rem; border-radius:6px; font-size:.74rem; overflow-wrap:anywhere; }
|
|
566
|
+
.jaxon-chat-queue { color:#ebce97; background:#393125; }
|
|
567
|
+
.jaxon-chat-error { color:#ffc2b8; background:#402b33; }
|
|
568
|
+
.jaxon-chat-composer { display:flex; align-items:stretch; gap:.3rem; padding:.28rem; border:1px solid #354953; border-radius:10px; background:#0e171f; }
|
|
569
|
+
.jaxon-chat-composer:focus-within { border-color:#69958a; }
|
|
570
|
+
.jaxon-chat-composer textarea { flex:1; margin:0; min-width:0; min-height:2.35rem; max-height:min(8.25rem,23dvh);
|
|
571
|
+
background:transparent; border:0; outline:none; padding:.52rem .45rem; resize:none; font-size:.87rem; line-height:1.4; }
|
|
572
|
+
.jaxon-chat-composer textarea::placeholder { color:#93a8b9; }
|
|
573
|
+
.jaxon-chat-composer button { flex:none; min-height:2.35rem; padding-inline:.65rem; font-size:.78rem; }
|
|
574
|
+
.jaxon-chat-composer button:disabled { cursor:not-allowed; }
|
|
575
|
+
button.jaxon-chat-stop { background:transparent; color:#e3b8ac; border-color:#664c4c; }
|
|
576
|
+
button.jaxon-chat-stop:disabled { color:var(--chat-muted); border-color:transparent; }
|
|
577
|
+
.jaxon-chat-note { margin:.4rem 0 0; color:var(--chat-muted); font-size:.71rem; line-height:1.4; }
|
|
578
|
+
.jaxon-conversation.closed .jaxon-chat-note { color:#ccd5de; }
|
|
579
|
+
.jaxon-chat-window.minimized { height:auto !important; min-height:0; resize:none; }
|
|
580
|
+
.jaxon-chat-window.minimized .jaxon-chat-head { border-bottom:0; }
|
|
581
|
+
.jaxon-chat-window.minimized :is(.jaxon-chat-scroll,.jaxon-chat-footer) { display:none; }
|
|
582
|
+
.jaxon-chat-window.drawer { left:0 !important; right:0 !important; bottom:0 !important; top:auto !important; width:100% !important;
|
|
583
|
+
max-width:100%; height:min(78dvh,40rem) !important; border-radius:15px 15px 0 0; resize:none; }
|
|
584
|
+
.jaxon-chat-window.drawer.minimized { height:auto !important; }
|
|
585
|
+
.jaxon-chat-window.drawer .jaxon-chat-head { cursor:default; }
|
|
586
|
+
button.jaxon-chat-new { min-height:1.9rem; padding:0 .45rem; font-size:.73rem; white-space:nowrap; }
|
|
587
|
+
@container (max-width:21rem) {
|
|
588
|
+
.jaxon-chat-emblem { display:none; }
|
|
589
|
+
.jaxon-chat-head,.jaxon-chat-footer { padding-inline:.55rem; }
|
|
590
|
+
.jaxon-chat-composer button { padding-inline:.45rem; }
|
|
591
|
+
}
|
|
592
|
+
.preset-picker { border:1px solid var(--line); border-radius:8px; padding:.6rem .75rem; margin:.6rem 0; min-width:0; }
|
|
593
|
+
.preset-picker legend { padding:0 .35rem; color:var(--muted); }
|
|
594
|
+
.preset-options { display:grid; grid-template-columns:repeat(auto-fill,minmax(170px,1fr)); gap:.25rem .8rem; }
|
|
595
|
+
label.preset-option { display:flex; align-items:center; gap:.4rem; margin:0; color:var(--text); cursor:pointer; }
|
|
596
|
+
label.preset-option input[type=checkbox] { width:auto; margin:0; }
|
|
597
|
+
.preset-picker [data-preset-summary] { margin:0 0 .4rem; font-size:.78rem; }
|
|
598
|
+
.station-board { padding:0; overflow:hidden; }
|
|
599
|
+
.station-board > summary { display:flex; align-items:center; gap:.65rem; padding:.7rem .9rem; cursor:pointer; list-style:none; }
|
|
600
|
+
.station-board > summary::-webkit-details-marker { display:none; }
|
|
601
|
+
.station-board > summary::after { content:"▸"; color:var(--muted); }
|
|
602
|
+
.station-board[open] > summary::after { content:"▾"; }
|
|
603
|
+
.station-board[open] > summary { border-bottom:1px solid var(--line); }
|
|
604
|
+
.station-board > summary .section-heading { flex:1 1 auto; margin:0; }
|
|
605
|
+
.board-version { white-space:nowrap; font-size:.75rem; }
|
|
606
|
+
.board-detail { padding:.75rem .9rem .9rem; }
|
|
607
|
+
.board-detail [data-board-content] { max-height:24rem; }
|
|
513
608
|
`;
|
|
514
609
|
export const APP_JS = String.raw `
|
|
515
610
|
"use strict";
|
|
@@ -560,8 +655,13 @@ function redirectFor(form, result) {
|
|
|
560
655
|
});
|
|
561
656
|
return path.includes("//") || /\/$/.test(path) ? null : path;
|
|
562
657
|
}
|
|
658
|
+
const agentSettingsDefaults = new WeakMap();
|
|
563
659
|
function paramsFor(form) {
|
|
564
660
|
const params = {};
|
|
661
|
+
// Checkboxes that share a name form a multi-select group (e.g. the preset picker).
|
|
662
|
+
const checkboxCounts = new Map();
|
|
663
|
+
for (const el of form.elements) if (el.name && el.type === "checkbox") checkboxCounts.set(el.name, (checkboxCounts.get(el.name) || 0) + 1);
|
|
664
|
+
const checkboxGroups = new Set([...checkboxCounts].filter(([, count]) => count > 1).map(([name]) => name));
|
|
565
665
|
for (const el of form.elements) {
|
|
566
666
|
if (!el.name || el.matches(":disabled") || el.type === "submit" || el.type === "button") continue;
|
|
567
667
|
if (["resolve_unknown", "unknown_turn_id"].includes(el.name)) continue;
|
|
@@ -571,10 +671,18 @@ function paramsFor(form) {
|
|
|
571
671
|
try { value = JSON.parse(value); } catch { throw new Error(el.name + " must be valid JSON"); }
|
|
572
672
|
} else if (el.hasAttribute("data-number") && value !== "") value = Number(value);
|
|
573
673
|
else if (el.hasAttribute("data-comma")) value = value.split(",").map(s => s.trim()).filter(Boolean);
|
|
674
|
+
if (checkboxGroups.has(el.name)) {
|
|
675
|
+
if (!Array.isArray(params[el.name])) params[el.name] = [];
|
|
676
|
+
params[el.name].push(value);
|
|
677
|
+
continue;
|
|
678
|
+
}
|
|
574
679
|
if (el.hasAttribute("data-null-empty") && value === "") value = null;
|
|
575
680
|
if (value === "" && !el.hasAttribute("data-null-empty") && !el.hasAttribute("data-keep-empty")) continue;
|
|
576
681
|
params[el.name] = value;
|
|
577
682
|
}
|
|
683
|
+
const picker = form.querySelector("[data-preset-picker]");
|
|
684
|
+
if (picker && !picker.querySelector('input[name="agents"]:checked')) throw new Error("Select at least one member preset.");
|
|
685
|
+
if (picker && params.agents === undefined) params.agents = [];
|
|
578
686
|
const tools = form.querySelector("[data-tool-set]");
|
|
579
687
|
const override = form.querySelector("[data-override-tools]");
|
|
580
688
|
if (tools && (!override || override.checked)) {
|
|
@@ -593,6 +701,9 @@ function paramsFor(form) {
|
|
|
593
701
|
}
|
|
594
702
|
if (form.dataset.kind === "agent-settings") {
|
|
595
703
|
if (form.elements.connection.value === form.elements.connection.dataset.original) delete params.connection;
|
|
704
|
+
const policy = form.elements.namedItem("session_switch");
|
|
705
|
+
if (policy && policy.value !== policy.dataset.original) params.session_switch = policy.value || null;
|
|
706
|
+
else delete params.session_switch;
|
|
596
707
|
let settings;
|
|
597
708
|
try { settings = JSON.parse(form.dataset.settings || "{}"); } catch { settings = {}; }
|
|
598
709
|
const setOrDelete = (key, value) => { if (value) settings[key] = value; else delete settings[key]; };
|
|
@@ -600,8 +711,37 @@ function paramsFor(form) {
|
|
|
600
711
|
setOrDelete("defaultModel", params.model);
|
|
601
712
|
setOrDelete("defaultThinkingLevel", params.thinking);
|
|
602
713
|
settings.defaultTools = params.tools;
|
|
714
|
+
const compactionFields = {
|
|
715
|
+
compaction_reserve: ["reserveTokens", "Context reserve"],
|
|
716
|
+
compaction_keep_recent: ["keepRecentTokens", "Recent history to keep"],
|
|
717
|
+
};
|
|
718
|
+
if (form.elements.namedItem("compaction_enabled")) {
|
|
719
|
+
const compaction = {...settings.compaction};
|
|
720
|
+
if (params.compaction_enabled === undefined) delete compaction.enabled;
|
|
721
|
+
else if (params.compaction_enabled === "true" || params.compaction_enabled === "false")
|
|
722
|
+
compaction.enabled = params.compaction_enabled === "true";
|
|
723
|
+
else throw new Error("Choose a valid automatic compaction setting.");
|
|
724
|
+
delete params.compaction_enabled;
|
|
725
|
+
for (const [field, [key, label]] of Object.entries(compactionFields)) {
|
|
726
|
+
const raw = params[field];
|
|
727
|
+
if (raw === undefined) delete compaction[key];
|
|
728
|
+
else {
|
|
729
|
+
const value = Number(raw);
|
|
730
|
+
if (!Number.isSafeInteger(value) || value < 0) throw new Error(label + " must be a non-negative safe integer.");
|
|
731
|
+
compaction[key] = value;
|
|
732
|
+
}
|
|
733
|
+
delete params[field];
|
|
734
|
+
}
|
|
735
|
+
if (Object.keys(compaction).length) settings.compaction = compaction;
|
|
736
|
+
else delete settings.compaction;
|
|
737
|
+
}
|
|
603
738
|
params.patch = {"settings.json": JSON.stringify(settings, null, 2) + "\n"};
|
|
604
739
|
for (const key of ["provider", "model", "thinking", "tools"]) delete params[key];
|
|
740
|
+
if (Object.hasOwn(params, "session_switch")) {
|
|
741
|
+
const { session_switch, ...rest } = params;
|
|
742
|
+
if (agentSettingsDefaults.get(form) === JSON.stringify(rest))
|
|
743
|
+
return { name: params.name, expected_rev: params.expected_rev, session_switch };
|
|
744
|
+
}
|
|
605
745
|
} else if (form.dataset.kind === "agent-instructions") {
|
|
606
746
|
params.patch = {"APPEND_SYSTEM.md": String(params.instructions || "")};
|
|
607
747
|
delete params.instructions;
|
|
@@ -639,6 +779,16 @@ function paramsFor(form) {
|
|
|
639
779
|
}
|
|
640
780
|
return params;
|
|
641
781
|
}
|
|
782
|
+
for (const picker of document.querySelectorAll("[data-preset-picker]")) {
|
|
783
|
+
const boxes = [...picker.querySelectorAll('input[name="agents"]')];
|
|
784
|
+
const summary = picker.querySelector("[data-preset-summary]");
|
|
785
|
+
const update = () => {
|
|
786
|
+
const chosen = boxes.filter(box => box.checked).map(box => box.value);
|
|
787
|
+
if (summary) summary.textContent = chosen.length ? chosen.length + " selected: " + chosen.join(", ") : "No presets selected";
|
|
788
|
+
};
|
|
789
|
+
picker.addEventListener("change", update);
|
|
790
|
+
update();
|
|
791
|
+
}
|
|
642
792
|
for (const block of document.querySelectorAll("[data-model-fields]")) {
|
|
643
793
|
const catalog = JSON.parse(block.dataset.catalog);
|
|
644
794
|
const form = block.closest("form");
|
|
@@ -691,6 +841,13 @@ for (const block of document.querySelectorAll("[data-model-fields]")) {
|
|
|
691
841
|
provider.addEventListener("input", suggestModels);
|
|
692
842
|
chooseConnection();
|
|
693
843
|
}
|
|
844
|
+
for (const form of document.querySelectorAll('form[data-kind="agent-settings"]')) {
|
|
845
|
+
// A policy-only edit must not pin model or tool defaults populated by the editor.
|
|
846
|
+
try {
|
|
847
|
+
const { session_switch, ...rest } = paramsFor(form);
|
|
848
|
+
agentSettingsDefaults.set(form, JSON.stringify(rest));
|
|
849
|
+
} catch { /* Invalid fields will be reported on submit. */ }
|
|
850
|
+
}
|
|
694
851
|
for (const form of document.querySelectorAll('form[data-kind="mcp-server"]')) {
|
|
695
852
|
const transport = form.elements.transport;
|
|
696
853
|
function showTransport() {
|
|
@@ -730,7 +887,7 @@ for (const form of document.querySelectorAll('form[data-op="connection_create"]'
|
|
|
730
887
|
showProviderFields();
|
|
731
888
|
window.addEventListener("pageshow", showProviderFields);
|
|
732
889
|
}
|
|
733
|
-
for (const input of document.querySelectorAll('
|
|
890
|
+
for (const input of document.querySelectorAll('form[data-op="session_send"] textarea[name="prompt"]')) {
|
|
734
891
|
input.addEventListener("keydown", event => {
|
|
735
892
|
if (event.key !== "Enter" || event.isComposing || event.keyCode === 229) return;
|
|
736
893
|
if (event.ctrlKey) {
|
|
@@ -778,6 +935,7 @@ document.addEventListener("submit", async event => {
|
|
|
778
935
|
no_change: "Published; no changes from the effective revision",
|
|
779
936
|
})[result?.takes_effect] : undefined;
|
|
780
937
|
if (form.dataset.kind === "flow-response") toast("Response submitted");
|
|
938
|
+
else if (operation === "board_write" && result.warning?.code === "BOARD_SOFT_LIMIT") toast(result.warning.message);
|
|
781
939
|
else toast(publishMessage || "Operation completed");
|
|
782
940
|
if (operation === "board_write") form.dispatchEvent(new CustomEvent("board-saved", { detail: { content: params.content, version: result.version } }));
|
|
783
941
|
const redirect = redirectFor(form, result);
|
|
@@ -792,7 +950,7 @@ document.addEventListener("submit", async event => {
|
|
|
792
950
|
if (el) el.value = "";
|
|
793
951
|
}
|
|
794
952
|
}
|
|
795
|
-
document.dispatchEvent(new CustomEvent("console-operation", {detail: {operation, result}}));
|
|
953
|
+
document.dispatchEvent(new CustomEvent("console-operation", {detail: {operation, result, sessionId: params.session_id}}));
|
|
796
954
|
} catch (e) {
|
|
797
955
|
toast(e.code === "BOARD_VERSION_CONFLICT" ? "Board changed while you were editing. Your draft was not saved. Use the latest version before retrying."
|
|
798
956
|
: (e.code ? e.code + ": " : "") + e.message, true);
|
|
@@ -1377,202 +1535,6 @@ function renderMarkdown(text) {
|
|
|
1377
1535
|
}
|
|
1378
1536
|
return output;
|
|
1379
1537
|
}
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
let value = args.path || args.command || args.code || (args.pattern ? args.pattern + (args.path ? " · " + args.path : "") : "");
|
|
1384
|
-
if (!value) { try { value = JSON.stringify(args); } catch { value = "Arguments available"; } }
|
|
1385
|
-
const summary = String(value).replace(/\s+/g, " ").trim();
|
|
1386
|
-
return summary.length > 150 ? summary.slice(0, 149) + "…" : summary;
|
|
1387
|
-
}
|
|
1388
|
-
|
|
1389
|
-
function chatResultText(content) {
|
|
1390
|
-
if (typeof content === "string") return content;
|
|
1391
|
-
if (Array.isArray(content)) {
|
|
1392
|
-
const text = content.filter(part => part?.type === "text").map(part => part.text).join("\n");
|
|
1393
|
-
if (text) return text;
|
|
1394
|
-
}
|
|
1395
|
-
if (content === undefined) return "";
|
|
1396
|
-
try { return JSON.stringify(content, null, 2); } catch { return String(content); }
|
|
1397
|
-
}
|
|
1398
|
-
|
|
1399
|
-
function chatRows(history, sessionStatus) {
|
|
1400
|
-
const rows = [], calls = new Map();
|
|
1401
|
-
const addText = (role, text, id) => { if (text) rows.push({kind:"message", role, text, id}); };
|
|
1402
|
-
for (const entry of history) {
|
|
1403
|
-
if (entry.role === "user" || entry.role === "assistant") {
|
|
1404
|
-
if (typeof entry.content === "string") addText(entry.role, entry.content, entry.id);
|
|
1405
|
-
else if (Array.isArray(entry.content)) {
|
|
1406
|
-
let text = [];
|
|
1407
|
-
const flush = () => { if (text.length) addText(entry.role, text.join("\n"), entry.id); text = []; };
|
|
1408
|
-
for (const part of entry.content) {
|
|
1409
|
-
if (part?.type === "text") text.push(part.text);
|
|
1410
|
-
else if (part?.type === "toolCall") {
|
|
1411
|
-
flush();
|
|
1412
|
-
const row = {kind:"tool", id:part.id || entry.id, name:part.name || "tool", args:part.arguments,
|
|
1413
|
-
argsSummary:chatToolSummary(part.arguments), done:false, result:"", failed:false};
|
|
1414
|
-
rows.push(row); if (part.id) calls.set(part.id, row);
|
|
1415
|
-
}
|
|
1416
|
-
}
|
|
1417
|
-
flush();
|
|
1418
|
-
}
|
|
1419
|
-
} else if (entry.role === "toolResult") {
|
|
1420
|
-
const result = chatResultText(entry.content);
|
|
1421
|
-
let row = calls.get(entry.tool_call_id);
|
|
1422
|
-
if (!row) {
|
|
1423
|
-
row = {kind:"tool", id:entry.tool_call_id || entry.id, name:entry.tool_name || "tool", args:undefined, argsSummary:"", done:false};
|
|
1424
|
-
rows.push(row);
|
|
1425
|
-
}
|
|
1426
|
-
row.done = true; row.result = result; row.failed = Boolean(entry.is_error);
|
|
1427
|
-
}
|
|
1428
|
-
}
|
|
1429
|
-
const active = ["starting", "running", "waiting_input", "stopping"].includes(sessionStatus);
|
|
1430
|
-
for (const row of rows) if (row.kind === "tool" && !row.done) row.running = active;
|
|
1431
|
-
return rows;
|
|
1432
|
-
}
|
|
1433
|
-
|
|
1434
|
-
function chatToolNode(row, open) {
|
|
1435
|
-
const status = row.done ? (row.failed ? "Failed" : "Completed") : (row.running ? "Running" : "Stopped");
|
|
1436
|
-
const node = el("details", {className:"jaxon-tool", attrs:{"data-tool-id":row.id}});
|
|
1437
|
-
node.open = open;
|
|
1438
|
-
const heading = el("span", {className:"tool-heading"}, [
|
|
1439
|
-
el("code", {text:row.name}), el("span", {className:"tool-status " + status.toLowerCase(), text:status})
|
|
1440
|
-
]);
|
|
1441
|
-
const resultSummary = (row.done ? row.result : row.argsSummary).replace(/\s+/g, " ").trim();
|
|
1442
|
-
const summary = el("summary", {}, [heading, el("span", {className:"tool-summary", text:resultSummary ? (resultSummary.length > 150 ? resultSummary.slice(0, 149) + "…" : resultSummary) : (row.done ? "Result available" : "Waiting for a result")})]);
|
|
1443
|
-
node.append(summary);
|
|
1444
|
-
if (row.args !== undefined) node.append(el("p", {className:"tool-arguments-label", text:"Arguments"}), el("pre", {className:"tool-output", text:JSON.stringify(row.args, null, 2)}));
|
|
1445
|
-
if (row.done) node.append(el("p", {className:"tool-arguments-label", text:"Result"}), el("pre", {className:"tool-output", text:row.result || "(empty result)"}));
|
|
1446
|
-
return node;
|
|
1447
|
-
}
|
|
1448
|
-
|
|
1449
|
-
function mountJaXonChat() {
|
|
1450
|
-
const byId = id => document.getElementById(id);
|
|
1451
|
-
const panel = byId("jaxon-panel"), launch = byId("jaxon-launch"), form = byId("jaxon-chat");
|
|
1452
|
-
const messages = byId("jaxon-messages"), question = byId("jaxon-question"), status = byId("jaxon-status");
|
|
1453
|
-
const error = byId("jaxon-error"), stop = byId("jaxon-stop"), fresh = byId("jaxon-new"), input = form.elements.text;
|
|
1454
|
-
const key = "jaxon.console.chat";
|
|
1455
|
-
let state = {};
|
|
1456
|
-
try { state = JSON.parse(sessionStorage.getItem(key)) || {}; } catch {}
|
|
1457
|
-
const save = () => { try { sessionStorage.setItem(key, JSON.stringify(state)); } catch {} };
|
|
1458
|
-
let cursor, chatHistory = [];
|
|
1459
|
-
let snapshot, generation = 0, reading = false, writing = false, historyKey, opener = launch;
|
|
1460
|
-
const busy = s => ["starting","running","waiting_input","stopping"].includes(s);
|
|
1461
|
-
const report = message => { error.textContent = message || ""; error.hidden = !message; };
|
|
1462
|
-
const controls = () => {
|
|
1463
|
-
const s = snapshot?.status;
|
|
1464
|
-
form.querySelector('[type="submit"]').disabled = writing || Boolean(state.id && !snapshot) || busy(s) || s === "closed";
|
|
1465
|
-
input.readOnly = writing;
|
|
1466
|
-
fresh.disabled = writing;
|
|
1467
|
-
stop.hidden = !snapshot?.turn_id || !["running","waiting_input"].includes(s);
|
|
1468
|
-
stop.disabled = writing;
|
|
1469
|
-
};
|
|
1470
|
-
function resetView() {
|
|
1471
|
-
generation++;
|
|
1472
|
-
snapshot = undefined; cursor = undefined; chatHistory = []; historyKey = undefined;
|
|
1473
|
-
input.value = state.draft || "";
|
|
1474
|
-
messages.replaceChildren();
|
|
1475
|
-
question.hidden = true; question.firstElementChild.replaceChildren();
|
|
1476
|
-
delete question.firstElementChild.dataset.signature;
|
|
1477
|
-
report("");
|
|
1478
|
-
status.textContent = state.id ? "Loading conversation…" : "Console assistant";
|
|
1479
|
-
if (!state.id) messages.append(el("p", {text:"What would you like to manage?"}));
|
|
1480
|
-
controls();
|
|
1481
|
-
}
|
|
1482
|
-
function draw(read) {
|
|
1483
|
-
snapshot = read;
|
|
1484
|
-
const labels = {starting:"Starting…", running:"Working…", stopping:"Stopping…", waiting_input:"Waiting for your reply", idle:"Ready", dormant:"Sleeping · send to resume", closed:"Closed", failed:"Turn failed"};
|
|
1485
|
-
status.textContent = labels[read.status] || read.status;
|
|
1486
|
-
const rows = chatRows(read.history || [], read.status);
|
|
1487
|
-
const signature = JSON.stringify(rows);
|
|
1488
|
-
if (signature !== historyKey) {
|
|
1489
|
-
const scroll = messages.parentElement;
|
|
1490
|
-
const atEnd = historyKey === undefined || scroll.scrollHeight - scroll.scrollTop - scroll.clientHeight < 60;
|
|
1491
|
-
const openTools = new Set([...messages.querySelectorAll(".jaxon-tool[open]")].map(node => node.dataset.toolId));
|
|
1492
|
-
const nodes = rows.map(row => {
|
|
1493
|
-
if (row.kind === "tool") return chatToolNode(row, openTools.has(row.id));
|
|
1494
|
-
const bubble = el("div", {className:"jaxon-bubble " + row.role});
|
|
1495
|
-
bubble.append(el("strong", {text:row.role === "assistant" ? "JaXon" : "You"}));
|
|
1496
|
-
if (row.role === "assistant") {
|
|
1497
|
-
const content = el("div", {className:"jaxon-markdown"}); content.append(renderMarkdown(row.text)); bubble.append(content);
|
|
1498
|
-
} else bubble.append(document.createTextNode(row.text));
|
|
1499
|
-
return bubble;
|
|
1500
|
-
});
|
|
1501
|
-
messages.replaceChildren(...nodes);
|
|
1502
|
-
historyKey = signature;
|
|
1503
|
-
if (atEnd) scroll.scrollTop = scroll.scrollHeight;
|
|
1504
|
-
}
|
|
1505
|
-
const changed = question.firstElementChild.dataset.signature !== JSON.stringify(read.pending_request || null);
|
|
1506
|
-
question.hidden = !read.pending_request;
|
|
1507
|
-
renderPending(read.pending_request, state.id, question.firstElementChild);
|
|
1508
|
-
if (read.pending_request && changed) {
|
|
1509
|
-
if (read.screen && read.pending_request.kind === "select") question.firstElementChild.prepend(el("pre", {text:read.screen}));
|
|
1510
|
-
question.scrollIntoView({block:"nearest"});
|
|
1511
|
-
}
|
|
1512
|
-
if (read.last_error) report(read.last_error);
|
|
1513
|
-
controls();
|
|
1514
|
-
}
|
|
1515
|
-
async function poll() {
|
|
1516
|
-
if (!state.id || panel.hidden || document.hidden || reading || writing) return;
|
|
1517
|
-
const version = generation;
|
|
1518
|
-
reading = true;
|
|
1519
|
-
try {
|
|
1520
|
-
const read = await api("session_read", {session_id:state.id, after:cursor, include_inline_images:false});
|
|
1521
|
-
if (generation === version) {
|
|
1522
|
-
if (!cursor || read.history_reset) chatHistory = [];
|
|
1523
|
-
chatHistory.push(...(read.history || []));
|
|
1524
|
-
cursor = read.cursor;
|
|
1525
|
-
draw({...read, history:chatHistory});
|
|
1526
|
-
}
|
|
1527
|
-
} catch (e) { if (generation === version) report(e.message); }
|
|
1528
|
-
finally { reading = false; if (generation !== version) void poll(); }
|
|
1529
|
-
}
|
|
1530
|
-
function openChat(trigger, id) {
|
|
1531
|
-
if (id && id !== state.id) {
|
|
1532
|
-
if (writing) return;
|
|
1533
|
-
state = {id}; save(); resetView();
|
|
1534
|
-
}
|
|
1535
|
-
opener = trigger || launch;
|
|
1536
|
-
state.open = true; save();
|
|
1537
|
-
panel.hidden = false; launch.hidden = true; launch.setAttribute("aria-expanded","true");
|
|
1538
|
-
input.focus({preventScroll:true}); void poll();
|
|
1539
|
-
}
|
|
1540
|
-
function hideChat() {
|
|
1541
|
-
state.open = false; save(); panel.hidden = true; launch.hidden = false;
|
|
1542
|
-
launch.setAttribute("aria-expanded","false"); opener.focus({preventScroll:true});
|
|
1543
|
-
}
|
|
1544
|
-
launch.onclick = () => openChat(launch);
|
|
1545
|
-
byId("jaxon-hide").onclick = hideChat;
|
|
1546
|
-
panel.addEventListener("keydown", e => { if (e.key === "Escape") { e.preventDefault(); hideChat(); } });
|
|
1547
|
-
document.querySelectorAll("[data-ask-jaxon]").forEach(button => {
|
|
1548
|
-
button.onclick = () => openChat(button, button.dataset.askJaxon);
|
|
1549
|
-
});
|
|
1550
|
-
fresh.onclick = () => { state = {open:true}; save(); resetView(); input.focus(); };
|
|
1551
|
-
input.oninput = () => { state.draft = input.value; save(); };
|
|
1552
|
-
form.onsubmit = async e => {
|
|
1553
|
-
e.preventDefault();
|
|
1554
|
-
const text = input.value.trim();
|
|
1555
|
-
if (!text || form.querySelector('[type="submit"]').disabled) return;
|
|
1556
|
-
if (state.retry?.text !== text) state.retry = {text, id:crypto.randomUUID()};
|
|
1557
|
-
save(); writing = true; generation++; report(""); controls(); status.textContent = "Sending…";
|
|
1558
|
-
try {
|
|
1559
|
-
const result = await api("ask_jaxon", {text, ...(state.id ? {session_id:state.id} : {}), client_request_id:state.retry.id});
|
|
1560
|
-
state.id = result.session_id || state.id; state.draft = ""; delete state.retry; save(); input.value = "";
|
|
1561
|
-
draw({...snapshot, status:result.status, turn_id:result.turn_id, history:snapshot?.history || []});
|
|
1562
|
-
} catch (err) { report(err.message); status.textContent = "Message could not be sent"; }
|
|
1563
|
-
finally { writing = false; controls(); void poll(); }
|
|
1564
|
-
};
|
|
1565
|
-
stop.onclick = async () => {
|
|
1566
|
-
if (writing || !snapshot?.turn_id) return;
|
|
1567
|
-
writing = true; generation++; controls(); report("");
|
|
1568
|
-
try { await api("session_interrupt", {session_id:state.id, turn_id:snapshot.turn_id}); }
|
|
1569
|
-
catch (err) { report(err.message); }
|
|
1570
|
-
finally { writing = false; controls(); void poll(); }
|
|
1571
|
-
};
|
|
1572
|
-
resetView();
|
|
1573
|
-
if (state.open || (location.pathname === "/sessions" && new URL(location.href).searchParams.get("view") === "jaxon")) openChat(launch);
|
|
1574
|
-
document.addEventListener("visibilitychange", poll);
|
|
1575
|
-
document.addEventListener("console-operation", e => { if (e.detail.operation === "session_reply") void poll(); });
|
|
1576
|
-
setInterval(poll, 2000);
|
|
1577
|
-
}
|
|
1578
|
-
` + ACTIVITY_JS + `\nmountStationActivity();\nmountJaXonChat();\n`;
|
|
1538
|
+
// The shared conversation surface consumes the same Markdown and prompt helpers.
|
|
1539
|
+
window.JaxonConversation = { renderMarkdown, renderPending };
|
|
1540
|
+
` + ACTIVITY_JS + `\nmountStationActivity();\n`;
|