@pdpp/local-collector 0.18.2 → 0.18.3
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.
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const COLLECTOR_BUILD_SOURCE_SENTINEL = "source";
|
|
2
2
|
const COLLECTOR_BUILD_INFO = {
|
|
3
|
-
builtAt: "2026-06-26T09:
|
|
4
|
-
revision: "
|
|
5
|
-
version: "0.18.
|
|
3
|
+
builtAt: "2026-06-26T09:42:50.991Z",
|
|
4
|
+
revision: "25f16cff9bb5",
|
|
5
|
+
version: "0.18.3",
|
|
6
6
|
};
|
|
7
7
|
function buildAgentVersion(info = COLLECTOR_BUILD_INFO) {
|
|
8
8
|
return `${info.version}+${info.revision}`;
|
|
@@ -399,10 +399,10 @@ async function runInBrowser(args) {
|
|
|
399
399
|
page,
|
|
400
400
|
});
|
|
401
401
|
await watchdog.run(() => establishSession({ ensureSession, probeSession }, {
|
|
402
|
-
assist,
|
|
402
|
+
assist: watchdog.wrapAssist(assist),
|
|
403
403
|
capture: baseCtx.capture,
|
|
404
404
|
checkpoint: watchdog.checkpoint,
|
|
405
|
-
completeAssistance,
|
|
405
|
+
completeAssistance: watchdog.wrapCompleteAssistance(completeAssistance),
|
|
406
406
|
context: ctx,
|
|
407
407
|
page: page,
|
|
408
408
|
name,
|
|
@@ -798,6 +798,7 @@ export function makeSessionEstablishWatchdog(args) {
|
|
|
798
798
|
const pollIntervalMs = args.pollIntervalMs ?? Math.max(1, Math.min(1000, Math.floor(deadlineMs / 4)));
|
|
799
799
|
let lastProgressAt = now();
|
|
800
800
|
let lastLabel = null;
|
|
801
|
+
const openAssistance = new Map();
|
|
801
802
|
let openInteractions = 0;
|
|
802
803
|
let tripped = false;
|
|
803
804
|
const markProgress = (label) => {
|
|
@@ -816,6 +817,43 @@ export function makeSessionEstablishWatchdog(args) {
|
|
|
816
817
|
process.stderr.write(`[session-watchdog] checkpoint capture failed for ${label}: ${message}\n`);
|
|
817
818
|
}
|
|
818
819
|
};
|
|
820
|
+
const assistancePausesWatchdog = (req) => req.progress_posture === "running" && req.response_contract === "none";
|
|
821
|
+
const pruneExpiredAssistance = () => {
|
|
822
|
+
const current = now();
|
|
823
|
+
let pruned = false;
|
|
824
|
+
for (const [id, expiresAt] of openAssistance) {
|
|
825
|
+
if (expiresAt > current) {
|
|
826
|
+
continue;
|
|
827
|
+
}
|
|
828
|
+
openAssistance.delete(id);
|
|
829
|
+
pruned = true;
|
|
830
|
+
}
|
|
831
|
+
if (pruned) {
|
|
832
|
+
markProgress(null);
|
|
833
|
+
}
|
|
834
|
+
};
|
|
835
|
+
const wrapAssist = (assist) => async (req) => {
|
|
836
|
+
markProgress(null);
|
|
837
|
+
const assistanceRequestId = await assist(req);
|
|
838
|
+
if (assistancePausesWatchdog(req)) {
|
|
839
|
+
const timeoutMs = typeof req.timeout_seconds === "number" && Number.isFinite(req.timeout_seconds) && req.timeout_seconds > 0
|
|
840
|
+
? req.timeout_seconds * 1000
|
|
841
|
+
: deadlineMs;
|
|
842
|
+
openAssistance.set(assistanceRequestId, now() + timeoutMs + deadlineMs);
|
|
843
|
+
markProgress(null);
|
|
844
|
+
}
|
|
845
|
+
return assistanceRequestId;
|
|
846
|
+
};
|
|
847
|
+
const wrapCompleteAssistance = (completeAssistance) => async (assistanceRequestId, status, extra = {}) => {
|
|
848
|
+
try {
|
|
849
|
+
await completeAssistance(assistanceRequestId, status, extra);
|
|
850
|
+
}
|
|
851
|
+
finally {
|
|
852
|
+
if (openAssistance.delete(assistanceRequestId)) {
|
|
853
|
+
markProgress(null);
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
};
|
|
819
857
|
const wrapSendInteraction = (send) => async (req) => {
|
|
820
858
|
openInteractions++;
|
|
821
859
|
markProgress(null);
|
|
@@ -833,7 +871,8 @@ export function makeSessionEstablishWatchdog(args) {
|
|
|
833
871
|
const TRIP = Symbol("session-establish-trip");
|
|
834
872
|
const tripPromise = new Promise((resolve) => {
|
|
835
873
|
const onTick = () => {
|
|
836
|
-
|
|
874
|
+
pruneExpiredAssistance();
|
|
875
|
+
if (tripped || openInteractions > 0 || openAssistance.size > 0) {
|
|
837
876
|
return;
|
|
838
877
|
}
|
|
839
878
|
const sinceMs = now() - lastProgressAt;
|
|
@@ -868,7 +907,7 @@ export function makeSessionEstablishWatchdog(args) {
|
|
|
868
907
|
}
|
|
869
908
|
}
|
|
870
909
|
};
|
|
871
|
-
return { checkpoint, wrapSendInteraction, run };
|
|
910
|
+
return { checkpoint, wrapAssist, wrapCompleteAssistance, wrapSendInteraction, run };
|
|
872
911
|
}
|
|
873
912
|
async function establishSession(hooks, args) {
|
|
874
913
|
const { ensureSession, probeSession } = hooks;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pdpp/local-collector",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.3",
|
|
4
4
|
"description": "Publishable local collector runtime for PDPP: filesystem-class connectors (Claude Code, Codex) plus the device-exporter ingest client.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|