pi-agent-browser-native 0.2.42 → 0.2.43
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/CHANGELOG.md +21 -0
- package/README.md +8 -8
- package/docs/COMMAND_REFERENCE.md +9 -10
- package/docs/SUPPORT_MATRIX.md +6 -5
- package/docs/TOOL_CONTRACT.md +27 -24
- package/extensions/agent-browser/index.ts +71 -2
- package/extensions/agent-browser/lib/input-modes/params.ts +1 -1
- package/extensions/agent-browser/lib/input-modes/types.ts +1 -1
- package/extensions/agent-browser/lib/navigation-policy.ts +95 -0
- package/extensions/agent-browser/lib/orchestration/browser-run/diagnostics.ts +2 -7
- package/extensions/agent-browser/lib/orchestration/browser-run/final-result.ts +1 -0
- package/extensions/agent-browser/lib/orchestration/browser-run/prepare.ts +2 -2
- package/extensions/agent-browser/lib/orchestration/browser-run/process-output.ts +103 -12
- package/extensions/agent-browser/lib/orchestration/browser-run/session-state.ts +20 -3
- package/extensions/agent-browser/lib/orchestration/browser-run/types.ts +6 -1
- package/extensions/agent-browser/lib/playbook.ts +4 -4
- package/extensions/agent-browser/lib/results/action-recommendations.ts +15 -0
- package/extensions/agent-browser/lib/results/contracts.ts +17 -0
- package/extensions/agent-browser/lib/results/network-routes.ts +80 -0
- package/extensions/agent-browser/lib/results/network.ts +10 -2
- package/extensions/agent-browser/lib/results/presentation/artifacts.ts +14 -0
- package/extensions/agent-browser/lib/results/presentation/batch.ts +36 -13
- package/extensions/agent-browser/lib/results/presentation/diagnostics.ts +154 -16
- package/extensions/agent-browser/lib/results/presentation/errors.ts +62 -2
- package/extensions/agent-browser/lib/results/presentation/semantic-action.ts +2 -4
- package/extensions/agent-browser/lib/results/presentation.ts +31 -1
- package/extensions/agent-browser/lib/results/selector-recovery.ts +11 -3
- package/extensions/agent-browser/lib/results/shared.ts +1 -0
- package/extensions/agent-browser/lib/results.ts +3 -0
- package/extensions/agent-browser/lib/runtime.ts +6 -0
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Responsibilities: Parse find/semantic action targets, match current snapshot refs, build public diagnostics, text, and safe nextActions.
|
|
4
4
|
* Scope: Selector recovery policy only; subprocess snapshot probing and result orchestration stay in the extension entrypoint.
|
|
5
5
|
* Usage: The extension entrypoint supplies command tokens plus snapshot data after a selector-not-found failure.
|
|
6
|
-
* Invariants/Assumptions:
|
|
6
|
+
* Invariants/Assumptions: Public fill recovery must never echo or auto-submit the user-provided fill text; guarded semanticAction fill pre-resolution may execute only one exact current editable ref.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { isRecord } from "../parsing.js";
|
|
@@ -199,14 +199,22 @@ export interface VisibleRefActionResolution {
|
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
export function resolveVisibleRefActionFromSnapshot(options: {
|
|
202
|
+
allowFill?: boolean;
|
|
202
203
|
compiledAction: SelectorRecoveryCompiledAction;
|
|
203
204
|
snapshotData: unknown;
|
|
204
205
|
}): VisibleRefActionResolution | undefined {
|
|
205
206
|
const target = getFindVisibleRefFallbackTarget(options.compiledAction.args, { allowLeadingDashFillText: true });
|
|
206
|
-
if (!target || target.action === "
|
|
207
|
+
if (!target || target.action === "select") return undefined;
|
|
207
208
|
const snapshot = extractRefSnapshotFromData(options.snapshotData);
|
|
208
209
|
if (!snapshot) return undefined;
|
|
209
|
-
const
|
|
210
|
+
const candidates = getVisibleRefFallbackCandidates(target, options.snapshotData);
|
|
211
|
+
if (target.action === "fill") {
|
|
212
|
+
if (!options.allowFill || candidates.length !== 1 || target.text === undefined) return undefined;
|
|
213
|
+
const [candidate] = candidates;
|
|
214
|
+
if (!candidate || candidate.editableEvidence === false || !EDITABLE_CONTROL_ROLES.has(candidate.role.toLowerCase())) return undefined;
|
|
215
|
+
return { args: ["fill", candidate.ref, target.text], snapshot };
|
|
216
|
+
}
|
|
217
|
+
const candidate = candidates.find((item) => item.args !== undefined);
|
|
210
218
|
if (!candidate?.args) return undefined;
|
|
211
219
|
return { args: candidate.args, snapshot };
|
|
212
220
|
}
|
|
@@ -13,6 +13,7 @@ export * from "./artifact-manifest.js";
|
|
|
13
13
|
export * from "./artifact-state.js";
|
|
14
14
|
export * from "./editable-ref-evidence.js";
|
|
15
15
|
export * from "./network.js";
|
|
16
|
+
export * from "./network-routes.js";
|
|
16
17
|
export * from "./next-actions.js";
|
|
17
18
|
export * from "./recovery-actions.js";
|
|
18
19
|
export * from "./recovery-next-actions.js";
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
export { getAgentBrowserErrorText, parseAgentBrowserEnvelope } from "./results/envelope.js";
|
|
10
10
|
export { buildToolPresentation } from "./results/presentation.js";
|
|
11
|
+
export { applyNetworkRouteRecords, buildNetworkRouteDiagnostics } from "./results/network-routes.js";
|
|
11
12
|
export {
|
|
12
13
|
buildAgentBrowserResultCategoryDetails,
|
|
13
14
|
classifyAgentBrowserFailureCategory,
|
|
@@ -30,6 +31,8 @@ export type {
|
|
|
30
31
|
AgentBrowserResultCategory,
|
|
31
32
|
AgentBrowserResultCategoryDetails,
|
|
32
33
|
AgentBrowserSuccessCategory,
|
|
34
|
+
NetworkRouteDiagnostic,
|
|
35
|
+
NetworkRouteRecord,
|
|
33
36
|
FileArtifactKind,
|
|
34
37
|
FileArtifactMetadata,
|
|
35
38
|
ToolPresentation,
|
|
@@ -355,6 +355,12 @@ export function redactInvocationArgs(args: string[]): string[] {
|
|
|
355
355
|
redacted[commandStartIndex + 4] = "[REDACTED]";
|
|
356
356
|
}
|
|
357
357
|
|
|
358
|
+
if (commandStartIndex !== undefined && args[commandStartIndex] === "clipboard" && args[commandStartIndex + 1] === "write") {
|
|
359
|
+
for (let index = commandStartIndex + 2; index < redacted.length; index += 1) {
|
|
360
|
+
redacted[index] = "[REDACTED]";
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
358
364
|
return redacted;
|
|
359
365
|
}
|
|
360
366
|
|
package/package.json
CHANGED