acp-ts 1.1.2 → 1.1.4

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/agentmd.d.ts CHANGED
@@ -17,7 +17,7 @@ export interface AgentMdOptions {
17
17
  }
18
18
  /**
19
19
  * 从 AID 中提取显示名称
20
- * 例如: "alice.aid.pub" -> "alice"
20
+ * 例如: "alice.aid.show" -> "alice"
21
21
  */
22
22
  export declare function extractDisplayName(aid: string): string;
23
23
  /**
package/dist/agentmd.js CHANGED
@@ -7,11 +7,14 @@ exports.extractDisplayName = extractDisplayName;
7
7
  exports.generateAgentMd = generateAgentMd;
8
8
  /**
9
9
  * 从 AID 中提取显示名称
10
- * 例如: "alice.aid.pub" -> "alice"
10
+ * 例如: "alice.aid.show" -> "alice"
11
11
  */
12
12
  function extractDisplayName(aid) {
13
- if (aid.endsWith('.aid.pub')) {
14
- return aid.slice(0, -'.aid.pub'.length);
13
+ const suffixes = ['.agentcp.io', '.aid.show', '.agentid.pub'];
14
+ for (const suffix of suffixes) {
15
+ if (aid.endsWith(suffix)) {
16
+ return aid.slice(0, -suffix.length);
17
+ }
15
18
  }
16
19
  return aid;
17
20
  }
package/dist/cli.js CHANGED
@@ -106,7 +106,7 @@ function update() {
106
106
  }
107
107
  const args = process.argv.slice(2);
108
108
  let port = 9527; // 使用非常用端口
109
- let apiUrl = 'aid.pub'; // 默认服务地址
109
+ let apiUrl = 'agentcp.io'; // 默认服务地址
110
110
  let dataDir = ''; // 数据目录
111
111
  // 解析命令行参数
112
112
  for (let i = 0; i < args.length; i++) {
@@ -161,7 +161,7 @@ acp-ts - 智能体通信调试工具 v${getVersion()}
161
161
  选项:
162
162
  -v, --version 显示版本号
163
163
  -p, --port <端口> 指定服务端口 (默认: 9527)
164
- -u, --url <地址> 指定 API 服务器地址 (默认: aid.pub)
164
+ -u, --url <地址> 指定 API 服务器地址 (默认: agentcp.io)
165
165
  -d, --data-dir <路径> 指定数据目录 (默认: 当前目录)
166
166
  -h, --help 显示帮助信息
167
167
 
@@ -163,7 +163,14 @@ class CertAndKeyStore {
163
163
  return [];
164
164
  }
165
165
  const entries = fs.readdirSync(aidsDir, { withFileTypes: true });
166
- return entries.filter(e => e.isDirectory()).map(e => e.name);
166
+ return entries.filter(e => {
167
+ if (!e.isDirectory())
168
+ return false;
169
+ const aidName = e.name;
170
+ const keyPath = path.join(aidsDir, aidName, 'private', `${aidName}.key`);
171
+ const crtPath = path.join(aidsDir, aidName, 'public', `${aidName}.crt`);
172
+ return fs.existsSync(keyPath) && fs.existsSync(crtPath);
173
+ }).map(e => e.name);
167
174
  }
168
175
  catch (e) {
169
176
  console.error('扫描 AIDs 目录失败:', e);