@wenathlan/extension 1.1.54 → 1.1.55

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.
@@ -4702,7 +4702,7 @@ function renderagentprotocol(context) {
4702
4702
  badge.className = "sessionbadge";
4703
4703
  badge.dataset.restored = "false";
4704
4704
  badge.textContent = client.paired ? "paired" : "waiting for approval";
4705
- headline.append(`${client.id} \xB7 ${client.transport}${client.capabilities !== void 0 ? ` \xB7 protocol ${client.capabilities.protocolversion} \xB7 tool floor ${client.capabilities.toolversion} \xB7 ${client.capabilities.tools} tools` : " \xB7 not negotiated yet"}`, badge);
4705
+ headline.append(`${client.id} \xB7 ${client.transport}${client.fingerprint !== void 0 ? ` \xB7 ${client.fingerprint.slice(0, 12)}` : ""}${client.capabilities !== void 0 ? ` \xB7 protocol ${client.capabilities.protocolversion} \xB7 tool floor ${client.toolfloor ?? client.capabilities.toolversion} \xB7 ${client.capabilities.tools} tools` : " \xB7 not negotiated yet"}`, badge);
4706
4706
  row.append(headline);
4707
4707
  const actions = document.createElement("div");
4708
4708
  actions.className = "actions";
@@ -4723,6 +4723,18 @@ function renderagentprotocol(context) {
4723
4723
  status(`Disconnected the client ${client.id}; its record stays for the audit trail.`);
4724
4724
  await refresh();
4725
4725
  }));
4726
+ const clienttokens = mcp.tokens.filter((token) => token.clientid === client.id && token.revokedat === void 0);
4727
+ for (const token of clienttokens) {
4728
+ const tokenline = document.createElement("p");
4729
+ const remaining = Math.max(0, Math.round((token.expiresat - Date.now()) / 1e3));
4730
+ tokenline.textContent = `Session token ${token.id.slice(0, 8)} \xB7 scopes ${token.scopes.join(", ") || "none"} \xB7 expires in ${Math.floor(remaining / 60)}m ${remaining % 60}s${token.revokedat !== void 0 ? " \xB7 revoked" : ""}.`;
4731
+ row.append(tokenline);
4732
+ }
4733
+ actions.append(" ", button("Revoke client", async () => {
4734
+ await request({ kind: "mcprevokeclient", clientid: client.id });
4735
+ status(`Revoked the client ${client.id}; its tokens stopped verifying at once.`);
4736
+ await refresh();
4737
+ }));
4726
4738
  row.append(actions);
4727
4739
  clientsbox.append(row);
4728
4740
  }
@@ -4732,6 +4744,155 @@ function renderagentprotocol(context) {
4732
4744
  clientsbox.append(empty);
4733
4745
  }
4734
4746
  agentprotocolroot.append(clientsbox);
4747
+ const approvalsbox = document.createElement("details");
4748
+ approvalsbox.className = "sessiongroup";
4749
+ approvalsbox.open = true;
4750
+ const approvalssummary = document.createElement("summary");
4751
+ const pendingapprovals = mcp.approvals.filter((request2) => request2.state === "pending");
4752
+ approvalssummary.textContent = `Approval gates (${pendingapprovals.length} pending, ${mcp.approvals.length - pendingapprovals.length} resolved)`;
4753
+ approvalsbox.append(approvalssummary);
4754
+ for (const gate of mcp.approvals.slice(0, 10)) {
4755
+ const card = document.createElement("div");
4756
+ card.className = "sessionrow";
4757
+ const identity = mcp.identities.find((entry) => entry.fingerprint === mcp.clients.find((client) => client.id === gate.clientid)?.fingerprint);
4758
+ const headline = document.createElement("p");
4759
+ const secrets = gate.secretfields ?? [];
4760
+ const shown = {};
4761
+ for (const [name, value] of Object.entries(gate.params)) shown[name] = secrets.includes(name) ? "[redacted]" : value;
4762
+ headline.textContent = `${gate.state === "pending" ? "PENDING" : gate.state.toUpperCase()} \xB7 ${identity?.displayname ?? gate.clientid} calls ${gate.tool} \xB7 ${gate.reason} Arguments: ${JSON.stringify(shown)}${gate.timeoutat !== void 0 ? ` \xB7 refuses by default at ${new Date(gate.timeoutat).toISOString()}` : ""}.`;
4763
+ card.append(headline);
4764
+ if (gate.state === "pending") {
4765
+ const actions = document.createElement("div");
4766
+ actions.className = "actions";
4767
+ actions.append(button("Approve", async () => {
4768
+ await request({ kind: "mcpapprovaldecision", approvalid: gate.id, approved: true });
4769
+ status(`Approved the ${gate.tool} call of the client ${gate.clientid}; the gate executed the held call.`);
4770
+ await refresh();
4771
+ }));
4772
+ actions.append(" ", button("Refuse", async () => {
4773
+ await request({ kind: "mcpapprovaldecision", approvalid: gate.id, approved: false });
4774
+ status(`Refused the ${gate.tool} call of the client ${gate.clientid}; the pending call never executes.`);
4775
+ await refresh();
4776
+ }));
4777
+ card.append(actions);
4778
+ }
4779
+ approvalsbox.append(card);
4780
+ }
4781
+ if (mcp.approvals.length === 0) {
4782
+ const empty = document.createElement("p");
4783
+ empty.textContent = "No approval gate yet; every sensitive call a remote client raises lands here with its full arguments before anything executes.";
4784
+ approvalsbox.append(empty);
4785
+ }
4786
+ agentprotocolroot.append(approvalsbox);
4787
+ const remotebox = document.createElement("details");
4788
+ remotebox.className = "sessiongroup";
4789
+ const remotesummary = document.createElement("summary");
4790
+ remotesummary.textContent = `Remote transport (${mcp.remote.channelsopen} live channel${mcp.remote.channelsopen === 1 ? "" : "s"}, ${mcp.remote.channelsdead} closed)`;
4791
+ remotebox.append(remotesummary);
4792
+ const remoteline = document.createElement("p");
4793
+ remoteline.textContent = `Endpoint ${mcp.remote.endpoint} \xB7 tls ${mcp.remote.tls.mode}${mcp.remote.tls.certificaterequired ? " (certificate required)" : ""}${mcp.remote.tls.verified ? " and verified" : " and unverified"} \xB7 ${mcp.remote.paired} of ${mcp.remote.clients} client${mcp.remote.clients === 1 ? "" : "s"} paired \xB7 ${mcp.remote.tokenslive} live token${mcp.remote.tokenslive === 1 ? "" : "s"}.`;
4794
+ remotebox.append(remoteline);
4795
+ for (const channel of mcp.channels.slice(0, 10)) {
4796
+ const line = document.createElement("p");
4797
+ const beatage = Math.max(0, Math.round((Date.now() - channel.lastbeatat) / 1e3));
4798
+ line.textContent = `Stream channel ${channel.id.slice(0, 12)} of ${channel.clientid} \xB7 ${channel.closedat === void 0 ? `heartbeat ${beatage}s ago` : `closed at ${new Date(channel.closedat).toISOString()}`}.`;
4799
+ remotebox.append(line);
4800
+ }
4801
+ for (const shake of mcp.handshakes.slice(0, 5)) {
4802
+ const line = document.createElement("p");
4803
+ line.textContent = `Auth handshake ${shake.method} of ${shake.clientid} \xB7 ${shake.outcome}${shake.outcome === "refused" ? " (consentrefused error, no pairing state leaked)" : ""} \xB7 ${new Date(shake.at).toISOString()}.`;
4804
+ remotebox.append(line);
4805
+ }
4806
+ const pairingline = document.createElement("p");
4807
+ pairingline.textContent = mcp.pairing.length > 0 ? `Pairing code ${mcp.pairing[0]?.code} for ${mcp.pairing[0]?.scopes.join(", ") || "no"} namespaces \xB7 expires at ${new Date(mcp.pairing[0]?.expiresat ?? Date.now()).toISOString()} \xB7 single use.` : "No pairing code pending; issue one while a session is live to pair a remote client.";
4808
+ remotebox.append(pairingline);
4809
+ const pairingactions = document.createElement("div");
4810
+ pairingactions.className = "actions";
4811
+ pairingactions.append(button("Issue pairing code", async () => {
4812
+ await request({ kind: "mcppairing", scopes: ["browser", "workflow", "memory", "system"] });
4813
+ status("Issued one single use pairing code; copy it to the remote client before its window closes.");
4814
+ await refresh();
4815
+ }));
4816
+ pairingactions.append(" ", button("Copy pairing code", async () => {
4817
+ const code = mcp.pairing[0]?.code ?? "";
4818
+ if (code === "") {
4819
+ status("No pending pairing code to copy.", true);
4820
+ return;
4821
+ }
4822
+ await navigator.clipboard.writeText(code).then(() => status(`Copied the pairing code ${code} to the clipboard.`)).catch(() => status(`Pairing code: ${code} (the clipboard permission was refused).`, true));
4823
+ }));
4824
+ remotebox.append(pairingactions);
4825
+ const tlsheadline = document.createElement("p");
4826
+ tlsheadline.textContent = "Tls certificate options of the remote transport: the mode and the reviewed sha-256 fingerprint stay user choices with no hardcoded certificate.";
4827
+ remotebox.append(tlsheadline);
4828
+ const tlsactions = document.createElement("div");
4829
+ tlsactions.className = "actions";
4830
+ const endpointinput = document.createElement("input");
4831
+ endpointinput.placeholder = "remote endpoint url";
4832
+ endpointinput.value = mcp.config.remoteaccess?.endpoint ?? "";
4833
+ const tlsmodeinput = document.createElement("input");
4834
+ tlsmodeinput.placeholder = "tls mode: off, on or required";
4835
+ tlsmodeinput.value = mcp.config.remoteaccess?.tls.mode ?? "off";
4836
+ const certinput = document.createElement("input");
4837
+ certinput.placeholder = "certificate sha-256 fingerprint";
4838
+ certinput.value = mcp.config.httpstream?.tls.certificatefingerprint ?? "";
4839
+ const maxclientsinput = document.createElement("input");
4840
+ maxclientsinput.placeholder = "max clients (empty: unbounded)";
4841
+ maxclientsinput.value = mcp.config.remoteaccess?.maxclients !== void 0 ? String(mcp.config.remoteaccess.maxclients) : "";
4842
+ const timeoutinput = document.createElement("input");
4843
+ timeoutinput.placeholder = "approval window ms";
4844
+ timeoutinput.value = mcp.config.remoteaccess?.approvaltimeout !== void 0 ? String(mcp.config.remoteaccess.approvaltimeout.windowms) : "";
4845
+ tlsactions.append(endpointinput, " ", tlsmodeinput, " ", certinput, " ", maxclientsinput, " ", timeoutinput, " ", button("Save remote config", async () => {
4846
+ await request({ kind: "mcpremoteconfig", endpoint: endpointinput.value, tlsmode: tlsmodeinput.value, ...certinput.value.trim() !== "" ? { certificatefingerprint: certinput.value } : {}, ...maxclientsinput.value.trim() !== "" ? { maxclients: Number(maxclientsinput.value) } : {}, ...timeoutinput.value.trim() !== "" ? { approvaltimeoutms: Number(timeoutinput.value) } : {}, reviewed: true });
4847
+ status(`Saved the remote transport config for ${endpointinput.value} with the ${tlsmodeinput.value} tls mode.`);
4848
+ await refresh();
4849
+ }));
4850
+ remotebox.append(tlsactions);
4851
+ agentprotocolroot.append(remotebox);
4852
+ const allowlistbox = document.createElement("details");
4853
+ allowlistbox.className = "sessiongroup";
4854
+ const allowlistsummary = document.createElement("summary");
4855
+ allowlistsummary.textContent = `Client allowlist (${mcp.allowlist.length} entr${mcp.allowlist.length === 1 ? "y" : "ies"})`;
4856
+ allowlistbox.append(allowlistsummary);
4857
+ for (const entry of mcp.allowlist) {
4858
+ const line = document.createElement("p");
4859
+ line.textContent = `${entry.displayname} \xB7 ${entry.fingerprint.slice(0, 12)} \xB7 namespaces ${entry.namespaces.join(", ") || "none"} \xB7 granted ${new Date(entry.grantedat).toISOString()} \xB7 ${entry.history.length} grant change${entry.history.length === 1 ? "" : "s"}.`;
4860
+ allowlistbox.append(line);
4861
+ const actions = document.createElement("div");
4862
+ actions.className = "actions";
4863
+ actions.append(button(`Rescope to browser+memory`, async () => {
4864
+ await request({ kind: "mcpallowlist", fingerprint: entry.fingerprint, displayname: entry.displayname, namespaces: ["browser", "memory"] });
4865
+ status(`Rescoped the allowlist entry ${entry.displayname} to the browser and memory namespaces.`);
4866
+ await refresh();
4867
+ }));
4868
+ actions.append(" ", button("Refuse entry", async () => {
4869
+ await request({ kind: "mcpallowlist", fingerprint: entry.fingerprint, remove: true });
4870
+ status(`Refused the allowlist entry ${entry.displayname}; its fingerprint stops passing the check.`);
4871
+ await refresh();
4872
+ }));
4873
+ allowlistbox.append(actions);
4874
+ }
4875
+ const allowactions = document.createElement("div");
4876
+ allowactions.className = "actions";
4877
+ const fingerprintinput = document.createElement("input");
4878
+ fingerprintinput.placeholder = "client fingerprint";
4879
+ const displayinput = document.createElement("input");
4880
+ displayinput.placeholder = "display name";
4881
+ const scopesinput = document.createElement("input");
4882
+ scopesinput.placeholder = "namespaces: browser,workflow,memory,system";
4883
+ allowactions.append(fingerprintinput, " ", displayinput, " ", scopesinput, " ", button("Allow client", async () => {
4884
+ const namespaces = scopesinput.value.split(",").map((scope) => scope.trim()).filter((scope) => scope !== "");
4885
+ await request({ kind: "mcpallowlist", fingerprint: fingerprintinput.value, ...displayinput.value.trim() !== "" ? { displayname: displayinput.value } : {}, namespaces });
4886
+ status(`Allowed the client ${displayinput.value || fingerprintinput.value} the ${namespaces.join(", ") || "no"} namespaces.`);
4887
+ await refresh();
4888
+ }));
4889
+ allowlistbox.append(allowactions);
4890
+ if (mcp.allowlist.length === 0) {
4891
+ const empty = document.createElement("p");
4892
+ empty.textContent = "No allowlist entry yet; a remote client pairs through the one time code or the user allows a known fingerprint with its namespace scopes.";
4893
+ allowlistbox.append(empty);
4894
+ }
4895
+ agentprotocolroot.append(allowlistbox);
4735
4896
  const catalogbox = document.createElement("details");
4736
4897
  catalogbox.className = "sessiongroup";
4737
4898
  const catalogsummary = document.createElement("summary");
@@ -4752,7 +4913,7 @@ function renderagentprotocol(context) {
4752
4913
  domain.append(domainsummary);
4753
4914
  for (const tool of tools) {
4754
4915
  const line = document.createElement("p");
4755
- line.textContent = `${tool.name} v${tool.version} \xB7 ${tool.risk} \xB7 ${tool.description.split(".")[0] ?? tool.description}${tool.consentmeta !== void 0 ? ` \xB7 review: ${tool.consentmeta}` : ""}`;
4916
+ line.textContent = `${tool.name} v${tool.version} \xB7 ${tool.risk} \xB7 ${tool.description.split(".")[0] ?? tool.description}${tool.consentmeta !== void 0 ? ` \xB7 ${tool.consentmeta.riskclass} \xB7 approval gate ${tool.consentmeta.approvalrequired ? "required" : "off"} \xB7 ${tool.consentmeta.originscope} scope \xB7 review: ${tool.consentmeta.review}` : ""}`;
4756
4917
  domain.append(line);
4757
4918
  }
4758
4919
  catalogbox.append(domain);