negotium 0.22.5 → 0.22.7
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/agent-helpers.js +56 -18
- package/dist/agent-helpers.js.map +7 -7
- package/dist/browser-runtime.js +38 -11
- package/dist/browser-runtime.js.map +4 -4
- package/dist/{chunk-7rpbcn1j.js → chunk-1gznvrth.js} +3 -3
- package/dist/{chunk-7rpbcn1j.js.map → chunk-1gznvrth.js.map} +2 -2
- package/dist/{chunk-vh8px000.js → chunk-pr8p6pap.js} +7 -2
- package/dist/{chunk-vh8px000.js.map → chunk-pr8p6pap.js.map} +3 -3
- package/dist/{chunk-a3me2mje.js → chunk-z4r7tt2p.js} +1 -1
- package/dist/hosted-agent.js +8 -3
- package/dist/hosted-agent.js.map +4 -4
- package/dist/main.js +86 -19
- package/dist/main.js.map +9 -9
- package/dist/mcp-factories.js +56 -18
- package/dist/mcp-factories.js.map +7 -7
- package/dist/registry.js +3 -3
- package/dist/rollout.js +2 -2
- package/dist/runtime/src/platform/playwright/manager.ts +77 -15
- package/dist/runtime/src/storage/api-topics.ts +6 -0
- package/dist/runtime/src/storage/browser-profiles.ts +18 -0
- package/dist/runtime/src/topics/lifecycle.ts +2 -5
- package/dist/runtime/src/topics/update.ts +37 -0
- package/dist/runtime/src/types/api.ts +6 -0
- package/dist/runtime/src/version.ts +1 -1
- package/dist/storage.js +7 -2
- package/dist/storage.js.map +3 -3
- package/dist/types/packages/core/src/platform/playwright/manager.d.ts +8 -0
- package/dist/types/packages/core/src/storage/api-topics.d.ts +1 -0
- package/dist/types/packages/core/src/storage/browser-profiles.d.ts +4 -0
- package/dist/types/packages/core/src/types/api.d.ts +6 -0
- package/dist/types/packages/core/src/version.d.ts +1 -1
- package/package.json +1 -1
- /package/dist/{chunk-a3me2mje.js.map → chunk-z4r7tt2p.js.map} +0 -0
package/dist/browser-runtime.js
CHANGED
|
@@ -1431,6 +1431,13 @@ function getTopicBrowserProfile(topicId) {
|
|
|
1431
1431
|
const value = db.query("SELECT browser_profile FROM api_topics WHERE id = ?").get(topicId)?.browser_profile;
|
|
1432
1432
|
return value || DEFAULT_BROWSER_PROFILE;
|
|
1433
1433
|
}
|
|
1434
|
+
function isBrowserConnectPort(value) {
|
|
1435
|
+
return Number.isInteger(value) && value >= 1024 && value <= 65535;
|
|
1436
|
+
}
|
|
1437
|
+
function getTopicBrowserConnectPort(topicId) {
|
|
1438
|
+
const value = db.query("SELECT browser_connect_port FROM api_topics WHERE id = ?").get(topicId)?.browser_connect_port;
|
|
1439
|
+
return isBrowserConnectPort(value) ? value : undefined;
|
|
1440
|
+
}
|
|
1434
1441
|
function assertBrowserProfileDeletable(ownerId, rawName) {
|
|
1435
1442
|
const name = normalizeBrowserProfileName(rawName);
|
|
1436
1443
|
if (name === DEFAULT_BROWSER_PROFILE)
|
|
@@ -1470,6 +1477,9 @@ function resolvePlaywrightTopicBinding(userId, topic) {
|
|
|
1470
1477
|
function defaultTopicBinding(userId, topic) {
|
|
1471
1478
|
if (!topic)
|
|
1472
1479
|
return managerHost.resolveNamedBinding(userId, "default");
|
|
1480
|
+
const connectPort = getTopicBrowserConnectPort(topic);
|
|
1481
|
+
if (connectPort !== undefined)
|
|
1482
|
+
return connectBinding(connectPort);
|
|
1473
1483
|
const ownerId = getBrowserProfileOwner(topic, userId);
|
|
1474
1484
|
const profile = getTopicBrowserProfile(topic);
|
|
1475
1485
|
return managerHost.resolveNamedBinding(ownerId, profile);
|
|
@@ -1486,6 +1496,26 @@ function validateProfileBinding(binding) {
|
|
|
1486
1496
|
}
|
|
1487
1497
|
return Object.freeze({ ...binding });
|
|
1488
1498
|
}
|
|
1499
|
+
function connectBinding(port) {
|
|
1500
|
+
return { instanceKey: `connect:${port}`, ownerId: "local", profile: `connect-${port}` };
|
|
1501
|
+
}
|
|
1502
|
+
function parseConnectInstanceKey(instanceKey) {
|
|
1503
|
+
const match = /^connect:(\d+)$/.exec(instanceKey);
|
|
1504
|
+
return match ? Number(match[1]) : undefined;
|
|
1505
|
+
}
|
|
1506
|
+
function browserRsArgs(instanceKey, port, userDataDir) {
|
|
1507
|
+
const connectPort = parseConnectInstanceKey(instanceKey);
|
|
1508
|
+
return [
|
|
1509
|
+
"--port",
|
|
1510
|
+
String(port),
|
|
1511
|
+
"--host",
|
|
1512
|
+
"127.0.0.1",
|
|
1513
|
+
"--headed",
|
|
1514
|
+
"--user-data-dir",
|
|
1515
|
+
userDataDir,
|
|
1516
|
+
...connectPort === undefined ? [] : ["--connect", String(connectPort)]
|
|
1517
|
+
];
|
|
1518
|
+
}
|
|
1489
1519
|
function defaultNamedBinding(_ownerId, rawProfile) {
|
|
1490
1520
|
const profile = normalizeBrowserProfileName(rawProfile);
|
|
1491
1521
|
const instanceKey = `profile:${profile}`;
|
|
@@ -1588,6 +1618,9 @@ function resetPlaywrightManagerHost() {
|
|
|
1588
1618
|
configurePlaywrightManagerHost(defaultManagerHost);
|
|
1589
1619
|
}
|
|
1590
1620
|
function parseInstanceKey(instanceKey) {
|
|
1621
|
+
const connectPort = parseConnectInstanceKey(instanceKey);
|
|
1622
|
+
if (connectPort !== undefined)
|
|
1623
|
+
return { ownerId: "local", profile: `_connect-${connectPort}` };
|
|
1591
1624
|
const shared = /^profile:(.+)$/.exec(instanceKey);
|
|
1592
1625
|
if (shared && !shared[1].includes(":")) {
|
|
1593
1626
|
return { ownerId: "local", profile: normalizeBrowserProfileName(shared[1]) };
|
|
@@ -1871,15 +1904,7 @@ async function spawnPlaywright(instanceKey, ownerId, reservedPort, browserBin =
|
|
|
1871
1904
|
const userDataDir = resolveUserDataDir(instanceKey);
|
|
1872
1905
|
const port = reservedPort ?? await allocatePort();
|
|
1873
1906
|
mkdirSync4(userDataDir, { recursive: true });
|
|
1874
|
-
const mcpArgs =
|
|
1875
|
-
"--port",
|
|
1876
|
-
String(port),
|
|
1877
|
-
"--host",
|
|
1878
|
-
"127.0.0.1",
|
|
1879
|
-
"--headed",
|
|
1880
|
-
"--user-data-dir",
|
|
1881
|
-
userDataDir
|
|
1882
|
-
];
|
|
1907
|
+
const mcpArgs = browserRsArgs(instanceKey, port, userDataDir);
|
|
1883
1908
|
const proxy = managerHost.resolveProxy();
|
|
1884
1909
|
if (proxy) {
|
|
1885
1910
|
releasePort(port);
|
|
@@ -2123,7 +2148,9 @@ async function ensureBrowserProfile(ownerId, rawProfile) {
|
|
|
2123
2148
|
return promise;
|
|
2124
2149
|
}
|
|
2125
2150
|
async function closeBrowserOwnerTabs(ownerId, rawProfile, owner) {
|
|
2126
|
-
|
|
2151
|
+
return closeBindingOwnerTabs(resolvePlaywrightProfileBinding(ownerId, rawProfile), owner);
|
|
2152
|
+
}
|
|
2153
|
+
async function closeBindingOwnerTabs(binding, owner) {
|
|
2127
2154
|
const instanceKey = binding.instanceKey;
|
|
2128
2155
|
const inProgress = spawning.get(instanceKey);
|
|
2129
2156
|
if (inProgress)
|
|
@@ -2305,4 +2332,4 @@ export {
|
|
|
2305
2332
|
CODEX_BROWSER_CAPABILITY_ENV
|
|
2306
2333
|
};
|
|
2307
2334
|
|
|
2308
|
-
//# debugId=
|
|
2335
|
+
//# debugId=5310A9FCBB9DA2ED64756E2164756E21
|