@eoasmxd/freya 0.4.4 → 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.
- package/core/dist/config/config-manager.js +3 -3
- package/core/dist/config/file-handler.js +7 -7
- package/core/dist/context.js +7 -6
- package/core/dist/llm/llm-logger.js +2 -2
- package/core/dist/logger.js +2 -2
- package/core/dist/plugin/plugin-manager.d.ts +1 -1
- package/core/dist/plugin/plugin-manager.js +35 -8
- package/core/dist/prompt/prompt-manager.js +4 -4
- package/core/dist/prompt/prompt-registry.js +4 -4
- package/core/dist/session/persistence.js +2 -2
- package/core/dist/skill/skill-registry.d.ts +1 -1
- package/core/dist/skill/skill-registry.js +18 -8
- package/core/dist/utils/paths.d.ts +5 -3
- package/core/dist/utils/paths.js +10 -6
- package/core/dist/web/web-container.js +5 -5
- package/core/package.json +2 -2
- package/doc/specifications/config-spec.md +1 -1
- package/doc/tutorials/part1_react/3.2_decoupled_architecture.md +1 -1
- package/doc/tutorials/part1_react/3.3_freya_dual_read_probe.md +1 -1
- package/doc/tutorials/part3_memory/6.2_physical_sandbox_separation.md +5 -5
- package/doc/tutorials/part5_plugins/10.1_microkernel_decoupling.md +5 -4
- package/freya.js +14 -2
- package/package.json +2 -2
- package/plugins/plugin-gemini/package.json +1 -1
- package/plugins/plugin-openai/package.json +1 -1
- package/plugins/plugin-telegram-channel/package.json +1 -1
- package/plugins/plugin-tool-fs/package.json +1 -1
- package/plugins/plugin-tool-memory/dist/tools.js +2 -2
- package/plugins/plugin-tool-memory/package.json +1 -1
- package/plugins/plugin-tool-mysql/dist/audit.js +1 -1
- package/plugins/plugin-tool-mysql/package.json +1 -1
- package/plugins/plugin-tool-web/package.json +1 -1
- package/plugins/plugin-wecom-channel/package.json +1 -1
- package/plugins/plugin-weixin-channel/package.json +1 -1
- package/src/packages/core/src/config/config-manager.ts +3 -3
- package/src/packages/core/src/config/file-handler.ts +7 -7
- package/src/packages/core/src/context.ts +7 -6
- package/src/packages/core/src/llm/llm-logger.ts +2 -2
- package/src/packages/core/src/logger.ts +2 -2
- package/src/packages/core/src/plugin/plugin-manager.ts +40 -11
- package/src/packages/core/src/prompt/prompt-manager.ts +4 -4
- package/src/packages/core/src/prompt/prompt-registry.ts +4 -4
- package/src/packages/core/src/session/persistence.ts +2 -2
- package/src/packages/core/src/skill/skill-registry.ts +24 -10
- package/src/packages/core/src/utils/paths.ts +11 -7
- package/src/packages/core/src/web/web-container.ts +5 -5
- package/src/packages/sdk/src/types/context.ts +4 -2
- package/src/packages/ui/src/features/config/panels/PluginConfigPanel.tsx +30 -0
- package/src/packages/ui/src/features/config/panels/SkillConfigPanel.tsx +17 -5
- package/src/plugins/plugin-tool-memory/src/tools.ts +2 -2
- package/src/plugins/plugin-tool-mysql/src/audit.ts +1 -1
- package/ui/assets/{index-CyDg-8Iv.js → index-CSZmaZbL.js} +15 -15
- package/ui/index.html +1 -1
|
@@ -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
|
|
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:
|
|
104
|
-
color:
|
|
115
|
+
background: tagMeta.bg,
|
|
116
|
+
color: tagMeta.color
|
|
105
117
|
}}
|
|
106
118
|
>
|
|
107
|
-
{
|
|
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
|
|
105
|
-
const escapedPath =
|
|
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.
|
|
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');
|