@xcanwin/manyoyo 6.1.1 → 6.2.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.
@@ -0,0 +1,49 @@
1
+ (function () {
2
+ function isNearBottom(scrollTop, scrollHeight, clientHeight, thresholdPx) {
3
+ const threshold = Number.isFinite(thresholdPx) ? thresholdPx : 40;
4
+ const distance = scrollHeight - (scrollTop + clientHeight);
5
+ return distance <= threshold;
6
+ }
7
+
8
+ function summarizeTraceFlow(traceEvents, options) {
9
+ const events = Array.isArray(traceEvents) ? traceEvents : [];
10
+ const count = events.length;
11
+ if (count === 0) {
12
+ return { count: 0, label: '暂无步骤' };
13
+ }
14
+ const opts = options && typeof options === 'object' ? options : {};
15
+ const hasError = events.some(event => event && event.kind === 'error');
16
+ const status = hasError ? '有错误' : (opts.pending === true ? '进行中' : '已完成');
17
+ return { count, label: `${count} 步 · ${status}` };
18
+ }
19
+
20
+ function buildDocumentTitle(agentName) {
21
+ const trimmed = String(agentName || '').trim();
22
+ return trimmed ? `${trimmed} · MANYOYO Web` : 'MANYOYO Web';
23
+ }
24
+
25
+ function mergeTraceIntoReply(messages) {
26
+ const list = Array.isArray(messages) ? messages : [];
27
+ const result = [];
28
+ for (let i = 0; i < list.length; i += 1) {
29
+ const msg = list[i];
30
+ if (msg && msg.streamTrace) {
31
+ const next = list[i + 1];
32
+ if (next && next.role === 'assistant' && !next.streamTrace) {
33
+ result.push(Object.assign({}, next, { timestamp: msg.timestamp, pairedTrace: msg }));
34
+ i += 1;
35
+ continue;
36
+ }
37
+ }
38
+ result.push(msg);
39
+ }
40
+ return result;
41
+ }
42
+
43
+ window.ManyoyoChatBehavior = {
44
+ isNearBottom,
45
+ summarizeTraceFlow,
46
+ buildDocumentTitle,
47
+ mergeTraceIntoReply
48
+ };
49
+ }());
package/lib/web/server.js CHANGED
@@ -4590,6 +4590,7 @@ async function startWebServer(options) {
4590
4590
  || assetName === 'app.js'
4591
4591
  || assetName === 'markdown.css'
4592
4592
  || assetName === 'markdown-renderer.js'
4593
+ || assetName === 'chat-behavior.js'
4593
4594
  || assetName === 'file-browser.js'
4594
4595
  || assetName === 'codemirror.bundle.js')) {
4595
4596
  sendHtml(res, 404, '<h1>404 Not Found</h1>');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xcanwin/manyoyo",
3
- "version": "6.1.1",
3
+ "version": "6.2.0",
4
4
  "imageVersion": "1.9.1-common",
5
5
  "playwrightCliVersion": "0.1.18",
6
6
  "description": "AI Agent CLI Security Sandbox for Docker and Podman",