opc-agent 4.0.34 → 4.0.35
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/dist/studio-ui/index.html +93 -1
- package/package.json +1 -1
- package/src/studio-ui/index.html +93 -1
|
@@ -301,6 +301,7 @@
|
|
|
301
301
|
/* Sidebar restructure */
|
|
302
302
|
.sidebar-section-title { font-size: 11px; letter-spacing: 1px; color: var(--text-dim); margin: 20px 12px 8px; text-transform: uppercase; font-weight: 600; }
|
|
303
303
|
.sidebar-divider { height: 1px; background: var(--border); margin: 8px 12px; }
|
|
304
|
+
.pattern-card.active { border-color: var(--accent); box-shadow: var(--glow-sm); }
|
|
304
305
|
.agent-list-container { overflow-y: auto; flex: 1; min-height: 0; }
|
|
305
306
|
.agent-list-item {
|
|
306
307
|
display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 12px;
|
|
@@ -361,7 +362,17 @@
|
|
|
361
362
|
<div style="padding: 12px 16px; color: var(--text-dim); font-size: 13px;">加载中...</div>
|
|
362
363
|
</div>
|
|
363
364
|
|
|
364
|
-
<!-- Section 2:
|
|
365
|
+
<!-- Section 2: Collaboration Groups -->
|
|
366
|
+
<div class="sidebar-divider"></div>
|
|
367
|
+
<div class="sidebar-section-title">👥 协作群组</div>
|
|
368
|
+
<div class="agent-list-container" id="groups-list" style="max-height:120px;">
|
|
369
|
+
<!-- dynamically loaded -->
|
|
370
|
+
</div>
|
|
371
|
+
<div class="nav-item" data-page="create-group" onclick="navigate('create-group')">
|
|
372
|
+
<span class="icon">➕</span> 新建群组
|
|
373
|
+
</div>
|
|
374
|
+
|
|
375
|
+
<!-- Section 3: Create Agent -->
|
|
365
376
|
<div class="sidebar-divider"></div>
|
|
366
377
|
<div class="nav-item" data-page="create" onclick="navigate('create')">
|
|
367
378
|
<span class="icon">➕</span> 新建 Agent
|
|
@@ -490,6 +501,49 @@
|
|
|
490
501
|
</div>
|
|
491
502
|
|
|
492
503
|
<!-- Templates Page -->
|
|
504
|
+
<!-- Create Group Page -->
|
|
505
|
+
<div class="page" id="page-create-group">
|
|
506
|
+
<h1 class="page-title">新建协作群组</h1>
|
|
507
|
+
<p class="page-subtitle">选择协作模式,拉入 Agent,开始多角色协作</p>
|
|
508
|
+
<div class="card" style="max-width:600px;">
|
|
509
|
+
<div class="label">群组名称</div>
|
|
510
|
+
<input class="input" id="group-name" placeholder="例如:产品讨论组">
|
|
511
|
+
<div class="label" style="margin-top:16px;">协作模式</div>
|
|
512
|
+
<div class="card-grid" style="grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap:12px; margin-bottom:16px;">
|
|
513
|
+
<div class="card pattern-card active" onclick="selectPattern('debate')" id="pat-debate" style="padding:14px;cursor:pointer;text-align:center;">
|
|
514
|
+
<div style="font-size:24px;margin-bottom:6px;">⚔️</div>
|
|
515
|
+
<div style="font-size:14px;font-weight:600;">Debate</div>
|
|
516
|
+
<div style="font-size:12px;color:var(--text-muted);">正反方辩论 + 裁判总结</div>
|
|
517
|
+
</div>
|
|
518
|
+
<div class="card pattern-card" onclick="selectPattern('voting')" id="pat-voting" style="padding:14px;cursor:pointer;text-align:center;">
|
|
519
|
+
<div style="font-size:24px;margin-bottom:6px;">🗳️</div>
|
|
520
|
+
<div style="font-size:14px;font-weight:600;">Voting</div>
|
|
521
|
+
<div style="font-size:12px;color:var(--text-muted);">多 Agent 投票表决</div>
|
|
522
|
+
</div>
|
|
523
|
+
<div class="card pattern-card" onclick="selectPattern('pipeline')" id="pat-pipeline" style="padding:14px;cursor:pointer;text-align:center;">
|
|
524
|
+
<div style="font-size:24px;margin-bottom:6px;">🔗</div>
|
|
525
|
+
<div style="font-size:14px;font-weight:600;">Pipeline</div>
|
|
526
|
+
<div style="font-size:12px;color:var(--text-muted);">链式处理,逐步传递</div>
|
|
527
|
+
</div>
|
|
528
|
+
<div class="card pattern-card" onclick="selectPattern('hierarchy')" id="pat-hierarchy" style="padding:14px;cursor:pointer;text-align:center;">
|
|
529
|
+
<div style="font-size:24px;margin-bottom:6px;">🏛️</div>
|
|
530
|
+
<div style="font-size:14px;font-weight:600;">Hierarchy</div>
|
|
531
|
+
<div style="font-size:12px;color:var(--text-muted);">上下级分配任务</div>
|
|
532
|
+
</div>
|
|
533
|
+
<div class="card pattern-card" onclick="selectPattern('shared-memory')" id="pat-shared-memory" style="padding:14px;cursor:pointer;text-align:center;">
|
|
534
|
+
<div style="font-size:24px;margin-bottom:6px;">🧠</div>
|
|
535
|
+
<div style="font-size:14px;font-weight:600;">Shared Memory</div>
|
|
536
|
+
<div style="font-size:12px;color:var(--text-muted);">共享记忆空间协作</div>
|
|
537
|
+
</div>
|
|
538
|
+
</div>
|
|
539
|
+
<div class="label">选择 Agent 成员</div>
|
|
540
|
+
<div id="group-agent-select" style="margin-bottom:16px;">
|
|
541
|
+
<p style="color:var(--text-muted);font-size:13px;">请先创建 Agent,再拉入群组</p>
|
|
542
|
+
</div>
|
|
543
|
+
<button class="btn btn-primary" onclick="createGroup()">✨ 创建群组</button>
|
|
544
|
+
</div>
|
|
545
|
+
</div>
|
|
546
|
+
|
|
493
547
|
<div class="page" id="page-templates">
|
|
494
548
|
<h1 class="page-title">Template Market</h1>
|
|
495
549
|
<p class="page-subtitle">Browse 100+ ready-to-use agent templates across 19 industries</p>
|
|
@@ -1062,6 +1116,7 @@
|
|
|
1062
1116
|
// === Init ===
|
|
1063
1117
|
async function init() {
|
|
1064
1118
|
await Promise.all([loadTemplates(), loadAgents()]);
|
|
1119
|
+
loadSidebarGroups();
|
|
1065
1120
|
handleRoute();
|
|
1066
1121
|
window.addEventListener('popstate', handleRoute);
|
|
1067
1122
|
checkFirstRun();
|
|
@@ -1146,6 +1201,42 @@
|
|
|
1146
1201
|
}
|
|
1147
1202
|
}
|
|
1148
1203
|
|
|
1204
|
+
// --- Collaboration Groups ---
|
|
1205
|
+
let selectedPattern = 'debate';
|
|
1206
|
+
function selectPattern(pat) {
|
|
1207
|
+
selectedPattern = pat;
|
|
1208
|
+
document.querySelectorAll('.pattern-card').forEach(c => c.classList.remove('active'));
|
|
1209
|
+
const el = document.getElementById('pat-' + pat);
|
|
1210
|
+
if (el) el.classList.add('active');
|
|
1211
|
+
}
|
|
1212
|
+
async function loadGroupAgentSelect() {
|
|
1213
|
+
try {
|
|
1214
|
+
const res = await fetch('/api/agents');
|
|
1215
|
+
const data = await res.json();
|
|
1216
|
+
const agents = data.agents || data || [];
|
|
1217
|
+
const container = document.getElementById('group-agent-select');
|
|
1218
|
+
if (!agents.length) {
|
|
1219
|
+
container.innerHTML = '<p style="color:var(--text-muted);font-size:13px;">请先创建 Agent,再拉入群组</p>';
|
|
1220
|
+
return;
|
|
1221
|
+
}
|
|
1222
|
+
container.innerHTML = agents.map(a => `<label style="display:flex;align-items:center;gap:8px;padding:6px 0;cursor:pointer;"><input type="checkbox" class="group-agent-cb" value="${a.id}"> <span>${a.templateIcon || a.icon || '🤖'}</span> <span style="font-size:14px;">${a.name}</span></label>`).join('');
|
|
1223
|
+
} catch(e) { console.error('loadGroupAgentSelect error', e); }
|
|
1224
|
+
}
|
|
1225
|
+
async function createGroup() {
|
|
1226
|
+
const name = document.getElementById('group-name').value.trim();
|
|
1227
|
+
if (!name) { alert('请输入群组名称'); return; }
|
|
1228
|
+
const members = [...document.querySelectorAll('.group-agent-cb:checked')].map(cb => cb.value);
|
|
1229
|
+
if (members.length < 2) { alert('至少选择 2 个 Agent'); return; }
|
|
1230
|
+
// TODO: POST to /api/groups
|
|
1231
|
+
alert('群组 "' + name + '" 创建成功!模式: ' + selectedPattern + ', 成员: ' + members.length + ' 个 Agent');
|
|
1232
|
+
navigate('dashboard');
|
|
1233
|
+
}
|
|
1234
|
+
async function loadSidebarGroups() {
|
|
1235
|
+
// TODO: fetch /api/groups and render
|
|
1236
|
+
const container = document.getElementById('groups-list');
|
|
1237
|
+
if (container) container.innerHTML = '<div style="padding:6px 16px;color:var(--text-dim);font-size:12px;">暂无群组</div>';
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1149
1240
|
function navigateToAgent(agentId) {
|
|
1150
1241
|
selectedAgentId = agentId;
|
|
1151
1242
|
// Update sidebar active state
|
|
@@ -1261,6 +1352,7 @@
|
|
|
1261
1352
|
if (page === 'global-models') { currentSettingsTab='models'; showSettings('models'); showPage('settings'); return; }
|
|
1262
1353
|
if (page === 'global-memory') { currentSettingsTab='memory'; showSettings('memory'); showPage('settings'); return; }
|
|
1263
1354
|
if (page === 'global-templates') { navigate('templates'); return; }
|
|
1355
|
+
if (page === 'create-group') { loadGroupAgentSelect(); }
|
|
1264
1356
|
if (page === 'schedules') { loadSchedules(); }
|
|
1265
1357
|
if (page === 'skills') { loadSkillsMarketplace(); }
|
|
1266
1358
|
|
package/package.json
CHANGED
package/src/studio-ui/index.html
CHANGED
|
@@ -301,6 +301,7 @@
|
|
|
301
301
|
/* Sidebar restructure */
|
|
302
302
|
.sidebar-section-title { font-size: 11px; letter-spacing: 1px; color: var(--text-dim); margin: 20px 12px 8px; text-transform: uppercase; font-weight: 600; }
|
|
303
303
|
.sidebar-divider { height: 1px; background: var(--border); margin: 8px 12px; }
|
|
304
|
+
.pattern-card.active { border-color: var(--accent); box-shadow: var(--glow-sm); }
|
|
304
305
|
.agent-list-container { overflow-y: auto; flex: 1; min-height: 0; }
|
|
305
306
|
.agent-list-item {
|
|
306
307
|
display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 12px;
|
|
@@ -361,7 +362,17 @@
|
|
|
361
362
|
<div style="padding: 12px 16px; color: var(--text-dim); font-size: 13px;">加载中...</div>
|
|
362
363
|
</div>
|
|
363
364
|
|
|
364
|
-
<!-- Section 2:
|
|
365
|
+
<!-- Section 2: Collaboration Groups -->
|
|
366
|
+
<div class="sidebar-divider"></div>
|
|
367
|
+
<div class="sidebar-section-title">👥 协作群组</div>
|
|
368
|
+
<div class="agent-list-container" id="groups-list" style="max-height:120px;">
|
|
369
|
+
<!-- dynamically loaded -->
|
|
370
|
+
</div>
|
|
371
|
+
<div class="nav-item" data-page="create-group" onclick="navigate('create-group')">
|
|
372
|
+
<span class="icon">➕</span> 新建群组
|
|
373
|
+
</div>
|
|
374
|
+
|
|
375
|
+
<!-- Section 3: Create Agent -->
|
|
365
376
|
<div class="sidebar-divider"></div>
|
|
366
377
|
<div class="nav-item" data-page="create" onclick="navigate('create')">
|
|
367
378
|
<span class="icon">➕</span> 新建 Agent
|
|
@@ -490,6 +501,49 @@
|
|
|
490
501
|
</div>
|
|
491
502
|
|
|
492
503
|
<!-- Templates Page -->
|
|
504
|
+
<!-- Create Group Page -->
|
|
505
|
+
<div class="page" id="page-create-group">
|
|
506
|
+
<h1 class="page-title">新建协作群组</h1>
|
|
507
|
+
<p class="page-subtitle">选择协作模式,拉入 Agent,开始多角色协作</p>
|
|
508
|
+
<div class="card" style="max-width:600px;">
|
|
509
|
+
<div class="label">群组名称</div>
|
|
510
|
+
<input class="input" id="group-name" placeholder="例如:产品讨论组">
|
|
511
|
+
<div class="label" style="margin-top:16px;">协作模式</div>
|
|
512
|
+
<div class="card-grid" style="grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap:12px; margin-bottom:16px;">
|
|
513
|
+
<div class="card pattern-card active" onclick="selectPattern('debate')" id="pat-debate" style="padding:14px;cursor:pointer;text-align:center;">
|
|
514
|
+
<div style="font-size:24px;margin-bottom:6px;">⚔️</div>
|
|
515
|
+
<div style="font-size:14px;font-weight:600;">Debate</div>
|
|
516
|
+
<div style="font-size:12px;color:var(--text-muted);">正反方辩论 + 裁判总结</div>
|
|
517
|
+
</div>
|
|
518
|
+
<div class="card pattern-card" onclick="selectPattern('voting')" id="pat-voting" style="padding:14px;cursor:pointer;text-align:center;">
|
|
519
|
+
<div style="font-size:24px;margin-bottom:6px;">🗳️</div>
|
|
520
|
+
<div style="font-size:14px;font-weight:600;">Voting</div>
|
|
521
|
+
<div style="font-size:12px;color:var(--text-muted);">多 Agent 投票表决</div>
|
|
522
|
+
</div>
|
|
523
|
+
<div class="card pattern-card" onclick="selectPattern('pipeline')" id="pat-pipeline" style="padding:14px;cursor:pointer;text-align:center;">
|
|
524
|
+
<div style="font-size:24px;margin-bottom:6px;">🔗</div>
|
|
525
|
+
<div style="font-size:14px;font-weight:600;">Pipeline</div>
|
|
526
|
+
<div style="font-size:12px;color:var(--text-muted);">链式处理,逐步传递</div>
|
|
527
|
+
</div>
|
|
528
|
+
<div class="card pattern-card" onclick="selectPattern('hierarchy')" id="pat-hierarchy" style="padding:14px;cursor:pointer;text-align:center;">
|
|
529
|
+
<div style="font-size:24px;margin-bottom:6px;">🏛️</div>
|
|
530
|
+
<div style="font-size:14px;font-weight:600;">Hierarchy</div>
|
|
531
|
+
<div style="font-size:12px;color:var(--text-muted);">上下级分配任务</div>
|
|
532
|
+
</div>
|
|
533
|
+
<div class="card pattern-card" onclick="selectPattern('shared-memory')" id="pat-shared-memory" style="padding:14px;cursor:pointer;text-align:center;">
|
|
534
|
+
<div style="font-size:24px;margin-bottom:6px;">🧠</div>
|
|
535
|
+
<div style="font-size:14px;font-weight:600;">Shared Memory</div>
|
|
536
|
+
<div style="font-size:12px;color:var(--text-muted);">共享记忆空间协作</div>
|
|
537
|
+
</div>
|
|
538
|
+
</div>
|
|
539
|
+
<div class="label">选择 Agent 成员</div>
|
|
540
|
+
<div id="group-agent-select" style="margin-bottom:16px;">
|
|
541
|
+
<p style="color:var(--text-muted);font-size:13px;">请先创建 Agent,再拉入群组</p>
|
|
542
|
+
</div>
|
|
543
|
+
<button class="btn btn-primary" onclick="createGroup()">✨ 创建群组</button>
|
|
544
|
+
</div>
|
|
545
|
+
</div>
|
|
546
|
+
|
|
493
547
|
<div class="page" id="page-templates">
|
|
494
548
|
<h1 class="page-title">Template Market</h1>
|
|
495
549
|
<p class="page-subtitle">Browse 100+ ready-to-use agent templates across 19 industries</p>
|
|
@@ -1062,6 +1116,7 @@
|
|
|
1062
1116
|
// === Init ===
|
|
1063
1117
|
async function init() {
|
|
1064
1118
|
await Promise.all([loadTemplates(), loadAgents()]);
|
|
1119
|
+
loadSidebarGroups();
|
|
1065
1120
|
handleRoute();
|
|
1066
1121
|
window.addEventListener('popstate', handleRoute);
|
|
1067
1122
|
checkFirstRun();
|
|
@@ -1146,6 +1201,42 @@
|
|
|
1146
1201
|
}
|
|
1147
1202
|
}
|
|
1148
1203
|
|
|
1204
|
+
// --- Collaboration Groups ---
|
|
1205
|
+
let selectedPattern = 'debate';
|
|
1206
|
+
function selectPattern(pat) {
|
|
1207
|
+
selectedPattern = pat;
|
|
1208
|
+
document.querySelectorAll('.pattern-card').forEach(c => c.classList.remove('active'));
|
|
1209
|
+
const el = document.getElementById('pat-' + pat);
|
|
1210
|
+
if (el) el.classList.add('active');
|
|
1211
|
+
}
|
|
1212
|
+
async function loadGroupAgentSelect() {
|
|
1213
|
+
try {
|
|
1214
|
+
const res = await fetch('/api/agents');
|
|
1215
|
+
const data = await res.json();
|
|
1216
|
+
const agents = data.agents || data || [];
|
|
1217
|
+
const container = document.getElementById('group-agent-select');
|
|
1218
|
+
if (!agents.length) {
|
|
1219
|
+
container.innerHTML = '<p style="color:var(--text-muted);font-size:13px;">请先创建 Agent,再拉入群组</p>';
|
|
1220
|
+
return;
|
|
1221
|
+
}
|
|
1222
|
+
container.innerHTML = agents.map(a => `<label style="display:flex;align-items:center;gap:8px;padding:6px 0;cursor:pointer;"><input type="checkbox" class="group-agent-cb" value="${a.id}"> <span>${a.templateIcon || a.icon || '🤖'}</span> <span style="font-size:14px;">${a.name}</span></label>`).join('');
|
|
1223
|
+
} catch(e) { console.error('loadGroupAgentSelect error', e); }
|
|
1224
|
+
}
|
|
1225
|
+
async function createGroup() {
|
|
1226
|
+
const name = document.getElementById('group-name').value.trim();
|
|
1227
|
+
if (!name) { alert('请输入群组名称'); return; }
|
|
1228
|
+
const members = [...document.querySelectorAll('.group-agent-cb:checked')].map(cb => cb.value);
|
|
1229
|
+
if (members.length < 2) { alert('至少选择 2 个 Agent'); return; }
|
|
1230
|
+
// TODO: POST to /api/groups
|
|
1231
|
+
alert('群组 "' + name + '" 创建成功!模式: ' + selectedPattern + ', 成员: ' + members.length + ' 个 Agent');
|
|
1232
|
+
navigate('dashboard');
|
|
1233
|
+
}
|
|
1234
|
+
async function loadSidebarGroups() {
|
|
1235
|
+
// TODO: fetch /api/groups and render
|
|
1236
|
+
const container = document.getElementById('groups-list');
|
|
1237
|
+
if (container) container.innerHTML = '<div style="padding:6px 16px;color:var(--text-dim);font-size:12px;">暂无群组</div>';
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1149
1240
|
function navigateToAgent(agentId) {
|
|
1150
1241
|
selectedAgentId = agentId;
|
|
1151
1242
|
// Update sidebar active state
|
|
@@ -1261,6 +1352,7 @@
|
|
|
1261
1352
|
if (page === 'global-models') { currentSettingsTab='models'; showSettings('models'); showPage('settings'); return; }
|
|
1262
1353
|
if (page === 'global-memory') { currentSettingsTab='memory'; showSettings('memory'); showPage('settings'); return; }
|
|
1263
1354
|
if (page === 'global-templates') { navigate('templates'); return; }
|
|
1355
|
+
if (page === 'create-group') { loadGroupAgentSelect(); }
|
|
1264
1356
|
if (page === 'schedules') { loadSchedules(); }
|
|
1265
1357
|
if (page === 'skills') { loadSkillsMarketplace(); }
|
|
1266
1358
|
|