@aiyiran/myclaw 1.1.148 → 1.1.150
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/assets/debug-probe.js +12 -2
- package/assets/myclaw-inject.js +0 -3
- package/package.json +1 -1
package/assets/debug-probe.js
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
window.__OPENCLAW_DEBUG_PROBE_INSTALLED__ = true;
|
|
21
21
|
|
|
22
|
-
const PROBE_VERSION = "
|
|
22
|
+
const PROBE_VERSION = "probe_003";
|
|
23
23
|
const MAX_TEXT_LENGTH = 1000;
|
|
24
24
|
const MAX_STACK_LENGTH = 3000;
|
|
25
25
|
const MAX_ELEMENT_TEXT_LENGTH = 80;
|
|
@@ -135,6 +135,13 @@
|
|
|
135
135
|
};
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
+
const _isInIframe = (function () {
|
|
139
|
+
try { return window.parent !== window; } catch (e) { return false; }
|
|
140
|
+
})();
|
|
141
|
+
|
|
142
|
+
// 保存原始 console.log,防止 probe 覆盖后造成递归
|
|
143
|
+
const _nativeLog = console.log.bind(console);
|
|
144
|
+
|
|
138
145
|
function sendEvent(type, payload) {
|
|
139
146
|
const event = {
|
|
140
147
|
type,
|
|
@@ -145,7 +152,7 @@
|
|
|
145
152
|
};
|
|
146
153
|
|
|
147
154
|
try {
|
|
148
|
-
if (
|
|
155
|
+
if (_isInIframe) {
|
|
149
156
|
window.parent.postMessage(
|
|
150
157
|
{
|
|
151
158
|
source: "OPENCLAW_DEBUG_PROBE",
|
|
@@ -154,6 +161,9 @@
|
|
|
154
161
|
},
|
|
155
162
|
"*"
|
|
156
163
|
);
|
|
164
|
+
} else {
|
|
165
|
+
// 独立页面模式:直接打到控制台,方便本地调试
|
|
166
|
+
_nativeLog("[PROBE]", type, payload);
|
|
157
167
|
}
|
|
158
168
|
} catch (error) {
|
|
159
169
|
// 不让 probe 影响学生作品运行
|
package/assets/myclaw-inject.js
CHANGED