@wenathlan/extension 1.1.55 → 1.1.56
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 +3 -3
- package/dist/agentstream.d.ts +155 -0
- package/dist/agentstream.d.ts.map +1 -0
- package/dist/index.js +247 -3
- package/dist/index.js.map +4 -4
- package/dist/mcpserver.d.ts +11 -4
- package/dist/mcpserver.d.ts.map +1 -1
- package/dist/memory.d.ts +57 -1
- package/dist/memory.d.ts.map +1 -1
- package/dist/policy.d.ts +26 -1
- package/dist/policy.d.ts.map +1 -1
- package/dist/protocol.d.ts +202 -0
- package/dist/protocol.d.ts.map +1 -1
- package/dist/types.d.ts +198 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/extension/dist/background.js +683 -20
- 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 +3 -1
- package/extension/dist/popup.js.map +2 -2
- package/extension/dist/sidepanel.js +234 -5
- package/extension/dist/sidepanel.js.map +2 -2
- package/extension/manifest.json +1 -1
- package/package.json +1 -1
|
@@ -4919,19 +4919,248 @@ function renderagentprotocol(context) {
|
|
|
4919
4919
|
catalogbox.append(domain);
|
|
4920
4920
|
}
|
|
4921
4921
|
agentprotocolroot.append(catalogbox);
|
|
4922
|
+
const runtimebox = document.createElement("details");
|
|
4923
|
+
runtimebox.className = "sessiongroup";
|
|
4924
|
+
const runtimesummary = document.createElement("summary");
|
|
4925
|
+
runtimesummary.textContent = `Call runtime (${mcp.inflight?.length ?? 0} in flight, ${mcp.dryruntoggle === true ? "dry run armed" : "dry run off"}, ${mcp.mocks?.length ?? 0} mock${(mcp.mocks?.length ?? 0) === 1 ? "" : "s"})`;
|
|
4926
|
+
runtimebox.append(runtimesummary);
|
|
4927
|
+
for (const call of mcp.inflight ?? []) {
|
|
4928
|
+
const line = document.createElement("p");
|
|
4929
|
+
line.textContent = `In flight ${call.tool} of ${call.clientid} \xB7 call ${call.callid.slice(0, 12)} \xB7 ${call.chunks} chunk${call.chunks === 1 ? "" : "s"} \xB7 open ${Math.max(0, Math.round((Date.now() - call.startedat) / 1e3))}s${call.dryrun === true ? " \xB7 dry run" : ""}.`;
|
|
4930
|
+
runtimebox.append(line);
|
|
4931
|
+
const actions = document.createElement("div");
|
|
4932
|
+
actions.className = "actions";
|
|
4933
|
+
actions.append(button("Cancel call", async () => {
|
|
4934
|
+
await request({ kind: "mcpcancelcall", callid: call.callid });
|
|
4935
|
+
status(`Cancelled the in flight ${call.tool} call; the partial result stays preserved.`);
|
|
4936
|
+
await refresh();
|
|
4937
|
+
}));
|
|
4938
|
+
runtimebox.append(actions);
|
|
4939
|
+
}
|
|
4940
|
+
if ((mcp.inflight?.length ?? 0) === 0) {
|
|
4941
|
+
const empty = document.createElement("p");
|
|
4942
|
+
empty.textContent = "No in flight tool call; a cancellation frame aborts a running call and preserves its partial result.";
|
|
4943
|
+
runtimebox.append(empty);
|
|
4944
|
+
}
|
|
4945
|
+
const runtimeactions = document.createElement("div");
|
|
4946
|
+
runtimeactions.className = "actions";
|
|
4947
|
+
runtimeactions.append(button(mcp.dryruntoggle === true ? "Disarm dry run" : "Dry run next call", async () => {
|
|
4948
|
+
await request({ kind: "mcpdryrun", enabled: mcp.dryruntoggle !== true });
|
|
4949
|
+
status(mcp.dryruntoggle === true ? "Disarmed the tool dry run; the next call executes behind the gates." : "Armed the tool dry run of the next call: it evaluates arguments and consent with no side effects.");
|
|
4950
|
+
await refresh();
|
|
4951
|
+
}));
|
|
4952
|
+
const mockinput = document.createElement("input");
|
|
4953
|
+
mockinput.placeholder = "tool name to mock (test context)";
|
|
4954
|
+
runtimeactions.append(" ", mockinput, " ", button("Add mock", async () => {
|
|
4955
|
+
if (mockinput.value.trim() === "") {
|
|
4956
|
+
status("The tool mock needs the namespaced tool name.", true);
|
|
4957
|
+
return;
|
|
4958
|
+
}
|
|
4959
|
+
await request({ kind: "mcpmock", tool: mockinput.value.trim() });
|
|
4960
|
+
status(`Registered the ${mockinput.value.trim()} tool mock of a test context; it never touches the browser.`);
|
|
4961
|
+
await refresh();
|
|
4962
|
+
}));
|
|
4963
|
+
runtimebox.append(runtimeactions);
|
|
4964
|
+
for (const mock of mcp.mocks ?? []) {
|
|
4965
|
+
const line = document.createElement("p");
|
|
4966
|
+
line.textContent = `Tool mock ${mock.tool} \xB7 test context \xB7 created ${new Date(mock.createdat).toISOString()}.`;
|
|
4967
|
+
runtimebox.append(line);
|
|
4968
|
+
const actions = document.createElement("div");
|
|
4969
|
+
actions.className = "actions";
|
|
4970
|
+
actions.append(button("Remove mock", async () => {
|
|
4971
|
+
await request({ kind: "mcpmock", tool: mock.tool, remove: true });
|
|
4972
|
+
status(`Removed the ${mock.tool} tool mock; the tool returns to the real gates.`);
|
|
4973
|
+
await refresh();
|
|
4974
|
+
}));
|
|
4975
|
+
runtimebox.append(actions);
|
|
4976
|
+
}
|
|
4977
|
+
agentprotocolroot.append(runtimebox);
|
|
4978
|
+
const limitsbox = document.createElement("details");
|
|
4979
|
+
limitsbox.className = "sessiongroup";
|
|
4980
|
+
const limitssummary = document.createElement("summary");
|
|
4981
|
+
limitssummary.textContent = `Rate limits (${mcp.limits?.length ?? 0} client${(mcp.limits?.length ?? 0) === 1 ? "" : "s"} limited)`;
|
|
4982
|
+
limitsbox.append(limitssummary);
|
|
4983
|
+
for (const limit of mcp.limits ?? []) {
|
|
4984
|
+
const line = document.createElement("p");
|
|
4985
|
+
const used = limit.budget !== void 0 ? Math.min(100, Math.round(limit.used / limit.budget * 100)) : 0;
|
|
4986
|
+
const bar = limit.budget !== void 0 ? " " + "\u2588".repeat(Math.round(used / 10)) + "\xB7".repeat(10 - Math.round(used / 10)) : "";
|
|
4987
|
+
line.textContent = `${limit.clientid} \xB7 ${limit.used}${limit.budget !== void 0 ? ` of ${limit.budget}` : " of unbounded"} call${limit.used === 1 ? "" : "s"} in the ${limit.windowms}ms window${bar} \xB7 resets in ${Math.max(0, Math.round((limit.windowstartedat + limit.windowms - Date.now()) / 1e3))}s.`;
|
|
4988
|
+
limitsbox.append(line);
|
|
4989
|
+
const actions = document.createElement("div");
|
|
4990
|
+
actions.className = "actions";
|
|
4991
|
+
actions.append(button("Remove limit", async () => {
|
|
4992
|
+
await request({ kind: "mcpratelimit", clientid: limit.clientid, remove: true });
|
|
4993
|
+
status(`Removed the rate limit of the client ${limit.clientid}; the client stays unbounded because no silent default applies.`);
|
|
4994
|
+
await refresh();
|
|
4995
|
+
}));
|
|
4996
|
+
limitsbox.append(actions);
|
|
4997
|
+
}
|
|
4998
|
+
const limtactions = document.createElement("div");
|
|
4999
|
+
limtactions.className = "actions";
|
|
5000
|
+
const limitclientinput = document.createElement("input");
|
|
5001
|
+
limitclientinput.placeholder = "client id";
|
|
5002
|
+
const limitwindowinput = document.createElement("input");
|
|
5003
|
+
limitwindowinput.placeholder = "window ms";
|
|
5004
|
+
const limitbudgetinput = document.createElement("input");
|
|
5005
|
+
limitbudgetinput.placeholder = "call budget (empty: unbounded)";
|
|
5006
|
+
limtactions.append(limitclientinput, " ", limitwindowinput, " ", limitbudgetinput, " ", button("Limit client", async () => {
|
|
5007
|
+
if (limitclientinput.value.trim() === "") {
|
|
5008
|
+
status("The rate limit needs the client id.", true);
|
|
5009
|
+
return;
|
|
5010
|
+
}
|
|
5011
|
+
await request({ kind: "mcpratelimit", clientid: limitclientinput.value.trim(), windowms: Number(limitwindowinput.value) || 6e4, ...limitbudgetinput.value.trim() !== "" ? { budget: Number(limitbudgetinput.value) } : {} });
|
|
5012
|
+
status(`Limited the client ${limitclientinput.value.trim()} inside its window; the budget stays the user choice.`);
|
|
5013
|
+
await refresh();
|
|
5014
|
+
}));
|
|
5015
|
+
limitsbox.append(limtactions);
|
|
5016
|
+
if ((mcp.limits?.length ?? 0) === 0) {
|
|
5017
|
+
const empty = document.createElement("p");
|
|
5018
|
+
empty.textContent = "No rate limit configured; an absent limit keeps the client unbounded because no silent default ever applies.";
|
|
5019
|
+
limitsbox.append(empty);
|
|
5020
|
+
}
|
|
5021
|
+
agentprotocolroot.append(limitsbox);
|
|
5022
|
+
const streambox = document.createElement("details");
|
|
5023
|
+
streambox.className = "sessiongroup";
|
|
5024
|
+
const streamsummary = document.createElement("summary");
|
|
5025
|
+
streamsummary.textContent = `Streaming and progress (${mcp.chunks?.length ?? 0} chunk${(mcp.chunks?.length ?? 0) === 1 ? "" : "s"}, ${mcp.progressnotices?.length ?? 0} notice${(mcp.progressnotices?.length ?? 0) === 1 ? "" : "s"})`;
|
|
5026
|
+
streambox.append(streamsummary);
|
|
5027
|
+
for (const notice of (mcp.progressnotices ?? []).slice(0, 5)) {
|
|
5028
|
+
const line = document.createElement("p");
|
|
5029
|
+
line.textContent = `Progress ${notice.percent !== void 0 ? `${notice.percent}%` : ""} of the call ${notice.callid.slice(0, 12)} \xB7 ${notice.message}${notice.cancellable ? " \xB7 cancellable" : ""} \xB7 ${new Date(notice.at).toISOString()}.`;
|
|
5030
|
+
streambox.append(line);
|
|
5031
|
+
}
|
|
5032
|
+
for (const chunk of (mcp.chunks ?? []).slice(0, 10)) {
|
|
5033
|
+
const line = document.createElement("p");
|
|
5034
|
+
line.textContent = `Chunk ${chunk.seq}${chunk.done ? " (done)" : ""} of the call ${chunk.callid.slice(0, 12)} \xB7 ${chunk.content.slice(0, 60)}${chunk.content.length > 60 ? "\u2026" : ""}`;
|
|
5035
|
+
streambox.append(line);
|
|
5036
|
+
}
|
|
5037
|
+
if ((mcp.chunks?.length ?? 0) === 0 && (mcp.progressnotices?.length ?? 0) === 0) {
|
|
5038
|
+
const empty = document.createElement("p");
|
|
5039
|
+
empty.textContent = "No streamed result yet; a streaming call delivers its content in ordered chunks with progress notices in between.";
|
|
5040
|
+
streambox.append(empty);
|
|
5041
|
+
}
|
|
5042
|
+
agentprotocolroot.append(streambox);
|
|
5043
|
+
const samplingbox = document.createElement("details");
|
|
5044
|
+
samplingbox.className = "sessiongroup";
|
|
5045
|
+
const samplingsummary = document.createElement("summary");
|
|
5046
|
+
samplingsummary.textContent = `Sampling callbacks (${mcp.sampling?.length ?? 0})`;
|
|
5047
|
+
samplingbox.append(samplingsummary);
|
|
5048
|
+
for (const callback of mcp.sampling ?? []) {
|
|
5049
|
+
const line = document.createElement("p");
|
|
5050
|
+
line.textContent = `${callback.state} \xB7 client ${callback.clientid} \xB7 requested ${new Date(callback.requestedat).toISOString()}${callback.answeredat !== void 0 ? ` \xB7 answered ${new Date(callback.answeredat).toISOString()}` : ""}${callback.pagecontent !== void 0 ? " \xB7 page content granted" : " \xB7 page content stripped"}.`;
|
|
5051
|
+
samplingbox.append(line);
|
|
5052
|
+
const payload = document.createElement("p");
|
|
5053
|
+
payload.textContent = `Prompt: ${callback.prompt}${callback.system !== void 0 ? ` System: ${callback.system}` : ""}${callback.answer !== void 0 ? ` Answer: ${callback.answer}` : ""}`;
|
|
5054
|
+
samplingbox.append(payload);
|
|
5055
|
+
if (callback.state === "pending") {
|
|
5056
|
+
const actions = document.createElement("div");
|
|
5057
|
+
actions.className = "actions";
|
|
5058
|
+
const answerinput = document.createElement("input");
|
|
5059
|
+
answerinput.placeholder = "client answer for the local test";
|
|
5060
|
+
actions.append(answerinput, " ", button("Record answer", async () => {
|
|
5061
|
+
await request({ kind: "mcpsampling", respond: true, samplingid: callback.id, ...answerinput.value.trim() !== "" ? { answer: answerinput.value.trim() } : { refused: true } });
|
|
5062
|
+
status(`Closed the sampling round trip ${callback.id.slice(0, 12)}.`);
|
|
5063
|
+
await refresh();
|
|
5064
|
+
}));
|
|
5065
|
+
samplingbox.append(actions);
|
|
5066
|
+
}
|
|
5067
|
+
}
|
|
5068
|
+
if ((mcp.sampling?.length ?? 0) === 0) {
|
|
5069
|
+
const empty = document.createElement("p");
|
|
5070
|
+
empty.textContent = "No sampling callback yet; a callback asks a paired client model for a completion and the page content rides it only behind the user grant.";
|
|
5071
|
+
samplingbox.append(empty);
|
|
5072
|
+
}
|
|
5073
|
+
const samplingactions = document.createElement("div");
|
|
5074
|
+
samplingactions.className = "actions";
|
|
5075
|
+
const samplingclientinput = document.createElement("input");
|
|
5076
|
+
samplingclientinput.placeholder = "client id";
|
|
5077
|
+
const samplingpromptinput = document.createElement("input");
|
|
5078
|
+
samplingpromptinput.placeholder = "prompt for the client model";
|
|
5079
|
+
const samplingpageinput = document.createElement("input");
|
|
5080
|
+
samplingpageinput.placeholder = "page content (empty: none)";
|
|
5081
|
+
samplingactions.append(samplingclientinput, " ", samplingpromptinput, " ", samplingpageinput, " ", button("Ask client model", async () => {
|
|
5082
|
+
if (samplingclientinput.value.trim() === "" || samplingpromptinput.value.trim() === "") {
|
|
5083
|
+
status("The sampling callback needs the client id and the prompt.", true);
|
|
5084
|
+
return;
|
|
5085
|
+
}
|
|
5086
|
+
await request({ kind: "mcpsampling", clientid: samplingclientinput.value.trim(), prompt: samplingpromptinput.value.trim(), ...samplingpageinput.value.trim() !== "" ? { pagecontent: samplingpageinput.value.trim(), pagegrant: true } : {} });
|
|
5087
|
+
status(`Sent one sampling callback to the client ${samplingclientinput.value.trim()}; the exact payload rides this view.`);
|
|
5088
|
+
await refresh();
|
|
5089
|
+
}));
|
|
5090
|
+
samplingbox.append(samplingactions);
|
|
5091
|
+
agentprotocolroot.append(samplingbox);
|
|
5092
|
+
const subsbox = document.createElement("details");
|
|
5093
|
+
subsbox.className = "sessiongroup";
|
|
5094
|
+
const subssummary = document.createElement("summary");
|
|
5095
|
+
subssummary.textContent = `Subscriptions (${mcp.subscriptions?.length ?? 0} event, ${mcp.watches?.length ?? 0} resource)`;
|
|
5096
|
+
subsbox.append(subssummary);
|
|
5097
|
+
for (const subscription of mcp.subscriptions ?? []) {
|
|
5098
|
+
const line = document.createElement("p");
|
|
5099
|
+
line.textContent = `Client ${subscription.clientid} \xB7 kinds ${subscription.kinds.join(", ")}${subscription.origin !== void 0 ? ` \xB7 origin ${subscription.origin}` : ""}${subscription.tool !== void 0 ? ` \xB7 tool ${subscription.tool}` : ""} \xB7 subscribed ${new Date(subscription.createdat).toISOString()}${subscription.lastdeliveredat !== void 0 ? ` \xB7 last delivery ${new Date(subscription.lastdeliveredat).toISOString()}` : ""}.`;
|
|
5100
|
+
subsbox.append(line);
|
|
5101
|
+
const actions = document.createElement("div");
|
|
5102
|
+
actions.className = "actions";
|
|
5103
|
+
actions.append(button("Unsubscribe", async () => {
|
|
5104
|
+
await request({ kind: "mcpsubscribe", clientid: subscription.clientid, subscriptionid: subscription.id, unsubscribe: true });
|
|
5105
|
+
status(`Cancelled the event subscription of the client ${subscription.clientid}.`);
|
|
5106
|
+
await refresh();
|
|
5107
|
+
}));
|
|
5108
|
+
subsbox.append(actions);
|
|
5109
|
+
}
|
|
5110
|
+
for (const watch of mcp.watches ?? []) {
|
|
5111
|
+
const line = document.createElement("p");
|
|
5112
|
+
line.textContent = `Client ${watch.clientid} watches the ${watch.resource} resource \xB7 since ${new Date(watch.createdat).toISOString()}${watch.lastdeliveredat !== void 0 ? ` \xB7 last delta ${new Date(watch.lastdeliveredat).toISOString()}` : ""}.`;
|
|
5113
|
+
subsbox.append(line);
|
|
5114
|
+
const actions = document.createElement("div");
|
|
5115
|
+
actions.className = "actions";
|
|
5116
|
+
actions.append(button("Unwatch", async () => {
|
|
5117
|
+
await request({ kind: "mcpresource", clientid: watch.clientid, watchid: watch.id, unwatch: true });
|
|
5118
|
+
status(`Cancelled the ${watch.resource} resource watcher of the client ${watch.clientid}.`);
|
|
5119
|
+
await refresh();
|
|
5120
|
+
}));
|
|
5121
|
+
subsbox.append(actions);
|
|
5122
|
+
}
|
|
5123
|
+
if ((mcp.subscriptions?.length ?? 0) === 0 && (mcp.watches?.length ?? 0) === 0) {
|
|
5124
|
+
const empty = document.createElement("p");
|
|
5125
|
+
empty.textContent = "No subscription yet; a paired client subscribes its event kinds and watches page state resources through the frame intake.";
|
|
5126
|
+
subsbox.append(empty);
|
|
5127
|
+
}
|
|
5128
|
+
agentprotocolroot.append(subsbox);
|
|
5129
|
+
const batchbox = document.createElement("details");
|
|
5130
|
+
batchbox.className = "sessiongroup";
|
|
5131
|
+
const batchsummary = document.createElement("summary");
|
|
5132
|
+
batchsummary.textContent = `Batch calls (${mcp.batches?.length ?? 0})`;
|
|
5133
|
+
batchbox.append(batchsummary);
|
|
5134
|
+
for (const batch of mcp.batches ?? []) {
|
|
5135
|
+
const line = document.createElement("p");
|
|
5136
|
+
const done = batch.outcomes.length;
|
|
5137
|
+
line.textContent = `${batch.state} \xB7 client ${batch.clientid} \xB7 ${done} of ${batch.calls.length} member${batch.calls.length === 1 ? "" : "s"} done \xB7 stop on error ${batch.stoponerror ? "on" : "off"} \xB7 created ${new Date(batch.createdat).toISOString()}.`;
|
|
5138
|
+
batchbox.append(line);
|
|
5139
|
+
for (const outcome of batch.outcomes.slice(0, 10)) {
|
|
5140
|
+
const item = document.createElement("p");
|
|
5141
|
+
item.textContent = ` ${outcome.ok ? "ran" : "failed"} \xB7 ${outcome.tool} (${outcome.callid}).`;
|
|
5142
|
+
batchbox.append(item);
|
|
5143
|
+
}
|
|
5144
|
+
}
|
|
5145
|
+
if ((mcp.batches?.length ?? 0) === 0) {
|
|
5146
|
+
const empty = document.createElement("p");
|
|
5147
|
+
empty.textContent = "No batch call yet; an ordered batch runs its members behind the gates and stops at the first error when the flag requests it.";
|
|
5148
|
+
batchbox.append(empty);
|
|
5149
|
+
}
|
|
5150
|
+
agentprotocolroot.append(batchbox);
|
|
4922
5151
|
const callsbox = document.createElement("details");
|
|
4923
5152
|
callsbox.className = "sessiongroup";
|
|
4924
5153
|
const callssummary = document.createElement("summary");
|
|
4925
|
-
callssummary.textContent = `
|
|
5154
|
+
callssummary.textContent = `Audited tool calls (${(mcp.calllog ?? mcp.calls).length} shown, every call logged)`;
|
|
4926
5155
|
callsbox.append(callssummary);
|
|
4927
|
-
for (const call of mcp.calls.slice(0, 25)) {
|
|
5156
|
+
for (const call of (mcp.calllog ?? mcp.calls).slice(0, 25)) {
|
|
4928
5157
|
const line = document.createElement("p");
|
|
4929
|
-
line.textContent = `${new Date(call.at).toISOString()} \xB7 ${call.clientid} \xB7 ${call.tool} \xB7 ${call.origin} \xB7 ${call.ok ? "ran behind the gates" : `refused${call.code !== void 0 ? ` (${call.code})` : ""}`}`;
|
|
5158
|
+
line.textContent = `${new Date(call.at).toISOString()} \xB7 ${call.clientid} \xB7 ${call.tool} \xB7 ${call.origin} \xB7 ${call.ok ? "ran behind the gates" : `refused${call.code !== void 0 ? ` (${call.code})` : ""}`}${call.dryrun === true ? " \xB7 dry run" : ""}${call.mocked === true ? " \xB7 mocked" : ""}${call.batchid !== void 0 ? " \xB7 batch member" : ""}${call.idempotencykey !== void 0 ? ` \xB7 key ${call.idempotencykey.slice(0, 10)}` : ""}${call.replayed === true ? " \xB7 idempotent replay" : ""}`;
|
|
4930
5159
|
callsbox.append(line);
|
|
4931
5160
|
}
|
|
4932
|
-
if (mcp.calls.length === 0) {
|
|
5161
|
+
if ((mcp.calllog ?? mcp.calls).length === 0) {
|
|
4933
5162
|
const empty = document.createElement("p");
|
|
4934
|
-
empty.textContent = "No tool call yet; every call records the client, tool and
|
|
5163
|
+
empty.textContent = "No tool call yet; every call records the client, tool, outcome and idempotency key without payloads.";
|
|
4935
5164
|
callsbox.append(empty);
|
|
4936
5165
|
}
|
|
4937
5166
|
agentprotocolroot.append(callsbox);
|