lampson 0.5.2 → 0.5.4
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/chat.syn +17 -12
- package/cli.syn +8 -1
- package/hub.tpl.syn +4 -4
- package/lampson.ps1 +9 -7
- package/lampson.sh +22 -8
- package/lib/agents.syn +35 -27
- package/lib/api.syn +37 -35
- package/lib/apikeys.syn +8 -8
- package/lib/approvals.syn +11 -7
- package/lib/apptools.syn +27 -24
- package/lib/channels.syn +38 -36
- package/lib/computer.syn +20 -20
- package/lib/diagnose.syn +9 -7
- package/lib/fs.syn +11 -11
- package/lib/judge.syn +4 -4
- package/lib/loop.syn +46 -21
- package/lib/lsp.syn +13 -13
- package/lib/mailbox.syn +34 -24
- package/lib/mcp.syn +25 -17
- package/lib/mcp_server.syn +34 -26
- package/lib/permission.syn +3 -1
- package/lib/plugins.syn +48 -40
- package/lib/prompt.syn +5 -5
- package/lib/provider.syn +25 -11
- package/lib/remotetools.syn +3 -1
- package/lib/runtime.syn +112 -85
- package/lib/sched_run.syn +19 -13
- package/lib/schedule.syn +25 -23
- package/lib/session.syn +6 -6
- package/lib/settings.syn +10 -10
- package/lib/skills.syn +9 -9
- package/lib/teamrun.syn +75 -28
- package/lib/teams.syn +190 -115
- package/lib/term.syn +2 -2
- package/lib/tools/bash.syn +2 -2
- package/lib/tools/common.syn +3 -3
- package/lib/tools/edit.syn +1 -1
- package/lib/tools/fetch.syn +7 -3
- package/lib/tools/find.syn +1 -1
- package/lib/tools/grep.syn +2 -2
- package/lib/tools/ls.syn +1 -1
- package/lib/tools/memo.syn +7 -7
- package/lib/tools/proc.syn +10 -10
- package/lib/tools/process.syn +1 -1
- package/lib/tools/read.syn +2 -2
- package/lib/tools/todo.syn +3 -3
- package/lib/tools/write.syn +1 -1
- package/lib/tools.syn +17 -15
- package/lib/trace.syn +5 -5
- package/lib/tree.syn +3 -3
- package/lib/update.syn +6 -0
- package/lib/workspaces.syn +76 -62
- package/lib/worktree.syn +323 -24
- package/package.json +2 -2
- package/plugins/chatwoot/plugin.syn +2 -0
- package/plugins/orders/plugin.json +1 -1
- package/plugins/orders/plugin.syn +1 -1
- package/plugins/telegram/plugin.syn +2 -0
- package/public/css/inbox.css +100 -0
- package/public/css/mobile.css +0 -13
- package/public/css/panel.css +21 -0
- package/public/css/teams.css +20 -52
- package/public/hub.html +3 -0
- package/public/index.html +3 -0
- package/public/js/config.js +3 -3
- package/public/js/devices.js +1 -1
- package/public/js/hub.js +3 -2
- package/public/js/inbox.js +234 -0
- package/public/js/navtabs.js +1 -6
- package/public/js/objlive.js +11 -3
- package/public/js/panel.js +12 -6
- package/public/js/teams-home.js +3 -33
- package/public/js/teams.js +35 -114
- package/public/js/workspaces.js +1 -1
- package/public/plugins-home.html +3 -0
- package/public/tasks-home.html +3 -0
- package/public/teams-home.html +3 -1
- package/public/teams.html +3 -2
- package/run.syn +17 -12
- package/skills/synsema/SKILL.md +3 -3
- package/web.syn +10 -7
package/public/css/panel.css
CHANGED
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
.panel .blist input { flex:none; height:30px; font:400 12px/1.4 var(--mono); background:transparent; padding:0 8px; margin:0 0 8px; width:100%; }
|
|
52
52
|
.panel .bitems { flex:1; overflow-y:auto; overflow-x:hidden; min-height:0; }
|
|
53
53
|
.panel .bcount { color:var(--ink-3); font:400 11px/1 var(--mono); padding-top:8px; border-top:1px solid var(--rule); flex:none; }
|
|
54
|
+
.panel .bback { display:none; }
|
|
54
55
|
.panel .bdetail { overflow-y:auto; overflow-x:hidden; min-height:0; min-width:0; padding:12px 6px 8px 18px; font:400 12.5px/1.5 var(--mono); }
|
|
55
56
|
.panel .bempty { color:var(--ink-3); font:400 12.5px/1.5 var(--serif); padding:8px; }
|
|
56
57
|
.panel .li { display:grid; grid-template-columns:14px minmax(0,1fr); gap:8px; align-items:start; padding:7px 8px; border-radius:var(--r); cursor:pointer; font:400 12px/1.35 var(--mono); min-width:0; }
|
|
@@ -197,3 +198,23 @@
|
|
|
197
198
|
.panel .phelp .pacts { display:flex; align-items:center; gap:8px; }
|
|
198
199
|
.panel .phelp .plinks a { color:var(--accent); cursor:pointer; text-decoration:none; }
|
|
199
200
|
.panel .phelp .plinks a:hover { text-decoration:underline; text-underline-offset:.2em; }
|
|
201
|
+
|
|
202
|
+
/* celular (≤ 900 px): modales a pantalla completa; en «browse» la lista arriba y el detalle abajo. Vive acá y no en
|
|
203
|
+
mobile.css porque el inicio (hub.html: gestionar, dispositivos) también abre paneles y no carga mobile.css */
|
|
204
|
+
@media (max-width:900px) {
|
|
205
|
+
.modal { align-items:stretch; justify-content:stretch; }
|
|
206
|
+
.panel, .panel.lg, .panel.md, .panel.sm { width:100vw; height:100dvh; max-height:none; border:0; border-radius:0; box-shadow:none; padding:calc(10px + env(safe-area-inset-top)) 14px calc(12px + env(safe-area-inset-bottom)); }
|
|
207
|
+
/* lista → detalle (js/panel.js): sin «det» solo la lista; con «det» solo el detalle, con «← volver» arriba */
|
|
208
|
+
.panel .browse { grid-template-columns:minmax(0,1fr); grid-template-rows:minmax(0,1fr); }
|
|
209
|
+
.panel .browse.det { grid-template-rows:auto minmax(0,1fr); }
|
|
210
|
+
.panel .browse:not(.det) .bdetail, .panel .browse.det .blist { display:none; }
|
|
211
|
+
.panel .browse.det .bback { display:block; justify-self:start; margin:8px 0 0; padding:8px 10px 8px 0; background:none; border:0; color:var(--accent); font:400 13px/1 var(--mono); cursor:pointer; }
|
|
212
|
+
.panel .blist { border-right:0; padding:10px 0 8px; }
|
|
213
|
+
.panel .bdetail { padding:12px 2px 8px; }
|
|
214
|
+
.panel input, .panel select, .panel textarea { font-size:16px; }
|
|
215
|
+
.panel .pghost { width:36px; height:36px; flex:none; }
|
|
216
|
+
/* cabecera del modal: la ✕ siempre a la vista (la ruta de «sub» la empujaba fuera de la pantalla) */
|
|
217
|
+
.panel .phead { gap:8px; min-width:0; }
|
|
218
|
+
.panel .phead .sub { display:none; }
|
|
219
|
+
.panel .phead h3 { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
|
220
|
+
}
|
package/public/css/teams.css
CHANGED
|
@@ -18,58 +18,7 @@ body { display:flex; flex-direction:column; height:100vh; overflow:hidden; }
|
|
|
18
18
|
.alllink { font:400 12px/1 var(--mono); color:var(--ink-2); text-decoration:none; padding:6px 8px; border-radius:var(--r-sm); }
|
|
19
19
|
.alllink:hover { color:var(--ink); background:var(--paper-2); }
|
|
20
20
|
|
|
21
|
-
/* lo que espera a la persona */
|
|
22
|
-
.attention { flex:none; border-bottom:1px solid var(--rule); background:var(--paper-2); padding:12px 16px; display:grid; grid-template-columns:repeat(auto-fill, minmax(min(100%, 520px), 1fr)); gap:10px; align-items:start; max-height:52vh; overflow:auto; }
|
|
23
|
-
/* un aviso: el ícono de lo que es, quién y qué quiere, y la respuesta a mano */
|
|
24
|
-
.aviso { --k:var(--accent); display:grid; grid-template-columns:36px minmax(0, 1fr); gap:12px; padding:12px 14px 12px 12px; background:var(--surface); border:1px solid var(--rule-2); border-radius:var(--r-lg); box-shadow:inset 3px 0 0 var(--k); }
|
|
25
|
-
.aviso.k-ask { --k:var(--amber); }
|
|
26
|
-
.aviso.k-ok { --k:var(--rubric); }
|
|
27
|
-
.aviso.k-pass, .aviso.k-git { --k:var(--accent); }
|
|
28
|
-
.aviso.fresh { animation:avin .45s cubic-bezier(.2,.8,.2,1); }
|
|
29
|
-
.aviso.going { opacity:.55; transition:opacity .2s; }
|
|
30
|
-
@keyframes avin { from { opacity:0; translate:0 -8px; } }
|
|
31
|
-
.av-ico { width:36px; height:36px; border-radius:50%; display:grid; place-items:center; background:color-mix(in srgb, var(--k) 16%, transparent); }
|
|
32
|
-
.av-ico .ico { width:20px; height:20px; fill:none; stroke:var(--k); stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
|
|
33
|
-
.av-ico .ico circle.dot, .av-ico .ico circle.bit { fill:var(--k); stroke:none; }
|
|
34
|
-
.av-body { min-width:0; display:flex; flex-direction:column; gap:8px; }
|
|
35
|
-
.av-body header { display:flex; flex-wrap:wrap; align-items:baseline; justify-content:space-between; gap:2px 12px; }
|
|
36
|
-
.av-who { font:400 14.5px/1.35 var(--serif); color:var(--ink-2); }
|
|
37
|
-
.av-who b { font-weight:600; color:var(--ink); }
|
|
38
|
-
.av-meta { font:400 11.5px/1.3 var(--mono); color:var(--ink-3); }
|
|
39
|
-
.av-meta a { color:var(--ink-2); }
|
|
40
|
-
.av-q { font:400 14px/1.5 var(--serif); color:var(--ink); max-height:9.5em; overflow:auto; }
|
|
41
|
-
.av-q p { margin:0 0 4px; } .av-q ul { margin:0 0 4px; padding-left:18px; }
|
|
42
|
-
blockquote.av-q { margin:0; padding:8px 12px; border-left:2px solid var(--rule-2); background:var(--paper-2); border-radius:0 var(--r-sm) var(--r-sm) 0; }
|
|
43
|
-
.av-lbl { margin:0; font:600 12px/1.3 var(--mono); color:var(--ink-3); }
|
|
44
|
-
.av-why { margin:0; font:400 13px/1.45 var(--serif); color:var(--ink-2); }
|
|
45
|
-
.av-cmd { margin:0; padding:8px 10px; font:400 12px/1.5 var(--mono); color:var(--ink); background:var(--paper-2); border-radius:var(--r-sm); white-space:pre-wrap; word-break:break-word; max-height:7.5em; overflow:auto; }
|
|
46
|
-
.av-acts { display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
|
|
47
|
-
.av-acts input { flex:1 1 200px; min-width:0; font:400 13.5px/1.4 var(--serif); background:var(--paper); color:var(--ink); border:1px solid var(--rule-2); border-radius:var(--r); padding:7px 10px; }
|
|
48
|
-
.av-acts input:focus { outline:none; border-color:var(--ink-3); box-shadow:0 0 0 3px var(--accent-bg); }
|
|
49
|
-
.av-exp { margin-left:auto; font:400 11.5px/1 var(--mono); color:var(--ink-3); }
|
|
50
|
-
/* el merge: qué rama entra a cuál, y qué trae */
|
|
51
|
-
.av-merge { display:flex; flex-direction:column; gap:6px; }
|
|
52
|
-
.av-flow { display:flex; flex-wrap:wrap; align-items:center; gap:6px 8px; }
|
|
53
|
-
.av-flow code { font:600 12.5px/1.2 var(--mono); color:var(--ink); background:var(--paper-2); border:1px solid var(--rule); border-radius:var(--r-sm); padding:3px 7px; }
|
|
54
|
-
.av-flow .arr { width:22px; height:11px; fill:none; stroke:var(--ink-3); stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
|
|
55
|
-
.av-badge { margin-left:auto; font:600 11.5px/1 var(--mono); padding:4px 8px; border-radius:var(--r-pill); }
|
|
56
|
-
.av-badge.ok { color:var(--ok); background:color-mix(in srgb, var(--ok) 14%, transparent); }
|
|
57
|
-
.av-badge.bad { color:var(--rubric); background:color-mix(in srgb, var(--rubric) 14%, transparent); }
|
|
58
|
-
.av-stat { margin:0; font:400 12.5px/1.4 var(--mono); color:var(--ink-2); }
|
|
59
|
-
.av-merge .add { color:var(--ok); } .av-merge .del { color:var(--rubric); }
|
|
60
|
-
.av-commits { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:3px; }
|
|
61
|
-
.av-commits li { display:flex; gap:8px; align-items:baseline; font:400 13.5px/1.4 var(--serif); color:var(--ink); min-width:0; }
|
|
62
|
-
.av-commits .sha { flex:none; font:400 11.5px/1 var(--mono); color:var(--ink-3); }
|
|
63
|
-
.av-commits .sj { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
|
64
|
-
.av-commits .by { flex:none; margin-left:auto; font:400 11.5px/1 var(--mono); color:var(--ink-3); }
|
|
65
|
-
.av-commits .more { color:var(--ink-3); font-size:12.5px; }
|
|
66
|
-
.av-files summary { cursor:pointer; font:400 12px/1.4 var(--mono); color:var(--ink-2); }
|
|
67
|
-
.av-files ul { list-style:none; margin:6px 0; padding:0; display:flex; flex-direction:column; gap:2px; max-height:9em; overflow:auto; }
|
|
68
|
-
.av-files li { display:flex; gap:8px; font:400 12px/1.4 var(--mono); }
|
|
69
|
-
.av-files .fp { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--ink); }
|
|
70
|
-
.av-warn { margin:0; font:400 13px/1.45 var(--serif); color:var(--rubric); }
|
|
71
|
-
.av-warn code { font-family:var(--mono); font-size:12px; }
|
|
72
|
-
@media (prefers-reduced-motion: reduce) { .aviso.fresh { animation:none; } }
|
|
21
|
+
/* los avisos de lo que espera a la persona y la bandeja: css/inbox.css */
|
|
73
22
|
button.ok { color:var(--paper); background:var(--ok); border-color:var(--ok); }
|
|
74
23
|
button.no { color:var(--rubric); border-color:var(--rubric); }
|
|
75
24
|
|
|
@@ -150,6 +99,8 @@ button.no { color:var(--rubric); border-color:var(--rubric); }
|
|
|
150
99
|
.log .k.message { color:var(--str); }
|
|
151
100
|
.log .k.approval, .log .k.asked, .log .k.denied, .log .k.budget, .log .k.paused, .log .k.failed { color:var(--rubric); }
|
|
152
101
|
.log .k.done, .log .k.approved { color:var(--ok); }
|
|
102
|
+
.log .k.error { color:var(--rubric); font-weight:600; }
|
|
103
|
+
.log .x.why { color:var(--rubric); }
|
|
153
104
|
.log .x { display:block; color:var(--ink-2); margin-top:3px; white-space:pre-wrap; word-break:break-word; }
|
|
154
105
|
.log li.fresh { animation:fresh 2.5s ease-out; }
|
|
155
106
|
@keyframes fresh { from { background:var(--accent-bg); } to { background:transparent; } }
|
|
@@ -367,6 +318,18 @@ a.btn.primary:hover { opacity:.85; }
|
|
|
367
318
|
/* acá el body deja de medir la pantalla (scroll normal): el lienzo necesita su propio alto */
|
|
368
319
|
.view.teamsview { flex:none; height:calc(100dvh - 48px); }
|
|
369
320
|
.crumbs .sep, .crumbs a:first-child, .crumbs .here, .tbar .alllink { display:none; }
|
|
321
|
+
/* barra de edición del equipo: una cosa por fila (en una sola fila los campos y los botones se pisaban) */
|
|
322
|
+
.tsub { gap:10px; padding:8px 12px 12px; }
|
|
323
|
+
.tsub-l { flex:1 1 100%; gap:10px; }
|
|
324
|
+
.tsub .back { flex:1 1 100%; text-align:left; padding:4px 0; }
|
|
325
|
+
.tsub .namebox, .tsub label.inl.grow { flex:1 1 100%; min-width:0; }
|
|
326
|
+
.tsub .namebox label.inl { width:100%; }
|
|
327
|
+
.tsub label.inl input { flex:1; width:auto; }
|
|
328
|
+
.namebox .slug { position:static; display:block; margin:6px 0 0; white-space:normal; }
|
|
329
|
+
.tsub-r { flex:1 1 100%; justify-content:flex-end; }
|
|
330
|
+
details.advpop > .advgrid { width:calc(100vw - 24px); max-width:340px; }
|
|
331
|
+
/* «+ asiento» a la derecha: centrado tapaba los controles del lienzo (zoom, ordenar) de abajo a la izquierda */
|
|
332
|
+
.ov-add { left:auto; right:12px; transform:none; padding:6px; }
|
|
370
333
|
#crProj::before { content:'‹ '; }
|
|
371
334
|
.ov-insp { left:12px; right:12px; width:auto; top:auto; max-height:62%; }
|
|
372
335
|
.ahint { display:none; }
|
|
@@ -705,6 +668,10 @@ button.lvover { cursor:pointer; font:inherit; }
|
|
|
705
668
|
.fl-node.lv.done { border-color:var(--ok); }
|
|
706
669
|
.fl-node.lv.done .fl-pip { background:var(--ok); }
|
|
707
670
|
.fl-node.lv.blocked { border-color:var(--rubric); }
|
|
671
|
+
.fl-node.lv.asks { opacity:1; border-color:var(--amber); box-shadow:0 0 0 4px color-mix(in srgb, var(--amber) 16%, transparent); }
|
|
672
|
+
.fl-node.lv.asks .lvact { color:var(--ink); }
|
|
673
|
+
.fl-node.lv.asks .ico { stroke:var(--amber); }
|
|
674
|
+
.fl-node.lv.asks .ico .dot { fill:var(--amber); }
|
|
708
675
|
.fl-node.lv.talking { z-index:4; }
|
|
709
676
|
.fl-node.lv.hit-ok { animation:lvhit .8s ease-out; }
|
|
710
677
|
.fl-node.lv.hit-recv { animation:lvrecv .8s ease-out; }
|
|
@@ -831,3 +798,4 @@ button.lvover { cursor:pointer; font:inherit; }
|
|
|
831
798
|
.fl-node.lv, .fl-node.lv.busy::before, .fl-node.lv .ico *, .lvhead .crew .pulse, .spin, .lvact .tx.enter, .kc.appear, .kc.pop, .kc.land, .lvticker .ti.new, .fl-edge.live .line, .lvbubble, .lvhead .tok.up { animation:none !important; }
|
|
832
799
|
}
|
|
833
800
|
@media (max-width: 1000px) { .odetail.lvmode { overflow:auto; } .lvgrid { grid-template-columns:minmax(0, 1fr); grid-template-rows:460px 420px; } }
|
|
801
|
+
.ti .err { color:var(--rubric); }
|
package/public/hub.html
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
<link rel="stylesheet" href="/css/chat.css">
|
|
17
17
|
<link rel="stylesheet" href="/css/panel.css">
|
|
18
18
|
<link rel="stylesheet" href="/css/hub.css">
|
|
19
|
+
<link rel="stylesheet" href="/css/inbox.css">
|
|
19
20
|
<script>(function(){try{var t=localStorage.getItem('lampson.theme');if(t!=='light'&&t!=='dark'){t='dark';}document.documentElement.setAttribute('data-theme',t);}catch(e){}})();</script>
|
|
20
21
|
</head>
|
|
21
22
|
<body class="hub">
|
|
@@ -24,6 +25,7 @@
|
|
|
24
25
|
<span class="brand">lampson</span>
|
|
25
26
|
<nav class="navtabs" data-on="proyectos"></nav>
|
|
26
27
|
<span class="spacer"></span>
|
|
28
|
+
<span class="inbox-slot" data-inbox></span>
|
|
27
29
|
<span class="pill" id="devicesBtn" role="button" tabindex="0">dispositivos</span>
|
|
28
30
|
<button class="theme-toggle" id="theme" type="button" title="cambiar tema"></button>
|
|
29
31
|
</div>
|
|
@@ -48,6 +50,7 @@
|
|
|
48
50
|
</main>
|
|
49
51
|
<script src="/js/panel.js"></script>
|
|
50
52
|
<script src="/js/navtabs.js"></script>
|
|
53
|
+
<script src="/js/inbox.js"></script>
|
|
51
54
|
<script src="/js/hub.js"></script>
|
|
52
55
|
<script src="/js/workspaces.js"></script>
|
|
53
56
|
<script src="/vendor/qrcode.js"></script>
|
package/public/index.html
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
<link rel="stylesheet" href="/css/chat.css">
|
|
19
19
|
<link rel="stylesheet" href="/css/panel.css">
|
|
20
20
|
<link rel="stylesheet" href="/css/code.css">
|
|
21
|
+
<link rel="stylesheet" href="/css/inbox.css">
|
|
21
22
|
<link rel="stylesheet" href="/css/mobile.css">
|
|
22
23
|
<link rel="stylesheet" href="/vendor/xterm.css">
|
|
23
24
|
<script src="/vendor/xterm.js"></script>
|
|
@@ -31,6 +32,7 @@
|
|
|
31
32
|
<div class="hrow">
|
|
32
33
|
<span class="brand"><a class="home" id="home">lampson</a><span class="proj" id="proj">…</span></span>
|
|
33
34
|
<span class="spacer"></span>
|
|
35
|
+
<span class="inbox-slot" data-inbox></span>
|
|
34
36
|
<button class="hbtn upd" id="update" style="display:none"></button>
|
|
35
37
|
<button class="hbtn" id="term" title="terminal real (shell en el workspace): lo abre, lo trae de vuelta si está minimizado y lo esconde si está a la vista — verde = shell abierta">>_ terminal</button>
|
|
36
38
|
<button class="hbtn" id="teamsBtn" title="objetivos y equipos de agentes: lo que trabajan solos, sus tableros y quién reporta a quién (pantalla propia)">equipos</button>
|
|
@@ -154,6 +156,7 @@
|
|
|
154
156
|
<script src="/js/events.js"></script>
|
|
155
157
|
<script src="/js/mobile.js"></script>
|
|
156
158
|
<script src="/js/app.js"></script>
|
|
159
|
+
<script src="/js/inbox.js"></script>
|
|
157
160
|
<script src="/js/pwa.js"></script>
|
|
158
161
|
</body>
|
|
159
162
|
</html>
|
package/public/js/config.js
CHANGED
|
@@ -46,7 +46,7 @@ async function openCfg(section, onboarding) {
|
|
|
46
46
|
const v = r.values || {};
|
|
47
47
|
Panel.open({
|
|
48
48
|
id: 'config', eyebrow: 'configuración', title: onboarding ? 'Bienvenido a Lampson' : 'Configuración', sub: 'lampson/.lampson/config.json', layout: 'browse', noClose: !!onboarding,
|
|
49
|
-
select: section || 'general',
|
|
49
|
+
select: section || 'general', detail: !!section,
|
|
50
50
|
browse: {
|
|
51
51
|
placeholder: 'buscar…', listWidth: '260px', nodot: true, key: s => s.id,
|
|
52
52
|
load: async (q) => CFG_SECTIONS.filter(s => !q || (s.name + ' ' + s.meta).toLowerCase().includes(q.toLowerCase())),
|
|
@@ -238,6 +238,6 @@ async function openCfg(section, onboarding) {
|
|
|
238
238
|
}
|
|
239
239
|
// proveedor: la pill de la cabecera y el onboarding abren la misma vista, parados en «Proveedor»
|
|
240
240
|
function openSetup(onboarding) { openCfg('provider', onboarding); }
|
|
241
|
-
$('#cfgBtn').onclick = () => openCfg(
|
|
241
|
+
$('#cfgBtn').onclick = () => openCfg();
|
|
242
242
|
$('#model').onclick = () => openSetup(false);
|
|
243
|
-
if (location.hash === '#config') setTimeout(() => openCfg(
|
|
243
|
+
if (location.hash === '#config') setTimeout(() => openCfg(), 400);
|
package/public/js/devices.js
CHANGED
|
@@ -50,7 +50,7 @@ function pairWire(box) {
|
|
|
50
50
|
function openDevices() {
|
|
51
51
|
Panel.open({
|
|
52
52
|
id: 'devices', eyebrow: 'acceso remoto', title: 'Dispositivos', sub: authMe.local ? 'celulares y tablets que pueden entrar a esta PC' : 'entraste desde un dispositivo emparejado', layout: 'browse',
|
|
53
|
-
select: authMe.local ? '__pair' : null,
|
|
53
|
+
select: authMe.local ? '__pair' : null, detail: false,
|
|
54
54
|
onClose: stopPairTimer,
|
|
55
55
|
browse: {
|
|
56
56
|
placeholder: 'buscar dispositivo…', listWidth: '280px', key: d => d.id,
|
package/public/js/hub.js
CHANGED
|
@@ -119,9 +119,10 @@ function paintHome() {
|
|
|
119
119
|
const attn = $('#wsAttn'), box = $('#wsGroups');
|
|
120
120
|
if (!wsData) { attn.innerHTML = ''; $('#wsTiles').innerHTML = ''; box.innerHTML = '<p class="none">el hub no responde</p>'; return; }
|
|
121
121
|
const all = (wsData.workspaces || []).slice().sort((a, b) => (b.last_used || 0) - (a.last_used || 0));
|
|
122
|
-
// lo que te espera, de todos los proyectos (la búsqueda no lo esconde)
|
|
122
|
+
// lo que te espera, de todos los proyectos (la búsqueda no lo esconde): una línea por proyecto que abre la bandeja
|
|
123
|
+
// (js/inbox.js), así no crece con cada aviso
|
|
123
124
|
const waiting = all.map(w => ({ w, n: waitingIn(w) })).filter(x => x.n);
|
|
124
|
-
attn.innerHTML = waiting.length ? `<p class="ghead warn">Necesita tu atención</p>` + waiting.map(({ w, n }) => `<a class="attn" href="
|
|
125
|
+
attn.innerHTML = waiting.length ? `<p class="ghead warn">Necesita tu atención</p>` + waiting.map(({ w, n }) => `<a class="attn" href="#inbox"><span class="ic">⚑</span><span class="tx"><b>${esc(w.name)}</b> · ${n === 1 ? 'una cosa te espera' : n + ' cosas te esperan'}</span><span class="go">responder →</span></a>`).join('') : '';
|
|
125
126
|
const q = ($('#wsSearch').value || '').trim().toLowerCase();
|
|
126
127
|
paintTiles(q);
|
|
127
128
|
const list = q ? all.filter(w => (w.name + ' ' + w.path).toLowerCase().includes(q)) : all;
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
// inbox.js — lo que te espera, de todos los proyectos: preguntas y aprobaciones de los objetivos, merges y push con lo
|
|
2
|
+
// que entra, pases a otro equipo y comandos que piden permiso. UNA implementación para todas las pantallas:
|
|
3
|
+
// * la bandeja: el botón ⚑ de la cabecera (donde la página pone <span data-inbox></span>) abre un panel a la derecha
|
|
4
|
+
// (a pantalla completa en el celular) con todo, agrupado por proyecto. /#inbox la abre al cargar.
|
|
5
|
+
// * Inbox.objective(el, slug, id): la pregunta de un objetivo en su propia página, con la respuesta ahí mismo.
|
|
6
|
+
// * Inbox.strip(el, slug, id): esa pregunta en una línea (la pantalla en vivo); tocarla abre la bandeja en ella.
|
|
7
|
+
// Lee GET /api/teams-home (el resumen de cada workspace) y, si un proyecto tiene aprobaciones, su /w/<slug>/api/approvals
|
|
8
|
+
// (trae la vista previa del merge: lib/worktree.syn → preview). Responder va directo al workspace por el proxy del hub.
|
|
9
|
+
// Estilos: css/inbox.css.
|
|
10
|
+
(function () {
|
|
11
|
+
const esc = (s) => String(s ?? '').replace(/[&<>"]/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c]));
|
|
12
|
+
const short = (slug) => String(slug).replace(/-[0-9a-f]{8}$/, '');
|
|
13
|
+
const unescapeU = (t) => String(t ?? '').replace(/\\u([0-9a-fA-F]{4})/g, (m, h) => String.fromCharCode(parseInt(h, 16)));
|
|
14
|
+
const ago = (t) => { const s = Math.max(0, Date.now() / 1000 - (t || 0)); return s < 60 ? 'recién' : s < 3600 ? `hace ${Math.floor(s / 60)} min` : s < 86400 ? `hace ${Math.floor(s / 3600)} h` : `hace ${Math.floor(s / 86400)} d`; };
|
|
15
|
+
const when = (t) => new Date((t || 0) * 1000).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
|
|
16
|
+
const SVG = (inner, cls = 'ico') => `<svg class="${cls}" viewBox="0 0 24 24" aria-hidden="true">${inner}</svg>`;
|
|
17
|
+
const ICON = {
|
|
18
|
+
ask: SVG('<path d="M4 5.5h16a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1H10l-4.5 3.5v-3.5H4a1 1 0 0 1-1-1v-9a1 1 0 0 1 1-1z"/><circle class="dot" cx="8.5" cy="11" r="1"/><circle class="dot" cx="12" cy="11" r="1"/><circle class="dot" cx="15.5" cy="11" r="1"/>'),
|
|
19
|
+
ok: SVG('<circle cx="8" cy="15" r="4.5"/><path d="M11.3 11.7 20 3M16.5 6.5l2.5 2.5M14 9l2 2"/>'),
|
|
20
|
+
git: SVG('<circle cx="6" cy="5.5" r="2.2"/><circle cx="6" cy="18.5" r="2.2"/><circle cx="18" cy="7.5" r="2.2"/><path d="M6 7.7v8.6"/><path d="M18 9.7c0 4.3-7.5 3.3-11.2 6.9"/>'),
|
|
21
|
+
pass: SVG('<rect x="2.5" y="6" width="13" height="10" rx="1.8"/><path d="M3 7l6 4.4L15 7"/><path d="M15 17.5h6.5M18.5 14.5l3 3-3 3"/>'),
|
|
22
|
+
};
|
|
23
|
+
const ARROW = '<svg class="arr" viewBox="0 0 24 12" aria-hidden="true"><path d="M1 6h20M16 1.5 21 6l-5 4.5"/></svg>';
|
|
24
|
+
|
|
25
|
+
// ---------- texto con formato: párrafos, listas, `código`, **negrita** ----------
|
|
26
|
+
const mdInline = (t) => esc(unescapeU(t)).replace(/`([^`]+)`/g, '<code>$1</code>').replace(/\*\*([^*]+)\*\*/g, '<b>$1</b>');
|
|
27
|
+
function md(txt) {
|
|
28
|
+
const lines = String(txt || '').split(/\n+/).map((l) => l.trim()).filter(Boolean);
|
|
29
|
+
let html = '', list = false;
|
|
30
|
+
for (const l of lines) {
|
|
31
|
+
const li = l.match(/^(?:[-•*]|\d+[.)])\s+(.*)$/);
|
|
32
|
+
if (li && !list) { html += '<ul>'; list = true; }
|
|
33
|
+
if (!li && list) { html += '</ul>'; list = false; }
|
|
34
|
+
html += li ? `<li>${mdInline(li[1])}</li>` : `<p>${mdInline(l)}</p>`;
|
|
35
|
+
}
|
|
36
|
+
return html + (list ? '</ul>' : '');
|
|
37
|
+
}
|
|
38
|
+
// por qué pide permiso, en palabras
|
|
39
|
+
function whyText(why) {
|
|
40
|
+
const w = String(why || '').replace(/ · agent \S+$/, '');
|
|
41
|
+
let m;
|
|
42
|
+
if ((m = w.match(/dangerous pattern: (.+)$/))) return `Es un comando que puede borrar o cambiar cosas difíciles de recuperar (${m[1].trim()}).`;
|
|
43
|
+
if ((m = w.match(/asks before every (\S+) call/))) return `Este agente pide permiso antes de cada «${m[1]}».`;
|
|
44
|
+
if (/once per objective/.test(w)) return 'Trabaja en tu propia copia del proyecto (tu checkout). Si aprobás, el equipo puede trabajar ahí sin volver a preguntarte hasta que termine este objetivo: correr cosas, integrar a tu rama principal (merge), arreglar, etiquetar. El push te lo sigue preguntando.';
|
|
45
|
+
if (/git push/.test(w)) return 'Sube cambios fuera de esta máquina: cada push lo aprobás vos.';
|
|
46
|
+
if (/shared history/.test(w)) return 'Toca la historia compartida del proyecto: siempre lo aprobás vos.';
|
|
47
|
+
return w;
|
|
48
|
+
}
|
|
49
|
+
const filesOpen = new Set();
|
|
50
|
+
function mergeHtml(a) {
|
|
51
|
+
const p = a.preview;
|
|
52
|
+
if (!p) return `<pre class="av-cmd">${esc(a.message)}</pre>`;
|
|
53
|
+
if (p.missing) return `<p class="av-warn">La rama <code>${esc(p.branch)}</code> no existe: si lo aprobás, el comando va a fallar.</p><pre class="av-cmd">${esc(a.message)}</pre>`;
|
|
54
|
+
const add = p.files.reduce((n, f) => n + f.add, 0), del = p.files.reduce((n, f) => n + f.del, 0);
|
|
55
|
+
const badge = p.conflicts ? `<span class="av-badge bad">choca con ${esc(p.into)}</span>` : `<span class="av-badge ok">${p.ff ? 'avance directo' : 'sin conflictos'}</span>`;
|
|
56
|
+
return `<div class="av-merge">
|
|
57
|
+
<div class="av-flow"><code>${esc(p.branch)}</code>${ARROW}<code>${esc(p.into || 'remoto')}</code>${badge}</div>
|
|
58
|
+
${p.count ? `<p class="av-stat">${p.count} commit${p.count === 1 ? '' : 's'} · ${p.files.length} archivo${p.files.length === 1 ? '' : 's'} <span class="add">+${add}</span> <span class="del">−${del}</span></p>
|
|
59
|
+
<ul class="av-commits">${p.commits.slice(0, 4).map((c) => `<li><span class="sha">${esc(c.sha)}</span><span class="sj">${esc(c.subject)}</span><span class="by">${esc(String(c.author).split(' · ')[0])}</span></li>`).join('')}${p.count > 4 ? `<li class="more">y ${p.count - 4} más</li>` : ''}</ul>
|
|
60
|
+
<details class="av-files" data-k="${esc(a.id)}"${filesOpen.has(a.id) ? ' open' : ''}><summary>ver archivos y comando</summary><ul>${p.files.map((f) => `<li><span class="fp">${esc(f.path)}</span><span class="add">+${f.add}</span><span class="del">−${f.del}</span></li>`).join('')}</ul><pre class="av-cmd">${esc(a.message)}</pre></details>` : `<p class="av-stat">No trae nada nuevo: ${esc(p.into)} ya tiene todo lo de esta rama.</p>`}
|
|
61
|
+
${p.conflicts ? '<p class="av-warn">Toca las mismas líneas que cambiaron en la rama principal: si lo aprobás, el merge se frena con conflictos y el agente tiene que resolverlos.</p>' : ''}
|
|
62
|
+
</div>`;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// ---------- los datos: un ítem por cosa que te espera ----------
|
|
66
|
+
let items = [], loaded = false;
|
|
67
|
+
const apCache = {}; // slug → {sig, list}: las aprobaciones con su vista previa, pedidas solo si cambiaron
|
|
68
|
+
async function getJSON(u) { const r = await fetch(u); if (r.status === 401) { location.href = '/login'; return {}; } return r.json(); }
|
|
69
|
+
async function load() {
|
|
70
|
+
let ws = [];
|
|
71
|
+
try { ws = (await getJSON('/api/teams-home')).workspaces || []; } catch (e) { return items; }
|
|
72
|
+
const out = [];
|
|
73
|
+
for (const w of ws) {
|
|
74
|
+
const seat = (agent) => { for (const t of w.teams || []) { const s = (t.seats || []).find((x) => x.agent === agent); if (s) return { role: s.role || agent, team: t }; } return { role: agent, team: null }; };
|
|
75
|
+
const teamName = (id) => { const t = (w.teams || []).find((x) => x.id === id); return t ? t.name || t.id : id; };
|
|
76
|
+
for (const o of (w.objectives || []).filter((o) => o.status === 'waiting')) {
|
|
77
|
+
const s = seat(o.agent), team = s.team || (w.teams || []).find((t) => t.id === o.team);
|
|
78
|
+
const href = '/w/' + encodeURIComponent(w.slug) + (o.team ? '/equipos/' + encodeURIComponent(o.team) + '/objetivos/' : '/objetivos/') + o.id;
|
|
79
|
+
out.push({ key: w.slug + ':o' + o.id, slug: w.slug, ws: w.name || short(w.slug), kind: 'objective', o, who: s.role, team: team ? team.name || team.id : '', href, at: o.updated_at, teamName });
|
|
80
|
+
}
|
|
81
|
+
const pend = w.approvals || [];
|
|
82
|
+
if (pend.length) {
|
|
83
|
+
const sig = pend.map((a) => a.id).join(',');
|
|
84
|
+
if (!apCache[w.slug] || apCache[w.slug].sig !== sig) {
|
|
85
|
+
let full = [];
|
|
86
|
+
try { full = ((await getJSON('/w/' + encodeURIComponent(w.slug) + '/api/approvals')).approvals || []).filter((a) => a.status === 'pending'); } catch (e) {}
|
|
87
|
+
apCache[w.slug] = { sig, list: full };
|
|
88
|
+
}
|
|
89
|
+
for (const a0 of pend) {
|
|
90
|
+
const a = apCache[w.slug].list.find((x) => x.id === a0.id) || a0;
|
|
91
|
+
const agent = (String(a.why || '').match(/agent (\S+)/) || [])[1], s = agent ? seat(agent) : { role: 'un agente', team: null };
|
|
92
|
+
out.push({ key: w.slug + ':a' + a.id, slug: w.slug, ws: w.name || short(w.slug), kind: 'approval', a, who: s.role, team: s.team ? s.team.name || s.team.id : '', at: a.created });
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
items = out.sort((x, y) => (y.at || 0) - (x.at || 0)); loaded = true;
|
|
97
|
+
paintButtons();
|
|
98
|
+
listeners = listeners.filter((l) => l.el.isConnected); listeners.forEach((l) => l.draw());
|
|
99
|
+
return items;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// ---------- un aviso ----------
|
|
103
|
+
const seen = new Set();
|
|
104
|
+
function avisoHtml(it) {
|
|
105
|
+
const meta = `${it.team ? esc(it.team) + ' · ' : ''}${it.href ? `<a href="${esc(it.href)}">${esc(it.o.ref)}</a> · ` : ''}${ago(it.at)}`;
|
|
106
|
+
const box = (kind, verb, body, acts) => {
|
|
107
|
+
const fresh = !seen.has(it.key); seen.add(it.key);
|
|
108
|
+
return `<article class="aviso k-${kind}${fresh ? ' fresh' : ''}" data-key="${esc(it.key)}"><span class="av-ico">${ICON[kind]}</span><div class="av-body">
|
|
109
|
+
<header><span class="av-who"><b>${esc(it.who)}</b> ${verb}</span><span class="av-meta">${meta}</span></header>${body}<div class="av-acts">${acts}</div></div></article>`;
|
|
110
|
+
};
|
|
111
|
+
const k = esc(it.key);
|
|
112
|
+
if (it.kind === 'objective') {
|
|
113
|
+
const o = it.o, pass = String(o.question || '').match(/^hand over to team (\S+):\n?([\s\S]*)$/);
|
|
114
|
+
if (pass) return box('pass', `quiere pasarle el trabajo a <b>${esc(it.teamName(pass[1]))}</b>`, `<p class="av-lbl">Lo que le va a pedir:</p><blockquote class="av-q">${md(pass[2])}</blockquote>`,
|
|
115
|
+
`<input data-in="${k}" placeholder="nota para ${esc(it.who)} (opcional)"><button class="ok" data-do="approve">Pasárselo</button><button class="no" data-do="deny">No pasarlo</button>`);
|
|
116
|
+
if (o.question_kind === 'approval') return box('ok', 'te pide aprobación', `<div class="av-q">${md(o.question)}</div>`,
|
|
117
|
+
`<input data-in="${k}" placeholder="nota (opcional)"><button class="ok" data-do="approve">Aprobar</button><button class="no" data-do="deny">Denegar</button>`);
|
|
118
|
+
return box('ask', 'te pregunta', `<div class="av-q">${md(o.question)}</div>`, `<input data-in="${k}" placeholder="tu respuesta"><button class="primary" data-do="answer">Responder</button>`);
|
|
119
|
+
}
|
|
120
|
+
const a = it.a, p = a.preview, exp = a.expires_at ? `<span class="av-exp">vence ${esc(when(a.expires_at))}</span>` : '';
|
|
121
|
+
if (p) return box('git', p.kind === 'push' ? `quiere subir <b>${esc(p.branch)}</b>` : `quiere llevar el trabajo a <b>${esc(p.into)}</b>`,
|
|
122
|
+
mergeHtml(a) + `<p class="av-why">${esc(whyText(a.why))}</p>`, `<button class="ok" data-do="qok">${p.kind === 'push' ? 'Aprobar push' : 'Aprobar merge'}</button>${/once per objective/.test(a.why || '') ? '<button data-do="qonce">Solo esta vez</button>' : ''}<button class="no" data-do="qno">Denegar</button>${exp}`);
|
|
123
|
+
// en tu copia: aprobar vale para todo el objetivo; «solo esta vez» deja correr este comando y el próximo vuelve a preguntar
|
|
124
|
+
const scoped = /once per objective/.test(a.why || '');
|
|
125
|
+
return box('ok', 'quiere correr un comando', `<pre class="av-cmd">${esc(a.message)}</pre><p class="av-why">${esc(whyText(a.why))}</p>`,
|
|
126
|
+
`<button class="ok" data-do="qok">${scoped ? 'Aprobar para este objetivo' : 'Aprobar'}</button>${scoped ? '<button data-do="qonce">Solo esta vez</button>' : ''}<button class="no" data-do="qno">Denegar</button>${exp}`);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// ---------- dibujar y responder (lo escrito y el foco sobreviven al pulso) ----------
|
|
130
|
+
const typed = {};
|
|
131
|
+
async function post(u, body) { const r = await fetch(u, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(body) }); if (r.status === 401) location.href = '/login'; return r.ok; }
|
|
132
|
+
async function act(it, what, text) {
|
|
133
|
+
const base = '/w/' + encodeURIComponent(it.slug) + '/api/';
|
|
134
|
+
if (what === 'qok' || what === 'qno' || what === 'qonce') await post(base + 'approve', { id: it.a.id, decision: what === 'qonce' ? 'once' : what === 'qok' });
|
|
135
|
+
else await post(base + 'objectives/' + it.o.id + '/reply', { text, approved: what === 'approve' });
|
|
136
|
+
delete typed[it.key];
|
|
137
|
+
await load();
|
|
138
|
+
}
|
|
139
|
+
function render(el, list, group) {
|
|
140
|
+
let html = '', last = '';
|
|
141
|
+
for (const it of list) {
|
|
142
|
+
if (group && it.ws !== last) { html += `<p class="inbox-ws">${esc(it.ws)}</p>`; last = it.ws; }
|
|
143
|
+
html += avisoHtml(it);
|
|
144
|
+
}
|
|
145
|
+
if (el._html === html) return;
|
|
146
|
+
const focus = document.activeElement && el.contains(document.activeElement) && document.activeElement.dataset.in;
|
|
147
|
+
el._html = html; el.innerHTML = html;
|
|
148
|
+
el.querySelectorAll('details[data-k]').forEach((d) => (d.ontoggle = () => (d.open ? filesOpen.add(d.dataset.k) : filesOpen.delete(d.dataset.k))));
|
|
149
|
+
el.querySelectorAll('input[data-in]').forEach((i) => {
|
|
150
|
+
if (typed[i.dataset.in]) i.value = typed[i.dataset.in];
|
|
151
|
+
if (focus === i.dataset.in) i.focus();
|
|
152
|
+
i.oninput = () => (typed[i.dataset.in] = i.value);
|
|
153
|
+
i.onkeydown = (e) => { if (e.key === 'Enter') { const b = i.parentElement.querySelector('[data-do="answer"], [data-do="approve"]'); if (b) b.click(); } };
|
|
154
|
+
});
|
|
155
|
+
el.querySelectorAll('[data-do]').forEach((b) => (b.onclick = () => {
|
|
156
|
+
const art = b.closest('.aviso'), it = list.find((x) => x.key === art.dataset.key); if (!it) return;
|
|
157
|
+
const inp = art.querySelector('input[data-in]'), text = inp ? inp.value : '';
|
|
158
|
+
if (b.dataset.do === 'answer' && !text.trim()) { inp.focus(); return; }
|
|
159
|
+
art.classList.add('going'); art.querySelectorAll('button').forEach((x) => (x.disabled = true));
|
|
160
|
+
act(it, b.dataset.do, text);
|
|
161
|
+
}));
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// ---------- la bandeja ----------
|
|
165
|
+
let drawer = null;
|
|
166
|
+
let listeners = []; // {el, draw}: los avisos de un objetivo en su página (se sueltan cuando la página los quita)
|
|
167
|
+
function paintButtons() {
|
|
168
|
+
const n = items.length;
|
|
169
|
+
document.querySelectorAll('[data-inbox]').forEach((ph) => {
|
|
170
|
+
let b = ph.querySelector('.inbox-btn');
|
|
171
|
+
if (!b) { b = document.createElement('button'); b.type = 'button'; b.className = 'inbox-btn'; b.onclick = open; ph.appendChild(b); }
|
|
172
|
+
b.hidden = n === 0; b.innerHTML = `⚑ ${n}<span class="t"> te espera${n === 1 ? '' : 'n'}</span>`; b.title = 'preguntas y aprobaciones de tus agentes';
|
|
173
|
+
});
|
|
174
|
+
if (drawer && !drawer.panel.hidden) paintDrawer();
|
|
175
|
+
}
|
|
176
|
+
function paintDrawer() {
|
|
177
|
+
drawer.count.textContent = items.length ? String(items.length) : '';
|
|
178
|
+
if (!items.length) { drawer.list._html = ''; drawer.list.innerHTML = '<p class="inbox-empty">Nada te espera. Cuando un agente te pregunte algo o pida permiso, aparece acá.</p>'; return; }
|
|
179
|
+
render(drawer.list, items, new Set(items.map((i) => i.ws)).size > 1);
|
|
180
|
+
}
|
|
181
|
+
// focus: la clave de un aviso para llevarlo a la vista, marcado y con el cursor en su respuesta
|
|
182
|
+
function open(focus) {
|
|
183
|
+
if (!drawer) {
|
|
184
|
+
const veil = document.createElement('div'); veil.className = 'inbox-veil'; veil.hidden = true;
|
|
185
|
+
const panel = document.createElement('aside'); panel.className = 'inbox'; panel.hidden = true; panel.setAttribute('aria-label', 'lo que te espera');
|
|
186
|
+
panel.innerHTML = '<div class="inbox-head"><h2>Te espera<small></small></h2><button type="button" data-close title="cerrar (Esc)">✕</button></div><div class="inbox-list"></div>';
|
|
187
|
+
document.body.append(veil, panel);
|
|
188
|
+
drawer = { veil, panel, list: panel.querySelector('.inbox-list'), count: panel.querySelector('small') };
|
|
189
|
+
veil.onclick = close; panel.querySelector('[data-close]').onclick = close;
|
|
190
|
+
document.addEventListener('keydown', (e) => { if (e.key === 'Escape' && !drawer.panel.hidden) close(); });
|
|
191
|
+
}
|
|
192
|
+
drawer.veil.hidden = false; drawer.panel.hidden = false; paintDrawer(); load();
|
|
193
|
+
const art = typeof focus === 'string' && [...drawer.list.querySelectorAll('.aviso')].find((x) => x.dataset.key === focus);
|
|
194
|
+
if (art) {
|
|
195
|
+
art.scrollIntoView({ block: 'start' }); art.classList.remove('lit'); void art.offsetWidth; art.classList.add('lit');
|
|
196
|
+
const inp = art.querySelector('input[data-in]'); if (inp) inp.focus({ preventScroll: true });
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
function close() { if (drawer) { drawer.veil.hidden = true; drawer.panel.hidden = true; } if (location.hash === '#inbox') history.replaceState(null, '', location.pathname + location.search); }
|
|
200
|
+
|
|
201
|
+
// la pregunta de un objetivo en su página: el mismo aviso, con la respuesta en el lugar
|
|
202
|
+
function objective(el, slug, id) {
|
|
203
|
+
const draw = () => { if (!el.isConnected) return; render(el, items.filter((it) => it.slug === slug && it.kind === 'objective' && it.o.id === id), false); };
|
|
204
|
+
if (!el._inboxHooked) { el._inboxHooked = true; listeners.push({ el, draw }); }
|
|
205
|
+
if (loaded) draw(); else load();
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// la misma pregunta en una línea, para la pantalla en vivo (el grafo y el tablero no se corren): tocarla abre la bandeja
|
|
209
|
+
// en ese aviso
|
|
210
|
+
function strip(el, slug, id) {
|
|
211
|
+
const draw = () => {
|
|
212
|
+
if (!el.isConnected) return;
|
|
213
|
+
const it = items.find((x) => x.slug === slug && x.kind === 'objective' && x.o.id === id);
|
|
214
|
+
let html = '';
|
|
215
|
+
if (it) {
|
|
216
|
+
const q = String(it.o.question || ''), pass = q.match(/^hand over to team (\S+):/);
|
|
217
|
+
const [kind, verb, go] = pass ? ['pass', `quiere pasarle el trabajo a ${esc(it.teamName(pass[1]))}`, 'Ver y decidir']
|
|
218
|
+
: it.o.question_kind === 'approval' ? ['ok', 'te pide aprobación', 'Ver y decidir'] : ['ask', 'te pregunta', 'Responder'];
|
|
219
|
+
const gist = unescapeU(pass ? q.replace(/^[^\n]*\n?/, '') : q).replace(/[*`]/g, '').replace(/\s+/g, ' ').trim();
|
|
220
|
+
html = `<button type="button" class="ob-strip k-${kind}" data-key="${esc(it.key)}"><span class="av-ico">${ICON[kind]}</span><span class="sx"><b>${esc(it.who)}</b> ${verb} · <span class="g">${esc(gist)}</span></span><span class="go">${go} →</span></button>`;
|
|
221
|
+
}
|
|
222
|
+
if (el._html === html) return;
|
|
223
|
+
el._html = html; el.innerHTML = html;
|
|
224
|
+
const b = el.querySelector('.ob-strip'); if (b) b.onclick = () => open(b.dataset.key);
|
|
225
|
+
};
|
|
226
|
+
if (!el._inboxHooked) { el._inboxHooked = true; listeners.push({ el, draw }); }
|
|
227
|
+
if (loaded) draw(); else load();
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
window.Inbox = { open, close, load, objective, strip, get count() { return items.length; } };
|
|
231
|
+
document.addEventListener('click', (e) => { const a = e.target.closest('a[href="#inbox"]'); if (a) { e.preventDefault(); open(); } });
|
|
232
|
+
load().then(() => { if (location.hash === '#inbox') open(); });
|
|
233
|
+
setInterval(load, 5000);
|
|
234
|
+
})();
|
package/public/js/navtabs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// navtabs.js — las pestañas del hub (proyectos · equipos · tareas · plugins), iguales en las cuatro pantallas.
|
|
2
2
|
// Cada página pone <nav class="navtabs" data-on="<pestaña>"></nav>; esto las dibuja y les pone los contadores:
|
|
3
|
-
//
|
|
3
|
+
// ✕ las tareas cuya última corrida falló. Lo que te espera (preguntas y aprobaciones) va en la bandeja ⚑ (js/inbox.js).
|
|
4
4
|
(function () {
|
|
5
5
|
const nav = document.querySelector('nav.navtabs'); if (!nav) return;
|
|
6
6
|
const TABS = [['proyectos', '/', 'tus proyectos'], ['equipos', '/equipos', 'equipos y objetivos de todos tus proyectos'], ['tareas', '/tareas', 'tareas programadas de todos tus proyectos'], ['plugins', '/plugins', 'lo que podés sumarle a tus agentes']];
|
|
@@ -8,11 +8,6 @@
|
|
|
8
8
|
nav.innerHTML = TABS.map(([id, href, title]) => `<a href="${href}" title="${title}"${id === on ? ' class="on" aria-current="page"' : ''}>${id}<span class="badge" data-badge="${id}" hidden></span></a>`).join('');
|
|
9
9
|
const badge = (id, text) => { const b = nav.querySelector(`[data-badge="${id}"]`); b.hidden = !text; b.textContent = text || ''; };
|
|
10
10
|
async function paint() {
|
|
11
|
-
try {
|
|
12
|
-
const t = await (await fetch('/api/teams-home')).json();
|
|
13
|
-
const n = (t.workspaces || []).reduce((s, w) => s + w.objectives.filter(o => o.status === 'waiting').length + (w.approvals || []).length, 0);
|
|
14
|
-
badge('equipos', n ? '⚑ ' + n : '');
|
|
15
|
-
} catch (e) {}
|
|
16
11
|
try {
|
|
17
12
|
const t = await (await fetch('/api/tasks-home')).json();
|
|
18
13
|
const n = (t.workspaces || []).reduce((s, w) => s + w.tasks.filter(x => x.enabled && String(x.last_status || '').startsWith('error')).length, 0);
|
package/public/js/objlive.js
CHANGED
|
@@ -84,6 +84,7 @@ function seatView(o, s) {
|
|
|
84
84
|
if (tr) { const name = tr.raw ? tr.raw.split(' ')[0] : ''; return { cls: 'busy', icon: tr.cls.includes('say') ? 'say' : name ? actOf(name, salvageArgs(tr.raw.slice(name.length + 1))) : 'think', html: tr.html }; }
|
|
85
85
|
return { cls: 'busy', icon: 'think', html: 'pensando…' };
|
|
86
86
|
}
|
|
87
|
+
if (o.status === 'waiting' && a === o.agent) return { cls: 'asks', icon: 'say', html: '⚑ espera tu respuesta' };
|
|
87
88
|
if (mine.length && mine.every((t) => t.status === 'done')) return { cls: 'done', icon: 'done', html: 'terminó lo suyo' };
|
|
88
89
|
if (mine.some((t) => t.status === 'blocked')) return { cls: 'blocked', icon: 'block', html: 'trabado: espera que se destrabe algo' };
|
|
89
90
|
if (mine.some((t) => t.status !== 'done')) return { cls: 'wait', icon: 'wait', html: 'esperando su próximo turno' };
|
|
@@ -100,6 +101,7 @@ function tickerLine(r, roleOf) {
|
|
|
100
101
|
if (r.kind === 'over cap') return `${who} pasó su tope diario: ${esc(overText(r))}`;
|
|
101
102
|
if (r.kind === 'continued') return `${esc(roleOf(String(r.text).split(':')[0]))} llegó al límite de pasos de un turno: sigue donde quedó`;
|
|
102
103
|
if (r.kind === 'stuck') return `${esc(roleOf(String(r.text).split(':')[0]))} se cortó varias veces seguidas: le avisamos a su jefe`;
|
|
104
|
+
if (r.kind === 'error') return `${who} <span class="err">se cortó: ${esc(errHint(r.text))}</span>`;
|
|
103
105
|
if (r.kind === 'tokens') return `le diste más tokens por hoy a ${esc(roleOf(String(r.text).split(':')[0]))}`;
|
|
104
106
|
if (r.kind === 'handed off') return `${who} le pasó el trabajo a <b>${esc(teamName(String(r.text).split(':')[0].trim()))}</b> (${esc(r.ref)})`;
|
|
105
107
|
return `${who} ${esc(KIND[r.kind] || r.kind)} ${esc(r.ref || '')}${x ? ': «' + x + '»' : ''}`;
|
|
@@ -210,7 +212,7 @@ function paintSeats(o) {
|
|
|
210
212
|
const s = seats.find((x) => x.agent === m.agent) || { agent: m.agent, role: m.role, lead: m.agent === o.agent };
|
|
211
213
|
const v = seatView(o, s), was = LIVE.view[m.agent] || {};
|
|
212
214
|
el.style.setProperty('--seat', colorOf(m.agent));
|
|
213
|
-
if (was.cls !== v.cls) ['busy', 'done', 'blocked', 'wait', 'idle'].forEach((c) => el.classList.toggle(c, c === v.cls));
|
|
215
|
+
if (was.cls !== v.cls) ['busy', 'asks', 'done', 'blocked', 'wait', 'idle'].forEach((c) => el.classList.toggle(c, c === v.cls));
|
|
214
216
|
const box = el.querySelector('.lvact');
|
|
215
217
|
if (box && was.icon !== v.icon) { const ic = box.querySelector('.ico'); if (ic) ic.outerHTML = ICONS[v.icon]; else box.insertAdjacentHTML('afterbegin', ICONS[v.icon]); }
|
|
216
218
|
if (box && was.html !== v.html) { const tx = box.querySelector('.tx'); tx.innerHTML = v.html; if (was.html !== undefined) { tx.classList.remove('enter'); void tx.offsetWidth; tx.classList.add('enter'); } }
|
|
@@ -340,7 +342,9 @@ async function renderLive(o) {
|
|
|
340
342
|
const members = team ? team.members : seats.map((s) => ({ agent: s.agent, role: s.role, reports_to: '' }));
|
|
341
343
|
LIVE.members = [...members].sort((a, b) => (b.agent === o.agent) - (a.agent === o.agent));
|
|
342
344
|
$('#lvAsk').innerHTML = `<p class="${state.askOpen ? '' : 'clamp'}"><b>Qué se pidió:</b> ${esc(unescapeU(o.text))}</p>${o.text.length > 160 ? `<button class="lnk" data-ask>${state.askOpen ? 'ver menos' : 'ver todo'}</button>` : ''}
|
|
343
|
-
${o.status === 'waiting' ?
|
|
345
|
+
${o.status === 'waiting' ? '<div class="ob-ask" id="lvWait"></div>' : ''}`;
|
|
346
|
+
// lo que te espera, en una línea: el texto completo y la respuesta, en la bandeja ⚑
|
|
347
|
+
if ($('#lvWait') && window.Inbox) Inbox.strip($('#lvWait'), decodeURIComponent(BASE.slice(3)), o.id);
|
|
344
348
|
// el equipo se dibuja solo si cambió quién está o cómo se une; lo demás se pinta encima
|
|
345
349
|
const edges = members.filter((m) => m.reports_to && members.some((x) => x.agent === m.reports_to)).map((m) => ({ kind: 'reports', from: m.reports_to, to: m.agent }))
|
|
346
350
|
.concat(((team && team.talks) || []).map(([x, y]) => ({ kind: 'talk', from: x, to: y })));
|
|
@@ -348,7 +352,11 @@ async function renderLive(o) {
|
|
|
348
352
|
if (LIVE.flowSig !== sig) {
|
|
349
353
|
LIVE.flowSig = sig; LIVE.view = {};
|
|
350
354
|
const nodes = members.map((m) => ({ id: m.agent, title: m.role || m.agent, avatar: avatarOf(m.role || m.agent), lead: m.agent === o.agent, cls: 'lv', html: '<button type="button" class="lvover" hidden></button><div class="lvact"><span class="tx"></span></div><div class="lvtasks"></div>' }));
|
|
351
|
-
LIVE.flow.render({ nodes, edges, editable: false, storeKey: 'lampson.flow:' + BASE + ':' + (o.team || 'solo-' + o.agent), onSelect: (a) => {
|
|
355
|
+
LIVE.flow.render({ nodes, edges, editable: false, storeKey: 'lampson.flow:' + BASE + ':' + (o.team || 'solo-' + o.agent), onSelect: (a) => {
|
|
356
|
+
// quien espera tu respuesta: tocarlo abre su pregunta en la bandeja
|
|
357
|
+
const ask = a && LIVE.o.status === 'waiting' && a === LIVE.o.agent && document.querySelector('#lvWait .ob-strip');
|
|
358
|
+
if (ask) ask.click(); else if (a) openDrawer('seat', a);
|
|
359
|
+
} });
|
|
352
360
|
}
|
|
353
361
|
paintSeats(o);
|
|
354
362
|
paintHead(o);
|