@nuanu-ai/agentbrowse 0.2.7 → 0.2.8
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/README.md +36 -8
- package/dist/agentpay-stagehand-llm.d.ts.map +1 -1
- package/dist/agentpay-stagehand-llm.js +5 -1
- package/dist/commands/act.d.ts +6 -2
- package/dist/commands/act.d.ts.map +1 -1
- package/dist/commands/act.js +840 -55
- package/dist/commands/act.test-harness.d.ts +19 -0
- package/dist/commands/act.test-harness.d.ts.map +1 -0
- package/dist/commands/act.test-harness.js +245 -0
- package/dist/commands/action-acceptance.d.ts +90 -0
- package/dist/commands/action-acceptance.d.ts.map +1 -0
- package/dist/commands/action-acceptance.js +1411 -0
- package/dist/commands/action-artifacts.d.ts +33 -0
- package/dist/commands/action-artifacts.d.ts.map +1 -0
- package/dist/commands/action-artifacts.js +104 -0
- package/dist/commands/action-execution-guards.d.ts +5 -0
- package/dist/commands/action-execution-guards.d.ts.map +1 -0
- package/dist/commands/action-execution-guards.js +3 -0
- package/dist/commands/action-executor-helpers.d.ts +21 -0
- package/dist/commands/action-executor-helpers.d.ts.map +1 -0
- package/dist/commands/action-executor-helpers.js +242 -0
- package/dist/commands/action-executor.d.ts +12 -0
- package/dist/commands/action-executor.d.ts.map +1 -0
- package/dist/commands/action-executor.js +45 -0
- package/dist/commands/action-fallbacks.d.ts +6 -0
- package/dist/commands/action-fallbacks.d.ts.map +1 -0
- package/dist/commands/action-fallbacks.js +43 -0
- package/dist/commands/action-value-projection.d.ts +32 -0
- package/dist/commands/action-value-projection.d.ts.map +1 -0
- package/dist/commands/action-value-projection.js +151 -0
- package/dist/commands/browse-actions.d.ts +4 -0
- package/dist/commands/browse-actions.d.ts.map +1 -0
- package/dist/commands/browse-actions.js +4 -0
- package/dist/commands/captcha-solve.d.ts.map +1 -1
- package/dist/commands/captcha-solve.js +13 -3
- package/dist/commands/click-action-executor.d.ts +10 -0
- package/dist/commands/click-action-executor.d.ts.map +1 -0
- package/dist/commands/click-action-executor.js +68 -0
- package/dist/commands/create-intent.d.ts +6 -0
- package/dist/commands/create-intent.d.ts.map +1 -0
- package/dist/commands/create-intent.js +75 -0
- package/dist/commands/datepicker-action-executor.d.ts +12 -0
- package/dist/commands/datepicker-action-executor.d.ts.map +1 -0
- package/dist/commands/datepicker-action-executor.js +218 -0
- package/dist/commands/descriptor-validation.d.ts +27 -0
- package/dist/commands/descriptor-validation.d.ts.map +1 -0
- package/dist/commands/descriptor-validation.js +333 -0
- package/dist/commands/extract-scope-resolution.d.ts +20 -0
- package/dist/commands/extract-scope-resolution.d.ts.map +1 -0
- package/dist/commands/extract-scope-resolution.js +100 -0
- package/dist/commands/extract-stagehand-executor.d.ts +17 -0
- package/dist/commands/extract-stagehand-executor.d.ts.map +1 -0
- package/dist/commands/extract-stagehand-executor.js +18 -0
- package/dist/commands/extract.d.ts +3 -2
- package/dist/commands/extract.d.ts.map +1 -1
- package/dist/commands/extract.js +256 -39
- package/dist/commands/fill-secret.d.ts +7 -0
- package/dist/commands/fill-secret.d.ts.map +1 -0
- package/dist/commands/fill-secret.js +371 -0
- package/dist/commands/get-secrets-catalog.d.ts +6 -0
- package/dist/commands/get-secrets-catalog.d.ts.map +1 -0
- package/dist/commands/get-secrets-catalog.js +23 -0
- package/dist/commands/launch.d.ts.map +1 -1
- package/dist/commands/launch.js +41 -7
- package/dist/commands/navigate.d.ts +2 -1
- package/dist/commands/navigate.d.ts.map +1 -1
- package/dist/commands/navigate.js +49 -12
- package/dist/commands/observe-inventory.d.ts +109 -0
- package/dist/commands/observe-inventory.d.ts.map +1 -0
- package/dist/commands/observe-inventory.js +2837 -0
- package/dist/commands/observe-persistence.d.ts +14 -0
- package/dist/commands/observe-persistence.d.ts.map +1 -0
- package/dist/commands/observe-persistence.js +170 -0
- package/dist/commands/observe-projection.d.ts +84 -0
- package/dist/commands/observe-projection.d.ts.map +1 -0
- package/dist/commands/observe-projection.js +140 -0
- package/dist/commands/observe-protected.d.ts +5 -0
- package/dist/commands/observe-protected.d.ts.map +1 -0
- package/dist/commands/observe-protected.js +18 -0
- package/dist/commands/observe-semantics.d.ts +10 -0
- package/dist/commands/observe-semantics.d.ts.map +1 -0
- package/dist/commands/observe-semantics.js +338 -0
- package/dist/commands/observe-stagehand.d.ts +48 -0
- package/dist/commands/observe-stagehand.d.ts.map +1 -0
- package/dist/commands/observe-stagehand.js +105 -0
- package/dist/commands/observe-surfaces.d.ts +9 -0
- package/dist/commands/observe-surfaces.d.ts.map +1 -0
- package/dist/commands/observe-surfaces.js +195 -0
- package/dist/commands/observe.d.ts +47 -1
- package/dist/commands/observe.d.ts.map +1 -1
- package/dist/commands/observe.js +173 -20
- package/dist/commands/observe.test-harness.d.ts +67 -0
- package/dist/commands/observe.test-harness.d.ts.map +1 -0
- package/dist/commands/observe.test-harness.js +107 -0
- package/dist/commands/poll-intent.d.ts +6 -0
- package/dist/commands/poll-intent.d.ts.map +1 -0
- package/dist/commands/poll-intent.js +57 -0
- package/dist/commands/screenshot.d.ts +2 -1
- package/dist/commands/screenshot.d.ts.map +1 -1
- package/dist/commands/screenshot.js +44 -12
- package/dist/commands/select-action-executor.d.ts +10 -0
- package/dist/commands/select-action-executor.d.ts.map +1 -0
- package/dist/commands/select-action-executor.js +91 -0
- package/dist/commands/semantic-observe.d.ts +24 -0
- package/dist/commands/semantic-observe.d.ts.map +1 -0
- package/dist/commands/semantic-observe.js +344 -0
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +75 -2
- package/dist/commands/structured-grid-action-executor.d.ts +3 -0
- package/dist/commands/structured-grid-action-executor.d.ts.map +1 -0
- package/dist/commands/structured-grid-action-executor.js +4 -0
- package/dist/commands/target-resolution.d.ts +4 -0
- package/dist/commands/target-resolution.d.ts.map +1 -0
- package/dist/commands/target-resolution.js +33 -0
- package/dist/commands/text-input-action-executor.d.ts +5 -0
- package/dist/commands/text-input-action-executor.d.ts.map +1 -0
- package/dist/commands/text-input-action-executor.js +116 -0
- package/dist/commands/user-actionable.d.ts +4 -0
- package/dist/commands/user-actionable.d.ts.map +1 -0
- package/dist/commands/user-actionable.js +95 -0
- package/dist/control-semantics.d.ts +29 -0
- package/dist/control-semantics.d.ts.map +1 -0
- package/dist/control-semantics.js +299 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +95 -32
- package/dist/output.d.ts +14 -2
- package/dist/output.d.ts.map +1 -1
- package/dist/output.js +17 -29
- package/dist/playwright-runtime.d.ts +35 -0
- package/dist/playwright-runtime.d.ts.map +1 -0
- package/dist/playwright-runtime.js +224 -0
- package/dist/runtime-resolution.d.ts +9 -0
- package/dist/runtime-resolution.d.ts.map +1 -0
- package/dist/runtime-resolution.js +19 -0
- package/dist/runtime-state.d.ts +217 -0
- package/dist/runtime-state.d.ts.map +1 -0
- package/dist/runtime-state.js +629 -0
- package/dist/secrets/backend.d.ts +32 -0
- package/dist/secrets/backend.d.ts.map +1 -0
- package/dist/secrets/backend.js +169 -0
- package/dist/secrets/catalog-applicability.d.ts +5 -0
- package/dist/secrets/catalog-applicability.d.ts.map +1 -0
- package/dist/secrets/catalog-applicability.js +59 -0
- package/dist/secrets/catalog-sync.d.ts +14 -0
- package/dist/secrets/catalog-sync.d.ts.map +1 -0
- package/dist/secrets/catalog-sync.js +35 -0
- package/dist/secrets/field-policy.d.ts +3 -0
- package/dist/secrets/field-policy.d.ts.map +1 -0
- package/dist/secrets/field-policy.js +3 -0
- package/dist/secrets/fill-ordering.d.ts +11 -0
- package/dist/secrets/fill-ordering.d.ts.map +1 -0
- package/dist/secrets/fill-ordering.js +44 -0
- package/dist/secrets/form-matcher.d.ts +60 -0
- package/dist/secrets/form-matcher.d.ts.map +1 -0
- package/dist/secrets/form-matcher.js +596 -0
- package/dist/secrets/intent-output.d.ts +11 -0
- package/dist/secrets/intent-output.d.ts.map +1 -0
- package/dist/secrets/intent-output.js +64 -0
- package/dist/secrets/mock-agentpay-backend.d.ts +13 -0
- package/dist/secrets/mock-agentpay-backend.d.ts.map +1 -0
- package/dist/secrets/mock-agentpay-backend.js +87 -0
- package/dist/secrets/mock-agentpay-cabinet.d.ts +43 -0
- package/dist/secrets/mock-agentpay-cabinet.d.ts.map +1 -0
- package/dist/secrets/mock-agentpay-cabinet.js +195 -0
- package/dist/secrets/protected-artifact-guard.d.ts +25 -0
- package/dist/secrets/protected-artifact-guard.d.ts.map +1 -0
- package/dist/secrets/protected-artifact-guard.js +26 -0
- package/dist/secrets/protected-bindings.d.ts +10 -0
- package/dist/secrets/protected-bindings.d.ts.map +1 -0
- package/dist/secrets/protected-bindings.js +17 -0
- package/dist/secrets/protected-field-values.d.ts +13 -0
- package/dist/secrets/protected-field-values.d.ts.map +1 -0
- package/dist/secrets/protected-field-values.js +100 -0
- package/dist/secrets/protected-fill.d.ts +47 -0
- package/dist/secrets/protected-fill.d.ts.map +1 -0
- package/dist/secrets/protected-fill.js +512 -0
- package/dist/secrets/types.d.ts +84 -0
- package/dist/secrets/types.d.ts.map +1 -0
- package/dist/secrets/types.js +27 -0
- package/dist/session.d.ts +22 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +74 -2
- package/dist/solver/browser-launcher.d.ts.map +1 -1
- package/dist/solver/browser-launcher.js +6 -3
- package/dist/stagehand-runtime.d.ts +4 -0
- package/dist/stagehand-runtime.d.ts.map +1 -0
- package/dist/stagehand-runtime.js +10 -0
- package/dist/stagehand.d.ts +0 -5
- package/dist/stagehand.d.ts.map +1 -1
- package/dist/stagehand.js +0 -6
- package/package.json +5 -2
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BrowseSession } from '../session.js';
|
|
2
|
+
import type { SurfaceDescriptor, TargetDescriptor } from '../runtime-state.js';
|
|
3
|
+
import type { DomObservedTarget } from './observe-inventory.js';
|
|
4
|
+
export declare function toDomDescriptor(pageRef: string, target: DomObservedTarget, surfaceRefMap: ReadonlyMap<string, string>): Omit<TargetDescriptor, 'ref'>;
|
|
5
|
+
export declare function attachObservedTargetOwners(domTargets: ReadonlyArray<DomObservedTarget>, targets: TargetDescriptor[]): void;
|
|
6
|
+
export declare function persistObservedSurfacesForPage(session: BrowseSession, pageRef: string, targets: ReadonlyArray<DomObservedTarget>, options?: {
|
|
7
|
+
allSurfaceInputs?: ReadonlyArray<Omit<SurfaceDescriptor, 'ref'>>;
|
|
8
|
+
explicitSurfaceIds?: ReadonlySet<string>;
|
|
9
|
+
}): {
|
|
10
|
+
observedScopes: SurfaceDescriptor[];
|
|
11
|
+
surfaceRefMap: Map<string, string>;
|
|
12
|
+
};
|
|
13
|
+
export declare function reconcileObservedTargetsForPage(session: BrowseSession, pageRef: string, observedTargets: ReadonlyArray<Pick<TargetDescriptor, 'ref'>>): void;
|
|
14
|
+
//# sourceMappingURL=observe-persistence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observe-persistence.d.ts","sourceRoot":"","sources":["../../src/commands/observe-persistence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AASnD,OAAO,KAAK,EAAoB,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACjG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAGhE,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,iBAAiB,EACzB,aAAa,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACzC,IAAI,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAmF/B;AAED,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,aAAa,CAAC,iBAAiB,CAAC,EAC5C,OAAO,EAAE,gBAAgB,EAAE,GAC1B,IAAI,CAYN;AAED,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,aAAa,CAAC,iBAAiB,CAAC,EACzC,OAAO,CAAC,EAAE;IACR,gBAAgB,CAAC,EAAE,aAAa,CAAC,IAAI,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC,CAAC;IACjE,kBAAkB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC1C,GACA;IACD,cAAc,EAAE,iBAAiB,EAAE,CAAC;IACpC,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC,CAgEA;AAED,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,MAAM,EACf,eAAe,EAAE,aAAa,CAAC,IAAI,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC,GAC5D,IAAI,CAsBN"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { ensureRuntimeState, markSurfaceLifecycle, markTargetLifecycle, replaceSurfacesForPage, setSurfaceAvailability, setTargetAvailability, } from '../runtime-state.js';
|
|
2
|
+
import { collectSurfaceDescriptors, pushUniqueLocatorCandidate, surfaceReplacementKey } from './observe-surfaces.js';
|
|
3
|
+
export function toDomDescriptor(pageRef, target, surfaceRefMap) {
|
|
4
|
+
const locatorCandidates = [];
|
|
5
|
+
if (target.role && target.label) {
|
|
6
|
+
pushUniqueLocatorCandidate(locatorCandidates, {
|
|
7
|
+
strategy: 'role',
|
|
8
|
+
value: target.role,
|
|
9
|
+
name: target.label,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
if (target.label) {
|
|
13
|
+
pushUniqueLocatorCandidate(locatorCandidates, {
|
|
14
|
+
strategy: 'label',
|
|
15
|
+
value: target.label,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
if (target.placeholder) {
|
|
19
|
+
pushUniqueLocatorCandidate(locatorCandidates, {
|
|
20
|
+
strategy: 'placeholder',
|
|
21
|
+
value: target.placeholder,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
if (target.text) {
|
|
25
|
+
pushUniqueLocatorCandidate(locatorCandidates, {
|
|
26
|
+
strategy: 'text',
|
|
27
|
+
value: target.text,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
if (target.title) {
|
|
31
|
+
pushUniqueLocatorCandidate(locatorCandidates, {
|
|
32
|
+
strategy: 'title',
|
|
33
|
+
value: target.title,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
if (target.testId) {
|
|
37
|
+
pushUniqueLocatorCandidate(locatorCandidates, {
|
|
38
|
+
strategy: 'testId',
|
|
39
|
+
value: target.testId,
|
|
40
|
+
attribute: target.testIdAttribute,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
if (target.selector) {
|
|
44
|
+
pushUniqueLocatorCandidate(locatorCandidates, {
|
|
45
|
+
strategy: target.selector.startsWith('xpath=') ? 'xpath' : 'css',
|
|
46
|
+
value: target.selector,
|
|
47
|
+
scope: 'root',
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
pageRef,
|
|
52
|
+
framePath: target.framePath,
|
|
53
|
+
frameUrl: target.frameUrl,
|
|
54
|
+
kind: target.kind,
|
|
55
|
+
label: target.label ?? target.text ?? target.placeholder ?? target.title,
|
|
56
|
+
displayLabel: target.displayLabel,
|
|
57
|
+
placeholder: target.placeholder,
|
|
58
|
+
inputName: target.inputName,
|
|
59
|
+
inputType: target.inputType,
|
|
60
|
+
autocomplete: target.autocomplete,
|
|
61
|
+
validation: target.validation,
|
|
62
|
+
locatorCandidates,
|
|
63
|
+
semantics: target.role || target.label || target.states
|
|
64
|
+
? {
|
|
65
|
+
role: target.role,
|
|
66
|
+
name: target.label,
|
|
67
|
+
states: target.states,
|
|
68
|
+
source: 'dom',
|
|
69
|
+
}
|
|
70
|
+
: undefined,
|
|
71
|
+
structure: target.structure,
|
|
72
|
+
context: target.context,
|
|
73
|
+
capability: target.capability ?? 'actionable',
|
|
74
|
+
lifecycle: 'live',
|
|
75
|
+
availability: target.availability ?? { state: 'available' },
|
|
76
|
+
allowedActions: target.allowedActions ?? [],
|
|
77
|
+
acceptancePolicy: target.acceptancePolicy,
|
|
78
|
+
surfaceRef: target.surfaceRef ? surfaceRefMap.get(target.surfaceRef) : undefined,
|
|
79
|
+
createdAt: Date.now(),
|
|
80
|
+
pageSignature: target.pageSignature,
|
|
81
|
+
domSignature: target.domSignature,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
export function attachObservedTargetOwners(domTargets, targets) {
|
|
85
|
+
for (const [index, observedTarget] of domTargets.entries()) {
|
|
86
|
+
if (typeof observedTarget.ownerIndex !== 'number') {
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
const ownerSlot = domTargets.findIndex((candidate) => candidate.ordinal === observedTarget.ownerIndex);
|
|
90
|
+
if (ownerSlot >= 0 && targets[ownerSlot]) {
|
|
91
|
+
targets[index].ownerRef = targets[ownerSlot].ref;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
export function persistObservedSurfacesForPage(session, pageRef, targets, options) {
|
|
96
|
+
const runtime = ensureRuntimeState(session);
|
|
97
|
+
const derivedSurfaces = collectSurfaceDescriptors(pageRef, targets);
|
|
98
|
+
const descriptors = new Map();
|
|
99
|
+
for (const surface of derivedSurfaces) {
|
|
100
|
+
descriptors.set(surface.surfaceId, surface);
|
|
101
|
+
}
|
|
102
|
+
for (const surface of options?.allSurfaceInputs ?? []) {
|
|
103
|
+
if (!options?.explicitSurfaceIds?.has(surface.surfaceId)) {
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
if (!descriptors.has(surface.surfaceId)) {
|
|
107
|
+
descriptors.set(surface.surfaceId, surface);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const observedScopes = replaceSurfacesForPage(session, pageRef, [...descriptors.values()], {
|
|
111
|
+
preserveExistingOnEmpty: false,
|
|
112
|
+
preserveExisting: true,
|
|
113
|
+
});
|
|
114
|
+
const activeSurfaceRefs = new Set(observedScopes.map((scope) => scope.ref));
|
|
115
|
+
const activeSurfaceSlots = new Set(observedScopes.map((scope) => surfaceReplacementKey(scope)));
|
|
116
|
+
for (const surface of Object.values(runtime.surfaces)) {
|
|
117
|
+
if (surface.pageRef !== pageRef)
|
|
118
|
+
continue;
|
|
119
|
+
if (activeSurfaceRefs.has(surface.ref)) {
|
|
120
|
+
markSurfaceLifecycle(session, surface.ref, 'live');
|
|
121
|
+
setSurfaceAvailability(session, surface.ref, 'available');
|
|
122
|
+
}
|
|
123
|
+
else if (activeSurfaceSlots.has(surfaceReplacementKey(surface))) {
|
|
124
|
+
markSurfaceLifecycle(session, surface.ref, 'invalidated', 'surface-replaced');
|
|
125
|
+
setSurfaceAvailability(session, surface.ref, 'hidden', 'surface-replaced');
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
setSurfaceAvailability(session, surface.ref, 'hidden', 'surface-not-observed');
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
for (const target of Object.values(runtime.targets)) {
|
|
132
|
+
if (target.pageRef !== pageRef || !target.surfaceRef)
|
|
133
|
+
continue;
|
|
134
|
+
if (activeSurfaceRefs.has(target.surfaceRef)) {
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
const linkedSurface = runtime.surfaces[target.surfaceRef];
|
|
138
|
+
if (linkedSurface?.lifecycle === 'invalidated') {
|
|
139
|
+
markTargetLifecycle(session, target.ref, 'invalidated', linkedSurface.lifecycleReason);
|
|
140
|
+
setTargetAvailability(session, target.ref, 'hidden', linkedSurface.lifecycleReason ?? 'surface-replaced');
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
setTargetAvailability(session, target.ref, 'surface-inactive', 'surface-not-observed');
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return {
|
|
147
|
+
observedScopes,
|
|
148
|
+
surfaceRefMap: new Map(observedScopes.map((scope) => [scope.surfaceId, scope.ref])),
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
export function reconcileObservedTargetsForPage(session, pageRef, observedTargets) {
|
|
152
|
+
const runtime = ensureRuntimeState(session);
|
|
153
|
+
const activeTargetRefs = new Set(observedTargets.map((target) => target.ref));
|
|
154
|
+
for (const target of Object.values(runtime.targets)) {
|
|
155
|
+
if (target.pageRef !== pageRef || activeTargetRefs.has(target.ref)) {
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
const linkedSurface = target.surfaceRef ? runtime.surfaces[target.surfaceRef] : null;
|
|
159
|
+
if (linkedSurface) {
|
|
160
|
+
if (linkedSurface.lifecycle === 'invalidated') {
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
if (linkedSurface.availability.state !== 'available') {
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
markTargetLifecycle(session, target.ref, 'stale', 'target-not-observed');
|
|
168
|
+
setTargetAvailability(session, target.ref, 'hidden', 'target-not-observed');
|
|
169
|
+
}
|
|
170
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { SurfaceDescriptor, TargetDescriptor, TargetValidationEvidence } from '../runtime-state.js';
|
|
2
|
+
import type { PersistedFillableForm, ProtectedBindingValueHint } from '../secrets/types.js';
|
|
3
|
+
import type { DomObservedTarget, ObservedPageSignal } from './observe-inventory.js';
|
|
4
|
+
export type GoalObserveScopeCandidate = {
|
|
5
|
+
goalInventoryType: 'scope';
|
|
6
|
+
goalSurfaceId: string;
|
|
7
|
+
kind?: string;
|
|
8
|
+
label?: string;
|
|
9
|
+
capability: 'scope';
|
|
10
|
+
surfaceRef?: string;
|
|
11
|
+
surfacePriority?: number;
|
|
12
|
+
framePath?: string[];
|
|
13
|
+
frameUrl?: string;
|
|
14
|
+
pageSignature?: string;
|
|
15
|
+
context?: TargetDescriptor['context'];
|
|
16
|
+
structure?: TargetDescriptor['structure'];
|
|
17
|
+
};
|
|
18
|
+
export type GoalObserveTargetCandidate = DomObservedTarget & {
|
|
19
|
+
goalInventoryType: 'target';
|
|
20
|
+
goalTargetKey: string;
|
|
21
|
+
};
|
|
22
|
+
export type GoalObserveInventoryCandidate = GoalObserveTargetCandidate | GoalObserveScopeCandidate;
|
|
23
|
+
export declare function compactTargets(targets: ReadonlyArray<Pick<TargetDescriptor, 'ref' | 'kind' | 'label' | 'displayLabel' | 'placeholder' | 'inputName' | 'inputType' | 'autocomplete' | 'validation' | 'context' | 'semantics' | 'structure' | 'capability' | 'availability'>>): Array<{
|
|
24
|
+
ref: string;
|
|
25
|
+
kind?: string;
|
|
26
|
+
label?: string;
|
|
27
|
+
displayLabel?: string;
|
|
28
|
+
placeholder?: string;
|
|
29
|
+
inputName?: string;
|
|
30
|
+
inputType?: string;
|
|
31
|
+
autocomplete?: string;
|
|
32
|
+
validation?: TargetValidationEvidence;
|
|
33
|
+
context?: string;
|
|
34
|
+
state?: Record<string, string | boolean | number>;
|
|
35
|
+
structure?: TargetDescriptor['structure'];
|
|
36
|
+
capability?: TargetDescriptor['capability'];
|
|
37
|
+
availability?: string;
|
|
38
|
+
availabilityReason?: string;
|
|
39
|
+
source?: 'dom' | 'stagehand' | 'aria-snapshot' | 'cdp-ax';
|
|
40
|
+
}>;
|
|
41
|
+
export declare function compactScopes(scopes: ReadonlyArray<Pick<SurfaceDescriptor, 'ref' | 'kind' | 'label' | 'availability'>>): Array<{
|
|
42
|
+
ref: string;
|
|
43
|
+
kind?: string;
|
|
44
|
+
label?: string;
|
|
45
|
+
capability: 'scope';
|
|
46
|
+
availability?: string;
|
|
47
|
+
availabilityReason?: string;
|
|
48
|
+
source: 'dom';
|
|
49
|
+
}>;
|
|
50
|
+
export declare function compactFillableForms(forms: ReadonlyArray<PersistedFillableForm>): Array<{
|
|
51
|
+
fillRef: string;
|
|
52
|
+
scopeRef?: string;
|
|
53
|
+
purpose: string;
|
|
54
|
+
recommendedTiming?: 'late';
|
|
55
|
+
fields: Array<{
|
|
56
|
+
fieldKey: string;
|
|
57
|
+
targetRef: string;
|
|
58
|
+
label?: string;
|
|
59
|
+
required?: boolean;
|
|
60
|
+
valueHint?: ProtectedBindingValueHint;
|
|
61
|
+
}>;
|
|
62
|
+
storedSecretCandidates: Array<{
|
|
63
|
+
storedSecretRef: string;
|
|
64
|
+
kind: string;
|
|
65
|
+
scope: string;
|
|
66
|
+
displayName: string;
|
|
67
|
+
matchConfidence: 'high' | 'medium' | 'low';
|
|
68
|
+
intentRequired: boolean;
|
|
69
|
+
}>;
|
|
70
|
+
}>;
|
|
71
|
+
export declare function compactSignals(signals: ReadonlyArray<ObservedPageSignal>): Array<{
|
|
72
|
+
kind: ObservedPageSignal['kind'];
|
|
73
|
+
text: string;
|
|
74
|
+
framePath?: string[];
|
|
75
|
+
source: 'dom';
|
|
76
|
+
}>;
|
|
77
|
+
export declare function buildGoalObserveInventoryCandidates(targets: ReadonlyArray<DomObservedTarget>, surfaces: ReadonlyArray<Omit<SurfaceDescriptor, 'ref'>>): GoalObserveInventoryCandidate[];
|
|
78
|
+
export declare function selectTargetsForGoalMatches(allTargets: ReadonlyArray<DomObservedTarget>, rerankedCandidates: ReadonlyArray<GoalObserveInventoryCandidate>): {
|
|
79
|
+
targets: DomObservedTarget[];
|
|
80
|
+
selectedSurfaceIds: Set<string>;
|
|
81
|
+
};
|
|
82
|
+
export declare function buildExplicitScopeRefs(selectedSurfaceIds: ReadonlySet<string>, surfaceRefMap: ReadonlyMap<string, string>): Set<string>;
|
|
83
|
+
export declare function projectPersistedTargetsForGoal(domTargets: ReadonlyArray<DomObservedTarget>, persistedTargets: ReadonlyArray<TargetDescriptor>, selectedTargets: ReadonlyArray<DomObservedTarget>): TargetDescriptor[];
|
|
84
|
+
//# sourceMappingURL=observe-projection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observe-projection.d.ts","sourceRoot":"","sources":["../../src/commands/observe-projection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,EACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,qBA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CAAC,MAAM,CAAC,CAMb;AAED,wBAAgB,8BAA8B,CAC5C,UAAU,EAAE,aAAa,CAAC,iBAAiB,CAAC,EAC5C,gBAAgB,EAAE,aAAa,CAAC,gBAAgB,CAAC,EACjD,eAAe,EAAE,aAAa,CAAC,iBAAiB,CAAC,GAChD,gBAAgB,EAAE,CAmBpB"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { observedTargetKey } from './observe-semantics.js';
|
|
2
|
+
import { summarizeContext } from './observe-surfaces.js';
|
|
3
|
+
export function compactTargets(targets) {
|
|
4
|
+
return targets.map((target) => ({
|
|
5
|
+
ref: target.ref,
|
|
6
|
+
kind: target.kind,
|
|
7
|
+
label: target.label,
|
|
8
|
+
displayLabel: target.displayLabel,
|
|
9
|
+
placeholder: target.placeholder,
|
|
10
|
+
inputName: target.inputName,
|
|
11
|
+
inputType: target.inputType,
|
|
12
|
+
autocomplete: target.autocomplete,
|
|
13
|
+
validation: target.validation,
|
|
14
|
+
context: summarizeContext(target.context),
|
|
15
|
+
state: target.semantics?.states,
|
|
16
|
+
structure: target.structure,
|
|
17
|
+
capability: target.capability,
|
|
18
|
+
availability: target.availability?.state,
|
|
19
|
+
availabilityReason: target.availability?.reason,
|
|
20
|
+
source: target.semantics?.source,
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
export function compactScopes(scopes) {
|
|
24
|
+
return scopes.map((scope) => ({
|
|
25
|
+
ref: scope.ref,
|
|
26
|
+
kind: scope.kind,
|
|
27
|
+
label: scope.label,
|
|
28
|
+
capability: 'scope',
|
|
29
|
+
availability: scope.availability?.state,
|
|
30
|
+
availabilityReason: scope.availability?.reason,
|
|
31
|
+
source: 'dom',
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
export function compactFillableForms(forms) {
|
|
35
|
+
return forms.map((form) => ({
|
|
36
|
+
fillRef: form.fillRef,
|
|
37
|
+
scopeRef: form.scopeRef,
|
|
38
|
+
purpose: form.purpose,
|
|
39
|
+
recommendedTiming: form.recommendedTiming,
|
|
40
|
+
fields: form.fields.map((field) => ({
|
|
41
|
+
fieldKey: field.fieldKey,
|
|
42
|
+
targetRef: field.targetRef,
|
|
43
|
+
label: field.label,
|
|
44
|
+
required: field.required,
|
|
45
|
+
valueHint: field.valueHint,
|
|
46
|
+
})),
|
|
47
|
+
storedSecretCandidates: form.storedSecretCandidates.map((candidate) => ({
|
|
48
|
+
storedSecretRef: candidate.storedSecretRef,
|
|
49
|
+
kind: candidate.kind,
|
|
50
|
+
scope: candidate.scope,
|
|
51
|
+
displayName: candidate.displayName,
|
|
52
|
+
matchConfidence: candidate.matchConfidence,
|
|
53
|
+
intentRequired: candidate.intentRequired,
|
|
54
|
+
})),
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
export function compactSignals(signals) {
|
|
58
|
+
return signals.map((signal) => ({
|
|
59
|
+
kind: signal.kind,
|
|
60
|
+
text: signal.text,
|
|
61
|
+
framePath: signal.framePath,
|
|
62
|
+
source: signal.source,
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
export function buildGoalObserveInventoryCandidates(targets, surfaces) {
|
|
66
|
+
const targetCandidates = targets.map((target) => ({
|
|
67
|
+
...target,
|
|
68
|
+
goalInventoryType: 'target',
|
|
69
|
+
goalTargetKey: observedTargetKey(target),
|
|
70
|
+
}));
|
|
71
|
+
const scopeCandidates = surfaces.map((surface) => {
|
|
72
|
+
const linkedTargets = targets.filter((target) => target.surfaceRef === surface.surfaceId);
|
|
73
|
+
const primaryLinkedTarget = linkedTargets[0];
|
|
74
|
+
return {
|
|
75
|
+
goalInventoryType: 'scope',
|
|
76
|
+
goalSurfaceId: surface.surfaceId,
|
|
77
|
+
kind: surface.kind,
|
|
78
|
+
label: surface.label,
|
|
79
|
+
capability: 'scope',
|
|
80
|
+
surfaceRef: `scope:${surface.surfaceId}`,
|
|
81
|
+
surfacePriority: linkedTargets.reduce((best, target) => Math.max(best, target.surfacePriority ?? 0), 0) ||
|
|
82
|
+
undefined,
|
|
83
|
+
framePath: surface.framePath,
|
|
84
|
+
frameUrl: surface.frameUrl,
|
|
85
|
+
pageSignature: surface.pageSignature,
|
|
86
|
+
context: primaryLinkedTarget?.context,
|
|
87
|
+
structure: primaryLinkedTarget?.structure,
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
return [...targetCandidates, ...scopeCandidates];
|
|
91
|
+
}
|
|
92
|
+
function isGoalObserveTargetCandidate(candidate) {
|
|
93
|
+
return candidate.goalInventoryType === 'target';
|
|
94
|
+
}
|
|
95
|
+
function isGoalObserveScopeCandidate(candidate) {
|
|
96
|
+
return candidate.goalInventoryType === 'scope';
|
|
97
|
+
}
|
|
98
|
+
export function selectTargetsForGoalMatches(allTargets, rerankedCandidates) {
|
|
99
|
+
const directTargetOrdinals = new Set(rerankedCandidates
|
|
100
|
+
.filter(isGoalObserveTargetCandidate)
|
|
101
|
+
.map((candidate) => candidate.ordinal)
|
|
102
|
+
.filter((value) => typeof value === 'number'));
|
|
103
|
+
const directTargetKeys = new Set(rerankedCandidates
|
|
104
|
+
.filter(isGoalObserveTargetCandidate)
|
|
105
|
+
.map((candidate) => candidate.goalTargetKey)
|
|
106
|
+
.filter((value) => typeof value === 'string' && value.length > 0));
|
|
107
|
+
const selectedSurfaceIds = new Set(rerankedCandidates
|
|
108
|
+
.filter(isGoalObserveScopeCandidate)
|
|
109
|
+
.map((candidate) => candidate.goalSurfaceId));
|
|
110
|
+
const mergedTargets = allTargets.filter((target) => {
|
|
111
|
+
const directMatch = typeof target.ordinal === 'number' && directTargetOrdinals.has(target.ordinal);
|
|
112
|
+
const directKeyMatch = directTargetKeys.has(observedTargetKey(target));
|
|
113
|
+
const scopeMatch = target.surfaceRef ? selectedSurfaceIds.has(target.surfaceRef) : false;
|
|
114
|
+
return directMatch || directKeyMatch || scopeMatch;
|
|
115
|
+
});
|
|
116
|
+
return {
|
|
117
|
+
targets: mergedTargets,
|
|
118
|
+
selectedSurfaceIds,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
export function buildExplicitScopeRefs(selectedSurfaceIds, surfaceRefMap) {
|
|
122
|
+
return new Set([...selectedSurfaceIds]
|
|
123
|
+
.map((surfaceId) => surfaceRefMap.get(surfaceId))
|
|
124
|
+
.filter((value) => typeof value === 'string' && value.length > 0));
|
|
125
|
+
}
|
|
126
|
+
export function projectPersistedTargetsForGoal(domTargets, persistedTargets, selectedTargets) {
|
|
127
|
+
const selectedOrdinals = new Set(selectedTargets
|
|
128
|
+
.map((target) => target.ordinal)
|
|
129
|
+
.filter((value) => typeof value === 'number'));
|
|
130
|
+
const selectedKeys = new Set(selectedTargets.map((target) => observedTargetKey(target)));
|
|
131
|
+
return persistedTargets.filter((target, index) => {
|
|
132
|
+
const domTarget = domTargets[index];
|
|
133
|
+
if (!domTarget) {
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
const ordinalMatch = typeof domTarget.ordinal === 'number' && selectedOrdinals.has(domTarget.ordinal);
|
|
137
|
+
const keyMatch = selectedKeys.has(observedTargetKey(domTarget));
|
|
138
|
+
return ordinalMatch || keyMatch;
|
|
139
|
+
});
|
|
140
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BrowseSession } from '../session.js';
|
|
2
|
+
import type { TargetDescriptor } from '../runtime-state.js';
|
|
3
|
+
export declare function persistProtectedFillableFormsForPage(session: BrowseSession, pageRef: string, pageUrl: string, targets: ReadonlyArray<TargetDescriptor>, observedAt: string): Promise<import("../secrets/types.js").PersistedFillableForm[]>;
|
|
4
|
+
export declare function clearProtectedFillableFormsForPage(session: BrowseSession, pageRef: string): import("../secrets/types.js").PersistedFillableForm[];
|
|
5
|
+
//# sourceMappingURL=observe-protected.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observe-protected.d.ts","sourceRoot":"","sources":["../../src/commands/observe-protected.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAK5D,wBAAsB,oCAAoC,CACxD,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,aAAa,CAAC,gBAAgB,CAAC,EACxC,UAAU,EAAE,MAAM,kEAWnB;AAED,wBAAgB,kCAAkC,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,yDAIzF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { getSecretCatalog, replaceFillableFormsForPage } from '../runtime-state.js';
|
|
2
|
+
import { tryResolveCatalogHost } from '../secrets/catalog-sync.js';
|
|
3
|
+
import { matchStoredSecretsToObservedTargets } from '../secrets/form-matcher.js';
|
|
4
|
+
export async function persistProtectedFillableFormsForPage(session, pageRef, pageUrl, targets, observedAt) {
|
|
5
|
+
const host = tryResolveCatalogHost(pageUrl);
|
|
6
|
+
const catalog = host ? getSecretCatalog(session, host) : null;
|
|
7
|
+
const matchedForms = await matchStoredSecretsToObservedTargets(pageRef, targets, catalog, {
|
|
8
|
+
observedAt,
|
|
9
|
+
});
|
|
10
|
+
return replaceFillableFormsForPage(session, pageRef, matchedForms, {
|
|
11
|
+
preserveExistingOnEmpty: false,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export function clearProtectedFillableFormsForPage(session, pageRef) {
|
|
15
|
+
return replaceFillableFormsForPage(session, pageRef, [], {
|
|
16
|
+
preserveExistingOnEmpty: false,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DomObservedTarget } from './observe-inventory.js';
|
|
2
|
+
export declare function normalizeSemanticDuplicateLabel(target: DomObservedTarget): string;
|
|
3
|
+
export declare function isPrimaryFormControlTarget(target: DomObservedTarget): boolean;
|
|
4
|
+
export declare function formGroupingKeyOf(target: DomObservedTarget): string | undefined;
|
|
5
|
+
export declare function observedTargetKey(target: DomObservedTarget): string;
|
|
6
|
+
export declare function expandRerankedFormTargets(targets: ReadonlyArray<DomObservedTarget>, selectedTargets: ReadonlyArray<DomObservedTarget>): DomObservedTarget[];
|
|
7
|
+
export declare function compressSemanticallyDuplicateTargets(targets: ReadonlyArray<DomObservedTarget>): DomObservedTarget[];
|
|
8
|
+
export declare function annotateDomTargets(targets: ReadonlyArray<DomObservedTarget>): DomObservedTarget[];
|
|
9
|
+
export declare function orderBySurfaceCompetition(targets: ReadonlyArray<DomObservedTarget>): DomObservedTarget[];
|
|
10
|
+
//# sourceMappingURL=observe-semantics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observe-semantics.d.ts","sourceRoot":"","sources":["../../src/commands/observe-semantics.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAGhE,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAYjF;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CA6B7E;AAgBD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,GAAG,SAAS,CAQ/E;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAMnE;AAED,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,aAAa,CAAC,iBAAiB,CAAC,EACzC,eAAe,EAAE,aAAa,CAAC,iBAAiB,CAAC,GAChD,iBAAiB,EAAE,CAyCrB;AAqBD,wBAAgB,oCAAoC,CAClD,OAAO,EAAE,aAAa,CAAC,iBAAiB,CAAC,GACxC,iBAAiB,EAAE,CAuBrB;AAkGD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,aAAa,CAAC,iBAAiB,CAAC,GAAG,iBAAiB,EAAE,CAmDjG;AAED,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,aAAa,CAAC,iBAAiB,CAAC,GACxC,iBAAiB,EAAE,CAsFrB"}
|