m365connector 0.3.2 → 0.3.4
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/package.json +1 -1
- package/src/tools/search.js +6 -2
- package/src/ws-server.js +6 -5
package/package.json
CHANGED
package/src/tools/search.js
CHANGED
|
@@ -61,6 +61,10 @@ const OPEN_TOOL = {
|
|
|
61
61
|
read_handle: {
|
|
62
62
|
type: "string",
|
|
63
63
|
description: "Opaque read handle from search result"
|
|
64
|
+
},
|
|
65
|
+
fullContent: {
|
|
66
|
+
type: "boolean",
|
|
67
|
+
description: "When true, attempt full document extraction via Office Online deep-link with scroll (slower, opens browser tab). Default: false."
|
|
64
68
|
}
|
|
65
69
|
},
|
|
66
70
|
required: ["read_handle", "conversation_id"]
|
|
@@ -328,8 +332,8 @@ export function registerTools(registry, context) {
|
|
|
328
332
|
|
|
329
333
|
const wsResult = await context.ws.sendRequest(
|
|
330
334
|
"open",
|
|
331
|
-
{ conversation_id: conversationId, context: readContext },
|
|
332
|
-
{ timeoutMs: 60000 }
|
|
335
|
+
{ conversation_id: conversationId, context: readContext, fullContent: Boolean(args.fullContent) },
|
|
336
|
+
{ timeoutMs: args.fullContent ? 90000 : 60000 }
|
|
333
337
|
);
|
|
334
338
|
|
|
335
339
|
return asObject(wsResult);
|
package/src/ws-server.js
CHANGED
|
@@ -44,7 +44,7 @@ export class WsServer {
|
|
|
44
44
|
this.wss.once("error", reject);
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
-
this.logger.
|
|
47
|
+
this.logger.info(`[m365connector/ws] listening on ws://${this.host}:${this.port}`);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
async stop() {
|
|
@@ -96,6 +96,7 @@ export class WsServer {
|
|
|
96
96
|
|
|
97
97
|
return new Promise((resolve, reject) => {
|
|
98
98
|
const timeout = setTimeout(() => {
|
|
99
|
+
this.logger.warn(`[m365connector/ws] request timed out: type=${type} id=${id}`);
|
|
99
100
|
this.pending.delete(id);
|
|
100
101
|
reject(new Error(`WebSocket request timed out after ${timeoutMs}ms`));
|
|
101
102
|
}, timeoutMs);
|
|
@@ -130,7 +131,7 @@ export class WsServer {
|
|
|
130
131
|
if (this.client && this.client.readyState === WebSocket.OPEN) {
|
|
131
132
|
// MV3 service workers can die silently without sending a close frame.
|
|
132
133
|
// When the extension reconnects, replace the stale connection.
|
|
133
|
-
this.logger.
|
|
134
|
+
this.logger.info("[m365connector/ws] replacing existing connection with new one");
|
|
134
135
|
try { this.client.terminate(); } catch (_e) { /* ignored */ }
|
|
135
136
|
this.handleClose(this.client);
|
|
136
137
|
}
|
|
@@ -147,14 +148,14 @@ export class WsServer {
|
|
|
147
148
|
});
|
|
148
149
|
|
|
149
150
|
socket.on("close", (code, reason) => {
|
|
150
|
-
this.logger.
|
|
151
|
+
this.logger.info(`[m365connector/ws] socket close: code=${code}, reason=${String(reason)}`);
|
|
151
152
|
this.handleClose(socket);
|
|
152
153
|
});
|
|
153
154
|
|
|
154
155
|
socket.on("error", (err) => {
|
|
155
156
|
this.logger.warn("[m365connector/ws] client socket error:", err.message);
|
|
156
157
|
});
|
|
157
|
-
this.logger.
|
|
158
|
+
this.logger.info("[m365connector/ws] extension connected");
|
|
158
159
|
}
|
|
159
160
|
|
|
160
161
|
async handleMessage(socket, rawData) {
|
|
@@ -197,6 +198,6 @@ export class WsServer {
|
|
|
197
198
|
this.pending.delete(id);
|
|
198
199
|
}
|
|
199
200
|
|
|
200
|
-
this.logger.
|
|
201
|
+
this.logger.info("[m365connector/ws] extension disconnected");
|
|
201
202
|
}
|
|
202
203
|
}
|