@max1874/feishu 0.2.26 → 0.2.27

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/docx.ts +40 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@max1874/feishu",
3
- "version": "0.2.26",
3
+ "version": "0.2.27",
4
4
  "type": "module",
5
5
  "description": "OpenClaw Feishu/Lark channel plugin",
6
6
  "license": "MIT",
package/src/docx.ts CHANGED
@@ -868,6 +868,13 @@ const SetPermissionSchema = Type.Object({
868
868
  }),
869
869
  });
870
870
 
871
+ const TransferOwnerSchema = Type.Object({
872
+ doc_token: Type.String({ description: "Document token" }),
873
+ new_owner_open_id: Type.Optional(
874
+ Type.String({ description: "Open ID of the new owner. Omit to transfer to the current conversation sender." }),
875
+ ),
876
+ });
877
+
871
878
  // Wiki Schemas
872
879
  const WikiTokenSchema = Type.Object({
873
880
  wiki_token: Type.String({ description: "Wiki token (extract from URL /wiki/XXX)" }),
@@ -1355,5 +1362,37 @@ export function registerFeishuDocTools(api: OpenClawPluginApi) {
1355
1362
  { name: "feishu_chat_messages" },
1356
1363
  );
1357
1364
 
1358
- api.logger.info?.(`feishu_doc: Registered 15 document/wiki/messaging tools`);
1365
+ // Tool 16: feishu_doc_transfer_owner
1366
+ api.registerTool(
1367
+ {
1368
+ name: "feishu_doc_transfer_owner",
1369
+ label: "Feishu Doc Transfer Owner",
1370
+ description:
1371
+ "Transfer ownership of a Feishu document to another user. " +
1372
+ "If new_owner_open_id is omitted, transfers to the current conversation sender.",
1373
+ parameters: TransferOwnerSchema,
1374
+ async execute(_toolCallId, params) {
1375
+ const { doc_token, new_owner_open_id } = params as {
1376
+ doc_token: string;
1377
+ new_owner_open_id?: string;
1378
+ };
1379
+ try {
1380
+ const openId = new_owner_open_id || getConversationContext()?.senderOpenId;
1381
+ if (!openId) {
1382
+ return json({
1383
+ error:
1384
+ "No new_owner_open_id provided and no current conversation context available.",
1385
+ });
1386
+ }
1387
+ const result = await transferOwner(getClient(), doc_token, openId);
1388
+ return json(result);
1389
+ } catch (err) {
1390
+ return json({ error: err instanceof Error ? err.message : String(err) });
1391
+ }
1392
+ },
1393
+ },
1394
+ { name: "feishu_doc_transfer_owner" },
1395
+ );
1396
+
1397
+ api.logger.info?.(`feishu_doc: Registered 16 document/wiki/messaging tools`);
1359
1398
  }