gm-oc 2.0.376 → 2.0.377
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/package.json +1 -1
- package/skills/browser/SKILL.md +52 -0
package/package.json
CHANGED
package/skills/browser/SKILL.md
CHANGED
|
@@ -74,6 +74,58 @@ exec:browser
|
|
|
74
74
|
console.log(JSON.stringify(state.consoleMsgs))
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
+
### Web Worker Console Monitoring
|
|
78
|
+
|
|
79
|
+
Capture console output from Dedicated Web Workers (e.g. game server workers):
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
exec:browser
|
|
83
|
+
state.workerMsgs = []
|
|
84
|
+
// Capture from already-spawned workers
|
|
85
|
+
for (const w of page.workers()) {
|
|
86
|
+
w.evaluate(() => {
|
|
87
|
+
const orig = console.log.bind(console)
|
|
88
|
+
console.log = (...a) => { orig(...a); self.postMessage({ __log: a.map(String).join(' ') }) }
|
|
89
|
+
}).catch(() => {})
|
|
90
|
+
}
|
|
91
|
+
// Capture from workers spawned after this point
|
|
92
|
+
page.on('worker', w => {
|
|
93
|
+
state.workerMsgs.push('[worker attached] ' + w.url())
|
|
94
|
+
w.evaluate(() => {
|
|
95
|
+
const orig = console.log.bind(console)
|
|
96
|
+
console.log = (...a) => { orig(...a); self.postMessage({ __log: a.map(String).join(' ') }) }
|
|
97
|
+
}).catch(() => {})
|
|
98
|
+
})
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
exec:browser
|
|
103
|
+
// List all active workers and their URLs
|
|
104
|
+
const workers = page.workers()
|
|
105
|
+
console.log('Workers:', workers.length, workers.map(w => w.url()).join(', '))
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
exec:browser
|
|
110
|
+
// Evaluate JS inside the first worker
|
|
111
|
+
const result = await page.workers()[0].evaluate(() => typeof self.someGlobal)
|
|
112
|
+
console.log(result)
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Inject Global Debug State into Page
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
exec:browser
|
|
119
|
+
const result = await page.evaluate(() => {
|
|
120
|
+
// Access app globals exposed on window
|
|
121
|
+
return JSON.stringify({
|
|
122
|
+
entityCount: window.debug?.scene?.children?.length,
|
|
123
|
+
playerId: window.debug?.client?.playerId
|
|
124
|
+
})
|
|
125
|
+
})
|
|
126
|
+
console.log(result)
|
|
127
|
+
```
|
|
128
|
+
|
|
77
129
|
## Key Rules
|
|
78
130
|
|
|
79
131
|
**Only `exec:browser`** — never run any browser CLI tool directly via Bash.
|