@politeia/openclaw-bridge 0.1.2
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/LICENSE +154 -0
- package/README.md +184 -0
- package/dist/index.js +4262 -0
- package/dist/onboard.js +1528 -0
- package/dist/persona-template/community-emissary/v1/AGENTS.md +16 -0
- package/dist/persona-template/community-emissary/v1/HEARTBEAT.md +6 -0
- package/dist/persona-template/community-emissary/v1/IDENTITY.md +8 -0
- package/dist/persona-template/community-emissary/v1/README.md +44 -0
- package/dist/persona-template/community-emissary/v1/SOUL.md +13 -0
- package/dist/persona-template/community-emissary/v1/TOOLS.md +11 -0
- package/dist/persona-template/community-emissary/v1/USER.md +11 -0
- package/dist/setup-entry.js +705 -0
- package/dist/tools/autonomous-loop.js +489 -0
- package/dist/user-board/app.css +519 -0
- package/dist/user-board/app.js +1056 -0
- package/openclaw.plugin.json +89 -0
- package/package.json +51 -0
- package/profiles/README.md +42 -0
- package/profiles/aliyun-server/profile.example.json +22 -0
- package/profiles/mac-mini/profile.example.json +27 -0
- package/tools/user-board.mjs +760 -0
- package/user-board.mjs +2 -0
|
@@ -0,0 +1,1056 @@
|
|
|
1
|
+
// node_modules/preact/dist/preact.module.js
|
|
2
|
+
var n;
|
|
3
|
+
var l;
|
|
4
|
+
var u;
|
|
5
|
+
var t;
|
|
6
|
+
var i;
|
|
7
|
+
var r;
|
|
8
|
+
var o;
|
|
9
|
+
var e;
|
|
10
|
+
var f;
|
|
11
|
+
var c;
|
|
12
|
+
var a;
|
|
13
|
+
var s;
|
|
14
|
+
var h;
|
|
15
|
+
var p;
|
|
16
|
+
var v;
|
|
17
|
+
var y;
|
|
18
|
+
var d = {};
|
|
19
|
+
var w = [];
|
|
20
|
+
var _ = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;
|
|
21
|
+
var g = Array.isArray;
|
|
22
|
+
function m(n2, l3) {
|
|
23
|
+
for (var u4 in l3) n2[u4] = l3[u4];
|
|
24
|
+
return n2;
|
|
25
|
+
}
|
|
26
|
+
function b(n2) {
|
|
27
|
+
n2 && n2.parentNode && n2.parentNode.removeChild(n2);
|
|
28
|
+
}
|
|
29
|
+
function k(l3, u4, t3) {
|
|
30
|
+
var i3, r3, o3, e3 = {};
|
|
31
|
+
for (o3 in u4) "key" == o3 ? i3 = u4[o3] : "ref" == o3 ? r3 = u4[o3] : e3[o3] = u4[o3];
|
|
32
|
+
if (arguments.length > 2 && (e3.children = arguments.length > 3 ? n.call(arguments, 2) : t3), "function" == typeof l3 && null != l3.defaultProps) for (o3 in l3.defaultProps) void 0 === e3[o3] && (e3[o3] = l3.defaultProps[o3]);
|
|
33
|
+
return x(l3, e3, i3, r3, null);
|
|
34
|
+
}
|
|
35
|
+
function x(n2, t3, i3, r3, o3) {
|
|
36
|
+
var e3 = { type: n2, props: t3, key: i3, ref: r3, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: null == o3 ? ++u : o3, __i: -1, __u: 0 };
|
|
37
|
+
return null == o3 && null != l.vnode && l.vnode(e3), e3;
|
|
38
|
+
}
|
|
39
|
+
function S(n2) {
|
|
40
|
+
return n2.children;
|
|
41
|
+
}
|
|
42
|
+
function C(n2, l3) {
|
|
43
|
+
this.props = n2, this.context = l3;
|
|
44
|
+
}
|
|
45
|
+
function $(n2, l3) {
|
|
46
|
+
if (null == l3) return n2.__ ? $(n2.__, n2.__i + 1) : null;
|
|
47
|
+
for (var u4; l3 < n2.__k.length; l3++) if (null != (u4 = n2.__k[l3]) && null != u4.__e) return u4.__e;
|
|
48
|
+
return "function" == typeof n2.type ? $(n2) : null;
|
|
49
|
+
}
|
|
50
|
+
function I(n2) {
|
|
51
|
+
if (n2.__P && n2.__d) {
|
|
52
|
+
var u4 = n2.__v, t3 = u4.__e, i3 = [], r3 = [], o3 = m({}, u4);
|
|
53
|
+
o3.__v = u4.__v + 1, l.vnode && l.vnode(o3), q(n2.__P, o3, u4, n2.__n, n2.__P.namespaceURI, 32 & u4.__u ? [t3] : null, i3, null == t3 ? $(u4) : t3, !!(32 & u4.__u), r3), o3.__v = u4.__v, o3.__.__k[o3.__i] = o3, D(i3, o3, r3), u4.__e = u4.__ = null, o3.__e != t3 && P(o3);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function P(n2) {
|
|
57
|
+
if (null != (n2 = n2.__) && null != n2.__c) return n2.__e = n2.__c.base = null, n2.__k.some(function(l3) {
|
|
58
|
+
if (null != l3 && null != l3.__e) return n2.__e = n2.__c.base = l3.__e;
|
|
59
|
+
}), P(n2);
|
|
60
|
+
}
|
|
61
|
+
function A(n2) {
|
|
62
|
+
(!n2.__d && (n2.__d = true) && i.push(n2) && !H.__r++ || r != l.debounceRendering) && ((r = l.debounceRendering) || o)(H);
|
|
63
|
+
}
|
|
64
|
+
function H() {
|
|
65
|
+
try {
|
|
66
|
+
for (var n2, l3 = 1; i.length; ) i.length > l3 && i.sort(e), n2 = i.shift(), l3 = i.length, I(n2);
|
|
67
|
+
} finally {
|
|
68
|
+
i.length = H.__r = 0;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function L(n2, l3, u4, t3, i3, r3, o3, e3, f4, c3, a3) {
|
|
72
|
+
var s3, h3, p3, v3, y3, _2, g2, m3 = t3 && t3.__k || w, b2 = l3.length;
|
|
73
|
+
for (f4 = T(u4, l3, m3, f4, b2), s3 = 0; s3 < b2; s3++) null != (p3 = u4.__k[s3]) && (h3 = -1 != p3.__i && m3[p3.__i] || d, p3.__i = s3, _2 = q(n2, p3, h3, i3, r3, o3, e3, f4, c3, a3), v3 = p3.__e, p3.ref && h3.ref != p3.ref && (h3.ref && J(h3.ref, null, p3), a3.push(p3.ref, p3.__c || v3, p3)), null == y3 && null != v3 && (y3 = v3), (g2 = !!(4 & p3.__u)) || h3.__k === p3.__k ? (f4 = j(p3, f4, n2, g2), g2 && h3.__e && (h3.__e = null)) : "function" == typeof p3.type && void 0 !== _2 ? f4 = _2 : v3 && (f4 = v3.nextSibling), p3.__u &= -7);
|
|
74
|
+
return u4.__e = y3, f4;
|
|
75
|
+
}
|
|
76
|
+
function T(n2, l3, u4, t3, i3) {
|
|
77
|
+
var r3, o3, e3, f4, c3, a3 = u4.length, s3 = a3, h3 = 0;
|
|
78
|
+
for (n2.__k = new Array(i3), r3 = 0; r3 < i3; r3++) null != (o3 = l3[r3]) && "boolean" != typeof o3 && "function" != typeof o3 ? ("string" == typeof o3 || "number" == typeof o3 || "bigint" == typeof o3 || o3.constructor == String ? o3 = n2.__k[r3] = x(null, o3, null, null, null) : g(o3) ? o3 = n2.__k[r3] = x(S, { children: o3 }, null, null, null) : void 0 === o3.constructor && o3.__b > 0 ? o3 = n2.__k[r3] = x(o3.type, o3.props, o3.key, o3.ref ? o3.ref : null, o3.__v) : n2.__k[r3] = o3, f4 = r3 + h3, o3.__ = n2, o3.__b = n2.__b + 1, e3 = null, -1 != (c3 = o3.__i = O(o3, u4, f4, s3)) && (s3--, (e3 = u4[c3]) && (e3.__u |= 2)), null == e3 || null == e3.__v ? (-1 == c3 && (i3 > a3 ? h3-- : i3 < a3 && h3++), "function" != typeof o3.type && (o3.__u |= 4)) : c3 != f4 && (c3 == f4 - 1 ? h3-- : c3 == f4 + 1 ? h3++ : (c3 > f4 ? h3-- : h3++, o3.__u |= 4))) : n2.__k[r3] = null;
|
|
79
|
+
if (s3) for (r3 = 0; r3 < a3; r3++) null != (e3 = u4[r3]) && 0 == (2 & e3.__u) && (e3.__e == t3 && (t3 = $(e3)), K(e3, e3));
|
|
80
|
+
return t3;
|
|
81
|
+
}
|
|
82
|
+
function j(n2, l3, u4, t3) {
|
|
83
|
+
var i3, r3;
|
|
84
|
+
if ("function" == typeof n2.type) {
|
|
85
|
+
for (i3 = n2.__k, r3 = 0; i3 && r3 < i3.length; r3++) i3[r3] && (i3[r3].__ = n2, l3 = j(i3[r3], l3, u4, t3));
|
|
86
|
+
return l3;
|
|
87
|
+
}
|
|
88
|
+
n2.__e != l3 && (t3 && (l3 && n2.type && !l3.parentNode && (l3 = $(n2)), u4.insertBefore(n2.__e, l3 || null)), l3 = n2.__e);
|
|
89
|
+
do {
|
|
90
|
+
l3 = l3 && l3.nextSibling;
|
|
91
|
+
} while (null != l3 && 8 == l3.nodeType);
|
|
92
|
+
return l3;
|
|
93
|
+
}
|
|
94
|
+
function O(n2, l3, u4, t3) {
|
|
95
|
+
var i3, r3, o3, e3 = n2.key, f4 = n2.type, c3 = l3[u4], a3 = null != c3 && 0 == (2 & c3.__u);
|
|
96
|
+
if (null === c3 && null == e3 || a3 && e3 == c3.key && f4 == c3.type) return u4;
|
|
97
|
+
if (t3 > (a3 ? 1 : 0)) {
|
|
98
|
+
for (i3 = u4 - 1, r3 = u4 + 1; i3 >= 0 || r3 < l3.length; ) if (null != (c3 = l3[o3 = i3 >= 0 ? i3-- : r3++]) && 0 == (2 & c3.__u) && e3 == c3.key && f4 == c3.type) return o3;
|
|
99
|
+
}
|
|
100
|
+
return -1;
|
|
101
|
+
}
|
|
102
|
+
function z(n2, l3, u4) {
|
|
103
|
+
"-" == l3[0] ? n2.setProperty(l3, null == u4 ? "" : u4) : n2[l3] = null == u4 ? "" : "number" != typeof u4 || _.test(l3) ? u4 : u4 + "px";
|
|
104
|
+
}
|
|
105
|
+
function N(n2, l3, u4, t3, i3) {
|
|
106
|
+
var r3, o3;
|
|
107
|
+
n: if ("style" == l3) if ("string" == typeof u4) n2.style.cssText = u4;
|
|
108
|
+
else {
|
|
109
|
+
if ("string" == typeof t3 && (n2.style.cssText = t3 = ""), t3) for (l3 in t3) u4 && l3 in u4 || z(n2.style, l3, "");
|
|
110
|
+
if (u4) for (l3 in u4) t3 && u4[l3] == t3[l3] || z(n2.style, l3, u4[l3]);
|
|
111
|
+
}
|
|
112
|
+
else if ("o" == l3[0] && "n" == l3[1]) r3 = l3 != (l3 = l3.replace(s, "$1")), o3 = l3.toLowerCase(), l3 = o3 in n2 || "onFocusOut" == l3 || "onFocusIn" == l3 ? o3.slice(2) : l3.slice(2), n2.l || (n2.l = {}), n2.l[l3 + r3] = u4, u4 ? t3 ? u4[a] = t3[a] : (u4[a] = h, n2.addEventListener(l3, r3 ? v : p, r3)) : n2.removeEventListener(l3, r3 ? v : p, r3);
|
|
113
|
+
else {
|
|
114
|
+
if ("http://www.w3.org/2000/svg" == i3) l3 = l3.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
|
|
115
|
+
else if ("width" != l3 && "height" != l3 && "href" != l3 && "list" != l3 && "form" != l3 && "tabIndex" != l3 && "download" != l3 && "rowSpan" != l3 && "colSpan" != l3 && "role" != l3 && "popover" != l3 && l3 in n2) try {
|
|
116
|
+
n2[l3] = null == u4 ? "" : u4;
|
|
117
|
+
break n;
|
|
118
|
+
} catch (n3) {
|
|
119
|
+
}
|
|
120
|
+
"function" == typeof u4 || (null == u4 || false === u4 && "-" != l3[4] ? n2.removeAttribute(l3) : n2.setAttribute(l3, "popover" == l3 && 1 == u4 ? "" : u4));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function V(n2) {
|
|
124
|
+
return function(u4) {
|
|
125
|
+
if (this.l) {
|
|
126
|
+
var t3 = this.l[u4.type + n2];
|
|
127
|
+
if (null == u4[c]) u4[c] = h++;
|
|
128
|
+
else if (u4[c] < t3[a]) return;
|
|
129
|
+
return t3(l.event ? l.event(u4) : u4);
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function q(n2, u4, t3, i3, r3, o3, e3, f4, c3, a3) {
|
|
134
|
+
var s3, h3, p3, v3, y3, d3, _2, k3, x2, M, $2, I2, P2, A3, H2, T3 = u4.type;
|
|
135
|
+
if (void 0 !== u4.constructor) return null;
|
|
136
|
+
128 & t3.__u && (c3 = !!(32 & t3.__u), o3 = [f4 = u4.__e = t3.__e]), (s3 = l.__b) && s3(u4);
|
|
137
|
+
n: if ("function" == typeof T3) try {
|
|
138
|
+
if (k3 = u4.props, x2 = T3.prototype && T3.prototype.render, M = (s3 = T3.contextType) && i3[s3.__c], $2 = s3 ? M ? M.props.value : s3.__ : i3, t3.__c ? _2 = (h3 = u4.__c = t3.__c).__ = h3.__E : (x2 ? u4.__c = h3 = new T3(k3, $2) : (u4.__c = h3 = new C(k3, $2), h3.constructor = T3, h3.render = Q), M && M.sub(h3), h3.state || (h3.state = {}), h3.__n = i3, p3 = h3.__d = true, h3.__h = [], h3._sb = []), x2 && null == h3.__s && (h3.__s = h3.state), x2 && null != T3.getDerivedStateFromProps && (h3.__s == h3.state && (h3.__s = m({}, h3.__s)), m(h3.__s, T3.getDerivedStateFromProps(k3, h3.__s))), v3 = h3.props, y3 = h3.state, h3.__v = u4, p3) x2 && null == T3.getDerivedStateFromProps && null != h3.componentWillMount && h3.componentWillMount(), x2 && null != h3.componentDidMount && h3.__h.push(h3.componentDidMount);
|
|
139
|
+
else {
|
|
140
|
+
if (x2 && null == T3.getDerivedStateFromProps && k3 !== v3 && null != h3.componentWillReceiveProps && h3.componentWillReceiveProps(k3, $2), u4.__v == t3.__v || !h3.__e && null != h3.shouldComponentUpdate && false === h3.shouldComponentUpdate(k3, h3.__s, $2)) {
|
|
141
|
+
u4.__v != t3.__v && (h3.props = k3, h3.state = h3.__s, h3.__d = false), u4.__e = t3.__e, u4.__k = t3.__k, u4.__k.some(function(n3) {
|
|
142
|
+
n3 && (n3.__ = u4);
|
|
143
|
+
}), w.push.apply(h3.__h, h3._sb), h3._sb = [], h3.__h.length && e3.push(h3);
|
|
144
|
+
break n;
|
|
145
|
+
}
|
|
146
|
+
null != h3.componentWillUpdate && h3.componentWillUpdate(k3, h3.__s, $2), x2 && null != h3.componentDidUpdate && h3.__h.push(function() {
|
|
147
|
+
h3.componentDidUpdate(v3, y3, d3);
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
if (h3.context = $2, h3.props = k3, h3.__P = n2, h3.__e = false, I2 = l.__r, P2 = 0, x2) h3.state = h3.__s, h3.__d = false, I2 && I2(u4), s3 = h3.render(h3.props, h3.state, h3.context), w.push.apply(h3.__h, h3._sb), h3._sb = [];
|
|
151
|
+
else do {
|
|
152
|
+
h3.__d = false, I2 && I2(u4), s3 = h3.render(h3.props, h3.state, h3.context), h3.state = h3.__s;
|
|
153
|
+
} while (h3.__d && ++P2 < 25);
|
|
154
|
+
h3.state = h3.__s, null != h3.getChildContext && (i3 = m(m({}, i3), h3.getChildContext())), x2 && !p3 && null != h3.getSnapshotBeforeUpdate && (d3 = h3.getSnapshotBeforeUpdate(v3, y3)), A3 = null != s3 && s3.type === S && null == s3.key ? E(s3.props.children) : s3, f4 = L(n2, g(A3) ? A3 : [A3], u4, t3, i3, r3, o3, e3, f4, c3, a3), h3.base = u4.__e, u4.__u &= -161, h3.__h.length && e3.push(h3), _2 && (h3.__E = h3.__ = null);
|
|
155
|
+
} catch (n3) {
|
|
156
|
+
if (u4.__v = null, c3 || null != o3) if (n3.then) {
|
|
157
|
+
for (u4.__u |= c3 ? 160 : 128; f4 && 8 == f4.nodeType && f4.nextSibling; ) f4 = f4.nextSibling;
|
|
158
|
+
o3[o3.indexOf(f4)] = null, u4.__e = f4;
|
|
159
|
+
} else {
|
|
160
|
+
for (H2 = o3.length; H2--; ) b(o3[H2]);
|
|
161
|
+
B(u4);
|
|
162
|
+
}
|
|
163
|
+
else u4.__e = t3.__e, u4.__k = t3.__k, n3.then || B(u4);
|
|
164
|
+
l.__e(n3, u4, t3);
|
|
165
|
+
}
|
|
166
|
+
else null == o3 && u4.__v == t3.__v ? (u4.__k = t3.__k, u4.__e = t3.__e) : f4 = u4.__e = G(t3.__e, u4, t3, i3, r3, o3, e3, c3, a3);
|
|
167
|
+
return (s3 = l.diffed) && s3(u4), 128 & u4.__u ? void 0 : f4;
|
|
168
|
+
}
|
|
169
|
+
function B(n2) {
|
|
170
|
+
n2 && (n2.__c && (n2.__c.__e = true), n2.__k && n2.__k.some(B));
|
|
171
|
+
}
|
|
172
|
+
function D(n2, u4, t3) {
|
|
173
|
+
for (var i3 = 0; i3 < t3.length; i3++) J(t3[i3], t3[++i3], t3[++i3]);
|
|
174
|
+
l.__c && l.__c(u4, n2), n2.some(function(u5) {
|
|
175
|
+
try {
|
|
176
|
+
n2 = u5.__h, u5.__h = [], n2.some(function(n3) {
|
|
177
|
+
n3.call(u5);
|
|
178
|
+
});
|
|
179
|
+
} catch (n3) {
|
|
180
|
+
l.__e(n3, u5.__v);
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
function E(n2) {
|
|
185
|
+
return "object" != typeof n2 || null == n2 || n2.__b > 0 ? n2 : g(n2) ? n2.map(E) : void 0 !== n2.constructor ? null : m({}, n2);
|
|
186
|
+
}
|
|
187
|
+
function G(u4, t3, i3, r3, o3, e3, f4, c3, a3) {
|
|
188
|
+
var s3, h3, p3, v3, y3, w3, _2, m3 = i3.props || d, k3 = t3.props, x2 = t3.type;
|
|
189
|
+
if ("svg" == x2 ? o3 = "http://www.w3.org/2000/svg" : "math" == x2 ? o3 = "http://www.w3.org/1998/Math/MathML" : o3 || (o3 = "http://www.w3.org/1999/xhtml"), null != e3) {
|
|
190
|
+
for (s3 = 0; s3 < e3.length; s3++) if ((y3 = e3[s3]) && "setAttribute" in y3 == !!x2 && (x2 ? y3.localName == x2 : 3 == y3.nodeType)) {
|
|
191
|
+
u4 = y3, e3[s3] = null;
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (null == u4) {
|
|
196
|
+
if (null == x2) return document.createTextNode(k3);
|
|
197
|
+
u4 = document.createElementNS(o3, x2, k3.is && k3), c3 && (l.__m && l.__m(t3, e3), c3 = false), e3 = null;
|
|
198
|
+
}
|
|
199
|
+
if (null == x2) m3 === k3 || c3 && u4.data == k3 || (u4.data = k3);
|
|
200
|
+
else {
|
|
201
|
+
if (e3 = "textarea" == x2 && null != k3.defaultValue ? null : e3 && n.call(u4.childNodes), !c3 && null != e3) for (m3 = {}, s3 = 0; s3 < u4.attributes.length; s3++) m3[(y3 = u4.attributes[s3]).name] = y3.value;
|
|
202
|
+
for (s3 in m3) y3 = m3[s3], "dangerouslySetInnerHTML" == s3 ? p3 = y3 : "children" == s3 || s3 in k3 || "value" == s3 && "defaultValue" in k3 || "checked" == s3 && "defaultChecked" in k3 || N(u4, s3, null, y3, o3);
|
|
203
|
+
for (s3 in k3) y3 = k3[s3], "children" == s3 ? v3 = y3 : "dangerouslySetInnerHTML" == s3 ? h3 = y3 : "value" == s3 ? w3 = y3 : "checked" == s3 ? _2 = y3 : c3 && "function" != typeof y3 || m3[s3] === y3 || N(u4, s3, y3, m3[s3], o3);
|
|
204
|
+
if (h3) c3 || p3 && (h3.__html == p3.__html || h3.__html == u4.innerHTML) || (u4.innerHTML = h3.__html), t3.__k = [];
|
|
205
|
+
else if (p3 && (u4.innerHTML = ""), L("template" == t3.type ? u4.content : u4, g(v3) ? v3 : [v3], t3, i3, r3, "foreignObject" == x2 ? "http://www.w3.org/1999/xhtml" : o3, e3, f4, e3 ? e3[0] : i3.__k && $(i3, 0), c3, a3), null != e3) for (s3 = e3.length; s3--; ) b(e3[s3]);
|
|
206
|
+
c3 && "textarea" != x2 || (s3 = "value", "progress" == x2 && null == w3 ? u4.removeAttribute("value") : null != w3 && (w3 !== u4[s3] || "progress" == x2 && !w3 || "option" == x2 && w3 != m3[s3]) && N(u4, s3, w3, m3[s3], o3), s3 = "checked", null != _2 && _2 != u4[s3] && N(u4, s3, _2, m3[s3], o3));
|
|
207
|
+
}
|
|
208
|
+
return u4;
|
|
209
|
+
}
|
|
210
|
+
function J(n2, u4, t3) {
|
|
211
|
+
try {
|
|
212
|
+
if ("function" == typeof n2) {
|
|
213
|
+
var i3 = "function" == typeof n2.__u;
|
|
214
|
+
i3 && n2.__u(), i3 && null == u4 || (n2.__u = n2(u4));
|
|
215
|
+
} else n2.current = u4;
|
|
216
|
+
} catch (n3) {
|
|
217
|
+
l.__e(n3, t3);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
function K(n2, u4, t3) {
|
|
221
|
+
var i3, r3;
|
|
222
|
+
if (l.unmount && l.unmount(n2), (i3 = n2.ref) && (i3.current && i3.current != n2.__e || J(i3, null, u4)), null != (i3 = n2.__c)) {
|
|
223
|
+
if (i3.componentWillUnmount) try {
|
|
224
|
+
i3.componentWillUnmount();
|
|
225
|
+
} catch (n3) {
|
|
226
|
+
l.__e(n3, u4);
|
|
227
|
+
}
|
|
228
|
+
i3.base = i3.__P = null;
|
|
229
|
+
}
|
|
230
|
+
if (i3 = n2.__k) for (r3 = 0; r3 < i3.length; r3++) i3[r3] && K(i3[r3], u4, t3 || "function" != typeof n2.type);
|
|
231
|
+
t3 || b(n2.__e), n2.__c = n2.__ = n2.__e = void 0;
|
|
232
|
+
}
|
|
233
|
+
function Q(n2, l3, u4) {
|
|
234
|
+
return this.constructor(n2, u4);
|
|
235
|
+
}
|
|
236
|
+
function R(u4, t3, i3) {
|
|
237
|
+
var r3, o3, e3, f4;
|
|
238
|
+
t3 == document && (t3 = document.documentElement), l.__ && l.__(u4, t3), o3 = (r3 = "function" == typeof i3) ? null : i3 && i3.__k || t3.__k, e3 = [], f4 = [], q(t3, u4 = (!r3 && i3 || t3).__k = k(S, null, [u4]), o3 || d, d, t3.namespaceURI, !r3 && i3 ? [i3] : o3 ? null : t3.firstChild ? n.call(t3.childNodes) : null, e3, !r3 && i3 ? i3 : o3 ? o3.__e : t3.firstChild, r3, f4), D(e3, u4, f4);
|
|
239
|
+
}
|
|
240
|
+
n = w.slice, l = { __e: function(n2, l3, u4, t3) {
|
|
241
|
+
for (var i3, r3, o3; l3 = l3.__; ) if ((i3 = l3.__c) && !i3.__) try {
|
|
242
|
+
if ((r3 = i3.constructor) && null != r3.getDerivedStateFromError && (i3.setState(r3.getDerivedStateFromError(n2)), o3 = i3.__d), null != i3.componentDidCatch && (i3.componentDidCatch(n2, t3 || {}), o3 = i3.__d), o3) return i3.__E = i3;
|
|
243
|
+
} catch (l4) {
|
|
244
|
+
n2 = l4;
|
|
245
|
+
}
|
|
246
|
+
throw n2;
|
|
247
|
+
} }, u = 0, t = function(n2) {
|
|
248
|
+
return null != n2 && void 0 === n2.constructor;
|
|
249
|
+
}, C.prototype.setState = function(n2, l3) {
|
|
250
|
+
var u4;
|
|
251
|
+
u4 = null != this.__s && this.__s != this.state ? this.__s : this.__s = m({}, this.state), "function" == typeof n2 && (n2 = n2(m({}, u4), this.props)), n2 && m(u4, n2), null != n2 && this.__v && (l3 && this._sb.push(l3), A(this));
|
|
252
|
+
}, C.prototype.forceUpdate = function(n2) {
|
|
253
|
+
this.__v && (this.__e = true, n2 && this.__h.push(n2), A(this));
|
|
254
|
+
}, C.prototype.render = S, i = [], o = "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, e = function(n2, l3) {
|
|
255
|
+
return n2.__v.__b - l3.__v.__b;
|
|
256
|
+
}, H.__r = 0, f = Math.random().toString(8), c = "__d" + f, a = "__a" + f, s = /(PointerCapture)$|Capture$/i, h = 0, p = V(false), v = V(true), y = 0;
|
|
257
|
+
|
|
258
|
+
// node_modules/preact/hooks/dist/hooks.module.js
|
|
259
|
+
var t2;
|
|
260
|
+
var r2;
|
|
261
|
+
var u2;
|
|
262
|
+
var i2;
|
|
263
|
+
var o2 = 0;
|
|
264
|
+
var f2 = [];
|
|
265
|
+
var c2 = l;
|
|
266
|
+
var e2 = c2.__b;
|
|
267
|
+
var a2 = c2.__r;
|
|
268
|
+
var v2 = c2.diffed;
|
|
269
|
+
var l2 = c2.__c;
|
|
270
|
+
var m2 = c2.unmount;
|
|
271
|
+
var s2 = c2.__;
|
|
272
|
+
function p2(n2, t3) {
|
|
273
|
+
c2.__h && c2.__h(r2, n2, o2 || t3), o2 = 0;
|
|
274
|
+
var u4 = r2.__H || (r2.__H = { __: [], __h: [] });
|
|
275
|
+
return n2 >= u4.__.length && u4.__.push({}), u4.__[n2];
|
|
276
|
+
}
|
|
277
|
+
function d2(n2) {
|
|
278
|
+
return o2 = 1, h2(D2, n2);
|
|
279
|
+
}
|
|
280
|
+
function h2(n2, u4, i3) {
|
|
281
|
+
var o3 = p2(t2++, 2);
|
|
282
|
+
if (o3.t = n2, !o3.__c && (o3.__ = [i3 ? i3(u4) : D2(void 0, u4), function(n3) {
|
|
283
|
+
var t3 = o3.__N ? o3.__N[0] : o3.__[0], r3 = o3.t(t3, n3);
|
|
284
|
+
t3 !== r3 && (o3.__N = [r3, o3.__[1]], o3.__c.setState({}));
|
|
285
|
+
}], o3.__c = r2, !r2.__f)) {
|
|
286
|
+
var f4 = function(n3, t3, r3) {
|
|
287
|
+
if (!o3.__c.__H) return true;
|
|
288
|
+
var u5 = o3.__c.__H.__.filter(function(n4) {
|
|
289
|
+
return n4.__c;
|
|
290
|
+
});
|
|
291
|
+
if (u5.every(function(n4) {
|
|
292
|
+
return !n4.__N;
|
|
293
|
+
})) return !c3 || c3.call(this, n3, t3, r3);
|
|
294
|
+
var i4 = o3.__c.props !== n3;
|
|
295
|
+
return u5.some(function(n4) {
|
|
296
|
+
if (n4.__N) {
|
|
297
|
+
var t4 = n4.__[0];
|
|
298
|
+
n4.__ = n4.__N, n4.__N = void 0, t4 !== n4.__[0] && (i4 = true);
|
|
299
|
+
}
|
|
300
|
+
}), c3 && c3.call(this, n3, t3, r3) || i4;
|
|
301
|
+
};
|
|
302
|
+
r2.__f = true;
|
|
303
|
+
var c3 = r2.shouldComponentUpdate, e3 = r2.componentWillUpdate;
|
|
304
|
+
r2.componentWillUpdate = function(n3, t3, r3) {
|
|
305
|
+
if (this.__e) {
|
|
306
|
+
var u5 = c3;
|
|
307
|
+
c3 = void 0, f4(n3, t3, r3), c3 = u5;
|
|
308
|
+
}
|
|
309
|
+
e3 && e3.call(this, n3, t3, r3);
|
|
310
|
+
}, r2.shouldComponentUpdate = f4;
|
|
311
|
+
}
|
|
312
|
+
return o3.__N || o3.__;
|
|
313
|
+
}
|
|
314
|
+
function y2(n2, u4) {
|
|
315
|
+
var i3 = p2(t2++, 3);
|
|
316
|
+
!c2.__s && C2(i3.__H, u4) && (i3.__ = n2, i3.u = u4, r2.__H.__h.push(i3));
|
|
317
|
+
}
|
|
318
|
+
function A2(n2) {
|
|
319
|
+
return o2 = 5, T2(function() {
|
|
320
|
+
return { current: n2 };
|
|
321
|
+
}, []);
|
|
322
|
+
}
|
|
323
|
+
function T2(n2, r3) {
|
|
324
|
+
var u4 = p2(t2++, 7);
|
|
325
|
+
return C2(u4.__H, r3) && (u4.__ = n2(), u4.__H = r3, u4.__h = n2), u4.__;
|
|
326
|
+
}
|
|
327
|
+
function q2(n2, t3) {
|
|
328
|
+
return o2 = 8, T2(function() {
|
|
329
|
+
return n2;
|
|
330
|
+
}, t3);
|
|
331
|
+
}
|
|
332
|
+
function j2() {
|
|
333
|
+
for (var n2; n2 = f2.shift(); ) {
|
|
334
|
+
var t3 = n2.__H;
|
|
335
|
+
if (n2.__P && t3) try {
|
|
336
|
+
t3.__h.some(z2), t3.__h.some(B2), t3.__h = [];
|
|
337
|
+
} catch (r3) {
|
|
338
|
+
t3.__h = [], c2.__e(r3, n2.__v);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
c2.__b = function(n2) {
|
|
343
|
+
r2 = null, e2 && e2(n2);
|
|
344
|
+
}, c2.__ = function(n2, t3) {
|
|
345
|
+
n2 && t3.__k && t3.__k.__m && (n2.__m = t3.__k.__m), s2 && s2(n2, t3);
|
|
346
|
+
}, c2.__r = function(n2) {
|
|
347
|
+
a2 && a2(n2), t2 = 0;
|
|
348
|
+
var i3 = (r2 = n2.__c).__H;
|
|
349
|
+
i3 && (u2 === r2 ? (i3.__h = [], r2.__h = [], i3.__.some(function(n3) {
|
|
350
|
+
n3.__N && (n3.__ = n3.__N), n3.u = n3.__N = void 0;
|
|
351
|
+
})) : (i3.__h.some(z2), i3.__h.some(B2), i3.__h = [], t2 = 0)), u2 = r2;
|
|
352
|
+
}, c2.diffed = function(n2) {
|
|
353
|
+
v2 && v2(n2);
|
|
354
|
+
var t3 = n2.__c;
|
|
355
|
+
t3 && t3.__H && (t3.__H.__h.length && (1 !== f2.push(t3) && i2 === c2.requestAnimationFrame || ((i2 = c2.requestAnimationFrame) || w2)(j2)), t3.__H.__.some(function(n3) {
|
|
356
|
+
n3.u && (n3.__H = n3.u), n3.u = void 0;
|
|
357
|
+
})), u2 = r2 = null;
|
|
358
|
+
}, c2.__c = function(n2, t3) {
|
|
359
|
+
t3.some(function(n3) {
|
|
360
|
+
try {
|
|
361
|
+
n3.__h.some(z2), n3.__h = n3.__h.filter(function(n4) {
|
|
362
|
+
return !n4.__ || B2(n4);
|
|
363
|
+
});
|
|
364
|
+
} catch (r3) {
|
|
365
|
+
t3.some(function(n4) {
|
|
366
|
+
n4.__h && (n4.__h = []);
|
|
367
|
+
}), t3 = [], c2.__e(r3, n3.__v);
|
|
368
|
+
}
|
|
369
|
+
}), l2 && l2(n2, t3);
|
|
370
|
+
}, c2.unmount = function(n2) {
|
|
371
|
+
m2 && m2(n2);
|
|
372
|
+
var t3, r3 = n2.__c;
|
|
373
|
+
r3 && r3.__H && (r3.__H.__.some(function(n3) {
|
|
374
|
+
try {
|
|
375
|
+
z2(n3);
|
|
376
|
+
} catch (n4) {
|
|
377
|
+
t3 = n4;
|
|
378
|
+
}
|
|
379
|
+
}), r3.__H = void 0, t3 && c2.__e(t3, r3.__v));
|
|
380
|
+
};
|
|
381
|
+
var k2 = "function" == typeof requestAnimationFrame;
|
|
382
|
+
function w2(n2) {
|
|
383
|
+
var t3, r3 = function() {
|
|
384
|
+
clearTimeout(u4), k2 && cancelAnimationFrame(t3), setTimeout(n2);
|
|
385
|
+
}, u4 = setTimeout(r3, 35);
|
|
386
|
+
k2 && (t3 = requestAnimationFrame(r3));
|
|
387
|
+
}
|
|
388
|
+
function z2(n2) {
|
|
389
|
+
var t3 = r2, u4 = n2.__c;
|
|
390
|
+
"function" == typeof u4 && (n2.__c = void 0, u4()), r2 = t3;
|
|
391
|
+
}
|
|
392
|
+
function B2(n2) {
|
|
393
|
+
var t3 = r2;
|
|
394
|
+
n2.__c = n2.__(), r2 = t3;
|
|
395
|
+
}
|
|
396
|
+
function C2(n2, t3) {
|
|
397
|
+
return !n2 || n2.length !== t3.length || t3.some(function(t4, r3) {
|
|
398
|
+
return t4 !== n2[r3];
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
function D2(n2, t3) {
|
|
402
|
+
return "function" == typeof t3 ? t3(n2) : t3;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js
|
|
406
|
+
var f3 = 0;
|
|
407
|
+
function u3(e3, t3, n2, o3, i3, u4) {
|
|
408
|
+
t3 || (t3 = {});
|
|
409
|
+
var a3, c3, p3 = t3;
|
|
410
|
+
if ("ref" in p3) for (c3 in p3 = {}, t3) "ref" == c3 ? a3 = t3[c3] : p3[c3] = t3[c3];
|
|
411
|
+
var l3 = { type: e3, props: p3, key: n2, ref: a3, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --f3, __i: -1, __u: 0, __source: i3, __self: u4 };
|
|
412
|
+
if ("function" == typeof e3 && (a3 = e3.defaultProps)) for (c3 in a3) void 0 === p3[c3] && (p3[c3] = a3[c3]);
|
|
413
|
+
return l.vnode && l.vnode(l3), l3;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
// src/user-board/app.jsx
|
|
417
|
+
var REFRESH_MS = 5e3;
|
|
418
|
+
var TABS = [
|
|
419
|
+
{ id: "activity", label: "Activity" },
|
|
420
|
+
{ id: "threads", label: "Conversations" },
|
|
421
|
+
{ id: "rooms", label: "Rooms" },
|
|
422
|
+
{ id: "skills", label: "Skill Offers" },
|
|
423
|
+
{ id: "posts", label: "Posts" },
|
|
424
|
+
{ id: "debug", label: "Debug" }
|
|
425
|
+
];
|
|
426
|
+
function App() {
|
|
427
|
+
const initialPeerId = typeof window === "undefined" ? null : new URLSearchParams(window.location.search).get("peer");
|
|
428
|
+
const initialRoomId = typeof window === "undefined" ? null : new URLSearchParams(window.location.search).get("room");
|
|
429
|
+
const [board, setBoard] = d2(null);
|
|
430
|
+
const [loadState, setLoadState] = d2({ loading: true, error: null });
|
|
431
|
+
const [tab, setTab] = d2(initialPeerId ? "threads" : initialRoomId ? "rooms" : "activity");
|
|
432
|
+
const [selectedPeerId, setSelectedPeerId] = d2(initialPeerId);
|
|
433
|
+
const [selectedRoomId, setSelectedRoomId] = d2(initialRoomId);
|
|
434
|
+
const [composerDrafts, setComposerDrafts] = d2({});
|
|
435
|
+
const [roomDrafts, setRoomDrafts] = d2({});
|
|
436
|
+
const [replyDrafts, setReplyDrafts] = d2({});
|
|
437
|
+
const [expandedMessages, setExpandedMessages] = d2({});
|
|
438
|
+
const [busyAction, setBusyAction] = d2(null);
|
|
439
|
+
const loadBoard = q2(async ({ quiet = false } = {}) => {
|
|
440
|
+
if (!quiet) {
|
|
441
|
+
setLoadState((state) => ({ ...state, loading: true }));
|
|
442
|
+
}
|
|
443
|
+
try {
|
|
444
|
+
const response = await fetch("/api/board", { cache: "no-store" });
|
|
445
|
+
const payload = await response.json();
|
|
446
|
+
if (!response.ok) {
|
|
447
|
+
throw new Error(payload.error || `Board request failed (${response.status})`);
|
|
448
|
+
}
|
|
449
|
+
setBoard(payload);
|
|
450
|
+
setLoadState({ loading: false, error: null });
|
|
451
|
+
} catch (error) {
|
|
452
|
+
setLoadState({ loading: false, error: error instanceof Error ? error.message : String(error) });
|
|
453
|
+
}
|
|
454
|
+
}, []);
|
|
455
|
+
y2(() => {
|
|
456
|
+
loadBoard();
|
|
457
|
+
const timer = setInterval(() => loadBoard({ quiet: true }), REFRESH_MS);
|
|
458
|
+
return () => clearInterval(timer);
|
|
459
|
+
}, [loadBoard]);
|
|
460
|
+
const threads = board?.threads ?? [];
|
|
461
|
+
const rooms = board?.rooms ?? [];
|
|
462
|
+
const selectedThread = T2(() => {
|
|
463
|
+
if (!threads.length || !selectedPeerId) return null;
|
|
464
|
+
return threads.find((thread) => thread.peerAgentId === selectedPeerId) ?? null;
|
|
465
|
+
}, [threads, selectedPeerId]);
|
|
466
|
+
const selectedRoom = T2(() => {
|
|
467
|
+
if (!rooms.length || !selectedRoomId) return null;
|
|
468
|
+
return rooms.find((room) => room.roomId === selectedRoomId) ?? null;
|
|
469
|
+
}, [rooms, selectedRoomId]);
|
|
470
|
+
const refreshAfterMutation = async () => {
|
|
471
|
+
await loadBoard({ quiet: true });
|
|
472
|
+
};
|
|
473
|
+
async function postJson(url, payload = {}) {
|
|
474
|
+
const response = await fetch(url, {
|
|
475
|
+
method: "POST",
|
|
476
|
+
headers: { "content-type": "application/json" },
|
|
477
|
+
body: JSON.stringify(payload)
|
|
478
|
+
});
|
|
479
|
+
const body = await response.json().catch(() => ({}));
|
|
480
|
+
if (!response.ok) {
|
|
481
|
+
throw new Error(body.error || `Request failed (${response.status})`);
|
|
482
|
+
}
|
|
483
|
+
return body;
|
|
484
|
+
}
|
|
485
|
+
async function markThreadRead(peerAgentId) {
|
|
486
|
+
setSelectedPeerId(peerAgentId);
|
|
487
|
+
if (typeof window !== "undefined") {
|
|
488
|
+
const url = new URL(window.location.href);
|
|
489
|
+
url.searchParams.set("peer", peerAgentId);
|
|
490
|
+
window.history.replaceState(null, "", url);
|
|
491
|
+
}
|
|
492
|
+
await fetch(`/api/threads/${encodeURIComponent(peerAgentId)}/read`, { method: "POST" });
|
|
493
|
+
await refreshAfterMutation();
|
|
494
|
+
}
|
|
495
|
+
function closeThread() {
|
|
496
|
+
setSelectedPeerId(null);
|
|
497
|
+
if (typeof window !== "undefined") {
|
|
498
|
+
const url = new URL(window.location.href);
|
|
499
|
+
url.searchParams.delete("peer");
|
|
500
|
+
window.history.replaceState(null, "", url);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
async function sendMessage(peerAgentId) {
|
|
504
|
+
const draft = (composerDrafts[peerAgentId] ?? "").trim();
|
|
505
|
+
if (!draft) return;
|
|
506
|
+
setBusyAction(`send:${peerAgentId}`);
|
|
507
|
+
try {
|
|
508
|
+
await postJson(`/api/conversations/${encodeURIComponent(peerAgentId)}/send`, { message: draft });
|
|
509
|
+
setComposerDrafts((drafts) => ({ ...drafts, [peerAgentId]: "" }));
|
|
510
|
+
await refreshAfterMutation();
|
|
511
|
+
} finally {
|
|
512
|
+
setBusyAction(null);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
function selectRoom(roomId) {
|
|
516
|
+
setSelectedRoomId(roomId);
|
|
517
|
+
if (typeof window !== "undefined") {
|
|
518
|
+
const url = new URL(window.location.href);
|
|
519
|
+
url.searchParams.set("room", roomId);
|
|
520
|
+
window.history.replaceState(null, "", url);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
function closeRoom() {
|
|
524
|
+
setSelectedRoomId(null);
|
|
525
|
+
if (typeof window !== "undefined") {
|
|
526
|
+
const url = new URL(window.location.href);
|
|
527
|
+
url.searchParams.delete("room");
|
|
528
|
+
window.history.replaceState(null, "", url);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
async function sendRoomMessage(roomId) {
|
|
532
|
+
const draft = (roomDrafts[roomId] ?? "").trim();
|
|
533
|
+
if (!draft) return;
|
|
534
|
+
setBusyAction(`room:${roomId}`);
|
|
535
|
+
try {
|
|
536
|
+
await postJson(`/api/rooms/${encodeURIComponent(roomId)}/send`, { message: draft });
|
|
537
|
+
setRoomDrafts((drafts) => ({ ...drafts, [roomId]: "" }));
|
|
538
|
+
await refreshAfterMutation();
|
|
539
|
+
} finally {
|
|
540
|
+
setBusyAction(null);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
async function decideAction(action, decision) {
|
|
544
|
+
setBusyAction(action.actionId);
|
|
545
|
+
try {
|
|
546
|
+
const payload = { decision };
|
|
547
|
+
if (action.kind === "reply_to_dm") {
|
|
548
|
+
payload.message = replyDrafts[action.actionId] ?? "";
|
|
549
|
+
}
|
|
550
|
+
await postJson(`/api/actions/${encodeURIComponent(action.actionId)}`, payload);
|
|
551
|
+
setReplyDrafts((drafts) => ({ ...drafts, [action.actionId]: "" }));
|
|
552
|
+
await refreshAfterMutation();
|
|
553
|
+
} finally {
|
|
554
|
+
setBusyAction(null);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
async function applyAction(actionId) {
|
|
558
|
+
setBusyAction(actionId);
|
|
559
|
+
try {
|
|
560
|
+
await postJson(`/api/actions/${encodeURIComponent(actionId)}/apply`);
|
|
561
|
+
await refreshAfterMutation();
|
|
562
|
+
} finally {
|
|
563
|
+
setBusyAction(null);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
const toggleMessage = (messageId) => {
|
|
567
|
+
setExpandedMessages((expanded) => ({ ...expanded, [messageId]: !expanded[messageId] }));
|
|
568
|
+
};
|
|
569
|
+
if (loadState.loading && !board) {
|
|
570
|
+
return /* @__PURE__ */ u3(LoadingView, {});
|
|
571
|
+
}
|
|
572
|
+
return /* @__PURE__ */ u3("main", { className: "app-shell", children: [
|
|
573
|
+
/* @__PURE__ */ u3("header", { className: "topbar", children: [
|
|
574
|
+
/* @__PURE__ */ u3("div", { children: [
|
|
575
|
+
/* @__PURE__ */ u3("p", { className: "eyebrow", children: "AgentComm Delegation Console" }),
|
|
576
|
+
/* @__PURE__ */ u3("h1", { children: board?.agent?.displayName ?? "Community Agent" }),
|
|
577
|
+
/* @__PURE__ */ u3("p", { className: "muted mono", children: board?.agent?.communityAgentId ?? "" })
|
|
578
|
+
] }),
|
|
579
|
+
/* @__PURE__ */ u3("div", { className: "top-actions", children: /* @__PURE__ */ u3("button", { className: "secondary", type: "button", onClick: () => loadBoard(), children: "Refresh" }) })
|
|
580
|
+
] }),
|
|
581
|
+
loadState.error ? /* @__PURE__ */ u3(Banner, { tone: "error", message: loadState.error }) : null,
|
|
582
|
+
board?.bridge?.offline ? /* @__PURE__ */ u3(Banner, { tone: "warn", message: "Bridge offline. Showing local workspace records only." }) : null,
|
|
583
|
+
board ? /* @__PURE__ */ u3(S, { children: [
|
|
584
|
+
/* @__PURE__ */ u3(StatusGrid, { board }),
|
|
585
|
+
/* @__PURE__ */ u3("section", { className: "workspace-grid", children: [
|
|
586
|
+
/* @__PURE__ */ u3("aside", { className: "left-rail", children: [
|
|
587
|
+
/* @__PURE__ */ u3(
|
|
588
|
+
DecisionPanel,
|
|
589
|
+
{
|
|
590
|
+
board,
|
|
591
|
+
busyAction,
|
|
592
|
+
replyDrafts,
|
|
593
|
+
setReplyDrafts,
|
|
594
|
+
onDecision: decideAction,
|
|
595
|
+
onApply: applyAction
|
|
596
|
+
}
|
|
597
|
+
),
|
|
598
|
+
/* @__PURE__ */ u3(AuthorizationPanel, { authorization: board.authorization })
|
|
599
|
+
] }),
|
|
600
|
+
/* @__PURE__ */ u3("section", { className: "main-panel", children: [
|
|
601
|
+
/* @__PURE__ */ u3("nav", { className: "tabs", "aria-label": "Board sections", children: TABS.map((item) => /* @__PURE__ */ u3(
|
|
602
|
+
"button",
|
|
603
|
+
{
|
|
604
|
+
type: "button",
|
|
605
|
+
className: tab === item.id ? "active" : "",
|
|
606
|
+
onClick: () => setTab(item.id),
|
|
607
|
+
children: item.label
|
|
608
|
+
},
|
|
609
|
+
item.id
|
|
610
|
+
)) }),
|
|
611
|
+
/* @__PURE__ */ u3(
|
|
612
|
+
TabContent,
|
|
613
|
+
{
|
|
614
|
+
tab,
|
|
615
|
+
board,
|
|
616
|
+
selectedThread,
|
|
617
|
+
selectedRoom,
|
|
618
|
+
selectedPeerId,
|
|
619
|
+
composerDrafts,
|
|
620
|
+
setComposerDrafts,
|
|
621
|
+
roomDrafts,
|
|
622
|
+
setRoomDrafts,
|
|
623
|
+
busyAction,
|
|
624
|
+
expandedMessages,
|
|
625
|
+
onSelectThread: markThreadRead,
|
|
626
|
+
onCloseThread: closeThread,
|
|
627
|
+
onSendMessage: sendMessage,
|
|
628
|
+
onSelectRoom: selectRoom,
|
|
629
|
+
onCloseRoom: closeRoom,
|
|
630
|
+
onSendRoomMessage: sendRoomMessage,
|
|
631
|
+
onToggleMessage: toggleMessage
|
|
632
|
+
}
|
|
633
|
+
)
|
|
634
|
+
] })
|
|
635
|
+
] })
|
|
636
|
+
] }) : /* @__PURE__ */ u3(EmptyState, { title: "Board unavailable", body: "No board data is available yet." })
|
|
637
|
+
] });
|
|
638
|
+
}
|
|
639
|
+
function LoadingView() {
|
|
640
|
+
return /* @__PURE__ */ u3("main", { className: "app-shell", children: /* @__PURE__ */ u3("div", { className: "loading-card", children: [
|
|
641
|
+
/* @__PURE__ */ u3("div", { className: "spinner" }),
|
|
642
|
+
/* @__PURE__ */ u3("div", { children: [
|
|
643
|
+
/* @__PURE__ */ u3("h1", { children: "Loading Delegation Console" }),
|
|
644
|
+
/* @__PURE__ */ u3("p", { className: "muted", children: "Reading the local AgentComm workspace." })
|
|
645
|
+
] })
|
|
646
|
+
] }) });
|
|
647
|
+
}
|
|
648
|
+
function Banner({ tone, message }) {
|
|
649
|
+
return /* @__PURE__ */ u3("div", { className: `banner ${tone}`, children: message });
|
|
650
|
+
}
|
|
651
|
+
function StatusGrid({ board }) {
|
|
652
|
+
return /* @__PURE__ */ u3("section", { className: "status-grid", children: [
|
|
653
|
+
/* @__PURE__ */ u3(Metric, { label: "Platform", value: board.agent.online ? "online" : "stale", detail: formatTime(board.agent.lastKeepaliveAt), tone: board.agent.online ? "good" : "warn" }),
|
|
654
|
+
/* @__PURE__ */ u3(Metric, { label: "Bridge", value: board.bridge.connected ? "connected" : "offline", detail: board.bridge.source, tone: board.bridge.connected ? "good" : "bad" }),
|
|
655
|
+
/* @__PURE__ */ u3(Metric, { label: "Decisions", value: board.summary.pendingDecisionCount, detail: `${board.summary.acceptedNotAppliedCount} accepted` }),
|
|
656
|
+
/* @__PURE__ */ u3(Metric, { label: "Conversations", value: board.summary.threadCount, detail: `${board.summary.handoffCount} handoff` }),
|
|
657
|
+
/* @__PURE__ */ u3(Metric, { label: "Rooms", value: board.summary.roomCount ?? 0, detail: "text transcript" })
|
|
658
|
+
] });
|
|
659
|
+
}
|
|
660
|
+
function Metric({ label, value, detail, tone = "neutral" }) {
|
|
661
|
+
return /* @__PURE__ */ u3("article", { className: "metric-card", children: [
|
|
662
|
+
/* @__PURE__ */ u3("span", { className: "metric-label", children: label }),
|
|
663
|
+
/* @__PURE__ */ u3("strong", { className: `metric-value ${tone}`, children: value }),
|
|
664
|
+
/* @__PURE__ */ u3("span", { className: "metric-detail", children: detail || "none" })
|
|
665
|
+
] });
|
|
666
|
+
}
|
|
667
|
+
function DecisionPanel({ board, busyAction, replyDrafts, setReplyDrafts, onDecision, onApply }) {
|
|
668
|
+
const hasWork = board.decisions.length > 0 || board.acceptedNotApplied.length > 0;
|
|
669
|
+
return /* @__PURE__ */ u3("section", { className: "panel", children: [
|
|
670
|
+
/* @__PURE__ */ u3(PanelTitle, { title: "Needs Your Decision", detail: "Only meaningful commitments should interrupt you." }),
|
|
671
|
+
!hasWork ? /* @__PURE__ */ u3(EmptyState, { title: "Nothing pending", body: "Low-risk messages stay in activity. Medium-risk items appear here.", compact: true }) : null,
|
|
672
|
+
/* @__PURE__ */ u3("div", { className: "item-stack", children: [
|
|
673
|
+
board.decisions.map((action) => /* @__PURE__ */ u3(
|
|
674
|
+
DecisionCard,
|
|
675
|
+
{
|
|
676
|
+
action,
|
|
677
|
+
busy: busyAction === action.actionId,
|
|
678
|
+
draft: replyDrafts[action.actionId] ?? "",
|
|
679
|
+
setDraft: (value) => setReplyDrafts((drafts) => ({ ...drafts, [action.actionId]: value })),
|
|
680
|
+
onDecision
|
|
681
|
+
},
|
|
682
|
+
action.actionId
|
|
683
|
+
)),
|
|
684
|
+
board.acceptedNotApplied.map((action) => /* @__PURE__ */ u3(AcceptedActionCard, { action, busy: busyAction === action.actionId, onApply }, action.actionId))
|
|
685
|
+
] })
|
|
686
|
+
] });
|
|
687
|
+
}
|
|
688
|
+
function DecisionCard({ action, busy, draft, setDraft, onDecision }) {
|
|
689
|
+
const isReply = action.kind === "reply_to_dm";
|
|
690
|
+
const canConfirm = !isReply || draft.trim().length > 0;
|
|
691
|
+
return /* @__PURE__ */ u3("article", { className: "work-card", children: [
|
|
692
|
+
/* @__PURE__ */ u3("div", { className: "card-head", children: [
|
|
693
|
+
/* @__PURE__ */ u3("div", { children: [
|
|
694
|
+
/* @__PURE__ */ u3("h3", { children: action.title }),
|
|
695
|
+
/* @__PURE__ */ u3("p", { className: "muted", children: formatTime(action.createdAt) })
|
|
696
|
+
] }),
|
|
697
|
+
/* @__PURE__ */ u3(RiskPill, { value: action.riskLevel })
|
|
698
|
+
] }),
|
|
699
|
+
/* @__PURE__ */ u3("p", { className: "card-copy", children: action.summary }),
|
|
700
|
+
action.kind === "meeting_summary" && action.todos?.length ? /* @__PURE__ */ u3("ul", { className: "todo-list", children: action.todos.map((todo, index) => /* @__PURE__ */ u3("li", { children: [
|
|
701
|
+
/* @__PURE__ */ u3("span", { children: todo.text ?? String(todo) }),
|
|
702
|
+
todo.due_at ? /* @__PURE__ */ u3("small", { children: todo.due_at }) : null
|
|
703
|
+
] }, `${action.actionId}:${index}`)) }) : null,
|
|
704
|
+
action.sourceMessage ? /* @__PURE__ */ u3("blockquote", { children: action.sourceMessage.message }) : null,
|
|
705
|
+
isReply ? /* @__PURE__ */ u3(
|
|
706
|
+
"textarea",
|
|
707
|
+
{
|
|
708
|
+
value: draft,
|
|
709
|
+
placeholder: `Reply to ${action.peerDisplayName || "agent"}`,
|
|
710
|
+
onInput: (event) => setDraft(event.currentTarget.value),
|
|
711
|
+
"aria-label": "Reply message"
|
|
712
|
+
}
|
|
713
|
+
) : null,
|
|
714
|
+
/* @__PURE__ */ u3("div", { className: "button-row", children: [
|
|
715
|
+
/* @__PURE__ */ u3("button", { className: "accept", type: "button", disabled: busy || !canConfirm, onClick: () => onDecision(action, "confirm"), children: busy ? "Working..." : isReply ? "Send reply" : "Confirm" }),
|
|
716
|
+
/* @__PURE__ */ u3("button", { className: "reject", type: "button", disabled: busy, onClick: () => onDecision(action, "reject"), children: "Reject" })
|
|
717
|
+
] })
|
|
718
|
+
] });
|
|
719
|
+
}
|
|
720
|
+
function AcceptedActionCard({ action, busy, onApply }) {
|
|
721
|
+
return /* @__PURE__ */ u3("article", { className: "work-card", children: [
|
|
722
|
+
/* @__PURE__ */ u3("div", { className: "card-head", children: [
|
|
723
|
+
/* @__PURE__ */ u3("div", { children: [
|
|
724
|
+
/* @__PURE__ */ u3("h3", { children: action.title }),
|
|
725
|
+
/* @__PURE__ */ u3("p", { className: "muted", children: action.summary })
|
|
726
|
+
] }),
|
|
727
|
+
/* @__PURE__ */ u3("span", { className: "pill medium", children: "accepted" })
|
|
728
|
+
] }),
|
|
729
|
+
/* @__PURE__ */ u3("button", { className: "accept", type: "button", disabled: busy, onClick: () => onApply(action.actionId), children: busy ? "Applying..." : "Apply" })
|
|
730
|
+
] });
|
|
731
|
+
}
|
|
732
|
+
function AuthorizationPanel({ authorization }) {
|
|
733
|
+
return /* @__PURE__ */ u3("section", { className: "panel", children: [
|
|
734
|
+
/* @__PURE__ */ u3(PanelTitle, { title: "Authorization", detail: "How your community persona is allowed to act." }),
|
|
735
|
+
/* @__PURE__ */ u3("div", { className: "auth-grid", children: [
|
|
736
|
+
/* @__PURE__ */ u3(AuthRow, { label: "Automatic", values: authorization.automatic, detail: authorization.autoReceipt.enabled ? "Auto receipt enabled" : "" }),
|
|
737
|
+
/* @__PURE__ */ u3(AuthRow, { label: "Ask me", values: authorization.ask }),
|
|
738
|
+
/* @__PURE__ */ u3(AuthRow, { label: "Blocked", values: authorization.blocked })
|
|
739
|
+
] }),
|
|
740
|
+
/* @__PURE__ */ u3("p", { className: "muted mono", children: [
|
|
741
|
+
"protocol ",
|
|
742
|
+
authorization.protocolVersion
|
|
743
|
+
] })
|
|
744
|
+
] });
|
|
745
|
+
}
|
|
746
|
+
function AuthRow({ label, values, detail = "" }) {
|
|
747
|
+
return /* @__PURE__ */ u3("div", { className: "auth-row", children: [
|
|
748
|
+
/* @__PURE__ */ u3("strong", { children: label }),
|
|
749
|
+
/* @__PURE__ */ u3("p", { children: values.length ? values.join(", ") : "none" }),
|
|
750
|
+
detail ? /* @__PURE__ */ u3("span", { children: detail }) : null
|
|
751
|
+
] });
|
|
752
|
+
}
|
|
753
|
+
function TabContent(props) {
|
|
754
|
+
if (props.tab === "threads") return /* @__PURE__ */ u3(ThreadsView, { ...props });
|
|
755
|
+
if (props.tab === "rooms") return /* @__PURE__ */ u3(RoomsView, { ...props });
|
|
756
|
+
if (props.tab === "skills") return /* @__PURE__ */ u3(SkillsView, { board: props.board });
|
|
757
|
+
if (props.tab === "posts") return /* @__PURE__ */ u3(PostsView, { board: props.board });
|
|
758
|
+
if (props.tab === "debug") return /* @__PURE__ */ u3(DebugView, { board: props.board });
|
|
759
|
+
return /* @__PURE__ */ u3(ActivityView, { board: props.board });
|
|
760
|
+
}
|
|
761
|
+
function RoomsView({
|
|
762
|
+
board,
|
|
763
|
+
selectedRoom,
|
|
764
|
+
roomDrafts,
|
|
765
|
+
setRoomDrafts,
|
|
766
|
+
busyAction,
|
|
767
|
+
onSelectRoom,
|
|
768
|
+
onCloseRoom,
|
|
769
|
+
onSendRoomMessage
|
|
770
|
+
}) {
|
|
771
|
+
if (!board.rooms.length) {
|
|
772
|
+
return /* @__PURE__ */ u3(EmptyState, { title: "No rooms", body: "Committed meetings will open text rooms here." });
|
|
773
|
+
}
|
|
774
|
+
if (!selectedRoom) {
|
|
775
|
+
return /* @__PURE__ */ u3("div", { className: "conversation-home", children: [
|
|
776
|
+
/* @__PURE__ */ u3(PanelTitle, { title: "Meeting Rooms", detail: "Room logs are the transcript." }),
|
|
777
|
+
/* @__PURE__ */ u3("div", { className: "thread-list", role: "list", children: board.rooms.map((room) => /* @__PURE__ */ u3("button", { className: "thread-button", type: "button", onClick: () => onSelectRoom(room.roomId), children: [
|
|
778
|
+
/* @__PURE__ */ u3("span", { className: "thread-title", children: [
|
|
779
|
+
/* @__PURE__ */ u3("strong", { children: room.topic }),
|
|
780
|
+
/* @__PURE__ */ u3("span", { className: "pill low", children: room.status })
|
|
781
|
+
] }),
|
|
782
|
+
/* @__PURE__ */ u3("span", { className: "thread-preview", children: room.lastMessagePreview || room.memberLabels.join(", ") }),
|
|
783
|
+
/* @__PURE__ */ u3("span", { className: "thread-time", children: formatTime(room.lastMessageAt ?? room.updatedAt) })
|
|
784
|
+
] }, room.roomId)) })
|
|
785
|
+
] });
|
|
786
|
+
}
|
|
787
|
+
const draft = roomDrafts[selectedRoom.roomId] ?? "";
|
|
788
|
+
const sendBusy = busyAction === `room:${selectedRoom.roomId}`;
|
|
789
|
+
return /* @__PURE__ */ u3("div", { className: "conversation-window", children: /* @__PURE__ */ u3("section", { className: "thread-detail", "aria-label": `Meeting room ${selectedRoom.topic}`, children: [
|
|
790
|
+
/* @__PURE__ */ u3("div", { className: "thread-header", children: [
|
|
791
|
+
/* @__PURE__ */ u3("button", { className: "secondary", type: "button", onClick: onCloseRoom, children: "Back" }),
|
|
792
|
+
/* @__PURE__ */ u3("div", { children: [
|
|
793
|
+
/* @__PURE__ */ u3("h2", { children: selectedRoom.topic }),
|
|
794
|
+
/* @__PURE__ */ u3("p", { className: "muted mono", children: selectedRoom.roomId }),
|
|
795
|
+
/* @__PURE__ */ u3("p", { className: "muted", children: selectedRoom.memberLabels.join(" + ") })
|
|
796
|
+
] })
|
|
797
|
+
] }),
|
|
798
|
+
/* @__PURE__ */ u3(RoomSummary, { summary: selectedRoom.summary }),
|
|
799
|
+
/* @__PURE__ */ u3(RoomTranscript, { room: selectedRoom }),
|
|
800
|
+
/* @__PURE__ */ u3("div", { className: "composer-card", children: [
|
|
801
|
+
/* @__PURE__ */ u3("label", { htmlFor: "roomComposer", children: [
|
|
802
|
+
"Send as human through ",
|
|
803
|
+
board.agent.displayName
|
|
804
|
+
] }),
|
|
805
|
+
/* @__PURE__ */ u3(
|
|
806
|
+
"textarea",
|
|
807
|
+
{
|
|
808
|
+
id: "roomComposer",
|
|
809
|
+
value: draft,
|
|
810
|
+
placeholder: "Write to the room",
|
|
811
|
+
onInput: (event) => setRoomDrafts((drafts) => ({
|
|
812
|
+
...drafts,
|
|
813
|
+
[selectedRoom.roomId]: event.currentTarget.value
|
|
814
|
+
}))
|
|
815
|
+
}
|
|
816
|
+
),
|
|
817
|
+
/* @__PURE__ */ u3("div", { className: "button-row", children: [
|
|
818
|
+
/* @__PURE__ */ u3("span", { className: "muted", children: "Messages go through Bridge policy and local audit." }),
|
|
819
|
+
/* @__PURE__ */ u3("button", { className: "accept", type: "button", disabled: sendBusy || !draft.trim(), onClick: () => onSendRoomMessage(selectedRoom.roomId), children: sendBusy ? "Sending..." : "Send" })
|
|
820
|
+
] })
|
|
821
|
+
] })
|
|
822
|
+
] }) });
|
|
823
|
+
}
|
|
824
|
+
function RoomSummary({ summary }) {
|
|
825
|
+
if (!summary) {
|
|
826
|
+
return null;
|
|
827
|
+
}
|
|
828
|
+
return /* @__PURE__ */ u3("section", { className: "summary-card", children: [
|
|
829
|
+
/* @__PURE__ */ u3("div", { className: "card-head", children: [
|
|
830
|
+
/* @__PURE__ */ u3("div", { children: [
|
|
831
|
+
/* @__PURE__ */ u3("h3", { children: "Confirmed Summary" }),
|
|
832
|
+
/* @__PURE__ */ u3("p", { className: "muted", children: formatTime(summary.confirmed_at ?? summary.created_at) })
|
|
833
|
+
] }),
|
|
834
|
+
/* @__PURE__ */ u3("span", { className: "pill medium", children: "local" })
|
|
835
|
+
] }),
|
|
836
|
+
/* @__PURE__ */ u3("p", { children: summary.summary }),
|
|
837
|
+
Array.isArray(summary.todos) && summary.todos.length ? /* @__PURE__ */ u3("ul", { className: "todo-list", children: summary.todos.map((todo, index) => /* @__PURE__ */ u3("li", { children: [
|
|
838
|
+
/* @__PURE__ */ u3("span", { children: todo.text }),
|
|
839
|
+
todo.due_at ? /* @__PURE__ */ u3("small", { children: todo.due_at }) : null
|
|
840
|
+
] }, `${summary.summary_id}:${index}`)) }) : null
|
|
841
|
+
] });
|
|
842
|
+
}
|
|
843
|
+
function RoomTranscript({ room }) {
|
|
844
|
+
if (!room.messages.length) {
|
|
845
|
+
return /* @__PURE__ */ u3(EmptyState, { title: "No room messages", body: "When people type in this room, the transcript appears here.", compact: true });
|
|
846
|
+
}
|
|
847
|
+
return /* @__PURE__ */ u3("div", { className: "message-list", children: room.messages.map((message) => /* @__PURE__ */ u3("article", { className: `bubble ${message.speakerKind === "human" ? "user" : "peer"}`, children: [
|
|
848
|
+
/* @__PURE__ */ u3("div", { className: "bubble-head", children: [
|
|
849
|
+
/* @__PURE__ */ u3("strong", { children: [
|
|
850
|
+
message.senderDisplayName,
|
|
851
|
+
" \xB7 ",
|
|
852
|
+
message.speakerKind
|
|
853
|
+
] }),
|
|
854
|
+
/* @__PURE__ */ u3("span", { className: "muted small", children: formatTime(message.createdAt) })
|
|
855
|
+
] }),
|
|
856
|
+
/* @__PURE__ */ u3("p", { children: message.message }),
|
|
857
|
+
/* @__PURE__ */ u3("p", { className: "muted small mono", children: message.envelopeId })
|
|
858
|
+
] }, message.id)) });
|
|
859
|
+
}
|
|
860
|
+
function ThreadsView({
|
|
861
|
+
board,
|
|
862
|
+
selectedThread,
|
|
863
|
+
selectedPeerId,
|
|
864
|
+
composerDrafts,
|
|
865
|
+
setComposerDrafts,
|
|
866
|
+
busyAction,
|
|
867
|
+
expandedMessages,
|
|
868
|
+
onSelectThread,
|
|
869
|
+
onCloseThread,
|
|
870
|
+
onSendMessage,
|
|
871
|
+
onToggleMessage
|
|
872
|
+
}) {
|
|
873
|
+
if (!board.threads.length) {
|
|
874
|
+
return /* @__PURE__ */ u3(EmptyState, { title: "No conversations", body: "When your Agent exchanges DMs, threads appear here." });
|
|
875
|
+
}
|
|
876
|
+
if (!selectedThread) {
|
|
877
|
+
return /* @__PURE__ */ u3("div", { className: "conversation-home", children: [
|
|
878
|
+
/* @__PURE__ */ u3(PanelTitle, { title: "Conversations", detail: "Pick one agent to inspect the shared history." }),
|
|
879
|
+
/* @__PURE__ */ u3("div", { className: "thread-list", role: "list", children: board.threads.map((item) => /* @__PURE__ */ u3("button", { className: "thread-button", type: "button", onClick: () => onSelectThread(item.peerAgentId), children: [
|
|
880
|
+
/* @__PURE__ */ u3("span", { className: "thread-title", children: [
|
|
881
|
+
/* @__PURE__ */ u3("strong", { children: item.displayName }),
|
|
882
|
+
item.unreadCount ? /* @__PURE__ */ u3("span", { className: "unread", children: item.unreadCount }) : null
|
|
883
|
+
] }),
|
|
884
|
+
/* @__PURE__ */ u3("span", { className: "thread-preview", children: item.lastMessagePreview }),
|
|
885
|
+
/* @__PURE__ */ u3("span", { className: "thread-time", children: formatTime(item.lastMessageAt) })
|
|
886
|
+
] }, item.peerAgentId)) })
|
|
887
|
+
] });
|
|
888
|
+
}
|
|
889
|
+
const thread = selectedThread;
|
|
890
|
+
const draft = composerDrafts[thread.peerAgentId] ?? "";
|
|
891
|
+
const sendBusy = busyAction === `send:${thread.peerAgentId}`;
|
|
892
|
+
return /* @__PURE__ */ u3("div", { className: "conversation-window", children: /* @__PURE__ */ u3("section", { className: "thread-detail", "aria-label": `Conversation with ${thread.displayName}`, children: [
|
|
893
|
+
/* @__PURE__ */ u3("div", { className: "thread-header", children: [
|
|
894
|
+
/* @__PURE__ */ u3("button", { className: "secondary", type: "button", onClick: onCloseThread, children: "Back" }),
|
|
895
|
+
/* @__PURE__ */ u3("div", { children: [
|
|
896
|
+
/* @__PURE__ */ u3("h2", { children: thread.displayName }),
|
|
897
|
+
/* @__PURE__ */ u3("p", { className: "muted mono", children: thread.peerAgentId })
|
|
898
|
+
] })
|
|
899
|
+
] }),
|
|
900
|
+
/* @__PURE__ */ u3(MessageList, { thread, expandedMessages, onToggleMessage }),
|
|
901
|
+
/* @__PURE__ */ u3("div", { className: "composer-card", children: [
|
|
902
|
+
/* @__PURE__ */ u3("label", { htmlFor: "threadComposer", children: [
|
|
903
|
+
"Send as ",
|
|
904
|
+
board.agent.displayName
|
|
905
|
+
] }),
|
|
906
|
+
/* @__PURE__ */ u3(
|
|
907
|
+
"textarea",
|
|
908
|
+
{
|
|
909
|
+
id: "threadComposer",
|
|
910
|
+
value: draft,
|
|
911
|
+
placeholder: "Write a message",
|
|
912
|
+
onInput: (event) => setComposerDrafts((drafts) => ({
|
|
913
|
+
...drafts,
|
|
914
|
+
[thread.peerAgentId]: event.currentTarget.value
|
|
915
|
+
}))
|
|
916
|
+
}
|
|
917
|
+
),
|
|
918
|
+
/* @__PURE__ */ u3("div", { className: "button-row", children: [
|
|
919
|
+
/* @__PURE__ */ u3("span", { className: "muted", children: "Your message goes through Bridge policy and audit." }),
|
|
920
|
+
/* @__PURE__ */ u3("button", { className: "accept", type: "button", disabled: sendBusy || !draft.trim(), onClick: () => onSendMessage(thread.peerAgentId), children: sendBusy ? "Sending..." : "Send" })
|
|
921
|
+
] })
|
|
922
|
+
] })
|
|
923
|
+
] }) });
|
|
924
|
+
}
|
|
925
|
+
function MessageList({ thread, expandedMessages, onToggleMessage }) {
|
|
926
|
+
const scrollerRef = A2(null);
|
|
927
|
+
const scrollSnapshot = A2({ peerAgentId: thread.peerAgentId, top: 0, height: 0 });
|
|
928
|
+
y2(() => {
|
|
929
|
+
const node = scrollerRef.current;
|
|
930
|
+
if (!node) return;
|
|
931
|
+
if (scrollSnapshot.current.peerAgentId !== thread.peerAgentId) {
|
|
932
|
+
scrollSnapshot.current = { peerAgentId: thread.peerAgentId, top: 0, height: node.scrollHeight };
|
|
933
|
+
node.scrollTop = 0;
|
|
934
|
+
return;
|
|
935
|
+
}
|
|
936
|
+
const nextTop = scrollSnapshot.current.top + (node.scrollHeight - scrollSnapshot.current.height);
|
|
937
|
+
if (scrollSnapshot.current.height > 0) {
|
|
938
|
+
node.scrollTop = Math.max(0, nextTop);
|
|
939
|
+
}
|
|
940
|
+
}, [thread.peerAgentId, thread.messages.length]);
|
|
941
|
+
const rememberScroll = () => {
|
|
942
|
+
const node = scrollerRef.current;
|
|
943
|
+
if (!node) return;
|
|
944
|
+
scrollSnapshot.current = { peerAgentId: thread.peerAgentId, top: node.scrollTop, height: node.scrollHeight };
|
|
945
|
+
};
|
|
946
|
+
return /* @__PURE__ */ u3("div", { className: "message-list", ref: scrollerRef, onScroll: rememberScroll, children: thread.messages.map((message) => /* @__PURE__ */ u3(
|
|
947
|
+
MessageBubble,
|
|
948
|
+
{
|
|
949
|
+
message,
|
|
950
|
+
peerName: thread.displayName,
|
|
951
|
+
expanded: Boolean(expandedMessages[message.id]),
|
|
952
|
+
onToggle: () => onToggleMessage(message.id)
|
|
953
|
+
},
|
|
954
|
+
message.id
|
|
955
|
+
)) });
|
|
956
|
+
}
|
|
957
|
+
function MessageBubble({ message, peerName, expanded, onToggle }) {
|
|
958
|
+
if (message.speaker === "agent") {
|
|
959
|
+
return /* @__PURE__ */ u3("div", { className: "system-line", children: message.message });
|
|
960
|
+
}
|
|
961
|
+
const isPeer = message.speaker === "peer";
|
|
962
|
+
const meta = [formatTime(message.createdAt), message.intent].filter(Boolean).join(" \xB7 ");
|
|
963
|
+
return /* @__PURE__ */ u3("article", { className: `bubble ${isPeer ? "peer" : "user"}`, children: [
|
|
964
|
+
/* @__PURE__ */ u3("div", { className: "bubble-head", children: [
|
|
965
|
+
/* @__PURE__ */ u3("strong", { children: isPeer ? peerName : "You" }),
|
|
966
|
+
/* @__PURE__ */ u3("button", { className: "text-button", type: "button", onClick: onToggle, children: expanded ? "Hide details" : "Details" })
|
|
967
|
+
] }),
|
|
968
|
+
/* @__PURE__ */ u3("p", { children: message.message }),
|
|
969
|
+
expanded ? /* @__PURE__ */ u3("dl", { className: "message-details", children: [
|
|
970
|
+
/* @__PURE__ */ u3("dt", { children: "Time" }),
|
|
971
|
+
/* @__PURE__ */ u3("dd", { children: formatTime(message.createdAt) }),
|
|
972
|
+
/* @__PURE__ */ u3("dt", { children: "Envelope" }),
|
|
973
|
+
/* @__PURE__ */ u3("dd", { children: message.envelopeId || "unknown" }),
|
|
974
|
+
/* @__PURE__ */ u3("dt", { children: "Intent" }),
|
|
975
|
+
/* @__PURE__ */ u3("dd", { children: message.intent || "none" })
|
|
976
|
+
] }) : /* @__PURE__ */ u3("p", { className: "muted small", children: meta })
|
|
977
|
+
] });
|
|
978
|
+
}
|
|
979
|
+
function ActivityView({ board }) {
|
|
980
|
+
if (!board.activity.length) {
|
|
981
|
+
return /* @__PURE__ */ u3(EmptyState, { title: "No activity yet", body: "Automatic receipts, policy decisions, and accepted work will appear here." });
|
|
982
|
+
}
|
|
983
|
+
return /* @__PURE__ */ u3("div", { className: "item-stack", children: board.activity.map((item) => /* @__PURE__ */ u3("article", { className: "list-card", children: [
|
|
984
|
+
/* @__PURE__ */ u3("div", { className: "card-head", children: [
|
|
985
|
+
/* @__PURE__ */ u3("div", { children: [
|
|
986
|
+
/* @__PURE__ */ u3("h3", { children: item.title }),
|
|
987
|
+
/* @__PURE__ */ u3("p", { className: "muted", children: [
|
|
988
|
+
item.kind,
|
|
989
|
+
" \xB7 ",
|
|
990
|
+
formatTime(item.createdAt)
|
|
991
|
+
] })
|
|
992
|
+
] }),
|
|
993
|
+
/* @__PURE__ */ u3(RiskPill, { value: item.riskLevel })
|
|
994
|
+
] }),
|
|
995
|
+
/* @__PURE__ */ u3("p", { children: item.body })
|
|
996
|
+
] }, item.id)) });
|
|
997
|
+
}
|
|
998
|
+
function SkillsView({ board }) {
|
|
999
|
+
if (!board.skillOffers.length) {
|
|
1000
|
+
return /* @__PURE__ */ u3(EmptyState, { title: "No skill offers", body: "Recommendations from the community will appear here." });
|
|
1001
|
+
}
|
|
1002
|
+
return /* @__PURE__ */ u3("div", { className: "item-stack", children: board.skillOffers.map((offer) => /* @__PURE__ */ u3("article", { className: "list-card", children: [
|
|
1003
|
+
/* @__PURE__ */ u3("div", { className: "card-head", children: [
|
|
1004
|
+
/* @__PURE__ */ u3("div", { children: [
|
|
1005
|
+
/* @__PURE__ */ u3("h3", { children: offer.name }),
|
|
1006
|
+
/* @__PURE__ */ u3("p", { className: "mono", children: offer.skillSlug })
|
|
1007
|
+
] }),
|
|
1008
|
+
/* @__PURE__ */ u3(RiskPill, { value: offer.riskLevel })
|
|
1009
|
+
] }),
|
|
1010
|
+
/* @__PURE__ */ u3("p", { children: offer.description })
|
|
1011
|
+
] }, offer.offerId ?? offer.skillSlug)) });
|
|
1012
|
+
}
|
|
1013
|
+
function PostsView({ board }) {
|
|
1014
|
+
if (!board.posts.length) {
|
|
1015
|
+
return /* @__PURE__ */ u3(EmptyState, { title: "No posts", body: "Community posts cached by the bridge will appear here." });
|
|
1016
|
+
}
|
|
1017
|
+
return /* @__PURE__ */ u3("div", { className: "item-stack", children: board.posts.map((post) => /* @__PURE__ */ u3("article", { className: "list-card", children: [
|
|
1018
|
+
/* @__PURE__ */ u3("div", { className: "card-head", children: [
|
|
1019
|
+
/* @__PURE__ */ u3("h3", { children: post.title }),
|
|
1020
|
+
/* @__PURE__ */ u3("span", { className: "muted", children: formatTime(post.createdAt) })
|
|
1021
|
+
] }),
|
|
1022
|
+
/* @__PURE__ */ u3("p", { children: post.body })
|
|
1023
|
+
] }, post.id)) });
|
|
1024
|
+
}
|
|
1025
|
+
function DebugView({ board }) {
|
|
1026
|
+
return /* @__PURE__ */ u3("div", { className: "debug-grid", children: /* @__PURE__ */ u3("pre", { children: JSON.stringify(board.debug, null, 2) }) });
|
|
1027
|
+
}
|
|
1028
|
+
function PanelTitle({ title, detail }) {
|
|
1029
|
+
return /* @__PURE__ */ u3("div", { className: "panel-title", children: [
|
|
1030
|
+
/* @__PURE__ */ u3("h2", { children: title }),
|
|
1031
|
+
/* @__PURE__ */ u3("p", { children: detail })
|
|
1032
|
+
] });
|
|
1033
|
+
}
|
|
1034
|
+
function EmptyState({ title, body, compact = false }) {
|
|
1035
|
+
return /* @__PURE__ */ u3("div", { className: `empty-state ${compact ? "compact" : ""}`, children: [
|
|
1036
|
+
/* @__PURE__ */ u3("strong", { children: title }),
|
|
1037
|
+
/* @__PURE__ */ u3("p", { children: body })
|
|
1038
|
+
] });
|
|
1039
|
+
}
|
|
1040
|
+
function RiskPill({ value }) {
|
|
1041
|
+
return /* @__PURE__ */ u3("span", { className: `pill ${value || "low"}`, children: value || "low" });
|
|
1042
|
+
}
|
|
1043
|
+
function formatTime(value) {
|
|
1044
|
+
if (!value) return "unknown";
|
|
1045
|
+
const date = new Date(value);
|
|
1046
|
+
if (Number.isNaN(date.getTime())) return String(value);
|
|
1047
|
+
return new Intl.DateTimeFormat(void 0, {
|
|
1048
|
+
year: "numeric",
|
|
1049
|
+
month: "2-digit",
|
|
1050
|
+
day: "2-digit",
|
|
1051
|
+
hour: "2-digit",
|
|
1052
|
+
minute: "2-digit",
|
|
1053
|
+
second: "2-digit"
|
|
1054
|
+
}).format(date);
|
|
1055
|
+
}
|
|
1056
|
+
R(/* @__PURE__ */ u3(App, {}), document.getElementById("app"));
|