@proagentstore/cli 0.4.142 → 0.4.143
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.
|
@@ -262,9 +262,11 @@ export function parseLocalApplyResult(raw) {
|
|
|
262
262
|
const gateId = str(s.gateId, 100);
|
|
263
263
|
if (mode !== "auto_submit")
|
|
264
264
|
return { error: "a submitted outcome requires a run in auto_submit mode" };
|
|
265
|
-
if (!url || !isHttpUrl(url) || !at || Number.isNaN(Date.parse(at)) || !gateId)
|
|
265
|
+
if (!url || !isHttpUrl(url) || !traceUrl(url) || !at || Number.isNaN(Date.parse(at)) || !gateId)
|
|
266
266
|
return { error: "a submitted outcome needs the confirmed url, its time and the gateId" };
|
|
267
|
-
|
|
267
|
+
// A page URL kept as a fact keeps origin and path only, as a trace's does (#1069): a confirmation
|
|
268
|
+
// page's query can carry session or application tokens, and the receipt is the page, not its query.
|
|
269
|
+
out.submitted = { url: traceUrl(url), at, gateId };
|
|
268
270
|
out.submitAttempted = true;
|
|
269
271
|
}
|
|
270
272
|
// #975 — accepted ONLY as the closed vocabulary it declares. A runner that sends prose here gets
|
|
@@ -296,10 +298,10 @@ export function parseLocalApplyResult(raw) {
|
|
|
296
298
|
const reason = oneOf(LOCAL_APPLY_UNAVAILABLE_REASONS, evidence.reason);
|
|
297
299
|
const url = str(evidence.url, 2000);
|
|
298
300
|
const observedAt = str(evidence.observedAt, 40);
|
|
299
|
-
if (!reason || !url || !isHttpUrl(url) || !observedAt || Number.isNaN(Date.parse(observedAt)) || evidence.source !== "page_notice") {
|
|
301
|
+
if (!reason || !url || !isHttpUrl(url) || !traceUrl(url) || !observedAt || Number.isNaN(Date.parse(observedAt)) || evidence.source !== "page_notice") {
|
|
300
302
|
return { error: "a job_unavailable result needs runner-verified unavailable evidence (reason, url, observedAt, source)" };
|
|
301
303
|
}
|
|
302
|
-
out.unavailable = { reason, url, observedAt, source: "page_notice" };
|
|
304
|
+
out.unavailable = { reason, url: traceUrl(url), observedAt, source: "page_notice" };
|
|
303
305
|
}
|
|
304
306
|
else if (o.unavailable !== undefined)
|
|
305
307
|
return { error: "unavailable evidence is only valid for a job_unavailable result" };
|
|
@@ -122,6 +122,20 @@ export function redactDetail(detail, depth = 0, secrets = []) {
|
|
|
122
122
|
const str = (v, max) => (typeof v === "string" && v.trim() ? v.trim().slice(0, max) : null);
|
|
123
123
|
const isHttpUrl = (v) => /^https?:\/\/[^\s/]+/i.test(v);
|
|
124
124
|
const oneOf = (list, v) => (list.includes(v) ? v : null);
|
|
125
|
+
/**
|
|
126
|
+
* A page URL as a trace may keep it (#1069): origin and path — no query, no fragment, no credentials
|
|
127
|
+
* (`origin` never carries a `user:pass@`). The same rule as the local-apply contract's `traceUrl`;
|
|
128
|
+
* restated here because each vendored contract imports nothing. Empty when it is not an http(s) URL.
|
|
129
|
+
*/
|
|
130
|
+
export function traceUrl(raw) {
|
|
131
|
+
try {
|
|
132
|
+
const u = new URL(raw);
|
|
133
|
+
return u.protocol === "http:" || u.protocol === "https:" ? `${u.origin}${u.pathname}` : "";
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
return "";
|
|
137
|
+
}
|
|
138
|
+
}
|
|
125
139
|
/** A validated event, or null. */
|
|
126
140
|
export function parseLocalBrowserEvent(raw) {
|
|
127
141
|
if (!raw || typeof raw !== "object")
|
|
@@ -132,9 +146,14 @@ export function parseLocalBrowserEvent(raw) {
|
|
|
132
146
|
if (!type || !at || Number.isNaN(Date.parse(at)))
|
|
133
147
|
return null;
|
|
134
148
|
const event = { type, at };
|
|
149
|
+
// Origin and path only (#1069): a research trace keeps where the browser went, never a page's query
|
|
150
|
+
// or fragment — a sign-in page's OAuth state/nonce/PKCE values or a session id ride there.
|
|
135
151
|
const url = str(o.url, 2000);
|
|
136
|
-
if (url && isHttpUrl(url))
|
|
137
|
-
|
|
152
|
+
if (url && isHttpUrl(url)) {
|
|
153
|
+
const kept = traceUrl(url);
|
|
154
|
+
if (kept)
|
|
155
|
+
event.url = kept;
|
|
156
|
+
}
|
|
138
157
|
const domain = str(o.domain, 253);
|
|
139
158
|
if (domain)
|
|
140
159
|
event.domain = domain.toLowerCase();
|
|
@@ -27,7 +27,7 @@ import { RunnerInputError } from "../errors.js";
|
|
|
27
27
|
import { BrowserBridge, domainWithin } from "./bridge.js";
|
|
28
28
|
import { SCOUT_SHOT_CAP, ShotRecorder } from "./replay.js";
|
|
29
29
|
import { BRIDGE_ENV } from "./bridge-stdio.js";
|
|
30
|
-
import { LOCAL_BROWSER_AUTH_MODES, LOCAL_BROWSER_ENGINES, LOCAL_BROWSER_TASK_TYPE, redactDetail, redactFinding, redactSourceFailure, redactText, secretEnvValues, } from "./contract.js";
|
|
30
|
+
import { LOCAL_BROWSER_AUTH_MODES, LOCAL_BROWSER_ENGINES, LOCAL_BROWSER_TASK_TYPE, redactDetail, redactFinding, redactSourceFailure, redactText, secretEnvValues, traceUrl, } from "./contract.js";
|
|
31
31
|
import { bridgeUnused, buildEngineSpec, finalText, missingLogin, observedEngineAuth, researchPrompt, signInHelp } from "./engine.js";
|
|
32
32
|
/**
|
|
33
33
|
* Why the run could not be launched, in words the owner can act on (#944).
|
|
@@ -303,9 +303,11 @@ export class LocalBrowserRuntime {
|
|
|
303
303
|
emit(run, ev) {
|
|
304
304
|
if (run.events.length >= MAX_EVENTS)
|
|
305
305
|
return;
|
|
306
|
-
|
|
306
|
+
// Origin and path only, before anything leaves the machine (#1069) — the cloud reduces it again.
|
|
307
|
+
const { detail: raw, url: rawUrl, ...rest } = ev;
|
|
308
|
+
const url = rawUrl ? traceUrl(rawUrl) : "";
|
|
307
309
|
const detail = redactDetail(raw, 0, run.secrets);
|
|
308
|
-
run.events.push({ ...rest, ...(detail && Object.keys(detail).length ? { detail } : {}), at: new Date(this.now()).toISOString(), seq: ++run.seq });
|
|
310
|
+
run.events.push({ ...rest, ...(url ? { url } : {}), ...(detail && Object.keys(detail).length ? { detail } : {}), at: new Date(this.now()).toISOString(), seq: ++run.seq });
|
|
309
311
|
}
|
|
310
312
|
pause(run, reason, detail) {
|
|
311
313
|
if (run.state === "ended" || run.cancelled)
|