@becrafter/prompt-manager 0.0.18 → 0.0.19

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 (50) hide show
  1. package/IFLOW.md +175 -0
  2. package/README.md +1 -1
  3. package/app/desktop/assets/icons/icon.icns +0 -0
  4. package/app/desktop/assets/icons/icon.ico +0 -0
  5. package/app/desktop/assets/icons/icon_1024x1024.png +0 -0
  6. package/app/desktop/assets/icons/icon_128x128.png +0 -0
  7. package/app/desktop/assets/icons/icon_16x16.png +0 -0
  8. package/app/desktop/assets/icons/icon_24x24.png +0 -0
  9. package/app/desktop/assets/icons/icon_256x256.png +0 -0
  10. package/app/desktop/assets/icons/icon_32x32.png +0 -0
  11. package/app/desktop/assets/icons/icon_48x48.png +0 -0
  12. package/app/desktop/assets/icons/icon_512x512.png +0 -0
  13. package/app/desktop/assets/icons/icon_64x64.png +0 -0
  14. package/app/desktop/assets/icons/icon_96x96.png +0 -0
  15. package/app/desktop/assets/templates/about.html +147 -0
  16. package/app/desktop/main.js +160 -732
  17. package/app/desktop/package-lock.json +567 -534
  18. package/app/desktop/package.json +45 -10
  19. package/app/desktop/preload.js +7 -0
  20. package/app/desktop/src/core/error-handler.js +108 -0
  21. package/app/desktop/src/core/event-emitter.js +84 -0
  22. package/app/desktop/src/core/logger.js +108 -0
  23. package/app/desktop/src/core/state-manager.js +125 -0
  24. package/app/desktop/src/services/module-loader.js +193 -0
  25. package/app/desktop/src/services/runtime-manager.js +152 -0
  26. package/app/desktop/src/services/service-manager.js +169 -0
  27. package/app/desktop/src/services/update-manager.js +268 -0
  28. package/app/desktop/src/ui/about-dialog-manager.js +208 -0
  29. package/app/desktop/src/ui/tray-manager.js +202 -0
  30. package/app/desktop/src/utils/icon-manager.js +141 -0
  31. package/app/desktop/src/utils/path-utils.js +58 -0
  32. package/app/desktop/src/utils/resource-paths.js +72 -0
  33. package/app/desktop/src/utils/template-renderer.js +284 -0
  34. package/app/desktop/src/utils/version-utils.js +59 -0
  35. package/examples/prompts/engineer/engineer-professional.yaml +92 -0
  36. package/examples/prompts/engineer/laowang-engineer.yaml +132 -0
  37. package/examples/prompts/engineer/nekomata-engineer.yaml +123 -0
  38. package/examples/prompts/engineer/ojousama-engineer.yaml +124 -0
  39. package/examples/prompts/workflow/sixstep-workflow.yaml +192 -0
  40. package/package.json +9 -3
  41. package/packages/admin-ui/admin.html +1 -1
  42. package/packages/resources/tools/filesystem/filesystem.tool.js +184 -0
  43. package/packages/resources/tools/index.js +16 -0
  44. package/packages/server/mcp/mcp.handler.js +108 -9
  45. package/packages/server/mcp/mcp.server.js +126 -27
  46. package/packages/server/mcp/toolx.handler.js +131 -0
  47. package/packages/server/utils/config.js +1 -1
  48. package/scripts/build-icons.js +105 -0
  49. package/scripts/icns-builder/package.json +12 -0
  50. /package/app/desktop/assets/{icon.png → icons/icon.png} +0 -0
@@ -0,0 +1,105 @@
1
+ #!/usr/bin/env node
2
+
3
+ import fs from 'fs';
4
+ import path from 'path';
5
+ import { fileURLToPath } from 'url';
6
+ import { spawn } from 'child_process';
7
+ import sharp from 'sharp';
8
+ import toIco from 'to-ico';
9
+
10
+ // 获取当前文件的目录
11
+ const __filename = fileURLToPath(import.meta.url);
12
+ const __dirname = path.dirname(__filename);
13
+
14
+ // 图标文件路径
15
+ const sourceIcon = path.join(__dirname, '..', 'app', 'desktop', 'assets', 'icons', 'icon.png');
16
+ const assetsDir = path.join(__dirname, '..', 'app', 'desktop', 'assets', 'icons');
17
+
18
+ // 确保 assets 目录存在
19
+ if (!fs.existsSync(assetsDir)) {
20
+ fs.mkdirSync(assetsDir, { recursive: true });
21
+ }
22
+
23
+ // macOS 图标尺寸
24
+ const macSizes = [16, 32, 64, 128, 256, 512, 1024];
25
+
26
+ // Windows 图标尺寸
27
+ const winSizes = [16, 24, 32, 48, 64, 96, 128, 256];
28
+
29
+ // 为 macOS 创建不同尺寸的图标
30
+ console.log('Creating macOS icons...');
31
+ const macIconDir = path.join(assetsDir, 'icon.iconset');
32
+ if (!fs.existsSync(macIconDir)) {
33
+ fs.mkdirSync(macIconDir, { recursive: true });
34
+ }
35
+
36
+ for (const size of macSizes) {
37
+ const filename = `icon_${size}x${size}.png`;
38
+ const filepath = path.join(macIconDir, size === 512 ? 'icon_512x512@2x.png' : `icon_${size}x${size}.png`);
39
+ console.log(` - ${filename}`);
40
+ // 对于 512x512@2x 实际上是 1024x1024
41
+ const actualSize = size === 512 ? 1024 : size;
42
+ await sharp(sourceIcon).resize(actualSize, actualSize).toFile(filepath);
43
+ }
44
+
45
+ // 为 Windows 创建不同尺寸的图标
46
+ console.log('Creating Windows icons...');
47
+ const winIconBuffers = [];
48
+ for (const size of winSizes) {
49
+ const filename = `icon_${size}x${size}.png`;
50
+ const filepath = path.join(assetsDir, filename);
51
+ console.log(` - ${filename}`);
52
+ const buffer = await sharp(sourceIcon).resize(size, size).png({ compressionLevel: 9 }).toBuffer();
53
+ fs.writeFileSync(filepath, buffer);
54
+ // 保存前几个尺寸用于创建 ICO 文件,现在包括 256x256
55
+ if (size == 256) {
56
+ // 确保 buffer 是有效的 Buffer 对象
57
+ if (Buffer.isBuffer(buffer) && buffer.length > 0) {
58
+ winIconBuffers.push(buffer);
59
+ } else {
60
+ console.log(` - Skipping invalid buffer for size ${size}`);
61
+ }
62
+ }
63
+ }
64
+
65
+ // 创建 ICNS 文件 (macOS) - 使用 iconutil 工具
66
+ console.log('Creating ICNS file for macOS...');
67
+ try {
68
+ const icnsPath = path.join(assetsDir, 'icon.icns');
69
+
70
+ // 使用 iconutil 创建 ICNS 文件
71
+ const iconutil = spawn('iconutil', ['-c', 'icns', '-o', icnsPath, macIconDir]);
72
+
73
+ iconutil.on('close', (code) => {
74
+ if (code === 0) {
75
+ console.log(' - icon.icns');
76
+ // 清理临时文件
77
+ fs.rmSync(macIconDir, { recursive: true, force: true });
78
+ } else {
79
+ console.log(' - Failed to create ICNS file with iconutil');
80
+ }
81
+ });
82
+ } catch (error) {
83
+ console.log(' - Failed to create ICNS file:', error.message, error.stack);
84
+ }
85
+
86
+ // 创建 ICO 文件 (Windows)
87
+ console.log('Creating ICO file for Windows...');
88
+ try {
89
+ // 确保 winIconBuffers 不为空并且包含有效的缓冲区
90
+ if (winIconBuffers.length > 0) {
91
+ // 验证所有缓冲区都是有效的
92
+ const validBuffers = winIconBuffers.filter(buffer => Buffer.isBuffer(buffer) && buffer.length > 0);
93
+ if (validBuffers.length > 0) {
94
+ const icoBuffer = await toIco(validBuffers);
95
+ const icoPath = path.join(assetsDir, 'icon.ico');
96
+ fs.writeFileSync(icoPath, icoBuffer);
97
+ } else {
98
+ console.log(' - No valid buffers for ICO creation');
99
+ }
100
+ }
101
+ } catch (error) {
102
+ console.log(' - Failed to create ICO file:', error.message, error.stack);
103
+ }
104
+
105
+ console.log('Icon preparation completed.');
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "icns-builder",
3
+ "version": "1.0.0",
4
+ "description": "Simple ICNS file builder for macOS",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "build": "node index.js"
8
+ },
9
+ "dependencies": {
10
+ "png-to-icns": "^0.0.4"
11
+ }
12
+ }
File without changes