feishu-user-plugin 1.3.7 → 1.3.9
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/.claude-plugin/plugin.json +13 -3
- package/CHANGELOG.md +87 -0
- package/README.md +20 -4
- package/package.json +10 -6
- package/proto/lark.proto +10 -0
- package/scripts/capture-feishu-protobuf.js +86 -0
- package/scripts/check-changelog.js +31 -0
- package/scripts/check-docs-sync.js +41 -0
- package/scripts/check-tool-count.js +32 -7
- package/scripts/decode-feishu-protobuf.js +115 -0
- package/scripts/explore-card-protobuf.js +144 -0
- package/scripts/explore-image-minimize.js +163 -0
- package/scripts/generate-release-artifacts.js +318 -0
- package/scripts/probe-feishu-docx.js +203 -0
- package/scripts/sync-server-json.js +71 -0
- package/scripts/sync-team-skills.sh +109 -7
- package/scripts/test-wiki-attach-fallback.js +71 -0
- package/scripts/test-ws-events.js +84 -0
- package/skills/feishu-user-plugin/SKILL.md +77 -5
- package/skills/feishu-user-plugin/references/CLAUDE.md +208 -297
- package/src/auth/cookie.js +30 -0
- package/src/auth/credentials.js +85 -0
- package/src/auth/profile-router.js +248 -0
- package/src/auth/uat.js +231 -0
- package/src/cli.js +86 -42
- package/src/clients/official/base.js +12 -248
- package/src/clients/user.js +19 -31
- package/src/config.js +13 -8
- package/src/events/cursor.js +103 -0
- package/src/events/event-buffer.js +103 -0
- package/src/events/event-log.js +151 -0
- package/src/events/index.js +12 -0
- package/src/events/lockfile.js +126 -0
- package/src/events/owner.js +73 -0
- package/src/events/ws-server.js +156 -0
- package/src/oauth.js +48 -7
- package/src/resolver.js +10 -0
- package/src/server.js +285 -3
- package/src/setup.js +100 -11
- package/src/test-all.js +12 -9
- package/src/test-events-cursor.js +56 -0
- package/src/test-events-lockfile.js +36 -0
- package/src/test-events-log.js +67 -0
- package/src/test-events-owner.js +64 -0
- package/src/test-fixtures/doc-blocks/sample-1.json +1256 -0
- package/src/test-read-doc-markdown.js +61 -0
- package/src/test-switch-profile.js +171 -0
- package/src/tools/_registry.js +1 -0
- package/src/tools/diagnostics.js +10 -3
- package/src/tools/docs.js +93 -3
- package/src/tools/events.js +174 -0
- package/src/tools/messaging-bot.js +2 -3
- package/src/tools/messaging-user.js +23 -14
- package/src/tools/profile.js +43 -7
package/src/tools/profile.js
CHANGED
|
@@ -1,28 +1,46 @@
|
|
|
1
|
-
// src/tools/profile.js — multi-account profile management
|
|
1
|
+
// src/tools/profile.js — multi-account profile management.
|
|
2
2
|
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
3
|
+
// v1.3.9 SSOT: profiles live in ~/.feishu-user-plugin/credentials.json under
|
|
4
|
+
// `profiles[]`. Switching writes `active` field; cross-process MCP picks it up
|
|
5
|
+
// via dispatcher mtime hook (~10μs/call) within ms.
|
|
6
|
+
//
|
|
7
|
+
// Legacy LARK_PROFILES_JSON env still works as a back-compat fallback when
|
|
8
|
+
// credentials.json doesn't exist. New profiles should be added via
|
|
9
|
+
// `npx feishu-user-plugin setup --profile <name> --app-id ... --app-secret ... --cookie ...`,
|
|
10
|
+
// then optionally `npx feishu-user-plugin oauth --profile <name>` for UAT.
|
|
6
11
|
|
|
7
12
|
const { text, json } = require('./_registry');
|
|
8
13
|
|
|
9
14
|
const schemas = [
|
|
10
15
|
{
|
|
11
16
|
name: 'list_profiles',
|
|
12
|
-
description: '[Plugin] List all available identity profiles (
|
|
17
|
+
description: '[Plugin] List all available identity profiles (each profile has its own LARK_COOKIE / APP_ID / APP_SECRET / UAT). v1.3.9 SSOT: profiles live in ~/.feishu-user-plugin/credentials.json::profiles. Legacy fallback: LARK_PROFILES_JSON env var. Marks the currently active profile.',
|
|
13
18
|
inputSchema: { type: 'object', properties: {} },
|
|
14
19
|
},
|
|
15
20
|
{
|
|
16
21
|
name: 'switch_profile',
|
|
17
|
-
description: '[Plugin] Switch the active identity profile.
|
|
22
|
+
description: '[Plugin v1.3.9] Switch the active identity profile. Atomically writes credentials.json::active; cached clients in this process are invalidated; cross-process MCPs (Codex / another Claude Code) auto-sync via dispatcher mtime check on next tool call (~10μs). To add a new profile, run `npx feishu-user-plugin setup --profile <name> --app-id ... --app-secret ... --cookie ...` then `npx feishu-user-plugin oauth --profile <name>` for UAT.',
|
|
18
23
|
inputSchema: {
|
|
19
24
|
type: 'object',
|
|
20
25
|
properties: {
|
|
21
|
-
name: { type: 'string', description: 'Profile name. "default" for
|
|
26
|
+
name: { type: 'string', description: 'Profile name. Use "default" for the primary profile; other names come from credentials.json or LARK_PROFILES_JSON.' },
|
|
22
27
|
},
|
|
23
28
|
required: ['name'],
|
|
24
29
|
},
|
|
25
30
|
},
|
|
31
|
+
{
|
|
32
|
+
name: 'manage_profile_hints',
|
|
33
|
+
description: '[Plugin v1.3.8] Inspect / set / clear profileHints — the resourceKey → profileName cache the auto-switch middleware uses to remember which profile owns each Feishu resource. Useful when a hint goes stale (e.g., a profile lost access to a doc).',
|
|
34
|
+
inputSchema: {
|
|
35
|
+
type: 'object',
|
|
36
|
+
properties: {
|
|
37
|
+
action: { type: 'string', enum: ['list', 'set', 'clear'], description: 'list = show all hints; set = upsert one; clear = remove one or all.' },
|
|
38
|
+
resource_key: { type: 'string', description: 'For set/clear: the resourceKey, e.g. "doc:doccnXXX" or "chat:oc_zzz". Omit on clear to wipe all hints.' },
|
|
39
|
+
profile: { type: 'string', description: 'For set: the profile name to associate with the resource_key.' },
|
|
40
|
+
},
|
|
41
|
+
required: ['action'],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
26
44
|
];
|
|
27
45
|
|
|
28
46
|
const handlers = {
|
|
@@ -38,6 +56,24 @@ const handlers = {
|
|
|
38
56
|
ctx.setActiveProfile(target);
|
|
39
57
|
return text(`Switched to profile: ${target}`);
|
|
40
58
|
},
|
|
59
|
+
async manage_profile_hints(args, _ctx) {
|
|
60
|
+
const credentials = require('../auth/credentials');
|
|
61
|
+
if (args.action === 'list') {
|
|
62
|
+
return json({ hints: credentials.getProfileHints() });
|
|
63
|
+
}
|
|
64
|
+
if (args.action === 'set') {
|
|
65
|
+
if (!args.resource_key) return text('manage_profile_hints(set): resource_key is required');
|
|
66
|
+
if (!args.profile) return text('manage_profile_hints(set): profile is required');
|
|
67
|
+
const ok = credentials.setProfileHint(args.resource_key, args.profile);
|
|
68
|
+
return text(ok ? `Hint set: ${args.resource_key} → ${args.profile}` : 'Hint not set (no credentials.json — run `npx feishu-user-plugin migrate --confirm`)');
|
|
69
|
+
}
|
|
70
|
+
if (args.action === 'clear') {
|
|
71
|
+
const ok = credentials.clearProfileHint(args.resource_key);
|
|
72
|
+
const target = args.resource_key || '<all>';
|
|
73
|
+
return text(ok ? `Hint cleared: ${target}` : `No hint to clear for: ${target}`);
|
|
74
|
+
}
|
|
75
|
+
return text(`manage_profile_hints: unknown action "${args.action}". Use list / set / clear.`);
|
|
76
|
+
},
|
|
41
77
|
};
|
|
42
78
|
|
|
43
79
|
module.exports = { schemas, handlers };
|