@eoasmxd/freya 0.4.3 → 0.5.0

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 (55) hide show
  1. package/core/dist/config/config-manager.js +3 -3
  2. package/core/dist/config/file-handler.js +7 -7
  3. package/core/dist/context.js +7 -6
  4. package/core/dist/llm/llm-logger.js +2 -2
  5. package/core/dist/logger.js +2 -2
  6. package/core/dist/plugin/plugin-manager.d.ts +1 -1
  7. package/core/dist/plugin/plugin-manager.js +35 -8
  8. package/core/dist/prompt/prompt-manager.js +4 -4
  9. package/core/dist/prompt/prompt-registry.js +4 -4
  10. package/core/dist/session/persistence.js +2 -2
  11. package/core/dist/skill/skill-registry.d.ts +1 -1
  12. package/core/dist/skill/skill-registry.js +18 -8
  13. package/core/dist/utils/paths.d.ts +5 -3
  14. package/core/dist/utils/paths.js +10 -6
  15. package/core/dist/web/web-container.js +5 -5
  16. package/core/package.json +2 -2
  17. package/doc/specifications/config-spec.md +1 -1
  18. package/doc/tutorials/part1_react/3.2_decoupled_architecture.md +1 -1
  19. package/doc/tutorials/part1_react/3.3_freya_dual_read_probe.md +1 -1
  20. package/doc/tutorials/part3_memory/6.2_physical_sandbox_separation.md +5 -5
  21. package/doc/tutorials/part5_plugins/10.1_microkernel_decoupling.md +5 -4
  22. package/freya.js +14 -2
  23. package/package.json +2 -2
  24. package/plugins/plugin-gemini/package.json +1 -1
  25. package/plugins/plugin-openai/package.json +1 -1
  26. package/plugins/plugin-telegram-channel/package.json +1 -1
  27. package/plugins/plugin-tool-fs/package.json +1 -1
  28. package/plugins/plugin-tool-memory/dist/tools.js +2 -2
  29. package/plugins/plugin-tool-memory/package.json +1 -1
  30. package/plugins/plugin-tool-mysql/dist/audit.js +1 -1
  31. package/plugins/plugin-tool-mysql/package.json +1 -1
  32. package/plugins/plugin-tool-web/package.json +1 -1
  33. package/plugins/plugin-wecom-channel/package.json +1 -1
  34. package/plugins/plugin-weixin-channel/package.json +1 -1
  35. package/src/packages/core/src/config/config-manager.ts +3 -3
  36. package/src/packages/core/src/config/file-handler.ts +7 -7
  37. package/src/packages/core/src/context.ts +7 -6
  38. package/src/packages/core/src/llm/llm-logger.ts +2 -2
  39. package/src/packages/core/src/logger.ts +2 -2
  40. package/src/packages/core/src/plugin/plugin-manager.ts +40 -11
  41. package/src/packages/core/src/prompt/prompt-manager.ts +4 -4
  42. package/src/packages/core/src/prompt/prompt-registry.ts +4 -4
  43. package/src/packages/core/src/session/persistence.ts +2 -2
  44. package/src/packages/core/src/skill/skill-registry.ts +24 -10
  45. package/src/packages/core/src/utils/paths.ts +11 -7
  46. package/src/packages/core/src/web/web-container.ts +5 -5
  47. package/src/packages/sdk/src/types/context.ts +4 -2
  48. package/src/packages/ui/src/App.tsx +10 -3
  49. package/src/packages/ui/src/features/config/panels/PluginConfigPanel.tsx +30 -0
  50. package/src/packages/ui/src/features/config/panels/SkillConfigPanel.tsx +17 -5
  51. package/src/plugins/plugin-tool-memory/src/tools.ts +2 -2
  52. package/src/plugins/plugin-tool-mysql/src/audit.ts +1 -1
  53. package/ui/assets/index-CSZmaZbL.js +43 -0
  54. package/ui/index.html +2 -2
  55. package/ui/assets/index-BqPQMflk.js +0 -43
@@ -5,6 +5,7 @@ interface PluginEntry {
5
5
  name: string;
6
6
  description: string;
7
7
  enabled: boolean;
8
+ source?: 'builtin' | 'workspace' | 'runtime' | 'npm';
8
9
  }
9
10
 
10
11
  interface PluginConfigPanelProps {
@@ -65,12 +66,27 @@ export const PluginConfigPanel: React.FC<PluginConfigPanelProps> = ({ getApiUrl
65
66
  }
66
67
  };
67
68
 
69
+ const getSourceTagMeta = (source?: string) => {
70
+ switch (source) {
71
+ case 'builtin':
72
+ return { label: '内置', bg: 'rgba(59, 130, 246, 0.15)', color: '#60a5fa' };
73
+ case 'workspace':
74
+ return { label: '集成', bg: 'rgba(168, 85, 247, 0.15)', color: '#c084fc' };
75
+ case 'npm':
76
+ return { label: 'NPM', bg: 'rgba(245, 158, 11, 0.15)', color: '#fbbf24' };
77
+ case 'runtime':
78
+ default:
79
+ return { label: '自定义', bg: 'rgba(16, 185, 129, 0.15)', color: '#34d399' };
80
+ }
81
+ };
82
+
68
83
  return (
69
84
  <div className="plugins-list">
70
85
  {plugins.map((plugin) => {
71
86
  const displayName = plugin.name || plugin.id;
72
87
  const displayDesc = plugin.description || '未提供描述信息';
73
88
  const shouldShowIdTag = displayName !== plugin.id;
89
+ const tagMeta = getSourceTagMeta(plugin.source);
74
90
 
75
91
  return (
76
92
  <div key={plugin.id} className="plugin-card">
@@ -82,6 +98,20 @@ export const PluginConfigPanel: React.FC<PluginConfigPanelProps> = ({ getApiUrl
82
98
  ({plugin.id})
83
99
  </span>
84
100
  )}
101
+ {plugin.source && (
102
+ <span
103
+ style={{
104
+ fontSize: '0.68rem',
105
+ marginLeft: '0.5rem',
106
+ padding: '0.1rem 0.4rem',
107
+ borderRadius: '4px',
108
+ background: tagMeta.bg,
109
+ color: tagMeta.color
110
+ }}
111
+ >
112
+ {tagMeta.label}
113
+ </span>
114
+ )}
85
115
  </div>
86
116
  <div className="plugin-desc">{displayDesc}</div>
87
117
  </div>
@@ -5,7 +5,7 @@ interface SkillEntry {
5
5
  name: string;
6
6
  description: string;
7
7
  enabled: boolean;
8
- source: 'builtin' | 'runtime';
8
+ source: 'builtin' | 'workspace' | 'runtime';
9
9
  }
10
10
 
11
11
  interface SkillConfigPanelProps {
@@ -79,12 +79,24 @@ export const SkillConfigPanel: React.FC<SkillConfigPanelProps> = ({ getApiUrl })
79
79
  );
80
80
  }
81
81
 
82
+ const getSourceTagMeta = (source?: string) => {
83
+ switch (source) {
84
+ case 'builtin':
85
+ return { label: '内置', bg: 'rgba(59, 130, 246, 0.15)', color: '#60a5fa' };
86
+ case 'workspace':
87
+ return { label: '集成', bg: 'rgba(168, 85, 247, 0.15)', color: '#c084fc' };
88
+ case 'runtime':
89
+ default:
90
+ return { label: '自定义', bg: 'rgba(16, 185, 129, 0.15)', color: '#34d399' };
91
+ }
92
+ };
93
+
82
94
  return (
83
95
  <div className="plugins-list">
84
96
  {skills.map((skill) => {
85
97
  const displayName = skill.name || skill.id;
86
98
  const displayDesc = skill.description || '未提供描述信息';
87
- const isBuiltin = skill.source === 'builtin';
99
+ const tagMeta = getSourceTagMeta(skill.source);
88
100
 
89
101
  return (
90
102
  <div key={skill.id} className="plugin-card">
@@ -100,11 +112,11 @@ export const SkillConfigPanel: React.FC<SkillConfigPanelProps> = ({ getApiUrl })
100
112
  marginLeft: '0.5rem',
101
113
  padding: '0.1rem 0.4rem',
102
114
  borderRadius: '4px',
103
- background: isBuiltin ? 'rgba(59, 130, 246, 0.15)' : 'rgba(16, 185, 129, 0.15)',
104
- color: isBuiltin ? '#60a5fa' : '#34d399'
115
+ background: tagMeta.bg,
116
+ color: tagMeta.color
105
117
  }}
106
118
  >
107
- {isBuiltin ? '内置' : '自定义'}
119
+ {tagMeta.label}
108
120
  </span>
109
121
  </div>
110
122
  <div className="plugin-desc">{displayDesc}</div>
@@ -101,8 +101,8 @@ function getFormattedDateTime(): { date: string; time: string } {
101
101
 
102
102
  function cleanPathFromError(err: any, ctx: FreyaContext): string {
103
103
  const rawMessage = err?.message || String(err);
104
- const projectRoot = ctx.paths.projectRoot;
105
- const escapedPath = projectRoot.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
104
+ const homeDir = ctx.paths.homeDir;
105
+ const escapedPath = homeDir.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
106
106
  const regex = new RegExp(escapedPath + '[\\\\/]?', 'g');
107
107
  return rawMessage.replace(regex, '');
108
108
  }
@@ -19,7 +19,7 @@ export class SqlAuditService {
19
19
  }
20
20
 
21
21
  const promptFileName = 'plugin.prompt.mysql.select.audit.md';
22
- const runtimeOverridePath = path.join(ctx.paths.projectRoot, 'config', 'prompts', promptFileName);
22
+ const runtimeOverridePath = path.join(ctx.paths.homeDir, 'config', 'prompts', promptFileName);
23
23
 
24
24
  try {
25
25
  const content = await fs.readFile(runtimeOverridePath, 'utf-8');