opc-agent 5.0.0-rc.7 → 5.0.0-rc.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.
package/.opc/brain.db ADDED
Binary file
package/.opc/memory.db CHANGED
Binary file
@@ -779,6 +779,126 @@
779
779
  "updatedAt": "2026-04-22T05:32:00.260Z",
780
780
  "nextRun": "2026-04-23T01:00:00.000Z",
781
781
  "lastRun": "2026-04-22T05:32:00.273Z"
782
+ },
783
+ {
784
+ "name": "Test Task",
785
+ "schedule": "0 9 * * *",
786
+ "description": "Test description",
787
+ "frequency": "daily",
788
+ "time": "09:00",
789
+ "outputChannel": "web",
790
+ "enabled": true,
791
+ "id": "sched-1776845081446-mi7y",
792
+ "createdAt": "2026-04-22T08:04:41.446Z",
793
+ "updatedAt": "2026-04-22T08:04:41.446Z",
794
+ "nextRun": "2026-04-23T01:00:00.000Z"
795
+ },
796
+ {
797
+ "name": "A",
798
+ "schedule": "0 9 * * *",
799
+ "description": "",
800
+ "frequency": "daily",
801
+ "outputChannel": "web",
802
+ "enabled": true,
803
+ "id": "sched-1776845081453-t83k",
804
+ "createdAt": "2026-04-22T08:04:41.453Z",
805
+ "updatedAt": "2026-04-22T08:04:41.453Z",
806
+ "nextRun": "2026-04-23T01:00:00.000Z"
807
+ },
808
+ {
809
+ "name": "B",
810
+ "schedule": "0 10 * * *",
811
+ "description": "",
812
+ "frequency": "daily",
813
+ "outputChannel": "telegram",
814
+ "enabled": false,
815
+ "id": "sched-1776845081456-36t5",
816
+ "createdAt": "2026-04-22T08:04:41.456Z",
817
+ "updatedAt": "2026-04-22T08:04:41.456Z"
818
+ },
819
+ {
820
+ "name": "Updated",
821
+ "schedule": "0 9 * * *",
822
+ "description": "",
823
+ "frequency": "daily",
824
+ "outputChannel": "web",
825
+ "enabled": false,
826
+ "id": "sched-1776845081472-31h0",
827
+ "createdAt": "2026-04-22T08:04:41.472Z",
828
+ "updatedAt": "2026-04-22T08:04:41.475Z"
829
+ },
830
+ {
831
+ "name": "RunMe",
832
+ "schedule": "0 9 * * *",
833
+ "description": "test",
834
+ "frequency": "daily",
835
+ "outputChannel": "web",
836
+ "enabled": true,
837
+ "id": "sched-1776845081500-39oo",
838
+ "createdAt": "2026-04-22T08:04:41.500Z",
839
+ "updatedAt": "2026-04-22T08:04:41.500Z",
840
+ "nextRun": "2026-04-23T01:00:00.000Z",
841
+ "lastRun": "2026-04-22T08:04:41.513Z"
842
+ },
843
+ {
844
+ "name": "Test Task",
845
+ "schedule": "0 9 * * *",
846
+ "description": "Test description",
847
+ "frequency": "daily",
848
+ "time": "09:00",
849
+ "outputChannel": "web",
850
+ "enabled": true,
851
+ "id": "sched-1776845621860-64ve",
852
+ "createdAt": "2026-04-22T08:13:41.860Z",
853
+ "updatedAt": "2026-04-22T08:13:41.860Z",
854
+ "nextRun": "2026-04-23T01:00:00.000Z"
855
+ },
856
+ {
857
+ "name": "A",
858
+ "schedule": "0 9 * * *",
859
+ "description": "",
860
+ "frequency": "daily",
861
+ "outputChannel": "web",
862
+ "enabled": true,
863
+ "id": "sched-1776845621868-lgmn",
864
+ "createdAt": "2026-04-22T08:13:41.868Z",
865
+ "updatedAt": "2026-04-22T08:13:41.868Z",
866
+ "nextRun": "2026-04-23T01:00:00.000Z"
867
+ },
868
+ {
869
+ "name": "B",
870
+ "schedule": "0 10 * * *",
871
+ "description": "",
872
+ "frequency": "daily",
873
+ "outputChannel": "telegram",
874
+ "enabled": false,
875
+ "id": "sched-1776845621872-md3i",
876
+ "createdAt": "2026-04-22T08:13:41.872Z",
877
+ "updatedAt": "2026-04-22T08:13:41.872Z"
878
+ },
879
+ {
880
+ "name": "Updated",
881
+ "schedule": "0 9 * * *",
882
+ "description": "",
883
+ "frequency": "daily",
884
+ "outputChannel": "web",
885
+ "enabled": false,
886
+ "id": "sched-1776845621890-4ewt",
887
+ "createdAt": "2026-04-22T08:13:41.890Z",
888
+ "updatedAt": "2026-04-22T08:13:41.894Z"
889
+ },
890
+ {
891
+ "name": "RunMe",
892
+ "schedule": "0 9 * * *",
893
+ "description": "test",
894
+ "frequency": "daily",
895
+ "outputChannel": "web",
896
+ "enabled": true,
897
+ "id": "sched-1776845621935-0xlj",
898
+ "createdAt": "2026-04-22T08:13:41.935Z",
899
+ "updatedAt": "2026-04-22T08:13:41.935Z",
900
+ "nextRun": "2026-04-23T01:00:00.000Z",
901
+ "lastRun": "2026-04-22T08:13:41.949Z"
782
902
  }
783
903
  ]
784
904
  }
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: greet-user
3
+ description: "Greet the user warmly when they say hello"
4
+ version: 1.0.0
5
+ author: auto-generated
6
+ trigger: "hello, hi, 你好"
7
+ tools_used: []
8
+ created: 2026-04-22
9
+ ---
10
+
11
+ ## Steps
12
+
13
+ 1. Identify the user's language from their greeting
14
+ 2. Respond with a warm greeting in the same language
15
+ 3. Briefly introduce yourself and your capabilities
16
+
17
+ ## Triggers
18
+
19
+ - hello
20
+ - hi
21
+ - 你好
package/TASK-STUDIO.md ADDED
@@ -0,0 +1,200 @@
1
+ # TASK: Studio Agent 设置页 — 8 Tab 完整实现
2
+
3
+ ## 文件
4
+ - `src/studio-ui/index.html` — 单文件前端
5
+ - `src/studio/server.ts` — 后端(补缺失 API)
6
+
7
+ ## 现状
8
+ Agent 设置页当前只有 4 个 tab(基本信息/模型/记忆/渠道),且部分不可用。
9
+ 需要扩展到 8 个 tab,覆盖 OAD schema 全部可配置项。
10
+
11
+ ## 8 个 Tab
12
+
13
+ ### Tab 1: 📋 基本信息
14
+ 已有,需修复:
15
+ - name(text input)
16
+ - version(text input)
17
+ - description(textarea)
18
+ - author(text input)
19
+ - systemPrompt(大文本框,最小高度 300px)
20
+ - locale(select: en / zh-CN)
21
+ - 「AI 生成 Prompt」按钮 → POST /api/agents/generate-prompt
22
+ - 底部「保存」按钮
23
+
24
+ ### Tab 2: 🧠 模型
25
+ 已有,需修复:
26
+ - provider(select: ollama/openai/deepseek/qwen/openrouter/anthropic)
27
+ - model(联动 provider 的模型列表)
28
+ - API Key(password input,对应 provider)
29
+ - Base URL(text input)
30
+ - 「测试连接」按钮 → POST /api/settings/models/test
31
+ - Ollama 模型自动检测 → GET /api/models/ollama
32
+
33
+ ### Tab 3: 🔧 工具 & Skill(新增)
34
+ ```html
35
+ <div class="settings-section">
36
+ <h3>内置工具</h3>
37
+ <!-- 每个工具一行:图标 + 名称 + 描述 + toggle switch -->
38
+ <div class="tool-toggle">
39
+ <span>📁</span><span>file_operations</span><span class="desc">文件读写操作</span>
40
+ <label class="switch"><input type="checkbox" checked><span class="slider"></span></label>
41
+ </div>
42
+ <!-- file_operations, shell_exec, web_search, web_read, datetime, browser_*, vision_*, rl_*, home_assistant_* -->
43
+ </div>
44
+
45
+ <div class="settings-section">
46
+ <h3>MCP Servers</h3>
47
+ <!-- 卡片列表 + 添加按钮 -->
48
+ <!-- 每个 server: name, command, args[], env{} -->
49
+ </div>
50
+
51
+ <div class="settings-section">
52
+ <h3>Skills</h3>
53
+ <!-- 已安装 skill 列表 GET /api/skills/installed -->
54
+ <!-- 浏览更多 → 跳转 Workstation Skill 市场 -->
55
+ </div>
56
+ ```
57
+
58
+ ### Tab 4: 💾 记忆
59
+ 已有,需修复:
60
+ - shortTerm toggle
61
+ - longTerm toggle → 展开配置
62
+ - provider select (in-memory / deepbrain)
63
+ - database 路径
64
+ - autoLearn toggle
65
+ - autoRecall toggle
66
+ - evolveInterval (number, 单位小时)
67
+ - embeddingProvider select
68
+ - 记忆统计卡片(页数/分块数)
69
+
70
+ ### Tab 5: 📡 渠道
71
+ 已有,需修复:
72
+ - 已启用渠道卡片列表(类型 + 状态灯 🟢/🔴)
73
+ - 「添加渠道」按钮 → 选类型 → 展开配置表单
74
+ - Telegram: botToken input
75
+ - Web: port input
76
+ - 微信: appId, appSecret, token, encodingAESKey
77
+ - 飞书: appId, appSecret, verificationToken
78
+ - Slack: botToken, signingSecret
79
+ - Discord: botToken
80
+ - Email: smtp/imap host/port/user/pass
81
+ - Webhook: path, secret
82
+
83
+ ### Tab 6: 🎙️ 语音(新增)
84
+ ```html
85
+ <div class="settings-section">
86
+ <div class="toggle-row">
87
+ <span>启用语音</span>
88
+ <label class="switch"><input type="checkbox" id="voice-enabled"><span class="slider"></span></label>
89
+ </div>
90
+ <div id="voice-config" style="display:none">
91
+ <label>STT Provider</label>
92
+ <select id="voice-stt">
93
+ <option value="none">关闭</option>
94
+ <option value="volcano">火山引擎(中文最佳)</option>
95
+ <option value="azure">Azure Speech</option>
96
+ <option value="whisper-api">Whisper API</option>
97
+ </select>
98
+ <label>TTS Provider</label>
99
+ <select id="voice-tts">
100
+ <option value="edge-tts">Edge TTS(免费默认)</option>
101
+ <option value="volcano">火山引擎</option>
102
+ <option value="azure">Azure Speech</option>
103
+ <option value="openai-tts">OpenAI TTS</option>
104
+ <option value="none">关闭</option>
105
+ </select>
106
+ <label>Language</label>
107
+ <select id="voice-lang">
108
+ <option value="zh-CN">中文</option>
109
+ <option value="en-US">English</option>
110
+ <option value="ja-JP">日本語</option>
111
+ </select>
112
+ <!-- 依赖提示:选 volcano 显示环境变量提示 -->
113
+ </div>
114
+ </div>
115
+ ```
116
+
117
+ ### Tab 7: 🔒 安全(新增)
118
+ ```html
119
+ <!-- Auth -->
120
+ <div class="settings-section">
121
+ <h3>认证</h3>
122
+ <div class="toggle-row"><span>启用 API 认证</span><toggle/></div>
123
+ <div class="toggle-row"><span>Session 隔离</span><toggle/></div>
124
+ <div><label>API Keys</label><!-- 可添加/删除的 tag list --></div>
125
+ </div>
126
+
127
+ <!-- HITL -->
128
+ <div class="settings-section">
129
+ <h3>人工审批 (HITL)</h3>
130
+ <div class="toggle-row"><span>启用</span><toggle/></div>
131
+ <div><label>需审批的动作</label><!-- tag input --></div>
132
+ <div><label>超时时间 (ms)</label><input type="number" value="60000"></div>
133
+ <div><label>默认动作</label><select><option>deny</option><option>approve</option></select></div>
134
+ </div>
135
+
136
+ <!-- Guardrails -->
137
+ <div class="settings-section">
138
+ <h3>Guardrails</h3>
139
+ <div><h4>输入规则</h4><!-- 规则列表 + 添加 --></div>
140
+ <div><h4>输出规则</h4><!-- 规则列表 + 添加 --></div>
141
+ </div>
142
+ ```
143
+
144
+ ### Tab 8: ⚙️ 高级(新增)
145
+ ```html
146
+ <div class="settings-section">
147
+ <div class="toggle-row"><span>Streaming 输出</span><toggle/></div>
148
+ </div>
149
+ <div class="settings-section">
150
+ <h3>协议</h3>
151
+ <div class="toggle-row"><span>A2A (Agent-to-Agent)</span><toggle/><input placeholder="端口" type="number"></div>
152
+ <div class="toggle-row"><span>AG-UI</span><toggle/><input placeholder="路径" value="/agui"></div>
153
+ <div class="toggle-row"><span>MCP Server</span><toggle/>
154
+ <select><option>stdio</option><option>http</option></select>
155
+ <input placeholder="端口" type="number" value="3002">
156
+ </div>
157
+ <div><label>MCP 暴露工具</label><!-- checkbox list of tools --></div>
158
+ </div>
159
+ <div class="settings-section">
160
+ <h3>遥测</h3>
161
+ <div class="toggle-row"><span>启用</span><toggle/></div>
162
+ <select><option>console</option><option>file</option><option>otlp</option></select>
163
+ <input placeholder="Endpoint URL">
164
+ </div>
165
+ <div class="settings-section">
166
+ <h3>插件</h3>
167
+ <!-- plugin list + add -->
168
+ </div>
169
+ ```
170
+
171
+ ## Tab 导航 HTML
172
+ ```html
173
+ <div id="settings-tabs">
174
+ <button class="tab active" data-tab="basic">📋 基本信息</button>
175
+ <button class="tab" data-tab="model">🧠 模型</button>
176
+ <button class="tab" data-tab="tools">🔧 工具</button>
177
+ <button class="tab" data-tab="memory">💾 记忆</button>
178
+ <button class="tab" data-tab="channels">📡 渠道</button>
179
+ <button class="tab" data-tab="voice">🎙️ 语音</button>
180
+ <button class="tab" data-tab="security">🔒 安全</button>
181
+ <button class="tab" data-tab="advanced">⚙️ 高级</button>
182
+ </div>
183
+ ```
184
+
185
+ ## 后端补充
186
+ 如果缺失以下 API,需要在 server.ts 补:
187
+ - PUT /api/agents/{id} — 需要能保存完整 OAD(tools, voice, auth, hitl, guardrails, protocols, telemetry, plugins)
188
+ - GET /api/agents/{id} — 需要返回完整 OAD
189
+
190
+ ## 样式要求
191
+ - 亮色 Material 3 风格(与现有一致)
192
+ - Toggle switch 样式统一
193
+ - Tab 导航水平排列,可滚动
194
+ - 响应式布局
195
+ - 保存按钮固定在底部
196
+
197
+ ## 约束
198
+ - 单文件 HTML,不拆分
199
+ - 纯原生 JS(无 React/Vue)
200
+ - `npx tsc` 零报错
package/TASK.md CHANGED
@@ -1,52 +1,19 @@
1
- # TASK: TUI 美化 opc chat 交互体验升级
2
-
3
- ## 目标
4
- 让 `opc chat` 的终端体验达到 Hermes Agent 水平,开发者第一眼就觉得专业。
5
-
6
- ## 文件
7
- - `src/cli/chat.ts` 主文件,所有改动在这里
8
-
9
- ## 要求
10
-
11
- ### 1. 代码块高亮
12
- 当前 `renderMarkdown()` 只做了基础 bold/italic/inline-code。需要增强:
13
- - 检测 ``` 围栏代码块,用不同背景色显示
14
- - 代码块第一行如果有语言标识(如 ```typescript),显示语言标签
15
- - 代码块内容用 dim 灰色背景 + 白色前景
16
- - 支持多行代码块
17
-
18
- ### 2. 列表渲染
19
- - `- item` 和 `* item` 前面加 ` •` 符号
20
- - 有序列表 `1.` 保持数字
21
- - 嵌套缩进
22
-
23
- ### 3. 表格渲染
24
- - 检测 markdown 表格(`| col | col |` 格式)
25
- - 用 Unicode box-drawing 字符渲染
26
- - 对齐列宽
27
-
28
- ### 4. 链接和引用
29
- - `[text](url)` → 显示 text(带下划线)+ dim 显示 url
30
- - `> quote` → 用 `│` 前缀 + italic
31
-
32
- ### 5. 水平线
33
- - `---` 或 `***` → 用 `─` 字符画满一行
34
-
35
- ### 6. Streaming 兼容
36
- - 所有渲染必须兼容 streaming 输出(逐行渲染)
37
- - 代码块需要 buffer 直到 ``` 结束才渲染
38
- - 不引入任何外部依赖(纯 ANSI escape codes)
39
-
40
- ## 约束
41
- - 不引入外部依赖(No chalk, no marked, no highlight.js)
42
- - 纯 ANSI escape sequences
43
- - `npx tsc` 必须通过
44
- - 不破坏现有的 tool calling 逻辑
45
- - 不修改其他文件
46
-
47
- ## 验收标准
48
- 1. `npx tsc` 零报错
49
- 2. 代码块有视觉区分(背景色不同)
50
- 3. 列表有 bullet 符号
51
- 4. 引用有竖线前缀
52
- 5. 不影响 tool call `<tool_call>` 解析
1
+ src/studio-ui/index.html Agent 设置页(id="page-agent-chat" 附近的 settings 区域),找到现有的 settings-tabs,把 tab 按钮从 4 个扩展到 8 个。
2
+
3
+ 新增 4 个 tab 按钮:🔧 工具、🎙️ 语音、🔒 安全、⚙️ 高级
4
+
5
+ 在 renderSettingsTab 函数中,为这 4 个新 tab 添加对应的渲染逻辑。
6
+
7
+ 工具 tab:显示 builtin tools 开关列表(file_operations, shell_exec, web_search, web_read, datetime, browser_navigate, browser_screenshot, browser_click, browser_fill, vision_analyze, vision_extract_text, vision_compare, rl_reward, rl_explore, rl_exploit, home_assistant_state, home_assistant_call, home_assistant_history),每个一行 toggle switch。
8
+
9
+ 语音 tab:enabled toggle + sttProvider select (none/volcano/azure/whisper-api) + ttsProvider select (edge-tts/volcano/azure/openai-tts/none) + language select (zh-CN/en-US/ja-JP)
10
+
11
+ 安全 tab:auth.enabled toggle + auth.apiKeys tag list + auth.sessionIsolation toggle + hitl.enabled toggle + hitl.requireApproval tag input + hitl.defaultTimeoutMs number + hitl.defaultAction select
12
+
13
+ 高级 tab:streaming toggle + protocols.a2a enabled+port + protocols.agui enabled+path + protocols.mcp enabled+mode+port + telemetry enabled+exporter
14
+
15
+ 每个 tab 底部有保存按钮,PUT /api/agents/{currentAgentId}
16
+
17
+ 样式沿用现有的 Material 3 亮色风格。保持单文件 HTML。
18
+
19
+ 完成后运行 npx tsc 确认零报错。
package/cc-err3.txt ADDED
File without changes
@@ -1 +1 @@
1
- {"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/cli/chat.ts"],"names":[],"mappings":"AA4NA,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAsB,OAAO,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAqzBrE"}
1
+ {"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/cli/chat.ts"],"names":[],"mappings":"AA6NA,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAsB,OAAO,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAs9BrE"}