mcp-teams 0.3.20 → 0.3.23
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/README.md +5 -5
- package/dist/setup.js +24 -9
- package/dist/setup.js.map +1 -1
- package/dist/tools.js +19 -8
- package/dist/tools.js.map +1 -1
- package/extension/background.js +381 -100
- package/extension/manifest.json +1 -1
- package/extension/teams.js +76 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -16,16 +16,16 @@ AI app ────stdio(MCP)──► mcp-teams server ──ws://127.0.0.1:473
|
|
|
16
16
|
|---|---|
|
|
17
17
|
| `get_version` | Server and extension versions, the connection status, and which Teams services have a session |
|
|
18
18
|
| `reload_extension` | Reloads the browser extension from disk after an update and waits until it is back |
|
|
19
|
-
| `list_teams` | Your teams with their channels (`include_ids: true` adds ids) |
|
|
20
|
-
| `list_chats` | Your 1:1, group and meeting chats, most recent first: title (or the other members' names), last message, unread. Filter with `query` or `unread_only`. |
|
|
19
|
+
| `list_teams` | Your teams with their channels (`include_ids: true` adds ids). Up to a minute old unless `refresh: true`. |
|
|
20
|
+
| `list_chats` | Your 1:1, group and meeting chats, most recent first: title (or the other members' names), last message, unread. Filter with `query` or `unread_only`. The list can be up to a minute old; `refresh: true` reads it again (sending a message refreshes it). |
|
|
21
21
|
| `read_messages` | The latest messages of a chat or channel, oldest first: sender, time, text, shared files, reactions. In channels, replies are nested under their post; `reply_to` reads one post's thread; `cursor` (the returned `olderCursor`) pages further back; `before` (a time) still works. |
|
|
22
22
|
| `search_messages` | Searches all chats and channels with Microsoft Search, like the search box in Teams |
|
|
23
23
|
| `find_people` | Looks people up by name or email: name, email, job title, department, office |
|
|
24
|
-
| `list_meetings` | Your meetings (each has a meeting chat), most recent first: subject, scheduled time, organizer, whether there is a transcript, and whether another organization hosted it |
|
|
24
|
+
| `list_meetings` | Your meetings (each has a meeting chat), most recent first: subject, scheduled time, organizer, whether there is a transcript, and whether another organization hosted it. Up to a minute old unless `refresh: true`. |
|
|
25
25
|
| `get_meeting` | The calls held in a meeting (one per occurrence of a recurring one): start, end, who joined, the recording's link, whether there is a transcript |
|
|
26
26
|
| `read_transcript` | What was said: `[hh:mm:ss] Speaker: text` lines and each speaker's talk time. Long transcripts continue with `from`. |
|
|
27
27
|
| `search_transcripts` | Finds lines in the transcripts of your recent meetings that contain all the words of a query, each with the line before it |
|
|
28
|
-
| `api_traffic` | Diagnostic: the endpoints the Teams tab
|
|
28
|
+
| `api_traffic` | Diagnostic: the endpoints the Teams tab called while recording was on (method, host, path, status, header **names**, auth scheme). Off until the AI turns it on with `record: true`; it stops after 30 minutes or with `record: false`. Header and query **values** are never recorded. |
|
|
29
29
|
| `send_message` | Asks to post in a chat or channel, to reply to a channel post, or to start a chat with people (`to`: one person for a 1:1 chat, several for a group chat, with an optional `title`). **You must click Send.** |
|
|
30
30
|
|
|
31
31
|
People in `to` are given by name or email and looked up like Teams' people picker; each must mean exactly one person in your organization, otherwise the matches are listed. If a chat with exactly those people already exists (for a group with a `title`, also that title), the message goes there instead of starting another one.
|
|
@@ -112,7 +112,7 @@ Every AI session starts its own mcp-teams server, and they share the one extensi
|
|
|
112
112
|
- The server and the extension prove to each other that they know the pairing token in `~/.mcp-teams/config.json`, without sending it. Setup copies it into the installed extension folder as `pairing.json`; both files can be read only by your user. So a program that takes the port while no AI app runs gets nothing from the extension, and a program posing as the extension gets no calls.
|
|
113
113
|
- Teams' tokens are only ever sent to the service they were captured from.
|
|
114
114
|
- Messages can contain prompt injection. The send-confirmation window is the safeguard, so read it before clicking Send. With `autoSendTo` set, messages to yourself alone skip it (see Configuration).
|
|
115
|
-
- The extension may observe requests to Microsoft hosts (`*.microsoft.com`, `*.office.com`, `*.sharepoint.com` and similar), but it only records requests made by the Teams tab,
|
|
115
|
+
- The extension may observe requests to Microsoft hosts (`*.microsoft.com`, `*.office.com`, `*.sharepoint.com` and similar), but it only records requests made by the Teams tab, only names, and only while `api_traffic` recording is on. It runs requests only in Teams tabs, and in SharePoint tabs to read transcripts.
|
|
116
116
|
- If you also give an AI direct control of your browser or desktop, it could click the confirmation button itself. Don't combine the two if you rely on the confirmation step.
|
|
117
117
|
|
|
118
118
|
## Limitations
|
package/dist/setup.js
CHANGED
|
@@ -18,7 +18,17 @@ const TEAMS_WAIT_MS = 120_000;
|
|
|
18
18
|
const ok = (text) => console.log(`✓ ${text}`);
|
|
19
19
|
const todo = (text) => console.log(`→ ${text}`);
|
|
20
20
|
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
21
|
-
|
|
21
|
+
/**
|
|
22
|
+
* One argument of a command printed for the user to paste into their shell. To run a
|
|
23
|
+
* command through cmd.exe, see cmdQuote. No double-quoted form is safe in both cmd and
|
|
24
|
+
* PowerShell: inside the quotes, %VAR% still expands in cmd and $x in PowerShell.
|
|
25
|
+
*/
|
|
26
|
+
export function quote(arg, platform = process.platform) {
|
|
27
|
+
if (platform === "win32")
|
|
28
|
+
return /[\s&%$`]/.test(arg) ? `"${arg}"` : arg;
|
|
29
|
+
return /[^A-Za-z0-9_@%+=:,./-]/.test(arg) ? `'${arg.replace(/'/g, "'\\''")}'` : arg;
|
|
30
|
+
}
|
|
31
|
+
const commandLine = (parts, platform) => parts.map((part) => quote(part, platform)).join(" ");
|
|
22
32
|
/** The package from npm, always the latest release (npx keeps it cached). */
|
|
23
33
|
export const NPX_COMMAND = { command: "npx", args: ["-y", "mcp-teams@latest"] };
|
|
24
34
|
/**
|
|
@@ -88,7 +98,9 @@ function claude(args, options) {
|
|
|
88
98
|
return execFileSync(inv.file, inv.args, { ...inv.options, ...options });
|
|
89
99
|
}
|
|
90
100
|
/** The command that registers this server with Claude Code, to run by hand. */
|
|
91
|
-
export const claudeAddCommand = (cmd) => ["claude", "mcp", "add", "--scope", "user", "teams", "--", cmd.command, ...cmd.args]
|
|
101
|
+
export const claudeAddCommand = (cmd, platform = process.platform) => commandLine(["claude", "mcp", "add", "--scope", "user", "teams", "--", cmd.command, ...cmd.args], platform);
|
|
102
|
+
/** What to do when no AI app was found: register the server by hand. */
|
|
103
|
+
export const noAppHint = (cmd, platform = process.platform) => `No AI app found. Register this stdio server with yours: ${commandLine([cmd.command, ...cmd.args], platform)}`;
|
|
92
104
|
/** Claude Code is configured through its CLI: null if it isn't installed, "broken" if its CLI won't start. */
|
|
93
105
|
function planClaudeCode(cmd) {
|
|
94
106
|
if (process.platform === "win32" && !windowsHas("claude"))
|
|
@@ -150,18 +162,20 @@ export function registerNext(claudeCode, plans) {
|
|
|
150
162
|
return claudeCode === "broken" ? "stop" : "up-to-date";
|
|
151
163
|
}
|
|
152
164
|
/** Shows what registering would change in each AI app, asks once, then does it. */
|
|
153
|
-
async function registerApps(yes) {
|
|
165
|
+
export async function registerApps(yes) {
|
|
154
166
|
const cmd = serverCommand();
|
|
155
167
|
const claudeCode = planClaudeCode(cmd);
|
|
156
168
|
const plans = planClients(cmd);
|
|
157
|
-
|
|
169
|
+
const rows = plans.map((p) => ` ${p.client.name.padEnd(15)} ${STATUS_TEXT[p.status]}`);
|
|
158
170
|
if (claudeCode && claudeCode !== "broken")
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
console.log(
|
|
171
|
+
rows.unshift(` ${"Claude Code".padEnd(15)} ${STATUS_TEXT[claudeCode.status]}`);
|
|
172
|
+
if (rows.length)
|
|
173
|
+
console.log("AI apps on this computer:");
|
|
174
|
+
for (const row of rows)
|
|
175
|
+
console.log(row);
|
|
162
176
|
const next = registerNext(claudeCode, plans);
|
|
163
177
|
if (next === "none-found")
|
|
164
|
-
todo(
|
|
178
|
+
todo(noAppHint(cmd));
|
|
165
179
|
if (next === "up-to-date")
|
|
166
180
|
ok("Registered with every AI app found");
|
|
167
181
|
if (next !== "ask")
|
|
@@ -318,7 +332,8 @@ export async function setup(bridge, serverVersion, { yes = false } = {}) {
|
|
|
318
332
|
return false;
|
|
319
333
|
// Opens Teams in a background tab if none is open, and waits for its session.
|
|
320
334
|
try {
|
|
321
|
-
|
|
335
|
+
// refresh: really ask Teams, not a list cached a minute ago.
|
|
336
|
+
const { teams } = await bridge.call("listTeams", { refresh: true }, TEAMS_WAIT_MS);
|
|
322
337
|
ok(`Teams reachable (${teams.length} teams)`);
|
|
323
338
|
}
|
|
324
339
|
catch (err) {
|
package/dist/setup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,YAAY,EAAE,KAAK,EAA4B,MAAM,oBAAoB,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAiC,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACjG,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,aAAa,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,YAAY,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC5E,MAAM,iBAAiB,GAAG,EAAE,GAAG,MAAM,CAAC;AACtC,MAAM,aAAa,GAAG,OAAO,CAAC;AAE9B,MAAM,EAAE,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;AACtD,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;AACxD,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,I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AiG,CAAC,CAAC;IAC/G,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/tools.js
CHANGED
|
@@ -87,34 +87,44 @@ export function registerTools(server, bridge, config) {
|
|
|
87
87
|
}));
|
|
88
88
|
server.registerTool("api_traffic", {
|
|
89
89
|
title: "Show the Teams web app's API calls (diagnostic)",
|
|
90
|
-
description: "Lists the API endpoints the open Teams tab
|
|
90
|
+
description: "Lists the API endpoints the open Teams tab called while recording was on: method, host, path, status, which headers were sent (names only, never values) and the auth scheme. Used to find out which API Teams uses for a feature. Recording is off until you turn it on: first call with record: true, then click through the feature in Teams, then call again to list what it called. Recording stops after 30 minutes or with record: false; what was recorded stays until clear.",
|
|
91
91
|
inputSchema: {
|
|
92
|
+
record: z.boolean().optional().describe("true: start recording the Teams tab's API calls (for 30 minutes); false: stop recording. Leave out to only list"),
|
|
92
93
|
filter: z.string().optional().describe("Only requests whose host or path contains this text"),
|
|
93
94
|
limit: z.number().int().min(1).max(400).default(100),
|
|
94
95
|
clear: z.boolean().default(false).describe("Clear the recorded traffic after returning it"),
|
|
95
96
|
},
|
|
96
97
|
}, safe(async (args, extra) => text(await bridge.call("apiTraffic", args, undefined, extra.signal))));
|
|
98
|
+
// list_teams, list_chats and list_meetings share one list, which the extension keeps for a minute.
|
|
99
|
+
const refresh = z
|
|
100
|
+
.boolean()
|
|
101
|
+
.default(false)
|
|
102
|
+
.describe("Read the list from Teams again instead of reusing the one from the last minute: e.g. right after a chat was created or joined elsewhere, or for the current unread state");
|
|
103
|
+
/** The bridge param: sent only when asked, so a call without it reads as before. */
|
|
104
|
+
const refreshParam = (r) => (r ? { refresh: true } : {});
|
|
97
105
|
server.registerTool("list_teams", {
|
|
98
106
|
title: "List teams and channels",
|
|
99
|
-
description: "Lists the teams you are a member of, each with its channels. Use 'Team/Channel' or a channel id as the conversation for read_messages and send_message.",
|
|
107
|
+
description: "Lists the teams you are a member of, each with its channels. Use 'Team/Channel' or a channel id as the conversation for read_messages and send_message. The list may be up to a minute old (see refresh).",
|
|
100
108
|
inputSchema: {
|
|
101
109
|
include_ids: z.boolean().default(false).describe("Also return team and channel ids (long; 'Team/Channel' names are enough to address channels)"),
|
|
110
|
+
refresh,
|
|
102
111
|
},
|
|
103
|
-
}, safe(async ({ include_ids }, extra) => {
|
|
104
|
-
const r = await bridge.call("listTeams",
|
|
112
|
+
}, safe(async ({ include_ids, refresh }, extra) => {
|
|
113
|
+
const r = await bridge.call("listTeams", refreshParam(refresh), READ_TIMEOUT_MS, extra.signal);
|
|
105
114
|
return text(include_ids
|
|
106
115
|
? r
|
|
107
116
|
: { teams: r.teams.map(({ id, channels, ...t }) => ({ ...t, channels: channels.map(({ id: _, ...c }) => c) })) });
|
|
108
117
|
}));
|
|
109
118
|
server.registerTool("list_chats", {
|
|
110
119
|
title: "List chats",
|
|
111
|
-
description: "Lists your chats (1:1, group and meeting chats), most recent first, with their title (or the other members' names), the last message and whether it is unread. Returns ids for read_messages and send_message.",
|
|
120
|
+
description: "Lists your chats (1:1, group and meeting chats), most recent first, with their title (or the other members' names), the last message and whether it is unread. Returns ids for read_messages and send_message. The list may be up to a minute old, so the last message and unread state can lag; pass refresh: true for the current ones.",
|
|
112
121
|
inputSchema: {
|
|
113
122
|
query: z.string().optional().describe("Only chats whose title or a member's name contains these words"),
|
|
114
123
|
unread_only: z.boolean().default(false),
|
|
115
124
|
limit: z.number().int().min(1).max(200).default(30),
|
|
125
|
+
refresh,
|
|
116
126
|
},
|
|
117
|
-
}, safe(async ({ query, unread_only, limit }, extra) => text(await bridge.call("listChats", { query, unreadOnly: unread_only, limit }, READ_TIMEOUT_MS, extra.signal))));
|
|
127
|
+
}, safe(async ({ query, unread_only, limit, refresh }, extra) => text(await bridge.call("listChats", { query, unreadOnly: unread_only, limit, ...refreshParam(refresh) }, READ_TIMEOUT_MS, extra.signal))));
|
|
118
128
|
server.registerTool("read_messages", {
|
|
119
129
|
title: "Read a chat or channel",
|
|
120
130
|
description: "Reads the latest messages of a chat or channel, oldest first: sender, time, text (formatting removed), files shared and reactions. In channels, replies are nested under their post (a reply whose post is on an older page comes on its own, with replyTo). To read further back, pass the returned olderCursor as `cursor` (with the same conversation and reply_to); it is there whenever older history exists, so keep paging while it is returned. A page usually costs one or two Teams requests, but one call reads at most 20 pages of Teams history: it may then return fewer messages than asked, even none, with `truncated: true`, a note and an olderCursor to go on. `before` (a time) also works but re-reads from the newest message each call, so it hits that limit sooner. Give cursor or before, not both. With reply_to, reads one channel post's whole thread.",
|
|
@@ -138,13 +148,14 @@ export function registerTools(server, bridge, config) {
|
|
|
138
148
|
.describe("Which meeting: its chat id from list_meetings (19:meeting_…) or its title. A title must match exactly one meeting chat.");
|
|
139
149
|
server.registerTool("list_meetings", {
|
|
140
150
|
title: "List Teams meetings",
|
|
141
|
-
description: "Lists your Teams meetings (each scheduled meeting or recurring series has a meeting chat), most recent activity first: subject, scheduled time (for a series, its first occurrence), organizer, whether a transcript exists, and whether another organization hosted it (`external`: its chat and recordings are usually no longer readable afterwards). Use get_meeting for the calls held and who attended, read_transcript for what was said, read_messages for the meeting chat.",
|
|
151
|
+
description: "Lists your Teams meetings (each scheduled meeting or recurring series has a meeting chat), most recent activity first: subject, scheduled time (for a series, its first occurrence), organizer, whether a transcript exists, and whether another organization hosted it (`external`: its chat and recordings are usually no longer readable afterwards). The list may be up to a minute old (see refresh). Use get_meeting for the calls held and who attended, read_transcript for what was said, read_messages for the meeting chat.",
|
|
142
152
|
inputSchema: {
|
|
143
153
|
query: z.string().optional().describe("Only meetings whose subject or organizer contains these words"),
|
|
144
154
|
transcript_only: z.boolean().default(false).describe("Only meetings with a transcript"),
|
|
145
155
|
limit: z.number().int().min(1).max(200).default(20),
|
|
156
|
+
refresh,
|
|
146
157
|
},
|
|
147
|
-
}, safe(async ({ query, transcript_only, limit }, extra) => text(await bridge.call("listMeetings", { query, transcriptOnly: transcript_only, limit }, READ_TIMEOUT_MS, extra.signal))));
|
|
158
|
+
}, safe(async ({ query, transcript_only, limit, refresh }, extra) => text(await bridge.call("listMeetings", { query, transcriptOnly: transcript_only, limit, ...refreshParam(refresh) }, READ_TIMEOUT_MS, extra.signal))));
|
|
148
159
|
server.registerTool("get_meeting", {
|
|
149
160
|
title: "Get a meeting's calls and attendance",
|
|
150
161
|
description: "One meeting with the calls held in it, newest first (a recurring meeting has one per occurrence): when it started and ended, who joined, the recording's link, and whether there is a transcript.",
|
package/dist/tools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAwB,MAAM,aAAa,CAAC;AAE/D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,yFAAyF;AACzF,MAAM,eAAe,GAAG,CAAC,GAAG,MAAM,CAAC;AACnC,6EAA6E;AAC7E,MAAM,eAAe,GAAG,OAAO,CAAC;AAEhC,MAAM,IAAI,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,CAAC;IAChC,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;CAC/G,CAAC,CAAC;AAEH,MAAM,IAAI,GAAG,CAAC,GAAY,EAAE,EAAE,CAAC,CAAC;IAC9B,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;CAC7F,CAAC,CAAC;AAKH;;;GAGG;AACH,SAAS,IAAI,CAA6B,EAA2D;IACnG,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UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,sDAAsD,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7F,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,sEAAsE,IAAI,kDAAkD,CAAC,CAAC;QAC1J,CAAC;IACH,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
|
package/extension/background.js
CHANGED
|
@@ -28,12 +28,59 @@ function captureSession(details) {
|
|
|
28
28
|
if (!svc) return;
|
|
29
29
|
const headers = teams.pickHeaders(details.requestHeaders);
|
|
30
30
|
if (!headers) return;
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
// Whose session it is: the user its token was issued to (an object id is one tenant's).
|
|
32
|
+
const oid = teams.tokenOid(headers) ?? svc.oid ?? null;
|
|
33
|
+
const capture = { base: svc.base, region: svc.region ?? null, headers, at: Date.now(), oid };
|
|
34
|
+
return (captureQueue = captureQueue.then(() => storeCapture(svc.service, capture)).catch(() => {}));
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
const CAPTURED_SERVICES = ["chatsvc", "csa", "mt", "substrate"];
|
|
38
|
+
let captureQueue = Promise.resolve(); // one capture at a time, so a switch is seen in order
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Stores a capture. One from another user than the signed-in one (the user switched Teams to
|
|
42
|
+
* another tenant or account) retires the other services' sessions, which belong to the
|
|
43
|
+
* previous one (or to nobody known), and the caches of what that user saw: the next request
|
|
44
|
+
* to those services waits for Teams' own request as the new user.
|
|
45
|
+
*
|
|
46
|
+
* The same session again (same base, headers and user: every request Teams, or this worker in
|
|
47
|
+
* its tab, makes with it) isn't written: it only marks the stored one as seen now (`seenAt`).
|
|
48
|
+
*/
|
|
49
|
+
async function storeCapture(service, capture) {
|
|
50
|
+
const key = `capture:${service}`;
|
|
51
|
+
const { [key]: held, oid: was } = await chrome.storage.session.get([key, "oid"]);
|
|
52
|
+
if (sameSession(held, capture) && (!capture.oid || capture.oid === was)) {
|
|
53
|
+
seenAt.set(service, capture.at);
|
|
54
|
+
for (const f of [...captureSeen]) f(service);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
seenAt.delete(service);
|
|
58
|
+
const update = { [key]: capture };
|
|
59
|
+
if (capture.oid) {
|
|
60
|
+
if (was && was !== capture.oid) {
|
|
61
|
+
const others = CAPTURED_SERVICES.filter((s) => s !== service).map((s) => `capture:${s}`);
|
|
62
|
+
const held = await chrome.storage.session.get(others);
|
|
63
|
+
const stale = others.filter((k) => held[k] && held[k].oid !== capture.oid);
|
|
64
|
+
if (stale.length) await chrome.storage.session.remove(stale);
|
|
65
|
+
forgetAccount();
|
|
66
|
+
}
|
|
67
|
+
update.oid = capture.oid;
|
|
68
|
+
}
|
|
69
|
+
await chrome.storage.session.set(update);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// service -> when Teams last sent the stored session again (in memory: no storage write for it)
|
|
73
|
+
const seenAt = new Map();
|
|
74
|
+
// Called with the service whenever its stored session is seen again (see waitForCapture).
|
|
75
|
+
const captureSeen = new Set();
|
|
76
|
+
|
|
77
|
+
const sameHeaders = (a = {}, b = {}) => {
|
|
78
|
+
const keys = Object.keys(a);
|
|
79
|
+
return keys.length === Object.keys(b).length && keys.every((k) => a[k] === b[k]);
|
|
80
|
+
};
|
|
81
|
+
/** Whether two captures hold the same session (when they were seen aside). */
|
|
82
|
+
const sameSession = (a, b) => !!a && a.base === b.base && (a.region ?? null) === (b.region ?? null) && (a.oid ?? null) === (b.oid ?? null) && sameHeaders(a.headers, b.headers);
|
|
83
|
+
|
|
37
84
|
const captureFilter = {
|
|
38
85
|
urls: [
|
|
39
86
|
"https://teams.cloud.microsoft/api/*",
|
|
@@ -47,18 +94,35 @@ const captureFilter = {
|
|
|
47
94
|
* Which endpoints Teams uses for meetings, recaps and files is not documented, so we log
|
|
48
95
|
* the calls the Teams tab makes (method, host, path, header *names*, auth scheme) for the
|
|
49
96
|
* api_traffic tool. Kept in chrome.storage.session, so a browser restart clears it.
|
|
97
|
+
* Recorded only while api_traffic turned recording on (record: true), for at most
|
|
98
|
+
* TRAFFIC_RECORD_MS; when it ends is kept in chrome.storage.session too, so it survives a
|
|
99
|
+
* restart of this worker.
|
|
50
100
|
*/
|
|
51
101
|
const TRAFFIC_KEY = "traffic";
|
|
102
|
+
const TRAFFIC_UNTIL_KEY = "trafficUntil";
|
|
103
|
+
const TRAFFIC_RECORD_MS = 30 * 60_000;
|
|
52
104
|
let traffic = null;
|
|
53
105
|
let trafficSave = null;
|
|
54
106
|
let trafficQueue = Promise.resolve();
|
|
107
|
+
let trafficUntil = null; // ms since 1970 when recording ends (0: off); null until read from storage
|
|
108
|
+
|
|
109
|
+
async function recordingUntil() {
|
|
110
|
+
trafficUntil ??= (await chrome.storage.session.get(TRAFFIC_UNTIL_KEY))[TRAFFIC_UNTIL_KEY] ?? 0;
|
|
111
|
+
return trafficUntil;
|
|
112
|
+
}
|
|
55
113
|
|
|
56
|
-
/**
|
|
57
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Applies fn to the log one update at a time, so events that land together don't overwrite
|
|
116
|
+
* each other. `ifRecording`: only while recording is on. Saved only when fn changed the log.
|
|
117
|
+
*/
|
|
118
|
+
function updateTraffic(fn, { ifRecording = false } = {}) {
|
|
58
119
|
trafficQueue = trafficQueue
|
|
59
120
|
.then(async () => {
|
|
121
|
+
if (ifRecording && Date.now() >= (await recordingUntil())) return;
|
|
60
122
|
traffic ??= (await chrome.storage.session.get(TRAFFIC_KEY))[TRAFFIC_KEY] ?? [];
|
|
61
|
-
|
|
123
|
+
const next = fn(traffic);
|
|
124
|
+
if (next === traffic) return;
|
|
125
|
+
traffic = next;
|
|
62
126
|
clearTimeout(trafficSave);
|
|
63
127
|
trafficSave = setTimeout(() => chrome.storage.session.set({ [TRAFFIC_KEY]: traffic }), 500);
|
|
64
128
|
})
|
|
@@ -71,30 +135,53 @@ const trafficFilter = { urls: teams.TRAFFIC_URLS, types: ["xmlhttprequest", "oth
|
|
|
71
135
|
function recordRequest(details) {
|
|
72
136
|
if (!teams.isTeamsOrigin(details.initiator)) return;
|
|
73
137
|
const entry = teams.summarizeRequest(details);
|
|
74
|
-
updateTraffic((list) => teams.recordTraffic(list, entry));
|
|
138
|
+
updateTraffic((list) => teams.recordTraffic(list, entry), { ifRecording: true });
|
|
75
139
|
}
|
|
76
140
|
|
|
77
141
|
function recordCompleted(details) {
|
|
78
142
|
if (!teams.isTeamsOrigin(details.initiator)) return;
|
|
79
143
|
const url = new URL(details.url);
|
|
80
144
|
const key = `${details.method} ${url.host}${url.pathname.slice(0, 300)}`;
|
|
81
|
-
updateTraffic((list) => teams.recordStatus(list, key, details.statusCode));
|
|
145
|
+
updateTraffic((list) => teams.recordStatus(list, key, details.statusCode), { ifRecording: true });
|
|
82
146
|
}
|
|
83
147
|
|
|
148
|
+
/** The service's captured session; its `at` is when Teams last sent it (stored, or seen again since). */
|
|
84
149
|
async function getCapture(service) {
|
|
85
150
|
const key = `capture:${service}`;
|
|
86
|
-
|
|
151
|
+
const cap = (await chrome.storage.session.get(key))[key] ?? null;
|
|
152
|
+
const seen = seenAt.get(service);
|
|
153
|
+
return cap && seen > cap.at ? { ...cap, at: seen } : cap;
|
|
87
154
|
}
|
|
88
155
|
|
|
89
156
|
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
90
157
|
|
|
91
|
-
/**
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
return
|
|
158
|
+
/**
|
|
159
|
+
* Waits until Teams sends the service a session after `since` (a new one, or the stored one
|
|
160
|
+
* again); null on timeout. Listens for the capture instead of asking for it.
|
|
161
|
+
*/
|
|
162
|
+
function waitForCapture(service, since, timeoutMs) {
|
|
163
|
+
const key = `capture:${service}`;
|
|
164
|
+
return new Promise((resolve) => {
|
|
165
|
+
let done = false;
|
|
166
|
+
const finish = (cap) => {
|
|
167
|
+
if (done) return;
|
|
168
|
+
done = true;
|
|
169
|
+
clearTimeout(timer);
|
|
170
|
+
chrome.storage.onChanged.removeListener(onChanged);
|
|
171
|
+
captureSeen.delete(onSeen);
|
|
172
|
+
resolve(cap);
|
|
173
|
+
};
|
|
174
|
+
const check = async () => {
|
|
175
|
+
const cap = await getCapture(service);
|
|
176
|
+
if (cap && cap.at > since) finish(cap);
|
|
177
|
+
};
|
|
178
|
+
const onChanged = (changes, area) => area === "session" && changes[key]?.newValue && check();
|
|
179
|
+
const onSeen = (s) => s === service && check();
|
|
180
|
+
const timer = setTimeout(() => finish(null), timeoutMs);
|
|
181
|
+
chrome.storage.onChanged.addListener(onChanged);
|
|
182
|
+
captureSeen.add(onSeen);
|
|
183
|
+
check();
|
|
184
|
+
});
|
|
98
185
|
}
|
|
99
186
|
|
|
100
187
|
const OPEN_TAB_WAIT_MS = 60_000;
|
|
@@ -129,10 +216,30 @@ function openTeamsTab() {
|
|
|
129
216
|
return opening;
|
|
130
217
|
}
|
|
131
218
|
|
|
219
|
+
// The tabs a request can run in: Teams, and SharePoint (transcripts), found with one lookup.
|
|
220
|
+
const TEAMS_TAB = /^https:\/\/(teams\.cloud\.microsoft|teams\.microsoft\.com)\//;
|
|
221
|
+
const TAB_URLS = [...TEAMS_URLS, "https://*.sharepoint.com/*"];
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* The open Teams and SharePoint tabs. A call (`ctx`) looks them up once and reuses the list
|
|
225
|
+
* (with the tabs it opened added, see knownTab); without one, every time.
|
|
226
|
+
*/
|
|
227
|
+
function openTabs(ctx) {
|
|
228
|
+
if (!ctx) return chrome.tabs.query({ url: TAB_URLS });
|
|
229
|
+
ctx.tabs ??= chrome.tabs.query({ url: TAB_URLS });
|
|
230
|
+
return ctx.tabs;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/** Adds a tab the call opened (or found ready) to its list, so its next request finds it. */
|
|
234
|
+
function knownTab(ctx, tab) {
|
|
235
|
+
if (ctx?.tabs) ctx.tabs = ctx.tabs.then((list) => [...list.filter((t) => t.id !== tab.id), tab]);
|
|
236
|
+
return tab;
|
|
237
|
+
}
|
|
238
|
+
|
|
132
239
|
/** The Teams tab to run requests in: one on the origin of the service's capture, else any. */
|
|
133
|
-
async function findTeamsTab(origin) {
|
|
134
|
-
const tabs = await
|
|
135
|
-
if (!tabs.length) return openTeamsTab();
|
|
240
|
+
async function findTeamsTab(origin, ctx = null) {
|
|
241
|
+
const tabs = (await openTabs(ctx)).filter((t) => TEAMS_TAB.test(t.url ?? ""));
|
|
242
|
+
if (!tabs.length) return knownTab(ctx, await openTeamsTab());
|
|
136
243
|
const sameOrigin = tabs.filter((t) => origin && t.url?.startsWith(origin));
|
|
137
244
|
const pool = sameOrigin.length ? sameOrigin : tabs;
|
|
138
245
|
return pool.find((t) => !t.discarded && t.status === "complete") ?? pool[0];
|
|
@@ -141,12 +248,35 @@ async function findTeamsTab(origin) {
|
|
|
141
248
|
// Teams keeps routing for a moment after the page has loaded.
|
|
142
249
|
const SETTLE_MS = 1_000;
|
|
143
250
|
|
|
251
|
+
/**
|
|
252
|
+
* Waits until the tab is `ready(tab)`, listening for its updates: resolves with the tab, null
|
|
253
|
+
* once it is closed, or undefined after timeoutMs.
|
|
254
|
+
*/
|
|
255
|
+
function waitForTab(tabId, ready, timeoutMs) {
|
|
256
|
+
return new Promise((resolve) => {
|
|
257
|
+
let done = false;
|
|
258
|
+
const finish = (result) => {
|
|
259
|
+
if (done) return;
|
|
260
|
+
done = true;
|
|
261
|
+
clearTimeout(timer);
|
|
262
|
+
chrome.tabs.onUpdated.removeListener(onUpdated);
|
|
263
|
+
chrome.tabs.onRemoved.removeListener(onRemoved);
|
|
264
|
+
resolve(result);
|
|
265
|
+
};
|
|
266
|
+
const onUpdated = (id, _change, tab) => id === tabId && ready(tab) && finish(tab);
|
|
267
|
+
const onRemoved = (id) => id === tabId && finish(null);
|
|
268
|
+
const timer = setTimeout(() => finish(undefined), timeoutMs);
|
|
269
|
+
chrome.tabs.onUpdated.addListener(onUpdated);
|
|
270
|
+
chrome.tabs.onRemoved.addListener(onRemoved);
|
|
271
|
+
chrome.tabs.get(tabId).then(
|
|
272
|
+
(t) => ready(t) && finish(t),
|
|
273
|
+
() => finish(null),
|
|
274
|
+
);
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
|
|
144
278
|
async function waitForTabLoaded(tabId, timeoutMs = 30_000) {
|
|
145
|
-
|
|
146
|
-
const t = await chrome.tabs.get(tabId).catch(() => null);
|
|
147
|
-
if (!t) return;
|
|
148
|
-
if (t.status === "complete") return sleep(SETTLE_MS);
|
|
149
|
-
}
|
|
279
|
+
if (await waitForTab(tabId, (t) => t.status === "complete", timeoutMs)) await sleep(SETTLE_MS);
|
|
150
280
|
}
|
|
151
281
|
|
|
152
282
|
const refreshing = new Map(); // service -> Promise<capture|null>, so parallel calls reload once
|
|
@@ -213,6 +343,16 @@ function unanswered(message) {
|
|
|
213
343
|
return Object.assign(new Error(message), { outcomeUnknown: true });
|
|
214
344
|
}
|
|
215
345
|
|
|
346
|
+
/**
|
|
347
|
+
* unanswered, because of the tab: its script failed (`tabFailed: "script"`: closed, reloaded,
|
|
348
|
+
* gone elsewhere) or its fetch failed without a timeout (`"fetch"`: e.g. a page that isn't Teams
|
|
349
|
+
* any more). The call's next request looks the tabs up again.
|
|
350
|
+
*/
|
|
351
|
+
function tabFailed(kind, message, ctx) {
|
|
352
|
+
if (ctx) ctx.tabs = null;
|
|
353
|
+
return Object.assign(unanswered(message), { tabFailed: kind });
|
|
354
|
+
}
|
|
355
|
+
|
|
216
356
|
/**
|
|
217
357
|
* One fetch in the tab, by REQUEST_TIMEOUT_MS or the request's deadline (ctx), whichever
|
|
218
358
|
* comes first. Nothing starts once the request was withdrawn, and a tab that doesn't run
|
|
@@ -240,7 +380,7 @@ async function runInTab(tab, url, method, headers, body, ctx = null) {
|
|
|
240
380
|
})
|
|
241
381
|
// E.g. the tab closed or reloaded while the request ran: it may have reached Teams.
|
|
242
382
|
.catch((err) => {
|
|
243
|
-
throw
|
|
383
|
+
throw tabFailed("script", String(err?.message ?? err), ctx);
|
|
244
384
|
});
|
|
245
385
|
let injection;
|
|
246
386
|
try {
|
|
@@ -249,15 +389,12 @@ async function runInTab(tab, url, method, headers, body, ctx = null) {
|
|
|
249
389
|
clearTimeout(timer);
|
|
250
390
|
}
|
|
251
391
|
const res = injection?.result;
|
|
252
|
-
if (!res) throw
|
|
392
|
+
if (!res) throw tabFailed("script", "Could not run inside the Teams tab. Reload the Teams tab and try again.", ctx);
|
|
253
393
|
if (res.status === 0) {
|
|
254
394
|
ctx?.check(); // the deadline passed: say that rather than "Teams did not answer"
|
|
255
395
|
// A fetch that failed may have been sent already (a reset connection, no answer in time).
|
|
256
|
-
throw unanswered(
|
|
257
|
-
|
|
258
|
-
? `Teams did not answer within ${seconds} s. Reload the Teams tab and try again.`
|
|
259
|
-
: `Could not reach Teams: ${res.error}`,
|
|
260
|
-
);
|
|
396
|
+
if (res.error === "timeout") throw unanswered(`Teams did not answer within ${seconds} s. Reload the Teams tab and try again.`);
|
|
397
|
+
throw tabFailed("fetch", `Could not reach Teams: ${res.error}`, ctx);
|
|
261
398
|
}
|
|
262
399
|
return res;
|
|
263
400
|
}
|
|
@@ -314,20 +451,39 @@ async function passGate(key, ctx, wait) {
|
|
|
314
451
|
if (gaveBack && gatedFor(key) > 0) return passGate(key, ctx, wait);
|
|
315
452
|
}
|
|
316
453
|
|
|
454
|
+
const originOf = (tab) => (tab?.url ? new URL(tab.url).origin : null);
|
|
455
|
+
|
|
317
456
|
/**
|
|
318
|
-
* runInTab through the gate `key`. A 429 closes the gate for its Retry-After. Teams
|
|
319
|
-
* that request without running it, so a read (a GET, or a POST that only reads:
|
|
320
|
-
* goes once more after the wait (when `wait` and it fits the deadline). Anything
|
|
321
|
-
* a post, is never sent again: the caller hears that Teams is busy.
|
|
457
|
+
* runInTab in `tab` through the gate `key`. A 429 closes the gate for its Retry-After. Teams
|
|
458
|
+
* refused that request without running it, so a read (a GET, or a POST that only reads:
|
|
459
|
+
* `repeatable`) goes once more after the wait (when `wait` and it fits the deadline). Anything
|
|
460
|
+
* else, such as a post, is never sent again: the caller hears that Teams is busy.
|
|
461
|
+
*
|
|
462
|
+
* A tab that failed under a read (see tabFailed: closed or reloaded since the call looked it up,
|
|
463
|
+
* or gone to another page) is looked up again with `findTab`, and the read goes once more there,
|
|
464
|
+
* by the same deadline. A fetch that failed in the same tab, still on the same page (e.g.
|
|
465
|
+
* offline), isn't sent again. A post never is: it may have reached Teams.
|
|
322
466
|
*/
|
|
323
|
-
async function sendTo(key, tab, url, method, headers, body, ctx, wait, repeatable = method === "GET") {
|
|
324
|
-
|
|
467
|
+
async function sendTo(key, tab, findTab, url, method, headers, body, ctx, wait, repeatable = method === "GET") {
|
|
468
|
+
let foundAgain = false;
|
|
469
|
+
for (let attempt = 0; ; ) {
|
|
325
470
|
await passGate(key, ctx, wait);
|
|
326
|
-
|
|
471
|
+
let res;
|
|
472
|
+
try {
|
|
473
|
+
res = await runInTab(tab, url, method, headers, body, ctx);
|
|
474
|
+
} catch (err) {
|
|
475
|
+
if (!err?.tabFailed || !repeatable || foundAgain) throw err;
|
|
476
|
+
foundAgain = true;
|
|
477
|
+
const again = await guarded(findTab(), ctx);
|
|
478
|
+
if (err.tabFailed === "fetch" && again.id === tab.id && originOf(again) === originOf(tab)) throw err;
|
|
479
|
+
if (again.status === "loading") await guarded(waitForTabLoaded(again.id), ctx);
|
|
480
|
+
tab = again;
|
|
481
|
+
continue;
|
|
482
|
+
}
|
|
327
483
|
if (res.status !== 429) return res;
|
|
328
484
|
const until = Math.max(gates.get(key) ?? 0, Date.now() + teams.retryAfterMs(res.retryAfter));
|
|
329
485
|
gates.set(key, until);
|
|
330
|
-
if (!repeatable || attempt > 0) throw busy(until);
|
|
486
|
+
if (!repeatable || attempt++ > 0) throw busy(until);
|
|
331
487
|
}
|
|
332
488
|
}
|
|
333
489
|
|
|
@@ -338,25 +494,32 @@ async function sendTo(key, tab, url, method, headers, body, ctx, wait, repeatabl
|
|
|
338
494
|
* that can be done without) fails at once as busy instead. `repeatable`: a POST that only
|
|
339
495
|
* reads (a search, a profile lookup), sent again after a 429 like a GET.
|
|
340
496
|
*/
|
|
341
|
-
async function api(service, path, { method = "GET", body, raw = false, withLocation = false, ctx = null, wait = true, repeatable = method === "GET" } = {}) {
|
|
497
|
+
async function api(service, path, { method = "GET", body, raw = false, withLocation = false, ctx = null, wait = true, repeatable = method === "GET", onCapture } = {}) {
|
|
342
498
|
ctx?.check();
|
|
343
499
|
let cap = await getCapture(service);
|
|
344
500
|
// Opening a tab or waiting for a session can take a minute; a withdrawn request stops waiting.
|
|
345
|
-
let tab = await guarded(findTeamsTab(cap ? new URL(cap.base).origin : null), ctx);
|
|
501
|
+
let tab = await guarded(findTeamsTab(cap ? new URL(cap.base).origin : null, ctx), ctx);
|
|
346
502
|
if (!cap) {
|
|
347
503
|
cap = await guarded(refreshSession(service, tab, { quickWaitMs: service === "substrate" ? 2_000 : 4_000 }), ctx);
|
|
348
504
|
if (!cap) throw new Error(SERVICE_HELP[service]);
|
|
349
505
|
}
|
|
350
506
|
const urlFor = (c) => teams.serviceUrl(path, c.base);
|
|
351
|
-
|
|
507
|
+
const findTab = () => findTeamsTab(new URL(cap.base).origin, ctx);
|
|
508
|
+
await onCapture?.(cap); // may refuse the session (it throws), before anything is sent
|
|
509
|
+
let res = await sendTo(gateKey(service, cap.base), tab, findTab, urlFor(cap), method, cap.headers, body, ctx, wait, repeatable);
|
|
352
510
|
if (res.status === 401) {
|
|
353
511
|
// Rejected before running (expired token), so trying once more is safe. A 403 is a
|
|
354
512
|
// real answer (e.g. no longer a member of that chat).
|
|
355
|
-
|
|
513
|
+
// The session (maybe the account) is changing: lists read with it are read again.
|
|
514
|
+
dropList();
|
|
515
|
+
meetingSessionsCache.clear();
|
|
356
516
|
cap = await guarded(refreshSession(service, tab, { quickWaitMs: 0 }), ctx);
|
|
357
517
|
if (!cap) throw new Error(SERVICE_HELP[service]);
|
|
358
|
-
tab
|
|
359
|
-
|
|
518
|
+
// The tab reloaded (or was closed meanwhile): look the tabs up again.
|
|
519
|
+
if (ctx) ctx.tabs = null;
|
|
520
|
+
tab = await guarded(findTab(), ctx);
|
|
521
|
+
await onCapture?.(cap);
|
|
522
|
+
res = await sendTo(gateKey(service, cap.base), tab, findTab, urlFor(cap), method, cap.headers, body, ctx, wait, repeatable);
|
|
360
523
|
}
|
|
361
524
|
if (raw) return res;
|
|
362
525
|
if (res.status >= 400) {
|
|
@@ -388,18 +551,50 @@ async function myMri() {
|
|
|
388
551
|
return oid ? `8:orgid:${oid}` : null;
|
|
389
552
|
}
|
|
390
553
|
|
|
554
|
+
/**
|
|
555
|
+
* Whose data a capture reads: "<base>\n<oid>", the service's base (origin and region) and the
|
|
556
|
+
* user its token was issued to. An object id is one tenant's, so two tenants (or accounts) in
|
|
557
|
+
* the same region still get different keys. null without a capture.
|
|
558
|
+
*/
|
|
559
|
+
const accountKey = (cap) => (cap ? `${cap.base}\n${cap.oid ?? ""}` : null);
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* The user switched Teams to another account or tenant: forget what the previous one saw.
|
|
563
|
+
* (Throttle gates stay: they are Teams' limits per service and base, not anyone's data.)
|
|
564
|
+
*/
|
|
565
|
+
function forgetAccount() {
|
|
566
|
+
dropList();
|
|
567
|
+
names.clear();
|
|
568
|
+
transcripts.clear();
|
|
569
|
+
meetingSessionsCache.clear();
|
|
570
|
+
myAddressCache = null;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
/** A read that a switch of the signed-in Teams account overtook: what it read, and what a retry reads. */
|
|
574
|
+
const ACCOUNT_CHANGED_WHILE = (what, retry) => `The signed-in Teams account changed while ${what}; it's now signed in as another account, so a retry ${retry}.`;
|
|
575
|
+
|
|
391
576
|
const LIST_CACHE_MS = 60_000;
|
|
392
|
-
let listCache = null; // { until, data: { teams, chats, meetings, namesMissing } }
|
|
577
|
+
let listCache = null; // { key: accountKey of csa, until, data: { teams, chats, meetings, namesMissing } }
|
|
578
|
+
let listGeneration = 0; // bumped by dropList: a read that started before a drop doesn't store its (older) list
|
|
579
|
+
|
|
580
|
+
/** Empties the list cache, also for a read under way: it can't put the list from before this back. */
|
|
581
|
+
function dropList() {
|
|
582
|
+
listCache = null;
|
|
583
|
+
listGeneration++;
|
|
584
|
+
}
|
|
393
585
|
|
|
394
586
|
/**
|
|
395
|
-
* Teams, channels and chats (csa), with names for untitled chats. Cached for a minute
|
|
587
|
+
* Teams, channels and chats (csa), with names for untitled chats. Cached for a minute for the
|
|
588
|
+
* account it was read as (a 401 empties it), but
|
|
396
589
|
* when names are missing (`namesMissing`: { chats, organizers }, see lookupNames) only until
|
|
397
590
|
* Teams' throttle is over, or not at all after another failure, so they are looked up again.
|
|
398
591
|
* A meeting whose organizer's name is missing that way has `organizerNameMissing`.
|
|
399
592
|
*/
|
|
400
593
|
async function teamsAndChats(fresh = false, ctx = null) {
|
|
401
|
-
if (!fresh && listCache && Date.now() < listCache.until) return listCache.data;
|
|
402
|
-
|
|
594
|
+
if (!fresh && listCache && Date.now() < listCache.until && listCache.key === accountKey(await getCapture("csa"))) return listCache.data;
|
|
595
|
+
let readAs = null; // the session the list was read with
|
|
596
|
+
const generation = listGeneration;
|
|
597
|
+
const json = await api("csa", "/api/v1/teams/users/me?isPrefetch=false&enableMembershipSummary=true&enableRC2Fetch=false", { ctx, onCapture: (c) => (readAs = c) });
|
|
403
598
|
const data = { teams: teams.parseTeams(json), chats: teams.parseCsaChats(json), meetings: teams.parseCsaMeetings(json) };
|
|
404
599
|
const chats = await nameChats(data.chats, ctx);
|
|
405
600
|
const organizers = await lookupNames(data.meetings.map((m) => m.organizer), ctx);
|
|
@@ -410,7 +605,11 @@ async function teamsAndChats(fresh = false, ctx = null) {
|
|
|
410
605
|
data.namesMissing = { chats, organizers };
|
|
411
606
|
const missing = [chats, organizers].filter(Boolean);
|
|
412
607
|
const until = missing.some((x) => !x.throttled) ? 0 : missing.length ? Math.max(...missing.map((x) => x.until)) : Date.now() + LIST_CACHE_MS;
|
|
413
|
-
|
|
608
|
+
// Filed under the account it was read as. A switch while it was read leaves nothing of the
|
|
609
|
+
// old account for the new one: not cached, and not used (its chats aren't the new account's).
|
|
610
|
+
const key = accountKey(readAs);
|
|
611
|
+
if (key !== accountKey(await getCapture("csa"))) throw new Error(ACCOUNT_CHANGED_WHILE("the chat list was read", "reads that account's chats"));
|
|
612
|
+
if (generation === listGeneration) listCache = { key, until, data };
|
|
414
613
|
return data;
|
|
415
614
|
}
|
|
416
615
|
|
|
@@ -443,18 +642,26 @@ async function lookupNames(mris, ctx = null, { wait = false } = {}) {
|
|
|
443
642
|
// Names that can't be looked up are left out, but a withdrawn request ends here (and isn't cached).
|
|
444
643
|
ctx?.check();
|
|
445
644
|
const batch = unknown.slice(i, i + 100);
|
|
645
|
+
let readAs = null; // the session the names were looked up with
|
|
446
646
|
const json = await api("mt", "/beta/users/fetchShortProfile?isMailAddress=false&enableGuest=true&includeIBBarredUsers=true&skypeTeamsInfo=true", {
|
|
447
647
|
method: "POST",
|
|
448
648
|
body: batch,
|
|
449
649
|
ctx,
|
|
450
650
|
wait,
|
|
451
651
|
repeatable: true,
|
|
652
|
+
onCapture: (c) => (readAs = c),
|
|
452
653
|
}).catch((err) => {
|
|
453
654
|
ctx?.check(); // a withdrawn request ends here (and isn't cached)
|
|
454
655
|
missing = err?.throttled ? { throttled: true, until: err.until } : (missing ?? { error: err?.message ?? String(err) });
|
|
455
656
|
for (const m of batch) notAsked.add(m);
|
|
456
657
|
return null;
|
|
457
658
|
});
|
|
659
|
+
// Names looked up as an account that is no longer signed in aren't kept.
|
|
660
|
+
if (json && accountKey(readAs) !== accountKey(await getCapture("mt"))) {
|
|
661
|
+
missing ??= { error: ACCOUNT_CHANGED_WHILE("names were looked up", "looks them up as that account") };
|
|
662
|
+
for (const m of batch) notAsked.add(m);
|
|
663
|
+
continue;
|
|
664
|
+
}
|
|
458
665
|
if (names.size > NAMES_MAX) names.clear();
|
|
459
666
|
for (const p of teams.parseProfiles(json)) if (p.mri && p.name) names.set(p.mri, p.name);
|
|
460
667
|
}
|
|
@@ -555,8 +762,8 @@ const spOpening = new Map(); // origin -> Promise of that tab, so parallel calls
|
|
|
555
762
|
* organizer's OneDrive, which doesn't answer the Teams page across origins. Opens the
|
|
556
763
|
* origin in a pinned background tab when none is open.
|
|
557
764
|
*/
|
|
558
|
-
async function sharepointTab(origin) {
|
|
559
|
-
const open = (await
|
|
765
|
+
async function sharepointTab(origin, ctx = null) {
|
|
766
|
+
const open = (await openTabs(ctx)).filter((t) => !t.discarded && t.url?.startsWith(`${origin}/`));
|
|
560
767
|
const ready = open.find((t) => t.status === "complete") ?? open[0];
|
|
561
768
|
if (ready) return ready;
|
|
562
769
|
if (!spOpening.has(origin)) {
|
|
@@ -570,16 +777,14 @@ async function sharepointTab(origin) {
|
|
|
570
777
|
spTabs.set(origin, tab.id);
|
|
571
778
|
}
|
|
572
779
|
// Single sign-on goes through login.microsoftonline.com and comes back.
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
}
|
|
578
|
-
throw new Error(`OneDrive (${origin}) was opened in a background tab but isn't signed in yet. Sign in there, then try again.`);
|
|
780
|
+
const t = await waitForTab(tab.id, (x) => x.status === "complete" && !!x.url?.startsWith(`${origin}/`), OPEN_TAB_WAIT_MS);
|
|
781
|
+
if (t === null) throw new Error("The SharePoint tab that was opened was closed. Try again.");
|
|
782
|
+
if (!t) throw new Error(`OneDrive (${origin}) was opened in a background tab but isn't signed in yet. Sign in there, then try again.`);
|
|
783
|
+
return t;
|
|
579
784
|
})().finally(() => spOpening.delete(origin));
|
|
580
785
|
spOpening.set(origin, p);
|
|
581
786
|
}
|
|
582
|
-
return spOpening.get(origin);
|
|
787
|
+
return knownTab(ctx, await spOpening.get(origin));
|
|
583
788
|
}
|
|
584
789
|
|
|
585
790
|
/** A GET on SharePoint with the browser's own SharePoint session. */
|
|
@@ -587,15 +792,21 @@ async function sharepointGet(url, ctx = null) {
|
|
|
587
792
|
if (!SHAREPOINT_URL.test(url)) throw new Error("Not a SharePoint URL");
|
|
588
793
|
ctx?.check();
|
|
589
794
|
const origin = new URL(url).origin;
|
|
590
|
-
|
|
795
|
+
const findTab = () => sharepointTab(origin, ctx);
|
|
796
|
+
return sendTo(gateKey("sharepoint", origin), await guarded(findTab(), ctx), findTab, url, "GET", {}, null, ctx, true);
|
|
591
797
|
}
|
|
592
798
|
|
|
593
|
-
|
|
594
|
-
|
|
799
|
+
// "<accountKey of chatsvc>\n<transcript URL>" -> parsed transcript; a finished transcript doesn't
|
|
800
|
+
// change, but what one user may read isn't another's. Bounded by size: each counts the length
|
|
801
|
+
// of the response text it was parsed from, least recently used out first, and one longer than
|
|
802
|
+
// the cap isn't kept at all.
|
|
803
|
+
const TRANSCRIPTS_MAX_BYTES = 8 * 1024 * 1024;
|
|
804
|
+
const transcripts = new teams.ByteCache(TRANSCRIPTS_MAX_BYTES);
|
|
595
805
|
|
|
596
806
|
/** A call's transcript (Stream transcript.json) from the organizer's OneDrive. */
|
|
597
807
|
async function transcriptOf(info, session, ctx = null) {
|
|
598
|
-
const
|
|
808
|
+
const key = `${accountKey(await getCapture("chatsvc")) ?? ""}\n${session.transcriptUrl}`;
|
|
809
|
+
const cached = transcripts.get(key);
|
|
599
810
|
if (cached) return cached;
|
|
600
811
|
const url = session.transcriptUrl + (session.transcriptUrl.includes("?") ? "&" : "?") + "format=json";
|
|
601
812
|
const res = await sharepointGet(url, ctx);
|
|
@@ -604,8 +815,9 @@ async function transcriptOf(info, session, ctx = null) {
|
|
|
604
815
|
}
|
|
605
816
|
if (res.status >= 400) throw new Error(`OneDrive HTTP ${res.status} while reading the transcript.`);
|
|
606
817
|
const json = JSON.parse(res.text);
|
|
607
|
-
|
|
608
|
-
|
|
818
|
+
// Not kept for an account that signed in while it was read.
|
|
819
|
+
if (key !== `${accountKey(await getCapture("chatsvc")) ?? ""}\n${session.transcriptUrl}`) return json;
|
|
820
|
+
transcripts.set(key, json, res.text.length);
|
|
609
821
|
return json;
|
|
610
822
|
}
|
|
611
823
|
|
|
@@ -619,9 +831,9 @@ async function resolveMeeting(meeting, ctx = null) {
|
|
|
619
831
|
|
|
620
832
|
const SESSIONS_CACHE_MS = 60_000;
|
|
621
833
|
const SESSIONS_CACHE_MAX = 50;
|
|
622
|
-
/** "<chatsvc
|
|
834
|
+
/** "<accountKey of chatsvc>\n<meeting id>" -> { at, sessions }: one tenant's meetings never answer another's. */
|
|
623
835
|
const meetingSessionsCache = new Map();
|
|
624
|
-
const sessionsKey = (cap, id) => (cap ? `${cap
|
|
836
|
+
const sessionsKey = (cap, id) => (cap ? `${accountKey(cap)}\n${id}` : null);
|
|
625
837
|
|
|
626
838
|
/**
|
|
627
839
|
* The calls held in a meeting chat (see teams.meetingSessions). Cached for a minute, so
|
|
@@ -632,12 +844,12 @@ async function sessionsOf(info, ctx = null) {
|
|
|
632
844
|
const hit = key && meetingSessionsCache.get(key);
|
|
633
845
|
if (hit && Date.now() - hit.at < SESSIONS_CACHE_MS) return hit.sessions;
|
|
634
846
|
const sessions = await readSessions(info, ctx);
|
|
635
|
-
//
|
|
636
|
-
|
|
637
|
-
if (
|
|
638
|
-
meetingSessionsCache.delete(
|
|
847
|
+
// Kept only when the chat was read as the account it is filed under: a session that changed
|
|
848
|
+
// meanwhile (a switch, or a 401 that brought another base) may have read part of it.
|
|
849
|
+
if (key && key === sessionsKey(await getCapture("chatsvc"), info.id)) {
|
|
850
|
+
meetingSessionsCache.delete(key);
|
|
639
851
|
if (meetingSessionsCache.size >= SESSIONS_CACHE_MAX) meetingSessionsCache.delete(meetingSessionsCache.keys().next().value);
|
|
640
|
-
meetingSessionsCache.set(
|
|
852
|
+
meetingSessionsCache.set(key, { at: Date.now(), sessions });
|
|
641
853
|
}
|
|
642
854
|
return sessions;
|
|
643
855
|
}
|
|
@@ -722,12 +934,13 @@ export const handlers = {
|
|
|
722
934
|
};
|
|
723
935
|
},
|
|
724
936
|
|
|
725
|
-
|
|
726
|
-
|
|
937
|
+
// The three lists share teamsAndChats' one-minute cache; `refresh` reads it again first.
|
|
938
|
+
async listTeams({ refresh = false } = {}, ctx) {
|
|
939
|
+
return { teams: (await teamsAndChats(refresh === true, ctx)).teams };
|
|
727
940
|
},
|
|
728
941
|
|
|
729
|
-
async listChats({ query, limit = 30, unreadOnly = false }, ctx) {
|
|
730
|
-
const data = await teamsAndChats(true, ctx);
|
|
942
|
+
async listChats({ query, limit = 30, unreadOnly = false, refresh = false }, ctx) {
|
|
943
|
+
const data = await teamsAndChats(refresh === true, ctx);
|
|
731
944
|
let chats = data.chats;
|
|
732
945
|
if (unreadOnly) chats = chats.filter((c) => c.unread);
|
|
733
946
|
if (query) chats = chats.filter((c) => teams.matchesWords(c.title, query) || c.memberNames?.some((n) => teams.matchesWords(n, query)));
|
|
@@ -796,8 +1009,8 @@ export const handlers = {
|
|
|
796
1009
|
return { count: people.length, people };
|
|
797
1010
|
},
|
|
798
1011
|
|
|
799
|
-
async listMeetings({ query, limit = 20, transcriptOnly = false }, ctx) {
|
|
800
|
-
const data = await teamsAndChats(true, ctx);
|
|
1012
|
+
async listMeetings({ query, limit = 20, transcriptOnly = false, refresh = false }, ctx) {
|
|
1013
|
+
const data = await teamsAndChats(refresh === true, ctx);
|
|
801
1014
|
let meetings = data.meetings;
|
|
802
1015
|
if (query) meetings = meetings.filter((m) => teams.matchesWords(m.title, query) || teams.matchesWords(m.organizerName, query));
|
|
803
1016
|
if (transcriptOnly) meetings = meetings.filter((m) => m.hasTranscript);
|
|
@@ -920,13 +1133,30 @@ export const handlers = {
|
|
|
920
1133
|
return { status: res.status, text: res.text.slice(0, 20_000_000) };
|
|
921
1134
|
},
|
|
922
1135
|
|
|
923
|
-
async apiTraffic({ filter, limit = 100, clear = false }) {
|
|
1136
|
+
async apiTraffic({ filter, limit = 100, clear = false, record }) {
|
|
1137
|
+
if (typeof record === "boolean") {
|
|
1138
|
+
// In the log's queue, so events already reported are recorded (or not) under the old setting.
|
|
1139
|
+
await (trafficQueue = trafficQueue.then(async () => {
|
|
1140
|
+
trafficUntil = record ? Date.now() + TRAFFIC_RECORD_MS : 0;
|
|
1141
|
+
await chrome.storage.session.set({ [TRAFFIC_UNTIL_KEY]: trafficUntil });
|
|
1142
|
+
}).catch(() => {}));
|
|
1143
|
+
}
|
|
924
1144
|
let list;
|
|
925
1145
|
await updateTraffic((l) => {
|
|
926
1146
|
list = l;
|
|
927
|
-
return clear ? [] : l;
|
|
1147
|
+
return clear && l.length ? [] : l;
|
|
928
1148
|
});
|
|
929
|
-
|
|
1149
|
+
const until = await recordingUntil();
|
|
1150
|
+
const recording = Date.now() < until;
|
|
1151
|
+
return {
|
|
1152
|
+
recording,
|
|
1153
|
+
...(recording ? { recordingUntil: new Date(until).toISOString() } : {}),
|
|
1154
|
+
recorded: list.length,
|
|
1155
|
+
requests: teams.filterTraffic(list, { filter, limit }),
|
|
1156
|
+
...(recording
|
|
1157
|
+
? {}
|
|
1158
|
+
: { note: "Recording is off. Call api_traffic with record: true, use the feature in the Teams tab, then call api_traffic again to list its requests." }),
|
|
1159
|
+
};
|
|
930
1160
|
},
|
|
931
1161
|
|
|
932
1162
|
/**
|
|
@@ -942,6 +1172,8 @@ export const handlers = {
|
|
|
942
1172
|
|
|
943
1173
|
async requestSend({ conversation, to, title, text, threadId, subject, autoSendTo }, ctx) {
|
|
944
1174
|
if (!String(text ?? "").trim()) throw new Error("The message is empty.");
|
|
1175
|
+
// Who the window (or an auto-send) is for: taken before anything is looked up for it.
|
|
1176
|
+
const account = await signedInAccount();
|
|
945
1177
|
// The server's allowlist (config autoSendTo) only permits; whether this send goes without the
|
|
946
1178
|
// window is decided below from the target as resolved here (see sendsToMeAlone, isMeAlone).
|
|
947
1179
|
const allow = teams.normalizeAddresses(autoSendTo);
|
|
@@ -951,7 +1183,7 @@ export const handlers = {
|
|
|
951
1183
|
const me = await myMri();
|
|
952
1184
|
if (!me) throw new Error("Teams hasn't shown who is signed in yet. Reload the Teams tab and try again.");
|
|
953
1185
|
if (allow.length && !title && (await sendsToMeAlone(to, me, allow, ctx))) {
|
|
954
|
-
return sendWithoutConfirming({ conversation: NOTES_TO_SELF, text: String(text) }, ctx);
|
|
1186
|
+
return sendWithoutConfirming({ conversation: NOTES_TO_SELF, text: String(text) }, ctx, account);
|
|
955
1187
|
}
|
|
956
1188
|
const people = await resolvePeople(to, me, ctx);
|
|
957
1189
|
if (title && people.length < 2) throw new Error("A title is only for group chats (two or more people besides you).");
|
|
@@ -959,7 +1191,7 @@ export const handlers = {
|
|
|
959
1191
|
const request = existing
|
|
960
1192
|
? { conversation: { id: existing.id, kind: existing.kind, title: existing.title }, people, text: String(text), existingChat: true }
|
|
961
1193
|
: { conversation: null, newChat: { members: people.map((p) => p.mri), title: title ?? null }, people, text: String(text) };
|
|
962
|
-
return askUserToConfirm(request, ctx);
|
|
1194
|
+
return askUserToConfirm(request, ctx, account);
|
|
963
1195
|
}
|
|
964
1196
|
const conv = await resolve(conversation, ctx);
|
|
965
1197
|
if (threadId && conv.kind !== "channel") throw new Error("reply_to is only for channel posts; in a chat, just send the message.");
|
|
@@ -970,8 +1202,8 @@ export const handlers = {
|
|
|
970
1202
|
replyingTo = root ? teams.parseMessage(root) : { id: threadId };
|
|
971
1203
|
}
|
|
972
1204
|
const request = { conversation: conv, text: String(text), threadId: threadId ?? null, subject: subject ?? null, replyingTo };
|
|
973
|
-
if (allow.length && !threadId && !subject && (await isMeAlone(conv, allow, ctx))) return sendWithoutConfirming(request, ctx);
|
|
974
|
-
return askUserToConfirm(request, ctx);
|
|
1205
|
+
if (allow.length && !threadId && !subject && (await isMeAlone(conv, allow, ctx))) return sendWithoutConfirming(request, ctx, account);
|
|
1206
|
+
return askUserToConfirm(request, ctx, account);
|
|
975
1207
|
},
|
|
976
1208
|
};
|
|
977
1209
|
|
|
@@ -979,7 +1211,7 @@ export const handlers = {
|
|
|
979
1211
|
* Creates a chat with these members and me (called only after the user clicked Send).
|
|
980
1212
|
* A 1:1 chat that already exists on Teams' side comes back as that chat.
|
|
981
1213
|
*/
|
|
982
|
-
async function createChat({ members, title }) {
|
|
1214
|
+
async function createChat({ members, title }, account = null) {
|
|
983
1215
|
const me = await myMri();
|
|
984
1216
|
const oneOnOne = members.length === 1;
|
|
985
1217
|
const body = {
|
|
@@ -991,25 +1223,48 @@ async function createChat({ members, title }) {
|
|
|
991
1223
|
...(title ? { topic: title } : {}),
|
|
992
1224
|
},
|
|
993
1225
|
};
|
|
994
|
-
|
|
1226
|
+
let answer;
|
|
1227
|
+
try {
|
|
1228
|
+
answer = await api("chatsvc", "/v1/threads", { method: "POST", body, withLocation: true, onCapture: asConfirmed(account) });
|
|
1229
|
+
} finally {
|
|
1230
|
+
// The chat list changed, or may have: without an answer the chat may exist, and the
|
|
1231
|
+
// list_chats the AI is told to check with must not show the list from before it.
|
|
1232
|
+
dropList();
|
|
1233
|
+
}
|
|
1234
|
+
const { json, location } = answer;
|
|
995
1235
|
const id = teams.threadIdFrom(location, json) ?? (oneOnOne ? teams.oneOnOneId(me, members[0]) : null);
|
|
996
1236
|
if (!id) throw new Error("Teams created no chat (its answer had no chat id).");
|
|
997
|
-
listCache = null; // the chat list changed
|
|
998
1237
|
return id;
|
|
999
1238
|
}
|
|
1000
1239
|
|
|
1001
|
-
|
|
1240
|
+
/**
|
|
1241
|
+
* An onCapture check for a post confirmed as `account` (an oid, or null when Teams hadn't shown
|
|
1242
|
+
* who was signed in): fails before anything is sent when the session it would go out with is
|
|
1243
|
+
* another account's (Teams switched since the click).
|
|
1244
|
+
*/
|
|
1245
|
+
const asConfirmed = (account) => async (cap) => {
|
|
1246
|
+
if (account && (cap.oid ?? (await signedInAccount())) !== account) throw Object.assign(new Error(ACCOUNT_CHANGED), { accountChanged: true });
|
|
1247
|
+
};
|
|
1248
|
+
|
|
1249
|
+
/** Posts a confirmed message; `account`: who confirmed it (see asConfirmed). */
|
|
1250
|
+
async function sendMessage({ conversation, newChat, people, text, threadId, subject }, account = null) {
|
|
1002
1251
|
if (newChat) {
|
|
1003
1252
|
let id;
|
|
1004
1253
|
try {
|
|
1005
|
-
id = await createChat(newChat);
|
|
1254
|
+
id = await createChat(newChat, account);
|
|
1006
1255
|
} catch (err) {
|
|
1007
1256
|
// Without an answer the chat may exist, but the message was never sent.
|
|
1008
1257
|
if (err.outcomeUnknown) err.chatMayExist = true;
|
|
1009
1258
|
throw err;
|
|
1010
1259
|
}
|
|
1011
1260
|
const title = newChat.title ?? people.map((p) => p.name).join(", ");
|
|
1012
|
-
|
|
1261
|
+
let r;
|
|
1262
|
+
try {
|
|
1263
|
+
r = await sendMessage({ conversation: { id, title }, text }, account);
|
|
1264
|
+
} catch (err) {
|
|
1265
|
+
if (err.accountChanged) err.chatCreated = true;
|
|
1266
|
+
throw err;
|
|
1267
|
+
}
|
|
1013
1268
|
return { ...r, newChat: true, conversationId: id };
|
|
1014
1269
|
}
|
|
1015
1270
|
const target = threadId ? `${conversation.id};messageid=${threadId}` : conversation.id;
|
|
@@ -1031,7 +1286,8 @@ async function sendMessage({ conversation, newChat, people, text, threadId, subj
|
|
|
1031
1286
|
postType: "Standard",
|
|
1032
1287
|
crossPostChannels: [],
|
|
1033
1288
|
};
|
|
1034
|
-
const r = await api("chatsvc", `/v1/users/ME/conversations/${encodeURIComponent(target)}/messages`, { method: "POST", body });
|
|
1289
|
+
const r = await api("chatsvc", `/v1/users/ME/conversations/${encodeURIComponent(target)}/messages`, { method: "POST", body, onCapture: asConfirmed(account) });
|
|
1290
|
+
dropList(); // its last message changed: a list_chats right after must not show the old one
|
|
1035
1291
|
return { sent: true, conversation: conversation.title ?? conversation.id, time: r?.OriginalArrivalTime ? new Date(r.OriginalArrivalTime).toISOString() : null };
|
|
1036
1292
|
}
|
|
1037
1293
|
|
|
@@ -1101,12 +1357,16 @@ async function isMeAlone(conv, allow, ctx) {
|
|
|
1101
1357
|
return alone && (await myAddressesOrNone(me, ctx)).some((a) => allow.includes(a));
|
|
1102
1358
|
}
|
|
1103
1359
|
|
|
1104
|
-
/**
|
|
1105
|
-
|
|
1360
|
+
/**
|
|
1361
|
+
* Posts without the window (see above). Once started, the post runs to the end, as after a click.
|
|
1362
|
+
* `account`: who it was judged to reach alone; as after a click, it isn't posted as another (3.3).
|
|
1363
|
+
*/
|
|
1364
|
+
async function sendWithoutConfirming(request, ctx, account = null) {
|
|
1106
1365
|
if (ctx?.cancelled) return WITHDRAWN;
|
|
1107
1366
|
autoSending++;
|
|
1108
1367
|
try {
|
|
1109
|
-
|
|
1368
|
+
if (account && (await signedInAccount()) !== account) return { sent: false, autoSent: true, reason: ACCOUNT_CHANGED };
|
|
1369
|
+
return { ...(await sendMessage(request, account)), autoSent: true, note: AUTO_SENT_NOTE };
|
|
1110
1370
|
} catch (err) {
|
|
1111
1371
|
return { sent: false, autoSent: true, reason: sendFailure(err) };
|
|
1112
1372
|
} finally {
|
|
@@ -1127,6 +1387,18 @@ export function pendingSendCount() {
|
|
|
1127
1387
|
return pendingSends.size;
|
|
1128
1388
|
}
|
|
1129
1389
|
|
|
1390
|
+
const ACCOUNT_CHANGED = "The signed-in Teams account changed since this was confirmed; nothing was sent.";
|
|
1391
|
+
const CHAT_CREATED_ACCOUNT_CHANGED =
|
|
1392
|
+
"The chat was created, but no message was sent: the signed-in Teams account changed while it was being sent. Check with list_chats (as the account that confirmed it) before trying again.";
|
|
1393
|
+
|
|
1394
|
+
/**
|
|
1395
|
+
* The signed-in user's object id (one tenant's), or null before Teams has shown it. A send
|
|
1396
|
+
* window remembers it: a click after a switch to another account posts nothing.
|
|
1397
|
+
*/
|
|
1398
|
+
async function signedInAccount() {
|
|
1399
|
+
return (await chrome.storage.session.get("oid")).oid ?? null;
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1130
1402
|
const WITHDRAWN = {
|
|
1131
1403
|
sent: false,
|
|
1132
1404
|
reason: "The request was withdrawn (cancelled, or the server stopped waiting), so the confirmation window was closed; nothing was sent.",
|
|
@@ -1139,7 +1411,7 @@ const WITHDRAWN = {
|
|
|
1139
1411
|
* the AI was told the send failed. Once the user clicked Send, the post runs to the end
|
|
1140
1412
|
* and its outcome is the answer.
|
|
1141
1413
|
*/
|
|
1142
|
-
async function askUserToConfirm(request, ctx) {
|
|
1414
|
+
async function askUserToConfirm(request, ctx, account = null) {
|
|
1143
1415
|
if (ctx?.cancelled) return WITHDRAWN;
|
|
1144
1416
|
const id = crypto.randomUUID();
|
|
1145
1417
|
const win = await chrome.windows.create({
|
|
@@ -1162,7 +1434,7 @@ async function askUserToConfirm(request, ctx) {
|
|
|
1162
1434
|
resolve(result);
|
|
1163
1435
|
};
|
|
1164
1436
|
const timer = setTimeout(() => finish({ sent: false, reason: "No decision within 5 minutes; nothing was sent." }), CONFIRM_TIMEOUT_MS);
|
|
1165
|
-
pendingSends.set(id, { request, windowId: win.id, timer, finish, sending: false });
|
|
1437
|
+
pendingSends.set(id, { request, account, windowId: win.id, timer, finish, sending: false });
|
|
1166
1438
|
// Withdrawn while the window was opening, or later.
|
|
1167
1439
|
if (ctx?.cancelled) finish(WITHDRAWN);
|
|
1168
1440
|
else if (ctx) stopWatching = ctx.onCancel(() => finish(WITHDRAWN));
|
|
@@ -1173,7 +1445,11 @@ async function askUserToConfirm(request, ctx) {
|
|
|
1173
1445
|
function sendFailure(err) {
|
|
1174
1446
|
// Without an answer the post may have gone through: saying it failed would invite a second one.
|
|
1175
1447
|
const cause = /[.!?]$/.test(err.message) ? err.message : `${err.message}.`;
|
|
1176
|
-
return err.
|
|
1448
|
+
return err.accountChanged
|
|
1449
|
+
? err.chatCreated
|
|
1450
|
+
? CHAT_CREATED_ACCOUNT_CHANGED
|
|
1451
|
+
: ACCOUNT_CHANGED
|
|
1452
|
+
: err.chatMayExist
|
|
1177
1453
|
? `Creating the chat did not finish: ${cause} The chat may have been created, without the message: check with list_chats before trying again.`
|
|
1178
1454
|
: err.outcomeUnknown
|
|
1179
1455
|
? `Sending did not finish: ${cause} The message may have been posted: check with read_messages before sending again.`
|
|
@@ -1202,8 +1478,13 @@ function onConfirmMessage(msg, sender, sendResponse) {
|
|
|
1202
1478
|
}
|
|
1203
1479
|
// From here on the post runs to the end: a withdrawal no longer closes the window.
|
|
1204
1480
|
p.sending = true;
|
|
1481
|
+
// Confirmed as one account, clicked after Teams switched to another: its session would post it.
|
|
1482
|
+
if (p.account && (await signedInAccount()) !== p.account) {
|
|
1483
|
+
p.finish({ sent: false, reason: ACCOUNT_CHANGED }, true);
|
|
1484
|
+
return sendResponse({ ok: false, error: ACCOUNT_CHANGED });
|
|
1485
|
+
}
|
|
1205
1486
|
try {
|
|
1206
|
-
p.finish(await sendMessage(p.request), true);
|
|
1487
|
+
p.finish(await sendMessage(p.request, p.account), true);
|
|
1207
1488
|
sendResponse({ ok: true });
|
|
1208
1489
|
} catch (err) {
|
|
1209
1490
|
p.finish({ sent: false, reason: sendFailure(err) }, true);
|
package/extension/manifest.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"manifest_version": 3,
|
|
3
3
|
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvoz9Wexl4ZqY9YtEyBZsu/Qi5Ft5EjNUNB8b30wgt3AR8TjXI5UumcPQFBIm7ZfvBsjgrh6tBJlygsgFbZ5cB1EiI+WSz/2Wcqwz4eowKMXXPvGuDGrO+2O2zbSpTG19/MwTljI+g0TLfn8Vkoqd8z9MskKk+vCZjjV0Jk8QjVEdHypgM7H8zTuUM06SO12IIZMdeE3IURzf35zbjlfPPkJiDWoo3wB9nxAvLd57xrQhPUB/lGtCJk9mS3SY+/VwOlG5kJ9WS/RCHXcs5Qs7huIlKIatmFz7YiducvTR3DKBbjqbMTyqHzXkmkUmJRqzsYtgtKcz0C0cjFOt6uNdhwIDAQAB",
|
|
4
4
|
"name": "mcp-teams bridge",
|
|
5
|
-
"version": "0.3.
|
|
5
|
+
"version": "0.3.23",
|
|
6
6
|
"description": "Lets AI assistants (via the mcp-teams MCP server) read and search Microsoft Teams chats, channels and meeting transcripts and, with your explicit confirmation, post messages.",
|
|
7
7
|
"minimum_chrome_version": "116",
|
|
8
8
|
"icons": {
|
package/extension/teams.js
CHANGED
|
@@ -54,6 +54,31 @@ export function pickHeaders(requestHeaders) {
|
|
|
54
54
|
return headers.authorization || headers.authentication || headers["x-skypetoken"] ? headers : null;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
const GUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The object id (lowercase GUID) of the user a request's token was issued to, or null.
|
|
61
|
+
* Teams' tokens are JWTs: an AAD bearer token carries `oid`, a skype token
|
|
62
|
+
* `skypeid: "orgid:<oid>"`. An object id belongs to one tenant (a guest has its own in each),
|
|
63
|
+
* so it tells accounts and tenants apart. Only the payload is decoded, locally and without
|
|
64
|
+
* verifying; nothing else of the token is kept.
|
|
65
|
+
*/
|
|
66
|
+
export function tokenOid(headers) {
|
|
67
|
+
for (const value of [headers?.authorization, headers?.authentication, headers?.["x-skypetoken"]]) {
|
|
68
|
+
const jwt = /([A-Za-z0-9_-]+)\.([A-Za-z0-9_-]+)\.[A-Za-z0-9_-]*$/.exec(String(value ?? ""));
|
|
69
|
+
if (!jwt) continue;
|
|
70
|
+
let claims;
|
|
71
|
+
try {
|
|
72
|
+
claims = JSON.parse(atob(jwt[2].replace(/-/g, "+").replace(/_/g, "/")));
|
|
73
|
+
} catch {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
const oid = String(claims?.oid ?? /^orgid:(.+)$/i.exec(String(claims?.skypeid ?? ""))?.[1] ?? "").toLowerCase();
|
|
77
|
+
if (GUID.test(oid)) return oid;
|
|
78
|
+
}
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
|
|
57
82
|
/** A paging link from chatsvc (often on its own host) on the base we send requests to. */
|
|
58
83
|
export function rebase(link, base) {
|
|
59
84
|
const i = link.indexOf("/v1/");
|
|
@@ -837,6 +862,57 @@ export function filterTraffic(list, { filter, limit = 100 } = {}) {
|
|
|
837
862
|
.map(({ key, ...e }) => ({ ...e, lastAt: new Date(e.lastAt).toISOString() }));
|
|
838
863
|
}
|
|
839
864
|
|
|
865
|
+
// ------------------------------------------------------------ caches
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* A least-recently-used cache bounded by bytes, not by entries: set() takes each value's size
|
|
869
|
+
* (the caller's measure, e.g. the length of the text it was parsed from) and evicts the least
|
|
870
|
+
* recently used entries until the total fits the cap. A value bigger than the cap isn't
|
|
871
|
+
* cached at all, and evicts nothing.
|
|
872
|
+
*/
|
|
873
|
+
export class ByteCache {
|
|
874
|
+
#map = new Map(); // key -> { value, bytes }, least recently used first
|
|
875
|
+
#bytes = 0;
|
|
876
|
+
constructor(maxBytes) {
|
|
877
|
+
this.maxBytes = maxBytes;
|
|
878
|
+
}
|
|
879
|
+
get bytes() {
|
|
880
|
+
return this.#bytes;
|
|
881
|
+
}
|
|
882
|
+
get size() {
|
|
883
|
+
return this.#map.size;
|
|
884
|
+
}
|
|
885
|
+
get(key) {
|
|
886
|
+
const e = this.#map.get(key);
|
|
887
|
+
if (!e) return undefined;
|
|
888
|
+
this.#map.delete(key);
|
|
889
|
+
this.#map.set(key, e);
|
|
890
|
+
return e.value;
|
|
891
|
+
}
|
|
892
|
+
set(key, value, bytes) {
|
|
893
|
+
this.delete(key);
|
|
894
|
+
if (bytes > this.maxBytes) return;
|
|
895
|
+
for (const [k, e] of this.#map) {
|
|
896
|
+
if (this.#bytes + bytes <= this.maxBytes) break;
|
|
897
|
+
this.#map.delete(k);
|
|
898
|
+
this.#bytes -= e.bytes;
|
|
899
|
+
}
|
|
900
|
+
this.#map.set(key, { value, bytes });
|
|
901
|
+
this.#bytes += bytes;
|
|
902
|
+
}
|
|
903
|
+
delete(key) {
|
|
904
|
+
const e = this.#map.get(key);
|
|
905
|
+
if (!e) return false;
|
|
906
|
+
this.#map.delete(key);
|
|
907
|
+
this.#bytes -= e.bytes;
|
|
908
|
+
return true;
|
|
909
|
+
}
|
|
910
|
+
clear() {
|
|
911
|
+
this.#map.clear();
|
|
912
|
+
this.#bytes = 0;
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
|
|
840
916
|
// ------------------------------------------------------------ meetings
|
|
841
917
|
|
|
842
918
|
/** The tenant most of the user's non-meeting chats live in: their own organization's. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-teams",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.23",
|
|
4
4
|
"description": "MCP server that lets AI assistants work with Microsoft Teams (web) through a Chrome/Edge extension bridge",
|
|
5
5
|
"keywords": ["mcp", "model-context-protocol", "teams", "microsoft-teams", "microsoft-365", "chat", "claude", "chrome-extension"],
|
|
6
6
|
"repository": {
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"test:system": "tsc -p tsconfig.json && vitest run test/system",
|
|
29
29
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
30
30
|
"probe": "node scripts/probe.mjs",
|
|
31
|
+
"measure-memory": "tsc -p tsconfig.json && node scripts/measure-memory.mjs",
|
|
31
32
|
"update": "node scripts/update.mjs",
|
|
32
33
|
"prepublishOnly": "npm test"
|
|
33
34
|
},
|