@wenathlan/extension 1.1.57 → 1.1.58
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 +4 -3
- package/dist/agentmailbox.d.ts +42 -0
- package/dist/agentmailbox.d.ts.map +1 -0
- package/dist/blackboard.d.ts +55 -0
- package/dist/blackboard.d.ts.map +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3954 -3455
- package/dist/index.js.map +4 -4
- package/dist/memory.d.ts +47 -1
- package/dist/memory.d.ts.map +1 -1
- package/dist/multiagent.d.ts +151 -0
- package/dist/multiagent.d.ts.map +1 -0
- package/dist/policy.d.ts +36 -1
- package/dist/policy.d.ts.map +1 -1
- package/dist/protocol.d.ts +58 -1
- package/dist/protocol.d.ts.map +1 -1
- package/dist/taskqueue.d.ts +97 -0
- package/dist/taskqueue.d.ts.map +1 -0
- package/dist/types.d.ts +186 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/extension/dist/background.js +4584 -3873
- package/extension/dist/background.js.map +4 -4
- package/extension/dist/manifest.json +1 -1
- package/extension/dist/pagebridge.js.map +1 -1
- package/extension/dist/popup.html +1 -1
- package/extension/dist/popup.js +12 -0
- package/extension/dist/popup.js.map +2 -2
- package/extension/dist/sidepanel.html +1 -1
- package/extension/dist/sidepanel.js +337 -0
- package/extension/dist/sidepanel.js.map +2 -2
- package/extension/manifest.json +1 -1
- package/package.json +1 -1
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Devthink review</title><link rel="stylesheet" href="style.css"></head>
|
|
4
4
|
<body><main class="wide"><header><p class="eyebrow">REVIEW GATE</p><h1>Plan before action</h1><p>Every browser operation remains blocked until the user reviews and approves it here.</p></header><label for="objective">Objective</label><textarea id="objective" rows="4" placeholder="Describe a browser task to turn into a reviewable plan."></textarea><div class="actions"><button id="localplan">Create local observation plan</button><button id="remoteplan" class="secondary">Ask configured endpoint</button><button id="diagnostic" class="secondary">Capture local diagnostics</button></div>
|
|
5
5
|
<div class="actions"><input id="command" placeholder="Ask any connected model in plain language" aria-label="Natural language command"><button id="commandsend" class="secondary">Ask model</button><span id="intentbadge" class="muted"></span></div><p id="status" role="status">Loading session state.</p><p id="capabilitiestext" role="status" class="muted">Optional capabilities unknown.</p><section><h2>Current plan</h2><progress id="planprogress" max="1" value="0"></progress><div id="plan" class="panel"></div></section><section><h2>Clickable map</h2><ol id="map" class="audit maplist"></ol></section><section><h2>Navigation trail</h2><ol id="trail" class="audit"></ol></section><section><h2>Navigation state</h2><div id="navigation" class="panel"></div></section><section><h2>Tabs and windows</h2><div id="tabswindows" class="panel"></div></section><section><h2>Forms and data</h2><div id="forms" class="panel"></div></section><section><h2>Files and downloads</h2><div id="files" class="panel"></div></section><section><h2>Capture gallery</h2><div id="captures" class="panel"></div></section><section><h2>Media</h2><div id="media" class="panel"></div></section><section><h2>Network calls</h2><div id="calls" class="panel"></div></section><section><h2>Network view</h2><div id="netview" class="panel"></div></section><section><h2>Traffic control</h2><div id="traffic" class="panel"></div></section><section><h2>Run timeline</h2><div id="timeline" class="panel"></div></section><section><h2>Debugger</h2><div id="debugger" class="panel"></div></section><section><h2>Profiling</h2><div id="profiling" class="panel"></div></section><section><h2>Emulation</h2><div id="emulation" class="panel"></div></section><section><h2>Sessions</h2><div id="sessions" class="panel"></div></section><section><h2>Workflows</h2><div id="workflows" class="panel"></div></section><section><h2>Workflow editor</h2><div id="workfloweditor" class="panel"></div></section><section><h2>Triggers</h2><div id="triggers" class="panel"></div></section><section><h2>Agent protocol</h2><div id="agentprotocol" class="panel"></div></section>
|
|
6
|
-
<section><h2>Models</h2><div id="models" class="panel"></div></section><section><h2>Console diff</h2><div id="consolediff" class="panel"></div></section><section><h2>Datasets</h2><div id="datasets" class="panel"></div></section><section><h2>Consent banners</h2><div id="banners" class="panel"></div></section><section><h2>Accessibility tree</h2><div id="a11y" class="panel"></div></section><section><h2>Reader view</h2><div id="reader" class="panel"></div></section><section><h2>Detected shapes</h2><ol id="detections" class="audit maplist"></ol></section><section><h2>Watch stream</h2><ol id="stream" class="audit"></ol></section><section><h2>Snapshot diffs</h2><div id="diffs" class="panel"></div></section><section><h2>Derived selectors</h2><ol id="selectors" class="audit maplist"></ol></section><section><h2>Structured diagnostics</h2><ul id="diagnostics" class="audit"></ul></section><section><h2>Local audit</h2><ol id="audit" class="audit"></ol></section></main><script type="module" src="sidepanel.js"></script></body>
|
|
6
|
+
<section><h2>Models</h2><div id="models" class="panel"></div></section><section><h2>Agents</h2><div id="agents" class="panel"></div></section><section><h2>Console diff</h2><div id="consolediff" class="panel"></div></section><section><h2>Datasets</h2><div id="datasets" class="panel"></div></section><section><h2>Consent banners</h2><div id="banners" class="panel"></div></section><section><h2>Accessibility tree</h2><div id="a11y" class="panel"></div></section><section><h2>Reader view</h2><div id="reader" class="panel"></div></section><section><h2>Detected shapes</h2><ol id="detections" class="audit maplist"></ol></section><section><h2>Watch stream</h2><ol id="stream" class="audit"></ol></section><section><h2>Snapshot diffs</h2><div id="diffs" class="panel"></div></section><section><h2>Derived selectors</h2><ol id="selectors" class="audit maplist"></ol></section><section><h2>Structured diagnostics</h2><ul id="diagnostics" class="audit"></ul></section><section><h2>Local audit</h2><ol id="audit" class="audit"></ol></section></main><script type="module" src="sidepanel.js"></script></body>
|
|
7
7
|
</html>
|
|
@@ -394,6 +394,7 @@ var workfloweditorroot = document.querySelector("#workfloweditor");
|
|
|
394
394
|
var triggersroot = document.querySelector("#triggers");
|
|
395
395
|
var agentprotocolroot = document.querySelector("#agentprotocol");
|
|
396
396
|
var modelsroot = document.querySelector("#models");
|
|
397
|
+
var agentsroot = document.querySelector("#agents");
|
|
397
398
|
var commandinput = document.querySelector("#command");
|
|
398
399
|
var commandbutton = document.querySelector("#commandsend");
|
|
399
400
|
var intentbadge = document.querySelector("#intentbadge");
|
|
@@ -2881,6 +2882,7 @@ async function refresh() {
|
|
|
2881
2882
|
rendertriggers(context);
|
|
2882
2883
|
renderagentprotocol(context);
|
|
2883
2884
|
rendermodels(context);
|
|
2885
|
+
renderagents(context);
|
|
2884
2886
|
renderconsolediff();
|
|
2885
2887
|
renderaudit(context.audit);
|
|
2886
2888
|
rendercapabilities(context.capabilities);
|
|
@@ -5541,4 +5543,339 @@ function rendermodels(context) {
|
|
|
5541
5543
|
}
|
|
5542
5544
|
modelsroot.append(guardbox);
|
|
5543
5545
|
}
|
|
5546
|
+
function renderagents(context) {
|
|
5547
|
+
if (!agentsroot) return;
|
|
5548
|
+
agentsroot.replaceChildren();
|
|
5549
|
+
const swarm = context.swarm;
|
|
5550
|
+
if (!swarm) {
|
|
5551
|
+
const empty = document.createElement("p");
|
|
5552
|
+
empty.textContent = "The swarm state is unknown.";
|
|
5553
|
+
agentsroot.append(empty);
|
|
5554
|
+
return;
|
|
5555
|
+
}
|
|
5556
|
+
const head = document.createElement("p");
|
|
5557
|
+
head.textContent = `${swarm.overview.agents} agent${swarm.overview.agents === 1 ? "" : "s"} (${swarm.overview.active} active, ${swarm.overview.paused} paused, ${swarm.overview.stopped} stopped) \xB7 ${swarm.overview.tasks} task${swarm.overview.tasks === 1 ? "" : "s"} (${swarm.overview.claimed} claimed, ${swarm.overview.queued} queued, ${swarm.overview.done} done) \xB7 ${swarm.overview.messages} message${swarm.overview.messages === 1 ? "" : "s"} with ${swarm.overview.unread} unread \xB7 queue policy ${swarm.queue.completionpolicy}${swarm.queue.complete ? " \xB7 queue complete" : ""}.`;
|
|
5558
|
+
agentsroot.append(head);
|
|
5559
|
+
const switchbox = document.createElement("div");
|
|
5560
|
+
switchbox.className = "actions";
|
|
5561
|
+
if (swarm.killswitch.engaged) {
|
|
5562
|
+
const state = document.createElement("span");
|
|
5563
|
+
state.className = "muted";
|
|
5564
|
+
state.textContent = `Killswitch engaged${swarm.killswitch.reason !== void 0 ? `: ${swarm.killswitch.reason}` : ""}; every agent halted.`;
|
|
5565
|
+
switchbox.append(state, " ", button("Disarm killswitch", async () => {
|
|
5566
|
+
await request({ kind: "swarmagent", disarm: true });
|
|
5567
|
+
status("The killswitch disarmed; the stopped agents stay stopped until resumed.");
|
|
5568
|
+
await refresh();
|
|
5569
|
+
}));
|
|
5570
|
+
} else {
|
|
5571
|
+
switchbox.append(button("Halt every agent (killswitch)", async () => {
|
|
5572
|
+
if (window.confirm("Halt every agent of the swarm at once?")) {
|
|
5573
|
+
await request({ kind: "swarmagent", killall: true, reason: "The user halted the swarm from the panel." });
|
|
5574
|
+
status("The killswitch engaged: every agent halted at once and the claims returned to the queue.");
|
|
5575
|
+
await refresh();
|
|
5576
|
+
}
|
|
5577
|
+
}));
|
|
5578
|
+
}
|
|
5579
|
+
agentsroot.append(switchbox);
|
|
5580
|
+
const agentsbox = document.createElement("details");
|
|
5581
|
+
agentsbox.className = "sessiongroup";
|
|
5582
|
+
agentsbox.open = true;
|
|
5583
|
+
const agentsummary = document.createElement("summary");
|
|
5584
|
+
agentsummary.textContent = `Agent cards (${swarm.agents.length})`;
|
|
5585
|
+
agentsbox.append(agentsummary);
|
|
5586
|
+
for (const agent of swarm.agents) {
|
|
5587
|
+
const row = document.createElement("div");
|
|
5588
|
+
row.className = "sessionrow";
|
|
5589
|
+
const info = document.createElement("p");
|
|
5590
|
+
const budgettext = agent.budget === void 0 ? "no ceiling" : [agent.budget.maxtokens !== void 0 ? `${agent.usage?.tokens ?? 0}/${agent.budget.maxtokens} tokens` : "", agent.budget.maxcost !== void 0 ? `${agent.usage?.cost ?? 0}/${agent.budget.maxcost} ${agent.budget.currency ?? ""}` : "", agent.budget.maxsteps !== void 0 ? `${agent.usage?.steps ?? 0}/${agent.budget.maxsteps} steps` : ""].filter((part) => part !== "").join(", ") || "no ceiling set";
|
|
5591
|
+
info.textContent = `${agent.name} \xB7 ${agent.role} \xB7 ${agent.state}${agent.tabid !== void 0 ? ` \xB7 tab ${agent.tabid}` : ""}${agent.parentid !== void 0 ? ` \xB7 sub of ${agent.parentid} at depth ${agent.depth}` : ""}${agent.currenttask !== void 0 ? ` \xB7 working: ${agent.currenttask}` : " \xB7 idle"} \xB7 budget ${budgettext}${agent.heartbeatat !== void 0 ? ` \xB7 heartbeat ${new Date(agent.heartbeatat).toLocaleTimeString()}` : ""}${agent.unread > 0 ? ` \xB7 ${agent.unread} unread` : ""}.`;
|
|
5592
|
+
row.append(info);
|
|
5593
|
+
const actions = document.createElement("div");
|
|
5594
|
+
actions.className = "actions";
|
|
5595
|
+
actions.append(button("Pause", async () => {
|
|
5596
|
+
await request({ kind: "swarmagent", agentid: agent.id, action: "pause" });
|
|
5597
|
+
status(`Paused the agent ${agent.name}; the others keep running.`);
|
|
5598
|
+
await refresh();
|
|
5599
|
+
}), " ", button("Resume", async () => {
|
|
5600
|
+
await request({ kind: "swarmagent", agentid: agent.id, action: "resume" });
|
|
5601
|
+
status(`Resumed the agent ${agent.name}.`);
|
|
5602
|
+
await refresh();
|
|
5603
|
+
}), " ", button("Stop", async () => {
|
|
5604
|
+
await request({ kind: "swarmagent", agentid: agent.id, action: "stop" });
|
|
5605
|
+
status(`Stopped the agent ${agent.name}.`);
|
|
5606
|
+
await refresh();
|
|
5607
|
+
}), " ", button("Claim task", async () => {
|
|
5608
|
+
await request({ kind: "swarmqueue", agentid: agent.id, claim: true });
|
|
5609
|
+
status(`The agent ${agent.name} claimed the highest priority task; the proposal still passes the plan review.`);
|
|
5610
|
+
await refresh();
|
|
5611
|
+
}), " ", button("Heartbeat", async () => {
|
|
5612
|
+
await request({ kind: "swarmagent", agentid: agent.id, heartbeat: true });
|
|
5613
|
+
status(`The agent ${agent.name} refreshed its heartbeat.`);
|
|
5614
|
+
await refresh();
|
|
5615
|
+
}));
|
|
5616
|
+
const budgetrow = document.createElement("div");
|
|
5617
|
+
budgetrow.className = "actions";
|
|
5618
|
+
const tokensinput = document.createElement("input");
|
|
5619
|
+
tokensinput.placeholder = "token ceiling";
|
|
5620
|
+
const costinput = document.createElement("input");
|
|
5621
|
+
costinput.placeholder = "cost ceiling";
|
|
5622
|
+
const stepsinput = document.createElement("input");
|
|
5623
|
+
stepsinput.placeholder = "step ceiling";
|
|
5624
|
+
const currencyinput = document.createElement("input");
|
|
5625
|
+
currencyinput.placeholder = "currency";
|
|
5626
|
+
budgetrow.append(tokensinput, " ", costinput, " ", currencyinput, " ", stepsinput, " ", button("Set budget", async () => {
|
|
5627
|
+
await request({ kind: "swarmagent", agentid: agent.id, budget: { ...tokensinput.value.trim() !== "" ? { maxtokens: Number(tokensinput.value) } : {}, ...costinput.value.trim() !== "" ? { maxcost: Number(costinput.value) } : {}, ...stepsinput.value.trim() !== "" ? { maxsteps: Number(stepsinput.value) } : {}, ...currencyinput.value.trim() !== "" ? { currency: currencyinput.value.trim() } : {} } });
|
|
5628
|
+
status(`Saved the budget of the agent ${agent.name}.`);
|
|
5629
|
+
await refresh();
|
|
5630
|
+
}));
|
|
5631
|
+
row.append(actions, budgetrow);
|
|
5632
|
+
agentsbox.append(row);
|
|
5633
|
+
}
|
|
5634
|
+
const addrow = document.createElement("div");
|
|
5635
|
+
addrow.className = "actions";
|
|
5636
|
+
const nameinput = document.createElement("input");
|
|
5637
|
+
nameinput.placeholder = "new agent name";
|
|
5638
|
+
const roleselect = document.createElement("select");
|
|
5639
|
+
for (const role of ["worker", "planner", "observer"]) {
|
|
5640
|
+
const option = document.createElement("option");
|
|
5641
|
+
option.value = role;
|
|
5642
|
+
option.textContent = role;
|
|
5643
|
+
roleselect.append(option);
|
|
5644
|
+
}
|
|
5645
|
+
const customrole = document.createElement("input");
|
|
5646
|
+
customrole.placeholder = "custom role";
|
|
5647
|
+
const tabinput = document.createElement("input");
|
|
5648
|
+
tabinput.placeholder = "tab id";
|
|
5649
|
+
addrow.append(nameinput, " ", roleselect, " ", customrole, " ", tabinput, " ", button("Register agent", async () => {
|
|
5650
|
+
await request({ kind: "swarmagent", register: { name: nameinput.value, role: customrole.value.trim() !== "" ? customrole.value.trim() : roleselect.value, ...tabinput.value.trim() !== "" ? { tabid: Number(tabinput.value) } : {} } });
|
|
5651
|
+
status(`Registered the agent ${nameinput.value}; one tab holds at most one agent.`);
|
|
5652
|
+
await refresh();
|
|
5653
|
+
}));
|
|
5654
|
+
agentsbox.append(addrow);
|
|
5655
|
+
const spawnrow = document.createElement("div");
|
|
5656
|
+
spawnrow.className = "actions";
|
|
5657
|
+
const parentselect = document.createElement("select");
|
|
5658
|
+
for (const agent of swarm.agents) {
|
|
5659
|
+
const option = document.createElement("option");
|
|
5660
|
+
option.value = agent.id;
|
|
5661
|
+
option.textContent = agent.name;
|
|
5662
|
+
parentselect.append(option);
|
|
5663
|
+
}
|
|
5664
|
+
const spawnrole = document.createElement("select");
|
|
5665
|
+
for (const role of ["worker", "planner", "observer"]) {
|
|
5666
|
+
const option = document.createElement("option");
|
|
5667
|
+
option.value = role;
|
|
5668
|
+
option.textContent = role;
|
|
5669
|
+
spawnrole.append(option);
|
|
5670
|
+
}
|
|
5671
|
+
const spawntask = document.createElement("input");
|
|
5672
|
+
spawntask.placeholder = "sub agent task";
|
|
5673
|
+
const spawndepth = document.createElement("input");
|
|
5674
|
+
spawndepth.placeholder = "depth";
|
|
5675
|
+
spawndepth.value = "1";
|
|
5676
|
+
const spawnname = document.createElement("input");
|
|
5677
|
+
spawnname.placeholder = "sub agent name";
|
|
5678
|
+
spawnrow.append(parentselect, " ", spawnrole, " ", spawntask, " ", spawndepth, " ", spawnname, " ", button("Spawn sub agent", async () => {
|
|
5679
|
+
await request({ kind: "swarmagent", spawn: { parentid: parentselect.value, role: spawnrole.value, task: spawntask.value, depth: Number(spawndepth.value || "1"), ...spawnname.value.trim() !== "" ? { name: spawnname.value } : {} } });
|
|
5680
|
+
status("Spawned the sub agent; the depth history records the recursion.");
|
|
5681
|
+
await refresh();
|
|
5682
|
+
}));
|
|
5683
|
+
agentsbox.append(spawnrow);
|
|
5684
|
+
if (swarm.spawns.length > 0) {
|
|
5685
|
+
const history = document.createElement("p");
|
|
5686
|
+
history.textContent = `Spawn history: ${swarm.spawns.slice(0, 5).map((record) => `${record.parentid} \u2192 ${record.childid} (${record.role}, depth ${record.depth})`).join("; ")}.`;
|
|
5687
|
+
agentsbox.append(history);
|
|
5688
|
+
}
|
|
5689
|
+
agentsroot.append(agentsbox);
|
|
5690
|
+
const queuebox = document.createElement("details");
|
|
5691
|
+
queuebox.className = "sessiongroup";
|
|
5692
|
+
queuebox.open = true;
|
|
5693
|
+
const queuesummary = document.createElement("summary");
|
|
5694
|
+
queuesummary.textContent = `Task queue (${swarm.queue.items.length})`;
|
|
5695
|
+
queuebox.append(queuesummary);
|
|
5696
|
+
for (const lane of swarm.queue.lanesreport) {
|
|
5697
|
+
const row = document.createElement("p");
|
|
5698
|
+
const claims = swarm.queue.claims.filter((claim) => swarm.queue.items.some((item) => item.id === claim.taskid && item.lane === lane.lane && item.state === "claimed"));
|
|
5699
|
+
row.textContent = `Lane ${lane.lane}: ${lane.queued} queued \xB7 ${lane.claimed} claimed \xB7 ${lane.done} done \xB7 ${lane.cancelled} cancelled${claims.length > 0 ? ` \xB7 held by ${claims.map((claim) => claim.agentid).join(", ")}` : ""}.`;
|
|
5700
|
+
queuebox.append(row);
|
|
5701
|
+
}
|
|
5702
|
+
const list = document.createElement("ol");
|
|
5703
|
+
list.className = "audit";
|
|
5704
|
+
for (const item of swarm.queue.items.slice(0, 12)) {
|
|
5705
|
+
const entry = document.createElement("li");
|
|
5706
|
+
entry.textContent = `${item.payload} \u2014 lane ${item.lane}, priority ${item.priority}, ${item.state}.`;
|
|
5707
|
+
const actions = document.createElement("div");
|
|
5708
|
+
actions.className = "actions";
|
|
5709
|
+
actions.append(button("Complete", async () => {
|
|
5710
|
+
await request({ kind: "swarmqueue", taskid: item.id, complete: true });
|
|
5711
|
+
status("The task completed and released its claim.");
|
|
5712
|
+
await refresh();
|
|
5713
|
+
}), " ", button("Cancel", async () => {
|
|
5714
|
+
await request({ kind: "swarmqueue", taskid: item.id, cancel: true });
|
|
5715
|
+
status("The task left the queue.");
|
|
5716
|
+
await refresh();
|
|
5717
|
+
}));
|
|
5718
|
+
entry.append(actions);
|
|
5719
|
+
list.append(entry);
|
|
5720
|
+
}
|
|
5721
|
+
queuebox.append(list);
|
|
5722
|
+
const enqueuerow = document.createElement("div");
|
|
5723
|
+
enqueuerow.className = "actions";
|
|
5724
|
+
const laneinput = document.createElement("input");
|
|
5725
|
+
laneinput.placeholder = "lane";
|
|
5726
|
+
const priorityinput = document.createElement("input");
|
|
5727
|
+
priorityinput.placeholder = "priority";
|
|
5728
|
+
const payloadinput = document.createElement("input");
|
|
5729
|
+
payloadinput.placeholder = "task in plain language";
|
|
5730
|
+
const lanesinput = document.createElement("input");
|
|
5731
|
+
lanesinput.placeholder = "configured lanes, comma separated";
|
|
5732
|
+
lanesinput.value = swarm.queue.lanes.join(", ");
|
|
5733
|
+
enqueuerow.append(laneinput, " ", priorityinput, " ", payloadinput, " ", button("Enqueue", async () => {
|
|
5734
|
+
await request({ kind: "swarmqueue", enqueue: { lane: laneinput.value, priority: Number(priorityinput.value || "0"), payload: payloadinput.value } });
|
|
5735
|
+
status("The task entered the lane; nothing runs before the plan review.");
|
|
5736
|
+
await refresh();
|
|
5737
|
+
}), " ", button("Requeue orphans", async () => {
|
|
5738
|
+
await request({ kind: "swarmqueue", requeue: true });
|
|
5739
|
+
status("The requeue pass returned the orphaned tasks to their lanes.");
|
|
5740
|
+
await refresh();
|
|
5741
|
+
}), " ", button("Save lanes", async () => {
|
|
5742
|
+
await request({ kind: "swarmqueue", lanes: lanesinput.value.split(",").map((lane) => lane.trim()).filter((lane) => lane !== "") });
|
|
5743
|
+
status("Saved the configured lanes.");
|
|
5744
|
+
await refresh();
|
|
5745
|
+
}));
|
|
5746
|
+
queuebox.append(enqueuerow);
|
|
5747
|
+
agentsroot.append(queuebox);
|
|
5748
|
+
const mailboxbox = document.createElement("details");
|
|
5749
|
+
mailboxbox.className = "sessiongroup";
|
|
5750
|
+
const mailboxsummary = document.createElement("summary");
|
|
5751
|
+
mailboxsummary.textContent = `Mailboxes (${swarm.mailboxes.length})`;
|
|
5752
|
+
mailboxbox.append(mailboxsummary);
|
|
5753
|
+
for (const mailbox of swarm.mailboxes) {
|
|
5754
|
+
if (mailbox.inbox.length === 0 && mailbox.outbox.length === 0) continue;
|
|
5755
|
+
const row = document.createElement("div");
|
|
5756
|
+
row.className = "sessionrow";
|
|
5757
|
+
const info = document.createElement("p");
|
|
5758
|
+
info.textContent = `Agent ${mailbox.agentid}: ${mailbox.inbox.length} in, ${mailbox.outbox.length} out, ${mailbox.unread} unread.`;
|
|
5759
|
+
row.append(info);
|
|
5760
|
+
const feed = document.createElement("ul");
|
|
5761
|
+
feed.className = "audit";
|
|
5762
|
+
for (const message of [...mailbox.inbox, ...mailbox.outbox].slice(0, 6)) {
|
|
5763
|
+
const entry = document.createElement("li");
|
|
5764
|
+
entry.textContent = `${message.senderid} \u2192 ${message.recipient} (${message.routing}): ${message.payload}`;
|
|
5765
|
+
feed.append(entry);
|
|
5766
|
+
}
|
|
5767
|
+
row.append(feed, button("Receive", async () => {
|
|
5768
|
+
await request({ kind: "swarmmailbox", agentid: mailbox.agentid, receive: true });
|
|
5769
|
+
status(`The agent ${mailbox.agentid} drained its inbox.`);
|
|
5770
|
+
await refresh();
|
|
5771
|
+
}));
|
|
5772
|
+
mailboxbox.append(row);
|
|
5773
|
+
}
|
|
5774
|
+
const composerow = document.createElement("div");
|
|
5775
|
+
composerow.className = "actions";
|
|
5776
|
+
const recipientselect = document.createElement("select");
|
|
5777
|
+
const broadcastoption = document.createElement("option");
|
|
5778
|
+
broadcastoption.value = "*";
|
|
5779
|
+
broadcastoption.textContent = "broadcast (every agent)";
|
|
5780
|
+
recipientselect.append(broadcastoption);
|
|
5781
|
+
for (const agent of swarm.agents) {
|
|
5782
|
+
const option = document.createElement("option");
|
|
5783
|
+
option.value = agent.id;
|
|
5784
|
+
option.textContent = `${agent.name} (${agent.id})`;
|
|
5785
|
+
recipientselect.append(option);
|
|
5786
|
+
}
|
|
5787
|
+
const routingselect = document.createElement("select");
|
|
5788
|
+
for (const routing of ["direct", "broadcast", "role"]) {
|
|
5789
|
+
const option = document.createElement("option");
|
|
5790
|
+
option.value = routing;
|
|
5791
|
+
option.textContent = routing;
|
|
5792
|
+
routingselect.append(option);
|
|
5793
|
+
}
|
|
5794
|
+
const messageinput = document.createElement("input");
|
|
5795
|
+
messageinput.placeholder = "message to the agents";
|
|
5796
|
+
composerow.append(recipientselect, " ", routingselect, " ", messageinput, " ", button("Send user message", async () => {
|
|
5797
|
+
await request({ kind: "swarmmailbox", send: { senderid: "user", recipient: recipientselect.value, routing: routingselect.value, payload: messageinput.value } });
|
|
5798
|
+
status("The user message was delivered to the swarm.");
|
|
5799
|
+
await refresh();
|
|
5800
|
+
}));
|
|
5801
|
+
mailboxbox.append(composerow);
|
|
5802
|
+
agentsroot.append(mailboxbox);
|
|
5803
|
+
const boardbox = document.createElement("details");
|
|
5804
|
+
boardbox.className = "sessiongroup";
|
|
5805
|
+
const boardsummary = document.createElement("summary");
|
|
5806
|
+
boardsummary.textContent = "Blackboard";
|
|
5807
|
+
boardbox.append(boardsummary);
|
|
5808
|
+
for (const section of swarm.blackboard.sections) {
|
|
5809
|
+
const row = document.createElement("p");
|
|
5810
|
+
row.textContent = `Section ${section.section}: ${section.entries} live entr${section.entries === 1 ? "y" : "ies"}${section.authors.length > 0 ? ` by ${section.authors.join(", ")}` : ""}${section.freshestat !== void 0 ? ` \xB7 freshest ${new Date(section.freshestat).toLocaleTimeString()}` : ""}.`;
|
|
5811
|
+
boardbox.append(row);
|
|
5812
|
+
}
|
|
5813
|
+
const entries = document.createElement("ol");
|
|
5814
|
+
entries.className = "audit";
|
|
5815
|
+
for (const entry of swarm.blackboard.entries.slice(0, 12)) {
|
|
5816
|
+
const item = document.createElement("li");
|
|
5817
|
+
item.textContent = `[${entry.section}] ${entry.key} = ${entry.value} \u2014 ${entry.author}, ${entry.consentclass}, posted ${new Date(entry.postedat).toLocaleTimeString()}.`;
|
|
5818
|
+
const actions = document.createElement("div");
|
|
5819
|
+
actions.className = "actions";
|
|
5820
|
+
actions.append(button("Retire", async () => {
|
|
5821
|
+
await request({ kind: "swarmblackboard", retire: entry.id });
|
|
5822
|
+
status(`Retired the entry ${entry.key}.`);
|
|
5823
|
+
await refresh();
|
|
5824
|
+
}));
|
|
5825
|
+
item.append(actions);
|
|
5826
|
+
entries.append(item);
|
|
5827
|
+
}
|
|
5828
|
+
boardbox.append(entries);
|
|
5829
|
+
const postrow = document.createElement("div");
|
|
5830
|
+
postrow.className = "actions";
|
|
5831
|
+
const keyinput = document.createElement("input");
|
|
5832
|
+
keyinput.placeholder = "key";
|
|
5833
|
+
const valueinput = document.createElement("input");
|
|
5834
|
+
valueinput.placeholder = "value";
|
|
5835
|
+
const sectionselect = document.createElement("select");
|
|
5836
|
+
for (const section of ["goals", "facts", "findings", "scratch"]) {
|
|
5837
|
+
const option = document.createElement("option");
|
|
5838
|
+
option.value = section;
|
|
5839
|
+
option.textContent = section;
|
|
5840
|
+
sectionselect.append(option);
|
|
5841
|
+
}
|
|
5842
|
+
const authorselect = document.createElement("select");
|
|
5843
|
+
const useroption = document.createElement("option");
|
|
5844
|
+
useroption.value = "user";
|
|
5845
|
+
useroption.textContent = "user";
|
|
5846
|
+
authorselect.append(useroption);
|
|
5847
|
+
for (const agent of swarm.agents) {
|
|
5848
|
+
const option = document.createElement("option");
|
|
5849
|
+
option.value = agent.id;
|
|
5850
|
+
option.textContent = agent.name;
|
|
5851
|
+
authorselect.append(option);
|
|
5852
|
+
}
|
|
5853
|
+
postrow.append(keyinput, " ", valueinput, " ", sectionselect, " ", authorselect, " ", button("Post entry", async () => {
|
|
5854
|
+
await request({ kind: "swarmblackboard", post: { key: keyinput.value, value: valueinput.value, section: sectionselect.value, author: authorselect.value } });
|
|
5855
|
+
status("The entry landed on the shared board; every agent reads it.");
|
|
5856
|
+
await refresh();
|
|
5857
|
+
}), " ", button("Retirement sweep", async () => {
|
|
5858
|
+
await request({ kind: "swarmblackboard", sweep: true });
|
|
5859
|
+
status("The retirement pass expired the stale entries.");
|
|
5860
|
+
await refresh();
|
|
5861
|
+
}));
|
|
5862
|
+
boardbox.append(postrow);
|
|
5863
|
+
agentsroot.append(boardbox);
|
|
5864
|
+
if (swarm.events.length > 0) {
|
|
5865
|
+
const eventbox = document.createElement("details");
|
|
5866
|
+
eventbox.className = "sessiongroup";
|
|
5867
|
+
const eventsummary = document.createElement("summary");
|
|
5868
|
+
eventsummary.textContent = `Lifecycle events (${swarm.events.length})`;
|
|
5869
|
+
eventbox.append(eventsummary);
|
|
5870
|
+
const feed = document.createElement("ul");
|
|
5871
|
+
feed.className = "audit";
|
|
5872
|
+
for (const event of swarm.events.slice(0, 10)) {
|
|
5873
|
+
const entry = document.createElement("li");
|
|
5874
|
+
entry.textContent = `${event.kind}: ${event.summary}`;
|
|
5875
|
+
feed.append(entry);
|
|
5876
|
+
}
|
|
5877
|
+
eventbox.append(feed);
|
|
5878
|
+
agentsroot.append(eventbox);
|
|
5879
|
+
}
|
|
5880
|
+
}
|
|
5544
5881
|
//# sourceMappingURL=sidepanel.js.map
|