@xcanwin/manyoyo 5.8.9 → 5.8.10
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/bin/manyoyo.js +24 -66
- package/lib/plugin/playwright.js +1049 -169
- package/lib/web/server.js +2173 -209
- package/package.json +1 -1
- package/lib/plugin/playwright-bootstrap.js +0 -116
- package/lib/plugin/playwright-command-output.js +0 -95
- package/lib/plugin/playwright-container-runtime.js +0 -94
- package/lib/plugin/playwright-extension-manager.js +0 -265
- package/lib/plugin/playwright-extension-paths.js +0 -98
- package/lib/plugin/playwright-host-runtime.js +0 -114
- package/lib/plugin/playwright-scene-config.js +0 -137
- package/lib/plugin/playwright-scene-drivers.js +0 -285
- package/lib/plugin/playwright-scene-state.js +0 -80
- package/lib/web/agent-command.js +0 -153
- package/lib/web/api-route-helpers.js +0 -88
- package/lib/web/container-exec.js +0 -215
- package/lib/web/http-handlers.js +0 -163
- package/lib/web/runtime-state.js +0 -50
- package/lib/web/server-context.js +0 -71
- package/lib/web/server-lifecycle.js +0 -129
- package/lib/web/session-api-routes.js +0 -390
- package/lib/web/structured-output.js +0 -149
- package/lib/web/structured-trace.js +0 -603
- package/lib/web/system-api-routes.js +0 -114
- package/lib/web/terminal-session.js +0 -205
- package/lib/web/upgrade-handler.js +0 -94
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function parseJsonObjectLine(line) {
|
|
4
|
-
const text = String(line || '').trim();
|
|
5
|
-
if (!text) {
|
|
6
|
-
return null;
|
|
7
|
-
}
|
|
8
|
-
try {
|
|
9
|
-
const payload = JSON.parse(text);
|
|
10
|
-
return payload && typeof payload === 'object' ? payload : null;
|
|
11
|
-
} catch (e) {
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function collectStructuredText(value) {
|
|
17
|
-
if (typeof value === 'string') {
|
|
18
|
-
return value.trim();
|
|
19
|
-
}
|
|
20
|
-
if (Array.isArray(value)) {
|
|
21
|
-
return value.map(item => collectStructuredText(item)).filter(Boolean).join('\n').trim();
|
|
22
|
-
}
|
|
23
|
-
if (!value || typeof value !== 'object') {
|
|
24
|
-
return '';
|
|
25
|
-
}
|
|
26
|
-
if (typeof value.text === 'string' && value.text.trim()) {
|
|
27
|
-
return value.text.trim();
|
|
28
|
-
}
|
|
29
|
-
if (typeof value.content === 'string' && value.content.trim()) {
|
|
30
|
-
return value.content.trim();
|
|
31
|
-
}
|
|
32
|
-
if (Array.isArray(value.content)) {
|
|
33
|
-
return value.content.map(item => collectStructuredText(item)).filter(Boolean).join('\n').trim();
|
|
34
|
-
}
|
|
35
|
-
return '';
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function createStructuredOutputHelpers(deps) {
|
|
39
|
-
const {
|
|
40
|
-
pickFirstString,
|
|
41
|
-
toPlainObject,
|
|
42
|
-
extractAgentMessageFromCodexJsonl
|
|
43
|
-
} = deps;
|
|
44
|
-
|
|
45
|
-
function extractClaudeAgentMessage(text) {
|
|
46
|
-
let lastMessage = '';
|
|
47
|
-
for (const rawLine of String(text || '').split('\n')) {
|
|
48
|
-
const payload = parseJsonObjectLine(rawLine);
|
|
49
|
-
if (!payload || payload.type !== 'assistant') {
|
|
50
|
-
continue;
|
|
51
|
-
}
|
|
52
|
-
const message = toPlainObject(payload.message);
|
|
53
|
-
const content = Array.isArray(message.content) ? message.content : [];
|
|
54
|
-
const nextMessage = content
|
|
55
|
-
.filter(item => item && typeof item === 'object' && item.type === 'text')
|
|
56
|
-
.map(item => collectStructuredText(item))
|
|
57
|
-
.filter(Boolean)
|
|
58
|
-
.join('\n')
|
|
59
|
-
.trim();
|
|
60
|
-
if (nextMessage) {
|
|
61
|
-
lastMessage = nextMessage;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
return lastMessage.trim();
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function extractGeminiAgentMessage(text) {
|
|
68
|
-
let lastMessage = '';
|
|
69
|
-
let deltaMessage = '';
|
|
70
|
-
for (const rawLine of String(text || '').split('\n')) {
|
|
71
|
-
const payload = parseJsonObjectLine(rawLine);
|
|
72
|
-
if (!payload || payload.type !== 'message' || payload.role !== 'assistant') {
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
const content = collectStructuredText(payload.content);
|
|
76
|
-
if (!content) {
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
if (payload.delta === true) {
|
|
80
|
-
deltaMessage += content;
|
|
81
|
-
lastMessage = deltaMessage.trim();
|
|
82
|
-
continue;
|
|
83
|
-
}
|
|
84
|
-
deltaMessage = '';
|
|
85
|
-
lastMessage = content;
|
|
86
|
-
}
|
|
87
|
-
return lastMessage.trim();
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function extractOpenCodeAgentMessage(text) {
|
|
91
|
-
let lastMessage = '';
|
|
92
|
-
let deltaMessage = '';
|
|
93
|
-
for (const rawLine of String(text || '').split('\n')) {
|
|
94
|
-
const payload = parseJsonObjectLine(rawLine);
|
|
95
|
-
if (!payload) {
|
|
96
|
-
continue;
|
|
97
|
-
}
|
|
98
|
-
const eventType = pickFirstString(payload.type);
|
|
99
|
-
const message = toPlainObject(payload.message);
|
|
100
|
-
const role = pickFirstString(payload.role, message.role);
|
|
101
|
-
if (eventType !== 'message' && eventType !== 'assistant' && eventType !== 'assistant_message' && eventType !== 'text') {
|
|
102
|
-
continue;
|
|
103
|
-
}
|
|
104
|
-
if (role && role !== 'assistant') {
|
|
105
|
-
continue;
|
|
106
|
-
}
|
|
107
|
-
const content = collectStructuredText(message.content || payload.content || payload.text || payload);
|
|
108
|
-
if (!content) {
|
|
109
|
-
continue;
|
|
110
|
-
}
|
|
111
|
-
if (payload.delta === true) {
|
|
112
|
-
deltaMessage += content;
|
|
113
|
-
lastMessage = deltaMessage.trim();
|
|
114
|
-
continue;
|
|
115
|
-
}
|
|
116
|
-
deltaMessage = '';
|
|
117
|
-
lastMessage = content;
|
|
118
|
-
}
|
|
119
|
-
return lastMessage.trim();
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
function extractAgentMessageFromStructuredOutput(agentProgram, text) {
|
|
123
|
-
if (agentProgram === 'codex') {
|
|
124
|
-
return extractAgentMessageFromCodexJsonl(text);
|
|
125
|
-
}
|
|
126
|
-
if (agentProgram === 'claude') {
|
|
127
|
-
return extractClaudeAgentMessage(text);
|
|
128
|
-
}
|
|
129
|
-
if (agentProgram === 'gemini') {
|
|
130
|
-
return extractGeminiAgentMessage(text);
|
|
131
|
-
}
|
|
132
|
-
if (agentProgram === 'opencode') {
|
|
133
|
-
return extractOpenCodeAgentMessage(text);
|
|
134
|
-
}
|
|
135
|
-
return '';
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
return {
|
|
139
|
-
parseJsonObjectLine,
|
|
140
|
-
collectStructuredText,
|
|
141
|
-
extractAgentMessageFromStructuredOutput
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
module.exports = {
|
|
146
|
-
parseJsonObjectLine,
|
|
147
|
-
collectStructuredText,
|
|
148
|
-
createStructuredOutputHelpers
|
|
149
|
-
};
|