gm-plugkit 2.0.1305 → 2.0.1306
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/plugkit-wasm-wrapper.js +33 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gm-plugkit",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1306",
|
|
4
4
|
"description": "Bootstrap and daemon-spawn tool for gm plugkit binary. Downloads the correct platform binary, verifies SHA256, and starts the spool watcher daemon. Includes plugkit-wasm-wrapper for WASM-based spool watching.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
package/plugkit-wasm-wrapper.js
CHANGED
|
@@ -381,7 +381,18 @@ function emitOrchestratorEvents(verb, taskBase, resultStr) {
|
|
|
381
381
|
if (verb === 'prd-resolve' && errData && errData.deviation_kind === 'prd-resolve-unknown-id') {
|
|
382
382
|
logEvent('hook', 'deviation.prd-resolve-unknown-id', { task: taskBase, prd_id: errData.prd_id, reason: errData.error });
|
|
383
383
|
}
|
|
384
|
-
|
|
384
|
+
const reason = (parsed && (parsed.reason || parsed.error)) ||
|
|
385
|
+
(parsed && parsed.data && (parsed.data.reason || parsed.data.error)) ||
|
|
386
|
+
(errData && (errData.reason || errData.error)) ||
|
|
387
|
+
(parsed && parsed.stderr) ||
|
|
388
|
+
'unknown';
|
|
389
|
+
logEvent('plugkit', 'orchestrator.error', {
|
|
390
|
+
verb,
|
|
391
|
+
task: taskBase,
|
|
392
|
+
error: String(reason).slice(0, 500),
|
|
393
|
+
gate_denied: !!(parsed && parsed.gate_denied),
|
|
394
|
+
next_dispatch: parsed && parsed.next_dispatch || null,
|
|
395
|
+
});
|
|
385
396
|
return;
|
|
386
397
|
}
|
|
387
398
|
const data = parsed.data || {};
|
|
@@ -847,8 +858,27 @@ function getOrCreateBrowserSession(cwd, claudeSessionId, pw) {
|
|
|
847
858
|
}
|
|
848
859
|
cleanDeadProfileFragments(cwd);
|
|
849
860
|
const profileDir = acquireProfileDir(cwd);
|
|
850
|
-
|
|
851
|
-
|
|
861
|
+
const aliveCdpForProfile = (() => {
|
|
862
|
+
for (const key of Object.keys(ports)) {
|
|
863
|
+
const ent = ports[key];
|
|
864
|
+
if (!ent || !ent.pid || !ent.port || !ent.wsEndpoint) continue;
|
|
865
|
+
if (ent.profileDir !== profileDir && !(ent.profileDir || '').startsWith(profileDir)) continue;
|
|
866
|
+
if (!isProcessAliveSync(ent.pid)) continue;
|
|
867
|
+
const info = fetchJsonSync(`http://127.0.0.1:${ent.port}/json/version`, 1000);
|
|
868
|
+
if (info && info.webSocketDebuggerUrl) {
|
|
869
|
+
return { pid: ent.pid, port: ent.port, wsEndpoint: ent.wsEndpoint };
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
return null;
|
|
873
|
+
})();
|
|
874
|
+
let browserPid, port, wsEndpoint;
|
|
875
|
+
if (aliveCdpForProfile) {
|
|
876
|
+
({ pid: browserPid, port, wsEndpoint } = aliveCdpForProfile);
|
|
877
|
+
logEvent('plugkit', 'browser.reused-existing-chromium', { pid: browserPid, port, profileDir });
|
|
878
|
+
} else {
|
|
879
|
+
logEvent('plugkit', 'browser.start', { profileDir });
|
|
880
|
+
({ pid: browserPid, port, wsEndpoint } = startManagedBrowser(pw, profileDir));
|
|
881
|
+
}
|
|
852
882
|
const r = runBrowserRunner(pw, ['session', 'new', '--direct', wsEndpoint], 30000);
|
|
853
883
|
if (!r || r.status !== 0) {
|
|
854
884
|
const errTxt = scrubBrowserRunnerText((r && (r.stderr || r.stdout)) || 'unknown');
|