@kamilio/wire 0.1.27 → 0.1.29

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.
@@ -1,3 +1,6 @@
1
+ import { createHash } from "node:crypto";
2
+ import { join } from "node:path";
3
+ import { setTimeout as sleep } from "node:timers/promises";
1
4
  import { defineService } from "wire-core";
2
5
  import type { Cookie } from "wire-core";
3
6
  import type { JsonObject } from "wire-core";
@@ -37,9 +40,12 @@ async function zoomText(response: Response, label: string): Promise<string> {
37
40
  return text;
38
41
  }
39
42
 
43
+ class UnavailableDocument extends Error {}
44
+
40
45
  async function zoomJson(response: Response, label: string): Promise<JsonObject> {
41
- const body = await response.json() as JsonObject;
42
46
  if (response.status === 401) throw zoomAuthError();
47
+ if (response.status === 403 || response.status === 404) throw new UnavailableDocument(`Zoom Hub ${label} failed: HTTP ${response.status} ${await response.text()}`);
48
+ const body = await response.json() as JsonObject;
43
49
  if (!response.ok) throw new Error(`Zoom Hub ${label} failed: HTTP ${response.status} ${JSON.stringify(body)}`);
44
50
  return body;
45
51
  }
@@ -153,71 +159,187 @@ function pruneExpiredCookies(jar: CookieJar, now: Date): boolean {
153
159
  return changed;
154
160
  }
155
161
 
162
+ async function connectZoom(runtime: RuntimeCapabilities, pace: boolean) {
163
+ const cookies = await runtime.cookies.loadSaved("zoom");
164
+ if (cookies === null) throw zoomAuthError();
165
+ const jar = cookieJar(cookies);
166
+ const state = { metadata: await runtime.cookies.metadata("zoom") };
167
+ const save = () => runtime.cookies.save("zoom", Object.freeze([...jar.values()]), state.metadata);
168
+ if (pruneExpiredCookies(jar, runtime.clock.now())) await save();
169
+ const accountCookie = [...jar.values()].find((value) => value.name === "zm_aid");
170
+ if (accountCookie === undefined) throw zoomAuthError();
171
+ const accountId = accountCookie.value;
172
+ let nextRequest = 0;
173
+ const zoomRequest = async (url: string, init: RequestInit & { headers: ZoomHeaders }): Promise<Response> => {
174
+ const parsed = new URL(url);
175
+ for (let attempt = 0; ; attempt++) {
176
+ if (pace) {
177
+ const wait = Math.max(nextRequest, Number(state.metadata["hub_retry_at"] ?? 0)) - runtime.clock.now().getTime();
178
+ if (wait > 60_000) throw new Error(`Zoom Hub rate limited; retry after ${new Date(Number(state.metadata["hub_retry_at"])).toISOString()}`);
179
+ if (wait > 0) await sleep(wait);
180
+ }
181
+ const response = await runtime.http.request(url, { ...init, headers: { ...init.headers, cookie: requestCookies(jar, parsed, runtime.clock.now()) } });
182
+ const now = runtime.clock.now();
183
+ nextRequest = now.getTime() + 1000;
184
+ if (applyResponseCookies(jar, parsed, response, now)) await save();
185
+ if (!pace || response.status !== 429) return response;
186
+ await response.body?.cancel();
187
+ const retry = response.headers.get("retry-after");
188
+ const serverDate = Date.parse(response.headers.get("date") ?? "");
189
+ const wait = retry !== null && /^\d+$/.test(retry) ? Number(retry) * 1000
190
+ : retry !== null && Number.isFinite(Date.parse(retry)) ? Date.parse(retry) - (Number.isFinite(serverDate) ? serverDate : now.getTime())
191
+ : 1000 * 2 ** attempt;
192
+ const deadline = now.getTime() + Math.max(1000, wait);
193
+ state.metadata = { ...state.metadata, hub_retry_at: String(deadline) };
194
+ await save();
195
+ if (attempt === 4 || wait > 60_000) throw new Error(`Zoom Hub rate limited; retry after ${new Date(deadline).toISOString()}`);
196
+ }
197
+ };
198
+ const refreshJwt = async (): Promise<string> => {
199
+ const jwtResponse = await zoomRequest("https://hub.zoom.us/nws/common/2.0/nak?pms=Hub%2CUser%3ABase%2CAICW&src=aicw", { headers: { "user-agent": userAgent, "x-requested-with": "XMLHttpRequest", accept: "application/json, text/plain, */*", referer: "https://hub.zoom.us/" } });
200
+ const jwt = zoomJwt(await zoomText(jwtResponse, "JWT"));
201
+ state.metadata = Object.freeze({ ...state.metadata, hub_jwt: jwt, hub_jwt_expires: String(runtime.clock.now().getTime() + 1_800_000) });
202
+ await save();
203
+ return jwt;
204
+ };
205
+ const cachedJwt = state.metadata["hub_jwt"];
206
+ const cachedExpires = state.metadata["hub_jwt_expires"];
207
+ let cached = cachedJwt !== undefined && cachedExpires !== undefined && runtime.clock.now().getTime() < Number(cachedExpires);
208
+ let jwt = cached ? cachedJwt! : await refreshJwt();
209
+ const docsRequest = async (url: string, init: (token: string) => RequestInit & { headers: ZoomHeaders }): Promise<Response> => {
210
+ const response = await zoomRequest(url, init(jwt));
211
+ if (response.status !== 401 || (!cached && !pace)) return response;
212
+ await response.body?.cancel();
213
+ cached = false;
214
+ jwt = await refreshJwt();
215
+ return zoomRequest(url, init(jwt));
216
+ };
217
+ return { accountId, docsRequest };
218
+ }
219
+
220
+ type ZoomClient = Awaited<ReturnType<typeof connectZoom>>;
221
+
222
+ async function transcript(runtime: RuntimeCapabilities, { docsRequest }: ZoomClient, identifier: string, document: JsonObject) {
223
+ const notes = document["meetingNotes"] as JsonObject;
224
+ const meetingId = notes["meetingId"] as string;
225
+ const mainMeetingId = notes["mainMeetingId"] as string;
226
+ const base = { recording_id: identifier, title: document["title"] as string, source_url: document["fileLink"] as string, meeting_id: meetingId, main_meeting_id: mainMeetingId, owner: (document["owner"] as JsonObject)["ownerName"] as string, created_at: (document["createdInfo"] as JsonObject)["time"] as string, updated_at: (document["updatedInfo"] as JsonObject)["time"] as string };
227
+ if (meetingId !== "") {
228
+ const statusResponse = await docsRequest(`https://us01docs.zoom.us/api/meeting/transcript_status?meetingId=${encodeURIComponent(meetingId)}`, (token) => ({ headers: hubHeaders(token) }));
229
+ const status = (await zoomJson(statusResponse, "transcript status"))["aicTranscript"] as JsonObject;
230
+ if (!(status["exist"] as boolean) || !(status["canAccess"] as boolean)) {
231
+ const result = { ...base, transcript: "", state: status["exist"] as boolean ? "denied" : "missing" };
232
+ const markdown = [`# ${result.title}`, "", `- Transcript state: ${result.state}`, `- Recording ID: ${result.recording_id}`, `- Meeting ID: ${result.meeting_id}`, `- Main meeting ID: ${result.main_meeting_id}`, `- Owner: ${result.owner}`, `- Zoom document: ${result.source_url}`].join("\n");
233
+ return { document: Object.freeze({ title: result.title, markdown, data: result }), archive: null };
234
+ }
235
+ }
236
+ const transcriptResponse = await docsRequest(`https://us01docs.zoom.us/api/bridge/meeting/transcripts/v2?meetingId=${encodeURIComponent(meetingId)}&fileId=${encodeURIComponent(identifier)}`, (token) => ({ headers: hubHeaders(token) }));
237
+ const raw = await zoomJson(transcriptResponse, "transcript");
238
+ const speakers = raw["speakers"] as readonly JsonObject[];
239
+ const speakerMap = new Map(speakers.map((speaker) => [speaker["userId"] as string, speaker["username"] as string]));
240
+ const segments = (raw["items"] as readonly JsonObject[]).map(item => {
241
+ const speaker_id = item["userId"] as string;
242
+ return { start: item["startTime"] as string, end: item["endTime"] as string, speaker_id, speaker: speakerMap.get(speaker_id) ?? speaker_id, text: item["text"] as string };
243
+ });
244
+ const turns: string[] = [];
245
+ let previous: string | undefined;
246
+ let length = 0;
247
+ for (const segment of segments) {
248
+ const text = segment.text.trim();
249
+ if (!text) continue;
250
+ if (segment.speaker_id === previous && length + text.length < 600) {
251
+ turns[turns.length - 1] += " " + text;
252
+ length += 1 + text.length;
253
+ } else {
254
+ turns.push(`- [${segment.start.replace(/\.000$/, "")}] **${segment.speaker}:** ${text}`);
255
+ previous = segment.speaker_id;
256
+ length = text.length;
257
+ }
258
+ }
259
+ const transcript = turns.join("\n\n");
260
+ const result = { ...base, meeting_start_time: new Date(Number(raw["meetingStartTime"])).toISOString().replace("Z", "+00:00"), participants: speakers.map((speaker) => speaker["username"] as string), transcript, raw, state: "ready" };
261
+ const lines = [`# ${result.title}`, "", `- Meeting start: ${formatMeetingStartTime(result.meeting_start_time, runtime.clock.localTimezone())}`, `- Owner: ${result.owner}`, `- Zoom document: ${result.source_url}`, "", "## Transcript", "", result.transcript];
262
+ return { document: Object.freeze({ title: transcriptTitle(result.title, result.meeting_start_time, runtime.clock.localTimezone()), markdown: lines.join("\n"), data: result }), archive: { ...base, meeting_start_time: result.meeting_start_time, participants: result.participants, segments } };
263
+ }
264
+
156
265
  export const zoomHubService = defineService<RuntimeCapabilities>({
157
266
  name: "zoom-hub",
158
267
  matches: (url) => url.hostname === "hub.zoom.us" && /^\/doc\/[^/]+\/?$/.test(url.pathname),
159
268
  parse: (url) => Object.freeze({ service: "zoom-hub", identifier: /^\/doc\/([^/]+)\/?$/.exec(url.pathname)![1]!, type: "transcript" }),
160
269
  fetch: async (runtime, _url, source) => {
161
- const cookies = await runtime.cookies.loadSaved("zoom");
162
- if (cookies === null) throw zoomAuthError();
163
- const jar = cookieJar(cookies);
164
- const state = { metadata: await runtime.cookies.metadata("zoom") };
165
- const save = () => runtime.cookies.save("zoom", Object.freeze([...jar.values()]), state.metadata);
166
- if (pruneExpiredCookies(jar, runtime.clock.now())) await save();
167
- const accountCookie = [...jar.values()].find((value) => value.name === "zm_aid");
168
- if (accountCookie === undefined) throw zoomAuthError();
169
- const accountId = accountCookie.value;
170
- const zoomRequest = async (url: string, init: RequestInit & { headers: ZoomHeaders }): Promise<Response> => {
171
- const parsed = new URL(url);
172
- const response = await runtime.http.request(url, { ...init, headers: { ...init.headers, cookie: requestCookies(jar, parsed, runtime.clock.now()) } });
173
- if (applyResponseCookies(jar, parsed, response, runtime.clock.now())) await save();
174
- return response;
175
- };
176
- const refreshJwt = async (): Promise<string> => {
177
- const jwtResponse = await zoomRequest("https://hub.zoom.us/nws/common/2.0/nak?pms=Hub%2CUser%3ABase%2CAICW&src=aicw", { headers: { "user-agent": userAgent, "x-requested-with": "XMLHttpRequest", accept: "application/json, text/plain, */*", referer: "https://hub.zoom.us/" } });
178
- const jwt = zoomJwt(await zoomText(jwtResponse, "JWT"));
179
- state.metadata = Object.freeze({ ...state.metadata, hub_jwt: jwt, hub_jwt_expires: String(runtime.clock.now().getTime() + 1_800_000) });
180
- await save();
181
- return jwt;
182
- };
183
- const cachedJwt = state.metadata["hub_jwt"];
184
- const cachedExpires = state.metadata["hub_jwt_expires"];
185
- let cached = cachedJwt !== undefined && cachedExpires !== undefined && runtime.clock.now().getTime() < Number(cachedExpires);
186
- let jwt = cached ? cachedJwt! : await refreshJwt();
187
- const docsRequest = async (url: string, init: (token: string) => RequestInit & { headers: ZoomHeaders }): Promise<Response> => {
188
- const response = await zoomRequest(url, init(jwt));
189
- if (response.status !== 401 || !cached) return response;
190
- cached = false;
191
- jwt = await refreshJwt();
192
- return zoomRequest(url, init(jwt));
193
- };
270
+ const client = await connectZoom(runtime, false);
271
+ const { accountId, docsRequest } = client;
194
272
  const fileResponse = await docsRequest("https://us01docs.zoom.us/api/file/files/action/batch_get", (token) => ({ method: "POST", headers: hubHeaders(token, "application/json"), body: JSON.stringify({ ids: [source.identifier], accountId }) }));
195
273
  const files = (await zoomJson(fileResponse, "file batch_get"))["successItems"] as readonly JsonObject[];
196
274
  if (files.length === 0) throw new Error(`Zoom Hub file ${source.identifier} was not returned by batch_get`);
197
275
  const document = files[0]!;
198
- const notes = document["meetingNotes"] as JsonObject;
199
- const meetingId = notes["meetingId"] as string;
200
- const mainMeetingId = notes["mainMeetingId"] as string;
201
- const base = { recording_id: source.identifier, title: document["title"] as string, source_url: document["fileLink"] as string, meeting_id: meetingId, main_meeting_id: mainMeetingId, owner: (document["owner"] as JsonObject)["ownerName"] as string, created_at: (document["createdInfo"] as JsonObject)["time"] as string, updated_at: (document["updatedInfo"] as JsonObject)["time"] as string };
202
- if (meetingId !== "") {
203
- const statusResponse = await docsRequest(`https://us01docs.zoom.us/api/meeting/transcript_status?meetingId=${encodeURIComponent(meetingId)}`, (token) => ({ headers: hubHeaders(token) }));
204
- const status = (await zoomJson(statusResponse, "transcript status"))["aicTranscript"] as JsonObject;
205
- if (!(status["exist"] as boolean) || !(status["canAccess"] as boolean)) {
206
- const result = { ...base, transcript: "", state: status["exist"] as boolean ? "denied" : "missing" };
207
- const markdown = [`# ${result.title}`, "", `- Transcript state: ${result.state}`, `- Recording ID: ${result.recording_id}`, `- Meeting ID: ${result.meeting_id}`, `- Main meeting ID: ${result.main_meeting_id}`, `- Owner: ${result.owner}`, `- Zoom document: ${result.source_url}`].join("\n");
208
- return Object.freeze({ title: result.title, markdown, data: result });
209
- }
210
- }
211
- const transcriptResponse = await docsRequest(`https://us01docs.zoom.us/api/bridge/meeting/transcripts/v2?meetingId=${encodeURIComponent(meetingId)}&fileId=${encodeURIComponent(source.identifier)}`, (token) => ({ headers: hubHeaders(token) }));
212
- const raw = await zoomJson(transcriptResponse, "transcript");
213
- const speakers = raw["speakers"] as readonly JsonObject[];
214
- const speakerMap = new Map(speakers.map((speaker) => [speaker["userId"] as string, speaker["username"] as string]));
215
- const transcript = (raw["items"] as readonly JsonObject[]).map((item) => {
216
- const userId = item["userId"] as string;
217
- return `- [${item["startTime"] as string}] **${speakerMap.get(userId) ?? userId}:** ${item["text"] as string}`;
218
- }).join("\n");
219
- const result = { ...base, meeting_start_time: new Date(Number(raw["meetingStartTime"])).toISOString().replace("Z", "+00:00"), participants: speakers.map((speaker) => speaker["username"] as string), transcript, raw, state: "ready" };
220
- const lines = [`# ${result.title}`, "", `- Meeting start: ${formatMeetingStartTime(result.meeting_start_time, runtime.clock.localTimezone())}`, `- Owner: ${result.owner}`, `- Zoom document: ${result.source_url}`, "", "## Transcript", "", result.transcript];
221
- return Object.freeze({ title: transcriptTitle(result.title, result.meeting_start_time, runtime.clock.localTimezone()), markdown: lines.join("\n"), data: result });
276
+ return (await transcript(runtime, client, source.identifier, document)).document;
222
277
  },
223
278
  });
279
+
280
+ export async function scrapeZoom(runtime: RuntimeCapabilities, directory: string) {
281
+ const client = await connectZoom(runtime, true);
282
+ const request = async (path: string, body?: JsonObject) => zoomJson(await client.docsRequest(
283
+ "https://us01docs.zoom.us/api/" + path, token => body === undefined ? { headers: hubHeaders(token) }
284
+ : { method: "POST", headers: hubHeaders(token, "application/json"), body: JSON.stringify(body) }), path);
285
+ const seen = new Set<string>();
286
+ const counts = { downloaded: 0, unchanged: 0, unavailable: 0, locallyModified: 0 };
287
+ const digest = (text: string) => createHash("sha256").update(text).digest("hex");
288
+ const sync = async (file: JsonObject) => {
289
+ const id = file["id"] as string;
290
+ const notes = file["meetingNotes"] as JsonObject | null;
291
+ if (file["isDeleted"] || !notes || !(notes["meetingId"] || notes["mainMeetingId"] || notes["source"] === "1pMeeting") || seen.has(id)) return;
292
+ seen.add(id);
293
+ const path = join(directory, "zoom", encodeURIComponent(id) + ".md");
294
+ const version = (file["updatedInfo"] as JsonObject)["time"];
295
+ const jsonPath = join(directory, "zoom", encodeURIComponent(id) + ".json");
296
+ const hasJson = await runtime.filesystem.exists(jsonPath);
297
+ if (await runtime.filesystem.exists(path)) {
298
+ const contents = await runtime.filesystem.readText(path);
299
+ const marker = /\n\n<!-- wire:zoom (\S+) ([a-f0-9]{64})(?: ([a-f0-9]{64}))? -->\n$/.exec(contents);
300
+ if (!marker || digest(contents.slice(0, marker.index)) !== marker[2]) { counts.locallyModified++; return; }
301
+ if (hasJson && digest(await runtime.filesystem.readText(jsonPath)) !== marker[3]) { counts.locallyModified++; return; }
302
+ if (hasJson && version === marker[1]) { counts.unchanged++; return; }
303
+ } else if (hasJson) { counts.locallyModified++; return; }
304
+ let doc;
305
+ try { doc = await transcript(runtime, client, id, file); }
306
+ catch (error) {
307
+ if (!(error instanceof UnavailableDocument)) throw error;
308
+ counts.unavailable++; return;
309
+ }
310
+ if (!doc.archive || !doc.document.data.transcript) { counts.unavailable++; return; }
311
+ const json = JSON.stringify(doc.archive, null, 2) + "\n";
312
+ await runtime.filesystem.writeText(path, doc.document.markdown + `\n\n<!-- wire:zoom ${version} ${digest(doc.document.markdown)} ${digest(json)} -->\n`);
313
+ await runtime.filesystem.writeText(jsonPath, json);
314
+ counts.downloaded++;
315
+ };
316
+ let token = "";
317
+ const tokens = new Set<string>();
318
+ do {
319
+ const page = await request("file/recent?limit=50" + (token ? "&pagingToken=" + encodeURIComponent(token) : ""));
320
+ for (const entry of page["recentFiles"] as readonly JsonObject[]) await sync(entry["file"] as JsonObject);
321
+ token = page["nextPagingToken"] as string;
322
+ if (token && tokens.has(token)) throw new Error("Zoom Hub repeated a recent files page token");
323
+ tokens.add(token);
324
+ } while (token);
325
+
326
+ const first = Date.UTC(2011, 0, 1);
327
+ for (let end = runtime.clock.now().getTime(); end >= first;) {
328
+ const start = Math.max(first, end - 30 * 86400_000 + 1);
329
+ for (let pageNum = 0; ; pageNum++) {
330
+ const page = await request("meeting/list_my_meetings", { startTime: start, endTime: end, pageNum, pageSize: 50, meetingFilter: 0, filters: {}, query: "" });
331
+ const ids = [...new Set((page["meetings"] as readonly JsonObject[]).map(m => m["meetingId"] as string))];
332
+ for (let i = 0; i < ids.length; i += 5) {
333
+ const assets = await request("hub/files/batch_get_meeting_assets", { meetingIds: ids.slice(i, i + 5), meetingAccountId: client.accountId });
334
+ for (const entry of Object.values(assets["meetingAssetsMap"] as Record<string, JsonObject>)) {
335
+ for (const item of entry["createFromMeeting"] as readonly JsonObject[]) {
336
+ if (item["doc"]) await sync(item["doc"] as JsonObject);
337
+ }
338
+ }
339
+ }
340
+ if (!page["hasNext"]) break;
341
+ }
342
+ end = start - 1;
343
+ }
344
+ return counts;
345
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kamilio/wire",
3
- "version": "0.1.27",
3
+ "version": "0.1.29",
4
4
  "description": "Attach Notion, Google Docs, Slack, Gmail, Asana, ChatGPT, and Zoom resources as local Markdown you can sync.",
5
5
  "keywords": [
6
6
  "markdown",
@@ -2,12 +2,13 @@ import { UserError, defineCommand, defineGroup, S, type Group } from "toolcraft"
2
2
 
3
3
  import { defaultWireBackend, registryPathForBackend, type JsonObject, type FetchedDocument, type InitializedWire, type Resource, type SwitchedWireBackend, type Wire, type WireBackend, type WireResult, type WireWatchSession } from "wire-core";
4
4
  import type { listAsanaProjects, listAsanaTasks, moveAsanaTask, showAsanaProject } from "provider-asana";
5
+ import type { zoomProvider } from "provider-zoom";
5
6
  import type { SlackSentMessage } from "provider-slack";
6
7
  import type { Auth, AuthResult, AuthService } from "../auth.js";
7
8
 
8
9
  export type WireRoot = Group;
9
10
  export type TextInputReader = () => Promise<string>;
10
- export type WireRootOptions = Readonly<{ allowPaste: boolean }>;
11
+ export type WireRootOptions = Readonly<{ allowPaste: boolean; scrapeZoom?: () => ReturnType<typeof zoomProvider.scrape> }>;
11
12
 
12
13
  const authServices = ["asana", "chatgpt", "gmail", "google-docs", "notion", "slack", "zoom"] as const;
13
14
  const removedCliCommandNames = Object.freeze({
@@ -208,6 +209,7 @@ function wireUserErrorMessage(message: string): boolean {
208
209
  || /^Asana API /.test(message)
209
210
  || /^(GET|POST|PUT|DELETE) \/.* failed: \d+ /.test(message)
210
211
  || /^(Invalid Asana project heading|Asana section appears|Asana milestone appears|Asana task appears|Asana subtask appears|Unsupported Asana Markdown|Duplicate Asana identity|Missing Asana project heading|Asana project identity changed|Unknown Asana identity|Conflicting Asana edits)/.test(message)
212
+ || /^Zoom Hub rate limited; retry after /.test(message)
211
213
  || /^ChatGPT conversation download failed\. Run `wire chatgpt login`\./.test(message)
212
214
  || /^Gmail API .+ failed: HTTP \d+ /.test(message)
213
215
  || /^Slack API [\w.]+ failed: /.test(message)
@@ -557,6 +559,11 @@ export function createRoot(wire: Wire, currentDirectory: string, auth?: Auth, re
557
559
  render: render<JsonObject>((comment) => `Updated comment ${comment["gid"]}`),
558
560
  })] })] : []),
559
561
  ] });
562
+ if (service === "zoom" && options.scrapeZoom) return defineGroup({ ...group, children: [...group.children, defineCommand({
563
+ name: "scrape", scope: ["cli"], description: "Sync available Zoom Hub transcripts into ./zoom without deleting existing files.", params: S.Object({}),
564
+ handler: () => userFacing(options.scrapeZoom!),
565
+ render: render<Awaited<ReturnType<typeof zoomProvider.scrape>>>(v => `Zoom: ${v.downloaded} downloaded, ${v.unchanged} unchanged, ${v.unavailable} unavailable, ${v.locallyModified} locally modified.`),
566
+ })] });
560
567
  if (service !== "slack") return users.length === 0 ? group : defineGroup({ ...group, children: [...group.children, ...users] });
561
568
  return defineGroup({ name: "slack", description: "Read Slack channels, DMs, and threads, send Markdown, and manage login.", children: [preview, defaultAttach, sync, ...group.children, ...users, ...(sendSlack === undefined ? [] : [defineCommand({
562
569
  name: "send",
package/src/cli.ts CHANGED
@@ -243,6 +243,7 @@ function excessPositionals(argv: readonly string[]): Readonly<{ commandPath: str
243
243
  if (command === "slack" && slackResourceCommands.has(words[1]!)) return { commandPath: `slack ${words[1]}`, expected: 1, received: words.length - 2 };
244
244
  if ((command === "slack" || command === "notion" || command === "asana") && words[1] === "users" && words[2] === "lookup") return { commandPath: `${command} users lookup`, expected: 1, received: words.length - 3 };
245
245
  if (command === "slack" && (words[1] === "send" || words[1] === "edit")) return { commandPath: `slack ${words[1]}`, expected: 2, received: words.length - 2 };
246
+ if (command === "zoom" && words[1] === "scrape") return { commandPath: "zoom scrape", expected: 0, received: words.length - 2 };
246
247
  if (authServices.has(command)) {
247
248
  const authCommand = words[1];
248
249
  if (authCommand === undefined || !authCommands.has(authCommand)) return null;
@@ -297,7 +298,7 @@ function renderRemovedCommand(argv: readonly string[]): boolean {
297
298
  function renderUnknownAuthCommand(argv: readonly string[]): boolean {
298
299
  if (hasRootSeparator(argv)) return false;
299
300
  const words = positionalWords(argv);
300
- if (words === null || words.length < 2 || !authServices.has(words[0]!) || authCommands.has(words[1]!) || words[0] === "asana" && (words[1] === "projects" || words[1] === "tasks" || words[1] === "comments") || (words[0] === "slack" || words[0] === "notion" || words[0] === "asana") && words[1] === "users" || words[0] === "slack" && (words[1] === "send" || words[1] === "edit" || slackResourceCommands.has(words[1]!))) return false;
301
+ if (words === null || words.length < 2 || !authServices.has(words[0]!) || authCommands.has(words[1]!) || (words[0] === "zoom" && words[1] === "scrape") || words[0] === "asana" && (words[1] === "projects" || words[1] === "tasks" || words[1] === "comments") || (words[0] === "slack" || words[0] === "notion" || words[0] === "asana") && words[1] === "users" || words[0] === "slack" && (words[1] === "send" || words[1] === "edit" || slackResourceCommands.has(words[1]!))) return false;
301
302
  renderCliError(argv, `Unknown command: ${words[1]}`, `wire ${words[0]} --help`, `Unknown command: ${cliValue(words[1]!)}`);
302
303
  return true;
303
304
  }
package/src/executable.ts CHANGED
@@ -5,6 +5,7 @@ import { dirname, isAbsolute, join, resolve } from "node:path";
5
5
  import { addAsanaComment, createAsanaTask, editAsanaComment, editAsanaTask, listAsanaProjects, listAsanaTasks, lookupAsanaUsers, moveAsanaTask, showAsanaProject, showAsanaTask } from "provider-asana";
6
6
  import { sendSlackMessage, editSlackMessage, lookupSlackUsers } from "provider-slack";
7
7
 
8
+ import { zoomProvider } from "provider-zoom";
8
9
  import { lookupNotionUsers } from "provider-notion";
9
10
 
10
11
  import { createRoot } from "./adapters/root.js";
@@ -130,7 +131,7 @@ export function createExecutableRoot(environment: NodeEnvironment, currentDirect
130
131
  switchBackend: baseWire.switchBackend,
131
132
  });
132
133
  const wire = withWireHooks(configuredWire, { currentDirectory, home, environment: configuredEnvironment() });
133
- return createRoot(wire, currentDirectory, auth, readStandardInput, options, (destination, markdown) => sendSlackMessage(runtime, destination, markdown), (query) => lookupSlackUsers(runtime, query), (url, markdown) => editSlackMessage(runtime, url, markdown), (query) => lookupNotionUsers(runtime, query), {
134
+ return createRoot(wire, currentDirectory, auth, readStandardInput, { ...options, scrapeZoom: () => zoomProvider.scrape(runtime, currentDirectory) }, (destination, markdown) => sendSlackMessage(runtime, destination, markdown), (query) => lookupSlackUsers(runtime, query), (url, markdown) => editSlackMessage(runtime, url, markdown), (query) => lookupNotionUsers(runtime, query), {
134
135
  lookup: (query) => lookupAsanaUsers(runtime, query), projects: () => listAsanaProjects(runtime), project: (project) => showAsanaProject(runtime, project), tasks: (project) => listAsanaTasks(runtime, project), show: (task) => showAsanaTask(runtime, task),
135
136
  writes: { move: (task, project, section) => moveAsanaTask(runtime, task, project, section), create: (project, title, section, body, assignee) => createAsanaTask(runtime, project, title, section, body, assignee), edit: (task, fields) => editAsanaTask(runtime, task, fields), comment: (task, body) => addAsanaComment(runtime, task, body), editComment: (comment, body) => editAsanaComment(runtime, comment, body) },
136
137
  });