@attson/atwebpilot-mcp 0.0.73 → 0.0.74
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/index.js +24 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -895,7 +895,9 @@ var Coordinator = class {
|
|
|
895
895
|
return session;
|
|
896
896
|
}
|
|
897
897
|
closeSession(id) {
|
|
898
|
+
const session = this.sessions.get(id);
|
|
898
899
|
this.sessions.close(id);
|
|
900
|
+
if (session) this.notifySessionClosed(session);
|
|
899
901
|
}
|
|
900
902
|
// === Tool calls ===
|
|
901
903
|
validateCall(input) {
|
|
@@ -920,8 +922,22 @@ var Coordinator = class {
|
|
|
920
922
|
// === Periodic housekeeping ===
|
|
921
923
|
tick() {
|
|
922
924
|
const expired_sessions = this.sessions.tick();
|
|
925
|
+
for (const id of expired_sessions) {
|
|
926
|
+
const session = this.sessions.get(id);
|
|
927
|
+
if (session) this.notifySessionClosed(session);
|
|
928
|
+
}
|
|
923
929
|
return { expired_sessions };
|
|
924
930
|
}
|
|
931
|
+
notifySessionClosed(session) {
|
|
932
|
+
void this.hub.send(session.worker_id, {
|
|
933
|
+
type: "CLOSE_SESSION",
|
|
934
|
+
nonce: this.idGen.next("nonce"),
|
|
935
|
+
ts: this.clock.now(),
|
|
936
|
+
protocol_version: PROTOCOL_VERSION,
|
|
937
|
+
session_id: session.id
|
|
938
|
+
}).catch(() => {
|
|
939
|
+
});
|
|
940
|
+
}
|
|
925
941
|
};
|
|
926
942
|
|
|
927
943
|
// src/mcp-server.ts
|
|
@@ -3011,6 +3027,7 @@ function processInfo(cwd = process.cwd()) {
|
|
|
3011
3027
|
|
|
3012
3028
|
// src/ensure-hub.ts
|
|
3013
3029
|
var DEFAULT_WORKER_WAIT_TIMEOUT_MS = 9e4;
|
|
3030
|
+
var SESSION_SWEEP_INTERVAL_MS = 3e4;
|
|
3014
3031
|
function createHubEnsurer(d) {
|
|
3015
3032
|
let bundle = null;
|
|
3016
3033
|
let inflight = null;
|
|
@@ -3019,6 +3036,7 @@ function createHubEnsurer(d) {
|
|
|
3019
3036
|
let opening = null;
|
|
3020
3037
|
let hubIsClosed = false;
|
|
3021
3038
|
let pendingDenial = false;
|
|
3039
|
+
let sessionSweepTimer = null;
|
|
3022
3040
|
let workerWait = null;
|
|
3023
3041
|
const info = d.processInfo ?? processInfo();
|
|
3024
3042
|
function connectedWorkerId(coordinator) {
|
|
@@ -3054,6 +3072,10 @@ function createHubEnsurer(d) {
|
|
|
3054
3072
|
}
|
|
3055
3073
|
function hubClosed() {
|
|
3056
3074
|
hubIsClosed = true;
|
|
3075
|
+
if (sessionSweepTimer) {
|
|
3076
|
+
clearInterval(sessionSweepTimer);
|
|
3077
|
+
sessionSweepTimer = null;
|
|
3078
|
+
}
|
|
3057
3079
|
if (workerWait) {
|
|
3058
3080
|
finishWorkerWait({ error: new Error("\u6D4F\u89C8\u5668\u914D\u5BF9\u670D\u52A1\u5DF2\u5173\u95ED\u3002") });
|
|
3059
3081
|
}
|
|
@@ -3082,6 +3104,8 @@ function createHubEnsurer(d) {
|
|
|
3082
3104
|
}
|
|
3083
3105
|
saveLastPort(port, d.identityDir);
|
|
3084
3106
|
const coordinator = new Coordinator({ hub, clock: d.clock, idGen: d.idGen });
|
|
3107
|
+
sessionSweepTimer = setInterval(() => coordinator.tick(), SESSION_SWEEP_INTERVAL_MS);
|
|
3108
|
+
sessionSweepTimer.unref?.();
|
|
3085
3109
|
installWire(hub, coordinator, d.clock, () => notifyWorkerReady(coordinator));
|
|
3086
3110
|
pairUrlValue = `http://127.0.0.1:${port}/pair`;
|
|
3087
3111
|
return { coordinator, hub, port };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@attson/atwebpilot-mcp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.74",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "MCP server for the atwebpilot browser extension - let Codex or Claude Code drive your browser.",
|
|
6
6
|
"homepage": "https://github.com/attson/atwebpilot#readme",
|