chatccc 0.2.101 → 0.2.103

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chatccc",
3
- "version": "0.2.101",
3
+ "version": "0.2.103",
4
4
  "description": "Feishu bot bridge for Claude Code",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -9,6 +9,9 @@ import {
9
9
  unstable_v2_resumeSession,
10
10
  getSessionInfo as sdkGetSessionInfo,
11
11
  } from "@anthropic-ai/claude-agent-sdk";
12
+ import { readdirSync, existsSync } from "node:fs";
13
+ import { join } from "node:path";
14
+ import { homedir } from "node:os";
12
15
 
13
16
  import type {
14
17
  ToolAdapter,
@@ -125,6 +128,22 @@ function resolveSettingSources(
125
128
  return ["user", "project", "local"];
126
129
  }
127
130
 
131
+ // ---------------------------------------------------------------------------
132
+ // collectSkillNames — 扫描用户级 skill 目录,返回所有 skill 名
133
+ // ---------------------------------------------------------------------------
134
+
135
+ function collectSkillNames(): string[] {
136
+ const userSkillsDir = join(homedir(), ".claude", "skills");
137
+ if (!existsSync(userSkillsDir)) return [];
138
+ try {
139
+ return readdirSync(userSkillsDir, { withFileTypes: true })
140
+ .filter((d) => d.isDirectory())
141
+ .map((d) => d.name);
142
+ } catch {
143
+ return [];
144
+ }
145
+ }
146
+
128
147
  // ---------------------------------------------------------------------------
129
148
  // buildSessionOptions — 还原 claudeSdkSessionOptions 的精确行为
130
149
  // ---------------------------------------------------------------------------
@@ -144,6 +163,7 @@ function buildSessionOptions(
144
163
  allowDangerouslySkipPermissions: true,
145
164
  autoCompactEnabled: true,
146
165
  settingSources: resolveSettingSources(apiKey, baseUrl),
166
+ skills: collectSkillNames(),
147
167
  };
148
168
  if (!isEmpty(model)) o.model = model;
149
169
  if (!isEmpty(effort)) o.effort = effort;
package/src/feishu-api.ts CHANGED
@@ -892,6 +892,7 @@ export async function sendRawCard(
892
892
  chatId: string,
893
893
  cardJson: string
894
894
  ): Promise<boolean> {
895
+ const safeJson = applyPrivacy(cardJson);
895
896
  try {
896
897
  const resp = await fetch(`${BASE_URL}/im/v1/messages?receive_id_type=chat_id`, {
897
898
  method: "POST",
@@ -899,7 +900,7 @@ export async function sendRawCard(
899
900
  Authorization: `Bearer ${token}`,
900
901
  "Content-Type": "application/json",
901
902
  },
902
- body: JSON.stringify({ receive_id: chatId, msg_type: "interactive", content: cardJson }),
903
+ body: JSON.stringify({ receive_id: chatId, msg_type: "interactive", content: safeJson }),
903
904
  });
904
905
  const data = (await resp.json().catch(() => ({}))) as { code: number; msg?: string; data?: { message_id?: string } };
905
906
  if (data.code !== 0) {