opc-agent 4.0.36 → 4.0.37

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.
@@ -342,20 +342,6 @@ class AgentRuntime {
342
342
  this.logger.info('Scheduler started');
343
343
  }
344
344
  this.logger.info('Agent started');
345
- // Auto-start Studio UI
346
- try {
347
- const { StudioServer } = require('../studio/server');
348
- const studioPort = 4000;
349
- const studio = new StudioServer({ port: studioPort, agentDir: process.cwd() });
350
- await studio.start();
351
- this.logger.info(`Studio UI ready → http://localhost:${studioPort}`);
352
- console.log(` Studio: http://localhost:${studioPort}`);
353
- }
354
- catch (e) {
355
- const msg = e?.message || String(e);
356
- this.logger.warn('Studio UI failed to start: ' + msg);
357
- console.log(` Studio: ⚠️ failed - ${msg}`);
358
- }
359
345
  }
360
346
  async stop() {
361
347
  if (!this.agent)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opc-agent",
3
- "version": "4.0.36",
3
+ "version": "4.0.37",
4
4
  "description": "Open Agent Framework — Build, test, and run AI Agents for business workstations",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,13 @@
1
+ const http = require('http');
2
+ const fs = require('fs');
3
+ const html = fs.readFileSync(__dirname + '/dist/studio-ui/index.html', 'utf-8');
4
+ const srv = http.createServer((req, res) => {
5
+ if (req.url === '/api/agents') {
6
+ res.end(JSON.stringify({agents:[{id:'a1',name:'客服小助手',templateIcon:'🤖',status:'online'},{id:'a2',name:'销售顾问',templateIcon:'💼',status:'offline'}]}));
7
+ return;
8
+ }
9
+ if (req.url === '/api/templates') { res.end(JSON.stringify([])); return; }
10
+ res.writeHead(200, {'Content-Type':'text/html; charset=utf-8'});
11
+ res.end(html);
12
+ });
13
+ srv.listen(4449, '0.0.0.0', () => console.log('Studio test server ready: http://localhost:4449'));
@@ -320,20 +320,6 @@ export class AgentRuntime {
320
320
  this.logger.info('Scheduler started');
321
321
  }
322
322
  this.logger.info('Agent started');
323
-
324
- // Auto-start Studio UI
325
- try {
326
- const { StudioServer } = require('../studio/server');
327
- const studioPort = 4000;
328
- const studio = new StudioServer({ port: studioPort, agentDir: process.cwd() });
329
- await studio.start();
330
- this.logger.info(`Studio UI ready → http://localhost:${studioPort}`);
331
- console.log(` Studio: http://localhost:${studioPort}`);
332
- } catch (e: any) {
333
- const msg = e?.message || String(e);
334
- this.logger.warn('Studio UI failed to start: ' + msg);
335
- console.log(` Studio: ⚠️ failed - ${msg}`);
336
- }
337
323
  }
338
324
 
339
325
  async stop(): Promise<void> {
package/srv-err.txt ADDED
File without changes
package/srv-out.txt ADDED
@@ -0,0 +1 @@
1
+ Studio test server ready: http://localhost:4449
@@ -0,0 +1,75 @@
1
+ const puppeteer = require('puppeteer-core');
2
+ (async () => {
3
+ const browser = await puppeteer.launch({executablePath: 'C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe', headless: true, args:['--no-sandbox']});
4
+ const page = await browser.newPage();
5
+ const errors = [];
6
+ page.on('pageerror', e => errors.push(e.message));
7
+ page.on('console', m => { if(m.type()==='error') errors.push(m.text()); });
8
+ await page.goto('http://localhost:4449', {waitUntil:'networkidle0', timeout:10000});
9
+
10
+ // Check sidebar structure
11
+ const sidebar = await page.evaluate(() => {
12
+ const items = document.querySelectorAll('.sidebar .nav-item, .sidebar .agent-list-item, .sidebar .sidebar-section-title');
13
+ return Array.from(items).map(el => el.textContent.trim().substring(0, 40));
14
+ });
15
+
16
+ // Check navigate
17
+ const navType = await page.evaluate(() => typeof navigate);
18
+
19
+ // Try global-models
20
+ const modelsResult = await page.evaluate(() => {
21
+ navigate('global-models');
22
+ const pages = document.querySelectorAll('.page');
23
+ for (const p of pages) {
24
+ if (p.style.display === 'block') return p.id;
25
+ }
26
+ return 'none-visible';
27
+ });
28
+
29
+ // Try create-group
30
+ const groupResult = await page.evaluate(() => {
31
+ navigate('create-group');
32
+ const pages = document.querySelectorAll('.page');
33
+ for (const p of pages) {
34
+ if (p.style.display === 'block') return p.id;
35
+ }
36
+ return 'none-visible';
37
+ });
38
+
39
+ // Check agent list
40
+ const agentList = await page.evaluate(() => {
41
+ const container = document.getElementById('sidebar-agent-list');
42
+ return container ? container.children.length + ' items' : 'NOT FOUND';
43
+ });
44
+
45
+ // Check groups list
46
+ const groupsList = await page.evaluate(() => {
47
+ const container = document.getElementById('groups-list');
48
+ return container ? container.innerHTML.substring(0, 100) : 'NOT FOUND';
49
+ });
50
+
51
+ // Try navigateToAgent
52
+ const agentDetail = await page.evaluate(() => {
53
+ if (typeof navigateToAgent === 'function') {
54
+ navigateToAgent('agent-1');
55
+ const pages = document.querySelectorAll('.page');
56
+ for (const p of pages) {
57
+ if (p.style.display === 'block') return p.id;
58
+ }
59
+ }
60
+ return typeof navigateToAgent;
61
+ });
62
+
63
+ console.log('=== Studio Test Results ===');
64
+ console.log('JS Errors:', errors.length ? errors.join('; ') : 'NONE');
65
+ console.log('Sidebar items:', JSON.stringify(sidebar, null, 2));
66
+ console.log('navigate type:', navType);
67
+ console.log('global-models:', modelsResult);
68
+ console.log('create-group:', groupResult);
69
+ console.log('agent list:', agentList);
70
+ console.log('groups list:', groupsList);
71
+ console.log('agent detail:', agentDetail);
72
+
73
+ await browser.close();
74
+ process.exit(0);
75
+ })().catch(e => { console.error('FAIL:', e.message); process.exit(1); });
@@ -0,0 +1,41 @@
1
+ const puppeteer = require('puppeteer-core');
2
+ (async () => {
3
+ const browser = await puppeteer.launch({executablePath: 'C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe', headless: true, args:['--no-sandbox']});
4
+ const page = await browser.newPage();
5
+ const errors = [];
6
+ page.on('pageerror', e => errors.push(e.message));
7
+ await page.goto('http://localhost:4449', {waitUntil:'networkidle0', timeout:10000});
8
+
9
+ const result = await page.evaluate(() => {
10
+ // Test create-group
11
+ navigate('create-group');
12
+ const el = document.getElementById('page-create-group');
13
+ if (!el) return 'page-create-group element NOT FOUND';
14
+ const hasActive = el.classList.contains('active');
15
+ const computedDisplay = window.getComputedStyle(el).display;
16
+ return `found=true, active=${hasActive}, display=${computedDisplay}`;
17
+ });
18
+
19
+ const result2 = await page.evaluate(() => {
20
+ navigate('global-models');
21
+ const el = document.getElementById('page-settings');
22
+ if (!el) return 'page-settings NOT FOUND';
23
+ return `active=${el.classList.contains('active')}, display=${window.getComputedStyle(el).display}`;
24
+ });
25
+
26
+ const result3 = await page.evaluate(() => {
27
+ // Check agent detail
28
+ navigateToAgent('a1');
29
+ const el = document.getElementById('page-agent-detail');
30
+ if (!el) return 'page-agent-detail NOT FOUND';
31
+ return `active=${el.classList.contains('active')}, display=${window.getComputedStyle(el).display}`;
32
+ });
33
+
34
+ console.log('JS errors:', errors.length ? errors : 'NONE');
35
+ console.log('create-group:', result);
36
+ console.log('global-models:', result2);
37
+ console.log('agent-detail:', result3);
38
+
39
+ await browser.close();
40
+ process.exit(0);
41
+ })().catch(e => { console.error('FAIL:', e.message); process.exit(1); });