opc-agent 1.1.0 → 1.1.2
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/CHANGELOG.md +51 -51
- package/CONTRIBUTING.md +75 -75
- package/README.md +341 -101
- package/README.zh-CN.md +382 -55
- package/dist/channels/web.js +256 -256
- package/dist/cli.js +1 -32
- package/dist/deploy/hermes.js +22 -22
- package/dist/deploy/openclaw.js +31 -31
- package/dist/i18n/index.js +60 -9
- package/dist/templates/code-reviewer.js +5 -5
- package/dist/templates/customer-service.js +2 -2
- package/dist/templates/data-analyst.js +5 -5
- package/dist/templates/knowledge-base.js +2 -2
- package/dist/templates/sales-assistant.js +4 -4
- package/dist/templates/teacher.js +6 -6
- package/docs/.vitepress/config.ts +103 -92
- package/docs/api/cli.md +48 -48
- package/docs/api/oad-schema.md +64 -64
- package/docs/api/sdk.md +80 -80
- package/docs/guide/concepts.md +51 -51
- package/docs/guide/configuration.md +79 -79
- package/docs/guide/deployment.md +42 -42
- package/docs/guide/getting-started.md +44 -44
- package/docs/guide/templates.md +28 -28
- package/docs/guide/testing.md +84 -84
- package/docs/index.md +27 -27
- package/docs/zh/api/cli.md +54 -0
- package/docs/zh/api/oad-schema.md +87 -3
- package/docs/zh/api/sdk.md +102 -0
- package/docs/zh/guide/concepts.md +104 -28
- package/docs/zh/guide/configuration.md +135 -39
- package/docs/zh/guide/deployment.md +81 -3
- package/docs/zh/guide/getting-started.md +82 -58
- package/docs/zh/guide/templates.md +84 -22
- package/docs/zh/guide/testing.md +88 -18
- package/docs/zh/index.md +27 -27
- package/examples/customer-service-demo/README.md +90 -90
- package/examples/customer-service-demo/oad.yaml +107 -107
- package/package.json +1 -1
- package/src/analytics/index.ts +66 -66
- package/src/channels/discord.ts +192 -192
- package/src/channels/email.ts +177 -177
- package/src/channels/feishu.ts +236 -236
- package/src/channels/index.ts +15 -15
- package/src/channels/slack.ts +160 -160
- package/src/channels/telegram.ts +90 -90
- package/src/channels/voice.ts +106 -106
- package/src/channels/web.ts +596 -596
- package/src/channels/webhook.ts +199 -199
- package/src/channels/websocket.ts +87 -87
- package/src/channels/wechat.ts +149 -149
- package/src/cli.ts +1 -35
- package/src/core/a2a.ts +143 -143
- package/src/core/agent.ts +152 -152
- package/src/core/analytics-engine.ts +186 -186
- package/src/core/auth.ts +57 -57
- package/src/core/cache.ts +141 -141
- package/src/core/compose.ts +77 -77
- package/src/core/config.ts +14 -14
- package/src/core/errors.ts +148 -148
- package/src/core/hitl.ts +138 -138
- package/src/core/knowledge.ts +210 -210
- package/src/core/logger.ts +57 -57
- package/src/core/orchestrator.ts +215 -215
- package/src/core/performance.ts +187 -187
- package/src/core/rate-limiter.ts +128 -128
- package/src/core/room.ts +109 -109
- package/src/core/runtime.ts +152 -152
- package/src/core/sandbox.ts +101 -101
- package/src/core/security.ts +171 -171
- package/src/core/types.ts +68 -68
- package/src/core/versioning.ts +106 -106
- package/src/core/watch.ts +178 -178
- package/src/core/workflow.ts +235 -235
- package/src/deploy/hermes.ts +156 -156
- package/src/deploy/openclaw.ts +200 -200
- package/src/dtv/data.ts +29 -29
- package/src/dtv/trust.ts +43 -43
- package/src/dtv/value.ts +47 -47
- package/src/i18n/index.ts +216 -165
- package/src/index.ts +110 -110
- package/src/marketplace/index.ts +223 -223
- package/src/memory/deepbrain.ts +108 -108
- package/src/memory/index.ts +34 -34
- package/src/plugins/index.ts +208 -208
- package/src/providers/index.ts +183 -183
- package/src/schema/oad.ts +155 -155
- package/src/skills/base.ts +16 -16
- package/src/skills/document.ts +100 -100
- package/src/skills/http.ts +35 -35
- package/src/skills/index.ts +27 -27
- package/src/skills/scheduler.ts +80 -80
- package/src/skills/webhook-trigger.ts +59 -59
- package/src/templates/code-reviewer.ts +34 -34
- package/src/templates/customer-service.ts +80 -80
- package/src/templates/data-analyst.ts +70 -70
- package/src/templates/executive-assistant.ts +71 -71
- package/src/templates/financial-advisor.ts +60 -60
- package/src/templates/knowledge-base.ts +31 -31
- package/src/templates/legal-assistant.ts +71 -71
- package/src/templates/sales-assistant.ts +79 -79
- package/src/templates/teacher.ts +79 -79
- package/src/testing/index.ts +181 -181
- package/src/tools/calculator.ts +73 -73
- package/src/tools/datetime.ts +149 -149
- package/src/tools/json-transform.ts +187 -187
- package/src/tools/mcp.ts +76 -76
- package/src/tools/text-analysis.ts +116 -116
- package/templates/Dockerfile +15 -15
- package/templates/code-reviewer/README.md +27 -27
- package/templates/code-reviewer/oad.yaml +41 -41
- package/templates/customer-service/README.md +22 -22
- package/templates/customer-service/oad.yaml +36 -36
- package/templates/docker-compose.yml +21 -21
- package/templates/knowledge-base/README.md +28 -28
- package/templates/knowledge-base/oad.yaml +38 -38
- package/templates/sales-assistant/README.md +26 -26
- package/templates/sales-assistant/oad.yaml +43 -43
- package/tests/a2a.test.ts +66 -66
- package/tests/agent.test.ts +72 -72
- package/tests/analytics.test.ts +50 -50
- package/tests/channel.test.ts +39 -39
- package/tests/e2e.test.ts +134 -134
- package/tests/errors.test.ts +83 -83
- package/tests/hitl.test.ts +71 -71
- package/tests/i18n.test.ts +41 -41
- package/tests/mcp.test.ts +54 -54
- package/tests/oad.test.ts +68 -68
- package/tests/performance.test.ts +115 -115
- package/tests/plugin.test.ts +74 -74
- package/tests/room.test.ts +106 -106
- package/tests/runtime.test.ts +42 -42
- package/tests/sandbox.test.ts +46 -46
- package/tests/security.test.ts +60 -60
- package/tests/templates.test.ts +77 -77
- package/tests/v070.test.ts +76 -76
- package/tests/versioning.test.ts +75 -75
- package/tests/voice.test.ts +61 -61
- package/tests/webhook.test.ts +29 -29
- package/tests/workflow.test.ts +143 -143
- package/tsconfig.json +19 -19
- package/vitest.config.ts +9 -9
package/src/i18n/index.ts
CHANGED
|
@@ -1,165 +1,216 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internationalization (i18n) support for OPC Agent.
|
|
3
|
-
* Supports English, Chinese, and Japanese.
|
|
4
|
-
*/
|
|
5
|
-
export type Locale = 'en' | 'zh-CN' | 'ja';
|
|
6
|
-
|
|
7
|
-
export interface I18nMessages {
|
|
8
|
-
[key: string]: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const messages: Record<Locale, I18nMessages> = {
|
|
12
|
-
'en': {
|
|
13
|
-
'agent.started': 'Agent "{name}" started successfully',
|
|
14
|
-
'agent.stopped': 'Agent "{name}" stopped',
|
|
15
|
-
'agent.error': 'An error occurred: {error}',
|
|
16
|
-
'agent.greeting': 'Hello! How can I help you?',
|
|
17
|
-
'agent.farewell': 'Goodbye! Have a great day.',
|
|
18
|
-
'agent.notUnderstood': 'I\'m not sure I understand. Could you rephrase?',
|
|
19
|
-
'agent.handoff': 'Let me connect you with a human agent.',
|
|
20
|
-
'cli.init.success': 'Created agent project: {name}',
|
|
21
|
-
'cli.
|
|
22
|
-
'cli.
|
|
23
|
-
'cli.
|
|
24
|
-
'cli.
|
|
25
|
-
'cli.
|
|
26
|
-
'cli.
|
|
27
|
-
'cli.
|
|
28
|
-
'cli.
|
|
29
|
-
'
|
|
30
|
-
'
|
|
31
|
-
'
|
|
32
|
-
'
|
|
33
|
-
'
|
|
34
|
-
'
|
|
35
|
-
'
|
|
36
|
-
'
|
|
37
|
-
'
|
|
38
|
-
'
|
|
39
|
-
'
|
|
40
|
-
'
|
|
41
|
-
'
|
|
42
|
-
'
|
|
43
|
-
'
|
|
44
|
-
'
|
|
45
|
-
'
|
|
46
|
-
'
|
|
47
|
-
'
|
|
48
|
-
'
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
'
|
|
52
|
-
'
|
|
53
|
-
'
|
|
54
|
-
'
|
|
55
|
-
'
|
|
56
|
-
'
|
|
57
|
-
'
|
|
58
|
-
'
|
|
59
|
-
'
|
|
60
|
-
'
|
|
61
|
-
'
|
|
62
|
-
'
|
|
63
|
-
'
|
|
64
|
-
'
|
|
65
|
-
'
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
'
|
|
69
|
-
'
|
|
70
|
-
'
|
|
71
|
-
'
|
|
72
|
-
'
|
|
73
|
-
'
|
|
74
|
-
'
|
|
75
|
-
'
|
|
76
|
-
'
|
|
77
|
-
'
|
|
78
|
-
'
|
|
79
|
-
'
|
|
80
|
-
'
|
|
81
|
-
'
|
|
82
|
-
'
|
|
83
|
-
'
|
|
84
|
-
'
|
|
85
|
-
'
|
|
86
|
-
'
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
'
|
|
90
|
-
'
|
|
91
|
-
'
|
|
92
|
-
'
|
|
93
|
-
'
|
|
94
|
-
'
|
|
95
|
-
'
|
|
96
|
-
'cli.
|
|
97
|
-
'cli.
|
|
98
|
-
'
|
|
99
|
-
'
|
|
100
|
-
'
|
|
101
|
-
'
|
|
102
|
-
'
|
|
103
|
-
'
|
|
104
|
-
'
|
|
105
|
-
'
|
|
106
|
-
'
|
|
107
|
-
'web.
|
|
108
|
-
'web.
|
|
109
|
-
'web.
|
|
110
|
-
'web.
|
|
111
|
-
'web.
|
|
112
|
-
'web.
|
|
113
|
-
'web.dashboard.
|
|
114
|
-
'web.
|
|
115
|
-
'web.
|
|
116
|
-
'web.
|
|
117
|
-
'web.
|
|
118
|
-
'
|
|
119
|
-
'
|
|
120
|
-
'
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
'
|
|
124
|
-
'
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Internationalization (i18n) support for OPC Agent.
|
|
3
|
+
* Supports English, Chinese, and Japanese.
|
|
4
|
+
*/
|
|
5
|
+
export type Locale = 'en' | 'zh-CN' | 'ja';
|
|
6
|
+
|
|
7
|
+
export interface I18nMessages {
|
|
8
|
+
[key: string]: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const messages: Record<Locale, I18nMessages> = {
|
|
12
|
+
'en': {
|
|
13
|
+
'agent.started': 'Agent "{name}" started successfully',
|
|
14
|
+
'agent.stopped': 'Agent "{name}" stopped',
|
|
15
|
+
'agent.error': 'An error occurred: {error}',
|
|
16
|
+
'agent.greeting': 'Hello! How can I help you?',
|
|
17
|
+
'agent.farewell': 'Goodbye! Have a great day.',
|
|
18
|
+
'agent.notUnderstood': 'I\'m not sure I understand. Could you rephrase?',
|
|
19
|
+
'agent.handoff': 'Let me connect you with a human agent.',
|
|
20
|
+
'cli.init.success': 'Created agent project: {name}',
|
|
21
|
+
'cli.init.prompt.name': 'Agent name:',
|
|
22
|
+
'cli.init.prompt.template': 'Choose a template:',
|
|
23
|
+
'cli.init.prompt.provider': 'Choose an LLM provider:',
|
|
24
|
+
'cli.build.success': 'Build successful: {name} v{version}',
|
|
25
|
+
'cli.test.pass': 'All tests passed',
|
|
26
|
+
'cli.test.fail': '{count} test(s) failed',
|
|
27
|
+
'cli.run.starting': 'Starting agent "{name}"...',
|
|
28
|
+
'cli.run.listening': 'Agent "{name}" is running at http://localhost:{port}',
|
|
29
|
+
'cli.deploy.success': 'Deployed "{name}" to {target}',
|
|
30
|
+
'cli.deploy.error': 'Deploy failed: {error}',
|
|
31
|
+
'cli.validate.success': 'OAD validation passed',
|
|
32
|
+
'cli.validate.error': 'OAD validation failed: {error}',
|
|
33
|
+
'cli.analytics.title': 'Agent Analytics',
|
|
34
|
+
'cli.analytics.noData': 'No analytics data yet',
|
|
35
|
+
'cli.stats.title': 'Agent Analytics',
|
|
36
|
+
'cli.stats.messages': 'Messages Processed',
|
|
37
|
+
'cli.stats.avgTime': 'Avg Response Time',
|
|
38
|
+
'cli.stats.errors': 'Errors',
|
|
39
|
+
'cli.stats.uptime': 'Uptime',
|
|
40
|
+
'cli.chat.welcome': 'Chat with your agent. Type "exit" to quit.',
|
|
41
|
+
'cli.dev.watching': 'Watching for changes...',
|
|
42
|
+
'cli.publish.success': 'Published "{name}" v{version}',
|
|
43
|
+
'plugin.loaded': 'Plugin "{name}" loaded',
|
|
44
|
+
'plugin.error': 'Plugin "{name}" failed: {error}',
|
|
45
|
+
'kb.added': 'Added "{file}" to knowledge base',
|
|
46
|
+
'kb.searchResults': '{count} results found',
|
|
47
|
+
'kb.noResults': 'No results found',
|
|
48
|
+
'web.title': 'OPC Agent',
|
|
49
|
+
'web.chat.placeholder': 'Type a message...',
|
|
50
|
+
'web.chat.send': 'Send',
|
|
51
|
+
'web.nav.chat': 'Chat',
|
|
52
|
+
'web.nav.dashboard': 'Dashboard',
|
|
53
|
+
'web.nav.settings': 'Settings',
|
|
54
|
+
'web.dashboard.title': 'Dashboard',
|
|
55
|
+
'web.dashboard.messages': 'Messages',
|
|
56
|
+
'web.dashboard.tokens': 'Tokens Used',
|
|
57
|
+
'web.dashboard.errors': 'Errors',
|
|
58
|
+
'web.dashboard.avgLatency': 'Avg Latency',
|
|
59
|
+
'web.settings.title': 'Settings',
|
|
60
|
+
'web.settings.language': 'Language',
|
|
61
|
+
'web.settings.theme': 'Theme',
|
|
62
|
+
'web.settings.save': 'Save',
|
|
63
|
+
'cache.hit': 'Cache hit',
|
|
64
|
+
'cache.miss': 'Cache miss',
|
|
65
|
+
'rateLimit.exceeded': 'Rate limit exceeded. Please wait.',
|
|
66
|
+
},
|
|
67
|
+
'zh-CN': {
|
|
68
|
+
'agent.started': '智能体 "{name}" 启动成功',
|
|
69
|
+
'agent.stopped': '智能体 "{name}" 已停止',
|
|
70
|
+
'agent.error': '发生错误:{error}',
|
|
71
|
+
'agent.greeting': '你好!有什么可以帮你的?',
|
|
72
|
+
'agent.farewell': '再见!祝你愉快。',
|
|
73
|
+
'agent.notUnderstood': '抱歉,我没太理解你的意思。能换个方式描述一下吗?',
|
|
74
|
+
'agent.handoff': '我来帮你转接人工客服。',
|
|
75
|
+
'cli.init.success': '已创建智能体项目:{name}',
|
|
76
|
+
'cli.init.prompt.name': '智能体名称:',
|
|
77
|
+
'cli.init.prompt.template': '选择一个模板:',
|
|
78
|
+
'cli.init.prompt.provider': '选择大语言模型供应商:',
|
|
79
|
+
'cli.build.success': '构建成功:{name} v{version}',
|
|
80
|
+
'cli.test.pass': '所有测试通过',
|
|
81
|
+
'cli.test.fail': '{count} 个测试失败',
|
|
82
|
+
'cli.run.starting': '正在启动智能体 "{name}"...',
|
|
83
|
+
'cli.run.listening': '智能体 "{name}" 已在 http://localhost:{port} 上运行',
|
|
84
|
+
'cli.deploy.success': '已将 "{name}" 部署到 {target}',
|
|
85
|
+
'cli.deploy.error': '部署失败:{error}',
|
|
86
|
+
'cli.validate.success': 'OAD 配置校验通过',
|
|
87
|
+
'cli.validate.error': 'OAD 配置校验失败:{error}',
|
|
88
|
+
'cli.analytics.title': '智能体数据分析',
|
|
89
|
+
'cli.analytics.noData': '暂无分析数据',
|
|
90
|
+
'cli.stats.title': '智能体数据分析',
|
|
91
|
+
'cli.stats.messages': '已处理消息',
|
|
92
|
+
'cli.stats.avgTime': '平均响应时间',
|
|
93
|
+
'cli.stats.errors': '错误数',
|
|
94
|
+
'cli.stats.uptime': '运行时间',
|
|
95
|
+
'cli.chat.welcome': '开始和智能体对话吧。输入 "exit" 退出。',
|
|
96
|
+
'cli.dev.watching': '正在监听文件变更...',
|
|
97
|
+
'cli.publish.success': '已发布 "{name}" v{version}',
|
|
98
|
+
'plugin.loaded': '插件 "{name}" 已加载',
|
|
99
|
+
'plugin.error': '插件 "{name}" 出错:{error}',
|
|
100
|
+
'kb.added': '已将 "{file}" 添加到知识库',
|
|
101
|
+
'kb.searchResults': '找到 {count} 条结果',
|
|
102
|
+
'kb.noResults': '未找到相关结果',
|
|
103
|
+
'web.title': 'OPC 智能体',
|
|
104
|
+
'web.chat.placeholder': '输入消息...',
|
|
105
|
+
'web.chat.send': '发送',
|
|
106
|
+
'web.nav.chat': '对话',
|
|
107
|
+
'web.nav.dashboard': '仪表盘',
|
|
108
|
+
'web.nav.settings': '设置',
|
|
109
|
+
'web.dashboard.title': '仪表盘',
|
|
110
|
+
'web.dashboard.messages': '消息数',
|
|
111
|
+
'web.dashboard.tokens': '已用 Token',
|
|
112
|
+
'web.dashboard.errors': '错误数',
|
|
113
|
+
'web.dashboard.avgLatency': '平均延迟',
|
|
114
|
+
'web.settings.title': '设置',
|
|
115
|
+
'web.settings.language': '语言',
|
|
116
|
+
'web.settings.theme': '主题',
|
|
117
|
+
'web.settings.save': '保存',
|
|
118
|
+
'cache.hit': '缓存命中',
|
|
119
|
+
'cache.miss': '缓存未命中',
|
|
120
|
+
'rateLimit.exceeded': '请求过于频繁,请稍候。',
|
|
121
|
+
},
|
|
122
|
+
'ja': {
|
|
123
|
+
'agent.started': 'エージェント「{name}」が正常に起動しました',
|
|
124
|
+
'agent.stopped': 'エージェント「{name}」が停止しました',
|
|
125
|
+
'agent.error': 'エラーが発生しました: {error}',
|
|
126
|
+
'agent.greeting': 'こんにちは!何かお手伝いできますか?',
|
|
127
|
+
'agent.farewell': 'さようなら!良い一日を。',
|
|
128
|
+
'agent.notUnderstood': '申し訳ございません、理解できませんでした。別の言い方でお願いできますか?',
|
|
129
|
+
'agent.handoff': 'オペレーターにおつなぎします。',
|
|
130
|
+
'cli.init.success': 'エージェントプロジェクトを作成しました: {name}',
|
|
131
|
+
'cli.init.prompt.name': 'エージェント名:',
|
|
132
|
+
'cli.init.prompt.template': 'テンプレートを選択:',
|
|
133
|
+
'cli.init.prompt.provider': 'LLMプロバイダーを選択:',
|
|
134
|
+
'cli.build.success': 'ビルド成功: {name} v{version}',
|
|
135
|
+
'cli.test.pass': '全テスト合格',
|
|
136
|
+
'cli.test.fail': '{count} 件のテストが失敗しました',
|
|
137
|
+
'cli.run.starting': 'エージェント「{name}」を起動中...',
|
|
138
|
+
'cli.run.listening': 'エージェント「{name}」が http://localhost:{port} で稼働中',
|
|
139
|
+
'cli.deploy.success': '「{name}」を {target} にデプロイしました',
|
|
140
|
+
'cli.deploy.error': 'デプロイ失敗: {error}',
|
|
141
|
+
'cli.validate.success': 'OADバリデーション成功',
|
|
142
|
+
'cli.validate.error': 'OADバリデーション失敗: {error}',
|
|
143
|
+
'cli.analytics.title': 'エージェント分析',
|
|
144
|
+
'cli.analytics.noData': '分析データがありません',
|
|
145
|
+
'cli.stats.title': 'エージェント分析',
|
|
146
|
+
'cli.stats.messages': '処理済みメッセージ',
|
|
147
|
+
'cli.stats.avgTime': '平均応答時間',
|
|
148
|
+
'cli.stats.errors': 'エラー数',
|
|
149
|
+
'cli.stats.uptime': '稼働時間',
|
|
150
|
+
'cli.chat.welcome': 'エージェントとチャットしましょう。"exit"で終了。',
|
|
151
|
+
'cli.dev.watching': 'ファイル変更を監視中...',
|
|
152
|
+
'cli.publish.success': '「{name}」v{version} を公開しました',
|
|
153
|
+
'plugin.loaded': 'プラグイン「{name}」を読み込みました',
|
|
154
|
+
'plugin.error': 'プラグイン「{name}」でエラー: {error}',
|
|
155
|
+
'kb.added': '「{file}」をナレッジベースに追加しました',
|
|
156
|
+
'kb.searchResults': '{count} 件の結果が見つかりました',
|
|
157
|
+
'kb.noResults': '結果が見つかりませんでした',
|
|
158
|
+
'web.title': 'OPC エージェント',
|
|
159
|
+
'web.chat.placeholder': 'メッセージを入力...',
|
|
160
|
+
'web.chat.send': '送信',
|
|
161
|
+
'web.nav.chat': 'チャット',
|
|
162
|
+
'web.nav.dashboard': 'ダッシュボード',
|
|
163
|
+
'web.nav.settings': '設定',
|
|
164
|
+
'web.dashboard.title': 'ダッシュボード',
|
|
165
|
+
'web.dashboard.messages': 'メッセージ数',
|
|
166
|
+
'web.dashboard.tokens': '使用トークン',
|
|
167
|
+
'web.dashboard.errors': 'エラー数',
|
|
168
|
+
'web.dashboard.avgLatency': '平均レイテンシ',
|
|
169
|
+
'web.settings.title': '設定',
|
|
170
|
+
'web.settings.language': '言語',
|
|
171
|
+
'web.settings.theme': 'テーマ',
|
|
172
|
+
'web.settings.save': '保存',
|
|
173
|
+
'cache.hit': 'キャッシュヒット',
|
|
174
|
+
'cache.miss': 'キャッシュミス',
|
|
175
|
+
'rateLimit.exceeded': 'リクエスト制限を超えました。しばらくお待ちください。',
|
|
176
|
+
},
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
let currentLocale: Locale = 'en';
|
|
180
|
+
|
|
181
|
+
export function setLocale(locale: Locale): void {
|
|
182
|
+
currentLocale = locale;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export function getLocale(): Locale {
|
|
186
|
+
return currentLocale;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export function getSupportedLocales(): { code: Locale; label: string }[] {
|
|
190
|
+
return [
|
|
191
|
+
{ code: 'en', label: 'English' },
|
|
192
|
+
{ code: 'zh-CN', label: '中文' },
|
|
193
|
+
{ code: 'ja', label: '日本語' },
|
|
194
|
+
];
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export function t(key: string, params?: Record<string, string>): string {
|
|
198
|
+
let msg = messages[currentLocale]?.[key] ?? messages['en']?.[key] ?? key;
|
|
199
|
+
if (params) {
|
|
200
|
+
for (const [k, v] of Object.entries(params)) {
|
|
201
|
+
msg = msg.replace(new RegExp(`\\{${k}\\}`, 'g'), v);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return msg;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export function detectLocale(): Locale {
|
|
208
|
+
const env = process.env.LANG ?? process.env.LC_ALL ?? process.env.LANGUAGE ?? '';
|
|
209
|
+
if (env.startsWith('zh')) return 'zh-CN';
|
|
210
|
+
if (env.startsWith('ja')) return 'ja';
|
|
211
|
+
return 'en';
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export function addMessages(locale: Locale, newMessages: I18nMessages): void {
|
|
215
|
+
messages[locale] = { ...messages[locale], ...newMessages };
|
|
216
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
// OPC Agent — Open Agent Framework
|
|
2
|
-
export { BaseAgent } from './core/agent';
|
|
3
|
-
export { AgentRuntime, truncateOutput } from './core/runtime';
|
|
4
|
-
export { Logger } from './core/logger';
|
|
5
|
-
export { loadOAD, validateOAD } from './core/config';
|
|
6
|
-
export { OADSchema } from './schema/oad';
|
|
7
|
-
export type { OADDocument, Metadata, Spec, DTVConfig, TrustLevelType } from './schema/oad';
|
|
8
|
-
export type { IAgent, IChannel, ISkill, Message, AgentContext, SkillResult, MemoryStore, AgentState } from './core/types';
|
|
9
|
-
export { BaseChannel } from './channels';
|
|
10
|
-
export { WebChannel } from './channels/web';
|
|
11
|
-
export { TelegramChannel } from './channels/telegram';
|
|
12
|
-
export { WebSocketChannel } from './channels/websocket';
|
|
13
|
-
export { BaseSkill } from './skills/base';
|
|
14
|
-
export { SkillRegistry } from './skills';
|
|
15
|
-
export { InMemoryStore } from './memory';
|
|
16
|
-
export { DeepBrainMemoryStore } from './memory/deepbrain';
|
|
17
|
-
export { TrustManager } from './dtv/trust';
|
|
18
|
-
export { ValueTracker } from './dtv/value';
|
|
19
|
-
export { MRGConfigReader } from './dtv/data';
|
|
20
|
-
export { createProvider, SUPPORTED_PROVIDERS } from './providers';
|
|
21
|
-
|
|
22
|
-
// v0.3.0 new modules
|
|
23
|
-
export { Room } from './core/room';
|
|
24
|
-
export type { RoomMessage } from './core/room';
|
|
25
|
-
export { MCPToolRegistry, createMCPTool } from './tools/mcp';
|
|
26
|
-
export type { MCPTool, MCPToolDefinition, MCPToolResult } from './tools/mcp';
|
|
27
|
-
export { PluginManager } from './plugins';
|
|
28
|
-
export type { IPlugin, PluginHooks } from './plugins';
|
|
29
|
-
export { Sandbox } from './core/sandbox';
|
|
30
|
-
export type { SandboxConfig, SandboxRestrictions } from './core/sandbox';
|
|
31
|
-
export { Analytics } from './analytics';
|
|
32
|
-
|
|
33
|
-
// v0.4.0 modules
|
|
34
|
-
export { WorkflowEngine } from './core/workflow';
|
|
35
|
-
export type { WorkflowDefinition, WorkflowStep, WorkflowResult, StepResult } from './core/workflow';
|
|
36
|
-
export { AgentRegistry } from './core/a2a';
|
|
37
|
-
export type { A2ARequest, A2AResponse, AgentCapability, AgentRegistration } from './core/a2a';
|
|
38
|
-
export { HITLManager } from './core/hitl';
|
|
39
|
-
export type { ApprovalRequest, ApprovalResponse, HITLConfig } from './core/hitl';
|
|
40
|
-
export { VoiceChannel } from './channels/voice';
|
|
41
|
-
export type { VoiceChannelConfig, STTProvider, TTSProvider } from './channels/voice';
|
|
42
|
-
export { WebhookChannel } from './channels/webhook';
|
|
43
|
-
export type { WebhookConfig, WebhookPayload } from './channels/webhook';
|
|
44
|
-
export { VersionManager } from './core/versioning';
|
|
45
|
-
export type { VersionEntry, Migration } from './core/versioning';
|
|
46
|
-
export { ConnectionPool, RequestBatcher, LazyLoader } from './core/performance';
|
|
47
|
-
export type { AnalyticsSnapshot } from './analytics';
|
|
48
|
-
export { t, setLocale, getLocale, detectLocale, addMessages } from './i18n';
|
|
49
|
-
export type { Locale } from './i18n';
|
|
50
|
-
|
|
51
|
-
// v0.5.0+ modules
|
|
52
|
-
export { KnowledgeBase } from './core/knowledge';
|
|
53
|
-
export { deployToHermes } from './deploy/hermes';
|
|
54
|
-
export type { HermesDeployOptions, HermesDeployResult } from './deploy/hermes';
|
|
55
|
-
export { publishAgent, installAgent } from './marketplace';
|
|
56
|
-
export type { AgentManifest, PublishOptions, InstallOptions } from './marketplace';
|
|
57
|
-
|
|
58
|
-
// v0.7.0 modules
|
|
59
|
-
export { createAuthMiddleware, getActiveSessions } from './core/auth';
|
|
60
|
-
export type { AuthConfig, AuthSession } from './core/auth';
|
|
61
|
-
// v0.8.0 modules
|
|
62
|
-
export { Orchestrator } from './core/orchestrator';
|
|
63
|
-
export type { AgentNode, OrchestratorWorkflow, OrchestratorConfig, HandoffRequest } from './core/orchestrator';
|
|
64
|
-
export { AgentPipeline, compose } from './core/compose';
|
|
65
|
-
export type { ComposableAgent, ComposeOptions } from './core/compose';
|
|
66
|
-
export { EmailChannel } from './channels/email';
|
|
67
|
-
export type { EmailChannelConfig, EmailMessage } from './channels/email';
|
|
68
|
-
export { SlackChannel } from './channels/slack';
|
|
69
|
-
export type { SlackChannelConfig, SlashCommandConfig, SlashCommandPayload } from './channels/slack';
|
|
70
|
-
export { WeChatChannel } from './channels/wechat';
|
|
71
|
-
export type { WeChatChannelConfig, WeChatMessage, TemplateMessageData } from './channels/wechat';
|
|
72
|
-
export { CalculatorTool } from './tools/calculator';
|
|
73
|
-
export { DateTimeTool } from './tools/datetime';
|
|
74
|
-
export { JsonTransformTool } from './tools/json-transform';
|
|
75
|
-
export { TextAnalysisTool } from './tools/text-analysis';
|
|
76
|
-
|
|
77
|
-
export { HttpSkill } from './skills/http';
|
|
78
|
-
export { WebhookTriggerSkill } from './skills/webhook-trigger';
|
|
79
|
-
export type { WebhookTarget } from './skills/webhook-trigger';
|
|
80
|
-
export { SchedulerSkill } from './skills/scheduler';
|
|
81
|
-
export type { ScheduledTask } from './skills/scheduler';
|
|
82
|
-
export { DocumentSkill } from './skills/document';
|
|
83
|
-
export type { DocumentChunk } from './skills/document';
|
|
84
|
-
|
|
85
|
-
// v0.9.0 modules
|
|
86
|
-
export { runTests, loadTestCases, formatReport } from './testing';
|
|
87
|
-
export type { TestCase, TestResult, TestReport } from './testing';
|
|
88
|
-
export { AnalyticsEngine } from './core/analytics-engine';
|
|
89
|
-
export type { AnalyticsEvent, AnalyticsStats } from './core/analytics-engine';
|
|
90
|
-
export { RateLimiter } from './core/rate-limiter';
|
|
91
|
-
export { LLMCache } from './core/cache';
|
|
92
|
-
export type { CacheConfig, CacheEntry } from './core/cache';
|
|
93
|
-
export { getSupportedLocales } from './i18n';
|
|
94
|
-
export { createDataAnalystConfig } from './templates/data-analyst';
|
|
95
|
-
export { createTeacherConfig } from './templates/teacher';
|
|
96
|
-
|
|
97
|
-
// v1.0.0 modules
|
|
98
|
-
export { OPCError, ProviderError, ValidationError, ConfigError, ChannelError, PluginError, RateLimitError, SecurityError, TimeoutError, wrapError, formatErrorForUser } from './core/errors';
|
|
99
|
-
export { sanitizeInput, detectInjection, securityHeaders, corsMiddleware, APIKeyManager, inputValidation } from './core/security';
|
|
100
|
-
export type { SecurityHeadersConfig, CORSConfig, APIKeyEntry } from './core/security';
|
|
101
|
-
export { createLoggingPlugin, createAnalyticsPlugin, createRateLimitPlugin } from './plugins';
|
|
102
|
-
export type { PluginManifest } from './plugins';
|
|
103
|
-
|
|
104
|
-
// v1.1.0 modules
|
|
105
|
-
export { FeishuChannel } from './channels/feishu';
|
|
106
|
-
export type { FeishuChannelConfig } from './channels/feishu';
|
|
107
|
-
export { DiscordChannel } from './channels/discord';
|
|
108
|
-
export type { DiscordChannelConfig } from './channels/discord';
|
|
109
|
-
export { ProcessWatcher } from './core/watch';
|
|
110
|
-
export type { WatchPattern, WatchMatch, WatchOptions } from './core/watch';
|
|
1
|
+
// OPC Agent — Open Agent Framework
|
|
2
|
+
export { BaseAgent } from './core/agent';
|
|
3
|
+
export { AgentRuntime, truncateOutput } from './core/runtime';
|
|
4
|
+
export { Logger } from './core/logger';
|
|
5
|
+
export { loadOAD, validateOAD } from './core/config';
|
|
6
|
+
export { OADSchema } from './schema/oad';
|
|
7
|
+
export type { OADDocument, Metadata, Spec, DTVConfig, TrustLevelType } from './schema/oad';
|
|
8
|
+
export type { IAgent, IChannel, ISkill, Message, AgentContext, SkillResult, MemoryStore, AgentState } from './core/types';
|
|
9
|
+
export { BaseChannel } from './channels';
|
|
10
|
+
export { WebChannel } from './channels/web';
|
|
11
|
+
export { TelegramChannel } from './channels/telegram';
|
|
12
|
+
export { WebSocketChannel } from './channels/websocket';
|
|
13
|
+
export { BaseSkill } from './skills/base';
|
|
14
|
+
export { SkillRegistry } from './skills';
|
|
15
|
+
export { InMemoryStore } from './memory';
|
|
16
|
+
export { DeepBrainMemoryStore } from './memory/deepbrain';
|
|
17
|
+
export { TrustManager } from './dtv/trust';
|
|
18
|
+
export { ValueTracker } from './dtv/value';
|
|
19
|
+
export { MRGConfigReader } from './dtv/data';
|
|
20
|
+
export { createProvider, SUPPORTED_PROVIDERS } from './providers';
|
|
21
|
+
|
|
22
|
+
// v0.3.0 new modules
|
|
23
|
+
export { Room } from './core/room';
|
|
24
|
+
export type { RoomMessage } from './core/room';
|
|
25
|
+
export { MCPToolRegistry, createMCPTool } from './tools/mcp';
|
|
26
|
+
export type { MCPTool, MCPToolDefinition, MCPToolResult } from './tools/mcp';
|
|
27
|
+
export { PluginManager } from './plugins';
|
|
28
|
+
export type { IPlugin, PluginHooks } from './plugins';
|
|
29
|
+
export { Sandbox } from './core/sandbox';
|
|
30
|
+
export type { SandboxConfig, SandboxRestrictions } from './core/sandbox';
|
|
31
|
+
export { Analytics } from './analytics';
|
|
32
|
+
|
|
33
|
+
// v0.4.0 modules
|
|
34
|
+
export { WorkflowEngine } from './core/workflow';
|
|
35
|
+
export type { WorkflowDefinition, WorkflowStep, WorkflowResult, StepResult } from './core/workflow';
|
|
36
|
+
export { AgentRegistry } from './core/a2a';
|
|
37
|
+
export type { A2ARequest, A2AResponse, AgentCapability, AgentRegistration } from './core/a2a';
|
|
38
|
+
export { HITLManager } from './core/hitl';
|
|
39
|
+
export type { ApprovalRequest, ApprovalResponse, HITLConfig } from './core/hitl';
|
|
40
|
+
export { VoiceChannel } from './channels/voice';
|
|
41
|
+
export type { VoiceChannelConfig, STTProvider, TTSProvider } from './channels/voice';
|
|
42
|
+
export { WebhookChannel } from './channels/webhook';
|
|
43
|
+
export type { WebhookConfig, WebhookPayload } from './channels/webhook';
|
|
44
|
+
export { VersionManager } from './core/versioning';
|
|
45
|
+
export type { VersionEntry, Migration } from './core/versioning';
|
|
46
|
+
export { ConnectionPool, RequestBatcher, LazyLoader } from './core/performance';
|
|
47
|
+
export type { AnalyticsSnapshot } from './analytics';
|
|
48
|
+
export { t, setLocale, getLocale, detectLocale, addMessages } from './i18n';
|
|
49
|
+
export type { Locale } from './i18n';
|
|
50
|
+
|
|
51
|
+
// v0.5.0+ modules
|
|
52
|
+
export { KnowledgeBase } from './core/knowledge';
|
|
53
|
+
export { deployToHermes } from './deploy/hermes';
|
|
54
|
+
export type { HermesDeployOptions, HermesDeployResult } from './deploy/hermes';
|
|
55
|
+
export { publishAgent, installAgent } from './marketplace';
|
|
56
|
+
export type { AgentManifest, PublishOptions, InstallOptions } from './marketplace';
|
|
57
|
+
|
|
58
|
+
// v0.7.0 modules
|
|
59
|
+
export { createAuthMiddleware, getActiveSessions } from './core/auth';
|
|
60
|
+
export type { AuthConfig, AuthSession } from './core/auth';
|
|
61
|
+
// v0.8.0 modules
|
|
62
|
+
export { Orchestrator } from './core/orchestrator';
|
|
63
|
+
export type { AgentNode, OrchestratorWorkflow, OrchestratorConfig, HandoffRequest } from './core/orchestrator';
|
|
64
|
+
export { AgentPipeline, compose } from './core/compose';
|
|
65
|
+
export type { ComposableAgent, ComposeOptions } from './core/compose';
|
|
66
|
+
export { EmailChannel } from './channels/email';
|
|
67
|
+
export type { EmailChannelConfig, EmailMessage } from './channels/email';
|
|
68
|
+
export { SlackChannel } from './channels/slack';
|
|
69
|
+
export type { SlackChannelConfig, SlashCommandConfig, SlashCommandPayload } from './channels/slack';
|
|
70
|
+
export { WeChatChannel } from './channels/wechat';
|
|
71
|
+
export type { WeChatChannelConfig, WeChatMessage, TemplateMessageData } from './channels/wechat';
|
|
72
|
+
export { CalculatorTool } from './tools/calculator';
|
|
73
|
+
export { DateTimeTool } from './tools/datetime';
|
|
74
|
+
export { JsonTransformTool } from './tools/json-transform';
|
|
75
|
+
export { TextAnalysisTool } from './tools/text-analysis';
|
|
76
|
+
|
|
77
|
+
export { HttpSkill } from './skills/http';
|
|
78
|
+
export { WebhookTriggerSkill } from './skills/webhook-trigger';
|
|
79
|
+
export type { WebhookTarget } from './skills/webhook-trigger';
|
|
80
|
+
export { SchedulerSkill } from './skills/scheduler';
|
|
81
|
+
export type { ScheduledTask } from './skills/scheduler';
|
|
82
|
+
export { DocumentSkill } from './skills/document';
|
|
83
|
+
export type { DocumentChunk } from './skills/document';
|
|
84
|
+
|
|
85
|
+
// v0.9.0 modules
|
|
86
|
+
export { runTests, loadTestCases, formatReport } from './testing';
|
|
87
|
+
export type { TestCase, TestResult, TestReport } from './testing';
|
|
88
|
+
export { AnalyticsEngine } from './core/analytics-engine';
|
|
89
|
+
export type { AnalyticsEvent, AnalyticsStats } from './core/analytics-engine';
|
|
90
|
+
export { RateLimiter } from './core/rate-limiter';
|
|
91
|
+
export { LLMCache } from './core/cache';
|
|
92
|
+
export type { CacheConfig, CacheEntry } from './core/cache';
|
|
93
|
+
export { getSupportedLocales } from './i18n';
|
|
94
|
+
export { createDataAnalystConfig } from './templates/data-analyst';
|
|
95
|
+
export { createTeacherConfig } from './templates/teacher';
|
|
96
|
+
|
|
97
|
+
// v1.0.0 modules
|
|
98
|
+
export { OPCError, ProviderError, ValidationError, ConfigError, ChannelError, PluginError, RateLimitError, SecurityError, TimeoutError, wrapError, formatErrorForUser } from './core/errors';
|
|
99
|
+
export { sanitizeInput, detectInjection, securityHeaders, corsMiddleware, APIKeyManager, inputValidation } from './core/security';
|
|
100
|
+
export type { SecurityHeadersConfig, CORSConfig, APIKeyEntry } from './core/security';
|
|
101
|
+
export { createLoggingPlugin, createAnalyticsPlugin, createRateLimitPlugin } from './plugins';
|
|
102
|
+
export type { PluginManifest } from './plugins';
|
|
103
|
+
|
|
104
|
+
// v1.1.0 modules
|
|
105
|
+
export { FeishuChannel } from './channels/feishu';
|
|
106
|
+
export type { FeishuChannelConfig } from './channels/feishu';
|
|
107
|
+
export { DiscordChannel } from './channels/discord';
|
|
108
|
+
export type { DiscordChannelConfig } from './channels/discord';
|
|
109
|
+
export { ProcessWatcher } from './core/watch';
|
|
110
|
+
export type { WatchPattern, WatchMatch, WatchOptions } from './core/watch';
|