zhitalk 0.0.7 → 0.0.8

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.
@@ -39,6 +39,20 @@ const memoryPrompt = `## Memory Management Rules
39
39
  const dateTimePrompt = `## Current DateTime
40
40
 
41
41
  ${new Date().toLocaleString('zh-CN', { timeZone: 'Asia/Shanghai' })}`;
42
- export const systemPrompt = skillsText
43
- ? `${basePrompt}\n\n${profilePrompt}\n\n${memoryPrompt}\n\n## Available Skills\n\nYou have access to the following skills. When a user's request matches a skill's description, you MUST call the \`load_skill\` tool to load that skill's full instructions, then follow them.\n\n${skillsText}\n\n${dateTimePrompt}`
44
- : `${basePrompt}\n\n${profilePrompt}\n\n${memoryPrompt}\n\n${dateTimePrompt}`;
42
+ const skillList = skillsText
43
+ ? `You have access to the following skills. When a user's request matches a skill's description, you MUST call the \`load_skill\` tool to load that skill's full instructions, then follow them.
44
+
45
+ ${skillsText}`
46
+ : 'There are no skills available.';
47
+ const skillPrompt = `## Skills
48
+
49
+ ${skillList}\n\nNote: If you want to add a new skill, it must be placed in the ${path.join(WORKSPACE_DIR, 'skills')} directory.`;
50
+ export const systemPrompt = [
51
+ basePrompt,
52
+ profilePrompt,
53
+ memoryPrompt,
54
+ skillPrompt,
55
+ dateTimePrompt,
56
+ ]
57
+ .filter(Boolean)
58
+ .join('\n\n');
@@ -1,6 +1,5 @@
1
1
  import { readdirSync, readFileSync, statSync } from 'fs';
2
2
  import { join } from 'path';
3
- import { homedir } from 'os';
4
3
  import { WORKSPACE_DIR } from './config.js';
5
4
  const skills = [];
6
5
  const skillContentMap = new Map();
@@ -29,9 +28,8 @@ export function discoverSkills() {
29
28
  skills.length = 0;
30
29
  skillContentMap.clear();
31
30
  const skillDirs = [
32
- join(homedir(), '.agents', 'skills'),
33
- join(WORKSPACE_DIR, '.agents', 'skills'),
34
31
  join(WORKSPACE_DIR, 'skills'),
32
+ join(process.cwd(), '.agents', 'skills'),
35
33
  ];
36
34
  for (const skillsDir of skillDirs) {
37
35
  let entries;
@@ -73,14 +71,13 @@ export function loadSkill(name) {
73
71
  return skillContentMap.get(name) ?? null;
74
72
  }
75
73
  export function getSkillsListText() {
76
- const lines = skills.map((s) => `- **${s.name}**: ${s.description}`);
77
- if (skills.length > 0) {
74
+ const lines = [];
75
+ for (const s of skills) {
76
+ lines.push(`**${s.name}**:`);
77
+ lines.push(` - description: ${s.description}`);
78
+ lines.push(` - dirPath: ${s.dirPath}`);
78
79
  lines.push('');
79
- lines.push('skills 的目录:');
80
- lines.push(join(homedir(), '.agents', 'skills'));
81
- lines.push(join(WORKSPACE_DIR, '.agents', 'skills'));
82
- lines.push(join(WORKSPACE_DIR, 'skills'));
83
- lines.push(`如果增加新 skill,必须放在 ${join(WORKSPACE_DIR, 'skills')} 目录下`);
84
80
  }
81
+ // console.log('skills...\n', lines.join('\n'))
85
82
  return lines.join('\n');
86
83
  }
package/dist/install.js CHANGED
@@ -4,7 +4,7 @@ import * as os from 'os';
4
4
  import { execSync } from 'child_process';
5
5
  import { WORKSPACE_DIR, CONFIG_PATH } from './agent/config.js';
6
6
  import { initDb } from './agent/db.js';
7
- const SKILLS_DIR = path.join(WORKSPACE_DIR, '.agents', 'skills');
7
+ const SKILLS_DIR = path.join(WORKSPACE_DIR, 'skills');
8
8
  function run(command, options) {
9
9
  execSync(command, { stdio: 'inherit', ...options });
10
10
  }
@@ -18,8 +18,8 @@ function installSkill(name, repo, skillPath, targetDir, tempDir) {
18
18
  const extractDir = path.join(tempDir, `${name}-extract`);
19
19
  fs.mkdirSync(extractDir, { recursive: true });
20
20
  try {
21
- run(`curl -fsSL -o "${tarPath}" "https://github.com/${repo}/archive/refs/heads/main.tar.gz"`, { timeout: 20000 });
22
- run(`tar -xzf "${tarPath}" -C "${extractDir}"`, { timeout: 20000 });
21
+ run(`curl -fsSL -o "${tarPath}" "https://github.com/${repo}/archive/refs/heads/main.tar.gz"`, { timeout: 30000 });
22
+ run(`tar -xzf "${tarPath}" -C "${extractDir}"`, { timeout: 30000 });
23
23
  const subDir = fs.readdirSync(extractDir)[0];
24
24
  fs.cpSync(path.join(extractDir, subDir, skillPath), targetDir, {
25
25
  recursive: true,
@@ -27,8 +27,8 @@ function installSkill(name, repo, skillPath, targetDir, tempDir) {
27
27
  console.log(` ✅ ${name} 安装完成`);
28
28
  }
29
29
  catch (error) {
30
- if (error.killed) {
31
- console.log(` ⏱️ ${name} 安装超时(超过 20s),已跳过,继续下一步`);
30
+ if (error.killed || error.code === 'ETIMEDOUT') {
31
+ console.log(` ⏱️ ${name} 安装超时(网络较慢),已跳过,继续下一步`);
32
32
  return;
33
33
  }
34
34
  throw error;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zhitalk",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "A personal AI Agent like OpenClaw, including tools, skills, memory, hook, sub-agent, MCP server, etc. Run in the terminal.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",