@agentproto/apps 0.9.3 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -10
- package/dist/agents-overview/panel.mjs +18 -1
- package/dist/agents-overview/panel.mjs.map +1 -1
- package/dist/agents-overview.mjs +18 -1
- package/dist/agents-overview.mjs.map +1 -1
- package/dist/bureau-sessions/panel.mjs +18 -1
- package/dist/bureau-sessions/panel.mjs.map +1 -1
- package/dist/bureau-sessions.mjs +18 -1
- package/dist/bureau-sessions.mjs.map +1 -1
- package/dist/index.d.ts +8 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +777 -2
- package/dist/index.mjs.map +1 -1
- package/dist/live-session/panel.mjs +18 -1
- package/dist/live-session/panel.mjs.map +1 -1
- package/dist/live-session.mjs +18 -1
- package/dist/live-session.mjs.map +1 -1
- package/dist/mcp-app-types.d.ts +4 -0
- package/dist/mcp-app-types.d.ts.map +1 -1
- package/dist/panel-bridge.d.ts +48 -0
- package/dist/panel-bridge.d.ts.map +1 -1
- package/dist/session-chat/index.d.ts +72 -0
- package/dist/session-chat/index.d.ts.map +1 -0
- package/dist/session-chat/panel.d.ts +28 -0
- package/dist/session-chat/panel.d.ts.map +1 -0
- package/dist/session-chat/panel.mjs +65 -0
- package/dist/session-chat/panel.mjs.map +1 -0
- package/dist/session-chat.mjs +113 -0
- package/dist/session-chat.mjs.map +1 -0
- package/dist/session-story/panel.mjs +18 -1
- package/dist/session-story/panel.mjs.map +1 -1
- package/dist/session-story.mjs +18 -1
- package/dist/session-story.mjs.map +1 -1
- package/dist/sessions-panel/panel.mjs +18 -1
- package/dist/sessions-panel/panel.mjs.map +1 -1
- package/dist/sessions-panel.mjs +18 -1
- package/dist/sessions-panel.mjs.map +1 -1
- package/dist/work-board/index.d.ts +67 -0
- package/dist/work-board/index.d.ts.map +1 -0
- package/dist/work-board/panel.d.ts +72 -0
- package/dist/work-board/panel.d.ts.map +1 -0
- package/dist/work-board/panel.generated.d.ts +13 -0
- package/dist/work-board/panel.generated.d.ts.map +1 -0
- package/dist/work-board/panel.mjs +637 -0
- package/dist/work-board/panel.mjs.map +1 -0
- package/dist/work-board.mjs +669 -0
- package/dist/work-board.mjs.map +1 -0
- package/package.json +32 -8
|
@@ -0,0 +1,637 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agentproto/apps v0.1.0
|
|
3
|
+
* Ready-made agentproto apps (teams of agents + workflows) built on app-kit.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// src/work-board/panel.generated.ts
|
|
7
|
+
var WORK_BOARD_HTML_GENERATED = `<!DOCTYPE html>
|
|
8
|
+
<html lang="en">
|
|
9
|
+
<head>
|
|
10
|
+
<meta charset="UTF-8" />
|
|
11
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
12
|
+
<title>agentproto work board</title>
|
|
13
|
+
<!-- PANEL_BRIDGE: replaced with the inline panelBridgeScript() output by
|
|
14
|
+
vite.config.ts's injectPanelBridge plugin \u2014 a classic (non-module)
|
|
15
|
+
script so its \`initBridge\`/\`callTool\` land as globals before the
|
|
16
|
+
deferred module script below runs. -->
|
|
17
|
+
<script>// \u2500\u2500 MCP Apps bridge (shared: panel-bridge.ts) \u2500\u2500
|
|
18
|
+
// JSON-RPC 2.0 over window.parent.postMessage \xB7 spec 2026-01-26
|
|
19
|
+
var _nextId = 1, _pending = {}, _notifyHandlers = [];
|
|
20
|
+
var _hostContext = null, _hostContextHandlers = [];
|
|
21
|
+
var _standaloneApp = null;
|
|
22
|
+
function _isStandalone(){
|
|
23
|
+
return window.parent === window && !!window.McpApp && typeof window.McpApp.connect === 'function';
|
|
24
|
+
}
|
|
25
|
+
function post(msg){ window.parent.postMessage(msg, '*'); }
|
|
26
|
+
function getHostContext(){ return _hostContext; }
|
|
27
|
+
function onHostContext(cb){
|
|
28
|
+
_hostContextHandlers.push(cb);
|
|
29
|
+
// Replay the last context so a late subscriber isn't stuck blind.
|
|
30
|
+
if (_hostContext){ try { cb(_hostContext); } catch(_) {} }
|
|
31
|
+
}
|
|
32
|
+
function _setHostContext(ctx){
|
|
33
|
+
if (!ctx || typeof ctx !== 'object') return;
|
|
34
|
+
// ui/notifications/host-context-changed carries only the changed keys \u2014
|
|
35
|
+
// merge, matching the official ext-apps App behaviour.
|
|
36
|
+
_hostContext = Object.assign({}, _hostContext || {}, ctx);
|
|
37
|
+
for (var i = 0; i < _hostContextHandlers.length; i++){
|
|
38
|
+
try { _hostContextHandlers[i](_hostContext); } catch(_) {}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function rpcRequest(method, params){
|
|
42
|
+
return new Promise(function(resolve, reject){
|
|
43
|
+
var id = _nextId++;
|
|
44
|
+
_pending[id] = {resolve: resolve, reject: reject};
|
|
45
|
+
post({jsonrpc: '2.0', id: id, method: method, params: params || {}});
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function rpcNotify(method, params){ post({jsonrpc: '2.0', method: method, params: params || {}}); }
|
|
49
|
+
function onHostNotification(cb){ _notifyHandlers.push(cb); }
|
|
50
|
+
window.addEventListener('message', function(evt){
|
|
51
|
+
var msg = evt.data;
|
|
52
|
+
if (!msg || typeof msg !== 'object' || msg.jsonrpc !== '2.0') return;
|
|
53
|
+
if (msg.id != null && msg.method == null){
|
|
54
|
+
var p = _pending[msg.id];
|
|
55
|
+
if (!p) return;
|
|
56
|
+
delete _pending[msg.id];
|
|
57
|
+
if (msg.error) p.reject(new Error(msg.error.message || ('rpc error ' + msg.error.code)));
|
|
58
|
+
else p.resolve(msg.result);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (msg.method){
|
|
62
|
+
if (msg.method === 'ui/notifications/host-context-changed'){
|
|
63
|
+
_setHostContext(msg.params || {});
|
|
64
|
+
}
|
|
65
|
+
for (var i = 0; i < _notifyHandlers.length; i++){
|
|
66
|
+
try { _notifyHandlers[i](msg.method, msg.params || {}); } catch(_) {}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
function initBridge(){
|
|
71
|
+
if (_isStandalone()){
|
|
72
|
+
return window.McpApp.connect().then(function(conn){
|
|
73
|
+
_standaloneApp = conn;
|
|
74
|
+
// No host to advertise a hostContext \u2014 default to inline with no
|
|
75
|
+
// other modes available, which keeps the #dm/#pin toggle buttons
|
|
76
|
+
// hidden (they only show for modes hostContext.availableDisplayModes
|
|
77
|
+
// lists) instead of rendering two buttons with nothing to switch to.
|
|
78
|
+
_setHostContext({displayMode: 'inline', availableDisplayModes: []});
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return rpcRequest('ui/initialize', {
|
|
82
|
+
appInfo: {name: "agentproto-work-board-panel", version: '0.1.0'},
|
|
83
|
+
appCapabilities: {availableDisplayModes: ['inline', 'fullscreen', 'pip']},
|
|
84
|
+
protocolVersion: '2026-01-26'
|
|
85
|
+
}).then(function(result){
|
|
86
|
+
// The initialize result carries the initial hostContext (displayMode +
|
|
87
|
+
// availableDisplayModes) \u2014 capture it before notifying the host.
|
|
88
|
+
if (result && result.hostContext) _setHostContext(result.hostContext);
|
|
89
|
+
rpcNotify('ui/notifications/initialized', {});
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function requestDisplayMode(mode){
|
|
93
|
+
return rpcRequest('ui/request-display-mode', {mode: mode});
|
|
94
|
+
}
|
|
95
|
+
function callTool(name, args){
|
|
96
|
+
var raw = _standaloneApp
|
|
97
|
+
? _standaloneApp.callTool(name, args || {})
|
|
98
|
+
: rpcRequest('tools/call', {name: name, arguments: args || {}});
|
|
99
|
+
return raw.then(function(result){
|
|
100
|
+
if (result.isError){
|
|
101
|
+
var e = (result.content && result.content[0] && result.content[0].text) || 'tool error';
|
|
102
|
+
throw new Error(e);
|
|
103
|
+
}
|
|
104
|
+
var text = (result.content && result.content[0] && result.content[0].text) || '{}';
|
|
105
|
+
return JSON.parse(text);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// \u2500\u2500 Display-mode toggle buttons (NO auto-request) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
110
|
+
// Injected by the shared bridge so every panel gets them without touching
|
|
111
|
+
// its own markup. Mirrors guilde canvas.app.ts canvasShellHtml(): the
|
|
112
|
+
// panel stays inline by default; the user expands on demand. Buttons only
|
|
113
|
+
// appear for modes the host advertises in hostContext.availableDisplayModes.
|
|
114
|
+
(function(){
|
|
115
|
+
function mount(){
|
|
116
|
+
var style = document.createElement('style');
|
|
117
|
+
style.textContent = '#dm,#pin{display:none;position:fixed;top:8px;z-index:10;'
|
|
118
|
+
+ 'border:1px solid #d0d0d0;background:#fff;color:#1a1a1a;'
|
|
119
|
+
+ 'font:600 13px/1 system-ui,sans-serif;padding:7px 12px;border-radius:6px;'
|
|
120
|
+
+ 'cursor:pointer;box-shadow:0 1px 4px rgba(0,0,0,.18)}'
|
|
121
|
+
+ '#dm{right:8px}#pin{right:118px}'
|
|
122
|
+
+ '#dm:hover,#pin:hover{background:#f2f2f2;border-color:#b0b0b0}'
|
|
123
|
+
+ '@media (prefers-color-scheme:dark){'
|
|
124
|
+
+ '#dm,#pin{border-color:#555;background:#2a2a2a;color:#f0f0f0;box-shadow:0 1px 4px rgba(0,0,0,.5)}'
|
|
125
|
+
+ '#dm:hover,#pin:hover{background:#333;border-color:#777}}';
|
|
126
|
+
document.head.appendChild(style);
|
|
127
|
+
|
|
128
|
+
var btn = document.createElement('button');
|
|
129
|
+
btn.id = 'dm'; btn.type = 'button'; btn.title = "Basculer l'affichage";
|
|
130
|
+
var pin = document.createElement('button');
|
|
131
|
+
pin.id = 'pin'; pin.type = 'button'; pin.title = '\xC9pingler sur le c\xF4t\xE9 (pip)';
|
|
132
|
+
document.body.appendChild(pin);
|
|
133
|
+
document.body.appendChild(btn);
|
|
134
|
+
|
|
135
|
+
function has(avail, m){ return !!avail && avail.indexOf(m) >= 0; }
|
|
136
|
+
|
|
137
|
+
// Re-sync button visibility + label from the current host context.
|
|
138
|
+
function syncBtn(ctx){
|
|
139
|
+
ctx = ctx || {};
|
|
140
|
+
var avail = ctx.availableDisplayModes;
|
|
141
|
+
// Diagnostic: what does THIS host actually advertise? (inline/fullscreen/pip)
|
|
142
|
+
console.log('[mcp-app] displayMode=', ctx.displayMode,
|
|
143
|
+
'availableDisplayModes=', avail);
|
|
144
|
+
|
|
145
|
+
// Fullscreen toggle button.
|
|
146
|
+
if (has(avail, 'fullscreen')){
|
|
147
|
+
btn.style.display = 'block';
|
|
148
|
+
btn.textContent = (ctx.displayMode === 'fullscreen') ? '\u2921 R\xE9duire' : '\u2922 Agrandir';
|
|
149
|
+
} else { btn.style.display = 'none'; }
|
|
150
|
+
|
|
151
|
+
// Dedicated pip ("pinned on side") button \u2014 only if the host advertises pip.
|
|
152
|
+
if (has(avail, 'pip')){
|
|
153
|
+
pin.style.display = 'block';
|
|
154
|
+
pin.textContent = (ctx.displayMode === 'pip') ? '\u2921 D\xE9tacher' : '\u{1F4CC} \xC9pingler';
|
|
155
|
+
} else { pin.style.display = 'none'; }
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
onHostContext(syncBtn);
|
|
159
|
+
|
|
160
|
+
btn.addEventListener('click', function(){
|
|
161
|
+
var ctx = getHostContext() || {};
|
|
162
|
+
var inPanel = (ctx.displayMode === 'fullscreen' || ctx.displayMode === 'pip');
|
|
163
|
+
requestDisplayMode(inPanel ? 'inline' : 'fullscreen').catch(function(){});
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
pin.addEventListener('click', function(){
|
|
167
|
+
var ctx = getHostContext() || {};
|
|
168
|
+
requestDisplayMode(ctx.displayMode === 'pip' ? 'inline' : 'pip').catch(function(){});
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
if (document.body) mount();
|
|
172
|
+
else document.addEventListener('DOMContentLoaded', mount);
|
|
173
|
+
})();</script>
|
|
174
|
+
<script>(function() {
|
|
175
|
+
"use strict";
|
|
176
|
+
const COLUMN_STATUSES = ["pending", "in_progress", "done", "failed"];
|
|
177
|
+
const COLUMN_LABELS = {
|
|
178
|
+
pending: "Pending",
|
|
179
|
+
in_progress: "In Progress",
|
|
180
|
+
done: "Done",
|
|
181
|
+
failed: "Failed"
|
|
182
|
+
};
|
|
183
|
+
function esc(value) {
|
|
184
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
185
|
+
}
|
|
186
|
+
function columnOf(status) {
|
|
187
|
+
return status === "cancelled" ? "failed" : status;
|
|
188
|
+
}
|
|
189
|
+
function verificationTag(task) {
|
|
190
|
+
const v = task.verification;
|
|
191
|
+
if (v) {
|
|
192
|
+
if (v.kind === "gate") return '<span class="tag t-gate">✓ gate</span>';
|
|
193
|
+
if (v.kind === "self-report") return '<span class="tag t-self">self-report</span>';
|
|
194
|
+
if (v.kind === "human") return '<span class="tag t-human">human</span>';
|
|
195
|
+
}
|
|
196
|
+
if (task.status === "in_progress" && task.verify) {
|
|
197
|
+
return '<span class="tag t-gated">gated</span>';
|
|
198
|
+
}
|
|
199
|
+
return "";
|
|
200
|
+
}
|
|
201
|
+
function ownerTag(task) {
|
|
202
|
+
if (!task.owner) return '<span class="tag t-unclaimed">Unclaimed</span>';
|
|
203
|
+
return \`<span class="tag t-owner">\${esc(task.owner)}</span>\`;
|
|
204
|
+
}
|
|
205
|
+
function actionsFor(task) {
|
|
206
|
+
if (task.status === "pending") {
|
|
207
|
+
return [
|
|
208
|
+
task.owner ? { label: "Start", action: "start", cls: "primary" } : { label: "Claim", action: "claim", cls: "primary" },
|
|
209
|
+
{ label: "Cancel", action: "cancel", cls: "danger" }
|
|
210
|
+
];
|
|
211
|
+
}
|
|
212
|
+
if (task.status === "in_progress") {
|
|
213
|
+
return [
|
|
214
|
+
{ label: "Done", action: "done", cls: "primary" },
|
|
215
|
+
{ label: "Fail", action: "fail", cls: "danger" },
|
|
216
|
+
{ label: "Release", action: "release", cls: "" },
|
|
217
|
+
{ label: "Cancel", action: "cancel", cls: "danger" }
|
|
218
|
+
];
|
|
219
|
+
}
|
|
220
|
+
if (task.status === "done") {
|
|
221
|
+
return [{ label: "Reopen", action: "reopen", cls: "" }];
|
|
222
|
+
}
|
|
223
|
+
return [];
|
|
224
|
+
}
|
|
225
|
+
function renderCard(task) {
|
|
226
|
+
let html = \`<div class="card" data-taskid="\${esc(task.taskId)}">\`;
|
|
227
|
+
html += \`<div class="c-title">\${esc(task.title)}</div>\`;
|
|
228
|
+
html += \`<div class="c-id">#\${esc(task.taskId)}</div>\`;
|
|
229
|
+
html += \`<div class="c-row">\${ownerTag(task)}\${verificationTag(task)}\`;
|
|
230
|
+
if (task.status === "cancelled") html += '<span class="tag t-cancelled">cancelled</span>';
|
|
231
|
+
html += "</div>";
|
|
232
|
+
if (task.lastVerifyError) {
|
|
233
|
+
html += \`<div class="c-err">verify failed: \${esc(task.lastVerifyError)}</div>\`;
|
|
234
|
+
}
|
|
235
|
+
const actions = actionsFor(task);
|
|
236
|
+
if (actions.length > 0) {
|
|
237
|
+
html += '<div class="c-actions">';
|
|
238
|
+
for (const a of actions) {
|
|
239
|
+
html += \`<button class="abtn \${a.cls}" data-taskid="\${esc(task.taskId)}" data-action="\${a.action}">\${a.label}</button>\`;
|
|
240
|
+
}
|
|
241
|
+
html += "</div>";
|
|
242
|
+
}
|
|
243
|
+
html += "</div>";
|
|
244
|
+
return html;
|
|
245
|
+
}
|
|
246
|
+
function renderColumns(tasks2) {
|
|
247
|
+
let html = "";
|
|
248
|
+
for (const status of COLUMN_STATUSES) {
|
|
249
|
+
const rows = tasks2.filter((t) => columnOf(t.status) === status);
|
|
250
|
+
html += \`<div class="col"><div class="col-hdr"><span>\${COLUMN_LABELS[status]}</span><span>\${rows.length}</span></div><div class="col-body">\`;
|
|
251
|
+
html += rows.length === 0 ? '<div class="empty">No tasks</div>' : rows.map(renderCard).join("");
|
|
252
|
+
html += "</div></div>";
|
|
253
|
+
}
|
|
254
|
+
return html;
|
|
255
|
+
}
|
|
256
|
+
function getEl(id) {
|
|
257
|
+
const el = document.getElementById(id);
|
|
258
|
+
if (!el) throw new Error(\`work board: missing #\${id}\`);
|
|
259
|
+
return el;
|
|
260
|
+
}
|
|
261
|
+
function getInput(id) {
|
|
262
|
+
const el = document.getElementById(id);
|
|
263
|
+
if (!(el instanceof HTMLInputElement)) throw new Error(\`work board: missing input #\${id}\`);
|
|
264
|
+
return el;
|
|
265
|
+
}
|
|
266
|
+
function isCardAction(value) {
|
|
267
|
+
switch (value) {
|
|
268
|
+
case "claim":
|
|
269
|
+
case "start":
|
|
270
|
+
case "done":
|
|
271
|
+
case "fail":
|
|
272
|
+
case "release":
|
|
273
|
+
case "cancel":
|
|
274
|
+
case "reopen":
|
|
275
|
+
return true;
|
|
276
|
+
default:
|
|
277
|
+
return false;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
let boardId = null;
|
|
281
|
+
let tasks = [];
|
|
282
|
+
let pollActive = false;
|
|
283
|
+
function boot() {
|
|
284
|
+
const columnsEl = getEl("columns");
|
|
285
|
+
const statusbarEl = getEl("statusbar");
|
|
286
|
+
const boardIdEl = getEl("board-id");
|
|
287
|
+
const boardInputEl = getInput("board-input");
|
|
288
|
+
const newTitleEl = getInput("new-title");
|
|
289
|
+
function setStatus(msg) {
|
|
290
|
+
statusbarEl.textContent = msg;
|
|
291
|
+
}
|
|
292
|
+
function render() {
|
|
293
|
+
boardIdEl.textContent = boardId ?? "\u2014";
|
|
294
|
+
if (!boardInputEl.value) boardInputEl.value = boardId ?? "";
|
|
295
|
+
columnsEl.innerHTML = renderColumns(tasks);
|
|
296
|
+
}
|
|
297
|
+
function findTask(taskId) {
|
|
298
|
+
return tasks.find((t) => t.taskId === taskId);
|
|
299
|
+
}
|
|
300
|
+
function loadBoard() {
|
|
301
|
+
const args = {
|
|
302
|
+
includeClosed: true,
|
|
303
|
+
full: true,
|
|
304
|
+
...boardId ? { boardId } : {}
|
|
305
|
+
};
|
|
306
|
+
return callTool("task_list", args).then((data) => {
|
|
307
|
+
boardId = data.boardId ?? boardId;
|
|
308
|
+
tasks = data.tasks ?? [];
|
|
309
|
+
render();
|
|
310
|
+
setStatus(\`\${tasks.length} task\${tasks.length === 1 ? "" : "s"} \xB7 \${(/* @__PURE__ */ new Date()).toLocaleTimeString()}\`);
|
|
311
|
+
}).catch((e) => {
|
|
312
|
+
setStatus(\`Error: \${e.message}\`);
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
function applyAction(taskId, action) {
|
|
316
|
+
const task = findTask(taskId);
|
|
317
|
+
if (!task) return;
|
|
318
|
+
const base = { taskId: task.taskId, rev: task.rev };
|
|
319
|
+
let promise;
|
|
320
|
+
if (action === "claim") {
|
|
321
|
+
promise = callTool("task_claim", base);
|
|
322
|
+
} else if (action === "start") {
|
|
323
|
+
promise = callTool("task_update", { ...base, status: "in_progress" });
|
|
324
|
+
} else if (action === "done") {
|
|
325
|
+
promise = callTool("task_update", { ...base, status: "done" });
|
|
326
|
+
} else if (action === "fail") {
|
|
327
|
+
promise = callTool("task_update", { ...base, status: "failed" });
|
|
328
|
+
} else if (action === "release") {
|
|
329
|
+
promise = callTool("task_update", { ...base, owner: null });
|
|
330
|
+
} else if (action === "cancel") {
|
|
331
|
+
promise = callTool("task_update", { ...base, status: "cancelled" });
|
|
332
|
+
} else {
|
|
333
|
+
promise = callTool("task_update", { ...base, status: "pending" });
|
|
334
|
+
}
|
|
335
|
+
promise.then((result) => {
|
|
336
|
+
if ("conflict" in result) {
|
|
337
|
+
setStatus(\`Someone else moved "\${task.title}" first \u2014 refreshed.\`);
|
|
338
|
+
} else if ("error" in result) {
|
|
339
|
+
setStatus(\`Action failed: \${result.error}\`);
|
|
340
|
+
} else {
|
|
341
|
+
setStatus(\`Updated "\${task.title}".\`);
|
|
342
|
+
}
|
|
343
|
+
return loadBoard();
|
|
344
|
+
}).catch((e) => {
|
|
345
|
+
setStatus(\`Action failed: \${e.message}\`);
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
function doPoll() {
|
|
349
|
+
if (pollActive) return;
|
|
350
|
+
pollActive = true;
|
|
351
|
+
loadBoard().finally(() => {
|
|
352
|
+
pollActive = false;
|
|
353
|
+
setTimeout(doPoll, 4e3);
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
columnsEl.addEventListener("click", (evt) => {
|
|
357
|
+
if (!(evt.target instanceof Element)) return;
|
|
358
|
+
const btn = evt.target.closest("button[data-action]");
|
|
359
|
+
if (!(btn instanceof HTMLButtonElement)) return;
|
|
360
|
+
const taskId = btn.getAttribute("data-taskid");
|
|
361
|
+
const action = btn.getAttribute("data-action");
|
|
362
|
+
if (!taskId || !action || !isCardAction(action)) return;
|
|
363
|
+
applyAction(taskId, action);
|
|
364
|
+
});
|
|
365
|
+
getEl("refresh-btn").addEventListener("click", () => {
|
|
366
|
+
void loadBoard();
|
|
367
|
+
});
|
|
368
|
+
getEl("go-btn").addEventListener("click", () => {
|
|
369
|
+
const value = boardInputEl.value.trim();
|
|
370
|
+
if (!value) return;
|
|
371
|
+
boardId = value;
|
|
372
|
+
void loadBoard();
|
|
373
|
+
});
|
|
374
|
+
getEl("add-btn").addEventListener("click", () => {
|
|
375
|
+
const title = newTitleEl.value.trim();
|
|
376
|
+
if (!title) return;
|
|
377
|
+
const args = boardId ? { title, boardId } : { title };
|
|
378
|
+
callTool("task_create", args).then((result) => {
|
|
379
|
+
if (result.error) {
|
|
380
|
+
setStatus(\`Create failed: \${result.error}\`);
|
|
381
|
+
return void 0;
|
|
382
|
+
}
|
|
383
|
+
newTitleEl.value = "";
|
|
384
|
+
setStatus(\`Created "\${title}".\`);
|
|
385
|
+
return loadBoard();
|
|
386
|
+
}).catch((e) => {
|
|
387
|
+
setStatus(\`Create failed: \${e.message}\`);
|
|
388
|
+
});
|
|
389
|
+
});
|
|
390
|
+
initBridge().then(() => loadBoard()).then(() => {
|
|
391
|
+
setTimeout(doPoll, 4e3);
|
|
392
|
+
}).catch((e) => {
|
|
393
|
+
setStatus(\`Bridge error: \${e.message}\`);
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
if (document.readyState === "loading") {
|
|
397
|
+
document.addEventListener("DOMContentLoaded", boot);
|
|
398
|
+
} else {
|
|
399
|
+
boot();
|
|
400
|
+
}
|
|
401
|
+
})();</script>
|
|
402
|
+
<style rel="stylesheet" crossorigin>/* \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
403
|
+
Semantic tokens + runtime mapping sheets.
|
|
404
|
+
|
|
405
|
+
Every rule below the next section reads ONLY the --wb-* custom
|
|
406
|
+
properties. Each one resolves through TWO mapping sheets, chosen at
|
|
407
|
+
PAINT time via plain CSS var() fallback \u2014 no build step, no JS, so a
|
|
408
|
+
host that swaps its theme live (VS Code) is never frozen at whatever
|
|
409
|
+
theme happened to be active when this bundle was built:
|
|
410
|
+
|
|
411
|
+
1. embedded \u2014 VS Code injects a live --vscode-* custom-property set
|
|
412
|
+
into the webview and swaps it on theme change. Whenever the
|
|
413
|
+
relevant --vscode-* variable exists, it wins \u2014 in a VS Code
|
|
414
|
+
\`srcdoc\` relay panel AND (structurally identically) any other host
|
|
415
|
+
that happened to expose the same names, though none is known to.
|
|
416
|
+
2. standalone \u2014 the agentproto brand tokens (see
|
|
417
|
+
projects/agentproto/site/src/app/brand.css), used whenever no
|
|
418
|
+
--vscode-* variable is set \u2014 a plain MCP-Apps host or the daemon's
|
|
419
|
+
own \`/apps/.../ui\` tab. \`--phos\`/\`--amber\`/\`--crimson\` are
|
|
420
|
+
THEME-INVARIANT in brand.css (the phosphor terminal palette), so
|
|
421
|
+
they're identical in both blocks below; the rest follow brand.css's
|
|
422
|
+
light/dark split via \`prefers-color-scheme\` \u2014 a standalone tab has
|
|
423
|
+
no host to pick a theme for it, unlike VS Code's own.
|
|
424
|
+
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 */
|
|
425
|
+
|
|
426
|
+
:root {
|
|
427
|
+
--wb-bg: var(--vscode-editor-background, #f5f6f3);
|
|
428
|
+
--wb-surface: var(--vscode-sideBar-background, #ffffff);
|
|
429
|
+
--wb-ink: var(--vscode-editor-foreground, #171a1e);
|
|
430
|
+
--wb-ink-muted: var(--vscode-descriptionForeground, #5c6470);
|
|
431
|
+
--wb-border: var(--vscode-panel-border, #dde0da);
|
|
432
|
+
--wb-accent: var(--vscode-button-background, #0f62fe);
|
|
433
|
+
|
|
434
|
+
/* Status colors \u2014 phos/amber/crimson are the theme-invariant terminal
|
|
435
|
+
palette in brand.css, so light and dark standalone fallbacks match. */
|
|
436
|
+
--wb-status-pending: var(--vscode-descriptionForeground, #5c6470);
|
|
437
|
+
--wb-status-in-progress: var(--vscode-charts-yellow, #f0b429);
|
|
438
|
+
--wb-status-done: var(--vscode-charts-green, #3edc81);
|
|
439
|
+
--wb-status-failed: var(--vscode-charts-red, #fa4d56);
|
|
440
|
+
--wb-status-cancelled: var(--vscode-descriptionForeground, #5c6470);
|
|
441
|
+
--wb-status-cancelled-weak: color-mix(in srgb, var(--wb-status-cancelled) 55%, transparent);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
@media (prefers-color-scheme: dark) {
|
|
445
|
+
:root {
|
|
446
|
+
--wb-bg: var(--vscode-editor-background, #101214);
|
|
447
|
+
--wb-surface: var(--vscode-sideBar-background, #16191d);
|
|
448
|
+
--wb-ink: var(--vscode-editor-foreground, #e8eaed);
|
|
449
|
+
--wb-ink-muted: var(--vscode-descriptionForeground, #99a2ad);
|
|
450
|
+
--wb-border: var(--vscode-panel-border, #272c33);
|
|
451
|
+
--wb-accent: var(--vscode-button-background, #4589ff);
|
|
452
|
+
|
|
453
|
+
--wb-status-pending: var(--vscode-descriptionForeground, #99a2ad);
|
|
454
|
+
--wb-status-in-progress: var(--vscode-charts-yellow, #f0b429);
|
|
455
|
+
--wb-status-done: var(--vscode-charts-green, #3edc81);
|
|
456
|
+
--wb-status-failed: var(--vscode-charts-red, #fa4d56);
|
|
457
|
+
--wb-status-cancelled: var(--vscode-descriptionForeground, #99a2ad);
|
|
458
|
+
--wb-status-cancelled-weak: color-mix(in srgb, var(--wb-status-cancelled) 55%, transparent);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/* \u2500\u2500 Base \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
463
|
+
|
|
464
|
+
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
465
|
+
|
|
466
|
+
html, body {
|
|
467
|
+
height: 100%;
|
|
468
|
+
font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
469
|
+
font-size: 13px;
|
|
470
|
+
background: var(--wb-bg);
|
|
471
|
+
color: var(--wb-ink);
|
|
472
|
+
overflow: hidden;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
.mono {
|
|
476
|
+
font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, "Courier New", monospace;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
#app { display: flex; flex-direction: column; height: 100%; }
|
|
480
|
+
|
|
481
|
+
#toolbar {
|
|
482
|
+
padding: 8px 12px;
|
|
483
|
+
border-bottom: 1px solid var(--wb-border);
|
|
484
|
+
display: flex;
|
|
485
|
+
align-items: center;
|
|
486
|
+
gap: 8px;
|
|
487
|
+
background: var(--wb-surface);
|
|
488
|
+
flex-shrink: 0;
|
|
489
|
+
}
|
|
490
|
+
#board-label { font-size: 11px; color: var(--wb-ink-muted); }
|
|
491
|
+
#board-id { font-weight: 600; color: var(--wb-ink); font-size: 12px; font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, "Courier New", monospace; }
|
|
492
|
+
#board-input {
|
|
493
|
+
background: var(--wb-bg);
|
|
494
|
+
border: 1px solid var(--wb-border);
|
|
495
|
+
color: var(--wb-ink);
|
|
496
|
+
padding: 4px 8px;
|
|
497
|
+
border-radius: 4px;
|
|
498
|
+
font-size: 12px;
|
|
499
|
+
font-family: inherit;
|
|
500
|
+
width: 220px;
|
|
501
|
+
}
|
|
502
|
+
.tbtn {
|
|
503
|
+
background: var(--wb-bg);
|
|
504
|
+
border: 1px solid var(--wb-border);
|
|
505
|
+
color: var(--wb-ink);
|
|
506
|
+
padding: 4px 10px;
|
|
507
|
+
border-radius: 4px;
|
|
508
|
+
cursor: pointer;
|
|
509
|
+
font-size: 12px;
|
|
510
|
+
font-family: inherit;
|
|
511
|
+
}
|
|
512
|
+
.tbtn:hover { background: var(--wb-border); }
|
|
513
|
+
#new-title {
|
|
514
|
+
flex: 1;
|
|
515
|
+
min-width: 120px;
|
|
516
|
+
background: var(--wb-bg);
|
|
517
|
+
border: 1px solid var(--wb-border);
|
|
518
|
+
color: var(--wb-ink);
|
|
519
|
+
padding: 4px 8px;
|
|
520
|
+
border-radius: 4px;
|
|
521
|
+
font-size: 12px;
|
|
522
|
+
font-family: inherit;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
#columns { flex: 1; display: flex; overflow-x: auto; overflow-y: hidden; }
|
|
526
|
+
.col {
|
|
527
|
+
width: 260px;
|
|
528
|
+
min-width: 220px;
|
|
529
|
+
flex-shrink: 0;
|
|
530
|
+
display: flex;
|
|
531
|
+
flex-direction: column;
|
|
532
|
+
border-right: 1px solid var(--wb-border);
|
|
533
|
+
}
|
|
534
|
+
.col-hdr {
|
|
535
|
+
padding: 8px 10px;
|
|
536
|
+
border-bottom: 1px solid var(--wb-border);
|
|
537
|
+
background: var(--wb-surface);
|
|
538
|
+
font-size: 11px;
|
|
539
|
+
font-weight: 600;
|
|
540
|
+
color: var(--wb-ink-muted);
|
|
541
|
+
text-transform: uppercase;
|
|
542
|
+
letter-spacing: 0.05em;
|
|
543
|
+
display: flex;
|
|
544
|
+
justify-content: space-between;
|
|
545
|
+
}
|
|
546
|
+
.col-body { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
|
|
547
|
+
|
|
548
|
+
.card {
|
|
549
|
+
background: var(--wb-surface);
|
|
550
|
+
border: 1px solid var(--wb-border);
|
|
551
|
+
border-radius: 6px;
|
|
552
|
+
padding: 8px 10px;
|
|
553
|
+
}
|
|
554
|
+
.c-title { font-size: 12px; font-weight: 500; margin-bottom: 4px; word-break: break-word; }
|
|
555
|
+
.c-id {
|
|
556
|
+
font-size: 10px;
|
|
557
|
+
color: var(--wb-ink-muted);
|
|
558
|
+
margin-bottom: 6px;
|
|
559
|
+
font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, "Courier New", monospace;
|
|
560
|
+
}
|
|
561
|
+
.c-row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-bottom: 6px; }
|
|
562
|
+
|
|
563
|
+
.tag { display: inline-block; padding: 1px 6px; border-radius: 10px; font-size: 10px; font-weight: 600; white-space: nowrap; }
|
|
564
|
+
.t-unclaimed { background: color-mix(in srgb, var(--wb-ink-muted) 15%, transparent); color: var(--wb-ink-muted); border: 1px dashed var(--wb-ink-muted); }
|
|
565
|
+
.t-owner { background: color-mix(in srgb, var(--wb-accent) 15%, transparent); color: var(--wb-accent); }
|
|
566
|
+
|
|
567
|
+
/* Verification tell: gate solid green, self-report amber outline, human
|
|
568
|
+
blue, a declared verify with no verification yet grey "gated" \u2014 never
|
|
569
|
+
render an unverified done as gate-passed (see render.ts's verificationTag). */
|
|
570
|
+
.t-gate { background: color-mix(in srgb, var(--wb-status-done) 18%, transparent); color: var(--wb-status-done); }
|
|
571
|
+
.t-self { background: transparent; color: var(--wb-status-in-progress); border: 1px solid var(--wb-status-in-progress); }
|
|
572
|
+
.t-human { background: color-mix(in srgb, var(--wb-accent) 18%, transparent); color: var(--wb-accent); }
|
|
573
|
+
.t-gated { background: color-mix(in srgb, var(--wb-ink-muted) 12%, transparent); color: var(--wb-ink-muted); }
|
|
574
|
+
.t-cancelled {
|
|
575
|
+
background: color-mix(in srgb, var(--wb-status-cancelled) 10%, transparent);
|
|
576
|
+
color: var(--wb-status-cancelled-weak);
|
|
577
|
+
border: 1px dashed color-mix(in srgb, var(--wb-status-cancelled) 40%, transparent);
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
.c-err { font-size: 10px; color: var(--wb-status-failed); margin-bottom: 6px; word-break: break-word; }
|
|
581
|
+
.c-actions { display: flex; flex-wrap: wrap; gap: 4px; }
|
|
582
|
+
.abtn {
|
|
583
|
+
background: var(--wb-bg);
|
|
584
|
+
border: 1px solid var(--wb-border);
|
|
585
|
+
color: var(--wb-ink);
|
|
586
|
+
padding: 3px 8px;
|
|
587
|
+
border-radius: 4px;
|
|
588
|
+
cursor: pointer;
|
|
589
|
+
font-size: 11px;
|
|
590
|
+
font-family: inherit;
|
|
591
|
+
}
|
|
592
|
+
.abtn:hover { background: var(--wb-border); }
|
|
593
|
+
.abtn.danger { border-color: var(--wb-status-failed); color: var(--wb-status-failed); }
|
|
594
|
+
.abtn.primary { border-color: var(--wb-status-done); color: var(--wb-status-done); }
|
|
595
|
+
|
|
596
|
+
#statusbar {
|
|
597
|
+
padding: 4px 12px;
|
|
598
|
+
font-size: 11px;
|
|
599
|
+
color: var(--wb-ink-muted);
|
|
600
|
+
border-top: 1px solid var(--wb-border);
|
|
601
|
+
background: var(--wb-surface);
|
|
602
|
+
flex-shrink: 0;
|
|
603
|
+
}
|
|
604
|
+
.empty { padding: 16px 8px; color: var(--wb-ink-muted); font-size: 11px; text-align: center; }</style>
|
|
605
|
+
</head>
|
|
606
|
+
<body>
|
|
607
|
+
<div id="app">
|
|
608
|
+
<div id="toolbar">
|
|
609
|
+
<span id="board-label">Board:</span>
|
|
610
|
+
<span id="board-id">\u2014</span>
|
|
611
|
+
<input id="board-input" type="text" placeholder="tree:<sessionId> or ws:<slug>">
|
|
612
|
+
<button class="tbtn" id="go-btn">Go</button>
|
|
613
|
+
<button class="tbtn" id="refresh-btn" title="Refresh">↻</button>
|
|
614
|
+
<input id="new-title" type="text" placeholder="New task title…">
|
|
615
|
+
<button class="tbtn" id="add-btn">+ Add</button>
|
|
616
|
+
</div>
|
|
617
|
+
<div id="columns"></div>
|
|
618
|
+
<div id="statusbar">Connecting to bridge…</div>
|
|
619
|
+
</div>
|
|
620
|
+
</body>
|
|
621
|
+
</html>
|
|
622
|
+
`;
|
|
623
|
+
|
|
624
|
+
// src/work-board/panel.ts
|
|
625
|
+
var WORK_BOARD_APP_ID = "@agentproto/work-board";
|
|
626
|
+
var WORK_BOARD_TOOL_ID = "agentproto_work_board";
|
|
627
|
+
var WORK_BOARD_UI_TOOLS = [
|
|
628
|
+
"task_list",
|
|
629
|
+
"task_claim",
|
|
630
|
+
"task_update",
|
|
631
|
+
"task_create"
|
|
632
|
+
];
|
|
633
|
+
var WORK_BOARD_HTML = WORK_BOARD_HTML_GENERATED;
|
|
634
|
+
|
|
635
|
+
export { WORK_BOARD_APP_ID, WORK_BOARD_HTML, WORK_BOARD_TOOL_ID, WORK_BOARD_UI_TOOLS };
|
|
636
|
+
//# sourceMappingURL=panel.mjs.map
|
|
637
|
+
//# sourceMappingURL=panel.mjs.map
|