pi-agent-browser-native 0.2.61 → 0.2.63
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 +34 -0
- package/README.md +10 -10
- package/dist/extensions/agent-browser/index.js +51 -30
- package/dist/extensions/agent-browser/lib/argv-descriptor.js +6 -3
- package/dist/extensions/agent-browser/lib/argv-grammar.js +29 -1
- package/dist/extensions/agent-browser/lib/command-policy.js +10 -1
- package/dist/extensions/agent-browser/lib/command-taxonomy.js +7 -0
- package/dist/extensions/agent-browser/lib/input-modes/lookups.js +5 -2
- package/dist/extensions/agent-browser/lib/input-modes/params.js +2 -1
- package/dist/extensions/agent-browser/lib/launch-scoped-flags.js +25 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/click-dispatch.js +4 -3
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/diagnostics.js +25 -17
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result.js +14 -11
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/index.js +3 -2
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/direct-anchor-download.js +2 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/network-page-filter.js +3 -3
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/scroll-shims.js +5 -4
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-filter.js +4 -4
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare.js +43 -27
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output.js +66 -54
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state.js +24 -15
- package/dist/extensions/agent-browser/lib/playbook.js +4 -4
- package/dist/extensions/agent-browser/lib/process.js +3 -3
- package/dist/extensions/agent-browser/lib/results/next-actions.js +19 -1
- package/dist/extensions/agent-browser/lib/results/presentation/batch.js +8 -7
- package/dist/extensions/agent-browser/lib/results/presentation.js +2 -1
- package/dist/extensions/agent-browser/lib/runtime.js +62 -10
- package/dist/extensions/agent-browser/lib/session-page-state.js +14 -7
- package/docs/ARCHITECTURE.md +5 -5
- package/docs/COMMAND_REFERENCE.md +65 -23
- package/docs/SUPPORT_MATRIX.md +15 -13
- package/docs/TOOL_CONTRACT.md +20 -20
- package/package.json +1 -1
- package/scripts/agent-browser-capability-baseline.mjs +36 -4
- package/scripts/platform-smoke/browser-dogfood-windows.ps1 +53 -10
- package/scripts/platform-smoke/doctor.mjs +67 -0
- package/scripts/platform-smoke/targets.mjs +2 -0
- package/scripts/platform-smoke.mjs +2 -4
|
@@ -10,11 +10,12 @@ import { trySnapshotFilter } from "./prepare/snapshot-filter.js";
|
|
|
10
10
|
import { getWaitAwareProcessTimeoutMs } from "./prepare/wait-timeouts.js";
|
|
11
11
|
import { getPersistentSessionArtifactStore } from "./session-artifacts.js";
|
|
12
12
|
import { buildAgentBrowserResultCategoryDetails } from "../../results.js";
|
|
13
|
+
import { applyNamespaceToNextActions } from "../../results/next-actions.js";
|
|
13
14
|
import { buildSessionAwareStaleRefNextActions, buildSessionTabRecoveryNextActions } from "../../results/recovery-next-actions.js";
|
|
14
15
|
import { resolveVisibleRefActionFromSnapshot } from "../../results/selector-recovery.js";
|
|
15
16
|
import { extractRefSnapshotFromData } from "../../session-page-state.js";
|
|
16
17
|
import { buildExecutionPlan, createFreshSessionName, extractCommandTokens, redactInvocationArgs, } from "../../runtime.js";
|
|
17
|
-
import { applyOpenResultTabCorrection, buildManagedSessionOutcome, buildPinnedBatchPlan, buildSessionDetailFields, buildStaleRefPreflight, collectSessionTabSelection, getGuardedRefUsage, getTraceOwnerGuardMessage, runSessionCommandData, shouldPinSessionTabForCommand, } from "./session-state.js";
|
|
18
|
+
import { applyOpenResultTabCorrection, buildManagedSessionOutcome, buildPinnedBatchPlan, buildSessionDetailFields, buildStaleRefPreflight, getSessionContextKey, collectSessionTabSelection, getGuardedRefUsage, getTraceOwnerGuardMessage, runSessionCommandData, shouldPinSessionTabForCommand, } from "./session-state.js";
|
|
18
19
|
import { parseBatchStdinJsonArray } from "../batch-stdin.js";
|
|
19
20
|
import { buildElectronHostFailureResult, getElectronLaunchFailureCategory, redactRecoveryHint } from "./final-result.js";
|
|
20
21
|
import { prepareClickDispatchProbe } from "./click-dispatch.js";
|
|
@@ -242,7 +243,7 @@ async function collectSamePageRefFreshnessPreflight(options) {
|
|
|
242
243
|
const currentTargetUrl = options.currentTarget?.url;
|
|
243
244
|
if (currentTargetUrl === "about:blank" || (previousUrl && currentTargetUrl && previousUrl !== currentTargetUrl))
|
|
244
245
|
return undefined;
|
|
245
|
-
const snapshotData = await runSessionCommandData({ args: ["snapshot", "-i"], cwd: options.cwd, sessionName: options.sessionName, signal: options.signal });
|
|
246
|
+
const snapshotData = await runSessionCommandData({ args: ["snapshot", "-i"], cwd: options.cwd, namespace: options.namespace, sessionName: options.sessionName, signal: options.signal });
|
|
246
247
|
const currentSnapshot = extractRefSnapshotFromData(snapshotData);
|
|
247
248
|
if (!currentSnapshot)
|
|
248
249
|
return undefined;
|
|
@@ -280,7 +281,7 @@ export function validateStdinCommandContract(options) {
|
|
|
280
281
|
export async function resolveSemanticActionVisibleRefArgs(options) {
|
|
281
282
|
if (!options.compiled || !options.sessionName || options.compiled.locator !== "role" || !["check", "click", "fill"].includes(options.compiled.action))
|
|
282
283
|
return undefined;
|
|
283
|
-
const snapshotData = await runSessionCommandData({ args: ["snapshot", "-i"], cwd: options.cwd, sessionName: options.sessionName, signal: options.signal });
|
|
284
|
+
const snapshotData = await runSessionCommandData({ args: ["snapshot", "-i"], cwd: options.cwd, namespace: options.namespace, sessionName: options.sessionName, signal: options.signal });
|
|
284
285
|
const resolution = resolveVisibleRefActionFromSnapshot({ allowFill: true, compiledAction: options.compiled, snapshotData });
|
|
285
286
|
if (!resolution)
|
|
286
287
|
return undefined;
|
|
@@ -328,6 +329,7 @@ export async function prepareBrowserRun(options) {
|
|
|
328
329
|
freshSessionName,
|
|
329
330
|
managedSessionActive: state.managedSessionActive,
|
|
330
331
|
managedSessionName: state.managedSessionName,
|
|
332
|
+
managedSessionNamespace: state.managedSessionNamespace,
|
|
331
333
|
sessionMode,
|
|
332
334
|
});
|
|
333
335
|
let semanticActionVisibleRefResolution;
|
|
@@ -335,6 +337,7 @@ export async function prepareBrowserRun(options) {
|
|
|
335
337
|
semanticActionVisibleRefResolution = await resolveSemanticActionVisibleRefArgs({
|
|
336
338
|
compiled: compiledSemanticAction,
|
|
337
339
|
cwd,
|
|
340
|
+
namespace: executionPlan.namespace,
|
|
338
341
|
sessionName: executionPlan.sessionName,
|
|
339
342
|
signal,
|
|
340
343
|
});
|
|
@@ -343,6 +346,7 @@ export async function prepareBrowserRun(options) {
|
|
|
343
346
|
freshSessionName,
|
|
344
347
|
managedSessionActive: state.managedSessionActive,
|
|
345
348
|
managedSessionName: state.managedSessionName,
|
|
349
|
+
managedSessionNamespace: state.managedSessionNamespace,
|
|
346
350
|
sessionMode,
|
|
347
351
|
});
|
|
348
352
|
}
|
|
@@ -382,9 +386,10 @@ export async function prepareBrowserRun(options) {
|
|
|
382
386
|
commandTokens,
|
|
383
387
|
stdin: runtimeToolStdin,
|
|
384
388
|
});
|
|
389
|
+
const sessionStateKey = getSessionContextKey(executionPlan.sessionName, executionPlan.namespace);
|
|
385
390
|
const traceOwnerGuardMessage = getTraceOwnerGuardMessage({
|
|
386
391
|
command: executionPlan.commandInfo.command,
|
|
387
|
-
sessionName:
|
|
392
|
+
sessionName: sessionStateKey,
|
|
388
393
|
subcommand: executionPlan.commandInfo.subcommand,
|
|
389
394
|
traceOwners,
|
|
390
395
|
});
|
|
@@ -399,7 +404,7 @@ export async function prepareBrowserRun(options) {
|
|
|
399
404
|
sessionMode,
|
|
400
405
|
...buildAgentBrowserResultCategoryDetails({ args: redactedEffectiveArgs, command: executionPlan.commandInfo.command, errorText: traceOwnerGuardMessage, succeeded: false, validationError: traceOwnerGuardMessage }),
|
|
401
406
|
validationError: traceOwnerGuardMessage,
|
|
402
|
-
...buildSessionDetailFields(executionPlan.sessionName, executionPlan.usedImplicitSession),
|
|
407
|
+
...buildSessionDetailFields(executionPlan.sessionName, executionPlan.usedImplicitSession, executionPlan.namespace),
|
|
403
408
|
},
|
|
404
409
|
isError: true,
|
|
405
410
|
} };
|
|
@@ -420,12 +425,12 @@ export async function prepareBrowserRun(options) {
|
|
|
420
425
|
sessionMode,
|
|
421
426
|
...buildAgentBrowserResultCategoryDetails({ args: redactedEffectiveArgs, command: executionPlan.commandInfo.command, errorText: stdinValidationError, succeeded: false, validationError: stdinValidationError }),
|
|
422
427
|
validationError: stdinValidationError,
|
|
423
|
-
...buildSessionDetailFields(executionPlan.sessionName, executionPlan.usedImplicitSession),
|
|
428
|
+
...buildSessionDetailFields(executionPlan.sessionName, executionPlan.usedImplicitSession, executionPlan.namespace),
|
|
424
429
|
},
|
|
425
430
|
isError: true,
|
|
426
431
|
} };
|
|
427
432
|
}
|
|
428
|
-
const priorSessionPageState = sessionPageState.get(
|
|
433
|
+
const priorSessionPageState = sessionPageState.get(sessionStateKey);
|
|
429
434
|
const priorSessionTabTarget = priorSessionPageState.tabTarget;
|
|
430
435
|
const sessionTabPinningReason = priorSessionPageState.pinningReason;
|
|
431
436
|
const priorRefSnapshotState = priorSessionPageState.refSnapshot;
|
|
@@ -447,7 +452,7 @@ export async function prepareBrowserRun(options) {
|
|
|
447
452
|
sessionMode,
|
|
448
453
|
...buildAgentBrowserResultCategoryDetails({ args: redactedEffectiveArgs, command: executionPlan.commandInfo.command, errorText: requestedArtifactCloseViolation.message, failureCategory: "policy-blocked", succeeded: false, validationError: requestedArtifactCloseViolation.message }),
|
|
449
454
|
validationError: requestedArtifactCloseViolation.message,
|
|
450
|
-
...buildSessionDetailFields(executionPlan.sessionName, executionPlan.usedImplicitSession),
|
|
455
|
+
...buildSessionDetailFields(executionPlan.sessionName, executionPlan.usedImplicitSession, executionPlan.namespace),
|
|
451
456
|
},
|
|
452
457
|
isError: true,
|
|
453
458
|
} };
|
|
@@ -467,13 +472,13 @@ export async function prepareBrowserRun(options) {
|
|
|
467
472
|
command: executionPlan.commandInfo.command,
|
|
468
473
|
compatibilityWorkaround,
|
|
469
474
|
effectiveArgs: redactedEffectiveArgs,
|
|
470
|
-
nextActions: buildSessionAwareStaleRefNextActions(executionPlan.sessionName),
|
|
475
|
+
nextActions: applyNamespaceToNextActions(buildSessionAwareStaleRefNextActions(executionPlan.sessionName), executionPlan.namespace),
|
|
471
476
|
refIds: staleRefPreflight.refIds,
|
|
472
477
|
refSnapshot: staleRefPreflight.snapshot,
|
|
473
478
|
refSnapshotInvalidation: staleRefPreflight.snapshotInvalidation,
|
|
474
479
|
sessionMode,
|
|
475
480
|
...buildAgentBrowserResultCategoryDetails({ args: redactedEffectiveArgs, command: executionPlan.commandInfo.command, errorText: staleRefPreflight.message, failureCategory: "stale-ref", succeeded: false }),
|
|
476
|
-
...buildSessionDetailFields(executionPlan.sessionName, executionPlan.usedImplicitSession),
|
|
481
|
+
...buildSessionDetailFields(executionPlan.sessionName, executionPlan.usedImplicitSession, executionPlan.namespace),
|
|
477
482
|
},
|
|
478
483
|
isError: true,
|
|
479
484
|
} };
|
|
@@ -483,12 +488,13 @@ export async function prepareBrowserRun(options) {
|
|
|
483
488
|
cwd,
|
|
484
489
|
currentTarget: priorSessionTabTarget,
|
|
485
490
|
previousSnapshot: resolvedSemanticActionRefSnapshot ? undefined : priorRefSnapshotState,
|
|
491
|
+
namespace: executionPlan.namespace,
|
|
486
492
|
sessionName: executionPlan.sessionName,
|
|
487
493
|
signal,
|
|
488
494
|
});
|
|
489
495
|
if (samePageRefFreshnessPreflight) {
|
|
490
|
-
if (samePageRefFreshnessPreflight.snapshot &&
|
|
491
|
-
sessionPageState.applyRefSnapshot({ fallbackTarget: priorSessionTabTarget, sessionName:
|
|
496
|
+
if (samePageRefFreshnessPreflight.snapshot && sessionStateKey) {
|
|
497
|
+
sessionPageState.applyRefSnapshot({ fallbackTarget: priorSessionTabTarget, sessionName: sessionStateKey, snapshot: samePageRefFreshnessPreflight.snapshot, update: options.sessionPageStateUpdate });
|
|
492
498
|
}
|
|
493
499
|
return { kind: "early-result", statePatch, result: {
|
|
494
500
|
content: [{ type: "text", text: samePageRefFreshnessPreflight.message }],
|
|
@@ -497,12 +503,12 @@ export async function prepareBrowserRun(options) {
|
|
|
497
503
|
command: executionPlan.commandInfo.command,
|
|
498
504
|
compatibilityWorkaround,
|
|
499
505
|
effectiveArgs: redactedEffectiveArgs,
|
|
500
|
-
nextActions: buildSessionAwareStaleRefNextActions(executionPlan.sessionName),
|
|
506
|
+
nextActions: applyNamespaceToNextActions(buildSessionAwareStaleRefNextActions(executionPlan.sessionName), executionPlan.namespace),
|
|
501
507
|
refIds: samePageRefFreshnessPreflight.refIds,
|
|
502
508
|
refSnapshot: samePageRefFreshnessPreflight.snapshot,
|
|
503
509
|
sessionMode,
|
|
504
510
|
...buildAgentBrowserResultCategoryDetails({ args: redactedEffectiveArgs, command: executionPlan.commandInfo.command, errorText: samePageRefFreshnessPreflight.message, failureCategory: "stale-ref", succeeded: false }),
|
|
505
|
-
...buildSessionDetailFields(executionPlan.sessionName, executionPlan.usedImplicitSession),
|
|
511
|
+
...buildSessionDetailFields(executionPlan.sessionName, executionPlan.usedImplicitSession, executionPlan.namespace),
|
|
506
512
|
},
|
|
507
513
|
isError: true,
|
|
508
514
|
} };
|
|
@@ -510,6 +516,7 @@ export async function prepareBrowserRun(options) {
|
|
|
510
516
|
if (compiledQaPreset?.checks.attached) {
|
|
511
517
|
const qaAttachedPrecondition = await validateQaAttachedPrecondition({
|
|
512
518
|
cwd,
|
|
519
|
+
namespace: executionPlan.namespace,
|
|
513
520
|
sessionName: executionPlan.sessionName,
|
|
514
521
|
signal,
|
|
515
522
|
});
|
|
@@ -521,11 +528,11 @@ export async function prepareBrowserRun(options) {
|
|
|
521
528
|
compiledQaPreset: redactedCompiledQaPreset,
|
|
522
529
|
compatibilityWorkaround,
|
|
523
530
|
effectiveArgs: redactedEffectiveArgs,
|
|
524
|
-
nextActions: qaAttachedPrecondition.nextActions,
|
|
531
|
+
nextActions: applyNamespaceToNextActions(qaAttachedPrecondition.nextActions, executionPlan.namespace),
|
|
525
532
|
sessionMode,
|
|
526
533
|
...buildAgentBrowserResultCategoryDetails({ args: redactedEffectiveArgs, command: executionPlan.commandInfo.command, errorText: qaAttachedPrecondition.error, succeeded: false, validationError: qaAttachedPrecondition.error }),
|
|
527
534
|
validationError: qaAttachedPrecondition.error,
|
|
528
|
-
...buildSessionDetailFields(executionPlan.sessionName, executionPlan.usedImplicitSession),
|
|
535
|
+
...buildSessionDetailFields(executionPlan.sessionName, executionPlan.usedImplicitSession, executionPlan.namespace),
|
|
529
536
|
},
|
|
530
537
|
isError: true,
|
|
531
538
|
} };
|
|
@@ -541,8 +548,10 @@ export async function prepareBrowserRun(options) {
|
|
|
541
548
|
persistentArtifactStore,
|
|
542
549
|
previousRefSnapshot: priorRefSnapshotState,
|
|
543
550
|
redactedArgs,
|
|
551
|
+
namespace: executionPlan.namespace,
|
|
544
552
|
sessionMode,
|
|
545
553
|
sessionName: executionPlan.sessionName,
|
|
554
|
+
sessionStateKey,
|
|
546
555
|
sessionPageState,
|
|
547
556
|
sessionPageStateUpdate: options.sessionPageStateUpdate,
|
|
548
557
|
signal,
|
|
@@ -557,6 +566,7 @@ export async function prepareBrowserRun(options) {
|
|
|
557
566
|
effectiveArgs: redactedEffectiveArgs,
|
|
558
567
|
redactedArgs,
|
|
559
568
|
sessionMode,
|
|
569
|
+
namespace: executionPlan.namespace,
|
|
560
570
|
sessionName: executionPlan.sessionName,
|
|
561
571
|
signal,
|
|
562
572
|
usedImplicitSession: executionPlan.usedImplicitSession,
|
|
@@ -570,6 +580,7 @@ export async function prepareBrowserRun(options) {
|
|
|
570
580
|
effectiveArgs: redactedEffectiveArgs,
|
|
571
581
|
redactedArgs,
|
|
572
582
|
sessionMode,
|
|
583
|
+
namespace: executionPlan.namespace,
|
|
573
584
|
sessionName: executionPlan.sessionName,
|
|
574
585
|
signal,
|
|
575
586
|
usedImplicitSession: executionPlan.usedImplicitSession,
|
|
@@ -583,6 +594,7 @@ export async function prepareBrowserRun(options) {
|
|
|
583
594
|
effectiveArgs: redactedEffectiveArgs,
|
|
584
595
|
redactedArgs,
|
|
585
596
|
sessionMode,
|
|
597
|
+
namespace: executionPlan.namespace,
|
|
586
598
|
sessionName: executionPlan.sessionName,
|
|
587
599
|
signal,
|
|
588
600
|
usedImplicitSession: executionPlan.usedImplicitSession,
|
|
@@ -597,6 +609,7 @@ export async function prepareBrowserRun(options) {
|
|
|
597
609
|
effectiveArgs: redactedEffectiveArgs,
|
|
598
610
|
redactedArgs,
|
|
599
611
|
sessionMode,
|
|
612
|
+
namespace: executionPlan.namespace,
|
|
600
613
|
sessionName: executionPlan.sessionName,
|
|
601
614
|
signal,
|
|
602
615
|
usedImplicitSession: executionPlan.usedImplicitSession,
|
|
@@ -618,6 +631,7 @@ export async function prepareBrowserRun(options) {
|
|
|
618
631
|
})) {
|
|
619
632
|
const plannedSessionTabSelection = await collectSessionTabSelection({
|
|
620
633
|
cwd,
|
|
634
|
+
namespace: executionPlan.namespace,
|
|
621
635
|
sessionName: executionPlan.sessionName,
|
|
622
636
|
signal,
|
|
623
637
|
target: priorSessionTabTarget,
|
|
@@ -627,6 +641,7 @@ export async function prepareBrowserRun(options) {
|
|
|
627
641
|
const appliedSessionTabSelection = await applyOpenResultTabCorrection({
|
|
628
642
|
correction: plannedSessionTabSelection,
|
|
629
643
|
cwd,
|
|
644
|
+
namespace: executionPlan.namespace,
|
|
630
645
|
sessionName: executionPlan.sessionName,
|
|
631
646
|
signal,
|
|
632
647
|
});
|
|
@@ -642,15 +657,15 @@ export async function prepareBrowserRun(options) {
|
|
|
642
657
|
sessionMode,
|
|
643
658
|
sessionTabCorrection: plannedSessionTabSelection,
|
|
644
659
|
...buildAgentBrowserResultCategoryDetails({ args: redactedEffectiveArgs, command: executionPlan.commandInfo.command, errorText: error, failureCategory: "tab-drift", succeeded: false, tabDrift: true, validationError: error }),
|
|
645
|
-
nextActions: buildSessionTabRecoveryNextActions({
|
|
660
|
+
nextActions: applyNamespaceToNextActions(buildSessionTabRecoveryNextActions({
|
|
646
661
|
kind: "tab-drift",
|
|
647
662
|
resultCategory: "failure",
|
|
648
663
|
sessionName: executionPlan.sessionName,
|
|
649
664
|
tabCorrection: plannedSessionTabSelection,
|
|
650
665
|
target: priorSessionTabTarget,
|
|
651
|
-
}),
|
|
666
|
+
}), executionPlan.namespace),
|
|
652
667
|
validationError: error,
|
|
653
|
-
...buildSessionDetailFields(executionPlan.sessionName, executionPlan.usedImplicitSession),
|
|
668
|
+
...buildSessionDetailFields(executionPlan.sessionName, executionPlan.usedImplicitSession, executionPlan.namespace),
|
|
654
669
|
},
|
|
655
670
|
isError: true,
|
|
656
671
|
} };
|
|
@@ -675,22 +690,22 @@ export async function prepareBrowserRun(options) {
|
|
|
675
690
|
sessionMode,
|
|
676
691
|
sessionTabCorrection: plannedSessionTabSelection,
|
|
677
692
|
...buildAgentBrowserResultCategoryDetails({ args: redactedEffectiveArgs, command: executionPlan.commandInfo.command, errorText: pinnedBatchPlan.error, failureCategory: "tab-drift", succeeded: false, tabDrift: true, validationError: pinnedBatchPlan.error }),
|
|
678
|
-
nextActions: buildSessionTabRecoveryNextActions({
|
|
693
|
+
nextActions: applyNamespaceToNextActions(buildSessionTabRecoveryNextActions({
|
|
679
694
|
kind: "tab-drift",
|
|
680
695
|
resultCategory: "failure",
|
|
681
696
|
sessionName: executionPlan.sessionName,
|
|
682
697
|
tabCorrection: plannedSessionTabSelection,
|
|
683
698
|
target: priorSessionTabTarget,
|
|
684
|
-
}),
|
|
699
|
+
}), executionPlan.namespace),
|
|
685
700
|
validationError: pinnedBatchPlan.error,
|
|
686
|
-
...buildSessionDetailFields(executionPlan.sessionName, executionPlan.usedImplicitSession),
|
|
701
|
+
...buildSessionDetailFields(executionPlan.sessionName, executionPlan.usedImplicitSession, executionPlan.namespace),
|
|
687
702
|
},
|
|
688
703
|
isError: true,
|
|
689
704
|
} };
|
|
690
705
|
}
|
|
691
706
|
if (pinnedBatchPlan) {
|
|
692
707
|
sessionTabCorrection = plannedSessionTabSelection;
|
|
693
|
-
processArgs = ["--json", "--session", executionPlan.sessionName, "batch"];
|
|
708
|
+
processArgs = ["--json", ...(executionPlan.namespace ? ["--namespace", executionPlan.namespace] : []), "--session", executionPlan.sessionName, "batch"];
|
|
694
709
|
processStdin = JSON.stringify(pinnedBatchPlan.steps);
|
|
695
710
|
includePinnedNavigationSummary = pinnedBatchPlan.includeNavigationSummary;
|
|
696
711
|
pinnedBatchUnwrapMode = pinnedBatchPlan.unwrapMode;
|
|
@@ -699,13 +714,14 @@ export async function prepareBrowserRun(options) {
|
|
|
699
714
|
}
|
|
700
715
|
}
|
|
701
716
|
const clickDispatchProbe = pinnedBatchUnwrapMode === undefined && compiledElectron === undefined
|
|
702
|
-
? await prepareClickDispatchProbe({ commandTokens, cwd, refSnapshot: promptRefSnapshot, sessionName: executionPlan.sessionName, signal })
|
|
717
|
+
? await prepareClickDispatchProbe({ commandTokens, cwd, namespace: executionPlan.namespace, refSnapshot: promptRefSnapshot, sessionName: executionPlan.sessionName, signal })
|
|
703
718
|
: undefined;
|
|
704
719
|
const processTimeoutMs = options.params.timeoutMs ?? getDialogAwareProcessTimeoutMs(commandTokens, promptRefSnapshot, processStdin) ?? getWaitAwareProcessTimeoutMs(commandTokens, processStdin);
|
|
705
720
|
const redactedProcessArgs = redactInvocationArgs(processArgs);
|
|
706
|
-
const
|
|
721
|
+
const scrollAmount = Number(commandTokens.find((token) => /^\d+(?:\.\d+)?$/.test(token)));
|
|
722
|
+
const shouldProbeScrollNoop = executionPlan.commandInfo.command === "scroll" && executionPlan.startupScopedFlags.length === 0 && (state.managedSessionActive || sessionMode === "fresh") && (!Number.isFinite(scrollAmount) || scrollAmount >= 500);
|
|
707
723
|
const scrollPositionBefore = shouldProbeScrollNoop
|
|
708
|
-
? await collectScrollPositionSnapshot({ cwd, sessionName: executionPlan.sessionName, signal })
|
|
724
|
+
? await collectScrollPositionSnapshot({ cwd, namespace: executionPlan.namespace, sessionName: executionPlan.sessionName, signal })
|
|
709
725
|
: undefined;
|
|
710
726
|
onUpdate?.({
|
|
711
727
|
content: [{ type: "text", text: `Running agent-browser ${buildInvocationPreview(redactedProcessArgs)}` }],
|
|
@@ -714,7 +730,7 @@ export async function prepareBrowserRun(options) {
|
|
|
714
730
|
effectiveArgs: redactedProcessArgs,
|
|
715
731
|
sessionMode,
|
|
716
732
|
sessionTabCorrection,
|
|
717
|
-
...buildSessionDetailFields(executionPlan.sessionName, executionPlan.usedImplicitSession),
|
|
733
|
+
...buildSessionDetailFields(executionPlan.sessionName, executionPlan.usedImplicitSession, executionPlan.namespace),
|
|
718
734
|
},
|
|
719
735
|
});
|
|
720
736
|
return { kind: "ready", prepared: {
|