@teamclaw/feishu-agent 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +24 -22
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2355,23 +2355,24 @@ class AuthManager {
|
|
|
2355
2355
|
const { homedir: homedir2 } = await import("node:os");
|
|
2356
2356
|
const localConfigPath = ".feishu_agent/config.json";
|
|
2357
2357
|
try {
|
|
2358
|
-
const
|
|
2359
|
-
const
|
|
2360
|
-
|
|
2361
|
-
|
|
2358
|
+
const content2 = await readFile(localConfigPath, "utf-8");
|
|
2359
|
+
const config2 = JSON.parse(content2);
|
|
2360
|
+
config2.userAccessToken = token.accessToken;
|
|
2361
|
+
config2.refreshToken = token.refreshToken;
|
|
2362
2362
|
await mkdir2(".feishu_agent", { recursive: true });
|
|
2363
|
-
await writeFile(localConfigPath, JSON.stringify(
|
|
2363
|
+
await writeFile(localConfigPath, JSON.stringify(config2, null, 2));
|
|
2364
2364
|
return;
|
|
2365
2365
|
} catch {}
|
|
2366
2366
|
const globalConfigPath = join2(homedir2(), ".feishu-agent", "config.json");
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2367
|
+
const content = await readFile(globalConfigPath, "utf-8");
|
|
2368
|
+
const config = JSON.parse(content);
|
|
2369
|
+
config.userAccessToken = token.accessToken;
|
|
2370
|
+
config.refreshToken = token.refreshToken;
|
|
2371
|
+
await writeFile(globalConfigPath, JSON.stringify(config, null, 2));
|
|
2372
|
+
} catch (error) {
|
|
2373
|
+
console.error("Warning: Failed to save updated tokens to config file.");
|
|
2374
|
+
console.error("Tokens will need to be refreshed again on next run.");
|
|
2375
|
+
}
|
|
2375
2376
|
}
|
|
2376
2377
|
}
|
|
2377
2378
|
|
|
@@ -3186,8 +3187,9 @@ class CalendarManager {
|
|
|
3186
3187
|
attendees: event.attendeeUserIds.map((id) => ({
|
|
3187
3188
|
type: "user",
|
|
3188
3189
|
user_id: id
|
|
3189
|
-
}))
|
|
3190
|
-
|
|
3190
|
+
})),
|
|
3191
|
+
need_notification: true
|
|
3192
|
+
}, { user_id_type: "union_id" });
|
|
3191
3193
|
}
|
|
3192
3194
|
return createdEvent;
|
|
3193
3195
|
}
|
|
@@ -3474,7 +3476,7 @@ async function handleCreateEvent(config, options) {
|
|
|
3474
3476
|
console.error("Error: --summary, --start, and --end are required.");
|
|
3475
3477
|
process.exit(1);
|
|
3476
3478
|
}
|
|
3477
|
-
let
|
|
3479
|
+
let attendeeUserIds = [];
|
|
3478
3480
|
if (attendeeName && attendeeName.length > 0) {
|
|
3479
3481
|
console.log(`
|
|
3480
3482
|
\uD83D\uDD0D Resolving attendee names...`);
|
|
@@ -3491,12 +3493,12 @@ async function handleCreateEvent(config, options) {
|
|
|
3491
3493
|
});
|
|
3492
3494
|
console.log(" Using the first match.");
|
|
3493
3495
|
}
|
|
3494
|
-
|
|
3496
|
+
attendeeUserIds.push(results[0].union_id);
|
|
3495
3497
|
console.log(` \u2713 "${name}" -> ${results[0].name} (${results[0].union_id})`);
|
|
3496
3498
|
}
|
|
3497
3499
|
}
|
|
3498
3500
|
if (attendee && attendee.length > 0) {
|
|
3499
|
-
|
|
3501
|
+
attendeeUserIds = [...attendeeUserIds, ...attendee];
|
|
3500
3502
|
}
|
|
3501
3503
|
let targetCalendarId = calendarId;
|
|
3502
3504
|
if (!targetCalendarId) {
|
|
@@ -3515,15 +3517,15 @@ async function handleCreateEvent(config, options) {
|
|
|
3515
3517
|
summary,
|
|
3516
3518
|
startTime: { timestamp: startTimestamp },
|
|
3517
3519
|
endTime: { timestamp: endTimestamp },
|
|
3518
|
-
attendeeUserIds:
|
|
3520
|
+
attendeeUserIds: attendeeUserIds.length > 0 ? attendeeUserIds : undefined
|
|
3519
3521
|
});
|
|
3520
3522
|
console.log(`
|
|
3521
3523
|
\u2705 Event created!`);
|
|
3522
3524
|
console.log(` Title: ${summary}`);
|
|
3523
3525
|
console.log(` Time: ${new Date(parseInt(startTimestamp) * 1000).toLocaleString()} - ${new Date(parseInt(endTimestamp) * 1000).toLocaleString()}`);
|
|
3524
3526
|
console.log(` Calendar ID: ${targetCalendarId}`);
|
|
3525
|
-
if (
|
|
3526
|
-
console.log(` Attendees: ${
|
|
3527
|
+
if (attendeeUserIds.length > 0) {
|
|
3528
|
+
console.log(` Attendees: ${attendeeUserIds.join(", ")}`);
|
|
3527
3529
|
}
|
|
3528
3530
|
}
|
|
3529
3531
|
async function handleDeleteEvent(config, options) {
|
|
@@ -3768,7 +3770,7 @@ async function handleSearch(config, query) {
|
|
|
3768
3770
|
// package.json
|
|
3769
3771
|
var package_default = {
|
|
3770
3772
|
name: "@teamclaw/feishu-agent",
|
|
3771
|
-
version: "1.0.
|
|
3773
|
+
version: "1.0.10",
|
|
3772
3774
|
description: "Feishu Agent CLI for AI assistants",
|
|
3773
3775
|
type: "module",
|
|
3774
3776
|
private: false,
|