@agentproto/apps 0.10.0 → 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.
@@ -3,12 +3,25 @@
3
3
  * Ready-made agentproto apps (teams of agents + workflows) built on app-kit.
4
4
  */
5
5
 
6
- // src/panel-bridge.ts
7
- function panelBridgeScript(appName) {
8
- return `// \u2500\u2500 MCP Apps bridge (shared: panel-bridge.ts) \u2500\u2500
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
9
18
  // JSON-RPC 2.0 over window.parent.postMessage \xB7 spec 2026-01-26
10
19
  var _nextId = 1, _pending = {}, _notifyHandlers = [];
11
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
+ }
12
25
  function post(msg){ window.parent.postMessage(msg, '*'); }
13
26
  function getHostContext(){ return _hostContext; }
14
27
  function onHostContext(cb){
@@ -55,8 +68,18 @@ window.addEventListener('message', function(evt){
55
68
  }
56
69
  });
57
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
+ }
58
81
  return rpcRequest('ui/initialize', {
59
- appInfo: {name: ${JSON.stringify(appName)}, version: '0.1.0'},
82
+ appInfo: {name: "agentproto-work-board-panel", version: '0.1.0'},
60
83
  appCapabilities: {availableDisplayModes: ['inline', 'fullscreen', 'pip']},
61
84
  protocolVersion: '2026-01-26'
62
85
  }).then(function(result){
@@ -70,7 +93,10 @@ function requestDisplayMode(mode){
70
93
  return rpcRequest('ui/request-display-mode', {mode: mode});
71
94
  }
72
95
  function callTool(name, args){
73
- return rpcRequest('tools/call', {name: name, arguments: args || {}}).then(function(result){
96
+ var raw = _standaloneApp
97
+ ? _standaloneApp.callTool(name, args || {})
98
+ : rpcRequest('tools/call', {name: name, arguments: args || {}});
99
+ return raw.then(function(result){
74
100
  if (result.isError){
75
101
  var e = (result.content && result.content[0] && result.content[0].text) || 'tool error';
76
102
  throw new Error(e);
@@ -144,321 +170,468 @@ function callTool(name, args){
144
170
  }
145
171
  if (document.body) mount();
146
172
  else document.addEventListener('DOMContentLoaded', mount);
147
- })();`;
148
- }
149
-
150
- // src/work-board/panel.ts
151
- var WORK_BOARD_HTML = `<!DOCTYPE html>
152
- <html lang="en">
153
- <head>
154
- <meta charset="UTF-8">
155
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
156
- <title>agentproto work board</title>
157
- <style>
158
- *{box-sizing:border-box;margin:0;padding:0}
159
- :root{
160
- --bg:#0d1117;--bg2:#161b22;--bg3:#21262d;--border:#30363d;
161
- --text:#e6edf3;--text2:#8b949e;
162
- --green:#3fb950;--yellow:#d29922;--red:#f85149;--blue:#58a6ff;--purple:#bc8cff;
163
- }
164
- html,body{height:100%;font-family:Menlo,Monaco,'Courier New',monospace;font-size:13px;background:var(--bg);color:var(--text);overflow:hidden}
165
- #app{display:flex;flex-direction:column;height:100%}
166
- #toolbar{padding:8px 12px;border-bottom:1px solid var(--border);display:flex;align-items:center;gap:8px;background:var(--bg2);flex-shrink:0}
167
- #board-label{font-size:11px;color:var(--text2)}
168
- #board-id{font-weight:600;color:var(--text);font-size:12px}
169
- #board-input{background:var(--bg3);border:1px solid var(--border);color:var(--text);padding:4px 8px;border-radius:4px;font-size:12px;font-family:inherit;width:220px}
170
- .tbtn{background:var(--bg3);border:1px solid var(--border);color:var(--text);padding:4px 10px;border-radius:4px;cursor:pointer;font-size:12px;font-family:inherit}
171
- .tbtn:hover{background:var(--border)}
172
- #new-title{flex:1;min-width:120px;background:var(--bg3);border:1px solid var(--border);color:var(--text);padding:4px 8px;border-radius:4px;font-size:12px;font-family:inherit}
173
- #columns{flex:1;display:flex;overflow-x:auto;overflow-y:hidden}
174
- .col{width:260px;min-width:220px;flex-shrink:0;display:flex;flex-direction:column;border-right:1px solid var(--border)}
175
- .col-hdr{padding:8px 10px;border-bottom:1px solid var(--border);background:var(--bg2);font-size:11px;font-weight:600;color:var(--text2);text-transform:uppercase;letter-spacing:.05em;display:flex;justify-content:space-between}
176
- .col-body{flex:1;overflow-y:auto;padding:8px;display:flex;flex-direction:column;gap:8px}
177
- .card{background:var(--bg2);border:1px solid var(--border);border-radius:6px;padding:8px 10px}
178
- .c-title{font-size:12px;font-weight:500;margin-bottom:4px;word-break:break-word}
179
- .c-id{font-size:10px;color:var(--text2);margin-bottom:6px}
180
- .c-row{display:flex;flex-wrap:wrap;gap:4px;align-items:center;margin-bottom:6px}
181
- .tag{display:inline-block;padding:1px 6px;border-radius:10px;font-size:10px;font-weight:600;white-space:nowrap}
182
- .t-unclaimed{background:rgba(139,148,158,.15);color:var(--text2);border:1px dashed var(--text2)}
183
- .t-owner{background:rgba(88,166,255,.15);color:var(--blue)}
184
- .t-gate{background:rgba(63,185,80,.18);color:var(--green)}
185
- .t-self{background:rgba(210,153,34,.18);color:var(--yellow)}
186
- .t-human{background:rgba(88,166,255,.18);color:var(--blue)}
187
- .t-gated{background:rgba(139,148,158,.12);color:var(--text2)}
188
- .t-cancelled{background:rgba(139,148,158,.12);color:var(--text2)}
189
- .c-err{font-size:10px;color:var(--red);margin-bottom:6px;word-break:break-word}
190
- .c-actions{display:flex;flex-wrap:wrap;gap:4px}
191
- .abtn{background:var(--bg3);border:1px solid var(--border);color:var(--text);padding:3px 8px;border-radius:4px;cursor:pointer;font-size:11px;font-family:inherit}
192
- .abtn:hover{background:var(--border)}
193
- .abtn.danger{border-color:var(--red);color:var(--red)}
194
- .abtn.primary{border-color:var(--green);color:var(--green)}
195
- #statusbar{padding:4px 12px;font-size:11px;color:var(--text2);border-top:1px solid var(--border);background:var(--bg2);flex-shrink:0}
196
- .empty{padding:16px 8px;color:var(--text2);font-size:11px;text-align:center}
197
- </style>
198
- </head>
199
- <body>
200
- <div id="app">
201
- <div id="toolbar">
202
- <span id="board-label">Board:</span>
203
- <span id="board-id">\u2014</span>
204
- <input id="board-input" type="text" placeholder="tree:&lt;sessionId&gt; or ws:&lt;slug&gt;">
205
- <button class="tbtn" id="go-btn">Go</button>
206
- <button class="tbtn" id="refresh-btn" title="Refresh">&#8635;</button>
207
- <input id="new-title" type="text" placeholder="New task title&#8230;">
208
- <button class="tbtn" id="add-btn">+ Add</button>
209
- </div>
210
- <div id="columns"></div>
211
- <div id="statusbar">Connecting to bridge&#8230;</div>
212
- </div>
213
- <script>
214
- ${panelBridgeScript("agentproto-work-board-panel")}
215
-
216
- // ============================================================
217
- // State
218
- // ============================================================
219
-
220
- var COLUMNS = [
221
- {key: 'pending', label: 'Pending'},
222
- {key: 'in_progress', label: 'In Progress'},
223
- {key: 'done', label: 'Done'},
224
- {key: 'failed', label: 'Failed'}
225
- ];
226
-
227
- var boardId = null;
228
- var tasks = [];
229
- var pollTimer = null;
230
- var pollActive = false;
231
-
232
- function setStatus(msg) {
233
- document.getElementById('statusbar').textContent = msg;
234
- }
235
-
236
- function esc(s) {
237
- return String(s == null ? '' : s).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
238
- }
239
-
240
- // A cancelled task folds into the Failed column, tagged distinctly \u2014 v1
241
- // treats both as terminal scrap, and a fifth column for a rarely-used
242
- // status isn't worth the width.
243
- function columnOf(status) {
244
- if (status === 'cancelled') return 'failed';
245
- return status;
246
- }
247
-
248
- // ============================================================
249
- // Verification tell \u2014 never render an unverified done as gate-passed.
250
- // ============================================================
251
-
252
- function verificationTag(t) {
253
- var v = t.verification;
254
- if (v) {
255
- if (v.kind === 'gate') return '<span class="tag t-gate">&#10003; gate</span>';
256
- if (v.kind === 'self-report') return '<span class="tag t-self">self-report</span>';
257
- if (v.kind === 'human') return '<span class="tag t-human">human</span>';
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, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
258
185
  }
259
- if (t.status === 'in_progress' && t.verify) {
260
- return '<span class="tag t-gated">gated</span>';
186
+ function columnOf(status) {
187
+ return status === "cancelled" ? "failed" : status;
261
188
  }
262
- return '';
263
- }
264
-
265
- function ownerTag(t) {
266
- if (!t.owner) return '<span class="tag t-unclaimed">Unclaimed</span>';
267
- return '<span class="tag t-owner">' + esc(t.owner) + '</span>';
268
- }
269
-
270
- // ============================================================
271
- // Card actions \u2014 explicit status moves, no drag-and-drop (read-only-safe
272
- // first: see module docblock).
273
- // ============================================================
274
-
275
- function actionsFor(t) {
276
- var a = [];
277
- if (t.status === 'pending') {
278
- if (!t.owner) a.push({label: 'Claim', action: 'claim', cls: 'primary'});
279
- else a.push({label: 'Start', action: 'start', cls: 'primary'});
280
- a.push({label: 'Cancel', action: 'cancel', cls: 'danger'});
281
- } else if (t.status === 'in_progress') {
282
- a.push({label: 'Done', action: 'done', cls: 'primary'});
283
- a.push({label: 'Fail', action: 'fail', cls: 'danger'});
284
- a.push({label: 'Release', action: 'release', cls: ''});
285
- a.push({label: 'Cancel', action: 'cancel', cls: 'danger'});
286
- } else if (t.status === 'done') {
287
- a.push({label: 'Reopen', action: 'reopen', cls: ''});
189
+ function verificationTag(task) {
190
+ const v = task.verification;
191
+ if (v) {
192
+ if (v.kind === "gate") return '<span class="tag t-gate">&#10003; 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 "";
288
200
  }
289
- return a;
290
- }
291
-
292
- function applyAction(taskId, action) {
293
- var t = null;
294
- for (var i = 0; i < tasks.length; i++) {
295
- if (tasks[i].taskId === taskId) { t = tasks[i]; break; }
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>\`;
296
204
  }
297
- if (!t) return;
298
- var p;
299
- if (action === 'claim') {
300
- p = callTool('task_claim', {taskId: t.taskId, rev: t.rev});
301
- } else if (action === 'start') {
302
- p = callTool('task_update', {taskId: t.taskId, rev: t.rev, status: 'in_progress'});
303
- } else if (action === 'done') {
304
- p = callTool('task_update', {taskId: t.taskId, rev: t.rev, status: 'done'});
305
- } else if (action === 'fail') {
306
- p = callTool('task_update', {taskId: t.taskId, rev: t.rev, status: 'failed'});
307
- } else if (action === 'release') {
308
- p = callTool('task_update', {taskId: t.taskId, rev: t.rev, owner: null});
309
- } else if (action === 'cancel') {
310
- p = callTool('task_update', {taskId: t.taskId, rev: t.rev, status: 'cancelled'});
311
- } else if (action === 'reopen') {
312
- p = callTool('task_update', {taskId: t.taskId, rev: t.rev, status: 'pending'});
313
- } else {
314
- return;
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 [];
315
224
  }
316
- p.then(function (result) {
317
- if (result && result.conflict) {
318
- setStatus('Someone else moved "' + t.title + '" first \u2014 refreshed.');
319
- } else if (result && result.error) {
320
- setStatus('Action failed: ' + result.error);
321
- } else {
322
- setStatus('Updated "' + t.title + '".');
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>\`;
323
234
  }
324
- return loadBoard();
325
- }).catch(function (e) {
326
- setStatus('Action failed: ' + e.message);
327
- });
328
- }
329
-
330
- // ============================================================
331
- // Render
332
- // ============================================================
333
-
334
- function renderCard(t) {
335
- var html = '<div class="card" data-taskid="' + esc(t.taskId) + '">';
336
- html += '<div class="c-title">' + esc(t.title) + '</div>';
337
- html += '<div class="c-id">#' + esc(t.taskId) + '</div>';
338
- html += '<div class="c-row">' + ownerTag(t) + verificationTag(t);
339
- if (t.status === 'cancelled') html += '<span class="tag t-cancelled">cancelled</span>';
340
- html += '</div>';
341
- if (t.lastVerifyError) {
342
- html += '<div class="c-err">verify failed: ' + esc(t.lastVerifyError) + '</div>';
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;
343
245
  }
344
- var actions = actionsFor(t);
345
- if (actions.length > 0) {
346
- html += '<div class="c-actions">';
347
- for (var i = 0; i < actions.length; i++) {
348
- var a = actions[i];
349
- html += '<button class="abtn ' + a.cls + '" data-taskid="' + esc(t.taskId) + '" data-action="' + a.action + '">' + a.label + '</button>';
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>";
350
253
  }
351
- html += '</div>';
254
+ return html;
352
255
  }
353
- html += '</div>';
354
- return html;
355
- }
356
-
357
- function render() {
358
- document.getElementById('board-id').textContent = boardId || '\u2014';
359
- if (!document.getElementById('board-input').value) {
360
- document.getElementById('board-input').value = boardId || '';
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
+ }
361
279
  }
362
- var el = document.getElementById('columns');
363
- var html = '';
364
- for (var c = 0; c < COLUMNS.length; c++) {
365
- var col = COLUMNS[c];
366
- var rows = tasks.filter(function (t) { return columnOf(t.status) === col.key; });
367
- html += '<div class="col"><div class="col-hdr"><span>' + col.label + '</span><span>' + rows.length + '</span></div><div class="col-body">';
368
- if (rows.length === 0) {
369
- html += '<div class="empty">No tasks</div>';
370
- } else {
371
- for (var i = 0; i < rows.length; i++) html += renderCard(rows[i]);
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
+ });
372
347
  }
373
- html += '</div></div>';
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();
374
400
  }
375
- el.innerHTML = html;
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);
376
442
  }
377
443
 
378
- // ============================================================
379
- // Data
380
- // ============================================================
381
-
382
- function loadBoard() {
383
- var args = {includeClosed: true, full: true};
384
- if (boardId) args.boardId = boardId;
385
- return callTool('task_list', args).then(function (data) {
386
- boardId = data.boardId || boardId;
387
- tasks = data.tasks || [];
388
- render();
389
- setStatus(tasks.length + ' task' + (tasks.length === 1 ? '' : 's') + ' \xB7 ' + new Date().toLocaleTimeString());
390
- }).catch(function (e) {
391
- setStatus('Error: ' + e.message);
392
- });
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
+ }
393
460
  }
394
461
 
395
- function doPoll() {
396
- if (pollActive) return;
397
- pollActive = true;
398
- loadBoard().then(function () {
399
- pollActive = false;
400
- pollTimer = setTimeout(doPoll, 4000);
401
- }).catch(function () {
402
- pollActive = false;
403
- pollTimer = setTimeout(doPoll, 4000);
404
- });
405
- }
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 */
406
463
 
407
- // ============================================================
408
- // Toolbar wiring
409
- // ============================================================
464
+ * { box-sizing: border-box; margin: 0; padding: 0; }
410
465
 
411
- document.getElementById('columns').addEventListener('click', function (evt) {
412
- var btn = evt.target.closest ? evt.target.closest('button[data-action]') : null;
413
- if (!btn) return;
414
- applyAction(btn.getAttribute('data-taskid'), btn.getAttribute('data-action'));
415
- });
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
+ }
416
474
 
417
- document.getElementById('refresh-btn').addEventListener('click', function () {
418
- loadBoard();
419
- });
475
+ .mono {
476
+ font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, "Courier New", monospace;
477
+ }
420
478
 
421
- document.getElementById('go-btn').addEventListener('click', function () {
422
- var v = document.getElementById('board-input').value.trim();
423
- if (!v) return;
424
- boardId = v;
425
- loadBoard();
426
- });
479
+ #app { display: flex; flex-direction: column; height: 100%; }
427
480
 
428
- document.getElementById('add-btn').addEventListener('click', function () {
429
- var input = document.getElementById('new-title');
430
- var title = input.value.trim();
431
- if (!title) return;
432
- var args = {title: title};
433
- if (boardId) args.boardId = boardId;
434
- callTool('task_create', args).then(function (result) {
435
- if (result && result.error) {
436
- setStatus('Create failed: ' + result.error);
437
- return;
438
- }
439
- input.value = '';
440
- setStatus('Created "' + title + '".');
441
- return loadBoard();
442
- }).catch(function (e) {
443
- setStatus('Create failed: ' + e.message);
444
- });
445
- });
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
+ }
446
524
 
447
- // ============================================================
448
- // Boot
449
- // ============================================================
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; }
450
547
 
451
- initBridge().then(function () {
452
- return loadBoard();
453
- }).then(function () {
454
- pollTimer = setTimeout(doPoll, 4000);
455
- }).catch(function (e) {
456
- setStatus('Bridge error: ' + e.message);
457
- });
458
- </script>
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:&lt;sessionId&gt; or ws:&lt;slug&gt;">
612
+ <button class="tbtn" id="go-btn">Go</button>
613
+ <button class="tbtn" id="refresh-btn" title="Refresh">&#8635;</button>
614
+ <input id="new-title" type="text" placeholder="New task title&#8230;">
615
+ <button class="tbtn" id="add-btn">+ Add</button>
616
+ </div>
617
+ <div id="columns"></div>
618
+ <div id="statusbar">Connecting to bridge&#8230;</div>
619
+ </div>
459
620
  </body>
460
- </html>`;
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;
461
634
 
462
- export { WORK_BOARD_HTML };
635
+ export { WORK_BOARD_APP_ID, WORK_BOARD_HTML, WORK_BOARD_TOOL_ID, WORK_BOARD_UI_TOOLS };
463
636
  //# sourceMappingURL=panel.mjs.map
464
637
  //# sourceMappingURL=panel.mjs.map