@opentabs-dev/browser-extension 0.0.57 → 0.0.59
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/dist/background-message-handlers.d.ts +4 -8
- package/dist/background-message-handlers.d.ts.map +1 -1
- package/dist/background-message-handlers.js +59 -114
- package/dist/background-message-handlers.js.map +1 -1
- package/dist/background.js +76 -200
- package/dist/extension-messages.d.ts +10 -21
- package/dist/extension-messages.d.ts.map +1 -1
- package/dist/message-router.d.ts +2 -0
- package/dist/message-router.d.ts.map +1 -1
- package/dist/message-router.js +26 -6
- package/dist/message-router.js.map +1 -1
- package/dist/side-panel/bridge.d.ts +3 -1
- package/dist/side-panel/bridge.d.ts.map +1 -1
- package/dist/side-panel/bridge.js +3 -1
- package/dist/side-panel/bridge.js.map +1 -1
- package/dist/side-panel/components/PluginCard.d.ts.map +1 -1
- package/dist/side-panel/components/PluginCard.js +43 -3
- package/dist/side-panel/components/PluginCard.js.map +1 -1
- package/dist/side-panel/components/PluginIcon.d.ts +3 -1
- package/dist/side-panel/components/PluginIcon.d.ts.map +1 -1
- package/dist/side-panel/components/PluginIcon.js +10 -3
- package/dist/side-panel/components/PluginIcon.js.map +1 -1
- package/dist/side-panel/side-panel.js +188 -99
- package/dist/side-panel/styles.css +1 -1
- package/dist/tool-dispatch.d.ts.map +1 -1
- package/dist/tool-dispatch.js +4 -133
- package/dist/tool-dispatch.js.map +1 -1
- package/manifest.json +1 -1
- package/package.json +1 -1
package/dist/background.js
CHANGED
|
@@ -3607,67 +3607,6 @@ var removeProgressListener = (tabId, dispatchId) => {
|
|
|
3607
3607
|
}).catch(() => {
|
|
3608
3608
|
});
|
|
3609
3609
|
};
|
|
3610
|
-
var injectFetchProxyBridge = async (tabId, dispatchId) => {
|
|
3611
|
-
try {
|
|
3612
|
-
await chrome.scripting.executeScript({
|
|
3613
|
-
target: { tabId },
|
|
3614
|
-
world: "ISOLATED",
|
|
3615
|
-
func: (dId) => {
|
|
3616
|
-
const pendingRequestIds = /* @__PURE__ */ new Set();
|
|
3617
|
-
const requestEventName = `opentabs:fetch-proxy:request:${dId}`;
|
|
3618
|
-
const requestHandler = (e) => {
|
|
3619
|
-
const detail = e.detail;
|
|
3620
|
-
if (!detail)
|
|
3621
|
-
return;
|
|
3622
|
-
pendingRequestIds.add(detail.requestId);
|
|
3623
|
-
void chrome.runtime.sendMessage({
|
|
3624
|
-
type: "fetch:proxy",
|
|
3625
|
-
requestId: detail.requestId,
|
|
3626
|
-
url: detail.url,
|
|
3627
|
-
method: detail.method,
|
|
3628
|
-
headers: detail.headers,
|
|
3629
|
-
body: detail.body,
|
|
3630
|
-
pluginName: detail.pluginName
|
|
3631
|
-
});
|
|
3632
|
-
};
|
|
3633
|
-
document.addEventListener(requestEventName, requestHandler);
|
|
3634
|
-
const responseHandler = (msg) => {
|
|
3635
|
-
if (msg.type !== "fetch:proxy:response")
|
|
3636
|
-
return;
|
|
3637
|
-
if (!msg.requestId || !pendingRequestIds.has(msg.requestId))
|
|
3638
|
-
return;
|
|
3639
|
-
pendingRequestIds.delete(msg.requestId);
|
|
3640
|
-
document.dispatchEvent(new CustomEvent(`opentabs:fetch-proxy:response:${msg.requestId}`, { detail: msg }));
|
|
3641
|
-
};
|
|
3642
|
-
chrome.runtime.onMessage.addListener(responseHandler);
|
|
3643
|
-
const cleanupKey = `__opentabs_fetch_proxy_cleanup_${dId}`;
|
|
3644
|
-
const doc = document;
|
|
3645
|
-
doc[cleanupKey] = () => {
|
|
3646
|
-
document.removeEventListener(requestEventName, requestHandler);
|
|
3647
|
-
chrome.runtime.onMessage.removeListener(responseHandler);
|
|
3648
|
-
pendingRequestIds.clear();
|
|
3649
|
-
doc[cleanupKey] = void 0;
|
|
3650
|
-
};
|
|
3651
|
-
},
|
|
3652
|
-
args: [dispatchId]
|
|
3653
|
-
});
|
|
3654
|
-
} catch {
|
|
3655
|
-
}
|
|
3656
|
-
};
|
|
3657
|
-
var removeFetchProxyBridge = (tabId, dispatchId) => {
|
|
3658
|
-
chrome.scripting.executeScript({
|
|
3659
|
-
target: { tabId },
|
|
3660
|
-
world: "ISOLATED",
|
|
3661
|
-
func: (dId) => {
|
|
3662
|
-
const cleanupKey = `__opentabs_fetch_proxy_cleanup_${dId}`;
|
|
3663
|
-
const cleanup = document[cleanupKey];
|
|
3664
|
-
if (cleanup)
|
|
3665
|
-
cleanup();
|
|
3666
|
-
},
|
|
3667
|
-
args: [dispatchId]
|
|
3668
|
-
}).catch(() => {
|
|
3669
|
-
});
|
|
3670
|
-
};
|
|
3671
3610
|
var executeToolOnTab = async (tabId, pluginName, toolName, input, dispatchId) => {
|
|
3672
3611
|
let timeoutId;
|
|
3673
3612
|
const startTs = Date.now();
|
|
@@ -3710,7 +3649,6 @@ var executeToolOnTab = async (tabId, pluginName, toolName, input, dispatchId) =>
|
|
|
3710
3649
|
if (!tool || typeof tool.handle !== "function") {
|
|
3711
3650
|
return { type: "error", code: -32603, message: `Tool "${tName}" not found in adapter "${pName}"` };
|
|
3712
3651
|
}
|
|
3713
|
-
let fetchCounter = 0;
|
|
3714
3652
|
const context = {
|
|
3715
3653
|
reportProgress(opts) {
|
|
3716
3654
|
try {
|
|
@@ -3724,47 +3662,6 @@ var executeToolOnTab = async (tabId, pluginName, toolName, input, dispatchId) =>
|
|
|
3724
3662
|
}));
|
|
3725
3663
|
} catch {
|
|
3726
3664
|
}
|
|
3727
|
-
},
|
|
3728
|
-
fetchViaBackground(url, init) {
|
|
3729
|
-
return new Promise((resolve, reject) => {
|
|
3730
|
-
const requestId = `${dId}:${fetchCounter++}`;
|
|
3731
|
-
const responseEvent = `opentabs:fetch-proxy:response:${requestId}`;
|
|
3732
|
-
const timeout = setTimeout(() => {
|
|
3733
|
-
document.removeEventListener(responseEvent, handler);
|
|
3734
|
-
reject(new Error("Fetch proxy timeout after 30s"));
|
|
3735
|
-
}, 3e4);
|
|
3736
|
-
const handler = (e) => {
|
|
3737
|
-
clearTimeout(timeout);
|
|
3738
|
-
document.removeEventListener(responseEvent, handler);
|
|
3739
|
-
const detail = e.detail;
|
|
3740
|
-
if (detail.error) {
|
|
3741
|
-
reject(new Error(detail.error));
|
|
3742
|
-
return;
|
|
3743
|
-
}
|
|
3744
|
-
resolve({
|
|
3745
|
-
status: detail.status,
|
|
3746
|
-
statusText: detail.statusText,
|
|
3747
|
-
headers: detail.headers,
|
|
3748
|
-
body: detail.body,
|
|
3749
|
-
ok: detail.status >= 200 && detail.status < 300
|
|
3750
|
-
});
|
|
3751
|
-
};
|
|
3752
|
-
document.addEventListener(responseEvent, handler);
|
|
3753
|
-
let headersObj = {};
|
|
3754
|
-
if (init?.headers) {
|
|
3755
|
-
headersObj = Object.fromEntries(new Headers(init.headers).entries());
|
|
3756
|
-
}
|
|
3757
|
-
document.dispatchEvent(new CustomEvent(`opentabs:fetch-proxy:request:${dId}`, {
|
|
3758
|
-
detail: {
|
|
3759
|
-
requestId,
|
|
3760
|
-
url,
|
|
3761
|
-
method: init?.method ?? "GET",
|
|
3762
|
-
headers: headersObj,
|
|
3763
|
-
body: typeof init?.body === "string" ? init.body : init?.body ? JSON.stringify(init.body) : void 0,
|
|
3764
|
-
pluginName: pName
|
|
3765
|
-
}
|
|
3766
|
-
}));
|
|
3767
|
-
});
|
|
3768
3665
|
}
|
|
3769
3666
|
};
|
|
3770
3667
|
try {
|
|
@@ -3882,12 +3779,10 @@ var handleToolDispatch = async (params, id) => {
|
|
|
3882
3779
|
const executeOnTab = async (tid) => {
|
|
3883
3780
|
await injectToolInvocationLog(tid, pluginName, toolName, link);
|
|
3884
3781
|
await injectProgressListener(tid, dispatchId);
|
|
3885
|
-
await injectFetchProxyBridge(tid, dispatchId);
|
|
3886
3782
|
try {
|
|
3887
3783
|
return await executeToolOnTab(tid, pluginName, toolName, input, dispatchId);
|
|
3888
3784
|
} finally {
|
|
3889
3785
|
removeProgressListener(tid, dispatchId);
|
|
3890
|
-
removeFetchProxyBridge(tid, dispatchId);
|
|
3891
3786
|
}
|
|
3892
3787
|
};
|
|
3893
3788
|
if (targetTabId !== void 0) {
|
|
@@ -3945,6 +3840,8 @@ var toPluginMeta = (p) => ({
|
|
|
3945
3840
|
adapterFile: p.adapterFile,
|
|
3946
3841
|
iconSvg: p.iconSvg,
|
|
3947
3842
|
iconInactiveSvg: p.iconInactiveSvg,
|
|
3843
|
+
iconDarkSvg: p.iconDarkSvg,
|
|
3844
|
+
iconDarkInactiveSvg: p.iconDarkInactiveSvg,
|
|
3948
3845
|
tools: p.tools
|
|
3949
3846
|
});
|
|
3950
3847
|
var validatePluginPayload = (raw) => {
|
|
@@ -3971,6 +3868,7 @@ var validatePluginPayload = (raw) => {
|
|
|
3971
3868
|
displayName: typeof t.displayName === "string" ? t.displayName : t.name,
|
|
3972
3869
|
description: t.description,
|
|
3973
3870
|
icon: typeof t.icon === "string" ? t.icon : "wrench",
|
|
3871
|
+
...typeof t.group === "string" ? { group: t.group } : {},
|
|
3974
3872
|
enabled: typeof t.enabled === "boolean" ? t.enabled : true
|
|
3975
3873
|
};
|
|
3976
3874
|
}) : [];
|
|
@@ -3985,6 +3883,8 @@ var validatePluginPayload = (raw) => {
|
|
|
3985
3883
|
adapterFile: typeof obj.adapterFile === "string" ? obj.adapterFile : void 0,
|
|
3986
3884
|
iconSvg: typeof obj.iconSvg === "string" ? obj.iconSvg : void 0,
|
|
3987
3885
|
iconInactiveSvg: typeof obj.iconInactiveSvg === "string" ? obj.iconInactiveSvg : void 0,
|
|
3886
|
+
iconDarkSvg: typeof obj.iconDarkSvg === "string" ? obj.iconDarkSvg : void 0,
|
|
3887
|
+
iconDarkInactiveSvg: typeof obj.iconDarkInactiveSvg === "string" ? obj.iconDarkInactiveSvg : void 0,
|
|
3988
3888
|
tools
|
|
3989
3889
|
};
|
|
3990
3890
|
};
|
|
@@ -4059,7 +3959,9 @@ var handleSyncFull = async (params) => {
|
|
|
4059
3959
|
iconSvg: p.iconSvg,
|
|
4060
3960
|
iconInactiveSvg: p.iconInactiveSvg,
|
|
4061
3961
|
...typeof raw?.sdkVersion === "string" ? { sdkVersion: raw.sdkVersion } : {},
|
|
4062
|
-
...raw?.update && typeof raw.update === "object" ? {
|
|
3962
|
+
...raw?.update && typeof raw.update === "object" ? {
|
|
3963
|
+
update: raw.update
|
|
3964
|
+
} : {}
|
|
4063
3965
|
};
|
|
4064
3966
|
});
|
|
4065
3967
|
const rawFailedPlugins = Array.isArray(params.failedPlugins) ? params.failedPlugins : void 0;
|
|
@@ -4105,7 +4007,9 @@ var handlePluginUpdate = async (params) => {
|
|
|
4105
4007
|
iconSvg: validated.iconSvg,
|
|
4106
4008
|
iconInactiveSvg: validated.iconInactiveSvg,
|
|
4107
4009
|
...typeof params.sdkVersion === "string" ? { sdkVersion: params.sdkVersion } : {},
|
|
4108
|
-
...params.update && typeof params.update === "object" ? {
|
|
4010
|
+
...params.update && typeof params.update === "object" ? {
|
|
4011
|
+
update: params.update
|
|
4012
|
+
} : {}
|
|
4109
4013
|
};
|
|
4110
4014
|
const otherPlugins = existingCache.plugins.filter((p) => p.name !== validated.name);
|
|
4111
4015
|
updateServerStateCache({ plugins: [...otherPlugins, updatedPlugin] });
|
|
@@ -4127,7 +4031,10 @@ var handlePluginUninstall = async (params, id) => {
|
|
|
4127
4031
|
if (!isValidPluginName(pluginName)) {
|
|
4128
4032
|
sendToServer({
|
|
4129
4033
|
jsonrpc: "2.0",
|
|
4130
|
-
error: {
|
|
4034
|
+
error: {
|
|
4035
|
+
code: JSONRPC_INVALID_PARAMS,
|
|
4036
|
+
message: `Invalid plugin name format: "${pluginName}"`
|
|
4037
|
+
},
|
|
4131
4038
|
id
|
|
4132
4039
|
});
|
|
4133
4040
|
return;
|
|
@@ -4144,7 +4051,9 @@ var handlePluginUninstall = async (params, id) => {
|
|
|
4144
4051
|
await removePlugin(pluginName);
|
|
4145
4052
|
clearPluginTabState(pluginName);
|
|
4146
4053
|
const existingCache = getServerStateCache();
|
|
4147
|
-
updateServerStateCache({
|
|
4054
|
+
updateServerStateCache({
|
|
4055
|
+
plugins: existingCache.plugins.filter((p) => p.name !== pluginName)
|
|
4056
|
+
});
|
|
4148
4057
|
forwardToSidePanel({
|
|
4149
4058
|
type: "sp:serverMessage",
|
|
4150
4059
|
data: { jsonrpc: "2.0", method: "plugins.changed" }
|
|
@@ -4249,7 +4158,10 @@ var handleServerMessage = (message) => {
|
|
|
4249
4158
|
if (id !== void 0) {
|
|
4250
4159
|
sendToServer({
|
|
4251
4160
|
jsonrpc: "2.0",
|
|
4252
|
-
error: {
|
|
4161
|
+
error: {
|
|
4162
|
+
code: JSONRPC_INTERNAL_ERROR,
|
|
4163
|
+
message: `Rate limited: ${method}`
|
|
4164
|
+
},
|
|
4253
4165
|
id
|
|
4254
4166
|
});
|
|
4255
4167
|
}
|
|
@@ -4261,7 +4173,10 @@ var handleServerMessage = (message) => {
|
|
|
4261
4173
|
if (id !== void 0) {
|
|
4262
4174
|
sendToServer({
|
|
4263
4175
|
jsonrpc: "2.0",
|
|
4264
|
-
error: {
|
|
4176
|
+
error: {
|
|
4177
|
+
code: JSONRPC_METHOD_NOT_FOUND,
|
|
4178
|
+
message: `Method not found: ${method}`
|
|
4179
|
+
},
|
|
4265
4180
|
id
|
|
4266
4181
|
});
|
|
4267
4182
|
}
|
|
@@ -4442,93 +4357,6 @@ var handleToolProgress = (message, sendResponse) => {
|
|
|
4442
4357
|
}
|
|
4443
4358
|
sendResponse({ ok: true });
|
|
4444
4359
|
};
|
|
4445
|
-
var getRegistrableDomain = (hostname) => {
|
|
4446
|
-
const parts = hostname.split(".");
|
|
4447
|
-
if (parts.length <= 2)
|
|
4448
|
-
return hostname;
|
|
4449
|
-
return parts.slice(-2).join(".");
|
|
4450
|
-
};
|
|
4451
|
-
var hostnameFromPattern = (pattern) => {
|
|
4452
|
-
try {
|
|
4453
|
-
const normalized = pattern.replace(/^\*:\/\//, "https://");
|
|
4454
|
-
const url = new URL(normalized);
|
|
4455
|
-
return url.hostname.replace(/^\*\./, "");
|
|
4456
|
-
} catch {
|
|
4457
|
-
return void 0;
|
|
4458
|
-
}
|
|
4459
|
-
};
|
|
4460
|
-
var handleFetchProxy = (message, _sendResponse, senderTabId) => {
|
|
4461
|
-
const requestId = message.requestId;
|
|
4462
|
-
const url = message.url;
|
|
4463
|
-
const method = message.method;
|
|
4464
|
-
const headers = message.headers;
|
|
4465
|
-
const body = message.body;
|
|
4466
|
-
const pluginName = message.pluginName;
|
|
4467
|
-
const sendResult = (result) => {
|
|
4468
|
-
if (senderTabId === void 0)
|
|
4469
|
-
return;
|
|
4470
|
-
chrome.tabs.sendMessage(senderTabId, {
|
|
4471
|
-
type: "fetch:proxy:response",
|
|
4472
|
-
requestId,
|
|
4473
|
-
...result
|
|
4474
|
-
}).catch(() => {
|
|
4475
|
-
});
|
|
4476
|
-
};
|
|
4477
|
-
(async () => {
|
|
4478
|
-
const meta = await getPluginMeta(pluginName);
|
|
4479
|
-
if (!meta) {
|
|
4480
|
-
sendResult({ status: 0, statusText: "", headers: {}, body: "", error: `Unknown plugin: ${pluginName}` });
|
|
4481
|
-
return;
|
|
4482
|
-
}
|
|
4483
|
-
let requestHostname;
|
|
4484
|
-
try {
|
|
4485
|
-
requestHostname = new URL(url).hostname;
|
|
4486
|
-
} catch {
|
|
4487
|
-
sendResult({ status: 0, statusText: "", headers: {}, body: "", error: `Invalid URL: ${url}` });
|
|
4488
|
-
return;
|
|
4489
|
-
}
|
|
4490
|
-
const requestDomain = getRegistrableDomain(requestHostname);
|
|
4491
|
-
const domainAllowed = meta.urlPatterns.some((pattern) => {
|
|
4492
|
-
const patternHostname = hostnameFromPattern(pattern);
|
|
4493
|
-
if (!patternHostname)
|
|
4494
|
-
return false;
|
|
4495
|
-
return getRegistrableDomain(patternHostname) === requestDomain;
|
|
4496
|
-
});
|
|
4497
|
-
if (!domainAllowed) {
|
|
4498
|
-
sendResult({
|
|
4499
|
-
status: 0,
|
|
4500
|
-
statusText: "",
|
|
4501
|
-
headers: {},
|
|
4502
|
-
body: "",
|
|
4503
|
-
error: `Fetch proxy denied: ${requestHostname} does not match any urlPattern for plugin ${pluginName}`
|
|
4504
|
-
});
|
|
4505
|
-
return;
|
|
4506
|
-
}
|
|
4507
|
-
const cookies = await chrome.cookies.getAll({ url });
|
|
4508
|
-
const cookieHeader = cookies.map((c) => `${c.name}=${c.value}`).join("; ");
|
|
4509
|
-
const fetchHeaders = { ...headers };
|
|
4510
|
-
if (cookieHeader) {
|
|
4511
|
-
fetchHeaders.Cookie = cookieHeader;
|
|
4512
|
-
}
|
|
4513
|
-
const response = await fetch(url, {
|
|
4514
|
-
method,
|
|
4515
|
-
headers: fetchHeaders,
|
|
4516
|
-
body: body ?? void 0,
|
|
4517
|
-
signal: AbortSignal.timeout(3e4)
|
|
4518
|
-
});
|
|
4519
|
-
const responseHeaders = Object.fromEntries(response.headers.entries());
|
|
4520
|
-
const responseBody = await response.text();
|
|
4521
|
-
sendResult({
|
|
4522
|
-
status: response.status,
|
|
4523
|
-
statusText: response.statusText,
|
|
4524
|
-
headers: responseHeaders,
|
|
4525
|
-
body: responseBody
|
|
4526
|
-
});
|
|
4527
|
-
})().catch((err2) => {
|
|
4528
|
-
const errorMessage = err2 instanceof Error ? err2.message : String(err2);
|
|
4529
|
-
sendResult({ status: 0, statusText: "", headers: {}, body: "", error: errorMessage });
|
|
4530
|
-
});
|
|
4531
|
-
};
|
|
4532
4360
|
var handleSpConfirmationResponse = (message, sendResponse) => {
|
|
4533
4361
|
if (wsConnected) {
|
|
4534
4362
|
sendToServer({
|
|
@@ -4631,6 +4459,53 @@ var handleBgSetAllToolsEnabled = (message, sendResponse) => {
|
|
|
4631
4459
|
sendResponse({ error: err2 instanceof Error ? err2.message : String(err2) });
|
|
4632
4460
|
});
|
|
4633
4461
|
};
|
|
4462
|
+
var handleBgSetToolsEnabled = (message, sendResponse) => {
|
|
4463
|
+
const plugin = message.plugin;
|
|
4464
|
+
const toolNames = message.tools;
|
|
4465
|
+
const enabled = message.enabled;
|
|
4466
|
+
const cache2 = getServerStateCache();
|
|
4467
|
+
const pluginEntry = cache2.plugins.find((p) => p.name === plugin);
|
|
4468
|
+
const originalToolStates = /* @__PURE__ */ new Map();
|
|
4469
|
+
if (pluginEntry) {
|
|
4470
|
+
const toolNameSet2 = new Set(toolNames);
|
|
4471
|
+
for (const t of pluginEntry.tools) {
|
|
4472
|
+
if (toolNameSet2.has(t.name)) {
|
|
4473
|
+
originalToolStates.set(t.name, t.enabled);
|
|
4474
|
+
}
|
|
4475
|
+
}
|
|
4476
|
+
}
|
|
4477
|
+
const toolNameSet = new Set(toolNames);
|
|
4478
|
+
const updatedPlugins = cache2.plugins.map((p) => {
|
|
4479
|
+
if (p.name !== plugin)
|
|
4480
|
+
return p;
|
|
4481
|
+
return {
|
|
4482
|
+
...p,
|
|
4483
|
+
tools: p.tools.map((t) => toolNameSet.has(t.name) ? { ...t, enabled } : t)
|
|
4484
|
+
};
|
|
4485
|
+
});
|
|
4486
|
+
addPendingPluginAllToolsUpdate(plugin, toolNames, enabled);
|
|
4487
|
+
updateServerStateCache({ plugins: updatedPlugins });
|
|
4488
|
+
sendServerRequest("config.setToolsEnabled", { plugin, tools: toolNames, enabled }).then((result) => {
|
|
4489
|
+
removePendingPluginAllToolsUpdate(plugin, toolNames);
|
|
4490
|
+
sendResponse(result);
|
|
4491
|
+
}).catch((err2) => {
|
|
4492
|
+
removePendingPluginAllToolsUpdate(plugin, toolNames);
|
|
4493
|
+
const currentCache = getServerStateCache();
|
|
4494
|
+
const revertedPlugins = currentCache.plugins.map((p) => {
|
|
4495
|
+
if (p.name !== plugin)
|
|
4496
|
+
return p;
|
|
4497
|
+
return {
|
|
4498
|
+
...p,
|
|
4499
|
+
tools: p.tools.map((t) => ({
|
|
4500
|
+
...t,
|
|
4501
|
+
enabled: originalToolStates.get(t.name) ?? t.enabled
|
|
4502
|
+
}))
|
|
4503
|
+
};
|
|
4504
|
+
});
|
|
4505
|
+
updateServerStateCache({ plugins: revertedPlugins });
|
|
4506
|
+
sendResponse({ error: err2 instanceof Error ? err2.message : String(err2) });
|
|
4507
|
+
});
|
|
4508
|
+
};
|
|
4634
4509
|
var handleBgSetBrowserToolEnabled = (message, sendResponse) => {
|
|
4635
4510
|
const tool = message.tool;
|
|
4636
4511
|
const enabled = message.enabled;
|
|
@@ -4719,6 +4594,7 @@ var backgroundHandlers = /* @__PURE__ */ new Map([
|
|
|
4719
4594
|
["bg:getFullState", handleBgGetFullState],
|
|
4720
4595
|
["bg:setToolEnabled", handleBgSetToolEnabled],
|
|
4721
4596
|
["bg:setAllToolsEnabled", handleBgSetAllToolsEnabled],
|
|
4597
|
+
["bg:setToolsEnabled", handleBgSetToolsEnabled],
|
|
4722
4598
|
["bg:setBrowserToolEnabled", handleBgSetBrowserToolEnabled],
|
|
4723
4599
|
["bg:setAllBrowserToolsEnabled", handleBgSetAllBrowserToolsEnabled],
|
|
4724
4600
|
["bg:searchPlugins", handleBgSearchPlugins],
|
|
@@ -4727,7 +4603,6 @@ var backgroundHandlers = /* @__PURE__ */ new Map([
|
|
|
4727
4603
|
["bg:updatePlugin", handleBgUpdatePlugin],
|
|
4728
4604
|
["plugin:logs", handlePluginLogs],
|
|
4729
4605
|
["tool:progress", handleToolProgress],
|
|
4730
|
-
["fetch:proxy", handleFetchProxy],
|
|
4731
4606
|
["sp:confirmationResponse", handleSpConfirmationResponse],
|
|
4732
4607
|
["sp:confirmationTimeout", handleSpConfirmationTimeout],
|
|
4733
4608
|
["port-changed", handlePortChanged]
|
|
@@ -4739,6 +4614,7 @@ var EXTENSION_ONLY_TYPES = /* @__PURE__ */ new Set([
|
|
|
4739
4614
|
"bg:getFullState",
|
|
4740
4615
|
"bg:setToolEnabled",
|
|
4741
4616
|
"bg:setAllToolsEnabled",
|
|
4617
|
+
"bg:setToolsEnabled",
|
|
4742
4618
|
"bg:setBrowserToolEnabled",
|
|
4743
4619
|
"bg:setAllBrowserToolsEnabled",
|
|
4744
4620
|
"bg:searchPlugins",
|
|
@@ -4758,7 +4634,7 @@ var initBackgroundMessageHandlers = () => {
|
|
|
4758
4634
|
}
|
|
4759
4635
|
const handler = backgroundHandlers.get(message.type);
|
|
4760
4636
|
if (handler) {
|
|
4761
|
-
handler(message, sendResponse
|
|
4637
|
+
handler(message, sendResponse);
|
|
4762
4638
|
return true;
|
|
4763
4639
|
}
|
|
4764
4640
|
return false;
|
|
@@ -85,26 +85,6 @@ export interface ToolProgressMessage {
|
|
|
85
85
|
total: number;
|
|
86
86
|
message?: string;
|
|
87
87
|
}
|
|
88
|
-
/** Content script relay → Background: proxied fetch request from MAIN world tool handler */
|
|
89
|
-
export interface FetchProxyRequestMessage {
|
|
90
|
-
type: 'fetch:proxy';
|
|
91
|
-
requestId: string;
|
|
92
|
-
url: string;
|
|
93
|
-
method: string;
|
|
94
|
-
headers: Record<string, string>;
|
|
95
|
-
body: string | undefined;
|
|
96
|
-
pluginName: string;
|
|
97
|
-
}
|
|
98
|
-
/** Background → Content script: response to a proxied fetch request */
|
|
99
|
-
export interface FetchProxyResponseMessage {
|
|
100
|
-
type: 'fetch:proxy:response';
|
|
101
|
-
requestId: string;
|
|
102
|
-
status: number;
|
|
103
|
-
statusText: string;
|
|
104
|
-
headers: Record<string, string>;
|
|
105
|
-
body: string;
|
|
106
|
-
error?: string;
|
|
107
|
-
}
|
|
108
88
|
/** Side panel → Background: confirmation response from user */
|
|
109
89
|
export interface SpConfirmationResponseMessage {
|
|
110
90
|
type: 'sp:confirmationResponse';
|
|
@@ -132,6 +112,13 @@ export interface BgSetAllToolsEnabledMessage {
|
|
|
132
112
|
plugin: string;
|
|
133
113
|
enabled: boolean;
|
|
134
114
|
}
|
|
115
|
+
/** Side panel → Background: toggle a subset of tools for a plugin */
|
|
116
|
+
export interface BgSetToolsEnabledMessage {
|
|
117
|
+
type: 'bg:setToolsEnabled';
|
|
118
|
+
plugin: string;
|
|
119
|
+
tools: string[];
|
|
120
|
+
enabled: boolean;
|
|
121
|
+
}
|
|
135
122
|
/** Side panel → Background: toggle a browser tool's enabled state */
|
|
136
123
|
export interface BgSetBrowserToolEnabledMessage {
|
|
137
124
|
type: 'bg:setBrowserToolEnabled';
|
|
@@ -169,7 +156,7 @@ export interface PortChangedMessage {
|
|
|
169
156
|
port: number;
|
|
170
157
|
}
|
|
171
158
|
/** All internal message types flowing through chrome.runtime.sendMessage */
|
|
172
|
-
export type InternalMessage = OffscreenGetUrlMessage | WsStateMessage | WsDataMessage | WsSendMessage | WsGetStateMessage | WsSetUrlMessage | BgGetFullStateMessage | BgSetToolEnabledMessage | BgSetAllToolsEnabledMessage | BgSetBrowserToolEnabledMessage | BgSetAllBrowserToolsEnabledMessage | BgSearchPluginsMessage | BgInstallPluginMessage | BgRemovePluginMessage | BgUpdatePluginMessage | OffscreenGetLogsMessage | BgForceReconnectMessage | PluginLogsMessage | ToolProgressMessage |
|
|
159
|
+
export type InternalMessage = OffscreenGetUrlMessage | WsStateMessage | WsDataMessage | WsSendMessage | WsGetStateMessage | WsSetUrlMessage | BgGetFullStateMessage | BgSetToolEnabledMessage | BgSetAllToolsEnabledMessage | BgSetToolsEnabledMessage | BgSetBrowserToolEnabledMessage | BgSetAllBrowserToolsEnabledMessage | BgSearchPluginsMessage | BgInstallPluginMessage | BgRemovePluginMessage | BgUpdatePluginMessage | OffscreenGetLogsMessage | BgForceReconnectMessage | PluginLogsMessage | ToolProgressMessage | SpGetStateMessage | SpConnectionStateMessage | SpRelayMessage | SpConfirmationResponseMessage | SpConfirmationTimeoutMessage | PortChangedMessage;
|
|
173
160
|
/** Tab state info for a single plugin — shared shape used by tab.stateChanged payloads */
|
|
174
161
|
export interface PluginTabStateInfo {
|
|
175
162
|
state: TabState;
|
|
@@ -187,6 +174,8 @@ export interface PluginMeta {
|
|
|
187
174
|
adapterFile?: string;
|
|
188
175
|
iconSvg?: string;
|
|
189
176
|
iconInactiveSvg?: string;
|
|
177
|
+
iconDarkSvg?: string;
|
|
178
|
+
iconDarkInactiveSvg?: string;
|
|
190
179
|
tools: WireToolDef[];
|
|
191
180
|
}
|
|
192
181
|
//# sourceMappingURL=extension-messages.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension-messages.d.ts","sourceRoot":"","sources":["../src/extension-messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAU5F,mEAAmE;AACnE,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,kBAAkB,CAAC;CAC1B;AAED,0FAA0F;AAC1F,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GAAG,aAAa,GAAG,SAAS,CAAC;AAEhF,iEAAiE;AACjE,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,UAAU,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,iFAAiF;IACjF,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC;AAED,yEAAyE;AACzE,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED,+FAA+F;AAC/F,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;CACf;AAED,+DAA+D;AAC/D,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,aAAa,CAAC;CACrB;AAED,kEAAkE;AAClE,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,WAAW,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,4EAA4E;AAC5E,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,iBAAiB,CAAC;CACzB;AAED,kFAAkF;AAClF,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,mBAAmB,CAAC;IAC1B,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;QAC1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AAEvB,0FAA0F;AAC1F,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,QAAQ,CAAC;IAChB,IAAI,EAAE,aAAa,EAAE,CAAC;CACvB;AAED,uFAAuF;AACvF,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,SAAS,EAAE,SAAS,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB"}
|
package/dist/message-router.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-router.d.ts","sourceRoot":"","sources":["../src/message-router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAKV,SAAS,EACT,WAAW,EACZ,MAAM,sBAAsB,CAAC;AAmH9B,2EAA2E;AAC3E,UAAU,sBAAsB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,SAAS,EAAE,SAAS,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB;
|
|
1
|
+
{"version":3,"file":"message-router.d.ts","sourceRoot":"","sources":["../src/message-router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAKV,SAAS,EACT,WAAW,EACZ,MAAM,sBAAsB,CAAC;AAmH9B,2EAA2E;AAC3E,UAAU,sBAAsB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,SAAS,EAAE,SAAS,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB;AAmBD;;;;GAIG;AACH,QAAA,MAAM,qBAAqB,GAAI,KAAK,OAAO,KAAG,sBAAsB,GAAG,IAsEtE,CAAC;AA6XF,6DAA6D;AAC7D,QAAA,MAAM,mBAAmB,GAAI,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,IAuE/D,CAAC;AAEF,oFAAoF;AACpF,QAAA,MAAM,kBAAkB,UAAoC,CAAC;AAE7D,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,CAAC;AAC1E,YAAY,EAAE,sBAAsB,EAAE,CAAC"}
|
package/dist/message-router.js
CHANGED
|
@@ -55,6 +55,8 @@ const toPluginMeta = (p) => ({
|
|
|
55
55
|
adapterFile: p.adapterFile,
|
|
56
56
|
iconSvg: p.iconSvg,
|
|
57
57
|
iconInactiveSvg: p.iconInactiveSvg,
|
|
58
|
+
iconDarkSvg: p.iconDarkSvg,
|
|
59
|
+
iconDarkInactiveSvg: p.iconDarkInactiveSvg,
|
|
58
60
|
tools: p.tools,
|
|
59
61
|
});
|
|
60
62
|
/**
|
|
@@ -98,6 +100,7 @@ const validatePluginPayload = (raw) => {
|
|
|
98
100
|
displayName: typeof t.displayName === 'string' ? t.displayName : t.name,
|
|
99
101
|
description: t.description,
|
|
100
102
|
icon: typeof t.icon === 'string' ? t.icon : 'wrench',
|
|
103
|
+
...(typeof t.group === 'string' ? { group: t.group } : {}),
|
|
101
104
|
enabled: typeof t.enabled === 'boolean' ? t.enabled : true,
|
|
102
105
|
};
|
|
103
106
|
})
|
|
@@ -115,6 +118,8 @@ const validatePluginPayload = (raw) => {
|
|
|
115
118
|
adapterFile: typeof obj.adapterFile === 'string' ? obj.adapterFile : undefined,
|
|
116
119
|
iconSvg: typeof obj.iconSvg === 'string' ? obj.iconSvg : undefined,
|
|
117
120
|
iconInactiveSvg: typeof obj.iconInactiveSvg === 'string' ? obj.iconInactiveSvg : undefined,
|
|
121
|
+
iconDarkSvg: typeof obj.iconDarkSvg === 'string' ? obj.iconDarkSvg : undefined,
|
|
122
|
+
iconDarkInactiveSvg: typeof obj.iconDarkInactiveSvg === 'string' ? obj.iconDarkInactiveSvg : undefined,
|
|
118
123
|
tools,
|
|
119
124
|
};
|
|
120
125
|
};
|
|
@@ -227,7 +232,9 @@ const handleSyncFull = async (params) => {
|
|
|
227
232
|
iconInactiveSvg: p.iconInactiveSvg,
|
|
228
233
|
...(typeof raw?.sdkVersion === 'string' ? { sdkVersion: raw.sdkVersion } : {}),
|
|
229
234
|
...(raw?.update && typeof raw.update === 'object'
|
|
230
|
-
? {
|
|
235
|
+
? {
|
|
236
|
+
update: raw.update,
|
|
237
|
+
}
|
|
231
238
|
: {}),
|
|
232
239
|
};
|
|
233
240
|
});
|
|
@@ -305,7 +312,9 @@ const handlePluginUpdate = async (params) => {
|
|
|
305
312
|
iconInactiveSvg: validated.iconInactiveSvg,
|
|
306
313
|
...(typeof params.sdkVersion === 'string' ? { sdkVersion: params.sdkVersion } : {}),
|
|
307
314
|
...(params.update && typeof params.update === 'object'
|
|
308
|
-
? {
|
|
315
|
+
? {
|
|
316
|
+
update: params.update,
|
|
317
|
+
}
|
|
309
318
|
: {}),
|
|
310
319
|
};
|
|
311
320
|
const otherPlugins = existingCache.plugins.filter(p => p.name !== validated.name);
|
|
@@ -329,7 +338,10 @@ const handlePluginUninstall = async (params, id) => {
|
|
|
329
338
|
if (!isValidPluginName(pluginName)) {
|
|
330
339
|
sendToServer({
|
|
331
340
|
jsonrpc: '2.0',
|
|
332
|
-
error: {
|
|
341
|
+
error: {
|
|
342
|
+
code: JSONRPC_INVALID_PARAMS,
|
|
343
|
+
message: `Invalid plugin name format: "${pluginName}"`,
|
|
344
|
+
},
|
|
333
345
|
id,
|
|
334
346
|
});
|
|
335
347
|
return;
|
|
@@ -353,7 +365,9 @@ const handlePluginUninstall = async (params, id) => {
|
|
|
353
365
|
// Remove the uninstalled plugin from the cache so bg:getFullState returns
|
|
354
366
|
// fresh state immediately, without waiting for the server's plugins.changed.
|
|
355
367
|
const existingCache = getServerStateCache();
|
|
356
|
-
updateServerStateCache({
|
|
368
|
+
updateServerStateCache({
|
|
369
|
+
plugins: existingCache.plugins.filter(p => p.name !== pluginName),
|
|
370
|
+
});
|
|
357
371
|
// Notify the side panel so it removes the plugin card without waiting for
|
|
358
372
|
// the server's own plugins.changed (which arrives after the success response).
|
|
359
373
|
forwardToSidePanel({
|
|
@@ -482,7 +496,10 @@ const handleServerMessage = (message) => {
|
|
|
482
496
|
if (id !== undefined) {
|
|
483
497
|
sendToServer({
|
|
484
498
|
jsonrpc: '2.0',
|
|
485
|
-
error: {
|
|
499
|
+
error: {
|
|
500
|
+
code: JSONRPC_INTERNAL_ERROR,
|
|
501
|
+
message: `Rate limited: ${method}`,
|
|
502
|
+
},
|
|
486
503
|
id,
|
|
487
504
|
});
|
|
488
505
|
}
|
|
@@ -495,7 +512,10 @@ const handleServerMessage = (message) => {
|
|
|
495
512
|
if (id !== undefined) {
|
|
496
513
|
sendToServer({
|
|
497
514
|
jsonrpc: '2.0',
|
|
498
|
-
error: {
|
|
515
|
+
error: {
|
|
516
|
+
code: JSONRPC_METHOD_NOT_FOUND,
|
|
517
|
+
message: `Method not found: ${method}`,
|
|
518
|
+
},
|
|
499
519
|
id,
|
|
500
520
|
});
|
|
501
521
|
}
|